@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.
Files changed (81) hide show
  1. package/analyzer-template/.build-info.json +7 -7
  2. package/analyzer-template/log.txt +3 -3
  3. package/analyzer-template/package.json +3 -3
  4. package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +13 -7
  5. package/analyzer-template/packages/analyze/src/lib/asts/index.ts +7 -2
  6. package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js +196 -0
  7. package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js.map +1 -0
  8. package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js +114 -0
  9. package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js.map +1 -0
  10. package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js +149 -0
  11. package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js.map +1 -0
  12. package/codeyam-cli/src/commands/default.js +3 -46
  13. package/codeyam-cli/src/commands/default.js.map +1 -1
  14. package/codeyam-cli/src/commands/editor.js +254 -66
  15. package/codeyam-cli/src/commands/editor.js.map +1 -1
  16. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +234 -0
  17. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -1
  18. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js +12 -1
  19. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js.map +1 -1
  20. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +29 -0
  21. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -1
  22. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +1217 -0
  23. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -0
  24. package/codeyam-cli/src/utils/backgroundServer.js +2 -2
  25. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  26. package/codeyam-cli/src/utils/editorAudit.js +45 -5
  27. package/codeyam-cli/src/utils/editorAudit.js.map +1 -1
  28. package/codeyam-cli/src/utils/editorJournal.js +7 -0
  29. package/codeyam-cli/src/utils/editorJournal.js.map +1 -1
  30. package/codeyam-cli/src/utils/entityChangeStatus.js +255 -0
  31. package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -0
  32. package/codeyam-cli/src/utils/install-skills.js +1 -1
  33. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  34. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +5 -1
  35. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  36. package/codeyam-cli/src/webserver/build/client/assets/Terminal-nZNBALox.js +41 -0
  37. package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-diff-l0sNRNKZ.js +1 -0
  38. package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-l0sNRNKZ.js +1 -0
  39. package/codeyam-cli/src/webserver/build/client/assets/editor-DTwKl1Xu.js +10 -0
  40. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.dev-D8ILZMR0.js → entity._sha.scenarios._scenarioId.dev-DjACbfdI.js} +1 -1
  41. package/codeyam-cli/src/webserver/build/client/assets/git-CdN8sCqs.js +1 -0
  42. package/codeyam-cli/src/webserver/build/client/assets/globals-h1-1oFYI.css +1 -0
  43. package/codeyam-cli/src/webserver/build/client/assets/index-yHOVb4rc.js +15 -0
  44. package/codeyam-cli/src/webserver/build/client/assets/manifest-9422aeab.js +1 -0
  45. package/codeyam-cli/src/webserver/build/client/assets/{memory-FweZHj5U.js → memory-Dg0mvYrI.js} +4 -1
  46. package/codeyam-cli/src/webserver/build/client/assets/{root-DUKqhFlb.js → root-BzQgN2ff.js} +1 -1
  47. package/codeyam-cli/src/webserver/build/server/assets/{index-BLhjL9Xi.js → index-Bh_pNxNA.js} +1 -1
  48. package/codeyam-cli/src/webserver/build/server/assets/server-build-Bqr22tlO.js +367 -0
  49. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  50. package/codeyam-cli/src/webserver/build-info.json +5 -5
  51. package/codeyam-cli/src/webserver/server.js +32 -6
  52. package/codeyam-cli/src/webserver/server.js.map +1 -1
  53. package/codeyam-cli/src/webserver/terminalServer.js +23 -4
  54. package/codeyam-cli/src/webserver/terminalServer.js.map +1 -1
  55. package/codeyam-cli/templates/editor-step-hook.py +53 -6
  56. package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +10 -5
  57. package/codeyam-cli/templates/skills/codeyam-memory/SKILL.md +10 -10
  58. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/detect-deprecated-patterns.mjs +139 -0
  59. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/find-exports.mjs +52 -0
  60. package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/read-json-field.mjs +61 -0
  61. package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/ripgrep-fallback.mjs +155 -0
  62. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/cleanup.mjs +13 -0
  63. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/filter-session.mjs +95 -0
  64. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/preprocess.mjs +160 -0
  65. package/package.json +10 -10
  66. package/packages/analyze/src/lib/ProjectAnalyzer.js +10 -4
  67. package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
  68. package/packages/analyze/src/lib/asts/index.js +4 -2
  69. package/packages/analyze/src/lib/asts/index.js.map +1 -1
  70. package/scripts/npm-post-install.cjs +22 -0
  71. package/codeyam-cli/src/webserver/build/client/assets/Terminal-wkqC0AQk.js +0 -41
  72. package/codeyam-cli/src/webserver/build/client/assets/editor-CdjF_fX6.js +0 -8
  73. package/codeyam-cli/src/webserver/build/client/assets/git-CFCTYk9I.js +0 -15
  74. package/codeyam-cli/src/webserver/build/client/assets/globals-B17TBSS6.css +0 -1
  75. package/codeyam-cli/src/webserver/build/client/assets/manifest-b8fd6b07.js +0 -1
  76. package/codeyam-cli/src/webserver/build/server/assets/server-build-DyMuI5mU.js +0 -363
  77. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/detect-deprecated-patterns.sh +0 -108
  78. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/find-exports.sh +0 -69
  79. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/cleanup.sh +0 -12
  80. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/filter.jq +0 -45
  81. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/preprocess.sh +0 -139
@@ -1 +1 @@
1
- {"version":3,"file":"setupClaudeCodeSettings.js","sourceRoot":"","sources":["../../../../src/utils/setupClaudeCodeSettings.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"setupClaudeCodeSettings.js","sourceRoot":"","sources":["../../../../src/utils/setupClaudeCodeSettings.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,41 @@
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 P}from"./preload-helper-ckwbz45p.js";function te({serverUrl:f,isStarting:z,projectSlug:g,devServerError:E,onStartServer:y}){const[b,v]=n.useState(null),m=n.useRef(null);n.useEffect(()=>{if(!g)return;const h=new EventSource("/api/dev-mode-events");return h.onmessage=A=>{try{const T=JSON.parse(A.data);T.type==="file-synced"&&(v(T.fileName),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{v(null)},5e3))}catch{}},()=>{h.close(),m.current&&clearTimeout(m.current)}},[g]);let a;E?a="error":z?a="starting":f?a="running":a="stopped";const N={starting:"bg-yellow-400",running:"bg-green-400",stopped:"bg-gray-400",error:"bg-red-400"},S={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 ${N[a]}`}),r.jsxs("span",{className:"text-gray-400",children:["Server:"," ",r.jsx("span",{className:"text-gray-300",children:S[a]})]}),(a==="stopped"||a==="error")&&y&&r.jsx("button",{onClick:y,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]"}),b&&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: ",b]})]}),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 Q=`
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 Y(){if(document.getElementById("xterm-css"))return;const f=document.createElement("style");f.id="xterm-css",f.textContent=Q,document.head.appendChild(f)}const re=n.forwardRef(function({entityName:z,entityType:g,entitySha:E,entityFilePath:y,scenarioName:b,scenarioDescription:v,analysisId:m,projectSlug:a,onRefreshPreview:N,onShowResults:S,onHideResults:h,editorMode:A,onIdleChange:T,notificationsEnabled:D},$){const M=n.useRef(null),k=n.useRef(null),j=n.useRef(null),w=n.useRef(null),B=n.useRef(null),C=n.useRef(!1),R=n.useRef(0),F=n.useRef(!1),x=n.useRef(T);x.current=T;const L=n.useRef(D);L.current=D;const q=n.useCallback(()=>{var o;(o=j.current)==null||o.focus()},[]);return n.useImperativeHandle($,()=>({sendInput(o){const l=w.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 Y(),Promise.all([P(()=>import("./xterm-BqvuqXEL.js"),[]),P(()=>import("./addon-fit-CUXOrorO.js").then(p=>p.a),__vite__mapDeps([0,1])),P(()=>import("./addon-web-links-Duc5hnl7.js").then(p=>p.a),__vite__mapDeps([2,1]))]).then(([p,U,V])=>{if(l)return;const t=new p.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 u=new BroadcastChannel("codeyam-editor");u.postMessage({type:"switch-scenario",scenarioId:c}),u.close();return}}catch{}window.open(e,"_blank")}}}),O=new U.FitAddon;t.loadAddon(O),t.loadAddon(new V.WebLinksAddon),t.open(o),requestAnimationFrame(()=>{try{O.fit()}catch{}}),j.current=t,t.focus(),setTimeout(()=>t.focus(),100),setTimeout(()=>t.focus(),500);const X=window.location.protocol==="https:"?"wss:":"ws:",G=window.location.host;function K(s){const e=new URLSearchParams;return e.set("entityName",z),g&&e.set("entityType",g),E&&e.set("entitySha",E),y&&e.set("entityFilePath",y),b&&e.set("scenarioName",b),v&&e.set("scenarioDescription",v),m&&e.set("analysisId",m),a&&e.set("projectSlug",a),A&&e.set("editorMode","true"),s&&e.set("reconnectId",s),`${X}//${G}/ws/terminal?${e.toString()}`}function W(s){const e=K(s),i=new WebSocket(e);w.current=i,i.onopen=()=>{R.current=0,F.current=!1,i.send(JSON.stringify({type:"resize",cols:t.cols,rows:t.rows}))},i.onmessage=c=>{var u,I;try{const d=JSON.parse(c.data);if(d.type==="session-id"){B.current=d.sessionId;return}if(d.type==="refresh-preview"){N==null||N(d.path);return}if(d.type==="show-results"){S==null||S();return}if(d.type==="hide-results"){h==null||h();return}if(d.type==="claude-idle"){if(console.log("[Terminal] Received claude-idle, notifications:",L.current,"permission:",typeof Notification<"u"?Notification.permission:"N/A"),(u=x.current)==null||u.call(x,!0),L.current&&typeof Notification<"u"&&Notification.permission==="granted"){const H=new Notification("Claude is ready for you",{body:"Claude has finished and is waiting for your input.",tag:"claude-idle"});H.onclick=()=>{window.focus(),H.close()}}return}d.type==="output"&&(t.write(d.data),(I=x.current)==null||I.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=R.current;if(c<5&&B.current){const u=1e3*Math.pow(2,Math.min(c,3));R.current=c+1,t.write(`\r
36
+ \x1B[33m[Reconnecting...]\x1B[0m\r
37
+ `),setTimeout(()=>{C.current||W(B.current)},u)}else F.current?t.write(`\r
38
+ \x1B[90m[Terminal session ended]\x1B[0m\r
39
+ `):(F.current=!0,t.write(`\r
40
+ \x1B[33m[Starting new session...]\x1B[0m\r
41
+ `),B.current=null,R.current=0,W())},i.onerror=()=>{}}W(),t.onData(s=>{const e=w.current;e&&e.readyState===WebSocket.OPEN&&e.send(JSON.stringify({type:"input",data:s}))});let _=null;const J=new ResizeObserver(()=>{_&&clearTimeout(_),_=setTimeout(()=>{let s;try{s=O.proposeDimensions()}catch{return}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),O.fit(),e&&i!==void 0&&(c?e.scrollTop=e.scrollHeight:e.scrollTop=i);const u=w.current;u&&u.readyState===WebSocket.OPEN&&u.send(JSON.stringify({type:"resize",cols:t.cols,rows:t.rows}))},150)});J.observe(o),k.current=()=>{var s;_&&clearTimeout(_),J.disconnect(),C.current=!0,(s=w.current)==null||s.close(),w.current=null,t.dispose(),j.current=null}}),()=>{var p;l=!0,(p=k.current)==null||p.call(k),k.current=null}},[]),r.jsx("div",{ref:M,onClick:q,className:"w-full h-full",style:{padding:"4px 0 0 8px"}})});export{te as D,re as T};
@@ -0,0 +1,10 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-yHOVb4rc.js","assets/chunk-JZWAC4HX-C4pqxYJB.js"])))=>i.map(i=>d[i]);
2
+ import{r,j as e,w as pt,u as ht,f as ut,b as ft}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{u as gt,V as jt,S as bt}from"./useCustomSizes-ByhSyh0W.js";import{T as vt,D as Nt}from"./Terminal-nZNBALox.js";import{C as ge}from"./CopyButton-DmJveP3T.js";import{_ as wt}from"./preload-helper-ckwbz45p.js";import{c as yt}from"./cy-logo-cli-DcX-ZS3p.js";import{S as Le,u as St}from"./Spinner-Bb5uFQ5V.js";import"./copy-NDbZjXao.js";import"./createLucideIcon-CMT1jU2q.js";import"./useLastLogLine-C14nCb1q.js";function je(a){const[t,s]=r.useState(null),[x,u]=r.useState(!1),j=r.useCallback(()=>{a&&(u(!0),fetch(`/api/editor-test-results?testFile=${encodeURIComponent(a)}`).then(p=>p.json()).then(p=>{s(p),u(!1)}).catch(()=>{s({testFilePath:a,status:"error",testCases:[],errorMessage:"Failed to fetch test results"}),u(!1)}))},[a]);return r.useEffect(()=>{a&&j()},[a,j]),{results:t,isRunning:x,runTests:j}}function be(a){if(!a||a==="/")return"Home";const s=a.split("?")[0].replace(/^\//,"").split("/")[0];return s.charAt(0).toUpperCase()+s.slice(1)}function fe(a,t){return!t||Object.keys(t).length===0?a:a.filter(([s])=>t[s])}function K({imgSrc:a,name:t,isActive:s,onSelect:x}){return e.jsxs("button",{onClick:x,className:"flex flex-col items-center gap-1 cursor-pointer group",title:t,children:[e.jsx("div",{className:`w-32 h-32 rounded overflow-hidden border-2 transition-all bg-[#1a1a1a] ${s?"border-[#005c75] ring-1 ring-[#005c75]":"border-transparent hover:border-[#4d4d4d]"}`,children:a?e.jsx("img",{src:a,alt:t,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 ${s?"text-white":"text-gray-500 group-hover:text-gray-300"}`,children:t})]})}function he({testFile:a,entityName:t}){const{results:s,isRunning:x,runTests:u}=je(a);if(x&&!s)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(!s)return null;if(s.status==="error")return e.jsx("div",{className:"px-2 pt-1",children:e.jsx("span",{className:"text-[10px] text-red-400",children:s.errorMessage})});const j=t?s.testCases.filter(d=>d.fullName.startsWith(t)):s.testCases,p=j.length>0?j:s.testCases;if(p.length===0)return null;const N=t?`${t} > `:"";return e.jsxs("div",{className:"px-2 pt-1 space-y-0.5",children:[p.map(d=>{var C;const S=N&&d.fullName.startsWith(N)?d.fullName.slice(N.length):d.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[d.status==="passed"?e.jsx("span",{className:"text-green-400 text-[10px]",children:"✓"}):d.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] ${d.status==="passed"?"text-green-400":d.status==="failed"?"text-red-400":"text-gray-500"}`,children:S})]}),d.status==="failed"&&((C=d.failureMessages)==null?void 0:C.map((w,E)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-300/70 truncate max-w-full",title:w,children:w.split(`
3
+ `)[0]},E)))]},d.fullName)}),e.jsx("button",{onClick:u,disabled:x,className:"mt-1 text-[10px] text-[#00a0c4] hover:text-[#00c4ee] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:x?"Running...":"Re-run"})]})}function V({filePath:a}){return a?e.jsxs("div",{className:"flex items-center gap-1 px-2 mt-0.5",children:[e.jsxs("a",{href:`/api/editor-file?path=${encodeURIComponent(a)}`,target:"_blank",rel:"noopener noreferrer",title:"Open file",className:"flex items-center gap-1 text-gray-500 hover:text-gray-300 transition-colors min-w-0",children:[e.jsx("span",{className:"text-[9px] truncate",children:a}),e.jsx("svg",{className:"shrink-0",width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M4.5 1.5H2.5C1.95 1.5 1.5 1.95 1.5 2.5V9.5C1.5 10.05 1.95 10.5 2.5 10.5H9.5C10.05 10.5 10.5 10.05 10.5 9.5V7.5M7.5 1.5H10.5M10.5 1.5V4.5M10.5 1.5L5 7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e.jsx(ge,{content:a,icon:!0,iconSize:10,className:"shrink-0 text-gray-500 hover:text-gray-300 transition-colors"})]}):null}function Ct({scenarios:a,projectRoot:t,activeScenarioId:s,onScenarioSelect:x,zoomComponent:u,onZoomChange:j,analyzedEntities:p=[],glossaryFunctions:N=[],activeAnalyzedScenarioId:d,onAnalyzedScenarioSelect:S,entityImports:C,pageFilePaths:w={}}){const{pageGroups:E,componentGroups:P}=r.useMemo(()=>{const n=new Map,c=new Map;for(const y of a)if(y.componentName){const L=c.get(y.componentName)||[];L.push(y),c.set(y.componentName,L)}else{const L=be(y.url),o=n.get(L)||[];o.push(y),n.set(L,o)}const m=new Map([...c.entries()].sort(([y],[L])=>y.localeCompare(L)));return{pageGroups:n,componentGroups:m}},[a]),R=r.useMemo(()=>{const n=new Set((p||[]).filter(m=>m.entityType==="visual").map(m=>m.name)),c=new Map;for(const[m,y]of P)n.has(m)||c.set(m,y);return c},[P,p]),{visualEntities:g,libraryEntities:$}=r.useMemo(()=>{const n=p.filter(m=>m.entityType==="visual").sort((m,y)=>m.name.localeCompare(y.name)),c=p.filter(m=>m.entityType==="library"||m.entityType==="functionCall").sort((m,y)=>m.name.localeCompare(y.name));return{visualEntities:n,libraryEntities:c}},[p]),T=r.useMemo(()=>{const n=new Set($.map(c=>c.name));return N.filter(c=>!n.has(c.name)).sort((c,m)=>c.name.localeCompare(m.name))},[N,$]),b=p.some(n=>n.isAnalyzing),M=r.useRef(null),l=r.useRef(0),v=r.useCallback(()=>{M.current&&(l.current=M.current.scrollTop)},[]);if(r.useEffect(()=>{M.current&&l.current>0&&(M.current.scrollTop=l.current)}),a.length===0&&p.length===0&&T.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 n=P.get(u)||[],c=new Set((C==null?void 0:C[u])||[]),m=c.size>0,y=m?g.filter(o=>c.has(o.name)):[],L=m?$.filter(o=>c.has(o.name)):[];return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-3 space-y-1",children:[e.jsxs("button",{onClick:()=>j(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:n.length===0?e.jsx("div",{className:"px-3 py-2 text-xs text-gray-500",children:"No scenarios for this component"}):n.map(o=>e.jsx(K,{imgSrc:o.screenshotPath?`/api/editor-scenario-image/${o.id}.png`:null,name:o.name,isActive:o.id===s,onSelect:()=>x(o)},o.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(o=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"flex items-center gap-2 px-2 py-1",children:e.jsx("button",{onClick:()=>j(o.name),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:o.name})}),e.jsx(V,{filePath:o.filePath,projectRoot:t}),(o.scenarios.length>0||o.pendingScenarios.length>0)&&e.jsx("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:o.scenarios.map(h=>e.jsx(K,{imgSrc:h.screenshotPath?`/api/screenshot/${h.screenshotPath}`:null,name:h.name,isActive:h.id===d,onSelect:()=>S==null?void 0:S({analysisId:o.analysisId,scenarioId:h.id,scenarioName:h.name,entitySha:o.sha,entityName:o.name})},h.id))})]},o.sha))]}),L.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"})}),L.map(o=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-300",children:o.name})}),e.jsx(V,{filePath:o.filePath,projectRoot:t}),o.testFile&&e.jsx(he,{testFile:o.testFile,entityName:o.name})]},o.sha))]})]})})}return e.jsx("div",{ref:M,onScroll:v,className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-3 space-y-3",children:[E.size>0&&e.jsxs("div",{children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Application"})}),[...E.entries()].sort(([n],[c])=>n==="Home"?-1:c==="Home"?1:n.localeCompare(c)).map(([n,c])=>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:n})}),w[n]&&e.jsx(V,{filePath:w[n],projectRoot:t}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:c.map(m=>e.jsx(K,{imgSrc:m.screenshotPath?`/api/editor-scenario-image/${m.id}.png`:null,name:m.name,isActive:m.id===s&&!d,onSelect:()=>x(m)},m.id))})]},n))]}),R.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"})}),[...R.entries()].map(([n,c])=>{var m;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:()=>j(n),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:n})}),((m=c[0])==null?void 0:m.componentPath)&&e.jsx(V,{filePath:c[0].componentPath,projectRoot:t}),e.jsx("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:c.map(y=>e.jsx(K,{imgSrc:y.screenshotPath?`/api/editor-scenario-image/${y.id}.png`:null,name:y.name,isActive:y.id===s&&!d,onSelect:()=>x(y)},y.id))})]},n)})]}),g.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"}),b&&a.length===0&&p.every(n=>n.scenarioCount===0)&&e.jsx("span",{className:"ml-2 text-[10px] text-gray-500",children:"— Entities are being analyzed..."})]}),g.map(n=>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:()=>j(n.name),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:n.name}),n.isAnalyzing&&n.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:n.filePath,projectRoot:t}),(n.scenarios.length>0||n.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:[n.scenarios.map(c=>e.jsx(K,{imgSrc:c.screenshotPath?`/api/screenshot/${c.screenshotPath}`:null,name:c.name,isActive:c.id===d,onSelect:()=>S==null?void 0:S({analysisId:n.analysisId,scenarioId:c.id,scenarioName:c.name,entitySha:n.sha,entityName:n.name})},c.id)),n.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))]})]},n.sha))]}),($.length>0||T.length>0)&&e.jsxs("div",{className:`pt-2 mt-1 ${g.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"})}),$.map(n=>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:n.name}),n.isAnalyzing&&n.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:n.filePath,projectRoot:t}),n.testFile?e.jsx(he,{testFile:n.testFile,entityName:n.name}):e.jsx("div",{className:"px-2 pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-500",children:"No test file"})})]},n.sha)),T.map(n=>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:n.name})}),e.jsx(V,{filePath:n.filePath,projectRoot:t}),e.jsx(he,{testFile:n.testFile,entityName:n.name})]},n.name))]})]})})}function kt(a){const t=new Map;for(const s of[...a].reverse()){const x=t.get(s.date)||[];x.push(s),t.set(s.date,x)}return t}function Pt(a){const t=new Map;for(const s of a){const x=s.name.indexOf(" - "),u=x!==-1?s.name.slice(0,x):"App",j=t.get(u)||[];j.push(s),t.set(u,j)}return[...t.entries()].sort(([s],[x])=>s==="App"?-1:x==="App"?1:s.localeCompare(x))}function _e({status:a}){const t={new:{label:"New",bg:"bg-green-900/40",text:"text-green-400",border:"border-green-700/50"},edited:{label:"Edited",bg:"bg-blue-900/40",text:"text-blue-400",border:"border-blue-700/50"},impacted:{label:"Impacted",bg:"bg-amber-900/40",text:"text-amber-400",border:"border-amber-700/50"}}[a.status];return e.jsx("span",{className:`${t.bg} ${t.text} ${t.border} border text-[8px] font-bold px-1 py-0 rounded-full uppercase tracking-wider`,children:t.label})}function Mt({testFile:a,entityName:t}){const{results:s,isRunning:x,runTests:u}=je(a);if(x&&!s)return e.jsxs("div",{className:"pt-1 flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#00a0c4] animate-pulse"}),e.jsx("span",{className:"text-[10px] text-gray-500",children:"Running tests..."})]});if(!s)return null;if(s.status==="error")return e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-red-400",children:s.errorMessage})});const j=t?s.testCases.filter(d=>d.fullName.startsWith(t)):s.testCases,p=j.length>0?j:s.testCases;if(p.length===0)return null;const N=t?`${t} > `:"";return e.jsxs("div",{className:"pt-1 space-y-0.5",children:[p.map(d=>{var C;const S=N&&d.fullName.startsWith(N)?d.fullName.slice(N.length):d.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[d.status==="passed"?e.jsx("span",{className:"text-green-400 text-[10px]",children:"✓"}):d.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] ${d.status==="passed"?"text-green-400":d.status==="failed"?"text-red-400":"text-gray-500"}`,children:S})]}),d.status==="failed"&&((C=d.failureMessages)==null?void 0:C.map((w,E)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-400/70 truncate max-w-full",title:w,children:w.split(`
4
+ `)[0]},E)))]},d.fullName)}),e.jsx("button",{onClick:u,disabled:x,className:"mt-1 text-[10px] text-[#00a0c4] hover:text-[#38bdf8] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:x?"Running...":"Re-run"})]})}const Et={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 $t(a){try{return new Date(a).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}function It(a){try{return new Date(a+"T00:00:00").toLocaleDateString([],{weekday:"long",month:"long",day:"numeric"})}catch{return a}}function Tt({isActive:a,onScreenshotClick:t,glossaryFunctions:s=[],pageNames:x=[]}){const[u,j]=r.useState([]),[p,N]=r.useState(!0),[d,S]=r.useState(new Set),C=r.useCallback(P=>{S(R=>{const g=new Set(R);return g.has(P)?g.delete(P):g.add(P),g})},[]),w=r.useCallback(async()=>{try{const P=await fetch("/api/editor-journal");if(P.ok){const R=await P.json();j(R.entries||[])}}catch{}finally{N(!1)}},[]);if(r.useEffect(()=>{w()},[w]),r.useEffect(()=>{a&&w()},[a,w]),r.useEffect(()=>{const P=new EventSource("/api/events");return P.addEventListener("message",R=>{try{const g=JSON.parse(R.data);g.type==="db-change"&&g.changeType==="journal"&&w()}catch{}}),()=>P.close()},[w]),p)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(u.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 E=kt(u);return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsx("div",{className:"p-3 space-y-4",children:[...E.entries()].map(([P,R])=>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:It(P)})}),e.jsx("div",{className:"space-y-2",children:R.map((g,$)=>{const T=Et[g.type]||{label:g.type,color:"bg-gray-600"},b=`${g.time}-${$}`,M=d.has(b);return e.jsxs("div",{className:"bg-[#2d2d2d] rounded-lg overflow-hidden",children:[e.jsxs("div",{className:`p-3 space-y-2 ${M?"":"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:`${T.color} text-white text-[9px] font-bold px-1.5 py-0.5 rounded uppercase tracking-wider shrink-0`,children:T.label})]}),e.jsx("span",{className:"text-[10px] text-gray-500",children:$t(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:()=>t==null?void 0:t({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 l=Pt(g.scenarioScreenshots);new Set(x);const v=l.filter(([o])=>o==="App").flatMap(([,o])=>o),n=fe(l.filter(([o])=>o!=="App"),g.entityChangeStatus),c=g.entityChangeStatus,y=c&&Object.keys(c).length>0?x.filter(o=>c[o]):x,L=o=>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:()=>t==null?void 0:t({screenshotUrl:`/api/editor-journal-image/${o.path.replace("screenshots/","")}`,commitSha:g.commitSha,commitMessage:g.commitMessage,scenarioName:o.name}),children:e.jsx("img",{src:`/api/editor-journal-image/${o.path.replace("screenshots/","")}`,alt:o.name,title:o.name,className:"max-w-full max-h-full object-contain",loading:"lazy"})},o.path);return e.jsxs("div",{className:"space-y-2",children:[(y.length>0||v.length>0)&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Application"}),y.map(o=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] font-medium text-gray-400",children:o}),(c==null?void 0:c[o])&&e.jsx(_e,{status:c[o]})]}),v.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-0.5",children:v.map(L)})]},o))]}),n.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),n.map(([o,h])=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] font-medium text-gray-400",children:o}),(c==null?void 0:c[o])&&e.jsx(_e,{status:c[o]})]}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-0.5",children:h.map(L)})]},o))]})]})})(),s.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"}),e.jsx("div",{className:"space-y-2",children:s.map(l=>e.jsxs("div",{children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-200",children:l.name}),e.jsx("span",{className:"text-[9px] text-gray-500 truncate block",children:l.filePath}),l.testFile?e.jsx(Mt,{testFile:l.testFile,entityName:l.name}):e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-500",children:"No test file"})})]},l.name))})]}),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:()=>C(b),className:"w-full py-1.5 text-[10px] text-gray-500 hover:text-gray-300 border-t border-[#3d3d3d] transition-colors cursor-pointer",children:["——— ",M?"Collapse":"Expand"," ———"]})]},b)})})]},P))})})}function U({imgSrc:a,name:t,isActive:s,onSelect:x}){return e.jsxs("button",{onClick:x,className:"flex flex-col items-center gap-1 cursor-pointer group",title:t,children:[e.jsx("div",{className:`w-24 h-24 rounded overflow-hidden border-2 transition-all bg-[#1a1a1a] ${s?"border-[#005c75] ring-1 ring-[#005c75]":"border-transparent hover:border-[#4d4d4d]"}`,children:a?e.jsx("img",{src:a,alt:t,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 ${s?"text-white":"text-gray-500 group-hover:text-gray-300"}`,children:t})]})}function Be({filePath:a}){return a?e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsxs("a",{href:`/api/editor-file?path=${encodeURIComponent(a)}`,target:"_blank",rel:"noopener noreferrer",title:"Open file",className:"flex items-center gap-1 text-gray-500 hover:text-gray-300 transition-colors min-w-0",children:[e.jsx("span",{className:"text-[9px] truncate",children:a}),e.jsx("svg",{className:"shrink-0",width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M4.5 1.5H2.5C1.95 1.5 1.5 1.95 1.5 2.5V9.5C1.5 10.05 1.95 10.5 2.5 10.5H9.5C10.05 10.5 10.5 10.05 10.5 9.5V7.5M7.5 1.5H10.5M10.5 1.5V4.5M10.5 1.5L5 7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e.jsx(ge,{content:a,icon:!0,iconSize:10,className:"shrink-0 text-gray-500 hover:text-gray-300 transition-colors"})]}):null}function Rt({hasProject:a,scenarios:t,analyzedEntities:s,glossaryFunctions:x=[],projectRoot:u,activeScenarioId:j,onScenarioSelect:p,onAnalyzedScenarioSelect:N,onSwitchToBuild:d,zoomComponent:S,onZoomChange:C,entityImports:w,pageFilePaths:E={}}){const{pageGroups:P,componentGroups:R}=r.useMemo(()=>{const l=new Map,v=new Map;for(const c of t)if(c.componentName){const m=v.get(c.componentName)||[];m.push(c),v.set(c.componentName,m)}else{const m=be(c.url),y=l.get(m)||[];y.push(c),l.set(m,y)}const n=new Map([...v.entries()].sort(([c],[m])=>c.localeCompare(m)));return{pageGroups:l,componentGroups:n}},[t]),g=r.useRef(null),$=r.useRef(0),T=r.useCallback(()=>{g.current&&($.current=g.current.scrollTop)},[]);if(r.useEffect(()=>{g.current&&$.current>0&&(g.current.scrollTop=$.current)}),!a)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:d,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 b=r.useMemo(()=>s.filter(l=>l.entityType==="visual").sort((l,v)=>l.name.localeCompare(v.name)),[s]);if(!(t.length>0||b.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:d,className:"px-6 py-3 bg-[#005c75] text-white text-sm font-medium rounded-lg hover:bg-[#004d63] transition-colors cursor-pointer",children:"Start Building"})]})});if(S){const l=P.get(S)||[],v=R.get(S)||[],n=b.find(h=>h.name===S),c=P.has(S),m=new Set((w==null?void 0:w[S])||[]),y=m.size>0,L=y?[...R.entries()].filter(([h])=>m.has(h)):[...R.entries()],o=y?b.filter(h=>m.has(h.name)):b;return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsxs("button",{onClick:()=>C(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:S}),l.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(h=>e.jsx(U,{imgSrc:h.screenshotPath?`/api/editor-scenario-image/${h.id}.png`:null,name:h.name,isActive:h.id===j,onSelect:()=>p(h)},h.id))}),v.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:v.map(h=>e.jsx(U,{imgSrc:h.screenshotPath?`/api/editor-scenario-image/${h.id}.png`:null,name:h.name,isActive:h.id===j,onSelect:()=>p(h)},h.id))}),n&&(n.scenarios.length>0||n.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2",children:[n.scenarios.map(h=>e.jsx(U,{imgSrc:h.screenshotPath?`/api/screenshot/${h.screenshotPath}`:null,name:h.name,isActive:!1,onSelect:()=>N({analysisId:n.analysisId,scenarioId:h.id,scenarioName:h.name,entitySha:n.sha,entityName:n.name})},h.id)),n.pendingScenarios.map(h=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:h,children:h},h))]}),c&&L.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"}),L.map(([h,D])=>e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>C(h),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:h})}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:D.map(B=>e.jsx(U,{imgSrc:B.screenshotPath?`/api/editor-scenario-image/${B.id}.png`:null,name:B.name,isActive:B.id===j,onSelect:()=>p(B)},B.id))})]},h))]}),c&&o.length>0&&e.jsxs("div",{className:`${L.length===0?"pt-2 mt-1 border-t border-[#3d3d3d]":"mt-2"}`,children:[L.length===0&&e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),o.map(h=>e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>C(h.name),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:h.name})}),(h.scenarios.length>0||h.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[h.scenarios.map(D=>e.jsx(U,{imgSrc:D.screenshotPath?`/api/screenshot/${D.screenshotPath}`:null,name:D.name,isActive:!1,onSelect:()=>N({analysisId:h.analysisId,scenarioId:D.id,scenarioName:D.name,entitySha:h.sha,entityName:h.name})},D.id)),h.pendingScenarios.map(D=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:D,children:D},D))]})]},h.sha))]}),l.length===0&&v.length===0&&!n&&e.jsx("div",{className:"text-xs text-gray-500",children:"No scenarios for this entity"})]})})}return e.jsx("div",{ref:g,onScroll:T,className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsx("h2",{className:"text-sm font-medium text-gray-300 m-0 font-['IBM_Plex_Sans']",children:"What do you want to work on next?"}),e.jsx("button",{onClick:d,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"}),P.size>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Application"}),[...P.entries()].sort(([l],[v])=>l==="Home"?-1:v==="Home"?1:l.localeCompare(v)).map(([l,v])=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>C(l),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:l})}),E[l]&&e.jsx(Be,{filePath:E[l],projectRoot:u}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:v.map(n=>e.jsx(U,{imgSrc:n.screenshotPath?`/api/editor-scenario-image/${n.id}.png`:null,name:n.name,isActive:n.id===j,onSelect:()=>p(n)},n.id))})]},l))]}),R.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"})}),[...R.entries()].map(([l,v])=>e.jsxs("div",{children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>C(l),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:l})}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:v.map(n=>e.jsx(U,{imgSrc:n.screenshotPath?`/api/editor-scenario-image/${n.id}.png`:null,name:n.name,isActive:n.id===j,onSelect:()=>p(n)},n.id))})]},l)),b.map(l=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 py-1",children:[e.jsx("button",{onClick:()=>C(l.name),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:l.name}),l.isAnalyzing&&l.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..."]})]}),(l.scenarios.length>0||l.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[l.scenarios.map(v=>e.jsx(U,{imgSrc:v.screenshotPath?`/api/screenshot/${v.screenshotPath}`:null,name:v.name,isActive:!1,onSelect:()=>N({analysisId:l.analysisId,scenarioId:v.id,scenarioName:v.name,entitySha:l.sha,entityName:l.name})},v.id)),l.pendingScenarios.map(v=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:v,children:v},v))]})]},l.sha)),x.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"})}),x.map(l=>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:l.name}),l.testFile&&e.jsx("span",{className:"text-[9px] text-green-400 bg-green-400/10 px-1.5 py-0.5 rounded",children:"tested"})]}),l.description&&e.jsx("p",{className:"text-[10px] text-gray-500 mt-0 mb-0 leading-relaxed",children:l.description}),e.jsx(Be,{filePath:l.filePath,projectRoot:u})]},l.name))]})]})})}function Lt({items:a,onNavigate:t}){return a.length===0?null:e.jsx("nav",{className:"flex items-center gap-1 text-xs",children:a.map((s,x)=>{const u=x===a.length-1;return e.jsxs("span",{className:"flex items-center gap-1",children:[x>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:s.name}):e.jsx("button",{onClick:()=>t(s.componentName),className:"text-gray-400 hover:text-white transition-colors cursor-pointer",children:s.name})]},s.componentName||"app")})})}const De={new:0,edited:1,impacted:2};function Ae({status:a,onClick:t}){const s={new:{label:"New",bg:"bg-green-100",text:"text-green-700",border:"border-green-200"},edited:{label:"Edited",bg:"bg-blue-100",text:"text-blue-700",border:"border-blue-200"},impacted:{label:"Impacted",bg:"bg-amber-100",text:"text-amber-700",border:"border-amber-200"}}[a.status],x=t&&(a.status==="edited"||a.status==="impacted");return e.jsx("button",{onClick:x?t:void 0,className:`${s.bg} ${s.text} ${s.border} border text-[9px] font-bold px-1.5 py-0.5 rounded-full uppercase tracking-wider shrink-0 ${x?"cursor-pointer hover:opacity-80 transition-opacity":"cursor-default"}`,children:s.label})}function ze({filePath:a}){const[t,s]=r.useState(null),[x,u]=r.useState(!0),[j,p]=r.useState(null);return r.useEffect(()=>{wt(()=>import("./index-yHOVb4rc.js"),__vite__mapDeps([0,1])).then(N=>{p(()=>N.default)})},[]),r.useEffect(()=>{u(!0),fetch(`/api/editor-file-diff?path=${encodeURIComponent(a)}`).then(N=>N.json()).then(N=>{s({oldContent:N.oldContent,newContent:N.newContent})}).catch(()=>{s(null)}).finally(()=>u(!1))},[a]),x?e.jsx("div",{className:"p-2 text-[10px] text-gray-400",children:"Loading diff..."}):!t||!j?e.jsx("div",{className:"p-2 text-[10px] text-gray-400",children:"Could not load diff"}):e.jsx("div",{className:"mt-2 border border-gray-200 rounded-lg overflow-hidden max-h-[300px] overflow-auto text-xs",children:e.jsx(j,{oldValue:t.oldContent,newValue:t.newContent,splitView:!1,useDarkTheme:!1,showDiffOnly:!0,styles:{contentText:{fontSize:"11px",lineHeight:"1.4"},line:{padding:"1px 8px",fontSize:"11px"}}})})}function Oe({impactedBy:a,changedEntities:t}){return e.jsx("div",{className:"mt-2 bg-amber-50 border border-amber-200 rounded-lg p-2.5",children:a&&a.length>0?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[10px] font-semibold text-amber-700 uppercase tracking-wider",children:"Re-captured because these dependencies changed"}),e.jsx("ul",{className:"mt-1.5 space-y-1",children:a.map(s=>e.jsxs("li",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`text-[9px] font-bold px-1 py-0 rounded-full uppercase tracking-wider border ${s.changeType==="new"?"bg-green-100 text-green-700 border-green-200":"bg-blue-100 text-blue-700 border-blue-200"}`,children:s.changeType==="new"?"New":"Edited"}),e.jsx("span",{className:"text-[11px] font-medium text-amber-800",children:s.name}),e.jsx("span",{className:"text-[9px] text-amber-500 truncate",children:s.filePath})]},s.filePath))})]}):t&&t.length>0?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[10px] font-semibold text-amber-700 uppercase tracking-wider",children:"Unchanged — these entities were modified in this session"}),e.jsx("ul",{className:"mt-1.5 space-y-1",children:t.map(s=>e.jsxs("li",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`text-[9px] font-bold px-1 py-0 rounded-full uppercase tracking-wider border ${s.status==="new"?"bg-green-100 text-green-700 border-green-200":"bg-blue-100 text-blue-700 border-blue-200"}`,children:s.status==="new"?"New":"Edited"}),e.jsx("span",{className:"text-[11px] font-medium text-amber-800",children:s.name})]},s.name))})]}):e.jsx("span",{className:"text-[10px] text-amber-600",children:"This component was re-captured because a dependency changed"})})}function Fe({scenarioId:a,name:t,isActive:s,onSelect:x}){const[u,j]=r.useState(!1);return r.useEffect(()=>{j(!1)},[a]),e.jsxs("button",{onClick:x,className:"flex flex-col items-center gap-1.5 cursor-pointer group",title:t,children:[e.jsx("div",{className:`w-32 h-32 rounded-lg overflow-hidden border-2 transition-all ${s?"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/${a}.png`,alt:t,className:"w-full h-full object-contain bg-white",loading:"lazy",onError:()=>j(!0)})}),e.jsx("span",{className:`text-[11px] leading-tight text-center truncate w-32 font-medium ${s?"text-gray-900":"text-gray-600 group-hover:text-gray-900"}`,children:t})]})}function _t({filePath:a}){return a?e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsxs("a",{href:`/api/editor-file?path=${encodeURIComponent(a)}`,target:"_blank",rel:"noopener noreferrer",title:"Open file",className:"flex items-center gap-1 text-gray-400 hover:text-gray-600 transition-colors min-w-0",children:[e.jsx("span",{className:"text-[9px] truncate",children:a}),e.jsx("svg",{className:"shrink-0",width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M4.5 1.5H2.5C1.95 1.5 1.5 1.95 1.5 2.5V9.5C1.5 10.05 1.95 10.5 2.5 10.5H9.5C10.05 10.5 10.5 10.05 10.5 9.5V7.5M7.5 1.5H10.5M10.5 1.5V4.5M10.5 1.5L5 7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e.jsx(ge,{content:a,icon:!0,iconSize:10,className:"shrink-0 text-gray-400 hover:text-gray-600 transition-colors"})]}):null}function Bt({testFile:a,entityName:t}){const{results:s,isRunning:x,runTests:u}=je(a);if(x&&!s)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(!s)return null;if(s.status==="error")return e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-red-500",children:s.errorMessage})});const j=t?s.testCases.filter(d=>d.fullName.startsWith(t)):s.testCases,p=j.length>0?j:s.testCases;if(p.length===0)return null;const N=t?`${t} > `:"";return e.jsxs("div",{className:"pt-1 space-y-0.5",children:[p.map(d=>{var C;const S=N&&d.fullName.startsWith(N)?d.fullName.slice(N.length):d.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[d.status==="passed"?e.jsx("span",{className:"text-green-600 text-[10px]",children:"✓"}):d.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] ${d.status==="passed"?"text-green-600":d.status==="failed"?"text-red-500":"text-gray-400"}`,children:S})]}),d.status==="failed"&&((C=d.failureMessages)==null?void 0:C.map((w,E)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-400 truncate max-w-full",title:w,children:w.split(`
5
+ `)[0]},E)))]},d.fullName)}),e.jsx("button",{onClick:u,disabled:x,className:"mt-1 text-[10px] text-[#0ea5e9] hover:text-[#38bdf8] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:x?"Running...":"Re-run"})]})}function Ue(a){const t=a.indexOf(" - ");return t!==-1?a.slice(t+3):a}function Ve(a,t){return!t||Object.keys(t).length===0?a:[...a].sort(([s],[x])=>{var N,d;const u=((N=t[s])==null?void 0:N.status)||"impacted",j=((d=t[x])==null?void 0:d.status)||"impacted",p=(De[u]??2)-(De[j]??2);return p!==0?p:s.localeCompare(x)})}function Dt({scenarios:a,glossaryFunctions:t=[],projectRoot:s,activeScenarioId:x,onScenarioSelect:u,onClose:j,entityChangeStatus:p={}}){const N=r.useMemo(()=>Object.entries(p).filter(([,b])=>b.status==="new"||b.status==="edited").map(([b,M])=>({name:b,status:M.status})),[p]),[d,S]=r.useState(null),C=r.useCallback(b=>{S(M=>M===b?null:b)},[]),{pageGroups:w,componentGroups:E}=r.useMemo(()=>{const b=new Map,M=new Map;for(const l of a)if(l.componentName){const v=M.get(l.componentName)||[];v.push(l),M.set(l.componentName,v)}else{const v=be(l.url),n=b.get(v)||[];n.push(l),b.set(v,n)}return{pageGroups:b,componentGroups:M}},[a]),P=r.useMemo(()=>Ve([...w.entries()],p),[w,p]),R=r.useMemo(()=>Ve([...E.entries()],p),[E,p]),g=r.useMemo(()=>fe(P,p),[P,p]),$=r.useMemo(()=>fe(R,p),[R,p]),T=t;return a.length===0&&t.length===0?e.jsxs("div",{className:"h-full bg-white flex items-center justify-center relative",children:[e.jsx("button",{onClick:j,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:j,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:[g.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"mb-2",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Application"})}),e.jsx("div",{className:"space-y-3 pl-1",children:g.map(([b,M])=>{var c;const l=p[b],v=d===b,n=(c=M[0])==null?void 0:c.componentPath;return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-600",children:b}),l&&e.jsx(Ae,{status:l,onClick:()=>C(b)})]}),v&&(l==null?void 0:l.status)==="edited"&&n&&e.jsx(ze,{filePath:n}),v&&(l==null?void 0:l.status)==="impacted"&&e.jsx(Oe,{impactedBy:l.impactedBy,changedEntities:N}),e.jsx("div",{className:"flex flex-wrap gap-3",children:M.map(m=>e.jsx(Fe,{scenarioId:m.id,name:Ue(m.name),isActive:m.id===x,onSelect:()=>u(m)},m.id))})]},b)})})]}),$.length>0&&e.jsxs("div",{className:g.length>0?"pt-3 border-t border-gray-200":"",children:[e.jsx("div",{className:"mb-2",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"})}),e.jsx("div",{className:"space-y-3 pl-1",children:$.map(([b,M])=>{var c;const l=p[b],v=d===b,n=(c=M[0])==null?void 0:c.componentPath;return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-600",children:b}),l&&e.jsx(Ae,{status:l,onClick:()=>C(b)})]}),v&&(l==null?void 0:l.status)==="edited"&&n&&e.jsx(ze,{filePath:n}),v&&(l==null?void 0:l.status)==="impacted"&&e.jsx(Oe,{impactedBy:l.impactedBy,changedEntities:N}),e.jsx("div",{className:"flex flex-wrap gap-3",children:M.map(m=>e.jsx(Fe,{scenarioId:m.id,name:Ue(m.name),isActive:m.id===x,onSelect:()=>u(m)},m.id))})]},b)})})]}),T.length>0&&e.jsxs("div",{className:g.length>0||$.length>0?"pt-3 border-t border-gray-200":"",children:[e.jsx("div",{className:"mb-2",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"})}),e.jsx("div",{className:"space-y-2 pl-1",children:T.map(b=>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:b.name})}),e.jsx(_t,{filePath:b.filePath,projectRoot:s}),b.testFile?e.jsx(Bt,{testFile:b.testFile,entityName:b.name}):e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-400",children:"No test file"})})]},b.name))})]})]})})]})}function q(a){return a.replace(/[^a-zA-Z0-9_]+/g,"_")}function At(a){const{activeAnalyzedScenario:t,analyzedPreviewUrl:s,activeScenarioId:x,scenarios:u,proxyUrl:j,devServerUrl:p,zoomComponent:N}=a;if(t&&s)return s;if(t&&!s)return null;if(x){const S=u.find(C=>C.id===x);if(S!=null&&S.url){const C=j||p;return C?S.url.startsWith("/")?`${C}${S.url}`:S.url:null}}const d=j||p;if(!d)return null;if(N&&x){const S=u.find(w=>w.id===x),C=S?q(S.name):"Default";return`${d}/__codeyam__/${N}/${C}`}return d}function zt(a,t){const s=t.width,x=t.height??900,u=a.width,j=a.height;return s<=u&&x<=j?1:Math.min(u/s,j/x)}const Qt=()=>[{title:"Editor - CodeYam"},{name:"description",content:"CodeYam Code + Data Editor"}],ue=[{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 Ot({analysisId:a,scenarioId:t,scenarioName:s,entityName:x,projectSlug:u,onStateChange:j}){const{interactiveServerUrl:p,isStarting:N,isLoading:d}=St({analysisId:a,scenarioId:t,scenarioName:s,entityName:x,projectSlug:u,enabled:!0});return r.useEffect(()=>{j(p,N||d)},[p,N,d,j]),null}const Xt=pt(function(){const{projectSlug:t,projectRoot:s,hasProject:x,scenarios:u,analyzedEntities:j,glossaryFunctions:p,entityImports:N,pageFilePaths:d,entityChangeStatus:S}=ht(),C=ut(),[w,E]=ft(),P=r.useRef(null),R=r.useRef(null),g=r.useRef(null),$=w.get("zoom")||void 0,T=w.get("scenario")||void 0;r.useEffect(()=>{if(!T)return;const i=u.find(k=>k.id===T);if(!i)return;const f=q(i.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:f,scenarioId:i.id,scenarioName:i.name})}).catch(()=>{})},[T,u]),r.useEffect(()=>{const i=new BroadcastChannel("codeyam-editor");return i.onmessage=f=>{var k;if(((k=f.data)==null?void 0:k.type)==="switch-scenario"&&f.data.scenarioId){const I=f.data.scenarioId,z=u.find(pe=>pe.id===I);if(!z)return;const ee=new URLSearchParams(w);ee.set("scenario",I),ee.delete("zoom"),E(ee),te(null),Q(null),W(null);const mt=q(z.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:mt,scenarioId:I})}).then(()=>{Y(pe=>pe+1),o(!1)}).catch(()=>{})}},()=>i.close()},[w,E,u]),r.useEffect(()=>{if(w.get("ref")!=="link"||!T)return;const i=new BroadcastChannel("codeyam-editor");i.postMessage({type:"switch-scenario",scenarioId:T}),i.close(),window.close()},[]);const[b,M]=r.useState(null),[l,v]=r.useState(null),[n,c]=r.useState(!1),[m,y]=r.useState(null),[L,o]=r.useState(!1),[h,D]=r.useState(!0),[B,te]=r.useState(null),[ve,Q]=r.useState(null),[se,Ne]=r.useState(!1),[O,W]=r.useState(null),[we,ye]=r.useState(!1),[Se,X]=r.useState(null),We=r.useCallback(i=>{W(i),X(null)},[]),He=r.useCallback((i,f)=>{Q(k=>(i&&i!==k&&o(!1),i)),!f&&i&&o(!0),Ne(f)},[]),Ce=r.useCallback(i=>{W(null),te(k=>(k&&k.analysisId===i.analysisId||(Q(null),Y(z=>z+1)),i)),Ne(!0),o(!1);const f=new URLSearchParams(w);f.delete("scenario"),f.delete("zoom"),E(f)},[w,E]),[Je,ke]=r.useState(1440),[_,ae]=r.useState({name:"Desktop",width:1440,height:900}),[Ge,ne]=r.useState(!1),[re,Ye]=r.useState(null),[A,H]=r.useState("app"),Ke=r.useCallback(()=>{H("build"),le(!0)},[]),[qe,le]=r.useState(!1),[Qe,Pe]=r.useState(!1),Xe=r.useCallback(i=>{Pe(i)},[]),[ie,Me]=r.useState(!1),Ze=r.useCallback(()=>{Me(!0),H("build"),le(!0)},[]),Ee=r.useCallback(()=>{Me(!1)},[]),[J,ce]=r.useState(!1),et=r.useCallback(()=>{if(J){ce(!1);return}typeof Notification<"u"&&Notification.permission==="default"?Notification.requestPermission().then(i=>{i==="granted"&&ce(!0)}):ce(!0)},[J]);r.useEffect(()=>{if(A==="build"){Pe(!1);const i=setTimeout(()=>{var f,k;(f=P.current)==null||f.scrollToBottom(),(k=P.current)==null||k.focus()},50);return()=>clearTimeout(i)}},[A]);const[oe,tt]=r.useState(null);r.useEffect(()=>{const i=g.current;if(!i)return;const f=new ResizeObserver(k=>{const I=k[0];I&&tt({width:I.contentRect.width,height:I.contentRect.height})});return f.observe(i),()=>f.disconnect()},[]);const G=r.useMemo(()=>oe?zt(oe,_):1,[oe,_]),[st,Y]=r.useState(0),[de,$e]=r.useState(null),at=r.useCallback(i=>{$e(i||null),Y(f=>f+1)},[]),{customSizes:Ie,addCustomSize:nt}=gt(t),Z=r.useMemo(()=>[...ue,...Ie],[Ie]),Te=r.useRef(!1);r.useEffect(()=>{let i=!1,f=null;const k=async()=>{try{const I=await fetch("/api/editor-dev-server");if(i)return;const z=await I.json();if(z.status==="error")M(null),v(null),c(!1),y(z.errorMessage||"Dev server crashed");else if(z.url)M(z.url),v(z.proxyUrl||null),c(!1),y(null),D(!0);else if(z.status==="starting")c(!0),y(null),D(!0);else if(z.status==="stopped")if(b)M(null),c(!1);else if(Te.current)c(!1);else{Te.current=!0;try{(await fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"start"})})).ok?c(!0):D(!1)}catch{}}}catch{}};return k(),f=setInterval(()=>void k(),2e3),()=>{i=!0,f&&clearInterval(f)}},[b]),r.useEffect(()=>{const i=new EventSource("/api/events");let f=null;return i.addEventListener("message",k=>{try{const I=JSON.parse(k.data);(I.type==="db-change"||I.type==="unknown")&&(f&&clearTimeout(f),f=setTimeout(()=>{C.revalidate()},2e3))}catch{}}),()=>{f&&clearTimeout(f),i.close()}},[C]);const rt=r.useMemo(()=>{const i=[{name:"App"}];return $&&i.push({name:$,componentName:$}),i},[$]),xe=r.useCallback(i=>{const f=new URLSearchParams(w);if(i){f.set("zoom",i);const k=u.find(I=>I.componentName===i||I.componentName===null&&i==="Home");if(k){f.set("scenario",k.id);const I=q(k.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:I,scenarioId:k.id})}).catch(()=>{}),Y(z=>z+1),o(!1)}else f.delete("scenario")}else f.delete("zoom"),f.delete("scenario");E(f)},[w,E,u]),me=r.useCallback(i=>{te(null),Q(null),W(null);const f=new URLSearchParams(w);f.set("scenario",i.id),E(f);const k=q(i.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:k,scenarioId:i.id})}).catch(()=>{}),Y(I=>I+1),o(!1)},[w,E]),lt=(i,f)=>{ke(i);const k=Z.find(I=>I.width===i&&I.height===f);ae({name:(k==null?void 0:k.name)||"Custom",width:i,height:f})},Re=i=>{ke(i.width),ae({name:i.name,width:i.width,height:i.height})},it=i=>{nt(i,_.width,_.height??900),ne(!1),ae(f=>({...f,name:i}))},ct=()=>{B||o(!0)},ot=r.useCallback(()=>{y(null),c(!0),fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"restart"})}).catch(()=>{})},[]),dt=r.useCallback(()=>{y(null),c(!0),fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"start"})}).catch(()=>{})},[]),F=r.useMemo(()=>At({activeAnalyzedScenario:!!B,analyzedPreviewUrl:ve,activeScenarioId:T||null,scenarios:u,proxyUrl:l,devServerUrl:b,zoomComponent:$||null}),[l,b,$,T,u,B,ve]),xt=r.useMemo(()=>{if(!F||!de)return F;try{const i=new URL(F);return i.pathname=de,i.href}catch{return F}},[F,de]);return e.jsxs("div",{className:"fixed inset-0 bg-[#2d2d2d] flex flex-col",children:[B&&e.jsx(Ot,{analysisId:B.analysisId,scenarioId:B.scenarioId,scenarioName:B.scenarioName,entityName:B.entityName,projectSlug:t,onStateChange:He},B.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:yt,alt:"CodeYam",className:"h-6 brightness-0 invert"}),e.jsx("span",{className:"text-white font-medium text-sm whitespace-nowrap",children:"Editor"}),$&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-4 bg-gray-600"}),e.jsx(Lt,{items:rt,onNavigate:xe})]}),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:`${ue[ue.length-1].width}px`,width:"100%"},children:e.jsx(jt,{currentViewportWidth:Je,currentPresetName:_.name,onDevicePresetClick:Re,devicePresets:Z,hideLabel:!0,onHoverChange:Ye,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:(re==null?void 0:re.name)||_.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:_.name,onChange:i=>{const f=Z.find(k=>k.name===i.target.value);f&&Re(f)},className:"relative w-full h-full opacity-0 cursor-pointer",children:[Z.map(i=>e.jsx("option",{value:i.name,children:i.name},i.name)),_.name==="Custom"&&e.jsx("option",{value:"Custom",children:"Custom"})]})]}),e.jsx("input",{type:"number",value:_.width,onChange:i=>{const f=parseInt(i.target.value,10);!isNaN(f)&&f>0&&lt(f,_.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:_.height??900}),_.name==="Custom"&&e.jsx("button",{onClick:()=>ne(!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:`
6
+ linear-gradient(45deg, #ebebeb 25%, transparent 25%),
7
+ linear-gradient(-45deg, #ebebeb 25%, transparent 25%),
8
+ linear-gradient(45deg, transparent 75%, #ebebeb 75%),
9
+ linear-gradient(-45deg, transparent 75%, #ebebeb 75%)
10
+ `,backgroundSize:"16px 16px",backgroundPosition:"0 0, 0 8px, 8px -8px, -8px 0px",backgroundColor:"#fafafa"},children:O?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:O.screenshotUrl,alt:O.scenarioName,className:"max-w-full h-auto block"})}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-[#666]",children:[O.commitSha&&e.jsx("span",{className:"font-mono text-xs text-[#00a0c4] bg-[#00a0c4]/15 px-2 py-0.5 rounded",children:O.commitSha.slice(0,7)}),e.jsxs("span",{className:"truncate",children:[O.scenarioName,O.commitMessage&&` — ${O.commitMessage}`]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:()=>W(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"}),O.commitSha&&e.jsx("button",{onClick:()=>{ye(!0),X(null),fetch("/api/editor-load-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commitSha:O.commitSha})}).then(i=>i.json()).then(i=>{i.success?(W(null),c(!0),o(!1)):X(i.error||"Failed to load commit")}).catch(i=>{X(i instanceof Error?i.message:"Network error")}).finally(()=>{ye(!1)})},disabled:we,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:we?"Loading...":"Load this version"})]}),Se&&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:Se})]}):F?e.jsx("div",{style:{width:`${_.width*G}px`,height:`${(_.height??900)*G}px`},children:e.jsxs("div",{className:"relative bg-white origin-top-left",style:{width:`${_.width}px`,height:`${_.height??900}px`,transform:G<1?`scale(${G})`:void 0},children:[!L&&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(Le,{})}),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:R,src:xt||F,className:"w-full h-full border-none",title:"Editor preview",onLoad:ct,style:{opacity:L?1:0}},st)]})}):e.jsx("div",{className:"bg-white rounded-lg shadow-sm flex flex-col items-center justify-center",style:{width:`${_.width*G}px`,height:`${(_.height??900)*G}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:ot,className:"mx-auto px-4 py-2 bg-[#005c75] text-white text-sm font-medium rounded hover:bg-[#004d63] transition-colors cursor-pointer",children:"Retry"})]}):n||se?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-4",children:e.jsx(Le,{})}),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:se?"Starting Interactive Mode":"Starting Dev Server"}),e.jsx("p",{className:"text-sm text-[#666] leading-5 m-0 font-['IBM_Plex_Sans']",children:se?"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:()=>H("app"),className:`px-3 py-2 text-xs font-medium transition-colors relative cursor-pointer ${A==="app"?"text-white":"text-gray-500 hover:text-gray-300"}`,children:["App",A==="app"&&e.jsx("span",{className:"absolute bottom-0 left-3 right-3 h-0.5 bg-[#005c75]"})]}),e.jsxs("button",{onClick:()=>{H("build"),le(!0)},className:`px-3 py-2 text-xs font-medium transition-colors relative cursor-pointer ${A==="build"?"text-white":"text-gray-500 hover:text-gray-300"}`,children:["Build",Qe&&A!=="build"&&e.jsx("span",{className:"ml-1.5 inline-block w-2 h-2 rounded-full bg-amber-400 animate-pulse"}),A==="build"&&e.jsx("span",{className:"absolute bottom-0 left-3 right-3 h-0.5 bg-[#005c75]"})]}),e.jsxs("button",{onClick:()=>H("data"),className:`px-3 py-2 text-xs font-medium transition-colors relative cursor-pointer ${A==="data"?"text-white":"text-gray-500 hover:text-gray-300"}`,children:["Data",A==="data"&&e.jsx("span",{className:"absolute bottom-0 left-3 right-3 h-0.5 bg-[#005c75]"})]}),e.jsxs("button",{onClick:()=>H("journal"),className:`px-3 py-2 text-xs font-medium transition-colors relative cursor-pointer ${A==="journal"?"text-white":"text-gray-500 hover:text-gray-300"}`,children:["Journal",A==="journal"&&e.jsx("span",{className:"absolute bottom-0 left-3 right-3 h-0.5 bg-[#005c75]"})]})]}),typeof Notification<"u"&&e.jsx("button",{onClick:et,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:[qe&&e.jsxs("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:A==="build"?"visible":"hidden"},children:[e.jsx("div",{className:ie?"flex-1 min-h-0":"flex-1",style:ie?{flex:"1 1 50%"}:void 0,children:e.jsx(vt,{ref:P,entityName:"Editor",projectSlug:t,entityFilePath:null,scenarioName:null,onRefreshPreview:at,onShowResults:Ze,onHideResults:Ee,editorMode:!0,onIdleChange:Xe,notificationsEnabled:J})}),ie&&e.jsx("div",{style:{flex:"1 1 50%"},className:"min-h-0 border-t-2 border-gray-300",children:e.jsx(Dt,{scenarios:u,glossaryFunctions:p,projectRoot:s,activeScenarioId:T,onScenarioSelect:me,onClose:Ee,entityChangeStatus:S})})]}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:A==="app"?"visible":"hidden"},children:e.jsx(Rt,{hasProject:x,scenarios:u,analyzedEntities:[],glossaryFunctions:p,projectRoot:s,activeScenarioId:T,onScenarioSelect:me,onAnalyzedScenarioSelect:Ce,onSwitchToBuild:Ke,zoomComponent:$,onZoomChange:xe,entityImports:N,pageFilePaths:d})}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:A==="data"?"visible":"hidden"},children:e.jsx(Ct,{scenarios:u,projectRoot:s,activeScenarioId:T,onScenarioSelect:me,zoomComponent:$,onZoomChange:xe,analyzedEntities:[],glossaryFunctions:p,activeAnalyzedScenarioId:B==null?void 0:B.scenarioId,onAnalyzedScenarioSelect:Ce,entityImports:N,pageFilePaths:d})}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:A==="journal"?"visible":"hidden"},children:e.jsx(Tt,{isActive:A==="journal",onScreenshotClick:We,glossaryFunctions:p,pageNames:Object.keys(d)})})]})]})]}),e.jsx(Nt,{serverUrl:b,isStarting:n,projectSlug:t,devServerError:m,onStartServer:h?dt:void 0}),Ge&&e.jsx(bt,{width:_.width,height:_.height??900,onSave:it,onCancel:()=>ne(!1)})]})});export{Xt as default,Qt as meta};
@@ -1,4 +1,4 @@
1
- import{a as V,j as e,w as re,u as oe,r as i}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{u as le,S as W}from"./Spinner-Bb5uFQ5V.js";import{u as ce}from"./useLastLogLine-C14nCb1q.js";import{u as de,V as he,S as xe}from"./useCustomSizes-ByhSyh0W.js";import{c as me}from"./cy-logo-cli-DcX-ZS3p.js";import{I as E}from"./InlineSpinner-Bu6c6aDe.js";import{T as ue,D as pe}from"./Terminal-wkqC0AQk.js";import{S as fe}from"./SafeScreenshot-BED4B6sP.js";import"./preload-helper-ckwbz45p.js";function ge({scenarios:w,currentScenarioId:r,entitySha:s,cacheBuster:l}){const d=V();return w.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center p-8",children:e.jsx("p",{className:"text-gray-500 text-sm",children:"No scenarios found"})}):e.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-3",children:w.map(o=>{var j,u;const f=o.id===r,g=(u=(j=o.metadata)==null?void 0:j.screenshotPaths)==null?void 0:u[0];return e.jsxs("button",{onClick:()=>{d(`/entity/${s}/scenarios/${o.id}/dev`)},className:`w-full text-left rounded-lg overflow-hidden border transition-colors cursor-pointer flex ${f?"border-[#005c75] bg-[#1a3a44]":"border-[#3d3d3d] bg-[#252525] hover:border-[#555]"}`,children:[e.jsx("div",{className:"w-24 h-20 shrink-0 bg-[#1a1a1a]",children:e.jsx(fe,{screenshotPath:g,cacheBuster:l,alt:o.name,className:"w-full h-full object-cover object-top"})}),e.jsxs("div",{className:"p-2.5 min-w-0 flex-1",children:[e.jsxs("div",{className:"text-white text-sm font-medium truncate",children:[f&&e.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-[#005c75] mr-1.5 relative top-[-1px]"}),o.name]}),o.description&&e.jsx("div",{className:"text-gray-400 text-xs mt-1 line-clamp-2",children:o.description})]})]},o.id)})})}const M=[{name:"Mobile",width:375,height:667},{name:"Tablet",width:768,height:1024},{name:"Laptop",width:1024,height:768},{name:"Desktop",width:1440,height:900}],Pe=re(function(){const{entity:r,scenario:s,analysis:l,projectSlug:d}=oe(),o=V(),f=i.useRef(null),g=i.useRef(null),[j,u]=i.useState(null),[U,D]=i.useState(1440),[n,N]=i.useState({name:"Desktop",width:1440,height:900}),[A,y]=i.useState(!1),[S,H]=i.useState(null),[h,k]=i.useState("chat"),[F,q]=i.useState(0),[C,$]=i.useState(null),K=i.useCallback(t=>{$(t||null),q(a=>a+1)},[]),{customSizes:_,addCustomSize:Y}=de(d),v=i.useMemo(()=>[...M,..._],[_]),{interactiveServerUrl:c,isStarting:L,isLoading:z,showIframe:B,iframeKey:G,onIframeLoad:J}=le({analysisId:l==null?void 0:l.id,scenarioId:s==null?void 0:s.id,scenarioName:s==null?void 0:s.name,projectSlug:d,enabled:!0,refreshTrigger:F}),O=i.useMemo(()=>{if(!c)return null;if(!C)return c;try{const t=new URL(c);return t.pathname=C,t.href}catch{return c}},[c,C]),{lastLine:b}=ce(d,L||z),Q=()=>{o(`/entity/${r.sha}`)},X=(t,a)=>{D(t);const m=v.find(T=>T.width===t&&T.height===a);u(m||null),N({name:(m==null?void 0:m.name)||"Custom",width:t,height:a})},R=t=>{u(t),D(t.width),N({name:t.name,width:t.width,height:t.height})},Z=t=>{Y(t,n.width,n.height??900),y(!1),N(a=>({...a,name:t}))},ee=()=>{var a;k("chat"),(a=g.current)==null||a.sendInput("Create a new scenario for this entity based on the work we've just done. Create a name and description that reflects what the live preview is showing. Use the scenario data you've changed to create a new scenario in the database. If the data structure was fixed in any way you need to update that in the database as well and backfill all existing scenarios, then save to the database and capture a screenshot. Remember the database is at `.codeyam/db.sqlite3`, the scenarios table has all scenarios and the analyses table contains the scenariosDataStructure is its metadata.")},x=((l==null?void 0:l.scenarios)||[]).filter(t=>{var a;return!((a=t.metadata)!=null&&a.sameAsDefault)}),p=x.findIndex(t=>t.id===(s==null?void 0:s.id)),te=p+1,se=x.length,P=p>0,I=p<x.length-1,ae=()=>{if(P){const t=x[p-1];o(`/entity/${r.sha}/scenarios/${t.id}/dev`)}},ne=()=>{if(I){const t=x[p+1];o(`/entity/${r.sha}/scenarios/${t.id}/dev`)}},ie=L||z||!B;return e.jsxs("div",{className:"fixed inset-0 bg-[#2d2d2d] flex flex-col",children:[e.jsxs("div",{className:"bg-[#3d3d3d] h-12 flex items-center px-4 gap-4 shrink-0 z-20",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("img",{src:me,alt:"CodeYam",className:"h-6 brightness-0 invert"}),e.jsx("span",{className:"text-white font-medium text-sm whitespace-nowrap",children:r.name}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("button",{onClick:ae,disabled:!P,className:`${P?"text-white hover:text-gray-300":"text-gray-600 cursor-not-allowed"} transition-colors`,"aria-label":"Previous scenario",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e.jsx("path",{d:"M12.5 15L7.5 10L12.5 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),e.jsxs("span",{className:"text-gray-400 text-sm",children:[te,"/",se]}),e.jsx("button",{onClick:ne,disabled:!I,className:`${I?"text-white hover:text-gray-300":"text-gray-600 cursor-not-allowed"} transition-colors`,"aria-label":"Next scenario",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e.jsx("path",{d:"M7.5 15L12.5 10L7.5 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-2 min-w-0",children:[e.jsx("span",{className:"text-white font-semibold text-xs whitespace-nowrap shrink-0",children:s==null?void 0:s.name}),(s==null?void 0:s.description)&&e.jsxs("div",{className:"relative group min-w-0",children:[e.jsx("span",{className:"text-gray-400 text-xs truncate block",children:s.description}),e.jsx("div",{className:"absolute left-0 top-full mt-1 hidden group-hover:block z-50 bg-black text-white text-xs px-3 py-2 rounded shadow-lg max-w-md",children:s.description})]})]}),e.jsx("span",{className:"bg-[#005c75] text-white text-[10px] font-bold px-2 py-0.5 rounded uppercase tracking-wider ml-2",children:"Dev Mode"})]}),e.jsx("button",{onClick:Q,className:"text-white hover:text-gray-300 transition-colors ml-4","aria-label":"Close dev mode",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e.jsx("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"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:`${M[M.length-1].width}px`,width:"100%"},children:e.jsx(he,{currentViewportWidth:U,currentPresetName:n.name,onDevicePresetClick:R,devicePresets:v,hideLabel:!0,onHoverChange:H,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:(S==null?void 0:S.name)||n.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:n.name,onChange:t=>{const a=v.find(m=>m.name===t.target.value);a&&R(a)},className:"relative w-full h-full opacity-0 cursor-pointer",children:[v.map(t=>e.jsx("option",{value:t.name,children:t.name},t.name)),n.name==="Custom"&&e.jsx("option",{value:"Custom",children:"Custom"})]})]}),e.jsx("input",{type:"number",value:n.width,onChange:t=>{const a=parseInt(t.target.value,10);!isNaN(a)&&a>0&&X(a,n.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:n.height??900}),n.name==="Custom"&&e.jsx("button",{onClick:()=>y(!0),className:"bg-white text-gray-900 text-xs px-2 rounded h-5 flex items-center leading-none border border-gray-300 hover:bg-gray-50 transition-colors",children:"Save"})]})]}),e.jsx("div",{className:"flex-1 flex items-center justify-center overflow-auto p-8",style:{backgroundImage:`
1
+ import{a as V,j as e,w as re,u as oe,r as i}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{u as le,S as W}from"./Spinner-Bb5uFQ5V.js";import{u as ce}from"./useLastLogLine-C14nCb1q.js";import{u as de,V as he,S as xe}from"./useCustomSizes-ByhSyh0W.js";import{c as me}from"./cy-logo-cli-DcX-ZS3p.js";import{I as E}from"./InlineSpinner-Bu6c6aDe.js";import{T as ue,D as pe}from"./Terminal-nZNBALox.js";import{S as fe}from"./SafeScreenshot-BED4B6sP.js";import"./preload-helper-ckwbz45p.js";function ge({scenarios:w,currentScenarioId:r,entitySha:s,cacheBuster:l}){const d=V();return w.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center p-8",children:e.jsx("p",{className:"text-gray-500 text-sm",children:"No scenarios found"})}):e.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-3",children:w.map(o=>{var j,u;const f=o.id===r,g=(u=(j=o.metadata)==null?void 0:j.screenshotPaths)==null?void 0:u[0];return e.jsxs("button",{onClick:()=>{d(`/entity/${s}/scenarios/${o.id}/dev`)},className:`w-full text-left rounded-lg overflow-hidden border transition-colors cursor-pointer flex ${f?"border-[#005c75] bg-[#1a3a44]":"border-[#3d3d3d] bg-[#252525] hover:border-[#555]"}`,children:[e.jsx("div",{className:"w-24 h-20 shrink-0 bg-[#1a1a1a]",children:e.jsx(fe,{screenshotPath:g,cacheBuster:l,alt:o.name,className:"w-full h-full object-cover object-top"})}),e.jsxs("div",{className:"p-2.5 min-w-0 flex-1",children:[e.jsxs("div",{className:"text-white text-sm font-medium truncate",children:[f&&e.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-[#005c75] mr-1.5 relative top-[-1px]"}),o.name]}),o.description&&e.jsx("div",{className:"text-gray-400 text-xs mt-1 line-clamp-2",children:o.description})]})]},o.id)})})}const M=[{name:"Mobile",width:375,height:667},{name:"Tablet",width:768,height:1024},{name:"Laptop",width:1024,height:768},{name:"Desktop",width:1440,height:900}],Pe=re(function(){const{entity:r,scenario:s,analysis:l,projectSlug:d}=oe(),o=V(),f=i.useRef(null),g=i.useRef(null),[j,u]=i.useState(null),[U,D]=i.useState(1440),[n,N]=i.useState({name:"Desktop",width:1440,height:900}),[A,y]=i.useState(!1),[S,H]=i.useState(null),[h,k]=i.useState("chat"),[F,q]=i.useState(0),[C,$]=i.useState(null),K=i.useCallback(t=>{$(t||null),q(a=>a+1)},[]),{customSizes:_,addCustomSize:Y}=de(d),v=i.useMemo(()=>[...M,..._],[_]),{interactiveServerUrl:c,isStarting:L,isLoading:z,showIframe:B,iframeKey:G,onIframeLoad:J}=le({analysisId:l==null?void 0:l.id,scenarioId:s==null?void 0:s.id,scenarioName:s==null?void 0:s.name,projectSlug:d,enabled:!0,refreshTrigger:F}),O=i.useMemo(()=>{if(!c)return null;if(!C)return c;try{const t=new URL(c);return t.pathname=C,t.href}catch{return c}},[c,C]),{lastLine:b}=ce(d,L||z),Q=()=>{o(`/entity/${r.sha}`)},X=(t,a)=>{D(t);const m=v.find(T=>T.width===t&&T.height===a);u(m||null),N({name:(m==null?void 0:m.name)||"Custom",width:t,height:a})},R=t=>{u(t),D(t.width),N({name:t.name,width:t.width,height:t.height})},Z=t=>{Y(t,n.width,n.height??900),y(!1),N(a=>({...a,name:t}))},ee=()=>{var a;k("chat"),(a=g.current)==null||a.sendInput("Create a new scenario for this entity based on the work we've just done. Create a name and description that reflects what the live preview is showing. Use the scenario data you've changed to create a new scenario in the database. If the data structure was fixed in any way you need to update that in the database as well and backfill all existing scenarios, then save to the database and capture a screenshot. Remember the database is at `.codeyam/db.sqlite3`, the scenarios table has all scenarios and the analyses table contains the scenariosDataStructure is its metadata.")},x=((l==null?void 0:l.scenarios)||[]).filter(t=>{var a;return!((a=t.metadata)!=null&&a.sameAsDefault)}),p=x.findIndex(t=>t.id===(s==null?void 0:s.id)),te=p+1,se=x.length,P=p>0,I=p<x.length-1,ae=()=>{if(P){const t=x[p-1];o(`/entity/${r.sha}/scenarios/${t.id}/dev`)}},ne=()=>{if(I){const t=x[p+1];o(`/entity/${r.sha}/scenarios/${t.id}/dev`)}},ie=L||z||!B;return e.jsxs("div",{className:"fixed inset-0 bg-[#2d2d2d] flex flex-col",children:[e.jsxs("div",{className:"bg-[#3d3d3d] h-12 flex items-center px-4 gap-4 shrink-0 z-20",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("img",{src:me,alt:"CodeYam",className:"h-6 brightness-0 invert"}),e.jsx("span",{className:"text-white font-medium text-sm whitespace-nowrap",children:r.name}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("button",{onClick:ae,disabled:!P,className:`${P?"text-white hover:text-gray-300":"text-gray-600 cursor-not-allowed"} transition-colors`,"aria-label":"Previous scenario",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e.jsx("path",{d:"M12.5 15L7.5 10L12.5 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),e.jsxs("span",{className:"text-gray-400 text-sm",children:[te,"/",se]}),e.jsx("button",{onClick:ne,disabled:!I,className:`${I?"text-white hover:text-gray-300":"text-gray-600 cursor-not-allowed"} transition-colors`,"aria-label":"Next scenario",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e.jsx("path",{d:"M7.5 15L12.5 10L7.5 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-2 min-w-0",children:[e.jsx("span",{className:"text-white font-semibold text-xs whitespace-nowrap shrink-0",children:s==null?void 0:s.name}),(s==null?void 0:s.description)&&e.jsxs("div",{className:"relative group min-w-0",children:[e.jsx("span",{className:"text-gray-400 text-xs truncate block",children:s.description}),e.jsx("div",{className:"absolute left-0 top-full mt-1 hidden group-hover:block z-50 bg-black text-white text-xs px-3 py-2 rounded shadow-lg max-w-md",children:s.description})]})]}),e.jsx("span",{className:"bg-[#005c75] text-white text-[10px] font-bold px-2 py-0.5 rounded uppercase tracking-wider ml-2",children:"Dev Mode"})]}),e.jsx("button",{onClick:Q,className:"text-white hover:text-gray-300 transition-colors ml-4","aria-label":"Close dev mode",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e.jsx("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"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:`${M[M.length-1].width}px`,width:"100%"},children:e.jsx(he,{currentViewportWidth:U,currentPresetName:n.name,onDevicePresetClick:R,devicePresets:v,hideLabel:!0,onHoverChange:H,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:(S==null?void 0:S.name)||n.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:n.name,onChange:t=>{const a=v.find(m=>m.name===t.target.value);a&&R(a)},className:"relative w-full h-full opacity-0 cursor-pointer",children:[v.map(t=>e.jsx("option",{value:t.name,children:t.name},t.name)),n.name==="Custom"&&e.jsx("option",{value:"Custom",children:"Custom"})]})]}),e.jsx("input",{type:"number",value:n.width,onChange:t=>{const a=parseInt(t.target.value,10);!isNaN(a)&&a>0&&X(a,n.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:n.height??900}),n.name==="Custom"&&e.jsx("button",{onClick:()=>y(!0),className:"bg-white text-gray-900 text-xs px-2 rounded h-5 flex items-center leading-none border border-gray-300 hover:bg-gray-50 transition-colors",children:"Save"})]})]}),e.jsx("div",{className:"flex-1 flex items-center justify-center overflow-auto p-8",style:{backgroundImage:`
2
2
  linear-gradient(45deg, #ebebeb 25%, transparent 25%),
3
3
  linear-gradient(-45deg, #ebebeb 25%, transparent 25%),
4
4
  linear-gradient(45deg, transparent 75%, #ebebeb 75%),
@@ -0,0 +1 @@
1
+ import{r as S,d as ie,j as e,w as ve,u as we,b as Ne}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{u as Se}from"./useReportContext-O-jkvSPx.js";import{F as re,b as le,E as ce,S as de,u as Ce,C as ke,a as Be}from"./EntityItem-C76mRRiF.js";import{L as Ae}from"./LogViewer-ceAyBX-H.js";import Me from"./index-yHOVb4rc.js";import{g as pe}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 Te(o,l,h=10){var u;const t=new Map,s=c=>c.entityType==="visual"||c.entityType==="library";for(const c of o)s(c)&&t.set(c.sha,{entity:c,depth:0});const n=new Map;for(const c of l){const x=(u=c.metadata)==null?void 0:u.importedBy;if(x)for(const y of Object.keys(x))for(const m of Object.keys(x[y])){const{shas:B}=x[y][m];for(const T of B)n.has(c.sha)||n.set(c.sha,new Set),n.get(c.sha).add(T)}}const i=[],a=new Set;for(const c of o)i.push({sha:c.sha,depth:0}),a.add(c.sha);for(;i.length>0;){const{sha:c,depth:x}=i.shift();if(x>=h)continue;const y=n.get(c);if(y)for(const m of y){if(a.has(m))continue;a.add(m);const B=l.find(T=>T.sha===m);if(B){if(s(B)){const T=x+1,F=t.get(m);(!F||T<F.depth)&&t.set(m,{entity:B,depth:T})}i.push({sha:m,depth:x+1})}}}return Array.from(t.values()).sort((c,x)=>c.depth!==x.depth?c.depth-x.depth:c.entity.name.localeCompare(x.entity.name))}function W(o){const l=new Map;for(const t of o)l.has(t.name)||l.set(t.name,[]),l.get(t.name).push(t);const h=[];for(const t of l.values())if(t.length===1)h.push(t[0]);else{const s=t.sort((n,i)=>{var c,x;const a=((c=n.metadata)==null?void 0:c.editedAt)||n.createdAt||"";return(((x=i.metadata)==null?void 0:x.editedAt)||i.createdAt||"").localeCompare(a)});h.push(s[0])}return h}function Fe(o,l){const h=new Map,t=new Set(o.map(s=>s.path));for(const s of o)s.status==="renamed"&&s.oldPath&&t.add(s.oldPath);for(const s of o){const n=l.filter(u=>u.filePath===s.path||s.status==="renamed"&&s.oldPath&&u.filePath===s.oldPath),i=n.filter(u=>{var c,x;return t.has(u.filePath)&&((c=u.metadata)==null?void 0:c.isUncommitted)&&!((x=u.metadata)!=null&&x.isSuperseded)}),a=W(i);h.set(s.path,{status:s,entities:n,editedEntities:a})}return h}function ze(o,l,h){const t=new Map;if(!h){for(const n of o)if(n.status==="deleted")t.set(n.path,{status:n,entities:[]});else{const i=l.filter(u=>u.filePath===n.path||n.status==="renamed"&&n.oldPath&&u.filePath===n.oldPath),a=W(i);t.set(n.path,{status:n,entities:a})}return t}const s=new Map;for(const n of h.fileComparisons){const i=new Set;for(const a of n.newEntities)i.add(a.name);for(const a of n.modifiedEntities)i.add(a.name);for(const a of n.deletedEntities)i.add(a.name);i.size>0&&s.set(n.filePath,i)}for(const n of o){const i=s.get(n.path);if(n.status==="deleted")t.set(n.path,{status:n,entities:[]});else{const a=i?l.filter(c=>(c.filePath===n.path||n.status==="renamed"&&n.oldPath&&c.filePath===n.oldPath)&&i.has(c.name)):[],u=W(a);t.set(n.path,{status:n,entities:u})}}return t}function De(o,l){const h=new Map,t=Ee(o,l);for(const s of t){const i=Te([s],l).filter(({depth:a})=>a>0);h.set(s.sha,i)}return h}function Ee(o,l){const h=new Set(o.map(s=>s.path));for(const s of o)s.status==="renamed"&&s.oldPath&&h.add(s.oldPath);const t=l.filter(s=>{var n,i;return h.has(s.filePath)&&((n=s.metadata)==null?void 0:n.isUncommitted)&&!((i=s.metadata)!=null&&i.isSuperseded)});return W(t)}function Pe(o,l,h){const[t,s]=S.useState(()=>new Set),[n,i]=S.useState(()=>new Set),a=S.useRef([]),u=S.useRef([]);return S.useEffect(()=>{(l.length!==a.current.length||l.some((F,A)=>F!==a.current[A]))&&(a.current=l,s(F=>{const A=new Set;return l.forEach(z=>{F.has(z)&&A.add(z)}),A}))},[l]),S.useEffect(()=>{(h.length!==u.current.length||h.some((F,A)=>F!==u.current[A]))&&(u.current=h,i(F=>{const A=new Set;return h.forEach(z=>{F.has(z)&&A.add(z)}),A}))},[h]),{expandedUncommitted:t,expandedBranch:n,setExpandedUncommitted:s,setExpandedBranch:i,toggleFile:(T,F,A)=>{A(z=>{const D=new Set(z);return D.has(T)?D.delete(T):D.add(T),D})},expandAllUncommitted:()=>{s(new Set(l))},collapseAllUncommitted:()=>{s(new Set)},expandAllBranch:()=>{i(new Set(h))},collapseAllBranch:()=>{i(new Set)}}}function Ie(o,l,h){const[t,s]=S.useState(null),[n,i]=S.useState(null),a=ie();S.useEffect(()=>{var y,m;((y=a.data)==null?void 0:y.oldContent)!==void 0&&((m=a.data)==null?void 0:m.newContent)!==void 0&&i({oldContent:a.data.oldContent,newContent:a.data.newContent,fileName:a.data.fileName})},[a.data]);const u=y=>{s({type:"file",path:y}),i(null);const m=new FormData;m.append("actionType","getDiff"),m.append("filePath",y),m.append("diffType","branch"),m.append("baseBranch",o),m.append("currentBranch",l||""),a.submit(m,{method:"post"})},c=(y,m)=>{s({type:"entity",path:y,entitySha:m}),i(null);const B=new FormData;B.append("actionType","getDiff"),B.append("filePath",y),B.append("diffType","branch"),B.append("baseBranch",o),B.append("currentBranch",l||""),B.append("entitySha",m),a.submit(B,{method:"post"})},x=()=>{s(null),i(null)};return{diffView:t,diffContent:n,isLoading:a.state==="loading"||a.state==="submitting",handleShowFileDiff:u,handleShowEntityDiff:c,handleCloseDiff:x}}function _e({diffView:o,diffContent:l,isLoading:h,entities:t,onClose:s}){var c;const[n,i]=S.useState(!1),[a,u]=S.useState(!1);return S.useEffect(()=>{u(!0)},[]),e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center p-8 z-50",children:e.jsxs("div",{className:"bg-white rounded-xl shadow-2xl max-w-6xl w-full max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-6 border-b border-[#e1e1e1] flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-['IBM_Plex_Sans'] text-2xl font-semibold text-[#232323]",children:o.type==="file"?"File Diff":"Entity Diff"}),e.jsx("p",{className:"font-['IBM_Plex_Mono'] text-sm text-[#8e8e8e] mt-1",children:o.path}),o.type==="entity"&&o.entitySha&&e.jsxs("p",{className:"font-['IBM_Plex_Mono'] text-sm text-[#8e8e8e]",children:["Entity:"," ",((c=t.find(x=>x.sha===o.entitySha))==null?void 0:c.name)||o.entitySha]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:()=>i(!n),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:n?"Show changes only":"Show full file",children:n?"Show Changes Only":"Show Full File"}),e.jsx("button",{onClick:s,className:"text-[#8e8e8e] hover:text-[#626262] transition-colors cursor-pointer",children:e.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:h?e.jsx("div",{className:"p-6 text-center",children:e.jsx("div",{className:"text-[#8e8e8e]",children:"Loading diff..."})}):l?e.jsx("div",{className:"diff-viewer-wrapper",children:a&&e.jsx(Me,{oldValue:l.oldContent,newValue:l.newContent,splitView:!0,useDarkTheme:!1,showDiffOnly:!n,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"}}})}):e.jsx("div",{className:"p-6 text-center",children:e.jsx("div",{className:"text-[#8e8e8e]",children:"No diff available"})})}),e.jsx("div",{className:"p-6 border-t border-[#e1e1e1] flex justify-end gap-3",children:e.jsx("button",{onClick:s,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 Le({files:o,currentBranch:l,defaultBranch:h,baseBranch:t,allBranches:s,expandedFiles:n,isEntityBeingAnalyzed:i,isEntityQueued:a,sortOrder:u,onToggleFile:c,onBranchChange:x,onGenerateSimulation:y,onSortChange:m,onAnalyzeAll:B,analyzeAllDisabled:T,analyzeAllText:F}){const A=o.flatMap(([v,{entities:M}])=>{const f=M.filter(g=>i(g.sha)||a(g)).map(g=>g.sha);return f.length>0?[{entityShas:f}]:[]}),z=v=>{const M=v.map(f=>pe(f,A));return M.includes("analyzing")||M.includes("queued")?"analyzing":M.includes("out-of-date")?"out-of-date":M.includes("not-analyzed")?"not-analyzed":"up-to-date"},D=S.useMemo(()=>[...o].sort((v,M)=>{const f=v[1].entities.reduce((C,k)=>{var N;const j=((N=k.metadata)==null?void 0:N.editedAt)||k.updatedAt;return j?C?new Date(j)>new Date(C)?j:C:j:C},null),g=M[1].entities.reduce((C,k)=>{var N;const j=((N=k.metadata)==null?void 0:N.editedAt)||k.updatedAt;return j?C?new Date(j)>new Date(C)?j:C:j:C},null);if(!f&&!g)return 0;if(!f)return 1;if(!g)return-1;const b=new Date(f).getTime(),w=new Date(g).getTime();return u==="desc"?w-b:b-w}),[o,u]);return e.jsx("div",{children:o.length>0?e.jsxs("div",{children:[e.jsx(re,{showActions:!0,sortOrder:u,onSortChange:m,onAnalyzeAll:B,analyzeAllDisabled:T,analyzeAllText:F}),e.jsx("div",{className:"flex flex-col gap-[3px]",children:D.map(([v,{status:M,entities:f,isUncommitted:g}])=>{const b=n.has(v),w=z(f),C=f.reduce((d,p)=>{var P;const E=((P=p.metadata)==null?void 0:P.editedAt)||p.updatedAt;return E?d?new Date(E)>new Date(d)?E:d:E:d},null),j=f.filter(d=>d.entityType==="visual"||d.entityType==="library").length===0;let N;return j?N=e.jsx("span",{className:"text-[12px] text-gray-400",children:"Not Analyzable"}):w==="analyzing"?N=e.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:[e.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 9 9",fill:"none",className:"animate-spin",children:[e.jsx("circle",{cx:"4.5",cy:"4.5",r:"3.5",stroke:"#FFF4FC",strokeWidth:"1",fill:"none"}),e.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..."]}):w==="up-to-date"?N=e.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"}):w==="out-of-date"?N=e.jsx("button",{onClick:d=>{d.stopPropagation(),f.filter(p=>(p.entityType==="visual"||p.entityType==="library")&&!i(p.sha)&&!a(p)).forEach(p=>y(p))},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"}):w==="not-analyzed"&&(N=e.jsx("button",{onClick:d=>{d.stopPropagation(),f.filter(p=>(p.entityType==="visual"||p.entityType==="library")&&!i(p.sha)&&!a(p)).forEach(p=>y(p))},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"})),e.jsx(le,{filePath:v,isExpanded:b,onToggle:()=>c(v),fileStatus:M,isUncommitted:g,simulationPreviews:e.jsx(de,{entities:f,maxPreviews:1}),entityCount:f.length,state:w,lastModified:C,isNotAnalyzable:j,actionButton:N,children:f.sort((d,p)=>{const E=d.entityType==="visual"||d.entityType==="library",P=p.entityType==="visual"||p.entityType==="library";return E&&!P?-1:!E&&P?1:0}).map(d=>e.jsx(ce,{entity:d,isActivelyAnalyzing:i(d.sha),isQueued:a(d),onGenerateSimulation:y},d.sha))},v)})})]}):e.jsxs("div",{className:"bg-[#efefef] rounded-[10px] flex flex-col items-center justify-center text-center",style:{height:"190px"},children:[e.jsx("p",{className:"font-['IBM_Plex_Sans'] font-medium text-[16px] text-[#3e3e3e] leading-[24px] mb-2",children:"No Changes"}),e.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 Ue({files:o,entityImpactMap:l,expandedFiles:h,isEntityBeingAnalyzed:t,isEntityQueued:s,projectSlug:n,baseBranch:i,currentBranch:a,sortOrder:u,onToggleFile:c,onShowFileDiff:x,onGenerateSimulation:y,onSortChange:m,onAnalyzeAll:B,analyzeAllDisabled:T,analyzeAllText:F}){const A=S.useMemo(()=>{const v=[];return o.forEach(([M,{editedEntities:f}])=>{const g=f.filter(b=>t(b.sha)||s(b)).map(b=>b.sha);g.length>0&&v.push({entityShas:g})}),v},[o,t,s]),z=S.useMemo(()=>{const v=new Map;return o.forEach(([M,{editedEntities:f}])=>{const g=f.map(k=>pe(k,A));let b;g.includes("analyzing")||g.includes("queued")?b="analyzing":g.includes("out-of-date")?b="out-of-date":g.includes("not-analyzed")?b="not-analyzed":b="up-to-date";const w=f.reduce((k,j)=>{var d;const N=((d=j.metadata)==null?void 0:d.editedAt)||j.updatedAt;return N&&(!k||new Date(N)>new Date(k))?N:k},null),C=f.filter(k=>k.entityType==="visual"||k.entityType==="library").length;v.set(M,{state:b,lastModified:w,analyzableCount:C})}),v},[o,A]),D=S.useMemo(()=>[...o].sort((v,M)=>{const f=z.get(v[0]),g=z.get(M[0]),b=f==null?void 0:f.lastModified,w=g==null?void 0:g.lastModified;if(!b&&!w)return 0;if(!b)return 1;if(!w)return-1;const C=new Date(b).getTime(),k=new Date(w).getTime();return u==="desc"?k-C:C-k}),[o,z,u]);return o.length===0?e.jsxs("div",{className:"bg-[#efefef] rounded-[10px] flex flex-col items-center justify-center text-center",style:{height:"190px"},children:[e.jsx("p",{className:"font-['IBM_Plex_Sans'] font-medium text-[16px] text-[#3e3e3e] leading-[24px] mb-2",children:"No Uncommitted Changes"}),e.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."})]}):e.jsxs("div",{children:[e.jsx(re,{showActions:!0,sortOrder:u,onSortChange:m,onAnalyzeAll:B,analyzeAllDisabled:T,analyzeAllText:F}),e.jsx("div",{className:"flex flex-col gap-[3px]",children:D.map(([v,{status:M,editedEntities:f}])=>{const g=h.has(v),b=z.get(v),{state:w,lastModified:C,analyzableCount:k}=b,j=k===0;let N;return j?N=e.jsx("span",{className:"text-[12px] text-gray-400",children:"Not Analyzable"}):w==="analyzing"?N=e.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:[e.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 9 9",fill:"none",className:"animate-spin",children:[e.jsx("circle",{cx:"4.5",cy:"4.5",r:"3.5",stroke:"#FFF4FC",strokeWidth:"1",fill:"none"}),e.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..."]}):w==="up-to-date"?N=e.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"}):w==="out-of-date"?N=e.jsx("button",{onClick:d=>{d.stopPropagation(),f.filter(p=>(p.entityType==="visual"||p.entityType==="library")&&!t(p.sha)&&!s(p)).forEach(p=>y(p))},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"}):w==="not-analyzed"&&(N=e.jsx("button",{onClick:d=>{d.stopPropagation(),f.filter(p=>(p.entityType==="visual"||p.entityType==="library")&&!t(p.sha)&&!s(p)).forEach(p=>y(p))},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"})),e.jsx(le,{filePath:v,isExpanded:g,onToggle:()=>c(v),fileStatus:M,simulationPreviews:e.jsx(de,{entities:f,maxPreviews:1}),entityCount:f.length,state:w,lastModified:C,isNotAnalyzable:j,isUncommitted:!0,actionButton:N,children:f.sort((d,p)=>{const E=d.entityType==="visual"||d.entityType==="library",P=p.entityType==="visual"||p.entityType==="library";return E&&!P?-1:!E&&P?1:0}).map(d=>e.jsx(ce,{entity:d,isActivelyAnalyzing:t(d.sha),isQueued:s(d),onGenerateSimulation:y},d.sha))},v)})})]})}function We({activeTab:o,onTabChange:l,uncommittedCount:h,branchCount:t}){return e.jsx("div",{className:"border-b border-gray-200",children:e.jsxs("nav",{className:"flex gap-8 items-center",children:[e.jsxs("button",{onClick:()=>l("branch"),className:`relative pb-3 px-2 text-sm font-medium transition-colors cursor-pointer ${o==="branch"?"text-primary-100":"text-gray-500 hover:text-gray-700"}`,children:[e.jsxs("span",{className:"flex items-center gap-2",children:["Branch Changes",t>0&&e.jsx("span",{className:`inline-flex items-center justify-center px-2 py-0.5 text-xs font-semibold rounded-full ${o==="branch"?"bg-[#cbf3fa] text-[#005c75]":"bg-[#e1e1e1] text-[#3e3e3e]"}`,children:t})]}),o==="branch"&&e.jsx("span",{className:"absolute -bottom-px left-0 right-0 h-0.5 bg-primary-100"})]}),e.jsxs("button",{onClick:()=>l("uncommitted"),className:`relative pb-3 px-2 text-sm font-medium transition-colors cursor-pointer ${o==="uncommitted"?"text-primary-100":"text-gray-500 hover:text-gray-700"}`,children:[e.jsxs("span",{className:"flex items-center gap-2",children:["Uncommitted Changes",h>0&&e.jsx("span",{className:`inline-flex items-center justify-center px-2 py-0.5 text-xs font-semibold rounded-full ${o==="uncommitted"?"bg-[#cbf3fa] text-[#005c75]":"bg-[#e1e1e1] text-[#3e3e3e]"}`,children:h})]}),o==="uncommitted"&&e.jsx("span",{className:"absolute -bottom-px left-0 right-0 h-0.5 bg-primary-100"})]})]})})}const nt=()=>[{title:"Git - CodeYam"},{name:"description",content:"Git status and impact analysis"}],st=ve(function(){var se,ae;const{entities:l,gitStatus:h,currentBranch:t,actualCurrentBranch:s,defaultBranch:n,allBranches:i,baseBranch:a,branchDiff:u,currentCommit:c,projectSlug:x,queueState:y}=we();Se({source:"git-page"});const[m,B]=Ne(),[T,F]=S.useState(null),[A,z]=S.useState("desc"),[D,v]=S.useState("branch"),M=m.get("expanded")==="true",f=()=>{z(r=>r==="desc"?"asc":"desc")},g=ie(),b=g.data;S.useEffect(()=>{t&&a&&t!==a&&g.state==="idle"&&!b&&g.load(`/api/branch-entity-diff?base=${encodeURIComponent(a)}&compare=${encodeURIComponent(t)}`)},[t,a,g,b]);const w=S.useMemo(()=>{const r=Fe(h,l);return Array.from(r.entries()).sort((I,_)=>I[0].localeCompare(_[0]))},[h,l]),C=S.useMemo(()=>{const r=ze(u,l,b);return Array.from(r.entries()).sort((I,_)=>I[0].localeCompare(_[0]))},[u,l,b]),k=S.useMemo(()=>De(h,l),[h,l]),j=S.useMemo(()=>D==="uncommitted"?w:C,[D,w,C]),N=S.useMemo(()=>j.map(([r])=>r),[j]),{expandedUncommitted:d,setExpandedUncommitted:p,toggleFile:E,expandAllUncommitted:P,collapseAllUncommitted:he}=Pe(M,N,[]),{diffView:$,diffContent:fe,isLoading:ue,handleShowFileDiff:me,handleCloseDiff:xe}=Ie(a,t),L=(se=c==null?void 0:c.metadata)==null?void 0:se.currentRun,Y=new Set((L==null?void 0:L.currentEntityShas)||[]),G=new Set(y.jobs.flatMap(r=>r.entityShas||[])),V=new Set(((ae=y.currentlyExecuting)==null?void 0:ae.entityShas)||[]),{isAnalyzing:H,handleGenerateSimulation:J,handleGenerateAllSimulations:ge,isEntityBeingAnalyzed:O,isEntityPending:X}=Ce(L==null?void 0:L.currentEntityShas,y),K=r=>X(r)||G.has(r.sha)||V.has(r.sha),ye=r=>{r===(s||t)?m.delete("viewBranch"):m.set("viewBranch",r),B(m)},Z=r=>{r===n?m.delete("compare"):m.set("compare",r),B(m)},Q=()=>{const I=j.flatMap(([_,oe])=>oe.editedEntities||oe.entities||[]).filter(_=>!Y.has(_.sha)&&!G.has(_.sha)&&!V.has(_.sha)&&!X(_));ge(I)},be=w.length,je=C.length,R=j.flatMap(([r,I])=>I.editedEntities||I.entities||[]),U=R.filter(r=>r.entityType==="visual"||r.entityType==="library"),q=U.length>0&&U.every(r=>Y.has(r.sha)),ee=U.length>0&&!q&&U.every(r=>G.has(r.sha)||V.has(r.sha)),te=H||q||ee,ne=q?"Analyzing...":ee?"Queued...":H?"Analyzing...":"Analyze All";return e.jsx("div",{className:"bg-[#F8F7F6] min-h-screen",children:e.jsxs("div",{className:"px-20 py-12",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-[28px] font-semibold text-gray-900 mb-2",children:"Git Changes"}),e.jsxs("p",{className:"text-[15px] text-gray-500",children:["This is a list of all the files that are affected by your local changes. ",e.jsx("strong",{children:"Analyze a file to get simulations."})]})]}),e.jsx("div",{className:"mb-6",children:e.jsx(We,{activeTab:D,onTabChange:v,uncommittedCount:be,branchCount:je})}),t&&D==="branch"&&e.jsx("div",{className:"bg-white border-b border-gray-200 rounded-t-lg px-5 py-4 mb-3",children:t===n?e.jsxs("div",{className:"text-gray-700",children:["You are currently on the primary branch,"," ",e.jsx("span",{className:"text-cyblack-75",children:n}),"."]}):e.jsxs("div",{className:"flex gap-6 items-center",children:[e.jsxs("div",{className:"shrink-0",children:[e.jsx("div",{className:"text-[11px] text-gray-500 mb-2 uppercase",children:"Changes in Branch:"}),i.length>0?e.jsxs("div",{className:"relative w-50",children:[e.jsx("select",{value:t,onChange:r=>ye(r.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:i.map(r=>e.jsx("option",{value:r,children:r},r))}),e.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:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}):e.jsx("span",{className:"text-gray-900 font-medium text-[12px]",children:t})]}),e.jsxs("div",{className:"flex-shrink-0",children:[e.jsx("div",{className:"text-[11px] text-gray-500 mb-2 uppercase",children:"Compared To:"}),e.jsxs("div",{className:"relative w-[200px]",children:[e.jsx("select",{value:a,onChange:r=>Z(r.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:i.filter(r=>r!==t).map(r=>e.jsx("option",{value:r,children:r},r))}),e.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:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),e.jsx("div",{className:"flex-1 mt-6",children:e.jsxs("div",{className:"relative flex items-center",children:[e.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:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),e.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"})]})})]})}),e.jsx("div",{className:"mb-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsxs("span",{className:"font-mono uppercase",style:{fontSize:"11px",color:"#8b8b8b",fontWeight:500,letterSpacing:"0.05em"},children:[e.jsx("span",{style:{color:"#000000"},children:j.length})," ","modified ",j.length===1?"file":"files"]}),e.jsxs("div",{className:"relative group inline-flex items-center ml-1.5",children:[e.jsx("svg",{className:"w-3 h-3 text-gray-400 cursor-help",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),e.jsx("div",{className:"absolute left-0 top-full mt-2 hidden group-hover:block z-50 w-80",children:e.jsxs("div",{className:"bg-gray-900 text-white text-xs rounded-lg px-3 py-2 shadow-lg",children:["In CodeYam, an entity is a discrete, analyzable unit of code that can be independently simulated and tested.",e.jsx("div",{className:"absolute -top-1 left-4 w-2 h-2 bg-gray-900 transform rotate-45"})]})})]}),e.jsx("span",{className:"font-mono uppercase",style:{fontSize:"11px",color:"#d1d5db",fontWeight:500,letterSpacing:"0.05em",marginLeft:"8px"},children:"|"}),e.jsxs("span",{className:"font-mono uppercase",style:{fontSize:"11px",color:"#8b8b8b",fontWeight:500,letterSpacing:"0.05em",marginLeft:"8px"},children:[e.jsx("span",{style:{color:"#000000"},children:R.length})," ",R.length===1?"entity":"entities"]})]}),j.length>0&&e.jsxs("div",{className:"flex gap-6",children:[e.jsxs("button",{onClick:P,className:"text-[#005c75] hover:bg-[#E6F5F8] hover:text-[#003d4f] font-mono uppercase transition-all cursor-pointer px-3 py-1 rounded flex items-center gap-1.5",style:{fontSize:"11px",fontWeight:500,letterSpacing:"0.05em"},children:[e.jsx(ke,{className:"w-3.5 h-3.5"}),"Expand All"]}),e.jsxs("button",{onClick:he,className:"text-[#005c75] hover:bg-[#E6F5F8] hover:text-[#003d4f] font-mono uppercase transition-all cursor-pointer px-3 py-1 rounded flex items-center gap-1.5",style:{fontSize:"11px",fontWeight:500,letterSpacing:"0.05em"},children:[e.jsx(Be,{className:"w-3.5 h-3.5"}),"Collapse All"]})]})]})}),e.jsxs("div",{className:"overflow-hidden",children:[D==="branch"&&t&&e.jsx(Le,{files:C,currentBranch:t,defaultBranch:n,baseBranch:a,allBranches:i,expandedFiles:d,isEntityBeingAnalyzed:O,isEntityQueued:K,sortOrder:A,onToggleFile:r=>E(r,d,p),onBranchChange:Z,onGenerateSimulation:J,onSortChange:f,onAnalyzeAll:Q,analyzeAllDisabled:te,analyzeAllText:ne}),D==="uncommitted"&&e.jsx(Ue,{files:w,entityImpactMap:k,expandedFiles:d,isEntityBeingAnalyzed:O,isEntityQueued:K,projectSlug:x,baseBranch:a,currentBranch:t,sortOrder:A,onToggleFile:r=>E(r,d,p),onShowFileDiff:me,onGenerateSimulation:J,onSortChange:f,onAnalyzeAll:Q,analyzeAllDisabled:te,analyzeAllText:ne})]}),$&&e.jsx(_e,{diffView:$,diffContent:fe,isLoading:ue,entities:l,onClose:xe}),T&&x&&e.jsx(Ae,{projectSlug:x,onClose:()=>F(null)})]})})});export{st as default,nt as meta};