cezarion 0.18.0-dev.8244 → 0.18.0-dev.8263
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 +3 -3
- package/web/dist/assets/accounts-section-DsnFNCVP.js +1 -0
- package/web/dist/assets/activity-motion-CpU6YFPU.js +2 -0
- package/web/dist/assets/{activity-route-D84XrmQO.js → activity-route-BtxcuDc0.js} +1 -1
- package/web/dist/assets/{agent-config-section-Btyd_I6J.js → agent-config-section-BFwA04cy.js} +2 -2
- package/web/dist/assets/agent-defaults-section-D6IPIUea.js +1 -0
- package/web/dist/assets/appearance-CozDBhRc.js +1 -0
- package/web/dist/assets/{archive-on-merge-field-BMxl0_RG.js → archive-on-merge-field-Dx8afb0D.js} +1 -1
- package/web/dist/assets/attention-VcsXbAZz.js +1 -0
- package/web/dist/assets/automations-route-Ry60a8sC.js +1 -0
- package/web/dist/assets/commit-diff-panel-pgCLyrNX.js +1 -0
- package/web/dist/assets/{diff-K_Xswloe.js → diff-CnAlvkju.js} +2 -2
- package/web/dist/assets/{diff-view-DQOZSURG.js → diff-view-IQvUTtRr.js} +1 -1
- package/web/dist/assets/file-preview-CZjDTemy.js +2 -0
- package/web/dist/assets/folder-browser-DJd_sQFq.js +1 -0
- package/web/dist/assets/{git-toolbar-DfFwDI49.js → git-toolbar-BQ66aD9z.js} +1 -1
- package/web/dist/assets/github-7UFDrLUe.js +1 -0
- package/web/dist/assets/global-activity-route-Dr3AS_BP.js +1 -0
- package/web/dist/assets/index-C5aVDcjv.js +21 -0
- package/web/dist/assets/label-HRVFTN4V.js +1 -0
- package/web/dist/assets/live-reads-Djkq38NT.js +1 -0
- package/web/dist/assets/{markdown-POxkTBG0.js → markdown-DTnUu-dT.js} +1 -1
- package/web/dist/assets/{notifications-section-B-lcEfAs.js → notifications-section-BVUoGPFj.js} +1 -1
- package/web/dist/assets/{open-in-menu-szYIrLlc.js → open-in-menu-BeAj_aq3.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-DeAYL6ND.js → preview-pane-connected-B4Zu-lJi.js} +1 -1
- package/web/dist/assets/project-location-DJEH4PmN.js +1 -0
- package/web/dist/assets/{project-router-BYHPCHz0.js → project-router-C6zhlnwO.js} +1 -1
- package/web/dist/assets/{project-scope-context-C0FJXpqD.js → project-scope-context-d3J3hWPR.js} +1 -1
- package/web/dist/assets/projects-section-CIDk8n0P.js +1 -0
- package/web/dist/assets/prompt-templates-section-BE0EMMl2.js +1 -0
- package/web/dist/assets/queries-dnpdX9VT.js +1 -0
- package/web/dist/assets/{reference-chip-jyOBNGWj.js → reference-chip-DHWnJcWz.js} +1 -1
- package/web/dist/assets/remote-settings-notice-BCWXxM6g.js +1 -0
- package/web/dist/assets/repo-git-DwrG03Ww.js +1 -0
- package/web/dist/assets/report-reader-Mew6trDs.js +1 -0
- package/web/dist/assets/reports-XoTtaTdw.js +1 -0
- package/web/dist/assets/{resources-section-Dzqw_Eh_.js → resources-section-CKfUOEMU.js} +1 -1
- package/web/dist/assets/run-header-Brb5L23m.js +2 -0
- package/web/dist/assets/settings-agent-picker-kO11YmnR.js +1 -0
- package/web/dist/assets/settings-shell-C8CoTe7B.js +1 -0
- package/web/dist/assets/sidebar-section-CrCVthxb.js +1 -0
- package/web/dist/assets/{skills-Df3f4tt8.js → skills-BBouXQ5m.js} +1 -1
- package/web/dist/assets/{tab-link-Crlr5m1D.js → tab-link-Cq8g7cFx.js} +1 -1
- package/web/dist/assets/task-changes-CKHQh1Rt.js +1 -0
- package/web/dist/assets/task-commits-CyY7us4B.js +1 -0
- package/web/dist/assets/{task-files-YaD4DU-8.js → task-files-UQO8pCfL.js} +1 -1
- package/web/dist/assets/task-github-item-F6d6OnYG.js +1 -0
- package/web/dist/assets/{task-groups-CZPi6W0m.js → task-groups-BF7_ZZTh.js} +1 -1
- package/web/dist/assets/task-thread-BOLKtrKe.js +9 -0
- package/web/dist/assets/{tasks-table-Cim2-KSS.js → tasks-table-CzLkD-kr.js} +1 -1
- package/web/dist/assets/{thread-state-C3QKqNMn.js → thread-state-DZGF-q3x.js} +1 -1
- package/web/dist/assets/use-hand-to-agent-state-DSzi-s1y.js +1 -0
- package/web/dist/assets/{useInfiniteQuery-waSOS4EO.js → useInfiniteQuery-qJcgwcf9.js} +1 -1
- package/web/dist/assets/useQuery-CkUPLiaa.js +1 -0
- package/web/dist/assets/workflows-DQllQH0_.js +7 -0
- package/web/dist/assets/workspace-tools-CpbyIxhx.js +1 -0
- package/web/dist/assets/{worktrees-section-Dhlt22RI.js → worktrees-section-Dce9owPY.js} +4 -4
- package/web/dist/index.html +14 -14
- package/web/dist/assets/accounts-section-DpX5vTr7.js +0 -1
- package/web/dist/assets/activity-motion-B7vHpK-u.js +0 -2
- package/web/dist/assets/agent-defaults-section-D42khLKT.js +0 -1
- package/web/dist/assets/appearance-BdWvRErI.js +0 -1
- package/web/dist/assets/attention-BiqSbE32.js +0 -1
- package/web/dist/assets/automations-route-CVK-f13I.js +0 -1
- package/web/dist/assets/commit-diff-panel-DEgRHEFl.js +0 -1
- package/web/dist/assets/file-preview-PwiOYFhV.js +0 -2
- package/web/dist/assets/folder-browser-vE5IBaDD.js +0 -1
- package/web/dist/assets/github-DHOg6-co.js +0 -1
- package/web/dist/assets/global-activity-route-Bx6y-b0h.js +0 -1
- package/web/dist/assets/index-Br3WCnOm.js +0 -21
- package/web/dist/assets/label-uUv3KkFX.js +0 -1
- package/web/dist/assets/project-location-D5yAc-_A.js +0 -1
- package/web/dist/assets/projects-section-B1MB9FoT.js +0 -1
- package/web/dist/assets/prompt-templates-section-C6NTpSpA.js +0 -1
- package/web/dist/assets/queries-CK9ZDDfL.js +0 -1
- package/web/dist/assets/remote-settings-notice-CrHduqnC.js +0 -1
- package/web/dist/assets/repo-git-KGxu_ZKb.js +0 -1
- package/web/dist/assets/report-reader-CnXmsiMI.js +0 -1
- package/web/dist/assets/reports-CzsCz6ZC.js +0 -1
- package/web/dist/assets/run-header-BcuJbBox.js +0 -2
- package/web/dist/assets/settings-agent-picker-D9OiVDV3.js +0 -1
- package/web/dist/assets/settings-shell-D9LDT4iY.js +0 -1
- package/web/dist/assets/sidebar-section-BFcDThEN.js +0 -1
- package/web/dist/assets/task-changes-B45GjG50.js +0 -1
- package/web/dist/assets/task-commits-C6_f5ewJ.js +0 -1
- package/web/dist/assets/task-github-item-D1QAOVjQ.js +0 -1
- package/web/dist/assets/task-thread-BoOE1dvx.js +0 -9
- package/web/dist/assets/use-hand-to-agent-state-DGAvwfdj.js +0 -1
- package/web/dist/assets/useQuery-9BEU-yko.js +0 -1
- package/web/dist/assets/workflows-B2pwgXHF.js +0 -7
- package/web/dist/assets/workspace-tools-DfCerd4L.js +0 -1
- package/web/dist/assets/ws-DQjRhoew.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-DSMR_WLb.js";import{q as n}from"./queries-CK9ZDDfL.js";import{t as r}from"./createLucideIcon-BHp8sXmF.js";import{n as i,t as a}from"./moon-CRE9nU5R.js";import{t as o}from"./button-BQ2y4XRB.js";import{Rn as s,ut as c,xn as l}from"./index-Br3WCnOm.js";var u=r(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),d=e(),f=[{value:`system`,label:`System`,icon:i},{value:`light`,label:`Light`,icon:u},{value:`dark`,label:`Dark`,icon:a}],p=[{value:`cezarion`,label:`Squawk`,swatch:`var(--accent-strong)`}],m=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`},{value:`ultra`,label:`Compact for real`}],h=[{value:`narrow`,label:`Narrow`},{value:`wide`,label:`Wide`}];function g({slot:e,label:n,value:r,options:i,onChange:a}){return(0,d.jsx)(`div`,{role:`radiogroup`,"aria-label":n,"data-slot":e,className:`inline-flex w-fit gap-0.5 rounded-md border border-border bg-card p-0.5 max-md:max-w-full max-md:flex-wrap`,children:i.map(e=>{let n=e.value===r;return(0,d.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"data-value":e.value,onClick:()=>a(e.value),className:t(`flex min-h-11 items-center gap-2 rounded-sm px-3 py-1.5 text-[13px] font-medium transition-colors`,n?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[e.icon?(0,d.jsx)(e.icon,{"aria-hidden":`true`,className:`size-3.5`}):null,e.swatch?(0,d.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-border`,style:{background:e.swatch}}):null,e.label]},e.value)})})}function _({title:e,hint:t,children:n}){return(0,d.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,d.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}function v(){let e=n(),{order:t,canReorder:r,reset:i}=l();return!((e.data?.projects.length??0)>1)||t.length===0?null:(0,d.jsx)(_,{title:`Project order`,hint:`The project rail is in the order you dragged it into. Reset puts it back in the order the projects were added. Saved with your workspace, so every browser sees it.`,children:(0,d.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`appearance-project-order-reset`,disabled:!r,onClick:i,className:`w-fit`,children:`Reset order`})})}function y(){let{theme:e,setTheme:t}=s(),{accent:n,density:r,width:i,setAccent:a,setDensity:o,setWidth:l}=c();return(0,d.jsxs)(`div`,{"data-slot":`appearance-section`,className:`flex w-full flex-col gap-7 rounded-lg border border-border bg-card p-5`,children:[(0,d.jsx)(_,{title:`Theme`,hint:`System follows your OS preference. Applies to this browser.`,children:(0,d.jsx)(g,{slot:`appearance-theme`,label:`Theme`,value:e,options:f,onChange:t})}),p.length>1?(0,d.jsx)(_,{title:`Accent`,hint:`The cockpit brand accent. Saved with your workspace appearance.`,children:(0,d.jsx)(g,{slot:`appearance-accent`,label:`Accent`,value:n,options:p,onChange:a})}):null,(0,d.jsx)(_,{title:`Density`,hint:`Compact tightens spacing across the cockpit — text stays the same size.`,children:(0,d.jsx)(g,{slot:`appearance-density`,label:`Density`,value:r,options:m,onChange:o})}),(0,d.jsx)(_,{title:`Reading width`,hint:`Wide lets a task's session and commits use more of the screen. Narrow keeps a comfortable reading column. The Changes tab is always full-width.`,children:(0,d.jsx)(g,{slot:`appearance-width`,label:`Reading width`,value:i,options:h,onChange:l})}),(0,d.jsx)(v,{}),(0,d.jsxs)(`div`,{className:`settings-appearance-preview settings-readout`,children:[(0,d.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`PREVIEW`}),(0,d.jsx)(`p`,{className:`mt-3 text-base`,children:`Review finalization retries`}),(0,d.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Needs you · Squawk · Task `,`#`,`227`]}),(0,d.jsx)(`span`,{className:`mt-3 inline-flex rounded-md border border-accent-strong/30 bg-accent-strong/10 px-4 py-3 text-xs text-accent-text`,children:`Open task`})]}),(0,d.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`Changes apply immediately. Theme is browser-local; density and reading width are saved with your workspace.`})]})}export{y as AppearanceSection};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{En as e,jn as t}from"./project-scope-context-C0FJXpqD.js";function n(n){return e[t(n).bucket]<=e.waiting}export{n as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{t as i}from"./utils-DSMR_WLb.js";import{$n as a,D as o,H as s,Rr as c,U as l,W as u,Xr as d,Zn as f,Zr as p,an as m,dn as h,er as g,i as _,nr as v,p as y,rn as b,u as x,vn as ee,y as te}from"./project-scope-context-C0FJXpqD.js";import{B as S,G as C,H as w,I as T,K as E,N as D,P as O,V as k,W as A,j,z as M}from"./live-protocol-DteqtbyN.js";import{Ht as N,Ut as ne,Vt as re,en as ie,kt as ae,p as oe}from"./queries-CK9ZDDfL.js";import{h as se}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as ce,t as P}from"./label-uUv3KkFX.js";import{I as le,Y as ue,c as de,d as fe,it as pe,l as me,pt as he,ut as ge,y as _e}from"./design-icons-CzEoMH9c.js";import{n as ve,r as ye}from"./dist-C28wFbz0.js";import{t as F}from"./button-BQ2y4XRB.js";import{a as I,n as be}from"./dist-BW234Kg5.js";import{a as L,i as xe,n as R,r as z,t as Se}from"./dist-C5mlVBmd.js";import{h as Ce,m as we}from"./dropdown-menu-4e2iKSMT.js";import{a as Te,c as Ee,i as De,l as Oe,n as ke,o as Ae,r as je,t as Me,u as Ne}from"./es2015-CQth82uv.js";import{n as Pe,r as Fe,t as Ie}from"./collapsible-BEV4FO-1.js";import{n as Le,t as Re}from"./switch-Bv2Zf1uU.js";import{a as ze,i as Be,n as Ve,r as He,t as Ue}from"./dist-BAoXdNsT.js";import{c as We,s as Ge,t as B}from"./project-router-BYHPCHz0.js";import{t as Ke}from"./centered-state-V15AR_qo.js";import{Cn as qe,G as Je,J as Ye,N as Xe,O as Ze,Un as V,W as Qe,_n as $e,bn as et,er as tt,k as nt,q as rt,r as it,t as at,wn as ot}from"./index-Br3WCnOm.js";import{_ as st,a as ct,c as lt,d as ut,f as dt,g as ft,h as pt,i as mt,l as ht,m as gt,n as _t,o as vt,p as yt,r as bt,s as xt,t as St,u as Ct,v as wt}from"./automation-format-CUP262Tk.js";import{t as Tt}from"./textarea-vJt9undk.js";function Et(e,[t,n]){return Math.min(n,Math.max(t,e))}var H=e(t(),1),Dt=e(n(),1),U=r(),Ot=[` `,`Enter`,`ArrowUp`,`ArrowDown`],kt=[` `,`Enter`],W=`Select`,[At,jt,Mt]=Ce(W),[G,Nt]=xe(W,[Mt,ze]),Pt=ze(),[Ft,K]=G(W),[It,Lt]=G(W),Rt=`SelectProvider`;function zt(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:h}=e,g=Pt(t),[_,v]=H.useState(null),[y,b]=H.useState(null),[x,ee]=H.useState(!1),te=we(l),[S,C]=Se({prop:r,defaultProp:i??!1,onChange:a,caller:W}),[w,T]=Se({prop:o,defaultProp:s,onChange:c,caller:W}),E=H.useRef(null),D=H.useRef(w);H.useEffect(()=>{let e=m?_?.ownerDocument.getElementById(m):_?.form;if(e instanceof HTMLFormElement){let t=()=>T(D.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[m,_,T]);let O=!_||!!m||!!_.closest(`form`),[k,A]=H.useState(new Set),j=Oe(),M=Array.from(k).map(e=>e.props.value).join(`;`),N=H.useCallback(e=>{A(t=>new Set(t).add(e))},[]),ne=H.useCallback(e=>{A(t=>{let n=new Set(t);return n.delete(e),n})},[]),re={required:p,trigger:_,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:ee,contentId:j,value:w,onValueChange:T,open:S,onOpenChange:C,dir:te,triggerPointerDownPosRef:E,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:k,nativeSelectKey:M,isFormControl:O};return(0,U.jsx)(Be,{...g,children:(0,U.jsx)(Ft,{scope:t,...re,children:(0,U.jsx)(At.Provider,{scope:t,children:(0,U.jsx)(It,{scope:t,onNativeOptionAdd:N,onNativeOptionRemove:ne,children:Ln(h)?h(re):n})})})})}zt.displayName=Rt;var Bt=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,U.jsx)(zt,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,U.jsxs)(U.Fragment,{children:[n,e?(0,U.jsx)(In,{__scopeSelect:t}):null]})})};Bt.displayName=W;var Vt=`SelectTrigger`,Ht=H.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Pt(n),o=K(Vt,n),s=o.disabled||r,c=I(t,o.onTriggerChange),l=jt(n),u=H.useRef(`touch`),[d,f,p]=zn(e=>{let t=l().filter(e=>!e.disabled),n=Bn(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,U.jsx)(Ue,{asChild:!0,...a,children:(0,U.jsx)(L.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":Rn(o.value)?``:void 0,...i,ref:c,onClick:z(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:z(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:z(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&Ot.includes(e.key)&&(m(),e.preventDefault())})})})});Ht.displayName=Vt;var Ut=`SelectValue`,Wt=H.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=K(Ut,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=I(t,c.onValueNodeChange);R(()=>{l(u)},[l,u]);let f=Rn(c.value);return(0,U.jsx)(L.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,U.jsx)(H.Fragment,{children:f?o:a},f?`placeholder`:`value`)})});Wt.displayName=Ut;var Gt=`SelectIcon`,Kt=H.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,U.jsx)(L.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});Kt.displayName=Gt;var qt=`SelectPortal`,[Jt,Yt]=G(qt,{forceMount:void 0}),Xt=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,U.jsx)(Jt,{scope:e.__scopeSelect,forceMount:n,children:(0,U.jsx)(De,{asChild:!0,...r})})};Xt.displayName=qt;var q=`SelectContent`,Zt=H.forwardRef((e,t)=>{let n=Yt(q,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=K(q,e.__scopeSelect),[o,s]=H.useState();return R(()=>{s(new DocumentFragment)},[]),(0,U.jsx)(Ne,{present:r||a.open,children:({present:e})=>e?(0,U.jsx)(nn,{...i,ref:t}):(0,U.jsx)(Qt,{...i,fragment:o})})});Zt.displayName=q;var Qt=H.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?Dt.createPortal((0,U.jsx)($t,{scope:n,children:(0,U.jsx)(At.Slot,{scope:n,children:(0,U.jsx)(`div`,{ref:t,children:r})})}),i):null});Qt.displayName=`SelectContentFragment`;var J=10,[$t,Y]=G(q),en=`SelectContentImpl`,tn=be(`SelectContent.RemoveScroll`),nn=H.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=K(q,n),[y,b]=H.useState(null),[x,ee]=H.useState(null),te=I(t,b),[S,C]=H.useState(null),[w,T]=H.useState(null),E=jt(n),[D,O]=H.useState(!1),k=H.useRef(!1);H.useEffect(()=>{if(y)return Me(y)},[y]),je();let A=H.useCallback(e=>{let[t,...n]=E().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[E,x]),j=H.useCallback(()=>A([S,y]),[A,S,y]);H.useEffect(()=>{D&&j()},[D,j]);let{onOpenChange:M,triggerPointerDownPosRef:N}=v;H.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(N.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(N.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(y)||M(!1),document.removeEventListener(`pointermove`,t),N.current=null};return N.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,M,N]),H.useEffect(()=>{let e=()=>M(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[M]);let[ne,re]=zn(e=>{let t=E().filter(e=>!e.disabled),n=Bn(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),ie=H.useCallback((e,t,n)=>{let r=!k.current&&!n;(v.value!==void 0&&v.value===t||r)&&(C(e),r&&(k.current=!0))},[v.value]),ae=H.useCallback(()=>y?.focus(),[y]),oe=H.useCallback((e,t,n)=>{let r=!k.current&&!n;(v.value!==void 0&&v.value===t||r)&&T(e)},[v.value]),se=r===`popper`?sn:an,ce=se===sn?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,U.jsx)($t,{scope:n,content:y,viewport:x,onViewportChange:ee,itemRefCallback:ie,selectedItem:S,onItemLeave:ae,itemTextRefCallback:oe,focusSelectedItem:j,selectedItemText:w,position:r,isPositioned:D,searchRef:ne,children:(0,U.jsx)(ke,{as:tn,allowPinchZoom:!0,children:(0,U.jsx)(Te,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:z(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,U.jsx)(Ae,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,U.jsx)(se,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...ce,onPlaced:()=>O(!0),ref:te,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:z(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&re(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=E().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>A(t)),e.preventDefault()}})})})})})})});nn.displayName=en;var rn=`SelectItemAlignedPosition`,an=H.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=K(q,n),o=Y(q,n),[s,c]=H.useState(null),[l,u]=H.useState(null),d=I(t,u),f=jt(n),p=H.useRef(!1),m=H.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=H.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-J,d=Et(a,[J,Math.max(J,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-J,d=Et(a,[J,Math.max(J,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-J*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,ee=Math.min(g.offsetHeight*5,x),te=window.getComputedStyle(h),S=parseInt(te.paddingTop,10),C=parseInt(te.paddingBottom,10),w=e.top+e.height/2-J,T=c-w,E=g.offsetHeight/2,D=g.offsetTop+E,O=m+v+D,k=x-O;if(O<=w){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=O+Math.max(T,E+(e?C:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(w,m+h.offsetTop+(e?S:0)+E)+k;s.style.height=t+`px`,h.scrollTop=O-w+h.offsetTop}s.style.margin=`${J}px 0`,s.style.minHeight=ee+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);R(()=>y(),[y]);let[b,x]=H.useState();return R(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,U.jsx)(cn,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:H.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,U.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,U.jsx)(L.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});an.displayName=rn;var on=`SelectPopperPosition`,sn=H.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=J,...a}=e,o=Pt(n);return(0,U.jsx)(He,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});sn.displayName=on;var[cn,ln]=G(q,{}),un=`SelectViewport`,dn=H.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Y(un,n),o=ln(un,n),s=I(t,a.onViewportChange),c=H.useRef(0);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,U.jsx)(At.Slot,{scope:n,children:(0,U.jsx)(L.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:z(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-J*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});dn.displayName=un;var fn=`SelectGroup`,[pn,mn]=G(fn),hn=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Oe();return(0,U.jsx)(pn,{scope:n,id:i,children:(0,U.jsx)(L.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});hn.displayName=fn;var gn=`SelectLabel`,_n=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=mn(gn,n);return(0,U.jsx)(L.div,{id:i.id,...r,ref:t})});_n.displayName=gn;var vn=`SelectItem`,[yn,bn]=G(vn),xn=H.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=K(vn,n),c=Y(vn,n),l=s.value===r,[u,d]=H.useState(a??``),[f,p]=H.useState(!1),m=I(t,Ee(e=>c.itemRefCallback?.(e,r,i))),h=Oe(),g=H.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,U.jsx)(yn,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:H.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,U.jsx)(At.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,U.jsx)(L.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:z(o.onFocus,()=>p(!0)),onBlur:z(o.onBlur,()=>p(!1)),onClick:z(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:z(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:z(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:z(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:z(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:z(o.onKeyDown,e=>{i||e.target!==e.currentTarget||c.searchRef?.current!==``&&e.key===` `||(kt.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});xn.displayName=vn;var Sn=`SelectItemText`,Cn=H.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=K(Sn,n),s=Y(Sn,n),c=bn(Sn,n),l=Lt(Sn,n),[u,d]=H.useState(null),f=Ee(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=I(t,d,c.onItemTextChange,f),m=u?.textContent,h=H.useMemo(()=>(0,U.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return R(()=>(g(h),()=>_(h)),[g,_,h]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(L.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Rn(o.value)?Dt.createPortal(a.children,o.valueNode):null]})});Cn.displayName=Sn;var wn=`SelectItemIndicator`,Tn=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return bn(wn,n).isSelected?(0,U.jsx)(L.span,{"aria-hidden":!0,...r,ref:t}):null});Tn.displayName=wn;var En=`SelectScrollUpButton`,Dn=H.forwardRef((e,t)=>{let n=Y(En,e.__scopeSelect),r=ln(En,e.__scopeSelect),[i,a]=H.useState(!1),o=I(t,r.onScrollButtonChange);return R(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,U.jsx)(An,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Dn.displayName=En;var On=`SelectScrollDownButton`,kn=H.forwardRef((e,t)=>{let n=Y(On,e.__scopeSelect),r=ln(On,e.__scopeSelect),[i,a]=H.useState(!1),o=I(t,r.onScrollButtonChange);return R(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,U.jsx)(An,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});kn.displayName=On;var An=H.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Y(`SelectScrollButton`,n),o=H.useRef(null),s=jt(n),c=H.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return H.useEffect(()=>()=>c(),[c]),R(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,U.jsx)(L.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:z(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:z(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:z(i.onPointerLeave,()=>{c()})})}),jn=`SelectSeparator`,Mn=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,U.jsx)(L.div,{"aria-hidden":!0,...r,ref:t})});Mn.displayName=jn;var Nn=`SelectArrow`,Pn=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Pt(n);return Y(Nn,n).position===`popper`?(0,U.jsx)(Ve,{...i,...r,ref:t}):null});Pn.displayName=Nn;var Fn=`SelectBubbleInput`,In=H.forwardRef(({__scopeSelect:e,...t},n)=>{let r=K(Fn,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=H.useRef(null),m=I(n,p),h=i??``,g=Le(h),_=Array.from(d).some(e=>(e.props.value??``)===``);return H.useEffect(()=>{let e=p.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(g!==h&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,h),e.dispatchEvent(t)}},[g,h]),(0,U.jsxs)(L.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...ve,...t.style},ref:m,defaultValue:h,children:[Rn(i)&&!_?(0,U.jsx)(`option`,{value:``}):null,Array.from(d)]},f)});In.displayName=Fn;function Ln(e){return typeof e==`function`}function Rn(e){return e===``||e===void 0}function zn(e){let t=Ee(e),n=H.useRef(``),r=H.useRef(0),i=H.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=H.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return H.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function Bn(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Vn(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Vn(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Hn=j([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),Un=S({includeExisting:O().optional(),authors:D(A()).optional(),assignees:D(A()).optional(),requireCurrentLabels:O().optional(),allLabels:D(A()).optional(),anyLabels:D(A()).optional(),excludeLabels:D(A()).optional(),changedLabels:D(A()).optional(),lookbackDays:M(),maxRecords:M()}),Wn=j([`github`,`schedule`]),Gn=f.omit({task:!0,images:!0,systemPrompt:!0}).extend({prompt:A(),variants:C([T(1),T(2),T(3)]).optional(),systemPrompt:A().optional()}),Kn=S({at:A(),outcome:j([`launched`,`cancelled`]),runId:A().optional(),receiptId:A().optional(),trigger:j([`schedule`,`late`,`manual`,`retry`]).optional()}),qn=S({id:A(),revision:M(),name:A(),description:A().optional(),enabled:O(),kind:Wn,events:D(Hn).optional(),intervalSeconds:M().optional(),filters:Un.optional(),schedule:lt.optional(),task:Gn,archived:Kn.optional(),createdAt:A(),updatedAt:A()}),Jn=S({timestamp:A(),tieBreaker:A().optional()}),Yn=S({since:A().datetime(),until:A().datetime(),source:M().int().min(0).max(2),page:M().int().min(1).max(10),item:M().int().min(0).max(100),event:M().int().min(0).max(1e3),cursor:Jn.optional()}),Xn={lastError:A().max(1e3).optional(),lastErrorAt:A().datetime().optional()},Zn=S({revision:M().optional(),baselineAt:A().optional(),armedAt:A().optional(),historyScan:Yn.optional(),cursor:Jn.optional(),frozenHighWatermark:Jn.extend({tieBreaker:A()}).optional(),backlogAfter:Jn.extend({tieBreaker:A()}).optional(),nextCheckAt:A().optional(),lastSuccessAt:A().optional(),nextRunAt:A().optional(),lastRunAt:A().optional(),etags:w(A(),A()).optional(),backoffUntil:A().optional(),consecutiveFailures:M().optional(),...Xn,onceOutcome:j([`failed`,`missed`]).optional()});function Qn(e){let t=e?.consecutiveFailures??0;if(!(t<3||!e?.lastError))return{consecutiveFailures:t,lastError:e.lastError,...e.lastErrorAt?{lastErrorAt:e.lastErrorAt}:{},...e.backoffUntil?{retryAt:e.backoffUntil}:{}}}var $n=j([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]),er=S({seq:M(),ts:A(),automationId:A(),revision:M(),event:Hn.optional(),result:$n,reason:A().optional(),durationMs:M().optional(),receiptId:A().optional(),runId:A().optional(),githubNumber:M().optional(),githubTitle:A().optional(),githubUrl:A().optional(),rateLimit:S({bucket:j([`core`,`search`]),remaining:M().optional(),resetAt:A().optional()}).optional()}),tr=S({matches:M(),launched:M(),duplicates:M(),errors:M()}),nr=qn.extend({state:Zn.optional(),latestLog:er.optional(),counts:tr,nextRunAt:A().optional(),onceStatus:yt.optional()});S({available:O(),reason:A().optional(),timeZone:A(),scheduler:S({state:j([`scheduled`,`idle`]),nextDue:A().optional()}),automations:D(nr)}),S({automation:qn}).extend({once:S({dueAt:A(),timeZone:A(),resolvedInstant:A(),note:A()}).optional()}),S({automation:qn,state:Zn.optional(),latestLog:er.optional(),onceStatus:yt.optional()}),S({id:A(),automationId:A(),mode:j([`preview`,`execute`]),status:j([`queued`,`running`,`complete`,`error`]),createdAt:A(),completedAt:A().optional(),matches:M().optional(),truncated:O().optional(),error:A().optional()}),S({checkId:A()}),S({records:D(er)}),S({receiptId:A(),runId:A()}),S({runId:A()}),qn.omit({id:!0,revision:!0,createdAt:!0,updatedAt:!0,enabled:!0,kind:!0,archived:!0}).extend({kind:Wn.optional(),task:Gn.omit({variants:!0}).strict(),enable:O().optional()}).omit({enable:!0}).extend({enabled:O().optional(),expectedRevision:M()}),S({archived:j([`include`,`only`]).optional()}),S({mode:j([`preview`,`execute`])});function rr({...e}){return(0,U.jsx)(Bt,{"data-slot":`select`,...e})}function ir({...e}){return(0,U.jsx)(Wt,{"data-slot":`select-value`,...e})}function ar({className:e,size:t=`default`,children:n,...r}){return(0,U.jsxs)(Ht,{"data-slot":`select-trigger`,"data-size":t,className:i(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-[var(--task-brand-bg)] px-3 py-2 text-sm whitespace-nowrap shadow-none transition-[color,box-shadow] outline-hidden focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-11 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 pointer-hover:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,U.jsx)(Kt,{asChild:!0,children:(0,U.jsx)(me,{className:`size-4 opacity-50`})})]})}function or({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...a}){return(0,U.jsx)(Xt,{children:(0,U.jsxs)(Zt,{"data-slot":`select-content`,className:i(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md 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`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...a,children:[(0,U.jsx)(cr,{}),(0,U.jsx)(dn,{className:i(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,U.jsx)(lr,{})]})})}function sr({className:e,children:t,...n}){return(0,U.jsxs)(xn,{"data-slot":`select-item`,className:i(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pe-8 ps-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,U.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute end-2 flex size-3.5 items-center justify-center`,children:(0,U.jsx)(Tn,{children:(0,U.jsx)(de,{className:`size-4`})})}),(0,U.jsx)(Cn,{children:t})]})}function cr({className:e,...t}){return(0,U.jsx)(Dn,{"data-slot":`select-scroll-up-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,U.jsx)(fe,{className:`size-4`})})}function lr({className:e,...t}){return(0,U.jsx)(kn,{"data-slot":`select-scroll-down-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,U.jsx)(me,{className:`size-4`})})}function X({title:e,subtitle:t,action:n,children:r}){return(0,U.jsxs)(`main`,{"data-route":`automations`,className:`task-flow-page w-full max-w-full min-w-0 max-md:p-4!`,children:[(0,U.jsxs)(`header`,{className:`mb-6 flex flex-col items-start gap-5 max-md:mb-4 max-md:gap-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h1`,{className:`mb-2 text-[28px] font-medium max-md:text-[22px]`,children:e}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]}),n]}),r]})}function Z({text:e}){return(0,U.jsx)(`div`,{role:`status`,className:`rounded-xl border bg-card p-6 text-sm text-muted-foreground`,children:e})}var ur={launched:`success`,manual:`success`,"catch-up":`success`,skipped:`neutral`,missed:`neutral`,"no-match":`neutral`,preview:`neutral`,baseline:`neutral`,duplicate:`neutral`,failed:`danger`,error:`danger`,"rate-limited":`danger`},dr={launched:`Launched`,manual:`Manual`,"catch-up":`Catch up`,skipped:`Skipped`,missed:`Missed`,"no-match":`No match`,preview:`Preview`,baseline:`Baseline`,duplicate:`Duplicate`,failed:`Failed`,error:`Error`,"rate-limited":`Rate limited`};function fr(e){let[t,n]=(0,H.useState)(),[r,i]=(0,H.useState)(``),a=(0,H.useCallback)(t=>l(e,{signal:t}).then(({records:e})=>{t?.aborted||(n(e),i(``))}).catch(e=>{t?.aborted||i(String(e))}),[e]);return(0,H.useEffect)(()=>{a()},[a]),(0,H.useEffect)(()=>c(a),[a]),(0,H.useEffect)(()=>ce((t,n)=>{t===`automation-change`&&n.automationId===e&&a()}),[e,a]),{records:t,error:r,refresh:a}}function pr(e,t){return e.result!==`failed`&&e.result!==`error`||!e.receiptId||e.runId?!1:!t.some(t=>t.receiptId===e.receiptId&&(t.runId||t.seq>e.seq))}function mr({records:e,all:t,timeZone:n,onRetried:r,readOnly:i=!1}){let a=e=>!i&&pr(e,t),[o,s]=(0,H.useState)(),[c,l]=(0,H.useState)(),u=Date.now(),d=async e=>{s(e),l(void 0);try{await b(e),r()}catch(t){l({receiptId:e,message:t instanceof Error?t.message:String(t)})}finally{s(void 0)}};return(0,U.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:e.map(e=>(0,U.jsxs)(`li`,{className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,U.jsx)(it,{dot:ur[e.result],children:dr[e.result]}),(0,U.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,title:e.ts,children:_t(e.ts,n,u)})]}),e.reason?(0,U.jsx)(`p`,{className:`mt-2 text-sm break-words text-muted-foreground`,children:e.reason}):null,e.githubUrl||e.runId||a(e)?(0,U.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-sm`,children:[e.githubUrl?(0,U.jsx)(`a`,{className:`inline-flex min-h-11 items-center underline underline-offset-4 break-all`,href:e.githubUrl,target:`_blank`,rel:`noreferrer`,children:e.githubTitle??`GitHub #${e.githubNumber??``}`}):null,e.runId?(0,U.jsx)(B,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`}):null,a(e)?(0,U.jsx)(F,{variant:`outline`,disabled:o===e.receiptId,onClick:()=>void d(e.receiptId),children:`Retry task`}):null]}):null,c&&c.receiptId===e.receiptId?(0,U.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm break-words text-destructive`,children:c.message}):null]},e.seq))})}var hr=`all`;function gr({label:e,value:t,onChange:n,options:r}){return(0,U.jsxs)(rr,{value:t,onValueChange:n,children:[(0,U.jsx)(ar,{"aria-label":e,className:`w-full sm:w-52`,children:(0,U.jsx)(ir,{})}),(0,U.jsx)(or,{children:r.map(e=>(0,U.jsx)(sr,{value:e.value,children:e.label},e.value))})]})}function _r({automationId:e,automationName:t,timeZone:n,readOnly:r=!1}){let{records:i,error:a,refresh:o}=fr(e),[s,c]=(0,H.useState)(hr),[l,u]=(0,H.useState)(hr),d=(0,H.useMemo)(()=>(i??[]).filter(e=>(s===hr||e.result===s)&&(l===hr||e.event===l)),[i,s,l]),f=(i??[]).some(e=>e.event);return(0,U.jsx)(X,{title:`Execution log`,subtitle:t??`Automation activity`,action:(0,U.jsx)(F,{variant:`outline`,asChild:!0,children:(0,U.jsx)(B,{to:`/automations`,children:`Back to automations`})}),children:a&&!i?(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,U.jsx)(Z,{text:a}),(0,U.jsx)(F,{variant:`outline`,onClick:()=>void o(),children:`Retry`})]}):i?i.length===0?(0,U.jsx)(Z,{text:`Nothing has run yet.`}):(0,U.jsxs)(`div`,{className:`grid gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(gr,{label:`Result`,value:s,onChange:c,options:[{value:hr,label:`All results`},...$n.options.map(e=>({value:e,label:dr[e]}))]}),f?(0,U.jsx)(gr,{label:`Event`,value:l,onChange:u,options:[{value:hr,label:`All events`},...Hn.options.map(e=>({value:e,label:e}))]}):null]}),d.length===0?(0,U.jsx)(Z,{text:`No rows match these filters.`}):(0,U.jsx)(mr,{records:d,all:i,timeZone:n,onRetried:()=>void o(),readOnly:r})]}):(0,U.jsx)(Z,{text:`Loading execution log…`})})}function vr({automationId:e,automationName:t,timeZone:n,showName:r=!1,readOnly:i=!1}){let{records:a,error:o,refresh:s}=fr(e);return(0,U.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`mt-4 min-w-0 border-t pt-4`,children:[(0,U.jsxs)(`h3`,{className:`mb-3 text-sm font-medium`,children:[`Recent activity`,r&&t?` · ${t}`:``]}),o&&!a?(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,U.jsx)(Z,{text:o}),(0,U.jsx)(F,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]}):a?a.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Nothing has run yet.`}):(0,U.jsx)(mr,{records:a.slice(0,5),all:a,timeZone:n,onRetried:()=>void s(),readOnly:i}):(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading activity…`})]})}function yr({automation:e,timeZone:t,onDeleted:n}){let r=e.archived,i=e.schedule,a=i?bt(i):null,[s,c]=(0,H.useState)(!1),[l,u]=(0,H.useState)(!1),[d,f]=(0,H.useState)(``),p=(0,H.useRef)(null),m=(0,H.useRef)(null),h=(0,H.useRef)(null);(0,H.useEffect)(()=>{let e=h.current===`keep`?m.current:h.current===`delete`?p.current:null;h.current=null,e?.focus()},[s]);let g=async()=>{u(!0);try{await o(e.id),n()}catch(e){f(e instanceof Error?e.message:String(e)),u(!1)}},_=[[`Workflow`,e.task.workflow],[`Runner`,e.task.runner],[`Model`,e.task.model],[`Effort`,e.task.effort]];return(0,U.jsx)(X,{title:e.name,subtitle:`Archived one-time schedule. It cannot change; delete it when you no longer need the record.`,children:(0,U.jsxs)(`div`,{className:`grid min-w-0 max-w-3xl gap-5`,children:[(0,U.jsxs)(`section`,{className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,U.jsxs)(`p`,{className:`text-sm break-words`,children:[(0,U.jsx)(`span`,{children:r.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`}),r.runId?(0,U.jsxs)(U.Fragment,{children:[` · `,(0,U.jsx)(B,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${r.runId}`,children:`Open task`})]}):null]}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Archived ${St(r.at,t)} (${t}).`}),a&&i?.timeZone?(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Was due ${a.date} ${a.time} (${i.timeZone}).`}):null]}),(0,U.jsxs)(`section`,{"aria-labelledby":`archived-inputs`,className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,U.jsx)(`h2`,{id:`archived-inputs`,className:`mb-3 text-[15px] font-medium`,children:`What it ran with`}),(0,U.jsxs)(`dl`,{className:`grid gap-3 text-sm`,children:[(0,U.jsxs)(`div`,{className:`grid gap-1`,children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:`Prompt`}),(0,U.jsx)(`dd`,{className:`break-words whitespace-pre-wrap`,children:e.task.prompt})]}),_.filter(([,e])=>e).map(([e,t])=>(0,U.jsxs)(`div`,{className:`grid gap-1`,children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,U.jsx)(`dd`,{className:`break-words`,children:t})]},e))]})]}),(0,U.jsxs)(`section`,{className:`min-w-0`,children:[(0,U.jsx)(vr,{automationId:e.id,automationName:e.name,timeZone:t,readOnly:!0}),(0,U.jsx)(F,{variant:`outline`,asChild:!0,className:`mt-3`,children:(0,U.jsx)(B,{to:`/automations/${e.id}/log`,children:`Execution log`})})]}),(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[s?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? Its record and log are removed; the task stays.`}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(F,{variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:l,onClick:()=>void g(),children:`Delete schedule`}),(0,U.jsx)(F,{ref:m,variant:`outline`,disabled:l,onClick:()=>{h.current=`delete`,c(!1)},children:`Keep`})]})]}):(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(F,{ref:p,variant:`outline`,"data-action":`automation-delete`,onClick:()=>{h.current=`keep`,c(!0)},children:`Delete`}),(0,U.jsx)(F,{variant:`outline`,asChild:!0,children:(0,U.jsx)(B,{to:`/automations`,children:`Back to automations`})})]}),d?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:d}):null]})]})})}var br=j([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),xr=D(A().trim().min(1).max(200)).max(100).optional(),Sr=S({includeExisting:O().optional(),requireCurrentLabels:O().optional(),authors:xr,assignees:xr,allLabels:xr,anyLabels:xr,excludeLabels:xr,changedLabels:xr,lookbackDays:M().int().min(1).max(90).default(7),maxRecords:M().int().min(1).max(100).default(25)}).passthrough(),Cr=S({prompt:A().min(1).max(1e5),workflow:A().trim().min(1).max(200).optional(),steps:D(a).min(1).max(100).optional(),runner:d.optional(),model:A().trim().min(1).max(200).optional(),effort:A().trim().min(1).max(32).optional(),variants:C([T(1),T(2),T(3)]).optional(),worktree:O().optional(),autonomous:O().optional(),...g,...v,systemPrompt:A().max(1e5).optional()}).passthrough().refine(e=>!(e.workflow&&e.steps),{message:`task selects either a named workflow or inline steps, not both`}),wr=new Set(Object.keys(Cr.shape).filter(e=>e!==`variants`));function Tr(e){return Object.fromEntries(Object.entries(e).filter(([e])=>wr.has(e)))}k(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return e;let t=e;return t.kind===`schedule`?e:{...t,intervalSeconds:t.intervalSeconds??300,filters:t.filters??{}}},S({id:A().min(1).max(100),revision:M().int().positive(),name:A().trim().min(1).max(200),description:A().max(2e3).optional(),enabled:O().default(!1),kind:Wn.default(`github`),events:D(br).min(1).max(4).optional(),intervalSeconds:M().int().min(60).max(86400).optional(),filters:Sr.optional(),schedule:lt.passthrough().optional(),task:Cr,archived:S({at:A().datetime(),outcome:j([`launched`,`cancelled`]),runId:A().optional(),receiptId:A().optional(),trigger:j([`schedule`,`late`,`manual`,`retry`]).optional()}).passthrough().optional(),createdAt:A().datetime(),updatedAt:A().datetime()}).passthrough().superRefine((e,t)=>{if(e.kind===`schedule`){e.schedule||t.addIssue({code:p.custom,path:[`schedule`],message:`a scheduled automation needs a schedule`});return}e.events?.length||t.addIssue({code:p.custom,path:[`events`],message:`a GitHub automation needs at least one event`}),e.intervalSeconds===void 0&&t.addIssue({code:p.custom,path:[`intervalSeconds`],message:`a GitHub automation needs a poll interval`}),e.filters||t.addIssue({code:p.custom,path:[`filters`],message:`a GitHub automation needs its bounded filter`}),e.events?.some(e=>e===`issue.labeled`||e===`issue.unlabeled`)&&!e.filters?.changedLabels?.length&&t.addIssue({code:p.custom,path:[`filters`,`changedLabels`],message:`changedLabels is required for issue label events`})})),S({version:T(1).default(1),automations:D(E()).default([]),tombstones:w(A(),A().datetime()).optional()}).passthrough();var Er=S({timestamp:A().datetime(),tieBreaker:A().optional()}).passthrough(),Dr=Yn.extend({cursor:Er.optional()}),Or=S({revision:M().int().positive().optional(),baselineAt:A().datetime().optional(),armedAt:A().datetime().optional(),historyScan:Dr.optional(),cursor:Er.optional(),frozenHighWatermark:Er.extend({tieBreaker:A()}).optional(),backlogAfter:Er.extend({tieBreaker:A()}).optional(),nextCheckAt:A().datetime().optional(),lastSuccessAt:A().datetime().optional(),nextRunAt:A().datetime().optional(),lastRunAt:A().datetime().optional(),etags:w(A(),A()).optional(),backoffUntil:A().datetime().optional(),consecutiveFailures:M().int().nonnegative().optional(),...Xn,onceOutcome:j([`failed`,`missed`]).optional()}).passthrough();S({version:T(1).default(1),states:w(A(),Or).default({})}).passthrough(),S({receiptId:A().min(1),receiptKey:A().min(1),eventId:A().min(1),automationId:A().min(1),revision:M().int().positive(),status:j([`reserved`,`launched`,`launch-error`,`released`]),runId:A().optional(),observedAt:A().datetime(),updatedAt:A().datetime(),error:A().max(2e3).optional(),occurrenceAt:A().datetime().optional(),candidate:S({eventId:A(),event:br,timestamp:A().datetime(),tieBreaker:A(),repo:A(),nodeId:A(),number:M().int().positive(),title:A().max(500),url:A().url(),author:A().max(200),assignees:D(A().max(200)).max(100),labels:D(A().max(200)).max(100),changedLabel:A().max(200).optional()}).passthrough().optional()}).passthrough();var kr=j([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]);S({seq:M().int().positive(),ts:A().datetime(),automationId:A().min(1),revision:M().int().positive(),event:br.optional(),result:kr,reason:A().max(2e3).optional(),durationMs:M().int().nonnegative().optional(),receiptId:A().optional(),runId:A().optional(),githubNumber:M().int().positive().optional(),githubTitle:A().max(500).optional(),githubUrl:A().url().optional(),rateLimit:S({bucket:j([`core`,`search`]),remaining:M().int().nonnegative().optional(),resetAt:A().datetime().optional()}).passthrough().optional()}).passthrough();var Ar=`quick-task`;function jr(e={}){let{prompt:t,workflow:n,runner:r,model:i,autonomous:a,archiveWhenDone:o,autoMergePr:s,allowWorkers:c,allowMessaging:l,...u}=Tr(e.task??{prompt:``}),d=e.task===void 0;return{name:e.name??``,description:e.description??``,kind:e.kind??`schedule`,schedule:Ct(e.schedule??{type:`daily`}),events:e.events??[`issue.opened`],intervalSeconds:e.intervalSeconds??300,filters:e.filters??{lookbackDays:7,maxRecords:25},prompt:t,...n===void 0?d?{workflow:Ar}:{}:{workflow:n},...r===void 0?{}:{runner:r},...i===void 0?{}:{model:i},autonomous:a??!0,archiveWhenDone:o??!1,autoMergePr:s??!1,allowWorkers:c!==!1,allowMessaging:l!==!1,enabled:e.enabled??e.enable??!1,taskExtra:u}}function Mr(e){switch(e.type){case`daily`:case`weekdays`:return{type:e.type,hour:e.hour,minute:e.minute};case`weekly`:return{type:`weekly`,hour:e.hour,minute:e.minute,day:e.day};case`hours`:return{type:`hours`,every:e.every};case`once`:return{type:`once`,at:e.at??``,timeZone:e.timeZone??``,...e.latestStartMinutes===void 0?{}:{latestStartMinutes:e.latestStartMinutes}}}}function Nr(e){return{...e.taskExtra,prompt:e.prompt,...e.workflow?{workflow:e.workflow}:{},...e.runner?{runner:e.runner}:{},...e.model?{model:e.model}:{},autonomous:e.autonomous,...e.archiveWhenDone?{archiveWhenDone:!0}:{},...e.autoMergePr?{autoMergePr:!0}:{},...e.allowWorkers?{}:{allowWorkers:!1},...e.allowMessaging?{}:{allowMessaging:!1}}}function Pr(e){return{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},kind:e.kind,...e.kind===`schedule`?{schedule:Mr(e.schedule)}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:Nr(e)}}function Fr(e){return{...Pr(e),enable:e.enabled}}function Ir(e,t){return{...Pr(e),task:{...Nr(e),archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging},enabled:e.enabled,expectedRevision:t}}function Q(e){return`'${e.replace(/'/g,`'\\''`)}'`}var Lr=new Set([`prompt`,`workflow`,`runner`,`model`,`autonomous`,`worktree`,`archiveWhenDone`,`autoMergePr`,`allowWorkers`,`allowMessaging`]),Rr=new Set([`anyLabels`,`authors`,`changedLabels`]);function zr(e){if(e.description!==void 0||!e.name.trim()||!e.task.prompt.trim())return!1;let t=e.task;if(Object.keys(t).some(e=>!Lr.has(e))||t.archiveWhenDone===!1||t.autoMergePr===!1||t.allowWorkers===!0||t.allowMessaging===!0||t.worktree!==!0)return!1;if(e.kind===`schedule`)return e.schedule!==void 0;let{events:n,filters:r}=e;return!n?.length||n.some(e=>e.includes(`,`))||!r||r.lookbackDays!==7||r.maxRecords!==25?!1:Object.entries(r).every(([e,t])=>e===`lookbackDays`||e===`maxRecords`||e===`includeExisting`&&t===!0||Rr.has(e)&&Array.isArray(t)&&t.length>0)}function Br(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function Vr(e){return e%1440==0?`${e/1440}d`:e%60==0?`${e/60}h`:`${e}m`}function $(e,t){return t.startsWith(`-`)?`--${e}=${Q(t)}`:`--${e} ${Q(t)}`}function Hr(e){let t=[`${$e()} automation add`,$(`name`,e.name)];if(e.schedule?.type===`once`)t.push($(`at`,e.schedule.at),$(`tz`,e.schedule.timeZone)),e.schedule.latestStartMinutes!==void 0&&t.push($(`latest-start`,Vr(e.schedule.latestStartMinutes)));else if(e.kind===`schedule`)t.push($(`cron`,ht(e.schedule)));else{t.push($(`on`,e.events.join(`,`)),`--every ${Br(e.intervalSeconds??300)}`),e.filters?.includeExisting&&t.push(`--include-existing`);for(let n of e.filters?.anyLabels??[])t.push($(`label`,n));for(let n of e.filters?.authors??[])t.push($(`author`,n));for(let n of e.filters?.changedLabels??[])t.push($(`changed-label`,n))}return t.push(...Ur(e.task)),e.enable===!0&&t.push(`--enable`),t.push($(`prompt`,e.task.prompt)),t.join(` `)}function Ur(e){let t=[];return e.workflow&&t.push($(`workflow`,e.workflow)),e.runner&&t.push($(`runner`,e.runner)),e.model&&t.push($(`model`,e.model)),e.autonomous===!1&&t.push(`--no-autonomous`),e.archiveWhenDone&&t.push(`--archive-when-done`),e.autoMergePr&&t.push(`--auto-merge-pr`),e.allowWorkers===!1&&t.push(`--no-workers`),e.allowMessaging===!1&&t.push(`--no-messaging`),t}function Wr(e,t){let n=Fr(e),r=zr(n)?Hr(n):`${$e()} automation create --json ${Q(JSON.stringify(n))}`;return t?`CEZ_COCKPIT_URL=${Q(t.origin)} CEZ_PROJECT_ID=${Q(t.projectId)} HSQ_COCKPIT_URL=${Q(t.origin)} HSQ_PROJECT_ID=${Q(t.projectId)} ${r}`:r}function Gr({draft:e}){let t=Ge(),n=window.location.origin,r=(0,H.useMemo)(()=>Wr(e,t?{origin:n,projectId:t}:void 0),[e,n,t]),[i,a]=(0,H.useState)(`idle`),o=(0,H.useRef)(void 0);(0,H.useEffect)(()=>()=>clearTimeout(o.current),[]),(0,H.useEffect)(()=>a(`idle`),[r]);let s=async()=>{clearTimeout(o.current);try{await navigator.clipboard.writeText(r),a(`copied`),o.current=setTimeout(()=>a(`idle`),1600)}catch{a(`failed`)}};return(0,U.jsxs)(`section`,{"aria-labelledby":`copy-as-cli-heading`,"data-slot":`copy-as-cli`,className:`mbs-4 rounded-xl border bg-card p-4`,children:[(0,U.jsxs)(`div`,{className:`mbe-2 flex items-center gap-2`,children:[(0,U.jsx)(`h2`,{id:`copy-as-cli-heading`,className:`text-[15px] font-medium`,children:`Copy as CLI`}),(0,U.jsxs)(F,{type:`button`,variant:`ghost`,size:`sm`,className:`ms-auto`,onClick:()=>void s(),children:[i===`copied`?(0,U.jsx)(ye,{"aria-hidden":`true`}):(0,U.jsx)(tt,{"aria-hidden":`true`}),i===`copied`?`Copied`:`Copy`]})]}),(0,U.jsx)(`pre`,{className:`m-0 rounded-lg border bg-muted px-2.5 py-2 font-mono text-xs/relaxed break-words whitespace-pre-wrap text-muted-foreground`,children:r}),(0,U.jsx)(`p`,{role:`status`,className:`mbs-2 text-xs break-words text-muted-foreground`,children:i===`failed`?`Could not copy — select the line and copy it by hand.`:(0,U.jsxs)(U.Fragment,{children:[`The definition Save would create. `,(0,U.jsxs)(`code`,{children:[$e(),` automation schema`]}),` prints its shape.`]})})]})}function Kr({pressed:e,onClick:t,disabled:n,children:r}){return(0,U.jsx)(`button`,{type:`button`,"aria-pressed":e,disabled:n,onClick:t,className:i(Ye,`h-11 px-4 text-[13px]`,e&&`border-transparent bg-accent-strong text-accent-strong-foreground hover:bg-accent-strong hover:text-accent-strong-foreground`),children:r})}var qr=Hn.options,Jr=[{seconds:60,label:`1 minute`},{seconds:300,label:`5 minutes`},{seconds:900,label:`15 minutes`},{seconds:1800,label:`30 minutes`},{seconds:3600,label:`1 hour`}],Yr=[{key:`authors`,label:`Authors`},{key:`assignees`,label:`Assignees`},{key:`allLabels`,label:`Has all labels`},{key:`anyLabels`,label:`Has any label`},{key:`excludeLabels`,label:`Excludes labels`},{key:`changedLabels`,label:`Changed labels`,hint:`Required for the two label events.`}],Xr=e=>(e??[]).join(`, `),Zr=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean);function Qr(e){return e?`Existing matches within the lookback are eligible on the next check. Previously processed matches will not run again.`:`Enabling starts from a current-time baseline. Existing matches will not launch tasks.`}function $r(e){let t=Math.max(1,Math.round(e.intervalSeconds/60));return`Polls GitHub every ${t} minute${t===1?``:`s`} for ${e.events.join(`, `)||`no events`}. ${Qr(e.filters.includeExisting)}`}function ei({draft:e,onChange:t,disabledReason:n}){let r=n=>{t({events:e.events.includes(n)?e.events.filter(e=>e!==n):[...e.events,n]})},i=n=>t({filters:{...e.filters,...n}}),a=(n,r)=>{let i=Zr(r),{[n]:a,...o}=e.filters;t({filters:i.length?{...o,[n]:i}:o})},o=Jr.some(t=>t.seconds===e.intervalSeconds)?Jr:[...Jr,{seconds:e.intervalSeconds,label:`${Math.round(e.intervalSeconds/60)} minutes`}].sort((e,t)=>e.seconds-t.seconds);return(0,U.jsxs)(`div`,{className:`grid gap-4`,children:[n?(0,U.jsx)(`p`,{className:`text-xs text-pending-strong`,children:`GitHub unavailable · ${n}`}):null,(0,U.jsx)(`div`,{role:`group`,"aria-label":`GitHub events`,className:`flex flex-wrap gap-2`,children:qr.map(t=>(0,U.jsx)(Kr,{pressed:e.events.includes(t),onClick:()=>r(t),children:t},t))}),(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-interval`,children:`Check every`}),(0,U.jsxs)(rr,{value:String(e.intervalSeconds),onValueChange:e=>t({intervalSeconds:Number(e)}),children:[(0,U.jsx)(ar,{id:`automation-interval`,className:`w-full sm:w-48`,"aria-label":`Check every`,children:(0,U.jsx)(ir,{})}),(0,U.jsx)(or,{children:o.map(e=>(0,U.jsx)(sr,{value:String(e.seconds),children:e.label},e.seconds))})]})]}),(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,U.jsx)(Re,{"aria-label":`Include existing items`,"aria-describedby":`automation-history-hint`,checked:e.filters.includeExisting??!1,onCheckedChange:e=>i({includeExisting:e})}),(0,U.jsx)(`span`,{children:`Include existing items`})]}),(0,U.jsx)(`p`,{id:`automation-history-hint`,className:`text-xs text-muted-foreground`,children:Qr(e.filters.includeExisting)})]}),(0,U.jsxs)(Ie,{children:[(0,U.jsxs)(Fe,{className:`group flex min-h-11 items-center gap-2 text-sm font-medium`,children:[`Filters`,(0,U.jsx)(me,{"aria-hidden":`true`,className:`size-4 text-soft-foreground transition-transform motion-reduce:transition-none group-data-[state=open]:rotate-180`})]}),(0,U.jsx)(Pe,{children:(0,U.jsxs)(`div`,{className:`grid gap-4 pt-2 sm:grid-cols-2`,children:[Yr.map(t=>(0,U.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-filter-${t.key}`,children:t.label}),(0,U.jsx)(V,{id:`automation-filter-${t.key}`,placeholder:`comma separated`,value:Xr(e.filters[t.key]),onChange:e=>a(t.key,e.target.value)}),t.hint?(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.hint}):null]},t.key)),(0,U.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-filter-lookback`,children:`Look back (days)`}),(0,U.jsx)(V,{id:`automation-filter-lookback`,type:`number`,min:1,value:e.filters.lookbackDays,onChange:e=>i({lookbackDays:Math.max(1,Number(e.target.value)||1)})})]}),(0,U.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-filter-max`,children:`Max records per check`}),(0,U.jsx)(V,{id:`automation-filter-max`,type:`number`,min:1,value:e.filters.maxRecords,onChange:e=>i({maxRecords:Math.max(1,Number(e.target.value)||1)})})]})]})})]})]})}var ti=e=>String(e).padStart(2,`0`);function ni({label:e,value:t,max:n,onCommit:r}){let[i,a]=(0,H.useState)(ti(t)),o=(0,H.useRef)(null),s=!(/^\d{1,2}$/.test(i)&&Number(i)===t),c=`${e} must be 00–${ti(n)}.`,l=(0,H.useId)();return(0,H.useEffect)(()=>{o.current?.setCustomValidity(s?c:``)},[s,c]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(V,{ref:o,"aria-label":e,"aria-invalid":s||void 0,"aria-describedby":s?l:void 0,inputMode:`numeric`,maxLength:2,className:`w-20 text-center tabular-nums`,value:i,onChange:e=>{a(e.target.value),/^\d{1,2}$/.test(e.target.value)&&Number(e.target.value)<=n&&r(Number(e.target.value))},onBlur:()=>a(ti(t))}),s?(0,U.jsx)(`p`,{id:l,className:`order-last basis-full text-xs text-destructive`,children:c}):null]})}var ri=[{minutes:void 0,label:`No limit`},{minutes:30,label:`30 minutes`},{minutes:120,label:`2 hours`},{minutes:360,label:`6 hours`},{minutes:1440,label:`1 day`},{minutes:10080,label:`7 days`}],ii=`none`,ai=e=>String(e).padStart(2,`0`);function oi(e,t=Date.now()){let n=wt(t,e)??wt(t,`UTC`),r=new Date(Date.UTC(n.year,n.month-1,n.day+1));return`${r.getUTCFullYear()}-${ai(r.getUTCMonth()+1)}-${ai(r.getUTCDate())}T09:00`}function si(){let e=typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[];return e.includes(`UTC`)?e:[`UTC`,...e]}function ci({value:e,stored:t,onChange:n}){let r=t=>n({...e,...t}),i=e.at?gt(e.at):null,a=e.at?.slice(0,10)??``,o=i?.hour??9,s=i?.minute??0,c=(e,t,n)=>r({at:`${e}T${ai(t)}:${ai(n)}`}),l=(0,H.useRef)(null),u=(0,H.useId)(),d=dt(e),f=!(t?.type===`once`&&t.at===e.at&&t.timeZone===e.timeZone)&&d!==null&&d<=Date.now();(0,H.useEffect)(()=>{l.current?.setCustomValidity(f?ct:``)},[f]);let p=bt(e);return(0,U.jsxs)(`div`,{className:`grid gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-4 gap-y-3`,children:[(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-once-date`,children:`Date`}),(0,U.jsx)(V,{ref:l,id:`automation-once-date`,type:`date`,className:`w-44 max-w-full`,value:a,"aria-invalid":f||void 0,"aria-describedby":f?u:void 0,onChange:e=>{/^\d{4}-\d{2}-\d{2}$/.test(e.target.value)&&c(e.target.value,o,s)},required:!0})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,U.jsx)(ni,{label:`Hour`,value:o,max:23,onCommit:e=>c(a,e,s)}),(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,U.jsx)(ni,{label:`Minute`,value:s,max:59,onCommit:e=>c(a,o,e)})]})]}),f?(0,U.jsx)(`p`,{id:u,className:`text-xs text-destructive`,children:ct}):null,(0,U.jsx)(ui,{value:e.timeZone??``,onCommit:e=>r({timeZone:e})}),(0,U.jsx)(di,{value:e.latestStartMinutes,onChange:t=>n(li(e,t))}),p?(0,U.jsx)(`p`,{className:`text-sm break-words`,children:`Runs once at ${p.time} on ${p.date} (${e.timeZone}). ${p.note?`${p.note} `:``}Squawk must be running then.`}):null]})}function li(e,t){let{latestStartMinutes:n,...r}=e;return t===void 0?r:{...r,latestStartMinutes:t}}function ui({value:e,onCommit:t}){let[n,r]=(0,H.useState)(e),i=(0,H.useRef)(null),a=(0,H.useId)(),o=(0,H.useId)(),[s]=(0,H.useState)(si),c=n!==e||!st(n),l=ft(n);return(0,H.useEffect)(()=>{i.current?.setCustomValidity(c?l:``)},[c,l]),(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-once-zone`,children:`Time zone`}),(0,U.jsx)(V,{ref:i,id:`automation-once-zone`,list:a,autoComplete:`off`,spellCheck:!1,className:`w-full sm:w-72`,value:n,"aria-invalid":c||void 0,"aria-describedby":c?o:void 0,onChange:e=>{r(e.target.value),st(e.target.value)&&t(e.target.value)}}),(0,U.jsx)(`datalist`,{id:a,children:s.map(e=>(0,U.jsx)(`option`,{value:e},e))}),c?(0,U.jsx)(`p`,{id:o,className:`text-xs break-words text-destructive`,children:l}):null]})}function di({value:e,onChange:t}){let n=ri.some(t=>t.minutes===e)||e===void 0?ri:[...ri,{minutes:e,label:`${e} minutes`}];return(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-once-latest`,children:`Latest start`}),(0,U.jsxs)(rr,{value:e===void 0?ii:String(e),onValueChange:e=>t(e===ii?void 0:Number(e)),children:[(0,U.jsx)(ar,{id:`automation-once-latest`,className:`w-full sm:w-48`,"aria-label":`Latest start`,children:(0,U.jsx)(ir,{})}),(0,U.jsx)(or,{children:n.map(e=>(0,U.jsx)(sr,{value:e.minutes===void 0?ii:String(e.minutes),children:e.label},e.label))})]}),(0,U.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`If Squawk was not running at the time, it still starts the task this long afterwards; later, the schedule is marked missed.`})]})}var fi=[{type:`daily`,label:`Every day`},{type:`weekdays`,label:`Weekdays`},{type:`weekly`,label:`Weekly`},{type:`hours`,label:`Every N hours`},{type:`once`,label:`Once`}];function pi({value:e,stored:t,onChange:n,timeZone:r}){let i=t=>n({...e,...t}),a=t=>i(t===`once`?{type:t,at:e.at??oi(r),timeZone:e.timeZone??r}:{type:t});return(0,U.jsxs)(`div`,{className:`grid gap-4`,children:[(0,U.jsx)(`div`,{role:`group`,"aria-label":`Repeat`,className:`flex flex-wrap gap-2`,children:fi.map(t=>(0,U.jsx)(Kr,{pressed:e.type===t.type,onClick:()=>a(t.type),children:t.label},t.type))}),e.type===`once`?(0,U.jsx)(ci,{value:e,stored:t,onChange:n}):null,e.type===`weekly`?(0,U.jsx)(`div`,{role:`group`,"aria-label":`Day of the week`,className:`flex flex-wrap gap-2`,children:xt.map((t,n)=>(0,U.jsx)(Kr,{pressed:e.day===n+1,onClick:()=>i({day:n+1}),children:t},t))}):null,e.type===`once`?null:e.type===`hours`?(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-every`,children:`Run every`}),(0,U.jsxs)(rr,{value:String(e.every),onValueChange:e=>i({every:Number(e)}),children:[(0,U.jsx)(ar,{id:`automation-every`,className:`w-full sm:w-48`,"aria-label":`Run every`,children:(0,U.jsx)(ir,{})}),(0,U.jsx)(or,{children:vt.map(e=>(0,U.jsx)(sr,{value:String(e),children:e===1?`hour`:`${e} hours`},e))})]}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Counted from midnight, so “every 6 hours” runs at 00:00, 06:00, 12:00 and 18:00.`})]}):(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,U.jsx)(ni,{label:`Hour`,value:e.hour,max:23,onCommit:e=>i({hour:e})}),(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,U.jsx)(ni,{label:`Minute`,value:e.minute,max:59,onCommit:e=>i({minute:e})}),(0,U.jsx)(`span`,{className:`text-sm break-all text-muted-foreground`,children:r})]}),e.type===`once`?null:(0,U.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Cron: `,(0,U.jsx)(`code`,{className:`font-mono text-foreground`,children:ht(e)})]})]})}var mi=40*864e5,hi=5;function gi({schedule:e,timeZone:t,now:n=Date.now()}){if(e.type===`once`)return(0,U.jsx)(_i,{schedule:e,now:n});let r=ut(e,n+1,n+mi,t,hi);return(0,U.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,className:`rounded-xl border bg-card p-4`,children:[(0,U.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-[15px] font-medium`,children:`Next 5 runs`}),r.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No runs in the next 40 days.`}):(0,U.jsx)(`ol`,{"aria-label":`Next 5 runs`,className:`grid gap-1.5 text-sm`,children:r.map(e=>(0,U.jsxs)(`li`,{className:`flex items-baseline justify-between gap-3`,children:[(0,U.jsx)(`span`,{className:`font-medium tabular-nums`,children:St(new Date(e).toISOString(),t)}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:mt(n,e)})]},e))}),(0,U.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Times are in `,t,`, the zone this Squawk runs in.`]})]})}function _i({schedule:e,now:t}){let n=dt(e),r=bt(e);return(0,U.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,className:`rounded-xl border bg-card p-4`,children:[(0,U.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-[15px] font-medium`,children:`Runs once`}),n===null||!r?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pick a date, a time and a time zone.`}):(0,U.jsxs)(`p`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 text-sm`,children:[(0,U.jsx)(`span`,{className:`font-medium tabular-nums`,children:`${r.date} ${r.time}`}),n>t?(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:mt(t,n)}):null]}),r?.note?(0,U.jsx)(`p`,{className:`mt-2 text-sm break-words`,children:r.note}):null,n!==null&&n<=t?(0,U.jsx)(`p`,{className:`mt-2 text-sm text-destructive`,children:`The due time has passed.`}):null,(0,U.jsx)(`p`,{className:`mt-3 text-xs break-words text-muted-foreground`,children:`Times are in ${e.timeZone??`UTC`}. Squawk must be running then; afterwards the schedule is archived with its task.`})]})}var vi={schedule:`On a schedule`,github:`When GitHub changes`};function yi(e){return/time zone|due time/i.test(e)?`when`:/placeholder|prompt|workflow|runner|model|task|autonomous/i.test(e)?`run`:/\bname\b/i.test(e)?`name`:/schedule|github|event|filter|label|interval|remote|forge|lookback|records?|hour|minute|poll|kind|archived/i.test(e)?`when`:`form`}function bi({title:e,failure:t,section:n,children:r}){return(0,U.jsxs)(`fieldset`,{className:`grid min-w-0 gap-4 rounded-xl border p-5 max-md:p-4!`,children:[(0,U.jsx)(`legend`,{className:`px-0`,children:e}),r,t?.section===n&&!t.conflict?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:t.message}):null]})}function xi({draft:e,patch:t,forge:n,automation:r}){return(0,U.jsx)(U.Fragment,{children:r?(0,U.jsxs)(`p`,{className:`text-sm`,children:[(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`Trigger · `}),vi[e.kind]]}):(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,U.jsx)(at,{slot:`automation-kind`,label:`Trigger`,size:`touch`,value:e.kind,onChange:e=>t({kind:e}),options:[{value:`schedule`,label:vi.schedule},{value:`github`,label:vi.github,disabled:!n.available,...n.available?{}:{title:n.reason??`GitHub is unavailable`}}]}),n.available?null:(0,U.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`GitHub unavailable · ${n.reason??`no GitHub access`}`})]})})}function Si({draft:e,patch:t,forge:n,timeZone:r,automation:i}){return e.kind===`schedule`?(0,U.jsx)(pi,{value:e.schedule,stored:i?.schedule,onChange:e=>t({schedule:e}),timeZone:r}):(0,U.jsx)(ei,{draft:e,onChange:t,...n.available?{}:{disabledReason:n.reason??`no GitHub access`}})}function Ci({draft:e,patch:t,saving:n,automation:r}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-prompt`,children:`Prompt`}),(0,U.jsx)(Tt,{id:`automation-prompt`,value:e.prompt,onChange:e=>t({prompt:e.target.value}),rows:4,required:!0}),(0,U.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:e.kind===`schedule`?(0,U.jsxs)(U.Fragment,{children:[`Available: `,`{{date}}`,` `,`{{time}}`,` `,`{{project}}`,` `,`{{automation}}`,`. A run-context block is appended automatically.`]}):(0,U.jsxs)(U.Fragment,{children:[`Available: `,`{{github.number}}`,` `,`{{github.title}}`,` `,`{{github.url}}`,` `,`{{github.labels}}`,`. GitHub content is appended as untrusted context.`]})})]}),(0,U.jsx)(Ei,{draft:e,patch:t}),(0,U.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,U.jsx)(Re,{"aria-label":`Autonomous`,checked:e.autonomous,onCheckedChange:e=>t({autonomous:e})}),(0,U.jsxs)(`span`,{children:[`Autonomous `,(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`· runs without waiting for answers`})]})]}),(0,U.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`Each run is an ordinary task in its own worktree, queued behind the parallel cap.`}),(0,U.jsx)(nt,{archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,onChange:t,disabled:n}),(0,U.jsx)(Ze,{allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging,onChange:t,disabled:n}),r?(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`These settings apply to future tasks. Existing tasks keep their settings.`}):null]})}function wi({draft:e,patch:t,automation:n}){let r=e.kind===`schedule`;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,U.jsx)(Re,{"aria-label":n?`Enabled`:`Enable after saving`,checked:e.enabled,onCheckedChange:e=>t({enabled:e})}),(0,U.jsx)(`span`,{children:n?`Enabled`:`Enable after saving`})]}),(0,U.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:r&&e.schedule.type===`once`?`It runs once at the time set above, then moves to Archived with its task.`:r?`The first run is the next occurrence shown beside the schedule.`:Qr(e.filters.includeExisting)})]})}function Ti({automation:e,forge:t,timeZone:n,onSaved:r,onReload:i}){let[a,s]=(0,H.useState)(()=>jr(e)),[c,l]=(0,H.useState)(e?.revision),[u,d]=(0,H.useState)(),[f,p]=(0,H.useState)(!1),[m,g]=(0,H.useState)(!1),[v,y]=(0,H.useState)(!1),[b,x]=(0,H.useState)(``),S=e=>s(t=>({...t,...e})),C=async t=>{if(t.preventDefault(),f)return;let n=t.currentTarget;if(n instanceof HTMLFormElement&&!n.checkValidity()){n.reportValidity();return}p(!0),d(void 0);let i=`save`;try{if(e&&c!==void 0){let{automation:t}=await ee(e.id,Ir({...a,enabled:e.enabled},c));l(t.revision),a.enabled!==e.enabled&&(i=`enable`,await h(e.id,a.enabled))}else await te(Fr(a));r()}catch(t){let n=t instanceof Error?t.message:String(t);i===`save`&&e&&t instanceof _&&t.status===409&&/revision conflict/i.test(n)?d({section:`form`,message:`Edited elsewhere — reload to see the latest version`,conflict:!0}):d({section:i===`enable`?`enable`:yi(n),message:n})}finally{p(!1)}},w=async()=>{if(!(!e||v)){y(!0),x(``);try{await o(e.id),r()}catch(e){x(e instanceof Error?e.message:String(e))}finally{y(!1)}}},T=e?`Save changes`:a.enabled?`Save and enable`:`Save paused`,E=a.kind===`schedule`;return(0,U.jsx)(X,{title:e?`Edit automation`:`New automation`,subtitle:`Define when it runs and the ordinary task it launches.`,children:(0,U.jsxs)(`form`,{className:`automation-editor grid min-w-0 gap-5 md:grid-cols-[minmax(0,1fr)_320px] md:items-start`,onSubmit:C,children:[(0,U.jsxs)(`div`,{className:`grid min-w-0 gap-5`,children:[(0,U.jsx)(bi,{title:`Name`,section:`name`,failure:u,children:(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-name`,children:`Name`}),(0,U.jsx)(V,{id:`automation-name`,value:a.name,onChange:e=>S({name:e.target.value}),required:!0})]})}),(0,U.jsxs)(bi,{title:`When`,section:`when`,failure:u,children:[(0,U.jsx)(xi,{draft:a,patch:S,forge:t,automation:e}),(0,U.jsx)(Si,{draft:a,patch:S,forge:t,timeZone:n,automation:e})]}),(0,U.jsx)(bi,{title:`What to run`,section:`run`,failure:u,children:(0,U.jsx)(Ci,{draft:a,patch:S,saving:f,automation:e})}),(0,U.jsx)(bi,{title:`Enable`,section:`enable`,failure:u,children:(0,U.jsx)(wi,{draft:a,patch:S,automation:e})}),u?.section===`form`?(0,U.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 text-sm text-destructive`,children:[(0,U.jsx)(`span`,{className:`break-words`,children:u.message}),u.conflict&&i?(0,U.jsx)(F,{type:`button`,variant:`outline`,onClick:i,children:`Reload`}):null]}):null,(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(F,{type:`submit`,disabled:f,children:f?`Saving…`:T}),(0,U.jsx)(F,{type:`button`,variant:`outline`,asChild:!0,children:(0,U.jsx)(B,{to:`/automations`,children:`Cancel`})})]}),e?(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-2 border-t pt-4`,children:[m?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? It will stop running and cannot be restored.`}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(F,{type:`button`,variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:v,onClick:()=>void w(),children:`Delete automation`}),(0,U.jsx)(F,{type:`button`,variant:`outline`,disabled:v,onClick:()=>{g(!1),x(``)},children:`Keep`})]})]}):(0,U.jsx)(F,{type:`button`,variant:`outline`,"data-action":`automation-delete`,onClick:()=>g(!0),children:`Delete`}),b?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:b}):null]}):null]}),(0,U.jsxs)(`aside`,{className:`min-w-0 md:sticky md:top-4`,children:[E?(0,U.jsx)(gi,{schedule:a.schedule,timeZone:n}):(0,U.jsxs)(`section`,{className:`rounded-xl border bg-card p-4`,children:[(0,U.jsx)(`h2`,{className:`mb-2 text-[15px] font-medium`,children:`How it polls`}),(0,U.jsx)(`p`,{className:`text-sm break-words text-muted-foreground`,children:$r(a)})]}),(0,U.jsx)(Gr,{draft:a})]})]})})}function Ei({draft:e,patch:t}){let n=ae(),r=et(),{runners:i,signedOut:a}=r.runnersOn(e=>r.repoAccount?.[e]),o=oe(),s=ne(),{runner:c,ready:l}=N(e.runner??o.data?.defaultRunner??`claude`),u=ie(c,l,r.repoAccount?.[c]),d=[...new Set([...(n.data?.workflows??[]).map(e=>e.name),...e.workflow?[e.workflow]:[]])],f=[...new Set([...i,...e.runner?[e.runner]:[]])],p=Xe(c,s.data,u.data,[e.model]),m=p.find(t=>t.id===(e.model??``))?.label??e.model??`auto`,h=e=>(0,U.jsx)(e,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`});return(0,U.jsx)(Je,{children:(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(Qe,{slot:`automation-workflow-pill`,icon:h(ge),fieldLabel:!0,ariaLabel:`Workflow`,label:e.workflow??`inline steps`,value:e.workflow??``,disabled:e.workflow===void 0,disabledHint:`This automation carries its own steps.`,options:d.map(e=>({value:e,label:e})),onPick:e=>t({workflow:e})}),(0,U.jsx)(Qe,{slot:`automation-runner-pill`,icon:h(pe),fieldLabel:!0,ariaLabel:`Runner`,label:e.runner??`default`,value:e.runner??``,disabled:!s.data,options:[{value:``,label:`default`,desc:`The project’s default runner`},...f.map(e=>({value:e,label:re(s.data,e)}))],footer:(0,U.jsx)(rt,{uninstalled:r.uninstalled,signedOut:a.filter(t=>t!==e.runner)}),onPick:e=>{t({runner:e||void 0,model:void 0})}}),(0,U.jsx)(Qe,{slot:`automation-model-pill`,icon:h(_e),fieldLabel:!0,ariaLabel:`Model`,label:m,value:e.model??``,options:p.map(e=>({value:e.id,label:e.label,desc:e.desc})),onPick:e=>t({model:e||void 0})})]})})}function Di({data:e,error:t,refresh:n,archived:r=!1,onArchivedChange:i}){let[a,o]=(0,H.useState)({}),[c,l]=(0,H.useState)({}),u=(e,t)=>o(n=>{let{[e]:r,...i}=n;return t?{...i,[e]:t}:i}),d=async(e,t)=>{l(t=>({...t,[e]:!0}));try{await t()}catch(t){u(e,{text:t instanceof Error?t.message:String(t),tone:`error`})}finally{l(t=>({...t,[e]:!1}))}},f=e=>d(e.id,async()=>{u(e.id,{text:`Starting…`,tone:`info`});let{runId:t}=await m(e.id);u(e.id,{text:`Started task`,tone:`info`,runId:t}),n()}),p=e=>d(e.id,async()=>{u(e.id,void 0),await h(e.id,!e.enabled),await n()}),g=e=>d(e.id,async()=>{u(e.id,void 0),await x(e.id),await n()}),_=e=>d(e.id,async()=>{u(e.id,{text:`Checking…`,tone:`info`});let{checkId:t}=await y(e.id,`preview`);for(let r=0;r<60;r+=1){let r=await s(t);if(r.status===`complete`){u(e.id,{text:`${r.matches??0} filter match${r.matches===1?``:`es`} found; no tasks launched. Counts can include closed items and previously processed events.`,tone:`info`}),n();return}if(r.status===`error`)throw Error(r.error??`Preview failed`);await new Promise(e=>setTimeout(e,500))}throw Error(`Preview is still running`)});return(0,U.jsx)(X,{title:`Automations`,subtitle:`Schedules and GitHub checks run while Squawk is open.`,action:(0,U.jsx)(F,{asChild:!0,children:(0,U.jsx)(B,{to:`/automations/new`,children:`New automation`})}),children:t&&!e?(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,U.jsx)(Z,{text:t}),(0,U.jsx)(F,{variant:`outline`,onClick:()=>void n(),children:`Retry`})]}):e?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Oi,{data:e}),i?(0,U.jsx)(`div`,{className:`mb-4 flex flex-wrap gap-2`,children:(0,U.jsx)(Kr,{pressed:r,onClick:()=>i(!r),children:`Archived`})}):null,r&&e.automations.length===0?(0,U.jsx)(Z,{text:`No archived one-time schedules.`}):e.automations.length===0?(0,U.jsx)(Ke,{icon:(0,U.jsx)(he,{}),tone:`neutral`,title:`No automations yet`,subtitle:`Create one paused, preview it, then enable it.`,heading:`h2`,actions:(0,U.jsx)(F,{asChild:!0,children:(0,U.jsx)(B,{to:`/automations/new`,children:`New automation`})})}):(0,U.jsx)(`ul`,{className:`grid gap-3`,"aria-label":`Automations`,children:e.automations.map(t=>(0,U.jsx)(zi,{automation:t,timeZone:e.timeZone,note:a[t.id],busy:c[t.id]===!0,onRun:()=>void f(t),onToggle:()=>void p(t),onPreview:()=>void _(t),onCancel:()=>void g(t)},t.id))})]}):(0,U.jsx)(Z,{text:`Loading automations…`})})}function Oi({data:e}){return(0,U.jsx)(`p`,{"data-slot":`automation-scheduler`,className:i(`mb-4 text-xs break-words`,e.scheduler.state===`scheduled`?`text-success`:`text-muted-foreground`),children:`Scheduler ${e.scheduler.state===`scheduled`?`running`:`idle`} · GitHub ${e.available?`available`:`unavailable`}${e.reason?` · ${e.reason}`:``} · ${e.timeZone}`})}function ki(e){return e.kind===`schedule`&&e.schedule?pt(e.schedule):`on ${(e.events??[]).join(`, `)} · every ${Math.round((e.intervalSeconds??300)/60)} min`}var Ai={waiting:{label:`Waiting`,dot:`success`},paused:{label:`Paused`,dot:`neutral`},failed:{label:`Failed`,dot:`danger`},missed:{label:`Missed`,dot:`pending`},archived:{label:`Archived`,dot:`neutral`}};function ji(e){if(e.schedule?.type===`once`)return Ai[e.onceStatus??(e.enabled?`waiting`:`paused`)]}function Mi({automation:e,badge:t}){return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsxs)(`h2`,{className:`flex items-center gap-2 font-semibold break-words`,children:[(0,U.jsx)(e.kind===`schedule`?ue:le,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),e.name]}),(0,U.jsx)(`p`,{className:`mt-1.5 text-[13px] break-words text-muted-foreground`,children:ki(e)})]}),t?(0,U.jsx)(it,{dot:t.dot,children:t.label}):(0,U.jsx)(it,{dot:e.enabled?`success`:`neutral`,children:e.enabled?`Enabled`:`Paused`})]})}function Ni({automation:e,archive:t}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`mt-3 text-sm break-words`,children:[t.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`,t.runId?(0,U.jsxs)(U.Fragment,{children:[` · `,(0,U.jsx)(B,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${t.runId}`,children:`Open task`})]}):null]}),(0,U.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:(0,U.jsx)(F,{variant:`outline`,asChild:!0,children:(0,U.jsx)(B,{to:`/automations/${e.id}`,children:`Details`})})})]})}function Pi({automation:e,timeZone:t}){let n=e.kind===`schedule`,r=e.enabled&&n?e.nextRunAt:void 0;return(0,U.jsx)(`p`,{className:`mt-3 text-sm`,children:!n&&e.enabled?(0,U.jsx)(`span`,{children:`continuous`}):r?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{children:`Next run: ${St(r,t)}`}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:` · ${mt(Date.now(),Date.parse(r))}`})]}):(0,U.jsx)(`span`,{children:`Next run: —`})})}function Fi({automation:e,timeZone:t}){let n=e.enabled?Qn(e.state):void 0;return n?(0,U.jsxs)(`p`,{role:`alert`,"data-slot":`automation-failing`,className:`mt-3 text-sm break-words text-destructive`,children:[`The last ${n.consecutiveFailures} checks failed: ${n.lastError}`,n.retryAt?(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:` · Next try ${St(n.retryAt,t)}`}):null]}):null}function Ii({automation:e,busy:t,confirmingCancel:n,cancelRef:r,onToggle:i,onRun:a,onPreview:o,onOpenCancel:s}){let c=e.kind===`schedule`,l=e.schedule?.type===`once`;return(0,U.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,U.jsx)(F,{variant:`outline`,asChild:!0,children:(0,U.jsx)(B,{to:`/automations/${e.id}`,children:`Edit`})}),(0,U.jsx)(F,{variant:`outline`,asChild:!0,children:(0,U.jsx)(B,{to:`/automations/${e.id}/log`,children:`Execution log`})}),(0,U.jsx)(F,{variant:`outline`,"data-action":`automation-toggle`,disabled:t,onClick:i,children:e.enabled?`Pause`:`Enable`}),c?(0,U.jsx)(F,{variant:`outline`,"data-action":`automation-run`,disabled:t,onClick:a,children:`Run now`}):(0,U.jsx)(F,{variant:`outline`,"data-action":`automation-preview`,disabled:t,onClick:o,children:`Test filter`}),l&&!n?(0,U.jsx)(F,{variant:`outline`,ref:r,"data-action":`automation-cancel`,disabled:t,onClick:s,children:`Cancel`}):null]})}function Li({automation:e,busy:t,keepRef:n,onConfirm:r,onKeep:i}){return(0,U.jsxs)(`div`,{className:`mt-3 grid justify-items-start gap-2`,children:[(0,U.jsx)(`p`,{className:`text-sm break-words`,children:`Cancel “${e.name}”? It will never run, and it moves to Archived.`}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(F,{variant:`danger-ghost`,"data-action":`automation-cancel-confirm`,disabled:t,onClick:r,children:`Cancel schedule`}),(0,U.jsx)(F,{ref:n,variant:`outline`,disabled:t,onClick:i,children:`Keep`})]})]})}function Ri({note:e}){return(0,U.jsxs)(`p`,{role:e.tone===`error`?`alert`:`status`,className:i(`mt-3 text-sm break-words`,e.tone===`error`?`text-destructive`:`text-muted-foreground`),children:[e.text,e.runId?(0,U.jsxs)(U.Fragment,{children:[` · `,(0,U.jsx)(B,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`})]}):null]})}function zi({automation:e,timeZone:t,note:n,busy:r,onRun:i,onToggle:a,onPreview:o,onCancel:s}){let[c,l]=(0,H.useState)(!1),u=(0,H.useRef)(null),d=(0,H.useRef)(null),f=(0,H.useRef)(null);(0,H.useEffect)(()=>{let e=f.current===`keep`?d.current:f.current===`cancel`?u.current:null;f.current=null,e?.focus()},[c]);let p=()=>{f.current=`keep`,l(!0)},m=()=>{f.current=`cancel`,l(!1)},h=e.archived;return(0,U.jsxs)(`li`,{"data-slot":`automation-card`,"data-kind":e.kind,className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,U.jsx)(Mi,{automation:e,badge:ji(e)}),h?(0,U.jsx)(Ni,{automation:e,archive:h}):null,h?null:(0,U.jsx)(Pi,{automation:e,timeZone:t}),h?null:(0,U.jsx)(Fi,{automation:e,timeZone:t}),h?null:(0,U.jsx)(Ii,{automation:e,busy:r,confirmingCancel:c,cancelRef:u,onToggle:a,onRun:i,onPreview:o,onOpenCancel:p}),e.schedule?.type===`once`&&!h&&c?(0,U.jsx)(Li,{automation:e,busy:r,keepRef:d,onConfirm:()=>{l(!1),s()},onKeep:m}):null,n?(0,U.jsx)(Ri,{note:n}):null,(0,U.jsx)(vr,{automationId:e.id,automationName:e.name,timeZone:t})]})}function Bi(e){let t=Ge(),n=ot(),[r,i]=(0,H.useState)(),[a,o]=(0,H.useState)(``),s=(0,H.useCallback)(t=>u({signal:t,...e?{archived:e}:{}}).then(e=>{t?.aborted||(i(e),o(``))}).catch(e=>{t?.aborted||o(String(e))}),[e]);return(0,H.useEffect)(()=>{n&&s()},[n,s]),(0,H.useEffect)(()=>c(async e=>{n&&await s(e)}),[n,s]),(0,H.useEffect)(()=>ce((e,n)=>{if(e!==`automation-change`)return;let r=n;typeof r.project==`string`&&(t===null||r.project===t)&&s()}),[t,s]),{data:r,error:a,refresh:s}}function Vi({mode:e=`list`}){let{automationId:t}=se(),n=We(),[r,i]=(0,H.useState)(!1),{data:a,error:o,refresh:s}=Bi(e===`list`?r?`only`:void 0:`include`),[c,l]=(0,H.useState)(0),u=qe();if(u===`unknown`)return(0,U.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,U.jsx)(Z,{text:`Loading automations…`})});if(u===`unavailable`)return(0,U.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,U.jsx)(Ke,{icon:(0,U.jsx)(he,{}),tone:`neutral`,title:`Automations are off`,subtitle:`This server does not run schedules, poll GitHub or launch tasks from them. Unset CEZ_AUTOMATIONS or set it to 1 and restart Squawk to turn automations on.`,heading:`h2`})});let d=()=>{n(`/automations`),s()},f=a?.automations.find(e=>e.id===t);if(e===`list`)return(0,U.jsx)(Di,{data:a,error:o,refresh:s,archived:r,onArchivedChange:i});if(!a)return o?(0,U.jsx)(X,{title:`Automations`,subtitle:`Could not load automations.`,children:(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,U.jsx)(Z,{text:o}),(0,U.jsx)(F,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]})}):(0,U.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,U.jsx)(Z,{text:`Loading automations…`})});let p={available:a.available,...a.reason?{reason:a.reason}:{}};return e===`new`?(0,U.jsx)(Ti,{forge:p,timeZone:a.timeZone,onSaved:d}):e===`edit`?f?f.archived?(0,U.jsx)(yr,{automation:f,timeZone:a.timeZone,onDeleted:d}):(0,U.jsx)(Ti,{automation:f,forge:p,timeZone:a.timeZone,onSaved:d,onReload:()=>void s().then(()=>l(e=>e+1))},`${f.id}:${c}`):(0,U.jsx)(X,{title:`Automation not found`,subtitle:`This automation may have been removed.`,children:(0,U.jsx)(F,{asChild:!0,variant:`outline`,children:(0,U.jsx)(B,{to:`/automations`,children:`Back to automations`})})}):t?(0,U.jsx)(_r,{automationId:t,automationName:f?.name,timeZone:a.timeZone,readOnly:!!f?.archived}):(0,U.jsx)(Z,{text:`Automation not found.`})}export{Vi as AutomationsRoute};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{i as r}from"./project-scope-context-C0FJXpqD.js";import{j as i,ot as a,r as o}from"./design-icons-CzEoMH9c.js";import{n as s}from"./diff-controls-BSWICnsb.js";import{u as c}from"./reference-chip-jyOBNGWj.js";import{t as l}from"./button-BQ2y4XRB.js";import{t as u}from"./project-router-BYHPCHz0.js";import{t as d}from"./centered-state-V15AR_qo.js";import{en as f,gn as p}from"./index-Br3WCnOm.js";import{t as m}from"./diff-K_Xswloe.js";var h=e(t(),1),g=n();function _({commit:e,sha:t,backTo:n,backLabel:_,slot:v,className:y,diffClassName:b}){let x=f(),[S,C]=(0,h.useState)(`unified`),[w,T]=(0,h.useState)(!1),E=e.isError&&e.error instanceof r&&e.error.status===409,D=x?S:`unified`,O=!x||w;return(0,g.jsxs)(`section`,{"data-slot":v,"data-sha":t,className:y,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,g.jsx)(l,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,g.jsxs)(u,{to:n,children:[(0,g.jsx)(o,{size:16,"aria-hidden":`true`}),_]})}),e.data?(0,g.jsx)(p,{stat:e.data.stat}):null,(0,g.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,g.jsx)(s,{mode:S,wrap:w,onModeChange:C,onWrapChange:T})})]}),e.isPending?(0,g.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):e.isError?(0,g.jsx)(d,{icon:E?(0,g.jsx)(c,{}):(0,g.jsx)(a,{size:16}),tone:E?`neutral`:`danger`,heading:`h2`,title:E?`Commit not found`:`Could not load the commit`,subtitle:e.error.message}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,g.jsx)(`h2`,{className:`text-sm font-semibold`,children:e.data.subject}),(0,g.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[e.data.author,` · `,e.data.when,` ·`,` `,(0,g.jsx)(`span`,{className:`font-mono select-all`,children:e.data.sha})]})]}),e.data.files.length===0?(0,g.jsx)(d,{icon:(0,g.jsx)(i,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,g.jsx)(`div`,{className:b,children:(0,g.jsx)(m,{files:e.data.files,mode:D,wrap:O,className:`min-w-0`})})]})]})}export{_ as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{i,on as a}from"./project-scope-context-C0FJXpqD.js";import{ht as o}from"./queries-CK9ZDDfL.js";import{f as s,p as c}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{ot as l,w as u}from"./design-icons-CzEoMH9c.js";import{t as d}from"./createLucideIcon-BHp8sXmF.js";import{t as f}from"./centered-state-V15AR_qo.js";import{a as p,i as m,r as h}from"./highlighter-DvLzHjjY.js";import{a as g,c as _,d as v,l as y,n as b,o as x,s as S,t as C,u as w}from"./markdown-POxkTBG0.js";var T=d(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),E=d(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),D=d(`file-x`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),O=e(t(),1),k=n(),A=[[`scripts`,`remote script`,`remote scripts`],[`remote`,`remote resource`,`remote resources`],[`relative`,`linked file next to the report`,`linked files next to the report`],[`forms`,`form`,`forms`],[`embeds`,`embedded frame or object`,`embedded frames or objects`]];function j(e){let t=A.filter(([t])=>e[t]>0).map(([t,n,r])=>`${e[t]} ${e[t]===1?n:r}`);return t.length?t.join(`, `):null}var M={};function N(e){let t=(0,O.useMemo)(()=>w(e),[e]).join(` `),[n,r]=(0,O.useState)(null);return(0,O.useEffect)(()=>{if(!t)return;let e=!0;return v(t.split(` `)).then(n=>{e&&r({key:t,libraries:n})}),()=>{e=!1}},[t]),t?n?.key===t?n.libraries:null:M}function P({html:e,title:t,fragment:n,className:i}){let a=N(e);return a?(0,k.jsx)(F,{html:e,title:t,fragment:n,className:i,libraries:a}):(0,k.jsx)(`div`,{"data-slot":`html-report`,"aria-busy":`true`,className:r(`flex min-h-0 flex-col`,i)})}function F({html:e,title:t,fragment:n,className:i,libraries:a}){let{srcdoc:o,blocked:s}=(0,O.useMemo)(()=>{let n=_(e,a);return{srcdoc:y(n.srcdoc,t),blocked:n.blocked}},[e,a,t]),c=e=>{n&&/^#\S+$/.test(n)&&e.currentTarget.contentWindow?.frames[0]?.location.replace(`about:srcdoc${n}`)},l=j(s);return(0,k.jsxs)(`div`,{"data-slot":`html-report`,className:r(`flex min-h-0 flex-col`,i),children:[l?(0,k.jsxs)(`p`,{"data-slot":`html-report-blocked`,role:`note`,className:`border-b border-border bg-muted/40 px-4 py-2 text-xs text-foreground`,children:[`Blocked for your safety: `,l,`. Reports show only what they carry inside the file.`]}):null,(0,k.jsx)(`iframe`,{"data-slot":`html-report-frame`,title:t,sandbox:x,allow:g,srcDoc:o,referrerPolicy:`no-referrer`,onLoad:c,className:`block min-h-0 w-full flex-1 border-0 bg-report-canvas`})]})}var I=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`ico`,`avif`]);function L(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:I.has(t.slice(n+1).toLowerCase())}function R(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return L(e)||n>0&&t.slice(n+1).toLowerCase()===`svg`}function z(e){return e.tooLarge?`too-large`:R(e.path)?`image`:e.binary?`binary`:`text`}function B(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}function V({runId:e,path:t,className:n}){let r=o(e,t??void 0);if(t===null)return(0,k.jsx)(K,{className:n,children:(0,k.jsx)(f,{icon:(0,k.jsx)(u,{size:16}),tone:`neutral`,heading:`h2`,title:`Select a file`,subtitle:`Pick a file from this task’s worktree to inspect its contents.`,className:`[&_[data-slot=centered-state-tile]]:size-10 [&_[data-slot=centered-state-tile]]:border-0 [&_[data-slot=centered-state-tile]]:bg-transparent [&_[data-slot=centered-state-tile]]:text-accent-text [&_[data-slot=centered-state-tile]]:shadow-none [&_h2]:text-xl`})});if(r.isPending)return(0,k.jsx)(K,{className:n,children:(0,k.jsxs)(`p`,{"data-slot":`file-preview-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t,`…`]})});if(r.isError){let e=r.error instanceof i&&r.error.status===409;return(0,k.jsx)(K,{className:n,children:(0,k.jsx)(f,{icon:e?(0,k.jsx)(D,{}):(0,k.jsx)(l,{size:16}),tone:e?`neutral`:`danger`,heading:`h2`,title:e?`Cannot preview this file`:`Could not load this file`,subtitle:r.error.message})})}return r.data.type===`file`?(0,k.jsx)(H,{runId:e,entry:r.data,className:n}):(0,k.jsx)(K,{className:n,children:(0,k.jsx)(f,{icon:(0,k.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`Choose a file inside this directory`,subtitle:`Expand the folder in the tree, or enter the full path to a file.`})})}function H({runId:e,entry:t,className:n,imageUrl:r,downloadUrl:i,snapshot:a,readerHref:o,documentPreview:s=!1}){let[c,l]=(0,O.useState)(!1),u=s&&/\.(?:md|markdown)$/i.test(t.path),d=s&&S(t.path),f=/\.(?:png|jpe?g|gif|webp|bmp|ico|avif)$/i.test(t.path),p=s&&f&&t.size<=10*1024*1024?`image`:z(t),m=(u||d)&&p===`text`;return(0,k.jsxs)(K,{className:n,children:[(0,k.jsxs)(`header`,{"data-slot":`file-preview-head`,className:`flex items-center gap-2 border-b border-border bg-muted/40 px-4 py-2 text-xs`,children:[(0,k.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium`,children:t.path}),(0,k.jsx)(`span`,{className:`ml-auto shrink-0 tabular-nums text-soft-foreground`,children:B(t.size)})]}),a||i||m?(0,k.jsx)(W,{snapshot:a,downloadUrl:i,source:m?c:null,onSource:()=>l(e=>!e),readerHref:d&&p===`text`?o:void 0}):null,(0,k.jsx)(U,{runId:e,entry:t,kind:p,showImage:p===`image`&&(!s||f),rendered:c?null:u?`markdown`:d?`html`:null,imageUrl:r})]})}function U({runId:e,entry:t,kind:n,showImage:r,rendered:i,imageUrl:o}){return r?(0,k.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,k.jsx)(`img`,{"data-slot":`file-preview-image`,src:o??a(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):n===`too-large`?(0,k.jsx)(f,{icon:(0,k.jsx)(T,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${B(t.size)} — past the preview cap. Open it in your editor instead.`}):n===`binary`?(0,k.jsx)(f,{icon:(0,k.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${B(t.size)} of binary data — no text preview.`}):i===`markdown`?(0,k.jsx)(`div`,{className:`p-4`,children:(0,k.jsx)(C,{document:!0,children:t.content??``})}):i===`html`?(0,k.jsx)(P,{html:t.content??``,title:`Report: ${t.path}`,className:`h-[70vh]`}):(0,k.jsx)(Y,{path:t.path,text:t.content??``})}function W({snapshot:e,downloadUrl:t,source:n,onSource:r,readerHref:i}){return(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-b border-border px-4 py-2 text-xs`,children:[e?(0,k.jsxs)(`span`,{children:[`Published snapshot · `,e]}):null,t?(0,k.jsx)(`a`,{className:`inline-flex min-h-11 items-center text-accent-text underline`,href:t,children:`Download`}):null,n===null?null:(0,k.jsx)(`button`,{className:`min-h-11 rounded px-2 text-accent-text underline focus-visible:ring-2`,onClick:r,children:n?`Preview`:`View source`}),i?(0,k.jsx)(G,{href:i}):null]})}function G({href:e}){let t=c(),n=s();return(0,k.jsx)(`a`,{className:`inline-flex min-h-11 items-center px-2 text-accent-text underline focus-visible:ring-2`,href:e,onClick:r=>b(r,t,e,n),children:`Open reader`})}function K({className:e,children:t}){return(0,k.jsx)(`section`,{"data-slot":`file-preview`,className:r(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,e),children:t})}var q=1500;function J(e,t){let n=(0,O.useMemo)(()=>t.split(`
|
|
2
|
-
`).map(e=>[{content:e}]),[t]),r=(0,O.useMemo)(()=>p(e),[e]),i=n.length>q,[a,o]=(0,O.useState)(null);return(0,O.useEffect)(()=>{if(r===null||i)return;let n=!1;return h(t,r).then(r=>{n||o({key:`${e}\0${t}`,tokens:r.tokens})}),()=>{n=!0}},[e,t,r,i]),r===null||i?n:a?.key===`${e}\0${t}`?a.tokens:m(t,r)?.tokens??n}function Y({path:e,text:t}){let n=J(e,t);return(0,k.jsx)(`div`,{"data-slot":`file-preview-code`,"data-lang":p(e)??`plaintext`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7]`,children:n.map((e,t)=>(0,k.jsxs)(`div`,{className:`flex px-4`,children:[(0,k.jsx)(`span`,{className:`w-10 shrink-0 select-none pr-3 text-right tabular-nums text-soft-foreground`,children:t+1}),(0,k.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre pr-4`,children:e.map((e,t)=>(0,k.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t))})]},t))})}export{R as a,E as c,B as i,T as l,H as n,P as o,V as r,D as s,Y as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-DSMR_WLb.js";import{i as n}from"./project-scope-context-C0FJXpqD.js";import{S as r}from"./queries-CK9ZDDfL.js";import{t as i}from"./createLucideIcon-BHp8sXmF.js";import{t as a}from"./chevron-right-BENZ-1ZN.js";import{t as o}from"./folder-o-AvL3y3.js";var s=i(`corner-left-up`,[[`path`,{d:`M14 9 9 4 4 9`,key:`1af5af`}],[`path`,{d:`M20 20h-7a4 4 0 0 1-4-4V4`,key:`1blwi3`}]]),c=e(),l=`x-apple.systempreferences:com.apple.preference.security?Privacy_FilesAndFolders`,u=`inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-foreground hover:bg-muted`;function d(e){let t=e.replace(/[\\/]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n<0?null:n===0?t.slice(0,1):t.slice(0,n)}function f({path:e,selected:n,onSelect:i,onEnter:l,decorate:u,emptyHint:d,showHidden:f=!1}){let m=r(e,f),h=m.data?.parent??null;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`p`,{"data-slot":`fs-breadcrumb`,className:`truncate font-mono text-[11px] text-soft-foreground`,title:m.data?.path??void 0,children:m.data?.path??(m.isError?``:`Loading…`)}),m.isError?(0,c.jsx)(p,{error:m.error,path:e,onEnter:l,onRetry:()=>void m.refetch()}):(0,c.jsxs)(`ul`,{"data-slot":`fs-listing`,className:`max-h-64 divide-y divide-border/60 overflow-y-auto overscroll-contain rounded-md border border-border`,children:[h===null?null:(0,c.jsx)(`li`,{className:`flex`,children:(0,c.jsxs)(`button`,{type:`button`,"data-slot":`fs-up`,onClick:()=>l(h),className:`flex flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,children:[(0,c.jsx)(s,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),`Up one level`]})}),(m.data?.dirs??[]).map(e=>(0,c.jsxs)(`li`,{className:`flex items-stretch`,children:[(0,c.jsxs)(`button`,{type:`button`,"data-slot":`fs-dir`,"aria-pressed":n?.path===e.path,onClick:()=>i(e),onDoubleClick:()=>l(e.path),className:t(`flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,n?.path===e.path&&`bg-muted`),children:[(0,c.jsx)(o,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,c.jsx)(`span`,{className:`truncate`,children:e.name}),u?.(e)]}),(0,c.jsx)(`button`,{type:`button`,"data-slot":`fs-enter`,"aria-label":`Open ${e.name}`,onClick:()=>l(e.path),className:`flex shrink-0 items-center px-2.5 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,c.jsx)(a,{className:`size-3.5`,"aria-hidden":`true`})})]},e.path)),m.data&&m.data.dirs.length===0?(0,c.jsx)(`li`,{className:`px-3 py-2 text-[13px] text-muted-foreground`,children:d}):null]}),m.data?.truncated?(0,c.jsx)(`p`,{"data-slot":`fs-truncated`,className:`text-[11px] text-muted-foreground`,children:`Too many folders to list — only the first ones are shown.`}):null]})}function p({error:e,path:t,onEnter:r,onRetry:i}){let a=e instanceof n&&e.status===403,o=t===null?null:d(t);return(0,c.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,c.jsx)(`p`,{"data-slot":`fs-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:e instanceof Error?e.message:`could not list that folder`}),a?(0,c.jsx)(`p`,{"data-slot":`fs-privacy-hint`,className:`text-[12.5px] text-soft-foreground`,children:`Allow it under Privacy & Security ▸ Files & Folders, then try again.`}):null,(0,c.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[12.5px]`,children:[o===null?null:(0,c.jsxs)(`button`,{type:`button`,"data-slot":`fs-error-back`,onClick:()=>r(o),className:u,children:[(0,c.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),`Back`]}),a?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`a`,{"data-slot":`fs-privacy-settings`,href:l,target:`_blank`,rel:`noreferrer`,className:u,children:`Open Privacy Settings`}),(0,c.jsx)(`button`,{type:`button`,"data-slot":`fs-retry`,onClick:i,className:u,children:`Try again`})]}):null]})]})}function m(e,t,n=!1){let i=r(e,n);return t?.path??i.data?.path??null}export{m as n,f as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{c as r,t as i}from"./utils-DSMR_WLb.js";import{J as a,Q as o,X as s,Z as c,_i as l,ci as u,jn as d,qt as f}from"./project-scope-context-C0FJXpqD.js";import{D as p,T as m,Tt as h,in as g,j as _,k as v,s as y,t as b,tn as x,w as S}from"./queries-CK9ZDDfL.js";import{h as ee}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{n as C}from"./toaster-Bo5vCbz-.js";import{F as w,I as T,X as E,Y as D,c as O,l as k,ot as A,p as j,r as M}from"./design-icons-CzEoMH9c.js";import{t as te}from"./chevron-down-CHGyCDBH.js";import{t as N}from"./chevron-right-BENZ-1ZN.js";import{l as P,n as F}from"./nav-row-styles-DqKjMToI.js";import{a as I,i as L}from"./format-BNCkW110.js";import{t as R}from"./button-BQ2y4XRB.js";import{i as z,r as B,t as V}from"./popover-BPgUYFyu.js";import{r as ne,t as H}from"./project-router-BYHPCHz0.js";import"./attention-BiqSbE32.js";import{f as re,v as ie}from"./task-groups-CZPi6W0m.js";import{t as ae}from"./status-dot-DtAOFiIi.js";import{a as oe,o as U,r as se,s as ce,t as le}from"./command-CDt1BsZy.js";import{t as W}from"./centered-state-V15AR_qo.js";import{Ct as ue,Dt as de,Et as fe,St as pe,Tt as me,_t as he,b as ge,bt as _e,en as ve,gt as ye,ht as be,mt as xe,ot as Se,s as Ce,vt as we,wn as Te,wt as Ee,xt as G,yt as De}from"./index-Br3WCnOm.js";import{a as Oe,d as ke,f as Ae,i as je,l as Me,n as Ne,o as Pe,r as Fe,s as Ie,t as Le,u as K}from"./use-hand-to-agent-state-DGAvwfdj.js";import{t as q}from"./tab-link-Crlr5m1D.js";var J=e(t(),1),Y=`cez-github-list-width`;function X(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 Re(){try{let e=localStorage.getItem(Y);return e===null?360:X(e)}catch{return 360}}function ze(e){try{localStorage.setItem(Y,String(X(e)))}catch{}}var Z=n();function Be({number:e,repo:t}){let n=r();return(0,Z.jsx)(Ve,{number:e,repo:t,scope:n},JSON.stringify([n,t,e]))}function Ve({number:e,repo:t,scope:n}){let r=(0,J.useId)(),i=(0,J.useId)(),[a,o]=(0,J.useState)(!1),s=a?te:N,c=x(n,!0,n==="default"),l=y(`#${e}`,!0),u=(0,J.useMemo)(()=>Ee(ie(c.data??[],l.data?.pages.flatMap(e=>e.runs)??[]),e,t,n),[c.data,l.data,e,t,n]);return(0,Z.jsxs)(`section`,{"aria-labelledby":r,className:`mt-4 min-w-0 rounded-lg border border-border p-3`,children:[(0,Z.jsx)(`h3`,{id:r,className:`text-xs font-semibold text-muted-foreground`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":a,"aria-controls":i,onClick:()=>o(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,Z.jsx)(s,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsxs)(`span`,{children:[`Linked tasks`,c.data?` (${u.length}${l.hasNextPage||l.isError?`+`:``})`:``]})]})}),(0,Z.jsx)(`div`,{id:i,children:a?(0,Z.jsxs)(Z.Fragment,{children:[c.isPending?(0,Z.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-muted-foreground`,children:`Loading linked tasks…`}):null,c.isError?(0,Z.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(`p`,{role:`status`,children:`Couldn’t load linked tasks. Check your connection and try again.`}),(0,Z.jsx)(R,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void c.refetch(),disabled:c.isFetching,children:`Retry linked tasks`})]}):null,c.data&&u.length===0&&!c.isError?(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`No linked tasks yet.`}):null,u.length>0?(0,Z.jsx)(`ul`,{className:`mt-2 flex flex-col gap-1`,children:u.map(e=>{let t=d(e);return(0,Z.jsx)(`li`,{children:(0,Z.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,Z.jsx)(`span`,{className:`text-sm font-medium break-words [overflow-wrap:anywhere]`,children:re(e)}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[(0,Z.jsx)(ae,{tone:t.tone,shape:t.shape,pulse:t.pulse,role:`img`,"aria-label":t.label,title:t.label}),e.archived?(0,Z.jsx)(`span`,{className:`rounded border border-border px-1`,children:`Archived`}):null,(0,Z.jsx)(`time`,{dateTime:e.createdAt,children:new Date(e.createdAt).toLocaleDateString()})]})]})},e.id)})}):null,l.isError?(0,Z.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(`p`,{role:`status`,children:`Couldn’t load older archived linked tasks.`}),(0,Z.jsx)(R,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void l.refetch(),disabled:l.isFetching,children:`Retry older linked tasks`})]}):l.hasNextPage?(0,Z.jsx)(R,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void l.fetchNextPage(),disabled:l.isFetchingNextPage,children:l.isFetchingNextPage?`Loading older linked tasks…`:`Show older linked tasks`}):null]}):null})]})}var Q=`w-44 max-w-full`,$=`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 He(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 Ue(e,t){return!!e&&t.length===1&&t[0]?.toLowerCase()===e.toLowerCase()}function We(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 Ge(e){return[e.viewerLogin?``:`GitHub login unavailable.`,We(e)].filter(Boolean).join(` `)}function Ke({options:e,assignees:t,onAssigneesChange:n}){return(0,Z.jsxs)(V,{children:[(0,Z.jsx)(z,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:$,disabled:e.length===0,children:[`Assignee`,t.length?` · ${t.length}`:``,(0,Z.jsx)(k,{size:12,"aria-hidden":`true`,className:`ml-1 inline size-3 shrink-0 align-[-1px] text-soft-foreground`})]})}),(0,Z.jsx)(B,{align:`start`,className:`w-64 max-w-[calc(100vw-2rem)] p-2`,children:(0,Z.jsxs)(`fieldset`,{className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] overflow-y-auto`,children:[(0,Z.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,Z.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded px-2 hover:bg-muted`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:r,onChange:()=>n(r?t.filter(t=>t.toLowerCase()!==e.toLowerCase()):[...t,e])}),(0,Z.jsx)(`span`,{className:`break-all text-sm`,children:e})]},e.toLowerCase())})]})})]})}function qe({data:e,projectId:t,onProjectChange:n,pickerRef:r}){return e.projects?.length?(0,Z.jsxs)(`select`,{ref:r,"aria-label":`Project board`,className:`${$} ${Q}`,value:t,onChange:e=>n(e.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:`All boards`}),e.projects.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.title},e.id))]}):e.projects||e.projectsState?(0,Z.jsx)(`select`,{ref:r,"aria-label":`Project board`,className:`${$} ${Q}`,disabled:!0,value:``,children:(0,Z.jsx)(`option`,{value:``,children:e.projects?`No boards`:e.projectsState===`refreshing`?`Loading boards…`:`Boards unavailable`})}):null}function Je({data:e,message:t,lastMessage:n,hasMessage:r,statusOpen:i,setStatusOpen:a,triggerRef:o,contentRef:s}){return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{role:`status`,className:`sr-only`,children:t}),(0,Z.jsxs)(V,{open:i,onOpenChange:a,children:[(0,Z.jsx)(z,{asChild:!0,children:(0,Z.jsx)(`button`,{ref:o,type:`button`,className:`${$} inline-flex items-center justify-center ${t?``:`invisible`}`,"aria-label":`Project board status`,tabIndex:t?void 0:-1,children:e.projectsState===`refreshing`?(0,Z.jsx)(D,{size:14,"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):(0,Z.jsx)(A,{size:14,"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsx)(B,{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 Ye({data:e,assignees:t,projectId:n,onAssigneesChange:r,onProjectChange:i}){let[a,o]=(0,J.useState)(!1),s=(0,J.useRef)(null),c=(0,J.useRef)(null),l=(0,J.useRef)(null),u=(0,J.useRef)(null),d=He(e.issues,t),f=Ue(e.viewerLogin,t),p=Ge(e),m=p!==``,h=(0,J.useRef)(p);m&&(h.current=p);let g=(0,J.useRef)(!m);g.current=!m;let _=()=>(l.current&&!l.current.disabled?l.current:u.current)?.focus();return(0,J.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,J.useEffect)(()=>{if(m)return;let e=document.activeElement,t=!!e&&(e===s.current||!!c.current?.contains(e));o(!1),t&&_()},[m]),(0,Z.jsxs)(`div`,{className:`contents`,"data-slot":`gh-issue-filters`,children:[(0,Z.jsx)(Ke,{options:d,assignees:t,onAssigneesChange:r}),(0,Z.jsx)(`button`,{ref:u,type:`button`,className:`${$} 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,Z.jsx)(qe,{data:e,projectId:n,onProjectChange:i,pickerRef:l}),(0,Z.jsx)(Je,{data:e,message:p,lastMessage:h,hasMessage:m,statusOpen:a,setStatusOpen:o,triggerRef:s,contentRef:c})]})}function Xe({onRefresh:e,refreshing:t}){let n=xe(r());return(0,Z.jsxs)(`div`,{"data-route":`github`,"data-slot":`github-filter-screen`,className:F,children:[(0,Z.jsxs)(`div`,{className:`mb-[16px] flex items-center gap-[8px]`,children:[(0,Z.jsx)(`h1`,{className:i(P,`min-w-0 flex-1`),children:`GitHub`}),(0,Z.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,Z.jsx)(D,{size:17,"aria-hidden":`true`,className:i(`size-[17px]`,t&&`motion-safe:animate-spin`)})})]}),(0,Z.jsx)(be,{model:n,variant:`screen`})]})}function Ze(e){let t=getComputedStyle(e).overflowY;return t===`auto`||t===`scroll`?e:e.closest(`[data-slot="main"]`)??e}function Qe(e){let[t,n]=(0,J.useState)(null);return(0,J.useLayoutEffect)(()=>{if(!e){n(null);return}let t=()=>n(Ze(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 $e(e,t){let[n,r]=(0,J.useState)(0);return(0,J.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 et(e,t,n){let[r,i]=(0,J.useState)(null),a=(0,J.useRef)(n);return(0,J.useEffect)(()=>{a.current=n}),(0,J.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 tt(e,t,n,r,i){let[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(null),l=Qe(a),u=(0,J.useRef)(null);u.current=l;let d=$e(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:et(p&&!i&&!t.isFetchingNextPage&&!t.isFetchNextPageError,l,()=>void t.fetchNextPage())}}var nt=100;function rt(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>=nt)break;a.add(t.number)}return[...a]}function it(e,t,n,r,i,a){let o=rt(n,e,r,i,a),s=S(o,e===`prs`),c=s.data?.available?s.data.checks:void 0,l=m(e===`issues`?`issue`:`pr`,(0,J.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,J.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 at(e){let[t,n]=ge(),r=t.get(`filter`),i=me(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 ot(e,t,{filter:n,activeFilter:r,setFilterParam:i}){let[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)([]),[l,u]=(0,J.useState)([]),{setProjectFilter:d,activeProject:f}=st(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 st(e){let[t,n]=(0,J.useState)(``),r=e?.projectsState===`refreshing`||e?.projectsState===`unavailable`,i=r||e?.projects?.some(e=>e.id===t)?t:``;return(0,J.useEffect)(()=>{e&&!r&&t&&!i&&n(``)},[e,t,i,r]),{setProjectFilter:n,activeProject:i}}function ct(e,t,{filter:n,activeFilter:i},a){let o=r(),s=e===`issues`&&(i===`no-task`||i===`has-task`),c=x(o,s,o==="default"),l=(0,J.useMemo)(()=>c.data?ue(c.data,t?.repo,o):null,[c.data,t?.repo,o]),u=pe(e,n)?de(n):null,d=_(`pr`,u??``,u!==null&&t?.available===!0),f=u!==null&&d.data?.available?d.data.items:null,p=(0,J.useMemo)(()=>t?.available?e===`issues`?t.issues:t.prs:[],[t,e]),m=(0,J.useMemo)(()=>f?fe(f,p):null,[f,p]),h=lt({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,J.useMemo)(()=>h?[]:m??p,[h,m,p]),narrow:(0,J.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 lt({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 ut(e,t){return t?o(t.kind,t.number,{refresh:!0}).then(n=>(e.setQueryData(t.key,n),!0)).catch(()=>!1):Promise.resolve(!0)}function dt(e,t,n,{filterGate:r,filterRows:i,fullList:a}){let o=b.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,J.useState)(null);return(0,J.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 ft(e,t,n,{fullList:r,filterRows:i},a){let o=u(),s=(0,J.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=p(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:b.githubItem(c,n)}:null;let[m,h]=(0,J.useState)(!1);return{exactWanted:l,exactItem:d,exactDetail:f,exactTargetRef:s,retryingExact:m,retryExact:()=>{h(!0),ut(o,s.current).then(e=>{h(!1),e||C(`Could not reach GitHub for #${n}`,{tone:`danger`})})}}}function pt(e,t,n){let r=u(),i=(0,J.useRef)(null);return{refresh:g({mutationFn:e=>(ut(r,e),a({refresh:!0,limit:50})),onSuccess:async a=>{await r.cancelQueries({queryKey:b.githubPages(50),exact:!0}),r.setQueryData(b.githubPages(50),{pages:[a],pageParams:[{}]}),r.invalidateQueries({queryKey:b.githubChecks(t)});let o=e===`issues`?`issue`:`pr`,u=(e===`issues`?a.issues:a.prs).map(e=>e.number),d=b.githubCommentCounts(o,u);r.removeQueries({queryKey:b.githubCommentCounts(o,[]).slice(0,4),predicate:e=>e.queryHash!==l(d)}),a.available&&a.commentsDeferred&&u.length>0&&s(o,u,{refresh:!0}).then(e=>r.setQueryData(d,e)).catch(()=>{}),r.invalidateQueries({queryKey:b.githubSearch(e===`issues`?`issue`:`pr`,n)}),r.invalidateQueries({queryKey:b.githubSearch(`pr`,_e)}),r.invalidateQueries({queryKey:b.githubSearch(`pr`,he)});let f=i.current,p=b.githubComments(`issue`,0).slice(0,3);if(!f){r.removeQueries({queryKey:p});return}let m=b.githubComments(f.kind,f.number);c(f.kind,f.number,{refresh:!0}).then(e=>r.setQueryData(m,e)).catch(()=>{}),r.removeQueries({queryKey:p,predicate:e=>e.queryHash!==l(m)})},onError:e=>C(e.message,{tone:`danger`})}),openThreadRef:i}}var mt=350;function ht(e,t){let[n,r]=(0,J.useState)(e);return(0,J.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function gt(e,t,{query:n,labelFilter:r,effectiveAssignees:i,activeProject:a},{openItems:o,narrow:s,filterGate:c}){let l=ht(n,mt),u=(0,J.useMemo)(()=>K(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&&Ae(l,u),p=_(e===`issues`?`issue`:`pr`,l,f),m=K(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)),v=_t(e,h,a,i);return{debouncedQuery:l,searchWanted:f,forgeSearch:p,items:m,searchPayload:h,metadataFailure:v,searchHits:h&&!v?K(h.items,{labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}).filter(e=>!g.has(e.number)):[],...vt(n,d,f,p)}}function _t(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 vt(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 yt({width:e,onWidthChange:t}){let n=(0,J.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(X(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,Z.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(X(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 bt({view:e,changes:t=!1,index:n=!1}){let{n:r}=ee(),i=at(e),{rawFilterParam:a,activeFilter:o}=i,s=ve(),{pages:c,data:l}=v(50),u=Te(),d=St(),f=Le(),p=xt({index:n,isDesktop:s,rawFilterParam:a,n:r,rememberedView:h().data?.githubView}),m=Ct(l?.available===!0&&!p.filterScreen),[g,_]=(0,J.useState)(!1),y=ot(e,l,i),b=ct(e,l,i,y.isAssignedFilter),x=gt(e,l,y,b),S=dt(e,r,x.forgeSearch,b),C=ft(e,l,S.selectedNumber,b,S.remoteDetail),w=it(e,c,l,S.selectedNumber,x.searchHits,b.openItems),{refresh:T,openThreadRef:E}=pt(e,w.checkPrNumbers,x.debouncedQuery),D=tt(e,c,l,b.backedQuery,y.narrowing);if(p.restorePrs)return(0,Z.jsx)(ne,{to:`/github/prs`,replace:!0});if(!l)return c.isError?(0,Z.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(W,{icon:(0,Z.jsx)(A,{size:16}),tone:`danger`,title:`Could not load GitHub`,subtitle:c.error.message})}):(0,Z.jsx)(Se,{});E.current=null;let O=()=>T.mutate(C.exactTargetRef.current);if(p.filterScreen&&l.available)return(0,Z.jsx)(Xe,{onRefresh:O,refreshing:T.isPending});if(!l.available)return(0,Z.jsx)(Ot,{reason:l.reason,refreshing:T.isPending,onRetry:O});let{labelColors:k,labelOptions:j}=wt(l,x.searchPayload,b.openItems,b.fullList),M=Tt({number:S.selectedNumber,items:x.items,searchHits:x.searchHits,fullList:b.fullList,filterRows:b.filterRows,remoteDetail:S.remoteDetail,exactDetail:C.exactDetail});E.current=M?{kind:M.kind,number:M.number}:null;let{linkFilter:te,listPath:N}=Et(e,a,o,s),P={view:e,filter:te,colors:k,selected:M,queued:f.queued,checksMap:w.checksMap,commentsOf:w.commentsOf},F=Dt(e,y,b.filterGate,x);return(0,Z.jsxs)(`div`,{ref:m.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,Z.jsx)(kt,{view:e,activeFilter:o,isDesktop:s,rawFilterParam:a,n:r,gh:l}),(0,Z.jsxs)(`div`,{ref:m.workspaceRef,"data-slot":`gh-workspace`,"data-stacked":m.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,Z.jsxs)(`header`,{"data-slot":`gh-header`,className:`flex shrink-0 flex-col gap-3 bg-background md:gap-[22px]`,children:[(0,Z.jsx)(At,{view:e,isDesktop:s,gh:l,automationsAvailable:u,onSaveView:d,refreshing:T.isPending,onRefresh:O}),(0,Z.jsx)(jt,{view:e,gh:l,filters:y,labelOptions:j,labelColors:k,searchPayload:x.searchPayload})]}),(0,Z.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,Z.jsx)(Pt,{view:e,n:r,rows:P,verdict:F,search:x,sidebar:b,list:c,paging:D,width:m.githubListWidth,onWidthChange:m.changeGithubListWidth,expanded:g,onExpandedChange:_}),(0,Z.jsx)(Bt,{view:e,n:r,selected:M,selectedNumber:S.selectedNumber,exact:C,repo:l.repo,rows:P,listPath:N,changes:t,handToAgent:f})]})]})]})}function xt({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 St(){let e=u();return t=>{e.setQueryData(b.uiState,e=>({...e,githubView:t})),f({githubView:t}).then(t=>e.setQueryData(b.uiState,t)).catch(t=>{C(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:b.uiState})})}}function Ct(e){let[t,n]=(0,J.useState)(Re),[r,i]=(0,J.useState)(!0),a=(0,J.useRef)(null),o=(0,J.useRef)(null);return(0,J.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=X(e);n(t),ze(t)},panesStacked:r,routeRef:a,workspaceRef:o}}function wt(e,t,n,r){return{labelColors:{...t?.labelColors,...e.labelColors},labelOptions:Me([...n,...r,...t?.items??[]])}}function Tt({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 Et(e,t,n,r){let i=t===null?null:n;return{linkFilter:i,listPath:G(e,i??(e===`issues`&&!r?`all`:null))}}function Dt(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,Z.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,Z.jsx)(I,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):null,r.message]}):n?i?(0,Z.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(I,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,t.trim(),`”…`]}):a?c.length>0?(0,Z.jsxs)(`p`,{role:`status`,children:[`Showing previous results. GitHub could not be refreshed: `,o,`. Use Refresh to try again.`]}):u.length>0?(0,Z.jsxs)(`p`,{children:[`GitHub could not be searched: `,o,`.`]}):(0,Z.jsxs)(`p`,{children:[`No open `,d,` match your filter, and GitHub could not be searched: `,o,`.`]}):s?(0,Z.jsxs)(`p`,{role:`status`,children:[`Cannot apply the selected filters to GitHub results: `,s]}):c.length>0?null:l?.truncated?(0,Z.jsx)(`p`,{children:`No matches within GitHub’s first matches. Narrow your search to check more specific results.`}):l&&u.length>0?(0,Z.jsxs)(`p`,{children:[`No additional `,d,` match your filter on GitHub.`]}):l?(0,Z.jsxs)(`p`,{children:[`No `,d,` match your filter — open, closed or merged.`]}):(0,Z.jsxs)(`p`,{children:[`No open `,d,` match your filter.`]}):(0,Z.jsxs)(`p`,{children:[`No open `,d,`.`]})}function Ot({reason:e,refreshing:t,onRetry:n}){return(0,Z.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(W,{icon:(0,Z.jsx)(T,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:e??`unknown reason`,actions:(0,Z.jsx)(R,{variant:`outline`,"data-action":`gh-retry`,disabled:t,onClick:n,children:`Try again`}),children:(0,Z.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,Z.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,Z.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in Squawk works without it.`]})})})}function kt({view:e,activeFilter:t,isDesktop:n,rawFilterParam:r,n:i,gh:a}){return(0,Z.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,Z.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight md:text-[15px] md:tracking-normal`,children:n?`${e===`issues`?`Issues`:`Pull requests`} · ${ye[t]}`:`GitHub`}),r!==null&&i===void 0?(0,Z.jsxs)(`div`,{"data-slot":`gh-filter-context`,className:`flex min-w-0 items-center gap-3 md:hidden`,children:[(0,Z.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,Z.jsx)(M,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to filters`]}),t===`all`?null:(0,Z.jsx)(`span`,{"data-slot":`gh-active-filter`,className:`truncate text-xs text-soft-foreground`,children:[...we,...De].find(e=>e.id===t)?.label})]}):null,a.repo?(0,Z.jsxs)(`span`,{className:`min-w-0 truncate text-[13px] text-muted-foreground md:text-[11px] md:text-soft-foreground`,children:[(0,Z.jsx)(`span`,{"data-slot":`gh-repo`,children:a.repo}),(0,Z.jsxs)(`span`,{"data-slot":`gh-synced`,children:[` · `,a.syncedAt?`Synced ${L(a.syncedAt)} ago`:`Not synced yet`]})]}):null]})}function At({view:e,isDesktop:t,gh:n,automationsAvailable:r,onSaveView:a,refreshing:o,onRefresh:s}){return(0,Z.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`flex min-h-11 flex-wrap items-center gap-3`,children:[(0,Z.jsxs)(q,{to:t?`/github`:`/github?filter=all`,active:e===`issues`,onClick:()=>a(`issues`),children:[`Issues · `,n.issuesTotal??n.issues.length]}),(0,Z.jsxs)(q,{to:`/github/prs`,active:e===`prs`,onClick:()=>a(`prs`),children:[`Pull requests · `,n.prsTotal??n.prs.length]}),r?(0,Z.jsx)(H,{to:`/automations/new`,className:`gh-utility`,children:`Set up automations`}):null,(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:o,onClick:s,className:`gh-utility`,children:[(0,Z.jsx)(D,{size:16,"aria-hidden":`true`,className:i(`size-3.5`,o&&`motion-safe:animate-spin`)}),`Refresh`]})]})}function jt({view:e,gh:t,filters:n,labelOptions:r,labelColors:i,searchPayload:a}){return(0,Z.jsxs)(`div`,{"data-slot":`gh-filter-toolbar`,className:`flex flex-wrap items-center gap-2.5`,children:[(0,Z.jsxs)(`div`,{className:`relative min-w-0 basis-full md:flex-1 md:basis-auto`,children:[(0,Z.jsx)(E,{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,Z.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,Z.jsx)(Kt,{options:r,colors:i,selected:n.labelFilter,onChange:n.setLabelFilter}),e===`issues`?(0,Z.jsx)(Ye,{data:{...t,issues:[...t.issues,...a?.items??[]]},assignees:n.effectiveAssignees,projectId:n.activeProject,onAssigneesChange:n.changeAssignees,onProjectChange:n.setProjectFilter}):null,(0,Z.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 Mt(e,t){return e.kind===`pr`?t?.[e.number]??e.checks:e.checks}function Nt(e,t){return(0,Z.jsx)(Gt,{item:e,view:t.view,filter:t.filter,colors:t.colors,active:t.selected?.url===e.url,queued:t.queued.has(e.url),checks:Mt(e,t.checksMap),comments:t.commentsOf(e)})}function Pt({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,Z.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,Z.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-soft-foreground`,children:r}):(0,Z.jsx)(Ft,{items:f,rows:n,compactPreview:m,paging:s}),s.pagingAvailable?(0,Z.jsx)(It,{view:e,list:o,paging:s}):null,(0,Z.jsx)(Lt,{backedQuery:a.backedQuery,filterSearch:a.filterSearch}),(0,Z.jsx)(Rt,{view:e,n:t,count:f.length,expanded:u,onExpandedChange:d}),f.length>0&&i.searchWanted&&r?(0,Z.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,Z.jsx)(zt,{hits:p,searchPayload:i.searchPayload,rows:n}):null,(0,Z.jsx)(yt,{width:c,onWidthChange:l})]})}function Ft({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,Z.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:Nt(e,t)},e.url));return(0,Z.jsx)(`div`,{ref:i,"data-slot":`gh-rows`,"data-virtualized":a?`true`:void 0,role:`list`,children:a?(0,Z.jsx)(Ce,{scrollRef:s,startMargin:c,children:l},a===o?`list`:`main`):l})}function It({view:e,list:t,paging:n}){return(0,Z.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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(I,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Loading more…`]}):t.isFetchNextPageError?(0,Z.jsxs)(Z.Fragment,{children:[`Could not load more.`,(0,Z.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,Z.jsxs)(Z.Fragment,{children:[`Filters cover the loaded `,e===`issues`?`issues`:`pull requests`,`.`,(0,Z.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 Lt({backedQuery:e,filterSearch:t}){return e!==null&&t.data?.available&&t.data.truncated?(0,Z.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 Rt({view:e,n:t,count:n,expanded:r,onExpandedChange:i}){return e===`issues`&&t!==void 0&&n>2?(0,Z.jsx)(R,{variant:`outline`,className:`mt-2 self-start md:hidden`,"data-slot":`gh-expand-list`,"aria-expanded":r,onClick:()=>i(e=>!e),children:r?`Show fewer issues`:`View all ${n} issues`}):null}function zt({hits:e,searchPayload:t,rows:n}){return(0,Z.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,Z.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,Z.jsx)(`ul`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:e.map(e=>(0,Z.jsx)(`li`,{children:Nt(e,n)},e.url))})]})}function Bt({view:e,n:t,selected:n,selectedNumber:r,exact:a,repo:o,rows:s,listPath:c,changes:l,handToAgent:u}){let{exactWanted:d,exactItem:f}=a;return(0,Z.jsx)(`section`,{"data-slot":`gh-detail`,className:i(`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,Z.jsx)(Vt,{item:n,n:t,repo:o,rows:s,listPath:c,changes:l,handToAgent:u}):d&&f.isPending?(0,Z.jsx)(`div`,{"data-slot":`gh-detail-loading`,className:`flex min-h-full flex-1 flex-col`,children:(0,Z.jsx)(W,{icon:(0,Z.jsx)(I,{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,Z.jsx)(Ht,{number:r,exact:a}):(0,Z.jsx)(Ut,{view:e,number:r})})}function Vt({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,Z.jsx)(Pe,{item:e,comments:r.commentsOf(e),afterHeading:e.kind===`issue`?(0,Z.jsx)(Be,{number:e.number,repo:n},t??`list`):void 0,backLink:{to:i},subNav:{filter:r.filter,changes:a},onRunAgent:Wt,colors:r.colors,checks:Mt(e,r.checksMap),children:(0,Z.jsx)(Ne,{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 Ht({number:e,exact:t}){let{exactItem:n,retryingExact:r,retryExact:i}=t;return(0,Z.jsx)(W,{icon:(0,Z.jsx)(A,{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,Z.jsx)(R,{variant:`outline`,disabled:r,onClick:i,children:`Retry`})})}function Ut({view:e,number:t}){return(0,Z.jsx)(W,{icon:e===`issues`?(0,Z.jsx)(j,{size:16}):(0,Z.jsx)(w,{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 Wt(){let e=document.querySelector(`[data-slot="gh-detail-inner"] [data-slot="gh-custom-prompt"]`);e?.scrollIntoView({block:`center`}),e?.focus({preventScroll:!0})}function Gt({item:e,view:t,filter:n,colors:r,active:a,queued:o,checks:s,comments:l}){let d=e.kind===`issue`?j:w,f=u(),p=()=>{f.prefetchQuery({queryKey:b.githubComments(e.kind,e.number),queryFn:({signal:t})=>c(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,Z.jsxs)(H,{to:G(t,n,e.number),draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,Fe(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},onMouseEnter:p,onFocus:p,"data-slot":`gh-row`,"data-number":e.number,"data-kind":e.kind,"aria-current":a?`page`:void 0,title:`Drag into the composer to prefill a task`,className:i(`flex flex-col gap-2 rounded-md px-3 py-4 transition-colors hover:bg-muted`,a&&`bg-accent-strong/10 text-accent-text`),children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 md:items-center`,children:[(0,Z.jsx)(d,{"aria-hidden":`true`,"data-slot":`gh-row-icon`,className:i(`mt-0.5 size-3.5 shrink-0 md:mt-0`,e.kind===`issue`?`text-success`:`text-accent-icon`)}),(0,Z.jsx)(`span`,{"data-slot":`gh-row-title`,className:i(`line-clamp-2 min-w-0 text-[13px] font-medium md:block md:truncate`,a&&`font-semibold`),children:e.title})]}),(0,Z.jsxs)(`span`,{"data-slot":`gh-row-meta`,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,Z.jsxs)(`span`,{children:[`#`,e.number]}),(0,Z.jsx)(`span`,{"data-slot":`gh-row-author`,className:`max-w-full shrink-0 truncate md:min-w-0 md:shrink`,children:e.author}),(0,Z.jsx)(`span`,{children:L(e.createdAt)}),(0,Z.jsx)(Oe,{count:l}),s?(0,Z.jsx)(je,{checks:s}):null,o?(0,Z.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-accent-text`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,Z.jsx)(`span`,{"data-slot":`gh-row-labels`,className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,Z.jsx)(Ie,{label:e,color:r[e],plain:!0},e))}):null]})}function Kt({options:e,colors:t,selected:n,onChange:r}){let[a,o]=(0,J.useState)(!1),s=e=>r(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,Z.jsxs)(V,{open:a,onOpenChange:o,children:[(0,Z.jsx)(z,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:i(`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,Z.jsx)(k,{size:12,"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(B,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,Z.jsxs)(le,{children:[(0,Z.jsx)(oe,{placeholder:`Filter labels…`}),(0,Z.jsxs)(ce,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Z.jsx)(se,{children:`No labels.`}),n.length>0?(0,Z.jsxs)(U,{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,Z.jsxs)(U,{value:e,onSelect:()=>s(e),className:`min-h-11`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:ke(t[e])}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e)})]})]})})]})}export{bt as GithubRoute};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{M as i,q as a}from"./queries-CK9ZDDfL.js";import{f as o,n as s}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{A as c,B as l,D as u,F as d,I as f,J as p,K as m,M as h,O as g,P as _,Q as v,R as y,S as b,V as x,W as ee,X as S,Z as C,_ as te,a as ne,b as re,d as w,f as ie,h as ae,i as oe,j as se,k as T,l as E,n as D,o as O,p as k,q as A,r as j,t as M,u as N,v as P,x as F,y as I,z as L}from"./activity-motion-B7vHpK-u.js";import{t as R}from"./button-BQ2y4XRB.js";import{i as z}from"./project-order-AcHI4Dcl.js";import{xn as B}from"./index-Br3WCnOm.js";var V=e(t(),1);function H(e,t){if(!t||t.length===0)return[...e];let n=new Map(t.map((e,t)=>[e,t])),r=e.filter(e=>n.has(e.projectId)),i=e.filter(e=>!n.has(e.projectId));return r.sort((e,t)=>(n.get(e.projectId)??0)-(n.get(t.projectId)??0)),[...r,...i]}function U(e){let t=[],n=[];for(let r of e)x(r)===void 0&&r.tasks.length===0?n.push(r):t.push(r);return{panels:t,idle:n}}function W(e){let t=new Set(e.tasks.map(e=>e.runId));return e.requests.filter(e=>e.relationship===`peer`&&t.has(e.senderRunId)&&t.has(e.recipientRunId))}function G(e,t){let n=new Set(e.map(e=>e.runId));return t.filter(e=>n.has(e.waiterRunId)&&n.has(e.peerRunId))}function K(e){let t=e.tasks.length,n=e.tasks.reduce((e,t)=>e+t.workers.filter(e=>A(e.status)).length,0),r=[`${t} active task${t===1?``:`s`}`];return n>0&&r.push(`${n} worker${n===1?``:`s`}`),r.join(` · `)}function ce(e,t){let n=t?`more `:``;return e===1?`1 ${n}project has no active work:`:`${e} ${n}projects have no active work:`}var q=n(),le={w:104,h:20};function ue(e){let t=e.getBoundingClientRect(),n=new Map;for(let r of e.querySelectorAll(`[data-activity-pill]`)){let e=r.getAttribute(`data-activity-pill`);e&&n.set(e,re(r.getBoundingClientRect(),t))}return n}function de(e,t,n=[]){let r=ue(e),i=[...r.values()],a=[...t.map(e=>({requestId:e.requestId,senderRunId:e.senderRunId,recipientRunId:e.recipientRunId,kind:`peer`})),...n.map(e=>({...P(e),kind:`wait`}))],o=F(a),s=[];for(let e of a){let t=r.get(e.senderRunId),n=r.get(e.recipientRunId);t&&n&&s.push({id:e.requestId,kind:e.kind,...I(t,n,i,o.get(e.requestId))})}let c=b(s.map(e=>({id:e.id,at:e.label})),le,`x`);return s.map(e=>({...e,label:c.get(e.id)??e.label}))}function fe(e,t){return e.length===t.length&&e.every((e,n)=>e.id===t[n]?.id&&e.d===t[n]?.d&&e.label.x===t[n]?.label.x&&e.label.y===t[n]?.label.y)}var J=`pointer-events-none absolute z-[4] -translate-x-1/2 -translate-y-1/2 rounded-md border bg-background px-1.5 py-px text-[10.5px] whitespace-nowrap text-foreground tabular-nums max-md:hidden`;function pe({arc:e,wait:t,now:n,motion:i}){return(0,q.jsxs)(`span`,{"data-slot":`activity-arc-label`,"data-wait":t.id,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y},className:r(J,`border-dashed border-message-peer-accent`,t.id in i.waitsClosing&&`activity-line-out`),children:[(0,q.jsx)(`span`,{className:`font-semibold text-message-peer-accent`,children:`Waiting`}),` · `,S(C(t.since,n))]})}function me({arc:e,request:t,now:n,motion:i}){let a=ie(i,e.id);return(0,q.jsxs)(`span`,{"data-slot":`activity-arc-label`,"data-request":e.id,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y},className:r(J,a?`border-success`:`border-message-peer-accent`,w(i,e.id)===`fade`&&`activity-line-out`),children:[a?(0,q.jsx)(`span`,{className:`font-semibold text-success`,children:`Replied`}):(0,q.jsx)(`span`,{className:`font-semibold text-message-peer-accent`,children:`Request`}),` · `,S(C(t.createdAt,n))]})}var he=[],ge=new Set;function _e({arcs:e,waits:t=he,active:n=ge,layoutKey:i,now:a,motion:o=d,paused:s=!1}){let c=V.useRef(null),l=ae(c,V.useCallback(n=>de(n,e,t),[e,t]),fe,`[data-activity-pill]`,i),u=V.useMemo(()=>new Set(l.map(e=>e.id)),[l]),f=te(o.comets,u,s),p=new Map(e.map(e=>[e.requestId,e])),m=new Map(t.map(e=>[e.id,e])),h=V.useId().replace(/[^a-zA-Z0-9_-]/g,``),g=`activity-arrow-arc-${h}`,_=`activity-ring-arc-${h}`;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`svg`,{ref:c,"data-slot":`activity-arcs`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 z-[3] size-full overflow-visible max-md:hidden`,children:[(0,q.jsxs)(`defs`,{children:[(0,q.jsx)(`marker`,{id:g,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerWidth:`7`,markerHeight:`7`,orient:`auto`,children:(0,q.jsx)(`path`,{d:`M0 0 10 5 0 10z`,className:`fill-message-peer-accent`})}),(0,q.jsx)(E,{id:_})]}),l.map(e=>{if(e.kind===`wait`){let t=n.has(e.id);return(0,q.jsx)(`path`,{"data-wait":e.id,"data-kind":`wait`,"data-active":t?`true`:void 0,d:e.d,fill:`none`,strokeDasharray:`0 8`,strokeLinecap:`round`,strokeWidth:t?3:2.2,markerEnd:`url(#${_})`,className:r(`stroke-message-peer-accent`,t?`opacity-100`:`opacity-80`,k(o,e.id))},e.id)}let t=w(o,e.id);return(0,q.jsx)(`path`,{"data-request":e.id,"data-kind":`peer`,"data-phase":t,d:e.d,fill:`none`,strokeDasharray:t===`replied`?void 0:`6 5`,strokeWidth:2,markerEnd:`url(#${g})`,className:r(`stroke-message-peer-accent`,N(t,e.id in o.opening))},e.id)}),(0,q.jsx)(`g`,{ref:f,"data-slot":`activity-comets`})]}),l.map(e=>{let t=e.kind===`wait`?m.get(e.id):void 0;if(t)return(0,q.jsx)(pe,{arc:e,wait:t,now:a,motion:o},e.id);let n=p.get(e.id);return n?(0,q.jsx)(me,{arc:e,request:n,now:a,motion:o},e.id):null})]})}var Y=(e,t)=>`/p/${encodeURIComponent(e)}/tasks/${encodeURIComponent(t)}`,ve=[],ye=`relative z-[1] inline-flex min-h-11 items-center text-[12px] text-message-peer-accent hover:underline focus-visible:outline-2 focus-visible:outline-ring`;function be({task:e}){let t=e.workers.filter(e=>A(e.status));return t.length===0?null:(0,q.jsxs)(`div`,{"data-slot":`activity-pill-workers`,className:`mt-1.5 ml-[19px] flex flex-wrap items-center gap-1 text-[11px] text-muted-foreground`,children:[t.map(e=>(0,q.jsx)(h,{run:e,role:`worker`},e.runId)),(0,q.jsxs)(`span`,{className:`ml-0.5`,children:[t.length,` worker`,t.length===1?``:`s`]})]})}function xe({projectId:e,task:t,requests:n,waits:i=ve,index:a,ctx:o,motion:l=d,linked:f=!1,onHover:m}){let v=p(t,o);return(0,q.jsxs)(`li`,{"data-activity-pill":t.runId,"data-rung":t.rung,"data-action":v.action,"data-linked":f?`true`:void 0,...T(t.runId,m),className:r(`relative min-w-0 rounded-[10px] border bg-card-2 px-2.5 py-2`,v.action?`border-pending`:`border-border`,f&&`outline-2 outline-offset-2 outline-message-peer-accent`,t.runId in l.entering&&`activity-card-enter`),children:[(0,q.jsx)(u,{task:t,motion:l,glow:v.action!==void 0}),(0,q.jsxs)(`div`,{className:`flex items-center gap-[7px]`,children:[(0,q.jsx)(h,{run:t,role:`root`}),(0,q.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[12.5px] font-medium`,children:(0,q.jsx)(s,{to:Y(e,t.runId),className:`after:absolute after:inset-0 after:rounded-[10px] after:content-[''] focus-visible:outline-2 focus-visible:outline-ring`,children:t.title})}),(0,q.jsx)(c,{rate:t.rate,className:`h-3 w-10`})]}),(0,q.jsxs)(`p`,{"data-slot":`activity-pill-line`,className:`mt-[3px] ml-[19px] truncate text-[11.5px] text-muted-foreground tabular-nums`,children:[(0,q.jsx)(_,{"data-slot":`activity-verb`,tone:v.tone,className:`font-semibold`,children:v.verb}),` · `,(0,q.jsx)(`span`,{"data-slot":`activity-main`,className:r(v.mono&&`font-mono text-[11px]`),children:v.main})]}),(0,q.jsx)(g,{texts:y(t.runId,n,a,i)}),(0,q.jsx)(be,{task:t}),(0,q.jsx)(se,{runId:t.runId,requests:n,waits:i,index:a,link:s,pathOf:t=>Y(e,t),className:`mt-1 ml-[19px] flex flex-col md:hidden`,linkClassName:ye})]})}var X=e=>`/p/${encodeURIComponent(e)}/activity`,Se=e=>`/p/${encodeURIComponent(e)}/`,Z=`rounded-xl border border-border bg-card px-4 pt-3.5 pb-4`,Ce=`ml-auto inline-flex items-center text-[12px] text-accent-text hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11`;function Q({project:e,headingId:t,detail:n,to:r,label:i}){return(0,q.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,q.jsx)(`h2`,{id:t,className:`min-w-0 truncate text-[14px] font-semibold`,children:e.name}),(0,q.jsx)(`span`,{"data-slot":`activity-panel-detail`,className:`text-[12px] text-muted-foreground`,children:n}),(0,q.jsx)(s,{to:r,className:Ce,children:i})]})}function $({project:e,notice:t}){let n=V.useId();return(0,q.jsx)(`section`,{"aria-labelledby":n,"data-slot":`activity-panel`,"data-project":e.projectId,"data-notice":`true`,className:Z,children:(0,q.jsx)(Q,{project:e,headingId:n,detail:t,to:Se(e.projectId),label:`Open project →`})})}function we(e,t){return V.useMemo(()=>{let n=new Set(e.requests.map(e=>e.requestId)),r=Object.values(t.closing).filter(t=>t.projectId===e.projectId&&!n.has(t.request.requestId)).map(e=>e.request);return W({tasks:e.tasks,requests:[...e.requests,...r]})},[e,t.closing])}function Te({project:e,now:t,motion:n=d,paused:i=!1}){let a=V.useId(),o=V.useMemo(()=>ee(e),[e]),s=we(e,n),c=V.useMemo(()=>l(e.tasks),[e.tasks]),u=V.useMemo(()=>G(e.tasks,[...c,...f(e.projectId,c,n)]),[e.tasks,e.projectId,c,n]),p=O(c),m={now:t,titleOf:e=>L(o,e)},h=`${e.tasks.map(e=>e.runId).join(`,`)}:${s.map(e=>e.requestId).join(`,`)}:${u.map(e=>e.id).join(`,`)}`,g=s.length>0||u.length>0;return(0,q.jsxs)(`section`,{"aria-labelledby":a,"data-slot":`activity-panel`,"data-project":e.projectId,className:Z,children:[(0,q.jsx)(Q,{project:e,headingId:a,detail:K(e),to:X(e.projectId),label:`Open project activity →`}),(0,q.jsxs)(`div`,{className:r(`relative mt-3`,g&&`md:mt-1 md:pt-10`),children:[(0,q.jsx)(`ul`,{"data-slot":`activity-pills`,"aria-label":`${e.name} tasks`,className:r(`grid grid-cols-[repeat(auto-fill,minmax(min(100%,220px),1fr))] items-start gap-3.5`,g&&`md:gap-y-11`),children:e.tasks.map(t=>(0,q.jsx)(xe,{projectId:e.projectId,task:t,requests:e.requests,waits:c,index:o,ctx:m,motion:n,linked:p.linked.has(t.runId),onHover:p.onHover},t.runId))}),g?(0,q.jsx)(_e,{arcs:s,waits:u,active:p.active,layoutKey:h,now:t,motion:n,paused:i}):null]})]})}function Ee(e){let t=x(e.project);return t===void 0?(0,q.jsx)(Te,{...e}):(0,q.jsx)($,{project:e.project,notice:t})}function De({projects:e,belowPanels:t}){return e.length===0?null:(0,q.jsxs)(`p`,{"data-slot":`activity-idle`,className:`text-[12.5px] text-muted-foreground`,children:[ce(e.length,t),` `,e.map((e,t)=>(0,q.jsxs)(V.Fragment,{children:[t>0?`, `:null,(0,q.jsx)(s,{to:X(e.projectId),"data-project":e.projectId,className:`text-foreground 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.name})]},e.projectId))]})}var Oe={kind:`workspace`};function ke(){let e=a().data?.projects,{order:t}=B();return V.useMemo(()=>e?z(e,t).map(e=>e.id):void 0,[e,t])}function Ae(){let e=v(Oe),t=a(),n=i(),r=o().state?.activityProjectId,s=ke(),c=M(e.data?.generatedAt,e.dataUpdatedAt),l=t.data?.bootProject??n.data?.bootProject??null,u=typeof r==`string`&&t.data?.projects.some(e=>e.id===r&&e.status!==`missing`)?r:l,d=e.data?.projects,f=V.useMemo(()=>U(H(d??[],s)),[d,s]),{motion:p,paused:h,reduced:g}=D(e.data,`workspace`);return(0,q.jsxs)(`div`,{"data-route":`activity-global`,"data-activity-paused":h?`true`:void 0,className:`flex min-h-full w-full flex-col gap-4 px-[18px] py-6 md:px-7`,children:[(0,q.jsx)(j,{name:`All projects`,now:e.data?c:void 0,stale:e.isError,children:(0,q.jsx)(oe,{scope:`all`,projectId:u})}),d?(0,q.jsx)(ne,{summary:m(d),tasksTo:`/tasks`,bumps:p.bumps}):null,e.isPending?(0,q.jsx)(`p`,{"data-slot":`activity-loading`,role:`status`,className:`text-xs text-muted-foreground`,children:`Loading activity…`}):null,e.isError&&!d?(0,q.jsxs)(`div`,{role:`alert`,className:`flex items-center gap-3 text-[13px] text-muted-foreground`,children:[`Could not load activity: `,e.error.message,(0,q.jsx)(R,{size:`sm`,variant:`outline`,onClick:()=>void e.refetch(),className:`max-md:min-h-11`,children:`Retry`})]}):null,d&&f.panels.length===0&&f.idle.length===0?(0,q.jsx)(`p`,{"data-slot":`activity-empty`,className:`py-6 text-[13px] text-muted-foreground`,children:`No projects to show.`}):null,(0,q.jsx)(`div`,{"data-slot":`activity-panels`,className:`flex flex-col gap-3.5`,children:f.panels.map(e=>(0,q.jsx)(Ee,{project:e,now:c,motion:p,paused:h||g},e.projectId))}),(0,q.jsx)(De,{projects:f.idle,belowPanels:f.panels.length>0})]})}export{Ae as GlobalActivityRoute};
|