@wjarka/cezarion 0.18.0-dev.7303 → 0.18.0-dev.7305
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/web/dist/assets/{activity-motion-DUCV5L0w.js → activity-motion-YMvJpfC8.js} +2 -2
- package/web/dist/assets/{activity-route-DhR7Phxz.js → activity-route-C3nuQQR-.js} +1 -1
- package/web/dist/assets/{agent-accounts-Ck78cTaG.js → agent-accounts-C1IZE0uf.js} +1 -1
- package/web/dist/assets/attention-SAsrxB3a.js +1 -0
- package/web/dist/assets/{commit-diff-panel-DROIgIvc.js → commit-diff-panel-B78xqBBB.js} +1 -1
- package/web/dist/assets/{diff-DpxnwWWi.js → diff-CuoNLz3Q.js} +2 -2
- package/web/dist/assets/{diff-view-CT2koEmZ.js → diff-view-Dxt-xGXY.js} +1 -1
- package/web/dist/assets/{file-preview-DoN49plc.js → file-preview-D6fgR7rc.js} +1 -1
- package/web/dist/assets/{git-toolbar-BK3rzi1x.js → git-toolbar-B4gNpVK8.js} +1 -1
- package/web/dist/assets/github-D4IdDmEF.js +1 -0
- package/web/dist/assets/{global-activity-route-S7yzZmEr.js → global-activity-route-BQW6XCBZ.js} +1 -1
- package/web/dist/assets/index-CZSDjjxd.js +14 -0
- package/web/dist/assets/index-D6Jjh8b7.css +1 -0
- package/web/dist/assets/{markdown-B0anEsMd.js → markdown-CFpzsarc.js} +1 -1
- package/web/dist/assets/picker-pill-AQuDoa6t.js +15 -0
- package/web/dist/assets/{preview-pane-connected-BzekXFjg.js → preview-pane-connected-Divki4iS.js} +2 -2
- package/web/dist/assets/{project-router-BKoMKwmx.js → project-router-CuXiyyHq.js} +1 -1
- package/web/dist/assets/{project-scope-context-Cb2B_LxQ.js → project-scope-context-TjMvUo_E.js} +1 -1
- package/web/dist/assets/{prompt-template-menu-BBSaimz3.js → prompt-template-menu-DttDghYr.js} +1 -1
- package/web/dist/assets/queries-M7QM2Z_B.js +1 -0
- package/web/dist/assets/{reference-chip-AYFrAylA.js → reference-chip-C2uR5keT.js} +1 -1
- package/web/dist/assets/{repo-git-B7ZeLEvR.js → repo-git-Dl6O3hGA.js} +1 -1
- package/web/dist/assets/{report-reader-D3ClRGaS.js → report-reader-MmUDUBB6.js} +1 -1
- package/web/dist/assets/{reports-DY-sN7ya.js → reports-D5N5f1oD.js} +1 -1
- package/web/dist/assets/run-header-CWSg_ZYo.js +2 -0
- package/web/dist/assets/{skills-CvgUI4o3.js → skills-UhbdEQES.js} +1 -1
- package/web/dist/assets/{tab-link-CekOt2NF.js → tab-link-Bz7Tn_PW.js} +1 -1
- package/web/dist/assets/{task-changes-DI7U63bx.js → task-changes-Ciq3wQdC.js} +1 -1
- package/web/dist/assets/{task-commits-BHb8bDAK.js → task-commits-BYZEw7j8.js} +1 -1
- package/web/dist/assets/{task-files-C_JvFlH3.js → task-files-zvZu7yvk.js} +1 -1
- package/web/dist/assets/task-github-item-BYzml2gD.js +1 -0
- package/web/dist/assets/{task-thread-BcgJ2CLQ.js → task-thread-DSdn2fYx.js} +7 -7
- package/web/dist/assets/{thread-state-AfNliBC6.js → thread-state-BU_1o8aR.js} +1 -1
- package/web/dist/assets/{use-desktop-tg8hhNdq.js → use-desktop-Dc0-ZSdE.js} +1 -1
- package/web/dist/assets/use-hand-to-agent-state-C8jp_mTB.js +1 -0
- package/web/dist/assets/{useInfiniteQuery-De6BP_4x.js → useInfiniteQuery-BzvShKMo.js} +1 -1
- package/web/dist/assets/useQuery-BJvp3XYr.js +1 -0
- package/web/dist/assets/{workflows-C-sOpa7G.js → workflows-BdBF5bnk.js} +2 -2
- package/web/dist/assets/ws-BQRkvdhO.js +1 -0
- package/web/dist/index.html +14 -14
- package/web/dist/assets/attention-DLIMAzlf.js +0 -1
- package/web/dist/assets/github-C3NKXyls.js +0 -1
- package/web/dist/assets/index-BRcS2Xvy.css +0 -1
- package/web/dist/assets/index-DgjX4EGJ.js +0 -14
- package/web/dist/assets/picker-pill-Bd3Q9PFA.js +0 -15
- package/web/dist/assets/queries-Bb9GjWMQ.js +0 -1
- package/web/dist/assets/run-header-B2aqbtt8.js +0 -2
- package/web/dist/assets/task-github-item-Da601f-w.js +0 -1
- package/web/dist/assets/use-hand-to-agent-state-CFQoeO76.js +0 -1
- package/web/dist/assets/useQuery-BsOmvrd_.js +0 -1
- package/web/dist/assets/ws-2N3miuuZ.js +0 -1
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{l as t,o as n,u as r}from"./button-DGwhwRuD.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{$ as o,L as s,N as c,P as l,X as u,Z as d,at as f,it as p,nt as m}from"./live-protocol-B8HJ-VW8.js";import{X as h,l as g}from"./design-icons-B6-0w7Aw.js";import{h as _,l as v}from"./es2015-DTn4s5Lh.js";import{c as y,i as b,p as ee,r as x,s as S,t as C}from"./dropdown-menu-CzUYjvx4.js";import{a as w,o as T,r as E,t as D}from"./dist-CwBtGUlU.js";import{i as O,o as k,r as A,s as j,t as M}from"./dialog-tMSuX5a7.js";import{i as N}from"./agent-accounts-Ck78cTaG.js";var P=e(i(),1),F=1,I=.9,L=.8,R=.17,z=.1,B=.999,te=.9999,ne=.99,re=/[\\\/_+.#"@\[\(\{&]/,ie=/[\\\/_+.#"@\[\(\{&]/g,ae=/[\s-]/,oe=/[\s-]/g;function se(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?F:ne;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=se(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=F:re.test(e.charAt(l-1))?(d*=L,p=e.slice(i,l-1).match(ie),p&&i>0&&(d*=B**+p.length)):ae.test(e.charAt(l-1))?(d*=I,m=e.slice(i,l-1).match(oe),m&&i>0&&(d*=B**+m.length)):(d*=R,i>0&&(d*=B**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=te)),(d<z&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=se(e,t,n,r,l+1,a+2,o),f*z>d&&(d=f*z)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function ce(e){return e.toLowerCase().replace(oe,` `)}function le(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,se(e,t,ce(e),ce(t),0,0,{})}var V=`[cmdk-group=""]`,ue=`[cmdk-group-items=""]`,de=`[cmdk-group-heading=""]`,fe=`[cmdk-item=""]`,pe=`${fe}:not([aria-disabled="true"])`,me=`cmdk-item-select`,H=`data-value`,he=(e,t,n)=>le(e,t,n),ge=P.createContext(void 0),U=()=>P.useContext(ge),_e=P.createContext(void 0),W=()=>P.useContext(_e),ve=P.createContext(void 0),ye=P.forwardRef((e,t)=>{let n=q(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=q(()=>new Set),i=q(()=>new Map),a=q(()=>new Map),o=q(()=>new Set),s=Ae(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,...y}=e,b=v(),ee=v(),x=v(),S=P.useRef(null),C=Me();K(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,w.emit()}},[u]),K(()=>{C(6,A)},[]);let w=P.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)k(),D(),C(1,O);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(x);e?e.focus():(i=document.getElementById(b))==null||i.focus()}if(C(7,()=>{n.current.selectedItemId=j()?.id,w.emit()}),r||C(5,A),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}w.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=P.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,E(t,r)),C(2,()=>{D(),w.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),C(3,()=>{k(),D(),n.current.value||O(),w.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=j();C(4,()=>{k(),t?.getAttribute(`id`)===e&&O(),w.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:b,inputId:x,labelId:ee,listInnerRef:S}),[]);function E(e,t){let r=s.current?.filter??he;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=S.current;M().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(ue);t?t.appendChild(e.parentElement===t?e:e.closest(`${ue} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${ue} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${V}[${H}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=M().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(H);w.setState(`value`,e||void 0)}function k(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=E(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function A(){var e;let t=j();t&&(t.parentElement?.firstChild===t&&((e=t.closest(V)?.querySelector(de))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function j(){return S.current?.querySelector(`${fe}[aria-selected="true"]`)}function M(){return Array.from(S.current?.querySelectorAll(pe)||[])}function N(e){let t=M()[e];t&&w.setState(`value`,t.getAttribute(H))}function F(e){var t;let n=j(),r=M(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&w.setState(`value`,a.getAttribute(H))}function I(e){let t=j()?.closest(V),n;for(;t&&!n;)t=e>0?Oe(t,V):ke(t,V),n=t?.querySelector(pe);n?w.setState(`value`,n.getAttribute(H)):F(e)}let L=()=>N(M().length-1),R=e=>{e.preventDefault(),e.metaKey?L():e.altKey?I(1):F(1)},z=e=>{e.preventDefault(),e.metaKey?N(0):e.altKey?I(-1):F(-1)};return P.createElement(_.div,{ref:t,tabIndex:-1,...y,"cmdk-root":``,onKeyDown:e=>{var t;(t=y.onKeyDown)==null||t.call(y,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&R(e);break;case`ArrowDown`:R(e);break;case`p`:case`k`:g&&e.ctrlKey&&z(e);break;case`ArrowUp`:z(e);break;case`Home`:e.preventDefault(),N(0);break;case`End`:e.preventDefault(),L();break;case`Enter`:{e.preventDefault();let t=j();if(t){let e=new Event(me);t.dispatchEvent(e)}}}}},P.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:Pe},c),Y(e,e=>P.createElement(_e.Provider,{value:w},P.createElement(ge.Provider,{value:T},e))))}),be=P.forwardRef((e,t)=>{let r=v(),i=P.useRef(null),a=P.useContext(ve),o=U(),s=Ae(e),c=s.current?.forceMount??a?.forceMount;K(()=>{if(!c)return o.item(r,a?.id)},[c]);let l=je(r,i,[e.value,e.children,i],e.keywords),u=W(),d=J(e=>e.value&&e.value===l.current),f=J(e=>c||o.filter()===!1?!0:!e.search||e.filtered.items.get(r)>0);P.useEffect(()=>{let t=i.current;if(!(!t||e.disabled))return t.addEventListener(me,p),()=>t.removeEventListener(me,p)},[f,e.onSelect,e.disabled]);function p(){var e,t;m(),(t=(e=s.current).onSelect)==null||t.call(e,l.current)}function m(){u.setState(`value`,l.current,!0)}if(!f)return null;let{disabled:h,value:g,onSelect:y,forceMount:b,keywords:ee,...x}=e;return P.createElement(_.div,{ref:n(i,t),...x,id:r,"cmdk-item":``,role:`option`,"aria-disabled":!!h,"aria-selected":!!d,"data-disabled":!!h,"data-selected":!!d,onPointerMove:h||o.getDisablePointerSelection()?void 0:m,onClick:h?void 0:p},e.children)}),xe=P.forwardRef((e,t)=>{let{heading:r,children:i,forceMount:a,...o}=e,s=v(),c=P.useRef(null),l=P.useRef(null),u=v(),d=U(),f=J(e=>a||d.filter()===!1?!0:!e.search||e.filtered.groups.has(s));K(()=>d.group(s),[]),je(s,c,[e.value,e.heading,l]);let p=P.useMemo(()=>({id:s,forceMount:a}),[a]);return P.createElement(_.div,{ref:n(c,t),...o,"cmdk-group":``,role:`presentation`,hidden:!f||void 0},r&&P.createElement(`div`,{ref:l,"cmdk-group-heading":``,"aria-hidden":!0,id:u},r),Y(e,e=>P.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":r?u:void 0},P.createElement(ve.Provider,{value:p},e))))}),Se=P.forwardRef((e,t)=>{let{alwaysRender:r,...i}=e,a=P.useRef(null),o=J(e=>!e.search);return!r&&!o?null:P.createElement(_.div,{ref:n(a,t),...i,"cmdk-separator":``,role:`separator`})}),Ce=P.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=W(),o=J(e=>e.search),s=J(e=>e.selectedItemId),c=U();return P.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),P.createElement(_.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),we=P.forwardRef((e,t)=>{let{children:r,label:i=`Suggestions`,...a}=e,o=P.useRef(null),s=P.useRef(null),c=J(e=>e.selectedItemId),l=U();return P.useEffect(()=>{if(s.current&&o.current){let e=s.current,t=o.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),P.createElement(_.div,{ref:n(o,t),...a,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":c,"aria-label":i,id:l.listId},Y(e,e=>P.createElement(`div`,{ref:n(s,l.listInnerRef),"cmdk-list-sizer":``},e)))}),Te=P.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return P.createElement(D,{open:n,onOpenChange:r},P.createElement(T,{container:o},P.createElement(w,{"cmdk-overlay":``,className:i}),P.createElement(E,{"aria-label":e.label,"cmdk-dialog":``,className:a},P.createElement(ye,{ref:t,...s}))))}),Ee=P.forwardRef((e,t)=>J(e=>e.filtered.count===0)?P.createElement(_.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),De=P.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return P.createElement(_.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Y(e,e=>P.createElement(`div`,{"aria-hidden":!0},e)))}),G=Object.assign(ye,{List:we,Item:be,Input:Ce,Group:xe,Separator:Se,Dialog:Te,Empty:Ee,Loading:De});function Oe(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function ke(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Ae(e){let t=P.useRef(e);return K(()=>{t.current=e}),t}var K=typeof window>`u`?P.useEffect:P.useLayoutEffect;function q(e){let t=P.useRef();return t.current===void 0&&(t.current=e()),t}function J(e){let t=W(),n=()=>e(t.snapshot());return P.useSyncExternalStore(t.subscribe,n,n)}function je(e,t,n,r=[]){let i=P.useRef(),a=U();return K(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(H,s),i.current=s}),i}var Me=()=>{let[e,t]=P.useState(),n=q(()=>new Map);return K(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Ne(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function Y({asChild:e,children:t},n){return e&&P.isValidElement(t)?P.cloneElement(Ne(t),{ref:t.ref},n(t.props.children)):n(t)}var Pe={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},X=a();function Fe({className:e,...t}){return(0,X.jsx)(G,{"data-slot":`command`,className:r(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t})}function Ie({title:e=`Command Palette`,description:n=`Search for a command to run...`,children:i,className:a,showCloseButton:o=!0,filter:s,...c}){return(0,X.jsxs)(M,{...c,children:[(0,X.jsxs)(k,{className:`sr-only`,children:[(0,X.jsx)(j,{children:e}),(0,X.jsx)(O,{children:n})]}),(0,X.jsx)(A,{className:r(`overflow-hidden p-0`,a),showCloseButton:o,children:(0,X.jsx)(Fe,{...t({filter:s}),className:`**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:i})})]})}function Le({className:e,...t}){return(0,X.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex min-h-11 shrink-0 items-center gap-2 rounded-ss-[inherit] rounded-se-[inherit] border-b px-3`,children:[(0,X.jsx)(h,{className:`size-4 shrink-0 opacity-50`}),(0,X.jsx)(G.Input,{"data-slot":`command-input`,className:r(`flex h-11 min-w-0 flex-1 rounded-md bg-transparent py-3 text-base md:text-sm placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]})}function Re({className:e,onPointerMoveCapture:t,...n}){return(0,X.jsx)(G.List,{"data-slot":`command-list`,onPointerMoveCapture:e=>{t?.(e),e.pointerType===`touch`&&e.stopPropagation()},className:r(`max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto`,e),...n})}function ze({...e}){return(0,X.jsx)(G.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e})}function Be({className:e,...t}){return(0,X.jsx)(G.Group,{"data-slot":`command-group`,className:r(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function Ve({className:e,...t}){return(0,X.jsx)(G.Separator,{"data-slot":`command-separator`,className:r(`-mx-1 h-px bg-border`,e),...t})}function He({className:e,...t}){return(0,X.jsx)(G.Item,{"data-slot":`command-item`,className:r(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...t})}function Ue({className:e,...t}){return(0,X.jsx)(`span`,{"data-slot":`command-shortcut`,className:r(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}var We=`default`,Ge=m({id:f(),label:f(),path:f(),exists:d()}),Ke=m({id:f(),provider:c,label:f(),configDir:f(),path:f(),exists:d(),looksValid:d(),isDefault:d(),status:l.optional(),files:u(Ge)});function qe(e){return e.isDefault?`default:${e.provider}`:e.id}var Z=s();m({editable:d(),profiles:u(Ke),profileCapableProviders:u(c),selections:p(f(),Z),defaults:Z}),m({projectId:f().min(1).max(64).nullable(),provider:c,profileId:f().max(64).nullable()}),m({selections:p(f(),Z),defaults:Z}),m({status:l}),m({available:d(),reason:f().optional(),fields:u(m({label:f(),value:f()}))}),m({file:f().min(1).max(200),target:f().min(1).max(64).optional()}),m({opened:o(!0),path:f()}),m({provider:c,label:f().trim().max(200).optional(),configDir:f().trim().min(1).max(4096)}),m({profile:Ke}),m({label:f().trim().max(200).optional(),configDir:f().trim().min(1).max(4096).optional()}),m({removed:o(!0),id:f()});var Je=80,Ye=2e3,Xe=50,Ze=200,Qe=50,$e=[{id:`add-tests`,label:`Add tests`,text:`Also add or update tests covering this change.`},{id:`explain-change`,label:`Explain the change`,text:`Explain what changed and why before finishing.`},{id:`keep-minimal`,label:`Keep it minimal`,text:`Keep the change as small and targeted as possible — no unrelated refactors.`},{id:`update-docs`,label:`Update docs`,text:`Also update any relevant documentation or comments.`},{id:`check-edge-cases`,label:`Double-check edge cases`,text:`Double-check edge cases and error handling before finishing.`}];function et(e){return!!e&&typeof e==`object`}function tt(e){if(e===void 0||!Array.isArray(e))return $e.map(e=>({...e}));let t=new Set,n=[];for(let r of e){if(!et(r))continue;let e=typeof r.id==`string`?r.id.trim():``;if(e===`create-automation`)continue;let i=typeof r.label==`string`?r.label.trim():``,a=typeof r.text==`string`?r.text.trim():``;if(!e||!i||!a||t.has(e))continue;t.add(e);let o=nt(r.skills);if(n.push({id:e,label:i.slice(0,Je),text:a.slice(0,Ye),...o.length>0?{skills:o}:{}}),n.length>=Xe)break}return n}function nt(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(!(!e||t.has(e))&&(t.add(e.slice(0,Ze)),t.size>=Qe))break}return[...t]}function rt(e,t){if(t.length===0)return[];let n=new Set(t);return e.filter(e=>e.skills?.some(e=>n.has(e)))}function it(e,t){return rt(e,t).map(e=>e.text).join(`
|
|
2
|
-
|
|
3
|
-
`)}function at(e,t,n,r=``){if(e===``||e===r||e===t){let e=r&&n?`${r}\n\n${n}`:r||n;return{text:e,applied:n?e:``}}return{text:e,applied:t}}function ot(){return`tpl-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function st(e,t,n){let r=Math.max(0,Math.min(t,e.length)),i=e.slice(0,r),a=e.slice(r),o=``;i.length>0&&(o=i.endsWith(`
|
|
4
|
-
|
|
5
|
-
`)?``:i.endsWith(`
|
|
6
|
-
`)?`
|
|
7
|
-
`:`
|
|
8
|
-
|
|
9
|
-
`);let s=a.replace(/^[ \t]+/,``),c=``;return s.length>0&&(c=s.startsWith(`
|
|
10
|
-
|
|
11
|
-
`)?``:s.startsWith(`
|
|
12
|
-
`)?`
|
|
13
|
-
`:`
|
|
14
|
-
|
|
15
|
-
`),{text:i+o+n+c+s,caret:i.length+o.length+n.length}}function ct({prompt:e,base:t,selectionStart:n,focused:r,remembered:i}){return e===t?e.length:r&&n!=null||n!=null&&n>0?n:i??e.length}var lt=`inline-flex h-[26px] min-w-0 max-w-full items-center gap-1.5 rounded-full border border-control-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:border-dashed disabled:bg-muted`,ut=(0,X.jsx)(g,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-supporting-foreground`}),dt=(0,P.createContext)(null),Q=e=>Number.parseFloat(e)||0;function ft({pill:e,box:t,full:n}){let r=getComputedStyle(e),i=[...e.children].filter(e=>{if(e===t)return!1;let n=getComputedStyle(e);return n.display!==`none`&&n.position!==`absolute`});return i.reduce((e,t)=>e+t.getBoundingClientRect().width,0)+Q(r.columnGap)*i.length+n.getBoundingClientRect().width+Q(r.paddingLeft)+Q(r.paddingRight)+Q(r.borderLeftWidth)+Q(r.borderRightWidth)}function pt(e){for(let t=e.parentElement;t;t=t.parentElement){if(t.dataset.slot===`picker-pill-disabled-wrapper`)continue;let e=getComputedStyle(t).display;if(e===`grid`||e===`flex`)return t}return e.parentElement}function mt(e){let t=new Map;for(let n of e){let e=pt(n.pill),r=t.get(e)??new Map,i=Math.round(n.pill.getBoundingClientRect().top);r.set(i,[...r.get(i)??[],n]),t.set(e,r)}for(let[e,n]of t){let t=getComputedStyle(e),r=e.clientWidth-Q(t.paddingLeft)-Q(t.paddingRight);for(let e of n.values())if(e.reduce((e,t)=>e+ft(t),0)+Q(t.columnGap)*(e.length-1)>r+.5)return!1}return!0}function ht({children:e}){let t=(0,P.useRef)(new Map),n=(0,P.useRef)(null),[r,i]=(0,P.useState)(!0),a=(0,P.useCallback)(()=>i(mt([...t.current.values()])),[]),o=(0,P.useCallback)((e,r)=>{if(t.current.set(e,r),typeof ResizeObserver<`u`){n.current??=new ResizeObserver(a);for(let e of[r.box,r.full,pt(r.pill)])n.current.observe(e)}return a(),()=>{if(t.current.delete(e),typeof ResizeObserver<`u`)for(let e of[r.box,r.full])n.current?.unobserve(e);a()}},[a]);(0,P.useLayoutEffect)(()=>()=>n.current?.disconnect(),[]);let s=(0,P.useMemo)(()=>({register:o,showPrefixes:r}),[o,r]);return(0,X.jsx)(dt.Provider,{value:s,children:e})}function gt({field:e,children:t}){let n=(0,P.useRef)(null),i=(0,P.useRef)(null),a=(0,P.useContext)(dt),o=a?.register,s=(0,P.useId)(),[c,l]=(0,P.useState)(!0);(0,P.useLayoutEffect)(()=>{let e=n.current,t=i.current;if(o){let n=e.closest(`[data-slot$="pill"]`);return n?o(s,{pill:n,box:e,full:t}):void 0}let r=()=>l(t.getBoundingClientRect().width<=e.getBoundingClientRect().width+.5);if(r(),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(r);return a.observe(e),a.observe(t),()=>a.disconnect()},[e,t,s,o]);let u=a!==null,d=u?a.showPrefixes:c,f=u&&!d;return(0,X.jsxs)(`span`,{ref:n,className:`relative min-w-0 overflow-hidden`,"aria-hidden":`true`,children:[(0,X.jsxs)(`span`,{ref:i,className:r(`invisible w-max whitespace-nowrap`,f?`absolute left-0 top-0`:`block`),children:[e,` · `,t]}),(0,X.jsxs)(`span`,{"data-slot":`picker-label`,className:r(`block truncate`,f?`relative`:`absolute inset-0`),children:[d?(0,X.jsxs)(`span`,{className:`text-muted-foreground`,children:[e,` · `]}):null,t]})]})}function _t({fieldLabel:e,ariaLabel:t,label:n,options:r,value:i}){return e?`${t} · ${typeof n==`string`?n:r.find(e=>e.value===i)?.label??i}`:t}function vt({readOnly:e,disabled:t,hint:n,disabledHint:r}){return e?r??n:t?r:n}function yt({fieldLabel:e,fullLabel:t,explanation:n}){return e?[t,n].filter(Boolean).join(` — `):n}function bt({icon:e,fieldLabel:t,ariaLabel:n,label:r}){return(0,X.jsxs)(X.Fragment,{children:[e,t?(0,X.jsx)(gt,{field:n,children:r}):(0,X.jsx)(`span`,{className:`min-w-0 truncate`,title:typeof r==`string`?r:void 0,children:r})]})}function xt({slot:e,ariaLabel:t,label:n,value:i,options:a,onPick:o,disabled:s=!1,readOnly:c=!1,hint:l,disabledHint:u,status:d,searchPlaceholder:f,icon:p,fieldLabel:m=!1}){let[_,v]=(0,P.useState)(!1),[w,T]=(0,P.useState)(``),E=(0,P.useRef)(null),D=(0,P.useRef)(null),O=f?a.filter(e=>e.label.toLowerCase().includes(w.trim().toLowerCase())):a;(0,P.useEffect)(()=>{if(!_||!f)return;let e=window.setTimeout(()=>E.current?.focus());return()=>window.clearTimeout(e)},[_,f]);let k=e=>{E.current&&document.activeElement===E.current&&e.preventDefault()},A=p?` h-11 gap-2 rounded-lg border-border px-3 text-foreground`:``,j=_t({fieldLabel:m,ariaLabel:t,label:n,options:a,value:i}),M=yt({fieldLabel:m,fullLabel:j,explanation:vt({readOnly:c,disabled:s,hint:l,disabledHint:u})}),N=bt({icon:p,fieldLabel:m,ariaLabel:t,label:n});if(c)return(0,X.jsxs)(`span`,{"data-slot":e,"aria-label":j,title:M,className:r(lt,A,`cursor-default hover:bg-card hover:text-muted-foreground`),children:[N,m?(0,X.jsx)(`span`,{className:`sr-only`,children:j}):null]});let F=(0,X.jsxs)(`button`,{type:`button`,"data-slot":e,"aria-label":j,disabled:s,title:M,className:r(lt,A),children:[N,p?(0,X.jsx)(g,{"aria-hidden":`true`,className:`size-[13px] shrink-0 text-muted-foreground`}):ut]});return s?(0,X.jsx)(`span`,{"data-slot":`picker-pill-disabled-wrapper`,title:M,className:`inline-flex min-w-0 max-w-full`,children:F}):(0,X.jsxs)(C,{open:_,onOpenChange:e=>{v(e),e||T(``)},children:[(0,X.jsx)(ee,{asChild:!0,children:F}),(0,X.jsxs)(x,{ref:D,align:`start`,"data-testid":`${e}-menu`,children:[f?(0,X.jsxs)(`div`,{"data-slot":`picker-search`,className:`mbe-1 flex min-h-11 min-w-56 items-center gap-2 border-b border-border px-2`,children:[(0,X.jsx)(h,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,X.jsx)(`input`,{ref:E,type:`search`,"aria-label":f,placeholder:f,value:w,onChange:e=>T(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation();let t=D.current?.querySelectorAll(`[role="menuitemradio"]:not([data-disabled])`);(e.key===`ArrowDown`?t?.[0]:t?.[t.length-1])?.focus()}else e.key!==`Escape`&&e.stopPropagation()},className:`h-11 w-0 min-w-0 flex-1 bg-transparent text-sm placeholder:text-muted-foreground`})]}):null,(0,X.jsx)(S,{value:i,onValueChange:o,children:O.map(e=>(0,X.jsx)(y,{value:e.value,className:r(`gap-2.5`,f&&`min-h-11`),onPointerMove:k,onPointerLeave:k,onKeyDown:t=>{E.current&&(t.key===`ArrowUp`&&e===O[0]||t.key===`Tab`&&t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),E.current.focus())},children:(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsx)(`span`,{className:`text-[13px] font-medium`,children:e.label}),e.desc?(0,X.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.desc}):null]})},e.value))}),f&&O.length===0?(0,X.jsx)(`p`,{role:`status`,className:`px-2 py-5 text-center text-xs text-muted-foreground`,children:`No matches found.`}):null,d?(0,X.jsx)(b,{disabled:!0,onPointerMove:k,onPointerLeave:k,className:`border-t border-border text-[11px] text-muted-foreground`,children:d}):null]})]})}var $=(e,t)=>t===null?e:`${e}:${t}`;function St({runners:e,value:t,onPick:n,disabled:r=!1,accounts:i=[],account:a=null,repoAccount:o,icon:s,fieldLabel:c}){let l=N.filter(t=>e.includes(t.id)).flatMap(e=>{let t=i.filter(t=>t.provider===e.id);return t.length<2?[{value:$(e.id,null),label:e.id,desc:e.desc}]:t.map(t=>({value:$(e.id,t.id),label:`${e.id} · ${t.label}`,desc:t.configDir}))}),u=a??o?.[t]??`default`,d=l.some(e=>e.value===$(t,u))?$(t,u):$(t,null);return(0,X.jsx)(xt,{icon:s,fieldLabel:c,slot:`runner-pill`,ariaLabel:`Runner`,label:l.find(e=>e.value===d)?.label??t,value:d,disabled:r,onPick:e=>{let[t,r]=e.split(`:`);n(t,r??null)},options:l})}export{Ue as C,Ve as S,ze as _,lt as a,He as b,st as c,at as d,ct as f,Ie as g,Fe as h,ut as i,ot as l,qe as m,ht as n,$e as o,We as p,St as r,it as s,xt as t,tt as u,Be as v,Re as x,Le as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{A as t,M as n}from"./button-DGwhwRuD.js";import{i as r}from"./react-runtime-CCIEwYL0.js";import{n as i,t as a}from"./live-refetch-CZb2VOyu.js";import{$ as o,$r as s,Ar as c,At as l,B as u,Br as d,Dt as f,Et as p,F as m,Fr as h,Gr as g,Gt as _,H as v,I as y,Ir as ee,J as te,Jr as ne,K as re,L as ie,Lr as ae,Lt as oe,M as se,Mr as ce,Mt as le,Nr as ue,Nt as de,Ot as fe,Pr as pe,Q as me,R as he,Rt as ge,Sn as _e,Sr as ve,Tt as ye,U as be,V as xe,Wr as Se,Wt as Ce,X as b,Xr as we,Y as Te,Yt as Ee,Z as De,_ as Oe,_n as ke,_r as Ae,_t as je,an as Me,at as Ne,b as Pe,bt as Fe,c as Ie,cn as Le,ct as Re,dn as ze,dr as x,dt as Be,et as Ve,fn as He,ft as Ue,g as We,gn as Ge,gr as Ke,gt as qe,ht as Je,i as Ye,ii as Xe,in as Ze,it as Qe,j as $e,jr as et,jt as tt,kt as nt,lt as rt,m as it,mt as at,nn as ot,nt as st,on as ct,ot as lt,pn as ut,pt as dt,r as ft,ri as pt,rn as mt,si as ht,st as gt,ti as S,tt as _t,ut as vt,v as yt,vt as bt,wt as xt,x as St,xn as Ct,xt as wt,yn as Tt,yt as Et,z as Dt,zr as C}from"./project-scope-context-Cb2B_LxQ.js";import{F as w,M as Ot,dt as T}from"./live-protocol-B8HJ-VW8.js";import{t as kt}from"./useInfiniteQuery-De6BP_4x.js";import{t as E}from"./useQuery-BsOmvrd_.js";import{n as At,r as D,t as jt}from"./ws-2N3miuuZ.js";import{n as Mt}from"./toaster-CoMJoQvk.js";var Nt=class extends Se{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Pt(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=g({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),T.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Pt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Ft=class extends ht{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),pt(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&ne(t.mutationKey)!==ne(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Pt();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){T.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function It(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Lt(e,t,n){let r=e.slice(0);return r[t]=n,r}var Rt=class extends ht{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,T.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!pt(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(It(e,n).forEach(e=>{e.destroy()}),It(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=S(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new d(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Lt(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&T.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},O=e(r(),1);function k({queries:e,...t},n){let r=C(n),i=ae(),a=ee(),o=O.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{c(e);let t=r.getQueryCache().get(e.queryHash);ue(e,a,t)}),h(a);let[l]=O.useState(()=>new Rt(r,o,t)),[u,f,p]=l.getOptimisticResult(o,t.combine),m=!i&&t.subscribed!==!1;O.useSyncExternalStore(O.useCallback(e=>m?l.subscribe(T.batchCalls(e)):s,[l,m]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),O.useEffect(()=>{l.setQueries(o,t)},[o,t,l]);let g=u.some((e,t)=>ce(o[t],e))?u.flatMap((e,t)=>{let n=o[t];return n&&ce(n,e)?et(n,new d(r,n),a):[]}):[];if(g.length>0)throw Promise.all(g);let _=u.find((e,t)=>{let n=o[t];return n&&pe({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(_?.error)throw _.error;return f(p())}function A(e,t){let n=C(t),[r]=O.useState(()=>new Ft(n,e));O.useEffect(()=>{r.setOptions(e)},[r,e]);let i=O.useSyncExternalStore(O.useCallback(e=>r.subscribe(T.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=O.useCallback((e,t)=>{r.mutate(e,t).catch(s)},[r]);if(i.error&&Xe(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function j(e={}){let t=e.projectId??n();return{projectId:t,cacheScope:e.cacheScope??(e.boot?`default`:t)}}function M(e,t={}){return{...j(t),runId:e}}var N=[`workspace`,`runs-index`],P=e=>[e.cacheScope,`runs`,`list`],F=e=>[e.cacheScope,`runs`,`detail`,e.runId],I=e=>typeof e==`function`?e():e;function zt(e){let{seenAt:t,...n}=e;return n}function Bt(e,t){let n=zt(e);return t.seenAt===void 0?n:{...n,seenAt:t.seenAt}}function L(e,t,n){return t?{...e,seenAt:n}:zt(e)}function Vt(e){let t=()=>{e.invalidateQueries({queryKey:N})};function r(r,i){if(r===`index`)return t();let a=typeof i==`function`?i():i;if(r===`indexed`){t(),e.invalidateQueries({queryKey:[n(),`runs`]}),e.invalidateQueries({queryKey:[a.projectId,`runs`,`list`]});return}if(r===`runs`)return e.invalidateQueries({queryKey:[a.cacheScope,`runs`]});let o=Ae(),s=[a.projectId,a.cacheScope],c=o!==void 0&&s.some(e=>e===o||e==="default")?[o,`default`]:[],l=new Set([...s,...c,n()]);return Promise.all([...l].map(t=>e.invalidateQueries({queryKey:[t,`runs`]}))).then(()=>void 0)}async function i(n,r){await e.cancelQueries({queryKey:P(I(n))}),await e.cancelQueries({queryKey:F(I(n))});let i=e.getQueryData(P(I(n))),a=e.getQueryData(F(I(n))),o=I(n).runId,s=new Date().toISOString();return e.setQueryData(P(I(n)),e=>e?.map(e=>e.id===o?L(e,r,s):e)),e.setQueryData(F(I(n)),e=>e&&L(e,r,s)),{id:o,prevList:i,prevDetail:a,rollback(){if(!r){i&&e.setQueryData(P(I(n)),i),a&&e.setQueryData(F(I(n)),a);return}let t=i?.find(e=>e.id===o);t&&e.setQueryData(P(I(n)),e=>e?.map(e=>e.id===o?Bt(e,t):e)),a&&e.setQueryData(F(I(n)),e=>e&&Bt(e,a))},settle(i){let a=e=>e.id===(r?o:i.id)?L(e,r,i.seenAt):e;e.setQueryData(P(I(n)),e=>e?.map(a));let s={...I(n),runId:r?o:i.id};e.setQueryData(F(s),e=>e?a(e):i),t()}}}async function a(t,n){await e.cancelQueries({queryKey:N});let i=e.getQueryData(N),a=n();return e.setQueryData(N,e=>e===void 0?e:{...e,runs:e.runs.map(e=>e.projectId===t.projectId&&e.id===t.runId?a(e):e)}),{previous:i,rollback(){i&&e.setQueryData(N,i)},settle(){r(`indexed`,t)}}}return{patchRead:i,patchIndex:a,invalidateAfter:r}}function R(){let e=C();return(0,O.useMemo)(()=>Vt(e),[e])}function Ht(e){return e.type===`run`?e.run.id:e.id}function z(e,t){return{...e,runs:t}}function Ut(e,t){let n=0;for(let r of e)r.projectId===t&&r.archived&&(n+=1);return n}function Wt(e,t){let n=e.findIndex(e=>(e.createdAt??``).localeCompare(t.createdAt)<0),r=[...e];return r.splice(n<0?e.length:n,0,t),r}function Gt(e,t,n){return n?n.has(t):e.runs.some(e=>e.projectId===t)}function Kt(e,t,n){let{project:r}=t,i=Ht(t),a=e.runs.findIndex(e=>e.projectId===r&&e.id===i),o=a>=0?e.runs[a]:void 0,s=e.truncated.includes(r);if(t.type===`deleted`)return o?{index:z(e,e.runs.filter((e,t)=>t!==a)),reconcile:s&&o.archived}:{index:e,reconcile:!1};let{run:c}=t;if(c.delegation?.role===`worker`)return o?{index:z(e,e.runs.filter((e,t)=>t!==a)),reconcile:!1}:{index:e,reconcile:!1};if(!o&&!Gt(e,r,n))return{index:e,reconcile:!0};let l=S(o,{projectId:r,...c});if(o){if(l===o)return{index:e,reconcile:!1};let t=[...e.runs];t[a]=l;let n=o.archived!==l.archived&&(s||Ut(t,r)>e.perProjectLimit);return{index:z(e,t),reconcile:n}}if(s)return Jt(e,l);let u=Wt(e.runs,l);return{index:z(e,u),reconcile:l.archived&&Ut(u,r)>e.perProjectLimit}}function qt(e,t){let n;for(let r of e)r.projectId===t&&r.archived&&(n===void 0||r.createdAt<n)&&(n=r.createdAt);return n}function Jt(e,t){let n=qt(e.runs,t.projectId),r=n!==void 0&&t.createdAt>n;return t.archived&&!r?{index:e,reconcile:!1}:{index:z(e,Wt(e.runs,t)),reconcile:t.archived||n===void 0||t.createdAt<n}}function Yt(e,t,n){let r=!1,i=e.runs.map(e=>{if(e.projectId!==t)return e;let i=n[e.id];if(i){let t=S(e.usage,i);return t===e.usage?e:(r=!0,{...e,usage:t})}if(e.usage===void 0)return e;r=!0;let{usage:a,...o}=e;return o});return r?z(e,i):e}function Xt(e,t){let n=e.runs.filter(e=>e.projectId!==t),r=e.truncated.filter(e=>e!==t),i=Object.prototype.hasOwnProperty.call(e.referenceStatuses,t);if(n.length===e.runs.length&&r.length===e.truncated.length&&!i)return e;let a={...e.referenceStatuses};return delete a[t],{...e,runs:n,truncated:r,referenceStatuses:a}}function Zt(){return{stream:void 0,lastStream:void 0,mismatch:void 0,floor:void 0,changes:new Map}}function Qt(e,t,n){if(e.lastStream===t)e.floor=Math.max(e.floor??n,n);else{for(let[n,r]of e.changes)r.generation!==t&&e.changes.delete(n);e.floor=n}e.stream=t,e.lastStream=t,e.mismatch=void 0}function $t(e){e.stream=void 0}function en(e,t,n=!1){let r=e.stream;if(r===void 0)return!1;(e.floor===void 0||n)&&(e.floor=t.seq-1);let i=JSON.stringify([r,t.project,Ht(t)]),a=e.changes.get(i);return(!a||a.seq<t.seq)&&e.changes.set(i,{...t,generation:r}),!0}function tn(e,t){for(let[n,r]of e.changes)r.project===t&&e.changes.delete(n)}function nn(e){return typeof e.generation==`string`&&typeof e.eventSeq==`number`}function rn(e,t,n){if(!nn(t))return{index:t,reconcile:!1};let{generation:r,eventSeq:i}=t;if(e.stream!==void 0&&e.stream!==r){let n=e.mismatch!==r;return e.mismatch=r,{index:t,reconcile:n}}let a=e.lastStream===r&&e.floor!==void 0,o=a&&i<e.floor,s=t,c=o,l=[...e.changes.entries()].filter(([,e])=>e.generation===r),u=l.map(([,e])=>e).filter(e=>e.seq>i).sort((e,t)=>e.seq-t.seq);for(let e of u){let t=Kt(s,e,n);s=t.index,c||=t.reconcile}for(let[t,n]of l)n.seq<=i&&e.changes.delete(t);return a&&!o&&(e.floor=i),{index:s,reconcile:c}}var B=[`workspace`,`runs-index`],an=[`workspace`,`projects`],on=6e4,sn=100,cn=new WeakMap;function V(e){let t=cn.get(e);return t||(t=pn(e),cn.set(e,t)),t}function ln(e,t){return typeof e!=`object`||!e||!Array.isArray(e.runs)?e:V(t).merge(e)}function un(e){let t=e.getQueryData(an)?.projects;return t?new Set(t.map(e=>e.id)):void 0}function dn(e,t,n){if(!(!e||typeof e.eventSeq!=`number`||typeof t.eventSeq!=`number`))return e.generation===t.generation?t.eventSeq<e.eventSeq?e:void 0:n!==void 0&&e.generation===n&&t.generation!==n?e:void 0}function fn(e,t){return t.type===`run-summary`?{type:`run`,project:e,seq:t.seq,run:t.summary}:{type:`deleted`,project:e,seq:t.seq,id:t.id}}function pn(e){let t=Zt(),n=[],r,i,a,o,s=!1,c=-1/0,l=new Set,u=!1,d,f=!1,p=()=>{if(!u){if(u=!0,d?.()){f=!0;return}_({hold:!0})}},m=t=>{c=Date.now(),e.setQueryData(B,t)},h=()=>e.getQueryData(B),g=()=>{clearTimeout(a),a=void 0;let t=e.getQueryCache().find({queryKey:B,exact:!0}),n=(t!==void 0&&t.state.data===void 0&&t.state.fetchStatus!==`idle`?e.cancelQueries({queryKey:B,exact:!0}).then(()=>e.invalidateQueries({queryKey:B})):e.invalidateQueries({queryKey:B})).catch(()=>void 0).finally(()=>{o===n&&(o=void 0,s&&(s=!1,g()))});return o=n,n},_=(e={})=>o?(s=!0,o):e.hold?(a??=setTimeout(()=>{g()},400),Promise.resolve()):g(),v=()=>{r!==void 0&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(r),r=void 0,clearTimeout(i),i=void 0;let t=n;n=[];let a=h();if(!a||t.length===0)return;let o=un(e),s=a,c=!1;for(let e of t){if(e.generation!==a.generation)continue;if(e.type===`usage`){l.has(e.project)||(s=Yt(s,e.project,e.usage));continue}if(l.has(e.change.project)||e.change.seq<=a.eventSeq)continue;let t=Kt(s,e.change,o);s=t.index,c||=t.reconcile}s!==a&&m(s),c&&_({hold:!0})},y=()=>{if(i!==void 0)return;let e=c+250-Date.now();if(e>0){i=setTimeout(v,e);return}i=setTimeout(v,sn),typeof requestAnimationFrame==`function`&&(r=requestAnimationFrame(v))};return{ready(e,n){Qt(t,e,n),u=!1,f&&(f=!1,_({hold:!0}))},detach(){$t(t)},run(e,r,i=!1){if(l.has(e))return;let a=fn(e,r);if(!en(t,a,i)){p();return}n.push({type:`change`,change:a,generation:t.stream}),y()},usage(e,r){if(!l.has(e)){if(t.stream===void 0){p();return}n.push({type:`usage`,project:e,usage:r,generation:t.stream}),y()}},dropProject(e){l.add(e),tn(t,e),n=n.filter(t=>(t.type===`change`?t.change.project:t.project)!==e);let r=h();if(!r)return;let i=Xt(r,e);i!==r&&m(i)},setUnknownGenerationHandler(e){d=e},restoreProject(e){l.delete(e)},merge(n){let r=h(),i=rn(t,n,un(e));for(let e of l)i.index=Xt(i.index,e);return i.reconcile&&queueMicrotask(()=>{_({hold:!0})}),dn(r,n,t.stream)??i.index},reconcile:_,flush:v,stop(){r!==void 0&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(r),r=void 0,clearTimeout(i),i=void 0,clearTimeout(a),a=void 0,n=[],s=!1}}}var mn={draft:{label:`Draft`,hint:`the author has not marked it ready for review`,tone:`neutral`},"review-required":{label:`Waiting for review`,hint:`checks are fine, no one has reviewed it yet`,tone:`info`},"changes-requested":{label:`Changes requested`,hint:`a reviewer asked for edits before this can merge`,tone:`danger`},"checks-pending":{label:`Checks running`,hint:`CI has not finished on the latest commit`,tone:`pending`},"checks-failing":{label:`Checks failing`,hint:`CI is red on the latest commit`,tone:`danger`},ready:{label:`Ready to merge`,hint:`open, checks pass, nothing is waiting on a reviewer`,tone:`success`},merged:{label:`Merged`,hint:`this landed on its base branch`,tone:`merged`},closed:{label:`Closed`,hint:`closed without merging — the work did not land`,tone:`danger`},open:{label:`Open`,hint:`still open on the tracker`,tone:`success`},completed:{label:`Closed as completed`,hint:`the issue was resolved`,tone:`accent`},"not-planned":{label:`Closed as not planned`,hint:`the issue was declined — nothing shipped for it`,tone:`neutral`}},hn={label:`Merge conflicts`,hint:`this branch no longer merges cleanly into its base — rebase or merge the base in`,tone:`conflict`};function gn(e){return typeof e==`string`&&Object.hasOwn(mn,e)}function _n(e){return e!==void 0&&gn(e)?mn[e]:void 0}var vn=`cez.reference-statuses.v1`,yn=`cez.reference-conflicts.v1`,H=new Map(Sn()),bn=1e3;function U(e,t){if(H.get(e)!==t){for(H.delete(e),H.set(e,t);H.size>bn;){let e=H.keys().next().value;if(e===void 0)break;H.delete(e)}wn()}}var W=new Set(Cn());function xn(e,t){if(W.has(e)!==t){if(t)for(W.add(e);W.size>bn;){let e=W.values().next().value;if(e===void 0)break;W.delete(e)}else W.delete(e);wn()}}function Sn(){try{let e=globalThis.sessionStorage?.getItem(vn);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>Array.isArray(e)&&e.length===2&&typeof e[0]==`string`&&gn(e[1])):[]}catch{return[]}}function Cn(){try{let e=globalThis.sessionStorage?.getItem(yn);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}var G;function wn(){G===void 0&&(G=setTimeout(()=>{G=void 0;try{globalThis.sessionStorage?.setItem(vn,JSON.stringify([...H])),globalThis.sessionStorage?.setItem(yn,JSON.stringify([...W]))}catch{}},250))}var K=e=>`${e.projectId}\u0000${e.kind}#${e.number}`;function Tn(e,t){return{...e?{status:e}:{},...t?{conflicting:!0}:{}}}function En(e){return[...e.prs.map(t=>({projectId:e.projectId,kind:`PR`,number:t})),...e.issues.map(t=>({projectId:e.projectId,kind:`Issue`,number:t}))]}function Dn(e,t,n,r,i,a){let o=r.prs[n.number]??r.issues[n.number];if(!o){e.set(t,{state:`unknown`,...i?{status:i}:{}});return}let s=r.conflicts?r.conflicts.includes(n.number):void 0;U(t,o),s!==void 0&&xn(t,s),e.set(t,{state:`ready`,status:o,...s??a?{conflicting:!0}:{}})}function On(e,t,n){let r=K(t),i=H.get(r),a=W.has(r)?!0:void 0,o=n.data;if(o?.available){Dn(e,r,t,o,i,a);return}if(o){e.set(r,{state:`unavailable`,reason:o.reason,...Tn(i,a)});return}if(n.isError){e.set(r,{state:`unavailable`,reason:n.error instanceof Error?n.error.message:void 0,...Tn(i,a)});return}e.set(r,{state:`loading`,...Tn(i,a)})}function kn(e,t){let n=new Map;return t.forEach((t,r)=>{let i=e[r];if(i)for(let e of En(i))On(n,e,t)}),n}function An(e){if(!e)return;let t=e.trim().replace(/\/+$/,``),n=/^(?:https?|ssh|git|git\+ssh):\/\/(?:[^@/]+@)?([^/:]+)(?::\d+)?\/(.+)$/.exec(t),r=n?null:/^(?:[^@/:]+@)?([^:/]+):(.+)$/.exec(t),i=n??r;if(!i)return;let[,a,o]=i;if(!o||a?.toLowerCase()!==`github.com`)return;let s=o.replace(/\.git$/i,``).split(`/`).filter(Boolean),c=s[s.length-2],l=s[s.length-1];return c&&l?`https://github.com/${c}/${l}`:void 0}function jn(e){let t=new Map;for(let n of e)for(let e of n.tags??[]){let n=e.toLowerCase();t.has(n)||t.set(n,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function Mn(e,t,n,r=8){let i=n.trim().toLowerCase(),a=new Set(t.map(e=>e.toLowerCase())),o=e.filter(e=>{let t=e.toLowerCase();return a.has(t)?!1:i===``||t.includes(i)&&t!==i});return i===``?o.slice(0,r):o.sort((e,t)=>Number(t.toLowerCase().startsWith(i))-Number(e.toLowerCase().startsWith(i))||e.localeCompare(t,void 0,{sensitivity:`base`})).slice(0,r)}function Nn(e){let t=new Map;for(let n of e){let e=n.trim();if(!e)continue;let r=e.toLowerCase();t.has(r)||t.set(r,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function Pn(e){if(!e.available)return;let t=e.issuesNextCursor,n=e.prsNextCursor;if(!(t===void 0&&n===void 0)&&!(!t&&!n))return{...t?{issuesCursor:t}:{issuesDone:!0},...n?{prsCursor:n}:{prsDone:!0}}}function Fn(e,t){return e?(t===`issues`?e.issuesNextCursor:e.prsNextCursor)==null:!1}function In(e,t,n){for(let r of e)t.has(r.number)||(t.add(r.number),n.push(r))}function Ln(e){let t=e[0];if(!t)return;let n=e[e.length-1],r=[],i=[],a=new Set,o=new Set,s={};for(let t of e){In(t.issues,a,r),In(t.prs,o,i);for(let[e,n]of Object.entries(t.labelColors??{}))s[e]??=n}let c=e.find(e=>e.projects)?.projects,l=e.map(e=>e.projectsState),u=e.find(e=>e.projectsState===`unavailable`),d=l.includes(`refreshing`)?`refreshing`:u?`unavailable`:l.some(e=>e===`ready`)?`ready`:void 0,{projectsGeneration:f,projectsReason:p,...m}=t;return{...m,issues:r,prs:i,...Object.keys(s).length>0?{labelColors:s}:{},...c?{projects:c}:{},...d?{projectsState:d}:{},...d===`unavailable`&&u?.projectsReason?{projectsReason:u.projectsReason}:{},...`issuesNextCursor`in n?{issuesNextCursor:n.issuesNextCursor}:{},...`prsNextCursor`in n?{prsNextCursor:n.prsNextCursor}:{}}}var q=e=>e.map(e=>e.number).join(`,`);function Rn(e,t){let n=e[0];if(e.length>1&&n&&(q(n.issues)!==q(t.issues)||q(n.prs)!==q(t.prs)||n.issuesTotal!==t.issuesTotal||n.prsTotal!==t.prsTotal))return`refetch`;let r=t;if(n&&t.available&&t.projectsState===`refreshing`&&n.repo===t.repo){let e=new Map(n.issues.map(e=>[e.number,e.projectIds]));r={...t,issues:t.issues.map(t=>{let n=e.get(t.number);return t.projectIds===void 0&&n!==void 0?{...t,projectIds:n}:t})}}return[r,...e.slice(1)]}function zn(e,t,r=!0){let i=Wr(),a=$(),o=e??i.data?.defaultRunner??`claude`,s=a.data?.capabilities?.localHandoff===!1?null:t,c=n(),l=E({queryKey:J.runnerSkills(o,s),queryFn:({signal:e})=>p(o,s,{signal:e,projectId:c}),enabled:r&&(e!==void 0||!i.isPending)&&(!t||!a.isPending),retry:!1});return{...l,runner:o,account:s,data:l.data?.skills,list:l.data,unchecked:l.isError||!l.data||l.data.source===`unavailable`}}var J={get health(){return[n(),`health`]},runs:{get all(){return[n(),`runs`]},relationships:e=>[n(),`runs`,`relationships`,e],list:(e=n())=>[e,`runs`,`list`],archived:e=>[n(),`runs`,`archived`,e],detail:(e,t=n())=>[t,`runs`,`detail`,e],diff:e=>[n(),`runs`,`diff`,e],changes:e=>[n(),`runs`,`changes`,e],file:(e,t)=>[n(),`runs`,`files`,e,t],handoff:e=>[n(),`runs`,`handoff`,e],commits:e=>[n(),`runs`,`commits`,e],commit:(e,t)=>[n(),`runs`,`commit`,e,t]},get workflows(){return[n(),`workflows`]},runnerSkills:(e,t)=>[n(),`runner-skills`,e,t??null],get repo(){return[n(),`repo`]},get repoChanges(){return[n(),`repo`,`changes`]},repoCommit:e=>[n(),`repo`,`commit`,e],get repoBranches(){return[n(),`repo`,`branches`]},get uiState(){return[n(),`ui-state`]},get config(){return[n(),`config`]},get agentConfig(){return[n(),`agent-config`]},agentConfigFile:e=>[n(),`agent-config`,`file`,e],get worktrees(){return[n(),`worktrees`]},github:(e={})=>[n(),`github`,e.limit??null],githubPages:e=>[n(),`github`,`pages`,e],githubPagesHead:e=>[n(),`github`,`pages-head`,e],githubCommentCounts:(e,t)=>[n(),`github`,`comment-counts`,e,[...t].sort((e,t)=>e-t).join(`,`)],githubChecks:e=>[n(),`github`,`checks`,[...e].sort((e,t)=>e-t).join(`,`)],githubSearch:(e,t)=>[n(),`github`,`search`,e,t],githubRefStatus:(e,t,n)=>[e,`github`,`ref-status`,[...t].sort((e,t)=>e-t).join(`,`),[...n].sort((e,t)=>e-t).join(`,`)],githubComments:(e,t)=>[n(),`github`,`comments`,e,t],githubItem:(e,t)=>[n(),`github`,`item`,e,t],githubRefStatusOf:e=>[e,`github`,`ref-status`],githubPrChanges:e=>[n(),`github`,`pr-changes`,e],githubMergeState:e=>[n(),`github`,`merge-state`,e],get openTargets(){return[n(),`open-targets`]}},Y={models:e=>[`workspace`,`models`,e],providerStatus:[`workspace`,`providers`,`status`],projects:[`workspace`,`projects`],githubOwners:[`workspace`,`github-owners`],runsIndex:B,runsSearch:e=>[`workspace`,`runs-search`,e],uiState:[`workspace`,`ui-state`],config:[`workspace`,`config`],agentProfiles:[`workspace`,`agent-profiles`],agentAccountDetails:e=>[`workspace`,`agent-profiles`,`details`,e],agentAccountStatus:e=>[`workspace`,`agent-profiles`,`status`,e],fsBrowseRoot:[`workspace`,`fs-browse`],fsBrowse:(e,t=!1)=>[...Y.fsBrowseRoot,e,t]};function X(e,t,n=`active`){return e.invalidateQueries({queryKey:t===void 0?[`workspace`,`models`]:Y.models(t),refetchType:n})}function Z(e,t=!0){return E({queryKey:Y.models(e),queryFn:({signal:t})=>w(e)?ye(e,{signal:t}):Promise.reject(Error(`${e} has no host model catalog`)),staleTime:300*1e3,enabled:t&&w(e)})}function Bn(e=!0){return{claude:Z(`claude`,e),codex:Z(`codex`,e),opencode:Z(`opencode`,e),pi:Z(`pi`,e),omp:Z(`omp`,e)}}function Vn(){let e=C();return E({queryKey:Y.providerStatus,queryFn:async({signal:t})=>{let n=e.getQueryData(Y.providerStatus),r=await vt(!1,{signal:t});return x(n,e.getQueryData(Y.providerStatus),r)},staleTime:5*6e4,refetchInterval:a(!1),refetchOnWindowFocus:!0})}function Hn(){let e=C();return A({mutationFn:()=>vt(!0),onMutate:()=>e.getQueryData(Y.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(Y.providerStatus,e=>x(r,e,t)),X(e)}})}function Un(){let e=C();return A({mutationFn:({provider:e,authFailureId:t})=>Le(e,t),onMutate:()=>e.getQueryData(Y.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(Y.providerStatus,e=>x(r,e,t,n.authFailureId)),w(n.provider)&&X(e,n.provider)}})}function Wn(e={}){return E({queryKey:Y.projects,queryFn:({signal:e})=>rt({signal:e}),...e})}function Gn(e,t=!1){return E({queryKey:Y.fsBrowse(e,t),queryFn:({signal:n})=>Ie(e??void 0,{signal:n,showHidden:t}),retry:!1})}function Kn(){let e=C();return A({mutationFn:e=>ot(e),onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function qn(){let e=C();return A({mutationFn:e=>Ze(e),retry:!1,onSuccess:()=>{e.invalidateQueries({queryKey:Y.projects})}})}function Jn(){let e=C();return A({mutationFn:e=>{let{id:t,...n}=e;return Ct(t,n)},retry:!1,onMutate:async({id:t,...n})=>{await e.cancelQueries({queryKey:Y.projects});let r=e.getQueryData(Y.projects);return e.setQueryData(Y.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t?Yn(e,n):e)}),{previous:r}},onError:(t,n,r)=>{r?.previous&&e.setQueryData(Y.projects,r.previous)},onSuccess:({project:t})=>{e.setQueryData(Y.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t.id?t:e)})},onSettled:()=>e.invalidateQueries({queryKey:Y.projects})})}function Yn(e,t){let{maxParallel:n,tags:r,...i}=e,a={...i},o=`maxParallel`in t?t.maxParallel:e.maxParallel;o!=null&&(a.maxParallel=o);let s=`tags`in t&&t.tags!==void 0?t.tags:e.tags,c=s==null?[]:Nn(s);if(c.length>0&&(a.tags=c),`webhook`in t&&t.webhook!==void 0)if(t.webhook===null)delete a.webhook;else{let n=t.webhook.token===void 0?e.webhook?.tokenSet??!1:t.webhook.token!==``;a.webhook={url:t.webhook.url,tokenSet:n}}return a}function Xn(e){let t=C();return A({mutationFn:e,retry:!1,onSuccess:({project:e})=>{t.setQueryData(Y.projects,t=>t===void 0?t:{...t,projects:t.projects.map(t=>t.id===e.id?e:t)})},onSettled:()=>t.invalidateQueries({queryKey:Y.projects})})}function Zn(){return Xn(e=>{let{projectId:t,...n}=e;return St(t,n)})}function Qn(){return Xn(e=>{let{projectId:t,webhookId:n,...r}=e;return _e(t,n,r)})}function $n(){return Xn(({projectId:e,webhookId:t})=>Me(e,t))}function er(){return A({mutationFn:({projectId:e,webhookId:t})=>ke(e,t),retry:!1})}function tr(e){let t=C();return A({mutationFn:t=>oe(e,t),retry:!1,onSuccess:()=>t.invalidateQueries({queryKey:J.runs.all})})}function Q(e){let t=C();return A({mutationFn:e,retry:!1,onSuccess:async()=>{await Promise.all([t.invalidateQueries({queryKey:Y.agentProfiles}),t.invalidateQueries({queryKey:Y.projects}),t.invalidateQueries({predicate:({queryKey:e})=>e[1]===`runner-skills`})])}})}function nr(){return Q(e=>yt(e))}function rr(){return Q(e=>{let{id:t,...n}=e;return Tt(t,n)})}function ir(){return Q(e=>mt(e))}function ar(){return Q(e=>He(e))}function or(e,t){return E({queryKey:Y.agentAccountDetails(e),queryFn:({signal:t})=>m(e,{signal:t}),enabled:t,staleTime:0,retry:!1})}function sr(e,t){return E({queryKey:Y.agentAccountStatus(e),queryFn:({signal:t})=>y(e,{signal:t}),enabled:t,staleTime:6e4,retry:!1})}function cr(){let e=C();return A({mutationFn:({provider:e,profileId:t})=>We(e,t),retry:!1,onSuccess:async(t,{provider:n})=>{await Promise.all([e.invalidateQueries({queryKey:Y.agentProfiles}),e.invalidateQueries({queryKey:Y.providerStatus}),w(n)?X(e,n,`none`):Promise.resolve()])}})}function lr(){let e=C();return A({mutationFn:e=>y(e,{refresh:!0}),retry:!1,onSuccess:(t,n)=>{e.setQueryData(Y.agentAccountStatus(n),t),e.invalidateQueries({queryKey:Y.agentProfiles}),w(t.status.provider)&&X(e,t.status.provider)}})}function ur(){return A({mutationFn:e=>{let{routeId:t,...n}=e;return ge(t,n)},retry:!1})}function dr(){let e=C();return A({mutationFn:e=>it(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function fr(){let e=C();return A({mutationFn:e=>Pe(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function pr({enabled:e}){return E({queryKey:Y.githubOwners,queryFn:({signal:e})=>_t({signal:e}),enabled:e,staleTime:6e4,retry:!1})}function mr(){let e=C();(0,O.useEffect)(()=>{let n,r=()=>{let r=e.getQueryData(J.health),i=r?.capabilities?.localHandoff===!0;r&&Ke({local:i,bootProject:r.bootProject??`default`,apiBase:t()}),i&&n===void 0?n=jt(`health`,t=>{e.setQueryData(J.health,t)}):!i&&n!==void 0&&(n(),n=void 0)};r();let i=e.getQueryCache().subscribe(r);return()=>{i(),n?.(),ve()}},[e])}function $(){return E({queryKey:J.health,queryFn:({signal:e})=>gt({signal:e})})}function hr(e,t){let n=$().data,r=Wn(t).data?.projects,i=ft(),a=e??i.projectId,o=a??n?.bootProject,s=o===void 0?void 0:r?.find(e=>e.id===o);return s?.repoUrl?s.repoUrl:a===null||a===n?.bootProject?An(n?.repo?.remote):void 0}function gr(){return E({queryKey:J.openTargets,queryFn:({signal:e})=>Re({signal:e}),staleTime:5*6e4})}function _r(){return E({queryKey:J.runs.list(),queryFn:({signal:e})=>f(j(),{signal:e})})}function vr(e,t){return kt({queryKey:J.runs.archived(e),enabled:t,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>u({before:t,limit:200,q:e},{signal:n}),getNextPageParam:e=>e.nextCursor??void 0,placeholderData:(e,t)=>t?.queryKey[0]===n()?e:void 0})}function yr(e){let t=e.trim();return E({queryKey:Y.runsSearch(t),queryFn:({signal:e})=>ze(t,{signal:e}),enabled:t.length>=2,placeholderData:we,staleTime:1e4})}function br(e=!0,t=on){let n=V(C());return D(`/api/v1/workspace/runs-index`,Y.runsIndex,a(e?t:!1),ln),E({queryKey:Y.runsIndex,queryFn:({signal:e})=>fe({signal:e}).then(n.merge),enabled:e,staleTime:3e4,refetchInterval:!1})}function xr(e,t=!0,n=!1){return E({queryKey:[j({projectId:e,boot:n}).cacheScope,`runs`,`list`],queryFn:({signal:t})=>f(j({projectId:e,boot:n}),{signal:t}),enabled:t,placeholderData:(t,r)=>n&&r?.queryKey[0]===e?t:void 0})}function Sr(e){let t=C();return A({mutationFn:e=>$e(e),onSettled:()=>t.invalidateQueries({queryKey:J.runs.relationships(e)})})}function Cr(e,t={}){return E({queryKey:J.runs.relationships(e),queryFn:({signal:t})=>xt(e,{signal:t}),enabled:t.enabled??!0})}function wr(e){return E({queryKey:J.runs.detail(e??``),queryFn:({signal:t})=>Je(M(e),{signal:t}),enabled:!!e})}function Tr(e,t,n=!0){return E({queryKey:[e??`default`,`runs`,`detail`,t??``],queryFn:({signal:n})=>Je(M(t,{projectId:e}),{signal:n}),enabled:n&&!!e&&!!t})}function Er(e){return E({queryKey:J.runs.diff(e??``),queryFn:({signal:t})=>Et(e,{signal:t}),enabled:!!e})}function Dr(e,t=!1){return D(e?`/api/v1/p/${n()}/runs/${encodeURIComponent(e)}/changes`:void 0,J.runs.changes(e??``),a(t?4e3:!1)),E({queryKey:J.runs.changes(e??``),queryFn:({signal:t})=>qe(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1,refetchOnWindowFocus:!0,staleTime:0})}function Or(e,t){return E({queryKey:J.runs.file(e??``,t??``),queryFn:({signal:n})=>Fe(e,t,{signal:n}),enabled:!!e&&t!==void 0,retry:!1})}function kr(e,t){return E({queryKey:[n(),`runs`,`file-link`,e,t],queryFn:({signal:n})=>Te(e,t,{signal:n}),enabled:t!==null,retry:!1})}function Ar(e,t){return E({queryKey:[n(),`runs`,`artifact`,e,t],queryFn:({signal:n})=>xe(e,t,{signal:n}),enabled:t!==null,retry:!1})}function jr(e,t){return E({queryKey:[n(),`runs`,`artifact-metadata`,e,t],queryFn:({signal:n})=>v(e,t,{signal:n}),enabled:t!==null,retry:!1})}function Mr(e){return E({queryKey:[n(),`runs`,`artifacts`,e],queryFn:({signal:t})=>be(e,{signal:t}),retry:!1,staleTime:0,refetchOnWindowFocus:!0})}function Nr(e,t=!1){return D(e?`/api/v1/p/${n()}/runs/${encodeURIComponent(e)}/commits`:void 0,J.runs.commits(e??``),a(t?5e3:!1)),E({queryKey:J.runs.commits(e??``),queryFn:({signal:t})=>bt(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1})}function Pr(e,t){return E({queryKey:J.runs.commit(e??``,t??``),queryFn:({signal:n})=>je(e,t,{signal:n}),enabled:!!e&&!!t,retry:!1})}function Fr(e,t=!0){return E({queryKey:J.runs.handoff(e??``),queryFn:({signal:t})=>wt(M(e),{signal:t}),enabled:!!e&&t})}function Ir(e,t,n){return E({queryKey:e===void 0?J.runs.handoff(t):[e,`runs`,`handoff`,t],queryFn:({signal:n})=>wt(M(t,{projectId:e}),{signal:n}),enabled:n,staleTime:15e3})}function Lr(e,t){let r=[...new Set(e)],i=k({queries:r.map(e=>({queryKey:[e??n(),`automations`,`names`],queryFn:({signal:t})=>re({signal:t,archived:`include`,...e===void 0?{}:{projectId:e}}),enabled:t,staleTime:6e4,retry:!1}))}),a=i.map(e=>e.data);return(0,O.useMemo)(()=>{let e=new Map;return a.forEach((t,n)=>{if(t?.available)for(let i of t.automations)e.set(JSON.stringify([r[n]??null,i.id]),i.name)}),(t,n)=>e.get(JSON.stringify([t??null,n]))},[JSON.stringify([r,i.map(e=>e.dataUpdatedAt)])])}function Rr(){return E({queryKey:J.workflows,queryFn:({signal:e})=>l({signal:e})})}function zr(){return E({queryKey:J.repo,queryFn:({signal:e})=>Be({signal:e})})}function Br(e){return E({queryKey:[e,`repo`],queryFn:({signal:t})=>Be({signal:t},e)})}function Vr(){return E({queryKey:J.repoBranches,queryFn:({signal:e})=>Ue({signal:e})})}function Hr(){return E({queryKey:J.repoChanges,queryFn:({signal:e})=>dt({signal:e}),retry:!1})}function Ur(e){return E({queryKey:J.repoCommit(e??``),queryFn:({signal:t})=>at(e,{signal:t}),enabled:!!e,retry:!1})}function Wr(){return E({queryKey:J.config,queryFn:({signal:e})=>te({signal:e})})}function Gr(){return E({queryKey:J.worktrees,queryFn:({signal:e})=>de({signal:e})})}function Kr(e){return E({queryKey:[e,`worktrees`],queryFn:({signal:t})=>de({signal:t},e),staleTime:0})}function qr(e,t=!0,n=!1){return E({queryKey:[j({projectId:e,boot:n}).cacheScope,`ui-state`],queryFn:({signal:t})=>nt({signal:t},e),select:e=>e.sidebarLimits===void 0?e:{...e,sidebarLimits:Ot(e.sidebarLimits)},enabled:t})}function Jr(){return qr(n())}function Yr(){return E({queryKey:J.agentConfig,queryFn:({signal:e})=>ie({signal:e})})}function Xr(e){return E({queryKey:J.agentConfigFile(e??``),queryFn:({signal:t})=>he(e,{signal:t}),enabled:e!==null})}function Zr(e){let t=C(),n=J.agentConfig,r=J.agentConfigFile(e);return A({mutationFn:t=>Ee(e,t),onSuccess:e=>{t.setQueryData(r,e),t.invalidateQueries({queryKey:n})}})}function Qr(){return E({queryKey:Y.uiState,queryFn:({signal:e})=>le({signal:e})})}function $r(){return E({queryKey:Y.config,queryFn:({signal:e})=>tt({signal:e})})}function ei(){return E({queryKey:Y.agentProfiles,queryFn:({signal:e})=>Dt({signal:e})})}function ti(e){let t=C();return A({mutationFn:t=>Ce(e,t),onSuccess:()=>t.invalidateQueries({queryKey:J.runs.all})})}function ni(e){let t=R(),n=e?.projectId,r=e?.cacheScope,i=A({mutationFn:e=>Ge(e,!0),onMutate:e=>t.patchRead(e,!0),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)}),a=(0,O.useCallback)(e=>({...M(e,{projectId:n,cacheScope:r}),id:e}),[n,r]),o=(0,O.useCallback)(e=>({onSuccess:(t,n,r,i)=>e?.onSuccess?.(t,n.id,r,i),onError:(t,n,r,i)=>e?.onError?.(t,n.id,r,i),onSettled:(t,n,r,i,a)=>e?.onSettled?.(t,n,r.id,i,a)}),[]),{mutate:s,mutateAsync:c}=i,l=(0,O.useCallback)((e,t)=>s(a(e),o(t)),[s,a,o]),u=(0,O.useCallback)((e,t)=>c(a(e),o(t)),[c,a,o]);return{...i,variables:i.variables?.id,mutate:l,mutateAsync:u}}function ri(){let e=R();return A({mutationFn:e=>Ge(M(e),!1),onMutate:t=>e.patchRead(()=>M(t),!1),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)})}function ii(e){let t=R();return A({mutationFn:({id:t,pinned:n})=>_(M(t,e),n),onError:e=>Mt(`Could not update pin. ${e.message} Please retry.`,{tone:`danger`}),onMutate:()=>e??j(),onSuccess:(e,n,r)=>t.invalidateAfter(`runs`,r)})}function ai(e,t){let n=R();return A({mutationFn:n=>ut(M(e,{projectId:t}),n),onMutate:()=>j({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`send`,r),onError:(e,t,r)=>{e instanceof Ye&&e.status===409&&r&&n.invalidateAfter(`send`,r)}})}function oi(e,t){let n=R();return A({mutationFn:(n={})=>Oe(M(e,{projectId:t}),n),onMutate:()=>j({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`continue`,r)})}function si(e){let t=C();return A({mutationFn:({msgId:t,message:n})=>se(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:J.runs.all})})}function ci(e){let t=C();return A({mutationFn:t=>ct(e,t),onSuccess:()=>t.invalidateQueries({queryKey:J.runs.all})})}function li(e={},t=!0){let r=C(),i=J.github(e);D(`/api/v1/p/${n()}/github${e.limit===void 0?``:`?limit=${e.limit}`}`,i,a(t?6e4:!1));let o=E({queryKey:J.github(e),queryFn:({signal:t})=>b({limit:e.limit},{signal:t}),enabled:t,staleTime:6e4,refetchInterval:!1,refetchIntervalInBackground:!1,refetchOnWindowFocus:!0}),s=o.data?.projectsGeneration,c=E({queryKey:[...i,`projects`,s],queryFn:({signal:e})=>Qe(s,{signal:e}),enabled:t&&o.data?.projectsState===`refreshing`&&!!s,staleTime:1/0,retry:!1});return(0,O.useEffect)(()=>{!s||!c.data&&!c.error||r.setQueryData(i,e=>{if(!e||e.projectsGeneration!==s||e.projectsState!==`refreshing`)return e;let t=c.data;return t?.generation&&t.generation!==s?e:t?.state===`ready`?{...e,projectsState:`ready`,projects:t.projects,issues:e.issues.map(e=>({...e,projectIds:t.membership?.[e.number]??[]}))}:{...e,projectsState:`unavailable`,projectsReason:t?.reason??`Project boards unavailable. Refresh to try again.`}})},[r,s,c.data,c.error,i]),o}var ui=class extends Error{};function di(e,t,n){return{queryKey:e,initialPageParam:{},queryFn:async({pageParam:e,signal:r})=>{let i=await b({limit:t,...e,...n?{projectId:n}:{}},{signal:r});if(!i.available&&Object.keys(e).length>0)throw new ui(i.reason??`GitHub is unavailable.`);return i},getNextPageParam:e=>Pn(e),retry:(e,t)=>!(t instanceof ui)&&!(t instanceof Ye&&t.status>=400&&t.status<500)&&e<1,staleTime:6e4,refetchOnWindowFocus:!0}}function fi(e=50,t=!0){let r=C(),i=J.githubPages(e),o=J.githubPagesHead(e);D(`/api/v1/p/${n()}/github?limit=${e}`,o,a(t?6e4:!1));let s=kt({...di(i,e),enabled:t,refetchInterval:!1,refetchIntervalInBackground:!1}),c=E({queryKey:o,queryFn:({signal:t})=>b({limit:e},{signal:t}),enabled:!1,staleTime:1/0}),{refetch:l}=s;(0,O.useEffect)(()=>{if(!c.data)return;let e=r.getQueryData(i);if(!e||e.pages.length===0)return;let t=Rn(e.pages,c.data);t===`refetch`?l():r.setQueryData(i,{...e,pages:t})},[r,c.dataUpdatedAt,l]);let u=(s.data?.pages??[]).flatMap(e=>e.projectsState===`refreshing`&&e.projectsGeneration?[e.projectsGeneration]:[]),d=k({queries:u.map(e=>({queryKey:[...i,`projects`,e],queryFn:({signal:t})=>Qe(e,{signal:t}),enabled:t,staleTime:1/0,retry:!1}))});return(0,O.useEffect)(()=>{d.forEach((e,t)=>{let n=u[t];!n||!e.data&&!e.error||r.setQueryData(i,t=>{if(!t)return t;let r=!1,i=t.pages.map(t=>{if(t.projectsGeneration!==n||t.projectsState!==`refreshing`)return t;let i=e.data;return i?.generation&&i.generation!==n?t:(r=!0,i?.state===`ready`?{...t,projectsState:`ready`,projects:i.projects,issues:t.issues.map(e=>({...e,projectIds:i.membership?.[e.number]??[]}))}:{...t,projectsState:`unavailable`,projectsReason:i?.reason??`Project boards unavailable. Refresh to try again.`})});return r?{...t,pages:i}:t})})},[r,d.map((e,t)=>e.data||e.error?u[t]:``).join(`,`)]),{pages:s,data:(0,O.useMemo)(()=>Ln(s.data?.pages??[]),[s.data])}}function pi(e,t=50,n=!0){let r=kt({...di([e,`github`,`pages`,t],t,e),enabled:n});return{pages:r,data:(0,O.useMemo)(()=>Ln(r.data?.pages??[]),[r.data])}}function mi(e,t,n=!0){let r=k({queries:t.filter(e=>e.length>0).map(t=>({queryKey:J.githubCommentCounts(e,t),queryFn:({signal:n})=>me(e,t,{},{signal:n}),enabled:n,staleTime:6e4}))});return(0,O.useMemo)(()=>{let e={};for(let t of r)t.data?.available&&Object.assign(e,t.data.counts);return e},[r.map(e=>e.dataUpdatedAt).join(`,`)])}function hi(e,t,n,r=!0){return E({queryKey:[e,`github`,`search`,t,n],queryFn:({signal:r})=>lt(t,n,{projectId:e},{signal:r}),enabled:r&&n.trim()!==``,staleTime:6e4})}function gi(e,t=!0){return E({queryKey:J.githubChecks(e),queryFn:({signal:t})=>De(e,{signal:t}),enabled:t&&e.length>0,staleTime:6e4})}function _i(e,t,n=!0){return E({queryKey:J.githubSearch(e,t),queryFn:({signal:n})=>lt(e,t,{},{signal:n}),enabled:n&&t.trim()!==``,staleTime:6e4})}var vi=100;function yi(e){return[...e].sort((e,t)=>t-e).slice(0,vi).sort((e,t)=>e-t)}function bi(){let e=ft(),t=$();return e.projectId??t.data?.bootProject}function xi(e){for(let[t,n]of Object.entries(e)){for(let[e,r]of Object.entries(n.prs))U(K({projectId:t,kind:`PR`,number:Number(e)}),r);for(let[e,r]of Object.entries(n.issues))U(K({projectId:t,kind:`Issue`,number:Number(e)}),r)}}var Si=5*6e4;function Ci(e){return e?e.recheckAfterMs:Si}function wi(e,t=!0){let n=(0,O.useMemo)(()=>{let t=new Map;for(let n of e){let e=t.get(n.projectId)??{prs:new Set,issues:new Set};e[n.kind===`PR`?`prs`:`issues`].add(n.number),t.set(n.projectId,e)}return[...t.entries()].map(([e,t])=>({projectId:e,prs:yi(t.prs),issues:yi(t.issues)}))},[e.map(K).sort().join(`|`)]),r=k({queries:n.map(e=>({queryKey:J.githubRefStatus(e.projectId,e.prs,e.issues),queryFn:({signal:t})=>Ne(e.projectId,{prs:e.prs,issues:e.issues},{signal:t}),enabled:t&&e.prs.length+e.issues.length>0,staleTime:e=>Ci(e.state.data)??1/0,refetchInterval:!1,refetchOnWindowFocus:!0}))}),a=C(),o=JSON.stringify(n.map((e,t)=>({...e,interval:Ci(r[t]?.data)??!1})));(0,O.useEffect)(()=>{if(!t||i())return;let e=!0,n=JSON.parse(o).filter(e=>e.interval!==!1).map(t=>{let n=new URLSearchParams;t.prs.length&&n.set(`prs`,t.prs.join(`,`)),t.issues.length&&n.set(`issues`,t.issues.join(`,`));let r=J.githubRefStatus(t.projectId,t.prs,t.issues);return At({path:`/api/v1/p/${t.projectId}/github/ref-status?${n}`,intervalMs:t.interval},(t,n)=>{n||a.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&a.setQueryData(r,t)})})});return()=>{e=!1;for(let e of n)e()}},[t,o,a]);let s=(0,O.useMemo)(()=>kn(n,r),[n,r.map(e=>`${e.dataUpdatedAt}:${e.status}`).join(`,`)]);return(0,O.useCallback)(e=>{let t=K(e),n=s.get(t);if(n)return n;let r=H.get(t);return{state:`idle`,...r?{status:r}:{},...W.has(t)?{conflicting:!0}:{}}},[s])}function Ti(e,t,n=!0){return E({queryKey:J.githubComments(e,t),queryFn:({signal:n})=>o(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function Ei(e,t,n=!0){return E({queryKey:J.githubItem(e,t),queryFn:({signal:n})=>Ve(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function Di(e){return E({queryKey:J.githubPrChanges(e??0),queryFn:({signal:t})=>st(e,{},{signal:t}),enabled:e!==void 0,staleTime:6e4,retry:!1})}export{Zr as $,pr as A,er as At,gr as B,zn as Bt,kr as C,Z as Ct,mi as D,ar as Dt,gi as E,yr as Et,mr as F,Rr as Ft,Br as G,hn as Gt,ii as H,jn as Ht,ni as I,$r as It,xr as J,R as Jt,hr as K,_n as Kt,ri as L,Qr as Lt,Di as M,rr as Mt,_i as N,Jn as Nt,Ti as O,ai as Ot,$ as P,Qn as Pt,Vn as Q,Nt as Qt,tr as R,Gr as Rt,si as S,Bn as St,li as T,br as Tt,pi as U,Mn as Ut,ti as V,Fn as Vt,hi as W,An as Wt,Kr as X,M as Xt,qr as Y,j as Yt,Wn as Z,A as Zt,oi as _,Nr as _t,sr as a,ir as at,Zn as b,Fr as bt,ei as c,ci as ct,jr as d,Hr as dt,lr as et,Mr as f,Ur as ft,cr as g,Pr as gt,Wr as h,Dr as ht,or as i,Kn as it,fi as j,Jr as jt,Ei as k,Ir as kt,vr as l,zr as lt,dr as m,wr as mt,J as n,wi as nt,Yr as o,qn as ot,Lr as p,Un as pt,Tr as q,V as qt,xi as r,Hn as rt,Xr as s,$n as st,X as t,bi as tt,Ar as u,Vr as ut,nr as v,Er as vt,Gn as w,_r as wt,Sr as x,Cr as xt,fr as y,Or as yt,ur as z,Y as zt};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{E as t,L as n,S as r,d as i,t as a,u as o}from"./button-DGwhwRuD.js";import{i as s,t as c}from"./react-runtime-CCIEwYL0.js";import{Gn as l,Ht as u,In as d,Ln as f,Nn as ee,Qn as p,Vt as m,Wn as h,Xn as g,Yn as _,hr as v,i as te,k as y,o as ne,zr as re}from"./project-scope-context-Cb2B_LxQ.js";import{B as b,H as ie,Jt as ae,K as x,L as S,P as oe,Q as C,R as w,V as T,Xt as se,Yt as ce,Z as le,Zt as E,bt as ue,mt as de,n as fe,tt as pe,wt as me,x as he,xt as D}from"./queries-Bb9GjWMQ.js";import{J as ge,L as _e,S as ve,_ as ye,a as be,b as xe,d as Se,f as Ce,n as we,o as Te,p as Ee,r as De,v as Oe,y as ke,z as O}from"./use-desktop-tg8hhNdq.js";import{n as k}from"./toaster-CoMJoQvk.js";import{A as Ae,F as je,a as Me,at as Ne,f as Pe,ft as A,g as Fe,h as Ie,i as j,l as M,m as Le,p as Re,q as ze,t as Be,v as N,x as Ve}from"./design-icons-B6-0w7Aw.js";import{t as P}from"./createLucideIcon-BHp8sXmF.js";import{t as He}from"./app-window-CSHwDX9N.js";import{t as Ue}from"./info-DA1x_4bz.js";import{a as We,t as Ge}from"./format-BNCkW110.js";import{t as Ke}from"./message-square-B-MD-8rD.js";import{i as qe,n as Je,t as F}from"./reference-chip-AYFrAylA.js";import{a as I,i as L,l as R,n as z,p as B,r as V,t as H}from"./dropdown-menu-CzUYjvx4.js";import{a as Ye,i as Xe,o as Ze,r as Qe,s as $e,t as et}from"./dialog-tMSuX5a7.js";import{c as tt,s as nt,t as U}from"./project-router-BKoMKwmx.js";import"./attention-DLIMAzlf.js";import{Bt as rt,Ct as it,Dt as W,Ht as at,Jt as G,M as ot,N as st,Ot as K,V as ct,Vt as lt,Xt as ut,Yt as dt,Zt as ft,_ as pt,a as mt,ct as ht,dt as gt,en as _t,ft as vt,gt as yt,ht as bt,j as xt,ln as St,lt as Ct,mt as q,nn as wt,o as Tt,pt as Et,r as Dt,rn as Ot,st as kt,t as At,ut as jt,vn as Mt,vt as Nt,yt as Pt}from"./index-DgjX4EGJ.js";import{r as Ft,t as It}from"./markdown-B0anEsMd.js";import{t as J}from"./tab-link-CekOt2NF.js";var Lt=P(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),Rt=P(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),zt=P(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),Y=e(s(),1),X=c();function Bt(e){let t=ae();return E({mutationFn:t=>ne(se(e),t),onSuccess:()=>t.invalidateAfter(`runs`,()=>ce()),onError:e=>k(e.message,{tone:`danger`})})}function Vt(e){return e.archived?`Unarchive`:`Archive task`}function Ht({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,X.jsx)(kt,{open:t,onOpenChange:n,children:(0,X.jsxs)(jt,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,X.jsxs)(Et,{children:[(0,X.jsx)(q,{children:`Archive task?`}),(0,X.jsxs)(gt,{children:[`Move “`,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,title:O(e),children:O(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,X.jsxs)(vt,{children:[(0,X.jsx)(Ct,{children:`Cancel`}),(0,X.jsx)(ht,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function Z({run:e,className:t,compactOnMobile:n=!1}){let[r,i]=(0,Y.useState)(!1),s=Bt(e.id),c=Vt(e);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(a,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":c,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:s.isPending,className:o(`h-11 gap-[7px] px-3`,n&&`max-md:size-11 max-md:px-0`,t),onClick:()=>e.archived?s.mutate(!1):i(!0),children:[e.archived?(0,X.jsx)(Mt,{"aria-hidden":`true`}):(0,X.jsx)(Be,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:o(n&&`max-md:sr-only`),children:c})]}),(0,X.jsx)(Ht,{run:e,open:r,onOpenChange:i,onConfirm:()=>{s.mutate(!0),i(!1)}})]})}function Ut({run:e,action:t,prUrl:n,patch:r}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:t.phase===`blocked`?`Completion blocked`:`Completion pending`}),` · `,t.message||(t.phase===`blocked`?`Completion needs attention.`:`Checking completion actions.`)]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&i(n)?(0,X.jsx)(a,{variant:`outline`,asChild:!0,children:(0,X.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:`Open PR`})}):null,e.autoMergePr?(0,X.jsx)(a,{variant:`outline`,disabled:r.isPending,onClick:()=>r.mutate({autoMergePr:!1},{onError:e=>k(e.message,{tone:`danger`})}),children:r.isPending?`Saving…`:`Disable auto-merge`}):null]})]})}function Wt({run:e,blocker:t,flags:n}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:`Archive blocked`}),` · `,t.message]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.runId?(0,X.jsx)(a,{variant:`outline`,asChild:!0,children:(0,X.jsx)(U,{to:`/tasks/${t.runId}`,children:`Open blocking task`})}):null,t.pullRequestUrl&&i(t.pullRequestUrl)?(0,X.jsx)(a,{variant:`outline`,asChild:!0,children:(0,X.jsx)(`a`,{href:t.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,children:`Open blocking PR`})}):null,n.archive?(0,X.jsx)(Z,{run:e}):null]})]})}function Gt({run:e}){let t=T(e.id),n=K(e),r=e.status===`done`?e.completionAction:void 0,i=n.archive?e.archiveBlocker:void 0,a=r&&r.phase!==`complete`?r:void 0;if(!a&&!i)return null;let o=e.pullRequestUrl??e.pullRequests?.find(e=>e.url)?.url;return(0,X.jsxs)(`section`,{"data-slot":`completion-status`,"aria-label":`Completion action`,className:`grid min-w-0 gap-2 rounded-lg border border-border bg-card p-3 [margin-block:0.75rem]`,children:[a?(0,X.jsx)(Ut,{run:e,action:a,prUrl:o,patch:t}):null,i?(0,X.jsx)(Wt,{run:e,blocker:i,flags:n}):null]})}var Kt=[`running`,`queued`,`waiting`];function qt(e,{queuePosition:t,now:n=new Date}){let r=ee(e),i=r.label.charAt(0).toUpperCase()+r.label.slice(1),a=t===void 0?i:`${i} #${t}`,o=Kt.includes(e.status)?Yt(e,n):void 0;return o?{attention:r,label:a,nextCheck:o}:{attention:r,label:a}}function Jt(e){return e.nextCheck?`${e.label} · Next check ${e.nextCheck.text}`:e.label}function Yt(e,t){let n;for(let t of Array.isArray(e.waits)?e.waits:[]){if(t?.kind!==`timer`||t.phase!==`open`)continue;let e=new Date(t.deadline);Number.isFinite(e.getTime())&&(!n||e<n)&&(n=e)}if(n)return{at:n.toISOString(),text:Ge(n,t)}}async function Q(e,t){try{await navigator.clipboard.writeText(e),k(t)}catch{k(`Run manually: ${e}`)}}function Xt(e){let t=x(),n=pe(),r=(0,Y.useMemo)(()=>ve(e,t),[e,t]);return{referenceProjectId:n,repoBase:t,references:r,requests:(0,Y.useMemo)(()=>n===void 0?[]:r.filter(e=>Se(e,t)).map(e=>({projectId:n,kind:e.kind,number:e.number})),[r,n,t])}}function Zt(e){return E({mutationFn:()=>u(e.id),onError:e=>{if(e instanceof te&&e.command){Q(e.command,`No terminal found — command copied to clipboard.`);return}k(e.message,{tone:`danger`})}})}function $(e,t){let n=b(),r=C(),i=E({mutationFn:t=>m(e.id,t),onError:e=>k(e.message,{tone:`danger`})}),a=v(r.data),o=e=>!r.isSuccess||a.includes(e??`claude`);return{canResumeHere:t&&o(it(e)),choices:e.worktreePath?(n.data?.targets??[]).filter(e=>{let t=ut(e.id);return t===void 0||o(t)}).map(t=>({target:t,...Pt(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[],open:i}}function Qt({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:o}=$(e,t),s=W(e);return!r&&i.length===0&&!s?null:(0,X.jsxs)(X.Fragment,{children:[r||i.length>0?(0,X.jsxs)(`div`,{className:`task-open-targets flex flex-wrap gap-3`,children:[r?(0,X.jsxs)(a,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,X.jsx)(_t,{}),`Terminal (resume session)`]}):null,i.map(({target:e,suffix:t,title:n})=>{let r=ft(e);return(0,X.jsxs)(a,{variant:`outline`,"data-target":e.id,title:n,disabled:o.isPending,onClick:()=>o.mutate(e.id),children:[(0,X.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,X.jsxs)(a,{variant:`outline`,onClick:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>k(`Worktree path copied`)).catch(()=>k(`Path: ${t}`))},children:[(0,X.jsx)(N,{}),`Copy worktree path`]}):null]}):null,s?(0,X.jsxs)(`div`,{"data-slot":`resume-command`,className:`mt-5 border-t border-border pt-5`,children:[(0,X.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,X.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:s}),(0,X.jsxs)(a,{variant:`outline`,onClick:()=>void Q(s,`Command copied to clipboard.`),children:[(0,X.jsx)(N,{}),`Copy resume command`]})]}):null]})}function $t({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:o}=$(e,t),s=W(e),c=e.worktreePath;if(!r&&i.length===0&&!s&&!c)return null;let l=`max-md:min-h-11`;return(0,X.jsxs)(`div`,{"data-slot":`workspace-tools`,className:`flex min-w-0 flex-wrap gap-2`,children:[r||i.length>0?(0,X.jsx)(dt,{choices:i,onPick:e=>o.mutate(e),disabled:o.isPending,triggerVariant:`outline`,className:l,leading:r?(0,X.jsxs)(L,{"data-target":`terminal-resume`,onSelect:n,children:[(0,X.jsx)(_t,{"aria-hidden":`true`}),`Terminal (resume session)`]}):void 0}):null,c?(0,X.jsxs)(a,{variant:`outline`,size:`sm`,className:l,onClick:()=>void Q(c,`Worktree path copied`),children:[(0,X.jsx)(N,{"aria-hidden":`true`}),`Copy worktree path`]}):null,s?(0,X.jsxs)(a,{variant:`outline`,size:`sm`,"data-slot":`resume-command`,title:s,className:l,onClick:()=>void Q(s,`Command copied to clipboard.`),children:[(0,X.jsx)(N,{"aria-hidden":`true`}),`Copy resume command`]}):null]})}function en({run:e,canResume:t,onResume:n,onOpen:r,onClose:i}){let{canResumeHere:o,choices:s}=$(e,t);return!o&&s.length===0?null:r?(0,X.jsx)(L,{onSelect:r,children:`Open in…`}):(0,X.jsxs)(`section`,{"aria-label":`Open task worktree in…`,className:`task-action-panel my-5 rounded-xl border border-border bg-card p-6`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,X.jsx)(a,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,X.jsx)(A,{})})]}),e.worktreePath?(0,X.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,X.jsx)(`div`,{className:`mt-4`,children:(0,X.jsx)(Qt,{run:e,canResume:t,onResume:n})})]})}function tn({branch:e}){let[t,n]=(0,Y.useState)(null),r=(0,Y.useRef)(null);(0,Y.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);let i=t===e,a=async()=>{r.current!==null&&clearTimeout(r.current),n(null);try{if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(e),n(e),r.current=setTimeout(()=>n(null),2e3)}catch{k(`Could not copy branch. Select and copy: ${e}`)}};return(0,X.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,children:[(0,X.jsx)(`span`,{"data-slot":`branch-chip`,className:`min-w-0 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium break-all`,children:e}),(0,X.jsxs)(`button`,{type:`button`,"aria-label":i?`Copied branch name`:`Copy branch name`,onClick:()=>void a(),className:`inline-flex min-h-11 shrink-0 items-center gap-1 rounded-sm px-2 text-xs font-medium text-foreground hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground md:min-h-8`,children:[(0,X.jsx)(N,{className:`size-3.5`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{"aria-live":`polite`,children:i?`Copied`:`Copy`})]})]})}function nn({run:e}){let t=x(),n=pe(),r=r=>n===void 0?void 0:Oe(n,e.id,r,t),a=(0,Y.useMemo)(()=>ve(e,t),[e,t]),o=[],s=[],c=a.filter(e=>e.kind===`PR`);for(let t of c)o.push((0,X.jsx)(F,{reference:t,to:r(t),taskTitle:O(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`,conflictAction:(0,X.jsx)(yt,{run:e,prNumber:t.number})},Ee(t)));let l=xe(e);l&&i(l)&&!c.some(e=>e.url===l)&&o.push((0,X.jsx)(F,{reference:{kind:`PR`,url:l},taskTitle:O(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`pr`));let u=a.filter(e=>e.kind===`Issue`);for(let t of u)s.push((0,X.jsx)(F,{reference:t,to:r(t),taskTitle:O(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},Ee(t)));let d=ye(e,t);if(d&&i(d)&&!u.some(e=>e.url===d)){let t=Ce(d);s.push((0,X.jsx)(F,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:d},to:t?r({kind:`Issue`,number:Number(t),url:d}):void 0,taskTitle:O(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`issue`))}return o.length===0&&s.length===0?null:(0,X.jsx)(`div`,{"data-slot":`linked-references`,className:`flex min-w-0 flex-col gap-3`,children:[[`PR`,`PRs`,o],[`Issue`,`Issues`,s]].map(([e,t,n])=>n.length>0?(0,X.jsxs)(`div`,{"data-reference-kind":e,className:`grid min-w-0 grid-cols-[5rem_minmax(0,1fr)] items-center gap-x-2 gap-y-1`,children:[(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,X.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:n})]},e):null)})}function rn(){let e=nt(),t=le();return xt(t.data?.projects?.find(n=>n.id===(e??t.data?.bootProject)))}var an=e=>e.map(e=>`${e.name}: ${ot(e.url)}`).join(`
|
|
2
|
-
`);function on(e){return rn().length>0||e.notify===!0}function sn({run:e}){let t=rn(),n=t.length>0,r=w(e.id),[i,o]=(0,Y.useState)(null),s=e.notify===!0;return!n&&!s?null:(0,X.jsxs)(X.Fragment,{children:[s?(0,X.jsxs)(H,{children:[(0,X.jsx)(B,{asChild:!0,children:(0,X.jsxs)(a,{variant:`outline`,size:`sm`,"data-slot":`notifying-chip`,className:`h-11 gap-1.5 md:h-[30px]`,"aria-label":n?`Notifying ${st(t)} — webhook actions`:`Notifying — webhook actions`,title:n?an(t):void 0,children:[(0,X.jsx)(G,{tone:`success`}),(0,X.jsx)(`span`,{children:`Notifying`}),(0,X.jsx)(M,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,X.jsxs)(V,{align:`end`,"data-slot":`notifying-menu`,className:`w-[240px] max-w-[calc(100vw-2rem)] p-2`,children:[n?(0,X.jsx)(I,{"data-slot":`notifying-targets`,className:`flex flex-col gap-0.5 px-2 py-1.5 text-[11px] font-normal text-muted-foreground`,children:t.map(e=>(0,X.jsx)(`span`,{"data-webhook-target":e.id,className:`truncate`,title:ot(e.url),children:e.name},e.id))}):null,n?(0,X.jsxs)(L,{className:`min-h-11`,onSelect:()=>o(`note`),children:[(0,X.jsx)(Ke,{"aria-hidden":`true`}),` Send a note…`]}):null,(0,X.jsxs)(L,{variant:`destructive`,className:`min-h-11`,disabled:r.isPending,onSelect:()=>r.mutate({notify:!1},{onSuccess:()=>k(`Stopped notifying the webhook`),onError:e=>k(`Could not stop notifying. ${e.message}`,{tone:`danger`})}),children:[(0,X.jsx)(Lt,{"aria-hidden":`true`}),` Stop notifying`]})]})]}):(0,X.jsxs)(a,{variant:`outline`,size:`sm`,"data-action":`handoff`,className:`size-11 px-0 md:h-[30px] md:w-auto md:px-2.5`,"aria-label":`Hand off to webhook`,onClick:()=>o(`handoff`),children:[(0,X.jsx)(wt,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`max-md:sr-only`,children:`Hand off`})]}),n?(0,X.jsx)(cn,{mode:i,targets:t,pending:r.isPending,onOpenChange:e=>!e&&o(null),onSubmit:e=>r.mutate({notify:!0,...e?{message:e}:{}},{onSuccess:()=>{o(null),k(i===`note`?`Note sent to the webhook`:`Handed off to the webhook`)},onError:e=>k(`Could not hand off. ${e.message}`,{tone:`danger`})})}):null]})}function cn({mode:e,targets:t,pending:n,onOpenChange:r,onSubmit:i}){let o=(0,Y.useId)(),s=(0,Y.useId)(),[c,l]=(0,Y.useState)(``);(0,Y.useEffect)(()=>{e!==null&&l(``)},[e]);let u=e===`note`,d=st(t);return(0,X.jsx)(et,{open:e!==null,onOpenChange:e=>{e||l(``),r(e)},children:(0,X.jsx)(Qe,{"data-slot":`handoff-dialog`,className:`max-sm:top-auto max-sm:bottom-0 max-sm:left-0 max-sm:max-w-none max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none max-sm:rounded-t-xl max-sm:border-x-0 max-sm:border-b-0 max-sm:pb-[max(1.5rem,env(safe-area-inset-bottom))] max-sm:data-[state=open]:slide-in-from-bottom max-sm:data-[state=open]:zoom-in-100 max-sm:data-[state=closed]:slide-out-to-bottom max-sm:data-[state=closed]:zoom-out-100`,children:(0,X.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),i(c.trim())},children:[(0,X.jsxs)(Ze,{className:`text-left`,children:[(0,X.jsx)($e,{children:u?`Send a note to ${t.length===1?`the webhook`:`the webhooks`}`:`Hand off to webhook`}),(0,X.jsx)(Xe,{children:(0,X.jsx)(`span`,{"data-webhook-destination":``,title:an(t),children:u?`${d} ${t.length===1?`gets`:`get`} this note with the task's current status.`:`${d} will start receiving this task's status updates. Add a note (optional).`})})]}),(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(`label`,{htmlFor:o,className:`text-[13px] font-medium`,children:`Note`}),(0,X.jsx)(ct,{id:o,"data-slot":`handoff-note`,"aria-describedby":s,rows:4,maxLength:1e5,className:`min-h-24`,placeholder:`e.g. Take over from here, ping me when the PR is green`,value:c,onChange:e=>l(e.target.value)}),(0,X.jsxs)(`p`,{id:s,className:`flex items-center gap-1.5 text-[12px] text-muted-foreground`,children:[(0,X.jsx)(Ue,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`The note goes to the webhook only, not to the agent.`]})]}),(0,X.jsxs)(Ye,{className:`gap-2 max-sm:flex-col-reverse max-sm:[&>button]:h-11 max-sm:[&>button]:w-full`,children:[(0,X.jsx)(a,{type:`button`,variant:`ghost`,className:`sm:h-9`,onClick:()=>r(!1),children:`Cancel`}),(0,X.jsxs)(a,{type:`submit`,variant:`contrast`,className:`sm:h-9`,"data-action":`handoff-submit`,disabled:n||u&&c.trim()===``,children:[(0,X.jsx)(wt,{"aria-hidden":`true`}),u?`Send note`:`Hand off`]})]})]})})})}function ln({runId:e,children:t}){let n=r(),i=(0,Y.useMemo)(()=>({runId:e}),[e]);return n?(0,X.jsx)(un,{runId:e,children:t}):(0,X.jsx)(Ft.Provider,{value:i,children:t})}function un({runId:e,children:n}){let{projectId:r}=t(),i=(0,Y.useMemo)(()=>({runId:e,...r?{projectId:r}:{}}),[e,r]);return(0,X.jsx)(Ft.Provider,{value:i,children:n})}function dn(e,t,n,r){return n?r===`step`?`Step ${e} of ${t}`:`${e} of ${t} complete`:`${e} / ${t}`}function fn(e){return typeof e==`object`&&!!e&&!(0,Y.isValidElement)(e)&&`keep`in e}function pn({slot:e,icon:t,title:n,meta:r,summary:i,aside:a,open:s,onToggle:c,className:l,children:u}){let d=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`flex size-4 shrink-0 items-center justify-center text-accent-text`,children:t}),(0,X.jsx)(`span`,{className:o(`truncate text-[14px] font-semibold text-foreground`,typeof n==`string`?`shrink-0`:`min-w-0 shrink`),children:n}),i??(fn(r)?(0,X.jsxs)(`span`,{"data-slot":`run-activity-meta`,className:`contents text-[13px] text-muted-foreground tabular-nums`,children:[r.drop===void 0?null:(0,X.jsxs)(`span`,{className:`flex h-[1lh] min-w-0 shrink-[2] flex-wrap overflow-hidden`,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`h-[1lh] w-0`}),(0,X.jsxs)(`span`,{"data-slot":`run-activity-meta-drop`,className:`whitespace-nowrap`,children:[r.drop,(0,X.jsx)(`span`,{className:`text-soft-foreground`,children:` ·`})]})]}),` `,(0,X.jsx)(`span`,{"data-slot":`run-activity-meta-keep`,className:`shrink-0 whitespace-nowrap`,children:r.keep})]}):r===void 0?null:(0,X.jsx)(`span`,{"data-slot":`run-activity-meta`,className:`min-w-0 shrink-[2] truncate text-[13px] text-muted-foreground tabular-nums`,children:r}))]}),f=c!==void 0;return(0,X.jsxs)(`div`,{"data-slot":`run-activity-${e}`,"data-state":f&&s?`open`:`collapsed`,className:o(`min-w-0 border-t border-border first:border-t-0`,l),children:[f?(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":s,onClick:c,className:`flex min-h-11 w-full min-w-0 items-center gap-2.5 px-3.5 py-2 text-start hover:bg-muted/40 active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-ring`,children:[d,a,(0,X.jsx)(M,{"aria-hidden":!0,className:o(`size-4 shrink-0 text-soft-foreground motion-safe:transition-transform motion-reduce:transition-none`,!a&&`ms-auto`,s&&`rotate-180`)})]}):(0,X.jsxs)(`div`,{className:`flex min-h-11 w-full min-w-0 items-center gap-2.5 px-3.5 py-2`,children:[d,a]}),f&&s?(0,X.jsx)(`div`,{"data-slot":`run-activity-body`,className:`min-w-0 border-t border-border/60 bg-muted/30 px-3.5 py-2.5`,children:u}):null]})}function mn(e,t){let n=e?.role===`root`?e.receipts.map(e=>e.workerId).reverse():[];return[...new Set([...n,...(t?.workers??[]).map(e=>e.workerId)])]}function hn(e){let t=e.delegation,n=t?.role===`root`,r=D(e.id,{enabled:n});if(!n||!t)return`complete`;if(!r.isSuccess)return r.isError||r.fetchStatus===`paused`?`unknown`:`pending`;let i=new Map(r.data.workers.map(e=>[e.workerId,e])),a=mn(t,r.data).map(e=>{let t=i.get(e)?.status;return t===`done`||t===`cancelled`?`complete`:t===void 0||t===`failed`?`issue`:`pending`});return a.includes(`pending`)?`pending`:a.includes(`issue`)?`issue`:`complete`}function gn(e){let t=D(e.id,{enabled:e.delegation?.role===`root`});return t.isSuccess&&t.data.workers.some(e=>ge(e.status))}function _n({run:e,open:t,onToggle:n}){let r=D(e.id),i=me(),s=we(),c=e.delegation,l=new Map(r.data?.workers.map(e=>[e.workerId,e])),u=mn(c,r.data),d=_(e)??p(e),f=d?vn(e,d):void 0;return(0,X.jsx)(pn,{slot:`workers`,icon:(0,X.jsx)(Ae,{className:`size-4`}),title:`Workers`,meta:yn({ids:u,workers:l,desktop:s,query:r}),aside:r.data?.capacity?(0,X.jsx)(En,{capacity:r.data.capacity}):void 0,open:t,onToggle:n,children:(0,X.jsxs)(`div`,{"aria-label":`Task relationships`,className:`min-w-0 text-[13px] text-muted-foreground`,role:`group`,children:[r.data?.capacity&&r.data.capacity.outstanding>=r.data.capacity.limit?(0,X.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`All worker slots are in use. Clean up finished workers to free a slot.`}):null,d?(0,X.jsx)(Cn,{wait:d,dependencyLabel:f}):null,u.length>0?(0,X.jsx)(`ul`,{className:`grid max-h-64 min-w-0 gap-0.5 overflow-y-auto`,children:u.map(t=>{let n=l.get(t),a=i.data?.find(e=>e.id===t)??r.data?.titles?.find(e=>e.id===t),s=n?xn(n.status):r.isSuccess?`Record unavailable or deleted`:`Status unavailable`;return(0,X.jsxs)(`li`,{"data-slot":`worker-item`,"data-status":n?.status,className:`min-w-0`,children:[(0,X.jsxs)(U,{to:`/tasks/${t}`,"aria-label":`Worker task ${t}`,className:`group flex min-h-11 min-w-0 items-center gap-2.5 rounded-md px-1 text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,X.jsx)(bn,{status:n?.status}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:a?O(a):`Worker ${t.slice(0,8)}`}),(0,X.jsx)(`span`,{className:o(`max-w-[45%] shrink-0 truncate text-xs`,Sn(n?.status)),children:s}),(0,X.jsx)(Me,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`})]}),n?(0,X.jsx)(On,{parentRunId:e.id,worker:n}):null,n?.destroy?(0,X.jsx)(An,{state:n.destroy}):null]},t)})}):c?.role===`root`&&r.isSuccess?(0,X.jsx)(`p`,{className:`px-1 py-1`,children:`No workers`}):null,r.fetchStatus===`paused`?(0,X.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Offline — relationship details will refresh when connected.`}):r.isPending?(0,X.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Loading relationships…`}):null,r.isError?(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-1 py-1`,children:[(0,X.jsx)(`p`,{role:`status`,children:`Could not load relationships. Known task links are retained.`}),(0,X.jsx)(a,{variant:`outline`,className:`min-h-11`,onClick:()=>void r.refetch(),children:`Retry relationships`})]}):null]})})}function vn(e,t){let n=e.delegation;if(!(!n||n.role===`invalid`))return f(e)??d(n.role,t,`requestIds`in t&&g(n,t.requestIds))}function yn({ids:e,workers:t,desktop:n,query:r}){if(e.length===0)return r.isError?`Unavailable`:r.isPending?`Linking…`:`No workers`;let i=`${e.length} linked`;if(!n)return i;let a=new Map;for(let n of e){let e=t.get(n)?.status;e!==void 0&&a.set(e,(a.get(e)??0)+1)}return[i,...[...a.entries()].map(([e,t])=>`${t} ${e}`)].join(` · `)}function bn({status:e}){let t=`size-[15px] shrink-0`;return e===`done`?(0,X.jsx)(Pe,{"aria-hidden":!0,className:o(t,`text-success`)}):e===`failed`?(0,X.jsx)(Fe,{"aria-hidden":!0,className:o(t,`text-danger`)}):e===`cancelled`?(0,X.jsx)(Ie,{"aria-hidden":!0,className:o(t,`text-soft-foreground`)}):e===`running`||e===`waiting`||e===`review`?(0,X.jsx)(We,{role:`status`,"aria-label":`Worker running`,className:o(t,`animate-spin stroke-pending motion-reduce:animate-none`)}):(0,X.jsx)(Le,{"aria-hidden":!0,className:o(t,`text-soft-foreground`)})}function xn(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function Sn(e){return e===`done`?`text-success`:e===`failed`?`text-danger`:`text-muted-foreground`}function Cn({wait:e,dependencyLabel:t}){return(0,X.jsxs)(`p`,{className:`px-2 break-words`,children:[e.phase===`parked`&&t?`${t.charAt(0).toUpperCase()}${t.slice(1)}`:`requestIds`in e&&e.requestIds?e.phase===`parked`?`Waiting on request replies`:e.phase===`wake-pending`?`Conversation update queued for this task`:`Request wait registered — the agent is finishing its turn`:e.phase===`parked`?`Waiting on workers`:e.phase===`wake-pending`?`Worker update queued for the parent`:`Worker wait registered — the agent is finishing its turn`,`.`,`deadline`in e?(0,X.jsxs)(X.Fragment,{children:[` `,`Deadline: `,(0,X.jsx)(`time`,{dateTime:e.deadline,children:e.deadline})]}):` No deadline: ${n(`Cezar`)} wakes this task when they have all settled.`]})}function wn(e){return e.delegation?.role===`worker`&&p(e)?.phase===`wake-pending`}function Tn({run:e}){let t=p(e);return e.delegation?.role===`worker`&&t?.phase===`wake-pending`?(0,X.jsx)(Cn,{wait:t,dependencyLabel:d(`worker`,t)}):null}function En({capacity:e}){return(0,X.jsxs)(`span`,{"data-slot":`worker-capacity`,role:`status`,"aria-label":`Worker capacity: ${e.outstanding} of ${e.limit} in use`,className:`ms-auto shrink-0 whitespace-nowrap text-[13px] font-normal text-muted-foreground tabular-nums`,children:[e.outstanding,` of `,e.limit,` in use`]})}var Dn=new Set([`review`,`done`,`failed`,`cancelled`]);function On({parentRunId:e,worker:t}){let n=he(e),[r,i]=(0,Y.useState)(!1);if(!Dn.has(t.status)||t.destroy?.phase===`complete`&&t.destroy.remaining.length===0)return null;let o=t.workerId.slice(0,8),s=!!t.destroy&&t.destroy.phase!==`complete`;return(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 px-1`,children:[r?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`break-words text-xs`,children:`Removes this worker's worktree and branch. Its result is saved first.`}),(0,X.jsx)(a,{variant:`danger-ghost`,size:`sm`,className:`min-h-11`,"aria-label":`Confirm clean up of worker ${o}`,onClick:()=>{i(!1),n.mutate(t.workerId)},children:`Clean up`}),(0,X.jsx)(a,{variant:`outline`,size:`sm`,className:`min-h-11`,onClick:()=>i(!1),children:`Cancel`})]}):(0,X.jsx)(a,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":s?`Retry clean up of worker ${o}`:`Clean up worker ${o}`,disabled:n.isPending,onClick:()=>i(!0),children:n.isPending?`Cleaning up…`:s?`Retry clean up`:`Clean up`}),n.isError&&!r?(0,X.jsxs)(`span`,{role:`status`,className:`break-words text-xs`,children:[`Cleanup did not finish: `,n.error.message]}):null]})}function kn(e){return e!==void 0&&(e.phase!==`complete`||e.remaining.length>0||e.error!==void 0)}function An({state:e}){if(!kn(e))return null;let t=e.phase===`complete`?void 0:e.retry,n=t&&(0,X.jsx)(jn,{at:t.nextAt});return(0,X.jsxs)(`p`,{className:`px-2 pb-2 break-words`,children:[t?.needsAttention?`Cleanup needs attention`:e.phase===`incomplete`?`Cleanup incomplete`:e.phase===`complete`?`Cleanup complete`:`Cleanup ${e.phase}`,e.remaining.length?` — remaining: ${e.remaining.join(`, `)}`:``,e.error?` — ${t?e.error.replace(/\.$/,``):e.error}`:``,t?.needsAttention?(0,X.jsxs)(X.Fragment,{children:[`. Nothing changed after `,t.attempts,` automatic attempts; checking hourly, next check `,n,`. Retry clean up to try now.`]}):t?(0,X.jsxs)(X.Fragment,{children:[`. Retrying automatically, next attempt `,n,`.`]}):null]})}function jn({at:e}){let t=bt(3e4);return(0,X.jsx)(`time`,{dateTime:e,title:new Date(e).toLocaleString(),children:At(t,Date.parse(e))})}function Mn({id:e}){return(0,X.jsxs)(U,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,"data-slot":`mobile-parent-task-link`,className:`inline-flex shrink-0 items-center justify-center gap-1 rounded-sm px-2 text-[13px] text-muted-foreground [min-block-size:2.75rem] [min-inline-size:2.75rem] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:bg-muted active:text-foreground`,children:[(0,X.jsx)(j,{"aria-hidden":!0,className:`shrink-0 [block-size:1.2cap] [inline-size:auto]`}),`Parent`]})}function Nn({id:e}){let t=de(e),n=t.data?O(t.data):e;return(0,X.jsxs)(`div`,{"data-slot":`parent-task`,className:`flex min-w-0 flex-wrap items-center gap-x-2 text-[13px] text-muted-foreground`,children:[(0,X.jsxs)(U,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,title:`Parent · ${n}`,"data-slot":`parent-task-link`,className:`flex min-h-11 min-w-0 max-w-full items-center gap-2 rounded-sm text-muted-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:text-foreground`,children:[(0,X.jsx)(j,{"aria-hidden":!0,className:`h-[1.2cap] w-auto shrink-0`}),(0,X.jsx)(`span`,{className:`shrink-0`,children:`Parent`}),(0,X.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,X.jsx)(`span`,{className:`min-w-0 overflow-clip text-ellipsis whitespace-nowrap`,children:n})]}),t.isError?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:`Parent record unavailable or deleted`}),(0,X.jsx)(a,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry parent task`})]}):null]})}var Pn=3,Fn=(e,t)=>e.kind===t.kind&&e.number===t.number;function In(e,t,n=Pn){let r=t?e.findIndex(e=>Fn(e,t)):-1;if(e.length<=n||r<n)return{inline:e.slice(0,n),overflow:e.slice(n)};let i=[...e.slice(0,n-1),e[r]];return{inline:i,overflow:e.filter(e=>!i.includes(e))}}var Ln=(e,t)=>`/tasks/${e}/${t.kind}/${t.number}`;function Rn({tab:e}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(e.kind===`pr`?je:Re,{"aria-hidden":`true`,className:`mr-1 size-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`sr-only`,children:e.kind===`pr`?`Pull request`:`Issue`}),` #`,e.number,(0,X.jsx)(Je,{kind:e.kind===`pr`?`PR`:`Issue`,number:e.number,className:`ml-1`})]})}function zn(e,t){let n=e[0],r=e.length+ +!!t;return n?`Preview :${n.port}${r>1?` +${r-1}`:``}`:t?`Preview · agent`:`Preview`}function Bn({servers:e}){let t=pt();if(t===null)return null;let n=t.agentLive===!0,r=e[0],i=e.length+ +!!n===1?r?{port:r.port}:{agent:!0}:{};return(0,X.jsxs)(a,{variant:`outline`,size:`sm`,"data-slot":`preview-toggle`,className:`max-md:h-11`,"aria-pressed":t.open,onClick:()=>t.openPane(i),children:[(0,X.jsx)(He,{"aria-hidden":`true`}),zn(e,n),t.live?(0,X.jsx)(G,{tone:`success`,"aria-label":`Preview is live`}):null]})}function Vn(e){return e?.role===`worker`?`Worker session`:e?.role===`root`?`Parent session`:`Task session`}function Hn({run:e,compact:t=!1}){return e.delegation?.role===`worker`?t?(0,X.jsx)(Mn,{id:e.delegation.parentRunId}):(0,X.jsx)(Nn,{id:e.delegation.parentRunId}):null}function Un(e,t,n,r){return!e.archiveBlocker&&t.archive&&(n!==`session`||!Nt(e,r))?(0,X.jsx)(Z,{run:e}):null}function Wn({run:e}){return e.archived&&e.autoArchive?.reason===`pull-requests-merged`&&e.autoArchive.archivedAt===e.archivedAt?(0,X.jsx)(`p`,{"data-slot":`auto-archive-reason`,className:`text-[13px] text-muted-foreground`,children:`Archived automatically after all associated PRs merged.`}):null}function Gn({shown:e,run:t,archiveButton:n,previewToggle:r}){let i=on(t);return e&&(n||r||i)?(0,X.jsxs)(`div`,{"data-slot":`run-mobile-actions`,className:`flex flex-wrap items-center gap-2 pt-2`,children:[n,r,(0,X.jsx)(sn,{run:t})]}):null}function Kn({run:e,tab:t,activeItem:n,inlineItemTabs:r,overflowItemTabs:i,phoneBar:a,isDesktop:o}){let s=(0,Y.useRef)(null),c=n?`${n.kind}#${n.number}`:null;return(0,Y.useEffect)(()=>{!c||o||s.current?.querySelector(`[aria-current="page"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[c,r.map(e=>`${e.kind}#${e.number}`).join(`,`),o]),(0,X.jsxs)(`div`,{ref:s,"data-slot":`run-tabs`,"data-phone-bar":a||void 0,className:`mt-3 flex flex-wrap items-end gap-1 border-b border-border md:mt-5 max-md:flex-nowrap max-md:overflow-x-auto max-md:border-b-0 max-md:shadow-[inset_0_-1px_0_var(--border)] max-md:gap-0 max-md:[&>*]:mb-0 max-md:[&>*]:shrink-0 max-md:[&>a]:min-h-11 max-md:[&>a]:px-3.5 max-md:[&>a]:text-[13.5px]`,children:[(0,X.jsx)(J,{to:`/tasks/${e.id}`,active:t===`session`,replace:a,children:`Session`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/changes`,active:t===`changes`,replace:a,count:e.diffStat&&e.diffStat.files>0?e.diffStat.files:void 0,children:`Changes`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/commits`,active:t===`commits`,replace:a,children:`Commits`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/files`,active:t===`files`,replace:a,children:`Files`}),r.map(t=>(0,X.jsx)(J,{to:Ln(e.id,t),active:n!==null&&Fn(t,n),replace:a,children:(0,X.jsx)(Rn,{tab:t})},`${t.kind}-${t.number}`)),i.length>0?(0,X.jsxs)(H,{children:[(0,X.jsxs)(B,{"data-slot":`run-tabs-more`,"aria-label":`${i.length} more linked items`,className:`-mb-px flex h-8 items-center rounded-t-md border-b-2 border-transparent px-3 text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground max-md:min-h-11 max-md:px-3.5 max-md:text-[13.5px]`,children:[`+`,i.length]}),(0,X.jsx)(V,{align:`end`,children:i.map(t=>(0,X.jsx)(L,{asChild:!0,children:(0,X.jsx)(U,{to:Ln(e.id,t),replace:a,children:(0,X.jsx)(Rn,{tab:t})})},`${t.kind}-${t.number}`))})]}):null]})}function qn({run:e,tab:t=`session`,onMarkedUnread:n}){let r=ee(e),i=K(e),a=gn(e),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(!1),d=Jn(e,n),f=me(),p=oe(),m=qt(e,{queuePosition:e.status===`queued`?_e(f.data??[]).get(e.id):void 0}),h=at(),g=lt(),_=h!==null&&!g?h:null,v=_!==null,{referenceProjectId:te,repoBase:y,requests:ne}=Xt(e),re=(0,Y.useMemo)(()=>ke(e,y),[e,y]),b=typeof t==`object`?t:null,{inline:ie,overflow:ae}=In(re,b),x=p.data?.capabilities?.preview===!0,S=e.worktreePath&&x?(0,X.jsx)(Bn,{servers:e.previewServers??[]}):null,C=(0,X.jsx)(Qn,{run:e,actions:d,onOpenChooser:()=>u(!0),onToggleNotes:()=>c(e=>!e)}),w=Un(e,i,t,a);return(0,X.jsx)(qe,{projectId:te,repoBase:y,requests:ne,children:(0,X.jsxs)(`header`,{"data-slot":`run-header`,className:o(`relative z-20 bg-background px-[18px] md:px-9 md:pt-7`,v?`pt-0`:`pt-[18px]`,t===`session`&&`md:sticky md:top-0`),children:[(0,X.jsx)(Wn,{run:e}),(0,X.jsx)(Gt,{run:e}),(0,X.jsxs)(`div`,{className:`w-full`,children:[(0,X.jsx)(Hn,{run:e}),_?(0,X.jsxs)(rt,{slot:_,children:[(0,X.jsx)(Zn,{run:e}),(0,X.jsx)(Hn,{run:e,compact:!0}),C]}):(0,X.jsxs)(`div`,{"data-slot":`run-title-row`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 md:flex-nowrap`,children:[(0,X.jsx)(`p`,{"data-slot":`session-kind`,className:`text-[12px] font-semibold tracking-[0.14em] text-muted-foreground uppercase md:hidden`,children:Vn(e.delegation)}),(0,X.jsx)(Xn,{run:e}),(0,X.jsx)(Dt,{dot:r.tone,shape:r.shape,pulse:r.pulse,className:`max-md:hidden`,children:Jt(m)}),(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[w,S,(0,X.jsx)(sn,{run:e}),C]})]}),(0,X.jsx)(Gn,{shown:_!==null,run:e,archiveButton:w,previewToggle:S}),(0,X.jsx)(Kn,{run:e,tab:t,activeItem:b,inlineItemTabs:ie,overflowItemTabs:ae,phoneBar:v,isDesktop:g}),s?(0,X.jsx)(tr,{runId:e.id,onClose:()=>c(!1)}):null,l?(0,X.jsx)(en,{run:e,canResume:K(e).terminal,onResume:()=>d.terminal.mutate(),onClose:()=>u(!1)}):null]}),(0,X.jsx)(er,{run:e,actions:d})]})})}function Jn(e,t){let n=re(),r=tt(),[i,a]=(0,Y.useState)(null),o=()=>n.invalidateQueries({queryKey:fe.runs.all}),s=e=>k(e.message,{tone:`danger`}),c=ie(),l={isPending:c.isPending,mutate:()=>c.mutate({id:e.id,pinned:!e.pinned})},u=S();return{pin:l,markUnread:{isPending:u.isPending,mutate:()=>{t?.(),u.mutate(e.id,{onError:s})}},delete:E({mutationFn:()=>y(e.id),onSuccess:()=>{o(),r(`/`)},onError:s}),terminal:Zt(e),confirming:i,setConfirming:a}}function Yn(e){let t=T(e.id),n=O(e);return{title:n,editor:Tt(n,e=>t.mutate({title:e},{onError:e=>k(e.message,{tone:`danger`})}))}}function Xn({run:e}){let{title:t,editor:n}=Yn(e);return n.editing?(0,X.jsx)(mt,{editor:n,className:`flex-1 text-[16px] font-semibold`}):(0,X.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,X.jsx)(`h1`,{className:`line-clamp-2 min-w-0 break-words text-2xl font-semibold tracking-tight`,title:e.task,children:t}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,onClick:n.begin,className:`shrink-0 rounded-sm p-1 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,X.jsx)(Ot,{className:`size-3.5`,"aria-hidden":`true`})})]})}function Zn({run:e}){let{title:t,editor:n}=Yn(e);return(0,X.jsxs)(De,{open:n.editing,onOpenChange:e=>{e?n.begin():n.commit()},children:[(0,X.jsx)(`div`,{"data-slot":`mobile-run-title`,className:`flex min-w-0 flex-1 flex-col gap-px`,children:(0,X.jsx)(`h1`,{className:`truncate text-[15px] leading-tight font-semibold text-foreground`,title:e.task,children:t})}),(0,X.jsx)(Te,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,className:`flex size-11 shrink-0 items-center justify-center rounded-sm text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,X.jsx)(Ot,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,X.jsx)(be,{align:`end`,className:`w-64 max-w-[calc(100vw-16px)] p-2`,onEscapeKeyDown:e=>{e.preventDefault(),n.cancel()},children:(0,X.jsx)(mt,{editor:n,className:`text-[16px] font-semibold`})})]})}function Qn({run:e,actions:t,onToggleNotes:n,onOpenChooser:r}){let i=K(e),o=W(e),s=T(e.id),c=(0,Y.useId)();return(0,X.jsxs)(H,{children:[(0,X.jsx)(B,{asChild:!0,children:(0,X.jsx)(a,{variant:`ghost`,size:`icon-sm`,className:`size-11`,"aria-label":`Run actions`,children:(0,X.jsx)(Ve,{"aria-hidden":`true`})})}),(0,X.jsxs)(V,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,children:[(0,X.jsx)(I,{className:`px-2 py-3 text-[12px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),(0,X.jsxs)(L,{onSelect:n,children:[(0,X.jsx)(St,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,X.jsx)(en,{run:e,canResume:i.terminal,onResume:()=>t.terminal.mutate(),onOpen:r}),o?(0,X.jsxs)(L,{onSelect:()=>void Q(o,`Command copied to clipboard.`),children:[(0,X.jsx)(N,{"aria-hidden":`true`}),` Copy resume command`]}):null,i.markUnread?(0,X.jsxs)(L,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,X.jsx)(Rt,{"aria-hidden":`true`}),` Mark unread`]}):null,i.pin?(0,X.jsxs)(z,{"data-slot":`pin-run`,className:`min-h-11`,checked:!!e.pinned,disabled:t.pin.isPending,onCheckedChange:()=>t.pin.mutate(),children:[e.pinned?(0,X.jsx)(zt,{"aria-hidden":`true`}):(0,X.jsx)(ze,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,(0,X.jsx)(R,{}),(0,X.jsx)(I,{className:`text-xs text-muted-foreground`,children:`AFTER DONE`}),(0,X.jsx)(z,{"data-slot":`archive-when-done`,className:`min-h-11`,checked:e.archiveWhenDone===!0,disabled:s.isPending,onCheckedChange:e=>s.mutate({archiveWhenDone:e},{onError:e=>k(e.message,{tone:`danger`})}),children:`Archive when Done`}),(0,X.jsx)(z,{"data-slot":`auto-merge-pr`,className:`min-h-11`,checked:e.autoMergePr===!0,disabled:s.isPending,"aria-describedby":c,onCheckedChange:e=>s.mutate({autoMergePr:e},{onError:e=>k(e.message,{tone:`danger`})}),children:`Auto-merge PR`}),(0,X.jsx)(`p`,{id:c,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block:0.5rem]`,children:`After Done, auto-merge can mark a draft PR ready. It waits for current-head CI and GitHub rules. Merge comes before archive.`}),e.delegation?.role===`worker`?null:(0,X.jsx)($n,{run:e,patch:s}),i.deleteRun?(0,X.jsx)(R,{}):null,i.deleteRun?(0,X.jsxs)(L,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,X.jsx)(Ne,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})}function $n({run:e,patch:t}){let r=(0,Y.useId)(),i=(0,Y.useId)(),a=(0,Y.useId)(),o=e=>k(e.message,{tone:`danger`});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(R,{}),(0,X.jsx)(I,{className:`text-xs text-muted-foreground`,children:`TASK ACCESS`}),(0,X.jsxs)(z,{"data-slot":`allow-workers`,className:`min-h-11`,checked:l(e),disabled:t.isPending,"aria-describedby":`${r} ${a}`,onCheckedChange:e=>t.mutate({allowWorkers:e},{onError:o}),children:[`Allow `,n(`cezar`),` workers`]}),(0,X.jsxs)(`p`,{id:r,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:[`Agents in this task can start `,n(`Cezar`),` workers. Each worker is a separate paid agent session. Worker limits cap resources, not spending.`]}),(0,X.jsx)(z,{"data-slot":`allow-messaging`,className:`min-h-11`,checked:h(e),disabled:t.isPending,"aria-describedby":`${i} ${a}`,onCheckedChange:e=>t.mutate({allowMessaging:e},{onError:o}),children:`Allow task messaging`}),(0,X.jsx)(`p`,{id:i,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can message other tasks in this project.`}),(0,X.jsx)(`p`,{id:a,"data-slot":`task-access-session-note`,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Turning one off applies at once. Turning one on reaches a running agent at its next session.`})]})}function er({run:e,actions:t}){let n=t.confirming;return(0,X.jsx)(kt,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,X.jsxs)(jt,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,X.jsxs)(Et,{children:[(0,X.jsx)(q,{className:`text-danger`,children:`Delete task permanently?`}),(0,X.jsx)(gt,{children:(0,X.jsxs)(X.Fragment,{children:[`Delete “`,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,title:O(e),children:O(e)}),`” and its transcript, worktree and branch. This cannot be undone.`]})})]}),(0,X.jsxs)(vt,{children:[(0,X.jsx)(Ct,{children:`Cancel`}),(0,X.jsx)(ht,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t.delete.mutate(),t.setConfirming(null)},children:`Delete task`})]})]})})}function tr({runId:e,onClose:t}){let n=ue(e);return(0,X.jsxs)(`div`,{"data-slot":`notes-panel`,className:`my-5 rounded-xl border border-border bg-card p-6`,children:[(0,X.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,X.jsx)(`h2`,{className:`text-lg font-medium`,children:`Notes / handoff`}),(0,X.jsx)(a,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,X.jsx)(A,{})})]}),n.isPending?(0,X.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):n.isError?(0,X.jsx)(`p`,{className:`text-xs text-danger`,children:n.error.message}):n.data.trim().length>0?(0,X.jsx)(ln,{runId:e,children:(0,X.jsx)(It,{children:n.data})}):(0,X.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`}),(0,X.jsxs)(`div`,{className:`mt-4 flex gap-3`,children:[(0,X.jsx)(a,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void Q(n.data??``,`Notes copied`),children:`Copy notes`}),(0,X.jsx)(a,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{qt as _,kn as a,hn as c,ln as d,tn as f,Xt as g,Zt as h,Tn as i,pn as l,$t as m,An as n,wn as o,nn as p,_n as r,gn as s,qn as t,dn as u,Z as v};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{E as e,d as t,t as n}from"./button-DGwhwRuD.js";import{t as r}from"./react-runtime-CCIEwYL0.js";import{et as i,zr as a}from"./project-scope-context-Cb2B_LxQ.js";import{E as o,K as s,P as c,Z as l,Zt as u,k as d,mt as f,n as p}from"./queries-Bb9GjWMQ.js";import{S as m,tt as h,y as g}from"./use-desktop-tg8hhNdq.js";import{F as _,ot as v,p as y}from"./design-icons-B6-0w7Aw.js";import{t as b}from"./run-header-B2aqbtt8.js";import{u as x}from"./reference-chip-AYFrAylA.js";import{t as S}from"./project-router-BKoMKwmx.js";import{t as C}from"./centered-state-B5QmAy2y.js";import{E as w,T,on as E}from"./index-DgjX4EGJ.js";import{n as D,o as O,t as k}from"./use-hand-to-agent-state-CFQoeO76.js";var A=r(),j={issue:`Issue`,pr:`Pull request`};function M({kind:t}){let{id:n}=e(),r=f(n);return r.isPending?(0,A.jsx)(T,{kind:t}):r.isError?(0,A.jsx)(w,{tab:`github-item`,error:r.error}):(0,A.jsx)(N,{run:r.data,kind:t})}function N({run:t,kind:r}){let{n:i}=e(),a=Number(i),o=s(),u=l(),f=c(),p=u.isPending||f.isPending,m=g(t,o).some(e=>e.kind===r&&e.number===a),h=d(r,a,m);return(0,A.jsxs)(`div`,{"data-route":`task-github-item`,className:`flex min-h-full flex-col`,children:[(0,A.jsx)(b,{run:t,tab:{kind:r,number:a}}),m?(0,A.jsx)(V,{run:t,kind:r,number:a,repoBase:o,item:h}):p?(0,A.jsx)(T,{kind:r,number:a,heading:`h2`}):(0,A.jsx)(C,{icon:(0,A.jsx)(E,{size:16}),tone:`neutral`,heading:`h2`,title:`#${i} is not linked to this task`,subtitle:`Only the issues and pull requests this task references open here.`,actions:(0,A.jsx)(n,{asChild:!0,variant:`outline`,children:(0,A.jsx)(S,{to:`/tasks/${t.id}`,children:`Back to the session`})})})]})}function P(e,t){return e===`pr`&&t.data?.available===!0&&t.data.item!==null}function F(e,t,n,r){return e===`pr`?n?.[t]??r:r}function I({retry:e,kind:t,number:r}){return(0,A.jsx)(n,{variant:`outline`,disabled:e.isPending,onClick:()=>e.mutate(p.githubItem(t,r)),children:`Retry`})}function L({kind:e,number:t,error:n,retryButton:r}){return(0,A.jsx)(C,{icon:(0,A.jsx)(v,{size:16}),tone:`danger`,heading:`h2`,title:`Could not load ${j[e].toLowerCase()} #${t}`,subtitle:n.message,actions:r})}function R({run:e,kind:r,number:i,repoBase:a,reason:o,retryError:s,retryButton:c}){let l=r===`pr`?_:y,u=m(e,a).find(e=>e.kind===`PR`==(r===`pr`)&&e.number===i)?.url;return(0,A.jsx)(C,{icon:(0,A.jsx)(l,{size:16}),tone:`neutral`,heading:`h2`,title:`GitHub is unavailable`,subtitle:s?.message??o,actions:(0,A.jsxs)(A.Fragment,{children:[c,u&&t(u)?(0,A.jsx)(n,{asChild:!0,variant:`outline`,children:(0,A.jsxs)(`a`,{href:u,target:`_blank`,rel:`noopener noreferrer`,children:[`open on GitHub`,(0,A.jsx)(h,{"aria-hidden":`true`})]})}):null]})})}function z({label:e,repoBase:t}){return(0,A.jsx)(C,{icon:(0,A.jsx)(x,{}),tone:`neutral`,heading:`h2`,title:`${e} was not found in ${H(t)}`,subtitle:`It may have been deleted, or the number points at a different repository.`})}function B({kind:e,item:t,labelColors:n,checks:r}){return(0,A.jsx)(`div`,{className:`min-w-0 px-0.5 md:px-2`,children:(0,A.jsx)(O,{item:t,colors:n??{},checks:r,backLink:null,subNav:null,children:e===`issue`?(0,A.jsx)(U,{item:t},t.url):null})})}function V({run:e,kind:t,number:n,repoBase:r,item:s}){let c=a(),l=u({mutationFn:e=>i(t,n,{refresh:!0}),onSuccess:(e,t)=>c.setQueryData(t,e)}),d=P(t,s),f=o(d?[n]:[],d),p=f.data?.available?f.data.checks:void 0,m=`${j[t]} #${n}`,h=(0,A.jsx)(I,{retry:l,kind:t,number:n});if(s.isPending)return(0,A.jsx)(T,{kind:t,number:n,heading:`h2`});if(s.isError)return(0,A.jsx)(L,{kind:t,number:n,error:l.error??s.error,retryButton:h});let g=s.data;return g.available?g.item?(0,A.jsx)(B,{kind:t,item:g.item,labelColors:g.labelColors,checks:F(t,n,p,g.item.checks)}):(0,A.jsx)(z,{label:m,repoBase:r}):(0,A.jsx)(R,{run:e,kind:t,number:n,repoBase:r,reason:g.reason,retryError:l.error,retryButton:h})}function H(e){if(!e)return`this repository`;try{return new URL(e).pathname.split(`/`).filter(Boolean).slice(0,2).join(`/`)||`this repository`}catch{return`this repository`}}function U({item:e}){let t=k();return(0,A.jsx)(D,{item:e,workflows:t.workflows.data?.workflows??[],skills:t.skillList,workflow:t.workflow,onWorkflowChange:t.setWorkflow,selectedSkills:t.selectedSkills,onSkillsChange:t.setSelectedSkills,engine:t.engine,onEngineChange:t.setEngine,queuedRunId:t.queued.get(e.url)??null,onQueued:t.onQueued},e.url)}export{M as TaskGithubItemRoute};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,t as n,u as r}from"./button-DGwhwRuD.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{C as o,It as s,Zt as c,hr as l,nt as u,r as d,rt as f,zr as p}from"./project-scope-context-Cb2B_LxQ.js";import{Bt as m,Ct as h,Ft as g,M as _,O as v,Q as y,Zt as b,h as x,jt as S,n as C,tt as w}from"./queries-Bb9GjWMQ.js";import{t as T}from"./useQuery-BsOmvrd_.js";import{a as E,o as D,r as O,tt as k}from"./use-desktop-tg8hhNdq.js";import{n as A}from"./toaster-CoMJoQvk.js";import{Y as j,c as M,ct as N,ft as P,g as ee,it as F,k as I,l as L,m as R,ot as te,r as z,tt as ne,u as re,ut as ie,y as ae}from"./design-icons-B6-0w7Aw.js";import{t as oe}from"./eye-B8okNWXU.js";import{a as se,i as B}from"./format-BNCkW110.js";import{t as ce}from"./message-square-B-MD-8rD.js";import{t as le}from"./play-CmVAj_fu.js";import{a as ue,i as de,o as fe,r as pe,s as me,t as he}from"./dialog-tMSuX5a7.js";import{d as V,t as ge,y as H}from"./prompt-template-menu-BBSaimz3.js";import{t as U}from"./project-router-BKoMKwmx.js";import{_ as _e,a as ve,b as W,c as ye,d as be,f as xe,h as Se,n as Ce,p as we,r as Te,s as Ee,t as G,u as De,v as K,x as Oe,y as ke}from"./picker-pill-Bd3Q9PFA.js";import{d as Ae,f as q,i as je,o as Me,p as Ne,s as Pe,t as Fe,u as Ie}from"./skills-pM_PouEs.js";import{c as Le,d as Re,f as ze,h as Be,l as Ve,n as He,p as Ue,s as We,t as Ge}from"./agent-accounts-Ck78cTaG.js";import{F as Ke,L as qe,R as Je,V as Ye,mn as Xe}from"./index-DgjX4EGJ.js";import{t as Ze}from"./markdown-B0anEsMd.js";import{t as Qe}from"./diff-DpxnwWWi.js";import{t as $e}from"./tab-link-CekOt2NF.js";var J=e(i(),1),Y=a(),et={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function X({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,Y.jsx)(M,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:r(t,`text-success`)}):e===`failing`?(0,Y.jsx)(ee,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:r(t,`text-danger`)}):e===`pending`?(0,Y.jsx)(se,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:r(t,`animate-spin text-warning`)}):(0,Y.jsx)(R,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:r(t,`text-soft-foreground`)})}function tt(e){return e?.available?e.mergeState:null}function nt(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function rt(e){return e.state===`merged`?`Merged`:e.state===`closed`?`Closed`:e.isDraft?`Draft`:e.mergeable===`conflicting`?`Conflicts must be resolved`:e.canMerge?`Ready to merge`:e.eligibility===`unknown`?`Merge blocked · Requirements unknown`:`Merge blocked`}function it(e){return e===`approved`||e===`not-required`?`passing`:e===`unknown`?`unknown`:`failing`}function at(e){return e===`mergeable`?`passing`:e===`conflicting`?`failing`:`unknown`}function ot(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function st(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function ct(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function lt(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function Z(e){return e?et[e]:`Merge`}function ut(e){return e===`conflicting`?`true`:void 0}function dt({check:e}){return(0,Y.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(X,{state:e.state}),(0,Y.jsxs)(`span`,{children:[e.name,` · `,e.state,st(e.required)]})]}),e.url&&t(e.url)?(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function ft({reason:e}){return(0,Y.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,Y.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:e})]})}function pt({state:e,selectedMethod:t,overrideRules:i,mergeEnabled:a,refreshPending:o,onRefresh:s,onRunAgent:c,onConfirm:l,onMethodChange:u,onOverrideChange:d}){let f=rt(e),p=it(e.reviewDecision),m=at(e.mergeable);return(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,Y.jsx)(M,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,Y.jsx)(te,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsx)(`h3`,{className:`font-semibold`,children:f}),(0,Y.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,disabled:o,onClick:s,children:[(0,Y.jsx)(j,{size:16,"aria-hidden":`true`,className:r(`size-3.5`,o&&`animate-spin`)}),`Refresh`]})]}),(0,Y.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[e.headRef,` (`,e.headSha.slice(0,7),`) → `,e.baseRef]}),(0,Y.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,Y.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(X,{state:p}),(0,Y.jsxs)(`span`,{children:[`Reviews: `,e.reviewDecision.replaceAll(`-`,` `)]})]}),(0,Y.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(X,{state:m}),(0,Y.jsxs)(`span`,{children:[`Conflicts: `,ot(e.mergeable)]})]}),e.checks.length===0?(0,Y.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,Y.jsx)(dt,{check:e},e.name)),e.blockers.map(e=>(0,Y.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&c?(0,Y.jsx)(n,{className:`mt-4`,onClick:c,children:`Run agent on this PR`}):null,e.canOverride?(0,Y.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-warning/40 bg-warning/5 p-3 text-xs`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>d(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,Y.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,e.eligibility===`unknown`?(0,Y.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`GitHub could not confirm review and branch-protection requirements. Passing checks do not establish merge readiness.`}):null,e.state===`open`&&e.methods.length>0?(0,Y.jsxs)(`div`,{className:`mt-4 flex flex-col flex-wrap gap-2 sm:flex-row`,children:[(0,Y.jsx)(`select`,{"aria-label":`Merge method`,value:t??``,onChange:e=>u(e.target.value),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm`,children:e.methods.map(e=>(0,Y.jsx)(`option`,{value:e,children:et[e]},e))}),(0,Y.jsx)(n,{disabled:!a,onClick:l,children:Z(t)})]}):null]})]})}function mt({number:e,state:t,selectedMethod:r,confirming:i,overrideRules:a,mergePending:o,mergeError:s,onOpenChange:c,onMerge:l}){return(0,Y.jsx)(he,{open:i,onOpenChange:c,children:(0,Y.jsxs)(pe,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,Y.jsxs)(fe,{children:[(0,Y.jsxs)(me,{children:[Z(r),` pull request #`,e,`?`]}),(0,Y.jsx)(de,{asChild:!0,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`p`,{children:[`This will merge “`,t.title,`” into `,t.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),a&&t.canOverride?(0,Y.jsx)(`p`,{"data-slot":`gh-bypass-warning`,className:`mt-4 text-sm text-warning`,children:`You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`}):null]})})]}),s?(0,Y.jsx)(`p`,{className:`text-sm text-danger`,children:s.message}):null,(0,Y.jsxs)(ue,{children:[(0,Y.jsx)(n,{variant:`outline`,disabled:o,onClick:()=>c(!1),children:`Cancel`}),(0,Y.jsx)(n,{disabled:o,onClick:l,children:o?`Merging…`:Z(r)})]})]})})}function ht({number:e,onRunAgent:t}){let n=p(),r=w(),i=T({queryKey:C.githubMergeState(e),queryFn:({signal:t})=>f(e,{},{signal:t}),retry:!1}),a=tt(i.data),[o,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(!1),[d,m]=(0,J.useState)(!1),h=b({mutationFn:t=>f(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>A(e instanceof Error?e.message:String(e),{tone:`danger`})}),g=nt(o,a),_=()=>({mergeState:C.githubMergeState(e),list:C.githubPages(50),comments:C.githubComments(`pr`,e),item:C.githubItem(`pr`,e),refStatus:r===void 0?void 0:C.githubRefStatusOf(r)}),v=b({mutationFn:t=>{if(!a||!g)throw Error(`No merge method is available.`);return s(e,{method:g,expectedHeadSha:a.headSha,...d&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{u(!1),A(`Pull request #${e} merged`),n.invalidateQueries({queryKey:r.mergeState}),n.invalidateQueries({queryKey:r.list}),n.invalidateQueries({queryKey:r.comments}),n.invalidateQueries({queryKey:r.item}),r.refStatus&&n.invalidateQueries({queryKey:r.refStatus})},onError:(e,t)=>{A(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,Y.jsx)(H,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,Y.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":ut(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,Y.jsx)(pt,{state:a,selectedMethod:g,overrideRules:d,mergeEnabled:lt(g,a,d),refreshPending:h.isPending,onRefresh:()=>h.mutate(C.githubMergeState(e)),onRunAgent:t,onConfirm:()=>u(!0),onMethodChange:c,onOverrideChange:m}),(0,Y.jsx)(mt,{number:e,state:a,selectedMethod:g,confirming:l,overrideRules:d,mergePending:v.isPending,mergeError:v.error,onOpenChange:u,onMerge:()=>v.mutate(_())})]}):(0,Y.jsx)(ft,{reason:ct(i.data)})}function gt(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function _t(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))||t.assignees?.length&&!e.assignees?.some(e=>t.assignees.some(t=>t.toLowerCase()===e.toLowerCase()))||t.author!==void 0&&e.author.toLowerCase()!==t.author.toLowerCase()||t.includeNumbers&&!t.includeNumbers.has(e.number)||t.excludeNumbers?.has(e.number)||t.projectId&&e.projectIds!==void 0&&!e.projectIds.includes(t.projectId)?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body??``}`.toLowerCase().includes(n))}function vt(e,t){let n=e.trim();if(n===``)return!1;let r=n.replace(/^#/,``);return/^\d+$/.test(r)?!t.some(e=>e.number===Number(r)):t.length===0}function Q(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}function yt({label:e,color:t,plain:n=!1}){return(0,Y.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:Q(t),className:n?`text-[11px] font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[12px] font-medium`,children:e})}function bt(e){return e===`pr`?`pull request`:`issue`}function xt(e,t,n){return e===`pr`&&!!(t||n)}function St({backLink:e}){return e?(0,Y.jsxs)(U,{to:e.to,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,Y.jsx)(z,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}):null}function Ct({item:e,kindWord:n,commentCount:r,hasDiffStat:i,additions:a,deletions:o}){return(0,Y.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,Y.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,Y.jsx)(`span`,{children:n}),`·`,(0,Y.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Y.jsxs)(`span`,{children:[B(e.createdAt),` ago`]}),r?(0,Y.jsxs)(Y.Fragment,{children:[`·`,(0,Y.jsx)(qt,{count:r})]}):null,i?(0,Y.jsxs)(Y.Fragment,{children:[`·`,(0,Y.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,a??0]}),` `,(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,o??0]})]})]}):null,`·`,t(e.url)?(0,Y.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Y.jsx)(k,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Y.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]})}function wt({item:e,subNav:t,changes:n}){return e.kind===`pr`?t?(0,Y.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,Y.jsx)($e,{to:V(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,Y.jsx)($e,{to:V(`prs`,t.filter,e.number,`/changes`),active:n,children:`Changes`})]}):(0,Y.jsx)(U,{to:V(`prs`,null,e.number,`/changes`),"data-slot":`gh-files-changed`,className:`mt-3 inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground hover:underline`,children:`Files changed`}):null}function Tt({item:e,colors:t,checks:n}){return e.labels.length>0||n?(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Y.jsx)(yt,{label:e,color:t[e]},e)),n?(0,Y.jsx)(Jt,{checks:n,url:e.url}):null]}):null}function Et({item:e,colors:t,body:n}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:n?(0,Y.jsx)(Ze,{children:n}):(0,Y.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,Y.jsx)(kt,{item:e,colors:t})]})}function Dt({item:e,colors:t,checks:n,comments:r,backLink:i,subNav:a,onRunAgent:o,afterHeading:s,children:c}){let l=a?.changes??!1,u=bt(e.kind),d=v(e.kind,e.number,!l).data?.detail,f=d?.body??e.body,p=d?.additions??e.additions,m=d?.deletions??e.deletions,h=xt(e.kind,p,m),g=r??e.comments;return(0,Y.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Y.jsx)(St,{backLink:i}),(0,Y.jsxs)(`div`,{"data-slot":`gh-description-card`,className:e.kind===`pr`?`rounded-xl border border-border bg-card p-6`:void 0,children:[e.kind===`pr`?(0,Y.jsxs)(`h2`,{className:`mb-4 text-[22px] leading-snug font-normal`,children:[`#`,e.number,` `,e.title]}):null,(0,Y.jsx)(Ct,{item:e,kindWord:u,commentCount:g,hasDiffStat:h,additions:p,deletions:m}),e.kind===`pr`?null:(0,Y.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-normal`,children:e.title}),s,(0,Y.jsx)(wt,{item:e,subNav:a,changes:l}),(0,Y.jsx)(Tt,{item:e,colors:t,checks:n}),l&&e.kind===`pr`?(0,Y.jsx)(Ot,{item:e}):(0,Y.jsx)(Et,{item:e,colors:t,body:f})]}),e.kind===`pr`?(0,Y.jsx)(ht,{number:e.number,onRunAgent:o}):null,c]})}function Ot({item:e}){let i=p(),a=_(e.number),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(null),d=a.data,f=d?.available?d.files.filter(e=>e.path.toLowerCase().includes(o.toLowerCase())):[],m=f.findIndex(e=>e.path===c);(0,J.useEffect)(()=>{f.length>0&&!f.some(e=>e.path===c)&&l(f[0].path)},[d?.available?d.headSha:``,o]);let h=async()=>{let t=d?.available?d.headSha:null,n=C.githubPrChanges(e.number),r=await u(e.number,{refresh:!0});i.setQueryData(n,r),r.available&&t&&t!==r.headSha&&(l(r.files[0]?.path??null),A(`The reviewed revision changed.`))};if(a.isPending)return(0,Y.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(a.isError||!d)return(0,Y.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!d.available)return(0,Y.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:d.reason});let g=f.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),v=t(e.url)?`${e.url}/files`:null,y=f.find(e=>e.path===c);return(0,Y.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,Y.jsxs)(`strong`,{children:[d.files.length,` changed files`]}),(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,d.additions]}),(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,d.deletions]}),(0,Y.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:d.headSha,children:[`head `,d.headSha.slice(0,8)]}),(0,Y.jsx)(n,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void h(),children:`Refresh`})]}),d.truncated?(0,Y.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[d.reason??`This response is incomplete.`,` `,v?(0,Y.jsx)(`a`,{href:v,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,Y.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Y.jsxs)(`aside`,{className:`min-w-0`,children:[(0,Y.jsx)(`input`,{"aria-label":`Filter changed files`,value:o,onChange:e=>s(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,Y.jsx)(`select`,{"aria-label":`Select changed file`,value:c??``,onChange:e=>l(e.target.value),className:`mt-2 min-h-11 w-full rounded-md border border-input bg-background px-2 text-sm lg:hidden`,children:f.map(e=>(0,Y.jsx)(`option`,{children:e.path},e.path))}),(0,Y.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:f.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>l(e.path),className:r(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,c===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,Y.jsx)(n,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:m<=0,onClick:()=>l(f[m-1]?.path??null),children:(0,Y.jsx)(Xe,{})}),(0,Y.jsx)(n,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:m<0||m>=f.length-1,onClick:()=>l(f[m+1]?.path??null),children:(0,Y.jsx)(re,{size:16})})]}),f.length===0?(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Qe,{files:g.filter(e=>e.path===c),wrap:!0,className:`min-w-0`}),y&&!y.patch?(0,Y.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,y.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function kt({item:e,colors:t}){let n=v(e.kind,e.number),r=n.data,i=(0,J.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(At(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,Y.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Y.jsx)(H,{className:`mb-3 h-3 w-24`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsx)(H,{className:`h-14 w-full`}),(0,Y.jsx)(H,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Y.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,Y.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Y.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Y.jsx)(k,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Y.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Y.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-soft-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,Y.jsx)(`ul`,{className:`flex flex-col gap-5`,children:jt(i).map(e=>e.group===`commits`?(0,Y.jsx)(Mt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Y.jsx)(Ut,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Y.jsx)(Pt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Y.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-soft-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,Y.jsx)(k,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var At=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function jt(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function Mt({commits:e,colors:t}){let[n,r]=(0,J.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:Nt.committed}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Y.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Y.jsx)(Pt,{event:e,colors:t},e.id))]}):(0,Y.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:Nt.committed}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Y.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Y.jsx)(`span`,{className:`shrink-0`,children:B(e[e.length-1].createdAt)})]})})}var Nt={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Pt({event:e,colors:t}){return(0,Y.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:r(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:Nt[e.kind]}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Y.jsx)(Bt,{event:e,colors:t}),(0,Y.jsx)(`span`,{className:`shrink-0`,children:B(e.createdAt)}),e.url?(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Y.jsx)(k,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Ft({event:e}){return(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,Y.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,Y.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,Y.jsx)(Vt,{checks:e.checks})]})}function It({event:e,colors:t}){return(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,Y.jsx)(`span`,{"data-slot":`gh-event-label`,style:Q(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[12px]`,children:e.label.name}):null,(0,Y.jsx)(`span`,{className:`shrink-0`,children:`label`})]})}function Lt({event:e}){return(0,Y.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Rt({event:e}){return(0,Y.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var zt={committed:e=>(0,Y.jsx)(Ft,{event:e}),labeled:(e,t)=>(0,Y.jsx)(It,{event:e,colors:t}),unlabeled:(e,t)=>(0,Y.jsx)(It,{event:e,colors:t}),assigned:e=>(0,Y.jsx)(Lt,{event:e}),unassigned:e=>(0,Y.jsx)(Lt,{event:e}),merged:()=>(0,Y.jsx)(`span`,{children:`merged this`}),closed:()=>(0,Y.jsx)(`span`,{children:`closed this`}),reopened:()=>(0,Y.jsx)(`span`,{children:`reopened this`}),head_ref_force_pushed:()=>(0,Y.jsx)(`span`,{children:`force-pushed`}),renamed:e=>(0,Y.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]}),"cross-referenced":e=>(0,Y.jsx)(Rt,{event:e})};function Bt({event:e,colors:t}){return zt[e.kind]?.(e,t)??null}function Vt({checks:e}){return e?(0,Y.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:r(`shrink-0`,Kt[e]),children:Gt[e]}):null}var Ht={approved:{label:`approved`,tone:`border-success/40 text-success`},changes_requested:{label:`changes requested`,tone:`border-danger/40 text-danger`},commented:{label:`commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`dismissed`,tone:`border-border text-muted-foreground`}};function Ut({comment:e}){let t=e.reviewState?Ht[e.reviewState]:null;return(0,Y.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,Y.jsx)(Wt,{url:e.avatarUrl,login:e.author}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Y.jsx)(`span`,{children:B(e.createdAt)}),t?(0,Y.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:r(`rounded-full border px-1.5 py-px font-sans text-[12px] font-medium`,t.tone),children:t.label}):null,(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Y.jsx)(k,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Y.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,Y.jsx)(Ze,{children:e.body}):(0,Y.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function Wt({url:e,login:t}){let[n,r]=(0,J.useState)(!1);return e&&!n?(0,Y.jsx)(`img`,{src:e,alt:``,width:16,height:16,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-4 shrink-0 rounded-full`}):(0,Y.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var Gt={passing:`✓`,failing:`✗`,pending:`○`},Kt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function qt({count:e}){return e?(0,Y.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,Y.jsx)(ce,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Jt({checks:e,url:t}){let n=r(`text-[11px] font-medium`,Kt[e],t&&`hover:underline`),i=`${Gt[e]} checks ${e}`;return t?(0,Y.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:i}):(0,Y.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:i})}function Yt({checks:e}){return(0,Y.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:r(`shrink-0 font-sans text-[11px] font-semibold`,Kt[e]),children:Gt[e]})}function Xt(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function Zt(e,t=[]){let n=Xt(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=Qt(t)),n}function Qt(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function $t(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function en(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function tn(e,t,n){let r=(n??``).trim();if(!r)return Zt(e,t);let i=Xt(e),a=r.startsWith(i)?i+$t(r.slice(i.length),e):$t(r,e),o=en(a,e)?a:`${i}\n\n${a}`;return t.length?o+Qt(t):o}function nn(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function rn(e,t,n,r,i={}){return t?{...i,workflow:t,task:tn(e,n.map(e=>e.id),r)}:n.length?{...i,steps:nn(n.map(e=>e.id)).map((e,t)=>({...e,...n[t]?.path===void 0?{}:{skillPath:n[t].path}})),task:tn(e,[],r)}:{...i,workflow:`quick-task`,task:tn(e,[],r)}}function an(e){let t=y(),n=x(),r=l(t.data),i=n.data?.defaultRunner,a=Ue(e.runner,r,i??r[0]??`claude`),o=h(a),s=n.data?.modelsLocked===!0,{accounts:c,repoAccount:u}=He(),d=c.some(t=>t.provider===a&&t.id===e.account)?e.account:null,f=ze(s?null:e.model,a,n.data?.defaultModels,o.data),p=We(a,f,o.data);return{runner:a,runnerExplicit:e.runner!==null,model:f,effort:s?``:Re(e.effort,p),effortOptions:p,runners:r,defaultRunner:i,canRun:t.isSuccess&&r.length>0,modelsLocked:s,providerPending:t.isPending,providerError:t.isError,accounts:c,account:d,repoAccount:u}}function on(e){return{runner:Be(e.runner,e.defaultRunner,e.runnerExplicit),model:e.modelsLocked?void 0:e.model||void 0,effort:e.modelsLocked?void 0:e.effort||void 0}}function sn(e){return{...on(e),...e.account?{agentProfile:e.account}:{}}}function cn({pick:e,onChange:t,disabled:n=!1,accounts:r=!1,layout:i}){let a=(0,J.useRef)(null),o=(0,J.useRef)(null),[s,c]=(0,J.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,J.useLayoutEffect)(()=>{let e=a.current;if(i!==`row`||!e)return;let t=()=>{let t=window.innerWidth<=767||e.getBoundingClientRect().width<550,n=document.activeElement;o.current=n instanceof HTMLElement&&e.contains(n)?n:null,c(t)};t();let n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[i]),(0,J.useLayoutEffect)(()=>{let e=o.current;o.current=null,e&&e.isConnected&&document.activeElement!==e&&e.focus()},[s]);let l=an(e),{runner:u,model:d,effort:f,effortOptions:p,runners:m,canRun:g,modelsLocked:_}=l,v=x(),y=h(u),b=Ve(u,y.data,[e.model,v.data?.defaultModels?.[u]]),S=n||!g,C=r?l.accounts:[],w=m.length>1||m.some(e=>Ge(C,e))?(0,Y.jsx)(Te,{icon:(0,Y.jsx)(F,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:m,value:u,accounts:C,account:r?l.account:null,repoAccount:r?l.repoAccount:void 0,disabled:S,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===u?e.model:null,effort:e.effort}:{runner:n,account:null,model:null,effort:e.effort})},`runner`):null,T=(0,Y.jsx)(G,{icon:(0,Y.jsx)(ae,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:d===``?`Default`:b.find(e=>e.id===d).label,value:d,disabled:S,readOnly:_===!0,disabledHint:_?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=We(u,n,y.data);t({...e,model:n,effort:e.effort===null?null:Re(e.effort,r)})},options:b.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Le(u,y.data,y.isError,y.isFetching)},`model`),E=(0,Y.jsx)(G,{icon:(0,Y.jsx)(I,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:p.find(e=>e.value===f)?.label??`auto`,value:f,disabled:S,readOnly:_===!0,disabledHint:_?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,effort:n}),options:p.map(e=>({value:e.value,label:e.label,desc:e.desc}))},`effort`);return i===`row`?(0,Y.jsx)(`div`,{ref:a,"data-slot":`engine-row-box`,children:(0,Y.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,Y.jsx)(Ce,{children:s?[w,E,T]:[w,T,E]})})}):(0,Y.jsxs)(Ce,{children:[w,T,E]})}var ln={workflow:null,skills:[]},un=`cez-followup-selection`;function dn(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.flatMap(e=>typeof e==`string`?[{id:e}]:!e||typeof e!=`object`||typeof e.id!=`string`?[]:[{id:e.id,...typeof e.path==`string`?{path:e.path}:{}}]):[]}}function fn(){try{let e=localStorage.getItem(un);return e?dn(JSON.parse(e)):{...ln}}catch{return{...ln}}}function pn(e){try{localStorage.setItem(un,JSON.stringify(e))}catch{}}var $=`cez-followup-prompt:`;function mn(e){try{return localStorage.getItem($+e)??``}catch{return``}}function hn(e,t){try{t===``?localStorage.removeItem($+e):localStorage.setItem($+e,t)}catch{}}function gn({item:e,workflows:r,skills:i,workflow:a,onWorkflowChange:s,selectedSkills:l,onSkillsChange:u,engine:d,onEngineChange:f,queuedRunId:h,onQueued:g}){let _=p(),v=S(),y=e.kind===`pr`?`PR`:`issue`,x=an(d),w=m(x.runner,x.account),T=l.filter(e=>w.unchecked||e.path===void 0||i.some(t=>t.id===e.id&&(e.path===void 0||t.path===e.path))),E=T.length!==l.length,[D]=(0,J.useState)(()=>Xt(e)),[O,k]=(0,J.useState)(()=>mn(e.url)||D),j=(0,J.useRef)(null),N=(0,J.useRef)(null);(0,J.useEffect)(()=>{hn(e.url,O===D?``:O)},[e.url,O,D]);let P=(0,J.useMemo)(()=>De(v.data?.promptTemplates),[v.data?.promptTemplates]),ee=e=>{let t=j.current,n=xe({prompt:O,base:D,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:N.current}),r=ye(O,n,e);k(r.text),N.current=r.caret,requestAnimationFrame(()=>{j.current?.focus(),j.current?.setSelectionRange(r.caret,r.caret)})},F=Ee(P,T.map(e=>e.id)),I=(0,J.useRef)(O);I.current=O;let L=(0,J.useRef)(``);(0,J.useEffect)(()=>{let e=be(I.current,L.current,F,D);L.current=e.applied,e.text!==I.current&&k(e.text)},[F,D]);let R=b({mutationFn:async()=>!x.canRun||E?null:o(rn(e,a,T,O,sn(x))),onSuccess:t=>{if(t===null)return;let n=t;n&&g(e.url,n.id),A(`Added to the queue — ${y} #${e.number}`),T.length>0&&v.data!==void 0&&c({skillUsage:T.reduce((e,t)=>Fe(e,t.id),v.data.skillUsage)}).then(()=>_.invalidateQueries({queryKey:C.uiState})).catch(()=>{}),hn(e.url,``),k(D),L.current=``,_.invalidateQueries({queryKey:C.runs.all})},onError:e=>A(e.message,{tone:`danger`})}),te=e=>{qe({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),!R.isPending&&x.canRun&&R.mutate())},z=e=>u(l.some(t=>q(t)===q(e))?l.filter(t=>q(t)!==q(e)):[...l,Pe(e)]);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Y.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,Y.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,Y.jsx)(`span`,{children:`Instructions for the agent`}),(0,Y.jsx)(Ye,{ref:j,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:O,onChange:e=>k(e.target.value),onSelect:e=>{N.current=e.currentTarget.selectionStart},onKeyDown:te,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,Y.jsx)(ge,{templates:P,onInsert:ee}),(0,Y.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,Y.jsxs)(`div`,{className:`gh-field`,children:[(0,Y.jsx)(`span`,{children:`Workflow`}),(0,Y.jsx)(vn,{workflows:r,value:a,onChange:s})]}),(0,Y.jsxs)(`div`,{className:`gh-field`,children:[(0,Y.jsx)(`span`,{children:`Skills · select one or more`}),(0,Y.jsx)(bn,{skills:i,skillUsage:v.data?.skillUsage,selected:l,onToggle:z})]}),l.length>0?(0,Y.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:l.map(e=>(0,Y.jsx)(_n,{skill:e,skills:i,unchecked:w.unchecked,onRemove:()=>z(e)},q(e)))}):null,E?(0,Y.jsx)(`p`,{role:`alert`,children:`A selected skill path is unavailable. Remove it or choose a current copy before starting.`}):null,(0,Y.jsx)(cn,{layout:`row`,pick:d,onChange:f,disabled:R.isPending||!x.canRun,accounts:!0}),(0,Y.jsxs)(`div`,{className:`gh-field`,children:[(0,Y.jsx)(`span`,{children:`Account`}),(0,Y.jsx)(yn,{resolved:x,disabled:R.isPending||!x.canRun,onPick:e=>f({...d,account:e})})]}),!x.providerPending&&!x.canRun?(0,Y.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[x.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,Y.jsx)(U,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,Y.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:[e.kind===`pr`?`PR`:`Issue`,` number and link remain attached to the task. Edit the prompt before starting. Cmd/Ctrl+Enter submits; Enter adds a new line.`]})]}),(0,Y.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[t(e.url)?(0,Y.jsx)(n,{asChild:!0,variant:`outline`,children:(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,Y.jsxs)(n,{variant:`primary`,"data-action":`gh-run`,disabled:R.isPending||!x.canRun||E,onClick:()=>R.mutate(),children:[(0,Y.jsx)(le,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,y]}),(0,Y.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[11px] font-medium text-muted-foreground`,children:Je()}),h?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Y.jsx)(M,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Y.jsx)(U,{to:`/tasks/${h}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function _n({skill:e,skills:t,unchecked:n,onRemove:r}){let i=t.find(t=>t.id===e.id&&(e.path===void 0||t.path===e.path)),a=[i?.name??e.id,e.path].filter(Boolean).join(` · `),o=!n&&e.path!==void 0&&!i?` (unavailable)`:n||!i?` (unchecked)`:``;return(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e.id,onClick:r,title:`Remove skill ${a}`,"aria-label":`Remove skill ${a}`,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[a,o,(0,Y.jsx)(P,{size:16,"aria-hidden":`true`,className:`size-3`})]})}function vn({workflows:e,value:t,onChange:n}){let[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(``),c=(0,J.useRef)(null),l=Ae(e,o);return(0,Y.jsxs)(O,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Y.jsx)(D,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:r(ve,t&&`border-foreground/60 font-mono text-[11px] font-semibold text-foreground`),children:[(0,Y.jsx)(ie,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,Y.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,Y.jsx)(L,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Y.jsx)(E,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Y.jsxs)(Se,{shouldFilter:!1,children:[(0,Y.jsx)(ke,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,Y.jsxs)(Oe,{ref:c,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,Y.jsx)(_e,{children:`Nothing matches.`}):null,(0,Y.jsx)(K,{children:l.map(e=>{let r=t===e.name;return(0,Y.jsxs)(W,{value:`workflow ${e.name}`,keywords:Ne(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,Y.jsx)(M,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function yn({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:we,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,desc:e.configDir}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,Y.jsx)(G,{icon:(0,Y.jsx)(N,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),slot:`account-pill`,ariaLabel:`Account`,label:i.find(e=>e.value===a)?.label??`Default`,value:a,options:i,disabled:t,onPick:n})}function bn({skills:e,skillUsage:t,selected:n,onToggle:i}){let[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(null),d=(0,J.useRef)(null),{mostUsed:f,project:p,global:m,ranked:h}=Ie(e,s,t),g=(e,t)=>{let a=n.some(t=>q(t)===q(e));return(0,Y.jsxs)(W,{value:q(e),keywords:Ne(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.id,"data-selected":a?`true`:void 0,onSelect:()=>i(Pe(e)),children:[(0,Y.jsx)(`span`,{className:r(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.path?(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-xs`,children:e.path}):null,e.description?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Y.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Y.jsx)(oe,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,Y.jsx)(M,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},q(e))};return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Ke,{skill:l,onClose:()=>u(null)}),(0,Y.jsxs)(O,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,Y.jsx)(D,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:r(ve,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Y.jsx)(ne,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,Y.jsx)(L,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Y.jsx)(E,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Y.jsxs)(Se,{shouldFilter:!1,children:[(0,Y.jsx)(ke,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,Y.jsxs)(Oe,{ref:d,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[s.trim()&&!e.some(e=>e.id===s.trim())?(0,Y.jsx)(K,{children:(0,Y.jsxs)(W,{value:`typed-skill`,onSelect:()=>i({id:s.trim()}),children:[`Use skill id “`,s.trim(),`” (unchecked)`]})}):null,(h?h.length===0:f.length===0&&p.length===0&&m.length===0)?(0,Y.jsx)(_e,{children:`Nothing matches.`}):null,h?h.length>0?(0,Y.jsx)(K,{children:h.map(e=>g(e,je(e)))}):null:(0,Y.jsxs)(Y.Fragment,{children:[f.length>0?(0,Y.jsx)(K,{heading:`Most used`,children:f.map(e=>g(e,je(e)))}):null,p.length>0?(0,Y.jsx)(K,{heading:`Project skills`,children:p.map(e=>g(e,!0))}):null,m.length>0?(0,Y.jsx)(K,{heading:`Global`,children:m.map(e=>g(e,!1))}):null]})]})]})})]})]})}var xn=new WeakMap;function Sn(){let e=fn(),t={workflow:e.workflow,selectedSkills:e.skills,engine:{runner:null,model:null,effort:null,account:null},queued:new Map},n=new Set;return{snapshot:()=>t,subscribe:e=>(n.add(e),()=>{n.delete(e)}),update:e=>{t={...t,...e},(e.workflow!==void 0||e.selectedSkills!==void 0)&&pn({workflow:t.workflow,skills:[...t.selectedSkills]}),n.forEach(e=>e())}}}function Cn(){let e=p(),{projectId:t}=d(),n=xn.get(e);n||xn.set(e,n=new Map);let r=n.get(t);r||n.set(t,r=Sn());let{snapshot:i,subscribe:a,update:o}=r,s=(0,J.useSyncExternalStore)(a,i,i),c=g(),l=an(s.engine),u=m(l.runner,l.account),f=S(),h=c.data?.workflows;(0,J.useEffect)(()=>{h&&s.workflow!==null&&!h.some(e=>e.name===s.workflow)&&o({workflow:null})},[o,h,s.workflow]);let _=(0,J.useMemo)(()=>Me(u.data??[],f.data?.skillUsage),[u.data,f.data?.skillUsage]);return{...s,workflows:c,skillList:_,skillsUnchecked:u.unchecked,setWorkflow:e=>o({workflow:e}),setSelectedSkills:e=>o({selectedSkills:e}),setEngine:e=>o({engine:e}),onQueued:(e,t)=>o({queued:new Map(i().queued).set(e,t)})}}export{qt as a,jt as c,Q as d,vt as f,Yt as i,gt as l,gn as n,Dt as o,Zt as r,yt as s,Cn as t,_t as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Br as e,kr as t}from"./project-scope-context-Cb2B_LxQ.js";function n(n,r){return t(n,e,r)}export{n as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{Cr as n,zr as r}from"./project-scope-context-Cb2B_LxQ.js";import{i}from"./live-protocol-B8HJ-VW8.js";var a=e(t(),1);function o(e,t){if(!i(e.path))throw Error(`unsupported shared read`);let r=new URL(e.path,`http://cezar.invalid`);return r.searchParams.sort(),n({kind:`read`,path:`${r.pathname}${r.search}`,intervalMs:e.intervalMs},{value:t})}function s(e,t,n,i){let s=r(),c=JSON.stringify(t),l=(0,a.useMemo)(()=>JSON.parse(c),[c]);(0,a.useEffect)(()=>{if(!e||n===!1)return;let t=!0,r=o({path:e,intervalMs:n},(e,n)=>{n||s.cancelQueries({queryKey:l,exact:!0}).then(()=>{t&&s.setQueryData(l,i?i(e,s):e)})});return()=>{t=!1,r()}},[s,e,l,n,i])}function c(e,t){return n({kind:`topic`,topic:e},{value:t})}export{o as n,s as r,c as t};
|