@wjarka/cezarion 0.18.0-dev.5863 → 0.18.0-dev.5872

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 (82) hide show
  1. package/package.json +2 -2
  2. package/web/dist/assets/activity-motion-Dj3dlCYS.js +2 -0
  3. package/web/dist/assets/{activity-route-1OFUVP3A.js → activity-route-CpjbEhk_.js} +1 -1
  4. package/web/dist/assets/{alert-dialog-Dj464rjk.js → alert-dialog-h-3h9B4l.js} +1 -1
  5. package/web/dist/assets/button-CS5tOblf.js +3 -0
  6. package/web/dist/assets/{centered-state-DGyy0SuA.js → centered-state-BmsqxbI8.js} +1 -1
  7. package/web/dist/assets/commit-diff-panel-DGx2t9Pw.js +1 -0
  8. package/web/dist/assets/{control-locations-C9II3kPz.js → control-locations-CD2r0mMU.js} +1 -1
  9. package/web/dist/assets/{diff-controls-BR2uqhwG.js → diff-controls-BHF0Pvdc.js} +1 -1
  10. package/web/dist/assets/diff-qq2vW6Xc.js +3 -0
  11. package/web/dist/assets/{diff-view-BBhxSIlf.js → diff-view-wanjAW5U.js} +5 -5
  12. package/web/dist/assets/{dropdown-menu-DhrBcVgr.js → dropdown-menu-CjLqyqwB.js} +1 -1
  13. package/web/dist/assets/{es2015-D345RR4o.js → es2015-CX0rgbM5.js} +1 -1
  14. package/web/dist/assets/file-preview-YiP5f666.js +2 -0
  15. package/web/dist/assets/format-BNCkW110.js +1 -0
  16. package/web/dist/assets/git-toolbar-D0mTYtOj.js +1 -0
  17. package/web/dist/assets/github-DizdAh0y.js +1 -0
  18. package/web/dist/assets/{global-activity-route-Dt83uvZc.js → global-activity-route-DMbPEZPP.js} +1 -1
  19. package/web/dist/assets/{image-preview-Cq1vDiEo.js → image-preview-Dy3o8upo.js} +1 -1
  20. package/web/dist/assets/index-9YmaiQ1k.css +1 -0
  21. package/web/dist/assets/index-D51Su-nT.js +34 -0
  22. package/web/dist/assets/{live-refetch-BdnmTJ_8.js → live-refetch-C2xZHKkJ.js} +1 -1
  23. package/web/dist/assets/{nav-row-styles-BZUUavOF.js → nav-row-styles-CEA9c88Q.js} +1 -1
  24. package/web/dist/assets/play-CmVAj_fu.js +1 -0
  25. package/web/dist/assets/popover-s-Wchzjn.js +1 -0
  26. package/web/dist/assets/preview-pane-connected-DQYoGd9W.js +3 -0
  27. package/web/dist/assets/{project-router-MMOk9VbW.js → project-router-BLO2IxbU.js} +1 -1
  28. package/web/dist/assets/project-scope-context-DbO9a0ii.js +4 -0
  29. package/web/dist/assets/queries-C_DEjjv2.js +1 -0
  30. package/web/dist/assets/repo-git-CSTwuYJ5.js +1 -0
  31. package/web/dist/assets/report-reader-B8D_6si1.js +1 -0
  32. package/web/dist/assets/reports-Dr312nK-.js +1 -0
  33. package/web/dist/assets/run-header-B8M6-fvb.js +2 -0
  34. package/web/dist/assets/skills-Bz-itxvq.js +1 -0
  35. package/web/dist/assets/{tab-link-BvoGfK8S.js → tab-link-CqVqRhuM.js} +1 -1
  36. package/web/dist/assets/task-changes-6F8fNE6I.js +1 -0
  37. package/web/dist/assets/task-commits-1TKZD8tP.js +1 -0
  38. package/web/dist/assets/task-files-BitTchRw.js +1 -0
  39. package/web/dist/assets/{task-github-item-npfGLu9C.js → task-github-item-ux8yQOHs.js} +1 -1
  40. package/web/dist/assets/{task-thread-DnpkXb5P.js → task-thread-DAnwO8BU.js} +7 -7
  41. package/web/dist/assets/thread-state-COdb27sX.js +4 -0
  42. package/web/dist/assets/{toaster-B1MyeHiE.js → toaster-CRVRHlMR.js} +1 -1
  43. package/web/dist/assets/use-hand-to-agent-state-CZK9cWMq.js +1 -0
  44. package/web/dist/assets/{useInfiniteQuery-BbYMWe23.js → useInfiniteQuery-DCWsxLiy.js} +1 -1
  45. package/web/dist/assets/useQuery-C2HBIY3e.js +1 -0
  46. package/web/dist/assets/workflows-CNnPn5Zx.js +7 -0
  47. package/web/dist/assets/ws-BXdlGFIZ.js +1 -0
  48. package/web/dist/assets/{zoomable-image-5pOUaPEg.js → zoomable-image-UzXCYU7Z.js} +1 -1
  49. package/web/dist/index.html +21 -26
  50. package/web/dist/assets/activity-motion-BdGFmrw-.js +0 -2
  51. package/web/dist/assets/agent-accounts-f1cxwgfz.js +0 -18
  52. package/web/dist/assets/button-CHUAMTHK.js +0 -3
  53. package/web/dist/assets/commit-diff-panel-BiNPMHC6.js +0 -1
  54. package/web/dist/assets/diff-BHwQUS2W.js +0 -3
  55. package/web/dist/assets/file-preview-D08Kq15E.js +0 -2
  56. package/web/dist/assets/git-toolbar-BnOaO_OH.js +0 -1
  57. package/web/dist/assets/github-CXc8nroh.js +0 -1
  58. package/web/dist/assets/github-sidebar-model-B0Ufci5S.js +0 -1
  59. package/web/dist/assets/index-B18AqW0Z.css +0 -1
  60. package/web/dist/assets/index-B5LayM4y.js +0 -14
  61. package/web/dist/assets/loader-circle-CZkGEdoI.js +0 -1
  62. package/web/dist/assets/markdown-D7DUNWcJ.js +0 -6
  63. package/web/dist/assets/popover-DRcRI46x.js +0 -1
  64. package/web/dist/assets/preview-pane-connected-JHeCgq7I.js +0 -3
  65. package/web/dist/assets/project-scope-context-B3M-u8R0.js +0 -4
  66. package/web/dist/assets/queries-DORTKwyN.js +0 -1
  67. package/web/dist/assets/repo-git-wEXDON29.js +0 -1
  68. package/web/dist/assets/report-reader-DJ_0htSx.js +0 -1
  69. package/web/dist/assets/reports-BIXmTBFJ.js +0 -1
  70. package/web/dist/assets/run-header-Bgtlx-vc.js +0 -2
  71. package/web/dist/assets/skills-BJ2nSfyr.js +0 -1
  72. package/web/dist/assets/skills-DFBiAuJG.js +0 -1
  73. package/web/dist/assets/skills-workflows-C21NystW.css +0 -1
  74. package/web/dist/assets/task-changes-Dz0udwrE.js +0 -1
  75. package/web/dist/assets/task-commits-5uILgm5M.js +0 -1
  76. package/web/dist/assets/task-files-DGZjTKSS.js +0 -1
  77. package/web/dist/assets/textarea-DlVUfdWG.js +0 -1
  78. package/web/dist/assets/thread-state-BfrO2t7g.js +0 -4
  79. package/web/dist/assets/use-hand-to-agent-state-DyVB4IBv.js +0 -1
  80. package/web/dist/assets/useQuery-CqqnAJvu.js +0 -1
  81. package/web/dist/assets/workflows-ByduCwgu.js +0 -7
  82. package/web/dist/assets/ws-BtSVmivO.js +0 -1
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{A as t,M as n}from"./button-CS5tOblf.js";import{i as r}from"./react-runtime-CCIEwYL0.js";import{r as i,t as a}from"./live-refetch-C2xZHKkJ.js";import{$ as o,$t as s,At as c,B as l,Bn as u,Br as d,Cn as f,Cr as p,Ct as m,Dn as h,Dt as g,F as _,Fn as v,Ft as y,H as ee,Hr as te,Ht as ne,I as re,It as ie,J as ae,Jt as oe,K as se,Kr as b,L as ce,Lr as le,Lt as ue,M as de,Mt as fe,Nt as pe,On as me,Ot as he,Pt as ge,Q as _e,Qr as ve,R as ye,Rr as be,Sn as xe,St as Se,Tn as Ce,U as we,Ur as Te,V as Ee,Vr as De,Vt as Oe,Wn as ke,Wr as Ae,X as je,Y as Me,Yt as Ne,Z as Pe,Zr as Fe,_ as Ie,_n as Le,_t as Re,at as ze,b as Be,bt as Ve,c as He,ci as Ue,cn as We,ct as Ge,di as Ke,dn as qe,dt as Je,et as Ye,ft as Xe,g as Ze,gt as Qe,ht as $e,i as et,it as tt,j as nt,jt as rt,kr as it,kt as at,ln as ot,lt as st,m as ct,mi as lt,mn as ut,mt as dt,nt as ft,oi as pt,or as x,ot as mt,pt as ht,qr as gt,r as _t,ri as vt,sn as yt,st as bt,ti as xt,tt as St,ui as Ct,un as wt,ut as Tt,v as Et,vn as Dt,vr as Ot,vt as kt,wr as At,wt as jt,x as Mt,xt as Nt,yn as Pt,yt as Ft,z as It,zr as Lt}from"./project-scope-context-DbO9a0ii.js";import{I as S,L as Rt,N as zt,lt as C}from"./live-protocol-BVn0UA_g.js";import{t as Bt}from"./useInfiniteQuery-DCWsxLiy.js";import{t as w}from"./useQuery-C2HBIY3e.js";import{n as Vt,r as T,t as Ht}from"./ws-BXdlGFIZ.js";import{n as Ut}from"./toaster-CRVRHlMR.js";var Wt=class extends Fe{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Gt(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=ve({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),C.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Gt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Kt=class extends lt{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),Ct(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&xt(t.mutationKey)!==xt(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Gt();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){C.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function qt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Jt(e,t,n){let r=e.slice(0);return r[t]=n,r}var Yt=class extends lt{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,C.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!Ct(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(qt(e,n).forEach(e=>{e.destroy()}),qt(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=Ue(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new gt(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Jt(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&C.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},E=e(r(),1);function D({queries:e,...t},n){let r=b(n),i=Ae(),a=Te(),o=E.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{le(e);let t=r.getQueryCache().get(e.queryHash);d(e,a,t)}),te(a);let[s]=E.useState(()=>new Yt(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),f=!i&&t.subscribed!==!1;E.useSyncExternalStore(E.useCallback(e=>f?s.subscribe(C.batchCalls(e)):pt,[s,f]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),E.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let p=c.some((e,t)=>Lt(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&Lt(n,e)?be(n,new gt(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let m=c.find((e,t)=>{let n=o[t];return n&&De({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(m?.error)throw m.error;return l(u())}function O(e,t){let n=b(t),[r]=E.useState(()=>new Kt(n,e));E.useEffect(()=>{r.setOptions(e)},[r,e]);let i=E.useSyncExternalStore(E.useCallback(e=>r.subscribe(C.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=E.useCallback((e,t)=>{r.mutate(e,t).catch(pt)},[r]);if(i.error&&Ke(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function k(e={}){let t=e.projectId??n();return{projectId:t,cacheScope:e.cacheScope??(e.boot?`default`:t)}}function A(e,t={}){return{...k(t),runId:e}}function Xt(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 j=[`workspace`,`runs-index`],M=e=>[e.cacheScope,`runs`,`list`],N=e=>[e.cacheScope,`runs`,`detail`,e.runId],P=e=>typeof e==`function`?e():e;function Zt(e){let{seenAt:t,...n}=e;return n}function Qt(e,t){let n=Zt(e);return t.seenAt===void 0?n:{...n,seenAt:t.seenAt}}function $t(e,t,n){return t?{...e,seenAt:n}:Zt(e)}function en(e){let t=()=>{e.invalidateQueries({queryKey:j})};function r(r,i){if(r===`index`)return t();let a=typeof i==`function`?i():i;if(r===`indexed`){t(),e.invalidateQueries({queryKey:[n(),`runs`]}),e.invalidateQueries({queryKey:[a.projectId,`runs`,`list`]});return}if(r===`runs`)return e.invalidateQueries({queryKey:[a.cacheScope,`runs`]});let o=At(),s=[a.projectId,a.cacheScope],c=o!==void 0&&s.some(e=>e===o||e==="default")?[o,`default`]:[],l=new Set([...s,...c,n()]);return Promise.all([...l].map(t=>e.invalidateQueries({queryKey:[t,`runs`]}))).then(()=>void 0)}async function i(n,r){await e.cancelQueries({queryKey:M(P(n))}),await e.cancelQueries({queryKey:N(P(n))});let i=e.getQueryData(M(P(n))),a=e.getQueryData(N(P(n))),o=P(n).runId,s=new Date().toISOString();return e.setQueryData(M(P(n)),e=>e?.map(e=>e.id===o?$t(e,r,s):e)),e.setQueryData(N(P(n)),e=>e&&$t(e,r,s)),{id:o,prevList:i,prevDetail:a,rollback(){if(!r){i&&e.setQueryData(M(P(n)),i),a&&e.setQueryData(N(P(n)),a);return}let t=i?.find(e=>e.id===o);t&&e.setQueryData(M(P(n)),e=>e?.map(e=>e.id===o?Qt(e,t):e)),a&&e.setQueryData(N(P(n)),e=>e&&Qt(e,a))},settle(i){let a=e=>e.id===(r?o:i.id)?$t(e,r,i.seenAt):e;e.setQueryData(M(P(n)),e=>e?.map(a));let s={...P(n),runId:r?o:i.id};e.setQueryData(N(s),e=>e?a(e):i),t()}}}async function a(t,n){await e.cancelQueries({queryKey:j});let i=e.getQueryData(j),a=n();return e.setQueryData(j,e=>e===void 0?e:{...e,runs:e.runs.map(e=>e.projectId===t.projectId&&e.id===t.runId?a(e):e)}),{previous:i,rollback(){i&&e.setQueryData(j,i)},settle(){r(`indexed`,t)}}}return{patchRead:i,patchIndex:a,invalidateAfter:r}}function F(){let e=b();return(0,E.useMemo)(()=>en(e),[e])}function tn(e){return e.type===`run`?e.run.id:e.id}function I(e,t){return{...e,runs:t}}function nn(e,t){let n=0;for(let r of e)r.projectId===t&&r.archived&&(n+=1);return n}function rn(e,t){let n=e.findIndex(e=>(e.createdAt??``).localeCompare(t.createdAt)<0),r=[...e];return r.splice(n<0?e.length:n,0,t),r}function an(e,t,n){return n?n.has(t):e.runs.some(e=>e.projectId===t)}function on(e,t,n){let{project:r}=t,i=tn(t),a=e.runs.findIndex(e=>e.projectId===r&&e.id===i),o=a>=0?e.runs[a]:void 0,s=e.truncated.includes(r);if(t.type===`deleted`)return o?{index:I(e,e.runs.filter((e,t)=>t!==a)),reconcile:s&&o.archived}:{index:e,reconcile:!1};let{run:c}=t;if(c.delegation?.role===`worker`)return o?{index:I(e,e.runs.filter((e,t)=>t!==a)),reconcile:!1}:{index:e,reconcile:!1};if(!o&&!an(e,r,n))return{index:e,reconcile:!0};let l=Ue(o,{projectId:r,...c});if(o){if(l===o)return{index:e,reconcile:!1};let t=[...e.runs];t[a]=l;let n=o.archived!==l.archived&&(s||nn(t,r)>e.perProjectLimit);return{index:I(e,t),reconcile:n}}if(s)return cn(e,l);let u=rn(e.runs,l);return{index:I(e,u),reconcile:l.archived&&nn(u,r)>e.perProjectLimit}}function sn(e,t){let n;for(let r of e)r.projectId===t&&r.archived&&(n===void 0||r.createdAt<n)&&(n=r.createdAt);return n}function cn(e,t){let n=sn(e.runs,t.projectId),r=n!==void 0&&t.createdAt>n;return t.archived&&!r?{index:e,reconcile:!1}:{index:I(e,rn(e.runs,t)),reconcile:t.archived||n===void 0||t.createdAt<n}}function ln(e,t,n){let r=!1,i=e.runs.map(e=>{if(e.projectId!==t)return e;let i=n[e.id];if(i){let t=Ue(e.usage,i);return t===e.usage?e:(r=!0,{...e,usage:t})}if(e.usage===void 0)return e;r=!0;let{usage:a,...o}=e;return o});return r?I(e,i):e}function un(e,t){let n=e.runs.filter(e=>e.projectId!==t),r=e.truncated.filter(e=>e!==t),i=Object.prototype.hasOwnProperty.call(e.referenceStatuses,t);if(n.length===e.runs.length&&r.length===e.truncated.length&&!i)return e;let a={...e.referenceStatuses};return delete a[t],{...e,runs:n,truncated:r,referenceStatuses:a}}function dn(){return{stream:void 0,lastStream:void 0,mismatch:void 0,floor:void 0,changes:new Map}}function fn(e,t,n){if(e.lastStream===t)e.floor=Math.max(e.floor??n,n);else{for(let[n,r]of e.changes)r.generation!==t&&e.changes.delete(n);e.floor=n}e.stream=t,e.lastStream=t,e.mismatch=void 0}function pn(e){e.stream=void 0}function mn(e,t,n=!1){let r=e.stream;if(r===void 0)return!1;(e.floor===void 0||n)&&(e.floor=t.seq-1);let i=JSON.stringify([r,t.project,tn(t)]),a=e.changes.get(i);return(!a||a.seq<t.seq)&&e.changes.set(i,{...t,generation:r}),!0}function hn(e,t){for(let[n,r]of e.changes)r.project===t&&e.changes.delete(n)}function gn(e){return typeof e.generation==`string`&&typeof e.eventSeq==`number`}function _n(e,t,n){if(!gn(t))return{index:t,reconcile:!1};let{generation:r,eventSeq:i}=t;if(e.stream!==void 0&&e.stream!==r){let n=e.mismatch!==r;return e.mismatch=r,{index:t,reconcile:n}}let a=e.lastStream===r&&e.floor!==void 0,o=a&&i<e.floor,s=t,c=o,l=[...e.changes.entries()].filter(([,e])=>e.generation===r),u=l.map(([,e])=>e).filter(e=>e.seq>i).sort((e,t)=>e.seq-t.seq);for(let e of u){let t=on(s,e,n);s=t.index,c||=t.reconcile}for(let[t,n]of l)n.seq<=i&&e.changes.delete(t);return a&&!o&&(e.floor=i),{index:s,reconcile:c}}var L=[`workspace`,`runs-index`],vn=[`workspace`,`projects`],yn=6e4,bn=100,xn=new WeakMap;function R(e){let t=xn.get(e);return t||(t=En(e),xn.set(e,t)),t}function Sn(e,t){return typeof e!=`object`||!e||!Array.isArray(e.runs)?e:R(t).merge(e)}function Cn(e){let t=e.getQueryData(vn)?.projects;return t?new Set(t.map(e=>e.id)):void 0}function wn(e,t,n){if(!(!e||typeof e.eventSeq!=`number`||typeof t.eventSeq!=`number`))return e.generation===t.generation?t.eventSeq<e.eventSeq?e:void 0:n!==void 0&&e.generation===n&&t.generation!==n?e:void 0}function Tn(e,t){return t.type===`run-summary`?{type:`run`,project:e,seq:t.seq,run:t.summary}:{type:`deleted`,project:e,seq:t.seq,id:t.id}}function En(e){let t=dn(),n=[],r,i,a,o,s=!1,c=-1/0,l=new Set,u=!1,d,f=!1,p=()=>{if(!u){if(u=!0,d?.()){f=!0;return}_({hold:!0})}},m=t=>{c=Date.now(),e.setQueryData(L,t)},h=()=>e.getQueryData(L),g=()=>{clearTimeout(a),a=void 0;let t=e.getQueryCache().find({queryKey:L,exact:!0}),n=(t!==void 0&&t.state.data===void 0&&t.state.fetchStatus!==`idle`?e.cancelQueries({queryKey:L,exact:!0}).then(()=>e.invalidateQueries({queryKey:L})):e.invalidateQueries({queryKey:L})).catch(()=>void 0).finally(()=>{o===n&&(o=void 0,s&&(s=!1,g()))});return o=n,n},_=(e={})=>o?(s=!0,o):e.hold?(a??=setTimeout(()=>{g()},400),Promise.resolve()):g(),v=()=>{r!==void 0&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(r),r=void 0,clearTimeout(i),i=void 0;let t=n;n=[];let a=h();if(!a||t.length===0)return;let o=Cn(e),s=a,c=!1;for(let e of t){if(e.generation!==a.generation)continue;if(e.type===`usage`){l.has(e.project)||(s=ln(s,e.project,e.usage));continue}if(l.has(e.change.project)||e.change.seq<=a.eventSeq)continue;let t=on(s,e.change,o);s=t.index,c||=t.reconcile}s!==a&&m(s),c&&_({hold:!0})},y=()=>{if(i!==void 0)return;let e=c+250-Date.now();if(e>0){i=setTimeout(v,e);return}i=setTimeout(v,bn),typeof requestAnimationFrame==`function`&&(r=requestAnimationFrame(v))};return{ready(e,n){fn(t,e,n),u=!1,f&&(f=!1,_({hold:!0}))},detach(){pn(t)},run(e,r,i=!1){if(l.has(e))return;let a=Tn(e,r);if(!mn(t,a,i)){p();return}n.push({type:`change`,change:a,generation:t.stream}),y()},usage(e,r){if(!l.has(e)){if(t.stream===void 0){p();return}n.push({type:`usage`,project:e,usage:r,generation:t.stream}),y()}},dropProject(e){l.add(e),hn(t,e),n=n.filter(t=>(t.type===`change`?t.change.project:t.project)!==e);let r=h();if(!r)return;let i=un(r,e);i!==r&&m(i)},setUnknownGenerationHandler(e){d=e},restoreProject(e){l.delete(e)},merge(n){let r=h(),i=_n(t,n,Cn(e));for(let e of l)i.index=un(i.index,e);return i.reconcile&&queueMicrotask(()=>{_({hold:!0})}),wn(r,n,t.stream)??i.index},reconcile:_,flush:v,stop(){r!==void 0&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(r),r=void 0,clearTimeout(i),i=void 0,clearTimeout(a),a=void 0,n=[],s=!1}}}var Dn={draft:{label:`Draft`,hint:`the author has not marked it ready for review`,tone:`neutral`},"review-required":{label:`Waiting for review`,hint:`checks are fine, no one has reviewed it yet`,tone:`info`},"changes-requested":{label:`Changes requested`,hint:`a reviewer asked for edits before this can merge`,tone:`danger`},"checks-pending":{label:`Checks running`,hint:`CI has not finished on the latest commit`,tone:`pending`},"checks-failing":{label:`Checks failing`,hint:`CI is red on the latest commit`,tone:`danger`},ready:{label:`Ready to merge`,hint:`open, checks pass, nothing is waiting on a reviewer`,tone:`success`},merged:{label:`Merged`,hint:`this landed on its base branch`,tone:`merged`},closed:{label:`Closed`,hint:`closed without merging — the work did not land`,tone:`danger`},open:{label:`Open`,hint:`still open on the tracker`,tone:`success`},completed:{label:`Closed as completed`,hint:`the issue was resolved`,tone:`accent`},"not-planned":{label:`Closed as not planned`,hint:`the issue was declined — nothing shipped for it`,tone:`neutral`}},On={label:`Merge conflicts`,hint:`this branch no longer merges cleanly into its base — rebase or merge the base in`,tone:`conflict`};function kn(e){return typeof e==`string`&&Object.hasOwn(Dn,e)}function An(e){return e!==void 0&&kn(e)?Dn[e]:void 0}var z=new Map(In()),jn=1e3;function Mn(e,t){if(z.get(e)!==t){for(z.delete(e),z.set(e,t);z.size>jn;){let e=z.keys().next().value;if(e===void 0)break;z.delete(e)}Rn()}}var B=new Set(Ln());function Nn(e,t){if(B.has(e)!==t){if(t)for(B.add(e);B.size>jn;){let e=B.values().next().value;if(e===void 0)break;B.delete(e)}else B.delete(e);Rn()}}var Pn=`cez.reference-statuses.v1`,Fn=`cez.reference-conflicts.v1`;function In(){try{let e=globalThis.sessionStorage?.getItem(Pn);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>Array.isArray(e)&&e.length===2&&typeof e[0]==`string`&&kn(e[1])):[]}catch{return[]}}function Ln(){try{let e=globalThis.sessionStorage?.getItem(Fn);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}var V;function Rn(){V===void 0&&(V=setTimeout(()=>{V=void 0;try{globalThis.sessionStorage?.setItem(Pn,JSON.stringify([...z])),globalThis.sessionStorage?.setItem(Fn,JSON.stringify([...B]))}catch{}},250))}var H=e=>`${e.projectId}\u0000${e.kind}#${e.number}`;function zn(e,t){return{...e?{status:e}:{},...t?{conflicting:!0}:{}}}function Bn(e){return[...e.prs.map(t=>({projectId:e.projectId,kind:`PR`,number:t})),...e.issues.map(t=>({projectId:e.projectId,kind:`Issue`,number:t}))]}function Vn(e,t,n,r,i,a){let o=r.prs[n.number]??r.issues[n.number];if(!o){e.set(t,{state:`unknown`,...i?{status:i}:{}});return}let s=r.conflicts?r.conflicts.includes(n.number):void 0;Mn(t,o),s!==void 0&&Nn(t,s),e.set(t,{state:`ready`,status:o,...s??a?{conflicting:!0}:{}})}function Hn(e,t,n){let r=H(t),i=z.get(r),a=B.has(r)?!0:void 0,o=n.data;if(o?.available){Vn(e,r,t,o,i,a);return}if(o){e.set(r,{state:`unavailable`,reason:o.reason,...zn(i,a)});return}if(n.isError){e.set(r,{state:`unavailable`,reason:n.error instanceof Error?n.error.message:void 0,...zn(i,a)});return}e.set(r,{state:`loading`,...zn(i,a)})}function Un(e,t){let n=new Map;return t.forEach((t,r)=>{let i=e[r];if(i)for(let e of Bn(i))Hn(n,e,t)}),n}function Wn(e){return x(e)?!1:e.status===`queued`||e.status===`running`||e.status===`waiting`}function Gn(e){return Wn(e)&&e.status!==`queued`}function Kn(e,t,n){return e.archived||!(e.status===`done`||e.status===`failed`||e.status===`cancelled`)||e.delegation?.role===`worker`||n!==void 0&&ke(e)!==n?!1:t===`unpinned`?!e.pinned:t!==`pinned`||e.pinned===!0}var qn=[`done`,`failed`];function Jn(e){return e.archived||x(e)||!qn.includes(e.status)?!1:e.finishedAt!==void 0}function Yn(e){let t=e.finishedAt;return t===void 0||!Jn(e)?!1:e.seenAt===void 0||e.seenAt<t}function Xn(e){let t=/\/(\d+)\/?$/.exec(e.trim()),n=t?Number(t[1]):NaN;return Number.isInteger(n)&&n>0?n:null}function Zn(e){let t=new Set;for(let n of[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl]){let e=n?Xn(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 Qn=[{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:Zn},{id:`shownReferences`,kind:`reference`,scopes:[`shown`],source:`reader`,numbers:(e,t)=>t.references?.()??[]}];function $n(e){return e.trim().toLowerCase().split(/\s+/).filter(e=>e!==``)}function er(e,t){if(t!==`phrase`)return $n(e);let n=e.trim().toLowerCase();return n===``?[]:[n]}function tr(e,t){return t&&e.automationId!==void 0?t.get(e.automationId)??e.automationId:void 0}function nr(e,t){let n=t.scope??`stored`,r=t.scope===`shown`?t.omit??[]:[],i=t.scope===`shown`?t.extras:{automation:tr(e,t.automationNames)},a=[],o=[],s=[],c={text:a,identifier:o,link:s},l=[];for(let t of Qn)if(!(!t.scopes.includes(n)||r.includes(t.id))){if(t.kind===`reference`){l.push(()=>t.numbers(e,i));continue}for(let n of t.texts(e,i))typeof n==`string`&&c[t.kind].push(n.toLowerCase())}let u;return{prose:a,ids:o,links:s,references:()=>u??=new Set(l.flatMap(e=>e().map(String)))}}function rr(e,t,n={}){let r=er(t,n.mode);if(r.length===0)return!1;let{prose:i,ids:a,links:o,references:s}=nr(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 ir=[`Needs you`,`Finished`,`Working`,`Archived`],ar={waiting:0,review:1,running:2,queued:4,done:5,failed:6,cancelled:7},or=3,U=e=>x(e)?or:ar[e.status]??9;function sr(e){let t=e=>v[u(e).bucket];return[...e].sort((e,n)=>t(e)-t(n)||U(e)-U(n))[0]}function cr(e,t){return t===`archived`?`Archived`:u(e).bucket===`waiting`?`Needs you`:e.status===`waiting`||e.status===`running`||e.status===`queued`?`Working`:`Finished`}function lr(e){let t=e.titleSummary;return t===void 0||!(e.titleOrigin===`user`||e.titleOrigin===`marker`)&&/[.!?][A-Z]/.test(t)?e.title:t}function ur(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 dr(e,t){return t!==void 0&&ur(e).ref===t}function fr(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 pr(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=U(e)-U(n);if(r!==0)return r;if(x(e)&&x(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 W(e){return e.delegation?.role===`worker`}function mr(e,t){if(e==null)return null;let n=t.find(t=>t.id===e);return!n||!W(n)?e:n.delegation?.parentRunId??e}function hr(e,t,n=fr(e)){let r=pr(e,t).filter(e=>!W(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(cr(e,t),{kind:`run`,run:e,queuePosition:n.get(e.id)??null});return ir.filter(e=>i.has(e)).map(e=>({label:e,rows:i.get(e)}))}function gr(e,t={}){let n=typeof t==`number`?{overall:t}:zt(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 _r(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 vr(e){let t=0,n=0,r=0;for(let i of e)if(!W(i)){if(i.archived){n+=1;continue}t+=1,u(i).bucket===`waiting`&&(r+=1)}return{active:t,archived:n,waiting:r}}function yr(e,t){let n=t===`automations`;return e.filter(e=>!e.archived&&ke(e)===n)}var G={"Needs you":`needs-you`,Finished:`finished`,Working:`working`},br=Object.keys(G),xr=`section`;function Sr(e,t){return`/?origin=${t===`automations`?`automations`:`direct`}&${xr}=${G[e]}`}function Cr(e){return br.find(t=>G[t]===e)??null}function wr(e){let t={active:0,automations:0,activeWaiting:0,automationsWaiting:0};for(let n of e){if(W(n)||n.archived)continue;let e=+(u(n).bucket===`waiting`);ke(n)?(t.automations+=1,t.automationsWaiting+=e):(t.active+=1,t.activeWaiting+=e)}return t}var Tr=new Set([`running`,`waiting`]);function K(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 Er(e){return e===void 0?``:`$${e>=10?e.toFixed(0):e.toFixed(2)}`}function Dr(e,t=new Date){if(!x(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 Or(e){return e.steps?Xt({workflow:e.workflow,steps:e.steps}):e.workflowLabel??e.workflow}function kr(e,t,n=()=>``){let r=e.filter(e=>!W(e));return t.trim()?r.filter(e=>rr(e,t,{scope:`shown`,mode:`phrase`,extras:{displayTitle:lr(e),automation:n(e),references:()=>Ar(e)}})):[...r]}function Ar(e){return q(e).map(e=>e.number)}function jr(e,t){return e.filter(e=>Kn(e,t)).length}function Mr(e){return jr(e)}function Nr(e){if(!e)return;let t=e.trim().replace(/\/+$/,``),n=/^(?:https?|ssh|git|git\+ssh):\/\/(?:[^@/]+@)?([^/:]+)(?::\d+)?\/(.+)$/.exec(t),r=n?null:/^(?:[^@/:]+@)?([^:/]+):(.+)$/.exec(t),i=n??r;if(!i)return;let[,a,o]=i;if(!o||a?.toLowerCase()!==`github.com`)return;let s=o.replace(/\.git$/i,``).split(`/`).filter(Boolean),c=s[s.length-2],l=s[s.length-1];return c&&l?`https://github.com/${c}/${l}`:void 0}function Pr(e){return Fr(e)[0]??e.pullRequests?.find(e=>e.url)?.url}function Fr(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 Ir(e,t){if(e.referencedIssueUrl)return e.referencedIssueUrl;let n=e.issueNumber??e.markerRefs?.issue;if(!(!n||!t))return`${t}/issues/${n}`}function Lr(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 q(e,t,n=e.projectId){let r=Fr(e),i=e.markerRefs?.pr,a=[...i===void 0||[...r,...(e.pullRequests??[]).flatMap(e=>e.url?[e.url]:[])].some(e=>Wr(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:Ir(e,t)},{kind:`Issue`,number:e.issueNumber}],o=new Set,s=[];for(let e of a){let r=e.url?Number(Wr(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??Rr(e.kind,r,t),a={kind:e.kind,number:r,...i?{url:i}:n===void 0?{}:{projectId:n}},c=Lr(a);o.has(c)||(o.add(c),s.push(a))}return s}function Rr(e,t,n){if(n)return`${n}/${e===`PR`?`pull`:`issues`}/${t}`}function zr(e){return q(e)[0]}function Br(e,t){if(!e.url)return!0;if(!t)return!1;let n=Vr(t);return n!==void 0&&Vr(e.url)===n}function Vr(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 Hr(e,t){let n=[];for(let r of q(e,t)){if(!Br(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 Ur(e,t,n,r){if(Br(n,r))return`/p/${e}/tasks/${t}/${n.kind===`PR`?`pr`:`issue`}/${n.number}`}function Wr(e){return/\/(\d+)\/?(?:[?#].*)?$/.exec(e)?.[1]??null}function Gr(e,t){let n=Tr.has(e.status)?t:void 0;if(n)return{cpu:{text:`${n.cpuPct.toFixed(0)}%`,kind:`live`},mem:{text:K(n.rssBytes),kind:`live`}};let r=K(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`}}}function Kr(e){let t=new Map;for(let n of e)for(let e of n.tags??[]){let n=e.toLowerCase();t.has(n)||t.set(n,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function qr(e,t,n,r=8){let i=n.trim().toLowerCase(),a=new Set(t.map(e=>e.toLowerCase())),o=e.filter(e=>{let t=e.toLowerCase();return a.has(t)?!1:i===``||t.includes(i)&&t!==i});return i===``?o.slice(0,r):o.sort((e,t)=>Number(t.toLowerCase().startsWith(i))-Number(e.toLowerCase().startsWith(i))||e.localeCompare(t,void 0,{sensitivity:`base`})).slice(0,r)}function Jr(e){let t=new Map;for(let n of e){let e=n.trim();if(!e)continue;let r=e.toLowerCase();t.has(r)||t.set(r,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function Yr(e){if(!e.available)return;let t=e.issuesNextCursor,n=e.prsNextCursor;if(!(t===void 0&&n===void 0)&&!(!t&&!n))return{...t?{issuesCursor:t}:{issuesDone:!0},...n?{prsCursor:n}:{prsDone:!0}}}function Xr(e,t){return e?(t===`issues`?e.issuesNextCursor:e.prsNextCursor)==null:!1}function Zr(e,t,n){for(let r of e)t.has(r.number)||(t.add(r.number),n.push(r))}function Qr(e){let t=e[0];if(!t)return;let n=e[e.length-1],r=[],i=[],a=new Set,o=new Set,s={};for(let t of e){Zr(t.issues,a,r),Zr(t.prs,o,i);for(let[e,n]of Object.entries(t.labelColors??{}))s[e]??=n}let c=e.find(e=>e.projects)?.projects,l=e.map(e=>e.projectsState),u=e.find(e=>e.projectsState===`unavailable`),d=l.includes(`refreshing`)?`refreshing`:u?`unavailable`:l.some(e=>e===`ready`)?`ready`:void 0,{projectsGeneration:f,projectsReason:p,...m}=t;return{...m,issues:r,prs:i,...Object.keys(s).length>0?{labelColors:s}:{},...c?{projects:c}:{},...d?{projectsState:d}:{},...d===`unavailable`&&u?.projectsReason?{projectsReason:u.projectsReason}:{},...`issuesNextCursor`in n?{issuesNextCursor:n.issuesNextCursor}:{},...`prsNextCursor`in n?{prsNextCursor:n.prsNextCursor}:{}}}var J=e=>e.map(e=>e.number).join(`,`);function $r(e,t){let n=e[0];if(e.length>1&&n&&(J(n.issues)!==J(t.issues)||J(n.prs)!==J(t.prs)||n.issuesTotal!==t.issuesTotal||n.prsTotal!==t.prsTotal))return`refetch`;let r=t;if(n&&t.available&&t.projectsState===`refreshing`&&n.repo===t.repo){let e=new Map(n.issues.map(e=>[e.number,e.projectIds]));r={...t,issues:t.issues.map(t=>{let n=e.get(t.number);return t.projectIds===void 0&&n!==void 0?{...t,projectIds:n}:t})}}return[r,...e.slice(1)]}var Y={get health(){return[n(),`health`]},runs:{get all(){return[n(),`runs`]},relationships:e=>[n(),`runs`,`relationships`,e],list:(e=n())=>[e,`runs`,`list`],archived:e=>[n(),`runs`,`archived`,e],detail:(e,t=n())=>[t,`runs`,`detail`,e],diff:e=>[n(),`runs`,`diff`,e],changes:e=>[n(),`runs`,`changes`,e],file:(e,t)=>[n(),`runs`,`files`,e,t],handoff:e=>[n(),`runs`,`handoff`,e],commits:e=>[n(),`runs`,`commits`,e],commit:(e,t)=>[n(),`runs`,`commit`,e,t]},get workflows(){return[n(),`workflows`]},get skills(){return[n(),`skills`]},get skillsReady(){return[n(),`skills`,`ready`]},get importableSkills(){return[n(),`skills`,`importable`]},get importableSkillsReady(){return[n(),`skills`,`importable`,`ready`]},get launchKey(){return[n(),`launch-key`]},get repo(){return[n(),`repo`]},get repoChanges(){return[n(),`repo`,`changes`]},repoCommit:e=>[n(),`repo`,`commit`,e],get repoBranches(){return[n(),`repo`,`branches`]},get uiState(){return[n(),`ui-state`]},get config(){return[n(),`config`]},get agentConfig(){return[n(),`agent-config`]},agentConfigFile:e=>[n(),`agent-config`,`file`,e],get worktrees(){return[n(),`worktrees`]},github:(e={})=>[n(),`github`,e.limit??null],githubPages:e=>[n(),`github`,`pages`,e],githubPagesHead:e=>[n(),`github`,`pages-head`,e],githubCommentCounts:(e,t)=>[n(),`github`,`comment-counts`,e,[...t].sort((e,t)=>e-t).join(`,`)],githubChecks:e=>[n(),`github`,`checks`,[...e].sort((e,t)=>e-t).join(`,`)],githubSearch:(e,t)=>[n(),`github`,`search`,e,t],githubRefStatus:(e,t,n)=>[e,`github`,`ref-status`,[...t].sort((e,t)=>e-t).join(`,`),[...n].sort((e,t)=>e-t).join(`,`)],githubComments:(e,t)=>[n(),`github`,`comments`,e,t],githubItem:(e,t)=>[n(),`github`,`item`,e,t],githubRefStatusOf:e=>[e,`github`,`ref-status`],githubPrChanges:e=>[n(),`github`,`pr-changes`,e],githubMergeState:e=>[n(),`github`,`merge-state`,e],get openTargets(){return[n(),`open-targets`]}},X={models:e=>[`workspace`,`models`,e],providerStatus:[`workspace`,`providers`,`status`],projects:[`workspace`,`projects`],githubOwners:[`workspace`,`github-owners`],runsIndex:L,runsSearch:e=>[`workspace`,`runs-search`,e],uiState:[`workspace`,`ui-state`],config:[`workspace`,`config`],agentProfiles:[`workspace`,`agent-profiles`],agentAccountDetails:e=>[`workspace`,`agent-profiles`,`details`,e],agentAccountStatus:e=>[`workspace`,`agent-profiles`,`status`,e],fsBrowseRoot:[`workspace`,`fs-browse`],fsBrowse:(e,t=!1)=>[...X.fsBrowseRoot,e,t]};function Z(e,t,n=`active`){return e.invalidateQueries({queryKey:t===void 0?[`workspace`,`models`]:X.models(t),refetchType:n})}function Q(e,t=!0){let n=b();return(0,E.useEffect)(()=>{if(!t||e!==`cursor`)return;let r,i=()=>{let e=n.getQueryData(Y.health)?.capabilities?.localHandoff===!0;e&&!r?r=Ht(`models:cursor`,e=>{let t=Rt.safeParse(e);t.success&&t.data.runner===`cursor`&&(n.cancelQueries({queryKey:X.models(`cursor`)}),n.setQueryData(X.models(`cursor`),t.data))}):!e&&r&&(r(),r=void 0)};i();let a=n.getQueryCache().subscribe(i);return()=>{a(),r?.()}},[t,e,n]),w({queryKey:X.models(e),queryFn:({signal:t})=>S(e)?he(e,{signal:t}):Promise.reject(Error(`${e} has no host model catalog`)),staleTime:300*1e3,enabled:t&&S(e)})}function ei(e=!0){return{claude:Q(`claude`,e),codex:Q(`codex`,e),opencode:Q(`opencode`,e),pi:Q(`pi`,e),cursor:Q(`cursor`,e),omp:Q(`omp`,e)}}function ti(){let e=b();return w({queryKey:X.providerStatus,queryFn:async({signal:t})=>{let n=e.getQueryData(X.providerStatus),r=await ht(!1,{signal:t});return Ot(n,e.getQueryData(X.providerStatus),r)},staleTime:5*6e4,refetchInterval:a(!1),refetchOnWindowFocus:!0})}function ni(){let e=b();return O({mutationFn:()=>ht(!0),onMutate:()=>e.getQueryData(X.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(X.providerStatus,e=>Ot(r,e,t)),Z(e)}})}function ri(){let e=b();return O({mutationFn:({provider:e,authFailureId:t})=>ut(e,t),onMutate:()=>e.getQueryData(X.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(X.providerStatus,e=>Ot(r,e,t,n.authFailureId)),S(n.provider)&&Z(e,n.provider)}})}function ii(e={}){return w({queryKey:X.projects,queryFn:({signal:e})=>Xe({signal:e}),...e})}function ai(e,t=!1){return w({queryKey:X.fsBrowse(e,t),queryFn:({signal:n})=>He(e??void 0,{signal:n,showHidden:t}),retry:!1})}function oi(){let e=b();return O({mutationFn:e=>yt(e),onSuccess:()=>e.invalidateQueries({queryKey:X.projects})})}function si(){let e=b();return O({mutationFn:e=>ot(e),retry:!1,onSuccess:()=>{e.invalidateQueries({queryKey:X.projects})}})}function ci(){let e=b();return O({mutationFn:e=>{let{id:t,...n}=e;return h(t,n)},retry:!1,onMutate:async({id:t,...n})=>{await e.cancelQueries({queryKey:X.projects});let r=e.getQueryData(X.projects);return e.setQueryData(X.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t?li(e,n):e)}),{previous:r}},onError:(t,n,r)=>{r?.previous&&e.setQueryData(X.projects,r.previous)},onSuccess:({project:t})=>{e.setQueryData(X.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t.id?t:e)})},onSettled:()=>e.invalidateQueries({queryKey:X.projects})})}function li(e,t){let{maxParallel:n,tags:r,...i}=e,a={...i},o=`maxParallel`in t?t.maxParallel:e.maxParallel;o!=null&&(a.maxParallel=o);let s=`tags`in t&&t.tags!==void 0?t.tags:e.tags,c=s==null?[]:Jr(s);if(c.length>0&&(a.tags=c),`webhook`in t&&t.webhook!==void 0)if(t.webhook===null)delete a.webhook;else{let n=t.webhook.token===void 0?e.webhook?.tokenSet??!1:t.webhook.token!==``;a.webhook={url:t.webhook.url,tokenSet:n}}return a}function ui(e){let t=b();return O({mutationFn:e,retry:!1,onSuccess:({project:e})=>{t.setQueryData(X.projects,t=>t===void 0?t:{...t,projects:t.projects.map(t=>t.id===e.id?e:t)})},onSettled:()=>t.invalidateQueries({queryKey:X.projects})})}function di(){return ui(e=>{let{projectId:t,...n}=e;return Mt(t,n)})}function fi(){return ui(e=>{let{projectId:t,webhookId:n,...r}=e;return me(t,n,r)})}function pi(){return ui(({projectId:e,webhookId:t})=>wt(e,t))}function mi(){return O({mutationFn:({projectId:e,webhookId:t})=>f(e,t),retry:!1})}function hi(e){let t=b();return O({mutationFn:t=>Oe(e,t),retry:!1,onSuccess:()=>t.invalidateQueries({queryKey:Y.runs.all})})}function $(e){let t=b();return O({mutationFn:e,retry:!1,onSuccess:async()=>{await Promise.all([t.invalidateQueries({queryKey:X.agentProfiles}),t.invalidateQueries({queryKey:X.projects})])}})}function gi(){return $(e=>Et(e))}function _i(){return $(e=>{let{id:t,...n}=e;return Ce(t,n)})}function vi(){return $(e=>We(e))}function yi(){return $(e=>Dt(e))}function bi(e,t){return w({queryKey:X.agentAccountDetails(e),queryFn:({signal:t})=>_(e,{signal:t}),enabled:t,staleTime:0,retry:!1})}function xi(e,t){return w({queryKey:X.agentAccountStatus(e),queryFn:({signal:t})=>re(e,{signal:t}),enabled:t,staleTime:6e4,retry:!1})}function Si(){let e=b();return O({mutationFn:({provider:e,profileId:t})=>Ze(e,t),retry:!1,onSuccess:async(t,{provider:n})=>{await Promise.all([e.invalidateQueries({queryKey:X.agentProfiles}),e.invalidateQueries({queryKey:X.providerStatus}),S(n)?Z(e,n,`none`):Promise.resolve()])}})}function Ci(){let e=b();return O({mutationFn:e=>re(e,{refresh:!0}),retry:!1,onSuccess:(t,n)=>{e.setQueryData(X.agentAccountStatus(n),t),e.invalidateQueries({queryKey:X.agentProfiles}),S(t.status.provider)&&Z(e,t.status.provider)}})}function wi(){return O({mutationFn:e=>{let{routeId:t,...n}=e;return ne(t,n)},retry:!1})}function Ti(){let e=b();return O({mutationFn:e=>ct(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:X.projects})})}function Ei(){let e=b();return O({mutationFn:e=>Be(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:X.projects})})}function Di({enabled:e}){return w({queryKey:X.githubOwners,queryFn:({signal:e})=>St({signal:e}),enabled:e,staleTime:6e4,retry:!1})}function Oi(){let e=b();(0,E.useEffect)(()=>{let n,r=()=>{let r=e.getQueryData(Y.health),i=r?.capabilities?.localHandoff===!0;r&&p({local:i,bootProject:r.bootProject??`default`,apiBase:t()}),i&&n===void 0?n=Ht(`health`,t=>{e.setQueryData(Y.health,t)}):!i&&n!==void 0&&(n(),n=void 0)};r();let i=e.getQueryCache().subscribe(r);return()=>{i(),n?.(),it()}},[e])}function ki(){return w({queryKey:Y.health,queryFn:({signal:e})=>bt({signal:e})})}function Ai(e,t){let n=ki().data,r=ii(t).data?.projects,i=_t(),a=e??i.projectId,o=a??n?.bootProject,s=o===void 0?void 0:r?.find(e=>e.id===o);return s?.repoUrl?s.repoUrl:a===null||a===n?.bootProject?Nr(n?.repo?.remote):void 0}function ji(){return w({queryKey:Y.openTargets,queryFn:({signal:e})=>Je({signal:e}),staleTime:5*6e4})}function Mi(){return w({queryKey:Y.runs.list(),queryFn:({signal:e})=>at(k(),{signal:e})})}function Ni(e,t){return Bt({queryKey:Y.runs.archived(e),enabled:t,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>l({before:t,limit:200,q:e},{signal:n}),getNextPageParam:e=>e.nextCursor??void 0,placeholderData:(e,t)=>t?.queryKey[0]===n()?e:void 0})}function Pi(e){let t=e.trim();return w({queryKey:X.runsSearch(t),queryFn:({signal:e})=>Le(t,{signal:e}),enabled:t.length>=2,placeholderData:vt,staleTime:1e4})}function Fi(e=!0,t=yn){let n=R(b());return T(`/api/v1/workspace/runs-index`,X.runsIndex,a(e?t:!1),Sn),w({queryKey:X.runsIndex,queryFn:({signal:e})=>c({signal:e}).then(n.merge),enabled:e,staleTime:3e4,refetchInterval:!1})}function Ii(e,t=!0,n=!1){return w({queryKey:[k({projectId:e,boot:n}).cacheScope,`runs`,`list`],queryFn:({signal:t})=>at(k({projectId:e,boot:n}),{signal:t}),enabled:t})}function Li(e){let t=b();return O({mutationFn:e=>nt(e),onSettled:()=>t.invalidateQueries({queryKey:Y.runs.relationships(e)})})}function Ri(e,t={}){return w({queryKey:Y.runs.relationships(e),queryFn:({signal:t})=>g(e,{signal:t}),enabled:t.enabled??!0})}function zi(e){return w({queryKey:Y.runs.detail(e??``),queryFn:({signal:t})=>kt(A(e),{signal:t}),enabled:!!e})}function Bi(e,t,n=!0){return w({queryKey:[e??`default`,`runs`,`detail`,t??``],queryFn:({signal:n})=>kt(A(t,{projectId:e}),{signal:n}),enabled:n&&!!e&&!!t})}function Vi(e){return w({queryKey:Y.runs.diff(e??``),queryFn:({signal:t})=>Se(e,{signal:t}),enabled:!!e})}function Hi(e,t=!1){return T(e?`/api/v1/p/${n()}/runs/${encodeURIComponent(e)}/changes`:void 0,Y.runs.changes(e??``),a(t?4e3:!1)),w({queryKey:Y.runs.changes(e??``),queryFn:({signal:t})=>Ft(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1,refetchOnWindowFocus:!0,staleTime:0})}function Ui(e,t){return w({queryKey:Y.runs.file(e??``,t??``),queryFn:({signal:n})=>m(e,t,{signal:n}),enabled:!!e&&t!==void 0,retry:!1})}function Wi(e,t){return w({queryKey:[n(),`runs`,`file-link`,e,t],queryFn:({signal:n})=>Me(e,t,{signal:n}),enabled:t!==null,retry:!1})}function Gi(e,t){return w({queryKey:[n(),`runs`,`artifact`,e,t],queryFn:({signal:n})=>Ee(e,t,{signal:n}),enabled:t!==null,retry:!1})}function Ki(e,t){return w({queryKey:[n(),`runs`,`artifact-metadata`,e,t],queryFn:({signal:n})=>ee(e,t,{signal:n}),enabled:t!==null,retry:!1})}function qi(e){return w({queryKey:[n(),`runs`,`artifacts`,e],queryFn:({signal:t})=>we(e,{signal:t}),retry:!1,staleTime:0,refetchOnWindowFocus:!0})}function Ji(e,t=!1){return T(e?`/api/v1/p/${n()}/runs/${encodeURIComponent(e)}/commits`:void 0,Y.runs.commits(e??``),a(t?5e3:!1)),w({queryKey:Y.runs.commits(e??``),queryFn:({signal:t})=>Nt(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1})}function Yi(e,t){return w({queryKey:Y.runs.commit(e??``,t??``),queryFn:({signal:n})=>Ve(e,t,{signal:n}),enabled:!!e&&!!t,retry:!1})}function Xi(e,t=!0){return w({queryKey:Y.runs.handoff(e??``),queryFn:({signal:t})=>jt(A(e),{signal:t}),enabled:!!e&&t})}function Zi(e,t,n){return w({queryKey:e===void 0?Y.runs.handoff(t):[e,`runs`,`handoff`,t],queryFn:({signal:n})=>jt(A(t,{projectId:e}),{signal:n}),enabled:n,staleTime:15e3})}function Qi(e,t){let r=[...new Set(e)],i=D({queries:r.map(e=>({queryKey:[e??n(),`automations`,`names`],queryFn:({signal:t})=>se({signal:t,archived:`include`,...e===void 0?{}:{projectId:e}}),enabled:t,staleTime:6e4,retry:!1}))}),a=i.map(e=>e.data);return(0,E.useMemo)(()=>{let e=new Map;return a.forEach((t,n)=>{if(t?.available)for(let i of t.automations)e.set(JSON.stringify([r[n]??null,i.id]),i.name)}),(t,n)=>e.get(JSON.stringify([t??null,n]))},[JSON.stringify([r,i.map(e=>e.dataUpdatedAt)])])}function $i(){return w({queryKey:Y.workflows,queryFn:({signal:e})=>ge({signal:e})})}function ea(e=!0){let t=b(),n=Y.skills,r=n[0],i=w({queryKey:n,queryFn:({signal:e})=>rt({signal:e}),enabled:e}),a=w({queryKey:Y.skillsReady,queryFn:({signal:e})=>fe({signal:e}),enabled:e&&i.isSuccess,staleTime:1/0,retry:!1});return(0,E.useEffect)(()=>{Array.isArray(a.data)&&t.setQueryData([r,`skills`],a.data)},[t,a.data,r]),i}function ta(e=!0){let t=b(),n=Y.importableSkills,r=n[0],i=w({queryKey:n,queryFn:({signal:e})=>Ge({signal:e}),enabled:e}),a=w({queryKey:Y.importableSkillsReady,queryFn:({signal:e})=>st({signal:e}),enabled:e&&i.isSuccess,staleTime:1/0,retry:!1});return(0,E.useEffect)(()=>{Array.isArray(a.data)&&t.setQueryData([r,`skills`,`importable`],a.data)},[t,a.data,r]),i}function na(){return w({queryKey:Y.launchKey,queryFn:({signal:e})=>Tt({signal:e}),staleTime:1/0})}function ra(){return w({queryKey:Y.repo,queryFn:({signal:e})=>dt({signal:e})})}function ia(e){return w({queryKey:[e,`repo`],queryFn:({signal:t})=>dt({signal:t},e)})}function aa(){return w({queryKey:Y.repoBranches,queryFn:({signal:e})=>$e({signal:e})})}function oa(){return w({queryKey:Y.repoChanges,queryFn:({signal:e})=>Qe({signal:e}),retry:!1})}function sa(e){return w({queryKey:Y.repoCommit(e??``),queryFn:({signal:t})=>Re(e,{signal:t}),enabled:!!e,retry:!1})}function ca(){return w({queryKey:Y.config,queryFn:({signal:e})=>ae({signal:e})})}function la(){return w({queryKey:Y.worktrees,queryFn:({signal:e})=>ue({signal:e})})}function ua(e){return w({queryKey:[e,`worktrees`],queryFn:({signal:t})=>ue({signal:t},e),staleTime:0})}function da(e,t=!0,n=!1){return w({queryKey:[k({projectId:e,boot:n}).cacheScope,`ui-state`],queryFn:({signal:t})=>pe({signal:t},e),select:e=>e.sidebarLimits===void 0?e:{...e,sidebarLimits:zt(e.sidebarLimits)},enabled:t})}function fa(){return da(n())}function pa(){return w({queryKey:Y.agentConfig,queryFn:({signal:e})=>ce({signal:e})})}function ma(e){return w({queryKey:Y.agentConfigFile(e??``),queryFn:({signal:t})=>ye(e,{signal:t}),enabled:e!==null})}function ha(e){let t=b(),n=Y.agentConfig,r=Y.agentConfigFile(e);return O({mutationFn:t=>s(e,t),onSuccess:e=>{t.setQueryData(r,e),t.invalidateQueries({queryKey:n})}})}function ga(){return w({queryKey:X.uiState,queryFn:({signal:e})=>ie({signal:e})})}function _a(){return w({queryKey:X.config,queryFn:({signal:e})=>y({signal:e})})}function va(){return w({queryKey:X.agentProfiles,queryFn:({signal:e})=>It({signal:e})})}function ya(e){let t=b();return O({mutationFn:t=>oe(e,t),onSuccess:()=>t.invalidateQueries({queryKey:Y.runs.all})})}function ba(e){let t=F(),n=e?.projectId,r=e?.cacheScope,i=O({mutationFn:e=>xe(e,!0),onMutate:e=>t.patchRead(e,!0),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)}),a=(0,E.useCallback)(e=>({...A(e,{projectId:n,cacheScope:r}),id:e}),[n,r]),o=(0,E.useCallback)(e=>({onSuccess:(t,n,r,i)=>e?.onSuccess?.(t,n.id,r,i),onError:(t,n,r,i)=>e?.onError?.(t,n.id,r,i),onSettled:(t,n,r,i,a)=>e?.onSettled?.(t,n,r.id,i,a)}),[]),{mutate:s,mutateAsync:c}=i,l=(0,E.useCallback)((e,t)=>s(a(e),o(t)),[s,a,o]),u=(0,E.useCallback)((e,t)=>c(a(e),o(t)),[c,a,o]);return{...i,variables:i.variables?.id,mutate:l,mutateAsync:u}}function xa(){let e=F();return O({mutationFn:e=>xe(A(e),!1),onMutate:t=>e.patchRead(()=>A(t),!1),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)})}function Sa(e){let t=F();return O({mutationFn:({id:t,pinned:n})=>Ne(A(t,e),n),onError:e=>Ut(`Could not update pin. ${e.message} Please retry.`,{tone:`danger`}),onMutate:()=>e??k(),onSuccess:(e,n,r)=>t.invalidateAfter(`runs`,r)})}function Ca(e,t){let n=F();return O({mutationFn:n=>Pt(A(e,{projectId:t}),n),onMutate:()=>k({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`send`,r),onError:(e,t,r)=>{e instanceof et&&e.status===409&&r&&n.invalidateAfter(`send`,r)}})}function wa(e,t){let n=F();return O({mutationFn:(n={})=>Ie(A(e,{projectId:t}),n),onMutate:()=>k({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`continue`,r)})}function Ta(e){let t=b();return O({mutationFn:({msgId:t,message:n})=>de(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:Y.runs.all})})}function Ea(e){let t=b();return O({mutationFn:t=>qe(e,t),onSuccess:()=>t.invalidateQueries({queryKey:Y.runs.all})})}function Da(e={},t=!0){let r=b(),i=Y.github(e);T(`/api/v1/p/${n()}/github${e.limit===void 0?``:`?limit=${e.limit}`}`,i,a(t?6e4:!1));let o=w({queryKey:Y.github(e),queryFn:({signal:t})=>je({limit:e.limit},{signal:t}),enabled:t,staleTime:6e4,refetchInterval:!1,refetchIntervalInBackground:!1,refetchOnWindowFocus:!0}),s=o.data?.projectsGeneration,c=w({queryKey:[...i,`projects`,s],queryFn:({signal:e})=>tt(s,{signal:e}),enabled:t&&o.data?.projectsState===`refreshing`&&!!s,staleTime:1/0,retry:!1});return(0,E.useEffect)(()=>{!s||!c.data&&!c.error||r.setQueryData(i,e=>{if(!e||e.projectsGeneration!==s||e.projectsState!==`refreshing`)return e;let t=c.data;return t?.generation&&t.generation!==s?e:t?.state===`ready`?{...e,projectsState:`ready`,projects:t.projects,issues:e.issues.map(e=>({...e,projectIds:t.membership?.[e.number]??[]}))}:{...e,projectsState:`unavailable`,projectsReason:t?.reason??`Project boards unavailable. Refresh to try again.`}})},[r,s,c.data,c.error,i]),o}var Oa=class extends Error{};function ka(e,t,n){return{queryKey:e,initialPageParam:{},queryFn:async({pageParam:e,signal:r})=>{let i=await je({limit:t,...e,...n?{projectId:n}:{}},{signal:r});if(!i.available&&Object.keys(e).length>0)throw new Oa(i.reason??`GitHub is unavailable.`);return i},getNextPageParam:e=>Yr(e),retry:(e,t)=>!(t instanceof Oa)&&!(t instanceof et&&t.status>=400&&t.status<500)&&e<1,staleTime:6e4,refetchOnWindowFocus:!0}}function Aa(e=50,t=!0){let r=b(),i=Y.githubPages(e),o=Y.githubPagesHead(e);T(`/api/v1/p/${n()}/github?limit=${e}`,o,a(t?6e4:!1));let s=Bt({...ka(i,e),enabled:t,refetchInterval:!1,refetchIntervalInBackground:!1}),c=w({queryKey:o,queryFn:({signal:t})=>je({limit:e},{signal:t}),enabled:!1,staleTime:1/0}),{refetch:l}=s;(0,E.useEffect)(()=>{if(!c.data)return;let e=r.getQueryData(i);if(!e||e.pages.length===0)return;let t=$r(e.pages,c.data);t===`refetch`?l():r.setQueryData(i,{...e,pages:t})},[r,c.dataUpdatedAt,l]);let u=(s.data?.pages??[]).flatMap(e=>e.projectsState===`refreshing`&&e.projectsGeneration?[e.projectsGeneration]:[]),d=D({queries:u.map(e=>({queryKey:[...i,`projects`,e],queryFn:({signal:t})=>tt(e,{signal:t}),enabled:t,staleTime:1/0,retry:!1}))});return(0,E.useEffect)(()=>{d.forEach((e,t)=>{let n=u[t];!n||!e.data&&!e.error||r.setQueryData(i,t=>{if(!t)return t;let r=!1,i=t.pages.map(t=>{if(t.projectsGeneration!==n||t.projectsState!==`refreshing`)return t;let i=e.data;return i?.generation&&i.generation!==n?t:(r=!0,i?.state===`ready`?{...t,projectsState:`ready`,projects:i.projects,issues:t.issues.map(e=>({...e,projectIds:i.membership?.[e.number]??[]}))}:{...t,projectsState:`unavailable`,projectsReason:i?.reason??`Project boards unavailable. Refresh to try again.`})});return r?{...t,pages:i}:t})})},[r,d.map((e,t)=>e.data||e.error?u[t]:``).join(`,`)]),{pages:s,data:(0,E.useMemo)(()=>Qr(s.data?.pages??[]),[s.data])}}function ja(e,t=50,n=!0){let r=Bt({...ka([e,`github`,`pages`,t],t,e),enabled:n});return{pages:r,data:(0,E.useMemo)(()=>Qr(r.data?.pages??[]),[r.data])}}function Ma(e,t,n=!0){let r=D({queries:t.filter(e=>e.length>0).map(t=>({queryKey:Y.githubCommentCounts(e,t),queryFn:({signal:n})=>_e(e,t,{},{signal:n}),enabled:n,staleTime:6e4}))});return(0,E.useMemo)(()=>{let e={};for(let t of r)t.data?.available&&Object.assign(e,t.data.counts);return e},[r.map(e=>e.dataUpdatedAt).join(`,`)])}function Na(e,t,n,r=!0){return w({queryKey:[e,`github`,`search`,t,n],queryFn:({signal:r})=>mt(t,n,{projectId:e},{signal:r}),enabled:r&&n.trim()!==``,staleTime:6e4})}function Pa(e,t=!0){return w({queryKey:Y.githubChecks(e),queryFn:({signal:t})=>Pe(e,{signal:t}),enabled:t&&e.length>0,staleTime:6e4})}function Fa(e,t,n=!0){return w({queryKey:Y.githubSearch(e,t),queryFn:({signal:n})=>mt(e,t,{},{signal:n}),enabled:n&&t.trim()!==``,staleTime:6e4})}var Ia=100;function La(e){return[...e].sort((e,t)=>t-e).slice(0,Ia).sort((e,t)=>e-t)}function Ra(){let e=_t(),t=ki();return e.projectId??t.data?.bootProject}function za(e){for(let[t,n]of Object.entries(e)){for(let[e,r]of Object.entries(n.prs))Mn(H({projectId:t,kind:`PR`,number:Number(e)}),r);for(let[e,r]of Object.entries(n.issues))Mn(H({projectId:t,kind:`Issue`,number:Number(e)}),r)}}var Ba=5*6e4;function Va(e){return e?e.recheckAfterMs:Ba}function Ha(e,t=!0){let n=(0,E.useMemo)(()=>{let t=new Map;for(let n of e){let e=t.get(n.projectId)??{prs:new Set,issues:new Set};e[n.kind===`PR`?`prs`:`issues`].add(n.number),t.set(n.projectId,e)}return[...t.entries()].map(([e,t])=>({projectId:e,prs:La(t.prs),issues:La(t.issues)}))},[e.map(H).sort().join(`|`)]),r=D({queries:n.map(e=>({queryKey:Y.githubRefStatus(e.projectId,e.prs,e.issues),queryFn:({signal:t})=>ze(e.projectId,{prs:e.prs,issues:e.issues},{signal:t}),enabled:t&&e.prs.length+e.issues.length>0,staleTime:e=>Va(e.state.data)??1/0,refetchInterval:!1,refetchOnWindowFocus:!0}))}),a=b(),o=JSON.stringify(n.map((e,t)=>({...e,interval:Va(r[t]?.data)??!1})));(0,E.useEffect)(()=>{if(!t||i())return;let e=!0,n=JSON.parse(o).filter(e=>e.interval!==!1).map(t=>{let n=new URLSearchParams;t.prs.length&&n.set(`prs`,t.prs.join(`,`)),t.issues.length&&n.set(`issues`,t.issues.join(`,`));let r=Y.githubRefStatus(t.projectId,t.prs,t.issues);return Vt({path:`/api/v1/p/${t.projectId}/github/ref-status?${n}`,intervalMs:t.interval},(t,n)=>{n||a.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&a.setQueryData(r,t)})})});return()=>{e=!1;for(let e of n)e()}},[t,o,a]);let s=(0,E.useMemo)(()=>Un(n,r),[n,r.map(e=>`${e.dataUpdatedAt}:${e.status}`).join(`,`)]);return(0,E.useCallback)(e=>{let t=H(e),n=s.get(t);if(n)return n;let r=z.get(t);return{state:`idle`,...r?{status:r}:{},...B.has(t)?{conflicting:!0}:{}}},[s])}function Ua(e,t,n=!0){return w({queryKey:Y.githubComments(e,t),queryFn:({signal:n})=>o(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function Wa(e,t,n=!0){return w({queryKey:Y.githubItem(e,t),queryFn:({signal:n})=>Ye(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function Ga(e){return w({queryKey:Y.githubPrChanges(e??0),queryFn:({signal:t})=>ft(e,{},{signal:t}),enabled:e!==void 0,staleTime:6e4,retry:!1})}export{ii as $,Lr as $t,Di as A,_r as An,Ca as At,hi as B,F as Bn,ga as Bt,Wi as C,lr as Cn,Ri as Ct,Ma as D,yr as Dn,Fi as Dt,Pa as E,wr as En,Mi as Et,Oi as F,Kn as Fn,_i as Ft,ja as G,qr as Gt,ji as H,A as Hn,X as Ht,ta as I,Yn as In,ci as It,Ai as J,Er as Jt,Na as K,kr as Kt,na as L,On as Ln,fi as Lt,Ga as M,Jn as Mn,Zi as Mt,Fa as N,Wn as Nn,mi as Nt,Ua as O,pr as On,Pi as Ot,ki as P,Gn as Pn,fa as Pt,ua as Q,Wr as Qt,ba as R,An as Rn,$i as Rt,Ta as S,dr as Sn,Xi as St,Da as T,mr as Tn,Q as Tt,ya as U,O as Un,Xr as Ut,wi as V,k as Vn,la as Vt,Sa as W,Wt as Wn,Kr as Wt,Ii as X,Nr as Xt,Bi as Y,K as Yt,da as Z,Br as Zt,wa as _,W as _n,Hi as _t,xi as a,Hr as an,ni as at,di as b,Cr as bn,Vi as bt,va as c,q as cn,si as ct,Ki as d,ir as dn,ra as dt,Dr as en,ti as et,qi as f,xr as fn,aa as ft,Si as g,hr as gn,zi as gt,ca as h,gr as hn,ri as ht,bi as i,Ur as in,Ha as it,Aa as j,rr as jn,ea as jt,Wa as k,ur as kn,yi as kt,Ni as l,Gr as ln,pi as lt,Ti as m,cr as mn,sa as mt,Y as n,jr as nn,Ci as nt,pa as o,Pr as on,oi as ot,Qi as p,br as pn,oa as pt,ia as q,Mr as qt,za as r,Ir as rn,Ra as rt,ma as s,zr as sn,vi as st,Z as t,Ar as tn,ha as tt,Gi as u,Or as un,Ea as ut,gi as v,vr as vn,Yi as vt,ai as w,Sr as wn,ei as wt,Li as x,fr as xn,Ui as xt,Ei as y,sr as yn,Ji as yt,xa as z,R as zn,_a as zt};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{D as t,E as n,L as r,M as i,d as a,t as o,u as s}from"./button-CS5tOblf.js";import{i as c,t as l}from"./react-runtime-CCIEwYL0.js";import{Gt as u,Kr as d,O as f,S as p,an as m,i as h,in as g,w as _}from"./project-scope-context-DbO9a0ii.js";import{lt as v}from"./live-protocol-BVn0UA_g.js";import{Et as y,H as ee,J as b,P as x,Rn as te,T as ne,Un as S,Vt as re,Yt as C,dt as w,ft as T,mt as ie,n as E,pt as ae}from"./queries-C_DEjjv2.js";import{n as D}from"./toaster-CRVRHlMR.js";import{D as oe,I as se,M as ce,N as le,Q as ue,S as de,X as fe,Z as pe,c as me,ct as O,d as he,j as k,n as ge,st as _e,w as A,y as ve}from"./design-icons-DmYTv2r1.js";import{t as j}from"./createLucideIcon-BHp8sXmF.js";import{l as ye,n as be,y as xe}from"./nav-row-styles-CEA9c88Q.js";import{n as Se,r as Ce}from"./diff-controls-BHF0Pvdc.js";import{i as we,r as Te,t as Ee}from"./git-toolbar-D0mTYtOj.js";import{t as M}from"./info-DA1x_4bz.js";import{a as De,i as N}from"./format-BNCkW110.js";import{a as Oe,l as ke,n as Ae,t as je}from"./control-locations-CD2r0mMU.js";import{t as P}from"./project-router-BLO2IxbU.js";import{t as F}from"./centered-state-BmsqxbI8.js";import{i as I,l as Me,p as Ne,r as Pe,t as Fe}from"./dropdown-menu-CjLqyqwB.js";import{a as L,c as R,i as z,n as B,o as V,r as H,s as U,t as W}from"./alert-dialog-h-3h9B4l.js";import{Bt as G,C as Ie,E as Le,S as Re,T as ze,Vt as K,_ as Be,b as Ve,bt as He,g as Ue,h as We,ot as q,pr as Ge,v as Ke,w as qe,x as Je,xr as J,y as Ye,zt as Xe}from"./index-D51Su-nT.js";import{t as Ze}from"./markdown-BBDDg-4t.js";import{t as Qe}from"./diff-qq2vW6Xc.js";import{t as $e}from"./commit-diff-panel-DGx2t9Pw.js";var Y=e(c(),1);function et(e,t){let n=d(t),r=n.getQueryCache();return Y.useSyncExternalStore(Y.useCallback(e=>r.subscribe(v.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}var tt=j(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),nt=j(`git-pull-request-create`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 9v12`,key:`1sc30k`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v3`,key:`1jb6z3`}],[`path`,{d:`M18 15v6`,key:`9wciyi`}],[`path`,{d:`M21 18h-6`,key:`139f0c`}]]),X=l();function rt(){let e=i(),t=w(),n=d(),r=et({queryKey:E.repo})>0,a=t.data?.info?t.data:null,o=We(e,a,`screen`);return(0,X.jsxs)(`div`,{"data-route":`repo-git`,"data-slot":`git-screen`,className:be,children:[(0,X.jsxs)(`div`,{className:`mb-[16px] flex items-center gap-[8px]`,children:[(0,X.jsx)(`h1`,{className:s(ye,`min-w-0 flex-1`),children:`Git`}),(0,X.jsx)(`button`,{type:`button`,"data-slot":`git-screen-refresh`,"aria-label":`Refresh the repository`,title:`Refresh the repository`,disabled:r,onClick:()=>{n.invalidateQueries({queryKey:E.repo}),n.invalidateQueries({queryKey:E.worktrees})},className:`-my-2 -mr-[10px] flex size-11 shrink-0 items-center justify-center rounded-md text-soft-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-60`,children:(0,X.jsx)(pe,{size:17,"aria-hidden":`true`,className:s(`size-[17px]`,r&&`motion-safe:animate-spin`)})})]}),a?.info?(0,X.jsx)(`div`,{className:`mb-[16px]`,children:(0,X.jsx)(Ke,{scope:e,repo:a,info:a.info,variant:`screen`},e)}):t.isPending?(0,X.jsx)(`p`,{"data-slot":`git-screen-loading`,role:`status`,className:`mb-[16px] px-[10px] text-[13px] text-soft-foreground`,children:`Loading the checkout…`}):t.isError?(0,X.jsxs)(`p`,{"data-slot":`git-screen-error`,role:`alert`,className:`mb-[16px] px-[10px] text-[13px] text-danger`,children:[`Could not load the repository: `,t.error.message]}):(0,X.jsx)(`p`,{"data-slot":`git-screen-not-git`,className:`mb-[16px] px-[10px] text-[13px] text-soft-foreground`,children:`Not a git repository.`}),t.isPending?null:(0,X.jsx)(Ue,{branch:a?.info?.branch??null,counts:o,variant:`screen`})]})}function Z({entry:e}){return e.keptReason?(0,X.jsx)(`span`,{"data-slot":`branch-kept-reason`,className:`min-w-0 text-[11px] text-soft-foreground`,children:e.keptReason}):null}function it({repo:e,info:t}){let n=x(),r=T(),i=new Map((r.data?.branches??[]).map(e=>[e.name,e])),a=d(),c=S({mutationFn:e=>p({name:e}),onSuccess:async e=>{D(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([a.invalidateQueries({queryKey:E.repo}),a.invalidateQueries({queryKey:E.health})]),a.setQueryData(E.repo,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),a.setQueryData(E.health,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:e=>D(e.message,{tone:`danger`})}),[l,u]=(0,Y.useState)(``),[f,m]=(0,Y.useState)(``),h=f.trim().toLowerCase(),g=Q(e,r.data?.branches),_=h?g.filter(e=>e.toLowerCase().includes(h)):g;return(0,X.jsxs)(`section`,{"data-slot":`repo-branches`,className:`grid min-w-0 grid-cols-1 gap-5 px-[18px] py-[22px] md:grid-cols-[minmax(0,1fr)_290px] md:px-9`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,X.jsx)(`h2`,{className:`sr-only`,children:`Branches`}),(0,X.jsxs)(`label`,{className:`relative block`,children:[(0,X.jsx)(ue,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,X.jsx)(K,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:f,onChange:e=>m(e.target.value),className:`h-11 pl-10`})]}),(0,X.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-4 flex min-w-0 flex-col divide-y divide-border border-t border-border md:max-h-[40rem] md:overflow-y-auto md:overscroll-contain`,children:[_.map(e=>{let n=e===t.branch,r=i.get(e);return(0,X.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":e,"data-branch-class":r?.class,className:`flex min-h-20 flex-col items-start justify-center gap-2 py-3 md:flex-row md:items-center md:justify-start md:py-2.5`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-[8px]`,children:[r?.runId?(0,X.jsx)(P,{to:`/tasks/${r.runId}`,"data-slot":`branch-task-link`,title:r.title?`Open the task ${r.title}`:`Open the task`,className:`min-w-0 truncate rounded-[2px] text-[13px] underline-offset-2 hover:underline focus-visible:outline-2 focus-visible:outline-ring`,children:e}):(0,X.jsx)(`span`,{className:s(`min-w-0 truncate text-[13px]`,n&&`font-normal`),children:e}),r?(0,X.jsx)(lt,{entry:r}):null]}),r?(0,X.jsx)(Z,{entry:r}):null,e.startsWith(`cez/`)&&!n?null:n?(0,X.jsx)(`span`,{"data-slot":`branch-current`,className:`md:ml-auto flex shrink-0 items-center rounded-md bg-accent-strong/10 px-2 py-1.5 text-[12px] font-medium text-accent-text`,children:`Current`}):(0,X.jsxs)(o,{variant:`outline`,size:`sm`,"data-action":`switch-branch`,className:`md:ml-auto h-11`,disabled:c.isPending,onClick:()=>c.mutate(e),children:[(0,X.jsx)(k,{size:16,"aria-hidden":`true`}),`Switch`]})]},e)}),_.length===0?(0,X.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-soft-foreground`,children:[`No branches match “`,f.trim(),`”.`]}):null]})]}),(0,X.jsxs)(`div`,{className:`min-w-0 self-start rounded-xl border border-border bg-card p-5`,children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold`,children:`Create a branch`}),(0,X.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-7 flex flex-col items-stretch gap-3`,onSubmit:e=>{e.preventDefault();let t=l.trim();t&&c.mutate(t,{onSuccess:()=>u(``)})},children:[(0,X.jsx)(`label`,{htmlFor:`new-branch-name`,className:`text-sm font-medium`,children:`Branch name`}),(0,X.jsx)(`p`,{className:`-mt-1 text-xs text-muted-foreground`,children:`Create from the selected base.`}),(0,X.jsx)(K,{id:`new-branch-name`,"aria-label":`New branch name`,placeholder:`new-branch-name`,className:`h-11 bg-background`,value:l,onChange:e=>u(e.target.value)}),(0,X.jsxs)(o,{type:`submit`,variant:`primary`,size:`sm`,className:`min-h-11 self-start`,"data-action":`create-branch`,disabled:!l.trim()||c.isPending,children:[(0,X.jsx)(fe,{size:16,"aria-hidden":`true`}),`Create branch`]})]}),(0,X.jsx)(`p`,{className:`mt-3 border-t border-border pt-4 text-xs leading-relaxed text-muted-foreground`,children:`Switching branches changes your working tree. Review uncommitted changes first.`})]}),n.data?.forge?.available?(0,X.jsx)(at,{}):null]})}function at(){let e=ne({limit:20});return(0,X.jsxs)(`div`,{"data-slot":`repo-prs`,className:`max-w-xl`,children:[(0,X.jsx)(`h2`,{className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Open pull requests`}),e.isPending?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Loading pull requests…`}):e.isError?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`No open pull requests.`}):(0,X.jsx)(`ul`,{className:`mt-2 flex flex-col divide-y divide-border`,children:e.data.prs.map(e=>(0,X.jsx)(ot,{pr:e},e.number))}):(0,X.jsx)(`p`,{"data-slot":`repo-prs-unavailable`,className:`mt-2 text-xs text-soft-foreground`,children:e.data.reason??`The forge is unreachable right now.`})]})}function ot({pr:e}){let t=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(se,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,X.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:[`#`,e.number]}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title}),e.checks?(0,X.jsx)(st,{checks:e.checks}):null]}),n=`flex min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,X.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:a(e.url)?(0,X.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:s(n,`hover:bg-muted`),children:t}):(0,X.jsx)(`span`,{className:n,children:t})})}function st({checks:e}){return(0,X.jsx)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:s(`shrink-0 text-[12px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:e})}var ct={active:`in use`,"not-landed":`not landed`,orphan:`not landed`,merged:`merged`,empty:`empty`,other:`yours`};function lt({entry:e}){return(0,X.jsx)(`span`,{"data-slot":`branch-class`,className:s(`shrink-0 rounded-[4px] border px-[5px] py-[1px] text-[10.5px] leading-[14px]`,e.class===`active`?`border-status-running/40 text-status-running`:e.class===`not-landed`||e.class===`orphan`?`border-inbox-count-foreground/40 text-inbox-count-foreground`:`border-border text-soft-foreground`),children:ct[e.class]})}function Q(e,t){let n=new Set(e.branches);for(let e of t??[])n.add(e.name);return[...n].sort((e,t)=>e.localeCompare(t))}function ut(){let e=ae(),t=q(),[n,r]=(0,Y.useState)(`unified`),[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(null),u=(0,Y.useRef)(null),d=e.isError&&e.error instanceof h&&e.error.status===409,f=e.data?.files??[],p=(0,Y.useMemo)(()=>Te(f),[f]),m=(0,Y.useMemo)(()=>f.some(Ze),[f]),g=t?n:`unified`,_=!t||i;return(0,X.jsxs)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,X.jsxs)(`div`,{"data-slot":`repo-changes-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 px-[18px] py-[22px] md:px-9`,children:[(0,X.jsx)(`span`,{className:`text-sm`,children:e.data?`${e.data.stat.files} files changed ·`:`Uncommitted changes`}),e.data?(0,X.jsx)(Ee,{stat:e.data.stat}):null,(0,X.jsxs)(`span`,{className:`ml-auto flex items-center gap-1`,children:[(0,X.jsx)(`span`,{className:`hidden items-center gap-1 md:flex`,children:(0,X.jsx)(Se,{mode:n,wrap:i,onModeChange:r,onWrapChange:a})}),m?(0,X.jsx)(Ce,{preview:o,onPreviewChange:s}):null]})]}),e.isPending?(0,X.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):e.isError?(0,X.jsx)(F,{icon:d?(0,X.jsx)(A,{size:16}):(0,X.jsx)(O,{size:16}),tone:d?`neutral`:`danger`,heading:`h2`,title:d?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):f.length===0?(0,X.jsx)(F,{icon:(0,X.jsx)(A,{size:16}),tone:`neutral`,heading:`h2`,title:`Working tree clean`,subtitle:`No uncommitted changes in the main working tree. Edits show up here as they happen.`}):(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 md:flex-row md:items-start px-[18px] pb-9 pt-0 [--diff-sticky-top:1rem] md:px-9`,children:[(0,X.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`md:sticky md:top-4 md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] w-full md:w-60 shrink-0 overflow-y-auto overscroll-contain rounded-xl border border-border bg-card p-3.5 lg:w-[250px]`,children:[(0,X.jsx)(`h2`,{className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,X.jsx)(we,{root:p,selected:c,onSelect:e=>{l(e),u.current?.scrollToPath(e)}})]}),(0,X.jsx)(Qe,{files:f,viewRef:u,mode:g,wrap:_,preview:o,className:`min-w-0 flex-1`})]})]})}function dt({repo:e,info:t}){let{sha:r}=n(),i=e.log,a=(0,Y.useMemo)(()=>ze(i),[i]);if(r)return(0,X.jsx)(mt,{sha:r});let o=Ie(e,t),s=o&&o.behind>0?(0,X.jsx)(pt,{info:t,tracking:o}):null;return i.length===0?(0,X.jsxs)(X.Fragment,{children:[s?(0,X.jsx)(`div`,{className:`px-[8px] pt-[12px] md:px-[20px]`,children:s}):null,(0,X.jsx)(F,{icon:(0,X.jsx)(ce,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`})]}):(0,X.jsxs)(`div`,{"data-slot":`repo-commits`,className:`flex flex-col gap-[2px] px-[8px] pt-[12px] pb-[20px] md:px-[20px]`,children:[s,a.map(e=>(0,X.jsxs)(`section`,{"data-slot":`repo-commit-day`,"aria-label":e.label,className:`flex flex-col`,children:[(0,X.jsx)(`h2`,{className:`px-[10px] pt-[14px] pb-[4px] text-[11px] font-medium text-soft-foreground`,children:e.label}),(0,X.jsx)(`ul`,{className:`flex flex-col`,children:e.commits.map(e=>(0,X.jsxs)(`li`,{className:`flex min-h-[52px] items-center gap-[14px] rounded-[6px] hover:bg-sidebar-row-hover`,children:[(0,X.jsxs)(P,{to:`/git/commits/${e.hash}`,"data-slot":`commit-row`,"data-sha":e.hash,className:`flex min-h-[52px] min-w-0 flex-1 flex-col justify-center gap-[3px] rounded-[6px] px-[10px] py-[6px] focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,X.jsx)(`span`,{"data-slot":`commit-row-subject`,className:`truncate text-[13px] text-foreground`,children:e.subject}),(0,X.jsxs)(`span`,{"data-slot":`commit-row-meta`,className:`flex min-w-0 items-center gap-[6px] text-[11px] text-soft-foreground`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono`,children:e.hash}),(0,X.jsxs)(`span`,{className:`truncate`,children:[`· `,e.author,` · `,Le(e.when)]})]})]}),(0,X.jsx)(ft,{source:e.source})]},e.hash))})]},e.label))]})}function ft({source:e}){let t=`hidden max-w-[45%] shrink-0 items-center gap-[5px] pr-[10px] text-[11.5px] text-soft-foreground md:flex`;return e?(0,X.jsxs)(P,{to:`/tasks/${e.runId}`,"data-slot":`commit-source`,"data-source":`task`,"aria-label":`From the task ${e.title}${e.prNumber===null?``:`, pull request #${e.prNumber}`}`,className:s(t,`rounded-[4px] hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`),children:[e.prNumber===null?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(le,{"aria-hidden":`true`,className:`size-[11px] shrink-0 text-merged-text`}),(0,X.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[`PR #`,e.prNumber]})]}),(0,X.jsx)(me,{"aria-hidden":`true`,className:`size-[12px] shrink-0`}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]}):(0,X.jsx)(`span`,{"data-slot":`commit-source`,"data-source":`unknown`,className:t,children:`no task found`})}function pt({info:e,tracking:t}){let n=Ve(i(),e),r=(0,Y.useRef)(null);return(0,X.jsxs)(`div`,{"data-slot":`git-incoming`,className:`mb-[4px] flex min-h-[40px] items-center gap-[8px] rounded-[8px] border border-border px-[10px] py-[6px]`,children:[(0,X.jsx)(tt,{"aria-hidden":`true`,className:`size-[14px] shrink-0 text-inbox-count-foreground`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 text-[12.5px] text-muted-foreground`,children:[t.behind,` commit`,t.behind===1?``:`s`,` on `,t.ref,` `,t.behind===1?`is`:`are`,` not in your checkout yet`]}),(0,X.jsxs)(`button`,{ref:r,type:`button`,"data-action":`repo-pull-incoming`,disabled:!n.hasRemote||n.pulling,onClick:()=>void n.pull(),className:`inline-flex h-[26px] shrink-0 items-center gap-[4px] rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 max-md:h-11 [&>svg]:size-[12px]`,children:[n.pulling?(0,X.jsx)(De,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,X.jsx)(ge,{"aria-hidden":`true`}),`Pull`]}),(0,X.jsx)(Ye,{checkout:n,returnFocus:r})]})}function mt({sha:e}){return(0,X.jsx)($e,{commit:ie(e),sha:e,backTo:q()?`/git`:Je,backLabel:`All recent commits`,slot:`repo-commit`,className:`flex min-h-0 flex-1 flex-col`,diffClassName:`px-4 py-4 [--diff-sticky-top:1rem] md:px-6`})}var ht=`Squash-merged branches may show as not landed without GitHub`;function gt(e){let t=[],n=[],r=[];for(let i of e)if(i.class===`orphan`)r.push(i);else if(i.class!==`not-landed`)continue;else i.pr&&(i.pr.state===`open`||i.pr.state===`draft`)?n.push(i):t.push(i);return[{key:`no-pr`,title:`No pull request`,note:`nobody sees this work until you act`,rows:t},{key:`pr-open`,title:`Pull request open`,rows:n},{key:`deleted`,title:`Task deleted`,note:`this branch is the only copy of the work`,rows:r}].filter(e=>e.rows.length>0)}function _t(e){return e.filter(e=>e.class===`active`&&e.runId!==null&&e.ahead>0&&(e.runStatus===`done`||e.runStatus===`failed`||e.runStatus===`cancelled`)).length}var vt={done:`success`,failed:`danger`,cancelled:`neutral`};function yt(){let e=T(),t=y(),n=i(),r=b(),[a,o]=(0,Y.useState)(null);if(e.isPending)return(0,X.jsx)(`p`,{"data-slot":`not-landed-loading`,role:`status`,className:`px-[28px] py-[20px] text-[13px] text-soft-foreground`,children:`Loading branches…`});if(e.isError)return(0,X.jsx)(F,{icon:(0,X.jsx)(O,{size:16}),tone:`danger`,heading:`h2`,title:`Could not classify the branches`,subtitle:e.error.message});let s=gt(e.data.branches),c=_t(e.data.branches),l=c>0?(0,X.jsxs)(`p`,{"data-slot":`not-landed-retained`,className:`flex items-start gap-[6px] px-[10px] pt-[6px] text-[11.5px] leading-[17px] text-soft-foreground`,children:[(0,X.jsx)(M,{"aria-hidden":`true`,className:`mt-[2.5px] size-[12px] shrink-0`}),(0,X.jsxs)(`span`,{children:[c,` finished task`,c===1?` still has its`:`s still have their`,` worktree and commits not on the base, so `,c===1?`it is`:`they are`,` not listed here.`,` `,`They show here once the worktree is reclaimed in `,(0,X.jsx)(P,{to:Re.cleanup,className:`underline underline-offset-2 hover:text-foreground`,children:`Cleanup`}),`.`]})]}):null,u=new Map((t.data??[]).map(e=>[e.id,e.finishedAt]));return(0,X.jsxs)(Oe,{projectId:n,repoBase:r,requests:s.flatMap(e=>e.rows).flatMap(e=>e.pr?[{projectId:n,kind:`PR`,number:e.pr.number}]:[]),children:[(0,X.jsxs)(`div`,{"data-slot":`repo-not-landed`,className:`flex flex-col gap-[2px] px-[8px] pt-[12px] pb-[calc(90px+env(safe-area-inset-bottom))] md:px-[20px] md:pb-[20px]`,children:[e.data.prStateKnown?null:(0,X.jsx)(bt,{}),l,s.length===0?(0,X.jsx)(F,{icon:(0,X.jsx)(Ge,{size:16}),tone:`neutral`,heading:`h2`,title:c>0?`Nothing else waiting to land`:`Everything landed`,subtitle:c>0?`Every other finished task's commits are on the base branch, or it made none.`:`Every finished task's commits are on the base branch, or it made none.`}):(0,X.jsxs)(X.Fragment,{children:[s.map(e=>(0,X.jsxs)(`section`,{"data-slot":`not-landed-group`,"data-group":e.key,"aria-label":e.title,className:`flex flex-col`,children:[(0,X.jsxs)(`h2`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-[6px] px-[10px] pt-[14px] pb-[6px] text-[11px] text-soft-foreground`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.title}),(0,X.jsx)(`span`,{children:e.rows.length}),e.note?(0,X.jsxs)(`span`,{children:[`· `,e.note]}):null]}),(0,X.jsx)(`ul`,{className:`flex flex-col`,children:e.rows.map(e=>(0,X.jsx)(xt,{entry:e,finishedAt:e.runId?u.get(e.runId):void 0,onDelete:()=>o(e)},e.name))})]},e.key)),(0,X.jsxs)(`p`,{"data-slot":`not-landed-note`,className:`flex items-start gap-[6px] px-[10px] pt-[14px] text-[11.5px] leading-[17px] text-soft-foreground`,children:[(0,X.jsx)(M,{"aria-hidden":`true`,className:`mt-[2.5px] size-[12px] shrink-0`}),`Delete branch is in each row's … menu. It confirms and names the commits it drops. Nothing on this list can be bulk-deleted.`]})]})]}),(0,X.jsx)(Et,{entry:a,onClose:()=>o(null)})]})}function bt({className:e}){return(0,X.jsxs)(`p`,{"data-slot":`git-no-forge`,className:s(`flex items-start gap-[6px] px-[10px] pt-[6px] text-[11.5px] leading-[17px] text-soft-foreground`,e),children:[(0,X.jsx)(M,{"aria-hidden":`true`,className:`mt-[2.5px] size-[12px] shrink-0`}),ht,`.`]})}function xt({entry:e,finishedAt:t,onDelete:n}){return(0,X.jsxs)(`li`,{"data-slot":`not-landed-row`,"data-branch":e.name,"data-branch-class":e.class,className:`flex min-h-[56px] items-center gap-[12px] rounded-[6px] px-[10px] py-[6px] hover:bg-sidebar-row-hover`,children:[(0,X.jsx)(wt,{entry:e,finishedAt:t}),(0,X.jsx)(St,{entry:e}),(0,X.jsx)(Ct,{entry:e,onDelete:n})]})}function St({entry:e}){return(0,X.jsx)(X.Fragment,{children:e.pr?(0,X.jsxs)(`span`,{"data-slot":`not-landed-pr`,className:`hidden shrink-0 items-center gap-[4px] text-[11.5px] text-muted-foreground md:flex`,children:[(0,X.jsx)(Ae,{plain:!0,reference:{kind:`PR`,number:e.pr.number,url:e.pr.url},taskTitle:e.title??e.name,status:e.pr.state===`draft`?`draft`:e.pr.state===`closed`?`closed`:void 0}),(0,X.jsx)(Tt,{entry:e})]}):null})}function Ct({entry:e,onDelete:t}){let n=d(),r=e.class===`orphan`,i=e.pr&&(e.pr.state===`open`||e.pr.state===`draft`)?e.pr:null,a=!r&&e.runId!==null&&!i,o=S({mutationFn:()=>_(e.runId),onSuccess:e=>{D(`Draft PR created — ${e.url}`),n.invalidateQueries({queryKey:E.repoBranches}),n.invalidateQueries({queryKey:E.runs.all})},onError:e=>D(e instanceof h&&e.manual?`${e.message} — ${e.manual}`:e.message,{tone:`danger`})}),c=()=>void navigator.clipboard.writeText(e.name).then(()=>D(`Copied ${e.name}`),()=>D(`Could not copy the branch name`,{tone:`danger`})),l=`inline-flex h-[28px] shrink-0 items-center gap-[5px] rounded-[6px] px-[10px] text-[12px] font-medium text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 [&>svg]:size-[12px]`;return(0,X.jsxs)(X.Fragment,{children:[e.runId?(0,X.jsx)(P,{to:`/tasks/${e.runId}`,"data-action":`not-landed-open`,className:s(l,`hidden border border-border hover:bg-muted md:inline-flex`),children:`Open task`}):null,a?(0,X.jsxs)(`button`,{type:`button`,"data-action":`not-landed-create-pr`,disabled:o.isPending,onClick:()=>o.mutate(),className:s(l,`hidden bg-muted hover:brightness-110 md:inline-flex`),children:[(0,X.jsx)(nt,{"aria-hidden":`true`}),o.isPending?`Creating…`:`Create draft PR`]}):null,r?(0,X.jsxs)(`button`,{type:`button`,"data-action":`not-landed-copy`,onClick:c,className:s(l,`hidden border border-border hover:bg-muted md:inline-flex`),children:[(0,X.jsx)(ve,{"aria-hidden":`true`}),`Copy branch`]}):null,(0,X.jsxs)(Fe,{children:[(0,X.jsx)(Ne,{"data-action":`not-landed-more`,"aria-label":`More actions for ${e.name}`,className:`flex size-[28px] shrink-0 items-center justify-center rounded-[6px] text-soft-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:size-11`,children:(0,X.jsx)(de,{"aria-hidden":`true`,className:`size-[14px]`})}),(0,X.jsxs)(Pe,{align:`end`,className:`w-52`,children:[e.runId?(0,X.jsx)(I,{asChild:!0,className:`md:hidden`,children:(0,X.jsx)(P,{to:`/tasks/${e.runId}`,children:`Open task`})}):null,a?(0,X.jsx)(I,{className:`md:hidden`,disabled:o.isPending,onSelect:()=>o.mutate(),children:`Create draft PR`}):null,(0,X.jsx)(I,{className:s(!r&&`md:hidden`),onSelect:c,children:`Copy branch`}),(0,X.jsx)(Me,{className:`md:hidden`}),(0,X.jsx)(I,{"data-action":`not-landed-delete`,variant:`destructive`,onSelect:t,children:`Delete branch…`})]})]})]})}function wt({entry:e,finishedAt:t}){let n=e.class===`orphan`,r=n?`No task · last commit “${e.lastCommit.subject}”`:e.title??e.name,i=N(t??e.lastCommit.at),a=n||!e.runStatus?i?`${i} ago`:``:`${e.runStatus}${i?` ${i} ago`:``}`;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`flex size-[12px] shrink-0 items-center justify-center`,children:n?(0,X.jsx)(xe,{"aria-label":`Task deleted`,className:`size-[12px] text-soft-foreground`}):(0,X.jsx)(He,{tone:e.runStatus&&vt[e.runStatus]||`neutral`,"aria-label":e.runStatus??void 0})}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[3px]`,children:[e.runId?(0,X.jsx)(P,{to:`/tasks/${e.runId}`,"data-slot":`not-landed-title`,className:`min-w-0 truncate rounded-[2px] text-[13px] text-foreground hover:underline underline-offset-2 focus-visible:outline-2 focus-visible:outline-ring`,children:r}):(0,X.jsx)(`span`,{"data-slot":`not-landed-title`,className:`min-w-0 truncate text-[13px] text-muted-foreground`,title:r,children:r}),(0,X.jsxs)(`span`,{"data-slot":`not-landed-meta`,className:`flex min-w-0 items-center gap-[6px] text-[11px] text-soft-foreground`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-muted-foreground`,children:e.name}),(0,X.jsxs)(`span`,{className:`shrink-0`,children:[`· `,e.ahead,` commit`,e.ahead===1?``:`s`]}),e.diffStat?(0,X.jsxs)(`span`,{className:`flex shrink-0 gap-[4px] tabular-nums`,children:[(0,X.jsxs)(`span`,{className:`text-success`,children:[`+`,e.diffStat.additions]}),(0,X.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.diffStat.deletions]})]}):null,a?(0,X.jsxs)(`span`,{className:`truncate`,children:[`· `,a]}):null]}),(0,X.jsx)(Z,{entry:e})]})]})}function Tt({entry:e}){let t=te(ke(`PR`,e.pr?.number).status),n=e.pr?.state;return(0,X.jsxs)(`span`,{"data-slot":`not-landed-pr-state`,children:[`· `,n===`draft`||n===`closed`?n:t?t.label.toLowerCase():`open`]})}function Et({entry:e,onClose:t}){let n=d(),[r,i]=(0,Y.useState)(``),a=(0,Y.useId)(),o=S({mutationFn:e=>f({names:[e],confirm:e}),onSuccess:e=>{let t=e.dropped?.length??0;D(e.deleted.length>0?`Deleted ${e.deleted[0]}${t?` and ${t} commit${t===1?``:`s`} with it`:``}`:e.refused[0]?.reason??`Nothing was deleted`),n.invalidateQueries({queryKey:E.repo}),s()},onError:e=>D(e.message,{tone:`danger`})}),s=()=>{i(``),t()},c=e!==null&&r.trim()===e.name,l=e&&`${e.ahead} commit${e.ahead===1?``:`s`}`;return(0,X.jsx)(W,{open:e!==null,onOpenChange:e=>!e&&!o.isPending&&s(),children:(0,X.jsxs)(z,{"data-slot":`delete-branch-dialog`,children:[(0,X.jsxs)(U,{children:[(0,X.jsxs)(R,{children:[`Delete `,e?.name,`?`]}),(0,X.jsx)(L,{asChild:!0,children:(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`p`,{children:e?.class===`orphan`?`Its task was deleted, so this branch is the only copy of the work.`:(0,X.jsxs)(X.Fragment,{children:[`This drops the work of `,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:e?.title??e?.name}),`. It is not on the base branch`,e?.pr?``:` and no pull request carries it`,`.`]})}),(0,X.jsxs)(`p`,{"data-slot":`delete-branch-dropped`,children:[l,` will be dropped`,e?.diffStat?` (+${e.diffStat.additions} −${e.diffStat.deletions})`:``,`, the latest “`,e?.lastCommit.subject,`”`,` `,`(`,(0,X.jsx)(`span`,{className:`font-mono`,children:e?.lastCommit.sha.slice(0,7)}),`).`]})]})})]}),(0,X.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),c&&e&&o.mutate(e.name)},className:`flex flex-col gap-[6px]`,children:[(0,X.jsxs)(`label`,{htmlFor:a,className:`text-[12.5px] text-muted-foreground`,children:[`Type `,(0,X.jsx)(`span`,{className:`font-mono text-foreground`,children:e?.name}),` to confirm`]}),(0,X.jsx)(K,{id:a,"data-slot":`delete-branch-confirm`,autoComplete:`off`,spellCheck:!1,value:r,onChange:e=>i(e.target.value),className:`h-11 font-mono`})]}),(0,X.jsxs)(V,{children:[(0,X.jsx)(H,{className:`h-11`,disabled:o.isPending,children:`Keep it`}),(0,X.jsx)(B,{"data-action":`delete-branch-confirm`,className:`h-11 bg-danger text-danger-foreground hover:brightness-[0.96]`,disabled:!c||o.isPending,onClick:t=>{t.preventDefault(),e&&o.mutate(e.name)},children:o.isPending?`Deleting…`:`Delete branch`})]})]})})}function Dt({base:e}){let t=T(),n=d(),[r,i]=(0,Y.useState)({merged:!1,empty:!1}),[a,o]=(0,Y.useState)(!1),s=(t.data?.branches??[]).filter(e=>e.class===`merged`),c=(t.data?.branches??[]).filter(e=>e.class===`empty`),l=[...s,...c],u=S({mutationFn:e=>f({names:e}),onSuccess:e=>{let t=e.refused.length;D(`Deleted ${e.deleted.length} branch${e.deleted.length===1?``:`es`}${t?`; kept ${t} that ${t===1?`is`:`are`} no longer safe to delete`:``}`),n.invalidateQueries({queryKey:E.repo})},onError:e=>{n.invalidateQueries({queryKey:E.repo}),D(e.message,{tone:`danger`})}});if(t.isPending)return(0,X.jsx)(`p`,{"data-slot":`cleanup-branches-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading branches…`});if(t.isError)return(0,X.jsxs)(`p`,{"data-slot":`cleanup-branches-error`,className:`text-[13px] text-danger`,children:[`Branches did not load: `,t.error.message]});let p=l.length,m=`branch${p===1?``:`es`}`;return(0,X.jsxs)(`section`,{"data-slot":`cleanup-branches`,"aria-labelledby":`cleanup-branches-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsxs)(`h2`,{id:`cleanup-branches-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Branches safe to delete · `,p]}),(0,X.jsxs)(`p`,{className:`text-[11.5px] leading-[17px] text-soft-foreground`,children:[`Their work is already on `,e,`, or they have none. Deleting loses nothing.`]})]}),(0,X.jsxs)(`button`,{type:`button`,"data-action":`cleanup-branches-delete`,disabled:p===0||u.isPending,onClick:()=>o(!0),className:`inline-flex h-[28px] shrink-0 items-center gap-[5px] self-start rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100 max-md:h-11 md:self-center`,children:[(0,X.jsx)(_e,{"aria-hidden":`true`,className:`size-[12px]`}),u.isPending?`Deleting…`:`Delete ${p} ${m}`]})]}),(0,X.jsx)($,{kind:`merged`,title:`Merged into ${e}`,hint:t.data.prStateKnown?`including squash-merged PRs, read from the PR state`:ht.toLowerCase(),rows:s,open:r.merged,onToggle:()=>i(e=>({...e,merged:!e.merged}))}),(0,X.jsx)($,{kind:`empty`,title:`Empty`,hint:`no commits beyond the fork point`,rows:c,open:r.empty,onToggle:()=>i(e=>({...e,empty:!e.empty}))}),(0,X.jsx)(W,{open:a,onOpenChange:o,children:(0,X.jsxs)(z,{children:[(0,X.jsxs)(U,{children:[(0,X.jsxs)(R,{children:[`Delete `,p,` `,m,`?`]}),(0,X.jsxs)(L,{children:[s.length,` merged into `,e,` and `,c.length,` empty. Their work is already on `,e,`, or they have none. Anything that stopped being safe since this list loaded is kept.`]})]}),(0,X.jsxs)(V,{children:[(0,X.jsx)(H,{children:`Keep them`}),(0,X.jsxs)(B,{"data-action":`cleanup-branches-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{u.mutate(l.map(e=>e.name)),o(!1)},children:[`Delete `,p,` `,m]})]})]})})]})}function $({kind:e,title:t,hint:n,rows:r,open:i,onToggle:a}){let o=`cleanup-branches-${e}`;return(0,X.jsxs)(`div`,{"data-slot":`cleanup-branch-group`,"data-group":e,className:`border-b border-border last:border-0`,children:[(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":i,"aria-controls":o,disabled:r.length===0,onClick:a,className:`flex min-h-[44px] w-full items-center gap-[12px] px-[14px] py-[4px] text-left hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring disabled:hover:bg-transparent`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsxs)(`span`,{className:`truncate text-[12.5px] text-foreground`,children:[t,` · `,r.length]}),(0,X.jsx)(`span`,{className:`truncate text-[11px] text-soft-foreground`,children:n})]}),r.length>0?(0,X.jsx)(he,{"aria-hidden":`true`,className:s(`size-[13px] shrink-0 text-soft-foreground transition-transform motion-reduce:transition-none`,i&&`rotate-90`)}):null]}),i?(0,X.jsx)(`ul`,{id:o,"aria-label":t,className:`flex flex-col pb-[6px]`,children:r.map(e=>(0,X.jsxs)(`li`,{"data-slot":`cleanup-branch-row`,"data-branch":e.name,className:`flex min-h-[32px] items-center gap-[10px] px-[14px] pl-[26px] text-[11.5px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-muted-foreground`,children:e.name}),e.runId?(0,X.jsx)(P,{to:`/tasks/${e.runId}`,className:`min-w-0 flex-1 truncate text-soft-foreground underline-offset-2 hover:text-foreground hover:underline`,children:e.title??`Open the task`}):(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-soft-foreground`,children:e.lastCommit.subject}),e.pr?(0,X.jsxs)(`span`,{className:`shrink-0 text-soft-foreground`,children:[`PR #`,e.pr.number]}):null,(0,X.jsx)(`span`,{className:`shrink-0 tabular-nums text-soft-foreground`,children:N(e.lastCommit.at)})]},e.name))}):null]})}function Ot(){let e=re(),t=ee().data?.targets.find(e=>e.id===`finder`),n=S({mutationFn:e=>u(e,t.id),onError:e=>D(e.message,{tone:`danger`})}),r=d(),[i,a]=(0,Y.useState)(!1),o=()=>Promise.all([r.invalidateQueries({queryKey:E.worktrees}),r.invalidateQueries({queryKey:E.repoBranches})]),s=S({mutationFn:e=>m(),onSuccess:(e,t)=>{o();let n=e.reclaimed.length,r=Math.max(0,t-n);D(n===0?r>0?`Nothing was reclaimed — the worktrees past the keep limit have uncommitted work or are in use`:`Nothing to reclaim — no finished worktrees exceed the keep limit`:`Reclaimed ${n} worktree${n===1?``:`s`} (branch kept)${r>0?` · ${r} kept: uncommitted work or in use`:``}`)},onError:e=>D(e.message,{tone:`danger`})}),c=S({mutationFn:e=>g(e.runId),onSuccess:(e,t)=>{o(),D(`Reclaimed the worktree of ${t.title} (branch kept)`)},onError:e=>{o(),D(e.message,{tone:`danger`})}});if(e.isPending)return(0,X.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading worktrees…`});if(e.isError)return(0,X.jsxs)(`p`,{"data-slot":`worktrees-error`,className:`text-[13px] text-danger`,children:[`Worktrees did not load: `,e.error.message]});let{worktrees:l,totalBytes:f,keep:p}=e.data,h=s.isPending||c.isPending,_=l.filter(e=>e.pastKeep),v=_.length>0,y=_.some(e=>e.sizeBytes===null)?null:_.reduce((e,t)=>e+(t.sizeBytes??0),0),b=v?y?`Reclaim ${C(y)} now`:`Reclaim ${_.length} now`:`Reclaim now`,x=f?C(f):null;return(0,X.jsxs)(`section`,{"data-slot":`worktrees-panel`,"aria-labelledby":`worktrees-panel-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsxs)(`h2`,{id:`worktrees-panel-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Worktrees on disk`,x?` · ${x}`:``]}),(0,X.jsxs)(`p`,{"data-slot":`worktrees-retention`,className:`text-[11.5px] leading-[17px] text-soft-foreground`,children:[p===0?`Retention is unlimited (`:`Retention keeps the newest ${p} finished checkout${p===1?``:`s`} (`,(0,X.jsx)(P,{to:`/settings/worktrees`,"data-slot":`worktrees-retention-link`,className:`underline-offset-2 hover:text-foreground hover:underline`,children:je(`worktrees`,` › `)}),p===0?`), so nothing is reclaimed on its own.`:`) and reclaims the rest.`,` `,`Reclaim removes the directory only; the branch stays, so its work stays recoverable.`]})]}),(0,X.jsxs)(`button`,{type:`button`,"data-action":`worktrees-reclaim-now`,disabled:h||!v,title:v?void 0:`Nothing past the keep limit to reclaim`,onClick:()=>a(!0),className:`inline-flex h-[28px] shrink-0 items-center gap-[5px] self-start rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100 max-md:h-11 md:self-center`,children:[(0,X.jsx)(J,{"aria-hidden":`true`,className:`size-[12px]`}),b]})]}),l.length===0?(0,X.jsx)(`p`,{"data-slot":`worktrees-empty`,className:`px-[14px] py-[12px] text-[12.5px] text-soft-foreground`,children:`No task worktrees on disk.`}):(0,X.jsx)(`ul`,{"aria-label":`Task worktrees on disk`,className:`flex flex-col`,children:l.map(e=>(0,X.jsx)(jt,{worktree:e,keep:p,disabled:h,onOpen:t?()=>n.mutate(e.runId):void 0,opening:n.isPending,onReclaim:()=>c.mutate(e)},e.runId))}),(0,X.jsx)(W,{open:i,onOpenChange:a,children:(0,X.jsxs)(z,{children:[(0,X.jsxs)(U,{children:[(0,X.jsx)(R,{children:`Reclaim old worktrees?`}),(0,X.jsxs)(L,{children:[_.length,` finished worktree`,_.length===1?``:`s`,` beyond the keep limit`,y?` (${C(y)})`:``,` `,_.length===1?`is`:`are`,` reclaimed now, directory only. Their branches are kept, so the work stays recoverable.`]})]}),(0,X.jsxs)(V,{children:[(0,X.jsx)(H,{children:`Keep them`}),(0,X.jsx)(B,{"data-action":`worktrees-confirm`,onClick:()=>{s.mutate(_.length),a(!1)},children:b})]})]})})]})}var kt=new Set([`queued`,`running`,`waiting`,`review`]);function At(e,t){return kt.has(e.status)||!e.reclaimable?{label:`in use`,tone:`in-use`}:e.pastKeep?{label:`reclaimable`,tone:`plain`}:{label:t>0?`kept · newest ${t}`:`kept`,tone:`plain`}}function jt({worktree:e,keep:t,disabled:n,onOpen:r,opening:i,onReclaim:a}){let o=At(e,t),c=N(e.finishedAt??void 0),l=e.status===`review`?`at review`:c?`${e.status} ${c} ago`:e.status,u=(0,X.jsx)(`span`,{"data-slot":`worktree-state`,"data-state":o.tone===`in-use`?`in-use`:e.pastKeep?`reclaimable`:`kept`,className:s(`text-[11.5px]`,o.tone===`in-use`?`text-status-running`:`text-soft-foreground`),children:o.label}),d=`flex size-[28px] shrink-0 items-center justify-center rounded-[6px] text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 max-md:size-11`;return(0,X.jsxs)(`li`,{"data-slot":`worktree-row`,"data-run":e.runId,className:`flex min-h-[44px] items-center gap-[12px] border-b border-border px-[14px] py-[4px] last:border-0`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsx)(`span`,{className:`truncate text-[12.5px] text-foreground`,title:e.title,children:e.title}),(0,X.jsxs)(`span`,{className:`truncate font-mono text-[10.5px] text-soft-foreground`,children:[e.branch??e.runId.slice(0,8),` · `,l,(0,X.jsxs)(`span`,{className:`md:hidden`,children:[` · `,o.label]})]})]}),(0,X.jsx)(`span`,{"data-slot":`worktree-size`,className:`shrink-0 text-[11.5px] tabular-nums text-muted-foreground`,children:e.sizeBytes===null?`—`:C(e.sizeBytes)||`0 kB`}),(0,X.jsx)(`span`,{className:`hidden shrink-0 md:inline`,children:u}),r?(0,X.jsx)(`button`,{type:`button`,className:d,"aria-label":`Open folder for ${e.title}`,title:`Open folder`,disabled:i,onClick:r,children:(0,X.jsx)(oe,{"aria-hidden":`true`,className:`size-[13px]`})}):null,o.tone===`in-use`?null:(0,X.jsx)(`button`,{type:`button`,"data-action":`worktree-reclaim`,"aria-label":`Reclaim the worktree of ${e.title} (branch kept)`,title:`Reclaim the directory (branch kept)`,disabled:n,onClick:a,className:d,children:(0,X.jsx)(J,{"aria-hidden":`true`,className:`size-[13px]`})})]})}function Mt({section:e,index:n=!1}){let i=w(),a=q(),[o]=t();if(n&&!a&&o.get(`view`)!==`repo`)return(0,X.jsx)(rt,{});if(i.isPending)return(0,X.jsx)(Xe,{});if(i.isError)return(0,X.jsxs)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:[(0,X.jsx)(G,{}),(0,X.jsx)(F,{icon:(0,X.jsx)(O,{size:16}),tone:`danger`,title:`Could not load the repository`,subtitle:i.error.message})]});let s=i.data.info;return s?(0,X.jsx)(Nt,{repo:i.data,info:s,section:e}):(0,X.jsxs)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:[(0,X.jsx)(G,{}),(0,X.jsx)(F,{icon:(0,X.jsx)(k,{size:16}),tone:`neutral`,title:`Not a git repository`,subtitle:`${r(`cezar`)} is running outside a git repository — start it inside one to browse changes, commits and branches.`})]})}function Nt({repo:e,info:t,section:n}){return(0,X.jsxs)(`div`,{"data-route":`repo-git`,"data-git-section":n,className:`flex min-h-full flex-col`,children:[(0,X.jsx)(G,{}),(0,X.jsxs)(`header`,{"data-slot":`repo-header`,className:`flex flex-col gap-1 px-[18px] pt-[18px] md:min-h-[61px] md:flex-row md:items-center md:gap-[10px] md:border-b md:border-border md:px-7 md:py-4`,children:[(0,X.jsx)(`h1`,{className:`min-w-0 flex-1 truncate text-2xl font-semibold tracking-tight md:text-[15px] md:tracking-normal`,children:Be(n,t.branch)}),(0,X.jsx)(`p`,{"data-slot":`repo-meta`,className:`min-w-0 truncate text-[12px] text-soft-foreground md:text-[11.5px]`,children:(0,X.jsx)(Pt,{repo:e,info:t,section:n})})]}),n===`main`?(0,X.jsx)(dt,{repo:e,info:t}):n===`not-landed`?(0,X.jsx)(yt,{}):n===`cleanup`?(0,X.jsxs)(`div`,{"data-slot":`repo-cleanup`,className:`flex flex-col gap-[16px] px-[18px] pt-[12px] pb-[calc(90px+env(safe-area-inset-bottom))] md:px-[20px] md:pb-[20px]`,children:[(0,X.jsx)(Ot,{}),(0,X.jsx)(Dt,{base:e.baseBranch??t.branch})]}):n===`branches`?(0,X.jsx)(it,{repo:e,info:t}):(0,X.jsx)(ut,{})]})}function Pt({repo:e,info:t,section:n}){let r=e.baseBranch??t.branch;switch(n){case`main`:return(0,X.jsxs)(X.Fragment,{children:[e.log.length===0?`no commits yet`:`latest ${e.log.length} commit${e.log.length===1?``:`s`} in the main checkout`,e.tracking?` · ${qe(e.tracking)}`:``]});case`not-landed`:return(0,X.jsxs)(X.Fragment,{children:[`finished tasks whose commits are not on `,r]});case`branches`:return(0,X.jsx)(Ft,{repo:e,info:t});case`changes`:return(0,X.jsxs)(X.Fragment,{children:[e.status.length,` uncommitted file`,e.status.length===1?``:`s`,` in the main checkout`]});case`cleanup`:return(0,X.jsxs)(X.Fragment,{children:[`nothing here can delete work that is not on `,r]})}}function Ft({repo:e,info:t}){let n=Q(e,T().data?.branches).length;return(0,X.jsxs)(X.Fragment,{children:[n,` branch`,n===1?``:`es`,` · on `,t.branch]})}export{Mt as RepoGitRoute};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{C as t,D as n,E as r,h as i,p as a,t as o,w as s}from"./button-CS5tOblf.js";import{i as c,t as l}from"./react-runtime-CCIEwYL0.js";import{i as u,s as d}from"./project-scope-context-DbO9a0ii.js";import{C as f,u as p}from"./queries-C_DEjjv2.js";import{ct as m,r as h}from"./design-icons-DmYTv2r1.js";import{c as g,i as _,l as v,o as y,s as b,t as x}from"./file-preview-YiP5f666.js";import{t as S}from"./centered-state-BmsqxbI8.js";import{At as C,Ot as w,kt as T,nn as E}from"./index-D51Su-nT.js";var D=e(c(),1),O=l();function k(){let e=t(),n=s();return()=>{if(e.key==="default"||window.history.state?.idx===0){n({pathname:e.pathname.replace(/\/report\/?$/,``)},{replace:!0});return}let t=window.navigation,r=A(e.state);t?.canGoBack?t.back():r?n(r,{state:{filesRestoreKey:e.state?.filesRestoreKey}}):n(-1)}}function A(e){let t=e?.readerFrom;return typeof t==`string`&&t.startsWith(`/`)&&!t.startsWith(`//`)?t:null}function j(e){return e?.type===`file`?e:null}function M(){let[e]=n(),t=e.get(`path`),r=e.get(`artifact`);return{path:t,artifactId:r,conflict:e.getAll(`path`).length>1||e.getAll(`artifact`).length>1||t!==null&&r!==null||t===``||r===``}}function N(){let{id:e=``}=r(),n=M(),i=t(),a=k();return(0,O.jsx)(P,{runId:e,selection:n,fragment:i.hash,onBack:a,variant:`route`})}function P({runId:e,selection:n,fragment:r,onBack:a,variant:o,sourceLookup:s}){let{path:c,conflict:l,selected:u,result:d}=I(e,n,s),f=C(w,!0),p=C(T,!1),m=t(),[h,g]=(0,D.useState)(!1),_=j(d.data);if(o===`route`&&L(_))return(0,O.jsx)(i,{replace:!0,to:{pathname:m.pathname.replace(/\/report\/?$/,`/files`),search:m.search,hash:m.hash}});let v=z(_,c),y=o===`pane`&&!p&&!f?`Conversation`:`Back`,b=o===`pane`&&!h&&R(_),x=F(m.pathname,e,n);return(0,O.jsxs)(`div`,{"data-route":`task-report`,"data-variant":o,onKeyDown:e=>{o!==`pane`||e.key!==`Escape`||e.defaultPrevented||(e.preventDefault(),e.stopPropagation(),a())},className:o===`route`?`fixed inset-0 z-50 flex flex-col bg-background [padding-block-start:env(safe-area-inset-top)] [padding-inline-end:env(safe-area-inset-right)] [padding-block-end:env(safe-area-inset-bottom)] [padding-inline-start:env(safe-area-inset-left)] md:static md:z-auto md:h-full md:p-0`:`flex h-full min-h-0 flex-col bg-background max-md:[padding-block-start:env(safe-area-inset-top)] max-md:[padding-inline-start:env(safe-area-inset-left)] max-md:[padding-inline-end:env(safe-area-inset-right)]`,children:[(0,O.jsx)(B,{runId:e,file:_,name:v,source:h,onSource:()=>g(e=>!e),onBack:a,backLabel:y,hideDownload:o===`pane`&&p,focusBack:o===`pane`}),(0,O.jsx)(`div`,{"data-slot":`report-body`,className:b?`flex min-h-0 flex-1 flex-col overflow-clip`:`flex min-h-0 flex-1 flex-col overflow-auto`,children:(0,O.jsx)(V,{conflict:l,selected:u,result:d,source:h,name:v,fragment:r,pane:o===`pane`,filesHref:x})})]})}function F(e,t,n){let r=/^\/p\/[^/]+/.exec(e)?.[0]??``,i=n.artifactId?new URLSearchParams({artifact:n.artifactId}):new URLSearchParams({path:n.path??``});return`${r}/tasks/${encodeURIComponent(t)}/files?${i}`}function I(e,t,n){let{path:r=null,artifactId:i=null,conflict:a=!1}=t,o=n?.isPending||n?.isError,s=f(e,i||a||o?null:r),c=p(e,a||o?null:i),l=o&&n?{...n,data:void 0}:i?c:s;return{path:r,conflict:a,selected:r!==null||i!==null,result:l}}function L(e){return e!==null&&(!E(e.path)||!e.artifact&&(e.tooLarge||e.binary))}function R(e){return e!==null&&!e.tooLarge&&!e.binary}function z(e,t){return e?e.artifact?.name??e.path.split(/[\\/]/).at(-1)??e.path:t??`Report`}function B({runId:e,file:t,name:n,source:r,onSource:i,onBack:a,backLabel:s,hideDownload:c,focusBack:l}){let u=(0,D.useRef)(null);(0,D.useEffect)(()=>{l&&u.current?.focus({preventScroll:!0})},[l]);let f=t?.artifact;return(0,O.jsxs)(`header`,{"data-slot":`report-bar`,className:`flex min-h-14 shrink-0 items-center gap-2 border-b border-border bg-card px-2 md:px-4`,children:[(0,O.jsxs)(o,{ref:u,variant:`ghost`,className:`min-h-11 min-w-11 gap-1.5 px-2`,onClick:a,"aria-label":s,children:[(0,O.jsx)(h,{size:18,"aria-hidden":`true`}),(0,O.jsx)(`span`,{className:`max-sm:sr-only`,children:s})]}),(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsx)(`h1`,{className:`truncate text-sm font-medium`,children:n}),t?(0,O.jsxs)(`p`,{className:`truncate text-xs text-soft-foreground`,children:[f?`Published snapshot · ${new Date(f.createdAt).toLocaleString()}`:`Live file`,` · `,_(t.size)]}):null]}),t&&!t.tooLarge&&!t.binary?(0,O.jsx)(o,{variant:`ghost`,className:`min-h-11 px-3 text-accent-text`,onClick:i,children:r?`Preview`:`Source`}):null,f&&!c?(0,O.jsx)(`a`,{className:`inline-flex min-h-11 items-center rounded-md px-3 text-sm text-accent-text underline focus-visible:ring-2`,href:d(e,f.id,`download`),children:`Download`}):null]})}function V({conflict:e,selected:t,result:n,source:r,name:i,fragment:o,pane:s,filesHref:c}){if(e)return(0,O.jsx)(U,{icon:(0,O.jsx)(b,{}),title:`Invalid report link`,subtitle:`Choose either a path or a published artifact.`});if(!t)return(0,O.jsx)(U,{icon:(0,O.jsx)(g,{}),title:`No report selected`,subtitle:`Open a report from a link in the conversation or from Files.`});if(n.isPending)return(0,O.jsx)(`p`,{role:`status`,"data-slot":`report-loading`,className:`px-4 py-6 text-center text-sm text-soft-foreground`,children:`Loading report…`});if(n.isError)return(0,O.jsx)(H,{result:n});let l=n.data;return l.type===`file`?s&&!E(l.path)?(0,O.jsx)(U,{icon:(0,O.jsx)(g,{}),title:`Not an HTML report`,subtitle:`Open this published file in Files.`,action:(0,O.jsx)(a,{to:c,className:`inline-flex min-h-11 items-center rounded-md px-3 text-sm text-accent-text underline active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:`Open in Files`})}):l.tooLarge?(0,O.jsx)(U,{icon:(0,O.jsx)(v,{}),title:`Too large to preview`,subtitle:`${_(l.size)} is past the 500 kB preview limit. Download it to read it.`}):l.binary?(0,O.jsx)(U,{icon:(0,O.jsx)(g,{}),title:`Binary file`,subtitle:`This file holds binary data, not readable HTML.`}):r?(0,O.jsx)(`div`,{className:`bg-card`,children:(0,O.jsx)(x,{path:l.path,text:l.content??``})}):(0,O.jsx)(y,{html:l.content??``,title:`Report: ${i}`,fragment:o,className:s?`min-h-0 flex-1`:`min-h-[60dvh] flex-1`}):(0,O.jsx)(U,{icon:(0,O.jsx)(b,{}),title:l.type===`unpublished`?`Report not published`:`Report unavailable`,subtitle:l.reason})}function H({result:e}){let t=e.error instanceof u&&e.error.status===404;return(0,O.jsx)(U,{icon:t?(0,O.jsx)(b,{}):(0,O.jsx)(m,{size:16}),tone:t?`neutral`:`danger`,title:t?`Report missing or deleted`:`Could not load this report`,subtitle:e.error?.message??`Try again.`,action:(0,O.jsx)(o,{variant:`outline`,className:`min-h-11`,onClick:()=>void e.refetch(),children:`Retry`})})}function U({icon:e,title:t,subtitle:n,tone:r=`neutral`,action:i}){return(0,O.jsxs)(`div`,{"data-slot":`report-state`,className:`flex flex-col items-center gap-3 p-6`,children:[(0,O.jsx)(S,{icon:e,tone:r,heading:`h2`,title:t,subtitle:n}),i]})}export{P as ReportReader,N as TaskReportRoute};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{C as t,I as n,M as r,T as i,t as a}from"./button-CS5tOblf.js";import{i as o,t as s}from"./react-runtime-CCIEwYL0.js";import{Dr as c,Jn as l,Kr as u,Rt as d,Tr as f,f as p,wn as m}from"./project-scope-context-DbO9a0ii.js";import{$ as h,J as g,X as _,Z as v,ct as y,et as b,rt as x,st as S}from"./live-protocol-BVn0UA_g.js";import{t as C}from"./useInfiniteQuery-DCWsxLiy.js";import{n as w,t as T}from"./ws-BXdlGFIZ.js";import{t as E}from"./project-router-BLO2IxbU.js";import{Nt as D,Vt as O}from"./index-D51Su-nT.js";import{t as k}from"./report-title-D4Mbu2Er.js";var A=e(o(),1),j=1e3,M=x().min(1).max(1024);b({q:x().max(j).optional(),before:M.optional(),limit:x().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()}).strict();var N=b({reports:g(b({id:S(),runId:S(),name:x(),title:x(),createdAt:y(),size:h().int().nonnegative(),taskTitle:x(),taskStatus:l}).strict()),nextCursor:M.nullable(),total:h().int().nonnegative()}).strict(),P=b({epoch:S(),generation:h().int().nonnegative(),metadataGeneration:h().int().nonnegative()}).strict(),F=b({runId:S(),taskTitle:x(),taskStatus:l}).strict(),I=_(`type`,[P.extend({type:v(`snapshot`)}),P.extend({type:v(`content`)}),P.extend({type:v(`metadata`),runs:g(F)})]),L=new WeakMap;function R(e,t){if(!e)return{content:t.type===`content`,metadata:t.type===`metadata`,reset:!1};if(e.epoch!==t.epoch)return{content:!0,metadata:!0,reset:!0};if(!(t.generation<e.generation||t.metadataGeneration<e.metadataGeneration)&&!(e.generation===t.generation&&e.metadataGeneration===t.metadataGeneration))return{content:t.generation!==e.generation,metadata:t.metadataGeneration!==e.metadataGeneration,reset:!1}}var z=class{client;project;state;content=0;metadata=0;patches=new Map;trailing=new Set;flights=new Map;constructor(e,t){this.client=e,this.project=t,e.getQueryCache().subscribe(n=>{if(n.type===`removed`){this.trailing.delete(n.query),this.flights.delete(n.query);return}if(!(n.query.queryKey[0]!==t||n.query.queryKey[1]!==`reports`)){if(n.type===`updated`&&n.action.type===`fetch`&&this.flights.set(n.query,this.metadata),n.query.state.fetchStatus===`idle`&&this.flights.has(n.query)){let e=this.flights.get(n.query);this.flights.delete(n.query),e!==this.metadata&&String(n.query.queryKey[2]??``).trim()===``&&this.client.setQueryData(n.query.queryKey,t=>t&&{...t,pages:t.pages.map(t=>this.patch(t,e))})}!this.trailing.has(n.query)||n.query.state.fetchStatus!==`idle`||(this.trailing.delete(n.query),queueMicrotask(()=>{e.invalidateQueries({queryKey:n.query.queryKey,exact:!0,refetchType:`active`},{cancelRefetch:!1})}))}})}patch(e,t=-1){return{...e,reports:e.reports.map(e=>{let n=this.patches.get(e.runId);return n&&n.version>t?{...e,taskTitle:n.value.taskTitle,taskStatus:n.value.taskStatus}:e})}}async read(e,t){for(;;){let n=this.content,r=this.metadata,i=await t();if(!(n!==this.content||e.trim()!==``&&r!==this.metadata))return e.trim()===``?this.patch(i,r):i}}receive(e,t=!1){let n=this.state;if(!n&&e.type===`snapshot`){this.state=e,this.content++,this.client.getQueryCache().findAll({queryKey:[this.project,`reports`]}).some(e=>e.state.data!==void 0)&&this.invalidate(!0);return}let r=R(n,e);if(!r){t&&e.type===`snapshot`&&(this.content++,this.invalidate(!0));return}let{metadata:i,reset:a}=r,o=r.content||t&&e.type===`snapshot`;this.state=e,a&&this.patches.clear(),i&&this.metadata++,o&&this.content++,e.type===`metadata`&&!a&&this.patchCaches(e);let s=o||i&&e.type!==`metadata`;(s||i)&&this.invalidate(s)}patchCaches(e){for(let t of e.runs)this.patches.set(t.runId,{value:t,version:this.metadata});this.client.setQueriesData({queryKey:[this.project,`reports`],predicate:e=>String(e.queryKey[2]??``).trim()===``},e=>e&&{...e,pages:e.pages.map(e=>this.patch(e,this.metadata-1))})}invalidate(e){let t={queryKey:[this.project,`reports`],refetchType:`active`,...e?{}:{predicate:e=>String(e.queryKey[2]??``).trim()!==``}};for(let e of this.client.getQueryCache().findAll(t))e.state.fetchStatus===`fetching`&&this.trailing.add(e);this.client.invalidateQueries(t,{cancelRefetch:!1})}};function B(e,t){let n=L.get(e);n||(n=new Map,L.set(e,n));let r=n.get(t);return r||(r=new z(e,t),n.set(t,r)),r}async function V(e,t){let n=await p.api.v1.p[`:projectId`].reports.state.$get({param:{projectId:e}},d({signal:t}));return P.parse(await m(n,`/reports/state`))}function H(e){let t=B(u(),e);return(0,A.useEffect)(()=>{let n=T(`reports:project:${e}`,e=>{let n=I.safeParse(e);n.success&&t.receive(n.data,n.data.type===`snapshot`)}),r,i,a=()=>{if(f()===`finite`&&!r){i=new AbortController;let n=i.signal;V(e,n).then(e=>{n.aborted||t.receive({type:`snapshot`,...e})}).catch(()=>void 0),r=w({path:`/api/v1/p/${encodeURIComponent(e)}/reports/state`,intervalMs:5e3},(e,n)=>{let r=P.safeParse(e);!n&&r.success&&t.receive({type:`snapshot`,...r.data})})}else f()!==`finite`&&(i?.abort(),r?.(),r=void 0)};a();let o=c(a);return()=>{o(),i?.abort(),r?.(),n()}},[t,e]),t}async function U(e,t,n,r){let i=await p.api.v1.p[`:projectId`].reports.$get({param:{projectId:e},query:{q:t.slice(0,j),...n?{before:n}:{}}},d(r?{signal:r}:void 0));return N.parse(await m(i,`/reports`))}function W(e){let t=r(),n=H(t);return C({queryKey:[t,`reports`,e],initialPageParam:void 0,queryFn:({pageParam:r,signal:i})=>n.read(e,()=>U(t,e,r,i)),getNextPageParam:e=>e.nextCursor??void 0,staleTime:0,refetchOnWindowFocus:!0})}var G=s(),K=new Map;function q(){let e=t(),r=i(),[o,s]=D(),c=(o.get(`q`)??``).slice(0,j),l=W(c),u=(0,A.useRef)(null),d=(0,A.useRef)(``),f=e.pathname+e.search,p=l.data?.pages.flatMap(e=>e.reports)??[];(0,A.useLayoutEffect)(()=>{if(!l.data||d.current===f)return;let t=K.get(f),n=e.state?.filesRestoreKey===f;if(!t||!u.current||r!==`POP`&&!n){d.current=f;return}let i=u.current.querySelector(`[data-report-id="${t.row}"]`);if(l.isFetchNextPageError){d.current=f,u.current.scrollTop=0;return}if((!i||l.data.pages.length<t.pages)&&l.hasNextPage){l.isFetchingNextPage||l.fetchNextPage();return}d.current=f,u.current.scrollTop=i?t.scroll:0,i?.focus({preventScroll:!0})},[f,l.data,l.hasNextPage,l.isFetchingNextPage,l.isFetchNextPageError,l.fetchNextPage,e.state,r]);let m=t=>s(n=>(t?n.set(`q`,t.slice(0,j)):n.delete(`q`),K.delete(e.pathname+`?`+n.toString()),n));return(0,G.jsxs)(`section`,{"data-route":`reports`,className:`flex h-full min-h-0 flex-col`,children:[(0,G.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-3 border-b border-border p-4`,children:[(0,G.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Reports`}),(0,G.jsx)(O,{maxLength:j,"aria-label":`Search reports`,placeholder:`Search reports or source tasks`,value:c,onChange:e=>m(e.target.value),className:`min-h-11`})]}),(0,G.jsxs)(`div`,{ref:u,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4 [scrollbar-gutter:stable]`,children:[l.isPending?(0,G.jsx)(`p`,{role:`status`,children:`Loading reports…`}):l.isError?(0,G.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-3`,children:[(0,G.jsx)(`p`,{children:`Could not load reports`}),(0,G.jsx)(`p`,{className:`text-sm text-soft-foreground`,children:l.error.message}),(0,G.jsx)(a,{className:`min-h-11`,onClick:()=>void l.refetch(),children:`Retry`})]}):p.length===0?(0,G.jsxs)(`div`,{className:`flex flex-col items-start gap-3`,children:[(0,G.jsx)(`h2`,{className:`font-medium`,children:c?`No matching reports`:`No published reports yet`}),c?(0,G.jsx)(a,{"data-slot":`reports-clear-search`,variant:`outline`,className:`min-h-11`,onClick:()=>m(``),children:`Clear search`}):(0,G.jsxs)(`p`,{className:`text-sm text-soft-foreground`,children:[`Publish an HTML snapshot with `,(0,G.jsxs)(`code`,{children:[n(),` artifact publish`]}),` to list it here.`]})]}):(0,G.jsx)(`ul`,{className:`flex flex-col gap-3`,children:p.map(e=>(0,G.jsxs)(`li`,{"data-slot":`report-row`,className:`reports-row rounded-lg border border-border bg-card p-3`,children:[(0,G.jsx)(`h2`,{className:`min-w-0 font-medium [overflow-wrap:anywhere]`,children:(0,G.jsx)(E,{"data-report-id":e.id,className:`reports-open`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:f,filesRestoreKey:f},onClick:()=>K.set(f,{scroll:u.current?.scrollTop??0,row:e.id,pages:l.data?.pages.length??1}),children:k(e)})}),(0,G.jsx)(E,{className:`reports-task text-sm text-accent-text underline [overflow-wrap:anywhere]`,to:`/tasks/${e.runId}`,children:e.taskTitle}),(0,G.jsx)(`time`,{className:`block text-xs text-soft-foreground`,dateTime:e.createdAt,children:new Date(e.createdAt).toLocaleString()})]},e.id))}),l.hasNextPage?(0,G.jsx)(a,{variant:`outline`,className:`min-h-11`,disabled:l.isFetchingNextPage,onClick:()=>void l.fetchNextPage(),children:`Load more reports`}):null]})]})}export{q as ReportsRoute};
@@ -0,0 +1,2 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{E as t,L as n,S as r,d as i,t as a,u as o}from"./button-CS5tOblf.js";import{i as s,t as c}from"./react-runtime-CCIEwYL0.js";import"./live-refetch-C2xZHKkJ.js";import{Bn as l,Gt as u,Kr as d,Kt as ee,Qn as te,Sr as ne,Zn as f,i as p,k as m,o as h}from"./project-scope-context-DbO9a0ii.js";import{$ as re,$t as g,B as ie,Bn as ae,Cn as _,Et as oe,H as se,Hn as ce,J as v,P as le,Qt as y,St as b,U as x,Un as S,Vn as ue,W as de,Zt as fe,an as pe,cn as C,et as me,gt as he,in as ge,n as _e,on as ve,rn as ye,rt as be,xn as xe,z as Se}from"./queries-C_DEjjv2.js";import{n as w}from"./toaster-CRVRHlMR.js";import{I as Ce,S as we,Y as Te,a as T,m as Ee,mt as De,st as Oe,t as ke,u as Ae,y as E}from"./design-icons-DmYTv2r1.js";import{t as D}from"./createLucideIcon-BHp8sXmF.js";import{t as je}from"./app-window-CSHwDX9N.js";import{i as Me,r as Ne,t as Pe}from"./popover-s-Wchzjn.js";import{t as Fe}from"./info-DA1x_4bz.js";import{t as Ie}from"./format-BNCkW110.js";import{t as Le}from"./message-square-B-MD-8rD.js";import{a as Re,n as O,r as ze}from"./control-locations-CD2r0mMU.js";import{c as Be,s as Ve,t as k}from"./project-router-BLO2IxbU.js";import{a as A,i as j,l as M,n as N,p as P,r as F,t as I}from"./dropdown-menu-CjLqyqwB.js";import{a as L,c as R,i as z,n as B,o as V,r as H,s as U,t as W}from"./alert-dialog-h-3h9B4l.js";import{Cr as He,D as Ue,Dt as We,Fn as Ge,Ht as Ke,In as qe,K as Je,Ln as Ye,Mn as Xe,Nn as Ze,O as Qe,Pn as $e,Qt as G,Ut as et,W as tt,Wt as nt,X as rt,Xt as it,_t as at,ar as ot,bt as st,cr as ct,ct as lt,et as K,gt as ut,k as dt,mr as ft,q as pt,rt as mt,sr as ht,st as gt,tt as q,vt as _t,yt as vt}from"./index-D51Su-nT.js";import{t as J}from"./tab-link-CqVqRhuM.js";var yt=D(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),bt=D(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),xt=D(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),Y=e(s(),1),X=c();function St(e){let t=ae();return S({mutationFn:t=>h(ce(e),t),onSuccess:()=>t.invalidateAfter(`runs`,()=>ue()),onError:e=>w(e.message,{tone:`danger`})})}function Ct(e){return e.archived?`Unarchive`:`Archive task`}function wt({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,X.jsx)(W,{open:t,onOpenChange:n,children:(0,X.jsxs)(z,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,X.jsxs)(U,{children:[(0,X.jsx)(R,{children:`Archive task?`}),(0,X.jsxs)(L,{children:[`Move “`,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,title:_(e),children:_(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,X.jsxs)(V,{children:[(0,X.jsx)(H,{children:`Cancel`}),(0,X.jsx)(B,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function Z({run:e,className:t,compactOnMobile:n=!1}){let[r,i]=(0,Y.useState)(!1),s=St(e.id),c=Ct(e);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(a,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":c,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:s.isPending,className:o(`h-11 gap-[7px] px-3`,n&&`max-md:size-11 max-md:px-0`,t),onClick:()=>e.archived?s.mutate(!1):i(!0),children:[e.archived?(0,X.jsx)(He,{"aria-hidden":`true`}):(0,X.jsx)(ke,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:o(n&&`max-md:sr-only`),children:c})]}),(0,X.jsx)(wt,{run:e,open:r,onOpenChange:i,onConfirm:()=>{s.mutate(!0),i(!1)}})]})}function Tt({run:e,action:t,prUrl:n,patch:r}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:t.phase===`blocked`?`Completion blocked`:`Completion pending`}),` · `,t.message||(t.phase===`blocked`?`Completion needs attention.`:`Checking completion actions.`)]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&i(n)?(0,X.jsx)(a,{variant:`outline`,asChild:!0,children:(0,X.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:`Open PR`})}):null,e.autoMergePr?(0,X.jsx)(a,{variant:`outline`,disabled:r.isPending,onClick:()=>r.mutate({autoMergePr:!1},{onError:e=>w(e.message,{tone:`danger`})}),children:r.isPending?`Saving…`:`Disable auto-merge`}):null]})]})}function Et({run:e,blocker:t,flags:n}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:`Archive blocked`}),` · `,t.message]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.runId?(0,X.jsx)(a,{variant:`outline`,asChild:!0,children:(0,X.jsx)(k,{to:`/tasks/${t.runId}`,children:`Open blocking task`})}):null,t.pullRequestUrl&&i(t.pullRequestUrl)?(0,X.jsx)(a,{variant:`outline`,asChild:!0,children:(0,X.jsx)(`a`,{href:t.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,children:`Open blocking PR`})}):null,n.archive?(0,X.jsx)(Z,{run:e}):null]})]})}function Dt({run:e}){let t=x(e.id),n=q(e),r=e.status===`done`?e.completionAction:void 0,i=n.archive?e.archiveBlocker:void 0,a=r&&r.phase!==`complete`?r:void 0;if(!a&&!i)return null;let o=e.pullRequestUrl??e.pullRequests?.find(e=>e.url)?.url;return(0,X.jsxs)(`section`,{"data-slot":`completion-status`,"aria-label":`Completion action`,className:`grid min-w-0 gap-2 rounded-lg border border-border bg-card p-3 [margin-block:0.75rem]`,children:[a?(0,X.jsx)(Tt,{run:e,action:a,prUrl:o,patch:t}):null,i?(0,X.jsx)(Et,{run:e,blocker:i,flags:n}):null]})}var Ot=[`running`,`queued`,`waiting`];function kt(e,{queuePosition:t,now:n=new Date}){let r=l(e),i=r.label.charAt(0).toUpperCase()+r.label.slice(1),a=t===void 0?i:`${i} #${t}`,o=Ot.includes(e.status)?jt(e,n):void 0;return o?{attention:r,label:a,nextCheck:o}:{attention:r,label:a}}function At(e){return e.nextCheck?`${e.label} · Next check ${e.nextCheck.text}`:e.label}function jt(e,t){let n;for(let t of Array.isArray(e.waits)?e.waits:[]){if(t?.kind!==`timer`||t.phase!==`open`)continue;let e=new Date(t.deadline);Number.isFinite(e.getTime())&&(!n||e<n)&&(n=e)}if(n)return{at:n.toISOString(),text:Ie(n,t)}}async function Q(e,t){try{await navigator.clipboard.writeText(e),w(t)}catch{w(`Run manually: ${e}`)}}function Mt(e){let t=v(),n=be(),r=(0,Y.useMemo)(()=>C(e,t),[e,t]);return{referenceProjectId:n,repoBase:t,references:r,requests:(0,Y.useMemo)(()=>n===void 0?[]:r.filter(e=>fe(e,t)).map(e=>({projectId:n,kind:e.kind,number:e.number})),[r,n,t])}}function Nt(e){return S({mutationFn:()=>ee(e.id),onError:e=>{if(e instanceof p&&e.command){Q(e.command,`No terminal found — command copied to clipboard.`);return}w(e.message,{tone:`danger`})}})}function $(e,t){let n=se(),r=me(),i=S({mutationFn:t=>u(e.id,t),onError:e=>w(e.message,{tone:`danger`})}),a=ne(r.data),o=e=>!r.isSuccess||a.includes(e??`claude`);return{canResumeHere:t&&o(rt(e)),choices:e.worktreePath?(n.data?.targets??[]).filter(e=>{let t=_t(e.id);return t===void 0||o(t)}).map(t=>({target:t,...pt(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[],open:i}}function Pt({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:o}=$(e,t),s=K(e);return!r&&i.length===0&&!s?null:(0,X.jsxs)(X.Fragment,{children:[r||i.length>0?(0,X.jsxs)(`div`,{className:`task-open-targets flex flex-wrap gap-3`,children:[r?(0,X.jsxs)(a,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,X.jsx)(ot,{}),`Terminal (resume session)`]}):null,i.map(({target:e,suffix:t,title:n})=>{let r=vt(e);return(0,X.jsxs)(a,{variant:`outline`,"data-target":e.id,title:n,disabled:o.isPending,onClick:()=>o.mutate(e.id),children:[(0,X.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,X.jsxs)(a,{variant:`outline`,onClick:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>w(`Worktree path copied`)).catch(()=>w(`Path: ${t}`))},children:[(0,X.jsx)(E,{}),`Copy worktree path`]}):null]}):null,s?(0,X.jsxs)(`div`,{"data-slot":`resume-command`,className:`mt-5 border-t border-border pt-5`,children:[(0,X.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,X.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:s}),(0,X.jsxs)(a,{variant:`outline`,onClick:()=>void Q(s,`Command copied to clipboard.`),children:[(0,X.jsx)(E,{}),`Copy resume command`]})]}):null]})}function Ft({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:o}=$(e,t),s=K(e),c=e.worktreePath;if(!r&&i.length===0&&!s&&!c)return null;let l=`max-md:min-h-11`;return(0,X.jsxs)(`div`,{"data-slot":`workspace-tools`,className:`flex min-w-0 flex-wrap gap-2`,children:[r||i.length>0?(0,X.jsx)(at,{choices:i,onPick:e=>o.mutate(e),disabled:o.isPending,triggerVariant:`outline`,className:l,leading:r?(0,X.jsxs)(j,{"data-target":`terminal-resume`,onSelect:n,children:[(0,X.jsx)(ot,{"aria-hidden":`true`}),`Terminal (resume session)`]}):void 0}):null,c?(0,X.jsxs)(a,{variant:`outline`,size:`sm`,className:l,onClick:()=>void Q(c,`Worktree path copied`),children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Copy worktree path`]}):null,s?(0,X.jsxs)(a,{variant:`outline`,size:`sm`,"data-slot":`resume-command`,title:s,className:l,onClick:()=>void Q(s,`Command copied to clipboard.`),children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Copy resume command`]}):null]})}function It({run:e,canResume:t,onResume:n,onOpen:r,onClose:i}){let{canResumeHere:o,choices:s}=$(e,t);return!o&&s.length===0?null:r?(0,X.jsx)(j,{onSelect:r,children:`Open in…`}):(0,X.jsxs)(`section`,{"aria-label":`Open task worktree in…`,className:`task-action-panel my-5 rounded-xl border border-border bg-card p-6`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,X.jsx)(a,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,X.jsx)(De,{})})]}),e.worktreePath?(0,X.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,X.jsx)(`div`,{className:`mt-4`,children:(0,X.jsx)(Pt,{run:e,canResume:t,onResume:n})})]})}function Lt({branch:e}){let[t,n]=(0,Y.useState)(null),r=(0,Y.useRef)(null);(0,Y.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);let i=t===e,a=async()=>{r.current!==null&&clearTimeout(r.current),n(null);try{if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(e),n(e),r.current=setTimeout(()=>n(null),2e3)}catch{w(`Could not copy branch. Select and copy: ${e}`)}};return(0,X.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,children:[(0,X.jsx)(`span`,{"data-slot":`branch-chip`,className:`min-w-0 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium break-all`,children:e}),(0,X.jsxs)(`button`,{type:`button`,"aria-label":i?`Copied branch name`:`Copy branch name`,onClick:()=>void a(),className:`inline-flex min-h-11 shrink-0 items-center gap-1 rounded-sm px-2 text-xs font-medium text-foreground hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground md:min-h-8`,children:[(0,X.jsx)(E,{className:`size-3.5`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{"aria-live":`polite`,children:i?`Copied`:`Copy`})]})]})}function Rt({run:e}){let t=v(),n=be(),r=r=>n===void 0?void 0:ge(n,e.id,r,t),a=(0,Y.useMemo)(()=>C(e,t),[e,t]),o=[],s=[],c=a.filter(e=>e.kind===`PR`);for(let t of c)o.push((0,X.jsx)(O,{reference:t,to:r(t),taskTitle:_(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`,conflictAction:(0,X.jsx)(tt,{run:e,prNumber:t.number})},g(t)));let l=ve(e);l&&i(l)&&!c.some(e=>e.url===l)&&o.push((0,X.jsx)(O,{reference:{kind:`PR`,url:l},taskTitle:_(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`pr`));let u=a.filter(e=>e.kind===`Issue`);for(let t of u)s.push((0,X.jsx)(O,{reference:t,to:r(t),taskTitle:_(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},g(t)));let d=ye(e,t);if(d&&i(d)&&!u.some(e=>e.url===d)){let t=y(d);s.push((0,X.jsx)(O,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:d},to:t?r({kind:`Issue`,number:Number(t),url:d}):void 0,taskTitle:_(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`issue`))}return o.length===0&&s.length===0?null:(0,X.jsx)(`div`,{"data-slot":`linked-references`,className:`flex min-w-0 flex-col gap-3`,children:[[`PR`,`PRs`,o],[`Issue`,`Issues`,s]].map(([e,t,n])=>n.length>0?(0,X.jsxs)(`div`,{"data-reference-kind":e,className:`grid min-w-0 grid-cols-[5rem_minmax(0,1fr)] items-center gap-x-2 gap-y-1`,children:[(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,X.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:n})]},e):null)})}function zt(){let e=Ve(),t=re();return Ke(t.data?.projects?.find(n=>n.id===(e??t.data?.bootProject)))}var Bt=e=>e.map(e=>`${e.name}: ${et(e.url)}`).join(`
2
+ `);function Vt(e){return zt().length>0||e.notify===!0}function Ht({run:e}){let t=zt(),n=t.length>0,r=ie(e.id),[i,o]=(0,Y.useState)(null),s=e.notify===!0;return!n&&!s?null:(0,X.jsxs)(X.Fragment,{children:[s?(0,X.jsxs)(I,{children:[(0,X.jsx)(P,{asChild:!0,children:(0,X.jsxs)(a,{variant:`outline`,size:`sm`,"data-slot":`notifying-chip`,className:`h-11 gap-1.5 md:h-[30px]`,"aria-label":n?`Notifying ${nt(t)} — webhook actions`:`Notifying — webhook actions`,title:n?Bt(t):void 0,children:[(0,X.jsx)(st,{tone:`success`}),(0,X.jsx)(`span`,{children:`Notifying`}),(0,X.jsx)(Ae,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,X.jsxs)(F,{align:`end`,"data-slot":`notifying-menu`,className:`w-[240px] max-w-[calc(100vw-2rem)] p-2`,children:[n?(0,X.jsx)(A,{"data-slot":`notifying-targets`,className:`flex flex-col gap-0.5 px-2 py-1.5 text-[11px] font-normal text-muted-foreground`,children:t.map(e=>(0,X.jsx)(`span`,{"data-webhook-target":e.id,className:`truncate`,title:et(e.url),children:e.name},e.id))}):null,n?(0,X.jsxs)(j,{className:`min-h-11`,onSelect:()=>o(`note`),children:[(0,X.jsx)(Le,{"aria-hidden":`true`}),` Send a note…`]}):null,(0,X.jsxs)(j,{variant:`destructive`,className:`min-h-11`,disabled:r.isPending,onSelect:()=>r.mutate({notify:!1},{onSuccess:()=>w(`Stopped notifying the webhook`),onError:e=>w(`Could not stop notifying. ${e.message}`,{tone:`danger`})}),children:[(0,X.jsx)(yt,{"aria-hidden":`true`}),` Stop notifying`]})]})]}):(0,X.jsxs)(a,{variant:`outline`,size:`sm`,"data-action":`handoff`,className:`size-11 px-0 md:h-[30px] md:w-auto md:px-2.5`,"aria-label":`Hand off to webhook`,onClick:()=>o(`handoff`),children:[(0,X.jsx)(ht,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`max-md:sr-only`,children:`Hand off`})]}),n?(0,X.jsx)(Ut,{mode:i,targets:t,pending:r.isPending,onOpenChange:e=>!e&&o(null),onSubmit:e=>r.mutate({notify:!0,...e?{message:e}:{}},{onSuccess:()=>{o(null),w(i===`note`?`Note sent to the webhook`:`Handed off to the webhook`)},onError:e=>w(`Could not hand off. ${e.message}`,{tone:`danger`})})}):null]})}function Ut({mode:e,targets:t,pending:n,onOpenChange:r,onSubmit:i}){let o=(0,Y.useId)(),s=(0,Y.useId)(),[c,l]=(0,Y.useState)(``);(0,Y.useEffect)(()=>{e!==null&&l(``)},[e]);let u=e===`note`,d=nt(t);return(0,X.jsx)(Xe,{open:e!==null,onOpenChange:e=>{e||l(``),r(e)},children:(0,X.jsx)(Ze,{"data-slot":`handoff-dialog`,className:`max-sm:top-auto max-sm:bottom-0 max-sm:left-0 max-sm:max-w-none max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none max-sm:rounded-t-xl max-sm:border-x-0 max-sm:border-b-0 max-sm:pb-[max(1.5rem,env(safe-area-inset-bottom))] max-sm:data-[state=open]:slide-in-from-bottom max-sm:data-[state=open]:zoom-in-100 max-sm:data-[state=closed]:slide-out-to-bottom max-sm:data-[state=closed]:zoom-out-100`,children:(0,X.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),i(c.trim())},children:[(0,X.jsxs)(qe,{className:`text-left`,children:[(0,X.jsx)(Ye,{children:u?`Send a note to ${t.length===1?`the webhook`:`the webhooks`}`:`Hand off to webhook`}),(0,X.jsx)($e,{children:(0,X.jsx)(`span`,{"data-webhook-destination":``,title:Bt(t),children:u?`${d} ${t.length===1?`gets`:`get`} this note with the task's current status.`:`${d} will start receiving this task's status updates. Add a note (optional).`})})]}),(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(`label`,{htmlFor:o,className:`text-[13px] font-medium`,children:`Note`}),(0,X.jsx)(ut,{id:o,"data-slot":`handoff-note`,"aria-describedby":s,rows:4,maxLength:1e5,className:`min-h-24`,placeholder:`e.g. Take over from here, ping me when the PR is green`,value:c,onChange:e=>l(e.target.value)}),(0,X.jsxs)(`p`,{id:s,className:`flex items-center gap-1.5 text-[12px] text-muted-foreground`,children:[(0,X.jsx)(Fe,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`The note goes to the webhook only, not to the agent.`]})]}),(0,X.jsxs)(Ge,{className:`gap-2 max-sm:flex-col-reverse max-sm:[&>button]:h-11 max-sm:[&>button]:w-full`,children:[(0,X.jsx)(a,{type:`button`,variant:`ghost`,className:`sm:h-9`,onClick:()=>r(!1),children:`Cancel`}),(0,X.jsxs)(a,{type:`submit`,variant:`contrast`,className:`sm:h-9`,"data-action":`handoff-submit`,disabled:n||u&&c.trim()===``,children:[(0,X.jsx)(ht,{"aria-hidden":`true`}),u?`Send note`:`Hand off`]})]})]})})})}function Wt({runId:e,children:t}){let n=r(),i=(0,Y.useMemo)(()=>({runId:e}),[e]);return n?(0,X.jsx)(Gt,{runId:e,children:t}):(0,X.jsx)(G.Provider,{value:i,children:t})}function Gt({runId:e,children:n}){let{projectId:r}=t(),i=(0,Y.useMemo)(()=>({runId:e,...r?{projectId:r}:{}}),[e,r]);return(0,X.jsx)(G.Provider,{value:i,children:n})}function Kt({id:e}){return(0,X.jsxs)(k,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,"data-slot":`mobile-parent-task-link`,className:`inline-flex shrink-0 items-center justify-center gap-1 rounded-sm px-2 text-[13px] text-muted-foreground [min-block-size:2.75rem] [min-inline-size:2.75rem] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:bg-muted active:text-foreground`,children:[(0,X.jsx)(T,{"aria-hidden":!0,className:`shrink-0 [block-size:1.2cap] [inline-size:auto]`}),`Parent`]})}function qt({id:e}){let t=he(e),n=t.data?_(t.data):e;return(0,X.jsxs)(`div`,{"data-slot":`parent-task`,className:`flex min-w-0 flex-wrap items-center gap-x-2 text-[13px] text-muted-foreground`,children:[(0,X.jsxs)(k,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,title:`Parent · ${n}`,"data-slot":`parent-task-link`,className:`flex min-h-11 min-w-0 max-w-full items-center gap-2 rounded-sm text-muted-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:text-foreground`,children:[(0,X.jsx)(T,{"aria-hidden":!0,className:`h-[1.2cap] w-auto shrink-0`}),(0,X.jsx)(`span`,{className:`shrink-0`,children:`Parent`}),(0,X.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,X.jsx)(`span`,{className:`min-w-0 overflow-clip text-ellipsis whitespace-nowrap`,children:n})]}),t.isError?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:`Parent record unavailable or deleted`}),(0,X.jsx)(a,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry parent task`})]}):null]})}var Jt=3,Yt=(e,t)=>e.kind===t.kind&&e.number===t.number;function Xt(e,t,n=Jt){let r=t?e.findIndex(e=>Yt(e,t)):-1;if(e.length<=n||r<n)return{inline:e.slice(0,n),overflow:e.slice(n)};let i=[...e.slice(0,n-1),e[r]];return{inline:i,overflow:e.filter(e=>!i.includes(e))}}var Zt=(e,t)=>`/tasks/${e}/${t.kind}/${t.number}`;function Qt({tab:e}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(e.kind===`pr`?Ce:Ee,{"aria-hidden":`true`,className:`mr-1 size-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`sr-only`,children:e.kind===`pr`?`Pull request`:`Issue`}),` #`,e.number,(0,X.jsx)(ze,{kind:e.kind===`pr`?`PR`:`Issue`,number:e.number,className:`ml-1`})]})}function $t(e,t){let n=e[0],r=e.length+ +!!t;return n?`Preview :${n.port}${r>1?` +${r-1}`:``}`:t?`Preview · agent`:`Preview`}function en({servers:e}){let t=We();if(t===null)return null;let n=t.agentLive===!0,r=e[0],i=e.length+ +!!n===1?r?{port:r.port}:{agent:!0}:{};return(0,X.jsxs)(a,{variant:`outline`,size:`sm`,"data-slot":`preview-toggle`,className:`max-md:h-11`,"aria-pressed":t.open,onClick:()=>t.openPane(i),children:[(0,X.jsx)(je,{"aria-hidden":`true`}),$t(e,n),t.live?(0,X.jsx)(st,{tone:`success`,"aria-label":`Preview is live`}):null]})}function tn(e){return e?.role===`worker`?`Worker session`:e?.role===`root`?`Parent session`:`Task session`}function nn({run:e,compact:t=!1}){return e.delegation?.role===`worker`?t?(0,X.jsx)(Kt,{id:e.delegation.parentRunId}):(0,X.jsx)(qt,{id:e.delegation.parentRunId}):null}function rn(e,t,n){return!e.archiveBlocker&&t.archive&&(n!==`session`||!Je(e))?(0,X.jsx)(Z,{run:e}):null}function an({run:e}){return e.archived&&e.autoArchive?.reason===`pull-requests-merged`&&e.autoArchive.archivedAt===e.archivedAt?(0,X.jsx)(`p`,{"data-slot":`auto-archive-reason`,className:`text-[13px] text-muted-foreground`,children:`Archived automatically after all associated PRs merged.`}):null}function on({shown:e,run:t,archiveButton:n,previewToggle:r}){let i=Vt(t);return e&&(n||r||i)?(0,X.jsxs)(`div`,{"data-slot":`run-mobile-actions`,className:`flex flex-wrap items-center gap-2 pt-2`,children:[n,r,(0,X.jsx)(Ht,{run:t})]}):null}function sn({run:e,tab:t,activeItem:n,inlineItemTabs:r,overflowItemTabs:i,phoneBar:a,isDesktop:o}){let s=(0,Y.useRef)(null),c=n?`${n.kind}#${n.number}`:null;return(0,Y.useEffect)(()=>{!c||o||s.current?.querySelector(`[aria-current="page"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[c,r.map(e=>`${e.kind}#${e.number}`).join(`,`),o]),(0,X.jsxs)(`div`,{ref:s,"data-slot":`run-tabs`,"data-phone-bar":a||void 0,className:`mt-3 flex flex-wrap items-end gap-1 border-b border-border md:mt-5 max-md:flex-nowrap max-md:overflow-x-auto max-md:border-b-0 max-md:shadow-[inset_0_-1px_0_var(--border)] max-md:gap-0 max-md:[&>*]:mb-0 max-md:[&>*]:shrink-0 max-md:[&>a]:min-h-11 max-md:[&>a]:px-3.5 max-md:[&>a]:text-[13.5px]`,children:[(0,X.jsx)(J,{to:`/tasks/${e.id}`,active:t===`session`,replace:a,children:`Session`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/changes`,active:t===`changes`,replace:a,count:e.diffStat&&e.diffStat.files>0?e.diffStat.files:void 0,children:`Changes`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/commits`,active:t===`commits`,replace:a,children:`Commits`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/files`,active:t===`files`,replace:a,children:`Files`}),r.map(t=>(0,X.jsx)(J,{to:Zt(e.id,t),active:n!==null&&Yt(t,n),replace:a,children:(0,X.jsx)(Qt,{tab:t})},`${t.kind}-${t.number}`)),i.length>0?(0,X.jsxs)(I,{children:[(0,X.jsxs)(P,{"data-slot":`run-tabs-more`,"aria-label":`${i.length} more linked items`,className:`-mb-px flex h-8 items-center rounded-t-md border-b-2 border-transparent px-3 text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground max-md:min-h-11 max-md:px-3.5 max-md:text-[13.5px]`,children:[`+`,i.length]}),(0,X.jsx)(F,{align:`end`,children:i.map(t=>(0,X.jsx)(j,{asChild:!0,children:(0,X.jsx)(k,{to:Zt(e.id,t),replace:a,children:(0,X.jsx)(Qt,{tab:t})})},`${t.kind}-${t.number}`))})]}):null]})}function cn({run:e,tab:t=`session`,onMarkedUnread:n}){let r=l(e),i=q(e),[a,s]=(0,Y.useState)(!1),[c,u]=(0,Y.useState)(!1),d=ln(e,n),ee=oe(),te=le(),ne=kt(e,{queuePosition:e.status===`queued`?xe(ee.data??[]).get(e.id):void 0}),f=dt(),p=Qe(),m=f!==null&&!p?f:null,h=m!==null,{referenceProjectId:re,repoBase:g,requests:ie}=Mt(e),ae=(0,Y.useMemo)(()=>pe(e,g),[e,g]),_=typeof t==`object`?t:null,{inline:se,overflow:ce}=Xt(ae,_),v=te.data?.capabilities?.preview===!0,y=e.worktreePath&&v?(0,X.jsx)(en,{servers:e.previewServers??[]}):null,b=(0,X.jsx)(pn,{run:e,actions:d,onOpenChooser:()=>u(!0),onToggleNotes:()=>s(e=>!e)}),x=rn(e,i,t);return(0,X.jsx)(Re,{projectId:re,repoBase:g,requests:ie,children:(0,X.jsxs)(`header`,{"data-slot":`run-header`,className:o(`relative z-20 bg-background px-[18px] md:px-9 md:pt-7`,h?`pt-0`:`pt-[18px]`,t===`session`&&`md:sticky md:top-0`),children:[(0,X.jsx)(an,{run:e}),(0,X.jsx)(Dt,{run:e}),(0,X.jsxs)(`div`,{className:`w-full`,children:[(0,X.jsx)(nn,{run:e}),m?(0,X.jsxs)(Ue,{slot:m,children:[(0,X.jsx)(fn,{run:e}),(0,X.jsx)(nn,{run:e,compact:!0}),b]}):(0,X.jsxs)(`div`,{"data-slot":`run-title-row`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 md:flex-nowrap`,children:[(0,X.jsx)(`p`,{"data-slot":`session-kind`,className:`text-[12px] font-semibold tracking-[0.14em] text-muted-foreground uppercase md:hidden`,children:tn(e.delegation)}),(0,X.jsx)(dn,{run:e}),(0,X.jsx)(mt,{dot:r.tone,shape:r.shape,pulse:r.pulse,className:`max-md:hidden`,children:At(ne)}),(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[x,y,(0,X.jsx)(Ht,{run:e}),b]})]}),(0,X.jsx)(on,{shown:m!==null,run:e,archiveButton:x,previewToggle:y}),(0,X.jsx)(sn,{run:e,tab:t,activeItem:_,inlineItemTabs:se,overflowItemTabs:ce,phoneBar:h,isDesktop:p}),a?(0,X.jsx)(gn,{runId:e.id,onClose:()=>s(!1)}):null,c?(0,X.jsx)(It,{run:e,canResume:q(e).terminal,onResume:()=>d.terminal.mutate(),onClose:()=>u(!1)}):null]}),(0,X.jsx)(hn,{run:e,actions:d})]})})}function ln(e,t){let n=d(),r=Be(),[i,a]=(0,Y.useState)(null),o=()=>n.invalidateQueries({queryKey:_e.runs.all}),s=e=>w(e.message,{tone:`danger`}),c=de(),l={isPending:c.isPending,mutate:()=>c.mutate({id:e.id,pinned:!e.pinned})},u=Se();return{pin:l,markUnread:{isPending:u.isPending,mutate:()=>{t?.(),u.mutate(e.id,{onError:s})}},delete:S({mutationFn:()=>m(e.id),onSuccess:()=>{o(),r(`/`)},onError:s}),terminal:Nt(e),confirming:i,setConfirming:a}}function un(e){let t=x(e.id),n=_(e);return{title:n,editor:lt(n,e=>t.mutate({title:e},{onError:e=>w(e.message,{tone:`danger`})}))}}function dn({run:e}){let{title:t,editor:n}=un(e);return n.editing?(0,X.jsx)(gt,{editor:n,className:`flex-1 text-[16px] font-semibold`}):(0,X.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,X.jsx)(`h1`,{className:`line-clamp-2 min-w-0 break-words text-2xl font-semibold tracking-tight`,title:e.task,children:t}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,onClick:n.begin,className:`shrink-0 rounded-sm p-1 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,X.jsx)(ct,{className:`size-3.5`,"aria-hidden":`true`})})]})}function fn({run:e}){let{title:t,editor:n}=un(e);return(0,X.jsxs)(Pe,{open:n.editing,onOpenChange:e=>{e?n.begin():n.commit()},children:[(0,X.jsx)(`div`,{"data-slot":`mobile-run-title`,className:`flex min-w-0 flex-1 flex-col gap-px`,children:(0,X.jsx)(`h1`,{className:`truncate text-[15px] leading-tight font-semibold text-foreground`,title:e.task,children:t})}),(0,X.jsx)(Me,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,className:`flex size-11 shrink-0 items-center justify-center rounded-sm text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,X.jsx)(ct,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,X.jsx)(Ne,{align:`end`,className:`w-64 max-w-[calc(100vw-16px)] p-2`,onEscapeKeyDown:e=>{e.preventDefault(),n.cancel()},children:(0,X.jsx)(gt,{editor:n,className:`text-[16px] font-semibold`})})]})}function pn({run:e,actions:t,onToggleNotes:n,onOpenChooser:r}){let i=q(e),o=K(e),s=x(e.id),c=(0,Y.useId)();return(0,X.jsxs)(I,{children:[(0,X.jsx)(P,{asChild:!0,children:(0,X.jsx)(a,{variant:`ghost`,size:`icon-sm`,className:`size-11`,"aria-label":`Run actions`,children:(0,X.jsx)(we,{"aria-hidden":`true`})})}),(0,X.jsxs)(F,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,children:[(0,X.jsx)(A,{className:`px-2 py-3 text-[12px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),(0,X.jsxs)(j,{onSelect:n,children:[(0,X.jsx)(ft,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,X.jsx)(It,{run:e,canResume:i.terminal,onResume:()=>t.terminal.mutate(),onOpen:r}),o?(0,X.jsxs)(j,{onSelect:()=>void Q(o,`Command copied to clipboard.`),children:[(0,X.jsx)(E,{"aria-hidden":`true`}),` Copy resume command`]}):null,i.markUnread?(0,X.jsxs)(j,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,X.jsx)(bt,{"aria-hidden":`true`}),` Mark unread`]}):null,i.pin?(0,X.jsxs)(N,{"data-slot":`pin-run`,className:`min-h-11`,checked:!!e.pinned,disabled:t.pin.isPending,onCheckedChange:()=>t.pin.mutate(),children:[e.pinned?(0,X.jsx)(xt,{"aria-hidden":`true`}):(0,X.jsx)(Te,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,(0,X.jsx)(M,{}),(0,X.jsx)(A,{className:`text-xs text-muted-foreground`,children:`AFTER DONE`}),(0,X.jsx)(N,{"data-slot":`archive-when-done`,className:`min-h-11`,checked:e.archiveWhenDone===!0,disabled:s.isPending,onCheckedChange:e=>s.mutate({archiveWhenDone:e},{onError:e=>w(e.message,{tone:`danger`})}),children:`Archive when Done`}),(0,X.jsx)(N,{"data-slot":`auto-merge-pr`,className:`min-h-11`,checked:e.autoMergePr===!0,disabled:s.isPending,"aria-describedby":c,onCheckedChange:e=>s.mutate({autoMergePr:e},{onError:e=>w(e.message,{tone:`danger`})}),children:`Auto-merge PR`}),(0,X.jsx)(`p`,{id:c,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block:0.5rem]`,children:`After Done, auto-merge can mark a draft PR ready. It waits for current-head CI and GitHub rules. Merge comes before archive.`}),e.delegation?.role===`worker`?null:(0,X.jsx)(mn,{run:e,patch:s}),i.deleteRun?(0,X.jsx)(M,{}):null,i.deleteRun?(0,X.jsxs)(j,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,X.jsx)(Oe,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})}function mn({run:e,patch:t}){let r=(0,Y.useId)(),i=(0,Y.useId)(),a=(0,Y.useId)(),o=e=>w(e.message,{tone:`danger`});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(M,{}),(0,X.jsx)(A,{className:`text-xs text-muted-foreground`,children:`TASK ACCESS`}),(0,X.jsxs)(N,{"data-slot":`allow-workers`,className:`min-h-11`,checked:te(e),disabled:t.isPending,"aria-describedby":`${r} ${a}`,onCheckedChange:e=>t.mutate({allowWorkers:e},{onError:o}),children:[`Allow `,n(`cezar`),` workers`]}),(0,X.jsxs)(`p`,{id:r,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:[`Agents in this task can start `,n(`Cezar`),` workers. Each worker is a separate paid agent session. Worker limits cap resources, not spending.`]}),(0,X.jsx)(N,{"data-slot":`allow-messaging`,className:`min-h-11`,checked:f(e),disabled:t.isPending,"aria-describedby":`${i} ${a}`,onCheckedChange:e=>t.mutate({allowMessaging:e},{onError:o}),children:`Allow task messaging`}),(0,X.jsx)(`p`,{id:i,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can message other tasks in this project.`}),(0,X.jsx)(`p`,{id:a,"data-slot":`task-access-session-note`,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Turning one off applies at once. Turning one on reaches a running agent at its next session.`})]})}function hn({run:e,actions:t}){let n=t.confirming;return(0,X.jsx)(W,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,X.jsxs)(z,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,X.jsxs)(U,{children:[(0,X.jsx)(R,{className:`text-danger`,children:`Delete task permanently?`}),(0,X.jsx)(L,{children:(0,X.jsxs)(X.Fragment,{children:[`Delete “`,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,title:_(e),children:_(e)}),`” and its transcript, worktree and branch. This cannot be undone.`]})})]}),(0,X.jsxs)(V,{children:[(0,X.jsx)(H,{children:`Cancel`}),(0,X.jsx)(B,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t.delete.mutate(),t.setConfirming(null)},children:`Delete task`})]})]})})}function gn({runId:e,onClose:t}){let n=b(e);return(0,X.jsxs)(`div`,{"data-slot":`notes-panel`,className:`my-5 rounded-xl border border-border bg-card p-6`,children:[(0,X.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,X.jsx)(`h2`,{className:`text-lg font-medium`,children:`Notes / handoff`}),(0,X.jsx)(a,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,X.jsx)(De,{})})]}),n.isPending?(0,X.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):n.isError?(0,X.jsx)(`p`,{className:`text-xs text-danger`,children:n.error.message}):n.data.trim().length>0?(0,X.jsx)(Wt,{runId:e,children:(0,X.jsx)(it,{children:n.data})}):(0,X.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`}),(0,X.jsxs)(`div`,{className:`mt-4 flex gap-3`,children:[(0,X.jsx)(a,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void Q(n.data??``,`Notes copied`),children:`Copy notes`}),(0,X.jsx)(a,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{Ft as a,kt as c,Rt as i,Z as l,Wt as n,Nt as o,Lt as r,Mt as s,cn as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{D as t,I as n,L as r,M as i,t as a,u as o}from"./button-CS5tOblf.js";import{i as s,t as c}from"./react-runtime-CCIEwYL0.js";import{Kr as l,Rt as u,f as d,on as f,tn as p,wn as m}from"./project-scope-context-DbO9a0ii.js";import{$ as h,J as g,K as _,X as v,Y as y,Z as b,et as x,rt as S,z as C}from"./live-protocol-BVn0UA_g.js";import{I as ee,Rt as te,Un as w,Z as T,jt as ne,n as E}from"./queries-C_DEjjv2.js";import{t as re}from"./useQuery-C2HBIY3e.js";import{n as D}from"./toaster-CRVRHlMR.js";import{G as ie,Q as ae,Z as O,ct as k,d as oe,ht as se,l as ce,mt as le,u as ue}from"./design-icons-DmYTv2r1.js";import{t as A}from"./project-router-BLO2IxbU.js";import{t as de}from"./centered-state-BmsqxbI8.js";import{Hn as fe,Vn as pe,Vt as j,Wn as me,Yn as he,Yt as ge,pt as _e,qt as ve,un as ye}from"./index-D51Su-nT.js";import{t as be}from"./skill-empty-hint-YDmkqgo-.js";var M=e(s(),1),N=`owner/name, an https, ssh or git URL, git@host:path, or a local or file:// path`,xe=new Set([`https`,`http`,`ssh`,`git`,`file`]);function P(e){let t=e.trim();if(!t||t.startsWith(`-`)||t.includes(`::`))return null;if(t.startsWith(`~/`))return`home`;if(/^(\/|\.\/|\.\.\/)/.test(t)||/^[A-Za-z]:[\\/]/.test(t))return`local`;if(/^[\w.-]+\/[\w.-]+$/.test(t))return`github`;let n=/^([a-z][a-z0-9+.-]*):\/\//i.exec(t);return n?xe.has(n[1].toLowerCase())?`url`:null:/^[\w.-]+@[\w.-]+:/.test(t)?`scp`:null}function F(e){return e.length>0&&e.length<=256&&!e.startsWith(`-`)&&!e.includes(`..`)&&/^[A-Za-z0-9._/-]+$/.test(e)}var Se=S().trim().min(1).max(500).refine(e=>P(e)!==null,{message:`Use ${N}.`}),Ce=S().trim().refine(F,{message:`Use a branch, tag or commit SHA, such as main.`}),we=x({repo:S().min(1).max(500),ref:S().min(1).max(256)}).strict();x({repo:Se,ref:Ce.optional()}).strict(),we.extend({enabled:y()}).strict();var Te=_([`refused-format`,`fetch-failed`,`ref-not-found`]),Ee=v(`state`,[x({state:b(`idle`)}),x({state:b(`loading`)}),x({state:b(`ok`),skillCount:h().int().min(0)}),x({state:b(`error`),cause:Te,detail:S(),skillCount:h().int().min(0)})]);x({sources:g(x({repo:S(),ref:S(),enabled:y(),status:Ee})),editable:y(),configIssue:S().nullable()});var I=()=>[i(),`skills`,`sources`];async function De(e){return m(await d.api.v1.p[`:projectId`].skills.sources.$get({param:{projectId:i()}},u(e)),`/skills/sources`)}async function Oe(e){return m(await d.api.v1.p[`:projectId`].skills.sources.$post({param:{projectId:i()},json:e}),`/skills/sources`)}async function ke(e){return m(await d.api.v1.p[`:projectId`].skills.sources.$patch({param:{projectId:i()},json:e}),`/skills/sources`)}async function Ae(e){return m(await d.api.v1.p[`:projectId`].skills.sources.$delete({param:{projectId:i()},json:e}),`/skills/sources`)}async function je(e){return m(await d.api.v1.p[`:projectId`].skills.sources.retry.$post({param:{projectId:i()},json:e}),`/skills/sources/retry`)}var L=c(),Me=1e3,R=e=>`${e.repo} @ ${e.ref}`;function Ne(){return re({queryKey:I(),queryFn:({signal:e})=>De({signal:e}),refetchInterval:e=>e.state.data?.sources.some(e=>e.status.state===`loading`)?Me:!1})}function Pe(){return{sources:I(),lists:[E.skills,E.skillsReady,E.importableSkills,E.importableSkillsReady]}}function z(e,t=Pe()){for(let n of t.lists)e.invalidateQueries({queryKey:n,exact:!0})}function B(e,t){let n=l();return w({mutationFn:async t=>{let n=Pe();return{answer:await e(t),keys:n}},onSuccess:({answer:e,keys:r},i)=>{n.setQueryData(r.sources,e),n.invalidateQueries({queryKey:r.sources,exact:!0}),z(n,r),t?.(i)},onError:e=>D(e.message,{tone:`danger`})})}function Fe(e){let t=l(),n=(0,M.useRef)(!1),r=e?.sources.some(e=>e.status.state===`loading`)??!1;(0,M.useEffect)(()=>{n.current&&!r&&z(t),n.current=r},[r,t])}function Ie(){let e=Ne();Fe(e.data);let t=B(ke),i=B(Ae,e=>D(`Removed ${R(e)}. Add it again to restore its skill switches.`)),o=B(je),s=e.data,c=s?.editable===!0&&s.configIssue===null,l=t.isPending||i.isPending;return(0,L.jsxs)(`section`,{"data-slot":`skill-sources`,"aria-labelledby":`skill-sources-heading`,className:`flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-3 @min-[520px]:p-4`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h2`,{id:`skill-sources-heading`,className:`text-[15px] font-semibold`,children:`Team skill sources`}),(0,L.jsxs)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:[`Repos whose skills this project can use. Changes are saved to`,` `,(0,L.jsx)(`span`,{className:`font-mono`,children:`.ai/cezar/config.json`}),`.`]})]}),e.isError?(0,L.jsxs)(V,{slot:`skill-sources-error`,alert:!0,children:[`Could not load the team skill sources: `,e.error.message,` `,(0,L.jsx)(a,{type:`button`,variant:`outline`,size:`sm`,className:`mt-2 min-h-11`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:`Retry`})]}):null,s?.configIssue?(0,L.jsx)(V,{slot:`skill-sources-config-issue`,alert:!0,children:s.configIssue}):null,s&&!s.editable?(0,L.jsxs)(V,{slot:`skill-sources-read-only`,children:[`Sources are read-only on this remote cockpit. To edit them here, run`,` `,(0,L.jsxs)(`span`,{className:`font-mono`,children:[n(),` remote-settings enable`]}),` on the machine running `,r(`cezar`),`.`]}):null,e.isPending?(0,L.jsx)(`p`,{role:`status`,"aria-busy":`true`,className:`text-xs text-muted-foreground`,children:`Loading sources…`}):s&&s.configIssue===null&&s.sources.length===0?(0,L.jsx)(`p`,{"data-slot":`skill-sources-empty`,className:`text-xs leading-relaxed text-soft-foreground`,children:`No team skill sources yet. Add a repo below to use its skills in this project.`}):s&&s.sources.length>0?(0,L.jsx)(`ul`,{"data-slot":`skill-source-list`,className:`flex flex-col divide-y divide-border rounded-lg border border-border`,children:s.sources.map(e=>(0,L.jsx)(Le,{source:e,editable:c,busy:l,retrying:o.isPending,onToggle:()=>t.mutate({repo:e.repo,ref:e.ref,enabled:!e.enabled}),onRemove:()=>i.mutate({repo:e.repo,ref:e.ref}),onRetry:()=>o.mutate({repo:e.repo,ref:e.ref})},JSON.stringify([e.repo,e.ref])))}):null,s?(0,L.jsx)(Ve,{disabled:!c}):null]})}function V({slot:e,alert:t=!1,children:n}){return(0,L.jsxs)(`div`,{role:t?`alert`:void 0,"data-slot":e,className:`flex items-start gap-2 rounded-lg border border-border bg-background p-3 text-xs leading-relaxed text-muted-foreground`,children:[t?(0,L.jsx)(k,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-danger`}):null,(0,L.jsx)(`div`,{className:`min-w-0 break-words`,children:n})]})}function Le({source:e,editable:t,busy:n,retrying:r,onToggle:i,onRemove:o,onRetry:s}){let c=(0,M.useId)(),l=Re(e),u=e.status.state===`error`,d=e.enabled&&(u||e.status.state===`idle`);return(0,L.jsxs)(`li`,{"data-slot":`skill-source`,"data-repo":e.repo,"data-ref":e.ref,"data-state":e.enabled?e.status.state:`disabled`,className:`flex flex-col gap-2 p-2.5 @min-[520px]:flex-row @min-[520px]:items-center`,children:[(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsxs)(`p`,{className:`break-all font-mono text-[13px] text-foreground`,children:[e.repo,` `,(0,L.jsxs)(`span`,{className:`text-muted-foreground`,children:[`@ `,e.ref]})]}),(0,L.jsx)(`p`,{id:c,"data-slot":`skill-source-status`,role:u?`alert`:void 0,"aria-live":u?void 0:`polite`,className:u?`mt-1 text-xs leading-relaxed text-danger`:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:l})]}),(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[d?(0,L.jsxs)(a,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`skill-source-retry`,className:`min-h-11`,disabled:!t||r,"aria-label":`Retry ${R(e)}`,onClick:s,children:[(0,L.jsx)(O,{"aria-hidden":`true`}),`Retry`]}):null,(0,L.jsx)(`span`,{className:`inline-flex min-h-11 min-w-11 items-center justify-center`,children:(0,L.jsx)(ye,{"data-slot":`skill-source-switch`,"aria-label":`Enable ${R(e)}`,"aria-describedby":c,checked:e.enabled,disabled:!t||n,onCheckedChange:i,className:`relative before:absolute before:-inset-x-1 before:-inset-y-2.5 before:content-['']`})}),(0,L.jsx)(a,{type:`button`,variant:`ghost`,size:`icon`,"data-slot":`skill-source-remove`,className:`size-11`,disabled:!t||n,"aria-label":`Remove ${R(e)}`,onClick:o,children:(0,L.jsx)(le,{"aria-hidden":`true`})})]})]})}function Re(e){if(!e.enabled)return`Disabled. Its skills are hidden from the catalog and from tasks.`;let t=e.status;switch(t.state){case`loading`:return`Fetching…`;case`idle`:return`Not fetched yet. Use Retry to fetch it now.`;case`ok`:return t.skillCount===1?`1 skill`:`${t.skillCount} skills`;case`error`:{let e=t.skillCount>0?` Skills from an earlier fetch still show.`:``;return t.cause===`refused-format`?`${r(`cezar`)} does not accept this repo format. Remove it, then add it as ${N}.`:t.cause===`ref-not-found`?`${t.detail} Check the ref, or remove the source and add it with another ref.${e}`:`Could not fetch: ${ze(t.detail)} Check the network and your access to the repo, then Retry.${e}`}}}var ze=e=>/[.!?]$/.test(e.trim())?e.trim():`${e.trim()}.`;function Be(e,t){return e.trim()?P(e)===null?`Use ${N}.`:t.trim()&&!F(t.trim())?`Use a branch, tag or commit SHA for the ref, such as main.`:null:`Enter a repo.`}function Ve({disabled:e}){let[t,n]=(0,M.useState)(``),[r,i]=(0,M.useState)(``),[o,s]=(0,M.useState)(null),c=(0,M.useId)(),l=(0,M.useId)(),u=(0,M.useId)(),d=B(Oe,()=>{n(``),i(``)});return(0,L.jsxs)(`form`,{"data-slot":`skill-source-add`,"aria-label":`Add a team skill source`,noValidate:!0,onSubmit:e=>{e.preventDefault();let n=Be(t,r);s(n),!n&&d.mutate(r.trim()?{repo:t.trim(),ref:r.trim()}:{repo:t.trim()})},className:`flex flex-col gap-2 @min-[520px]:flex-row @min-[520px]:flex-wrap @min-[520px]:items-end`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,L.jsx)(`label`,{htmlFor:c,className:`text-xs font-medium`,children:`Repo`}),(0,L.jsx)(j,{id:c,"data-slot":`skill-source-repo`,value:t,placeholder:`owner/name`,autoComplete:`off`,spellCheck:!1,disabled:e,"aria-invalid":o?!0:void 0,"aria-describedby":o?u:void 0,onChange:e=>{n(e.target.value),s(null)},className:`h-11 font-mono text-[13px]`})]}),(0,L.jsxs)(`div`,{className:`flex flex-col gap-1 @min-[520px]:w-36`,children:[(0,L.jsx)(`label`,{htmlFor:l,className:`text-xs font-medium`,children:`Ref`}),(0,L.jsx)(j,{id:l,"data-slot":`skill-source-ref`,value:r,placeholder:`main`,autoComplete:`off`,spellCheck:!1,disabled:e,onChange:e=>{i(e.target.value),s(null)},className:`h-11 font-mono text-[13px]`})]}),(0,L.jsx)(a,{type:`submit`,"data-slot":`skill-source-submit`,className:`h-11`,disabled:e||d.isPending,children:`Add source`}),o?(0,L.jsx)(`p`,{id:u,role:`alert`,"data-slot":`skill-source-problem`,className:`text-xs text-danger @min-[520px]:basis-full`,children:o}):null]})}var He=[[`.ai`,`cezar`,`skills`],[`.ai`,`squawk`,`skills`],[`.ai`,`skills`],[`.claude`,`skills`],[`.agents`,`skills`],[`skills`]];function Ue(e){let t=e.split(`/`).slice(0,-1);if((e===`SKILL.md`||e.endsWith(`/SKILL.md`)||t.at(-1)===`commands`)&&t.pop(),t[0]===`plugins`&&t[1])return{kind:`plugin`,name:t[1]};for(let e of He){let n=We(t,e);if(n!==-1&&(e.length>1||n===t.length-1)){t.splice(n,e.length);break}}return t.length>0?{kind:`directory`,name:t.join(`/`)}:null}function We(e,t){for(let n=e.length-t.length;n>=0;n--)if(t.every((t,r)=>e[n+r]===t))return n;return-1}var H=[{id:`project`,label:`This project`,sources:new Set([`ai`,`cezar`,`agents`])},{id:`global`,label:`Global`,sources:new Set([`global`])},{id:`builtin`,label:`Built-in`,sources:new Set([`builtin`])}],U=(e,t,n,r)=>({key:e,label:t,kind:n,locked:r,items:[],children:[]});function Ge(e){let t=H.map(e=>U(`source\u0000${e.id}`,e.label,`source`,!0)),n=new Map;for(let r of e){let{skill:e}=r;if(!e.team){let n=H.findIndex(t=>t.sources.has(e.source));t[n===-1?0:n].items.push(r);continue}let{repo:i,path:a}=e.team,o=n.get(i);o||(o=U(`repo\u0000${i}`,i,`repo`,!1),n.set(i,o));let s=Ue(a);if(!s){o.items.push(r);continue}let c=`${o.key}\u0000${s.kind}\u0000${s.name}`,l=o.children.find(e=>e.key===c);l||(l=U(c,s.name,s.kind,!1),o.children.push(l)),l.items.push(r)}for(let e of n.values())e.children.sort((e,t)=>e.label.localeCompare(t.label));let r=[...n.values()].sort((e,t)=>e.label.localeCompare(t.label));return[t[0],...r,t[1],t[2]].filter(e=>e.items.length>0||e.children.length>0)}function W(e){return e.flatMap(e=>[e.key,...W(e.children)])}function G(e){return[...e.items,...e.children.flatMap(G)]}function Ke(e,t){let n=G(e);if(e.locked)return{enabled:n.length,total:n.length,state:`on`,refs:[]};let r=[],i=0;for(let{skill:e}of n)e.team&&(r.push({repo:e.team.repo,name:e.name}),t(e)&&i++);let a=i===0?`off`:i===r.length?`on`:`mixed`;return{enabled:i,total:r.length,state:a,refs:r}}function K(e,t){if(t.trim()===``)return null;let n=new Set,r=(e,i)=>{let a=[...i,e.label];for(let{skill:r,key:i}of e.items){let e=[r.description??``,...a].join(` `);me(r.name,e,t)>0&&n.add(i)}for(let t of e.children)r(t,a)};for(let t of e)r(t,[]);return n}function q(e,t){let n=[],r=(e,i)=>{let a=[...i,e.key],o=e.items.some(e=>t.has(e.key));o&&n.push(...a.filter(e=>!n.includes(e)));for(let t of e.children)o=r(t,a)||o;return o};for(let t of e)r(t,[]);return n}function J(e){let t=e?.disabledTeamSkills;if(!Array.isArray(t))return[];let n=[];for(let e of t){let t=C.safeParse(e);t.success&&n.push(t.data)}return n}var Y=(e,t)=>e.repo===t.repo&&e.name===t.name;function X(e){return e.team?{repo:e.team.repo,name:e.name}:void 0}function qe(e,t,n){let r=new Map;for(let e of t)r.has(e.name)||r.set(e.name,e);let i=[],a=new Set;for(let t of e){let e=X(t);if(!e)continue;let o=JSON.stringify([e.repo,e.name]);if(a.has(o))continue;a.add(o);let s=n(e),c=r.get(t.name),l=c?X(c):void 0;s&&c&&!(l&&Y(l,e))?i.push({skill:t,on:s,hiddenBy:c.team?.repo??c.source}):i.push({skill:t,on:s})}return i}var Z=new Map;function Je(e){let t=Z.get(e);return t||(t={chain:Promise.resolve(),latest:0},Z.set(e,t)),t}function Ye(e){let t=l(),n=T(e),[r,i]=M.useState(0),a=M.useMemo(()=>J(n.data),[n.data]),o=M.useCallback(e=>!a.some(t=>Y(t,e)),[a]),s=M.useCallback(n=>{let r=[e,`ui-state`],a=[e,`skills`],o=t.getQueryData(r),s=n(J(o));t.setQueryData(r,{...o,disabledTeamSkills:s});let c=Je(e),l=++c.latest;i(e=>e+1),c.chain=c.chain.then(async()=>{try{let n=await p({disabledTeamSkills:s},e);l===c.latest&&(t.setQueryData(r,n),t.invalidateQueries({queryKey:a}))}catch(e){D(e instanceof Error?e.message:String(e),{tone:`danger`}),l===c.latest&&t.invalidateQueries({queryKey:r})}finally{i(e=>e-1)}})},[e,t]);return{disabled:a,isOn:o,toggle:M.useCallback(e=>{let t={repo:e.repo,name:e.name};s(e=>e.some(e=>Y(e,t))?e.filter(e=>!Y(e,t)):[...e,t])},[s]),setMany:M.useCallback((e,t)=>{let n=e.map(e=>({repo:e.repo,name:e.name}));s(e=>{if(t)return e.filter(e=>!n.some(t=>Y(e,t)));let r=[...e];for(let e of n)r.some(t=>Y(t,e))||r.push(e);return r})},[s]),pending:r>0,ready:n.isSuccess}}var Q=`__bm`,Xe=`__import`,$=e=>e.team?`${e.team.repo}\u0000${e.name}`:e.path,Ze=e=>e.source!==`team`&&e.source!==`builtin`;function Qe(){return(0,L.jsx)(`div`,{"data-route":`skills`,className:`mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:(0,L.jsx)($e,{})})}function $e(){let e=ne(),n=te(),r=ee(),[a]=t(),[o,s]=(0,M.useState)(``),c=Ye(i()),l=et(),u=(0,M.useMemo)(()=>e.data??[],[e.data]),d=(0,M.useMemo)(()=>r.data??[],[r.data]),f=r.isSuccess,p=(0,M.useMemo)(()=>tt(u,f?d:null,c.isOn),[u,d,f,c.isOn]),m=(0,M.useMemo)(()=>Ge(p),[p]),h=new Map;for(let e of p)h.set(e.skill.name,(h.get(e.skill.name)??0)+1);let g=e=>(h.get(e.name)??0)>1&&e.team!==void 0,_=e=>{let t=X(e);return t&&f?c.isOn(t):!0},v=e=>{let t=X(e);return t?{ariaLabel:g(e)?`Enable ${e.name} from ${t.repo}`:`Enable ${e.name}`,checked:_(e),disabled:!f||!c.ready,locked:!1,onCheckedChange:()=>c.toggle(t)}:{ariaLabel:`${e.name} is always enabled`,checked:!0,disabled:!0,locked:!0,onCheckedChange:()=>{}}},y=e=>`/skills?skill=${encodeURIComponent(e.name)}${g(e)?`&repo=${encodeURIComponent(e.team.repo)}`:``}`,b=a.get(`skill`),x=nt(p,b,a.get(`repo`),_)?.key??null,S=rt(m,x),C=e=>{s(e);let t=K(m,e);t&&t.size>0&&S.open(q(m,t))};if(e.isError)return(0,L.jsx)(de,{icon:(0,L.jsx)(k,{}),tone:`danger`,heading:`h2`,title:`Could not load skills`,subtitle:e.error.message});let w=b===Q,T=e.isPending?[]:it({tree:m,matches:K(m,o),isOpen:S.isOpen,onFold:S.toggle,openKey:x,workflows:n.data?.workflows??[],activationFor:v,linkFor:y,groupActivationFor:e=>Ke(e,_),switchable:f&&c.ready,onActivate:c.setMany});return(0,L.jsxs)(`div`,{"data-slot":`skills-section`,className:`@container flex min-w-0 flex-col gap-[22px]`,children:[(0,L.jsxs)(`header`,{className:`flex flex-col gap-4 @min-[700px]:flex-row @min-[700px]:items-center @min-[700px]:justify-between`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h1`,{className:`text-[25px] font-semibold md:text-[30px]`,children:`Skills`}),(0,L.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground md:text-[13px]`,children:`Markdown playbooks your agents can follow.`})]}),(0,L.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,L.jsxs)(A,{to:w?`/skills`:`/skills?skill=${Q}`,"data-slot":`bookmarklets-row`,"aria-current":w?`page`:void 0,"aria-expanded":w,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium aria-[current=page]:bg-accent-strong/10 hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,L.jsx)(se,{"aria-hidden":`true`,className:`size-4 text-link-foreground`}),`Run from GitHub`]})})]}),w?(0,L.jsx)(`section`,{"data-slot":`skills-bookmarklets`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:(0,L.jsx)(_e,{skills:p.filter(e=>_(e.skill)&&!e.hiddenBy).map(e=>e.skill)})}):null,(0,L.jsx)(Ie,{}),(0,L.jsx)(ot,{query:o,onQuery:C,refreshing:l.isPending,onRefresh:()=>l.mutate(),onFoldAll:S.setAll}),(0,L.jsxs)(`section`,{"data-slot":`skills-list`,"aria-label":`Skills`,className:`flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-2 @min-[520px]:p-3`,children:[r.isError?(0,L.jsx)(st,{message:r.error.message,retrying:r.isFetching,onRetry:()=>void r.refetch()}):null,(0,L.jsx)(`div`,{"data-slot":`skill-rows`,className:`min-h-0 overflow-y-auto md:max-h-[calc(100dvh-260px)]`,children:e.isPending?(0,L.jsx)(`p`,{role:`status`,"aria-busy":`true`,className:`min-h-72 p-3 text-[13px] text-muted-foreground`,children:`Loading skills…`}):T.length>0?(0,L.jsxs)(`table`,{"data-slot":`skills-table`,className:`w-full table-fixed border-collapse text-left`,children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{className:`border-b border-border text-[12px] text-muted-foreground`,children:[(0,L.jsx)(`th`,{scope:`col`,className:`px-2 py-2 font-semibold`,children:`Skill / group`}),(0,L.jsx)(`th`,{scope:`col`,className:`hidden w-[30%] px-2 py-2 font-semibold @min-[520px]:table-cell`,children:`Used by`}),(0,L.jsx)(`th`,{scope:`col`,className:`w-[116px] px-2 py-2 text-right font-semibold`,children:`Enabled`})]})}),(0,L.jsx)(`tbody`,{children:T})]}):(0,L.jsx)(`p`,{className:`px-2.5 py-2 text-xs leading-relaxed text-soft-foreground`,children:p.length>0?`(no skills match)`:(0,L.jsx)(be,{})})})]})]})}function et(){let e=l();return w({mutationFn:()=>f(),onSuccess:t=>{e.setQueryData(E.skills,t),e.invalidateQueries({queryKey:E.importableSkills}),D(`Team skills refreshed.`)},onError:e=>D(e.message,{tone:`danger`})})}function tt(e,t,n){let r=new Set(e.filter(Ze).map(e=>e.name)),i=t?qe(t.filter(e=>!r.has(e.name)),e,n):[],a=(e,t)=>({skill:e,key:$(e),...t?{hiddenBy:t}:{}}),o=new Set((t??[]).map($)),s=[...e.filter(e=>e.source!==`team`||!o.has($(e))).map(e=>a(e)),...i.map(e=>a(e.skill,e.on?e.hiddenBy:void 0))].sort((e,t)=>e.skill.name.localeCompare(t.skill.name)),c=new Map(s.map(e=>[e.skill,e]));return fe(s.map(e=>e.skill)).map(e=>c.get(e))}function nt(e,t,n,r){if(t===null||t===Q)return null;if(t===Xe)return e.find(e=>!r(e.skill))??null;let i=e.filter(e=>e.skill.name===t);return i.find(e=>n===null||e.skill.team?.repo===n)??i[0]??null}function rt(e,t){let[n,r]=(0,M.useState)({}),i=e=>r(t=>({...t,...Object.fromEntries(e.map(e=>[e,!0]))})),a=t?q(e,new Set([t])).join(``):``;return(0,M.useEffect)(()=>{a&&r(e=>({...e,...Object.fromEntries(a.split(``).map(e=>[e,!0]))}))},[a]),{isOpen:(e,t)=>n[e.key]??t===0,toggle:(e,t)=>r(n=>({...n,[e]:t})),open:i,setAll:t=>r(Object.fromEntries(W(e).map(e=>[e,t])))}}function it(e){let t=[],n=t=>e.matches===null||e.matches.has(t.key),r=e=>e.items.some(n)||e.children.some(r),i=(a,o)=>{if(!r(a))return;let s=e.isOpen(a,o);if(t.push((0,L.jsx)(ut,{node:a,depth:o,open:s,onFold:()=>e.onFold(a.key,!s),activation:e.groupActivationFor(a),switchable:e.switchable,onActivate:e.onActivate},a.key)),s){for(let r of a.items.filter(n)){let n=r.key===e.openKey,i=he(e.workflows,r.skill.name),a=e.activationFor(r.skill);t.push((0,L.jsx)(ft,{item:r,depth:o+1,href:n?`/skills`:e.linkFor(r.skill),expanded:n,usedBy:i,activation:a},r.key)),n&&t.push((0,L.jsx)(at,{skill:r.skill,usedBy:i,activation:a},`${r.key}\u0000detail`))}for(let e of a.children)i(e,o+1)}};for(let t of e.tree)i(t,0);return t}function at({skill:e,usedBy:t,activation:n}){return(0,L.jsx)(`tr`,{"data-slot":`skill-detail-row`,children:(0,L.jsx)(`td`,{colSpan:3,className:`border-b border-border px-3 pb-5 @min-[520px]:px-5`,children:(0,L.jsx)(`div`,{"data-slot":`skills-detail`,className:`min-w-0 rounded-lg border border-border bg-background p-4 md:p-5`,children:(0,L.jsx)(ve,{skill:e,usedBy:t,activation:n})})})})}function ot({query:e,onQuery:t,refreshing:n,onRefresh:r,onFoldAll:i}){return(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsxs)(`div`,{className:`sw-search relative min-w-0 basis-full sm:basis-auto sm:flex-1`,children:[(0,L.jsx)(ae,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,L.jsx)(j,{"data-slot":`skills-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:e,onChange:e=>t(e.target.value),className:`h-11 min-w-0 bg-card pl-9 text-xs`})]}),(0,L.jsxs)(`button`,{type:`button`,"data-slot":`skills-refresh`,title:`git fetch the team skills repos`,disabled:n,onClick:r,className:`flex h-11 shrink-0 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-55`,children:[(0,L.jsx)(O,{"aria-hidden":`true`,className:o(`size-3`,n&&`motion-safe:animate-spin`)}),n?`Refreshing…`:`Refresh`]}),(0,L.jsx)(a,{type:`button`,variant:`outline`,"data-slot":`skills-expand-all`,className:`h-11 text-xs`,onClick:()=>i(!0),children:`Expand groups`}),(0,L.jsx)(a,{type:`button`,variant:`outline`,"data-slot":`skills-collapse-all`,className:`h-11 text-xs`,onClick:()=>i(!1),children:`Collapse groups`})]})}function st({message:e,retrying:t,onRetry:n}){return(0,L.jsxs)(`div`,{role:`alert`,"data-slot":`skills-importable-error`,className:`flex flex-col items-start gap-2 rounded-lg border border-border bg-background p-3 text-xs text-muted-foreground`,children:[(0,L.jsxs)(`span`,{children:[`Could not load the team skills, so they cannot be switched right now. Your saved choice is kept.`,` `,e]}),(0,L.jsx)(a,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11`,disabled:t,onClick:n,children:`Retry`})]})}var ct={repo:`repository`,plugin:`plugin`,directory:`directory`},lt=e=>({paddingInlineStart:`${e*16}px`});function ut({node:e,depth:t,open:n,onFold:r,activation:i,switchable:a,onActivate:s}){let c=n?ue:oe,l=ct[e.kind],u=e.locked||a;return(0,L.jsxs)(`tr`,{"data-slot":`skill-group-row`,"data-group":e.label,"data-kind":e.kind,"data-level":t,className:o(`border-b border-border`,t===0&&`bg-muted/40`),children:[(0,L.jsx)(`th`,{scope:`row`,className:`min-w-0 p-0 text-left font-normal`,children:(0,L.jsx)(`span`,{className:`flex min-w-0`,style:lt(t),children:(0,L.jsxs)(`button`,{type:`button`,"data-slot":`skill-group-toggle`,"aria-expanded":n,onClick:r,className:`flex min-h-11 min-w-0 flex-1 items-center gap-2 rounded-md px-2 text-left hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-link-foreground`,children:[(0,L.jsx)(c,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),(0,L.jsx)(`span`,{className:o(`min-w-0 [overflow-wrap:anywhere]`,t===0?`text-[13px] font-semibold`:`text-[13px] font-medium`),children:e.label}),l?(0,L.jsx)(`span`,{className:`shrink-0 text-[12px] text-soft-foreground`,children:l}):null]})})}),(0,L.jsx)(`td`,{"aria-hidden":`true`,className:`hidden @min-[520px]:table-cell`}),(0,L.jsx)(`td`,{className:`px-1 py-0 text-right`,children:(0,L.jsxs)(`span`,{className:`inline-flex items-center justify-end gap-1`,children:[(0,L.jsx)(`span`,{"data-slot":`skill-group-count`,className:`text-[12px] tabular-nums text-muted-foreground`,children:u?`${i.enabled} / ${i.total}`:`—`}),(0,L.jsx)(dt,{label:e.label,locked:e.locked,state:u?i.state:null,disabled:e.locked||!a||i.total===0,onClick:()=>s(i.refs,i.state!==`on`)})]})})]})}function dt({label:e,locked:t,state:n,disabled:r,onClick:i}){return(0,L.jsx)(`button`,{type:`button`,role:`checkbox`,"data-slot":`skill-group-switch`,"data-state":n??`unknown`,"aria-checked":n===null?void 0:n===`mixed`?`mixed`:n===`on`,"aria-busy":n===null||void 0,"aria-label":t?`${e} skills are always enabled`:`Enable all skills in ${e}`,disabled:r,onClick:i,className:`group/check inline-flex size-11 shrink-0 items-center justify-center rounded-md focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-link-foreground disabled:cursor-default`,children:(0,L.jsx)(`span`,{"aria-hidden":`true`,className:o(`inline-flex size-5 items-center justify-center rounded border-2 transition-colors`,n===`on`||n===`mixed`?`border-accent-strong bg-accent-strong text-accent-strong-foreground`:`border-muted-foreground bg-card text-transparent`,n===null&&`border-dashed border-soft-foreground`,`group-disabled/check:opacity-60`),children:n===`mixed`?(0,L.jsx)(ie,{className:`size-3.5`}):(0,L.jsx)(ce,{className:`size-3.5`})})})}function ft({item:e,depth:t,href:n,expanded:r,usedBy:i,activation:a}){let{skill:s,hiddenBy:c}=e,l=pe(s),u=[...new Set(i.map(e=>e.split(` › `)[0]))];return(0,L.jsxs)(`tr`,{"data-slot":`skill-table-row`,className:o(`border-b border-border`,r&&`border-transparent`),children:[(0,L.jsx)(`td`,{className:`min-w-0 p-0`,style:lt(t),children:(0,L.jsxs)(A,{to:n,"data-slot":`skill-row`,"data-skill":s.name,"data-repo":s.team?.repo,"data-project":l?`true`:void 0,"data-enabled":a.checked?`true`:void 0,"aria-current":r?`page`:void 0,"aria-expanded":r,className:o(`selection-row flex min-h-11 min-w-0 flex-col justify-center gap-1 rounded-md px-3 py-2 transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-link-foreground`,r&&`bg-accent-strong/10`),children:[(0,L.jsx)(`span`,{className:`flex min-w-0 items-center gap-2`,children:(0,L.jsx)(`span`,{className:o(`min-w-0 break-words text-[13px]`,l?`font-semibold text-foreground`:`font-normal text-muted-foreground`),children:s.name})}),s.description?(0,L.jsx)(`span`,{className:`line-clamp-1 text-xs leading-relaxed text-supporting-foreground`,children:s.description}):null,u.length>0?(0,L.jsxs)(`span`,{"data-slot":`skill-used-by-inline`,className:`text-xs text-supporting-foreground @min-[520px]:hidden`,children:[`Used by `,u.join(`, `)]}):null,c?(0,L.jsxs)(`span`,{"data-slot":`skill-hidden-by`,className:`min-w-0 text-xs text-supporting-foreground [overflow-wrap:anywhere]`,children:[`hidden by `,c]}):null]})}),(0,L.jsx)(`td`,{"data-slot":`skill-used-by-cell`,className:`hidden px-2 py-2 align-middle text-xs text-supporting-foreground @min-[520px]:table-cell`,children:u.length>0?(0,L.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:u.join(`, `)}):(0,L.jsx)(`span`,{className:`text-soft-foreground`,children:`—`})}),(0,L.jsx)(`td`,{className:`px-1 py-0 text-right align-middle`,children:(0,L.jsx)(`span`,{className:`inline-flex justify-end`,children:(0,L.jsx)(ge,{skill:s,activation:a})})})]})}export{Qe as SkillsRoute};
@@ -1 +1 @@
1
- import{l as e,u as t}from"./button-CHUAMTHK.js";import{t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./project-router-MMOk9VbW.js";var i=n();function a({to:n,active:a=!1,onClick:o,count:s,replace:c,className:l,children:u}){return(0,i.jsxs)(r,{to:n,...e({replace:c}),"aria-current":a?`page`:void 0,onClick:o,className:t(`-mb-px flex h-8 items-center rounded-t-md border-b-2 px-3 text-[13px] font-medium`,a?`border-foreground font-semibold text-foreground`:`border-transparent text-muted-foreground hover:bg-muted hover:text-foreground`,l),children:[u,s===void 0?null:(0,i.jsx)(`span`,{"data-slot":`tab-count`,className:`ml-1.5 text-[11.5px] font-normal text-soft-foreground`,children:s})]})}export{a as t};
1
+ import{l as e,u as t}from"./button-CS5tOblf.js";import{t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./project-router-BLO2IxbU.js";var i=n();function a({to:n,active:a=!1,onClick:o,count:s,replace:c,className:l,children:u}){return(0,i.jsxs)(r,{to:n,...e({replace:c}),"aria-current":a?`page`:void 0,onClick:o,className:t(`-mb-px flex h-8 items-center rounded-t-md border-b-2 px-3 text-[13px] font-medium`,a?`border-foreground font-semibold text-foreground`:`border-transparent text-muted-foreground hover:bg-muted hover:text-foreground`,l),children:[u,s===void 0?null:(0,i.jsx)(`span`,{"data-slot":`tab-count`,className:`ml-1.5 text-[11.5px] font-normal text-soft-foreground`,children:s})]})}export{a as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{E as t,t as n}from"./button-CS5tOblf.js";import{i as r,t as i}from"./react-runtime-CCIEwYL0.js";import{Ct as a,Kr as o,Kt as s,Qt as c,Wt as l,gn as u,h as d,i as f,w as p}from"./project-scope-context-DbO9a0ii.js";import{Cn as m,Nn as h,P as g,Un as _,_t as v,dt as y,gt as b,n as x}from"./queries-C_DEjjv2.js";import{n as S}from"./toaster-CRVRHlMR.js";import{M as C,w}from"./design-icons-DmYTv2r1.js";import{t as T}from"./run-header-B8M6-fvb.js";import{i as E,n as D,r as O}from"./git-toolbar-D0mTYtOj.js";import{t as k}from"./centered-state-BmsqxbI8.js";import{Fn as A,In as j,It as M,Ln as N,Lt as P,Mn as F,Nn as I,Pn as L,Rn as R,Z as z,gt as B,ot as V}from"./index-D51Su-nT.js";import{t as H}from"./markdown-BBDDg-4t.js";import{t as U}from"./diff-qq2vW6Xc.js";var W=e(r(),1),G=e=>e===`running`||e===`queued`||e===`waiting`,K=`no worktree — this task ran directly in the repo working tree`;function q(e){let t=e=>({id:`commit`,label:`Commit`,enabled:!1,reason:e});return e.hasWorktree?e.status===`running`?t(`Commit unavailable — the agent is still working in this worktree`):e.changedFiles===void 0?t(`Commit unavailable — changes are still loading`):e.changedFiles===0?t(`Commit unavailable — no changes to commit`):{id:`commit`,label:`Commit`,enabled:!0}:t(`Commit unavailable — ${K}`)}function J(e){let t=e=>({id:`push`,label:`Push`,enabled:!1,reason:e});return e.hasWorktree?e.remote===void 0?t(`Push unavailable — no remote configured`):e.branch===void 0?t(`Push unavailable — the run has no branch to push`):e.status===`running`?t(`Push unavailable — the agent is still working in this worktree`):{id:`push`,label:`Push`,enabled:!0}:t(`Push unavailable — ${K}`)}function Y(e){let t=e=>({id:`create-pr`,label:`Create PR`,enabled:!1,reason:e});return!e.hasWorktree||e.branch===void 0?t(`Create PR unavailable — ${K}`):e.forge===null?t(`Create PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?G(e.status)?t(`Create PR unavailable — the run is still active; wait for the review gate`):{id:`create-pr`,label:`Create PR`,enabled:!0}:t(`Create PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function X(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:q(e),n=e.prUrl?[q(e),J(e)]:[J(e),Y(e)],r=[];if(e.localHandoff){let t=e.hasSession?G(e.status)?{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — the session is still active in the engine`}:{id:`open-terminal`,label:`Open in terminal`,enabled:!0}:{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — no agent session to resume`};r.push(t)}return{primary:t,secondary:n,menu:r}}var Z=i();function Q({run:e,open:t,onOpenChange:r}){let i=o(),[a,s]=(0,W.useState)(``),c=m(e),l=(0,W.useRef)(c);l.current=c,(0,W.useEffect)(()=>{t&&s(l.current)},[t]);let u=_({mutationFn:t=>d(e.id,t),onSuccess:t=>{S(`Committed ${t.sha.slice(0,7)}`),r(!1),i.invalidateQueries({queryKey:x.runs.changes(e.id)}),i.invalidateQueries({queryKey:x.runs.all})},onError:e=>S(e.message,{tone:`danger`})}),f=()=>{let e=a.trim();e.length===0||u.isPending||u.mutate(e)};return(0,Z.jsx)(F,{open:t,onOpenChange:r,children:(0,Z.jsxs)(I,{"data-slot":`commit-dialog`,children:[(0,Z.jsxs)(j,{children:[(0,Z.jsx)(N,{children:`Commit changes`}),(0,Z.jsxs)(L,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,Z.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,`.`]})]}),(0,Z.jsx)(B,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:a,onChange:e=>s(e.target.value),onKeyDown:e=>{R({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())}}),(0,Z.jsxs)(A,{children:[(0,Z.jsx)(n,{variant:`outline`,onClick:()=>r(!1),children:`Cancel`}),(0,Z.jsx)(n,{"data-slot":`commit-confirm`,disabled:a.trim().length===0||u.isPending,onClick:f,children:u.isPending?`Committing…`:`Commit`})]})]})})}function $(){let{id:e}=t(),n=b(e);return n.isPending?(0,Z.jsx)(P,{tab:`changes`}):n.isError?(0,Z.jsx)(M,{tab:`changes`,error:n.error}):(0,Z.jsx)(ee,{run:n.data})}function ee({run:e}){let t=g(),n=y(),r=v(e.id,h(e)),i=V(),[a,u]=(0,W.useState)(`unified`),[d,m]=(0,W.useState)(!1),[b,C]=(0,W.useState)(!1),[w,E]=(0,W.useState)(null),[k,A]=(0,W.useState)(!1),j=(0,W.useRef)(null),M=o(),N=()=>M.invalidateQueries({queryKey:x.runs.all}),P=e=>S(e.message,{tone:`danger`}),F=_({mutationFn:()=>c(e.id),onSuccess:e=>S(e.upstreamSet?`Pushed ${e.branch} to ${e.remote} (upstream set)`:`Pushed ${e.branch} to ${e.remote}`),onError:P}),I=_({mutationFn:()=>p(e.id),onSuccess:e=>{S(`Draft PR created — ${e.url}`),N()},onError:P}),L=_({mutationFn:()=>s(e.id),onError:e=>{if(e instanceof f&&e.command){navigator.clipboard.writeText(e.command).then(()=>S(`No terminal found — command copied to clipboard.`)).catch(()=>S(`Run manually: ${e.command}`));return}P(e)}}),R=_({mutationFn:t=>l(e.id,t),onError:P}),B=r.isError&&r.error instanceof f&&r.error.status===409,U=X({status:e.status,hasWorktree:!!e.worktreePath&&!B,branch:e.branch,changedFiles:r.data?.stat.files,remote:n.data?.info?.remote,forge:t.data?.forge??null,localHandoff:t.data?.capabilities.localHandoff??!1,hasSession:z(e)!==void 0,prUrl:e.pullRequestUrl}),G=e=>{switch(e){case`commit`:A(!0);break;case`push`:F.mutate();break;case`create-pr`:I.mutate();break;case`open-terminal`:L.mutate();break;case`view-pr`:break}},K=r.data?.files??[],q=(0,W.useMemo)(()=>O(K),[K]),J=(0,W.useMemo)(()=>K.some(H),[K]),Y=i?a:`unified`,$=!i||d;return(0,Z.jsxs)(`div`,{"data-route":`task-changes`,className:`flex min-h-full flex-col`,children:[(0,Z.jsx)(T,{run:e,tab:`changes`}),(0,Z.jsx)(D,{bar:U,healthReady:t.data!==void 0,branch:e.branch,stat:r.data?.stat,mode:Y,wrap:$,preview:b,onModeChange:u,onWrapChange:m,onPreviewChange:J?C:void 0,onAction:G}),r.data?.repointedHead?(0,Z.jsxs)(`p`,{"data-slot":`repointed-head-note`,className:`border-b px-4 py-2 text-xs text-soft-foreground md:px-9`,children:[`HEAD is on `,(0,Z.jsx)(`code`,{children:r.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,Z.jsx)(`code`,{children:r.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,(0,Z.jsx)(te,{changes:r,changesRefused:B,fileCount:K.length,children:(0,Z.jsx)(ne,{runId:e.id,files:K,tree:q,selected:w,selectFile:e=>{E(e),j.current?.scrollToPath(e)},diffRef:j,effectiveMode:Y,effectiveWrap:$,preview:b,localHandoff:t.data?.capabilities.localHandoff,onOpenInApp:R.mutate})}),(0,Z.jsx)(Q,{run:e,open:k,onOpenChange:A})]})}function te({changes:e,changesRefused:t,fileCount:n,children:r}){return e.isPending?(0,Z.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):e.isError?(0,Z.jsx)(k,{icon:t?(0,Z.jsx)(w,{size:16}):(0,Z.jsx)(C,{size:16}),tone:t?`neutral`:`danger`,heading:`h2`,title:t?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):n===0?(0,Z.jsx)(k,{icon:(0,Z.jsx)(w,{size:16}),tone:`neutral`,heading:`h2`,title:`No changes yet`,subtitle:`The worktree matches its base branch. Changes appear here as the agent works.`}):r}function ne({runId:e,files:t,tree:n,selected:r,selectFile:i,diffRef:a,effectiveMode:o,effectiveWrap:s,preview:c,localHandoff:l,onOpenInApp:d}){return(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 md:flex-row md:items-start px-[18px] pb-9 pt-0 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem] md:px-9`,children:[(0,Z.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`md:sticky md:top-4 max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] w-full md:w-60 shrink-0 overflow-y-auto overscroll-contain rounded-xl border border-border bg-card p-3.5 md:block lg:w-[250px]`,children:[(0,Z.jsx)(`h2`,{className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,Z.jsx)(E,{root:n,selected:r,onSelect:i})]}),(0,Z.jsx)(U,{files:t,viewRef:a,mode:o,wrap:s,preview:c,loadFileText:t=>re(e,t),imageSrc:t=>u(e,t),onOpenInApp:l?e=>d(e):void 0,className:`min-w-0 flex-1`})]})}async function re(e,t){try{let n=await a(e,t);return n.type!==`file`||n.binary||n.tooLarge?null:n.content??null}catch{return null}}export{$ as TaskChangesRoute};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{E as t,u as n}from"./button-CS5tOblf.js";import{i as r,t as i}from"./react-runtime-CCIEwYL0.js";import{i as a}from"./project-scope-context-DbO9a0ii.js";import{Nn as o,_t as s,gt as c,vt as l,yt as u}from"./queries-C_DEjjv2.js";import{C as d,M as f,Q as p,w as m}from"./design-icons-DmYTv2r1.js";import{t as h}from"./run-header-B8M6-fvb.js";import{t as g}from"./project-router-BLO2IxbU.js";import{t as _}from"./centered-state-BmsqxbI8.js";import{It as v,Lt as y,Vt as b,lt as x}from"./index-D51Su-nT.js";import{t as S}from"./commit-diff-panel-DGx2t9Pw.js";var C=e(r(),1),w=i(),T=77;function E({slot:e,commits:t,className:r,heading:i}){let[a,o]=(0,C.useState)(``),s=a.trim().toLowerCase(),c=s?t.filter(e=>e.subject.toLowerCase().includes(s)):t,l=c.length>150,u=(0,C.useRef)(null),d=(0,C.useRef)(null),[f,m]=(0,C.useState)(0);(0,C.useLayoutEffect)(()=>{if(!l)return;let e=()=>{let e=u.current,t=d.current;!e||!t||m(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[l]);let h=c.map(n=>(0,w.jsx)(D,{commit:n,detailed:e===`task-commits`&&t.length===1},n.sha));return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`label`,{className:`relative mb-[22px] block`,children:[(0,w.jsx)(p,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3.5 left-3 size-4 text-muted-foreground`}),(0,w.jsx)(b,{"aria-label":`Search commit messages`,placeholder:`Search commit messages…`,value:a,onChange:e=>o(e.target.value),className:`h-11 bg-card pl-10`})]}),(0,w.jsxs)(`div`,{ref:e=>{u.current=e,e&&(d.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":l,className:n(`flex flex-col divide-y divide-border rounded-xl border border-border bg-card px-4 py-1 md:px-5`,r),children:[i?(0,w.jsx)(`div`,{className:`flex min-h-14 flex-wrap items-center gap-2 py-4`,children:i}):null,c.length===0?(0,w.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,l?(0,w.jsx)(x,{scrollRef:d,startMargin:f,itemSize:T,children:h}):h]})]})}function D({commit:e,detailed:t}){return(0,w.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_77px] [content-visibility:auto]`,children:(0,w.jsxs)(g,{"data-slot":`commit-row`,"data-sha":e.sha,to:e.href,className:n(`flex min-h-[76px] min-w-0 flex-col items-start gap-3 rounded-sm py-4 hover:bg-muted`,!t&&`md:flex-row md:items-center md:py-3`),children:[(0,w.jsx)(f,{size:16,"aria-hidden":`true`,className:n(`shrink-0 text-accent-text`,t?`size-[22px]`:`size-4`)}),(0,w.jsxs)(`span`,{className:n(`min-w-0 w-full`,!t&&`md:w-auto md:flex-1`),children:[(0,w.jsx)(`span`,{className:n(`block font-normal`,t?`text-[22px] leading-snug`:`text-[13px] md:truncate`),children:e.subject}),(0,w.jsxs)(`span`,{className:`mt-1 block truncate text-[11px] text-soft-foreground`,children:[e.author,` · `,e.when]})]}),(0,w.jsx)(`span`,{className:`shrink-0 rounded-md bg-muted px-2 py-1 font-mono text-[11px] text-muted-foreground`,children:e.shaLabel}),t?(0,w.jsxs)(`span`,{className:`inline-flex min-h-11 items-center gap-2 rounded-lg bg-action px-3 text-xs font-medium text-action-foreground`,children:[(0,w.jsx)(m,{size:16,"aria-hidden":`true`,className:`size-4`}),`View changes`]}):null]})})}function O(){let{id:e}=t(),n=c(e);return n.isPending?(0,w.jsx)(y,{tab:`changes`}):n.isError?(0,w.jsx)(v,{tab:`changes`,error:n.error}):(0,w.jsx)(k,{run:n.data})}function k({run:e}){let{sha:n}=t(),r=u(e.id,o(e));return(0,w.jsxs)(`div`,{"data-route":`task-commits`,className:`flex min-h-full flex-col`,children:[(0,w.jsx)(h,{run:e,tab:`commits`}),n?(0,w.jsx)(A,{runId:e.id,sha:n}):r.isPending?(0,w.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commits…`}):r.isError?(0,w.jsx)(_,{icon:(0,w.jsx)(f,{size:16}),tone:r.error instanceof a&&r.error.status===409?`neutral`:`danger`,heading:`h2`,title:r.error instanceof a&&r.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:r.error.message}):r.data.commits.length===0?(0,w.jsx)(_,{icon:(0,w.jsx)(f,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`This task hasn't committed anything on its branch. Autosave commits and any the agent makes appear here.`}):(0,w.jsxs)(`div`,{className:`px-[18px] py-[22px] md:px-9`,children:[(0,w.jsx)(E,{slot:`task-commits`,heading:(0,w.jsxs)(`h2`,{className:`text-base font-semibold`,children:[r.data.commits.length,` `,r.data.commits.length===1?`commit`:`commits`,` in this task`]}),className:`w-full`,commits:r.data.commits.map(t=>({...t,shaLabel:t.sha.slice(0,8),href:`/tasks/${e.id}/commits/${t.sha}`}))}),(0,w.jsx)(j,{run:e})]})]})}function A({runId:e,sha:t}){return(0,w.jsx)(S,{commit:l(e,t),sha:t,backTo:`/tasks/${e}/commits`,backLabel:`All commits`,slot:`task-commit`,className:`mx-auto flex min-h-0 w-full max-w-[var(--measure)] flex-1 flex-col`,diffClassName:`px-4 py-4 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem] md:px-6`})}function j({run:e}){let t=s(e.id,o(e));return t.isPending?(0,w.jsx)(`p`,{className:`mt-[22px] text-xs text-muted-foreground`,children:`Loading changed files…`}):t.isError?(0,w.jsxs)(`p`,{role:`status`,className:`mt-[22px] text-xs text-danger`,children:[`Could not load changed files: `,t.error.message]}):t.data.files.length===0?null:(0,w.jsxs)(`section`,{"data-slot":`task-commit-files`,className:`mt-[22px] rounded-[10px] border border-border bg-card p-5`,children:[(0,w.jsxs)(`h2`,{className:`mb-4 text-[16px] font-semibold`,children:[t.data.files.length,` changed files`]}),(0,w.jsx)(`ul`,{className:`space-y-4`,children:t.data.files.map(t=>(0,w.jsx)(`li`,{children:(0,w.jsxs)(g,{to:`/tasks/${e.id}/changes`,className:`flex min-h-11 items-center gap-2 text-xs text-muted-foreground hover:text-foreground`,children:[(0,w.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-[15px] shrink-0`}),(0,w.jsx)(`span`,{className:`break-all`,children:t.path})]})},t.path))})]})}export{O as TaskCommitsRoute};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{C as t,D as n,E as r,T as i,t as a,u as o}from"./button-CS5tOblf.js";import{i as s,t as c}from"./react-runtime-CCIEwYL0.js";import{N as l,i as u,s as d}from"./project-scope-context-DbO9a0ii.js";import{C as f,f as p,gt as m,u as h,xt as g}from"./queries-C_DEjjv2.js";import{C as _,E as v,Q as y,ct as b,d as x}from"./design-icons-DmYTv2r1.js";import{t as S}from"./createLucideIcon-BHp8sXmF.js";import{n as C,t as w}from"./run-header-B8M6-fvb.js";import{a as T,i as E,n as D,r as O}from"./file-preview-YiP5f666.js";import{t as k}from"./centered-state-BmsqxbI8.js";import{It as A,Lt as j,Qt as M,Vt as N}from"./index-D51Su-nT.js";var P=S(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),F=S(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),I=e(s(),1),L=c();function R({runId:e,path:n,artifactId:r}){let i=f(e,r?null:n),o=h(e,r),s=r?o:i,c=(0,I.useContext)(M),u=t(),p=u.pathname.replace(/\/files\/?$/,`/report`)+u.search,m=s.data,g=(0,I.useMemo)(()=>m?.type===`file`&&m.source!==`artifact`?{runId:e,...c,basePath:m.path}:null,[m,c,e]);if(!n&&!r)return(0,L.jsx)(O,{runId:e,path:null,className:`min-w-0 flex-1`});if(s.isPending)return(0,L.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading file…`});if(s.isError)return(0,L.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,L.jsx)(`h2`,{children:`Could not load this file`}),(0,L.jsx)(`p`,{className:`wrap-anywhere text-sm`,children:s.error.message}),(0,L.jsx)(a,{variant:`outline`,onClick:()=>void s.refetch(),children:`Retry`})]});if(!m)return(0,L.jsx)(`p`,{role:`alert`,className:`p-4`,children:`No file data was returned.`});if(m.type!==`file`)return(0,L.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,L.jsx)(`h2`,{children:m.type===`unpublished`?`File not published`:`Cannot preview this file`}),(0,L.jsx)(`p`,{className:`wrap-anywhere py-2 font-mono text-xs`,children:m.path}),(0,L.jsx)(`p`,{className:`text-sm`,children:m.reason}),(0,L.jsx)(a,{variant:`outline`,onClick:()=>void s.refetch(),children:`Retry`})]});let _=m.artifact;return(0,L.jsx)(M.Provider,{value:g,children:(0,L.jsx)(D,{runId:e,entry:m,documentPreview:!0,readerHref:p,className:`min-w-0 flex-1`,imageUrl:_?d(e,_.id,`image`):l(e,n),..._?{downloadUrl:d(e,_.id,`download`),snapshot:new Date(_.createdAt).toLocaleString()}:{}},_?.id??m.path)})}var z=new Map;function B(e){let t=e?.filesRestoreKey;return typeof t==`string`&&t?t:null}var V=(0,I.createContext)(null);function H(){let{key:e}=t(),n=i()===`POP`,[r,a]=(0,I.useState)({key:e,generation:0});if(r.key===e)return r.generation;let o={key:e,generation:n?r.generation+1:r.generation};return a(o),o.generation}var U=()=>document.querySelector(`[data-slot="main"]`);function W(e,n){let r=(0,I.useRef)(null),a=t(),o=i()===`POP`?a.key:B(a.state),[s]=(0,I.useState)(()=>{let t=o?z.get(o):void 0;return t?.runId===e?t:null}),c=(0,I.useRef)(new Set(s?.folders??[])),l=(0,I.useRef)(new Set),[u,d]=(0,I.useState)(0),f=(0,I.useRef)(s===null),p=(0,I.useCallback)(()=>{f.current&&z.set(a.key,{runId:e,folders:new Set(c.current),tree:r.current?.scrollTop??0,main:U()?.scrollTop??0})},[a.key,e]),m=(0,I.useMemo)(()=>({isOpen:e=>c.current.has(e),setOpen:(e,t)=>{t?c.current.add(e):c.current.delete(e),p()},loading:(e,t)=>{s?.folders.has(e)&&(t?l.current.add(e):l.current.delete(e),d(l.current.size))}}),[s,p]);return(0,I.useEffect)(()=>{if(f.current||!s||!n||l.current.size>0)return;r.current&&(r.current.scrollTop=s.tree);let e=U();e&&(e.scrollTop=s.main),f.current=!0,p()},[s,n,u,p]),(0,I.useEffect)(()=>{p();let e=[r.current,U()].filter(e=>e!==null);for(let t of e)t.addEventListener(`scroll`,p,{passive:!0});return()=>{for(let t of e)t.removeEventListener(`scroll`,p)}},[p]),{tree:r,folders:m}}function G({runId:e,selected:t,onSelect:n}){return(0,L.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,L.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,L.jsx)(K,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function K({runId:e,path:t,depth:n,selected:r,onSelect:i}){let a=g(e,t),o=(0,I.useContext)(V);return(0,I.useEffect)(()=>{if(!(!t||!o))return o.loading(t,a.isPending),()=>o.loading(t,!1)},[o,t,a.isPending]),a.isPending?(0,L.jsx)(`li`,{"data-slot":`files-tree-loading`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Loading…`}):a.isError?(0,L.jsx)(`li`,{"data-slot":`files-tree-error`,className:`px-1.5 py-1 text-xs text-danger`,style:{paddingLeft:`${6+n*14}px`},children:a.error.message}):a.data.type===`dir`?a.data.entries.length===0?(0,L.jsx)(`li`,{"data-slot":`files-tree-empty`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Empty directory`}):(0,L.jsx)(L.Fragment,{children:a.data.entries.map(a=>a.type===`dir`?(0,L.jsx)(q,{runId:e,name:a.name,path:t===``?a.name:`${t}/${a.name}`,depth:n,selected:r,onSelect:i},a.name):(0,L.jsx)(J,{name:a.name,path:t===``?a.name:`${t}/${a.name}`,size:a.size,depth:n,selected:r,onSelect:i},a.name))}):null}function q({runId:e,name:t,path:n,depth:r,selected:i,onSelect:a}){let s=(0,I.useContext)(V),[c,l]=(0,I.useState)(()=>s?.isOpen(n)??!1);return(0,L.jsxs)(`li`,{children:[(0,L.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":c?`open`:`closed`,"aria-expanded":c,onClick:()=>{s?.setOpen(n,!c),l(!c)},className:`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+r*14}px`},children:[(0,L.jsx)(x,{size:16,"aria-hidden":`true`,className:o(`order-last ml-auto size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,c&&`rotate-90`)}),(0,L.jsx)(v,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,L.jsx)(`span`,{className:`min-w-0 truncate font-normal`,children:t})]}),c?(0,L.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,L.jsx)(K,{runId:e,path:n,depth:r+1,selected:i,onSelect:a})}):null]})}function J({name:e,path:t,size:n,depth:r,selected:i,onSelect:a}){let s=i===t,c=T(t)?F:_;return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":s?`true`:void 0,onClick:()=>a(t),className:o(`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,s?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${6+r*14}px`},children:[(0,L.jsx)(c,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,L.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] tabular-nums text-soft-foreground`,children:E(n)})]})})}function Y(){let{id:e}=r(),t=m(e),n=H();return t.isPending?(0,L.jsx)(j,{tab:`files`}):t.isError?(0,L.jsx)(A,{tab:`files`,error:t.error}):(0,L.jsx)(C,{runId:t.data.id,children:(0,L.jsx)(Z,{run:t.data},`${t.data.id}:${n}`)})}function X(e,t,n,r){let i=f(e,r||n!==null?null:t),a=h(e,r?null:n);return r||t===null&&n===null?!0:!(n===null?i:a).isPending}function Z({run:e}){let t=g(e.id,``),r=p(e.id),[i,o]=n(),s=i.get(`path`),c=i.get(`artifact`),l=i.getAll(`path`).length>1||i.getAll(`artifact`).length>1||s!==null&&c!==null,[d,f]=(0,I.useState)(s??``);(0,I.useEffect)(()=>f(s??``),[s]);let m=(e,t)=>{let n=new URLSearchParams(i);n.delete(`path`),n.delete(`artifact`),n.set(e,t),o(n)},h=t.isError&&t.error instanceof u&&t.error.status===409,_=X(e.id,s,c,l),v=W(e.id,!t.isPending&&_);return(0,L.jsxs)(`div`,{"data-route":`task-files`,className:`flex min-h-full flex-col`,children:[(0,L.jsx)(w,{run:e,tab:`files`}),(0,L.jsxs)(`form`,{className:`flex min-w-0 gap-2 px-[18px] pt-[22px] md:px-9`,onSubmit:e=>{e.preventDefault(),d.trim()&&m(`path`,d.trim())},children:[(0,L.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,L.jsx)(y,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,L.jsx)(N,{"aria-label":`File path in the worktree`,placeholder:`Open a file by path…`,value:d,onChange:e=>f(e.target.value),className:`h-11 min-w-0 bg-card pl-10`})]}),(0,L.jsx)(a,{type:`submit`,variant:`outline`,className:`h-11 shrink-0`,disabled:!d.trim(),children:`Open file`})]}),(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-col items-stretch gap-5 px-[18px] py-[22px] [--diff-sticky-top:1rem] md:flex-row md:items-start md:px-9`,children:[(0,L.jsxs)(`aside`,{ref:v.tree,"data-slot":`files-tree-pane`,className:`w-full shrink-0 rounded-xl border border-border bg-card p-3.5 md:sticky md:top-[var(--diff-sticky-top)] md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain lg:w-72`,children:[(0,L.jsx)(`h2`,{className:`sr-only`,children:`Worktree files`}),t.isPending?(0,L.jsx)(`p`,{"data-slot":`files-loading`,className:`py-4 text-xs`,children:`Loading files…`}):t.isError?(0,L.jsx)(k,{icon:h?(0,L.jsx)(P,{}):(0,L.jsx)(b,{size:16}),tone:h?`neutral`:`danger`,heading:`h2`,title:h?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,L.jsx)(V.Provider,{value:v.folders,children:(0,L.jsx)(G,{runId:e.id,selected:s,onSelect:e=>m(`path`,e)})}),(0,L.jsxs)(`section`,{className:`mt-4 border-t border-border pt-3`,"aria-label":`Published artifacts`,children:[(0,L.jsx)(`h2`,{className:`text-sm font-medium`,children:`Published artifacts`}),r.isPending?(0,L.jsx)(`p`,{className:`py-2 text-xs`,children:`Loading published files…`}):r.isError?(0,L.jsx)(`p`,{role:`alert`,className:`py-2 text-xs`,children:`Could not load published files.`}):r.data.artifacts.length===0?(0,L.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No published files yet.`}):(0,L.jsx)(`ul`,{children:r.data.artifacts.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsx)(`button`,{type:`button`,"aria-current":e.id===c?`true`:void 0,className:`min-h-11 w-full rounded px-2 py-2 text-left text-xs wrap-anywhere hover:bg-muted focus-visible:ring-2`,onClick:()=>m(`artifact`,e.id),children:e.name})},e.id))}),(0,L.jsx)(a,{variant:`ghost`,className:`min-h-11`,onClick:()=>void r.refetch(),children:`Refresh published files`})]})]}),l?(0,L.jsx)(`p`,{role:`alert`,className:`p-4`,children:`Invalid file link: choose either a path or a published artifact.`}):s!==null||c!==null||t.isSuccess?(0,L.jsx)(R,{runId:e.id,path:s,artifactId:c}):null]}),(0,L.jsx)(`p`,{className:`px-[18px] pb-6 text-xs text-muted-foreground md:px-9`,children:`Browsing files is read-only. Worktree contents may differ from your main checkout. Published files are snapshots.`})]})}export{Y as TaskFilesRoute};
@@ -1 +1 @@
1
- import{E as e,d as t,t as n}from"./button-CHUAMTHK.js";import{t as r}from"./react-runtime-CCIEwYL0.js";import{Jr as i,tt as a}from"./project-scope-context-B3M-u8R0.js";import{$ as o,E as s,J as c,P as l,Un as u,an as d,cn as f,gt as p,k as m,n as h}from"./queries-DORTKwyN.js";import{s as g}from"./popover-DRcRI46x.js";import{I as _,ct as v,m as y}from"./design-icons-DmYTv2r1.js";import{t as b}from"./run-header-Bgtlx-vc.js";import{u as x}from"./control-locations-C9II3kPz.js";import{t as S}from"./project-router-MMOk9VbW.js";import{t as C}from"./centered-state-DGyy0SuA.js";import{St as w,Wt as T,xt as E}from"./index-B5LayM4y.js";import{n as D,o as O,t as k}from"./use-hand-to-agent-state-DyVB4IBv.js";var A=r(),j={issue:`Issue`,pr:`Pull request`};function M({kind:t}){let{id:n}=e(),r=p(n);return r.isPending?(0,A.jsx)(E,{kind:t}):r.isError?(0,A.jsx)(w,{tab:`github-item`,error:r.error}):(0,A.jsx)(N,{run:r.data,kind:t})}function N({run:t,kind:r}){let{n:i}=e(),a=Number(i),s=c(),u=o(),f=l(),p=u.isPending||f.isPending,h=d(t,s).some(e=>e.kind===r&&e.number===a),g=m(r,a,h);return(0,A.jsxs)(`div`,{"data-route":`task-github-item`,className:`flex min-h-full flex-col`,children:[(0,A.jsx)(b,{run:t,tab:{kind:r,number:a}}),h?(0,A.jsx)(V,{run:t,kind:r,number:a,repoBase:s,item:g}):p?(0,A.jsx)(E,{kind:r,number:a,heading:`h2`}):(0,A.jsx)(C,{icon:(0,A.jsx)(T,{size:16}),tone:`neutral`,heading:`h2`,title:`#${i} is not linked to this task`,subtitle:`Only the issues and pull requests this task references open here.`,actions:(0,A.jsx)(n,{asChild:!0,variant:`outline`,children:(0,A.jsx)(S,{to:`/tasks/${t.id}`,children:`Back to the session`})})})]})}function P(e,t){return e===`pr`&&t.data?.available===!0&&t.data.item!==null}function F(e,t,n,r){return e===`pr`?n?.[t]??r:r}function I({retry:e,kind:t,number:r}){return(0,A.jsx)(n,{variant:`outline`,disabled:e.isPending,onClick:()=>e.mutate(h.githubItem(t,r)),children:`Retry`})}function L({kind:e,number:t,error:n,retryButton:r}){return(0,A.jsx)(C,{icon:(0,A.jsx)(v,{size:16}),tone:`danger`,heading:`h2`,title:`Could not load ${j[e].toLowerCase()} #${t}`,subtitle:n.message,actions:r})}function R({run:e,kind:r,number:i,repoBase:a,reason:o,retryError:s,retryButton:c}){let l=r===`pr`?_:y,u=f(e,a).find(e=>e.kind===`PR`==(r===`pr`)&&e.number===i)?.url;return(0,A.jsx)(C,{icon:(0,A.jsx)(l,{size:16}),tone:`neutral`,heading:`h2`,title:`GitHub is unavailable`,subtitle:s?.message??o,actions:(0,A.jsxs)(A.Fragment,{children:[c,u&&t(u)?(0,A.jsx)(n,{asChild:!0,variant:`outline`,children:(0,A.jsxs)(`a`,{href:u,target:`_blank`,rel:`noopener noreferrer`,children:[`open on GitHub`,(0,A.jsx)(g,{"aria-hidden":`true`})]})}):null]})})}function z({label:e,repoBase:t}){return(0,A.jsx)(C,{icon:(0,A.jsx)(x,{}),tone:`neutral`,heading:`h2`,title:`${e} was not found in ${H(t)}`,subtitle:`It may have been deleted, or the number points at a different repository.`})}function B({kind:e,item:t,labelColors:n,checks:r}){return(0,A.jsx)(`div`,{className:`min-w-0 px-0.5 md:px-2`,children:(0,A.jsx)(O,{item:t,colors:n??{},checks:r,backLink:null,subNav:null,children:e===`issue`?(0,A.jsx)(U,{item:t},t.url):null})})}function V({run:e,kind:t,number:n,repoBase:r,item:o}){let c=i(),l=u({mutationFn:e=>a(t,n,{refresh:!0}),onSuccess:(e,t)=>c.setQueryData(t,e)}),d=P(t,o),f=s(d?[n]:[],d),p=f.data?.available?f.data.checks:void 0,m=`${j[t]} #${n}`,h=(0,A.jsx)(I,{retry:l,kind:t,number:n});if(o.isPending)return(0,A.jsx)(E,{kind:t,number:n,heading:`h2`});if(o.isError)return(0,A.jsx)(L,{kind:t,number:n,error:l.error??o.error,retryButton:h});let g=o.data;return g.available?g.item?(0,A.jsx)(B,{kind:t,item:g.item,labelColors:g.labelColors,checks:F(t,n,p,g.item.checks)}):(0,A.jsx)(z,{label:m,repoBase:r}):(0,A.jsx)(R,{run:e,kind:t,number:n,repoBase:r,reason:g.reason,retryError:l.error,retryButton:h})}function H(e){if(!e)return`this repository`;try{return new URL(e).pathname.split(`/`).filter(Boolean).slice(0,2).join(`/`)||`this repository`}catch{return`this repository`}}function U({item:e}){let t=k();return(0,A.jsx)(D,{item:e,workflows:t.workflows.data?.workflows??[],skills:t.skillList,workflow:t.workflow,onWorkflowChange:t.setWorkflow,selectedSkills:t.selectedSkills,onSkillsChange:t.setSelectedSkills,engine:t.engine,onEngineChange:t.setEngine,queuedRunId:t.queued.get(e.url)??null,onQueued:t.onQueued},e.url)}export{M as TaskGithubItemRoute};
1
+ import{E as e,d as t,t as n}from"./button-CS5tOblf.js";import{t as r}from"./react-runtime-CCIEwYL0.js";import{Kr as i,et as a}from"./project-scope-context-DbO9a0ii.js";import{$ as o,E as s,J as c,P as l,Un as u,an as d,cn as f,gt as p,k as m,n as h}from"./queries-C_DEjjv2.js";import{I as g,ct as _,m as v}from"./design-icons-DmYTv2r1.js";import{t as y}from"./run-header-B8M6-fvb.js";import{s as b}from"./popover-s-Wchzjn.js";import{u as x}from"./control-locations-CD2r0mMU.js";import{t as S}from"./project-router-BLO2IxbU.js";import{t as C}from"./centered-state-BmsqxbI8.js";import{Ft as w,It as T,dr as E}from"./index-D51Su-nT.js";import{n as D,o as O,t as k}from"./use-hand-to-agent-state-CZK9cWMq.js";var A=r(),j={issue:`Issue`,pr:`Pull request`};function M({kind:t}){let{id:n}=e(),r=p(n);return r.isPending?(0,A.jsx)(w,{kind:t}):r.isError?(0,A.jsx)(T,{tab:`github-item`,error:r.error}):(0,A.jsx)(N,{run:r.data,kind:t})}function N({run:t,kind:r}){let{n:i}=e(),a=Number(i),s=c(),u=o(),f=l(),p=u.isPending||f.isPending,h=d(t,s).some(e=>e.kind===r&&e.number===a),g=m(r,a,h);return(0,A.jsxs)(`div`,{"data-route":`task-github-item`,className:`flex min-h-full flex-col`,children:[(0,A.jsx)(y,{run:t,tab:{kind:r,number:a}}),h?(0,A.jsx)(V,{run:t,kind:r,number:a,repoBase:s,item:g}):p?(0,A.jsx)(w,{kind:r,number:a,heading:`h2`}):(0,A.jsx)(C,{icon:(0,A.jsx)(E,{size:16}),tone:`neutral`,heading:`h2`,title:`#${i} is not linked to this task`,subtitle:`Only the issues and pull requests this task references open here.`,actions:(0,A.jsx)(n,{asChild:!0,variant:`outline`,children:(0,A.jsx)(S,{to:`/tasks/${t.id}`,children:`Back to the session`})})})]})}function P(e,t){return e===`pr`&&t.data?.available===!0&&t.data.item!==null}function F(e,t,n,r){return e===`pr`?n?.[t]??r:r}function I({retry:e,kind:t,number:r}){return(0,A.jsx)(n,{variant:`outline`,disabled:e.isPending,onClick:()=>e.mutate(h.githubItem(t,r)),children:`Retry`})}function L({kind:e,number:t,error:n,retryButton:r}){return(0,A.jsx)(C,{icon:(0,A.jsx)(_,{size:16}),tone:`danger`,heading:`h2`,title:`Could not load ${j[e].toLowerCase()} #${t}`,subtitle:n.message,actions:r})}function R({run:e,kind:r,number:i,repoBase:a,reason:o,retryError:s,retryButton:c}){let l=r===`pr`?g:v,u=f(e,a).find(e=>e.kind===`PR`==(r===`pr`)&&e.number===i)?.url;return(0,A.jsx)(C,{icon:(0,A.jsx)(l,{size:16}),tone:`neutral`,heading:`h2`,title:`GitHub is unavailable`,subtitle:s?.message??o,actions:(0,A.jsxs)(A.Fragment,{children:[c,u&&t(u)?(0,A.jsx)(n,{asChild:!0,variant:`outline`,children:(0,A.jsxs)(`a`,{href:u,target:`_blank`,rel:`noopener noreferrer`,children:[`open on GitHub`,(0,A.jsx)(b,{"aria-hidden":`true`})]})}):null]})})}function z({label:e,repoBase:t}){return(0,A.jsx)(C,{icon:(0,A.jsx)(x,{}),tone:`neutral`,heading:`h2`,title:`${e} was not found in ${H(t)}`,subtitle:`It may have been deleted, or the number points at a different repository.`})}function B({kind:e,item:t,labelColors:n,checks:r}){return(0,A.jsx)(`div`,{className:`min-w-0 px-0.5 md:px-2`,children:(0,A.jsx)(O,{item:t,colors:n??{},checks:r,backLink:null,subNav:null,children:e===`issue`?(0,A.jsx)(U,{item:t},t.url):null})})}function V({run:e,kind:t,number:n,repoBase:r,item:o}){let c=i(),l=u({mutationFn:e=>a(t,n,{refresh:!0}),onSuccess:(e,t)=>c.setQueryData(t,e)}),d=P(t,o),f=s(d?[n]:[],d),p=f.data?.available?f.data.checks:void 0,m=`${j[t]} #${n}`,h=(0,A.jsx)(I,{retry:l,kind:t,number:n});if(o.isPending)return(0,A.jsx)(w,{kind:t,number:n,heading:`h2`});if(o.isError)return(0,A.jsx)(L,{kind:t,number:n,error:l.error??o.error,retryButton:h});let g=o.data;return g.available?g.item?(0,A.jsx)(B,{kind:t,item:g.item,labelColors:g.labelColors,checks:F(t,n,p,g.item.checks)}):(0,A.jsx)(z,{label:m,repoBase:r}):(0,A.jsx)(R,{run:e,kind:t,number:n,repoBase:r,reason:g.reason,retryError:l.error,retryButton:h})}function H(e){if(!e)return`this repository`;try{return new URL(e).pathname.split(`/`).filter(Boolean).slice(0,2).join(`/`)||`this repository`}catch{return`this repository`}}function U({item:e}){let t=k();return(0,A.jsx)(D,{item:e,workflows:t.workflows.data?.workflows??[],skills:t.skillList,workflow:t.workflow,onWorkflowChange:t.setWorkflow,selectedSkills:t.selectedSkills,onSkillsChange:t.setSelectedSkills,engine:t.engine,onEngineChange:t.setEngine,queuedRunId:t.queued.get(e.url)??null,onQueued:t.onQueued},e.url)}export{M as TaskGithubItemRoute};