@codeyam/codeyam-cli 0.1.0-staging.6e699e5 → 0.1.0-staging.79ef713

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 (437) 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 +7 -7
  4. package/analyzer-template/packages/ai/index.ts +10 -2
  5. package/analyzer-template/packages/ai/package.json +2 -2
  6. package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +86 -18
  7. package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +67 -9
  8. package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +41 -17
  9. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.ts +10 -17
  10. package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +308 -50
  11. package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +15 -6
  12. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +833 -243
  13. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +5 -1
  14. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.ts +16 -3
  15. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.ts +6 -4
  16. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +54 -3
  17. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +60 -15
  18. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.ts +70 -0
  19. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +80 -5
  20. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.ts +179 -0
  21. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.ts +40 -30
  22. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +393 -97
  23. package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +58 -3
  24. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +283 -1
  25. package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +9 -5
  26. package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +11 -3
  27. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.ts +1 -1
  28. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +297 -7
  29. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.ts +1 -1
  30. package/analyzer-template/packages/ai/src/lib/isolateScopes.ts +51 -3
  31. package/analyzer-template/packages/ai/src/lib/mergeStatements.ts +90 -96
  32. package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +10 -7
  33. package/analyzer-template/packages/ai/src/lib/resolvePathToControllable.ts +25 -13
  34. package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +4 -3
  35. package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +114 -2
  36. package/analyzer-template/packages/analyze/index.ts +2 -0
  37. package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +65 -59
  38. package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +113 -26
  39. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.ts +19 -0
  40. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.ts +19 -0
  41. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllExports.ts +11 -0
  42. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.ts +8 -0
  43. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.ts +49 -1
  44. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.ts +2 -1
  45. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +71 -9
  46. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +19 -4
  47. package/analyzer-template/packages/analyze/src/lib/files/analyze/dependencyResolver.ts +6 -0
  48. package/analyzer-template/packages/analyze/src/lib/files/analyze/gatherEntityMap.ts +4 -2
  49. package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +0 -3
  50. package/analyzer-template/packages/analyze/src/lib/files/analyzeRemixRoute.ts +4 -5
  51. package/analyzer-template/packages/analyze/src/lib/files/getImportedExports.ts +14 -12
  52. package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +1315 -0
  53. package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +61 -13
  54. package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +37 -0
  55. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +229 -19
  56. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +117 -9
  57. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +459 -39
  58. package/analyzer-template/packages/analyze/src/lib/files/scenarios/propagateArrayItemSchemas.ts +474 -0
  59. package/analyzer-template/packages/analyze/src/lib/files/setImportedExports.ts +2 -1
  60. package/analyzer-template/packages/analyze/src/lib/index.ts +1 -0
  61. package/analyzer-template/packages/analyze/src/lib/utils/getFileByPath.ts +19 -0
  62. package/analyzer-template/packages/aws/package.json +1 -1
  63. package/analyzer-template/packages/database/package.json +1 -1
  64. package/analyzer-template/packages/database/src/lib/kysely/db.ts +8 -1
  65. package/analyzer-template/packages/database/src/lib/kysely/tables/commitsTable.ts +6 -0
  66. package/analyzer-template/packages/database/src/lib/loadAnalyses.ts +58 -1
  67. package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +13 -0
  68. package/analyzer-template/packages/database/src/lib/loadBranch.ts +16 -1
  69. package/analyzer-template/packages/database/src/lib/loadCommit.ts +11 -0
  70. package/analyzer-template/packages/database/src/lib/loadCommits.ts +28 -0
  71. package/analyzer-template/packages/database/src/lib/loadEntities.ts +26 -3
  72. package/analyzer-template/packages/database/src/lib/loadEntityBranches.ts +12 -0
  73. package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +7 -14
  74. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
  75. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +8 -1
  76. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
  77. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts +1 -0
  78. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts.map +1 -1
  79. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js +3 -0
  80. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
  81. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts +2 -0
  82. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts.map +1 -1
  83. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js +45 -2
  84. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js.map +1 -1
  85. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.d.ts.map +1 -1
  86. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js +8 -0
  87. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js.map +1 -1
  88. package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js +11 -1
  89. package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js.map +1 -1
  90. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.d.ts.map +1 -1
  91. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js +7 -0
  92. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js.map +1 -1
  93. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts +3 -1
  94. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
  95. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +22 -1
  96. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
  97. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts +3 -1
  98. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts.map +1 -1
  99. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js +23 -4
  100. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js.map +1 -1
  101. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.d.ts.map +1 -1
  102. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js +9 -0
  103. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js.map +1 -1
  104. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts +2 -2
  105. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
  106. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +5 -4
  107. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
  108. package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts +2 -0
  109. package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts.map +1 -1
  110. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts +3 -0
  111. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  112. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +5 -5
  113. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  114. package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
  115. package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
  116. package/analyzer-template/packages/github/package.json +1 -1
  117. package/analyzer-template/packages/types/src/types/Commit.ts +2 -0
  118. package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +1 -0
  119. package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +6 -5
  120. package/analyzer-template/packages/types/src/types/ScopeAnalysis.ts +6 -1
  121. package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts +2 -0
  122. package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts.map +1 -1
  123. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts +3 -0
  124. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  125. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +5 -5
  126. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  127. package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
  128. package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
  129. package/analyzer-template/playwright/capture.ts +20 -8
  130. package/analyzer-template/playwright/captureStatic.ts +1 -1
  131. package/analyzer-template/project/analyzeBaselineCommit.ts +5 -0
  132. package/analyzer-template/project/analyzeRegularCommit.ts +5 -0
  133. package/analyzer-template/project/captureLibraryFunctionDirect.ts +29 -26
  134. package/analyzer-template/project/constructMockCode.ts +90 -10
  135. package/analyzer-template/project/createEntitiesAndSortFiles.ts +83 -0
  136. package/analyzer-template/project/loadReadyToBeCaptured.ts +65 -41
  137. package/analyzer-template/project/orchestrateCapture/AwsCaptureTaskRunner.ts +12 -4
  138. package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +11 -6
  139. package/analyzer-template/project/orchestrateCapture/taskRunner.ts +4 -2
  140. package/analyzer-template/project/orchestrateCapture.ts +45 -6
  141. package/analyzer-template/project/start.ts +35 -11
  142. package/analyzer-template/project/writeMockDataTsx.ts +181 -8
  143. package/analyzer-template/project/writeScenarioComponents.ts +103 -12
  144. package/analyzer-template/project/writeSimpleRoot.ts +21 -11
  145. package/analyzer-template/scripts/comboWorkerLoop.cjs +98 -50
  146. package/background/src/lib/virtualized/project/analyzeBaselineCommit.js +5 -0
  147. package/background/src/lib/virtualized/project/analyzeBaselineCommit.js.map +1 -1
  148. package/background/src/lib/virtualized/project/analyzeRegularCommit.js +5 -0
  149. package/background/src/lib/virtualized/project/analyzeRegularCommit.js.map +1 -1
  150. package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js +3 -3
  151. package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js.map +1 -1
  152. package/background/src/lib/virtualized/project/constructMockCode.js +75 -4
  153. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  154. package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js +73 -1
  155. package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js.map +1 -1
  156. package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js +19 -8
  157. package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js.map +1 -1
  158. package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js +2 -2
  159. package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js.map +1 -1
  160. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +4 -4
  161. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
  162. package/background/src/lib/virtualized/project/orchestrateCapture.js +38 -6
  163. package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
  164. package/background/src/lib/virtualized/project/start.js +32 -11
  165. package/background/src/lib/virtualized/project/start.js.map +1 -1
  166. package/background/src/lib/virtualized/project/writeMockDataTsx.js +162 -4
  167. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  168. package/background/src/lib/virtualized/project/writeScenarioComponents.js +85 -15
  169. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  170. package/background/src/lib/virtualized/project/writeSimpleRoot.js +21 -11
  171. package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
  172. package/codeyam-cli/scripts/apply-setup.js +180 -0
  173. package/codeyam-cli/scripts/apply-setup.js.map +1 -1
  174. package/codeyam-cli/src/cli.js +2 -0
  175. package/codeyam-cli/src/cli.js.map +1 -1
  176. package/codeyam-cli/src/commands/debug.js +7 -5
  177. package/codeyam-cli/src/commands/debug.js.map +1 -1
  178. package/codeyam-cli/src/commands/memory.js +264 -0
  179. package/codeyam-cli/src/commands/memory.js.map +1 -0
  180. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +2 -2
  181. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
  182. package/codeyam-cli/src/utils/analysisRunner.js +21 -2
  183. package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
  184. package/codeyam-cli/src/utils/backgroundServer.js +4 -0
  185. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  186. package/codeyam-cli/src/utils/install-skills.js +55 -10
  187. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  188. package/codeyam-cli/src/utils/queue/job.js +4 -0
  189. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  190. package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js +82 -0
  191. package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js.map +1 -0
  192. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js +230 -0
  193. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js.map +1 -0
  194. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +67 -0
  195. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -0
  196. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js +105 -0
  197. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js.map +1 -0
  198. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js +34 -0
  199. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js.map +1 -0
  200. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js +162 -0
  201. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js.map +1 -0
  202. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +75 -0
  203. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -0
  204. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +285 -0
  205. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -0
  206. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +115 -0
  207. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -0
  208. package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js +127 -0
  209. package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js.map +1 -0
  210. package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js +50 -0
  211. package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js.map +1 -0
  212. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js +116 -0
  213. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js.map +1 -0
  214. package/codeyam-cli/src/utils/ruleReflection/index.js +5 -0
  215. package/codeyam-cli/src/utils/ruleReflection/index.js.map +1 -0
  216. package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js +44 -0
  217. package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js.map +1 -0
  218. package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js +85 -0
  219. package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js.map +1 -0
  220. package/codeyam-cli/src/utils/ruleReflection/types.js +5 -0
  221. package/codeyam-cli/src/utils/ruleReflection/types.js.map +1 -0
  222. package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js +293 -0
  223. package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js.map +1 -0
  224. package/codeyam-cli/src/utils/rules/index.js +6 -0
  225. package/codeyam-cli/src/utils/rules/index.js.map +1 -0
  226. package/codeyam-cli/src/utils/rules/parser.js +78 -0
  227. package/codeyam-cli/src/utils/rules/parser.js.map +1 -0
  228. package/codeyam-cli/src/utils/rules/pathMatcher.js +18 -0
  229. package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -0
  230. package/codeyam-cli/src/utils/rules/ruleState.js +150 -0
  231. package/codeyam-cli/src/utils/rules/ruleState.js.map +1 -0
  232. package/codeyam-cli/src/utils/rules/staleness.js +137 -0
  233. package/codeyam-cli/src/utils/rules/staleness.js.map +1 -0
  234. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +1 -1
  235. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  236. package/codeyam-cli/src/webserver/app/lib/database.js +7 -3
  237. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  238. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-CA3JxPb7.js +1 -0
  239. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-B86KKU7e.js +11 -0
  240. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-DLqD3qNt.js → EntityTypeBadge-B5ctlSYt.js} +1 -1
  241. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-Ba2JVPzP.js → EntityTypeIcon-BqY8gDAW.js} +1 -1
  242. package/codeyam-cli/src/webserver/build/client/assets/{InlineSpinner-C8lyxW9k.js → InlineSpinner-ClaLpuOo.js} +1 -1
  243. package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-aht4aafF.js → InteractivePreview-BDhPilK7.js} +2 -2
  244. package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-CVtiBnY5.js → LibraryFunctionPreview-VeqEBv9v.js} +1 -1
  245. package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-B0GLXMsr.js → LoadingDots-Bs7Nn1Jr.js} +1 -1
  246. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-xgeCVgSM.js → LogViewer-Bm3PmcCz.js} +1 -1
  247. package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-D4TZhLuw.js → ReportIssueModal-C6PKeMYR.js} +3 -13
  248. package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-DuDvi0jm.js → SafeScreenshot-Gq3Ocjo6.js} +1 -1
  249. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-DEx02QDa.js → ScenarioViewer-BNLaXBHR.js} +3 -3
  250. package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-DyFZkK0l.js → TruncatedFilePath-CiwXDxLh.js} +1 -1
  251. package/codeyam-cli/src/webserver/build/client/assets/{_index-BwqWJOgH.js → _index-B3TDXxnk.js} +1 -1
  252. package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-DoLIqZX2.js → activity.(_tab)-BtBFH820.js} +6 -16
  253. package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-DfKzxuoe.js +11 -0
  254. package/codeyam-cli/src/webserver/build/client/assets/api.memory-profile-l0sNRNKZ.js +1 -0
  255. package/codeyam-cli/src/webserver/build/client/assets/api.save-fixture-l0sNRNKZ.js +1 -0
  256. package/codeyam-cli/src/webserver/build/client/assets/book-open-PttOB2SF.js +6 -0
  257. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-Cx24_aWc.js → chevron-down-TJp6ofnp.js} +1 -1
  258. package/codeyam-cli/src/webserver/build/client/assets/{chunk-EPOLDU6W-CXRTFQ3F.js → chunk-JZWAC4HX-JE9ZIoBl.js} +12 -12
  259. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-BOARzkeR.js → circle-check-CXhHQYrI.js} +1 -1
  260. package/codeyam-cli/src/webserver/build/client/assets/copy-6y9ALfGT.js +11 -0
  261. package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-BdhJEx6B.js → createLucideIcon-Ca9fAY46.js} +1 -1
  262. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-C5lqplTC.js +1 -0
  263. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-C2N4Op8e.js → entity._sha._-n38keI1k.js} +10 -10
  264. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.fullscreen-DavjRmOY.js → entity._sha.scenarios._scenarioId.fullscreen-CBoafmVs.js} +1 -1
  265. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.create-scenario-D1T4TGjf.js → entity._sha_.create-scenario-DGgZjdFg.js} +1 -1
  266. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-CTBG2mmz.js → entity._sha_.edit._scenarioId-38yPijoD.js} +1 -1
  267. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-CS2cb_eZ.js → entry.client-BSHEfydn.js} +1 -1
  268. package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-DMJ7zii9.js → fileTableUtils-DCPhhSMo.js} +1 -1
  269. package/codeyam-cli/src/webserver/build/client/assets/files-0N0YJQv7.js +1 -0
  270. package/codeyam-cli/src/webserver/build/client/assets/{git-B4RJRvYB.js → git-DXnyr8uP.js} +8 -8
  271. package/codeyam-cli/src/webserver/build/client/assets/globals-Bh6jH0cL.css +1 -0
  272. package/codeyam-cli/src/webserver/build/client/assets/{index-lzqtyFU8.js → index-CcsFv748.js} +1 -1
  273. package/codeyam-cli/src/webserver/build/client/assets/{index-B1h680n5.js → index-ChN9-fAY.js} +1 -1
  274. package/codeyam-cli/src/webserver/build/client/assets/labs-CdVUfvji.js +1 -0
  275. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-B7B9V-bu.js → loader-circle-CTqLEAGU.js} +1 -1
  276. package/codeyam-cli/src/webserver/build/client/assets/manifest-87319d0f.js +1 -0
  277. package/codeyam-cli/src/webserver/build/client/assets/memory-CPIDnDEj.js +76 -0
  278. package/codeyam-cli/src/webserver/build/client/assets/pause-D6vreykR.js +11 -0
  279. package/codeyam-cli/src/webserver/build/client/assets/root-D6oziHts.js +62 -0
  280. package/codeyam-cli/src/webserver/build/client/assets/{search-CxXUmBSd.js → search-B8VUL8nl.js} +1 -1
  281. package/codeyam-cli/src/webserver/build/client/assets/{settings-CS5f3WzT.js → settings-eBI36Yv5.js} +1 -1
  282. package/codeyam-cli/src/webserver/build/client/assets/{simulations-DwFIBT09.js → simulations-CPoAg7Zo.js} +1 -1
  283. package/codeyam-cli/src/webserver/build/client/assets/terminal-BrCP7uQo.js +11 -0
  284. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-B6LgvRJg.js → triangle-alert-BZz2NjYa.js} +1 -1
  285. package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-C1v1PQzo.js → useCustomSizes-DNwUduNu.js} +1 -1
  286. package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-aSv48UbS.js → useLastLogLine-COky1GVF.js} +1 -1
  287. package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-DYxHZQuP.js → useReportContext-CpZgwliL.js} +1 -1
  288. package/codeyam-cli/src/webserver/build/client/assets/{useToast-mBRpZPiu.js → useToast-Bv9JFvUO.js} +1 -1
  289. package/codeyam-cli/src/webserver/build/server/assets/index-9ox9LcrG.js +1 -0
  290. package/codeyam-cli/src/webserver/build/server/assets/server-build-Cq5Vqcob.js +260 -0
  291. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  292. package/codeyam-cli/src/webserver/build-info.json +5 -5
  293. package/codeyam-cli/templates/{codeyam-power-rules-hook.sh → codeyam-memory-hook.sh} +12 -13
  294. package/codeyam-cli/templates/codeyam:diagnose.md +178 -25
  295. package/codeyam-cli/templates/codeyam:memory.md +404 -0
  296. package/codeyam-cli/templates/codeyam:new-rule.md +2 -2
  297. package/codeyam-cli/templates/rule-notification-hook.py +56 -0
  298. package/codeyam-cli/templates/rule-reflection-hook.py +590 -0
  299. package/codeyam-cli/templates/rules-instructions.md +123 -0
  300. package/package.json +8 -6
  301. package/packages/ai/index.js +3 -2
  302. package/packages/ai/index.js.map +1 -1
  303. package/packages/ai/src/lib/analyzeScope.js +68 -13
  304. package/packages/ai/src/lib/analyzeScope.js.map +1 -1
  305. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +54 -8
  306. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
  307. package/packages/ai/src/lib/astScopes/methodSemantics.js +41 -17
  308. package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
  309. package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js +10 -14
  310. package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js.map +1 -1
  311. package/packages/ai/src/lib/astScopes/processExpression.js +239 -43
  312. package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
  313. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +650 -166
  314. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  315. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +5 -1
  316. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
  317. package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js +13 -3
  318. package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js.map +1 -1
  319. package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js +6 -4
  320. package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js.map +1 -1
  321. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +52 -3
  322. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
  323. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +55 -11
  324. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
  325. package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js +63 -0
  326. package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js.map +1 -0
  327. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +73 -5
  328. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
  329. package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js +173 -0
  330. package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js.map +1 -0
  331. package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js +37 -20
  332. package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js.map +1 -1
  333. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +333 -86
  334. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
  335. package/packages/ai/src/lib/generateEntityDataStructure.js +46 -2
  336. package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
  337. package/packages/ai/src/lib/generateEntityScenarioData.js +205 -1
  338. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  339. package/packages/ai/src/lib/generateEntityScenarios.js +7 -1
  340. package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
  341. package/packages/ai/src/lib/generateExecutionFlows.js +10 -2
  342. package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -1
  343. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +209 -3
  344. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -1
  345. package/packages/ai/src/lib/isolateScopes.js +39 -3
  346. package/packages/ai/src/lib/isolateScopes.js.map +1 -1
  347. package/packages/ai/src/lib/mergeStatements.js +70 -51
  348. package/packages/ai/src/lib/mergeStatements.js.map +1 -1
  349. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +10 -4
  350. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
  351. package/packages/ai/src/lib/resolvePathToControllable.js +24 -14
  352. package/packages/ai/src/lib/resolvePathToControllable.js.map +1 -1
  353. package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
  354. package/packages/ai/src/lib/worker/analyzeScopeWorker.js +94 -1
  355. package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
  356. package/packages/analyze/index.js +1 -0
  357. package/packages/analyze/index.js.map +1 -1
  358. package/packages/analyze/src/lib/FileAnalyzer.js +60 -36
  359. package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
  360. package/packages/analyze/src/lib/ProjectAnalyzer.js +96 -26
  361. package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
  362. package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js +14 -0
  363. package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js.map +1 -1
  364. package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js +14 -0
  365. package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js.map +1 -1
  366. package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js +6 -0
  367. package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js.map +1 -1
  368. package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js +6 -0
  369. package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js.map +1 -1
  370. package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js +39 -1
  371. package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js.map +1 -1
  372. package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js +2 -1
  373. package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js.map +1 -1
  374. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +54 -6
  375. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
  376. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +17 -4
  377. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  378. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js +5 -0
  379. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js.map +1 -1
  380. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js +2 -1
  381. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
  382. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +0 -3
  383. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
  384. package/packages/analyze/src/lib/files/analyzeRemixRoute.js +3 -2
  385. package/packages/analyze/src/lib/files/analyzeRemixRoute.js.map +1 -1
  386. package/packages/analyze/src/lib/files/getImportedExports.js +11 -7
  387. package/packages/analyze/src/lib/files/getImportedExports.js.map +1 -1
  388. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +880 -0
  389. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -0
  390. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +56 -10
  391. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -1
  392. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +33 -8
  393. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
  394. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +150 -17
  395. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  396. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +56 -8
  397. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -1
  398. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +399 -31
  399. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  400. package/packages/analyze/src/lib/files/setImportedExports.js +2 -1
  401. package/packages/analyze/src/lib/files/setImportedExports.js.map +1 -1
  402. package/packages/analyze/src/lib/index.js +1 -0
  403. package/packages/analyze/src/lib/index.js.map +1 -1
  404. package/packages/analyze/src/lib/utils/getFileByPath.js +12 -0
  405. package/packages/analyze/src/lib/utils/getFileByPath.js.map +1 -0
  406. package/packages/database/src/lib/kysely/db.js +8 -1
  407. package/packages/database/src/lib/kysely/db.js.map +1 -1
  408. package/packages/database/src/lib/kysely/tables/commitsTable.js +3 -0
  409. package/packages/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
  410. package/packages/database/src/lib/loadAnalyses.js +45 -2
  411. package/packages/database/src/lib/loadAnalyses.js.map +1 -1
  412. package/packages/database/src/lib/loadAnalysis.js +8 -0
  413. package/packages/database/src/lib/loadAnalysis.js.map +1 -1
  414. package/packages/database/src/lib/loadBranch.js +11 -1
  415. package/packages/database/src/lib/loadBranch.js.map +1 -1
  416. package/packages/database/src/lib/loadCommit.js +7 -0
  417. package/packages/database/src/lib/loadCommit.js.map +1 -1
  418. package/packages/database/src/lib/loadCommits.js +22 -1
  419. package/packages/database/src/lib/loadCommits.js.map +1 -1
  420. package/packages/database/src/lib/loadEntities.js +23 -4
  421. package/packages/database/src/lib/loadEntities.js.map +1 -1
  422. package/packages/database/src/lib/loadEntityBranches.js +9 -0
  423. package/packages/database/src/lib/loadEntityBranches.js.map +1 -1
  424. package/packages/database/src/lib/updateCommitMetadata.js +5 -4
  425. package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
  426. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-BXhEawa3.js +0 -1
  427. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-BRb-0kQl.js +0 -1
  428. package/codeyam-cli/src/webserver/build/client/assets/files-Cs4MdYtv.js +0 -1
  429. package/codeyam-cli/src/webserver/build/client/assets/git-commit-horizontal-CysbcZxi.js +0 -6
  430. package/codeyam-cli/src/webserver/build/client/assets/globals-DMUaGAqV.css +0 -1
  431. package/codeyam-cli/src/webserver/build/client/assets/manifest-f874c610.js +0 -1
  432. package/codeyam-cli/src/webserver/build/client/assets/root-Bz5TunQg.js +0 -57
  433. package/codeyam-cli/src/webserver/build/client/assets/rules-hEkvVw2-.js +0 -97
  434. package/codeyam-cli/src/webserver/build/server/assets/index-967OuJoF.js +0 -1
  435. package/codeyam-cli/src/webserver/build/server/assets/server-build-DRTmerg9.js +0 -257
  436. package/codeyam-cli/templates/codeyam:power-rules.md +0 -447
  437. /package/codeyam-cli/src/webserver/build/client/assets/{api.rules-l0sNRNKZ.js → api.agent-transcripts-l0sNRNKZ.js} +0 -0
@@ -1,4 +1,4 @@
1
- import{w as Y,u as q,a as G,b as J,r as l,j as e}from"./chunk-EPOLDU6W-CXRTFQ3F.js";import{u as O,S as P,I as $}from"./InlineSpinner-C8lyxW9k.js";import{u as Q}from"./useLastLogLine-aSv48UbS.js";import{u as X,V as Z,S as ee}from"./useCustomSizes-C1v1PQzo.js";import{c as te}from"./cy-logo-cli-DcX-ZS3p.js";const b=[{name:"Mobile",width:375,height:667},{name:"Tablet",width:768,height:1024},{name:"Laptop",width:1024,height:768},{name:"Desktop",width:1440,height:900}],de=Y(function(){const{entity:i,scenario:s,analysis:r,projectSlug:m}=q(),u=G();J();const[ne,w]=l.useState(null),[_,N]=l.useState(1440),[a,g]=l.useState({name:"Desktop",width:1440,height:900}),[z,p]=l.useState(!1),[f,B]=l.useState(null),{customSizes:S,addCustomSize:D}=X(m),x=l.useMemo(()=>[...b,...S],[S]),{interactiveServerUrl:y,isStarting:k,isLoading:C,showIframe:I,iframeKey:W,onIframeLoad:E}=O({analysisId:r==null?void 0:r.id,scenarioId:s==null?void 0:s.id,scenarioName:s==null?void 0:s.name,projectSlug:m,enabled:!0}),{lastLine:h}=Q(m,k||C),U=()=>{u(`/entity/${i.sha}`)},V=(t,n)=>{N(t);const o=x.find(M=>M.width===t&&M.height===n);w(o||null),g({name:(o==null?void 0:o.name)||"Custom",width:t,height:n})},L=t=>{w(t),N(t.width),g({name:t.name,width:t.width,height:t.height})},R=t=>{D(t,a.width,a.height??900),p(!1),g(n=>({...n,name:t}))},c=((r==null?void 0:r.scenarios)||[]).filter(t=>{var n;return!((n=t.metadata)!=null&&n.sameAsDefault)}),d=c.findIndex(t=>t.id===(s==null?void 0:s.id)),H=d+1,T=c.length,v=d>0,j=d<c.length-1,A=()=>{if(v){const t=c[d-1],n=encodeURIComponent(`/entity/${i.sha}/scenarios/${t.id}/fullscreen`);u(`/entity/${i.sha}/scenarios/${t.id}/fullscreen?from=${n}`)}},F=()=>{if(j){const t=c[d+1],n=encodeURIComponent(`/entity/${i.sha}/scenarios/${t.id}/fullscreen`);u(`/entity/${i.sha}/scenarios/${t.id}/fullscreen?from=${n}`)}},K=k||C||!I;return e.jsxs("div",{className:"fixed inset-0 bg-[#2d2d2d] flex flex-col",children:[e.jsxs("div",{className:"bg-[#3d3d3d] h-12 flex items-center px-4 gap-4 shrink-0 z-20",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("img",{src:te,alt:"CodeYam",className:"h-6 brightness-0 invert"}),e.jsx("span",{className:"text-white font-medium text-sm whitespace-nowrap",children:i.name}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("button",{onClick:A,disabled:!v,className:`${v?"text-white hover:text-gray-300":"text-gray-600 cursor-not-allowed"} transition-colors`,"aria-label":"Previous scenario",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e.jsx("path",{d:"M12.5 15L7.5 10L12.5 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),e.jsxs("span",{className:"text-gray-400 text-sm",children:[H,"/",T]}),e.jsx("button",{onClick:F,disabled:!j,className:`${j?"text-white hover:text-gray-300":"text-gray-600 cursor-not-allowed"} transition-colors`,"aria-label":"Next scenario",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e.jsx("path",{d:"M7.5 15L12.5 10L7.5 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-2 min-w-0",children:[e.jsx("span",{className:"text-white font-semibold text-xs whitespace-nowrap shrink-0",children:s==null?void 0:s.name}),(s==null?void 0:s.description)&&e.jsxs("div",{className:"relative group min-w-0",children:[e.jsx("span",{className:"text-gray-400 text-xs truncate block",children:s.description}),e.jsx("div",{className:"absolute left-0 top-full mt-1 hidden group-hover:block z-50 bg-black text-white text-xs px-3 py-2 rounded shadow-lg max-w-md",children:s.description})]})]})]}),e.jsx("button",{onClick:U,className:"text-white hover:text-gray-300 transition-colors ml-4","aria-label":"Close fullscreen",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e.jsx("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"bg-[#e5e7eb] border-b border-[rgba(0,0,0,0.1)] shrink-0 z-10 h-6 flex items-center justify-center relative",children:[e.jsx("div",{className:"absolute inset-0 flex justify-center",children:e.jsx("div",{style:{maxWidth:`${b[b.length-1].width}px`,width:"100%"},children:e.jsx(Z,{currentViewportWidth:_,currentPresetName:a.name,onDevicePresetClick:L,devicePresets:x,hideLabel:!0,onHoverChange:B,lightMode:!0})})}),e.jsxs("div",{className:"relative z-10 flex items-center gap-2",children:[e.jsxs("div",{className:"relative w-28 h-5",children:[e.jsxs("div",{className:"absolute inset-0 bg-white text-gray-900 text-xs px-2 rounded flex items-center justify-between pointer-events-none border border-gray-300",children:[e.jsx("span",{className:"leading-none",children:(f==null?void 0:f.name)||a.name}),e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e.jsxs("select",{value:a.name,onChange:t=>{const n=x.find(o=>o.name===t.target.value);n&&L(n)},className:"relative w-full h-full opacity-0 cursor-pointer",children:[x.map(t=>e.jsx("option",{value:t.name,children:t.name},t.name)),a.name==="Custom"&&e.jsx("option",{value:"Custom",children:"Custom"})]})]}),e.jsx("input",{type:"number",value:a.width,onChange:t=>{const n=parseInt(t.target.value,10);!isNaN(n)&&n>0&&V(n,a.height??900)},className:"bg-white text-gray-900 text-xs px-1 rounded border border-gray-300 outline-none w-16 text-center h-5 leading-none",min:"200",max:"3840"}),e.jsx("span",{className:"text-gray-400 text-xs h-5 flex items-center leading-none",children:"×"}),e.jsx("span",{className:"bg-gray-100 text-gray-600 text-xs px-1 rounded w-14 text-center h-5 flex items-center justify-center leading-none",children:a.height??900}),a.name==="Custom"&&e.jsx("button",{onClick:()=>p(!0),className:"bg-white text-gray-900 text-xs px-2 rounded h-5 flex items-center leading-none border border-gray-300 hover:bg-gray-50 transition-colors",children:"Save"})]})]}),e.jsx("div",{className:"flex-1 flex items-center justify-center overflow-auto p-8",style:{backgroundImage:`
1
+ import{w as Y,u as q,a as G,b as J,r as l,j as e}from"./chunk-JZWAC4HX-JE9ZIoBl.js";import{u as O,S as P,I as $}from"./InlineSpinner-ClaLpuOo.js";import{u as Q}from"./useLastLogLine-COky1GVF.js";import{u as X,V as Z,S as ee}from"./useCustomSizes-DNwUduNu.js";import{c as te}from"./cy-logo-cli-DcX-ZS3p.js";const b=[{name:"Mobile",width:375,height:667},{name:"Tablet",width:768,height:1024},{name:"Laptop",width:1024,height:768},{name:"Desktop",width:1440,height:900}],de=Y(function(){const{entity:i,scenario:s,analysis:r,projectSlug:m}=q(),u=G();J();const[ne,w]=l.useState(null),[_,N]=l.useState(1440),[a,g]=l.useState({name:"Desktop",width:1440,height:900}),[z,p]=l.useState(!1),[f,B]=l.useState(null),{customSizes:S,addCustomSize:D}=X(m),x=l.useMemo(()=>[...b,...S],[S]),{interactiveServerUrl:y,isStarting:k,isLoading:C,showIframe:I,iframeKey:W,onIframeLoad:E}=O({analysisId:r==null?void 0:r.id,scenarioId:s==null?void 0:s.id,scenarioName:s==null?void 0:s.name,projectSlug:m,enabled:!0}),{lastLine:h}=Q(m,k||C),U=()=>{u(`/entity/${i.sha}`)},V=(t,n)=>{N(t);const o=x.find(M=>M.width===t&&M.height===n);w(o||null),g({name:(o==null?void 0:o.name)||"Custom",width:t,height:n})},L=t=>{w(t),N(t.width),g({name:t.name,width:t.width,height:t.height})},R=t=>{D(t,a.width,a.height??900),p(!1),g(n=>({...n,name:t}))},c=((r==null?void 0:r.scenarios)||[]).filter(t=>{var n;return!((n=t.metadata)!=null&&n.sameAsDefault)}),d=c.findIndex(t=>t.id===(s==null?void 0:s.id)),H=d+1,T=c.length,v=d>0,j=d<c.length-1,A=()=>{if(v){const t=c[d-1],n=encodeURIComponent(`/entity/${i.sha}/scenarios/${t.id}/fullscreen`);u(`/entity/${i.sha}/scenarios/${t.id}/fullscreen?from=${n}`)}},F=()=>{if(j){const t=c[d+1],n=encodeURIComponent(`/entity/${i.sha}/scenarios/${t.id}/fullscreen`);u(`/entity/${i.sha}/scenarios/${t.id}/fullscreen?from=${n}`)}},K=k||C||!I;return e.jsxs("div",{className:"fixed inset-0 bg-[#2d2d2d] flex flex-col",children:[e.jsxs("div",{className:"bg-[#3d3d3d] h-12 flex items-center px-4 gap-4 shrink-0 z-20",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("img",{src:te,alt:"CodeYam",className:"h-6 brightness-0 invert"}),e.jsx("span",{className:"text-white font-medium text-sm whitespace-nowrap",children:i.name}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("button",{onClick:A,disabled:!v,className:`${v?"text-white hover:text-gray-300":"text-gray-600 cursor-not-allowed"} transition-colors`,"aria-label":"Previous scenario",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e.jsx("path",{d:"M12.5 15L7.5 10L12.5 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),e.jsxs("span",{className:"text-gray-400 text-sm",children:[H,"/",T]}),e.jsx("button",{onClick:F,disabled:!j,className:`${j?"text-white hover:text-gray-300":"text-gray-600 cursor-not-allowed"} transition-colors`,"aria-label":"Next scenario",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e.jsx("path",{d:"M7.5 15L12.5 10L7.5 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-2 min-w-0",children:[e.jsx("span",{className:"text-white font-semibold text-xs whitespace-nowrap shrink-0",children:s==null?void 0:s.name}),(s==null?void 0:s.description)&&e.jsxs("div",{className:"relative group min-w-0",children:[e.jsx("span",{className:"text-gray-400 text-xs truncate block",children:s.description}),e.jsx("div",{className:"absolute left-0 top-full mt-1 hidden group-hover:block z-50 bg-black text-white text-xs px-3 py-2 rounded shadow-lg max-w-md",children:s.description})]})]})]}),e.jsx("button",{onClick:U,className:"text-white hover:text-gray-300 transition-colors ml-4","aria-label":"Close fullscreen",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e.jsx("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"bg-[#e5e7eb] border-b border-[rgba(0,0,0,0.1)] shrink-0 z-10 h-6 flex items-center justify-center relative",children:[e.jsx("div",{className:"absolute inset-0 flex justify-center",children:e.jsx("div",{style:{maxWidth:`${b[b.length-1].width}px`,width:"100%"},children:e.jsx(Z,{currentViewportWidth:_,currentPresetName:a.name,onDevicePresetClick:L,devicePresets:x,hideLabel:!0,onHoverChange:B,lightMode:!0})})}),e.jsxs("div",{className:"relative z-10 flex items-center gap-2",children:[e.jsxs("div",{className:"relative w-28 h-5",children:[e.jsxs("div",{className:"absolute inset-0 bg-white text-gray-900 text-xs px-2 rounded flex items-center justify-between pointer-events-none border border-gray-300",children:[e.jsx("span",{className:"leading-none",children:(f==null?void 0:f.name)||a.name}),e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e.jsxs("select",{value:a.name,onChange:t=>{const n=x.find(o=>o.name===t.target.value);n&&L(n)},className:"relative w-full h-full opacity-0 cursor-pointer",children:[x.map(t=>e.jsx("option",{value:t.name,children:t.name},t.name)),a.name==="Custom"&&e.jsx("option",{value:"Custom",children:"Custom"})]})]}),e.jsx("input",{type:"number",value:a.width,onChange:t=>{const n=parseInt(t.target.value,10);!isNaN(n)&&n>0&&V(n,a.height??900)},className:"bg-white text-gray-900 text-xs px-1 rounded border border-gray-300 outline-none w-16 text-center h-5 leading-none",min:"200",max:"3840"}),e.jsx("span",{className:"text-gray-400 text-xs h-5 flex items-center leading-none",children:"×"}),e.jsx("span",{className:"bg-gray-100 text-gray-600 text-xs px-1 rounded w-14 text-center h-5 flex items-center justify-center leading-none",children:a.height??900}),a.name==="Custom"&&e.jsx("button",{onClick:()=>p(!0),className:"bg-white text-gray-900 text-xs px-2 rounded h-5 flex items-center leading-none border border-gray-300 hover:bg-gray-50 transition-colors",children:"Save"})]})]}),e.jsx("div",{className:"flex-1 flex items-center justify-center overflow-auto p-8",style:{backgroundImage:`
2
2
  linear-gradient(45deg, #ebebeb 25%, transparent 25%),
3
3
  linear-gradient(-45deg, #ebebeb 25%, transparent 25%),
4
4
  linear-gradient(45deg, transparent 75%, #ebebeb 75%),
@@ -1,4 +1,4 @@
1
- import{r as a,j as e,w as Z,u as ee,a as te,L as v}from"./chunk-EPOLDU6W-CXRTFQ3F.js";import{W as se,u as re,I as ae}from"./InteractivePreview-aht4aafF.js";import{u as ne}from"./InlineSpinner-C8lyxW9k.js";import{c as oe}from"./executionFlowCoverage-BWhdfn70.js";import"./preload-helper-ckwbz45p.js";import"./useLastLogLine-aSv48UbS.js";function ie({executionFlows:t,selections:r,onChange:n,disabled:i=!1}){const x=a.useCallback(s=>r.some(o=>o.flowId===s),[r]),p=a.useCallback(s=>{x(s.id)?n(r.filter(o=>o.flowId!==s.id)):n([...r,{flowId:s.id,flowName:s.name}])},[r,n,x]);return t.length===0?e.jsx("div",{className:"text-sm text-gray-500 py-2",children:"No execution flows found."}):e.jsx("div",{className:"space-y-3",children:t.map(s=>{const o=x(s.id),I=s.usedInScenarios.length>0;return e.jsxs("div",{className:"border-b border-gray-100 pb-3 last:border-0 last:pb-0",children:[e.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:o,onChange:()=>p(s),disabled:i,className:"mt-0.5 h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-mono text-sm font-medium text-gray-900",children:s.name}),!I&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-amber-100 text-amber-700 rounded",children:"uncovered"}),s.blocksOtherFlows&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-purple-100 text-purple-700 rounded",children:"blocking"}),s.impact==="high"&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-red-100 text-red-700 rounded",children:"high impact"})]}),s.description&&e.jsx("p",{className:"text-xs text-gray-500 mt-0.5 m-0",children:s.description})]})]}),o&&s.requiredValues.length>0&&e.jsxs("div",{className:"ml-6 mt-2 p-2 bg-gray-50 rounded text-xs",children:[e.jsx("span",{className:"text-gray-700 font-medium",children:"Required values:"}),e.jsx("ul",{className:"m-0 mt-1 pl-4 space-y-0.5",children:s.requiredValues.map((h,E)=>e.jsxs("li",{className:"text-gray-600",children:[e.jsx("code",{className:"bg-gray-100 px-1 rounded",children:h.attributePath})," ",e.jsx("span",{className:"text-gray-400",children:h.comparison})," ",e.jsx("code",{className:"bg-gray-100 px-1 rounded",children:h.value})]},E))})]})]},s.id)})})}const he=({data:t})=>[{title:t!=null&&t.entity?`Create Scenario - ${t.entity.name} - CodeYam`:"Create Scenario - CodeYam"},{name:"description",content:"Create a new scenario"}];function ce(){var W;const{analysis:t,defaultScenario:r,entity:n,entitySha:i,projectSlug:x}=ee(),p=te(),{iframeRef:s}=re(),[o,I]=a.useState(""),[h,E]=a.useState(400),[b,P]=a.useState(!1),[U,R]=a.useState(!1),[G,$]=a.useState(!1),[M,L]=a.useState(null),[F,l]=a.useState(null),[d,H]=a.useState([]),D=a.useMemo(()=>{var c;return!((c=t==null?void 0:t.metadata)!=null&&c.executionFlows)||!(t!=null&&t.scenarios)?[]:oe(t.metadata.executionFlows,t.scenarios).executionFlows},[t]),{interactiveServerUrl:y,isStarting:J,isLoading:_,showIframe:q,iframeKey:B,onIframeLoad:V}=ne({analysisId:t==null?void 0:t.id,scenarioId:r==null?void 0:r.id,scenarioName:r==null?void 0:r.name,projectSlug:x,enabled:!0}),Y=a.useCallback(async()=>{var m,c,T,z;if(!o.trim()&&d.length===0){L("Please describe how you want to change the scenario or select execution flows");return}R(!0),L(null),l("Generating scenario with AI...");try{const u=await fetch("/api/generate-scenario-data",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:o,existingScenarios:t.scenarios,scenariosDataStructure:(m=t.metadata)==null?void 0:m.scenariosDataStructure,flowSelections:d.length>0?d:void 0})}),N=await u.json();if(!u.ok||!N.success)throw new Error(N.error||"Failed to generate scenario data");console.log("[CreateScenario] AI generated scenario:",N.data);const g=N.data;if(!g.name||!g.data)throw new Error("AI response missing required fields (name or data)");l("Saving new scenario..."),$(!0);const X={name:g.name,description:g.description||o,metadata:{data:g.data,interactiveExamplePath:(c=r.metadata)==null?void 0:c.interactiveExamplePath}},Q=[...t.scenarios||[],X],O=await fetch("/api/save-scenarios",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({analysis:t,scenarios:Q})}),C=await O.json();if(!O.ok||!C.success)throw new Error(C.error||"Failed to save scenario");console.log("[CreateScenario] Scenario saved:",C);const f=(z=(T=C.analysis)==null?void 0:T.scenarios)==null?void 0:z.find(k=>k.name===g.name);if(!(f!=null&&f.id)){console.warn("[CreateScenario] Could not find saved scenario ID, navigating to entity page"),l("Scenario created! Redirecting..."),setTimeout(()=>void p(`/entity/${i}`),1e3);return}if(y){l("Capturing screenshot...");const k=await fetch("/api/capture-screenshot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({serverUrl:y,scenarioId:f.id,projectId:t.projectId,viewportWidth:1440})}),A=await k.json();!k.ok||!A.success?(console.error("[CreateScenario] Capture failed:",A),l("Scenario created! (Screenshot capture failed)")):l("Scenario created and captured!")}else l("Scenario created!");setTimeout(()=>{p(`/entity/${i}/scenarios/${f.id}`)},1e3)}catch(u){console.error("[CreateScenario] Error:",u),L(u instanceof Error?u.message:String(u)),l(null)}finally{R(!1),$(!1)}},[o,d,t,r,i,y,p]),j=U||G,K=a.useCallback(()=>{P(!0)},[]),w=a.useCallback(m=>{if(!b)return;const c=m.clientX;c>=250&&c<=600&&E(c)},[b]),S=a.useCallback(()=>{P(!1)},[]);return a.useEffect(()=>(b?(document.addEventListener("mousemove",w),document.addEventListener("mouseup",S)):(document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",S)),()=>{document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",S)}),[b,w,S]),e.jsxs("div",{className:"h-screen bg-white 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-end h-full px-6 gap-6",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1 pb-[14px]",children:[e.jsx("button",{onClick:()=>void p(`/entity/${i}`),className:"no-underline shrink-0 bg-transparent border-none cursor-pointer p-0 flex items-center",title:"Back",children:e.jsx("svg",{width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",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-base font-semibold text-black m-0 leading-[20px] shrink-0",children:n==null?void 0:n.name}),e.jsx("span",{className:"text-xs text-[#9e9e9e] font-mono font-normal whitespace-nowrap overflow-hidden text-ellipsis min-w-0",title:n==null?void 0:n.filePath,children:n==null?void 0:n.filePath})]}),e.jsxs("div",{className:"flex items-end gap-8 shrink-0",children:[e.jsx(v,{to:`/entity/${i}/scenarios`,className:"relative pb-[17px] px-2 text-sm transition-colors cursor-pointer no-underline font-medium border-b-2",style:{color:"#005C75",borderColor:"#005C75"},children:e.jsxs("span",{className:"flex items-center gap-2",children:["Scenarios",e.jsx("span",{className:"inline-flex items-center justify-center px-2 py-0.5 text-xs font-semibold rounded-full bg-[#cbf3fa] text-[#005c75]",children:((W=t==null?void 0:t.scenarios)==null?void 0:W.length)||0})]})}),e.jsx(v,{to:`/entity/${i}/related`,className:"relative pb-[17px] px-2 text-sm transition-colors cursor-pointer no-underline font-normal hover:text-gray-700",style:{color:"#9ca3af"},children:"Related Entities"}),e.jsx(v,{to:`/entity/${i}/code`,className:"relative pb-[17px] px-2 text-sm transition-colors cursor-pointer no-underline font-normal hover:text-gray-700",style:{color:"#9ca3af"},children:"Code"}),e.jsx(v,{to:`/entity/${i}/data`,className:"relative pb-[17px] px-2 text-sm transition-colors cursor-pointer no-underline font-normal hover:text-gray-700",style:{color:"#9ca3af"},children:"Data Structure"}),e.jsx(v,{to:`/entity/${i}/history`,className:"relative pb-[17px] px-2 text-sm transition-colors cursor-pointer no-underline font-normal hover:text-gray-700",style:{color:"#9ca3af"},children:"History"})]})]})}),e.jsxs("div",{className:"flex flex-1 gap-0 min-h-0 relative",children:[e.jsxs("aside",{className:"bg-white border-r border-gray-200 overflow-y-auto shrink-0 p-6 flex flex-col",style:{width:`${h}px`},children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 mb-2",children:"Default Scenario Preview"}),e.jsx("p",{className:"text-sm text-gray-600 leading-relaxed",children:"The preview on the right shows the Default Scenario. Select execution flows and/or describe how you'd like to change it."})]}),D.length>0&&e.jsxs("details",{className:"mb-4 border border-gray-200 rounded-lg",children:[e.jsxs("summary",{className:"px-3 py-2 text-sm font-medium text-gray-700 cursor-pointer hover:bg-gray-50 rounded-lg",children:["Select Execution Flows"," ",d.length>0&&e.jsxs("span",{className:"text-blue-600",children:["(",d.length," selected)"]})]}),e.jsx("div",{className:"px-3 pb-3 pt-1 border-t border-gray-100",children:e.jsx(ie,{executionFlows:D,selections:d,onChange:H,disabled:j})})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{htmlFor:"prompt",className:"block text-sm font-medium text-gray-700 mb-2",children:"Describe your scenario"}),e.jsx("textarea",{id:"prompt",value:o,onChange:m=>I(m.target.value),placeholder:"e.g., Show an empty state with no items...",className:"w-full h-32 px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 text-sm resize-none",disabled:j})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("button",{onClick:()=>void Y(),disabled:j||!o.trim()&&d.length===0,className:"w-full px-4 py-2 bg-blue-600 text-white rounded-lg text-sm font-medium cursor-pointer transition-colors hover:bg-blue-700 disabled:bg-gray-400 disabled:cursor-not-allowed",children:j?"Creating...":"Create Scenario"}),F&&e.jsx("div",{className:"text-xs text-blue-600 bg-blue-50 px-2 py-1.5 rounded",children:F}),M&&e.jsx("div",{className:"text-xs text-red-600 bg-red-50 px-2 py-1.5 rounded",children:M})]})]}),e.jsxs("div",{onMouseDown:K,style:{width:"20px",position:"absolute",top:0,left:`${h-10}px`,bottom:0,cursor:"col-resize",touchAction:"none",userSelect:"none",zIndex:100,pointerEvents:"auto"},children:[e.jsx("div",{style:{position:"absolute",left:"10px",top:0,bottom:0,width:"1px",background:b?"#005c75":"rgba(0,0,0,0.1)",transition:"background 0.15s ease"}}),e.jsx("div",{style:{position:"absolute",top:"50%",left:"10px",transform:"translate(-50%, -50%)",width:"8px",height:"40px",background:"#fff",border:"1px solid rgba(0,0,0,0.15)",borderRadius:"4px",cursor:"col-resize"}})]}),e.jsx("main",{className:"flex-1 overflow-auto flex items-center justify-center min-w-0",style:{backgroundImage:`
1
+ import{r as a,j as e,w as Z,u as ee,a as te,L as v}from"./chunk-JZWAC4HX-JE9ZIoBl.js";import{W as se,u as re,I as ae}from"./InteractivePreview-BDhPilK7.js";import{u as ne}from"./InlineSpinner-ClaLpuOo.js";import{c as oe}from"./executionFlowCoverage-BWhdfn70.js";import"./preload-helper-ckwbz45p.js";import"./useLastLogLine-COky1GVF.js";function ie({executionFlows:t,selections:r,onChange:n,disabled:i=!1}){const x=a.useCallback(s=>r.some(o=>o.flowId===s),[r]),p=a.useCallback(s=>{x(s.id)?n(r.filter(o=>o.flowId!==s.id)):n([...r,{flowId:s.id,flowName:s.name}])},[r,n,x]);return t.length===0?e.jsx("div",{className:"text-sm text-gray-500 py-2",children:"No execution flows found."}):e.jsx("div",{className:"space-y-3",children:t.map(s=>{const o=x(s.id),I=s.usedInScenarios.length>0;return e.jsxs("div",{className:"border-b border-gray-100 pb-3 last:border-0 last:pb-0",children:[e.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:o,onChange:()=>p(s),disabled:i,className:"mt-0.5 h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-mono text-sm font-medium text-gray-900",children:s.name}),!I&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-amber-100 text-amber-700 rounded",children:"uncovered"}),s.blocksOtherFlows&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-purple-100 text-purple-700 rounded",children:"blocking"}),s.impact==="high"&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-red-100 text-red-700 rounded",children:"high impact"})]}),s.description&&e.jsx("p",{className:"text-xs text-gray-500 mt-0.5 m-0",children:s.description})]})]}),o&&s.requiredValues.length>0&&e.jsxs("div",{className:"ml-6 mt-2 p-2 bg-gray-50 rounded text-xs",children:[e.jsx("span",{className:"text-gray-700 font-medium",children:"Required values:"}),e.jsx("ul",{className:"m-0 mt-1 pl-4 space-y-0.5",children:s.requiredValues.map((h,E)=>e.jsxs("li",{className:"text-gray-600",children:[e.jsx("code",{className:"bg-gray-100 px-1 rounded",children:h.attributePath})," ",e.jsx("span",{className:"text-gray-400",children:h.comparison})," ",e.jsx("code",{className:"bg-gray-100 px-1 rounded",children:h.value})]},E))})]})]},s.id)})})}const he=({data:t})=>[{title:t!=null&&t.entity?`Create Scenario - ${t.entity.name} - CodeYam`:"Create Scenario - CodeYam"},{name:"description",content:"Create a new scenario"}];function ce(){var W;const{analysis:t,defaultScenario:r,entity:n,entitySha:i,projectSlug:x}=ee(),p=te(),{iframeRef:s}=re(),[o,I]=a.useState(""),[h,E]=a.useState(400),[b,P]=a.useState(!1),[U,R]=a.useState(!1),[G,$]=a.useState(!1),[M,L]=a.useState(null),[F,l]=a.useState(null),[d,H]=a.useState([]),D=a.useMemo(()=>{var c;return!((c=t==null?void 0:t.metadata)!=null&&c.executionFlows)||!(t!=null&&t.scenarios)?[]:oe(t.metadata.executionFlows,t.scenarios).executionFlows},[t]),{interactiveServerUrl:y,isStarting:J,isLoading:_,showIframe:q,iframeKey:B,onIframeLoad:V}=ne({analysisId:t==null?void 0:t.id,scenarioId:r==null?void 0:r.id,scenarioName:r==null?void 0:r.name,projectSlug:x,enabled:!0}),Y=a.useCallback(async()=>{var m,c,T,z;if(!o.trim()&&d.length===0){L("Please describe how you want to change the scenario or select execution flows");return}R(!0),L(null),l("Generating scenario with AI...");try{const u=await fetch("/api/generate-scenario-data",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:o,existingScenarios:t.scenarios,scenariosDataStructure:(m=t.metadata)==null?void 0:m.scenariosDataStructure,flowSelections:d.length>0?d:void 0})}),N=await u.json();if(!u.ok||!N.success)throw new Error(N.error||"Failed to generate scenario data");console.log("[CreateScenario] AI generated scenario:",N.data);const g=N.data;if(!g.name||!g.data)throw new Error("AI response missing required fields (name or data)");l("Saving new scenario..."),$(!0);const X={name:g.name,description:g.description||o,metadata:{data:g.data,interactiveExamplePath:(c=r.metadata)==null?void 0:c.interactiveExamplePath}},Q=[...t.scenarios||[],X],O=await fetch("/api/save-scenarios",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({analysis:t,scenarios:Q})}),C=await O.json();if(!O.ok||!C.success)throw new Error(C.error||"Failed to save scenario");console.log("[CreateScenario] Scenario saved:",C);const f=(z=(T=C.analysis)==null?void 0:T.scenarios)==null?void 0:z.find(k=>k.name===g.name);if(!(f!=null&&f.id)){console.warn("[CreateScenario] Could not find saved scenario ID, navigating to entity page"),l("Scenario created! Redirecting..."),setTimeout(()=>void p(`/entity/${i}`),1e3);return}if(y){l("Capturing screenshot...");const k=await fetch("/api/capture-screenshot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({serverUrl:y,scenarioId:f.id,projectId:t.projectId,viewportWidth:1440})}),A=await k.json();!k.ok||!A.success?(console.error("[CreateScenario] Capture failed:",A),l("Scenario created! (Screenshot capture failed)")):l("Scenario created and captured!")}else l("Scenario created!");setTimeout(()=>{p(`/entity/${i}/scenarios/${f.id}`)},1e3)}catch(u){console.error("[CreateScenario] Error:",u),L(u instanceof Error?u.message:String(u)),l(null)}finally{R(!1),$(!1)}},[o,d,t,r,i,y,p]),j=U||G,K=a.useCallback(()=>{P(!0)},[]),w=a.useCallback(m=>{if(!b)return;const c=m.clientX;c>=250&&c<=600&&E(c)},[b]),S=a.useCallback(()=>{P(!1)},[]);return a.useEffect(()=>(b?(document.addEventListener("mousemove",w),document.addEventListener("mouseup",S)):(document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",S)),()=>{document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",S)}),[b,w,S]),e.jsxs("div",{className:"h-screen bg-white 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-end h-full px-6 gap-6",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1 pb-[14px]",children:[e.jsx("button",{onClick:()=>void p(`/entity/${i}`),className:"no-underline shrink-0 bg-transparent border-none cursor-pointer p-0 flex items-center",title:"Back",children:e.jsx("svg",{width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",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-base font-semibold text-black m-0 leading-[20px] shrink-0",children:n==null?void 0:n.name}),e.jsx("span",{className:"text-xs text-[#9e9e9e] font-mono font-normal whitespace-nowrap overflow-hidden text-ellipsis min-w-0",title:n==null?void 0:n.filePath,children:n==null?void 0:n.filePath})]}),e.jsxs("div",{className:"flex items-end gap-8 shrink-0",children:[e.jsx(v,{to:`/entity/${i}/scenarios`,className:"relative pb-[17px] px-2 text-sm transition-colors cursor-pointer no-underline font-medium border-b-2",style:{color:"#005C75",borderColor:"#005C75"},children:e.jsxs("span",{className:"flex items-center gap-2",children:["Scenarios",e.jsx("span",{className:"inline-flex items-center justify-center px-2 py-0.5 text-xs font-semibold rounded-full bg-[#cbf3fa] text-[#005c75]",children:((W=t==null?void 0:t.scenarios)==null?void 0:W.length)||0})]})}),e.jsx(v,{to:`/entity/${i}/related`,className:"relative pb-[17px] px-2 text-sm transition-colors cursor-pointer no-underline font-normal hover:text-gray-700",style:{color:"#9ca3af"},children:"Related Entities"}),e.jsx(v,{to:`/entity/${i}/code`,className:"relative pb-[17px] px-2 text-sm transition-colors cursor-pointer no-underline font-normal hover:text-gray-700",style:{color:"#9ca3af"},children:"Code"}),e.jsx(v,{to:`/entity/${i}/data`,className:"relative pb-[17px] px-2 text-sm transition-colors cursor-pointer no-underline font-normal hover:text-gray-700",style:{color:"#9ca3af"},children:"Data Structure"}),e.jsx(v,{to:`/entity/${i}/history`,className:"relative pb-[17px] px-2 text-sm transition-colors cursor-pointer no-underline font-normal hover:text-gray-700",style:{color:"#9ca3af"},children:"History"})]})]})}),e.jsxs("div",{className:"flex flex-1 gap-0 min-h-0 relative",children:[e.jsxs("aside",{className:"bg-white border-r border-gray-200 overflow-y-auto shrink-0 p-6 flex flex-col",style:{width:`${h}px`},children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 mb-2",children:"Default Scenario Preview"}),e.jsx("p",{className:"text-sm text-gray-600 leading-relaxed",children:"The preview on the right shows the Default Scenario. Select execution flows and/or describe how you'd like to change it."})]}),D.length>0&&e.jsxs("details",{className:"mb-4 border border-gray-200 rounded-lg",children:[e.jsxs("summary",{className:"px-3 py-2 text-sm font-medium text-gray-700 cursor-pointer hover:bg-gray-50 rounded-lg",children:["Select Execution Flows"," ",d.length>0&&e.jsxs("span",{className:"text-blue-600",children:["(",d.length," selected)"]})]}),e.jsx("div",{className:"px-3 pb-3 pt-1 border-t border-gray-100",children:e.jsx(ie,{executionFlows:D,selections:d,onChange:H,disabled:j})})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{htmlFor:"prompt",className:"block text-sm font-medium text-gray-700 mb-2",children:"Describe your scenario"}),e.jsx("textarea",{id:"prompt",value:o,onChange:m=>I(m.target.value),placeholder:"e.g., Show an empty state with no items...",className:"w-full h-32 px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 text-sm resize-none",disabled:j})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("button",{onClick:()=>void Y(),disabled:j||!o.trim()&&d.length===0,className:"w-full px-4 py-2 bg-blue-600 text-white rounded-lg text-sm font-medium cursor-pointer transition-colors hover:bg-blue-700 disabled:bg-gray-400 disabled:cursor-not-allowed",children:j?"Creating...":"Create Scenario"}),F&&e.jsx("div",{className:"text-xs text-blue-600 bg-blue-50 px-2 py-1.5 rounded",children:F}),M&&e.jsx("div",{className:"text-xs text-red-600 bg-red-50 px-2 py-1.5 rounded",children:M})]})]}),e.jsxs("div",{onMouseDown:K,style:{width:"20px",position:"absolute",top:0,left:`${h-10}px`,bottom:0,cursor:"col-resize",touchAction:"none",userSelect:"none",zIndex:100,pointerEvents:"auto"},children:[e.jsx("div",{style:{position:"absolute",left:"10px",top:0,bottom:0,width:"1px",background:b?"#005c75":"rgba(0,0,0,0.1)",transition:"background 0.15s ease"}}),e.jsx("div",{style:{position:"absolute",top:"50%",left:"10px",transform:"translate(-50%, -50%)",width:"8px",height:"40px",background:"#fff",border:"1px solid rgba(0,0,0,0.15)",borderRadius:"4px",cursor:"col-resize"}})]}),e.jsx("main",{className:"flex-1 overflow-auto flex items-center justify-center min-w-0",style:{backgroundImage:`
2
2
  linear-gradient(45deg, #ebebeb 25%, transparent 25%),
3
3
  linear-gradient(-45deg, #ebebeb 25%, transparent 25%),
4
4
  linear-gradient(45deg, transparent 75%, #ebebeb 75%),
@@ -1,4 +1,4 @@
1
- import{j as e,r as l,w as Y,u as K,a as Q,L as z}from"./chunk-EPOLDU6W-CXRTFQ3F.js";import{W as X,u as Z,I as ee}from"./InteractivePreview-aht4aafF.js";import{u as te}from"./InlineSpinner-C8lyxW9k.js";import"./preload-helper-ckwbz45p.js";import"./useLastLogLine-aSv48UbS.js";function U(t,n,r){if(Array.isArray(t)){if(!isNaN(parseInt(n)))return t[parseInt(n)];for(const s of t)if(s.name===n||s.title===n||s.id===n)return s}return t[n]}function q(t){return t&&(typeof t=="object"||Array.isArray(t))}function re(t){return Array.isArray(t)?t.length:void 0}function ne(t){const{data:n,structure:r}=t;if(!(!n&&!r)){if(Array.isArray(r))return Array.isArray(n)?n.map((s,d)=>d.toString()):[];if(typeof r=="object")return[...new Set([...Object.keys(n),...Object.keys(r)])].sort((d,o)=>{const p=q(n[d]),c=q(n[o]);return p&&!c?1:!p&&c?-1:d.localeCompare(o)});if(typeof n=="object")return Object.keys(n).sort((d,o)=>d.localeCompare(o))}}function se({scenarioFormData:t,handleInputChange:n}){return e.jsxs("div",{className:"p-3 flex flex-col gap-3",children:[e.jsxs("div",{className:"grid w-full max-w-sm items-center gap-1.5",children:[e.jsx("label",{htmlFor:"name",className:"text-sm font-medium text-gray-700",children:"Name"}),e.jsx("input",{type:"text",id:"name",placeholder:"Name",name:"name",value:t.name,onChange:n,required:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),e.jsxs("div",{className:"grid w-full gap-1.5 pt-2",children:[e.jsx("label",{htmlFor:"description",className:"text-sm font-medium text-gray-700",children:"Description"}),e.jsx("textarea",{placeholder:"Type your message here.",id:"description",name:"description",value:t.description,onChange:n,required:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 min-h-[100px]"})]}),e.jsx("button",{type:"submit",className:"mt-3 w-full px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 font-medium",children:"Save Name & Description"})]})}function ae({path:t,namedPath:n,isArray:r,count:s,onClick:d}){const o=l.useCallback(()=>{d&&d(t)},[d,t]);return e.jsxs("div",{className:"bg-blue-50 p-3 rounded-lg flex items-center justify-between cursor-pointer group hover:bg-blue-100 transition-colors border border-blue-200",onClick:o,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[r&&e.jsx("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})}),e.jsxs("div",{className:"capitalize font-medium text-gray-900",children:[n[n.length-1],s!==void 0&&` (${s})`]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[r&&e.jsx("svg",{className:"w-5 h-5 text-red-500 opacity-0 group-hover:opacity-100 transition-opacity",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),e.jsx("svg",{className:"w-4 h-4 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})]})}var V=(t=>(t.STRING="string",t.NUMBER="number",t.BOOLEAN="boolean",t.UNION="union",t.OBJECT="object",t.ARRAY="array",t))(V||{});const oe=({name:t,value:n,options:r,onChange:s})=>{const d=l.useCallback(o=>{s({target:{name:t,value:o.target.value}})},[t,s]);return e.jsx("select",{name:t,value:n,onChange:d,className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",children:r.map((o,p)=>e.jsx("option",{value:o.trim(),children:o.trim()},p))})},ie=({name:t,value:n,onChange:r})=>{const s=l.useCallback(d=>{const o=d.target.checked;r({target:{name:t,value:o}})},[t,r]);return e.jsx("label",{className:"flex items-center gap-2 cursor-pointer",children:e.jsx("input",{type:"checkbox",name:t,checked:n,onChange:s,className:`w-10 h-6 rounded-full appearance-none cursor-pointer transition-colors relative
1
+ import{j as e,r as l,w as Y,u as K,a as Q,L as z}from"./chunk-JZWAC4HX-JE9ZIoBl.js";import{W as X,u as Z,I as ee}from"./InteractivePreview-BDhPilK7.js";import{u as te}from"./InlineSpinner-ClaLpuOo.js";import"./preload-helper-ckwbz45p.js";import"./useLastLogLine-COky1GVF.js";function U(t,n,r){if(Array.isArray(t)){if(!isNaN(parseInt(n)))return t[parseInt(n)];for(const s of t)if(s.name===n||s.title===n||s.id===n)return s}return t[n]}function q(t){return t&&(typeof t=="object"||Array.isArray(t))}function re(t){return Array.isArray(t)?t.length:void 0}function ne(t){const{data:n,structure:r}=t;if(!(!n&&!r)){if(Array.isArray(r))return Array.isArray(n)?n.map((s,d)=>d.toString()):[];if(typeof r=="object")return[...new Set([...Object.keys(n),...Object.keys(r)])].sort((d,o)=>{const p=q(n[d]),c=q(n[o]);return p&&!c?1:!p&&c?-1:d.localeCompare(o)});if(typeof n=="object")return Object.keys(n).sort((d,o)=>d.localeCompare(o))}}function se({scenarioFormData:t,handleInputChange:n}){return e.jsxs("div",{className:"p-3 flex flex-col gap-3",children:[e.jsxs("div",{className:"grid w-full max-w-sm items-center gap-1.5",children:[e.jsx("label",{htmlFor:"name",className:"text-sm font-medium text-gray-700",children:"Name"}),e.jsx("input",{type:"text",id:"name",placeholder:"Name",name:"name",value:t.name,onChange:n,required:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),e.jsxs("div",{className:"grid w-full gap-1.5 pt-2",children:[e.jsx("label",{htmlFor:"description",className:"text-sm font-medium text-gray-700",children:"Description"}),e.jsx("textarea",{placeholder:"Type your message here.",id:"description",name:"description",value:t.description,onChange:n,required:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 min-h-[100px]"})]}),e.jsx("button",{type:"submit",className:"mt-3 w-full px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 font-medium",children:"Save Name & Description"})]})}function ae({path:t,namedPath:n,isArray:r,count:s,onClick:d}){const o=l.useCallback(()=>{d&&d(t)},[d,t]);return e.jsxs("div",{className:"bg-blue-50 p-3 rounded-lg flex items-center justify-between cursor-pointer group hover:bg-blue-100 transition-colors border border-blue-200",onClick:o,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[r&&e.jsx("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})}),e.jsxs("div",{className:"capitalize font-medium text-gray-900",children:[n[n.length-1],s!==void 0&&` (${s})`]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[r&&e.jsx("svg",{className:"w-5 h-5 text-red-500 opacity-0 group-hover:opacity-100 transition-opacity",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),e.jsx("svg",{className:"w-4 h-4 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})]})}var V=(t=>(t.STRING="string",t.NUMBER="number",t.BOOLEAN="boolean",t.UNION="union",t.OBJECT="object",t.ARRAY="array",t))(V||{});const oe=({name:t,value:n,options:r,onChange:s})=>{const d=l.useCallback(o=>{s({target:{name:t,value:o.target.value}})},[t,s]);return e.jsx("select",{name:t,value:n,onChange:d,className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",children:r.map((o,p)=>e.jsx("option",{value:o.trim(),children:o.trim()},p))})},ie=({name:t,value:n,onChange:r})=>{const s=l.useCallback(d=>{const o=d.target.checked;r({target:{name:t,value:o}})},[t,r]);return e.jsx("label",{className:"flex items-center gap-2 cursor-pointer",children:e.jsx("input",{type:"checkbox",name:t,checked:n,onChange:s,className:`w-10 h-6 rounded-full appearance-none cursor-pointer transition-colors relative
2
2
  bg-gray-300 checked:bg-blue-600
3
3
  after:content-[''] after:absolute after:top-1 after:left-1 after:w-4 after:h-4
4
4
  after:bg-white after:rounded-full after:transition-transform
@@ -1,4 +1,4 @@
1
- import{g as Zd,m as jd,s as xd,E as Vd,N as Ld,R as Ul,i as Kd,r as Ml,k as sy,l as rd,F as Jd,n as wd,o as Wd,p as Fd,q as $d,t as kd,v as Id,x as Pd,y as lh,z as th,A as ah,B as uh,j as iy}from"./chunk-EPOLDU6W-CXRTFQ3F.js";import{r as oy}from"./index-B1h680n5.js";var ei={exports:{}},he={},ni={exports:{}},fi={};/**
1
+ import{g as Zd,m as jd,s as xd,E as Vd,N as Ld,R as Ul,i as Kd,r as Ml,k as sy,l as rd,F as Jd,n as wd,o as Wd,p as Fd,q as $d,t as kd,v as Id,x as Pd,y as lh,z as th,A as ah,B as uh,j as iy}from"./chunk-JZWAC4HX-JE9ZIoBl.js";import{r as oy}from"./index-ChN9-fAY.js";var ei={exports:{}},he={},ni={exports:{}},fi={};/**
2
2
  * @license React
3
3
  * scheduler.production.js
4
4
  *
@@ -1 +1 @@
1
- import{j as l}from"./chunk-EPOLDU6W-CXRTFQ3F.js";function C(e){switch(e){case"queued":return{text:"Queued",bgColor:"#cbf3fa",textColor:"#3098b4",icon:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#3098b4",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("polyline",{points:"12,6 12,12 16,14"})]})};case"analyzing":return{text:"Analyzing...",bgColor:"#ffdbf6",textColor:"#ff2ab5",icon:l.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 9 9",fill:"none",className:"animate-spin",children:[l.jsx("circle",{cx:"4.5",cy:"4.5",r:"3.5",stroke:"#FFF4FC",strokeWidth:"1",fill:"none"}),l.jsx("path",{d:"M4.5 1C2.57 1 1 2.57 1 4.5C1 5.6 1.5 6.58 2.28 7.23",stroke:"#FF2AB5",strokeWidth:"1",strokeLinecap:"round",fill:"none"})]})};case"up-to-date":return{text:"Up to date",bgColor:"#e8ffe6",textColor:"#00925d",icon:null};case"incomplete":return{text:"Incomplete",bgColor:"#fdf9c9",textColor:"#c69538",icon:null};case"out-of-date":return{text:"Out of date",bgColor:"#fdf9c9",textColor:"#c69538",icon:null};case"not-analyzed":return{text:"Not analyzed",bgColor:"#f9f9f9",textColor:"#646464",icon:null}}}function A(e){if(!e)return"Never";const o=new Date(e),c=new Date;if(o.getDate()===c.getDate()&&o.getMonth()===c.getMonth()&&o.getFullYear()===c.getFullYear()){const t=o.getHours(),f=o.getMinutes(),u=t>=12?"pm":"am",d=t%12||12,i=f.toString().padStart(2,"0");return`Today, ${d}:${i} ${u}`}return o.toLocaleString("en-US",{month:"numeric",day:"numeric",year:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!0})}function b(e,o=[],c=!1){var h,g;if(o.some(n=>{var a,s;return!!((a=n.entityShas)!=null&&a.includes(e.sha)||(s=n.entities)!=null&&s.some(r=>r.sha===e.sha))}))return c?"analyzing":"queued";if(!e.analyses||e.analyses.length===0)return"not-analyzed";const t=e.analyses[0];if(!(((h=t.status)==null?void 0:h.scenarios)&&t.status.scenarios.length>0&&t.status.scenarios.some(n=>n.screenshotFinishedAt||n.finishedAt))||t.entitySha!==e.sha)return"not-analyzed";const u=t.createdAt?new Date(t.createdAt).getTime():0,d=(g=e.metadata)!=null&&g.editedAt?new Date(e.metadata.editedAt).getTime():0,i=t.scenarios||[],p=i.some(n=>{var a,s,r;return((s=(a=n.metadata)==null?void 0:a.screenshotPaths)==null?void 0:s[0])||((r=n.metadata)==null?void 0:r.executionResult)});return u>=d?i.length>0&&p?i.every(a=>{var s,r,m;return((r=(s=a.metadata)==null?void 0:s.screenshotPaths)==null?void 0:r[0])||((m=a.metadata)==null?void 0:m.executionResult)})?"up-to-date":"incomplete":i.length>0?"incomplete":"not-analyzed":"out-of-date"}export{C as a,A as f,b as g};
1
+ import{j as l}from"./chunk-JZWAC4HX-JE9ZIoBl.js";function C(e){switch(e){case"queued":return{text:"Queued",bgColor:"#cbf3fa",textColor:"#3098b4",icon:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#3098b4",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("polyline",{points:"12,6 12,12 16,14"})]})};case"analyzing":return{text:"Analyzing...",bgColor:"#ffdbf6",textColor:"#ff2ab5",icon:l.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 9 9",fill:"none",className:"animate-spin",children:[l.jsx("circle",{cx:"4.5",cy:"4.5",r:"3.5",stroke:"#FFF4FC",strokeWidth:"1",fill:"none"}),l.jsx("path",{d:"M4.5 1C2.57 1 1 2.57 1 4.5C1 5.6 1.5 6.58 2.28 7.23",stroke:"#FF2AB5",strokeWidth:"1",strokeLinecap:"round",fill:"none"})]})};case"up-to-date":return{text:"Up to date",bgColor:"#e8ffe6",textColor:"#00925d",icon:null};case"incomplete":return{text:"Incomplete",bgColor:"#fdf9c9",textColor:"#c69538",icon:null};case"out-of-date":return{text:"Out of date",bgColor:"#fdf9c9",textColor:"#c69538",icon:null};case"not-analyzed":return{text:"Not analyzed",bgColor:"#f9f9f9",textColor:"#646464",icon:null}}}function A(e){if(!e)return"Never";const o=new Date(e),c=new Date;if(o.getDate()===c.getDate()&&o.getMonth()===c.getMonth()&&o.getFullYear()===c.getFullYear()){const t=o.getHours(),f=o.getMinutes(),u=t>=12?"pm":"am",d=t%12||12,i=f.toString().padStart(2,"0");return`Today, ${d}:${i} ${u}`}return o.toLocaleString("en-US",{month:"numeric",day:"numeric",year:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!0})}function b(e,o=[],c=!1){var h,g;if(o.some(n=>{var a,s;return!!((a=n.entityShas)!=null&&a.includes(e.sha)||(s=n.entities)!=null&&s.some(r=>r.sha===e.sha))}))return c?"analyzing":"queued";if(!e.analyses||e.analyses.length===0)return"not-analyzed";const t=e.analyses[0];if(!(((h=t.status)==null?void 0:h.scenarios)&&t.status.scenarios.length>0&&t.status.scenarios.some(n=>n.screenshotFinishedAt||n.finishedAt))||t.entitySha!==e.sha)return"not-analyzed";const u=t.createdAt?new Date(t.createdAt).getTime():0,d=(g=e.metadata)!=null&&g.editedAt?new Date(e.metadata.editedAt).getTime():0,i=t.scenarios||[],p=i.some(n=>{var a,s,r;return((s=(a=n.metadata)==null?void 0:a.screenshotPaths)==null?void 0:s[0])||((r=n.metadata)==null?void 0:r.executionResult)});return u>=d?i.length>0&&p?i.every(a=>{var s,r,m;return((r=(s=a.metadata)==null?void 0:s.screenshotPaths)==null?void 0:r[0])||((m=a.metadata)==null?void 0:m.executionResult)})?"up-to-date":"incomplete":i.length>0?"incomplete":"not-analyzed":"out-of-date"}export{C as a,A as f,b as g};
@@ -0,0 +1 @@
1
+ import{b as ne,r as u,j as e,w as le,u as ce,f as de}from"./chunk-JZWAC4HX-JE9ZIoBl.js";import{u as me}from"./useReportContext-CpZgwliL.js";import{C as pe,a as he,F as fe,b as xe,E as ue,S as ye,u as ge}from"./EntityItem-B86KKU7e.js";import{g as T}from"./fileTableUtils-DCPhhSMo.js";import{C as ae}from"./chevron-down-TJp6ofnp.js";import{S as ve}from"./search-B8VUL8nl.js";import"./createLucideIcon-Ca9fAY46.js";import"./useToast-Bv9JFvUO.js";import"./TruncatedFilePath-CiwXDxLh.js";import"./SafeScreenshot-Gq3Ocjo6.js";import"./LibraryFunctionPreview-VeqEBv9v.js";import"./scenarioStatus-B_8jpV3e.js";import"./triangle-alert-BZz2NjYa.js";import"./EntityTypeIcon-BqY8gDAW.js";import"./EntityTypeBadge-B5ctlSYt.js";function be({entities:Q,page:N,itemsPerPage:b=50,currentRun:L,filter:S,entityType:_,queueState:o,isEntityPending:U,pendingEntityKeys:w,onGenerateSimulation:k,onGenerateAllSimulations:D,totalFilesCount:H,totalEntitiesCount:J,uncommittedFilesCount:W,showOnlyUncommitted:j,onToggleUncommitted:V}){const[I,X]=ne(),[B,M]=u.useState(new Set),[A,y]=u.useState(""),[g,x]=u.useState(!1),[E,$]=u.useState("all"),[z,Y]=u.useState("desc"),P=_||"all",R=u.useMemo(()=>{let s=Q;return P!=="all"&&(s=s.filter(i=>i.entityType===P)),S==="analyzed"&&(s=s.filter(i=>i.analyses&&i.analyses.length>0)),s},[Q,P,S]),te=u.useMemo(()=>{const s=new Map,i=new Map,p=new Map;R.forEach(a=>{var r,c;const t=`${a.filePath}::${a.name}`,n=i.get(t);if(!n)i.set(t,a),p.set(t,[]);else{const d=((r=n.metadata)==null?void 0:r.editedAt)||n.createdAt||"",l=((c=a.metadata)==null?void 0:c.editedAt)||a.createdAt||"";let m=!1;if(l>d)m=!0;else if(l===d){const h=n.createdAt||"";m=(a.createdAt||"")>h}m?(p.get(t).push(n),i.set(t,a)):p.get(t).push(a)}}),i.forEach((a,t)=>{var r;if(!(a.analyses&&a.analyses.length>0)&&((r=a.metadata)!=null&&r.previousVersionWithAnalyses)){const d=(p.get(t)||[]).find(l=>{var m;return l.sha===((m=a.metadata)==null?void 0:m.previousVersionWithAnalyses)});d&&d.analyses&&d.analyses.length>0&&(a.analyses=d.analyses)}}),Array.from(i.values()).sort((a,t)=>{var c,d,l,m;const n=!((c=a.metadata)!=null&&c.notExported)&&!((d=a.metadata)!=null&&d.namedExport),r=!((l=t.metadata)!=null&&l.notExported)&&!((m=t.metadata)!=null&&m.namedExport);return n&&!r?-1:!n&&r?1:0}).forEach(a=>{var d,l,m,h,f;const t=a.filePath??"No File Path";s.has(t)||s.set(t,{filePath:t,entities:[],totalCount:0,uncommittedCount:0,lastUpdated:null,previewScreenshots:[],previewScreenshotErrors:[],previewLibraryScenarios:[],state:"up-to-date",simulationCount:0});const n=s.get(t);n.entities.push(a),n.totalCount++,(d=a.metadata)!=null&&d.isUncommitted&&n.uncommittedCount++;const r=((h=(m=(l=a.analyses)==null?void 0:l[0])==null?void 0:m.scenarios)==null?void 0:h.length)||0;n.simulationCount+=r;const c=((f=a.metadata)==null?void 0:f.editedAt)||a.updatedAt;c&&(!n.lastUpdated||new Date(c)>new Date(n.lastUpdated))&&(n.lastUpdated=c)});const q=(o==null?void 0:o.jobs)||[],ee=a=>{const t=`${a.filePath||""}::${a.name}`;return(w==null?void 0:w.includes(t))||!1};s.forEach(a=>{const t=a.entities.map(n=>ee(n)?"queued":T(n,q));t.includes("analyzing")||t.includes("queued")?a.state="analyzing":t.includes("incomplete")?a.state="incomplete":t.includes("out-of-date")?a.state="out-of-date":t.includes("not-analyzed")?a.state="not-analyzed":a.state="up-to-date"}),s.forEach(a=>{var t,n,r,c,d;for(const l of a.entities){if(a.previewScreenshots.length+a.previewLibraryScenarios.length>=3)break;const h=((n=(t=l.analyses)==null?void 0:t[0])==null?void 0:n.scenarios)||[];if(l.entityType==="library"){const f=h.find(v=>{var F,O;return((F=v.metadata)==null?void 0:F.executionResult)||((O=v.metadata)==null?void 0:O.error)});f&&a.previewLibraryScenarios.push({scenario:f,entitySha:l.sha})}else{const f=h.find(v=>{var F,O;return(O=(F=v.metadata)==null?void 0:F.screenshotPaths)==null?void 0:O[0]});if(f){const v=(c=(r=f.metadata)==null?void 0:r.screenshotPaths)==null?void 0:c[0],F=!!((d=f.metadata)!=null&&d.error);v&&!a.previewScreenshots.includes(v)&&(a.previewScreenshots.push(v),a.previewScreenshotErrors.push(F))}}}});const G=Array.from(s.values());return G.sort((a,t)=>{if(S==="analyzed"){const c=Math.max(...a.entities.filter(l=>{var m,h;return(h=(m=l.analyses)==null?void 0:m[0])==null?void 0:h.createdAt}).map(l=>new Date(l.analyses[0].createdAt).getTime()),0),d=Math.max(...t.entities.filter(l=>{var m,h;return(h=(m=l.analyses)==null?void 0:m[0])==null?void 0:h.createdAt}).map(l=>new Date(l.analyses[0].createdAt).getTime()),0);return z==="desc"?d-c:c-d}if(a.uncommittedCount>0&&t.uncommittedCount===0)return-1;if(a.uncommittedCount===0&&t.uncommittedCount>0)return 1;const n=a.lastUpdated?new Date(a.lastUpdated).getTime():0,r=t.lastUpdated?new Date(t.lastUpdated).getTime():0;return z==="desc"?r-n:n-r}),G},[R,S,z,o,w]),C=u.useMemo(()=>{let s=te;if(E!=="all"&&(s=s.filter(i=>i.state===E)),A.trim()){const i=A.toLowerCase();s=s.filter(p=>p.filePath.toLowerCase().includes(i))}return s},[te,A,E]),se=(N-1)*b,oe=se+b,Z=C.slice(se,oe),K=Math.ceil(C.length/b),re=s=>{M(i=>{const p=new Set(i);return p.has(s)?p.delete(s):p.add(s),p})},ie=()=>{Y(s=>s==="desc"?"asc":"desc")};return e.jsxs("div",{children:[e.jsxs("div",{className:"bg-white border-b border-gray-200 rounded-t-lg px-5 py-4 mb-3",children:[e.jsx("div",{className:"text-[11px] text-gray-500 mb-2 uppercase",children:"Filters"}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("div",{className:"relative w-[130px]",children:[e.jsxs("select",{value:P,onChange:s=>{const i=s.target.value,p=new URLSearchParams(I);i==="all"?p.delete("entityType"):p.set("entityType",i),p.set("page","1"),X(p)},className:"appearance-none bg-gray-50 border border-gray-200 rounded px-[10px] pr-6 text-[13px] h-[39px] w-full cursor-pointer focus:outline-none focus:ring-0 focus:border-2 focus:border-[#005c75] hover:border-gray-300 transition-colors",children:[e.jsx("option",{value:"all",children:"All Types"}),e.jsx("option",{value:"visual",children:"Visual"}),e.jsx("option",{value:"library",children:"Library"})]}),e.jsx(ae,{className:"absolute right-2 top-1/2 -translate-y-1/2 w-3 h-3 text-gray-500 pointer-events-none"})]}),e.jsxs("div",{className:"relative w-[130px]",children:[e.jsxs("select",{value:E,onChange:s=>$(s.target.value),className:"appearance-none bg-gray-50 border border-gray-200 rounded px-[10px] pr-6 text-[13px] h-[39px] w-full cursor-pointer focus:outline-none focus:ring-0 focus:border-2 focus:border-[#005c75] hover:border-gray-300 transition-colors",children:[e.jsx("option",{value:"all",children:"All States"}),e.jsx("option",{value:"analyzing",children:"Analyzing..."}),e.jsx("option",{value:"up-to-date",children:"Up to date"}),e.jsx("option",{value:"incomplete",children:"Incomplete"}),e.jsx("option",{value:"out-of-date",children:"Out of date"}),e.jsx("option",{value:"not-analyzed",children:"Not analyzed"})]}),e.jsx(ae,{className:"absolute right-2 top-1/2 -translate-y-1/2 w-3 h-3 text-gray-500 pointer-events-none"})]}),e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(ve,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx("input",{type:"text",placeholder:"Search component",value:A,onChange:s=>y(s.target.value),className:"w-full bg-gray-50 border border-gray-200 rounded pl-9 pr-[10px] text-[13px] h-[39px] placeholder:text-gray-400 focus:outline-none focus:ring-0 focus:border-2 focus:border-[#005c75] transition-colors"})]})]})]}),H!==void 0&&J!==void 0&&W!==void 0&&e.jsx("div",{className:"mb-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsxs("span",{className:"font-mono uppercase",style:{fontSize:"11px",color:"#8b8b8b",fontWeight:500,letterSpacing:"0.05em"},children:[e.jsx("span",{style:{color:"#000000"},children:C.length})," ",C.length===1?"file":"files"]}),e.jsxs("div",{className:"relative group inline-flex items-center ml-1.5",children:[e.jsx("svg",{className:"w-3 h-3 text-gray-400 cursor-help",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),e.jsx("div",{className:"absolute left-0 top-full mt-2 hidden group-hover:block z-50 w-80",children:e.jsxs("div",{className:"bg-gray-900 text-white text-xs rounded-lg px-3 py-2 shadow-lg",children:["In CodeYam, an entity is a discrete, analyzable unit of code that can be independently simulated and tested.",e.jsx("div",{className:"absolute -top-1 left-4 w-2 h-2 bg-gray-900 transform rotate-45"})]})})]}),e.jsx("span",{className:"font-mono uppercase",style:{fontSize:"11px",color:"#d1d5db",fontWeight:500,letterSpacing:"0.05em",marginLeft:"8px"},children:"|"}),e.jsxs("span",{className:"font-mono uppercase",style:{fontSize:"11px",color:"#8b8b8b",fontWeight:500,letterSpacing:"0.05em",marginLeft:"8px"},children:[e.jsx("span",{style:{color:"#000000"},children:C.reduce((s,i)=>s+i.totalCount,0)})," ",C.reduce((s,i)=>s+i.totalCount,0)===1?"entity":"entities"]}),e.jsx("span",{className:"font-mono uppercase",style:{fontSize:"11px",color:"#d1d5db",fontWeight:500,letterSpacing:"0.05em",marginLeft:"8px"},children:"|"}),j?e.jsxs("button",{onClick:V,className:"flex items-center gap-2 text-[#005c75] underline hover:text-[#004a5e] transition-colors ml-2 font-mono uppercase cursor-pointer",style:{fontSize:"11px",fontWeight:500,letterSpacing:"0.05em"},children:[C.filter(s=>s.uncommittedCount>0).length," ","uncommitted"," ",C.filter(s=>s.uncommittedCount>0).length===1?"file":"files",e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})})]}):e.jsxs("button",{onClick:V,className:"text-[#005c75] underline hover:text-[#004a5e] transition-colors ml-2 font-mono uppercase",style:{fontSize:"11px",fontWeight:500,letterSpacing:"0.05em"},children:[W," uncommitted"," ",W===1?"file":"files"]})]}),Z.length>0&&e.jsxs("div",{className:"flex gap-6",children:[e.jsxs("button",{onClick:()=>{M(new Set(Z.map(s=>s.filePath))),x(!0)},className:"text-[#005c75] hover:bg-[#E6F5F8] hover:text-[#003d4f] font-mono uppercase transition-all cursor-pointer px-3 py-1 rounded flex items-center gap-1.5",style:{fontSize:"11px",fontWeight:500,letterSpacing:"0.05em"},children:[e.jsx(pe,{className:"w-3.5 h-3.5"}),"Expand All"]}),e.jsxs("button",{onClick:()=>{M(new Set),x(!1)},className:"text-[#005c75] hover:bg-[#E6F5F8] hover:text-[#003d4f] font-mono uppercase transition-all cursor-pointer px-3 py-1 rounded flex items-center gap-1.5",style:{fontSize:"11px",fontWeight:500,letterSpacing:"0.05em"},children:[e.jsx(he,{className:"w-3.5 h-3.5"}),"Collapse All"]})]})]})}),e.jsx(fe,{showActions:!0,sortOrder:z,onSortChange:ie}),e.jsx("div",{className:"flex flex-col gap-[3px]",children:Z.map(s=>{const i=B.has(s.filePath),q=s.entities.filter(t=>(t.entityType==="visual"||t.entityType==="library")&&(T(t,(o==null?void 0:o.jobs)||[])==="not-analyzed"||T(t,(o==null?void 0:o.jobs)||[])==="out-of-date"||T(t,(o==null?void 0:o.jobs)||[])==="incomplete")).length>0,ee=t=>{var n;return((n=L==null?void 0:L.currentEntityShas)==null?void 0:n.includes(t))||!1},G=t=>{var n;return U!=null&&U(t)?!0:((n=o==null?void 0:o.jobs)==null?void 0:n.some(r=>{var c;return(c=r.entityShas)==null?void 0:c.includes(t.sha)}))||!1},a=t=>{k==null||k(t)};return e.jsx(xe,{filePath:s.filePath,isExpanded:i,onToggle:()=>re(s.filePath),simulationPreviews:e.jsx(ye,{entities:s.entities,maxPreviews:1}),entityCount:s.totalCount,state:s.state,lastModified:s.lastUpdated,uncommittedCount:s.uncommittedCount,isUncommitted:s.uncommittedCount>0,actionButton:q?e.jsx("button",{onClick:t=>{t.stopPropagation();const n=s.entities.filter(r=>(r.entityType==="visual"||r.entityType==="library")&&(T(r,(o==null?void 0:o.jobs)||[])==="not-analyzed"||T(r,(o==null?void 0:o.jobs)||[])==="out-of-date"||T(r,(o==null?void 0:o.jobs)||[])==="incomplete"));D==null||D(n)},className:"bg-[#005c75] text-white rounded text-[12px] font-['IBM_Plex_Sans'] font-normal hover:bg-[#004a5e] transition-colors cursor-pointer px-[15px] py-0 h-[28px]",children:s.state==="out-of-date"?"Re-analyze":"Analyze"}):void 0,children:s.entities.sort((t,n)=>{var m,h,f,v;const r=!((m=t.metadata)!=null&&m.notExported)&&!((h=t.metadata)!=null&&h.namedExport),c=!((f=n.metadata)!=null&&f.notExported)&&!((v=n.metadata)!=null&&v.namedExport);if(r&&!c)return-1;if(!r&&c)return 1;const d=t.entityType==="visual"||t.entityType==="library",l=n.entityType==="visual"||n.entityType==="library";return d&&!l?-1:!d&&l?1:t.name.localeCompare(n.name)}).map(t=>e.jsx(ue,{entity:t,isActivelyAnalyzing:ee(t.sha),isQueued:G(t),onGenerateSimulation:a},t.sha))},s.filePath)})}),K>1&&e.jsxs("div",{className:"flex justify-center items-center gap-4 mt-6 p-4",children:[N>1&&e.jsx("a",{href:`?${new URLSearchParams({...Object.fromEntries(I),page:String(N-1)}).toString()}`,className:"no-underline font-medium hover:underline",style:{color:"#005C75"},children:"← Previous"}),e.jsxs("span",{children:["Page ",N," of ",K]}),N<K&&e.jsx("a",{href:`?${new URLSearchParams({...Object.fromEntries(I),page:String(N+1)}).toString()}`,className:"no-underline font-medium hover:underline",style:{color:"#005C75"},children:"Next →"})]})]})}const De=()=>[{title:"Files & Entities - CodeYam"},{name:"description",content:"Browse your codebase files and entities"}],We=le(function(){var B,M,A;const{entities:N,currentCommit:b,page:L,filter:S,entityType:_,queueState:o,error:U}=ce();de(),ne();const[w,k]=u.useState(!1);me({source:"files-page"});const{handleGenerateSimulation:D,handleGenerateAllSimulations:H,isEntityPending:J,pendingEntityKeys:W}=ge((M=(B=b==null?void 0:b.metadata)==null?void 0:B.currentRun)==null?void 0:M.currentEntityShas,o),j=N||[],V=u.useMemo(()=>{const y=new Set([]);for(const g of j)y.add(g.filePath??"No File Path");return Array.from(y)},[j]),I=u.useMemo(()=>{let y=j;return w&&(y=y.filter(g=>{var x;return(x=g.metadata)==null?void 0:x.isUncommitted})),y.sort((g,x)=>{var E,$,z,Y,P,R;return(E=g.metadata)!=null&&E.isUncommitted&&!(($=x.metadata)!=null&&$.isUncommitted)?-1:!((z=g.metadata)!=null&&z.isUncommitted)&&((Y=x.metadata)!=null&&Y.isUncommitted)?1:new Date(((P=x.metadata)==null?void 0:P.editedAt)||0).getTime()-new Date(((R=g.metadata)==null?void 0:R.editedAt)||0).getTime()})},[j,w]),X=u.useMemo(()=>{var g;const y=new Set([]);for(const x of j)(g=x.metadata)!=null&&g.isUncommitted&&y.add(x.filePath??"No File Path");return Array.from(y)},[j]);return U?e.jsx("div",{className:"bg-[#F8F7F6] min-h-screen",children:e.jsxs("div",{className:"px-12 py-6 font-sans",children:[e.jsx("h1",{className:"text-[28px] font-semibold text-gray-900",children:"Error"}),e.jsx("p",{className:"text-base text-gray-500",children:U})]})}):j.length===0?e.jsx("div",{className:"bg-[#f9f9f9] min-h-screen",children:e.jsxs("div",{className:"px-20 py-12 font-sans",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-[28px] font-semibold text-gray-900 mb-2",children:"Files & Entities"}),e.jsx("p",{className:"text-[15px] text-gray-500",children:"This is a list of all the files in your app."})]}),e.jsx("div",{className:"bg-white rounded-lg border border-gray-200 p-12 text-center",children:e.jsxs("div",{className:"max-w-md mx-auto",children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-3",children:"No entities found"}),e.jsxs("p",{className:"text-[15px] text-gray-600 mb-6",children:["Your project hasn't been analyzed yet. Run"," ",e.jsx("code",{className:"px-2 py-1 bg-gray-100 rounded text-sm font-mono",children:"codeyam analyze"})," ","to extract entities from your codebase."]}),e.jsx("p",{className:"text-sm text-gray-500",children:"Entities include React components, functions, and other analyzable code elements."})]})})]})}):e.jsx("div",{className:"bg-[#f9f9f9] min-h-screen",children:e.jsxs("div",{className:"px-20 py-12 font-sans",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-[28px] font-semibold text-gray-900 mb-2",children:"Files & Entities"}),e.jsx("p",{className:"text-[15px] text-gray-500",children:"This is a list of all the files in your app."})]}),e.jsx(be,{entities:I,page:L,itemsPerPage:50,currentRun:(A=b==null?void 0:b.metadata)==null?void 0:A.currentRun,filter:S,entityType:_,queueState:o,isEntityPending:J,pendingEntityKeys:W,onGenerateSimulation:D,onGenerateAllSimulations:H,totalFilesCount:V.length,totalEntitiesCount:j.length,uncommittedFilesCount:X.length,showOnlyUncommitted:w,onToggleUncommitted:()=>k(!w)})]})})});export{We as default,De as meta};