@codeyam/codeyam-cli 0.1.10 → 0.1.12
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.
- package/analyzer-template/.build-info.json +7 -7
- package/analyzer-template/log.txt +3 -3
- package/analyzer-template/package.json +2 -2
- package/analyzer-template/packages/ai/package.json +1 -1
- package/analyzer-template/packages/aws/package.json +1 -1
- package/analyzer-template/packages/database/package.json +1 -1
- package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +42 -16
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +3 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +44 -16
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -1
- package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js +11 -0
- package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js.map +1 -1
- package/codeyam-cli/src/commands/editor.js +1214 -217
- package/codeyam-cli/src/commands/editor.js.map +1 -1
- package/codeyam-cli/src/commands/init.js +1 -0
- package/codeyam-cli/src/commands/init.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +893 -1
- package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js +76 -0
- package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorDeleteScenario.test.js +100 -0
- package/codeyam-cli/src/utils/__tests__/editorDeleteScenario.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js +6 -3
- package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js +261 -0
- package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js +75 -1
- package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorMigration.test.js +435 -0
- package/codeyam-cli/src/utils/__tests__/editorMigration.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +441 -17
- package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js +67 -0
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapterPrismaValidation.test.js +143 -0
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapterPrismaValidation.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js +66 -0
- package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js +53 -0
- package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +125 -10
- package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js +118 -0
- package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js +40 -1
- package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +1 -0
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
- package/codeyam-cli/src/utils/analysisRunner.js +3 -1
- package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
- package/codeyam-cli/src/utils/editorAudit.js +145 -0
- package/codeyam-cli/src/utils/editorAudit.js.map +1 -1
- package/codeyam-cli/src/utils/editorBroadcastViewport.js +26 -0
- package/codeyam-cli/src/utils/editorBroadcastViewport.js.map +1 -0
- package/codeyam-cli/src/utils/editorDeleteScenario.js +67 -0
- package/codeyam-cli/src/utils/editorDeleteScenario.js.map +1 -0
- package/codeyam-cli/src/utils/editorEntityChangeStatus.js +1 -1
- package/codeyam-cli/src/utils/editorEntityChangeStatus.js.map +1 -1
- package/codeyam-cli/src/utils/editorEntityHelpers.js +129 -0
- package/codeyam-cli/src/utils/editorEntityHelpers.js.map +1 -0
- package/codeyam-cli/src/utils/editorLoaderHelpers.js +40 -1
- package/codeyam-cli/src/utils/editorLoaderHelpers.js.map +1 -1
- package/codeyam-cli/src/utils/editorMigration.js +224 -0
- package/codeyam-cli/src/utils/editorMigration.js.map +1 -0
- package/codeyam-cli/src/utils/editorScenarios.js +163 -2
- package/codeyam-cli/src/utils/editorScenarios.js.map +1 -1
- package/codeyam-cli/src/utils/editorSeedAdapter.js +253 -4
- package/codeyam-cli/src/utils/editorSeedAdapter.js.map +1 -1
- package/codeyam-cli/src/utils/editorShouldRevalidate.js +21 -0
- package/codeyam-cli/src/utils/editorShouldRevalidate.js.map +1 -0
- package/codeyam-cli/src/utils/entityChangeStatus.js +19 -2
- package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -1
- package/codeyam-cli/src/utils/entityChangeStatus.server.js +41 -3
- package/codeyam-cli/src/utils/entityChangeStatus.server.js.map +1 -1
- package/codeyam-cli/src/utils/fileWatcher.js +38 -0
- package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
- package/codeyam-cli/src/utils/install-skills.js +9 -0
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/routePatternMatching.js +129 -0
- package/codeyam-cli/src/utils/routePatternMatching.js.map +1 -0
- package/codeyam-cli/src/utils/scenarioCoverage.js +8 -9
- package/codeyam-cli/src/utils/scenarioCoverage.js.map +1 -1
- package/codeyam-cli/src/utils/scenariosManifest.js +18 -10
- package/codeyam-cli/src/utils/scenariosManifest.js.map +1 -1
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +1 -0
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
- package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js +35 -0
- package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js.map +1 -0
- package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js +33 -0
- package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js.map +1 -1
- package/codeyam-cli/src/webserver/app/types/editor.js +8 -0
- package/codeyam-cli/src/webserver/app/types/editor.js.map +1 -0
- package/codeyam-cli/src/webserver/backgroundServer.js +18 -4
- package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/CopyButton-CzTDWkF2.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-BcgbViKV.js → EntityItem-BFbq6iFk.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-CQgyEGV-.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-CQIG2qda.js → EntityTypeIcon-B6OMi58N.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-DuYodzo1.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-CXo9EeCl.js +25 -0
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DYCNb2It.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-BU_OAEMP.js → LoadingDots-By5zI316.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-ceAyBX-H.js → LogViewer-CZgY3sxX.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-BzHcG7SE.js → ReportIssueModal-CnYYwRDw.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-CDoF7ZpU.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-TSD3C211.js → ScenarioViewer-DrnfvaLL.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/Spinner-Df3UCi8k.js +34 -0
- package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-CK7-NaPZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-DRKR9T0U.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{_index-DLxKhri3.js → _index-ClR-g3tY.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-BcY3q6nt.js → activity.(_tab)-DTH6ydEA.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/{addon-web-links-Duc5hnl7.js → addon-web-links-74hnHF59.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{agent-transcripts-Bni3iiUj.js → agent-transcripts-B8CYhCO9.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-rename-scenario-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-save-seed-state-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-prompt-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-session-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{book-open-BYOypzCa.js → book-open-CLaoh4ac.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-C_Pmso5S.js → chevron-down-BZ2DZxbW.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{chunk-JZWAC4HX-C4pqxYJB.js → chunk-JZWAC4HX-BBXArFPl.js} +13 -21
- package/codeyam-cli/src/webserver/build/client/assets/{circle-check-BVMi9VA5.js → circle-check-CT4unAk-.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{copy-n2FB0_Sw.js → copy-zK0B6Nu-.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-CC6AbExI.js → createLucideIcon-DJB0YQJL.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-CkXFP_i-.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/editor._tab-DPw7NZHc.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/editor.entity.(_sha)-DmBK1JBK.js +58 -0
- package/codeyam-cli/src/webserver/build/client/assets/editorPreview-DBa7T2FK.js +41 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-DwCV5__E.js → entity._sha._-BqAN7hyG.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-BOi8kpwd.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-Dg1NhIms.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-CJX6kkkV.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-BMvVHNXU.js → entity._sha_.edit._scenarioId-BhVjZhKg.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{entry.client-DTvKq3TY.js → entry.client-_gzKltPN.js} +6 -6
- package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-Daa96Fr1.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/files-CV_17tZS.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/git-D-YXmMbR.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-CGrDAxj0.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{index-yHOVb4rc.js → index-Blo6EK8G.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-10oVnAAH.js → index-BsX0F-9C.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-BcvgDzbZ.js → index-CCrgCshv.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/jsx-runtime-D_zvdyIk.js +9 -0
- package/codeyam-cli/src/webserver/build/client/assets/labs-Byazq8Pv.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-DaAZ_H2w.js → loader-circle-DVQ0oHR7.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-b3f77062.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{memory-9gnxSZlb.js → memory-b-VmA2Vj.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{pause-f5-1lKBt.js → pause-DGcndCAa.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{root-BWAyuj0r.js → root-D5Zi3U2Z.js} +4 -4
- package/codeyam-cli/src/webserver/build/client/assets/{search-Di64LWVb.js → search-C0Uw0bcK.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-OoNgHIfW.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/simulations-Bcemfu8a.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{terminal-Br7MOqts.js → terminal-BgMmG7R9.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-BLdiCuG-.js → triangle-alert-Cs87hJYK.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-BR3Rs7JY.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-C14nCb1q.js → useLastLogLine-BxxP_XF9.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-BermyNU5.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/useToast-a_QN_W9_.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/analysisRunner-yTyb36j3.js +13 -0
- package/codeyam-cli/src/webserver/build/server/assets/{index-ChX0hPcu.js → index-Cr7d_IsG.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/init-M_wqNAfu.js +10 -0
- package/codeyam-cli/src/webserver/build/server/assets/progress-CHTtrxFG.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-_ybRgrlc.js +551 -0
- package/codeyam-cli/src/webserver/build/server/index.js +1 -1
- package/codeyam-cli/src/webserver/build-info.json +5 -5
- package/codeyam-cli/src/webserver/editorProxy.js +93 -11
- package/codeyam-cli/src/webserver/editorProxy.js.map +1 -1
- package/codeyam-cli/src/webserver/mockStateEvents.js +28 -0
- package/codeyam-cli/src/webserver/mockStateEvents.js.map +1 -0
- package/codeyam-cli/src/webserver/server.js +9 -0
- package/codeyam-cli/src/webserver/server.js.map +1 -1
- package/codeyam-cli/src/webserver/terminalServer.js +105 -9
- package/codeyam-cli/src/webserver/terminalServer.js.map +1 -1
- package/codeyam-cli/templates/editor-step-hook.py +104 -20
- package/codeyam-cli/templates/nextjs-prisma-sqlite/seed-adapter.ts +42 -7
- package/codeyam-cli/templates/seed-adapters/supabase.ts +282 -0
- package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +62 -0
- package/package.json +1 -1
- package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +44 -16
- package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/CopyButton-BPXZwM4t.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-g3saevPb.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-Bu6c6aDe.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-DYFW3lDD.js +0 -25
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DLeucoVX.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BED4B6sP.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/Spinner-Bb5uFQ5V.js +0 -34
- package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-C8OKAR5x.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-oAf2Kqsf.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-Ii3inc0_.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/editor-COWCNVyV.js +0 -10
- package/codeyam-cli/src/webserver/build/client/assets/editorPreview-CNB06EIa.js +0 -41
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-CXSi2aeZ.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-CHMiAog3.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-p9hhkjJM.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-cPo8LiG3.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-BZrlFE1F.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/git-DdZcvjGh.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/globals-phvmGvat.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/labs-Zk7ryIM1.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-6134dc40.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-0OrEMU6J.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/simulations-DWT-CvLy.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-C-_hOl_g.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-O-jkvSPx.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useToast-9FIWuYfK.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/init-kSNsMjj8.js +0 -10
- package/codeyam-cli/src/webserver/build/server/assets/server-build-Bm2xIhmh.js +0 -439
|
@@ -16,6 +16,68 @@ You MUST follow a step-by-step workflow driven by `codeyam editor` commands. Eac
|
|
|
16
16
|
|
|
17
17
|
**The rule:** After completing what a command tells you to do, run the NEXT command it specifies. The commands are your instructions — follow them one at a time.
|
|
18
18
|
|
|
19
|
+
## Migration Mode
|
|
20
|
+
|
|
21
|
+
When `codeyam editor steps` shows **"Project Migration"** instead of "Feature Cycle", the project is being migrated from an existing codebase. Follow the `codeyam editor migrate` commands instead of the normal 13-step cycle.
|
|
22
|
+
|
|
23
|
+
Migration uses a different command set:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
codeyam editor migrate → Survey the project (explore pages, confirm order)
|
|
27
|
+
codeyam editor migrate 1-8 → Run migration step N for the current page
|
|
28
|
+
codeyam editor migrate next → Advance to the next page
|
|
29
|
+
codeyam editor migrate status → Show migration progress
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**The same rule applies:** run the command shown in the output, follow its checklist, then run the next command it specifies. Migration steps are 1-8 per page: Capture → Preview → Discuss → Decompose → Extract → Recapture → Journal → Present. Steps 4-6 (Decompose/Extract/Recapture) are optional — the user decides at step 3 whether to decompose or skip to step 7. After all pages are migrated, the project transitions to the normal feature cycle.
|
|
33
|
+
|
|
34
|
+
**IMPORTANT:** When `codeyam editor steps` tells you to run a `codeyam editor migrate` command, run THAT command — do NOT run `codeyam editor 1` or any other normal step command.
|
|
35
|
+
|
|
36
|
+
### Migration Survey (codeyam editor migrate)
|
|
37
|
+
|
|
38
|
+
When you run `codeyam editor migrate` with no arguments and no existing migration state, follow this survey checklist:
|
|
39
|
+
|
|
40
|
+
1. Read `package.json` — understand the framework, dependencies, and scripts
|
|
41
|
+
2. Explore the project structure — find all page/route files
|
|
42
|
+
- Next.js App Router: `app/**/page.tsx` | Pages Router: `pages/**/*.tsx`
|
|
43
|
+
- Check for other patterns: `src/` directory, custom routing, etc.
|
|
44
|
+
3. Read each page/route to assess complexity and data flow
|
|
45
|
+
4. Identify how the dev server starts (check `scripts` in package.json)
|
|
46
|
+
5. Note any environment variables, databases, or external services needed
|
|
47
|
+
6. Present a numbered list of all pages with:
|
|
48
|
+
- Page name and route
|
|
49
|
+
- File path
|
|
50
|
+
- Complexity assessment (simple / moderate / complex)
|
|
51
|
+
7. Suggest a migration order — **start with the most complex pages** (dashboards, analytics, etc.) as they best demonstrate CodeYam's value and have rich decomposition opportunities
|
|
52
|
+
8. Wait for user confirmation of the order
|
|
53
|
+
|
|
54
|
+
**After user confirms**, write `.codeyam/migration-state.json`:
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"status": "surveyed",
|
|
59
|
+
"startedAt": "<ISO>",
|
|
60
|
+
"completedAt": null,
|
|
61
|
+
"pages": [
|
|
62
|
+
{
|
|
63
|
+
"name": "Home",
|
|
64
|
+
"route": "/",
|
|
65
|
+
"filePath": "app/page.tsx",
|
|
66
|
+
"status": "pending",
|
|
67
|
+
"startedAt": null,
|
|
68
|
+
"completedAt": null,
|
|
69
|
+
"extractedComponents": [],
|
|
70
|
+
"extractedFunctions": [],
|
|
71
|
+
"scenarioCount": 0
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"currentPageIndex": 0,
|
|
75
|
+
"sharedComponents": []
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Then run: `codeyam editor migrate 1`
|
|
80
|
+
|
|
19
81
|
## The Cycle
|
|
20
82
|
|
|
21
83
|
Every feature follows 13 gated steps:
|
package/package.json
CHANGED
|
@@ -11,9 +11,11 @@ const editorScenariosSchema = {
|
|
|
11
11
|
screenshot_path: schemaField(),
|
|
12
12
|
viewport_width: schemaField(),
|
|
13
13
|
viewport_height: schemaField(),
|
|
14
|
-
dimension: schemaField(),
|
|
15
14
|
dimensions: schemaField(),
|
|
16
15
|
screenshot_paths: schemaField(),
|
|
16
|
+
page_file_path: schemaField(),
|
|
17
|
+
entity_sha: schemaField(),
|
|
18
|
+
display_name: schemaField(),
|
|
17
19
|
created_at: schemaField(),
|
|
18
20
|
updated_at: schemaField(),
|
|
19
21
|
};
|
|
@@ -64,16 +66,6 @@ export async function createEditorScenariosTable(db) {
|
|
|
64
66
|
// Column already exists — expected for fresh databases
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
|
-
// Named dimension column (e.g. "Mobile", "Desktop")
|
|
68
|
-
try {
|
|
69
|
-
await db.schema
|
|
70
|
-
.alterTable('editor_scenarios')
|
|
71
|
-
.addColumn('dimension', 'varchar')
|
|
72
|
-
.execute();
|
|
73
|
-
}
|
|
74
|
-
catch {
|
|
75
|
-
// Column already exists — expected for fresh databases
|
|
76
|
-
}
|
|
77
69
|
// Multi-dimension support: JSON array of dimension names and map of screenshot paths
|
|
78
70
|
for (const col of ['dimensions', 'screenshot_paths']) {
|
|
79
71
|
try {
|
|
@@ -86,12 +78,27 @@ export async function createEditorScenariosTable(db) {
|
|
|
86
78
|
// Column already exists — expected for fresh databases
|
|
87
79
|
}
|
|
88
80
|
}
|
|
89
|
-
//
|
|
90
|
-
//
|
|
81
|
+
// Route tracking: page file path for application scenarios
|
|
82
|
+
// Entity association: SHA links scenario to entity, display_name is the human label
|
|
83
|
+
for (const col of ['page_file_path', 'entity_sha', 'display_name']) {
|
|
84
|
+
try {
|
|
85
|
+
await db.schema
|
|
86
|
+
.alterTable('editor_scenarios')
|
|
87
|
+
.addColumn(col, 'varchar')
|
|
88
|
+
.execute();
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
// Column already exists — expected for fresh databases
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// Legacy backfill: migrate old `dimension` column (single string) into `dimensions`
|
|
95
|
+
// JSON array. Only runs on databases that have the legacy column — new databases
|
|
96
|
+
// won't have it. Separated from the screenshot_paths backfill below so that
|
|
97
|
+
// a missing column doesn't skip both migrations.
|
|
91
98
|
try {
|
|
92
99
|
const rows = await db
|
|
93
100
|
.selectFrom('editor_scenarios')
|
|
94
|
-
.select(['id', 'dimension', '
|
|
101
|
+
.select(['id', 'dimension', 'dimensions'])
|
|
95
102
|
.execute();
|
|
96
103
|
for (const row of rows) {
|
|
97
104
|
const r = row;
|
|
@@ -102,8 +109,29 @@ export async function createEditorScenariosTable(db) {
|
|
|
102
109
|
.where('id', '=', r.id)
|
|
103
110
|
.execute();
|
|
104
111
|
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
// Column doesn't exist (new DB) or other error — skip
|
|
116
|
+
}
|
|
117
|
+
// Backfill: wrap existing single screenshot_path into screenshot_paths object
|
|
118
|
+
try {
|
|
119
|
+
const rows = await db
|
|
120
|
+
.selectFrom('editor_scenarios')
|
|
121
|
+
.select(['id', 'screenshot_path', 'screenshot_paths', 'dimensions'])
|
|
122
|
+
.execute();
|
|
123
|
+
for (const row of rows) {
|
|
124
|
+
const r = row;
|
|
105
125
|
if (r.screenshot_path && !r.screenshot_paths) {
|
|
106
|
-
|
|
126
|
+
let dimName = 'Default';
|
|
127
|
+
try {
|
|
128
|
+
const dims = r.dimensions ? JSON.parse(r.dimensions) : null;
|
|
129
|
+
if (Array.isArray(dims) && dims.length > 0)
|
|
130
|
+
dimName = dims[0];
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
/* ignore */
|
|
134
|
+
}
|
|
107
135
|
await db
|
|
108
136
|
.updateTable('editor_scenarios')
|
|
109
137
|
.set({
|
|
@@ -115,7 +143,7 @@ export async function createEditorScenariosTable(db) {
|
|
|
115
143
|
}
|
|
116
144
|
}
|
|
117
145
|
catch {
|
|
118
|
-
// Backfill is best-effort
|
|
146
|
+
// Backfill is best-effort
|
|
119
147
|
}
|
|
120
148
|
}
|
|
121
149
|
//# sourceMappingURL=editorScenariosTable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editorScenariosTable.js","sourceRoot":"","sources":["../../../../../../../../packages/database/src/lib/kysely/tables/editorScenariosTable.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE3D,MAAM,qBAAqB,GAAG;IAC5B,EAAE,EAAE,WAAW,EAAqB;IACpC,UAAU,EAAE,WAAW,EAAU;IACjC,IAAI,EAAE,WAAW,EAAU;IAC3B,WAAW,EAAE,WAAW,EAAiB;IACzC,cAAc,EAAE,WAAW,EAAiB;IAC5C,cAAc,EAAE,WAAW,EAAiB;IAC5C,GAAG,EAAE,WAAW,EAAiB;IACjC,IAAI,EAAE,WAAW,EAAiB;IAClC,eAAe,EAAE,WAAW,EAAiB;IAC7C,cAAc,EAAE,WAAW,EAAiB;IAC5C,eAAe,EAAE,WAAW,EAAiB;IAC7C,
|
|
1
|
+
{"version":3,"file":"editorScenariosTable.js","sourceRoot":"","sources":["../../../../../../../../packages/database/src/lib/kysely/tables/editorScenariosTable.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE3D,MAAM,qBAAqB,GAAG;IAC5B,EAAE,EAAE,WAAW,EAAqB;IACpC,UAAU,EAAE,WAAW,EAAU;IACjC,IAAI,EAAE,WAAW,EAAU;IAC3B,WAAW,EAAE,WAAW,EAAiB;IACzC,cAAc,EAAE,WAAW,EAAiB;IAC5C,cAAc,EAAE,WAAW,EAAiB;IAC5C,GAAG,EAAE,WAAW,EAAiB;IACjC,IAAI,EAAE,WAAW,EAAiB;IAClC,eAAe,EAAE,WAAW,EAAiB;IAC7C,cAAc,EAAE,WAAW,EAAiB;IAC5C,eAAe,EAAE,WAAW,EAAiB;IAC7C,UAAU,EAAE,WAAW,EAAiB;IACxC,gBAAgB,EAAE,WAAW,EAAiB;IAC9C,cAAc,EAAE,WAAW,EAAiB;IAC5C,UAAU,EAAE,WAAW,EAAiB;IACxC,YAAY,EAAE,WAAW,EAAiB;IAC1C,UAAU,EAAE,WAAW,EAAqB;IAC5C,UAAU,EAAE,WAAW,EAAqB;CACpC,CAAC;AAMX,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC,IAAI,CACpD,qBAAqB,CACY,CAAC;AAEpC,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,EAAe;IAEf,MAAM,EAAE,CAAC,MAAM;SACZ,WAAW,CAAC,kBAAkB,CAAC;SAC/B,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,GAA4B,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;SAC3E,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC,GAA4B,EAAE,EAAE,CAChE,GAAG,CAAC,OAAO,EAAE,CACd;SACA,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,GAA4B,EAAE,EAAE,CAC7D,GAAG,CAAC,OAAO,EAAE,CACd;SACA,SAAS,CAAC,aAAa,EAAE,MAAM,CAAC;SAChC,SAAS,CAAC,gBAAgB,EAAE,SAAS,CAAC;SACtC,SAAS,CAAC,gBAAgB,EAAE,SAAS,CAAC;SACtC,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC;SAC3B,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC;SAC5B,SAAS,CAAC,iBAAiB,EAAE,SAAS,CAAC;SACvC,SAAS,CAAC,YAAY,EAAE,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;SACrD,SAAS,CAAC,YAAY,EAAE,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;SACrD,WAAW,EAAE;SACb,OAAO,EAAE,CAAC;IAEb,8EAA8E;IAC9E,KAAK,MAAM,GAAG,IAAI;QAChB,gBAAgB;QAChB,gBAAgB;QAChB,KAAK;QACL,MAAM;QACN,iBAAiB;KACT,EAAE,CAAC;QACX,IAAI,CAAC;YACH,MAAM,EAAE,CAAC,MAAM;iBACZ,UAAU,CAAC,kBAAkB,CAAC;iBAC9B,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC;iBACzB,OAAO,EAAE,CAAC;QACf,CAAC;QAAC,MAAM,CAAC;YACP,uDAAuD;QACzD,CAAC;IACH,CAAC;IAED,0CAA0C;IAC1C,KAAK,MAAM,GAAG,IAAI,CAAC,gBAAgB,EAAE,iBAAiB,CAAU,EAAE,CAAC;QACjE,IAAI,CAAC;YACH,MAAM,EAAE,CAAC,MAAM;iBACZ,UAAU,CAAC,kBAAkB,CAAC;iBAC9B,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC;iBACzB,OAAO,EAAE,CAAC;QACf,CAAC;QAAC,MAAM,CAAC;YACP,uDAAuD;QACzD,CAAC;IACH,CAAC;IAED,qFAAqF;IACrF,KAAK,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE,kBAAkB,CAAU,EAAE,CAAC;QAC9D,IAAI,CAAC;YACH,MAAM,EAAE,CAAC,MAAM;iBACZ,UAAU,CAAC,kBAAkB,CAAC;iBAC9B,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC;iBACtB,OAAO,EAAE,CAAC;QACf,CAAC;QAAC,MAAM,CAAC;YACP,uDAAuD;QACzD,CAAC;IACH,CAAC;IAED,2DAA2D;IAC3D,oFAAoF;IACpF,KAAK,MAAM,GAAG,IAAI,CAAC,gBAAgB,EAAE,YAAY,EAAE,cAAc,CAAU,EAAE,CAAC;QAC5E,IAAI,CAAC;YACH,MAAM,EAAE,CAAC,MAAM;iBACZ,UAAU,CAAC,kBAAkB,CAAC;iBAC9B,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC;iBACzB,OAAO,EAAE,CAAC;QACf,CAAC;QAAC,MAAM,CAAC;YACP,uDAAuD;QACzD,CAAC;IACH,CAAC;IAED,oFAAoF;IACpF,iFAAiF;IACjF,4EAA4E;IAC5E,iDAAiD;IACjD,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,EAAE;aAClB,UAAU,CAAC,kBAAkB,CAAC;aAC9B,MAAM,CAAC,CAAC,IAAI,EAAE,WAAW,EAAE,YAAY,CAAQ,CAAC;aAChD,OAAO,EAAE,CAAC;QACb,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,MAAM,CAAC,GAAG,GAAU,CAAC;YACrB,IAAI,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;gBACjC,MAAM,EAAE;qBACL,WAAW,CAAC,kBAAkB,CAAC;qBAC/B,GAAG,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;qBAClD,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;qBACtB,OAAO,EAAE,CAAC;YACf,CAAC;QACH,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,sDAAsD;IACxD,CAAC;IAED,8EAA8E;IAC9E,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,EAAE;aAClB,UAAU,CAAC,kBAAkB,CAAC;aAC9B,MAAM,CAAC,CAAC,IAAI,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,YAAY,CAAC,CAAC;aACnE,OAAO,EAAE,CAAC;QACb,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,MAAM,CAAC,GAAG,GAAU,CAAC;YACrB,IAAI,CAAC,CAAC,eAAe,IAAI,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC;gBAC7C,IAAI,OAAO,GAAG,SAAS,CAAC;gBACxB,IAAI,CAAC;oBACH,MAAM,IAAI,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;oBAC5D,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;wBAAE,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;gBAChE,CAAC;gBAAC,MAAM,CAAC;oBACP,YAAY;gBACd,CAAC;gBACD,MAAM,EAAE;qBACL,WAAW,CAAC,kBAAkB,CAAC;qBAC/B,GAAG,CAAC;oBACH,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,eAAe,EAAE,CAAC;iBACnE,CAAC;qBACD,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;qBACtB,OAAO,EAAE,CAAC;YACf,CAAC;QACH,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,0BAA0B;IAC5B,CAAC;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as i,j as o}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{C as x,a as m}from"./copy-n2FB0_Sw.js";function y({content:a,label:l="Copy",copiedLabel:p="✓ Copied!",className:c="",duration:t=2e3,ariaLabel:C,icon:n=!1,iconSize:s=14}){const[e,r]=i.useState(!1),d=i.useCallback(()=>{navigator.clipboard.writeText(a).then(()=>{r(!0),setTimeout(()=>r(!1),t)}).catch(u=>{console.error("Failed to copy:",u)})},[a,t]);return o.jsx("button",{onClick:d,className:`cursor-pointer ${c}`,disabled:e,"aria-label":C||(e?"Copied to clipboard":"Copy to clipboard"),"aria-live":"polite",children:n?e?o.jsx(x,{size:s,className:"text-green-500"}):o.jsx(m,{size:s}):e?p:l})}export{y as C};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./chunk-JZWAC4HX-C4pqxYJB.js";const l={visual:{label:"VISUAL",bgColor:"#f9f9f9",textColor:"#9040f5"},library:{label:"LIBRARY",bgColor:"#f9f9f9",textColor:"#06b6d5"},type:{label:"TYPE",bgColor:"#ffe1e1",textColor:"#db2627"},other:{label:"OTHER",bgColor:"#f9f9f9",textColor:"#646464"}};function n({type:t,className:r=""}){const e=l[t]||l.other;return o.jsx("div",{className:`inline-flex items-center justify-center px-[4px] rounded-[4px] ${r}`,style:{backgroundColor:e.bgColor,color:e.textColor,height:"15px"},children:o.jsx("span",{className:"text-[10px] font-['IBM_Plex_Sans'] font-semibold leading-[15px] uppercase",children:e.label})})}export{n as E};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,j as c}from"./chunk-JZWAC4HX-C4pqxYJB.js";const n=["⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷"],o=80;function i(){const[t,r]=e.useState(0);return e.useEffect(()=>{const s=setInterval(()=>{r(a=>(a+1)%n.length)},o);return()=>clearInterval(s)},[]),c.jsx("span",{className:"inline-block mr-2",children:n[t]})}export{i as I};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BcvgDzbZ.js","assets/chunk-JZWAC4HX-C4pqxYJB.js","assets/index-10oVnAAH.js","assets/styles-CMKNK2uU.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as t,j as e}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{_ as L}from"./preload-helper-ckwbz45p.js";import{u as Q}from"./useLastLogLine-C14nCb1q.js";import{S as P}from"./Spinner-Bb5uFQ5V.js";import{I as B}from"./InlineSpinner-Bu6c6aDe.js";const $=t.createContext({dimensions:{height:720,width:1200},updateDimensions:()=>{},iframeRef:{current:null},scale:1,updateScale:()=>{},maxWidth:1200,updateMaxWidth:()=>{}}),U=()=>{const o=t.useContext($);if(!o)throw new Error("useWebContainer must be used within a WebContainerProvider");return o},le=({children:o})=>{const[i,r]=t.useState({height:720,width:1200}),[d,f]=t.useState(1),[u,g]=t.useState(1200),x=t.useRef(null),h=t.useCallback(({height:l,width:j})=>{r(S=>({height:l??S.height,width:j??S.width}))},[]),v=t.useCallback(l=>{f(l)},[]),w=t.useCallback(l=>{g(l)},[]);return e.jsx($.Provider,{value:{dimensions:i,updateDimensions:h,iframeRef:x,scale:d,updateScale:v,maxWidth:u,updateMaxWidth:w},children:o})},X=typeof window<"u";function Z(){const[o,i]=t.useState(null);return t.useEffect(()=>{L(()=>import("./index-BcvgDzbZ.js").then(r=>r.i),__vite__mapDeps([0,1,2])).then(r=>{i(()=>r.ResizableBox)}),L(()=>Promise.resolve({}),__vite__mapDeps([3]))},[]),o}const ee=1200,te=720,H=30,se=({id:o,scenarioName:i,iframeUrl:r,defaultWidth:d=1440,defaultHeight:f=900,onDataOverride:u,onIframeLoad:g,onScaleChange:x,onDimensionChange:h})=>{const v=Z(),[w,l]=t.useState(!1),[j,S]=t.useState(!1),[c,A]=t.useState(ee),[_,D]=t.useState(te),[E,T]=t.useState(null),[M,I]=t.useState(null),{dimensions:a,updateDimensions:y,iframeRef:m,updateScale:N,updateMaxWidth:R}=U(),k=t.useMemo(()=>Math.min(1,c/a.width),[c,a.width]),p=M!==null?M:k;t.useEffect(()=>{w||(N(p),x==null||x(p))},[p,N,x,w]),t.useEffect(()=>{R(c)},[c,R]);const G=t.useCallback(()=>{l(!0),I(k)},[k]),O=t.useCallback(()=>{l(!1),I(null)},[]),V=t.useCallback((n,s)=>{const b=M!==null?M:1,z=Math.round(s.size.width/b);y({width:z}),h==null||h(z,a.height)},[y,M,h,a.height]),F=t.useCallback(()=>{setTimeout(()=>{S(!0)},100),g&&g()},[g]);t.useEffect(()=>{const n=s=>{if(s.data.type==="codeyam-resize"){if(i&&s.data.name!==i||a.height===s.data.height||s.data.height===0)return;y({height:s.data.height})}};return window.addEventListener("message",n),()=>{window.removeEventListener("message",n)}},[m,i,d,a,y]),t.useEffect(()=>{j&&u&&u(m.current)},[j,u,m]),t.useEffect(()=>{if(!i)return;const n=setInterval(()=>{var s,b;(b=(s=m==null?void 0:m.current)==null?void 0:s.contentWindow)==null||b.postMessage({type:"codeyam-respond",name:i},"*")},1e3);return()=>clearInterval(n)},[i,m]),t.useEffect(()=>{const n=()=>{const s=document.getElementById("scenario-container");if(!s)return;const b=s.getBoundingClientRect(),z=s.clientWidth-H*2,q=window.innerHeight-b.top-H*2,J=Math.max(q,400),K=window.innerHeight-b.top;A(z),D(J),T(K)};return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t.useEffect(()=>{y({width:d,height:f})},[d,f,y]);const C=t.useMemo(()=>a.width*p,[a.width,p]),W=t.useMemo(()=>{const n=a.height,s=n*p;return n&&n!==720&&n!==900&&s<_?s:_},[a.height,_,p]),Y=t.useCallback(()=>{window.history.back()},[]);return!X||!v?e.jsx("div",{className:"relative bg-gray-100 w-full h-full flex items-center justify-center",children:e.jsx("p",{className:"text-gray-500",children:"Loading interactive view..."})}):e.jsxs("div",{id:"scenario-container",className:"relative bg-gray-100 w-full flex items-center justify-center",style:E?{height:`${E}px`}:{},children:[w&&e.jsx("div",{className:"fixed inset-0 z-50 bg-transparent"}),e.jsx("style",{children:`
|
|
3
|
-
.react-resizable-handle-e {
|
|
4
|
-
display: flex !important;
|
|
5
|
-
align-items: center !important;
|
|
6
|
-
justify-content: center !important;
|
|
7
|
-
width: 6px !important;
|
|
8
|
-
height: 48px !important;
|
|
9
|
-
right: -8px !important;
|
|
10
|
-
top: 50% !important;
|
|
11
|
-
transform: translateY(-50%) !important;
|
|
12
|
-
cursor: ew-resize !important;
|
|
13
|
-
background: #d1d5db !important;
|
|
14
|
-
border-radius: 3px !important;
|
|
15
|
-
opacity: 0 !important;
|
|
16
|
-
transition: all 0.2s ease !important;
|
|
17
|
-
}
|
|
18
|
-
.react-resizable-handle-e:hover {
|
|
19
|
-
opacity: 0.8 !important;
|
|
20
|
-
background: #9ca3af !important;
|
|
21
|
-
}
|
|
22
|
-
.react-resizable:hover .react-resizable-handle-e {
|
|
23
|
-
opacity: 0.4 !important;
|
|
24
|
-
}
|
|
25
|
-
`}),e.jsx(v,{width:C,height:W,minConstraints:[300,200],maxConstraints:[c,_],className:"relative bg-white rounded-lg shadow-md",resizeHandles:["e"],onResizeStart:G,onResizeStop:O,onResize:V,children:e.jsx("div",{className:"overflow-auto",style:{width:`${C}px`,height:`${W}px`},children:e.jsx("div",{style:{width:`${a.width}px`,height:`${a.height}px`,transform:`scale(${p})`,transformOrigin:"top left"},children:r?e.jsx("iframe",{ref:m,className:"w-full h-full rounded-lg",src:r,onLoad:F,sandbox:"allow-scripts allow-same-origin"}):e.jsxs("p",{className:"w-full h-full flex flex-col gap-3 items-center justify-center",children:[e.jsx("span",{className:"text-xl font-light",children:"Oops! Looks like this scenario is not available yet. Please check back later."}),e.jsx("span",{className:"text-blue-600 cursor-pointer",onClick:Y,children:"Go back"})]})})})},`resizable-box-${o}`)]})};function ce({scenarioId:o,scenarioName:i,iframeUrl:r,isStarting:d,isLoading:f,showIframe:u,iframeKey:g,onIframeLoad:x,onScaleChange:h,onDimensionChange:v,projectSlug:w,defaultWidth:l=1440,defaultHeight:j=900,retryCount:S=0}){const{lastLine:c}=Q(w??null,d||f);return r?e.jsxs("div",{className:"flex-1 min-h-0 relative",style:{background:"transparent"},children:[e.jsx("div",{style:{opacity:u?1:0,background:"transparent"},children:e.jsx(se,{id:o,scenarioName:i,iframeUrl:r,defaultWidth:l,defaultHeight:j,onIframeLoad:x,onScaleChange:h,onDimensionChange:v},g)}),!u&&(d||f)&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10",children:e.jsxs("div",{className:"flex flex-col items-center justify-center gap-6 bg-white rounded-lg p-8 shadow-sm w-[500px] h-[300px]",children:[e.jsx("div",{className:"mb-4",children:e.jsx(P,{})}),e.jsxs("div",{className:"flex flex-col gap-3 text-center",children:[e.jsx("h2",{className:"text-xl font-medium text-black leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Starting Interactive Mode"}),e.jsx("p",{className:"text-sm text-[#666] leading-5 m-0 font-['IBM_Plex_Sans']",children:"Setting up a sandboxed environment for your component"}),c&&e.jsxs("p",{className:"text-xs font-mono text-[#005c75] text-center leading-5 m-0 mt-3 font-['IBM_Plex_Mono'] uppercase",children:[e.jsx(B,{}),c]})]})]})})]}):e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center p-12 text-center",children:e.jsxs("div",{className:"flex flex-col items-center justify-center gap-6 w-[500px] h-[300px] bg-white rounded-lg p-8 shadow-sm",children:[e.jsx("div",{className:"mb-4",children:e.jsx(P,{})}),e.jsxs("div",{className:"flex flex-col gap-3 text-center",children:[e.jsx("h2",{className:"text-xl font-medium text-black leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Starting Interactive Mode"}),e.jsx("p",{className:"text-sm text-[#666] leading-5 m-0 font-['IBM_Plex_Sans']",children:"Setting up a sandboxed environment for your component"}),c&&e.jsxs("p",{className:"text-xs font-mono text-[#005c75] text-center leading-5 m-0 mt-3 font-['IBM_Plex_Mono'] uppercase",children:[e.jsx(B,{}),c]})]})]})})}export{ce as I,le as W,U as u};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{j as r,L as C}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{g as L}from"./scenarioStatus-B_8jpV3e.js";function M({scenario:s,entitySha:m,size:g="medium",showBorder:j=!0,isOutdated:E=!1}){var x,h,u,p,$,f;const t=L(s,void 0,void 0,m,void 0),e=(x=s.metadata)==null?void 0:x.executionResult,o=!!e,b=(((u=(h=s.metadata)==null?void 0:h.data)==null?void 0:u.argumentsData)||[]).length,c=(e==null?void 0:e.returnValue)!==void 0&&(e==null?void 0:e.returnValue)!==null,i=(($=(p=e==null?void 0:e.sideEffects)==null?void 0:p.consoleOutput)==null?void 0:$.length)||0,d=((f=e==null?void 0:e.timing)==null?void 0:f.duration)||0;let a=0;b>0&&a++,b>2&&a++,c&&a++,i>0&&a++,a=Math.min(3,a);const l=g==="small"?{width:"w-[50px]",height:"h-[38px]",iconSize:"text-base",textSize:"text-[8px]"}:{width:"w-20",height:"h-15",iconSize:"text-xl",textSize:"text-[10px]"},n=t.hasError?{border:"border-red-400",bg:"bg-red-50",icon:"text-red-600",badge:"bg-red-100 text-red-700"}:o?E?{border:"border-amber-500",bg:"bg-amber-50",icon:"text-amber-700",badge:"bg-amber-100 text-amber-700"}:{border:"border-blue-400",bg:"bg-blue-50",icon:"text-blue-600",badge:"bg-blue-100 text-blue-700"}:{border:"border-gray-300 border-dashed",bg:"bg-gray-50",icon:"text-gray-400",badge:"bg-gray-100 text-gray-600"},w=j?`border-2 ${n.border}`:"",S=Array.from({length:3},(v,y)=>r.jsx("div",{className:`w-1 h-1 rounded-full ${y<a?n.icon.replace("text-","bg-"):"bg-gray-300"}`},y)),N=t.hasError?`Error: ${t.errorMessage||"Unknown error"}`:o?`${s.name}
|
|
2
|
-
${b} args → ${c?"value":"void"}${i>0?` (${i} logs)`:""}
|
|
3
|
-
${d}ms`:`Not executed: ${s.name}`;return r.jsxs(C,{to:`/entity/${m}/scenarios/${s.id}`,className:`relative ${l.width} ${l.height} ${w} rounded ${n.bg} flex flex-col items-center justify-center gap-0.5 cursor-pointer transition-all hover:scale-105 hover:shadow-md`,title:N,onClick:v=>v.stopPropagation(),children:[r.jsx("div",{className:`${n.icon} ${l.iconSize} font-mono font-bold`,children:t.hasError?"⚠":o?"ƒ":"○"}),o&&!t.hasError&&r.jsxs("div",{className:`flex items-center gap-0.5 ${l.textSize} ${n.badge} px-1 rounded`,children:[r.jsx("span",{children:b}),r.jsx("span",{children:"→"}),r.jsx("span",{children:c?"✓":"∅"})]}),o&&!t.hasError&&g==="medium"&&r.jsx("div",{className:"flex gap-0.5 mt-0.5",children:S}),o&&!t.hasError&&d>100&&g==="medium"&&r.jsx("div",{className:`absolute top-0.5 right-0.5 ${l.textSize} ${n.badge} px-1 rounded`,children:d>1e3?`${Math.round(d/1e3)}s`:`${d}ms`}),o&&!t.hasError&&i>0&&g==="medium"&&r.jsxs("div",{className:"absolute bottom-0.5 left-0.5 text-[8px] text-gray-500",children:["📝",i]})]})}export{M as L};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as a,j as e}from"./chunk-JZWAC4HX-C4pqxYJB.js";function j({screenshotPath:l,cacheBuster:o,alt:x,className:f="",title:n}){const[i,s]=a.useState("loading"),[c,r]=a.useState(!1),d=a.useRef(null),u=o?`/api/screenshot/${l}?cb=${o}`:`/api/screenshot/${l}`,m=()=>{s("success"),r(!0)},h=()=>{s("error"),r(!1)};return a.useEffect(()=>{s("loading"),r(!1);const t=d.current;t!=null&&t.complete&&(t.naturalHeight!==0?(s("success"),r(!0)):(s("error"),r(!1)))},[u]),l?e.jsxs("div",{className:"relative w-full h-full flex items-center justify-center",title:n,children:[e.jsx("img",{ref:d,src:u,alt:x,onLoad:m,onError:h,className:f||"max-w-full max-h-full object-contain",style:{visibility:c?"visible":"hidden",position:c?"relative":"absolute"}}),i==="loading"&&e.jsx("div",{className:"absolute inset-0 bg-gray-100 animate-pulse rounded flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-gray-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),i==="error"&&e.jsxs("div",{className:"absolute inset-0 border-2 border-dashed border-gray-300 bg-gray-50 rounded flex flex-col items-center justify-center text-xs gap-1",children:[e.jsx("span",{className:"text-2xl text-gray-400",children:"📷"}),e.jsx("span",{className:"text-gray-400 whitespace-nowrap",children:"No Screenshot"})]})]}):e.jsx("div",{className:"w-full h-full border-2 border-dashed border-gray-300 bg-gray-50 rounded flex flex-col items-center justify-center text-xs gap-1",title:n,children:e.jsx("span",{className:"text-2xl text-gray-400",children:"📷"})})}export{j as S};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import{d as P,r as t,j as y}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{u as _}from"./useLastLogLine-C14nCb1q.js";function R(s){const o=s.replace(/[^a-zA-Z0-9_]+/g,"_");return o.slice(0,1).toUpperCase()+o.slice(1)}function $({analysisId:s,scenarioId:o,scenarioName:i,entityName:c,projectSlug:m,enabled:x=!0,refreshTrigger:p=0}){const k=P(),[b,E]=t.useState(null),[q,U]=t.useState(!1),[z,u]=t.useState(!1),[A,f]=t.useState(!1),v=t.useRef(!1),I=t.useRef(null),g=t.useRef(null),h=t.useRef(null),[F,w]=t.useState(0),[j,M]=t.useState(0),r=t.useRef(null),l=t.useRef(!1),{interactiveUrl:L,resetLogs:T}=_(m,x),C=t.useRef(o),B=t.useRef(p);t.useEffect(()=>{B.current!==p&&(B.current=p,b&&(console.log("[useInteractiveMode] Manual refresh triggered"),u(!0),f(!1),w(0),M(e=>e+1),l.current=!1,r.current&&(clearTimeout(r.current),r.current=null)))},[p,b]),t.useEffect(()=>{if(C.current!==o&&(C.current=o,I.current&&g.current&&i)){let e=I.current;if(h.current&&c){const a=R(h.current),d=R(c);a!==d&&(e=e.replace(a,d),h.current=c)}const n=R(g.current),S=R(i);e=e.replace(n,S),g.current=i,E(e),u(!0),f(!1),w(0),M(a=>a+1),l.current=!1,r.current&&(clearTimeout(r.current),r.current=null);return}},[o,i,c]),t.useEffect(()=>{if(L){const e=L+"?width=600px";I.current=e,i&&(g.current=i),c&&(h.current=c),E(e),U(!1),u(!0)}},[L]),t.useEffect(()=>{const e=n=>{n.data.type==="codeyam-resize"&&(l.current||(l.current=!0,r.current&&(clearTimeout(r.current),r.current=null),w(0),f(!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{u(!1)})})))};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[]);const D=()=>{l.current=!1,r.current&&clearTimeout(r.current);const e=300*Math.pow(2,F);r.current=setTimeout(()=>{l.current||(F<2?(w(n=>n+1),M(n=>n+1),u(!0)):(console.error("[useInteractiveMode] Interactive mode failed to load after 3 attempts - showing iframe anyway"),f(!0),u(!1)))},e)};return t.useEffect(()=>{x&&!v.current&&o&&s&&(v.current=!0,U(!0),f(!1),E(null),(async()=>{if(m)try{await fetch(`/api/logs/${m}`,{method:"DELETE"})}catch(n){console.error("[useInteractiveMode] Failed to clear log file:",n)}T(),k.submit({action:"start",analysisId:s,scenarioId:o},{method:"post",action:"/api/interactive-mode"})})())},[x,o,s,T,m]),t.useEffect(()=>{const e=s,n=()=>{if(v.current&&e){const a=new URLSearchParams({action:"stop",analysisId:e});console.log("[useInteractiveMode] Sending stop request via sendBeacon");const d=navigator.sendBeacon("/api/interactive-mode",a);console.log("[useInteractiveMode] sendBeacon result:",d),d||(console.log("[useInteractiveMode] sendBeacon failed, using fetch fallback"),fetch("/api/interactive-mode",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:a,keepalive:!0}).catch(K=>console.error("Failed to stop interactive mode:",K)))}},S=()=>{n()};return window.addEventListener("beforeunload",S),()=>{window.removeEventListener("beforeunload",S),console.log("[useInteractiveMode] Cleanup running:",{hasStarted:v.current,analysisId:e}),n()}},[s]),{interactiveServerUrl:b,isStarting:q,isLoading:z,showIframe:A,iframeKey:j,onIframeLoad:D}}function G(){return y.jsxs("div",{className:"spinner-container",children:[y.jsx("span",{className:"loader"}),y.jsx("style",{children:`
|
|
2
|
-
.loader {
|
|
3
|
-
width: 48px;
|
|
4
|
-
height: 48px;
|
|
5
|
-
border: 3px solid rgba(0, 92, 117, 0.2);
|
|
6
|
-
border-radius: 50%;
|
|
7
|
-
display: inline-block;
|
|
8
|
-
position: relative;
|
|
9
|
-
box-sizing: border-box;
|
|
10
|
-
animation: rotation 1s linear infinite;
|
|
11
|
-
}
|
|
12
|
-
.loader::after {
|
|
13
|
-
content: '';
|
|
14
|
-
box-sizing: border-box;
|
|
15
|
-
position: absolute;
|
|
16
|
-
left: 50%;
|
|
17
|
-
top: 50%;
|
|
18
|
-
transform: translate(-50%, -50%);
|
|
19
|
-
width: 56px;
|
|
20
|
-
height: 56px;
|
|
21
|
-
border-radius: 50%;
|
|
22
|
-
border: 3px solid;
|
|
23
|
-
border-color: #005c75 transparent;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
@keyframes rotation {
|
|
27
|
-
0% {
|
|
28
|
-
transform: rotate(0deg);
|
|
29
|
-
}
|
|
30
|
-
100% {
|
|
31
|
-
transform: rotate(360deg);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
`})]})}export{G as S,$ as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as v}from"./chunk-JZWAC4HX-C4pqxYJB.js";function O({filePath:n,maxLength:x=60,className:f,style:u}){const o=((t,r)=>{if(t.length<=r)return t;const a="...",c=r-a.length,i=Math.ceil(c*.4),d=Math.floor(c*.6),e=t.slice(0,i),s=t.slice(-d),h=e.lastIndexOf("/"),l=s.indexOf("/"),g=h>i*.5?e.slice(0,h+1):e,m=l!==-1&&l<d*.5?s.slice(l):s;return`${g}${a}${m}`})(n,x),p=o!==n;return v.jsx("span",{className:f||"font-normal text-gray-900 text-[14px] select-text cursor-text",style:{...u,display:"inline-block",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:p?n:void 0,children:o})}export{O as T};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as u,j as n}from"./chunk-JZWAC4HX-C4pqxYJB.js";const g=10,W=1024;function G({currentViewportWidth:m,currentPresetName:P,onDevicePresetClick:w,devicePresets:p,onHoverChange:c,hideLabel:E=!1,lightMode:d=!1}){const[l,v]=u.useState(null),x=u.useRef(null),j=u.useMemo(()=>[...p].sort((t,s)=>t.width-s.width),[p]),{fittingPresets:o,overflowPresets:i}=u.useMemo(()=>{const t=[],s=[];for(const e of j)e.width<=W?t.push(e):s.push(e);return s.sort((e,r)=>r.width-e.width),{fittingPresets:t,overflowPresets:s}},[j]),b=u.useCallback(t=>{if(!x.current)return null;const s=x.current.getBoundingClientRect(),e=t-s.left,r=s.width,h=r/2,y=(o.length>0?o[o.length-1].width:0)/2,S=h-y,X=h+y,$=i.length>0?(i.length-1)*g:0;if(i.length>0){if(e<S){if(e<=$){const a=Math.min(Math.floor(e/g),i.length-1);return i[a]}return i[i.length-1]}if(e>X){const a=r-e;if(a<=$){const f=Math.min(Math.floor(a/g),i.length-1);return i[f]}return i[i.length-1]}}const k=Math.abs(e-h);for(let a=o.length-1;a>=0;a--){const f=o[a],F=o[a-1],B=f.width/2,T=F?F.width/2:0;if(k<=B&&k>=T)return f}return o[0]||i[i.length-1]||null},[o,i]),I=u.useCallback(t=>{const s=b(t.clientX);v(s),c==null||c(s)},[b,c]),M=u.useCallback(()=>{v(null),c==null||c(null)},[c]),R=u.useCallback(t=>{const s=b(t.clientX);s&&w(s)},[b,w]),N=l||{name:P,width:m};return n.jsxs("div",{ref:x,className:"relative h-6 shrink-0 overflow-hidden cursor-pointer",onMouseMove:I,onMouseLeave:M,onClick:R,children:[l&&n.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:n.jsx("div",{className:"h-full transition-all duration-100 bg-[#005C75]",style:{width:`${l.width}px`}})}),n.jsx("div",{className:"absolute inset-0 pointer-events-none",children:o.map(t=>{const s=t.width===m,e=(l==null?void 0:l.name)===t.name,r=t.width/2;return n.jsxs("div",{children:[n.jsx("div",{className:"absolute top-0 bottom-0",style:{left:`calc(50% - ${r}px)`},children:n.jsx("div",{className:`w-0.5 h-full transition-colors duration-75 ${s||e?d?"bg-gray-900":"bg-white":d?"bg-[rgba(0,0,0,0.2)]":"bg-[rgba(255,255,255,0.3)]"}`})}),n.jsx("div",{className:"absolute top-0 bottom-0",style:{left:`calc(50% + ${r}px)`},children:n.jsx("div",{className:`w-0.5 h-full transition-colors duration-75 ${s||e?d?"bg-gray-900":"bg-white":d?"bg-[rgba(0,0,0,0.2)]":"bg-[rgba(255,255,255,0.3)]"}`})})]},t.name)})}),n.jsx("div",{className:"absolute inset-0 pointer-events-none",children:i.map((t,s)=>{const e=s*g,r=t.width===m,h=(l==null?void 0:l.name)===t.name;return n.jsxs("div",{children:[n.jsx("div",{className:"absolute top-0 bottom-0",style:{left:`${e}px`},children:n.jsx("div",{className:`w-0.5 h-full transition-colors duration-75 ${r||h?d?"bg-gray-900":"bg-white":d?"bg-[rgba(0,0,0,0.2)]":"bg-[rgba(255,255,255,0.3)]"}`})}),n.jsx("div",{className:"absolute top-0 bottom-0",style:{right:`${e}px`},children:n.jsx("div",{className:`w-0.5 h-full transition-colors duration-75 ${r||h?d?"bg-gray-900":"bg-white":d?"bg-[rgba(0,0,0,0.2)]":"bg-[rgba(255,255,255,0.3)]"}`})})]},t.name)})}),!E&&n.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:n.jsxs("div",{className:`text-[10px] px-2 py-0.5 rounded shadow-sm whitespace-nowrap transition-colors ${l?"bg-[#005c75] text-white":"bg-white/90 text-[#005c75] border border-[rgba(0,92,117,0.25)]"}`,children:[N.name," - ",N.width,"px"]})})]})}export{G as V};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{w as t,d as r,j as e}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{S as i}from"./ScenarioViewer-TSD3C211.js";import{W as n}from"./InteractivePreview-DYFW3lDD.js";import"./ViewportInspectBar-oAf2Kqsf.js";import"./useCustomSizes-C-_hOl_g.js";import"./LogViewer-ceAyBX-H.js";import"./SafeScreenshot-BED4B6sP.js";import"./useLastLogLine-C14nCb1q.js";import"./Spinner-Bb5uFQ5V.js";import"./preload-helper-ckwbz45p.js";import"./ReportIssueModal-BzHcG7SE.js";import"./createLucideIcon-CC6AbExI.js";import"./circle-check-BVMi9VA5.js";import"./triangle-alert-BLdiCuG-.js";import"./copy-n2FB0_Sw.js";import"./scenarioStatus-B_8jpV3e.js";import"./InlineSpinner-Bu6c6aDe.js";const k=()=>[{title:"Empty State - CodeYam"},{name:"description",content:"Simulations empty state development view"}],S=t(function(){r();const s={sha:"mock-sha",name:"Dashboard",filePath:"codeyam-cli/src/webserver/app/routes/_index.tsx",entityType:"visual"};return e.jsx(n,{children:e.jsxs("div",{className:"h-screen bg-[#F8F7F6] flex flex-col overflow-hidden",children:[e.jsx("header",{className:"bg-white border-b border-gray-200 shrink-0 relative h-[54px]",children:e.jsxs("div",{className:"flex items-center h-full px-6 gap-6",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("svg",{width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M13 8.5H4M4 8.5L8.5 4M4 8.5L8.5 13",stroke:"#005c75",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsx("h1",{className:"text-lg font-semibold text-black m-0 leading-[26px] shrink-0",children:"Dashboard"}),e.jsx("span",{className:"text-xs text-[#626262] font-mono whitespace-nowrap overflow-hidden text-ellipsis min-w-0",children:"codeyam-cli/src/webserver/app/routes/_index.tsx"})]}),e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2 px-[15px] py-0 h-[26px] bg-[#efefef] border border-[#e1e1e1] rounded",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-[#626262]"}),e.jsx("span",{className:"text-xs font-semibold text-[#626262]",children:"Not analyzed"})]}),e.jsx("button",{className:"px-[15px] py-0 h-[26px] bg-[#005c75] text-white rounded text-xs font-semibold border-none cursor-pointer hover:bg-[#004a5e] transition-colors",children:"Analyze"})]}),e.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-[#626262] ml-auto",children:[e.jsx("span",{className:"leading-[22px]",children:"Next Entity"}),e.jsx("svg",{width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M4 8.5H13M13 8.5L8.5 4M13 8.5L8.5 13",stroke:"#005c75",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})}),e.jsx("div",{className:"bg-[#efefef] border-b border-[#efefef] shrink-0",children:e.jsxs("div",{className:"flex items-center gap-3 h-11 px-[15px]",children:[e.jsxs("div",{className:"px-4 flex items-center justify-center gap-3 shrink-0 text-sm rounded bg-[#343434] text-[#efefef] font-semibold h-8",children:["Scenarios",e.jsx("span",{className:"px-2 py-0.5 rounded-[9px] text-xs font-semibold bg-[#cbf3fa] text-[#005c75] min-w-[25px] text-center",children:"0"})]}),e.jsxs("div",{className:"px-4 flex items-center justify-center gap-3 shrink-0 text-sm rounded-[9px] text-[#3e3e3e] font-normal",children:["Related Entities",e.jsx("span",{className:"px-2 py-0.5 rounded-[9px] text-xs font-semibold bg-[#e1e1e1] text-[#3e3e3e] min-w-[25px] text-center",children:"5"})]}),e.jsx("div",{className:"px-4 shrink-0 text-sm text-[#3e3e3e] font-normal",children:"Code"}),e.jsx("div",{className:"px-4 shrink-0 text-sm text-[#3e3e3e] font-normal",children:"Data Structure"}),e.jsx("div",{className:"px-4 shrink-0 text-sm text-[#3e3e3e] font-normal",children:"History"})]})}),e.jsxs("div",{className:"flex flex-1 gap-0 min-h-0",children:[e.jsx("div",{className:"w-[165px] bg-[#e1e1e1] border-r border-[#c7c7c7] flex items-center justify-center shrink-0",children:e.jsx("span",{className:"text-xs font-medium text-[#8e8e8e] leading-5",children:"No Scenarios"})}),e.jsx(i,{selectedScenario:null,analysis:void 0,entity:s,viewMode:"screenshot",cacheBuster:Date.now(),hasScenarios:!1,isAnalyzing:!1,projectSlug:null,hasAnApiKey:!0})]})]})})});export{S as default,k as meta};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-yHOVb4rc.js","assets/chunk-JZWAC4HX-C4pqxYJB.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var Mt=Object.defineProperty;var It=(t,s,a)=>s in t?Mt(t,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[s]=a;var qe=(t,s,a)=>It(t,typeof s!="symbol"?s+"":s,a);import{r as n,j as e,w as Et,u as Rt,b as $t}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{u as Tt,C as Lt}from"./useCustomSizes-C-_hOl_g.js";import{g as Bt,s as At,r as Me,b as ce,c as _t,l as Dt,d as Ot,e as Ut,f as zt,a as Ft,T as Wt,D as Ht}from"./editorPreview-CNB06EIa.js";import{C as Ee}from"./CopyButton-BPXZwM4t.js";import{_ as Gt}from"./preload-helper-ckwbz45p.js";import{c as Jt}from"./cy-logo-cli-DcX-ZS3p.js";import{u as Vt,S as Ke}from"./Spinner-Bb5uFQ5V.js";import"./copy-n2FB0_Sw.js";import"./createLucideIcon-CC6AbExI.js";import"./useLastLogLine-C14nCb1q.js";const xe=[{name:"Desktop",width:1440,height:900},{name:"Laptop",width:1024,height:768},{name:"Tablet",width:768,height:1024},{name:"Mobile",width:375,height:667}];function Yt(t){if(!t)return xe;const s=Object.entries(t).map(([i,h])=>({name:i,width:h.width,height:h.height})),a=new Set(s.map(i=>i.name));return[...s,...xe.filter(i=>!a.has(i.name))]}function Re(t){const[s,a]=n.useState(null),[i,h]=n.useState(!1),d=n.useCallback(()=>{t&&(h(!0),fetch(`/api/editor-test-results?testFile=${encodeURIComponent(t)}`).then(c=>c.json()).then(c=>{a(c),h(!1)}).catch(()=>{a({testFilePath:t,status:"error",testCases:[],errorMessage:"Failed to fetch test results"}),h(!1)}))},[t]);return n.useEffect(()=>{t&&d()},[t,d]),{results:s,isRunning:i,runTests:d}}function Q(t){if(!t||t==="/")return"Home";const s=t.split("?")[0].replace(/^\//,"");if(!s)return"Home";const a=s.split("/")[0];return a.charAt(0).toUpperCase()+a.slice(1)}function $e(t){return t?t.includes("/isolated-components"):!1}function qt(t,s){return!s||Object.keys(s).length===0?t:t.filter(a=>s[a.name])}function ne({imgSrc:t,name:s,isActive:a,onSelect:i}){return e.jsxs("button",{onClick:i,className:"flex flex-col items-center gap-1 cursor-pointer group",title:s,children:[e.jsx("div",{className:`w-32 h-32 rounded overflow-hidden border-2 transition-all bg-[#1a1a1a] ${a?"border-[#005c75] ring-1 ring-[#005c75]":"border-transparent hover:border-[#4d4d4d]"}`,children:t?e.jsx("img",{src:t,alt:s,className:"w-full h-full object-contain",loading:"lazy"}):e.jsx("div",{className:"w-full h-full bg-[#1a1a1a] flex items-center justify-center",children:e.jsx("span",{className:"text-[8px] text-gray-600",children:"No img"})})}),e.jsx("span",{className:`text-[10px] leading-tight text-center truncate w-32 ${a?"text-white":"text-gray-500 group-hover:text-gray-300"}`,children:s})]})}function Ie({testFile:t,entityName:s}){const{results:a,isRunning:i,runTests:h}=Re(t);if(i&&!a)return e.jsxs("div",{className:"px-2 pt-1 flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#005c75] animate-pulse"}),e.jsx("span",{className:"text-[10px] text-gray-400",children:"Running tests..."})]});if(!a)return null;if(a.status==="error")return e.jsx("div",{className:"px-2 pt-1",children:e.jsx("span",{className:"text-[10px] text-red-400",children:a.errorMessage})});const d=s?a.testCases.filter(u=>u.fullName.startsWith(s)):a.testCases,c=d.length>0?d:a.testCases;if(c.length===0)return null;const x=s?`${s} > `:"";return e.jsxs("div",{className:"px-2 pt-1 space-y-0.5",children:[c.map(u=>{var S;const k=x&&u.fullName.startsWith(x)?u.fullName.slice(x.length):u.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[u.status==="passed"?e.jsx("span",{className:"text-green-400 text-[10px]",children:"✓"}):u.status==="failed"?e.jsx("span",{className:"text-red-400 text-[10px]",children:"✗"}):e.jsx("span",{className:"text-gray-500 text-[10px]",children:"—"}),e.jsx("span",{className:`text-[10px] ${u.status==="passed"?"text-green-400":u.status==="failed"?"text-red-400":"text-gray-500"}`,children:k})]}),u.status==="failed"&&((S=u.failureMessages)==null?void 0:S.map((N,w)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-300/70 truncate max-w-full",title:N,children:N.split(`
|
|
3
|
-
`)[0]},w)))]},u.fullName)}),e.jsx("button",{onClick:h,disabled:i,className:"mt-1 text-[10px] text-[#00a0c4] hover:text-[#00c4ee] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:i?"Running...":"Re-run"})]})}function Y({filePath:t}){return t?e.jsxs("div",{className:"flex items-center gap-1 px-2 mt-0.5",children:[e.jsxs("a",{href:`/api/editor-file?path=${encodeURIComponent(t)}`,target:"_blank",rel:"noopener noreferrer",title:"Open file",className:"flex items-center gap-1 text-gray-500 hover:text-gray-300 transition-colors min-w-0",children:[e.jsx("span",{className:"text-[9px] truncate",children:t}),e.jsx("svg",{className:"shrink-0",width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M4.5 1.5H2.5C1.95 1.5 1.5 1.95 1.5 2.5V9.5C1.5 10.05 1.95 10.5 2.5 10.5H9.5C10.05 10.5 10.5 10.05 10.5 9.5V7.5M7.5 1.5H10.5M10.5 1.5V4.5M10.5 1.5L5 7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e.jsx(Ee,{content:t,icon:!0,iconSize:10,className:"shrink-0 text-gray-500 hover:text-gray-300 transition-colors"})]}):null}function Kt({scenarios:t,projectRoot:s,activeScenarioId:a,onScenarioSelect:i,zoomComponent:h,onZoomChange:d,analyzedEntities:c=[],glossaryFunctions:x=[],activeAnalyzedScenarioId:u,onAnalyzedScenarioSelect:k,entityImports:S,pageFilePaths:N={}}){const{pageGroups:w,componentGroups:E}=n.useMemo(()=>{var m;const f=new Map,l=new Map;for(const p of t)if(p.componentName){const o=l.get(p.componentName)||[];o.push(p),l.set(p.componentName,o)}else if($e(p.url)){const o=(m=p.url)==null?void 0:m.match(/[?&]c=([^&]+)/),y=o?decodeURIComponent(o[1]):"Isolated",C=l.get(y)||[];C.push(p),l.set(y,C)}else{const o=Q(p.url),y=f.get(o)||[];y.push(p),f.set(o,y)}const j=new Map([...l.entries()].sort(([p],[o])=>p.localeCompare(o)));return{pageGroups:f,componentGroups:j}},[t]),v=n.useMemo(()=>{const f=new Set((c||[]).filter(j=>j.entityType==="visual").map(j=>j.name)),l=new Map;for(const[j,m]of E)f.has(j)||l.set(j,m);return l},[E,c]),{visualEntities:D,libraryEntities:O}=n.useMemo(()=>{const f=c.filter(j=>j.entityType==="visual").sort((j,m)=>j.name.localeCompare(m.name)),l=c.filter(j=>j.entityType==="library"||j.entityType==="functionCall").sort((j,m)=>j.name.localeCompare(m.name));return{visualEntities:f,libraryEntities:l}},[c]),R=n.useMemo(()=>{const f=new Set(O.map(l=>l.name));return x.filter(l=>!f.has(l.name)).sort((l,j)=>l.name.localeCompare(j.name))},[x,O]),z=c.some(f=>f.isAnalyzing),P=n.useRef(null),I=n.useRef(0),_=n.useCallback(()=>{P.current&&(I.current=P.current.scrollTop)},[]);if(n.useEffect(()=>{P.current&&I.current>0&&(P.current.scrollTop=I.current)}),t.length===0&&c.length===0&&R.length===0)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 px-8",children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"No scenarios yet"}),e.jsx("p",{className:"text-xs",children:"Scenarios will appear here as Claude creates them alongside your code. Each scenario represents a different state of your app's data."})]})});if(h){const f=E.get(h)||[],l=new Set((S==null?void 0:S[h])||[]),j=l.size>0,m=j?D.filter(o=>l.has(o.name)):[],p=j?O.filter(o=>l.has(o.name)):[];return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-3 space-y-1",children:[e.jsxs("button",{onClick:()=>d(void 0),className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-gray-400 hover:text-white transition-colors cursor-pointer",children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M7.5 9L4.5 6L7.5 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),"All scenarios"]}),e.jsx("div",{className:"px-3 py-1.5",children:e.jsx("span",{className:"text-xs font-semibold text-white uppercase tracking-wider",children:h})}),e.jsx("div",{className:"flex flex-wrap gap-2 px-2",children:f.length===0?e.jsx("div",{className:"px-3 py-2 text-xs text-gray-500",children:"No scenarios for this component"}):f.map(o=>e.jsx(ne,{imgSrc:o.screenshotPath?`/api/editor-scenario-image/${o.id}.png${o.updatedAt?`?v=${encodeURIComponent(o.updatedAt)}`:""}`:null,name:o.name,isActive:o.id===a,onSelect:()=>i(o)},o.id))}),m.length>0&&e.jsxs("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"})}),m.map(o=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"flex items-center gap-2 px-2 py-1",children:e.jsx("button",{onClick:()=>d(o.name),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:o.name})}),e.jsx(Y,{filePath:o.filePath,projectRoot:s}),(o.scenarios.length>0||o.pendingScenarios.length>0)&&e.jsx("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:o.scenarios.map(y=>e.jsx(ne,{imgSrc:y.screenshotPath?`/api/screenshot/${y.screenshotPath}`:null,name:y.name,isActive:y.id===u,onSelect:()=>k==null?void 0:k({analysisId:o.analysisId,scenarioId:y.id,scenarioName:y.name,entitySha:o.sha,entityName:o.name})},y.id))})]},o.sha))]}),p.length>0&&e.jsxs("div",{className:"pt-2 mt-1",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"})}),p.map(o=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-300",children:o.name})}),e.jsx(Y,{filePath:o.filePath,projectRoot:s}),o.testFile&&e.jsx(Ie,{testFile:o.testFile,entityName:o.name})]},o.sha))]})]})})}return e.jsx("div",{ref:P,onScroll:_,className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-3 space-y-3",children:[w.size>0&&e.jsxs("div",{children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Application"})}),[...w.entries()].sort(([f],[l])=>f==="Home"?-1:l==="Home"?1:f.localeCompare(l)).map(([f,l])=>e.jsxs("div",{className:"px-2 pt-1",children:[e.jsx("div",{className:"py-0.5",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-400",children:f})}),N[f]&&e.jsx(Y,{filePath:N[f],projectRoot:s}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:l.map(j=>e.jsx(ne,{imgSrc:j.screenshotPath?`/api/editor-scenario-image/${j.id}.png${j.updatedAt?`?v=${encodeURIComponent(j.updatedAt)}`:""}`:null,name:j.name,isActive:j.id===a&&!u,onSelect:()=>i(j)},j.id))})]},f))]}),v.size>0&&e.jsxs("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"})}),[...v.entries()].map(([f,l])=>{var j;return e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"flex items-center justify-between px-2 py-1",children:e.jsx("button",{onClick:()=>d(f),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:f})}),((j=l[0])==null?void 0:j.componentPath)&&e.jsx(Y,{filePath:l[0].componentPath,projectRoot:s}),e.jsx("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:l.map(m=>e.jsx(ne,{imgSrc:m.screenshotPath?`/api/editor-scenario-image/${m.id}.png${m.updatedAt?`?v=${encodeURIComponent(m.updatedAt)}`:""}`:null,name:m.name,isActive:m.id===a&&!u,onSelect:()=>i(m)},m.id))})]},f)})]}),D.length>0&&e.jsxs("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:[e.jsxs("div",{className:"px-2 py-1",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),z&&t.length===0&&c.every(f=>f.scenarioCount===0)&&e.jsx("span",{className:"ml-2 text-[10px] text-gray-500",children:"— Entities are being analyzed..."})]}),D.map(f=>e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[e.jsx("button",{onClick:()=>d(f.name),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:f.name}),f.isAnalyzing&&f.scenarioCount===0&&e.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] text-gray-400",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#005c75] animate-pulse"}),"Analyzing..."]})]}),e.jsx(Y,{filePath:f.filePath,projectRoot:s}),(f.scenarios.length>0||f.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:[f.scenarios.map(l=>e.jsx(ne,{imgSrc:l.screenshotPath?`/api/screenshot/${l.screenshotPath}`:null,name:l.name,isActive:l.id===u,onSelect:()=>k==null?void 0:k({analysisId:f.analysisId,scenarioId:l.id,scenarioName:l.name,entitySha:f.sha,entityName:f.name})},l.id)),f.pendingScenarios.map(l=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:l,children:l},l))]})]},f.sha))]}),(O.length>0||R.length>0)&&e.jsxs("div",{className:`pt-2 mt-1 ${D.length>0?"":"border-t border-[#3d3d3d]"}`,children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"})}),O.map(f=>e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"px-2 py-1",children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-300",children:f.name}),f.isAnalyzing&&f.scenarioCount===0&&e.jsxs("span",{className:"ml-2 inline-flex items-center gap-1.5 text-[10px] text-gray-400",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#005c75] animate-pulse"}),"Analyzing..."]})]}),e.jsx(Y,{filePath:f.filePath,projectRoot:s}),f.testFile?e.jsx(Ie,{testFile:f.testFile,entityName:f.name}):e.jsx("div",{className:"px-2 pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-500",children:"No test file"})})]},f.sha)),R.map(f=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-300",children:f.name})}),e.jsx(Y,{filePath:f.filePath,projectRoot:s}),e.jsx(Ie,{testFile:f.testFile,entityName:f.name})]},f.name))]})]})})}function Xt(t,s,a=new Date){const i={"1d":1,"3d":3,"7d":7,"30d":30}[s],h=new Date(a);h.setDate(h.getDate()-i);const d=h.toISOString().split("T")[0],c=t.filter(N=>N.date>=d),x=new Set(c.map(N=>N.commitSha).filter(Boolean)),u=new Map;for(const N of c)if(N.scenarioScreenshots)for(const w of N.scenarioScreenshots){u.has(w.name)||u.set(w.name,[]);const E=u.get(w.name);E.some(v=>v.path===w.path)||E.push({path:w.path,time:N.time})}for(const N of u.values())N.sort((w,E)=>w.time.localeCompare(E.time));const k=[],S=new Map;for(const[N,w]of u){const E=N.indexOf(" - ");if(E!==-1){const v=N.slice(0,E);S.has(v)||S.set(v,[]),S.get(v).push({name:N,screenshots:w})}else k.push({name:N,screenshots:w})}return{commitCount:x.size,entryCount:c.length,appScenarios:k,componentGroups:S,totalScenarios:u.size}}function Qt(t){const s=new Map;for(const a of[...t].reverse()){const i=s.get(a.date)||[];i.push(a),s.set(a.date,i)}return s}function Zt(t){const s=new Map;for(const a of t){let i;if("componentName"in a&&a.componentName)i=a.componentName;else if("componentName"in a&&a.componentName===null)i="App";else{const d=a.name.indexOf(" - ");i=d!==-1?a.name.slice(0,d):"App"}const h=s.get(i)||[];h.push(a),s.set(i,h)}return[...s.entries()].sort(([a],[i])=>a==="App"?-1:i==="App"?1:a.localeCompare(i))}const Xe=120;function ot({text:t,theme:s}){const[a,i]=n.useState(!1),h=t.length>Xe,d=h&&!a?t.slice(0,Xe)+"…":t,c=s==="light";return e.jsxs("div",{className:`px-4 py-2 ${c?"border-b border-gray-200 bg-gray-50":"border-b border-[#3d3d3d] bg-[#252525]"}`,children:[e.jsx("span",{className:"text-[9px] font-semibold uppercase tracking-wider text-gray-500",children:"User Prompt"}),e.jsxs("p",{className:`text-[11px] mt-0.5 mb-0 leading-relaxed ${c?"text-gray-600":"text-gray-400"}`,children:[d,h&&e.jsx("button",{onClick:()=>i(!a),className:`ml-1 text-[11px] font-medium bg-transparent border-none p-0 cursor-pointer ${c?"text-blue-500 hover:text-blue-700":"text-[#00a0c4] hover:text-[#00c0e8]"}`,children:a?"Show less":"Read more…"})]})]})}function Qe({status:t}){const s={new:{label:"New",bg:"bg-green-900/40",text:"text-green-400",border:"border-green-700/50"},edited:{label:"Edited",bg:"bg-blue-900/40",text:"text-blue-400",border:"border-blue-700/50"},impacted:{label:"Impacted",bg:"bg-amber-900/40",text:"text-amber-400",border:"border-amber-700/50"}}[t.status];return e.jsx("span",{className:`${s.bg} ${s.text} ${s.border} border text-[8px] font-bold px-1 py-0 rounded-full uppercase tracking-wider`,children:s.label})}function es({testFile:t,entityName:s}){const{results:a,isRunning:i,runTests:h}=Re(t);if(i&&!a)return e.jsxs("div",{className:"pt-1 flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#00a0c4] animate-pulse"}),e.jsx("span",{className:"text-[10px] text-gray-500",children:"Running tests..."})]});if(!a)return null;if(a.status==="error")return e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-red-400",children:a.errorMessage})});const d=s?a.testCases.filter(u=>u.fullName.startsWith(s)):a.testCases,c=d.length>0?d:a.testCases;if(c.length===0)return null;const x=s?`${s} > `:"";return e.jsxs("div",{className:"pt-1 space-y-0.5",children:[c.map(u=>{var S;const k=x&&u.fullName.startsWith(x)?u.fullName.slice(x.length):u.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[u.status==="passed"?e.jsx("span",{className:"text-green-400 text-[10px]",children:"✓"}):u.status==="failed"?e.jsx("span",{className:"text-red-400 text-[10px]",children:"✗"}):e.jsx("span",{className:"text-gray-500 text-[10px]",children:"—"}),e.jsx("span",{className:`text-[10px] ${u.status==="passed"?"text-green-400":u.status==="failed"?"text-red-400":"text-gray-500"}`,children:k})]}),u.status==="failed"&&((S=u.failureMessages)==null?void 0:S.map((N,w)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-400/70 truncate max-w-full",title:N,children:N.split(`
|
|
4
|
-
`)[0]},w)))]},u.fullName)}),e.jsx("button",{onClick:h,disabled:i,className:"mt-1 text-[10px] text-[#00a0c4] hover:text-[#38bdf8] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:i?"Running...":"Re-run"})]})}const ts={added:"text-green-400",untracked:"text-green-400",modified:"text-blue-400",renamed:"text-purple-400"};function ss({files:t}){return e.jsxs("div",{className:"border-t border-[#3d3d3d] pt-2 mt-1",children:[e.jsxs("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:["Modified Files (",t.length,")"]}),e.jsx("div",{className:"mt-1 space-y-0.5 max-h-[150px] overflow-auto",children:t.map(s=>e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`text-[9px] font-bold uppercase w-[14px] text-center ${ts[s.status]||"text-gray-500"}`,children:s.status==="added"||s.status==="untracked"?"A":s.status==="modified"?"M":s.status==="renamed"?"R":"?"}),e.jsx("span",{className:"text-[10px] text-gray-400 truncate font-mono",children:s.path})]},s.path))})]})}const as={feature:{label:"Feature",color:"bg-[#005c75]"},fix:{label:"Fix",color:"bg-amber-700"},refactor:{label:"Refactor",color:"bg-purple-700"},scaffold:{label:"Scaffold",color:"bg-green-700"},data:{label:"Data",color:"bg-blue-700"},milestone:{label:"Milestone",color:"bg-yellow-600"}};function ns(t){try{return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}function rs(t){try{return new Date(t+"T00:00:00").toLocaleDateString([],{weekday:"long",month:"long",day:"numeric"})}catch{return t}}const is=[{value:"1d",label:"1 Day"},{value:"3d",label:"3 Days"},{value:"7d",label:"1 Week"},{value:"30d",label:"1 Month"}];function ls({entries:t,onScreenshotClick:s}){const[a,i]=n.useState(!1),[h,d]=n.useState("7d"),c=n.useMemo(()=>Xt(t,h),[t,h]);return e.jsxs("div",{className:"bg-[#2d2d2d] rounded-lg overflow-hidden",children:[e.jsxs("button",{onClick:()=>i(!a),className:"w-full flex items-center justify-between px-3 py-2.5 cursor-pointer bg-transparent border-none text-left hover:bg-[#333] transition-colors",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wider",children:"Timeframe Summary"}),e.jsx("span",{className:`text-gray-500 text-[10px] transition-transform ${a?"rotate-180":""}`,children:"▼"})]}),a&&e.jsxs("div",{className:"px-3 pb-3 space-y-3 border-t border-[#3d3d3d]",children:[e.jsx("div",{className:"flex gap-1 pt-2.5",children:is.map(x=>e.jsx("button",{onClick:()=>d(x.value),className:`px-2.5 py-1 text-[10px] font-medium rounded transition-colors cursor-pointer border ${h===x.value?"bg-[#005c75] text-white border-[#005c75]":"bg-transparent text-gray-400 border-[#4d4d4d] hover:text-white hover:border-[#005c75]"}`,children:x.label},x.value))}),e.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-gray-400",children:[e.jsxs("span",{children:[e.jsx("span",{className:"text-white font-medium",children:c.commitCount})," ",c.commitCount===1?"commit":"commits"]}),e.jsx("span",{className:"text-[#3d3d3d]",children:"|"}),e.jsxs("span",{children:[e.jsx("span",{className:"text-white font-medium",children:c.totalScenarios})," ",c.totalScenarios===1?"scenario changed":"scenarios changed"]}),e.jsx("span",{className:"text-[#3d3d3d]",children:"|"}),e.jsxs("span",{children:[e.jsx("span",{className:"text-white font-medium",children:c.entryCount})," ",c.entryCount===1?"entry":"entries"]})]}),c.totalScenarios===0?e.jsx("p",{className:"text-[11px] text-gray-500 italic m-0",children:"No scenario changes in this period."}):e.jsxs("div",{className:"space-y-3",children:[c.appScenarios.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Application"}),c.appScenarios.map(x=>e.jsx(Ze,{scenario:x,onScreenshotClick:s},x.name))]}),c.componentGroups.size>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),[...c.componentGroups.entries()].sort(([x],[u])=>x.localeCompare(u)).map(([x,u])=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("span",{className:"text-[10px] font-medium text-gray-400",children:x}),u.map(k=>e.jsx(Ze,{scenario:k,onScreenshotClick:s},k.name))]},x))]})]})]})]})}function Ze({scenario:t,onScreenshotClick:s}){const a=t.name.indexOf(" - "),i=a!==-1?t.name.slice(a+3):t.name;return e.jsxs("div",{className:"pl-2",children:[e.jsx("span",{className:"text-[10px] text-gray-500 block mb-1",children:i}),e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto",children:t.screenshots.map((h,d)=>e.jsxs("div",{className:"flex items-center shrink-0",children:[d>0&&e.jsx("span",{className:"text-[8px] text-gray-600 mx-0.5",children:"→"}),e.jsx("button",{type:"button",className:"w-16 h-16 rounded overflow-hidden border border-[#3d3d3d] hover:border-[#00a0c4] bg-[#1e1e1e] shrink-0 flex items-center justify-center cursor-pointer transition-colors",title:`${t.name} (${new Date(h.time).toLocaleDateString()})`,onClick:()=>s==null?void 0:s({screenshotUrl:`/api/editor-journal-image/${h.path.replace("screenshots/","")}`,commitSha:null,commitMessage:null,scenarioName:t.name}),children:e.jsx("img",{src:`/api/editor-journal-image/${h.path.replace("screenshots/","")}`,alt:t.name,className:"max-w-full max-h-full object-contain",loading:"lazy"})})]},h.path))})]})}function os({isActive:t,onScreenshotClick:s,glossaryFunctions:a=[]}){const[i,h]=n.useState([]),[d,c]=n.useState(!0),[x,u]=n.useState(new Set),k=n.useCallback(w=>{u(E=>{const v=new Set(E);return v.has(w)?v.delete(w):v.add(w),v})},[]),S=n.useCallback(async()=>{try{const w=await fetch("/api/editor-journal");if(w.ok){const E=await w.json();h(E.entries||[])}}catch{}finally{c(!1)}},[]);if(n.useEffect(()=>{S()},[S]),n.useEffect(()=>{t&&S()},[t,S]),n.useEffect(()=>{if(!t)return;const w=setInterval(()=>void S(),5e3);return()=>clearInterval(w)},[t,S]),d)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx("span",{className:"text-gray-500 text-sm",children:"Loading journal..."})});if(i.length===0)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 px-8",children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"No journal entries yet"}),e.jsx("p",{className:"text-xs",children:"Journal entries will appear as you build. Claude records features, screenshots, and commits as the project evolves."})]})});const N=Qt(i);return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-3 space-y-4",children:[e.jsx(ls,{entries:i,onScreenshotClick:s}),[...N.entries()].map(([w,E])=>e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-1.5 sticky top-0 bg-[#1e1e1e] z-10",children:e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:rs(w)})}),e.jsx("div",{className:"space-y-2",children:E.map((v,D)=>{const O=as[v.type]||{label:v.type,color:"bg-gray-600"},R=`${v.time}-${D}`,z=x.has(R);return e.jsxs("div",{className:"bg-[#2d2d2d] rounded-lg overflow-hidden",children:[e.jsxs("div",{className:`p-3 space-y-2 ${z?"":"max-h-[300px] overflow-y-auto"}`,children:[e.jsx("div",{className:"flex items-start gap-2 cursor-pointer",onClick:()=>k(R),children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-white truncate",children:v.title}),e.jsx("span",{className:`${O.color} text-white text-[9px] font-bold px-1.5 py-0.5 rounded uppercase tracking-wider shrink-0`,children:O.label})]}),e.jsx("span",{className:"text-[10px] text-gray-500",children:ns(v.time)}),v.featureName&&e.jsx("span",{className:"text-[10px] text-gray-500 italic truncate",title:v.featureName,children:v.featureName})]})}),v.userPrompt&&e.jsx(ot,{text:v.userPrompt,theme:"dark"}),e.jsx("p",{className:"text-xs text-gray-400 leading-relaxed",children:v.description}),v.screenshot&&e.jsx("button",{type:"button",className:"rounded overflow-hidden border border-[#3d3d3d] hover:border-[#00a0c4] bg-[#1e1e1e] flex items-center justify-center p-1 cursor-pointer transition-colors w-full",onClick:()=>s==null?void 0:s({screenshotUrl:`/api/editor-journal-image/${v.screenshot.replace("screenshots/","")}`,commitSha:v.commitSha,commitMessage:v.commitMessage,scenarioName:v.title}),children:e.jsx("img",{src:`/api/editor-journal-image/${v.screenshot.replace("screenshots/","")}`,alt:v.title,className:"max-w-full max-h-full object-contain",loading:"lazy"})}),v.scenarioScreenshots&&v.scenarioScreenshots.length>0&&(()=>{const P=Zt(v.scenarioScreenshots),I=v.entityChangeStatus,_=P.filter(([p])=>p==="App").flatMap(([,p])=>p),f=P.filter(([p])=>p!=="App"),l=new Map;for(const p of _){const o=Q(p.url??null),y=l.get(o)||[];y.push(p),l.set(o,y)}const j=[...l.entries()],m=p=>e.jsx("button",{type:"button",className:"w-[4.5rem] h-[4.5rem] rounded overflow-hidden border border-[#3d3d3d] hover:border-[#00a0c4] bg-[#1e1e1e] shrink-0 flex items-center justify-center cursor-pointer transition-colors",onClick:()=>s==null?void 0:s({screenshotUrl:`/api/editor-journal-image/${p.path.replace("screenshots/","")}`,commitSha:v.commitSha,commitMessage:v.commitMessage,scenarioName:p.name}),children:e.jsx("img",{src:`/api/editor-journal-image/${p.path.replace("screenshots/","")}`,alt:p.name,title:p.name,className:"max-w-full max-h-full object-contain",loading:"lazy"})},p.path);return e.jsxs("div",{className:"space-y-2",children:[j.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Application"}),j.map(([p,o])=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] font-medium text-gray-400",children:p}),(I==null?void 0:I[p])&&e.jsx(Qe,{status:I[p]})]}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-0.5",children:o.map(m)})]},p))]}),f.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),f.map(([p,o])=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] font-medium text-gray-400",children:p}),(I==null?void 0:I[p])&&e.jsx(Qe,{status:I[p]})]}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-0.5",children:o.map(m)})]},p))]})]})})(),a.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"}),e.jsx("div",{className:"space-y-2",children:a.map(P=>e.jsxs("div",{children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-200",children:P.name}),e.jsx("span",{className:"text-[9px] text-gray-500 truncate block",children:P.filePath}),P.testFile?e.jsx(es,{testFile:P.testFile,entityName:P.name}):e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-500",children:"No test file"})})]},P.name))})]}),v.commitSha&&e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[e.jsx("span",{className:"font-mono text-[#00a0c4] bg-[#00a0c4]/10 px-1.5 py-0.5 rounded",children:v.commitSha.slice(0,7)}),e.jsx("span",{className:"text-gray-500 truncate",children:v.commitMessage})]}),z&&v.modifiedFiles&&v.modifiedFiles.length>0&&e.jsx(ss,{files:v.modifiedFiles})]}),e.jsxs("button",{onClick:()=>k(R),className:"w-full py-1.5 text-[10px] text-gray-500 hover:text-gray-300 border-t border-[#3d3d3d] transition-colors cursor-pointer",children:["——— ",z?"Collapse":"Expand"," ———"]})]},R)})})]},w))]})})}const et=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-gray-500 shrink-0",children:e.jsx("path",{d:"M4.5 3L7.5 6L4.5 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});function cs(t,s){if(t.length<=s)return t;const a=s-2;return[t[0],"ellipsis",...t.slice(t.length-a)]}function ds({items:t,onNavigate:s}){if(t.length===0)return null;const a=cs(t,4);return e.jsx("nav",{className:"flex items-center gap-1 text-xs min-w-0",children:a.map((i,h)=>{if(i==="ellipsis")return e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(et,{}),e.jsx("span",{className:"text-gray-500",children:"..."})]},"ellipsis");const d=h===a.length-1;return e.jsxs("span",{className:"flex items-center gap-1 min-w-0",children:[h>0&&e.jsx(et,{}),d?e.jsx("span",{className:"text-white font-medium truncate",children:i.name}):e.jsx("button",{onClick:()=>s(i.componentName),className:"text-gray-400 hover:text-white transition-colors cursor-pointer bg-transparent border-none p-0 truncate",children:i.name})]},i.componentName||"app")})})}function re({imgSrc:t,name:s,isActive:a,onSelect:i}){return e.jsxs("button",{onClick:i,className:"flex flex-col items-center gap-1 cursor-pointer group w-full",title:s,children:[e.jsx("div",{className:`w-full aspect-square rounded overflow-hidden border-2 transition-all bg-[#1a1a1a] ${a?"border-[#005c75] ring-1 ring-[#005c75]":"border-transparent hover:border-[#4d4d4d]"}`,children:t?e.jsx("img",{src:t,alt:s,className:"w-full h-full object-contain",loading:"lazy"}):e.jsx("div",{className:"w-full h-full bg-[#1a1a1a] flex items-center justify-center",children:e.jsx("span",{className:"text-[8px] text-gray-600",children:"No img"})})}),e.jsx("span",{className:`text-[10px] leading-tight text-center truncate w-full ${a?"text-white":"text-gray-500 group-hover:text-gray-300"}`,children:s})]})}function de({filePath:t}){return t?e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsxs("a",{href:`/api/editor-file?path=${encodeURIComponent(t)}`,target:"_blank",rel:"noopener noreferrer",title:"Open file",className:"flex items-center gap-1 text-gray-500 hover:text-gray-300 transition-colors min-w-0",children:[e.jsx("span",{className:"text-[9px] truncate",children:t}),e.jsx("svg",{className:"shrink-0",width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M4.5 1.5H2.5C1.95 1.5 1.5 1.95 1.5 2.5V9.5C1.5 10.05 1.95 10.5 2.5 10.5H9.5C10.05 10.5 10.5 10.05 10.5 9.5V7.5M7.5 1.5H10.5M10.5 1.5V4.5M10.5 1.5L5 7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e.jsx(Ee,{content:t,icon:!0,iconSize:10,className:"shrink-0 text-gray-500 hover:text-gray-300 transition-colors"})]}):null}function xs({hasProject:t,scenarios:s,analyzedEntities:a,glossaryFunctions:i=[],glossaryEntries:h=[],projectRoot:d,activeScenarioId:c,onScenarioSelect:x,onAnalyzedScenarioSelect:u,onSwitchToBuild:k,zoomComponent:S,onZoomChange:N,entityImports:w,pageFilePaths:E={},projectTitle:v,projectDescription:D,breadcrumbItems:O=[]}){const{pageGroups:R,componentGroups:z}=n.useMemo(()=>{var y;const m=new Map,p=new Map;for(const C of s)if(C.componentName){const A=p.get(C.componentName)||[];A.push(C),p.set(C.componentName,A)}else if($e(C.url)){const A=(y=C.url)==null?void 0:y.match(/[?&]c=([^&]+)/),F=A?decodeURIComponent(A[1]):"Isolated",H=p.get(F)||[];H.push(C),p.set(F,H)}else{const A=Q(C.url),F=m.get(A)||[];F.push(C),m.set(A,F)}const o=new Map([...p.entries()].sort(([C],[A])=>C.localeCompare(A)));return{pageGroups:m,componentGroups:o}},[s]),P=n.useMemo(()=>a.filter(m=>m.entityType==="visual").sort((m,p)=>m.name.localeCompare(p.name)),[a]),I=n.useMemo(()=>{const m=new Map;for(const p of i)m.set(p.name,p);return m},[i]),_=n.useRef(null),f=n.useRef(0),l=n.useCallback(()=>{_.current&&(f.current=_.current.scrollTop)},[]);if(n.useEffect(()=>{_.current&&f.current>0&&(_.current.scrollTop=f.current)}),!t)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsx("h2",{className:"text-lg font-medium text-white font-['IBM_Plex_Sans'] m-0",children:"Ready to build something?"}),e.jsx("button",{onClick:k,className:"px-6 py-3 bg-[#005c75] text-white text-sm font-medium rounded-lg hover:bg-[#004d63] transition-colors cursor-pointer",children:"Start Building"})]})});if(!(s.length>0||P.length>0))return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-4 px-8 text-center",children:[v?e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"text-lg font-medium text-white font-['IBM_Plex_Sans'] m-0",children:v}),D&&e.jsx("p",{className:"text-sm text-gray-400 m-0 font-['IBM_Plex_Sans'] leading-relaxed",children:D})]}):e.jsx("h2",{className:"text-lg font-medium text-white font-['IBM_Plex_Sans'] m-0",children:"Your project is ready"}),e.jsx("p",{className:"text-sm text-gray-400 m-0 font-['IBM_Plex_Sans'] leading-relaxed",children:"Describe what you want to build in the Chat and your pages and components will appear here."}),e.jsx("button",{onClick:k,className:"px-6 py-3 bg-[#005c75] text-white text-sm font-medium rounded-lg hover:bg-[#004d63] transition-colors cursor-pointer",children:"Start Building"})]})});if(S){const m=R.get(S)||[],p=z.get(S)||[],o=P.find(g=>g.name===S),y=I.get(S),C=[...m,...p],A=new Set((w==null?void 0:w[S])||[]),F=A.size>0,H=F?[...z.entries()].filter(([g])=>A.has(g)):[],Z=F?P.filter(g=>A.has(g.name)&&!H.some(([T])=>T===g.name)):[],q=F?h.filter(g=>A.has(g.name)&&g.returnType!=="JSX.Element"&&g.returnType!=="React.ReactNode").map(g=>({name:g.name,filePath:g.filePath,description:g.description||"",testFile:g.testFile,feature:g.feature})):[],ie=H.length>0||Z.length>0,le=q.length>0,me=ie||le;return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsx(ds,{items:O,onNavigate:N}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-semibold text-white m-0 font-['IBM_Plex_Sans'] uppercase tracking-wider",children:S}),(()=>{const g=(y==null?void 0:y.filePath)||(o==null?void 0:o.filePath)||E[S];return g?e.jsx(de,{filePath:g,projectRoot:d}):null})()]}),C.length>0&&e.jsx("div",{className:"grid grid-cols-3 gap-2",children:C.map(g=>e.jsx(re,{imgSrc:g.screenshotPath?`/api/editor-scenario-image/${g.id}.png${g.updatedAt?`?v=${encodeURIComponent(g.updatedAt)}`:""}`:null,name:g.name,isActive:g.id===c,onSelect:()=>x(g)},g.id))}),o&&(o.scenarios.length>0||o.pendingScenarios.length>0)&&e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[o.scenarios.map(g=>e.jsx(re,{imgSrc:g.screenshotPath?`/api/screenshot/${g.screenshotPath}`:null,name:g.name,isActive:!1,onSelect:()=>u({analysisId:o.analysisId,scenarioId:g.id,scenarioName:g.name,entitySha:o.sha,entityName:o.name})},g.id)),o.pendingScenarios.map(g=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:g,children:g},g))]}),y&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] text-gray-500",children:"Tests:"}),e.jsx(de,{filePath:y.testFile,projectRoot:d})]}),C.length===0&&!o&&!y&&e.jsx("div",{className:"text-xs text-gray-500",children:"No scenarios for this entity"}),me&&e.jsxs("div",{className:"pt-3 mt-2 border-t border-[#3d3d3d] space-y-3",children:[ie&&e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),H.map(([g,T])=>e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>N(g),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:g})}),T.length>0&&e.jsx("div",{className:"grid grid-cols-3 gap-2 pt-1",children:T.map(L=>e.jsx(re,{imgSrc:L.screenshotPath?`/api/editor-scenario-image/${L.id}.png${L.updatedAt?`?v=${encodeURIComponent(L.updatedAt)}`:""}`:null,name:L.name,isActive:L.id===c,onSelect:()=>x(L)},L.id))})]},g)),Z.map(g=>e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>N(g.name),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:g.name})}),(g.scenarios.length>0||g.pendingScenarios.length>0)&&e.jsxs("div",{className:"grid grid-cols-3 gap-2 pt-1",children:[g.scenarios.map(T=>e.jsx(re,{imgSrc:T.screenshotPath?`/api/screenshot/${T.screenshotPath}`:null,name:T.name,isActive:!1,onSelect:()=>u({analysisId:g.analysisId,scenarioId:T.id,scenarioName:T.name,entitySha:g.sha,entityName:g.name})},T.id)),g.pendingScenarios.map(T=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:T,children:T},T))]})]},g.sha))]}),le&&e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"}),q.map(g=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>N(g.name),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:g.name})}),e.jsx(de,{filePath:g.filePath,projectRoot:d}),g.testFile&&e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsx("span",{className:"text-[9px] text-gray-600",children:"test:"}),e.jsx("span",{className:"text-[9px] text-gray-500 truncate",children:g.testFile})]})]},g.name))]})]})]})})}return e.jsx("div",{ref:_,onScroll:l,className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-4 space-y-4",children:[v&&e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-white m-0 font-['IBM_Plex_Sans']",children:v}),D&&e.jsx("p",{className:"text-xs text-gray-400 m-0 mt-1 font-['IBM_Plex_Sans'] leading-relaxed",children:D})]}),R.size>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Application"}),e.jsx("button",{onClick:k,className:"px-2.5 py-1 text-[10px] font-medium text-gray-400 bg-[#2a2a2a] border border-[#4d4d4d] rounded hover:bg-[#333] hover:text-white hover:border-[#005c75] transition-colors cursor-pointer",children:"+ New Page"})]}),e.jsxs("p",{className:"text-[11px] text-gray-500 m-0 mt-1.5 font-['IBM_Plex_Sans'] leading-relaxed",children:["Select a page scenario below and switch to"," ",e.jsx("button",{onClick:k,className:"text-[#00a0c4] hover:text-[#00c4eb] bg-transparent border-none p-0 cursor-pointer underline font-inherit text-inherit",children:"Build"})," ","to change or enhance an existing page or"," ",e.jsx("button",{onClick:k,className:"text-[#00a0c4] hover:text-[#00c4eb] bg-transparent border-none p-0 cursor-pointer underline font-inherit text-inherit",children:"create a new page"})]}),[...R.entries()].sort(([m],[p])=>m==="Home"?-1:p==="Home"?1:m.localeCompare(p)).map(([m,p])=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>N(m),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:m})}),E[m]&&e.jsx(de,{filePath:E[m],projectRoot:d}),e.jsx("div",{className:"grid grid-cols-3 gap-2 pt-1",children:p.map(o=>e.jsx(re,{imgSrc:o.screenshotPath?`/api/editor-scenario-image/${o.id}.png${o.updatedAt?`?v=${encodeURIComponent(o.updatedAt)}`:""}`:null,name:o.name,isActive:o.id===c,onSelect:()=>x(o)},o.id))})]},m))]})]})})}const tt={new:0,edited:1,impacted:2};function st({status:t,onClick:s}){const a={new:{label:"New",bg:"bg-green-100",text:"text-green-700",border:"border-green-200"},edited:{label:"Edited",bg:"bg-blue-100",text:"text-blue-700",border:"border-blue-200"},impacted:{label:"Impacted",bg:"bg-amber-100",text:"text-amber-700",border:"border-amber-200"}}[t.status],i=s&&(t.status==="edited"||t.status==="impacted");return e.jsx("button",{onClick:i?s:void 0,className:`${a.bg} ${a.text} ${a.border} border text-[9px] font-bold px-1.5 py-0.5 rounded-full uppercase tracking-wider shrink-0 ${i?"cursor-pointer hover:opacity-80 transition-opacity":"cursor-default"}`,children:a.label})}function at({filePath:t}){const[s,a]=n.useState(null),[i,h]=n.useState(!0),[d,c]=n.useState(null);return n.useEffect(()=>{Gt(()=>import("./index-yHOVb4rc.js"),__vite__mapDeps([0,1])).then(x=>{c(()=>x.default)})},[]),n.useEffect(()=>{h(!0),fetch(`/api/editor-file-diff?path=${encodeURIComponent(t)}`).then(x=>x.json()).then(x=>{a({oldContent:x.oldContent,newContent:x.newContent})}).catch(()=>{a(null)}).finally(()=>h(!1))},[t]),i?e.jsx("div",{className:"p-2 text-[10px] text-gray-400",children:"Loading diff..."}):!s||!d?e.jsx("div",{className:"p-2 text-[10px] text-gray-400",children:"Could not load diff"}):e.jsx("div",{className:"mt-2 border border-gray-200 rounded-lg overflow-hidden max-h-[300px] overflow-auto text-xs",children:e.jsx(d,{oldValue:s.oldContent,newValue:s.newContent,splitView:!1,useDarkTheme:!1,showDiffOnly:!0,styles:{contentText:{fontSize:"11px",lineHeight:"1.4"},line:{padding:"1px 8px",fontSize:"11px"}}})})}function nt({impactedBy:t,changedEntities:s}){return e.jsx("div",{className:"mt-2 bg-amber-50 border border-amber-200 rounded-lg p-2.5",children:t&&t.length>0?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[10px] font-semibold text-amber-700 uppercase tracking-wider",children:"Re-captured because these dependencies changed"}),e.jsx("ul",{className:"mt-1.5 space-y-1",children:t.map(a=>e.jsxs("li",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`text-[9px] font-bold px-1 py-0 rounded-full uppercase tracking-wider border ${a.changeType==="new"?"bg-green-100 text-green-700 border-green-200":"bg-blue-100 text-blue-700 border-blue-200"}`,children:a.changeType==="new"?"New":"Edited"}),e.jsx("span",{className:"text-[11px] font-medium text-amber-800",children:a.name}),e.jsx("span",{className:"text-[9px] text-amber-500 truncate",children:a.filePath})]},a.filePath))})]}):s&&s.length>0?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[10px] font-semibold text-amber-700 uppercase tracking-wider",children:"Unchanged — these entities were modified in this session"}),e.jsx("ul",{className:"mt-1.5 space-y-1",children:s.map(a=>e.jsxs("li",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`text-[9px] font-bold px-1 py-0 rounded-full uppercase tracking-wider border ${a.status==="new"?"bg-green-100 text-green-700 border-green-200":"bg-blue-100 text-blue-700 border-blue-200"}`,children:a.status==="new"?"New":"Edited"}),e.jsx("span",{className:"text-[11px] font-medium text-amber-800",children:a.name})]},a.name))})]}):e.jsx("span",{className:"text-[10px] text-amber-600",children:"This component was re-captured because a dependency changed"})})}function rt({scenarioId:t,name:s,isActive:a,onSelect:i,updatedAt:h}){const[d,c]=n.useState(!1);n.useEffect(()=>{c(!1)},[t]);const x=`/api/editor-scenario-image/${t}.png${h?`?v=${encodeURIComponent(h)}`:""}`;return e.jsxs("button",{onClick:i,className:"flex flex-col items-center gap-1.5 cursor-pointer group",title:s,children:[e.jsx("div",{className:`w-32 h-32 rounded-lg overflow-hidden border-2 transition-all ${a?"border-[#0ea5e9] ring-2 ring-[#0ea5e9]/40 shadow-lg shadow-[#0ea5e9]/20":"border-gray-200 hover:border-gray-400 shadow-sm"}`,children:d?e.jsx("div",{className:"w-full h-full bg-gray-100 flex items-center justify-center",children:e.jsx("span",{className:"text-[9px] text-gray-400",children:"No preview"})}):e.jsx("img",{src:x,alt:s,className:"w-full h-full object-contain bg-white",loading:"lazy",onError:()=>c(!0)})}),e.jsx("span",{className:`text-[11px] leading-tight text-center truncate w-32 font-medium ${a?"text-gray-900":"text-gray-600 group-hover:text-gray-900"}`,children:s})]})}function ms({filePath:t}){return t?e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsxs("a",{href:`/api/editor-file?path=${encodeURIComponent(t)}`,target:"_blank",rel:"noopener noreferrer",title:"Open file",className:"flex items-center gap-1 text-gray-400 hover:text-gray-600 transition-colors min-w-0",children:[e.jsx("span",{className:"text-[9px] truncate",children:t}),e.jsx("svg",{className:"shrink-0",width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M4.5 1.5H2.5C1.95 1.5 1.5 1.95 1.5 2.5V9.5C1.5 10.05 1.95 10.5 2.5 10.5H9.5C10.05 10.5 10.5 10.05 10.5 9.5V7.5M7.5 1.5H10.5M10.5 1.5V4.5M10.5 1.5L5 7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e.jsx(Ee,{content:t,icon:!0,iconSize:10,className:"shrink-0 text-gray-400 hover:text-gray-600 transition-colors"})]}):null}function ps({testFile:t,entityName:s}){const{results:a,isRunning:i,runTests:h}=Re(t);if(i&&!a)return e.jsxs("div",{className:"pt-1 flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#0ea5e9] animate-pulse"}),e.jsx("span",{className:"text-[10px] text-gray-400",children:"Running tests..."})]});if(!a)return null;if(a.status==="error")return e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-red-500",children:a.errorMessage})});const d=s?a.testCases.filter(u=>u.fullName.startsWith(s)):a.testCases,c=d.length>0?d:a.testCases;if(c.length===0)return null;const x=s?`${s} > `:"";return e.jsxs("div",{className:"pt-1 space-y-0.5",children:[c.map(u=>{var S;const k=x&&u.fullName.startsWith(x)?u.fullName.slice(x.length):u.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[u.status==="passed"?e.jsx("span",{className:"text-green-600 text-[10px]",children:"✓"}):u.status==="failed"?e.jsx("span",{className:"text-red-500 text-[10px]",children:"✗"}):e.jsx("span",{className:"text-gray-400 text-[10px]",children:"—"}),e.jsx("span",{className:`text-[10px] ${u.status==="passed"?"text-green-600":u.status==="failed"?"text-red-500":"text-gray-400"}`,children:k})]}),u.status==="failed"&&((S=u.failureMessages)==null?void 0:S.map((N,w)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-400 truncate max-w-full",title:N,children:N.split(`
|
|
5
|
-
`)[0]},w)))]},u.fullName)}),e.jsx("button",{onClick:h,disabled:i,className:"mt-1 text-[10px] text-[#0ea5e9] hover:text-[#38bdf8] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:i?"Running...":"Re-run"})]})}function it(t){const s=t.indexOf(" - ");return s!==-1?t.slice(s+3):t}function lt(t,s){return!s||Object.keys(s).length===0?t:[...t].sort(([a],[i])=>{var x,u;const h=((x=s[a])==null?void 0:x.status)||"impacted",d=((u=s[i])==null?void 0:u.status)||"impacted",c=(tt[h]??2)-(tt[d]??2);return c!==0?c:a.localeCompare(i)})}function us({scenarios:t,allScenarios:s=[],glossaryFunctions:a=[],projectRoot:i,activeScenarioId:h,onScenarioSelect:d,onClose:c,entityChangeStatus:x={},modifiedFiles:u=[],featureName:k,userPrompt:S}){const N=n.useMemo(()=>{if(s.length===0||Object.keys(x).length===0)return t;const l=new Set(t.map(m=>m.id)),j=s.filter(m=>{var o;if(l.has(m.id))return!1;const p=m.componentName||Q(m.url);return((o=x[p])==null?void 0:o.status)==="impacted"});return j.length===0?t:[...t,...j]},[t,s,x]),w=n.useMemo(()=>Object.entries(x).filter(([,l])=>l.status==="new"||l.status==="edited").map(([l,j])=>({name:l,status:j.status})),[x]),[E,v]=n.useState(null),D=n.useCallback(l=>{v(j=>j===l?null:l)},[]),{pageGroups:O,componentGroups:R}=n.useMemo(()=>{var m;const l=new Map,j=new Map;for(const p of N)if(p.componentName){const o=j.get(p.componentName)||[];o.push(p),j.set(p.componentName,o)}else if($e(p.url)){const o=(m=p.url)==null?void 0:m.match(/[?&]c=([^&]+)/),y=o?decodeURIComponent(o[1]):"Isolated",C=j.get(y)||[];C.push(p),j.set(y,C)}else{const o=Q(p.url),y=l.get(o)||[];y.push(p),l.set(o,y)}return{pageGroups:l,componentGroups:j}},[N]),z=n.useMemo(()=>lt([...O.entries()],x),[O,x]),P=n.useMemo(()=>lt([...R.entries()],x),[R,x]),I=z,_=P,f=n.useMemo(()=>qt(a,x),[a,x]);return N.length===0&&a.length===0?e.jsxs("div",{className:"h-full bg-white flex items-center justify-center relative",children:[e.jsx("button",{onClick:c,className:"absolute top-2 right-3 text-gray-400 hover:text-gray-700 text-lg leading-none cursor-pointer bg-transparent border-none",title:"Close results",children:"×"}),e.jsx("span",{className:"text-sm text-gray-400",children:"No scenarios registered yet"})]}):e.jsxs("div",{className:"h-full bg-white flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-gray-200 shrink-0",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Working Session Results"}),k&&e.jsx("div",{className:"text-[11px] text-gray-400 truncate",title:k,children:k})]}),e.jsx("button",{onClick:c,className:"text-gray-400 hover:text-gray-700 text-lg leading-none cursor-pointer bg-transparent border-none shrink-0",title:"Close results",children:"×"})]}),S&&e.jsx(ot,{text:S,theme:"light"}),e.jsx("div",{className:"flex-1 overflow-auto p-4",children:e.jsxs("div",{className:"space-y-5",children:[I.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"mb-2",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Application"})}),e.jsx("div",{className:"space-y-3 pl-1",children:I.map(([l,j])=>{var y;const m=x[l],p=E===l,o=(y=j[0])==null?void 0:y.componentPath;return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-600",children:l}),m&&e.jsx(st,{status:m,onClick:()=>D(l)})]}),p&&(m==null?void 0:m.status)==="edited"&&o&&e.jsx(at,{filePath:o}),p&&(m==null?void 0:m.status)==="impacted"&&e.jsx(nt,{impactedBy:m.impactedBy,changedEntities:w}),e.jsx("div",{className:"flex flex-wrap gap-3",children:j.map(C=>e.jsx(rt,{scenarioId:C.id,name:it(C.name),isActive:C.id===h,onSelect:()=>d(C),updatedAt:C.updatedAt},C.id))})]},l)})})]}),_.length>0&&e.jsxs("div",{className:I.length>0?"pt-3 border-t border-gray-200":"",children:[e.jsx("div",{className:"mb-2",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"})}),e.jsx("div",{className:"space-y-3 pl-1",children:_.map(([l,j])=>{var y;const m=x[l],p=E===l,o=(y=j[0])==null?void 0:y.componentPath;return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-600",children:l}),m&&e.jsx(st,{status:m,onClick:()=>D(l)})]}),p&&(m==null?void 0:m.status)==="edited"&&o&&e.jsx(at,{filePath:o}),p&&(m==null?void 0:m.status)==="impacted"&&e.jsx(nt,{impactedBy:m.impactedBy,changedEntities:w}),e.jsx("div",{className:"flex flex-wrap gap-3",children:j.map(C=>e.jsx(rt,{scenarioId:C.id,name:it(C.name),isActive:C.id===h,onSelect:()=>d(C),updatedAt:C.updatedAt},C.id))})]},l)})})]}),f.length>0&&e.jsxs("div",{className:I.length>0||_.length>0?"pt-3 border-t border-gray-200":"",children:[e.jsx("div",{className:"mb-2",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"})}),e.jsx("div",{className:"space-y-2 pl-1",children:f.map(l=>e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-700",children:l.name})}),e.jsx(ms,{filePath:l.filePath,projectRoot:i}),l.testFile?e.jsx(ps,{testFile:l.testFile,entityName:l.name}):e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-400",children:"No test file"})})]},l.name))})]}),u.length>0&&e.jsxs("div",{className:I.length>0||_.length>0||f.length>0?"pt-3 border-t border-gray-200":"",children:[e.jsx("div",{className:"mb-2",children:e.jsxs("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:["Modified Files (",u.length,")"]})}),e.jsx("div",{className:"space-y-0.5 pl-1 max-h-[200px] overflow-auto",children:u.map(l=>e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`text-[9px] font-bold uppercase w-[14px] text-center ${l.status==="added"||l.status==="untracked"?"text-green-600":l.status==="modified"?"text-blue-600":l.status==="renamed"?"text-purple-600":"text-gray-400"}`,children:l.status==="added"||l.status==="untracked"?"A":l.status==="modified"?"M":l.status==="renamed"?"R":"?"}),e.jsx("span",{className:"text-[10px] text-gray-500 truncate font-mono",children:l.path})]},l.path))})]})]})})]})}const hs=[{key:"app",label:"App"},{key:"build",label:"Build"},{key:"data",label:"Structure"},{key:"journal",label:"Journal"}];function fs({activeTab:t,onTabChange:s,buildIdle:a,zoomComponent:i,breadcrumbItems:h,onBreadcrumbNavigate:d,panelLayout:c,onToggleExpand:x}){return e.jsxs("div",{className:"bg-[#3d3d3d] h-10 flex items-center px-3 gap-3 shrink-0 z-20 border-b border-[#2d2d2d]",children:[e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("img",{src:Jt,alt:"CodeYam",className:"h-5 brightness-0 invert"}),e.jsx("span",{className:"text-white font-medium text-xs whitespace-nowrap",children:"Codeyam Editor"})]}),e.jsx("div",{className:"flex-1"}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("div",{className:"flex items-center gap-0.5 bg-[#4a3232] rounded-lg p-0.5",children:hs.map(u=>e.jsxs("button",{onClick:()=>s(u.key),className:`px-2.5 py-1 text-xs font-medium rounded-md transition-colors cursor-pointer ${t===u.key?"bg-[#7a4444] text-white":"text-gray-300 hover:text-white"}`,children:[u.label,u.key==="build"&&a&&t!=="build"&&e.jsx("span",{className:"ml-1 inline-block w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse"})]},u.key))}),x&&e.jsx("button",{onClick:x,className:"p-1.5 rounded text-gray-400 hover:text-white transition-colors cursor-pointer",title:c==="editor-only"?"Show preview":"Hide preview",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:c==="editor-only"?e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("path",{d:"M9 3v18"}),e.jsx("path",{d:"M16 15l-3-3 3-3"})]}):e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("path",{d:"M9 3v18"}),e.jsx("path",{d:"M14 9l3 3-3 3"})]})})})]})]})}function gs({preview:t,onDismiss:s,onLoadCommit:a}){return e.jsxs("div",{className:"flex flex-col items-center gap-6 max-w-[700px] w-full",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:"text-lg font-semibold text-[#333] m-0 font-['IBM_Plex_Sans']",children:"Journal Screenshot"}),e.jsx("p",{className:"text-sm text-[#888] mt-1 m-0 font-['IBM_Plex_Sans']",children:"This is a snapshot from a previous version — not a live preview"})]}),e.jsx("div",{className:"rounded-lg overflow-hidden border-2 border-[#ccc] shadow-md max-w-full w-fit",children:e.jsx("img",{src:t.screenshotUrl,alt:t.scenarioName,className:"max-w-full h-auto block"})}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-[#666]",children:[t.commitSha&&e.jsx("span",{className:"font-mono text-xs text-[#00a0c4] bg-[#00a0c4]/15 px-2 py-0.5 rounded",children:t.commitSha.slice(0,7)}),e.jsxs("span",{className:"truncate",children:[t.scenarioName,t.commitMessage&&` — ${t.commitMessage}`]})]}),e.jsx("div",{className:"flex items-center gap-3",children:t.commitSha&&a&&e.jsx(js,{commitSha:t.commitSha,onLoadCommit:a})})]})}function js({commitSha:t,onLoadCommit:s}){const[a,i]=n.useState(!1),[h,d]=n.useState(null);return e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>{i(!0),d(null),s(t).then(c=>{c.success||d(c.error||"Failed to load commit")}).catch(c=>{d(c instanceof Error?c.message:"Network error")}).finally(()=>i(!1))},disabled:a,className:"bg-[#005c75] hover:bg-[#004d63] disabled:opacity-50 text-white text-sm font-medium px-4 py-1.5 rounded transition-colors cursor-pointer",children:a?"Reverting...":"Revert to this code and load this version"}),h&&e.jsx("div",{className:"bg-red-50 border border-red-200 rounded px-4 py-2 text-sm text-red-600 w-full text-center",children:h})]})}function vs({analysisId:t,scenarioId:s,scenarioName:a,entityName:i,projectSlug:h,onStateChange:d}){const{interactiveServerUrl:c,isStarting:x,isLoading:u}=Vt({analysisId:t,scenarioId:s,scenarioName:a,entityName:i,projectSlug:h,enabled:!0});return n.useEffect(()=>{d(c,x||u)},[c,x,u,d]),null}function bs(t,s){return s.status==="error"?{url:null,proxyUrl:null,isStarting:!1,error:s.errorMessage||"Dev server crashed",canStartServer:t.canStartServer,autoStartAttempted:t.autoStartAttempted,shouldAutoStart:!1}:s.url?{url:s.url,proxyUrl:s.proxyUrl||null,isStarting:!1,error:null,canStartServer:!0,autoStartAttempted:t.autoStartAttempted,shouldAutoStart:!1}:s.status==="starting"?{...t,isStarting:!0,error:null,canStartServer:!0,shouldAutoStart:!1}:s.status==="stopped"?t.url?{...t,url:null,isStarting:!1,shouldAutoStart:!1}:t.autoStartAttempted?{...t,isStarting:!1,shouldAutoStart:!1}:{...t,autoStartAttempted:!0,shouldAutoStart:!0}:{...t,shouldAutoStart:!1}}function Ns(){const[t,s]=n.useState({url:null,proxyUrl:null,isStarting:!1,error:null,canStartServer:!0,autoStartAttempted:!1}),a=n.useRef(t);a.current=t,n.useEffect(()=>{let d=!1,c=null;const x=async()=>{try{const u=await fetch("/api/editor-dev-server");if(d)return;const k=await u.json(),S=bs(a.current,k),{shouldAutoStart:N,...w}=S;if(s(w),N)try{const E=await fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"start"})});if(d)return;E.ok?s(v=>({...v,isStarting:!0})):s(v=>({...v,canStartServer:!1}))}catch{}}catch{}};return x(),c=setInterval(()=>void x(),2e3),()=>{d=!0,c&&clearInterval(c)}},[t.url]);const i=n.useCallback(()=>{s(d=>({...d,error:null,isStarting:!0})),fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"restart"})}).catch(()=>{})},[]),h=n.useCallback(()=>{s(d=>({...d,error:null,isStarting:!0})),fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"start"})}).catch(()=>{})},[]);return{devServerUrl:t.url,proxyUrl:t.proxyUrl,isStarting:t.isStarting,error:t.error,canStartServer:t.canStartServer,retryServer:i,startServer:h}}function ys(t){const s=n.useRef(null),a=n.useRef(null);n.useEffect(()=>{if(typeof document>"u")return;a.current||(a.current=document.createElement("canvas"),a.current.width=64,a.current.height=64);const i=document.querySelector('link[rel="icon"]');if(!i)return;if(s.current||(s.current=i.href),!t){i.href=s.current;return}const h=new Image;h.crossOrigin="anonymous",h.onload=()=>{const d=a.current,c=d.getContext("2d");c.clearRect(0,0,64,64),c.drawImage(h,0,0,64,64);const x=18,u=64-x,k=x;c.beginPath(),c.arc(u,k,x+3,0,2*Math.PI),c.fillStyle="#ffffff",c.fill(),c.beginPath(),c.arc(u,k,x,0,2*Math.PI),c.fillStyle="#ef4444",c.fill(),i.href=d.toDataURL("image/png")},h.src=s.current},[t]),n.useEffect(()=>()=>{if(typeof document>"u")return;const i=document.querySelector('link[rel="icon"]');i&&s.current&&(i.href=s.current)},[])}const Bs=()=>[{title:"Editor - CodeYam"},{name:"description",content:"CodeYam Code + Data Editor"}];class ws extends n.Component{constructor(){super(...arguments);qe(this,"state",{error:null,errorInfo:null})}static getDerivedStateFromError(a){return{error:a,errorInfo:null}}componentDidCatch(a,i){console.error("[EditorErrorBoundary] Error:",a.message),console.error("[EditorErrorBoundary] Component stack:",i.componentStack),console.error("[EditorErrorBoundary] Loader snapshot:",JSON.stringify(this.props.loaderSnapshot,null,2)),this.setState({errorInfo:i})}render(){var a;return this.state.error?e.jsx("div",{className:"fixed inset-0 bg-[#1e1e1e] flex items-center justify-center p-8",children:e.jsxs("div",{className:"max-w-[600px] w-full space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-red-400 font-['IBM_Plex_Sans'] m-0",children:"Something went wrong"}),e.jsx("pre",{className:"text-xs text-gray-300 bg-[#2d2d2d] p-3 rounded overflow-auto max-h-[120px]",children:this.state.error.message}),((a=this.state.errorInfo)==null?void 0:a.componentStack)&&e.jsxs("details",{className:"text-xs text-gray-500",children:[e.jsx("summary",{className:"cursor-pointer hover:text-gray-300 transition-colors",children:"Component stack"}),e.jsx("pre",{className:"mt-2 bg-[#2d2d2d] p-3 rounded overflow-auto max-h-[200px] text-yellow-300",children:this.state.errorInfo.componentStack})]}),e.jsx("p",{className:"text-xs text-gray-500 m-0",children:"Full diagnostics are in the browser console."}),e.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-[#005c75] text-white text-sm rounded hover:bg-[#004d63] transition-colors cursor-pointer",children:"Reload"})]})}):this.props.children}}const As=Et(function(){const{projectSlug:s,projectRoot:a,hasProject:i,scenarios:h,allScenarios:d,analyzedEntities:c,glossaryFunctions:x,glossaryEntries:u,entityImports:k,pageFilePaths:S,entityChangeStatus:N,modifiedFiles:w,featureName:E,userPrompt:v,projectTitle:D,projectDescription:O,defaultScreenSize:R,screenSizes:z}=Rt(),[P,I]=$t(),_=n.useRef(null),f=n.useRef(null),l=n.useRef(null),j=P.get("zoom")||void 0,m=P.get("scenario")||void 0,[p,o]=n.useState(()=>{if(typeof window>"u")return[];const r=new URLSearchParams(window.location.search).get("zoom");return r?[r]:[]}),y=n.useRef(null),C=n.useRef([]),A=n.useRef(null);n.useEffect(()=>{var B;const r=m||((B=Bt(d))==null?void 0:B.id);if(!At(r,y.current))return;const b=d.find(V=>V.id===r);if(!b)return;y.current=r;const M=Me(b,C.current,A.current);M&&K(M);const $=ce(b.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:$,scenarioId:b.id,scenarioName:b.name,scenarioType:b.type})}).catch(()=>{})},[m,d]),n.useEffect(()=>{const r=new BroadcastChannel("codeyam-editor");return r.onmessage=b=>{var M;if(((M=b.data)==null?void 0:M.type)==="switch-scenario"&&b.data.scenarioId){const $=b.data.scenarioId,B=d.find(Pe=>Pe.id===$);if(!B)return;y.current=$;const V=new URLSearchParams(P);V.set("scenario",$),V.delete("zoom"),I(V),pe(null),oe(null),G(null),J(!0);const Pt=ce(B.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:Pt,scenarioId:$,scenarioType:B.type})}).then(()=>{te(Pe=>Pe+1)}).catch(()=>{J(!1)})}},()=>r.close()},[P,I,d]),n.useEffect(()=>{if(P.get("ref")!=="link"||!m)return;const r=new BroadcastChannel("codeyam-editor");r.postMessage({type:"switch-scenario",scenarioId:m}),r.close(),window.close()},[]);const{devServerUrl:F,proxyUrl:H,isStarting:Z,error:q,canStartServer:ie,retryServer:le,startServer:me}=Ns(),[g,T]=n.useState(!1),[L,pe]=n.useState(null),[Te,oe]=n.useState(null),[ue,Le]=n.useState(!1),[he,G]=n.useState(null),ct=n.useCallback(async r=>{const M=await(await fetch("/api/editor-load-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commitSha:r})})).json();return M.success&&(G(null),T(!1)),M},[]),dt=n.useCallback((r,b)=>{oe(M=>(r&&r!==M&&T(!1),r)),!b&&r&&T(!0),Le(b)},[]),Be=n.useCallback(r=>{G(null),pe(M=>(M&&M.analysisId===r.analysisId||(oe(null),te(B=>B+1)),r)),Le(!0),T(!1);const b=new URLSearchParams(P);b.delete("scenario"),b.delete("zoom"),I(b)},[P,I]),[U,K]=n.useState(R?{name:R.name,width:R.width,height:R.height}:{name:"Desktop",width:1440,height:900}),[Ae,_e]=n.useState(!1),De=R?{name:R.name,width:R.width,height:R.height}:null;A.current=De;const[W,fe]=n.useState("app"),xt=n.useCallback(()=>{fe("build"),ge(!0)},[]),[mt,ge]=n.useState(!1),[Oe,je]=n.useState(!1),pt=n.useCallback(r=>{je(r)},[]);ys(Oe);const[ee,Ue]=n.useState("split"),[ve,ze]=n.useState(!1),ut=n.useCallback(()=>{ze(!0),fe("build"),ge(!0)},[]),Fe=n.useCallback(()=>{ze(!1)},[]),ht=n.useCallback(r=>{K(r),fetch("/api/editor-project-info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({defaultScreenSize:r,skipBroadcast:!0})})},[]),[We,He]=n.useState(_t);n.useEffect(()=>{const r=Dt();He(r),r.systemNotification&&typeof Notification<"u"&&Notification.permission==="default"&&Notification.requestPermission()},[]);const ft=n.useCallback(r=>{He(r),Ot(r)},[]);n.useEffect(()=>{if(W==="build"){je(!1);const r=setTimeout(()=>{var b,M;(b=_.current)==null||b.scrollToBottom(),(M=_.current)==null||M.focus()},50);return()=>clearTimeout(r)}},[W]),n.useEffect(()=>{function r(){!document.hidden&&W==="build"&&je(!1)}return document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)},[W]);const[be,gt]=n.useState(null);n.useEffect(()=>{const r=l.current;if(!r)return;const b=new ResizeObserver(M=>{const $=M[0];$&>({width:$.contentRect.width,height:$.contentRect.height})});return b.observe(r),()=>b.disconnect()},[]);const X=n.useMemo(()=>be?Ut(be,U):1,[be,U]),[Ne,te]=n.useState(0),[Ge,ye]=n.useState(null),[Je,J]=n.useState(!1),jt=n.useCallback((r,b)=>{if(ye(r||null),b){const M=new URLSearchParams(P);M.set("scenario",b),y.current=b,I(M);const $=d.find(B=>B.id===b);if($){const B=Me($,C.current,A.current);B&&K(B)}}G(null),te(M=>M+1)},[P,I,d]),{customSizes:we,addCustomSize:vt,removeCustomSize:bt}=Tt(s),Se=n.useMemo(()=>Yt(z),[z]),ke=n.useMemo(()=>[...Se,...we],[Se,we]);C.current=ke;const Ve=n.useMemo(()=>{const r=[{name:"App"}];for(const b of p)r.push({name:b,componentName:b});return r},[p]),Ce=n.useCallback(r=>{const b=new URLSearchParams(P);if(r){b.set("zoom",r);const M=p.indexOf(r);M>=0?o(p.slice(0,M+1)):o([...p,r]);const $=d.find(B=>B.componentName===r||B.componentName===null&&Q(B.url)===r);if($){b.set("scenario",$.id),y.current=$.id,J(!0);const B=ce($.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:B,scenarioId:$.id,scenarioType:$.type})}).then(()=>{te(V=>V+1)}).catch(()=>{J(!1)})}else b.delete("scenario")}else b.delete("zoom"),b.delete("scenario"),o([]);I(b)},[P,I,d,p]),se=n.useCallback(r=>{pe(null),oe(null),G(null),ye(null);const b=Me(r,ke,De);b&&K(b),y.current=r.id;const M=new URLSearchParams(P);M.set("scenario",r.id),I(M),J(!0);const $=ce(r.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:$,scenarioId:r.id,scenarioType:r.type,skipBroadcast:!0})}).then(()=>{te(B=>B+1)}).catch(()=>{J(!1)})},[P,I,ke]),Nt=n.useCallback(r=>{if(!r.commitSha){const b=d.find(M=>M.name===r.scenarioName);if(b){se(b);return}}G(r)},[d,se]),yt=r=>{const b={name:r.name,width:r.width,height:r.height};K(b),fetch("/api/editor-project-info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({defaultScreenSize:b,skipBroadcast:!0})})},wt=(r,b,M)=>{vt(r,b,M)},St=r=>{K(r),fetch("/api/editor-project-info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({defaultScreenSize:r,skipBroadcast:!0})})},kt=()=>{L||T(!0),J(!1)},ae=n.useMemo(()=>zt({activeAnalyzedScenario:!!L,analyzedPreviewUrl:Te,activeScenarioId:m||null,scenarios:d,proxyUrl:H,devServerUrl:F,zoomComponent:j||null}),[H,F,j,m,d,L,Te]),Ye=n.useMemo(()=>{const r=Ft(ae,Ge);if(!r)return null;const b=r.includes("?")?"&":"?";return`${r}${b}__cb=${Ne}`},[ae,Ge,Ne]),Ct=n.useMemo(()=>({projectSlug:s,hasProject:i,scenarioCount:h==null?void 0:h.length,allScenarioCount:d==null?void 0:d.length,analyzedEntityCount:c==null?void 0:c.length,glossaryFunctionCount:x==null?void 0:x.length,entityChangeStatusKeys:N?Object.keys(N):[],featureName:E}),[s,i,h,d,c,x,N,E]);return e.jsx(ws,{loaderSnapshot:Ct,children:e.jsxs("div",{className:"fixed inset-0 bg-[#2d2d2d] flex flex-col",children:[L&&e.jsx(vs,{analysisId:L.analysisId,scenarioId:L.scenarioId,scenarioName:L.scenarioName,entityName:L.entityName,projectSlug:s,onStateChange:dt},L.analysisId),e.jsxs("div",{className:"flex-1 flex min-h-0",children:[e.jsxs("div",{className:"flex-1 flex flex-col min-w-0",style:ee==="editor-only"?{display:"none"}:void 0,children:[e.jsxs("div",{className:"bg-[#2d2d2d] border-b border-[#3d3d3d] shrink-0 z-10 h-10 flex items-center px-4 relative",children:[e.jsx("div",{className:"flex items-center gap-1 shrink-0 z-10",children:e.jsx("button",{onClick:()=>Ue(r=>r==="preview-only"?"split":"preview-only"),className:"p-1.5 rounded text-gray-500 hover:text-gray-300 transition-colors cursor-pointer",title:ee==="preview-only"?"Show sidebar":"Hide sidebar",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("path",{d:"M9 3v18"})]})})}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center gap-1 pointer-events-none",children:e.jsxs("div",{className:"flex items-center gap-1 pointer-events-auto",children:[xe.map(r=>e.jsxs("button",{onClick:()=>yt(r),className:`p-1.5 rounded transition-colors cursor-pointer ${U.name===r.name?"text-white bg-[#555]":"text-gray-500 hover:text-gray-300"}`,title:`${r.name} (${r.width}×${r.height})`,children:[r.name==="Desktop"&&e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),e.jsx("path",{d:"M8 21h8M12 17v4"})]}),r.name==="Laptop"&&e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8H4V6z"}),e.jsx("path",{d:"M2 18h20"})]}),r.name==="Tablet"&&e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"5",y:"2",width:"14",height:"20",rx:"2"}),e.jsx("path",{d:"M12 18h.01"})]}),r.name==="Mobile"&&e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"7",y:"2",width:"10",height:"20",rx:"2"}),e.jsx("path",{d:"M12 18h.01"})]})]},r.name)),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>_e(r=>!r),className:`flex items-center gap-1.5 px-2 py-1 rounded transition-colors cursor-pointer ${Ae||!xe.some(r=>r.name===U.name)?"text-white bg-[#555]":"text-gray-400 hover:text-gray-200 hover:bg-[#444]"}`,title:"Custom dimensions",children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M17 3a2.83 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})}),e.jsxs("span",{className:"text-xs font-mono",children:[U.width," ×"," ",U.height??900]})]}),Ae&&e.jsx(Lt,{currentWidth:U.width,currentHeight:U.height??900,devicePresets:Se,customSizes:we,onApply:St,onSave:wt,onRemove:bt,onClose:()=>_e(!1)})]})]})}),e.jsx("div",{className:"ml-auto flex items-center gap-1 shrink-0 z-10",children:e.jsx("button",{onClick:()=>{const r=Ye||ae;r&&window.open(r,"_blank")},className:"p-1.5 rounded text-gray-500 hover:text-gray-300 transition-colors cursor-pointer",title:"Open preview in new window",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),e.jsx("polyline",{points:"15 3 21 3 21 9"}),e.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})})})]}),e.jsx("div",{ref:l,className:"flex-1 flex items-center justify-center overflow-hidden p-8",style:he?{backgroundColor:"#f5f0e8",backgroundImage:"repeating-linear-gradient(0deg, transparent, transparent 19px, #e8e0d0 19px, #e8e0d0 20px), repeating-linear-gradient(90deg, transparent, transparent 19px, #e8e0d0 19px, #e8e0d0 20px)"}:{backgroundImage:`
|
|
6
|
-
linear-gradient(45deg, #333 25%, transparent 25%),
|
|
7
|
-
linear-gradient(-45deg, #333 25%, transparent 25%),
|
|
8
|
-
linear-gradient(45deg, transparent 75%, #333 75%),
|
|
9
|
-
linear-gradient(-45deg, transparent 75%, #333 75%)
|
|
10
|
-
`,backgroundSize:"16px 16px",backgroundPosition:"0 0, 0 8px, 8px -8px, -8px 0px",backgroundColor:"#2d2d2d"},children:he?e.jsx(gs,{preview:he,onDismiss:()=>G(null),onLoadCommit:ct}):ae?e.jsx("div",{style:{width:`${U.width*X}px`,height:`${(U.height??900)*X}px`},children:e.jsxs("div",{className:"relative bg-white origin-top-left",style:{width:`${U.width}px`,height:`${U.height??900}px`,transform:X<1?`scale(${X})`:void 0},children:[!g&&!Je&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10",children:e.jsxs("div",{className:"flex flex-col items-center justify-center gap-6 bg-[#2a2a2a] rounded-lg p-8 w-[500px] h-[300px]",children:[e.jsx("div",{className:"mb-4",children:e.jsx(Ke,{})}),e.jsxs("div",{className:"flex flex-col gap-3 text-center",children:[e.jsx("h2",{className:"text-xl font-medium text-gray-200 leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Loading Preview"}),e.jsx("p",{className:"text-sm text-gray-400 leading-5 m-0 font-['IBM_Plex_Sans']",children:"Waiting for the app to render"})]})]})}),Je&&e.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center",style:{backgroundColor:"rgba(0, 0, 0, 0.25)",backdropFilter:"blur(1px)",transition:"opacity 200ms ease-out"},children:e.jsxs("div",{className:"flex flex-col items-center gap-3 animate-pulse",children:[e.jsx("svg",{className:"w-6 h-6 text-white/80 animate-spin",viewBox:"0 0 24 24",fill:"none",children:e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeDasharray:"50 100"})}),e.jsx("span",{className:"text-white/70 text-xs font-['IBM_Plex_Sans']",children:"Switching scenario"})]})}),e.jsx("iframe",{ref:f,src:Ye||ae,className:"w-full h-full border-none",title:"Editor preview",onLoad:kt,style:{opacity:g?1:0}},Ne)]})}):e.jsx("div",{className:"bg-[#2a2a2a] rounded-lg flex flex-col items-center justify-center",style:{width:`${U.width*X}px`,height:`${(U.height??900)*X}px`},children:q?e.jsxs("div",{className:"flex flex-col gap-4 text-center px-8 max-w-[600px]",children:[e.jsx("h2",{className:"text-xl font-medium text-red-400 leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Dev Server Failed"}),e.jsx("pre",{className:"text-xs text-left bg-[#1e1e1e] text-gray-300 p-4 rounded overflow-auto max-h-[300px] w-full font-mono whitespace-pre-wrap",children:q}),e.jsx("button",{onClick:le,className:"mx-auto px-4 py-2 bg-[#005c75] text-white text-sm font-medium rounded hover:bg-[#004d63] transition-colors cursor-pointer",children:"Retry"})]}):Z||ue?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-4",children:e.jsx(Ke,{})}),e.jsxs("div",{className:"flex flex-col gap-3 text-center",children:[e.jsx("h2",{className:"text-xl font-medium text-gray-200 leading-[28px] m-0 font-['IBM_Plex_Sans']",children:ue?"Starting Interactive Mode":"Starting Dev Server"}),e.jsx("p",{className:"text-sm text-gray-400 leading-5 m-0 font-['IBM_Plex_Sans']",children:ue?"Loading component preview...":"Your dev server is starting up..."})]})]}):e.jsxs("div",{className:"flex flex-col gap-3 text-center px-8",children:[e.jsx("h2",{className:"text-xl font-medium text-gray-200 leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Live Preview"}),e.jsx("p",{className:"text-sm text-gray-500 leading-5 m-0 font-['IBM_Plex_Sans']",children:"Describe what you want to build in the Build tab"})]})})})]}),e.jsxs("aside",{className:`bg-[#1e1e1e] border-r border-[#3d3d3d] shrink-0 flex flex-col overflow-hidden order-first ${ee==="editor-only"?"w-full max-w-none min-w-0":"w-[50%] min-w-[400px] max-w-[800px]"}`,style:ee==="preview-only"?{display:"none"}:void 0,children:[e.jsx(fs,{activeTab:W,onTabChange:r=>{fe(r),r==="build"&&ge(!0)},buildIdle:Oe,zoomComponent:j,breadcrumbItems:Ve,onBreadcrumbNavigate:Ce,panelLayout:ee,onToggleExpand:()=>Ue(r=>r==="editor-only"?"split":"editor-only")}),e.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[mt&&e.jsxs("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:W==="build"?"visible":"hidden"},children:[e.jsx("div",{className:ve?"flex-1 min-h-0":"flex-1",style:ve?{flex:"1 1 50%"}:void 0,children:e.jsx(Wt,{ref:_,entityName:"Editor",projectSlug:s,entityFilePath:null,scenarioName:null,onRefreshPreview:jt,onShowResults:ut,onHideResults:Fe,onSetViewport:ht,editorMode:!0,onIdleChange:pt,notificationSettings:We})}),ve&&e.jsx("div",{style:{flex:"1 1 50%"},className:"min-h-0 border-t-2 border-gray-300",children:e.jsx(us,{scenarios:h,allScenarios:d,glossaryFunctions:x,projectRoot:a,activeScenarioId:m,onScenarioSelect:se,onClose:Fe,entityChangeStatus:N,modifiedFiles:w,featureName:E,userPrompt:v})})]}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:W==="app"?"visible":"hidden"},children:e.jsx(xs,{hasProject:i,scenarios:d,analyzedEntities:c,glossaryFunctions:x,glossaryEntries:u,projectRoot:a,activeScenarioId:m,onScenarioSelect:se,onAnalyzedScenarioSelect:Be,onSwitchToBuild:xt,zoomComponent:j,onZoomChange:Ce,entityImports:k,pageFilePaths:S,projectTitle:D,projectDescription:O,breadcrumbItems:Ve})}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:W==="data"?"visible":"hidden"},children:e.jsx(Kt,{scenarios:d,projectRoot:a,activeScenarioId:m,onScenarioSelect:se,zoomComponent:j,onZoomChange:Ce,analyzedEntities:[],glossaryFunctions:x,activeAnalyzedScenarioId:L==null?void 0:L.scenarioId,onAnalyzedScenarioSelect:Be,entityImports:k,pageFilePaths:S})}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:W==="journal"?"visible":"hidden"},children:e.jsx(os,{isActive:W==="journal",onScreenshotClick:Nt,glossaryFunctions:x})})]}),e.jsx(Ht,{serverUrl:F,isStarting:Z,projectSlug:s,devServerError:q,onStartServer:ie?me:void 0,notificationSettings:We,onChangeNotificationSettings:ft})]})]})]})})});export{As as default,Bs as meta};
|