octomux 1.0.8 → 1.0.10

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.
@@ -0,0 +1 @@
1
+ import{j as e,r as n}from"./vendor-react-BZ8ItZjw.js";import{c as ne,D as le,a as de,b as ce,d as ue,e as xe,L as F,T as se,B as m,f as p,I as te,P as re,g as ae,h as oe,u as he,S as me,i as pe,E as fe}from"./index-DrO4cTNw.js";import{TerminalView as ie}from"./TerminalView-CguHyqU9.js";import{b as ge,a as je,d as ve}from"./vendor-router-DRLGqALp.js";import"./vendor-ui-BEZHWVRx.js";import"./vendor-xterm-DvXGiZvM.js";function we({agents:o,activeIndex:f,onSelect:s,onAddAgent:t,onStopAgent:u,canAddAgent:g,userTerminals:d=[],onAddTerminal:i,onCloseTerminal:x}){return e.jsxs("div",{className:"flex items-center gap-1 border-b border-border px-1 pb-1",children:[o.filter(l=>l.status!=="stopped").map(l=>e.jsxs("div",{className:"group flex items-center",children:[e.jsxs("button",{className:ne("rounded-t-md px-3 py-1.5 text-sm transition-colors",l.window_index===f?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>s(l.window_index),children:[l.label,l.status==="running"&&e.jsx("span",{className:`ml-1.5 inline-block h-1.5 w-1.5 rounded-full ${l.hook_activity==="waiting"?"bg-amber-500":l.hook_activity==="idle"?"bg-zinc-400":"animate-pulse bg-green-400"}`})]}),l.status==="running"&&e.jsx("button",{className:"ml-0.5 hidden rounded p-0.5 text-muted-foreground hover:text-destructive group-hover:inline-flex",onClick:b=>{b.stopPropagation(),u(l.id)},title:"Stop agent",children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 6 6 18"}),e.jsx("path",{d:"m6 6 12 12"})]})})]},l.id)),g&&e.jsx(be,{onAdd:t}),(d.length>0||i)&&e.jsx("div",{"data-testid":"tab-separator",className:"mx-1 h-5 w-px bg-border"}),d.map(l=>e.jsxs("div",{className:"group flex items-center",children:[e.jsxs("button",{className:ne("rounded-t-md px-3 py-1.5 text-sm transition-colors",l.window_index===f?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>s(l.window_index),children:[l.label,e.jsx("span",{className:`ml-1.5 inline-block h-1.5 w-1.5 rounded-full ${l.status==="working"?"animate-pulse bg-green-400":"bg-zinc-400"}`})]}),x&&e.jsx("button",{className:"ml-0.5 hidden rounded p-0.5 text-muted-foreground hover:text-destructive group-hover:inline-flex",onClick:b=>{b.stopPropagation(),x(l.id)},title:"Close terminal",children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 6 6 18"}),e.jsx("path",{d:"m6 6 12 12"})]})})]},l.id)),i&&e.jsx("button",{className:"rounded-t-md px-2 py-1.5 text-sm text-muted-foreground hover:text-foreground",onClick:i,title:"Add terminal",children:"+"})]})}function be({onAdd:o}){const[f,s]=n.useState(!1),[t,u]=n.useState("");function g(){o(t.trim()||void 0),u(""),s(!1)}function d(){o()}return e.jsxs(le,{open:f,onOpenChange:s,children:[e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx("button",{className:"rounded-t-md px-2 py-1.5 text-sm text-muted-foreground hover:text-foreground",onClick:d,title:"Add agent without prompt",children:"+"}),e.jsx(de,{render:e.jsx("button",{className:"rounded px-1 py-1 text-xs text-muted-foreground hover:text-foreground",title:"Add agent with prompt"}),children:"..."})]}),e.jsxs(ce,{className:"sm:max-w-md",children:[e.jsx(ue,{children:e.jsx(xe,{children:"Add Agent"})}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(F,{htmlFor:"agent-prompt",children:"Initial Prompt (optional)"}),e.jsx(se,{id:"agent-prompt",placeholder:"Write tests for the authentication module...",rows:3,value:t,onChange:i=>u(i.target.value)})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(m,{variant:"ghost",onClick:()=>s(!1),children:"Cancel"}),e.jsx(m,{onClick:g,children:"Add Agent"})]})]})]})]})}function Ne({task:o,onSaved:f,onStart:s}){const[t,u]=n.useState(o.title),[g,d]=n.useState(o.description),[i,x]=n.useState(o.repo_path),[l,b]=n.useState(o.branch??""),[v,z]=n.useState(o.base_branch??""),[h,C]=n.useState(o.initial_prompt??""),[S,I]=n.useState(!!o.initial_prompt),[M,N]=n.useState([]),[U,_]=n.useState(""),[B,D]=n.useState(!1),[T,R]=n.useState(!1),[k,$]=n.useState(null),[q,G]=n.useState(!1),[W,E]=n.useState(!1),[H,V]=n.useState(null),[J,L]=n.useState(!1),j=n.useRef(v);j.current=v,n.useEffect(()=>{const a=i.trim();if(!a){N([]);return}let r=!1;const c=setTimeout(async()=>{try{const[y,w]=await Promise.all([p.listBranches(a),p.getDefaultBranch(a)]);r||(N(y),j.current||z(w.branch))}catch{r||N([])}},300);return()=>{r=!0,clearTimeout(c)}},[i]);const O=M.filter(a=>a.toLowerCase().includes(U.toLowerCase())),A=n.useCallback(async a=>{G(!0);try{const r=await p.browse(a);$(r)}catch{}finally{G(!1)}},[]);n.useEffect(()=>{T&&!k&&A()},[T,k,A]);function K(a){x(a),R(!1)}async function X(){if(!(!t.trim()||!g.trim()||!i.trim())){E(!0),V(null),L(!1);try{await p.updateTask(o.id,{title:t.trim(),description:g.trim(),repo_path:i.trim(),branch:l.trim()||void 0,base_branch:v.trim()||void 0,initial_prompt:h.trim()||void 0}),L(!0),f(),setTimeout(()=>L(!1),2e3)}catch(a){V(a.message)}finally{E(!1)}}}const Q=t.trim()&&g.trim()&&i.trim()&&!W;return e.jsx("div",{className:"mx-auto max-w-2xl p-6",children:e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(F,{htmlFor:"edit-title",children:"Title"}),e.jsx(te,{id:"edit-title",value:t,onChange:a=>u(a.target.value),placeholder:"Task title"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(F,{htmlFor:"edit-description",children:"Description"}),e.jsx(se,{id:"edit-description",value:g,onChange:a=>d(a.target.value),placeholder:"Task description",rows:3})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(F,{htmlFor:"edit-repo-path",children:"Repository Path"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(te,{id:"edit-repo-path",className:"flex-1 font-mono text-sm",value:i,onChange:a=>x(a.target.value),placeholder:"/Users/you/projects/my-repo"}),e.jsxs(re,{open:T,onOpenChange:R,children:[e.jsx(ae,{render:e.jsx(m,{type:"button",variant:"outline",className:"shrink-0",children:"Browse"})}),e.jsx(oe,{align:"end",side:"bottom",sideOffset:4,className:"w-[420px] p-0",children:e.jsx(ke,{data:k,loading:q,onNavigate:A,onSelect:K})})]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(F,{htmlFor:"edit-branch",children:"Branch Name"}),e.jsx(te,{id:"edit-branch",className:"font-mono text-sm",value:l,onChange:a=>b(a.target.value),placeholder:"feat/my-feature"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(F,{children:"Base Branch"}),e.jsxs(re,{open:B,onOpenChange:D,children:[e.jsx(ae,{render:e.jsxs("button",{type:"button",className:"flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[e.jsx("span",{className:v?"font-mono text-xs":"text-muted-foreground",children:v||"Select base branch..."}),e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})]})}),e.jsx(oe,{align:"start",side:"bottom",sideOffset:4,className:"w-[--trigger-width] p-0",children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{className:"border-b border-border px-3 py-2",children:e.jsx("input",{type:"text",placeholder:"Search branches...",className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",value:U,onChange:a=>_(a.target.value),autoFocus:!0})}),e.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[O.length===0&&e.jsx("div",{className:"px-3 py-3 text-center text-xs text-muted-foreground",children:M.length===0?"Select a repository first":"No matching branches"}),O.map(a=>e.jsx("button",{type:"button",className:`flex w-full items-center px-3 py-1.5 text-left text-sm hover:bg-muted transition-colors ${a===v?"bg-muted font-medium":""}`,onClick:()=>{z(a),_(""),D(!1)},children:e.jsx("span",{className:"font-mono text-xs truncate",children:a})},a))]})]})})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("button",{type:"button",className:"w-fit cursor-pointer border-0 bg-transparent p-0 text-xs text-muted-foreground outline-0 ring-0 hover:text-foreground transition-colors text-left focus:outline-0 focus:ring-0 focus-visible:outline-0 focus-visible:ring-0",onClick:()=>I(!S),children:S?"- Hide initial prompt":"+ Add initial prompt"}),S&&e.jsx(se,{id:"edit-initial-prompt",placeholder:"Custom prompt to send to the agent on start...",rows:4,value:h,onChange:a=>C(a.target.value)})]}),H&&e.jsx("p",{className:"text-sm text-destructive",children:H}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{onClick:X,disabled:!Q,children:W?"Saving...":"Save"}),e.jsx(m,{variant:"outline",onClick:s,children:"Start"}),J&&e.jsx("span",{className:"text-sm text-emerald-500",children:"Saved"})]})]})})}function ke({data:o,loading:f,onNavigate:s,onSelect:t}){return!o&&f?e.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"Loading..."}):o?e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[e.jsx("button",{type:"button",disabled:!o.parent,className:"shrink-0 rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-30 disabled:hover:bg-transparent",onClick:()=>o.parent&&s(o.parent),children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m15 18-6-6 6-6"})})}),e.jsx("span",{className:"font-mono text-xs text-muted-foreground truncate direction-rtl text-left",children:o.current})]}),e.jsxs("div",{className:"max-h-[280px] overflow-y-auto",children:[o.entries.length===0&&e.jsx("div",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:"No subdirectories"}),o.entries.map(u=>e.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm hover:bg-muted transition-colors",onClick:()=>s(u.path),onDoubleClick:()=>u.isGit&&t(u.path),children:[e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:u.isGit?"text-emerald-500":"text-muted-foreground",children:e.jsx("path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"})}),e.jsxs("span",{className:"font-mono text-xs truncate",children:[u.name,e.jsx("span",{className:"text-muted-foreground",children:"/"})]}),u.isGit&&e.jsx("span",{className:"ml-auto shrink-0 rounded bg-emerald-500/10 px-1.5 py-0.5 text-[10px] font-medium text-emerald-600 dark:text-emerald-400",children:"git"})]},u.path))]}),e.jsxs("div",{className:"flex items-center justify-between border-t border-border px-3 py-2",children:[e.jsxs("div",{className:"flex flex-col truncate mr-2",children:[e.jsx("span",{className:"font-mono text-[10px] text-muted-foreground truncate",children:o.current}),e.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"Double-click a git repo to select it"})]}),e.jsx(m,{type:"button",size:"sm",className:"shrink-0 h-7 text-xs",onClick:()=>t(o.current),children:"Select"})]})]}):null}const Z=new Map;function Le(){Z.clear()}function Ae(){var Q,a;const{id:o}=ge(),f=je(),s=o??"",{task:t,loading:u,error:g,refresh:d}=he(s),[i,x]=n.useState(null),[l,b]=n.useState(!1),[v,z]=n.useState(!1),[h,C]=n.useState("agents"),[S,I]=n.useState(!1),[M]=ve(),N=M.get("agent"),[U,_]=n.useState(null),B=(t==null?void 0:t.user_window_index)??U,D=n.useRef(s),T=n.useRef(i),R=n.useRef(h);T.current=i,R.current=h,n.useEffect(()=>{const r=D.current;if(r!==s){Z.set(r,{activeWindow:T.current,mode:R.current});const c=Z.get(s);x((c==null?void 0:c.activeWindow)??null),C((c==null?void 0:c.mode)??"agents"),_(null),D.current=s}},[s]),n.useEffect(()=>{s&&Z.set(s,{activeWindow:i,mode:h})},[s,i,h]);const k=((a=(Q=t==null?void 0:t.agents)==null?void 0:Q[0])==null?void 0:a.window_index)??null;n.useEffect(()=>{if(N&&(t!=null&&t.agents)){const r=t.agents.find(c=>c.id===N);if(r){x(r.window_index);return}}i===null&&k!==null&&x(k)},[k,i,N,t==null?void 0:t.agents]),n.useEffect(()=>{t&&t.status!=="running"&&(C("agents"),_(null))},[t==null?void 0:t.status]);const $=n.useCallback(async r=>{if(s)try{const c=await p.addAgent(s,r?{prompt:r}:void 0);x(c.window_index),d()}catch(c){console.error("Failed to add agent:",c)}},[s,d]),q=n.useCallback(async r=>{if(s)try{const c=(t==null?void 0:t.agents)||[],y=c.find(w=>w.id===r);if(await p.stopAgent(s,r),y&&y.window_index===i){const w=c.find(P=>P.id!==r&&P.status!=="stopped");w&&x(w.window_index)}d()}catch(c){console.error("Failed to stop agent:",c)}},[s,d,t,i]),G=n.useCallback(async()=>{if(s)try{await p.updateTask(s,{status:"closed"}),d()}catch(r){console.error("Failed to close task:",r)}},[s,d]),W=n.useCallback(async()=>{if(s)try{await p.startTask(s),d()}catch(r){console.error("Failed to start task:",r)}},[s,d]),E=n.useCallback(async()=>{if(s){b(!0);try{await p.updateTask(s,{status:"running"}),d()}catch(r){console.error("Failed to resume task:",r)}finally{b(!1)}}},[s,d]),H=n.useCallback(async()=>{if(s)try{const r=await p.createTerminal(s);x(r.window_index),d()}catch(r){console.error("Failed to create terminal:",r)}},[s,d]),V=n.useCallback(async r=>{if(s)try{const c=(t==null?void 0:t.user_terminals)||[],y=c.find(w=>w.id===r);if(await p.closeTerminal(s,r),y&&y.window_index===i){const P=((t==null?void 0:t.agents)||[]).find(ee=>ee.status!=="stopped"),Y=c.find(ee=>ee.id!==r);x((P==null?void 0:P.window_index)??(Y==null?void 0:Y.window_index)??null)}d()}catch(c){console.error("Failed to close terminal:",c)}},[s,d,t,i]),J=n.useCallback(async()=>{if(h==="editor"){C("agents");return}if(B===null){if(S)return;I(!0);try{const r=await p.createUserTerminal(s);_(r.user_window_index),d()}catch(r){console.error("Failed to create user terminal:",r);return}finally{I(!1)}}C("editor")},[h,B,s,S,d]);if(u)return e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:"Loading..."});if(!t)return e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-4",children:[e.jsx("p",{className:"text-destructive",children:g||"Task not found"}),e.jsx(m,{variant:"outline",onClick:()=>f("/"),children:"Back to Dashboard"})]});const L=t.agents||[],j=t.status==="running",O=t.status==="draft",A=(t.status==="closed"||t.status==="error")&&!!t.worktree,K=t.status==="running"||t.status==="setting_up",X=!!t.tmux_session&&L.length>0&&i!==null&&K;return e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2 sm:px-4 sm:py-3",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[e.jsxs(m,{variant:"ghost",size:"sm",className:"shrink-0",onClick:()=>f("/"),children:[e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","data-icon":"inline-start",children:e.jsx("path",{d:"m15 18-6-6 6-6"})}),e.jsx("span",{className:"hidden sm:inline",children:"Tasks"})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h1",{className:"truncate text-base font-semibold sm:text-lg",children:t.title}),e.jsx(me,{status:t.derived_status||t.status})]}),e.jsx("p",{className:"hidden max-w-xl truncate text-xs text-muted-foreground sm:block",children:t.description})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1 sm:gap-2",children:[t.pr_url&&e.jsxs("a",{href:t.pr_url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-400 hover:underline sm:text-sm",children:["PR #",t.pr_number]}),A&&e.jsx(m,{variant:"default",size:"sm",disabled:l,onClick:E,children:l?"...":"Resume"}),j&&!!t.tmux_session&&e.jsxs(m,{variant:h==="editor"?"default":"outline",size:"sm",onClick:J,children:[e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"16 18 22 12 16 6"}),e.jsx("polyline",{points:"8 6 2 12 8 18"})]}),e.jsx("span",{className:"hidden sm:inline",children:"Editor"})]}),O&&e.jsx(m,{variant:"default",size:"sm",onClick:W,children:"Start"}),j&&e.jsx(m,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:G,children:"Close"})]})]}),t.error&&e.jsx("div",{className:"border-b border-destructive/30 bg-destructive/10 px-4 py-2 text-sm text-destructive",children:t.error}),e.jsxs("div",{className:"border-b border-border",children:[e.jsxs("button",{onClick:()=>z(r=>!r),className:"flex w-full items-center gap-1.5 px-4 py-1.5 text-xs text-muted-foreground hover:bg-muted/50",children:[e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`transition-transform ${v?"rotate-90":""}`,children:e.jsx("path",{d:"m9 18 6-6-6-6"})}),"Details"]}),v&&e.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-6 gap-y-1 px-4 pb-3 text-xs",children:[t.repo_path&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:"Repo"}),e.jsx("span",{className:"font-mono text-muted-foreground",children:t.repo_path})]}),t.branch&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:"Branch"}),e.jsx("span",{className:"font-mono text-muted-foreground",children:t.branch})]}),t.base_branch&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:"Base"}),e.jsx(pe,{variant:"outline",className:"w-fit text-xs font-normal",children:t.base_branch})]}),t.pr_url&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:"PR"}),e.jsxs("a",{href:t.pr_url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:underline",children:["#",t.pr_number," — ",t.pr_url]})]}),t.created_at&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:"Created"}),e.jsx("span",{className:"text-muted-foreground",children:new Date(t.created_at).toLocaleString()})]}),t.updated_at&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:"Updated"}),e.jsx("span",{className:"text-muted-foreground",children:new Date(t.updated_at).toLocaleString()})]})]})]}),X?e.jsxs("div",{className:h==="agents"?"flex min-h-0 flex-1 flex-col":"hidden",children:[e.jsx(we,{agents:L,activeIndex:i,onSelect:x,onAddAgent:$,onStopAgent:q,canAddAgent:j,userTerminals:j?t.user_terminals||[]:[],onAddTerminal:j?H:void 0,onCloseTerminal:j?V:void 0}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden p-1",children:e.jsx(ie,{taskId:t.id,windowIndex:i,visible:h==="agents"})})]}):O?e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx(Ne,{task:t,onSaved:d,onStart:W})}):e.jsx("div",{className:h==="agents"?"flex flex-1 flex-col items-center justify-center gap-3 text-muted-foreground":"hidden",children:t.status==="setting_up"?"Setting up terminal...":t.status==="closed"||t.status==="error"?e.jsxs(e.Fragment,{children:[e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground/50",children:[e.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),e.jsx("path",{d:"m7 8 4 4-4 4"}),e.jsx("path",{d:"M13 16h4"})]}),e.jsx("span",{className:"text-sm",children:"Terminal session ended"}),A&&e.jsx(m,{variant:"default",size:"sm",disabled:l,onClick:E,children:l?"Resuming...":"Resume"})]}):e.jsx(fe,{icon:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),e.jsx("path",{d:"m7 8 4 4-4 4"}),e.jsx("path",{d:"M13 16h4"})]}),heading:"No agents running",subtext:"Add an agent to start working on this task",action:j?e.jsx(m,{variant:"default",size:"sm",onClick:()=>$(),children:"Add Agent"}):void 0})}),B!==null&&h==="editor"&&e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden p-1",children:e.jsx(ie,{taskId:t.id,windowIndex:B})})})]})}export{Le as _resetPerTaskUiState,Ae as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalView-CguHyqU9.js","assets/vendor-react-BZ8ItZjw.js","assets/vendor-xterm-DvXGiZvM.js","assets/vendor-xterm-DYP7pi_n.css","assets/TaskDetail-DsKJCcdC.js","assets/vendor-router-DRLGqALp.js","assets/vendor-ui-BEZHWVRx.js"])))=>i.map(i=>d[i]);
2
+ var As=Object.defineProperty;var Rs=(e,s,r)=>s in e?As(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r;var Tt=(e,s,r)=>Rs(e,typeof s!="symbol"?s+"":s,r);import{c as g,d as Ms,r as m,j as t,e as Bs}from"./vendor-react-BZ8ItZjw.js";import{u as Is,a as Je,b as Ps,L as Gt,O as Ds,R as Os,c as rt,B as $s}from"./vendor-router-DRLGqALp.js";import{u as Fs,m as Ws,B as Vs,P as Hs,a as Gs,b as Us,c as Ys,d as Ks,D as qs,e as Xs,f as Js,g as Zs,h as Qs,i as er,j as tr,I as sr}from"./vendor-ui-BEZHWVRx.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))o(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&o(u)}).observe(document,{childList:!0,subtree:!0});function r(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function o(a){if(a.ep)return;a.ep=!0;const l=r(a);fetch(a.href,l)}})();const rr="modulepreload",or=function(e){return"/"+e},Et={},Ut=function(s,r,o){let a=Promise.resolve();if(r&&r.length>0){let u=function(i){return Promise.all(i.map(f=>Promise.resolve(f).then(n=>({status:"fulfilled",value:n}),n=>({status:"rejected",reason:n}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),c=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));a=u(r.map(i=>{if(i=or(i),i in Et)return;Et[i]=!0;const f=i.endsWith(".css"),n=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${i}"]${n}`))return;const p=document.createElement("link");if(p.rel=f?"stylesheet":rr,f||(p.as="script"),p.crossOrigin="",p.href=i,c&&p.setAttribute("nonce",c),document.head.appendChild(p),f)return new Promise((N,C)=>{p.addEventListener("load",N),p.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${i}`)))})}))}function l(u){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=u,window.dispatchEvent(d),!d.defaultPrevented)throw u}return a.then(u=>{for(const d of u||[])d.status==="rejected"&&l(d.reason);return s().catch(l)})};function nr(e){if(typeof document>"u")return;let s=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",s.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const ar=e=>{switch(e){case"success":return cr;case"info":return ur;case"warning":return dr;case"error":return mr;default:return null}},ir=Array(12).fill(0),lr=({visible:e,className:s})=>g.createElement("div",{className:["sonner-loading-wrapper",s].filter(Boolean).join(" "),"data-visible":e},g.createElement("div",{className:"sonner-spinner"},ir.map((r,o)=>g.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${o}`})))),cr=g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},g.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),dr=g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},g.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),ur=g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},g.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),mr=g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},g.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),pr=g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},g.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),g.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),fr=()=>{const[e,s]=g.useState(document.hidden);return g.useEffect(()=>{const r=()=>{s(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let ct=1;class hr{constructor(){this.subscribe=s=>(this.subscribers.push(s),()=>{const r=this.subscribers.indexOf(s);this.subscribers.splice(r,1)}),this.publish=s=>{this.subscribers.forEach(r=>r(s))},this.addToast=s=>{this.publish(s),this.toasts=[...this.toasts,s]},this.create=s=>{var r;const{message:o,...a}=s,l=typeof(s==null?void 0:s.id)=="number"||((r=s.id)==null?void 0:r.length)>0?s.id:ct++,u=this.toasts.find(c=>c.id===l),d=s.dismissible===void 0?!0:s.dismissible;return this.dismissedToasts.has(l)&&this.dismissedToasts.delete(l),u?this.toasts=this.toasts.map(c=>c.id===l?(this.publish({...c,...s,id:l,title:o}),{...c,...s,id:l,dismissible:d,title:o}):c):this.addToast({title:o,...a,dismissible:d,id:l}),l},this.dismiss=s=>(s?(this.dismissedToasts.add(s),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:s,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(o=>o({id:r.id,dismiss:!0}))}),s),this.message=(s,r)=>this.create({...r,message:s}),this.error=(s,r)=>this.create({...r,message:s,type:"error"}),this.success=(s,r)=>this.create({...r,type:"success",message:s}),this.info=(s,r)=>this.create({...r,type:"info",message:s}),this.warning=(s,r)=>this.create({...r,type:"warning",message:s}),this.loading=(s,r)=>this.create({...r,type:"loading",message:s}),this.promise=(s,r)=>{if(!r)return;let o;r.loading!==void 0&&(o=this.create({...r,promise:s,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const a=Promise.resolve(s instanceof Function?s():s);let l=o!==void 0,u;const d=a.then(async i=>{if(u=["resolve",i],g.isValidElement(i))l=!1,this.create({id:o,type:"default",message:i});else if(xr(i)&&!i.ok){l=!1;const n=typeof r.error=="function"?await r.error(`HTTP error! status: ${i.status}`):r.error,p=typeof r.description=="function"?await r.description(`HTTP error! status: ${i.status}`):r.description,C=typeof n=="object"&&!g.isValidElement(n)?n:{message:n};this.create({id:o,type:"error",description:p,...C})}else if(i instanceof Error){l=!1;const n=typeof r.error=="function"?await r.error(i):r.error,p=typeof r.description=="function"?await r.description(i):r.description,C=typeof n=="object"&&!g.isValidElement(n)?n:{message:n};this.create({id:o,type:"error",description:p,...C})}else if(r.success!==void 0){l=!1;const n=typeof r.success=="function"?await r.success(i):r.success,p=typeof r.description=="function"?await r.description(i):r.description,C=typeof n=="object"&&!g.isValidElement(n)?n:{message:n};this.create({id:o,type:"success",description:p,...C})}}).catch(async i=>{if(u=["reject",i],r.error!==void 0){l=!1;const f=typeof r.error=="function"?await r.error(i):r.error,n=typeof r.description=="function"?await r.description(i):r.description,N=typeof f=="object"&&!g.isValidElement(f)?f:{message:f};this.create({id:o,type:"error",description:n,...N})}}).finally(()=>{l&&(this.dismiss(o),o=void 0),r.finally==null||r.finally.call(r)}),c=()=>new Promise((i,f)=>d.then(()=>u[0]==="reject"?f(u[1]):i(u[1])).catch(f));return typeof o!="string"&&typeof o!="number"?{unwrap:c}:Object.assign(o,{unwrap:c})},this.custom=(s,r)=>{const o=(r==null?void 0:r.id)||ct++;return this.create({jsx:s(o),id:o,...r}),o},this.getActiveToasts=()=>this.toasts.filter(s=>!this.dismissedToasts.has(s.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Q=new hr,gr=(e,s)=>{const r=(s==null?void 0:s.id)||ct++;return Q.addToast({title:e,...s,id:r}),r},xr=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",br=gr,vr=()=>Q.toasts,yr=()=>Q.getActiveToasts(),Me=Object.assign(br,{success:Q.success,info:Q.info,warning:Q.warning,error:Q.error,custom:Q.custom,message:Q.message,promise:Q.promise,dismiss:Q.dismiss,loading:Q.loading},{getHistory:vr,getToasts:yr});nr("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Ve(e){return e.label!==void 0}const wr=3,kr="24px",jr="16px",_t=4e3,Nr=356,Sr=14,Cr=45,Tr=200;function fe(...e){return e.filter(Boolean).join(" ")}function Er(e){const[s,r]=e.split("-"),o=[];return s&&o.push(s),r&&o.push(r),o}const _r=e=>{var s,r,o,a,l,u,d,c,i;const{invert:f,toast:n,unstyled:p,interacting:N,setHeights:C,visibleToasts:b,heights:h,index:S,toasts:A,expanded:$,removeToast:j,defaultRichColors:B,closeButton:D,style:X,cancelButtonStyle:y,actionButtonStyle:V,className:ue="",descriptionClassName:me="",duration:ee,position:Y,gap:ne,expandByDefault:Z,classNames:k,icons:L,closeButtonAriaLabel:re="Close toast"}=e,[ae,w]=g.useState(null),[pe,je]=g.useState(null),[z,I]=g.useState(!1),[_,R]=g.useState(!1),[ie,M]=g.useState(!1),[P,Ne]=g.useState(!1),[he,le]=g.useState(!1),[Ae,be]=g.useState(0),[ws,bt]=g.useState(0),Re=g.useRef(n.duration||ee||_t),vt=g.useRef(null),ge=g.useRef(null),ks=S===0,js=S+1<=b,te=n.type,Ee=n.dismissible!==!1,Ns=n.className||"",Ss=n.descriptionClassName||"",$e=g.useMemo(()=>h.findIndex(T=>T.toastId===n.id)||0,[h,n.id]),Cs=g.useMemo(()=>{var T;return(T=n.closeButton)!=null?T:D},[n.closeButton,D]),yt=g.useMemo(()=>n.duration||ee||_t,[n.duration,ee]),tt=g.useRef(0),_e=g.useRef(0),wt=g.useRef(0),ze=g.useRef(null),[Ts,Es]=Y.split("-"),kt=g.useMemo(()=>h.reduce((T,H,K)=>K>=$e?T:T+H.height,0),[h,$e]),jt=fr(),_s=n.invert||f,st=te==="loading";_e.current=g.useMemo(()=>$e*ne+kt,[$e,kt]),g.useEffect(()=>{Re.current=yt},[yt]),g.useEffect(()=>{I(!0)},[]),g.useEffect(()=>{const T=ge.current;if(T){const H=T.getBoundingClientRect().height;return bt(H),C(K=>[{toastId:n.id,height:H,position:n.position},...K]),()=>C(K=>K.filter(se=>se.toastId!==n.id))}},[C,n.id]),g.useLayoutEffect(()=>{if(!z)return;const T=ge.current,H=T.style.height;T.style.height="auto";const K=T.getBoundingClientRect().height;T.style.height=H,bt(K),C(se=>se.find(U=>U.toastId===n.id)?se.map(U=>U.toastId===n.id?{...U,height:K}:U):[{toastId:n.id,height:K,position:n.position},...se])},[z,n.title,n.description,C,n.id,n.jsx,n.action,n.cancel]);const ve=g.useCallback(()=>{R(!0),be(_e.current),C(T=>T.filter(H=>H.toastId!==n.id)),setTimeout(()=>{j(n)},Tr)},[n,j,C,_e]);g.useEffect(()=>{if(n.promise&&te==="loading"||n.duration===1/0||n.type==="loading")return;let T;return $||N||jt?(()=>{if(wt.current<tt.current){const se=new Date().getTime()-tt.current;Re.current=Re.current-se}wt.current=new Date().getTime()})():(()=>{Re.current!==1/0&&(tt.current=new Date().getTime(),T=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),ve()},Re.current))})(),()=>clearTimeout(T)},[$,N,n,te,jt,ve]),g.useEffect(()=>{n.delete&&(ve(),n.onDismiss==null||n.onDismiss.call(n,n))},[ve,n.delete]);function zs(){var T;if(L!=null&&L.loading){var H;return g.createElement("div",{className:fe(k==null?void 0:k.loader,n==null||(H=n.classNames)==null?void 0:H.loader,"sonner-loader"),"data-visible":te==="loading"},L.loading)}return g.createElement(lr,{className:fe(k==null?void 0:k.loader,n==null||(T=n.classNames)==null?void 0:T.loader),visible:te==="loading"})}const Ls=n.icon||(L==null?void 0:L[te])||ar(te);var Nt,St;return g.createElement("li",{tabIndex:0,ref:ge,className:fe(ue,Ns,k==null?void 0:k.toast,n==null||(s=n.classNames)==null?void 0:s.toast,k==null?void 0:k.default,k==null?void 0:k[te],n==null||(r=n.classNames)==null?void 0:r[te]),"data-sonner-toast":"","data-rich-colors":(Nt=n.richColors)!=null?Nt:B,"data-styled":!(n.jsx||n.unstyled||p),"data-mounted":z,"data-promise":!!n.promise,"data-swiped":he,"data-removed":_,"data-visible":js,"data-y-position":Ts,"data-x-position":Es,"data-index":S,"data-front":ks,"data-swiping":ie,"data-dismissible":Ee,"data-type":te,"data-invert":_s,"data-swipe-out":P,"data-swipe-direction":pe,"data-expanded":!!($||Z&&z),"data-testid":n.testId,style:{"--index":S,"--toasts-before":S,"--z-index":A.length-S,"--offset":`${_?Ae:_e.current}px`,"--initial-height":Z?"auto":`${ws}px`,...X,...n.style},onDragEnd:()=>{M(!1),w(null),ze.current=null},onPointerDown:T=>{T.button!==2&&(st||!Ee||(vt.current=new Date,be(_e.current),T.target.setPointerCapture(T.pointerId),T.target.tagName!=="BUTTON"&&(M(!0),ze.current={x:T.clientX,y:T.clientY})))},onPointerUp:()=>{var T,H,K;if(P||!Ee)return;ze.current=null;const se=Number(((T=ge.current)==null?void 0:T.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Fe=Number(((H=ge.current)==null?void 0:H.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),U=new Date().getTime()-((K=vt.current)==null?void 0:K.getTime()),oe=ae==="x"?se:Fe,We=Math.abs(oe)/U;if(Math.abs(oe)>=Cr||We>.11){be(_e.current),n.onDismiss==null||n.onDismiss.call(n,n),je(ae==="x"?se>0?"right":"left":Fe>0?"down":"up"),ve(),Ne(!0);return}else{var ce,de;(ce=ge.current)==null||ce.style.setProperty("--swipe-amount-x","0px"),(de=ge.current)==null||de.style.setProperty("--swipe-amount-y","0px")}le(!1),M(!1),w(null)},onPointerMove:T=>{var H,K,se;if(!ze.current||!Ee||((H=window.getSelection())==null?void 0:H.toString().length)>0)return;const U=T.clientY-ze.current.y,oe=T.clientX-ze.current.x;var We;const ce=(We=e.swipeDirections)!=null?We:Er(Y);!ae&&(Math.abs(oe)>1||Math.abs(U)>1)&&w(Math.abs(oe)>Math.abs(U)?"x":"y");let de={x:0,y:0};const Ct=Se=>1/(1.5+Math.abs(Se)/20);if(ae==="y"){if(ce.includes("top")||ce.includes("bottom"))if(ce.includes("top")&&U<0||ce.includes("bottom")&&U>0)de.y=U;else{const Se=U*Ct(U);de.y=Math.abs(Se)<Math.abs(U)?Se:U}}else if(ae==="x"&&(ce.includes("left")||ce.includes("right")))if(ce.includes("left")&&oe<0||ce.includes("right")&&oe>0)de.x=oe;else{const Se=oe*Ct(oe);de.x=Math.abs(Se)<Math.abs(oe)?Se:oe}(Math.abs(de.x)>0||Math.abs(de.y)>0)&&le(!0),(K=ge.current)==null||K.style.setProperty("--swipe-amount-x",`${de.x}px`),(se=ge.current)==null||se.style.setProperty("--swipe-amount-y",`${de.y}px`)}},Cs&&!n.jsx&&te!=="loading"?g.createElement("button",{"aria-label":re,"data-disabled":st,"data-close-button":!0,onClick:st||!Ee?()=>{}:()=>{ve(),n.onDismiss==null||n.onDismiss.call(n,n)},className:fe(k==null?void 0:k.closeButton,n==null||(o=n.classNames)==null?void 0:o.closeButton)},(St=L==null?void 0:L.close)!=null?St:pr):null,(te||n.icon||n.promise)&&n.icon!==null&&((L==null?void 0:L[te])!==null||n.icon)?g.createElement("div",{"data-icon":"",className:fe(k==null?void 0:k.icon,n==null||(a=n.classNames)==null?void 0:a.icon)},n.promise||n.type==="loading"&&!n.icon?n.icon||zs():null,n.type!=="loading"?Ls:null):null,g.createElement("div",{"data-content":"",className:fe(k==null?void 0:k.content,n==null||(l=n.classNames)==null?void 0:l.content)},g.createElement("div",{"data-title":"",className:fe(k==null?void 0:k.title,n==null||(u=n.classNames)==null?void 0:u.title)},n.jsx?n.jsx:typeof n.title=="function"?n.title():n.title),n.description?g.createElement("div",{"data-description":"",className:fe(me,Ss,k==null?void 0:k.description,n==null||(d=n.classNames)==null?void 0:d.description)},typeof n.description=="function"?n.description():n.description):null),g.isValidElement(n.cancel)?n.cancel:n.cancel&&Ve(n.cancel)?g.createElement("button",{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||y,onClick:T=>{Ve(n.cancel)&&Ee&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,T),ve())},className:fe(k==null?void 0:k.cancelButton,n==null||(c=n.classNames)==null?void 0:c.cancelButton)},n.cancel.label):null,g.isValidElement(n.action)?n.action:n.action&&Ve(n.action)?g.createElement("button",{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||V,onClick:T=>{Ve(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,T),!T.defaultPrevented&&ve())},className:fe(k==null?void 0:k.actionButton,n==null||(i=n.classNames)==null?void 0:i.actionButton)},n.action.label):null)};function zt(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function zr(e,s){const r={};return[e,s].forEach((o,a)=>{const l=a===1,u=l?"--mobile-offset":"--offset",d=l?jr:kr;function c(i){["top","right","bottom","left"].forEach(f=>{r[`${u}-${f}`]=typeof i=="number"?`${i}px`:i})}typeof o=="number"||typeof o=="string"?c(o):typeof o=="object"?["top","right","bottom","left"].forEach(i=>{o[i]===void 0?r[`${u}-${i}`]=d:r[`${u}-${i}`]=typeof o[i]=="number"?`${o[i]}px`:o[i]}):c(d)}),r}const Lr=g.forwardRef(function(s,r){const{id:o,invert:a,position:l="bottom-right",hotkey:u=["altKey","KeyT"],expand:d,closeButton:c,className:i,offset:f,mobileOffset:n,theme:p="light",richColors:N,duration:C,style:b,visibleToasts:h=wr,toastOptions:S,dir:A=zt(),gap:$=Sr,icons:j,containerAriaLabel:B="Notifications"}=s,[D,X]=g.useState([]),y=g.useMemo(()=>o?D.filter(z=>z.toasterId===o):D.filter(z=>!z.toasterId),[D,o]),V=g.useMemo(()=>Array.from(new Set([l].concat(y.filter(z=>z.position).map(z=>z.position)))),[y,l]),[ue,me]=g.useState([]),[ee,Y]=g.useState(!1),[ne,Z]=g.useState(!1),[k,L]=g.useState(p!=="system"?p:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),re=g.useRef(null),ae=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),w=g.useRef(null),pe=g.useRef(!1),je=g.useCallback(z=>{X(I=>{var _;return(_=I.find(R=>R.id===z.id))!=null&&_.delete||Q.dismiss(z.id),I.filter(({id:R})=>R!==z.id)})},[]);return g.useEffect(()=>Q.subscribe(z=>{if(z.dismiss){requestAnimationFrame(()=>{X(I=>I.map(_=>_.id===z.id?{..._,delete:!0}:_))});return}setTimeout(()=>{Ms.flushSync(()=>{X(I=>{const _=I.findIndex(R=>R.id===z.id);return _!==-1?[...I.slice(0,_),{...I[_],...z},...I.slice(_+1)]:[z,...I]})})})}),[D]),g.useEffect(()=>{if(p!=="system"){L(p);return}if(p==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?L("dark"):L("light")),typeof window>"u")return;const z=window.matchMedia("(prefers-color-scheme: dark)");try{z.addEventListener("change",({matches:I})=>{L(I?"dark":"light")})}catch{z.addListener(({matches:_})=>{try{L(_?"dark":"light")}catch(R){console.error(R)}})}},[p]),g.useEffect(()=>{D.length<=1&&Y(!1)},[D]),g.useEffect(()=>{const z=I=>{var _;if(u.every(M=>I[M]||I.code===M)){var ie;Y(!0),(ie=re.current)==null||ie.focus()}I.code==="Escape"&&(document.activeElement===re.current||(_=re.current)!=null&&_.contains(document.activeElement))&&Y(!1)};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[u]),g.useEffect(()=>{if(re.current)return()=>{w.current&&(w.current.focus({preventScroll:!0}),w.current=null,pe.current=!1)}},[re.current]),g.createElement("section",{ref:r,"aria-label":`${B} ${ae}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},V.map((z,I)=>{var _;const[R,ie]=z.split("-");return y.length?g.createElement("ol",{key:z,dir:A==="auto"?zt():A,tabIndex:-1,ref:re,className:i,"data-sonner-toaster":!0,"data-sonner-theme":k,"data-y-position":R,"data-x-position":ie,style:{"--front-toast-height":`${((_=ue[0])==null?void 0:_.height)||0}px`,"--width":`${Nr}px`,"--gap":`${$}px`,...b,...zr(f,n)},onBlur:M=>{pe.current&&!M.currentTarget.contains(M.relatedTarget)&&(pe.current=!1,w.current&&(w.current.focus({preventScroll:!0}),w.current=null))},onFocus:M=>{M.target instanceof HTMLElement&&M.target.dataset.dismissible==="false"||pe.current||(pe.current=!0,w.current=M.relatedTarget)},onMouseEnter:()=>Y(!0),onMouseMove:()=>Y(!0),onMouseLeave:()=>{ne||Y(!1)},onDragEnd:()=>Y(!1),onPointerDown:M=>{M.target instanceof HTMLElement&&M.target.dataset.dismissible==="false"||Z(!0)},onPointerUp:()=>Z(!1)},y.filter(M=>!M.position&&I===0||M.position===z).map((M,P)=>{var Ne,he;return g.createElement(_r,{key:M.id,icons:j,index:P,toast:M,defaultRichColors:N,duration:(Ne=S==null?void 0:S.duration)!=null?Ne:C,className:S==null?void 0:S.className,descriptionClassName:S==null?void 0:S.descriptionClassName,invert:a,visibleToasts:h,closeButton:(he=S==null?void 0:S.closeButton)!=null?he:c,interacting:ne,position:z,style:S==null?void 0:S.style,unstyled:S==null?void 0:S.unstyled,classNames:S==null?void 0:S.classNames,cancelButtonStyle:S==null?void 0:S.cancelButtonStyle,actionButtonStyle:S==null?void 0:S.actionButtonStyle,closeButtonAriaLabel:S==null?void 0:S.closeButtonAriaLabel,removeToast:je,toasts:y.filter(le=>le.position==M.position),heights:ue.filter(le=>le.position==M.position),setHeights:me,expandByDefault:d,gap:$,expanded:ee,swipeDirections:s.swipeDirections})})):null}))}),Ar="/api";async function F(e,s){const r={};s!=null&&s.body&&(r["Content-Type"]="application/json");const o=await fetch(`${Ar}${e}`,{headers:r,...s});if(!o.ok){const a=await o.json().catch(()=>({error:o.statusText}));throw new Error(a.error||o.statusText)}if(o.status!==204)return o.json()}const G={browse:e=>F(`/browse${e?`?path=${encodeURIComponent(e)}`:""}`),recentRepos:()=>F("/recent-repos"),listBranches:e=>F(`/branches?repo_path=${encodeURIComponent(e)}`),getDefaultBranch:e=>F(`/default-branch?repo_path=${encodeURIComponent(e)}`),listTasks:()=>F("/tasks"),getTask:e=>F(`/tasks/${e}`),createTask:e=>F("/tasks",{method:"POST",body:JSON.stringify(e)}),updateTask:(e,s)=>F(`/tasks/${e}`,{method:"PATCH",body:JSON.stringify(s)}),startTask:e=>F(`/tasks/${e}/start`,{method:"POST"}),deleteTask:e=>F(`/tasks/${e}`,{method:"DELETE"}),addAgent:(e,s)=>F(`/tasks/${e}/agents`,{method:"POST",body:JSON.stringify(s||{})}),stopAgent:(e,s)=>F(`/tasks/${e}/agents/${s}`,{method:"DELETE"}),createUserTerminal:e=>F(`/tasks/${e}/user-terminal`,{method:"POST"}),createTerminal:e=>F(`/tasks/${e}/terminals`,{method:"POST",body:JSON.stringify({})}),closeTerminal:(e,s)=>F(`/tasks/${e}/terminals/${s}`,{method:"DELETE"}),orchestratorStatus:()=>F("/orchestrator/status"),orchestratorStart:()=>F("/orchestrator/start",{method:"POST"}),orchestratorStop:()=>F("/orchestrator/stop",{method:"POST"}),orchestratorSend:e=>F("/orchestrator/send",{method:"POST",body:JSON.stringify({message:e})}),orchestratorType:e=>F("/orchestrator/type",{method:"POST",body:JSON.stringify({message:e})})},Rr=1e4,mt=1e3;let q=null,Ye=null,Ie=mt;const Pe=new Set;function Mr(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/events`}function Yt(){(q==null?void 0:q.readyState)===WebSocket.OPEN||(q==null?void 0:q.readyState)===WebSocket.CONNECTING||(q=new WebSocket(Mr()),q.onopen=()=>{Ie=mt},q.onmessage=()=>{for(const e of Pe)e()},q.onclose=e=>{q=null,e.code!==1e3&&Pe.size>0&&(Ye=setTimeout(()=>{Ie=Math.min(Ie*2,Rr),Yt()},Ie))},q.onerror=()=>{})}function pt(e){return Pe.add(e),Yt(),()=>{Pe.delete(e),Pe.size===0&&(Ye&&(clearTimeout(Ye),Ye=null),q==null||q.close(1e3),q=null,Ie=mt)}}function Br(){const[e,s]=m.useState(!1),[r,o]=m.useState(!0),[a,l]=m.useState(null),u=m.useCallback(async()=>{try{const i=await G.orchestratorStatus();s(i.running),l(null)}catch(i){l(i.message)}finally{o(!1)}},[]);m.useEffect(()=>(u(),pt(u)),[u]);const d=m.useCallback(async()=>{try{await G.orchestratorStart(),s(!0)}catch(i){l(i.message)}},[]),c=m.useCallback(async()=>{try{await G.orchestratorStop(),s(!1)}catch(i){l(i.message)}},[]);return{running:e,loading:r,error:a,start:d,stop:c,refresh:u}}function ft(){const[e,s]=m.useState([]),[r,o]=m.useState(!0),[a,l]=m.useState(null),u=m.useRef(""),d=m.useCallback(async()=>{try{const c=await G.listTasks(),i=JSON.stringify(c);i!==u.current&&(u.current=i,s(c)),l(null)}catch(c){l(c.message)}finally{o(!1)}},[]);return m.useEffect(()=>(d(),pt(d)),[d]),{tasks:e,loading:r,error:a,refresh:d}}function Kn(e){const[s,r]=m.useState(null),[o,a]=m.useState(!0),[l,u]=m.useState(null),d=m.useRef(""),c=m.useCallback(async()=>{try{const i=await G.getTask(e),f=JSON.stringify(i);f!==d.current&&(d.current=f,r(i)),u(null)}catch(i){u(i.message)}finally{a(!1)}},[e]);return m.useEffect(()=>(c(),pt(c)),[c]),{task:s,loading:o,error:l,refresh:c}}const ot="octomux",nt="/logo.png";function Ir(e){return e.filter(s=>{const r=s.derived_status??s.status;return r==="error"||r==="needs_attention"}).length}function Pr(e){const r=document.createElement("canvas");r.width=32,r.height=32;const o=r.getContext("2d");o.drawImage(e,0,0,32,32);const a=7,l=32-a-1,u=a+1;return o.beginPath(),o.arc(l,u,a,0,2*Math.PI),o.fillStyle="#ef4444",o.fill(),o.strokeStyle="#1a1a2e",o.lineWidth=2,o.stroke(),r.toDataURL("image/png")}function at(e){let s=document.querySelector('link[rel="icon"]');s||(s=document.createElement("link"),s.rel="icon",document.head.appendChild(s)),s.href!==e&&(s.href=e)}function Dr(e){const s=m.useRef(null);m.useEffect(()=>{const r=new Image;r.onload=()=>{s.current=Pr(r)},r.src=nt},[]),m.useEffect(()=>{const r=Ir(e);document.title=r>0?`(${r}) ${ot}`:ot,r>0&&s.current?at(s.current):at(nt)},[e]),m.useEffect(()=>()=>{document.title=ot,at(nt)},[])}const Kt="octomux-notifications-enabled";function qt(){return localStorage.getItem(Kt)!=="false"}function Or(e){localStorage.setItem(Kt,String(e))}function it(e,s){var o;const r=((o=s.label.match(/\d+/))==null?void 0:o[0])??"1";return`${e.title} #${r}`}function $r(){const{pathname:e}=Is(),s=e.match(/^\/tasks\/([^/]+)/);return s?s[1]:null}function Fr(e,s){const r=m.useRef(new Map),o=m.useRef(new Set),a=m.useRef(!1),l=$r();m.useEffect(()=>{var d,c;if(!qt()||e.length===0)return;const u=new Map;for(const i of e){if(!i.agents)continue;const f=i.id===l;for(const n of i.agents){if(u.set(n.id,{status:n.status,hookActivity:n.hook_activity}),!a.current)continue;const p=r.current.get(n.id);if(p&&!f){if(p.status!=="stopped"&&n.status==="stopped"){const N=i.id;Me(it(i,n),{description:"Agent stopped",action:{label:"View",onClick:()=>s(`/tasks/${N}`)}})}if(p.hookActivity==="active"&&n.hook_activity==="idle"){const N=i.id;Me.success(it(i,n),{description:"Agent finished",action:{label:"View",onClick:()=>s(`/tasks/${N}`)}})}}}if(a.current&&!f&&i.pending_prompts){for(const n of i.pending_prompts)if(n.status==="pending"&&!o.current.has(n.id)){o.current.add(n.id);const p=i.id,N=n.agent_id,C=(d=i.agents)==null?void 0:d.find(h=>h.id===n.agent_id),b=C?it(i,C):`${i.title} #?`;Me.warning(b,{description:`Needs permission: ${n.tool_name}`,action:{label:"View",onClick:()=>s(`/tasks/${p}?agent=${N}`)}})}}}if(a.current){for(const i of e)if(i.id!==l&&(i.status==="closed"||i.status==="error")&&((c=i.agents)==null?void 0:c.some(n=>{const p=r.current.get(n.id);return p&&p.status!=="stopped"}))){const n=i.id;i.status==="error"?Me.error(i.title,{description:"Task errored",action:{label:"View",onClick:()=>s(`/tasks/${n}`)}}):Me.success(i.title,{description:"Task closed",action:{label:"View",onClick:()=>s(`/tasks/${n}`)}})}}if(r.current=u,!a.current){for(const i of e)if(i.pending_prompts)for(const f of i.pending_prompts)o.current.add(f.id);a.current=!0}},[e,s,l])}const Lt="octomux-repo-filter",At="octomux-status-filter",Rt=["setting_up","running","error"];function Wr(e){const[s,r]=m.useState({status:localStorage.getItem(At)??"open",repo:localStorage.getItem(Lt)??""}),o=m.useMemo(()=>[...new Set(e.map(c=>c.repo_path))].sort((c,i)=>{const f=c.split("/").pop()||c,n=i.split("/").pop()||i;return f.localeCompare(n)}),[e]),a=m.useMemo(()=>{const d=s.repo?e.filter(c=>c.repo_path===s.repo):e;return{open:d.filter(c=>Rt.includes(c.status)).length,closed:d.filter(c=>c.status==="closed").length,backlog:d.filter(c=>c.status==="draft").length}},[e,s.repo]),l=m.useMemo(()=>{const d=e.filter(c=>{let i;s.status==="open"?i=Rt.includes(c.status):s.status==="backlog"?i=c.status==="draft":i=c.status==="closed";const f=!s.repo||c.repo_path===s.repo;return i&&f});if(s.status==="open"){const c={needs_attention:0,working:1,running:2,setting_up:3,error:4,draft:5};d.sort((i,f)=>{const n=c[i.derived_status??i.status]??9,p=c[f.derived_status??f.status]??9;return n!==p?n-p:f.created_at.localeCompare(i.created_at)})}return d},[e,s]);function u(d,c){d==="repo"?localStorage.setItem(Lt,c):d==="status"&&localStorage.setItem(At,c),r(i=>({...i,[d]:c}))}return{filters:s,setFilter:u,filtered:l,counts:a,repos:o}}function Xt(e){var s,r,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(s=0;s<a;s++)e[s]&&(r=Xt(e[s]))&&(o&&(o+=" "),o+=r)}else for(r in e)e[r]&&(o&&(o+=" "),o+=r);return o}function Jt(){for(var e,s,r=0,o="",a=arguments.length;r<a;r++)(e=arguments[r])&&(s=Xt(e))&&(o&&(o+=" "),o+=s);return o}const Vr=(e,s)=>{const r=new Array(e.length+s.length);for(let o=0;o<e.length;o++)r[o]=e[o];for(let o=0;o<s.length;o++)r[e.length+o]=s[o];return r},Hr=(e,s)=>({classGroupId:e,validator:s}),Zt=(e=new Map,s=null,r)=>({nextPart:e,validators:s,classGroupId:r}),Ke="-",Mt=[],Gr="arbitrary..",Ur=e=>{const s=Kr(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return Yr(u);const d=u.split(Ke),c=d[0]===""&&d.length>1?1:0;return Qt(d,c,s)},getConflictingClassGroupIds:(u,d)=>{if(d){const c=o[u],i=r[u];return c?i?Vr(i,c):c:i||Mt}return r[u]||Mt}}},Qt=(e,s,r)=>{if(e.length-s===0)return r.classGroupId;const a=e[s],l=r.nextPart.get(a);if(l){const i=Qt(e,s+1,l);if(i)return i}const u=r.validators;if(u===null)return;const d=s===0?e.join(Ke):e.slice(s).join(Ke),c=u.length;for(let i=0;i<c;i++){const f=u[i];if(f.validator(d))return f.classGroupId}},Yr=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const s=e.slice(1,-1),r=s.indexOf(":"),o=s.slice(0,r);return o?Gr+o:void 0})(),Kr=e=>{const{theme:s,classGroups:r}=e;return qr(r,s)},qr=(e,s)=>{const r=Zt();for(const o in e){const a=e[o];ht(a,r,o,s)}return r},ht=(e,s,r,o)=>{const a=e.length;for(let l=0;l<a;l++){const u=e[l];Xr(u,s,r,o)}},Xr=(e,s,r,o)=>{if(typeof e=="string"){Jr(e,s,r);return}if(typeof e=="function"){Zr(e,s,r,o);return}Qr(e,s,r,o)},Jr=(e,s,r)=>{const o=e===""?s:es(s,e);o.classGroupId=r},Zr=(e,s,r,o)=>{if(eo(e)){ht(e(o),s,r,o);return}s.validators===null&&(s.validators=[]),s.validators.push(Hr(r,e))},Qr=(e,s,r,o)=>{const a=Object.entries(e),l=a.length;for(let u=0;u<l;u++){const[d,c]=a[u];ht(c,es(s,d),r,o)}},es=(e,s)=>{let r=e;const o=s.split(Ke),a=o.length;for(let l=0;l<a;l++){const u=o[l];let d=r.nextPart.get(u);d||(d=Zt(),r.nextPart.set(u,d)),r=d}return r},eo=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,to=e=>{if(e<1)return{get:()=>{},set:()=>{}};let s=0,r=Object.create(null),o=Object.create(null);const a=(l,u)=>{r[l]=u,s++,s>e&&(s=0,o=r,r=Object.create(null))};return{get(l){let u=r[l];if(u!==void 0)return u;if((u=o[l])!==void 0)return a(l,u),u},set(l,u){l in r?r[l]=u:a(l,u)}}},dt="!",Bt=":",so=[],It=(e,s,r,o,a)=>({modifiers:e,hasImportantModifier:s,baseClassName:r,maybePostfixModifierPosition:o,isExternal:a}),ro=e=>{const{prefix:s,experimentalParseClassName:r}=e;let o=a=>{const l=[];let u=0,d=0,c=0,i;const f=a.length;for(let b=0;b<f;b++){const h=a[b];if(u===0&&d===0){if(h===Bt){l.push(a.slice(c,b)),c=b+1;continue}if(h==="/"){i=b;continue}}h==="["?u++:h==="]"?u--:h==="("?d++:h===")"&&d--}const n=l.length===0?a:a.slice(c);let p=n,N=!1;n.endsWith(dt)?(p=n.slice(0,-1),N=!0):n.startsWith(dt)&&(p=n.slice(1),N=!0);const C=i&&i>c?i-c:void 0;return It(l,N,p,C)};if(s){const a=s+Bt,l=o;o=u=>u.startsWith(a)?l(u.slice(a.length)):It(so,!1,u,void 0,!0)}if(r){const a=o;o=l=>r({className:l,parseClassName:a})}return o},oo=e=>{const s=new Map;return e.orderSensitiveModifiers.forEach((r,o)=>{s.set(r,1e6+o)}),r=>{const o=[];let a=[];for(let l=0;l<r.length;l++){const u=r[l],d=u[0]==="[",c=s.has(u);d||c?(a.length>0&&(a.sort(),o.push(...a),a=[]),o.push(u)):a.push(u)}return a.length>0&&(a.sort(),o.push(...a)),o}},no=e=>({cache:to(e.cacheSize),parseClassName:ro(e),sortModifiers:oo(e),...Ur(e)}),ao=/\s+/,io=(e,s)=>{const{parseClassName:r,getClassGroupId:o,getConflictingClassGroupIds:a,sortModifiers:l}=s,u=[],d=e.trim().split(ao);let c="";for(let i=d.length-1;i>=0;i-=1){const f=d[i],{isExternal:n,modifiers:p,hasImportantModifier:N,baseClassName:C,maybePostfixModifierPosition:b}=r(f);if(n){c=f+(c.length>0?" "+c:c);continue}let h=!!b,S=o(h?C.substring(0,b):C);if(!S){if(!h){c=f+(c.length>0?" "+c:c);continue}if(S=o(C),!S){c=f+(c.length>0?" "+c:c);continue}h=!1}const A=p.length===0?"":p.length===1?p[0]:l(p).join(":"),$=N?A+dt:A,j=$+S;if(u.indexOf(j)>-1)continue;u.push(j);const B=a(S,h);for(let D=0;D<B.length;++D){const X=B[D];u.push($+X)}c=f+(c.length>0?" "+c:c)}return c},lo=(...e)=>{let s=0,r,o,a="";for(;s<e.length;)(r=e[s++])&&(o=ts(r))&&(a&&(a+=" "),a+=o);return a},ts=e=>{if(typeof e=="string")return e;let s,r="";for(let o=0;o<e.length;o++)e[o]&&(s=ts(e[o]))&&(r&&(r+=" "),r+=s);return r},co=(e,...s)=>{let r,o,a,l;const u=c=>{const i=s.reduce((f,n)=>n(f),e());return r=no(i),o=r.cache.get,a=r.cache.set,l=d,d(c)},d=c=>{const i=o(c);if(i)return i;const f=io(c,r);return a(c,f),f};return l=u,(...c)=>l(lo(...c))},uo=[],W=e=>{const s=r=>r[e]||uo;return s.isThemeGetter=!0,s},ss=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,rs=/^\((?:(\w[\w-]*):)?(.+)\)$/i,mo=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,po=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,fo=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ho=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,go=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,xo=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ye=e=>mo.test(e),E=e=>!!e&&!Number.isNaN(Number(e)),we=e=>!!e&&Number.isInteger(Number(e)),lt=e=>e.endsWith("%")&&E(e.slice(0,-1)),xe=e=>po.test(e),os=()=>!0,bo=e=>fo.test(e)&&!ho.test(e),gt=()=>!1,vo=e=>go.test(e),yo=e=>xo.test(e),wo=e=>!x(e)&&!v(e),ko=e=>ke(e,is,gt),x=e=>ss.test(e),Ce=e=>ke(e,ls,bo),Pt=e=>ke(e,zo,E),jo=e=>ke(e,ds,os),No=e=>ke(e,cs,gt),Dt=e=>ke(e,ns,gt),So=e=>ke(e,as,yo),He=e=>ke(e,us,vo),v=e=>rs.test(e),Be=e=>Te(e,ls),Co=e=>Te(e,cs),Ot=e=>Te(e,ns),To=e=>Te(e,is),Eo=e=>Te(e,as),Ge=e=>Te(e,us,!0),_o=e=>Te(e,ds,!0),ke=(e,s,r)=>{const o=ss.exec(e);return o?o[1]?s(o[1]):r(o[2]):!1},Te=(e,s,r=!1)=>{const o=rs.exec(e);return o?o[1]?s(o[1]):r:!1},ns=e=>e==="position"||e==="percentage",as=e=>e==="image"||e==="url",is=e=>e==="length"||e==="size"||e==="bg-size",ls=e=>e==="length",zo=e=>e==="number",cs=e=>e==="family-name",ds=e=>e==="number"||e==="weight",us=e=>e==="shadow",Lo=()=>{const e=W("color"),s=W("font"),r=W("text"),o=W("font-weight"),a=W("tracking"),l=W("leading"),u=W("breakpoint"),d=W("container"),c=W("spacing"),i=W("radius"),f=W("shadow"),n=W("inset-shadow"),p=W("text-shadow"),N=W("drop-shadow"),C=W("blur"),b=W("perspective"),h=W("aspect"),S=W("ease"),A=W("animate"),$=()=>["auto","avoid","all","avoid-page","page","left","right","column"],j=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],B=()=>[...j(),v,x],D=()=>["auto","hidden","clip","visible","scroll"],X=()=>["auto","contain","none"],y=()=>[v,x,c],V=()=>[ye,"full","auto",...y()],ue=()=>[we,"none","subgrid",v,x],me=()=>["auto",{span:["full",we,v,x]},we,v,x],ee=()=>[we,"auto",v,x],Y=()=>["auto","min","max","fr",v,x],ne=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Z=()=>["start","end","center","stretch","center-safe","end-safe"],k=()=>["auto",...y()],L=()=>[ye,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...y()],re=()=>[ye,"screen","full","dvw","lvw","svw","min","max","fit",...y()],ae=()=>[ye,"screen","full","lh","dvh","lvh","svh","min","max","fit",...y()],w=()=>[e,v,x],pe=()=>[...j(),Ot,Dt,{position:[v,x]}],je=()=>["no-repeat",{repeat:["","x","y","space","round"]}],z=()=>["auto","cover","contain",To,ko,{size:[v,x]}],I=()=>[lt,Be,Ce],_=()=>["","none","full",i,v,x],R=()=>["",E,Be,Ce],ie=()=>["solid","dashed","dotted","double"],M=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],P=()=>[E,lt,Ot,Dt],Ne=()=>["","none",C,v,x],he=()=>["none",E,v,x],le=()=>["none",E,v,x],Ae=()=>[E,v,x],be=()=>[ye,"full",...y()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[xe],breakpoint:[xe],color:[os],container:[xe],"drop-shadow":[xe],ease:["in","out","in-out"],font:[wo],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[xe],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[xe],shadow:[xe],spacing:["px",E],text:[xe],"text-shadow":[xe],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ye,x,v,h]}],container:["container"],columns:[{columns:[E,x,v,d]}],"break-after":[{"break-after":$()}],"break-before":[{"break-before":$()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:B()}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:X()}],"overscroll-x":[{"overscroll-x":X()}],"overscroll-y":[{"overscroll-y":X()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:V()}],"inset-x":[{"inset-x":V()}],"inset-y":[{"inset-y":V()}],start:[{"inset-s":V(),start:V()}],end:[{"inset-e":V(),end:V()}],"inset-bs":[{"inset-bs":V()}],"inset-be":[{"inset-be":V()}],top:[{top:V()}],right:[{right:V()}],bottom:[{bottom:V()}],left:[{left:V()}],visibility:["visible","invisible","collapse"],z:[{z:[we,"auto",v,x]}],basis:[{basis:[ye,"full","auto",d,...y()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[E,ye,"auto","initial","none",x]}],grow:[{grow:["",E,v,x]}],shrink:[{shrink:["",E,v,x]}],order:[{order:[we,"first","last","none",v,x]}],"grid-cols":[{"grid-cols":ue()}],"col-start-end":[{col:me()}],"col-start":[{"col-start":ee()}],"col-end":[{"col-end":ee()}],"grid-rows":[{"grid-rows":ue()}],"row-start-end":[{row:me()}],"row-start":[{"row-start":ee()}],"row-end":[{"row-end":ee()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Y()}],"auto-rows":[{"auto-rows":Y()}],gap:[{gap:y()}],"gap-x":[{"gap-x":y()}],"gap-y":[{"gap-y":y()}],"justify-content":[{justify:[...ne(),"normal"]}],"justify-items":[{"justify-items":[...Z(),"normal"]}],"justify-self":[{"justify-self":["auto",...Z()]}],"align-content":[{content:["normal",...ne()]}],"align-items":[{items:[...Z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Z(),{baseline:["","last"]}]}],"place-content":[{"place-content":ne()}],"place-items":[{"place-items":[...Z(),"baseline"]}],"place-self":[{"place-self":["auto",...Z()]}],p:[{p:y()}],px:[{px:y()}],py:[{py:y()}],ps:[{ps:y()}],pe:[{pe:y()}],pbs:[{pbs:y()}],pbe:[{pbe:y()}],pt:[{pt:y()}],pr:[{pr:y()}],pb:[{pb:y()}],pl:[{pl:y()}],m:[{m:k()}],mx:[{mx:k()}],my:[{my:k()}],ms:[{ms:k()}],me:[{me:k()}],mbs:[{mbs:k()}],mbe:[{mbe:k()}],mt:[{mt:k()}],mr:[{mr:k()}],mb:[{mb:k()}],ml:[{ml:k()}],"space-x":[{"space-x":y()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":y()}],"space-y-reverse":["space-y-reverse"],size:[{size:L()}],"inline-size":[{inline:["auto",...re()]}],"min-inline-size":[{"min-inline":["auto",...re()]}],"max-inline-size":[{"max-inline":["none",...re()]}],"block-size":[{block:["auto",...ae()]}],"min-block-size":[{"min-block":["auto",...ae()]}],"max-block-size":[{"max-block":["none",...ae()]}],w:[{w:[d,"screen",...L()]}],"min-w":[{"min-w":[d,"screen","none",...L()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[u]},...L()]}],h:[{h:["screen","lh",...L()]}],"min-h":[{"min-h":["screen","lh","none",...L()]}],"max-h":[{"max-h":["screen","lh",...L()]}],"font-size":[{text:["base",r,Be,Ce]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,_o,jo]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",lt,x]}],"font-family":[{font:[Co,No,s]}],"font-features":[{"font-features":[x]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,v,x]}],"line-clamp":[{"line-clamp":[E,"none",v,Pt]}],leading:[{leading:[l,...y()]}],"list-image":[{"list-image":["none",v,x]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",v,x]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:w()}],"text-color":[{text:w()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:[E,"from-font","auto",v,Ce]}],"text-decoration-color":[{decoration:w()}],"underline-offset":[{"underline-offset":[E,"auto",v,x]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:y()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",v,x]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",v,x]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:pe()}],"bg-repeat":[{bg:je()}],"bg-size":[{bg:z()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},we,v,x],radial:["",v,x],conic:[we,v,x]},Eo,So]}],"bg-color":[{bg:w()}],"gradient-from-pos":[{from:I()}],"gradient-via-pos":[{via:I()}],"gradient-to-pos":[{to:I()}],"gradient-from":[{from:w()}],"gradient-via":[{via:w()}],"gradient-to":[{to:w()}],rounded:[{rounded:_()}],"rounded-s":[{"rounded-s":_()}],"rounded-e":[{"rounded-e":_()}],"rounded-t":[{"rounded-t":_()}],"rounded-r":[{"rounded-r":_()}],"rounded-b":[{"rounded-b":_()}],"rounded-l":[{"rounded-l":_()}],"rounded-ss":[{"rounded-ss":_()}],"rounded-se":[{"rounded-se":_()}],"rounded-ee":[{"rounded-ee":_()}],"rounded-es":[{"rounded-es":_()}],"rounded-tl":[{"rounded-tl":_()}],"rounded-tr":[{"rounded-tr":_()}],"rounded-br":[{"rounded-br":_()}],"rounded-bl":[{"rounded-bl":_()}],"border-w":[{border:R()}],"border-w-x":[{"border-x":R()}],"border-w-y":[{"border-y":R()}],"border-w-s":[{"border-s":R()}],"border-w-e":[{"border-e":R()}],"border-w-bs":[{"border-bs":R()}],"border-w-be":[{"border-be":R()}],"border-w-t":[{"border-t":R()}],"border-w-r":[{"border-r":R()}],"border-w-b":[{"border-b":R()}],"border-w-l":[{"border-l":R()}],"divide-x":[{"divide-x":R()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":R()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ie(),"hidden","none"]}],"divide-style":[{divide:[...ie(),"hidden","none"]}],"border-color":[{border:w()}],"border-color-x":[{"border-x":w()}],"border-color-y":[{"border-y":w()}],"border-color-s":[{"border-s":w()}],"border-color-e":[{"border-e":w()}],"border-color-bs":[{"border-bs":w()}],"border-color-be":[{"border-be":w()}],"border-color-t":[{"border-t":w()}],"border-color-r":[{"border-r":w()}],"border-color-b":[{"border-b":w()}],"border-color-l":[{"border-l":w()}],"divide-color":[{divide:w()}],"outline-style":[{outline:[...ie(),"none","hidden"]}],"outline-offset":[{"outline-offset":[E,v,x]}],"outline-w":[{outline:["",E,Be,Ce]}],"outline-color":[{outline:w()}],shadow:[{shadow:["","none",f,Ge,He]}],"shadow-color":[{shadow:w()}],"inset-shadow":[{"inset-shadow":["none",n,Ge,He]}],"inset-shadow-color":[{"inset-shadow":w()}],"ring-w":[{ring:R()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:w()}],"ring-offset-w":[{"ring-offset":[E,Ce]}],"ring-offset-color":[{"ring-offset":w()}],"inset-ring-w":[{"inset-ring":R()}],"inset-ring-color":[{"inset-ring":w()}],"text-shadow":[{"text-shadow":["none",p,Ge,He]}],"text-shadow-color":[{"text-shadow":w()}],opacity:[{opacity:[E,v,x]}],"mix-blend":[{"mix-blend":[...M(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":M()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[E]}],"mask-image-linear-from-pos":[{"mask-linear-from":P()}],"mask-image-linear-to-pos":[{"mask-linear-to":P()}],"mask-image-linear-from-color":[{"mask-linear-from":w()}],"mask-image-linear-to-color":[{"mask-linear-to":w()}],"mask-image-t-from-pos":[{"mask-t-from":P()}],"mask-image-t-to-pos":[{"mask-t-to":P()}],"mask-image-t-from-color":[{"mask-t-from":w()}],"mask-image-t-to-color":[{"mask-t-to":w()}],"mask-image-r-from-pos":[{"mask-r-from":P()}],"mask-image-r-to-pos":[{"mask-r-to":P()}],"mask-image-r-from-color":[{"mask-r-from":w()}],"mask-image-r-to-color":[{"mask-r-to":w()}],"mask-image-b-from-pos":[{"mask-b-from":P()}],"mask-image-b-to-pos":[{"mask-b-to":P()}],"mask-image-b-from-color":[{"mask-b-from":w()}],"mask-image-b-to-color":[{"mask-b-to":w()}],"mask-image-l-from-pos":[{"mask-l-from":P()}],"mask-image-l-to-pos":[{"mask-l-to":P()}],"mask-image-l-from-color":[{"mask-l-from":w()}],"mask-image-l-to-color":[{"mask-l-to":w()}],"mask-image-x-from-pos":[{"mask-x-from":P()}],"mask-image-x-to-pos":[{"mask-x-to":P()}],"mask-image-x-from-color":[{"mask-x-from":w()}],"mask-image-x-to-color":[{"mask-x-to":w()}],"mask-image-y-from-pos":[{"mask-y-from":P()}],"mask-image-y-to-pos":[{"mask-y-to":P()}],"mask-image-y-from-color":[{"mask-y-from":w()}],"mask-image-y-to-color":[{"mask-y-to":w()}],"mask-image-radial":[{"mask-radial":[v,x]}],"mask-image-radial-from-pos":[{"mask-radial-from":P()}],"mask-image-radial-to-pos":[{"mask-radial-to":P()}],"mask-image-radial-from-color":[{"mask-radial-from":w()}],"mask-image-radial-to-color":[{"mask-radial-to":w()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":j()}],"mask-image-conic-pos":[{"mask-conic":[E]}],"mask-image-conic-from-pos":[{"mask-conic-from":P()}],"mask-image-conic-to-pos":[{"mask-conic-to":P()}],"mask-image-conic-from-color":[{"mask-conic-from":w()}],"mask-image-conic-to-color":[{"mask-conic-to":w()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:pe()}],"mask-repeat":[{mask:je()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",v,x]}],filter:[{filter:["","none",v,x]}],blur:[{blur:Ne()}],brightness:[{brightness:[E,v,x]}],contrast:[{contrast:[E,v,x]}],"drop-shadow":[{"drop-shadow":["","none",N,Ge,He]}],"drop-shadow-color":[{"drop-shadow":w()}],grayscale:[{grayscale:["",E,v,x]}],"hue-rotate":[{"hue-rotate":[E,v,x]}],invert:[{invert:["",E,v,x]}],saturate:[{saturate:[E,v,x]}],sepia:[{sepia:["",E,v,x]}],"backdrop-filter":[{"backdrop-filter":["","none",v,x]}],"backdrop-blur":[{"backdrop-blur":Ne()}],"backdrop-brightness":[{"backdrop-brightness":[E,v,x]}],"backdrop-contrast":[{"backdrop-contrast":[E,v,x]}],"backdrop-grayscale":[{"backdrop-grayscale":["",E,v,x]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[E,v,x]}],"backdrop-invert":[{"backdrop-invert":["",E,v,x]}],"backdrop-opacity":[{"backdrop-opacity":[E,v,x]}],"backdrop-saturate":[{"backdrop-saturate":[E,v,x]}],"backdrop-sepia":[{"backdrop-sepia":["",E,v,x]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":y()}],"border-spacing-x":[{"border-spacing-x":y()}],"border-spacing-y":[{"border-spacing-y":y()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",v,x]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[E,"initial",v,x]}],ease:[{ease:["linear","initial",S,v,x]}],delay:[{delay:[E,v,x]}],animate:[{animate:["none",A,v,x]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,v,x]}],"perspective-origin":[{"perspective-origin":B()}],rotate:[{rotate:he()}],"rotate-x":[{"rotate-x":he()}],"rotate-y":[{"rotate-y":he()}],"rotate-z":[{"rotate-z":he()}],scale:[{scale:le()}],"scale-x":[{"scale-x":le()}],"scale-y":[{"scale-y":le()}],"scale-z":[{"scale-z":le()}],"scale-3d":["scale-3d"],skew:[{skew:Ae()}],"skew-x":[{"skew-x":Ae()}],"skew-y":[{"skew-y":Ae()}],transform:[{transform:[v,x,"","none","gpu","cpu"]}],"transform-origin":[{origin:B()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:be()}],"translate-x":[{"translate-x":be()}],"translate-y":[{"translate-y":be()}],"translate-z":[{"translate-z":be()}],"translate-none":["translate-none"],accent:[{accent:w()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:w()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",v,x]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":y()}],"scroll-mx":[{"scroll-mx":y()}],"scroll-my":[{"scroll-my":y()}],"scroll-ms":[{"scroll-ms":y()}],"scroll-me":[{"scroll-me":y()}],"scroll-mbs":[{"scroll-mbs":y()}],"scroll-mbe":[{"scroll-mbe":y()}],"scroll-mt":[{"scroll-mt":y()}],"scroll-mr":[{"scroll-mr":y()}],"scroll-mb":[{"scroll-mb":y()}],"scroll-ml":[{"scroll-ml":y()}],"scroll-p":[{"scroll-p":y()}],"scroll-px":[{"scroll-px":y()}],"scroll-py":[{"scroll-py":y()}],"scroll-ps":[{"scroll-ps":y()}],"scroll-pe":[{"scroll-pe":y()}],"scroll-pbs":[{"scroll-pbs":y()}],"scroll-pbe":[{"scroll-pbe":y()}],"scroll-pt":[{"scroll-pt":y()}],"scroll-pr":[{"scroll-pr":y()}],"scroll-pb":[{"scroll-pb":y()}],"scroll-pl":[{"scroll-pl":y()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",v,x]}],fill:[{fill:["none",...w()]}],"stroke-w":[{stroke:[E,Be,Ce,Pt]}],stroke:[{stroke:["none",...w()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Ao=co(Lo);function J(...e){return Ao(Jt(e))}function Ro({className:e,size:s="default",...r}){return t.jsx("div",{"data-slot":"card","data-size":s,className:J("group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",e),...r})}function Mo({className:e,...s}){return t.jsx("div",{"data-slot":"card-header",className:J("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3",e),...s})}function Bo({className:e,...s}){return t.jsx("div",{"data-slot":"card-title",className:J("text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",e),...s})}function Io({className:e,...s}){return t.jsx("div",{"data-slot":"card-description",className:J("text-sm text-muted-foreground",e),...s})}function Po({className:e,...s}){return t.jsx("div",{"data-slot":"card-content",className:J("px-4 group-data-[size=sm]/card:px-3",e),...s})}const $t=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Ft=Jt,ms=(e,s)=>r=>{var o;if((s==null?void 0:s.variants)==null)return Ft(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:a,defaultVariants:l}=s,u=Object.keys(a).map(i=>{const f=r==null?void 0:r[i],n=l==null?void 0:l[i];if(f===null)return null;const p=$t(f)||$t(n);return a[i][p]}),d=r&&Object.entries(r).reduce((i,f)=>{let[n,p]=f;return p===void 0||(i[n]=p),i},{}),c=s==null||(o=s.compoundVariants)===null||o===void 0?void 0:o.reduce((i,f)=>{let{class:n,className:p,...N}=f;return Object.entries(N).every(C=>{let[b,h]=C;return Array.isArray(h)?h.includes({...l,...d}[b]):{...l,...d}[b]===h})?[...i,n,p]:i},[]);return Ft(e,u,c,r==null?void 0:r.class,r==null?void 0:r.className)},Do=ms("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function De({className:e,variant:s="default",render:r,...o}){return Fs({defaultTagName:"span",props:Ws({className:J(Do({variant:s}),e)},o),render:r,state:{slot:"badge",variant:s}})}const Oo=ms("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function O({className:e,variant:s="default",size:r="default",...o}){return t.jsx(Vs,{"data-slot":"button",className:J(Oo({variant:s,size:r,className:e})),...o})}const $o={draft:{label:"Draft",className:"bg-zinc-500/20 text-zinc-400 border-zinc-500/30"},setting_up:{label:"Setting up",className:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30"},running:{label:"Running",className:"bg-green-500/20 text-green-400 border-green-500/30"},closed:{label:"Closed",className:"bg-blue-500/20 text-blue-400 border-blue-500/30"},error:{label:"Error",className:"bg-red-500/20 text-red-400 border-red-500/30"},working:{label:"Working",className:"bg-green-500/20 text-green-400 border-green-500/30"},needs_attention:{label:"Needs attention",className:"bg-amber-500/20 text-amber-400 border-amber-500/30"},done:{label:"Done",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30"}},Fo={label:"Unknown",className:"bg-zinc-500/20 text-zinc-400 border-zinc-500/30"},ps=m.memo(function({status:s}){const r=$o[s]||Fo;return t.jsxs(De,{variant:"outline",className:r.className,children:[(s==="running"||s==="working")&&t.jsx("span",{className:"mr-1 inline-block h-1.5 w-1.5 animate-pulse rounded-full bg-green-400"}),r.label]})});function qe(e){const s=Date.now()-new Date(e+"Z").getTime(),r=Math.floor(s/1e3);if(r<5)return"just now";if(r<60)return`${r}s ago`;const o=Math.floor(r/60);if(o<60)return`${o}m ago`;const a=Math.floor(o/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function Wo(e){const s=Date.now()-new Date(e+"Z").getTime(),r=Math.floor(s/1e3);if(r<60)return`${r}s`;const o=Math.floor(r/60);if(o<60)return`${o}m`;const a=Math.floor(o/60);return a<24?`${a}h`:`${Math.floor(a/24)}d`}const Ue={active:"bg-green-500",idle:"bg-zinc-400",waiting:"bg-amber-500"};function Wt(e){return e.hook_activity==="active"?"Active":e.hook_activity==="waiting"?"Waiting for input":e.hook_activity_updated_at?`Idle ${Wo(e.hook_activity_updated_at)}`:"Idle"}function Vo(e){let s=null;for(const r of e)r.hook_activity_updated_at&&(!s||r.hook_activity_updated_at>s)&&(s=r.hook_activity_updated_at);return s}const fs=m.memo(function({agents:s,pendingPrompts:r,compact:o}){const a=s.filter(d=>d.status!=="stopped"),l=r&&r.length>0,u=Vo(a);return a.length===0?null:o?t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{className:"tabular-nums text-xs text-muted-foreground",children:[a.length," agent",a.length>1?"s":""]}),t.jsx("div",{className:"flex items-center gap-1",children:a.map(d=>t.jsx("span",{title:`${d.label}: ${Wt(d)}`,className:`inline-block h-2 w-2 rounded-full ${Ue[d.hook_activity]||Ue.active} ${d.hook_activity==="active"?"animate-pulse":""}`},d.id))}),l&&t.jsxs("span",{className:"inline-flex items-center gap-0.5 text-amber-500",title:"Needs input",children:[t.jsx("span",{className:"animate-pulse text-xs",children:"⚠"}),t.jsx("span",{className:"text-[10px] font-semibold uppercase",children:r.length})]}),u&&t.jsx("span",{className:"text-xs text-muted-foreground",children:qe(u)})]}):t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.jsxs("span",{className:"tabular-nums",children:[a.length," agent",a.length>1?"s":""]}),u&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-zinc-600",children:"·"}),t.jsxs("span",{className:"tabular-nums",children:["Last active ",qe(u)]})]}),l&&t.jsxs("span",{className:"ml-auto inline-flex items-center gap-1 rounded bg-amber-500/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-amber-500",children:[t.jsx("span",{className:"animate-pulse",children:"⚠"}),"Needs input"]})]}),t.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1 text-xs",children:a.map(d=>t.jsxs("span",{className:"inline-flex items-center gap-1",children:[t.jsx("span",{className:`inline-block h-2 w-2 rounded-full ${Ue[d.hook_activity]||Ue.active} ${d.hook_activity==="active"?"animate-pulse":""}`}),t.jsx("span",{className:"text-zinc-400",children:Wt(d)}),t.jsx("span",{className:"text-zinc-500",children:d.label})]},d.id))})]})});function Ho(e){const s=Math.floor((Date.now()-new Date(e+"Z").getTime())/1e3);if(s<60)return"just now";const r=Math.floor(s/60);return r<60?`${r}m ago`:`${Math.floor(r/60)}h ago`}function Go(e){const s=e.command||e.file_path||e.pattern||"",r=String(s);return r.length>40?r.slice(0,37)+"...":r}const Uo=m.memo(function({prompt:s,taskId:r}){const o=Je(),a=l=>{l.stopPropagation(),o(`/tasks/${r}?agent=${s.agent_id}`)};return t.jsxs("button",{onClick:a,className:"flex w-full items-center gap-2 rounded border-l-2 border-amber-500 bg-amber-500/5 px-2 py-1.5 text-left text-sm text-amber-400 hover:bg-amber-500/10",children:[t.jsx("span",{className:"animate-pulse text-amber-500",children:"⚠"}),t.jsx("span",{className:"shrink-0 rounded bg-amber-500/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-amber-500",children:"Action required"}),t.jsx("span",{className:"text-zinc-400",children:s.agent_label}),t.jsxs("span",{className:"font-medium",children:[s.tool_name," ",Go(s.tool_input)]}),t.jsx("span",{className:"ml-auto shrink-0 text-xs text-zinc-500",children:Ho(s.created_at)})]})});function Yo(e){return e.split("/").pop()||e}const Ko=m.memo(function({task:s,onClose:r,onDelete:o,onResume:a}){const l=Je(),u=(s.status==="closed"||s.status==="error")&&!!s.worktree,d=s.status==="running"||s.status==="setting_up";return t.jsxs(Ro,{className:"cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>l(`/tasks/${s.id}`),children:[t.jsxs(Mo,{className:"px-4 py-3 pb-2",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx(Bo,{className:"min-w-0 text-base leading-snug line-clamp-2",children:s.title}),t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(ps,{status:s.derived_status||s.status}),t.jsx("span",{className:"text-xs tabular-nums whitespace-nowrap text-muted-foreground",children:qe(s.created_at)})]})]}),t.jsx(Io,{className:"line-clamp-1",children:s.description})]}),t.jsxs(Po,{className:"px-4 pb-3 pt-0",children:[t.jsxs("div",{className:"flex items-center justify-between text-sm",children:[t.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[t.jsx(De,{variant:"outline",className:"text-xs font-normal",children:Yo(s.repo_path)}),s.branch&&t.jsx("span",{className:"font-mono text-xs",children:s.branch})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[s.pr_url&&t.jsxs("a",{href:s.pr_url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-400 hover:underline",onClick:c=>c.stopPropagation(),children:["PR #",t.jsx("span",{className:"tabular-nums",children:s.pr_number})]}),s.error&&t.jsx("span",{className:"text-xs text-destructive",title:s.error,children:"Error"}),u&&a&&t.jsx(O,{variant:"ghost",size:"icon-xs",className:"text-muted-foreground hover:text-green-400",title:"Resume agents",onClick:c=>{c.stopPropagation(),a(s.id)},children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",stroke:"none",children:t.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),d?t.jsx(O,{variant:"ghost",size:"icon-xs",className:"text-muted-foreground hover:text-yellow-500",title:"Close task",onClick:c=>{c.stopPropagation(),r(s.id)},children:t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),t.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]})}):t.jsx(O,{variant:"ghost",size:"icon-xs",className:"text-muted-foreground hover:text-destructive",title:"Delete task",onClick:c=>{c.stopPropagation(),o(s.id)},children:t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M3 6h18"}),t.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),t.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]})})]})]}),s.agents&&s.agents.length>0&&s.status==="running"&&t.jsx("div",{className:"mt-2",children:t.jsx(fs,{agents:s.agents,pendingPrompts:s.pending_prompts})}),s.pending_prompts&&s.pending_prompts.length>0&&t.jsx("div",{className:"mt-1 space-y-0.5",children:s.pending_prompts.map(c=>t.jsx(Uo,{prompt:c,taskId:s.id},c.id))})]})]})});function Xe({icon:e,heading:s,subtext:r,action:o,className:a=""}){return t.jsxs("div",{className:`flex flex-col items-center justify-center py-16 animate-in fade-in duration-300 ${a}`,children:[t.jsx("div",{className:"text-muted-foreground/40",children:e}),t.jsx("h3",{className:"mt-4 text-lg font-medium",children:s}),r&&t.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:r}),o&&t.jsx("div",{className:"mt-4",children:o})]})}function qo(e){return e.split("/").pop()||e}const Xo=m.memo(function({task:s,onClose:r,onDelete:o,onResume:a}){var i;const l=Je(),u=(s.status==="closed"||s.status==="error")&&!!s.worktree,d=s.status==="running"||s.status==="setting_up",c=((i=s.agents)==null?void 0:i.filter(f=>f.status!=="stopped"))??[];return t.jsxs("tr",{className:"cursor-pointer border-b border-border transition-colors last:border-b-0 hover:bg-accent/50",onClick:()=>l(`/tasks/${s.id}`),children:[t.jsx("td",{className:"py-2 pr-3 pl-3",children:t.jsx(ps,{status:s.derived_status||s.status})}),t.jsx("td",{className:"py-2 pr-3",children:t.jsxs("div",{className:"min-w-0",children:[t.jsx("span",{className:"block truncate text-sm font-medium",children:s.title}),s.description&&t.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:s.description})]})}),t.jsx("td",{className:"py-2 pr-3",children:t.jsx(De,{variant:"outline",className:"text-xs font-normal",children:qo(s.repo_path)})}),t.jsx("td",{className:"py-2 pr-3",children:c.length>0&&s.status==="running"?t.jsx(fs,{agents:s.agents??[],pendingPrompts:s.pending_prompts,compact:!0}):t.jsx("span",{className:"tabular-nums text-xs text-muted-foreground",children:c.length>0?`${c.length} agent${c.length>1?"s":""}`:"—"})}),t.jsx("td",{className:"tabular-nums py-2 pr-3 text-xs text-muted-foreground whitespace-nowrap",children:qe(s.created_at)}),t.jsx("td",{className:"py-2 pr-3",children:t.jsxs("div",{className:"flex items-center gap-1",onClick:f=>f.stopPropagation(),children:[s.pr_url&&t.jsxs("a",{href:s.pr_url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-400 hover:underline",children:["PR #",t.jsx("span",{className:"tabular-nums",children:s.pr_number})]}),u&&a&&t.jsx(O,{variant:"ghost",size:"icon-xs",className:"text-muted-foreground hover:text-green-400",title:"Resume agents",onClick:()=>a(s.id),children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",stroke:"none",children:t.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),d?t.jsx(O,{variant:"ghost",size:"icon-xs",className:"text-muted-foreground hover:text-yellow-500",title:"Close task",onClick:()=>r(s.id),children:t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),t.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]})}):t.jsx(O,{variant:"ghost",size:"icon-xs",className:"text-muted-foreground hover:text-destructive",title:"Delete task",onClick:()=>o(s.id),children:t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M3 6h18"}),t.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),t.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]})})]})})]})});function Jo({tasks:e,onClose:s,onDelete:r,onResume:o}){return t.jsx("div",{className:"overflow-x-auto rounded-lg border border-border",children:t.jsxs("table",{className:"w-full text-left",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border bg-muted/50 text-xs text-muted-foreground",children:[t.jsx("th",{className:"py-2 pr-3 pl-3 font-medium",children:"Status"}),t.jsx("th",{className:"py-2 pr-3 font-medium",children:"Task"}),t.jsx("th",{className:"py-2 pr-3 font-medium",children:"Project"}),t.jsx("th",{className:"py-2 pr-3 font-medium",children:"Agents"}),t.jsx("th",{className:"py-2 pr-3 font-medium",children:"Created"}),t.jsx("th",{className:"py-2 pr-3 font-medium",children:"Actions"})]})}),t.jsx("tbody",{children:e.map(a=>t.jsx(Xo,{task:a,onClose:s,onDelete:r,onResume:o},a.id))})]})})}function Zo({tasks:e,onClose:s,onDelete:r,onResume:o,viewMode:a,totalCount:l=0,emptyAction:u}){return e.length===0?l>0?t.jsx(Xe,{icon:t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"11",cy:"11",r:"8"}),t.jsx("path",{d:"m21 21-4.3-4.3"}),t.jsx("path",{d:"M8 11h6"})]}),heading:"No matching tasks",subtext:"Try adjusting your filters or status tab"}):t.jsx(Xe,{icon:t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),t.jsx("path",{d:"m7 8 4 4-4 4"}),t.jsx("path",{d:"M13 16h4"})]}),heading:"No tasks yet",subtext:"Create your first task to start running agents",action:u}):a==="table"?t.jsx(Jo,{tasks:e,onClose:s,onDelete:r,onResume:o}):t.jsx("div",{className:"flex flex-col gap-2",children:e.map(d=>t.jsx(Ko,{task:d,onClose:s,onDelete:r,onResume:o},d.id))})}function Ze({...e}){return t.jsx(Hs,{"data-slot":"popover",...e})}function Qe({...e}){return t.jsx(Gs,{"data-slot":"popover-trigger",...e})}function et({className:e,align:s="center",alignOffset:r=0,side:o="bottom",sideOffset:a=4,...l}){return t.jsx(Us,{children:t.jsx(Ys,{align:s,alignOffset:r,side:o,sideOffset:a,className:"isolate z-50",children:t.jsx(Ks,{"data-slot":"popover-content",className:J("z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...l})})})}function Vt(e){return e.split("/").pop()||e}function Qo({repos:e,activeRepo:s,onRepoChange:r}){const[o,a]=m.useState(!1);return t.jsxs(Ze,{open:o,onOpenChange:a,children:[t.jsx(Qe,{render:t.jsxs("button",{type:"button",className:"mb-1 flex items-center gap-1.5 rounded-md border border-border bg-background px-2 py-1 text-xs transition-colors hover:bg-muted",children:[s?t.jsx(De,{variant:"outline",className:"text-xs font-normal",children:Vt(s)}):t.jsx("span",{children:"All projects"}),t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground",children:t.jsx("path",{d:"m6 9 6 6 6-6"})})]})}),t.jsx(et,{align:"end",side:"bottom",sideOffset:4,className:"w-[200px] p-0",children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("button",{type:"button",className:`px-3 py-1.5 text-left text-xs transition-colors hover:bg-muted ${s?"":"bg-muted font-medium"}`,onClick:()=>{r(""),a(!1)},children:"All projects"}),e.map(l=>t.jsx("button",{type:"button",className:`flex items-center px-3 py-1.5 text-left text-xs transition-colors hover:bg-muted ${l===s?"bg-muted font-medium":""}`,onClick:()=>{r(l),a(!1)},children:t.jsx(De,{variant:"outline",className:"text-xs font-normal",children:Vt(l)})},l))]})})]})}function en({viewMode:e,onViewChange:s}){return t.jsxs("div",{className:"mb-1 flex items-center rounded-md border border-border",children:[t.jsx("button",{type:"button",title:"Card view",className:`rounded-l-md px-1.5 py-1 transition-colors ${e==="cards"?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,onClick:()=>s("cards"),children:t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("rect",{x:"3",y:"3",width:"7",height:"7"}),t.jsx("rect",{x:"14",y:"3",width:"7",height:"7"}),t.jsx("rect",{x:"3",y:"14",width:"7",height:"7"}),t.jsx("rect",{x:"14",y:"14",width:"7",height:"7"})]})}),t.jsx("button",{type:"button",title:"List view",className:`rounded-r-md px-1.5 py-1 transition-colors ${e==="table"?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,onClick:()=>s("table"),children:t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),t.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),t.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})})]})}const tn=m.memo(function({activeStatus:s,counts:r,onStatusChange:o,repos:a,activeRepo:l,onRepoChange:u,viewMode:d,onViewChange:c}){const i=[{key:"open",label:"Open",count:r.open},{key:"backlog",label:"Backlog",count:r.backlog},{key:"closed",label:"Closed",count:r.closed}];return t.jsxs("div",{className:"mb-3 flex items-center justify-between border-b border-border",children:[t.jsx("div",{className:"flex gap-1",children:i.map(f=>t.jsxs("button",{className:`px-3 py-2 text-sm font-medium ${s===f.key?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,onClick:()=>o(f.key),children:[f.label," ",t.jsxs("span",{className:"tabular-nums text-xs",children:["(",f.count,")"]})]},f.key))}),t.jsxs("div",{className:"flex items-center gap-2",children:[a.length>1&&t.jsx(Qo,{repos:a,activeRepo:l,onRepoChange:u}),t.jsx(en,{viewMode:d,onViewChange:c})]})]})});function sn(e){return t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[t.jsx("path",{d:"M18 6 6 18"}),t.jsx("path",{d:"m6 6 12 12"})]})}function rn({...e}){return t.jsx(qs,{"data-slot":"dialog",...e})}function on({...e}){return t.jsx(Xs,{"data-slot":"dialog-trigger",...e})}function nn({...e}){return t.jsx(er,{"data-slot":"dialog-portal",...e})}function an({className:e,...s}){return t.jsx(tr,{"data-slot":"dialog-overlay",className:J("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...s})}function ln({className:e,children:s,showCloseButton:r=!0,...o}){return t.jsxs(nn,{children:[t.jsx(an,{}),t.jsxs(Js,{"data-slot":"dialog-content",className:J("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-background p-4 text-sm ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...o,children:[s,r&&t.jsxs(Zs,{"data-slot":"dialog-close",render:t.jsx(O,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[t.jsx(sn,{}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function cn({className:e,...s}){return t.jsx("div",{"data-slot":"dialog-header",className:J("flex flex-col gap-2",e),...s})}function dn({className:e,...s}){return t.jsx(Qs,{"data-slot":"dialog-title",className:J("text-base leading-none font-medium",e),...s})}function Oe({className:e,type:s,...r}){return t.jsx(sr,{type:s,"data-slot":"input",className:J("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...r})}function ut({className:e,...s}){return t.jsx("textarea",{"data-slot":"textarea",className:J("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...s})}function Le({className:e,...s}){return t.jsx("label",{"data-slot":"label",className:J("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...s})}function un(e){const s=Date.now(),r=new Date(e+"Z").getTime(),o=Math.max(0,s-r),a=Math.floor(o/6e4);if(a<60)return`${a}m ago`;const l=Math.floor(a/60);return l<24?`${l}h ago`:`${Math.floor(l/24)}d ago`}function hs({value:e,onChange:s,onValidationChange:r}){const[o,a]=m.useState([]),[l,u]=m.useState(!1),[d,c]=m.useState(null),[i,f]=m.useState(!1),[n,p]=m.useState("idle");m.useEffect(()=>{G.recentRepos().then(a).catch(()=>a([]))},[]),m.useEffect(()=>{const b=e.trim();if(!b){p("idle"),r==null||r("idle");return}let h=!1;p("loading"),r==null||r("loading");const S=setTimeout(async()=>{try{await Promise.all([G.listBranches(b),G.getDefaultBranch(b)]),h||(p("valid"),r==null||r("valid"))}catch{h||(p("invalid"),r==null||r("invalid"))}},500);return()=>{h=!0,clearTimeout(S)}},[e,r]);const N=m.useCallback(async b=>{f(!0);try{const h=await G.browse(b);c(h)}catch{}finally{f(!1)}},[]);m.useEffect(()=>{l&&!d&&N()},[l,d,N]);function C(b){s(b),u(!1)}return t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(Oe,{id:"repo-path",placeholder:"/Users/you/projects/my-repo",className:"font-mono text-sm pr-8",value:e,onChange:b=>s(b.target.value)}),e.trim()&&t.jsxs("span",{className:"absolute right-2 top-1/2 -translate-y-1/2",children:[n==="loading"&&t.jsxs("svg",{className:"h-4 w-4 animate-spin text-muted-foreground",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","aria-label":"Validating repo",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),n==="valid"&&t.jsx("svg",{className:"h-4 w-4 text-emerald-500",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-label":"Valid git repo",children:t.jsx("path",{d:"M20 6 9 17l-5-5"})}),n==="invalid"&&t.jsxs("svg",{className:"h-4 w-4 text-destructive",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-label":"Not a git repository",children:[t.jsx("path",{d:"M18 6 6 18"}),t.jsx("path",{d:"m6 6 12 12"})]})]})]}),t.jsxs(Ze,{open:l,onOpenChange:u,children:[t.jsx(Qe,{render:t.jsx(O,{type:"button",variant:"outline",className:"shrink-0",children:"Browse"})}),t.jsx(et,{align:"end",side:"bottom",sideOffset:4,className:"w-[420px] p-0",children:t.jsx(mn,{data:d,loading:i,onNavigate:N,onSelect:C})})]})]}),e.trim()&&n==="valid"&&t.jsx("p",{className:"text-xs text-emerald-500",children:"Valid git repo"}),e.trim()&&n==="invalid"&&t.jsx("p",{className:"text-xs text-destructive",children:"Not a git repository"}),!e.trim()&&o.length>0&&t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Recent"}),t.jsx("div",{className:"rounded-md border border-border overflow-hidden",children:o.slice(0,5).map(b=>t.jsxs("button",{type:"button",className:"flex w-full items-center justify-between px-3 py-1.5 text-left text-sm hover:bg-muted transition-colors",onClick:()=>s(b.repo_path),children:[t.jsx("span",{className:"font-mono text-xs truncate mr-3",children:b.repo_path}),t.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:un(b.last_used)})]},b.repo_path))})]})]})}function mn({data:e,loading:s,onNavigate:r,onSelect:o}){return!e&&s?t.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"Loading..."}):e?t.jsxs("div",{className:"flex flex-col",children:[t.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[t.jsx("button",{type:"button",disabled:!e.parent,className:"shrink-0 rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-30 disabled:hover:bg-transparent",onClick:()=>e.parent&&r(e.parent),children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("path",{d:"m15 18-6-6 6-6"})})}),t.jsx("span",{className:"font-mono text-xs text-muted-foreground truncate direction-rtl text-left",children:e.current})]}),t.jsxs("div",{className:"max-h-[280px] overflow-y-auto",children:[e.entries.length===0&&t.jsx("div",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:"No subdirectories"}),e.entries.map(a=>t.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm hover:bg-muted transition-colors",onClick:()=>r(a.path),onDoubleClick:()=>a.isGit&&o(a.path),children:[t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:a.isGit?"text-emerald-500":"text-muted-foreground",children:t.jsx("path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"})}),t.jsxs("span",{className:"font-mono text-xs truncate",children:[a.name,t.jsx("span",{className:"text-muted-foreground",children:"/"})]}),a.isGit&&t.jsx("span",{className:"ml-auto shrink-0 rounded bg-emerald-500/10 px-1.5 py-0.5 text-[10px] font-medium text-emerald-600 dark:text-emerald-400",children:"git"})]},a.path))]}),t.jsxs("div",{className:"flex items-center justify-between border-t border-border px-3 py-2",children:[t.jsx("span",{className:"font-mono text-[10px] text-muted-foreground truncate mr-2",children:e.current}),t.jsx(O,{type:"button",size:"sm",className:"shrink-0 h-7 text-xs",onClick:()=>o(e.current),children:"Select"})]})]}):null}function gs({repoPath:e,value:s,onChange:r,onBranchesLoaded:o,disabled:a}){const[l,u]=m.useState([]),[d,c]=m.useState(""),[i,f]=m.useState(!1);m.useEffect(()=>{const p=e.trim();if(!p){u([]);return}let N=!1;const C=setTimeout(async()=>{try{const[b,h]=await Promise.all([G.listBranches(p),G.getDefaultBranch(p)]);N||(u(b),o?o(b,h.branch):r(h.branch))}catch{N||u([])}},500);return()=>{N=!0,clearTimeout(C)}},[e]);const n=m.useMemo(()=>l.filter(p=>p.toLowerCase().includes(d.toLowerCase())),[l,d]);return t.jsx("div",{className:"flex flex-col gap-2",children:t.jsxs(Ze,{open:i,onOpenChange:f,children:[t.jsx(Qe,{render:t.jsxs("button",{type:"button",disabled:a||l.length===0,className:"flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[t.jsx("span",{className:s?"font-mono text-xs":"text-muted-foreground",children:s||"Select base branch..."}),t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground",children:t.jsx("path",{d:"m6 9 6 6 6-6"})})]})}),t.jsx(et,{align:"start",side:"bottom",sideOffset:4,className:"w-[--trigger-width] p-0",children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("div",{className:"border-b border-border px-3 py-2",children:t.jsx("input",{type:"text",placeholder:"Search branches...",className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",value:d,onChange:p=>c(p.target.value),autoFocus:!0})}),t.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[n.length===0&&t.jsx("div",{className:"px-3 py-3 text-center text-xs text-muted-foreground",children:l.length===0?"Select a repository first":"No matching branches"}),n.map(p=>t.jsx("button",{type:"button",className:`flex w-full items-center px-3 py-1.5 text-left text-sm hover:bg-muted transition-colors ${p===s?"bg-muted font-medium":""}`,onClick:()=>{r(p),c(""),f(!1)},children:t.jsx("span",{className:"font-mono text-xs truncate",children:p})},p))]})]})})]})})}function xs({onCreated:e}){const[s,r]=m.useState(!1),[o,a]=m.useState(""),[l,u]=m.useState(""),[d,c]=m.useState(""),[i,f]=m.useState(""),[n,p]=m.useState(""),[N,C]=m.useState(""),[b,h]=m.useState(!1),[S,A]=m.useState(!1),[$,j]=m.useState(!1),[B,D]=m.useState(null),[X,y]=m.useState({}),[V,ue]=m.useState("idle"),[me,ee]=m.useState(!0),Y=k=>y(L=>({...L,[k]:!0})),ne=o.trim()&&l.trim()&&d.trim()&&!$;m.useEffect(()=>{if(!me)return;const k=o.trim();if(!k){p("");return}const L=k.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"");p(L?`feat/${L}`:"")},[o,me]);async function Z(k){if(k.preventDefault(),!!ne){j(!0),D(null);try{await G.createTask({title:o.trim(),description:l.trim(),repo_path:d.trim(),branch:n.trim()||void 0,base_branch:N.trim()||void 0,initial_prompt:i.trim()||void 0,draft:S||void 0}),a(""),u(""),c(""),p(""),C(""),f(""),h(!1),A(!1),y({}),ue("idle"),ee(!0),r(!1),e==null||e()}catch(L){D(L.message)}finally{j(!1)}}}return t.jsxs(rn,{open:s,onOpenChange:r,children:[t.jsxs(on,{render:t.jsx(O,{}),children:[t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","data-icon":"inline-start",children:[t.jsx("path",{d:"M12 5v14"}),t.jsx("path",{d:"M5 12h14"})]}),"New Task"]}),t.jsxs(ln,{className:"max-h-[90vh] overflow-y-auto sm:max-w-xl",children:[t.jsx(cn,{children:t.jsx(dn,{children:"Create Task"})}),t.jsxs("form",{onSubmit:Z,className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Le,{htmlFor:"title",children:"Title"}),t.jsx(Oe,{id:"title",placeholder:"Fix order validation",value:o,onChange:k=>a(k.target.value),onBlur:()=>Y("title")}),X.title&&!o.trim()&&t.jsx("p",{className:"text-xs text-destructive",children:"Title is required"})]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Le,{htmlFor:"description",children:"Description"}),t.jsx(ut,{id:"description",placeholder:"Add negative quantity checks to the order form...",rows:3,value:l,onChange:k=>u(k.target.value),onBlur:()=>Y("description")}),X.description&&!l.trim()&&t.jsx("p",{className:"text-xs text-destructive",children:"Description is required"})]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Le,{htmlFor:"repo-path",children:"Repository Path"}),t.jsx(hs,{value:d,onChange:c,onValidationChange:ue}),X.repoPath&&!d.trim()&&t.jsx("p",{className:"text-xs text-destructive",children:"Repository path is required"})]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Le,{htmlFor:"branch",children:"Branch Name"}),me&&n&&t.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",children:"auto"})]}),t.jsx(Oe,{id:"branch",placeholder:"feat/my-feature",className:"font-mono text-sm",value:n,onChange:k=>{p(k.target.value),ee(!1)}})]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Le,{children:"Base Branch"}),t.jsx(gs,{repoPath:d,value:N,onChange:C,onBranchesLoaded:(k,L)=>{C(L)},disabled:!d.trim()})]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(O,{type:"button",variant:"ghost",size:"sm",className:"w-fit h-auto px-2 py-1 text-xs text-muted-foreground hover:text-foreground",onClick:()=>h(!b),children:b?"- Hide initial prompt":"+ Add initial prompt"}),b&&t.jsx(ut,{id:"initial-prompt",placeholder:"Custom prompt to send to the agent on start...",rows:4,value:i,onChange:k=>f(k.target.value)})]}),t.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted-foreground cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:S,onChange:k=>A(k.target.checked),className:"rounded border-border"}),"Save as draft (start later)"]}),B&&t.jsx("p",{className:"text-sm text-destructive",children:B}),t.jsxs("div",{className:"sticky bottom-0 flex justify-end gap-2 border-t border-border bg-background pt-3 -mb-1",children:[t.jsx(O,{type:"button",variant:"ghost",onClick:()=>r(!1),children:"Cancel"}),t.jsx(O,{type:"submit",disabled:!ne,children:$?"Creating...":"Create"})]})]})]})]})}function pn(){const[e,s]=m.useState(!1),r=Br(),o=m.useCallback(()=>s(!0),[]),a=m.useCallback(()=>s(!1),[]),l=m.useCallback(()=>s(u=>!u),[]);return{isOpen:e,open:o,close:a,toggle:l,...r}}const bs=m.createContext(null);function fn({children:e}){const s=pn();return t.jsx(bs.Provider,{value:s,children:e})}function xt(){const e=m.useContext(bs);if(!e)throw new Error("useOrchestratorContext must be used within OrchestratorProvider");return e}const vs=[{slash:"/create-task",chipLabel:"+ Create Task",description:"Create a task for an autonomous agent",fields:[{name:"title",label:"Title",type:"text",required:!0,placeholder:"Fix login bug"},{name:"repo",label:"Repository",type:"repo-picker",required:!0},{name:"baseBranch",label:"Base Branch",type:"branch-picker",dependsOn:"repo"},{name:"description",label:"Description",type:"textarea",placeholder:"Describe what needs to be done..."},{name:"prompt",label:"Initial Prompt",type:"textarea",placeholder:"Tell the agent what to do..."}],buildMessage:e=>`Create a task titled "${e.title}" in repo ${e.repo}${e.baseBranch?` with base branch ${e.baseBranch}`:""}${e.description?`. Description: ${e.description}`:""} with prompt: ${e.prompt||e.description||e.title}`},{slash:"/list-tasks",chipLabel:"List Tasks",description:"Show all running tasks",buildMessage:()=>"Show me all running tasks"},{slash:"/status",chipLabel:"Task Status",description:"Check status of a specific task",fields:[{name:"task",label:"Task",type:"task-picker",required:!0}],buildMessage:e=>`What is the status of task ${e.task}?`},{slash:"/create-pr",chipLabel:"Create PR",description:"Create a PR for a completed task",fields:[{name:"task",label:"Task",type:"task-picker",required:!0}],buildMessage:e=>`Create a PR for task ${e.task}`}];function hn(e){const s=e.toLowerCase();return vs.filter(r=>r.slash.slice(1).startsWith(s))}const gn=new Set(["running","closed"]);function xn({value:e,onChange:s}){const[r,o]=m.useState([]),[a,l]=m.useState(!0),[u,d]=m.useState(!1),[c,i]=m.useState("");m.useEffect(()=>{G.listTasks().then(p=>o(p.filter(N=>gn.has(N.status)))).catch(()=>o([])).finally(()=>l(!1))},[]);const f=r.filter(p=>p.title.toLowerCase().includes(c.toLowerCase())),n=r.find(p=>p.id===e);return t.jsxs(Ze,{open:u,onOpenChange:d,children:[t.jsx(Qe,{render:t.jsxs("button",{type:"button",className:"flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs",children:[t.jsx("span",{className:n?"":"text-muted-foreground",children:n?n.title:"Select task..."}),t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"ml-2 shrink-0 text-muted-foreground",children:t.jsx("path",{d:"m6 9 6 6 6-6"})})]})}),t.jsx(et,{align:"start",side:"bottom",sideOffset:4,className:"w-[var(--popover-trigger-width)] p-0",children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("div",{className:"p-2 border-b border-border",children:t.jsx(Oe,{placeholder:"Search tasks...",value:c,onChange:p=>i(p.target.value),className:"h-8 text-sm"})}),t.jsxs("div",{className:"max-h-[220px] overflow-y-auto",children:[a&&t.jsx("div",{className:"px-3 py-4 text-center text-sm text-muted-foreground",children:"Loading..."}),!a&&f.length===0&&t.jsx("div",{className:"px-3 py-4 text-center text-sm text-muted-foreground",children:"No tasks found"}),!a&&f.map(p=>t.jsxs("button",{type:"button",className:"flex w-full flex-col items-start px-3 py-2 text-left hover:bg-muted transition-colors",onClick:()=>{s(p.id),d(!1)},children:[t.jsx("span",{className:"text-sm font-semibold",children:p.title}),t.jsx("span",{className:"text-xs text-muted-foreground",children:p.id.slice(0,6)})]},p.id))]})]})})]})}function bn({command:e,onSubmit:s,onClose:r,sending:o}){var b;const[a,l]=m.useState({}),[u,d]=m.useState("idle"),c=m.useCallback((h,S)=>{l(A=>{const $={...A,[h]:S};if(e.fields)for(const j of e.fields)j.dependsOn===h&&($[j.name]="");return $})},[e.fields]),f=(!e.fields||e.fields.filter(h=>h.required).every(h=>(a[h.name]||"").trim()!==""))&&!o,n=()=>{if(!f)return;const h=e.buildMessage(a);s(h)},p=h=>{if(h.key==="Escape"){h.stopPropagation(),r();return}if((h.metaKey||h.ctrlKey)&&h.key==="Enter"){h.preventDefault(),n();return}},N=h=>{p(h),h.key==="Enter"&&!h.shiftKey&&!h.metaKey&&!h.ctrlKey&&(h.preventDefault(),n())},C=h=>{const S=a[h.name]||"";switch(h.type){case"text":return t.jsx(Oe,{value:S,onChange:A=>c(h.name,A.target.value),placeholder:h.placeholder,onKeyDown:N});case"textarea":return t.jsx(ut,{value:S,onChange:A=>c(h.name,A.target.value),placeholder:h.placeholder,onKeyDown:p,rows:3});case"repo-picker":return t.jsx(hs,{value:S,onChange:A=>c(h.name,A),onValidationChange:d});case"branch-picker":return t.jsx(gs,{repoPath:h.dependsOn&&a[h.dependsOn]||"",value:S,onChange:A=>c(h.name,A),disabled:h.dependsOn?!a[h.dependsOn]:!1});case"task-picker":return t.jsx(xn,{value:S,onChange:A=>c(h.name,A)});default:return null}};return t.jsxs("div",{className:"flex flex-col gap-3 p-3",onKeyDown:p,children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-sm font-semibold",children:e.chipLabel}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(O,{variant:"ghost",size:"sm",onClick:r,"aria-label":"Close",className:"h-7",children:t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M18 6 6 18"}),t.jsx("path",{d:"m6 6 12 12"})]})}),t.jsx(O,{size:"sm",disabled:!f,onClick:n,"aria-label":"Send",className:"h-7",children:"Send"})]})]}),(b=e.fields)==null?void 0:b.map(h=>t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs(Le,{htmlFor:h.name,children:[h.label,h.required&&t.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),C(h)]},h.name))]})}function vn(){const[e,s]=m.useState(""),[r,o]=m.useState(!1),[a,l]=m.useState(!1),[u,d]=m.useState(0),[c,i]=m.useState(null),f=m.useRef(null),{open:n,refresh:p}=xt(),N=e.startsWith("/")?hn(e.slice(1)):[],C=async j=>{if(!(!j.trim()||r)){o(!0);try{await G.orchestratorSend(j),s(""),p(),n()}catch(B){console.error("Failed to send to orchestrator:",B)}finally{o(!1)}}},b=()=>C(e.trim()),h=a&&e.startsWith("/")&&N.length>0,S=j=>{if(h){if(j.key==="ArrowDown"){j.preventDefault(),d(B=>(B+1)%N.length);return}if(j.key==="ArrowUp"){j.preventDefault(),d(B=>(B-1+N.length)%N.length);return}if(j.key==="Enter"){j.preventDefault(),A(N[u]),l(!1);return}if(j.key==="Escape"){j.stopPropagation(),l(!1);return}}j.key==="Enter"&&!j.shiftKey&&(j.preventDefault(),b()),j.key==="Escape"&&(j.stopPropagation(),c?i(null):s(""))},A=j=>{if(j.fields){i(j),l(!1),s("");return}i(null),C(j.buildMessage({}))},$=j=>{const B=j.target.value;s(B),B.startsWith("/")?(l(!0),d(0)):l(!1);const D=j.target;D.style.height="auto",D.style.height=`${Math.min(D.scrollHeight,80)}px`};return t.jsxs("div",{className:"relative mb-4 rounded-xl border border-border bg-card",children:[c?t.jsx(bn,{command:c,onSubmit:async j=>{o(!0);try{await G.orchestratorType(j),p(),n(),i(null)}catch(B){console.error("Failed to type to orchestrator:",B)}finally{o(!1)}},onClose:()=>i(null),sending:r}):t.jsxs("div",{className:"flex items-end gap-2 p-3",children:[t.jsx("textarea",{ref:f,value:e,onChange:$,onKeyDown:S,placeholder:"Ask the orchestrator anything...",rows:1,className:"flex-1 resize-none bg-transparent text-sm outline-none placeholder:text-muted-foreground"}),t.jsx(O,{size:"sm",disabled:!e.trim()||r,onClick:b,"aria-label":"Send",className:"shrink-0",children:r?t.jsx(wn,{className:"h-4 w-4 animate-spin"}):t.jsx(yn,{className:"h-4 w-4"})})]}),t.jsx("div",{className:"flex flex-wrap gap-1.5 border-t border-border px-3 py-2",children:vs.map(j=>t.jsx("button",{onClick:()=>A(j),className:"rounded-md border border-border bg-background px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:j.chipLabel},j.slash))}),h&&t.jsx("div",{className:"absolute top-full left-0 z-50 mt-1 w-72 rounded-lg border border-border bg-popover p-1 shadow-md",children:N.map((j,B)=>t.jsxs("button",{onClick:()=>{A(j),l(!1)},className:`flex w-full flex-col items-start rounded-md px-3 py-2 text-left text-sm ${B===u?"bg-muted":""}`,children:[t.jsx("span",{className:"font-semibold",children:j.slash}),t.jsx("span",{className:"text-xs text-muted-foreground",children:j.description})]},j.slash))})]})}function yn({className:e}){return t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:[t.jsx("path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"}),t.jsx("path",{d:"m21.854 2.147-10.94 10.939"})]})}function wn({className:e}){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:t.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}function kn(){const{tasks:e,loading:s,error:r,refresh:o}=ft(),{filters:a,setFilter:l,filtered:u,counts:d,repos:c}=Wr(e),[i,f]=m.useState(()=>localStorage.getItem("octomux-view-mode")||"cards"),n=m.useCallback(async b=>{try{await G.updateTask(b,{status:"closed"}),o()}catch(h){console.error("Failed to close task:",h)}},[o]),p=m.useCallback(async b=>{try{await G.deleteTask(b),o()}catch(h){console.error("Failed to delete task:",h)}},[o]),N=m.useCallback(b=>{f(b),localStorage.setItem("octomux-view-mode",b)},[]),C=m.useCallback(async b=>{try{await G.updateTask(b,{status:"running"}),o()}catch(h){console.error("Failed to resume task:",h)}},[o]);return t.jsx("div",{className:"h-full overflow-auto",children:t.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-4",children:[r&&t.jsx(Xe,{icon:t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"}),t.jsx("path",{d:"M12 9v4"}),t.jsx("path",{d:"M12 17h.01"})]}),heading:"Unable to load tasks",subtext:`Check that the server is running on port 7777. ${r}`,action:t.jsx(O,{variant:"outline",size:"sm",onClick:o,children:"Retry"})}),s?t.jsx("div",{className:"flex flex-col gap-3",children:[1,2,3].map(b=>t.jsxs("div",{className:"animate-pulse rounded-xl border border-border bg-card p-4",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx("div",{className:"h-5 w-48 rounded bg-muted"}),t.jsx("div",{className:"h-5 w-16 rounded bg-muted"})]}),t.jsx("div",{className:"mt-2 h-4 w-64 rounded bg-muted"}),t.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[t.jsx("div",{className:"h-5 w-20 rounded bg-muted"}),t.jsx("div",{className:"h-4 w-32 rounded bg-muted"})]})]},b))}):t.jsxs(t.Fragment,{children:[t.jsx(vn,{}),t.jsx(tn,{activeStatus:a.status,counts:d,onStatusChange:b=>l("status",b),repos:c,activeRepo:a.repo,onRepoChange:b=>l("repo",b),viewMode:i,onViewChange:N}),t.jsx(Zo,{tasks:u,totalCount:e.length,emptyAction:t.jsx(xs,{onCreated:o}),onClose:n,onDelete:p,onResume:C,viewMode:i})]})]})})}const jn=["running","setting_up","error"];function Ht(e){return e.status==="error"?2:e.derivedStatus==="needs_attention"?1:e.status==="running"||e.status==="setting_up"?0:3}function Nn(e){const s=e.filter(a=>jn.includes(a.status)),r=new Map;for(const a of s){const l=a.repo_path.split("/").pop()||a.repo_path,u={id:a.id,title:a.title,status:a.status,derivedStatus:a.derived_status??null},d=r.get(l);d?(d.items.push(u),d.tasks.push(a)):r.set(l,{items:[u],tasks:[a]})}const o=[];for(const[a,{items:l,tasks:u}]of r){const d=new Map(u.map(c=>[c.id,c.created_at]));l.sort((c,i)=>{const f=Ht(c)-Ht(i);return f!==0?f:(d.get(i.id)??"").localeCompare(d.get(c.id)??"")}),o.push({repo:a,items:l})}return o.sort((a,l)=>a.repo.localeCompare(l.repo)),o}const ys="octomux-sidebar-collapsed";function Sn(){try{return localStorage.getItem(ys)==="true"}catch{return!1}}function Cn({item:e}){switch(e.derivedStatus??e.status){case"working":case"running":return t.jsxs("svg",{className:"h-4 w-4 shrink-0 text-green-400 animate-spin",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[t.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"2",opacity:"0.3"}),t.jsx("path",{d:"M14 8a6 6 0 0 0-6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]});case"setting_up":return t.jsx("svg",{className:"h-4 w-4 shrink-0 text-yellow-400",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:t.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"2",strokeDasharray:"4 2"})});case"needs_attention":return t.jsxs("svg",{className:"h-4 w-4 shrink-0 text-amber-400",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[t.jsx("path",{d:"M8 1.5l6.5 12H1.5L8 1.5z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),t.jsx("line",{x1:"8",y1:"6",x2:"8",y2:"9.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),t.jsx("circle",{cx:"8",cy:"11.5",r:"0.75",fill:"currentColor"})]});case"error":return t.jsxs("svg",{className:"h-4 w-4 shrink-0 text-red-400",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[t.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),t.jsx("path",{d:"M5.5 5.5l5 5M10.5 5.5l-5 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});default:return t.jsx("svg",{className:"h-4 w-4 shrink-0 text-muted-foreground",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:t.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})})}}function Tn(e){switch(e.derivedStatus??e.status){case"working":case"running":return"Running";case"setting_up":return"Setting up";case"needs_attention":return"Needs attention";case"error":return"Error";default:return e.status}}function En(){const[e,s]=m.useState(Sn),{tasks:r}=ft(),{id:o}=Ps(),a=m.useMemo(()=>Nn(r),[r]),l=m.useMemo(()=>a.flatMap(c=>c.items),[a]),u=m.useMemo(()=>l.filter(c=>{const i=c.derivedStatus??c.status;return i==="error"||i==="needs_attention"}).length,[l]),d=m.useCallback(()=>{s(c=>{const i=!c;try{localStorage.setItem(ys,String(i))}catch{}return i})},[]);return m.useEffect(()=>{function c(i){(i.metaKey||i.ctrlKey)&&i.key==="b"&&(i.preventDefault(),d())}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[d]),t.jsxs("nav",{"aria-label":"Task list",className:"hidden md:flex flex-col border-r border-border bg-muted/30 overflow-y-auto overflow-x-hidden transition-[width] duration-150 ease-out",style:{width:e?48:240},children:[t.jsxs("div",{className:"flex items-center gap-2 p-2 border-b border-border shrink-0",children:[t.jsx("button",{onClick:d,className:"p-1 rounded hover:bg-muted","aria-label":e?"Expand sidebar":"Collapse sidebar",children:t.jsxs("svg",{className:"h-4 w-4",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[t.jsx("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5",stroke:"currentColor",strokeWidth:"1.5"}),t.jsx("path",{d:"M5.5 2.5v11",stroke:"currentColor",strokeWidth:"1.5"}),e?t.jsx("path",{d:"M9 6l2 2-2 2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}):t.jsx("path",{d:"M11 6l-2 2 2 2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),u>0&&t.jsx("span",{"data-testid":"attention-count",className:e?"sr-only":"ml-auto inline-flex items-center justify-center rounded-full bg-red-500/20 text-red-400 text-xs font-medium min-w-5 h-5 px-1.5",children:u})]}),t.jsx("div",{className:"flex-1 py-1",children:a.map(c=>t.jsxs("div",{children:[!e&&t.jsx("div",{className:"px-3 py-1.5 text-[11px] font-medium text-muted-foreground uppercase tracking-wider truncate",children:c.repo}),c.items.map(i=>{const f=i.id===o;return t.jsxs(Gt,{to:`/tasks/${i.id}`,"aria-current":f?"page":void 0,title:e?`${i.title} — ${Tn(i)}`:void 0,className:`flex items-center gap-2 px-2 py-1.5 text-sm transition-colors hover:bg-muted/60 ${f?"bg-muted border-l-2 border-l-primary":"border-l-2 border-l-transparent"}`,children:[t.jsx(Cn,{item:i}),!e&&t.jsx("span",{className:"truncate max-w-[180px]",children:i.title})]},i.id)})]},c.repo))})]})}function _n(){return t.jsxs("div",{className:"flex h-full",children:[t.jsx(En,{}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(m.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:"Loading..."}),children:t.jsx(Ds,{})})})]})}function zn(){const[e,s]=m.useState(qt),r=m.useCallback(()=>{const o=!e;Or(o),s(o)},[e]);return t.jsx(O,{variant:"ghost",size:"icon",onClick:r,title:e?"Disable notifications":"Enable notifications",className:"relative h-8 w-8",children:e?t.jsx(Ln,{className:"h-4 w-4"}):t.jsx(An,{className:"h-4 w-4 text-muted-foreground"})})}function Ln({className:e}){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:e,children:t.jsx("path",{fillRule:"evenodd",d:"M5.25 9a6.75 6.75 0 0 1 13.5 0v.75c0 2.123.8 4.057 2.118 5.52a.75.75 0 0 1-.573 1.23H3.705a.75.75 0 0 1-.573-1.23A8.973 8.973 0 0 0 5.25 9.75V9ZM8.159 18.753a.75.75 0 0 1 .932-.514 3.756 3.756 0 0 0 5.818 0 .75.75 0 0 1 1.446.418 5.256 5.256 0 0 1-7.678 0 .75.75 0 0 1-.518-.904Z",clipRule:"evenodd"})})}function An({className:e}){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:e,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.857 17.082a23.848 23.848 0 0 0 5.454-1.31A8.967 8.967 0 0 1 18 9.75V9A6 6 0 0 0 6 9v.75a8.967 8.967 0 0 1-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 0 1-5.714 0m5.714 0a3 3 0 1 1-5.714 0"})})}const Rn=m.lazy(()=>Ut(()=>import("./TerminalView-CguHyqU9.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.TerminalView})));function Mn({isOpen:e,running:s,toggle:r}){return t.jsxs(O,{variant:e?"secondary":"ghost",size:"sm",onClick:r,title:"Toggle orchestrator",className:"relative gap-1.5",children:[t.jsx(In,{className:"h-4 w-4"}),t.jsx("span",{className:"text-xs hidden sm:inline",children:"Orchestrator"}),s&&t.jsxs("span",{className:"absolute -top-0.5 -right-0.5 flex h-2.5 w-2.5",children:[t.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75"}),t.jsx("span",{className:"relative inline-flex h-2.5 w-2.5 rounded-full bg-emerald-500"})]})]})}function Bn(){const{isOpen:e,close:s,running:r,loading:o,start:a,stop:l}=xt();return m.useEffect(()=>{if(!e)return;const u=d=>{d.key==="Escape"&&s()};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,s]),t.jsxs("div",{className:`fixed inset-0 z-50 flex items-center justify-center transition-all duration-200 ${e?"visible opacity-100":"invisible opacity-0 pointer-events-none"}`,children:[t.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:s}),t.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"orchestrator-title",className:`relative z-10 flex h-[80vh] w-[90vw] max-w-5xl flex-col overflow-hidden rounded-xl border border-border bg-card shadow-2xl transition-transform duration-200 ${e?"scale-100":"scale-95"}`,children:[t.jsxs("div",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:`h-2 w-2 rounded-full ${r?"bg-emerald-500 animate-pulse":"bg-muted-foreground/30"}`}),t.jsx("span",{id:"orchestrator-title",className:"text-sm font-medium",children:"Orchestrator"})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[r&&t.jsx(O,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:l,children:"Stop"}),t.jsx("button",{onClick:s,className:"rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground",children:t.jsx(Pn,{})})]})]}),t.jsx("div",{className:"flex-1 overflow-hidden",children:o?t.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"Loading..."}):r?t.jsx(m.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"Loading terminal..."}),children:t.jsx(Rn,{wsUrl:"/ws/terminal/orchestrator",visible:e})}):t.jsx(Xe,{icon:t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("polyline",{points:"4 17 10 11 4 5"}),t.jsx("line",{x1:"12",x2:"20",y1:"19",y2:"19"})]}),heading:"Orchestrator not running",subtext:"Start the orchestrator to manage task queues",action:t.jsx(O,{onClick:a,children:"Start Orchestrator"}),className:"h-full"})})]})]})}function In({className:e}){return t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:[t.jsx("polyline",{points:"4 17 10 11 4 5"}),t.jsx("line",{x1:"12",x2:"20",y1:"19",y2:"19"})]})}function Pn(){return t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M18 6 6 18"}),t.jsx("path",{d:"m6 6 12 12"})]})}function Dn(){const e=xt();return t.jsxs("header",{className:"flex h-12 shrink-0 items-center justify-between border-b border-border bg-card px-4",children:[t.jsxs(Gt,{to:"/",className:"flex items-center gap-2.5",children:[t.jsx("img",{src:"/logo.png",alt:"octomux",className:"h-6 w-6 brightness-150 saturate-200"}),t.jsx("span",{className:"text-base font-semibold tracking-tight",children:"octomux"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Mn,{isOpen:e.isOpen,running:e.running,toggle:e.toggle}),t.jsx(zn,{}),t.jsx(xs,{})]})]})}const On=m.lazy(()=>Ut(()=>import("./TaskDetail-DsKJCcdC.js"),__vite__mapDeps([4,1,0,2,3,5,6])));function $n(){const{tasks:e}=ft(),s=Je();return Dr(e),Fr(e,s),null}class Fn extends m.Component{constructor(){super(...arguments);Tt(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}render(){return this.state.error?t.jsxs("div",{className:"flex h-screen flex-col items-center justify-center gap-4 bg-background text-foreground",children:[t.jsx("p",{className:"text-lg font-semibold text-destructive",children:"Something went wrong"}),t.jsx("p",{className:"max-w-md text-center text-sm text-muted-foreground",children:this.state.error.message}),t.jsx("button",{className:"rounded-md bg-primary px-4 py-2 text-sm text-primary-foreground",onClick:()=>{this.setState({error:null}),window.location.reload()},children:"Reload"})]}):this.props.children}}function Wn(){return t.jsx(Fn,{children:t.jsxs(fn,{children:[t.jsxs("div",{className:"flex h-screen flex-col bg-background text-foreground",children:[t.jsx(Lr,{theme:"dark",position:"bottom-right",richColors:!0}),t.jsx($n,{}),t.jsx(Dn,{}),t.jsx("div",{className:"min-h-0 flex-1",children:t.jsxs(Os,{children:[t.jsx(rt,{path:"/",element:t.jsx(kn,{})}),t.jsx(rt,{element:t.jsx(_n,{}),children:t.jsx(rt,{path:"/tasks/:id",element:t.jsx(On,{})})})]})})]}),t.jsx(Bn,{})]})})}Bs.createRoot(document.getElementById("root")).render(t.jsx(m.StrictMode,{children:t.jsx($s,{children:t.jsx(Wn,{})})}));export{O as B,rn as D,Xe as E,Oe as I,Le as L,Ze as P,ps as S,ut as T,on as a,ln as b,J as c,cn as d,dn as e,G as f,Qe as g,et as h,De as i,Kn as u};