@a5c-ai/babysitter-observer-dashboard 6.0.1 → 6.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +3 -3
- package/.next/fallback-build-manifest.json +3 -3
- package/.next/prerender-manifest.json +3 -3
- package/.next/required-server-files.json +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +11 -11
- package/.next/server/app/_not-found.segments/_full.segment.rsc +11 -11
- package/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
- package/.next/server/app/_not-found.segments/_index.segment.rsc +6 -6
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +3 -3
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +13 -13
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/index.segments/_full.segment.rsc +13 -13
- package/.next/server/app/index.segments/_head.segment.rsc +4 -4
- package/.next/server/app/index.segments/_index.segment.rsc +6 -6
- package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/page/server-reference-manifest.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/runs/[runId]/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/runs/[runId]/page/server-reference-manifest.json +1 -1
- package/.next/server/app/runs/[runId]/page_client-reference-manifest.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0kdfw4x._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__006f7~t._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0cpy61n._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0cpy61n._.js.map +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0cwa32j._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0cwa32j._.js.map +1 -1
- package/.next/server/chunks/ssr/_0wrbwro._.js +1 -1
- package/.next/server/chunks/ssr/_0wrbwro._.js.map +1 -1
- package/.next/server/chunks/ssr/packages_observer-dashboard_src_components_providers_tsx_03_vrrn._.js +1 -1
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +2 -2
- package/.next/static/chunks/{0j~l1s4qdwdc4.js → 02b3hntwwtkcc.js} +1 -1
- package/.next/static/chunks/{15lw8f5okp.vg.js → 02xtzt1xc_qnf.js} +1 -1
- package/.next/static/chunks/{0wv.anze5hz09.js → 0mttx2.x19myo.js} +1 -1
- package/.next/static/chunks/{0oknt341jrzu3.js → 0vxpk3.shoodp.js} +1 -1
- package/.next/static/chunks/{0ydywrcrbq0i0.js → 0wb~.houk6pn~.js} +1 -1
- package/.next/static/chunks/{0sw20c9zzv5di.js → 0y4t6mv7uzyvt.js} +1 -1
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- /package/.next/static/{33ZiK9k92GBOyjrvkVYYf → P_MJwoqj8gQV2JcFwfJLH}/_buildManifest.js +0 -0
- /package/.next/static/{33ZiK9k92GBOyjrvkVYYf → P_MJwoqj8gQV2JcFwfJLH}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{33ZiK9k92GBOyjrvkVYYf → P_MJwoqj8gQV2JcFwfJLH}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,848791,e=>{"use strict";var t=e.i(843476),s=e.i(271645),r=e.i(126650),n=e.i(645483);let a="observer:",i=s.useLayoutEffect;function l(e,t){let r=e.startsWith(a)?e:`${a}${e}`,[n,l]=(0,s.useState)(t);return i(()=>{try{let e=window.localStorage.getItem(r);if(null!==e){let t=JSON.parse(e);l(t)}}catch{}},[r]),[n,(0,s.useCallback)(e=>{l(t=>{let s="function"==typeof e?e(t):e;try{window.localStorage.setItem(r,JSON.stringify(s))}catch{}return s})},[r])]}var o=e.i(522016),d=e.i(273172),c=e.i(806790),u=e.i(608646),h=e.i(368842),m=e.i(86752),g=e.i(853897),x=e.i(689517);let p="observer:dismissed-breakpoints";function f({bp:e,stale:r,onDismiss:n}){let[a,i]=(0,s.useTransition)(),[l,p]=(0,s.useState)(null);return l?.ok?(0,t.jsxs)("div",{className:(0,d.cn)("group relative flex items-center gap-3 px-4 py-3 rounded-lg","bg-success-muted border border-success/30"),children:[(0,t.jsx)(h.CheckCircle2,{className:"h-5 w-5 text-success shrink-0"}),(0,t.jsxs)("span",{className:"text-sm text-success font-medium",children:["Approved — ",e.projectName]})]}):(0,t.jsxs)("div",{className:(0,d.cn)("group relative flex items-center gap-3 px-4 py-3 rounded-lg","bg-warning-muted border border-warning/30","shadow-breakpoint-glow animate-breakpoint-glow",r&&"opacity-70"),children:[(0,t.jsxs)(o.default,{href:`/runs/${e.runId}`,className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"relative shrink-0",children:[(0,t.jsx)(c.Hand,{className:"h-5 w-5 text-warning animate-pulse-dot"}),(0,t.jsx)("span",{className:"absolute -top-0.5 -right-0.5 h-2 w-2 rounded-full bg-warning animate-ping"})]}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-0.5",children:[(0,t.jsx)(u.AlertTriangle,{className:"h-3 w-3 text-warning shrink-0"}),(0,t.jsx)("span",{className:"text-xs font-bold text-warning uppercase tracking-wider",children:"Approval Needed"}),r&&(0,t.jsx)("span",{className:"text-xs text-foreground-muted italic","data-testid":"staleness-indicator",children:"(checking...)"}),(0,t.jsx)("span",{className:"text-xs text-foreground-muted font-medium",children:e.projectName}),(0,t.jsx)("span",{className:"font-mono text-xs text-info",children:e.runId.slice(0,8)})]}),(0,t.jsx)("p",{className:"text-sm text-foreground truncate",children:e.breakpointQuestion})]})]}),(0,t.jsxs)("button",{onClick:t=>{t.preventDefault(),t.stopPropagation(),i(async()=>{let t=await (0,x.approveBreakpoint)(e.runId,e.effectId,"Approved from dashboard");p(t.success?{ok:!0}:{ok:!1,msg:t.error})})},disabled:a||!e.effectId,className:(0,d.cn)("shrink-0 flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-semibold","bg-success/20 text-success border border-success/30","hover:bg-success/30 hover:border-success/50","disabled:opacity-50 disabled:cursor-not-allowed","transition-colors"),title:"Approve this breakpoint",children:[(0,t.jsx)(m.Check,{className:"h-3.5 w-3.5"}),a?"Approving...":"Approve"]}),r&&n&&(0,t.jsx)("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),n()},className:(0,d.cn)("shrink-0 p-1 rounded text-foreground-muted/50","hover:text-foreground-muted hover:bg-foreground-muted/10","transition-colors"),title:"Dismiss this stale breakpoint","data-testid":"dismiss-breakpoint",children:(0,t.jsx)(g.X,{className:"h-3.5 w-3.5"})}),l&&!l.ok&&(0,t.jsx)("span",{className:"text-xs text-error ml-2",children:l.msg})]})}function b({breakpointRuns:e}){let[r,n]=(0,s.useState)([]),a=(0,s.useRef)(new Map),i=(0,s.useRef)(new Map),[l,u]=(0,s.useState)(new Set);(0,s.useLayoutEffect)(()=>{try{let e=localStorage.getItem(p);e&&u(new Set(JSON.parse(e)))}catch{}},[]);let m=(0,s.useCallback)(e=>{u(t=>{let s=new Set(t);s.add(e);try{localStorage.setItem(p,JSON.stringify([...s]))}catch{}return s})},[]);(0,s.useEffect)(()=>{let t=new Set(e.map(e=>e.runId));u(e=>{let s=new Set([...e].filter(e=>t.has(e)));if(s.size!==e.size){try{localStorage.setItem(p,JSON.stringify([...s]))}catch{}return s}return e})},[e]);let[,g]=(0,s.useState)(0);(0,s.useEffect)(()=>{let t=new Set(e.map(e=>e.runId)),s=Date.now(),r=[];for(let[e,n]of a.current)t.has(e)||(r.push({bp:n,resolvedAt:s}),i.current.delete(e));for(let t of(r.length>0&&n(e=>[...e,...r]),e))i.current.has(t.runId)||i.current.set(t.runId,s);a.current=new Map(e.map(e=>[e.runId,e]))},[e]),(0,s.useEffect)(()=>{if(0===e.length)return;let t=setInterval(()=>{g(e=>e+1)},1e4);return()=>clearInterval(t)},[e.length]);let x=(0,s.useCallback)(e=>{let t=i.current.get(e);return!!t&&Date.now()-t>12e4},[]);(0,s.useEffect)(()=>{if(0===r.length)return;let e=setInterval(()=>{let e=Date.now();n(t=>t.filter(t=>e-t.resolvedAt<2e4))},1e3);return()=>clearInterval(e)},[r.length]);let v=e.filter(e=>!l.has(e.runId)),w=v.length>0,j=r.length>0;return w||j?(0,t.jsxs)("div",{role:"alert","aria-live":"assertive","aria-atomic":"true",className:"flex flex-col gap-2 mb-6","data-testid":"breakpoint-banner",children:[v.map(e=>{let s=x(e.runId);return(0,t.jsx)(f,{bp:e,stale:s,onDismiss:()=>m(e.runId)},e.runId)}),r.map(e=>(0,t.jsxs)(o.default,{href:`/runs/${e.bp.runId}`,className:(0,d.cn)("group relative flex items-center gap-3 px-4 py-3 rounded-lg","bg-success-muted border border-success/30","shadow-glow-success","hover:border-success/50","transition-colors cursor-pointer"),children:[(0,t.jsx)("div",{className:"relative shrink-0",children:(0,t.jsx)(h.CheckCircle2,{className:"h-5 w-5 text-success"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-0.5",children:[(0,t.jsx)(h.CheckCircle2,{className:"h-3 w-3 text-success shrink-0"}),(0,t.jsx)("span",{className:"text-xs font-bold text-success uppercase tracking-wider",children:"Approved"}),(0,t.jsx)("span",{className:"text-xs text-foreground-muted font-medium",children:e.bp.projectName}),(0,t.jsx)("span",{className:"font-mono text-xs text-info",children:e.bp.runId.slice(0,8)})]}),(0,t.jsx)("p",{className:"text-sm text-foreground-muted truncate",children:e.bp.breakpointQuestion})]})]},`resolved-${e.bp.runId}`)),v.length>1&&(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1",children:[(0,t.jsx)(c.Hand,{className:"h-3.5 w-3.5 text-warning"}),(0,t.jsxs)("span",{className:"text-xs font-semibold text-warning",children:[v.length," approvals pending"]})]})]}):null}var v=e.i(622537),w=e.i(621255);let j=(0,w.default)("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);function y({catchUp:e,summary:s}){if(!e.active)return null;let r=function(e){if(!e)return null;let t=[];return(e.failedRuns>0&&t.push(`${e.failedRuns} failed`),e.pendingBreakpoints>0&&t.push(`${e.pendingBreakpoints} awaiting input`),e.completedRuns>0&&t.push(`${e.completedRuns} completed`),0===t.length)?null:t.join(", ")}(s);return(0,t.jsxs)("div",{"data-testid":"catch-up-banner",className:(0,d.cn)("flex items-center gap-3 px-4 py-2.5 mb-4 rounded-lg","bg-info-muted border border-info/20","animate-in fade-in slide-in-from-top-2 duration-300"),children:[(0,t.jsx)("div",{className:"rounded-md p-1.5 bg-info/10",children:(0,t.jsx)(j,{className:"h-4 w-4 text-info"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("p",{className:"text-sm text-foreground",children:[(0,t.jsx)("span",{className:"font-semibold tabular-nums",children:e.bufferedCount})," ","runs updated while you were away"]}),r&&(0,t.jsx)("p",{"data-testid":"catch-up-summary",className:"text-xs text-foreground-muted mt-0.5 truncate",children:r})]}),(0,t.jsxs)("button",{onClick:e.flush,"data-testid":"catch-up-refresh-btn",className:(0,d.cn)("inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-semibold","bg-info/10 border border-info/20 text-info","hover:bg-info/20 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-info/50"),children:[(0,t.jsx)(v.RefreshCw,{className:"h-3 w-3"}),"Refresh now"]})]})}var N=e.i(949201);let k={healthy:{container:"border-success/25 bg-success-muted shadow-neon-glow-success-sm",text:"text-success",iconColor:"text-success"},amber:{container:"border-warning/25 bg-warning-muted shadow-neon-glow-warning-sm",text:"text-warning",iconColor:"text-warning"},red:{container:"border-error/25 bg-error-muted shadow-neon-glow-error-sm",text:"text-error",iconColor:"text-error"}};function C({metrics:e,onFilterChange:r,dismissed:n,onDismiss:a}){let i=(0,s.useMemo)(()=>(function(e){let s=[],r="healthy";if(e.failedRuns>0&&(s.push({text:`${e.failedRuns} run${1!==e.failedRuns?"s":""} failing`,filter:"failed"}),r="red"),e.pendingBreakpoints>0&&(s.push({text:`${e.pendingBreakpoints} approval${1!==e.pendingBreakpoints?"s":""} need${1===e.pendingBreakpoints?"s":""} your attention`,filter:"waiting"}),"red"!==r&&(r="amber")),e.staleRuns>0&&(s.push({text:`${e.staleRuns} stale run${1!==e.staleRuns?"s":""}`,filter:"stale"}),"red"!==r&&(r="amber")),0===s.length){let s=1===e.totalProjects?"project":"projects";return{severity:"healthy",issues:[{text:e.activeRuns>0?`All ${e.totalProjects} ${s} healthy \u2014 ${e.activeRuns} run${1!==e.activeRuns?"s":""} in progress`:`All ${e.totalProjects} ${s} healthy`,filter:null}],icon:(0,t.jsx)(h.CheckCircle2,{className:"h-4 w-4 shrink-0","aria-hidden":"true"})}}let n="red"===r?(0,t.jsx)(N.XCircle,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):(0,t.jsx)(u.AlertTriangle,{className:"h-4 w-4 shrink-0","aria-hidden":"true"});return{severity:r,issues:s,icon:n}})(e),[e]),l=k[i.severity];return n?null:(0,t.jsxs)("div",{role:"status","aria-live":"polite","aria-atomic":"true","data-testid":"executive-summary-banner",className:(0,d.cn)("flex items-center gap-2.5 rounded-xl border px-4 py-3 mb-6 shadow-sm transition-all duration-300",l.container),children:[(0,t.jsx)("span",{className:l.iconColor,children:i.icon}),(0,t.jsx)("p",{className:(0,d.cn)("text-sm font-medium leading-snug flex-1",l.text),children:i.issues.map((e,s)=>(0,t.jsxs)("span",{children:[s>0&&", ",e.filter&&r?(0,t.jsx)("button",{onClick:()=>r(e.filter),className:"underline decoration-dotted underline-offset-2 hover:decoration-solid transition-all",children:e.text}):e.text]},s))}),"healthy"!==i.severity&&a&&(0,t.jsx)("button",{"data-testid":"executive-summary-dismiss",onClick:a,className:(0,d.cn)("rounded-md p-1.5 min-h-[44px] min-w-[44px] flex items-center justify-center transition-colors",l.iconColor,"opacity-60 hover:opacity-100"),"aria-label":"Dismiss banner",children:(0,t.jsx)(g.X,{className:"h-3.5 w-3.5"})})]})}var S=e.i(422930);let R=(0,w.default)("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]]);var M=e.i(411670),I=e.i(770354);let E={primary:{text:"text-primary",bg:"bg-primary/10",glow:"shadow-neon-glow-primary-xs",borderL:"",ring:"ring-primary/50"},success:{text:"text-success",bg:"bg-success/10",glow:"shadow-neon-glow-success-sm",borderL:"border-l-success/60",ring:"ring-success/50"},warning:{text:"text-warning",bg:"bg-warning/10",glow:"shadow-neon-glow-warning-sm",borderL:"border-l-warning/60",ring:"ring-warning/50"},error:{text:"text-error",bg:"bg-error/10",glow:"shadow-neon-glow-error-sm",borderL:"border-l-error/60",ring:"ring-error/50"},muted:{text:"text-zinc-500",bg:"bg-zinc-500/10",glow:"",borderL:"border-l-zinc-500/60",ring:"ring-zinc-500/50"}};function A({label:e,value:r,icon:n,color:a,pulse:i,testId:l,active:o,onClick:c}){let u=E[a],h=!!c,m=function(e,t=600){let[r,n]=(0,s.useState)(e),a=(0,s.useRef)(null),i=(0,s.useRef)(null),l=(0,s.useRef)(e),o=(0,s.useRef)(e),d=(0,s.useCallback)(e=>1-Math.pow(1-e,3),[]);return(0,s.useEffect)(()=>{let s=l.current;if(l.current=e,s===e)return;null!==a.current&&(cancelAnimationFrame(a.current),a.current=null);let r=o.current,c=e-r;if(0===c||2>=Math.abs(c)){n(e),o.current=e;return}let u=performance.now();return i.current={value:r,time:u},a.current=requestAnimationFrame(function s(i){let l=Math.min((i-u)/t,1),h=Math.round(r+c*d(l));o.current=h,n(h),l<1?a.current=requestAnimationFrame(s):(a.current=null,o.current=e,n(e))}),()=>{null!==a.current&&(cancelAnimationFrame(a.current),a.current=null)}},[e,t,d]),r}(r);return(0,t.jsxs)("div",{"data-testid":l,role:h?"button":void 0,"aria-pressed":h?!!o:void 0,tabIndex:h?0:void 0,onClick:c,onKeyDown:h?e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),c?.())}:void 0,className:(0,d.cn)("rounded-xl border border-border bg-card/90 p-3 flex items-center gap-3 transition-all shadow-sm",r>0&&"primary"!==a&&"border-l-2",r>0&&"primary"!==a&&u.borderL,u.glow,h&&"cursor-pointer hover:bg-background-secondary/65 hover:shadow-md",o&&"ring-2",o&&u.ring),children:[(0,t.jsx)("div",{className:(0,d.cn)("rounded-md p-2",u.bg),children:(0,t.jsx)("span",{className:(0,d.cn)(u.text,i&&"animate-pulse-dot"),children:n})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:(0,d.cn)("text-lg font-bold tabular-nums leading-none mb-0.5",u.text),children:m}),(0,t.jsx)("p",{className:"text-[11px] leading-tight text-foreground-muted uppercase tracking-[0.12em] font-medium",children:e})]})]})}function z({metrics:e,statusFilter:s,hasStaleRuns:r,onToggleFilter:n}){return(0,t.jsxs)("div",{"data-testid":"kpi-grid","aria-live":"polite","aria-label":"Key metrics",className:(0,d.cn)("grid gap-3 mb-6",r?"grid-cols-2 sm:grid-cols-5":"grid-cols-2 sm:grid-cols-4"),children:[(0,t.jsx)(A,{label:"Total Runs",value:e.totalRuns,icon:(0,t.jsx)(S.Layers,{className:"h-4 w-4"}),color:"primary",testId:"metric-tile-total-runs",onClick:()=>n("all"),active:"all"===s}),(0,t.jsx)(A,{label:"In Progress",value:e.activeRuns,icon:(0,t.jsx)(R,{className:"h-4 w-4"}),color:"warning",pulse:e.activeRuns>0,testId:"metric-tile-active",onClick:()=>n("waiting"),active:"waiting"===s}),r&&(0,t.jsx)(A,{label:"Stale",value:e.staleRuns,icon:(0,t.jsx)(I.Pause,{className:"h-4 w-4"}),color:"muted",testId:"metric-tile-stale",onClick:()=>n("stale"),active:"stale"===s}),(0,t.jsx)(A,{label:"Completed",value:e.completedRuns,icon:(0,t.jsx)(h.CheckCircle2,{className:"h-4 w-4"}),color:"success",testId:"metric-tile-completed",onClick:()=>n("completed"),active:"completed"===s}),(0,t.jsx)(A,{label:"Failed",value:e.failedRuns,icon:(0,t.jsx)(M.AlertCircle,{className:"h-4 w-4"}),color:"error",testId:"metric-tile-failed",onClick:()=>n("failed"),active:"failed"===s})]})}let T=(0,w.default)("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);var O=e.i(327214);let F=[{label:"All",value:"all"},{label:"Running",value:"waiting"},{label:"Stale",value:"stale"},{label:"Completed",value:"completed"},{label:"Failed",value:"failed"}];function P({statusFilter:e,onStatusFilterChange:s,filterCounts:r,sortMode:n,onSortModeToggle:a,filteredProjectCount:i}){return(0,t.jsx)("div",{className:"mb-5",children:(0,t.jsxs)("div",{"data-testid":"filter-bar",className:"flex items-center gap-1",children:[F.map(n=>{let a=r[n.value]??0;return"stale"===n.value&&0===a?null:(0,t.jsxs)("button",{"data-testid":`filter-pill-${n.value}`,"aria-pressed":e===n.value,onClick:()=>s(n.value),className:(0,d.cn)("rounded-md px-3 py-1.5 min-h-[44px] text-xs font-medium transition-all inline-flex items-center gap-1.5",e===n.value?"stale"===n.value?"bg-zinc-500/10 text-zinc-500":"bg-primary/10 text-primary shadow-neon-glow-primary-xs":"text-foreground-muted hover:text-foreground-secondary hover:bg-background-secondary"),children:[n.label,a>0&&(0,t.jsx)("span",{className:(0,d.cn)("rounded-full px-1.5 py-px text-xs leading-tight font-semibold tabular-nums",e===n.value?"stale"===n.value?"bg-zinc-500/20 text-zinc-500":"bg-primary/20 text-primary":"bg-background-secondary text-foreground-muted"),children:a})]},n.value)}),(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[(0,t.jsxs)("button",{"data-testid":"sort-toggle",onClick:a,className:(0,d.cn)("rounded-md px-2.5 py-1.5 min-h-[44px] text-xs font-medium inline-flex items-center gap-1.5","transition-all duration-200 ease-in-out","status"===n?"bg-warning/10 border border-warning/30 text-warning hover:bg-warning/15 hover:border-warning/40 shadow-sm":"bg-primary/10 border border-primary/30 text-primary hover:bg-primary/15 hover:border-primary/40 shadow-sm"),title:"status"===n?"Currently sorting by status priority (active first, then failed, then completed). Click to switch to chronological activity view.":"Currently sorting by most recent activity (newest updates first). Click to switch to status-grouped view.",children:["status"===n?(0,t.jsx)(T,{className:"h-3 w-3 transition-transform duration-200"}):(0,t.jsx)(O.Clock,{className:"h-3 w-3 transition-transform duration-200"}),"status"===n?"By Status":"By Activity"]}),(0,t.jsxs)("span",{"data-testid":"project-count",className:"text-xs text-foreground-muted tabular-nums",children:[i," project",1!==i?"s":""]})]})]})})}var D=e.i(355338),$=e.i(421509);let B=(0,w.default)("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);var L=e.i(229235),_=e.i(777297),H=e.i(793649);function W({className:e,...s}){return(0,t.jsx)("div",{className:(0,d.cn)("rounded-xl border border-card-border bg-card text-card-foreground shadow-sm transition-all duration-200 hover:bg-[var(--card-hover)] hover:border-[var(--border-hover)] hover:shadow-md",e),...s})}var K=e.i(538170),U=e.i(83143),q=e.i(246519),V=e.i(722727),J=e.i(743041);let Q=(0,w.default)("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);var X=e.i(448647);let Y=(0,s.memo)(function({run:e,selected:s}){var r;let n,a="completed"===e.status?100:e.totalTasks>0?Math.round(e.completedTasks/e.totalTasks*100):0,i="waiting"===e.status||"pending"===e.status,l=!0===e.isStale,u=e.tasks.find(e=>"breakpoint"===e.kind&&"requested"===e.status),h=e.breakpointQuestion??u?.breakpointQuestion,m=!l&&(!!u||"waiting"===e.status&&"breakpoint"===e.waitingKind),g="failed"===e.status?e.failedStep||(e.failureMessage?`${e.failureMessage}`:void 0):void 0;return(0,t.jsx)(o.default,{href:`/runs/${e.runId}`,children:(0,t.jsxs)(W,{className:(0,d.cn)("cursor-pointer p-4 transition-all card-hover-lift","hover:shadow-md",s&&"ring-1 ring-primary shadow-glow-primary",i&&!l&&!m&&"border-[var(--border-hover)]",m&&"border-warning/40 shadow-glow-warning ring-1 ring-warning/20 animate-breakpoint-glow",l&&"opacity-50"),children:[(0,t.jsx)("div",{className:"flex items-start justify-between gap-3",children:(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,t.jsx)("span",{className:(0,d.cn)("h-2 w-2 rounded-full shrink-0",l?"bg-zinc-500":m?"bg-warning shadow-[0_0_8px_var(--warning)] animate-pulse-dot":"completed"===e.status?"bg-success shadow-[0_0_6px_var(--success)]":"failed"===e.status?"bg-error shadow-[0_0_6px_var(--error)]":"waiting"===e.status?"bg-warning shadow-[0_0_6px_var(--warning)] animate-pulse-dot":"bg-pending")}),(0,t.jsx)("span",{className:"text-lg font-semibold italic font-serif text-foreground truncate",children:(0,J.friendlyProcessName)(e.processId)}),m&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-warning/15 border border-warning/30 px-2.5 py-1 text-[11px] leading-tight font-bold text-warning uppercase tracking-[0.12em] shrink-0 animate-pulse-dot",children:[(0,t.jsx)(c.Hand,{className:"h-2.5 w-2.5"}),"Approval Required"]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[(0,t.jsx)(K.StatusBadge,{status:e.status,waitingKind:e.waitingKind,isStale:l}),l&&(0,t.jsx)("span",{className:"inline-flex items-center rounded-full bg-zinc-500/10 border border-zinc-500/20 px-2 py-0.5 text-xs leading-tight font-medium text-zinc-500 shrink-0",children:(r=e.updatedAt,(n=(0,J.formatRelativeTime)(r))?`Stale (${n})`:"Stale")}),(0,t.jsx)(q.TruncatedId,{id:e.runId,chars:4,className:"text-foreground-secondary"}),e.projectName&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-background-secondary px-2 py-0.5 text-xs leading-tight font-medium text-foreground-muted shrink-0",children:[(0,t.jsx)(Q,{className:"h-2.5 w-2.5"}),e.projectName]})]}),g&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 mt-2 px-2 py-1 rounded-md bg-error-muted border border-error/20 border-l-2 border-l-error shadow-glow-error",children:[(0,t.jsx)(M.AlertCircle,{className:"h-3.5 w-3.5 text-error shrink-0"}),(0,t.jsxs)("span",{className:"text-xs text-error truncate",children:["Failed at: ",g.length>80?g.slice(0,80)+"...":g]})]}),m&&h&&(0,t.jsx)("div",{className:"mt-2 px-3 py-2 rounded-md bg-warning-muted border border-warning/25 border-l-2 border-l-warning shadow-breakpoint-glow",children:(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)(c.Hand,{className:"h-4 w-4 text-warning shrink-0 mt-0.5 animate-pulse-dot"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("span",{className:"text-xs font-bold text-warning uppercase tracking-wider block mb-0.5",children:"Awaiting approval"}),(0,t.jsx)("span",{className:"text-sm text-foreground leading-snug block",children:h})]}),(0,t.jsxs)("span",{className:(0,d.cn)("shrink-0 inline-flex items-center gap-1 px-2 py-1 rounded-md","bg-warning/10 border border-warning/20","text-xs font-semibold text-warning","hover:bg-warning/20 transition-colors"),children:["Review & Approve",(0,t.jsx)(X.ExternalLink,{className:"h-2.5 w-2.5"})]})]})}),m&&!h&&(0,t.jsxs)("div",{className:"flex items-center gap-2 mt-2 px-3 py-2 rounded-md bg-warning-muted border border-warning/25 border-l-2 border-l-warning shadow-breakpoint-glow",children:[(0,t.jsx)(c.Hand,{className:"h-4 w-4 text-warning shrink-0 animate-pulse-dot"}),(0,t.jsx)("span",{className:"text-xs font-semibold text-warning",children:"Approval needed"}),(0,t.jsxs)("span",{className:(0,d.cn)("ml-auto shrink-0 inline-flex items-center gap-1 px-2 py-1 rounded-md","bg-warning/10 border border-warning/20","text-xs font-semibold text-warning"),children:["Review & Approve",(0,t.jsx)(X.ExternalLink,{className:"h-2.5 w-2.5"})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3 mt-2 text-xs text-foreground-muted",children:[(0,t.jsx)(U.SessionPill,{sessionId:e.sessionId,active:i&&!l}),(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)(S.Layers,{className:"h-3 w-3"}),e.completedTasks,"/",e.totalTasks," tasks"]}),(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)(O.Clock,{className:"h-3 w-3"}),(0,J.formatDuration)(e.duration)]})]})]})}),e.totalTasks>0&&(0,t.jsx)(V.ProgressBar,{value:a,variant:function(e){switch(e){case"completed":return"success";case"failed":return"error";case"waiting":return"warning";default:return"default"}}(e.status),glow:i&&!l,className:"mt-4"})]})})},function(e,t){if(e.selected!==t.selected)return!1;let s=e.run,r=t.run;return s.runId===r.runId&&s.status===r.status&&s.updatedAt===r.updatedAt&&s.completedTasks===r.completedTasks&&s.totalTasks===r.totalTasks&&s.duration===r.duration&&s.isStale===r.isStale&&s.waitingKind===r.waitingKind&&s.breakpointQuestion===r.breakpointQuestion&&s.failedStep===r.failedStep&&s.failureMessage===r.failureMessage});var G=e.i(174080);function Z(e,t,s){let r,n=s.initialDeps??[],a=!0;function i(){var i,l,o;let d,c;s.key&&(null==(i=s.debug)?void 0:i.call(s))&&(d=Date.now());let u=e();if(!(u.length!==n.length||u.some((e,t)=>n[t]!==e)))return r;if(n=u,s.key&&(null==(l=s.debug)?void 0:l.call(s))&&(c=Date.now()),r=t(...u),s.key&&(null==(o=s.debug)?void 0:o.call(s))){let e=Math.round((Date.now()-d)*100)/100,t=Math.round((Date.now()-c)*100)/100,r=t/16,n=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${n(t,5)} /${n(e,5)} ms`,`
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,848791,e=>{"use strict";var t=e.i(843476),s=e.i(271645),r=e.i(126650),n=e.i(645483);let a="observer:",i=s.useLayoutEffect;function l(e,t){let r=e.startsWith(a)?e:`${a}${e}`,[n,l]=(0,s.useState)(t);return i(()=>{try{let e=window.localStorage.getItem(r);if(null!==e){let t=JSON.parse(e);l(t)}}catch{}},[r]),[n,(0,s.useCallback)(e=>{l(t=>{let s="function"==typeof e?e(t):e;try{window.localStorage.setItem(r,JSON.stringify(s))}catch{}return s})},[r])]}var o=e.i(522016),d=e.i(273172),c=e.i(806790),u=e.i(608646),h=e.i(368842),m=e.i(86752),g=e.i(853897),x=e.i(809395);let p="observer:dismissed-breakpoints";function f({bp:e,stale:r,onDismiss:n}){let[a,i]=(0,s.useTransition)(),[l,p]=(0,s.useState)(null);return l?.ok?(0,t.jsxs)("div",{className:(0,d.cn)("group relative flex items-center gap-3 px-4 py-3 rounded-lg","bg-success-muted border border-success/30"),children:[(0,t.jsx)(h.CheckCircle2,{className:"h-5 w-5 text-success shrink-0"}),(0,t.jsxs)("span",{className:"text-sm text-success font-medium",children:["Approved — ",e.projectName]})]}):(0,t.jsxs)("div",{className:(0,d.cn)("group relative flex items-center gap-3 px-4 py-3 rounded-lg","bg-warning-muted border border-warning/30","shadow-breakpoint-glow animate-breakpoint-glow",r&&"opacity-70"),children:[(0,t.jsxs)(o.default,{href:`/runs/${e.runId}`,className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"relative shrink-0",children:[(0,t.jsx)(c.Hand,{className:"h-5 w-5 text-warning animate-pulse-dot"}),(0,t.jsx)("span",{className:"absolute -top-0.5 -right-0.5 h-2 w-2 rounded-full bg-warning animate-ping"})]}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-0.5",children:[(0,t.jsx)(u.AlertTriangle,{className:"h-3 w-3 text-warning shrink-0"}),(0,t.jsx)("span",{className:"text-xs font-bold text-warning uppercase tracking-wider",children:"Approval Needed"}),r&&(0,t.jsx)("span",{className:"text-xs text-foreground-muted italic","data-testid":"staleness-indicator",children:"(checking...)"}),(0,t.jsx)("span",{className:"text-xs text-foreground-muted font-medium",children:e.projectName}),(0,t.jsx)("span",{className:"font-mono text-xs text-info",children:e.runId.slice(0,8)})]}),(0,t.jsx)("p",{className:"text-sm text-foreground truncate",children:e.breakpointQuestion})]})]}),(0,t.jsxs)("button",{onClick:t=>{t.preventDefault(),t.stopPropagation(),i(async()=>{let t=await (0,x.approveBreakpoint)(e.runId,e.effectId,"Approved from dashboard");p(t.success?{ok:!0}:{ok:!1,msg:t.error})})},disabled:a||!e.effectId,className:(0,d.cn)("shrink-0 flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-semibold","bg-success/20 text-success border border-success/30","hover:bg-success/30 hover:border-success/50","disabled:opacity-50 disabled:cursor-not-allowed","transition-colors"),title:"Approve this breakpoint",children:[(0,t.jsx)(m.Check,{className:"h-3.5 w-3.5"}),a?"Approving...":"Approve"]}),r&&n&&(0,t.jsx)("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),n()},className:(0,d.cn)("shrink-0 p-1 rounded text-foreground-muted/50","hover:text-foreground-muted hover:bg-foreground-muted/10","transition-colors"),title:"Dismiss this stale breakpoint","data-testid":"dismiss-breakpoint",children:(0,t.jsx)(g.X,{className:"h-3.5 w-3.5"})}),l&&!l.ok&&(0,t.jsx)("span",{className:"text-xs text-error ml-2",children:l.msg})]})}function b({breakpointRuns:e}){let[r,n]=(0,s.useState)([]),a=(0,s.useRef)(new Map),i=(0,s.useRef)(new Map),[l,u]=(0,s.useState)(new Set);(0,s.useLayoutEffect)(()=>{try{let e=localStorage.getItem(p);e&&u(new Set(JSON.parse(e)))}catch{}},[]);let m=(0,s.useCallback)(e=>{u(t=>{let s=new Set(t);s.add(e);try{localStorage.setItem(p,JSON.stringify([...s]))}catch{}return s})},[]);(0,s.useEffect)(()=>{let t=new Set(e.map(e=>e.runId));u(e=>{let s=new Set([...e].filter(e=>t.has(e)));if(s.size!==e.size){try{localStorage.setItem(p,JSON.stringify([...s]))}catch{}return s}return e})},[e]);let[,g]=(0,s.useState)(0);(0,s.useEffect)(()=>{let t=new Set(e.map(e=>e.runId)),s=Date.now(),r=[];for(let[e,n]of a.current)t.has(e)||(r.push({bp:n,resolvedAt:s}),i.current.delete(e));for(let t of(r.length>0&&n(e=>[...e,...r]),e))i.current.has(t.runId)||i.current.set(t.runId,s);a.current=new Map(e.map(e=>[e.runId,e]))},[e]),(0,s.useEffect)(()=>{if(0===e.length)return;let t=setInterval(()=>{g(e=>e+1)},1e4);return()=>clearInterval(t)},[e.length]);let x=(0,s.useCallback)(e=>{let t=i.current.get(e);return!!t&&Date.now()-t>12e4},[]);(0,s.useEffect)(()=>{if(0===r.length)return;let e=setInterval(()=>{let e=Date.now();n(t=>t.filter(t=>e-t.resolvedAt<2e4))},1e3);return()=>clearInterval(e)},[r.length]);let v=e.filter(e=>!l.has(e.runId)),w=v.length>0,j=r.length>0;return w||j?(0,t.jsxs)("div",{role:"alert","aria-live":"assertive","aria-atomic":"true",className:"flex flex-col gap-2 mb-6","data-testid":"breakpoint-banner",children:[v.map(e=>{let s=x(e.runId);return(0,t.jsx)(f,{bp:e,stale:s,onDismiss:()=>m(e.runId)},e.runId)}),r.map(e=>(0,t.jsxs)(o.default,{href:`/runs/${e.bp.runId}`,className:(0,d.cn)("group relative flex items-center gap-3 px-4 py-3 rounded-lg","bg-success-muted border border-success/30","shadow-glow-success","hover:border-success/50","transition-colors cursor-pointer"),children:[(0,t.jsx)("div",{className:"relative shrink-0",children:(0,t.jsx)(h.CheckCircle2,{className:"h-5 w-5 text-success"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-0.5",children:[(0,t.jsx)(h.CheckCircle2,{className:"h-3 w-3 text-success shrink-0"}),(0,t.jsx)("span",{className:"text-xs font-bold text-success uppercase tracking-wider",children:"Approved"}),(0,t.jsx)("span",{className:"text-xs text-foreground-muted font-medium",children:e.bp.projectName}),(0,t.jsx)("span",{className:"font-mono text-xs text-info",children:e.bp.runId.slice(0,8)})]}),(0,t.jsx)("p",{className:"text-sm text-foreground-muted truncate",children:e.bp.breakpointQuestion})]})]},`resolved-${e.bp.runId}`)),v.length>1&&(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1",children:[(0,t.jsx)(c.Hand,{className:"h-3.5 w-3.5 text-warning"}),(0,t.jsxs)("span",{className:"text-xs font-semibold text-warning",children:[v.length," approvals pending"]})]})]}):null}var v=e.i(622537),w=e.i(621255);let j=(0,w.default)("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);function y({catchUp:e,summary:s}){if(!e.active)return null;let r=function(e){if(!e)return null;let t=[];return(e.failedRuns>0&&t.push(`${e.failedRuns} failed`),e.pendingBreakpoints>0&&t.push(`${e.pendingBreakpoints} awaiting input`),e.completedRuns>0&&t.push(`${e.completedRuns} completed`),0===t.length)?null:t.join(", ")}(s);return(0,t.jsxs)("div",{"data-testid":"catch-up-banner",className:(0,d.cn)("flex items-center gap-3 px-4 py-2.5 mb-4 rounded-lg","bg-info-muted border border-info/20","animate-in fade-in slide-in-from-top-2 duration-300"),children:[(0,t.jsx)("div",{className:"rounded-md p-1.5 bg-info/10",children:(0,t.jsx)(j,{className:"h-4 w-4 text-info"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("p",{className:"text-sm text-foreground",children:[(0,t.jsx)("span",{className:"font-semibold tabular-nums",children:e.bufferedCount})," ","runs updated while you were away"]}),r&&(0,t.jsx)("p",{"data-testid":"catch-up-summary",className:"text-xs text-foreground-muted mt-0.5 truncate",children:r})]}),(0,t.jsxs)("button",{onClick:e.flush,"data-testid":"catch-up-refresh-btn",className:(0,d.cn)("inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-semibold","bg-info/10 border border-info/20 text-info","hover:bg-info/20 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-info/50"),children:[(0,t.jsx)(v.RefreshCw,{className:"h-3 w-3"}),"Refresh now"]})]})}var N=e.i(949201);let k={healthy:{container:"border-success/25 bg-success-muted shadow-neon-glow-success-sm",text:"text-success",iconColor:"text-success"},amber:{container:"border-warning/25 bg-warning-muted shadow-neon-glow-warning-sm",text:"text-warning",iconColor:"text-warning"},red:{container:"border-error/25 bg-error-muted shadow-neon-glow-error-sm",text:"text-error",iconColor:"text-error"}};function C({metrics:e,onFilterChange:r,dismissed:n,onDismiss:a}){let i=(0,s.useMemo)(()=>(function(e){let s=[],r="healthy";if(e.failedRuns>0&&(s.push({text:`${e.failedRuns} run${1!==e.failedRuns?"s":""} failing`,filter:"failed"}),r="red"),e.pendingBreakpoints>0&&(s.push({text:`${e.pendingBreakpoints} approval${1!==e.pendingBreakpoints?"s":""} need${1===e.pendingBreakpoints?"s":""} your attention`,filter:"waiting"}),"red"!==r&&(r="amber")),e.staleRuns>0&&(s.push({text:`${e.staleRuns} stale run${1!==e.staleRuns?"s":""}`,filter:"stale"}),"red"!==r&&(r="amber")),0===s.length){let s=1===e.totalProjects?"project":"projects";return{severity:"healthy",issues:[{text:e.activeRuns>0?`All ${e.totalProjects} ${s} healthy \u2014 ${e.activeRuns} run${1!==e.activeRuns?"s":""} in progress`:`All ${e.totalProjects} ${s} healthy`,filter:null}],icon:(0,t.jsx)(h.CheckCircle2,{className:"h-4 w-4 shrink-0","aria-hidden":"true"})}}let n="red"===r?(0,t.jsx)(N.XCircle,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):(0,t.jsx)(u.AlertTriangle,{className:"h-4 w-4 shrink-0","aria-hidden":"true"});return{severity:r,issues:s,icon:n}})(e),[e]),l=k[i.severity];return n?null:(0,t.jsxs)("div",{role:"status","aria-live":"polite","aria-atomic":"true","data-testid":"executive-summary-banner",className:(0,d.cn)("flex items-center gap-2.5 rounded-xl border px-4 py-3 mb-6 shadow-sm transition-all duration-300",l.container),children:[(0,t.jsx)("span",{className:l.iconColor,children:i.icon}),(0,t.jsx)("p",{className:(0,d.cn)("text-sm font-medium leading-snug flex-1",l.text),children:i.issues.map((e,s)=>(0,t.jsxs)("span",{children:[s>0&&", ",e.filter&&r?(0,t.jsx)("button",{onClick:()=>r(e.filter),className:"underline decoration-dotted underline-offset-2 hover:decoration-solid transition-all",children:e.text}):e.text]},s))}),"healthy"!==i.severity&&a&&(0,t.jsx)("button",{"data-testid":"executive-summary-dismiss",onClick:a,className:(0,d.cn)("rounded-md p-1.5 min-h-[44px] min-w-[44px] flex items-center justify-center transition-colors",l.iconColor,"opacity-60 hover:opacity-100"),"aria-label":"Dismiss banner",children:(0,t.jsx)(g.X,{className:"h-3.5 w-3.5"})})]})}var S=e.i(422930);let R=(0,w.default)("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]]);var M=e.i(411670),I=e.i(770354);let E={primary:{text:"text-primary",bg:"bg-primary/10",glow:"shadow-neon-glow-primary-xs",borderL:"",ring:"ring-primary/50"},success:{text:"text-success",bg:"bg-success/10",glow:"shadow-neon-glow-success-sm",borderL:"border-l-success/60",ring:"ring-success/50"},warning:{text:"text-warning",bg:"bg-warning/10",glow:"shadow-neon-glow-warning-sm",borderL:"border-l-warning/60",ring:"ring-warning/50"},error:{text:"text-error",bg:"bg-error/10",glow:"shadow-neon-glow-error-sm",borderL:"border-l-error/60",ring:"ring-error/50"},muted:{text:"text-zinc-500",bg:"bg-zinc-500/10",glow:"",borderL:"border-l-zinc-500/60",ring:"ring-zinc-500/50"}};function A({label:e,value:r,icon:n,color:a,pulse:i,testId:l,active:o,onClick:c}){let u=E[a],h=!!c,m=function(e,t=600){let[r,n]=(0,s.useState)(e),a=(0,s.useRef)(null),i=(0,s.useRef)(null),l=(0,s.useRef)(e),o=(0,s.useRef)(e),d=(0,s.useCallback)(e=>1-Math.pow(1-e,3),[]);return(0,s.useEffect)(()=>{let s=l.current;if(l.current=e,s===e)return;null!==a.current&&(cancelAnimationFrame(a.current),a.current=null);let r=o.current,c=e-r;if(0===c||2>=Math.abs(c)){n(e),o.current=e;return}let u=performance.now();return i.current={value:r,time:u},a.current=requestAnimationFrame(function s(i){let l=Math.min((i-u)/t,1),h=Math.round(r+c*d(l));o.current=h,n(h),l<1?a.current=requestAnimationFrame(s):(a.current=null,o.current=e,n(e))}),()=>{null!==a.current&&(cancelAnimationFrame(a.current),a.current=null)}},[e,t,d]),r}(r);return(0,t.jsxs)("div",{"data-testid":l,role:h?"button":void 0,"aria-pressed":h?!!o:void 0,tabIndex:h?0:void 0,onClick:c,onKeyDown:h?e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),c?.())}:void 0,className:(0,d.cn)("rounded-xl border border-border bg-card/90 p-3 flex items-center gap-3 transition-all shadow-sm",r>0&&"primary"!==a&&"border-l-2",r>0&&"primary"!==a&&u.borderL,u.glow,h&&"cursor-pointer hover:bg-background-secondary/65 hover:shadow-md",o&&"ring-2",o&&u.ring),children:[(0,t.jsx)("div",{className:(0,d.cn)("rounded-md p-2",u.bg),children:(0,t.jsx)("span",{className:(0,d.cn)(u.text,i&&"animate-pulse-dot"),children:n})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:(0,d.cn)("text-lg font-bold tabular-nums leading-none mb-0.5",u.text),children:m}),(0,t.jsx)("p",{className:"text-[11px] leading-tight text-foreground-muted uppercase tracking-[0.12em] font-medium",children:e})]})]})}function z({metrics:e,statusFilter:s,hasStaleRuns:r,onToggleFilter:n}){return(0,t.jsxs)("div",{"data-testid":"kpi-grid","aria-live":"polite","aria-label":"Key metrics",className:(0,d.cn)("grid gap-3 mb-6",r?"grid-cols-2 sm:grid-cols-5":"grid-cols-2 sm:grid-cols-4"),children:[(0,t.jsx)(A,{label:"Total Runs",value:e.totalRuns,icon:(0,t.jsx)(S.Layers,{className:"h-4 w-4"}),color:"primary",testId:"metric-tile-total-runs",onClick:()=>n("all"),active:"all"===s}),(0,t.jsx)(A,{label:"In Progress",value:e.activeRuns,icon:(0,t.jsx)(R,{className:"h-4 w-4"}),color:"warning",pulse:e.activeRuns>0,testId:"metric-tile-active",onClick:()=>n("waiting"),active:"waiting"===s}),r&&(0,t.jsx)(A,{label:"Stale",value:e.staleRuns,icon:(0,t.jsx)(I.Pause,{className:"h-4 w-4"}),color:"muted",testId:"metric-tile-stale",onClick:()=>n("stale"),active:"stale"===s}),(0,t.jsx)(A,{label:"Completed",value:e.completedRuns,icon:(0,t.jsx)(h.CheckCircle2,{className:"h-4 w-4"}),color:"success",testId:"metric-tile-completed",onClick:()=>n("completed"),active:"completed"===s}),(0,t.jsx)(A,{label:"Failed",value:e.failedRuns,icon:(0,t.jsx)(M.AlertCircle,{className:"h-4 w-4"}),color:"error",testId:"metric-tile-failed",onClick:()=>n("failed"),active:"failed"===s})]})}let T=(0,w.default)("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);var O=e.i(327214);let F=[{label:"All",value:"all"},{label:"Running",value:"waiting"},{label:"Stale",value:"stale"},{label:"Completed",value:"completed"},{label:"Failed",value:"failed"}];function P({statusFilter:e,onStatusFilterChange:s,filterCounts:r,sortMode:n,onSortModeToggle:a,filteredProjectCount:i}){return(0,t.jsx)("div",{className:"mb-5",children:(0,t.jsxs)("div",{"data-testid":"filter-bar",className:"flex items-center gap-1",children:[F.map(n=>{let a=r[n.value]??0;return"stale"===n.value&&0===a?null:(0,t.jsxs)("button",{"data-testid":`filter-pill-${n.value}`,"aria-pressed":e===n.value,onClick:()=>s(n.value),className:(0,d.cn)("rounded-md px-3 py-1.5 min-h-[44px] text-xs font-medium transition-all inline-flex items-center gap-1.5",e===n.value?"stale"===n.value?"bg-zinc-500/10 text-zinc-500":"bg-primary/10 text-primary shadow-neon-glow-primary-xs":"text-foreground-muted hover:text-foreground-secondary hover:bg-background-secondary"),children:[n.label,a>0&&(0,t.jsx)("span",{className:(0,d.cn)("rounded-full px-1.5 py-px text-xs leading-tight font-semibold tabular-nums",e===n.value?"stale"===n.value?"bg-zinc-500/20 text-zinc-500":"bg-primary/20 text-primary":"bg-background-secondary text-foreground-muted"),children:a})]},n.value)}),(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[(0,t.jsxs)("button",{"data-testid":"sort-toggle",onClick:a,className:(0,d.cn)("rounded-md px-2.5 py-1.5 min-h-[44px] text-xs font-medium inline-flex items-center gap-1.5","transition-all duration-200 ease-in-out","status"===n?"bg-warning/10 border border-warning/30 text-warning hover:bg-warning/15 hover:border-warning/40 shadow-sm":"bg-primary/10 border border-primary/30 text-primary hover:bg-primary/15 hover:border-primary/40 shadow-sm"),title:"status"===n?"Currently sorting by status priority (active first, then failed, then completed). Click to switch to chronological activity view.":"Currently sorting by most recent activity (newest updates first). Click to switch to status-grouped view.",children:["status"===n?(0,t.jsx)(T,{className:"h-3 w-3 transition-transform duration-200"}):(0,t.jsx)(O.Clock,{className:"h-3 w-3 transition-transform duration-200"}),"status"===n?"By Status":"By Activity"]}),(0,t.jsxs)("span",{"data-testid":"project-count",className:"text-xs text-foreground-muted tabular-nums",children:[i," project",1!==i?"s":""]})]})]})})}var D=e.i(355338),$=e.i(421509);let B=(0,w.default)("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);var L=e.i(229235),_=e.i(777297),H=e.i(793649);function W({className:e,...s}){return(0,t.jsx)("div",{className:(0,d.cn)("rounded-xl border border-card-border bg-card text-card-foreground shadow-sm transition-all duration-200 hover:bg-[var(--card-hover)] hover:border-[var(--border-hover)] hover:shadow-md",e),...s})}var K=e.i(538170),U=e.i(83143),q=e.i(246519),V=e.i(722727),J=e.i(743041);let Q=(0,w.default)("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);var X=e.i(448647);let Y=(0,s.memo)(function({run:e,selected:s}){var r;let n,a="completed"===e.status?100:e.totalTasks>0?Math.round(e.completedTasks/e.totalTasks*100):0,i="waiting"===e.status||"pending"===e.status,l=!0===e.isStale,u=e.tasks.find(e=>"breakpoint"===e.kind&&"requested"===e.status),h=e.breakpointQuestion??u?.breakpointQuestion,m=!l&&(!!u||"waiting"===e.status&&"breakpoint"===e.waitingKind),g="failed"===e.status?e.failedStep||(e.failureMessage?`${e.failureMessage}`:void 0):void 0;return(0,t.jsx)(o.default,{href:`/runs/${e.runId}`,children:(0,t.jsxs)(W,{className:(0,d.cn)("cursor-pointer p-4 transition-all card-hover-lift","hover:shadow-md",s&&"ring-1 ring-primary shadow-glow-primary",i&&!l&&!m&&"border-[var(--border-hover)]",m&&"border-warning/40 shadow-glow-warning ring-1 ring-warning/20 animate-breakpoint-glow",l&&"opacity-50"),children:[(0,t.jsx)("div",{className:"flex items-start justify-between gap-3",children:(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,t.jsx)("span",{className:(0,d.cn)("h-2 w-2 rounded-full shrink-0",l?"bg-zinc-500":m?"bg-warning shadow-[0_0_8px_var(--warning)] animate-pulse-dot":"completed"===e.status?"bg-success shadow-[0_0_6px_var(--success)]":"failed"===e.status?"bg-error shadow-[0_0_6px_var(--error)]":"waiting"===e.status?"bg-warning shadow-[0_0_6px_var(--warning)] animate-pulse-dot":"bg-pending")}),(0,t.jsx)("span",{className:"text-lg font-semibold italic font-serif text-foreground truncate",children:(0,J.friendlyProcessName)(e.processId)}),m&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-warning/15 border border-warning/30 px-2.5 py-1 text-[11px] leading-tight font-bold text-warning uppercase tracking-[0.12em] shrink-0 animate-pulse-dot",children:[(0,t.jsx)(c.Hand,{className:"h-2.5 w-2.5"}),"Approval Required"]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[(0,t.jsx)(K.StatusBadge,{status:e.status,waitingKind:e.waitingKind,isStale:l}),l&&(0,t.jsx)("span",{className:"inline-flex items-center rounded-full bg-zinc-500/10 border border-zinc-500/20 px-2 py-0.5 text-xs leading-tight font-medium text-zinc-500 shrink-0",children:(r=e.updatedAt,(n=(0,J.formatRelativeTime)(r))?`Stale (${n})`:"Stale")}),(0,t.jsx)(q.TruncatedId,{id:e.runId,chars:4,className:"text-foreground-secondary"}),e.projectName&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-background-secondary px-2 py-0.5 text-xs leading-tight font-medium text-foreground-muted shrink-0",children:[(0,t.jsx)(Q,{className:"h-2.5 w-2.5"}),e.projectName]})]}),g&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 mt-2 px-2 py-1 rounded-md bg-error-muted border border-error/20 border-l-2 border-l-error shadow-glow-error",children:[(0,t.jsx)(M.AlertCircle,{className:"h-3.5 w-3.5 text-error shrink-0"}),(0,t.jsxs)("span",{className:"text-xs text-error truncate",children:["Failed at: ",g.length>80?g.slice(0,80)+"...":g]})]}),m&&h&&(0,t.jsx)("div",{className:"mt-2 px-3 py-2 rounded-md bg-warning-muted border border-warning/25 border-l-2 border-l-warning shadow-breakpoint-glow",children:(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)(c.Hand,{className:"h-4 w-4 text-warning shrink-0 mt-0.5 animate-pulse-dot"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("span",{className:"text-xs font-bold text-warning uppercase tracking-wider block mb-0.5",children:"Awaiting approval"}),(0,t.jsx)("span",{className:"text-sm text-foreground leading-snug block",children:h})]}),(0,t.jsxs)("span",{className:(0,d.cn)("shrink-0 inline-flex items-center gap-1 px-2 py-1 rounded-md","bg-warning/10 border border-warning/20","text-xs font-semibold text-warning","hover:bg-warning/20 transition-colors"),children:["Review & Approve",(0,t.jsx)(X.ExternalLink,{className:"h-2.5 w-2.5"})]})]})}),m&&!h&&(0,t.jsxs)("div",{className:"flex items-center gap-2 mt-2 px-3 py-2 rounded-md bg-warning-muted border border-warning/25 border-l-2 border-l-warning shadow-breakpoint-glow",children:[(0,t.jsx)(c.Hand,{className:"h-4 w-4 text-warning shrink-0 animate-pulse-dot"}),(0,t.jsx)("span",{className:"text-xs font-semibold text-warning",children:"Approval needed"}),(0,t.jsxs)("span",{className:(0,d.cn)("ml-auto shrink-0 inline-flex items-center gap-1 px-2 py-1 rounded-md","bg-warning/10 border border-warning/20","text-xs font-semibold text-warning"),children:["Review & Approve",(0,t.jsx)(X.ExternalLink,{className:"h-2.5 w-2.5"})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3 mt-2 text-xs text-foreground-muted",children:[(0,t.jsx)(U.SessionPill,{sessionId:e.sessionId,active:i&&!l}),(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)(S.Layers,{className:"h-3 w-3"}),e.completedTasks,"/",e.totalTasks," tasks"]}),(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)(O.Clock,{className:"h-3 w-3"}),(0,J.formatDuration)(e.duration)]})]})]})}),e.totalTasks>0&&(0,t.jsx)(V.ProgressBar,{value:a,variant:function(e){switch(e){case"completed":return"success";case"failed":return"error";case"waiting":return"warning";default:return"default"}}(e.status),glow:i&&!l,className:"mt-4"})]})})},function(e,t){if(e.selected!==t.selected)return!1;let s=e.run,r=t.run;return s.runId===r.runId&&s.status===r.status&&s.updatedAt===r.updatedAt&&s.completedTasks===r.completedTasks&&s.totalTasks===r.totalTasks&&s.duration===r.duration&&s.isStale===r.isStale&&s.waitingKind===r.waitingKind&&s.breakpointQuestion===r.breakpointQuestion&&s.failedStep===r.failedStep&&s.failureMessage===r.failureMessage});var G=e.i(174080);function Z(e,t,s){let r,n=s.initialDeps??[],a=!0;function i(){var i,l,o;let d,c;s.key&&(null==(i=s.debug)?void 0:i.call(s))&&(d=Date.now());let u=e();if(!(u.length!==n.length||u.some((e,t)=>n[t]!==e)))return r;if(n=u,s.key&&(null==(l=s.debug)?void 0:l.call(s))&&(c=Date.now()),r=t(...u),s.key&&(null==(o=s.debug)?void 0:o.call(s))){let e=Math.round((Date.now()-d)*100)/100,t=Math.round((Date.now()-c)*100)/100,r=t/16,n=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${n(t,5)} /${n(e,5)} ms`,`
|
|
2
2
|
font-size: .6rem;
|
|
3
3
|
font-weight: bold;
|
|
4
4
|
color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,null==s?void 0:s.key)}return(null==s?void 0:s.onChange)&&!(a&&s.skipInitialOnChange)&&s.onChange(r),a=!1,r}return i.updateDeps=e=>{n=e},i}function ee(e,t){if(void 0!==e)return e;throw Error(`Unexpected undefined${t?`: ${t}`:""}`)}e.i(247167);let et=e=>{let{offsetWidth:t,offsetHeight:s}=e;return{width:t,height:s}},es=e=>e,er=e=>{let t=Math.max(e.startIndex-e.overscan,0),s=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let e=t;e<=s;e++)r.push(e);return r},en=(e,t)=>{let s=e.scrollElement;if(!s)return;let r=e.targetWindow;if(!r)return;let n=e=>{let{width:s,height:r}=e;t({width:Math.round(s),height:Math.round(r)})};if(n(et(s)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(null==e?void 0:e.borderBoxSize){let t=e.borderBoxSize[0];if(t)return void n({width:t.inlineSize,height:t.blockSize})}n(et(s))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(s,{box:"border-box"}),()=>{a.unobserve(s)}},ea={passive:!0},ei="u"<typeof window||"onscrollend"in window,el=(e,t)=>{var s,r;let n,a=e.scrollElement;if(!a)return;let i=e.targetWindow;if(!i)return;let l=0,o=e.options.useScrollendEvent&&ei?()=>void 0:(s=()=>{t(l,!1)},r=e.options.isScrollingResetDelay,function(...e){i.clearTimeout(n),n=i.setTimeout(()=>s.apply(this,e),r)}),d=s=>()=>{let{horizontal:r,isRtl:n}=e.options;l=r?a.scrollLeft*(n&&-1||1):a.scrollTop,o(),t(l,s)},c=d(!0),u=d(!1);a.addEventListener("scroll",c,ea);let h=e.options.useScrollendEvent&&ei;return h&&a.addEventListener("scrollend",u,ea),()=>{a.removeEventListener("scroll",c),h&&a.removeEventListener("scrollend",u)}},eo=(e,t,s)=>{if(null==t?void 0:t.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[s.options.horizontal?"inlineSize":"blockSize"])}return e[s.options.horizontal?"offsetWidth":"offsetHeight"]},ed=(e,{adjustments:t=0,behavior:s},r)=>{var n,a;null==(a=null==(n=r.scrollElement)?void 0:n.scrollTo)||a.call(n,{[r.options.horizontal?"left":"top"]:e+t,behavior:s})};class ec{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var e,t,s;return(null==(s=null==(t=null==(e=this.targetWindow)?void 0:e.performance)?void 0:t.now)?void 0:s.call(t))??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(this.targetWindow&&this.targetWindow.ResizeObserver?e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,s=this.indexFromElement(t);t.isConnected?this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(t,e,this)):this.observer.unobserve(t)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}):null);return{disconnect:()=>{var s;null==(s=t())||s.disconnect(),e=null},observe:e=>{var s;return null==(s=t())?void 0:s.observe(e,{box:"border-box"})},unobserve:e=>{var s;return null==(s=t())?void 0:s.unobserve(e)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([t,s])=>{void 0===s&&delete e[t]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:es,rangeExtractor:er,onChange:()=>{},measureElement:eo,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...e}},this.notify=e=>{var t,s;null==(s=(t=this.options).onChange)||s.call(t,this,e)},this.maybeNotify=Z(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),null!=this.rafId&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;let t=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==t){if(this.cleanup(),!t)return void this.maybeNotify();this.scrollElement=t,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=(null==(e=this.scrollElement)?void 0:e.window)??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?"forward":"backward":null,this.scrollOffset=e,this.isScrolling=t,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??("function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,t)=>{let s=new Map,r=new Map;for(let n=t-1;n>=0;n--){let t=e[n];if(s.has(t.lane))continue;let a=r.get(t.lane);if(null==a||t.end>a.end?r.set(t.lane,t):t.end<a.end&&s.set(t.lane,!0),s.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end)[0]:void 0},this.getMeasurementOptions=Z(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(e,t,s,r,n,a,i)=>(void 0!==this.prevLanes&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:s,getItemKey:r,enabled:n,lanes:a,laneAssignmentMode:i}),{key:!1}),this.getMeasurements=Z(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:t,scrollMargin:s,getItemKey:r,enabled:n,lanes:a,laneAssignmentMode:i},l)=>{if(!n)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),0!==this.measurementsCache.length||this.lanesSettling||(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let o=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);let d=this.measurementsCache.slice(0,o),c=Array(a).fill(void 0);for(let e=0;e<o;e++){let t=d[e];t&&(c[t.lane]=e)}for(let n=o;n<e;n++){let e,a,o=r(n),u=this.laneAssignments.get(n),h="estimate"===i||l.has(o);if(void 0!==u&&this.options.lanes>1){let r=c[e=u],n=void 0!==r?d[r]:void 0;a=n?n.end+this.options.gap:t+s}else{let r=1===this.options.lanes?d[n-1]:this.getFurthestMeasurement(d,n);a=r?r.end+this.options.gap:t+s,e=r?r.lane:n%this.options.lanes,this.options.lanes>1&&h&&this.laneAssignments.set(n,e)}let m=l.get(o),g="number"==typeof m?m:this.options.estimateSize(n),x=a+g;d[n]={index:n,start:a,size:g,end:x,key:o,lane:e},c[e]=n}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Z(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,s,r)=>this.range=e.length>0&&t>0?function({measurements:e,outerSize:t,scrollOffset:s,lanes:r}){let n=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:n};let a=eu(0,n,t=>e[t].start,s),i=a;if(1===r)for(;i<n&&e[i].end<s+t;)i++;else if(r>1){let l=Array(r).fill(0);for(;i<n&&l.some(e=>e<s+t);){let t=e[i];l[t.lane]=t.end,i++}let o=Array(r).fill(s+t);for(;a>=0&&o.some(e=>e>=s);){let t=e[a];o[t.lane]=t.start,a--}a=Math.max(0,a-a%r),i=Math.min(n,i+(r-1-i%r))}return{startIndex:a,endIndex:i}}({measurements:e,outerSize:t,scrollOffset:s,lanes:r}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Z(()=>{let e=null,t=null,s=this.calculateRange();return s&&(e=s.startIndex,t=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,s,r,n)=>null===r||null===n?[]:e({startIndex:r,endIndex:n,overscan:t,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,s=e.getAttribute(t);return s?parseInt(s,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{var t;if(!this.scrollState||"smooth"!==this.scrollState.behavior)return!0;let s=this.scrollState.index??(null==(t=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))?void 0:t.index);if(void 0!==s&&this.range){let t=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,s-t),n=Math.min(this.options.count-1,s+t);return e>=r&&e<=n}return!0},this.measureElement=e=>{if(!e)return void this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});let t=this.indexFromElement(e),s=this.options.getItemKey(t),r=this.elementsCache.get(s);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(s,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{var s;let r=this.measurementsCache[e];if(!r)return;let n=t-(this.itemSizeCache.get(r.key)??r.size);0!==n&&((null==(s=this.scrollState)?void 0:s.behavior)!=="smooth"&&(void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(r,n,this):r.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=n,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(r.index),this.itemSizeCache=new Map(this.itemSizeCache.set(r.key,t)),this.notify(!1))},this.getVirtualItems=Z(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let s=[];for(let r=0,n=e.length;r<n;r++){let n=t[e[r]];s.push(n)}return s},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(0!==t.length)return ee(t[eu(0,t.length-1,e=>ee(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,t,s=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),n=this.getScrollOffset();return"auto"===t&&(t=e>=n+r?"end":"start"),"center"===t?e+=(s-r)/2:"end"===t&&(e-=r),Math.max(Math.min(this.getMaxScrollOffset(),e),0)},this.getOffsetForIndex=(e,t="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));let s=this.getSize(),r=this.getScrollOffset(),n=this.measurementsCache[e];if(!n)return;if("auto"===t)if(n.end>=r+s-this.options.scrollPaddingEnd)t="end";else{if(!(n.start<=r+this.options.scrollPaddingStart))return[r,t];t="start"}if("end"===t&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a="end"===t?n.end+this.options.scrollPaddingEnd:n.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,n.size),t]},this.scrollToOffset=(e,{align:t="start",behavior:s="auto"}={})=>{let r=this.getOffsetForAlignment(e,t),n=this.now();this.scrollState={index:null,align:t,behavior:s,startedAt:n,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t="auto",behavior:s="auto"}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[n,a]=r,i=this.now();this.scrollState={index:e,align:a,behavior:s,startedAt:i,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t="auto"}={})=>{let s=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:"start",behavior:t,startedAt:r,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var e;let t,s=this.getMeasurements();if(0===s.length)t=this.options.paddingStart;else if(1===this.options.lanes)t=(null==(e=s[s.length-1])?void 0:e.end)??0;else{let e=Array(this.options.lanes).fill(null),r=s.length-1;for(;r>=0&&e.some(e=>null===e);){let t=s[r];null===e[t.lane]&&(e[t.lane]=t.end),r--}t=Math.max(...e.filter(e=>null!==e))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:t,behavior:s})=>{this.options.scrollToFn(e,{behavior:s,adjustments:t},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}null==this.rafId&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=null!=this.scrollState.index?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,t=e?e[0]:this.scrollState.lastTargetOffset,s=t!==this.scrollState.lastTargetOffset;if(!s&&1.01>Math.abs(t-this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.scrollState=null;return}}else this.scrollState.stableFrames=0,s&&(this.scrollState.lastTargetOffset=t,this.scrollState.behavior="auto",this._scrollToOffset(t,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}let eu=(e,t,s,r)=>{for(;e<=t;){let n=(e+t)/2|0,a=s(n);if(a<r)e=n+1;else{if(!(a>r))return n;t=n-1}}return e>0?e-1:0},eh="u">typeof document?s.useLayoutEffect:s.useEffect;function em({runs:e,className:r,maxHeight:n=600,renderItem:a}){let i=(0,s.useRef)(null),l=(0,s.useMemo)(()=>e,[e]),o=(0,s.useCallback)(e=>l[e]?.runId??e,[l]),d=function({useFlushSync:e=!0,...t}){let r=s.useReducer(()=>({}),{})[1],n={...t,onChange:(s,n)=>{var a;e&&n?(0,G.flushSync)(r):r(),null==(a=t.onChange)||a.call(t,s,n)}},[a]=s.useState(()=>new ec(n));return a.setOptions(n),eh(()=>a._didMount(),[]),eh(()=>a._willUpdate()),a}({observeElementRect:en,observeElementOffset:el,scrollToFn:ed,...{count:l.length,getScrollElement:()=>i.current,estimateSize:()=>140,overscan:3,getItemKey:o}});if(l.length<15)return(0,t.jsx)("div",{className:r,"data-testid":"run-list-flat",children:(0,t.jsx)("div",{className:"flex flex-col gap-2",children:l.map((e,s)=>a?(0,t.jsx)("div",{children:a(e,s)},e.runId):(0,t.jsx)(Y,{run:e},e.runId))})});let c=d.getVirtualItems();return(0,t.jsx)("div",{ref:i,className:r,"data-testid":"run-list-virtualized",style:{maxHeight:n,overflow:"auto",contain:"strict"},children:(0,t.jsx)("div",{style:{height:`${d.getTotalSize()}px`,width:"100%",position:"relative"},children:c.map(e=>{let s=l[e.index];return s?(0,t.jsx)("div",{"data-index":e.index,ref:d.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${e.start}px)`},children:(0,t.jsx)("div",{style:{paddingBottom:8},children:a?a(s,e.index):(0,t.jsx)(Y,{run:s})})},e.key):null})})})}let eg=(0,w.default)("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);var ex=e.i(908080);function ep({currentPage:e,totalItems:s,itemsPerPage:r,onPageChange:n,className:a}){let i=Math.ceil(s/r),l=Math.min((e+1)*r,s),o=e>0,c=e<i-1;if(0===s)return null;let u=[];if(i<=5)for(let e=0;e<i;e++)u.push(e);else{u.push(0),e>2&&u.push("ellipsis");for(let t=Math.max(1,e-1);t<=Math.min(i-2,e+1);t++)u.push(t);e<i-3&&u.push("ellipsis"),u.push(i-1)}return(0,t.jsxs)("div",{className:(0,d.cn)("flex items-center justify-between border-t border-border pt-3",a),children:[(0,t.jsxs)("span",{className:"text-xs text-foreground-muted tabular-nums",children:[e*r+1,"–",l," of ",s]}),(0,t.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,t.jsx)("button",{onClick:()=>n(e-1),disabled:!o,className:(0,d.cn)("inline-flex h-11 w-11 items-center justify-center rounded-md text-xs transition-all",o?"text-foreground hover:bg-primary-muted hover:text-primary hover:shadow-neon-glow-primary-xs cursor-pointer":"text-foreground-muted cursor-not-allowed opacity-40"),"aria-label":"Previous page",children:(0,t.jsx)(eg,{className:"h-4 w-4"})}),u.map((s,r)=>"ellipsis"===s?(0,t.jsx)("span",{className:"inline-flex h-11 w-5 items-center justify-center text-xs text-foreground-muted",children:"..."},`ellipsis-${r}`):(0,t.jsx)("button",{onClick:()=>n(s),className:(0,d.cn)("inline-flex h-11 min-w-[44px] items-center justify-center rounded-md px-1.5 text-xs font-medium tabular-nums transition-all",s===e?"text-primary bg-primary/10":"text-foreground-muted hover:bg-background-secondary hover:text-foreground-secondary cursor-pointer"),children:s+1},s)),(0,t.jsx)("button",{onClick:()=>n(e+1),disabled:!c,className:(0,d.cn)("inline-flex h-11 w-11 items-center justify-center rounded-md text-xs transition-all",c?"text-foreground hover:bg-primary-muted hover:text-primary hover:shadow-neon-glow-primary-xs cursor-pointer":"text-foreground-muted cursor-not-allowed opacity-40"),"aria-label":"Next page",children:(0,t.jsx)(ex.ChevronRight,{className:"h-4 w-4"})})]})]})}var ef=e.i(595833),eb=e.i(781225),ev=e.i(23406);let ew={healthy:{dotClass:"bg-success shadow-[0_0_6px_var(--success)]",borderClass:"border-success/20 hover:border-success/40",icon:h.CheckCircle2,label:"Healthy",barColor:"bg-success"},active:{dotClass:"bg-warning shadow-[0_0_6px_var(--warning)] animate-pulse-dot",borderClass:"border-warning/20 hover:border-warning/40",icon:R,label:"Active",barColor:"bg-warning"},stale:{dotClass:"bg-zinc-500",borderClass:"border-zinc-500/20 hover:border-zinc-500/40",icon:I.Pause,label:"Stale",barColor:"bg-zinc-500"},failing:{dotClass:"bg-error shadow-[0_0_6px_var(--error)]",borderClass:"border-error/20 hover:border-error/40",icon:M.AlertCircle,label:"Failing",barColor:"bg-error"}};function ej({project:e,statusFilter:n,sortMode:a="status",onHide:i}){let o,u,m,g,x,p,[f,b]=(0,s.useState)(!1),v=(0,s.useCallback)(async t=>{t.stopPropagation(),b(!0);let s=await (0,ef.resilientFetch)("/api/config");if(!s.ok)return void b(!1);let r=s.data.hiddenProjects??[];if(r.includes(e.projectName)){b(!1),i?.(e.projectName);return}let n=[...r,e.projectName],a=await (0,ef.resilientFetch)("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sources:s.data.sources,pollInterval:s.data.pollInterval,theme:s.data.theme,retentionDays:s.data.retentionDays,hiddenProjects:n})});b(!1),a.ok&&i?.(e.projectName)},[e.projectName,i]),[w,j]=l(`observer:project-expanded:${e.projectName}`,!1),[y,N]=(0,s.useState)(0),[k,C]=(0,s.useState)(!1),[E,A]=(0,s.useState)(!1),[z,T]=(0,s.useState)("all"),F=ew[e.failedRuns>0?"failing":e.activeRuns>0?"active":e.staleRuns>0?"stale":"healthy"],P=F.icon,D=e.totalTasks>0?Math.round(e.completedTasksAggregate/e.totalTasks*100):0,$="all"!==z?z:n,{runs:H,totalCount:K,loading:U}=function(e,t={}){let{limit:s=10,offset:n=0,search:a="",status:i="",sort:l="status",enabled:o=!0}=t,d=new URLSearchParams;d.set("project",e),d.set("limit",String(s)),d.set("offset",String(n)),a&&d.set("search",a),i&&d.set("status",i),l&&"status"!==l&&d.set("sort",l);let c=`/api/runs?${d.toString()}`,{data:u,loading:h,error:m,refresh:g}=(0,r.useSmartPolling)(c,{interval:5e3,sseFilter:()=>!0,enabled:o});return{runs:o&&u?u.runs:[],totalCount:o&&u?u.totalCount:0,loading:h,error:m,refresh:g}}(e.projectName,{limit:5,offset:5*y,status:"all"===$?"":$,sort:a,enabled:w}),q=e=>{T(t=>t===e?"all":e),N(0)};return(0,t.jsxs)(W,{"data-testid":`project-card-${e.projectName}`,className:(0,d.cn)("transition-all duration-200 overflow-hidden card-hover-lift",F.borderClass,w&&"ring-1 ring-primary/20"),children:[(0,t.jsxs)("button",{onClick:()=>j(e=>!e),className:"w-full text-left p-4 hover:bg-background-secondary/30 transition-colors",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 truncate flex-1",children:[(0,t.jsx)("h3",{className:"text-lg font-semibold text-foreground truncate",children:e.projectName}),e.pendingBreakpoints>0&&(0,t.jsxs)("span",{className:(0,d.cn)("inline-flex items-center gap-1 rounded-full px-2 py-0.5 shrink-0","bg-warning/15 border border-warning/30","text-xs leading-tight font-bold text-warning","animate-pulse-dot"),children:[(0,t.jsx)(c.Hand,{className:"h-2.5 w-2.5"}),e.pendingBreakpoints," Pending"]})]}),(0,t.jsxs)("div",{className:"flex items-center shrink-0 ml-2 gap-1",children:[(0,t.jsx)("span",{role:"button",tabIndex:0,onClick:v,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),v(e))},className:(0,d.cn)("rounded-md p-2 min-h-[44px] min-w-[44px] inline-flex items-center justify-center transition-colors",f?"text-foreground-muted cursor-wait":"text-foreground-muted/40 hover:text-foreground-muted hover:bg-background-secondary"),title:"Hide project from dashboard",children:f?(0,t.jsx)(ev.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(eb.EyeOff,{className:"h-3.5 w-3.5"})}),w?(0,t.jsx)(_.ChevronUp,{className:"h-4 w-4 text-foreground-muted"}):(0,t.jsx)(L.ChevronDown,{className:"h-4 w-4 text-foreground-muted"})]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 text-xs text-foreground-muted",children:[(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,t.jsx)("span",{className:(0,d.cn)("h-2.5 w-2.5 rounded-full shrink-0",F.dotClass)}),(0,t.jsx)(P,{className:"h-3 w-3"}),F.label]}),(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)(S.Layers,{className:"h-3 w-3"}),e.totalRuns]}),(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)(O.Clock,{className:"h-3 w-3"}),(0,J.formatRelativeTime)(e.latestUpdate)]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.activeRuns>0&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-0.5 rounded-full bg-warning/10 border border-warning/20 px-1.5 py-0.5 text-xs leading-tight font-medium text-warning tabular-nums",title:`${e.activeRuns} active`,children:[(0,t.jsx)(R,{className:"h-3 w-3"}),e.activeRuns]}),e.staleRuns>0&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-0.5 rounded-full bg-zinc-500/10 border border-zinc-500/20 px-1.5 py-0.5 text-xs leading-tight font-medium text-zinc-500 tabular-nums",title:`${e.staleRuns} stale`,children:[(0,t.jsx)(I.Pause,{className:"h-3 w-3"}),e.staleRuns]}),e.completedRuns>0&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-0.5 rounded-full bg-success/10 border border-success/20 px-1.5 py-0.5 text-xs leading-tight font-medium text-success tabular-nums",title:`${e.completedRuns} completed`,children:[(0,t.jsx)(h.CheckCircle2,{className:"h-3 w-3"}),e.completedRuns]}),e.failedRuns>0&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-0.5 rounded-full bg-error/10 border border-error/20 px-1.5 py-0.5 text-xs leading-tight font-medium text-error tabular-nums",title:`${e.failedRuns} failed`,children:[(0,t.jsx)(M.AlertCircle,{className:"h-3 w-3"}),e.failedRuns]})]})]}),e.totalTasks>0&&(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,t.jsxs)("span",{className:"text-xs leading-tight text-foreground-muted",children:[e.completedTasksAggregate,"/",e.totalTasks," tasks"]}),(0,t.jsxs)("span",{className:"text-xs leading-tight text-foreground-muted tabular-nums",children:[D,"%"]})]}),(0,t.jsx)("div",{className:"h-1.5 w-full rounded-full bg-background-secondary overflow-hidden",children:(0,t.jsx)("div",{className:(0,d.cn)("h-full rounded-full transition-all duration-500",F.barColor),style:{width:`${D}%`}})})]})]}),w&&(o=H.filter(e=>"waiting"===e.status||"pending"===e.status||e.isStale),u=H.filter(e=>"completed"===e.status&&!e.isStale),m=H.filter(e=>"failed"===e.status&&!e.isStale),g=o.length>0,x=u.length>0,p=m.length>0,(0,t.jsxs)("div",{className:"border-t border-border px-4 pb-4 pt-3",children:[U&&0===H.length?(0,t.jsx)("div",{className:"flex flex-col gap-2",children:[1,2].map(e=>(0,t.jsxs)("div",{className:"rounded-lg border border-border bg-background p-3 animate-pulse",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)("div",{className:"h-2 w-2 rounded-full bg-foreground-muted/20"}),(0,t.jsx)("div",{className:"h-3 w-32 rounded bg-foreground-muted/10"})]}),(0,t.jsx)("div",{className:"h-2 w-full rounded bg-foreground-muted/10"})]},e))}):0===H.length?(0,t.jsx)("p",{className:"text-xs text-foreground-muted text-center py-4",children:"No matching runs"}):"activity"===a?(0,t.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,t.jsxs)("div",{className:(0,d.cn)("grid gap-2 mb-3",e.staleRuns>0?"grid-cols-4":"grid-cols-3"),children:[(0,t.jsx)(ey,{icon:(0,t.jsx)(R,{className:"h-3.5 w-3.5"}),count:e.activeRuns,label:"Active",colorClass:"text-warning",bgClass:"bg-warning/10",pulse:e.activeRuns>0,active:"waiting"===z,onClick:e=>{e.stopPropagation(),q("waiting")}}),e.staleRuns>0&&(0,t.jsx)(ey,{icon:(0,t.jsx)(I.Pause,{className:"h-3.5 w-3.5"}),count:e.staleRuns,label:"Stale",colorClass:"text-zinc-500",bgClass:"bg-zinc-500/10",active:"waiting"===z,onClick:e=>{e.stopPropagation(),q("waiting")}}),(0,t.jsx)(ey,{icon:(0,t.jsx)(h.CheckCircle2,{className:"h-3.5 w-3.5"}),count:e.completedRuns,label:"Completed",colorClass:"text-success",bgClass:"bg-success/10",active:"completed"===z,onClick:e=>{e.stopPropagation(),q("completed")}}),(0,t.jsx)(ey,{icon:(0,t.jsx)(M.AlertCircle,{className:"h-3.5 w-3.5"}),count:e.failedRuns,label:"Failed",colorClass:"text-error",bgClass:"bg-error/10",active:"failed"===z,onClick:e=>{e.stopPropagation(),q("failed")}})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,t.jsx)(O.Clock,{className:"h-3.5 w-3.5 text-primary"}),(0,t.jsx)("span",{className:"text-xs font-semibold text-foreground",children:"Timeline"}),(0,t.jsx)("span",{className:"rounded-full bg-primary/10 border border-primary/20 px-2 py-px text-xs font-semibold text-primary tabular-nums",children:H.length})]}),(0,t.jsx)(em,{runs:H,maxHeight:500,renderItem:e=>(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(Y,{run:e}),(0,t.jsxs)("span",{className:"absolute top-2 right-2 inline-flex items-center gap-1 rounded-full bg-background/80 backdrop-blur-sm border border-border px-2 py-0.5 text-xs text-foreground-muted tabular-nums pointer-events-none z-10",children:[(0,t.jsx)(O.Clock,{className:"h-2.5 w-2.5"}),(0,J.formatRelativeTime)(e.updatedAt)]})]})})]}):(0,t.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,t.jsxs)("div",{className:(0,d.cn)("grid gap-2 mb-3",e.staleRuns>0?"grid-cols-4":"grid-cols-3"),children:[(0,t.jsx)(ey,{icon:(0,t.jsx)(R,{className:"h-3.5 w-3.5"}),count:e.activeRuns,label:"Active",colorClass:"text-warning",bgClass:"bg-warning/10",pulse:e.activeRuns>0,active:"waiting"===z,onClick:e=>{e.stopPropagation(),q("waiting")}}),e.staleRuns>0&&(0,t.jsx)(ey,{icon:(0,t.jsx)(I.Pause,{className:"h-3.5 w-3.5"}),count:e.staleRuns,label:"Stale",colorClass:"text-zinc-500",bgClass:"bg-zinc-500/10",active:"waiting"===z,onClick:e=>{e.stopPropagation(),q("waiting")}}),(0,t.jsx)(ey,{icon:(0,t.jsx)(h.CheckCircle2,{className:"h-3.5 w-3.5"}),count:e.completedRuns,label:"Completed",colorClass:"text-success",bgClass:"bg-success/10",active:"completed"===z,onClick:e=>{e.stopPropagation(),q("completed")}}),(0,t.jsx)(ey,{icon:(0,t.jsx)(M.AlertCircle,{className:"h-3.5 w-3.5"}),count:e.failedRuns,label:"Failed",colorClass:"text-error",bgClass:"bg-error/10",active:"failed"===z,onClick:e=>{e.stopPropagation(),q("failed")}})]}),g&&(0,t.jsxs)("div",{className:"mb-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)(R,{className:"h-3.5 w-3.5 text-warning animate-pulse-dot"}),(0,t.jsx)("span",{className:"text-xs font-semibold text-foreground",children:"In Progress"}),(0,t.jsx)("span",{className:"rounded-full bg-warning/10 border border-warning/20 px-2 py-px text-xs font-semibold text-warning tabular-nums",children:o.length})]}),(0,t.jsx)(em,{runs:o,maxHeight:500})]}),p&&(0,t.jsxs)("div",{children:[(0,t.jsxs)("button",{onClick:e=>{e.stopPropagation(),A(e=>!e)},className:"flex items-center gap-2 py-1.5 text-xs group w-fit",children:[(0,t.jsx)(M.AlertCircle,{className:"h-3.5 w-3.5 text-error/70"}),(0,t.jsx)("span",{className:"font-semibold text-error/80 group-hover:text-error transition-colors",children:"Failed Runs"}),(0,t.jsx)("span",{className:"rounded-full bg-error/10 border border-error/20 px-2 py-px text-xs font-semibold text-error tabular-nums",children:m.length}),E?(0,t.jsx)(_.ChevronUp,{className:"h-3 w-3 text-error/40 group-hover:text-error/60"}):(0,t.jsx)(L.ChevronDown,{className:"h-3 w-3 text-error/40 group-hover:text-error/60"})]}),E&&(0,t.jsx)("div",{className:"mt-1 opacity-70",children:(0,t.jsx)(em,{runs:m,maxHeight:400})})]}),x&&(0,t.jsxs)("div",{children:[(0,t.jsxs)("button",{onClick:e=>{e.stopPropagation(),C(e=>!e)},className:"flex items-center gap-2 py-1.5 text-xs group w-fit",children:[(0,t.jsx)(B,{className:"h-3.5 w-3.5 text-foreground-muted/70"}),(0,t.jsx)("span",{className:"font-semibold text-foreground-muted group-hover:text-foreground-secondary transition-colors",children:"Completed History"}),(0,t.jsx)("span",{className:"rounded-full bg-background-secondary border border-border px-2 py-px text-xs font-semibold text-foreground-muted tabular-nums",children:u.length}),k?(0,t.jsx)(_.ChevronUp,{className:"h-3 w-3 text-foreground-muted/60 group-hover:text-foreground-muted"}):(0,t.jsx)(L.ChevronDown,{className:"h-3 w-3 text-foreground-muted/60 group-hover:text-foreground-muted"})]}),k&&(0,t.jsx)("div",{className:"mt-1 opacity-60",children:(0,t.jsx)(em,{runs:u,maxHeight:400})})]})]}),K>5&&(0,t.jsx)(ep,{currentPage:y,totalItems:K,itemsPerPage:5,onPageChange:N,className:"mt-3"})]}))]})}function ey({icon:e,count:s,label:r,colorClass:n,bgClass:a,pulse:i,active:l,onClick:o}){let c=!!o;return(0,t.jsxs)("div",{role:c?"button":void 0,tabIndex:c?0:void 0,onClick:o,onKeyDown:c?e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),o?.(e))}:void 0,className:(0,d.cn)("rounded-md px-2.5 py-1.5 flex items-center gap-2 transition-all",a,c&&"cursor-pointer hover:opacity-80",l&&"ring-2 ring-offset-1 ring-offset-card",l&&n.replace("text-","ring-").replace(/\/\d+$/,"/50")),children:[(0,t.jsx)("span",{className:(0,d.cn)(n,i&&"animate-pulse"),children:e}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:(0,d.cn)("text-sm font-bold tabular-nums leading-none",n),children:s}),(0,t.jsx)("p",{className:"text-xs leading-tight text-foreground-muted uppercase tracking-wider",children:r})]})]})}function eN(){return(0,t.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 items-start",children:[1,2,3].map(e=>(0,t.jsxs)("div",{className:"rounded-lg border border-border bg-card p-4 animate-pulse",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,t.jsx)("div",{className:"h-2.5 w-2.5 rounded-full bg-foreground-muted/20"}),(0,t.jsx)("div",{className:"h-4 w-32 rounded bg-foreground-muted/10"})]}),(0,t.jsx)("div",{className:"h-1.5 w-full rounded-full bg-foreground-muted/10 mb-3"}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"h-5 w-16 rounded-full bg-foreground-muted/10"}),(0,t.jsx)("div",{className:"h-5 w-16 rounded-full bg-foreground-muted/10"}),(0,t.jsx)("div",{className:"h-3 w-12 rounded bg-foreground-muted/10"})]})]},e))})}function ek({error:e}){return(0,t.jsxs)("div",{"data-testid":"error-banner",className:"rounded-lg border border-error/20 bg-error-muted p-4 text-sm text-error",children:["Failed to load projects: ",e]})}function eC(){return(0,t.jsxs)("div",{"data-testid":"empty-state",className:"text-center py-16",children:[(0,t.jsx)(D.FolderOpen,{className:"h-10 w-10 text-foreground-muted/30 mx-auto mb-3"}),(0,t.jsx)("p",{className:"text-sm text-foreground-muted mb-1",children:"No projects found"}),(0,t.jsxs)("p",{className:"text-xs text-foreground-muted/60",children:["Configure watch sources in"," ",(0,t.jsx)("button",{onClick:()=>window.dispatchEvent(new CustomEvent("open-settings")),className:"text-primary hover:underline",children:"Settings"})," ","or edit ",(0,t.jsx)("span",{className:"font-mono",children:"~/.a5c/observer.json"})]})]})}function eS(){return(0,t.jsxs)("div",{"data-testid":"idle-empty-state",className:"text-center py-16",children:[(0,t.jsx)($.Eye,{className:"h-10 w-10 text-foreground-muted/30 mx-auto mb-3"}),(0,t.jsx)("p",{className:"text-sm text-foreground-muted mb-1",children:"All quiet — no active orchestration runs"}),(0,t.jsx)("p",{className:"text-xs text-foreground-muted/60",children:"Runs will appear here when babysitter processes are started"})]})}function eR({loading:e,error:s,filteredProjects:r,activeProjects:n,historyProjects:a,statusFilter:i,sortMode:l,cardStatusFilter:o,historyCollapsed:c,onHistoryCollapsedChange:u,onHideProject:h}){return e?(0,t.jsx)(eN,{}):s?(0,t.jsx)(ek,{error:s}):0===r.length?(0,t.jsx)(eC,{}):(0,t.jsxs)("div",{className:"flex flex-col gap-8",children:[0===n.length&&0===a.length&&(0,t.jsx)(eS,{}),0===n.length&&a.length>0&&("all"===i||"stale"===i)&&(0,t.jsxs)("div",{"data-testid":"idle-with-history-banner",className:"flex items-center gap-2 px-3 py-2 rounded-md bg-background-secondary/50 border border-border w-fit",children:[(0,t.jsx)(R,{className:"h-3.5 w-3.5 text-foreground-muted/50"}),(0,t.jsx)("span",{className:"text-xs text-foreground-muted",children:"activity"===l?"No activity in the last 24 hours":"No runs in progress"})]}),n.length>0&&("all"===i||"stale"===i||"waiting"===i)&&(0,t.jsx)(H.ErrorBoundary,{section:"Active Runs",children:(0,t.jsxs)("section",{"data-testid":"active-runs-section",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:["activity"===l?(0,t.jsx)(O.Clock,{className:"h-4 w-4 text-primary"}):(0,t.jsx)(R,{className:"h-4 w-4 text-warning animate-pulse-dot"}),(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:"activity"===l?"Recent Activity":"In Progress"}),(0,t.jsx)("span",{className:(0,d.cn)("rounded-full px-2 py-px text-xs font-semibold tabular-nums","activity"===l?"bg-primary/10 border border-primary/20 text-primary":"bg-warning/10 border border-warning/20 text-warning"),children:n.length})]}),(0,t.jsx)("div",{"data-testid":"project-grid-active",className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 items-start",children:n.map(e=>(0,t.jsx)(ej,{project:e,statusFilter:o,sortMode:l,onHide:h},e.projectName))})]})}),("completed"===i||"failed"===i)&&(0,t.jsx)(H.ErrorBoundary,{section:"Filtered Results",children:(0,t.jsx)("div",{"data-testid":"project-grid-filtered",className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 items-start",children:r.map(e=>(0,t.jsx)(ej,{project:e,statusFilter:o,sortMode:l},e.projectName))})}),a.length>0&&("all"===i||"stale"===i)&&(0,t.jsx)(H.ErrorBoundary,{section:"Recent History",children:(0,t.jsxs)("section",{"data-testid":"recent-history-section",children:[(0,t.jsxs)("button",{onClick:()=>u(e=>!e),className:"flex items-center gap-2 mb-3 group w-fit",children:[(0,t.jsx)(B,{className:"h-4 w-4 text-foreground-muted/70"}),(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground-muted group-hover:text-foreground-secondary transition-colors",children:"activity"===l?"Earlier":"Recent History"}),(0,t.jsx)("span",{className:"rounded-full bg-background-secondary border border-border px-2 py-px text-xs font-semibold text-foreground-muted tabular-nums",children:a.length}),c?(0,t.jsx)(L.ChevronDown,{className:"h-3.5 w-3.5 text-foreground-muted/60 group-hover:text-foreground-muted transition-colors"}):(0,t.jsx)(_.ChevronUp,{className:"h-3.5 w-3.5 text-foreground-muted/60 group-hover:text-foreground-muted transition-colors"})]}),!c&&(0,t.jsx)("div",{className:"opacity-70",children:(0,t.jsx)("div",{"data-testid":"project-grid-history",className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 items-start",children:a.map(e=>(0,t.jsx)(ej,{project:e,statusFilter:o,sortMode:l},e.projectName))})})]})})]})}var eM=e.i(618566);let eI=(0,w.default)("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),eE=(0,w.default)("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);function eA(){let e=(0,eM.useRouter)(),[r,n]=(0,s.useState)(""),[a,i]=(0,s.useState)(""),[l,o]=(0,s.useState)([]),[c,u]=(0,s.useState)(!1),[h,m]=(0,s.useState)(!1),[x,p]=(0,s.useState)(-1),[f,b]=(0,s.useState)(!1),v=(0,s.useRef)(null),w=(0,s.useRef)(null),j=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=setTimeout(()=>{i(r.trim())},300);return()=>clearTimeout(e)},[r]),(0,s.useEffect)(()=>{if(!a){o([]),b(!1),p(-1);return}let e=!1;return async function(){m(!0);try{let t=new URLSearchParams({search:a,limit:"10"}),s=await fetch(`/api/runs?${t}`);if(!s.ok)throw Error("Search failed");let r=await s.json();e||(o(r.runs??[]),b(!0),p(-1))}catch{e||(o([]),b(!0))}finally{e||m(!1)}}(),()=>{e=!0}},[a]);let y=(0,s.useCallback)(t=>{u(!1),n(""),o([]),b(!1),e.push(`/runs/${t}`)},[e]),N=(0,s.useCallback)(e=>{if(c)switch(e.key){case"ArrowDown":e.preventDefault(),p(e=>e<l.length-1?e+1:0);break;case"ArrowUp":e.preventDefault(),p(e=>e>0?e-1:l.length-1);break;case"Enter":e.preventDefault(),x>=0&&x<l.length&&y(l[x].runId);break;case"Escape":e.preventDefault(),u(!1),v.current?.blur()}},[c,l,x,y]);(0,s.useEffect)(()=>{if(x>=0&&j.current){let e=j.current.querySelectorAll("[data-search-item]");e[x]?.scrollIntoView({block:"nearest"})}},[x]),(0,s.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"k"===e.key&&(e.preventDefault(),v.current?.focus(),u(!0)),"/"!==e.key||e.metaKey||e.ctrlKey||e.altKey||e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLSelectElement||e.target?.isContentEditable||(e.preventDefault(),v.current?.focus(),u(!0))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),(0,s.useEffect)(()=>{let e=e=>{w.current&&!w.current.contains(e.target)&&u(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let k=c&&r.trim().length>0;return(0,t.jsxs)("div",{ref:w,className:"relative w-full max-w-xl mx-auto mb-6",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(eI,{className:"absolute left-3.5 top-1/2 -translate-y-1/2 h-4 w-4 text-foreground-muted pointer-events-none"}),(0,t.jsx)("input",{ref:v,type:"text",value:r,onChange:e=>{n(e.target.value),u(!0)},onFocus:()=>{r.trim()&&u(!0)},onKeyDown:N,placeholder:"Search runs by ID, process name, or task title...",className:(0,d.cn)("w-full rounded-lg border border-border bg-card/80 backdrop-blur-sm","pl-10 pr-20 py-2.5 text-sm text-foreground","placeholder:text-foreground-muted/60","focus:border-primary/40 focus:outline-none focus:ring-2 focus:ring-primary/30","focus:shadow-neon-glow-primary-focus transition-all"),"data-testid":"global-search-input"}),(0,t.jsxs)("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-1.5",children:[r&&(0,t.jsx)("button",{onClick:()=>{n(""),o([]),b(!1),u(!1),v.current?.focus()},className:"rounded-md p-2 min-h-[44px] min-w-[44px] flex items-center justify-center text-foreground-muted hover:text-foreground-secondary transition-colors","aria-label":"Clear search",children:(0,t.jsx)(g.X,{className:"h-3.5 w-3.5"})}),(0,t.jsxs)("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 rounded border border-border bg-background-secondary px-1.5 py-0.5 text-xs font-medium text-foreground-muted",children:[(0,t.jsx)("span",{className:"text-xs",children:"u">typeof navigator&&/Mac/i.test(navigator.userAgent)?"⌘":"Ctrl"}),(0,t.jsx)("span",{children:"K"})]})]})]}),k&&(0,t.jsxs)("div",{className:(0,d.cn)("absolute z-50 top-full left-0 right-0 mt-1.5","rounded-lg border border-border bg-card/95 backdrop-blur-md shadow-xl","overflow-hidden"),"data-testid":"global-search-dropdown",children:[h&&(0,t.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3 text-xs text-foreground-muted",children:[(0,t.jsx)("div",{className:"h-3 w-3 rounded-full border-2 border-primary/40 border-t-primary animate-spin"}),"Searching..."]}),!h&&f&&0===l.length&&(0,t.jsxs)("div",{className:"px-4 py-6 text-center",children:[(0,t.jsx)(eI,{className:"h-5 w-5 text-foreground-muted/30 mx-auto mb-2"}),(0,t.jsxs)("p",{className:"text-xs text-foreground-muted",children:["No runs found for “",a,"”"]})]}),!h&&l.length>0&&(0,t.jsx)("ul",{ref:j,className:"max-h-80 overflow-y-auto py-1",role:"listbox",children:l.map((e,s)=>(0,t.jsxs)("li",{"data-search-item":!0,role:"option","aria-selected":s===x,onClick:()=>y(e.runId),className:(0,d.cn)("flex items-center gap-3 px-4 py-2.5 cursor-pointer transition-colors",s===x?"bg-primary/10":"hover:bg-background-secondary/60"),children:[(0,t.jsx)("span",{className:(0,d.cn)("h-2 w-2 rounded-full shrink-0","completed"===e.status?"bg-success":"failed"===e.status?"bg-error":"waiting"===e.status||"pending"===e.status?"bg-warning":"bg-foreground-muted")}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-foreground truncate",children:(0,J.friendlyProcessName)(e.processId)}),(0,t.jsx)(K.StatusBadge,{status:e.status,waitingKind:e.waitingKind,isStale:e.isStale})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[e.projectName&&(0,t.jsx)("span",{className:"text-xs text-foreground-muted",children:e.projectName}),(0,t.jsx)("span",{className:"font-mono text-xs text-info",children:(0,J.formatShortId)(e.runId,8)})]})]}),(0,t.jsx)(eE,{className:(0,d.cn)("h-3.5 w-3.5 shrink-0 transition-colors",s===x?"text-primary":"text-foreground-muted/40")})]},e.runId))})]})]})}e.s(["default",0,function(){let{projects:e,loading:a,error:i,metrics:o,allBreakpointRuns:d,summaryMetrics:c,bannerFingerprint:u,bannerDismissed:h,filterCounts:m,filteredProjects:g,activeProjects:x,historyProjects:p,statusFilter:f,sortMode:v,historyCollapsed:w,cardStatusFilter:j,hasStaleRuns:N,catchUp:k,setStatusFilter:S,setSortMode:R,setHistoryCollapsed:M,setDismissedFingerprint:I,toggleMetricFilter:E,handleHideProject:A}=function(){let e=(0,s.useRef)(()=>{}),t=function(e={}){let{sseFilter:t,onFlush:r,enabled:a=!0}=e,[i,l]=(0,s.useState)(!1),[o,d]=(0,s.useState)(0),c=(0,s.useRef)([]),u=(0,s.useRef)(!1),h=(0,s.useRef)(null),m=(0,s.useRef)(t);m.current=t;let g=(0,s.useRef)(r);g.current=r;let x=(0,s.useCallback)(()=>{u.current=!1,l(!1),d(0),c.current=[],h.current&&(clearTimeout(h.current),h.current=null),g.current?.()},[]),p=(0,s.useCallback)(()=>{u.current&&x()},[x]);return(0,s.useEffect)(()=>{if(!a)return;let e=(0,n.subscribe)(e=>{if("connected"===e.type||"disconnect"===e.type||"error"===e.type||m.current&&!m.current(e))return;let t=Date.now();c.current.push(t),c.current=c.current.filter(e=>t-e<5e3),u.current?(d(e=>e+1),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{x()},3e3)):c.current.length>=10&&(u.current=!0,l(!0),d(c.current.length),h.current=setTimeout(()=>{x()},3e3))});return()=>{e(),h.current&&(clearTimeout(h.current),h.current=null)}},[a,x]),{active:i,bufferedCount:o,flush:p}}({sseFilter:(0,s.useCallback)(e=>"update"===e.type||"new-run"===e.type,[]),onFlush:()=>e.current()}),{projects:a,recentCompletionWindowMs:i,loading:o,error:d,refresh:c}=function(e=5e3,t=!1){let{data:s,loading:n,error:a,refresh:i}=(0,r.useSmartPolling)("/api/runs?mode=projects",{interval:e,sseFilter:e=>"update"===e.type||"new-run"===e.type,suppressSseRefetch:t});return{projects:s?.projects||[],recentCompletionWindowMs:s?.recentCompletionWindowMs??144e5,loading:n,error:a,refresh:i}}(5e3,t.active);e.current=c;let[u,h]=(0,s.useState)("all"),[m,g]=l("observer:sort-mode","status"),[x,p]=l("banner-dismissed-fingerprint",null),f=(0,s.useCallback)(e=>{h(t=>t===e?"all":e)},[]),b=(0,s.useCallback)(e=>{c()},[c]),v=(0,s.useMemo)(()=>{let e=a.reduce((e,t)=>e+t.totalRuns,0),t=a.reduce((e,t)=>e+t.activeRuns,0),s=a.reduce((e,t)=>e+t.completedRuns,0),r=a.reduce((e,t)=>e+t.failedRuns,0),n=a.reduce((e,t)=>e+t.staleRuns,0);return{totalRuns:e,activeRuns:t,completedRuns:s,failedRuns:r,staleRuns:n,totalTasks:a.reduce((e,t)=>e+t.totalTasks,0),completedTasks:a.reduce((e,t)=>e+t.completedTasksAggregate,0)}},[a]),w=(0,s.useMemo)(()=>a.flatMap(e=>e.breakpointRuns??[]),[a]),j=(0,s.useMemo)(()=>({totalProjects:a.length,activeRuns:v.activeRuns,failedRuns:v.failedRuns,completedRuns:v.completedRuns,staleRuns:v.staleRuns,pendingBreakpoints:a.reduce((e,t)=>e+t.pendingBreakpoints,0)}),[a,v]),y=`${j.failedRuns}-${j.staleRuns}-${j.pendingBreakpoints}`,N=(0,s.useMemo)(()=>({all:v.totalRuns,waiting:v.activeRuns,stale:v.staleRuns,completed:v.completedRuns,failed:v.failedRuns,pending:0}),[v]),k=(0,s.useMemo)(()=>"all"===u?a:"stale"===u?a.filter(e=>e.staleRuns>0):a.filter(e=>"waiting"===u?e.activeRuns>0:"completed"===u?e.completedRuns>0:"failed"===u&&e.failedRuns>0),[a,u]),C="stale"===u?"all":u,{activeProjects:S,historyProjects:R}=(0,s.useMemo)(()=>{let e=Date.now();return"activity"===m?{activeProjects:k.filter(t=>e-new Date(t.latestUpdate).getTime()<864e5),historyProjects:k.filter(t=>e-new Date(t.latestUpdate).getTime()>=864e5)}:{activeProjects:k.filter(t=>t.activeRuns>0||t.staleRuns>0||e-new Date(t.latestUpdate).getTime()<i),historyProjects:k.filter(t=>0===t.activeRuns&&0===t.staleRuns&&e-new Date(t.latestUpdate).getTime()>=i)}},[k,i,m]),[M,I]=l("observer:history-collapsed",R.length>5),E=v.staleRuns>0;return{projects:a,loading:o,error:d,metrics:v,allBreakpointRuns:w,summaryMetrics:j,bannerFingerprint:y,bannerDismissed:x===y,filterCounts:N,filteredProjects:k,activeProjects:S,historyProjects:R,statusFilter:u,sortMode:m,historyCollapsed:M,cardStatusFilter:C,hasStaleRuns:E,catchUp:t,setStatusFilter:h,setSortMode:g,setHistoryCollapsed:I,setDismissedFingerprint:p,toggleMetricFilter:f,handleHideProject:b}}(),T=!a&&!i&&e.length>0;return(0,t.jsx)("div",{className:"bg-gradient-brand flex-1",children:(0,t.jsxs)("div",{className:"mx-auto max-w-[1600px] px-6 py-6",children:[(0,t.jsx)(eA,{}),T&&(0,t.jsx)(H.ErrorBoundary,{section:"Executive Summary",children:(0,t.jsx)(C,{metrics:c,onFilterChange:S,dismissed:h,onDismiss:()=>I(u)})}),T&&(0,t.jsx)(H.ErrorBoundary,{section:"KPI Metrics",children:(0,t.jsx)(z,{metrics:o,statusFilter:f,hasStaleRuns:N,onToggleFilter:E})}),k.active&&(0,t.jsx)(y,{catchUp:k,summary:{failedRuns:c.failedRuns,completedRuns:c.completedRuns,pendingBreakpoints:c.pendingBreakpoints}}),!a&&!i&&d.length>0&&(0,t.jsx)(H.ErrorBoundary,{section:"Breakpoint Banner",children:(0,t.jsx)("div",{className:"sticky top-0 z-40",children:(0,t.jsx)(b,{breakpointRuns:d})})}),(0,t.jsx)(P,{statusFilter:f,onStatusFilterChange:S,filterCounts:m,sortMode:v,onSortModeToggle:()=>R(e=>"status"===e?"activity":"status"),filteredProjectCount:g.length}),(0,t.jsx)(eR,{loading:a,error:i,filteredProjects:g,activeProjects:x,historyProjects:p,statusFilter:f,sortMode:v,cardStatusFilter:j,historyCollapsed:w,onHistoryCollapsedChange:M,onHideProject:A})]})})}],848791)}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,908080,e=>{"use strict";let r=(0,e.i(621255).default)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",0,r],908080)},777297,e=>{"use strict";let r=(0,e.i(621255).default)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);e.s(["ChevronUp",0,r],777297)},95187,(e,r,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});var n={callServer:function(){return s.callServer},createServerReference:function(){return l.createServerReference},findSourceMapURL:function(){return i.findSourceMapURL}};for(var t in n)Object.defineProperty(a,t,{enumerable:!0,get:n[t]});let s=e.r(132120),i=e.r(92245),l=e.r(235326)},
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,908080,e=>{"use strict";let r=(0,e.i(621255).default)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",0,r],908080)},777297,e=>{"use strict";let r=(0,e.i(621255).default)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);e.s(["ChevronUp",0,r],777297)},95187,(e,r,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});var n={callServer:function(){return s.callServer},createServerReference:function(){return l.createServerReference},findSourceMapURL:function(){return i.findSourceMapURL}};for(var t in n)Object.defineProperty(a,t,{enumerable:!0,get:n[t]});let s=e.r(132120),i=e.r(92245),l=e.r(235326)},809395,e=>{"use strict";var r=e.i(95187);let a=(0,r.createServerReference)("70eb86084b98f05f243b7a1d06f21b5dc9465dfca4",r.callServer,void 0,r.findSourceMapURL,"approveBreakpoint");e.s(["approveBreakpoint",0,a])},411670,e=>{"use strict";let r=(0,e.i(621255).default)("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["AlertCircle",0,r],411670)},126650,e=>{"use strict";var r=e.i(271645),a=e.i(645483),n=e.i(595833);e.s(["useSmartPolling",0,function(e,t={}){let{interval:s=5e3,sseFilter:i,enabled:l=!0,suppressSseRefetch:o=!1}=t,[c,u]=(0,r.useState)(null),[d,g]=(0,r.useState)(l&&!!e),[p,h]=(0,r.useState)(null),w=(0,r.useRef)(!0),f=(0,r.useRef)(i);f.current=i;let v=(0,r.useRef)(!1),m=(0,r.useRef)(null),x=(0,r.useRef)(null),y=(0,r.useRef)(null),b=(0,r.useRef)(o);b.current=o;let k=(0,r.useCallback)(async()=>{if(!e||!l)return;x.current?.abort(),x.current=new AbortController;let a=await (0,n.resilientFetch)(e,{signal:x.current.signal});if(!a.ok){if(a.error.isAborted)return;w.current&&(h(a.error.message),g(!1));return}w.current&&(304!==a.status&&(0,r.startTransition)(()=>{u(a.data)}),h(null),g(!1))},[e,l]);return(0,r.useEffect)(()=>(w.current=!0,l&&e)?(g(!0),k(),m.current&&clearInterval(m.current),m.current=setInterval(k,v.current?Math.max(3*s,15e3):s),()=>{w.current=!1,x.current?.abort(),m.current&&(clearInterval(m.current),m.current=null)}):void g(!1),[k,s,l,e]),(0,r.useEffect)(()=>{if(!l||!f.current)return;let e=(0,a.subscribe)(e=>{if("connected"===e.type){v.current||(v.current=!0,m.current&&clearInterval(m.current),m.current=setInterval(k,Math.max(3*s,15e3)));return}if("disconnect"===e.type||"error"===e.type){v.current&&(v.current=!1,m.current&&clearInterval(m.current),m.current=setInterval(k,s));return}if(f.current?.(e)){if(b.current)return;y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{y.current=null,k()},1500)}});return()=>{e(),v.current=!1,y.current&&(clearTimeout(y.current),y.current=null)}},[l,k,s]),{data:c,loading:d,error:p,refresh:k}}])},622537,770354,e=>{"use strict";var r=e.i(621255);let a=(0,r.default)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);e.s(["RefreshCw",0,a],622537);let n=(0,r.default)("Pause",[["rect",{width:"4",height:"16",x:"6",y:"4",key:"iffhe4"}],["rect",{width:"4",height:"16",x:"14",y:"4",key:"sjin7j"}]]);e.s(["Pause",0,n],770354)},806790,e=>{"use strict";let r=(0,e.i(621255).default)("Hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2v0a2 2 0 0 0-2 2v0",key:"aigmz7"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2v0a2 2 0 0 0-2 2v2",key:"1n6bmn"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2v0a2 2 0 0 0-2 2v8",key:"a9iiix"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]);e.s(["Hand",0,r],806790)},229235,e=>{"use strict";let r=(0,e.i(621255).default)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);e.s(["ChevronDown",0,r],229235)},327214,e=>{"use strict";let r=(0,e.i(621255).default)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);e.s(["Clock",0,r],327214)},538170,e=>{"use strict";var r=e.i(843476),a=e.i(273172),n=e.i(877051),t=e.i(368842),s=e.i(949201),i=e.i(327214),l=e.i(23406);let o=(0,e.i(621255).default)("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var c=e.i(806790);let u="h-3.5 w-3.5",d={completed:{variant:"success",icon:(0,r.jsx)(t.CheckCircle2,{className:(0,a.cn)(u,"drop-shadow-[var(--drop-glow-success)]")}),label:"Completed",extraClass:"ring-success/30 shadow-neon-glow-success-sm"},resolved:{variant:"success",icon:(0,r.jsx)(t.CheckCircle2,{className:(0,a.cn)(u,"drop-shadow-[var(--drop-glow-success)]")}),label:"Done",extraClass:"ring-success/30 shadow-neon-glow-success-sm"},ok:{variant:"success",icon:(0,r.jsx)(t.CheckCircle2,{className:(0,a.cn)(u,"drop-shadow-[var(--drop-glow-success)]")}),label:"OK",extraClass:"ring-success/30 shadow-neon-glow-success-sm"},failed:{variant:"error",icon:(0,r.jsx)(s.XCircle,{className:(0,a.cn)(u,"drop-shadow-[var(--drop-glow-error)]")}),label:"Failed",extraClass:"ring-error/30 shadow-neon-glow-error-sm"},error:{variant:"error",icon:(0,r.jsx)(s.XCircle,{className:(0,a.cn)(u,"drop-shadow-[var(--drop-glow-error)]")}),label:"Error",extraClass:"ring-error/30 shadow-neon-glow-error-sm"},waiting:{variant:"warning",icon:(0,r.jsx)(i.Clock,{className:(0,a.cn)(u,"drop-shadow-[var(--drop-glow-warning)]")}),label:"Waiting",extraClass:"ring-warning/30 shadow-neon-glow-warning-sm"},waiting_breakpoint:{variant:"warning",icon:(0,r.jsx)(c.Hand,{className:(0,a.cn)(u,"animate-pulse drop-shadow-[var(--drop-glow-warning)]")}),label:"Approval Needed",extraClass:"ring-warning/40 animate-breakpoint-glow"},waiting_task:{variant:"info",icon:(0,r.jsx)(l.Loader2,{className:(0,a.cn)(u,"animate-spin drop-shadow-[var(--drop-glow-cyan)]")}),label:"Working",extraClass:"ring-info/30 shadow-neon-glow-cyan-sm"},breakpoint_awaiting:{variant:"warning",icon:(0,r.jsx)(c.Hand,{className:(0,a.cn)(u,"animate-pulse drop-shadow-[var(--drop-glow-warning)]")}),label:"Needs Approval",extraClass:"ring-warning/40 animate-breakpoint-glow"},requested:{variant:"info",icon:(0,r.jsx)(l.Loader2,{className:(0,a.cn)(u,"animate-spin drop-shadow-[var(--drop-glow-cyan)]")}),label:"Running",extraClass:"ring-info/30 shadow-neon-glow-cyan-sm"},pending:{variant:"pending",icon:(0,r.jsx)(o,{className:u}),label:"Pending"}};e.s(["StatusBadge",0,function({status:e,className:t,waitingKind:s,isStale:i}){let l=d[e]||d.pending;return"waiting"===e&&s&&(l=d[`waiting_${s}`]||l),(0,r.jsxs)(n.Badge,{"data-testid":`status-badge-${e}`,variant:i?"default":l.variant,className:(0,a.cn)("gap-1",i?"opacity-60 text-zinc-500 ring-zinc-500/20 bg-zinc-500/10 shadow-none":l.extraClass,t),children:[l.icon,i&&("pending"===e||"waiting"===e&&!s)?"Interrupted":l.label]})}],538170)},422930,e=>{"use strict";let r=(0,e.i(621255).default)("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);e.s(["Layers",0,r],422930)},83143,e=>{"use strict";var r=e.i(843476),a=e.i(271645),n=e.i(273172),t=e.i(743041),s=e.i(952848);e.s(["SessionPill",0,function({sessionId:e,active:i=!1,className:l}){let[o,c]=(0,a.useState)(!1);return e?(0,r.jsx)(s.TooltipProvider,{children:(0,r.jsxs)(s.Tooltip,{children:[(0,r.jsx)(s.TooltipTrigger,{asChild:!0,children:(0,r.jsxs)("span",{className:(0,n.cn)("relative inline-flex items-center gap-1.5 rounded-full bg-background-secondary px-2.5 py-0.5 text-xs font-mono text-foreground-muted cursor-pointer transition-all hover:bg-background-tertiary select-none",i&&"shadow-neon-glow-cyan-sm",l),onClick:r=>{r.stopPropagation(),r.preventDefault(),navigator.clipboard.writeText(e),c(!0),setTimeout(()=>c(!1),1500)},children:[(0,r.jsx)("span",{className:(0,n.cn)("h-1.5 w-1.5 rounded-full",i?"bg-secondary shadow-[0_0_6px_var(--secondary)] animate-pulse-dot":"bg-foreground-muted/40")}),(0,t.formatShortId)(e,4),o&&(0,r.jsx)("span",{className:"absolute -top-7 left-1/2 -translate-x-1/2 rounded-md bg-primary px-2 py-0.5 text-xs leading-tight font-sans font-medium text-primary-foreground whitespace-nowrap animate-slide-in-right",children:"Copied!"})]})}),(0,r.jsxs)(s.TooltipContent,{children:[(0,r.jsx)("p",{className:"font-mono text-xs",children:o?"Copied!":`Session: ${e}`}),!o&&(0,r.jsx)("p",{className:"text-foreground-muted text-xs leading-tight mt-0.5",children:"Click to copy"})]})]})}):null}])},722727,e=>{"use strict";var r=e.i(843476),a=e.i(273172);let n={default:"bg-primary",success:"bg-success",error:"bg-error",warning:"bg-warning"},t={default:"shadow-progress-glow-primary",success:"shadow-progress-glow-success",error:"shadow-progress-glow-error",warning:"shadow-progress-glow-warning"};e.s(["ProgressBar",0,function({value:e,variant:s="default",glow:i=!1,className:l}){let o=Math.min(100,Math.max(0,e));return(0,r.jsx)("div",{className:(0,a.cn)("h-2 w-full overflow-hidden rounded-full bg-background-muted",l),children:(0,r.jsx)("div",{className:(0,a.cn)("h-full transition-all duration-500 ease-out",n[s],i&&t[s],100===o?"rounded-full":"rounded-l-full"),style:{width:`${o}%`}})})}])}]);
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
4
4
|
|
|
5
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return f.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},ta=({contentRef:e,descriptionId:t})=>{let r=tr("DialogDescriptionWarning"),n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${r.contentName}}.`;return f.useEffect(()=>{let r=e.current?.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},to=e.i(497035),ts=e.i(853897),ti=e.i(348890);let tl=[{keys:["?"],description:"Show this help",context:"global"},{keys:["n"],description:"Toggle notifications",context:"global"},{keys:["/"],description:"Focus search",context:"dashboard"},{keys:["j"],description:"Next item",context:"run-detail"},{keys:["k"],description:"Previous item",context:"run-detail"},{keys:["Enter"],description:"Open selected",context:"run-detail"},{keys:["Esc"],description:"Go back / Close",context:"run-detail"},{keys:["e"],description:"Toggle event stream",context:"run-detail"},{keys:["1"],description:"Agent tab",context:"run-detail"},{keys:["2"],description:"Timing tab",context:"run-detail"},{keys:["3"],description:"Logs tab",context:"run-detail"},{keys:["4"],description:"Data tab",context:"run-detail"},{keys:["5"],description:"Approval tab",context:"run-detail"}],tc={global:"Global",dashboard:"Dashboard","run-detail":"Run Detail"};function td(){let[e,t]=(0,f.useState)(!1),r=(0,j.usePathname)(),n=r?.startsWith("/runs/")??!1;(0,ti.useKeyboard)([{key:"?",action:()=>t(!0),description:"Show shortcuts help"},{key:"Escape",action:()=>t(!1),description:"Close shortcuts help"}]),(0,f.useEffect)(()=>{let e=()=>t(!0);return window.addEventListener("open-shortcuts-help",e),()=>window.removeEventListener("open-shortcuts-help",e)},[]);let a=tl.filter(e=>"global"===e.context||"dashboard"===e.context&&!n||"run-detail"===e.context&&!!n).reduce((e,t)=>((e[t.context]??=[]).push(t),e),{});return(0,m.jsx)(eK,{open:e,onOpenChange:t,children:(0,m.jsxs)(eq,{children:[(0,m.jsx)(eY,{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm"}),(0,m.jsxs)(eQ,{className:"fixed left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2 rounded-lg border border-[var(--glass-border)] bg-[var(--glass-bg)] backdrop-blur-xl p-6 shadow-glass w-full max-w-md",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,m.jsx)(e5,{className:"text-sm font-medium text-foreground",children:"Keyboard Shortcuts"}),(0,m.jsx)(e7,{asChild:!0,children:(0,m.jsx)("button",{className:"rounded-md p-2 min-h-[44px] min-w-[44px] flex items-center justify-center text-foreground-muted hover:text-primary transition-colors",children:(0,m.jsx)(ts.X,{className:"h-4 w-4"})})})]}),(0,m.jsx)("div",{className:"space-y-4",children:Object.entries(a).map(([e,t])=>(0,m.jsxs)("div",{children:[(0,m.jsx)("h3",{className:"text-xs font-medium text-foreground-muted uppercase tracking-wider mb-2",children:tc[e]??e}),(0,m.jsx)("div",{className:"space-y-2",children:t.map(({keys:e,description:t})=>(0,m.jsxs)("div",{className:"flex items-center justify-between py-1",children:[(0,m.jsx)("span",{className:"text-sm text-foreground-secondary",children:t}),(0,m.jsx)("div",{className:"flex items-center gap-1",children:e.map(e=>(0,m.jsx)(to.Kbd,{children:e},e))})]},t))})]},e))})]})]})})}var tu=e.i(522016),tm=e.i(273172),tf=e.i(368842),tp=e.i(949201),th=e.i(608646),tx=e.i(999459),tg=e.i(621255);let tb=(0,tg.default)("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);var ty=e.i(700878);let tv={success:(0,m.jsx)(tf.CheckCircle2,{className:"h-4 w-4 text-success drop-shadow-[var(--drop-glow-success)]"}),error:(0,m.jsx)(tp.XCircle,{className:"h-4 w-4 text-error drop-shadow-[var(--drop-glow-error)]"}),warning:(0,m.jsx)(th.AlertTriangle,{className:"h-4 w-4 text-warning drop-shadow-[var(--drop-glow-warning)]"}),info:(0,m.jsx)(tx.Info,{className:"h-4 w-4 text-info drop-shadow-[var(--drop-glow-cyan)]"})},tj={success:"border-l-success",error:"border-l-error",warning:"border-l-warning",info:"border-l-info"};function tw({open:e,notifications:t,onDismiss:r,onClose:n}){let a=(0,j.useRouter)();return(0,m.jsx)(eK,{open:e,onOpenChange:e=>{e||n()},children:(0,m.jsxs)(eq,{children:[(0,m.jsx)(eY,{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm"}),(0,m.jsxs)(eQ,{"data-testid":"notification-panel",className:"fixed right-4 top-4 z-50 rounded-lg border border-[var(--glass-border)] bg-[var(--glass-bg)] backdrop-blur-xl shadow-glass w-full max-w-md max-h-[80vh] flex flex-col",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between p-4 border-b border-[var(--glass-border-subtle)]",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)(tb,{className:"h-4 w-4 text-primary/60"}),(0,m.jsx)(e5,{className:"text-sm font-medium text-foreground",children:"Notifications"}),t.length>0&&(0,m.jsxs)("span",{className:"text-xs text-primary/70 font-mono",children:["(",t.length,")"]})]}),(0,m.jsx)(e7,{asChild:!0,children:(0,m.jsx)("button",{className:"rounded-md p-2 min-h-[44px] min-w-[44px] flex items-center justify-center text-foreground-muted hover:text-primary transition-colors",children:(0,m.jsx)(ts.X,{className:"h-4 w-4"})})})]}),(0,m.jsx)("div",{className:"flex-1 overflow-y-auto p-2",children:0===t.length?(0,m.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-foreground-muted",children:[(0,m.jsx)(tb,{className:"h-8 w-8 mb-2 opacity-50"}),(0,m.jsx)("p",{className:"text-sm",children:"No notifications"})]}):(0,m.jsx)("div",{className:"space-y-2",children:t.map(e=>{var t;let o,s,i;return(0,m.jsx)("div",{"data-testid":`notification-item-${e.id}`,className:(0,tm.cn)("rounded-lg border border-[var(--glass-border-faint)] bg-[var(--glass-card-bg)] p-3 border-l-2","transition-colors duration-150",e.href&&"cursor-pointer hover:bg-[var(--glass-border-faint)]",tj[e.type]),onClick:()=>{e.href&&(a.push(e.href),r(e.id),n())},children:(0,m.jsxs)("div",{className:"flex items-start gap-2",children:[(0,m.jsx)("div",{className:"shrink-0 mt-0.5",children:tv[e.type]}),e.persistent&&(0,m.jsx)("span",{title:"Pinned — won't auto-dismiss",className:"shrink-0",children:(0,m.jsx)(ty.Pin,{className:"h-3 w-3 text-primary/50"})}),(0,m.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,m.jsx)("p",{className:"text-sm font-medium text-foreground",children:e.title}),(0,m.jsx)("p",{className:"text-xs text-foreground-muted mt-0.5",children:e.body}),(0,m.jsxs)("p",{className:"text-xs text-foreground-muted mt-1 opacity-70",children:[(t=e.timestamp,i=Math.floor((s=Math.floor((o=Math.floor((Date.now()-t)/1e3))/60))/60),o<60?"just now":s<60?`${s}m ago`:i<24?`${i}h ago`:new Date(t).toLocaleString()),e.persistent&&(0,m.jsx)("span",{className:"text-primary/50 ml-1",children:"· Pinned"})]})]}),(0,m.jsx)("button",{onClick:t=>{t.stopPropagation(),r(e.id)},className:"shrink-0 rounded-md p-2 min-h-[44px] min-w-[44px] flex items-center justify-center text-foreground-muted hover:text-primary transition-colors",children:(0,m.jsx)(ts.X,{className:"h-3.5 w-3.5"})})]})},e.id)})})})]})]})})}let tN=(0,tg.default)("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);var tk=e.i(355338);let tE=(0,tg.default)("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]),tC=(0,tg.default)("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]),tS=(0,tg.default)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),tM=(0,tg.default)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);var tR=e.i(23406),tP=e.i(86752);let tO=(0,tg.default)("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);var tA=e.i(421509),tD=e.i(781225),tI=e.i(595833);function tT({open:e,onClose:t}){let{theme:r,toggle:n}=h(),[a,o]=(0,f.useState)(null),[s,i]=(0,f.useState)(null),[l,c]=(0,f.useState)(!1),[d,u]=(0,f.useState)([]),[p,x]=(0,f.useState)(2e3),[g,b]=(0,f.useState)("dark"),[y,v]=(0,f.useState)(30),[j,w]=(0,f.useState)([]),[N,k]=(0,f.useState)([]),[E,C]=(0,f.useState)(!1),[S,M]=(0,f.useState)(null),[R,P]=(0,f.useState)(null),O=(0,f.useRef)(null),A=(0,f.useRef)(null);(0,f.useEffect)(()=>{if(!e)return;c(!0),i(null),M(null),P(null),O.current?.abort(),O.current=new AbortController;let t=O.current.signal;return Promise.all([(0,tI.resilientFetch)("/api/config",{signal:t}),(0,tI.resilientFetch)("/api/runs?mode=projects",{signal:t})]).then(([e,t])=>{if(!e.ok){if(e.error.isAborted)return;i(e.error.message);return}let r=e.data;o(r),u(r.sources.map(e=>({...e}))),x(r.pollInterval),b(r.theme),v(r.retentionDays),w(r.hiddenProjects??[]),k(Array.from(new Set([...t.ok?t.data.projects.map(e=>e.projectName):[],...r.hiddenProjects??[]])).sort())}).finally(()=>c(!1)),()=>{O.current?.abort(),A.current?.abort()}},[e]);let D=(0,f.useCallback)((e,t,r)=>{u(n=>n.map((n,a)=>a===e?{...n,[t]:r}:n))},[]),I=(0,f.useCallback)(e=>{u(t=>t.filter((t,r)=>r!==e))},[]),T=(0,f.useCallback)(()=>{u(e=>[...e,{path:"",depth:2}])},[]),L=(0,f.useCallback)(()=>{a&&(u(a.sources.map(e=>({...e}))),x(a.pollInterval),b(a.theme),v(a.retentionDays),w(a.hiddenProjects??[])),M(null),P(null)},[a]),_=(0,f.useCallback)(async()=>{C(!0),M(null),P(null),A.current?.abort(),A.current=new AbortController;let e=await (0,tI.resilientFetch)("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sources:d.filter(e=>e.path.trim()),pollInterval:p,theme:g,retentionDays:y,hiddenProjects:j}),signal:A.current.signal});if(!e.ok){if(e.error.isAborted)return;M("error"),P(e.error.message),C(!1);return}let t=e.data;o(t),u(t.sources.map(e=>({...e}))),x(t.pollInterval),b(t.theme),v(t.retentionDays),w(t.hiddenProjects??[]),M("success"),t.theme!==r&&n(),setTimeout(()=>M(null),2e3),C(!1)},[d,p,g,y,j,r,n]),F=a&&(JSON.stringify(d)!==JSON.stringify(a.sources)||p!==a.pollInterval||g!==a.theme||y!==a.retentionDays||JSON.stringify(j.slice().sort())!==JSON.stringify((a.hiddenProjects??[]).slice().sort()));return(0,m.jsx)(eK,{open:e,onOpenChange:e=>{e||t()},children:(0,m.jsxs)(eq,{children:[(0,m.jsx)(eY,{className:"fixed inset-0 z-50 bg-black/60"}),(0,m.jsx)(eQ,{className:"fixed inset-0 z-50 flex items-center justify-center p-4","data-testid":"settings-modal",children:(0,m.jsxs)("div",{className:"relative z-50 rounded-lg border border-border bg-card shadow-xl w-full max-w-lg max-h-[80vh] flex flex-col",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)(tN,{className:"h-4 w-4 text-foreground-muted"}),(0,m.jsx)(e5,{className:"text-sm font-medium text-foreground",children:"Settings"})]}),(0,m.jsx)(e7,{asChild:!0,children:(0,m.jsx)("button",{className:"rounded-md p-2 min-h-[44px] min-w-[44px] flex items-center justify-center text-foreground-muted hover:text-foreground transition-colors",children:(0,m.jsx)(ts.X,{className:"h-4 w-4"})})})]}),(0,m.jsx)(e6,{asChild:!0,children:(0,m.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:l?(0,m.jsxs)("div",{className:"flex items-center justify-center py-12 text-foreground-muted",children:[(0,m.jsx)(tR.Loader2,{className:"h-4 w-4 animate-spin mr-2"}),(0,m.jsx)("p",{className:"text-sm",children:"Loading configuration..."})]}):s?(0,m.jsxs)("div",{className:"rounded-lg border border-error/20 bg-error-muted p-3 text-sm text-error",children:["Failed to load config: ",s]}):a?(0,m.jsxs)("div",{className:"space-y-5",children:[(0,m.jsxs)("section",{children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,m.jsx)(tk.FolderOpen,{className:"h-4 w-4 text-foreground-muted"}),(0,m.jsx)("span",{className:"text-xs font-medium text-foreground-secondary",children:"Watch Sources"})]}),(0,m.jsx)("div",{className:"space-y-2",children:d.map((e,t)=>(0,m.jsxs)("div",{className:"rounded-md border border-border bg-background p-2.5 space-y-2",children:[(0,m.jsxs)("div",{className:"flex items-start gap-2",children:[(0,m.jsxs)("div",{className:"flex-1",children:[(0,m.jsx)("label",{className:"text-xs uppercase tracking-wider text-foreground-muted mb-1 block",children:"Path"}),(0,m.jsx)("input",{type:"text",value:e.path,onChange:e=>D(t,"path",e.target.value),placeholder:"/path/to/projects",className:"w-full rounded-md border border-border bg-background-secondary px-2.5 py-1.5 font-mono text-xs text-foreground placeholder:text-foreground-muted/50 focus:outline-none focus:ring-1 focus:ring-primary/50"})]}),(0,m.jsx)("button",{onClick:()=>I(t),className:"mt-4 rounded-md p-2 min-h-[44px] min-w-[44px] flex items-center justify-center text-foreground-muted hover:text-error hover:bg-error/10 transition-colors",title:"Remove source",children:(0,m.jsx)(tM,{className:"h-3.5 w-3.5"})})]}),(0,m.jsx)("div",{className:"flex items-center gap-3",children:(0,m.jsxs)("div",{className:"w-20",children:[(0,m.jsx)("label",{className:"text-xs uppercase tracking-wider text-foreground-muted mb-1 block",children:"Depth"}),(0,m.jsx)("input",{type:"number",value:e.depth,onChange:e=>D(t,"depth",Math.max(0,Math.min(10,parseInt(e.target.value)||0))),min:0,max:10,className:"w-full rounded-md border border-border bg-background-secondary px-2.5 py-1.5 font-mono text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary/50"})]})})]},t))}),(0,m.jsxs)("button",{onClick:T,className:"mt-2 flex items-center gap-1.5 rounded-md px-2.5 py-1.5 min-h-[44px] text-xs text-foreground-muted hover:text-foreground hover:bg-background-secondary transition-colors",children:[(0,m.jsx)(tS,{className:"h-3.5 w-3.5"}),"Add Source"]})]}),(0,m.jsxs)("section",{children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,m.jsx)(tE,{className:"h-4 w-4 text-foreground-muted"}),(0,m.jsx)("span",{className:"text-xs font-medium text-foreground-secondary",children:"Poll Interval"})]}),(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)("input",{type:"number",value:p,onChange:e=>x(Math.max(500,parseInt(e.target.value)||500)),min:500,step:500,className:"w-28 rounded-md border border-border bg-background-secondary px-2.5 py-1.5 font-mono text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,m.jsx)("span",{className:"text-xs text-foreground-muted",children:"ms"})]})]}),(0,m.jsxs)("section",{children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,m.jsx)(tC,{className:"h-4 w-4 text-foreground-muted"}),(0,m.jsx)("span",{className:"text-xs font-medium text-foreground-secondary",children:"Theme"})]}),(0,m.jsx)("div",{className:"flex rounded-md border border-border overflow-hidden",children:["dark","light"].map(e=>(0,m.jsx)("button",{onClick:()=>b(e),className:(0,tm.cn)("flex-1 px-4 py-1.5 min-h-[44px] text-xs font-medium transition-colors capitalize",g===e?"bg-primary/15 text-primary":"bg-background-secondary text-foreground-muted hover:text-foreground"),children:e},e))})]}),(0,m.jsxs)("section",{children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,m.jsx)(tO,{className:"h-4 w-4 text-foreground-muted"}),(0,m.jsx)("span",{className:"text-xs font-medium text-foreground-secondary",children:"Run Retention"})]}),(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)("span",{className:"text-xs text-foreground-muted",children:"Show runs from the last"}),(0,m.jsx)("input",{type:"number",value:y,onChange:e=>v(Math.max(1,Math.min(365,parseInt(e.target.value)||30))),min:1,max:365,className:"w-20 rounded-md border border-border bg-background-secondary px-2.5 py-1.5 font-mono text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,m.jsx)("span",{className:"text-xs text-foreground-muted",children:"days"})]}),(0,m.jsx)("p",{className:"text-xs text-foreground-muted mt-1.5",children:"Older completed/failed runs are hidden from the dashboard. Active runs are always shown."})]}),N.length>0&&(0,m.jsxs)("section",{children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,m.jsx)(tA.Eye,{className:"h-4 w-4 text-foreground-muted"}),(0,m.jsx)("span",{className:"text-xs font-medium text-foreground-secondary",children:"Project Visibility"})]}),(0,m.jsx)("p",{className:"text-xs text-foreground-muted mb-2",children:"Hidden projects will not appear on the dashboard."}),(0,m.jsx)("div",{className:"space-y-1",children:N.map(e=>{let t=j.includes(e);return(0,m.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-border bg-background px-2.5 py-1.5",children:[(0,m.jsx)("span",{className:(0,tm.cn)("text-xs font-mono truncate",t?"text-foreground-muted line-through":"text-foreground"),children:e}),(0,m.jsx)("button",{onClick:()=>{w(r=>t?r.filter(t=>t!==e):[...r,e])},className:(0,tm.cn)("rounded-md p-2 min-h-[44px] min-w-[44px] flex items-center justify-center transition-colors",t?"text-foreground-muted hover:text-foreground hover:bg-background-secondary":"text-foreground-secondary hover:text-foreground-muted hover:bg-background-secondary"),title:t?"Show project":"Hide project",children:t?(0,m.jsx)(tD.EyeOff,{className:"h-3.5 w-3.5"}):(0,m.jsx)(tA.Eye,{className:"h-3.5 w-3.5"})})]},e)})})]}),"success"===S&&(0,m.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-success/20 bg-success/5 px-3 py-2 text-xs text-success",children:[(0,m.jsx)(tP.Check,{className:"h-3.5 w-3.5"}),"Settings saved successfully"]}),"error"===S&&(0,m.jsx)("div",{className:"rounded-md border border-error/20 bg-error/5 px-3 py-2 text-xs text-error",children:R||"Failed to save settings"})]}):null})}),a&&(0,m.jsxs)("div",{className:"flex items-center justify-between border-t border-border px-4 py-3",children:[(0,m.jsxs)("p",{className:"text-xs text-foreground-muted",children:["Config file: ",(0,m.jsx)("span",{className:"font-mono",children:"~/.a5c/observer.json"})]}),(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)("button",{onClick:L,disabled:E,className:"rounded-md px-3 py-1.5 min-h-[44px] text-xs text-foreground-muted hover:text-foreground hover:bg-background-secondary transition-colors disabled:opacity-50",children:"Cancel"}),(0,m.jsx)("button",{onClick:_,disabled:E||!F,className:(0,tm.cn)("rounded-md px-3 py-1.5 min-h-[44px] text-xs font-medium transition-colors",F?"bg-primary text-primary-foreground hover:bg-primary/90":"bg-background-secondary text-foreground-muted cursor-not-allowed",E&&"opacity-50"),children:E?(0,m.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,m.jsx)(tR.Loader2,{className:"h-3 w-3 animate-spin"}),"Saving..."]}):"Save"})]})]})]})})]})})}let tL=(0,tg.default)("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),t_=(0,tg.default)("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]),tF=(0,tg.default)("HelpCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),tW=(0,tg.default)("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]),tz=(0,tg.default)("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),tB=(0,tg.default)("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);function tK(){let{theme:e,toggle:t}=h(),{connected:r}=(0,b.useEventStream)(),{notifications:n,dismiss:a}=(0,g.useNotificationContext)(),[o,s]=(0,f.useState)(!1),[i,l]=(0,f.useState)(!1),c=(0,f.useCallback)(()=>{s(e=>!e)},[]);return(0,ti.useKeyboard)([{key:"n",action:c,description:"Toggle notifications"}]),(0,f.useEffect)(()=>{let e=()=>l(!0);return window.addEventListener("open-settings",e),()=>window.removeEventListener("open-settings",e)},[]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("a",{href:"#main-content",className:"sr-only focus:not-sr-only focus:absolute focus:top-2 focus:left-2 focus:z-[100] focus:px-4 focus:py-2 focus:bg-primary focus:text-primary-foreground focus:rounded-md",children:"Skip to main content"}),(0,m.jsx)("header",{className:"sticky top-0 z-30 border-b border-border bg-background/80 backdrop-blur-md",children:(0,m.jsxs)("div",{className:"mx-auto max-w-[1600px] px-6 py-3 flex items-center gap-3",children:[(0,m.jsx)(tA.Eye,{className:"h-5 w-5 text-primary"}),(0,m.jsx)("h1",{className:"text-base font-semibold",children:(0,m.jsx)(tu.default,{href:"/",className:"text-foreground hover:text-primary transition-colors",children:"Babysitter Observer"})}),(0,m.jsx)("a",{href:"https://www.a5c.ai/",target:"_blank",rel:"noopener noreferrer",className:"text-xs leading-tight font-medium text-primary/60 hover:text-primary transition-colors hidden sm:block",children:"a5c.ai"}),(0,m.jsx)("a",{href:"https://github.com/a5c-ai/babysitter",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs text-foreground-muted hover:text-foreground-secondary transition-colors hidden sm:block",title:"Babysitter on GitHub",children:(0,m.jsx)(tB,{className:"h-3.5 w-3.5"})}),(0,m.jsx)("span",{className:"text-xs text-foreground-muted hidden md:block",children:"Real-time orchestration dashboard"}),(0,m.jsxs)("div",{className:"ml-auto flex items-center gap-1.5",children:[(0,m.jsxs)("span",{"data-testid":"sse-status",role:"status","aria-live":"polite",className:(0,tm.cn)("inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium mr-1 transition-all",r?"bg-success/10 text-success border border-success/20":"bg-error/10 text-error border border-error/20"),title:r?"Live updates connected":"Live updates disconnected",children:[r?(0,m.jsx)(tW,{className:"h-3 w-3"}):(0,m.jsx)(tz,{className:"h-3 w-3"}),(0,m.jsx)("span",{className:"hidden sm:inline",children:r?"Live":"Offline"})]}),(0,m.jsxs)("button",{"data-testid":"notification-bell",onClick:c,className:"relative rounded-md p-2 min-h-[44px] min-w-[44px] flex items-center justify-center text-foreground-muted hover:text-foreground-secondary hover:bg-background-secondary transition-colors",title:"Notifications","aria-label":`Notifications${n.length>0?` (${n.length} unread)`:""}`,children:[(0,m.jsx)(tb,{className:"h-4 w-4"}),n.length>0&&(0,m.jsx)("span",{"data-testid":"notification-badge",className:"absolute -top-0.5 -right-0.5 flex h-4 w-4 items-center justify-center rounded-full bg-primary text-[10px] font-bold text-primary-foreground tabular-nums",children:n.length>9?"9+":n.length})]}),(0,m.jsx)("button",{onClick:()=>window.dispatchEvent(new CustomEvent("open-shortcuts-help")),className:"rounded-md p-2 min-h-[44px] min-w-[44px] flex items-center justify-center text-foreground-muted hover:text-foreground-secondary hover:bg-background-secondary transition-colors",title:"Keyboard shortcuts","aria-label":"Keyboard shortcuts",children:(0,m.jsx)(tF,{className:"h-4 w-4"})}),(0,m.jsx)("button",{onClick:()=>l(!0),className:"rounded-md p-2 min-h-[44px] min-w-[44px] flex items-center justify-center text-foreground-muted hover:text-foreground-secondary hover:bg-background-secondary transition-colors",title:"Settings","aria-label":"Settings",children:(0,m.jsx)(tN,{className:"h-4 w-4"})}),(0,m.jsx)("button",{"data-testid":"theme-toggle",onClick:t,className:"rounded-md p-2 min-h-[44px] min-w-[44px] flex items-center justify-center text-foreground-muted hover:text-foreground-secondary hover:bg-background-secondary transition-colors",title:`Switch to ${"dark"===e?"light":"dark"} theme`,"aria-label":`Switch to ${"dark"===e?"light":"dark"} theme`,children:"dark"===e?(0,m.jsx)(tL,{className:"h-4 w-4"}):(0,m.jsx)(t_,{className:"h-4 w-4"})})]})]})}),(0,m.jsx)(tw,{open:o,notifications:n,onDismiss:a,onClose:()=>s(!1)}),(0,m.jsx)(tT,{open:i,onClose:()=>l(!1)})]})}var tH=e.i(247167),tX=e.i(448647);function t$(){let[e,t]=(0,f.useState)({app:"6.0.1",babysitter:tH.default.env.NEXT_PUBLIC_BABYSITTER_VERSION||"…"});return(0,f.useEffect)(()=>{fetch("/api/version").then(e=>e.json()).then(e=>{(e.app||e.babysitter)&&t(t=>({app:e.app||t.app,babysitter:e.babysitter||t.babysitter}))}).catch(()=>{})},[]),(0,m.jsx)("footer",{className:"border-t border-border bg-background/80 backdrop-blur-sm",children:(0,m.jsxs)("div",{className:"mx-auto max-w-[1600px] px-6 py-3 flex flex-wrap items-center justify-between gap-3 text-xs text-foreground-muted",children:[(0,m.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,m.jsx)(tA.Eye,{className:"h-3.5 w-3.5 text-primary/40"}),(0,m.jsxs)("span",{className:"font-medium",children:["Babysitter Observer"," ",(0,m.jsxs)("span",{className:"rounded-full bg-primary/10 border border-primary/20 px-1.5 py-px text-[10px] font-medium text-primary tabular-nums",children:["v",e.app]})]}),(0,m.jsx)("span",{className:"text-foreground-muted/30 select-none",children:"·"}),(0,m.jsxs)("span",{className:"text-xs font-normal text-foreground-muted",children:["Babysitter"," ",(0,m.jsxs)("span",{className:"rounded-full bg-muted/50 border border-border px-1.5 py-px text-[10px] font-normal text-foreground-muted tabular-nums",children:["v",e.babysitter]})]})]}),(0,m.jsxs)("div",{className:"flex items-center gap-4",children:[(0,m.jsxs)("a",{href:"https://github.com/a5c-ai/babysitter/tree/main/packages/observer-dashboard#readme",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 hover:text-foreground-secondary transition-colors",children:[(0,m.jsx)(tB,{className:"h-3 w-3"}),"Docs"]}),(0,m.jsxs)("a",{href:"https://github.com/a5c-ai/babysitter",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 hover:text-foreground-secondary transition-colors",children:[(0,m.jsx)(tB,{className:"h-3 w-3"}),"Babysitter"]}),(0,m.jsxs)("a",{href:"https://www.a5c.ai/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 hover:text-primary transition-colors",children:["a5c.ai",(0,m.jsx)(tX.ExternalLink,{className:"h-3 w-3"})]})]})]})})}e.s(["Providers",0,function({children:e}){return(0,m.jsx)(x,{children:(0,m.jsx)(g.NotificationProvider,{children:(0,m.jsxs)(v,{children:[(0,m.jsxs)("div",{className:"flex flex-col min-h-screen",children:[(0,m.jsx)(tK,{}),(0,m.jsx)("main",{id:"main-content",className:"flex-1 flex flex-col",children:e}),(0,m.jsx)(t$,{})]}),(0,m.jsx)(td,{})]})})})}],513722)}]);
|
|
5
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return f.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},ta=({contentRef:e,descriptionId:t})=>{let r=tr("DialogDescriptionWarning"),n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${r.contentName}}.`;return f.useEffect(()=>{let r=e.current?.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},to=e.i(497035),ts=e.i(853897),ti=e.i(348890);let tl=[{keys:["?"],description:"Show this help",context:"global"},{keys:["n"],description:"Toggle notifications",context:"global"},{keys:["/"],description:"Focus search",context:"dashboard"},{keys:["j"],description:"Next item",context:"run-detail"},{keys:["k"],description:"Previous item",context:"run-detail"},{keys:["Enter"],description:"Open selected",context:"run-detail"},{keys:["Esc"],description:"Go back / Close",context:"run-detail"},{keys:["e"],description:"Toggle event stream",context:"run-detail"},{keys:["1"],description:"Agent tab",context:"run-detail"},{keys:["2"],description:"Timing tab",context:"run-detail"},{keys:["3"],description:"Logs tab",context:"run-detail"},{keys:["4"],description:"Data tab",context:"run-detail"},{keys:["5"],description:"Approval tab",context:"run-detail"}],tc={global:"Global",dashboard:"Dashboard","run-detail":"Run Detail"};function td(){let[e,t]=(0,f.useState)(!1),r=(0,j.usePathname)(),n=r?.startsWith("/runs/")??!1;(0,ti.useKeyboard)([{key:"?",action:()=>t(!0),description:"Show shortcuts help"},{key:"Escape",action:()=>t(!1),description:"Close shortcuts help"}]),(0,f.useEffect)(()=>{let e=()=>t(!0);return window.addEventListener("open-shortcuts-help",e),()=>window.removeEventListener("open-shortcuts-help",e)},[]);let a=tl.filter(e=>"global"===e.context||"dashboard"===e.context&&!n||"run-detail"===e.context&&!!n).reduce((e,t)=>((e[t.context]??=[]).push(t),e),{});return(0,m.jsx)(eK,{open:e,onOpenChange:t,children:(0,m.jsxs)(eq,{children:[(0,m.jsx)(eY,{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm"}),(0,m.jsxs)(eQ,{className:"fixed left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2 rounded-lg border border-[var(--glass-border)] bg-[var(--glass-bg)] backdrop-blur-xl p-6 shadow-glass w-full max-w-md",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,m.jsx)(e5,{className:"text-sm font-medium text-foreground",children:"Keyboard Shortcuts"}),(0,m.jsx)(e7,{asChild:!0,children:(0,m.jsx)("button",{className:"rounded-md p-2 min-h-[44px] min-w-[44px] flex items-center justify-center text-foreground-muted hover:text-primary transition-colors",children:(0,m.jsx)(ts.X,{className:"h-4 w-4"})})})]}),(0,m.jsx)("div",{className:"space-y-4",children:Object.entries(a).map(([e,t])=>(0,m.jsxs)("div",{children:[(0,m.jsx)("h3",{className:"text-xs font-medium text-foreground-muted uppercase tracking-wider mb-2",children:tc[e]??e}),(0,m.jsx)("div",{className:"space-y-2",children:t.map(({keys:e,description:t})=>(0,m.jsxs)("div",{className:"flex items-center justify-between py-1",children:[(0,m.jsx)("span",{className:"text-sm text-foreground-secondary",children:t}),(0,m.jsx)("div",{className:"flex items-center gap-1",children:e.map(e=>(0,m.jsx)(to.Kbd,{children:e},e))})]},t))})]},e))})]})]})})}var tu=e.i(522016),tm=e.i(273172),tf=e.i(368842),tp=e.i(949201),th=e.i(608646),tx=e.i(999459),tg=e.i(621255);let tb=(0,tg.default)("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);var ty=e.i(700878);let tv={success:(0,m.jsx)(tf.CheckCircle2,{className:"h-4 w-4 text-success drop-shadow-[var(--drop-glow-success)]"}),error:(0,m.jsx)(tp.XCircle,{className:"h-4 w-4 text-error drop-shadow-[var(--drop-glow-error)]"}),warning:(0,m.jsx)(th.AlertTriangle,{className:"h-4 w-4 text-warning drop-shadow-[var(--drop-glow-warning)]"}),info:(0,m.jsx)(tx.Info,{className:"h-4 w-4 text-info drop-shadow-[var(--drop-glow-cyan)]"})},tj={success:"border-l-success",error:"border-l-error",warning:"border-l-warning",info:"border-l-info"};function tw({open:e,notifications:t,onDismiss:r,onClose:n}){let a=(0,j.useRouter)();return(0,m.jsx)(eK,{open:e,onOpenChange:e=>{e||n()},children:(0,m.jsxs)(eq,{children:[(0,m.jsx)(eY,{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm"}),(0,m.jsxs)(eQ,{"data-testid":"notification-panel",className:"fixed right-4 top-4 z-50 rounded-lg border border-[var(--glass-border)] bg-[var(--glass-bg)] backdrop-blur-xl shadow-glass w-full max-w-md max-h-[80vh] flex flex-col",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between p-4 border-b border-[var(--glass-border-subtle)]",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)(tb,{className:"h-4 w-4 text-primary/60"}),(0,m.jsx)(e5,{className:"text-sm font-medium text-foreground",children:"Notifications"}),t.length>0&&(0,m.jsxs)("span",{className:"text-xs text-primary/70 font-mono",children:["(",t.length,")"]})]}),(0,m.jsx)(e7,{asChild:!0,children:(0,m.jsx)("button",{className:"rounded-md p-2 min-h-[44px] min-w-[44px] flex items-center justify-center text-foreground-muted hover:text-primary transition-colors",children:(0,m.jsx)(ts.X,{className:"h-4 w-4"})})})]}),(0,m.jsx)("div",{className:"flex-1 overflow-y-auto p-2",children:0===t.length?(0,m.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-foreground-muted",children:[(0,m.jsx)(tb,{className:"h-8 w-8 mb-2 opacity-50"}),(0,m.jsx)("p",{className:"text-sm",children:"No notifications"})]}):(0,m.jsx)("div",{className:"space-y-2",children:t.map(e=>{var t;let o,s,i;return(0,m.jsx)("div",{"data-testid":`notification-item-${e.id}`,className:(0,tm.cn)("rounded-lg border border-[var(--glass-border-faint)] bg-[var(--glass-card-bg)] p-3 border-l-2","transition-colors duration-150",e.href&&"cursor-pointer hover:bg-[var(--glass-border-faint)]",tj[e.type]),onClick:()=>{e.href&&(a.push(e.href),r(e.id),n())},children:(0,m.jsxs)("div",{className:"flex items-start gap-2",children:[(0,m.jsx)("div",{className:"shrink-0 mt-0.5",children:tv[e.type]}),e.persistent&&(0,m.jsx)("span",{title:"Pinned — won't auto-dismiss",className:"shrink-0",children:(0,m.jsx)(ty.Pin,{className:"h-3 w-3 text-primary/50"})}),(0,m.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,m.jsx)("p",{className:"text-sm font-medium text-foreground",children:e.title}),(0,m.jsx)("p",{className:"text-xs text-foreground-muted mt-0.5",children:e.body}),(0,m.jsxs)("p",{className:"text-xs text-foreground-muted mt-1 opacity-70",children:[(t=e.timestamp,i=Math.floor((s=Math.floor((o=Math.floor((Date.now()-t)/1e3))/60))/60),o<60?"just now":s<60?`${s}m ago`:i<24?`${i}h ago`:new Date(t).toLocaleString()),e.persistent&&(0,m.jsx)("span",{className:"text-primary/50 ml-1",children:"· Pinned"})]})]}),(0,m.jsx)("button",{onClick:t=>{t.stopPropagation(),r(e.id)},className:"shrink-0 rounded-md p-2 min-h-[44px] min-w-[44px] flex items-center justify-center text-foreground-muted hover:text-primary transition-colors",children:(0,m.jsx)(ts.X,{className:"h-3.5 w-3.5"})})]})},e.id)})})})]})]})})}let tN=(0,tg.default)("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);var tk=e.i(355338);let tE=(0,tg.default)("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]),tC=(0,tg.default)("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]),tS=(0,tg.default)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),tM=(0,tg.default)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);var tR=e.i(23406),tP=e.i(86752);let tO=(0,tg.default)("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);var tA=e.i(421509),tD=e.i(781225),tI=e.i(595833);function tT({open:e,onClose:t}){let{theme:r,toggle:n}=h(),[a,o]=(0,f.useState)(null),[s,i]=(0,f.useState)(null),[l,c]=(0,f.useState)(!1),[d,u]=(0,f.useState)([]),[p,x]=(0,f.useState)(2e3),[g,b]=(0,f.useState)("dark"),[y,v]=(0,f.useState)(30),[j,w]=(0,f.useState)([]),[N,k]=(0,f.useState)([]),[E,C]=(0,f.useState)(!1),[S,M]=(0,f.useState)(null),[R,P]=(0,f.useState)(null),O=(0,f.useRef)(null),A=(0,f.useRef)(null);(0,f.useEffect)(()=>{if(!e)return;c(!0),i(null),M(null),P(null),O.current?.abort(),O.current=new AbortController;let t=O.current.signal;return Promise.all([(0,tI.resilientFetch)("/api/config",{signal:t}),(0,tI.resilientFetch)("/api/runs?mode=projects",{signal:t})]).then(([e,t])=>{if(!e.ok){if(e.error.isAborted)return;i(e.error.message);return}let r=e.data;o(r),u(r.sources.map(e=>({...e}))),x(r.pollInterval),b(r.theme),v(r.retentionDays),w(r.hiddenProjects??[]),k(Array.from(new Set([...t.ok?t.data.projects.map(e=>e.projectName):[],...r.hiddenProjects??[]])).sort())}).finally(()=>c(!1)),()=>{O.current?.abort(),A.current?.abort()}},[e]);let D=(0,f.useCallback)((e,t,r)=>{u(n=>n.map((n,a)=>a===e?{...n,[t]:r}:n))},[]),I=(0,f.useCallback)(e=>{u(t=>t.filter((t,r)=>r!==e))},[]),T=(0,f.useCallback)(()=>{u(e=>[...e,{path:"",depth:2}])},[]),L=(0,f.useCallback)(()=>{a&&(u(a.sources.map(e=>({...e}))),x(a.pollInterval),b(a.theme),v(a.retentionDays),w(a.hiddenProjects??[])),M(null),P(null)},[a]),_=(0,f.useCallback)(async()=>{C(!0),M(null),P(null),A.current?.abort(),A.current=new AbortController;let e=await (0,tI.resilientFetch)("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sources:d.filter(e=>e.path.trim()),pollInterval:p,theme:g,retentionDays:y,hiddenProjects:j}),signal:A.current.signal});if(!e.ok){if(e.error.isAborted)return;M("error"),P(e.error.message),C(!1);return}let t=e.data;o(t),u(t.sources.map(e=>({...e}))),x(t.pollInterval),b(t.theme),v(t.retentionDays),w(t.hiddenProjects??[]),M("success"),t.theme!==r&&n(),setTimeout(()=>M(null),2e3),C(!1)},[d,p,g,y,j,r,n]),F=a&&(JSON.stringify(d)!==JSON.stringify(a.sources)||p!==a.pollInterval||g!==a.theme||y!==a.retentionDays||JSON.stringify(j.slice().sort())!==JSON.stringify((a.hiddenProjects??[]).slice().sort()));return(0,m.jsx)(eK,{open:e,onOpenChange:e=>{e||t()},children:(0,m.jsxs)(eq,{children:[(0,m.jsx)(eY,{className:"fixed inset-0 z-50 bg-black/60"}),(0,m.jsx)(eQ,{className:"fixed inset-0 z-50 flex items-center justify-center p-4","data-testid":"settings-modal",children:(0,m.jsxs)("div",{className:"relative z-50 rounded-lg border border-border bg-card shadow-xl w-full max-w-lg max-h-[80vh] flex flex-col",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)(tN,{className:"h-4 w-4 text-foreground-muted"}),(0,m.jsx)(e5,{className:"text-sm font-medium text-foreground",children:"Settings"})]}),(0,m.jsx)(e7,{asChild:!0,children:(0,m.jsx)("button",{className:"rounded-md p-2 min-h-[44px] min-w-[44px] flex items-center justify-center text-foreground-muted hover:text-foreground transition-colors",children:(0,m.jsx)(ts.X,{className:"h-4 w-4"})})})]}),(0,m.jsx)(e6,{asChild:!0,children:(0,m.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:l?(0,m.jsxs)("div",{className:"flex items-center justify-center py-12 text-foreground-muted",children:[(0,m.jsx)(tR.Loader2,{className:"h-4 w-4 animate-spin mr-2"}),(0,m.jsx)("p",{className:"text-sm",children:"Loading configuration..."})]}):s?(0,m.jsxs)("div",{className:"rounded-lg border border-error/20 bg-error-muted p-3 text-sm text-error",children:["Failed to load config: ",s]}):a?(0,m.jsxs)("div",{className:"space-y-5",children:[(0,m.jsxs)("section",{children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,m.jsx)(tk.FolderOpen,{className:"h-4 w-4 text-foreground-muted"}),(0,m.jsx)("span",{className:"text-xs font-medium text-foreground-secondary",children:"Watch Sources"})]}),(0,m.jsx)("div",{className:"space-y-2",children:d.map((e,t)=>(0,m.jsxs)("div",{className:"rounded-md border border-border bg-background p-2.5 space-y-2",children:[(0,m.jsxs)("div",{className:"flex items-start gap-2",children:[(0,m.jsxs)("div",{className:"flex-1",children:[(0,m.jsx)("label",{className:"text-xs uppercase tracking-wider text-foreground-muted mb-1 block",children:"Path"}),(0,m.jsx)("input",{type:"text",value:e.path,onChange:e=>D(t,"path",e.target.value),placeholder:"/path/to/projects",className:"w-full rounded-md border border-border bg-background-secondary px-2.5 py-1.5 font-mono text-xs text-foreground placeholder:text-foreground-muted/50 focus:outline-none focus:ring-1 focus:ring-primary/50"})]}),(0,m.jsx)("button",{onClick:()=>I(t),className:"mt-4 rounded-md p-2 min-h-[44px] min-w-[44px] flex items-center justify-center text-foreground-muted hover:text-error hover:bg-error/10 transition-colors",title:"Remove source",children:(0,m.jsx)(tM,{className:"h-3.5 w-3.5"})})]}),(0,m.jsx)("div",{className:"flex items-center gap-3",children:(0,m.jsxs)("div",{className:"w-20",children:[(0,m.jsx)("label",{className:"text-xs uppercase tracking-wider text-foreground-muted mb-1 block",children:"Depth"}),(0,m.jsx)("input",{type:"number",value:e.depth,onChange:e=>D(t,"depth",Math.max(0,Math.min(10,parseInt(e.target.value)||0))),min:0,max:10,className:"w-full rounded-md border border-border bg-background-secondary px-2.5 py-1.5 font-mono text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary/50"})]})})]},t))}),(0,m.jsxs)("button",{onClick:T,className:"mt-2 flex items-center gap-1.5 rounded-md px-2.5 py-1.5 min-h-[44px] text-xs text-foreground-muted hover:text-foreground hover:bg-background-secondary transition-colors",children:[(0,m.jsx)(tS,{className:"h-3.5 w-3.5"}),"Add Source"]})]}),(0,m.jsxs)("section",{children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,m.jsx)(tE,{className:"h-4 w-4 text-foreground-muted"}),(0,m.jsx)("span",{className:"text-xs font-medium text-foreground-secondary",children:"Poll Interval"})]}),(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)("input",{type:"number",value:p,onChange:e=>x(Math.max(500,parseInt(e.target.value)||500)),min:500,step:500,className:"w-28 rounded-md border border-border bg-background-secondary px-2.5 py-1.5 font-mono text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,m.jsx)("span",{className:"text-xs text-foreground-muted",children:"ms"})]})]}),(0,m.jsxs)("section",{children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,m.jsx)(tC,{className:"h-4 w-4 text-foreground-muted"}),(0,m.jsx)("span",{className:"text-xs font-medium text-foreground-secondary",children:"Theme"})]}),(0,m.jsx)("div",{className:"flex rounded-md border border-border overflow-hidden",children:["dark","light"].map(e=>(0,m.jsx)("button",{onClick:()=>b(e),className:(0,tm.cn)("flex-1 px-4 py-1.5 min-h-[44px] text-xs font-medium transition-colors capitalize",g===e?"bg-primary/15 text-primary":"bg-background-secondary text-foreground-muted hover:text-foreground"),children:e},e))})]}),(0,m.jsxs)("section",{children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,m.jsx)(tO,{className:"h-4 w-4 text-foreground-muted"}),(0,m.jsx)("span",{className:"text-xs font-medium text-foreground-secondary",children:"Run Retention"})]}),(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)("span",{className:"text-xs text-foreground-muted",children:"Show runs from the last"}),(0,m.jsx)("input",{type:"number",value:y,onChange:e=>v(Math.max(1,Math.min(365,parseInt(e.target.value)||30))),min:1,max:365,className:"w-20 rounded-md border border-border bg-background-secondary px-2.5 py-1.5 font-mono text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,m.jsx)("span",{className:"text-xs text-foreground-muted",children:"days"})]}),(0,m.jsx)("p",{className:"text-xs text-foreground-muted mt-1.5",children:"Older completed/failed runs are hidden from the dashboard. Active runs are always shown."})]}),N.length>0&&(0,m.jsxs)("section",{children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,m.jsx)(tA.Eye,{className:"h-4 w-4 text-foreground-muted"}),(0,m.jsx)("span",{className:"text-xs font-medium text-foreground-secondary",children:"Project Visibility"})]}),(0,m.jsx)("p",{className:"text-xs text-foreground-muted mb-2",children:"Hidden projects will not appear on the dashboard."}),(0,m.jsx)("div",{className:"space-y-1",children:N.map(e=>{let t=j.includes(e);return(0,m.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-border bg-background px-2.5 py-1.5",children:[(0,m.jsx)("span",{className:(0,tm.cn)("text-xs font-mono truncate",t?"text-foreground-muted line-through":"text-foreground"),children:e}),(0,m.jsx)("button",{onClick:()=>{w(r=>t?r.filter(t=>t!==e):[...r,e])},className:(0,tm.cn)("rounded-md p-2 min-h-[44px] min-w-[44px] flex items-center justify-center transition-colors",t?"text-foreground-muted hover:text-foreground hover:bg-background-secondary":"text-foreground-secondary hover:text-foreground-muted hover:bg-background-secondary"),title:t?"Show project":"Hide project",children:t?(0,m.jsx)(tD.EyeOff,{className:"h-3.5 w-3.5"}):(0,m.jsx)(tA.Eye,{className:"h-3.5 w-3.5"})})]},e)})})]}),"success"===S&&(0,m.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-success/20 bg-success/5 px-3 py-2 text-xs text-success",children:[(0,m.jsx)(tP.Check,{className:"h-3.5 w-3.5"}),"Settings saved successfully"]}),"error"===S&&(0,m.jsx)("div",{className:"rounded-md border border-error/20 bg-error/5 px-3 py-2 text-xs text-error",children:R||"Failed to save settings"})]}):null})}),a&&(0,m.jsxs)("div",{className:"flex items-center justify-between border-t border-border px-4 py-3",children:[(0,m.jsxs)("p",{className:"text-xs text-foreground-muted",children:["Config file: ",(0,m.jsx)("span",{className:"font-mono",children:"~/.a5c/observer.json"})]}),(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)("button",{onClick:L,disabled:E,className:"rounded-md px-3 py-1.5 min-h-[44px] text-xs text-foreground-muted hover:text-foreground hover:bg-background-secondary transition-colors disabled:opacity-50",children:"Cancel"}),(0,m.jsx)("button",{onClick:_,disabled:E||!F,className:(0,tm.cn)("rounded-md px-3 py-1.5 min-h-[44px] text-xs font-medium transition-colors",F?"bg-primary text-primary-foreground hover:bg-primary/90":"bg-background-secondary text-foreground-muted cursor-not-allowed",E&&"opacity-50"),children:E?(0,m.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,m.jsx)(tR.Loader2,{className:"h-3 w-3 animate-spin"}),"Saving..."]}):"Save"})]})]})]})})]})})}let tL=(0,tg.default)("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),t_=(0,tg.default)("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]),tF=(0,tg.default)("HelpCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),tW=(0,tg.default)("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]),tz=(0,tg.default)("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),tB=(0,tg.default)("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);function tK(){let{theme:e,toggle:t}=h(),{connected:r}=(0,b.useEventStream)(),{notifications:n,dismiss:a}=(0,g.useNotificationContext)(),[o,s]=(0,f.useState)(!1),[i,l]=(0,f.useState)(!1),c=(0,f.useCallback)(()=>{s(e=>!e)},[]);return(0,ti.useKeyboard)([{key:"n",action:c,description:"Toggle notifications"}]),(0,f.useEffect)(()=>{let e=()=>l(!0);return window.addEventListener("open-settings",e),()=>window.removeEventListener("open-settings",e)},[]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("a",{href:"#main-content",className:"sr-only focus:not-sr-only focus:absolute focus:top-2 focus:left-2 focus:z-[100] focus:px-4 focus:py-2 focus:bg-primary focus:text-primary-foreground focus:rounded-md",children:"Skip to main content"}),(0,m.jsx)("header",{className:"sticky top-0 z-30 border-b border-border bg-background/80 backdrop-blur-md",children:(0,m.jsxs)("div",{className:"mx-auto max-w-[1600px] px-6 py-3 flex items-center gap-3",children:[(0,m.jsx)(tA.Eye,{className:"h-5 w-5 text-primary"}),(0,m.jsx)("h1",{className:"text-base font-semibold",children:(0,m.jsx)(tu.default,{href:"/",className:"text-foreground hover:text-primary transition-colors",children:"Babysitter Observer"})}),(0,m.jsx)("a",{href:"https://www.a5c.ai/",target:"_blank",rel:"noopener noreferrer",className:"text-xs leading-tight font-medium text-primary/60 hover:text-primary transition-colors hidden sm:block",children:"a5c.ai"}),(0,m.jsx)("a",{href:"https://github.com/a5c-ai/babysitter",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs text-foreground-muted hover:text-foreground-secondary transition-colors hidden sm:block",title:"Babysitter on GitHub",children:(0,m.jsx)(tB,{className:"h-3.5 w-3.5"})}),(0,m.jsx)("span",{className:"text-xs text-foreground-muted hidden md:block",children:"Real-time orchestration dashboard"}),(0,m.jsxs)("div",{className:"ml-auto flex items-center gap-1.5",children:[(0,m.jsxs)("span",{"data-testid":"sse-status",role:"status","aria-live":"polite",className:(0,tm.cn)("inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium mr-1 transition-all",r?"bg-success/10 text-success border border-success/20":"bg-error/10 text-error border border-error/20"),title:r?"Live updates connected":"Live updates disconnected",children:[r?(0,m.jsx)(tW,{className:"h-3 w-3"}):(0,m.jsx)(tz,{className:"h-3 w-3"}),(0,m.jsx)("span",{className:"hidden sm:inline",children:r?"Live":"Offline"})]}),(0,m.jsxs)("button",{"data-testid":"notification-bell",onClick:c,className:"relative rounded-md p-2 min-h-[44px] min-w-[44px] flex items-center justify-center text-foreground-muted hover:text-foreground-secondary hover:bg-background-secondary transition-colors",title:"Notifications","aria-label":`Notifications${n.length>0?` (${n.length} unread)`:""}`,children:[(0,m.jsx)(tb,{className:"h-4 w-4"}),n.length>0&&(0,m.jsx)("span",{"data-testid":"notification-badge",className:"absolute -top-0.5 -right-0.5 flex h-4 w-4 items-center justify-center rounded-full bg-primary text-[10px] font-bold text-primary-foreground tabular-nums",children:n.length>9?"9+":n.length})]}),(0,m.jsx)("button",{onClick:()=>window.dispatchEvent(new CustomEvent("open-shortcuts-help")),className:"rounded-md p-2 min-h-[44px] min-w-[44px] flex items-center justify-center text-foreground-muted hover:text-foreground-secondary hover:bg-background-secondary transition-colors",title:"Keyboard shortcuts","aria-label":"Keyboard shortcuts",children:(0,m.jsx)(tF,{className:"h-4 w-4"})}),(0,m.jsx)("button",{onClick:()=>l(!0),className:"rounded-md p-2 min-h-[44px] min-w-[44px] flex items-center justify-center text-foreground-muted hover:text-foreground-secondary hover:bg-background-secondary transition-colors",title:"Settings","aria-label":"Settings",children:(0,m.jsx)(tN,{className:"h-4 w-4"})}),(0,m.jsx)("button",{"data-testid":"theme-toggle",onClick:t,className:"rounded-md p-2 min-h-[44px] min-w-[44px] flex items-center justify-center text-foreground-muted hover:text-foreground-secondary hover:bg-background-secondary transition-colors",title:`Switch to ${"dark"===e?"light":"dark"} theme`,"aria-label":`Switch to ${"dark"===e?"light":"dark"} theme`,children:"dark"===e?(0,m.jsx)(tL,{className:"h-4 w-4"}):(0,m.jsx)(t_,{className:"h-4 w-4"})})]})]})}),(0,m.jsx)(tw,{open:o,notifications:n,onDismiss:a,onClose:()=>s(!1)}),(0,m.jsx)(tT,{open:i,onClose:()=>l(!1)})]})}var tH=e.i(247167),tX=e.i(448647);function t$(){let[e,t]=(0,f.useState)({app:"6.0.2",babysitter:tH.default.env.NEXT_PUBLIC_BABYSITTER_VERSION||"…"});return(0,f.useEffect)(()=>{fetch("/api/version").then(e=>e.json()).then(e=>{(e.app||e.babysitter)&&t(t=>({app:e.app||t.app,babysitter:e.babysitter||t.babysitter}))}).catch(()=>{})},[]),(0,m.jsx)("footer",{className:"border-t border-border bg-background/80 backdrop-blur-sm",children:(0,m.jsxs)("div",{className:"mx-auto max-w-[1600px] px-6 py-3 flex flex-wrap items-center justify-between gap-3 text-xs text-foreground-muted",children:[(0,m.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,m.jsx)(tA.Eye,{className:"h-3.5 w-3.5 text-primary/40"}),(0,m.jsxs)("span",{className:"font-medium",children:["Babysitter Observer"," ",(0,m.jsxs)("span",{className:"rounded-full bg-primary/10 border border-primary/20 px-1.5 py-px text-[10px] font-medium text-primary tabular-nums",children:["v",e.app]})]}),(0,m.jsx)("span",{className:"text-foreground-muted/30 select-none",children:"·"}),(0,m.jsxs)("span",{className:"text-xs font-normal text-foreground-muted",children:["Babysitter"," ",(0,m.jsxs)("span",{className:"rounded-full bg-muted/50 border border-border px-1.5 py-px text-[10px] font-normal text-foreground-muted tabular-nums",children:["v",e.babysitter]})]})]}),(0,m.jsxs)("div",{className:"flex items-center gap-4",children:[(0,m.jsxs)("a",{href:"https://github.com/a5c-ai/babysitter/tree/main/packages/observer-dashboard#readme",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 hover:text-foreground-secondary transition-colors",children:[(0,m.jsx)(tB,{className:"h-3 w-3"}),"Docs"]}),(0,m.jsxs)("a",{href:"https://github.com/a5c-ai/babysitter",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 hover:text-foreground-secondary transition-colors",children:[(0,m.jsx)(tB,{className:"h-3 w-3"}),"Babysitter"]}),(0,m.jsxs)("a",{href:"https://www.a5c.ai/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 hover:text-primary transition-colors",children:["a5c.ai",(0,m.jsx)(tX.ExternalLink,{className:"h-3 w-3"})]})]})]})})}e.s(["Providers",0,function({children:e}){return(0,m.jsx)(x,{children:(0,m.jsx)(g.NotificationProvider,{children:(0,m.jsxs)(v,{children:[(0,m.jsxs)("div",{className:"flex flex-col min-h-screen",children:[(0,m.jsx)(tK,{}),(0,m.jsx)("main",{id:"main-content",className:"flex-1 flex flex-col",children:e}),(0,m.jsx)(t$,{})]}),(0,m.jsx)(td,{})]})})})}],513722)}]);
|