maxsimcli 2.0.4 → 2.0.5

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 (56) hide show
  1. package/dist/assets/CHANGELOG.md +7 -0
  2. package/dist/assets/dashboard/packages/dashboard/.next/BUILD_ID +1 -1
  3. package/dist/assets/dashboard/packages/dashboard/.next/app-build-manifest.json +4 -4
  4. package/dist/assets/dashboard/packages/dashboard/.next/app-path-routes-manifest.json +1 -1
  5. package/dist/assets/dashboard/packages/dashboard/.next/build-manifest.json +2 -2
  6. package/dist/assets/dashboard/packages/dashboard/.next/prerender-manifest.json +3 -3
  7. package/dist/assets/dashboard/packages/dashboard/.next/server/app/_not-found.html +1 -1
  8. package/dist/assets/dashboard/packages/dashboard/.next/server/app/_not-found.rsc +1 -1
  9. package/dist/assets/dashboard/packages/dashboard/.next/server/app/index.html +1 -1
  10. package/dist/assets/dashboard/packages/dashboard/.next/server/app/index.rsc +1 -1
  11. package/dist/assets/dashboard/packages/dashboard/.next/server/app-paths-manifest.json +1 -1
  12. package/dist/assets/dashboard/packages/dashboard/.next/server/pages/404.html +1 -1
  13. package/dist/assets/dashboard/packages/dashboard/.next/server/pages/500.html +1 -1
  14. package/dist/assets/dashboard/packages/dashboard/.next/server/server-reference-manifest.json +1 -1
  15. package/dist/assets/dashboard/packages/dashboard/.next/static/SqS3mf1zkkvKitganURR6/_buildManifest.js +1 -0
  16. package/dist/assets/dashboard/packages/dashboard/.next/static/SqS3mf1zkkvKitganURR6/_ssgManifest.js +1 -0
  17. package/dist/assets/dashboard/packages/dashboard/.next/static/chunks/1e97858d-8f9862bf6e8392c4.js +1 -0
  18. package/dist/assets/dashboard/packages/dashboard/.next/static/chunks/201-f8a322a9e47f34de.js +1 -0
  19. package/dist/assets/dashboard/packages/dashboard/.next/static/chunks/4d67e943-e6a0fd3b5c397505.js +1 -0
  20. package/dist/assets/dashboard/packages/dashboard/.next/static/chunks/690-74e5df42203c3ac7.js +1 -0
  21. package/dist/assets/dashboard/packages/dashboard/.next/static/chunks/app/_not-found/page-467b0752ec97f74f.js +1 -0
  22. package/dist/assets/dashboard/packages/dashboard/.next/static/chunks/app/api/health/route-47e01b8ae8872f2e.js +1 -0
  23. package/dist/assets/dashboard/packages/dashboard/.next/static/chunks/app/api/phase/[id]/route-47e01b8ae8872f2e.js +1 -0
  24. package/dist/assets/dashboard/packages/dashboard/.next/static/chunks/app/api/phases/route-47e01b8ae8872f2e.js +1 -0
  25. package/dist/assets/dashboard/packages/dashboard/.next/static/chunks/app/api/plan/[...path]/route-47e01b8ae8872f2e.js +1 -0
  26. package/dist/assets/dashboard/packages/dashboard/.next/static/chunks/app/api/project/route-47e01b8ae8872f2e.js +1 -0
  27. package/dist/assets/dashboard/packages/dashboard/.next/static/chunks/app/api/roadmap/route-47e01b8ae8872f2e.js +1 -0
  28. package/dist/assets/dashboard/packages/dashboard/.next/static/chunks/app/api/state/route-47e01b8ae8872f2e.js +1 -0
  29. package/dist/assets/dashboard/packages/dashboard/.next/static/chunks/app/api/todos/route-47e01b8ae8872f2e.js +1 -0
  30. package/dist/assets/dashboard/packages/dashboard/.next/static/chunks/app/layout-ed940397e445e353.js +1 -0
  31. package/dist/assets/dashboard/packages/dashboard/.next/static/chunks/app/page-7d14d86bc5334ec8.js +1 -0
  32. package/dist/assets/dashboard/packages/dashboard/.next/static/chunks/framework-bec628f2b7cc8f6d.js +1 -0
  33. package/dist/assets/dashboard/packages/dashboard/.next/static/chunks/main-790db736f48e7597.js +1 -0
  34. package/dist/assets/dashboard/packages/dashboard/.next/static/chunks/main-app-6b9bd1992c146060.js +1 -0
  35. package/dist/assets/dashboard/packages/dashboard/.next/static/chunks/pages/_app-f4d560c9dbc22e4e.js +1 -0
  36. package/dist/assets/dashboard/packages/dashboard/.next/static/chunks/pages/_error-492bd157be5771d5.js +1 -0
  37. package/dist/assets/dashboard/packages/dashboard/.next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
  38. package/dist/assets/dashboard/packages/dashboard/.next/static/chunks/webpack-73318435590a84a9.js +1 -0
  39. package/dist/assets/dashboard/packages/dashboard/.next/static/css/c9e9cb8d084f06ac.css +3 -0
  40. package/dist/assets/dashboard/packages/dashboard/.next/static/media/0aa834ed78bf6d07-s.woff2 +0 -0
  41. package/dist/assets/dashboard/packages/dashboard/.next/static/media/19cfc7226ec3afaa-s.woff2 +0 -0
  42. package/dist/assets/dashboard/packages/dashboard/.next/static/media/21350d82a1f187e9-s.woff2 +0 -0
  43. package/dist/assets/dashboard/packages/dashboard/.next/static/media/67957d42bae0796d-s.woff2 +0 -0
  44. package/dist/assets/dashboard/packages/dashboard/.next/static/media/886030b0b59bc5a7-s.woff2 +0 -0
  45. package/dist/assets/dashboard/packages/dashboard/.next/static/media/8e9860b6e62d6359-s.woff2 +0 -0
  46. package/dist/assets/dashboard/packages/dashboard/.next/static/media/939c4f875ee75fbb-s.woff2 +0 -0
  47. package/dist/assets/dashboard/packages/dashboard/.next/static/media/ba9851c3c22cd980-s.woff2 +0 -0
  48. package/dist/assets/dashboard/packages/dashboard/.next/static/media/bb3ef058b751a6ad-s.p.woff2 +0 -0
  49. package/dist/assets/dashboard/packages/dashboard/.next/static/media/c5fe6dc8356a8c31-s.woff2 +0 -0
  50. package/dist/assets/dashboard/packages/dashboard/.next/static/media/df0a9ae256c0569c-s.woff2 +0 -0
  51. package/dist/assets/dashboard/packages/dashboard/.next/static/media/e4af272ccee01ff0-s.p.woff2 +0 -0
  52. package/dist/assets/dashboard/packages/dashboard/.next/static/media/f911b923c6adde36-s.woff2 +0 -0
  53. package/dist/install.cjs +1 -1
  54. package/package.json +1 -1
  55. /package/dist/assets/dashboard/.next/static/{QZFMbW4UFaqoa-WPGmy8n → SqS3mf1zkkvKitganURR6}/_buildManifest.js +0 -0
  56. /package/dist/assets/dashboard/.next/static/{QZFMbW4UFaqoa-WPGmy8n → SqS3mf1zkkvKitganURR6}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{4054:(e,t,s)=>{Promise.resolve().then(s.bind(s,4098))},4098:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>P});var n=s(206),a=s(1406),r=s(4934);function o(){let{lastChange:e}=(0,r.h)(),[t,s]=(0,a.useState)(null),[n,o]=(0,a.useState)(null),[l,c]=(0,a.useState)(null),[d,i]=(0,a.useState)(!0),[u,x]=(0,a.useState)(null),m=(0,a.useCallback)(async()=>{try{x(null);let[e,t,n]=await Promise.all([fetch("/api/roadmap"),fetch("/api/state"),fetch("/api/todos")]);if(!e.ok)throw Error("Roadmap fetch failed: ".concat(e.status));if(!t.ok)throw Error("State fetch failed: ".concat(t.status));if(!n.ok)throw Error("Todos fetch failed: ".concat(n.status));let[a,r,l]=await Promise.all([e.json(),t.json(),n.json()]);s(a),o(r),c(l)}catch(t){let e=t instanceof Error?t.message:"Failed to fetch dashboard data";x(e),console.error("[use-dashboard-data]",e)}finally{i(!1)}},[]);return(0,a.useEffect)(()=>{m()},[m]),(0,a.useEffect)(()=>{e>0&&m()},[e,m]),{roadmap:t,state:n,todos:l,loading:d,error:u}}var l=s(8748);function c(e){var t,s,a,o,c,d,i,u,x;let{roadmap:m,state:p,todos:h}=e,{connected:f}=(0,r.h)(),g=null!=(s=null==m?void 0:m.progress_percent)?s:0,b=null!=(o=null!=(a=null==m?void 0:m.current_phase)?a:null==p?void 0:p.currentPhase)?o:"--",j=null!=(c=null==m||null==(t=m.phases.find(e=>e.number===m.current_phase))?void 0:t.name)?c:"",v=null!=(d=null==p?void 0:p.blockers.filter(e=>!e.includes("RESOLVED")).length)?d:0,N=null!=(i=null==h?void 0:h.pending.length)?i:0,w=null!=(u=null==m?void 0:m.completed_phases)?u:0,y=null!=(x=null==m?void 0:m.phase_count)?x:0;return(0,n.jsxs)("div",{className:"flex flex-col gap-4 border-b border-border pb-5",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("span",{className:"inline-block h-2 w-2 rounded-full ".concat(f?"bg-success":"bg-danger"),title:f?"Connected":"Disconnected"}),(0,n.jsx)("span",{className:"font-mono text-xs uppercase tracking-widest text-muted-foreground",children:"Milestone Progress"}),(0,n.jsxs)("span",{className:"ml-auto font-mono text-xs text-muted-foreground",children:[w,"/",y," phases"]})]}),(0,n.jsx)("div",{className:"h-2 w-full overflow-hidden rounded-sm bg-muted",children:(0,n.jsx)(l.P.div,{className:"h-full rounded-sm bg-accent",initial:{width:0},animate:{width:"".concat(g,"%")},transition:{duration:.6,ease:"easeOut"}})}),(0,n.jsxs)("div",{className:"flex items-center gap-8",children:[(0,n.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,n.jsxs)("span",{className:"font-mono text-2xl font-bold tabular-nums text-foreground",children:[g,"%"]}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:"complete"})]}),(0,n.jsxs)("div",{className:"flex items-baseline gap-2 border-l border-border pl-8",children:[(0,n.jsx)("span",{className:"font-mono text-sm font-semibold text-accent",children:b}),(0,n.jsx)("span",{className:"text-sm text-foreground",children:j})]}),(0,n.jsxs)("div",{className:"ml-auto flex items-center gap-6",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"Blockers"}),(0,n.jsx)("span",{className:"inline-flex h-6 min-w-6 items-center justify-center rounded-sm px-1.5 font-mono text-xs font-bold ".concat(v>0?"bg-danger/20 text-danger shadow-[0_0_8px_rgba(239,68,68,0.3)]":"bg-muted text-muted-foreground"),children:v})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"Todos"}),(0,n.jsx)("span",{className:"inline-flex h-6 min-w-6 items-center justify-center rounded-sm px-1.5 font-mono text-xs font-bold ".concat(N>0?"bg-warning/20 text-warning":"bg-muted text-muted-foreground"),children:N})]})]})]})]})}function d(e){let{status:t}=e;switch(t){case"complete":return(0,n.jsx)("svg",{className:"h-4 w-4 text-success",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,n.jsx)("path",{d:"M3 8.5l3.5 3.5L13 4"})});case"partial":return(0,n.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-full border-2 border-accent bg-transparent"});case"planned":return(0,n.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-full border-2 border-muted-foreground bg-transparent"});default:return(0,n.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-full bg-muted"})}}function i(e){let{phaseName:t,phaseNumber:s,completedPlans:a,totalPlans:r,status:o,isCurrent:c,onClick:i}=e,u=r>0?Math.round(a/r*100):0;return(0,n.jsxs)("button",{type:"button",onClick:()=>i(s),className:"group flex w-full flex-col gap-2 rounded-sm px-4 py-3 text-left transition-colors ".concat(c?"border-l-4 border-l-accent bg-card-hover":"border-l-4 border-l-transparent hover:bg-card-hover"),children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)(d,{status:o}),(0,n.jsx)("span",{className:"font-mono text-sm font-semibold ".concat(c?"text-accent":"text-muted-foreground"),children:s}),(0,n.jsx)("span",{className:"truncate text-sm text-foreground",children:t}),(0,n.jsxs)("span",{className:"ml-auto shrink-0 font-mono text-xs text-muted-foreground",children:[a,"/",r]})]}),(0,n.jsx)("div",{className:"h-1.5 w-full overflow-hidden rounded-sm bg-muted",children:(0,n.jsx)(l.P.div,{className:"h-full rounded-sm ".concat(function(e){switch(e){case"complete":return"bg-success";case"partial":return"bg-accent";default:return"bg-muted-foreground"}}(o)),initial:{width:0},animate:{width:"".concat(u,"%")},transition:{duration:.5,ease:"easeOut"}})})]})}function u(e){let{phases:t,currentPhase:s,onPhaseClick:a}=e;return(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between px-4 pb-2",children:[(0,n.jsx)("span",{className:"font-mono text-xs uppercase tracking-widest text-muted-foreground",children:"Phases"}),(0,n.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:t.length})]}),(0,n.jsx)("div",{className:"flex flex-col gap-1",children:t.map(e=>(0,n.jsx)(i,{phaseNumber:e.number,phaseName:e.name,completedPlans:e.summaryCount,totalPlans:e.planCount,status:e.diskStatus,isCurrent:e.number===s,onClick:a},e.number))})]})}var x=s(5230),m=s(2501);function p(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return(0,m.QP)((0,x.$)(t))}function h(e){let{tasks:t,planPath:s,planContent:r,onContentChange:o}=e,l=(0,a.useCallback)(async e=>{let n=t[e];if(!n)return;let a=r,l=n.name.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=new RegExp("<name>\\s*".concat(l,"\\s*</name>")).exec(a);if(c){let e=a.slice(c.index),t=e.match(/<done>([\s\S]*?)<\/done>/);if(t){let s,r=t[1],o=c.index+e.indexOf(t[0]),l=o+t[0].length;s=n.completed?r.replace(/^\s*\[x\]\s*/,""):"[x] ".concat(r.trim()),a=a.slice(0,o)+"<done>".concat(s,"</done>")+a.slice(l)}}if(a!==r){o(a);try{let e=s.replace(/^\.planning[\\/]/,"").split(/[\\/]/);await fetch("/api/plan/".concat(e.join("/")),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:a})})}catch(e){console.error("[task-list] Failed to write checkbox change:",e)}}},[t,s,r,o]);return 0===t.length?(0,n.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"No tasks defined"}):(0,n.jsx)("div",{className:"space-y-1",children:t.map((e,t)=>(0,n.jsxs)("div",{className:p("flex items-start gap-2 py-1 px-2 rounded-md transition-colors","hover:bg-muted/50",e.completed&&"opacity-60"),children:[(0,n.jsx)("button",{type:"button",onClick:()=>l(t),className:p("mt-0.5 flex-shrink-0 w-4 h-4 rounded-sm border transition-colors","focus:outline-none focus:ring-2 focus:ring-accent/50",e.completed?"bg-success border-success text-background":"border-muted-foreground hover:border-accent"),"aria-label":"Toggle ".concat(e.name),children:e.completed&&(0,n.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,n.jsx)("path",{d:"M3 8l3 3 7-7"})})}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:p("text-sm font-sans",e.completed&&"line-through text-muted-foreground"),children:e.name}),(0,n.jsx)("span",{className:p("text-xs px-1.5 py-0.5 rounded-sm font-mono",e.type.startsWith("checkpoint")?"bg-warning/20 text-warning":"bg-muted text-muted-foreground"),children:e.type})]}),e.files.length>0&&(0,n.jsx)("div",{className:"mt-0.5",children:e.files.map((e,t)=>(0,n.jsx)("span",{className:"text-xs font-mono text-muted-foreground mr-2",children:e},t))})]})]},t))})}function f(e){var t,s,r;let{plan:o,onEdit:l}=e,[c,d]=(0,a.useState)(o.content),i=o.frontmatter,u=null!=(t=i.plan)?t:"?",x=i.wave,m=i.autonomous,f=null!=(s=i.depends_on)?s:[],g=null!=(r=i.files_modified)?r:[],b="",j=o.content.match(/<objective>([\s\S]*?)<\/objective>/);if(j){let e=j[1].trim().split("\n")[0];b=e.length>120?e.slice(0,117)+"...":e}let v=(0,a.useCallback)(e=>{d(e)},[]);return(0,n.jsxs)("div",{className:p("bg-card border border-border rounded-lg p-4","transition-colors hover:bg-card-hover"),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsxs)("span",{className:"text-lg font-semibold font-mono text-accent",children:["#",String(u).padStart(2,"0")]}),void 0!==x&&(0,n.jsxs)("span",{className:"text-xs px-1.5 py-0.5 rounded-sm bg-accent/20 text-accent-glow font-mono",children:["wave ",x]}),m&&(0,n.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded-sm bg-success/20 text-success font-mono",children:"autonomous"})]}),(0,n.jsx)("button",{type:"button",onClick:()=>l(o.path),className:p("text-xs px-3 py-1 rounded-md font-mono","bg-muted text-muted-foreground","hover:bg-accent/20 hover:text-accent-glow","transition-colors focus:outline-none focus:ring-2 focus:ring-accent/50"),children:"Edit"})]}),b&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground mb-3 leading-relaxed",children:b}),(0,n.jsxs)("div",{className:"flex gap-4 mb-3 text-xs text-muted-foreground font-mono",children:[f.length>0&&(0,n.jsxs)("span",{children:["depends: ",f.join(", ")]}),g.length>0&&(0,n.jsxs)("span",{children:[g.length," file",1!==g.length?"s":""]}),(0,n.jsxs)("span",{children:[o.tasks.length," task",1!==o.tasks.length?"s":""]})]}),(0,n.jsx)(h,{tasks:o.tasks,planPath:o.path,planContent:c,onContentChange:v})]})}var g=s(1571),b=s(6971),j=s(7918),v=s(7513);function N(e){let{initialContent:t,filePath:s,onSave:r,onClose:o}=e,[l,c]=(0,a.useState)(t),[d,i]=(0,a.useState)(!1),[u,x]=(0,a.useState)(!1),m=(0,a.useRef)(l);(0,a.useEffect)(()=>{m.current=l},[l]);let h=(0,a.useCallback)(e=>{c(e),x(e!==t)},[t]),f=(0,a.useCallback)(async()=>{if(!d){i(!0);try{await r(m.current),x(!1)}catch(e){console.error("[plan-editor] Save failed:",e)}finally{i(!1)}}},[r,d]),N=(0,a.useCallback)(()=>{(!u||window.confirm("Unsaved changes -- discard?"))&&o()},[u,o]),w=v.w4.of([{key:"Mod-s",run:()=>(f(),!0)}]);return(0,a.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&"s"===e.key&&e.preventDefault()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[]),(0,n.jsxs)("div",{className:"fixed inset-0 z-50 bg-background/95 flex flex-col",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-card",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("span",{className:"text-sm font-mono text-muted-foreground",children:s}),u&&(0,n.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded-sm bg-warning/20 text-warning font-mono",children:"unsaved"})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[u&&(0,n.jsx)("button",{type:"button",onClick:f,disabled:d,className:p("text-xs px-3 py-1.5 rounded-md font-mono","bg-accent text-foreground","hover:bg-accent-glow","disabled:opacity-50 disabled:cursor-not-allowed","transition-colors focus:outline-none focus:ring-2 focus:ring-accent/50"),children:d?"Saving...":"Save"}),(0,n.jsx)("button",{type:"button",onClick:N,className:p("text-xs px-3 py-1.5 rounded-md font-mono","bg-muted text-muted-foreground","hover:bg-danger/20 hover:text-danger","transition-colors focus:outline-none focus:ring-2 focus:ring-accent/50"),children:"Close"})]})]}),(0,n.jsx)("div",{className:"flex-1 overflow-auto",children:(0,n.jsx)(g.Ay,{value:l,onChange:h,theme:j.bM,extensions:[(0,b.wD)({base:b.Sz}),w],height:"calc(100vh - 56px)",basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0,bracketMatching:!0,indentOnInput:!0}})})]})}function w(e){var t;let{phaseId:s,onBack:o}=e,{plans:l,context:c,research:d,loading:i,error:u,refetch:x}=function(e){var t,s,n;let[o,l]=(0,a.useState)(null),[c,d]=(0,a.useState)(!1),[i,u]=(0,a.useState)(null),{lastChange:x}=(0,r.h)(),m=(0,a.useCallback)(async()=>{if(!e){l(null),d(!1),u(null);return}d(!0),u(null);try{let t=await fetch("/api/phase/".concat(encodeURIComponent(e)));if(!t.ok){let s=await t.json().catch(()=>({}));throw Error(s.error||"Failed to fetch phase ".concat(e," (").concat(t.status,")"))}let s=await t.json();l(s)}catch(e){u(e instanceof Error?e.message:"Unknown error")}finally{d(!1)}},[e]);return(0,a.useEffect)(()=>{m()},[m]),(0,a.useEffect)(()=>{x>0&&m()},[x,m]),{plans:null!=(t=null==o?void 0:o.plans)?t:[],context:null!=(s=null==o?void 0:o.context)?s:null,research:null!=(n=null==o?void 0:o.research)?n:null,loading:c,error:i,refetch:m}}(s),[m,h]=(0,a.useState)(null),[g,b]=(0,a.useState)(""),j=l.length>0&&null!=(t=l[0].frontmatter.phase)?t:s,v=(0,a.useCallback)(async e=>{try{let t=e.replace(/^\.planning[\\/]/,"").split(/[\\/]/),s=await fetch("/api/plan/".concat(t.join("/")));if(!s.ok)return void console.error("[phase-detail] Failed to fetch plan for editing");let n=await s.json();b(n.content),h(e)}catch(e){console.error("[phase-detail] Error fetching plan:",e)}},[]),w=(0,a.useCallback)(async e=>{if(!m)return;let t=m.replace(/^\.planning[\\/]/,"").split(/[\\/]/);if(!(await fetch("/api/plan/".concat(t.join("/")),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e})})).ok)throw Error("Failed to save plan")},[m]),y=(0,a.useCallback)(()=>{h(null),b(""),x()},[x]);return(0,n.jsxs)("div",{className:"space-y-6",children:[(0,n.jsxs)("button",{type:"button",onClick:o,className:p("flex items-center gap-2 text-sm text-muted-foreground","hover:text-foreground transition-colors","focus:outline-none focus:ring-2 focus:ring-accent/50 rounded-md px-2 py-1"),children:[(0,n.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,n.jsx)("path",{d:"M10 3L5 8l5 5"})}),"Back to overview"]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("h2",{className:"text-2xl font-semibold tracking-tight",children:[(0,n.jsxs)("span",{className:"text-accent font-mono",children:["Phase ",s]}),(0,n.jsx)("span",{className:"mx-2 text-muted-foreground",children:"-"}),(0,n.jsx)("span",{children:j})]}),(0,n.jsxs)("div",{className:"flex gap-2 mt-2",children:[c&&(0,n.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-sm bg-success/20 text-success font-mono",children:"context available"}),d&&(0,n.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-sm bg-success/20 text-success font-mono",children:"research available"}),!c&&!d&&!i&&(0,n.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-sm bg-muted text-muted-foreground font-mono",children:"no context or research"})]})]}),u&&(0,n.jsx)("div",{className:"p-4 rounded-lg border border-danger/50 bg-danger/10 text-danger text-sm",children:u}),i&&0===l.length&&(0,n.jsx)("div",{className:"space-y-4",children:[1,2,3].map(e=>(0,n.jsxs)("div",{className:"bg-card border border-border rounded-lg p-4 animate-pulse",children:[(0,n.jsx)("div",{className:"h-6 w-32 bg-muted rounded mb-3"}),(0,n.jsx)("div",{className:"h-4 w-3/4 bg-muted rounded mb-2"}),(0,n.jsx)("div",{className:"h-4 w-1/2 bg-muted rounded mb-3"}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)("div",{className:"h-3 w-full bg-muted rounded"}),(0,n.jsx)("div",{className:"h-3 w-5/6 bg-muted rounded"})]})]},e))}),!i&&!u&&0===l.length&&(0,n.jsx)("div",{className:"p-8 text-center text-muted-foreground border border-border rounded-lg bg-card",children:(0,n.jsxs)("p",{className:"text-sm",children:["No plans yet -- run"," ",(0,n.jsx)("code",{className:"font-mono text-accent",children:"/maxsim:plan-phase"})," to create plans"]})}),l.length>0&&(0,n.jsx)("div",{className:"space-y-4",children:l.map(e=>(0,n.jsx)(f,{plan:e,onEdit:v},e.path))}),m&&(0,n.jsx)(N,{initialContent:g,filePath:m,onSave:w,onClose:y})]})}function y(){let{lastChange:e}=(0,r.h)(),[t,s]=(0,a.useState)([]),[o,l]=(0,a.useState)([]),[c,d]=(0,a.useState)(!0),[i,u]=(0,a.useState)(null),[x,m]=(0,a.useState)(""),[h,f]=(0,a.useState)(!1),[g,b]=(0,a.useState)(!1),j=(0,a.useCallback)(async()=>{try{u(null);let e=await fetch("/api/todos");if(!e.ok)throw Error("Failed to fetch todos: ".concat(e.status));let t=await e.json();s(t.pending),l(t.completed)}catch(e){u(e instanceof Error?e.message:"Failed to fetch todos")}finally{d(!1)}},[]);(0,a.useEffect)(()=>{j()},[j]),(0,a.useEffect)(()=>{e>0&&j()},[e,j]);let v=(0,a.useCallback)(async()=>{let e=x.trim();if(e){f(!0);try{if(!(await fetch("/api/todos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:e})})).ok)throw Error("Failed to create todo");m(""),await j()}catch(e){u(e instanceof Error?e.message:"Failed to create todo")}finally{f(!1)}}},[x,j]),N=(0,a.useCallback)(async(e,t)=>{try{if(!(await fetch("/api/todos",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:e,completed:t})})).ok)throw Error("Failed to update todo");await j()}catch(e){u(e instanceof Error?e.message:"Failed to update todo")}},[j]);return(0,n.jsxs)("div",{className:"space-y-6",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("h2",{className:"font-mono text-lg font-semibold tracking-tight text-foreground",children:"Todos"}),(0,n.jsxs)("span",{className:"font-mono text-xs text-muted-foreground",children:[t.length," pending"]})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("input",{type:"text",value:x,onChange:e=>m(e.target.value),onKeyDown:e=>{"Enter"!==e.key||h||v()},placeholder:"Add a new todo...",className:"flex-1 rounded-sm border border-border bg-card px-3 py-2 font-mono text-sm text-foreground placeholder:text-muted-foreground focus:border-accent focus:outline-none"}),(0,n.jsx)("button",{type:"button",onClick:v,disabled:h||!x.trim(),className:p("rounded-sm bg-accent px-4 py-2 font-mono text-xs font-semibold text-foreground transition-colors","hover:bg-accent-glow disabled:opacity-40 disabled:cursor-not-allowed"),children:"Add"})]}),i&&(0,n.jsx)("div",{className:"rounded-sm border border-danger/50 bg-danger/10 px-3 py-2 text-sm text-danger",children:i}),c&&(0,n.jsx)("div",{className:"space-y-2",children:[1,2,3].map(e=>(0,n.jsxs)("div",{className:"flex items-center gap-3 rounded-sm bg-card px-4 py-3",children:[(0,n.jsx)("div",{className:"h-4 w-4 animate-pulse rounded-sm bg-muted"}),(0,n.jsx)("div",{className:"h-4 w-48 animate-pulse rounded-sm bg-muted"})]},e))}),!c&&(0,n.jsx)("div",{className:"space-y-1",children:0===t.length?(0,n.jsx)("p",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:"No pending todos"}):t.map(e=>(0,n.jsxs)("button",{type:"button",onClick:()=>N(e.file,!0),className:"group flex w-full items-center gap-3 rounded-sm px-4 py-2.5 text-left transition-colors hover:bg-card-hover",children:[(0,n.jsx)("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-muted-foreground transition-colors group-hover:border-accent"}),(0,n.jsx)("span",{className:"text-sm text-foreground",children:e.text})]},e.file))}),!c&&o.length>0&&(0,n.jsxs)("div",{className:"border-t border-border pt-4",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>b(!g),className:"flex w-full items-center gap-2 text-left",children:[(0,n.jsx)("svg",{className:p("h-3 w-3 text-muted-foreground transition-transform",g&&"rotate-90"),viewBox:"0 0 12 12",fill:"currentColor",children:(0,n.jsx)("path",{d:"M4 2l5 4-5 4z"})}),(0,n.jsxs)("span",{className:"font-mono text-xs text-muted-foreground",children:["Completed (",o.length,")"]})]}),g&&(0,n.jsx)("div",{className:"mt-2 space-y-1",children:o.map(e=>(0,n.jsxs)("button",{type:"button",onClick:()=>N(e.file,!1),className:"group flex w-full items-center gap-3 rounded-sm px-4 py-2 text-left transition-colors hover:bg-card-hover",children:[(0,n.jsx)("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-success bg-success/20",children:(0,n.jsx)("svg",{className:"h-3 w-3 text-success",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,n.jsx)("path",{d:"M2 6l3 3 5-5"})})}),(0,n.jsx)("span",{className:"text-sm text-muted-foreground line-through",children:e.text})]},e.file))})]})]})}function k(e){let{onEntryAdded:t}=e,[s,r]=(0,a.useState)(!1),[o,l]=(0,a.useState)("decision"),[c,d]=(0,a.useState)(""),[i,u]=(0,a.useState)(""),[x,m]=(0,a.useState)(!1),[h,f]=(0,a.useState)(null),[g,b]=(0,a.useState)(null),j=(0,a.useCallback)(async()=>{let e=i.trim();if(e){m(!0),f(null),b(null);try{if("decision"===o){let t=c.trim()?"[".concat(c.trim(),"]: "):"",s="".concat(t).concat(e);if(!(await fetch("/api/state",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({field:"decisions",value:s})})).ok)throw Error("Could not add decision - STATE.md field not found");b("Decision added")}else{if(!(await fetch("/api/state",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({field:"blockers",value:e})})).ok)throw Error("Could not add blocker - STATE.md field not found");b("Blocker added")}u(""),d(""),null==t||t(),setTimeout(()=>b(null),2e3)}catch(e){f(e instanceof Error?e.message:"Failed to update STATE.md")}finally{m(!1)}}},[o,c,i,t]);return(0,n.jsxs)("div",{className:"border-t border-border pt-4",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>r(!s),className:"flex w-full items-center gap-2 text-left",children:[(0,n.jsx)("svg",{className:p("h-3 w-3 text-muted-foreground transition-transform",s&&"rotate-90"),viewBox:"0 0 12 12",fill:"currentColor",children:(0,n.jsx)("path",{d:"M4 2l5 4-5 4z"})}),(0,n.jsx)("span",{className:"font-mono text-xs uppercase tracking-wide text-muted-foreground",children:"Add to STATE.md"})]}),s&&(0,n.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,n.jsxs)("div",{className:"flex gap-1",children:[(0,n.jsx)("button",{type:"button",onClick:()=>l("decision"),className:p("rounded-sm px-3 py-1 font-mono text-xs transition-colors","decision"===o?"bg-accent/20 text-accent":"text-muted-foreground hover:text-foreground"),children:"Decision"}),(0,n.jsx)("button",{type:"button",onClick:()=>l("blocker"),className:p("rounded-sm px-3 py-1 font-mono text-xs transition-colors","blocker"===o?"bg-danger/20 text-danger":"text-muted-foreground hover:text-foreground"),children:"Blocker"})]}),"decision"===o&&(0,n.jsx)("input",{type:"text",value:c,onChange:e=>d(e.target.value),placeholder:"Phase (e.g. 13-06)",className:"w-full rounded-sm border border-border bg-card px-3 py-1.5 font-mono text-xs text-foreground placeholder:text-muted-foreground focus:border-accent focus:outline-none"}),(0,n.jsx)("input",{type:"text",value:i,onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"!==e.key||x||j()},placeholder:"decision"===o?"Decision text...":"Blocker description...",className:"w-full rounded-sm border border-border bg-card px-3 py-1.5 font-mono text-xs text-foreground placeholder:text-muted-foreground focus:border-accent focus:outline-none"}),(0,n.jsx)("button",{type:"button",onClick:j,disabled:x||!i.trim(),className:p("rounded-sm px-3 py-1.5 font-mono text-xs font-semibold transition-colors","disabled:opacity-40 disabled:cursor-not-allowed","decision"===o?"bg-accent/20 text-accent hover:bg-accent/30":"bg-danger/20 text-danger hover:bg-danger/30"),children:x?"Saving...":"Add ".concat("decision"===o?"Decision":"Blocker")}),h&&(0,n.jsx)("p",{className:"text-xs text-danger",children:h}),g&&(0,n.jsx)("p",{className:"text-xs text-success",children:g})]})]})}function C(){var e;let{state:t}=o(),[s,r]=(0,a.useState)(!1),[l,c]=(0,a.useState)(null),[d,i]=(0,a.useState)(null),[u,x]=(0,a.useState)(0),m=(null!=(e=null==t?void 0:t.blockers)?e:[]).map(e=>({text:e.replace(/~~(.+)~~/,"$1").replace(/\s*RESOLVED.*$/i,"").trim(),resolved:e.includes("RESOLVED")||e.startsWith("~~")&&e.endsWith("~~")})),h=m.filter(e=>!e.resolved),f=m.filter(e=>e.resolved),g=(0,a.useCallback)(async e=>{c(e),i(null);try{if(!(await fetch("/api/state",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({field:"blockers",value:"~~".concat(e,"~~ RESOLVED")})})).ok)throw Error("Failed to resolve blocker");x(e=>e+1)}catch(e){i(e instanceof Error?e.message:"Failed to resolve blocker")}finally{c(null)}},[]),b=(0,a.useCallback)(()=>{x(e=>e+1)},[]);return(0,n.jsxs)("div",{className:"space-y-6",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("h2",{className:"font-mono text-lg font-semibold tracking-tight text-foreground",children:"Blockers"}),(0,n.jsx)("span",{className:p("font-mono text-xs",h.length>0?"text-danger":"text-success"),children:h.length>0?"".concat(h.length," active"):"No active blockers"})]}),d&&(0,n.jsx)("div",{className:"rounded-sm border border-danger/50 bg-danger/10 px-3 py-2 text-sm text-danger",children:d}),0===h.length?(0,n.jsx)("div",{className:"rounded-sm border border-success/30 bg-success/5 px-4 py-6 text-center",children:(0,n.jsx)("p",{className:"text-sm text-success",children:"No active blockers"})}):(0,n.jsx)("div",{className:"space-y-2",children:h.map(e=>(0,n.jsxs)("div",{className:"flex items-start gap-3 rounded-sm border border-border bg-card px-4 py-3",children:[(0,n.jsx)("span",{className:"mt-1 inline-block h-2 w-2 shrink-0 rounded-full bg-danger"}),(0,n.jsx)("div",{className:"flex-1",children:(0,n.jsx)("p",{className:"text-sm text-foreground",children:e.text})}),(0,n.jsx)("button",{type:"button",onClick:()=>g(e.text),disabled:l===e.text,className:p("shrink-0 rounded-sm px-3 py-1 font-mono text-xs transition-colors","bg-success/20 text-success hover:bg-success/30","disabled:opacity-40 disabled:cursor-not-allowed"),children:l===e.text?"...":"Resolve"})]},e.text))}),f.length>0&&(0,n.jsxs)("div",{className:"border-t border-border pt-4",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>r(!s),className:"flex w-full items-center gap-2 text-left",children:[(0,n.jsx)("svg",{className:p("h-3 w-3 text-muted-foreground transition-transform",s&&"rotate-90"),viewBox:"0 0 12 12",fill:"currentColor",children:(0,n.jsx)("path",{d:"M4 2l5 4-5 4z"})}),(0,n.jsxs)("span",{className:"font-mono text-xs text-muted-foreground",children:["Resolved (",f.length,")"]})]}),s&&(0,n.jsx)("div",{className:"mt-2 space-y-1",children:f.map(e=>(0,n.jsxs)("div",{className:"flex items-center gap-3 rounded-sm px-4 py-2",children:[(0,n.jsx)("span",{className:"inline-block h-2 w-2 shrink-0 rounded-full bg-muted"}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground line-through",children:e.text})]},e.text))})]}),(0,n.jsx)(k,{onEntryAdded:b})]},u)}function S(e){let{sidebar:t,children:s}=e;return(0,n.jsxs)("div",{className:"flex h-screen overflow-hidden",children:[(0,n.jsx)("div",{className:"hidden md:flex",children:t}),(0,n.jsx)("main",{className:"flex-1 overflow-y-auto p-6",children:s})]})}function E(e){var t,s,a,l;let{activeView:c,activePhaseId:d,onNavigate:i}=e,{roadmap:u,state:x,todos:m}=o(),{connected:h}=(0,r.h)(),f=(null!=(t=null==u?void 0:u.phases)?t:[]).map(e=>{var t;return{number:e.number,name:e.name,goal:null!=(t=e.goal)?t:"",dependsOn:e.depends_on?[e.depends_on]:[],planCount:e.plan_count,summaryCount:e.summary_count,diskStatus:e.disk_status,roadmapComplete:e.roadmap_complete,hasContext:e.has_context,hasResearch:e.has_research}}),g=null!=(s=null==u?void 0:u.current_phase)?s:null,b=null!=(a=null==x?void 0:x.blockers.filter(e=>!e.includes("RESOLVED")).length)?a:0,j=null!=(l=null==m?void 0:m.pending.length)?l:0;return(0,n.jsxs)("aside",{className:"flex h-full w-64 shrink-0 flex-col border-r border-border bg-card",children:[(0,n.jsx)("div",{className:"border-b border-border px-4 py-4",children:(0,n.jsxs)("button",{type:"button",onClick:()=>i("overview"),className:"flex flex-col gap-0.5 text-left",children:[(0,n.jsx)("span",{className:"font-mono text-lg font-bold tracking-tight text-foreground",children:"MAXSIM"}),(0,n.jsx)("span",{className:"font-mono text-[10px] text-muted-foreground",children:"Dashboard"})]})}),(0,n.jsxs)("div",{className:"flex-1 overflow-y-auto py-2",children:[(0,n.jsx)("div",{className:"px-3 pb-1",children:(0,n.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-widest text-muted-foreground",children:"Phases"})}),(0,n.jsx)("nav",{className:"flex flex-col gap-0.5 px-1",children:f.map(e=>{let t="phase"===c&&d===e.number,s=e.number===g;return(0,n.jsxs)("button",{type:"button",onClick:()=>i("phase",e.number),className:p("flex w-full items-center gap-2.5 rounded-sm px-3 py-1.5 text-left text-sm transition-colors",t?"border-l-2 border-l-accent bg-card-hover text-foreground":"border-l-2 border-l-transparent hover:bg-card-hover",s&&!t&&"border-l-accent-glow"),children:[(0,n.jsx)("span",{className:p("inline-block h-2 w-2 shrink-0 rounded-full",function(e){switch(e){case"complete":return"bg-success";case"partial":return"bg-accent";case"planned":return"bg-muted-foreground";default:return"bg-muted"}}(e.diskStatus))}),(0,n.jsx)("span",{className:p("font-mono text-xs font-semibold",s||t?"text-accent":"text-muted-foreground"),children:e.number}),(0,n.jsx)("span",{className:"truncate text-xs text-foreground",children:e.name})]},e.number)})})]}),(0,n.jsxs)("div",{className:"border-t border-border px-1 py-2",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>i("todos"),className:p("flex w-full items-center justify-between rounded-sm px-3 py-2 text-left text-sm transition-colors","todos"===c?"bg-card-hover text-foreground":"hover:bg-card-hover text-muted-foreground"),children:[(0,n.jsx)("span",{className:"font-mono text-xs uppercase tracking-wide",children:"Todos"}),j>0&&(0,n.jsx)("span",{className:"inline-flex h-5 min-w-5 items-center justify-center rounded-sm bg-warning/20 px-1 font-mono text-[10px] font-bold text-warning",children:j})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>i("blockers"),className:p("flex w-full items-center justify-between rounded-sm px-3 py-2 text-left text-sm transition-colors","blockers"===c?"bg-card-hover text-foreground":"hover:bg-card-hover text-muted-foreground"),children:[(0,n.jsx)("span",{className:"font-mono text-xs uppercase tracking-wide",children:"Blockers"}),b>0&&(0,n.jsx)("span",{className:"inline-flex h-5 min-w-5 items-center justify-center rounded-sm bg-danger/20 px-1 font-mono text-[10px] font-bold text-danger shadow-[0_0_6px_rgba(239,68,68,0.3)]",children:b})]})]}),(0,n.jsx)("div",{className:"border-t border-border px-4 py-3",children:(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:p("inline-block h-2 w-2 rounded-full",h?"bg-success":"bg-danger")}),(0,n.jsx)("span",{className:"font-mono text-[10px] text-muted-foreground",children:h?"Connected":"Disconnected"})]})})]})}function _(){return(0,n.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-4 border-b border-border pb-5",children:[(0,n.jsx)("div",{className:"h-3 w-40 animate-pulse rounded-sm bg-muted"}),(0,n.jsx)("div",{className:"h-2 w-full animate-pulse rounded-sm bg-muted"}),(0,n.jsxs)("div",{className:"flex gap-8",children:[(0,n.jsx)("div",{className:"h-8 w-20 animate-pulse rounded-sm bg-muted"}),(0,n.jsx)("div",{className:"h-8 w-32 animate-pulse rounded-sm bg-muted"}),(0,n.jsxs)("div",{className:"ml-auto flex gap-6",children:[(0,n.jsx)("div",{className:"h-6 w-24 animate-pulse rounded-sm bg-muted"}),(0,n.jsx)("div",{className:"h-6 w-20 animate-pulse rounded-sm bg-muted"})]})]})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,n.jsxs)("div",{className:"flex justify-between px-4",children:[(0,n.jsx)("div",{className:"h-3 w-16 animate-pulse rounded-sm bg-muted"}),(0,n.jsx)("div",{className:"h-3 w-6 animate-pulse rounded-sm bg-muted"})]}),Array.from({length:6}).map((e,t)=>(0,n.jsxs)("div",{className:"flex flex-col gap-2 px-4 py-3",children:[(0,n.jsxs)("div",{className:"flex gap-3",children:[(0,n.jsx)("div",{className:"h-4 w-4 animate-pulse rounded-full bg-muted"}),(0,n.jsx)("div",{className:"h-4 w-8 animate-pulse rounded-sm bg-muted"}),(0,n.jsx)("div",{className:"h-4 w-40 animate-pulse rounded-sm bg-muted"})]}),(0,n.jsx)("div",{className:"h-1.5 w-full animate-pulse rounded-sm bg-muted"})]},t))]})]})}function T(e){let{message:t,onRetry:s}=e;return(0,n.jsxs)("div",{className:"flex min-h-[50vh] flex-col items-center justify-center gap-4",children:[(0,n.jsx)("p",{className:"font-mono text-sm text-danger",children:t}),(0,n.jsx)("button",{type:"button",onClick:s,className:"rounded-sm bg-accent px-4 py-2 font-mono text-xs text-foreground transition-colors hover:bg-accent-glow",children:"Retry"})]})}function P(){var e,t;let{roadmap:s,state:r,todos:l,loading:d,error:i}=o(),[x,m]=(0,a.useState)("overview"),[p,h]=(0,a.useState)(null),f=(0,a.useCallback)((e,t)=>{m(e),"phase"===e&&t&&h(t)},[]),g=(0,a.useCallback)(e=>{m("phase"),h(e)},[]),b=(0,a.useCallback)(()=>{m("overview"),h(null)},[]),j=(null!=(e=null==s?void 0:s.phases)?e:[]).map(e=>{var t;return{number:e.number,name:e.name,goal:null!=(t=e.goal)?t:"",dependsOn:e.depends_on?[e.depends_on]:[],planCount:e.plan_count,summaryCount:e.summary_count,diskStatus:e.disk_status,roadmapComplete:e.roadmap_complete,hasContext:e.has_context,hasResearch:e.has_research}}),v=null!=(t=null==s?void 0:s.current_phase)?t:null;return(0,n.jsx)(S,{sidebar:(0,n.jsx)(E,{activeView:x,activePhaseId:p,onNavigate:f}),children:function(){if(d)return(0,n.jsx)(_,{});if(i)return(0,n.jsx)(T,{message:i,onRetry:()=>window.location.reload()});switch(x){case"overview":return(0,n.jsxs)("div",{className:"mx-auto flex max-w-4xl flex-col gap-6",children:[(0,n.jsx)(c,{roadmap:s,state:r,todos:l}),(0,n.jsx)(u,{phases:j,currentPhase:v,onPhaseClick:g})]});case"phase":return p?(0,n.jsx)("div",{className:"mx-auto max-w-4xl",children:(0,n.jsx)(w,{phaseId:p,onBack:b})}):null;case"todos":return(0,n.jsx)("div",{className:"mx-auto max-w-3xl",children:(0,n.jsx)(y,{})});case"blockers":return(0,n.jsx)("div",{className:"mx-auto max-w-3xl",children:(0,n.jsx)(C,{})});default:return null}}()})}},4934:(e,t,s)=>{"use strict";s.d(t,{WebSocketProvider:()=>o,h:()=>l});var n=s(206),a=s(1406);let r=(0,a.createContext)({connected:!1,lastChange:0});function o(e){let{children:t}=e,[s,o]=(0,a.useState)(!1),[l,c]=(0,a.useState)(0),d=(0,a.useRef)(null),i=(0,a.useRef)(null),u=(0,a.useRef)(2e3);return(0,a.useEffect)(()=>(!function e(){let t="https:"===window.location.protocol?"wss:":"ws:",s=new WebSocket("".concat(t,"//").concat(window.location.host,"/api/ws"));d.current=s,s.onopen=()=>{o(!0),u.current=2e3},s.onclose=()=>{o(!1),d.current=null;let t=u.current;u.current=Math.min(1.5*t,3e4),i.current=setTimeout(e,t)},s.onmessage=e=>{try{let t=JSON.parse(e.data);"file-changes"===t.type&&"number"==typeof t.timestamp&&c(t.timestamp)}catch(e){}},s.onerror=()=>{console.warn("[ws-provider] WebSocket error occurred")}}(),()=>{null!==i.current&&(clearTimeout(i.current),i.current=null),d.current&&(d.current.onclose=null,d.current.close(),d.current=null)}),[]),(0,n.jsx)(r.Provider,{value:{connected:s,lastChange:l},children:t})}function l(){return(0,a.useContext)(r)}}},e=>{e.O(0,[552,201,235,690,358],()=>e(e.s=4054)),_N_E=e.O()}]);