@wjarka/cezarion 0.18.0-dev.6035 → 0.18.0-dev.6043
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/web/dist/assets/activity-motion-Dld5ms7x.js +2 -0
- package/web/dist/assets/{activity-route-DQI_8J09.js → activity-route-CNZPeNfz.js} +1 -1
- package/web/dist/assets/{agent-accounts-C6eyz75V.js → agent-accounts-B-Gpf8IN.js} +1 -1
- package/web/dist/assets/attention-VmnPpwJx.js +1 -0
- package/web/dist/assets/{commit-diff-panel-C7BUSPzE.js → commit-diff-panel-NClCG68F.js} +1 -1
- package/web/dist/assets/control-locations-B88tMDqg.js +1 -0
- package/web/dist/assets/diff-nIehE-T6.js +3 -0
- package/web/dist/assets/{diff-view-B9kgeZTm.js → diff-view-DcvEkA3I.js} +1 -1
- package/web/dist/assets/{file-preview-DrXgM1-S.js → file-preview-D5OEhi_p.js} +1 -1
- package/web/dist/assets/{git-toolbar-B1gOn_1U.js → git-toolbar-6nOTPb_C.js} +1 -1
- package/web/dist/assets/github-kqE3kY6l.js +1 -0
- package/web/dist/assets/github-sidebar-model-DkUAF09l.js +1 -0
- package/web/dist/assets/{global-activity-route-CZ_xwiz3.js → global-activity-route-BExanylS.js} +1 -1
- package/web/dist/assets/{index-75IttVLX.js → index-DBNT3CYH.js} +11 -11
- package/web/dist/assets/live-refetch-CZb2VOyu.js +1 -0
- package/web/dist/assets/popover-G6KGT-qq.js +1 -0
- package/web/dist/assets/{preview-pane-connected-Cx8q-Yrh.js → preview-pane-connected-BN0BWrKD.js} +1 -1
- package/web/dist/assets/queries-D2MPDhtr.js +1 -0
- package/web/dist/assets/repo-git-CPEbNCTy.js +1 -0
- package/web/dist/assets/{report-reader-CeBtx_Sf.js → report-reader-Ltc8JdIV.js} +1 -1
- package/web/dist/assets/{reports-CRPxIRMM.js → reports-DHuR8gwU.js} +1 -1
- package/web/dist/assets/run-header-BDtR-uVy.js +2 -0
- package/web/dist/assets/{skills-DDoJCcmD.js → skills-DTowIB5z.js} +1 -1
- package/web/dist/assets/task-changes-NqJ_-tod.js +1 -0
- package/web/dist/assets/task-commits-BbhrfhCT.js +1 -0
- package/web/dist/assets/{task-files-CkPJZE0w.js → task-files-n29-eIMD.js} +1 -1
- package/web/dist/assets/task-github-item-BwS8ltjs.js +1 -0
- package/web/dist/assets/task-thread-DkF28KyV.js +9 -0
- package/web/dist/assets/{thread-state-BtmIMbkZ.js → thread-state-C8XI1WNf.js} +1 -1
- package/web/dist/assets/use-hand-to-agent-state-CY43kvaa.js +1 -0
- package/web/dist/assets/workflows-CWFMDlCn.js +7 -0
- package/web/dist/index.html +10 -9
- package/web/dist/assets/activity-motion-Bqd8S9Xy.js +0 -2
- package/web/dist/assets/control-locations-DlrUP5vD.js +0 -1
- package/web/dist/assets/diff-Bwy0qFul.js +0 -3
- package/web/dist/assets/github-g-ZOTwHQ.js +0 -1
- package/web/dist/assets/github-sidebar-model-BdoLA7qT.js +0 -1
- package/web/dist/assets/live-refetch-pzhdhNS_.js +0 -1
- package/web/dist/assets/popover-N-u5z2xh.js +0 -1
- package/web/dist/assets/queries-BtScxiQP.js +0 -1
- package/web/dist/assets/repo-git-DgZuI4FP.js +0 -1
- package/web/dist/assets/run-header-C8Eeonkx.js +0 -2
- package/web/dist/assets/task-changes-XAcKfebn.js +0 -1
- package/web/dist/assets/task-commits-D5V0Q0au.js +0 -1
- package/web/dist/assets/task-github-item-CbCOKkvp.js +0 -1
- package/web/dist/assets/task-thread-DyR8HsDz.js +0 -9
- package/web/dist/assets/use-hand-to-agent-state-BUpbMYM9.js +0 -1
- package/web/dist/assets/workflows-CEFtJj_h.js +0 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,t as n,u as r}from"./button-CS5tOblf.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{Bt as o,C as s,Kr as c,Sr as l,nt as u,r as d,rt as f,tn as p}from"./project-scope-context-DSkcNKO7.js";import{$t as m,M as h,O as g,P as _,Pt as v,Rt as y,Tt as b,et as x,h as S,jt as C,n as w,rt as T}from"./queries-D2MPDhtr.js";import{t as E}from"./useQuery-8pHkglP4.js";import{Z as D,i as O,r as k,t as A}from"./popover-G6KGT-qq.js";import{n as j}from"./toaster-CRVRHlMR.js";import{A as M,Z as ee,_ as N,b as P,ct as F,d as I,ft as te,h as L,l as R,mt as ne,ot as re,r as ie,rt as ae,u as oe,ut as se}from"./design-icons-DmYTv2r1.js";import{t as ce}from"./eye-B8okNWXU.js";import{a as le,i as z}from"./format-BNCkW110.js";import{t as ue}from"./message-square-B-MD-8rD.js";import{t as de}from"./play-CmVAj_fu.js";import{a as fe,i as pe,o as me,r as he,s as ge,t as _e}from"./dialog-Dw7fMdDQ.js";import{u as B,v as ve,y as V}from"./github-sidebar-model-DkUAF09l.js";import{t as H}from"./project-router-BFKfAFvq.js";import{A as ye,B as be,E as xe,H as Se,I as Ce,L as we,M as Te,O as Ee,V as De,_ as Oe,a as ke,b as Ae,f as je,g as Me,i as Ne,j as Pe,k as U,m as Fe,n as Ie,p as Le,r as W,s as Re,t as ze,v as Be,w as Ve,z as He}from"./agent-accounts-B-Gpf8IN.js";import{d as Ue,f as We,i as Ge,s as Ke,t as qe,u as Je}from"./skills-DFBiAuJG.js";import{Ft as Ye,G as Xe,Pt as Ze,gn as Qe,gt as $e,vt as et}from"./index-DBNT3CYH.js";import{t as tt}from"./diff-nIehE-T6.js";import{t as nt}from"./tab-link-DDpdYMnv.js";var G=e(i(),1),K=a(),rt={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function q({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,K.jsx)(R,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:r(t,`text-success`)}):e===`failing`?(0,K.jsx)(N,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:r(t,`text-danger`)}):e===`pending`?(0,K.jsx)(le,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:r(t,`animate-spin text-warning`)}):(0,K.jsx)(L,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:r(t,`text-soft-foreground`)})}function it(e){return e?.available?e.mergeState:null}function at(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function ot(e){return e.state===`merged`?`Merged`:e.state===`closed`?`Closed`:e.isDraft?`Draft`:e.mergeable===`conflicting`?`Conflicts must be resolved`:e.canMerge?`Ready to merge`:e.eligibility===`unknown`?`Merge blocked · Requirements unknown`:`Merge blocked`}function st(e){return e===`approved`||e===`not-required`?`passing`:e===`unknown`?`unknown`:`failing`}function ct(e){return e===`mergeable`?`passing`:e===`conflicting`?`failing`:`unknown`}function lt(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function ut(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function dt(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function ft(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function J(e){return e?rt[e]:`Merge`}function pt(e){return e===`conflicting`?`true`:void 0}function mt({check:e}){return(0,K.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(q,{state:e.state}),(0,K.jsxs)(`span`,{children:[e.name,` · `,e.state,ut(e.required)]})]}),e.url&&t(e.url)?(0,K.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function ht({reason:e}){return(0,K.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,K.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:e})]})}function gt({state:e,selectedMethod:t,overrideRules:i,mergeEnabled:a,refreshPending:o,onRefresh:s,onRunAgent:c,onConfirm:l,onMethodChange:u,onOverrideChange:d}){let f=ot(e),p=st(e.reviewDecision),m=ct(e.mergeable);return(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,K.jsx)(R,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,K.jsx)(F,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsx)(`h3`,{className:`font-semibold`,children:f}),(0,K.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,disabled:o,onClick:s,children:[(0,K.jsx)(ee,{size:16,"aria-hidden":`true`,className:r(`size-3.5`,o&&`animate-spin`)}),`Refresh`]})]}),(0,K.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[e.headRef,` (`,e.headSha.slice(0,7),`) → `,e.baseRef]}),(0,K.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,K.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(q,{state:p}),(0,K.jsxs)(`span`,{children:[`Reviews: `,e.reviewDecision.replaceAll(`-`,` `)]})]}),(0,K.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(q,{state:m}),(0,K.jsxs)(`span`,{children:[`Conflicts: `,lt(e.mergeable)]})]}),e.checks.length===0?(0,K.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,K.jsx)(mt,{check:e},e.name)),e.blockers.map(e=>(0,K.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&c?(0,K.jsx)(n,{className:`mt-4`,onClick:c,children:`Run agent on this PR`}):null,e.canOverride?(0,K.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-warning/40 bg-warning/5 p-3 text-xs`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>d(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,K.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,e.eligibility===`unknown`?(0,K.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`GitHub could not confirm review and branch-protection requirements. Passing checks do not establish merge readiness.`}):null,e.state===`open`&&e.methods.length>0?(0,K.jsxs)(`div`,{className:`mt-4 flex flex-col flex-wrap gap-2 sm:flex-row`,children:[(0,K.jsx)(`select`,{"aria-label":`Merge method`,value:t??``,onChange:e=>u(e.target.value),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm`,children:e.methods.map(e=>(0,K.jsx)(`option`,{value:e,children:rt[e]},e))}),(0,K.jsx)(n,{disabled:!a,onClick:l,children:J(t)})]}):null]})]})}function _t({number:e,state:t,selectedMethod:r,confirming:i,overrideRules:a,mergePending:o,mergeError:s,onOpenChange:c,onMerge:l}){return(0,K.jsx)(_e,{open:i,onOpenChange:c,children:(0,K.jsxs)(he,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,K.jsxs)(me,{children:[(0,K.jsxs)(ge,{children:[J(r),` pull request #`,e,`?`]}),(0,K.jsx)(pe,{asChild:!0,children:(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`p`,{children:[`This will merge “`,t.title,`” into `,t.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),a&&t.canOverride?(0,K.jsx)(`p`,{"data-slot":`gh-bypass-warning`,className:`mt-4 text-sm text-warning`,children:`You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`}):null]})})]}),s?(0,K.jsx)(`p`,{className:`text-sm text-danger`,children:s.message}):null,(0,K.jsxs)(fe,{children:[(0,K.jsx)(n,{variant:`outline`,disabled:o,onClick:()=>c(!1),children:`Cancel`}),(0,K.jsx)(n,{disabled:o,onClick:l,children:o?`Merging…`:J(r)})]})]})})}function vt({number:e,onRunAgent:t}){let n=c(),r=T(),i=E({queryKey:w.githubMergeState(e),queryFn:({signal:t})=>f(e,{},{signal:t}),retry:!1}),a=it(i.data),[s,l]=(0,G.useState)(null),[u,d]=(0,G.useState)(!1),[p,h]=(0,G.useState)(!1),g=m({mutationFn:t=>f(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>j(e instanceof Error?e.message:String(e),{tone:`danger`})}),_=at(s,a),v=()=>({mergeState:w.githubMergeState(e),list:w.githubPages(50),comments:w.githubComments(`pr`,e),item:w.githubItem(`pr`,e),refStatus:r===void 0?void 0:w.githubRefStatusOf(r)}),y=m({mutationFn:t=>{if(!a||!_)throw Error(`No merge method is available.`);return o(e,{method:_,expectedHeadSha:a.headSha,...p&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{d(!1),j(`Pull request #${e} merged`),n.invalidateQueries({queryKey:r.mergeState}),n.invalidateQueries({queryKey:r.list}),n.invalidateQueries({queryKey:r.comments}),n.invalidateQueries({queryKey:r.item}),r.refStatus&&n.invalidateQueries({queryKey:r.refStatus})},onError:(e,t)=>{j(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,K.jsx)(V,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,K.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":pt(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,K.jsx)(gt,{state:a,selectedMethod:_,overrideRules:p,mergeEnabled:ft(_,a,p),refreshPending:g.isPending,onRefresh:()=>g.mutate(w.githubMergeState(e)),onRunAgent:t,onConfirm:()=>d(!0),onMethodChange:l,onOverrideChange:h}),(0,K.jsx)(_t,{number:e,state:a,selectedMethod:_,confirming:u,overrideRules:p,mergePending:y.isPending,mergeError:y.error,onOpenChange:d,onMerge:()=>y.mutate(v())})]}):(0,K.jsx)(ht,{reason:dt(i.data)})}function yt(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function bt(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))||t.assignees?.length&&!e.assignees?.some(e=>t.assignees.some(t=>t.toLowerCase()===e.toLowerCase()))||t.author!==void 0&&e.author.toLowerCase()!==t.author.toLowerCase()||t.includeNumbers&&!t.includeNumbers.has(e.number)||t.excludeNumbers?.has(e.number)||t.projectId&&e.projectIds!==void 0&&!e.projectIds.includes(t.projectId)?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body??``}`.toLowerCase().includes(n))}function xt(e,t){let n=e.trim();if(n===``)return!1;let r=n.replace(/^#/,``);return/^\d+$/.test(r)?!t.some(e=>e.number===Number(r)):t.length===0}function Y(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}function St({label:e,color:t,plain:n=!1}){return(0,K.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:Y(t),className:n?`text-[11px] font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[12px] font-medium`,children:e})}function Ct(e){return e===`pr`?`pull request`:`issue`}function wt(e,t,n){return e===`pr`&&!!(t||n)}function Tt({backLink:e}){return e?(0,K.jsxs)(H,{to:e.to,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,K.jsx)(ie,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}):null}function Et({item:e,kindWord:n,commentCount:r,hasDiffStat:i,additions:a,deletions:o}){return(0,K.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,K.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,K.jsx)(`span`,{children:n}),`·`,(0,K.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,K.jsxs)(`span`,{children:[z(e.createdAt),` ago`]}),r?(0,K.jsxs)(K.Fragment,{children:[`·`,(0,K.jsx)(qt,{count:r})]}):null,i?(0,K.jsxs)(K.Fragment,{children:[`·`,(0,K.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,K.jsxs)(`span`,{className:`text-success`,children:[`+`,a??0]}),` `,(0,K.jsxs)(`span`,{className:`text-danger`,children:[`−`,o??0]})]})]}):null,`·`,t(e.url)?(0,K.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,K.jsx)(D,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,K.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]})}function Dt({item:e,subNav:t,changes:n}){return e.kind===`pr`?t?(0,K.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,K.jsx)(nt,{to:B(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,K.jsx)(nt,{to:B(`prs`,t.filter,e.number,`/changes`),active:n,children:`Changes`})]}):(0,K.jsx)(H,{to:B(`prs`,null,e.number,`/changes`),"data-slot":`gh-files-changed`,className:`mt-3 inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground hover:underline`,children:`Files changed`}):null}function Ot({item:e,colors:t,checks:n}){return e.labels.length>0||n?(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,K.jsx)(St,{label:e,color:t[e]},e)),n?(0,K.jsx)(Jt,{checks:n,url:e.url}):null]}):null}function kt({item:e,colors:t,body:n}){return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:n?(0,K.jsx)(et,{children:n}):(0,K.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,K.jsx)(Mt,{item:e,colors:t})]})}function At({item:e,colors:t,checks:n,comments:r,backLink:i,subNav:a,onRunAgent:o,afterHeading:s,children:c}){let l=a?.changes??!1,u=Ct(e.kind),d=g(e.kind,e.number,!l).data?.detail,f=d?.body??e.body,p=d?.additions??e.additions,m=d?.deletions??e.deletions,h=wt(e.kind,p,m),_=r??e.comments;return(0,K.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,K.jsx)(Tt,{backLink:i}),(0,K.jsxs)(`div`,{"data-slot":`gh-description-card`,className:e.kind===`pr`?`rounded-xl border border-border bg-card p-6`:void 0,children:[e.kind===`pr`?(0,K.jsxs)(`h2`,{className:`mb-4 text-[22px] leading-snug font-normal`,children:[`#`,e.number,` `,e.title]}):null,(0,K.jsx)(Et,{item:e,kindWord:u,commentCount:_,hasDiffStat:h,additions:p,deletions:m}),e.kind===`pr`?null:(0,K.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-normal`,children:e.title}),s,(0,K.jsx)(Dt,{item:e,subNav:a,changes:l}),(0,K.jsx)(Ot,{item:e,colors:t,checks:n}),l&&e.kind===`pr`?(0,K.jsx)(jt,{item:e}):(0,K.jsx)(kt,{item:e,colors:t,body:f})]}),e.kind===`pr`?(0,K.jsx)(vt,{number:e.number,onRunAgent:o}):null,c]})}function jt({item:e}){let i=c(),a=h(e.number),[o,s]=(0,G.useState)(``),[l,d]=(0,G.useState)(null),f=a.data,p=f?.available?f.files.filter(e=>e.path.toLowerCase().includes(o.toLowerCase())):[],m=p.findIndex(e=>e.path===l);(0,G.useEffect)(()=>{p.length>0&&!p.some(e=>e.path===l)&&d(p[0].path)},[f?.available?f.headSha:``,o]);let g=async()=>{let t=f?.available?f.headSha:null,n=w.githubPrChanges(e.number),r=await u(e.number,{refresh:!0});i.setQueryData(n,r),r.available&&t&&t!==r.headSha&&(d(r.files[0]?.path??null),j(`The reviewed revision changed.`))};if(a.isPending)return(0,K.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(a.isError||!f)return(0,K.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!f.available)return(0,K.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:f.reason});let _=p.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),v=t(e.url)?`${e.url}/files`:null,y=p.find(e=>e.path===l);return(0,K.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,K.jsxs)(`strong`,{children:[f.files.length,` changed files`]}),(0,K.jsxs)(`span`,{className:`text-success`,children:[`+`,f.additions]}),(0,K.jsxs)(`span`,{className:`text-danger`,children:[`−`,f.deletions]}),(0,K.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:f.headSha,children:[`head `,f.headSha.slice(0,8)]}),(0,K.jsx)(n,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void g(),children:`Refresh`})]}),f.truncated?(0,K.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[f.reason??`This response is incomplete.`,` `,v?(0,K.jsx)(`a`,{href:v,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,K.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,K.jsxs)(`aside`,{className:`min-w-0`,children:[(0,K.jsx)(`input`,{"aria-label":`Filter changed files`,value:o,onChange:e=>s(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,K.jsx)(`select`,{"aria-label":`Select changed file`,value:l??``,onChange:e=>d(e.target.value),className:`mt-2 min-h-11 w-full rounded-md border border-input bg-background px-2 text-sm lg:hidden`,children:p.map(e=>(0,K.jsx)(`option`,{children:e.path},e.path))}),(0,K.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:p.map(e=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,onClick:()=>d(e.path),className:r(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,l===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,K.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,K.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,K.jsx)(n,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:m<=0,onClick:()=>d(p[m-1]?.path??null),children:(0,K.jsx)(Qe,{})}),(0,K.jsx)(n,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:m<0||m>=p.length-1,onClick:()=>d(p[m+1]?.path??null),children:(0,K.jsx)(I,{size:16})})]}),p.length===0?(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(tt,{files:_.filter(e=>e.path===l),wrap:!0,className:`min-w-0`}),y&&!y.patch?(0,K.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,y.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Mt({item:e,colors:t}){let n=g(e.kind,e.number),r=n.data,i=(0,G.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(Nt(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,K.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,K.jsx)(V,{className:`mb-3 h-3 w-24`}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsx)(V,{className:`h-14 w-full`}),(0,K.jsx)(V,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,K.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,K.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,K.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,K.jsx)(D,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,K.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,K.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-soft-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,K.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Pt(i).map(e=>e.group===`commits`?(0,K.jsx)(Ft,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,K.jsx)(Gt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,K.jsx)(It,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,K.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-soft-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,K.jsx)(D,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var Nt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Pt(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function Ft({commits:e,colors:t}){let[n,r]=(0,G.useState)(!1),i=e[0]?.actor??`?`;return n?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,children:X.committed}),(0,K.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,K.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,K.jsx)(It,{event:e,colors:t},e.id))]}):(0,K.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,children:X.committed}),(0,K.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,K.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,K.jsx)(`span`,{className:`shrink-0`,children:z(e[e.length-1].createdAt)})]})})}var X={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function It({event:e,colors:t}){return(0,K.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:r(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:X[e.kind]}),(0,K.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,K.jsx)(Ht,{event:e,colors:t}),(0,K.jsx)(`span`,{className:`shrink-0`,children:z(e.createdAt)}),e.url?(0,K.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,K.jsx)(D,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Lt({event:e}){return(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,K.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,K.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,K.jsx)(Ut,{checks:e.checks})]})}function Rt({event:e,colors:t}){return(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,K.jsx)(`span`,{"data-slot":`gh-event-label`,style:Y(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[12px]`,children:e.label.name}):null,(0,K.jsx)(`span`,{className:`shrink-0`,children:`label`})]})}function zt({event:e}){return(0,K.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Bt({event:e}){return(0,K.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var Vt={committed:e=>(0,K.jsx)(Lt,{event:e}),labeled:(e,t)=>(0,K.jsx)(Rt,{event:e,colors:t}),unlabeled:(e,t)=>(0,K.jsx)(Rt,{event:e,colors:t}),assigned:e=>(0,K.jsx)(zt,{event:e}),unassigned:e=>(0,K.jsx)(zt,{event:e}),merged:()=>(0,K.jsx)(`span`,{children:`merged this`}),closed:()=>(0,K.jsx)(`span`,{children:`closed this`}),reopened:()=>(0,K.jsx)(`span`,{children:`reopened this`}),head_ref_force_pushed:()=>(0,K.jsx)(`span`,{children:`force-pushed`}),renamed:e=>(0,K.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]}),"cross-referenced":e=>(0,K.jsx)(Bt,{event:e})};function Ht({event:e,colors:t}){return Vt[e.kind]?.(e,t)??null}function Ut({checks:e}){return e?(0,K.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:r(`shrink-0`,Q[e]),children:Z[e]}):null}var Wt={approved:{label:`approved`,tone:`border-success/40 text-success`},changes_requested:{label:`changes requested`,tone:`border-danger/40 text-danger`},commented:{label:`commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`dismissed`,tone:`border-border text-muted-foreground`}};function Gt({comment:e}){let t=e.reviewState?Wt[e.reviewState]:null;return(0,K.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,K.jsx)(Kt,{url:e.avatarUrl,login:e.author}),(0,K.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,K.jsx)(`span`,{children:z(e.createdAt)}),t?(0,K.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:r(`rounded-full border px-1.5 py-px font-sans text-[12px] font-medium`,t.tone),children:t.label}):null,(0,K.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,K.jsx)(D,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,K.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,K.jsx)(et,{children:e.body}):(0,K.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function Kt({url:e,login:t}){let[n,r]=(0,G.useState)(!1);return e&&!n?(0,K.jsx)(`img`,{src:e,alt:``,width:16,height:16,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-4 shrink-0 rounded-full`}):(0,K.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var Z={passing:`✓`,failing:`✗`,pending:`○`},Q={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function qt({count:e}){return e?(0,K.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,K.jsx)(ue,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Jt({checks:e,url:t}){let n=r(`text-[11px] font-medium`,Q[e],t&&`hover:underline`),i=`${Z[e]} checks ${e}`;return t?(0,K.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:i}):(0,K.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:i})}function Yt({checks:e}){return(0,K.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:r(`shrink-0 font-sans text-[11px] font-semibold`,Q[e]),children:Z[e]})}function $(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function Xt(e,t=[]){let n=$(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=Zt(t)),n}function Zt(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function Qt(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function $t(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function en(e,t,n){let r=(n??``).trim();if(!r)return Xt(e,t);let i=$(e),a=r.startsWith(i)?i+Qt(r.slice(i.length),e):Qt(r,e),o=$t(a,e)?a:`${i}\n\n${a}`;return t.length?o+Zt(t):o}function tn(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function nn(e,t,n,r,i={}){return t?{...i,workflow:t,task:en(e,n,r)}:n.length?{...i,steps:tn(n),task:en(e,[],r)}:{...i,workflow:`quick-task`,task:en(e,[],r)}}function rn(e){let t=x(),n=S(),r=l(t.data),i=n.data?.defaultRunner,a=Be(e.runner,r,i??r[0]??`claude`),o=b(a),s=n.data?.modelsLocked===!0,{accounts:c,repoAccount:u}=Ie(),d=c.some(t=>t.provider===a&&t.id===e.account)?e.account:null,f=Oe(s?null:e.model,a,n.data?.defaultModels,o.data),p=je(a,f,o.data);return{runner:a,runnerExplicit:e.runner!==null,model:f,effort:s?``:Me(e.effort,p),effortOptions:p,runners:r,defaultRunner:i,canRun:t.isSuccess&&r.length>0,modelsLocked:s,providerPending:t.isPending,providerError:t.isError,accounts:c,account:d,repoAccount:u}}function an(e){return{runner:Ae(e.runner,e.defaultRunner,e.runnerExplicit),model:e.modelsLocked?void 0:e.model||void 0,effort:e.modelsLocked?void 0:e.effort||void 0}}function on(e){return{...an(e),...e.account?{agentProfile:e.account}:{}}}function sn({pick:e,onChange:t,disabled:n=!1,accounts:r=!1,layout:i}){let a=(0,G.useRef)(null),o=(0,G.useRef)(null),[s,c]=(0,G.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,G.useLayoutEffect)(()=>{let e=a.current;if(i!==`row`||!e)return;let t=()=>{let t=window.innerWidth<=767||e.getBoundingClientRect().width<550,n=document.activeElement;o.current=n instanceof HTMLElement&&e.contains(n)?n:null,c(t)};t();let n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[i]),(0,G.useLayoutEffect)(()=>{let e=o.current;o.current=null,e&&e.isConnected&&document.activeElement!==e&&e.focus()},[s]);let l=rn(e),{runner:u,model:d,effort:f,effortOptions:p,runners:m,canRun:h,modelsLocked:g}=l,_=S(),v=b(u),y=Fe(u,v.data,[e.model,_.data?.defaultModels?.[u]]),x=n||!h,C=r?l.accounts:[],w=m.length>1||m.some(e=>ze(C,e))?(0,K.jsx)(ke,{icon:(0,K.jsx)(re,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:m,value:u,accounts:C,account:r?l.account:null,repoAccount:r?l.repoAccount:void 0,disabled:x,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===u?e.model:null,effort:e.effort}:{runner:n,account:null,model:null,effort:e.effort})},`runner`):null,T=(0,K.jsx)(W,{icon:(0,K.jsx)(P,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:d===``?`Default`:y.find(e=>e.id===d).label,value:d,disabled:x,readOnly:g===!0,disabledHint:g?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=je(u,n,v.data);t({...e,model:n,effort:e.effort===null?null:Me(e.effort,r)})},options:y.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Le(u,v.data,v.isError,v.isFetching)},`model`),E=(0,K.jsx)(W,{icon:(0,K.jsx)(M,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:p.find(e=>e.value===f)?.label??`auto`,value:f,disabled:x,readOnly:g===!0,disabledHint:g?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,effort:n}),options:p.map(e=>({value:e.value,label:e.label,desc:e.desc}))},`effort`);return i===`row`?(0,K.jsx)(`div`,{ref:a,"data-slot":`engine-row-box`,children:(0,K.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,K.jsx)(Ne,{children:s?[w,E,T]:[w,T,E]})})}):(0,K.jsxs)(Ne,{children:[w,T,E]})}var cn={workflow:null,skills:[]},ln=`cez-followup-selection`;function un(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.filter(e=>typeof e==`string`):[]}}function dn(){try{let e=localStorage.getItem(ln);return e?un(JSON.parse(e)):{...cn}}catch{return{...cn}}}function fn(e){try{localStorage.setItem(ln,JSON.stringify(e))}catch{}}var pn=`cez-followup-prompt:`;function mn(e){try{return localStorage.getItem(pn+e)??``}catch{return``}}function hn(e,t){try{t===``?localStorage.removeItem(pn+e):localStorage.setItem(pn+e,t)}catch{}}function gn({item:e,workflows:r,skills:i,workflow:a,onWorkflowChange:o,selectedSkills:l,onSkillsChange:u,engine:d,onEngineChange:f,queuedRunId:h,onQueued:g}){let y=c(),b=v(),x=_().data?.capabilities.automations===!0,S=e.kind===`pr`?`PR`:`issue`,C=l.filter(e=>i.some(t=>t.name===e)),[T]=(0,G.useState)(()=>$(e)),[E,D]=(0,G.useState)(()=>mn(e.url)||T),O=rn(d),k=(0,G.useRef)(null),A=(0,G.useRef)(null);(0,G.useEffect)(()=>{hn(e.url,E===T?``:E)},[e.url,E,T]);let M=(0,G.useMemo)(()=>Se(He(b.data?.promptTemplates),{automations:x}),[b.data?.promptTemplates,x]),ee=e=>{let t=k.current,n=De({prompt:E,base:T,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:A.current}),r=we(E,n,e);D(r.text),A.current=r.caret,requestAnimationFrame(()=>{k.current?.focus(),k.current?.setSelectionRange(r.caret,r.caret)})},N=Ce(M,C),P=(0,G.useRef)(E);P.current=E;let F=(0,G.useRef)(``);(0,G.useEffect)(()=>{let e=be(P.current,F.current,N,T);F.current=e.applied,e.text!==P.current&&D(e.text)},[N,T]);let I=m({mutationFn:async()=>O.canRun?s(nn(e,a,C,E,on(O))):null,onSuccess:t=>{if(t===null)return;let n=t;n&&g(e.url,n.id),j(`Added to the queue — ${S} #${e.number}`),C.length>0&&b.data!==void 0&&p({skillUsage:C.reduce((e,t)=>qe(e,t),b.data.skillUsage)}).then(()=>y.invalidateQueries({queryKey:w.uiState})).catch(()=>{}),hn(e.url,``),D(T),F.current=``,y.invalidateQueries({queryKey:w.runs.all})},onError:e=>j(e.message,{tone:`danger`})}),te=e=>{Ze({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(),!I.isPending&&O.canRun&&I.mutate())},L=e=>u(l.includes(e)?l.filter(t=>t!==e):[...l,e]);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,K.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,K.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,K.jsx)(`span`,{children:`Instructions for the agent`}),(0,K.jsx)(Xe,{ref:k,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:E,onChange:e=>D(e.target.value),onSelect:e=>{A.current=e.currentTarget.selectionStart},onKeyDown:te,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,K.jsx)(ve,{templates:M,onInsert:ee}),(0,K.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,K.jsxs)(`div`,{className:`gh-field`,children:[(0,K.jsx)(`span`,{children:`Workflow`}),(0,K.jsx)(_n,{workflows:r,value:a,onChange:o})]}),(0,K.jsxs)(`div`,{className:`gh-field`,children:[(0,K.jsx)(`span`,{children:`Skills · select one or more`}),(0,K.jsx)(yn,{skills:i,skillUsage:b.data?.skillUsage,selected:C,onToggle:L})]}),C.length>0?(0,K.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:C.map(e=>(0,K.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>L(e),title:`Remove this skill`,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,K.jsx)(ne,{size:16,"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,K.jsx)(sn,{layout:`row`,pick:d,onChange:f,disabled:I.isPending||!O.canRun,accounts:!0}),(0,K.jsxs)(`div`,{className:`gh-field`,children:[(0,K.jsx)(`span`,{children:`Account`}),(0,K.jsx)(vn,{resolved:O,disabled:I.isPending||!O.canRun,onPick:e=>f({...d,account:e})})]}),!O.providerPending&&!O.canRun?(0,K.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[O.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,K.jsx)(H,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,K.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:[e.kind===`pr`?`PR`:`Issue`,` number and link remain attached to the task. Edit the prompt before starting. Cmd/Ctrl+Enter submits; Enter adds a new line.`]})]}),(0,K.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[t(e.url)?(0,K.jsx)(n,{asChild:!0,variant:`outline`,children:(0,K.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,K.jsxs)(n,{variant:`primary`,"data-action":`gh-run`,disabled:I.isPending||!O.canRun,onClick:()=>I.mutate(),children:[(0,K.jsx)(de,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,S]}),(0,K.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[11px] font-medium text-muted-foreground`,children:Ye()}),h?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,K.jsx)(R,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,K.jsx)(H,{to:`/tasks/${h}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function _n({workflows:e,value:t,onChange:n}){let[i,a]=(0,G.useState)(!1),[o,s]=(0,G.useState)(``),c=(0,G.useRef)(null),l=Ue(e,o);return(0,K.jsxs)(A,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,K.jsx)(O,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:r(Re,t&&`border-foreground/60 font-mono text-[11px] font-semibold text-foreground`),children:[(0,K.jsx)(te,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,K.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,K.jsx)(oe,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,K.jsx)(k,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,K.jsxs)(xe,{shouldFilter:!1,children:[(0,K.jsx)(ye,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,K.jsxs)(Te,{ref:c,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,K.jsx)(Ee,{children:`Nothing matches.`}):null,(0,K.jsx)(U,{children:l.map(e=>{let r=t===e.name;return(0,K.jsxs)(Pe,{value:`workflow ${e.name}`,keywords:We(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,K.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,K.jsx)(R,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function vn({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:Ve,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,desc:e.configDir}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,K.jsx)(W,{icon:(0,K.jsx)(se,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),slot:`account-pill`,ariaLabel:`Account`,label:i.find(e=>e.value===a)?.label??`Default`,value:a,options:i,disabled:t,onPick:n})}function yn({skills:e,skillUsage:t,selected:n,onToggle:i}){let[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(null),d=(0,G.useRef)(null),{mostUsed:f,project:p,global:m,ranked:h}=Je(e,s,t),g=(e,t)=>{let a=n.includes(e.name);return(0,K.jsxs)(Pe,{value:`skill ${e.name} ${e.path}`,keywords:We(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.name,"data-selected":a?`true`:void 0,onSelect:()=>i(e.name),children:[(0,K.jsx)(`span`,{className:r(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,K.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,K.jsx)(ce,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,K.jsx)(R,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.path)};return e.length===0?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)($e,{skill:l,onClose:()=>u(null)}),(0,K.jsxs)(A,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,K.jsx)(O,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:r(Re,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,K.jsx)(ae,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,K.jsx)(oe,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,K.jsx)(k,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,K.jsxs)(xe,{shouldFilter:!1,children:[(0,K.jsx)(ye,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,K.jsxs)(Te,{ref:d,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(h?h.length===0:f.length===0&&p.length===0&&m.length===0)?(0,K.jsx)(Ee,{children:`Nothing matches.`}):null,h?h.length>0?(0,K.jsx)(U,{children:h.map(e=>g(e,Ge(e)))}):null:(0,K.jsxs)(K.Fragment,{children:[f.length>0?(0,K.jsx)(U,{heading:`Most used`,children:f.map(e=>g(e,Ge(e)))}):null,p.length>0?(0,K.jsx)(U,{heading:`Project skills`,children:p.map(e=>g(e,!0))}):null,m.length>0?(0,K.jsx)(U,{heading:`Global`,children:m.map(e=>g(e,!1))}):null]})]})]})})]})]})}var bn=new WeakMap;function xn(){let e=dn(),t={workflow:e.workflow,selectedSkills:e.skills,engine:{runner:null,model:null,effort:null,account:null},queued:new Map},n=new Set;return{snapshot:()=>t,subscribe:e=>(n.add(e),()=>{n.delete(e)}),update:e=>{t={...t,...e},(e.workflow!==void 0||e.selectedSkills!==void 0)&&fn({workflow:t.workflow,skills:[...t.selectedSkills]}),n.forEach(e=>e())}}}function Sn(){let e=c(),{projectId:t}=d(),n=bn.get(e);n||bn.set(e,n=new Map);let r=n.get(t);r||n.set(t,r=xn());let{snapshot:i,subscribe:a,update:o}=r,s=(0,G.useSyncExternalStore)(a,i,i),l=y(),u=C(),f=v(),p=l.data?.workflows;(0,G.useEffect)(()=>{p&&s.workflow!==null&&!p.some(e=>e.name===s.workflow)&&o({workflow:null})},[o,p,s.workflow]);let m=(0,G.useMemo)(()=>Ke(u.data??[],f.data?.skillUsage),[u.data,f.data?.skillUsage]);return{...s,workflows:l,skillList:m,setWorkflow:e=>o({workflow:e}),setSelectedSkills:e=>o({selectedSkills:e}),setEngine:e=>o({engine:e}),onQueued:(e,t)=>o({queued:new Map(i().queued).set(e,t)})}}export{qt as a,Pt as c,Y as d,xt as f,Yt as i,yt as l,gn as n,At as o,Xt as r,St as s,Sn as t,bt as u};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{E as t,t as n,u as r}from"./button-CS5tOblf.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{A as o,Kr as s,T as c,Xt as l,i as u,qt as d}from"./project-scope-context-DSkcNKO7.js";import{$t as f,Pt as ee,Rt as te,jt as ne,n as re}from"./queries-D2MPDhtr.js";import{n as p}from"./toaster-CRVRHlMR.js";import{C as m,Q as h,S as ie,X as g,a as ae,ct as oe,dt as _,l as se,lt as v,mt as ce,n as y,rt as le,st as b,u as ue,x,y as S}from"./design-icons-DmYTv2r1.js";import{i as C,p as de,r as w,t as T}from"./dropdown-menu-D7f0O7xR.js";import{a as E,c as D,i as O,n as k,o as A,r as j,s as M,t as N}from"./alert-dialog-h-3h9B4l.js";import{i as P,o as fe,r as F,s as I,t as L}from"./dialog-Dw7fMdDQ.js";import{t as R}from"./input-DIwJvCgi.js";import{t as pe}from"./centered-state-BmsqxbI8.js";import{i as z,l as me,s as he}from"./skills-DFBiAuJG.js";import{_ as ge,a as B,d as _e,g as ve,h as ye,i as V,l as be,m as H,o as xe,p as Se,r as Ce,s as we,t as U,v as W}from"./sortable.esm-zp_qkYGV.js";import{G,lt as Te}from"./index-DBNT3CYH.js";import{n as Ee}from"./skill-empty-hint-YDmkqgo-.js";var K=e(i(),1);function q(e){let t=[];for(let n of e){if(n.command||!n.skill||n.prompt!==void 0&&n.prompt!==`{{task}}`||n.name!==void 0&&n.name!==n.skill||n.timeoutMs!==void 0||n.model||n.effort!==void 0||n.runner||n.agentProfile||n.allowedTools||n.bashAllowlist||n.onFail)return null;t.push(n.skill)}return t.length?t:null}function De(e,t){let n=new Set(t.map(e=>e.id)),r=e;for(let t=2;n.has(r);t++)r=`${e}-${t}`;return{id:r,name:e,skill:e,prompt:`{{task}}`}}function Oe(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function ke(e,t,n){if(t===n||t<0||t>=e.length||n<0||n>=e.length)return[...e];let r=[...e],[i]=r.splice(t,1);return i===void 0?[...e]:(r.splice(n,0,i),r)}function Ae(e,t){return e.filter((e,n)=>n!==t)}function J(e){let t=String(e),n=/^[A-Za-z0-9._][A-Za-z0-9 ._/-]*$/.test(t)&&!t.endsWith(` `),r=/^(true|false|yes|no|on|off|null|~)$/i.test(t)||/^[-+.]?\d/.test(t);return n&&!r?t:JSON.stringify(t)}function Y(e,t,n){let r=` `.repeat(n);return t.includes(`
|
|
2
|
+
`)?[`${r}${e}: |`,...t.split(`
|
|
3
|
+
`).map(e=>`${r} ${e}`)]:[`${r}${e}: ${J(t)}`]}function X(e){let t=[];return e.name&&e.name!==e.id&&t.push(` name: ${J(e.name)}`),e.skill&&t.push(` skill: ${J(e.skill)}`),t}function Z(e){let t=[];return e.model&&t.push(` model: ${J(e.model)}`),e.timeoutMs!==void 0&&t.push(` timeoutMs: ${e.timeoutMs}`),e.effort!==void 0&&t.push(` effort: ${J(e.effort)}`),e.runner&&t.push(` runner: ${J(e.runner)}`),e.agentProfile&&t.push(` agentProfile: ${J(e.agentProfile)}`),t}function je(e){let t=[];return e.allowedTools&&t.push(` allowedTools: [${e.allowedTools.map(J).join(`, `)}]`),e.bashAllowlist&&t.push(` bashAllowlist: [${e.bashAllowlist.map(J).join(`, `)}]`),t}function Me(e){return e.onFail?[` onFail:`,` retry: ${J(e.onFail.retry)}`,` max: ${e.onFail.max??2}`]:[]}function Ne(e){return[` - id: ${J(e.id)}`,...X(e),...e.prompt?Y(`prompt`,e.prompt,4):[],...Z(e),...je(e),...e.command?Y(`command`,e.command,4):[],...Me(e)]}function Pe(e,t,n){let r=[`name: ${J(e.trim()||`my-workflow`)}`];t.trim()&&r.push(...Y(`description`,t.trim(),0));let i=q(n);if(i){r.push(`skills:`);for(let e of i)r.push(` - ${J(e)}`)}else if(n.length){r.push(`steps:`);for(let e of n)r.push(...Ne(e))}else r.push(`skills: []`);return`${r.join(`
|
|
4
|
+
`)}\n`}function Fe(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`workflow`}function Ie(e){let t=q(e)?`skill`:`step`;return`${e.length} ${t}${e.length===1?``:`s`}`}function Le(e,t){let n=new Set,r=[];for(let t of e.steps.slice(0,8)){let e=t.id||`step`,i=e;for(let t=2;n.has(i);t++)i=`${e}-${t}`;n.add(i),r.push({...t,id:i})}return{name:e.name?.trim()||t,steps:r}}function Re(e,t,n){let r=q(n);return{name:e.trim(),...t.trim()?{description:t.trim()}:{},...r?{skills:r}:{steps:[...n]}}}var Q=a();function ze({workflows:e,draft:t,trimmedName:n,nameRef:r,onDraft:i,onLoadWorkflow:a}){return(0,Q.jsxs)(`section`,{"data-slot":`wb-metadata`,className:`flex min-w-0 flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{"data-slot":`wb-load`,className:`flex flex-col items-start gap-2`,children:[(0,Q.jsx)(`label`,{htmlFor:`workflow-load`,className:`text-xs text-muted-foreground`,children:`Load an existing workflow`}),(0,Q.jsxs)(`div`,{className:`relative max-w-full`,children:[(0,Q.jsx)(ue,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsxs)(`select`,{id:`workflow-load`,value:e.some(e=>e.name===n)?n:``,onChange:t=>{let n=e.find(e=>e.name===t.target.value);n&&a(n)},className:`h-11 max-w-full rounded-lg border border-border bg-card pl-9 pr-3 text-xs font-medium appearance-none focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(`option`,{value:``,disabled:!0,children:`Choose a workflow`}),e.map(e=>(0,Q.jsx)(`option`,{value:e.name,"data-slot":`wb-load-option`,"data-name":e.name,children:e.name},e.name))]})]})]}),(0,Q.jsx)(`label`,{htmlFor:`workflow-name`,className:`text-xs font-semibold`,children:`Workflow name`}),(0,Q.jsx)(R,{id:`workflow-name`,ref:r,"data-slot":`wb-name`,"aria-label":`Workflow name`,spellCheck:!1,value:t.name,onChange:e=>i({...t,name:e.target.value}),className:`h-12 bg-card text-sm`}),(0,Q.jsx)(`label`,{htmlFor:`workflow-description`,className:`text-xs font-semibold`,children:`Description`}),(0,Q.jsx)(G,{id:`workflow-description`,"data-slot":`wb-description`,"aria-label":`Description`,value:t.description,onChange:e=>i({...t,description:e.target.value}),className:`min-h-[72px] bg-card p-3.5 text-sm`})]})}function Be({savedFile:e,autoOpen:t,onImportToggle:r,onExport:i,onAutoToggle:a,onDeleteRequest:o}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-actions`,className:`grid grid-cols-[max-content_max-content] items-center justify-start gap-2 sm:flex sm:flex-wrap [&_button]:min-h-11 [&_button]:border [&_button]:border-border [&_button]:bg-card`,children:[(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import`,className:`col-span-2 justify-self-start`,onClick:r,children:[(0,Q.jsx)(v,{"aria-hidden":`true`,className:`size-3`}),`Import`]}),(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-export`,className:`col-span-2 justify-self-start`,title:`Download workflow.yaml`,onClick:i,children:[(0,Q.jsx)(x,{"aria-hidden":`true`,className:`size-3`}),`Export`]}),(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto`,"aria-expanded":t,title:`Describe a chain — the agent builds it`,onClick:a,children:[(0,Q.jsx)(_,{"aria-hidden":`true`,className:`size-3`}),`Auto`]}),e?(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-delete`,className:`text-danger hover:text-danger`,title:`Delete the saved workflow file`,onClick:o,children:[(0,Q.jsx)(b,{"aria-hidden":`true`,className:`size-3`}),`Delete`]}):null]})}function Ve({text:e,onTextChange:t,pending:r,onRun:i,onCancel:a}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-auto-panel`,className:`rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,Q.jsx)(`h2`,{className:`text-lg font-normal`,children:`Build a chain from a prompt`}),(0,Q.jsx)(`p`,{className:`mt-4 text-[13px] leading-relaxed text-muted-foreground`,children:`Describe the outcome. An agent proposes a title and ordered skill/check steps. Review the result, edit it, then Save.`}),(0,Q.jsx)(G,{"data-slot":`wb-auto-text`,"aria-label":`Describe the chain to build`,rows:3,autoFocus:!0,placeholder:`e.g. Fix the bug, run the tests, then review the diff for regressions.`,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),i())},className:`mt-4 min-h-[108px] bg-background p-4 text-sm`}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,Q.jsxs)(n,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-auto-run`,disabled:r||e.trim()===``,onClick:i,children:[(0,Q.jsx)(_,{"aria-hidden":`true`,className:`size-3`}),r?`Building…`:`Build chain`]}),(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto-cancel`,onClick:a,children:[(0,Q.jsx)(ce,{"aria-hidden":`true`,className:`size-4`}),`Cancel`]})]}),(0,Q.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Creates an editable draft. Review the generated name and steps before saving.`})]})}function He({open:e,onOpenChange:t,text:r,onTextChange:i,error:a,pending:o,onRun:s,onCancel:c}){return(0,Q.jsx)(L,{open:e,onOpenChange:t,children:(0,Q.jsxs)(F,{showCloseButton:!1,"data-slot":`wb-import-panel`,className:`max-md:translate-x-0 max-md:translate-y-0 sm:max-w-[660px] rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,Q.jsx)(I,{className:`text-xl font-normal`,children:`Import workflow YAML`}),(0,Q.jsx)(P,{className:`sr-only`,children:`Paste a portable workflow definition to import.`}),(0,Q.jsx)(G,{"data-slot":`wb-import-text`,"aria-label":`Workflow YAML to import`,rows:4,spellCheck:!1,placeholder:`name: my-flow
|
|
5
|
+
skills:
|
|
6
|
+
- test-conventions
|
|
7
|
+
- commit-style`,value:r,onChange:e=>i(e.target.value),className:`mt-4 min-h-[124px] bg-background p-4 font-mono text-[13px] leading-relaxed`}),(0,Q.jsx)(`p`,{className:`mt-4 text-[13px] text-muted-foreground`,children:`Paste a portable workflow definition. Imported steps appear in execution order.`}),a===``?null:(0,Q.jsx)(`p`,{"data-slot":`wb-import-error`,role:`alert`,className:`mt-2 text-xs text-danger`,children:a}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,Q.jsx)(n,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-import-run`,disabled:o,onClick:s,children:`Import`}),(0,Q.jsx)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import-cancel`,onClick:c,children:`Cancel`})]})]})})}function Ue({paletteSkills:e,query:t,onQueryChange:n,error:r,inFlow:i,onAdd:a,yaml:o}){return(0,Q.jsxs)(`aside`,{"data-slot":`wb-aside`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsx)(`h2`,{className:`text-[16px] font-semibold`,children:`Available skills`}),(0,Q.jsxs)(`div`,{className:`sw-search relative mt-4`,children:[(0,Q.jsx)(h,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsx)(R,{"data-slot":`wb-filter`,placeholder:`Find a skill…`,"aria-label":`Filter skills`,value:t,onChange:e=>n(e.target.value),className:`h-11 pl-9 text-xs`})]}),(0,Q.jsx)(rt,{skills:e,query:t,error:r,inFlow:i,onAdd:a}),(0,Q.jsx)(`h3`,{className:`mt-5 text-sm font-semibold`,children:`workflow.yaml`}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs leading-relaxed text-muted-foreground`,children:`Export the workflow to use this chain in another project.`}),(0,Q.jsxs)(`details`,{className:`mt-4 min-w-0`,children:[(0,Q.jsxs)(`summary`,{"data-slot":`wb-yaml-toggle`,className:`inline-flex min-h-[44px] cursor-pointer items-center rounded-lg border border-border px-3 text-xs font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(m,{"aria-hidden":`true`,className:`mr-2 size-4`}),`View YAML`]}),(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsx)(at,{yaml:o})}),(0,Q.jsx)(`pre`,{"data-slot":`wb-yaml`,className:`mt-2 max-h-96 overflow-auto rounded-lg border border-border bg-background p-3 font-mono text-[11px] leading-relaxed whitespace-pre text-muted-foreground`,children:o})]})]})}function We({dragging:e,steps:t,skills:n}){return e?.type===`palette`?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[13px] font-medium shadow-md`,children:[(0,Q.jsx)(le,{"aria-hidden":`true`,className:`size-3.5 text-link-foreground`}),e.skill]}):e?.type===`step`?(0,Q.jsx)(nt,{step:e.step,index:t.findIndex(t=>t.id===e.step.id),skills:n,overlay:!0}):null}function Ge({open:e,onOpenChange:t,query:r,onQueryChange:i,matches:a,skillsCount:o,error:s,selectedSkill:c,onSelectSkill:l,stepsCount:u,onCloseAutoFocus:d,onCancel:f,onAdd:ee}){return(0,Q.jsx)(L,{open:e,onOpenChange:t,children:(0,Q.jsxs)(F,{"data-slot":`wb-add-dialog`,onCloseAutoFocus:d,className:`max-h-[85dvh] overflow-y-auto sm:max-w-[660px] [&_button]:min-h-11`,children:[(0,Q.jsxs)(fe,{children:[(0,Q.jsx)(I,{className:`text-xl font-normal`,children:`Add step`}),(0,Q.jsx)(P,{className:`sr-only`,children:`Choose a skill to append to this workflow.`})]}),(0,Q.jsx)(R,{"aria-label":`Filter skills`,placeholder:`Filter skills…`,value:r,onChange:e=>i(e.target.value)}),s===null?(0,Q.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Available skills`,className:`grid max-h-80 gap-2 overflow-y-auto`,children:[a.map(e=>(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg py-2 has-[:checked]:bg-accent-strong/10 has-[:focus-visible]:outline-2`,children:[(0,Q.jsx)(`input`,{type:`radio`,name:`workflow-add-skill`,className:`sr-only`,value:e.name,checked:c===e.name,onChange:()=>l(e.name)}),(0,Q.jsxs)(`span`,{className:`min-w-0 break-words text-sm`,children:[(0,Q.jsx)(`span`,{className:`block`,children:e.name}),(0,Q.jsx)(`span`,{className:`mt-2 block text-xs text-muted-foreground`,children:e.description})]})]},e.name)),a.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o===0?`No skills available in this project.`:`No matching skills.`}):null]}):(0,Q.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not load skills: `,s]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Q.jsx)(n,{variant:`outline`,onClick:f,children:`Cancel`}),(0,Q.jsx)(n,{variant:`primary`,disabled:!c||u>=8,onClick:()=>{c&&ee(c)},children:`Add selected skill`})]}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Append the selected skill, then reorder it in the existing canvas.`}),u>=8?(0,Q.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[`A workflow can contain up to `,8,` steps. Remove a step before adding another.`]}):null]})})}function Ke({trimmedName:e,savedFile:t,overwriteOpen:n,onOverwriteDismiss:r,deleteOpen:i,onDeleteDismiss:a,onOverwrite:o,onDelete:s}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(N,{open:n,onOpenChange:e=>!e&&r(),children:(0,Q.jsxs)(O,{"data-slot":`wb-overwrite-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,Q.jsxs)(M,{children:[(0,Q.jsxs)(D,{children:[`“`,e,`” already exists`]}),(0,Q.jsx)(E,{children:`Saving overwrites the existing workflow file. There is no undo.`})]}),(0,Q.jsxs)(A,{children:[(0,Q.jsx)(j,{children:`Keep the file`}),(0,Q.jsx)(k,{"data-slot":`wb-overwrite-confirm`,className:`bg-danger text-danger-foreground`,onClick:o,children:`Overwrite`})]})]})}),(0,Q.jsx)(N,{open:i,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(O,{"data-slot":`wb-delete-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,Q.jsxs)(M,{children:[(0,Q.jsxs)(D,{children:[`Delete workflow “`,e,`”?`]}),(0,Q.jsxs)(E,{children:[`Removes `,t?.path?.split(`/`).pop()??`the saved file`,` from`,` `,(0,Q.jsx)(`span`,{className:`font-mono`,children:`.ai/cezar/workflows/`}),`. There is no undo.`]})]}),(0,Q.jsxs)(A,{children:[(0,Q.jsx)(j,{children:`Keep the file`}),(0,Q.jsx)(k,{"data-slot":`wb-delete-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:s,children:`Delete workflow`})]})]})})]})}function qe(e){return e.name??e.skill??e.id}function Je(e){return e.prompt?.trim()===`{{task}}`?void 0:e.prompt?.trim()}function Ye(e){let t=e.onFail?` — on fail retry from "${e.onFail.retry}" (×${e.onFail.max??2})`:``;return`$ ${e.command}${t}`}function Xe(e,t){return Je(e)||t?.description||`Not in this repo or the team skills — the step runs on its plain prompt.`}function Ze(e,t){return e.command?Ye(e):e.skill?Xe(e,t):e.prompt??``}function Qe(e,t){return e.skill&&!t?`unknown`:null}function $e(e){return e.command?`Command step${e.onFail?` · Retry ×${e.onFail.max??2}`:``}`:e.skill?`Skill step`:`Prompt step`}function et({index:e,title:t,badge:i,onRemove:a,gripProps:o}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-step-heading`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-step-grip`,"aria-label":`Reorder step ${e+1}: ${t}`,className:`inline-flex size-[26px] shrink-0 cursor-grab items-center justify-center rounded-md text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,...o,children:(0,Q.jsx)(`span`,{className:`rounded bg-accent-strong/10 px-2 py-1 font-mono text-[12px] text-link-foreground`,children:String(e+1).padStart(2,`0`)})}),(0,Q.jsx)(`div`,{className:`min-w-0 flex-1 break-words text-sm font-medium [overflow-wrap:anywhere]`,children:t}),i?(0,Q.jsx)(`span`,{"data-slot":`wb-step-badge`,className:r(`shrink-0 rounded-full border px-2 py-px font-mono text-[11px]`,i===`unknown`&&`border-danger/35 text-danger`),children:i}):null,a?(0,Q.jsxs)(T,{children:[(0,Q.jsx)(de,{asChild:!0,children:(0,Q.jsx)(n,{"data-slot":`wb-step-actions`,variant:`ghost`,size:`icon`,className:`size-[26px]`,"aria-label":`Step ${e+1} actions: ${t}`,children:(0,Q.jsx)(ie,{"aria-hidden":`true`,className:`size-4`})})}),(0,Q.jsx)(w,{align:`end`,children:(0,Q.jsxs)(C,{"data-slot":`wb-step-remove`,"aria-label":`Remove step ${e+1}: ${t}`,onSelect:a,children:[(0,Q.jsx)(b,{"aria-hidden":`true`}),` Remove step`]})})]}):null]})}function tt({index:e,onMoveUp:t,onMoveDown:r}){return(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 @min-[900px]:hidden`,children:[(0,Q.jsxs)(n,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} up`,disabled:!t,onClick:t,children:[(0,Q.jsx)(ae,{"aria-hidden":`true`,className:`size-4`}),`Move up`]}),(0,Q.jsxs)(n,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} down`,disabled:!r,onClick:r,children:[(0,Q.jsx)(y,{"aria-hidden":`true`,className:`size-4`}),`Move down`]})]})}function nt({step:e,index:t,skills:n,onRemove:i,gripProps:a,onMoveUp:o,onMoveDown:s,overlay:c=!1}){let l=n.find(t=>t.name===e.skill),u=qe(e),d=Ze(e,l),f=Qe(e,l);return(0,Q.jsxs)(`div`,{"data-slot":`wb-step`,"data-id":e.id,"data-index":t,className:r(`rounded-lg border border-border bg-background p-4`,c&&`shadow-md`),children:[(0,Q.jsx)(et,{index:t,title:u,badge:f,onRemove:i,gripProps:a}),d?(0,Q.jsx)(`div`,{"data-slot":`wb-step-summary`,className:`mt-3 break-words text-xs leading-relaxed text-muted-foreground`,children:d}):null,(0,Q.jsx)(`p`,{"data-slot":`wb-step-kind`,className:`mt-3 text-[12px] text-link-foreground`,children:$e(e)}),c?null:(0,Q.jsx)(tt,{index:t,onMoveUp:o,onMoveDown:s})]})}function rt({skills:e,query:t,error:n,inFlow:r,onAdd:i}){if(n!==null)return(0,Q.jsxs)(`p`,{"data-slot":`wb-palette`,className:`mt-2.5 text-xs text-danger`,children:[`Could not load skills: `,n]});let a=me(e,t);return(0,Q.jsx)(`div`,{"data-slot":`wb-palette`,className:`mt-2.5 flex flex-col gap-1`,children:a.length>0?a.map(e=>(0,Q.jsx)(it,{skill:e,inFlow:r.has(e.name),onAdd:i},e.path)):(0,Q.jsx)(`p`,{className:`py-1 text-xs leading-relaxed text-soft-foreground`,children:e.length>0?`No skills match.`:(0,Q.jsx)(Ee,{})})})}function it({skill:e,inFlow:t,onAdd:n}){let{attributes:i,listeners:a,setNodeRef:o,isDragging:s}=H({id:`palette:${e.name}`,data:{type:`palette`,skill:e.name}});return(0,Q.jsxs)(`div`,{ref:o,"data-slot":`wb-skill`,"data-skill":e.name,"data-in-flow":t||void 0,title:e.description??``,className:r(`flex min-h-11 cursor-grab items-center gap-2 rounded-md py-1 transition-colors hover:bg-muted`,s&&`opacity-40`),...i,...a,children:[(0,Q.jsx)(`span`,{className:r(`min-w-0 flex-1 break-words text-xs`,z(e)?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:e.name}),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-skill-add`,"aria-label":`Add ${e.name} to the flow`,title:`Add to the flow`,onClick:()=>n(e.name),className:`inline-flex size-11 shrink-0 items-center justify-center rounded-md text-link-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:(0,Q.jsx)(g,{"aria-hidden":`true`,className:`size-3.5`})})]})}function at({yaml:e}){let[t,n]=(0,K.useState)(!1),r=(0,K.useRef)(null);return(0,K.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-copy`,title:`Copy the YAML`,onClick:()=>{navigator.clipboard?.writeText(e).catch(()=>{}),n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),1600)},className:`flex items-center gap-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(se,{"aria-hidden":`true`,className:`size-3 text-success`}),`Copied`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(S,{"aria-hidden":`true`,className:`size-3`}),`Copy`]})})}var ot=`wb-canvas`;function $(){return{name:`my-workflow`,description:``,steps:[]}}function st(e){return{name:e.name,description:e.description??``,steps:structuredClone(e.steps??[])}}function ct(){let{name:e}=t();return(0,Q.jsx)(lt,{routeName:e},e??``)}function lt({routeName:e}){let t=te(),r=ne(),i=ee(),a=s(),[m,h]=(0,K.useState)(null),[ie,ae]=(0,K.useState)(``),[_,v]=(0,K.useState)(!1),[ce,y]=(0,K.useState)(``),[le,b]=(0,K.useState)(null),[ue,x]=(0,K.useState)(!1),[S,C]=(0,K.useState)(``),[de,w]=(0,K.useState)(``),[T,E]=(0,K.useState)(!1),[D,O]=(0,K.useState)(``),[k,A]=(0,K.useState)(!1),[j,M]=(0,K.useState)(!1),[N,P]=(0,K.useState)(null),[fe,F]=(0,K.useState)(null),I=(0,K.useRef)(null),L=(0,K.useRef)(null),R=t.data?.workflows??[],z=r.data??[],B=he(z,i.data?.skillUsage),ye=me(B,ce,i.data?.skillUsage);(0,K.useEffect)(()=>{if(m!==null||t.data===void 0)return;let n=t.data.workflows,r=(e?n.find(t=>t.name===e):void 0)??n.find(e=>e.source===`file`);h(r?st(r):$())},[m,t.data,e]);let V=e=>h(t=>t===null?t:{...t,steps:e}),H=f({mutationFn:e=>d(e),onSuccess:e=>{h({name:e.name,description:e.description??``,steps:e.steps}),x(!1),C(``),w(``),p(`Imported "${e.name}" — review, then Save.`)},onError:e=>w(e.message)}),U=f({mutationFn:e=>l(e),onSuccess:e=>{h(t=>{let n=t??$(),{name:r,steps:i}=Le(e,n.name);return{...n,name:r,steps:i}}),E(!1),O(``),p(e.fallback?`Planner unavailable — added a single step. Edit, then Save.`:`Built "${e.name??m?.name??`workflow`}" — review, tweak, then Save.`,e.fallback?{tone:`danger`}:void 0)},onError:e=>p(e instanceof Error?e.message:String(e),{tone:`danger`})}),W=f({mutationFn:e=>c({...Re(m?.name??``,m?.description??``,m?.steps??[]),...e?{overwrite:!0}:{}}),onSuccess:e=>{A(!1),p(`Saved — ${e.path.split(`/`).pop()??e.path}`),a.invalidateQueries({queryKey:re.workflows})},onError:e=>{e instanceof u&&e.exists===!0?A(!0):p(e instanceof Error?e.message:String(e),{tone:`danger`})}}),G=f({mutationFn:e=>o(e),onSuccess:(e,t)=>{M(!1),p(`Deleted "${t}".`),h($()),a.invalidateQueries({queryKey:re.workflows})},onError:e=>{M(!1),p(e instanceof Error?e.message:String(e),{tone:`danger`})}}),Ee=ge(ve(_e,{activationConstraint:{distance:4}}),ve(be,{coordinateGetter:Ce}));if(t.isError)return(0,Q.jsx)(`div`,{"data-route":`workflows`,className:`@container mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:(0,Q.jsx)(pe,{icon:(0,Q.jsx)(oe,{}),tone:`danger`,title:`Could not load workflows`,subtitle:t.error.message})});if(m===null)return(0,Q.jsx)(Te,{});let q=m.steps,J=m.name.trim(),Y=R.find(e=>e.name===J&&e.source===`file`),X=Pe(m.name,m.description,q),Z=(e,t=q.length)=>{if(q.length>=8){p(`A workflow holds at most 8 steps.`,{tone:`danger`});return}V(Oe(q,De(e,q),t))};return(0,Q.jsxs)(`div`,{"data-route":`workflows`,className:`@container mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:[(0,Q.jsxs)(`header`,{className:`mb-[22px] flex flex-wrap items-center justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-[25px] font-semibold md:text-[30px]`,children:`Workflows`}),(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground md:text-[13px]`,children:`Portable skill chains. Steps run from top to bottom.`})]}),(0,Q.jsxs)(n,{variant:`primary`,"data-slot":`wb-new`,className:`min-h-11`,onClick:()=>h($()),children:[(0,Q.jsx)(g,{"aria-hidden":`true`,className:`size-4`}),`New workflow`]})]}),(0,Q.jsxs)(xe,{sensors:Ee,collisionDetection:Se,onDragStart:e=>{let t=e.active.data.current;P(t??null)},onDragOver:e=>{F(e.over?String(e.over.id):null)},onDragEnd:e=>{P(null),F(null);let{active:t,over:n}=e;if(n===null)return;let r=t.data.current;if(r?.type===`palette`){let e=n.id===ot?q.length:q.findIndex(e=>e.id===n.id);Z(r.skill,e===-1?q.length:e);return}if(n.id===t.id)return;let i=q.findIndex(e=>e.id===t.id),a=q.findIndex(e=>e.id===n.id);i!==-1&&a!==-1&&V(ke(q,i,a))},onDragCancel:()=>{P(null),F(null)},children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-[22px] pb-[calc(32px+env(safe-area-inset-bottom))]`,children:[(0,Q.jsx)(ze,{workflows:R,draft:m,trimmedName:J,nameRef:I,onDraft:h,onLoadWorkflow:e=>h(st(e))}),(0,Q.jsx)(Be,{savedFile:Y,autoOpen:T,onImportToggle:()=>{w(``),E(!1),x(e=>!e)},onExport:()=>{let e=new Blob([X],{type:`text/yaml`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${Fe(m.name)}.yaml`,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)},onAutoToggle:()=>{x(!1),E(e=>!e)},onDeleteRequest:()=>M(!0)}),T?(0,Q.jsx)(Ve,{text:D,onTextChange:O,pending:U.isPending,onRun:()=>{let e=D.trim();e===``||U.isPending||U.mutate(e)},onCancel:()=>{E(!1),O(``)}}):null,(0,Q.jsx)(He,{open:ue,onOpenChange:x,text:S,onTextChange:C,error:de,pending:H.isPending,onRun:()=>{let e=S.trim();e!==``&&H.mutate(e)},onCancel:()=>{x(!1),C(``),w(``)}}),(0,Q.jsxs)(`div`,{className:`grid min-w-0 items-start gap-[22px] @min-[700px]:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,Q.jsxs)(`section`,{"data-slot":`wb-main`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Steps · `,q.length,` of `,8,(0,Q.jsx)(`span`,{"data-slot":`wb-count`,className:`sr-only`,children:Ie(q)})]}),(0,Q.jsx)(ut,{steps:q,skills:z,dragging:N!==null,overId:fe,activeStepId:N?.type===`step`?N.step.id:null,onRemove:e=>V(Ae(q,e)),onMove:(e,t)=>V(ke(q,e,t))}),(0,Q.jsxs)(n,{ref:L,variant:`outline`,className:`mt-4 min-h-11`,onClick:()=>{b(null),y(``),v(!0)},children:[(0,Q.jsx)(g,{"aria-hidden":`true`,className:`size-4`}),`Add step`]}),(0,Q.jsxs)(`p`,{className:`mt-4 text-xs leading-relaxed text-muted-foreground`,children:[(0,Q.jsx)(`span`,{className:`hidden @min-[900px]:inline`,children:`Drag to reorder. The agent follows this sequence from top to bottom.`}),(0,Q.jsx)(`span`,{className:`@min-[900px]:hidden`,children:`Use Move up / Move down to reorder without dragging.`})]}),(0,Q.jsxs)(`footer`,{className:`mt-4 flex flex-wrap items-center justify-between gap-4 border-t border-border pt-4`,children:[(0,Q.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`Review the name and steps, then save to a workflow file.`}),(0,Q.jsxs)(n,{type:`button`,variant:`primary`,size:`sm`,className:`min-h-11 max-sm:w-full`,"data-slot":`wb-save`,disabled:W.isPending,onClick:()=>{if(J===``){I.current?.focus();return}if(q.length===0){p(`Add at least one step first.`,{tone:`danger`});return}W.mutate(!1)},children:[(0,Q.jsx)(se,{"aria-hidden":`true`,className:`size-3`}),`Save`]})]})]}),(0,Q.jsx)(Ue,{paletteSkills:B,query:ie,onQueryChange:ae,error:r.isError?r.error.message:null,inFlow:new Set(q.map(e=>e.skill).filter(e=>!!e)),onAdd:e=>Z(e),yaml:X})]})]}),(0,Q.jsx)(we,{children:(0,Q.jsx)(We,{dragging:N,steps:q,skills:z})})]}),(0,Q.jsx)(Ge,{open:_,onOpenChange:v,query:ce,onQueryChange:y,matches:ye,skillsCount:z.length,error:r.isError?r.error.message:null,selectedSkill:le,onSelectSkill:b,stepsCount:q.length,onCloseAutoFocus:e=>{e.preventDefault(),L.current?.focus()},onCancel:()=>v(!1),onAdd:e=>{Z(e),v(!1)}}),(0,Q.jsx)(Ke,{trimmedName:J,savedFile:Y,overwriteOpen:k,onOverwriteDismiss:()=>A(!1),deleteOpen:j,onDeleteDismiss:()=>M(!1),onOverwrite:()=>W.mutate(!0),onDelete:()=>G.mutate(J)})]})}function ut({steps:e,skills:t,dragging:n,overId:i,activeStepId:a,onRemove:o,onMove:s}){let{setNodeRef:c,isOver:l}=ye({id:ot}),u=n&&i===ot;return(0,Q.jsx)(`div`,{ref:c,"data-slot":`wb-steps`,"data-dragging":n||void 0,className:r(`relative mt-4 rounded-lg transition-colors`,l?`border-accent-strong/60 bg-accent-strong/5`:`border-muted-foreground/25`),children:e.length===0?(0,Q.jsx)(`p`,{className:r(`rounded-md px-3 py-10 text-center text-[13px] transition-colors`,l?`text-link-foreground`:`text-muted-foreground`),children:`Drop a skill here — or Import a workflow.yaml`}):(0,Q.jsxs)(U,{items:e.map(e=>e.id),strategy:B,children:[(0,Q.jsx)(`ol`,{className:`flex flex-col gap-4`,children:e.map((r,c)=>(0,Q.jsx)(dt,{step:r,index:c,skills:t,dragging:n,insertBefore:n&&i===r.id&&a!==r.id,onRemove:()=>o(c),onMoveUp:c>0?()=>s(c,c-1):void 0,onMoveDown:c<e.length-1?()=>s(c,c+1):void 0},r.id))}),(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:r(`absolute inset-x-0 mt-1 h-[3px] rounded-full transition-colors`,u?`bg-accent-strong`:`bg-transparent`)})]})})}function dt({step:e,index:t,skills:n,insertBefore:i,onRemove:a,onMoveUp:o,onMoveDown:s}){let{attributes:c,listeners:l,setNodeRef:u,transform:d,transition:f,isDragging:ee}=V({id:e.id,data:{type:`step`,step:e}});return(0,Q.jsxs)(`li`,{ref:u,style:{transform:W.Transform.toString(d),transition:f},className:r(`relative`,ee&&`opacity-40`),children:[i?(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-drop-line`,className:`pointer-events-none absolute -top-[7px] right-0 left-0 h-[3px] rounded-full bg-accent-strong`}):null,(0,Q.jsx)(nt,{step:e,index:t,skills:n,onRemove:a,onMoveUp:o,onMoveDown:s,gripProps:{...c,...l}})]})}export{ct as WorkflowsRoute};
|
package/web/dist/index.html
CHANGED
|
@@ -47,38 +47,39 @@
|
|
|
47
47
|
}
|
|
48
48
|
})()
|
|
49
49
|
</script>
|
|
50
|
-
<script type="module" crossorigin src="/assets/index-
|
|
50
|
+
<script type="module" crossorigin src="/assets/index-DBNT3CYH.js"></script>
|
|
51
51
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
|
|
52
52
|
<link rel="modulepreload" crossorigin href="/assets/react-runtime-CCIEwYL0.js">
|
|
53
53
|
<link rel="modulepreload" crossorigin href="/assets/bundle-mjs-BT31bpU6.js">
|
|
54
54
|
<link rel="modulepreload" crossorigin href="/assets/button-CS5tOblf.js">
|
|
55
|
+
<link rel="modulepreload" crossorigin href="/assets/live-refetch-CZb2VOyu.js">
|
|
55
56
|
<link rel="modulepreload" crossorigin href="/assets/live-protocol-DBPXI6ks.js">
|
|
56
57
|
<link rel="modulepreload" crossorigin href="/assets/project-scope-context-DSkcNKO7.js">
|
|
57
|
-
<link rel="modulepreload" crossorigin href="/assets/live-refetch-pzhdhNS_.js">
|
|
58
58
|
<link rel="modulepreload" crossorigin href="/assets/useInfiniteQuery-BmfExLUr.js">
|
|
59
59
|
<link rel="modulepreload" crossorigin href="/assets/useQuery-8pHkglP4.js">
|
|
60
60
|
<link rel="modulepreload" crossorigin href="/assets/ws-CEQH0TUT.js">
|
|
61
61
|
<link rel="modulepreload" crossorigin href="/assets/toaster-CRVRHlMR.js">
|
|
62
|
-
<link rel="modulepreload" crossorigin href="/assets/queries-
|
|
62
|
+
<link rel="modulepreload" crossorigin href="/assets/queries-D2MPDhtr.js">
|
|
63
63
|
<link rel="modulepreload" crossorigin href="/assets/cez-idle-NomdGTfa.js">
|
|
64
|
-
<link rel="modulepreload" crossorigin href="/assets/design-icons-DmYTv2r1.js">
|
|
65
64
|
<link rel="modulepreload" crossorigin href="/assets/createLucideIcon-BHp8sXmF.js">
|
|
66
|
-
<link rel="modulepreload" crossorigin href="/assets/nav-row-styles-CEA9c88Q.js">
|
|
67
65
|
<link rel="modulepreload" crossorigin href="/assets/es2015-CX0rgbM5.js">
|
|
66
|
+
<link rel="modulepreload" crossorigin href="/assets/design-icons-DmYTv2r1.js">
|
|
68
67
|
<link rel="modulepreload" crossorigin href="/assets/dist-DvNdR7gM.js">
|
|
69
68
|
<link rel="modulepreload" crossorigin href="/assets/dropdown-menu-D7f0O7xR.js">
|
|
70
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
69
|
+
<link rel="modulepreload" crossorigin href="/assets/attention-VmnPpwJx.js">
|
|
70
|
+
<link rel="modulepreload" crossorigin href="/assets/popover-G6KGT-qq.js">
|
|
71
|
+
<link rel="modulepreload" crossorigin href="/assets/nav-row-styles-CEA9c88Q.js">
|
|
71
72
|
<link rel="modulepreload" crossorigin href="/assets/eye-B8okNWXU.js">
|
|
72
73
|
<link rel="modulepreload" crossorigin href="/assets/format-BNCkW110.js">
|
|
73
74
|
<link rel="modulepreload" crossorigin href="/assets/play-CmVAj_fu.js">
|
|
74
|
-
<link rel="modulepreload" crossorigin href="/assets/control-locations-
|
|
75
|
+
<link rel="modulepreload" crossorigin href="/assets/control-locations-B88tMDqg.js">
|
|
75
76
|
<link rel="modulepreload" crossorigin href="/assets/alert-dialog-h-3h9B4l.js">
|
|
76
77
|
<link rel="modulepreload" crossorigin href="/assets/dialog-Dw7fMdDQ.js">
|
|
77
78
|
<link rel="modulepreload" crossorigin href="/assets/input-DIwJvCgi.js">
|
|
78
79
|
<link rel="modulepreload" crossorigin href="/assets/project-router-BFKfAFvq.js">
|
|
79
|
-
<link rel="modulepreload" crossorigin href="/assets/agent-accounts-
|
|
80
|
+
<link rel="modulepreload" crossorigin href="/assets/agent-accounts-B-Gpf8IN.js">
|
|
80
81
|
<link rel="modulepreload" crossorigin href="/assets/skills-DFBiAuJG.js">
|
|
81
|
-
<link rel="modulepreload" crossorigin href="/assets/github-sidebar-model-
|
|
82
|
+
<link rel="modulepreload" crossorigin href="/assets/github-sidebar-model-DkUAF09l.js">
|
|
82
83
|
<link rel="modulepreload" crossorigin href="/assets/centered-state-BmsqxbI8.js">
|
|
83
84
|
<link rel="modulepreload" crossorigin href="/assets/lib-BxQXEXDF.js">
|
|
84
85
|
<link rel="modulepreload" crossorigin href="/assets/chunk-BO2N2NFS-DE6qKn3r.js">
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{L as t,p as n,t as r,u as i}from"./button-CS5tOblf.js";import{i as a,t as o}from"./react-runtime-CCIEwYL0.js";import{t as s}from"./live-refetch-pzhdhNS_.js";import{An as c,Dr as l,In as u,Kr as d,Pr as f,Rt as p,Tr as m,f as ee,gr as te,i as ne,or as re,wn as ie,zn as h}from"./project-scope-context-DSkcNKO7.js";import{$ as g,A as ae,J as _,K as v,V as oe,W as se,X as ce,Y as le,Z as y,ct as ue,et as b,it as de,rt as x,st as fe}from"./live-protocol-DBPXI6ks.js";import{t as pe}from"./useQuery-8pHkglP4.js";import{n as me,t as he}from"./ws-CEQH0TUT.js";import{t as S}from"./createLucideIcon-BHp8sXmF.js";import{n as ge,r as _e,t as ve}from"./hourglass-B0lPAJvT.js";import{t as ye}from"./eye-B8okNWXU.js";import{t as be}from"./message-square-B-MD-8rD.js";import{t as C}from"./project-router-BFKfAFvq.js";import{Nt as xe,Xt as w,yn as T}from"./index-75IttVLX.js";var Se=S(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),Ce=S(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),we=S(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),Te=S(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),Ee=S(`messages-square`,[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]),De=S(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),Oe=S(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),ke=S(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),Ae=S(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),E=e(a(),1),D=o(),O=ue(),k=g().int().nonnegative(),A=x().min(1),je=b({title:x().max(160),toolKind:v([`read`,`edit`,`delete`,`move`,`search`,`execute`,`think`,`fetch`,`task`,`plan`,`other`]),status:v([`pending`,`running`,`completed`,`failed`,`declined`]),startedAt:O,endedAt:O.optional()}).strict(),Me=v([`pass`,`fail`,`pending`,`skipping`,`cancel`]),Ne=b({checks:_(b({name:x().max(100),bucket:Me}).strict()).max(100),counts:b({pass:k,fail:k,pending:k,skipping:k,cancel:k}).strict(),truncated:y(!0).optional()}).strict(),Pe=ce(`kind`,[b({kind:y(`human`),since:O,detail:b({question:x().max(500).optional(),reason:v([`question`,`turn-end`,`budget`,`completion`]),queuedMessages:g().int().positive().optional()}).strict()}).strict(),b({kind:y(`usage-limit`),detail:b({resumeAt:x()}).strict()}).strict(),b({kind:y(`workers`),since:O,deadline:O.optional(),detail:b({owed:k,total:k,settled:k,replies:y(!0).optional(),mode:ae.optional(),recipientRunIds:_(A)}).strict()}).strict(),b({kind:y(`peers`),since:O,deadline:O,detail:b({peerRunIds:_(A)}).strict()}).strict(),b({kind:y(`subagents`),since:O,deadline:O,detail:b({running:k}).strict()}).strict(),b({kind:y(`pr`),since:O,deadline:O,detail:b({number:g().int().positive(),target:re,checks:Ne.shape.checks.optional(),counts:Ne.shape.counts.optional(),truncated:y(!0).optional()}).strict()}).strict(),b({kind:y(`process`),since:O,deadline:O,detail:b({pid:g().int(),note:x().optional()}).strict()}).strict(),b({kind:y(`timer`),since:O,deadline:O,detail:b({wakeAt:O,note:x().optional()}).strict()}).strict()]),Fe={runId:A,title:x(),status:te,rung:v(u),runner:se.optional(),model:x().optional(),currentStepId:x().optional(),startedAt:x().optional(),wait:Pe.optional(),tool:je.optional(),rate:_(k).length(30),error:x().max(200).optional()},Ie=b({...Fe,revision:k,collected:le()}).strict(),Le=b({...Fe,workers:_(Ie)}).strict(),Re=b({requestId:fe(),relationship:v([`family`,`peer`]),senderRunId:A,recipientRunId:A,text:x().max(500),senderTitle:x().optional(),recipientTitle:x().optional(),createdAt:O,deadline:O.optional()}).strict(),ze=b({requestId:fe(),senderRunId:A,recipientRunId:A,status:oe.shape.status,observedAt:O}).strict(),Be=b({generatedAt:O,projects:_(b({projectId:x(),name:x(),loaded:le(),unavailable:b({status:de([y(404),y(409),y(503)]),error:x()}).strict().optional(),inReview:k,tasks:_(Le),requests:_(Re),closed:_(ze)}).strict())}).strict();b({project:de([y(`default`),x().regex(c)]).optional()});var Ve=5e3,He=e=>[`workspace`,`activity`,e.kind===`project`?e.projectId:null],Ue=e=>e.kind===`project`?`activity:project:${e.projectId}`:`activity:workspace`,We=e=>e.kind===`project`?`/api/v1/workspace/activity?project=${encodeURIComponent(e.projectId)}`:`/api/v1/workspace/activity`,Ge=`the ${t(`cezar`)} server answered /workspace/activity with an unexpected body`;function Ke(e){let t=Be.safeParse(e);if(!t.success)throw new ne(200,Ge);return t.data}async function qe(e,t){let n=e.kind===`project`?{project:e.projectId}:{};return Ke(await ie(await ee.api.v1.workspace.activity.$get({query:n},p(t)),`/workspace/activity`))}function Je(e,t){return e!==void 0&&Date.parse(t.generatedAt)<Date.parse(e.generatedAt)?e:t}var Ye=new Date(0).toISOString();function Xe(e){return e!==void 0&&e!==Ye&&!Number.isNaN(Date.parse(e))}var Ze=new Set([404,409,503]);function Qe(e,t,n,r){let i=e?.projects.find(e=>e.projectId===t)?.name??t;return{generatedAt:e?.generatedAt??Ye,projects:[{projectId:t,name:i,loaded:!0,unavailable:{status:n,error:r},inReview:0,tasks:[],requests:[],closed:[]}]}}function $e(e,t){return new ne(Number(/^HTTP (\d+)$/.exec(t)?.[1]??0),e&&typeof e==`object`&&typeof e.error==`string`?e.error:t)}var et=(e,t)=>e.kind===`project`&&Ze.has(t.status)?t.status:void 0;function tt(e){let t=e.kind===`project`?e.projectId:void 0,n=(0,E.useMemo)(()=>t===void 0?{kind:`workspace`}:{kind:`project`,projectId:t},[t]),r=(0,E.useMemo)(()=>He(n),[n]),i=d(),a=pe({queryKey:r,queryFn:async({signal:e})=>{let t=i.getQueryData(r);try{return Je(t,await qe(n,{signal:e}))}catch(e){let r=e instanceof ne?et(n,e):void 0;if(r===void 0||n.kind!==`project`)throw e;return Qe(t,n.projectId,r,e.message)}},staleTime:1/0});return(0,E.useEffect)(()=>{let e=!0,t=t=>{i.cancelQueries({queryKey:r,exact:!0}).then(()=>{if(!e)return;let a=et(n,t);if(a!==void 0&&n.kind===`project`){i.setQueryData(r,e=>Qe(e,n.projectId,a,t.message));return}let o=i.getQueryCache().find({queryKey:r,exact:!0});o?.setState({status:`error`,error:t,errorUpdatedAt:Date.now(),errorUpdateCount:o.state.errorUpdateCount+1,fetchStatus:`idle`})})},a=n=>{let a;try{a=Ke(n)}catch(e){t(e);return}i.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&i.setQueryData(r,e=>Je(e,a))})},o=he(Ue(n),a),c=s(Ve),u,d=()=>{let e=m()===`finite`&&c!==!1;e&&!u?u=me({path:We(n),intervalMs:c},(e,n)=>{n===void 0?a(e):t($e(e,n))}):!e&&u&&(u(),u=void 0)};d();let f=l(d);return()=>{e=!1,f(),u?.(),o()}},[i,r,n]),a}var j=e=>String(e).padStart(2,`0`);function M(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t/60)%60,i=t%60;return n>0?`${n}:${j(r)}:${j(i)}`:`${r}:${j(i)}`}function N(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t} s`;let n=Math.floor(t/60);return n<60?`${n} min`:`${Math.floor(n/60)} h ${j(n%60)} min`}function P(e,t){let n=e===void 0?NaN:Date.parse(e);return Number.isNaN(n)?0:t-n}var nt=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`});function F(e){let t=Date.parse(e);return Number.isNaN(t)?e:nt.format(t)}function rt(){return Intl.DateTimeFormat().resolvedOptions().timeZone}var it=new Set([`queued`,`running`,`waiting`]),at={review:`In review`,failed:`Failed`,done:`Done`,cancelled:`Cancelled`},ot={review:`review`,failed:`failed`,done:`done`,cancelled:`cancelled`},I=e=>it.has(e),L=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,R=e=>h(e.rung).tone,st=(e,t=`Deadline`)=>e?`${t} ${F(e)}`:void 0;function ct(e,t,n){return t.length===1&&t[0]!==void 0?`${e} ${n.titleOf(t[0])}`:`${e} ${L(t.length,`task`)}`}function lt(e,t){let n=e.tool,r={verb:`Doing`,tone:R(e),icon:`tool`},i=n?.endedAt!==void 0&&P(n.endedAt,t.now)>1e4;if(n===void 0)return{...r,main:`Thinking`,...e.startedAt?{since:e.startedAt}:{}};let a=`Last tool ${N(P(n.endedAt??n.startedAt,t.now))} ago`;return i?{...r,main:`Thinking`,detail:a,since:n.endedAt??n.startedAt}:{...r,main:n.title,mono:!0,detail:a,since:n.startedAt}}function ut(e,t){let n={verb:`Needs you`,tone:R(e),icon:`user`,...t?{since:t.since}:{}};if(t?.detail.reason===`question`)return t.detail.question?{...n,main:t.detail.question,action:`answer`}:{...n,main:`Your turn`,action:`answer`};if(t?.detail.reason===`budget`){let e=t.detail.queuedMessages;return{...n,main:e?`Automatic wakes used up · ${L(e,`message`)} queued`:`Automatic wakes used up`,action:`open`}}return{...n,main:`Your turn`,action:`open`}}function dt(e){return{verb:`Needs you`,tone:R(e),icon:`user`,main:`Permission`,action:`open`}}function ft(e,t,n){let{owed:r,total:i,settled:a,replies:o,mode:s,recipientRunIds:c}=t.detail,l=i>0?a/i:0,u={tone:R(e),since:t.since};if(o){let e=c.length>0?ct(`From`,c,n):`Waiting for replies`;return{...u,verb:`Waiting for reply`,icon:`reply`,main:e,...z(`detail`,st(t.deadline,`Reply due`))}}let d=c.length>0?`${r} owed · ${a} settled`:s?`${pt[s]} of ${i} · ${a} settled`:`${r} owed`;return{...u,verb:`Waiting for workers`,icon:`workers`,main:d,bar:l,...z(`detail`,st(t.deadline))}}var pt={one:`One`,any:`Any`,all:`All`};function mt(e){let t=e.detail.counts;if(t===void 0)return`PR ${e.detail.number} checks`;let n=t.pass+t.fail+t.pending;return`PR ${e.detail.number} checks · ${t.pass} of ${n} passed`}var ht=[`fail`,`pending`,`pass`,`skipping`,`cancel`];function gt(e){let{counts:t,checks:n=[],truncated:r}=e.detail;if(!r||t===void 0)return;let i=e=>Math.max(0,t[e]-n.filter(t=>t.bucket===e).length),a=ht.reduce((e,t)=>e+i(t),0),o=ht.find(e=>i(e)>0);return a>0&&o?{count:a,bucket:o}:void 0}var _t=[[`pass`,`passed`],[`fail`,`failed`],[`pending`,`pending`],[`skipping`,`skipped`],[`cancel`,`cancelled`]];function vt(e){let{counts:t,checks:n}=e.detail,r=e=>t?t[e]:(n??[]).filter(t=>t.bucket===e).length,i=_t.filter(([e])=>r(e)>0).map(([e,t])=>`${r(e)} ${t}`),a=gt(e);return a&&i.push(`+${a.count} more not listed`),i.length>0?i.join(`, `):void 0}function yt(e,t){let n={tone:R(e),since:t.since,...z(`detail`,st(t.deadline))};if(t.detail.target!==`checks`)return{...n,verb:`Waiting for merge`,icon:`merge`,main:`PR ${t.detail.number}`};let r=t.detail.checks?[...t.detail.checks].sort((e,t)=>e.name.localeCompare(t.name)):void 0;return{...n,verb:`Waiting for CI`,icon:`ci`,main:mt(t),...z(`checks`,r),...z(`overflow`,gt(t)),...z(`checkSummary`,vt(t))}}function z(e,t){return t===void 0?{}:{[e]:t}}function bt(e,t,n){let r=R(e);switch(t.kind){case`workers`:return ft(e,t,n);case`peers`:return{verb:`Waiting for a peer`,tone:r,icon:`peer`,since:t.since,main:ct(`For`,t.detail.peerRunIds,n),detail:`Deadline ${F(t.deadline)}`};case`subagents`:return{verb:`Waiting for subagents`,tone:r,icon:`subagents`,since:t.since,main:L(t.detail.running,`native subagent`),detail:`Deadline ${F(t.deadline)}`};case`pr`:return yt(e,t);case`process`:return{verb:`Waiting for command`,tone:r,icon:`command`,since:t.since,main:t.detail.note??`Process ${t.detail.pid}`,detail:`Running ${M(P(t.since,n.now))} · deadline ${F(t.deadline)}`};case`timer`:return{verb:`Waiting for timer`,tone:r,icon:`timer`,since:t.since,main:t.detail.note??`Timer`,detail:`Wakes ${F(t.detail.wakeAt)} · in ${M(-P(t.detail.wakeAt,n.now))}`};case`usage-limit`:return xt(e,t.detail.resumeAt,n);case`human`:return}}function xt(e,t,n){let r=Date.parse(t),i=Number.isNaN(r)?`Resumes ${t}`:`Resumes ${F(t)} · in ${M(r-n.now)}`;return{verb:`Paused`,tone:R(e),icon:`pause`,main:`Usage limit`,detail:i}}function St(e,t){let n=e.wait&&`since`in e.wait?e.wait.since:e.startedAt;return{verb:`Queued`,tone:R(e),icon:`queued`,main:`Waiting for a free slot`,...n?{since:n,detail:`Waiting ${N(P(n,t.now))}`}:{}}}function B(e,t){return{verb:at[e.status]??e.status,tone:R(e),icon:ot[e.status]??`done`,main:t}}function Ct(e,t){return I(e.status)?wt(e,t):B(e,L(e.workers.filter(e=>I(e.status)).length,`live worker`))}function wt(e,t){let n=e.wait;switch(e.rung){case`running`:return lt(e,t);case`needs-permission`:return dt(e);case`needs-you`:return ut(e,n?.kind===`human`?n:void 0);case`usage-limit`:return n?.kind===`usage-limit`?xt(e,n.detail.resumeAt,t):{verb:`Paused`,tone:R(e),icon:`pause`,main:`Usage limit`};case`queued`:case`waiting-for-capacity`:return St(e,t);default:return(n&&bt(e,n,t))??St(e,t)}}function Tt(e,t,n){if(n!==void 0&&I(e.status))return{verb:`Asks parent`,tone:R(e),main:`“${n}”`,asks:!0};let r=Et(e,t);return{verb:r.verb,tone:r.tone,main:r.main,...r.mono?{mono:!0}:{}}}function Et(e,t){switch(e.status){case`done`:return B(e,e.collected?`Collected`:`Ready to collect`);case`review`:return B(e,`Waiting for the parent’s review`);case`failed`:case`cancelled`:return B(e,e.error??at[e.status]??e.status);default:return wt({...e,workers:[]},t)}}function Dt(e){if(e.unavailable)return e.unavailable.error;if(!e.loaded)return`Not loaded in this cockpit`}function Ot(e){let t=new Map;for(let n of e.tasks){t.set(n.runId,{title:n.title,cardId:n.runId,role:`root`});for(let e of n.workers)t.set(e.runId,{title:e.title,cardId:n.runId,role:`worker`})}return t}function V(e,t,n){return e.get(t)?.title??n??`Unreadable task`}var kt=(e,t)=>V(e,t.senderRunId,t.senderTitle),H=(e,t)=>V(e,t.recipientRunId,t.recipientTitle),At=(e,t)=>`wait:${e}:${t}`;function jt(e){let t=[];for(let n of e){let e=n.wait;if(!(!I(n.status)||e?.kind!==`peers`))for(let r of new Set(e.detail.peerRunIds))r!==n.runId&&t.push({id:At(n.runId,r),waiterRunId:n.runId,peerRunId:r,since:e.since,deadline:e.deadline})}return t}function Mt(e,t){let n=new Set;for(let r of t)r.waiterRunId===e&&n.add(r.peerRunId),r.peerRunId===e&&n.add(r.waiterRunId);return n}function Nt(e,t){return t.filter(t=>t.waiterRunId===e)}function Pt(e,t,n,r=[]){let i=[];for(let r of t)r.senderRunId===e&&i.push(`Waiting for a reply from ${H(n,r)}`),r.recipientRunId===e&&i.push(`${kt(n,r)} waits for your reply`);for(let t of r)t.waiterRunId===e&&i.push(`Waiting for a message from ${V(n,t.peerRunId)}`),t.peerRunId===e&&i.push(`${V(n,t.waiterRunId)} waits for you to write`);return i}function Ft(e,t,n){return n.find(n=>n.relationship===`family`&&n.senderRunId===e&&n.recipientRunId===t)}function It(e,t){let n=-P(e,t);return n>=1e3?`reply due in ${M(n)}`:`reply overdue`}function Lt(e,t){return t.filter(t=>t.relationship===`peer`&&t.senderRunId===e)}function Rt(e,t){return e.relationship===`peer`?{kind:`Request`,relation:`Peer`}:{kind:`Question`,relation:zt[Bt(e,t)]}}var zt={worker:`Worker → parent`,parent:`Parent → worker`,unknown:`Family`};function Bt(e,t){let n=t.get(e.senderRunId)?.role;if(n)return n===`worker`?`worker`:`parent`;let r=t.get(e.recipientRunId)?.role;return r?r===`root`?`worker`:`parent`:`unknown`}var Vt=new Set([`needs-you`,`needs-permission`]),Ht=new Set([`queued`,`waiting-for-capacity`]);function Ut(e){if(I(e.status))return Vt.has(e.rung)?`needsYou`:e.rung===`running`?`working`:Ht.has(e.rung)?`queued`:`waiting`}function Wt(e){let t={needsYou:0,working:0,waiting:0,queued:0,activeWorkers:0,openRequests:0,inReview:0};for(let n of e){t.inReview+=n.inReview,t.openRequests+=n.requests.length;for(let e of n.tasks){let n=Ut(e);n&&(t[n]+=1),t.activeWorkers+=e.workers.filter(e=>I(e.status)).length}}return t}function Gt(e,t=()=>!1){let n=0,r=0;for(let i of e.workers)t(i.runId)||((i.status===`done`||i.status===`cancelled`)&&(n+=1),i.status===`failed`&&(n+=1,r+=1));return{finished:n,failed:r}}function Kt({finished:e,failed:t}){if(e!==0)return t>0?`✓ ${e} finished · ${t} failed`:`✓ ${e} worker${e===1?``:`s`} finished`}var U={flash:1300,cardEnter:700,cardLeave:500,workerEnter:700,workerHold:3e3,workerFold:500,comet:1100,replied:900,fade:800,bump:500,slide:450,check:800},W={flash:{},entering:{},leaving:{},workerEnter:{},workerHold:{},opening:{},closing:{},waitsClosing:{},comets:{},bumps:{},slides:{},checks:{}},qt=(e,t)=>`${e}\n${t}`;function Jt(e,t){let n=qt(t,``);return new Set(Object.keys(e.checks).filter(e=>e.startsWith(n)).map(e=>e.slice(n.length)))}var Yt=class{key;changes=[];timers=[];constructor(e){this.key=e}timed(e,t,n,r){this.changes.push({field:e,id:t,value:{...n,key:this.key}}),this.timers.push({after:r,change:{field:e,id:t,ifKey:this.key}})}later(e,t,n,r){this.timers.push({after:r,change:{field:e,id:t,value:{...n,key:this.key},ifKey:this.key}})}drop(e,t){this.changes.push({field:e,id:t})}},Xt={done:`success`,review:`success`,failed:`danger`,cancelled:`neutral`};function Zt(e,t){let n=Xt[t.status]??`success`;if(t.status===`review`){e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},U.flash);return}e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},U.workerHold+U.workerFold),e.later(`workerHold`,t.runId,{tone:n,phase:`fold`},U.workerHold)}function Qt(e,t){e.drop(`closing`,t.requestId),e.timed(`opening`,t.requestId,{},U.fade),e.timed(`comets`,`${t.requestId}:open:${e.key}`,{requestId:t.requestId,reverse:!1,tone:t.relationship},U.comet)}function $t(e,t,n,r){let i=n.requestId;if(e.drop(`opening`,i),!r){e.timed(`closing`,i,{projectId:t,request:n,replied:!1,phase:`fade`},U.fade);return}let a=U.comet+U.replied+U.fade;e.timed(`closing`,i,{projectId:t,request:n,replied:!0,phase:`reply`},a),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`replied`},U.comet),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`fade`},U.comet+U.replied),e.timed(`comets`,`${i}:reply:${e.key}`,{requestId:i,reverse:!0,tone:`success`},U.comet)}function en(e,t){switch(t.kind){case`rung-changed`:return e.timed(`flash`,t.task.runId,{tone:h(t.task.rung).tone},U.flash);case`tool-started`:return e.timed(`slides`,t.runId,{},U.slide);case`worker-started`:return e.timed(`workerEnter`,t.worker.runId,{},U.workerEnter);case`worker-settled`:return Zt(e,t.worker);case`card-entered`:return e.drop(`leaving`,t.task.runId),e.timed(`entering`,t.task.runId,{},U.cardEnter);case`card-left`:return e.timed(`leaving`,t.task.runId,{projectId:t.projectId,task:t.task},U.cardLeave);case`check-passed`:return e.timed(`checks`,qt(t.runId,t.name),{},U.check);case`request-opened`:return Qt(e,t.request);case`request-closed`:return $t(e,t.projectId,t.request,t.status===`replied`);case`chip-changed`:return e.timed(`bumps`,t.chip,{},U.bump);case`wait-opened`:return e.drop(`waitsClosing`,t.wait.id),e.timed(`opening`,t.wait.id,{},U.fade);case`wait-closed`:return e.drop(`opening`,t.wait.id),e.timed(`waitsClosing`,t.wait.id,{projectId:t.projectId,wait:t.wait},U.fade)}}function tn(e,t,n){let r=new Yt(t);if(!n)for(let t of e)en(r,t);return{changes:r.changes,timers:r.timers}}function nn(e,t){let n=e[t.field];if(t.ifKey!==void 0&&n[t.id]?.key!==t.ifKey||t.value===void 0&&!(t.id in n))return e;let r={...n};return t.value===void 0?delete r[t.id]:r[t.id]=t.value,{...e,[t.field]:r}}function rn(e,t){return t.reduce(nn,e)}function an(e,t,n){let r=new Set(t.map(e=>e.id));return Object.values(n.waitsClosing).filter(t=>t.projectId===e&&!r.has(t.wait.id)).map(e=>e.wait)}var on={success:`text-success`,pending:`text-signal-word-amber`,danger:`text-signal-word-red`,accent:`text-accent-text`,info:`text-info`,running:`text-status-running`,neutral:`text-muted-foreground`};function sn({tone:e,className:t,children:n,...r}){return(0,D.jsx)(`span`,{...r,className:i(`bg-card-2`,{"text-success":e===`success`,"text-signal-word-amber":e===`pending`,"text-signal-word-red":e===`danger`,"text-accent-text":e===`accent`,"text-info":e===`info`,"text-status-running":e===`running`,"text-muted-foreground":e===`neutral`},t),children:n})}var cn={success:`border-success`,pending:`border-pending-strong`,danger:`border-danger`,accent:`border-accent-strong`,info:`border-info`,running:`border-status-running`,neutral:`border-soft-foreground`},ln={success:`bg-success`,pending:`bg-pending-strong`,danger:`bg-danger`,accent:`bg-accent-strong`,info:`bg-info`,running:`bg-status-running`,neutral:`bg-soft-foreground`},un={tool:Ae,user:ke,workers:T,reply:be,peer:Ee,subagents:T,ci:Te,merge:we,command:Oe,timer:Ce,pause:De,queued:ve,review:ye,failed:ge,done:_e,cancelled:Se};function dn(e,t){let n=h(e.rung),r=e.rung===`waiting-on-workers`&&(t===`worker`||e.wait?.kind===`peers`);return{tone:n.tone,shape:r?`ring`:n.shape,label:pn(e,t)??n.label}}var fn=(e,t,n)=>`${e} ${t} ${n}${t===1?``:`s`}`;function pn(e,t){let n=e.wait;if(e.rung===`waiting-on-workers`){if(t===`worker`)return`waiting on parent reply`;if(n?.kind===`peers`&&n.detail.peerRunIds.length>0)return fn(`waiting on`,n.detail.peerRunIds.length,`task`);if(n?.kind===`workers`&&n.detail.replies)return`waiting on replies`;if(n?.kind===`workers`&&n.detail.owed>0)return fn(`waiting on`,n.detail.owed,`worker`)}if(e.rung===`waiting-on-subagents`&&n?.kind===`subagents`&&n.detail.running>0)return fn(`waiting for`,n.detail.running,`subagent`)}function mn(e,t){if(I(e.status))return e.rung===`running`&&t===`filled`?`activity-pulse`:t===`filled`?void 0:`activity-breathe`}function G({run:e,role:t}){let{tone:n,shape:r,label:a}=dn(e,t);return(0,D.jsx)(`span`,{"data-activity-anchor":e.runId,className:i(`inline-flex size-[12px] shrink-0 items-center justify-center`,mn(e,r)),children:(0,D.jsx)(w,{tone:n,shape:r,role:`img`,"aria-label":a})})}function hn({runId:e,requests:t,waits:n,index:r,link:i,pathOf:a,className:o,linkClassName:s}){let c=Lt(e,t),l=Nt(e,n);return c.length===0&&l.length===0?null:(0,D.jsxs)(`ul`,{"data-slot":`activity-peer-links`,className:o,children:[c.map(e=>(0,D.jsx)(`li`,{children:(0,D.jsxs)(i,{to:a(e.recipientRunId),className:s,children:[`→ `,H(r,e)]})},e.requestId)),l.map(e=>(0,D.jsx)(`li`,{children:(0,D.jsxs)(i,{to:a(e.peerRunId),className:s,children:[`⋯ waits on `,V(r,e.peerRunId)]})},e.id))]})}var gn={pass:`bg-success`,fail:`bg-danger`,pending:`bg-info`,skipping:`border border-soft-foreground`,cancel:`border border-soft-foreground`},_n=(e,t)=>t?`activity-check-pass`:e===`pending`?`activity-breathe-fast`:void 0;function vn({checks:e,overflow:t,passed:n}){return(0,D.jsxs)(`span`,{"data-slot":`activity-checks`,"aria-hidden":`true`,className:i(`col-start-2 mt-[5px] flex items-center`,e.length>40?`gap-px`:`gap-[3px]`),children:[e.map(e=>(0,D.jsx)(`i`,{"data-bucket":e.bucket,"data-passed":n.has(e.name)?`true`:void 0,title:e.name,className:i(`h-[5px] min-w-px flex-1 rounded-[2px]`,gn[e.bucket],_n(e.bucket,n.has(e.name)))},e.name)),t?(0,D.jsxs)(`span`,{"data-slot":`activity-checks-overflow`,"data-bucket":t.bucket,className:`ml-1 flex shrink-0 items-center gap-1 text-[10px] leading-none text-muted-foreground tabular-nums`,children:[(0,D.jsx)(`i`,{className:i(`h-[5px] w-2 rounded-[2px]`,gn[t.bucket])}),`+`,t.count]}):null]})}function yn({value:e,ink:t}){return(0,D.jsx)(`span`,{"data-slot":`activity-bar`,"aria-hidden":`true`,className:`col-start-2 mt-[5px] block h-1 overflow-hidden rounded-sm bg-border`,children:(0,D.jsx)(`span`,{className:i(`block h-full bg-current`,t),style:{width:`${Math.round(e*100)}%`}})})}var bn=new Set;function xn({box:e,now:t,dense:n,motion:r={}}){let a=un[e.icon],o=on[e.tone];return(0,D.jsxs)(`div`,{"data-slot":`activity-now`,"data-verb":e.verb,className:`relative grid grid-cols-[16px_minmax(0,1fr)] gap-x-2 gap-y-px overflow-hidden rounded-lg bg-card-2 px-2.5 py-2`,children:[r.sweep?(0,D.jsx)(`span`,{"data-slot":`activity-sweep`,"aria-hidden":`true`,className:`activity-sweep`}):null,(0,D.jsx)(a,{"aria-hidden":`true`,className:i(`mt-px size-[15px]`,o)}),(0,D.jsxs)(sn,{tone:e.tone,className:`flex gap-2 text-[11px] font-semibold tracking-[0.04em] uppercase`,children:[(0,D.jsx)(`span`,{"data-slot":`activity-verb`,children:e.verb}),e.since?(0,D.jsx)(`span`,{"data-slot":`activity-age`,className:`ml-auto font-medium tracking-normal text-muted-foreground normal-case tabular-nums`,children:M(P(e.since,t))}):null]}),(0,D.jsx)(`span`,{"data-slot":`activity-main`,className:i(`col-start-2 truncate text-[12.5px] text-foreground`,e.mono&&`font-mono text-[12px]`,r.slideKey!==void 0&&`activity-slide`),children:e.main},r.slideKey??`still`),e.checks?(0,D.jsx)(vn,{checks:e.checks,overflow:e.overflow,passed:r.passed??bn}):null,e.checkSummary?(0,D.jsx)(`span`,{"data-slot":`activity-checks-summary`,className:`sr-only`,children:e.checkSummary}):null,e.bar===void 0?null:(0,D.jsx)(yn,{value:e.bar,ink:o}),e.detail&&!n?(0,D.jsx)(`span`,{"data-slot":`activity-detail`,className:`col-start-2 text-[11.5px] text-muted-foreground tabular-nums`,children:e.detail}):null]})}function Sn({rate:e,className:t}){let n=e.reduce((e,t)=>e+t,0),r=Math.max(4,...e);return(0,D.jsxs)(`svg`,{"data-slot":`activity-heartbeat`,role:`img`,"aria-label":`${n} tool call${n===1?``:`s`} in the last ${e.length} s`,viewBox:`0 0 62 16`,className:i(`block h-4 w-[62px] shrink-0`,t),children:[(0,D.jsx)(`path`,{d:`M0 15.5h62`,className:`stroke-border`}),e.map((e,t)=>{if(e<=0)return null;let n=Math.max(1.5,e/r*14);return(0,D.jsx)(`rect`,{x:t*2.07,y:15-n,width:1.4,height:n,className:`fill-status-running`},t)})]})}var K=e=>`/tasks/${encodeURIComponent(e)}`;function Cn(e,t){return[e.runner,e.model,e.currentStepId?`step ${e.currentStepId}`:void 0,e.startedAt?N(P(e.startedAt,t)):void 0].filter(e=>!!e).join(` · `)}function wn({texts:e}){return e.length===0?null:(0,D.jsx)(`ul`,{"data-slot":`activity-line-text`,className:`sr-only`,children:e.map((e,t)=>(0,D.jsx)(`li`,{children:e},t))})}function Tn({worker:e,parentId:t,requests:n,index:r,ctx:a,motion:o}){let s=Tt(e,a,Ft(e.runId,t,n)?.text),c=o.workerHold[e.runId];return(0,D.jsxs)(`li`,{"data-slot":`activity-worker`,"data-run":e.runId,"data-asks":s.asks?`true`:void 0,"data-hold":c?.phase,className:i(`relative grid grid-cols-[14px_minmax(0,1fr)] items-start gap-x-2 rounded-lg py-[5px] before:absolute before:top-[13px] before:-left-3.5 before:w-2.5 before:border-t before:border-border`,s.asks&&`-mx-1.5 bg-message-inbound-bg px-1.5`,e.runId in o.workerEnter&&`activity-row-enter`,c?.phase===`fold`&&`activity-row-fold`),children:[c?(0,D.jsx)(`span`,{"aria-hidden":`true`,className:i(`activity-row-flash`,ln[c.tone])},c.key):null,(0,D.jsx)(`span`,{className:`mt-[3px]`,children:(0,D.jsx)(G,{run:e,role:`worker`})}),(0,D.jsxs)(`span`,{className:`min-w-0 truncate text-[12.5px] font-medium`,children:[(0,D.jsx)(C,{to:K(e.runId),className:`relative z-[1] hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:e.title}),(0,D.jsx)(`span`,{className:`ml-1.5 text-[11px] font-normal text-muted-foreground`,children:[e.runner,e.model].filter(Boolean).join(` · `)})]}),(0,D.jsxs)(`span`,{"data-slot":`activity-worker-line`,className:`col-start-2 truncate text-[11.5px] text-muted-foreground tabular-nums`,children:[(0,D.jsx)(`b`,{className:i(`font-semibold`,on[s.tone]),children:s.verb}),` · `,(0,D.jsx)(`span`,{className:i(s.mono&&`font-mono`),children:s.main})]}),(0,D.jsx)(wn,{texts:Pt(e.runId,n,r)})]})}function En({workers:e}){return(0,D.jsxs)(`div`,{"data-slot":`activity-worker-dots`,className:`mt-2 ml-[18px] flex flex-wrap items-center gap-1 text-[11px] text-muted-foreground`,children:[e.map(e=>(0,D.jsx)(G,{run:e,role:`worker`},e.runId)),(0,D.jsxs)(`span`,{className:`ml-1`,children:[e.length,` worker`,e.length===1?``:`s`]})]})}function Dn({task:e,requests:t,index:n,ctx:r,dense:i,motion:a}){let o=e=>e in a.workerHold,s=e.workers.filter(e=>I(e.status)||e.status===`review`||o(e.runId)),c=Kt(Gt(e,o));return(0,D.jsxs)(D.Fragment,{children:[s.length>0&&i?(0,D.jsx)(En,{workers:s}):null,s.length>0&&!i?(0,D.jsx)(`ul`,{"data-slot":`activity-workers`,className:`mt-2 ml-1 border-l border-border pl-3.5`,children:s.map(i=>(0,D.jsx)(Tn,{worker:i,parentId:e.runId,requests:t,index:n,ctx:r,motion:a},i.runId))}):null,c?(0,D.jsx)(`p`,{"data-slot":`activity-finished`,className:`mt-1.5 ml-[18px] text-[11px] text-muted-foreground`,children:c}):null]})}var On=`relative z-[1] text-[12px] text-message-peer-accent hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`;function kn(e,t){return t?{onPointerEnter:()=>t(`pointer`,e),onPointerLeave:()=>t(`pointer`,void 0),onFocus:()=>t(`focus`,e),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||t(`focus`,void 0)}}:{}}function An(e,t,n){return n?`activity-card-leave`:e.runId in t.entering?`activity-card-enter`:void 0}function jn({task:e,motion:t,glow:n}){let r=t.flash[e.runId];return(0,D.jsxs)(D.Fragment,{children:[n?(0,D.jsx)(`span`,{"aria-hidden":`true`,className:`activity-glow`}):null,r?(0,D.jsx)(`span`,{"data-slot":`activity-flash`,"data-tone":r.tone,"aria-hidden":`true`,className:i(`activity-flash`,cn[r.tone])},r.key):null]})}var Mn=[];function Nn({task:e,requests:t,waits:n=Mn,index:a,ctx:o,dense:s,narrow:c,motion:l=W,ghost:u=!1,linked:d=!1,onHover:f}){let p=Ct(e,o),m=u?{"data-activity-ghost":e.runId,inert:!0,"aria-hidden":!0}:{"data-activity-card":e.runId},ee={sweep:e.rung===`running`&&I(e.status),slideKey:l.slides[e.runId]?.key,passed:Jt(l,e.runId)};return(0,D.jsxs)(`article`,{...m,"data-flip":e.runId,"data-rung":e.rung,"data-linked":d&&!u?`true`:void 0,...u?{}:kn(e.runId,f),className:i(`relative min-w-0 rounded-xl border bg-card px-3.5 py-3`,p.action?`border-pending`:`border-border`,d&&!u&&`outline-2 outline-offset-2 outline-message-peer-accent`,An(e,l,u)),children:[(0,D.jsx)(jn,{task:e,motion:l,glow:p.action!==void 0&&!u}),(0,D.jsxs)(`header`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(G,{run:e,role:`root`}),(0,D.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[13.5px] font-semibold`,children:(0,D.jsx)(C,{to:K(e.runId),className:`after:absolute after:inset-0 after:rounded-xl after:content-[''] focus-visible:outline-2 focus-visible:outline-ring`,children:e.title})}),(0,D.jsx)(Sn,{rate:e.rate})]}),(0,D.jsx)(`p`,{className:`mt-0.5 mb-2 ml-5 truncate text-[11.5px] text-muted-foreground`,children:Cn(e,o.now)}),(0,D.jsx)(wn,{texts:Pt(e.runId,t,a,n)}),(0,D.jsx)(xn,{box:p,now:o.now,dense:s,motion:ee}),p.action?(0,D.jsx)(`div`,{className:`mt-2 flex gap-1.5`,children:(0,D.jsx)(r,{asChild:!0,size:`sm`,variant:p.action===`answer`?`primary`:`outline`,className:`relative z-[1] max-md:min-h-11`,children:(0,D.jsx)(C,{to:K(e.runId),children:p.action===`answer`?`Answer`:`Open task`})})}):null,c?(0,D.jsx)(hn,{runId:e.runId,requests:t,waits:n,index:a,link:C,pathOf:K,className:`mt-2 flex flex-col gap-1`,linkClassName:On}):null,(0,D.jsx)(Dn,{task:e,requests:t,index:a,ctx:o,dense:s,motion:l})]})}function Pn(e){return!Number.isFinite(e)||e<=0?1:Math.max(1,Math.floor((e+96)/396))}function Fn(e,t){let n=e[0],r=1/0;for(let i of e){let e=i.reduce((e,n)=>e+t(n),0);e<r&&(n=i,r=e)}return n}function In(e,t,n,r=()=>1){let i=Math.max(1,Math.floor(n)),a=new Set(t),o=e?.length===i?e.map(e=>e.filter(e=>a.has(e))):Array.from({length:i},()=>[]),s=new Set(o.flat());for(let e of t)s.has(e)||(Fn(o,r).push(e),s.add(e));return o}function Ln(e,t){return e!==void 0&&e.length===t.length&&e.every((e,n)=>e.length===t[n]?.length&&e.every((e,r)=>e===t[n]?.[r]))}var Rn=(e,t)=>({x0:Math.min(e.x,t.x),y0:Math.min(e.y,t.y),x1:Math.max(e.x,t.x),y1:Math.max(e.y,t.y)});function zn(e,t,n=1){return t.some(t=>t.x+n<e.x1&&e.x0<t.x+t.w-n&&t.y+n<e.y1&&e.y0<t.y+t.h-n)}var Bn=(e,...t)=>e.filter(e=>!t.some(t=>Vn(e,t))),Vn=(e,t)=>e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h,Hn=e=>Math.round(e*10)/10,q=e=>`${Hn(e.x)} ${Hn(e.y)}`;function Un(e){let t=[];for(let n of e){let e=t[t.length-1];if(e&&e.x===n.x&&e.y===n.y)continue;let r=t[t.length-2];r&&e&&(r.x===e.x&&e.x===n.x||r.y===e.y&&e.y===n.y)&&t.pop(),t.push(n)}return t}function Wn(e,t=8){let n=Un(e),r=n[0];if(!r)return``;let i=`M${q(r)}`;for(let e=1;e<n.length;e++){let r=n[e],a=n[e-1],o=n[e+1];if(!o){i+=` L ${q(r)}`;continue}let s=Math.min(t,Math.hypot(r.x-a.x,r.y-a.y)/2,Math.hypot(o.x-r.x,o.y-r.y)/2),c=(e,t,n)=>{let r=Math.hypot(t.x-e.x,t.y-e.y)||1;return{x:e.x+(t.x-e.x)/r*n,y:e.y+(t.y-e.y)/r*n}};i+=` L ${q(c(r,a,s))} Q ${q(r)}, ${q(c(r,o,s))}`}return i}function Gn(e,t,n){let r=[];for(let i of[...e].sort((e,n)=>t(e)-t(n))){let e=r[r.length-1];e&&Math.abs(t(i)-e.from)<=2?e.to=Math.max(e.to,n(i)):r.push({from:t(i),to:n(i)})}return r}function Kn(e){return{rows:Gn(e,e=>e.y,e=>e.y+e.h).map(({from:e,to:t})=>({top:e,bottom:t})),cols:Gn(e,e=>e.x,e=>e.x+e.w).map(({from:e,to:t})=>({left:e,right:t}))}}var J=(e,t,n)=>Math.max(0,e.findIndex(e=>Math.abs(t(e)-n)<=2)),Y=(e,t)=>((e.rows[t]?.bottom??0)+(e.rows[t+1]?.top??(e.rows[t]?.bottom??0)+16))/2;function qn(e,t,n){let r=e.cols,i=e=>((r[e]?.right??0)+(r[e+1]?.left??0))/2;return t<n?i(t):t>n?i(t-1):t+1<r.length?i(t):t>0?i(t-1):(r[t]?.right??0)+8}function Jn(e,t,n,r=0){let i=Kn(n),a=J(i.rows,e=>e.top,e.y),o=J(i.rows,e=>e.top,t.y),s=o>a,c=e.x+e.w/2+r,l=t.x+t.w/2+r,u=(s?Y(i,a):Y(i,a-1))+r/2,d=(s?Y(i,o-1):Y(i,o))+r/2,f=qn(i,J(i.cols,e=>e.left,e.x),J(i.cols,e=>e.left,t.x))+r/2,p={x:c,y:s?e.y+e.h+1:e.y-1},m={x:l,y:s?t.y-3:t.y+t.h+3};return{points:[p,{x:c,y:u},{x:f,y:u},{x:f,y:d},{x:l,y:d},m],label:{x:(c+f)/2,y:u}}}var Yn=15;function Xn(e,t,n){let r=[...n,...e.flatMap(e=>[e.y-Yn,e.y+e.h+Yn])].filter(t=>t>=0&&!e.some(e=>e.y-6<t&&t<e.y+e.h+6));return r.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e,r[0]??t)}function Zn(e,t,n,r,i=0){let a=t.x>e.x?1:-1,o=e.x+a*n/2+i,s=t.x-a*n/2+i,c=Xn(r.filter(e=>e.x+e.w>Math.min(o,s)&&e.x<Math.max(o,s)),(e.y+t.y)/2,[e.y,t.y])+(i===0?0:Math.sign(i)*Math.min(Math.abs(i),Yn-6)),l=c===e.y?{x:s,y:(c+t.y)/2}:{x:o,y:(e.y+c)/2};return{points:[e,{x:o,y:e.y},{x:o,y:c},{x:s,y:c},{x:s,y:t.y},{x:t.x-a*2,y:t.y}],label:l}}function Qn(e){let t=new Map;for(let n of e){let e=[n.senderRunId,n.recipientRunId].sort().join(`
|
|
2
|
-
`);t.set(e,[...t.get(e)??[],n.requestId])}let n=new Map;for(let e of t.values())e.forEach((t,r)=>n.set(t,(r-(e.length-1)/2)*12));return n}function $n(e,t,n,r=4){let i=[],a=new Map;for(let{id:o,at:s}of e){let e={...s};for(let a=0;a<=i.length;a++){let a=i.find(n=>Math.abs(e.x-n.x)<t.w+r&&Math.abs(e.y-n.y)<t.h+r);if(!a)break;n===`x`?e.x=a.x+t.w+r:e.y=a.y+t.h+r}i.push(e),a.set(o,e)}return a}var er=e=>Math.round(e*10)/10,X=e=>`${er(e.x)} ${er(e.y)}`;function tr(e,t,n){return t&&t.x>e.x+40?1:t&&t.x<e.x-40?-1:e.x+e.w+96<=n+1?1:-1}function nr(e,t,n,r,i,a){let o=r>0?Math.max(e.x+e.w,t.x+t.w):Math.min(e.x,t.x),s=(70+n)*r;return{d:`M${X({x:o,y:i})} C ${X({x:o+s,y:i})}, ${X({x:o+s,y:a})}, ${X({x:o+2*r,y:a})}`,label:{x:o+s*.75,y:(i+a)/2}}}function rr(e,t,n=[],r=0,i=1){let a=e.y+22+r,o=t.y+22+r;if(Math.abs(e.x-t.x)<40)return nr(e,t,r,i,a,o);let s=t.x>e.x,c=s?e.x+e.w:e.x,l=s?t.x:t.x+t.w,u=Math.max(40,Math.abs(l-c)*.5)*(s?1:-1),d=l-(s?2:-2);if(zn(Rn({x:c,y:a},{x:l,y:o}),Bn(n,e,t))){let i=Zn({x:c,y:a},{x:l,y:o},96,Bn(n,e,t),r);return{d:Wn(i.points),label:i.label}}return{d:`M${X({x:c,y:a})} C ${X({x:c+u,y:a})}, ${X({x:l-u,y:o})}, ${X({x:d,y:o})}`,label:{x:(c+l)/2,y:(a+o)/2}}}function ir(e,{other:t,view:n,labelHeight:r}){let i=r/2+4,a=!t||!n?e+44:t.y>e?Math.max(e+44,n.y1-i):Math.min(e-44,n.y0+i);return n?ar(a,n.y0+i,n.y1-i):a}var ar=(e,t,n)=>Math.max(t,Math.min(n,e));function or(e,t,n){let r=n.lane??0,i=e.y+22+r,a=n.side>0?e.x+e.w:e.x,o=a+n.side*96/2+r/2,s={x:o,y:ir(i,n)};return{d:Wn(t===`sender`?[{x:a,y:i},{x:o,y:i},s]:[s,{x:o,y:i},{x:a+2*n.side,y:i}]),label:s}}function sr(e,t,n,r=0){let i={x:e.x,y:e.y+e.h/2},a={x:t.x-2,y:t.y+t.h/2},o=n.x-18+r/2;return{d:`M${X(i)} C ${X({x:o,y:i.y})}, ${X({x:o,y:a.y})}, ${X(a)}`,label:{x:o,y:(i.y+a.y)/2}}}function cr(e,t,n=[],r=0){let i=e.x+e.w/2+r,a=t.x+t.w/2+r;if(t.y>=e.y+e.h||t.y+t.h<=e.y){let o=t.y>e.y,s=o?e.y+e.h+1:e.y-1,c=o?t.y-3:t.y+t.h+3,l=(c-s)/2;if(zn(Rn({x:i,y:s},{x:a,y:c}),Bn(n,e,t))){let i=Jn(e,t,n,r);return{d:Wn(i.points),label:i.label}}return{d:`M${X({x:i,y:s})} C ${X({x:i,y:s+l})}, ${X({x:a,y:c-l})}, ${X({x:a,y:c})}`,label:{x:(i+a)/2,y:(s+c)/2}}}let o=e.y-1,s=t.y-1,c=Math.min(o,s),l=Math.max(8,Math.min(30,18+Math.abs(a-i)*.05)+r);return{d:`M${X({x:i,y:o})} C ${X({x:i,y:c-l})}, ${X({x:a,y:c-l})}, ${X({x:a,y:s-3})}`,label:{x:(i+a)/2,y:c-l*.75}}}function lr(e,t){return{x:e.left-t.left,y:e.top-t.top,w:e.width,h:e.height}}function ur(e,t){let n=[];for(let r of e){let e=n.find(e=>Math.abs((e[0]?.at.x??NaN)-r.at.x)<t);e?e.push(r):n.push([r])}return n}function dr(e,t,n,r){let i=e.map(e=>Math.min(r,Math.max(n,e.at.y))),a=i.map((e,t)=>t).sort((e,t)=>i[e]-i[t]);for(let e=1;e<a.length;e++){let n=a[e];i[n]=Math.max(i[n],i[a[e-1]]+t)}for(let e=a.length-1;e>=0;e--){let n=a[e],o=e+1<a.length?i[a[e+1]]-t:r;i[n]=Math.min(i[n],o)}return e.map((e,t)=>({id:e.id,at:{x:e.at.x,y:i[t]}}))}function fr(e,t,n,r=4){let i=n?n.y0+t.h/2:-1/0,a=n?n.y1-t.h/2:1/0,o=new Map;for(let n of ur(e,t.w+r))for(let e of dr(n,t.h+r,i,a))o.set(e.id,e.at);return o}var pr=(e,t)=>e.x<=t.x1&&t.x0<=e.x+e.w&&e.y<=t.y1&&t.y0<=e.y+e.h;function mr(e,t,n){let r=e!==void 0&&pr(e,n),i=t!==void 0&&pr(t,n);return r&&i?`both`:r?`sender`:i?`recipient`:`none`}var hr=e=>/(auto|scroll|hidden|clip)/.test(getComputedStyle(e).overflowY);function gr(e){let t=[];for(let n=e.parentElement;n&&n!==document.body&&n!==document.documentElement;n=n.parentElement)hr(n)&&t.push(n);return t}function _r(e,t){return{x0:Math.max(e.x0,t.x0),y0:Math.max(e.y0,t.y0),x1:Math.min(e.x1,t.x1),y1:Math.min(e.y1,t.y1)}}function vr(e){let t=e.getBoundingClientRect(),n={x0:0,y0:0,x1:window.innerWidth,y1:window.innerHeight};for(let t of gr(e)){let e=t.getBoundingClientRect();e.width>0&&e.height>0&&(n=_r(n,{x0:e.left,y0:e.top,x1:e.right,y1:e.bottom}))}return{x0:n.x0-t.left,y0:n.y0-t.top,x1:n.x1-t.left,y1:n.y1-t.top}}var Z={w:88,h:40};function yr(e,t){let n=e.getBoundingClientRect(),r=new Map;for(let i of e.querySelectorAll(`[${t}]`)){let e=i.getAttribute(t);e&&r.set(e,lr(i.getBoundingClientRect(),n))}return r}function br({base:e,from:t,to:n,fromName:r,toName:i},a,o,s){let c=a.get(t),l=a.get(n),u=s.view??{x0:-1/0,y0:-1/0,x1:1/0,y1:1/0},d=(e,t)=>({side:tr(e,t,s.width),labelHeight:Z.h,lane:o??0,view:u,...t?{other:t}:{}});switch(mr(c,l,u)){case`both`:return c&&l?{...e,...rr(c,l,[...a.values()],o,tr(c,void 0,s.width))}:void 0;case`sender`:return c?{...e,...or(c,`sender`,d(c,l)),away:i()}:void 0;case`recipient`:return l?{...e,...or(l,`recipient`,d(l,c)),away:r()}:void 0;case`none`:return}}var xr=(e,t)=>({base:{id:e.requestId,kind:`peer`},from:e.senderRunId,to:e.recipientRunId,fromName:()=>kt(t,e),toName:()=>H(t,e)}),Sr=(e,t)=>({base:{id:e.id,kind:`wait`},from:e.peerRunId,to:e.waiterRunId,fromName:()=>V(t,e.peerRunId),toName:()=>V(t,e.waiterRunId)}),Cr=e=>({requestId:e.id,senderRunId:e.peerRunId,recipientRunId:e.waiterRunId});function wr(e,t){return[...new Set([...e.values()].map(e=>Math.round(e.x+e.w)))].filter(e=>e+96<=t+1).map(e=>e+96/2)}function Tr(e,t){return t.length===0?e:{x:t.reduce((t,n)=>Math.abs(n-e.x)<Math.abs(t-e.x)?n:t),y:e.y}}function Er(e,t,n,r,i,a){let o=r.get(e.senderRunId)?.cardId??r.get(e.recipientRunId)?.cardId,s=o===void 0?void 0:t.get(o),c=n.get(e.senderRunId),l=n.get(e.recipientRunId);if(!(!s||!c||!l||a&&!pr(s,a)))return{id:e.requestId,kind:`family`,...sr(c,l,s,i)}}function Dr(e,t,n,{peers:r,frame:i={width:e.clientWidth},waits:a=[]}){let o=yr(e,`data-activity-card`),s=yr(e,`data-activity-anchor`),c=Qn([...t,...a.map(Cr)]),l=[];for(let e of t){let t=c.get(e.requestId),a=e.relationship===`peer`?r?br(xr(e,n),o,t,i):void 0:Er(e,o,s,n,t,i.view);a&&l.push(a)}for(let e of r?a:[]){let t=br(Sr(e,n),o,c.get(e.id),i);t&&l.push(t)}let u=wr(o,i.width),d=fr(l.filter(e=>e.kind!==`family`).map(e=>({id:e.id,at:Tr(e.label,u)})),Z,i.view);return l.map(e=>({...e,label:d.get(e.id)??e.label}))}function Or(e,t){return e.length===t.length&&e.every((e,n)=>{let r=t[n];return r!==void 0&&e.id===r.id&&e.d===r.d&&e.away===r.away&&e.label.x===r.label.x&&e.label.y===r.label.y})}function kr({frame:e,cancel:t,draw:n}){let r=[],i,a=t=>{i=void 0,r=r.map(e=>({...e,start:e.start??t})).filter(e=>t<e.start+e.duration),n(r,t),r.length>0&&(i=e(a))};return{launch(t){r.some(e=>e.id===t.id)||(r.push(t),i===void 0&&(i=e(a)))},stop(){i!==void 0&&t(i),i=void 0,r=[],n([],0)},running:()=>i!==void 0}}var Ar=e=>e<.5?2*e*e:1-(-2*e+2)**2/2;function jr(e,t,n=0){let r=Math.min(1,Math.max(0,(t-e.start)/e.duration)),i=Math.max(0,Ar(r)-n);return e.reverse?1-i:i}var Mr=`http://www.w3.org/2000/svg`,Nr=[0,.03,.06,.09,.12],Pr=[4.5,3.5,3,2.5,2],Fr={peer:`fill-message-peer-accent`,family:`fill-message-inbound-accent`,success:`fill-success`};function Ir(e,t){let n=e.querySelector(`g[data-comet="${CSS.escape(t.id)}"]`);if(n)return n;let r=document.createElementNS(Mr,`g`);r.setAttribute(`data-comet`,t.id);let i=document.createElementNS(Mr,`circle`);return i.setAttribute(`r`,`9`),i.setAttribute(`class`,`${Fr[t.tone]} opacity-35`),r.append(i),Nr.forEach((e,n)=>{let i=document.createElementNS(Mr,`circle`);i.setAttribute(`r`,String(Pr[n])),i.setAttribute(`class`,n===0?`fill-foreground`:Fr[t.tone]),i.setAttribute(`opacity`,String(1-n*.15)),r.append(i)}),e.append(r),r}function Lr(e,t,n){let r=new Set(t.map(e=>e.id));for(let t of e.querySelectorAll(`g[data-comet]`))r.has(t.getAttribute(`data-comet`)??``)||t.remove();let i=e.ownerSVGElement;for(let r of t){let t=i?.querySelector(`path[data-request="${CSS.escape(r.requestId)}"]`);if(!t||typeof t.getTotalLength!=`function`)continue;let a=t.getTotalLength();Ir(e,r).querySelectorAll(`circle`).forEach((e,i)=>{let o=t.getPointAtLength(jr(r,n,Nr[Math.max(0,i-1)])*a);e.setAttribute(`transform`,`translate(${o.x} ${o.y})`)})}}var Rr=e=>typeof requestAnimationFrame==`function`?requestAnimationFrame(e):setTimeout(()=>e(performance.now()),16),zr=e=>typeof cancelAnimationFrame==`function`?cancelAnimationFrame(e):clearTimeout(e);function Br(e,t,n){let r=E.useRef(null),i=E.useRef(void 0),a=E.useRef(new Set);return E.useEffect(()=>{let e=r.current;if(!e)return;let t=kr({frame:Rr,cancel:zr,draw:(t,n)=>Lr(e,t,n)});return i.current=t,()=>{t.stop(),i.current=void 0}},[]),E.useEffect(()=>{if(n){i.current?.stop();return}for(let t of a.current)t in e||a.current.delete(t);for(let[n,r]of Object.entries(e))a.current.has(n)||!t.has(r.requestId)||(a.current.add(n),i.current?.launch({id:n,requestId:r.requestId,reverse:r.reverse,tone:r.tone,duration:U.comet}))},[e,t,n]),r}function Vr(e,t){let n=new Map;for(let[r,i]of t){let t=e.get(r);if(!t)continue;let a={x:t.x-i.x,y:t.y-i.y};(Math.abs(a.x)>=1||Math.abs(a.y)>=1)&&n.set(r,a)}return n}function Hr(e,t){let n=new Map;for(let r of e.querySelectorAll(`[${t}]`)){let e=r.getBoundingClientRect();n.set(r.getAttribute(t)??``,{el:r,at:{x:e.left,y:e.top}})}return n}var Ur=`activity-layout-settled`;function Wr(e,t,n,r){let i=E.useRef(void 0),a=E.useRef(new Set);E.useLayoutEffect(()=>{let o=e.current;if(!o)return;let s=Hr(o,t),c=new Map([...s].map(([e,t])=>[e,t.at])),l=i.current;if(i.current={key:n,at:c},!(!r||!l||l.key===n))for(let[e,t]of Vr(l.at,c)){let n=s.get(e)?.el.animate?.([{transform:`translate(${t.x}px, ${t.y}px)`},{transform:`none`}],{duration:400,easing:`cubic-bezier(0.2, 0, 0, 1)`});n&&Gr(n,a.current,o)}}),E.useEffect(()=>{if(!r)for(let e of[...a.current])e.cancel()},[r])}function Gr(e,t,n){t.add(e);let r=()=>{t.delete(e)&&t.size===0&&n.dispatchEvent(new Event(Ur))};e.addEventListener(`finish`,r),e.addEventListener(`cancel`,r)}function Kr(e,t,n,r,i,a=!1){let[o,s]=E.useState([]);return E.useLayoutEffect(()=>{let i=e.current?.parentElement;if(!i)return;let o=()=>{let e=t(i);s(t=>n(t,e)?t:e)};o();let c=a?qr(i,o):void 0;i.addEventListener(Ur,o);let l=typeof ResizeObserver>`u`?void 0:new ResizeObserver(o);l?.observe(i);for(let e of i.querySelectorAll(r))l?.observe(e);return()=>{l?.disconnect(),i.removeEventListener(Ur,o),c?.()}},[e,t,n,r,i,a]),o}function qr(e,t){let n,r=()=>{n===void 0&&(n=requestAnimationFrame(()=>{n=void 0,t()}))},i=[...gr(e),window];for(let e of i)e.addEventListener(`scroll`,r,{passive:!0});return window.addEventListener(`resize`,r),()=>{for(let e of i)e.removeEventListener(`scroll`,r);window.removeEventListener(`resize`,r),n!==void 0&&cancelAnimationFrame(n)}}var Jr=28;function Yr(e){let t=e.replace(/\s+/g,` `).trim();return t.length>Jr?`${t.slice(0,Jr-1).trimEnd()}…`:t}function Xr(e,t){if(e.deadline!==void 0)return Zr(e.createdAt,e.deadline,t)}function Zr(e,t,n){let r=Date.parse(e),i=Date.parse(t);return Number.isNaN(r)||Number.isNaN(i)||i<=r?1:Math.min(1,Math.max(0,(n-r)/(i-r)))}function Qr(e,t){if(e===`fade`)return`activity-line-out`;if(e!==`replied`)return i(`activity-march`,t&&`activity-line-in`)}function $r(e,t){return t in e.waitsClosing?`activity-line-out`:i(`activity-drift`,t in e.opening&&`activity-line-in`)}var ei=`pointer-events-none absolute z-[4] -translate-x-1/2 -translate-y-1/2 rounded-lg border bg-background px-1.5 py-[3px] text-[10px] leading-[1.3] text-foreground tabular-nums`;function ti({line:e,wait:t,now:n,motion:r}){return(0,D.jsxs)(`div`,{"data-slot":`activity-line-label`,"data-wait":t.id,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y,width:Z.w},className:i(ei,`border-dashed border-message-peer-accent`,t.id in r.waitsClosing&&`activity-line-out`),children:[(0,D.jsxs)(`span`,{className:`flex gap-1 font-semibold`,children:[(0,D.jsx)(`span`,{className:`min-w-0 truncate text-message-peer-accent`,children:`Waiting`}),(0,D.jsx)(`span`,{className:`ml-auto shrink-0`,children:M(P(t.since,n))})]}),e.away?(0,D.jsx)(`span`,{className:`block truncate`,children:e.away}):null,(0,D.jsx)(`span`,{"data-slot":`activity-wait-bar`,className:`mt-[3px] block h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,D.jsx)(`span`,{className:`block h-full bg-message-peer-accent opacity-70`,style:{width:`${Math.round(Zr(t.since,t.deadline,n)*100)}%`}})})]})}function ni({line:e,request:t,now:n,phase:r,replied:a}){let o=Xr(t,n);return(0,D.jsxs)(`div`,{"data-slot":`activity-line-label`,"data-request":t.requestId,"data-phase":r,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y,width:Z.w},className:i(ei,a?`border-success`:`border-message-peer-accent`,r===`fade`&&`activity-line-out`),children:[(0,D.jsxs)(`span`,{className:`flex gap-1 font-semibold`,children:[a?(0,D.jsx)(`span`,{className:`text-success`,children:`Replied`}):(0,D.jsx)(`span`,{className:`min-w-0 truncate text-message-peer-accent`,children:`Request`}),(0,D.jsx)(`span`,{className:`ml-auto shrink-0`,children:M(P(t.createdAt,n))})]}),(0,D.jsx)(`span`,{className:`block truncate`,children:e.away??Yr(t.text)}),o===void 0||a?null:(0,D.jsx)(`span`,{className:`mt-[3px] block h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,D.jsx)(`span`,{className:`block h-full bg-message-peer-accent`,style:{width:`${Math.round(o*100)}%`}})})]})}var ri=(e,t)=>e.closing[t]?.phase??`open`;function ii(e,t){let n=e.closing[t];return n!==void 0&&n.replied&&n.phase!==`reply`}var ai=new Set;function oi({line:e,motion:t}){let n=ri(t,e.id);return(0,D.jsx)(`path`,{"data-request":e.id,"data-kind":e.kind,"data-phase":n,d:e.d,fill:`none`,strokeDasharray:n===`replied`?void 0:`6 5`,strokeWidth:e.kind===`peer`?2.2:1.8,markerEnd:`url(#activity-arrow-${e.kind})`,className:i(e.kind===`peer`?`stroke-message-peer-accent`:`stroke-message-inbound-accent`,Qr(n,e.id in t.opening))})}function si({line:e,motion:t,active:n}){return(0,D.jsx)(`path`,{"data-wait":e.id,"data-kind":`wait`,"data-active":n?`true`:void 0,d:e.d,fill:`none`,strokeDasharray:`0 8`,strokeLinecap:`round`,strokeWidth:n?3.2:2.4,markerEnd:`url(#activity-ring-wait)`,className:i(`stroke-message-peer-accent`,n?`opacity-100`:`opacity-80`,$r(t,e.id))})}function ci({id:e}){return(0,D.jsx)(`marker`,{id:e,viewBox:`0 0 12 12`,refX:`10`,refY:`6`,markerWidth:`5`,markerHeight:`5`,markerUnits:`strokeWidth`,orient:`auto`,children:(0,D.jsx)(`circle`,{cx:`6`,cy:`6`,r:`4`,strokeWidth:`2.4`,className:`fill-background stroke-message-peer-accent`})})}var li=[];function ui({requests:e,waits:t=li,active:n=ai,index:r,peers:i,layoutKey:a,now:o,motion:s=W,paused:c=!1}){let l=E.useRef(null),u=Kr(l,E.useCallback(n=>Dr(n,e,r,{peers:i,waits:t,frame:{width:n.clientWidth,view:vr(n)}}),[e,t,r,i]),Or,`[data-activity-card]`,a,!0),d=E.useMemo(()=>new Set(u.map(e=>e.id)),[u]),f=Br(s.comets,d,c),p=new Map(e.map(e=>[e.requestId,e])),m=new Map(t.map(e=>[e.id,e]));return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`svg`,{ref:l,"data-slot":`activity-lines`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 z-[3] size-full overflow-visible`,children:[(0,D.jsxs)(`defs`,{children:[(0,D.jsx)(`marker`,{id:`activity-arrow-peer`,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerWidth:`7`,markerHeight:`7`,orient:`auto`,children:(0,D.jsx)(`path`,{d:`M0 0 10 5 0 10z`,className:`fill-message-peer-accent`})}),(0,D.jsx)(`marker`,{id:`activity-arrow-family`,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerWidth:`6`,markerHeight:`6`,orient:`auto`,children:(0,D.jsx)(`path`,{d:`M0 0 10 5 0 10z`,className:`fill-message-inbound-accent`})}),(0,D.jsx)(ci,{id:`activity-ring-wait`})]}),u.map(e=>e.kind===`wait`?(0,D.jsx)(si,{line:e,motion:s,active:n.has(e.id)},e.id):(0,D.jsx)(oi,{line:e,motion:s},e.id)),(0,D.jsx)(`g`,{ref:f,"data-slot":`activity-comets`})]}),u.map(e=>{let t=e.kind===`wait`?m.get(e.id):void 0;if(t)return(0,D.jsx)(ti,{line:e,wait:t,now:o,motion:s},e.id);let n=p.get(e.id);return e.kind===`peer`&&n?(0,D.jsx)(ni,{line:e,request:n,now:o,phase:ri(s,e.id),replied:ii(s,e.id)},e.id):null})]})}function di(e,t){let n=new Map;for(let r of[...e?.projects??[],...t.projects])for(let[e,t]of Ot(r))n.set(e,t);return n}var fi={"timed-out":`timed out`,cancelled:`was cancelled`,destroyed:`closed: the recipient was destroyed`,failed:`closed: the recipient failed`,"completed-without-reply":`closed without a reply`,"sender-closed":`was closed by its sender`,"human-fallback":`went to a human`,deleted:`closed: the recipient was deleted`};function pi(e,t,n){let r=n(e.senderRunId,e.senderTitle),i=n(e.recipientRunId,e.recipientTitle);return t===`replied`?`${i} replied to ${r}`:`${r}’s request to ${i} ${fi[t??``]??`closed`}`}var mi={done:{tone:`success`,word:`finished`},failed:{tone:`danger`,word:`failed`},cancelled:{tone:`neutral`,word:`was cancelled`},review:{tone:`info`,word:`waits for review`}},hi=e=>e.relationship===`peer`?`peer`:`family`;function gi(e,t,n){let r=(e,n)=>V(t,e,n);switch(e.kind){case`request-opened`:return{tone:hi(e.request),text:`${r(e.request.senderRunId,e.request.senderTitle)} asked ${r(e.request.recipientRunId,e.request.recipientTitle)}`};case`request-closed`:return{tone:e.status===`replied`?`success`:`neutral`,text:pi(e.request,e.status,r)};case`rung-changed`:return{tone:h(e.task.rung).tone,text:`${e.task.title}: ${Ct(e.task,{now:n,titleOf:e=>r(e)}).verb}`};case`worker-started`:return{tone:`running`,text:`${e.worker.title} started`};case`worker-settled`:{let t=mi[e.worker.status]??{tone:`neutral`,word:`settled`};return{tone:t.tone,text:`${e.worker.title} ${t.word}`}}case`card-entered`:return{tone:h(e.task.rung).tone,text:`${e.task.title} started`};case`card-left`:return{tone:`neutral`,text:`${e.task.title} left active work`};case`check-passed`:return{tone:`success`,text:`PR ${e.pr}: check “${e.name}” passed`};default:return}}function _i(e,t,n,r){return[...t.map((e,t)=>({...e,id:r+t,at:n})),...e].slice(0,6)}function vi(e){let t=Math.max(0,Math.floor(e/1e3));return t<5?`now`:t<60?`${t} s`:`${Math.floor(t/60)} min`}var yi=new Set;function bi(e){let[t,n]=E.useState({}),r=t.pointer??t.focus,i=E.useCallback((e,t)=>n(n=>n[e]===t?n:{...n,[e]:t}),[]);return{linked:E.useMemo(()=>r===void 0?yi:Mt(r,e),[r,e]),active:E.useMemo(()=>r===void 0?yi:new Set(e.filter(e=>e.waiterRunId===r||e.peerRunId===r).map(e=>e.id)),[r,e]),onHover:i}}var xi=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}),Si=`inline-flex items-center px-3 py-[5px] text-[12px] font-medium focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring max-md:min-h-11`;function Ci({scope:e,projectId:t}){let r=e=>i(Si,e?`bg-card-2 text-foreground`:`text-muted-foreground hover:text-foreground`);return(0,D.jsxs)(`nav`,{"aria-label":`Activity scope`,"data-slot":`activity-scope`,className:`ml-auto inline-flex overflow-hidden rounded-lg border border-border`,children:[t===null?null:(0,D.jsx)(n,{to:`/p/${encodeURIComponent(t)}/activity`,"aria-current":e===`project`?`page`:void 0,className:r(e===`project`),children:`This project`}),(0,D.jsx)(n,{to:`/activity`,state:{activityProjectId:t},"aria-current":e===`all`?`page`:void 0,className:r(e===`all`),children:`All projects`})]})}function wi({now:e,stale:t}){return(0,D.jsxs)(`span`,{"data-slot":`activity-clock`,"data-stale":t?`true`:void 0,className:`inline-flex items-center gap-1.5 text-[12px] text-muted-foreground tabular-nums`,children:[(0,D.jsx)(`span`,{"data-tone":`success`,className:i(`inline-flex size-[12px] items-center justify-center`,!t&&`activity-pulse`),children:(0,D.jsx)(w,{tone:t?`neutral`:`success`,"aria-hidden":`true`})}),(0,D.jsx)(`b`,{className:i(`font-semibold`,t?`text-muted-foreground`:`text-success`),children:t?`Not updating`:`Live`}),xi.format(e),` `,rt()]})}function Ti({name:e,now:t,stale:n=!1,children:r}){return(0,D.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,D.jsxs)(`h1`,{className:`min-w-0 truncate text-[18px] font-semibold`,children:[`Activity `,(0,D.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`· `,e]})]}),t===void 0?null:(0,D.jsx)(wi,{now:t,stale:n}),r]})}function Ei({value:e,bump:t}){return(0,D.jsx)(`strong`,{"data-bump":t===void 0?void 0:`true`,className:i(`font-semibold text-foreground tabular-nums`,t!==void 0&&`activity-bump`),children:e},t??`still`)}function Q({icon:e,count:t,label:n,bump:r}){return(0,D.jsxs)(`li`,{"data-slot":`activity-chip`,"data-chip":n,className:`inline-flex items-center gap-[7px] rounded-full border border-border bg-card px-[11px] py-[5px] text-[12px] text-muted-foreground`,children:[e,(0,D.jsx)(Ei,{value:t,bump:r}),` `,n]})}function Di({summary:e,tasksTo:t,bumps:n={}}){let r=e=>n[e]?.key;return(0,D.jsxs)(`ul`,{"data-slot":`activity-summary`,"aria-live":`polite`,"aria-label":`Summary`,className:`flex flex-wrap gap-2`,children:[(0,D.jsx)(Q,{icon:(0,D.jsx)(w,{tone:`pending`,"aria-hidden":`true`}),count:e.needsYou,label:`needs you`,bump:r(`needsYou`)}),(0,D.jsx)(Q,{icon:(0,D.jsx)(w,{tone:`running`,"aria-hidden":`true`}),count:e.working,label:`working`,bump:r(`working`)}),(0,D.jsx)(Q,{icon:(0,D.jsx)(w,{tone:`running`,shape:`ring`,"aria-hidden":`true`}),count:e.waiting,label:`waiting`,bump:r(`waiting`)}),(0,D.jsx)(Q,{icon:(0,D.jsx)(w,{tone:`neutral`,shape:`ring`,"aria-hidden":`true`}),count:e.queued,label:`queued`,bump:r(`queued`)}),(0,D.jsx)(Q,{icon:(0,D.jsx)(T,{"aria-hidden":`true`,className:`size-3.5`}),count:e.activeWorkers,label:`active workers`,bump:r(`activeWorkers`)}),(0,D.jsx)(Q,{icon:(0,D.jsx)(be,{"aria-hidden":`true`,className:`size-3.5 text-message-peer-accent`}),count:e.openRequests,label:`open requests`,bump:r(`openRequests`)}),(0,D.jsx)(`li`,{"data-slot":`activity-chip`,"data-chip":`in review`,children:(0,D.jsxs)(C,{to:t,className:`inline-flex items-center gap-[7px] rounded-full border border-border bg-card px-[11px] py-[5px] text-[12px] text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11`,children:[(0,D.jsx)(w,{tone:`info`,"aria-hidden":`true`}),(0,D.jsx)(Ei,{value:e.inReview,bump:r(`inReview`)}),` in review`]})})]})}var $=e=>new Map(e.map(e=>[e.runId,e])),Oi=e=>e!==void 0&&Dt(e)===void 0;function ki(e,t,n,r){let i=$(t.workers);for(let t of n.workers){let a=i.get(t.runId);!a&&I(t.status)&&r({kind:`worker-started`,projectId:e,parentId:n.runId,worker:t}),a&&I(a.status)&&!I(t.status)&&r({kind:`worker-settled`,projectId:e,parentId:n.runId,worker:t})}}function Ai(e,t,n,r){if(t.wait?.kind!==`pr`||n.wait?.kind!==`pr`||t.wait.detail.number!==n.wait.detail.number)return;let i=new Set((t.wait.detail.checks??[]).filter(e=>e.bucket===`pending`).map(e=>e.name));for(let t of n.wait.detail.checks??[])t.bucket===`pass`&&i.has(t.name)&&r({kind:`check-passed`,projectId:e,runId:n.runId,pr:n.wait.detail.number,name:t.name})}var ji=(e,t)=>t.tool!==void 0&&(t.tool.startedAt!==e.tool?.startedAt||t.tool.title!==e.tool?.title);function Mi(e,t,n,r){t.rung!==n.rung&&r({kind:`rung-changed`,projectId:e,task:n,from:t.rung}),ji(t,n)&&r({kind:`tool-started`,projectId:e,runId:n.runId}),ki(e,t,n,r),Ai(e,t,n,r)}function Ni(e,t,n){let r=$(e.tasks),i=$(t.tasks);for(let e of t.tasks){let i=r.get(e.runId);i?Mi(t.projectId,i,e,n):n({kind:`card-entered`,projectId:t.projectId,task:e})}for(let r of e.tasks)i.has(r.runId)||n({kind:`card-left`,projectId:t.projectId,task:r})}function Pi(e,t,n){let r=new Set(e.requests.map(e=>e.requestId)),i=new Set(t.requests.map(e=>e.requestId)),a=new Map(t.closed.map(e=>[e.requestId,e.status]));for(let e of t.requests)r.has(e.requestId)||n({kind:`request-opened`,projectId:t.projectId,request:e});for(let r of e.requests){if(i.has(r.requestId))continue;let e=a.get(r.requestId);n({kind:`request-closed`,projectId:t.projectId,request:r,...e?{status:e}:{}})}}function Fi(e,t,n){let r=jt(e.tasks),i=jt(t.tasks),a=new Set(r.map(e=>e.id)),o=new Set(i.map(e=>e.id));for(let e of i)a.has(e.id)||n({kind:`wait-opened`,projectId:t.projectId,wait:e});for(let e of r)o.has(e.id)||n({kind:`wait-closed`,projectId:t.projectId,wait:e})}var Ii=[`needsYou`,`working`,`waiting`,`queued`,`activeWorkers`,`openRequests`,`inReview`];function Li(e,t,n){let r=Wt(e),i=Wt(t);for(let e of Ii)r[e]!==i[e]&&n({kind:`chip-changed`,chip:e,from:r[e],to:i[e]})}function Ri(e,t){if(e===void 0)return[];let n=[],r=e=>n.push(e),i=new Map(e.projects.map(e=>[e.projectId,e]));for(let e of t.projects){let t=i.get(e.projectId);!Oi(t)||!Oi(e)||(Ni(t,e,r),Pi(t,e,r),Fi(t,e,r))}return Li(e.projects,t.projects,r),n}function zi(e){return{input:e,reconcile:!1,seq:0,motion:W,feed:[],epoch:0,...e.snapshot?{seen:e.snapshot}:{}}}function Bi(e){let{plan:t,...n}=e;return{...n,motion:W,epoch:e.epoch+1}}function Vi(e,t,n){let r=Ri(t,n);if(r.length===0)return e;let i=Date.parse(n.generatedAt),a=di(t,n),o=r.flatMap(e=>gi(e,a,i)??[]),s=e.seq+o.length+1,c=tn(r,s,e.input.reduced);return{...e,seq:s,feed:o.length>0?_i(e.feed,o,i,e.seq+1):e.feed,motion:rn(e.motion,c.changes),...c.timers.length>0?{plan:{key:s,timers:c.timers}}:{}}}function Hi(e,t){let n=e.seen;if(!t||t===n)return e;let r={...e,seen:t};return!n||!e.input.active?r:e.reconcile?{...r,reconcile:!1}:Vi(r,n,t)}function Ui(e,t){let n=e.input;if(t.scope!==n.scope)return{...zi(t),seq:e.seq,epoch:e.epoch+1};if(t.snapshot===n.snapshot&&t.active===n.active&&t.reduced===n.reduced)return e;let r={...e,input:t};return n.active&&!t.active&&(r={...Bi(r),reconcile:!0}),!n.reduced&&t.reduced&&(r=Bi(r)),Hi(r,t.snapshot)}var Wi=`(prefers-reduced-motion: reduce)`,Gi=()=>typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(Wi):void 0;function Ki(e){let t=Gi();return t?.addEventListener?.(`change`,e),()=>t?.removeEventListener?.(`change`,e)}function qi(){return Gi()?.matches??!1}function Ji(){return(0,E.useSyncExternalStore)(Ki,qi,()=>!1)}function Yi(e,t){let n=E.useRef(new Set);E.useEffect(()=>{let e=n.current;return()=>{for(let t of e)clearTimeout(t);e.clear()}},[e.epoch]),E.useEffect(()=>{for(let{after:r,change:i}of e.plan?.timers??[]){let e=setTimeout(()=>{n.current.delete(e),t(e=>({...e,motion:rn(e.motion,[i])}))},r);n.current.add(e)}},[e.plan?.key])}function Xi(e,t){let n=Ji(),r=f(),i={snapshot:e,scope:t,active:r,reduced:n},[a,o]=E.useState(()=>zi(i)),s=Ui(a,i);return s!==a&&o(s),Yi(s,o),{motion:s.motion,feed:s.feed,reduced:n,paused:!r}}function Zi(e,t){let n=xe(1e3),[r,i]=E.useState({offset:0}),a=r.offset;return Xe(e)&&e!==r.generatedAt&&t!==0&&(a=Date.parse(e)-t,i({generatedAt:e,offset:a})),n+a}export{Sn as A,jt as B,Pn as C,jn as D,Nn as E,W as F,kt as G,H,an as I,Ct as J,Wt as K,Rt as L,G as M,ln as N,wn as O,sn as P,tt as Q,Pt as R,$n as S,Ln as T,It as U,Dt as V,Ot as W,M as X,F as Y,P as Z,Br as _,Di as a,lr as b,ui as c,ri as d,ii as f,Wr as g,Kr as h,Ci as i,hn as j,kn as k,ci as l,Xr as m,Xi as n,bi as o,$r as p,I as q,Ti as r,vi as s,Zi as t,Qr as u,Cr as v,In as w,Qn as x,cr as y,V as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,p as n,u as r}from"./button-CS5tOblf.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{Ln as o,Rn as s,Zt as c,it as l}from"./queries-BtScxiQP.js";import{F as u,I as d,N as f,P as p,U as m,_ as h,ct as g,g as _,h as v,m as y,p as b}from"./design-icons-DmYTv2r1.js";import{t as x}from"./createLucideIcon-BHp8sXmF.js";import{n as S,r as C,t as w}from"./popover-N-u5z2xh.js";var T=x(`search-x`,[[`path`,{d:`m13.5 8.5-5 5`,key:`1cs55j`}],[`path`,{d:`m8.5 8.5 5 5`,key:`a8mexj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),E=e(i(),1),D=a(),O=(0,E.createContext)(null);function k({children:e}){let[t,n]=(0,E.useState)(()=>new Map),r=(0,E.useCallback)((e,t)=>{n(n=>{let r=new Map(n);return r.set(e,t),r})},[]),i=(0,E.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),a=l((0,E.useMemo)(()=>[...t.values()].flat(),[t])),o=(0,E.useMemo)(()=>({publish:r,retract:i,lookup:a}),[r,i,a]);return(0,D.jsx)(O.Provider,{value:o,children:e})}var A=(0,E.createContext)(null);function j({projectId:e,repoBase:t,requests:n,children:r}){let i=(0,E.useContext)(O),a=(0,E.useContext)(A),o=(0,E.useId)();(0,E.useEffect)(()=>{if(i)return i.publish(o,n),()=>i.retract(o)},[i,o,n.map(e=>`${e.projectId} ${e.kind}#${e.number}`).sort().join(`|`)]);let s=l(i?M:n),c=i?.lookup??s,u=t??(a&&a.projectId===e?a.repoBase:void 0),d=(0,E.useMemo)(()=>({lookup:c,projectId:e,repoBase:u}),[c,e,u]);return(0,D.jsx)(A.Provider,{value:d,children:r})}var M=[];function N(e,t,n){let r=(0,E.useContext)(A),i=n??r?.projectId;return!r||!i||t===void 0?te:r.lookup({projectId:i,kind:e,number:t})}function ee(e,t){let n=(0,E.useContext)(A),r=t??n?.projectId;return!n||!r?[]:e.filter(e=>n.lookup({projectId:r,kind:`PR`,number:e}).conflicting===!0)}function P(){let e=(0,E.useContext)(A);return{projectId:e?.projectId,repoBase:e?.repoBase}}var te=Object.freeze({state:`idle`}),F={success:`border-success/40 text-success`,danger:`border-danger/40 text-danger`,accent:`border-accent-strong/35 text-accent-text`,merged:`border-merged-strong/35 text-merged-text`,info:`border-info/40 text-info`,neutral:`border-border text-muted-foreground`,pending:`border-pending-strong/45 text-pending-strong`,conflict:`border-conflict/45 text-conflict`},I={success:`text-success`,danger:`text-danger`,accent:`text-merged-text`,merged:`text-merged-text`,info:`text-info`,neutral:`text-soft-foreground`,pending:`text-pending-strong`,conflict:`text-conflict`},ne={success:`hover:bg-success/10`,danger:`hover:bg-danger/10`,accent:`hover:bg-accent-strong/10`,merged:`hover:bg-merged-strong/10`,info:`hover:bg-info/10`,neutral:`hover:bg-muted`,pending:`hover:bg-pending-strong/10`,conflict:`hover:bg-conflict/10`},re={draft:u,"review-required":d,"changes-requested":m,"checks-pending":null,"checks-failing":h,ready:b,merged:f,closed:p,open:y,completed:b,"not-planned":_};function L(e){return e===`PR`?`pr-chip`:`issue-chip`}function R(e){return e?{"data-conflicting":`true`}:{}}function z(e,t,n,r){return!n||r!==void 0&&c({kind:e,number:t??0,url:n},r)}function B(e,t,n){return e===`PR`&&(t??n)===!0}function V({plain:e,inert:t,conflicting:n,className:i,tone:a}){return e?r(`inline-flex items-center gap-1 rounded-[2px] text-inherit`,n&&`text-conflict font-medium`,!t&&`group/reference focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground`,i):r(`inline-flex h-[22px] items-center gap-1 rounded-md border px-1.5 font-mono text-[12px] font-normal`,F[a],i)}function H(e,t,n,r){return n&&!r?t?`${e===`PR`?`PR `:``}#${t}`:e:t?`${!r&&e===`Issue`?`Issue `:``}#${t}`:e}function U(e){return e===`PR`?`pull request`:`issue`}function W(e,t,n,r){return`Open the ${e}${t?` #${t}`:``} for ${n}${r?` — ${r.label}`:``}`}function G(e,t){return e&&t?I[t.tone]:void 0}function K(e,n){return!e&&(!n||!t(n))}function q({conflicting:e,presentation:t,status:n,plain:i,compact:a,inert:o,kind:s,label:c,glyphClass:l}){return(0,D.jsxs)(D.Fragment,{children:[e?(0,D.jsx)(g,{className:r(`size-2.5 shrink-0`,l),"aria-hidden":`true`}):(0,D.jsx)($,{status:t?n:void 0,className:i?r(`size-2.5`,l):void 0}),i&&a?s===`PR`?(0,D.jsx)(d,{"data-slot":`reference-kind`,className:`size-2.5 shrink-0`,"aria-hidden":`true`}):(0,D.jsx)(y,{"data-slot":`reference-kind`,className:`size-2.5 shrink-0`,"aria-hidden":`true`}):null,i?(0,D.jsx)(`span`,{className:o?void 0:`underline-offset-2 group-hover/reference:underline group-focus-visible/reference:underline`,children:c}):c]})}function J({kind:e,status:t,conflicting:n,chipClass:r,body:i}){return(0,D.jsx)(`span`,{"data-slot":L(e),"data-status":t,"data-inert":`true`,...R(n),className:r,children:i})}function Y({kind:e,number:n,tooltip:r,url:i}){return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`span`,{className:`block font-medium`,children:[e===`PR`?`Pull request`:`Issue`,n?` #${n}`:``,` · `,r.headline]}),(0,D.jsx)(`span`,{className:`block`,children:r.detail}),r.also?(0,D.jsx)(`span`,{className:`block opacity-70`,children:r.also}):null,i&&t(i)?(0,D.jsx)(`span`,{className:`block opacity-70`,children:i.replace(/^https?:\/\//,``)}):null]})}function ie({reference:e,taskTitle:t,status:n,conflicting:i,conflictAction:a,projectId:c,repoBase:l,to:u,className:d,compact:f=!1,plain:p=!1,inert:m=!1}){let{kind:h,number:g,url:_}=e,v=P(),y=N(h,z(h,g,_,l??v.repoBase)?g:void 0,c),b=n??y.status,x=s(b),S=B(h,i,y.conflicting),C=S?o:x,w=C?.tone??`accent`,T=V({plain:p,inert:m,conflicting:S,className:d,tone:w}),E=le(y,C,S?x:void 0),O=H(h,g,p,f),k=U(h),A=W(k,g,t,C),j=(0,D.jsx)(q,{conflicting:S,presentation:C,status:b,plain:p,compact:f,inert:m,kind:h,label:O,glyphClass:G(p,C)});if(m)return(0,D.jsx)(J,{kind:h,status:b,conflicting:S,chipClass:T,body:j});let M=K(u,_)?(0,D.jsx)(`span`,{"data-slot":L(h),"data-status":b,...R(S),"aria-label":C?`${k} ${O} — ${C.label}`:void 0,className:T,children:j}):(0,D.jsx)(ae,{to:u,url:_,"data-slot":L(h),"data-status":b,...R(S),title:E?void 0:_,"aria-label":A,className:p?T:r(T,ne[w]),children:j});return E?(0,D.jsx)(ce,{chip:M,action:S?a:void 0,state:y.state,children:(0,D.jsx)(Y,{kind:h,number:g,tooltip:E,url:_})}):M}function ae({to:e,url:t,children:r,...i}){return e?(0,D.jsx)(n,{to:e,...i,children:r}):(0,D.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,...i,children:r})}var X=(0,E.createContext)(()=>{});function oe(){return(0,E.useContext)(X)}var se=150,Z=120;function ce({chip:e,action:t,state:n,children:r}){let[i,a]=(0,E.useState)(!1),o=(0,E.useRef)(null),s=(0,E.useRef)(null),c=(0,E.useRef)(void 0),l=(0,E.useCallback)((e,t)=>{clearTimeout(c.current),c.current=setTimeout(()=>a(e),t)},[]),u=(0,E.useCallback)(()=>{clearTimeout(c.current),a(!1)},[]);(0,E.useEffect)(()=>()=>clearTimeout(c.current),[]);let d=e=>e instanceof Node&&(s.current?.contains(e)||o.current?.contains(e));return(0,D.jsxs)(w,{open:i,onOpenChange:e=>e?a(!0):u(),children:[(0,D.jsx)(S,{asChild:!0,ref:o,onPointerEnter:e=>{e.pointerType!==`touch`&&l(!0,se)},onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,Z)},onFocus:()=>a(!0),onBlur:e=>{d(e.relatedTarget)||u()},onKeyDown:e=>{if(e.key===`Escape`)return u();if(e.key!==`Tab`||e.shiftKey||!t)return;let n=s.current?.querySelector(`button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);n&&(e.preventDefault(),n.focus())},...t?{"aria-haspopup":`dialog`,"aria-expanded":i}:{},children:e}),(0,D.jsxs)(C,{ref:s,side:`top`,role:t?`dialog`:`tooltip`,"data-slot":`reference-status-card`,"data-tooltip-state":n,className:`w-64 space-y-2 p-3 text-xs`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),d(document.activeElement)&&o.current?.focus()},onPointerEnter:()=>clearTimeout(c.current),onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,Z)},children:[(0,D.jsx)(`div`,{className:`space-y-0.5`,children:r}),t?(0,D.jsx)(X.Provider,{value:u,children:t}):null]})]})}function le(e,t,n){if(t){let{label:r,hint:i}=t,a=n?`also ${ue(n.label)} — ${n.hint}`:void 0;return e.state===`unavailable`?{headline:r,detail:`last known — GitHub is unreachable${e.reason?` (${e.reason})`:``}`,...a?{also:a}:{}}:{headline:r,detail:i,...a?{also:a}:{}}}switch(e.state){case`loading`:return{headline:`Checking GitHub…`,detail:`the status of this reference is on its way`};case`unavailable`:return{headline:`Status unavailable`,detail:e.reason??`GitHub could not be reached — the chip says nothing rather than guessing`};case`unknown`:return{headline:`Not found on this repository`,detail:`GitHub has no such number here — the reference may point at another repo`};default:return null}}function ue(e){return e.charAt(0).toLowerCase()+e.slice(1)}function Q({kind:e,number:t,className:n}){let i=N(e,t),a=s(i.status),c=e===`PR`&&i.conflicting===!0,l=c?o:a;if(!l)return null;let u=r(`size-2.5`,I[l.tone]);return(0,D.jsx)(`span`,{"data-slot":`reference-status-glyph`,"data-status":i.status,...c?{"data-conflicting":`true`}:{},"aria-hidden":`true`,className:r(`inline-flex items-center`,n),children:c?(0,D.jsx)(g,{className:r(`shrink-0`,u),"aria-hidden":`true`}):(0,D.jsx)($,{status:i.status,className:u})})}function $({status:e,className:t}){if(!e)return null;if(e===`checks-pending`)return(0,D.jsx)(v,{"data-slot":`status-dot`,"data-tone":`pending`,className:r(`size-3 animate-pulse motion-reduce:animate-none`,t),"aria-hidden":`true`});let n=re[e];return n?(0,D.jsx)(n,{className:r(`size-2.5 shrink-0`,t),"aria-hidden":`true`}):null}var de={general:[`Settings`,`General`],webhooks:[`Settings`,`General`,`Webhooks`],providers:[`Settings`,`Agents`,`Providers`],projects:[`Settings`,`Projects`],worktrees:[`Settings`,`Worktrees`],sidebar:[`Settings`,`Sidebar`]};function fe(e,t=` → `){return de[e].join(t)}export{j as a,P as c,oe as i,N as l,ie as n,k as o,Q as r,ee as s,fe as t,T as u};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-B9kgeZTm.js","assets/rolldown-runtime-QTnfLwEv.js","assets/button-CS5tOblf.js","assets/react-runtime-CCIEwYL0.js","assets/bundle-mjs-BT31bpU6.js","assets/eye-B8okNWXU.js","assets/createLucideIcon-BHp8sXmF.js","assets/index-75IttVLX.js","assets/live-refetch-pzhdhNS_.js","assets/project-scope-context-DSkcNKO7.js","assets/live-protocol-DBPXI6ks.js","assets/useInfiniteQuery-BmfExLUr.js","assets/queries-BtScxiQP.js","assets/useQuery-8pHkglP4.js","assets/ws-CEQH0TUT.js","assets/toaster-CRVRHlMR.js","assets/cez-idle-NomdGTfa.js","assets/design-icons-DmYTv2r1.js","assets/nav-row-styles-CEA9c88Q.js","assets/popover-N-u5z2xh.js","assets/es2015-CX0rgbM5.js","assets/dropdown-menu-D7f0O7xR.js","assets/dist-DvNdR7gM.js","assets/format-BNCkW110.js","assets/play-CmVAj_fu.js","assets/control-locations-DlrUP5vD.js","assets/alert-dialog-h-3h9B4l.js","assets/dialog-Dw7fMdDQ.js","assets/input-DIwJvCgi.js","assets/github-sidebar-model-BdoLA7qT.js","assets/project-router-BFKfAFvq.js","assets/agent-accounts-C6eyz75V.js","assets/skills-DFBiAuJG.js","assets/centered-state-BmsqxbI8.js","assets/chunk-BO2N2NFS-DE6qKn3r.js","assets/lib-BxQXEXDF.js","assets/sortable.esm-zp_qkYGV.js","assets/index-9YmaiQ1k.css","assets/image-preview-Dy3o8upo.js","assets/zoomable-image-UzXCYU7Z.js","assets/markdown-BBDDg-4t.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{u as t}from"./button-CS5tOblf.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{i}from"./bundle-mjs-BT31bpU6.js";import{P as a}from"./index-75IttVLX.js";import{n as o,t as s}from"./image-preview-Dy3o8upo.js";var c=e(n(),1),l=r();function u(e){let[n,r]=(0,c.useState)(null);return(0,c.useEffect)(()=>{let e=!1;return i(()=>import(`./diff-view-B9kgeZTm.js`).then(t=>{e||r({View:t.DiffView})},()=>{e||r(`failed`)}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40])),()=>{e=!0}},[]),e.files.length===0?(0,l.jsx)(`p`,{"data-slot":`diff-empty`,className:t(`px-1 text-xs text-soft-foreground`,e.className),children:`No changes.`}):n===`failed`?(0,l.jsx)(d,{...e}):n===null?(0,l.jsx)(`p`,{"data-slot":`diff-loading`,className:t(`px-1 text-xs text-soft-foreground`,e.className),children:`Loading diff…`}):(0,l.jsx)(n.View,{...e})}function d({files:e,wrap:n=!1,imageSrc:r,onOpenInApp:i,viewRef:o,className:s}){let u={adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length},d=(0,c.useRef)(null);return(0,c.useImperativeHandle)(o,()=>({scrollToPath:e=>{for(let t of d.current?.querySelectorAll(`[data-slot="diff-file"]`)??[])if(t.dataset.path===e){t.scrollIntoView({block:`start`,behavior:`smooth`});return}}})),(0,l.jsxs)(`div`,{ref:d,"data-slot":`diff`,"data-fallback":`true`,className:t(`flex min-w-0 flex-col gap-3`,s),children:[(0,l.jsxs)(`p`,{"data-slot":`diff-totals`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,l.jsxs)(`span`,{children:[u.files,` `,u.files===1?`file`:`files`,` changed`]}),(0,l.jsx)(a,{stat:u})]}),e.map(e=>(0,l.jsx)(f,{file:e,wrap:n,imageSrc:r,onOpenInApp:i},`${e.oldPath??``}→${e.path}`))]})}function f({file:e,wrap:n,imageSrc:r,onOpenInApp:i}){return(0,l.jsxs)(`section`,{"data-slot":`diff-file`,"data-path":e.path,className:`min-w-0 overflow-clip rounded-md border border-border bg-card`,children:[(0,l.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-border/50 px-3 py-2`,children:[(0,l.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?`${e.oldPath} → ${e.path}`:e.path}),(0,l.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,l.jsx)(a,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-[11px]`})})]}),o(e)?(0,l.jsx)(s,{file:e,imageSrc:r,onOpenInApp:i}):e.binary?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.patch===``?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,l.jsx)(`pre`,{className:t(`py-2 font-mono text-xs leading-[1.7]`,n?`break-words whitespace-pre-wrap`:`overflow-x-auto whitespace-pre`),children:e.patch.split(`
|
|
3
|
-
`).map((e,n)=>(0,l.jsxs)(`span`,{className:t(`block px-4`,e.startsWith(`+`)&&!e.startsWith(`+++`)&&`bg-diff-add`,e.startsWith(`-`)&&!e.startsWith(`---`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[e,e===``?` `:``]},n))})]})}export{u as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{E as t,L as n,M as r,t as i,u as a}from"./button-CS5tOblf.js";import{i as o,t as s}from"./react-runtime-CCIEwYL0.js";import"./live-refetch-pzhdhNS_.js";import{$ as c,Bn as l,Kr as u,Q as d,X as f,et as p,ti as m,tn as h}from"./project-scope-context-DSkcNKO7.js";import{An as g,Cn as _,D as v,E as y,N as b,P as ee,Pt as te,Un as x,X as S,j as ne,k as C,l as w,n as T}from"./queries-BtScxiQP.js";import{n as E}from"./toaster-CRVRHlMR.js";import{I as D,L as O,Q as k,Z as A,ct as j,l as M,m as N,r as P,u as F}from"./design-icons-DmYTv2r1.js";import{l as re,n as ie}from"./nav-row-styles-CEA9c88Q.js";import{i as I,r as L,t as R}from"./popover-N-u5z2xh.js";import{a as z,i as B}from"./format-BNCkW110.js";import{_ as ae,a as oe,d as se,f as ce,g as le,i as ue,m as de,n as fe,p as pe,r as me,t as he,u as V}from"./github-sidebar-model-BdoLA7qT.js";import{r as ge,t as H}from"./project-router-BFKfAFvq.js";import{t as U}from"./centered-state-BmsqxbI8.js";import{A as _e,E as ve,M as ye,O as be,j as W}from"./agent-accounts-C6eyz75V.js";import{F as xe,It as Se,R as Ce,Xt as we,hn as Te,it as Ee,mn as De,n as Oe,t as ke}from"./index-75IttVLX.js";import{a as Ae,d as je,f as Me,i as Ne,l as Pe,n as Fe,o as Ie,r as Le,s as Re,t as ze,u as G}from"./use-hand-to-agent-state-BUpbMYM9.js";import{t as K}from"./tab-link-DDpdYMnv.js";var q=e(o(),1),J=`cez-github-list-width`;function Y(e){if(e==null||e===``||typeof e==`string`&&e.trim()===``)return 360;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(520,Math.max(280,Math.round(t))):360}function Be(){try{let e=localStorage.getItem(J);return e===null?360:Y(e)}catch{return 360}}function Ve(e){try{localStorage.setItem(J,String(Y(e)))}catch{}}var X=s();function He({number:e,repo:t}){let n=r();return(0,X.jsx)(Ue,{number:e,repo:t,scope:n},JSON.stringify([n,t,e]))}function Ue({number:e,repo:t,scope:n}){let r=(0,q.useId)(),a=(0,q.useId)(),[o,s]=(0,q.useState)(!1),c=o?Te:De,u=S(n,!0,n==="default"),d=w(`#${e}`,!0),f=(0,q.useMemo)(()=>pe(g(u.data??[],d.data?.pages.flatMap(e=>e.runs)??[]),e,t,n),[u.data,d.data,e,t,n]);return(0,X.jsxs)(`section`,{"aria-labelledby":r,className:`mt-4 min-w-0 rounded-lg border border-border p-3`,children:[(0,X.jsx)(`h3`,{id:r,className:`text-xs font-semibold text-muted-foreground`,children:(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":o,"aria-controls":a,onClick:()=>s(e=>!e),className:`flex min-h-11 w-full items-center gap-2 rounded-md px-2 text-left hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,X.jsx)(c,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,X.jsxs)(`span`,{children:[`Linked tasks`,u.data?` (${f.length}${d.hasNextPage||d.isError?`+`:``})`:``]})]})}),(0,X.jsx)(`div`,{id:a,children:o?(0,X.jsxs)(X.Fragment,{children:[u.isPending?(0,X.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-muted-foreground`,children:`Loading linked tasks…`}):null,u.isError?(0,X.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(`p`,{role:`status`,children:`Couldn’t load linked tasks. Check your connection and try again.`}),(0,X.jsx)(i,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void u.refetch(),disabled:u.isFetching,children:`Retry linked tasks`})]}):null,u.data&&f.length===0&&!u.isError?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`No linked tasks yet.`}):null,f.length>0?(0,X.jsx)(`ul`,{className:`mt-2 flex flex-col gap-1`,children:f.map(e=>{let t=l(e);return(0,X.jsx)(`li`,{children:(0,X.jsxs)(H,{to:`/tasks/${encodeURIComponent(e.id)}`,className:`flex min-h-11 min-w-0 flex-col justify-center gap-1 rounded-md px-2 py-2 hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium break-words [overflow-wrap:anywhere]`,children:_(e)}),(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[(0,X.jsx)(we,{tone:t.tone,shape:t.shape,pulse:t.pulse,role:`img`,"aria-label":t.label,title:t.label}),e.archived?(0,X.jsx)(`span`,{className:`rounded border border-border px-1`,children:`Archived`}):null,(0,X.jsx)(`time`,{dateTime:e.createdAt,children:new Date(e.createdAt).toLocaleDateString()})]})]})},e.id)})}):null,d.isError?(0,X.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(`p`,{role:`status`,children:`Couldn’t load older archived linked tasks.`}),(0,X.jsx)(i,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void d.refetch(),disabled:d.isFetching,children:`Retry older linked tasks`})]}):d.hasNextPage?(0,X.jsx)(i,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void d.fetchNextPage(),disabled:d.isFetchingNextPage,children:d.isFetchingNextPage?`Loading older linked tasks…`:`Show older linked tasks`}):null]}):null})]})}var Z=`w-44 max-w-full`,Q=`min-h-11 min-w-11 rounded-md border border-input bg-card px-3 text-sm text-foreground focus-visible:outline-ring disabled:opacity-50`;function We(e,t){let n=new Map;for(let t of e)for(let e of t.assignees??[])n.set(e.toLowerCase(),e);for(let e of t)n.set(e.toLowerCase(),e);return[...n.values()].sort((e,t)=>e.localeCompare(t))}function Ge(e,t){return!!e&&t.length===1&&t[0]?.toLowerCase()===e.toLowerCase()}function Ke(e){let t=` Previous memberships are shown; issues with unknown membership remain visible.`;return e.projectsState===`refreshing`&&e.projects?`Refreshing project boards.${t}`:e.projectsState===`unavailable`&&e.projects?`${e.projectsReason}${t}`:e.projects?``:e.projectsReason??(e.projectsState===`refreshing`?`Project memberships pending.`:`Project boards unavailable.`)}function qe(e){return[e.viewerLogin?``:`GitHub login unavailable.`,Ke(e)].filter(Boolean).join(` `)}function Je({options:e,assignees:t,onAssigneesChange:n}){return(0,X.jsxs)(R,{children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,className:Q,disabled:e.length===0,children:[`Assignee`,t.length?` · ${t.length}`:``,(0,X.jsx)(F,{size:12,"aria-hidden":`true`,className:`ml-1 inline size-3 shrink-0 align-[-1px] text-soft-foreground`})]})}),(0,X.jsx)(L,{align:`start`,className:`w-64 max-w-[calc(100vw-2rem)] p-2`,children:(0,X.jsxs)(`fieldset`,{className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] overflow-y-auto`,children:[(0,X.jsx)(`legend`,{className:`px-2 text-xs text-muted-foreground`,children:`Match any selected assignee`}),e.map(e=>{let r=t.some(t=>t.toLowerCase()===e.toLowerCase());return(0,X.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded px-2 hover:bg-muted`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:r,onChange:()=>n(r?t.filter(t=>t.toLowerCase()!==e.toLowerCase()):[...t,e])}),(0,X.jsx)(`span`,{className:`break-all text-sm`,children:e})]},e.toLowerCase())})]})})]})}function Ye({data:e,projectId:t,onProjectChange:n,pickerRef:r}){return e.projects?.length?(0,X.jsxs)(`select`,{ref:r,"aria-label":`Project board`,className:`${Q} ${Z}`,value:t,onChange:e=>n(e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:`All boards`}),e.projects.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.title},e.id))]}):e.projects||e.projectsState?(0,X.jsx)(`select`,{ref:r,"aria-label":`Project board`,className:`${Q} ${Z}`,disabled:!0,value:``,children:(0,X.jsx)(`option`,{value:``,children:e.projects?`No boards`:e.projectsState===`refreshing`?`Loading boards…`:`Boards unavailable`})}):null}function Xe({data:e,message:t,lastMessage:n,hasMessage:r,statusOpen:i,setStatusOpen:a,triggerRef:o,contentRef:s}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{role:`status`,className:`sr-only`,children:t}),(0,X.jsxs)(R,{open:i,onOpenChange:a,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(`button`,{ref:o,type:`button`,className:`${Q} inline-flex items-center justify-center ${t?``:`invisible`}`,"aria-label":`Project board status`,tabIndex:t?void 0:-1,children:e.projectsState===`refreshing`?(0,X.jsx)(A,{size:14,"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):(0,X.jsx)(j,{size:14,"aria-hidden":`true`,className:`size-3.5`})})}),(0,X.jsx)(L,{ref:s,align:`start`,"data-slot":`gh-issue-status`,onCloseAutoFocus:e=>{r||e.preventDefault()},className:`w-72 max-w-[calc(100vw-2rem)] p-3 text-xs text-muted-foreground`,children:t||n.current})]})]})}function Ze({data:e,assignees:t,projectId:n,onAssigneesChange:r,onProjectChange:i}){let[a,o]=(0,q.useState)(!1),s=(0,q.useRef)(null),c=(0,q.useRef)(null),l=(0,q.useRef)(null),u=(0,q.useRef)(null),d=We(e.issues,t),f=Ge(e.viewerLogin,t),p=qe(e),m=p!==``,h=(0,q.useRef)(p);m&&(h.current=p);let g=(0,q.useRef)(!m);g.current=!m;let _=()=>(l.current&&!l.current.disabled?l.current:u.current)?.focus();return(0,q.useEffect)(()=>{let e=s.current;if(!e)return;let t=e=>{g.current&&!e.relatedTarget&&requestAnimationFrame(()=>{(!document.activeElement||document.activeElement===document.body)&&_()})};return e.addEventListener(`blur`,t),()=>e.removeEventListener(`blur`,t)},[]),(0,q.useEffect)(()=>{if(m)return;let e=document.activeElement,t=!!e&&(e===s.current||!!c.current?.contains(e));o(!1),t&&_()},[m]),(0,X.jsxs)(`div`,{className:`contents`,"data-slot":`gh-issue-filters`,children:[(0,X.jsx)(Je,{options:d,assignees:t,onAssigneesChange:r}),(0,X.jsx)(`button`,{ref:u,type:`button`,className:`${Q} aria-pressed:border-foreground aria-pressed:bg-foreground aria-pressed:text-background`,disabled:!e.viewerLogin,"aria-pressed":f,onClick:()=>r(f?[]:[e.viewerLogin]),children:`Assigned to me`}),(0,X.jsx)(Ye,{data:e,projectId:n,onProjectChange:i,pickerRef:l}),(0,X.jsx)(Xe,{data:e,message:p,lastMessage:h,hasMessage:m,statusOpen:a,setStatusOpen:o,triggerRef:s,contentRef:c})]})}function Qe({onRefresh:e,refreshing:t}){let n=ke(r());return(0,X.jsxs)(`div`,{"data-route":`github`,"data-slot":`github-filter-screen`,className:ie,children:[(0,X.jsxs)(`div`,{className:`mb-[16px] flex items-center gap-[8px]`,children:[(0,X.jsx)(`h1`,{className:a(re,`min-w-0 flex-1`),children:`GitHub`}),(0,X.jsx)(`button`,{type:`button`,"data-slot":`gh-screen-refresh`,"aria-label":`Refresh from GitHub`,title:`Refresh from GitHub`,disabled:t,onClick:e,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)(A,{size:17,"aria-hidden":`true`,className:a(`size-[17px]`,t&&`motion-safe:animate-spin`)})})]}),(0,X.jsx)(Oe,{model:n,variant:`screen`})]})}function $e(e){let t=getComputedStyle(e).overflowY;return t===`auto`||t===`scroll`?e:e.closest(`[data-slot="main"]`)??e}function et(e){let[t,n]=(0,q.useState)(null);return(0,q.useLayoutEffect)(()=>{if(!e){n(null);return}let t=()=>n($e(e));t();let r=typeof window.matchMedia==`function`?window.matchMedia(`(min-width: 768px)`):null;r?.addEventListener(`change`,t);let i=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return i?.observe(e),()=>{r?.removeEventListener(`change`,t),i?.disconnect()}},[e]),t}function tt(e,t){let[n,r]=(0,q.useState)(0);return(0,q.useLayoutEffect)(()=>{let n=()=>{!e||!t||r(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return n(),window.addEventListener(`resize`,n),()=>window.removeEventListener(`resize`,n)},[e,t]),n}function nt(e,t,n){let[r,i]=(0,q.useState)(null),a=(0,q.useRef)(n);return(0,q.useEffect)(()=>{a.current=n}),(0,q.useEffect)(()=>{if(!e||!r||!t||typeof IntersectionObserver>`u`)return;let n=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&a.current()},{root:t.getAttribute(`data-slot`)===`main`?null:t,rootMargin:`0px 0px 600px 0px`});return n.observe(r),()=>n.disconnect()},[e,r,t]),i}function rt(e,t,n,r,i){let[a,o]=(0,q.useState)(null),[s,c]=(0,q.useState)(null),l=et(a),u=(0,q.useRef)(null);u.current=l;let d=tt(s,l),f=e===`issues`?n?.issues.length??0:n?.prs.length??0,p=t.hasNextPage&&r===null&&f>0;return{listEl:a,setListEl:o,setRowsEl:c,scrollOwner:l,scrollOwnerRef:u,startMargin:d,pagingAvailable:p,manualPaging:p&&i,loadMoreRef:nt(p&&!i&&!t.isFetchingNextPage&&!t.isFetchNextPageError,l,()=>void t.fetchNextPage())}}var it=100;function at(e,t,n,r,i){if(!e?.available||t!==`prs`)return[];let a=new Set;n!==null&&Number.isInteger(n)&&a.add(n);for(let t of[...r,...i,...e.prs]){if(a.size>=it)break;a.add(t.number)}return[...a]}function ot(e,t,n,r,i,a){let o=at(n,e,r,i,a),s=y(o,e===`prs`),c=s.data?.available?s.data.checks:void 0,l=v(e===`issues`?`issue`:`pr`,(0,q.useMemo)(()=>(t.data?.pages??[]).map(t=>(e===`issues`?t.issues:t.prs).map(e=>e.number)),[t.data,e]),n?.available===!0&&n.commentsDeferred===!0),u=(0,q.useMemo)(()=>new Set(n?.commentsDeferred?(e===`issues`?n.issues:n.prs).map(e=>e.number):[]),[n,e]);return{checkPrNumbers:o,checksMap:c,commentsOf:e=>l[e.number]??(u.has(e.number)?void 0:e.comments)}}function st(e){let[t,n]=Ee(),r=t.get(`filter`),i=de(e,r);return{rawFilterParam:r,filter:i,activeFilter:i??`all`,setFilterParam:e=>n(t=>{let n=new URLSearchParams(t);return e===null?n.delete(`filter`):n.set(`filter`,e),n})}}function ct(e,t,{filter:n,activeFilter:r,setFilterParam:i}){let[a,o]=(0,q.useState)(``),[s,c]=(0,q.useState)([]),[l,u]=(0,q.useState)([]),{setProjectFilter:d,activeProject:f}=lt(t),p=e===`issues`&&r===`assigned`,m=p?t?.viewerLogin?[t.viewerLogin]:[]:l;return{query:a,setQuery:o,labelFilter:s,setLabelFilter:c,setProjectFilter:d,activeProject:f,isAssignedFilter:p,effectiveAssignees:m,changeAssignees:e=>{u(e),p&&i(`all`)},clearFilters:()=>{o(``),c([]),u([]),d(``),n!==null&&n!==`all`&&i(`all`)},filtering:a.trim()!==``||s.length>0||e===`issues`&&(m.length>0||f!==``)||n!==null&&n!==`all`,narrowing:a.trim()!==``||s.length>0||e===`issues`&&(!p&&l.length>0||f!==``)}}function lt(e){let[t,n]=(0,q.useState)(``),r=e?.projectsState===`refreshing`||e?.projectsState===`unavailable`,i=r||e?.projects?.some(e=>e.id===t)?t:``;return(0,q.useEffect)(()=>{e&&!r&&t&&!i&&n(``)},[e,t,i,r]),{setProjectFilter:n,activeProject:i}}function ut(e,t,{filter:n,activeFilter:i},a){let o=r(),s=e===`issues`&&(i===`no-task`||i===`has-task`),c=S(o,s,o==="default"),l=(0,q.useMemo)(()=>c.data?ce(c.data,t?.repo,o):null,[c.data,t?.repo,o]),u=se(e,n)?ae(n):null,d=b(`pr`,u??``,u!==null&&t?.available===!0),f=u!==null&&d.data?.available?d.data.items:null,p=(0,q.useMemo)(()=>t?.available?e===`issues`?t.issues:t.prs:[],[t,e]),m=(0,q.useMemo)(()=>f?le(f,p):null,[f,p]),h=dt({view:e,gh:t,activeFilter:i,isAssignedFilter:a,taskFilter:s,taskNumbers:l,runsQuery:c,backedQuery:u,filterHits:f,filterSearch:d});return{backedQuery:u,filterSearch:d,fullList:p,filterRows:m,filterGate:h,openItems:(0,q.useMemo)(()=>h?[]:m??p,[h,m,p]),narrow:(0,q.useMemo)(()=>e===`issues`?i===`no-task`&&l?{excludeNumbers:l}:i===`has-task`&&l?{includeNumbers:l}:{}:i===`mine`&&t?.viewerLogin?{author:t.viewerLogin}:f?{includeNumbers:new Set(f.map(e=>e.number))}:{},[e,i,l,t?.viewerLogin,f])}}function dt({view:e,gh:t,activeFilter:n,isAssignedFilter:r,taskFilter:i,taskNumbers:a,runsQuery:o,backedQuery:s,filterHits:c,filterSearch:l}){return t?.available?(r||e===`prs`&&n===`mine`)&&!t.viewerLogin?{kind:`blocked`,message:`GitHub login unavailable, so this filter cannot be applied.`}:i&&!a?o.isError?{kind:`blocked`,message:`The task list is unavailable, so this filter cannot be applied.`}:{kind:`loading`,message:`Loading tasks…`}:s!==null&&!c?l.data?.available===!1?{kind:`blocked`,message:`GitHub could not be searched: ${l.data.reason??`unknown reason`}.`}:l.isError?{kind:`blocked`,message:`GitHub could not be searched: ${l.error instanceof Error?l.error.message:`the search request failed`}.`}:{kind:`loading`,message:`Searching GitHub…`}:null:null}function $(e,t){return t?p(t.kind,t.number,{refresh:!0}).then(n=>(e.setQueryData(t.key,n),!0)).catch(()=>!1):Promise.resolve(!0)}function ft(e,t,n,{filterGate:r,filterRows:i,fullList:a}){let o=T.github()[0],s=t===void 0?null:Number.parseInt(t,10),c=!r&&n.data?.available?n.data.items.find(e=>e.number===s):void 0,l=i&&s!==null&&!a.some(e=>e.number===s)?i.find(e=>e.number===s):void 0,u=c??l,[d,f]=(0,q.useState)(null);return(0,q.useEffect)(()=>{u&&f({scope:o,view:e,item:u})},[o,e,u]),{selectedNumber:s,remoteDetail:u??(d?.scope===o&&d.view===e&&d.item.number===s?d.item:null)}}function pt(e,t,n,{fullList:r,filterRows:i},a){let o=u(),s=(0,q.useRef)(null),c=e===`issues`?`issue`:`pr`,l=t?.available===!0&&n!==null&&Number.isSafeInteger(n)&&n>0&&!r.some(e=>e.number===n)&&!i?.some(e=>e.number===n)&&a===null,d=C(c,n??0,l),f=l&&d.data?.available&&d.data.item?.kind===c?d.data.item:null;s.current=l&&n!==null?{kind:c,number:n,key:T.githubItem(c,n)}:null;let[p,m]=(0,q.useState)(!1);return{exactWanted:l,exactItem:d,exactDetail:f,exactTargetRef:s,retryingExact:p,retryExact:()=>{m(!0),$(o,s.current).then(e=>{m(!1),e||E(`Could not reach GitHub for #${n}`,{tone:`danger`})})}}}function mt(e,t,n){let r=u(),i=(0,q.useRef)(null);return{refresh:x({mutationFn:e=>($(r,e),f({refresh:!0,limit:50})),onSuccess:async a=>{await r.cancelQueries({queryKey:T.githubPages(50),exact:!0}),r.setQueryData(T.githubPages(50),{pages:[a],pageParams:[{}]}),r.invalidateQueries({queryKey:T.githubChecks(t)});let o=e===`issues`?`issue`:`pr`,s=(e===`issues`?a.issues:a.prs).map(e=>e.number),l=T.githubCommentCounts(o,s);r.removeQueries({queryKey:T.githubCommentCounts(o,[]).slice(0,4),predicate:e=>e.queryHash!==m(l)}),a.available&&a.commentsDeferred&&s.length>0&&d(o,s,{refresh:!0}).then(e=>r.setQueryData(l,e)).catch(()=>{}),r.invalidateQueries({queryKey:T.githubSearch(e===`issues`?`issue`:`pr`,n)}),r.invalidateQueries({queryKey:T.githubSearch(`pr`,oe)}),r.invalidateQueries({queryKey:T.githubSearch(`pr`,fe)});let u=i.current;if(!u){r.removeQueries({queryKey:[`github`,`comments`]});return}let f=T.githubComments(u.kind,u.number);c(u.kind,u.number,{refresh:!0}).then(e=>r.setQueryData(f,e)).catch(()=>{}),r.removeQueries({queryKey:[`github`,`comments`],predicate:e=>e.queryHash!==m(f)})},onError:e=>E(e.message,{tone:`danger`})}),openThreadRef:i}}var ht=350;function gt(e,t){let[n,r]=(0,q.useState)(e);return(0,q.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function _t(e,t,{query:n,labelFilter:r,effectiveAssignees:i,activeProject:a},{openItems:o,narrow:s,filterGate:c}){let l=gt(n,ht),u=(0,q.useMemo)(()=>G(o,{query:l,labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}),[o,l,r,e,i,a,s]),d=n.trim()===l.trim(),f=t?.available===!0&&!c&&d&&Me(l,u),p=b(e===`issues`?`issue`:`pr`,l,f),m=G(o,{query:n,labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}),h=f&&p.data?.available?p.data:null,g=new Set(m.map(e=>e.number)),_=vt(e,h,a,i);return{debouncedQuery:l,searchWanted:f,forgeSearch:p,items:m,searchPayload:h,metadataFailure:_,searchHits:h&&!_?G(h.items,{labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}).filter(e=>!g.has(e.number)):[],...yt(n,d,f,p)}}function vt(e,t,n,r){return e===`issues`&&t?n&&t.items.some(e=>e.projectIds===void 0)?t.projectsReason??`Project board data is incomplete. Refresh to try again.`:r.length&&t.items.some(e=>e.assignees===void 0)?`Assignee data is incomplete. Refresh to try again.`:null:null}function yt(e,t,n,r){return{searching:e.trim()!==``&&!t||n&&r.isPending,searchFailed:n&&(r.data?.available===!1||r.isError),searchFailureReason:r.data?.available===!1?r.data.reason??`unknown reason`:r.error instanceof Error?r.error.message:`the search request failed`}}function bt({width:e,onWidthChange:t}){let n=(0,q.useRef)(null),r=t=>{t.button===0&&(n.current={x:t.clientX,width:e},t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),t.currentTarget.focus())},i=e=>{let r=n.current;r&&t(Y(r.width+(e.clientX-r.x)))},a=e=>{n.current&&(n.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,X.jsx)(`div`,{"data-slot":`gh-list-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the GitHub list`,"aria-valuenow":e,"aria-valuemin":280,"aria-valuemax":520,tabIndex:0,onPointerDown:r,onPointerMove:i,onPointerUp:a,onPointerCancel:a,onKeyDown:n=>{let r=n.key===`ArrowLeft`?e-16:n.key===`ArrowRight`?e+16:n.key===`Home`?280:n.key===`End`?520:null;r!==null&&(n.preventDefault(),t(Y(r)))},onDoubleClick:()=>t(360),title:`Drag to resize the GitHub list — double-click to reset`,className:`absolute inset-y-0 -right-[2px] z-20 hidden w-[5px] cursor-col-resize touch-none bg-transparent transition-colors hover:bg-accent-strong/40 focus-visible:bg-accent-strong/60 focus-visible:outline-none md:block`})}function xt({view:e,changes:n=!1,index:r=!1}){let{n:i}=t(),a=st(e),{rawFilterParam:o,activeFilter:s}=a,c=xe(),{pages:l,data:u}=ne(50),d=ee().data?.capabilities?.automations===!0,f=Ct(),p=ze(),m=St({index:r,isDesktop:c,rawFilterParam:o,n:i,rememberedView:te().data?.githubView}),h=wt(u?.available===!0&&!m.filterScreen),[g,_]=(0,q.useState)(!1),v=ct(e,u,a),y=ut(e,u,a,v.isAssignedFilter),b=_t(e,u,v,y),x=ft(e,i,b.forgeSearch,y),S=pt(e,u,x.selectedNumber,y,x.remoteDetail),C=ot(e,l,u,x.selectedNumber,b.searchHits,y.openItems),{refresh:w,openThreadRef:T}=mt(e,C.checkPrNumbers,b.debouncedQuery),E=rt(e,l,u,y.backedQuery,v.narrowing);if(m.restorePrs)return(0,X.jsx)(ge,{to:`/github/prs`,replace:!0});if(!u)return l.isError?(0,X.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(U,{icon:(0,X.jsx)(j,{size:16}),tone:`danger`,title:`Could not load GitHub`,subtitle:l.error.message})}):(0,X.jsx)(Se,{});T.current=null;let D=()=>w.mutate(S.exactTargetRef.current);if(m.filterScreen&&u.available)return(0,X.jsx)(Qe,{onRefresh:D,refreshing:w.isPending});if(!u.available)return(0,X.jsx)(kt,{reason:u.reason,refreshing:w.isPending,onRetry:D});let{labelColors:O,labelOptions:k}=Tt(u,b.searchPayload,y.openItems,y.fullList),A=Et({number:x.selectedNumber,items:b.items,searchHits:b.searchHits,fullList:y.fullList,filterRows:y.filterRows,remoteDetail:x.remoteDetail,exactDetail:S.exactDetail});T.current=A?{kind:A.kind,number:A.number}:null;let{linkFilter:M,listPath:N}=Dt(e,o,s,c),P={view:e,filter:M,colors:O,selected:A,queued:p.queued,checksMap:C.checksMap,commentsOf:C.commentsOf},F=Ot(e,v,y.filterGate,b);return(0,X.jsxs)(`div`,{ref:h.routeRef,"data-route":`github`,className:`flex min-h-full flex-col gap-3 px-[18px] pt-[18px] pb-[calc(90px+env(safe-area-inset-bottom))] md:gap-[22px] md:px-7 md:pt-4 md:pb-4`,children:[(0,X.jsx)(At,{view:e,activeFilter:s,isDesktop:c,rawFilterParam:o,n:i,gh:u}),(0,X.jsxs)(`div`,{ref:h.workspaceRef,"data-slot":`gh-workspace`,"data-stacked":h.panesStacked,className:`flex min-h-0 min-w-0 flex-1 flex-col gap-3 md:h-[calc(var(--gh-workspace-height,calc(100dvh-4rem))-1rem)] md:flex-none md:gap-[22px]`,children:[(0,X.jsxs)(`header`,{"data-slot":`gh-header`,className:`flex shrink-0 flex-col gap-3 bg-background md:gap-[22px]`,children:[(0,X.jsx)(jt,{view:e,isDesktop:c,gh:u,automationsAvailable:d,onSaveView:f,refreshing:w.isPending,onRefresh:D}),(0,X.jsx)(Mt,{view:e,gh:u,filters:v,labelOptions:k,labelColors:O,searchPayload:b.searchPayload})]}),(0,X.jsxs)(`div`,{"data-slot":`gh-panes`,className:`flex min-h-0 min-w-0 flex-1 flex-col items-start gap-[22px] md:flex-row md:items-stretch md:overflow-hidden`,children:[(0,X.jsx)(Ft,{view:e,n:i,rows:P,verdict:F,search:b,sidebar:y,list:l,paging:E,width:h.githubListWidth,onWidthChange:h.changeGithubListWidth,expanded:g,onExpandedChange:_}),(0,X.jsx)(Vt,{view:e,n:i,selected:A,selectedNumber:x.selectedNumber,exact:S,repo:u.repo,rows:P,listPath:N,changes:n,handToAgent:p})]})]})]})}function St({index:e,isDesktop:t,rawFilterParam:n,n:r,rememberedView:i}){return{filterScreen:e&&!t&&n===null&&r===void 0,restorePrs:e&&t&&n===null&&i===`prs`}}function Ct(){let e=u();return t=>{e.setQueryData(T.uiState,e=>({...e,githubView:t})),h({githubView:t}).then(t=>e.setQueryData(T.uiState,t)).catch(t=>{E(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:T.uiState})})}}function wt(e){let[t,n]=(0,q.useState)(Be),[r,i]=(0,q.useState)(!0),a=(0,q.useRef)(null),o=(0,q.useRef)(null);return(0,q.useEffect)(()=>{if(!e)return;let n=a.current,r=o.current,s=n?.closest(`[data-slot="main"]`);if(!n||!r||!s)return;let c=window.matchMedia(`(min-width: 768px)`),l=!1,u=()=>{if(l=c.matches&&r.clientWidth>=t+22+360,i(!l),!l||s.clientHeight<1){n.style.removeProperty(`--gh-workspace-height`);return}n.style.setProperty(`--gh-workspace-height`,`${Math.round(s.clientHeight)}px`)};u();let d=new ResizeObserver(u);d.observe(s),d.observe(r);let f=e=>{if(!l||e.ctrlKey||!e.deltaY||Math.abs(e.deltaX)>Math.abs(e.deltaY)||r.getBoundingClientRect().top<=s.getBoundingClientRect().top+1||!(e.target instanceof Element)||!e.target.closest(`[data-slot="gh-panes"]`))return;e.preventDefault();let t=e.deltaMode===1?16:e.deltaMode===2?s.clientHeight:1;s.scrollTop+=e.deltaY*t};return r.addEventListener(`wheel`,f,{passive:!1}),c.addEventListener(`change`,u),()=>{r.removeEventListener(`wheel`,f),d.disconnect(),c.removeEventListener(`change`,u)}},[e,t]),{githubListWidth:t,changeGithubListWidth:e=>{let t=Y(e);n(t),Ve(t)},panesStacked:r,routeRef:a,workspaceRef:o}}function Tt(e,t,n,r){return{labelColors:{...t?.labelColors,...e.labelColors},labelOptions:Pe([...n,...r,...t?.items??[]])}}function Et({number:e,items:t,searchHits:n,fullList:r,filterRows:i,remoteDetail:a,exactDetail:o}){return e===null?t[0]??n[0]??null:r.find(t=>t.number===e)??i?.find(t=>t.number===e)??a??o??null}function Dt(e,t,n,r){let i=t===null?null:n;return{linkFilter:i,listPath:V(e,i??(e===`issues`&&!r?`all`:null))}}function Ot(e,{query:t,filtering:n},r,{searching:i,searchFailed:a,searchFailureReason:o,metadataFailure:s,searchHits:c,searchPayload:l,items:u}){let d=e===`issues`?`issues`:`pull requests`;return r?(0,X.jsxs)(`p`,{role:`status`,className:`flex items-center gap-1.5`,"data-slot":`gh-filter-gate`,"data-kind":r.kind,children:[r.kind===`loading`?(0,X.jsx)(z,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):null,r.message]}):n?i?(0,X.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(z,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,t.trim(),`”…`]}):a?c.length>0?(0,X.jsxs)(`p`,{role:`status`,children:[`Showing previous results. GitHub could not be refreshed: `,o,`. Use Refresh to try again.`]}):u.length>0?(0,X.jsxs)(`p`,{children:[`GitHub could not be searched: `,o,`.`]}):(0,X.jsxs)(`p`,{children:[`No open `,d,` match your filter, and GitHub could not be searched: `,o,`.`]}):s?(0,X.jsxs)(`p`,{role:`status`,children:[`Cannot apply the selected filters to GitHub results: `,s]}):c.length>0?null:l?.truncated?(0,X.jsx)(`p`,{children:`No matches within GitHub’s first matches. Narrow your search to check more specific results.`}):l&&u.length>0?(0,X.jsxs)(`p`,{children:[`No additional `,d,` match your filter on GitHub.`]}):l?(0,X.jsxs)(`p`,{children:[`No `,d,` match your filter — open, closed or merged.`]}):(0,X.jsxs)(`p`,{children:[`No open `,d,` match your filter.`]}):(0,X.jsxs)(`p`,{children:[`No open `,d,`.`]})}function kt({reason:e,refreshing:t,onRetry:r}){return(0,X.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(U,{icon:(0,X.jsx)(O,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:e??`unknown reason`,actions:(0,X.jsx)(i,{variant:`outline`,"data-action":`gh-retry`,disabled:t,onClick:r,children:`Try again`}),children:(0,X.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,X.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,X.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in `,n(`cezar`),` works without it.`]})})})}function At({view:e,activeFilter:t,isDesktop:n,rawFilterParam:r,n:i,gh:a}){return(0,X.jsxs)(`div`,{"data-slot":`gh-masthead`,className:`flex min-w-0 shrink-0 flex-col gap-1 md:flex-row md:items-baseline md:gap-3`,children:[(0,X.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight md:text-[15px] md:tracking-normal`,children:n?`${e===`issues`?`Issues`:`Pull requests`} · ${he[t]}`:`GitHub`}),r!==null&&i===void 0?(0,X.jsxs)(`div`,{"data-slot":`gh-filter-context`,className:`flex min-w-0 items-center gap-3 md:hidden`,children:[(0,X.jsxs)(H,{to:`/github`,"data-slot":`gh-back-filters`,className:`inline-flex min-h-11 items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground`,children:[(0,X.jsx)(P,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to filters`]}),t===`all`?null:(0,X.jsx)(`span`,{"data-slot":`gh-active-filter`,className:`truncate text-xs text-soft-foreground`,children:[...me,...ue].find(e=>e.id===t)?.label})]}):null,a.repo?(0,X.jsxs)(`span`,{className:`min-w-0 truncate text-[13px] text-muted-foreground md:text-[11px] md:text-soft-foreground`,children:[(0,X.jsx)(`span`,{"data-slot":`gh-repo`,children:a.repo}),(0,X.jsxs)(`span`,{"data-slot":`gh-synced`,children:[` · `,a.syncedAt?`Synced ${B(a.syncedAt)} ago`:`Not synced yet`]})]}):null]})}function jt({view:e,isDesktop:t,gh:n,automationsAvailable:r,onSaveView:i,refreshing:o,onRefresh:s}){return(0,X.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`flex min-h-11 flex-wrap items-center gap-3`,children:[(0,X.jsxs)(K,{to:t?`/github`:`/github?filter=all`,active:e===`issues`,onClick:()=>i(`issues`),children:[`Issues · `,n.issuesTotal??n.issues.length]}),(0,X.jsxs)(K,{to:`/github/prs`,active:e===`prs`,onClick:()=>i(`prs`),children:[`Pull requests · `,n.prsTotal??n.prs.length]}),r?(0,X.jsx)(H,{to:`/automations/new`,className:`gh-utility`,children:`Set up automations`}):null,(0,X.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:o,onClick:s,className:`gh-utility`,children:[(0,X.jsx)(A,{size:16,"aria-hidden":`true`,className:a(`size-3.5`,o&&`motion-safe:animate-spin`)}),`Refresh`]})]})}function Mt({view:e,gh:t,filters:n,labelOptions:r,labelColors:i,searchPayload:a}){return(0,X.jsxs)(`div`,{"data-slot":`gh-filter-toolbar`,className:`flex flex-wrap items-center gap-2.5`,children:[(0,X.jsxs)(`div`,{className:`relative min-w-0 basis-full md:flex-1 md:basis-auto`,children:[(0,X.jsx)(k,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,X.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:e===`issues`?`Filter issues…`:`Filter pull requests…`,value:n.query,onChange:e=>n.setQuery(e.target.value),className:`min-h-11 w-full rounded-md border border-input bg-card py-1 pr-2 pl-7 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,X.jsx)(qt,{options:r,colors:i,selected:n.labelFilter,onChange:n.setLabelFilter}),e===`issues`?(0,X.jsx)(Ze,{data:{...t,issues:[...t.issues,...a?.items??[]]},assignees:n.effectiveAssignees,projectId:n.activeProject,onAssigneesChange:n.changeAssignees,onProjectChange:n.setProjectFilter}):null,(0,X.jsx)(`button`,{type:`button`,disabled:!n.filtering,className:`min-h-11 min-w-11 rounded-md border border-border bg-card px-4 text-xs disabled:opacity-50`,onClick:n.clearFilters,children:`Clear filters`})]})}function Nt(e,t){return e.kind===`pr`?t?.[e.number]??e.checks:e.checks}function Pt(e,t){return(0,X.jsx)(Kt,{item:e,view:t.view,filter:t.filter,colors:t.colors,active:t.selected?.url===e.url,queued:t.queued.has(e.url),checks:Nt(e,t.checksMap),comments:t.commentsOf(e)})}function Ft({view:e,n:t,rows:n,verdict:r,search:i,sidebar:a,list:o,paging:s,width:c,onWidthChange:l,expanded:u,onExpandedChange:d}){let{items:f,searchHits:p}=i,m=e===`issues`&&t!==void 0&&!u;return(0,X.jsxs)(`section`,{ref:s.setListEl,"data-slot":`gh-list`,"data-mobile-preview":m||void 0,style:{"--github-list-width":`${c}px`},className:`relative flex w-full min-h-0 min-w-0 flex-col rounded-lg border border-border bg-card p-3 md:w-[var(--github-list-width)] md:shrink-0 md:overflow-x-hidden md:overflow-y-auto`,children:[f.length===0?r&&(0,X.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-soft-foreground`,children:r}):(0,X.jsx)(It,{items:f,rows:n,compactPreview:m,paging:s}),s.pagingAvailable?(0,X.jsx)(Lt,{view:e,list:o,paging:s}):null,(0,X.jsx)(Rt,{backedQuery:a.backedQuery,filterSearch:a.filterSearch}),(0,X.jsx)(zt,{view:e,n:t,count:f.length,expanded:u,onExpandedChange:d}),f.length>0&&i.searchWanted&&r?(0,X.jsx)(`div`,{"data-slot":`gh-search-status`,role:`status`,className:`px-4 py-4 text-sm text-soft-foreground`,children:r}):null,p.length>0?(0,X.jsx)(Bt,{hits:p,searchPayload:i.searchPayload,rows:n}):null,(0,X.jsx)(bt,{width:c,onWidthChange:l})]})}function It({items:e,rows:t,compactPreview:n,paging:r}){let{setRowsEl:i,scrollOwner:a,listEl:o,scrollOwnerRef:s,startMargin:c}=r,l=e.map((e,r)=>(0,X.jsx)(`div`,{role:`listitem`,"data-slot":`gh-row-item`,"data-divided":r>0||void 0,"data-compact-hidden":n&&r>=2&&t.selected?.url!==e.url||void 0,children:Pt(e,t)},e.url));return(0,X.jsx)(`div`,{ref:i,"data-slot":`gh-rows`,"data-virtualized":a?`true`:void 0,role:`list`,children:a?(0,X.jsx)(Ce,{scrollRef:s,startMargin:c,children:l},a===o?`list`:`main`):l})}function Lt({view:e,list:t,paging:n}){return(0,X.jsx)(`div`,{ref:n.loadMoreRef,"data-slot":`gh-load-more`,className:`flex min-h-6 items-center justify-center gap-1.5 px-4 pb-3 text-xs text-soft-foreground`,children:t.isFetchingNextPage?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(z,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Loading more…`]}):t.isFetchNextPageError?(0,X.jsxs)(X.Fragment,{children:[`Could not load more.`,(0,X.jsx)(`button`,{type:`button`,"data-slot":`gh-load-more-retry`,onClick:()=>void t.fetchNextPage(),className:`font-medium text-accent-text hover:underline`,children:`Retry`})]}):n.manualPaging?(0,X.jsxs)(X.Fragment,{children:[`Filters cover the loaded `,e===`issues`?`issues`:`pull requests`,`.`,(0,X.jsx)(`button`,{type:`button`,"data-slot":`gh-load-more-manual`,onClick:()=>void t.fetchNextPage(),className:`font-medium text-accent-text hover:underline`,children:`Load more`})]}):null})}function Rt({backedQuery:e,filterSearch:t}){return e!==null&&t.data?.available&&t.data.truncated?(0,X.jsxs)(`div`,{"data-slot":`gh-filter-note`,role:`status`,className:`px-4 py-3 text-xs text-soft-foreground`,children:[`Showing the first `,t.data.items.length,` matches from GitHub search; more may exist.`]}):null}function zt({view:e,n:t,count:n,expanded:r,onExpandedChange:a}){return e===`issues`&&t!==void 0&&n>2?(0,X.jsx)(i,{variant:`outline`,className:`mt-2 self-start md:hidden`,"data-slot":`gh-expand-list`,"aria-expanded":r,onClick:()=>a(e=>!e),children:r?`Show fewer issues`:`View all ${n} issues`}):null}function Bt({hits:e,searchPayload:t,rows:n}){return(0,X.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,X.jsxs)(`p`,{className:`px-4 pt-2 pb-1 text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:[`Found on GitHub`,t?.truncated?` (first matches)`:``]}),(0,X.jsx)(`ul`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:e.map(e=>(0,X.jsx)(`li`,{children:Pt(e,n)},e.url))})]})}function Vt({view:e,n:t,selected:n,selectedNumber:r,exact:i,repo:o,rows:s,listPath:c,changes:l,handToAgent:u}){let{exactWanted:d,exactItem:f}=i;return(0,X.jsx)(`section`,{"data-slot":`gh-detail`,className:a(`w-full min-w-0 min-h-0 flex-1 flex-col rounded-lg border border-border bg-card md:overflow-y-auto`,t===void 0?`hidden md:flex`:`flex`),children:n?(0,X.jsx)(Ht,{item:n,n:t,repo:o,rows:s,listPath:c,changes:l,handToAgent:u}):d&&f.isPending?(0,X.jsx)(`div`,{"data-slot":`gh-detail-loading`,className:`flex min-h-full flex-1 flex-col`,children:(0,X.jsx)(U,{icon:(0,X.jsx)(z,{className:`motion-safe:animate-spin`}),tone:`neutral`,heading:`h2`,title:`Loading #${r}…`,subtitle:`It is not among the open items, so the tab is asking GitHub for it.`})}):d&&(f.isError||f.data?.available===!1)?(0,X.jsx)(Ut,{number:r,exact:i}):(0,X.jsx)(Wt,{view:e,number:r})})}function Ht({item:e,n:t,repo:n,rows:r,listPath:i,changes:a,handToAgent:o}){let{workflows:s,skillList:c,workflow:l,setWorkflow:u,selectedSkills:d,setSelectedSkills:f,engine:p,setEngine:m,queued:h,onQueued:g}=o;return(0,X.jsx)(Ie,{item:e,comments:r.commentsOf(e),afterHeading:e.kind===`issue`?(0,X.jsx)(He,{number:e.number,repo:n},t??`list`):void 0,backLink:{to:i},subNav:{filter:r.filter,changes:a},onRunAgent:Gt,colors:r.colors,checks:Nt(e,r.checksMap),children:(0,X.jsx)(Fe,{item:e,workflows:s.data?.workflows??[],skills:c,workflow:l,onWorkflowChange:u,selectedSkills:d,onSkillsChange:f,engine:p,onEngineChange:m,queuedRunId:h.get(e.url)??null,onQueued:g},e.url)})}function Ut({number:e,exact:t}){let{exactItem:n,retryingExact:r,retryExact:a}=t;return(0,X.jsx)(U,{icon:(0,X.jsx)(j,{size:16}),tone:n.isError?`danger`:`neutral`,heading:`h2`,title:`Could not load #${e}`,subtitle:n.data?.available===!1?n.data.reason:n.error instanceof Error?n.error.message:`The request failed.`,actions:(0,X.jsx)(i,{variant:`outline`,disabled:r,onClick:a,children:`Retry`})})}function Wt({view:e,number:t}){return(0,X.jsx)(U,{icon:e===`issues`?(0,X.jsx)(N,{size:16}):(0,X.jsx)(D,{size:16}),tone:`neutral`,heading:`h2`,title:t===null?`Nothing selected`:`Not found`,subtitle:t===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${t} is not among the open ${e===`issues`?`issues`:`pull requests`}. Search for ${t} above to look it up on GitHub, closed and merged included.`})}function Gt(){let e=document.querySelector(`[data-slot="gh-detail-inner"] [data-slot="gh-custom-prompt"]`);e?.scrollIntoView({block:`center`}),e?.focus({preventScroll:!0})}function Kt({item:e,view:t,filter:n,colors:r,active:i,queued:o,checks:s,comments:l}){let d=e.kind===`issue`?N:D,f=u(),p=()=>{f.prefetchQuery({queryKey:T.githubComments(e.kind,e.number),queryFn:({signal:t})=>c(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,X.jsxs)(H,{to:V(t,n,e.number),draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,Le(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},onMouseEnter:p,onFocus:p,"data-slot":`gh-row`,"data-number":e.number,"data-kind":e.kind,"aria-current":i?`page`:void 0,title:`Drag into the composer to prefill a task`,className:a(`flex flex-col gap-2 rounded-md px-3 py-4 transition-colors hover:bg-muted`,i&&`bg-accent-strong/10 text-accent-text`),children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 md:items-center`,children:[(0,X.jsx)(d,{"aria-hidden":`true`,className:a(`mt-0.5 size-3.5 shrink-0 md:mt-0`,e.kind===`issue`?`text-success`:`text-accent-icon`)}),(0,X.jsx)(`span`,{className:a(`line-clamp-2 min-w-0 text-[13px] font-medium md:block md:truncate`,i&&`font-semibold`),children:e.title})]}),(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 pl-[22px] font-mono text-[11px] text-muted-foreground md:flex-nowrap md:gap-y-0`,children:[(0,X.jsxs)(`span`,{children:[`#`,e.number]}),(0,X.jsx)(`span`,{className:`max-w-full shrink-0 truncate md:min-w-0 md:shrink`,children:e.author}),(0,X.jsx)(`span`,{children:B(e.createdAt)}),(0,X.jsx)(Ae,{count:l}),s?(0,X.jsx)(Ne,{checks:s}):null,o?(0,X.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-accent-text`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,X.jsx)(`span`,{"data-slot":`gh-row-labels`,className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,X.jsx)(Re,{label:e,color:r[e],plain:!0},e))}):null]})}function qt({options:e,colors:t,selected:n,onChange:r}){let[i,o]=(0,q.useState)(!1),s=e=>r(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,X.jsxs)(R,{open:i,onOpenChange:o,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:a(`flex min-h-11 min-w-11 shrink-0 items-center gap-1 rounded-md border border-input bg-card px-2 py-1 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50`,n.length>0&&`border-accent-strong/60 text-foreground`),children:[n.length>0?`Labels · ${n.length}`:`Labels`,(0,X.jsx)(F,{size:12,"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`})]})}),(0,X.jsx)(L,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,X.jsxs)(ve,{children:[(0,X.jsx)(_e,{placeholder:`Filter labels…`}),(0,X.jsxs)(ye,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,X.jsx)(be,{children:`No labels.`}),n.length>0?(0,X.jsxs)(W,{value:`__clear__`,onSelect:()=>r([]),className:`min-h-11 text-soft-foreground`,children:[`Clear `,n.length,` filter`,n.length>1?`s`:``]}):null,e.map(e=>{let r=n.includes(e);return(0,X.jsxs)(W,{value:e,onSelect:()=>s(e),className:`min-h-11`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:je(t[e])}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,X.jsx)(M,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e)})]})]})})]})}export{xt as GithubRoute};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{u as t}from"./button-CS5tOblf.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{Ut as i,_n as a,cn as o}from"./queries-BtScxiQP.js";import{K as s,rt as c,u as l}from"./design-icons-DmYTv2r1.js";import{i as u,r as d,t as f}from"./popover-N-u5z2xh.js";import{c as p}from"./project-router-BFKfAFvq.js";import{A as m,E as h,M as g,N as _,O as v,j as y,k as b}from"./agent-accounts-C6eyz75V.js";import{a as x}from"./skills-DFBiAuJG.js";var S=r();function C({className:e,...n}){return(0,S.jsx)(`div`,{"data-slot":`skeleton`,className:t(`animate-pulse rounded-md bg-accent`,e),...n})}var w=e(n(),1);function T({templates:e,onInsert:n,triggerClassName:r,disabled:i,iconOnly:a=!1,label:o=`Template`}){let[C,T]=(0,w.useState)(!1),E=(0,w.useRef)(null),D=p();return e.length===0?null:(0,S.jsxs)(f,{open:C,onOpenChange:T,children:[(0,S.jsx)(u,{asChild:!0,children:(0,S.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-trigger`,"aria-label":`Insert a prompt template`,title:`Insert a prompt template`,disabled:i,className:t(`inline-flex h-[26px] items-center gap-1.5 rounded-full border border-border bg-card text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,a?`w-[26px] justify-center px-0`:`h-11 gap-2 rounded-lg px-3 text-foreground`,r),children:[(0,S.jsx)(s,{"aria-hidden":`true`,className:a?`size-3 shrink-0 text-accent-icon`:`size-[18px] shrink-0 text-muted-foreground`}),a?null:(0,S.jsxs)(S.Fragment,{children:[o,(0,S.jsx)(l,{"aria-hidden":`true`,className:`size-[13px] shrink-0 text-soft-foreground`})]})]})}),(0,S.jsx)(d,{align:`start`,sideOffset:8,"data-slot":`prompt-template-menu`,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,onCloseAutoFocus:e=>e.preventDefault(),children:(0,S.jsxs)(h,{filter:x,children:[(0,S.jsx)(m,{placeholder:`search templates…`,onInput:()=>E.current?.scrollTo(0,0)}),(0,S.jsxs)(g,{ref:E,"data-slot":`prompt-template-list-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,S.jsx)(v,{children:`Nothing matches.`}),(0,S.jsx)(b,{heading:`Insert a template`,children:e.map(e=>(0,S.jsxs)(y,{value:`template ${e.label} ${e.id}`,keywords:[e.text,...e.skills??[]],"data-slot":`prompt-template-option`,"data-template":e.id,title:e.text,className:`flex-col items-start gap-0.5`,onSelect:()=>{n(e.text),T(!1)},children:[(0,S.jsxs)(`span`,{className:`flex w-full items-center gap-1.5`,children:[(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium text-foreground`,children:e.label}),e.skills&&e.skills.length>0?(0,S.jsxs)(`span`,{"data-slot":`prompt-template-assigned`,title:`Applied automatically with: ${e.skills.join(`, `)}`,className:`inline-flex shrink-0 items-center gap-0.5 text-[12px] font-medium text-accent-text`,children:[(0,S.jsx)(c,{"aria-hidden":`true`,className:`size-2.5`}),e.skills.length]}):null]}),(0,S.jsx)(`span`,{className:`line-clamp-1 text-[11px] text-soft-foreground`,children:e.text})]},e.id))}),(0,S.jsx)(_,{}),(0,S.jsx)(b,{children:(0,S.jsx)(y,{value:`edit prompt templates settings`,"data-slot":`prompt-template-settings`,className:`text-[12px] text-muted-foreground`,onSelect:()=>{T(!1),D(`/settings/prompt-templates`)},children:`Edit templates…`})})]})]})})]})}var E=[`assigned`,`no-task`,`has-task`,`all`],D=[`review`,`mine`,`failing`,`all`],O=50,k=`is:open review-requested:@me`,A=`is:open status:failure`;function j(e,t){return e===`prs`&&(t===`review`||t===`failing`)}function M(e){return e===`review`?k:e===`failing`?A:null}function N(e,t){return t===null?null:(e===`issues`?E:D).includes(t)?t:`all`}function P(e,t,n,r=``){let i=`${n===void 0?e===`issues`?`/github`:`/github/prs`:`${e===`issues`?`/github/issues`:`/github/prs`}/${n}`}${r}`;return t===null?i:`${i}?filter=${encodeURIComponent(t)}`}function F(e,t){let n=t??`all`;return n===`all`?e===`issues`?`all`:`all-prs`:n}function I(e){return e===`all`?{view:`issues`,filter:`all`}:e===`all-prs`?{view:`prs`,filter:`all`}:{view:e===`review`||e===`mine`||e===`failing`?`prs`:`issues`,filter:e}}var L=[{id:`assigned`,label:`Assigned to me`},{id:`no-task`,label:`No task yet`},{id:`has-task`,label:`Has a task`},{id:`all`,label:`All open`}],R=[{id:`review`,label:`Review requested`},{id:`mine`,label:`Mine`},{id:`failing`,label:`Checks failing`},{id:`all-prs`,label:`All open`}],z=Object.fromEntries([...L,...R].map(e=>[e.id,e.label]));function B(e){return e===null?``:`${e.value}${e.bound===`atLeast`?`+`:``}`}function V(e,t){if(t?.bound===`atLeast`)return e===`review`||e===`failing`?`At least ${t.value}: GitHub search returns at most ${O} results.`:`At least ${t.value}: only the loaded pages are counted. Scroll to load more.`}var H=(e,t)=>e!==void 0&&t!==void 0&&e.toLowerCase()===t.toLowerCase();function U(e){try{let t=new URL(e).pathname.split(`/`).filter(Boolean);return t.length>=2?`${t[0]}/${t[1]}`.toLowerCase():null}catch{return null}}function W(e,t,n){return new Set(e.filter(e=>!e.archived).flatMap(e=>G(e,t,n)))}function G(e,t,n){let r=t?.toLowerCase();return o(e,void 0,n).filter(e=>e.kind===`Issue`&&(!e.url||r!==void 0&&U(e.url)===r)).map(e=>e.number)}function K(e,t,n,r){let i=new Map;for(let o of e)!a(o)&&G(o,n,r).includes(t)&&i.set(o.id,o);return[...i.values()].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt)||e.id.localeCompare(t.id))}function q(e,t){let n=new Map(t.map(e=>[e.number,e]));return e.map(e=>n.get(e.number)??e)}function J(e){return e?.available?{value:e.items.length,bound:e.truncated?`atLeast`:`exact`}:null}function Y({gh:e,tasks:t,review:n,failing:r}){let a={assigned:null,"no-task":null,"has-task":null,all:null,review:J(n),mine:null,failing:J(r),"all-prs":null};if(!e?.available)return a;let o=!i(e,`issues`),s=!i(e,`prs`),c=(e,t)=>({value:e,bound:t?`atLeast`:`exact`}),l=t?e.issues.filter(e=>t.has(e.number)).length:null;return{...a,all:c(e.issuesTotal??e.issues.length,!1),"all-prs":c(e.prsTotal??e.prs.length,!1),assigned:e.viewerLogin?c(e.issues.filter(t=>t.assignees?.some(t=>H(t,e.viewerLogin))).length,o):null,mine:e.viewerLogin?c(e.prs.filter(t=>H(t.author,e.viewerLogin)).length,s):null,"has-task":l===null?null:c(l,o),"no-task":l===null?null:c(e.issues.length-l,o)}}export{M as _,k as a,I as c,j as d,W as f,q as g,F as h,R as i,B as l,N as m,A as n,V as o,K as p,L as r,Y as s,z as t,P as u,T as v,C as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Bn as e,Fn as t}from"./project-scope-context-DSkcNKO7.js";function n(e,t){return e??t}function r(e,t){let r=n(e,t);return r===`1`||r===`true`}function i(e,t,r){return e?.trim()||n(t,r)||``}function a(){return r(void 0,void 0)}function o(n){return t[e(n).bucket]<=t.waiting}function s(e){return!a()&&e}export{i,o as n,a as r,s as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,s as n,u as r}from"./button-CS5tOblf.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{t as o}from"./createLucideIcon-BHp8sXmF.js";import{a as s,d as c,h as l,i as u,l as d,m as f,n as p,o as m,p as h,r as ee,t as g,u as _}from"./es2015-CX0rgbM5.js";import{_ as v,b as y,v as b,x,y as te}from"./dropdown-menu-D7f0O7xR.js";var ne=o(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),S=e(i(),1),C=a(),w=`Popover`,[T,re]=f(w,[x]),E=x(),[ie,D]=T(w),O=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=E(t),l=S.useRef(null),[u,f]=S.useState(!1),[p,m]=c({prop:r,defaultProp:i??!1,onChange:a,caller:w});return(0,C.jsx)(y,{...s,children:(0,C.jsx)(ie,{scope:t,contentId:d(),triggerRef:l,open:p,onOpenChange:m,onOpenToggle:S.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:u,onCustomAnchorAdd:S.useCallback(()=>f(!0),[]),onCustomAnchorRemove:S.useCallback(()=>f(!1),[]),modal:o,children:n})})};O.displayName=w;var k=`PopoverAnchor`,A=S.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=D(k,n),a=E(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return S.useEffect(()=>(o(),()=>s()),[o,s]),(0,C.jsx)(v,{...a,...r,ref:t})});A.displayName=k;var j=`PopoverTrigger`,M=S.forwardRef((e,t)=>{let{__scopePopover:r,...i}=e,a=D(j,r),o=E(r),s=n(t,a.triggerRef),c=(0,C.jsx)(l.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":K(a.open),...i,ref:s,onClick:h(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?c:(0,C.jsx)(v,{asChild:!0,...o,children:c})});M.displayName=j;var N=`PopoverPortal`,[P,ae]=T(N,{forceMount:void 0}),F=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=D(N,t);return(0,C.jsx)(P,{scope:t,forceMount:n,children:(0,C.jsx)(_,{present:n||a.open,children:(0,C.jsx)(u,{asChild:!0,container:i,children:r})})})};F.displayName=N;var I=`PopoverContent`,L=S.forwardRef((e,t)=>{let n=ae(I,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=D(I,e.__scopePopover);return(0,C.jsx)(_,{present:r||a.open,children:a.modal?(0,C.jsx)(z,{...i,ref:t}):(0,C.jsx)(B,{...i,ref:t})})});L.displayName=I;var R=t(`PopoverContent.RemoveScroll`),z=S.forwardRef((e,t)=>{let r=D(I,e.__scopePopover),i=S.useRef(null),a=n(t,i),o=S.useRef(!1);return S.useEffect(()=>{let e=i.current;if(e)return g(e)},[]),(0,C.jsx)(p,{as:R,allowPinchZoom:!0,children:(0,C.jsx)(V,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:h(e.onCloseAutoFocus,e=>{e.preventDefault(),o.current||r.triggerRef.current?.focus()}),onPointerDownOutside:h(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;o.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:h(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),B=S.forwardRef((e,t)=>{let n=D(I,e.__scopePopover),r=S.useRef(!1),i=S.useRef(!1);return(0,C.jsx)(V,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),V=S.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,...f}=e,p=D(I,n),h=E(n);return ee(),(0,C.jsx)(s,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,C.jsx)(m,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>p.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,C.jsx)(te,{"data-state":K(p.open),role:`dialog`,id:p.contentId,...h,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),H=`PopoverClose`,U=S.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=D(H,n);return(0,C.jsx)(l.button,{type:`button`,...r,ref:t,onClick:h(e.onClick,()=>i.onOpenChange(!1))})});U.displayName=H;var W=`PopoverArrow`,G=S.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=E(n);return(0,C.jsx)(b,{...i,...r,ref:t})});G.displayName=W;function K(e){return e?`open`:`closed`}var q=O,J=A,oe=M,Y=F,se=L;function X(e){let t=e.visualViewport;return t?Math.max(0,Math.round(e.innerHeight-t.height-t.offsetTop)):0}function ce(e,t,n,r=250){let i=e.visualViewport;if(!i)return t(0),()=>{};let a,o=()=>{let i=X(e);t(i),n&&(clearTimeout(a),a=setTimeout(()=>n(i),r))};return t(X(e)),i.addEventListener(`resize`,o),i.addEventListener(`scroll`,o),()=>{clearTimeout(a),i.removeEventListener(`resize`,o),i.removeEventListener(`scroll`,o),t(0)}}function le(e){let t=e.visualViewport;return t?{top:Math.max(0,Math.round(t.offsetTop)),bottom:X(e)}:{top:0,bottom:0}}function ue(e,t=0){let n=typeof t==`number`?{top:t,right:t,bottom:t,left:t}:t;return{top:(n.top??0)+e.top,right:n.right??0,bottom:(n.bottom??0)+e.bottom,left:n.left??0}}function de(e,t){let n=e.visualViewport;if(!n)return t({top:0,bottom:0}),()=>{};let r=()=>t(le(e));return r(),n.addEventListener(`resize`,r),n.addEventListener(`scroll`,r),()=>{n.removeEventListener(`resize`,r),n.removeEventListener(`scroll`,r)}}function fe(){let[e,t]=(0,S.useState)({top:0,bottom:0});return(0,S.useEffect)(()=>de(window,e=>t(t=>t.top===e.top&&t.bottom===e.bottom?t:e)),[]),e}function pe(e){let t=(0,S.useRef)(e);t.current=e,(0,S.useEffect)(()=>{let e=document.documentElement;return ce(window,t=>e.style.setProperty(`--kb`,`${t}px`),e=>t.current?.(e))},[])}var me=new Set([``,`text`,`search`,`email`,`url`,`tel`,`password`,`number`]);function he(e){if(!e||typeof e!=`object`)return!1;let t=e,n=t.tagName?.toUpperCase();return n===`TEXTAREA`?!0:n===`INPUT`?me.has((t.type??``).toLowerCase()):t.isContentEditable===!0}var Z=new WeakMap;function ge(e){let t=Z.get(e),n=t&&t.width===e.innerWidth?Math.max(t.height,e.innerHeight):e.innerHeight;return Z.set(e,{width:e.innerWidth,height:n}),n-e.innerHeight}function _e(e){let t=ge(e),n=e.visualViewport?.scale??1;return Math.abs(n-1)<.05&&X(e)>80||t>80&&he(e.document?.activeElement)}function ve(){let[e,t]=(0,S.useState)(!1);return(0,S.useEffect)(()=>{let e=window,n=()=>t(_e(e));n();let r=e.visualViewport;return r?.addEventListener(`resize`,n),r?.addEventListener(`scroll`,n),window.addEventListener(`resize`,n),document.addEventListener(`focusin`,n),document.addEventListener(`focusout`,n),()=>{r?.removeEventListener(`resize`,n),r?.removeEventListener(`scroll`,n),window.removeEventListener(`resize`,n),document.removeEventListener(`focusin`,n),document.removeEventListener(`focusout`,n)}},[]),e}var Q=S.createContext(null);function ye({...e}){let t=S.useRef(!1);return(0,C.jsx)(Q,{value:t,children:(0,C.jsx)(q,{"data-slot":`popover`,...e})})}function be({onPointerDownCapture:e,onKeyDownCapture:t,...n}){let r=S.useContext(Q);return(0,C.jsx)(oe,{"data-slot":`popover-trigger`,...n,onPointerDownCapture:t=>{r&&(r.current=t.pointerType===`touch`),e?.(t)},onKeyDownCapture:e=>{r&&(r.current=!1),t?.(e)}})}function xe({className:e,align:t=`center`,sideOffset:n=4,collisionPadding:i,onOpenAutoFocus:a,...o}){let s=fe(),c=S.useContext(Q);return(0,C.jsx)(Y,{children:(0,C.jsx)(se,{"data-slot":`popover-content`,align:t,sideOffset:n,onOpenAutoFocus:e=>{let t=c?.current;if(c&&(c.current=!1),a?.(e),e.defaultPrevented||!t)return;let n=e.target;n instanceof HTMLElement&&n.querySelector(`[cmdk-input]`)&&(e.preventDefault(),n.focus({preventScroll:!0}))},collisionPadding:ue(s,i),className:r(`z-50 w-72 max-w-(--radix-popover-content-available-width) [overflow-wrap:anywhere] origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,e),...o})})}function $({...e}){return(0,C.jsx)(J,{"data-slot":`popover-anchor`,...e})}export{pe as a,be as i,$ as n,ve as o,xe as r,ne as s,ye as t};
|