@wjarka/cezarion 0.18.0-dev.6810 → 0.18.0-dev.6835

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/package.json +2 -2
  2. package/web/dist/assets/{activity-motion-AuQA350-.js → activity-motion-awuRigEi.js} +1 -1
  3. package/web/dist/assets/{activity-route-BNZ9bOOZ.js → activity-route-rhYVhpXu.js} +1 -1
  4. package/web/dist/assets/{agent-accounts-D2uZHuiM.js → agent-accounts-D3q1WLxk.js} +1 -1
  5. package/web/dist/assets/attention-CdwMIvQG.js +1 -0
  6. package/web/dist/assets/{cez-idle-MToU9Wv_.js → cez-idle-BqmM5iRr.js} +1 -1
  7. package/web/dist/assets/{commit-diff-panel-DBW7us79.js → commit-diff-panel-CZAQ_wMQ.js} +1 -1
  8. package/web/dist/assets/{diff-C3Cms5Ep.js → diff-BDJ4xGSd.js} +2 -2
  9. package/web/dist/assets/{diff-view-D5zTYOKV.js → diff-view-Bn7tV6S7.js} +1 -1
  10. package/web/dist/assets/{file-preview-FhzIdXZ3.js → file-preview-1f8vPVsK.js} +1 -1
  11. package/web/dist/assets/{git-toolbar-MFjkjDDG.js → git-toolbar-BbY7l1x9.js} +1 -1
  12. package/web/dist/assets/{github-CYmdc5Dh.js → github-CTdrVztq.js} +1 -1
  13. package/web/dist/assets/{global-activity-route-C41ofuHV.js → global-activity-route-xvY0P60v.js} +1 -1
  14. package/web/dist/assets/{index-e1OpsDKN.js → index-MgNz22Tg.js} +4 -4
  15. package/web/dist/assets/{live-protocol-B8boP96Z.js → live-protocol-BmbbwF5R.js} +1 -1
  16. package/web/dist/assets/{preview-pane-connected-Ds209_UZ.js → preview-pane-connected-D6TfZFTU.js} +1 -1
  17. package/web/dist/assets/{project-router-F1inY-EB.js → project-router-BqAKGSaS.js} +1 -1
  18. package/web/dist/assets/{project-scope-context-0Z0nsheq.js → project-scope-context-B0yKt2yI.js} +1 -1
  19. package/web/dist/assets/{prompt-template-menu-uUjg9v98.js → prompt-template-menu-DpCrLDWG.js} +1 -1
  20. package/web/dist/assets/{queries-7W9tOZsg.js → queries-DoYRza8s.js} +1 -1
  21. package/web/dist/assets/{reference-chip-BqRpnpaI.js → reference-chip-Dd_YU2KX.js} +1 -1
  22. package/web/dist/assets/{repo-git-BZcRanYE.js → repo-git-BrkR6pTH.js} +1 -1
  23. package/web/dist/assets/{report-reader-BLlV3dPF.js → report-reader-BeZdoVhf.js} +1 -1
  24. package/web/dist/assets/{reports-C--EXqf1.js → reports-D93WfzdD.js} +1 -1
  25. package/web/dist/assets/{run-header-CJg8dyfz.js → run-header-FB4j_Fjm.js} +1 -1
  26. package/web/dist/assets/{skills-CHWVejdV.js → skills-BV3eF6mC.js} +1 -1
  27. package/web/dist/assets/{tab-link-XI9xWLwR.js → tab-link-CGzPcVvS.js} +1 -1
  28. package/web/dist/assets/{task-changes-DFm_EHnj.js → task-changes-f9ldtHuA.js} +1 -1
  29. package/web/dist/assets/{task-commits-BX-GVdXG.js → task-commits-CLjEhkFM.js} +1 -1
  30. package/web/dist/assets/{task-files-Dsn11PYu.js → task-files-BEKlg0dR.js} +1 -1
  31. package/web/dist/assets/{task-github-item-3N6jEijR.js → task-github-item-CbdPCKot.js} +1 -1
  32. package/web/dist/assets/{task-thread-VNPhkI8i.js → task-thread-BPSL3OMS.js} +1 -1
  33. package/web/dist/assets/{thread-state-D1XLo7ab.js → thread-state-ZdBez7Ij.js} +1 -1
  34. package/web/dist/assets/{use-desktop-DdcA0Atl.js → use-desktop-BwkqVHep.js} +1 -1
  35. package/web/dist/assets/{use-hand-to-agent-state-2tzEmCDo.js → use-hand-to-agent-state-BOD9cT6o.js} +1 -1
  36. package/web/dist/assets/{useInfiniteQuery-BmmIZbVY.js → useInfiniteQuery-DYAQvmMU.js} +1 -1
  37. package/web/dist/assets/useQuery-CnVG8NoC.js +1 -0
  38. package/web/dist/assets/{workflows-CqqdPBFr.js → workflows-Driy32Xn.js} +1 -1
  39. package/web/dist/assets/{ws-BvDSfSVH.js → ws-BXpZYApG.js} +1 -1
  40. package/web/dist/index.html +14 -14
  41. package/web/dist/live-worker.js +1 -1
  42. package/web/dist/assets/attention-B7icDSLh.js +0 -1
  43. package/web/dist/assets/useQuery-CBKC2lBX.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{C as t,E as n,I as r,N as i,d as a,p as o,t as s,u as c,w as l}from"./button-DGwhwRuD.js";import{i as u,r as d,t as f}from"./react-runtime-CCIEwYL0.js";import{n as p}from"./live-refetch-CZb2VOyu.js";import{E as m,Ln as h,P as g,Qn as _,Ur as v,_ as y,ar as b,cr as x,d as S,i as C,l as w,rr as T,w as E,yr as D}from"./project-scope-context-0Z0nsheq.js";import{$ as O,H as ee,L as k,P as A,Qt as j,S as te,St as ne,Tt as M,Xt as N,Yt as re,c as P,d as F,h as I,ht as L,kt as R,lt as ie,n as z,nn as B,q as ae,tn as V,wt as oe,yt as se}from"./queries-7W9tOZsg.js";import{$ as ce,E as le,L as ue,Y as de,Z as fe,_ as pe,b as me,et as he,l as ge,n as _e,p as H,q as ve,w as ye,z as U}from"./use-desktop-DdcA0Atl.js";import{n as W}from"./toaster-CoMJoQvk.js";import{A as be,B as xe,I as Se,J as Ce,Q as we,V as Te,_ as Ee,b as De,c as Oe,ct as ke,d as G,ft as Ae,h as je,j as Me,l as Ne,n as Pe,ot as Fe,p as Ie,pt as Le,st as Re,u as ze,y as Be}from"./design-icons-DmYTv2r1.js";import{t as K}from"./createLucideIcon-BHp8sXmF.js";import{_ as Ve,a as He,c as Ue,d as We,f as Ge,g as Ke,h as qe,i as Je,l as Ye,m as Xe,n as Ze,o as Qe,p as $e,r as et,s as tt,t as nt,u as rt,v as it}from"./run-header-CJg8dyfz.js";import{t as at}from"./eye-B8okNWXU.js";import{a as ot}from"./format-BNCkW110.js";import{t as st}from"./message-square-B-MD-8rD.js";import{a as ct,c as lt,i as ut,n as dt,o as ft,r as pt,s as mt,t as ht}from"./thread-state-D1XLo7ab.js";import{i as gt,o as _t,t as vt,u as yt}from"./reference-chip-BqRpnpaI.js";import{s as bt,t as q}from"./project-router-F1inY-EB.js";import"./attention-B7icDSLh.js";import{E as xt,S as St,T as Ct,U as wt,a as Tt,b as Et,i as Dt,n as Ot,r as kt,t as At,w as jt,x as Mt}from"./agent-accounts-D2uZHuiM.js";import{n as Nt,t as Pt}from"./centered-state-B5QmAy2y.js";import{$ as Ft,$t as It,At as Lt,B as Rt,Ct as zt,Dt as Bt,Et as Vt,Gt as Ht,Ht as Ut,J as Wt,Kt as Gt,L as Kt,Ot as qt,S as Jt,St as Yt,U as Xt,Ut as Zt,Vt as Qt,Wt as $t,Y as en,_ as tn,bt as nn,c as J,cn as rn,dn as an,et as on,f as sn,i as cn,kt as ln,l as Y,n as un,on as dn,s as fn,tn as pn,tt as mn,u as X,w as hn,yt as gn,z as _n}from"./index-e1OpsDKN.js";import{t as vn}from"./zoomable-image-C7mEDZaS.js";import{t as yn}from"./report-title-D4Mbu2Er.js";var bn=K(`anchor`,[[`path`,{d:`M12 6v16`,key:`nqf5sj`}],[`path`,{d:`m19 13 2-1a9 9 0 0 1-18 0l2 1`,key:`y7qv08`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}]]),xn=K(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),Sn=K(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),Cn=K(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),wn=K(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Tn=K(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),En=K(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Z=e(u(),1),Q=f(),Dn=12;function On({run:e}){let t=v(),n=B({mutationFn:()=>w(e.id),onSuccess:()=>{t.invalidateQueries({queryKey:z.runs.detail(e.id)}),t.invalidateQueries({queryKey:z.runs.list()}),W(`This task will not resume itself`)},onError:e=>W(e.message,{tone:`danger`})});if(!T(e))return null;let r=new Date(e.autoResumeAt);if(!Number.isFinite(r.getTime()))return null;let i=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(r);return(0,Q.jsxs)(`div`,{"data-slot":`auto-resume-hint`,role:`status`,className:`flex flex-wrap items-center gap-x-2 gap-y-1 px-1 text-xs text-muted-foreground`,children:[(0,Q.jsx)(Gt,{tone:`neutral`,shape:`ring`}),e.autoResumeReason===`provider-error`?(0,Q.jsxs)(`span`,{title:e.error,children:[`Provider error — this task retries automatically at`,` `,(0,Q.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:i}),` `,`(attempt `,(e.autoResumeAttempts??0)+1,` of `,Dn,`)`]}):(0,Q.jsxs)(`span`,{children:[`Usage limit reached — this task resumes automatically at`,` `,(0,Q.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:i})]}),(0,Q.jsx)(`button`,{type:`button`,"data-action":`auto-resume-cancel`,disabled:n.isPending,onClick:()=>n.mutate(),className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground disabled:opacity-50`,children:`Don’t resume`}),(0,Q.jsx)(o,{to:`/settings/global/resources`,"data-slot":`auto-resume-settings-link`,className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground`,children:`Auto-resume settings`})]})}function kn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var An=/^[A-Za-z0-9_./:=+,@%-]+$/;function jn(e){return e.replaceAll(`'`,`'\\''`)}function Mn(e){return e===``?`''`:An.test(e)?e:`\u0027${jn(e)}\u0027`}function Nn(e){if(!kn(e))return;let t=e.command;if(typeof t==`string`&&t!==``)return t;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return e.map(Mn).join(` `)}}function Pn(e){let t="`".repeat(3),n=`~`.repeat(3);return e.split(t).filter((e,t)=>t%2==0).join(` `).split(n).filter((e,t)=>t%2==0).join(` `).split("`").filter((e,t)=>t%2==0).join(` `)}function Fn(e){return e.replace(/!\[(?:\\.|[^\]\\])*\]\([^)\s]*(?:\s+"[^"]*")?\)/g,` `)}function In(e){return e.replace(/(?<!\\)(?:\*\*|\*|__|~~|`)/g,``).replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~])/g,`$1`)}function Ln(e){let t=e.trim();return t===``||t.startsWith(`#`)||/^(https?:|mailto:)/i.test(t)?!0:!/^[a-z][a-z0-9+.-]*:/i.test(t)}function Rn(e){let t=Pn(Fn(e)),n=new Map;for(let e of t.matchAll(/^\s*\[([^\]]+)\]:\s*(\S+)/gm))Ln(e[2])&&n.set(e[1].toLowerCase(),e[2]);let r=t.replace(/^\s*\[[^\]]+\]:\s*\S+.*$/gm,` `),i=[];for(let e of r.matchAll(/(?<!!)\[((?:\\.|[^\]\\])+)\](?:\(((?:[^()\s]|\([^)]*\))+)(?:\s+"[^"]*")?\)|\[([^\]]*)\])|<(https?:\/\/[^>\s]+)>|(https?:\/\/[^\s<]+)/g)){if(e[2]){Ln(e[2])&&i.push({label:In(e[1]),href:e[2]});continue}if(e[1]!==void 0&&e[3]!==void 0){let t=(e[3].length>0?e[3]:e[1]).toLowerCase(),r=n.get(t);r&&i.push({label:In(e[1]),href:r});continue}let t=(e[4]??e[5])?.replace(/[.,;:!?]+$/,``);t&&Ln(t)&&i.push({label:t,href:t})}return i}var zn=(0,Z.createContext)(void 0),Bn=(0,Z.createContext)(void 0);function Vn(e,t){let n=new Map;for(let r of Rn(e)){let e=Rt(r.href,t);if(!e)continue;let i=new URL(e,`https://cockpit.invalid`),a=/^\/p\/([^/]+)\/tasks\/([^/]+)\/report$/.exec(i.pathname),o=/^\/tasks\/([^/]+)\/report$/.exec(i.pathname),s=i.searchParams.get(`artifact`);if(!s||(a?decodeURIComponent(a[1])!==t.projectId:!o))continue;let c=decodeURIComponent(a?a[2]:o[1]),l=`${c}:${s}`;n.has(l)||n.set(l,{runId:c,artifactId:s,label:r.label,href:e})}return[...n.values()]}function Hn(e,t){return`report-card-${encodeURIComponent(e)}-${t}`}function Un({text:e,messageKey:t}){let n=(0,Z.useContext)(_n),r=(0,Z.useContext)(Bn),i=t??r;if(!n||i===void 0)return null;let a=Vn(e,n);return a.length===0?null:(0,Q.jsx)(`div`,{"data-slot":`report-cards`,className:`flex flex-col gap-3 [margin-block-start:1rem]`,children:a.map(e=>(0,Q.jsx)(Wn,{reference:e,messageKey:i},`${e.runId}:${e.artifactId}`))})}function Wn({reference:e,messageKey:n}){let{artifactId:r,runId:i,label:a,href:s}=e,c=(0,Z.useContext)(zn),u=(0,Z.useContext)(Jt);(0,Z.useLayoutEffect)(()=>u?.register(r,i),[u,r,i]);let d=F(i,r),f=t(),p=l();if(d.isError)return(0,Q.jsx)(o,{id:Hn(n,r),"data-slot":`report-card-fallback`,to:s,state:{readerFrom:f.pathname+f.search},children:a});let m=d.data?.artifact;if(m&&!Xt(m.name))return null;let h=new URLSearchParams(f.search);h.set(`report`,r),h.set(`card`,n);let g=new URLSearchParams(f.search).has(`report`)?f.state:null,_=new URLSearchParams(f.search);_.delete(`report`),_.delete(`card`);let v=`${f.pathname}${_.size?`?${_}`:``}`,y=window.navigation,b={reportCardEntry:!0,reportReturnTo:g?.reportReturnTo??v,reportReturnKey:g?.reportReturnKey??y?.currentEntry?.key,reportScrollTop:g?.reportScrollTop},x={pathname:f.pathname,search:`?${h}`,hash:new URL(s,`https://cockpit.invalid`).hash};return(0,Q.jsxs)(`section`,{"data-slot":`report-card`,"data-artifact-id":r,"data-report-run-id":i,"aria-busy":d.isPending,className:`flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-card p-3 text-foreground`,children:[(0,Q.jsx)(`h3`,{className:`break-words text-sm font-medium`,children:m?yn(m):a}),(0,Q.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`HTML report`}),(0,Q.jsx)(o,{id:Hn(n,r),to:x,state:b,onClick:e=>{if(e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault(),c?.(n);let t=b.reportScrollTop??document.querySelector(`[data-slot="main"]`)?.scrollTop;p(x,{state:{...b,reportScrollTop:t}})},className:`inline-flex min-h-11 min-w-11 items-center self-start rounded-md border border-border px-3 text-sm active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring ${d.isPending?`text-soft-foreground`:`text-accent-text`}`,children:`Read report`})]})}var Gn={message:!0,reasoning:!0,tool:!0,hook:!0};function Kn(e){return Object.hasOwn(Gn,e)&&Gn[e]}var qn=e=>e.kind===`tool`,Jn=e=>e.kind===`conversation`,Yn=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,Xn=(e,t,n)=>`${e} ${e===1?t:n}`;function Zn(e,t){let n=[];return e>0&&n.push(Xn(e,`file`,`files`)),t>0&&n.push(Xn(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function Qn(e){return`${e} earlier tool call${e===1?``:`s`}`}var $n=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function er(e){for(let t of $n)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}function tr(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(qn).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=Kn(e.kind)&&`parentItemId`in e&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:Zn(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]},c=[],l=()=>{if(c.length!==0){for(let e of nr(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(Jn(e)){s(),c.push(e);continue}l(),qn(e)&&Yn(e)&&!r.has(e.id)?o.push(e):(s(),qn(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}))}s(),l();let u=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,d=e=>e.kind===`context-group`?e.tools.length:1,f=[],p=[],m=()=>{if(p.length>3){let e=p.slice(0,p.length-3);f.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+d(t),0),blocks:e}),f.push(...p.slice(p.length-3))}else f.push(...p);p=[]};for(let e of a)u(e)?p.push(e):(m(),f.push(e));return m(),f}function nr(e){let t=[];for(let n of e){let e=t.at(-1);n.messageKind===`request`&&e?.kind===`request`&&e.senderRunId===n.senderRunId&&e.text===n.text&&e.messages[0].relationship===`peer`==(n.relationship===`peer`)&&!e.messages.some(e=>e.recipientRunId===n.recipientRunId)?e.messages.push(n):t.push({id:`worker-batch:${n.messageId}`,kind:n.messageKind,text:n.text,senderRunId:n.senderRunId,messages:[n]})}return{kind:`worker-conversation`,id:`worker:${e[0].id}`,batches:t}}var rr=new Map,ir=(0,Z.createContext)(null);function ar(){return(0,Z.useContext)(ir)}function or({runId:e,children:t}){let n=(0,Z.useMemo)(()=>({get:t=>rr.get(e)?.get(t),set:(t,n)=>{let r=rr.get(e)??new Map;r.set(t,n),rr.set(e,r)}}),[e]);return(0,Q.jsx)(ir.Provider,{value:n,children:t})}function sr(e){return e.scrollTop<Math.max(600,e.clientHeight)}function cr(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function lr(e,t,n,r,i){if(n===void 0)return i;let a=r.find(({key:e})=>e===n.key);return a===void 0?i:e+(a.top-t-n.offset)}function ur(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function dr(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var fr=new Map;function pr(e,t){fr.set(e,t)}function mr(e){return fr.get(e)}var hr=new Map;function gr(e,t){hr.set(e,{...t,...t.rowKeys?{rowKeys:[...t.rowKeys]}:{}})}function _r(e){return hr.get(e)}function vr(e,t,n){let r=hr.get(e);if(!r||r.rows!==t)return;let i=r.rowKeys;if(!(n&&i&&(n.length!==t||i.length!==t||!n.every((e,t)=>e===i[t]))))return r.cache}var yr=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}),br=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),xr=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),Sr=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),Cr=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function $(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function wr(e){let t=$(e);return t===void 0?void 0:yr.format(t)}function Tr(e){let t=$(e);return t===void 0?void 0:br.format(t)}var Er=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function Dr(e){let t=$(e);return t===void 0?void 0:Er(t)}function Or(e,t=new Date){let n=$(e);if(n===void 0)return;let r=Er(n);return r===Er(t)?`Today`:r===Er(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?xr:Sr).format(n)}function kr(e,t){let n=$(e),r=$(t);if(n===void 0||r===void 0)return;let i=Math.round((r.getTime()-n.getTime())/1e3);if(i<0)return;if(i<60)return`${i}s`;let a=Math.floor(i/60);return a<60?`${a}m ${String(i%60).padStart(2,`0`)}s`:`${Math.floor(a/60)}h ${String(a%60).padStart(2,`0`)}m`}function Ar({ts:e}){let t=wr(e);return t===void 0?null:(0,Q.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:Tr(e),className:`text-[11px] leading-none text-soft-foreground`,children:t})}function jr({startedAt:e,completedAt:t}){let n=wr(t);if(n===void 0)return null;let r=kr(e,t);return(0,Q.jsxs)(`div`,{"data-slot":`turn-time`,className:`flex items-center gap-1.5 px-0.5 text-[11px] leading-none text-soft-foreground`,children:[(0,Q.jsx)(`time`,{dateTime:t,title:Tr(t),children:n}),r===void 0?null:(0,Q.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function Mr({ts:e}){let t=Or(e),n=$(e);if(t===void 0||n===void 0)return null;let r=Cr.format(n);return(0,Q.jsxs)(`div`,{"data-slot":`day-separator`,role:`separator`,"aria-label":t===`Today`||t===`Yesterday`?`${t}, ${r}`:r,className:`flex items-center gap-3 py-1 text-[11px] font-medium text-soft-foreground`,children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,Q.jsx)(`time`,{dateTime:Dr(e),title:r,children:t}),(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}var Nr={user:{label:`YOUR MESSAGE`,speaker:`Your message`,classes:`border-message-user-border bg-message-user-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-user-accent`,accent:`text-message-user-accent`,body:`max-md:text-[12px]`},agent:{label:`AGENT RESPONSE`,speaker:`Agent response`,classes:`border-message-agent-border bg-message-agent-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-agent-accent`,accent:`text-message-agent-accent`,body:`text-[15px] md:text-[14px]`}};function Pr({role:e,children:t,className:n,ts:r,headerActions:i,...a}){let o=Nr[e],s=r===void 0?void 0:wr(r);return(0,Q.jsxs)(`article`,{...a,"data-role":e,"aria-label":o.speaker,className:c(`flex w-full min-w-0 flex-col gap-2 self-stretch rounded-[8px] border p-3 md:px-4 md:py-[14px]`,o.classes,n),children:[(0,Q.jsxs)(`p`,{className:c(`m-0 flex w-full min-w-0 items-start gap-2 text-[11px] leading-[1.2] font-semibold tracking-[0.6px] uppercase`,o.accent),children:[(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1 normal-case tracking-normal`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 uppercase tracking-[0.6px]`,children:[(0,Q.jsx)(st,{"aria-hidden":`true`,className:`size-4 shrink-0`}),o.label]}),i]}),s===void 0?null:(0,Q.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,Q.jsx)(Ar,{ts:r})})]}),(0,Q.jsx)(`div`,{className:c(`min-w-0 break-words text-[14px] text-foreground select-text [overflow-wrap:anywhere]`,o.body,`leading-[1.6]`),children:t})]})}function Fr({text:e,imageCount:t=0,images:n=[],ts:r,onEdit:a,onRemove:o,editLabel:s=`Edit message`,removeLabel:c=`Remove message`,children:l}){let u=t-n.length,[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(e),[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(),y=()=>{m(e),v(void 0),f(!0)},b=async()=>{let t=p.trim();if(!t||t===e){f(!1);return}g(!0),v(void 0);try{await a?.(t),f(!1)}catch(e){v(e instanceof Error?e.message:`Could not save the message`)}finally{g(!1)}},S=async()=>{g(!0),v(void 0);try{await o?.()}catch(e){v(e instanceof Error?e.message:`Could not remove the message`)}finally{g(!1)}};return d?(0,Q.jsxs)(Pr,{role:`user`,ts:r,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,Q.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),f(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),b())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[14px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,Q.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>f(!1),disabled:h,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm px-2 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void b(),disabled:h,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm bg-action px-2 text-xs font-semibold text-action-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:h?(0,Q.jsx)(ot,{className:`size-3.5 animate-spin`}):`Save`})]}),_?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:_}):null]}):(0,Q.jsxs)(Pr,{role:`user`,ts:r,"data-slot":`user-bubble`,className:`group`,children:[a||o?(0,Q.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[a?(0,Q.jsx)(`button`,{type:`button`,"aria-label":s,onClick:y,disabled:h,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Q.jsx)(En,{className:`size-3.5`})}):null,o?(0,Q.jsx)(`button`,{type:`button`,"aria-label":c,onClick:()=>void S(),disabled:h,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Q.jsx)(Re,{className:`size-3.5`})}):null]}):null,_?(0,Q.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:_}):null,l??(0,Q.jsx)(Kt,{breaks:!0,children:e}),n.length>0?(0,Q.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>x(e.split(`/`).pop()??``)?(0,Q.jsx)(vn,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,Q.jsxs)(`a`,{href:i(e),download:!0,"data-slot":`user-file`,className:`inline-flex min-h-11 min-w-11 max-w-[220px] items-center gap-1.5 rounded-md border border-border bg-background/60 px-2 py-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Q.jsx)(Ce,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,u>0?(0,Q.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[u,` image`,u>1?`s`:``,` attached`]}):null]})}var Ir=`inline-flex h-11 min-w-11 items-center justify-center gap-1 rounded-sm px-2 text-xs font-medium text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,Lr=[`[data-streamdown="code-block-actions"]`,`[data-streamdown="code-copy-button"]`,`[data-streamdown="code-block-copy-button"]`,`[data-streamdown="code-block-header"]`].join(`,`);function Rr(e,t){let n=e.cloneNode(!0);n.querySelectorAll(Lr).forEach(e=>e.remove());let r=Rn(t);return[...n.querySelectorAll(`button[data-streamdown="link"]`)].forEach(e=>{let t=e.textContent??``,i=r.findIndex(e=>e.label===t);if(i<0)return;let a=r.splice(i,1)[0];if(!a||!Ln(a.href))return;let o=n.ownerDocument.createElement(`a`);o.setAttribute(`href`,a.href),o.setAttribute(`data-streamdown`,`link`),o.textContent=e.textContent,e.replaceWith(o)}),n.innerHTML}async function zr(e,t,n){if(e===`markdown`){if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(t);return}if(!navigator.clipboard?.write||typeof ClipboardItem>`u`||!n)throw Error(`Clipboard unavailable`);let r=Rr(n,t);await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([r],{type:`text/html`}),"text/plain":new Blob([t],{type:`text/plain`})})])}function Br({text:e,ts:t,messageKey:n}){let r=(0,Z.useRef)(null),[i,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(null),c=(0,Z.useRef)(null);(0,Z.useEffect)(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]);let l=async t=>{c.current!==null&&clearTimeout(c.current),a(null),s(null);try{await zr(t,e,r.current),a(t),c.current=setTimeout(()=>a(null),2e3)}catch{s(`Couldn't copy to the clipboard`)}};return(0,Q.jsxs)(Pr,{role:`agent`,ts:t,"data-slot":`assistant-message`,headerActions:(0,Q.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`flex items-center gap-0.5`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply`,onClick:()=>void l(`html`),className:Ir,children:[(0,Q.jsx)(Be,{className:`size-3.5`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{"aria-live":`polite`,children:i===`html`?`Copied`:`Copy`})]}),(0,Q.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply as markdown`,onClick:()=>void l(`markdown`),className:Ir,children:[(0,Q.jsx)(rn,{className:`size-3.5`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{"aria-live":`polite`,children:i===`markdown`?`Copied`:`Copy markdown`})]})]}),children:[o?(0,Q.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:o}):null,(0,Q.jsx)(`div`,{ref:r,children:(0,Q.jsx)(Kt,{breaks:!0,children:e})}),(0,Q.jsx)(Un,{text:e,messageKey:n})]})}function Vr({note:e}){return e.icon===`handoff`?(0,Q.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,"data-icon":`handoff`,className:`flex items-start gap-2 px-0.5 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`mt-[-1px] flex size-5 shrink-0 items-center justify-center rounded-full border border-border text-success`,children:(0,Q.jsx)(pn,{className:`size-3`})}),(0,Q.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}):(0,Q.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:c(`px-0.5 text-xs`,e.tone===`danger`?`text-danger [.light_&]:text-red-700`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:`· `,e.text]})}function Hr({incident:e}){let t=j(e.provider);return(0,Q.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,Q.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,t,` authorization`]}),(0,Q.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,t,` settings before retrying.`]}),(0,Q.jsx)(q,{to:`/settings/agents#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}function Ur({text:e}){let t=(0,Z.useId)();if(e.trim()===``)return null;let n=e.split(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{C as t,E as n,I as r,N as i,d as a,p as o,t as s,u as c,w as l}from"./button-DGwhwRuD.js";import{i as u,r as d,t as f}from"./react-runtime-CCIEwYL0.js";import{n as p}from"./live-refetch-CZb2VOyu.js";import{E as m,Ln as h,P as g,Qn as _,Ur as v,_ as y,ar as b,cr as x,d as S,i as C,l as w,rr as T,w as E,yr as D}from"./project-scope-context-B0yKt2yI.js";import{$ as O,H as ee,L as k,P as A,Qt as j,S as te,St as ne,Tt as M,Xt as N,Yt as re,c as P,d as F,h as I,ht as L,kt as R,lt as ie,n as z,nn as B,q as ae,tn as V,wt as oe,yt as se}from"./queries-DoYRza8s.js";import{$ as ce,E as le,L as ue,Y as de,Z as fe,_ as pe,b as me,et as he,l as ge,n as _e,p as H,q as ve,w as ye,z as U}from"./use-desktop-BwkqVHep.js";import{n as W}from"./toaster-CoMJoQvk.js";import{A as be,B as xe,I as Se,J as Ce,Q as we,V as Te,_ as Ee,b as De,c as Oe,ct as ke,d as G,ft as Ae,h as je,j as Me,l as Ne,n as Pe,ot as Fe,p as Ie,pt as Le,st as Re,u as ze,y as Be}from"./design-icons-DmYTv2r1.js";import{t as K}from"./createLucideIcon-BHp8sXmF.js";import{_ as Ve,a as He,c as Ue,d as We,f as Ge,g as Ke,h as qe,i as Je,l as Ye,m as Xe,n as Ze,o as Qe,p as $e,r as et,s as tt,t as nt,u as rt,v as it}from"./run-header-FB4j_Fjm.js";import{t as at}from"./eye-B8okNWXU.js";import{a as ot}from"./format-BNCkW110.js";import{t as st}from"./message-square-B-MD-8rD.js";import{a as ct,c as lt,i as ut,n as dt,o as ft,r as pt,s as mt,t as ht}from"./thread-state-ZdBez7Ij.js";import{i as gt,o as _t,t as vt,u as yt}from"./reference-chip-Dd_YU2KX.js";import{s as bt,t as q}from"./project-router-BqAKGSaS.js";import"./attention-CdwMIvQG.js";import{E as xt,S as St,T as Ct,U as wt,a as Tt,b as Et,i as Dt,n as Ot,r as kt,t as At,w as jt,x as Mt}from"./agent-accounts-D3q1WLxk.js";import{n as Nt,t as Pt}from"./centered-state-B5QmAy2y.js";import{$ as Ft,$t as It,At as Lt,B as Rt,Ct as zt,Dt as Bt,Et as Vt,Gt as Ht,Ht as Ut,J as Wt,Kt as Gt,L as Kt,Ot as qt,S as Jt,St as Yt,U as Xt,Ut as Zt,Vt as Qt,Wt as $t,Y as en,_ as tn,bt as nn,c as J,cn as rn,dn as an,et as on,f as sn,i as cn,kt as ln,l as Y,n as un,on as dn,s as fn,tn as pn,tt as mn,u as X,w as hn,yt as gn,z as _n}from"./index-MgNz22Tg.js";import{t as vn}from"./zoomable-image-C7mEDZaS.js";import{t as yn}from"./report-title-D4Mbu2Er.js";var bn=K(`anchor`,[[`path`,{d:`M12 6v16`,key:`nqf5sj`}],[`path`,{d:`m19 13 2-1a9 9 0 0 1-18 0l2 1`,key:`y7qv08`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}]]),xn=K(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),Sn=K(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),Cn=K(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),wn=K(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Tn=K(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),En=K(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Z=e(u(),1),Q=f(),Dn=12;function On({run:e}){let t=v(),n=B({mutationFn:()=>w(e.id),onSuccess:()=>{t.invalidateQueries({queryKey:z.runs.detail(e.id)}),t.invalidateQueries({queryKey:z.runs.list()}),W(`This task will not resume itself`)},onError:e=>W(e.message,{tone:`danger`})});if(!T(e))return null;let r=new Date(e.autoResumeAt);if(!Number.isFinite(r.getTime()))return null;let i=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(r);return(0,Q.jsxs)(`div`,{"data-slot":`auto-resume-hint`,role:`status`,className:`flex flex-wrap items-center gap-x-2 gap-y-1 px-1 text-xs text-muted-foreground`,children:[(0,Q.jsx)(Gt,{tone:`neutral`,shape:`ring`}),e.autoResumeReason===`provider-error`?(0,Q.jsxs)(`span`,{title:e.error,children:[`Provider error — this task retries automatically at`,` `,(0,Q.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:i}),` `,`(attempt `,(e.autoResumeAttempts??0)+1,` of `,Dn,`)`]}):(0,Q.jsxs)(`span`,{children:[`Usage limit reached — this task resumes automatically at`,` `,(0,Q.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:i})]}),(0,Q.jsx)(`button`,{type:`button`,"data-action":`auto-resume-cancel`,disabled:n.isPending,onClick:()=>n.mutate(),className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground disabled:opacity-50`,children:`Don’t resume`}),(0,Q.jsx)(o,{to:`/settings/global/resources`,"data-slot":`auto-resume-settings-link`,className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground`,children:`Auto-resume settings`})]})}function kn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var An=/^[A-Za-z0-9_./:=+,@%-]+$/;function jn(e){return e.replaceAll(`'`,`'\\''`)}function Mn(e){return e===``?`''`:An.test(e)?e:`\u0027${jn(e)}\u0027`}function Nn(e){if(!kn(e))return;let t=e.command;if(typeof t==`string`&&t!==``)return t;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return e.map(Mn).join(` `)}}function Pn(e){let t="`".repeat(3),n=`~`.repeat(3);return e.split(t).filter((e,t)=>t%2==0).join(` `).split(n).filter((e,t)=>t%2==0).join(` `).split("`").filter((e,t)=>t%2==0).join(` `)}function Fn(e){return e.replace(/!\[(?:\\.|[^\]\\])*\]\([^)\s]*(?:\s+"[^"]*")?\)/g,` `)}function In(e){return e.replace(/(?<!\\)(?:\*\*|\*|__|~~|`)/g,``).replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~])/g,`$1`)}function Ln(e){let t=e.trim();return t===``||t.startsWith(`#`)||/^(https?:|mailto:)/i.test(t)?!0:!/^[a-z][a-z0-9+.-]*:/i.test(t)}function Rn(e){let t=Pn(Fn(e)),n=new Map;for(let e of t.matchAll(/^\s*\[([^\]]+)\]:\s*(\S+)/gm))Ln(e[2])&&n.set(e[1].toLowerCase(),e[2]);let r=t.replace(/^\s*\[[^\]]+\]:\s*\S+.*$/gm,` `),i=[];for(let e of r.matchAll(/(?<!!)\[((?:\\.|[^\]\\])+)\](?:\(((?:[^()\s]|\([^)]*\))+)(?:\s+"[^"]*")?\)|\[([^\]]*)\])|<(https?:\/\/[^>\s]+)>|(https?:\/\/[^\s<]+)/g)){if(e[2]){Ln(e[2])&&i.push({label:In(e[1]),href:e[2]});continue}if(e[1]!==void 0&&e[3]!==void 0){let t=(e[3].length>0?e[3]:e[1]).toLowerCase(),r=n.get(t);r&&i.push({label:In(e[1]),href:r});continue}let t=(e[4]??e[5])?.replace(/[.,;:!?]+$/,``);t&&Ln(t)&&i.push({label:t,href:t})}return i}var zn=(0,Z.createContext)(void 0),Bn=(0,Z.createContext)(void 0);function Vn(e,t){let n=new Map;for(let r of Rn(e)){let e=Rt(r.href,t);if(!e)continue;let i=new URL(e,`https://cockpit.invalid`),a=/^\/p\/([^/]+)\/tasks\/([^/]+)\/report$/.exec(i.pathname),o=/^\/tasks\/([^/]+)\/report$/.exec(i.pathname),s=i.searchParams.get(`artifact`);if(!s||(a?decodeURIComponent(a[1])!==t.projectId:!o))continue;let c=decodeURIComponent(a?a[2]:o[1]),l=`${c}:${s}`;n.has(l)||n.set(l,{runId:c,artifactId:s,label:r.label,href:e})}return[...n.values()]}function Hn(e,t){return`report-card-${encodeURIComponent(e)}-${t}`}function Un({text:e,messageKey:t}){let n=(0,Z.useContext)(_n),r=(0,Z.useContext)(Bn),i=t??r;if(!n||i===void 0)return null;let a=Vn(e,n);return a.length===0?null:(0,Q.jsx)(`div`,{"data-slot":`report-cards`,className:`flex flex-col gap-3 [margin-block-start:1rem]`,children:a.map(e=>(0,Q.jsx)(Wn,{reference:e,messageKey:i},`${e.runId}:${e.artifactId}`))})}function Wn({reference:e,messageKey:n}){let{artifactId:r,runId:i,label:a,href:s}=e,c=(0,Z.useContext)(zn),u=(0,Z.useContext)(Jt);(0,Z.useLayoutEffect)(()=>u?.register(r,i),[u,r,i]);let d=F(i,r),f=t(),p=l();if(d.isError)return(0,Q.jsx)(o,{id:Hn(n,r),"data-slot":`report-card-fallback`,to:s,state:{readerFrom:f.pathname+f.search},children:a});let m=d.data?.artifact;if(m&&!Xt(m.name))return null;let h=new URLSearchParams(f.search);h.set(`report`,r),h.set(`card`,n);let g=new URLSearchParams(f.search).has(`report`)?f.state:null,_=new URLSearchParams(f.search);_.delete(`report`),_.delete(`card`);let v=`${f.pathname}${_.size?`?${_}`:``}`,y=window.navigation,b={reportCardEntry:!0,reportReturnTo:g?.reportReturnTo??v,reportReturnKey:g?.reportReturnKey??y?.currentEntry?.key,reportScrollTop:g?.reportScrollTop},x={pathname:f.pathname,search:`?${h}`,hash:new URL(s,`https://cockpit.invalid`).hash};return(0,Q.jsxs)(`section`,{"data-slot":`report-card`,"data-artifact-id":r,"data-report-run-id":i,"aria-busy":d.isPending,className:`flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-card p-3 text-foreground`,children:[(0,Q.jsx)(`h3`,{className:`break-words text-sm font-medium`,children:m?yn(m):a}),(0,Q.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`HTML report`}),(0,Q.jsx)(o,{id:Hn(n,r),to:x,state:b,onClick:e=>{if(e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault(),c?.(n);let t=b.reportScrollTop??document.querySelector(`[data-slot="main"]`)?.scrollTop;p(x,{state:{...b,reportScrollTop:t}})},className:`inline-flex min-h-11 min-w-11 items-center self-start rounded-md border border-border px-3 text-sm active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring ${d.isPending?`text-soft-foreground`:`text-accent-text`}`,children:`Read report`})]})}var Gn={message:!0,reasoning:!0,tool:!0,hook:!0};function Kn(e){return Object.hasOwn(Gn,e)&&Gn[e]}var qn=e=>e.kind===`tool`,Jn=e=>e.kind===`conversation`,Yn=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,Xn=(e,t,n)=>`${e} ${e===1?t:n}`;function Zn(e,t){let n=[];return e>0&&n.push(Xn(e,`file`,`files`)),t>0&&n.push(Xn(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function Qn(e){return`${e} earlier tool call${e===1?``:`s`}`}var $n=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function er(e){for(let t of $n)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}function tr(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(qn).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=Kn(e.kind)&&`parentItemId`in e&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:Zn(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]},c=[],l=()=>{if(c.length!==0){for(let e of nr(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(Jn(e)){s(),c.push(e);continue}l(),qn(e)&&Yn(e)&&!r.has(e.id)?o.push(e):(s(),qn(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}))}s(),l();let u=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,d=e=>e.kind===`context-group`?e.tools.length:1,f=[],p=[],m=()=>{if(p.length>3){let e=p.slice(0,p.length-3);f.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+d(t),0),blocks:e}),f.push(...p.slice(p.length-3))}else f.push(...p);p=[]};for(let e of a)u(e)?p.push(e):(m(),f.push(e));return m(),f}function nr(e){let t=[];for(let n of e){let e=t.at(-1);n.messageKind===`request`&&e?.kind===`request`&&e.senderRunId===n.senderRunId&&e.text===n.text&&e.messages[0].relationship===`peer`==(n.relationship===`peer`)&&!e.messages.some(e=>e.recipientRunId===n.recipientRunId)?e.messages.push(n):t.push({id:`worker-batch:${n.messageId}`,kind:n.messageKind,text:n.text,senderRunId:n.senderRunId,messages:[n]})}return{kind:`worker-conversation`,id:`worker:${e[0].id}`,batches:t}}var rr=new Map,ir=(0,Z.createContext)(null);function ar(){return(0,Z.useContext)(ir)}function or({runId:e,children:t}){let n=(0,Z.useMemo)(()=>({get:t=>rr.get(e)?.get(t),set:(t,n)=>{let r=rr.get(e)??new Map;r.set(t,n),rr.set(e,r)}}),[e]);return(0,Q.jsx)(ir.Provider,{value:n,children:t})}function sr(e){return e.scrollTop<Math.max(600,e.clientHeight)}function cr(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function lr(e,t,n,r,i){if(n===void 0)return i;let a=r.find(({key:e})=>e===n.key);return a===void 0?i:e+(a.top-t-n.offset)}function ur(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function dr(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var fr=new Map;function pr(e,t){fr.set(e,t)}function mr(e){return fr.get(e)}var hr=new Map;function gr(e,t){hr.set(e,{...t,...t.rowKeys?{rowKeys:[...t.rowKeys]}:{}})}function _r(e){return hr.get(e)}function vr(e,t,n){let r=hr.get(e);if(!r||r.rows!==t)return;let i=r.rowKeys;if(!(n&&i&&(n.length!==t||i.length!==t||!n.every((e,t)=>e===i[t]))))return r.cache}var yr=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}),br=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),xr=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),Sr=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),Cr=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function $(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function wr(e){let t=$(e);return t===void 0?void 0:yr.format(t)}function Tr(e){let t=$(e);return t===void 0?void 0:br.format(t)}var Er=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function Dr(e){let t=$(e);return t===void 0?void 0:Er(t)}function Or(e,t=new Date){let n=$(e);if(n===void 0)return;let r=Er(n);return r===Er(t)?`Today`:r===Er(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?xr:Sr).format(n)}function kr(e,t){let n=$(e),r=$(t);if(n===void 0||r===void 0)return;let i=Math.round((r.getTime()-n.getTime())/1e3);if(i<0)return;if(i<60)return`${i}s`;let a=Math.floor(i/60);return a<60?`${a}m ${String(i%60).padStart(2,`0`)}s`:`${Math.floor(a/60)}h ${String(a%60).padStart(2,`0`)}m`}function Ar({ts:e}){let t=wr(e);return t===void 0?null:(0,Q.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:Tr(e),className:`text-[11px] leading-none text-soft-foreground`,children:t})}function jr({startedAt:e,completedAt:t}){let n=wr(t);if(n===void 0)return null;let r=kr(e,t);return(0,Q.jsxs)(`div`,{"data-slot":`turn-time`,className:`flex items-center gap-1.5 px-0.5 text-[11px] leading-none text-soft-foreground`,children:[(0,Q.jsx)(`time`,{dateTime:t,title:Tr(t),children:n}),r===void 0?null:(0,Q.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function Mr({ts:e}){let t=Or(e),n=$(e);if(t===void 0||n===void 0)return null;let r=Cr.format(n);return(0,Q.jsxs)(`div`,{"data-slot":`day-separator`,role:`separator`,"aria-label":t===`Today`||t===`Yesterday`?`${t}, ${r}`:r,className:`flex items-center gap-3 py-1 text-[11px] font-medium text-soft-foreground`,children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,Q.jsx)(`time`,{dateTime:Dr(e),title:r,children:t}),(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}var Nr={user:{label:`YOUR MESSAGE`,speaker:`Your message`,classes:`border-message-user-border bg-message-user-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-user-accent`,accent:`text-message-user-accent`,body:`max-md:text-[12px]`},agent:{label:`AGENT RESPONSE`,speaker:`Agent response`,classes:`border-message-agent-border bg-message-agent-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-agent-accent`,accent:`text-message-agent-accent`,body:`text-[15px] md:text-[14px]`}};function Pr({role:e,children:t,className:n,ts:r,headerActions:i,...a}){let o=Nr[e],s=r===void 0?void 0:wr(r);return(0,Q.jsxs)(`article`,{...a,"data-role":e,"aria-label":o.speaker,className:c(`flex w-full min-w-0 flex-col gap-2 self-stretch rounded-[8px] border p-3 md:px-4 md:py-[14px]`,o.classes,n),children:[(0,Q.jsxs)(`p`,{className:c(`m-0 flex w-full min-w-0 items-start gap-2 text-[11px] leading-[1.2] font-semibold tracking-[0.6px] uppercase`,o.accent),children:[(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1 normal-case tracking-normal`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 uppercase tracking-[0.6px]`,children:[(0,Q.jsx)(st,{"aria-hidden":`true`,className:`size-4 shrink-0`}),o.label]}),i]}),s===void 0?null:(0,Q.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,Q.jsx)(Ar,{ts:r})})]}),(0,Q.jsx)(`div`,{className:c(`min-w-0 break-words text-[14px] text-foreground select-text [overflow-wrap:anywhere]`,o.body,`leading-[1.6]`),children:t})]})}function Fr({text:e,imageCount:t=0,images:n=[],ts:r,onEdit:a,onRemove:o,editLabel:s=`Edit message`,removeLabel:c=`Remove message`,children:l}){let u=t-n.length,[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(e),[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(),y=()=>{m(e),v(void 0),f(!0)},b=async()=>{let t=p.trim();if(!t||t===e){f(!1);return}g(!0),v(void 0);try{await a?.(t),f(!1)}catch(e){v(e instanceof Error?e.message:`Could not save the message`)}finally{g(!1)}},S=async()=>{g(!0),v(void 0);try{await o?.()}catch(e){v(e instanceof Error?e.message:`Could not remove the message`)}finally{g(!1)}};return d?(0,Q.jsxs)(Pr,{role:`user`,ts:r,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,Q.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),f(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),b())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[14px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,Q.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>f(!1),disabled:h,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm px-2 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void b(),disabled:h,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm bg-action px-2 text-xs font-semibold text-action-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:h?(0,Q.jsx)(ot,{className:`size-3.5 animate-spin`}):`Save`})]}),_?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:_}):null]}):(0,Q.jsxs)(Pr,{role:`user`,ts:r,"data-slot":`user-bubble`,className:`group`,children:[a||o?(0,Q.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[a?(0,Q.jsx)(`button`,{type:`button`,"aria-label":s,onClick:y,disabled:h,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Q.jsx)(En,{className:`size-3.5`})}):null,o?(0,Q.jsx)(`button`,{type:`button`,"aria-label":c,onClick:()=>void S(),disabled:h,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Q.jsx)(Re,{className:`size-3.5`})}):null]}):null,_?(0,Q.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:_}):null,l??(0,Q.jsx)(Kt,{breaks:!0,children:e}),n.length>0?(0,Q.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>x(e.split(`/`).pop()??``)?(0,Q.jsx)(vn,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,Q.jsxs)(`a`,{href:i(e),download:!0,"data-slot":`user-file`,className:`inline-flex min-h-11 min-w-11 max-w-[220px] items-center gap-1.5 rounded-md border border-border bg-background/60 px-2 py-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Q.jsx)(Ce,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,u>0?(0,Q.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[u,` image`,u>1?`s`:``,` attached`]}):null]})}var Ir=`inline-flex h-11 min-w-11 items-center justify-center gap-1 rounded-sm px-2 text-xs font-medium text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,Lr=[`[data-streamdown="code-block-actions"]`,`[data-streamdown="code-copy-button"]`,`[data-streamdown="code-block-copy-button"]`,`[data-streamdown="code-block-header"]`].join(`,`);function Rr(e,t){let n=e.cloneNode(!0);n.querySelectorAll(Lr).forEach(e=>e.remove());let r=Rn(t);return[...n.querySelectorAll(`button[data-streamdown="link"]`)].forEach(e=>{let t=e.textContent??``,i=r.findIndex(e=>e.label===t);if(i<0)return;let a=r.splice(i,1)[0];if(!a||!Ln(a.href))return;let o=n.ownerDocument.createElement(`a`);o.setAttribute(`href`,a.href),o.setAttribute(`data-streamdown`,`link`),o.textContent=e.textContent,e.replaceWith(o)}),n.innerHTML}async function zr(e,t,n){if(e===`markdown`){if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(t);return}if(!navigator.clipboard?.write||typeof ClipboardItem>`u`||!n)throw Error(`Clipboard unavailable`);let r=Rr(n,t);await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([r],{type:`text/html`}),"text/plain":new Blob([t],{type:`text/plain`})})])}function Br({text:e,ts:t,messageKey:n}){let r=(0,Z.useRef)(null),[i,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(null),c=(0,Z.useRef)(null);(0,Z.useEffect)(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]);let l=async t=>{c.current!==null&&clearTimeout(c.current),a(null),s(null);try{await zr(t,e,r.current),a(t),c.current=setTimeout(()=>a(null),2e3)}catch{s(`Couldn't copy to the clipboard`)}};return(0,Q.jsxs)(Pr,{role:`agent`,ts:t,"data-slot":`assistant-message`,headerActions:(0,Q.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`flex items-center gap-0.5`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply`,onClick:()=>void l(`html`),className:Ir,children:[(0,Q.jsx)(Be,{className:`size-3.5`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{"aria-live":`polite`,children:i===`html`?`Copied`:`Copy`})]}),(0,Q.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply as markdown`,onClick:()=>void l(`markdown`),className:Ir,children:[(0,Q.jsx)(rn,{className:`size-3.5`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{"aria-live":`polite`,children:i===`markdown`?`Copied`:`Copy markdown`})]})]}),children:[o?(0,Q.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:o}):null,(0,Q.jsx)(`div`,{ref:r,children:(0,Q.jsx)(Kt,{breaks:!0,children:e})}),(0,Q.jsx)(Un,{text:e,messageKey:n})]})}function Vr({note:e}){return e.icon===`handoff`?(0,Q.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,"data-icon":`handoff`,className:`flex items-start gap-2 px-0.5 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`mt-[-1px] flex size-5 shrink-0 items-center justify-center rounded-full border border-border text-success`,children:(0,Q.jsx)(pn,{className:`size-3`})}),(0,Q.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}):(0,Q.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:c(`px-0.5 text-xs`,e.tone===`danger`?`text-danger [.light_&]:text-red-700`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:`· `,e.text]})}function Hr({incident:e}){let t=j(e.provider);return(0,Q.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,Q.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,t,` authorization`]}),(0,Q.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,t,` settings before retrying.`]}),(0,Q.jsx)(q,{to:`/settings/agents#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}function Ur({text:e}){let t=(0,Z.useId)();if(e.trim()===``)return null;let n=e.split(`
2
2
  `,1)[0]??``,r=n.length<e.length;return(0,Q.jsxs)(J,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,Q.jsxs)(`div`,{id:t,className:`relative flex w-full items-center gap-1.5 rounded-md p-0.5 text-left text-[13px] text-soft-foreground hover:text-muted-foreground`,children:[(0,Q.jsx)(G,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,Q.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,Q.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,Q.jsx)(Kt,{inline:!0,children:n})}),r?(0,Q.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,Q.jsx)(X,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,Q.jsx)(Y,{children:(0,Q.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,Q.jsx)(Kt,{children:e})})})]})}function Wr(){return(0,Q.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex items-center gap-2 py-1 text-[13px] text-soft-foreground`,children:[(0,Q.jsx)(ot,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,Q.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`})]})}var Gr={read:rn,edit:En,delete:Re,move:wn,search:we,execute:It,think:xn,fetch:dn,task:Oe,plan:Te,other:Le},Kr=e=>e.split(`
3
3
  `).length;function qr({text:e,streaming:t}){let[n,r]=(0,Z.useState)(!1),i=(0,Z.useRef)(null),a=(0,Z.useRef)(!0);(0,Z.useEffect)(()=>{let e=i.current;t&&e&&a.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let o=Kr(e),s=!t&&!n&&o>12;return(0,Q.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":s?`true`:void 0,children:[(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(`div`,{ref:i,onScroll:t?e=>{a.current=ur(e.currentTarget)}:void 0,className:c(`overflow-x-auto`,t&&`max-h-[216px] overflow-y-auto`,s&&`max-h-[216px] overflow-y-hidden`),children:(0,Q.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),s?(0,Q.jsx)(`div`,{"data-slot":`tool-output-fade`,"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-14 bg-gradient-to-b from-transparent to-card-2`}):null]}),!t&&o>12?(0,Q.jsx)(`button`,{type:`button`,"data-slot":`tool-output-toggle`,onClick:()=>r(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-[11px] font-medium text-soft-foreground hover:text-foreground`,children:n?`Show less`:`Show all ${o} lines`}):null]})}function Jr({diffs:e}){return(0,Q.jsx)(Q.Fragment,{children:e.map((e,t)=>(0,Q.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,Q.jsx)(`div`,{className:`border-b border-border/50 px-4 py-1.5 font-mono text-[11px] wrap-anywhere text-muted-foreground`,children:e.path}),(0,Q.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...Yr(e.oldText).map((e,t)=>(0,Q.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...Yr(e.newText).map((e,t)=>(0,Q.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
4
4
  `).map((e,t)=>(0,Q.jsx)(Xr,{text:e},t))})]},`${e.path}:${t}`))})}function Yr(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`
@@ -1,4 +1,4 @@
1
- import{t as e,u as t}from"./button-DGwhwRuD.js";import{t as n}from"./react-runtime-CCIEwYL0.js";import{fr as r,pr as i}from"./project-scope-context-0Z0nsheq.js";import{G as a,K as o,_ as s,f as c,g as l,h as ee,m as te}from"./live-protocol-B8boP96Z.js";import{t as u}from"./createLucideIcon-BHp8sXmF.js";import{t as d}from"./app-window-CSHwDX9N.js";import{i as ne}from"./format-BNCkW110.js";import{t as re}from"./play-CmVAj_fu.js";import{$t as ie,Kt as ae,cn as oe,g as se,h as ce}from"./index-e1OpsDKN.js";var f=u(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),p=u(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),m=n(),le={registered:e=>e.server.answeredAtRegistration?{label:`Open`,run:!1}:{label:`Run and open`,run:!0},adopted:()=>({label:`Open`,run:!1}),starting:()=>({label:`Open`,run:!1}),up:()=>({label:`Open`,run:!1}),stalled:()=>({label:`View`,run:!1}),exited:()=>({label:`Start again`,run:!0}),stopped:()=>({label:`Start again`,run:!0}),unavailable:()=>void 0};function ue(e){let{text:t,...n}=se(e),r={...n,status:t},i=le[e.state](e);return i?{...r,action:i}:r}var de={"Run and open":re,Open:d,View:oe,"Start again":f};function fe({entry:e,inPreview:n,onOpen:r}){let{server:i}=e,a=ue(e),o=e.state===`unavailable`,s=r?a.action:void 0,c=ce(i.command),l=ne(i.registeredAt);return(0,m.jsxs)(`div`,{"data-slot":`preview-server-card`,"data-state":e.state,className:t(`min-w-0 rounded-lg border border-border bg-card px-3.5 py-3 text-sm`,o&&`text-muted-foreground`),children:[(0,m.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2 text-xs text-soft-foreground`,children:[(0,m.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 font-mono`,children:[(0,m.jsx)(p,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,m.jsx)(`span`,{className:`truncate`,children:`cezar_preview_serve`})]}),o?(0,m.jsx)(`span`,{children:`worktree removed`}):l?(0,m.jsxs)(`span`,{children:[l,` ago`]}):null]}),(0,m.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-2`,children:[(0,m.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,m.jsx)(ae,{tone:a.tone,shape:a.ring?`ring`:`filled`,pulse:a.pulse===!0,"aria-hidden":`true`}),(0,m.jsx)(`span`,{className:`font-semibold text-foreground`,children:i.label}),(0,m.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,i.port]}),(0,m.jsx)(`span`,{className:`text-muted-foreground`,children:a.status})]}),(0,m.jsx)(pe,{entry:e,inPreview:n,action:s,onOpen:r})]}),(0,m.jsxs)(`div`,{className:`mt-2.5 min-w-0 rounded-md bg-muted px-3 py-2 font-mono text-xs`,children:[(0,m.jsx)(`p`,{className:`break-words whitespace-pre-wrap text-foreground`,children:i.command}),i.cwd?(0,m.jsxs)(`p`,{className:`mt-1 flex gap-3 text-soft-foreground`,children:[(0,m.jsx)(`span`,{children:`cwd`}),(0,m.jsx)(`span`,{className:`break-all`,children:i.cwd})]}):null]}),s?.run?(0,m.jsx)(h,{icon:(0,m.jsx)(ie,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),children:`${s.label===`Start again`?`Starting again`:`Opening`} runs ${c} in this task's worktree, on the host.`}):null,o?(0,m.jsx)(h,{children:`The worktree this server ran in is gone. Register it again from a new task.`}):null]})}function pe({entry:t,inPreview:n,action:r,onOpen:i}){let{server:a}=t,o=n&&r!==void 0&&!r.run,s=o?`In preview`:r?.label,c=o?d:r?de[r.label]:null;return r&&s&&c?(0,m.jsxs)(e,{variant:o||r.label===`View`||r.label===`Open`&&t.state===`starting`?`outline`:`contrast`,size:`sm`,className:`max-md:h-11 max-md:px-3.5`,onClick:()=>i?.({port:a.port,run:r.run}),children:[(0,m.jsx)(c,{"aria-hidden":`true`}),s]}):null}function h({icon:e,children:t}){return(0,m.jsxs)(`p`,{className:`mt-2.5 flex items-start gap-2 text-xs text-muted-foreground`,children:[e,(0,m.jsx)(`span`,{children:t})]})}var g=120;function _(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function v(e){let t=e.replace(/\s+/g,` `).trim();return t.length>g?`${t.slice(0,g-1)}…`:t}var y=e=>e===void 0?void 0:v(e);function b(e,...t){if(_(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return t}}function x(e,...t){return y(b(e,...t))}function S(e){if(!_(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return t;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return e.join(` `)}}function me(e){if(!_(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)_(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function he(e){return x(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function C(e,t){return t?`${e} ${t}`:e}var w=new Map([[`bash`,`execute`],[`commandexecution`,`execute`],[`edit`,`edit`],[`multiedit`,`edit`],[`write`,`edit`],[`notebookedit`,`edit`],[`filechange`,`edit`],[`read`,`read`],[`imageview`,`read`],[`glob`,`search`],[`grep`,`search`],[`webfetch`,`fetch`],[`websearch`,`fetch`],[`task`,`task`],[`agent`,`task`],[`skill`,`task`],[`spawnagent`,`task`],[`subtask`,`task`],[`todowrite`,`plan`],[`todolist`,`plan`],[`plan`,`plan`],[`taskcreate`,`plan`],[`taskupdate`,`plan`],[`tasklist`,`plan`],[`contextcompaction`,`other`],[`mcptoolcall`,`other`]]);function T(e,t){switch(e){case`notebookedit`:return b(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`);case`filechange`:{let e=me(t);return e.length===1?e[0]:void 0}default:return b(t,`file_path`,`filePath`,`path`)}}function ge(e,t){let n=e===`write`?`Write`:`Edit`;if(e!==`filechange`)return{toolKind:`edit`,title:C(n,y(T(e,t)))};let r=me(t);return{toolKind:`edit`,title:C(n,r.length>1?`${r.length} files`:r[0])}}function E(e,t){return e===`imageview`?b(t,`path`):b(t,`file_path`,`filePath`,`path`)}function _e(e,t){return{toolKind:`read`,title:C(e===`imageview`?`View image`:`Read`,y(E(e,t)))}}function D(e){return b(e,`pattern`,`query`)}function O(e,t){return e===`webfetch`?b(t,`url`):b(t,`query`)}function ve(e,t){return{toolKind:`fetch`,title:C(e===`webfetch`?`Fetch`:`Web search`,y(O(e,t)))}}var k=e=>b(e,`skill`,`name`,`command`),A=e=>b(e,`subagent_type`,`subagentType`);function ye(e,t){return e===`skill`?k(t):b(t,`prompt`,`task`,`description`)??A(t)}function be(e,t){if(e===`skill`){let e=y(k(t));return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:x(t,`args`,`description`)}}let n=e===`agent`?`Agent`:`Task`,r=y(A(t)),i=x(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${n}: ${i}`:n,subtitle:i===r?void 0:r}}function xe(e,t,n){if(t===`contextcompaction`)return{toolKind:`other`,title:`Compacted context`};if(t===`mcptoolcall`){let e=x(n,`server`),t=x(n,`tool`);return e&&t?{toolKind:`other`,title:`${e}.${t}`}:{toolKind:`other`,title:`MCP tool`,subtitle:he(n)}}if(t.startsWith(`mcp__`)){let t=e.split(`__`).filter(e=>e!==``);if(t.length>=3)return{toolKind:`other`,title:`${t[1]}.${t.slice(2).join(`__`)}`}}return{toolKind:`other`,title:typeof e==`string`&&e.trim()!==``?v(e):`Tool`,subtitle:he(n)}}function j(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(w.get(n)){case`execute`:return{toolKind:`execute`,title:C(`Ran`,y(S(t))),subtitle:x(t,`description`)};case`edit`:return ge(n,t);case`read`:return _e(n,t);case`search`:return{toolKind:`search`,title:C(`Search`,y(D(t))),subtitle:x(t,`path`)};case`fetch`:return ve(n,t);case`task`:return be(n,t);case`plan`:return{toolKind:`plan`,title:`Update plan`};default:return xe(e,n,t)}}function Se(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(w.get(n)){case`execute`:return S(t);case`edit`:return T(n,t);case`read`:return E(n,t);case`search`:return D(t);case`fetch`:return O(n,t);case`task`:return ye(n,t);default:return}}function Ce(e,t){if(t.type===`ask.requested`&&typeof t.requestId==`string`&&a.safeParse({questions:t.questions}).success)return t;if(t.type===`human-input-delivered`||t.type===`human-ask-closed`){let n=(t.type===`human-input-delivered`?l:ee).safeParse(t);if(n.success&&n.data.askSeq===e?.seq)return}return e}function we(e){if(!(e.type!==`ask.requested`||typeof e.requestId!=`string`))return{requestId:e.requestId,questions:e.questions,...e.context===void 0?{}:{context:e.context}}}function M(e){let t=we(e);return t&&{seq:e.seq,...t}}function Te(e,t){let n=Ce(e&&{type:`ask.requested`,seq:e.seq,ts:``},t);return n===t?M(t):n===void 0?void 0:e}function Ee(e){let t;for(let n of e)t=Te(t,n);return t}function De(e){let t=Array.isArray(e.questions)?e.questions.filter(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&typeof e.header==`string`&&(e.options===void 0||Array.isArray(e.options))):[];if(t.length===0)return;let n=typeof e.context==`string`&&e.context!==``?e.context:void 0;return{id:e.requestId,questions:t,...n===void 0?{}:{context:n},askSeq:e.seq}}function Oe(){return{turns:[],itemsById:new Map,turnSeq:0,eventSeq:0,permissions:new Map,conversationEntries:new Map,outcomesByRequest:new Map,seenInputs:new Set,previewByPort:new Map,handedOff:!1}}function N(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function P(e){return typeof e==`string`?e:void 0}function F(e){let t=typeof e==`string`?new Date(e):void 0;return!t||Number.isNaN(t.getTime())?``:` · ${t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}`}function I(e){if(!(typeof e!=`string`||e===``))return Number.isFinite(new Date(e).getTime())?e:void 0}var ke=new Set(o.options);function Ae(e){return typeof e==`string`&&ke.has(e)?e:void 0}function L(e,t){e.turnSeq+=1;let n={id:t===void 0?`turn-fallback-${e.turnSeq}`:`turn-seq-${t}`,entries:[],v2Items:!1};return e.turns.push(n),n}function R(e){return e.turns.at(-1)??L(e)}function z(e,t){R(e).entries.push({origin:`meta`,entry:t,firstSeq:e.eventSeq,lastSeq:e.eventSeq})}function B(e){for(let t of e.permissions.values())t.status===`pending`&&(t.status=`expired`)}function V(e,t){let n=P(e.stepId);return n===void 0?t:`${n}:${t}`}function je(e,t){t.v2Items=!0;for(let n of t.entries)n.origin===`v1`&&n.entry.kind===`tool`&&e.itemsById.delete(n.entry.id);t.entries=t.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`tool`))}function Me(e,t,n,r,i){let a=n.kind===`message`&&i!==void 0?{...n,ts:i}:{...n};!t.v2Items&&a.kind!==`hook`&&je(e,t);let o=e.itemsById.get(r);if(o&&o.turn===t){o.entry.entry=a,o.entry.lastSeq=e.eventSeq;return}let s={origin:`v2`,entry:a,firstSeq:e.eventSeq,lastSeq:e.eventSeq};t.entries.push(s),e.itemsById.set(r,{turn:t,entry:s})}var H={"not-delivered":0,queued:1,delivered:2,consumed:3},Ne=[`instruction`,`resumed`,`requestId`,`relationship`,`state`,`createdAt`,`requestHash`,`deadline`];function U(e){let t={};for(let n of Ne)e[n]!==void 0&&Object.assign(t,{[n]:e[n]});return t}function W(e,t){if(t.messageKind!==`request`)return;let n=e.outcomesByRequest.get(t.messageId);n&&(t.outcome={status:n.status,...n.replyId===void 0?{}:{replyId:n.replyId},observedAt:n.observedAt})}function Pe(e,t){let n=e.conversationEntries.get(t);n&&W(e,n)}function Fe(e,t,n,r){(H[e.delivery]<H.delivered||H[n]>H[e.delivery])&&(e.delivery=n),t.text!==``&&(e.text=t.text),Object.assign(e,U(t)),r.deliveredAt!==void 0&&(e.deliveredAt=r.deliveredAt),r.consumedAt!==void 0&&(e.consumedAt=r.consumedAt),r.recordedAt!==void 0&&(n===`delivered`||e.delivery!==`delivered`)&&(e.recordedAt=r.recordedAt)}function G(e,t,n,r){let i=e.conversationEntries.get(t.id);if(i){Fe(i,t,n,r),W(e,i);return}let a={kind:`conversation`,id:`conversation-message:${t.id}`,messageId:t.id,text:t.text,senderRunId:t.senderRunId,recipientRunId:t.recipientRunId,messageKind:t.kind,delivery:n,...r,...U(t)};W(e,a),e.conversationEntries.set(t.id,a),z(e,a)}function Ie(e,t){let n=F(t.ts),r=P(t.message),i=t.notify===!1?`Stopped notifying the webhook${n}`:`${e.handedOff?`Note sent to webhook`:`Handed off to webhook`}${n}${r?` — ${r}`:``}`;e.handedOff=t.notify!==!1,z(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`dim`,icon:`handoff`})}function Le(e,t){let n=typeof t.attempts==`number`?t.attempts:void 0,r=P(t.webhookName),i=`${r?`Delivery to ${r} failed`:`Webhook delivery failed`}${P(t.event)?` (${P(t.event)})`:``}${n?` after ${n} attempt${n===1?``:`s`}`:``}: ${P(t.error)??`unknown error`}`;z(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`danger`})}function Re(e,t){let n=P(t.webhookName)??`webhook`,r=P(t.title),i=`v1:${t.seq}`;if(t.ok===!1){z(e,{kind:`note`,id:i,text:`Report to ${n} failed: ${P(t.error)??`unknown error`}`,tone:`danger`});return}let a=`${t.dryRun===!0?`Report to ${n} (dry run, nothing sent)`:`Sent report to ${n}`}${F(t.ts)}${r?` — ${r}`:``}`;z(e,t.dryRun===!0?{kind:`note`,id:i,text:a,tone:`dim`}:{kind:`note`,id:i,text:a,tone:`dim`,icon:`handoff`})}function ze(e,t){let n=t.payload??{},r=`Webhook (dry run, nothing sent): ${P(t.event)??`delivery`}${P(n.status)?` · ${P(n.status)}`:``}`;z(e,{kind:`note`,id:`v1:${t.seq}`,text:r,tone:`dim`})}function Be(e,t){let n=r.safeParse(t.server);if(!n.success)return;let i=e.previewByPort.get(n.data.port);i&&(i.turn.entries=i.turn.entries.filter(e=>e!==i.draft));let a=R(e),o={origin:`meta`,firstSeq:t.seq,lastSeq:t.seq,entry:{kind:`preview-server`,id:`preview-server:${n.data.port}`,server:n.data,state:`registered`,stateAt:t.ts}};a.entries.push(o),e.previewByPort.set(n.data.port,{turn:a,draft:o})}function Ve(e,t){let n=i.safeParse(t.state),r=typeof t.port==`number`?e.previewByPort.get(t.port):void 0;if(!n.success||!r||r.draft.entry.kind!==`preview-server`)return;let{server:a,id:o}=r.draft.entry;r.draft.lastSeq=t.seq,r.draft.entry={kind:`preview-server`,id:o,server:a,state:n.data,stateAt:t.ts,...typeof t.exitCode==`number`?{exitCode:t.exitCode}:{},...t.reason===`user`||t.reason===`idle`?{reason:t.reason}:{}}}function He(e,t){let n=te.safeParse(t);if(!n.success)return;let{message:r,delivery:i,deliveredAt:a,consumedAt:o,ts:s}=n.data;G(e,r,i,{deliveredAt:a,consumedAt:o,recordedAt:s})}function Ue(e,t){let n=s.safeParse(t);if(!n.success)return;let{outcome:r}=n.data,i=e.outcomesByRequest.get(r.requestId);i&&!(i.status===`timed-out`&&r.status===`replied-late`)||(e.outcomesByRequest.set(r.requestId,r),Pe(e,r.requestId))}function We(e,t){let n=c.safeParse(t);if(!n.success)return;let{input:r}=n.data;if(!e.seenInputs.has(r.id)){if(e.seenInputs.add(r.id),r.conversation){G(e,{id:r.id,text:r.text,createdAt:r.createdAt,...r.conversation},`delivered`,{deliveredAt:r.deliveredAt,recordedAt:n.data.ts});return}z(e,{kind:`note`,id:`agent-input:${r.id}`,text:r.text,tone:`dim`,attribution:{source:r.source,parentRunId:r.parentRunId}})}}function Ge(e,t){let n=P(t.text)??``,r=e.pendingAsk;e.pendingAsk&&!e.pendingAsk.resolved&&(e.pendingAsk.resolved=!0,e.pendingAsk.answeredBy=`human`,n!==``&&(e.pendingAsk.answer=n),e.pendingAsk=void 0);let i=L(e,t.seq),a=I(t.ts);i.userMessage={text:n,ask:r,imageCount:typeof t.imageCount==`number`?t.imageCount:0,images:Array.isArray(t.images)?t.images.filter(e=>typeof e==`string`):[],...a===void 0?{}:{ts:a}},a!==void 0&&(i.startedAt=a)}function Ke(e,t){let n=e.turns.at(-1),r=n&&n.turnId===void 0&&!n.v2Items?n:L(e,t.seq);r.turnId=P(t.turnId),r.startedAt??=I(t.ts)}function qe(e,t){for(let n=e.turns.length-1;n>=0;--n)if(e.turns[n].turnId===t)return e.turns[n];return e.turns.at(-1)}function Je(e,t){B(e);let n=qe(e,P(t.turnId));if(!n)return;let r=I(t.ts);n.completed={stopReason:P(t.stopReason)??`end_turn`,...typeof t.costUsd==`number`?{costUsd:t.costUsd}:{},...r===void 0?{}:{ts:r}}}var K=new Set([`message`,`reasoning`,`tool`,`hook`]),Ye=e=>K.has(e.kind);function Xe(e){if(!(!N(e)||!K.has(e.kind)))return typeof e.id==`string`&&e.id!==``?e:void 0}function q(e,t){let n=Xe(t.item);if(!n)return;let r=V(t,n.id);Me(e,e.itemsById.get(r)?.turn??R(e),n,r,t.type===`item.completed`?I(t.ts):void 0)}function Ze(e,t){let n=e.itemsById.get(V(t,P(t.itemId)??``)),r=P(t.delta)??``;if(!n||r===``||!Ye(n.entry.entry))return;let i=n.entry.entry;n.entry.lastSeq=t.seq,t.field===`output`&&i.kind===`tool`?i.output=(i.output??``)+r:t.field!==`output`&&(i.kind===`message`||i.kind===`reasoning`)&&(i.text+=r)}function Qe(e,t){let n=R(e),r=P(t.text)??``;if(r===``)return;let i=I(t.ts);n.entries.push({origin:`v1`,firstSeq:t.seq,lastSeq:t.seq,entry:{kind:`message`,id:`v1:${t.seq}`,role:`assistant`,text:r,...i===void 0?{}:{ts:i}}})}var $e=new Set([`pending`,`in_progress`,`completed`,`cancelled`]);function et(e){if(!N(e)||!Array.isArray(e.todos))return;let t=[];for(let n of e.todos){if(!N(n)||typeof n.content!=`string`)return;t.push({content:n.content,status:$e.has(n.status)?n.status:`pending`,...typeof n.activeForm==`string`?{activeForm:n.activeForm}:{}})}return t}var tt=new Set([`subAgentActivity`,`collabAgentToolCall`,`collabToolCall`]);function nt(e,t){let n=R(e),r=P(t.tool)??`Tool`;if(n.v2Items||tt.has(r))return;let i=j(r,t.input),a=i.toolKind===`plan`?et(t.input):void 0;a!==void 0&&(n.planEntries=a);let o={kind:`tool`,id:P(t.id)??`v1:${t.seq}`,name:r,toolKind:i.toolKind,title:i.title,status:`running`,input:t.input},s={origin:`v1`,entry:o,firstSeq:t.seq,lastSeq:t.seq};n.entries.push(s),e.itemsById.set(o.id,{turn:n,entry:s})}function rt(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return String(e)}}function it(e,t){let n=e.itemsById.get(P(t.toolCallId)??``);if(!n||n.turn.v2Items||n.entry.origin!==`v1`)return;let r=n.entry.entry;r.kind===`tool`&&(n.entry.lastSeq=t.seq,r.status=`completed`,r.output=rt(t.result))}function J(e,t,n,r){let i=P(t.message)??``;i!==``&&z(e,{kind:`note`,id:n,text:i,tone:r})}function Y(e,t){J(e,t,`v1:${t.seq}`,t.tone===`danger`?`danger`:`dim`)}function at(e,t){J(e,t,`v1:${t.seq}`,`danger`)}function ot(e,t){J(e,t,`v2:${t.seq}`,`danger`)}function st(e,t){if(t.status!==`failed`)return;let n=P(t.error)?` — ${P(t.error)}`:``;z(e,{kind:`note`,id:`v1:${t.seq}`,text:`step ${P(t.stepId)??`?`} failed${n}`,tone:`danger`})}function ct(e,t){let n=P(t.command)??`check`,r=typeof t.exitCode==`number`?t.exitCode:-1;z(e,{kind:`tool`,id:`v1:${t.seq}`,name:`check`,toolKind:`execute`,title:`Ran ${n}`,status:r===0?`completed`:`failed`,output:P(t.text)??``,exitCode:r})}function lt(e,t){let n=Ae(t.provider),r=P(t.authFailureId)??``;n===void 0||r.length<1||r.length>128||z(e,{kind:`provider-auth-required`,id:`v1:${t.seq}`,provider:n,authFailureId:r})}function ut(e,t){let n=P(t.url);if(n===void 0)return;let r={kind:`image`,id:`v1:${t.seq}`,url:n},i=P(t.name);i!==void 0&&(r.name=i),z(e,r)}function dt(e,t){Array.isArray(t.entries)&&(R(e).planEntries=t.entries)}function ft(e,t){B(e);let n=P(t.message);e.sessionEnded={reason:P(t.reason)??`end_turn`,...n===void 0?{}:{message:n}}}var pt=new Set([`allow_once`,`allow_always`,`reject_once`,`reject_always`]);function mt(e){return N(e)&&typeof e.id==`string`&&e.id!==``&&typeof e.label==`string`&&e.label!==``&&pt.has(e.kind)}function ht(e){if(!(!Array.isArray(e)||e.length===0||!e.every(mt)))return new Set(e.map(e=>e.id)).size===e.length?e:void 0}function gt(e,t){let n=P(t.requestId),r=P(t.title),i=ht(t.options);if(!n||!r||e.permissions.has(n)||!i)return;let a=P(t.itemId),o=P(t.details),s={kind:`permission`,id:`permission:${n}`,requestId:n,title:r,options:i.map(e=>({...e})),status:`pending`,...a===void 0?{}:{itemId:a},...o===void 0?{}:{details:o}};e.permissions.set(n,s),z(e,s)}function _t(e,t){let n=e.permissions.get(P(t.requestId)??``);if(!n||n.status!==`pending`)return;let r=P(t.optionId);r!==void 0&&n.options.some(e=>e.id===r)?(n.status=`resolved`,n.optionId=r):n.status=`expired`;let i=P(t.reason);i!==void 0&&(n.reason=i)}function vt(e,t){let n=M(t),r=n&&De(n);if(!r)return;let i={kind:`ask`,...r,questions:r.questions,resolved:!1};z(e,i),e.pendingAsk=i}function X(e,t){let n=e.pendingAsk;return n&&!n.resolved&&n.askSeq===t.askSeq?n:void 0}function yt(e,t){let n=X(e,t);if(!n)return;n.routedToParent=!0;let r=P(t.parentRunId);r!==void 0&&(n.parentRunId=r)}function bt(e,t){let n=X(e,t);n&&(n.routedToParent=!1)}function xt(e,t){let n=X(e,t);n&&Z(e,n,`undeliverable`)}var St=new Set([`finish`,`superseded`,`parent-stopped`,`worker-stopped`,`undeliverable`]);function Ct(e,t){let n=X(e,t);n&&St.has(t.reason)&&Z(e,n,t.reason)}function Z(e,t,n){t.resolved=!0,t.closed=n,e.pendingAsk=void 0}function wt(e,t){let n=X(e,t);if(n){if(t.source===`cezar`){Z(e,n,`undeliverable`);return}t.source===`parent`&&(n.resolved=!0,n.answeredBy=`parent`,e.pendingAsk=void 0)}}var Q=()=>{},Tt=new Map([[`handoff`,Ie],[`webhook.failed`,Le],[`webhook.dry-run`,ze],[`webhook.report`,Re],[`preview.server-registered`,Be],[`preview.server-state`,Ve],[`conversation-message`,He],[`request-outcome`,Ue],[`agent-input`,We],[`user-message`,Ge],[`turn.started`,Ke],[`turn.completed`,Je],[`item.started`,q],[`item.updated`,q],[`item.completed`,q],[`item.delta`,Ze],[`text`,Qe],[`tool-call`,nt],[`tool-result`,it],[`note`,Y],[`lifecycle`,Y],[`error`,at],[`session.error`,ot],[`step-end`,st],[`check-output`,ct],[`provider-auth-required`,lt],[`image`,ut],[`plan.updated`,dt],[`session.started`,e=>B(e)],[`session.ended`,ft],[`permission.requested`,gt],[`permission.resolved`,_t],[`ask.requested`,vt],[`worker-question-routed`,yt],[`worker-question-fallback`,bt],[`worker-question-undelivered`,xt],[`human-ask-closed`,Ct],[`human-input-delivered`,wt],[`step-start`,Q],[`token-usage`,Q],[`cost`,Q],[`turn-end`,Q],[`done`,Q],[`session`,Q]]);function Et(e,t){e.eventSeq=t.seq,Tt.get(t.type)?.(e,t)}function Dt(e){for(let t=e.turns.length-1;t>=0;--t){let n=e.turns[t].planEntries;if(n!==void 0)return n}}function Ot(e){let t=[];for(let n of e.turns)for(let e of n.items)if(e.kind===`tool`){for(let n of e.locations??[])t.push(n.path);for(let n of e.diffs??[])t.push(n.path)}let n=[];for(let e=t.length-1;e>=0;--e)n.includes(t[e])||n.push(t[e]);return n}function kt(e,t){switch(e){case`waiting`:return{state:`waiting`};case`failed`:return{state:`closed`,tone:`danger`,label:t?`Session failed — ${t}`:`Session failed`};case`review`:return{state:`closed`,tone:`dim`,label:`Session closed — waiting for your review`};case`done`:case`cancelled`:return{state:`closed`,tone:`dim`,label:`Session closed`};default:return null}}function $(e,t){let n=e.replace(/\s*CEZ:DONE\s*$/,``).replace(/\s*CEZ:MONITORING\s*$/,``);if(t){let e=n.trimEnd(),t=e.lastIndexOf(`
1
+ import{t as e,u as t}from"./button-DGwhwRuD.js";import{t as n}from"./react-runtime-CCIEwYL0.js";import{fr as r,pr as i}from"./project-scope-context-B0yKt2yI.js";import{G as a,K as o,_ as s,f as c,g as l,h as ee,m as te}from"./live-protocol-BmbbwF5R.js";import{t as u}from"./createLucideIcon-BHp8sXmF.js";import{t as d}from"./app-window-CSHwDX9N.js";import{i as ne}from"./format-BNCkW110.js";import{t as re}from"./play-CmVAj_fu.js";import{$t as ie,Kt as ae,cn as oe,g as se,h as ce}from"./index-MgNz22Tg.js";var f=u(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),p=u(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),m=n(),le={registered:e=>e.server.answeredAtRegistration?{label:`Open`,run:!1}:{label:`Run and open`,run:!0},adopted:()=>({label:`Open`,run:!1}),starting:()=>({label:`Open`,run:!1}),up:()=>({label:`Open`,run:!1}),stalled:()=>({label:`View`,run:!1}),exited:()=>({label:`Start again`,run:!0}),stopped:()=>({label:`Start again`,run:!0}),unavailable:()=>void 0};function ue(e){let{text:t,...n}=se(e),r={...n,status:t},i=le[e.state](e);return i?{...r,action:i}:r}var de={"Run and open":re,Open:d,View:oe,"Start again":f};function fe({entry:e,inPreview:n,onOpen:r}){let{server:i}=e,a=ue(e),o=e.state===`unavailable`,s=r?a.action:void 0,c=ce(i.command),l=ne(i.registeredAt);return(0,m.jsxs)(`div`,{"data-slot":`preview-server-card`,"data-state":e.state,className:t(`min-w-0 rounded-lg border border-border bg-card px-3.5 py-3 text-sm`,o&&`text-muted-foreground`),children:[(0,m.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2 text-xs text-soft-foreground`,children:[(0,m.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 font-mono`,children:[(0,m.jsx)(p,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,m.jsx)(`span`,{className:`truncate`,children:`cezar_preview_serve`})]}),o?(0,m.jsx)(`span`,{children:`worktree removed`}):l?(0,m.jsxs)(`span`,{children:[l,` ago`]}):null]}),(0,m.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-2`,children:[(0,m.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,m.jsx)(ae,{tone:a.tone,shape:a.ring?`ring`:`filled`,pulse:a.pulse===!0,"aria-hidden":`true`}),(0,m.jsx)(`span`,{className:`font-semibold text-foreground`,children:i.label}),(0,m.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,i.port]}),(0,m.jsx)(`span`,{className:`text-muted-foreground`,children:a.status})]}),(0,m.jsx)(pe,{entry:e,inPreview:n,action:s,onOpen:r})]}),(0,m.jsxs)(`div`,{className:`mt-2.5 min-w-0 rounded-md bg-muted px-3 py-2 font-mono text-xs`,children:[(0,m.jsx)(`p`,{className:`break-words whitespace-pre-wrap text-foreground`,children:i.command}),i.cwd?(0,m.jsxs)(`p`,{className:`mt-1 flex gap-3 text-soft-foreground`,children:[(0,m.jsx)(`span`,{children:`cwd`}),(0,m.jsx)(`span`,{className:`break-all`,children:i.cwd})]}):null]}),s?.run?(0,m.jsx)(h,{icon:(0,m.jsx)(ie,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),children:`${s.label===`Start again`?`Starting again`:`Opening`} runs ${c} in this task's worktree, on the host.`}):null,o?(0,m.jsx)(h,{children:`The worktree this server ran in is gone. Register it again from a new task.`}):null]})}function pe({entry:t,inPreview:n,action:r,onOpen:i}){let{server:a}=t,o=n&&r!==void 0&&!r.run,s=o?`In preview`:r?.label,c=o?d:r?de[r.label]:null;return r&&s&&c?(0,m.jsxs)(e,{variant:o||r.label===`View`||r.label===`Open`&&t.state===`starting`?`outline`:`contrast`,size:`sm`,className:`max-md:h-11 max-md:px-3.5`,onClick:()=>i?.({port:a.port,run:r.run}),children:[(0,m.jsx)(c,{"aria-hidden":`true`}),s]}):null}function h({icon:e,children:t}){return(0,m.jsxs)(`p`,{className:`mt-2.5 flex items-start gap-2 text-xs text-muted-foreground`,children:[e,(0,m.jsx)(`span`,{children:t})]})}var g=120;function _(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function v(e){let t=e.replace(/\s+/g,` `).trim();return t.length>g?`${t.slice(0,g-1)}…`:t}var y=e=>e===void 0?void 0:v(e);function b(e,...t){if(_(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return t}}function x(e,...t){return y(b(e,...t))}function S(e){if(!_(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return t;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return e.join(` `)}}function me(e){if(!_(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)_(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function he(e){return x(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function C(e,t){return t?`${e} ${t}`:e}var w=new Map([[`bash`,`execute`],[`commandexecution`,`execute`],[`edit`,`edit`],[`multiedit`,`edit`],[`write`,`edit`],[`notebookedit`,`edit`],[`filechange`,`edit`],[`read`,`read`],[`imageview`,`read`],[`glob`,`search`],[`grep`,`search`],[`webfetch`,`fetch`],[`websearch`,`fetch`],[`task`,`task`],[`agent`,`task`],[`skill`,`task`],[`spawnagent`,`task`],[`subtask`,`task`],[`todowrite`,`plan`],[`todolist`,`plan`],[`plan`,`plan`],[`taskcreate`,`plan`],[`taskupdate`,`plan`],[`tasklist`,`plan`],[`contextcompaction`,`other`],[`mcptoolcall`,`other`]]);function T(e,t){switch(e){case`notebookedit`:return b(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`);case`filechange`:{let e=me(t);return e.length===1?e[0]:void 0}default:return b(t,`file_path`,`filePath`,`path`)}}function ge(e,t){let n=e===`write`?`Write`:`Edit`;if(e!==`filechange`)return{toolKind:`edit`,title:C(n,y(T(e,t)))};let r=me(t);return{toolKind:`edit`,title:C(n,r.length>1?`${r.length} files`:r[0])}}function E(e,t){return e===`imageview`?b(t,`path`):b(t,`file_path`,`filePath`,`path`)}function _e(e,t){return{toolKind:`read`,title:C(e===`imageview`?`View image`:`Read`,y(E(e,t)))}}function D(e){return b(e,`pattern`,`query`)}function O(e,t){return e===`webfetch`?b(t,`url`):b(t,`query`)}function ve(e,t){return{toolKind:`fetch`,title:C(e===`webfetch`?`Fetch`:`Web search`,y(O(e,t)))}}var k=e=>b(e,`skill`,`name`,`command`),A=e=>b(e,`subagent_type`,`subagentType`);function ye(e,t){return e===`skill`?k(t):b(t,`prompt`,`task`,`description`)??A(t)}function be(e,t){if(e===`skill`){let e=y(k(t));return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:x(t,`args`,`description`)}}let n=e===`agent`?`Agent`:`Task`,r=y(A(t)),i=x(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${n}: ${i}`:n,subtitle:i===r?void 0:r}}function xe(e,t,n){if(t===`contextcompaction`)return{toolKind:`other`,title:`Compacted context`};if(t===`mcptoolcall`){let e=x(n,`server`),t=x(n,`tool`);return e&&t?{toolKind:`other`,title:`${e}.${t}`}:{toolKind:`other`,title:`MCP tool`,subtitle:he(n)}}if(t.startsWith(`mcp__`)){let t=e.split(`__`).filter(e=>e!==``);if(t.length>=3)return{toolKind:`other`,title:`${t[1]}.${t.slice(2).join(`__`)}`}}return{toolKind:`other`,title:typeof e==`string`&&e.trim()!==``?v(e):`Tool`,subtitle:he(n)}}function j(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(w.get(n)){case`execute`:return{toolKind:`execute`,title:C(`Ran`,y(S(t))),subtitle:x(t,`description`)};case`edit`:return ge(n,t);case`read`:return _e(n,t);case`search`:return{toolKind:`search`,title:C(`Search`,y(D(t))),subtitle:x(t,`path`)};case`fetch`:return ve(n,t);case`task`:return be(n,t);case`plan`:return{toolKind:`plan`,title:`Update plan`};default:return xe(e,n,t)}}function Se(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(w.get(n)){case`execute`:return S(t);case`edit`:return T(n,t);case`read`:return E(n,t);case`search`:return D(t);case`fetch`:return O(n,t);case`task`:return ye(n,t);default:return}}function Ce(e,t){if(t.type===`ask.requested`&&typeof t.requestId==`string`&&a.safeParse({questions:t.questions}).success)return t;if(t.type===`human-input-delivered`||t.type===`human-ask-closed`){let n=(t.type===`human-input-delivered`?l:ee).safeParse(t);if(n.success&&n.data.askSeq===e?.seq)return}return e}function we(e){if(!(e.type!==`ask.requested`||typeof e.requestId!=`string`))return{requestId:e.requestId,questions:e.questions,...e.context===void 0?{}:{context:e.context}}}function M(e){let t=we(e);return t&&{seq:e.seq,...t}}function Te(e,t){let n=Ce(e&&{type:`ask.requested`,seq:e.seq,ts:``},t);return n===t?M(t):n===void 0?void 0:e}function Ee(e){let t;for(let n of e)t=Te(t,n);return t}function De(e){let t=Array.isArray(e.questions)?e.questions.filter(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&typeof e.header==`string`&&(e.options===void 0||Array.isArray(e.options))):[];if(t.length===0)return;let n=typeof e.context==`string`&&e.context!==``?e.context:void 0;return{id:e.requestId,questions:t,...n===void 0?{}:{context:n},askSeq:e.seq}}function Oe(){return{turns:[],itemsById:new Map,turnSeq:0,eventSeq:0,permissions:new Map,conversationEntries:new Map,outcomesByRequest:new Map,seenInputs:new Set,previewByPort:new Map,handedOff:!1}}function N(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function P(e){return typeof e==`string`?e:void 0}function F(e){let t=typeof e==`string`?new Date(e):void 0;return!t||Number.isNaN(t.getTime())?``:` · ${t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}`}function I(e){if(!(typeof e!=`string`||e===``))return Number.isFinite(new Date(e).getTime())?e:void 0}var ke=new Set(o.options);function Ae(e){return typeof e==`string`&&ke.has(e)?e:void 0}function L(e,t){e.turnSeq+=1;let n={id:t===void 0?`turn-fallback-${e.turnSeq}`:`turn-seq-${t}`,entries:[],v2Items:!1};return e.turns.push(n),n}function R(e){return e.turns.at(-1)??L(e)}function z(e,t){R(e).entries.push({origin:`meta`,entry:t,firstSeq:e.eventSeq,lastSeq:e.eventSeq})}function B(e){for(let t of e.permissions.values())t.status===`pending`&&(t.status=`expired`)}function V(e,t){let n=P(e.stepId);return n===void 0?t:`${n}:${t}`}function je(e,t){t.v2Items=!0;for(let n of t.entries)n.origin===`v1`&&n.entry.kind===`tool`&&e.itemsById.delete(n.entry.id);t.entries=t.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`tool`))}function Me(e,t,n,r,i){let a=n.kind===`message`&&i!==void 0?{...n,ts:i}:{...n};!t.v2Items&&a.kind!==`hook`&&je(e,t);let o=e.itemsById.get(r);if(o&&o.turn===t){o.entry.entry=a,o.entry.lastSeq=e.eventSeq;return}let s={origin:`v2`,entry:a,firstSeq:e.eventSeq,lastSeq:e.eventSeq};t.entries.push(s),e.itemsById.set(r,{turn:t,entry:s})}var H={"not-delivered":0,queued:1,delivered:2,consumed:3},Ne=[`instruction`,`resumed`,`requestId`,`relationship`,`state`,`createdAt`,`requestHash`,`deadline`];function U(e){let t={};for(let n of Ne)e[n]!==void 0&&Object.assign(t,{[n]:e[n]});return t}function W(e,t){if(t.messageKind!==`request`)return;let n=e.outcomesByRequest.get(t.messageId);n&&(t.outcome={status:n.status,...n.replyId===void 0?{}:{replyId:n.replyId},observedAt:n.observedAt})}function Pe(e,t){let n=e.conversationEntries.get(t);n&&W(e,n)}function Fe(e,t,n,r){(H[e.delivery]<H.delivered||H[n]>H[e.delivery])&&(e.delivery=n),t.text!==``&&(e.text=t.text),Object.assign(e,U(t)),r.deliveredAt!==void 0&&(e.deliveredAt=r.deliveredAt),r.consumedAt!==void 0&&(e.consumedAt=r.consumedAt),r.recordedAt!==void 0&&(n===`delivered`||e.delivery!==`delivered`)&&(e.recordedAt=r.recordedAt)}function G(e,t,n,r){let i=e.conversationEntries.get(t.id);if(i){Fe(i,t,n,r),W(e,i);return}let a={kind:`conversation`,id:`conversation-message:${t.id}`,messageId:t.id,text:t.text,senderRunId:t.senderRunId,recipientRunId:t.recipientRunId,messageKind:t.kind,delivery:n,...r,...U(t)};W(e,a),e.conversationEntries.set(t.id,a),z(e,a)}function Ie(e,t){let n=F(t.ts),r=P(t.message),i=t.notify===!1?`Stopped notifying the webhook${n}`:`${e.handedOff?`Note sent to webhook`:`Handed off to webhook`}${n}${r?` — ${r}`:``}`;e.handedOff=t.notify!==!1,z(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`dim`,icon:`handoff`})}function Le(e,t){let n=typeof t.attempts==`number`?t.attempts:void 0,r=P(t.webhookName),i=`${r?`Delivery to ${r} failed`:`Webhook delivery failed`}${P(t.event)?` (${P(t.event)})`:``}${n?` after ${n} attempt${n===1?``:`s`}`:``}: ${P(t.error)??`unknown error`}`;z(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`danger`})}function Re(e,t){let n=P(t.webhookName)??`webhook`,r=P(t.title),i=`v1:${t.seq}`;if(t.ok===!1){z(e,{kind:`note`,id:i,text:`Report to ${n} failed: ${P(t.error)??`unknown error`}`,tone:`danger`});return}let a=`${t.dryRun===!0?`Report to ${n} (dry run, nothing sent)`:`Sent report to ${n}`}${F(t.ts)}${r?` — ${r}`:``}`;z(e,t.dryRun===!0?{kind:`note`,id:i,text:a,tone:`dim`}:{kind:`note`,id:i,text:a,tone:`dim`,icon:`handoff`})}function ze(e,t){let n=t.payload??{},r=`Webhook (dry run, nothing sent): ${P(t.event)??`delivery`}${P(n.status)?` · ${P(n.status)}`:``}`;z(e,{kind:`note`,id:`v1:${t.seq}`,text:r,tone:`dim`})}function Be(e,t){let n=r.safeParse(t.server);if(!n.success)return;let i=e.previewByPort.get(n.data.port);i&&(i.turn.entries=i.turn.entries.filter(e=>e!==i.draft));let a=R(e),o={origin:`meta`,firstSeq:t.seq,lastSeq:t.seq,entry:{kind:`preview-server`,id:`preview-server:${n.data.port}`,server:n.data,state:`registered`,stateAt:t.ts}};a.entries.push(o),e.previewByPort.set(n.data.port,{turn:a,draft:o})}function Ve(e,t){let n=i.safeParse(t.state),r=typeof t.port==`number`?e.previewByPort.get(t.port):void 0;if(!n.success||!r||r.draft.entry.kind!==`preview-server`)return;let{server:a,id:o}=r.draft.entry;r.draft.lastSeq=t.seq,r.draft.entry={kind:`preview-server`,id:o,server:a,state:n.data,stateAt:t.ts,...typeof t.exitCode==`number`?{exitCode:t.exitCode}:{},...t.reason===`user`||t.reason===`idle`?{reason:t.reason}:{}}}function He(e,t){let n=te.safeParse(t);if(!n.success)return;let{message:r,delivery:i,deliveredAt:a,consumedAt:o,ts:s}=n.data;G(e,r,i,{deliveredAt:a,consumedAt:o,recordedAt:s})}function Ue(e,t){let n=s.safeParse(t);if(!n.success)return;let{outcome:r}=n.data,i=e.outcomesByRequest.get(r.requestId);i&&!(i.status===`timed-out`&&r.status===`replied-late`)||(e.outcomesByRequest.set(r.requestId,r),Pe(e,r.requestId))}function We(e,t){let n=c.safeParse(t);if(!n.success)return;let{input:r}=n.data;if(!e.seenInputs.has(r.id)){if(e.seenInputs.add(r.id),r.conversation){G(e,{id:r.id,text:r.text,createdAt:r.createdAt,...r.conversation},`delivered`,{deliveredAt:r.deliveredAt,recordedAt:n.data.ts});return}z(e,{kind:`note`,id:`agent-input:${r.id}`,text:r.text,tone:`dim`,attribution:{source:r.source,parentRunId:r.parentRunId}})}}function Ge(e,t){let n=P(t.text)??``,r=e.pendingAsk;e.pendingAsk&&!e.pendingAsk.resolved&&(e.pendingAsk.resolved=!0,e.pendingAsk.answeredBy=`human`,n!==``&&(e.pendingAsk.answer=n),e.pendingAsk=void 0);let i=L(e,t.seq),a=I(t.ts);i.userMessage={text:n,ask:r,imageCount:typeof t.imageCount==`number`?t.imageCount:0,images:Array.isArray(t.images)?t.images.filter(e=>typeof e==`string`):[],...a===void 0?{}:{ts:a}},a!==void 0&&(i.startedAt=a)}function Ke(e,t){let n=e.turns.at(-1),r=n&&n.turnId===void 0&&!n.v2Items?n:L(e,t.seq);r.turnId=P(t.turnId),r.startedAt??=I(t.ts)}function qe(e,t){for(let n=e.turns.length-1;n>=0;--n)if(e.turns[n].turnId===t)return e.turns[n];return e.turns.at(-1)}function Je(e,t){B(e);let n=qe(e,P(t.turnId));if(!n)return;let r=I(t.ts);n.completed={stopReason:P(t.stopReason)??`end_turn`,...typeof t.costUsd==`number`?{costUsd:t.costUsd}:{},...r===void 0?{}:{ts:r}}}var K=new Set([`message`,`reasoning`,`tool`,`hook`]),Ye=e=>K.has(e.kind);function Xe(e){if(!(!N(e)||!K.has(e.kind)))return typeof e.id==`string`&&e.id!==``?e:void 0}function q(e,t){let n=Xe(t.item);if(!n)return;let r=V(t,n.id);Me(e,e.itemsById.get(r)?.turn??R(e),n,r,t.type===`item.completed`?I(t.ts):void 0)}function Ze(e,t){let n=e.itemsById.get(V(t,P(t.itemId)??``)),r=P(t.delta)??``;if(!n||r===``||!Ye(n.entry.entry))return;let i=n.entry.entry;n.entry.lastSeq=t.seq,t.field===`output`&&i.kind===`tool`?i.output=(i.output??``)+r:t.field!==`output`&&(i.kind===`message`||i.kind===`reasoning`)&&(i.text+=r)}function Qe(e,t){let n=R(e),r=P(t.text)??``;if(r===``)return;let i=I(t.ts);n.entries.push({origin:`v1`,firstSeq:t.seq,lastSeq:t.seq,entry:{kind:`message`,id:`v1:${t.seq}`,role:`assistant`,text:r,...i===void 0?{}:{ts:i}}})}var $e=new Set([`pending`,`in_progress`,`completed`,`cancelled`]);function et(e){if(!N(e)||!Array.isArray(e.todos))return;let t=[];for(let n of e.todos){if(!N(n)||typeof n.content!=`string`)return;t.push({content:n.content,status:$e.has(n.status)?n.status:`pending`,...typeof n.activeForm==`string`?{activeForm:n.activeForm}:{}})}return t}var tt=new Set([`subAgentActivity`,`collabAgentToolCall`,`collabToolCall`]);function nt(e,t){let n=R(e),r=P(t.tool)??`Tool`;if(n.v2Items||tt.has(r))return;let i=j(r,t.input),a=i.toolKind===`plan`?et(t.input):void 0;a!==void 0&&(n.planEntries=a);let o={kind:`tool`,id:P(t.id)??`v1:${t.seq}`,name:r,toolKind:i.toolKind,title:i.title,status:`running`,input:t.input},s={origin:`v1`,entry:o,firstSeq:t.seq,lastSeq:t.seq};n.entries.push(s),e.itemsById.set(o.id,{turn:n,entry:s})}function rt(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return String(e)}}function it(e,t){let n=e.itemsById.get(P(t.toolCallId)??``);if(!n||n.turn.v2Items||n.entry.origin!==`v1`)return;let r=n.entry.entry;r.kind===`tool`&&(n.entry.lastSeq=t.seq,r.status=`completed`,r.output=rt(t.result))}function J(e,t,n,r){let i=P(t.message)??``;i!==``&&z(e,{kind:`note`,id:n,text:i,tone:r})}function Y(e,t){J(e,t,`v1:${t.seq}`,t.tone===`danger`?`danger`:`dim`)}function at(e,t){J(e,t,`v1:${t.seq}`,`danger`)}function ot(e,t){J(e,t,`v2:${t.seq}`,`danger`)}function st(e,t){if(t.status!==`failed`)return;let n=P(t.error)?` — ${P(t.error)}`:``;z(e,{kind:`note`,id:`v1:${t.seq}`,text:`step ${P(t.stepId)??`?`} failed${n}`,tone:`danger`})}function ct(e,t){let n=P(t.command)??`check`,r=typeof t.exitCode==`number`?t.exitCode:-1;z(e,{kind:`tool`,id:`v1:${t.seq}`,name:`check`,toolKind:`execute`,title:`Ran ${n}`,status:r===0?`completed`:`failed`,output:P(t.text)??``,exitCode:r})}function lt(e,t){let n=Ae(t.provider),r=P(t.authFailureId)??``;n===void 0||r.length<1||r.length>128||z(e,{kind:`provider-auth-required`,id:`v1:${t.seq}`,provider:n,authFailureId:r})}function ut(e,t){let n=P(t.url);if(n===void 0)return;let r={kind:`image`,id:`v1:${t.seq}`,url:n},i=P(t.name);i!==void 0&&(r.name=i),z(e,r)}function dt(e,t){Array.isArray(t.entries)&&(R(e).planEntries=t.entries)}function ft(e,t){B(e);let n=P(t.message);e.sessionEnded={reason:P(t.reason)??`end_turn`,...n===void 0?{}:{message:n}}}var pt=new Set([`allow_once`,`allow_always`,`reject_once`,`reject_always`]);function mt(e){return N(e)&&typeof e.id==`string`&&e.id!==``&&typeof e.label==`string`&&e.label!==``&&pt.has(e.kind)}function ht(e){if(!(!Array.isArray(e)||e.length===0||!e.every(mt)))return new Set(e.map(e=>e.id)).size===e.length?e:void 0}function gt(e,t){let n=P(t.requestId),r=P(t.title),i=ht(t.options);if(!n||!r||e.permissions.has(n)||!i)return;let a=P(t.itemId),o=P(t.details),s={kind:`permission`,id:`permission:${n}`,requestId:n,title:r,options:i.map(e=>({...e})),status:`pending`,...a===void 0?{}:{itemId:a},...o===void 0?{}:{details:o}};e.permissions.set(n,s),z(e,s)}function _t(e,t){let n=e.permissions.get(P(t.requestId)??``);if(!n||n.status!==`pending`)return;let r=P(t.optionId);r!==void 0&&n.options.some(e=>e.id===r)?(n.status=`resolved`,n.optionId=r):n.status=`expired`;let i=P(t.reason);i!==void 0&&(n.reason=i)}function vt(e,t){let n=M(t),r=n&&De(n);if(!r)return;let i={kind:`ask`,...r,questions:r.questions,resolved:!1};z(e,i),e.pendingAsk=i}function X(e,t){let n=e.pendingAsk;return n&&!n.resolved&&n.askSeq===t.askSeq?n:void 0}function yt(e,t){let n=X(e,t);if(!n)return;n.routedToParent=!0;let r=P(t.parentRunId);r!==void 0&&(n.parentRunId=r)}function bt(e,t){let n=X(e,t);n&&(n.routedToParent=!1)}function xt(e,t){let n=X(e,t);n&&Z(e,n,`undeliverable`)}var St=new Set([`finish`,`superseded`,`parent-stopped`,`worker-stopped`,`undeliverable`]);function Ct(e,t){let n=X(e,t);n&&St.has(t.reason)&&Z(e,n,t.reason)}function Z(e,t,n){t.resolved=!0,t.closed=n,e.pendingAsk=void 0}function wt(e,t){let n=X(e,t);if(n){if(t.source===`cezar`){Z(e,n,`undeliverable`);return}t.source===`parent`&&(n.resolved=!0,n.answeredBy=`parent`,e.pendingAsk=void 0)}}var Q=()=>{},Tt=new Map([[`handoff`,Ie],[`webhook.failed`,Le],[`webhook.dry-run`,ze],[`webhook.report`,Re],[`preview.server-registered`,Be],[`preview.server-state`,Ve],[`conversation-message`,He],[`request-outcome`,Ue],[`agent-input`,We],[`user-message`,Ge],[`turn.started`,Ke],[`turn.completed`,Je],[`item.started`,q],[`item.updated`,q],[`item.completed`,q],[`item.delta`,Ze],[`text`,Qe],[`tool-call`,nt],[`tool-result`,it],[`note`,Y],[`lifecycle`,Y],[`error`,at],[`session.error`,ot],[`step-end`,st],[`check-output`,ct],[`provider-auth-required`,lt],[`image`,ut],[`plan.updated`,dt],[`session.started`,e=>B(e)],[`session.ended`,ft],[`permission.requested`,gt],[`permission.resolved`,_t],[`ask.requested`,vt],[`worker-question-routed`,yt],[`worker-question-fallback`,bt],[`worker-question-undelivered`,xt],[`human-ask-closed`,Ct],[`human-input-delivered`,wt],[`step-start`,Q],[`token-usage`,Q],[`cost`,Q],[`turn-end`,Q],[`done`,Q],[`session`,Q]]);function Et(e,t){e.eventSeq=t.seq,Tt.get(t.type)?.(e,t)}function Dt(e){for(let t=e.turns.length-1;t>=0;--t){let n=e.turns[t].planEntries;if(n!==void 0)return n}}function Ot(e){let t=[];for(let n of e.turns)for(let e of n.items)if(e.kind===`tool`){for(let n of e.locations??[])t.push(n.path);for(let n of e.diffs??[])t.push(n.path)}let n=[];for(let e=t.length-1;e>=0;--e)n.includes(t[e])||n.push(t[e]);return n}function kt(e,t){switch(e){case`waiting`:return{state:`waiting`};case`failed`:return{state:`closed`,tone:`danger`,label:t?`Session failed — ${t}`:`Session failed`};case`review`:return{state:`closed`,tone:`dim`,label:`Session closed — waiting for your review`};case`done`:case`cancelled`:return{state:`closed`,tone:`dim`,label:`Session closed`};default:return null}}function $(e,t){let n=e.replace(/\s*CEZ:DONE\s*$/,``).replace(/\s*CEZ:MONITORING\s*$/,``);if(t){let e=n.trimEnd(),t=e.lastIndexOf(`
2
2
  `)+1;/^CEZ:ASK[ \t]+.+$/.test(e.slice(t))&&(n=e.slice(0,t).trimEnd())}return n.includes(`CEZ:`)?n.split(`
3
3
  `).filter(e=>!/^CEZ:(?:PR=\d+|ISSUE=\d+|TITLE=.+)\s*$/.test(e)).join(`
4
4
  `):n}function At(e){let t=e=>$(e,!0).replace(/\s+/g,``),n=new Set,r=[];for(let{origin:i,entry:a}of e.entries)if(i===`v2`&&a.kind===`message`){let e=t(a.text);n.add(e),r.push(e)}if(r.length===0)return;n.add(r.join(``));let i=[],a={entries:[],texts:[]},o=()=>{if(a.entries.length>=2&&n.has(t(a.texts.join(``)))){a={entries:[],texts:[]};return}i.push(...a.entries),a={entries:[],texts:[]}};for(let t of e.entries)t.origin===`v1`&&t.entry.kind===`message`?(a.entries.push(t),a.texts.push(t.entry.text)):(o(),i.push(t));o(),e.entries=i}function jt(e){let t=new Set;for(let{origin:n,entry:r}of e.entries)n===`v2`&&r.kind===`message`&&t.add($(r.text,!0).trim());t.size!==0&&(e.entries=e.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`message`&&t.has($(e.entry.text,!0).trim()))),At(e))}function Mt(e){for(let t of e.conversationEntries.values())t.messageKind!==`request`||t.outcome!==void 0||t.delivery!==`not-delivered`&&(t.state!==void 0&&t.state!==`accepted`||(t.outcome={status:`pending`}))}function Nt(e,t){let n=t||e.entries.some(({entry:e})=>e.kind===`ask`);return{id:e.id,...e.turnId===void 0?{}:{turnId:e.turnId},...e.userMessage===void 0?{}:{userMessage:e.userMessage},...e.startedAt===void 0?{}:{startedAt:e.startedAt},...e.planEntries===void 0?{}:{planEntries:e.planEntries},...e.completed===void 0?{}:{completed:e.completed},items:e.entries.map(({entry:e})=>e.kind===`message`&&e.role===`assistant`?{...e,text:$(e.text,n)}:e),itemSeqs:Pt(e.entries)}}function Pt(e){let t=new Map;for(let{entry:n,firstSeq:r,lastSeq:i}of e)t.has(n.id)||t.set(n.id,{first:r,last:i});return t}function Ft(e,t={}){let n=Oe();for(let t of e)Et(n,t);for(let e of n.turns)e.v2Items&&jt(e);Mt(n);let r=n.turns.length-1;return{turns:n.turns.map((e,n)=>Nt(e,t.activeTurn===!0&&n===r)),...n.sessionEnded===void 0?{}:{sessionEnded:n.sessionEnded}}}export{Ee as a,fe as c,kt as i,p as l,Ft as n,Se as o,Ot as r,j as s,Dt as t,f as u};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,s as n,u as r}from"./button-DGwhwRuD.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{Ln as o,Mn as s,Rn as c,Un as l,rr as u}from"./project-scope-context-0Z0nsheq.js";import{M as d}from"./live-protocol-B8boP96Z.js";import"./queries-7W9tOZsg.js";import{t as f}from"./createLucideIcon-BHp8sXmF.js";import{a as ee,d as p,h as m,i as te,l as ne,m as re,n as ie,o as ae,p as h,r as oe,t as se,u as g}from"./es2015-DTn4s5Lh.js";import{_ as ce,b as le,v as ue,x as de,y as fe}from"./dropdown-menu-DPrTX-zi.js";import"./attention-B7icDSLh.js";function pe(e){if(e.workflow===`(planned)`||e.workflow===`(inbox)`){let t=(e.steps??[]).find(e=>e.kind===`agent`);if(t?.name)return t.name}return e.workflow}var me=f(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),_=e(i(),1),v=a(),y=`Popover`,[b,he]=re(y,[de]),x=de(),[ge,S]=b(y),C=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=x(t),c=_.useRef(null),[l,u]=_.useState(!1),[d,f]=p({prop:r,defaultProp:i??!1,onChange:a,caller:y});return(0,v.jsx)(le,{...s,children:(0,v.jsx)(ge,{scope:t,contentId:ne(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:_.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:_.useCallback(()=>u(!0),[]),onCustomAnchorRemove:_.useCallback(()=>u(!1),[]),modal:o,children:n})})};C.displayName=y;var w=`PopoverAnchor`,T=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=S(w,n),a=x(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return _.useEffect(()=>(o(),()=>s()),[o,s]),(0,v.jsx)(ce,{...a,...r,ref:t})});T.displayName=w;var E=`PopoverTrigger`,D=_.forwardRef((e,t)=>{let{__scopePopover:r,...i}=e,a=S(E,r),o=x(r),s=n(t,a.triggerRef),c=(0,v.jsx)(m.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":P(a.open),...i,ref:s,onClick:h(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?c:(0,v.jsx)(ce,{asChild:!0,...o,children:c})});D.displayName=E;var O=`PopoverPortal`,[_e,ve]=b(O,{forceMount:void 0}),k=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=S(O,t);return(0,v.jsx)(_e,{scope:t,forceMount:n,children:(0,v.jsx)(g,{present:n||a.open,children:(0,v.jsx)(te,{asChild:!0,container:i,children:r})})})};k.displayName=O;var A=`PopoverContent`,j=_.forwardRef((e,t)=>{let n=ve(A,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=S(A,e.__scopePopover);return(0,v.jsx)(g,{present:r||a.open,children:a.modal?(0,v.jsx)(be,{...i,ref:t}):(0,v.jsx)(xe,{...i,ref:t})})});j.displayName=A;var ye=t(`PopoverContent.RemoveScroll`),be=_.forwardRef((e,t)=>{let r=S(A,e.__scopePopover),i=_.useRef(null),a=n(t,i),o=_.useRef(!1);return _.useEffect(()=>{let e=i.current;if(e)return se(e)},[]),(0,v.jsx)(ie,{as:ye,allowPinchZoom:!0,children:(0,v.jsx)(M,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:h(e.onCloseAutoFocus,e=>{e.preventDefault(),o.current||r.triggerRef.current?.focus()}),onPointerDownOutside:h(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;o.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:h(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),xe=_.forwardRef((e,t)=>{let n=S(A,e.__scopePopover),r=_.useRef(!1),i=_.useRef(!1);return(0,v.jsx)(M,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),M=_.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=S(A,n),p=x(n);return oe(),(0,v.jsx)(ee,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,v.jsx)(ae,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,v.jsx)(fe,{"data-state":P(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),N=`PopoverClose`,Se=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=S(N,n);return(0,v.jsx)(m.button,{type:`button`,...r,ref:t,onClick:h(e.onClick,()=>i.onOpenChange(!1))})});Se.displayName=N;var Ce=`PopoverArrow`,we=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=x(n);return(0,v.jsx)(ue,{...i,...r,ref:t})});we.displayName=Ce;function P(e){return e?`open`:`closed`}var Te=C,Ee=T,De=D,Oe=k,ke=j;function F(e,t){let n;for(let r of e)!r.sessionId||r.id===t||(!n||!r.startedAt||!n.startedAt||r.startedAt>=n.startedAt)&&(n=r);return n}function Ae(e,t){return e?.backend??t?.runner??`claude`}function je(e){let t=F(e.steps);return{sessionId:t?.sessionId,backend:Ae(t,e),profileId:t?.profileId}}var Me=new Set([`queued`,`running`,`waiting`]);function Ne(e){return Me.has(e)}function I(e){return u(e)?!1:e.status===`queued`||e.status===`running`||e.status===`waiting`}function Pe(e){return I(e)&&e.status!==`queued`}function L(e,t,n){return e.archived||!(e.status===`done`||e.status===`failed`||e.status===`cancelled`)||e.delegation?.role===`worker`||n!==void 0&&l(e)!==n?!1:t===`unpinned`?!e.pinned:t!==`pinned`||e.pinned===!0}var Fe=[`done`,`failed`];function Ie(e){return e.archived||u(e)||!Fe.includes(e.status)?!1:e.finishedAt!==void 0}function Le(e){let t=e.finishedAt;return t===void 0||!Ie(e)?!1:e.seenAt===void 0||e.seenAt<t}var R=[`Needs you`,`Finished`,`Working`,`Archived`],Re={waiting:0,review:1,running:2,queued:4,done:5,failed:6,cancelled:7},ze=3,z=e=>u(e)?ze:Re[e.status]??9;function Be(e){let t=e=>s[o(e).bucket];return[...e].sort((e,n)=>t(e)-t(n)||z(e)-z(n))[0]}function Ve(e,t){return t===`archived`?`Archived`:c(e)?`Needs you`:e.status===`waiting`||e.status===`running`||e.status===`queued`?`Working`:`Finished`}function B(e){let t=e.titleSummary;return t===void 0||!(e.titleOrigin===`user`||e.titleOrigin===`marker`)&&/[.!?][A-Z]/.test(t)?e.title:t}function V(e){let t=/^(\d{1,9}): (.+)$/.exec(e),n=t?.[1],r=t?.[2];return n===void 0||r===void 0?{ref:null,rest:e}:{ref:Number(n),rest:r}}function He(e,t){return t!==void 0&&V(e).ref===t}function H(e){let t=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));return new Map(t.map((e,t)=>[e.id,t+1]))}function Ue(e,t){return e.filter(e=>t===`archived`?e.archived:!e.archived).sort((e,n)=>{if(t!==`archived`){let t=Number(!!n.pinned)-Number(!!e.pinned);if(t!==0)return t}let r=z(e)-z(n);if(r!==0)return r;if(u(e)&&u(n)){let t=e.autoResumeAt.localeCompare(n.autoResumeAt);if(t!==0)return t}return e.status===`queued`&&n.status===`queued`?e.createdAt.localeCompare(n.createdAt):n.createdAt.localeCompare(e.createdAt)})}function U(e){return e.delegation?.role===`worker`}function We(e,t){if(e==null)return null;let n=t.find(t=>t.id===e);return!n||!U(n)?e:n.delegation?.parentRunId??e}function Ge(e,t,n=H(e)){let r=Ue(e,t).filter(e=>!U(e)),i=new Map,a=(e,t)=>{let n=i.get(e);n?n.push(t):i.set(e,[t])};for(let e of r)a(Ve(e,t),{kind:`run`,run:e,queuePosition:n.get(e.id)??null});return R.filter(e=>i.has(e)).map(e=>({label:e,rows:i.get(e)}))}function Ke(e,t={}){let n=typeof t==`number`?{overall:t}:d(t),r={"Needs you":`needsYou`,Finished:`finished`,Working:`working`},i=[],a=n.overall===void 0?10:n.overall??1/0;for(let t of e){let e=t.label===`Archived`?1/0:n[r[t.label]]??1/0,o=t.rows.filter(n=>{let r=n.run.pinned;return t.label!==`Archived`&&r?!0:a<=0||e<=0?!1:(--a,--e,!0)});o.length&&i.push({label:t.label,rows:o})}return i}function qe(e,t){if(t.length===0)return[...e];let n=new Set(e.map(e=>e.id)),r=new Set,i=t.filter(e=>n.has(e.id)||r.has(e.id)?!1:(r.add(e.id),!0));return[...e,...i]}function Je(e){let t=0,n=0,r=0;for(let i of e)if(!U(i)){if(i.archived){n+=1;continue}t+=1,c(i)&&(r+=1)}return{active:t,archived:n,waiting:r}}function Ye(e,t,n){return e.filter(e=>!e.archived&&(!n||l(e)===(t===`automations`)))}var W={"Needs you":`needs-you`,Finished:`finished`,Working:`working`},G=Object.keys(W),K=`section`;function Xe(e,t,n){let r=`${K}=${W[e]}`;return n?`/?origin=${t===`automations`?`automations`:`direct`}&${r}`:`/?${r}`}function Ze(e){return G.find(t=>W[t]===e)??null}function Qe(e,t){let n={active:0,automations:0,activeWaiting:0,automationsWaiting:0};for(let r of e){if(U(r)||r.archived)continue;let e=+!!c(r);t&&l(r)?(n.automations+=1,n.automationsWaiting+=e):(n.active+=1,n.activeWaiting+=e)}return n}function q(e){let t=e.visualViewport;return t?Math.max(0,Math.round(e.innerHeight-t.height-t.offsetTop)):0}function $e(e,t,n,r=250){let i=e.visualViewport;if(!i)return t(0),()=>{};let a,o=()=>{let i=q(e);t(i),n&&(clearTimeout(a),a=setTimeout(()=>n(i),r))};return t(q(e)),i.addEventListener(`resize`,o),i.addEventListener(`scroll`,o),()=>{clearTimeout(a),i.removeEventListener(`resize`,o),i.removeEventListener(`scroll`,o),t(0)}}function et(e){let t=e.visualViewport;return t?{top:Math.max(0,Math.round(t.offsetTop)),bottom:q(e)}:{top:0,bottom:0}}function tt(e,t=0){let n=typeof t==`number`?{top:t,right:t,bottom:t,left:t}:t;return{top:(n.top??0)+e.top,right:n.right??0,bottom:(n.bottom??0)+e.bottom,left:n.left??0}}function nt(e,t){let n=e.visualViewport;if(!n)return t({top:0,bottom:0}),()=>{};let r=()=>t(et(e));return r(),n.addEventListener(`resize`,r),n.addEventListener(`scroll`,r),()=>{n.removeEventListener(`resize`,r),n.removeEventListener(`scroll`,r)}}function rt(){let[e,t]=(0,_.useState)({top:0,bottom:0});return(0,_.useEffect)(()=>nt(window,e=>t(t=>t.top===e.top&&t.bottom===e.bottom?t:e)),[]),e}function it(e){let t=(0,_.useRef)(e);t.current=e,(0,_.useEffect)(()=>{let e=document.documentElement;return $e(window,t=>e.style.setProperty(`--kb`,`${t}px`),e=>t.current?.(e))},[])}var at=new Set([``,`text`,`search`,`email`,`url`,`tel`,`password`,`number`]);function ot(e){if(!e||typeof e!=`object`)return!1;let t=e,n=t.tagName?.toUpperCase();return n===`TEXTAREA`?!0:n===`INPUT`?at.has((t.type??``).toLowerCase()):t.isContentEditable===!0}var st=new WeakMap;function ct(e){let t=st.get(e),n=t&&t.width===e.innerWidth?Math.max(t.height,e.innerHeight):e.innerHeight;return st.set(e,{width:e.innerWidth,height:n}),n-e.innerHeight}function lt(e){let t=ct(e),n=e.visualViewport?.scale??1;return Math.abs(n-1)<.05&&q(e)>80||t>80&&ot(e.document?.activeElement)}function ut(){let[e,t]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{let e=window,n=()=>t(lt(e));n();let r=e.visualViewport;return r?.addEventListener(`resize`,n),r?.addEventListener(`scroll`,n),window.addEventListener(`resize`,n),document.addEventListener(`focusin`,n),document.addEventListener(`focusout`,n),()=>{r?.removeEventListener(`resize`,n),r?.removeEventListener(`scroll`,n),window.removeEventListener(`resize`,n),document.removeEventListener(`focusin`,n),document.removeEventListener(`focusout`,n)}},[]),e}function dt(e){let t=/\/(\d+)\/?$/.exec(e.trim()),n=t?Number(t[1]):NaN;return Number.isInteger(n)&&n>0?n:null}function ft(e){let t=new Set;for(let n of[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl]){let e=n?dt(n):null;e!==null&&t.add(e)}for(let n of[e.prNumber,e.issueNumber,e.markerRefs?.pr,e.markerRefs?.issue])typeof n==`number`&&Number.isInteger(n)&&n>0&&t.add(n);for(let n of e.pullRequests??[])t.add(n.number);return[...t]}var pt=[{id:`title`,kind:`text`,scopes:[`stored`],source:`summary`,texts:e=>[e.title]},{id:`titleSummary`,kind:`text`,scopes:[`stored`],source:`summary`,texts:e=>[e.titleSummary]},{id:`displayTitle`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>[t.displayTitle]},{id:`branch`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.branch]},{id:`workflow`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.workflow]},{id:`workflowLabel`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.workflowLabel]},{id:`automation`,kind:`text`,scopes:[`stored`,`shown`],source:`reader`,texts:(e,t)=>[t.automation],universe:e=>[...e.automationNames?.values()??[]]},{id:`projectName`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>[t.projectName]},{id:`tags`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>t.tags??[]},{id:`id`,kind:`identifier`,scopes:[`stored`],source:`summary`,texts:e=>[e.id]},{id:`urls`,kind:`link`,scopes:[`stored`],source:`summary`,texts:e=>[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl,...(e.pullRequests??[]).map(e=>e.url)]},{id:`heldReferences`,kind:`reference`,scopes:[`stored`],source:`summary`,numbers:ft},{id:`shownReferences`,kind:`reference`,scopes:[`shown`],source:`reader`,numbers:(e,t)=>t.references?.()??[]}];function mt(e){return e.trim().toLowerCase().split(/\s+/).filter(e=>e!==``)}function ht(e,t){return t&&e.automationId!==void 0?t.get(e.automationId)??e.automationId:void 0}function gt(e,t){let n=t.scope??`stored`,r=t.scope===`shown`?t.extras:{automation:ht(e,t.automationNames)},i=[],a=[],o=[],s={text:i,identifier:a,link:o},c=[];for(let t of pt)if(t.scopes.includes(n)){if(t.kind===`reference`){c.push(()=>t.numbers(e,r));continue}for(let n of t.texts(e,r))typeof n==`string`&&s[t.kind].push(n.toLowerCase())}let l;return{prose:i,ids:a,links:o,references:()=>l??=new Set(c.flatMap(e=>e().map(String)))}}function _t(e,t,n={}){let r=mt(t);if(r.length===0)return!1;let{prose:i,ids:a,links:o,references:s}=gt(e,n);return r.every(e=>{if(i.some(t=>t.includes(e)))return!0;let t=e.replace(/^#/,``);return/^\d+$/.test(t)?s().has(String(Number(t)))||a.some(e=>e.startsWith(t)):a.some(t=>t.includes(e))||o.some(t=>t.includes(e))})}var vt=new Set([`running`,`waiting`]);function J(e){return e?e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} kB`:``}function yt(e){return e===void 0?``:`$${e>=10?e.toFixed(0):e.toFixed(2)}`}function bt(e,t=new Date){if(!u(e))return;let n=new Date(e.autoResumeAt);if(!Number.isFinite(n.getTime()))return;let r=n.toDateString()===t.toDateString(),i=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(n);return{label:r?i:`${new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(n)} ${i}`,title:`Resumes automatically at ${new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(n)}`}}function xt(e){return e.steps?pe({workflow:e.workflow,steps:e.steps}):e.workflowLabel??e.workflow}function St(e,t,n=()=>``){let r=e.filter(e=>!U(e));return t.trim()?r.filter(e=>_t(e,t,{scope:`shown`,extras:{displayTitle:B(e),automation:n(e),references:()=>Y(e)}})):[...r]}function Y(e){return X(e).map(e=>e.number)}function Ct(e,t){return e.filter(e=>L(e,t)).length}function wt(e){return Ct(e)}function Tt(e){return Et(e)[0]??e.pullRequests?.find(e=>e.url)?.url}function Et(e){let t=[];return e.pullRequestUrl&&t.push(e.pullRequestUrl),!(e.markerRefs?.issue!==void 0&&e.markerRefs?.pr===void 0)&&e.referencedPullRequestUrl&&t.push(e.referencedPullRequestUrl),t}function Dt(e,t){if(e.referencedIssueUrl)return e.referencedIssueUrl;let n=e.issueNumber??e.markerRefs?.issue;if(!(!n||!t))return`${t}/issues/${n}`}function Ot(e){let t=`${e.kind}#${e.number}`;if(!e.url)return`${t}@project:${e.projectId??`default`}`;try{let n=new URL(e.url),r=n.pathname.split(`/`).filter(Boolean).slice(0,2).join(`/`);return`${t}@${n.host.toLowerCase()}/${r.toLowerCase()}`}catch{return`${t}@${e.url}`}}function X(e,t,n=e.projectId){let r=Et(e),i=e.markerRefs?.pr,a=[...i===void 0||[...r,...(e.pullRequests??[]).flatMap(e=>e.url?[e.url]:[])].some(e=>Q(e)===String(i))?[]:[{kind:`PR`,number:i}],...r.map(e=>({kind:`PR`,url:e})),{kind:`PR`,number:e.prNumber},...(e.pullRequests??[]).map(e=>({kind:`PR`,number:e.number,...e.url?{url:e.url}:{},authoritative:!0})),{kind:`Issue`,url:Dt(e,t)},{kind:`Issue`,number:e.issueNumber}],o=new Set,s=[];for(let e of a){let r=e.url?Number(Q(e.url)):e.number;if(!r||!Number.isInteger(r)||!e.url&&!e.authoritative&&s.some(t=>t.url&&t.kind===e.kind&&t.number===r))continue;let i=e.url??kt(e.kind,r,t),a={kind:e.kind,number:r,...i?{url:i}:n===void 0?{}:{projectId:n}},c=Ot(a);o.has(c)||(o.add(c),s.push(a))}return s}function kt(e,t,n){if(n)return`${n}/${e===`PR`?`pull`:`issues`}/${t}`}function At(e){return X(e)[0]}function Z(e,t){if(!e.url)return!0;if(!t)return!1;let n=jt(t);return n!==void 0&&jt(e.url)===n}function jt(e){try{let t=new URL(e),[n,r]=t.pathname.split(`/`).filter(Boolean);return n&&r?`${t.host}/${n}/${r}`.toLowerCase():void 0}catch{return}}function Mt(e,t){let n=[];for(let r of X(e,t)){if(!Z(r,t))continue;let e=r.kind===`PR`?`pr`:`issue`;n.some(t=>t.kind===e&&t.number===r.number)||n.push({kind:e,number:r.number})}return n}function Nt(e,t,n,r){if(Z(n,r))return`/p/${e}/tasks/${t}/${n.kind===`PR`?`pr`:`issue`}/${n.number}`}function Q(e){return/\/(\d+)\/?(?:[?#].*)?$/.exec(e)?.[1]??null}function Pt(e,t){let n=vt.has(e.status)?t:void 0;if(n)return{cpu:{text:`${n.cpuPct.toFixed(0)}%`,kind:`live`},mem:{text:J(n.rssBytes),kind:`live`}};let r=J(e.peakRssBytes);return{cpu:{text:``,kind:`none`},mem:r?{text:`peak ${r}`,kind:`peak`,title:`peak — run finished${e.peakProcCount?` · ${e.peakProcCount} procs`:``}`}:{text:``,kind:`none`}}}var $=_.createContext(null);function Ft({...e}){let t=_.useRef(!1);return(0,v.jsx)($,{value:t,children:(0,v.jsx)(Te,{"data-slot":`popover`,...e})})}function It({onPointerDownCapture:e,onKeyDownCapture:t,...n}){let r=_.useContext($);return(0,v.jsx)(De,{"data-slot":`popover-trigger`,...n,onPointerDownCapture:t=>{r&&(r.current=t.pointerType===`touch`),e?.(t)},onKeyDownCapture:e=>{r&&(r.current=!1),t?.(e)}})}function Lt({className:e,align:t=`center`,sideOffset:n=4,collisionPadding:i,onOpenAutoFocus:a,...o}){let s=rt(),c=_.useContext($);return(0,v.jsx)(Oe,{children:(0,v.jsx)(ke,{"data-slot":`popover-content`,align:t,sideOffset:n,onOpenAutoFocus:e=>{let t=c?.current;if(c&&(c.current=!1),a?.(e),e.defaultPrevented||!t)return;let n=e.target;n instanceof HTMLElement&&n.querySelector(`[cmdk-input]`)&&(e.preventDefault(),n.focus({preventScroll:!0}))},collisionPadding:tt(s,i),className:r(`z-50 w-72 max-w-(--radix-popover-content-available-width) [overflow-wrap:anywhere] origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,e),...o})})}function Rt({...e}){return(0,v.jsx)(Ee,{"data-slot":`popover-anchor`,...e})}var zt=`(min-width: 48rem)`;function Bt(){let[e,t]=(0,_.useState)(()=>typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 48rem)`).matches);return(0,_.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(zt),n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}export{F as $,G as A,Xe as B,Pt as C,ut as D,it as E,Be as F,qe as G,Qe as H,Ze as I,Ne as J,Ie as K,H as L,Ge as M,U as N,R as O,Je as P,je as Q,He as R,X as S,_t as T,Ye as U,We as V,V as W,L as X,Pe as Y,Le as Z,Dt as _,Lt as a,Tt as b,wt as c,Z as d,me as et,Q as f,Ct as g,Y as h,Rt as i,Ke as j,K as k,yt as l,bt as m,Bt as n,It as o,Ot as p,I as q,Ft as r,St as s,zt as t,J as u,Nt as v,xt as w,At as x,Mt as y,B as z};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,s as n,u as r}from"./button-DGwhwRuD.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{Ln as o,Mn as s,Rn as c,Un as l,rr as u}from"./project-scope-context-B0yKt2yI.js";import{M as d}from"./live-protocol-BmbbwF5R.js";import"./queries-DoYRza8s.js";import{t as f}from"./createLucideIcon-BHp8sXmF.js";import{a as ee,d as p,h as m,i as te,l as ne,m as re,n as ie,o as ae,p as h,r as oe,t as se,u as g}from"./es2015-DTn4s5Lh.js";import{_ as ce,b as le,v as ue,x as de,y as fe}from"./dropdown-menu-DPrTX-zi.js";import"./attention-CdwMIvQG.js";function pe(e){if(e.workflow===`(planned)`||e.workflow===`(inbox)`){let t=(e.steps??[]).find(e=>e.kind===`agent`);if(t?.name)return t.name}return e.workflow}var me=f(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),_=e(i(),1),v=a(),y=`Popover`,[b,he]=re(y,[de]),x=de(),[ge,S]=b(y),C=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=x(t),c=_.useRef(null),[l,u]=_.useState(!1),[d,f]=p({prop:r,defaultProp:i??!1,onChange:a,caller:y});return(0,v.jsx)(le,{...s,children:(0,v.jsx)(ge,{scope:t,contentId:ne(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:_.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:_.useCallback(()=>u(!0),[]),onCustomAnchorRemove:_.useCallback(()=>u(!1),[]),modal:o,children:n})})};C.displayName=y;var w=`PopoverAnchor`,T=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=S(w,n),a=x(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return _.useEffect(()=>(o(),()=>s()),[o,s]),(0,v.jsx)(ce,{...a,...r,ref:t})});T.displayName=w;var E=`PopoverTrigger`,D=_.forwardRef((e,t)=>{let{__scopePopover:r,...i}=e,a=S(E,r),o=x(r),s=n(t,a.triggerRef),c=(0,v.jsx)(m.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":P(a.open),...i,ref:s,onClick:h(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?c:(0,v.jsx)(ce,{asChild:!0,...o,children:c})});D.displayName=E;var O=`PopoverPortal`,[_e,ve]=b(O,{forceMount:void 0}),k=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=S(O,t);return(0,v.jsx)(_e,{scope:t,forceMount:n,children:(0,v.jsx)(g,{present:n||a.open,children:(0,v.jsx)(te,{asChild:!0,container:i,children:r})})})};k.displayName=O;var A=`PopoverContent`,j=_.forwardRef((e,t)=>{let n=ve(A,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=S(A,e.__scopePopover);return(0,v.jsx)(g,{present:r||a.open,children:a.modal?(0,v.jsx)(be,{...i,ref:t}):(0,v.jsx)(xe,{...i,ref:t})})});j.displayName=A;var ye=t(`PopoverContent.RemoveScroll`),be=_.forwardRef((e,t)=>{let r=S(A,e.__scopePopover),i=_.useRef(null),a=n(t,i),o=_.useRef(!1);return _.useEffect(()=>{let e=i.current;if(e)return se(e)},[]),(0,v.jsx)(ie,{as:ye,allowPinchZoom:!0,children:(0,v.jsx)(M,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:h(e.onCloseAutoFocus,e=>{e.preventDefault(),o.current||r.triggerRef.current?.focus()}),onPointerDownOutside:h(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;o.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:h(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),xe=_.forwardRef((e,t)=>{let n=S(A,e.__scopePopover),r=_.useRef(!1),i=_.useRef(!1);return(0,v.jsx)(M,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),M=_.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=S(A,n),p=x(n);return oe(),(0,v.jsx)(ee,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,v.jsx)(ae,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,v.jsx)(fe,{"data-state":P(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),N=`PopoverClose`,Se=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=S(N,n);return(0,v.jsx)(m.button,{type:`button`,...r,ref:t,onClick:h(e.onClick,()=>i.onOpenChange(!1))})});Se.displayName=N;var Ce=`PopoverArrow`,we=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=x(n);return(0,v.jsx)(ue,{...i,...r,ref:t})});we.displayName=Ce;function P(e){return e?`open`:`closed`}var Te=C,Ee=T,De=D,Oe=k,ke=j;function F(e,t){let n;for(let r of e)!r.sessionId||r.id===t||(!n||!r.startedAt||!n.startedAt||r.startedAt>=n.startedAt)&&(n=r);return n}function Ae(e,t){return e?.backend??t?.runner??`claude`}function je(e){let t=F(e.steps);return{sessionId:t?.sessionId,backend:Ae(t,e),profileId:t?.profileId}}var Me=new Set([`queued`,`running`,`waiting`]);function Ne(e){return Me.has(e)}function I(e){return u(e)?!1:e.status===`queued`||e.status===`running`||e.status===`waiting`}function Pe(e){return I(e)&&e.status!==`queued`}function L(e,t,n){return e.archived||!(e.status===`done`||e.status===`failed`||e.status===`cancelled`)||e.delegation?.role===`worker`||n!==void 0&&l(e)!==n?!1:t===`unpinned`?!e.pinned:t!==`pinned`||e.pinned===!0}var Fe=[`done`,`failed`];function Ie(e){return e.archived||u(e)||!Fe.includes(e.status)?!1:e.finishedAt!==void 0}function Le(e){let t=e.finishedAt;return t===void 0||!Ie(e)?!1:e.seenAt===void 0||e.seenAt<t}var R=[`Needs you`,`Finished`,`Working`,`Archived`],Re={waiting:0,review:1,running:2,queued:4,done:5,failed:6,cancelled:7},ze=3,z=e=>u(e)?ze:Re[e.status]??9;function Be(e){let t=e=>s[o(e).bucket];return[...e].sort((e,n)=>t(e)-t(n)||z(e)-z(n))[0]}function Ve(e,t){return t===`archived`?`Archived`:c(e)?`Needs you`:e.status===`waiting`||e.status===`running`||e.status===`queued`?`Working`:`Finished`}function B(e){let t=e.titleSummary;return t===void 0||!(e.titleOrigin===`user`||e.titleOrigin===`marker`)&&/[.!?][A-Z]/.test(t)?e.title:t}function V(e){let t=/^(\d{1,9}): (.+)$/.exec(e),n=t?.[1],r=t?.[2];return n===void 0||r===void 0?{ref:null,rest:e}:{ref:Number(n),rest:r}}function He(e,t){return t!==void 0&&V(e).ref===t}function H(e){let t=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));return new Map(t.map((e,t)=>[e.id,t+1]))}function Ue(e,t){return e.filter(e=>t===`archived`?e.archived:!e.archived).sort((e,n)=>{if(t!==`archived`){let t=Number(!!n.pinned)-Number(!!e.pinned);if(t!==0)return t}let r=z(e)-z(n);if(r!==0)return r;if(u(e)&&u(n)){let t=e.autoResumeAt.localeCompare(n.autoResumeAt);if(t!==0)return t}return e.status===`queued`&&n.status===`queued`?e.createdAt.localeCompare(n.createdAt):n.createdAt.localeCompare(e.createdAt)})}function U(e){return e.delegation?.role===`worker`}function We(e,t){if(e==null)return null;let n=t.find(t=>t.id===e);return!n||!U(n)?e:n.delegation?.parentRunId??e}function Ge(e,t,n=H(e)){let r=Ue(e,t).filter(e=>!U(e)),i=new Map,a=(e,t)=>{let n=i.get(e);n?n.push(t):i.set(e,[t])};for(let e of r)a(Ve(e,t),{kind:`run`,run:e,queuePosition:n.get(e.id)??null});return R.filter(e=>i.has(e)).map(e=>({label:e,rows:i.get(e)}))}function Ke(e,t={}){let n=typeof t==`number`?{overall:t}:d(t),r={"Needs you":`needsYou`,Finished:`finished`,Working:`working`},i=[],a=n.overall===void 0?10:n.overall??1/0;for(let t of e){let e=t.label===`Archived`?1/0:n[r[t.label]]??1/0,o=t.rows.filter(n=>{let r=n.run.pinned;return t.label!==`Archived`&&r?!0:a<=0||e<=0?!1:(--a,--e,!0)});o.length&&i.push({label:t.label,rows:o})}return i}function qe(e,t){if(t.length===0)return[...e];let n=new Set(e.map(e=>e.id)),r=new Set,i=t.filter(e=>n.has(e.id)||r.has(e.id)?!1:(r.add(e.id),!0));return[...e,...i]}function Je(e){let t=0,n=0,r=0;for(let i of e)if(!U(i)){if(i.archived){n+=1;continue}t+=1,c(i)&&(r+=1)}return{active:t,archived:n,waiting:r}}function Ye(e,t,n){return e.filter(e=>!e.archived&&(!n||l(e)===(t===`automations`)))}var W={"Needs you":`needs-you`,Finished:`finished`,Working:`working`},G=Object.keys(W),K=`section`;function Xe(e,t,n){let r=`${K}=${W[e]}`;return n?`/?origin=${t===`automations`?`automations`:`direct`}&${r}`:`/?${r}`}function Ze(e){return G.find(t=>W[t]===e)??null}function Qe(e,t){let n={active:0,automations:0,activeWaiting:0,automationsWaiting:0};for(let r of e){if(U(r)||r.archived)continue;let e=+!!c(r);t&&l(r)?(n.automations+=1,n.automationsWaiting+=e):(n.active+=1,n.activeWaiting+=e)}return n}function q(e){let t=e.visualViewport;return t?Math.max(0,Math.round(e.innerHeight-t.height-t.offsetTop)):0}function $e(e,t,n,r=250){let i=e.visualViewport;if(!i)return t(0),()=>{};let a,o=()=>{let i=q(e);t(i),n&&(clearTimeout(a),a=setTimeout(()=>n(i),r))};return t(q(e)),i.addEventListener(`resize`,o),i.addEventListener(`scroll`,o),()=>{clearTimeout(a),i.removeEventListener(`resize`,o),i.removeEventListener(`scroll`,o),t(0)}}function et(e){let t=e.visualViewport;return t?{top:Math.max(0,Math.round(t.offsetTop)),bottom:q(e)}:{top:0,bottom:0}}function tt(e,t=0){let n=typeof t==`number`?{top:t,right:t,bottom:t,left:t}:t;return{top:(n.top??0)+e.top,right:n.right??0,bottom:(n.bottom??0)+e.bottom,left:n.left??0}}function nt(e,t){let n=e.visualViewport;if(!n)return t({top:0,bottom:0}),()=>{};let r=()=>t(et(e));return r(),n.addEventListener(`resize`,r),n.addEventListener(`scroll`,r),()=>{n.removeEventListener(`resize`,r),n.removeEventListener(`scroll`,r)}}function rt(){let[e,t]=(0,_.useState)({top:0,bottom:0});return(0,_.useEffect)(()=>nt(window,e=>t(t=>t.top===e.top&&t.bottom===e.bottom?t:e)),[]),e}function it(e){let t=(0,_.useRef)(e);t.current=e,(0,_.useEffect)(()=>{let e=document.documentElement;return $e(window,t=>e.style.setProperty(`--kb`,`${t}px`),e=>t.current?.(e))},[])}var at=new Set([``,`text`,`search`,`email`,`url`,`tel`,`password`,`number`]);function ot(e){if(!e||typeof e!=`object`)return!1;let t=e,n=t.tagName?.toUpperCase();return n===`TEXTAREA`?!0:n===`INPUT`?at.has((t.type??``).toLowerCase()):t.isContentEditable===!0}var st=new WeakMap;function ct(e){let t=st.get(e),n=t&&t.width===e.innerWidth?Math.max(t.height,e.innerHeight):e.innerHeight;return st.set(e,{width:e.innerWidth,height:n}),n-e.innerHeight}function lt(e){let t=ct(e),n=e.visualViewport?.scale??1;return Math.abs(n-1)<.05&&q(e)>80||t>80&&ot(e.document?.activeElement)}function ut(){let[e,t]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{let e=window,n=()=>t(lt(e));n();let r=e.visualViewport;return r?.addEventListener(`resize`,n),r?.addEventListener(`scroll`,n),window.addEventListener(`resize`,n),document.addEventListener(`focusin`,n),document.addEventListener(`focusout`,n),()=>{r?.removeEventListener(`resize`,n),r?.removeEventListener(`scroll`,n),window.removeEventListener(`resize`,n),document.removeEventListener(`focusin`,n),document.removeEventListener(`focusout`,n)}},[]),e}function dt(e){let t=/\/(\d+)\/?$/.exec(e.trim()),n=t?Number(t[1]):NaN;return Number.isInteger(n)&&n>0?n:null}function ft(e){let t=new Set;for(let n of[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl]){let e=n?dt(n):null;e!==null&&t.add(e)}for(let n of[e.prNumber,e.issueNumber,e.markerRefs?.pr,e.markerRefs?.issue])typeof n==`number`&&Number.isInteger(n)&&n>0&&t.add(n);for(let n of e.pullRequests??[])t.add(n.number);return[...t]}var pt=[{id:`title`,kind:`text`,scopes:[`stored`],source:`summary`,texts:e=>[e.title]},{id:`titleSummary`,kind:`text`,scopes:[`stored`],source:`summary`,texts:e=>[e.titleSummary]},{id:`displayTitle`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>[t.displayTitle]},{id:`branch`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.branch]},{id:`workflow`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.workflow]},{id:`workflowLabel`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.workflowLabel]},{id:`automation`,kind:`text`,scopes:[`stored`,`shown`],source:`reader`,texts:(e,t)=>[t.automation],universe:e=>[...e.automationNames?.values()??[]]},{id:`projectName`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>[t.projectName]},{id:`tags`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>t.tags??[]},{id:`id`,kind:`identifier`,scopes:[`stored`],source:`summary`,texts:e=>[e.id]},{id:`urls`,kind:`link`,scopes:[`stored`],source:`summary`,texts:e=>[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl,...(e.pullRequests??[]).map(e=>e.url)]},{id:`heldReferences`,kind:`reference`,scopes:[`stored`],source:`summary`,numbers:ft},{id:`shownReferences`,kind:`reference`,scopes:[`shown`],source:`reader`,numbers:(e,t)=>t.references?.()??[]}];function mt(e){return e.trim().toLowerCase().split(/\s+/).filter(e=>e!==``)}function ht(e,t){return t&&e.automationId!==void 0?t.get(e.automationId)??e.automationId:void 0}function gt(e,t){let n=t.scope??`stored`,r=t.scope===`shown`?t.extras:{automation:ht(e,t.automationNames)},i=[],a=[],o=[],s={text:i,identifier:a,link:o},c=[];for(let t of pt)if(t.scopes.includes(n)){if(t.kind===`reference`){c.push(()=>t.numbers(e,r));continue}for(let n of t.texts(e,r))typeof n==`string`&&s[t.kind].push(n.toLowerCase())}let l;return{prose:i,ids:a,links:o,references:()=>l??=new Set(c.flatMap(e=>e().map(String)))}}function _t(e,t,n={}){let r=mt(t);if(r.length===0)return!1;let{prose:i,ids:a,links:o,references:s}=gt(e,n);return r.every(e=>{if(i.some(t=>t.includes(e)))return!0;let t=e.replace(/^#/,``);return/^\d+$/.test(t)?s().has(String(Number(t)))||a.some(e=>e.startsWith(t)):a.some(t=>t.includes(e))||o.some(t=>t.includes(e))})}var vt=new Set([`running`,`waiting`]);function J(e){return e?e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} kB`:``}function yt(e){return e===void 0?``:`$${e>=10?e.toFixed(0):e.toFixed(2)}`}function bt(e,t=new Date){if(!u(e))return;let n=new Date(e.autoResumeAt);if(!Number.isFinite(n.getTime()))return;let r=n.toDateString()===t.toDateString(),i=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(n);return{label:r?i:`${new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(n)} ${i}`,title:`Resumes automatically at ${new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(n)}`}}function xt(e){return e.steps?pe({workflow:e.workflow,steps:e.steps}):e.workflowLabel??e.workflow}function St(e,t,n=()=>``){let r=e.filter(e=>!U(e));return t.trim()?r.filter(e=>_t(e,t,{scope:`shown`,extras:{displayTitle:B(e),automation:n(e),references:()=>Y(e)}})):[...r]}function Y(e){return X(e).map(e=>e.number)}function Ct(e,t){return e.filter(e=>L(e,t)).length}function wt(e){return Ct(e)}function Tt(e){return Et(e)[0]??e.pullRequests?.find(e=>e.url)?.url}function Et(e){let t=[];return e.pullRequestUrl&&t.push(e.pullRequestUrl),!(e.markerRefs?.issue!==void 0&&e.markerRefs?.pr===void 0)&&e.referencedPullRequestUrl&&t.push(e.referencedPullRequestUrl),t}function Dt(e,t){if(e.referencedIssueUrl)return e.referencedIssueUrl;let n=e.issueNumber??e.markerRefs?.issue;if(!(!n||!t))return`${t}/issues/${n}`}function Ot(e){let t=`${e.kind}#${e.number}`;if(!e.url)return`${t}@project:${e.projectId??`default`}`;try{let n=new URL(e.url),r=n.pathname.split(`/`).filter(Boolean).slice(0,2).join(`/`);return`${t}@${n.host.toLowerCase()}/${r.toLowerCase()}`}catch{return`${t}@${e.url}`}}function X(e,t,n=e.projectId){let r=Et(e),i=e.markerRefs?.pr,a=[...i===void 0||[...r,...(e.pullRequests??[]).flatMap(e=>e.url?[e.url]:[])].some(e=>Q(e)===String(i))?[]:[{kind:`PR`,number:i}],...r.map(e=>({kind:`PR`,url:e})),{kind:`PR`,number:e.prNumber},...(e.pullRequests??[]).map(e=>({kind:`PR`,number:e.number,...e.url?{url:e.url}:{},authoritative:!0})),{kind:`Issue`,url:Dt(e,t)},{kind:`Issue`,number:e.issueNumber}],o=new Set,s=[];for(let e of a){let r=e.url?Number(Q(e.url)):e.number;if(!r||!Number.isInteger(r)||!e.url&&!e.authoritative&&s.some(t=>t.url&&t.kind===e.kind&&t.number===r))continue;let i=e.url??kt(e.kind,r,t),a={kind:e.kind,number:r,...i?{url:i}:n===void 0?{}:{projectId:n}},c=Ot(a);o.has(c)||(o.add(c),s.push(a))}return s}function kt(e,t,n){if(n)return`${n}/${e===`PR`?`pull`:`issues`}/${t}`}function At(e){return X(e)[0]}function Z(e,t){if(!e.url)return!0;if(!t)return!1;let n=jt(t);return n!==void 0&&jt(e.url)===n}function jt(e){try{let t=new URL(e),[n,r]=t.pathname.split(`/`).filter(Boolean);return n&&r?`${t.host}/${n}/${r}`.toLowerCase():void 0}catch{return}}function Mt(e,t){let n=[];for(let r of X(e,t)){if(!Z(r,t))continue;let e=r.kind===`PR`?`pr`:`issue`;n.some(t=>t.kind===e&&t.number===r.number)||n.push({kind:e,number:r.number})}return n}function Nt(e,t,n,r){if(Z(n,r))return`/p/${e}/tasks/${t}/${n.kind===`PR`?`pr`:`issue`}/${n.number}`}function Q(e){return/\/(\d+)\/?(?:[?#].*)?$/.exec(e)?.[1]??null}function Pt(e,t){let n=vt.has(e.status)?t:void 0;if(n)return{cpu:{text:`${n.cpuPct.toFixed(0)}%`,kind:`live`},mem:{text:J(n.rssBytes),kind:`live`}};let r=J(e.peakRssBytes);return{cpu:{text:``,kind:`none`},mem:r?{text:`peak ${r}`,kind:`peak`,title:`peak — run finished${e.peakProcCount?` · ${e.peakProcCount} procs`:``}`}:{text:``,kind:`none`}}}var $=_.createContext(null);function Ft({...e}){let t=_.useRef(!1);return(0,v.jsx)($,{value:t,children:(0,v.jsx)(Te,{"data-slot":`popover`,...e})})}function It({onPointerDownCapture:e,onKeyDownCapture:t,...n}){let r=_.useContext($);return(0,v.jsx)(De,{"data-slot":`popover-trigger`,...n,onPointerDownCapture:t=>{r&&(r.current=t.pointerType===`touch`),e?.(t)},onKeyDownCapture:e=>{r&&(r.current=!1),t?.(e)}})}function Lt({className:e,align:t=`center`,sideOffset:n=4,collisionPadding:i,onOpenAutoFocus:a,...o}){let s=rt(),c=_.useContext($);return(0,v.jsx)(Oe,{children:(0,v.jsx)(ke,{"data-slot":`popover-content`,align:t,sideOffset:n,onOpenAutoFocus:e=>{let t=c?.current;if(c&&(c.current=!1),a?.(e),e.defaultPrevented||!t)return;let n=e.target;n instanceof HTMLElement&&n.querySelector(`[cmdk-input]`)&&(e.preventDefault(),n.focus({preventScroll:!0}))},collisionPadding:tt(s,i),className:r(`z-50 w-72 max-w-(--radix-popover-content-available-width) [overflow-wrap:anywhere] origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,e),...o})})}function Rt({...e}){return(0,v.jsx)(Ee,{"data-slot":`popover-anchor`,...e})}var zt=`(min-width: 48rem)`;function Bt(){let[e,t]=(0,_.useState)(()=>typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 48rem)`).matches);return(0,_.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(zt),n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}export{F as $,G as A,Xe as B,Pt as C,ut as D,it as E,Be as F,qe as G,Qe as H,Ze as I,Ne as J,Ie as K,H as L,Ge as M,U as N,R as O,Je as P,je as Q,He as R,X as S,_t as T,Ye as U,We as V,V as W,L as X,Pe as Y,Le as Z,Dt as _,Lt as a,Tt as b,wt as c,Z as d,me as et,Q as f,Ct as g,Y as h,Rt as i,Ke as j,K as k,yt as l,bt as m,Bt as n,It as o,Ot as p,I as q,Ft as r,St as s,zt as t,J as u,Nt as v,xt as w,At as x,Mt as y,B as z};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,t as n,u as r}from"./button-DGwhwRuD.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{C as o,Ur as s,en as c,nt as l,r as u,rt as d,yr as f,zt as p}from"./project-scope-context-0Z0nsheq.js";import{$ as m,At as h,Lt as g,M as _,Nt as v,O as y,h as b,n as x,nn as S,nt as C,wt as w}from"./queries-7W9tOZsg.js";import{t as T}from"./useQuery-CBKC2lBX.js";import{a as E,et as D,o as O,r as k}from"./use-desktop-DdcA0Atl.js";import{n as A}from"./toaster-CoMJoQvk.js";import{A as j,Z as ee,_ as M,b as N,ct as P,d as F,ft as te,h as I,l as L,mt as ne,ot as re,r as ie,rt as ae,u as oe,ut as se}from"./design-icons-DmYTv2r1.js";import{t as ce}from"./eye-B8okNWXU.js";import{a as le,i as R}from"./format-BNCkW110.js";import{t as ue}from"./message-square-B-MD-8rD.js";import{t as de}from"./play-CmVAj_fu.js";import{a as fe,i as pe,o as me,r as he,s as ge,t as _e}from"./dialog-B7p5oc5r.js";import{d as z,t as ve,y as B}from"./prompt-template-menu-uUjg9v98.js";import{t as V}from"./project-router-F1inY-EB.js";import{B as ye,E as be,G as xe,I as Se,L as H,M as Ce,O as we,P as Te,R as Ee,S as De,T as Oe,a as ke,b as Ae,f as je,h as Me,i as Ne,l as Pe,m as Fe,n as Ie,p as Le,r as Re,s as ze,t as Be,u as Ve,w as He,x as Ue,z as We}from"./agent-accounts-D2uZHuiM.js";import{d as Ge,f as Ke,i as qe,s as Je,t as Ye,u as Xe}from"./skills-DFBiAuJG.js";import{$ as Ze,F as Qe,L as $e,X as et,Y as tt,pn as nt}from"./index-e1OpsDKN.js";import{t as rt}from"./diff-C3Cms5Ep.js";import{t as it}from"./tab-link-XI9xWLwR.js";var U=e(i(),1),W=a(),at={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function G({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,W.jsx)(L,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:r(t,`text-success`)}):e===`failing`?(0,W.jsx)(M,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:r(t,`text-danger`)}):e===`pending`?(0,W.jsx)(le,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:r(t,`animate-spin text-warning`)}):(0,W.jsx)(I,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:r(t,`text-soft-foreground`)})}function ot(e){return e?.available?e.mergeState:null}function st(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function ct(e){return e.state===`merged`?`Merged`:e.state===`closed`?`Closed`:e.isDraft?`Draft`:e.mergeable===`conflicting`?`Conflicts must be resolved`:e.canMerge?`Ready to merge`:e.eligibility===`unknown`?`Merge blocked · Requirements unknown`:`Merge blocked`}function lt(e){return e===`approved`||e===`not-required`?`passing`:e===`unknown`?`unknown`:`failing`}function ut(e){return e===`mergeable`?`passing`:e===`conflicting`?`failing`:`unknown`}function dt(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function ft(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function pt(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function mt(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function K(e){return e?at[e]:`Merge`}function ht(e){return e===`conflicting`?`true`:void 0}function gt({check:e}){return(0,W.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,W.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(G,{state:e.state}),(0,W.jsxs)(`span`,{children:[e.name,` · `,e.state,ft(e.required)]})]}),e.url&&t(e.url)?(0,W.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function _t({reason:e}){return(0,W.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,W.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:e})]})}function vt({state:e,selectedMethod:t,overrideRules:i,mergeEnabled:a,refreshPending:o,onRefresh:s,onRunAgent:c,onConfirm:l,onMethodChange:u,onOverrideChange:d}){let f=ct(e),p=lt(e.reviewDecision),m=ut(e.mergeable);return(0,W.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,W.jsx)(L,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,W.jsx)(P,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,W.jsx)(`h3`,{className:`font-semibold`,children:f}),(0,W.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,disabled:o,onClick:s,children:[(0,W.jsx)(ee,{size:16,"aria-hidden":`true`,className:r(`size-3.5`,o&&`animate-spin`)}),`Refresh`]})]}),(0,W.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[e.headRef,` (`,e.headSha.slice(0,7),`) → `,e.baseRef]}),(0,W.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,W.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(G,{state:p}),(0,W.jsxs)(`span`,{children:[`Reviews: `,e.reviewDecision.replaceAll(`-`,` `)]})]}),(0,W.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(G,{state:m}),(0,W.jsxs)(`span`,{children:[`Conflicts: `,dt(e.mergeable)]})]}),e.checks.length===0?(0,W.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,W.jsx)(gt,{check:e},e.name)),e.blockers.map(e=>(0,W.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&c?(0,W.jsx)(n,{className:`mt-4`,onClick:c,children:`Run agent on this PR`}):null,e.canOverride?(0,W.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-warning/40 bg-warning/5 p-3 text-xs`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>d(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,W.jsxs)(`span`,{children:[(0,W.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,W.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,e.eligibility===`unknown`?(0,W.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`GitHub could not confirm review and branch-protection requirements. Passing checks do not establish merge readiness.`}):null,e.state===`open`&&e.methods.length>0?(0,W.jsxs)(`div`,{className:`mt-4 flex flex-col flex-wrap gap-2 sm:flex-row`,children:[(0,W.jsx)(`select`,{"aria-label":`Merge method`,value:t??``,onChange:e=>u(e.target.value),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm`,children:e.methods.map(e=>(0,W.jsx)(`option`,{value:e,children:at[e]},e))}),(0,W.jsx)(n,{disabled:!a,onClick:l,children:K(t)})]}):null]})]})}function yt({number:e,state:t,selectedMethod:r,confirming:i,overrideRules:a,mergePending:o,mergeError:s,onOpenChange:c,onMerge:l}){return(0,W.jsx)(_e,{open:i,onOpenChange:c,children:(0,W.jsxs)(he,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,W.jsxs)(me,{children:[(0,W.jsxs)(ge,{children:[K(r),` pull request #`,e,`?`]}),(0,W.jsx)(pe,{asChild:!0,children:(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`p`,{children:[`This will merge “`,t.title,`” into `,t.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),a&&t.canOverride?(0,W.jsx)(`p`,{"data-slot":`gh-bypass-warning`,className:`mt-4 text-sm text-warning`,children:`You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`}):null]})})]}),s?(0,W.jsx)(`p`,{className:`text-sm text-danger`,children:s.message}):null,(0,W.jsxs)(fe,{children:[(0,W.jsx)(n,{variant:`outline`,disabled:o,onClick:()=>c(!1),children:`Cancel`}),(0,W.jsx)(n,{disabled:o,onClick:l,children:o?`Merging…`:K(r)})]})]})})}function bt({number:e,onRunAgent:t}){let n=s(),r=C(),i=T({queryKey:x.githubMergeState(e),queryFn:({signal:t})=>d(e,{},{signal:t}),retry:!1}),a=ot(i.data),[o,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(!1),[f,m]=(0,U.useState)(!1),h=S({mutationFn:t=>d(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>A(e instanceof Error?e.message:String(e),{tone:`danger`})}),g=st(o,a),_=()=>({mergeState:x.githubMergeState(e),list:x.githubPages(50),comments:x.githubComments(`pr`,e),item:x.githubItem(`pr`,e),refStatus:r===void 0?void 0:x.githubRefStatusOf(r)}),v=S({mutationFn:t=>{if(!a||!g)throw Error(`No merge method is available.`);return p(e,{method:g,expectedHeadSha:a.headSha,...f&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{u(!1),A(`Pull request #${e} merged`),n.invalidateQueries({queryKey:r.mergeState}),n.invalidateQueries({queryKey:r.list}),n.invalidateQueries({queryKey:r.comments}),n.invalidateQueries({queryKey:r.item}),r.refStatus&&n.invalidateQueries({queryKey:r.refStatus})},onError:(e,t)=>{A(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,W.jsx)(B,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,W.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":ht(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,W.jsx)(vt,{state:a,selectedMethod:g,overrideRules:f,mergeEnabled:mt(g,a,f),refreshPending:h.isPending,onRefresh:()=>h.mutate(x.githubMergeState(e)),onRunAgent:t,onConfirm:()=>u(!0),onMethodChange:c,onOverrideChange:m}),(0,W.jsx)(yt,{number:e,state:a,selectedMethod:g,confirming:l,overrideRules:f,mergePending:v.isPending,mergeError:v.error,onOpenChange:u,onMerge:()=>v.mutate(_())})]}):(0,W.jsx)(_t,{reason:pt(i.data)})}function xt(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function St(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))||t.assignees?.length&&!e.assignees?.some(e=>t.assignees.some(t=>t.toLowerCase()===e.toLowerCase()))||t.author!==void 0&&e.author.toLowerCase()!==t.author.toLowerCase()||t.includeNumbers&&!t.includeNumbers.has(e.number)||t.excludeNumbers?.has(e.number)||t.projectId&&e.projectIds!==void 0&&!e.projectIds.includes(t.projectId)?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body??``}`.toLowerCase().includes(n))}function Ct(e,t){let n=e.trim();if(n===``)return!1;let r=n.replace(/^#/,``);return/^\d+$/.test(r)?!t.some(e=>e.number===Number(r)):t.length===0}function q(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}function wt({label:e,color:t,plain:n=!1}){return(0,W.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:q(t),className:n?`text-[11px] font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[12px] font-medium`,children:e})}function Tt(e){return e===`pr`?`pull request`:`issue`}function Et(e,t,n){return e===`pr`&&!!(t||n)}function Dt({backLink:e}){return e?(0,W.jsxs)(V,{to:e.to,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,W.jsx)(ie,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}):null}function Ot({item:e,kindWord:n,commentCount:r,hasDiffStat:i,additions:a,deletions:o}){return(0,W.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,W.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,W.jsx)(`span`,{children:n}),`·`,(0,W.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,W.jsxs)(`span`,{children:[R(e.createdAt),` ago`]}),r?(0,W.jsxs)(W.Fragment,{children:[`·`,(0,W.jsx)(Yt,{count:r})]}):null,i?(0,W.jsxs)(W.Fragment,{children:[`·`,(0,W.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,W.jsxs)(`span`,{className:`text-success`,children:[`+`,a??0]}),` `,(0,W.jsxs)(`span`,{className:`text-danger`,children:[`−`,o??0]})]})]}):null,`·`,t(e.url)?(0,W.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,W.jsx)(D,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,W.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]})}function kt({item:e,subNav:t,changes:n}){return e.kind===`pr`?t?(0,W.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,W.jsx)(it,{to:z(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,W.jsx)(it,{to:z(`prs`,t.filter,e.number,`/changes`),active:n,children:`Changes`})]}):(0,W.jsx)(V,{to:z(`prs`,null,e.number,`/changes`),"data-slot":`gh-files-changed`,className:`mt-3 inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground hover:underline`,children:`Files changed`}):null}function At({item:e,colors:t,checks:n}){return e.labels.length>0||n?(0,W.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,W.jsx)(wt,{label:e,color:t[e]},e)),n?(0,W.jsx)(Xt,{checks:n,url:e.url}):null]}):null}function jt({item:e,colors:t,body:n}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:n?(0,W.jsx)($e,{children:n}):(0,W.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,W.jsx)(Pt,{item:e,colors:t})]})}function Mt({item:e,colors:t,checks:n,comments:r,backLink:i,subNav:a,onRunAgent:o,afterHeading:s,children:c}){let l=a?.changes??!1,u=Tt(e.kind),d=y(e.kind,e.number,!l).data?.detail,f=d?.body??e.body,p=d?.additions??e.additions,m=d?.deletions??e.deletions,h=Et(e.kind,p,m),g=r??e.comments;return(0,W.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,W.jsx)(Dt,{backLink:i}),(0,W.jsxs)(`div`,{"data-slot":`gh-description-card`,className:e.kind===`pr`?`rounded-xl border border-border bg-card p-6`:void 0,children:[e.kind===`pr`?(0,W.jsxs)(`h2`,{className:`mb-4 text-[22px] leading-snug font-normal`,children:[`#`,e.number,` `,e.title]}):null,(0,W.jsx)(Ot,{item:e,kindWord:u,commentCount:g,hasDiffStat:h,additions:p,deletions:m}),e.kind===`pr`?null:(0,W.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-normal`,children:e.title}),s,(0,W.jsx)(kt,{item:e,subNav:a,changes:l}),(0,W.jsx)(At,{item:e,colors:t,checks:n}),l&&e.kind===`pr`?(0,W.jsx)(Nt,{item:e}):(0,W.jsx)(jt,{item:e,colors:t,body:f})]}),e.kind===`pr`?(0,W.jsx)(bt,{number:e.number,onRunAgent:o}):null,c]})}function Nt({item:e}){let i=s(),a=_(e.number),[o,c]=(0,U.useState)(``),[u,d]=(0,U.useState)(null),f=a.data,p=f?.available?f.files.filter(e=>e.path.toLowerCase().includes(o.toLowerCase())):[],m=p.findIndex(e=>e.path===u);(0,U.useEffect)(()=>{p.length>0&&!p.some(e=>e.path===u)&&d(p[0].path)},[f?.available?f.headSha:``,o]);let h=async()=>{let t=f?.available?f.headSha:null,n=x.githubPrChanges(e.number),r=await l(e.number,{refresh:!0});i.setQueryData(n,r),r.available&&t&&t!==r.headSha&&(d(r.files[0]?.path??null),A(`The reviewed revision changed.`))};if(a.isPending)return(0,W.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(a.isError||!f)return(0,W.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!f.available)return(0,W.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:f.reason});let g=p.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),v=t(e.url)?`${e.url}/files`:null,y=p.find(e=>e.path===u);return(0,W.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,W.jsxs)(`strong`,{children:[f.files.length,` changed files`]}),(0,W.jsxs)(`span`,{className:`text-success`,children:[`+`,f.additions]}),(0,W.jsxs)(`span`,{className:`text-danger`,children:[`−`,f.deletions]}),(0,W.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:f.headSha,children:[`head `,f.headSha.slice(0,8)]}),(0,W.jsx)(n,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void h(),children:`Refresh`})]}),f.truncated?(0,W.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[f.reason??`This response is incomplete.`,` `,v?(0,W.jsx)(`a`,{href:v,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,W.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,W.jsxs)(`aside`,{className:`min-w-0`,children:[(0,W.jsx)(`input`,{"aria-label":`Filter changed files`,value:o,onChange:e=>c(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,W.jsx)(`select`,{"aria-label":`Select changed file`,value:u??``,onChange:e=>d(e.target.value),className:`mt-2 min-h-11 w-full rounded-md border border-input bg-background px-2 text-sm lg:hidden`,children:p.map(e=>(0,W.jsx)(`option`,{children:e.path},e.path))}),(0,W.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:p.map(e=>(0,W.jsx)(`li`,{children:(0,W.jsxs)(`button`,{type:`button`,onClick:()=>d(e.path),className:r(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,u===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,W.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,W.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,W.jsx)(n,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:m<=0,onClick:()=>d(p[m-1]?.path??null),children:(0,W.jsx)(nt,{})}),(0,W.jsx)(n,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:m<0||m>=p.length-1,onClick:()=>d(p[m+1]?.path??null),children:(0,W.jsx)(F,{size:16})})]}),p.length===0?(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(rt,{files:g.filter(e=>e.path===u),wrap:!0,className:`min-w-0`}),y&&!y.patch?(0,W.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,y.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Pt({item:e,colors:t}){let n=y(e.kind,e.number),r=n.data,i=(0,U.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(Ft(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,W.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,W.jsx)(B,{className:`mb-3 h-3 w-24`}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsx)(B,{className:`h-14 w-full`}),(0,W.jsx)(B,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,W.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,W.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,W.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,W.jsx)(D,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,W.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,W.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-soft-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,W.jsx)(`ul`,{className:`flex flex-col gap-5`,children:It(i).map(e=>e.group===`commits`?(0,W.jsx)(Lt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,W.jsx)(qt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,W.jsx)(Rt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,W.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-soft-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,W.jsx)(D,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var Ft=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function It(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function Lt({commits:e,colors:t}){let[n,r]=(0,U.useState)(!1),i=e[0]?.actor??`?`;return n?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,W.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,children:J.committed}),(0,W.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,W.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,W.jsx)(Rt,{event:e,colors:t},e.id))]}):(0,W.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,W.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,children:J.committed}),(0,W.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,W.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,W.jsx)(`span`,{className:`shrink-0`,children:R(e[e.length-1].createdAt)})]})})}var J={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Rt({event:e,colors:t}){return(0,W.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:r(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:J[e.kind]}),(0,W.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,W.jsx)(Wt,{event:e,colors:t}),(0,W.jsx)(`span`,{className:`shrink-0`,children:R(e.createdAt)}),e.url?(0,W.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,W.jsx)(D,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function zt({event:e}){return(0,W.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,W.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,W.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,W.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,W.jsx)(Gt,{checks:e.checks})]})}function Bt({event:e,colors:t}){return(0,W.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,W.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,W.jsx)(`span`,{"data-slot":`gh-event-label`,style:q(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[12px]`,children:e.label.name}):null,(0,W.jsx)(`span`,{className:`shrink-0`,children:`label`})]})}function Vt({event:e}){return(0,W.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Ht({event:e}){return(0,W.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var Ut={committed:e=>(0,W.jsx)(zt,{event:e}),labeled:(e,t)=>(0,W.jsx)(Bt,{event:e,colors:t}),unlabeled:(e,t)=>(0,W.jsx)(Bt,{event:e,colors:t}),assigned:e=>(0,W.jsx)(Vt,{event:e}),unassigned:e=>(0,W.jsx)(Vt,{event:e}),merged:()=>(0,W.jsx)(`span`,{children:`merged this`}),closed:()=>(0,W.jsx)(`span`,{children:`closed this`}),reopened:()=>(0,W.jsx)(`span`,{children:`reopened this`}),head_ref_force_pushed:()=>(0,W.jsx)(`span`,{children:`force-pushed`}),renamed:e=>(0,W.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]}),"cross-referenced":e=>(0,W.jsx)(Ht,{event:e})};function Wt({event:e,colors:t}){return Ut[e.kind]?.(e,t)??null}function Gt({checks:e}){return e?(0,W.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:r(`shrink-0`,X[e]),children:Y[e]}):null}var Kt={approved:{label:`approved`,tone:`border-success/40 text-success`},changes_requested:{label:`changes requested`,tone:`border-danger/40 text-danger`},commented:{label:`commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`dismissed`,tone:`border-border text-muted-foreground`}};function qt({comment:e}){let t=e.reviewState?Kt[e.reviewState]:null;return(0,W.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,W.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,W.jsx)(Jt,{url:e.avatarUrl,login:e.author}),(0,W.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,W.jsx)(`span`,{children:R(e.createdAt)}),t?(0,W.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:r(`rounded-full border px-1.5 py-px font-sans text-[12px] font-medium`,t.tone),children:t.label}):null,(0,W.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,W.jsx)(D,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,W.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,W.jsx)($e,{children:e.body}):(0,W.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function Jt({url:e,login:t}){let[n,r]=(0,U.useState)(!1);return e&&!n?(0,W.jsx)(`img`,{src:e,alt:``,width:16,height:16,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-4 shrink-0 rounded-full`}):(0,W.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var Y={passing:`✓`,failing:`✗`,pending:`○`},X={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function Yt({count:e}){return e?(0,W.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,W.jsx)(ue,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Xt({checks:e,url:t}){let n=r(`text-[11px] font-medium`,X[e],t&&`hover:underline`),i=`${Y[e]} checks ${e}`;return t?(0,W.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:i}):(0,W.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:i})}function Zt({checks:e}){return(0,W.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:r(`shrink-0 font-sans text-[11px] font-semibold`,X[e]),children:Y[e]})}function Z(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function Qt(e,t=[]){let n=Z(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=$t(t)),n}function $t(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function en(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function tn(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function Q(e,t,n){let r=(n??``).trim();if(!r)return Qt(e,t);let i=Z(e),a=r.startsWith(i)?i+en(r.slice(i.length),e):en(r,e),o=tn(a,e)?a:`${i}\n\n${a}`;return t.length?o+$t(t):o}function nn(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function rn(e,t,n,r,i={}){return t?{...i,workflow:t,task:Q(e,n,r)}:n.length?{...i,steps:nn(n),task:Q(e,[],r)}:{...i,workflow:`quick-task`,task:Q(e,[],r)}}function an(e){let t=m(),n=b(),r=f(t.data),i=n.data?.defaultRunner,a=be(e.runner,r,i??r[0]??`claude`),o=w(a),s=n.data?.modelsLocked===!0,{accounts:c,repoAccount:l}=Ie(),u=c.some(t=>t.provider===a&&t.id===e.account)?e.account:null,d=Oe(s?null:e.model,a,n.data?.defaultModels,o.data),p=Ae(a,d,o.data);return{runner:a,runnerExplicit:e.runner!==null,model:d,effort:s?``:He(e.effort,p),effortOptions:p,runners:r,defaultRunner:i,canRun:t.isSuccess&&r.length>0,modelsLocked:s,providerPending:t.isPending,providerError:t.isError,accounts:c,account:u,repoAccount:l}}function on(e){return{runner:we(e.runner,e.defaultRunner,e.runnerExplicit),model:e.modelsLocked?void 0:e.model||void 0,effort:e.modelsLocked?void 0:e.effort||void 0}}function sn(e){return{...on(e),...e.account?{agentProfile:e.account}:{}}}function cn({pick:e,onChange:t,disabled:n=!1,accounts:r=!1,layout:i}){let a=(0,U.useRef)(null),o=(0,U.useRef)(null),[s,c]=(0,U.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,U.useLayoutEffect)(()=>{let e=a.current;if(i!==`row`||!e)return;let t=()=>{let t=window.innerWidth<=767||e.getBoundingClientRect().width<550,n=document.activeElement;o.current=n instanceof HTMLElement&&e.contains(n)?n:null,c(t)};t();let n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[i]),(0,U.useLayoutEffect)(()=>{let e=o.current;o.current=null,e&&e.isConnected&&document.activeElement!==e&&e.focus()},[s]);let l=an(e),{runner:u,model:d,effort:f,effortOptions:p,runners:m,canRun:h,modelsLocked:g}=l,_=b(),v=w(u),y=De(u,v.data,[e.model,_.data?.defaultModels?.[u]]),x=n||!h,S=r?l.accounts:[],C=m.length>1||m.some(e=>Be(S,e))?(0,W.jsx)(ke,{icon:(0,W.jsx)(re,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:m,value:u,accounts:S,account:r?l.account:null,repoAccount:r?l.repoAccount:void 0,disabled:x,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===u?e.model:null,effort:e.effort}:{runner:n,account:null,model:null,effort:e.effort})},`runner`):null,T=(0,W.jsx)(Re,{icon:(0,W.jsx)(N,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:d===``?`Default`:y.find(e=>e.id===d).label,value:d,disabled:x,readOnly:g===!0,disabledHint:g?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=Ae(u,n,v.data);t({...e,model:n,effort:e.effort===null?null:He(e.effort,r)})},options:y.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Ue(u,v.data,v.isError,v.isFetching)},`model`),E=(0,W.jsx)(Re,{icon:(0,W.jsx)(j,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:p.find(e=>e.value===f)?.label??`auto`,value:f,disabled:x,readOnly:g===!0,disabledHint:g?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,effort:n}),options:p.map(e=>({value:e.value,label:e.label,desc:e.desc}))},`effort`);return i===`row`?(0,W.jsx)(`div`,{ref:a,"data-slot":`engine-row-box`,children:(0,W.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,W.jsx)(Ne,{children:s?[C,E,T]:[C,T,E]})})}):(0,W.jsxs)(Ne,{children:[C,T,E]})}var ln={workflow:null,skills:[]},un=`cez-followup-selection`;function dn(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.filter(e=>typeof e==`string`):[]}}function fn(){try{let e=localStorage.getItem(un);return e?dn(JSON.parse(e)):{...ln}}catch{return{...ln}}}function pn(e){try{localStorage.setItem(un,JSON.stringify(e))}catch{}}var $=`cez-followup-prompt:`;function mn(e){try{return localStorage.getItem($+e)??``}catch{return``}}function hn(e,t){try{t===``?localStorage.removeItem($+e):localStorage.setItem($+e,t)}catch{}}function gn({item:e,workflows:r,skills:i,workflow:a,onWorkflowChange:l,selectedSkills:u,onSkillsChange:d,engine:f,onEngineChange:p,queuedRunId:m,onQueued:h}){let g=s(),_=v(),y=xe(),b=e.kind===`pr`?`PR`:`issue`,C=u.filter(e=>i.some(t=>t.name===e)),[w]=(0,U.useState)(()=>Z(e)),[T,E]=(0,U.useState)(()=>mn(e.url)||w),D=an(f),O=(0,U.useRef)(null),k=(0,U.useRef)(null);(0,U.useEffect)(()=>{hn(e.url,T===w?``:T)},[e.url,T,w]);let j=(0,U.useMemo)(()=>Me(je(_.data?.promptTemplates),{automations:y}),[_.data?.promptTemplates,y]),ee=e=>{let t=O.current,n=Fe({prompt:T,base:w,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:k.current}),r=Ve(T,n,e);E(r.text),k.current=r.caret,requestAnimationFrame(()=>{O.current?.focus(),O.current?.setSelectionRange(r.caret,r.caret)})},M=Pe(j,C),N=(0,U.useRef)(T);N.current=T;let P=(0,U.useRef)(``);(0,U.useEffect)(()=>{let e=Le(N.current,P.current,M,w);P.current=e.applied,e.text!==N.current&&E(e.text)},[M,w]);let F=S({mutationFn:async()=>D.canRun?o(rn(e,a,C,T,sn(D))):null,onSuccess:t=>{if(t===null)return;let n=t;n&&h(e.url,n.id),A(`Added to the queue — ${b} #${e.number}`),C.length>0&&_.data!==void 0&&c({skillUsage:C.reduce((e,t)=>Ye(e,t),_.data.skillUsage)}).then(()=>g.invalidateQueries({queryKey:x.uiState})).catch(()=>{}),hn(e.url,``),E(w),P.current=``,g.invalidateQueries({queryKey:x.runs.all})},onError:e=>A(e.message,{tone:`danger`})}),te=e=>{tt({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),!F.isPending&&D.canRun&&F.mutate())},I=e=>d(u.includes(e)?u.filter(t=>t!==e):[...u,e]);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,W.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,W.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,W.jsx)(`span`,{children:`Instructions for the agent`}),(0,W.jsx)(Ze,{ref:O,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:T,onChange:e=>E(e.target.value),onSelect:e=>{k.current=e.currentTarget.selectionStart},onKeyDown:te,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,W.jsx)(ve,{templates:j,onInsert:ee}),(0,W.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,W.jsxs)(`div`,{className:`gh-field`,children:[(0,W.jsx)(`span`,{children:`Workflow`}),(0,W.jsx)(_n,{workflows:r,value:a,onChange:l})]}),(0,W.jsxs)(`div`,{className:`gh-field`,children:[(0,W.jsx)(`span`,{children:`Skills · select one or more`}),(0,W.jsx)(yn,{skills:i,skillUsage:_.data?.skillUsage,selected:C,onToggle:I})]}),C.length>0?(0,W.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:C.map(e=>(0,W.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>I(e),title:`Remove this skill`,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,W.jsx)(ne,{size:16,"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,W.jsx)(cn,{layout:`row`,pick:f,onChange:p,disabled:F.isPending||!D.canRun,accounts:!0}),(0,W.jsxs)(`div`,{className:`gh-field`,children:[(0,W.jsx)(`span`,{children:`Account`}),(0,W.jsx)(vn,{resolved:D,disabled:F.isPending||!D.canRun,onPick:e=>p({...f,account:e})})]}),!D.providerPending&&!D.canRun?(0,W.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[D.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,W.jsx)(V,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,W.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:[e.kind===`pr`?`PR`:`Issue`,` number and link remain attached to the task. Edit the prompt before starting. Cmd/Ctrl+Enter submits; Enter adds a new line.`]})]}),(0,W.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[t(e.url)?(0,W.jsx)(n,{asChild:!0,variant:`outline`,children:(0,W.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,W.jsxs)(n,{variant:`primary`,"data-action":`gh-run`,disabled:F.isPending||!D.canRun,onClick:()=>F.mutate(),children:[(0,W.jsx)(de,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,b]}),(0,W.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[11px] font-medium text-muted-foreground`,children:et()}),m?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,W.jsx)(L,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,W.jsx)(V,{to:`/tasks/${m}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function _n({workflows:e,value:t,onChange:n}){let[i,a]=(0,U.useState)(!1),[o,s]=(0,U.useState)(``),c=(0,U.useRef)(null),l=Ge(e,o);return(0,W.jsxs)(k,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,W.jsx)(O,{asChild:!0,children:(0,W.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:r(ze,t&&`border-foreground/60 font-mono text-[11px] font-semibold text-foreground`),children:[(0,W.jsx)(te,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,W.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,W.jsx)(oe,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,W.jsx)(E,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,W.jsxs)(Te,{shouldFilter:!1,children:[(0,W.jsx)(Ee,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,W.jsxs)(ye,{ref:c,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,W.jsx)(Se,{children:`Nothing matches.`}):null,(0,W.jsx)(H,{children:l.map(e=>{let r=t===e.name;return(0,W.jsxs)(We,{value:`workflow ${e.name}`,keywords:Ke(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,W.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,W.jsx)(L,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function vn({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:Ce,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,desc:e.configDir}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,W.jsx)(Re,{icon:(0,W.jsx)(se,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),slot:`account-pill`,ariaLabel:`Account`,label:i.find(e=>e.value===a)?.label??`Default`,value:a,options:i,disabled:t,onPick:n})}function yn({skills:e,skillUsage:t,selected:n,onToggle:i}){let[a,o]=(0,U.useState)(!1),[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(null),d=(0,U.useRef)(null),{mostUsed:f,project:p,global:m,ranked:h}=Xe(e,s,t),g=(e,t)=>{let a=n.includes(e.name);return(0,W.jsxs)(We,{value:`skill ${e.name} ${e.path}`,keywords:Ke(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.name,"data-selected":a?`true`:void 0,onSelect:()=>i(e.name),children:[(0,W.jsx)(`span`,{className:r(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,W.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,W.jsx)(ce,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,W.jsx)(L,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.path)};return e.length===0?null:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Qe,{skill:l,onClose:()=>u(null)}),(0,W.jsxs)(k,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,W.jsx)(O,{asChild:!0,children:(0,W.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:r(ze,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,W.jsx)(ae,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,W.jsx)(oe,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,W.jsx)(E,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,W.jsxs)(Te,{shouldFilter:!1,children:[(0,W.jsx)(Ee,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,W.jsxs)(ye,{ref:d,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(h?h.length===0:f.length===0&&p.length===0&&m.length===0)?(0,W.jsx)(Se,{children:`Nothing matches.`}):null,h?h.length>0?(0,W.jsx)(H,{children:h.map(e=>g(e,qe(e)))}):null:(0,W.jsxs)(W.Fragment,{children:[f.length>0?(0,W.jsx)(H,{heading:`Most used`,children:f.map(e=>g(e,qe(e)))}):null,p.length>0?(0,W.jsx)(H,{heading:`Project skills`,children:p.map(e=>g(e,!0))}):null,m.length>0?(0,W.jsx)(H,{heading:`Global`,children:m.map(e=>g(e,!1))}):null]})]})]})})]})]})}var bn=new WeakMap;function xn(){let e=fn(),t={workflow:e.workflow,selectedSkills:e.skills,engine:{runner:null,model:null,effort:null,account:null},queued:new Map},n=new Set;return{snapshot:()=>t,subscribe:e=>(n.add(e),()=>{n.delete(e)}),update:e=>{t={...t,...e},(e.workflow!==void 0||e.selectedSkills!==void 0)&&pn({workflow:t.workflow,skills:[...t.selectedSkills]}),n.forEach(e=>e())}}}function Sn(){let e=s(),{projectId:t}=u(),n=bn.get(e);n||bn.set(e,n=new Map);let r=n.get(t);r||n.set(t,r=xn());let{snapshot:i,subscribe:a,update:o}=r,c=(0,U.useSyncExternalStore)(a,i,i),l=g(),d=h(),f=v(),p=l.data?.workflows;(0,U.useEffect)(()=>{p&&c.workflow!==null&&!p.some(e=>e.name===c.workflow)&&o({workflow:null})},[o,p,c.workflow]);let m=(0,U.useMemo)(()=>Je(d.data??[],f.data?.skillUsage),[d.data,f.data?.skillUsage]);return{...c,workflows:l,skillList:m,setWorkflow:e=>o({workflow:e}),setSelectedSkills:e=>o({selectedSkills:e}),setEngine:e=>o({engine:e}),onQueued:(e,t)=>o({queued:new Map(i().queued).set(e,t)})}}export{Yt as a,It as c,q as d,Ct as f,Zt as i,xt as l,gn as n,Mt as o,Qt as r,wt as s,Sn as t,St as u};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,t as n,u as r}from"./button-DGwhwRuD.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{C as o,Ur as s,en as c,nt as l,r as u,rt as d,yr as f,zt as p}from"./project-scope-context-B0yKt2yI.js";import{$ as m,At as h,Lt as g,M as _,Nt as v,O as y,h as b,n as x,nn as S,nt as C,wt as w}from"./queries-DoYRza8s.js";import{t as T}from"./useQuery-CnVG8NoC.js";import{a as E,et as D,o as O,r as k}from"./use-desktop-BwkqVHep.js";import{n as A}from"./toaster-CoMJoQvk.js";import{A as j,Z as ee,_ as M,b as N,ct as P,d as F,ft as te,h as I,l as L,mt as ne,ot as re,r as ie,rt as ae,u as oe,ut as se}from"./design-icons-DmYTv2r1.js";import{t as ce}from"./eye-B8okNWXU.js";import{a as le,i as R}from"./format-BNCkW110.js";import{t as ue}from"./message-square-B-MD-8rD.js";import{t as de}from"./play-CmVAj_fu.js";import{a as fe,i as pe,o as me,r as he,s as ge,t as _e}from"./dialog-B7p5oc5r.js";import{d as z,t as ve,y as B}from"./prompt-template-menu-DpCrLDWG.js";import{t as V}from"./project-router-BqAKGSaS.js";import{B as ye,E as be,G as xe,I as Se,L as H,M as Ce,O as we,P as Te,R as Ee,S as De,T as Oe,a as ke,b as Ae,f as je,h as Me,i as Ne,l as Pe,m as Fe,n as Ie,p as Le,r as Re,s as ze,t as Be,u as Ve,w as He,x as Ue,z as We}from"./agent-accounts-D3q1WLxk.js";import{d as Ge,f as Ke,i as qe,s as Je,t as Ye,u as Xe}from"./skills-DFBiAuJG.js";import{$ as Ze,F as Qe,L as $e,X as et,Y as tt,pn as nt}from"./index-MgNz22Tg.js";import{t as rt}from"./diff-BDJ4xGSd.js";import{t as it}from"./tab-link-CGzPcVvS.js";var U=e(i(),1),W=a(),at={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function G({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,W.jsx)(L,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:r(t,`text-success`)}):e===`failing`?(0,W.jsx)(M,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:r(t,`text-danger`)}):e===`pending`?(0,W.jsx)(le,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:r(t,`animate-spin text-warning`)}):(0,W.jsx)(I,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:r(t,`text-soft-foreground`)})}function ot(e){return e?.available?e.mergeState:null}function st(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function ct(e){return e.state===`merged`?`Merged`:e.state===`closed`?`Closed`:e.isDraft?`Draft`:e.mergeable===`conflicting`?`Conflicts must be resolved`:e.canMerge?`Ready to merge`:e.eligibility===`unknown`?`Merge blocked · Requirements unknown`:`Merge blocked`}function lt(e){return e===`approved`||e===`not-required`?`passing`:e===`unknown`?`unknown`:`failing`}function ut(e){return e===`mergeable`?`passing`:e===`conflicting`?`failing`:`unknown`}function dt(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function ft(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function pt(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function mt(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function K(e){return e?at[e]:`Merge`}function ht(e){return e===`conflicting`?`true`:void 0}function gt({check:e}){return(0,W.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,W.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(G,{state:e.state}),(0,W.jsxs)(`span`,{children:[e.name,` · `,e.state,ft(e.required)]})]}),e.url&&t(e.url)?(0,W.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function _t({reason:e}){return(0,W.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,W.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:e})]})}function vt({state:e,selectedMethod:t,overrideRules:i,mergeEnabled:a,refreshPending:o,onRefresh:s,onRunAgent:c,onConfirm:l,onMethodChange:u,onOverrideChange:d}){let f=ct(e),p=lt(e.reviewDecision),m=ut(e.mergeable);return(0,W.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,W.jsx)(L,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,W.jsx)(P,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,W.jsx)(`h3`,{className:`font-semibold`,children:f}),(0,W.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,disabled:o,onClick:s,children:[(0,W.jsx)(ee,{size:16,"aria-hidden":`true`,className:r(`size-3.5`,o&&`animate-spin`)}),`Refresh`]})]}),(0,W.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[e.headRef,` (`,e.headSha.slice(0,7),`) → `,e.baseRef]}),(0,W.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,W.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(G,{state:p}),(0,W.jsxs)(`span`,{children:[`Reviews: `,e.reviewDecision.replaceAll(`-`,` `)]})]}),(0,W.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(G,{state:m}),(0,W.jsxs)(`span`,{children:[`Conflicts: `,dt(e.mergeable)]})]}),e.checks.length===0?(0,W.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,W.jsx)(gt,{check:e},e.name)),e.blockers.map(e=>(0,W.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&c?(0,W.jsx)(n,{className:`mt-4`,onClick:c,children:`Run agent on this PR`}):null,e.canOverride?(0,W.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-warning/40 bg-warning/5 p-3 text-xs`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>d(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,W.jsxs)(`span`,{children:[(0,W.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,W.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,e.eligibility===`unknown`?(0,W.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`GitHub could not confirm review and branch-protection requirements. Passing checks do not establish merge readiness.`}):null,e.state===`open`&&e.methods.length>0?(0,W.jsxs)(`div`,{className:`mt-4 flex flex-col flex-wrap gap-2 sm:flex-row`,children:[(0,W.jsx)(`select`,{"aria-label":`Merge method`,value:t??``,onChange:e=>u(e.target.value),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm`,children:e.methods.map(e=>(0,W.jsx)(`option`,{value:e,children:at[e]},e))}),(0,W.jsx)(n,{disabled:!a,onClick:l,children:K(t)})]}):null]})]})}function yt({number:e,state:t,selectedMethod:r,confirming:i,overrideRules:a,mergePending:o,mergeError:s,onOpenChange:c,onMerge:l}){return(0,W.jsx)(_e,{open:i,onOpenChange:c,children:(0,W.jsxs)(he,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,W.jsxs)(me,{children:[(0,W.jsxs)(ge,{children:[K(r),` pull request #`,e,`?`]}),(0,W.jsx)(pe,{asChild:!0,children:(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`p`,{children:[`This will merge “`,t.title,`” into `,t.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),a&&t.canOverride?(0,W.jsx)(`p`,{"data-slot":`gh-bypass-warning`,className:`mt-4 text-sm text-warning`,children:`You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`}):null]})})]}),s?(0,W.jsx)(`p`,{className:`text-sm text-danger`,children:s.message}):null,(0,W.jsxs)(fe,{children:[(0,W.jsx)(n,{variant:`outline`,disabled:o,onClick:()=>c(!1),children:`Cancel`}),(0,W.jsx)(n,{disabled:o,onClick:l,children:o?`Merging…`:K(r)})]})]})})}function bt({number:e,onRunAgent:t}){let n=s(),r=C(),i=T({queryKey:x.githubMergeState(e),queryFn:({signal:t})=>d(e,{},{signal:t}),retry:!1}),a=ot(i.data),[o,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(!1),[f,m]=(0,U.useState)(!1),h=S({mutationFn:t=>d(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>A(e instanceof Error?e.message:String(e),{tone:`danger`})}),g=st(o,a),_=()=>({mergeState:x.githubMergeState(e),list:x.githubPages(50),comments:x.githubComments(`pr`,e),item:x.githubItem(`pr`,e),refStatus:r===void 0?void 0:x.githubRefStatusOf(r)}),v=S({mutationFn:t=>{if(!a||!g)throw Error(`No merge method is available.`);return p(e,{method:g,expectedHeadSha:a.headSha,...f&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{u(!1),A(`Pull request #${e} merged`),n.invalidateQueries({queryKey:r.mergeState}),n.invalidateQueries({queryKey:r.list}),n.invalidateQueries({queryKey:r.comments}),n.invalidateQueries({queryKey:r.item}),r.refStatus&&n.invalidateQueries({queryKey:r.refStatus})},onError:(e,t)=>{A(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,W.jsx)(B,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,W.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":ht(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,W.jsx)(vt,{state:a,selectedMethod:g,overrideRules:f,mergeEnabled:mt(g,a,f),refreshPending:h.isPending,onRefresh:()=>h.mutate(x.githubMergeState(e)),onRunAgent:t,onConfirm:()=>u(!0),onMethodChange:c,onOverrideChange:m}),(0,W.jsx)(yt,{number:e,state:a,selectedMethod:g,confirming:l,overrideRules:f,mergePending:v.isPending,mergeError:v.error,onOpenChange:u,onMerge:()=>v.mutate(_())})]}):(0,W.jsx)(_t,{reason:pt(i.data)})}function xt(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function St(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))||t.assignees?.length&&!e.assignees?.some(e=>t.assignees.some(t=>t.toLowerCase()===e.toLowerCase()))||t.author!==void 0&&e.author.toLowerCase()!==t.author.toLowerCase()||t.includeNumbers&&!t.includeNumbers.has(e.number)||t.excludeNumbers?.has(e.number)||t.projectId&&e.projectIds!==void 0&&!e.projectIds.includes(t.projectId)?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body??``}`.toLowerCase().includes(n))}function Ct(e,t){let n=e.trim();if(n===``)return!1;let r=n.replace(/^#/,``);return/^\d+$/.test(r)?!t.some(e=>e.number===Number(r)):t.length===0}function q(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}function wt({label:e,color:t,plain:n=!1}){return(0,W.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:q(t),className:n?`text-[11px] font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[12px] font-medium`,children:e})}function Tt(e){return e===`pr`?`pull request`:`issue`}function Et(e,t,n){return e===`pr`&&!!(t||n)}function Dt({backLink:e}){return e?(0,W.jsxs)(V,{to:e.to,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,W.jsx)(ie,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}):null}function Ot({item:e,kindWord:n,commentCount:r,hasDiffStat:i,additions:a,deletions:o}){return(0,W.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,W.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,W.jsx)(`span`,{children:n}),`·`,(0,W.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,W.jsxs)(`span`,{children:[R(e.createdAt),` ago`]}),r?(0,W.jsxs)(W.Fragment,{children:[`·`,(0,W.jsx)(Yt,{count:r})]}):null,i?(0,W.jsxs)(W.Fragment,{children:[`·`,(0,W.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,W.jsxs)(`span`,{className:`text-success`,children:[`+`,a??0]}),` `,(0,W.jsxs)(`span`,{className:`text-danger`,children:[`−`,o??0]})]})]}):null,`·`,t(e.url)?(0,W.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,W.jsx)(D,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,W.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]})}function kt({item:e,subNav:t,changes:n}){return e.kind===`pr`?t?(0,W.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,W.jsx)(it,{to:z(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,W.jsx)(it,{to:z(`prs`,t.filter,e.number,`/changes`),active:n,children:`Changes`})]}):(0,W.jsx)(V,{to:z(`prs`,null,e.number,`/changes`),"data-slot":`gh-files-changed`,className:`mt-3 inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground hover:underline`,children:`Files changed`}):null}function At({item:e,colors:t,checks:n}){return e.labels.length>0||n?(0,W.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,W.jsx)(wt,{label:e,color:t[e]},e)),n?(0,W.jsx)(Xt,{checks:n,url:e.url}):null]}):null}function jt({item:e,colors:t,body:n}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:n?(0,W.jsx)($e,{children:n}):(0,W.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,W.jsx)(Pt,{item:e,colors:t})]})}function Mt({item:e,colors:t,checks:n,comments:r,backLink:i,subNav:a,onRunAgent:o,afterHeading:s,children:c}){let l=a?.changes??!1,u=Tt(e.kind),d=y(e.kind,e.number,!l).data?.detail,f=d?.body??e.body,p=d?.additions??e.additions,m=d?.deletions??e.deletions,h=Et(e.kind,p,m),g=r??e.comments;return(0,W.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,W.jsx)(Dt,{backLink:i}),(0,W.jsxs)(`div`,{"data-slot":`gh-description-card`,className:e.kind===`pr`?`rounded-xl border border-border bg-card p-6`:void 0,children:[e.kind===`pr`?(0,W.jsxs)(`h2`,{className:`mb-4 text-[22px] leading-snug font-normal`,children:[`#`,e.number,` `,e.title]}):null,(0,W.jsx)(Ot,{item:e,kindWord:u,commentCount:g,hasDiffStat:h,additions:p,deletions:m}),e.kind===`pr`?null:(0,W.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-normal`,children:e.title}),s,(0,W.jsx)(kt,{item:e,subNav:a,changes:l}),(0,W.jsx)(At,{item:e,colors:t,checks:n}),l&&e.kind===`pr`?(0,W.jsx)(Nt,{item:e}):(0,W.jsx)(jt,{item:e,colors:t,body:f})]}),e.kind===`pr`?(0,W.jsx)(bt,{number:e.number,onRunAgent:o}):null,c]})}function Nt({item:e}){let i=s(),a=_(e.number),[o,c]=(0,U.useState)(``),[u,d]=(0,U.useState)(null),f=a.data,p=f?.available?f.files.filter(e=>e.path.toLowerCase().includes(o.toLowerCase())):[],m=p.findIndex(e=>e.path===u);(0,U.useEffect)(()=>{p.length>0&&!p.some(e=>e.path===u)&&d(p[0].path)},[f?.available?f.headSha:``,o]);let h=async()=>{let t=f?.available?f.headSha:null,n=x.githubPrChanges(e.number),r=await l(e.number,{refresh:!0});i.setQueryData(n,r),r.available&&t&&t!==r.headSha&&(d(r.files[0]?.path??null),A(`The reviewed revision changed.`))};if(a.isPending)return(0,W.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(a.isError||!f)return(0,W.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!f.available)return(0,W.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:f.reason});let g=p.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),v=t(e.url)?`${e.url}/files`:null,y=p.find(e=>e.path===u);return(0,W.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,W.jsxs)(`strong`,{children:[f.files.length,` changed files`]}),(0,W.jsxs)(`span`,{className:`text-success`,children:[`+`,f.additions]}),(0,W.jsxs)(`span`,{className:`text-danger`,children:[`−`,f.deletions]}),(0,W.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:f.headSha,children:[`head `,f.headSha.slice(0,8)]}),(0,W.jsx)(n,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void h(),children:`Refresh`})]}),f.truncated?(0,W.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[f.reason??`This response is incomplete.`,` `,v?(0,W.jsx)(`a`,{href:v,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,W.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,W.jsxs)(`aside`,{className:`min-w-0`,children:[(0,W.jsx)(`input`,{"aria-label":`Filter changed files`,value:o,onChange:e=>c(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,W.jsx)(`select`,{"aria-label":`Select changed file`,value:u??``,onChange:e=>d(e.target.value),className:`mt-2 min-h-11 w-full rounded-md border border-input bg-background px-2 text-sm lg:hidden`,children:p.map(e=>(0,W.jsx)(`option`,{children:e.path},e.path))}),(0,W.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:p.map(e=>(0,W.jsx)(`li`,{children:(0,W.jsxs)(`button`,{type:`button`,onClick:()=>d(e.path),className:r(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,u===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,W.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,W.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,W.jsx)(n,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:m<=0,onClick:()=>d(p[m-1]?.path??null),children:(0,W.jsx)(nt,{})}),(0,W.jsx)(n,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:m<0||m>=p.length-1,onClick:()=>d(p[m+1]?.path??null),children:(0,W.jsx)(F,{size:16})})]}),p.length===0?(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(rt,{files:g.filter(e=>e.path===u),wrap:!0,className:`min-w-0`}),y&&!y.patch?(0,W.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,y.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Pt({item:e,colors:t}){let n=y(e.kind,e.number),r=n.data,i=(0,U.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(Ft(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,W.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,W.jsx)(B,{className:`mb-3 h-3 w-24`}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsx)(B,{className:`h-14 w-full`}),(0,W.jsx)(B,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,W.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,W.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,W.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,W.jsx)(D,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,W.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,W.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-soft-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,W.jsx)(`ul`,{className:`flex flex-col gap-5`,children:It(i).map(e=>e.group===`commits`?(0,W.jsx)(Lt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,W.jsx)(qt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,W.jsx)(Rt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,W.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-soft-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,W.jsx)(D,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var Ft=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function It(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function Lt({commits:e,colors:t}){let[n,r]=(0,U.useState)(!1),i=e[0]?.actor??`?`;return n?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,W.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,children:J.committed}),(0,W.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,W.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,W.jsx)(Rt,{event:e,colors:t},e.id))]}):(0,W.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,W.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,children:J.committed}),(0,W.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,W.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,W.jsx)(`span`,{className:`shrink-0`,children:R(e[e.length-1].createdAt)})]})})}var J={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Rt({event:e,colors:t}){return(0,W.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:r(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:J[e.kind]}),(0,W.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,W.jsx)(Wt,{event:e,colors:t}),(0,W.jsx)(`span`,{className:`shrink-0`,children:R(e.createdAt)}),e.url?(0,W.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,W.jsx)(D,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function zt({event:e}){return(0,W.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,W.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,W.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,W.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,W.jsx)(Gt,{checks:e.checks})]})}function Bt({event:e,colors:t}){return(0,W.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,W.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,W.jsx)(`span`,{"data-slot":`gh-event-label`,style:q(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[12px]`,children:e.label.name}):null,(0,W.jsx)(`span`,{className:`shrink-0`,children:`label`})]})}function Vt({event:e}){return(0,W.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Ht({event:e}){return(0,W.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var Ut={committed:e=>(0,W.jsx)(zt,{event:e}),labeled:(e,t)=>(0,W.jsx)(Bt,{event:e,colors:t}),unlabeled:(e,t)=>(0,W.jsx)(Bt,{event:e,colors:t}),assigned:e=>(0,W.jsx)(Vt,{event:e}),unassigned:e=>(0,W.jsx)(Vt,{event:e}),merged:()=>(0,W.jsx)(`span`,{children:`merged this`}),closed:()=>(0,W.jsx)(`span`,{children:`closed this`}),reopened:()=>(0,W.jsx)(`span`,{children:`reopened this`}),head_ref_force_pushed:()=>(0,W.jsx)(`span`,{children:`force-pushed`}),renamed:e=>(0,W.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]}),"cross-referenced":e=>(0,W.jsx)(Ht,{event:e})};function Wt({event:e,colors:t}){return Ut[e.kind]?.(e,t)??null}function Gt({checks:e}){return e?(0,W.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:r(`shrink-0`,X[e]),children:Y[e]}):null}var Kt={approved:{label:`approved`,tone:`border-success/40 text-success`},changes_requested:{label:`changes requested`,tone:`border-danger/40 text-danger`},commented:{label:`commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`dismissed`,tone:`border-border text-muted-foreground`}};function qt({comment:e}){let t=e.reviewState?Kt[e.reviewState]:null;return(0,W.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,W.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,W.jsx)(Jt,{url:e.avatarUrl,login:e.author}),(0,W.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,W.jsx)(`span`,{children:R(e.createdAt)}),t?(0,W.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:r(`rounded-full border px-1.5 py-px font-sans text-[12px] font-medium`,t.tone),children:t.label}):null,(0,W.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,W.jsx)(D,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,W.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,W.jsx)($e,{children:e.body}):(0,W.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function Jt({url:e,login:t}){let[n,r]=(0,U.useState)(!1);return e&&!n?(0,W.jsx)(`img`,{src:e,alt:``,width:16,height:16,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-4 shrink-0 rounded-full`}):(0,W.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var Y={passing:`✓`,failing:`✗`,pending:`○`},X={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function Yt({count:e}){return e?(0,W.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,W.jsx)(ue,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Xt({checks:e,url:t}){let n=r(`text-[11px] font-medium`,X[e],t&&`hover:underline`),i=`${Y[e]} checks ${e}`;return t?(0,W.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:i}):(0,W.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:i})}function Zt({checks:e}){return(0,W.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:r(`shrink-0 font-sans text-[11px] font-semibold`,X[e]),children:Y[e]})}function Z(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function Qt(e,t=[]){let n=Z(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=$t(t)),n}function $t(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function en(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function tn(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function Q(e,t,n){let r=(n??``).trim();if(!r)return Qt(e,t);let i=Z(e),a=r.startsWith(i)?i+en(r.slice(i.length),e):en(r,e),o=tn(a,e)?a:`${i}\n\n${a}`;return t.length?o+$t(t):o}function nn(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function rn(e,t,n,r,i={}){return t?{...i,workflow:t,task:Q(e,n,r)}:n.length?{...i,steps:nn(n),task:Q(e,[],r)}:{...i,workflow:`quick-task`,task:Q(e,[],r)}}function an(e){let t=m(),n=b(),r=f(t.data),i=n.data?.defaultRunner,a=be(e.runner,r,i??r[0]??`claude`),o=w(a),s=n.data?.modelsLocked===!0,{accounts:c,repoAccount:l}=Ie(),u=c.some(t=>t.provider===a&&t.id===e.account)?e.account:null,d=Oe(s?null:e.model,a,n.data?.defaultModels,o.data),p=Ae(a,d,o.data);return{runner:a,runnerExplicit:e.runner!==null,model:d,effort:s?``:He(e.effort,p),effortOptions:p,runners:r,defaultRunner:i,canRun:t.isSuccess&&r.length>0,modelsLocked:s,providerPending:t.isPending,providerError:t.isError,accounts:c,account:u,repoAccount:l}}function on(e){return{runner:we(e.runner,e.defaultRunner,e.runnerExplicit),model:e.modelsLocked?void 0:e.model||void 0,effort:e.modelsLocked?void 0:e.effort||void 0}}function sn(e){return{...on(e),...e.account?{agentProfile:e.account}:{}}}function cn({pick:e,onChange:t,disabled:n=!1,accounts:r=!1,layout:i}){let a=(0,U.useRef)(null),o=(0,U.useRef)(null),[s,c]=(0,U.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,U.useLayoutEffect)(()=>{let e=a.current;if(i!==`row`||!e)return;let t=()=>{let t=window.innerWidth<=767||e.getBoundingClientRect().width<550,n=document.activeElement;o.current=n instanceof HTMLElement&&e.contains(n)?n:null,c(t)};t();let n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[i]),(0,U.useLayoutEffect)(()=>{let e=o.current;o.current=null,e&&e.isConnected&&document.activeElement!==e&&e.focus()},[s]);let l=an(e),{runner:u,model:d,effort:f,effortOptions:p,runners:m,canRun:h,modelsLocked:g}=l,_=b(),v=w(u),y=De(u,v.data,[e.model,_.data?.defaultModels?.[u]]),x=n||!h,S=r?l.accounts:[],C=m.length>1||m.some(e=>Be(S,e))?(0,W.jsx)(ke,{icon:(0,W.jsx)(re,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:m,value:u,accounts:S,account:r?l.account:null,repoAccount:r?l.repoAccount:void 0,disabled:x,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===u?e.model:null,effort:e.effort}:{runner:n,account:null,model:null,effort:e.effort})},`runner`):null,T=(0,W.jsx)(Re,{icon:(0,W.jsx)(N,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:d===``?`Default`:y.find(e=>e.id===d).label,value:d,disabled:x,readOnly:g===!0,disabledHint:g?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=Ae(u,n,v.data);t({...e,model:n,effort:e.effort===null?null:He(e.effort,r)})},options:y.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Ue(u,v.data,v.isError,v.isFetching)},`model`),E=(0,W.jsx)(Re,{icon:(0,W.jsx)(j,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:p.find(e=>e.value===f)?.label??`auto`,value:f,disabled:x,readOnly:g===!0,disabledHint:g?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,effort:n}),options:p.map(e=>({value:e.value,label:e.label,desc:e.desc}))},`effort`);return i===`row`?(0,W.jsx)(`div`,{ref:a,"data-slot":`engine-row-box`,children:(0,W.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,W.jsx)(Ne,{children:s?[C,E,T]:[C,T,E]})})}):(0,W.jsxs)(Ne,{children:[C,T,E]})}var ln={workflow:null,skills:[]},un=`cez-followup-selection`;function dn(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.filter(e=>typeof e==`string`):[]}}function fn(){try{let e=localStorage.getItem(un);return e?dn(JSON.parse(e)):{...ln}}catch{return{...ln}}}function pn(e){try{localStorage.setItem(un,JSON.stringify(e))}catch{}}var $=`cez-followup-prompt:`;function mn(e){try{return localStorage.getItem($+e)??``}catch{return``}}function hn(e,t){try{t===``?localStorage.removeItem($+e):localStorage.setItem($+e,t)}catch{}}function gn({item:e,workflows:r,skills:i,workflow:a,onWorkflowChange:l,selectedSkills:u,onSkillsChange:d,engine:f,onEngineChange:p,queuedRunId:m,onQueued:h}){let g=s(),_=v(),y=xe(),b=e.kind===`pr`?`PR`:`issue`,C=u.filter(e=>i.some(t=>t.name===e)),[w]=(0,U.useState)(()=>Z(e)),[T,E]=(0,U.useState)(()=>mn(e.url)||w),D=an(f),O=(0,U.useRef)(null),k=(0,U.useRef)(null);(0,U.useEffect)(()=>{hn(e.url,T===w?``:T)},[e.url,T,w]);let j=(0,U.useMemo)(()=>Me(je(_.data?.promptTemplates),{automations:y}),[_.data?.promptTemplates,y]),ee=e=>{let t=O.current,n=Fe({prompt:T,base:w,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:k.current}),r=Ve(T,n,e);E(r.text),k.current=r.caret,requestAnimationFrame(()=>{O.current?.focus(),O.current?.setSelectionRange(r.caret,r.caret)})},M=Pe(j,C),N=(0,U.useRef)(T);N.current=T;let P=(0,U.useRef)(``);(0,U.useEffect)(()=>{let e=Le(N.current,P.current,M,w);P.current=e.applied,e.text!==N.current&&E(e.text)},[M,w]);let F=S({mutationFn:async()=>D.canRun?o(rn(e,a,C,T,sn(D))):null,onSuccess:t=>{if(t===null)return;let n=t;n&&h(e.url,n.id),A(`Added to the queue — ${b} #${e.number}`),C.length>0&&_.data!==void 0&&c({skillUsage:C.reduce((e,t)=>Ye(e,t),_.data.skillUsage)}).then(()=>g.invalidateQueries({queryKey:x.uiState})).catch(()=>{}),hn(e.url,``),E(w),P.current=``,g.invalidateQueries({queryKey:x.runs.all})},onError:e=>A(e.message,{tone:`danger`})}),te=e=>{tt({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),!F.isPending&&D.canRun&&F.mutate())},I=e=>d(u.includes(e)?u.filter(t=>t!==e):[...u,e]);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,W.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,W.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,W.jsx)(`span`,{children:`Instructions for the agent`}),(0,W.jsx)(Ze,{ref:O,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:T,onChange:e=>E(e.target.value),onSelect:e=>{k.current=e.currentTarget.selectionStart},onKeyDown:te,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,W.jsx)(ve,{templates:j,onInsert:ee}),(0,W.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,W.jsxs)(`div`,{className:`gh-field`,children:[(0,W.jsx)(`span`,{children:`Workflow`}),(0,W.jsx)(_n,{workflows:r,value:a,onChange:l})]}),(0,W.jsxs)(`div`,{className:`gh-field`,children:[(0,W.jsx)(`span`,{children:`Skills · select one or more`}),(0,W.jsx)(yn,{skills:i,skillUsage:_.data?.skillUsage,selected:C,onToggle:I})]}),C.length>0?(0,W.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:C.map(e=>(0,W.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>I(e),title:`Remove this skill`,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,W.jsx)(ne,{size:16,"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,W.jsx)(cn,{layout:`row`,pick:f,onChange:p,disabled:F.isPending||!D.canRun,accounts:!0}),(0,W.jsxs)(`div`,{className:`gh-field`,children:[(0,W.jsx)(`span`,{children:`Account`}),(0,W.jsx)(vn,{resolved:D,disabled:F.isPending||!D.canRun,onPick:e=>p({...f,account:e})})]}),!D.providerPending&&!D.canRun?(0,W.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[D.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,W.jsx)(V,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,W.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:[e.kind===`pr`?`PR`:`Issue`,` number and link remain attached to the task. Edit the prompt before starting. Cmd/Ctrl+Enter submits; Enter adds a new line.`]})]}),(0,W.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[t(e.url)?(0,W.jsx)(n,{asChild:!0,variant:`outline`,children:(0,W.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,W.jsxs)(n,{variant:`primary`,"data-action":`gh-run`,disabled:F.isPending||!D.canRun,onClick:()=>F.mutate(),children:[(0,W.jsx)(de,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,b]}),(0,W.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[11px] font-medium text-muted-foreground`,children:et()}),m?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,W.jsx)(L,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,W.jsx)(V,{to:`/tasks/${m}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function _n({workflows:e,value:t,onChange:n}){let[i,a]=(0,U.useState)(!1),[o,s]=(0,U.useState)(``),c=(0,U.useRef)(null),l=Ge(e,o);return(0,W.jsxs)(k,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,W.jsx)(O,{asChild:!0,children:(0,W.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:r(ze,t&&`border-foreground/60 font-mono text-[11px] font-semibold text-foreground`),children:[(0,W.jsx)(te,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,W.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,W.jsx)(oe,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,W.jsx)(E,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,W.jsxs)(Te,{shouldFilter:!1,children:[(0,W.jsx)(Ee,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,W.jsxs)(ye,{ref:c,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,W.jsx)(Se,{children:`Nothing matches.`}):null,(0,W.jsx)(H,{children:l.map(e=>{let r=t===e.name;return(0,W.jsxs)(We,{value:`workflow ${e.name}`,keywords:Ke(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,W.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,W.jsx)(L,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function vn({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:Ce,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,desc:e.configDir}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,W.jsx)(Re,{icon:(0,W.jsx)(se,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),slot:`account-pill`,ariaLabel:`Account`,label:i.find(e=>e.value===a)?.label??`Default`,value:a,options:i,disabled:t,onPick:n})}function yn({skills:e,skillUsage:t,selected:n,onToggle:i}){let[a,o]=(0,U.useState)(!1),[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(null),d=(0,U.useRef)(null),{mostUsed:f,project:p,global:m,ranked:h}=Xe(e,s,t),g=(e,t)=>{let a=n.includes(e.name);return(0,W.jsxs)(We,{value:`skill ${e.name} ${e.path}`,keywords:Ke(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.name,"data-selected":a?`true`:void 0,onSelect:()=>i(e.name),children:[(0,W.jsx)(`span`,{className:r(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,W.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,W.jsx)(ce,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,W.jsx)(L,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.path)};return e.length===0?null:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Qe,{skill:l,onClose:()=>u(null)}),(0,W.jsxs)(k,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,W.jsx)(O,{asChild:!0,children:(0,W.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:r(ze,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,W.jsx)(ae,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,W.jsx)(oe,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,W.jsx)(E,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,W.jsxs)(Te,{shouldFilter:!1,children:[(0,W.jsx)(Ee,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,W.jsxs)(ye,{ref:d,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(h?h.length===0:f.length===0&&p.length===0&&m.length===0)?(0,W.jsx)(Se,{children:`Nothing matches.`}):null,h?h.length>0?(0,W.jsx)(H,{children:h.map(e=>g(e,qe(e)))}):null:(0,W.jsxs)(W.Fragment,{children:[f.length>0?(0,W.jsx)(H,{heading:`Most used`,children:f.map(e=>g(e,qe(e)))}):null,p.length>0?(0,W.jsx)(H,{heading:`Project skills`,children:p.map(e=>g(e,!0))}):null,m.length>0?(0,W.jsx)(H,{heading:`Global`,children:m.map(e=>g(e,!1))}):null]})]})]})})]})]})}var bn=new WeakMap;function xn(){let e=fn(),t={workflow:e.workflow,selectedSkills:e.skills,engine:{runner:null,model:null,effort:null,account:null},queued:new Map},n=new Set;return{snapshot:()=>t,subscribe:e=>(n.add(e),()=>{n.delete(e)}),update:e=>{t={...t,...e},(e.workflow!==void 0||e.selectedSkills!==void 0)&&pn({workflow:t.workflow,skills:[...t.selectedSkills]}),n.forEach(e=>e())}}}function Sn(){let e=s(),{projectId:t}=u(),n=bn.get(e);n||bn.set(e,n=new Map);let r=n.get(t);r||n.set(t,r=xn());let{snapshot:i,subscribe:a,update:o}=r,c=(0,U.useSyncExternalStore)(a,i,i),l=g(),d=h(),f=v(),p=l.data?.workflows;(0,U.useEffect)(()=>{p&&c.workflow!==null&&!p.some(e=>e.name===c.workflow)&&o({workflow:null})},[o,p,c.workflow]);let m=(0,U.useMemo)(()=>Je(d.data??[],f.data?.skillUsage),[d.data,f.data?.skillUsage]);return{...c,workflows:l,skillList:m,setWorkflow:e=>o({workflow:e}),setSelectedSkills:e=>o({selectedSkills:e}),setEngine:e=>o({engine:e}),onQueued:(e,t)=>o({queued:new Map(i().queued).set(e,t)})}}export{Yt as a,It as c,q as d,Ct as f,Zt as i,xt as l,gn as n,Mt as o,Qt as r,wt as s,Sn as t,St as u};
@@ -1 +1 @@
1
- import{Kr as e,Nr as t,Wr as n,qr as r}from"./project-scope-context-0Z0nsheq.js";var i=class extends n{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(t,n){let{state:i}=t,a=super.createResult(t,n),{isFetching:o,isRefetching:s,isError:c,isRefetchError:l}=a,u=i.fetchMeta?.fetchMore?.direction,d=c&&u===`forward`,f=o&&u===`forward`,p=c&&u===`backward`,m=o&&u===`backward`;return{...a,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:e(n,i.data),hasPreviousPage:r(n,i.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:s&&!f&&!m}}};function a(e,n){return t(e,i,n)}export{a as t};
1
+ import{Kr as e,Nr as t,Wr as n,qr as r}from"./project-scope-context-B0yKt2yI.js";var i=class extends n{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(t,n){let{state:i}=t,a=super.createResult(t,n),{isFetching:o,isRefetching:s,isError:c,isRefetchError:l}=a,u=i.fetchMeta?.fetchMore?.direction,d=c&&u===`forward`,f=o&&u===`forward`,p=c&&u===`backward`,m=o&&u===`backward`;return{...a,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:e(n,i.data),hasPreviousPage:r(n,i.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:s&&!f&&!m}}};function a(e,n){return t(e,i,n)}export{a as t};