loki-mode 10.10.2 → 10.10.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 (81) hide show
  1. package/SKILL.md +2 -2
  2. package/VERSION +1 -1
  3. package/dashboard/__init__.py +1 -1
  4. package/docs/CLI-REFERENCE.md +1 -1
  5. package/docs/INSTALLATION.md +1 -1
  6. package/docs/v10/BOARD.md +8 -0
  7. package/docs/v10/DEPS.md +2 -0
  8. package/docs/v10/FAILURE-CLASSES.md +59 -16
  9. package/docs/v10/METRICS.md +9 -0
  10. package/docs/v10/PROGRESS.md +17 -0
  11. package/docs/v10/cp-redesign/PARITY.md +188 -0
  12. package/docs/v10/cp-redesign/legacy/INDEX.md +1167 -0
  13. package/loki-ts/dist/loki.js +631 -612
  14. package/mcp/__init__.py +1 -1
  15. package/package.json +1 -1
  16. package/packages/control-plane/dist/server.js +433 -340
  17. package/packages/control-plane/src/server/diffstat.ts +77 -0
  18. package/packages/control-plane/src/server/repos.ts +5 -2
  19. package/packages/control-plane/src/server/routes/index.ts +1 -1
  20. package/packages/control-plane/src/server/runs.ts +3 -1
  21. package/packages/control-plane/ui/dist/assets/index-D27veKDf.js +152 -0
  22. package/packages/control-plane/ui/dist/index.html +1 -1
  23. package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
  24. package/web-app/dist/assets/{AdminPage-BvbxMtZO.js → AdminPage-qj6cyTT6.js} +1 -1
  25. package/web-app/dist/assets/{Avatar-Dc7Scg02.js → Avatar-Dg4WrYYd.js} +1 -1
  26. package/web-app/dist/assets/{Badge-BmVuOqbM.js → Badge-DHiwSg-p.js} +1 -1
  27. package/web-app/dist/assets/{Button-DvzqhxRU.js → Button-gi8XEzIU.js} +1 -1
  28. package/web-app/dist/assets/{CockpitPage-D8AZo7Ha.js → CockpitPage-B1QNjPBn.js} +1 -1
  29. package/web-app/dist/assets/{ComparePage-NmqaTXDz.js → ComparePage-DW-oUaDu.js} +1 -1
  30. package/web-app/dist/assets/{ErrorBoundary-PGl8Kzoq.js → ErrorBoundary-BK5zjqn-.js} +1 -1
  31. package/web-app/dist/assets/{EvidenceReceiptPanel-2NY4n9gv.js → EvidenceReceiptPanel-F58cuFm9.js} +1 -1
  32. package/web-app/dist/assets/{GitHubIssuesPanel-DBO_LHHM.js → GitHubIssuesPanel-QVyvF19M.js} +1 -1
  33. package/web-app/dist/assets/{GitHubPRsPanel-K7m9uJ1N.js → GitHubPRsPanel-BRFHMzwy.js} +1 -1
  34. package/web-app/dist/assets/{HomePage-qNQzAJxM.js → HomePage-Cpskd4yM.js} +2 -2
  35. package/web-app/dist/assets/{LoginPage-esu3OK65.js → LoginPage-CteYWi5M.js} +1 -1
  36. package/web-app/dist/assets/{MagicPage-CCdVvXrA.js → MagicPage-CCLor0AU.js} +1 -1
  37. package/web-app/dist/assets/{MetricsPage-bEvugU2t.js → MetricsPage-WgsOaLoq.js} +1 -1
  38. package/web-app/dist/assets/{NotFoundPage-BlEjQ1wX.js → NotFoundPage-DXSCr9P6.js} +1 -1
  39. package/web-app/dist/assets/{ProjectPage-Bnug_Yzv.js → ProjectPage-sR0kaaXV.js} +3 -3
  40. package/web-app/dist/assets/{ProjectsPage-M8r1vfpn.js → ProjectsPage-J3TNS42-.js} +1 -1
  41. package/web-app/dist/assets/{SettingsPage-NqAJpB48.js → SettingsPage-Cil5837P.js} +1 -1
  42. package/web-app/dist/assets/{ShowcasePage-8FggxL1P.js → ShowcasePage-C3_oWYJa.js} +1 -1
  43. package/web-app/dist/assets/{SystemSettingsPage-3Sz3kFOO.js → SystemSettingsPage-Sddw1fFS.js} +1 -1
  44. package/web-app/dist/assets/{TeamsPage-nV-6vdWM.js → TeamsPage-B0poySCt.js} +1 -1
  45. package/web-app/dist/assets/{TemplatesPage-Brbc_VR9.js → TemplatesPage-pcYSxHam.js} +1 -1
  46. package/web-app/dist/assets/{TerminalOutput-D1yta5ac.js → TerminalOutput-CRWTZM7F.js} +1 -1
  47. package/web-app/dist/assets/{activity-oEeKuqFe.js → activity-D3aR95zO.js} +1 -1
  48. package/web-app/dist/assets/{bell-3NJtqBRR.js → bell-WdWaPIBo.js} +1 -1
  49. package/web-app/dist/assets/{bot-CuvJZ6x1.js → bot-CzD3xokc.js} +1 -1
  50. package/web-app/dist/assets/{check-n4289IZw.js → check-DMYJiYcm.js} +1 -1
  51. package/web-app/dist/assets/{chevron-left-CmQeio7h.js → chevron-left-DY0FSKvI.js} +1 -1
  52. package/web-app/dist/assets/{circle-alert-CmmVW-Pd.js → circle-alert-DVPtG3Pe.js} +1 -1
  53. package/web-app/dist/assets/{clock-QFqk7GlA.js → clock-BjjLL6uI.js} +1 -1
  54. package/web-app/dist/assets/{cloud-BNkSokmq.js → cloud-CnUCVZhm.js} +1 -1
  55. package/web-app/dist/assets/{code-xml-nWeketqj.js → code-xml-BPoxcFNK.js} +1 -1
  56. package/web-app/dist/assets/{database-C83MXTmJ.js → database-ClVgDBYt.js} +1 -1
  57. package/web-app/dist/assets/{dollar-sign-Blg6TO4y.js → dollar-sign-Ui4BIml8.js} +1 -1
  58. package/web-app/dist/assets/{file-code-corner-Tk11oUzm.js → file-code-corner-BNYl7J1Z.js} +1 -1
  59. package/web-app/dist/assets/{file-plus-DF_eyA6I.js → file-plus-BxkSyRVn.js} +1 -1
  60. package/web-app/dist/assets/{globe-D5hDqqmn.js → globe-b2poyDKT.js} +1 -1
  61. package/web-app/dist/assets/{hammer-C2hm9lzl.js → hammer-D_0BUpBG.js} +1 -1
  62. package/web-app/dist/assets/{index-pMxOIwXq.js → index-D8TYtITk.js} +3 -3
  63. package/web-app/dist/assets/{layers-XWQKGXg0.js → layers-Co1szEIf.js} +1 -1
  64. package/web-app/dist/assets/{loader-circle-BRuvorm2.js → loader-circle-DylW-nwq.js} +1 -1
  65. package/web-app/dist/assets/{lock-BSGvQf5v.js → lock-D7aFdKw7.js} +1 -1
  66. package/web-app/dist/assets/{package-3FJYUYgJ.js → package-ElSsRKiN.js} +1 -1
  67. package/web-app/dist/assets/{plus-CeIx6g9P.js → plus-CVWgRxDX.js} +1 -1
  68. package/web-app/dist/assets/{refresh-cw-ChutW42g.js → refresh-cw-B2azSZHT.js} +1 -1
  69. package/web-app/dist/assets/{rotate-ccw-BdSjUAk-.js → rotate-ccw-BdQHOrf0.js} +1 -1
  70. package/web-app/dist/assets/{scroll-text-BjFqxpw3.js → scroll-text-9m-YKf83.js} +1 -1
  71. package/web-app/dist/assets/{server-C7UEKdol.js → server-BYq99Fe1.js} +1 -1
  72. package/web-app/dist/assets/{shield-alert-DY8fpEs7.js → shield-alert-BNCiHXhR.js} +1 -1
  73. package/web-app/dist/assets/{thumbs-up-Cz1san1g.js → thumbs-up-BB_EJkat.js} +1 -1
  74. package/web-app/dist/assets/{trash-2-D2MvGYeP.js → trash-2-BMF4kFvy.js} +1 -1
  75. package/web-app/dist/assets/{trending-down-CxO3OYOB.js → trending-down-BiqiTPXx.js} +1 -1
  76. package/web-app/dist/assets/{trending-up-DCHKPJLe.js → trending-up-Bq6qyKub.js} +1 -1
  77. package/web-app/dist/assets/{upload-CdPJpSHC.js → upload-1HzIJHHR.js} +1 -1
  78. package/web-app/dist/assets/{usePolling-DAH6K3ST.js → usePolling-FNwpjURt.js} +1 -1
  79. package/web-app/dist/assets/{user-Byyt01W4.js → user-DrORfQv3.js} +1 -1
  80. package/web-app/dist/index.html +1 -1
  81. package/packages/control-plane/ui/dist/assets/index-BrA22FUs.js +0 -152
@@ -1,4 +1,4 @@
1
- import{c as je,j as e,P as Ke,r as a,a as g,C as Ze,M as ve,R as de,S as Je,u as ye,b as Xe,U as et,d as tt}from"./index-pMxOIwXq.js";import{u as R}from"./usePolling-DAH6K3ST.js";import{P as st,S as rt,E as C}from"./ErrorBoundary-PGl8Kzoq.js";import{F as at,T as nt}from"./TerminalOutput-D1yta5ac.js";import{E as lt}from"./EvidenceReceiptPanel-2NY4n9gv.js";import{B as it}from"./Badge-BmVuOqbM.js";import{P as ot}from"./package-3FJYUYgJ.js";import{C as ct}from"./cloud-BNkSokmq.js";import{C as Ne}from"./code-xml-nWeketqj.js";import{H as dt}from"./hammer-C2hm9lzl.js";import{L as xt}from"./layers-XWQKGXg0.js";import{B as mt}from"./bell-3NJtqBRR.js";import{F as ut}from"./file-code-corner-Tk11oUzm.js";import"./lock-BSGvQf5v.js";import"./clock-QFqk7GlA.js";import"./circle-alert-CmmVW-Pd.js";import"./check-n4289IZw.js";/**
1
+ import{c as je,j as e,P as Ke,r as a,a as g,C as Ze,M as ve,R as de,S as Je,u as ye,b as Xe,U as et,d as tt}from"./index-D8TYtITk.js";import{u as R}from"./usePolling-FNwpjURt.js";import{P as st,S as rt,E as C}from"./ErrorBoundary-BK5zjqn-.js";import{F as at,T as nt}from"./TerminalOutput-CRWTZM7F.js";import{E as lt}from"./EvidenceReceiptPanel-F58cuFm9.js";import{B as it}from"./Badge-DHiwSg-p.js";import{P as ot}from"./package-ElSsRKiN.js";import{C as ct}from"./cloud-CnUCVZhm.js";import{C as Ne}from"./code-xml-BPoxcFNK.js";import{H as dt}from"./hammer-D_0BUpBG.js";import{L as xt}from"./layers-Co1szEIf.js";import{B as mt}from"./bell-WdWaPIBo.js";import{F as ut}from"./file-code-corner-BNYl7J1Z.js";import"./lock-D7aFdKw7.js";import"./clock-BjjLL6uI.js";import"./circle-alert-DVPtG3Pe.js";import"./check-DMYJiYcm.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -8,5 +8,5 @@ import{c as je,j as e,P as Ke,r as a,a as g,C as Ze,M as ve,R as de,S as Je,u as
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const ft=[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]],bt=je("party-popper",ft);function gt(t){if(t<60)return`${Math.round(t)}s`;if(t<3600)return`${Math.floor(t/60)}m ${Math.round(t%60)}s`;const r=Math.floor(t/3600),s=Math.floor(t%3600/60);return`${r}h ${s}m`}function jt({status:t,prdSummary:r,onStop:s,onPause:l,onResume:n,isPaused:i}){const o=i??(t==null?void 0:t.paused)??!1;return e.jsxs("div",{className:"card px-5 py-3 flex items-center gap-6 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium",children:"Phase"}),e.jsx("span",{className:"font-mono font-semibold text-ink",children:(t==null?void 0:t.phase)||"--"})]}),e.jsx("div",{className:"w-px h-5 bg-border"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium",children:"Complexity"}),e.jsx("span",{className:`font-mono font-semibold ${(t==null?void 0:t.complexity)==="complex"?"text-warning":(t==null?void 0:t.complexity)==="simple"?"text-success":"text-ink"}`,children:(t==null?void 0:t.complexity)||"--"})]}),e.jsx("div",{className:"w-px h-5 bg-border"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium",children:"Tasks"}),e.jsx("span",{className:"font-mono text-ink",children:t!=null&&t.current_task?e.jsx("span",{className:"text-xs",children:t.current_task}):e.jsx("span",{className:"text-muted",children:"--"})}),((t==null?void 0:t.pending_tasks)??0)>0&&e.jsxs("span",{className:"text-xs text-primary font-mono",children:["+",t==null?void 0:t.pending_tasks," pending"]})]}),r&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-5 bg-border"}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium flex-shrink-0",children:"Building"}),e.jsx("span",{className:"text-xs font-mono text-ink truncate max-w-[220px]",title:r,children:r.length>60?r.slice(0,60)+"...":r})]})]}),e.jsx("div",{className:"flex-1"}),typeof(t==null?void 0:t.uptime)=="number"&&t.uptime>0&&e.jsx("span",{className:"font-mono text-xs text-muted",children:gt(t.uptime)}),(l||n)&&e.jsxs("button",{onClick:o?n:l,className:"flex items-center gap-1.5 px-4 py-1.5 rounded-btn text-xs font-semibold border border-warning/30 text-warning hover:bg-warning/10 transition-colors",children:[o?e.jsx(Ke,{size:14}):e.jsx(st,{size:14}),o?"Resume":"Pause"]}),s&&e.jsxs("button",{onClick:s,className:"flex items-center gap-1.5 px-4 py-1.5 rounded-btn text-xs font-semibold bg-danger/10 text-danger border border-danger/20 hover:bg-danger/20 transition-colors",children:[e.jsx(rt,{size:14}),"Stop"]})]})}const ae=t=>typeof t=="number"?t.toString():"--";function vt({status:t}){const r=[{label:"Iteration",value:ae(t==null?void 0:t.iteration),color:"text-primary"},{label:"Agents",value:ae(t==null?void 0:t.running_agents),color:((t==null?void 0:t.running_agents)??0)>0?"text-success":"text-muted"},{label:"Pending",value:ae(t==null?void 0:t.pending_tasks),color:((t==null?void 0:t.pending_tasks)??0)>0?"text-warning":"text-muted"},{label:"Provider",value:(t==null?void 0:t.provider)||"--",color:"text-primary"}];return e.jsx("div",{className:"grid grid-cols-4 gap-3",children:r.map(s=>e.jsxs("div",{className:"card p-4 text-center",children:[e.jsx("div",{className:`text-2xl font-bold font-mono ${s.color}`,children:s.value}),e.jsx("div",{className:"text-xs text-muted font-medium mt-1 uppercase tracking-wider",children:s.label})]},s.label))})}const ne=t=>t==null||t===""?"--":t;function yt({plan:t,error:r,loading:s,onConfirm:l,onCancel:n}){var o;const i=e.jsxs("div",{className:"flex gap-3 justify-end",children:[e.jsx("button",{onClick:n,className:"px-4 py-2 text-sm font-medium text-muted hover:text-ink transition-colors",children:"Cancel"}),e.jsx("button",{onClick:l,className:"px-5 py-2 rounded-card text-sm font-semibold bg-primary text-white hover:bg-primary/90 transition-all shadow-button",children:"Start Build"})]});return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-sm",children:e.jsxs("div",{className:"card w-full max-w-lg mx-4 p-6 rounded-card shadow-card-hover",children:[e.jsx("h2",{className:"text-lg font-bold text-ink mb-4",children:"Build Estimate"}),s?e.jsxs("div",{className:"flex flex-col items-center py-8 gap-3",children:[e.jsx("div",{className:"w-8 h-8 border-2 border-primary border-t-transparent rounded-full animate-spin"}),e.jsx("p",{className:"text-sm text-muted",children:"Analyzing spec..."}),e.jsxs("div",{className:"flex gap-3 mt-4",children:[e.jsx("button",{onClick:n,className:"px-4 py-2 text-sm font-medium text-muted hover:text-ink transition-colors",children:"Cancel"}),e.jsx("button",{onClick:l,className:"px-4 py-2 text-sm font-medium text-primary hover:text-primary/80 transition-colors underline",children:"Skip analysis, build now"})]})]}):r?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4 px-3 py-2 rounded-btn bg-danger/10 border border-danger/20 text-danger text-xs",children:["Could not run loki plan: ",r]}),i]}):t?e.jsxs(e.Fragment,{children:[t.returncode!==0&&e.jsxs("div",{className:"mb-4 px-3 py-2 rounded-btn bg-warning/10 border border-warning/20 text-warning text-xs",children:["loki plan exited with code ",t.returncode," - showing partial results"]}),t.parsed===!1&&e.jsx("div",{className:"mb-4 px-3 py-2 rounded-btn bg-warning/10 border border-warning/20 text-warning text-xs",children:t.output_text?"The estimate could not be parsed from loki plan output. Raw output is shown below.":"The estimate could not be parsed: loki plan produced no output."}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 mb-4",children:[e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Complexity"}),e.jsx("div",{className:"text-base font-bold text-ink capitalize",children:ne(t.complexity)})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Est. Cost"}),e.jsx("div",{className:"text-base font-bold text-ink",children:ne(t.cost_estimate)})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Iterations"}),e.jsx("div",{className:"text-base font-bold text-ink",children:ne(t.iterations)})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Phases"}),e.jsx("div",{className:"text-xs text-ink capitalize",children:(o=t.phases)!=null&&o.length?t.phases.join(", "):"--"})]})]}),t.output_text&&e.jsxs("details",{className:"mb-4",open:t.parsed===!1,children:[e.jsx("summary",{className:"text-xs text-muted cursor-pointer hover:text-ink transition-colors",children:"Raw output"}),e.jsx("pre",{className:"mt-2 text-xs font-mono text-muted-accessible bg-black/5 rounded-card p-3 overflow-auto max-h-40 whitespace-pre-wrap",children:t.output_text})]}),i]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-sm text-muted py-4",children:"No plan data available."}),i]})]})})}function Nt({onSubmit:t,running:r,error:s,provider:l,onProviderChange:n,initialPrd:i}){const[o,d]=a.useState(""),[x,m]=a.useState(""),[u,y]=a.useState("claude"),[p,j]=a.useState(""),v=l??u,[w,A]=a.useState(!1),[N,k]=a.useState([]),[h,M]=a.useState(!1),[P,W]=a.useState(null),[_,z]=a.useState(!1),[I,D]=a.useState(!1),[U,E]=a.useState(null),[F,$]=a.useState(!1),[V,H]=a.useState(null),[X,q]=a.useState(!1);a.useEffect(()=>{g.getTemplates().then(f=>{k(f),M(!1)}).catch(()=>{k([]),M(!0)})},[]),a.useEffect(()=>{i&&d(i)},[i]),a.useEffect(()=>{if(i)return;const f=localStorage.getItem("loki-prd-draft");f&&d(f),g.getPrdPrefill().then(({content:S})=>{S&&d(S)}).catch(()=>{})},[i]),a.useEffect(()=>{o.trim()?localStorage.setItem("loki-prd-draft",o):localStorage.removeItem("loki-prd-draft")},[o]);const Q=a.useCallback(async(f,S)=>{A(!1);try{const B=await g.getTemplateContent(f);d(B.content),m(S),W(null)}catch(B){W(`Could not load template "${S}": ${B instanceof Error?B.message:"request failed"}`)}},[]),G=async()=>{if(!(!o.trim()||F)){$(!0),E(null),H(null),q(!0);try{const f=await g.planSession(o,v);E(f)}catch(f){H(f instanceof Error?f.message:"request failed")}finally{$(!1)}}},Y=async()=>{if(!(!o.trim()||r||_)){q(!1),z(!0);try{await t(o,v,p.trim()||void 0,I?"quick":void 0)}finally{z(!1)}}};return e.jsxs(e.Fragment,{children:[X&&e.jsx(yt,{plan:U,error:V,loading:F,onConfirm:Y,onCancel:()=>q(!1)}),e.jsxs("div",{className:"card p-6 flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Product Requirements"}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:()=>A(!w),className:"text-xs font-medium px-3 py-1.5 rounded-card border border-primary/20 text-primary hover:bg-primary/5 transition-colors",children:x||"Templates"}),w&&e.jsx("div",{className:"absolute right-0 top-full mt-1 w-56 card rounded-card overflow-hidden z-20 shadow-card-hover",children:e.jsxs("div",{className:"py-1 max-h-64 overflow-y-auto terminal-scroll",children:[h&&e.jsx("div",{className:"px-3 py-2 text-xs text-warning border-b border-warning/10",children:"Could not load templates from server. Check that the backend is running."}),!h&&N.length===0&&e.jsx("div",{className:"px-3 py-2 text-xs text-muted",children:"Loading..."}),N.map(f=>e.jsx("button",{onClick:()=>Q(f.filename,f.name),className:"w-full text-left px-3 py-2 text-sm text-ink hover:bg-primary/5 transition-colors",children:f.name},f.filename))]})})]})})]}),e.jsx("textarea",{value:o,onChange:f=>d(f.target.value),placeholder:"Paste your spec or PRD here, or select a template above to get started...",className:"flex-1 min-h-[280px] w-full bg-card rounded-card border border-border-light px-4 py-3 text-sm font-mono text-ink placeholder:text-primary/60 resize-none focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary/30 transition-all",spellCheck:!1}),e.jsxs("div",{className:"mt-3",children:[e.jsx("label",{className:"block text-xs text-muted font-medium mb-1 uppercase tracking-wider",children:"Project Directory"}),e.jsx("input",{type:"text",value:p,onChange:f=>j(f.target.value),placeholder:"Leave blank to auto-create, or type a path (e.g. /Users/you/my-project)",className:"w-full bg-card rounded-card border border-border-light px-4 py-2 text-sm font-mono text-ink placeholder:text-primary/60/70 focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary/30 transition-all",spellCheck:!1}),e.jsx("p",{className:"text-xs text-muted-accessible mt-1",children:"Type a path or leave blank to auto-create under ~/purple-lab-projects/"})]}),P&&e.jsx("div",{className:"mt-3 px-3 py-2 rounded-btn bg-danger/10 border border-danger/20 text-danger text-xs font-medium",children:P}),s&&e.jsx("div",{className:"mt-3 px-3 py-2 rounded-btn bg-danger/10 border border-danger/20 text-danger text-xs font-medium",children:s}),e.jsxs("div",{className:"flex items-center gap-3 mt-4",children:[e.jsxs("button",{onClick:()=>D(!I),title:"Quick Mode: 3 iterations max, faster builds",className:`flex items-center gap-1.5 px-3 py-1.5 rounded-card text-xs font-semibold border transition-all ${I?"bg-primary/10 border-primary/30 text-primary":"border-border-light text-muted hover:text-ink hover:bg-card"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${I?"bg-primary":"bg-muted/40"}`}),"Quick"]}),e.jsx("div",{className:"flex-1"}),e.jsxs("span",{className:"text-xs text-muted font-mono",children:[o.length.toLocaleString()," chars"]}),e.jsx("button",{onClick:G,disabled:!o.trim()||r||_||F,className:`px-6 py-2.5 rounded-card text-sm font-semibold transition-all ${!o.trim()||r||_||F?"bg-primary/10 text-muted cursor-not-allowed":"bg-primary text-white hover:bg-primary/90 shadow-button"}`,children:F?"Analyzing...":_?"Starting...":r?"Building...":"Start Build"})]})]})]})}const O=[{key:"reason",label:"Reason",description:"Analyzing task, planning approach"},{key:"act",label:"Act",description:"Implementing changes, writing code"},{key:"reflect",label:"Reflect",description:"Reviewing output, self-critique"},{key:"verify",label:"Verify",description:"Testing, validation, quality gates"}];function wt(t){if(!t)return"reason";const r=t.toLowerCase();return r.includes("reason")||r.includes("plan")?"reason":r.includes("act")||r.includes("implement")||r.includes("code")?"act":r.includes("reflect")||r.includes("review")?"reflect":r.includes("verify")||r.includes("test")||r.includes("check")?"verify":"idle"}function kt({currentPhase:t,iteration:r}){const s=wt(t),l=typeof r=="number"?r:"--";return e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"RARV Cycle"}),e.jsxs("span",{className:"font-mono text-xs text-muted",children:["Iteration ",l]})]}),e.jsx("div",{className:"flex items-center justify-center mb-5",children:e.jsxs("svg",{viewBox:"0 0 120 120",className:"w-28 h-28",children:[O.map((n,i)=>{const o=n.key===s,d=s!=="idle"&&O.findIndex(y=>y.key===s)>i,x=(i*90-90)*(Math.PI/180),m=60+40*Math.cos(x),u=60+40*Math.sin(x);return e.jsxs("g",{children:[i<O.length-1&&e.jsx("line",{x1:m,y1:u,x2:60+40*Math.cos(((i+1)*90-90)*(Math.PI/180)),y2:60+40*Math.sin(((i+1)*90-90)*(Math.PI/180)),stroke:d?"#553DE9":"#ECEAE3",strokeWidth:d?2:1,strokeDasharray:d?"none":"4 3"}),i===O.length-1&&e.jsx("line",{x1:m,y1:u,x2:60+40*Math.cos(-90*(Math.PI/180)),y2:60+40*Math.sin(-90*(Math.PI/180)),stroke:"#ECEAE3",strokeWidth:1,strokeDasharray:"4 3"}),e.jsx("circle",{cx:m,cy:u,r:o?14:10,fill:o||d?"#553DE9":"#E8E4FD",stroke:o?"#4432c4":d?"#553DE9":"#ECEAE3",strokeWidth:o?3:1.5,className:o?"phase-active":""}),e.jsx("text",{x:m,y:u+(i===0?-20:i===2?24:0),textAnchor:"middle",className:"text-[9px] font-semibold fill-ink",dx:i===1?22:i===3?-22:0,children:n.label[0]})]},n.key)}),e.jsx("text",{x:"60",y:"64",textAnchor:"middle",className:"text-lg font-bold font-mono fill-primary",children:l})]})}),e.jsx("div",{className:"space-y-2",children:O.map(n=>{const i=n.key===s;return e.jsxs("div",{className:`flex items-center gap-3 px-3 py-2 rounded-card transition-all duration-200 ${i?"bg-primary/8 border border-primary/20":"opacity-50"}`,children:[e.jsx("div",{className:`w-2.5 h-2.5 rounded-full flex-shrink-0 ${i?"bg-primary phase-active":"bg-border"}`}),e.jsxs("div",{children:[e.jsx("span",{className:`text-sm font-semibold ${i?"text-primary":"text-muted"}`,children:n.label}),i&&e.jsx("p",{className:"text-xs text-muted mt-0.5",children:n.description})]})]},n.key)})})]})}const le={architect:"bg-primary/10 text-primary border-primary/20",developer:"bg-primary/10 text-primary border-primary/20",tester:"bg-success/10 text-success border-success/20",reviewer:"bg-warning/10 text-warning border-warning/20",planner:"bg-primary/60/20 text-ink border-primary/60/30",default:"bg-border/30 text-muted border-border/50"};function Et(t){if(!t)return le.default;const r=t.toLowerCase();for(const[s,l]of Object.entries(le))if(r.includes(s))return l;return le.default}function St({agents:t,loading:r}){const s=(t==null?void 0:t.filter(n=>n.alive))||[],l=(t==null?void 0:t.filter(n=>!n.alive))||[];return e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Agents"}),e.jsxs("span",{className:"font-mono text-xs text-muted",children:[s.length," active"]})]}),r&&!t&&e.jsx("div",{className:"text-center py-8 text-muted text-sm",children:"Loading agents..."}),!r&&(t==null?void 0:t.length)===0&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted text-sm",children:"No agents running"}),e.jsx("p",{className:"text-primary/60 text-xs mt-1",children:"Start a build to spawn agents"})]}),s.length>0&&e.jsx("div",{className:"space-y-2 mb-4",children:s.map(n=>e.jsx(he,{agent:n},n.id))}),l.length>0&&e.jsxs("details",{className:"mt-3",children:[e.jsxs("summary",{className:"text-xs text-muted cursor-pointer hover:text-ink transition-colors",children:[l.length," completed"]}),e.jsx("div",{className:"space-y-1.5 mt-2",children:l.slice(0,10).map(n=>e.jsx(he,{agent:n,compact:!0},n.id))})]})]})}function he({agent:t,compact:r}){const s=Et(t.type||t.name||"");return r?e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded-btn bg-hover text-xs",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-muted/30"}),e.jsx("span",{className:"font-medium text-muted truncate",children:t.name||t.id}),e.jsx("span",{className:"text-primary/60 ml-auto",children:t.type})]}):e.jsxs("div",{className:`flex items-start gap-3 px-3 py-2.5 rounded-card border ${s}`,children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${t.alive?"bg-success phase-active":"bg-muted/30"}`})}),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-semibold truncate",children:t.name||t.id}),t.type&&e.jsx("span",{className:"text-xs font-mono font-medium opacity-70",children:t.type})]}),t.task&&e.jsx("p",{className:"text-xs opacity-70 mt-0.5 truncate",children:t.task}),t.status&&t.status!=="unknown"&&e.jsx("span",{className:"inline-block text-xs font-mono mt-1 opacity-60",children:t.status})]}),t.pid&&e.jsxs("span",{className:"text-xs font-mono text-muted-accessible flex-shrink-0",children:["PID ",t.pid]})]})}function Ct({text:t,position:r="top",size:s=14}){const[l,n]=a.useState(!1),i=a.useRef(null);a.useEffect(()=>{if(!l)return;const x=m=>{i.current&&!i.current.contains(m.target)&&n(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[l]);const o={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"},d={top:"top-full left-1/2 -translate-x-1/2 border-t-[#1A1A1E] dark:border-t-card border-l-transparent border-r-transparent border-b-transparent border-4",bottom:"bottom-full left-1/2 -translate-x-1/2 border-b-[#1A1A1E] dark:border-b-card border-l-transparent border-r-transparent border-t-transparent border-4",left:"left-full top-1/2 -translate-y-1/2 border-l-[#1A1A1E] dark:border-l-card border-t-transparent border-b-transparent border-r-transparent border-4",right:"right-full top-1/2 -translate-y-1/2 border-r-[#1A1A1E] dark:border-r-card border-t-transparent border-b-transparent border-l-transparent border-4"};return e.jsxs("div",{className:"relative inline-flex items-center",ref:i,children:[e.jsx("button",{onClick:()=>n(!l),onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),className:"text-muted/50 hover:text-primary transition-colors p-0.5 rounded-full","aria-label":"Help",type:"button",children:e.jsx(Ze,{size:s})}),l&&e.jsx("div",{className:`absolute z-50 ${o[r]}`,role:"tooltip",children:e.jsxs("div",{className:"relative bg-[#1A1A1E] text-white px-3 py-2 rounded-lg shadow-lg max-w-[240px]",children:[e.jsx("p",{className:"text-[11px] leading-relaxed",children:t}),e.jsx("span",{className:`absolute ${d[r]}`})]})})]})}const At={qualityGates:"Automated checks ensuring your code meets quality standards. Includes static analysis, test coverage, and security scanning."},Pt={pass:{badge:"bg-success/10 text-success border-success/20",dot:"bg-success",label:"Pass"},fail:{badge:"bg-danger/10 text-danger border-danger/20",dot:"bg-danger",label:"Fail"},skip:{badge:"bg-muted/10 text-muted border-muted/20",dot:"bg-muted/40",label:"Skip"},pending:{badge:"bg-warning/10 text-warning border-warning/20",dot:"bg-warning",label:"Pending"}};function Dt({item:t}){const[r,s]=a.useState(!1),l=Pt[t.status];return e.jsxs("div",{className:`border rounded-card overflow-hidden ${l.badge}`,children:[e.jsxs("button",{type:"button",className:"w-full flex items-center gap-3 px-3 py-2.5 text-left",onClick:()=>t.details&&s(!r),children:[e.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${l.dot}`}),e.jsx("span",{className:"text-sm font-medium flex-1 truncate",children:t.label}),e.jsx("span",{className:"text-xs font-mono font-semibold uppercase tracking-wider flex-shrink-0",children:l.label}),t.details&&e.jsx("span",{className:"text-xs text-muted/60 flex-shrink-0",children:r?"v":">"})]}),r&&t.details&&e.jsx("div",{className:"px-3 pb-2.5 pt-0",children:e.jsx("p",{className:"text-xs font-mono opacity-70 leading-relaxed",children:t.details})})]})}function Ft({checklist:t,loading:r}){const s=t&&Array.isArray(t.items)&&t.items.length>0?t:null,l=s&&s.total>0?s.passed/s.total*100:0;return e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Quality Gates"}),e.jsx(Ct,{text:At.qualityGates,position:"right",size:13})]}),s&&e.jsxs("span",{className:"font-mono text-xs text-muted",children:[s.passed,"/",s.total," passed"]})]}),r&&!s&&e.jsx("div",{className:"text-center py-8 text-muted text-sm",children:"Loading gates..."}),!r&&!s&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted text-sm",children:"No quality gate data"}),e.jsx("p",{className:"text-primary/60 text-xs mt-1",children:"Gates run during verification phase"})]}),s&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-4 mb-3 text-xs",children:[e.jsxs("span",{className:"text-success font-medium",children:[s.passed," passed"]}),s.failed>0&&e.jsxs("span",{className:"text-danger font-medium",children:[s.failed," failed"]}),s.skipped>0&&e.jsxs("span",{className:"text-muted",children:[s.skipped," skipped"]}),s.pending>0&&e.jsxs("span",{className:"text-warning",children:[s.pending," pending"]})]}),e.jsx("div",{className:"w-full h-2 bg-charcoal/10 rounded-full overflow-hidden mb-4",children:e.jsx("div",{className:"h-full bg-success rounded-full transition-all duration-500",style:{width:`${l}%`}})}),e.jsx("div",{className:"space-y-2 max-h-[400px] overflow-y-auto terminal-scroll",children:s.items.map(n=>e.jsx(Dt,{item:n},n.id))})]})]})}const Lt={".py":"bg-success",".ts":"bg-primary",".tsx":"bg-primary",".md":"bg-warning",".sh":"bg-primary"};function Mt(t){const r=t.substring(t.lastIndexOf("."));return Lt[r]||"bg-muted"}function Bt(t){return t==null?"":t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(1)}KB`:`${(t/(1024*1024)).toFixed(1)}MB`}const ie=100;function we({node:t,depth:r,onSelectFile:s,selectedPath:l}){const[n,i]=a.useState(!1),[o,d]=a.useState(ie),x=t.type==="directory",m=t.path===l,u=x&&n?t.children??[]:[],y=u.length>o;return e.jsxs("div",{children:[e.jsxs("button",{type:"button",className:`w-full flex items-center gap-2 px-2 py-1 rounded-btn text-left text-sm transition-colors hover:bg-hover ${m?"bg-primary/10 text-primary":"text-ink"}`,style:{paddingLeft:`${r*16+8}px`},onClick:()=>{x?(i(!n),n&&d(ie)):s(t.path)},children:[x?e.jsx("span",{className:"font-mono text-xs text-muted w-3 flex-shrink-0",children:n?"v":">"}):e.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${Mt(t.name)}`}),e.jsx("span",{className:`truncate ${x?"font-medium":"font-mono text-xs"}`,children:t.name}),!x&&t.size!==void 0&&e.jsx("span",{className:"ml-auto text-xs font-mono text-muted-accessible flex-shrink-0",children:Bt(t.size)})]}),u.length>0&&e.jsxs("div",{children:[u.slice(0,o).map(p=>e.jsx(we,{node:p,depth:r+1,onSelectFile:s,selectedPath:l},p.path)),y&&e.jsxs("button",{type:"button",className:"w-full text-left text-xs text-primary hover:text-primary/80 py-1 transition-colors",style:{paddingLeft:`${(r+1)*16+8}px`},onClick:()=>d(p=>p+ie),children:["Show more (",u.length-o," remaining)"]})]})]})}function Tt({files:t,loading:r}){const[s,l]=a.useState(null),[n,i]=a.useState(null),[o,d]=a.useState(!1),[x,m]=a.useState(null),u=a.useCallback(async p=>{i(null),l(p),d(!0),m(null);try{const j=await g.getFileContent(p);i(j.content)}catch(j){const v=j instanceof Error?j.message:"Unknown error",w=j instanceof TypeError||v==="Request timeout",A=v.includes("404")||v.includes("not found")||v.includes("Not found");m(w?"Network error - server may be unreachable":A?"File not found - it may have been deleted or renamed":v),i(null)}finally{d(!1)}},[]),y=a.useCallback(p=>{u(p)},[u]);return e.jsxs("div",{className:"card p-6 flex flex-col",style:{minHeight:"300px"},children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"File Browser"}),e.jsx("span",{className:"font-mono text-xs text-muted",children:".loki/"})]}),r&&!t&&e.jsx("div",{className:"text-center py-8 text-muted text-sm",children:"Loading files..."}),!r&&(!t||t.length===0)&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted text-sm",children:"No project files found"}),e.jsx("p",{className:"text-primary/60 text-xs mt-1",children:"Start a session to generate .loki/ state"})]}),t&&t.length>0&&e.jsxs("div",{className:"flex gap-4 flex-1 min-h-0",children:[e.jsx("div",{className:"w-1/2 overflow-y-auto terminal-scroll pr-2",children:t.map(p=>e.jsx(we,{node:p,depth:0,onSelectFile:y,selectedPath:s},p.path))}),e.jsxs("div",{className:"w-1/2 bg-charcoal/5 rounded-card p-3 overflow-hidden flex flex-col",children:[!s&&e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted text-xs",children:"Select a file to preview"}),s&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-xs font-mono text-primary mb-2 truncate",children:s}),e.jsx("div",{className:"flex-1 overflow-y-auto terminal-scroll",children:o?e.jsx("div",{className:"text-muted text-xs",children:"Loading..."}):x?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 py-6",children:[e.jsx("p",{className:"text-danger text-xs font-medium",children:"Failed to load file"}),e.jsx("p",{className:"text-muted-accessible text-xs text-center max-w-[200px] break-words",children:x}),e.jsx("button",{type:"button",onClick:()=>s&&u(s),className:"mt-1 px-3 py-1 text-xs font-semibold rounded-btn border border-primary/20 text-primary hover:bg-primary/5 transition-colors",children:"Retry"})]}):e.jsx("pre",{className:"text-xs font-mono text-ink whitespace-pre-wrap break-words leading-relaxed",children:n})})]})]})]})]})}function Rt(t){return typeof t!="number"||!Number.isFinite(t)||t<=0?"Not recorded":t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString()}function _t(t){if(!t)return"Not recorded";try{const r=new Date(t),l=new Date().getTime()-r.getTime(),n=Math.floor(l/(1e3*60*60));return n<1?"Just now":n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}catch{return t}}function It({memory:t,loading:r}){const s=t?[{label:"Episodic",count:t.episodic_count,color:"text-primary",bg:"bg-primary/10",border:"border-primary/20"},{label:"Semantic",count:t.semantic_count,color:"text-success",bg:"bg-success/10",border:"border-success/20"},{label:"Skills",count:t.skill_count,color:"text-warning",bg:"bg-warning/10",border:"border-warning/20"}]:[];return e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Memory System"}),(t==null?void 0:t.last_consolidation)&&e.jsx("span",{className:"font-mono text-xs text-muted",children:_t(t.last_consolidation)})]}),r&&!t&&e.jsx("div",{className:"text-center py-8 text-muted text-sm",children:"Loading memory..."}),!r&&!t&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted text-sm",children:"No memory data available"}),e.jsx("p",{className:"text-primary/60 text-xs mt-1",children:"Memory populates during autonomous runs"})]}),t&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:s.map(l=>e.jsxs("div",{className:`${l.bg} border ${l.border} rounded-card p-3 text-center`,children:[e.jsx("div",{className:`text-2xl font-bold font-mono ${l.color}`,children:l.count}),e.jsx("div",{className:"text-xs text-muted-accessible font-medium mt-1 uppercase tracking-wider",children:l.label})]},l.label))}),e.jsxs("div",{className:"mt-3 flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-muted font-medium",children:"Token Usage"}),e.jsx("span",{className:"font-mono text-ink",children:Rt(t.total_tokens)})]}),e.jsxs("div",{className:"mt-3 flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-muted",children:"Last Consolidation"}),e.jsx("span",{className:"font-mono text-ink",children:t.last_consolidation?new Date(t.last_consolidation).toLocaleString():"Not recorded"})]})]})]})}function $t({visible:t}){const[r,s]=a.useState("markdown"),[l,n]=a.useState(null),[i,o]=a.useState(null),[d,x]=a.useState(!1),[m,u]=a.useState(!1),[y,p]=a.useState(null),[j,v]=a.useState(!1);if(!t)return null;const w=async()=>{x(!0),p(null),n(null),o(null);try{const h=await g.generateReport(r);n(h)}catch(h){p(h instanceof Error?h.message:"Failed to generate report")}finally{x(!1)}},A=async()=>{u(!0),p(null);try{const h=await g.shareSession();o(h)}catch(h){p(h instanceof Error?h.message:"Failed to share session")}finally{u(!1)}},N=async h=>{try{await navigator.clipboard.writeText(h),v(!0),setTimeout(()=>v(!1),2e3)}catch{}},k=()=>{if(!l)return;const h=new Blob([l.content],{type:r==="html"?"text/html":"text/markdown"}),M=URL.createObjectURL(h),P=document.createElement("a");P.href=M,P.download=`loki-report.${r==="html"?"html":"md"}`,P.click(),URL.revokeObjectURL(M)};return e.jsxs("div",{className:"card p-4 rounded-card",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Session Report"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center gap-1 card rounded-card p-1",children:["markdown","html"].map(h=>e.jsx("button",{onClick:()=>s(h),className:`px-3 py-1 text-xs font-semibold rounded-btn transition-all ${r===h?"bg-primary text-white shadow-sm":"text-muted hover:text-ink hover:bg-hover"}`,children:h.toUpperCase()},h))}),e.jsx("button",{onClick:w,disabled:d,className:"px-4 py-1.5 rounded-card text-xs font-semibold bg-primary text-white hover:bg-primary/90 disabled:opacity-50 transition-all",children:d?"Generating...":"Generate Report"})]})]}),y&&e.jsx("div",{className:"mb-3 px-3 py-2 rounded-btn bg-danger/10 border border-danger/20 text-danger text-xs",children:y}),l&&e.jsxs("div",{className:"mt-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsxs("span",{className:"text-xs text-muted",children:["Report generated (",l.format,")"]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:()=>N(l.content),className:"px-3 py-1 text-xs font-medium text-muted hover:text-ink border border-border-light rounded-btn hover:bg-hover transition-all",children:j?"Copied":"Copy"}),e.jsx("button",{onClick:k,className:"px-3 py-1 text-xs font-medium text-muted hover:text-ink border border-border-light rounded-btn hover:bg-hover transition-all",children:"Download"}),e.jsx("button",{onClick:A,disabled:m,className:"px-3 py-1 text-xs font-medium bg-primary/10 text-primary border border-primary/20 rounded-btn hover:bg-primary/20 disabled:opacity-50 transition-all",children:m?"Sharing...":"Share as Gist"})]}),i&&e.jsxs("div",{className:"mb-2 flex items-center gap-2 px-3 py-2 rounded-btn bg-success/10 border border-success/20",children:[e.jsx("span",{className:"text-xs text-success font-medium",children:"Shared:"}),i.url?e.jsx("a",{href:i.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary underline flex-1 truncate",children:i.url}):e.jsx("span",{className:"text-xs text-muted flex-1",children:"No URL returned"}),i.url&&e.jsx("button",{onClick:()=>N(i.url),className:"text-xs text-muted hover:text-ink",children:"Copy URL"})]}),e.jsx("pre",{className:"text-[11px] font-mono text-ink bg-black/5 rounded-card p-3 overflow-auto max-h-64 whitespace-pre-wrap terminal-scroll",children:l.content||"(empty report)"})]})]})}const K=t=>typeof t=="number"&&Number.isFinite(t)?t:null;function fe({visible:t}){var d,x;const r=a.useCallback(()=>g.getMetrics(),[]),{data:s,loading:l}=R(r,15e3,t);if(!t)return null;const n=s,i=K((d=n==null?void 0:n.agent_activity)==null?void 0:d.total_iterations)??K(s==null?void 0:s.iterations),o=K((x=n==null?void 0:n.tokens)==null?void 0:x.total)??K(s==null?void 0:s.tokens_used);return e.jsxs("div",{className:"card p-4 rounded-card",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Session Metrics"}),l&&e.jsx("div",{className:"w-4 h-4 border-2 border-primary border-t-transparent rounded-full animate-spin"})]}),s?e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Iterations"}),e.jsx("div",{className:"text-xl font-bold text-ink",children:i??"N/A"})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Gate Pass Rate"}),e.jsx("div",{className:"text-xl font-bold text-ink",children:typeof s.quality_gate_pass_rate=="number"?`${s.quality_gate_pass_rate.toFixed(0)}%`:"N/A"})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Tokens Used"}),e.jsx("div",{className:"text-xl font-bold text-ink",children:o!==null&&o>0?o.toLocaleString():"N/A"})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Time Elapsed"}),e.jsx("div",{className:"text-xl font-bold text-ink",children:s.time_elapsed||"N/A"})]})]}):e.jsx("div",{className:"text-sm text-muted py-4 text-center",children:l?"Loading metrics...":"No metrics available"})]})}function zt(t){switch(t){case"completed":case"complete":case"done":return"completed";case"in_progress":return"running";case"started":return"started";case"error":case"failed":return"failed";default:return"empty"}}const Ht={completed:"Completed",complete:"Completed",done:"Completed",in_progress:"In Progress",started:"Started",error:"Failed",failed:"Failed",empty:"Empty"};function qt({onLoadSession:t}){const r=a.useCallback(()=>g.getSessionsHistory(),[]),{data:s,loading:l}=R(r,6e4,!0);return l&&!s?e.jsxs("div",{className:"card p-4 rounded-card",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider mb-3",children:"Past Builds"}),e.jsx("div",{className:"text-sm text-muted",children:"Loading..."})]}):!s||s.length===0?null:e.jsxs("div",{className:"card p-4 rounded-card",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider mb-3",children:"Past Builds"}),e.jsx("div",{className:"flex flex-col gap-2 max-h-64 overflow-y-auto terminal-scroll",children:s.map(n=>{const i=n.file_count;return e.jsxs("button",{onClick:()=>t==null?void 0:t(n),className:"text-left px-4 py-3 rounded-card card hover:bg-hover transition-all group cursor-pointer",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs font-mono text-muted-accessible",children:n.date}),e.jsxs("div",{className:"flex items-center gap-2",children:[i!==void 0&&i>0&&e.jsxs("span",{className:"text-xs font-mono text-muted-accessible",children:[i," files"]}),e.jsx(it,{status:zt(n.status),children:Ht[n.status]||n.status})]})]}),e.jsx("div",{className:"text-xs text-ink truncate group-hover:text-primary transition-colors",children:n.prd_snippet||n.id}),e.jsx("div",{className:"text-xs font-mono text-muted-accessible mt-0.5 truncate",children:n.path})]},n.id)})})]})}function Gt({end:t,suffix:r="",duration:s=1500}){const[l,n]=a.useState(0),i=a.useRef(null),o=a.useRef(!1);return a.useEffect(()=>{const d=new IntersectionObserver(([x])=>{if(x.isIntersecting&&!o.current){o.current=!0;const m=performance.now(),u=y=>{const p=y-m,j=Math.min(p/s,1),v=1-Math.pow(1-j,3);n(Math.floor(v*t)),j<1&&requestAnimationFrame(u)};requestAnimationFrame(u)}},{threshold:.3});return i.current&&d.observe(i.current),()=>d.disconnect()},[t,s]),e.jsxs("span",{ref:i,className:"tabular-nums",children:[l,r]})}const Ot=[{icon:ot,value:21,suffix:"",label:"Templates"},{icon:ct,value:5,suffix:"",label:"AI Providers"},{icon:Ne,value:100,suffix:"%",label:"Source-Available"}];function Wt(){return e.jsxs("section",{className:"w-full max-w-3xl mx-auto mt-16 mb-4",children:[e.jsx("p",{className:"text-center text-sm text-[#6B6960] mb-8 tracking-wide uppercase font-medium",children:"At a glance"}),e.jsx("div",{className:"flex items-center justify-center gap-12 sm:gap-16",children:Ot.map(t=>{const r=t.icon;return e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(r,{size:20,className:"text-[#553DE9]",strokeWidth:1.5}),e.jsx("span",{className:"text-2xl font-bold text-[#36342E]",children:e.jsx(Gt,{end:t.value,suffix:t.suffix})}),e.jsx("span",{className:"text-xs text-[#6B6960] font-medium",children:t.label})]},t.label)})}),e.jsx("div",{className:"mt-12 border-t border-[#ECEAE3]"})]})}function oe({icon:t,number:r,title:s,description:l,mockup:n,delay:i}){const o=a.useRef(null),[d,x]=a.useState(!1);return a.useEffect(()=>{const m=new IntersectionObserver(([u])=>{u.isIntersecting&&(setTimeout(()=>x(!0),i),m.disconnect())},{threshold:.2});return o.current&&m.observe(o.current),()=>m.disconnect()},[i]),e.jsxs("div",{ref:o,className:`flex flex-col items-center text-center max-w-xs transition-all duration-700 ${d?"opacity-100 translate-y-0":"opacity-0 translate-y-6"}`,children:[e.jsxs("div",{className:"relative mb-4",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#553DE9]/10 flex items-center justify-center",children:e.jsx(t,{size:24,className:"text-[#553DE9]",strokeWidth:1.5})}),e.jsx("span",{className:"absolute -top-2 -right-2 w-6 h-6 rounded-full bg-[#553DE9] text-white text-xs font-bold flex items-center justify-center",children:r})]}),e.jsx("h3",{className:"text-lg font-bold text-[#36342E] mb-1.5",children:s}),e.jsx("p",{className:"text-sm text-[#6B6960] mb-4 leading-relaxed",children:l}),e.jsxs("div",{className:"relative w-full rounded-xl border border-[#ECEAE3] bg-white p-3 pt-6 shadow-sm",children:[e.jsx("span",{className:"absolute top-1.5 right-2 text-[9px] font-semibold uppercase tracking-wider text-[#939084]",children:"Example"}),n]})]})}function Ut(){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1 px-3 py-2 rounded-lg bg-[#FAF9F6] border border-[#ECEAE3] text-left",children:e.jsx("span",{className:"text-xs text-[#36342E]",children:"Build a SaaS dashboard with analytics"})}),e.jsx("div",{className:"w-7 h-7 rounded-lg bg-[#553DE9] flex items-center justify-center flex-shrink-0",children:e.jsx(de,{size:12,className:"text-white"})})]})}function Vt(){return e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-[10px] text-[#6B6960] text-left",children:e.jsx("span",{children:"Phase: Act"})}),e.jsx("div",{className:"w-full h-2 rounded-full bg-[#ECEAE3] overflow-hidden",children:e.jsx("div",{className:"h-full w-2/3 rounded-full bg-gradient-to-r from-[#553DE9] to-[#1FC5A8]"})}),e.jsx("div",{className:"flex gap-1",children:["Reason","Act","Reflect","Verify"].map((t,r)=>e.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded ${r<=1?"bg-[#553DE9]/10 text-[#553DE9] font-medium":"bg-[#ECEAE3]/60 text-[#6B6960]"}`,children:t},t))})]})}function Qt(){return e.jsxs("div",{className:"space-y-2 text-left",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-5 h-5 rounded-full bg-[#1FC5A8]/20 flex items-center justify-center",children:e.jsx("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",children:e.jsx("path",{d:"M1 4L3.5 6.5L9 1",stroke:"#1FC5A8",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),e.jsx("span",{className:"text-xs font-semibold text-[#1FC5A8]",children:"Deployed successfully"})]}),e.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-[#FAF9F6] border border-[#ECEAE3]",children:e.jsx("span",{className:"text-[10px] font-mono text-[#553DE9]",children:"https://my-app.vercel.app"})})]})}function Yt(){return e.jsxs("section",{className:"w-full max-w-5xl mx-auto py-16",children:[e.jsx("h2",{className:"font-heading text-h2 text-[#36342E] text-center mb-3",children:"How It Works"}),e.jsx("p",{className:"text-sm text-[#6B6960] text-center mb-12 max-w-lg mx-auto",children:"Three steps from idea to production. No manual coding required."}),e.jsxs("div",{className:"relative flex flex-col md:flex-row items-start justify-center gap-10 md:gap-8",children:[e.jsx("div",{className:"hidden md:block absolute top-7 left-1/2 -translate-x-1/2 w-[60%] h-px border-t-2 border-dashed border-[#ECEAE3] z-0"}),e.jsx(oe,{icon:ve,number:1,title:"Describe Your Idea",description:"Type a one-line description. Loki handles the rest.",mockup:e.jsx(Ut,{}),delay:0}),e.jsx(oe,{icon:dt,number:2,title:"Watch It Build",description:"AI writes code, runs tests, and ensures quality.",mockup:e.jsx(Vt,{}),delay:150}),e.jsx(oe,{icon:de,number:3,title:"Ship It",description:"Deploy to Vercel, Netlify, or GitHub in one click.",mockup:e.jsx(Qt,{}),delay:300})]})]})}function Kt({icon:t,title:r,description:s}){return e.jsxs("div",{className:"rounded-xl border border-[#ECEAE3] bg-white p-5 hover:border-[#553DE9]/40 hover:shadow-lg transition-all group",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#553DE9]/10 flex items-center justify-center mb-3 group-hover:bg-[#553DE9]/15 transition-colors",children:e.jsx(t,{size:20,className:"text-[#553DE9]",strokeWidth:1.5})}),e.jsx("h3",{className:"text-sm font-bold text-[#36342E] mb-1.5",children:r}),e.jsx("p",{className:"text-xs text-[#6B6960] leading-relaxed",children:s})]})}const Zt=[{icon:xt,title:"Multi-AI",description:"Use Claude or GPT. Pick the best for each task."},{icon:Je,title:"Quality First",description:"8 quality gates. 3 blind reviewers. Zero sycophancy."},{icon:ht,title:"Self-Hosted",description:"Your code stays on your machine. Full privacy."},{icon:Ne,title:"Source-Available",description:"BUSL-1.1 source-available. Read it, fork it, self-host it."}];function Jt(){return e.jsxs("section",{className:"w-full max-w-4xl mx-auto py-16",children:[e.jsx("h2",{className:"font-heading text-h2 text-[#36342E] text-center mb-3",children:"Why developers choose Loki Mode"}),e.jsx("p",{className:"text-sm text-[#6B6960] text-center mb-10 max-w-lg mx-auto",children:"Built by developers, for developers. Every decision optimized for shipping faster."}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:Zt.map(t=>e.jsx(Kt,{...t},t.title))})]})}const Xt=[{title:"Product",links:[{label:"Features",to:"/"},{label:"Templates",to:"/templates"},{label:"Docs",href:"https://github.com/asklokesh/loki-mode/wiki"}]},{title:"Developers",links:[{label:"Quick Start",to:"/"},{label:"API Reference",href:"https://github.com/asklokesh/loki-mode/wiki/API-Reference"},{label:"CLI Docs",href:"https://github.com/asklokesh/loki-mode/wiki/CLI-Reference"},{label:"Changelog",href:"https://github.com/asklokesh/loki-mode/blob/main/CHANGELOG.md"}]},{title:"Company",links:[{label:"About Autonomi",href:"https://www.autonomi.dev/"},{label:"Blog",href:"https://www.autonomi.dev/blog"},{label:"Careers",href:"https://www.autonomi.dev/careers"},{label:"Contact",href:"mailto:hello@autonomi.dev"}]},{title:"Community",links:[{label:"GitHub",href:"https://github.com/asklokesh/loki-mode"},{label:"Discord",href:"https://discord.gg/autonomi"},{label:"Twitter",href:"https://twitter.com/autonomidev"},{label:"Forum",href:"https://github.com/asklokesh/loki-mode/discussions"}]}];function es(){const t=ye(),r=(s,l)=>{s.to&&(l.preventDefault(),t(s.to))};return e.jsx("footer",{className:"w-full bg-[#F0EDE8] border-t border-[#ECEAE3] mt-8",children:e.jsxs("div",{className:"max-w-5xl mx-auto px-6 py-12",children:[e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-8 mb-10",children:Xt.map(s=>e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-bold text-[#36342E] uppercase tracking-wider mb-4",children:s.title}),e.jsx("ul",{className:"space-y-2.5",children:s.links.map(l=>e.jsx("li",{children:e.jsx("a",{href:l.href||l.to||"#",onClick:n=>r(l,n),className:"text-sm text-[#6B6960] hover:text-[#553DE9] transition-colors",...l.href?{target:"_blank",rel:"noopener noreferrer"}:{},children:l.label})},l.label))})]},s.title))}),e.jsxs("div",{className:"border-t border-[#ECEAE3] pt-6 flex flex-col sm:flex-row items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 text-xs text-[#6B6960]",children:[e.jsx("span",{children:"Built with care by Autonomi"}),e.jsx("span",{className:"hidden sm:inline text-[#ECEAE3]",children:"|"}),e.jsx("span",{className:"px-2 py-0.5 rounded bg-[#553DE9]/10 text-[#553DE9] font-semibold text-[10px]",children:"v10.10.2"})]}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-[#6B6960]",children:[e.jsx("a",{href:"https://www.autonomi.dev/privacy",target:"_blank",rel:"noopener noreferrer",className:"hover:text-[#553DE9] transition-colors",children:"Privacy"}),e.jsx("a",{href:"https://www.autonomi.dev/terms",target:"_blank",rel:"noopener noreferrer",className:"hover:text-[#553DE9] transition-colors",children:"Terms"})]})]})]})})}function ts({label:t,value:r}){const[s,l]=a.useState(0),n=a.useRef(!1),i=a.useRef(null);return a.useEffect(()=>{if(n.current||r===null)return;const o=new IntersectionObserver(([d])=>{if(d.isIntersecting&&!n.current){let x=function(y){const p=y-u,j=Math.min(p/m,1),v=1-Math.pow(1-j,3);l(Math.round(r*v)),j<1&&requestAnimationFrame(x)};n.current=!0;const m=800,u=performance.now();requestAnimationFrame(x)}},{threshold:.3});return i.current&&o.observe(i.current),()=>o.disconnect()},[r]),e.jsxs("div",{ref:i,className:"text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-[#36342E] dark:text-[#E8E6E3] tabular-nums",children:r===null?e.jsx("span",{title:"Not available right now",children:"--"}):s.toLocaleString()}),e.jsx("div",{className:"text-xs text-[#6B6960] dark:text-[#8A8880] mt-1",children:t})]})}const Z="asklokesh/loki-mode",ss="loki-mode",be={stars:null,forks:null,contributors:null,downloads:null},ce=t=>typeof t=="number"&&Number.isFinite(t)?t:null;function rs(){const[t,r]=a.useState(be);a.useEffect(()=>{(async()=>{const[n,i,o]=await Promise.allSettled([fetch(`https://api.github.com/repos/${Z}`),fetch(`https://api.github.com/repos/${Z}/contributors?per_page=1&anon=true`,{method:"HEAD"}),fetch(`https://api.npmjs.org/downloads/point/last-month/${ss}`)]),d={...be};try{if(n.status==="fulfilled"&&n.value.ok){const x=await n.value.json();d.stars=ce(x.stargazers_count),d.forks=ce(x.forks_count)}if(i.status==="fulfilled"&&i.value.ok){const x=(i.value.headers.get("Link")||"").match(/page=(\d+)>; rel="last"/);if(x)d.contributors=parseInt(x[1],10);else{const m=await fetch(`https://api.github.com/repos/${Z}/contributors?per_page=100&anon=true`);if(m.ok){const u=await m.json();d.contributors=Array.isArray(u)?u.length:null}}}o.status==="fulfilled"&&o.value.ok&&(d.downloads=ce((await o.value.json()).downloads))}catch{}r(d)})()},[]);const s=[{label:"GitHub Stars",value:t.stars},{label:"Forks",value:t.forks},{label:"Contributors",value:t.contributors},{label:"npm downloads (30 days)",value:t.downloads}];return e.jsxs("div",{className:"py-8 border-t border-[#ECEAE3] dark:border-[#2A2A30]",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2 mb-6",children:[e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#36342E] dark:text-[#E8E6E3]",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",fill:"currentColor"})}),e.jsx("span",{className:"text-sm font-semibold text-[#36342E] dark:text-[#E8E6E3]",children:"Source-Available"})]}),e.jsx("div",{className:"grid grid-cols-4 gap-6 max-w-lg mx-auto",children:s.map(l=>e.jsx(ts,{...l},l.label))}),e.jsx("div",{className:"mt-4 text-center",children:e.jsxs("a",{href:`https://github.com/${Z}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm text-[#553DE9] hover:text-[#4832c7] font-medium transition-colors",children:["Star us on GitHub",e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M7 17L17 7M17 7H7M17 7V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})}const as={"build-complete":{icon:e.jsx(bt,{size:24,className:"text-teal"}),title:"Build complete!",description:"Your code is ready. Time to ship it."},"deploy-success":{icon:e.jsx(de,{size:24,className:"text-primary"}),title:"Your app is live!",description:"Successfully deployed. The world can see your work now."},"first-project":{icon:e.jsx(Xe,{size:24,className:"text-warning"}),title:"First build complete!",description:"Welcome to Purple Lab. This is just the beginning."}},ge=["#553DE9","#1FC5A8","#D63384","#2F71E3","#D4A03C","#E8E4FD"],ns=40;function ls({index:t}){const r=ge[t%ge.length],s=Math.random()*100,l=Math.random()*1.5,n=2+Math.random()*1.5,i=4+Math.random()*6,o=t%3===0,d=Math.random()*360;return e.jsx("div",{className:"confetti-piece",style:{position:"absolute",left:`${s}%`,top:"-10px",width:`${i}px`,height:`${i}px`,backgroundColor:r,borderRadius:o?"50%":"1px",opacity:0,transform:`rotate(${d}deg)`,animation:`confetti-fall ${n}s ease-in ${l}s forwards`}})}function is({type:t,onDismiss:r}){const[s,l]=a.useState(!0),n=as[t];return a.useEffect(()=>{const i=setTimeout(()=>{l(!1),r==null||r()},3500);return()=>clearTimeout(i)},[r]),s?e.jsxs("div",{className:"fixed inset-0 z-50 pointer-events-none",children:[e.jsx("div",{className:"absolute inset-0 overflow-hidden",children:Array.from({length:ns},(i,o)=>e.jsx(ls,{index:o},o))}),e.jsx("div",{className:"absolute top-8 left-1/2 -translate-x-1/2 pointer-events-auto celebration-banner-enter",children:e.jsxs("div",{className:"bg-card border border-border rounded-card shadow-lg px-6 py-4 flex items-center gap-3",children:[n.icon,e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold text-ink",children:n.title}),e.jsx("p",{className:"text-xs text-muted",children:n.description})]})]})})]}):null}const os={"no-projects":{icon:e.jsx(at,{size:32,className:"text-primary/60"}),title:"Your workspace is a blank canvas",description:"What will you create today? Describe your idea and watch it come to life.",defaultActionLabel:"Start a new project"},"no-files":{icon:e.jsx(ut,{size:32,className:"text-teal/60"}),title:"This project is brand new",description:"Let's add some code! Start building and files will appear here as they're created.",defaultActionLabel:"Open editor"},"no-chat":{icon:e.jsx(ve,{size:32,className:"text-primary/60"}),title:"Start a conversation with Loki",description:"Try something like 'Add a contact form to my app' or 'Create a dark mode toggle.'",defaultActionLabel:"Say hello"},"no-team":{icon:e.jsx(et,{size:32,className:"text-pink/60"}),title:"Building alone is great, but building together is better",description:"Invite teammates to collaborate on this project in real time.",defaultActionLabel:"Invite a teammate"},"no-notifications":{icon:e.jsx(mt,{size:32,className:"text-teal/60"}),title:"All clear!",description:"No notifications right now. When something needs your attention, it will show up here.",defaultActionLabel:"Dismiss"}};function cs({type:t}){const s={"no-projects":{primary:"#553DE9",secondary:"#1FC5A8"},"no-files":{primary:"#1FC5A8",secondary:"#553DE9"},"no-chat":{primary:"#553DE9",secondary:"#D63384"},"no-team":{primary:"#D63384",secondary:"#553DE9"},"no-notifications":{primary:"#1FC5A8",secondary:"#2F71E3"}}[t];return e.jsxs("svg",{width:"120",height:"80",viewBox:"0 0 120 80",fill:"none",className:"mb-4 opacity-60",children:[e.jsx("circle",{cx:"60",cy:"40",r:"28",stroke:s.primary,strokeWidth:"1.5",strokeDasharray:"4 3"}),e.jsx("circle",{cx:"30",cy:"25",r:"8",fill:s.primary,opacity:"0.1"}),e.jsx("circle",{cx:"90",cy:"55",r:"12",fill:s.secondary,opacity:"0.1"}),e.jsx("circle",{cx:"60",cy:"40",r:"4",fill:s.primary,opacity:"0.3"}),e.jsx("line",{x1:"20",y1:"60",x2:"45",y2:"45",stroke:s.secondary,strokeWidth:"1",opacity:"0.2"}),e.jsx("line",{x1:"75",y1:"35",x2:"100",y2:"20",stroke:s.primary,strokeWidth:"1",opacity:"0.2"}),e.jsx("rect",{x:"50",y:"15",width:"20",height:"3",rx:"1.5",fill:s.secondary,opacity:"0.15"}),e.jsx("rect",{x:"42",y:"62",width:"36",height:"3",rx:"1.5",fill:s.primary,opacity:"0.15"})]})}function ds({type:t,action:r,actionLabel:s}){const l=os[t];return e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-6 text-center warm-empty-state-enter",children:[e.jsx(cs,{type:t}),e.jsx("div",{className:"mb-3",children:l.icon}),e.jsx("h3",{className:"text-sm font-semibold text-ink mb-1.5",children:l.title}),e.jsx("p",{className:"text-xs text-muted max-w-[260px] leading-relaxed",children:l.description}),r&&e.jsx("button",{onClick:r,className:"mt-4 px-4 py-2 text-xs font-semibold rounded-btn bg-primary/10 text-primary hover:bg-primary/20 transition-colors",children:s||l.defaultActionLabel})]})}const J=["Build a SaaS dashboard with user analytics...","Create a REST API with authentication...","Make a landing page with pricing tiers...","Build a chat app with real-time messaging...","Create an e-commerce store with Stripe..."];function xs(){const t=new Date().getHours();return t>=5&&t<12?"Good morning! What shall we build today?":t>=12&&t<17?"Good afternoon! Ready to create something amazing?":t>=17&&t<22?"Good evening! Let's build something cool.":"Burning the midnight oil? Let's build something cool."}function Ps(){const t=ye(),[r,s]=a.useState(null),[l,n]=a.useState(null),[i,o]=a.useState(()=>sessionStorage.getItem("pl_running")==="1"),[d,x]=a.useState(!1),[m,u]=a.useState(()=>sessionStorage.getItem("pl_prd")),[y,p]=a.useState(!1),[j,v]=a.useState(!1),[w,A]=a.useState(!1),[N,k]=a.useState(()=>sessionStorage.getItem("pl_tab")||"terminal"),[h,M]=a.useState(()=>sessionStorage.getItem("pl_provider")||"claude"),[P,W]=a.useState(void 0),[_,z]=a.useState(!1),I=a.useMemo(()=>xs(),[]),[D,U]=a.useState(""),[E,F]=a.useState(!1),[$,V]=a.useState(!1),[H,X]=a.useState(0),[q,Q]=a.useState(!1),G=a.useRef(null),Y=a.useRef(null);a.useEffect(()=>{const c=setInterval(()=>{Q(!0),setTimeout(()=>{X(b=>(b+1)%J.length),Q(!1)},300)},3e3);return()=>clearInterval(c)},[]),a.useEffect(()=>{const c=sessionStorage.getItem("pl_template");c&&(sessionStorage.removeItem("pl_template"),g.getTemplateContent(c).then(({content:b})=>{b&&(W(b),V(!0))}).catch(()=>{}))},[]);const[f,S]=a.useState(null),[B,ee]=a.useState(null),[xe,te]=a.useState(null),ke=a.useCallback(c=>{if(!c){S(null),ee(null),te(null);return}S(c.status),ee(c.agents),te(c.logs),o(c.status.running??!1),x(c.status.paused??!1)},[]),{connected:se,subscribe:Ee}=tt(ke),Se=a.useCallback(()=>g.getStatus(),[]),{data:T}=R(Se,3e4,!se);a.useEffect(()=>{f===null&&T!==null&&(o(T.running??!1),x(T.paused??!1))},[T,f]),a.useEffect(()=>{sessionStorage.setItem("pl_running",i?"1":"0"),i&&p(!0)},[i]),a.useEffect(()=>{m?sessionStorage.setItem("pl_prd",m):sessionStorage.removeItem("pl_prd")},[m]),a.useEffect(()=>{sessionStorage.setItem("pl_provider",h)},[h]),a.useEffect(()=>{sessionStorage.setItem("pl_tab",N)},[N]);const re=a.useRef(void 0);a.useEffect(()=>{var b;const c=(b=f??T)==null?void 0:b.phase;c==="complete"&&re.current&&re.current!=="complete"&&z(!0),re.current=c},[f,T]);const Ce=a.useCallback(()=>g.getMemorySummary(),[]),Ae=a.useCallback(()=>g.getChecklist(),[]),Pe=a.useCallback(()=>g.getFiles(),[]),De=a.useCallback(()=>g.getSessionsHistory(),[]),{data:Fe,loading:Le}=R(Ce,3e4,i),{data:Me,loading:Be}=R(Ae,3e4,i),{data:Te,loading:Re}=R(Pe,3e4,i),{data:me}=R(De,6e4,!0),L=f??T,_e=B,Ie=xe,$e=B===null,ze=xe===null,ue=a.useCallback(async()=>{const c=D.trim();if(!(!c||E)){s(null),F(!0),p(!1),v(!1),k("terminal");try{const b=await g.quickStart(c,h);b.started&&b.session_id&&(u(c),o(!0),t(`/project/${b.session_id}`))}catch(b){s(b instanceof Error?b.message:"Failed to start build")}finally{F(!1)}}},[D,E,h,t]),He=a.useCallback(async(c,b,Qe,Ye)=>{s(null),n(null),p(!1),v(!1),k("terminal");try{await g.startSession({prd:c,provider:b,projectDir:Qe,mode:Ye}),u(c),o(!0)}catch(pe){s(pe instanceof Error?pe.message:"Failed to start session")}},[]),qe=a.useCallback(async()=>{n(null);try{(await g.stopSession()).stopped&&(o(!1),x(!1),u(null),S(null),ee(null),te(null))}catch(c){n(`Could not stop the build: ${c instanceof Error?c.message:"request failed"}`);return}sessionStorage.removeItem("pl_running"),sessionStorage.removeItem("pl_prd"),sessionStorage.removeItem("pl_tab")},[]),Ge=a.useCallback(c=>{t(`/project/${c.id}`)},[t]),Oe=a.useCallback(c=>{M(c)},[]),We=a.useCallback(async()=>{try{await g.pauseSession(),x(!0)}catch{}},[]),Ue=a.useCallback(async()=>{try{await g.resumeSession(),x(!1)}catch{}},[]),Ve=m&&m.replace(/^#+\s*/gm,"").split(`
11
+ */const ft=[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]],bt=je("party-popper",ft);function gt(t){if(t<60)return`${Math.round(t)}s`;if(t<3600)return`${Math.floor(t/60)}m ${Math.round(t%60)}s`;const r=Math.floor(t/3600),s=Math.floor(t%3600/60);return`${r}h ${s}m`}function jt({status:t,prdSummary:r,onStop:s,onPause:l,onResume:n,isPaused:i}){const o=i??(t==null?void 0:t.paused)??!1;return e.jsxs("div",{className:"card px-5 py-3 flex items-center gap-6 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium",children:"Phase"}),e.jsx("span",{className:"font-mono font-semibold text-ink",children:(t==null?void 0:t.phase)||"--"})]}),e.jsx("div",{className:"w-px h-5 bg-border"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium",children:"Complexity"}),e.jsx("span",{className:`font-mono font-semibold ${(t==null?void 0:t.complexity)==="complex"?"text-warning":(t==null?void 0:t.complexity)==="simple"?"text-success":"text-ink"}`,children:(t==null?void 0:t.complexity)||"--"})]}),e.jsx("div",{className:"w-px h-5 bg-border"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium",children:"Tasks"}),e.jsx("span",{className:"font-mono text-ink",children:t!=null&&t.current_task?e.jsx("span",{className:"text-xs",children:t.current_task}):e.jsx("span",{className:"text-muted",children:"--"})}),((t==null?void 0:t.pending_tasks)??0)>0&&e.jsxs("span",{className:"text-xs text-primary font-mono",children:["+",t==null?void 0:t.pending_tasks," pending"]})]}),r&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-5 bg-border"}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium flex-shrink-0",children:"Building"}),e.jsx("span",{className:"text-xs font-mono text-ink truncate max-w-[220px]",title:r,children:r.length>60?r.slice(0,60)+"...":r})]})]}),e.jsx("div",{className:"flex-1"}),typeof(t==null?void 0:t.uptime)=="number"&&t.uptime>0&&e.jsx("span",{className:"font-mono text-xs text-muted",children:gt(t.uptime)}),(l||n)&&e.jsxs("button",{onClick:o?n:l,className:"flex items-center gap-1.5 px-4 py-1.5 rounded-btn text-xs font-semibold border border-warning/30 text-warning hover:bg-warning/10 transition-colors",children:[o?e.jsx(Ke,{size:14}):e.jsx(st,{size:14}),o?"Resume":"Pause"]}),s&&e.jsxs("button",{onClick:s,className:"flex items-center gap-1.5 px-4 py-1.5 rounded-btn text-xs font-semibold bg-danger/10 text-danger border border-danger/20 hover:bg-danger/20 transition-colors",children:[e.jsx(rt,{size:14}),"Stop"]})]})}const ae=t=>typeof t=="number"?t.toString():"--";function vt({status:t}){const r=[{label:"Iteration",value:ae(t==null?void 0:t.iteration),color:"text-primary"},{label:"Agents",value:ae(t==null?void 0:t.running_agents),color:((t==null?void 0:t.running_agents)??0)>0?"text-success":"text-muted"},{label:"Pending",value:ae(t==null?void 0:t.pending_tasks),color:((t==null?void 0:t.pending_tasks)??0)>0?"text-warning":"text-muted"},{label:"Provider",value:(t==null?void 0:t.provider)||"--",color:"text-primary"}];return e.jsx("div",{className:"grid grid-cols-4 gap-3",children:r.map(s=>e.jsxs("div",{className:"card p-4 text-center",children:[e.jsx("div",{className:`text-2xl font-bold font-mono ${s.color}`,children:s.value}),e.jsx("div",{className:"text-xs text-muted font-medium mt-1 uppercase tracking-wider",children:s.label})]},s.label))})}const ne=t=>t==null||t===""?"--":t;function yt({plan:t,error:r,loading:s,onConfirm:l,onCancel:n}){var o;const i=e.jsxs("div",{className:"flex gap-3 justify-end",children:[e.jsx("button",{onClick:n,className:"px-4 py-2 text-sm font-medium text-muted hover:text-ink transition-colors",children:"Cancel"}),e.jsx("button",{onClick:l,className:"px-5 py-2 rounded-card text-sm font-semibold bg-primary text-white hover:bg-primary/90 transition-all shadow-button",children:"Start Build"})]});return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-sm",children:e.jsxs("div",{className:"card w-full max-w-lg mx-4 p-6 rounded-card shadow-card-hover",children:[e.jsx("h2",{className:"text-lg font-bold text-ink mb-4",children:"Build Estimate"}),s?e.jsxs("div",{className:"flex flex-col items-center py-8 gap-3",children:[e.jsx("div",{className:"w-8 h-8 border-2 border-primary border-t-transparent rounded-full animate-spin"}),e.jsx("p",{className:"text-sm text-muted",children:"Analyzing spec..."}),e.jsxs("div",{className:"flex gap-3 mt-4",children:[e.jsx("button",{onClick:n,className:"px-4 py-2 text-sm font-medium text-muted hover:text-ink transition-colors",children:"Cancel"}),e.jsx("button",{onClick:l,className:"px-4 py-2 text-sm font-medium text-primary hover:text-primary/80 transition-colors underline",children:"Skip analysis, build now"})]})]}):r?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4 px-3 py-2 rounded-btn bg-danger/10 border border-danger/20 text-danger text-xs",children:["Could not run loki plan: ",r]}),i]}):t?e.jsxs(e.Fragment,{children:[t.returncode!==0&&e.jsxs("div",{className:"mb-4 px-3 py-2 rounded-btn bg-warning/10 border border-warning/20 text-warning text-xs",children:["loki plan exited with code ",t.returncode," - showing partial results"]}),t.parsed===!1&&e.jsx("div",{className:"mb-4 px-3 py-2 rounded-btn bg-warning/10 border border-warning/20 text-warning text-xs",children:t.output_text?"The estimate could not be parsed from loki plan output. Raw output is shown below.":"The estimate could not be parsed: loki plan produced no output."}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 mb-4",children:[e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Complexity"}),e.jsx("div",{className:"text-base font-bold text-ink capitalize",children:ne(t.complexity)})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Est. Cost"}),e.jsx("div",{className:"text-base font-bold text-ink",children:ne(t.cost_estimate)})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Iterations"}),e.jsx("div",{className:"text-base font-bold text-ink",children:ne(t.iterations)})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Phases"}),e.jsx("div",{className:"text-xs text-ink capitalize",children:(o=t.phases)!=null&&o.length?t.phases.join(", "):"--"})]})]}),t.output_text&&e.jsxs("details",{className:"mb-4",open:t.parsed===!1,children:[e.jsx("summary",{className:"text-xs text-muted cursor-pointer hover:text-ink transition-colors",children:"Raw output"}),e.jsx("pre",{className:"mt-2 text-xs font-mono text-muted-accessible bg-black/5 rounded-card p-3 overflow-auto max-h-40 whitespace-pre-wrap",children:t.output_text})]}),i]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-sm text-muted py-4",children:"No plan data available."}),i]})]})})}function Nt({onSubmit:t,running:r,error:s,provider:l,onProviderChange:n,initialPrd:i}){const[o,d]=a.useState(""),[x,m]=a.useState(""),[u,y]=a.useState("claude"),[p,j]=a.useState(""),v=l??u,[w,A]=a.useState(!1),[N,k]=a.useState([]),[h,M]=a.useState(!1),[P,W]=a.useState(null),[_,z]=a.useState(!1),[I,D]=a.useState(!1),[U,E]=a.useState(null),[F,$]=a.useState(!1),[V,H]=a.useState(null),[X,q]=a.useState(!1);a.useEffect(()=>{g.getTemplates().then(f=>{k(f),M(!1)}).catch(()=>{k([]),M(!0)})},[]),a.useEffect(()=>{i&&d(i)},[i]),a.useEffect(()=>{if(i)return;const f=localStorage.getItem("loki-prd-draft");f&&d(f),g.getPrdPrefill().then(({content:S})=>{S&&d(S)}).catch(()=>{})},[i]),a.useEffect(()=>{o.trim()?localStorage.setItem("loki-prd-draft",o):localStorage.removeItem("loki-prd-draft")},[o]);const Q=a.useCallback(async(f,S)=>{A(!1);try{const B=await g.getTemplateContent(f);d(B.content),m(S),W(null)}catch(B){W(`Could not load template "${S}": ${B instanceof Error?B.message:"request failed"}`)}},[]),G=async()=>{if(!(!o.trim()||F)){$(!0),E(null),H(null),q(!0);try{const f=await g.planSession(o,v);E(f)}catch(f){H(f instanceof Error?f.message:"request failed")}finally{$(!1)}}},Y=async()=>{if(!(!o.trim()||r||_)){q(!1),z(!0);try{await t(o,v,p.trim()||void 0,I?"quick":void 0)}finally{z(!1)}}};return e.jsxs(e.Fragment,{children:[X&&e.jsx(yt,{plan:U,error:V,loading:F,onConfirm:Y,onCancel:()=>q(!1)}),e.jsxs("div",{className:"card p-6 flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Product Requirements"}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:()=>A(!w),className:"text-xs font-medium px-3 py-1.5 rounded-card border border-primary/20 text-primary hover:bg-primary/5 transition-colors",children:x||"Templates"}),w&&e.jsx("div",{className:"absolute right-0 top-full mt-1 w-56 card rounded-card overflow-hidden z-20 shadow-card-hover",children:e.jsxs("div",{className:"py-1 max-h-64 overflow-y-auto terminal-scroll",children:[h&&e.jsx("div",{className:"px-3 py-2 text-xs text-warning border-b border-warning/10",children:"Could not load templates from server. Check that the backend is running."}),!h&&N.length===0&&e.jsx("div",{className:"px-3 py-2 text-xs text-muted",children:"Loading..."}),N.map(f=>e.jsx("button",{onClick:()=>Q(f.filename,f.name),className:"w-full text-left px-3 py-2 text-sm text-ink hover:bg-primary/5 transition-colors",children:f.name},f.filename))]})})]})})]}),e.jsx("textarea",{value:o,onChange:f=>d(f.target.value),placeholder:"Paste your spec or PRD here, or select a template above to get started...",className:"flex-1 min-h-[280px] w-full bg-card rounded-card border border-border-light px-4 py-3 text-sm font-mono text-ink placeholder:text-primary/60 resize-none focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary/30 transition-all",spellCheck:!1}),e.jsxs("div",{className:"mt-3",children:[e.jsx("label",{className:"block text-xs text-muted font-medium mb-1 uppercase tracking-wider",children:"Project Directory"}),e.jsx("input",{type:"text",value:p,onChange:f=>j(f.target.value),placeholder:"Leave blank to auto-create, or type a path (e.g. /Users/you/my-project)",className:"w-full bg-card rounded-card border border-border-light px-4 py-2 text-sm font-mono text-ink placeholder:text-primary/60/70 focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary/30 transition-all",spellCheck:!1}),e.jsx("p",{className:"text-xs text-muted-accessible mt-1",children:"Type a path or leave blank to auto-create under ~/purple-lab-projects/"})]}),P&&e.jsx("div",{className:"mt-3 px-3 py-2 rounded-btn bg-danger/10 border border-danger/20 text-danger text-xs font-medium",children:P}),s&&e.jsx("div",{className:"mt-3 px-3 py-2 rounded-btn bg-danger/10 border border-danger/20 text-danger text-xs font-medium",children:s}),e.jsxs("div",{className:"flex items-center gap-3 mt-4",children:[e.jsxs("button",{onClick:()=>D(!I),title:"Quick Mode: 3 iterations max, faster builds",className:`flex items-center gap-1.5 px-3 py-1.5 rounded-card text-xs font-semibold border transition-all ${I?"bg-primary/10 border-primary/30 text-primary":"border-border-light text-muted hover:text-ink hover:bg-card"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${I?"bg-primary":"bg-muted/40"}`}),"Quick"]}),e.jsx("div",{className:"flex-1"}),e.jsxs("span",{className:"text-xs text-muted font-mono",children:[o.length.toLocaleString()," chars"]}),e.jsx("button",{onClick:G,disabled:!o.trim()||r||_||F,className:`px-6 py-2.5 rounded-card text-sm font-semibold transition-all ${!o.trim()||r||_||F?"bg-primary/10 text-muted cursor-not-allowed":"bg-primary text-white hover:bg-primary/90 shadow-button"}`,children:F?"Analyzing...":_?"Starting...":r?"Building...":"Start Build"})]})]})]})}const O=[{key:"reason",label:"Reason",description:"Analyzing task, planning approach"},{key:"act",label:"Act",description:"Implementing changes, writing code"},{key:"reflect",label:"Reflect",description:"Reviewing output, self-critique"},{key:"verify",label:"Verify",description:"Testing, validation, quality gates"}];function wt(t){if(!t)return"reason";const r=t.toLowerCase();return r.includes("reason")||r.includes("plan")?"reason":r.includes("act")||r.includes("implement")||r.includes("code")?"act":r.includes("reflect")||r.includes("review")?"reflect":r.includes("verify")||r.includes("test")||r.includes("check")?"verify":"idle"}function kt({currentPhase:t,iteration:r}){const s=wt(t),l=typeof r=="number"?r:"--";return e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"RARV Cycle"}),e.jsxs("span",{className:"font-mono text-xs text-muted",children:["Iteration ",l]})]}),e.jsx("div",{className:"flex items-center justify-center mb-5",children:e.jsxs("svg",{viewBox:"0 0 120 120",className:"w-28 h-28",children:[O.map((n,i)=>{const o=n.key===s,d=s!=="idle"&&O.findIndex(y=>y.key===s)>i,x=(i*90-90)*(Math.PI/180),m=60+40*Math.cos(x),u=60+40*Math.sin(x);return e.jsxs("g",{children:[i<O.length-1&&e.jsx("line",{x1:m,y1:u,x2:60+40*Math.cos(((i+1)*90-90)*(Math.PI/180)),y2:60+40*Math.sin(((i+1)*90-90)*(Math.PI/180)),stroke:d?"#553DE9":"#ECEAE3",strokeWidth:d?2:1,strokeDasharray:d?"none":"4 3"}),i===O.length-1&&e.jsx("line",{x1:m,y1:u,x2:60+40*Math.cos(-90*(Math.PI/180)),y2:60+40*Math.sin(-90*(Math.PI/180)),stroke:"#ECEAE3",strokeWidth:1,strokeDasharray:"4 3"}),e.jsx("circle",{cx:m,cy:u,r:o?14:10,fill:o||d?"#553DE9":"#E8E4FD",stroke:o?"#4432c4":d?"#553DE9":"#ECEAE3",strokeWidth:o?3:1.5,className:o?"phase-active":""}),e.jsx("text",{x:m,y:u+(i===0?-20:i===2?24:0),textAnchor:"middle",className:"text-[9px] font-semibold fill-ink",dx:i===1?22:i===3?-22:0,children:n.label[0]})]},n.key)}),e.jsx("text",{x:"60",y:"64",textAnchor:"middle",className:"text-lg font-bold font-mono fill-primary",children:l})]})}),e.jsx("div",{className:"space-y-2",children:O.map(n=>{const i=n.key===s;return e.jsxs("div",{className:`flex items-center gap-3 px-3 py-2 rounded-card transition-all duration-200 ${i?"bg-primary/8 border border-primary/20":"opacity-50"}`,children:[e.jsx("div",{className:`w-2.5 h-2.5 rounded-full flex-shrink-0 ${i?"bg-primary phase-active":"bg-border"}`}),e.jsxs("div",{children:[e.jsx("span",{className:`text-sm font-semibold ${i?"text-primary":"text-muted"}`,children:n.label}),i&&e.jsx("p",{className:"text-xs text-muted mt-0.5",children:n.description})]})]},n.key)})})]})}const le={architect:"bg-primary/10 text-primary border-primary/20",developer:"bg-primary/10 text-primary border-primary/20",tester:"bg-success/10 text-success border-success/20",reviewer:"bg-warning/10 text-warning border-warning/20",planner:"bg-primary/60/20 text-ink border-primary/60/30",default:"bg-border/30 text-muted border-border/50"};function Et(t){if(!t)return le.default;const r=t.toLowerCase();for(const[s,l]of Object.entries(le))if(r.includes(s))return l;return le.default}function St({agents:t,loading:r}){const s=(t==null?void 0:t.filter(n=>n.alive))||[],l=(t==null?void 0:t.filter(n=>!n.alive))||[];return e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Agents"}),e.jsxs("span",{className:"font-mono text-xs text-muted",children:[s.length," active"]})]}),r&&!t&&e.jsx("div",{className:"text-center py-8 text-muted text-sm",children:"Loading agents..."}),!r&&(t==null?void 0:t.length)===0&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted text-sm",children:"No agents running"}),e.jsx("p",{className:"text-primary/60 text-xs mt-1",children:"Start a build to spawn agents"})]}),s.length>0&&e.jsx("div",{className:"space-y-2 mb-4",children:s.map(n=>e.jsx(he,{agent:n},n.id))}),l.length>0&&e.jsxs("details",{className:"mt-3",children:[e.jsxs("summary",{className:"text-xs text-muted cursor-pointer hover:text-ink transition-colors",children:[l.length," completed"]}),e.jsx("div",{className:"space-y-1.5 mt-2",children:l.slice(0,10).map(n=>e.jsx(he,{agent:n,compact:!0},n.id))})]})]})}function he({agent:t,compact:r}){const s=Et(t.type||t.name||"");return r?e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded-btn bg-hover text-xs",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-muted/30"}),e.jsx("span",{className:"font-medium text-muted truncate",children:t.name||t.id}),e.jsx("span",{className:"text-primary/60 ml-auto",children:t.type})]}):e.jsxs("div",{className:`flex items-start gap-3 px-3 py-2.5 rounded-card border ${s}`,children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${t.alive?"bg-success phase-active":"bg-muted/30"}`})}),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-semibold truncate",children:t.name||t.id}),t.type&&e.jsx("span",{className:"text-xs font-mono font-medium opacity-70",children:t.type})]}),t.task&&e.jsx("p",{className:"text-xs opacity-70 mt-0.5 truncate",children:t.task}),t.status&&t.status!=="unknown"&&e.jsx("span",{className:"inline-block text-xs font-mono mt-1 opacity-60",children:t.status})]}),t.pid&&e.jsxs("span",{className:"text-xs font-mono text-muted-accessible flex-shrink-0",children:["PID ",t.pid]})]})}function Ct({text:t,position:r="top",size:s=14}){const[l,n]=a.useState(!1),i=a.useRef(null);a.useEffect(()=>{if(!l)return;const x=m=>{i.current&&!i.current.contains(m.target)&&n(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[l]);const o={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"},d={top:"top-full left-1/2 -translate-x-1/2 border-t-[#1A1A1E] dark:border-t-card border-l-transparent border-r-transparent border-b-transparent border-4",bottom:"bottom-full left-1/2 -translate-x-1/2 border-b-[#1A1A1E] dark:border-b-card border-l-transparent border-r-transparent border-t-transparent border-4",left:"left-full top-1/2 -translate-y-1/2 border-l-[#1A1A1E] dark:border-l-card border-t-transparent border-b-transparent border-r-transparent border-4",right:"right-full top-1/2 -translate-y-1/2 border-r-[#1A1A1E] dark:border-r-card border-t-transparent border-b-transparent border-l-transparent border-4"};return e.jsxs("div",{className:"relative inline-flex items-center",ref:i,children:[e.jsx("button",{onClick:()=>n(!l),onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),className:"text-muted/50 hover:text-primary transition-colors p-0.5 rounded-full","aria-label":"Help",type:"button",children:e.jsx(Ze,{size:s})}),l&&e.jsx("div",{className:`absolute z-50 ${o[r]}`,role:"tooltip",children:e.jsxs("div",{className:"relative bg-[#1A1A1E] text-white px-3 py-2 rounded-lg shadow-lg max-w-[240px]",children:[e.jsx("p",{className:"text-[11px] leading-relaxed",children:t}),e.jsx("span",{className:`absolute ${d[r]}`})]})})]})}const At={qualityGates:"Automated checks ensuring your code meets quality standards. Includes static analysis, test coverage, and security scanning."},Pt={pass:{badge:"bg-success/10 text-success border-success/20",dot:"bg-success",label:"Pass"},fail:{badge:"bg-danger/10 text-danger border-danger/20",dot:"bg-danger",label:"Fail"},skip:{badge:"bg-muted/10 text-muted border-muted/20",dot:"bg-muted/40",label:"Skip"},pending:{badge:"bg-warning/10 text-warning border-warning/20",dot:"bg-warning",label:"Pending"}};function Dt({item:t}){const[r,s]=a.useState(!1),l=Pt[t.status];return e.jsxs("div",{className:`border rounded-card overflow-hidden ${l.badge}`,children:[e.jsxs("button",{type:"button",className:"w-full flex items-center gap-3 px-3 py-2.5 text-left",onClick:()=>t.details&&s(!r),children:[e.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${l.dot}`}),e.jsx("span",{className:"text-sm font-medium flex-1 truncate",children:t.label}),e.jsx("span",{className:"text-xs font-mono font-semibold uppercase tracking-wider flex-shrink-0",children:l.label}),t.details&&e.jsx("span",{className:"text-xs text-muted/60 flex-shrink-0",children:r?"v":">"})]}),r&&t.details&&e.jsx("div",{className:"px-3 pb-2.5 pt-0",children:e.jsx("p",{className:"text-xs font-mono opacity-70 leading-relaxed",children:t.details})})]})}function Ft({checklist:t,loading:r}){const s=t&&Array.isArray(t.items)&&t.items.length>0?t:null,l=s&&s.total>0?s.passed/s.total*100:0;return e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Quality Gates"}),e.jsx(Ct,{text:At.qualityGates,position:"right",size:13})]}),s&&e.jsxs("span",{className:"font-mono text-xs text-muted",children:[s.passed,"/",s.total," passed"]})]}),r&&!s&&e.jsx("div",{className:"text-center py-8 text-muted text-sm",children:"Loading gates..."}),!r&&!s&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted text-sm",children:"No quality gate data"}),e.jsx("p",{className:"text-primary/60 text-xs mt-1",children:"Gates run during verification phase"})]}),s&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-4 mb-3 text-xs",children:[e.jsxs("span",{className:"text-success font-medium",children:[s.passed," passed"]}),s.failed>0&&e.jsxs("span",{className:"text-danger font-medium",children:[s.failed," failed"]}),s.skipped>0&&e.jsxs("span",{className:"text-muted",children:[s.skipped," skipped"]}),s.pending>0&&e.jsxs("span",{className:"text-warning",children:[s.pending," pending"]})]}),e.jsx("div",{className:"w-full h-2 bg-charcoal/10 rounded-full overflow-hidden mb-4",children:e.jsx("div",{className:"h-full bg-success rounded-full transition-all duration-500",style:{width:`${l}%`}})}),e.jsx("div",{className:"space-y-2 max-h-[400px] overflow-y-auto terminal-scroll",children:s.items.map(n=>e.jsx(Dt,{item:n},n.id))})]})]})}const Lt={".py":"bg-success",".ts":"bg-primary",".tsx":"bg-primary",".md":"bg-warning",".sh":"bg-primary"};function Mt(t){const r=t.substring(t.lastIndexOf("."));return Lt[r]||"bg-muted"}function Bt(t){return t==null?"":t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(1)}KB`:`${(t/(1024*1024)).toFixed(1)}MB`}const ie=100;function we({node:t,depth:r,onSelectFile:s,selectedPath:l}){const[n,i]=a.useState(!1),[o,d]=a.useState(ie),x=t.type==="directory",m=t.path===l,u=x&&n?t.children??[]:[],y=u.length>o;return e.jsxs("div",{children:[e.jsxs("button",{type:"button",className:`w-full flex items-center gap-2 px-2 py-1 rounded-btn text-left text-sm transition-colors hover:bg-hover ${m?"bg-primary/10 text-primary":"text-ink"}`,style:{paddingLeft:`${r*16+8}px`},onClick:()=>{x?(i(!n),n&&d(ie)):s(t.path)},children:[x?e.jsx("span",{className:"font-mono text-xs text-muted w-3 flex-shrink-0",children:n?"v":">"}):e.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${Mt(t.name)}`}),e.jsx("span",{className:`truncate ${x?"font-medium":"font-mono text-xs"}`,children:t.name}),!x&&t.size!==void 0&&e.jsx("span",{className:"ml-auto text-xs font-mono text-muted-accessible flex-shrink-0",children:Bt(t.size)})]}),u.length>0&&e.jsxs("div",{children:[u.slice(0,o).map(p=>e.jsx(we,{node:p,depth:r+1,onSelectFile:s,selectedPath:l},p.path)),y&&e.jsxs("button",{type:"button",className:"w-full text-left text-xs text-primary hover:text-primary/80 py-1 transition-colors",style:{paddingLeft:`${(r+1)*16+8}px`},onClick:()=>d(p=>p+ie),children:["Show more (",u.length-o," remaining)"]})]})]})}function Tt({files:t,loading:r}){const[s,l]=a.useState(null),[n,i]=a.useState(null),[o,d]=a.useState(!1),[x,m]=a.useState(null),u=a.useCallback(async p=>{i(null),l(p),d(!0),m(null);try{const j=await g.getFileContent(p);i(j.content)}catch(j){const v=j instanceof Error?j.message:"Unknown error",w=j instanceof TypeError||v==="Request timeout",A=v.includes("404")||v.includes("not found")||v.includes("Not found");m(w?"Network error - server may be unreachable":A?"File not found - it may have been deleted or renamed":v),i(null)}finally{d(!1)}},[]),y=a.useCallback(p=>{u(p)},[u]);return e.jsxs("div",{className:"card p-6 flex flex-col",style:{minHeight:"300px"},children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"File Browser"}),e.jsx("span",{className:"font-mono text-xs text-muted",children:".loki/"})]}),r&&!t&&e.jsx("div",{className:"text-center py-8 text-muted text-sm",children:"Loading files..."}),!r&&(!t||t.length===0)&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted text-sm",children:"No project files found"}),e.jsx("p",{className:"text-primary/60 text-xs mt-1",children:"Start a session to generate .loki/ state"})]}),t&&t.length>0&&e.jsxs("div",{className:"flex gap-4 flex-1 min-h-0",children:[e.jsx("div",{className:"w-1/2 overflow-y-auto terminal-scroll pr-2",children:t.map(p=>e.jsx(we,{node:p,depth:0,onSelectFile:y,selectedPath:s},p.path))}),e.jsxs("div",{className:"w-1/2 bg-charcoal/5 rounded-card p-3 overflow-hidden flex flex-col",children:[!s&&e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted text-xs",children:"Select a file to preview"}),s&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-xs font-mono text-primary mb-2 truncate",children:s}),e.jsx("div",{className:"flex-1 overflow-y-auto terminal-scroll",children:o?e.jsx("div",{className:"text-muted text-xs",children:"Loading..."}):x?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 py-6",children:[e.jsx("p",{className:"text-danger text-xs font-medium",children:"Failed to load file"}),e.jsx("p",{className:"text-muted-accessible text-xs text-center max-w-[200px] break-words",children:x}),e.jsx("button",{type:"button",onClick:()=>s&&u(s),className:"mt-1 px-3 py-1 text-xs font-semibold rounded-btn border border-primary/20 text-primary hover:bg-primary/5 transition-colors",children:"Retry"})]}):e.jsx("pre",{className:"text-xs font-mono text-ink whitespace-pre-wrap break-words leading-relaxed",children:n})})]})]})]})]})}function Rt(t){return typeof t!="number"||!Number.isFinite(t)||t<=0?"Not recorded":t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString()}function _t(t){if(!t)return"Not recorded";try{const r=new Date(t),l=new Date().getTime()-r.getTime(),n=Math.floor(l/(1e3*60*60));return n<1?"Just now":n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}catch{return t}}function It({memory:t,loading:r}){const s=t?[{label:"Episodic",count:t.episodic_count,color:"text-primary",bg:"bg-primary/10",border:"border-primary/20"},{label:"Semantic",count:t.semantic_count,color:"text-success",bg:"bg-success/10",border:"border-success/20"},{label:"Skills",count:t.skill_count,color:"text-warning",bg:"bg-warning/10",border:"border-warning/20"}]:[];return e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Memory System"}),(t==null?void 0:t.last_consolidation)&&e.jsx("span",{className:"font-mono text-xs text-muted",children:_t(t.last_consolidation)})]}),r&&!t&&e.jsx("div",{className:"text-center py-8 text-muted text-sm",children:"Loading memory..."}),!r&&!t&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted text-sm",children:"No memory data available"}),e.jsx("p",{className:"text-primary/60 text-xs mt-1",children:"Memory populates during autonomous runs"})]}),t&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:s.map(l=>e.jsxs("div",{className:`${l.bg} border ${l.border} rounded-card p-3 text-center`,children:[e.jsx("div",{className:`text-2xl font-bold font-mono ${l.color}`,children:l.count}),e.jsx("div",{className:"text-xs text-muted-accessible font-medium mt-1 uppercase tracking-wider",children:l.label})]},l.label))}),e.jsxs("div",{className:"mt-3 flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-muted font-medium",children:"Token Usage"}),e.jsx("span",{className:"font-mono text-ink",children:Rt(t.total_tokens)})]}),e.jsxs("div",{className:"mt-3 flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-muted",children:"Last Consolidation"}),e.jsx("span",{className:"font-mono text-ink",children:t.last_consolidation?new Date(t.last_consolidation).toLocaleString():"Not recorded"})]})]})]})}function $t({visible:t}){const[r,s]=a.useState("markdown"),[l,n]=a.useState(null),[i,o]=a.useState(null),[d,x]=a.useState(!1),[m,u]=a.useState(!1),[y,p]=a.useState(null),[j,v]=a.useState(!1);if(!t)return null;const w=async()=>{x(!0),p(null),n(null),o(null);try{const h=await g.generateReport(r);n(h)}catch(h){p(h instanceof Error?h.message:"Failed to generate report")}finally{x(!1)}},A=async()=>{u(!0),p(null);try{const h=await g.shareSession();o(h)}catch(h){p(h instanceof Error?h.message:"Failed to share session")}finally{u(!1)}},N=async h=>{try{await navigator.clipboard.writeText(h),v(!0),setTimeout(()=>v(!1),2e3)}catch{}},k=()=>{if(!l)return;const h=new Blob([l.content],{type:r==="html"?"text/html":"text/markdown"}),M=URL.createObjectURL(h),P=document.createElement("a");P.href=M,P.download=`loki-report.${r==="html"?"html":"md"}`,P.click(),URL.revokeObjectURL(M)};return e.jsxs("div",{className:"card p-4 rounded-card",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Session Report"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center gap-1 card rounded-card p-1",children:["markdown","html"].map(h=>e.jsx("button",{onClick:()=>s(h),className:`px-3 py-1 text-xs font-semibold rounded-btn transition-all ${r===h?"bg-primary text-white shadow-sm":"text-muted hover:text-ink hover:bg-hover"}`,children:h.toUpperCase()},h))}),e.jsx("button",{onClick:w,disabled:d,className:"px-4 py-1.5 rounded-card text-xs font-semibold bg-primary text-white hover:bg-primary/90 disabled:opacity-50 transition-all",children:d?"Generating...":"Generate Report"})]})]}),y&&e.jsx("div",{className:"mb-3 px-3 py-2 rounded-btn bg-danger/10 border border-danger/20 text-danger text-xs",children:y}),l&&e.jsxs("div",{className:"mt-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsxs("span",{className:"text-xs text-muted",children:["Report generated (",l.format,")"]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:()=>N(l.content),className:"px-3 py-1 text-xs font-medium text-muted hover:text-ink border border-border-light rounded-btn hover:bg-hover transition-all",children:j?"Copied":"Copy"}),e.jsx("button",{onClick:k,className:"px-3 py-1 text-xs font-medium text-muted hover:text-ink border border-border-light rounded-btn hover:bg-hover transition-all",children:"Download"}),e.jsx("button",{onClick:A,disabled:m,className:"px-3 py-1 text-xs font-medium bg-primary/10 text-primary border border-primary/20 rounded-btn hover:bg-primary/20 disabled:opacity-50 transition-all",children:m?"Sharing...":"Share as Gist"})]}),i&&e.jsxs("div",{className:"mb-2 flex items-center gap-2 px-3 py-2 rounded-btn bg-success/10 border border-success/20",children:[e.jsx("span",{className:"text-xs text-success font-medium",children:"Shared:"}),i.url?e.jsx("a",{href:i.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary underline flex-1 truncate",children:i.url}):e.jsx("span",{className:"text-xs text-muted flex-1",children:"No URL returned"}),i.url&&e.jsx("button",{onClick:()=>N(i.url),className:"text-xs text-muted hover:text-ink",children:"Copy URL"})]}),e.jsx("pre",{className:"text-[11px] font-mono text-ink bg-black/5 rounded-card p-3 overflow-auto max-h-64 whitespace-pre-wrap terminal-scroll",children:l.content||"(empty report)"})]})]})}const K=t=>typeof t=="number"&&Number.isFinite(t)?t:null;function fe({visible:t}){var d,x;const r=a.useCallback(()=>g.getMetrics(),[]),{data:s,loading:l}=R(r,15e3,t);if(!t)return null;const n=s,i=K((d=n==null?void 0:n.agent_activity)==null?void 0:d.total_iterations)??K(s==null?void 0:s.iterations),o=K((x=n==null?void 0:n.tokens)==null?void 0:x.total)??K(s==null?void 0:s.tokens_used);return e.jsxs("div",{className:"card p-4 rounded-card",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Session Metrics"}),l&&e.jsx("div",{className:"w-4 h-4 border-2 border-primary border-t-transparent rounded-full animate-spin"})]}),s?e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Iterations"}),e.jsx("div",{className:"text-xl font-bold text-ink",children:i??"N/A"})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Gate Pass Rate"}),e.jsx("div",{className:"text-xl font-bold text-ink",children:typeof s.quality_gate_pass_rate=="number"?`${s.quality_gate_pass_rate.toFixed(0)}%`:"N/A"})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Tokens Used"}),e.jsx("div",{className:"text-xl font-bold text-ink",children:o!==null&&o>0?o.toLocaleString():"N/A"})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Time Elapsed"}),e.jsx("div",{className:"text-xl font-bold text-ink",children:s.time_elapsed||"N/A"})]})]}):e.jsx("div",{className:"text-sm text-muted py-4 text-center",children:l?"Loading metrics...":"No metrics available"})]})}function zt(t){switch(t){case"completed":case"complete":case"done":return"completed";case"in_progress":return"running";case"started":return"started";case"error":case"failed":return"failed";default:return"empty"}}const Ht={completed:"Completed",complete:"Completed",done:"Completed",in_progress:"In Progress",started:"Started",error:"Failed",failed:"Failed",empty:"Empty"};function qt({onLoadSession:t}){const r=a.useCallback(()=>g.getSessionsHistory(),[]),{data:s,loading:l}=R(r,6e4,!0);return l&&!s?e.jsxs("div",{className:"card p-4 rounded-card",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider mb-3",children:"Past Builds"}),e.jsx("div",{className:"text-sm text-muted",children:"Loading..."})]}):!s||s.length===0?null:e.jsxs("div",{className:"card p-4 rounded-card",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider mb-3",children:"Past Builds"}),e.jsx("div",{className:"flex flex-col gap-2 max-h-64 overflow-y-auto terminal-scroll",children:s.map(n=>{const i=n.file_count;return e.jsxs("button",{onClick:()=>t==null?void 0:t(n),className:"text-left px-4 py-3 rounded-card card hover:bg-hover transition-all group cursor-pointer",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs font-mono text-muted-accessible",children:n.date}),e.jsxs("div",{className:"flex items-center gap-2",children:[i!==void 0&&i>0&&e.jsxs("span",{className:"text-xs font-mono text-muted-accessible",children:[i," files"]}),e.jsx(it,{status:zt(n.status),children:Ht[n.status]||n.status})]})]}),e.jsx("div",{className:"text-xs text-ink truncate group-hover:text-primary transition-colors",children:n.prd_snippet||n.id}),e.jsx("div",{className:"text-xs font-mono text-muted-accessible mt-0.5 truncate",children:n.path})]},n.id)})})]})}function Gt({end:t,suffix:r="",duration:s=1500}){const[l,n]=a.useState(0),i=a.useRef(null),o=a.useRef(!1);return a.useEffect(()=>{const d=new IntersectionObserver(([x])=>{if(x.isIntersecting&&!o.current){o.current=!0;const m=performance.now(),u=y=>{const p=y-m,j=Math.min(p/s,1),v=1-Math.pow(1-j,3);n(Math.floor(v*t)),j<1&&requestAnimationFrame(u)};requestAnimationFrame(u)}},{threshold:.3});return i.current&&d.observe(i.current),()=>d.disconnect()},[t,s]),e.jsxs("span",{ref:i,className:"tabular-nums",children:[l,r]})}const Ot=[{icon:ot,value:21,suffix:"",label:"Templates"},{icon:ct,value:5,suffix:"",label:"AI Providers"},{icon:Ne,value:100,suffix:"%",label:"Source-Available"}];function Wt(){return e.jsxs("section",{className:"w-full max-w-3xl mx-auto mt-16 mb-4",children:[e.jsx("p",{className:"text-center text-sm text-[#6B6960] mb-8 tracking-wide uppercase font-medium",children:"At a glance"}),e.jsx("div",{className:"flex items-center justify-center gap-12 sm:gap-16",children:Ot.map(t=>{const r=t.icon;return e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(r,{size:20,className:"text-[#553DE9]",strokeWidth:1.5}),e.jsx("span",{className:"text-2xl font-bold text-[#36342E]",children:e.jsx(Gt,{end:t.value,suffix:t.suffix})}),e.jsx("span",{className:"text-xs text-[#6B6960] font-medium",children:t.label})]},t.label)})}),e.jsx("div",{className:"mt-12 border-t border-[#ECEAE3]"})]})}function oe({icon:t,number:r,title:s,description:l,mockup:n,delay:i}){const o=a.useRef(null),[d,x]=a.useState(!1);return a.useEffect(()=>{const m=new IntersectionObserver(([u])=>{u.isIntersecting&&(setTimeout(()=>x(!0),i),m.disconnect())},{threshold:.2});return o.current&&m.observe(o.current),()=>m.disconnect()},[i]),e.jsxs("div",{ref:o,className:`flex flex-col items-center text-center max-w-xs transition-all duration-700 ${d?"opacity-100 translate-y-0":"opacity-0 translate-y-6"}`,children:[e.jsxs("div",{className:"relative mb-4",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#553DE9]/10 flex items-center justify-center",children:e.jsx(t,{size:24,className:"text-[#553DE9]",strokeWidth:1.5})}),e.jsx("span",{className:"absolute -top-2 -right-2 w-6 h-6 rounded-full bg-[#553DE9] text-white text-xs font-bold flex items-center justify-center",children:r})]}),e.jsx("h3",{className:"text-lg font-bold text-[#36342E] mb-1.5",children:s}),e.jsx("p",{className:"text-sm text-[#6B6960] mb-4 leading-relaxed",children:l}),e.jsxs("div",{className:"relative w-full rounded-xl border border-[#ECEAE3] bg-white p-3 pt-6 shadow-sm",children:[e.jsx("span",{className:"absolute top-1.5 right-2 text-[9px] font-semibold uppercase tracking-wider text-[#939084]",children:"Example"}),n]})]})}function Ut(){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1 px-3 py-2 rounded-lg bg-[#FAF9F6] border border-[#ECEAE3] text-left",children:e.jsx("span",{className:"text-xs text-[#36342E]",children:"Build a SaaS dashboard with analytics"})}),e.jsx("div",{className:"w-7 h-7 rounded-lg bg-[#553DE9] flex items-center justify-center flex-shrink-0",children:e.jsx(de,{size:12,className:"text-white"})})]})}function Vt(){return e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-[10px] text-[#6B6960] text-left",children:e.jsx("span",{children:"Phase: Act"})}),e.jsx("div",{className:"w-full h-2 rounded-full bg-[#ECEAE3] overflow-hidden",children:e.jsx("div",{className:"h-full w-2/3 rounded-full bg-gradient-to-r from-[#553DE9] to-[#1FC5A8]"})}),e.jsx("div",{className:"flex gap-1",children:["Reason","Act","Reflect","Verify"].map((t,r)=>e.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded ${r<=1?"bg-[#553DE9]/10 text-[#553DE9] font-medium":"bg-[#ECEAE3]/60 text-[#6B6960]"}`,children:t},t))})]})}function Qt(){return e.jsxs("div",{className:"space-y-2 text-left",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-5 h-5 rounded-full bg-[#1FC5A8]/20 flex items-center justify-center",children:e.jsx("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",children:e.jsx("path",{d:"M1 4L3.5 6.5L9 1",stroke:"#1FC5A8",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),e.jsx("span",{className:"text-xs font-semibold text-[#1FC5A8]",children:"Deployed successfully"})]}),e.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-[#FAF9F6] border border-[#ECEAE3]",children:e.jsx("span",{className:"text-[10px] font-mono text-[#553DE9]",children:"https://my-app.vercel.app"})})]})}function Yt(){return e.jsxs("section",{className:"w-full max-w-5xl mx-auto py-16",children:[e.jsx("h2",{className:"font-heading text-h2 text-[#36342E] text-center mb-3",children:"How It Works"}),e.jsx("p",{className:"text-sm text-[#6B6960] text-center mb-12 max-w-lg mx-auto",children:"Three steps from idea to production. No manual coding required."}),e.jsxs("div",{className:"relative flex flex-col md:flex-row items-start justify-center gap-10 md:gap-8",children:[e.jsx("div",{className:"hidden md:block absolute top-7 left-1/2 -translate-x-1/2 w-[60%] h-px border-t-2 border-dashed border-[#ECEAE3] z-0"}),e.jsx(oe,{icon:ve,number:1,title:"Describe Your Idea",description:"Type a one-line description. Loki handles the rest.",mockup:e.jsx(Ut,{}),delay:0}),e.jsx(oe,{icon:dt,number:2,title:"Watch It Build",description:"AI writes code, runs tests, and ensures quality.",mockup:e.jsx(Vt,{}),delay:150}),e.jsx(oe,{icon:de,number:3,title:"Ship It",description:"Deploy to Vercel, Netlify, or GitHub in one click.",mockup:e.jsx(Qt,{}),delay:300})]})]})}function Kt({icon:t,title:r,description:s}){return e.jsxs("div",{className:"rounded-xl border border-[#ECEAE3] bg-white p-5 hover:border-[#553DE9]/40 hover:shadow-lg transition-all group",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#553DE9]/10 flex items-center justify-center mb-3 group-hover:bg-[#553DE9]/15 transition-colors",children:e.jsx(t,{size:20,className:"text-[#553DE9]",strokeWidth:1.5})}),e.jsx("h3",{className:"text-sm font-bold text-[#36342E] mb-1.5",children:r}),e.jsx("p",{className:"text-xs text-[#6B6960] leading-relaxed",children:s})]})}const Zt=[{icon:xt,title:"Multi-AI",description:"Use Claude or GPT. Pick the best for each task."},{icon:Je,title:"Quality First",description:"8 quality gates. 3 blind reviewers. Zero sycophancy."},{icon:ht,title:"Self-Hosted",description:"Your code stays on your machine. Full privacy."},{icon:Ne,title:"Source-Available",description:"BUSL-1.1 source-available. Read it, fork it, self-host it."}];function Jt(){return e.jsxs("section",{className:"w-full max-w-4xl mx-auto py-16",children:[e.jsx("h2",{className:"font-heading text-h2 text-[#36342E] text-center mb-3",children:"Why developers choose Loki Mode"}),e.jsx("p",{className:"text-sm text-[#6B6960] text-center mb-10 max-w-lg mx-auto",children:"Built by developers, for developers. Every decision optimized for shipping faster."}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:Zt.map(t=>e.jsx(Kt,{...t},t.title))})]})}const Xt=[{title:"Product",links:[{label:"Features",to:"/"},{label:"Templates",to:"/templates"},{label:"Docs",href:"https://github.com/asklokesh/loki-mode/wiki"}]},{title:"Developers",links:[{label:"Quick Start",to:"/"},{label:"API Reference",href:"https://github.com/asklokesh/loki-mode/wiki/API-Reference"},{label:"CLI Docs",href:"https://github.com/asklokesh/loki-mode/wiki/CLI-Reference"},{label:"Changelog",href:"https://github.com/asklokesh/loki-mode/blob/main/CHANGELOG.md"}]},{title:"Company",links:[{label:"About Autonomi",href:"https://www.autonomi.dev/"},{label:"Blog",href:"https://www.autonomi.dev/blog"},{label:"Careers",href:"https://www.autonomi.dev/careers"},{label:"Contact",href:"mailto:hello@autonomi.dev"}]},{title:"Community",links:[{label:"GitHub",href:"https://github.com/asklokesh/loki-mode"},{label:"Discord",href:"https://discord.gg/autonomi"},{label:"Twitter",href:"https://twitter.com/autonomidev"},{label:"Forum",href:"https://github.com/asklokesh/loki-mode/discussions"}]}];function es(){const t=ye(),r=(s,l)=>{s.to&&(l.preventDefault(),t(s.to))};return e.jsx("footer",{className:"w-full bg-[#F0EDE8] border-t border-[#ECEAE3] mt-8",children:e.jsxs("div",{className:"max-w-5xl mx-auto px-6 py-12",children:[e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-8 mb-10",children:Xt.map(s=>e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-bold text-[#36342E] uppercase tracking-wider mb-4",children:s.title}),e.jsx("ul",{className:"space-y-2.5",children:s.links.map(l=>e.jsx("li",{children:e.jsx("a",{href:l.href||l.to||"#",onClick:n=>r(l,n),className:"text-sm text-[#6B6960] hover:text-[#553DE9] transition-colors",...l.href?{target:"_blank",rel:"noopener noreferrer"}:{},children:l.label})},l.label))})]},s.title))}),e.jsxs("div",{className:"border-t border-[#ECEAE3] pt-6 flex flex-col sm:flex-row items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 text-xs text-[#6B6960]",children:[e.jsx("span",{children:"Built with care by Autonomi"}),e.jsx("span",{className:"hidden sm:inline text-[#ECEAE3]",children:"|"}),e.jsx("span",{className:"px-2 py-0.5 rounded bg-[#553DE9]/10 text-[#553DE9] font-semibold text-[10px]",children:"v10.10.5"})]}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-[#6B6960]",children:[e.jsx("a",{href:"https://www.autonomi.dev/privacy",target:"_blank",rel:"noopener noreferrer",className:"hover:text-[#553DE9] transition-colors",children:"Privacy"}),e.jsx("a",{href:"https://www.autonomi.dev/terms",target:"_blank",rel:"noopener noreferrer",className:"hover:text-[#553DE9] transition-colors",children:"Terms"})]})]})]})})}function ts({label:t,value:r}){const[s,l]=a.useState(0),n=a.useRef(!1),i=a.useRef(null);return a.useEffect(()=>{if(n.current||r===null)return;const o=new IntersectionObserver(([d])=>{if(d.isIntersecting&&!n.current){let x=function(y){const p=y-u,j=Math.min(p/m,1),v=1-Math.pow(1-j,3);l(Math.round(r*v)),j<1&&requestAnimationFrame(x)};n.current=!0;const m=800,u=performance.now();requestAnimationFrame(x)}},{threshold:.3});return i.current&&o.observe(i.current),()=>o.disconnect()},[r]),e.jsxs("div",{ref:i,className:"text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-[#36342E] dark:text-[#E8E6E3] tabular-nums",children:r===null?e.jsx("span",{title:"Not available right now",children:"--"}):s.toLocaleString()}),e.jsx("div",{className:"text-xs text-[#6B6960] dark:text-[#8A8880] mt-1",children:t})]})}const Z="asklokesh/loki-mode",ss="loki-mode",be={stars:null,forks:null,contributors:null,downloads:null},ce=t=>typeof t=="number"&&Number.isFinite(t)?t:null;function rs(){const[t,r]=a.useState(be);a.useEffect(()=>{(async()=>{const[n,i,o]=await Promise.allSettled([fetch(`https://api.github.com/repos/${Z}`),fetch(`https://api.github.com/repos/${Z}/contributors?per_page=1&anon=true`,{method:"HEAD"}),fetch(`https://api.npmjs.org/downloads/point/last-month/${ss}`)]),d={...be};try{if(n.status==="fulfilled"&&n.value.ok){const x=await n.value.json();d.stars=ce(x.stargazers_count),d.forks=ce(x.forks_count)}if(i.status==="fulfilled"&&i.value.ok){const x=(i.value.headers.get("Link")||"").match(/page=(\d+)>; rel="last"/);if(x)d.contributors=parseInt(x[1],10);else{const m=await fetch(`https://api.github.com/repos/${Z}/contributors?per_page=100&anon=true`);if(m.ok){const u=await m.json();d.contributors=Array.isArray(u)?u.length:null}}}o.status==="fulfilled"&&o.value.ok&&(d.downloads=ce((await o.value.json()).downloads))}catch{}r(d)})()},[]);const s=[{label:"GitHub Stars",value:t.stars},{label:"Forks",value:t.forks},{label:"Contributors",value:t.contributors},{label:"npm downloads (30 days)",value:t.downloads}];return e.jsxs("div",{className:"py-8 border-t border-[#ECEAE3] dark:border-[#2A2A30]",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2 mb-6",children:[e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#36342E] dark:text-[#E8E6E3]",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",fill:"currentColor"})}),e.jsx("span",{className:"text-sm font-semibold text-[#36342E] dark:text-[#E8E6E3]",children:"Source-Available"})]}),e.jsx("div",{className:"grid grid-cols-4 gap-6 max-w-lg mx-auto",children:s.map(l=>e.jsx(ts,{...l},l.label))}),e.jsx("div",{className:"mt-4 text-center",children:e.jsxs("a",{href:`https://github.com/${Z}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm text-[#553DE9] hover:text-[#4832c7] font-medium transition-colors",children:["Star us on GitHub",e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M7 17L17 7M17 7H7M17 7V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})}const as={"build-complete":{icon:e.jsx(bt,{size:24,className:"text-teal"}),title:"Build complete!",description:"Your code is ready. Time to ship it."},"deploy-success":{icon:e.jsx(de,{size:24,className:"text-primary"}),title:"Your app is live!",description:"Successfully deployed. The world can see your work now."},"first-project":{icon:e.jsx(Xe,{size:24,className:"text-warning"}),title:"First build complete!",description:"Welcome to Purple Lab. This is just the beginning."}},ge=["#553DE9","#1FC5A8","#D63384","#2F71E3","#D4A03C","#E8E4FD"],ns=40;function ls({index:t}){const r=ge[t%ge.length],s=Math.random()*100,l=Math.random()*1.5,n=2+Math.random()*1.5,i=4+Math.random()*6,o=t%3===0,d=Math.random()*360;return e.jsx("div",{className:"confetti-piece",style:{position:"absolute",left:`${s}%`,top:"-10px",width:`${i}px`,height:`${i}px`,backgroundColor:r,borderRadius:o?"50%":"1px",opacity:0,transform:`rotate(${d}deg)`,animation:`confetti-fall ${n}s ease-in ${l}s forwards`}})}function is({type:t,onDismiss:r}){const[s,l]=a.useState(!0),n=as[t];return a.useEffect(()=>{const i=setTimeout(()=>{l(!1),r==null||r()},3500);return()=>clearTimeout(i)},[r]),s?e.jsxs("div",{className:"fixed inset-0 z-50 pointer-events-none",children:[e.jsx("div",{className:"absolute inset-0 overflow-hidden",children:Array.from({length:ns},(i,o)=>e.jsx(ls,{index:o},o))}),e.jsx("div",{className:"absolute top-8 left-1/2 -translate-x-1/2 pointer-events-auto celebration-banner-enter",children:e.jsxs("div",{className:"bg-card border border-border rounded-card shadow-lg px-6 py-4 flex items-center gap-3",children:[n.icon,e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold text-ink",children:n.title}),e.jsx("p",{className:"text-xs text-muted",children:n.description})]})]})})]}):null}const os={"no-projects":{icon:e.jsx(at,{size:32,className:"text-primary/60"}),title:"Your workspace is a blank canvas",description:"What will you create today? Describe your idea and watch it come to life.",defaultActionLabel:"Start a new project"},"no-files":{icon:e.jsx(ut,{size:32,className:"text-teal/60"}),title:"This project is brand new",description:"Let's add some code! Start building and files will appear here as they're created.",defaultActionLabel:"Open editor"},"no-chat":{icon:e.jsx(ve,{size:32,className:"text-primary/60"}),title:"Start a conversation with Loki",description:"Try something like 'Add a contact form to my app' or 'Create a dark mode toggle.'",defaultActionLabel:"Say hello"},"no-team":{icon:e.jsx(et,{size:32,className:"text-pink/60"}),title:"Building alone is great, but building together is better",description:"Invite teammates to collaborate on this project in real time.",defaultActionLabel:"Invite a teammate"},"no-notifications":{icon:e.jsx(mt,{size:32,className:"text-teal/60"}),title:"All clear!",description:"No notifications right now. When something needs your attention, it will show up here.",defaultActionLabel:"Dismiss"}};function cs({type:t}){const s={"no-projects":{primary:"#553DE9",secondary:"#1FC5A8"},"no-files":{primary:"#1FC5A8",secondary:"#553DE9"},"no-chat":{primary:"#553DE9",secondary:"#D63384"},"no-team":{primary:"#D63384",secondary:"#553DE9"},"no-notifications":{primary:"#1FC5A8",secondary:"#2F71E3"}}[t];return e.jsxs("svg",{width:"120",height:"80",viewBox:"0 0 120 80",fill:"none",className:"mb-4 opacity-60",children:[e.jsx("circle",{cx:"60",cy:"40",r:"28",stroke:s.primary,strokeWidth:"1.5",strokeDasharray:"4 3"}),e.jsx("circle",{cx:"30",cy:"25",r:"8",fill:s.primary,opacity:"0.1"}),e.jsx("circle",{cx:"90",cy:"55",r:"12",fill:s.secondary,opacity:"0.1"}),e.jsx("circle",{cx:"60",cy:"40",r:"4",fill:s.primary,opacity:"0.3"}),e.jsx("line",{x1:"20",y1:"60",x2:"45",y2:"45",stroke:s.secondary,strokeWidth:"1",opacity:"0.2"}),e.jsx("line",{x1:"75",y1:"35",x2:"100",y2:"20",stroke:s.primary,strokeWidth:"1",opacity:"0.2"}),e.jsx("rect",{x:"50",y:"15",width:"20",height:"3",rx:"1.5",fill:s.secondary,opacity:"0.15"}),e.jsx("rect",{x:"42",y:"62",width:"36",height:"3",rx:"1.5",fill:s.primary,opacity:"0.15"})]})}function ds({type:t,action:r,actionLabel:s}){const l=os[t];return e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-6 text-center warm-empty-state-enter",children:[e.jsx(cs,{type:t}),e.jsx("div",{className:"mb-3",children:l.icon}),e.jsx("h3",{className:"text-sm font-semibold text-ink mb-1.5",children:l.title}),e.jsx("p",{className:"text-xs text-muted max-w-[260px] leading-relaxed",children:l.description}),r&&e.jsx("button",{onClick:r,className:"mt-4 px-4 py-2 text-xs font-semibold rounded-btn bg-primary/10 text-primary hover:bg-primary/20 transition-colors",children:s||l.defaultActionLabel})]})}const J=["Build a SaaS dashboard with user analytics...","Create a REST API with authentication...","Make a landing page with pricing tiers...","Build a chat app with real-time messaging...","Create an e-commerce store with Stripe..."];function xs(){const t=new Date().getHours();return t>=5&&t<12?"Good morning! What shall we build today?":t>=12&&t<17?"Good afternoon! Ready to create something amazing?":t>=17&&t<22?"Good evening! Let's build something cool.":"Burning the midnight oil? Let's build something cool."}function Ps(){const t=ye(),[r,s]=a.useState(null),[l,n]=a.useState(null),[i,o]=a.useState(()=>sessionStorage.getItem("pl_running")==="1"),[d,x]=a.useState(!1),[m,u]=a.useState(()=>sessionStorage.getItem("pl_prd")),[y,p]=a.useState(!1),[j,v]=a.useState(!1),[w,A]=a.useState(!1),[N,k]=a.useState(()=>sessionStorage.getItem("pl_tab")||"terminal"),[h,M]=a.useState(()=>sessionStorage.getItem("pl_provider")||"claude"),[P,W]=a.useState(void 0),[_,z]=a.useState(!1),I=a.useMemo(()=>xs(),[]),[D,U]=a.useState(""),[E,F]=a.useState(!1),[$,V]=a.useState(!1),[H,X]=a.useState(0),[q,Q]=a.useState(!1),G=a.useRef(null),Y=a.useRef(null);a.useEffect(()=>{const c=setInterval(()=>{Q(!0),setTimeout(()=>{X(b=>(b+1)%J.length),Q(!1)},300)},3e3);return()=>clearInterval(c)},[]),a.useEffect(()=>{const c=sessionStorage.getItem("pl_template");c&&(sessionStorage.removeItem("pl_template"),g.getTemplateContent(c).then(({content:b})=>{b&&(W(b),V(!0))}).catch(()=>{}))},[]);const[f,S]=a.useState(null),[B,ee]=a.useState(null),[xe,te]=a.useState(null),ke=a.useCallback(c=>{if(!c){S(null),ee(null),te(null);return}S(c.status),ee(c.agents),te(c.logs),o(c.status.running??!1),x(c.status.paused??!1)},[]),{connected:se,subscribe:Ee}=tt(ke),Se=a.useCallback(()=>g.getStatus(),[]),{data:T}=R(Se,3e4,!se);a.useEffect(()=>{f===null&&T!==null&&(o(T.running??!1),x(T.paused??!1))},[T,f]),a.useEffect(()=>{sessionStorage.setItem("pl_running",i?"1":"0"),i&&p(!0)},[i]),a.useEffect(()=>{m?sessionStorage.setItem("pl_prd",m):sessionStorage.removeItem("pl_prd")},[m]),a.useEffect(()=>{sessionStorage.setItem("pl_provider",h)},[h]),a.useEffect(()=>{sessionStorage.setItem("pl_tab",N)},[N]);const re=a.useRef(void 0);a.useEffect(()=>{var b;const c=(b=f??T)==null?void 0:b.phase;c==="complete"&&re.current&&re.current!=="complete"&&z(!0),re.current=c},[f,T]);const Ce=a.useCallback(()=>g.getMemorySummary(),[]),Ae=a.useCallback(()=>g.getChecklist(),[]),Pe=a.useCallback(()=>g.getFiles(),[]),De=a.useCallback(()=>g.getSessionsHistory(),[]),{data:Fe,loading:Le}=R(Ce,3e4,i),{data:Me,loading:Be}=R(Ae,3e4,i),{data:Te,loading:Re}=R(Pe,3e4,i),{data:me}=R(De,6e4,!0),L=f??T,_e=B,Ie=xe,$e=B===null,ze=xe===null,ue=a.useCallback(async()=>{const c=D.trim();if(!(!c||E)){s(null),F(!0),p(!1),v(!1),k("terminal");try{const b=await g.quickStart(c,h);b.started&&b.session_id&&(u(c),o(!0),t(`/project/${b.session_id}`))}catch(b){s(b instanceof Error?b.message:"Failed to start build")}finally{F(!1)}}},[D,E,h,t]),He=a.useCallback(async(c,b,Qe,Ye)=>{s(null),n(null),p(!1),v(!1),k("terminal");try{await g.startSession({prd:c,provider:b,projectDir:Qe,mode:Ye}),u(c),o(!0)}catch(pe){s(pe instanceof Error?pe.message:"Failed to start session")}},[]),qe=a.useCallback(async()=>{n(null);try{(await g.stopSession()).stopped&&(o(!1),x(!1),u(null),S(null),ee(null),te(null))}catch(c){n(`Could not stop the build: ${c instanceof Error?c.message:"request failed"}`);return}sessionStorage.removeItem("pl_running"),sessionStorage.removeItem("pl_prd"),sessionStorage.removeItem("pl_tab")},[]),Ge=a.useCallback(c=>{t(`/project/${c.id}`)},[t]),Oe=a.useCallback(c=>{M(c)},[]),We=a.useCallback(async()=>{try{await g.pauseSession(),x(!0)}catch{}},[]),Ue=a.useCallback(async()=>{try{await g.resumeSession(),x(!1)}catch{}},[]),Ve=m&&m.replace(/^#+\s*/gm,"").split(`
12
12
  `).find(c=>c.trim().length>0)||null;return e.jsxs("div",{className:"min-h-screen bg-[#FAF9F6] relative",children:[e.jsx("div",{className:"pattern-nodes"}),e.jsx("div",{className:"max-w-[1920px] mx-auto px-6 py-6 relative z-10",children:i?e.jsxs(e.Fragment,{children:[e.jsx(C,{name:"ControlBar",children:e.jsx(jt,{status:L,prdSummary:Ve,onStop:qe,onPause:We,onResume:Ue,isPaused:d})}),l&&e.jsx("div",{role:"alert",className:"mt-3 px-4 py-2.5 rounded-xl bg-[#C45B5B]/10 border border-[#C45B5B]/20 text-[#C45B5B] text-sm font-medium",children:l}),e.jsx("div",{className:"mt-4",children:e.jsx(C,{name:"StatusOverview",children:e.jsx(vt,{status:L})})}),e.jsxs("div",{className:"mt-4 grid grid-cols-12 gap-6",style:{height:"calc(100vh - 340px)",minHeight:"400px"},children:[e.jsx("div",{className:"col-span-3 flex flex-col gap-6",children:e.jsx(C,{name:"PhaseVisualizer",children:e.jsx(kt,{currentPhase:(L==null?void 0:L.phase)||"idle",iteration:L==null?void 0:L.iteration})})}),e.jsxs("div",{className:"col-span-5 flex flex-col gap-0 min-h-0",children:[e.jsxs("div",{className:"flex items-center gap-1 mb-2 flex-shrink-0",children:[e.jsx("button",{onClick:()=>k("terminal"),className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all ${N==="terminal"?"bg-[#553DE9] text-white":"text-[#6B6960] hover:text-[#36342E] hover:bg-[#F8F4F0]"}`,children:"Terminal"}),e.jsx("button",{onClick:()=>k("metrics"),className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all ${N==="metrics"?"bg-[#553DE9] text-white":"text-[#6B6960] hover:text-[#36342E] hover:bg-[#F8F4F0]"}`,children:"Metrics"})]}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(C,{name:"Terminal",children:N==="terminal"?e.jsx(nt,{logs:Ie,loading:ze,subscribe:Ee}):e.jsx(fe,{visible:!0})})})]}),e.jsxs("div",{className:"col-span-4 flex flex-col gap-6 overflow-y-auto",children:[e.jsx(C,{name:"AgentDashboard",children:e.jsx(St,{agents:_e,loading:$e})}),e.jsx(C,{name:"QualityGates",children:e.jsx(Ft,{checklist:Me,loading:Be})}),e.jsx(C,{name:"EvidenceReceipts",children:e.jsx(lt,{})})]})]}),e.jsxs("div",{className:"mt-6 grid grid-cols-12 gap-6",children:[e.jsx("div",{className:"col-span-6",children:e.jsx(C,{name:"FileBrowser",children:e.jsx(Tt,{files:Te,loading:Re})})}),e.jsx("div",{className:"col-span-6",children:e.jsx(C,{name:"MemoryViewer",children:e.jsx(It,{memory:Fe,loading:Le})})})]})]}):e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsxs("div",{ref:Y,className:"text-center mt-12 mb-10",children:[e.jsx("p",{className:"text-sm font-medium text-[#553DE9] mb-2",children:I}),e.jsx("h2",{className:"font-heading text-h1 text-[#36342E]",children:"Describe it. Build it. Ship it."}),e.jsx("p",{className:"text-[#6B6960] mt-3 text-base max-w-xl mx-auto",children:"Type what you want to build. Purple Lab handles the rest -- from code to containers, autonomously."})]}),e.jsxs("div",{className:"w-full max-w-2xl",children:[e.jsxs("div",{className:"relative",children:[e.jsx("input",{ref:G,type:"text",value:D,onChange:c=>U(c.target.value),onKeyDown:c=>{c.key==="Enter"&&!c.shiftKey&&(c.preventDefault(),ue())},className:"w-full text-xl px-6 py-4 rounded-2xl bg-white border border-[#ECEAE3] shadow-sm focus:outline-none focus:ring-2 focus:ring-[#553DE9]/30 focus:border-[#553DE9]/40 focus:shadow-lg transition-all placeholder:text-transparent",disabled:E,"aria-label":"Describe what you want to build"}),!D&&e.jsx("div",{className:"absolute left-6 top-1/2 -translate-y-1/2 text-xl text-[#6B6960]/50 pointer-events-none select-none","aria-hidden":"true",children:e.jsx("span",{className:q?"quick-input-placeholder-exit":"quick-input-placeholder",children:J[H]},H)})]}),e.jsx("div",{className:"mt-4 flex items-center justify-center gap-4",children:e.jsx("button",{onClick:ue,disabled:!D.trim()||E,className:`px-8 py-3 rounded-xl text-base font-semibold transition-all ${!D.trim()||E?"bg-[#553DE9]/20 text-[#553DE9]/40 cursor-not-allowed":"bg-[#553DE9] text-white hover:bg-[#4832c7] shadow-lg shadow-[#553DE9]/25 hover:shadow-xl hover:shadow-[#553DE9]/30 active:scale-[0.98]"}`,children:E?"Starting...":"Start Building"})}),r&&e.jsx("div",{className:"mt-3 px-4 py-2.5 rounded-xl bg-[#C45B5B]/10 border border-[#C45B5B]/20 text-[#C45B5B] text-sm font-medium text-center",children:r}),e.jsx("div",{className:"mt-6 text-center",children:e.jsx("button",{onClick:()=>V(!$),className:"text-sm text-[#553DE9] hover:text-[#4832c7] font-medium transition-colors",children:$?"Hide advanced options":"Advanced (write full spec)"})}),$&&e.jsx("div",{className:"mt-4",children:e.jsx(Nt,{onSubmit:He,running:i,error:r,provider:h,onProviderChange:Oe,initialPrd:P})})]}),y&&!i&&e.jsxs("div",{className:"w-full max-w-3xl mt-6 flex flex-col gap-4",children:[e.jsx("button",{onClick:async()=>{try{const c=await g.getSessionsHistory();c.length>0&&t(`/project/${c[0].id}`)}catch{}},className:"w-full px-6 py-4 rounded-card text-base font-bold bg-[#553DE9] text-white hover:bg-[#553DE9]/90 transition-all shadow-lg shadow-[#553DE9]/20",children:"View Project -- Browse Files and Preview"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:()=>v(!j),className:"px-4 py-2 rounded-card text-sm font-semibold border border-[#553DE9]/30 text-[#553DE9] hover:bg-[#553DE9]/5 transition-all",children:j?"Hide Report":"Report"}),e.jsx("button",{onClick:()=>A(!w),className:"px-4 py-2 rounded-card text-sm font-semibold border border-[#ECEAE3] text-[#6B6960] hover:text-[#36342E] hover:bg-[#F8F4F0] transition-all",children:w?"Hide Metrics":"Metrics"})]}),e.jsx($t,{visible:j}),e.jsx(fe,{visible:w})]}),e.jsx("div",{className:"w-full max-w-3xl mt-6",children:me&&me.length===0?e.jsx(ds,{type:"no-projects",action:()=>{var b;const c=J[Math.floor(Math.random()*J.length)];U(c),(b=G.current)==null||b.focus()},actionLabel:"Try an example"}):e.jsx(qt,{onLoadSession:Ge})}),e.jsxs("div",{className:"mt-6 text-xs text-[#6B6960] flex items-center gap-2",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${se?"bg-[#1FC5A8]":"bg-[#C45B5B]"}`}),se?"Connected to Purple Lab backend":"Waiting for backend connection..."]}),e.jsx(Wt,{}),e.jsx(Yt,{}),e.jsx(Jt,{}),e.jsx("section",{className:"w-full max-w-3xl mx-auto py-16",children:e.jsxs("div",{className:"rounded-2xl bg-gradient-to-br from-[#553DE9]/5 via-[#553DE9]/10 to-[#1FC5A8]/5 border border-[#553DE9]/15 p-10 text-center",children:[e.jsx("h2",{className:"font-heading text-h2 text-[#36342E] mb-3",children:"Ready to build something amazing?"}),e.jsx("p",{className:"text-sm text-[#6B6960] mb-6 max-w-md mx-auto",children:"Go from idea to deployed product in minutes, not months. Let AI handle the heavy lifting."}),e.jsxs("div",{className:"flex items-center justify-center gap-3 flex-wrap",children:[e.jsx("button",{onClick:()=>{var c;(c=Y.current)==null||c.scrollIntoView({behavior:"smooth"}),setTimeout(()=>{var b;return(b=G.current)==null?void 0:b.focus()},500)},className:"px-8 py-3 rounded-xl text-base font-semibold bg-[#553DE9] text-white hover:bg-[#4832c7] shadow-lg shadow-[#553DE9]/25 hover:shadow-xl hover:shadow-[#553DE9]/30 active:scale-[0.98] transition-all",children:"Start Building"}),e.jsx("button",{onClick:()=>t("/templates"),className:"px-8 py-3 rounded-xl text-base font-semibold border border-[#553DE9]/30 text-[#553DE9] hover:bg-[#553DE9]/5 transition-all",children:"View Templates"})]})]})}),e.jsx(rs,{})]})}),!i&&e.jsx(es,{}),_&&e.jsx(is,{type:"build-complete",onDismiss:()=>z(!1)})]})}export{Ps as default};
@@ -1 +1 @@
1
- import{a0 as r,u as o,r as c,j as e}from"./index-pMxOIwXq.js";function x(){const{user:l,loading:t,login:i,isLocalMode:n}=r(),s=o();return c.useEffect(()=>{!t&&(l||n)&&s("/",{replace:!0})},[l,t,n,s]),t?e.jsx("div",{className:"h-screen bg-[#FAF9F6] flex items-center justify-center text-[#6B6960] text-sm",children:"Loading..."}):e.jsx("div",{className:"h-screen bg-[#FAF9F6] flex items-center justify-center",children:e.jsxs("div",{className:"w-full max-w-sm mx-auto px-6",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("h1",{className:"font-heading text-3xl font-bold text-[#36342E] mb-1",children:"Purple Lab"}),e.jsx("p",{className:"text-sm text-[#6B6960]",children:"Autonomous agent workspace powered by Loki"})]}),e.jsxs("div",{className:"bg-white rounded-lg border border-[#ECEAE3] shadow-sm p-6 space-y-4",children:[e.jsx("h2",{className:"text-base font-medium text-[#36342E] text-center",children:"Sign in to continue"}),e.jsxs("button",{type:"button",onClick:()=>i("github"),className:"w-full flex items-center justify-center gap-2 px-4 py-2.5 rounded-[5px] border border-[#ECEAE3] bg-[#24292f] text-white text-sm font-medium hover:bg-[#1b1f23] transition-colors",children:[e.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"})}),"Sign in with GitHub"]}),e.jsxs("button",{type:"button",onClick:()=>i("google"),className:"w-full flex items-center justify-center gap-2 px-4 py-2.5 rounded-[5px] border border-[#ECEAE3] bg-white text-[#36342E] text-sm font-medium hover:bg-[#F8F4F0] transition-colors",children:[e.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",children:[e.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 01-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z"}),e.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),e.jsx("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),e.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]}),"Sign in with Google"]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("div",{className:"w-full border-t border-[#ECEAE3]"})}),e.jsx("div",{className:"relative flex justify-center text-xs",children:e.jsx("span",{className:"bg-white px-2 text-[#939084]",children:"or"})})]}),e.jsx("button",{type:"button",onClick:()=>s("/"),className:"w-full text-center text-sm text-[#6B6960] hover:text-[#553DE9] transition-colors py-1",children:"Continue without account (local mode)"})]}),e.jsx("p",{className:"text-xs text-[#939084] text-center mt-4",children:"Local mode stores everything on your machine. Sign in for cloud sync and collaboration."})]})})}export{x as default};
1
+ import{a0 as r,u as o,r as c,j as e}from"./index-D8TYtITk.js";function x(){const{user:l,loading:t,login:i,isLocalMode:n}=r(),s=o();return c.useEffect(()=>{!t&&(l||n)&&s("/",{replace:!0})},[l,t,n,s]),t?e.jsx("div",{className:"h-screen bg-[#FAF9F6] flex items-center justify-center text-[#6B6960] text-sm",children:"Loading..."}):e.jsx("div",{className:"h-screen bg-[#FAF9F6] flex items-center justify-center",children:e.jsxs("div",{className:"w-full max-w-sm mx-auto px-6",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("h1",{className:"font-heading text-3xl font-bold text-[#36342E] mb-1",children:"Purple Lab"}),e.jsx("p",{className:"text-sm text-[#6B6960]",children:"Autonomous agent workspace powered by Loki"})]}),e.jsxs("div",{className:"bg-white rounded-lg border border-[#ECEAE3] shadow-sm p-6 space-y-4",children:[e.jsx("h2",{className:"text-base font-medium text-[#36342E] text-center",children:"Sign in to continue"}),e.jsxs("button",{type:"button",onClick:()=>i("github"),className:"w-full flex items-center justify-center gap-2 px-4 py-2.5 rounded-[5px] border border-[#ECEAE3] bg-[#24292f] text-white text-sm font-medium hover:bg-[#1b1f23] transition-colors",children:[e.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"})}),"Sign in with GitHub"]}),e.jsxs("button",{type:"button",onClick:()=>i("google"),className:"w-full flex items-center justify-center gap-2 px-4 py-2.5 rounded-[5px] border border-[#ECEAE3] bg-white text-[#36342E] text-sm font-medium hover:bg-[#F8F4F0] transition-colors",children:[e.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",children:[e.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 01-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z"}),e.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),e.jsx("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),e.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]}),"Sign in with Google"]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("div",{className:"w-full border-t border-[#ECEAE3]"})}),e.jsx("div",{className:"relative flex justify-center text-xs",children:e.jsx("span",{className:"bg-white px-2 text-[#939084]",children:"or"})})]}),e.jsx("button",{type:"button",onClick:()=>s("/"),className:"w-full text-center text-sm text-[#6B6960] hover:text-[#553DE9] transition-colors py-1",children:"Continue without account (local mode)"})]}),e.jsx("p",{className:"text-xs text-[#939084] text-center mt-4",children:"Local mode stores everything on your machine. Sign in for cloud sync and collaboration."})]})})}export{x as default};
@@ -1,4 +1,4 @@
1
- import{c as C,r as s,j as e,v as _,X as H,l as Q,e as I,T as K,F as Y,m as ee}from"./index-pMxOIwXq.js";import{U as te}from"./upload-CdPJpSHC.js";import{C as se}from"./circle-alert-CmmVW-Pd.js";import{L as R}from"./loader-circle-BRuvorm2.js";import{C as ae}from"./code-xml-nWeketqj.js";/**
1
+ import{c as C,r as s,j as e,v as _,X as H,l as Q,e as I,T as K,F as Y,m as ee}from"./index-D8TYtITk.js";import{U as te}from"./upload-1HzIJHHR.js";import{C as se}from"./circle-alert-DVPtG3Pe.js";import{L as R}from"./loader-circle-DylW-nwq.js";import{C as ae}from"./code-xml-BPoxcFNK.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as U,r as u,j as t,a as P}from"./index-pMxOIwXq.js";import{E as K}from"./EvidenceReceiptPanel-2NY4n9gv.js";import{D as q}from"./dollar-sign-Blg6TO4y.js";import{L as Z}from"./layers-XWQKGXg0.js";import{T as O}from"./trending-up-DCHKPJLe.js";import{T as J}from"./trending-down-CxO3OYOB.js";/**
1
+ import{c as U,r as u,j as t,a as P}from"./index-D8TYtITk.js";import{E as K}from"./EvidenceReceiptPanel-F58cuFm9.js";import{D as q}from"./dollar-sign-Ui4BIml8.js";import{L as Z}from"./layers-Co1szEIf.js";import{T as O}from"./trending-up-Bq6qyKub.js";import{T as J}from"./trending-down-BiqiTPXx.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{j as e,J as t,a3 as s,a4 as o}from"./index-pMxOIwXq.js";function r(){return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full min-h-[60vh] p-8 text-center",children:[e.jsx("div",{className:"text-6xl font-heading font-bold text-primary/20 mb-4",children:"404"}),e.jsx("h1",{className:"text-h3 font-heading font-bold text-ink mb-2",children:"Page not found"}),e.jsx("p",{className:"text-sm text-muted-accessible mb-6 max-w-xs",children:"The page you are looking for does not exist or has been moved."}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:()=>window.history.back(),className:"inline-flex items-center gap-1.5 px-4 py-2 text-xs font-medium rounded-btn border border-border text-secondary hover:bg-hover transition-colors",children:[e.jsx(t,{size:14}),"Go Back"]}),e.jsxs(s,{to:"/",className:"inline-flex items-center gap-1.5 px-4 py-2 text-xs font-medium rounded-btn bg-primary text-white hover:bg-[#4432c4] transition-colors shadow-button",children:[e.jsx(o,{size:14}),"Home"]})]})]})}export{r as default};
1
+ import{j as e,J as t,a3 as s,a4 as o}from"./index-D8TYtITk.js";function r(){return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full min-h-[60vh] p-8 text-center",children:[e.jsx("div",{className:"text-6xl font-heading font-bold text-primary/20 mb-4",children:"404"}),e.jsx("h1",{className:"text-h3 font-heading font-bold text-ink mb-2",children:"Page not found"}),e.jsx("p",{className:"text-sm text-muted-accessible mb-6 max-w-xs",children:"The page you are looking for does not exist or has been moved."}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:()=>window.history.back(),className:"inline-flex items-center gap-1.5 px-4 py-2 text-xs font-medium rounded-btn border border-border text-secondary hover:bg-hover transition-colors",children:[e.jsx(t,{size:14}),"Go Back"]}),e.jsxs(s,{to:"/",className:"inline-flex items-center gap-1.5 px-4 py-2 text-xs font-medium rounded-btn bg-primary text-white hover:bg-[#4432c4] transition-colors shadow-button",children:[e.jsx(o,{size:14}),"Home"]})]})]})}export{r as default};