@codeyam/codeyam-cli 0.1.0-staging.ae0de75 → 0.1.0-staging.b8f4f94
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 +3 -3
- package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +13 -7
- package/analyzer-template/packages/analyze/src/lib/asts/index.ts +7 -2
- package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js +196 -0
- package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js.map +1 -0
- package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js +114 -0
- package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js.map +1 -0
- package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js +149 -0
- package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js.map +1 -0
- package/codeyam-cli/src/commands/default.js +3 -46
- package/codeyam-cli/src/commands/default.js.map +1 -1
- package/codeyam-cli/src/commands/editor.js +254 -66
- package/codeyam-cli/src/commands/editor.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +234 -0
- package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorJournal.test.js +12 -1
- package/codeyam-cli/src/utils/__tests__/editorJournal.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +29 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +1217 -0
- package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -0
- package/codeyam-cli/src/utils/backgroundServer.js +2 -2
- package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/utils/editorAudit.js +45 -5
- package/codeyam-cli/src/utils/editorAudit.js.map +1 -1
- package/codeyam-cli/src/utils/editorJournal.js +7 -0
- package/codeyam-cli/src/utils/editorJournal.js.map +1 -1
- package/codeyam-cli/src/utils/entityChangeStatus.js +255 -0
- package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -0
- package/codeyam-cli/src/utils/install-skills.js +1 -1
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +5 -1
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/Terminal-nZNBALox.js +41 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-diff-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/editor-DTwKl1Xu.js +10 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.dev-D8ILZMR0.js → entity._sha.scenarios._scenarioId.dev-DjACbfdI.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/git-CdN8sCqs.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-h1-1oFYI.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/index-yHOVb4rc.js +15 -0
- package/codeyam-cli/src/webserver/build/client/assets/manifest-9422aeab.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{memory-FweZHj5U.js → memory-Dg0mvYrI.js} +4 -1
- package/codeyam-cli/src/webserver/build/client/assets/{root-DUKqhFlb.js → root-BzQgN2ff.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/{index-BLhjL9Xi.js → index-Bh_pNxNA.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-Bqr22tlO.js +367 -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/server.js +32 -6
- package/codeyam-cli/src/webserver/server.js.map +1 -1
- package/codeyam-cli/src/webserver/terminalServer.js +23 -4
- package/codeyam-cli/src/webserver/terminalServer.js.map +1 -1
- package/codeyam-cli/templates/editor-step-hook.py +53 -6
- package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +10 -5
- package/codeyam-cli/templates/skills/codeyam-memory/SKILL.md +10 -10
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/detect-deprecated-patterns.mjs +139 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/find-exports.mjs +52 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/read-json-field.mjs +61 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/ripgrep-fallback.mjs +155 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/cleanup.mjs +13 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/filter-session.mjs +95 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/preprocess.mjs +160 -0
- package/package.json +10 -10
- package/packages/analyze/src/lib/ProjectAnalyzer.js +10 -4
- package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
- package/packages/analyze/src/lib/asts/index.js +4 -2
- package/packages/analyze/src/lib/asts/index.js.map +1 -1
- package/scripts/npm-post-install.cjs +22 -0
- package/codeyam-cli/src/webserver/build/client/assets/Terminal-wkqC0AQk.js +0 -41
- package/codeyam-cli/src/webserver/build/client/assets/editor-CdjF_fX6.js +0 -8
- package/codeyam-cli/src/webserver/build/client/assets/git-CFCTYk9I.js +0 -15
- package/codeyam-cli/src/webserver/build/client/assets/globals-B17TBSS6.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-b8fd6b07.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-DyMuI5mU.js +0 -363
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/detect-deprecated-patterns.sh +0 -108
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/find-exports.sh +0 -69
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/cleanup.sh +0 -12
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/filter.jq +0 -45
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/preprocess.sh +0 -139
|
@@ -66,8 +66,10 @@ export function createProgramFromTsConfigPath(tsConfigPath, excludePatterns) {
|
|
|
66
66
|
if (!parsedCommandLine) {
|
|
67
67
|
throw new Error('Could not parse tsconfig.json');
|
|
68
68
|
}
|
|
69
|
-
//
|
|
70
|
-
|
|
69
|
+
// Always filter out node_modules from root files to prevent OOM on large projects.
|
|
70
|
+
// This only removes them as root compilation targets — TypeScript's module resolution
|
|
71
|
+
// still follows imports into node_modules for type info when processing source files.
|
|
72
|
+
let fileNames = parsedCommandLine.fileNames.filter((f) => !f.includes('/node_modules/'));
|
|
71
73
|
if (excludePatterns && excludePatterns.length > 0) {
|
|
72
74
|
const regexPatterns = excludePatterns
|
|
73
75
|
.map((pattern) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/analyze/src/lib/asts/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAEhC,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,WAAW,MAAM,qBAAqB,CAAC;AAEnD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,yBAAyB,CAAC,EACxC,UAAU,EACV,OAAO,GAIR;IACC,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAC7C,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAC7D,MAAM,KAAK,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAC3C,WAAW,CAAC,iBAAiB,CAAC,GAAG,CAAC,CACnC,CAAC;IACF,MAAM,QAAQ,GAAG,CAAC,CAAwB,EAAkB,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACnE,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACjE,MAAM,aAAa,GAAG,CAAC,CAA6B,EAAuB,EAAE,CAC3E,CAAC,CAAC,CAAC,CAAC;IACN,MAAM,YAAY,GAAG,OAAO;SACzB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC;SAC/B,IAAI,EAAE;SACN,MAAM,CAAC,aAAa,CAAC,CAAC;IACzB,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IACrD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACnC,UAAyB;IAEzB,MAAM,kBAAkB,GAA2B,EAAE,CAAC;IAEtD,SAAS,KAAK,CAAC,IAAa;QAC1B,IAAI,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;YACjC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;QAED,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,CAAC;IAElB,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,6BAA6B,CAC3C,YAAoB,EACpB,eAA0B;IAE1B,MAAM,iBAAiB,GAAG,EAAE,CAAC,gCAAgC,CAC3D,YAAY,EACZ,EAAE,EACF;QACE,GAAG,EAAE,CAAC,GAAG;QACT,mCAAmC,EAAE,GAAG,EAAE,GAAE,CAAC;KAC9C,CACF,CAAC;IAEF,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IAED,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/analyze/src/lib/asts/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAEhC,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,WAAW,MAAM,qBAAqB,CAAC;AAEnD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,yBAAyB,CAAC,EACxC,UAAU,EACV,OAAO,GAIR;IACC,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAC7C,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAC7D,MAAM,KAAK,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAC3C,WAAW,CAAC,iBAAiB,CAAC,GAAG,CAAC,CACnC,CAAC;IACF,MAAM,QAAQ,GAAG,CAAC,CAAwB,EAAkB,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACnE,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACjE,MAAM,aAAa,GAAG,CAAC,CAA6B,EAAuB,EAAE,CAC3E,CAAC,CAAC,CAAC,CAAC;IACN,MAAM,YAAY,GAAG,OAAO;SACzB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC;SAC/B,IAAI,EAAE;SACN,MAAM,CAAC,aAAa,CAAC,CAAC;IACzB,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IACrD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACnC,UAAyB;IAEzB,MAAM,kBAAkB,GAA2B,EAAE,CAAC;IAEtD,SAAS,KAAK,CAAC,IAAa;QAC1B,IAAI,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;YACjC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;QAED,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,CAAC;IAElB,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,6BAA6B,CAC3C,YAAoB,EACpB,eAA0B;IAE1B,MAAM,iBAAiB,GAAG,EAAE,CAAC,gCAAgC,CAC3D,YAAY,EACZ,EAAE,EACF;QACE,GAAG,EAAE,CAAC,GAAG;QACT,mCAAmC,EAAE,GAAG,EAAE,GAAE,CAAC;KAC9C,CACF,CAAC;IAEF,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IAED,mFAAmF;IACnF,sFAAsF;IACtF,sFAAsF;IACtF,IAAI,SAAS,GAAG,iBAAiB,CAAC,SAAS,CAAC,MAAM,CAChD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CACrC,CAAC;IAEF,IAAI,eAAe,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClD,MAAM,aAAa,GAAG,eAAe;aAClC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;YACf,IAAI,CAAC;gBACH,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;YAC7B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,IAAI,CAAC,4BAA4B,OAAO,EAAE,EAAE,KAAK,CAAC,CAAC;gBAC3D,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC,CAAC;aACD,MAAM,CAAC,CAAC,KAAK,EAAmB,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC;QAEtD,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7B,wDAAwD;YACxD,MAAM,WAAW,GAAG,YAAY,CAAC,SAAS,CACxC,CAAC,EACD,YAAY,CAAC,WAAW,CAAC,GAAG,CAAC,CAC9B,CAAC;YAEF,MAAM,aAAa,GAAG,SAAS,CAAC,MAAM,CAAC;YACvC,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE;gBACxC,8DAA8D;gBAC9D,wEAAwE;gBACxE,MAAM,YAAY,GAAG,QAAQ,CAAC,UAAU,CAAC,WAAW,GAAG,GAAG,CAAC;oBACzD,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC;oBAC5C,CAAC,CAAC,QAAQ,CAAC;gBAEb,4CAA4C;gBAC5C,MAAM,aAAa,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CACjD,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CACzB,CAAC;gBACF,OAAO,CAAC,aAAa,CAAC;YACxB,CAAC,CAAC,CAAC;YACH,MAAM,aAAa,GAAG,aAAa,GAAG,SAAS,CAAC,MAAM,CAAC;YACvD,IAAI,aAAa,GAAG,CAAC,EAAE,CAAC;gBACtB,eAAe;gBACf,8FAA8F;gBAC9F,KAAK;YACP,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,EAAE,CAAC,aAAa,CAAC;QACtB,SAAS,EAAE,SAAS;QACpB,OAAO,EAAE,iBAAiB,CAAC,OAAO;KACnC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,UAAyB;IAEzB,MAAM,aAAa,GAA6B,EAAE,CAAC;IAEnD,SAAS,KAAK,CAAC,IAAa;QAC1B,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACpC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC;QAED,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAEnC,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,mCAAmC,CACjD,UAAyB;IAEzB,MAAM,YAAY,GAAG,GAAG,CAAC,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAC/D,IAAI,CAAC,YAAY;QAAE,MAAM,qCAAqC,CAAC;IAE/D,MAAM,aAAa,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;IACrE,OAAO,aAAa,CAAC;AACvB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,CAAS;IAC1C,OAAO,EAAE,CAAC,gBAAgB;IACxB,kEAAkE;IAClE,SAAS,EACT,CAAC;IACD,gDAAgD;IAChD,+BAA+B;IAC/B,EAAE,CAAC,YAAY,CAAC,MAAM;IACtB,0EAA0E;IAC1E,sCAAsC;IACtC,IAAI,CACL,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,EAAiB;IAEjB,IAAI,KAAK,GAAuC,SAAS,CAAC;IAE1D,SAAS,KAAK,CAAC,IAAa;QAC1B,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;YAClB,KAAK,EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC;YACvC,KAAK,EAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC;YACtC,KAAK,EAAE,CAAC,UAAU,CAAC,aAAa;gBAC9B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;oBACrC,MAAM,6BAA6B,CAAC;gBACtC,CAAC;gBAED,KAAK,GAAG,IAAI,CAAC;gBACb,OAAO;YACT;gBACE,IAAI,KAAK;oBAAE,OAAO;gBAClB,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IAED,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAE3B,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,EAAiB;IAEjB,MAAM,OAAO,GAA2B,EAAE,CAAC;IAE3C,SAAS,KAAK,CAAC,IAAa;QAC1B,IAAI,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;YACjC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;QAED,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAE3B,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -5,6 +5,28 @@
|
|
|
5
5
|
* but that is now deferred to the `codeyam setup-simulations` step.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
|
|
11
|
+
// On macOS/Linux, ensure node-pty spawn-helper binaries are executable.
|
|
12
|
+
// This is a no-op on Windows where chmod isn't needed.
|
|
13
|
+
if (process.platform !== 'win32') {
|
|
14
|
+
const spawnHelpers = [
|
|
15
|
+
'node_modules/node-pty/prebuilds/darwin-arm64/spawn-helper',
|
|
16
|
+
'node_modules/node-pty/prebuilds/darwin-x64/spawn-helper',
|
|
17
|
+
];
|
|
18
|
+
for (const helper of spawnHelpers) {
|
|
19
|
+
const fullPath = path.join(__dirname, '..', helper);
|
|
20
|
+
if (fs.existsSync(fullPath)) {
|
|
21
|
+
try {
|
|
22
|
+
fs.chmodSync(fullPath, 0o755);
|
|
23
|
+
} catch {
|
|
24
|
+
// Best-effort — don't fail the install
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
8
30
|
console.error('');
|
|
9
31
|
console.error(' CodeYam CLI installed successfully!');
|
|
10
32
|
console.error('');
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/addon-fit-CUXOrorO.js","assets/chunk-JZWAC4HX-C4pqxYJB.js","assets/addon-web-links-Duc5hnl7.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as n,j as r}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{_ as H}from"./preload-helper-ckwbz45p.js";function ee({serverUrl:f,isStarting:A,projectSlug:w,devServerError:R,onStartServer:g}){const[y,b]=n.useState(null),u=n.useRef(null);n.useEffect(()=>{if(!w)return;const _=new EventSource("/api/dev-mode-events");return _.onmessage=E=>{try{const S=JSON.parse(E.data);S.type==="file-synced"&&(b(S.fileName),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{b(null)},5e3))}catch{}},()=>{_.close(),u.current&&clearTimeout(u.current)}},[w]);let a;R?a="error":A?a="starting":f?a="running":a="stopped";const v={starting:"bg-yellow-400",running:"bg-green-400",stopped:"bg-gray-400",error:"bg-red-400"},N={starting:"Starting...",running:f||"Running",stopped:"Stopped",error:"Error"};return r.jsxs("div",{className:"bg-[#1e1e1e] border-t border-[#3d3d3d] h-7 flex items-center px-4 gap-4 shrink-0 text-xs font-mono",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:`w-2 h-2 rounded-full ${v[a]}`}),r.jsxs("span",{className:"text-gray-400",children:["Server:"," ",r.jsx("span",{className:"text-gray-300",children:N[a]})]}),(a==="stopped"||a==="error")&&g&&r.jsx("button",{onClick:g,className:"ml-1 px-2.5 py-0.5 bg-[#005c75] hover:bg-[#007a9a] text-white text-[11px] font-medium rounded transition-colors cursor-pointer border-none leading-tight",children:"Start Server"})]}),r.jsx("div",{className:"w-px h-3 bg-[#3d3d3d]"}),y&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#4ade80",strokeWidth:"2",children:r.jsx("path",{d:"M20 6L9 17l-5-5"})}),r.jsxs("span",{className:"text-green-400",children:["Synced: ",y]})]}),r.jsx("div",{className:"w-px h-3 bg-[#3d3d3d]"})]}),r.jsx("div",{className:"flex-1"}),r.jsx("span",{className:"text-gray-500",children:"Claude edits auto-sync to preview via HMR"})]})}const K=`
|
|
3
|
-
.xterm { cursor: text; position: relative; user-select: none; -ms-user-select: none; -webkit-user-select: none; }
|
|
4
|
-
.xterm.focus, .xterm:focus { outline: none; }
|
|
5
|
-
.xterm .xterm-helpers { position: absolute; top: 0; z-index: 5; }
|
|
6
|
-
.xterm .xterm-helper-textarea { padding: 0; border: 0; margin: 0; position: absolute; opacity: 0; left: -9999em; top: 0; width: 0; height: 0; z-index: -5; white-space: nowrap; overflow: hidden; resize: none; }
|
|
7
|
-
.xterm .composition-view { background: #000; color: #FFF; display: none; position: absolute; white-space: nowrap; z-index: 1; }
|
|
8
|
-
.xterm .composition-view.active { display: block; }
|
|
9
|
-
.xterm .xterm-viewport { background-color: #000; overflow-y: scroll; cursor: default; position: absolute; right: 0; left: 0; top: 0; bottom: 0; }
|
|
10
|
-
.xterm .xterm-screen { position: relative; }
|
|
11
|
-
.xterm .xterm-screen canvas { position: absolute; left: 0; top: 0; }
|
|
12
|
-
.xterm .xterm-scroll-area { visibility: hidden; }
|
|
13
|
-
.xterm-char-measure-element { display: inline-block; visibility: hidden; position: absolute; top: 0; left: -9999em; line-height: normal; }
|
|
14
|
-
.xterm.enable-mouse-events { cursor: default; }
|
|
15
|
-
.xterm.xterm-cursor-pointer, .xterm .xterm-cursor-pointer { cursor: pointer; }
|
|
16
|
-
.xterm.column-select.focus { cursor: crosshair; }
|
|
17
|
-
.xterm .xterm-accessibility:not(.debug), .xterm .xterm-message { position: absolute; left: 0; top: 0; bottom: 0; right: 0; z-index: 10; color: transparent; pointer-events: none; }
|
|
18
|
-
.xterm .xterm-accessibility-tree:not(.debug) *::selection { color: transparent; }
|
|
19
|
-
.xterm .xterm-accessibility-tree { user-select: text; white-space: pre; }
|
|
20
|
-
.xterm .live-region { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
|
|
21
|
-
.xterm-dim { opacity: 1 !important; }
|
|
22
|
-
.xterm-underline-1 { text-decoration: underline; }
|
|
23
|
-
.xterm-underline-2 { text-decoration: double underline; }
|
|
24
|
-
.xterm-underline-3 { text-decoration: wavy underline; }
|
|
25
|
-
.xterm-underline-4 { text-decoration: dotted underline; }
|
|
26
|
-
.xterm-underline-5 { text-decoration: dashed underline; }
|
|
27
|
-
.xterm-overline { text-decoration: overline; }
|
|
28
|
-
.xterm-strikethrough { text-decoration: line-through; }
|
|
29
|
-
.xterm-screen .xterm-decoration-container .xterm-decoration { z-index: 6; position: absolute; }
|
|
30
|
-
.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer { z-index: 7; }
|
|
31
|
-
.xterm-decoration-overview-ruler { z-index: 8; position: absolute; top: 0; right: 0; pointer-events: none; }
|
|
32
|
-
.xterm-decoration-top { z-index: 2; position: relative; }
|
|
33
|
-
`;function Q(){if(document.getElementById("xterm-css"))return;const f=document.createElement("style");f.id="xterm-css",f.textContent=K,document.head.appendChild(f)}const te=n.forwardRef(function({entityName:A,entityType:w,entitySha:R,entityFilePath:g,scenarioName:y,scenarioDescription:b,analysisId:u,projectSlug:a,onRefreshPreview:v,onShowResults:N,editorMode:_,onIdleChange:E,notificationsEnabled:S},I){const M=n.useRef(null),T=n.useRef(null),j=n.useRef(null),h=n.useRef(null),B=n.useRef(null),C=n.useRef(!1),O=n.useRef(0),L=n.useRef(!1),x=n.useRef(E);x.current=E;const W=n.useRef(S);W.current=S;const $=n.useCallback(()=>{var o;(o=j.current)==null||o.focus()},[]);return n.useImperativeHandle(I,()=>({sendInput(o){const l=h.current;l&&l.readyState===WebSocket.OPEN&&(l.send(JSON.stringify({type:"input",data:o})),setTimeout(()=>{l.readyState===WebSocket.OPEN&&l.send(JSON.stringify({type:"input",data:"\r"}))},100))},focus(){var o;(o=j.current)==null||o.focus()},scrollToBottom(){var l;const o=(l=M.current)==null?void 0:l.querySelector(".xterm-viewport");o&&(o.scrollTop=o.scrollHeight)}})),n.useEffect(()=>{const o=M.current;if(!o)return;let l=!1;return Q(),Promise.all([H(()=>import("./xterm-BqvuqXEL.js"),[]),H(()=>import("./addon-fit-CUXOrorO.js").then(m=>m.a),__vite__mapDeps([0,1])),H(()=>import("./addon-web-links-Duc5hnl7.js").then(m=>m.a),__vite__mapDeps([2,1]))]).then(([m,U,V])=>{if(l)return;const t=new m.Terminal({cursorBlink:!0,fontSize:13,fontFamily:"'IBM Plex Mono', 'Menlo', 'Monaco', monospace",theme:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#d4d4d4",selectionBackground:"#264f78"},linkHandler:{activate(s,e){try{const i=new URL(e),c=i.searchParams.get("scenario");if(c&&i.pathname==="/editor"){const d=new BroadcastChannel("codeyam-editor");d.postMessage({type:"switch-scenario",scenarioId:c}),d.close();return}}catch{}window.open(e,"_blank")}}}),z=new U.FitAddon;t.loadAddon(z),t.loadAddon(new V.WebLinksAddon),t.open(o),z.fit(),j.current=t,t.focus(),setTimeout(()=>t.focus(),100),setTimeout(()=>t.focus(),500);const q=window.location.protocol==="https:"?"wss:":"ws:",X=window.location.host;function G(s){const e=new URLSearchParams;return e.set("entityName",A),w&&e.set("entityType",w),R&&e.set("entitySha",R),g&&e.set("entityFilePath",g),y&&e.set("scenarioName",y),b&&e.set("scenarioDescription",b),u&&e.set("analysisId",u),a&&e.set("projectSlug",a),_&&e.set("editorMode","true"),s&&e.set("reconnectId",s),`${q}//${X}/ws/terminal?${e.toString()}`}function F(s){const e=G(s),i=new WebSocket(e);h.current=i,i.onopen=()=>{O.current=0,L.current=!1,i.send(JSON.stringify({type:"resize",cols:t.cols,rows:t.rows}))},i.onmessage=c=>{var d,D;try{const p=JSON.parse(c.data);if(p.type==="session-id"){B.current=p.sessionId;return}if(p.type==="refresh-preview"){v==null||v(p.path);return}if(p.type==="show-results"){N==null||N();return}if(p.type==="claude-idle"){if(console.log("[Terminal] Received claude-idle, notifications:",W.current,"permission:",typeof Notification<"u"?Notification.permission:"N/A"),(d=x.current)==null||d.call(x,!0),W.current&&typeof Notification<"u"&&Notification.permission==="granted"){const J=new Notification("Claude is ready for you",{body:"Claude has finished and is waiting for your input.",tag:"claude-idle"});J.onclick=()=>{window.focus(),J.close()}}return}p.type==="output"&&(t.write(p.data),(D=x.current)==null||D.call(x,!1))}catch{t.write(c.data)}},i.onclose=()=>{if(C.current){t.write(`\r
|
|
34
|
-
\x1B[90m[Terminal session ended]\x1B[0m\r
|
|
35
|
-
`);return}const c=O.current;if(c<5&&B.current){const d=1e3*Math.pow(2,Math.min(c,3));O.current=c+1,t.write(`\r
|
|
36
|
-
\x1B[33m[Reconnecting...]\x1B[0m\r
|
|
37
|
-
`),setTimeout(()=>{C.current||F(B.current)},d)}else L.current?t.write(`\r
|
|
38
|
-
\x1B[90m[Terminal session ended]\x1B[0m\r
|
|
39
|
-
`):(L.current=!0,t.write(`\r
|
|
40
|
-
\x1B[33m[Starting new session...]\x1B[0m\r
|
|
41
|
-
`),B.current=null,O.current=0,F())},i.onerror=()=>{}}F(),t.onData(s=>{const e=h.current;e&&e.readyState===WebSocket.OPEN&&e.send(JSON.stringify({type:"input",data:s}))});let k=null;const P=new ResizeObserver(()=>{k&&clearTimeout(k),k=setTimeout(()=>{const s=z.proposeDimensions();if(!s||s.cols===t.cols&&s.rows===t.rows)return;const e=o.querySelector(".xterm-viewport");let i,c=!0;e&&(i=e.scrollTop,c=e.scrollTop+e.clientHeight>=e.scrollHeight-10),z.fit(),e&&i!==void 0&&(c?e.scrollTop=e.scrollHeight:e.scrollTop=i);const d=h.current;d&&d.readyState===WebSocket.OPEN&&d.send(JSON.stringify({type:"resize",cols:t.cols,rows:t.rows}))},150)});P.observe(o),T.current=()=>{var s;k&&clearTimeout(k),P.disconnect(),C.current=!0,(s=h.current)==null||s.close(),h.current=null,t.dispose(),j.current=null}}),()=>{var m;l=!0,(m=T.current)==null||m.call(T),T.current=null}},[]),r.jsx("div",{ref:M,onClick:$,className:"w-full h-full",style:{padding:"4px 0 0 8px"}})});export{ee as D,te as T};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{r as a,j as e,w as et,u as tt,f as st,b as at}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{u as nt,V as rt,S as it}from"./useCustomSizes-ByhSyh0W.js";import{T as lt,D as ot}from"./Terminal-wkqC0AQk.js";import{c as ct}from"./cy-logo-cli-DcX-ZS3p.js";import{S as Pe,u as dt}from"./Spinner-Bb5uFQ5V.js";import"./preload-helper-ckwbz45p.js";import"./useLastLogLine-C14nCb1q.js";function $e(r){const[s,i]=a.useState(null),[l,u]=a.useState(!1),N=a.useCallback(()=>{r&&(u(!0),fetch(`/api/editor-test-results?testFile=${encodeURIComponent(r)}`).then(v=>v.json()).then(v=>{i(v),u(!1)}).catch(()=>{i({testFilePath:r,status:"error",testCases:[],errorMessage:"Failed to fetch test results"}),u(!1)}))},[r]);return a.useEffect(()=>{r&&N()},[r,N]),{results:s,isRunning:l,runTests:N}}function Y({imgSrc:r,name:s,isActive:i,onSelect:l}){return e.jsxs("button",{onClick:l,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] ${i?"border-[#005c75] ring-1 ring-[#005c75]":"border-transparent hover:border-[#4d4d4d]"}`,children:r?e.jsx("img",{src:r,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 ${i?"text-white":"text-gray-500 group-hover:text-gray-300"}`,children:s})]})}function me({testFile:r,entityName:s}){const{results:i,isRunning:l,runTests:u}=$e(r);if(l&&!i)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(!i)return null;if(i.status==="error")return e.jsx("div",{className:"px-2 pt-1",children:e.jsx("span",{className:"text-[10px] text-red-400",children:i.errorMessage})});const N=s?i.testCases.filter(h=>{const f=`${s} > `;return h.fullName.startsWith(f)||h.fullName===s}):i.testCases;if(N.length===0)return null;const v=s?`${s} > `:"";return e.jsxs("div",{className:"px-2 pt-1 space-y-0.5",children:[N.map(h=>{var o;const f=v&&h.fullName.startsWith(v)?h.fullName.slice(v.length):h.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[h.status==="passed"?e.jsx("span",{className:"text-green-400 text-[10px]",children:"✓"}):h.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] ${h.status==="passed"?"text-green-400":h.status==="failed"?"text-red-400":"text-gray-500"}`,children:f})]}),h.status==="failed"&&((o=h.failureMessages)==null?void 0:o.map((p,b)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-300/70 truncate max-w-full",title:p,children:p.split(`
|
|
2
|
-
`)[0]},b)))]},h.fullName)}),e.jsx("button",{onClick:u,disabled:l,className:"mt-1 text-[10px] text-[#00a0c4] hover:text-[#00c4ee] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:l?"Running...":"Re-run"})]})}function V({filePath:r,projectRoot:s}){if(!r)return null;const l=`vscode://file/${s?`${s}/${r}`:r}`;return e.jsxs("div",{className:"flex items-center gap-1 px-2 mt-0.5",children:[e.jsx("span",{className:"text-[9px] text-gray-500 truncate",children:r}),e.jsx("a",{href:l,title:"Open in editor",className:"shrink-0 text-gray-500 hover:text-gray-300 transition-colors",children:e.jsx("svg",{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"})})})]})}function xt({scenarios:r,projectRoot:s,activeScenarioId:i,onScenarioSelect:l,zoomComponent:u,onZoomChange:N,analyzedEntities:v=[],glossaryFunctions:h=[],activeAnalyzedScenarioId:f,onAnalyzedScenarioSelect:o,entityImports:p}){const{appScenarios:b,componentGroups:k}=a.useMemo(()=>{const t=[],m=new Map;for(const y of r)if(y.componentName){const I=m.get(y.componentName)||[];I.push(y),m.set(y.componentName,I)}else t.push(y);const j=new Map([...m.entries()].sort(([y],[I])=>y.localeCompare(I)));return{appScenarios:t,componentGroups:j}},[r]),g=a.useMemo(()=>{const t=new Set((v||[]).filter(j=>j.entityType==="visual").map(j=>j.name)),m=new Map;for(const[j,y]of k)t.has(j)||m.set(j,y);return m},[k,v]),{visualEntities:E,libraryEntities:M}=a.useMemo(()=>{const t=v.filter(j=>j.entityType==="visual").sort((j,y)=>j.name.localeCompare(y.name)),m=v.filter(j=>j.entityType==="library"||j.entityType==="functionCall").sort((j,y)=>j.name.localeCompare(y.name));return{visualEntities:t,libraryEntities:m}},[v]),R=a.useMemo(()=>{const t=new Set(M.map(m=>m.name));return h.filter(m=>!t.has(m.name)).sort((m,j)=>m.name.localeCompare(j.name))},[h,M]),z=v.some(t=>t.isAnalyzing),A=a.useRef(null),x=a.useRef(0),C=a.useCallback(()=>{A.current&&(x.current=A.current.scrollTop)},[]);if(a.useEffect(()=>{A.current&&x.current>0&&(A.current.scrollTop=x.current)}),r.length===0&&v.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(u){const t=k.get(u)||[],m=new Set((p==null?void 0:p[u])||[]),j=m.size>0,y=j?E.filter(w=>m.has(w.name)):[],I=j?M.filter(w=>m.has(w.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:()=>N(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:u})}),e.jsx("div",{className:"flex flex-wrap gap-2 px-2",children:t.length===0?e.jsx("div",{className:"px-3 py-2 text-xs text-gray-500",children:"No scenarios for this component"}):t.map(w=>e.jsx(Y,{imgSrc:w.screenshotPath?`/api/editor-scenario-image/${w.id}.png`:null,name:w.name,isActive:w.id===i,onSelect:()=>l(w)},w.id))}),y.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"})}),y.map(w=>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:()=>N(w.name),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:w.name})}),e.jsx(V,{filePath:w.filePath,projectRoot:s}),(w.scenarios.length>0||w.pendingScenarios.length>0)&&e.jsx("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:w.scenarios.map(c=>e.jsx(Y,{imgSrc:c.screenshotPath?`/api/screenshot/${c.screenshotPath}`:null,name:c.name,isActive:c.id===f,onSelect:()=>o==null?void 0:o({analysisId:w.analysisId,scenarioId:c.id,scenarioName:c.name,entitySha:w.sha,entityName:w.name})},c.id))})]},w.sha))]}),I.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"})}),I.map(w=>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:w.name})}),e.jsx(V,{filePath:w.filePath,projectRoot:s}),w.testFile&&e.jsx(me,{testFile:w.testFile,entityName:w.name})]},w.sha))]})]})})}return e.jsx("div",{ref:A,onScroll:C,className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-3 space-y-3",children:[b.length>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"})}),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:"Home"})}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:b.map(t=>e.jsx(Y,{imgSrc:t.screenshotPath?`/api/editor-scenario-image/${t.id}.png`:null,name:t.name,isActive:t.id===i&&!f,onSelect:()=>l(t)},t.id))})]})]}),g.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"})}),[...g.entries()].map(([t,m])=>{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:()=>N(t),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:t})}),((j=m[0])==null?void 0:j.componentPath)&&e.jsx(V,{filePath:m[0].componentPath,projectRoot:s}),e.jsx("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:m.map(y=>e.jsx(Y,{imgSrc:y.screenshotPath?`/api/editor-scenario-image/${y.id}.png`:null,name:y.name,isActive:y.id===i&&!f,onSelect:()=>l(y)},y.id))})]},t)})]}),E.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&&r.length===0&&v.every(t=>t.scenarioCount===0)&&e.jsx("span",{className:"ml-2 text-[10px] text-gray-500",children:"— Entities are being analyzed..."})]}),E.map(t=>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:()=>N(t.name),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:t.name}),t.isAnalyzing&&t.scenarioCount===0&&e.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] text-gray-400",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#005c75] animate-pulse"}),"Analyzing..."]})]}),e.jsx(V,{filePath:t.filePath,projectRoot:s}),(t.scenarios.length>0||t.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:[t.scenarios.map(m=>e.jsx(Y,{imgSrc:m.screenshotPath?`/api/screenshot/${m.screenshotPath}`:null,name:m.name,isActive:m.id===f,onSelect:()=>o==null?void 0:o({analysisId:t.analysisId,scenarioId:m.id,scenarioName:m.name,entitySha:t.sha,entityName:t.name})},m.id)),t.pendingScenarios.map(m=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:m,children:m},m))]})]},t.sha))]}),(M.length>0||R.length>0)&&e.jsxs("div",{className:`pt-2 mt-1 ${E.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"})}),M.map(t=>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:t.name}),t.isAnalyzing&&t.scenarioCount===0&&e.jsxs("span",{className:"ml-2 inline-flex items-center gap-1.5 text-[10px] text-gray-400",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#005c75] animate-pulse"}),"Analyzing..."]})]}),e.jsx(V,{filePath:t.filePath,projectRoot:s}),t.testFile?e.jsx(me,{testFile:t.testFile,entityName:t.name}):e.jsx("div",{className:"px-2 pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-500",children:"No test file"})})]},t.sha)),R.map(t=>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:t.name})}),e.jsx(V,{filePath:t.filePath,projectRoot:s}),e.jsx(me,{testFile:t.testFile,entityName:t.name})]},t.name))]})]})})}function mt(r){const s=new Map;for(const i of[...r].reverse()){const l=s.get(i.date)||[];l.push(i),s.set(i.date,l)}return s}function ht(r){const s=new Map;for(const i of r){const l=i.name.indexOf(" - "),u=l!==-1?i.name.slice(0,l):"App",N=s.get(u)||[];N.push(i),s.set(u,N)}return[...s.entries()].sort(([i],[l])=>i==="App"?-1:l==="App"?1:i.localeCompare(l))}const pt={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 ut(r){try{return new Date(r).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}function ft(r){try{return new Date(r+"T00:00:00").toLocaleDateString([],{weekday:"long",month:"long",day:"numeric"})}catch{return r}}function gt({isActive:r,onScreenshotClick:s}){const[i,l]=a.useState([]),[u,N]=a.useState(!0),[v,h]=a.useState(new Set),f=a.useCallback(b=>{h(k=>{const g=new Set(k);return g.has(b)?g.delete(b):g.add(b),g})},[]),o=a.useCallback(async()=>{try{const b=await fetch("/api/editor-journal");if(b.ok){const k=await b.json();l(k.entries||[])}}catch{}finally{N(!1)}},[]);if(a.useEffect(()=>{o()},[o]),a.useEffect(()=>{r&&o()},[r,o]),a.useEffect(()=>{const b=new EventSource("/api/events");return b.addEventListener("message",k=>{try{const g=JSON.parse(k.data);g.type==="db-change"&&g.changeType==="journal"&&o()}catch{}}),()=>b.close()},[o]),u)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 p=mt(i);return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsx("div",{className:"p-3 space-y-4",children:[...p.entries()].map(([b,k])=>e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-1.5 sticky top-0 bg-[#1e1e1e] z-10",children:e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:ft(b)})}),e.jsx("div",{className:"space-y-2",children:k.map((g,E)=>{const M=pt[g.type]||{label:g.type,color:"bg-gray-600"},R=`${g.time}-${E}`,z=v.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",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:g.title}),e.jsx("span",{className:`${M.color} text-white text-[9px] font-bold px-1.5 py-0.5 rounded uppercase tracking-wider shrink-0`,children:M.label})]}),e.jsx("span",{className:"text-[10px] text-gray-500",children:ut(g.time)})]})}),e.jsx("p",{className:"text-xs text-gray-400 leading-relaxed",children:g.description}),g.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/${g.screenshot.replace("screenshots/","")}`,commitSha:g.commitSha,commitMessage:g.commitMessage,scenarioName:g.title}),children:e.jsx("img",{src:`/api/editor-journal-image/${g.screenshot.replace("screenshots/","")}`,alt:g.title,className:"max-w-full max-h-full object-contain",loading:"lazy"})}),g.scenarioScreenshots&&g.scenarioScreenshots.length>0&&(()=>{const A=ht(g.scenarioScreenshots);return e.jsx("div",{className:"space-y-1.5",children:A.map(([x,C])=>e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:x}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-0.5",children:C.map(t=>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/${t.path.replace("screenshots/","")}`,commitSha:g.commitSha,commitMessage:g.commitMessage,scenarioName:t.name}),children:e.jsx("img",{src:`/api/editor-journal-image/${t.path.replace("screenshots/","")}`,alt:t.name,title:t.name,className:"max-w-full max-h-full object-contain",loading:"lazy"})},t.path))})]},x))})})(),g.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:g.commitSha.slice(0,7)}),e.jsx("span",{className:"text-gray-500 truncate",children:g.commitMessage})]})]}),e.jsxs("button",{onClick:()=>f(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)})})]},b))})})}function F({imgSrc:r,name:s,isActive:i,onSelect:l}){return e.jsxs("button",{onClick:l,className:"flex flex-col items-center gap-1 cursor-pointer group",title:s,children:[e.jsx("div",{className:`w-24 h-24 rounded overflow-hidden border-2 transition-all bg-[#1a1a1a] ${i?"border-[#005c75] ring-1 ring-[#005c75]":"border-transparent hover:border-[#4d4d4d]"}`,children:r?e.jsx("img",{src:r,alt:s,className:"w-full h-full object-contain",loading:"lazy"}):e.jsx("div",{className:"w-full h-full bg-[#1a1a1a] flex items-center justify-center",children:e.jsx("span",{className:"text-[8px] text-gray-600",children:"No img"})})}),e.jsx("span",{className:`text-[10px] leading-tight text-center truncate w-24 ${i?"text-white":"text-gray-500 group-hover:text-gray-300"}`,children:s})]})}function jt({filePath:r,projectRoot:s}){if(!r)return null;const l=`vscode://file/${s?`${s}/${r}`:r}`;return e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsx("span",{className:"text-[9px] text-gray-500 truncate",children:r}),e.jsx("a",{href:l,title:"Open in editor",className:"shrink-0 text-gray-500 hover:text-gray-300 transition-colors",children:e.jsx("svg",{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"})})})]})}function vt({hasProject:r,scenarios:s,analyzedEntities:i,glossaryFunctions:l=[],projectRoot:u,activeScenarioId:N,onScenarioSelect:v,onAnalyzedScenarioSelect:h,onSwitchToBuild:f,zoomComponent:o,onZoomChange:p,entityImports:b}){const{pageGroups:k,componentGroups:g}=a.useMemo(()=>{const x=new Map,C=new Map;for(const m of s)if(m.componentName){const j=C.get(m.componentName)||[];j.push(m),C.set(m.componentName,j)}else{const j="Home",y=x.get(j)||[];y.push(m),x.set(j,y)}const t=new Map([...C.entries()].sort(([m],[j])=>m.localeCompare(j)));return{pageGroups:x,componentGroups:t}},[s]),E=a.useRef(null),M=a.useRef(0),R=a.useCallback(()=>{E.current&&(M.current=E.current.scrollTop)},[]);if(a.useEffect(()=>{E.current&&M.current>0&&(E.current.scrollTop=M.current)}),!r)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:f,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"})]})});const z=a.useMemo(()=>i.filter(x=>x.entityType==="visual").sort((x,C)=>x.name.localeCompare(C.name)),[i]);if(!(s.length>0||z.length>0))return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-4 px-8 text-center",children:[e.jsx("h2",{className:"text-lg font-medium text-white font-['IBM_Plex_Sans'] m-0",children:"Your project is ready"}),e.jsx("p",{className:"text-sm text-gray-400 m-0 font-['IBM_Plex_Sans'] leading-relaxed max-w-[280px]",children:"Describe what you want to build in the Chat and your pages and components will appear here."}),e.jsx("button",{onClick:f,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(o){const x=k.get(o)||[],C=g.get(o)||[],t=z.find(c=>c.name===o),m=k.has(o),j=new Set((b==null?void 0:b[o])||[]),y=j.size>0,I=y?[...g.entries()].filter(([c])=>j.has(c)):[...g.entries()],w=y?z.filter(c=>j.has(c.name)):z;return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsxs("button",{onClick:()=>p(void 0),className:"flex items-center gap-2 text-xs text-gray-400 hover:text-white transition-colors cursor-pointer bg-transparent border-none p-0",children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M7.5 9L4.5 6L7.5 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),"All"]}),e.jsx("h2",{className:"text-sm font-semibold text-white m-0 font-['IBM_Plex_Sans'] uppercase tracking-wider",children:o}),x.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:x.map(c=>e.jsx(F,{imgSrc:c.screenshotPath?`/api/editor-scenario-image/${c.id}.png`:null,name:c.name,isActive:c.id===N,onSelect:()=>v(c)},c.id))}),C.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:C.map(c=>e.jsx(F,{imgSrc:c.screenshotPath?`/api/editor-scenario-image/${c.id}.png`:null,name:c.name,isActive:c.id===N,onSelect:()=>v(c)},c.id))}),t&&(t.scenarios.length>0||t.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.scenarios.map(c=>e.jsx(F,{imgSrc:c.screenshotPath?`/api/screenshot/${c.screenshotPath}`:null,name:c.name,isActive:!1,onSelect:()=>h({analysisId:t.analysisId,scenarioId:c.id,scenarioName:c.name,entitySha:t.sha,entityName:t.name})},c.id)),t.pendingScenarios.map(c=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:c,children:c},c))]}),m&&I.length>0&&e.jsxs("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),I.map(([c,P])=>e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>p(c),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:c})}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:P.map(_=>e.jsx(F,{imgSrc:_.screenshotPath?`/api/editor-scenario-image/${_.id}.png`:null,name:_.name,isActive:_.id===N,onSelect:()=>v(_)},_.id))})]},c))]}),m&&w.length>0&&e.jsxs("div",{className:`${I.length===0?"pt-2 mt-1 border-t border-[#3d3d3d]":"mt-2"}`,children:[I.length===0&&e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),w.map(c=>e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>p(c.name),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:c.name})}),(c.scenarios.length>0||c.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[c.scenarios.map(P=>e.jsx(F,{imgSrc:P.screenshotPath?`/api/screenshot/${P.screenshotPath}`:null,name:P.name,isActive:!1,onSelect:()=>h({analysisId:c.analysisId,scenarioId:P.id,scenarioName:P.name,entitySha:c.sha,entityName:c.name})},P.id)),c.pendingScenarios.map(P=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:P,children:P},P))]})]},c.sha))]}),x.length===0&&C.length===0&&!t&&e.jsx("div",{className:"text-xs text-gray-500",children:"No scenarios for this entity"})]})})}return e.jsx("div",{ref:E,onScroll:R,className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsx("h2",{className:"text-sm font-medium text-gray-300 m-0 font-['IBM_Plex_Sans']",children:"What do you want to work on next?"}),e.jsx("button",{onClick:f,className:"w-full py-3 border-2 border-dashed border-[#4d4d4d] rounded-lg text-sm text-gray-400 hover:border-[#005c75] hover:text-white transition-colors cursor-pointer bg-transparent",children:"+ New Page"}),k.size>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Application"}),[...k.entries()].map(([x,C])=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>p(x),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:x})}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:C.map(t=>e.jsx(F,{imgSrc:t.screenshotPath?`/api/editor-scenario-image/${t.id}.png`:null,name:t.name,isActive:t.id===N,onSelect:()=>v(t)},t.id))})]},x))]}),g.size>0&&e.jsx("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"})}),[...g.entries()].map(([x,C])=>e.jsxs("div",{children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>p(x),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:x})}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:C.map(t=>e.jsx(F,{imgSrc:t.screenshotPath?`/api/editor-scenario-image/${t.id}.png`:null,name:t.name,isActive:t.id===N,onSelect:()=>v(t)},t.id))})]},x)),z.map(x=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 py-1",children:[e.jsx("button",{onClick:()=>p(x.name),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:x.name}),x.isAnalyzing&&x.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..."]})]}),(x.scenarios.length>0||x.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[x.scenarios.map(C=>e.jsx(F,{imgSrc:C.screenshotPath?`/api/screenshot/${C.screenshotPath}`:null,name:C.name,isActive:!1,onSelect:()=>h({analysisId:x.analysisId,scenarioId:C.id,scenarioName:C.name,entitySha:x.sha,entityName:x.name})},C.id)),x.pendingScenarios.map(C=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:C,children:C},C))]})]},x.sha)),l.length>0&&e.jsxs("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:[e.jsx("div",{className:"py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"})}),l.map(x=>e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"flex items-center gap-2 py-1",children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-300",children:x.name}),x.testFile&&e.jsx("span",{className:"text-[9px] text-green-400 bg-green-400/10 px-1.5 py-0.5 rounded",children:"tested"})]}),x.description&&e.jsx("p",{className:"text-[10px] text-gray-500 mt-0 mb-0 leading-relaxed",children:x.description}),e.jsx(jt,{filePath:x.filePath,projectRoot:u})]},x.name))]})]})})}function Nt({items:r,onNavigate:s}){return r.length===0?null:e.jsx("nav",{className:"flex items-center gap-1 text-xs",children:r.map((i,l)=>{const u=l===r.length-1;return e.jsxs("span",{className:"flex items-center gap-1",children:[l>0&&e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-gray-500",children:e.jsx("path",{d:"M4.5 3L7.5 6L4.5 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),u?e.jsx("span",{className:"text-white font-medium",children:i.name}):e.jsx("button",{onClick:()=>s(i.componentName),className:"text-gray-400 hover:text-white transition-colors cursor-pointer",children:i.name})]},i.componentName||"app")})})}function Me({scenarioId:r,name:s,isActive:i,onSelect:l}){const[u,N]=a.useState(!1);return e.jsxs("button",{onClick:l,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 ${i?"border-[#0ea5e9] ring-2 ring-[#0ea5e9]/40 shadow-lg shadow-[#0ea5e9]/20":"border-gray-200 hover:border-gray-400 shadow-sm"}`,children:u?e.jsx("div",{className:"w-full h-full bg-gray-100 flex items-center justify-center",children:e.jsx("span",{className:"text-[9px] text-gray-400",children:"No preview"})}):e.jsx("img",{src:`/api/editor-scenario-image/${r}.png`,alt:s,className:"w-full h-full object-contain bg-white",loading:"lazy",onError:()=>N(!0)})}),e.jsx("span",{className:`text-[11px] leading-tight text-center truncate w-32 font-medium ${i?"text-gray-900":"text-gray-600 group-hover:text-gray-900"}`,children:s})]})}function bt({filePath:r,projectRoot:s}){if(!r)return null;const l=`vscode://file/${s?`${s}/${r}`:r}`;return e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsx("span",{className:"text-[9px] text-gray-400 truncate",children:r}),e.jsx("a",{href:l,title:"Open in editor",className:"shrink-0 text-gray-400 hover:text-gray-600 transition-colors",children:e.jsx("svg",{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"})})})]})}function wt({testFile:r,entityName:s}){const{results:i,isRunning:l,runTests:u}=$e(r);if(l&&!i)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(!i)return null;if(i.status==="error")return e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-red-500",children:i.errorMessage})});const N=s?i.testCases.filter(h=>{const f=`${s} > `;return h.fullName.startsWith(f)||h.fullName===s}):i.testCases;if(N.length===0)return null;const v=s?`${s} > `:"";return e.jsxs("div",{className:"pt-1 space-y-0.5",children:[N.map(h=>{var o;const f=v&&h.fullName.startsWith(v)?h.fullName.slice(v.length):h.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[h.status==="passed"?e.jsx("span",{className:"text-green-600 text-[10px]",children:"✓"}):h.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] ${h.status==="passed"?"text-green-600":h.status==="failed"?"text-red-500":"text-gray-400"}`,children:f})]}),h.status==="failed"&&((o=h.failureMessages)==null?void 0:o.map((p,b)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-400 truncate max-w-full",title:p,children:p.split(`
|
|
3
|
-
`)[0]},b)))]},h.fullName)}),e.jsx("button",{onClick:u,disabled:l,className:"mt-1 text-[10px] text-[#0ea5e9] hover:text-[#38bdf8] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:l?"Running...":"Re-run"})]})}function yt(r){if(!r||r==="/")return"Home";const i=r.split("?")[0].replace(/^\//,"").split("/")[0];return i.charAt(0).toUpperCase()+i.slice(1)}function St({scenarios:r,glossaryFunctions:s=[],projectRoot:i,activeScenarioId:l,onScenarioSelect:u,onClose:N}){const{pageGroups:v,componentGroups:h}=a.useMemo(()=>{const f=new Map,o=new Map;for(const b of r)if(b.componentName){const k=o.get(b.componentName)||[];k.push(b),o.set(b.componentName,k)}else{const k=yt(b.url),g=f.get(k)||[];g.push(b),f.set(k,g)}const p=new Map([...o.entries()].sort(([b],[k])=>b.localeCompare(k)));return{pageGroups:f,componentGroups:p}},[r]);return r.length===0&&s.length===0?e.jsxs("div",{className:"h-full bg-white flex items-center justify-center relative",children:[e.jsx("button",{onClick:N,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.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Working Session Results"}),e.jsx("button",{onClick:N,className:"text-gray-400 hover:text-gray-700 text-lg leading-none cursor-pointer bg-transparent border-none",title:"Close results",children:"×"})]}),e.jsx("div",{className:"flex-1 overflow-auto p-4",children:e.jsxs("div",{className:"space-y-5",children:[v.size>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:[...v.entries()].map(([f,o])=>e.jsxs("div",{children:[e.jsx("div",{className:"mb-1.5",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-600",children:f})}),e.jsx("div",{className:"flex flex-wrap gap-3",children:o.map(p=>e.jsx(Me,{scenarioId:p.id,name:p.name,isActive:p.id===l,onSelect:()=>u(p)},p.id))})]},f))})]}),h.size>0&&e.jsxs("div",{className:v.size>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:[...h.entries()].map(([f,o])=>e.jsxs("div",{children:[e.jsx("div",{className:"mb-1.5",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-600",children:f})}),e.jsx("div",{className:"flex flex-wrap gap-3",children:o.map(p=>e.jsx(Me,{scenarioId:p.id,name:p.name,isActive:p.id===l,onSelect:()=>u(p)},p.id))})]},f))})]}),s.length>0&&e.jsxs("div",{className:r.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:s.map(f=>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:f.name})}),e.jsx(bt,{filePath:f.filePath,projectRoot:i}),f.testFile?e.jsx(wt,{testFile:f.testFile,entityName:f.name}):e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-400",children:"No test file"})})]},f.name))})]})]})})]})}function K(r){return r.replace(/[^a-zA-Z0-9_]+/g,"_")}function Ct(r){const{activeAnalyzedScenario:s,analyzedPreviewUrl:i,activeScenarioId:l,scenarios:u,proxyUrl:N,devServerUrl:v,zoomComponent:h}=r;if(s&&i)return i;if(s&&!i)return null;if(l){const o=u.find(p=>p.id===l);if(o!=null&&o.url){const p=N||v;return p?o.url.startsWith("/")?`${p}${o.url}`:o.url:null}}const f=N||v;if(!f)return null;if(h&&l){const o=u.find(b=>b.id===l),p=o?K(o.name):"Default";return`${f}/__codeyam__/${h}/${p}`}return f}function kt(r,s){const i=s.width,l=s.height??900,u=r.width,N=r.height;return i<=u&&l<=N?1:Math.min(u/i,N/l)}const zt=()=>[{title:"Editor - CodeYam"},{name:"description",content:"CodeYam Code + Data Editor"}],he=[{name:"Mobile",width:375,height:667},{name:"Tablet",width:768,height:1024},{name:"Laptop",width:1024,height:768},{name:"Desktop",width:1440,height:900}];function Pt({analysisId:r,scenarioId:s,scenarioName:i,entityName:l,projectSlug:u,onStateChange:N}){const{interactiveServerUrl:v,isStarting:h,isLoading:f}=dt({analysisId:r,scenarioId:s,scenarioName:i,entityName:l,projectSlug:u,enabled:!0});return a.useEffect(()=>{N(v,h||f)},[v,h,f,N]),null}const Bt=et(function(){const{projectSlug:s,projectRoot:i,hasProject:l,scenarios:u,analyzedEntities:N,glossaryFunctions:v,entityImports:h}=tt(),f=st(),[o,p]=at(),b=a.useRef(null),k=a.useRef(null),g=a.useRef(null),E=o.get("zoom")||void 0,M=o.get("scenario")||void 0;a.useEffect(()=>{if(!M)return;const n=u.find(S=>S.id===M);if(!n)return;const d=K(n.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:d,scenarioId:n.id})}).catch(()=>{})},[M,u]),a.useEffect(()=>{const n=new BroadcastChannel("codeyam-editor");return n.onmessage=d=>{var S;if(((S=d.data)==null?void 0:S.type)==="switch-scenario"&&d.data.scenarioId){const $=d.data.scenarioId,B=u.find(xe=>xe.id===$);if(!B)return;const Z=new URLSearchParams(o);Z.set("scenario",$),Z.delete("zoom"),p(Z),_(null),q(null),O(null);const Ze=K(B.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:Ze,scenarioId:$})}).then(()=>{G(xe=>xe+1),I(!1)}).catch(()=>{})}},()=>n.close()},[o,p,u]),a.useEffect(()=>{if(o.get("ref")!=="link"||!M)return;const n=new BroadcastChannel("codeyam-editor");n.postMessage({type:"switch-scenario",scenarioId:M}),n.close(),window.close()},[]);const[R,z]=a.useState(null),[A,x]=a.useState(null),[C,t]=a.useState(!1),[m,j]=a.useState(null),[y,I]=a.useState(!1),[w,c]=a.useState(!0),[P,_]=a.useState(null),[pe,q]=a.useState(null),[ee,ue]=a.useState(!1),[D,O]=a.useState(null),[fe,ge]=a.useState(!1),[je,Q]=a.useState(null),Ee=a.useCallback(n=>{O(n),Q(null)},[]),Ie=a.useCallback((n,d)=>{q(S=>(n&&n!==S&&I(!1),n)),!d&&n&&I(!0),ue(d)},[]),ve=a.useCallback(n=>{O(null),_(S=>(S&&S.analysisId===n.analysisId||(q(null),G(B=>B+1)),n)),ue(!0),I(!1);const d=new URLSearchParams(o);d.delete("scenario"),d.delete("zoom"),p(d)},[o,p]),[Le,Ne]=a.useState(1440),[L,te]=a.useState({name:"Desktop",width:1440,height:900}),[Te,se]=a.useState(!1),[ae,Re]=a.useState(null),[T,W]=a.useState("app"),ze=a.useCallback(()=>{W("build"),ne(!0)},[]),[Be,ne]=a.useState(!1),[Ae,be]=a.useState(!1),_e=a.useCallback(n=>{be(n)},[]),[re,we]=a.useState(!1),De=a.useCallback(()=>{we(!0),W("build"),ne(!0)},[]),Ue=a.useCallback(()=>{we(!1)},[]),[J,ie]=a.useState(!1),Fe=a.useCallback(()=>{if(J){ie(!1);return}typeof Notification<"u"&&Notification.permission==="default"?Notification.requestPermission().then(n=>{n==="granted"&&ie(!0)}):ie(!0)},[J]);a.useEffect(()=>{if(T==="build"){be(!1);const n=setTimeout(()=>{var d,S;(d=b.current)==null||d.scrollToBottom(),(S=b.current)==null||S.focus()},50);return()=>clearTimeout(n)}},[T]);const[le,Oe]=a.useState(null);a.useEffect(()=>{const n=g.current;if(!n)return;const d=new ResizeObserver(S=>{const $=S[0];$&&Oe({width:$.contentRect.width,height:$.contentRect.height})});return d.observe(n),()=>d.disconnect()},[]);const H=a.useMemo(()=>le?kt(le,L):1,[le,L]),[We,G]=a.useState(0),[oe,ye]=a.useState(null),Je=a.useCallback(n=>{ye(n||null),G(d=>d+1)},[]),{customSizes:Se,addCustomSize:He}=nt(s),X=a.useMemo(()=>[...he,...Se],[Se]),Ce=a.useRef(!1);a.useEffect(()=>{let n=!1,d=null;const S=async()=>{try{const $=await fetch("/api/editor-dev-server");if(n)return;const B=await $.json();if(B.status==="error")z(null),x(null),t(!1),j(B.errorMessage||"Dev server crashed");else if(B.url)z(B.url),x(B.proxyUrl||null),t(!1),j(null),c(!0);else if(B.status==="starting")t(!0),j(null),c(!0);else if(B.status==="stopped")if(R)z(null),t(!1);else if(Ce.current)t(!1);else{Ce.current=!0;try{(await fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"start"})})).ok?t(!0):c(!1)}catch{}}}catch{}};return S(),d=setInterval(()=>void S(),2e3),()=>{n=!0,d&&clearInterval(d)}},[R]),a.useEffect(()=>{const n=new EventSource("/api/events");let d=null;return n.addEventListener("message",S=>{try{const $=JSON.parse(S.data);($.type==="db-change"||$.type==="unknown")&&(d&&clearTimeout(d),d=setTimeout(()=>{f.revalidate()},2e3))}catch{}}),()=>{d&&clearTimeout(d),n.close()}},[f]);const Ve=a.useMemo(()=>{const n=[{name:"App"}];return E&&n.push({name:E,componentName:E}),n},[E]),ce=a.useCallback(n=>{const d=new URLSearchParams(o);if(n){d.set("zoom",n);const S=u.find($=>$.componentName===n||$.componentName===null&&n==="Home");if(S){d.set("scenario",S.id);const $=K(S.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:$,scenarioId:S.id})}).catch(()=>{}),G(B=>B+1),I(!1)}else d.delete("scenario")}else d.delete("zoom"),d.delete("scenario");p(d)},[o,p,u]),de=a.useCallback(n=>{_(null),q(null),O(null);const d=new URLSearchParams(o);d.set("scenario",n.id),p(d);const S=K(n.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:S,scenarioId:n.id})}).catch(()=>{}),G($=>$+1),I(!1)},[o,p]),Ge=(n,d)=>{Ne(n);const S=X.find($=>$.width===n&&$.height===d);te({name:(S==null?void 0:S.name)||"Custom",width:n,height:d})},ke=n=>{Ne(n.width),te({name:n.name,width:n.width,height:n.height})},Ye=n=>{He(n,L.width,L.height??900),se(!1),te(d=>({...d,name:n}))},Ke=()=>{P||I(!0)},qe=a.useCallback(()=>{j(null),t(!0),fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"restart"})}).catch(()=>{})},[]),Qe=a.useCallback(()=>{j(null),t(!0),fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"start"})}).catch(()=>{})},[]),U=a.useMemo(()=>Ct({activeAnalyzedScenario:!!P,analyzedPreviewUrl:pe,activeScenarioId:M||null,scenarios:u,proxyUrl:A,devServerUrl:R,zoomComponent:E||null}),[A,R,E,M,u,P,pe]),Xe=a.useMemo(()=>{if(!U||!oe)return U;try{const n=new URL(U);return n.pathname=oe,n.href}catch{return U}},[U,oe]);return e.jsxs("div",{className:"fixed inset-0 bg-[#2d2d2d] flex flex-col",children:[P&&e.jsx(Pt,{analysisId:P.analysisId,scenarioId:P.scenarioId,scenarioName:P.scenarioName,entityName:P.entityName,projectSlug:s,onStateChange:Ie},P.analysisId),e.jsx("div",{className:"bg-[#3d3d3d] h-12 flex items-center px-4 gap-4 shrink-0 z-20",children:e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("img",{src:ct,alt:"CodeYam",className:"h-6 brightness-0 invert"}),e.jsx("span",{className:"text-white font-medium text-sm whitespace-nowrap",children:"Editor"}),E&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-4 bg-gray-600"}),e.jsx(Nt,{items:Ve,onNavigate:ce})]}),e.jsx("span",{className:"bg-[#005c75] text-white text-[10px] font-bold px-2 py-0.5 rounded uppercase tracking-wider ml-auto",children:"Code + Data"})]})}),e.jsxs("div",{className:"flex-1 flex min-h-0",children:[e.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[e.jsxs("div",{className:"bg-[#e5e7eb] border-b border-[rgba(0,0,0,0.1)] shrink-0 z-10 h-6 flex items-center justify-center relative",children:[e.jsx("div",{className:"absolute inset-0 flex justify-center",children:e.jsx("div",{style:{maxWidth:`${he[he.length-1].width}px`,width:"100%"},children:e.jsx(rt,{currentViewportWidth:Le,currentPresetName:L.name,onDevicePresetClick:ke,devicePresets:X,hideLabel:!0,onHoverChange:Re,lightMode:!0})})}),e.jsxs("div",{className:"relative z-10 flex items-center gap-2",children:[e.jsxs("div",{className:"relative w-28 h-5",children:[e.jsxs("div",{className:"absolute inset-0 bg-white text-gray-900 text-xs px-2 rounded flex items-center justify-between pointer-events-none border border-gray-300",children:[e.jsx("span",{className:"leading-none",children:(ae==null?void 0:ae.name)||L.name}),e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e.jsxs("select",{value:L.name,onChange:n=>{const d=X.find(S=>S.name===n.target.value);d&&ke(d)},className:"relative w-full h-full opacity-0 cursor-pointer",children:[X.map(n=>e.jsx("option",{value:n.name,children:n.name},n.name)),L.name==="Custom"&&e.jsx("option",{value:"Custom",children:"Custom"})]})]}),e.jsx("input",{type:"number",value:L.width,onChange:n=>{const d=parseInt(n.target.value,10);!isNaN(d)&&d>0&&Ge(d,L.height??900)},className:"bg-white text-gray-900 text-xs px-1 rounded border border-gray-300 outline-none w-16 text-center h-5 leading-none",min:"200",max:"3840"}),e.jsx("span",{className:"text-gray-400 text-xs h-5 flex items-center leading-none",children:"x"}),e.jsx("span",{className:"bg-gray-100 text-gray-600 text-xs px-1 rounded w-14 text-center h-5 flex items-center justify-center leading-none",children:L.height??900}),L.name==="Custom"&&e.jsx("button",{onClick:()=>se(!0),className:"bg-white text-gray-900 text-xs px-2 rounded h-5 flex items-center leading-none border border-gray-300 hover:bg-gray-50 transition-colors",children:"Save"})]})]}),e.jsx("div",{ref:g,className:"flex-1 flex items-center justify-center overflow-hidden p-8",style:{backgroundImage:`
|
|
4
|
-
linear-gradient(45deg, #ebebeb 25%, transparent 25%),
|
|
5
|
-
linear-gradient(-45deg, #ebebeb 25%, transparent 25%),
|
|
6
|
-
linear-gradient(45deg, transparent 75%, #ebebeb 75%),
|
|
7
|
-
linear-gradient(-45deg, transparent 75%, #ebebeb 75%)
|
|
8
|
-
`,backgroundSize:"16px 16px",backgroundPosition:"0 0, 0 8px, 8px -8px, -8px 0px",backgroundColor:"#fafafa"},children:D?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:D.screenshotUrl,alt:D.scenarioName,className:"max-w-full h-auto block"})}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-[#666]",children:[D.commitSha&&e.jsx("span",{className:"font-mono text-xs text-[#00a0c4] bg-[#00a0c4]/15 px-2 py-0.5 rounded",children:D.commitSha.slice(0,7)}),e.jsxs("span",{className:"truncate",children:[D.scenarioName,D.commitMessage&&` — ${D.commitMessage}`]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:()=>O(null),className:"text-sm text-[#888] hover:text-[#333] transition-colors cursor-pointer px-3 py-1.5 rounded border border-[#ccc] hover:border-[#999] bg-white",children:"Back to live preview"}),D.commitSha&&e.jsx("button",{onClick:()=>{ge(!0),Q(null),fetch("/api/editor-load-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commitSha:D.commitSha})}).then(n=>n.json()).then(n=>{n.success?(O(null),t(!0),I(!1)):Q(n.error||"Failed to load commit")}).catch(n=>{Q(n instanceof Error?n.message:"Network error")}).finally(()=>{ge(!1)})},disabled:fe,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:fe?"Loading...":"Load this version"})]}),je&&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:je})]}):U?e.jsx("div",{style:{width:`${L.width*H}px`,height:`${(L.height??900)*H}px`},children:e.jsxs("div",{className:"relative bg-white origin-top-left",style:{width:`${L.width}px`,height:`${L.height??900}px`,transform:H<1?`scale(${H})`:void 0},children:[!y&&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(Pe,{})}),e.jsxs("div",{className:"flex flex-col gap-3 text-center",children:[e.jsx("h2",{className:"text-xl font-medium text-black leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Loading Preview"}),e.jsx("p",{className:"text-sm text-[#666] leading-5 m-0 font-['IBM_Plex_Sans']",children:"Waiting for the app to render"})]})]})}),e.jsx("iframe",{ref:k,src:Xe||U,className:"w-full h-full border-none",title:"Editor preview",onLoad:Ke,style:{opacity:y?1:0}},We)]})}):e.jsx("div",{className:"bg-white rounded-lg shadow-sm flex flex-col items-center justify-center",style:{width:`${L.width*H}px`,height:`${(L.height??900)*H}px`},children:m?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-600 leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Dev Server Failed"}),e.jsx("pre",{className:"text-xs text-left bg-gray-100 text-gray-800 p-4 rounded overflow-auto max-h-[300px] w-full font-mono whitespace-pre-wrap",children:m}),e.jsx("button",{onClick:qe,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"})]}):C||ee?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-4",children:e.jsx(Pe,{})}),e.jsxs("div",{className:"flex flex-col gap-3 text-center",children:[e.jsx("h2",{className:"text-xl font-medium text-black leading-[28px] m-0 font-['IBM_Plex_Sans']",children:ee?"Starting Interactive Mode":"Starting Dev Server"}),e.jsx("p",{className:"text-sm text-[#666] leading-5 m-0 font-['IBM_Plex_Sans']",children:ee?"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-black leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Code + Data Editor"}),e.jsx("p",{className:"text-sm text-[#888] leading-5 m-0 font-['IBM_Plex_Sans']",children:"Describe what you want to build in the chat"})]})})})]}),e.jsxs("aside",{className:"w-[50%] min-w-[400px] max-w-[800px] bg-[#1e1e1e] border-r border-[#3d3d3d] shrink-0 flex flex-col overflow-hidden order-first",children:[e.jsxs("div",{className:"border-b border-[#3d3d3d] px-4 shrink-0 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-0",children:[e.jsxs("button",{onClick:()=>W("app"),className:`px-3 py-2 text-xs font-medium transition-colors relative cursor-pointer ${T==="app"?"text-white":"text-gray-500 hover:text-gray-300"}`,children:["App",T==="app"&&e.jsx("span",{className:"absolute bottom-0 left-3 right-3 h-0.5 bg-[#005c75]"})]}),e.jsxs("button",{onClick:()=>{W("build"),ne(!0)},className:`px-3 py-2 text-xs font-medium transition-colors relative cursor-pointer ${T==="build"?"text-white":"text-gray-500 hover:text-gray-300"}`,children:["Build",Ae&&T!=="build"&&e.jsx("span",{className:"ml-1.5 inline-block w-2 h-2 rounded-full bg-amber-400 animate-pulse"}),T==="build"&&e.jsx("span",{className:"absolute bottom-0 left-3 right-3 h-0.5 bg-[#005c75]"})]}),e.jsxs("button",{onClick:()=>W("data"),className:`px-3 py-2 text-xs font-medium transition-colors relative cursor-pointer ${T==="data"?"text-white":"text-gray-500 hover:text-gray-300"}`,children:["Data",T==="data"&&e.jsx("span",{className:"absolute bottom-0 left-3 right-3 h-0.5 bg-[#005c75]"})]}),e.jsxs("button",{onClick:()=>W("journal"),className:`px-3 py-2 text-xs font-medium transition-colors relative cursor-pointer ${T==="journal"?"text-white":"text-gray-500 hover:text-gray-300"}`,children:["Journal",T==="journal"&&e.jsx("span",{className:"absolute bottom-0 left-3 right-3 h-0.5 bg-[#005c75]"})]})]}),typeof Notification<"u"&&e.jsx("button",{onClick:Fe,className:`px-2 py-1 text-[10px] rounded transition-colors cursor-pointer ${J?"text-green-400 hover:text-green-300":"text-gray-500 hover:text-gray-300"}`,title:J?"Click to turn off notifications":"Click to get notified when Claude finishes",children:J?"Notifications On":"Notifications Off"})]}),e.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[Be&&e.jsxs("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:T==="build"?"visible":"hidden"},children:[e.jsx("div",{className:re?"flex-1 min-h-0":"flex-1",style:re?{flex:"1 1 50%"}:void 0,children:e.jsx(lt,{ref:b,entityName:"Editor",projectSlug:s,entityFilePath:null,scenarioName:null,onRefreshPreview:Je,onShowResults:De,editorMode:!0,onIdleChange:_e,notificationsEnabled:J})}),re&&e.jsx("div",{style:{flex:"1 1 50%"},className:"min-h-0 border-t-2 border-gray-300",children:e.jsx(St,{scenarios:u,glossaryFunctions:v,projectRoot:i,activeScenarioId:M,onScenarioSelect:de,onClose:Ue})})]}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:T==="app"?"visible":"hidden"},children:e.jsx(vt,{hasProject:l,scenarios:u,analyzedEntities:[],glossaryFunctions:v,projectRoot:i,activeScenarioId:M,onScenarioSelect:de,onAnalyzedScenarioSelect:ve,onSwitchToBuild:ze,zoomComponent:E,onZoomChange:ce,entityImports:h})}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:T==="data"?"visible":"hidden"},children:e.jsx(xt,{scenarios:u,projectRoot:i,activeScenarioId:M,onScenarioSelect:de,zoomComponent:E,onZoomChange:ce,analyzedEntities:[],glossaryFunctions:v,activeAnalyzedScenarioId:P==null?void 0:P.scenarioId,onAnalyzedScenarioSelect:ve,entityImports:h})}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:T==="journal"?"visible":"hidden"},children:e.jsx(gt,{isActive:T==="journal",onScreenshotClick:Ee})})]})]})]}),e.jsx(ot,{serverUrl:R,isStarting:C,projectSlug:s,devServerError:m,onStartServer:w?Qe:void 0}),Te&&e.jsx(it,{width:L.width,height:L.height??900,onSave:Ye,onCancel:()=>se(!1)})]})});export{Bt as default,zt as meta};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var un=Object.defineProperty;var hn=(e,t,n)=>t in e?un(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var G=(e,t,n)=>hn(e,typeof t!="symbol"?t+"":t,n);import{r as R,d as $t,g as pn,j as l,w as mn,u as gn,b as xn}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{u as yn}from"./useReportContext-O-jkvSPx.js";import{F as Vt,b as zt,E as Pt,S as Gt,u as vn,C as bn,a as wn}from"./EntityItem-C76mRRiF.js";import{L as Cn}from"./LogViewer-ceAyBX-H.js";import{g as Ht}from"./fileTableUtils-cPo8LiG3.js";import"./createLucideIcon-CMT1jU2q.js";import"./useToast-9FIWuYfK.js";import"./TruncatedFilePath-C8OKAR5x.js";import"./SafeScreenshot-BED4B6sP.js";import"./LibraryFunctionPreview-DLeucoVX.js";import"./scenarioStatus-B_8jpV3e.js";import"./triangle-alert-DtSmdtM4.js";import"./EntityTypeIcon-CobE682z.js";import"./EntityTypeBadge-g3saevPb.js";function Nn(e,t,n=10){var c;const r=new Map,i=d=>d.entityType==="visual"||d.entityType==="library";for(const d of e)i(d)&&r.set(d.sha,{entity:d,depth:0});const s=new Map;for(const d of t){const f=(c=d.metadata)==null?void 0:c.importedBy;if(f)for(const u of Object.keys(f))for(const h of Object.keys(f[u])){const{shas:b}=f[u][h];for(const g of b)s.has(d.sha)||s.set(d.sha,new Set),s.get(d.sha).add(g)}}const o=[],a=new Set;for(const d of e)o.push({sha:d.sha,depth:0}),a.add(d.sha);for(;o.length>0;){const{sha:d,depth:f}=o.shift();if(f>=n)continue;const u=s.get(d);if(u)for(const h of u){if(a.has(h))continue;a.add(h);const b=t.find(g=>g.sha===h);if(b){if(i(b)){const g=f+1,p=r.get(h);(!p||g<p.depth)&&r.set(h,{entity:b,depth:g})}o.push({sha:h,depth:f+1})}}}return Array.from(r.values()).sort((d,f)=>d.depth!==f.depth?d.depth-f.depth:d.entity.name.localeCompare(f.entity.name))}function Le(e){const t=new Map;for(const r of e)t.has(r.name)||t.set(r.name,[]),t.get(r.name).push(r);const n=[];for(const r of t.values())if(r.length===1)n.push(r[0]);else{const i=r.sort((s,o)=>{var d,f;const a=((d=s.metadata)==null?void 0:d.editedAt)||s.createdAt||"";return(((f=o.metadata)==null?void 0:f.editedAt)||o.createdAt||"").localeCompare(a)});n.push(i[0])}return n}function jn(e,t){const n=new Map,r=new Set(e.map(i=>i.path));for(const i of e)i.status==="renamed"&&i.oldPath&&r.add(i.oldPath);for(const i of e){const s=t.filter(c=>c.filePath===i.path||i.status==="renamed"&&i.oldPath&&c.filePath===i.oldPath),o=s.filter(c=>{var d,f;return r.has(c.filePath)&&((d=c.metadata)==null?void 0:d.isUncommitted)&&!((f=c.metadata)!=null&&f.isSuperseded)}),a=Le(o);n.set(i.path,{status:i,entities:s,editedEntities:a})}return n}function Sn(e,t,n){const r=new Map;if(!n){for(const s of e)if(s.status==="deleted")r.set(s.path,{status:s,entities:[]});else{const o=t.filter(c=>c.filePath===s.path||s.status==="renamed"&&s.oldPath&&c.filePath===s.oldPath),a=Le(o);r.set(s.path,{status:s,entities:a})}return r}const i=new Map;for(const s of n.fileComparisons){const o=new Set;for(const a of s.newEntities)o.add(a.name);for(const a of s.modifiedEntities)o.add(a.name);for(const a of s.deletedEntities)o.add(a.name);o.size>0&&i.set(s.filePath,o)}for(const s of e){const o=i.get(s.path);if(s.status==="deleted")r.set(s.path,{status:s,entities:[]});else{const a=o?t.filter(d=>(d.filePath===s.path||s.status==="renamed"&&s.oldPath&&d.filePath===s.oldPath)&&o.has(d.name)):[],c=Le(a);r.set(s.path,{status:s,entities:c})}}return r}function kn(e,t){const n=new Map,r=Ln(e,t);for(const i of r){const o=Nn([i],t).filter(({depth:a})=>a>0);n.set(i.sha,o)}return n}function Ln(e,t){const n=new Set(e.map(i=>i.path));for(const i of e)i.status==="renamed"&&i.oldPath&&n.add(i.oldPath);const r=t.filter(i=>{var s,o;return n.has(i.filePath)&&((s=i.metadata)==null?void 0:s.isUncommitted)&&!((o=i.metadata)!=null&&o.isSuperseded)});return Le(r)}function An(e,t,n){const[r,i]=R.useState(()=>new Set),[s,o]=R.useState(()=>new Set),a=R.useRef([]),c=R.useRef([]);return R.useEffect(()=>{(t.length!==a.current.length||t.some((p,C)=>p!==a.current[C]))&&(a.current=t,i(p=>{const C=new Set;return t.forEach(w=>{p.has(w)&&C.add(w)}),C}))},[t]),R.useEffect(()=>{(n.length!==c.current.length||n.some((p,C)=>p!==c.current[C]))&&(c.current=n,o(p=>{const C=new Set;return n.forEach(w=>{p.has(w)&&C.add(w)}),C}))},[n]),{expandedUncommitted:r,expandedBranch:s,setExpandedUncommitted:i,setExpandedBranch:o,toggleFile:(g,p,C)=>{C(w=>{const N=new Set(w);return N.has(g)?N.delete(g):N.add(g),N})},expandAllUncommitted:()=>{i(new Set(t))},collapseAllUncommitted:()=>{i(new Set)},expandAllBranch:()=>{o(new Set(n))},collapseAllBranch:()=>{o(new Set)}}}function En(e,t,n){const[r,i]=R.useState(null),[s,o]=R.useState(null),a=$t();R.useEffect(()=>{var u,h;((u=a.data)==null?void 0:u.oldContent)!==void 0&&((h=a.data)==null?void 0:h.newContent)!==void 0&&o({oldContent:a.data.oldContent,newContent:a.data.newContent,fileName:a.data.fileName})},[a.data]);const c=u=>{i({type:"file",path:u}),o(null);const h=new FormData;h.append("actionType","getDiff"),h.append("filePath",u),h.append("diffType","branch"),h.append("baseBranch",e),h.append("currentBranch",t||""),a.submit(h,{method:"post"})},d=(u,h)=>{i({type:"entity",path:u,entitySha:h}),o(null);const b=new FormData;b.append("actionType","getDiff"),b.append("filePath",u),b.append("diffType","branch"),b.append("baseBranch",e),b.append("currentBranch",t||""),b.append("entitySha",h),a.submit(b,{method:"post"})},f=()=>{i(null),o(null)};return{diffView:r,diffContent:s,isLoading:a.state==="loading"||a.state==="submitting",handleShowFileDiff:c,handleShowEntityDiff:d,handleCloseDiff:f}}var Ge={exports:{}};/*!
|
|
2
|
-
Copyright (c) 2018 Jed Watson.
|
|
3
|
-
Licensed under the MIT License (MIT), see
|
|
4
|
-
http://jedwatson.github.io/classnames
|
|
5
|
-
*/var pt;function Bn(){return pt||(pt=1,(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var s="",o=0;o<arguments.length;o++){var a=arguments[o];a&&(s=i(s,r(a)))}return s}function r(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return n.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var o="";for(var a in s)t.call(s,a)&&s[a]&&(o=i(o,a));return o}function i(s,o){return o?s?s+" "+o:s+o:s}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Ge)),Ge.exports}var Fn=Bn();const U=pn(Fn);var mt=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function Tn(e,t){return!!(e===t||mt(e)&&mt(t))}function Dn(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!Tn(e[n],t[n]))return!1;return!0}function Mn(e,t){t===void 0&&(t=Dn);var n=null;function r(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];if(n&&n.lastThis===this&&t(i,n.lastArgs))return n.lastResult;var o=e.apply(this,i);return n={lastResult:o,lastArgs:i,lastThis:this},o}return r.clear=function(){n=null},r}function Rn(e,t,n){let r=0,i;const s={},o=[];return e.forEach((a,c)=>{const d=t.some(f=>f>=c-n&&f<=c+n);!d&&i===void 0?(i={index:r,startLine:c,endLine:c,lines:1},o.push(i),s[c]=i.index,r++):!d&&i?(i.endLine=c,i.lines++,s[c]=i.index):i=void 0}),{lineBlocks:s,blocks:o}}function X(){}X.prototype={diff:function(t,n){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=i.callback;typeof i=="function"&&(s=i,i={}),this.options=i;var o=this;function a(x){return s?(setTimeout(function(){s(void 0,x)},0),!0):x}t=this.castInput(t),n=this.castInput(n),t=this.removeEmpty(this.tokenize(t)),n=this.removeEmpty(this.tokenize(n));var c=n.length,d=t.length,f=1,u=c+d;i.maxEditLength&&(u=Math.min(u,i.maxEditLength));var h=(r=i.timeout)!==null&&r!==void 0?r:1/0,b=Date.now()+h,g=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(g[0],n,t,0);if(g[0].oldPos+1>=d&&p+1>=c)return a([{value:this.join(n),count:n.length}]);var C=-1/0,w=1/0;function N(){for(var x=Math.max(C,-f);x<=Math.min(w,f);x+=2){var v=void 0,y=g[x-1],m=g[x+1];y&&(g[x-1]=void 0);var A=!1;if(m){var E=m.oldPos-x;A=m&&0<=E&&E<c}var B=y&&y.oldPos+1<d;if(!A&&!B){g[x]=void 0;continue}if(!B||A&&y.oldPos+1<m.oldPos?v=o.addToPath(m,!0,void 0,0):v=o.addToPath(y,void 0,!0,1),p=o.extractCommon(v,n,t,x),v.oldPos+1>=d&&p+1>=c)return a(On(o,v.lastComponent,n,t,o.useLongestToken));g[x]=v,v.oldPos+1>=d&&(w=Math.min(w,x-1)),p+1>=c&&(C=Math.max(C,x+1))}f++}if(s)(function x(){setTimeout(function(){if(f>u||Date.now()>b)return s();N()||x()},0)})();else for(;f<=u&&Date.now()<=b;){var j=N();if(j)return j}},addToPath:function(t,n,r,i){var s=t.lastComponent;return s&&s.added===n&&s.removed===r?{oldPos:t.oldPos+i,lastComponent:{count:s.count+1,added:n,removed:r,previousComponent:s.previousComponent}}:{oldPos:t.oldPos+i,lastComponent:{count:1,added:n,removed:r,previousComponent:s}}},extractCommon:function(t,n,r,i){for(var s=n.length,o=r.length,a=t.oldPos,c=a-i,d=0;c+1<s&&a+1<o&&this.equals(n[c+1],r[a+1]);)c++,a++,d++;return d&&(t.lastComponent={count:d,previousComponent:t.lastComponent}),t.oldPos=a,c},equals:function(t,n){return this.options.comparator?this.options.comparator(t,n):t===n||this.options.ignoreCase&&t.toLowerCase()===n.toLowerCase()},removeEmpty:function(t){for(var n=[],r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n},castInput:function(t){return t},tokenize:function(t){return t.split("")},join:function(t){return t.join("")}};function On(e,t,n,r,i){for(var s=[],o;t;)s.push(t),o=t.previousComponent,delete t.previousComponent,t=o;s.reverse();for(var a=0,c=s.length,d=0,f=0;a<c;a++){var u=s[a];if(u.removed){if(u.value=e.join(r.slice(f,f+u.count)),f+=u.count,a&&s[a-1].added){var b=s[a-1];s[a-1]=s[a],s[a]=b}}else{if(!u.added&&i){var h=n.slice(d,d+u.count);h=h.map(function(p,C){var w=r[f+C];return w.length>p.length?w:p}),u.value=e.join(h)}else u.value=e.join(n.slice(d,d+u.count));d+=u.count,u.added||(f+=u.count)}}var g=s[c-1];return c>1&&typeof g.value=="string"&&(g.added||g.removed)&&e.equals("",g.value)&&(s[c-2].value+=g.value,s.pop()),s}var In=new X;function $n(e,t,n){return In.diff(e,t,n)}function Wt(e,t){if(typeof e=="function")t.callback=e;else if(e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}var gt=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,xt=/\S/,Te=new X;Te.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!xt.test(e)&&!xt.test(t)};Te.tokenize=function(e){for(var t=e.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;n<t.length-1;n++)!t[n+1]&&t[n+2]&>.test(t[n])&>.test(t[n+2])&&(t[n]+=t[n+2],t.splice(n+1,2),n--);return t};function Vn(e,t,n){return n=Wt(n,{ignoreWhitespace:!0}),Te.diff(e,t,n)}function zn(e,t,n){return Te.diff(e,t,n)}var De=new X;De.tokenize=function(e){this.options.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
6
|
-
`));var t=[],n=e.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var r=0;r<n.length;r++){var i=n[r];r%2&&!this.options.newlineIsToken?t[t.length-1]+=i:(this.options.ignoreWhitespace&&(i=i.trim()),t.push(i))}return t};function Ye(e,t,n){return De.diff(e,t,n)}function Pn(e,t,n){var r=Wt(n,{ignoreWhitespace:!0});return De.diff(e,t,r)}var Ut=new X;Ut.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};function Gn(e,t,n){return Ut.diff(e,t,n)}var qt=new X;qt.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function Hn(e,t,n){return qt.diff(e,t,n)}function Ne(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ne=function(t){return typeof t}:Ne=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ne(e)}function Wn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function vt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?yt(Object(n),!0).forEach(function(r){Wn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yt(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ee(e){return Un(e)||qn(e)||Zn(e)||Jn()}function Un(e){if(Array.isArray(e))return Ue(e)}function qn(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function Zn(e,t){if(e){if(typeof e=="string")return Ue(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ue(e,t)}}function Ue(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Jn(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
7
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var _n=Object.prototype.toString,fe=new X;fe.useLongestToken=!0;fe.tokenize=De.tokenize;fe.castInput=function(e){var t=this.options,n=t.undefinedReplacement,r=t.stringifyReplacer,i=r===void 0?function(s,o){return typeof o>"u"?n:o}:r;return typeof e=="string"?e:JSON.stringify(Ae(e,null,null,i),i," ")};fe.equals=function(e,t){return X.prototype.equals.call(fe,e.replace(/,([\r\n])/g,"$1"),t.replace(/,([\r\n])/g,"$1"))};function Zt(e,t,n){return fe.diff(e,t,n)}function Ae(e,t,n,r,i){t=t||[],n=n||[],r&&(e=r(i,e));var s;for(s=0;s<t.length;s+=1)if(t[s]===e)return n[s];var o;if(_n.call(e)==="[object Array]"){for(t.push(e),o=new Array(e.length),n.push(o),s=0;s<e.length;s+=1)o[s]=Ae(e[s],t,n,r,i);return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),Ne(e)==="object"&&e!==null){t.push(e),o={},n.push(o);var a=[],c;for(c in e)e.hasOwnProperty(c)&&a.push(c);for(a.sort(),s=0;s<a.length;s+=1)c=a[s],o[c]=Ae(e[c],t,n,r,c);t.pop(),n.pop()}else o=e;return o}var Ee=new X;Ee.tokenize=function(e){return e.slice()};Ee.join=Ee.removeEmpty=function(e){return e};function Yn(e,t,n){return Ee.diff(e,t,n)}function Me(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=e.split(/\r\n|[\n\v\f\r\x85]/),r=e.match(/\r\n|[\n\v\f\r\x85]/g)||[],i=[],s=0;function o(){var d={};for(i.push(d);s<n.length;){var f=n[s];if(/^(\-\-\-|\+\+\+|@@)\s/.test(f))break;var u=/^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(f);u&&(d.index=u[1]),s++}for(a(d),a(d),d.hunks=[];s<n.length;){var h=n[s];if(/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(h))break;if(/^@@/.test(h))d.hunks.push(c());else{if(h&&t.strict)throw new Error("Unknown line "+(s+1)+" "+JSON.stringify(h));s++}}}function a(d){var f=/^(---|\+\+\+)\s+(.*)$/.exec(n[s]);if(f){var u=f[1]==="---"?"old":"new",h=f[2].split(" ",2),b=h[0].replace(/\\\\/g,"\\");/^".*"$/.test(b)&&(b=b.substr(1,b.length-2)),d[u+"FileName"]=b,d[u+"Header"]=(h[1]||"").trim(),s++}}function c(){var d=s,f=n[s++],u=f.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/),h={oldStart:+u[1],oldLines:typeof u[2]>"u"?1:+u[2],newStart:+u[3],newLines:typeof u[4]>"u"?1:+u[4],lines:[],linedelimiters:[]};h.oldLines===0&&(h.oldStart+=1),h.newLines===0&&(h.newStart+=1);for(var b=0,g=0;s<n.length&&!(n[s].indexOf("--- ")===0&&s+2<n.length&&n[s+1].indexOf("+++ ")===0&&n[s+2].indexOf("@@")===0);s++){var p=n[s].length==0&&s!=n.length-1?" ":n[s][0];if(p==="+"||p==="-"||p===" "||p==="\\")h.lines.push(n[s]),h.linedelimiters.push(r[s]||`
|
|
8
|
-
`),p==="+"?b++:p==="-"?g++:p===" "&&(b++,g++);else break}if(!b&&h.newLines===1&&(h.newLines=0),!g&&h.oldLines===1&&(h.oldLines=0),t.strict){if(b!==h.newLines)throw new Error("Added line count did not match for hunk at line "+(d+1));if(g!==h.oldLines)throw new Error("Removed line count did not match for hunk at line "+(d+1))}return h}for(;s<n.length;)o();return i}function Xn(e,t,n){var r=!0,i=!1,s=!1,o=1;return function a(){if(r&&!s){if(i?o++:r=!1,e+o<=n)return o;s=!0}if(!i)return s||(r=!0),t<=e-o?-o++:(i=!0,a())}}function Jt(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(typeof t=="string"&&(t=Me(t)),Array.isArray(t)){if(t.length>1)throw new Error("applyPatch only works with a single input.");t=t[0]}var r=e.split(/\r\n|[\n\v\f\r\x85]/),i=e.match(/\r\n|[\n\v\f\r\x85]/g)||[],s=t.hunks,o=n.compareLine||function(I,V,te,Z){return V===Z},a=0,c=n.fuzzFactor||0,d=0,f=0,u,h;function b(I,V){for(var te=0;te<I.lines.length;te++){var Z=I.lines[te],se=Z.length>0?Z[0]:" ",ae=Z.length>0?Z.substr(1):Z;if(se===" "||se==="-"){if(!o(V+1,r[V],se,ae)&&(a++,a>c))return!1;V++}}return!0}for(var g=0;g<s.length;g++){for(var p=s[g],C=r.length-p.oldLines,w=0,N=f+p.oldStart-1,j=Xn(N,d,C);w!==void 0;w=j())if(b(p,N+w)){p.offset=f+=w;break}if(w===void 0)return!1;d=p.offset+p.oldStart+p.oldLines}for(var x=0,v=0;v<s.length;v++){var y=s[v],m=y.oldStart+y.offset+x-1;x+=y.newLines-y.oldLines;for(var A=0;A<y.lines.length;A++){var E=y.lines[A],B=E.length>0?E[0]:" ",T=E.length>0?E.substr(1):E,F=y.linedelimiters&&y.linedelimiters[A]||`
|
|
9
|
-
`;if(B===" ")m++;else if(B==="-")r.splice(m,1),i.splice(m,1);else if(B==="+")r.splice(m,0,T),i.splice(m,0,F),m++;else if(B==="\\"){var k=y.lines[A-1]?y.lines[A-1][0]:null;k==="+"?u=!0:k==="-"&&(h=!0)}}}if(u)for(;!r[r.length-1];)r.pop(),i.pop();else h&&(r.push(""),i.push(`
|
|
10
|
-
`));for(var S=0;S<r.length-1;S++)r[S]=r[S]+i[S];return r.join("")}function Kn(e,t){typeof e=="string"&&(e=Me(e));var n=0;function r(){var i=e[n++];if(!i)return t.complete();t.loadFile(i,function(s,o){if(s)return t.complete(s);var a=Jt(o,i,t);t.patched(i,a,function(c){if(c)return t.complete(c);r()})})}r()}function Xe(e,t,n,r,i,s,o){o||(o={}),typeof o.context>"u"&&(o.context=4);var a=Ye(n,r,o);if(!a)return;a.push({value:"",lines:[]});function c(w){return w.map(function(N){return" "+N})}for(var d=[],f=0,u=0,h=[],b=1,g=1,p=function(N){var j=a[N],x=j.lines||j.value.replace(/\n$/,"").split(`
|
|
11
|
-
`);if(j.lines=x,j.added||j.removed){var v;if(!f){var y=a[N-1];f=b,u=g,y&&(h=o.context>0?c(y.lines.slice(-o.context)):[],f-=h.length,u-=h.length)}(v=h).push.apply(v,ee(x.map(function(S){return(j.added?"+":"-")+S}))),j.added?g+=x.length:b+=x.length}else{if(f)if(x.length<=o.context*2&&N<a.length-2){var m;(m=h).push.apply(m,ee(c(x)))}else{var A,E=Math.min(x.length,o.context);(A=h).push.apply(A,ee(c(x.slice(0,E))));var B={oldStart:f,oldLines:b-f+E,newStart:u,newLines:g-u+E,lines:h};if(N>=a.length-2&&x.length<=o.context){var T=/\n$/.test(n),F=/\n$/.test(r),k=x.length==0&&h.length>B.oldLines;!T&&k&&n.length>0&&h.splice(B.oldLines,0,"\"),(!T&&!k||!F)&&h.push("\")}d.push(B),f=0,u=0,h=[]}b+=x.length,g+=x.length}},C=0;C<a.length;C++)p(C);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:s,hunks:d}}function Ke(e){if(Array.isArray(e))return e.map(Ke).join(`
|
|
12
|
-
`);var t=[];e.oldFileName==e.newFileName&&t.push("Index: "+e.oldFileName),t.push("==================================================================="),t.push("--- "+e.oldFileName+(typeof e.oldHeader>"u"?"":" "+e.oldHeader)),t.push("+++ "+e.newFileName+(typeof e.newHeader>"u"?"":" "+e.newHeader));for(var n=0;n<e.hunks.length;n++){var r=e.hunks[n];r.oldLines===0&&(r.oldStart-=1),r.newLines===0&&(r.newStart-=1),t.push("@@ -"+r.oldStart+","+r.oldLines+" +"+r.newStart+","+r.newLines+" @@"),t.push.apply(t,r.lines)}return t.join(`
|
|
13
|
-
`)+`
|
|
14
|
-
`}function _t(e,t,n,r,i,s,o){return Ke(Xe(e,t,n,r,i,s,o))}function Qn(e,t,n,r,i,s){return _t(e,e,t,n,r,i,s)}function er(e,t){return e.length!==t.length?!1:qe(e,t)}function qe(e,t){if(t.length>e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function tr(e){var t=Ze(e.lines),n=t.oldLines,r=t.newLines;n!==void 0?e.oldLines=n:delete e.oldLines,r!==void 0?e.newLines=r:delete e.newLines}function nr(e,t,n){e=bt(e,n),t=bt(t,n);var r={};(e.index||t.index)&&(r.index=e.index||t.index),(e.newFileName||t.newFileName)&&(wt(e)?wt(t)?(r.oldFileName=we(r,e.oldFileName,t.oldFileName),r.newFileName=we(r,e.newFileName,t.newFileName),r.oldHeader=we(r,e.oldHeader,t.oldHeader),r.newHeader=we(r,e.newHeader,t.newHeader)):(r.oldFileName=e.oldFileName,r.newFileName=e.newFileName,r.oldHeader=e.oldHeader,r.newHeader=e.newHeader):(r.oldFileName=t.oldFileName||e.oldFileName,r.newFileName=t.newFileName||e.newFileName,r.oldHeader=t.oldHeader||e.oldHeader,r.newHeader=t.newHeader||e.newHeader)),r.hunks=[];for(var i=0,s=0,o=0,a=0;i<e.hunks.length||s<t.hunks.length;){var c=e.hunks[i]||{oldStart:1/0},d=t.hunks[s]||{oldStart:1/0};if(Ct(c,d))r.hunks.push(Nt(c,o)),i++,a+=c.newLines-c.oldLines;else if(Ct(d,c))r.hunks.push(Nt(d,a)),s++,o+=d.newLines-d.oldLines;else{var f={oldStart:Math.min(c.oldStart,d.oldStart),oldLines:0,newStart:Math.min(c.newStart+o,d.oldStart+a),newLines:0,lines:[]};rr(f,c.oldStart,c.lines,d.oldStart,d.lines),s++,i++,r.hunks.push(f)}}return r}function bt(e,t){if(typeof e=="string"){if(/^@@/m.test(e)||/^Index:/m.test(e))return Me(e)[0];if(!t)throw new Error("Must provide a base reference or pass in a patch");return Xe(void 0,void 0,t,e)}return e}function wt(e){return e.newFileName&&e.newFileName!==e.oldFileName}function we(e,t,n){return t===n?t:(e.conflict=!0,{mine:t,theirs:n})}function Ct(e,t){return e.oldStart<t.oldStart&&e.oldStart+e.oldLines<t.oldStart}function Nt(e,t){return{oldStart:e.oldStart,oldLines:e.oldLines,newStart:e.newStart+t,newLines:e.newLines,lines:e.lines}}function rr(e,t,n,r,i){var s={offset:t,lines:n,index:0},o={offset:r,lines:i,index:0};for(St(e,s,o),St(e,o,s);s.index<s.lines.length&&o.index<o.lines.length;){var a=s.lines[s.index],c=o.lines[o.index];if((a[0]==="-"||a[0]==="+")&&(c[0]==="-"||c[0]==="+"))sr(e,s,o);else if(a[0]==="+"&&c[0]===" "){var d;(d=e.lines).push.apply(d,ee(oe(s)))}else if(c[0]==="+"&&a[0]===" "){var f;(f=e.lines).push.apply(f,ee(oe(o)))}else a[0]==="-"&&c[0]===" "?jt(e,s,o):c[0]==="-"&&a[0]===" "?jt(e,o,s,!0):a===c?(e.lines.push(a),s.index++,o.index++):Qe(e,oe(s),oe(o))}kt(e,s),kt(e,o),tr(e)}function sr(e,t,n){var r=oe(t),i=oe(n);if(Lt(r)&&Lt(i)){if(qe(r,i)&&At(n,r,r.length-i.length)){var s;(s=e.lines).push.apply(s,ee(r));return}else if(qe(i,r)&&At(t,i,i.length-r.length)){var o;(o=e.lines).push.apply(o,ee(i));return}}else if(er(r,i)){var a;(a=e.lines).push.apply(a,ee(r));return}Qe(e,r,i)}function jt(e,t,n,r){var i=oe(t),s=ir(n,i);if(s.merged){var o;(o=e.lines).push.apply(o,ee(s.merged))}else Qe(e,r?s:i,r?i:s)}function Qe(e,t,n){e.conflict=!0,e.lines.push({conflict:!0,mine:t,theirs:n})}function St(e,t,n){for(;t.offset<n.offset&&t.index<t.lines.length;){var r=t.lines[t.index++];e.lines.push(r),t.offset++}}function kt(e,t){for(;t.index<t.lines.length;){var n=t.lines[t.index++];e.lines.push(n)}}function oe(e){for(var t=[],n=e.lines[e.index][0];e.index<e.lines.length;){var r=e.lines[e.index];if(n==="-"&&r[0]==="+"&&(n="+"),n===r[0])t.push(r),e.index++;else break}return t}function ir(e,t){for(var n=[],r=[],i=0,s=!1,o=!1;i<t.length&&e.index<e.lines.length;){var a=e.lines[e.index],c=t[i];if(c[0]==="+")break;if(s=s||a[0]!==" ",r.push(c),i++,a[0]==="+")for(o=!0;a[0]==="+";)n.push(a),a=e.lines[++e.index];c.substr(1)===a.substr(1)?(n.push(a),e.index++):o=!0}if((t[i]||"")[0]==="+"&&s&&(o=!0),o)return n;for(;i<t.length;)r.push(t[i++]);return{merged:r,changes:n}}function Lt(e){return e.reduce(function(t,n){return t&&n[0]==="-"},!0)}function At(e,t,n){for(var r=0;r<n;r++){var i=t[t.length-n+r].substr(1);if(e.lines[e.index+r]!==" "+i)return!1}return e.index+=n,!0}function Ze(e){var t=0,n=0;return e.forEach(function(r){if(typeof r!="string"){var i=Ze(r.mine),s=Ze(r.theirs);t!==void 0&&(i.oldLines===s.oldLines?t+=i.oldLines:t=void 0),n!==void 0&&(i.newLines===s.newLines?n+=i.newLines:n=void 0)}else n!==void 0&&(r[0]==="+"||r[0]===" ")&&n++,t!==void 0&&(r[0]==="-"||r[0]===" ")&&t++}),{oldLines:t,newLines:n}}function Yt(e){return Array.isArray(e)?e.map(Yt).reverse():vt(vt({},e),{},{oldFileName:e.newFileName,oldHeader:e.newHeader,newFileName:e.oldFileName,newHeader:e.oldHeader,hunks:e.hunks.map(function(t){return{oldLines:t.newLines,oldStart:t.newStart,newLines:t.oldLines,newStart:t.oldStart,linedelimiters:t.linedelimiters,lines:t.lines.map(function(n){return n.startsWith("-")?"+".concat(n.slice(1)):n.startsWith("+")?"-".concat(n.slice(1)):n})}})})}function or(e){for(var t=[],n,r,i=0;i<e.length;i++)n=e[i],n.added?r=1:n.removed?r=-1:r=0,t.push([r,n.value]);return t}function ar(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];r.added?t.push("<ins>"):r.removed&&t.push("<del>"),t.push(lr(r.value)),r.added?t.push("</ins>"):r.removed&&t.push("</del>")}return t.join("")}function lr(e){var t=e;return t=t.replace(/&/g,"&"),t=t.replace(/</g,"<"),t=t.replace(/>/g,">"),t=t.replace(/"/g,"""),t}const cr=Object.freeze(Object.defineProperty({__proto__:null,Diff:X,applyPatch:Jt,applyPatches:Kn,canonicalize:Ae,convertChangesToDMP:or,convertChangesToXML:ar,createPatch:Qn,createTwoFilesPatch:_t,diffArrays:Yn,diffChars:$n,diffCss:Hn,diffJson:Zt,diffLines:Ye,diffSentences:Gn,diffTrimmedLines:Pn,diffWords:Vn,diffWordsWithSpace:zn,formatPatch:Ke,merge:nr,parsePatch:Me,reversePatch:Yt,structuredPatch:Xe},Symbol.toStringTag,{value:"Module"})),dr=cr;var O;(function(e){e[e.DEFAULT=0]="DEFAULT",e[e.ADDED=1]="ADDED",e[e.REMOVED=2]="REMOVED",e[e.CHANGED=3]="CHANGED"})(O||(O={}));var ue;(function(e){e.CHARS="diffChars",e.WORDS="diffWords",e.WORDS_WITH_SPACE="diffWordsWithSpace",e.LINES="diffLines",e.TRIMMED_LINES="diffTrimmedLines",e.SENTENCES="diffSentences",e.CSS="diffCss",e.JSON="diffJson"})(ue||(ue={}));const Et=e=>e===""?[]:e.replace(/\n$/,"").split(`
|
|
15
|
-
`),fr=(e,t,n=ue.CHARS)=>{const i=(typeof n=="string"?dr[n]:n)(e,t),s={left:[],right:[]};return i.forEach(({added:o,removed:a,value:c})=>{const d={};return o&&(d.type=O.ADDED,d.value=c,s.right.push(d)),a&&(d.type=O.REMOVED,d.value=c,s.left.push(d)),!a&&!o&&(d.type=O.DEFAULT,d.value=c,s.right.push(d),s.left.push(d)),d}),s},ur=(e,t,n=!1,r=ue.CHARS,i=0,s=[])=>{let o=[];typeof e=="string"&&typeof t=="string"?o=Ye(e,t,{newlineIsToken:!1,ignoreWhitespace:!1,ignoreCase:!1}):o=Zt(e,t);let a=i,c=i,d=[],f=0;const u=[],h=[],b=(g,p,C,w,N)=>Et(g).map((x,v)=>{const y={},m={};if(!(h.includes(`${p}-${v}`)||N&&v!==0)){if(C||w){let A=!0;if(w){c+=1,y.lineNumber=c,y.type=O.REMOVED,y.value=x||" ";const E=o[p+1];if(E!=null&&E.added){const B=Et(E.value)[v];if(B){const T=b(B,p,!0,!1,!0),{value:F,lineNumber:k,type:S}=T[0].right;if(h.push(`${p+1}-${v}`),m.lineNumber=k,y.value===F)A=!1,m.type=0,y.type=0,m.value=F;else if(m.type=S,n)m.value=F;else{const I=fr(x,F,r);m.value=I.right,y.value=I.left}}}}else a+=1,m.lineNumber=a,m.type=O.ADDED,m.value=x;A&&!N&&(u.includes(f)||u.push(f))}else c+=1,a+=1,y.lineNumber=c,y.type=O.DEFAULT,y.value=x,m.lineNumber=a,m.type=O.DEFAULT,m.value=x;return(s!=null&&s.includes(`L-${y.lineNumber}`)||s!=null&&s.includes(`R-${m.lineNumber}`)&&!u.includes(f))&&u.push(f),N||(f+=1),{right:m,left:y}}}).filter(Boolean);return o.forEach(({added:g,removed:p,value:C},w)=>{d=[...d,...b(C,w,g,p)]}),{lineInformation:d,diffLines:u}};function hr(){return l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:"16",height:"16",children:[l.jsx("title",{children:"expand"}),l.jsx("path",{d:"m8.177.677 2.896 2.896a.25.25 0 0 1-.177.427H8.75v1.25a.75.75 0 0 1-1.5 0V4H5.104a.25.25 0 0 1-.177-.427L7.823.677a.25.25 0 0 1 .354 0ZM7.25 10.75a.75.75 0 0 1 1.5 0V12h2.146a.25.25 0 0 1 .177.427l-2.896 2.896a.25.25 0 0 1-.354 0l-2.896-2.896A.25.25 0 0 1 5.104 12H7.25v-1.25Zm-5-2a.75.75 0 0 0 0-1.5h-.5a.75.75 0 0 0 0 1.5h.5ZM6 8a.75.75 0 0 1-.75.75h-.5a.75.75 0 0 1 0-1.5h.5A.75.75 0 0 1 6 8Zm2.25.75a.75.75 0 0 0 0-1.5h-.5a.75.75 0 0 0 0 1.5h.5ZM12 8a.75.75 0 0 1-.75.75h-.5a.75.75 0 0 1 0-1.5h.5A.75.75 0 0 1 12 8Zm2.25.75a.75.75 0 0 0 0-1.5h-.5a.75.75 0 0 0 0 1.5h.5Z"})]})}function pr(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}function mr(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),e.nonce!==void 0&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}var gr=(function(){function e(n){var r=this;this._insertTag=function(i){var s;r.tags.length===0?r.insertionPoint?s=r.insertionPoint.nextSibling:r.prepend?s=r.container.firstChild:s=r.before:s=r.tags[r.tags.length-1].nextSibling,r.container.insertBefore(i,s),r.tags.push(i)},this.isSpeedy=n.speedy===void 0?!0:n.speedy,this.tags=[],this.ctr=0,this.nonce=n.nonce,this.key=n.key,this.container=n.container,this.prepend=n.prepend,this.insertionPoint=n.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(r){r.forEach(this._insertTag)},t.insert=function(r){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(mr(this));var i=this.tags[this.tags.length-1];if(this.isSpeedy){var s=pr(i);try{s.insertRule(r,s.cssRules.length)}catch{}}else i.appendChild(document.createTextNode(r));this.ctr++},t.flush=function(){this.tags.forEach(function(r){var i;return(i=r.parentNode)==null?void 0:i.removeChild(r)}),this.tags=[],this.ctr=0},e})(),P="-ms-",Be="-moz-",D="-webkit-",Xt="comm",et="rule",tt="decl",xr="@import",Kt="@keyframes",yr="@layer",vr=Math.abs,Re=String.fromCharCode,br=Object.assign;function wr(e,t){return z(e,0)^45?(((t<<2^z(e,0))<<2^z(e,1))<<2^z(e,2))<<2^z(e,3):0}function Qt(e){return e.trim()}function Cr(e,t){return(e=t.exec(e))?e[0]:e}function M(e,t,n){return e.replace(t,n)}function Je(e,t){return e.indexOf(t)}function z(e,t){return e.charCodeAt(t)|0}function ge(e,t,n){return e.slice(t,n)}function _(e){return e.length}function nt(e){return e.length}function Ce(e,t){return t.push(e),e}function Nr(e,t){return e.map(t).join("")}var Oe=1,he=1,en=0,W=0,$=0,pe="";function Ie(e,t,n,r,i,s,o){return{value:e,root:t,parent:n,type:r,props:i,children:s,line:Oe,column:he,length:o,return:""}}function me(e,t){return br(Ie("",null,null,"",null,null,0),e,{length:-e.length},t)}function jr(){return $}function Sr(){return $=W>0?z(pe,--W):0,he--,$===10&&(he=1,Oe--),$}function q(){return $=W<en?z(pe,W++):0,he++,$===10&&(he=1,Oe++),$}function Y(){return z(pe,W)}function je(){return W}function ye(e,t){return ge(pe,e,t)}function xe(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function tn(e){return Oe=he=1,en=_(pe=e),W=0,[]}function nn(e){return pe="",e}function Se(e){return Qt(ye(W-1,_e(e===91?e+2:e===40?e+1:e)))}function kr(e){for(;($=Y())&&$<33;)q();return xe(e)>2||xe($)>3?"":" "}function Lr(e,t){for(;--t&&q()&&!($<48||$>102||$>57&&$<65||$>70&&$<97););return ye(e,je()+(t<6&&Y()==32&&q()==32))}function _e(e){for(;q();)switch($){case e:return W;case 34:case 39:e!==34&&e!==39&&_e($);break;case 40:e===41&&_e(e);break;case 92:q();break}return W}function Ar(e,t){for(;q()&&e+$!==57;)if(e+$===84&&Y()===47)break;return"/*"+ye(t,W-1)+"*"+Re(e===47?e:q())}function Er(e){for(;!xe(Y());)q();return ye(e,W)}function Br(e){return nn(ke("",null,null,null,[""],e=tn(e),0,[0],e))}function ke(e,t,n,r,i,s,o,a,c){for(var d=0,f=0,u=o,h=0,b=0,g=0,p=1,C=1,w=1,N=0,j="",x=i,v=s,y=r,m=j;C;)switch(g=N,N=q()){case 40:if(g!=108&&z(m,u-1)==58){Je(m+=M(Se(N),"&","&\f"),"&\f")!=-1&&(w=-1);break}case 34:case 39:case 91:m+=Se(N);break;case 9:case 10:case 13:case 32:m+=kr(g);break;case 92:m+=Lr(je()-1,7);continue;case 47:switch(Y()){case 42:case 47:Ce(Fr(Ar(q(),je()),t,n),c);break;default:m+="/"}break;case 123*p:a[d++]=_(m)*w;case 125*p:case 59:case 0:switch(N){case 0:case 125:C=0;case 59+f:w==-1&&(m=M(m,/\f/g,"")),b>0&&_(m)-u&&Ce(b>32?Ft(m+";",r,n,u-1):Ft(M(m," ","")+";",r,n,u-2),c);break;case 59:m+=";";default:if(Ce(y=Bt(m,t,n,d,f,i,a,j,x=[],v=[],u),s),N===123)if(f===0)ke(m,t,y,y,x,s,u,a,v);else switch(h===99&&z(m,3)===110?100:h){case 100:case 108:case 109:case 115:ke(e,y,y,r&&Ce(Bt(e,y,y,0,0,i,a,j,i,x=[],u),v),i,v,u,a,r?x:v);break;default:ke(m,y,y,y,[""],v,0,a,v)}}d=f=b=0,p=w=1,j=m="",u=o;break;case 58:u=1+_(m),b=g;default:if(p<1){if(N==123)--p;else if(N==125&&p++==0&&Sr()==125)continue}switch(m+=Re(N),N*p){case 38:w=f>0?1:(m+="\f",-1);break;case 44:a[d++]=(_(m)-1)*w,w=1;break;case 64:Y()===45&&(m+=Se(q())),h=Y(),f=u=_(j=m+=Er(je())),N++;break;case 45:g===45&&_(m)==2&&(p=0)}}return s}function Bt(e,t,n,r,i,s,o,a,c,d,f){for(var u=i-1,h=i===0?s:[""],b=nt(h),g=0,p=0,C=0;g<r;++g)for(var w=0,N=ge(e,u+1,u=vr(p=o[g])),j=e;w<b;++w)(j=Qt(p>0?h[w]+" "+N:M(N,/&\f/g,h[w])))&&(c[C++]=j);return Ie(e,t,n,i===0?et:a,c,d,f)}function Fr(e,t,n){return Ie(e,t,n,Xt,Re(jr()),ge(e,2,-2),0)}function Ft(e,t,n,r){return Ie(e,t,n,tt,ge(e,0,r),ge(e,r+1,-1),r)}function de(e,t){for(var n="",r=nt(e),i=0;i<r;i++)n+=t(e[i],i,e,t)||"";return n}function Tr(e,t,n,r){switch(e.type){case yr:if(e.children.length)break;case xr:case tt:return e.return=e.return||e.value;case Xt:return"";case Kt:return e.return=e.value+"{"+de(e.children,r)+"}";case et:e.value=e.props.join(",")}return _(n=de(e.children,r))?e.return=e.value+"{"+n+"}":""}function Dr(e){var t=nt(e);return function(n,r,i,s){for(var o="",a=0;a<t;a++)o+=e[a](n,r,i,s)||"";return o}}function Mr(e){return function(t){t.root||(t=t.return)&&e(t)}}function Rr(e){var t=Object.create(null);return function(n){return t[n]===void 0&&(t[n]=e(n)),t[n]}}var Or=function(t,n,r){for(var i=0,s=0;i=s,s=Y(),i===38&&s===12&&(n[r]=1),!xe(s);)q();return ye(t,W)},Ir=function(t,n){var r=-1,i=44;do switch(xe(i)){case 0:i===38&&Y()===12&&(n[r]=1),t[r]+=Or(W-1,n,r);break;case 2:t[r]+=Se(i);break;case 4:if(i===44){t[++r]=Y()===58?"&\f":"",n[r]=t[r].length;break}default:t[r]+=Re(i)}while(i=q());return t},$r=function(t,n){return nn(Ir(tn(t),n))},Tt=new WeakMap,Vr=function(t){if(!(t.type!=="rule"||!t.parent||t.length<1)){for(var n=t.value,r=t.parent,i=t.column===r.column&&t.line===r.line;r.type!=="rule";)if(r=r.parent,!r)return;if(!(t.props.length===1&&n.charCodeAt(0)!==58&&!Tt.get(r))&&!i){Tt.set(t,!0);for(var s=[],o=$r(n,s),a=r.props,c=0,d=0;c<o.length;c++)for(var f=0;f<a.length;f++,d++)t.props[d]=s[c]?o[c].replace(/&\f/g,a[f]):a[f]+" "+o[c]}}},zr=function(t){if(t.type==="decl"){var n=t.value;n.charCodeAt(0)===108&&n.charCodeAt(2)===98&&(t.return="",t.value="")}};function rn(e,t){switch(wr(e,t)){case 5103:return D+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return D+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return D+e+Be+e+P+e+e;case 6828:case 4268:return D+e+P+e+e;case 6165:return D+e+P+"flex-"+e+e;case 5187:return D+e+M(e,/(\w+).+(:[^]+)/,D+"box-$1$2"+P+"flex-$1$2")+e;case 5443:return D+e+P+"flex-item-"+M(e,/flex-|-self/,"")+e;case 4675:return D+e+P+"flex-line-pack"+M(e,/align-content|flex-|-self/,"")+e;case 5548:return D+e+P+M(e,"shrink","negative")+e;case 5292:return D+e+P+M(e,"basis","preferred-size")+e;case 6060:return D+"box-"+M(e,"-grow","")+D+e+P+M(e,"grow","positive")+e;case 4554:return D+M(e,/([^-])(transform)/g,"$1"+D+"$2")+e;case 6187:return M(M(M(e,/(zoom-|grab)/,D+"$1"),/(image-set)/,D+"$1"),e,"")+e;case 5495:case 3959:return M(e,/(image-set\([^]*)/,D+"$1$`$1");case 4968:return M(M(e,/(.+:)(flex-)?(.*)/,D+"box-pack:$3"+P+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+D+e+e;case 4095:case 3583:case 4068:case 2532:return M(e,/(.+)-inline(.+)/,D+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(_(e)-1-t>6)switch(z(e,t+1)){case 109:if(z(e,t+4)!==45)break;case 102:return M(e,/(.+:)(.+)-([^]+)/,"$1"+D+"$2-$3$1"+Be+(z(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~Je(e,"stretch")?rn(M(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(z(e,t+1)!==115)break;case 6444:switch(z(e,_(e)-3-(~Je(e,"!important")&&10))){case 107:return M(e,":",":"+D)+e;case 101:return M(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+D+(z(e,14)===45?"inline-":"")+"box$3$1"+D+"$2$3$1"+P+"$2box$3")+e}break;case 5936:switch(z(e,t+11)){case 114:return D+e+P+M(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return D+e+P+M(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return D+e+P+M(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return D+e+P+e+e}return e}var Pr=function(t,n,r,i){if(t.length>-1&&!t.return)switch(t.type){case tt:t.return=rn(t.value,t.length);break;case Kt:return de([me(t,{value:M(t.value,"@","@"+D)})],i);case et:if(t.length)return Nr(t.props,function(s){switch(Cr(s,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return de([me(t,{props:[M(s,/:(read-\w+)/,":"+Be+"$1")]})],i);case"::placeholder":return de([me(t,{props:[M(s,/:(plac\w+)/,":"+D+"input-$1")]}),me(t,{props:[M(s,/:(plac\w+)/,":"+Be+"$1")]}),me(t,{props:[M(s,/:(plac\w+)/,P+"input-$1")]})],i)}return""})}},Gr=[Pr],Hr=function(t){var n=t.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(p){var C=p.getAttribute("data-emotion");C.indexOf(" ")!==-1&&(document.head.appendChild(p),p.setAttribute("data-s",""))})}var i=t.stylisPlugins||Gr,s={},o,a=[];o=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(p){for(var C=p.getAttribute("data-emotion").split(" "),w=1;w<C.length;w++)s[C[w]]=!0;a.push(p)});var c,d=[Vr,zr];{var f,u=[Tr,Mr(function(p){f.insert(p)})],h=Dr(d.concat(i,u)),b=function(C){return de(Br(C),h)};c=function(C,w,N,j){f=N,b(C?C+"{"+w.styles+"}":w.styles),j&&(g.inserted[w.name]=!0)}}var g={key:n,sheet:new gr({key:n,container:o,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:s,registered:{},insert:c};return g.sheet.hydrate(a),g};function Wr(e){for(var t=0,n,r=0,i=e.length;i>=4;++r,i-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var Ur={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},qr=/[A-Z]|^ms/g,Zr=/_EMO_([^_]+?)_([^]*?)_EMO_/g,sn=function(t){return t.charCodeAt(1)===45},Dt=function(t){return t!=null&&typeof t!="boolean"},He=Rr(function(e){return sn(e)?e:e.replace(qr,"-$&").toLowerCase()}),Mt=function(t,n){switch(t){case"animation":case"animationName":if(typeof n=="string")return n.replace(Zr,function(r,i,s){return re={name:i,styles:s,next:re},i})}return Ur[t]!==1&&!sn(t)&&typeof n=="number"&&n!==0?n+"px":n};function Fe(e,t,n){if(n==null)return"";var r=n;if(r.__emotion_styles!==void 0)return r;switch(typeof n){case"boolean":return"";case"object":{var i=n;if(i.anim===1)return re={name:i.name,styles:i.styles,next:re},i.name;var s=n;if(s.styles!==void 0){var o=s.next;if(o!==void 0)for(;o!==void 0;)re={name:o.name,styles:o.styles,next:re},o=o.next;var a=s.styles+";";return a}return Jr(e,t,n)}}var c=n;if(t==null)return c;var d=t[c];return d!==void 0?d:c}function Jr(e,t,n){var r="";if(Array.isArray(n))for(var i=0;i<n.length;i++)r+=Fe(e,t,n[i])+";";else for(var s in n){var o=n[s];if(typeof o!="object"){var a=o;t!=null&&t[a]!==void 0?r+=s+"{"+t[a]+"}":Dt(a)&&(r+=He(s)+":"+Mt(s,a)+";")}else if(Array.isArray(o)&&typeof o[0]=="string"&&(t==null||t[o[0]]===void 0))for(var c=0;c<o.length;c++)Dt(o[c])&&(r+=He(s)+":"+Mt(s,o[c])+";");else{var d=Fe(e,t,o);switch(s){case"animation":case"animationName":{r+=He(s)+":"+d+";";break}default:r+=s+"{"+d+"}"}}}return r}var Rt=/label:\s*([^\s;{]+)\s*(;|$)/g,re;function We(e,t,n){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var r=!0,i="";re=void 0;var s=e[0];if(s==null||s.raw===void 0)r=!1,i+=Fe(n,t,s);else{var o=s;i+=o[0]}for(var a=1;a<e.length;a++)if(i+=Fe(n,t,e[a]),r){var c=s;i+=c[a]}Rt.lastIndex=0;for(var d="",f;(f=Rt.exec(i))!==null;)d+="-"+f[1];var u=Wr(i)+d;return{name:u,styles:i,next:re}}function on(e,t,n){var r="";return n.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):i&&(r+=i+" ")}),r}var _r=function(t,n,r){var i=t.key+"-"+n.name;t.registered[i]===void 0&&(t.registered[i]=n.styles)},Yr=function(t,n,r){_r(t,n);var i=t.key+"-"+n.name;if(t.inserted[n.name]===void 0){var s=n;do t.insert(n===s?"."+i:"",s,t.sheet,!0),s=s.next;while(s!==void 0)}};function Ot(e,t){if(e.inserted[t.name]===void 0)return e.insert("",t,e.sheet,!0)}function It(e,t,n){var r=[],i=on(e,r,n);return r.length<2?n:i+t(r)}var Xr=function(t){var n=Hr(t);n.sheet.speedy=function(a){this.isSpeedy=a},n.compat=!0;var r=function(){for(var c=arguments.length,d=new Array(c),f=0;f<c;f++)d[f]=arguments[f];var u=We(d,n.registered,void 0);return Yr(n,u),n.key+"-"+u.name},i=function(){for(var c=arguments.length,d=new Array(c),f=0;f<c;f++)d[f]=arguments[f];var u=We(d,n.registered),h="animation-"+u.name;return Ot(n,{name:u.name,styles:"@keyframes "+h+"{"+u.styles+"}"}),h},s=function(){for(var c=arguments.length,d=new Array(c),f=0;f<c;f++)d[f]=arguments[f];var u=We(d,n.registered);Ot(n,u)},o=function(){for(var c=arguments.length,d=new Array(c),f=0;f<c;f++)d[f]=arguments[f];return It(n.registered,r,Kr(d))};return{css:r,cx:o,injectGlobal:s,keyframes:i,hydrate:function(c){c.forEach(function(d){n.inserted[d]=!0})},flush:function(){n.registered={},n.inserted={},n.sheet.flush()},sheet:n.sheet,cache:n,getRegisteredStyles:on.bind(null,n.registered),merge:It.bind(null,n.registered,r)}},Kr=function e(t){for(var n="",r=0;r<t.length;r++){var i=t[r];if(i!=null){var s=void 0;switch(typeof i){case"boolean":break;case"object":{if(Array.isArray(i))s=e(i);else{s="";for(var o in i)i[o]&&o&&(s&&(s+=" "),s+=o)}break}default:s=i}s&&(n&&(n+=" "),n+=s)}}return n};const Qr=(e,t=!1,n="")=>{const{variables:r={},...i}=e,s={light:{diffViewerBackground:"#fff",diffViewerColor:"#212529",addedBackground:"#e6ffed",addedColor:"#24292e",removedBackground:"#ffeef0",removedColor:"#24292e",changedBackground:"#fffbdd",wordAddedBackground:"#acf2bd",wordRemovedBackground:"#fdb8c0",addedGutterBackground:"#cdffd8",removedGutterBackground:"#ffdce0",gutterBackground:"#f7f7f7",gutterBackgroundDark:"#f3f1f1",highlightBackground:"#fffbdd",highlightGutterBackground:"#fff5b1",codeFoldGutterBackground:"#dbedff",codeFoldBackground:"#f1f8ff",emptyLineBackground:"#fafbfc",gutterColor:"#212529",addedGutterColor:"#212529",removedGutterColor:"#212529",codeFoldContentColor:"#212529",diffViewerTitleBackground:"#fafbfc",diffViewerTitleColor:"#212529",diffViewerTitleBorderColor:"#eee",...r.light||{}},dark:{diffViewerBackground:"#2e303c",diffViewerColor:"#FFF",addedBackground:"#044B53",addedColor:"white",removedBackground:"#632F34",removedColor:"white",changedBackground:"#3e302c",wordAddedBackground:"#055d67",wordRemovedBackground:"#7d383f",addedGutterBackground:"#034148",removedGutterBackground:"#632b30",gutterBackground:"#2c2f3a",gutterBackgroundDark:"#262933",highlightBackground:"#2a3967",highlightGutterBackground:"#2d4077",codeFoldGutterBackground:"#262831",codeFoldBackground:"#262831",emptyLineBackground:"#363946",gutterColor:"#666c87",addedGutterColor:"#8c8c8c",removedGutterColor:"#8c8c8c",codeFoldContentColor:"#656a8b",diffViewerTitleBackground:"#2f323e",diffViewerTitleColor:"#757a9b",diffViewerTitleBorderColor:"#353846",...r.dark||{}}},o=t?s.dark:s.light,{css:a,cx:c}=Xr({key:"react-diff",nonce:n}),d=a({width:"auto",label:"content"}),f=a({label:"split-view"}),u=a({background:o.diffViewerTitleBackground,color:o.diffViewerTitleColor,padding:"0.5em 1em",display:"flex",alignItems:"center",gap:"0.5em",fontFamily:"monospace",fill:o.diffViewerTitleColor}),h=a({width:"100%",minWidth:"1000px",overflowX:"auto",tableLayout:"fixed",background:o.diffViewerBackground,pre:{margin:0,whiteSpace:"pre-wrap",lineHeight:"1.6em",width:"fit-content"},label:"diff-container",borderCollapse:"collapse"}),b=a({overflow:"hidden",width:"100%"}),g=a({color:o.diffViewerColor,whiteSpace:"pre-wrap",fontFamily:"monospace",lineBreak:"anywhere",textDecoration:"none",label:"content-text"}),p=a({userSelect:"none",label:"unselectable"}),C=a({background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",margin:0,label:"all-expand-button",":hover":{fill:o.addedGutterColor},":focus":{outline:`1px ${o.addedGutterColor} solid`}}),w=a({background:o.diffViewerTitleBackground,padding:"0.5em",lineHeight:"1.4em",height:"2.4em",overflow:"hidden",width:"50%",borderBottom:`1px solid ${o.diffViewerTitleBorderColor}`,label:"title-block",":last-child":{borderLeft:`1px solid ${o.diffViewerTitleBorderColor}`},[`.${g}`]:{color:o.diffViewerTitleColor}}),N=a({color:o.gutterColor,label:"line-number"}),j=a({background:o.removedBackground,color:o.removedColor,pre:{color:o.removedColor},[`.${N}`]:{color:o.removedGutterColor},label:"diff-removed"}),x=a({background:o.addedBackground,color:o.addedColor,pre:{color:o.addedColor},[`.${N}`]:{color:o.addedGutterColor},label:"diff-added"}),v=a({background:o.changedBackground,[`.${N}`]:{color:o.gutterColor},label:"diff-changed"}),y=a({padding:2,display:"inline-flex",borderRadius:4,wordBreak:"break-all",label:"word-diff"}),m=a({background:o.wordAddedBackground,textDecoration:"none",label:"word-added"}),A=a({background:o.wordRemovedBackground,textDecoration:"none",label:"word-removed"}),E=a({backgroundColor:o.codeFoldGutterBackground,label:"code-fold-gutter",minWidth:"50px",width:"50px"}),B=a({padding:""}),T=a({background:o.codeFoldBackground,cursor:"pointer",display:"inline",margin:0,border:"none",label:"code-fold-expand-button"}),F=a({color:o.codeFoldContentColor,fontFamily:"monospace",label:"code-fold-content"}),k=a({display:"block",width:"10px",height:"10px",backgroundColor:"#ddd",borderWidth:"1px",borderStyle:"solid",borderColor:o.diffViewerTitleBorderColor}),S=a({backgroundColor:o.wordAddedBackground}),I=a({backgroundColor:o.wordRemovedBackground}),V=a({backgroundColor:o.codeFoldBackground,height:40,fontSize:14,alignItems:"center",userSelect:"none",fontWeight:700,label:"code-fold",a:{textDecoration:"underline !important",cursor:"pointer",pre:{display:"inline"}}}),te=a({backgroundColor:o.emptyLineBackground,label:"empty-line"}),Z=a({width:28,paddingLeft:10,paddingRight:10,userSelect:"none",label:"marker",[`&.${x}`]:{pre:{color:o.addedColor}},[`&.${j}`]:{pre:{color:o.removedColor}}}),se=a({background:o.highlightBackground,label:"highlighted-line",[`.${m}, .${A}`]:{backgroundColor:"initial"}}),ae=a({label:"highlighted-gutter"}),$e=a({userSelect:"none",minWidth:50,width:"50px",padding:"0 10px",whiteSpace:"nowrap",label:"gutter",textAlign:"right",background:o.gutterBackground,"&:hover":{cursor:"pointer",background:o.gutterBackgroundDark,pre:{opacity:1}},pre:{opacity:.5},[`&.${x}`]:{background:o.addedGutterBackground},[`&.${j}`]:{background:o.removedGutterBackground},[`&.${ae}`]:{background:o.highlightGutterBackground,"&:hover":{background:o.highlightGutterBackground}}}),Ve=a({"&:hover":{background:o.gutterBackground,cursor:"initial"},label:"empty-gutter"}),ne=a({verticalAlign:"baseline",label:"line",textDecoration:"none"}),ve=a({}),ie={diffContainer:h,diffRemoved:j,diffAdded:x,diffChanged:v,splitView:f,marker:Z,highlightedGutter:ae,highlightedLine:se,gutter:$e,line:ne,lineContent:b,wordDiff:y,wordAdded:m,summary:u,block:k,blockAddition:S,blockDeletion:I,wordRemoved:A,noSelect:p,codeFoldGutter:E,codeFoldExpandButton:T,codeFoldContentContainer:B,codeFold:V,emptyGutter:Ve,emptyLine:te,lineNumber:N,contentText:g,content:d,column:ve,codeFoldContent:F,titleBlock:w,allExpandButton:C},le=Object.keys(i).reduce((ce,J)=>({...ce,[J]:a(i[J])}),{});return Object.keys(ie).reduce((ce,J)=>({...ce,[J]:le[J]?c(ie[J],le[J]):ie[J]}),{})};function es(){return l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:"16",height:"16",children:[l.jsx("title",{children:"fold"}),l.jsx("path",{d:"M10.896 2H8.75V.75a.75.75 0 0 0-1.5 0V2H5.104a.25.25 0 0 0-.177.427l2.896 2.896a.25.25 0 0 0 .354 0l2.896-2.896A.25.25 0 0 0 10.896 2ZM8.75 15.25a.75.75 0 0 1-1.5 0V14H5.104a.25.25 0 0 1-.177-.427l2.896-2.896a.25.25 0 0 1 .354 0l2.896 2.896a.25.25 0 0 1-.177.427H8.75v1.25Zm-6.5-6.5a.75.75 0 0 0 0-1.5h-.5a.75.75 0 0 0 0 1.5h.5ZM6 8a.75.75 0 0 1-.75.75h-.5a.75.75 0 0 1 0-1.5h.5A.75.75 0 0 1 6 8Zm2.25.75a.75.75 0 0 0 0-1.5h-.5a.75.75 0 0 0 0 1.5h.5ZM12 8a.75.75 0 0 1-.75.75h-.5a.75.75 0 0 1 0-1.5h.5A.75.75 0 0 1 12 8Zm2.25.75a.75.75 0 0 0 0-1.5h-.5a.75.75 0 0 0 0 1.5h.5Z"})]})}var H;(function(e){e.LEFT="L",e.RIGHT="R"})(H||(H={}));class an extends R.Component{constructor(n){super(n);G(this,"styles");G(this,"resetCodeBlocks",()=>this.state.expandedBlocks.length>0?(this.setState({expandedBlocks:[]}),!0):!1);G(this,"onBlockExpand",n=>{const r=this.state.expandedBlocks.slice();r.push(n),this.setState({expandedBlocks:r})});G(this,"computeStyles",Mn(Qr));G(this,"onLineNumberClickProxy",n=>this.props.onLineNumberClick?r=>this.props.onLineNumberClick(n,r):()=>{});G(this,"renderWordDiff",(n,r)=>n.map((i,s)=>{const o=r?r(i.value):typeof i.value=="string"?i.value:void 0;return i.type===O.ADDED?l.jsx("ins",{className:U(this.styles.wordDiff,{[this.styles.wordAdded]:i.type===O.ADDED}),children:o},s):i.type===O.REMOVED?l.jsx("del",{className:U(this.styles.wordDiff,{[this.styles.wordRemoved]:i.type===O.REMOVED}),children:o},s):l.jsx("span",{className:U(this.styles.wordDiff),children:o},s)}));G(this,"renderLine",(n,r,i,s,o,a)=>{const c=`${i}-${n}`,d=`${a}-${o}`,f=this.props.highlightLines.includes(c)||this.props.highlightLines.includes(d),u=r===O.ADDED,h=r===O.REMOVED,b=r===O.CHANGED;let g;const p=Array.isArray(s);p?g=this.renderWordDiff(s,this.props.renderContent):this.props.renderContent?g=this.props.renderContent(s):g=s;let C="div";return u&&!p?C="ins":h&&!p&&(C="del"),l.jsxs(l.Fragment,{children:[!this.props.hideLineNumbers&&l.jsx("td",{onClick:n&&this.onLineNumberClickProxy(c),className:U(this.styles.gutter,{[this.styles.emptyGutter]:!n,[this.styles.diffAdded]:u,[this.styles.diffRemoved]:h,[this.styles.diffChanged]:b,[this.styles.highlightedGutter]:f}),children:l.jsx("pre",{className:this.styles.lineNumber,children:n})}),!this.props.splitView&&!this.props.hideLineNumbers&&l.jsx("td",{onClick:o&&this.onLineNumberClickProxy(d),className:U(this.styles.gutter,{[this.styles.emptyGutter]:!o,[this.styles.diffAdded]:u,[this.styles.diffRemoved]:h,[this.styles.diffChanged]:b,[this.styles.highlightedGutter]:f}),children:l.jsx("pre",{className:this.styles.lineNumber,children:o})}),this.props.renderGutter?this.props.renderGutter({lineNumber:n,type:r,prefix:i,value:s,additionalLineNumber:o,additionalPrefix:a,styles:this.styles}):null,l.jsx("td",{className:U(this.styles.marker,{[this.styles.emptyLine]:!g,[this.styles.diffAdded]:u,[this.styles.diffRemoved]:h,[this.styles.diffChanged]:b,[this.styles.highlightedLine]:f}),children:l.jsxs("pre",{children:[u&&"+",h&&"-"]})}),l.jsx("td",{className:U(this.styles.content,{[this.styles.emptyLine]:!g,[this.styles.diffAdded]:u,[this.styles.diffRemoved]:h,[this.styles.diffChanged]:b,[this.styles.highlightedLine]:f,left:i===H.LEFT,right:i===H.RIGHT}),onMouseDown:()=>{const w=document.getElementsByClassName(i===H.LEFT?"right":"left");for(let N=0;N<w.length;N++)w.item(N).classList.add(this.styles.noSelect)},title:u&&!p?"Added line":h&&!p?"Removed line":void 0,children:l.jsx(C,{className:this.styles.contentText,children:g})})]})});G(this,"renderSplitView",({left:n,right:r},i)=>l.jsxs("tr",{className:this.styles.line,children:[this.renderLine(n.lineNumber,n.type,H.LEFT,n.value),this.renderLine(r.lineNumber,r.type,H.RIGHT,r.value)]},i));G(this,"renderInlineView",({left:n,right:r},i)=>{let s;return n.type===O.REMOVED&&r.type===O.ADDED?l.jsxs(R.Fragment,{children:[l.jsx("tr",{className:this.styles.line,children:this.renderLine(n.lineNumber,n.type,H.LEFT,n.value,null)}),l.jsx("tr",{className:this.styles.line,children:this.renderLine(null,r.type,H.RIGHT,r.value,r.lineNumber,H.RIGHT)})]},i):(n.type===O.REMOVED&&(s=this.renderLine(n.lineNumber,n.type,H.LEFT,n.value,null)),n.type===O.DEFAULT&&(s=this.renderLine(n.lineNumber,n.type,H.LEFT,n.value,r.lineNumber,H.RIGHT)),r.type===O.ADDED&&(s=this.renderLine(null,r.type,H.RIGHT,r.value,r.lineNumber)),l.jsx("tr",{className:this.styles.line,children:s},i))});G(this,"onBlockClickProxy",n=>()=>this.onBlockExpand(n));G(this,"renderSkippedLineIndicator",(n,r,i,s)=>{const{hideLineNumbers:o,splitView:a}=this.props,c=this.props.codeFoldMessageRenderer?this.props.codeFoldMessageRenderer(n,i,s):l.jsxs("span",{className:this.styles.codeFoldContent,children:["Expand ",n," lines ..."]}),d=l.jsx("td",{className:this.styles.codeFoldContentContainer,children:l.jsx("button",{type:"button",className:this.styles.codeFoldExpandButton,onClick:this.onBlockClickProxy(r),tabIndex:0,children:c})}),f=!a&&!o;return l.jsxs("tr",{className:this.styles.codeFold,children:[!o&&l.jsx("td",{className:this.styles.codeFoldGutter}),this.props.renderGutter?l.jsx("td",{className:this.styles.codeFoldGutter}):null,l.jsx("td",{className:U({[this.styles.codeFoldGutter]:f})}),f?l.jsxs(R.Fragment,{children:[l.jsx("td",{}),d]}):l.jsxs(R.Fragment,{children:[d,this.props.renderGutter?l.jsx("td",{}):null,l.jsx("td",{}),l.jsx("td",{}),o?null:l.jsx("td",{})]})]},`${i}-${s}`)});G(this,"renderDiff",()=>{const{oldValue:n,newValue:r,splitView:i,disableWordDiff:s,compareMethod:o,linesOffset:a}=this.props,{lineInformation:c,diffLines:d}=ur(n,r,s,o,a,this.props.alwaysShowLines),f=this.props.extraLinesSurroundingDiff<0?0:Math.round(this.props.extraLinesSurroundingDiff),{lineBlocks:u,blocks:h}=Rn(c,d,f);return{diffNodes:c.map((g,p)=>{if(this.props.showDiffOnly){const C=u[p];if(C!==void 0){const w=h[C].endLine===p;if(!this.state.expandedBlocks.includes(C)&&w)return l.jsx(R.Fragment,{children:this.renderSkippedLineIndicator(h[C].lines,C,g.left.lineNumber,g.right.lineNumber)},p);if(!this.state.expandedBlocks.includes(C))return null}}return i?this.renderSplitView(g,p):this.renderInlineView(g,p)}),blocks:h,lineInformation:c}});G(this,"render",()=>{const{oldValue:n,newValue:r,useDarkTheme:i,leftTitle:s,rightTitle:o,splitView:a,compareMethod:c,hideLineNumbers:d,nonce:f}=this.props;if(typeof c=="string"&&c!==ue.JSON&&(typeof n!="string"||typeof r!="string"))throw Error('"oldValue" and "newValue" should be strings');this.styles=this.computeStyles(this.props.styles,i,f);const u=this.renderDiff();let h=3,b=4;d&&(h-=1,b-=1),this.props.renderGutter&&(h+=1,b+=1);let g=0,p=0;for(const x of u.lineInformation)x.left.type===O.ADDED&&p++,x.right.type===O.ADDED&&p++,x.left.type===O.REMOVED&&g++,x.right.type===O.REMOVED&&g++;const C=g+p,w=Math.round(p/C*100),N=[];for(let x=0;x<5;x++)w>x*20?N.push(l.jsx("span",{className:U(this.styles.block,this.styles.blockAddition)},x)):N.push(l.jsx("span",{className:U(this.styles.block,this.styles.blockDeletion)},x));const j=this.state.expandedBlocks.length===u.blocks.length;return l.jsxs("div",{children:[l.jsxs("div",{className:this.styles.summary,role:"banner",children:[l.jsx("button",{type:"button",className:this.styles.allExpandButton,onClick:()=>{this.setState({expandedBlocks:j?[]:u.blocks.map(x=>x.index)})},children:j?l.jsx(es,{}):l.jsx(hr,{})})," ",C,l.jsx("div",{style:{display:"flex",gap:"1px"},children:N}),this.props.summary?l.jsx("span",{children:this.props.summary}):null]}),l.jsx("table",{className:U(this.styles.diffContainer,{[this.styles.splitView]:a}),onMouseUp:()=>{const x=document.getElementsByClassName("right");for(let y=0;y<x.length;y++)x.item(y).classList.remove(this.styles.noSelect);const v=document.getElementsByClassName("left");for(let y=0;y<v.length;y++)v.item(y).classList.remove(this.styles.noSelect)},children:l.jsxs("tbody",{children:[l.jsxs("tr",{children:[this.props.hideLineNumbers?null:l.jsx("td",{width:"50px"}),!a&&!this.props.hideLineNumbers?l.jsx("td",{width:"50px"}):null,this.props.renderGutter?l.jsx("td",{width:"50px"}):null,l.jsx("td",{width:"28px"}),l.jsx("td",{width:"100%"}),a?l.jsxs(l.Fragment,{children:[this.props.hideLineNumbers?null:l.jsx("td",{width:"50px"}),this.props.renderGutter?l.jsx("td",{width:"50px"}):null,l.jsx("td",{width:"28px"}),l.jsx("td",{width:"100%"})]}):null]}),s||o?l.jsxs("tr",{children:[l.jsx("th",{colSpan:a?h:b,className:U(this.styles.titleBlock,this.styles.column),children:s?l.jsx("pre",{className:this.styles.contentText,children:s}):null}),a?l.jsx("th",{colSpan:h,className:U(this.styles.titleBlock,this.styles.column),children:o?l.jsx("pre",{className:this.styles.contentText,children:o}):null}):null]}):null,u.diffNodes]})})]})});this.state={expandedBlocks:[],noSelect:void 0}}}G(an,"defaultProps",{oldValue:"",newValue:"",splitView:!0,highlightLines:[],disableWordDiff:!1,compareMethod:ue.CHARS,styles:{},hideLineNumbers:!1,extraLinesSurroundingDiff:3,showDiffOnly:!0,useDarkTheme:!1,linesOffset:0,nonce:""});function ts({diffView:e,diffContent:t,isLoading:n,entities:r,onClose:i}){var d;const[s,o]=R.useState(!1),[a,c]=R.useState(!1);return R.useEffect(()=>{c(!0)},[]),l.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center p-8 z-50",children:l.jsxs("div",{className:"bg-white rounded-xl shadow-2xl max-w-6xl w-full max-h-[90vh] flex flex-col",children:[l.jsxs("div",{className:"p-6 border-b border-[#e1e1e1] flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("h2",{className:"font-['IBM_Plex_Sans'] text-2xl font-semibold text-[#232323]",children:e.type==="file"?"File Diff":"Entity Diff"}),l.jsx("p",{className:"font-['IBM_Plex_Mono'] text-sm text-[#8e8e8e] mt-1",children:e.path}),e.type==="entity"&&e.entitySha&&l.jsxs("p",{className:"font-['IBM_Plex_Mono'] text-sm text-[#8e8e8e]",children:["Entity:"," ",((d=r.find(f=>f.sha===e.entitySha))==null?void 0:d.name)||e.entitySha]})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("button",{onClick:()=>o(!s),className:"px-3 py-1.5 bg-[#efefef] text-[#3e3e3e] rounded-lg font-['IBM_Plex_Sans'] text-sm font-semibold hover:bg-[#e1e1e1] transition-colors cursor-pointer",title:s?"Show changes only":"Show full file",children:s?"Show Changes Only":"Show Full File"}),l.jsx("button",{onClick:i,className:"text-[#8e8e8e] hover:text-[#626262] transition-colors cursor-pointer",children:l.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),l.jsx("div",{className:"flex-1 overflow-auto",children:n?l.jsx("div",{className:"p-6 text-center",children:l.jsx("div",{className:"text-[#8e8e8e]",children:"Loading diff..."})}):t?l.jsx("div",{className:"diff-viewer-wrapper",children:a&&l.jsx(an,{oldValue:t.oldContent,newValue:t.newContent,splitView:!0,useDarkTheme:!1,showDiffOnly:!s,extraLinesSurroundingDiff:4,styles:{variables:{light:{diffViewerBackground:"#fff",diffViewerColor:"#212529",addedBackground:"#e6ffed",addedColor:"#24292e",removedBackground:"#ffeef0",removedColor:"#24292e",wordAddedBackground:"#acf2bd",wordRemovedBackground:"#fdb8c0",addedGutterBackground:"#cdffd8",removedGutterBackground:"#ffdce0",gutterBackground:"#f6f8fa",gutterBackgroundDark:"#f3f4f6",highlightBackground:"#fffbdd",highlightGutterBackground:"#fff5b1"}},contentText:{fontSize:"12px",lineHeight:"1.5"},line:{padding:"2px 10px",fontSize:"12px","&:hover":{background:"#f8f9fa"}},splitView:{display:"flex",width:"100%"},diffContainer:{width:"50%",overflowX:"auto"}}})}):l.jsx("div",{className:"p-6 text-center",children:l.jsx("div",{className:"text-[#8e8e8e]",children:"No diff available"})})}),l.jsx("div",{className:"p-6 border-t border-[#e1e1e1] flex justify-end gap-3",children:l.jsx("button",{onClick:i,className:"px-4 py-2 bg-[#efefef] text-[#3e3e3e] rounded-lg font-['IBM_Plex_Sans'] font-semibold hover:bg-[#e1e1e1] transition-colors cursor-pointer",children:"Close"})})]})})}function ns({files:e,currentBranch:t,defaultBranch:n,baseBranch:r,allBranches:i,expandedFiles:s,isEntityBeingAnalyzed:o,isEntityQueued:a,sortOrder:c,onToggleFile:d,onBranchChange:f,onGenerateSimulation:u,onSortChange:h,onAnalyzeAll:b,analyzeAllDisabled:g,analyzeAllText:p}){const C=e.flatMap(([j,{entities:x}])=>{const v=x.filter(y=>o(y.sha)||a(y)).map(y=>y.sha);return v.length>0?[{entityShas:v}]:[]}),w=j=>{const x=j.map(v=>Ht(v,C));return x.includes("analyzing")||x.includes("queued")?"analyzing":x.includes("out-of-date")?"out-of-date":x.includes("not-analyzed")?"not-analyzed":"up-to-date"},N=R.useMemo(()=>[...e].sort((j,x)=>{const v=j[1].entities.reduce((E,B)=>{var F;const T=((F=B.metadata)==null?void 0:F.editedAt)||B.updatedAt;return T?E?new Date(T)>new Date(E)?T:E:T:E},null),y=x[1].entities.reduce((E,B)=>{var F;const T=((F=B.metadata)==null?void 0:F.editedAt)||B.updatedAt;return T?E?new Date(T)>new Date(E)?T:E:T:E},null);if(!v&&!y)return 0;if(!v)return 1;if(!y)return-1;const m=new Date(v).getTime(),A=new Date(y).getTime();return c==="desc"?A-m:m-A}),[e,c]);return l.jsx("div",{children:e.length>0?l.jsxs("div",{children:[l.jsx(Vt,{showActions:!0,sortOrder:c,onSortChange:h,onAnalyzeAll:b,analyzeAllDisabled:g,analyzeAllText:p}),l.jsx("div",{className:"flex flex-col gap-[3px]",children:N.map(([j,{status:x,entities:v,isUncommitted:y}])=>{const m=s.has(j),A=w(v),E=v.reduce((k,S)=>{var V;const I=((V=S.metadata)==null?void 0:V.editedAt)||S.updatedAt;return I?k?new Date(I)>new Date(k)?I:k:I:k},null),T=v.filter(k=>k.entityType==="visual"||k.entityType==="library").length===0;let F;return T?F=l.jsx("span",{className:"text-[12px] text-gray-400",children:"Not Analyzable"}):A==="analyzing"?F=l.jsxs("span",{className:"text-[13px] px-2 rounded inline-flex items-center gap-1.5 whitespace-nowrap",style:{backgroundColor:"#ffdbf6",color:"#ff2ab5",height:"26px"},children:[l.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 9 9",fill:"none",className:"animate-spin",children:[l.jsx("circle",{cx:"4.5",cy:"4.5",r:"3.5",stroke:"#FFF4FC",strokeWidth:"1",fill:"none"}),l.jsx("path",{d:"M4.5 1C2.57 1 1 2.57 1 4.5C1 5.6 1.5 6.58 2.28 7.23",stroke:"#FF2AB5",strokeWidth:"1",strokeLinecap:"round",fill:"none"})]}),"Analyzing..."]}):A==="up-to-date"?F=l.jsx("span",{className:"text-[13px] px-2 rounded inline-flex items-center gap-1.5 whitespace-nowrap",style:{backgroundColor:"#e8ffe6",color:"#00925d",height:"26px"},children:"Up to date"}):A==="out-of-date"?F=l.jsx("button",{onClick:k=>{k.stopPropagation(),v.filter(S=>(S.entityType==="visual"||S.entityType==="library")&&!o(S.sha)&&!a(S)).forEach(S=>u(S))},className:"bg-[#005c75] text-white rounded text-[12px] font-['IBM_Plex_Sans'] font-normal hover:bg-[#004a5e] transition-colors px-[15px] py-0 h-[28px]",children:"Re-Analyze"}):A==="not-analyzed"&&(F=l.jsx("button",{onClick:k=>{k.stopPropagation(),v.filter(S=>(S.entityType==="visual"||S.entityType==="library")&&!o(S.sha)&&!a(S)).forEach(S=>u(S))},className:"bg-[#005c75] text-white rounded text-[12px] font-['IBM_Plex_Sans'] font-normal hover:bg-[#004a5e] transition-colors px-[15px] py-0 h-[28px]",children:"Analyze File"})),l.jsx(zt,{filePath:j,isExpanded:m,onToggle:()=>d(j),fileStatus:x,isUncommitted:y,simulationPreviews:l.jsx(Gt,{entities:v,maxPreviews:1}),entityCount:v.length,state:A,lastModified:E,isNotAnalyzable:T,actionButton:F,children:v.sort((k,S)=>{const I=k.entityType==="visual"||k.entityType==="library",V=S.entityType==="visual"||S.entityType==="library";return I&&!V?-1:!I&&V?1:0}).map(k=>l.jsx(Pt,{entity:k,isActivelyAnalyzing:o(k.sha),isQueued:a(k),onGenerateSimulation:u},k.sha))},j)})})]}):l.jsxs("div",{className:"bg-[#efefef] rounded-[10px] flex flex-col items-center justify-center text-center",style:{height:"190px"},children:[l.jsx("p",{className:"font-['IBM_Plex_Sans'] font-medium text-[16px] text-[#3e3e3e] leading-[24px] mb-2",children:"No Changes"}),l.jsx("p",{className:"font-['IBM_Plex_Sans'] font-normal text-[14px] text-[#3e3e3e] leading-[18px]",children:"No files have been modified in this branch."})]})})}function rs({files:e,entityImpactMap:t,expandedFiles:n,isEntityBeingAnalyzed:r,isEntityQueued:i,projectSlug:s,baseBranch:o,currentBranch:a,sortOrder:c,onToggleFile:d,onShowFileDiff:f,onGenerateSimulation:u,onSortChange:h,onAnalyzeAll:b,analyzeAllDisabled:g,analyzeAllText:p}){const C=R.useMemo(()=>{const j=[];return e.forEach(([x,{editedEntities:v}])=>{const y=v.filter(m=>r(m.sha)||i(m)).map(m=>m.sha);y.length>0&&j.push({entityShas:y})}),j},[e,r,i]),w=R.useMemo(()=>{const j=new Map;return e.forEach(([x,{editedEntities:v}])=>{const y=v.map(B=>Ht(B,C));let m;y.includes("analyzing")||y.includes("queued")?m="analyzing":y.includes("out-of-date")?m="out-of-date":y.includes("not-analyzed")?m="not-analyzed":m="up-to-date";const A=v.reduce((B,T)=>{var k;const F=((k=T.metadata)==null?void 0:k.editedAt)||T.updatedAt;return F&&(!B||new Date(F)>new Date(B))?F:B},null),E=v.filter(B=>B.entityType==="visual"||B.entityType==="library").length;j.set(x,{state:m,lastModified:A,analyzableCount:E})}),j},[e,C]),N=R.useMemo(()=>[...e].sort((j,x)=>{const v=w.get(j[0]),y=w.get(x[0]),m=v==null?void 0:v.lastModified,A=y==null?void 0:y.lastModified;if(!m&&!A)return 0;if(!m)return 1;if(!A)return-1;const E=new Date(m).getTime(),B=new Date(A).getTime();return c==="desc"?B-E:E-B}),[e,w,c]);return e.length===0?l.jsxs("div",{className:"bg-[#efefef] rounded-[10px] flex flex-col items-center justify-center text-center",style:{height:"190px"},children:[l.jsx("p",{className:"font-['IBM_Plex_Sans'] font-medium text-[16px] text-[#3e3e3e] leading-[24px] mb-2",children:"No Uncommitted Changes"}),l.jsx("p",{className:"font-['IBM_Plex_Sans'] font-normal text-[14px] text-[#3e3e3e] leading-[18px]",children:"If you edit a file in your project, it will show up here."})]}):l.jsxs("div",{children:[l.jsx(Vt,{showActions:!0,sortOrder:c,onSortChange:h,onAnalyzeAll:b,analyzeAllDisabled:g,analyzeAllText:p}),l.jsx("div",{className:"flex flex-col gap-[3px]",children:N.map(([j,{status:x,editedEntities:v}])=>{const y=n.has(j),m=w.get(j),{state:A,lastModified:E,analyzableCount:B}=m,T=B===0;let F;return T?F=l.jsx("span",{className:"text-[12px] text-gray-400",children:"Not Analyzable"}):A==="analyzing"?F=l.jsxs("span",{className:"text-[13px] px-2 rounded inline-flex items-center gap-1.5 whitespace-nowrap",style:{backgroundColor:"#ffdbf6",color:"#ff2ab5",height:"26px"},children:[l.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 9 9",fill:"none",className:"animate-spin",children:[l.jsx("circle",{cx:"4.5",cy:"4.5",r:"3.5",stroke:"#FFF4FC",strokeWidth:"1",fill:"none"}),l.jsx("path",{d:"M4.5 1C2.57 1 1 2.57 1 4.5C1 5.6 1.5 6.58 2.28 7.23",stroke:"#FF2AB5",strokeWidth:"1",strokeLinecap:"round",fill:"none"})]}),"Analyzing..."]}):A==="up-to-date"?F=l.jsx("span",{className:"text-[13px] px-2 rounded inline-flex items-center gap-1.5 whitespace-nowrap",style:{backgroundColor:"#e8ffe6",color:"#00925d",height:"26px"},children:"Up to date"}):A==="out-of-date"?F=l.jsx("button",{onClick:k=>{k.stopPropagation(),v.filter(S=>(S.entityType==="visual"||S.entityType==="library")&&!r(S.sha)&&!i(S)).forEach(S=>u(S))},className:"bg-[#005c75] text-white rounded text-[12px] font-['IBM_Plex_Sans'] font-normal hover:bg-[#004a5e] transition-colors px-[15px] py-0 h-[28px]",children:"Re-Analyze"}):A==="not-analyzed"&&(F=l.jsx("button",{onClick:k=>{k.stopPropagation(),v.filter(S=>(S.entityType==="visual"||S.entityType==="library")&&!r(S.sha)&&!i(S)).forEach(S=>u(S))},className:"bg-[#005c75] text-white rounded text-[12px] font-['IBM_Plex_Sans'] font-normal hover:bg-[#004a5e] transition-colors px-[15px] py-0 h-[28px]",children:"Analyze File"})),l.jsx(zt,{filePath:j,isExpanded:y,onToggle:()=>d(j),fileStatus:x,simulationPreviews:l.jsx(Gt,{entities:v,maxPreviews:1}),entityCount:v.length,state:A,lastModified:E,isNotAnalyzable:T,isUncommitted:!0,actionButton:F,children:v.sort((k,S)=>{const I=k.entityType==="visual"||k.entityType==="library",V=S.entityType==="visual"||S.entityType==="library";return I&&!V?-1:!I&&V?1:0}).map(k=>l.jsx(Pt,{entity:k,isActivelyAnalyzing:r(k.sha),isQueued:i(k),onGenerateSimulation:u},k.sha))},j)})})]})}function ss({activeTab:e,onTabChange:t,uncommittedCount:n,branchCount:r}){return l.jsx("div",{className:"border-b border-gray-200",children:l.jsxs("nav",{className:"flex gap-8 items-center",children:[l.jsxs("button",{onClick:()=>t("branch"),className:`relative pb-3 px-2 text-sm font-medium transition-colors cursor-pointer ${e==="branch"?"text-primary-100":"text-gray-500 hover:text-gray-700"}`,children:[l.jsxs("span",{className:"flex items-center gap-2",children:["Branch Changes",r>0&&l.jsx("span",{className:`inline-flex items-center justify-center px-2 py-0.5 text-xs font-semibold rounded-full ${e==="branch"?"bg-[#cbf3fa] text-[#005c75]":"bg-[#e1e1e1] text-[#3e3e3e]"}`,children:r})]}),e==="branch"&&l.jsx("span",{className:"absolute -bottom-px left-0 right-0 h-0.5 bg-primary-100"})]}),l.jsxs("button",{onClick:()=>t("uncommitted"),className:`relative pb-3 px-2 text-sm font-medium transition-colors cursor-pointer ${e==="uncommitted"?"text-primary-100":"text-gray-500 hover:text-gray-700"}`,children:[l.jsxs("span",{className:"flex items-center gap-2",children:["Uncommitted Changes",n>0&&l.jsx("span",{className:`inline-flex items-center justify-center px-2 py-0.5 text-xs font-semibold rounded-full ${e==="uncommitted"?"bg-[#cbf3fa] text-[#005c75]":"bg-[#e1e1e1] text-[#3e3e3e]"}`,children:n})]}),e==="uncommitted"&&l.jsx("span",{className:"absolute -bottom-px left-0 right-0 h-0.5 bg-primary-100"})]})]})})}const bs=()=>[{title:"Git - CodeYam"},{name:"description",content:"Git status and impact analysis"}],ws=mn(function(){var ft,ut;const{entities:t,gitStatus:n,currentBranch:r,actualCurrentBranch:i,defaultBranch:s,allBranches:o,baseBranch:a,branchDiff:c,currentCommit:d,projectSlug:f,queueState:u}=gn();yn({source:"git-page"});const[h,b]=xn(),[g,p]=R.useState(null),[C,w]=R.useState("desc"),[N,j]=R.useState("branch"),x=h.get("expanded")==="true",v=()=>{w(L=>L==="desc"?"asc":"desc")},y=$t(),m=y.data;R.useEffect(()=>{r&&a&&r!==a&&y.state==="idle"&&!m&&y.load(`/api/branch-entity-diff?base=${encodeURIComponent(a)}&compare=${encodeURIComponent(r)}`)},[r,a,y,m]);const A=R.useMemo(()=>{const L=jn(n,t);return Array.from(L.entries()).sort((K,Q)=>K[0].localeCompare(Q[0]))},[n,t]),E=R.useMemo(()=>{const L=Sn(c,t,m);return Array.from(L.entries()).sort((K,Q)=>K[0].localeCompare(Q[0]))},[c,t,m]),B=R.useMemo(()=>kn(n,t),[n,t]),T=R.useMemo(()=>N==="uncommitted"?A:E,[N,A,E]),F=R.useMemo(()=>T.map(([L])=>L),[T]),{expandedUncommitted:k,setExpandedUncommitted:S,toggleFile:I,expandAllUncommitted:V,collapseAllUncommitted:te}=An(x,F,[]),{diffView:Z,diffContent:se,isLoading:ae,handleShowFileDiff:$e,handleCloseDiff:Ve}=En(a,r),ne=(ft=d==null?void 0:d.metadata)==null?void 0:ft.currentRun,ve=new Set((ne==null?void 0:ne.currentEntityShas)||[]),ie=new Set(u.jobs.flatMap(L=>L.entityShas||[])),le=new Set(((ut=u.currentlyExecuting)==null?void 0:ut.entityShas)||[]),{isAnalyzing:ce,handleGenerateSimulation:J,handleGenerateAllSimulations:ln,isEntityBeingAnalyzed:rt,isEntityPending:st}=vn(ne==null?void 0:ne.currentEntityShas,u),it=L=>st(L)||ie.has(L.sha)||le.has(L.sha),cn=L=>{L===(i||r)?h.delete("viewBranch"):h.set("viewBranch",L),b(h)},ot=L=>{L===s?h.delete("compare"):h.set("compare",L),b(h)},at=()=>{const K=T.flatMap(([Q,ht])=>ht.editedEntities||ht.entities||[]).filter(Q=>!ve.has(Q.sha)&&!ie.has(Q.sha)&&!le.has(Q.sha)&&!st(Q));ln(K)},dn=A.length,fn=E.length,ze=T.flatMap(([L,K])=>K.editedEntities||K.entities||[]),be=ze.filter(L=>L.entityType==="visual"||L.entityType==="library"),Pe=be.length>0&&be.every(L=>ve.has(L.sha)),lt=be.length>0&&!Pe&&be.every(L=>ie.has(L.sha)||le.has(L.sha)),ct=ce||Pe||lt,dt=Pe?"Analyzing...":lt?"Queued...":ce?"Analyzing...":"Analyze All";return l.jsx("div",{className:"bg-[#F8F7F6] min-h-screen",children:l.jsxs("div",{className:"px-20 py-12",children:[l.jsxs("div",{className:"mb-8",children:[l.jsx("h1",{className:"text-[28px] font-semibold text-gray-900 mb-2",children:"Git Changes"}),l.jsxs("p",{className:"text-[15px] text-gray-500",children:["This is a list of all the files that are affected by your local changes. ",l.jsx("strong",{children:"Analyze a file to get simulations."})]})]}),l.jsx("div",{className:"mb-6",children:l.jsx(ss,{activeTab:N,onTabChange:j,uncommittedCount:dn,branchCount:fn})}),r&&N==="branch"&&l.jsx("div",{className:"bg-white border-b border-gray-200 rounded-t-lg px-5 py-4 mb-3",children:r===s?l.jsxs("div",{className:"text-gray-700",children:["You are currently on the primary branch,"," ",l.jsx("span",{className:"text-cyblack-75",children:s}),"."]}):l.jsxs("div",{className:"flex gap-6 items-center",children:[l.jsxs("div",{className:"shrink-0",children:[l.jsx("div",{className:"text-[11px] text-gray-500 mb-2 uppercase",children:"Changes in Branch:"}),o.length>0?l.jsxs("div",{className:"relative w-50",children:[l.jsx("select",{value:r,onChange:L=>cn(L.target.value),className:"appearance-none bg-gray-50 border border-gray-200 rounded px-2.5 pr-6 text-[13px] h-9.75 w-full cursor-pointer focus:outline-none focus:ring-0 focus:border-2 focus:border-[#005c75] hover:border-gray-300 transition-colors",children:o.map(L=>l.jsx("option",{value:L,children:L},L))}),l.jsx("svg",{className:"absolute right-2 top-1/2 -translate-y-1/2 w-3 h-3 text-gray-500 pointer-events-none",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}):l.jsx("span",{className:"text-gray-900 font-medium text-[12px]",children:r})]}),l.jsxs("div",{className:"flex-shrink-0",children:[l.jsx("div",{className:"text-[11px] text-gray-500 mb-2 uppercase",children:"Compared To:"}),l.jsxs("div",{className:"relative w-[200px]",children:[l.jsx("select",{value:a,onChange:L=>ot(L.target.value),className:"appearance-none bg-gray-50 border border-gray-200 rounded px-[10px] pr-6 text-[13px] h-[39px] w-full cursor-pointer focus:outline-none focus:ring-0 focus:border-2 focus:border-[#005c75] hover:border-gray-300 transition-colors",children:o.filter(L=>L!==r).map(L=>l.jsx("option",{value:L,children:L},L))}),l.jsx("svg",{className:"absolute right-2 top-1/2 -translate-y-1/2 w-3 h-3 text-gray-500 pointer-events-none",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),l.jsx("div",{className:"flex-1 mt-6",children:l.jsxs("div",{className:"relative flex items-center",children:[l.jsx("svg",{className:"absolute left-3 w-4 h-4 text-gray-400 pointer-events-none",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),l.jsx("input",{type:"text",placeholder:"Search component",className:"w-full bg-gray-50 border border-gray-200 rounded pl-9 pr-[10px] text-[13px] h-[39px] placeholder:text-gray-400 focus:outline-none focus:ring-0 focus:border-2 focus:border-[#005c75] transition-colors"})]})})]})}),l.jsx("div",{className:"mb-3",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center",children:[l.jsxs("span",{className:"font-mono uppercase",style:{fontSize:"11px",color:"#8b8b8b",fontWeight:500,letterSpacing:"0.05em"},children:[l.jsx("span",{style:{color:"#000000"},children:T.length})," ","modified ",T.length===1?"file":"files"]}),l.jsxs("div",{className:"relative group inline-flex items-center ml-1.5",children:[l.jsx("svg",{className:"w-3 h-3 text-gray-400 cursor-help",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),l.jsx("div",{className:"absolute left-0 top-full mt-2 hidden group-hover:block z-50 w-80",children:l.jsxs("div",{className:"bg-gray-900 text-white text-xs rounded-lg px-3 py-2 shadow-lg",children:["In CodeYam, an entity is a discrete, analyzable unit of code that can be independently simulated and tested.",l.jsx("div",{className:"absolute -top-1 left-4 w-2 h-2 bg-gray-900 transform rotate-45"})]})})]}),l.jsx("span",{className:"font-mono uppercase",style:{fontSize:"11px",color:"#d1d5db",fontWeight:500,letterSpacing:"0.05em",marginLeft:"8px"},children:"|"}),l.jsxs("span",{className:"font-mono uppercase",style:{fontSize:"11px",color:"#8b8b8b",fontWeight:500,letterSpacing:"0.05em",marginLeft:"8px"},children:[l.jsx("span",{style:{color:"#000000"},children:ze.length})," ",ze.length===1?"entity":"entities"]})]}),T.length>0&&l.jsxs("div",{className:"flex gap-6",children:[l.jsxs("button",{onClick:V,className:"text-[#005c75] hover:bg-[#E6F5F8] hover:text-[#003d4f] font-mono uppercase transition-all cursor-pointer px-3 py-1 rounded flex items-center gap-1.5",style:{fontSize:"11px",fontWeight:500,letterSpacing:"0.05em"},children:[l.jsx(bn,{className:"w-3.5 h-3.5"}),"Expand All"]}),l.jsxs("button",{onClick:te,className:"text-[#005c75] hover:bg-[#E6F5F8] hover:text-[#003d4f] font-mono uppercase transition-all cursor-pointer px-3 py-1 rounded flex items-center gap-1.5",style:{fontSize:"11px",fontWeight:500,letterSpacing:"0.05em"},children:[l.jsx(wn,{className:"w-3.5 h-3.5"}),"Collapse All"]})]})]})}),l.jsxs("div",{className:"overflow-hidden",children:[N==="branch"&&r&&l.jsx(ns,{files:E,currentBranch:r,defaultBranch:s,baseBranch:a,allBranches:o,expandedFiles:k,isEntityBeingAnalyzed:rt,isEntityQueued:it,sortOrder:C,onToggleFile:L=>I(L,k,S),onBranchChange:ot,onGenerateSimulation:J,onSortChange:v,onAnalyzeAll:at,analyzeAllDisabled:ct,analyzeAllText:dt}),N==="uncommitted"&&l.jsx(rs,{files:A,entityImpactMap:B,expandedFiles:k,isEntityBeingAnalyzed:rt,isEntityQueued:it,projectSlug:f,baseBranch:a,currentBranch:r,sortOrder:C,onToggleFile:L=>I(L,k,S),onShowFileDiff:$e,onGenerateSimulation:J,onSortChange:v,onAnalyzeAll:at,analyzeAllDisabled:ct,analyzeAllText:dt})]}),Z&&l.jsx(ts,{diffView:Z,diffContent:se,isLoading:ae,entities:t,onClose:Ve}),g&&f&&l.jsx(Cn,{projectSlug:f,onClose:()=>p(null)})]})})});export{ws as default,bs as meta};
|