loki-mode 9.65.0 → 9.66.0

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 (67) hide show
  1. package/SKILL.md +2 -2
  2. package/VERSION +1 -1
  3. package/autonomy/completion-council.sh +18 -1
  4. package/dashboard/__init__.py +1 -1
  5. package/docs/INSTALLATION.md +1 -1
  6. package/loki-ts/dist/loki.js +2 -2
  7. package/mcp/__init__.py +1 -1
  8. package/package.json +1 -1
  9. package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
  10. package/web-app/dist/assets/{AdminPage-Oyx-w2Ch.js → AdminPage-ChUvLzkF.js} +1 -1
  11. package/web-app/dist/assets/{Avatar-D60m65JB.js → Avatar-Dpy96tAc.js} +1 -1
  12. package/web-app/dist/assets/{Badge-CqfZNaem.js → Badge-BOHHYZTu.js} +1 -1
  13. package/web-app/dist/assets/{Button-BqjzE4fz.js → Button-B_XqEF7a.js} +1 -1
  14. package/web-app/dist/assets/{CockpitPage-Czk7o_ou.js → CockpitPage-C0z5QwNJ.js} +1 -1
  15. package/web-app/dist/assets/{ComparePage-BEfTrTb1.js → ComparePage-KWL6acQk.js} +1 -1
  16. package/web-app/dist/assets/{ErrorBoundary-BrLk5nkO.js → ErrorBoundary-BbyBJ4ZP.js} +1 -1
  17. package/web-app/dist/assets/{EvidenceReceiptPanel-9vEpi5ir.js → EvidenceReceiptPanel-Btblkwfr.js} +1 -1
  18. package/web-app/dist/assets/{GitHubIssuesPanel-D6izZx0w.js → GitHubIssuesPanel-7Bi1t04Q.js} +1 -1
  19. package/web-app/dist/assets/{GitHubPRsPanel-BTkG2FgA.js → GitHubPRsPanel-BxZtNprq.js} +1 -1
  20. package/web-app/dist/assets/{HomePage-nsr4kpN1.js → HomePage-BxDh3-CD.js} +1 -1
  21. package/web-app/dist/assets/{LoginPage-BVblQrr9.js → LoginPage-DpXq4rQe.js} +1 -1
  22. package/web-app/dist/assets/{MagicPage-CmnSyLq7.js → MagicPage-DP2k0ioE.js} +1 -1
  23. package/web-app/dist/assets/{MetricsPage-BVfwU81j.js → MetricsPage-Dus04BUR.js} +1 -1
  24. package/web-app/dist/assets/{NotFoundPage-AYQ6uqqI.js → NotFoundPage--54yr9Cy.js} +1 -1
  25. package/web-app/dist/assets/{ProjectPage-DMnbw9X9.js → ProjectPage-Cs6LOI7R.js} +3 -3
  26. package/web-app/dist/assets/{ProjectsPage-CNVTAF2N.js → ProjectsPage-5cpa0X1d.js} +1 -1
  27. package/web-app/dist/assets/SettingsPage-Duc5ApRj.js +10 -0
  28. package/web-app/dist/assets/{ShowcasePage-2dBCjLXn.js → ShowcasePage-C1wrPZgl.js} +1 -1
  29. package/web-app/dist/assets/{SystemSettingsPage-Djo6IE4u.js → SystemSettingsPage-CoD3LARj.js} +1 -1
  30. package/web-app/dist/assets/{TeamsPage-CY8p-yxD.js → TeamsPage-GuQ4YDV5.js} +1 -1
  31. package/web-app/dist/assets/{TemplatesPage-B6iFgH6t.js → TemplatesPage-CvWecmzl.js} +1 -1
  32. package/web-app/dist/assets/{TerminalOutput-B3yzZe-h.js → TerminalOutput-DFZw34kD.js} +1 -1
  33. package/web-app/dist/assets/{activity-CNfAjtRv.js → activity-BvHkXBYj.js} +1 -1
  34. package/web-app/dist/assets/{bell-CMETsHPH.js → bell-Bw2j-HI7.js} +1 -1
  35. package/web-app/dist/assets/{bot-C9kXvk1i.js → bot-BRuEmshQ.js} +1 -1
  36. package/web-app/dist/assets/{check-BRK-zLB5.js → check-B5uToWdF.js} +1 -1
  37. package/web-app/dist/assets/{chevron-left-CxI5uD4g.js → chevron-left-D-tXeEPI.js} +1 -1
  38. package/web-app/dist/assets/{circle-alert-CVFRPWpv.js → circle-alert-p3-Bg3sx.js} +1 -1
  39. package/web-app/dist/assets/{clock-CLYV8a_x.js → clock-CJc_91vp.js} +1 -1
  40. package/web-app/dist/assets/{cloud-CiISiIOa.js → cloud-lhmojUN8.js} +1 -1
  41. package/web-app/dist/assets/{code-xml-DHsgqwV-.js → code-xml-DMvQ2jw1.js} +1 -1
  42. package/web-app/dist/assets/{database-DbvUqtz3.js → database-EdwkplCN.js} +1 -1
  43. package/web-app/dist/assets/{dollar-sign-Ct0lRPHw.js → dollar-sign-BQiPo9Co.js} +1 -1
  44. package/web-app/dist/assets/{file-code-corner-D1sjFEh7.js → file-code-corner-CXUzs2z1.js} +1 -1
  45. package/web-app/dist/assets/{file-plus-DnmX18Fi.js → file-plus-hS0xkTL5.js} +1 -1
  46. package/web-app/dist/assets/{globe-bSpDNgoA.js → globe-B6Xk69Fj.js} +1 -1
  47. package/web-app/dist/assets/{hammer-Bj41Kvlq.js → hammer-B_evoVEr.js} +1 -1
  48. package/web-app/dist/assets/{index-CxajNJVu.js → index-XZrgDphJ.js} +2 -2
  49. package/web-app/dist/assets/{layers-BNtBwYER.js → layers-Bb295b4u.js} +1 -1
  50. package/web-app/dist/assets/{loader-circle-YY_VZofG.js → loader-circle-C8cKZhjP.js} +1 -1
  51. package/web-app/dist/assets/{lock-rpjEPVoC.js → lock-DcC9B8sE.js} +1 -1
  52. package/web-app/dist/assets/{package-desXU6XA.js → package-BFz4FYcR.js} +1 -1
  53. package/web-app/dist/assets/{plus-7AoOU-I9.js → plus-aS4YpFPG.js} +1 -1
  54. package/web-app/dist/assets/{refresh-cw-oNj-Xn4B.js → refresh-cw-B9_ksndc.js} +1 -1
  55. package/web-app/dist/assets/{rotate-ccw-DeiFjfVO.js → rotate-ccw-CBogZEoT.js} +1 -1
  56. package/web-app/dist/assets/{scroll-text-Q9AzWiNV.js → scroll-text-DMGgO6uq.js} +1 -1
  57. package/web-app/dist/assets/{server-DKgVwfek.js → server-CsEqUM8R.js} +1 -1
  58. package/web-app/dist/assets/{shield-alert-G6x-bS-I.js → shield-alert-Btnj6tmQ.js} +1 -1
  59. package/web-app/dist/assets/{thumbs-up-Qhk0yvw0.js → thumbs-up-C_NLSPqa.js} +1 -1
  60. package/web-app/dist/assets/{trash-2-D23gvznl.js → trash-2-zqZc9cSK.js} +1 -1
  61. package/web-app/dist/assets/{trending-down-CSQClPrr.js → trending-down-BGQh2rVE.js} +1 -1
  62. package/web-app/dist/assets/{trending-up-sjMSd1wc.js → trending-up-C31TrzUt.js} +1 -1
  63. package/web-app/dist/assets/{upload-Dchovhld.js → upload-CLwWKjCG.js} +1 -1
  64. package/web-app/dist/assets/{usePolling-DwLceXwF.js → usePolling-8wwOP53Y.js} +1 -1
  65. package/web-app/dist/assets/{user-BqZM8CmD.js → user-DUkbxibF.js} +1 -1
  66. package/web-app/dist/index.html +1 -1
  67. package/web-app/dist/assets/SettingsPage-D1_qasFD.js +0 -10
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitHubIssuesPanel-D6izZx0w.js","assets/index-CxajNJVu.js","assets/index-BfQ0f3-S.css","assets/Button-BqjzE4fz.js","assets/thumbs-up-Qhk0yvw0.js","assets/refresh-cw-oNj-Xn4B.js","assets/circle-alert-CVFRPWpv.js","assets/user-BqZM8CmD.js","assets/loader-circle-YY_VZofG.js","assets/rotate-ccw-DeiFjfVO.js","assets/GitHubPRsPanel-BTkG2FgA.js","assets/chevron-left-CxI5uD4g.js","assets/shield-alert-G6x-bS-I.js","assets/file-code-corner-D1sjFEh7.js","assets/clock-CLYV8a_x.js","assets/check-BRK-zLB5.js","assets/ErrorBoundary-BrLk5nkO.js","assets/TerminalOutput-B3yzZe-h.js","assets/lock-rpjEPVoC.js","assets/package-desXU6XA.js","assets/file-plus-DnmX18Fi.js","assets/activity-CNfAjtRv.js","assets/scroll-text-Q9AzWiNV.js","assets/bot-C9kXvk1i.js","assets/hammer-Bj41Kvlq.js","assets/dollar-sign-Ct0lRPHw.js","assets/globe-bSpDNgoA.js","assets/trash-2-D23gvznl.js","assets/upload-Dchovhld.js","assets/plus-7AoOU-I9.js","assets/code-xml-DHsgqwV-.js","assets/trending-up-sjMSd1wc.js","assets/layers-BNtBwYER.js","assets/trending-down-CSQClPrr.js","assets/server-DKgVwfek.js"])))=>i.map(i=>d[i]);
2
- var ra=e=>{throw TypeError(e)};var na=(e,t,s)=>t.has(e)||ra("Cannot "+s);var Us=(e,t,s)=>(na(e,t,"read from private field"),s?s.call(e):t.get(e)),oa=(e,t,s)=>t.has(e)?ra("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),aa=(e,t,s,i)=>(na(e,t,"write to private field"),i?i.call(e,s):t.set(e,s),s);import{c as ae,r as d,W as Ms,j as r,e as sn,f as Vl,g as mr,h as ms,I as xd,T as Ut,R as Kt,i as os,M as Gl,k as sr,l as ps,S as Yl,U as vd,X as gt,m as as,Z as Ls,a as W,E as ls,G as Te,K as bd,n as yd,o as Sd,F as _i,P as rs,_ as eo,p as pr,q as Xl,s as wd,t as Cd,v as kd,A as to,L as Nd,B as Js,w as rn,x as jd,d as Ed,y as Es,z as la,D as ca,H as Dd,J as Jl,N as oi,O as Rd,u as Pd}from"./index-CxajNJVu.js";import{R as Md,S as ir,P as Zl,E as Wi}from"./ErrorBoundary-BrLk5nkO.js";import{B as le}from"./Button-BqjzE4fz.js";import{T as Ld,F as Bd}from"./TerminalOutput-B3yzZe-h.js";import{P as Ql}from"./package-desXU6XA.js";import{F as Q}from"./file-code-corner-D1sjFEh7.js";import{F as _r}from"./file-plus-DnmX18Fi.js";import{C as ut}from"./clock-CLYV8a_x.js";import{A as Td}from"./activity-CNfAjtRv.js";import{S as zd}from"./scroll-text-Q9AzWiNV.js";import{B as Ad}from"./bot-C9kXvk1i.js";import{C as Yt}from"./check-BRK-zLB5.js";import{L as gi}from"./loader-circle-YY_VZofG.js";import{H as Od}from"./hammer-Bj41Kvlq.js";import{D as ec}from"./dollar-sign-Ct0lRPHw.js";import{R as bt}from"./refresh-cw-oNj-Xn4B.js";import{C as _s}from"./circle-alert-CVFRPWpv.js";import{G as nn}from"./globe-bSpDNgoA.js";import{C as so,T as io,F as on}from"./trash-2-D23gvznl.js";import{C as $d,G as an,a as tc,F as sc,H as rr,M as ic,T as Id}from"./thumbs-up-Qhk0yvw0.js";import{U as rc}from"./upload-Dchovhld.js";import{P as gr}from"./plus-7AoOU-I9.js";import{R as nc,E as Fd}from"./rotate-ccw-DeiFjfVO.js";import{C as ln}from"./code-xml-DHsgqwV-.js";import{T as Hd}from"./trending-up-sjMSd1wc.js";import{L as Wd}from"./layers-BNtBwYER.js";import{T as Ud}from"./trending-down-CSQClPrr.js";import{S as Kd}from"./server-DKgVwfek.js";/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitHubIssuesPanel-7Bi1t04Q.js","assets/index-XZrgDphJ.js","assets/index-BfQ0f3-S.css","assets/Button-B_XqEF7a.js","assets/thumbs-up-C_NLSPqa.js","assets/refresh-cw-B9_ksndc.js","assets/circle-alert-p3-Bg3sx.js","assets/user-DUkbxibF.js","assets/loader-circle-C8cKZhjP.js","assets/rotate-ccw-CBogZEoT.js","assets/GitHubPRsPanel-BxZtNprq.js","assets/chevron-left-D-tXeEPI.js","assets/shield-alert-Btnj6tmQ.js","assets/file-code-corner-CXUzs2z1.js","assets/clock-CJc_91vp.js","assets/check-B5uToWdF.js","assets/ErrorBoundary-BbyBJ4ZP.js","assets/TerminalOutput-DFZw34kD.js","assets/lock-DcC9B8sE.js","assets/package-BFz4FYcR.js","assets/file-plus-hS0xkTL5.js","assets/activity-BvHkXBYj.js","assets/scroll-text-DMGgO6uq.js","assets/bot-BRuEmshQ.js","assets/hammer-B_evoVEr.js","assets/dollar-sign-BQiPo9Co.js","assets/globe-B6Xk69Fj.js","assets/trash-2-zqZc9cSK.js","assets/upload-CLwWKjCG.js","assets/plus-aS4YpFPG.js","assets/code-xml-DMvQ2jw1.js","assets/trending-up-C31TrzUt.js","assets/layers-Bb295b4u.js","assets/trending-down-BGQh2rVE.js","assets/server-CsEqUM8R.js"])))=>i.map(i=>d[i]);
2
+ var ra=e=>{throw TypeError(e)};var na=(e,t,s)=>t.has(e)||ra("Cannot "+s);var Us=(e,t,s)=>(na(e,t,"read from private field"),s?s.call(e):t.get(e)),oa=(e,t,s)=>t.has(e)?ra("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),aa=(e,t,s,i)=>(na(e,t,"write to private field"),i?i.call(e,s):t.set(e,s),s);import{c as ae,r as d,W as Ms,j as r,e as sn,f as Vl,g as mr,h as ms,I as xd,T as Ut,R as Kt,i as os,M as Gl,k as sr,l as ps,S as Yl,U as vd,X as gt,m as as,Z as Ls,a as W,E as ls,G as Te,K as bd,n as yd,o as Sd,F as _i,P as rs,_ as eo,p as pr,q as Xl,s as wd,t as Cd,v as kd,A as to,L as Nd,B as Js,w as rn,x as jd,d as Ed,y as Es,z as la,D as ca,H as Dd,J as Jl,N as oi,O as Rd,u as Pd}from"./index-XZrgDphJ.js";import{R as Md,S as ir,P as Zl,E as Wi}from"./ErrorBoundary-BbyBJ4ZP.js";import{B as le}from"./Button-B_XqEF7a.js";import{T as Ld,F as Bd}from"./TerminalOutput-DFZw34kD.js";import{P as Ql}from"./package-BFz4FYcR.js";import{F as Q}from"./file-code-corner-CXUzs2z1.js";import{F as _r}from"./file-plus-hS0xkTL5.js";import{C as ut}from"./clock-CJc_91vp.js";import{A as Td}from"./activity-BvHkXBYj.js";import{S as zd}from"./scroll-text-DMGgO6uq.js";import{B as Ad}from"./bot-BRuEmshQ.js";import{C as Yt}from"./check-B5uToWdF.js";import{L as gi}from"./loader-circle-C8cKZhjP.js";import{H as Od}from"./hammer-B_evoVEr.js";import{D as ec}from"./dollar-sign-BQiPo9Co.js";import{R as bt}from"./refresh-cw-B9_ksndc.js";import{C as _s}from"./circle-alert-p3-Bg3sx.js";import{G as nn}from"./globe-B6Xk69Fj.js";import{C as so,T as io,F as on}from"./trash-2-zqZc9cSK.js";import{C as $d,G as an,a as tc,F as sc,H as rr,M as ic,T as Id}from"./thumbs-up-C_NLSPqa.js";import{U as rc}from"./upload-CLwWKjCG.js";import{P as gr}from"./plus-aS4YpFPG.js";import{R as nc,E as Fd}from"./rotate-ccw-CBogZEoT.js";import{C as ln}from"./code-xml-DMvQ2jw1.js";import{T as Hd}from"./trending-up-C31TrzUt.js";import{L as Wd}from"./layers-Bb295b4u.js";import{T as Ud}from"./trending-down-BGQh2rVE.js";import{S as Kd}from"./server-CsEqUM8R.js";/**
3
3
  * @license lucide-react v0.577.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
@@ -222,7 +222,7 @@ WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){t
222
222
  \x1B[31m-- Terminal disconnected. Max reconnect attempts reached. Refresh the page to try again. --\x1B[0m`);return}const y=Math.min(Zg*Math.pow(2,x),Qg);h.current=x+1,_&&_.writeln(`\r
223
223
  \x1B[33m-- Terminal disconnected. Reconnecting in ${(y/1e3).toFixed(0)}s (attempt ${x+1}/${jl})... --\x1B[0m`),a.current=setTimeout(()=>{l.current&&f()},y)},g.onerror=()=>{}},[e,c]);return d.useEffect(()=>{l.current=!0,h.current=0;const p=s.current;if(!p)return;const u=new Hg({cursorBlink:!0,fontSize:13,fontFamily:"'JetBrains Mono', 'Fira Code', 'Cascadia Code', Menlo, Monaco, monospace",theme:{background:"#1a1a2e",foreground:"#e0e0e0",cursor:"#a78bfa",selectionBackground:"#3d3d5c",black:"#1a1a2e",red:"#ff6b6b",green:"#51cf66",yellow:"#ffd43b",blue:"#74c0fc",magenta:"#da77f2",cyan:"#66d9ef",white:"#e0e0e0",brightBlack:"#4a4a6a",brightRed:"#ff8787",brightGreen:"#69db7c",brightYellow:"#ffe066",brightBlue:"#91d5ff",brightMagenta:"#e599f7",brightCyan:"#99f7f5",brightWhite:"#ffffff"},scrollback:1e4,convertEol:!0,allowProposedApi:!0}),g=new Kg,m=new Jg;u.loadAddon(g),u.loadAddon(m),u.open(p),i.current=u,n.current=g;try{g.fit()}catch{}u.onData(y=>{const v=o.current;v&&v.readyState===WebSocket.OPEN&&v.send(JSON.stringify({type:"input",data:y}))}),f();let _=null;const x=new ResizeObserver(()=>{_&&clearTimeout(_),_=setTimeout(()=>{if(!(!n.current||!i.current))try{n.current.fit(),c()}catch{}},50)});return x.observe(p),()=>{l.current=!1,x.disconnect(),_&&clearTimeout(_),a.current&&clearTimeout(a.current),o.current&&(o.current.onclose=null,o.current.close(),o.current=null),u.dispose(),i.current=null,n.current=null}},[f,c]),d.useEffect(()=>{if(t&&n.current&&i.current){const p=setTimeout(()=>{var u;try{(u=n.current)==null||u.fit(),c()}catch{}},50);return()=>clearTimeout(p)}},[t,c]),r.jsx("div",{ref:s,className:"h-full w-full",style:{backgroundColor:"#1a1a2e"}})}const El={file_created:{icon:_r,color:"bg-blue-500",bgColor:"bg-blue-500/10",labelColor:"text-blue-600"},file_modified:{icon:Q,color:"bg-blue-400",bgColor:"bg-blue-400/10",labelColor:"text-blue-500"},dependency_install:{icon:Ql,color:"bg-teal-500",bgColor:"bg-teal-500/10",labelColor:"text-teal-600"},test_pass:{icon:ps,color:"bg-green-500",bgColor:"bg-green-500/10",labelColor:"text-green-600"},test_fail:{icon:sr,color:"bg-red-500",bgColor:"bg-red-500/10",labelColor:"text-red-500"},error:{icon:sr,color:"bg-red-500",bgColor:"bg-red-500/10",labelColor:"text-red-500"},narration:{icon:Gl,color:"bg-purple-500",bgColor:"bg-purple-500/10",labelColor:"text-purple-600"},command:{icon:os,color:"bg-gray-500",bgColor:"bg-gray-500/10",labelColor:"text-gray-600"},phase_change:{icon:Kt,color:"bg-primary",bgColor:"bg-primary/10",labelColor:"text-primary"},deploy:{icon:Kt,color:"bg-primary",bgColor:"bg-primary/10",labelColor:"text-primary"},warning:{icon:Ut,color:"bg-yellow-500",bgColor:"bg-yellow-500/10",labelColor:"text-yellow-600"},info:{icon:xd,color:"bg-gray-400",bgColor:"bg-gray-400/10",labelColor:"text-gray-500"}};function Dl(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return""}}function tx({event:e,isLast:t,onFileClick:s}){const i=El[e.type]||El.info,n=i.icon,o=e.type==="narration";return r.jsxs("div",{className:"flex gap-3 group",children:[r.jsxs("div",{className:"flex flex-col items-center flex-shrink-0",children:[r.jsx("div",{className:`w-7 h-7 rounded-full flex items-center justify-center ${i.bgColor}`,children:r.jsx(n,{size:14,className:i.labelColor})}),!t&&r.jsx("div",{className:"w-px flex-1 bg-border min-h-[16px]"})]}),r.jsx("div",{className:"flex-1 min-w-0 pb-4 ",children:o?r.jsxs("div",{className:"relative bg-purple-500/5 border border-purple-500/20 rounded-lg px-3 py-2 mt-0.5",children:[r.jsx("div",{className:"absolute -left-1.5 top-2.5 w-2.5 h-2.5 bg-purple-500/5 border-l border-b border-purple-500/20 rotate-45"}),r.jsx("p",{className:"text-xs text-ink leading-relaxed",children:e.message}),e.detail&&r.jsx("p",{className:"text-[11px] text-muted mt-1 leading-relaxed",children:e.detail}),r.jsxs("span",{className:"text-[10px] text-muted/60 mt-1.5 flex items-center gap-1",children:[r.jsx(ut,{size:10}),Dl(e.timestamp)]})]}):r.jsxs("div",{className:"mt-1",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("span",{className:`text-xs font-medium ${i.labelColor}`,children:e.message}),e.filePath&&s&&r.jsx("button",{onClick:()=>s(e.filePath),className:"text-[11px] font-mono text-primary hover:text-primary/80 hover:underline truncate max-w-[200px]",title:e.filePath,children:e.filePath})]}),r.jsxs("span",{className:"text-[10px] text-muted/60 flex items-center gap-1 mt-0.5",children:[r.jsx(ut,{size:10}),Dl(e.timestamp)]})]})})]})}const Xr=20,Rl=10;function sx({events:e,onFileClick:t,maxHeight:s}){const i=d.useRef(null),[n,o]=d.useState(!0);if(d.useEffect(()=>{i.current&&(i.current.scrollTop=i.current.scrollHeight)},[e.length]),d.useEffect(()=>{e.length>Xr},[e.length,n]),e.length===0)return r.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-center",children:[r.jsx(Vl,{size:28,className:"text-muted/30 mb-3"}),r.jsx("p",{className:"text-xs text-muted font-medium",children:"No build events yet"}),r.jsx("p",{className:"text-[11px] text-muted/70 mt-1",children:"Events will appear here as the build progresses."})]});const a=e.length>Xr&&n,l=a?e.slice(-Rl):e,h=a?e.length-Rl:0;return r.jsxs("div",{ref:i,className:"overflow-y-auto terminal-scroll px-3 py-3",style:{maxHeight:s||"100%"},children:[a&&h>0&&r.jsxs("button",{onClick:()=>o(!1),className:"flex items-center gap-1.5 text-[11px] text-primary hover:text-primary/80 font-medium mb-3 ml-9",children:[r.jsx(mr,{size:12}),"Show ",h," earlier event",h!==1?"s":""]}),!n&&e.length>Xr&&r.jsxs("button",{onClick:()=>o(!0),className:"flex items-center gap-1.5 text-[11px] text-primary hover:text-primary/80 font-medium mb-3 ml-9",children:[r.jsx(ms,{size:12}),"Collapse older events"]}),l.map((c,f)=>r.jsx(tx,{event:c,isLast:f===l.length-1,onFileClick:t},c.id))]})}const Pl=[{id:"terminal",label:"Terminal",icon:os,alwaysShow:!0},{id:"activity",label:"Activity",icon:Td,alwaysShow:!0},{id:"build",label:"Build Log",icon:zd},{id:"agents",label:"Agents",icon:Ad},{id:"quality",label:"Quality",icon:Yl}];function ix({status:e}){switch(e){case"pass":return r.jsx(Yt,{size:14,className:"text-success"});case"fail":return r.jsx(gt,{size:14,className:"text-danger"});default:return r.jsx(ut,{size:14,className:"text-muted"})}}function rx({agents:e}){return!e||e.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full",children:[r.jsx(vd,{size:24,className:"text-muted/30 mb-2"}),r.jsx("p",{className:"text-xs text-muted font-medium",children:"No agents active"}),r.jsx("p",{className:"text-[11px] text-muted/70 mt-0.5",children:"Agents appear here during active builds"})]}):r.jsx("div",{className:"p-2 space-y-1 overflow-y-auto terminal-scroll",children:e.map(t=>r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-btn bg-hover text-xs",children:[r.jsx("span",{className:"font-semibold text-ink truncate",children:t.name}),r.jsx("span",{className:"text-xs font-mono text-muted-accessible px-1.5 py-0.5 rounded-btn bg-card",children:t.type}),r.jsx("span",{className:`text-xs font-semibold ${t.status==="running"?"text-success":"text-muted"}`,children:t.status}),r.jsx("span",{className:"ml-auto text-xs text-muted-accessible font-mono truncate max-w-[200px]",children:t.task})]},t.id))})}function nx({checklist:e}){return!e||!e.items||e.items.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full",children:[r.jsx(Yl,{size:24,className:"text-muted/30 mb-2"}),r.jsx("p",{className:"text-xs text-muted font-medium",children:"No quality gate data"}),r.jsx("p",{className:"text-[11px] text-muted/70 mt-0.5",children:"Quality gates appear during active builds"})]}):r.jsxs("div",{className:"p-2 space-y-1 overflow-y-auto terminal-scroll",children:[r.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 text-xs text-muted-accessible font-semibold uppercase",children:[r.jsx("span",{children:"Gate"}),r.jsxs("span",{className:"ml-auto",children:[e.passed,"/",e.total," passed"]})]}),e.items.map(t=>r.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-btn hover:bg-hover text-xs",children:[r.jsx(ix,{status:t.status}),r.jsx("span",{className:"text-ink",children:t.label}),t.details&&r.jsx("span",{className:"ml-auto text-xs text-muted-accessible truncate max-w-[200px]",children:t.details})]},t.id))]})}function ox({logs:e,logsLoading:t,agents:s,checklist:i,sessionId:n,isRunning:o,subscribe:a,buildEvents:l,onFileClick:h}){var _;const[c,f]=d.useState("terminal"),p=s&&s.length>0,u=i&&i.items&&i.items.length>0,g=e&&e.length>0,m=Pl.filter(x=>!!(x.alwaysShow||x.id==="build"&&(g||o)||x.id==="agents"&&(p||o)||x.id==="quality"&&(u||o)));return m.find(x=>x.id===c)||f("terminal"),r.jsxs("div",{className:"h-full flex flex-col bg-card",children:[r.jsx("div",{role:"tablist",className:"flex items-center border-b border-border px-2 flex-shrink-0",children:m.map(x=>{const y=x.icon,v=c===x.id;return r.jsxs("button",{role:"tab","aria-selected":v,onClick:()=>f(x.id),className:`flex items-center gap-1.5 px-3 py-2 text-xs font-medium transition-colors border-b-2 ${v?"border-primary text-primary":"border-transparent text-muted hover:text-ink"}`,children:[r.jsx(y,{size:14}),x.label,x.id==="agents"&&p&&r.jsx("span",{className:"ml-0.5 px-1.5 py-0.5 text-[10px] font-bold rounded-full bg-primary/10 text-primary",children:s.length}),x.id==="quality"&&u&&r.jsxs("span",{className:"ml-0.5 px-1.5 py-0.5 text-[10px] font-bold rounded-full bg-success/10 text-success",children:[i.passed,"/",i.total]})]},x.id)})}),r.jsxs("div",{role:"tabpanel","aria-label":(_=Pl.find(x=>x.id===c))==null?void 0:_.label,className:"flex-1 min-h-0 overflow-hidden relative",children:[r.jsx("div",{className:"absolute inset-0",style:{visibility:c==="terminal"?"visible":"hidden",zIndex:c==="terminal"?1:0},children:r.jsx(ex,{sessionId:n,isActive:c==="terminal"})}),c==="build"&&r.jsx(Ld,{logs:e,loading:t,subscribe:a}),c==="agents"&&r.jsx(rx,{agents:s}),c==="activity"&&r.jsx(sx,{events:l||[],onFileClick:h}),c==="quality"&&r.jsx(nx,{checklist:i})]})]})}const Ml={ai:["Warming up the AI...","Reading your code...","Thinking about the best approach...","Running quality checks...","Almost there..."],build:["Working..."],deploy:["Preparing containers...","Pushing to the cloud...","Configuring services...","Running health checks...","Almost live..."],general:["Loading...","Getting things ready...","Just a moment...","Fetching data...","Almost there..."]};function ax({context:e="general",className:t=""}){const s=Ml[e]||Ml.general,[i,n]=d.useState(0),[o,a]=d.useState(!1);return d.useEffect(()=>{if(s.length<2)return;const l=setInterval(()=>{a(!0),setTimeout(()=>{n(h=>(h+1)%s.length),a(!1)},300)},3e3);return()=>clearInterval(l)},[s.length]),r.jsxs("div",{className:`flex items-center gap-2 ${t}`,children:[r.jsx(gi,{size:14,className:"animate-spin text-primary/60"}),r.jsx("span",{className:`text-xs text-muted transition-opacity duration-300 ${o?"opacity-0":"opacity-100"}`,children:s[i]})]})}const Jr=[{id:"planning",label:"Plan",color:"bg-blue-500",textColor:"text-blue-500",icon:eu},{id:"building",label:"Build",color:"bg-primary",textColor:"text-primary",icon:Od},{id:"testing",label:"Test",color:"bg-teal",textColor:"text-teal",icon:ai},{id:"reviewing",label:"Review",color:"bg-warning",textColor:"text-warning",icon:as},{id:"complete",label:"Done",color:"bg-success",textColor:"text-success",icon:ps}];function lx({phase:e,iteration:t,maxIterations:s,cost:i,startTime:n,isRunning:o}){const[a,l]=d.useState(null),[h,c]=d.useState(e),[f,p]=d.useState(!1);if(d.useEffect(()=>{if(!o||!n)return;const x=setInterval(()=>{l(Math.floor((Date.now()-n)/1e3))},1e3);return()=>clearInterval(x)},[o,n]),d.useEffect(()=>{if(e!==h){p(!0);const x=setTimeout(()=>{c(e),p(!1)},400);return()=>clearTimeout(x)}},[e,h]),!o&&e==="idle")return null;const u=Jr.findIndex(x=>x.id===e),g=t!==null&&s?Math.min(t/s*100,100):0,m=a!==null&&t&&s?Math.ceil(a/t*Math.max(0,s-t)):null,_=x=>x<60?`${x}s`:`${Math.floor(x/60)}m ${x%60}s`;return r.jsxs("div",{className:"flex-shrink-0 build-progress-container",children:[r.jsxs("div",{className:"h-1 bg-border relative overflow-hidden",children:[r.jsx("div",{className:"h-full bg-gradient-to-r from-primary to-teal build-progress-bar",style:{width:`${g}%`}}),o&&r.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent animate-shimmer"})]}),r.jsxs("div",{className:`px-4 py-1.5 flex items-center gap-4 bg-card border-b border-border text-xs ${f?"phase-transitioning":""}`,children:[r.jsx("div",{className:"flex items-center gap-1",children:Jr.map((x,y)=>{const v=y<u,j=y===u,k=x.icon;return r.jsxs("div",{className:`flex items-center gap-1 phase-indicator ${j?"phase-indicator-active":""} ${v?"phase-indicator-complete":""}`,children:[r.jsx("div",{className:`phase-icon-wrapper ${j?"phase-icon-active":""} ${v?"phase-icon-complete":""}`,children:v?r.jsx(ps,{size:14,className:"text-success phase-check-enter"}):j?r.jsx(k,{size:14,className:`${x.textColor} phase-icon-spin`}):r.jsx(k,{size:14,className:"text-muted/40"})}),r.jsx("span",{className:`text-[11px] font-medium transition-all duration-300 ${j?"text-ink":v?"text-success":"text-muted/50"}`,children:x.label}),y<Jr.length-1&&r.jsx("div",{className:`mx-1 h-px w-4 transition-all duration-500 ${v?"bg-success":"bg-border"}`})]},x.id)})}),o&&e!=="complete"&&e!=="idle"&&r.jsx(ax,{context:"build"}),r.jsx("div",{className:"flex-1"}),r.jsxs("div",{className:"flex items-center gap-3 text-muted",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ls,{size:12}),"Iter ",t??"--",s?`/${s}`:""]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ut,{size:12}),a===null?"--":_(a),o&&m!==null&&m>0&&r.jsxs("span",{className:"text-muted/60",children:["(est. ",_(m)," to iteration cap)"]})]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ec,{size:12}),i!==null?`$${i.toFixed(2)}`:"not recorded"]})]})]})]})}const Zr=[{id:"vercel",name:"Vercel",description:"Optimized for Next.js, React, and static sites with global CDN.",initial:"V",color:"text-ink",bgColor:"bg-ink/10",borderColor:"border-ink/20",tokenUrl:"https://vercel.com/account/tokens",tokenUrlLabel:"Get your token from vercel.com/account/tokens",hasTokenAuth:!0},{id:"netlify",name:"Netlify",description:"Deploy with CI/CD, serverless functions, and form handling.",initial:"N",color:"text-teal-600",bgColor:"bg-teal-500/10",borderColor:"border-teal-500/20",tokenUrl:"https://app.netlify.com/user/applications#personal-access-tokens",tokenUrlLabel:"Get your token from app.netlify.com/user/applications",hasTokenAuth:!0},{id:"github",name:"GitHub",description:"Free hosting for static sites directly from a GitHub repository.",initial:"G",color:"text-purple-600",bgColor:"bg-purple-500/10",borderColor:"border-purple-500/20",tokenUrl:"https://cli.github.com/",tokenUrlLabel:"Install GitHub CLI",hasTokenAuth:!1}];function cx({platform:e,onConnect:t}){const[s,i]=d.useState(""),[n,o]=d.useState(!1),[a,l]=d.useState(null),h=d.useCallback(async c=>{if(c.preventDefault(),!!s.trim()){o(!0),l(null);try{await t(s.trim()),i("")}catch(f){l(f instanceof Error?f.message:"Connection failed")}finally{o(!1)}}},[s,t]);return r.jsxs("form",{onSubmit:h,className:"mt-3 space-y-2.5",children:[r.jsxs("div",{children:[r.jsxs("label",{htmlFor:`token-${e.id}`,className:"sr-only",children:[e.name," Token"]}),r.jsx("input",{id:`token-${e.id}`,type:"password",value:s,onChange:c=>i(c.target.value),placeholder:`${e.name} access token`,disabled:n,className:`w-full px-3 py-2 text-sm border border-border rounded-lg bg-card text-ink
224
224
  focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary
225
- placeholder:text-muted disabled:opacity-50`})]}),r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("a",{href:e.tokenUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-[11px] text-primary hover:underline",children:[e.tokenUrlLabel,r.jsx(ls,{size:10})]}),r.jsx(le,{type:"submit",variant:"primary",size:"sm",loading:n,disabled:!s.trim()||n,children:"Connect"})]}),a&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-red-500 mt-1",children:[r.jsx(_s,{size:12}),a]})]})}function hx(){return r.jsxs("div",{className:"mt-3 space-y-2",children:[r.jsxs("div",{className:"flex items-start gap-2 bg-amber-500/5 border border-amber-500/15 rounded-lg px-3 py-2.5",children:[r.jsx(os,{size:14,className:"text-amber-600 flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"text-xs text-muted leading-relaxed",children:[r.jsx("p",{className:"font-medium text-ink mb-1",children:"Run in your terminal:"}),r.jsx("code",{className:"block bg-ink/5 rounded px-2 py-1 font-mono text-[11px] text-ink",children:"gh auth login"})]})]}),r.jsxs("a",{href:"https://cli.github.com/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-[11px] text-primary hover:underline",children:["Install GitHub CLI",r.jsx(ls,{size:10})]})]})}function dx({platform:e,status:t,onConnect:s,onDisconnect:i}){const[n,o]=d.useState(!1),[a,l]=d.useState(!1),h=d.useCallback(async()=>{l(!0);try{i()}finally{l(!1)}},[i]),c=d.useCallback(async f=>{await s(f),o(!1)},[s]);return r.jsxs("div",{className:`border rounded-lg p-4 transition-colors ${t.connected?"border-green-500/30 bg-green-500/5":"border-border hover:border-primary/30 hover:bg-hover"}`,children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:`w-10 h-10 rounded-lg flex items-center justify-center ${e.bgColor}`,children:r.jsx("span",{className:`text-sm font-bold ${e.color}`,children:e.initial})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h4",{className:"text-sm font-semibold text-ink",children:e.name}),r.jsx("p",{className:"text-[11px] text-muted leading-snug mt-0.5",children:e.description})]}),r.jsx("div",{className:"flex-shrink-0",children:r.jsx("span",{className:`inline-block w-2.5 h-2.5 rounded-full ${t.connected?"bg-green-500":"bg-gray-300"}`,title:t.connected?"Connected":"Not connected"})})]}),t.connected?r.jsxs("div",{className:"mt-3 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-green-600 font-medium",children:[r.jsx(ps,{size:14}),"Connected as ",t.user||"unknown"]}),t.last_deployed&&r.jsxs("p",{className:"text-[11px] text-muted",children:["Last deployed: ",new Date(t.last_deployed).toLocaleString()]}),r.jsx(le,{variant:"danger",size:"sm",icon:Iu,onClick:h,loading:a,className:"w-full",children:"Disconnect"})]}):r.jsxs(r.Fragment,{children:[t.error&&r.jsxs("div",{className:"mt-3 flex items-start gap-2 bg-red-500/5 border border-red-500/15 rounded-lg px-3 py-2",children:[r.jsx(_s,{size:14,className:"text-red-500 flex-shrink-0 mt-0.5"}),r.jsx("span",{className:"text-xs text-red-600",children:t.error})]}),e.hasTokenAuth?r.jsxs(r.Fragment,{children:[!n&&r.jsx("div",{className:"mt-3",children:r.jsx(le,{variant:"secondary",size:"sm",onClick:()=>o(!0),className:"w-full",children:t.error?`Reconnect ${e.name}`:`Connect ${e.name}`})}),n&&r.jsx(cx,{platform:e,onConnect:c})]}):r.jsx(hx,{})]})]})}function ux({compact:e=!1,onStatusChange:t}){const[s,i]=d.useState({vercel:{connected:!1},netlify:{connected:!1},github:{connected:!1}}),[n,o]=d.useState(!0),[a,l]=d.useState(null),h=d.useCallback(async()=>{try{const m=await W.getDeployStatus();i(m),t==null||t(m),l(null)}catch(m){l(m instanceof Error?m.message:"Failed to fetch connection status")}finally{o(!1)}},[t]);d.useEffect(()=>{h();const m=setInterval(h,3e4);return()=>clearInterval(m)},[h]);const c=d.useCallback(async m=>{const _=await W.connectVercel(m);_.success&&(i(x=>({...x,vercel:{connected:!0,user:_.user}})),t==null||t({...s,vercel:{connected:!0,user:_.user}}))},[s,t]),f=d.useCallback(async m=>{const _=await W.connectNetlify(m);_.success&&(i(x=>({...x,netlify:{connected:!0,user:_.user}})),t==null||t({...s,netlify:{connected:!0,user:_.user}}))},[s,t]),p=d.useCallback(async m=>{await W.disconnectPlatform(m),i(x=>({...x,[m]:{connected:!1}}));const _={...s,[m]:{connected:!1}};t==null||t(_)},[s,t]),u={vercel:c,netlify:f,github:async()=>{}};if(n)return r.jsxs("div",{className:"flex items-center justify-center py-8",children:[r.jsx(gi,{size:20,className:"text-primary animate-spin"}),r.jsx("span",{className:"text-sm text-muted ml-2",children:"Loading connections..."})]});const g=[s.vercel,s.netlify,s.github].filter(m=>m.connected).length;return r.jsxs("div",{className:e?"space-y-3":"space-y-4",children:[!e&&r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-semibold text-ink",children:"Platform Connections"}),r.jsxs("p",{className:"text-[11px] text-muted mt-0.5",children:[g," of ",Zr.length," platforms connected"]})]}),r.jsx("button",{onClick:h,className:"p-1.5 text-muted hover:text-ink rounded transition-colors",title:"Refresh connection status",children:r.jsx(bt,{size:14})})]}),e&&r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{className:"flex items-center gap-3",children:Zr.map(m=>{const _=s[m.id];return r.jsxs("div",{className:"flex items-center gap-1.5",title:`${m.name}: ${_.connected?`Connected as ${_.user}`:"Not connected"}`,children:[r.jsx("span",{className:`w-2 h-2 rounded-full ${_.connected?"bg-green-500":"bg-gray-300"}`}),r.jsx("span",{className:"text-[11px] text-muted",children:m.name})]},m.id)})}),r.jsx("button",{onClick:h,className:"p-1 text-muted hover:text-ink rounded transition-colors",title:"Refresh",children:r.jsx(bt,{size:12})})]}),a&&r.jsxs("div",{className:"flex items-center gap-2 bg-red-500/5 border border-red-500/15 rounded-lg px-3 py-2",children:[r.jsx(_s,{size:14,className:"text-red-500 flex-shrink-0"}),r.jsx("span",{className:"text-xs text-red-600",children:a})]}),r.jsx("div",{className:e?"space-y-2":"space-y-3",children:Zr.map(m=>r.jsx(dx,{platform:m,status:s[m.id],onConnect:u[m.id],onDisconnect:()=>p(m.id)},m.id))})]})}const Ll={connected:"Connected",disconnected:"Not connected",checking:"Checking...",unknown:"Status unknown"},fx=[{id:"vercel",name:"Vercel",description:"Optimized for Next.js, React, and static sites. Global CDN with instant rollbacks.",icon:nn,color:"text-ink",bgColor:"bg-ink/5",connectionKey:"vercel"},{id:"netlify",name:"Netlify",description:"Deploy with CI/CD, serverless functions, and form handling built in.",icon:nn,color:"text-teal-600",bgColor:"bg-teal-500/5",connectionKey:"netlify"},{id:"github-pages",name:"GitHub Pages",description:"Free hosting for static sites directly from a GitHub repository.",icon:Te,color:"text-purple-600",bgColor:"bg-purple-500/5",connectionKey:"github"}];function mx({platform:e,deployState:t,onDeploy:s,disabled:i,connection:n}){const[o,a]=d.useState(!1),l=e.icon,h=d.useCallback(async()=>{if(t.url)try{await navigator.clipboard.writeText(t.url),a(!0),setTimeout(()=>a(!1),2e3)}catch{}},[t.url]),c=n==="connected",f=i||!c;return r.jsxs("div",{className:`border border-border rounded-lg p-4 transition-colors ${t.status==="success"?"border-green-500/30 bg-green-500/5":t.status==="error"?"border-red-500/30 bg-red-500/5":n==="disconnected"?"opacity-60":"hover:border-primary/30 hover:bg-hover"}`,children:[r.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[r.jsx("div",{className:`w-10 h-10 rounded-lg flex items-center justify-center ${e.bgColor}`,children:r.jsx(l,{size:20,className:e.color})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h4",{className:"text-sm font-semibold text-ink",children:e.name}),r.jsx("p",{className:"text-[11px] text-muted leading-snug mt-0.5",children:e.description})]}),n==="checking"||n==="unknown"?r.jsx("span",{className:"text-[10px] text-muted flex-shrink-0",children:Ll[n]}):r.jsx("span",{className:`w-2.5 h-2.5 rounded-full flex-shrink-0 ${c?"bg-green-500":"bg-gray-300"}`,title:Ll[n]})]}),t.status==="idle"&&r.jsxs("div",{className:"relative group",children:[r.jsxs(le,{variant:"secondary",size:"sm",icon:Kt,onClick:s,disabled:f,className:"w-full",children:["Deploy to ",e.name]}),n==="disconnected"&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:r.jsxs("span",{className:"bg-ink text-white text-[10px] px-2 py-1 rounded shadow opacity-0 group-hover:opacity-100 transition-opacity",children:["Connect ",e.name," first"]})})]}),t.status==="deploying"&&r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-btn bg-primary/5 border border-primary/20",children:[r.jsx(gi,{size:14,className:"text-primary animate-spin"}),r.jsxs("span",{className:"text-xs font-medium text-primary",children:["Deploying to ",e.name,"..."]})]}),t.status==="success"&&t.url&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-green-600 font-medium",children:[r.jsx(ps,{size:14}),"Deployed successfully"]}),r.jsxs("div",{className:"flex items-center gap-1.5 bg-card border border-border rounded-btn px-3 py-2",children:[r.jsx(nn,{size:12,className:"text-muted flex-shrink-0"}),r.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs font-mono text-primary hover:underline truncate flex-1",children:t.url}),r.jsxs("button",{onClick:h,className:"flex items-center gap-1 text-[11px] text-muted hover:text-ink transition-colors flex-shrink-0",title:"Copy URL",children:[o?r.jsx(Yt,{size:12,className:"text-green-500"}):r.jsx(so,{size:12}),o?"Copied":"Copy"]}),r.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"text-muted hover:text-ink transition-colors flex-shrink-0",title:"Open in new tab",children:r.jsx(ls,{size:12})})]})]}),t.status==="error"&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-red-500 font-medium",children:[r.jsx(_s,{size:14}),"Deploy failed"]}),r.jsx("p",{className:"text-[11px] text-muted bg-red-500/5 border border-red-500/10 rounded px-2 py-1.5 font-mono",children:t.error||"Unknown error"}),r.jsx(le,{variant:"secondary",size:"sm",icon:Kt,onClick:s,disabled:f,className:"w-full",children:"Retry"})]})]})}function px({sessionId:e,disabled:t}){const[s,i]=d.useState({status:"idle"}),[n,o]=d.useState(!1),a=d.useCallback(async()=>{i({status:"pushing"});try{const h=await W.githubPush(e);h.repo_url?i({status:"success",repoUrl:h.repo_url}):i({status:"error",error:h.error||"Push failed"})}catch(h){i({status:"error",error:h instanceof Error?h.message:"Push failed"})}},[e]),l=d.useCallback(async()=>{if(s.repoUrl)try{await navigator.clipboard.writeText(s.repoUrl),o(!0),setTimeout(()=>o(!1),2e3)}catch{}},[s.repoUrl]);return r.jsxs("div",{className:"border border-border rounded-lg p-4",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center bg-ink/5",children:r.jsx(Te,{size:20,className:"text-ink"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h4",{className:"text-sm font-semibold text-ink",children:"Push to GitHub"}),r.jsx("p",{className:"text-[11px] text-muted leading-snug mt-0.5",children:"Create a repository and push your code to GitHub."})]})]}),s.status==="idle"&&r.jsx(le,{variant:"secondary",size:"sm",icon:Te,onClick:a,disabled:t,className:"w-full",children:"Create Repo + Push"}),s.status==="pushing"&&r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-btn bg-primary/5 border border-primary/20",children:[r.jsx(gi,{size:14,className:"text-primary animate-spin"}),r.jsx("span",{className:"text-xs font-medium text-primary",children:"Creating repository and pushing..."})]}),s.status==="success"&&s.repoUrl&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-green-600 font-medium",children:[r.jsx(ps,{size:14}),"Pushed to GitHub"]}),r.jsxs("div",{className:"flex items-center gap-1.5 bg-card border border-border rounded-btn px-3 py-2",children:[r.jsx(Te,{size:12,className:"text-muted flex-shrink-0"}),r.jsx("a",{href:s.repoUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs font-mono text-primary hover:underline truncate flex-1",children:s.repoUrl}),r.jsxs("button",{onClick:l,className:"flex items-center gap-1 text-[11px] text-muted hover:text-ink transition-colors flex-shrink-0",title:"Copy URL",children:[n?r.jsx(Yt,{size:12,className:"text-green-500"}):r.jsx(so,{size:12}),n?"Copied":"Copy"]})]})]}),s.status==="error"&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-red-500 font-medium",children:[r.jsx(_s,{size:14}),"Push failed"]}),r.jsx("p",{className:"text-[11px] text-muted bg-red-500/5 border border-red-500/10 rounded px-2 py-1.5 font-mono",children:s.error}),r.jsx(le,{variant:"secondary",size:"sm",icon:Te,onClick:a,disabled:t,className:"w-full",children:"Retry"})]})]})}function _x({sessionId:e}){const[t,s]=d.useState({vercel:{status:"idle"},netlify:{status:"idle"},"github-pages":{status:"idle"}}),[i,n]=d.useState(null),[o,a]=d.useState(!1);d.useEffect(()=>{W.getDeployStatus().then(n).catch(()=>a(!0))},[]);const[l,h]=d.useState(!1),c=Object.values(t).some(u=>u.status==="deploying"),f=d.useCallback(async u=>{s(g=>({...g,[u]:{status:"deploying"}}));try{const g=await W.deployProject(e,u);g.url?s(m=>({...m,[u]:{status:"success",url:g.url}})):s(m=>({...m,[u]:{status:"error",error:g.error||"Deploy failed"}}))}catch(g){s(m=>({...m,[u]:{status:"error",error:g instanceof Error?g.message:"Deploy failed"}}))}},[e]),p=u=>{var g;return i?(g=i[u.connectionKey])!=null&&g.connected?"connected":"disconnected":o?"unknown":"checking"};return r.jsx("div",{className:"h-full overflow-y-auto terminal-scroll",children:r.jsxs("div",{className:"p-6 max-w-2xl mx-auto space-y-6",children:[r.jsxs("div",{children:[r.jsxs("h3",{className:"text-lg font-heading font-bold text-ink flex items-center gap-2",children:[r.jsx(Kt,{size:20,className:"text-primary"}),"Deploy Your Project"]}),r.jsx("p",{className:"text-xs text-muted mt-1",children:"Choose a platform to deploy your project. One click to go live."})]}),r.jsxs("div",{className:"border border-border rounded-lg overflow-hidden",children:[r.jsxs("button",{type:"button",onClick:()=>h(!l),className:"flex items-center justify-between w-full px-4 py-3 text-left hover:bg-hover transition-colors",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(lc,{size:16,className:"text-primary"}),r.jsx("span",{className:"text-sm font-medium text-ink",children:"Platform Connections"}),r.jsx("div",{className:"flex items-center gap-1 ml-2",children:i?["vercel","netlify","github"].map(u=>{var g,m;return r.jsx("span",{className:`w-2 h-2 rounded-full ${(g=i[u])!=null&&g.connected?"bg-green-500":"bg-gray-300"}`,title:`${u}: ${(m=i[u])!=null&&m.connected?"Connected":"Not connected"}`},u)}):r.jsx("span",{className:"text-[11px] text-muted",children:o?"Status unknown":"Checking..."})})]}),r.jsx("span",{className:"text-xs text-muted",children:l?"Hide":"Manage"})]}),l&&r.jsx("div",{className:"border-t border-border p-4",children:r.jsx(ux,{compact:!0,onStatusChange:n})})]}),r.jsx("div",{className:"space-y-3",children:fx.map(u=>r.jsx(mx,{platform:u,deployState:t[u.id],onDeploy:()=>f(u.id),disabled:c,connection:p(u)},u.id))}),r.jsx("div",{className:"border-t border-border"}),r.jsx(px,{sessionId:e,disabled:c})]})})}const Ch=typeof navigator<"u"&&/Mac/.test(navigator.userAgent),Et=Ch?"Cmd":"Ctrl",Bl=[{keys:[`${Et}+K`],label:"Open Command Palette",category:"navigation"},{keys:[`${Et}+P`],label:"Quick open file",category:"navigation"},{keys:[`${Et}+,`],label:"Open settings",category:"navigation"},{keys:[`${Et}+S`],label:"Save file",category:"editor"},{keys:[`${Et}+Z`],label:"Undo",category:"editor"},{keys:[`${Et}+Shift+Z`],label:"Redo",category:"editor"},{keys:[`${Et}+B`],label:"Start / stop build",category:"build"},{keys:[`${Et}+\``],label:"Toggle terminal",category:"build"},{keys:["?"],label:"Show keyboard shortcuts",category:"general"},{keys:[`${Et}+?`],label:"Show keyboard shortcuts (alt)",category:"general"},{keys:["Escape"],label:"Close modals",category:"general"}],gx={navigation:"Navigation",editor:"Editor",build:"Build",general:"General"},xx=["navigation","editor","build","general"];function vx({onToggleTerminal:e,onToggleBuild:t}){const[s,i]=d.useState(!1),n=d.useCallback(o=>{var c,f;const a=Ch?o.metaKey:o.ctrlKey,l=(c=o.target)==null?void 0:c.tagName,h=l==="INPUT"||l==="TEXTAREA"||((f=o.target)==null?void 0:f.isContentEditable);if(a&&(o.key==="?"||o.shiftKey&&o.key==="/")){o.preventDefault(),i(p=>!p);return}if(o.key==="?"&&!a&&!h){o.preventDefault(),i(p=>!p);return}if(a&&o.key==="`"){o.preventDefault(),e==null||e();return}if(a&&o.key==="b"){o.preventDefault(),t==null||t();return}o.key==="Escape"&&s&&i(!1)},[e,t,s]);return d.useEffect(()=>(window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)),[n]),{showHelp:s,setShowHelp:i}}function bx({open:e,onClose:t}){const[s,i]=d.useState("");d.useEffect(()=>{e&&i("")},[e]);const n=d.useMemo(()=>{if(!s.trim())return Bl;const a=s.toLowerCase();return Bl.filter(l=>l.label.toLowerCase().includes(a)||l.keys.some(h=>h.toLowerCase().includes(a))||l.category.toLowerCase().includes(a))},[s]),o=d.useMemo(()=>{const a={};for(const l of n)a[l.category]||(a[l.category]=[]),a[l.category].push(l);return a},[n]);return e?r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-ink/20",onClick:t,children:r.jsxs("div",{className:"bg-card rounded-xl shadow-2xl border border-border w-full max-w-md mx-4 overflow-hidden",onClick:a=>a.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(bd,{size:16,className:"text-primary"}),r.jsx("h2",{className:"text-sm font-heading font-bold text-ink",children:"Keyboard Shortcuts"})]}),r.jsx("button",{onClick:t,className:"text-muted hover:text-ink transition-colors p-1 rounded-btn hover:bg-hover",children:r.jsx(gt,{size:16})})]}),r.jsx("div",{className:"px-4 py-2 border-b border-border",children:r.jsxs("div",{className:"relative",children:[r.jsx(as,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted"}),r.jsx("input",{type:"text",value:s,onChange:a=>i(a.target.value),placeholder:"Filter shortcuts...",className:"w-full pl-9 pr-3 py-1.5 text-xs bg-card border border-border rounded-btn outline-none focus:border-primary transition-colors",autoFocus:!0})]})}),r.jsxs("div",{className:"max-h-[400px] overflow-y-auto terminal-scroll",children:[xx.map(a=>{const l=o[a];return!l||l.length===0?null:r.jsxs("div",{children:[r.jsx("div",{className:"px-5 pt-3 pb-1",children:r.jsx("span",{className:"text-[10px] font-semibold text-muted uppercase tracking-wider",children:gx[a]})}),r.jsx("div",{className:"px-4 space-y-0.5 pb-2",children:l.map(h=>r.jsxs("div",{className:"flex items-center justify-between px-2 py-2 rounded-btn hover:bg-hover",children:[r.jsx("span",{className:"text-xs text-ink",children:h.label}),r.jsx("div",{className:"flex items-center gap-1",children:h.keys.map(c=>r.jsx("kbd",{className:"px-2 py-0.5 text-[11px] font-mono bg-hover border border-border rounded text-muted-accessible",children:c},c))})]},h.label))})]},a)}),n.length===0&&r.jsx("div",{className:"px-5 py-8 text-center",children:r.jsxs("p",{className:"text-xs text-muted",children:['No shortcuts matching "',s,'"']})})]}),r.jsx("div",{className:"px-5 py-3 border-t border-border text-center",children:r.jsxs("span",{className:"text-[11px] text-muted",children:["Press ",r.jsx("kbd",{className:"px-1.5 py-0.5 text-[10px] font-mono bg-hover border border-border rounded",children:"Escape"})," to close"]})})]})}):null}function yx({onClick:e}){return r.jsx("button",{onClick:e,title:"Keyboard shortcuts",className:"inline-flex items-center justify-center w-7 h-7 rounded-btn text-muted hover:text-ink hover:bg-hover transition-colors text-xs font-bold",children:"?"})}const kh="pl_recent_commands",Sx=5;function Nh(){try{const e=localStorage.getItem(kh);return e?JSON.parse(e):[]}catch{return[]}}function Qr(e){try{const t=Nh().filter(s=>s!==e);t.unshift(e),localStorage.setItem(kh,JSON.stringify(t.slice(0,Sx)))}catch{}}function wx(e){var i;const t=((i=e.split(".").pop())==null?void 0:i.toLowerCase())||"";return{js:Q,ts:Q,tsx:Q,jsx:Q,py:Q,go:Q,rs:Q,rb:Q,sh:Q,html:ac,css:no,json:ro,md:_i}[t]||oo}function Cx(e,t){const s=e.toLowerCase(),i=t.toLowerCase(),n=[];let o=0;for(let a=0;a<i.length&&o<s.length;a++)i[a]===s[o]&&(n.push(a),o++);return o===s.length?n:null}function Tl({text:e,indices:t}){if(t.length===0)return r.jsx(r.Fragment,{children:e});const s=new Set(t);return r.jsx(r.Fragment,{children:e.split("").map((i,n)=>s.has(n)?r.jsx("span",{className:"text-primary font-semibold",children:i},n):r.jsx("span",{children:i},n))})}function kx({isOpen:e,onClose:t,commands:s,sessionId:i,onFileSelect:n}){const[o,a]=d.useState(""),[l,h]=d.useState(0),[c,f]=d.useState([]),[p,u]=d.useState(!1),g=d.useRef(null),m=d.useRef(null),_=yd(e);Sd(e,t),d.useEffect(()=>{e&&(a(""),h(0),f([]),u(!1),setTimeout(()=>{var S;return(S=g.current)==null?void 0:S.focus()},50))},[e]);const x=d.useMemo(()=>Nh().map(C=>s.find(D=>D.id===C)).filter(Boolean),[s]),y=d.useMemo(()=>{if(!o.trim())return s.map(C=>({cmd:C,indices:[]}));const S=[];for(const C of s){const D=Cx(o,C.label);if(D){const L=D[0]*10+(D[D.length-1]-D[0]);S.push({cmd:C,indices:D,score:L})}}return S.sort((C,D)=>C.score-D.score),S.map(C=>({cmd:C.cmd,indices:C.indices}))},[s,o]),v=d.useMemo(()=>o.trim()?y.filter(S=>S.cmd.category==="setting"):[],[y,o]),j=d.useMemo(()=>y.filter(S=>S.cmd.category!=="setting"),[y]);d.useEffect(()=>{if(!i||!o.trim()){f([]),u(!1);return}return u(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(async()=>{try{const S=await W.searchFiles(i,o);f(S.filter(C=>C.type==="file"))}catch{f([])}u(!1)},200),()=>{m.current&&clearTimeout(m.current)}},[o,i]);const k=!o.trim()&&x.length>0,w=d.useMemo(()=>{const S=[];return k&&x.forEach((C,D)=>S.push({type:"recent",index:D})),j.forEach((C,D)=>S.push({type:"command",index:D})),v.length>0&&v.forEach((C,D)=>S.push({type:"setting",index:D})),c.forEach((C,D)=>S.push({type:"file",index:D})),S},[k,x,j,v,c]),N=w.length;d.useEffect(()=>{h(0)},[o]);const M=d.useCallback(S=>{const C=w[S];if(C){if(C.type==="recent"){const D=x[C.index];D&&(Qr(D.id),D.action(),t())}else if(C.type==="command"){const D=j[C.index];D&&(Qr(D.cmd.id),D.cmd.action(),t())}else if(C.type==="setting"){const D=v[C.index];D&&(Qr(D.cmd.id),D.cmd.action(),t())}else if(C.type==="file"){const D=c[C.index];D&&n&&(n(D.path,D.name),t())}}},[w,x,j,v,c,n,t]),U=d.useCallback(S=>{S.key==="ArrowDown"?(S.preventDefault(),h(C=>Math.min(C+1,N-1))):S.key==="ArrowUp"?(S.preventDefault(),h(C=>Math.max(C-1,0))):S.key==="Enter"&&N>0?M(l):S.key==="Escape"&&t()},[N,l,M,t]);if(!e)return null;let Y=0;const V=()=>Y++,$=j.length>0,P=v.length>0,E=c.length>0,B=p&&o.trim().length>0;return r.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[20vh]",onClick:t,children:[r.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm"}),r.jsxs("div",{ref:_,className:"relative w-full max-w-lg bg-card rounded-xl shadow-2xl border border-border overflow-hidden",onClick:S=>S.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border",children:[r.jsx(as,{size:18,className:"text-muted"}),r.jsx("input",{ref:g,value:o,onChange:S=>a(S.target.value),onKeyDown:U,placeholder:"Search commands, files, settings...",className:"flex-1 bg-transparent text-sm outline-none text-ink placeholder:text-muted"}),r.jsx("kbd",{className:"text-[10px] text-muted bg-hover px-1.5 py-0.5 rounded border border-border font-mono",children:"ESC"})]}),r.jsxs("div",{className:"max-h-[360px] overflow-y-auto py-1 terminal-scroll",children:[k&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"px-4 py-1.5 text-[10px] font-semibold text-muted uppercase tracking-wider flex items-center gap-1.5",children:[r.jsx(ut,{size:10})," Recent"]}),x.map((S,C)=>{const D=V(),L=S.icon;return r.jsxs("button",{onClick:()=>M(D),className:`w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors ${D===l?"bg-primary/10 text-primary":"text-ink hover:bg-hover"}`,children:[r.jsx(L,{size:16}),r.jsx("span",{className:"flex-1 text-left",children:S.label}),S.shortcut&&r.jsx("kbd",{className:"text-[10px] text-muted bg-hover px-1.5 py-0.5 rounded border border-border font-mono",children:S.shortcut})]},`recent-${S.id}`)})]}),$&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"px-4 py-1.5 text-[10px] font-semibold text-muted uppercase tracking-wider",children:"Commands"}),j.map((S,C)=>{const D=V(),L=S.cmd.icon;return r.jsxs("button",{onClick:()=>M(D),className:`w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors ${D===l?"bg-primary/10 text-primary":"text-ink hover:bg-hover"}`,children:[r.jsx(L,{size:16}),r.jsx("span",{className:"flex-1 text-left",children:o.trim()?r.jsx(Tl,{text:S.cmd.label,indices:S.indices}):S.cmd.label}),S.cmd.shortcut&&r.jsx("kbd",{className:"text-[10px] text-muted bg-hover px-1.5 py-0.5 rounded border border-border font-mono",children:S.cmd.shortcut})]},S.cmd.id)})]}),P&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"px-4 py-1.5 text-[10px] font-semibold text-muted uppercase tracking-wider mt-1",children:"Settings"}),v.map((S,C)=>{const D=V(),L=S.cmd.icon;return r.jsxs("button",{onClick:()=>M(D),className:`w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors ${D===l?"bg-primary/10 text-primary":"text-ink hover:bg-hover"}`,children:[r.jsx(L,{size:16}),r.jsx("span",{className:"flex-1 text-left",children:r.jsx(Tl,{text:S.cmd.label,indices:S.indices})}),S.cmd.shortcut&&r.jsx("kbd",{className:"text-[10px] text-muted bg-hover px-1.5 py-0.5 rounded border border-border font-mono",children:S.cmd.shortcut})]},`setting-${S.cmd.id}`)})]}),E&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"px-4 py-1.5 text-[10px] font-semibold text-muted uppercase tracking-wider mt-1",children:"Files"}),c.map((S,C)=>{const D=V(),L=S.type==="directory"?ao:wx(S.name);return r.jsxs("button",{onClick:()=>M(D),className:`w-full flex items-center gap-3 px-4 py-2 text-sm transition-colors ${D===l?"bg-primary/10 text-primary":"text-ink hover:bg-hover"}`,children:[r.jsx(L,{size:14}),r.jsx("span",{className:"flex-1 text-left font-mono text-xs truncate",children:S.name}),r.jsx("span",{className:"text-[10px] text-muted truncate max-w-[200px]",children:S.path})]},`file-${S.path}`)})]}),B&&!E&&r.jsx("div",{className:"px-4 py-2 text-xs text-muted animate-pulse",children:"Searching files..."}),N===0&&!B&&r.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted",children:"No results found"})]})]})]})}const Nx=d.lazy(()=>eo(()=>import("./GitHubIssuesPanel-D6izZx0w.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])).then(e=>({default:e.GitHubIssuesPanel}))),jx=d.lazy(()=>eo(()=>import("./GitHubPRsPanel-BTkG2FgA.js"),__vite__mapDeps([10,1,2,3,11,4,5,6,12,13,14,15,16,17,18,19,20,21,22,23,8,24,25,26,27,28,29,9,30,31,32,33,34])).then(e=>({default:e.GitHubPRsPanel}))),Ex=d.lazy(()=>eo(()=>Promise.resolve().then(()=>qx),void 0).then(e=>({default:e.CICDPanel}))),Dx=3e4,Rx={modified:r.jsx(Q,{size:13,className:"text-yellow-500"}),added:r.jsx(_r,{size:13,className:"text-green-500"}),deleted:r.jsx(io,{size:13,className:"text-red-400"}),renamed:r.jsx(Q,{size:13,className:"text-blue-400"}),untracked:r.jsx(sc,{size:13,className:"text-muted"})},Px={modified:"M",added:"A",deleted:"D",renamed:"R",untracked:"?"};function Mx({commit:e}){return r.jsx("div",{className:"px-3 py-2 border-b border-border hover:bg-hover transition-colors",children:r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(tc,{size:14,className:"text-primary mt-0.5 flex-shrink-0"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"text-xs font-medium text-ink truncate",children:e.message}),r.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[r.jsx("span",{className:"text-[11px] font-mono text-primary/70",children:e.short_hash}),r.jsx("span",{className:"text-[11px] text-muted",children:e.author}),r.jsx("span",{className:"text-[11px] text-muted ml-auto flex-shrink-0",children:e.date})]}),e.refs.length>0&&r.jsx("div",{className:"flex gap-1 mt-1",children:e.refs.map((t,s)=>r.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono bg-primary/10 text-primary rounded",children:[r.jsx(Te,{size:9}),t]},s))})]})]})})}function zl({file:e}){return r.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 hover:bg-hover transition-colors text-xs",children:[Rx[e.status]||r.jsx(sc,{size:13}),r.jsx("span",{className:"font-mono text-ink truncate flex-1",children:e.path}),r.jsx("span",{className:`font-mono text-[10px] px-1 rounded ${e.staged?"bg-green-500/10 text-green-500":"bg-muted/10 text-muted"}`,children:Px[e.status]||"?"})]})}function Lx({sessionId:e}){const[t,s]=d.useState("changes"),[i,n]=d.useState(null),[o,a]=d.useState([]),[l,h]=d.useState([]),[c,f]=d.useState(!0),[p,u]=d.useState(null),[g,m]=d.useState(""),[_,x]=d.useState(!1),[y,v]=d.useState(null),[j,k]=d.useState(!1),[w,N]=d.useState(""),[M,U]=d.useState(!1),[Y,V]=d.useState(!1),[$,P]=d.useState(""),[E,B]=d.useState(""),[S,C]=d.useState(!1),[D,L]=d.useState(null),[Z,oe]=d.useState(!1),q=d.useCallback(async()=>{f(!0),u(null);try{const[z,xe,T]=await Promise.all([W.git.status(e),W.git.log(e),W.git.branches(e)]);n(z),a(xe),h(T)}catch(z){u(z instanceof Error?z.message:"Failed to load git data")}f(!1)},[e]);d.useEffect(()=>{q()},[q]);const J=async()=>{if(!(!g.trim()||_)){x(!0),v(null);try{const z=await W.git.commit(e,g.trim());v(`Committed: ${z.hash}`),m(""),await q()}catch(z){v(`Error: ${z instanceof Error?z.message:"Commit failed"}`)}x(!1)}},se=async()=>{if(!(!w.trim()||M)){U(!0);try{await W.git.createBranch(e,w.trim()),N(""),k(!1),await q()}catch(z){u(z instanceof Error?z.message:"Branch creation failed")}U(!1)}},de=async z=>{try{await W.git.checkoutBranch(e,z),await q()}catch(xe){u(xe instanceof Error?xe.message:"Checkout failed")}},ue=async()=>{oe(!0);try{await W.git.push(e),await q()}catch(z){u(z instanceof Error?z.message:"Push failed")}oe(!1)},ce=async()=>{if(!(!$.trim()||S)){C(!0),L(null);try{const z=await W.git.pr(e,$.trim(),E.trim());L(z.url),P(""),B(""),V(!1)}catch(z){L(`Error: ${z instanceof Error?z.message:"PR creation failed"}`)}C(!1)}},ge=(i==null?void 0:i.files.filter(z=>z.staged))||[],Fe=(i==null?void 0:i.files.filter(z=>!z.staged))||[];return c&&!i?r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx(bt,{size:20,className:"text-muted animate-spin"}),r.jsx("span",{className:"text-xs text-muted",children:"Loading git status..."})]})}):p&&!i?r.jsx("div",{className:"h-full flex items-center justify-center p-6",children:r.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[r.jsx(_s,{size:32,className:"text-muted/40"}),r.jsx("p",{className:"text-sm text-muted",children:p}),r.jsx("p",{className:"text-xs text-muted/60",children:"This project may not be a git repository."}),r.jsx(le,{size:"sm",variant:"secondary",icon:bt,onClick:q,children:"Retry"})]})}):r.jsxs("div",{className:"h-full flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border bg-hover flex-shrink-0",children:[r.jsx(Te,{size:14,className:"text-primary"}),r.jsx("span",{className:"text-xs font-semibold text-ink",children:(i==null?void 0:i.branch)||"unknown"}),i&&(i.ahead>0||i.behind>0)&&r.jsxs("span",{className:"text-[10px] text-muted font-mono",children:[i.ahead>0&&`+${i.ahead}`,i.ahead>0&&i.behind>0&&" / ",i.behind>0&&`-${i.behind}`]}),(i==null?void 0:i.clean)&&r.jsxs("span",{className:"flex items-center gap-0.5 text-[10px] text-green-500",children:[r.jsx(Yt,{size:10})," Clean"]}),r.jsx("div",{className:"flex-1"}),r.jsx("button",{onClick:q,className:"p-1 text-muted hover:text-ink rounded transition-colors",title:"Refresh",children:r.jsx(bt,{size:13,className:c?"animate-spin":""})})]}),r.jsx("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-border flex-shrink-0",children:[{id:"changes",label:"Changes",icon:Q,count:(i==null?void 0:i.files.length)||0},{id:"history",label:"History",icon:ut},{id:"branches",label:"Branches",icon:Te,count:l.length}].map(z=>r.jsxs("button",{onClick:()=>s(z.id),className:`flex items-center gap-1 px-2.5 py-1 text-[11px] font-medium rounded-btn transition-colors ${t===z.id?"bg-primary/10 text-primary":"text-muted hover:text-ink"}`,children:[r.jsx(z.icon,{size:12}),z.label,z.count!==void 0&&z.count>0&&r.jsx("span",{className:"ml-0.5 px-1 py-0 text-[9px] rounded-full bg-primary/20 text-primary font-mono",children:z.count})]},z.id))}),p&&r.jsx("div",{className:"px-3 py-2 bg-red-500/5 border-b border-red-500/20 text-xs text-red-400",children:p}),r.jsxs("div",{className:"flex-1 overflow-y-auto terminal-scroll",children:[t==="changes"&&r.jsx("div",{className:"flex flex-col h-full",children:(i==null?void 0:i.files.length)===0?r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Yt,{size:28,className:"text-green-500/30 mb-2"}),r.jsx("p",{className:"text-xs text-muted",children:"Working tree clean"}),r.jsx("p",{className:"text-[11px] text-muted/60 mt-0.5",children:"No changes to commit."})]}):r.jsxs(r.Fragment,{children:[ge.length>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"px-3 py-1.5 text-[10px] font-semibold text-muted uppercase tracking-wider bg-green-500/5 border-b border-border",children:["Staged (",ge.length,")"]}),ge.map((z,xe)=>r.jsx(zl,{file:z},`s-${xe}`))]}),Fe.length>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"px-3 py-1.5 text-[10px] font-semibold text-muted uppercase tracking-wider bg-yellow-500/5 border-b border-border",children:["Unstaged (",Fe.length,")"]}),Fe.map((z,xe)=>r.jsx(zl,{file:z},`u-${xe}`))]}),r.jsxs("div",{className:"mt-auto border-t border-border p-3 space-y-2 flex-shrink-0",children:[r.jsx("textarea",{value:g,onChange:z=>m(z.target.value),placeholder:"Commit message...",rows:2,className:"w-full px-3 py-1.5 text-xs bg-card border border-border rounded-btn outline-none focus:border-primary transition-colors resize-none font-mono"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(le,{size:"sm",icon:tc,onClick:J,disabled:!g.trim()||_,loading:_,children:"Commit"}),r.jsx(le,{size:"sm",variant:"secondary",icon:rc,onClick:ue,loading:Z,disabled:Z,children:"Push"}),r.jsx(le,{size:"sm",variant:"ghost",icon:an,onClick:()=>V(!Y),children:"PR"})]}),y&&r.jsx("p",{className:`text-[11px] font-mono ${y.startsWith("Error")?"text-red-400":"text-green-500"}`,children:y}),D&&r.jsx("p",{className:"text-[11px] font-mono text-primary",children:D.startsWith("Error")?r.jsx("span",{className:"text-red-400",children:D}):r.jsx("a",{href:D,target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-primary/80",children:D})})]}),Y&&r.jsxs("div",{className:"border-t border-border p-3 space-y-2 flex-shrink-0 bg-hover",children:[r.jsx("p",{className:"text-[11px] font-semibold text-ink",children:"Create Pull Request"}),r.jsx("input",{value:$,onChange:z=>P(z.target.value),placeholder:"PR title...",className:"w-full px-3 py-1.5 text-xs bg-card border border-border rounded-btn outline-none focus:border-primary"}),r.jsx("textarea",{value:E,onChange:z=>B(z.target.value),placeholder:"PR description (optional)...",rows:3,className:"w-full px-3 py-1.5 text-xs bg-card border border-border rounded-btn outline-none focus:border-primary resize-none"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(le,{size:"sm",icon:an,onClick:ce,disabled:!$.trim()||S,loading:S,children:"Create PR"}),r.jsx(le,{size:"sm",variant:"ghost",onClick:()=>V(!1),children:"Cancel"})]})]})]})}),t==="history"&&r.jsx("div",{children:o.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(ut,{size:28,className:"text-muted/30 mb-2"}),r.jsx("p",{className:"text-xs text-muted",children:"No commits yet"})]}):o.map((z,xe)=>r.jsx(Mx,{commit:z},xe))}),t==="branches"&&r.jsxs("div",{children:[r.jsx("div",{className:"px-3 py-2 border-b border-border flex items-center gap-2",children:r.jsxs("button",{onClick:()=>k(!j),className:"flex items-center gap-1 text-xs text-primary hover:text-primary/80 font-medium",children:[r.jsx(gr,{size:12}),"New Branch"]})}),j&&r.jsxs("div",{className:"px-3 py-2 border-b border-border bg-hover flex items-center gap-2",children:[r.jsx("input",{value:w,onChange:z=>N(z.target.value),placeholder:"branch-name",className:"flex-1 px-2 py-1 text-xs font-mono bg-card border border-border rounded-btn outline-none focus:border-primary",onKeyDown:z=>{z.key==="Enter"&&se()}}),r.jsx(le,{size:"sm",onClick:se,disabled:!w.trim()||M,loading:M,children:"Create"})]}),l.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Te,{size:28,className:"text-muted/30 mb-2"}),r.jsx("p",{className:"text-xs text-muted",children:"No branches found"})]}):r.jsxs("div",{children:[l.filter(z=>!z.remote).map((z,xe)=>r.jsxs("button",{onClick:()=>!z.current&&de(z.name),disabled:z.current,className:`w-full text-left flex items-center gap-2 px-3 py-2 text-xs border-b border-border transition-colors ${z.current?"bg-primary/5":"hover:bg-hover cursor-pointer"}`,children:[r.jsx(Te,{size:13,className:z.current?"text-primary":"text-muted"}),r.jsx("span",{className:`font-mono ${z.current?"text-primary font-semibold":"text-ink"}`,children:z.name}),z.current&&r.jsx("span",{className:"ml-auto text-[10px] bg-primary/10 text-primary px-1.5 py-0.5 rounded font-medium",children:"current"})]},`l-${xe}`)),l.filter(z=>z.remote).length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"px-3 py-1.5 text-[10px] font-semibold text-muted uppercase tracking-wider bg-hover border-b border-border",children:"Remote"}),l.filter(z=>z.remote).map((z,xe)=>r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 text-xs border-b border-border",children:[r.jsx(Te,{size:13,className:"text-muted/60"}),r.jsx("span",{className:"font-mono text-muted",children:z.name})]},`r-${xe}`))]})]})]})]})]})}function en(){return r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx(bt,{size:20,className:"text-muted animate-spin"}),r.jsx("span",{className:"text-xs text-muted",children:"Loading..."})]})})}function tn({sessionId:e,onPushed:t}){const[s,i]=d.useState(!1),[n,o]=d.useState(null),a=async()=>{i(!0),o(null);try{await W.githubPush(e),t()}catch(l){o(l instanceof Error?l.message:"Push to GitHub failed")}i(!1)};return r.jsx("div",{className:"h-full flex items-center justify-center p-8",children:r.jsxs("div",{className:"flex flex-col items-center gap-4 text-center max-w-xs",children:[r.jsx(cu,{size:40,className:"text-muted/30"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-ink",children:"This project isn't connected to GitHub yet"}),r.jsx("p",{className:"text-xs text-muted mt-1",children:"Push your project to GitHub to access issues, pull requests, and CI/CD workflows."})]}),r.jsx("div",{className:"flex items-center gap-2",children:r.jsx(le,{size:"sm",icon:rc,onClick:a,loading:s,children:"Push to GitHub"})}),n&&r.jsx("p",{className:"text-[11px] text-red-400 font-mono",children:n})]})})}function Bx({sessionId:e}){const[t,s]=d.useState("changes"),[i,n]=d.useState(!0),[o,a]=d.useState(null),[l,h]=d.useState({actions:0,fetchedAt:0}),c=d.useRef(!1),f=d.useCallback(async()=>{n(!0);try{const _=await W.git.branches(e);a({has_remote:_.some(x=>x.remote)})}catch{a(null)}n(!1)},[e]);d.useEffect(()=>{f()},[f]);const p=d.useCallback(async()=>{if(!(o!=null&&o.has_remote)||Date.now()-l.fetchedAt<Dx||c.current)return;c.current=!0;const x=await W.getWorkflowRuns(e,5).catch(()=>null);h({actions:x?x.filter(y=>y.status==="in_progress").length:0,fetchedAt:Date.now()}),c.current=!1},[e,o==null?void 0:o.has_remote,l.fetchedAt]);if(d.useEffect(()=>{o!=null&&o.has_remote&&p()},[o==null?void 0:o.has_remote,p]),d.useEffect(()=>{["issues","prs","actions"].includes(t)&&(o!=null&&o.has_remote)&&p()},[t,o==null?void 0:o.has_remote,p]),i)return r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx(bt,{size:20,className:"text-muted animate-spin"}),r.jsx("span",{className:"text-xs text-muted",children:"Checking GitHub connection..."})]})});const u=(o==null?void 0:o.has_remote)??!0,g=[{id:"changes",label:"Changes",icon:Q,requiresRemote:!1},{id:"issues",label:"Issues",icon:$d,requiresRemote:!0},{id:"prs",label:"PRs",icon:an,requiresRemote:!0},{id:"actions",label:"Actions",icon:rs,count:l.actions,requiresRemote:!0}],m=g;return r.jsxs("div",{className:"h-full flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-border bg-hover flex-shrink-0",children:[m.map(_=>{const x=_.requiresRemote&&!u;return r.jsxs("button",{onClick:()=>s(_.id),disabled:x,className:`flex items-center gap-1 px-2.5 py-1 text-[11px] font-medium rounded-btn transition-colors ${t===_.id?"bg-primary/10 text-primary":x?"text-muted/40 cursor-not-allowed":"text-muted hover:text-ink"}`,title:x?"Connect to GitHub to access this tab":void 0,children:[r.jsx(_.icon,{size:12}),_.label,_.count!==void 0&&_.count>0&&r.jsx("span",{className:"ml-0.5 px-1 py-0 text-[9px] rounded-full bg-primary/20 text-primary font-mono",children:_.count})]},_.id)}),u&&(o==null?void 0:o.owner)&&r.jsxs("div",{className:"ml-auto flex items-center gap-1 text-[10px] text-muted font-mono",children:[r.jsx(lc,{size:10}),o.owner,"/",o.repo]})]}),r.jsxs("div",{className:"flex-1 overflow-hidden",children:[t==="changes"&&r.jsx(Lx,{sessionId:e}),t==="issues"&&(u?r.jsx(d.Suspense,{fallback:r.jsx(en,{}),children:r.jsx(Nx,{sessionId:e})}):r.jsx(tn,{sessionId:e,onPushed:f})),t==="prs"&&(u?r.jsx(d.Suspense,{fallback:r.jsx(en,{}),children:r.jsx(jx,{sessionId:e})}):r.jsx(tn,{sessionId:e,onPushed:f})),t==="actions"&&(u?r.jsx(d.Suspense,{fallback:r.jsx(en,{}),children:r.jsx("div",{className:"h-full overflow-y-auto p-4",children:r.jsx(Ex,{sessionId:e})})}):r.jsx(tn,{sessionId:e,onPushed:f}))]})]})}function Tx({sessionId:e,onRestore:t}){const[s,i]=d.useState([]),[n,o]=d.useState(!0),[a,l]=d.useState(null),[h,c]=d.useState(null),[f,p]=d.useState(null),u=d.useCallback(async()=>{try{const _=await W.getCheckpoints(e);i(_),p(null)}catch{p("Failed to load checkpoints")}o(!1)},[e]);d.useEffect(()=>{u();const _=setInterval(u,15e3);return()=>clearInterval(_)},[u]);const g=d.useCallback(async _=>{if(a)return;const x=s.find(v=>v.id===_);if(!(!x||!window.confirm(`Restore to checkpoint "${x.description}"?
225
+ placeholder:text-muted disabled:opacity-50`})]}),r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("a",{href:e.tokenUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-[11px] text-primary hover:underline",children:[e.tokenUrlLabel,r.jsx(ls,{size:10})]}),r.jsx(le,{type:"submit",variant:"primary",size:"sm",loading:n,disabled:!s.trim()||n,children:"Connect"})]}),a&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-red-500 mt-1",children:[r.jsx(_s,{size:12}),a]})]})}function hx(){return r.jsxs("div",{className:"mt-3 space-y-2",children:[r.jsxs("div",{className:"flex items-start gap-2 bg-amber-500/5 border border-amber-500/15 rounded-lg px-3 py-2.5",children:[r.jsx(os,{size:14,className:"text-amber-600 flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"text-xs text-muted leading-relaxed",children:[r.jsx("p",{className:"font-medium text-ink mb-1",children:"Run in your terminal:"}),r.jsx("code",{className:"block bg-ink/5 rounded px-2 py-1 font-mono text-[11px] text-ink",children:"gh auth login"})]})]}),r.jsxs("a",{href:"https://cli.github.com/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-[11px] text-primary hover:underline",children:["Install GitHub CLI",r.jsx(ls,{size:10})]})]})}function dx({platform:e,status:t,onConnect:s,onDisconnect:i}){const[n,o]=d.useState(!1),[a,l]=d.useState(!1),h=d.useCallback(async()=>{l(!0);try{i()}finally{l(!1)}},[i]),c=d.useCallback(async f=>{await s(f),o(!1)},[s]);return r.jsxs("div",{className:`border rounded-lg p-4 transition-colors ${t.connected?"border-green-500/30 bg-green-500/5":"border-border hover:border-primary/30 hover:bg-hover"}`,children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:`w-10 h-10 rounded-lg flex items-center justify-center ${e.bgColor}`,children:r.jsx("span",{className:`text-sm font-bold ${e.color}`,children:e.initial})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h4",{className:"text-sm font-semibold text-ink",children:e.name}),r.jsx("p",{className:"text-[11px] text-muted leading-snug mt-0.5",children:e.description})]}),r.jsx("div",{className:"flex-shrink-0",children:r.jsx("span",{className:`inline-block w-2.5 h-2.5 rounded-full ${t.connected?"bg-green-500":"bg-gray-300"}`,title:t.connected?"Connected":"Not connected"})})]}),t.connected?r.jsxs("div",{className:"mt-3 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-green-600 font-medium",children:[r.jsx(ps,{size:14}),"Connected as ",t.user||"unknown"]}),t.last_deployed&&r.jsxs("p",{className:"text-[11px] text-muted",children:["Last deployed: ",new Date(t.last_deployed).toLocaleString()]}),r.jsx(le,{variant:"danger",size:"sm",icon:Iu,onClick:h,loading:a,className:"w-full",children:"Disconnect"})]}):r.jsxs(r.Fragment,{children:[t.error&&r.jsxs("div",{className:"mt-3 flex items-start gap-2 bg-red-500/5 border border-red-500/15 rounded-lg px-3 py-2",children:[r.jsx(_s,{size:14,className:"text-red-500 flex-shrink-0 mt-0.5"}),r.jsx("span",{className:"text-xs text-red-600",children:t.error})]}),e.hasTokenAuth?r.jsxs(r.Fragment,{children:[!n&&r.jsx("div",{className:"mt-3",children:r.jsx(le,{variant:"secondary",size:"sm",onClick:()=>o(!0),className:"w-full",children:t.error?`Reconnect ${e.name}`:`Connect ${e.name}`})}),n&&r.jsx(cx,{platform:e,onConnect:c})]}):r.jsx(hx,{})]})]})}function ux({compact:e=!1,onStatusChange:t}){const[s,i]=d.useState({vercel:{connected:!1},netlify:{connected:!1},github:{connected:!1}}),[n,o]=d.useState(!0),[a,l]=d.useState(null),h=d.useCallback(async()=>{try{const m=await W.getDeployStatus();i(m),t==null||t(m),l(null)}catch(m){l(m instanceof Error?m.message:"Failed to fetch connection status")}finally{o(!1)}},[t]);d.useEffect(()=>{h();const m=setInterval(h,3e4);return()=>clearInterval(m)},[h]);const c=d.useCallback(async m=>{const _=await W.connectVercel(m);_.success&&(i(x=>({...x,vercel:{connected:!0,user:_.user}})),t==null||t({...s,vercel:{connected:!0,user:_.user}}))},[s,t]),f=d.useCallback(async m=>{const _=await W.connectNetlify(m);_.success&&(i(x=>({...x,netlify:{connected:!0,user:_.user}})),t==null||t({...s,netlify:{connected:!0,user:_.user}}))},[s,t]),p=d.useCallback(async m=>{await W.disconnectPlatform(m),i(x=>({...x,[m]:{connected:!1}}));const _={...s,[m]:{connected:!1}};t==null||t(_)},[s,t]),u={vercel:c,netlify:f,github:async()=>{}};if(n)return r.jsxs("div",{className:"flex items-center justify-center py-8",children:[r.jsx(gi,{size:20,className:"text-primary animate-spin"}),r.jsx("span",{className:"text-sm text-muted ml-2",children:"Loading connections..."})]});const g=[s.vercel,s.netlify,s.github].filter(m=>m.connected).length;return r.jsxs("div",{className:e?"space-y-3":"space-y-4",children:[!e&&r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-semibold text-ink",children:"Platform Connections"}),r.jsxs("p",{className:"text-[11px] text-muted mt-0.5",children:[g," of ",Zr.length," platforms connected"]})]}),r.jsx("button",{onClick:h,className:"p-1.5 text-muted hover:text-ink rounded transition-colors",title:"Refresh connection status",children:r.jsx(bt,{size:14})})]}),e&&r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{className:"flex items-center gap-3",children:Zr.map(m=>{const _=s[m.id];return r.jsxs("div",{className:"flex items-center gap-1.5",title:`${m.name}: ${_.connected?`Connected as ${_.user}`:"Not connected"}`,children:[r.jsx("span",{className:`w-2 h-2 rounded-full ${_.connected?"bg-green-500":"bg-gray-300"}`}),r.jsx("span",{className:"text-[11px] text-muted",children:m.name})]},m.id)})}),r.jsx("button",{onClick:h,className:"p-1 text-muted hover:text-ink rounded transition-colors",title:"Refresh",children:r.jsx(bt,{size:12})})]}),a&&r.jsxs("div",{className:"flex items-center gap-2 bg-red-500/5 border border-red-500/15 rounded-lg px-3 py-2",children:[r.jsx(_s,{size:14,className:"text-red-500 flex-shrink-0"}),r.jsx("span",{className:"text-xs text-red-600",children:a})]}),r.jsx("div",{className:e?"space-y-2":"space-y-3",children:Zr.map(m=>r.jsx(dx,{platform:m,status:s[m.id],onConnect:u[m.id],onDisconnect:()=>p(m.id)},m.id))})]})}const Ll={connected:"Connected",disconnected:"Not connected",checking:"Checking...",unknown:"Status unknown"},fx=[{id:"vercel",name:"Vercel",description:"Optimized for Next.js, React, and static sites. Global CDN with instant rollbacks.",icon:nn,color:"text-ink",bgColor:"bg-ink/5",connectionKey:"vercel"},{id:"netlify",name:"Netlify",description:"Deploy with CI/CD, serverless functions, and form handling built in.",icon:nn,color:"text-teal-600",bgColor:"bg-teal-500/5",connectionKey:"netlify"},{id:"github-pages",name:"GitHub Pages",description:"Free hosting for static sites directly from a GitHub repository.",icon:Te,color:"text-purple-600",bgColor:"bg-purple-500/5",connectionKey:"github"}];function mx({platform:e,deployState:t,onDeploy:s,disabled:i,connection:n}){const[o,a]=d.useState(!1),l=e.icon,h=d.useCallback(async()=>{if(t.url)try{await navigator.clipboard.writeText(t.url),a(!0),setTimeout(()=>a(!1),2e3)}catch{}},[t.url]),c=n==="connected",f=i||!c;return r.jsxs("div",{className:`border border-border rounded-lg p-4 transition-colors ${t.status==="success"?"border-green-500/30 bg-green-500/5":t.status==="error"?"border-red-500/30 bg-red-500/5":n==="disconnected"?"opacity-60":"hover:border-primary/30 hover:bg-hover"}`,children:[r.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[r.jsx("div",{className:`w-10 h-10 rounded-lg flex items-center justify-center ${e.bgColor}`,children:r.jsx(l,{size:20,className:e.color})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h4",{className:"text-sm font-semibold text-ink",children:e.name}),r.jsx("p",{className:"text-[11px] text-muted leading-snug mt-0.5",children:e.description})]}),n==="checking"||n==="unknown"?r.jsx("span",{className:"text-[10px] text-muted flex-shrink-0",children:Ll[n]}):r.jsx("span",{className:`w-2.5 h-2.5 rounded-full flex-shrink-0 ${c?"bg-green-500":"bg-gray-300"}`,title:Ll[n]})]}),t.status==="idle"&&r.jsxs("div",{className:"relative group",children:[r.jsxs(le,{variant:"secondary",size:"sm",icon:Kt,onClick:s,disabled:f,className:"w-full",children:["Deploy to ",e.name]}),n==="disconnected"&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:r.jsxs("span",{className:"bg-ink text-white text-[10px] px-2 py-1 rounded shadow opacity-0 group-hover:opacity-100 transition-opacity",children:["Connect ",e.name," first"]})})]}),t.status==="deploying"&&r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-btn bg-primary/5 border border-primary/20",children:[r.jsx(gi,{size:14,className:"text-primary animate-spin"}),r.jsxs("span",{className:"text-xs font-medium text-primary",children:["Deploying to ",e.name,"..."]})]}),t.status==="success"&&t.url&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-green-600 font-medium",children:[r.jsx(ps,{size:14}),"Deployed successfully"]}),r.jsxs("div",{className:"flex items-center gap-1.5 bg-card border border-border rounded-btn px-3 py-2",children:[r.jsx(nn,{size:12,className:"text-muted flex-shrink-0"}),r.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs font-mono text-primary hover:underline truncate flex-1",children:t.url}),r.jsxs("button",{onClick:h,className:"flex items-center gap-1 text-[11px] text-muted hover:text-ink transition-colors flex-shrink-0",title:"Copy URL",children:[o?r.jsx(Yt,{size:12,className:"text-green-500"}):r.jsx(so,{size:12}),o?"Copied":"Copy"]}),r.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"text-muted hover:text-ink transition-colors flex-shrink-0",title:"Open in new tab",children:r.jsx(ls,{size:12})})]})]}),t.status==="error"&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-red-500 font-medium",children:[r.jsx(_s,{size:14}),"Deploy failed"]}),r.jsx("p",{className:"text-[11px] text-muted bg-red-500/5 border border-red-500/10 rounded px-2 py-1.5 font-mono",children:t.error||"Unknown error"}),r.jsx(le,{variant:"secondary",size:"sm",icon:Kt,onClick:s,disabled:f,className:"w-full",children:"Retry"})]})]})}function px({sessionId:e,disabled:t}){const[s,i]=d.useState({status:"idle"}),[n,o]=d.useState(!1),a=d.useCallback(async()=>{i({status:"pushing"});try{const h=await W.githubPush(e);h.repo_url?i({status:"success",repoUrl:h.repo_url}):i({status:"error",error:h.error||"Push failed"})}catch(h){i({status:"error",error:h instanceof Error?h.message:"Push failed"})}},[e]),l=d.useCallback(async()=>{if(s.repoUrl)try{await navigator.clipboard.writeText(s.repoUrl),o(!0),setTimeout(()=>o(!1),2e3)}catch{}},[s.repoUrl]);return r.jsxs("div",{className:"border border-border rounded-lg p-4",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center bg-ink/5",children:r.jsx(Te,{size:20,className:"text-ink"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h4",{className:"text-sm font-semibold text-ink",children:"Push to GitHub"}),r.jsx("p",{className:"text-[11px] text-muted leading-snug mt-0.5",children:"Create a repository and push your code to GitHub."})]})]}),s.status==="idle"&&r.jsx(le,{variant:"secondary",size:"sm",icon:Te,onClick:a,disabled:t,className:"w-full",children:"Create Repo + Push"}),s.status==="pushing"&&r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-btn bg-primary/5 border border-primary/20",children:[r.jsx(gi,{size:14,className:"text-primary animate-spin"}),r.jsx("span",{className:"text-xs font-medium text-primary",children:"Creating repository and pushing..."})]}),s.status==="success"&&s.repoUrl&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-green-600 font-medium",children:[r.jsx(ps,{size:14}),"Pushed to GitHub"]}),r.jsxs("div",{className:"flex items-center gap-1.5 bg-card border border-border rounded-btn px-3 py-2",children:[r.jsx(Te,{size:12,className:"text-muted flex-shrink-0"}),r.jsx("a",{href:s.repoUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs font-mono text-primary hover:underline truncate flex-1",children:s.repoUrl}),r.jsxs("button",{onClick:l,className:"flex items-center gap-1 text-[11px] text-muted hover:text-ink transition-colors flex-shrink-0",title:"Copy URL",children:[n?r.jsx(Yt,{size:12,className:"text-green-500"}):r.jsx(so,{size:12}),n?"Copied":"Copy"]})]})]}),s.status==="error"&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-red-500 font-medium",children:[r.jsx(_s,{size:14}),"Push failed"]}),r.jsx("p",{className:"text-[11px] text-muted bg-red-500/5 border border-red-500/10 rounded px-2 py-1.5 font-mono",children:s.error}),r.jsx(le,{variant:"secondary",size:"sm",icon:Te,onClick:a,disabled:t,className:"w-full",children:"Retry"})]})]})}function _x({sessionId:e}){const[t,s]=d.useState({vercel:{status:"idle"},netlify:{status:"idle"},"github-pages":{status:"idle"}}),[i,n]=d.useState(null),[o,a]=d.useState(!1);d.useEffect(()=>{W.getDeployStatus().then(n).catch(()=>a(!0))},[]);const[l,h]=d.useState(!1),c=Object.values(t).some(u=>u.status==="deploying"),f=d.useCallback(async u=>{s(g=>({...g,[u]:{status:"deploying"}}));try{const g=await W.deployProject(e,u);g.url?s(m=>({...m,[u]:{status:"success",url:g.url}})):s(m=>({...m,[u]:{status:"error",error:g.error||"Deploy failed"}}))}catch(g){s(m=>({...m,[u]:{status:"error",error:g instanceof Error?g.message:"Deploy failed"}}))}},[e]),p=u=>{var g;return i?(g=i[u.connectionKey])!=null&&g.connected?"connected":"disconnected":o?"unknown":"checking"};return r.jsx("div",{className:"h-full overflow-y-auto terminal-scroll",children:r.jsxs("div",{className:"p-6 max-w-2xl mx-auto space-y-6",children:[r.jsxs("div",{children:[r.jsxs("h3",{className:"text-lg font-heading font-bold text-ink flex items-center gap-2",children:[r.jsx(Kt,{size:20,className:"text-primary"}),"Deploy Your Project"]}),r.jsx("p",{className:"text-xs text-muted mt-1",children:"Choose a platform to deploy your project. One click to go live."})]}),r.jsxs("div",{className:"border border-border rounded-lg overflow-hidden",children:[r.jsxs("button",{type:"button",onClick:()=>h(!l),className:"flex items-center justify-between w-full px-4 py-3 text-left hover:bg-hover transition-colors",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(lc,{size:16,className:"text-primary"}),r.jsx("span",{className:"text-sm font-medium text-ink",children:"Platform Connections"}),r.jsx("div",{className:"flex items-center gap-1 ml-2",children:i?["vercel","netlify","github"].map(u=>{var g,m;return r.jsx("span",{className:`w-2 h-2 rounded-full ${(g=i[u])!=null&&g.connected?"bg-green-500":"bg-gray-300"}`,title:`${u}: ${(m=i[u])!=null&&m.connected?"Connected":"Not connected"}`},u)}):r.jsx("span",{className:"text-[11px] text-muted",children:o?"Status unknown":"Checking..."})})]}),r.jsx("span",{className:"text-xs text-muted",children:l?"Hide":"Manage"})]}),l&&r.jsx("div",{className:"border-t border-border p-4",children:r.jsx(ux,{compact:!0,onStatusChange:n})})]}),r.jsx("div",{className:"space-y-3",children:fx.map(u=>r.jsx(mx,{platform:u,deployState:t[u.id],onDeploy:()=>f(u.id),disabled:c,connection:p(u)},u.id))}),r.jsx("div",{className:"border-t border-border"}),r.jsx(px,{sessionId:e,disabled:c})]})})}const Ch=typeof navigator<"u"&&/Mac/.test(navigator.userAgent),Et=Ch?"Cmd":"Ctrl",Bl=[{keys:[`${Et}+K`],label:"Open Command Palette",category:"navigation"},{keys:[`${Et}+P`],label:"Quick open file",category:"navigation"},{keys:[`${Et}+,`],label:"Open settings",category:"navigation"},{keys:[`${Et}+S`],label:"Save file",category:"editor"},{keys:[`${Et}+Z`],label:"Undo",category:"editor"},{keys:[`${Et}+Shift+Z`],label:"Redo",category:"editor"},{keys:[`${Et}+B`],label:"Start / stop build",category:"build"},{keys:[`${Et}+\``],label:"Toggle terminal",category:"build"},{keys:["?"],label:"Show keyboard shortcuts",category:"general"},{keys:[`${Et}+?`],label:"Show keyboard shortcuts (alt)",category:"general"},{keys:["Escape"],label:"Close modals",category:"general"}],gx={navigation:"Navigation",editor:"Editor",build:"Build",general:"General"},xx=["navigation","editor","build","general"];function vx({onToggleTerminal:e,onToggleBuild:t}){const[s,i]=d.useState(!1),n=d.useCallback(o=>{var c,f;const a=Ch?o.metaKey:o.ctrlKey,l=(c=o.target)==null?void 0:c.tagName,h=l==="INPUT"||l==="TEXTAREA"||((f=o.target)==null?void 0:f.isContentEditable);if(a&&(o.key==="?"||o.shiftKey&&o.key==="/")){o.preventDefault(),i(p=>!p);return}if(o.key==="?"&&!a&&!h){o.preventDefault(),i(p=>!p);return}if(a&&o.key==="`"){o.preventDefault(),e==null||e();return}if(a&&o.key==="b"){o.preventDefault(),t==null||t();return}o.key==="Escape"&&s&&i(!1)},[e,t,s]);return d.useEffect(()=>(window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)),[n]),{showHelp:s,setShowHelp:i}}function bx({open:e,onClose:t}){const[s,i]=d.useState("");d.useEffect(()=>{e&&i("")},[e]);const n=d.useMemo(()=>{if(!s.trim())return Bl;const a=s.toLowerCase();return Bl.filter(l=>l.label.toLowerCase().includes(a)||l.keys.some(h=>h.toLowerCase().includes(a))||l.category.toLowerCase().includes(a))},[s]),o=d.useMemo(()=>{const a={};for(const l of n)a[l.category]||(a[l.category]=[]),a[l.category].push(l);return a},[n]);return e?r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-ink/20",onClick:t,children:r.jsxs("div",{className:"bg-card rounded-xl shadow-2xl border border-border w-full max-w-md mx-4 overflow-hidden",onClick:a=>a.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(bd,{size:16,className:"text-primary"}),r.jsx("h2",{className:"text-sm font-heading font-bold text-ink",children:"Keyboard Shortcuts"})]}),r.jsx("button",{onClick:t,className:"text-muted hover:text-ink transition-colors p-1 rounded-btn hover:bg-hover",children:r.jsx(gt,{size:16})})]}),r.jsx("div",{className:"px-4 py-2 border-b border-border",children:r.jsxs("div",{className:"relative",children:[r.jsx(as,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted"}),r.jsx("input",{type:"text",value:s,onChange:a=>i(a.target.value),placeholder:"Filter shortcuts...",className:"w-full pl-9 pr-3 py-1.5 text-xs bg-card border border-border rounded-btn outline-none focus:border-primary transition-colors",autoFocus:!0})]})}),r.jsxs("div",{className:"max-h-[400px] overflow-y-auto terminal-scroll",children:[xx.map(a=>{const l=o[a];return!l||l.length===0?null:r.jsxs("div",{children:[r.jsx("div",{className:"px-5 pt-3 pb-1",children:r.jsx("span",{className:"text-[10px] font-semibold text-muted uppercase tracking-wider",children:gx[a]})}),r.jsx("div",{className:"px-4 space-y-0.5 pb-2",children:l.map(h=>r.jsxs("div",{className:"flex items-center justify-between px-2 py-2 rounded-btn hover:bg-hover",children:[r.jsx("span",{className:"text-xs text-ink",children:h.label}),r.jsx("div",{className:"flex items-center gap-1",children:h.keys.map(c=>r.jsx("kbd",{className:"px-2 py-0.5 text-[11px] font-mono bg-hover border border-border rounded text-muted-accessible",children:c},c))})]},h.label))})]},a)}),n.length===0&&r.jsx("div",{className:"px-5 py-8 text-center",children:r.jsxs("p",{className:"text-xs text-muted",children:['No shortcuts matching "',s,'"']})})]}),r.jsx("div",{className:"px-5 py-3 border-t border-border text-center",children:r.jsxs("span",{className:"text-[11px] text-muted",children:["Press ",r.jsx("kbd",{className:"px-1.5 py-0.5 text-[10px] font-mono bg-hover border border-border rounded",children:"Escape"})," to close"]})})]})}):null}function yx({onClick:e}){return r.jsx("button",{onClick:e,title:"Keyboard shortcuts",className:"inline-flex items-center justify-center w-7 h-7 rounded-btn text-muted hover:text-ink hover:bg-hover transition-colors text-xs font-bold",children:"?"})}const kh="pl_recent_commands",Sx=5;function Nh(){try{const e=localStorage.getItem(kh);return e?JSON.parse(e):[]}catch{return[]}}function Qr(e){try{const t=Nh().filter(s=>s!==e);t.unshift(e),localStorage.setItem(kh,JSON.stringify(t.slice(0,Sx)))}catch{}}function wx(e){var i;const t=((i=e.split(".").pop())==null?void 0:i.toLowerCase())||"";return{js:Q,ts:Q,tsx:Q,jsx:Q,py:Q,go:Q,rs:Q,rb:Q,sh:Q,html:ac,css:no,json:ro,md:_i}[t]||oo}function Cx(e,t){const s=e.toLowerCase(),i=t.toLowerCase(),n=[];let o=0;for(let a=0;a<i.length&&o<s.length;a++)i[a]===s[o]&&(n.push(a),o++);return o===s.length?n:null}function Tl({text:e,indices:t}){if(t.length===0)return r.jsx(r.Fragment,{children:e});const s=new Set(t);return r.jsx(r.Fragment,{children:e.split("").map((i,n)=>s.has(n)?r.jsx("span",{className:"text-primary font-semibold",children:i},n):r.jsx("span",{children:i},n))})}function kx({isOpen:e,onClose:t,commands:s,sessionId:i,onFileSelect:n}){const[o,a]=d.useState(""),[l,h]=d.useState(0),[c,f]=d.useState([]),[p,u]=d.useState(!1),g=d.useRef(null),m=d.useRef(null),_=yd(e);Sd(e,t),d.useEffect(()=>{e&&(a(""),h(0),f([]),u(!1),setTimeout(()=>{var S;return(S=g.current)==null?void 0:S.focus()},50))},[e]);const x=d.useMemo(()=>Nh().map(C=>s.find(D=>D.id===C)).filter(Boolean),[s]),y=d.useMemo(()=>{if(!o.trim())return s.map(C=>({cmd:C,indices:[]}));const S=[];for(const C of s){const D=Cx(o,C.label);if(D){const L=D[0]*10+(D[D.length-1]-D[0]);S.push({cmd:C,indices:D,score:L})}}return S.sort((C,D)=>C.score-D.score),S.map(C=>({cmd:C.cmd,indices:C.indices}))},[s,o]),v=d.useMemo(()=>o.trim()?y.filter(S=>S.cmd.category==="setting"):[],[y,o]),j=d.useMemo(()=>y.filter(S=>S.cmd.category!=="setting"),[y]);d.useEffect(()=>{if(!i||!o.trim()){f([]),u(!1);return}return u(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(async()=>{try{const S=await W.searchFiles(i,o);f(S.filter(C=>C.type==="file"))}catch{f([])}u(!1)},200),()=>{m.current&&clearTimeout(m.current)}},[o,i]);const k=!o.trim()&&x.length>0,w=d.useMemo(()=>{const S=[];return k&&x.forEach((C,D)=>S.push({type:"recent",index:D})),j.forEach((C,D)=>S.push({type:"command",index:D})),v.length>0&&v.forEach((C,D)=>S.push({type:"setting",index:D})),c.forEach((C,D)=>S.push({type:"file",index:D})),S},[k,x,j,v,c]),N=w.length;d.useEffect(()=>{h(0)},[o]);const M=d.useCallback(S=>{const C=w[S];if(C){if(C.type==="recent"){const D=x[C.index];D&&(Qr(D.id),D.action(),t())}else if(C.type==="command"){const D=j[C.index];D&&(Qr(D.cmd.id),D.cmd.action(),t())}else if(C.type==="setting"){const D=v[C.index];D&&(Qr(D.cmd.id),D.cmd.action(),t())}else if(C.type==="file"){const D=c[C.index];D&&n&&(n(D.path,D.name),t())}}},[w,x,j,v,c,n,t]),U=d.useCallback(S=>{S.key==="ArrowDown"?(S.preventDefault(),h(C=>Math.min(C+1,N-1))):S.key==="ArrowUp"?(S.preventDefault(),h(C=>Math.max(C-1,0))):S.key==="Enter"&&N>0?M(l):S.key==="Escape"&&t()},[N,l,M,t]);if(!e)return null;let Y=0;const V=()=>Y++,$=j.length>0,P=v.length>0,E=c.length>0,B=p&&o.trim().length>0;return r.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[20vh]",onClick:t,children:[r.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm"}),r.jsxs("div",{ref:_,className:"relative w-full max-w-lg bg-card rounded-xl shadow-2xl border border-border overflow-hidden",onClick:S=>S.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border",children:[r.jsx(as,{size:18,className:"text-muted"}),r.jsx("input",{ref:g,value:o,onChange:S=>a(S.target.value),onKeyDown:U,placeholder:"Search commands, files, settings...",className:"flex-1 bg-transparent text-sm outline-none text-ink placeholder:text-muted"}),r.jsx("kbd",{className:"text-[10px] text-muted bg-hover px-1.5 py-0.5 rounded border border-border font-mono",children:"ESC"})]}),r.jsxs("div",{className:"max-h-[360px] overflow-y-auto py-1 terminal-scroll",children:[k&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"px-4 py-1.5 text-[10px] font-semibold text-muted uppercase tracking-wider flex items-center gap-1.5",children:[r.jsx(ut,{size:10})," Recent"]}),x.map((S,C)=>{const D=V(),L=S.icon;return r.jsxs("button",{onClick:()=>M(D),className:`w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors ${D===l?"bg-primary/10 text-primary":"text-ink hover:bg-hover"}`,children:[r.jsx(L,{size:16}),r.jsx("span",{className:"flex-1 text-left",children:S.label}),S.shortcut&&r.jsx("kbd",{className:"text-[10px] text-muted bg-hover px-1.5 py-0.5 rounded border border-border font-mono",children:S.shortcut})]},`recent-${S.id}`)})]}),$&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"px-4 py-1.5 text-[10px] font-semibold text-muted uppercase tracking-wider",children:"Commands"}),j.map((S,C)=>{const D=V(),L=S.cmd.icon;return r.jsxs("button",{onClick:()=>M(D),className:`w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors ${D===l?"bg-primary/10 text-primary":"text-ink hover:bg-hover"}`,children:[r.jsx(L,{size:16}),r.jsx("span",{className:"flex-1 text-left",children:o.trim()?r.jsx(Tl,{text:S.cmd.label,indices:S.indices}):S.cmd.label}),S.cmd.shortcut&&r.jsx("kbd",{className:"text-[10px] text-muted bg-hover px-1.5 py-0.5 rounded border border-border font-mono",children:S.cmd.shortcut})]},S.cmd.id)})]}),P&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"px-4 py-1.5 text-[10px] font-semibold text-muted uppercase tracking-wider mt-1",children:"Settings"}),v.map((S,C)=>{const D=V(),L=S.cmd.icon;return r.jsxs("button",{onClick:()=>M(D),className:`w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors ${D===l?"bg-primary/10 text-primary":"text-ink hover:bg-hover"}`,children:[r.jsx(L,{size:16}),r.jsx("span",{className:"flex-1 text-left",children:r.jsx(Tl,{text:S.cmd.label,indices:S.indices})}),S.cmd.shortcut&&r.jsx("kbd",{className:"text-[10px] text-muted bg-hover px-1.5 py-0.5 rounded border border-border font-mono",children:S.cmd.shortcut})]},`setting-${S.cmd.id}`)})]}),E&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"px-4 py-1.5 text-[10px] font-semibold text-muted uppercase tracking-wider mt-1",children:"Files"}),c.map((S,C)=>{const D=V(),L=S.type==="directory"?ao:wx(S.name);return r.jsxs("button",{onClick:()=>M(D),className:`w-full flex items-center gap-3 px-4 py-2 text-sm transition-colors ${D===l?"bg-primary/10 text-primary":"text-ink hover:bg-hover"}`,children:[r.jsx(L,{size:14}),r.jsx("span",{className:"flex-1 text-left font-mono text-xs truncate",children:S.name}),r.jsx("span",{className:"text-[10px] text-muted truncate max-w-[200px]",children:S.path})]},`file-${S.path}`)})]}),B&&!E&&r.jsx("div",{className:"px-4 py-2 text-xs text-muted animate-pulse",children:"Searching files..."}),N===0&&!B&&r.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted",children:"No results found"})]})]})]})}const Nx=d.lazy(()=>eo(()=>import("./GitHubIssuesPanel-7Bi1t04Q.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])).then(e=>({default:e.GitHubIssuesPanel}))),jx=d.lazy(()=>eo(()=>import("./GitHubPRsPanel-BxZtNprq.js"),__vite__mapDeps([10,1,2,3,11,4,5,6,12,13,14,15,16,17,18,19,20,21,22,23,8,24,25,26,27,28,29,9,30,31,32,33,34])).then(e=>({default:e.GitHubPRsPanel}))),Ex=d.lazy(()=>eo(()=>Promise.resolve().then(()=>qx),void 0).then(e=>({default:e.CICDPanel}))),Dx=3e4,Rx={modified:r.jsx(Q,{size:13,className:"text-yellow-500"}),added:r.jsx(_r,{size:13,className:"text-green-500"}),deleted:r.jsx(io,{size:13,className:"text-red-400"}),renamed:r.jsx(Q,{size:13,className:"text-blue-400"}),untracked:r.jsx(sc,{size:13,className:"text-muted"})},Px={modified:"M",added:"A",deleted:"D",renamed:"R",untracked:"?"};function Mx({commit:e}){return r.jsx("div",{className:"px-3 py-2 border-b border-border hover:bg-hover transition-colors",children:r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(tc,{size:14,className:"text-primary mt-0.5 flex-shrink-0"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"text-xs font-medium text-ink truncate",children:e.message}),r.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[r.jsx("span",{className:"text-[11px] font-mono text-primary/70",children:e.short_hash}),r.jsx("span",{className:"text-[11px] text-muted",children:e.author}),r.jsx("span",{className:"text-[11px] text-muted ml-auto flex-shrink-0",children:e.date})]}),e.refs.length>0&&r.jsx("div",{className:"flex gap-1 mt-1",children:e.refs.map((t,s)=>r.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono bg-primary/10 text-primary rounded",children:[r.jsx(Te,{size:9}),t]},s))})]})]})})}function zl({file:e}){return r.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 hover:bg-hover transition-colors text-xs",children:[Rx[e.status]||r.jsx(sc,{size:13}),r.jsx("span",{className:"font-mono text-ink truncate flex-1",children:e.path}),r.jsx("span",{className:`font-mono text-[10px] px-1 rounded ${e.staged?"bg-green-500/10 text-green-500":"bg-muted/10 text-muted"}`,children:Px[e.status]||"?"})]})}function Lx({sessionId:e}){const[t,s]=d.useState("changes"),[i,n]=d.useState(null),[o,a]=d.useState([]),[l,h]=d.useState([]),[c,f]=d.useState(!0),[p,u]=d.useState(null),[g,m]=d.useState(""),[_,x]=d.useState(!1),[y,v]=d.useState(null),[j,k]=d.useState(!1),[w,N]=d.useState(""),[M,U]=d.useState(!1),[Y,V]=d.useState(!1),[$,P]=d.useState(""),[E,B]=d.useState(""),[S,C]=d.useState(!1),[D,L]=d.useState(null),[Z,oe]=d.useState(!1),q=d.useCallback(async()=>{f(!0),u(null);try{const[z,xe,T]=await Promise.all([W.git.status(e),W.git.log(e),W.git.branches(e)]);n(z),a(xe),h(T)}catch(z){u(z instanceof Error?z.message:"Failed to load git data")}f(!1)},[e]);d.useEffect(()=>{q()},[q]);const J=async()=>{if(!(!g.trim()||_)){x(!0),v(null);try{const z=await W.git.commit(e,g.trim());v(`Committed: ${z.hash}`),m(""),await q()}catch(z){v(`Error: ${z instanceof Error?z.message:"Commit failed"}`)}x(!1)}},se=async()=>{if(!(!w.trim()||M)){U(!0);try{await W.git.createBranch(e,w.trim()),N(""),k(!1),await q()}catch(z){u(z instanceof Error?z.message:"Branch creation failed")}U(!1)}},de=async z=>{try{await W.git.checkoutBranch(e,z),await q()}catch(xe){u(xe instanceof Error?xe.message:"Checkout failed")}},ue=async()=>{oe(!0);try{await W.git.push(e),await q()}catch(z){u(z instanceof Error?z.message:"Push failed")}oe(!1)},ce=async()=>{if(!(!$.trim()||S)){C(!0),L(null);try{const z=await W.git.pr(e,$.trim(),E.trim());L(z.url),P(""),B(""),V(!1)}catch(z){L(`Error: ${z instanceof Error?z.message:"PR creation failed"}`)}C(!1)}},ge=(i==null?void 0:i.files.filter(z=>z.staged))||[],Fe=(i==null?void 0:i.files.filter(z=>!z.staged))||[];return c&&!i?r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx(bt,{size:20,className:"text-muted animate-spin"}),r.jsx("span",{className:"text-xs text-muted",children:"Loading git status..."})]})}):p&&!i?r.jsx("div",{className:"h-full flex items-center justify-center p-6",children:r.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[r.jsx(_s,{size:32,className:"text-muted/40"}),r.jsx("p",{className:"text-sm text-muted",children:p}),r.jsx("p",{className:"text-xs text-muted/60",children:"This project may not be a git repository."}),r.jsx(le,{size:"sm",variant:"secondary",icon:bt,onClick:q,children:"Retry"})]})}):r.jsxs("div",{className:"h-full flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border bg-hover flex-shrink-0",children:[r.jsx(Te,{size:14,className:"text-primary"}),r.jsx("span",{className:"text-xs font-semibold text-ink",children:(i==null?void 0:i.branch)||"unknown"}),i&&(i.ahead>0||i.behind>0)&&r.jsxs("span",{className:"text-[10px] text-muted font-mono",children:[i.ahead>0&&`+${i.ahead}`,i.ahead>0&&i.behind>0&&" / ",i.behind>0&&`-${i.behind}`]}),(i==null?void 0:i.clean)&&r.jsxs("span",{className:"flex items-center gap-0.5 text-[10px] text-green-500",children:[r.jsx(Yt,{size:10})," Clean"]}),r.jsx("div",{className:"flex-1"}),r.jsx("button",{onClick:q,className:"p-1 text-muted hover:text-ink rounded transition-colors",title:"Refresh",children:r.jsx(bt,{size:13,className:c?"animate-spin":""})})]}),r.jsx("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-border flex-shrink-0",children:[{id:"changes",label:"Changes",icon:Q,count:(i==null?void 0:i.files.length)||0},{id:"history",label:"History",icon:ut},{id:"branches",label:"Branches",icon:Te,count:l.length}].map(z=>r.jsxs("button",{onClick:()=>s(z.id),className:`flex items-center gap-1 px-2.5 py-1 text-[11px] font-medium rounded-btn transition-colors ${t===z.id?"bg-primary/10 text-primary":"text-muted hover:text-ink"}`,children:[r.jsx(z.icon,{size:12}),z.label,z.count!==void 0&&z.count>0&&r.jsx("span",{className:"ml-0.5 px-1 py-0 text-[9px] rounded-full bg-primary/20 text-primary font-mono",children:z.count})]},z.id))}),p&&r.jsx("div",{className:"px-3 py-2 bg-red-500/5 border-b border-red-500/20 text-xs text-red-400",children:p}),r.jsxs("div",{className:"flex-1 overflow-y-auto terminal-scroll",children:[t==="changes"&&r.jsx("div",{className:"flex flex-col h-full",children:(i==null?void 0:i.files.length)===0?r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Yt,{size:28,className:"text-green-500/30 mb-2"}),r.jsx("p",{className:"text-xs text-muted",children:"Working tree clean"}),r.jsx("p",{className:"text-[11px] text-muted/60 mt-0.5",children:"No changes to commit."})]}):r.jsxs(r.Fragment,{children:[ge.length>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"px-3 py-1.5 text-[10px] font-semibold text-muted uppercase tracking-wider bg-green-500/5 border-b border-border",children:["Staged (",ge.length,")"]}),ge.map((z,xe)=>r.jsx(zl,{file:z},`s-${xe}`))]}),Fe.length>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"px-3 py-1.5 text-[10px] font-semibold text-muted uppercase tracking-wider bg-yellow-500/5 border-b border-border",children:["Unstaged (",Fe.length,")"]}),Fe.map((z,xe)=>r.jsx(zl,{file:z},`u-${xe}`))]}),r.jsxs("div",{className:"mt-auto border-t border-border p-3 space-y-2 flex-shrink-0",children:[r.jsx("textarea",{value:g,onChange:z=>m(z.target.value),placeholder:"Commit message...",rows:2,className:"w-full px-3 py-1.5 text-xs bg-card border border-border rounded-btn outline-none focus:border-primary transition-colors resize-none font-mono"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(le,{size:"sm",icon:tc,onClick:J,disabled:!g.trim()||_,loading:_,children:"Commit"}),r.jsx(le,{size:"sm",variant:"secondary",icon:rc,onClick:ue,loading:Z,disabled:Z,children:"Push"}),r.jsx(le,{size:"sm",variant:"ghost",icon:an,onClick:()=>V(!Y),children:"PR"})]}),y&&r.jsx("p",{className:`text-[11px] font-mono ${y.startsWith("Error")?"text-red-400":"text-green-500"}`,children:y}),D&&r.jsx("p",{className:"text-[11px] font-mono text-primary",children:D.startsWith("Error")?r.jsx("span",{className:"text-red-400",children:D}):r.jsx("a",{href:D,target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-primary/80",children:D})})]}),Y&&r.jsxs("div",{className:"border-t border-border p-3 space-y-2 flex-shrink-0 bg-hover",children:[r.jsx("p",{className:"text-[11px] font-semibold text-ink",children:"Create Pull Request"}),r.jsx("input",{value:$,onChange:z=>P(z.target.value),placeholder:"PR title...",className:"w-full px-3 py-1.5 text-xs bg-card border border-border rounded-btn outline-none focus:border-primary"}),r.jsx("textarea",{value:E,onChange:z=>B(z.target.value),placeholder:"PR description (optional)...",rows:3,className:"w-full px-3 py-1.5 text-xs bg-card border border-border rounded-btn outline-none focus:border-primary resize-none"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(le,{size:"sm",icon:an,onClick:ce,disabled:!$.trim()||S,loading:S,children:"Create PR"}),r.jsx(le,{size:"sm",variant:"ghost",onClick:()=>V(!1),children:"Cancel"})]})]})]})}),t==="history"&&r.jsx("div",{children:o.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(ut,{size:28,className:"text-muted/30 mb-2"}),r.jsx("p",{className:"text-xs text-muted",children:"No commits yet"})]}):o.map((z,xe)=>r.jsx(Mx,{commit:z},xe))}),t==="branches"&&r.jsxs("div",{children:[r.jsx("div",{className:"px-3 py-2 border-b border-border flex items-center gap-2",children:r.jsxs("button",{onClick:()=>k(!j),className:"flex items-center gap-1 text-xs text-primary hover:text-primary/80 font-medium",children:[r.jsx(gr,{size:12}),"New Branch"]})}),j&&r.jsxs("div",{className:"px-3 py-2 border-b border-border bg-hover flex items-center gap-2",children:[r.jsx("input",{value:w,onChange:z=>N(z.target.value),placeholder:"branch-name",className:"flex-1 px-2 py-1 text-xs font-mono bg-card border border-border rounded-btn outline-none focus:border-primary",onKeyDown:z=>{z.key==="Enter"&&se()}}),r.jsx(le,{size:"sm",onClick:se,disabled:!w.trim()||M,loading:M,children:"Create"})]}),l.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Te,{size:28,className:"text-muted/30 mb-2"}),r.jsx("p",{className:"text-xs text-muted",children:"No branches found"})]}):r.jsxs("div",{children:[l.filter(z=>!z.remote).map((z,xe)=>r.jsxs("button",{onClick:()=>!z.current&&de(z.name),disabled:z.current,className:`w-full text-left flex items-center gap-2 px-3 py-2 text-xs border-b border-border transition-colors ${z.current?"bg-primary/5":"hover:bg-hover cursor-pointer"}`,children:[r.jsx(Te,{size:13,className:z.current?"text-primary":"text-muted"}),r.jsx("span",{className:`font-mono ${z.current?"text-primary font-semibold":"text-ink"}`,children:z.name}),z.current&&r.jsx("span",{className:"ml-auto text-[10px] bg-primary/10 text-primary px-1.5 py-0.5 rounded font-medium",children:"current"})]},`l-${xe}`)),l.filter(z=>z.remote).length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"px-3 py-1.5 text-[10px] font-semibold text-muted uppercase tracking-wider bg-hover border-b border-border",children:"Remote"}),l.filter(z=>z.remote).map((z,xe)=>r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 text-xs border-b border-border",children:[r.jsx(Te,{size:13,className:"text-muted/60"}),r.jsx("span",{className:"font-mono text-muted",children:z.name})]},`r-${xe}`))]})]})]})]})]})}function en(){return r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx(bt,{size:20,className:"text-muted animate-spin"}),r.jsx("span",{className:"text-xs text-muted",children:"Loading..."})]})})}function tn({sessionId:e,onPushed:t}){const[s,i]=d.useState(!1),[n,o]=d.useState(null),a=async()=>{i(!0),o(null);try{await W.githubPush(e),t()}catch(l){o(l instanceof Error?l.message:"Push to GitHub failed")}i(!1)};return r.jsx("div",{className:"h-full flex items-center justify-center p-8",children:r.jsxs("div",{className:"flex flex-col items-center gap-4 text-center max-w-xs",children:[r.jsx(cu,{size:40,className:"text-muted/30"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-ink",children:"This project isn't connected to GitHub yet"}),r.jsx("p",{className:"text-xs text-muted mt-1",children:"Push your project to GitHub to access issues, pull requests, and CI/CD workflows."})]}),r.jsx("div",{className:"flex items-center gap-2",children:r.jsx(le,{size:"sm",icon:rc,onClick:a,loading:s,children:"Push to GitHub"})}),n&&r.jsx("p",{className:"text-[11px] text-red-400 font-mono",children:n})]})})}function Bx({sessionId:e}){const[t,s]=d.useState("changes"),[i,n]=d.useState(!0),[o,a]=d.useState(null),[l,h]=d.useState({actions:0,fetchedAt:0}),c=d.useRef(!1),f=d.useCallback(async()=>{n(!0);try{const _=await W.git.branches(e);a({has_remote:_.some(x=>x.remote)})}catch{a(null)}n(!1)},[e]);d.useEffect(()=>{f()},[f]);const p=d.useCallback(async()=>{if(!(o!=null&&o.has_remote)||Date.now()-l.fetchedAt<Dx||c.current)return;c.current=!0;const x=await W.getWorkflowRuns(e,5).catch(()=>null);h({actions:x?x.filter(y=>y.status==="in_progress").length:0,fetchedAt:Date.now()}),c.current=!1},[e,o==null?void 0:o.has_remote,l.fetchedAt]);if(d.useEffect(()=>{o!=null&&o.has_remote&&p()},[o==null?void 0:o.has_remote,p]),d.useEffect(()=>{["issues","prs","actions"].includes(t)&&(o!=null&&o.has_remote)&&p()},[t,o==null?void 0:o.has_remote,p]),i)return r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx(bt,{size:20,className:"text-muted animate-spin"}),r.jsx("span",{className:"text-xs text-muted",children:"Checking GitHub connection..."})]})});const u=(o==null?void 0:o.has_remote)??!0,g=[{id:"changes",label:"Changes",icon:Q,requiresRemote:!1},{id:"issues",label:"Issues",icon:$d,requiresRemote:!0},{id:"prs",label:"PRs",icon:an,requiresRemote:!0},{id:"actions",label:"Actions",icon:rs,count:l.actions,requiresRemote:!0}],m=g;return r.jsxs("div",{className:"h-full flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-border bg-hover flex-shrink-0",children:[m.map(_=>{const x=_.requiresRemote&&!u;return r.jsxs("button",{onClick:()=>s(_.id),disabled:x,className:`flex items-center gap-1 px-2.5 py-1 text-[11px] font-medium rounded-btn transition-colors ${t===_.id?"bg-primary/10 text-primary":x?"text-muted/40 cursor-not-allowed":"text-muted hover:text-ink"}`,title:x?"Connect to GitHub to access this tab":void 0,children:[r.jsx(_.icon,{size:12}),_.label,_.count!==void 0&&_.count>0&&r.jsx("span",{className:"ml-0.5 px-1 py-0 text-[9px] rounded-full bg-primary/20 text-primary font-mono",children:_.count})]},_.id)}),u&&(o==null?void 0:o.owner)&&r.jsxs("div",{className:"ml-auto flex items-center gap-1 text-[10px] text-muted font-mono",children:[r.jsx(lc,{size:10}),o.owner,"/",o.repo]})]}),r.jsxs("div",{className:"flex-1 overflow-hidden",children:[t==="changes"&&r.jsx(Lx,{sessionId:e}),t==="issues"&&(u?r.jsx(d.Suspense,{fallback:r.jsx(en,{}),children:r.jsx(Nx,{sessionId:e})}):r.jsx(tn,{sessionId:e,onPushed:f})),t==="prs"&&(u?r.jsx(d.Suspense,{fallback:r.jsx(en,{}),children:r.jsx(jx,{sessionId:e})}):r.jsx(tn,{sessionId:e,onPushed:f})),t==="actions"&&(u?r.jsx(d.Suspense,{fallback:r.jsx(en,{}),children:r.jsx("div",{className:"h-full overflow-y-auto p-4",children:r.jsx(Ex,{sessionId:e})})}):r.jsx(tn,{sessionId:e,onPushed:f}))]})]})}function Tx({sessionId:e,onRestore:t}){const[s,i]=d.useState([]),[n,o]=d.useState(!0),[a,l]=d.useState(null),[h,c]=d.useState(null),[f,p]=d.useState(null),u=d.useCallback(async()=>{try{const _=await W.getCheckpoints(e);i(_),p(null)}catch{p("Failed to load checkpoints")}o(!1)},[e]);d.useEffect(()=>{u();const _=setInterval(u,15e3);return()=>clearInterval(_)},[u]);const g=d.useCallback(async _=>{if(a)return;const x=s.find(v=>v.id===_);if(!(!x||!window.confirm(`Restore to checkpoint "${x.description}"?
226
226
 
227
227
  This will revert files to this checkpoint state.`))){l(_);try{await W.restoreCheckpoint(e,_),await u(),t==null||t()}catch{p("Failed to restore checkpoint")}l(null)}},[e,s,a,u,t]);if(n)return r.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-card border-b border-border",children:[r.jsx(rr,{size:14,className:"text-muted animate-pulse"}),r.jsx("span",{className:"text-xs text-muted",children:"Loading checkpoints..."})]});if(f&&s.length===0||s.length===0)return null;const m=_=>{if(!_)return"";try{return new Date(_).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}};return r.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5 bg-card border-b border-border overflow-x-auto",children:[r.jsx(rr,{size:14,className:"text-muted flex-shrink-0"}),r.jsx("span",{className:"text-[11px] font-medium text-muted flex-shrink-0",children:"Checkpoints"}),r.jsx("div",{className:"flex items-center gap-1 flex-1 min-w-0",children:s.map((_,x)=>r.jsxs("div",{className:"flex items-center gap-1",children:[x>0&&r.jsx("div",{className:"w-4 h-px bg-border flex-shrink-0"}),r.jsxs("div",{className:"relative flex-shrink-0",children:[r.jsx("button",{onClick:()=>g(_.id),onMouseEnter:()=>c(_.id),onMouseLeave:()=>c(null),disabled:a!==null,className:`w-3.5 h-3.5 rounded-full border-2 transition-all cursor-pointer ${_.is_current?"bg-primary border-primary shadow-sm shadow-primary/30":a===_.id?"bg-warning border-warning animate-pulse":"bg-card border-border hover:border-primary hover:bg-primary/10"} ${a!==null&&a!==_.id?"opacity-50":""}`,title:`${_.description} -- Click to restore`}),h===_.id&&r.jsxs("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 z-50 pointer-events-none",children:[r.jsxs("div",{className:"bg-card border border-border rounded-lg shadow-lg px-3 py-2 whitespace-nowrap",children:[r.jsx("p",{className:"text-xs font-medium text-ink",children:_.description}),r.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[_.timestamp&&r.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-muted",children:[r.jsx(ut,{size:10}),m(_.timestamp)]}),(_.files_changed??0)>0&&r.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-muted",children:[r.jsx(Q,{size:10}),_.files_changed," file",_.files_changed!==1?"s":""]}),(_.iteration??0)>0&&r.jsxs("span",{className:"text-[11px] text-muted",children:["Iter ",_.iteration]})]}),!_.is_current&&r.jsxs("div",{className:"flex items-center gap-1 mt-1.5 text-[11px] text-primary font-medium",children:[r.jsx(nc,{size:10}),"Click to restore"]}),_.is_current&&r.jsx("div",{className:"text-[11px] text-success mt-1",children:"Current"})]}),r.jsx("div",{className:"w-2 h-2 bg-card border-r border-b border-border rotate-45 mx-auto -mt-1"})]})]})]},_.id))}),f&&r.jsx("span",{className:"text-[11px] text-danger flex-shrink-0",children:f})]})}function zx({line:e}){const t=e.type==="add"?"bg-success/10":e.type==="delete"?"bg-danger/10":"",s=e.type==="add"?"text-success":e.type==="delete"?"text-danger":"text-muted",i=e.type==="add"?"+":e.type==="delete"?"-":" ",n=e.type==="delete"?e.old_line:e.new_line;return r.jsxs("div",{className:`flex font-mono text-xs leading-5 ${t}`,children:[r.jsx("span",{className:"w-12 text-right pr-2 text-muted/60 select-none flex-shrink-0 border-r border-border",children:n||""}),r.jsx("span",{className:`w-5 text-center select-none flex-shrink-0 ${s} font-bold`,children:i}),r.jsx("span",{className:`flex-1 whitespace-pre-wrap break-all pl-1 ${e.type==="context"?"text-ink/70":s}`,children:e.content})]})}function Ax({file:e,isSelected:t,onToggle:s}){const[i,n]=d.useState(!0),o=e.action==="add"?r.jsx(_r,{size:14,className:"text-success"}):e.action==="delete"?r.jsx(nu,{size:14,className:"text-danger"}):r.jsx(Q,{size:14,className:"text-blue-500"}),a=e.action==="add"?"New":e.action==="delete"?"Deleted":"Modified";return r.jsxs("div",{className:"border border-border rounded-lg overflow-hidden",children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-hover/50",children:[r.jsx("input",{type:"checkbox",checked:t,onChange:s,className:"w-3.5 h-3.5 rounded border-border accent-primary cursor-pointer"}),r.jsxs("button",{onClick:()=>n(l=>!l),className:"flex items-center gap-1 flex-1 min-w-0 text-left",children:[r.jsx(pr,{size:14,className:`text-muted transition-transform flex-shrink-0 ${i?"rotate-90":""}`}),o,r.jsx("span",{className:"text-xs font-mono text-ink truncate",children:e.path})]}),r.jsx("span",{className:`text-[11px] font-medium px-1.5 py-0.5 rounded ${e.action==="add"?"bg-success/10 text-success":e.action==="delete"?"bg-danger/10 text-danger":"bg-blue-500/10 text-blue-500"}`,children:a}),e.additions>0&&r.jsxs("span",{className:"flex items-center gap-0.5 text-[11px] text-success",children:[r.jsx(gr,{size:10}),e.additions]}),e.deletions>0&&r.jsxs("span",{className:"flex items-center gap-0.5 text-[11px] text-danger",children:[r.jsx(ic,{size:10}),e.deletions]})]}),i&&e.hunks.length>0&&r.jsx("div",{className:"border-t border-border max-h-[300px] overflow-y-auto terminal-scroll",children:e.hunks.map((l,h)=>r.jsxs("div",{children:[h>0&&r.jsxs("div",{className:"px-3 py-1 bg-hover/30 text-[11px] text-muted font-mono border-y border-border",children:["@@ -",l.old_start,",",l.old_count," +",l.new_start,",",l.new_count," @@"]}),l.lines.map((c,f)=>r.jsx(zx,{line:c},`${h}-${f}`))]},h))})]})}function Ox({data:e,onAcceptAll:t,onAcceptSelected:s,onReject:i,onClose:n}){const[o,a]=d.useState(()=>new Set(e.files.map(u=>u.path))),[l,h]=d.useState(0),c=d.useCallback(u=>{a(g=>{const m=new Set(g);return m.has(u)?m.delete(u):m.add(u),m})},[]),f=d.useCallback(()=>{o.size===e.files.length?a(new Set):a(new Set(e.files.map(u=>u.path)))},[o.size,e.files]),p=d.useCallback(()=>{s(Array.from(o))},[o,s]);return e.files.length===0?r.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",onClick:n,children:[r.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm"}),r.jsxs("div",{className:"relative bg-card rounded-xl shadow-2xl border border-border p-8 max-w-md",onClick:u=>u.stopPropagation(),children:[r.jsx("p",{className:"text-sm text-ink text-center",children:"No pending changes to preview."}),r.jsx("button",{onClick:n,className:"mt-4 w-full py-2 text-sm font-medium rounded-btn border border-border text-muted hover:text-ink hover:bg-hover transition-colors",children:"Close"})]})]}):r.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",onClick:n,children:[r.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm"}),r.jsxs("div",{className:"relative bg-card rounded-xl shadow-2xl border border-border w-full max-w-5xl max-h-[85vh] flex flex-col overflow-hidden",onClick:u=>u.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border flex-shrink-0",children:[r.jsx(Q,{size:18,className:"text-primary"}),r.jsx("h3",{className:"text-sm font-bold text-ink flex-1",children:"Change Preview"}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted",children:[r.jsxs("span",{className:"flex items-center gap-1 text-success",children:[r.jsx(gr,{size:12}),e.total_additions]}),r.jsxs("span",{className:"flex items-center gap-1 text-danger",children:[r.jsx(ic,{size:12}),e.total_deletions]}),r.jsxs("span",{children:[e.files.length," file",e.files.length!==1?"s":""]})]}),r.jsx("button",{onClick:n,className:"p-1 rounded hover:bg-hover text-muted hover:text-ink transition-colors",children:r.jsx(gt,{size:16})})]}),r.jsxs("div",{className:"flex flex-1 min-h-0",children:[r.jsxs("div",{className:"w-56 flex-shrink-0 border-r border-border overflow-y-auto terminal-scroll bg-hover/30",children:[r.jsx("div",{className:"px-3 py-2 border-b border-border",children:r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[r.jsx("input",{type:"checkbox",checked:o.size===e.files.length,onChange:f,className:"w-3.5 h-3.5 rounded border-border accent-primary"}),r.jsx("span",{className:"text-[11px] font-medium text-muted",children:"Select All"})]})}),e.files.map((u,g)=>{const m=u.action==="add"?"text-success":u.action==="delete"?"text-danger":"text-blue-500";return r.jsxs("button",{onClick:()=>h(g),className:`w-full flex items-center gap-2 px-3 py-1.5 text-left transition-colors ${g===l?"bg-primary/10 text-primary":"text-ink hover:bg-hover"}`,children:[r.jsx("input",{type:"checkbox",checked:o.has(u.path),onChange:()=>c(u.path),onClick:_=>_.stopPropagation(),className:"w-3 h-3 rounded border-border accent-primary flex-shrink-0"}),r.jsx("span",{className:"text-xs font-mono truncate flex-1",children:u.path.split("/").pop()}),r.jsx("span",{className:`text-[10px] flex-shrink-0 ${m}`,children:u.action==="add"?"+":u.action==="delete"?"-":"M"})]},u.path)})]}),r.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-3 terminal-scroll",children:e.files[l]&&r.jsx(Ax,{file:e.files[l],isSelected:o.has(e.files[l].path),onToggle:()=>c(e.files[l].path)})})]}),r.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-t border-border bg-hover/30 flex-shrink-0",children:[r.jsxs("button",{onClick:i,className:"flex items-center gap-1.5 px-4 py-2 text-sm font-medium rounded-btn border border-danger/30 text-danger hover:bg-danger/10 transition-colors",children:[r.jsx(oc,{size:14}),"Reject"]}),r.jsx("div",{className:"flex-1"}),r.jsxs("button",{onClick:p,disabled:o.size===0,className:"flex items-center gap-1.5 px-4 py-2 text-sm font-medium rounded-btn border border-primary/30 text-primary hover:bg-primary/10 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:[r.jsx(Yt,{size:14}),"Accept Selected (",o.size,")"]}),r.jsxs("button",{onClick:t,className:"flex items-center gap-1.5 px-4 py-2 text-sm font-medium rounded-btn bg-primary text-white hover:bg-primary-hover transition-colors",children:[r.jsx(Zd,{size:14}),"Accept All"]})]})]})]})}function Zi(e){if(e.status==="completed")switch(e.conclusion){case"success":return"success";case"failure":return"failed";case"cancelled":return"cancelled";case"skipped":return"skipped";case"timed_out":return"failed";default:return"failed"}return e.status==="in_progress"?"running":e.status==="queued"||e.status==="waiting"||e.status==="requested"||e.status==="pending"?"pending":"running"}function $x(e){if(e.status==="completed")switch(e.conclusion){case"success":return"success";case"failure":return"failed";case"cancelled":return"cancelled";case"skipped":return"skipped";default:return"failed"}return e.status==="in_progress"?"running":e.status==="queued"||e.status==="waiting"?"pending":"running"}function Ix(e){if(e.status==="completed")switch(e.conclusion){case"success":return"success";case"failure":return"failed";case"cancelled":return"cancelled";case"skipped":return"skipped";default:return"failed"}return e.status==="in_progress"?"running":"pending"}const jo={pending:{color:"text-[#939084]",bg:"bg-[#939084]/10",Icon:ut,label:"Queued"},running:{color:"text-[#553DE9]",bg:"bg-[#553DE9]/10",Icon:xr,label:"Running"},success:{color:"text-[#1FC5A8]",bg:"bg-[#1FC5A8]/10",Icon:Xl,label:"Success"},failed:{color:"text-[#C45B5B]",bg:"bg-[#C45B5B]/10",Icon:sr,label:"Failed"},cancelled:{color:"text-[#939084]",bg:"bg-[#939084]/10",Icon:oc,label:"Cancelled"},skipped:{color:"text-[#939084]",bg:"bg-[#939084]/10",Icon:wd,label:"Skipped"}};function jh(e){const t=new Date(e),i=Math.floor((new Date().getTime()-t.getTime())/1e3);if(i<60)return`${i}s ago`;const n=Math.floor(i/60);if(n<60)return`${n}m ago`;const o=Math.floor(n/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function Eh(e,t){if(!t)return"--";const s=new Date(t).getTime()-new Date(e).getTime();if(s<0)return"--";const i=Math.floor(s/1e3);if(i<60)return`${i}s`;const n=Math.floor(i/60),o=i%60;if(n<60)return`${n}m ${o}s`;const a=Math.floor(n/60),l=n%60;return`${a}h ${l}m`}function Eo({status:e}){const t=jo[e];return r.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium ${t.bg} ${t.color}`,children:[r.jsx(t.Icon,{size:12,className:e==="running"?"animate-spin":""}),t.label]})}function Fx({step:e}){const t=Ix(e),s=jo[t];return r.jsxs("div",{className:"flex items-center gap-2 py-1 px-3 text-xs",children:[r.jsx(s.Icon,{size:12,className:`${s.color} flex-shrink-0 ${t==="running"?"animate-spin":""}`}),r.jsx("span",{className:"text-[#201515] dark:text-[#E8E6E3] flex-1 truncate",children:e.name}),e.startedAt&&e.completedAt&&r.jsx("span",{className:"text-[#939084] font-mono flex-shrink-0",children:Eh(e.startedAt,e.completedAt)}),r.jsx(Eo,{status:t})]})}function Hx({job:e}){const[t,s]=d.useState(!1),i=$x(e),n=jo[i];return r.jsxs("div",{className:"border border-[#ECEAE3] dark:border-[#2A2A30] rounded-lg overflow-hidden",children:[r.jsxs("button",{onClick:()=>s(!t),className:"w-full flex items-center gap-3 px-4 py-2.5 text-left hover:bg-[#F8F4F0] dark:hover:bg-[#222228] transition-colors",children:[t?r.jsx(ms,{size:14,className:"text-[#939084]"}):r.jsx(pr,{size:14,className:"text-[#939084]"}),r.jsx(n.Icon,{size:14,className:`${n.color} ${i==="running"?"animate-spin":""}`}),r.jsx("span",{className:"text-sm font-medium text-[#201515] dark:text-[#E8E6E3] flex-1 truncate",children:e.name}),e.startedAt&&r.jsx("span",{className:"text-xs text-[#939084] font-mono flex-shrink-0",children:Eh(e.startedAt,e.completedAt)}),r.jsx(Eo,{status:i})]}),t&&e.steps&&e.steps.length>0&&r.jsx("div",{className:"border-t border-[#ECEAE3] dark:border-[#2A2A30] bg-[#FAFAF8] dark:bg-[#1A1A1F] divide-y divide-[#ECEAE3] dark:divide-[#2A2A30]",children:e.steps.map(o=>r.jsx(Fx,{step:o},o.number))})]})}function Wx({sessionId:e,runId:t}){const[s,i]=d.useState(null),[n,o]=d.useState(!1),[a,l]=d.useState(null),h=d.useCallback(async()=>{o(!0),l(null);try{const c=await W.getWorkflowRunLogs(e,t);i(c)}catch(c){l(c instanceof Error?c.message:"Failed to fetch logs")}finally{o(!1)}},[e,t]);return d.useEffect(()=>{h()},[h]),n?r.jsxs("div",{className:"bg-[#0F0F11] rounded-lg p-4 text-center",children:[r.jsx(xr,{size:16,className:"animate-spin text-[#939084] inline-block"}),r.jsx("span",{className:"text-xs text-[#939084] ml-2",children:"Loading logs..."})]}):a?r.jsx("div",{className:"bg-[#0F0F11] rounded-lg p-4",children:r.jsx("p",{className:"text-xs text-[#C45B5B] font-mono",children:a})}):r.jsx("div",{className:"bg-[#0F0F11] rounded-lg p-3 max-h-80 overflow-y-auto terminal-scroll",children:r.jsx("pre",{className:"text-xs font-mono leading-relaxed whitespace-pre-wrap text-[#E8E6E3]",children:s||"(No log output)"})})}function Ux({run:e,sessionId:t}){const[s,i]=d.useState(!1),[n,o]=d.useState(null),[a,l]=d.useState(!1),[h,c]=d.useState(null),[f,p]=d.useState(!1),u=Zi(e),g=d.useCallback(async()=>{if(!(n||a)){l(!0),c(null);try{const _=await W.getWorkflowRunDetail(t,e.databaseId);o(_)}catch(_){c(_ instanceof Error?_.message:"Failed to load run details")}finally{l(!1)}}},[t,e.databaseId,n,a]),m=()=>{const _=!s;i(_),_&&g()};return r.jsxs("div",{className:"border border-[#ECEAE3] dark:border-[#2A2A30] rounded-lg overflow-hidden",children:[r.jsxs("button",{onClick:m,className:"w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-[#F8F4F0] dark:hover:bg-[#222228] transition-colors",children:[s?r.jsx(ms,{size:14,className:"text-[#939084] flex-shrink-0"}):r.jsx(pr,{size:14,className:"text-[#939084] flex-shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("span",{className:"text-sm font-medium text-[#201515] dark:text-[#E8E6E3] truncate",children:e.name}),r.jsx(Eo,{status:u})]}),r.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[r.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-[#939084]",children:[r.jsx(Te,{size:12}),e.headBranch]}),r.jsx("span",{className:"text-xs text-[#939084]",children:e.event}),r.jsx("span",{className:"text-xs text-[#939084]",children:jh(e.createdAt)})]})]}),r.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",onClick:_=>_.stopPropagation(),className:"text-[#939084] hover:text-[#553DE9] transition-colors flex-shrink-0",title:"Open on GitHub",children:r.jsx(ls,{size:14})})]}),s&&r.jsxs("div",{className:"border-t border-[#ECEAE3] dark:border-[#2A2A30] px-4 pb-4 pt-3 space-y-3",children:[a&&r.jsxs("div",{className:"text-center py-4",children:[r.jsx(xr,{size:16,className:"animate-spin text-[#553DE9] inline-block"}),r.jsx("span",{className:"text-xs text-[#939084] ml-2",children:"Loading jobs..."})]}),h&&r.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-[#C45B5B]/10 text-[#C45B5B]",children:[r.jsx(Ut,{size:14}),r.jsx("span",{className:"text-xs",children:h})]}),n&&n.jobs&&n.jobs.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"text-xs font-semibold text-[#939084] uppercase tracking-wider",children:"Jobs"}),n.jobs.map(_=>r.jsx(Hx,{job:_},_.databaseId))]}),n&&(!n.jobs||n.jobs.length===0)&&!a&&r.jsx("p",{className:"text-xs text-[#939084]",children:"No jobs found for this run."}),n&&r.jsxs("div",{className:"pt-1",children:[r.jsxs("button",{onClick:()=>p(!f),className:"inline-flex items-center gap-1.5 text-xs text-[#553DE9] hover:text-[#4432c4] transition-colors",children:[r.jsx(os,{size:12}),f?"Hide full logs":"View full logs"]}),f&&r.jsx("div",{className:"mt-2",children:r.jsx(Wx,{sessionId:t,runId:e.databaseId})})]})]})]})}function Kx({sessionId:e,workflows:t,onClose:s,onDispatched:i}){var g;const[n,o]=d.useState(((g=t[0])==null?void 0:g.name)||""),[a,l]=d.useState(""),[h,c]=d.useState(!1),[f,p]=d.useState(null),u=async()=>{if(n){c(!0),p(null);try{await W.dispatchWorkflow(e,n,a),i(),s()}catch(m){p(m instanceof Error?m.message:"Dispatch failed")}finally{c(!1)}}};return r.jsxs("div",{className:"border border-[#ECEAE3] dark:border-[#2A2A30] rounded-lg p-4 bg-[#FAFAF8] dark:bg-[#1A1A1F] space-y-3",children:[r.jsx("h4",{className:"text-sm font-semibold text-[#201515] dark:text-[#E8E6E3]",children:"Run Workflow"}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs text-[#939084] mb-1",children:"Workflow"}),r.jsx("select",{value:n,onChange:m=>o(m.target.value),className:"w-full px-3 py-1.5 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#0F0F11] text-[#201515] dark:text-[#E8E6E3] focus:outline-none focus:ring-2 focus:ring-[#553DE9]/40",children:t.map(m=>r.jsxs("option",{value:m.name,children:[m.name," (",m.name,")"]},m.id))})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs text-[#939084] mb-1",children:"Branch / ref (leave empty for default)"}),r.jsx("input",{type:"text",value:a,onChange:m=>l(m.target.value),placeholder:"main",className:"w-full px-3 py-1.5 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#0F0F11] text-[#201515] dark:text-[#E8E6E3] focus:outline-none focus:ring-2 focus:ring-[#553DE9]/40"})]}),f&&r.jsxs("div",{className:"flex items-center gap-2 p-2 rounded bg-[#C45B5B]/10 text-[#C45B5B]",children:[r.jsx(Ut,{size:12}),r.jsx("span",{className:"text-xs",children:f})]}),r.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[r.jsx(le,{size:"sm",variant:"ghost",onClick:s,children:"Cancel"}),r.jsx(le,{size:"sm",icon:rs,onClick:u,loading:h,children:"Dispatch"})]})]})}function Dh({sessionId:e}){const[t,s]=d.useState([]),[i,n]=d.useState([]),[o,a]=d.useState(""),[l,h]=d.useState(!0),[c,f]=d.useState(null),[p,u]=d.useState(!1),[g,m]=d.useState(null),_=d.useRef(null),x=t.some(N=>N.status==="in_progress"||N.status==="queued"||N.status==="waiting"||N.status==="requested"||N.status==="pending"),y=d.useCallback(async(N=!1)=>{if(e){N&&h(!0),f(null);try{const M=await W.getWorkflowRuns(e);s(M),a(""),m(new Date)}catch(M){const U=M instanceof Error?M.message:String(M);U.includes("gh CLI not found")?f({type:"gh_not_found",message:"The gh CLI is not installed. Install it from https://cli.github.com/ to enable CI/CD integration."}):U.includes("not authenticated")||U.includes("401")?f({type:"not_authenticated",message:'The gh CLI is not authenticated. Run "gh auth login" in your terminal.'}):U.includes("Could not detect")?f({type:"no_repo",message:"No GitHub remote detected. Push this project to GitHub first."}):f({type:"generic",message:U})}finally{h(!1)}}},[e]),v=d.useCallback(async()=>{if(e)try{const N=await W.getWorkflows(e);n(N.filter(M=>M.state==="active"))}catch{n([])}},[e]);d.useEffect(()=>{y(!0),v()},[y,v]),d.useEffect(()=>(x&&e?_.current=setInterval(()=>y(!1),1e4):_.current&&(clearInterval(_.current),_.current=null),()=>{_.current&&clearInterval(_.current)}),[x,e,y]);const j=t.filter(N=>Zi(N)==="success").length,k=t.filter(N=>Zi(N)==="failed").length,w=t.filter(N=>{const M=Zi(N);return M==="running"||M==="pending"}).length;return r.jsxs("div",{className:"card p-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Te,{size:18,className:"text-[#553DE9]"}),r.jsx("h3",{className:"text-sm font-semibold text-[#201515] dark:text-[#E8E6E3] uppercase tracking-wider",children:"CI/CD Pipelines"}),o&&r.jsx("span",{className:"text-xs text-[#939084] font-mono",children:o})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[g&&r.jsxs("span",{className:"text-[10px] text-[#939084] flex items-center gap-1",children:[r.jsx(dc,{size:10}),jh(g.toISOString())]}),r.jsx(le,{size:"sm",variant:"ghost",icon:bt,onClick:()=>y(!0),children:"Refresh"}),i.length>0&&r.jsx(le,{size:"sm",icon:rs,onClick:()=>u(!p),children:"Run Workflow"})]})]}),p&&e&&i.length>0&&r.jsx("div",{className:"mb-4",children:r.jsx(Kx,{sessionId:e,workflows:i,onClose:()=>u(!1),onDispatched:()=>{setTimeout(()=>y(!1),3e3)}})}),c&&r.jsxs("div",{className:"mb-4",children:[c.type==="gh_not_found"&&r.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-lg bg-[#939084]/5 border border-[#ECEAE3] dark:border-[#2A2A30]",children:[r.jsx(Ut,{size:18,className:"text-[#939084] flex-shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-[#201515] dark:text-[#E8E6E3]",children:"GitHub CLI not installed"}),r.jsx("p",{className:"text-xs text-[#939084] mt-1",children:c.message}),r.jsxs("a",{href:"https://cli.github.com/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs text-[#553DE9] hover:text-[#4432c4] mt-2",children:["Install GitHub CLI ",r.jsx(ls,{size:10})]})]})]}),c.type==="not_authenticated"&&r.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-lg bg-[#C45B5B]/5 border border-[#C45B5B]/20",children:[r.jsx(Ut,{size:18,className:"text-[#C45B5B] flex-shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-[#201515] dark:text-[#E8E6E3]",children:"Not authenticated"}),r.jsx("p",{className:"text-xs text-[#939084] mt-1",children:c.message}),r.jsx("code",{className:"inline-block text-xs bg-[#0F0F11] text-[#E8E6E3] px-2 py-1 rounded mt-2 font-mono",children:"gh auth login"})]})]}),c.type==="no_repo"&&r.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-lg bg-[#939084]/5 border border-[#ECEAE3] dark:border-[#2A2A30]",children:[r.jsx(Te,{size:18,className:"text-[#939084] flex-shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-[#201515] dark:text-[#E8E6E3]",children:"No GitHub repository"}),r.jsx("p",{className:"text-xs text-[#939084] mt-1",children:c.message})]})]}),c.type==="generic"&&r.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-lg bg-[#C45B5B]/5 border border-[#C45B5B]/20",children:[r.jsx(Ut,{size:18,className:"text-[#C45B5B] flex-shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-[#201515] dark:text-[#E8E6E3]",children:"Failed to load workflow runs"}),r.jsx("p",{className:"text-xs text-[#939084] mt-1",children:c.message})]})]})]}),!l&&!c&&t.length>0&&r.jsxs("div",{className:"flex items-center gap-4 mb-4 text-xs",children:[r.jsxs("span",{className:"flex items-center gap-1 text-[#1FC5A8]",children:[r.jsx(Xl,{size:12}),j," passed"]}),r.jsxs("span",{className:"flex items-center gap-1 text-[#C45B5B]",children:[r.jsx(sr,{size:12}),k," failed"]}),r.jsxs("span",{className:"flex items-center gap-1 text-[#553DE9]",children:[r.jsx(xr,{size:12,className:w>0?"animate-spin":""}),w," active"]}),x&&r.jsx("span",{className:"text-[#939084] italic",children:"Auto-refreshing every 10s"})]}),l&&r.jsx("div",{className:"space-y-3",children:[1,2,3].map(N=>r.jsx("div",{className:"border border-[#ECEAE3] dark:border-[#2A2A30] rounded-lg p-4 animate-pulse",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-4 h-4 bg-[#ECEAE3] dark:bg-[#2A2A30] rounded"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"h-4 bg-[#ECEAE3] dark:bg-[#2A2A30] rounded w-48"}),r.jsx("div",{className:"h-3 bg-[#ECEAE3] dark:bg-[#2A2A30] rounded w-32 mt-2"})]}),r.jsx("div",{className:"h-5 bg-[#ECEAE3] dark:bg-[#2A2A30] rounded-full w-16"})]})},N))}),!l&&!c&&t.length===0&&r.jsxs("div",{className:"text-center py-8",children:[r.jsx("p",{className:"text-[#939084] text-sm",children:"No workflow runs found"}),r.jsx("p",{className:"text-[#939084]/60 text-xs mt-1",children:"Push commits or trigger a workflow to see runs here"})]}),!l&&!c&&t.length>0&&e&&r.jsx("div",{className:"space-y-3 max-h-[600px] overflow-y-auto terminal-scroll",children:t.map(N=>r.jsx(Ux,{run:N,sessionId:e},N.databaseId))})]})}const qx=Object.freeze(Object.defineProperty({__proto__:null,CICDPanel:Dh},Symbol.toStringTag,{value:"Module"}));function Vx({phase:e,buildTime:t,onDismiss:s}){const[i,n]=d.useState(!1),[o,a]=d.useState(!1),l=d.useRef(e);if(d.useEffect(()=>{if(e==="complete"&&l.current!=="complete"){n(!0),a(!1);const c=setTimeout(()=>{n(!1),a(!0),s==null||s()},3e3);return()=>clearTimeout(c)}e!=="complete"&&a(!1),l.current=e},[e,s]),!i||o)return null;const h=c=>{if(c<60)return`${c}s`;const f=Math.floor(c/60),p=c%60;return`${f}m ${p}s`};return r.jsx("div",{className:"build-celebration-overlay",onClick:()=>{n(!1),a(!0),s==null||s()},children:r.jsxs("div",{className:"build-celebration-content",onClick:c=>c.stopPropagation(),children:[r.jsx("div",{className:"build-celebration-icon",children:r.jsx(ps,{size:48,className:"text-success"})}),r.jsx("div",{className:"build-celebration-burst"}),r.jsx("h3",{className:"text-lg font-heading font-bold text-ink mt-4",children:"Your app is ready!"}),r.jsx("p",{className:"text-sm text-muted mt-1",children:t?`Built in ${h(t)}. Time to see it in action.`:"Everything looks great. Go take a look."})]})})}function Gx({tokenHistory:e,className:t=""}){const s=e.slice(-10);if(s.length<2)return null;const i=64,n=20,o=2,a=Math.max(...s,1),l=Math.min(...s,0),h=a-l||1,c=s.map((u,g)=>({x:o+g/(s.length-1)*(i-o*2),y:o+(1-(u-l)/h)*(n-o*2)})),f=c.map((u,g)=>`${g===0?"M":"L"} ${u.x.toFixed(1)} ${u.y.toFixed(1)}`).join(" "),p=`${f} L ${c[c.length-1].x.toFixed(1)} ${n-o} L ${c[0].x.toFixed(1)} ${n-o} Z`;return r.jsxs("svg",{width:i,height:n,viewBox:`0 0 ${i} ${n}`,className:`inline-block align-middle text-muted ${t}`,"aria-label":"Token usage trend",children:[r.jsx("path",{d:p,fill:"currentColor",fillOpacity:.15}),r.jsx("path",{d:f,fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),r.jsx("circle",{cx:c[c.length-1].x,cy:c[c.length-1].y,r:"2",fill:"currentColor"})]})}function Yx(){const[e,t]=d.useState([]),s=d.useRef(0);return{history:e,recordTokens:n=>{n!==s.current&&(s.current=n,t(o=>{const a=[...o,n];return a.length>20?a.slice(-20):a}))}}}function Xx(e){var i;const t=((i=e.split(".").pop())==null?void 0:i.toLowerCase())||"";return{js:{icon:Q,color:"text-yellow-600",label:"JavaScript"},jsx:{icon:Q,color:"text-yellow-500",label:"JSX"},ts:{icon:Q,color:"text-blue-500",label:"TypeScript"},tsx:{icon:Q,color:"text-blue-400",label:"TSX"},py:{icon:Q,color:"text-green-600",label:"Python"},html:{icon:Q,color:"text-orange-500",label:"HTML"},css:{icon:no,color:"text-purple-500",label:"CSS"},json:{icon:ro,color:"text-green-500",label:"JSON"},md:{icon:_i,color:"text-muted",label:"Markdown"},go:{icon:Q,color:"text-cyan-600",label:"Go"},rs:{icon:Q,color:"text-orange-600",label:"Rust"}}[t]||{icon:oo,color:"text-muted",label:t.toUpperCase()||"Plain Text"}}function Jx(e){const t=Math.floor((Date.now()-e)/1e3);return t<2?"just now":t<60?`${t}s ago`:`${Math.floor(t/60)}m ago`}function Al(e){if(e<60)return`${e}s`;const t=Math.floor(e/60),s=e%60;return`${t}m ${s}s`}function Zx({selectedFile:e,fileName:t,isModified:s,isSaving:i,lastSavedAt:n,lineCount:o,cursorLine:a,cursorColumn:l,buildTime:h,sessionId:c,prd:f}){const[p,u]=d.useState(""),[g,m]=d.useState(!1);d.useEffect(()=>{if(!n)return;const v=()=>u(Jx(n));v();const j=setInterval(v,5e3);return()=>clearInterval(j)},[n]);const _=d.useCallback(async()=>{const v=["Built with Loki Mode",c?`Session: ${c}`:"",h?`Build time: ${Al(h)}`:"",f?`
228
228
  Project: ${f.substring(0,100)}${f.length>100?"...":""}`:"",`
@@ -1,4 +1,4 @@
1
- import{c as P,j as e,r as n,u as B,a as N,m as D,k as T,E as L,e as R}from"./index-CxajNJVu.js";import{B as w}from"./Button-BqjzE4fz.js";import{B as _}from"./Badge-CqfZNaem.js";import{u as z}from"./usePolling-DwLceXwF.js";import{R as A}from"./refresh-cw-oNj-Xn4B.js";import{P as C}from"./plus-7AoOU-I9.js";import{F as M,C as O,T as $}from"./trash-2-D23gvznl.js";import"./clock-CLYV8a_x.js";import"./circle-alert-CVFRPWpv.js";import"./check-BRK-zLB5.js";/**
1
+ import{c as P,j as e,r as n,u as B,a as N,m as D,k as T,E as L,e as R}from"./index-XZrgDphJ.js";import{B as w}from"./Button-B_XqEF7a.js";import{B as _}from"./Badge-BOHHYZTu.js";import{u as z}from"./usePolling-8wwOP53Y.js";import{R as A}from"./refresh-cw-B9_ksndc.js";import{P as C}from"./plus-aS4YpFPG.js";import{F as M,C as O,T as $}from"./trash-2-zqZc9cSK.js";import"./clock-CJc_91vp.js";import"./circle-alert-p3-Bg3sx.js";import"./check-B5uToWdF.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1,10 @@
1
+ import{c as st,j as e,r as t,y as he,a as oe,z as at,$ as ot,K as nt,I as it,m as lt,E as rt}from"./index-XZrgDphJ.js";import{E as ct,R as dt}from"./rotate-ccw-CBogZEoT.js";import{H as ut}from"./hammer-B_evoVEr.js";import{C as xt}from"./cloud-lhmojUN8.js";import{L as mt}from"./loader-circle-C8cKZhjP.js";import{C as pt}from"./check-B5uToWdF.js";import{C as ft}from"./circle-alert-p3-Bg3sx.js";/**
2
+ * @license lucide-react v0.577.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const ht=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],bt=st("code",ht);function j({label:o,description:r,value:l,onChange:h,disabled:u=!1}){const g=`toggle-${o.replace(/\s+/g,"-").toLowerCase()}`;return e.jsxs("div",{className:"flex items-center justify-between py-3",children:[e.jsxs("div",{className:"flex-1 mr-4",children:[e.jsx("label",{htmlFor:g,className:"text-sm font-medium text-[#36342E] cursor-pointer",children:o}),r&&e.jsx("p",{className:"text-xs text-[#6B6960] mt-0.5",children:r})]}),e.jsx("button",{id:g,type:"button",role:"switch","aria-checked":l,"aria-label":o,disabled:u,onClick:()=>h(!l),className:["relative inline-flex h-6 w-11 flex-shrink-0 rounded-full border-2 border-transparent transition-colors duration-200 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#553DE9]",l?"bg-[#553DE9]":"bg-[#ECEAE3]",u?"opacity-50 cursor-not-allowed":"cursor-pointer"].filter(Boolean).join(" "),children:e.jsx("span",{"aria-hidden":"true",className:["pointer-events-none inline-block h-5 w-5 rounded-full bg-white shadow-sm transform transition-transform duration-200",l?"translate-x-5":"translate-x-0"].join(" ")})})]})}function f({label:o,description:r,options:l,value:h,onChange:u,disabled:g=!1}){const v=`select-${o.replace(/\s+/g,"-").toLowerCase()}`;return e.jsxs("div",{className:"flex items-center justify-between py-3",children:[e.jsxs("div",{className:"flex-1 mr-4",children:[e.jsx("label",{htmlFor:v,className:"text-sm font-medium text-[#36342E]",children:o}),r&&e.jsx("p",{className:"text-xs text-[#6B6960] mt-0.5",children:r})]}),e.jsx("select",{id:v,value:h,onChange:x=>u(x.target.value),disabled:g,"aria-label":o,className:["px-3 py-1.5 text-sm border border-[#ECEAE3] rounded-lg bg-white text-[#36342E] focus:border-[#553DE9] focus:outline-none focus:ring-1 focus:ring-[#553DE9] min-w-[140px]",g?"opacity-50 cursor-not-allowed":"cursor-pointer"].filter(Boolean).join(" "),children:l.map(x=>e.jsx("option",{value:x.value,children:x.label},x.value))})]})}function xe({label:o,description:r,min:l,max:h,value:u,onChange:g,step:v=1,unit:x="",disabled:y=!1}){const w=`slider-${o.replace(/\s+/g,"-").toLowerCase()}`,C=(u-l)/(h-l)*100;return e.jsxs("div",{className:"py-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:w,className:"text-sm font-medium text-[#36342E]",children:o}),r&&e.jsx("p",{className:"text-xs text-[#6B6960] mt-0.5",children:r})]}),e.jsxs("span",{className:"text-sm font-mono text-[#553DE9] min-w-[48px] text-right",children:[u,x]})]}),e.jsx("input",{id:w,type:"range",min:l,max:h,step:v,value:u,onChange:A=>g(Number(A.target.value)),disabled:y,"aria-label":o,"aria-valuemin":l,"aria-valuemax":h,"aria-valuenow":u,className:"w-full h-2 rounded-full appearance-none cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",style:{background:`linear-gradient(to right, #553DE9 0%, #553DE9 ${C}%, #ECEAE3 ${C}%, #ECEAE3 100%)`}}),e.jsxs("div",{className:"flex justify-between mt-1",children:[e.jsxs("span",{className:"text-[11px] text-[#939084]",children:[l,x]}),e.jsxs("span",{className:"text-[11px] text-[#939084]",children:[h,x]})]})]})}function ne({label:o,description:r,type:l="text",value:h,onChange:u,placeholder:g,disabled:v=!1}){const x=`input-${o.replace(/\s+/g,"-").toLowerCase()}`,[y,w]=t.useState(!1),C=l==="password",A=C&&y?"text":l;return e.jsxs("div",{className:"py-3",children:[e.jsxs("div",{className:"mb-1.5",children:[e.jsx("label",{htmlFor:x,className:"text-sm font-medium text-[#36342E]",children:o}),r&&e.jsx("p",{className:"text-xs text-[#6B6960] mt-0.5",children:r})]}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:x,type:A,value:h,onChange:S=>u(S.target.value),placeholder:g,disabled:v,"aria-label":o,className:["w-full px-3 py-2 text-sm border border-[#ECEAE3] rounded-lg bg-white text-[#36342E] focus:border-[#553DE9] focus:outline-none focus:ring-1 focus:ring-[#553DE9] placeholder:text-[#939084]",C&&"pr-10",v?"opacity-50 cursor-not-allowed":""].filter(Boolean).join(" ")}),C&&e.jsx("button",{type:"button",onClick:()=>w(!y),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-[#939084] hover:text-[#36342E] transition-colors","aria-label":y?"Hide password":"Show password",children:y?e.jsx(ct,{size:16}):e.jsx(he,{size:16})})]})]})}function gt({label:o,className:r=""}){return o?e.jsxs("div",{className:`flex items-center gap-3 ${r}`,children:[e.jsx("span",{className:"flex-1 border-t border-[#ECEAE3] dark:border-[#2A2A30]"}),e.jsx("span",{className:"text-xs text-muted font-medium",children:o}),e.jsx("span",{className:"flex-1 border-t border-[#ECEAE3] dark:border-[#2A2A30]"})]}):e.jsx("hr",{className:`border-t border-[#ECEAE3] dark:border-[#2A2A30] ${r}`})}const be="pl_settings_";function n(o,r){try{const l=localStorage.getItem(`${be}${o}`);return l===null?r:JSON.parse(l)}catch{return r}}function i(o,r){try{localStorage.setItem(`${be}${o}`,JSON.stringify(r))}catch{}}const me=[{id:"general",label:"General",icon:at},{id:"appearance",label:"Appearance",icon:ot},{id:"editor",label:"Editor",icon:bt},{id:"build",label:"Build",icon:ut},{id:"providers",label:"Providers",icon:xt},{id:"shortcuts",label:"Keyboard Shortcuts",icon:nt},{id:"accessibility",label:"Accessibility",icon:he},{id:"about",label:"About",icon:it}],pe=[{id:"claude",name:"Claude",description:"Anthropic Claude Code -- full features (Opus 4.7 default, 1M context)",models:["claude-opus-4-7","claude-sonnet-4-6","claude-haiku-4-5-20251001"],defaultModel:"claude-opus-4-7"},{id:"codex",name:"Codex",description:"OpenAI Codex CLI -- degraded mode",models:["gpt-5.3-codex","o3","o4-mini"],defaultModel:"gpt-5.3-codex"},{id:"cline",name:"Cline",description:"VS Code extension -- sequential mode",models:["claude-opus-4-7","claude-sonnet-4-6","gpt-4.1"],defaultModel:"claude-opus-4-7"},{id:"aider",name:"Aider",description:"Terminal-based pair programming",models:["claude-opus-4-7","claude-sonnet-4-6","gpt-4.1","ollama_chat/deepseek-coder"],defaultModel:"claude-opus-4-7"},{id:"opencode",name:"opencode",description:"Model-agnostic CLI -- 75+ providers, local models",models:["openrouter/deepseek/deepseek-v3.2","openrouter/z-ai/glm-4.6","openrouter/minimax/minimax-m2.1","ollama/qwen2.5-coder"],defaultModel:"openrouter/deepseek/deepseek-v3.2"}],vt=typeof navigator<"u"&&/Mac/.test(navigator.userAgent),E=vt?"Cmd":"Ctrl",fe=[{action:"Save file",keys:`${E}+S`,category:"File"},{action:"Quick open file",keys:`${E}+P`,category:"File"},{action:"Command palette",keys:`${E}+K`,category:"Navigation"},{action:"Toggle terminal",keys:`${E}+\``,category:"Navigation"},{action:"Start / stop build",keys:`${E}+B`,category:"Build"},{action:"Show keyboard shortcuts",keys:`${E}+?`,category:"Help"},{action:"Close modals",keys:"Escape",category:"Navigation"},{action:"Focus search",keys:`${E}+F`,category:"Navigation"},{action:"Toggle sidebar",keys:`${E}+\\`,category:"Navigation"},{action:"New project",keys:`${E}+N`,category:"File"},{action:"Go to settings",keys:`${E}+,`,category:"Navigation"}];function d({children:o}){return e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-[#939084] mb-3 mt-6 first:mt-0",children:o})}function b(){return e.jsx(gt,{className:"my-1"})}function kt(){var ue;const[o,r]=t.useState("general"),[l,h]=t.useState(()=>n("projectDir","~/projects")),[u,g]=t.useState(()=>n("autoSave",!0)),[v,x]=t.useState(()=>n("autoSaveInterval","15")),[y,w]=t.useState(()=>n("language","en")),[C,A]=t.useState(()=>n("telemetry",!1)),[S,ge]=t.useState(()=>{const a=localStorage.getItem("pl_theme");return a==="light"||a==="dark"?a:"system"}),[B,ve]=t.useState(()=>n("accentColor","purple")),[M,je]=t.useState(()=>n("fontSize","medium")),[T,Ee]=t.useState(()=>n("sidebarPosition","left")),[H,ye]=t.useState(()=>n("compactMode",!1)),[O,Ce]=t.useState(()=>n("animationLevel","full")),[$,Se]=t.useState(()=>n("editorFont","JetBrains Mono")),[z,Ne]=t.useState(()=>n("editorFontSize",14)),[_,we]=t.useState(()=>n("tabSize","2")),[V,ke]=t.useState(()=>n("wordWrap",!0)),[W,Ae]=t.useState(()=>n("lineNumbers",!0)),[G,Fe]=t.useState(()=>n("minimap",!0)),[K,Pe]=t.useState(()=>n("bracketMatching",!0)),[q,De]=t.useState(()=>n("defaultProvider","claude")),[J,Le]=t.useState(()=>n("maxIterations",25)),[U,Be]=t.useState(()=>n("qualityStrictness","standard")),[Q,Me]=t.useState(()=>n("autoDeploy",!1)),[X,$e]=t.useState(()=>n("budgetLimit","")),[Y,ze]=t.useState(()=>n("buildNotifications",!0)),[Z,Ie]=t.useState(()=>n("providerKeys",{})),[ee,Re]=t.useState(()=>n("providerModels",{})),[I,Te]=t.useState(()=>n("providerPriority",["claude","codex","cline","aider","opencode"])),[ie,le]=t.useState(null),[R,te]=t.useState({}),[F,He]=t.useState(()=>n("highContrast",!1)),[P,Oe]=t.useState(()=>n("focusIndicator","default")),[k,_e]=t.useState(()=>n("motionPref","full")),[se,Ve]=t.useState(()=>n("screenReaderAnnouncements",!0)),[D,We]=t.useState(()=>n("fontScaling","100")),[re,Ge]=t.useState(""),[L,ce]=t.useState("");t.useEffect(()=>{i("projectDir",l)},[l]),t.useEffect(()=>{i("autoSave",u)},[u]),t.useEffect(()=>{i("autoSaveInterval",v)},[v]),t.useEffect(()=>{i("language",y)},[y]),t.useEffect(()=>{i("telemetry",C)},[C]),t.useEffect(()=>{if(S==="system"){const a=window.matchMedia("(prefers-color-scheme: dark)").matches;document.documentElement.classList.toggle("dark",a),localStorage.removeItem("pl_theme")}else document.documentElement.classList.toggle("dark",S==="dark"),localStorage.setItem("pl_theme",S)},[S]),t.useEffect(()=>{i("accentColor",B)},[B]),t.useEffect(()=>{i("fontSize",M)},[M]),t.useEffect(()=>{i("sidebarPosition",T)},[T]),t.useEffect(()=>{i("compactMode",H)},[H]),t.useEffect(()=>{i("animationLevel",O)},[O]),t.useEffect(()=>{i("editorFont",$)},[$]),t.useEffect(()=>{i("editorFontSize",z)},[z]),t.useEffect(()=>{i("tabSize",_)},[_]),t.useEffect(()=>{i("wordWrap",V)},[V]),t.useEffect(()=>{i("lineNumbers",W)},[W]),t.useEffect(()=>{i("minimap",G)},[G]),t.useEffect(()=>{i("bracketMatching",K)},[K]),t.useEffect(()=>{i("defaultProvider",q)},[q]),t.useEffect(()=>{i("maxIterations",J)},[J]),t.useEffect(()=>{i("qualityStrictness",U)},[U]),t.useEffect(()=>{i("autoDeploy",Q)},[Q]),t.useEffect(()=>{i("budgetLimit",X)},[X]),t.useEffect(()=>{i("buildNotifications",Y)},[Y]),t.useEffect(()=>{i("providerKeys",Z)},[Z]),t.useEffect(()=>{i("providerModels",ee)},[ee]),t.useEffect(()=>{i("providerPriority",I)},[I]),t.useEffect(()=>{i("highContrast",F)},[F]),t.useEffect(()=>{i("focusIndicator",P)},[P]),t.useEffect(()=>{i("motionPref",k)},[k]),t.useEffect(()=>{i("screenReaderAnnouncements",se)},[se]),t.useEffect(()=>{i("fontScaling",D)},[D]),t.useEffect(()=>{const a=parseInt(D,10);return document.documentElement.style.fontSize=`${15*a/100}px`,()=>{document.documentElement.style.fontSize=""}},[D]),t.useEffect(()=>{document.documentElement.classList.toggle("high-contrast",F)},[F]),t.useEffect(()=>{document.documentElement.classList.toggle("reduce-motion",k==="reduced"),document.documentElement.classList.toggle("no-motion",k==="none")},[k]),t.useEffect(()=>{document.documentElement.classList.toggle("enhanced-focus",P==="enhanced")},[P]),t.useEffect(()=>{oe.getStatus().then(a=>Ge(a.version||"")).catch(()=>{})},[]);const Ke=t.useCallback(async a=>{le(a),te(c=>{const s={...c};return delete s[a],s});try{await oe.setProvider(a);const c=await oe.getCurrentProvider();te(s=>({...s,[a]:c.provider===a?{ok:!0,message:"Set as default in ~/.loki/config.json"}:{ok:!1,message:`Server reports default is still ${c.provider}`}}))}catch(c){te(s=>({...s,[a]:{ok:!1,message:c instanceof Error?c.message:"Could not set default"}}))}finally{le(null)}},[]),de=t.useCallback((a,c)=>{Te(s=>{const m=s.indexOf(a);if(m===-1)return s;const N=c==="up"?m-1:m+1;if(N<0||N>=s.length)return s;const p=[...s];return[p[m],p[N]]=[p[N],p[m]],p})},[]);function qe(){switch(o){case"general":return e.jsx(Je,{});case"appearance":return e.jsx(Ue,{});case"editor":return e.jsx(Qe,{});case"build":return e.jsx(Xe,{});case"providers":return e.jsx(Ye,{});case"shortcuts":return e.jsx(Ze,{});case"accessibility":return e.jsx(et,{});case"about":return e.jsx(tt,{});default:return null}}function Je(){return e.jsxs("div",{children:[e.jsx(d,{children:"Project"}),e.jsx(ne,{label:"Default project directory",description:"New projects will be created in this directory",value:l,onChange:h,placeholder:"~/projects"}),e.jsx(b,{}),e.jsx(d,{children:"Saving"}),e.jsx(j,{label:"Auto-save",description:"Automatically save files when modified",value:u,onChange:g}),e.jsx(f,{label:"Auto-save interval",description:"How often to auto-save open files",options:[{value:"5",label:"5 seconds"},{value:"15",label:"15 seconds"},{value:"30",label:"30 seconds"},{value:"60",label:"60 seconds"}],value:v,onChange:x,disabled:!u}),e.jsx(b,{}),e.jsx(d,{children:"Preferences"}),e.jsx(f,{label:"Language",description:"Interface language",options:[{value:"en",label:"English"}],value:y,onChange:w}),e.jsx(j,{label:"Telemetry",description:"Help improve Purple Lab by sending anonymous usage data",value:C,onChange:A})]})}function Ue(){const a=[{id:"purple",color:"#553DE9",label:"Purple"},{id:"blue",color:"#2563EB",label:"Blue"},{id:"green",color:"#059669",label:"Green"},{id:"orange",color:"#D97706",label:"Orange"},{id:"pink",color:"#DB2777",label:"Pink"}],c={small:"text-xs",medium:"text-sm",large:"text-base"};return e.jsxs("div",{children:[e.jsx(d,{children:"Theme"}),e.jsxs("div",{className:"py-3",children:[e.jsx("label",{className:"text-sm font-medium text-[#36342E] block mb-3",children:"Color theme"}),e.jsx("div",{className:"flex gap-3",children:["light","dark","system"].map(s=>e.jsxs("button",{type:"button",onClick:()=>ge(s),className:["flex-1 flex flex-col items-center gap-2 p-3 rounded-lg border-2 transition-colors",S===s?"border-[#553DE9] bg-[#553DE9]/5":"border-[#ECEAE3] hover:border-[#553DE9]/30"].join(" "),"aria-pressed":S===s,children:[e.jsxs("div",{className:["w-full h-12 rounded border flex items-end px-1.5 pb-1.5 gap-1",s==="dark"?"bg-[#1A1A1E] border-[#2A2A30]":s==="light"?"bg-white border-[#ECEAE3]":"bg-gradient-to-r from-white to-[#1A1A1E] border-[#ECEAE3]"].join(" "),children:[e.jsx("div",{className:`w-2 h-4 rounded-sm ${s==="dark"?"bg-[#2A2A30]":"bg-[#ECEAE3]"}`}),e.jsx("div",{className:`w-4 h-3 rounded-sm ${s==="dark"?"bg-[#2A2A30]":"bg-[#ECEAE3]"}`}),e.jsx("div",{className:`w-3 h-5 rounded-sm ${s==="dark"?"bg-[#2A2A30]":"bg-[#ECEAE3]"}`})]}),e.jsx("span",{className:"text-xs font-medium text-[#36342E] capitalize",children:s})]},s))})]}),e.jsx(b,{}),e.jsx(d,{children:"Accent color"}),e.jsx("div",{className:"py-3",children:e.jsx("div",{className:"flex gap-3",children:a.map(s=>e.jsxs("button",{type:"button",onClick:()=>ve(s.id),className:"flex flex-col items-center gap-1.5 group","aria-label":s.label,"aria-pressed":B===s.id,children:[e.jsx("div",{className:["w-8 h-8 rounded-full transition-all",B===s.id?"ring-2 ring-offset-2 ring-[#553DE9] scale-110":"group-hover:scale-105"].join(" "),style:{backgroundColor:s.color}}),e.jsx("span",{className:"text-[11px] text-[#6B6960]",children:s.label})]},s.id))})}),e.jsx(b,{}),e.jsx(d,{children:"Layout"}),e.jsx(f,{label:"Font size",description:"Base font size for the interface",options:[{value:"small",label:"Small"},{value:"medium",label:"Medium"},{value:"large",label:"Large"}],value:M,onChange:je}),e.jsx("div",{className:"pl-4 pb-2",children:e.jsx("span",{className:`${c[M]} text-[#6B6960] italic`,children:"The quick brown fox jumps over the lazy dog."})}),e.jsx(f,{label:"Sidebar position",description:"Which side the navigation sidebar appears on",options:[{value:"left",label:"Left"},{value:"right",label:"Right"}],value:T,onChange:Ee}),e.jsx(j,{label:"Compact mode",description:"Reduce padding and spacing throughout the interface",value:H,onChange:ye}),e.jsx(f,{label:"Animations",description:"Control interface transition animations",options:[{value:"full",label:"Full"},{value:"reduced",label:"Reduced"},{value:"none",label:"None"}],value:O,onChange:Ce})]})}function Qe(){return e.jsxs("div",{children:[e.jsx(d,{children:"Font"}),e.jsx(f,{label:"Font family",description:"Font used in the code editor",options:[{value:"JetBrains Mono",label:"JetBrains Mono"},{value:"Fira Code",label:"Fira Code"},{value:"Source Code Pro",label:"Source Code Pro"},{value:"Consolas",label:"Consolas"}],value:$,onChange:Se}),e.jsx(xe,{label:"Font size",description:"Size of text in the code editor",min:12,max:24,value:z,onChange:Ne,unit:"px"}),e.jsxs("div",{className:"my-3 rounded-lg border border-[#ECEAE3] overflow-hidden",children:[e.jsx("div",{className:"bg-[#FAF9F6] px-3 py-1.5 border-b border-[#ECEAE3]",children:e.jsx("span",{className:"text-[11px] text-[#939084]",children:"Preview"})}),e.jsx("div",{className:"bg-white p-4",children:e.jsx("pre",{className:"text-[#36342E] leading-relaxed",style:{fontFamily:`"${$}", monospace`,fontSize:`${z}px`},children:`function greet(name) {
7
+ return \`Hello, \${name}!\`;
8
+ }
9
+
10
+ greet("world");`})})]}),e.jsx(b,{}),e.jsx(d,{children:"Formatting"}),e.jsx(f,{label:"Tab size",description:"Number of spaces per tab",options:[{value:"2",label:"2 spaces"},{value:"4",label:"4 spaces"},{value:"8",label:"8 spaces"}],value:_,onChange:we}),e.jsx(j,{label:"Word wrap",description:"Wrap long lines to fit the editor width",value:V,onChange:ke}),e.jsx(b,{}),e.jsx(d,{children:"Display"}),e.jsx(j,{label:"Line numbers",description:"Show line numbers in the gutter",value:W,onChange:Ae}),e.jsx(j,{label:"Minimap",description:"Show a miniature overview of the file",value:G,onChange:Fe}),e.jsx(j,{label:"Bracket matching",description:"Highlight matching brackets",value:K,onChange:Pe})]})}function Xe(){return e.jsxs("div",{children:[e.jsx(d,{children:"Provider"}),e.jsx(f,{label:"Default provider",description:"AI provider to use for new builds",options:pe.map(a=>({value:a.id,label:a.name})),value:q,onChange:De}),e.jsx(b,{}),e.jsx(d,{children:"Execution"}),e.jsx(xe,{label:"Max iterations",description:"Maximum number of RARV iterations per build",min:5,max:50,value:J,onChange:Le,step:5}),e.jsx(f,{label:"Quality gate strictness",description:"How strict the quality gates are during builds",options:[{value:"relaxed",label:"Relaxed"},{value:"standard",label:"Standard"},{value:"strict",label:"Strict"}],value:U,onChange:Be}),e.jsx(b,{}),e.jsx(d,{children:"Automation"}),e.jsx(j,{label:"Auto-deploy on success",description:"Automatically deploy when build completes successfully",value:Q,onChange:Me}),e.jsx(ne,{label:"Budget limit",description:"Maximum spend per build (leave empty for unlimited)",type:"number",value:X,onChange:$e,placeholder:"e.g. 10.00"}),e.jsx(j,{label:"Build notifications",description:"Show browser notifications for build events",value:Y,onChange:ze})]})}function Ye(){return e.jsxs("div",{children:[e.jsx(d,{children:"Configured providers"}),e.jsx("div",{className:"flex flex-col gap-4 mt-2",children:I.map((a,c)=>{var m,N;const s=pe.find(p=>p.id===a);return s?e.jsxs("div",{className:"border border-[#ECEAE3] rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-6 h-6 flex items-center justify-center rounded-full bg-[#553DE9]/10 text-[#553DE9] text-xs font-bold",children:c+1}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium text-[#36342E]",children:s.name}),e.jsx("p",{className:"text-xs text-[#6B6960]",children:s.description})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{type:"button",onClick:()=>de(s.id,"up"),disabled:c===0,className:"px-2 py-1 text-xs text-[#6B6960] hover:text-[#36342E] disabled:opacity-30 disabled:cursor-not-allowed","aria-label":`Move ${s.name} up`,children:"Up"}),e.jsx("button",{type:"button",onClick:()=>de(s.id,"down"),disabled:c===I.length-1,className:"px-2 py-1 text-xs text-[#6B6960] hover:text-[#36342E] disabled:opacity-30 disabled:cursor-not-allowed","aria-label":`Move ${s.name} down`,children:"Down"})]})]}),e.jsx(ne,{label:"API key",type:"password",value:Z[s.id]||"",onChange:p=>Ie(ae=>({...ae,[s.id]:p})),placeholder:`Enter ${s.name} API key`}),e.jsx(f,{label:"Model",options:s.models.map(p=>({value:p,label:p})),value:ee[s.id]||s.defaultModel,onChange:p=>Re(ae=>({...ae,[s.id]:p}))}),e.jsxs("div",{className:"flex items-center gap-3 mt-2",children:[e.jsxs("button",{type:"button",onClick:()=>Ke(s.id),disabled:ie!==null,title:"Writes the default provider to ~/.loki/config.json. Does not test a connection.",className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium border border-[#553DE9] text-[#553DE9] hover:bg-[#E8E4FD] rounded-lg transition-colors disabled:opacity-50",children:[ie===s.id?e.jsx(mt,{size:12,className:"animate-spin"}):null,"Set as default (~/.loki/config.json)"]}),((m=R[s.id])==null?void 0:m.ok)===!0&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-[#059669]",children:[e.jsx(pt,{size:12})," ",R[s.id].message]}),((N=R[s.id])==null?void 0:N.ok)===!1&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-[#C45B5B] break-all",children:[e.jsx(ft,{size:12,className:"flex-shrink-0"})," ",R[s.id].message]})]})]},s.id):null})}),e.jsx("div",{className:"mt-4 p-3 rounded-lg bg-[#FAF9F6] border border-[#ECEAE3]",children:e.jsxs("p",{className:"text-xs text-[#6B6960]",children:["The order, API keys and models on this page are saved in this browser only; builds do not read them. Provider failover is configured with ",e.jsx("code",{children:"loki failover --chain"}),'. "Set as default" is the only action here that writes to the server (the provider field in ~/.loki/config.json).']})})]})}function Ze(){const a=L?fe.filter(s=>s.action.toLowerCase().includes(L.toLowerCase())||s.keys.toLowerCase().includes(L.toLowerCase())||s.category.toLowerCase().includes(L.toLowerCase())):fe,c=[...new Set(a.map(s=>s.category))];return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(lt,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[#939084]"}),e.jsx("input",{type:"text",value:L,onChange:s=>ce(s.target.value),placeholder:"Search shortcuts...",className:"w-full pl-8 pr-3 py-2 text-sm border border-[#ECEAE3] rounded-lg bg-white text-[#36342E] focus:border-[#553DE9] focus:outline-none focus:ring-1 focus:ring-[#553DE9] placeholder:text-[#939084]","aria-label":"Search keyboard shortcuts"})]}),e.jsxs("button",{type:"button",onClick:()=>ce(""),className:"inline-flex items-center gap-1.5 px-3 py-2 text-xs text-[#6B6960] hover:text-[#36342E] border border-[#ECEAE3] rounded-lg hover:bg-[#F8F4F0] transition-colors",children:[e.jsx(dt,{size:12}),"Reset to defaults"]})]}),c.map(s=>e.jsxs("div",{children:[e.jsx(d,{children:s}),e.jsx("div",{className:"flex flex-col",children:a.filter(m=>m.category===s).map(m=>e.jsxs("div",{className:"flex items-center justify-between py-2.5 px-2 rounded-lg hover:bg-[#FAF9F6]",children:[e.jsx("span",{className:"text-sm text-[#36342E]",children:m.action}),e.jsx("kbd",{className:"px-2.5 py-1 text-xs font-mono bg-[#FAF9F6] border border-[#ECEAE3] rounded-md text-[#6B6960]",children:m.keys})]},m.action))})]},s)),e.jsx("div",{className:"mt-6 p-3 rounded-lg bg-[#FAF9F6] border border-[#ECEAE3]",children:e.jsxs("p",{className:"text-xs text-[#6B6960]",children:["Press ",e.jsxs("kbd",{className:"px-1.5 py-0.5 text-[11px] font-mono bg-white border border-[#ECEAE3] rounded",children:[E,"+?"]})," anywhere to see keyboard shortcuts."]})})]})}function et(){return e.jsxs("div",{children:[e.jsx(d,{children:"Vision"}),e.jsx(j,{label:"High contrast mode",description:"Increase contrast for text and UI elements",value:F,onChange:He}),e.jsx(f,{label:"Focus indicators",description:"Visibility of keyboard focus outlines",options:[{value:"default",label:"Default"},{value:"enhanced",label:"Enhanced (thicker, more visible)"}],value:P,onChange:Oe}),e.jsx(f,{label:"Font scaling",description:"Scale all text in the interface",options:[{value:"100",label:"100%"},{value:"125",label:"125%"},{value:"150",label:"150%"}],value:D,onChange:We}),e.jsx(b,{}),e.jsx(d,{children:"Motion"}),e.jsx(f,{label:"Motion preference",description:"Control animations and transitions",options:[{value:"full",label:"Full -- all animations enabled"},{value:"reduced",label:"Reduced -- minimal animations"},{value:"none",label:"None -- no animations"}],value:k,onChange:_e}),e.jsx(b,{}),e.jsx(d,{children:"Screen reader"}),e.jsx(j,{label:"Screen reader announcements",description:"Enable additional ARIA live region announcements",value:se,onChange:Ve}),e.jsx("div",{className:"mt-6 p-3 rounded-lg bg-[#FAF9F6] border border-[#ECEAE3]",children:e.jsx("p",{className:"text-xs text-[#6B6960]",children:"Purple Lab is designed to work with assistive technologies. All interactive elements include proper ARIA labels and keyboard navigation support. If you encounter accessibility issues, please report them via the About section."})})]})}function tt(){return e.jsxs("div",{children:[e.jsx(d,{children:"Purple Lab"}),e.jsxs("div",{className:"py-3",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#553DE9] flex items-center justify-center",children:e.jsx("span",{className:"text-white font-heading font-bold text-lg",children:"PL"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-heading font-bold text-[#36342E]",children:"Purple Lab"}),e.jsx("p",{className:"text-xs text-[#6B6960]",children:"Powered by Loki Mode"})]})]}),e.jsxs("div",{className:"border border-[#ECEAE3] rounded-lg divide-y divide-[#ECEAE3]",children:[re&&e.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[e.jsx("span",{className:"text-sm text-[#6B6960]",children:"Version"}),e.jsxs("span",{className:"text-sm font-mono font-medium text-[#36342E]",children:["v",re]})]}),e.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[e.jsx("span",{className:"text-sm text-[#6B6960]",children:"License"}),e.jsx("span",{className:"text-sm text-[#36342E]",children:"BUSL-1.1"})]})]})]}),e.jsx(b,{}),e.jsx(d,{children:"Links"}),e.jsx("div",{className:"flex flex-col gap-1 py-2",children:[{label:"Documentation",href:"https://www.autonomi.dev/docs"},{label:"GitHub",href:"https://github.com/asklokesh/loki-mode"},{label:"Changelog",href:"https://github.com/asklokesh/loki-mode/blob/main/CHANGELOG.md"},{label:"Report a bug",href:"https://github.com/asklokesh/loki-mode/issues/new"}].map(a=>e.jsxs("a",{href:a.href,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between px-3 py-2.5 rounded-lg text-sm text-[#36342E] hover:bg-[#FAF9F6] transition-colors group",children:[e.jsx("span",{children:a.label}),e.jsx(rt,{size:14,className:"text-[#939084] group-hover:text-[#553DE9] transition-colors"})]},a.label))}),e.jsx(b,{}),e.jsx(d,{children:"Updates"}),e.jsx("div",{className:"py-3",children:e.jsx("button",{type:"button",onClick:()=>{window.open("https://github.com/asklokesh/loki-mode/releases","_blank")},className:"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium border border-[#553DE9] text-[#553DE9] hover:bg-[#E8E4FD] rounded-lg transition-colors",children:"Check for updates"})})]})}return e.jsxs("div",{className:"flex h-full min-h-0",children:[e.jsx("nav",{className:"w-56 flex-shrink-0 border-r border-[#ECEAE3] bg-[#FAF9F6] overflow-y-auto","aria-label":"Settings categories",children:e.jsxs("div",{className:"px-4 py-5",children:[e.jsx("h1",{className:"font-heading text-lg font-bold text-[#36342E] mb-4",children:"Settings"}),e.jsx("ul",{className:"flex flex-col gap-0.5",children:me.map(a=>{const c=o===a.id;return e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>r(a.id),className:["flex items-center gap-2.5 w-full px-3 py-2 text-sm rounded-lg transition-colors text-left",c?"bg-[#553DE9]/10 text-[#553DE9] font-medium":"text-[#36342E] hover:bg-[#F8F4F0]"].join(" "),"aria-current":c?"page":void 0,children:[e.jsx(a.icon,{size:16}),e.jsx("span",{children:a.label})]})},a.id)})})]})}),e.jsx("main",{className:"flex-1 overflow-y-auto",children:e.jsxs("div",{className:"max-w-[640px] mx-auto px-8 py-6",children:[e.jsx("h2",{className:"font-heading text-base font-bold text-[#36342E] mb-1",children:(ue=me.find(a=>a.id===o))==null?void 0:ue.label}),e.jsxs("p",{className:"text-xs text-[#6B6960] mb-6",children:[o==="general"&&"Manage general application preferences",o==="appearance"&&"Customize the look and feel of Purple Lab",o==="editor"&&"Configure the code editor behavior and display",o==="build"&&"Control build execution and automation settings",o==="providers"&&"Configure AI provider connections and fallback chain",o==="shortcuts"&&"View and manage keyboard shortcuts",o==="accessibility"&&"Adjust accessibility and assistive technology options",o==="about"&&"Version information and useful links"]}),o!=="shortcuts"&&o!=="about"&&e.jsx("p",{className:"mb-6 -mt-3 px-3 py-2 rounded-lg bg-[#FAF9F6] border border-[#ECEAE3] text-xs text-[#6B6960]",children:"Saved in this browser only. Builds and the server do not read these settings."}),qe()]})})]})}export{kt as default};
@@ -1 +1 @@
1
- import{j as e,r as c,g as m,h as p,X as h,u}from"./index-CxajNJVu.js";const x=[{label:"Q1 2026",period:"Jan - Mar",features:[{name:"Multi-provider support (5 providers)",status:"completed"},{name:"Memory system with vector search",status:"completed"},{name:"Purple Lab web UI",status:"completed"},{name:"Enterprise auth (OIDC, RBAC)",status:"completed"},{name:"Legacy system healing",status:"completed"}]},{label:"Q2 2026",period:"Apr - Jun",features:[{name:"Real-time collaboration (multi-user)",status:"in-progress"},{name:"Visual workflow builder",status:"in-progress"},{name:"Plugin marketplace",status:"planned"},{name:"Custom agent creation UI",status:"planned"}]},{label:"Q3 2026",period:"Jul - Sep",features:[{name:"Cloud deployment integration",status:"planned"},{name:"Team analytics dashboard",status:"planned"},{name:"AI-powered debugging assistant",status:"planned"},{name:"Mobile companion app",status:"planned"}]},{label:"Q4 2026",period:"Oct - Dec",features:[{name:"Multi-repo orchestration",status:"planned"},{name:"Custom model fine-tuning",status:"planned"},{name:"Compliance report generation",status:"planned"},{name:"On-prem cluster mode",status:"planned"}]}],l={completed:{dot:"bg-[#1FC5A8]",text:"text-[#36342E]",label:"Shipped"},"in-progress":{dot:"bg-[#553DE9]",text:"text-[#36342E]",label:"In Progress"},planned:{dot:"bg-[#939084]",text:"text-[#6B6960]",label:"Planned"}};function b(){return e.jsxs("div",{className:"py-8",children:[e.jsx("h3",{className:"text-xl font-bold text-[#36342E] mb-2",children:"Product Roadmap"}),e.jsx("p",{className:"text-sm text-[#6B6960] mb-8",children:"Where we have been and where we are heading."}),e.jsx("div",{className:"flex gap-6 mb-6",children:["completed","in-progress","planned"].map(t=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${l[t].dot}`}),e.jsx("span",{className:"text-[#6B6960]",children:l[t].label})]},t))}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute left-[7px] top-2 bottom-2 w-0.5 bg-[#ECEAE3]"}),e.jsx("div",{className:"space-y-8",children:x.map((t,i)=>e.jsxs("div",{className:"relative pl-8",children:[e.jsx("div",{className:`absolute left-0 top-1 w-[15px] h-[15px] rounded-full border-2 border-white shadow-sm ${i===0?"bg-[#1FC5A8]":i===1?"bg-[#553DE9]":"bg-[#ECEAE3]"}`}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-baseline gap-2 mb-3",children:[e.jsx("h4",{className:"text-base font-bold text-[#36342E]",children:t.label}),e.jsx("span",{className:"text-xs text-[#939084]",children:t.period}),i===1&&e.jsx("span",{className:"px-2 py-0.5 text-xs font-medium rounded-full bg-[#553DE9]/10 text-[#553DE9]",children:"Current"})]}),e.jsx("div",{className:"space-y-2",children:t.features.map(a=>{const s=l[a.status];return e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${s.dot}`}),e.jsx("span",{className:`text-sm ${s.text}`,children:a.name})]},a.name)})})]})]},t.label))})]})]})}const n=[{version:"6.71.1",date:"Mar 24, 2026",features:["BuildProgressBar server integration with cost, ETA, and phase data","Sprint 1 complete: BuildProgressBar, CommandPalette, dark mode, sidebar theme toggle","Quick-start API, dark mode prep, theme hook foundation"]},{version:"6.70.0",date:"Mar 22, 2026",features:["Embedded Loki Dashboard in Purple Lab workspace","Panel toggles, modern UI, bigger fonts, smooth transitions","Sprint 1 foundation with quick-start API"]},{version:"6.69.0",date:"Mar 20, 2026",features:["Purple Lab IDE workspace with Monaco editor","AI chat panel for iterative development","Activity panel with build log and quality gates"]}];function g(){const[t,i]=c.useState(!1),a=t?n:n.slice(0,2);return e.jsxs("div",{className:"bg-white border border-[#ECEAE3] rounded-xl p-4 shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h4",{className:"text-sm font-bold text-[#36342E]",children:"Recent Changes"}),e.jsx("a",{href:"https://github.com/asklokesh/loki-mode/blob/main/CHANGELOG.md",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[#553DE9] hover:text-[#4832c7] font-medium",children:"View all"})]}),e.jsx("div",{className:"space-y-3",children:a.map(s=>e.jsxs("div",{className:"pb-3 border-b border-[#ECEAE3] last:border-b-0 last:pb-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsxs("span",{className:"px-1.5 py-0.5 text-xs font-mono font-bold rounded bg-[#553DE9]/10 text-[#553DE9]",children:["v",s.version]}),e.jsx("span",{className:"text-xs text-[#939084]",children:s.date})]}),e.jsx("ul",{className:"space-y-1",children:s.features.map((r,o)=>e.jsx("li",{className:"text-xs text-[#6B6960] pl-3 relative before:content-[''] before:absolute before:left-0 before:top-[7px] before:w-1.5 before:h-1.5 before:rounded-full before:bg-[#ECEAE3]",children:r},o))})]},s.version))}),n.length>2&&e.jsxs("button",{onClick:()=>i(!t),className:"mt-2 flex items-center gap-1 text-xs text-[#6B6960] hover:text-[#36342E] transition-colors",children:[t?e.jsx(m,{size:12}):e.jsx(p,{size:12}),t?"Show less":`Show ${n.length-2} more`]})]})}const f={default:"bg-[#F8F4F0] text-[#36342E] border-[#ECEAE3] dark:bg-[#222228] dark:text-[#E8E6E3] dark:border-[#2A2A30]",primary:"bg-[#553DE9]/10 text-[#553DE9] border-[#553DE9]/20 dark:bg-[#553DE9]/20 dark:text-[#7B6BEF] dark:border-[#553DE9]/30",success:"bg-[#1FC5A8]/10 text-[#1FC5A8] border-[#1FC5A8]/20",warning:"bg-[#E5A940]/10 text-[#E5A940] border-[#E5A940]/20",danger:"bg-[#C45B5B]/10 text-[#C45B5B] border-[#C45B5B]/20",info:"bg-[#3B82F6]/10 text-[#3B82F6] border-[#3B82F6]/20"};function E({label:t,color:i="default",removable:a=!1,onClick:s,onRemove:r,className:o=""}){return e.jsxs("span",{className:`inline-flex items-center gap-1 px-2.5 py-0.5 text-xs font-medium rounded-full border transition-colors ${f[i]} ${s?"cursor-pointer hover:opacity-80":""} ${o}`,onClick:s,role:s?"button":void 0,children:[t,a&&e.jsx("button",{type:"button",onClick:d=>{d.stopPropagation(),r==null||r()},className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-full hover:bg-black/10 dark:hover:bg-white/10 transition-colors","aria-label":`Remove ${t}`,children:e.jsx(h,{size:10})})]})}const w=[{title:"SaaS Dashboard",description:"Admin dashboard with user analytics, charts, and real-time data visualization.",techStack:["React","Tailwind","Chart.js"],buildTime:"~25 min",gradient:"from-[#553DE9] to-[#7B6BEF]",prompt:"Build a SaaS admin dashboard with user analytics, charts showing MRR and churn, and a table of recent signups"},{title:"REST API Server",description:"Production-ready API with authentication, validation, and database integration.",techStack:["Node.js","Express","PostgreSQL"],buildTime:"~20 min",gradient:"from-[#1FC5A8] to-[#38D9A9]",prompt:"Build a REST API server with JWT authentication, user CRUD, input validation, and PostgreSQL database"},{title:"E-commerce Store",description:"Online store with product catalog, cart, checkout, and payment integration.",techStack:["Next.js","Stripe","Prisma"],buildTime:"~45 min",gradient:"from-[#E93D82] to-[#F06595]",prompt:"Build an e-commerce store with product listings, shopping cart, Stripe checkout, and order management"},{title:"Portfolio Website",description:"Personal portfolio with animations, project showcase, and contact form.",techStack:["React","Framer Motion","Tailwind"],buildTime:"~15 min",gradient:"from-[#F59F00] to-[#FCC419]",prompt:"Build a developer portfolio website with animated sections, project gallery, skills list, and contact form"},{title:"CLI Tool",description:"Command-line tool with subcommands, flags, configuration, and colorful output.",techStack:["Node.js","Commander","Chalk"],buildTime:"~15 min",gradient:"from-[#36342E] to-[#6B6960]",prompt:"Build a CLI tool with subcommands for file management: list, copy, move, and search with glob patterns"},{title:"Discord Bot",description:"Interactive bot with slash commands, moderation, and custom responses.",techStack:["Discord.js","Node.js","SQLite"],buildTime:"~20 min",gradient:"from-[#5865F2] to-[#7289DA]",prompt:"Build a Discord bot with slash commands for polls, reminders, moderation (kick/ban), and a leveling system"},{title:"Blog Platform",description:"Full-featured blog with markdown support, categories, and RSS feed.",techStack:["React","MDX","Tailwind"],buildTime:"~30 min",gradient:"from-[#845EF7] to-[#B197FC]",prompt:"Build a blog platform with MDX support, category filtering, search, RSS feed, and a clean reading experience"},{title:"Task Manager",description:"Kanban-style task board with drag-and-drop, labels, and persistence.",techStack:["React","DnD Kit","SQLite"],buildTime:"~25 min",gradient:"from-[#2F71E3] to-[#5C93E8]",prompt:"Build a task manager with kanban board, drag-and-drop cards, labels, due dates, and local SQLite storage"},{title:"Weather App",description:"Weather dashboard with location search, forecasts, and beautiful visualizations.",techStack:["React","OpenWeatherMap","Chart.js"],buildTime:"~15 min",gradient:"from-[#0EA5E9] to-[#38BDF8]",prompt:"Build a weather app with city search, 5-day forecast, current conditions, and temperature charts"},{title:"Chat Application",description:"Real-time chat with rooms, typing indicators, and message history.",techStack:["React","WebSocket","Node.js"],buildTime:"~30 min",gradient:"from-[#22C55E] to-[#4ADE80]",prompt:"Build a real-time chat application with chat rooms, user presence, typing indicators, and message history"},{title:"Landing Page",description:"Conversion-optimized landing page with hero, features, pricing, and CTA sections.",techStack:["HTML","Tailwind","Alpine.js"],buildTime:"~10 min",gradient:"from-[#F97316] to-[#FB923C]",prompt:"Build a SaaS landing page with hero section, feature grid, pricing table, testimonials, and email signup"},{title:"Mobile App",description:"Cross-platform mobile app with navigation, state management, and native features.",techStack:["React Native","Expo","TypeScript"],buildTime:"~35 min",gradient:"from-[#DC2626] to-[#F87171]",prompt:"Build a React Native mobile app with tab navigation, a home feed, profile page, and push notifications setup"}];function j(){const t=u(),i=a=>{sessionStorage.setItem("pl_showcase_prompt",a),t("/")};return e.jsx("div",{className:"min-h-screen bg-[#FAF9F6]",children:e.jsxs("div",{className:"max-w-6xl mx-auto px-6 py-8",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-2xl font-bold text-[#36342E]",children:"Showcase"}),e.jsx("p",{className:"text-[#6B6960] mt-1",children:'Explore example projects you can build with Loki Mode. Click "Build This" to start any project instantly.'})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5",children:w.map(a=>e.jsxs("div",{className:"bg-white border border-[#ECEAE3] rounded-xl overflow-hidden shadow-sm hover:shadow-md transition-shadow flex flex-col",children:[e.jsx("div",{className:`h-28 bg-gradient-to-br ${a.gradient} flex items-end p-4`,children:e.jsx("h3",{className:"text-lg font-bold text-white drop-shadow-sm",children:a.title})}),e.jsxs("div",{className:"p-4 flex-1 flex flex-col",children:[e.jsx("p",{className:"text-sm text-[#6B6960] mb-3",children:a.description}),e.jsx("div",{className:"flex flex-wrap gap-1.5 mb-3",children:a.techStack.map(s=>e.jsx(E,{label:s,color:"default"},s))}),e.jsxs("div",{className:"mt-auto pt-3 border-t border-[#ECEAE3] flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-[#939084]",children:["Est. ",a.buildTime]}),e.jsx("button",{onClick:()=>i(a.prompt),className:"px-4 py-1.5 text-sm font-semibold rounded-lg bg-[#553DE9] text-white hover:bg-[#4832c7] transition-colors",children:"Build This"})]})]})]},a.title))}),e.jsx("div",{className:"mt-12",children:e.jsx(b,{})}),e.jsx("div",{className:"mt-8 max-w-md",children:e.jsx(g,{})})]})})}export{j as default};
1
+ import{j as e,r as c,g as m,h as p,X as h,u}from"./index-XZrgDphJ.js";const x=[{label:"Q1 2026",period:"Jan - Mar",features:[{name:"Multi-provider support (5 providers)",status:"completed"},{name:"Memory system with vector search",status:"completed"},{name:"Purple Lab web UI",status:"completed"},{name:"Enterprise auth (OIDC, RBAC)",status:"completed"},{name:"Legacy system healing",status:"completed"}]},{label:"Q2 2026",period:"Apr - Jun",features:[{name:"Real-time collaboration (multi-user)",status:"in-progress"},{name:"Visual workflow builder",status:"in-progress"},{name:"Plugin marketplace",status:"planned"},{name:"Custom agent creation UI",status:"planned"}]},{label:"Q3 2026",period:"Jul - Sep",features:[{name:"Cloud deployment integration",status:"planned"},{name:"Team analytics dashboard",status:"planned"},{name:"AI-powered debugging assistant",status:"planned"},{name:"Mobile companion app",status:"planned"}]},{label:"Q4 2026",period:"Oct - Dec",features:[{name:"Multi-repo orchestration",status:"planned"},{name:"Custom model fine-tuning",status:"planned"},{name:"Compliance report generation",status:"planned"},{name:"On-prem cluster mode",status:"planned"}]}],l={completed:{dot:"bg-[#1FC5A8]",text:"text-[#36342E]",label:"Shipped"},"in-progress":{dot:"bg-[#553DE9]",text:"text-[#36342E]",label:"In Progress"},planned:{dot:"bg-[#939084]",text:"text-[#6B6960]",label:"Planned"}};function b(){return e.jsxs("div",{className:"py-8",children:[e.jsx("h3",{className:"text-xl font-bold text-[#36342E] mb-2",children:"Product Roadmap"}),e.jsx("p",{className:"text-sm text-[#6B6960] mb-8",children:"Where we have been and where we are heading."}),e.jsx("div",{className:"flex gap-6 mb-6",children:["completed","in-progress","planned"].map(t=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${l[t].dot}`}),e.jsx("span",{className:"text-[#6B6960]",children:l[t].label})]},t))}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute left-[7px] top-2 bottom-2 w-0.5 bg-[#ECEAE3]"}),e.jsx("div",{className:"space-y-8",children:x.map((t,i)=>e.jsxs("div",{className:"relative pl-8",children:[e.jsx("div",{className:`absolute left-0 top-1 w-[15px] h-[15px] rounded-full border-2 border-white shadow-sm ${i===0?"bg-[#1FC5A8]":i===1?"bg-[#553DE9]":"bg-[#ECEAE3]"}`}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-baseline gap-2 mb-3",children:[e.jsx("h4",{className:"text-base font-bold text-[#36342E]",children:t.label}),e.jsx("span",{className:"text-xs text-[#939084]",children:t.period}),i===1&&e.jsx("span",{className:"px-2 py-0.5 text-xs font-medium rounded-full bg-[#553DE9]/10 text-[#553DE9]",children:"Current"})]}),e.jsx("div",{className:"space-y-2",children:t.features.map(a=>{const s=l[a.status];return e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${s.dot}`}),e.jsx("span",{className:`text-sm ${s.text}`,children:a.name})]},a.name)})})]})]},t.label))})]})]})}const n=[{version:"6.71.1",date:"Mar 24, 2026",features:["BuildProgressBar server integration with cost, ETA, and phase data","Sprint 1 complete: BuildProgressBar, CommandPalette, dark mode, sidebar theme toggle","Quick-start API, dark mode prep, theme hook foundation"]},{version:"6.70.0",date:"Mar 22, 2026",features:["Embedded Loki Dashboard in Purple Lab workspace","Panel toggles, modern UI, bigger fonts, smooth transitions","Sprint 1 foundation with quick-start API"]},{version:"6.69.0",date:"Mar 20, 2026",features:["Purple Lab IDE workspace with Monaco editor","AI chat panel for iterative development","Activity panel with build log and quality gates"]}];function g(){const[t,i]=c.useState(!1),a=t?n:n.slice(0,2);return e.jsxs("div",{className:"bg-white border border-[#ECEAE3] rounded-xl p-4 shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h4",{className:"text-sm font-bold text-[#36342E]",children:"Recent Changes"}),e.jsx("a",{href:"https://github.com/asklokesh/loki-mode/blob/main/CHANGELOG.md",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[#553DE9] hover:text-[#4832c7] font-medium",children:"View all"})]}),e.jsx("div",{className:"space-y-3",children:a.map(s=>e.jsxs("div",{className:"pb-3 border-b border-[#ECEAE3] last:border-b-0 last:pb-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsxs("span",{className:"px-1.5 py-0.5 text-xs font-mono font-bold rounded bg-[#553DE9]/10 text-[#553DE9]",children:["v",s.version]}),e.jsx("span",{className:"text-xs text-[#939084]",children:s.date})]}),e.jsx("ul",{className:"space-y-1",children:s.features.map((r,o)=>e.jsx("li",{className:"text-xs text-[#6B6960] pl-3 relative before:content-[''] before:absolute before:left-0 before:top-[7px] before:w-1.5 before:h-1.5 before:rounded-full before:bg-[#ECEAE3]",children:r},o))})]},s.version))}),n.length>2&&e.jsxs("button",{onClick:()=>i(!t),className:"mt-2 flex items-center gap-1 text-xs text-[#6B6960] hover:text-[#36342E] transition-colors",children:[t?e.jsx(m,{size:12}):e.jsx(p,{size:12}),t?"Show less":`Show ${n.length-2} more`]})]})}const f={default:"bg-[#F8F4F0] text-[#36342E] border-[#ECEAE3] dark:bg-[#222228] dark:text-[#E8E6E3] dark:border-[#2A2A30]",primary:"bg-[#553DE9]/10 text-[#553DE9] border-[#553DE9]/20 dark:bg-[#553DE9]/20 dark:text-[#7B6BEF] dark:border-[#553DE9]/30",success:"bg-[#1FC5A8]/10 text-[#1FC5A8] border-[#1FC5A8]/20",warning:"bg-[#E5A940]/10 text-[#E5A940] border-[#E5A940]/20",danger:"bg-[#C45B5B]/10 text-[#C45B5B] border-[#C45B5B]/20",info:"bg-[#3B82F6]/10 text-[#3B82F6] border-[#3B82F6]/20"};function E({label:t,color:i="default",removable:a=!1,onClick:s,onRemove:r,className:o=""}){return e.jsxs("span",{className:`inline-flex items-center gap-1 px-2.5 py-0.5 text-xs font-medium rounded-full border transition-colors ${f[i]} ${s?"cursor-pointer hover:opacity-80":""} ${o}`,onClick:s,role:s?"button":void 0,children:[t,a&&e.jsx("button",{type:"button",onClick:d=>{d.stopPropagation(),r==null||r()},className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-full hover:bg-black/10 dark:hover:bg-white/10 transition-colors","aria-label":`Remove ${t}`,children:e.jsx(h,{size:10})})]})}const w=[{title:"SaaS Dashboard",description:"Admin dashboard with user analytics, charts, and real-time data visualization.",techStack:["React","Tailwind","Chart.js"],buildTime:"~25 min",gradient:"from-[#553DE9] to-[#7B6BEF]",prompt:"Build a SaaS admin dashboard with user analytics, charts showing MRR and churn, and a table of recent signups"},{title:"REST API Server",description:"Production-ready API with authentication, validation, and database integration.",techStack:["Node.js","Express","PostgreSQL"],buildTime:"~20 min",gradient:"from-[#1FC5A8] to-[#38D9A9]",prompt:"Build a REST API server with JWT authentication, user CRUD, input validation, and PostgreSQL database"},{title:"E-commerce Store",description:"Online store with product catalog, cart, checkout, and payment integration.",techStack:["Next.js","Stripe","Prisma"],buildTime:"~45 min",gradient:"from-[#E93D82] to-[#F06595]",prompt:"Build an e-commerce store with product listings, shopping cart, Stripe checkout, and order management"},{title:"Portfolio Website",description:"Personal portfolio with animations, project showcase, and contact form.",techStack:["React","Framer Motion","Tailwind"],buildTime:"~15 min",gradient:"from-[#F59F00] to-[#FCC419]",prompt:"Build a developer portfolio website with animated sections, project gallery, skills list, and contact form"},{title:"CLI Tool",description:"Command-line tool with subcommands, flags, configuration, and colorful output.",techStack:["Node.js","Commander","Chalk"],buildTime:"~15 min",gradient:"from-[#36342E] to-[#6B6960]",prompt:"Build a CLI tool with subcommands for file management: list, copy, move, and search with glob patterns"},{title:"Discord Bot",description:"Interactive bot with slash commands, moderation, and custom responses.",techStack:["Discord.js","Node.js","SQLite"],buildTime:"~20 min",gradient:"from-[#5865F2] to-[#7289DA]",prompt:"Build a Discord bot with slash commands for polls, reminders, moderation (kick/ban), and a leveling system"},{title:"Blog Platform",description:"Full-featured blog with markdown support, categories, and RSS feed.",techStack:["React","MDX","Tailwind"],buildTime:"~30 min",gradient:"from-[#845EF7] to-[#B197FC]",prompt:"Build a blog platform with MDX support, category filtering, search, RSS feed, and a clean reading experience"},{title:"Task Manager",description:"Kanban-style task board with drag-and-drop, labels, and persistence.",techStack:["React","DnD Kit","SQLite"],buildTime:"~25 min",gradient:"from-[#2F71E3] to-[#5C93E8]",prompt:"Build a task manager with kanban board, drag-and-drop cards, labels, due dates, and local SQLite storage"},{title:"Weather App",description:"Weather dashboard with location search, forecasts, and beautiful visualizations.",techStack:["React","OpenWeatherMap","Chart.js"],buildTime:"~15 min",gradient:"from-[#0EA5E9] to-[#38BDF8]",prompt:"Build a weather app with city search, 5-day forecast, current conditions, and temperature charts"},{title:"Chat Application",description:"Real-time chat with rooms, typing indicators, and message history.",techStack:["React","WebSocket","Node.js"],buildTime:"~30 min",gradient:"from-[#22C55E] to-[#4ADE80]",prompt:"Build a real-time chat application with chat rooms, user presence, typing indicators, and message history"},{title:"Landing Page",description:"Conversion-optimized landing page with hero, features, pricing, and CTA sections.",techStack:["HTML","Tailwind","Alpine.js"],buildTime:"~10 min",gradient:"from-[#F97316] to-[#FB923C]",prompt:"Build a SaaS landing page with hero section, feature grid, pricing table, testimonials, and email signup"},{title:"Mobile App",description:"Cross-platform mobile app with navigation, state management, and native features.",techStack:["React Native","Expo","TypeScript"],buildTime:"~35 min",gradient:"from-[#DC2626] to-[#F87171]",prompt:"Build a React Native mobile app with tab navigation, a home feed, profile page, and push notifications setup"}];function j(){const t=u(),i=a=>{sessionStorage.setItem("pl_showcase_prompt",a),t("/")};return e.jsx("div",{className:"min-h-screen bg-[#FAF9F6]",children:e.jsxs("div",{className:"max-w-6xl mx-auto px-6 py-8",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-2xl font-bold text-[#36342E]",children:"Showcase"}),e.jsx("p",{className:"text-[#6B6960] mt-1",children:'Explore example projects you can build with Loki Mode. Click "Build This" to start any project instantly.'})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5",children:w.map(a=>e.jsxs("div",{className:"bg-white border border-[#ECEAE3] rounded-xl overflow-hidden shadow-sm hover:shadow-md transition-shadow flex flex-col",children:[e.jsx("div",{className:`h-28 bg-gradient-to-br ${a.gradient} flex items-end p-4`,children:e.jsx("h3",{className:"text-lg font-bold text-white drop-shadow-sm",children:a.title})}),e.jsxs("div",{className:"p-4 flex-1 flex flex-col",children:[e.jsx("p",{className:"text-sm text-[#6B6960] mb-3",children:a.description}),e.jsx("div",{className:"flex flex-wrap gap-1.5 mb-3",children:a.techStack.map(s=>e.jsx(E,{label:s,color:"default"},s))}),e.jsxs("div",{className:"mt-auto pt-3 border-t border-[#ECEAE3] flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-[#939084]",children:["Est. ",a.buildTime]}),e.jsx("button",{onClick:()=>i(a.prompt),className:"px-4 py-1.5 text-sm font-semibold rounded-lg bg-[#553DE9] text-white hover:bg-[#4832c7] transition-colors",children:"Build This"})]})]})]},a.title))}),e.jsx("div",{className:"mt-12",children:e.jsx(b,{})}),e.jsx("div",{className:"mt-8 max-w-md",children:e.jsx(g,{})})]})})}export{j as default};