@codeyam/codeyam-cli 0.1.0-staging.2a88920 → 0.1.0-staging.2ea44f6

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 (719) 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 +23 -23
  4. package/analyzer-template/packages/ai/index.ts +1 -0
  5. package/analyzer-template/packages/ai/package.json +3 -3
  6. package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +23 -1
  7. package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +34 -3
  8. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.ts +10 -17
  9. package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +101 -0
  10. package/analyzer-template/packages/ai/src/lib/astScopes/sharedPatterns.ts +28 -0
  11. package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +6 -0
  12. package/analyzer-template/packages/ai/src/lib/completionCall.ts +114 -113
  13. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +588 -13
  14. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +5 -1
  15. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +11 -2
  16. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +2 -2
  17. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.ts +70 -0
  18. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.ts +62 -0
  19. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +140 -14
  20. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.ts +20 -1
  21. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +84 -19
  22. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.ts +35 -0
  23. package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +40 -13
  24. package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +58 -3
  25. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +377 -7
  26. package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +101 -2
  27. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +359 -142
  28. package/analyzer-template/packages/ai/src/lib/isolateScopes.ts +51 -3
  29. package/analyzer-template/packages/ai/src/lib/mergeJsonTypeDefinitions.ts +5 -0
  30. package/analyzer-template/packages/ai/src/lib/promptGenerators/collapseNullableObjects.ts +118 -0
  31. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +24 -4
  32. package/analyzer-template/packages/analyze/index.ts +2 -0
  33. package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +19 -7
  34. package/analyzer-template/packages/analyze/src/lib/asts/index.ts +7 -2
  35. package/analyzer-template/packages/analyze/src/lib/asts/nodes/getNodeType.ts +1 -0
  36. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +69 -3
  37. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +13 -0
  38. package/analyzer-template/packages/analyze/src/lib/files/analyze/dependencyResolver.ts +0 -6
  39. package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +12 -0
  40. package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +1352 -0
  41. package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +4 -0
  42. package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +59 -26
  43. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +277 -15
  44. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +0 -98
  45. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +395 -61
  46. package/analyzer-template/packages/analyze/src/lib/index.ts +1 -0
  47. package/analyzer-template/packages/aws/package.json +10 -10
  48. package/analyzer-template/packages/database/index.ts +1 -0
  49. package/analyzer-template/packages/database/package.json +4 -4
  50. package/analyzer-template/packages/database/src/lib/analysisBranchToDb.ts +1 -1
  51. package/analyzer-template/packages/database/src/lib/analysisToDb.ts +1 -1
  52. package/analyzer-template/packages/database/src/lib/branchToDb.ts +1 -1
  53. package/analyzer-template/packages/database/src/lib/commitBranchToDb.ts +1 -1
  54. package/analyzer-template/packages/database/src/lib/commitToDb.ts +1 -1
  55. package/analyzer-template/packages/database/src/lib/fileToDb.ts +1 -1
  56. package/analyzer-template/packages/database/src/lib/kysely/db.ts +14 -0
  57. package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +1 -1
  58. package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +65 -0
  59. package/analyzer-template/packages/database/src/lib/kysely/tables/labsRequestsTable.ts +52 -0
  60. package/analyzer-template/packages/database/src/lib/loadCommits.ts +31 -20
  61. package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +0 -5
  62. package/analyzer-template/packages/database/src/lib/projectToDb.ts +1 -1
  63. package/analyzer-template/packages/database/src/lib/saveFiles.ts +1 -1
  64. package/analyzer-template/packages/database/src/lib/scenarioToDb.ts +1 -1
  65. package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +151 -135
  66. package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatus.ts +58 -42
  67. package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.ts +81 -65
  68. package/analyzer-template/packages/database/src/lib/userScenarioToDb.ts +1 -1
  69. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.ts +29 -1
  70. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.ts +33 -5
  71. package/analyzer-template/packages/github/dist/database/index.d.ts +1 -0
  72. package/analyzer-template/packages/github/dist/database/index.d.ts.map +1 -1
  73. package/analyzer-template/packages/github/dist/database/index.js +1 -0
  74. package/analyzer-template/packages/github/dist/database/index.js.map +1 -1
  75. package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js +1 -1
  76. package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js.map +1 -1
  77. package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js +1 -1
  78. package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js.map +1 -1
  79. package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js +1 -1
  80. package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js.map +1 -1
  81. package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js +1 -1
  82. package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js.map +1 -1
  83. package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js +1 -1
  84. package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js.map +1 -1
  85. package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js +1 -1
  86. package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js.map +1 -1
  87. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +4 -0
  88. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
  89. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +8 -0
  90. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
  91. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts +1 -1
  92. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +21 -0
  93. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -0
  94. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +48 -0
  95. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
  96. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.d.ts +23 -0
  97. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.d.ts.map +1 -0
  98. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
  99. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
  100. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +5 -0
  101. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
  102. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
  103. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +23 -13
  104. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
  105. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +1 -1
  106. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +1 -4
  107. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  108. package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js +1 -1
  109. package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js.map +1 -1
  110. package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js +1 -1
  111. package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js.map +1 -1
  112. package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js +1 -1
  113. package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js.map +1 -1
  114. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
  115. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +100 -89
  116. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
  117. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.d.ts.map +1 -1
  118. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js +41 -30
  119. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
  120. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.d.ts.map +1 -1
  121. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
  122. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
  123. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts.map +1 -1
  124. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +29 -1
  125. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -1
  126. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.d.ts.map +1 -1
  127. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +33 -5
  128. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  129. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts +8 -0
  130. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  131. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +10 -0
  132. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
  133. package/analyzer-template/packages/github/package.json +1 -1
  134. package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +8 -0
  135. package/analyzer-template/packages/types/src/types/Scenario.ts +10 -0
  136. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts +8 -0
  137. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  138. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +10 -0
  139. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
  140. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts.map +1 -1
  141. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js +98 -3
  142. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  143. package/analyzer-template/packages/utils/src/lib/fs/rsyncCopy.ts +121 -3
  144. package/analyzer-template/playwright/captureFromUrl.ts +89 -82
  145. package/analyzer-template/project/constructMockCode.ts +206 -51
  146. package/analyzer-template/project/orchestrateCapture.ts +4 -1
  147. package/analyzer-template/project/reconcileMockDataKeys.ts +19 -14
  148. package/analyzer-template/project/start.ts +3 -0
  149. package/analyzer-template/project/startScenarioCapture.ts +9 -0
  150. package/analyzer-template/project/writeClientLogRoute.ts +125 -0
  151. package/analyzer-template/project/writeMockDataTsx.ts +191 -12
  152. package/analyzer-template/project/writeScenarioComponents.ts +170 -29
  153. package/analyzer-template/project/writeSimpleRoot.ts +21 -11
  154. package/analyzer-template/tsconfig.json +13 -1
  155. package/background/src/lib/local/createLocalAnalyzer.js +1 -1
  156. package/background/src/lib/local/createLocalAnalyzer.js.map +1 -1
  157. package/background/src/lib/virtualized/project/constructMockCode.js +175 -42
  158. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  159. package/background/src/lib/virtualized/project/orchestrateCapture.js +4 -1
  160. package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
  161. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +17 -11
  162. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
  163. package/background/src/lib/virtualized/project/start.js +2 -0
  164. package/background/src/lib/virtualized/project/start.js.map +1 -1
  165. package/background/src/lib/virtualized/project/startScenarioCapture.js +5 -0
  166. package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
  167. package/background/src/lib/virtualized/project/writeClientLogRoute.js +110 -0
  168. package/background/src/lib/virtualized/project/writeClientLogRoute.js.map +1 -0
  169. package/background/src/lib/virtualized/project/writeMockDataTsx.js +168 -8
  170. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  171. package/background/src/lib/virtualized/project/writeScenarioComponents.js +143 -27
  172. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  173. package/background/src/lib/virtualized/project/writeSimpleRoot.js +21 -11
  174. package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
  175. package/codeyam-cli/scripts/apply-setup.js +386 -9
  176. package/codeyam-cli/scripts/apply-setup.js.map +1 -1
  177. package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js +196 -0
  178. package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js.map +1 -0
  179. package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js +114 -0
  180. package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js.map +1 -0
  181. package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js +149 -0
  182. package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js.map +1 -0
  183. package/codeyam-cli/src/cli.js +33 -24
  184. package/codeyam-cli/src/cli.js.map +1 -1
  185. package/codeyam-cli/src/codeyam-cli.js +18 -2
  186. package/codeyam-cli/src/codeyam-cli.js.map +1 -1
  187. package/codeyam-cli/src/commands/analyze.js +21 -9
  188. package/codeyam-cli/src/commands/analyze.js.map +1 -1
  189. package/codeyam-cli/src/commands/baseline.js +2 -0
  190. package/codeyam-cli/src/commands/baseline.js.map +1 -1
  191. package/codeyam-cli/src/commands/debug.js +2 -0
  192. package/codeyam-cli/src/commands/debug.js.map +1 -1
  193. package/codeyam-cli/src/commands/default.js +44 -21
  194. package/codeyam-cli/src/commands/default.js.map +1 -1
  195. package/codeyam-cli/src/commands/editor.js +2322 -0
  196. package/codeyam-cli/src/commands/editor.js.map +1 -0
  197. package/codeyam-cli/src/commands/init.js +81 -260
  198. package/codeyam-cli/src/commands/init.js.map +1 -1
  199. package/codeyam-cli/src/commands/memory.js +97 -92
  200. package/codeyam-cli/src/commands/memory.js.map +1 -1
  201. package/codeyam-cli/src/commands/recapture.js +2 -0
  202. package/codeyam-cli/src/commands/recapture.js.map +1 -1
  203. package/codeyam-cli/src/commands/setup-sandbox.js +2 -0
  204. package/codeyam-cli/src/commands/setup-sandbox.js.map +1 -1
  205. package/codeyam-cli/src/commands/setup-simulations.js +284 -0
  206. package/codeyam-cli/src/commands/setup-simulations.js.map +1 -0
  207. package/codeyam-cli/src/commands/test-startup.js +2 -0
  208. package/codeyam-cli/src/commands/test-startup.js.map +1 -1
  209. package/codeyam-cli/src/commands/verify.js +14 -2
  210. package/codeyam-cli/src/commands/verify.js.map +1 -1
  211. package/codeyam-cli/src/utils/__tests__/devServerState.test.js +134 -0
  212. package/codeyam-cli/src/utils/__tests__/devServerState.test.js.map +1 -0
  213. package/codeyam-cli/src/utils/__tests__/editorApi.test.js +127 -0
  214. package/codeyam-cli/src/utils/__tests__/editorApi.test.js.map +1 -0
  215. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +480 -0
  216. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -0
  217. package/codeyam-cli/src/utils/__tests__/editorCapture.test.js +93 -0
  218. package/codeyam-cli/src/utils/__tests__/editorCapture.test.js.map +1 -0
  219. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js +155 -0
  220. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js.map +1 -0
  221. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js +121 -0
  222. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js.map +1 -0
  223. package/codeyam-cli/src/utils/__tests__/editorImageVerifier.test.js +166 -0
  224. package/codeyam-cli/src/utils/__tests__/editorImageVerifier.test.js.map +1 -0
  225. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js +306 -0
  226. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js.map +1 -0
  227. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js +393 -0
  228. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js.map +1 -0
  229. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js +270 -0
  230. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js.map +1 -0
  231. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js +217 -0
  232. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js.map +1 -0
  233. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +167 -0
  234. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -0
  235. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +174 -0
  236. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -0
  237. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +1493 -0
  238. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -0
  239. package/codeyam-cli/src/utils/__tests__/git.editor.test.js +134 -0
  240. package/codeyam-cli/src/utils/__tests__/git.editor.test.js.map +1 -0
  241. package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js +185 -0
  242. package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js.map +1 -0
  243. package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js +9 -0
  244. package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js.map +1 -1
  245. package/codeyam-cli/src/utils/__tests__/project.test.js +65 -0
  246. package/codeyam-cli/src/utils/__tests__/project.test.js.map +1 -0
  247. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js +121 -0
  248. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js.map +1 -0
  249. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js +246 -0
  250. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js.map +1 -0
  251. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +166 -86
  252. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
  253. package/codeyam-cli/src/utils/analyzer.js +7 -0
  254. package/codeyam-cli/src/utils/analyzer.js.map +1 -1
  255. package/codeyam-cli/src/utils/backgroundServer.js +109 -22
  256. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  257. package/codeyam-cli/src/utils/buildFlags.js +4 -0
  258. package/codeyam-cli/src/utils/buildFlags.js.map +1 -0
  259. package/codeyam-cli/src/utils/devModeEvents.js +40 -0
  260. package/codeyam-cli/src/utils/devModeEvents.js.map +1 -0
  261. package/codeyam-cli/src/utils/devServerState.js +71 -0
  262. package/codeyam-cli/src/utils/devServerState.js.map +1 -0
  263. package/codeyam-cli/src/utils/editorApi.js +73 -0
  264. package/codeyam-cli/src/utils/editorApi.js.map +1 -0
  265. package/codeyam-cli/src/utils/editorAudit.js +122 -0
  266. package/codeyam-cli/src/utils/editorAudit.js.map +1 -0
  267. package/codeyam-cli/src/utils/editorCapture.js +102 -0
  268. package/codeyam-cli/src/utils/editorCapture.js.map +1 -0
  269. package/codeyam-cli/src/utils/editorDevServer.js +109 -0
  270. package/codeyam-cli/src/utils/editorDevServer.js.map +1 -0
  271. package/codeyam-cli/src/utils/editorEntityChangeStatus.js +44 -0
  272. package/codeyam-cli/src/utils/editorEntityChangeStatus.js.map +1 -0
  273. package/codeyam-cli/src/utils/editorImageVerifier.js +120 -0
  274. package/codeyam-cli/src/utils/editorImageVerifier.js.map +1 -0
  275. package/codeyam-cli/src/utils/editorJournal.js +150 -0
  276. package/codeyam-cli/src/utils/editorJournal.js.map +1 -0
  277. package/codeyam-cli/src/utils/editorLoaderHelpers.js +81 -0
  278. package/codeyam-cli/src/utils/editorLoaderHelpers.js.map +1 -0
  279. package/codeyam-cli/src/utils/editorMockState.js +248 -0
  280. package/codeyam-cli/src/utils/editorMockState.js.map +1 -0
  281. package/codeyam-cli/src/utils/editorPreloadHelpers.js +135 -0
  282. package/codeyam-cli/src/utils/editorPreloadHelpers.js.map +1 -0
  283. package/codeyam-cli/src/utils/editorPreview.js +96 -0
  284. package/codeyam-cli/src/utils/editorPreview.js.map +1 -0
  285. package/codeyam-cli/src/utils/editorScenarios.js +96 -0
  286. package/codeyam-cli/src/utils/editorScenarios.js.map +1 -0
  287. package/codeyam-cli/src/utils/entityChangeStatus.js +326 -0
  288. package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -0
  289. package/codeyam-cli/src/utils/entityChangeStatus.server.js +107 -0
  290. package/codeyam-cli/src/utils/entityChangeStatus.server.js.map +1 -0
  291. package/codeyam-cli/src/utils/fileMetadata.js +5 -0
  292. package/codeyam-cli/src/utils/fileMetadata.js.map +1 -1
  293. package/codeyam-cli/src/utils/fileWatcher.js +25 -9
  294. package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
  295. package/codeyam-cli/src/utils/generateReport.js +2 -2
  296. package/codeyam-cli/src/utils/git.js +103 -0
  297. package/codeyam-cli/src/utils/git.js.map +1 -1
  298. package/codeyam-cli/src/utils/install-skills.js +101 -56
  299. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  300. package/codeyam-cli/src/utils/interactiveSyncWatcher.js +126 -0
  301. package/codeyam-cli/src/utils/interactiveSyncWatcher.js.map +1 -0
  302. package/codeyam-cli/src/utils/labsAutoCheck.js +19 -0
  303. package/codeyam-cli/src/utils/labsAutoCheck.js.map +1 -0
  304. package/codeyam-cli/src/utils/npmVersionCheck.js +76 -0
  305. package/codeyam-cli/src/utils/npmVersionCheck.js.map +1 -0
  306. package/codeyam-cli/src/utils/pathIgnoring.js +19 -7
  307. package/codeyam-cli/src/utils/pathIgnoring.js.map +1 -1
  308. package/codeyam-cli/src/utils/progress.js +7 -0
  309. package/codeyam-cli/src/utils/progress.js.map +1 -1
  310. package/codeyam-cli/src/utils/project.js +15 -5
  311. package/codeyam-cli/src/utils/project.js.map +1 -1
  312. package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js +11 -11
  313. package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js.map +1 -1
  314. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js +22 -0
  315. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js.map +1 -1
  316. package/codeyam-cli/src/utils/queue/heartbeat.js +13 -5
  317. package/codeyam-cli/src/utils/queue/heartbeat.js.map +1 -1
  318. package/codeyam-cli/src/utils/queue/job.js +74 -1
  319. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  320. package/codeyam-cli/src/utils/queue/manager.js +7 -6
  321. package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
  322. package/codeyam-cli/src/utils/requireSimulations.js +10 -0
  323. package/codeyam-cli/src/utils/requireSimulations.js.map +1 -0
  324. package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js +82 -0
  325. package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js.map +1 -0
  326. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js +229 -0
  327. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js.map +1 -0
  328. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +67 -0
  329. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -0
  330. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js +105 -0
  331. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js.map +1 -0
  332. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js +34 -0
  333. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js.map +1 -0
  334. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js +162 -0
  335. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js.map +1 -0
  336. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +74 -0
  337. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -0
  338. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +376 -0
  339. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -0
  340. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +113 -0
  341. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -0
  342. package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js +127 -0
  343. package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js.map +1 -0
  344. package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js +50 -0
  345. package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js.map +1 -0
  346. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js +116 -0
  347. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js.map +1 -0
  348. package/codeyam-cli/src/utils/ruleReflection/index.js +5 -0
  349. package/codeyam-cli/src/utils/ruleReflection/index.js.map +1 -0
  350. package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js +44 -0
  351. package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js.map +1 -0
  352. package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js +85 -0
  353. package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js.map +1 -0
  354. package/codeyam-cli/src/utils/ruleReflection/types.js +5 -0
  355. package/codeyam-cli/src/utils/ruleReflection/types.js.map +1 -0
  356. package/codeyam-cli/src/utils/rules/__tests__/parser.test.js +83 -0
  357. package/codeyam-cli/src/utils/rules/__tests__/parser.test.js.map +1 -0
  358. package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js +118 -0
  359. package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js.map +1 -0
  360. package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js +72 -0
  361. package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js.map +1 -0
  362. package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js +293 -0
  363. package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js.map +1 -0
  364. package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js +76 -0
  365. package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js.map +1 -0
  366. package/codeyam-cli/src/utils/rules/index.js +2 -0
  367. package/codeyam-cli/src/utils/rules/index.js.map +1 -1
  368. package/codeyam-cli/src/utils/rules/parser.js +16 -29
  369. package/codeyam-cli/src/utils/rules/parser.js.map +1 -1
  370. package/codeyam-cli/src/utils/rules/pathMatcher.js +34 -3
  371. package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -1
  372. package/codeyam-cli/src/utils/rules/rulePlacement.js +65 -0
  373. package/codeyam-cli/src/utils/rules/rulePlacement.js.map +1 -0
  374. package/codeyam-cli/src/utils/rules/ruleState.js +150 -0
  375. package/codeyam-cli/src/utils/rules/ruleState.js.map +1 -0
  376. package/codeyam-cli/src/utils/rules/sourceFiles.js +43 -0
  377. package/codeyam-cli/src/utils/rules/sourceFiles.js.map +1 -0
  378. package/codeyam-cli/src/utils/rules/staleness.js +16 -11
  379. package/codeyam-cli/src/utils/rules/staleness.js.map +1 -1
  380. package/codeyam-cli/src/utils/scenarioMarkers.js +134 -0
  381. package/codeyam-cli/src/utils/scenarioMarkers.js.map +1 -0
  382. package/codeyam-cli/src/utils/scenariosManifest.js +112 -0
  383. package/codeyam-cli/src/utils/scenariosManifest.js.map +1 -0
  384. package/codeyam-cli/src/utils/serverState.js +64 -12
  385. package/codeyam-cli/src/utils/serverState.js.map +1 -1
  386. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +83 -43
  387. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  388. package/codeyam-cli/src/utils/simulationGateMiddleware.js +159 -0
  389. package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -0
  390. package/codeyam-cli/src/utils/syncMocksMiddleware.js +5 -24
  391. package/codeyam-cli/src/utils/syncMocksMiddleware.js.map +1 -1
  392. package/codeyam-cli/src/utils/testRunner.js +158 -0
  393. package/codeyam-cli/src/utils/testRunner.js.map +1 -0
  394. package/codeyam-cli/src/utils/transcriptPruning.js +67 -0
  395. package/codeyam-cli/src/utils/transcriptPruning.js.map +1 -0
  396. package/codeyam-cli/src/utils/versionInfo.js +46 -0
  397. package/codeyam-cli/src/utils/versionInfo.js.map +1 -1
  398. package/codeyam-cli/src/utils/webappDetection.js +14 -2
  399. package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
  400. package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js +66 -0
  401. package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js.map +1 -0
  402. package/codeyam-cli/src/webserver/app/lib/database.js +56 -30
  403. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  404. package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
  405. package/codeyam-cli/src/webserver/app/lib/git.js +396 -0
  406. package/codeyam-cli/src/webserver/app/lib/git.js.map +1 -0
  407. package/codeyam-cli/src/webserver/backgroundServer.js +166 -16
  408. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  409. package/codeyam-cli/src/webserver/bootstrap.js +11 -0
  410. package/codeyam-cli/src/webserver/bootstrap.js.map +1 -1
  411. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-DmJveP3T.js +1 -0
  412. package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-DsN1wKrm.js → EntityItem-C76mRRiF.js} +1 -1
  413. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-DLqD3qNt.js → EntityTypeBadge-g3saevPb.js} +1 -1
  414. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-Ba2JVPzP.js → EntityTypeIcon-CobE682z.js} +1 -1
  415. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-Bu6c6aDe.js +1 -0
  416. package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-aht4aafF.js → InteractivePreview-DYFW3lDD.js} +3 -3
  417. package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-CVtiBnY5.js → LibraryFunctionPreview-DLeucoVX.js} +1 -1
  418. package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-B0GLXMsr.js → LoadingDots-BU_OAEMP.js} +1 -1
  419. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-xgeCVgSM.js → LogViewer-ceAyBX-H.js} +1 -1
  420. package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-OApQuNyq.js → ReportIssueModal-djPLI-WV.js} +3 -8
  421. package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-DuDvi0jm.js → SafeScreenshot-BED4B6sP.js} +1 -1
  422. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-DzccYyI8.js → ScenarioViewer-ZlRKbhrq.js} +3 -3
  423. package/codeyam-cli/src/webserver/build/client/assets/Spinner-Bb5uFQ5V.js +34 -0
  424. package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-DyFZkK0l.js → TruncatedFilePath-C8OKAR5x.js} +1 -1
  425. package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-oAf2Kqsf.js +1 -0
  426. package/codeyam-cli/src/webserver/build/client/assets/{_index-BwqWJOgH.js → _index-C96V0n15.js} +1 -1
  427. package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-BwavGCpm.js → activity.(_tab)-BpKzcsJz.js} +6 -11
  428. package/codeyam-cli/src/webserver/build/client/assets/addon-canvas-DpzMmAy5.js +1 -0
  429. package/codeyam-cli/src/webserver/build/client/assets/addon-fit-YJmn1quW.js +12 -0
  430. package/codeyam-cli/src/webserver/build/client/assets/addon-web-links-Duc5hnl7.js +1 -0
  431. package/codeyam-cli/src/webserver/build/client/assets/addon-webgl-DI8QOUvO.js +58 -0
  432. package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-D9hemwl6.js +22 -0
  433. package/codeyam-cli/src/webserver/build/client/assets/api.agent-transcripts-l0sNRNKZ.js +1 -0
  434. package/codeyam-cli/src/webserver/build/client/assets/api.dev-mode-events-l0sNRNKZ.js +1 -0
  435. package/codeyam-cli/src/webserver/build/client/assets/api.editor-audit-l0sNRNKZ.js +1 -0
  436. package/codeyam-cli/src/webserver/build/client/assets/api.editor-capture-scenario-l0sNRNKZ.js +1 -0
  437. package/codeyam-cli/src/webserver/build/client/assets/api.editor-client-errors-l0sNRNKZ.js +1 -0
  438. package/codeyam-cli/src/webserver/build/client/assets/api.editor-commit-l0sNRNKZ.js +1 -0
  439. package/codeyam-cli/src/webserver/build/client/assets/api.editor-dev-server-l0sNRNKZ.js +1 -0
  440. package/codeyam-cli/src/webserver/build/client/assets/api.editor-entity-status-l0sNRNKZ.js +1 -0
  441. package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-diff-l0sNRNKZ.js +1 -0
  442. package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-l0sNRNKZ.js +1 -0
  443. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-entry-l0sNRNKZ.js +1 -0
  444. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-image._-l0sNRNKZ.js +1 -0
  445. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-l0sNRNKZ.js +1 -0
  446. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-screenshot-l0sNRNKZ.js +1 -0
  447. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-update-l0sNRNKZ.js +1 -0
  448. package/codeyam-cli/src/webserver/build/client/assets/api.editor-load-commit-l0sNRNKZ.js +1 -0
  449. package/codeyam-cli/src/webserver/build/client/assets/api.editor-refresh-l0sNRNKZ.js +1 -0
  450. package/codeyam-cli/src/webserver/build/client/assets/api.editor-register-scenario-l0sNRNKZ.js +1 -0
  451. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-data-l0sNRNKZ.js +1 -0
  452. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-image._-l0sNRNKZ.js +1 -0
  453. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenarios-l0sNRNKZ.js +1 -0
  454. package/codeyam-cli/src/webserver/build/client/assets/api.editor-switch-scenario-l0sNRNKZ.js +1 -0
  455. package/codeyam-cli/src/webserver/build/client/assets/api.editor-test-results-l0sNRNKZ.js +1 -0
  456. package/codeyam-cli/src/webserver/build/client/assets/api.labs-unlock-l0sNRNKZ.js +1 -0
  457. package/codeyam-cli/src/webserver/build/client/assets/api.rule-path-l0sNRNKZ.js +1 -0
  458. package/codeyam-cli/src/webserver/build/client/assets/api.save-fixture-l0sNRNKZ.js +1 -0
  459. package/codeyam-cli/src/webserver/build/client/assets/book-open-D_nMCFmP.js +6 -0
  460. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-Cx24_aWc.js → chevron-down-BH2h1Ea2.js} +1 -1
  461. package/codeyam-cli/src/webserver/build/client/assets/{chunk-EPOLDU6W-CXRTFQ3F.js → chunk-JZWAC4HX-C4pqxYJB.js} +12 -12
  462. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-BOARzkeR.js → circle-check-DyIKORY6.js} +1 -1
  463. package/codeyam-cli/src/webserver/build/client/assets/copy-NDbZjXao.js +11 -0
  464. package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-BdhJEx6B.js → createLucideIcon-CMT1jU2q.js} +1 -1
  465. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-CltMNppm.js +1 -0
  466. package/codeyam-cli/src/webserver/build/client/assets/editor-Rfq_y0VR.js +10 -0
  467. package/codeyam-cli/src/webserver/build/client/assets/editorPreview-GNwaLSmC.js +41 -0
  468. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-BJUiQqZF.js → entity._sha._-DItJnD8s.js} +11 -11
  469. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-CCa2trIL.js +6 -0
  470. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-CF164ouH.js +6 -0
  471. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-p9hhkjJM.js +6 -0
  472. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-CTBG2mmz.js → entity._sha_.edit._scenarioId-BMvVHNXU.js} +2 -2
  473. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-CS2cb_eZ.js → entry.client-DTvKq3TY.js} +1 -1
  474. package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-DMJ7zii9.js → fileTableUtils-cPo8LiG3.js} +1 -1
  475. package/codeyam-cli/src/webserver/build/client/assets/{files-CJ6lTdTA.js → files-DO4CZ16O.js} +1 -1
  476. package/codeyam-cli/src/webserver/build/client/assets/git-CdN8sCqs.js +1 -0
  477. package/codeyam-cli/src/webserver/build/client/assets/globals-Bd0cs8vw.css +1 -0
  478. package/codeyam-cli/src/webserver/build/client/assets/{index-B1h680n5.js → index-10oVnAAH.js} +1 -1
  479. package/codeyam-cli/src/webserver/build/client/assets/{index-lzqtyFU8.js → index-BcvgDzbZ.js} +1 -1
  480. package/codeyam-cli/src/webserver/build/client/assets/index-yHOVb4rc.js +15 -0
  481. package/codeyam-cli/src/webserver/build/client/assets/labs-Zk7ryIM1.js +1 -0
  482. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-B7B9V-bu.js → loader-circle-BAXYRVEO.js} +1 -1
  483. package/codeyam-cli/src/webserver/build/client/assets/manifest-9ab0aba3.js +1 -0
  484. package/codeyam-cli/src/webserver/build/client/assets/memory-Dg0mvYrI.js +96 -0
  485. package/codeyam-cli/src/webserver/build/client/assets/pause-DTAcYxBt.js +11 -0
  486. package/codeyam-cli/src/webserver/build/client/assets/root-3ciuWk-c.js +67 -0
  487. package/codeyam-cli/src/webserver/build/client/assets/{search-CxXUmBSd.js → search-fKo7v0Zo.js} +1 -1
  488. package/codeyam-cli/src/webserver/build/client/assets/settings-DfuTtcJP.js +1 -0
  489. package/codeyam-cli/src/webserver/build/client/assets/{simulations-DwFIBT09.js → simulations-B3aOzpCZ.js} +1 -1
  490. package/codeyam-cli/src/webserver/build/client/assets/terminal-BG4heKCG.js +11 -0
  491. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-B6LgvRJg.js → triangle-alert-DtSmdtM4.js} +1 -1
  492. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-CrAK28Bc.js +1 -0
  493. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-C14nCb1q.js +2 -0
  494. package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-DYxHZQuP.js → useReportContext-O-jkvSPx.js} +1 -1
  495. package/codeyam-cli/src/webserver/build/client/assets/{useToast-mBRpZPiu.js → useToast-9FIWuYfK.js} +1 -1
  496. package/codeyam-cli/src/webserver/build/client/assets/xterm-BqvuqXEL.js +27 -0
  497. package/codeyam-cli/src/webserver/build/server/assets/index-DCxIbVvl.js +1 -0
  498. package/codeyam-cli/src/webserver/build/server/assets/server-build-E-peu3XZ.js +367 -0
  499. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  500. package/codeyam-cli/src/webserver/build-info.json +5 -5
  501. package/codeyam-cli/src/webserver/devServer.js +39 -5
  502. package/codeyam-cli/src/webserver/devServer.js.map +1 -1
  503. package/codeyam-cli/src/webserver/editorProxy.js +407 -0
  504. package/codeyam-cli/src/webserver/editorProxy.js.map +1 -0
  505. package/codeyam-cli/src/webserver/scripts/codeyam-preload.mjs +396 -0
  506. package/codeyam-cli/src/webserver/scripts/journalCapture.ts +140 -0
  507. package/codeyam-cli/src/webserver/server.js +275 -1
  508. package/codeyam-cli/src/webserver/server.js.map +1 -1
  509. package/codeyam-cli/src/webserver/terminalServer.js +703 -0
  510. package/codeyam-cli/src/webserver/terminalServer.js.map +1 -0
  511. package/codeyam-cli/templates/codeyam-editor-claude.md +68 -0
  512. package/codeyam-cli/templates/codeyam-memory-hook.sh +19 -20
  513. package/codeyam-cli/templates/commands/codeyam-diagnose.md +481 -0
  514. package/codeyam-cli/templates/editor-step-hook.py +208 -0
  515. package/codeyam-cli/templates/hooks/staleness-check.sh +43 -0
  516. package/codeyam-cli/templates/isolation-route/next-app.tsx.template +80 -0
  517. package/codeyam-cli/templates/isolation-route/next-pages.tsx.template +79 -0
  518. package/codeyam-cli/templates/isolation-route/vite-react.tsx.template +78 -0
  519. package/codeyam-cli/templates/msw/browser-setup.ts.template +47 -0
  520. package/codeyam-cli/templates/msw/handler-router.ts.template +47 -0
  521. package/codeyam-cli/templates/msw/server-setup.ts.template +52 -0
  522. package/codeyam-cli/templates/nextjs-prisma-sqlite/PRISMA_SETUP.md +84 -0
  523. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/api/todos/route.ts +17 -0
  524. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/codeyam-isolate/layout.tsx +12 -0
  525. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/globals.css +26 -0
  526. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/layout.tsx +34 -0
  527. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/lib/prisma.ts +19 -0
  528. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/page.tsx +10 -0
  529. package/codeyam-cli/templates/nextjs-prisma-sqlite/eslint.config.mjs +11 -0
  530. package/codeyam-cli/templates/nextjs-prisma-sqlite/gitignore +63 -0
  531. package/codeyam-cli/templates/nextjs-prisma-sqlite/next.config.ts +14 -0
  532. package/codeyam-cli/templates/nextjs-prisma-sqlite/package.json +38 -0
  533. package/codeyam-cli/templates/nextjs-prisma-sqlite/postcss.config.mjs +7 -0
  534. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/schema.prisma +27 -0
  535. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/seed.ts +37 -0
  536. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma.config.ts +12 -0
  537. package/codeyam-cli/templates/nextjs-prisma-sqlite/tsconfig.json +34 -0
  538. package/codeyam-cli/templates/nextjs-prisma-sqlite/vitest.config.ts +13 -0
  539. package/codeyam-cli/templates/prompts/conversation-guidance.txt +44 -0
  540. package/codeyam-cli/templates/prompts/conversation-prompt.txt +28 -0
  541. package/codeyam-cli/templates/prompts/interruption-prompt.txt +31 -0
  542. package/codeyam-cli/templates/prompts/stale-rules-prompt.txt +24 -0
  543. package/codeyam-cli/templates/rule-notification-hook.py +83 -0
  544. package/codeyam-cli/templates/rule-reflection-hook.py +574 -87
  545. package/codeyam-cli/templates/rules-instructions.md +45 -60
  546. package/codeyam-cli/templates/{codeyam:debug.md → skills/codeyam-debug/SKILL.md} +1 -1
  547. package/codeyam-cli/templates/skills/codeyam-dev-mode/SKILL.md +237 -0
  548. package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +130 -0
  549. package/codeyam-cli/templates/skills/codeyam-memory/SKILL.md +611 -0
  550. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/deprecated-prompt.md +100 -0
  551. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/detect-deprecated-patterns.mjs +139 -0
  552. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/find-exports.mjs +52 -0
  553. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/misleading-api-prompt.md +117 -0
  554. package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/read-json-field.mjs +61 -0
  555. package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/ripgrep-fallback.mjs +155 -0
  556. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/analyze-prompt.md +46 -0
  557. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/cleanup.mjs +13 -0
  558. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/filter-session.mjs +95 -0
  559. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/preprocess.mjs +160 -0
  560. package/codeyam-cli/templates/skills/codeyam-new-rule/SKILL.md +11 -0
  561. package/codeyam-cli/templates/{codeyam:setup.md → skills/codeyam-setup/SKILL.md} +13 -1
  562. package/codeyam-cli/templates/{codeyam:sim.md → skills/codeyam-sim/SKILL.md} +1 -1
  563. package/codeyam-cli/templates/{codeyam:test.md → skills/codeyam-test/SKILL.md} +1 -1
  564. package/codeyam-cli/templates/{codeyam:verify.md → skills/codeyam-verify/SKILL.md} +1 -1
  565. package/package.json +28 -21
  566. package/packages/ai/index.js +1 -1
  567. package/packages/ai/index.js.map +1 -1
  568. package/packages/ai/src/lib/analyzeScope.js +21 -1
  569. package/packages/ai/src/lib/analyzeScope.js.map +1 -1
  570. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +22 -4
  571. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
  572. package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js +10 -14
  573. package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js.map +1 -1
  574. package/packages/ai/src/lib/astScopes/processExpression.js +78 -1
  575. package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
  576. package/packages/ai/src/lib/astScopes/sharedPatterns.js +25 -0
  577. package/packages/ai/src/lib/astScopes/sharedPatterns.js.map +1 -1
  578. package/packages/ai/src/lib/completionCall.js +10 -7
  579. package/packages/ai/src/lib/completionCall.js.map +1 -1
  580. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +495 -10
  581. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  582. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +5 -1
  583. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
  584. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +11 -2
  585. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
  586. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +2 -2
  587. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
  588. package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js +63 -0
  589. package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js.map +1 -0
  590. package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js +54 -0
  591. package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js.map +1 -0
  592. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +122 -12
  593. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
  594. package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js +15 -1
  595. package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js.map +1 -1
  596. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +78 -17
  597. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
  598. package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js +34 -0
  599. package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js.map +1 -0
  600. package/packages/ai/src/lib/dataStructureChunking.js +30 -11
  601. package/packages/ai/src/lib/dataStructureChunking.js.map +1 -1
  602. package/packages/ai/src/lib/generateEntityDataStructure.js +46 -2
  603. package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
  604. package/packages/ai/src/lib/generateEntityScenarioData.js +269 -5
  605. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  606. package/packages/ai/src/lib/generateExecutionFlows.js +86 -2
  607. package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -1
  608. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +242 -81
  609. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -1
  610. package/packages/ai/src/lib/isolateScopes.js +39 -3
  611. package/packages/ai/src/lib/isolateScopes.js.map +1 -1
  612. package/packages/ai/src/lib/mergeJsonTypeDefinitions.js +5 -0
  613. package/packages/ai/src/lib/mergeJsonTypeDefinitions.js.map +1 -1
  614. package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js +97 -0
  615. package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js.map +1 -0
  616. package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +17 -2
  617. package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
  618. package/packages/analyze/index.js +1 -0
  619. package/packages/analyze/index.js.map +1 -1
  620. package/packages/analyze/src/lib/ProjectAnalyzer.js +13 -4
  621. package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
  622. package/packages/analyze/src/lib/asts/index.js +4 -2
  623. package/packages/analyze/src/lib/asts/index.js.map +1 -1
  624. package/packages/analyze/src/lib/asts/nodes/getNodeType.js +1 -0
  625. package/packages/analyze/src/lib/asts/nodes/getNodeType.js.map +1 -1
  626. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +52 -2
  627. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
  628. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +10 -0
  629. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  630. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js +0 -5
  631. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js.map +1 -1
  632. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +9 -0
  633. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
  634. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +907 -0
  635. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -0
  636. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +5 -1
  637. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -1
  638. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +51 -14
  639. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
  640. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +181 -13
  641. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  642. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +0 -40
  643. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -1
  644. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +328 -49
  645. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  646. package/packages/analyze/src/lib/index.js +1 -0
  647. package/packages/analyze/src/lib/index.js.map +1 -1
  648. package/packages/database/index.js +1 -0
  649. package/packages/database/index.js.map +1 -1
  650. package/packages/database/src/lib/analysisBranchToDb.js +1 -1
  651. package/packages/database/src/lib/analysisBranchToDb.js.map +1 -1
  652. package/packages/database/src/lib/analysisToDb.js +1 -1
  653. package/packages/database/src/lib/analysisToDb.js.map +1 -1
  654. package/packages/database/src/lib/branchToDb.js +1 -1
  655. package/packages/database/src/lib/branchToDb.js.map +1 -1
  656. package/packages/database/src/lib/commitBranchToDb.js +1 -1
  657. package/packages/database/src/lib/commitBranchToDb.js.map +1 -1
  658. package/packages/database/src/lib/commitToDb.js +1 -1
  659. package/packages/database/src/lib/commitToDb.js.map +1 -1
  660. package/packages/database/src/lib/fileToDb.js +1 -1
  661. package/packages/database/src/lib/fileToDb.js.map +1 -1
  662. package/packages/database/src/lib/kysely/db.js +8 -0
  663. package/packages/database/src/lib/kysely/db.js.map +1 -1
  664. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +48 -0
  665. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
  666. package/packages/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
  667. package/packages/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
  668. package/packages/database/src/lib/loadCommits.js +23 -13
  669. package/packages/database/src/lib/loadCommits.js.map +1 -1
  670. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +1 -4
  671. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  672. package/packages/database/src/lib/projectToDb.js +1 -1
  673. package/packages/database/src/lib/projectToDb.js.map +1 -1
  674. package/packages/database/src/lib/saveFiles.js +1 -1
  675. package/packages/database/src/lib/saveFiles.js.map +1 -1
  676. package/packages/database/src/lib/scenarioToDb.js +1 -1
  677. package/packages/database/src/lib/scenarioToDb.js.map +1 -1
  678. package/packages/database/src/lib/updateCommitMetadata.js +100 -89
  679. package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
  680. package/packages/database/src/lib/updateFreshAnalysisStatus.js +41 -30
  681. package/packages/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
  682. package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
  683. package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
  684. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +29 -1
  685. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -1
  686. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +33 -5
  687. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  688. package/packages/utils/src/lib/fs/rsyncCopy.js +98 -3
  689. package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  690. package/scripts/npm-post-install.cjs +34 -0
  691. package/codeyam-cli/src/commands/detect-universal-mocks.js +0 -118
  692. package/codeyam-cli/src/commands/detect-universal-mocks.js.map +0 -1
  693. package/codeyam-cli/src/commands/list.js +0 -31
  694. package/codeyam-cli/src/commands/list.js.map +0 -1
  695. package/codeyam-cli/src/commands/webapp-info.js +0 -146
  696. package/codeyam-cli/src/commands/webapp-info.js.map +0 -1
  697. package/codeyam-cli/src/utils/universal-mocks.js +0 -152
  698. package/codeyam-cli/src/utils/universal-mocks.js.map +0 -1
  699. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-C8lyxW9k.js +0 -34
  700. package/codeyam-cli/src/webserver/build/client/assets/copy-Bb-80kDT.js +0 -6
  701. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-BBnGWYga.js +0 -1
  702. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DavjRmOY.js +0 -6
  703. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-D1T4TGjf.js +0 -6
  704. package/codeyam-cli/src/webserver/build/client/assets/file-code-Dhef1kWN.js +0 -6
  705. package/codeyam-cli/src/webserver/build/client/assets/git-CPTZZ-JZ.js +0 -15
  706. package/codeyam-cli/src/webserver/build/client/assets/globals-D3yhhV8x.css +0 -1
  707. package/codeyam-cli/src/webserver/build/client/assets/manifest-a78b90a2.js +0 -1
  708. package/codeyam-cli/src/webserver/build/client/assets/memory--GCbFsBE.js +0 -92
  709. package/codeyam-cli/src/webserver/build/client/assets/root-eVAaavTS.js +0 -62
  710. package/codeyam-cli/src/webserver/build/client/assets/settings-CS5f3WzT.js +0 -1
  711. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-C1v1PQzo.js +0 -1
  712. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-aSv48UbS.js +0 -2
  713. package/codeyam-cli/src/webserver/build/server/assets/index-BM6TDT1Y.js +0 -1
  714. package/codeyam-cli/src/webserver/build/server/assets/server-build-dYC34MHw.js +0 -257
  715. package/codeyam-cli/templates/codeyam-stop-hook.sh +0 -284
  716. package/codeyam-cli/templates/codeyam:diagnose.md +0 -803
  717. package/codeyam-cli/templates/codeyam:memory.md +0 -341
  718. package/codeyam-cli/templates/codeyam:new-rule.md +0 -13
  719. package/scripts/finalize-analyzer.cjs +0 -81
@@ -1,4 +1,4 @@
1
- import{c}from"./createLucideIcon-BdhJEx6B.js";/**
1
+ import{c}from"./createLucideIcon-CMT1jU2q.js";/**
2
2
  * @license lucide-react v0.556.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1,11 @@
1
+ import{c}from"./createLucideIcon-CMT1jU2q.js";/**
2
+ * @license lucide-react v0.556.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 e=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],a=c("check",e);/**
7
+ * @license lucide-react v0.556.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 o=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],h=c("copy",o);export{a as C,h as a};
@@ -1,4 +1,4 @@
1
- import{r as s}from"./chunk-EPOLDU6W-CXRTFQ3F.js";/**
1
+ import{r as s}from"./chunk-JZWAC4HX-C4pqxYJB.js";/**
2
2
  * @license lucide-react v0.556.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -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-ZlRKbhrq.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-djPLI-WV.js";import"./createLucideIcon-CMT1jU2q.js";import"./circle-check-DyIKORY6.js";import"./triangle-alert-DtSmdtM4.js";import"./copy-NDbZjXao.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 nt=Object.defineProperty;var it=(t,s,a)=>s in t?nt(t,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[s]=a;var Ce=(t,s,a)=>it(t,typeof s!="symbol"?s+"":s,a);import{r as i,j as e,w as lt,u as ot,f as ct,b as dt}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{u as xt,S as mt}from"./useCustomSizes-CrAK28Bc.js";import{g as ee,c as pt,b as ht,a as ut,T as ft,D as gt}from"./editorPreview-GNwaLSmC.js";import{C as ue}from"./CopyButton-DmJveP3T.js";import{_ as jt}from"./preload-helper-ckwbz45p.js";import{c as vt}from"./cy-logo-cli-DcX-ZS3p.js";import{u as bt,S as Pe}from"./Spinner-Bb5uFQ5V.js";import"./copy-NDbZjXao.js";import"./createLucideIcon-CMT1jU2q.js";import"./useLastLogLine-C14nCb1q.js";function fe(t){const[s,a]=i.useState(null),[c,h]=i.useState(!1),m=i.useCallback(()=>{t&&(h(!0),fetch(`/api/editor-test-results?testFile=${encodeURIComponent(t)}`).then(x=>x.json()).then(x=>{a(x),h(!1)}).catch(()=>{a({testFilePath:t,status:"error",testCases:[],errorMessage:"Failed to fetch test results"}),h(!1)}))},[t]);return i.useEffect(()=>{t&&m()},[t,m]),{results:s,isRunning:c,runTests:m}}function se(t){if(!t||t==="/")return"Home";const a=t.split("?")[0].replace(/^\//,"").split("/")[0];return a.charAt(0).toUpperCase()+a.slice(1)}function he(t,s){return!s||Object.keys(s).length===0?t:t.filter(([a])=>s[a])}function Nt(t,s){return!s||Object.keys(s).length===0?t:t.filter(a=>s[a.name])}function X({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 pe({testFile:t,entityName:s}){const{results:a,isRunning:c,runTests:h}=fe(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 m=s?a.testCases.filter(p=>p.fullName.startsWith(s)):a.testCases,x=m.length>0?m:a.testCases;if(x.length===0)return null;const u=s?`${s} > `:"";return e.jsxs("div",{className:"px-2 pt-1 space-y-0.5",children:[x.map(p=>{var y;const S=u&&p.fullName.startsWith(u)?p.fullName.slice(u.length):p.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[p.status==="passed"?e.jsx("span",{className:"text-green-400 text-[10px]",children:"✓"}):p.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] ${p.status==="passed"?"text-green-400":p.status==="failed"?"text-red-400":"text-gray-500"}`,children:S})]}),p.status==="failed"&&((y=p.failureMessages)==null?void 0:y.map((k,L)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-300/70 truncate max-w-full",title:k,children:k.split(`
3
+ `)[0]},L)))]},p.fullName)}),e.jsx("button",{onClick:h,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 V({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(ue,{content:t,icon:!0,iconSize:10,className:"shrink-0 text-gray-500 hover:text-gray-300 transition-colors"})]}):null}function wt({scenarios:t,projectRoot:s,activeScenarioId:a,onScenarioSelect:c,zoomComponent:h,onZoomChange:m,analyzedEntities:x=[],glossaryFunctions:u=[],activeAnalyzedScenarioId:p,onAnalyzedScenarioSelect:S,entityImports:y,pageFilePaths:k={}}){const{pageGroups:L,componentGroups:M}=i.useMemo(()=>{const r=new Map,n=new Map;for(const g of t)if(g.componentName){const N=n.get(g.componentName)||[];N.push(g),n.set(g.componentName,N)}else{const N=se(g.url),d=r.get(N)||[];d.push(g),r.set(N,d)}const l=new Map([...n.entries()].sort(([g],[N])=>g.localeCompare(N)));return{pageGroups:r,componentGroups:l}},[t]),w=i.useMemo(()=>{const r=new Set((x||[]).filter(l=>l.entityType==="visual").map(l=>l.name)),n=new Map;for(const[l,g]of M)r.has(l)||n.set(l,g);return n},[M,x]),{visualEntities:f,libraryEntities:B}=i.useMemo(()=>{const r=x.filter(l=>l.entityType==="visual").sort((l,g)=>l.name.localeCompare(g.name)),n=x.filter(l=>l.entityType==="library"||l.entityType==="functionCall").sort((l,g)=>l.name.localeCompare(g.name));return{visualEntities:r,libraryEntities:n}},[x]),R=i.useMemo(()=>{const r=new Set(B.map(n=>n.name));return u.filter(n=>!r.has(n.name)).sort((n,l)=>n.name.localeCompare(l.name))},[u,B]),_=x.some(r=>r.isAnalyzing),T=i.useRef(null),C=i.useRef(0),v=i.useCallback(()=>{T.current&&(C.current=T.current.scrollTop)},[]);if(i.useEffect(()=>{T.current&&C.current>0&&(T.current.scrollTop=C.current)}),t.length===0&&x.length===0&&R.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(h){const r=M.get(h)||[],n=new Set((y==null?void 0:y[h])||[]),l=n.size>0,g=l?f.filter(d=>n.has(d.name)):[],N=l?B.filter(d=>n.has(d.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:()=>m(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:h})}),e.jsx("div",{className:"flex flex-wrap gap-2 px-2",children:r.length===0?e.jsx("div",{className:"px-3 py-2 text-xs text-gray-500",children:"No scenarios for this component"}):r.map(d=>e.jsx(X,{imgSrc:d.screenshotPath?`/api/editor-scenario-image/${d.id}.png`:null,name:d.name,isActive:d.id===a,onSelect:()=>c(d)},d.id))}),g.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"})}),g.map(d=>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:()=>m(d.name),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:d.name})}),e.jsx(V,{filePath:d.filePath,projectRoot:s}),(d.scenarios.length>0||d.pendingScenarios.length>0)&&e.jsx("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:d.scenarios.map(P=>e.jsx(X,{imgSrc:P.screenshotPath?`/api/screenshot/${P.screenshotPath}`:null,name:P.name,isActive:P.id===p,onSelect:()=>S==null?void 0:S({analysisId:d.analysisId,scenarioId:P.id,scenarioName:P.name,entitySha:d.sha,entityName:d.name})},P.id))})]},d.sha))]}),N.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"})}),N.map(d=>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:d.name})}),e.jsx(V,{filePath:d.filePath,projectRoot:s}),d.testFile&&e.jsx(pe,{testFile:d.testFile,entityName:d.name})]},d.sha))]})]})})}return e.jsx("div",{ref:T,onScroll:v,className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-3 space-y-3",children:[L.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"})}),[...L.entries()].sort(([r],[n])=>r==="Home"?-1:n==="Home"?1:r.localeCompare(n)).map(([r,n])=>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:r})}),k[r]&&e.jsx(V,{filePath:k[r],projectRoot:s}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:n.map(l=>e.jsx(X,{imgSrc:l.screenshotPath?`/api/editor-scenario-image/${l.id}.png`:null,name:l.name,isActive:l.id===a&&!p,onSelect:()=>c(l)},l.id))})]},r))]}),w.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"})}),[...w.entries()].map(([r,n])=>{var l;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:()=>m(r),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:r})}),((l=n[0])==null?void 0:l.componentPath)&&e.jsx(V,{filePath:n[0].componentPath,projectRoot:s}),e.jsx("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:n.map(g=>e.jsx(X,{imgSrc:g.screenshotPath?`/api/editor-scenario-image/${g.id}.png`:null,name:g.name,isActive:g.id===a&&!p,onSelect:()=>c(g)},g.id))})]},r)})]}),f.length>0&&e.jsxs("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:[e.jsxs("div",{className:"px-2 py-1",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),_&&t.length===0&&x.every(r=>r.scenarioCount===0)&&e.jsx("span",{className:"ml-2 text-[10px] text-gray-500",children:"— Entities are being analyzed..."})]}),f.map(r=>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:()=>m(r.name),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:r.name}),r.isAnalyzing&&r.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(V,{filePath:r.filePath,projectRoot:s}),(r.scenarios.length>0||r.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:[r.scenarios.map(n=>e.jsx(X,{imgSrc:n.screenshotPath?`/api/screenshot/${n.screenshotPath}`:null,name:n.name,isActive:n.id===p,onSelect:()=>S==null?void 0:S({analysisId:r.analysisId,scenarioId:n.id,scenarioName:n.name,entitySha:r.sha,entityName:r.name})},n.id)),r.pendingScenarios.map(n=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:n,children:n},n))]})]},r.sha))]}),(B.length>0||R.length>0)&&e.jsxs("div",{className:`pt-2 mt-1 ${f.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(r=>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:r.name}),r.isAnalyzing&&r.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(V,{filePath:r.filePath,projectRoot:s}),r.testFile?e.jsx(pe,{testFile:r.testFile,entityName:r.name}):e.jsx("div",{className:"px-2 pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-500",children:"No test file"})})]},r.sha)),R.map(r=>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:r.name})}),e.jsx(V,{filePath:r.filePath,projectRoot:s}),e.jsx(pe,{testFile:r.testFile,entityName:r.name})]},r.name))]})]})})}function yt(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 St(t){const s=new Map;for(const a of t){const c=a.name.indexOf(" - "),h=c!==-1?a.name.slice(0,c):"App",m=s.get(h)||[];m.push(a),s.set(h,m)}return[...s.entries()].sort(([a],[c])=>a==="App"?-1:c==="App"?1:a.localeCompare(c))}const Me=120;function De({text:t,theme:s}){const[a,c]=i.useState(!1),h=t.length>Me,m=h&&!a?t.slice(0,Me)+"…":t,x=s==="light";return e.jsxs("div",{className:`px-4 py-2 ${x?"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 ${x?"text-gray-600":"text-gray-400"}`,children:[m,h&&e.jsx("button",{onClick:()=>c(!a),className:`ml-1 text-[11px] font-medium bg-transparent border-none p-0 cursor-pointer ${x?"text-blue-500 hover:text-blue-700":"text-[#00a0c4] hover:text-[#00c0e8]"}`,children:a?"Show less":"Read more…"})]})]})}function Ee({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 kt({testFile:t,entityName:s}){const{results:a,isRunning:c,runTests:h}=fe(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 m=s?a.testCases.filter(p=>p.fullName.startsWith(s)):a.testCases,x=m.length>0?m:a.testCases;if(x.length===0)return null;const u=s?`${s} > `:"";return e.jsxs("div",{className:"pt-1 space-y-0.5",children:[x.map(p=>{var y;const S=u&&p.fullName.startsWith(u)?p.fullName.slice(u.length):p.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[p.status==="passed"?e.jsx("span",{className:"text-green-400 text-[10px]",children:"✓"}):p.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] ${p.status==="passed"?"text-green-400":p.status==="failed"?"text-red-400":"text-gray-500"}`,children:S})]}),p.status==="failed"&&((y=p.failureMessages)==null?void 0:y.map((k,L)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-400/70 truncate max-w-full",title:k,children:k.split(`
4
+ `)[0]},L)))]},p.fullName)}),e.jsx("button",{onClick:h,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 Ct={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 Pt(t){try{return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}function Mt(t){try{return new Date(t+"T00:00:00").toLocaleDateString([],{weekday:"long",month:"long",day:"numeric"})}catch{return t}}function Et({isActive:t,onScreenshotClick:s,glossaryFunctions:a=[],pageNames:c=[]}){const[h,m]=i.useState([]),[x,u]=i.useState(!0),[p,S]=i.useState(new Set),y=i.useCallback(M=>{S(w=>{const f=new Set(w);return f.has(M)?f.delete(M):f.add(M),f})},[]),k=i.useCallback(async()=>{try{const M=await fetch("/api/editor-journal");if(M.ok){const w=await M.json();m(w.entries||[])}}catch{}finally{u(!1)}},[]);if(i.useEffect(()=>{k()},[k]),i.useEffect(()=>{t&&k()},[t,k]),i.useEffect(()=>{const M=new EventSource("/api/events");return M.addEventListener("message",w=>{try{const f=JSON.parse(w.data);f.type==="db-change"&&f.changeType==="journal"&&k()}catch{}}),()=>M.close()},[k]),x)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx("span",{className:"text-gray-500 text-sm",children:"Loading journal..."})});if(h.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 L=yt(h);return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsx("div",{className:"p-3 space-y-4",children:[...L.entries()].map(([M,w])=>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:Mt(M)})}),e.jsx("div",{className:"space-y-2",children:w.map((f,B)=>{const R=Ct[f.type]||{label:f.type,color:"bg-gray-600"},_=`${f.time}-${B}`,T=p.has(_);return e.jsxs("div",{className:"bg-[#2d2d2d] rounded-lg overflow-hidden",children:[e.jsxs("div",{className:`p-3 space-y-2 ${T?"":"max-h-[300px] overflow-y-auto"}`,children:[e.jsx("div",{className:"flex items-start gap-2",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:f.title}),e.jsx("span",{className:`${R.color} text-white text-[9px] font-bold px-1.5 py-0.5 rounded uppercase tracking-wider shrink-0`,children:R.label})]}),e.jsx("span",{className:"text-[10px] text-gray-500",children:Pt(f.time)}),f.featureName&&e.jsx("span",{className:"text-[10px] text-gray-500 italic truncate",title:f.featureName,children:f.featureName})]})}),f.userPrompt&&e.jsx(De,{text:f.userPrompt,theme:"dark"}),e.jsx("p",{className:"text-xs text-gray-400 leading-relaxed",children:f.description}),f.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/${f.screenshot.replace("screenshots/","")}`,commitSha:f.commitSha,commitMessage:f.commitMessage,scenarioName:f.title}),children:e.jsx("img",{src:`/api/editor-journal-image/${f.screenshot.replace("screenshots/","")}`,alt:f.title,className:"max-w-full max-h-full object-contain",loading:"lazy"})}),f.scenarioScreenshots&&f.scenarioScreenshots.length>0&&(()=>{const C=St(f.scenarioScreenshots);new Set(c);const v=C.filter(([d])=>d==="App").flatMap(([,d])=>d),r=he(C.filter(([d])=>d!=="App"),f.entityChangeStatus),n=f.entityChangeStatus,g=n&&Object.keys(n).length>0?c.filter(d=>n[d]):c,N=d=>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/${d.path.replace("screenshots/","")}`,commitSha:f.commitSha,commitMessage:f.commitMessage,scenarioName:d.name}),children:e.jsx("img",{src:`/api/editor-journal-image/${d.path.replace("screenshots/","")}`,alt:d.name,title:d.name,className:"max-w-full max-h-full object-contain",loading:"lazy"})},d.path);return e.jsxs("div",{className:"space-y-2",children:[(g.length>0||v.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"}),g.map(d=>e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] font-medium text-gray-400",children:d}),(n==null?void 0:n[d])&&e.jsx(Ee,{status:n[d]})]},d)),v.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-0.5",children:v.map(N)})]}),r.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"}),r.map(([d,P])=>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:d}),(n==null?void 0:n[d])&&e.jsx(Ee,{status:n[d]})]}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-0.5",children:P.map(N)})]},d))]})]})})(),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(C=>e.jsxs("div",{children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-200",children:C.name}),e.jsx("span",{className:"text-[9px] text-gray-500 truncate block",children:C.filePath}),C.testFile?e.jsx(kt,{testFile:C.testFile,entityName:C.name}):e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-500",children:"No test file"})})]},C.name))})]}),f.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:f.commitSha.slice(0,7)}),e.jsx("span",{className:"text-gray-500 truncate",children:f.commitMessage})]})]}),e.jsxs("button",{onClick:()=>y(_),className:"w-full py-1.5 text-[10px] text-gray-500 hover:text-gray-300 border-t border-[#3d3d3d] transition-colors cursor-pointer",children:["——— ",T?"Collapse":"Expand"," ———"]})]},_)})})]},M))})})}function W({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-24 h-24 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-24 ${a?"text-white":"text-gray-500 group-hover:text-gray-300"}`,children:s})]})}function te({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(ue,{content:t,icon:!0,iconSize:10,className:"shrink-0 text-gray-500 hover:text-gray-300 transition-colors"})]}):null}function Tt({hasProject:t,scenarios:s,analyzedEntities:a,glossaryFunctions:c=[],projectRoot:h,activeScenarioId:m,onScenarioSelect:x,onAnalyzedScenarioSelect:u,onSwitchToBuild:p,zoomComponent:S,onZoomChange:y,entityImports:k,pageFilePaths:L={}}){const{pageGroups:M,componentGroups:w}=i.useMemo(()=>{const v=new Map,r=new Map;for(const l of s)if(l.componentName){const g=r.get(l.componentName)||[];g.push(l),r.set(l.componentName,g)}else{const g=se(l.url),N=v.get(g)||[];N.push(l),v.set(g,N)}const n=new Map([...r.entries()].sort(([l],[g])=>l.localeCompare(g)));return{pageGroups:v,componentGroups:n}},[s]),f=i.useMemo(()=>a.filter(v=>v.entityType==="visual").sort((v,r)=>v.name.localeCompare(r.name)),[a]),B=i.useMemo(()=>{const v=new Map;for(const r of c)v.set(r.name,r);return v},[c]),R=i.useRef(null),_=i.useRef(0),T=i.useCallback(()=>{R.current&&(_.current=R.current.scrollTop)},[]);if(i.useEffect(()=>{R.current&&_.current>0&&(R.current.scrollTop=_.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:p,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||f.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:[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 max-wpn-70",children:"Describe what you want to build in the Chat and your pages and components will appear here."}),e.jsx("button",{onClick:p,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 v=M.get(S)||[],r=w.get(S)||[],n=f.find(j=>j.name===S),l=B.get(S),g=[...v,...r],N=new Set((k==null?void 0:k[S])||[]),d=N.size>0,P=d?[...w.entries()].filter(([j])=>N.has(j)):[],O=d?f.filter(j=>N.has(j.name)&&!P.some(([I])=>I===j.name)):[],D=d?c.filter(j=>N.has(j.name)):[],H=P.length>0||O.length>0,K=D.length>0,J=H||K;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}),l&&e.jsx(te,{filePath:l.filePath,projectRoot:h})]}),g.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:g.map(j=>e.jsx(W,{imgSrc:j.screenshotPath?`/api/editor-scenario-image/${j.id}.png`:null,name:j.name,isActive:j.id===m,onSelect:()=>x(j)},j.id))}),n&&(n.scenarios.length>0||n.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2",children:[n.scenarios.map(j=>e.jsx(W,{imgSrc:j.screenshotPath?`/api/screenshot/${j.screenshotPath}`:null,name:j.name,isActive:!1,onSelect:()=>u({analysisId:n.analysisId,scenarioId:j.id,scenarioName:j.name,entitySha:n.sha,entityName:n.name})},j.id)),n.pendingScenarios.map(j=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:j,children:j},j))]}),l&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] text-gray-500",children:"Tests:"}),e.jsx(te,{filePath:l.testFile,projectRoot:h})]}),g.length===0&&!n&&!l&&e.jsx("div",{className:"text-xs text-gray-500",children:"No scenarios for this entity"}),J&&e.jsxs("div",{className:"pt-3 mt-2 border-t border-[#3d3d3d] space-y-3",children:[H&&e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),P.map(([j,I])=>e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>y(j),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:j})}),I.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:I.map(F=>e.jsx(W,{imgSrc:F.screenshotPath?`/api/editor-scenario-image/${F.id}.png`:null,name:F.name,isActive:F.id===m,onSelect:()=>x(F)},F.id))})]},j)),O.map(j=>e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>y(j.name),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:j.name})}),(j.scenarios.length>0||j.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[j.scenarios.map(I=>e.jsx(W,{imgSrc:I.screenshotPath?`/api/screenshot/${I.screenshotPath}`:null,name:I.name,isActive:!1,onSelect:()=>u({analysisId:j.analysisId,scenarioId:I.id,scenarioName:I.name,entitySha:j.sha,entityName:j.name})},I.id)),j.pendingScenarios.map(I=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:I,children:I},I))]})]},j.sha))]}),K&&e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"}),D.map(j=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>y(j.name),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:j.name})}),e.jsx(te,{filePath:j.filePath,projectRoot:h}),j.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:j.testFile})]})]},j.name))]})]})]})})}return e.jsx("div",{ref:R,onScroll:T,className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsx("h2",{className:"text-sm font-medium text-gray-300 m-0 font-['IBM_Plex_Sans']",children:"What do you want to work on next?"}),e.jsx("button",{onClick:p,className:"w-full py-3 border-2 border-dashed border-[#4d4d4d] rounded-lg text-sm text-gray-400 hover:border-[#005c75] hover:text-white transition-colors cursor-pointer bg-transparent",children:"+ New Page"}),M.size>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Application"}),[...M.entries()].sort(([v],[r])=>v==="Home"?-1:r==="Home"?1:v.localeCompare(r)).map(([v,r])=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>y(v),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:v})}),L[v]&&e.jsx(te,{filePath:L[v],projectRoot:h}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:r.map(n=>e.jsx(W,{imgSrc:n.screenshotPath?`/api/editor-scenario-image/${n.id}.png`:null,name:n.name,isActive:n.id===m,onSelect:()=>x(n)},n.id))})]},v))]}),w.size>0&&e.jsx("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"})}),[...w.entries()].map(([v,r])=>e.jsxs("div",{children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>y(v),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:v})}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:r.map(n=>e.jsx(W,{imgSrc:n.screenshotPath?`/api/editor-scenario-image/${n.id}.png`:null,name:n.name,isActive:n.id===m,onSelect:()=>x(n)},n.id))})]},v)),f.map(v=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 py-1",children:[e.jsx("button",{onClick:()=>y(v.name),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:v.name}),v.isAnalyzing&&v.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..."]})]}),(v.scenarios.length>0||v.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[v.scenarios.map(r=>e.jsx(W,{imgSrc:r.screenshotPath?`/api/screenshot/${r.screenshotPath}`:null,name:r.name,isActive:!1,onSelect:()=>u({analysisId:v.analysisId,scenarioId:r.id,scenarioName:r.name,entitySha:v.sha,entityName:v.name})},r.id)),v.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))]})]},v.sha))]})})}const Te={new:0,edited:1,impacted:2};function Le({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 Ie({filePath:t}){const[s,a]=i.useState(null),[c,h]=i.useState(!0),[m,x]=i.useState(null);return i.useEffect(()=>{jt(()=>import("./index-yHOVb4rc.js"),__vite__mapDeps([0,1])).then(u=>{x(()=>u.default)})},[]),i.useEffect(()=>{h(!0),fetch(`/api/editor-file-diff?path=${encodeURIComponent(t)}`).then(u=>u.json()).then(u=>{a({oldContent:u.oldContent,newContent:u.newContent})}).catch(()=>{a(null)}).finally(()=>h(!1))},[t]),c?e.jsx("div",{className:"p-2 text-[10px] text-gray-400",children:"Loading diff..."}):!s||!m?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(m,{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 $e({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 Re({scenarioId:t,name:s,isActive:a,onSelect:c}){const[h,m]=i.useState(!1);return i.useEffect(()=>{m(!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:h?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:()=>m(!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 Lt({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(ue,{content:t,icon:!0,iconSize:10,className:"shrink-0 text-gray-400 hover:text-gray-600 transition-colors"})]}):null}function It({testFile:t,entityName:s}){const{results:a,isRunning:c,runTests:h}=fe(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 m=s?a.testCases.filter(p=>p.fullName.startsWith(s)):a.testCases,x=m.length>0?m:a.testCases;if(x.length===0)return null;const u=s?`${s} > `:"";return e.jsxs("div",{className:"pt-1 space-y-0.5",children:[x.map(p=>{var y;const S=u&&p.fullName.startsWith(u)?p.fullName.slice(u.length):p.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[p.status==="passed"?e.jsx("span",{className:"text-green-600 text-[10px]",children:"✓"}):p.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] ${p.status==="passed"?"text-green-600":p.status==="failed"?"text-red-500":"text-gray-400"}`,children:S})]}),p.status==="failed"&&((y=p.failureMessages)==null?void 0:y.map((k,L)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-400 truncate max-w-full",title:k,children:k.split(`
5
+ `)[0]},L)))]},p.fullName)}),e.jsx("button",{onClick:h,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 Be(t){const s=t.indexOf(" - ");return s!==-1?t.slice(s+3):t}function Ae(t,s){return!s||Object.keys(s).length===0?t:[...t].sort(([a],[c])=>{var u,p;const h=((u=s[a])==null?void 0:u.status)||"impacted",m=((p=s[c])==null?void 0:p.status)||"impacted",x=(Te[h]??2)-(Te[m]??2);return x!==0?x:a.localeCompare(c)})}function $t({scenarios:t,allScenarios:s=[],glossaryFunctions:a=[],projectRoot:c,activeScenarioId:h,onScenarioSelect:m,onClose:x,entityChangeStatus:u={},featureName:p,userPrompt:S}){const y=i.useMemo(()=>{if(s.length===0||Object.keys(u).length===0)return t;const r=new Set(t.map(l=>l.id)),n=s.filter(l=>{var N;if(r.has(l.id))return!1;const g=l.componentName||se(l.url);return((N=u[g])==null?void 0:N.status)==="impacted"});return n.length===0?t:[...t,...n]},[t,s,u]),k=i.useMemo(()=>Object.entries(u).filter(([,r])=>r.status==="new"||r.status==="edited").map(([r,n])=>({name:r,status:n.status})),[u]),[L,M]=i.useState(null),w=i.useCallback(r=>{M(n=>n===r?null:r)},[]),{pageGroups:f,componentGroups:B}=i.useMemo(()=>{const r=new Map,n=new Map;for(const l of y)if(l.componentName){const g=n.get(l.componentName)||[];g.push(l),n.set(l.componentName,g)}else{const g=se(l.url),N=r.get(g)||[];N.push(l),r.set(g,N)}return{pageGroups:r,componentGroups:n}},[y]),R=i.useMemo(()=>Ae([...f.entries()],u),[f,u]),_=i.useMemo(()=>Ae([...B.entries()],u),[B,u]),T=i.useMemo(()=>he(R,u),[R,u]),C=i.useMemo(()=>he(_,u),[_,u]),v=i.useMemo(()=>Nt(a,u),[a,u]);return y.length===0&&a.length===0?e.jsxs("div",{className:"h-full bg-white flex items-center justify-center relative",children:[e.jsx("button",{onClick:x,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"}),p&&e.jsx("div",{className:"text-[11px] text-gray-400 truncate",title:p,children:p})]}),e.jsx("button",{onClick:x,className:"text-gray-400 hover:text-gray-700 text-lg leading-none cursor-pointer bg-transparent border-none shrink-0",title:"Close results",children:"×"})]}),S&&e.jsx(De,{text:S,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,n])=>{var d;const l=u[r],g=L===r,N=(d=n[0])==null?void 0:d.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}),l&&e.jsx(Le,{status:l,onClick:()=>w(r)})]}),g&&(l==null?void 0:l.status)==="edited"&&N&&e.jsx(Ie,{filePath:N}),g&&(l==null?void 0:l.status)==="impacted"&&e.jsx($e,{impactedBy:l.impactedBy,changedEntities:k}),e.jsx("div",{className:"flex flex-wrap gap-3",children:n.map(P=>e.jsx(Re,{scenarioId:P.id,name:Be(P.name),isActive:P.id===h,onSelect:()=>m(P)},P.id))})]},r)})})]}),C.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:C.map(([r,n])=>{var d;const l=u[r],g=L===r,N=(d=n[0])==null?void 0:d.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}),l&&e.jsx(Le,{status:l,onClick:()=>w(r)})]}),g&&(l==null?void 0:l.status)==="edited"&&N&&e.jsx(Ie,{filePath:N}),g&&(l==null?void 0:l.status)==="impacted"&&e.jsx($e,{impactedBy:l.impactedBy,changedEntities:k}),e.jsx("div",{className:"flex flex-wrap gap-3",children:n.map(P=>e.jsx(Re,{scenarioId:P.id,name:Be(P.name),isActive:P.id===h,onSelect:()=>m(P)},P.id))})]},r)})})]}),v.length>0&&e.jsxs("div",{className:T.length>0||C.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:v.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(Lt,{filePath:r.filePath,projectRoot:c}),r.testFile?e.jsx(It,{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))})]})]})})]})}function Rt({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 h=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"})}),h?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 Bt=[{key:"app",label:"App"},{key:"build",label:"Build"},{key:"data",label:"Structure"},{key:"journal",label:"Journal"}];function At({activeTab:t,onTabChange:s,buildIdle:a,zoomComponent:c,breadcrumbItems:h,onBreadcrumbNavigate:m}){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:vt,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(Rt,{items:h,onNavigate:m})]})]}),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:Bt.map(x=>e.jsxs("button",{onClick:()=>s(x.key),className:`px-2.5 py-1 text-xs font-medium rounded-md transition-colors cursor-pointer ${t===x.key?"bg-[#7a4444] text-white":"text-gray-300 hover:text-white"}`,children:[x.label,x.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"})]},x.key))})]})}function _t({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.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:s,className:"text-sm text-[#888] hover:text-[#333] transition-colors cursor-pointer px-3 py-1.5 rounded border border-[#ccc] hover:border-[#999] bg-white",children:"Back to live preview"}),t.commitSha&&a&&e.jsx(Dt,{commitSha:t.commitSha,onLoadCommit:a})]})]})}function Dt({commitSha:t,onLoadCommit:s}){const[a,c]=i.useState(!1),[h,m]=i.useState(null);return e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>{c(!0),m(null),s(t).then(x=>{x.success||m(x.error||"Failed to load commit")}).catch(x=>{m(x instanceof Error?x.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?"Loading...":"Load this version"}),h&&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:h})]})}function Ot({analysisId:t,scenarioId:s,scenarioName:a,entityName:c,projectSlug:h,onStateChange:m}){const{interactiveServerUrl:x,isStarting:u,isLoading:p}=bt({analysisId:t,scenarioId:s,scenarioName:a,entityName:c,projectSlug:h,enabled:!0});return i.useEffect(()=>{m(x,u||p)},[x,u,p,m]),null}function Ft(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 zt(){const[t,s]=i.useState({url:null,proxyUrl:null,isStarting:!1,error:null,canStartServer:!0,autoStartAttempted:!1}),a=i.useRef(t);a.current=t,i.useEffect(()=>{let m=!1,x=null;const u=async()=>{try{const p=await fetch("/api/editor-dev-server");if(m)return;const S=await p.json(),y=Ft(a.current,S),{shouldAutoStart:k,...L}=y;if(s(L),k)try{const M=await fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"start"})});if(m)return;M.ok?s(w=>({...w,isStarting:!0})):s(w=>({...w,canStartServer:!1}))}catch{}}catch{}};return u(),x=setInterval(()=>void u(),2e3),()=>{m=!0,x&&clearInterval(x)}},[t.url]);const c=i.useCallback(()=>{s(m=>({...m,error:null,isStarting:!0})),fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"restart"})}).catch(()=>{})},[]),h=i.useCallback(()=>{s(m=>({...m,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:h}}const es=()=>[{title:"Editor - CodeYam"},{name:"description",content:"CodeYam Code + Data Editor"}];class Ut extends i.Component{constructor(){super(...arguments);Ce(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 _e=[{name:"Desktop",width:1440,height:900},{name:"Laptop",width:1024,height:768},{name:"Tablet",width:768,height:1024},{name:"Mobile",width:375,height:667}],ts=lt(function(){const{projectSlug:s,projectRoot:a,hasProject:c,scenarios:h,allScenarios:m,analyzedEntities:x,glossaryFunctions:u,entityImports:p,pageFilePaths:S,entityChangeStatus:y,featureName:k,userPrompt:L}=ot(),M=ct(),[w,f]=dt(),B=i.useRef(null),R=i.useRef(null),_=i.useRef(null),T=w.get("zoom")||void 0,C=w.get("scenario")||void 0;i.useEffect(()=>{if(!C)return;const o=h.find(E=>E.id===C);if(!o)return;const b=ee(o.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:b,scenarioId:o.id,scenarioName:o.name})}).catch(()=>{})},[C,h]),i.useEffect(()=>{const o=new BroadcastChannel("codeyam-editor");return o.onmessage=b=>{var E;if(((E=b.data)==null?void 0:E.type)==="switch-scenario"&&b.data.scenarioId){const $=b.data.scenarioId,Y=h.find(me=>me.id===$);if(!Y)return;const xe=new URLSearchParams(w);xe.set("scenario",$),xe.delete("zoom"),f(xe),H(null),J(null),U(null);const rt=ee(Y.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:rt,scenarioId:$})}).then(()=>{q(me=>me+1),O(!1)}).catch(()=>{})}},()=>o.close()},[w,f,h]),i.useEffect(()=>{if(w.get("ref")!=="link"||!C)return;const o=new BroadcastChannel("codeyam-editor");o.postMessage({type:"switch-scenario",scenarioId:C}),o.close(),window.close()},[]);const{devServerUrl:v,proxyUrl:r,isStarting:n,error:l,canStartServer:g,retryServer:N,startServer:d}=zt(),[P,O]=i.useState(!1),[D,H]=i.useState(null),[K,J]=i.useState(null),[j,I]=i.useState(!1),[F,U]=i.useState(null),Oe=i.useCallback(o=>{U(o)},[]),Fe=i.useCallback(async o=>{const E=await(await fetch("/api/editor-load-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commitSha:o})})).json();return E.success&&(U(null),O(!1)),E},[]),ze=i.useCallback((o,b)=>{J(E=>(o&&o!==E&&O(!1),o)),!b&&o&&O(!0),I(b)},[]),ge=i.useCallback(o=>{U(null),H(E=>(E&&E.analysisId===o.analysisId||(J(null),q(Y=>Y+1)),o)),I(!0),O(!1);const b=new URLSearchParams(w);b.delete("scenario"),b.delete("zoom"),f(b)},[w,f]),[A,je]=i.useState({name:"Desktop",width:1440,height:900}),[Ue,ae]=i.useState(!1),[z,re]=i.useState("app"),Ve=i.useCallback(()=>{re("build"),ne(!0)},[]),[We,ne]=i.useState(!1),[He,ve]=i.useState(!1),Je=i.useCallback(o=>{ve(o)},[]),[ie,be]=i.useState(!1),Ge=i.useCallback(()=>{be(!0),re("build"),ne(!0)},[]),Ne=i.useCallback(()=>{be(!1)},[]),[Z,le]=i.useState(!1),Ye=i.useCallback(()=>{if(Z){le(!1);return}typeof Notification<"u"&&Notification.permission==="default"?Notification.requestPermission().then(o=>{o==="granted"&&le(!0)}):le(!0)},[Z]);i.useEffect(()=>{if(z==="build"){ve(!1);const o=setTimeout(()=>{var b,E;(b=B.current)==null||b.scrollToBottom(),(E=B.current)==null||E.focus()},50);return()=>clearTimeout(o)}},[z]);const[oe,Ke]=i.useState(null);i.useEffect(()=>{const o=_.current;if(!o)return;const b=new ResizeObserver(E=>{const $=E[0];$&&Ke({width:$.contentRect.width,height:$.contentRect.height})});return b.observe(o),()=>b.disconnect()},[]);const G=i.useMemo(()=>oe?pt(oe,A):1,[oe,A]),[qe,q]=i.useState(0),[we,ye]=i.useState(null),Qe=i.useCallback(o=>{ye(o||null),U(null),q(b=>b+1)},[]),{customSizes:Se,addCustomSize:Xe}=xt(s);i.useMemo(()=>[..._e,...Se],[Se]),i.useEffect(()=>{const o=new EventSource("/api/events");let b=null;return o.addEventListener("message",E=>{try{const $=JSON.parse(E.data);($.type==="db-change"||$.type==="unknown")&&(b&&clearTimeout(b),b=setTimeout(()=>{M.revalidate()},2e3))}catch{}}),()=>{b&&clearTimeout(b),o.close()}},[M]);const Ze=i.useMemo(()=>{const o=[{name:"App"}];return T&&o.push({name:T,componentName:T}),o},[T]),ce=i.useCallback(o=>{const b=new URLSearchParams(w);if(o){b.set("zoom",o);const E=h.find($=>$.componentName===o||$.componentName===null&&o==="Home");if(E){b.set("scenario",E.id);const $=ee(E.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:$,scenarioId:E.id})}).catch(()=>{}),q(Y=>Y+1),O(!1)}else b.delete("scenario")}else b.delete("zoom"),b.delete("scenario");f(b)},[w,f,h]),de=i.useCallback(o=>{H(null),J(null),U(null);const b=new URLSearchParams(w);b.set("scenario",o.id),f(b);const E=ee(o.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:E,scenarioId:o.id})}).catch(()=>{}),q($=>$+1),O(!1)},[w,f]),et=o=>{je({name:o.name,width:o.width,height:o.height})},tt=o=>{Xe(o,A.width,A.height??900),ae(!1),je(b=>({...b,name:o}))},st=()=>{D||O(!0)},Q=i.useMemo(()=>ht({activeAnalyzedScenario:!!D,analyzedPreviewUrl:K,activeScenarioId:C||null,scenarios:h,proxyUrl:r,devServerUrl:v,zoomComponent:T||null}),[r,v,T,C,h,D,K]),ke=i.useMemo(()=>ut(Q,we),[Q,we]),at=i.useMemo(()=>({projectSlug:s,hasProject:c,scenarioCount:h==null?void 0:h.length,allScenarioCount:m==null?void 0:m.length,analyzedEntityCount:x==null?void 0:x.length,glossaryFunctionCount:u==null?void 0:u.length,entityChangeStatusKeys:y?Object.keys(y):[],featureName:k}),[s,c,h,m,x,u,y,k]);return e.jsx(Ut,{loaderSnapshot:at,children:e.jsxs("div",{className:"fixed inset-0 bg-[#2d2d2d] flex flex-col",children:[D&&e.jsx(Ot,{analysisId:D.analysisId,scenarioId:D.scenarioId,scenarioName:D.scenarioName,entityName:D.entityName,projectSlug:s,onStateChange:ze},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:[_e.map(o=>e.jsxs("button",{onClick:()=>et(o),className:`p-1.5 rounded transition-colors cursor-pointer ${A.name===o.name?"text-white bg-[#555]":"text-gray-500 hover:text-gray-300"}`,title:`${o.name} (${o.width}×${o.height})`,children:[o.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"})]}),o.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"})]}),o.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"})]}),o.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"})]})]},o.name)),e.jsx("button",{onClick:()=>ae(!0),className:`p-1.5 rounded transition-colors cursor-pointer ${A.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:[A.width," × ",A.height??900]}),e.jsx("div",{className:"w-px h-4 bg-[#3d3d3d] mx-1"}),e.jsx("button",{onClick:()=>{const o=ke||Q;o&&window.open(o,"_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:_,className:"flex-1 flex items-center justify-center overflow-hidden p-8",style:{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:F?e.jsx(_t,{preview:F,onDismiss:()=>U(null),onLoadCommit:Fe}):Q?e.jsx("div",{style:{width:`${A.width*G}px`,height:`${(A.height??900)*G}px`},children:e.jsxs("div",{className:"relative bg-white origin-top-left",style:{width:`${A.width}px`,height:`${A.height??900}px`,transform:G<1?`scale(${G})`:void 0},children:[!P&&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(Pe,{})}),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"})]})]})}),e.jsx("iframe",{ref:R,src:ke||Q,className:"w-full h-full border-none",title:"Editor preview",onLoad:st,style:{opacity:P?1:0}},qe)]})}):e.jsx("div",{className:"bg-[#2a2a2a] rounded-lg flex flex-col items-center justify-center",style:{width:`${A.width*G}px`,height:`${(A.height??900)*G}px`},children:l?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:l}),e.jsx("button",{onClick:N,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"})]}):n||j?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-4",children:e.jsx(Pe,{})}),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:j?"Starting Interactive Mode":"Starting Dev Server"}),e.jsx("p",{className:"text-sm text-gray-400 leading-5 m-0 font-['IBM_Plex_Sans']",children:j?"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(At,{activeTab:z,onTabChange:o=>{re(o),o==="build"&&ne(!0)},buildIdle:He,zoomComponent:T,breadcrumbItems:Ze,onBreadcrumbNavigate:ce}),e.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[We&&e.jsxs("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:z==="build"?"visible":"hidden"},children:[e.jsx("div",{className:ie?"flex-1 min-h-0":"flex-1",style:ie?{flex:"1 1 50%"}:void 0,children:e.jsx(ft,{ref:B,entityName:"Editor",projectSlug:s,entityFilePath:null,scenarioName:null,onRefreshPreview:Qe,onShowResults:Ge,onHideResults:Ne,editorMode:!0,onIdleChange:Je,notificationsEnabled:Z})}),ie&&e.jsx("div",{style:{flex:"1 1 50%"},className:"min-h-0 border-t-2 border-gray-300",children:e.jsx($t,{scenarios:h,allScenarios:m,glossaryFunctions:u,projectRoot:a,activeScenarioId:C,onScenarioSelect:de,onClose:Ne,entityChangeStatus:y,featureName:k,userPrompt:L})})]}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:z==="app"?"visible":"hidden"},children:e.jsx(Tt,{hasProject:c,scenarios:m,analyzedEntities:x,glossaryFunctions:u,projectRoot:a,activeScenarioId:C,onScenarioSelect:de,onAnalyzedScenarioSelect:ge,onSwitchToBuild:Ve,zoomComponent:T,onZoomChange:ce,entityImports:p,pageFilePaths:S})}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:z==="data"?"visible":"hidden"},children:e.jsx(wt,{scenarios:m,projectRoot:a,activeScenarioId:C,onScenarioSelect:de,zoomComponent:T,onZoomChange:ce,analyzedEntities:[],glossaryFunctions:u,activeAnalyzedScenarioId:D==null?void 0:D.scenarioId,onAnalyzedScenarioSelect:ge,entityImports:p,pageFilePaths:S})}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:z==="journal"?"visible":"hidden"},children:e.jsx(Et,{isActive:z==="journal",onScreenshotClick:Oe,glossaryFunctions:u,pageNames:Object.keys(S)})})]}),e.jsx(gt,{serverUrl:v,isStarting:n,projectSlug:s,devServerError:l,onStartServer:g?d:void 0,notificationsEnabled:Z,onToggleNotifications:Ye})]})]}),Ue&&e.jsx(mt,{width:A.width,height:A.height??900,onSave:tt,onCancel:()=>ae(!1)})]})})});export{ts as default,es 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 u,j as d}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{_ as O}from"./preload-helper-ckwbz45p.js";function se({serverUrl:r,isStarting:t,projectSlug:n,devServerError:o,onStartServer:l,notificationsEnabled:m,onToggleNotifications:y}){const[b,g]=u.useState(null),c=u.useRef(null);u.useEffect(()=>{if(!n)return;const E=new EventSource("/api/dev-mode-events");return E.onmessage=C=>{try{const j=JSON.parse(C.data);j.type==="file-synced"&&(g(j.fileName),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{g(null)},5e3))}catch{}},()=>{E.close(),c.current&&clearTimeout(c.current)}},[n]);let a;o?a="error":t?a="starting":r?a="running":a="stopped";const S={starting:"bg-yellow-400",running:"bg-green-400",stopped:"bg-gray-400",error:"bg-red-400"},k={starting:"Starting...",running:r||"Running",stopped:"Stopped",error:"Error"};return d.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:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:`w-2 h-2 rounded-full ${S[a]}`}),d.jsxs("span",{className:"text-gray-400",children:["Server:"," ",d.jsx("span",{className:"text-gray-300",children:k[a]})]}),(a==="stopped"||a==="error")&&l&&d.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"})]}),d.jsx("div",{className:"w-px h-3 bg-[#3d3d3d]"}),b&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#4ade80",strokeWidth:"2",children:d.jsx("path",{d:"M20 6L9 17l-5-5"})}),d.jsxs("span",{className:"text-green-400",children:["Synced: ",b]})]}),d.jsx("div",{className:"w-px h-3 bg-[#3d3d3d]"})]}),d.jsx("div",{className:"flex-1"}),y&&d.jsx("button",{onClick:y,className:`text-[11px] rounded transition-colors cursor-pointer ${m?"text-green-400 hover:text-green-300":"text-gray-500 hover:text-gray-300"}`,title:m?"Click to turn off notifications":"Click to get notified when Claude finishes",children:m?"Notifications On":"Notifications Off"})]})}async function F(r,t){try{const{WebglAddon:o}=await O(async()=>{const{WebglAddon:m}=await import("./addon-webgl-DI8QOUvO.js").then(y=>y.a);return{WebglAddon:m}},[]),l=new o;return l.onContextLoss(()=>{t==null||t("webgl","canvas",new Error("WebGL context lost")),l.dispose(),q(r).then(m=>{m||t==null||t("canvas","dom",new Error("Canvas fallback failed after context loss"))})}),r.loadAddon(l),{type:"webgl",dispose:()=>l.dispose()}}catch(o){t==null||t("webgl","canvas",o)}const n=await q(r);return n||(t==null||t("canvas","dom",new Error("Canvas addon failed")),{type:"dom",dispose:()=>{}})}async function q(r){try{const{CanvasAddon:t}=await O(async()=>{const{CanvasAddon:o}=await import("./addon-canvas-DpzMmAy5.js").then(l=>l.a);return{CanvasAddon:o}},[]),n=new t;return r.loadAddon(n),{type:"canvas",dispose:()=>n.dispose()}}catch{return null}}const ee=`
3
+ .xterm { cursor: text; position: relative; user-select: none; -ms-user-select: none; -webkit-user-select: none; }
4
+ .xterm.focus, .xterm:focus { outline: none; }
5
+ .xterm .xterm-helpers { position: absolute; top: 0; z-index: 5; }
6
+ .xterm .xterm-helper-textarea { padding: 0; border: 0; margin: 0; position: absolute; opacity: 0; left: -9999em; top: 0; width: 0; height: 0; z-index: -5; white-space: nowrap; overflow: hidden; resize: none; }
7
+ .xterm .composition-view { background: #000; color: #FFF; display: none; position: absolute; white-space: nowrap; z-index: 1; }
8
+ .xterm .composition-view.active { display: block; }
9
+ .xterm .xterm-viewport { background-color: #000; overflow-y: scroll; cursor: default; position: absolute; right: 0; left: 0; top: 0; bottom: 0; }
10
+ .xterm .xterm-screen { position: relative; }
11
+ .xterm .xterm-screen canvas { position: absolute; left: 0; top: 0; }
12
+ .xterm .xterm-scroll-area { visibility: hidden; }
13
+ .xterm-char-measure-element { display: inline-block; visibility: hidden; position: absolute; top: 0; left: -9999em; line-height: normal; }
14
+ .xterm.enable-mouse-events { cursor: default; }
15
+ .xterm.xterm-cursor-pointer, .xterm .xterm-cursor-pointer { cursor: pointer; }
16
+ .xterm.column-select.focus { cursor: crosshair; }
17
+ .xterm .xterm-accessibility:not(.debug), .xterm .xterm-message { position: absolute; left: 0; top: 0; bottom: 0; right: 0; z-index: 10; color: transparent; pointer-events: none; }
18
+ .xterm .xterm-accessibility-tree:not(.debug) *::selection { color: transparent; }
19
+ .xterm .xterm-accessibility-tree { user-select: text; white-space: pre; }
20
+ .xterm .live-region { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
21
+ .xterm-dim { opacity: 1 !important; }
22
+ .xterm-underline-1 { text-decoration: underline; }
23
+ .xterm-underline-2 { text-decoration: double underline; }
24
+ .xterm-underline-3 { text-decoration: wavy underline; }
25
+ .xterm-underline-4 { text-decoration: dotted underline; }
26
+ .xterm-underline-5 { text-decoration: dashed underline; }
27
+ .xterm-overline { text-decoration: overline; }
28
+ .xterm-strikethrough { text-decoration: line-through; }
29
+ .xterm-screen .xterm-decoration-container .xterm-decoration { z-index: 6; position: absolute; }
30
+ .xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer { z-index: 7; }
31
+ .xterm-decoration-overview-ruler { z-index: 8; position: absolute; top: 0; right: 0; pointer-events: none; }
32
+ .xterm-decoration-top { z-index: 2; position: relative; }
33
+ `;function te(){if(document.getElementById("xterm-css"))return;const r=document.createElement("style");r.id="xterm-css",r.textContent=ee,document.head.appendChild(r)}const ie=u.forwardRef(function({entityName:t,entityType:n,entitySha:o,entityFilePath:l,scenarioName:m,scenarioDescription:y,analysisId:b,projectSlug:g,onRefreshPreview:c,onShowResults:a,onHideResults:S,editorMode:k,onIdleChange:E,notificationsEnabled:C},j){const M=u.useRef(null),A=u.useRef(null),z=u.useRef(null),N=u.useRef(null),B=u.useRef(null),I=u.useRef(!1),W=u.useRef(0),P=u.useRef(!1),_=u.useRef(E);_.current=E;const D=u.useRef(C);D.current=C;const X=u.useCallback(()=>{var f;(f=z.current)==null||f.focus()},[]);return u.useImperativeHandle(j,()=>({sendInput(f){const x=N.current;x&&x.readyState===WebSocket.OPEN&&(x.send(JSON.stringify({type:"input",data:f})),setTimeout(()=>{x.readyState===WebSocket.OPEN&&x.send(JSON.stringify({type:"input",data:"\r"}))},100))},focus(){var f;(f=z.current)==null||f.focus()},scrollToBottom(){var x;const f=(x=M.current)==null?void 0:x.querySelector(".xterm-viewport");f&&(f.scrollTop=f.scrollHeight)}})),u.useEffect(()=>{const f=M.current;if(!f)return;let x=!1;return te(),Promise.all([O(()=>import("./xterm-BqvuqXEL.js"),[]),O(()=>import("./addon-fit-YJmn1quW.js"),[]),O(()=>import("./addon-web-links-Duc5hnl7.js").then(T=>T.a),__vite__mapDeps([0,1]))]).then(([T,G,Z])=>{if(x)return;const s=new T.Terminal({cursorBlink:!0,scrollback:5e3,fontSize:13,fontFamily:"'IBM Plex Mono', 'Menlo', 'Monaco', monospace",theme:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#d4d4d4",selectionBackground:"#264f78"},linkHandler:{activate(i,e){try{const p=new URL(e),h=p.searchParams.get("scenario");if(h&&p.pathname==="/editor"){const w=new BroadcastChannel("codeyam-editor");w.postMessage({type:"switch-scenario",scenarioId:h}),w.close();return}}catch{}window.open(e,"_blank")}}}),L=new G.FitAddon;s.loadAddon(L),s.loadAddon(new Z.WebLinksAddon),s.open(f);let $=null;F(s,(i,e,p)=>{console.warn(`[Terminal] Renderer fallback: ${i} → ${e}`,p)}).then(i=>{if(x){i.dispose();return}console.log(`[Terminal] Using ${i.type} renderer`),$=i.dispose}),requestAnimationFrame(()=>{try{L.fit()}catch{}}),z.current=s,s.focus(),setTimeout(()=>s.focus(),100),setTimeout(()=>s.focus(),500);const K=window.location.protocol==="https:"?"wss:":"ws:",Q=window.location.host;function Y(i){const e=new URLSearchParams;return e.set("entityName",t),n&&e.set("entityType",n),o&&e.set("entitySha",o),l&&e.set("entityFilePath",l),m&&e.set("scenarioName",m),y&&e.set("scenarioDescription",y),b&&e.set("analysisId",b),g&&e.set("projectSlug",g),k&&e.set("editorMode","true"),i&&e.set("reconnectId",i),`${K}//${Q}/ws/terminal?${e.toString()}`}function J(i){const e=Y(i),p=new WebSocket(e);N.current=p,p.onopen=()=>{W.current=0,P.current=!1,p.send(JSON.stringify({type:"resize",cols:s.cols,rows:s.rows}))},p.onmessage=h=>{var w,H;try{const v=JSON.parse(h.data);if(v.type==="session-id"){B.current=v.sessionId;return}if(v.type==="refresh-preview"){c==null||c(v.path);return}if(v.type==="show-results"){a==null||a();return}if(v.type==="hide-results"){S==null||S();return}if(v.type==="claude-idle"){if(console.log("[Terminal] Received claude-idle, notifications:",D.current,"permission:",typeof Notification<"u"?Notification.permission:"N/A"),(w=_.current)==null||w.call(_,!0),D.current&&typeof Notification<"u"&&Notification.permission==="granted"){const V=new Notification("Claude is ready for you",{body:"Claude has finished and is waiting for your input.",tag:"claude-idle"});V.onclick=()=>{window.focus(),V.close()}}return}v.type==="output"&&(s.write(v.data),(H=_.current)==null||H.call(_,!1))}catch{s.write(h.data)}},p.onclose=()=>{if(I.current){s.write(`\r
34
+ \x1B[90m[Terminal session ended]\x1B[0m\r
35
+ `);return}const h=W.current;if(h<5&&B.current){const w=1e3*Math.pow(2,Math.min(h,3));W.current=h+1,s.write(`\r
36
+ \x1B[33m[Reconnecting...]\x1B[0m\r
37
+ `),setTimeout(()=>{I.current||J(B.current)},w)}else P.current?s.write(`\r
38
+ \x1B[90m[Terminal session ended]\x1B[0m\r
39
+ `):(P.current=!0,s.write(`\r
40
+ \x1B[33m[Starting new session...]\x1B[0m\r
41
+ `),B.current=null,W.current=0,J())},p.onerror=()=>{}}J(),s.onData(i=>{const e=N.current;e&&e.readyState===WebSocket.OPEN&&e.send(JSON.stringify({type:"input",data:i}))});let R=null;const U=new ResizeObserver(()=>{R&&clearTimeout(R),R=setTimeout(()=>{let i;try{i=L.proposeDimensions()}catch{return}if(!i||i.cols===s.cols&&i.rows===s.rows)return;const e=f.querySelector(".xterm-viewport");let p,h=!0;e&&(p=e.scrollTop,h=e.scrollTop+e.clientHeight>=e.scrollHeight-10),L.fit(),e&&p!==void 0&&(h?e.scrollTop=e.scrollHeight:e.scrollTop=p);const w=N.current;w&&w.readyState===WebSocket.OPEN&&w.send(JSON.stringify({type:"resize",cols:s.cols,rows:s.rows}))},150)});U.observe(f),A.current=()=>{var i;R&&clearTimeout(R),U.disconnect(),I.current=!0,(i=N.current)==null||i.close(),N.current=null,$==null||$(),s.dispose(),z.current=null}}),()=>{var T;x=!0,(T=A.current)==null||T.call(A),A.current=null}},[]),d.jsx("div",{ref:M,onClick:X,className:"w-full h-full",style:{padding:"4px 0 0 8px"}})});function re(r){return r.replace(/[^a-zA-Z0-9_]+/g,"_")}function ce(r){const{activeAnalyzedScenario:t,analyzedPreviewUrl:n,activeScenarioId:o,scenarios:l,proxyUrl:m,devServerUrl:y,zoomComponent:b}=r;if(t&&n)return n;if(t&&!n)return null;if(o){const c=l.find(a=>a.id===o);if(c!=null&&c.url){const a=m||y;return a?c.url.startsWith("/")?`${a}${c.url}`:c.url:null}}const g=m||y;if(!g)return null;if(b&&o){const c=l.find(S=>S.id===o),a=c?re(c.name):"Default";return`${g}/__codeyam__/${b}/${a}`}return g}function ae(r,t){if(!r||!t)return r;try{const n=new URL(r),o=t.indexOf("?");return o>=0?(n.pathname=t.slice(0,o),n.search=t.slice(o)):(n.pathname=t,n.search=""),n.href}catch{return r}}function le(r,t){const n=t.width,o=t.height??900,l=r.width,m=r.height;return n<=l&&o<=m?1:Math.min(l/n,m/o)}export{se as D,ie as T,ae as a,ce as b,le as c,re as g};