@hearsay-tools/squawk 0.19.0-dev.8959 → 0.19.0-dev.8963

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/delegation/routes.d.ts +65 -65
  2. package/dist/features/automations/automations-routes.d.ts +150 -150
  3. package/dist/server/models-routes.d.ts +12 -12
  4. package/dist/server/project-settings-routes.d.ts +107 -107
  5. package/dist/server/projects-routes.d.ts +45 -45
  6. package/dist/server/provider-sign-in-routes.d.ts +2 -2
  7. package/dist/server/providers-routes.d.ts +57 -57
  8. package/dist/server/repo-routes.d.ts +34 -34
  9. package/dist/server/reports-api.d.ts +2 -2
  10. package/dist/server/runner-install-routes.d.ts +10 -10
  11. package/dist/server/runners-routes.d.ts +10 -10
  12. package/dist/server/runs-routes.d.ts +276 -276
  13. package/dist/server/server.d.ts +1208 -1208
  14. package/dist/server/workspace-routes.d.ts +85 -85
  15. package/package.json +4 -4
  16. package/web/dist/assets/accounts-section-B_pqrkm3.js +1 -0
  17. package/web/dist/assets/{activity-motion-CNZbrIKs.js → activity-motion-QlltcKiQ.js} +1 -1
  18. package/web/dist/assets/{activity-route-HjCeTGFh.js → activity-route-Do-PSgpm.js} +1 -1
  19. package/web/dist/assets/{agent-config-section-D3ASkT9C.js → agent-config-section-BWBP7bir.js} +1 -1
  20. package/web/dist/assets/{agent-defaults-section-B9ooGC8t.js → agent-defaults-section-BjM9dSGv.js} +1 -1
  21. package/web/dist/assets/{appearance-OFbvt85o.js → appearance-Y7SFgASk.js} +1 -1
  22. package/web/dist/assets/{archive-on-merge-field-BvtuaspW.js → archive-on-merge-field-C5oo__jZ.js} +1 -1
  23. package/web/dist/assets/{automations-route-C6uMU-W3.js → automations-route-CCD630VY.js} +2 -2
  24. package/web/dist/assets/{commit-list-Dg-dPG_J.js → commit-list-DMTOciIo.js} +1 -1
  25. package/web/dist/assets/{diff-2NATw62W.js → diff-1Cn1zY0x.js} +2 -2
  26. package/web/dist/assets/{diff-controls-DkJTGyU5.js → diff-controls-BXaMnA8A.js} +1 -1
  27. package/web/dist/assets/{diff-view-CW-GN8t7.js → diff-view-yJW8dQIm.js} +1 -1
  28. package/web/dist/assets/discard-changes-dialog-Dr4S8U83.js +1 -0
  29. package/web/dist/assets/{file-preview-BJ6Q-VPN.js → file-preview-Cg4XNolK.js} +1 -1
  30. package/web/dist/assets/{git-toolbar-C68CnIDL.js → git-toolbar-C3mKb8Eo.js} +1 -1
  31. package/web/dist/assets/github-nRn7MvQh.js +1 -0
  32. package/web/dist/assets/{global-activity-route-CoxiPpqk.js → global-activity-route-DoeccLt8.js} +1 -1
  33. package/web/dist/assets/{index-CM_iAvs4.css → index-DImZdID6.css} +1 -1
  34. package/web/dist/assets/{index-MCtGGYNa.js → index-zhwJL4R4.js} +6 -6
  35. package/web/dist/assets/{markdown-Vws-ZDQC.js → markdown-C1Qn_3d6.js} +1 -1
  36. package/web/dist/assets/{option-select-C7M2fzIw.js → option-select-Dw55m71E.js} +1 -1
  37. package/web/dist/assets/{preferences-section-C_T_KjBg.js → preferences-section-D68R2rrK.js} +1 -1
  38. package/web/dist/assets/preview-pane-connected-BAwDR9I-.js +3 -0
  39. package/web/dist/assets/{project-location-Db8_ITcg.js → project-location-CxcuM0pc.js} +1 -1
  40. package/web/dist/assets/{projects-section-CFTrO5BI.js → projects-section-B6ZCAwGT.js} +1 -1
  41. package/web/dist/assets/{prompt-templates-section-DtlXhJiK.js → prompt-templates-section-FluPBVqd.js} +2 -2
  42. package/web/dist/assets/{remote-settings-notice-BVvV6edA.js → remote-settings-notice-C3EUZXnf.js} +1 -1
  43. package/web/dist/assets/repo-git-BAzppU31.js +1 -0
  44. package/web/dist/assets/{report-reader-c0AG1n4k.js → report-reader-CyXGxICd.js} +1 -1
  45. package/web/dist/assets/{reports-BTVWwMou.js → reports-CX7m1Fqi.js} +1 -1
  46. package/web/dist/assets/{resources-section-BmLG8Lm0.js → resources-section-DH5SlAAn.js} +1 -1
  47. package/web/dist/assets/{review-panel-B1Mt1hrO.js → review-panel-ChJ_958J.js} +4 -4
  48. package/web/dist/assets/run-header-BO93V6-R.js +2 -0
  49. package/web/dist/assets/{select-dpKLmgZ_.js → select-Ba45N9DZ.js} +1 -1
  50. package/web/dist/assets/{session-context-section-CXb8kIYJ.js → session-context-section-CB-74w_P.js} +2 -2
  51. package/web/dist/assets/{settings-agent-picker-NGLgXFte.js → settings-agent-picker-BASzliR9.js} +1 -1
  52. package/web/dist/assets/{settings-save-bar-CfUNcwW4.js → settings-save-bar-CJjHCAfn.js} +1 -1
  53. package/web/dist/assets/{settings-shell-Dcv1oVB4.js → settings-shell-2HdeaM8U.js} +1 -1
  54. package/web/dist/assets/{sidebar-section-BeXW9JPy.js → sidebar-section-DFXB7Npa.js} +1 -1
  55. package/web/dist/assets/{skills-BcCvvz3d.js → skills-DIp00-EP.js} +1 -1
  56. package/web/dist/assets/task-changes-Co5wTdgn.js +1 -0
  57. package/web/dist/assets/{task-commits-CgjVHKLR.js → task-commits-C2Kjrelj.js} +1 -1
  58. package/web/dist/assets/{task-file-scope-CPI1TQ21.js → task-file-scope-D4oeMbrZ.js} +1 -1
  59. package/web/dist/assets/{task-files-nBsD7Mvo.js → task-files-D6wwxYsU.js} +1 -1
  60. package/web/dist/assets/{task-github-item-Bybg0bs5.js → task-github-item-DhbqkjTN.js} +1 -1
  61. package/web/dist/assets/{task-thread-CIl3Uj6Y.js → task-thread-CjooERx8.js} +2 -2
  62. package/web/dist/assets/thread-state-mMAXhvWI.js +4 -0
  63. package/web/dist/assets/use-hand-to-agent-state-D9kvXuJa.js +1 -0
  64. package/web/dist/assets/use-path-bases-DI9Wp2bB.js +1 -0
  65. package/web/dist/assets/{workflows-aqvasP6w.js → workflows-CNpKm-Jx.js} +3 -3
  66. package/web/dist/assets/{workspace-tools-BwjfFjb2.js → workspace-tools-B0zJqYga.js} +1 -1
  67. package/web/dist/assets/{worktrees-section-BcuizqIq.js → worktrees-section-DABGAiMK.js} +1 -1
  68. package/web/dist/index.html +2 -2
  69. package/web/dist/assets/accounts-section-Iuso5EHy.js +0 -1
  70. package/web/dist/assets/discard-changes-dialog-BXfDdnph.js +0 -1
  71. package/web/dist/assets/github-Dqk0cII6.js +0 -1
  72. package/web/dist/assets/preview-pane-connected-CXUd2utJ.js +0 -3
  73. package/web/dist/assets/repo-git-ymL5_ed2.js +0 -1
  74. package/web/dist/assets/run-header-DyEbB88q.js +0 -2
  75. package/web/dist/assets/task-changes-Bj7JpmR_.js +0 -1
  76. package/web/dist/assets/thread-state-DQUYVbcr.js +0 -4
  77. package/web/dist/assets/use-hand-to-agent-state-CUDqVWwY.js +0 -1
  78. package/web/dist/assets/use-path-bases-BbEKGJNh.js +0 -1
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{a as i,n as a,o}from"./dist-C_rn70hE.js";import{f as s,l as c,u as l}from"./design-icons-QbNMZniQ.js";import{a as u,c as d,d as f,f as p,h as m,i as h,l as g,m as _,n as v,o as y,p as b,r as x,t as S,u as C}from"./es2015-CUEfzDjB.js";import{n as w,t as T}from"./dist-BSUJIXeE.js";import{t as E}from"./dist-Czz3Y5qH.js";import{a as D,i as O,n as k,r as A,t as j}from"./dist-DudPJH39.js";import{rr as ee}from"./index-MCtGGYNa.js";var M=e(t(),1),N=e(n(),1);function P(e,[t,n]){return Math.min(n,Math.max(t,e))}var F=r(),I=[` `,`Enter`,`ArrowUp`,`ArrowDown`],L=[` `,`Enter`],R=`Select`,[z,B,V]=w(R),[H,U]=_(R,[V,D]),W=D(),[te,G]=H(R),[ne,re]=H(R),ie=`SelectProvider`;function K(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:p,required:m,form:h,internal_do_not_use_render:_}=e,v=W(t),[y,b]=M.useState(null),[x,S]=M.useState(null),[C,w]=M.useState(!1),E=T(l),[D,k]=f({prop:r,defaultProp:i??!1,onChange:a,caller:R}),[A,j]=f({prop:o,defaultProp:s,onChange:c,caller:R}),ee=M.useRef(null),N=M.useRef(A);M.useEffect(()=>{let e=h?y?.ownerDocument.getElementById(h):y?.form;if(e instanceof HTMLFormElement){let t=()=>j(N.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[h,y,j]);let P=!y||!!h||!!y.closest(`form`),[I,L]=M.useState(new Set),B=g(),V=Array.from(I).map(e=>e.props.value).join(`;`),H=M.useCallback(e=>{L(t=>new Set(t).add(e))},[]),U=M.useCallback(e=>{L(t=>{let n=new Set(t);return n.delete(e),n})},[]),G={required:m,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:B,value:A,onValueChange:j,open:D,onOpenChange:k,dir:E,triggerPointerDownPosRef:ee,disabled:p,name:u,autoComplete:d,form:h,nativeOptions:I,nativeSelectKey:V,isFormControl:P};return(0,F.jsx)(O,{...v,children:(0,F.jsx)(te,{scope:t,...G,children:(0,F.jsx)(z.Provider,{scope:t,children:(0,F.jsx)(ne,{scope:t,onNativeOptionAdd:H,onNativeOptionRemove:U,children:Qe(_)?_(G):n})})})})}K.displayName=ie;var q=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,F.jsx)(K,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,F.jsxs)(F.Fragment,{children:[n,e?(0,F.jsx)(Ze,{__scopeSelect:t}):null]})})};q.displayName=R;var ae=`SelectTrigger`,oe=M.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...a}=e,o=W(n),s=G(ae,n),c=s.disabled||r,l=i(t,s.onTriggerChange),u=B(n),d=M.useRef(`touch`),[f,p,h]=$e(e=>{let t=u().filter(e=>!e.disabled),n=et(t,e,t.find(e=>e.value===s.value));n!==void 0&&s.onValueChange(n.value)}),g=e=>{c||(s.onOpenChange(!0),h()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,F.jsx)(j,{asChild:!0,...o,children:(0,F.jsx)(m.button,{type:`button`,role:`combobox`,"aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":`none`,dir:s.dir,"data-state":s.open?`open`:`closed`,disabled:c,"data-disabled":c?``:void 0,"data-placeholder":$(s.value)?``:void 0,...a,ref:l,onClick:b(a.onClick,e=>{e.currentTarget.focus(),d.current!==`mouse`&&g(e)}),onPointerDown:b(a.onPointerDown,e=>{d.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(g(e),e.preventDefault())}),onKeyDown:b(a.onKeyDown,e=>{let t=f.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&p(e.key),!(t&&e.key===` `)&&I.includes(e.key)&&(g(),e.preventDefault())})})})});oe.displayName=ae;var se=`SelectValue`,ce=M.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:a,children:o,placeholder:s=``,...c}=e,l=G(se,n),{onValueNodeHasChildrenChange:u}=l,d=o!==void 0,f=i(t,l.onValueNodeChange);p(()=>{u(d)},[u,d]);let h=$(l.value);return(0,F.jsx)(m.span,{...c,asChild:!h&&c.asChild,ref:f,style:{pointerEvents:`none`},children:(0,F.jsx)(M.Fragment,{children:h?s:o},h?`placeholder`:`value`)})});ce.displayName=se;var le=`SelectIcon`,ue=M.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,F.jsx)(m.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});ue.displayName=le;var de=`SelectPortal`,[fe,pe]=H(de,{forceMount:void 0}),me=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,F.jsx)(fe,{scope:e.__scopeSelect,forceMount:n,children:(0,F.jsx)(h,{asChild:!0,...r})})};me.displayName=de;var J=`SelectContent`,he=M.forwardRef((e,t)=>{let n=pe(J,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=G(J,e.__scopeSelect),[o,s]=M.useState();return p(()=>{s(new DocumentFragment)},[]),(0,F.jsx)(C,{present:r||a.open,children:({present:e})=>e?(0,F.jsx)(be,{...i,ref:t}):(0,F.jsx)(ge,{...i,fragment:o})})});he.displayName=J;var ge=M.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?N.createPortal((0,F.jsx)(_e,{scope:n,children:(0,F.jsx)(z.Slot,{scope:n,children:(0,F.jsx)(`div`,{ref:t,children:r})})}),i):null});ge.displayName=`SelectContentFragment`;var Y=10,[_e,X]=H(J),ve=`SelectContentImpl`,ye=a(`SelectContent.RemoveScroll`),be=M.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:l,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:_,avoidCollisions:C,...w}=e,T=G(J,n),[E,D]=M.useState(null),[O,k]=M.useState(null),A=i(t,D),[j,ee]=M.useState(null),[N,P]=M.useState(null),I=B(n),[L,R]=M.useState(!1),z=M.useRef(!1);M.useEffect(()=>{if(E)return S(E)},[E]),x();let V=M.useCallback(e=>{let[t,...n]=I().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&O&&(O.scrollTop=0),n===r&&O&&(O.scrollTop=O.scrollHeight),n?.focus(),document.activeElement!==i))return},[I,O]),H=M.useCallback(()=>V([j,E]),[V,j,E]);M.useEffect(()=>{L&&H()},[L,H]);let{onOpenChange:U,triggerPointerDownPosRef:W}=T;M.useEffect(()=>{if(E){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(W.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(W.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(E)||U(!1),document.removeEventListener(`pointermove`,t),W.current=null};return W.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[E,U,W]),M.useEffect(()=>{let e=()=>U(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[U]);let[te,ne]=$e(e=>{let t=I().filter(e=>!e.disabled),n=et(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),re=M.useCallback((e,t,n)=>{let r=!z.current&&!n;(T.value!==void 0&&T.value===t||r)&&(ee(e),r&&(z.current=!0))},[T.value]),ie=M.useCallback(()=>E?.focus(),[E]),K=M.useCallback((e,t,n)=>{let r=!z.current&&!n;(T.value!==void 0&&T.value===t||r)&&P(e)},[T.value]),q=r===`popper`?we:Se,ae=q===we?{side:c,sideOffset:l,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:_,avoidCollisions:C}:{};return(0,F.jsx)(_e,{scope:n,content:E,viewport:O,onViewportChange:k,itemRefCallback:re,selectedItem:j,onItemLeave:ie,itemTextRefCallback:K,focusSelectedItem:H,selectedItemText:N,position:r,isPositioned:L,searchRef:te,children:(0,F.jsx)(v,{as:ye,allowPinchZoom:!0,children:(0,F.jsx)(u,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:b(a,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,F.jsx)(y,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,F.jsx)(q,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...w,...ae,onPlaced:()=>R(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...w.style},onKeyDown:b(w.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ne(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=I().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>V(t)),e.preventDefault()}})})})})})})});be.displayName=ve;var xe=`SelectItemAlignedPosition`,Se=M.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...a}=e,o=G(J,n),s=X(J,n),[c,l]=M.useState(null),[u,d]=M.useState(null),f=i(t,d),h=B(n),g=M.useRef(!1),_=M.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=s,S=M.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&u&&v&&y&&b){let e=o.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),n=o.valueNode.getBoundingClientRect(),i=b.getBoundingClientRect();if(o.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);c.style.minWidth=s+`px`,c.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let a=h(),s=window.innerHeight-Y*2,l=v.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),m=parseInt(d.borderBottomWidth,10),_=parseInt(d.paddingBottom,10),x=f+p+l+_+m,S=Math.min(y.offsetHeight*5,x),C=window.getComputedStyle(v),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Y,D=s-E,O=y.offsetHeight/2,k=y.offsetTop+O,A=f+p+k,j=x-A;if(A<=E){let e=a.length>0&&y===a[a.length-1].ref.current;c.style.bottom=`0px`;let t=u.clientHeight-v.offsetTop-v.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+m);c.style.height=n+`px`}else{let e=a.length>0&&y===a[0].ref.current;c.style.top=`0px`;let t=Math.max(E,f+v.offsetTop+(e?w:0)+O)+j;c.style.height=t+`px`,v.scrollTop=A-E+v.offsetTop}c.style.margin=`${Y}px 0`,c.style.minHeight=S+`px`,c.style.maxHeight=s+`px`,r?.(),requestAnimationFrame(()=>g.current=!0)}},[h,o.trigger,o.valueNode,c,u,v,y,b,o.dir,r]);p(()=>S(),[S]);let[C,w]=M.useState();return p(()=>{u&&w(window.getComputedStyle(u).zIndex)},[u]),(0,F.jsx)(Te,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:g,onScrollButtonChange:M.useCallback(e=>{e&&_.current===!0&&(S(),x?.(),_.current=!1)},[S,x]),children:(0,F.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,F.jsx)(m.div,{...a,ref:f,style:{boxSizing:`border-box`,maxHeight:`100%`,...a.style}})})})});Se.displayName=xe;var Ce=`SelectPopperPosition`,we=M.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Y,...a}=e,o=W(n);return(0,F.jsx)(A,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});we.displayName=Ce;var[Te,Ee]=H(J,{}),De=`SelectViewport`,Oe=M.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...a}=e,o=X(De,n),s=Ee(De,n),c=i(t,o.onViewportChange),l=M.useRef(0);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,F.jsx)(z.Slot,{scope:n,children:(0,F.jsx)(m.div,{"data-radix-select-viewport":``,role:`presentation`,...a,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...a.style},onScroll:b(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-Y*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}l.current=t.scrollTop})})})]})});Oe.displayName=De;var ke=`SelectGroup`,[Ae,je]=H(ke),Me=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=g();return(0,F.jsx)(Ae,{scope:n,id:i,children:(0,F.jsx)(m.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Me.displayName=ke;var Ne=`SelectLabel`,Pe=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=je(Ne,n);return(0,F.jsx)(m.div,{id:i.id,...r,ref:t})});Pe.displayName=Ne;var Z=`SelectItem`,[Fe,Ie]=H(Z),Le=M.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:a=!1,textValue:o,...s}=e,c=G(Z,n),l=X(Z,n),u=c.value===r,[f,p]=M.useState(o??``),[h,_]=M.useState(!1),v=i(t,d(e=>l.itemRefCallback?.(e,r,a))),y=g(),x=M.useRef(`touch`),S=()=>{a||(c.onValueChange(r),c.onOpenChange(!1))};return(0,F.jsx)(Fe,{scope:n,value:r,disabled:a,textId:y,isSelected:u,onItemTextChange:M.useCallback(e=>{p(t=>t||(e?.textContent??``).trim())},[]),children:(0,F.jsx)(z.ItemSlot,{scope:n,value:r,disabled:a,textValue:f,children:(0,F.jsx)(m.div,{role:`option`,"aria-labelledby":y,"data-highlighted":h?``:void 0,"aria-selected":u&&h,"data-state":u?`checked`:`unchecked`,"aria-disabled":a||void 0,"data-disabled":a?``:void 0,tabIndex:a?void 0:-1,...s,ref:v,onFocus:b(s.onFocus,()=>_(!0)),onBlur:b(s.onBlur,()=>_(!1)),onClick:b(s.onClick,()=>{x.current!==`mouse`&&S()}),onPointerUp:b(s.onPointerUp,()=>{x.current===`mouse`&&S()}),onPointerDown:b(s.onPointerDown,e=>{x.current=e.pointerType}),onPointerMove:b(s.onPointerMove,e=>{x.current=e.pointerType,a?l.onItemLeave?.():x.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:b(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:b(s.onKeyDown,e=>{a||e.target!==e.currentTarget||l.searchRef?.current!==``&&e.key===` `||(L.includes(e.key)&&S(),e.key===` `&&e.preventDefault())})})})})});Le.displayName=Z;var Q=`SelectItemText`,Re=M.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:a,...o}=e,s=G(Q,n),c=X(Q,n),l=Ie(Q,n),u=re(Q,n),[f,h]=M.useState(null),g=d(e=>c.itemTextRefCallback?.(e,l.value,l.disabled)),_=i(t,h,l.onItemTextChange,g),v=f?.textContent,y=M.useMemo(()=>(0,F.jsx)(`option`,{value:l.value,disabled:l.disabled,children:v},l.value),[l.disabled,l.value,v]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=u;return p(()=>(b(y),()=>x(y)),[b,x,y]),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(m.span,{id:l.textId,...o,ref:_}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren&&!$(s.value)?N.createPortal(o.children,s.valueNode):null]})});Re.displayName=Q;var ze=`SelectItemIndicator`,Be=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Ie(ze,n).isSelected?(0,F.jsx)(m.span,{"aria-hidden":!0,...r,ref:t}):null});Be.displayName=ze;var Ve=`SelectScrollUpButton`,He=M.forwardRef((e,t)=>{let n=X(Ve,e.__scopeSelect),r=Ee(Ve,e.__scopeSelect),[a,o]=M.useState(!1),s=i(t,r.onScrollButtonChange);return p(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;o(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,F.jsx)(Ge,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});He.displayName=Ve;var Ue=`SelectScrollDownButton`,We=M.forwardRef((e,t)=>{let n=X(Ue,e.__scopeSelect),r=Ee(Ue,e.__scopeSelect),[a,o]=M.useState(!1),s=i(t,r.onScrollButtonChange);return p(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;o(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,F.jsx)(Ge,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});We.displayName=Ue;var Ge=M.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=X(`SelectScrollButton`,n),o=M.useRef(null),s=B(n),c=M.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return M.useEffect(()=>()=>c(),[c]),p(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,F.jsx)(m.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:b(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:b(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:b(i.onPointerLeave,()=>{c()})})}),Ke=`SelectSeparator`,qe=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,F.jsx)(m.div,{"aria-hidden":!0,...r,ref:t})});qe.displayName=Ke;var Je=`SelectArrow`,Ye=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=W(n);return X(Je,n).position===`popper`?(0,F.jsx)(k,{...i,...r,ref:t}):null});Ye.displayName=Je;var Xe=`SelectBubbleInput`,Ze=M.forwardRef(({__scopeSelect:e,...t},n)=>{let r=G(Xe,e),{value:a,onValueChange:o,required:s,disabled:c,name:l,autoComplete:u,form:d}=r,{nativeOptions:f,nativeSelectKey:p}=r,h=M.useRef(null),g=i(n,h),_=a??``,v=E(_),y=Array.from(f).some(e=>(e.props.value??``)===``);return M.useEffect(()=>{let e=h.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(v!==_&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,_),e.dispatchEvent(t)}},[v,_]),(0,F.jsxs)(m.select,{"aria-hidden":!0,required:s,tabIndex:-1,name:l,autoComplete:u,disabled:c,form:d,onChange:e=>o(e.target.value),...t,style:{...ee,...t.style},ref:g,defaultValue:_,children:[$(a)&&!y?(0,F.jsx)(`option`,{value:``}):null,Array.from(f)]},p)});Ze.displayName=Xe;function Qe(e){return typeof e==`function`}function $(e){return e===``||e===void 0}function $e(e){let t=d(e),n=M.useRef(``),r=M.useRef(0),i=M.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=M.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return M.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function et(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=tt(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function tt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function nt({...e}){return(0,F.jsx)(q,{"data-slot":`select`,...e})}function rt({...e}){return(0,F.jsx)(ce,{"data-slot":`select-value`,...e})}function it({className:e,size:t=`default`,children:n,...r}){return(0,F.jsxs)(oe,{"data-slot":`select-trigger`,"data-size":t,className:o(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-[var(--task-brand-bg)] px-3 py-2 text-sm whitespace-nowrap shadow-none transition-[color,box-shadow] outline-hidden focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-11 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 pointer-hover:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,F.jsx)(ue,{asChild:!0,children:(0,F.jsx)(l,{className:`size-4 opacity-50`})})]})}function at({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,F.jsx)(me,{children:(0,F.jsxs)(he,{"data-slot":`select-content`,className:o(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,F.jsx)(st,{}),(0,F.jsx)(Oe,{className:o(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,F.jsx)(ct,{})]})})}function ot({className:e,children:t,...n}){return(0,F.jsxs)(Le,{"data-slot":`select-item`,className:o(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pe-8 ps-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,F.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute end-2 flex size-3.5 items-center justify-center`,children:(0,F.jsx)(Be,{children:(0,F.jsx)(c,{className:`size-4`})})}),(0,F.jsx)(Re,{children:t})]})}function st({className:e,...t}){return(0,F.jsx)(He,{"data-slot":`select-scroll-up-button`,className:o(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,F.jsx)(s,{className:`size-4`})})}function ct({className:e,...t}){return(0,F.jsx)(We,{"data-slot":`select-scroll-down-button`,className:o(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,F.jsx)(l,{className:`size-4`})})}export{rt as a,it as i,at as n,ot as r,nt as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{a as i,n as a,o}from"./dist-C_rn70hE.js";import{f as s,l as c,u as l}from"./design-icons-QbNMZniQ.js";import{a as u,c as d,d as f,f as p,h as m,i as h,l as g,m as _,n as v,o as y,p as b,r as x,t as S,u as C}from"./es2015-CUEfzDjB.js";import{n as w,t as T}from"./dist-BSUJIXeE.js";import{t as E}from"./dist-Czz3Y5qH.js";import{a as D,i as O,n as k,r as A,t as j}from"./dist-DudPJH39.js";import{ar as ee}from"./index-zhwJL4R4.js";var M=e(t(),1),N=e(n(),1);function P(e,[t,n]){return Math.min(n,Math.max(t,e))}var F=r(),I=[` `,`Enter`,`ArrowUp`,`ArrowDown`],L=[` `,`Enter`],R=`Select`,[z,B,V]=w(R),[H,U]=_(R,[V,D]),W=D(),[te,G]=H(R),[ne,re]=H(R),ie=`SelectProvider`;function K(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:p,required:m,form:h,internal_do_not_use_render:_}=e,v=W(t),[y,b]=M.useState(null),[x,S]=M.useState(null),[C,w]=M.useState(!1),E=T(l),[D,k]=f({prop:r,defaultProp:i??!1,onChange:a,caller:R}),[A,j]=f({prop:o,defaultProp:s,onChange:c,caller:R}),ee=M.useRef(null),N=M.useRef(A);M.useEffect(()=>{let e=h?y?.ownerDocument.getElementById(h):y?.form;if(e instanceof HTMLFormElement){let t=()=>j(N.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[h,y,j]);let P=!y||!!h||!!y.closest(`form`),[I,L]=M.useState(new Set),B=g(),V=Array.from(I).map(e=>e.props.value).join(`;`),H=M.useCallback(e=>{L(t=>new Set(t).add(e))},[]),U=M.useCallback(e=>{L(t=>{let n=new Set(t);return n.delete(e),n})},[]),G={required:m,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:B,value:A,onValueChange:j,open:D,onOpenChange:k,dir:E,triggerPointerDownPosRef:ee,disabled:p,name:u,autoComplete:d,form:h,nativeOptions:I,nativeSelectKey:V,isFormControl:P};return(0,F.jsx)(O,{...v,children:(0,F.jsx)(te,{scope:t,...G,children:(0,F.jsx)(z.Provider,{scope:t,children:(0,F.jsx)(ne,{scope:t,onNativeOptionAdd:H,onNativeOptionRemove:U,children:Qe(_)?_(G):n})})})})}K.displayName=ie;var q=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,F.jsx)(K,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,F.jsxs)(F.Fragment,{children:[n,e?(0,F.jsx)(Ze,{__scopeSelect:t}):null]})})};q.displayName=R;var ae=`SelectTrigger`,oe=M.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...a}=e,o=W(n),s=G(ae,n),c=s.disabled||r,l=i(t,s.onTriggerChange),u=B(n),d=M.useRef(`touch`),[f,p,h]=$e(e=>{let t=u().filter(e=>!e.disabled),n=et(t,e,t.find(e=>e.value===s.value));n!==void 0&&s.onValueChange(n.value)}),g=e=>{c||(s.onOpenChange(!0),h()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,F.jsx)(j,{asChild:!0,...o,children:(0,F.jsx)(m.button,{type:`button`,role:`combobox`,"aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":`none`,dir:s.dir,"data-state":s.open?`open`:`closed`,disabled:c,"data-disabled":c?``:void 0,"data-placeholder":$(s.value)?``:void 0,...a,ref:l,onClick:b(a.onClick,e=>{e.currentTarget.focus(),d.current!==`mouse`&&g(e)}),onPointerDown:b(a.onPointerDown,e=>{d.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(g(e),e.preventDefault())}),onKeyDown:b(a.onKeyDown,e=>{let t=f.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&p(e.key),!(t&&e.key===` `)&&I.includes(e.key)&&(g(),e.preventDefault())})})})});oe.displayName=ae;var se=`SelectValue`,ce=M.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:a,children:o,placeholder:s=``,...c}=e,l=G(se,n),{onValueNodeHasChildrenChange:u}=l,d=o!==void 0,f=i(t,l.onValueNodeChange);p(()=>{u(d)},[u,d]);let h=$(l.value);return(0,F.jsx)(m.span,{...c,asChild:!h&&c.asChild,ref:f,style:{pointerEvents:`none`},children:(0,F.jsx)(M.Fragment,{children:h?s:o},h?`placeholder`:`value`)})});ce.displayName=se;var le=`SelectIcon`,ue=M.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,F.jsx)(m.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});ue.displayName=le;var de=`SelectPortal`,[fe,pe]=H(de,{forceMount:void 0}),me=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,F.jsx)(fe,{scope:e.__scopeSelect,forceMount:n,children:(0,F.jsx)(h,{asChild:!0,...r})})};me.displayName=de;var J=`SelectContent`,he=M.forwardRef((e,t)=>{let n=pe(J,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=G(J,e.__scopeSelect),[o,s]=M.useState();return p(()=>{s(new DocumentFragment)},[]),(0,F.jsx)(C,{present:r||a.open,children:({present:e})=>e?(0,F.jsx)(be,{...i,ref:t}):(0,F.jsx)(ge,{...i,fragment:o})})});he.displayName=J;var ge=M.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?N.createPortal((0,F.jsx)(_e,{scope:n,children:(0,F.jsx)(z.Slot,{scope:n,children:(0,F.jsx)(`div`,{ref:t,children:r})})}),i):null});ge.displayName=`SelectContentFragment`;var Y=10,[_e,X]=H(J),ve=`SelectContentImpl`,ye=a(`SelectContent.RemoveScroll`),be=M.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:l,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:_,avoidCollisions:C,...w}=e,T=G(J,n),[E,D]=M.useState(null),[O,k]=M.useState(null),A=i(t,D),[j,ee]=M.useState(null),[N,P]=M.useState(null),I=B(n),[L,R]=M.useState(!1),z=M.useRef(!1);M.useEffect(()=>{if(E)return S(E)},[E]),x();let V=M.useCallback(e=>{let[t,...n]=I().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&O&&(O.scrollTop=0),n===r&&O&&(O.scrollTop=O.scrollHeight),n?.focus(),document.activeElement!==i))return},[I,O]),H=M.useCallback(()=>V([j,E]),[V,j,E]);M.useEffect(()=>{L&&H()},[L,H]);let{onOpenChange:U,triggerPointerDownPosRef:W}=T;M.useEffect(()=>{if(E){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(W.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(W.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(E)||U(!1),document.removeEventListener(`pointermove`,t),W.current=null};return W.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[E,U,W]),M.useEffect(()=>{let e=()=>U(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[U]);let[te,ne]=$e(e=>{let t=I().filter(e=>!e.disabled),n=et(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),re=M.useCallback((e,t,n)=>{let r=!z.current&&!n;(T.value!==void 0&&T.value===t||r)&&(ee(e),r&&(z.current=!0))},[T.value]),ie=M.useCallback(()=>E?.focus(),[E]),K=M.useCallback((e,t,n)=>{let r=!z.current&&!n;(T.value!==void 0&&T.value===t||r)&&P(e)},[T.value]),q=r===`popper`?we:Se,ae=q===we?{side:c,sideOffset:l,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:_,avoidCollisions:C}:{};return(0,F.jsx)(_e,{scope:n,content:E,viewport:O,onViewportChange:k,itemRefCallback:re,selectedItem:j,onItemLeave:ie,itemTextRefCallback:K,focusSelectedItem:H,selectedItemText:N,position:r,isPositioned:L,searchRef:te,children:(0,F.jsx)(v,{as:ye,allowPinchZoom:!0,children:(0,F.jsx)(u,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:b(a,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,F.jsx)(y,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,F.jsx)(q,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...w,...ae,onPlaced:()=>R(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...w.style},onKeyDown:b(w.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ne(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=I().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>V(t)),e.preventDefault()}})})})})})})});be.displayName=ve;var xe=`SelectItemAlignedPosition`,Se=M.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...a}=e,o=G(J,n),s=X(J,n),[c,l]=M.useState(null),[u,d]=M.useState(null),f=i(t,d),h=B(n),g=M.useRef(!1),_=M.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=s,S=M.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&u&&v&&y&&b){let e=o.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),n=o.valueNode.getBoundingClientRect(),i=b.getBoundingClientRect();if(o.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);c.style.minWidth=s+`px`,c.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let a=h(),s=window.innerHeight-Y*2,l=v.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),m=parseInt(d.borderBottomWidth,10),_=parseInt(d.paddingBottom,10),x=f+p+l+_+m,S=Math.min(y.offsetHeight*5,x),C=window.getComputedStyle(v),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Y,D=s-E,O=y.offsetHeight/2,k=y.offsetTop+O,A=f+p+k,j=x-A;if(A<=E){let e=a.length>0&&y===a[a.length-1].ref.current;c.style.bottom=`0px`;let t=u.clientHeight-v.offsetTop-v.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+m);c.style.height=n+`px`}else{let e=a.length>0&&y===a[0].ref.current;c.style.top=`0px`;let t=Math.max(E,f+v.offsetTop+(e?w:0)+O)+j;c.style.height=t+`px`,v.scrollTop=A-E+v.offsetTop}c.style.margin=`${Y}px 0`,c.style.minHeight=S+`px`,c.style.maxHeight=s+`px`,r?.(),requestAnimationFrame(()=>g.current=!0)}},[h,o.trigger,o.valueNode,c,u,v,y,b,o.dir,r]);p(()=>S(),[S]);let[C,w]=M.useState();return p(()=>{u&&w(window.getComputedStyle(u).zIndex)},[u]),(0,F.jsx)(Te,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:g,onScrollButtonChange:M.useCallback(e=>{e&&_.current===!0&&(S(),x?.(),_.current=!1)},[S,x]),children:(0,F.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,F.jsx)(m.div,{...a,ref:f,style:{boxSizing:`border-box`,maxHeight:`100%`,...a.style}})})})});Se.displayName=xe;var Ce=`SelectPopperPosition`,we=M.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Y,...a}=e,o=W(n);return(0,F.jsx)(A,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});we.displayName=Ce;var[Te,Ee]=H(J,{}),De=`SelectViewport`,Oe=M.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...a}=e,o=X(De,n),s=Ee(De,n),c=i(t,o.onViewportChange),l=M.useRef(0);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,F.jsx)(z.Slot,{scope:n,children:(0,F.jsx)(m.div,{"data-radix-select-viewport":``,role:`presentation`,...a,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...a.style},onScroll:b(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-Y*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}l.current=t.scrollTop})})})]})});Oe.displayName=De;var ke=`SelectGroup`,[Ae,je]=H(ke),Me=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=g();return(0,F.jsx)(Ae,{scope:n,id:i,children:(0,F.jsx)(m.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Me.displayName=ke;var Ne=`SelectLabel`,Pe=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=je(Ne,n);return(0,F.jsx)(m.div,{id:i.id,...r,ref:t})});Pe.displayName=Ne;var Z=`SelectItem`,[Fe,Ie]=H(Z),Le=M.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:a=!1,textValue:o,...s}=e,c=G(Z,n),l=X(Z,n),u=c.value===r,[f,p]=M.useState(o??``),[h,_]=M.useState(!1),v=i(t,d(e=>l.itemRefCallback?.(e,r,a))),y=g(),x=M.useRef(`touch`),S=()=>{a||(c.onValueChange(r),c.onOpenChange(!1))};return(0,F.jsx)(Fe,{scope:n,value:r,disabled:a,textId:y,isSelected:u,onItemTextChange:M.useCallback(e=>{p(t=>t||(e?.textContent??``).trim())},[]),children:(0,F.jsx)(z.ItemSlot,{scope:n,value:r,disabled:a,textValue:f,children:(0,F.jsx)(m.div,{role:`option`,"aria-labelledby":y,"data-highlighted":h?``:void 0,"aria-selected":u&&h,"data-state":u?`checked`:`unchecked`,"aria-disabled":a||void 0,"data-disabled":a?``:void 0,tabIndex:a?void 0:-1,...s,ref:v,onFocus:b(s.onFocus,()=>_(!0)),onBlur:b(s.onBlur,()=>_(!1)),onClick:b(s.onClick,()=>{x.current!==`mouse`&&S()}),onPointerUp:b(s.onPointerUp,()=>{x.current===`mouse`&&S()}),onPointerDown:b(s.onPointerDown,e=>{x.current=e.pointerType}),onPointerMove:b(s.onPointerMove,e=>{x.current=e.pointerType,a?l.onItemLeave?.():x.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:b(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:b(s.onKeyDown,e=>{a||e.target!==e.currentTarget||l.searchRef?.current!==``&&e.key===` `||(L.includes(e.key)&&S(),e.key===` `&&e.preventDefault())})})})})});Le.displayName=Z;var Q=`SelectItemText`,Re=M.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:a,...o}=e,s=G(Q,n),c=X(Q,n),l=Ie(Q,n),u=re(Q,n),[f,h]=M.useState(null),g=d(e=>c.itemTextRefCallback?.(e,l.value,l.disabled)),_=i(t,h,l.onItemTextChange,g),v=f?.textContent,y=M.useMemo(()=>(0,F.jsx)(`option`,{value:l.value,disabled:l.disabled,children:v},l.value),[l.disabled,l.value,v]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=u;return p(()=>(b(y),()=>x(y)),[b,x,y]),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(m.span,{id:l.textId,...o,ref:_}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren&&!$(s.value)?N.createPortal(o.children,s.valueNode):null]})});Re.displayName=Q;var ze=`SelectItemIndicator`,Be=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Ie(ze,n).isSelected?(0,F.jsx)(m.span,{"aria-hidden":!0,...r,ref:t}):null});Be.displayName=ze;var Ve=`SelectScrollUpButton`,He=M.forwardRef((e,t)=>{let n=X(Ve,e.__scopeSelect),r=Ee(Ve,e.__scopeSelect),[a,o]=M.useState(!1),s=i(t,r.onScrollButtonChange);return p(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;o(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,F.jsx)(Ge,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});He.displayName=Ve;var Ue=`SelectScrollDownButton`,We=M.forwardRef((e,t)=>{let n=X(Ue,e.__scopeSelect),r=Ee(Ue,e.__scopeSelect),[a,o]=M.useState(!1),s=i(t,r.onScrollButtonChange);return p(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;o(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,F.jsx)(Ge,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});We.displayName=Ue;var Ge=M.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=X(`SelectScrollButton`,n),o=M.useRef(null),s=B(n),c=M.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return M.useEffect(()=>()=>c(),[c]),p(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,F.jsx)(m.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:b(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:b(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:b(i.onPointerLeave,()=>{c()})})}),Ke=`SelectSeparator`,qe=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,F.jsx)(m.div,{"aria-hidden":!0,...r,ref:t})});qe.displayName=Ke;var Je=`SelectArrow`,Ye=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=W(n);return X(Je,n).position===`popper`?(0,F.jsx)(k,{...i,...r,ref:t}):null});Ye.displayName=Je;var Xe=`SelectBubbleInput`,Ze=M.forwardRef(({__scopeSelect:e,...t},n)=>{let r=G(Xe,e),{value:a,onValueChange:o,required:s,disabled:c,name:l,autoComplete:u,form:d}=r,{nativeOptions:f,nativeSelectKey:p}=r,h=M.useRef(null),g=i(n,h),_=a??``,v=E(_),y=Array.from(f).some(e=>(e.props.value??``)===``);return M.useEffect(()=>{let e=h.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(v!==_&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,_),e.dispatchEvent(t)}},[v,_]),(0,F.jsxs)(m.select,{"aria-hidden":!0,required:s,tabIndex:-1,name:l,autoComplete:u,disabled:c,form:d,onChange:e=>o(e.target.value),...t,style:{...ee,...t.style},ref:g,defaultValue:_,children:[$(a)&&!y?(0,F.jsx)(`option`,{value:``}):null,Array.from(f)]},p)});Ze.displayName=Xe;function Qe(e){return typeof e==`function`}function $(e){return e===``||e===void 0}function $e(e){let t=d(e),n=M.useRef(``),r=M.useRef(0),i=M.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=M.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return M.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function et(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=tt(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function tt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function nt({...e}){return(0,F.jsx)(q,{"data-slot":`select`,...e})}function rt({...e}){return(0,F.jsx)(ce,{"data-slot":`select-value`,...e})}function it({className:e,size:t=`default`,children:n,...r}){return(0,F.jsxs)(oe,{"data-slot":`select-trigger`,"data-size":t,className:o(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-[var(--task-brand-bg)] px-3 py-2 text-sm whitespace-nowrap shadow-none transition-[color,box-shadow] outline-hidden focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-11 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 pointer-hover:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,F.jsx)(ue,{asChild:!0,children:(0,F.jsx)(l,{className:`size-4 opacity-50`})})]})}function at({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,F.jsx)(me,{children:(0,F.jsxs)(he,{"data-slot":`select-content`,className:o(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,F.jsx)(st,{}),(0,F.jsx)(Oe,{className:o(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,F.jsx)(ct,{})]})})}function ot({className:e,children:t,...n}){return(0,F.jsxs)(Le,{"data-slot":`select-item`,className:o(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pe-8 ps-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,F.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute end-2 flex size-3.5 items-center justify-center`,children:(0,F.jsx)(Be,{children:(0,F.jsx)(c,{className:`size-4`})})}),(0,F.jsx)(Re,{children:t})]})}function st({className:e,...t}){return(0,F.jsx)(He,{"data-slot":`select-scroll-up-button`,className:o(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,F.jsx)(s,{className:`size-4`})})}function ct({className:e,...t}){return(0,F.jsx)(We,{"data-slot":`select-scroll-down-button`,className:o(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,F.jsx)(l,{className:`size-4`})})}export{rt as a,it as i,at as n,ot as r,nt as t};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{D as i,O as a,S as o}from"./queries-CIeJg62Y.js";import{Fn as s}from"./toaster-D0HMoto5.js";import{t as c}from"./plus-CxRU2X8C.js";import{t as l}from"./button-C8jUIs8Q.js";import{t as u}from"./badge-B6B-xYQQ.js";import{t as d}from"./centered-state-BgSV4e79.js";import{$n as f,dr as p}from"./index-MCtGGYNa.js";import{t as m}from"./code-editor-GfQChdgl.js";import{r as h}from"./settings-save-bar-CfUNcwW4.js";var g=e(t(),1);function _(e,t,n){let r=e.indexOf(t),i={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1};if(n===`Home`)return e[0];if(n===`End`)return e.at(-1);if(!(i[n]===void 0||r===-1))return e[(r+i[n]+e.length)%e.length]}var v=n(),y={"built-in":`built in`,parent:`parent`,worker:`worker`,both:`both`},b={"built-in":`built in`,shared:`shared`,local:`local`},x={applied:`border-success/40 text-success`,skipped:`border-conflict/50 text-conflict`,"not-for-role":`text-soft-foreground`},S=e=>`${e.toLocaleString(`en-US`)} B`;function ee({id:e,preview:t,role:n,onRole:i,pending:a,className:o}){return(0,v.jsxs)(`section`,{id:e,"data-slot":`session-context-preview`,"aria-labelledby":`session-context-preview-title`,"aria-busy":a,className:r(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,o),children:[(0,v.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-border p-3`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(`h3`,{id:`session-context-preview-title`,className:`text-sm font-semibold`,children:`Combined preview`}),(0,v.jsx)(`span`,{className:`ml-auto text-[12px] text-soft-foreground`,children:`Updates as you type`})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,v.jsx)(`span`,{id:`session-context-role`,className:`text-[12px] text-soft-foreground`,children:`Preview as`}),(0,v.jsx)(te,{role:n,onRole:i}),(0,v.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`Handoff, shared, then local. Files come from the project checkout.`})]}),t?(0,v.jsx)(ne,{used:t.usedBytes,limit:t.limitBytes,blocks:t.blocks}):(0,v.jsx)(`div`,{className:`h-[38px]`})]}),(0,v.jsx)(`ul`,{"data-slot":`session-context-blocks`,className:`divide-y divide-border`,children:t?.blocks.map((e,t)=>(0,v.jsx)(w,{block:e,role:n},`${e.source}-${e.id}-${t}`))})]})}var C=[`parent`,`worker`];function te({role:e,onRole:t}){let n=(0,g.useRef)(new Map);return(0,v.jsx)(`div`,{role:`radiogroup`,"aria-labelledby":`session-context-role`,onKeyDown:r=>{let i=_(C,e,r.key);i!==void 0&&(r.preventDefault(),t(i),n.current.get(i)?.focus())},className:`inline-flex overflow-hidden rounded-md border border-[var(--control-border)]`,children:C.map(i=>(0,v.jsx)(`button`,{ref:e=>{e?n.current.set(i,e):n.current.delete(i)},type:`button`,role:`radio`,"aria-checked":e===i,tabIndex:e===i?0:-1,"data-slot":`session-context-role`,onClick:()=>t(i),className:r(`min-h-11 px-4 text-[13px] capitalize text-muted-foreground focus-visible:outline-2 focus-visible:outline-ring`,e===i&&`bg-muted text-foreground`),children:i},i))})}function ne({used:e,limit:t,blocks:n}){let r=n.filter(e=>e.status===`applied`).length,i=n.filter(e=>e.status===`skipped`).length,a=Math.min(100,e/t*100);return(0,v.jsxs)(`div`,{"data-slot":`session-context-meter`,children:[(0,v.jsx)(`div`,{role:`meter`,"aria-label":`Session context size`,"aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":e,"aria-valuetext":`${S(e)} of ${S(t)}`,className:`h-2 overflow-hidden rounded-full bg-muted`,children:(0,v.jsx)(`div`,{className:`h-full rounded-full bg-accent-strong`,style:{width:`${a}%`}})}),(0,v.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-x-3 text-[12px]`,children:[(0,v.jsxs)(`span`,{className:`text-muted-foreground`,children:[S(e),` used: `,r,` `,r===1?`block`:`blocks`,` applied`,i>0?`, ${i} skipped`:``]}),(0,v.jsxs)(`span`,{className:`ml-auto text-soft-foreground`,children:[`Limit 64 KiB (`,S(t),`)`]})]})]})}function w({block:e,role:t}){let n=e.status===`not-for-role`?`not for ${t}`:e.status,i=e.overridesShared?`local · overrides shared`:b[e.source],a=e.source===`built-in`||e.overridesShared,o=e.reason!==null&&!(e.status===`applied`&&e.overridesShared);return(0,v.jsxs)(`li`,{"data-slot":`session-context-block`,"data-status":e.status,"data-source":e.source,className:`flex flex-col gap-1.5 p-3`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:e.id}),(0,v.jsx)(u,{"data-slot":`session-context-source`,variant:`outline`,className:r(`text-xs`,a&&`border-accent-strong/40 text-link-foreground`),children:i}),e.target&&e.target!==`built-in`&&(0,v.jsx)(u,{variant:`outline`,className:`text-xs`,children:y[e.target]}),(0,v.jsx)(`span`,{className:`ml-auto font-mono text-[12px] text-soft-foreground`,children:e.bytes===null?`—`:S(e.bytes)}),(0,v.jsx)(u,{variant:`outline`,className:r(`text-xs`,x[e.status]),children:n})]}),o&&(0,v.jsx)(`p`,{className:`text-[12px] text-conflict`,children:e.reason}),e.text!==null&&(0,v.jsxs)(`pre`,{tabIndex:0,"aria-label":`${e.id} text`,className:`max-h-28 overflow-auto rounded-md bg-background px-2.5 py-2 font-mono text-[12px] whitespace-pre-wrap text-muted-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[e.text,e.truncated?`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{D as i,O as a,S as o}from"./queries-CIeJg62Y.js";import{Fn as s}from"./toaster-D0HMoto5.js";import{t as c}from"./plus-CxRU2X8C.js";import{t as l}from"./button-C8jUIs8Q.js";import{t as u}from"./badge-B6B-xYQQ.js";import{t as d}from"./centered-state-BgSV4e79.js";import{pr as f,tr as p}from"./index-zhwJL4R4.js";import{t as m}from"./code-editor-GfQChdgl.js";import{r as h}from"./settings-save-bar-CJjHCAfn.js";var g=e(t(),1);function _(e,t,n){let r=e.indexOf(t),i={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1};if(n===`Home`)return e[0];if(n===`End`)return e.at(-1);if(!(i[n]===void 0||r===-1))return e[(r+i[n]+e.length)%e.length]}var v=n(),y={"built-in":`built in`,parent:`parent`,worker:`worker`,both:`both`},b={"built-in":`built in`,shared:`shared`,local:`local`},x={applied:`border-success/40 text-success`,skipped:`border-conflict/50 text-conflict`,"not-for-role":`text-soft-foreground`},S=e=>`${e.toLocaleString(`en-US`)} B`;function ee({id:e,preview:t,role:n,onRole:i,pending:a,className:o}){return(0,v.jsxs)(`section`,{id:e,"data-slot":`session-context-preview`,"aria-labelledby":`session-context-preview-title`,"aria-busy":a,className:r(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,o),children:[(0,v.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-border p-3`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(`h3`,{id:`session-context-preview-title`,className:`text-sm font-semibold`,children:`Combined preview`}),(0,v.jsx)(`span`,{className:`ml-auto text-[12px] text-soft-foreground`,children:`Updates as you type`})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,v.jsx)(`span`,{id:`session-context-role`,className:`text-[12px] text-soft-foreground`,children:`Preview as`}),(0,v.jsx)(te,{role:n,onRole:i}),(0,v.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`Handoff, shared, then local. Files come from the project checkout.`})]}),t?(0,v.jsx)(ne,{used:t.usedBytes,limit:t.limitBytes,blocks:t.blocks}):(0,v.jsx)(`div`,{className:`h-[38px]`})]}),(0,v.jsx)(`ul`,{"data-slot":`session-context-blocks`,className:`divide-y divide-border`,children:t?.blocks.map((e,t)=>(0,v.jsx)(w,{block:e,role:n},`${e.source}-${e.id}-${t}`))})]})}var C=[`parent`,`worker`];function te({role:e,onRole:t}){let n=(0,g.useRef)(new Map);return(0,v.jsx)(`div`,{role:`radiogroup`,"aria-labelledby":`session-context-role`,onKeyDown:r=>{let i=_(C,e,r.key);i!==void 0&&(r.preventDefault(),t(i),n.current.get(i)?.focus())},className:`inline-flex overflow-hidden rounded-md border border-[var(--control-border)]`,children:C.map(i=>(0,v.jsx)(`button`,{ref:e=>{e?n.current.set(i,e):n.current.delete(i)},type:`button`,role:`radio`,"aria-checked":e===i,tabIndex:e===i?0:-1,"data-slot":`session-context-role`,onClick:()=>t(i),className:r(`min-h-11 px-4 text-[13px] capitalize text-muted-foreground focus-visible:outline-2 focus-visible:outline-ring`,e===i&&`bg-muted text-foreground`),children:i},i))})}function ne({used:e,limit:t,blocks:n}){let r=n.filter(e=>e.status===`applied`).length,i=n.filter(e=>e.status===`skipped`).length,a=Math.min(100,e/t*100);return(0,v.jsxs)(`div`,{"data-slot":`session-context-meter`,children:[(0,v.jsx)(`div`,{role:`meter`,"aria-label":`Session context size`,"aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":e,"aria-valuetext":`${S(e)} of ${S(t)}`,className:`h-2 overflow-hidden rounded-full bg-muted`,children:(0,v.jsx)(`div`,{className:`h-full rounded-full bg-accent-strong`,style:{width:`${a}%`}})}),(0,v.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-x-3 text-[12px]`,children:[(0,v.jsxs)(`span`,{className:`text-muted-foreground`,children:[S(e),` used: `,r,` `,r===1?`block`:`blocks`,` applied`,i>0?`, ${i} skipped`:``]}),(0,v.jsxs)(`span`,{className:`ml-auto text-soft-foreground`,children:[`Limit 64 KiB (`,S(t),`)`]})]})]})}function w({block:e,role:t}){let n=e.status===`not-for-role`?`not for ${t}`:e.status,i=e.overridesShared?`local · overrides shared`:b[e.source],a=e.source===`built-in`||e.overridesShared,o=e.reason!==null&&!(e.status===`applied`&&e.overridesShared);return(0,v.jsxs)(`li`,{"data-slot":`session-context-block`,"data-status":e.status,"data-source":e.source,className:`flex flex-col gap-1.5 p-3`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:e.id}),(0,v.jsx)(u,{"data-slot":`session-context-source`,variant:`outline`,className:r(`text-xs`,a&&`border-accent-strong/40 text-link-foreground`),children:i}),e.target&&e.target!==`built-in`&&(0,v.jsx)(u,{variant:`outline`,className:`text-xs`,children:y[e.target]}),(0,v.jsx)(`span`,{className:`ml-auto font-mono text-[12px] text-soft-foreground`,children:e.bytes===null?`—`:S(e.bytes)}),(0,v.jsx)(u,{variant:`outline`,className:r(`text-xs`,x[e.status]),children:n})]}),o&&(0,v.jsx)(`p`,{className:`text-[12px] text-conflict`,children:e.reason}),e.text!==null&&(0,v.jsxs)(`pre`,{tabIndex:0,"aria-label":`${e.id} text`,className:`max-h-28 overflow-auto rounded-md bg-background px-2.5 py-2 font-mono text-[12px] whitespace-pre-wrap text-muted-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[e.text,e.truncated?`
2
2
  …`:``]})]})}var re=Symbol.for(`yaml.alias`),ie=Symbol.for(`yaml.document`),T=Symbol.for(`yaml.map`),ae=Symbol.for(`yaml.pair`),E=Symbol.for(`yaml.scalar`),D=Symbol.for(`yaml.seq`),O=Symbol.for(`yaml.node.type`),k=e=>!!e&&typeof e==`object`&&e[O]===re,oe=e=>!!e&&typeof e==`object`&&e[O]===ie,A=e=>!!e&&typeof e==`object`&&e[O]===T,j=e=>!!e&&typeof e==`object`&&e[O]===ae,M=e=>!!e&&typeof e==`object`&&e[O]===E,se=e=>!!e&&typeof e==`object`&&e[O]===D;function N(e){if(e&&typeof e==`object`)switch(e[O]){case T:case D:return!0}return!1}function P(e){if(e&&typeof e==`object`)switch(e[O]){case re:case T:case E:case D:return!0}return!1}var ce=e=>(M(e)||N(e))&&!!e.anchor,F=Symbol(`break visit`),le=Symbol(`skip children`),I=Symbol(`remove node`);function ue(e,t){let n=me(t);oe(e)?de(null,e.contents,n,Object.freeze([e]))===I&&(e.contents=null):de(null,e,n,Object.freeze([]))}ue.BREAK=F,ue.SKIP=le,ue.REMOVE=I;function de(e,t,n,r){let i=he(e,t,n,r);if(P(i)||j(i))return ge(e,r,i),de(e,i,n,r);if(typeof i!=`symbol`){if(N(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=de(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===F)return F;else i===I&&(t.items.splice(e,1),--e)}}else if(j(t)){r=Object.freeze(r.concat(t));let e=de(`key`,t.key,n,r);if(e===F)return F;e===I&&(t.key=null);let i=de(`value`,t.value,n,r);if(i===F)return F;i===I&&(t.value=null)}}return i}async function fe(e,t){let n=me(t);oe(e)?await pe(null,e.contents,n,Object.freeze([e]))===I&&(e.contents=null):await pe(null,e,n,Object.freeze([]))}fe.BREAK=F,fe.SKIP=le,fe.REMOVE=I;async function pe(e,t,n,r){let i=await he(e,t,n,r);if(P(i)||j(i))return ge(e,r,i),pe(e,i,n,r);if(typeof i!=`symbol`){if(N(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=await pe(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===F)return F;else i===I&&(t.items.splice(e,1),--e)}}else if(j(t)){r=Object.freeze(r.concat(t));let e=await pe(`key`,t.key,n,r);if(e===F)return F;e===I&&(t.key=null);let i=await pe(`value`,t.value,n,r);if(i===F)return F;i===I&&(t.value=null)}}return i}function me(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function he(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(A(t))return n.Map?.(e,t,r);if(se(t))return n.Seq?.(e,t,r);if(j(t))return n.Pair?.(e,t,r);if(M(t))return n.Scalar?.(e,t,r);if(k(t))return n.Alias?.(e,t,r)}function ge(e,t,n){let r=t[t.length-1];if(N(r))r.items[e]=n;else if(j(r))e===`key`?r.key=n:r.value=n;else if(oe(r))r.contents=n;else{let e=k(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var _e={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},ve=e=>e.replace(/[!,[\]{}]/g,e=>_e[e]),L=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+ve(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&P(e.contents)){let t={};ue(e.contents,(e,n)=>{P(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
3
3
  `)}};L.defaultYaml={explicit:!1,version:`1.2`},L.defaultTags={"!!":`tag:yaml.org,2002:`};function ye(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function be(e){let t=new Set;return ue(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function xe(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function Se(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=be(e);let a=xe(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(M(t.node)||N(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function R(e,t,n,r){if(r&&typeof r==`object`)if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=R(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=R(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=R(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=R(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}return e.call(t,n,r)}function z(e,t,n){if(Array.isArray(e))return e.map((e,t)=>z(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!ce(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var Ce=class{constructor(e){Object.defineProperty(this,O,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!oe(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=z(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?R(i,{"":o},``,o):o}},we=class extends Ce{constructor(e){super(re),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],ue(e,{Node:(e,t)=>{(k(t)||ce(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(z(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=Te(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(ye(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function Te(e,t,n){if(k(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(N(t)){let r=0;for(let i of t.items){let t=Te(e,i,n);t>r&&(r=t)}return r}else if(j(t)){let r=Te(e,t.key,n),i=Te(e,t.value,n);return Math.max(r,i)}return 1}var Ee=e=>!e||typeof e!=`function`&&typeof e!=`object`,B=class extends Ce{constructor(e){super(E),this.value=e}toJSON(e,t){return t?.keep?this.value:z(this.value,e,t)}toString(){return String(this.value)}};B.BLOCK_FOLDED=`BLOCK_FOLDED`,B.BLOCK_LITERAL=`BLOCK_LITERAL`,B.PLAIN=`PLAIN`,B.QUOTE_DOUBLE=`QUOTE_DOUBLE`,B.QUOTE_SINGLE=`QUOTE_SINGLE`;var De=`tag:yaml.org,2002:`;function Oe(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function ke(e,t,n){if(oe(e)&&(e=e.contents),P(e))return e;if(j(e)){let t=n.schema[T].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??=i(e),new we(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=De+t.slice(2));let l=Oe(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new B(e);return c&&(c.node=t),t}l=e instanceof Map?o[T]:Symbol.iterator in Object(e)?o[D]:o[T]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new B(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function Ae(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return ke(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var je=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,Me=class extends Ce{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>P(t)||j(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(je(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(N(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,Ae(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(N(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&M(i)?i.value:i:N(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!j(t))return!1;let n=t.value;return n==null||e&&M(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return N(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(N(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,Ae(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},Ne=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function V(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var H=(e,t,n)=>e.endsWith(`
4
4
  `)?V(n,t):n.includes(`
@@ -116,4 +116,4 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
116
116
  `),$(`${n} - id: `,t,`${kr(` `)}\n`)}function Ir(e,t,n){if(!se(t)||!t.range)return;let r=t.items.at(-1);if(t.flow)return Mr(e,t.range[0],r,n);let i=t.items[0]?.range?.[0];return i===void 0?void 0:Nr(e,i,t.range[1],n)}function Lr(e,t=``){let n=Er(e,t);if(e.trim()===``)return Fr(`version: 1
117
117
  `,n);let r=xr(e),i=r.errors.length===0&&A(r.contents)?r.contents:void 0,a=i?.items.find(e=>M(e.key)&&e.key.value===`rules`),o=a?.value,s=M(a?.key)?a.key.range?.[0]:void 0;return s!==void 0&&(o===null||M(o)&&o.value===null)?jr(e,s,o,i?.flow===!0,n):Ir(e,o,n)||(!a&&i?.flow&&i.range?Pr(e,i.range[1],i.items.length>0,n):Fr(e,n))}function Rr(e,t,n,r){let i=`{{${r}}}`,a=e.slice(0,t)+i+e.slice(n);if(r.startsWith(`file:`)){let e=t+7;return{text:a,select:[e,e+r.length-5]}}let o=t+i.length;return{text:a,select:[o,o]}}function zr(e,t){let n=0;for(let r=1;r<t;r++){let t=e.indexOf(`
118
118
  `,n);if(t===-1)return[e.length,e.length];n=t+1}let r=e.indexOf(`
119
- `,n);return[n,r===-1?e.length:r]}var Br=`https://github.com/hearsay-tools/squawk/blob/main/docs/context-injection.md`;function Vr(){let e=i();return(0,v.jsxs)(`div`,{"data-slot":`session-context`,className:`flex flex-col gap-4 p-4 md:p-6`,children:[(0,v.jsx)(Hr,{}),e.data===void 0?e.isError?(0,v.jsx)(d,{icon:(0,v.jsx)(p,{}),tone:`danger`,title:`Session context did not load`,subtitle:e.error.message,heading:`h2`,actions:(0,v.jsx)(l,{variant:`outline`,onClick:()=>void e.refetch(),children:`Try again`})}):(0,v.jsx)(Ur,{}):(0,v.jsxs)(v.Fragment,{children:[e.isError&&(0,v.jsxs)(`p`,{"data-slot":`session-context-reload-error`,role:`alert`,className:`text-[13px] text-danger`,children:[`Could not read session context again: `,e.error.message]}),(0,v.jsx)(Kr,{state:e.data,refetch:()=>e.refetch()},e.data.local.path)]})]})}function Hr(){return(0,v.jsx)(`div`,{"data-slot":`session-context-handoff`,className:`flex items-start gap-3 rounded-lg border border-border bg-card p-3`,children:(0,v.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Handoff block`}),(0,v.jsx)(u,{variant:`outline`,className:`border-accent-strong/40 text-xs text-link-foreground`,children:`Built in · always first`})]}),(0,v.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Each task’s own handoff file: Goal, Progress log and Resume notes. It needs no setup and cannot be turned off. Shared and local rules come after it.`})]})})}function Ur(){return(0,v.jsxs)(`div`,{"data-slot":`session-context-loading`,"aria-busy":`true`,"aria-label":`Loading session context`,className:`grid gap-4 md:grid-cols-[minmax(0,1.15fr)_minmax(0,1fr)]`,children:[(0,v.jsx)(f,{className:`h-[420px] rounded-lg`}),(0,v.jsx)(f,{className:`h-[420px] rounded-lg max-md:hidden`})]})}function Wr(e,t=250){let[n,r]=(0,g.useState)(e);return(0,g.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function Gr(e,t,n){let[r,i]=(0,g.useState)(null),[c,l]=(0,g.useState)(null),u=(0,g.useRef)(r);u.current=r;let d=(0,g.useRef)(!0);(0,g.useEffect)(()=>(d.current=!0,()=>{d.current=!1}),[]);let f=t=>{l(t=>t??{version:e.version}),i(t)},[p,m]=(0,g.useState)(`parent`),[h,_]=(0,g.useState)(`edit`),[v,y]=(0,g.useState)(`local`),[b,x]=(0,g.useState)(null),[S,ee]=(0,g.useState)(!1),C=(0,g.useRef)(null),[te,ne]=(0,g.useState)(null),w=r??e.content,re=w!==e.content,ie=Wr(w),T=a(ie,p,`${t.path}|${t.exists?`1`:`0`}|${t.unreadableReason??``}|${t.content}`),ae=T.data!==void 0&&!T.isPlaceholderData&&!T.isError&&ie===w,E=T.isError&&!T.isFetching&&ie===w?T.error.message:null,D=(0,g.useMemo)(()=>T.data?.problems??[],[T.data]),O=o();(0,g.useLayoutEffect)(()=>{!te||!C.current||(C.current.focus(),C.current.setSelectionRange(te[0],te[1]),ne(null))},[te]);let k=e=>{f(e.text),y(`local`),_(`edit`),ne(e.select)};return{localStarted:e.exists||r!==null,content:w,dirty:re,setDraft:f,role:p,setRole:m,pane:h,setPane:_,scope:v,setScope:y,failure:b,showDisk:S,toggleDisk:()=>ee(e=>!e),inputRef:C,preview:T.data,current:ae,problems:D,previewError:E,retryPreview:()=>void T.refetch(),saving:O.isPending,edit:k,insert:e=>{let t=C.current;k(Rr(w,t?.selectionStart??w.length,t?.selectionEnd??w.length,e))},goToLine:e=>{y(`local`),_(`edit`),ne(zr(w,e))},discard:()=>{i(null),l(null),x(null)},save:(t=!1)=>{let r=t||c===null?e.version:c.version;x(null);let a=w;return O.mutateAsync({content:a,version:r}).then(e=>{if(!d.current)return;let t=u.current!==null&&u.current!==a;i(t?u.current:null),l(t?{version:e.local.version}:null),ee(!1)},e=>{if(!d.current)throw e;let t=e instanceof s&&e.status===409;throw x({kind:t?`conflict`:`error`,message:e instanceof Error?e.message:String(e)}),t&&n(),e})}}}function Kr({state:e,refetch:t}){let{local:n,shared:i}=e,a=Gr(n,i,t),{content:o,problems:s,current:c}=a,u=n.writable,d=(0,g.useMemo)(()=>new Set(s.flatMap(e=>e.line===null?[]:[e.line])),[s]);return h({dirty:a.dirty,invalid:!u||!c||s.length>0,busy:a.saving,save:()=>a.save(),discard:a.discard}),!a.localStarted&&!i.exists?(0,v.jsx)(li,{localPath:n.path,sharedPath:i.path,readOnlyReason:n.readOnlyReason,onAdd:u?()=>a.edit(Lr(``,i.content)):void 0}):(0,v.jsxs)(`div`,{"data-slot":`session-context-editor`,"data-reports-dirty":``,className:`flex flex-col gap-4`,children:[!u&&a.scope===`local`&&(0,v.jsx)(ci,{reason:n.readOnlyReason}),a.failure&&u&&(0,v.jsx)(si,{failure:a.failure,showDisk:a.showDisk,onShowDisk:a.toggleDisk,onOverwrite:()=>void a.save(!0).catch(()=>{})}),a.showDisk&&(0,v.jsx)(ni,{content:n.content}),a.previewError&&(0,v.jsxs)(`div`,{"data-slot":`session-context-preview-error`,role:`alert`,className:`flex flex-wrap items-center gap-3 rounded-lg border border-danger/45 bg-danger/10 p-3 text-[13px]`,children:[(0,v.jsxs)(`span`,{className:`mr-auto`,children:[`The preview failed: `,a.previewError,`. Save stays off until the draft is checked.`]}),(0,v.jsx)(l,{variant:`outline`,onClick:a.retryPreview,children:`Check again`})]}),s.length>0&&(0,v.jsx)(ai,{problems:s,onLine:a.goToLine}),(0,v.jsx)(ti,{pane:a.pane,onPane:a.setPane}),(0,v.jsxs)(`div`,{className:`grid items-start gap-4 md:grid-cols-[minmax(0,1.15fr)_minmax(0,1fr)]`,children:[(0,v.jsxs)(`section`,{id:ei.edit,"data-slot":`session-context-file`,"aria-label":`Session context rules`,className:r(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,a.pane!==`edit`&&`max-md:hidden`),children:[(0,v.jsx)(Yr,{scope:a.scope,onScope:a.setScope,dirty:a.dirty,shared:i}),a.scope===`local`?(0,v.jsx)(Xr,{file:n,sharedPath:i.path,started:a.localStarted,content:o,dirty:a.dirty,problems:s.length,current:c,previewFailed:a.previewError!==null,marked:d,inputRef:a.inputRef,onDraft:a.setDraft,onAdd:()=>a.edit(Lr(o,i.content)),onInsert:a.insert}):(0,v.jsx)(Qr,{shared:i,onOpenLocal:()=>a.setScope(`local`)})]}),(0,v.jsx)(ee,{id:ei.preview,preview:a.preview,role:a.role,onRole:a.setRole,pending:!c,className:r(a.pane!==`preview`&&`max-md:hidden`)})]}),(a.localStarted||a.dirty)&&(0,v.jsx)(ri,{localPath:n.path,hasProblems:s.length>0})]})}var qr=[`local`,`shared`],Jr={local:`session-context-local-panel`,shared:`session-context-shared-panel`};function Yr({scope:e,onScope:t,dirty:n,shared:i}){let a=(0,g.useRef)(new Map);return(0,v.jsx)(`div`,{role:`tablist`,"aria-label":`Context rule layer`,onKeyDown:n=>{let r=_(qr,e,n.key);r!==void 0&&(n.preventDefault(),t(r),a.current.get(r)?.focus())},className:`flex border-b border-border bg-muted/30`,children:qr.map(o=>{let s=e===o;return(0,v.jsxs)(`button`,{ref:e=>{e?a.current.set(o,e):a.current.delete(o)},type:`button`,role:`tab`,tabIndex:s?0:-1,"aria-selected":s,"aria-controls":Jr[o],"data-slot":`session-context-scope`,"data-scope":o,onClick:()=>t(o),className:r(`flex min-h-11 flex-1 items-center justify-center gap-2 border-b-2 border-transparent px-3 py-3 text-[13px] leading-5 font-medium text-muted-foreground focus-visible:outline-2 focus-visible:outline-ring`,s&&`border-accent-strong bg-card text-foreground`),children:[(0,v.jsx)(`span`,{children:o===`local`?`Local`:`Shared`}),o===`local`&&n&&(0,v.jsx)(`span`,{className:`text-xs text-conflict`,children:`· Unsaved`}),o===`shared`&&i.tracked&&(0,v.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`· Tracked`})]},o)})})}function Xr(e){let{file:t,started:n,content:r}=e,i=t.writable;return(0,v.jsxs)(`div`,{id:Jr.local,role:`tabpanel`,className:`flex flex-col`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border p-3`,children:[(0,v.jsx)(`code`,{className:`font-mono text-[12px] break-all`,children:t.path}),(0,v.jsx)(u,{variant:`outline`,className:`text-xs`,children:`Gitignored · local`}),n&&(0,v.jsx)(ii,{problems:e.problems,current:e.current,failed:e.previewFailed,dirty:e.dirty}),i&&n&&(0,v.jsxs)(l,{"data-slot":`session-context-add-rule`,variant:`outline`,className:`ml-auto min-h-11`,onClick:e.onAdd,children:[(0,v.jsx)(c,{}),` Add rule`]})]}),n?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(m,{value:r,onChange:i?e.onDraft:void 0,readOnly:!i,language:`yaml`,markedLines:e.marked,inputRef:e.inputRef,"aria-label":`context.local.yaml rules`,className:`h-[420px] rounded-none border-0`}),i&&(0,v.jsx)(oi,{onInsert:e.onInsert})]}):(0,v.jsxs)(`div`,{"data-slot":`session-context-local-empty`,className:`flex flex-col items-start gap-3 p-4`,children:[(0,v.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`No local rules yet. Local rules live in `,(0,v.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:t.path}),` (auto-ignored by Git) and run after shared rules from `,(0,v.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:e.sharedPath}),`. Reuse a shared rule’s `,(0,v.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:`id`}),` to replace it locally, or set `,(0,v.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:`enabled: false`}),` to mute it.`]}),i&&(0,v.jsxs)(l,{"data-slot":`session-context-add-rule`,className:`min-h-11`,onClick:e.onAdd,children:[(0,v.jsx)(c,{}),` Add a local rule`]})]})]})}function Zr({shared:e}){return e.exists?e.tracked?(0,v.jsx)(u,{"data-slot":`session-context-shared-status`,variant:`outline`,className:`border-accent-strong/40 text-xs text-link-foreground`,children:`Tracked in Git`}):(0,v.jsx)(u,{"data-slot":`session-context-shared-status`,variant:`outline`,className:`text-xs`,children:`Untracked · repo file`}):(0,v.jsx)(u,{"data-slot":`session-context-shared-status`,variant:`outline`,className:`text-xs`,children:`Not in repo`})}function Qr({shared:e,onOpenLocal:t}){return(0,v.jsxs)(`div`,{id:Jr.shared,role:`tabpanel`,"data-slot":`session-context-shared`,className:`flex flex-col`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border p-3`,children:[(0,v.jsx)(`code`,{className:`font-mono text-[12px] break-all`,children:e.path}),(0,v.jsx)(Zr,{shared:e}),(0,v.jsx)(u,{variant:`outline`,className:`text-xs`,children:`Read only`})]}),(0,v.jsx)(`p`,{"data-slot":`session-context-shared-note`,className:`border-b border-border bg-muted/30 px-3 py-2 text-[12px] text-muted-foreground`,children:`Shared team rules are versioned in Git and read only here. To replace or mute a rule on this host without dirtying Git, add a rule with the same id in Local.`}),e.unreadableReason?(0,v.jsx)(`div`,{className:`p-3`,children:(0,v.jsx)(ci,{reason:e.unreadableReason})}):e.exists?(0,v.jsx)(m,{value:e.content,language:`yaml`,readOnly:!0,"aria-label":`context.yaml shared rules`,className:`h-[420px] rounded-none border-0`}):(0,v.jsxs)(`div`,{className:`flex flex-col items-start gap-3 p-4`,children:[(0,v.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`This repository has no shared `,(0,v.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:e.path}),` yet. Commit one to share team rules across contributors, or add host-only rules in Local.`]}),(0,v.jsx)(l,{variant:`outline`,className:`min-h-11`,onClick:t,children:`Edit Local rules`})]})]})}var $r=[`edit`,`preview`],ei={edit:`session-context-edit-panel`,preview:`session-context-preview-panel`};function ti({pane:e,onPane:t}){let n=(0,g.useRef)(new Map);return(0,v.jsx)(`div`,{role:`tablist`,"aria-label":`Session context view`,onKeyDown:r=>{let i=_($r,e,r.key);i!==void 0&&(r.preventDefault(),t(i),n.current.get(i)?.focus())},className:`flex overflow-hidden rounded-md border border-[var(--control-border)] md:hidden`,children:$r.map(i=>(0,v.jsx)(`button`,{ref:e=>{e?n.current.set(i,e):n.current.delete(i)},type:`button`,tabIndex:e===i?0:-1,"aria-controls":ei[i],role:`tab`,"data-slot":`session-context-pane`,"data-pane":i,"aria-selected":e===i,onClick:()=>t(i),className:r(`min-h-11 flex-1 text-[13px] capitalize text-muted-foreground`,e===i&&`bg-muted text-foreground`),children:i},i))})}function ni({content:e}){return(0,v.jsxs)(`div`,{"data-slot":`session-context-disk`,className:`flex flex-col gap-2`,children:[(0,v.jsx)(`h3`,{className:`text-sm font-semibold`,children:`On disk now`}),(0,v.jsx)(m,{value:e,language:`yaml`,readOnly:!0,"aria-label":`context.local.yaml on disk`,className:`h-[200px]`})]})}function ri({localPath:e,hasProblems:t}){return(0,v.jsx)(`p`,{"data-slot":`session-context-note`,className:`text-[12px] text-soft-foreground`,children:t?`Save is off while the file has problems.`:`Applies from the next session launch. Saved to ${e} (gitignored; does not dirty Git).`})}function ii({problems:e,current:t,failed:n,dirty:r}){return(0,v.jsxs)(`span`,{className:`flex flex-wrap gap-1.5`,"aria-live":`polite`,children:[t&&e>0&&(0,v.jsxs)(u,{variant:`outline`,className:`border-danger/45 text-xs text-danger`,children:[e,` `,e===1?`problem`:`problems`]}),t&&e===0&&(0,v.jsx)(u,{variant:`outline`,className:`border-success/40 text-xs text-success`,children:`Valid`}),!t&&!n&&(0,v.jsx)(u,{variant:`outline`,className:`text-xs`,children:`Checking…`}),n&&(0,v.jsx)(u,{variant:`outline`,className:`border-danger/45 text-xs text-danger`,children:`Not checked`}),r&&(0,v.jsx)(u,{variant:`outline`,className:`border-conflict/50 text-xs text-conflict`,children:`Unsaved`})]})}function ai({problems:e,onLine:t}){return(0,v.jsxs)(`div`,{"data-slot":`session-context-problems`,role:`alert`,className:`rounded-lg border border-danger/45 bg-danger/10 p-3`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsxs)(`h3`,{className:`text-sm font-semibold text-danger`,children:[e.length,` `,e.length===1?`problem`:`problems`,`: fix `,e.length===1?`it`:`them`,` to save`]}),(0,v.jsx)(`span`,{className:`ml-auto text-[12px] text-soft-foreground`,children:`Your draft is kept until you save or discard it.`})]}),(0,v.jsx)(`ul`,{className:`mt-1.5 flex flex-col`,children:e.map((e,n)=>(0,v.jsxs)(`li`,{className:`text-[13px] leading-6`,children:[e.line!==null&&(0,v.jsxs)(`button`,{type:`button`,"data-slot":`session-context-line`,onClick:()=>t(e.line),className:`inline-flex min-h-11 items-center align-middle text-link-foreground underline-offset-2 hover:underline focus-visible:outline-2 focus-visible:outline-ring md:min-h-8`,children:[`Line `,e.line]}),e.line!==null&&(0,v.jsx)(`span`,{"aria-hidden":`true`,className:`text-soft-foreground`,children:` · `}),e.rule!==null&&(0,v.jsxs)(`span`,{className:`text-muted-foreground`,children:[`rule `,e.rule,`: `]}),(0,v.jsx)(`span`,{"data-slot":`session-context-problem`,children:e.message})]},n))})]})}function oi({onInsert:e}){return(0,v.jsxs)(`div`,{"data-slot":`session-context-tokens`,className:`flex flex-col gap-2 border-t border-border p-3`,children:[(0,v.jsx)(`span`,{id:`session-context-tokens`,className:`text-[12px] text-soft-foreground`,children:`Insert a variable`}),(0,v.jsx)(`div`,{role:`group`,"aria-labelledby":`session-context-tokens`,className:`flex flex-wrap gap-1.5`,children:Sr.map(t=>(0,v.jsx)(`button`,{type:`button`,onClick:()=>e(t),className:`min-h-8 rounded-md bg-muted px-2 font-mono text-[12px] text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring pointer-coarse:min-h-11`,children:`{{${t.startsWith(`file:`)?Cr:t}}}`},t))})]})}function si({failure:e,showDisk:t,onShowDisk:n,onOverwrite:r}){return(0,v.jsxs)(`div`,{"data-slot":`session-context-save-failure`,role:`alert`,className:`rounded-lg border border-danger/45 bg-danger/10 p-3`,children:[(0,v.jsx)(`h3`,{className:`text-sm font-semibold text-danger`,children:e.kind===`conflict`?`Not saved: the file changed on disk`:`Not saved`}),(0,v.jsxs)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:[e.message,` Your draft is still here.`]}),e.kind===`conflict`&&(0,v.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,v.jsx)(l,{variant:`outline`,className:`min-h-11`,onClick:n,children:t?`Hide the disk version`:`Show the disk version`}),(0,v.jsx)(l,{variant:`outline`,className:`min-h-11`,onClick:r,children:`Overwrite it`})]})]})}function ci({reason:e}){return(0,v.jsxs)(`div`,{"data-slot":`session-context-readonly`,className:`rounded-md border border-border bg-muted/40 px-3 py-2 text-[13px] text-muted-foreground`,children:[`Read only. `,e]})}function li({localPath:e,sharedPath:t,readOnlyReason:n,onAdd:r}){return(0,v.jsx)(`div`,{"data-slot":`session-context-empty`,className:`rounded-lg border border-border bg-card`,children:(0,v.jsx)(d,{icon:(0,v.jsx)(p,{}),title:`No project rules yet`,heading:`h2`,subtitle:`Every session already starts with its handoff block. Commit shared team rules in ${t}, or add host-local rules in ${e} (gitignored; overrides shared rules with the same id).`,actions:(0,v.jsxs)(v.Fragment,{children:[r&&(0,v.jsx)(l,{className:`min-h-11`,onClick:r,children:`Add a local rule`}),(0,v.jsx)(l,{variant:`outline`,className:`min-h-11`,asChild:!0,children:(0,v.jsx)(`a`,{href:Br,target:`_blank`,rel:`noreferrer`,children:`How rules work`})})]}),children:n&&(0,v.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`Read only. `,n]})})})}export{Vr as SessionContextSection};
119
+ `,n);return[n,r===-1?e.length:r]}var Br=`https://github.com/hearsay-tools/squawk/blob/main/docs/context-injection.md`;function Vr(){let e=i();return(0,v.jsxs)(`div`,{"data-slot":`session-context`,className:`flex flex-col gap-4 p-4 md:p-6`,children:[(0,v.jsx)(Hr,{}),e.data===void 0?e.isError?(0,v.jsx)(d,{icon:(0,v.jsx)(f,{}),tone:`danger`,title:`Session context did not load`,subtitle:e.error.message,heading:`h2`,actions:(0,v.jsx)(l,{variant:`outline`,onClick:()=>void e.refetch(),children:`Try again`})}):(0,v.jsx)(Ur,{}):(0,v.jsxs)(v.Fragment,{children:[e.isError&&(0,v.jsxs)(`p`,{"data-slot":`session-context-reload-error`,role:`alert`,className:`text-[13px] text-danger`,children:[`Could not read session context again: `,e.error.message]}),(0,v.jsx)(Kr,{state:e.data,refetch:()=>e.refetch()},e.data.local.path)]})]})}function Hr(){return(0,v.jsx)(`div`,{"data-slot":`session-context-handoff`,className:`flex items-start gap-3 rounded-lg border border-border bg-card p-3`,children:(0,v.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Handoff block`}),(0,v.jsx)(u,{variant:`outline`,className:`border-accent-strong/40 text-xs text-link-foreground`,children:`Built in · always first`})]}),(0,v.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Each task’s own handoff file: Goal, Progress log and Resume notes. It needs no setup and cannot be turned off. Shared and local rules come after it.`})]})})}function Ur(){return(0,v.jsxs)(`div`,{"data-slot":`session-context-loading`,"aria-busy":`true`,"aria-label":`Loading session context`,className:`grid gap-4 md:grid-cols-[minmax(0,1.15fr)_minmax(0,1fr)]`,children:[(0,v.jsx)(p,{className:`h-[420px] rounded-lg`}),(0,v.jsx)(p,{className:`h-[420px] rounded-lg max-md:hidden`})]})}function Wr(e,t=250){let[n,r]=(0,g.useState)(e);return(0,g.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function Gr(e,t,n){let[r,i]=(0,g.useState)(null),[c,l]=(0,g.useState)(null),u=(0,g.useRef)(r);u.current=r;let d=(0,g.useRef)(!0);(0,g.useEffect)(()=>(d.current=!0,()=>{d.current=!1}),[]);let f=t=>{l(t=>t??{version:e.version}),i(t)},[p,m]=(0,g.useState)(`parent`),[h,_]=(0,g.useState)(`edit`),[v,y]=(0,g.useState)(`local`),[b,x]=(0,g.useState)(null),[S,ee]=(0,g.useState)(!1),C=(0,g.useRef)(null),[te,ne]=(0,g.useState)(null),w=r??e.content,re=w!==e.content,ie=Wr(w),T=a(ie,p,`${t.path}|${t.exists?`1`:`0`}|${t.unreadableReason??``}|${t.content}`),ae=T.data!==void 0&&!T.isPlaceholderData&&!T.isError&&ie===w,E=T.isError&&!T.isFetching&&ie===w?T.error.message:null,D=(0,g.useMemo)(()=>T.data?.problems??[],[T.data]),O=o();(0,g.useLayoutEffect)(()=>{!te||!C.current||(C.current.focus(),C.current.setSelectionRange(te[0],te[1]),ne(null))},[te]);let k=e=>{f(e.text),y(`local`),_(`edit`),ne(e.select)};return{localStarted:e.exists||r!==null,content:w,dirty:re,setDraft:f,role:p,setRole:m,pane:h,setPane:_,scope:v,setScope:y,failure:b,showDisk:S,toggleDisk:()=>ee(e=>!e),inputRef:C,preview:T.data,current:ae,problems:D,previewError:E,retryPreview:()=>void T.refetch(),saving:O.isPending,edit:k,insert:e=>{let t=C.current;k(Rr(w,t?.selectionStart??w.length,t?.selectionEnd??w.length,e))},goToLine:e=>{y(`local`),_(`edit`),ne(zr(w,e))},discard:()=>{i(null),l(null),x(null)},save:(t=!1)=>{let r=t||c===null?e.version:c.version;x(null);let a=w;return O.mutateAsync({content:a,version:r}).then(e=>{if(!d.current)return;let t=u.current!==null&&u.current!==a;i(t?u.current:null),l(t?{version:e.local.version}:null),ee(!1)},e=>{if(!d.current)throw e;let t=e instanceof s&&e.status===409;throw x({kind:t?`conflict`:`error`,message:e instanceof Error?e.message:String(e)}),t&&n(),e})}}}function Kr({state:e,refetch:t}){let{local:n,shared:i}=e,a=Gr(n,i,t),{content:o,problems:s,current:c}=a,u=n.writable,d=(0,g.useMemo)(()=>new Set(s.flatMap(e=>e.line===null?[]:[e.line])),[s]);return h({dirty:a.dirty,invalid:!u||!c||s.length>0,busy:a.saving,save:()=>a.save(),discard:a.discard}),!a.localStarted&&!i.exists?(0,v.jsx)(li,{localPath:n.path,sharedPath:i.path,readOnlyReason:n.readOnlyReason,onAdd:u?()=>a.edit(Lr(``,i.content)):void 0}):(0,v.jsxs)(`div`,{"data-slot":`session-context-editor`,"data-reports-dirty":``,className:`flex flex-col gap-4`,children:[!u&&a.scope===`local`&&(0,v.jsx)(ci,{reason:n.readOnlyReason}),a.failure&&u&&(0,v.jsx)(si,{failure:a.failure,showDisk:a.showDisk,onShowDisk:a.toggleDisk,onOverwrite:()=>void a.save(!0).catch(()=>{})}),a.showDisk&&(0,v.jsx)(ni,{content:n.content}),a.previewError&&(0,v.jsxs)(`div`,{"data-slot":`session-context-preview-error`,role:`alert`,className:`flex flex-wrap items-center gap-3 rounded-lg border border-danger/45 bg-danger/10 p-3 text-[13px]`,children:[(0,v.jsxs)(`span`,{className:`mr-auto`,children:[`The preview failed: `,a.previewError,`. Save stays off until the draft is checked.`]}),(0,v.jsx)(l,{variant:`outline`,onClick:a.retryPreview,children:`Check again`})]}),s.length>0&&(0,v.jsx)(ai,{problems:s,onLine:a.goToLine}),(0,v.jsx)(ti,{pane:a.pane,onPane:a.setPane}),(0,v.jsxs)(`div`,{className:`grid items-start gap-4 md:grid-cols-[minmax(0,1.15fr)_minmax(0,1fr)]`,children:[(0,v.jsxs)(`section`,{id:ei.edit,"data-slot":`session-context-file`,"aria-label":`Session context rules`,className:r(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,a.pane!==`edit`&&`max-md:hidden`),children:[(0,v.jsx)(Yr,{scope:a.scope,onScope:a.setScope,dirty:a.dirty,shared:i}),a.scope===`local`?(0,v.jsx)(Xr,{file:n,sharedPath:i.path,started:a.localStarted,content:o,dirty:a.dirty,problems:s.length,current:c,previewFailed:a.previewError!==null,marked:d,inputRef:a.inputRef,onDraft:a.setDraft,onAdd:()=>a.edit(Lr(o,i.content)),onInsert:a.insert}):(0,v.jsx)(Qr,{shared:i,onOpenLocal:()=>a.setScope(`local`)})]}),(0,v.jsx)(ee,{id:ei.preview,preview:a.preview,role:a.role,onRole:a.setRole,pending:!c,className:r(a.pane!==`preview`&&`max-md:hidden`)})]}),(a.localStarted||a.dirty)&&(0,v.jsx)(ri,{localPath:n.path,hasProblems:s.length>0})]})}var qr=[`local`,`shared`],Jr={local:`session-context-local-panel`,shared:`session-context-shared-panel`};function Yr({scope:e,onScope:t,dirty:n,shared:i}){let a=(0,g.useRef)(new Map);return(0,v.jsx)(`div`,{role:`tablist`,"aria-label":`Context rule layer`,onKeyDown:n=>{let r=_(qr,e,n.key);r!==void 0&&(n.preventDefault(),t(r),a.current.get(r)?.focus())},className:`flex border-b border-border bg-muted/30`,children:qr.map(o=>{let s=e===o;return(0,v.jsxs)(`button`,{ref:e=>{e?a.current.set(o,e):a.current.delete(o)},type:`button`,role:`tab`,tabIndex:s?0:-1,"aria-selected":s,"aria-controls":Jr[o],"data-slot":`session-context-scope`,"data-scope":o,onClick:()=>t(o),className:r(`flex min-h-11 flex-1 items-center justify-center gap-2 border-b-2 border-transparent px-3 py-3 text-[13px] leading-5 font-medium text-muted-foreground focus-visible:outline-2 focus-visible:outline-ring`,s&&`border-accent-strong bg-card text-foreground`),children:[(0,v.jsx)(`span`,{children:o===`local`?`Local`:`Shared`}),o===`local`&&n&&(0,v.jsx)(`span`,{className:`text-xs text-conflict`,children:`· Unsaved`}),o===`shared`&&i.tracked&&(0,v.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`· Tracked`})]},o)})})}function Xr(e){let{file:t,started:n,content:r}=e,i=t.writable;return(0,v.jsxs)(`div`,{id:Jr.local,role:`tabpanel`,className:`flex flex-col`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border p-3`,children:[(0,v.jsx)(`code`,{className:`font-mono text-[12px] break-all`,children:t.path}),(0,v.jsx)(u,{variant:`outline`,className:`text-xs`,children:`Gitignored · local`}),n&&(0,v.jsx)(ii,{problems:e.problems,current:e.current,failed:e.previewFailed,dirty:e.dirty}),i&&n&&(0,v.jsxs)(l,{"data-slot":`session-context-add-rule`,variant:`outline`,className:`ml-auto min-h-11`,onClick:e.onAdd,children:[(0,v.jsx)(c,{}),` Add rule`]})]}),n?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(m,{value:r,onChange:i?e.onDraft:void 0,readOnly:!i,language:`yaml`,markedLines:e.marked,inputRef:e.inputRef,"aria-label":`context.local.yaml rules`,className:`h-[420px] rounded-none border-0`}),i&&(0,v.jsx)(oi,{onInsert:e.onInsert})]}):(0,v.jsxs)(`div`,{"data-slot":`session-context-local-empty`,className:`flex flex-col items-start gap-3 p-4`,children:[(0,v.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`No local rules yet. Local rules live in `,(0,v.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:t.path}),` (auto-ignored by Git) and run after shared rules from `,(0,v.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:e.sharedPath}),`. Reuse a shared rule’s `,(0,v.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:`id`}),` to replace it locally, or set `,(0,v.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:`enabled: false`}),` to mute it.`]}),i&&(0,v.jsxs)(l,{"data-slot":`session-context-add-rule`,className:`min-h-11`,onClick:e.onAdd,children:[(0,v.jsx)(c,{}),` Add a local rule`]})]})]})}function Zr({shared:e}){return e.exists?e.tracked?(0,v.jsx)(u,{"data-slot":`session-context-shared-status`,variant:`outline`,className:`border-accent-strong/40 text-xs text-link-foreground`,children:`Tracked in Git`}):(0,v.jsx)(u,{"data-slot":`session-context-shared-status`,variant:`outline`,className:`text-xs`,children:`Untracked · repo file`}):(0,v.jsx)(u,{"data-slot":`session-context-shared-status`,variant:`outline`,className:`text-xs`,children:`Not in repo`})}function Qr({shared:e,onOpenLocal:t}){return(0,v.jsxs)(`div`,{id:Jr.shared,role:`tabpanel`,"data-slot":`session-context-shared`,className:`flex flex-col`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border p-3`,children:[(0,v.jsx)(`code`,{className:`font-mono text-[12px] break-all`,children:e.path}),(0,v.jsx)(Zr,{shared:e}),(0,v.jsx)(u,{variant:`outline`,className:`text-xs`,children:`Read only`})]}),(0,v.jsx)(`p`,{"data-slot":`session-context-shared-note`,className:`border-b border-border bg-muted/30 px-3 py-2 text-[12px] text-muted-foreground`,children:`Shared team rules are versioned in Git and read only here. To replace or mute a rule on this host without dirtying Git, add a rule with the same id in Local.`}),e.unreadableReason?(0,v.jsx)(`div`,{className:`p-3`,children:(0,v.jsx)(ci,{reason:e.unreadableReason})}):e.exists?(0,v.jsx)(m,{value:e.content,language:`yaml`,readOnly:!0,"aria-label":`context.yaml shared rules`,className:`h-[420px] rounded-none border-0`}):(0,v.jsxs)(`div`,{className:`flex flex-col items-start gap-3 p-4`,children:[(0,v.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`This repository has no shared `,(0,v.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:e.path}),` yet. Commit one to share team rules across contributors, or add host-only rules in Local.`]}),(0,v.jsx)(l,{variant:`outline`,className:`min-h-11`,onClick:t,children:`Edit Local rules`})]})]})}var $r=[`edit`,`preview`],ei={edit:`session-context-edit-panel`,preview:`session-context-preview-panel`};function ti({pane:e,onPane:t}){let n=(0,g.useRef)(new Map);return(0,v.jsx)(`div`,{role:`tablist`,"aria-label":`Session context view`,onKeyDown:r=>{let i=_($r,e,r.key);i!==void 0&&(r.preventDefault(),t(i),n.current.get(i)?.focus())},className:`flex overflow-hidden rounded-md border border-[var(--control-border)] md:hidden`,children:$r.map(i=>(0,v.jsx)(`button`,{ref:e=>{e?n.current.set(i,e):n.current.delete(i)},type:`button`,tabIndex:e===i?0:-1,"aria-controls":ei[i],role:`tab`,"data-slot":`session-context-pane`,"data-pane":i,"aria-selected":e===i,onClick:()=>t(i),className:r(`min-h-11 flex-1 text-[13px] capitalize text-muted-foreground`,e===i&&`bg-muted text-foreground`),children:i},i))})}function ni({content:e}){return(0,v.jsxs)(`div`,{"data-slot":`session-context-disk`,className:`flex flex-col gap-2`,children:[(0,v.jsx)(`h3`,{className:`text-sm font-semibold`,children:`On disk now`}),(0,v.jsx)(m,{value:e,language:`yaml`,readOnly:!0,"aria-label":`context.local.yaml on disk`,className:`h-[200px]`})]})}function ri({localPath:e,hasProblems:t}){return(0,v.jsx)(`p`,{"data-slot":`session-context-note`,className:`text-[12px] text-soft-foreground`,children:t?`Save is off while the file has problems.`:`Applies from the next session launch. Saved to ${e} (gitignored; does not dirty Git).`})}function ii({problems:e,current:t,failed:n,dirty:r}){return(0,v.jsxs)(`span`,{className:`flex flex-wrap gap-1.5`,"aria-live":`polite`,children:[t&&e>0&&(0,v.jsxs)(u,{variant:`outline`,className:`border-danger/45 text-xs text-danger`,children:[e,` `,e===1?`problem`:`problems`]}),t&&e===0&&(0,v.jsx)(u,{variant:`outline`,className:`border-success/40 text-xs text-success`,children:`Valid`}),!t&&!n&&(0,v.jsx)(u,{variant:`outline`,className:`text-xs`,children:`Checking…`}),n&&(0,v.jsx)(u,{variant:`outline`,className:`border-danger/45 text-xs text-danger`,children:`Not checked`}),r&&(0,v.jsx)(u,{variant:`outline`,className:`border-conflict/50 text-xs text-conflict`,children:`Unsaved`})]})}function ai({problems:e,onLine:t}){return(0,v.jsxs)(`div`,{"data-slot":`session-context-problems`,role:`alert`,className:`rounded-lg border border-danger/45 bg-danger/10 p-3`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsxs)(`h3`,{className:`text-sm font-semibold text-danger`,children:[e.length,` `,e.length===1?`problem`:`problems`,`: fix `,e.length===1?`it`:`them`,` to save`]}),(0,v.jsx)(`span`,{className:`ml-auto text-[12px] text-soft-foreground`,children:`Your draft is kept until you save or discard it.`})]}),(0,v.jsx)(`ul`,{className:`mt-1.5 flex flex-col`,children:e.map((e,n)=>(0,v.jsxs)(`li`,{className:`text-[13px] leading-6`,children:[e.line!==null&&(0,v.jsxs)(`button`,{type:`button`,"data-slot":`session-context-line`,onClick:()=>t(e.line),className:`inline-flex min-h-11 items-center align-middle text-link-foreground underline-offset-2 hover:underline focus-visible:outline-2 focus-visible:outline-ring md:min-h-8`,children:[`Line `,e.line]}),e.line!==null&&(0,v.jsx)(`span`,{"aria-hidden":`true`,className:`text-soft-foreground`,children:` · `}),e.rule!==null&&(0,v.jsxs)(`span`,{className:`text-muted-foreground`,children:[`rule `,e.rule,`: `]}),(0,v.jsx)(`span`,{"data-slot":`session-context-problem`,children:e.message})]},n))})]})}function oi({onInsert:e}){return(0,v.jsxs)(`div`,{"data-slot":`session-context-tokens`,className:`flex flex-col gap-2 border-t border-border p-3`,children:[(0,v.jsx)(`span`,{id:`session-context-tokens`,className:`text-[12px] text-soft-foreground`,children:`Insert a variable`}),(0,v.jsx)(`div`,{role:`group`,"aria-labelledby":`session-context-tokens`,className:`flex flex-wrap gap-1.5`,children:Sr.map(t=>(0,v.jsx)(`button`,{type:`button`,onClick:()=>e(t),className:`min-h-8 rounded-md bg-muted px-2 font-mono text-[12px] text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring pointer-coarse:min-h-11`,children:`{{${t.startsWith(`file:`)?Cr:t}}}`},t))})]})}function si({failure:e,showDisk:t,onShowDisk:n,onOverwrite:r}){return(0,v.jsxs)(`div`,{"data-slot":`session-context-save-failure`,role:`alert`,className:`rounded-lg border border-danger/45 bg-danger/10 p-3`,children:[(0,v.jsx)(`h3`,{className:`text-sm font-semibold text-danger`,children:e.kind===`conflict`?`Not saved: the file changed on disk`:`Not saved`}),(0,v.jsxs)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:[e.message,` Your draft is still here.`]}),e.kind===`conflict`&&(0,v.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,v.jsx)(l,{variant:`outline`,className:`min-h-11`,onClick:n,children:t?`Hide the disk version`:`Show the disk version`}),(0,v.jsx)(l,{variant:`outline`,className:`min-h-11`,onClick:r,children:`Overwrite it`})]})]})}function ci({reason:e}){return(0,v.jsxs)(`div`,{"data-slot":`session-context-readonly`,className:`rounded-md border border-border bg-muted/40 px-3 py-2 text-[13px] text-muted-foreground`,children:[`Read only. `,e]})}function li({localPath:e,sharedPath:t,readOnlyReason:n,onAdd:r}){return(0,v.jsx)(`div`,{"data-slot":`session-context-empty`,className:`rounded-lg border border-border bg-card`,children:(0,v.jsx)(d,{icon:(0,v.jsx)(f,{}),title:`No project rules yet`,heading:`h2`,subtitle:`Every session already starts with its handoff block. Commit shared team rules in ${t}, or add host-local rules in ${e} (gitignored; overrides shared rules with the same id).`,actions:(0,v.jsxs)(v.Fragment,{children:[r&&(0,v.jsx)(l,{className:`min-h-11`,onClick:r,children:`Add a local rule`}),(0,v.jsx)(l,{variant:`outline`,className:`min-h-11`,asChild:!0,children:(0,v.jsx)(`a`,{href:Br,target:`_blank`,rel:`noreferrer`,children:`How rules work`})})]}),children:n&&(0,v.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`Read only. `,n]})})})}export{Vr as SessionContextSection};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{$t as i,Gt as a,Zt as o,dn as s,rn as c,yt as l}from"./queries-CIeJg62Y.js";import{In as u,Tr as d,hi as f,ii as p,zn as m}from"./toaster-D0HMoto5.js";import{ot as h,u as g}from"./design-icons-QbNMZniQ.js";import{t as _}from"./button-C8jUIs8Q.js";import{a as v,i as y,o as b,r as x,s as S,t as C}from"./dialog-DRZuXvul.js";import{tr as w}from"./index-MCtGGYNa.js";var T=e(t(),1),E=n();function D(e,t){return o(t).flatMap(t=>{let n=e.filter(e=>e.provider===t.id);return n.length<2?[{runner:t,account:null,label:t.pickerLabel,desc:t.pickerDescription,missing:!1}]:n.map(e=>({runner:t,account:e.isDefault?null:e.id,label:`${t.pickerLabel} · ${e.label}`,desc:e.configDir?e.exists?e.configDir:`${e.configDir} — folder not created yet`:e.exists?``:`Not initialized on host yet`,missing:!e.exists,...e.isDefault||e.status===void 0?{}:{accountStatus:e.status.status}}))})}var O=(e,t)=>e.length>i(t).length;function k(e,t,n){let r=d(e.data,t),i=r!==void 0&&r.status!==`not-installed`&&(n??r.status)===`connected`,a=!e.isPending&&!e.isError&&r?.enabled===!0&&i;return{providerConnected:a,providerReason:e.isPending?`Checking provider authentication…`:e.isError?`Provider authentication could not be verified.`:r?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:a?void 0:`Connect this provider before selecting it.`}}function A({rows:e,runner:t,accountFor:n,providerStatus:i,disabled:a=!1,accountDisabled:o=!1,onPick:s}){let l=c().data,u=l===void 0,d=O(e,l);return(0,E.jsx)(`div`,{role:`radiogroup`,"aria-label":`Default runner`,"data-slot":`agents-runner`,className:r(`gap-0.5 rounded-md border border-border bg-card p-0.5`,d?`flex max-w-md flex-col`:`inline-flex w-fit`),children:e.map(c=>{let{providerConnected:l,providerReason:f}=k(i,c.runner.id,c.accountStatus),p=e.filter(e=>e.runner.id===c.runner.id).length>1,m=c.runner.id===t&&c.account===n(c.runner.id);return(0,E.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":m,"data-value":c.runner.id,"data-account":c.account??``,title:f??c.desc,disabled:a||u||!l||p&&o,onClick:()=>s(c.runner.id,c.account,p),className:r(`rounded-sm px-3 py-1.5 text-left font-mono text-[13px] font-medium transition-colors disabled:opacity-50`,m?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[c.label,d?(0,E.jsx)(`span`,{"data-slot":c.missing?`agents-account-missing`:`agents-account-dir`,"data-runner":c.runner.id,className:`ml-2 font-sans text-xs text-soft-foreground`,children:c.desc}):null]},`${c.runner.id}:${c.account??``}`)})})}async function j(e,t){return m(await u.api.v1.providers[`sign-in`].start.$post({json:{provider:e,...t?{profileId:t}:{}}}),`/providers/sign-in/start`)}async function M(e){return m(await u.api.v1.providers[`sign-in`][`:id`].$get({param:{id:e}}),`/providers/sign-in/:id`)}async function N(e,t){return m(await u.api.v1.providers[`sign-in`][`:id`].redirect.$post({param:{id:e},json:{redirectUrl:t}}),`/providers/sign-in/:id/redirect`)}async function P(e){return m(await u.api.v1.providers[`sign-in`][`:id`].$delete({param:{id:e}}),`/providers/sign-in/:id`)}function F(e,t){let n=f(),[r,i]=(0,T.useState)(!1),[o,c]=(0,T.useState)(null),[l,u]=(0,T.useState)(``),d=(0,T.useRef)(null),m=(0,T.useRef)(!0),h=(0,T.useRef)(0),g=()=>{h.current++,v.current=!1;let e=d.current;d.current=null,e?.state===`waiting`&&P(e.id).catch(()=>{}),c(null),u(``),i(!1)};(0,T.useEffect)(()=>(m.current=!0,()=>{m.current=!1,h.current++;let e=d.current;e?.state===`waiting`&&P(e.id).catch(()=>{})}),[]);let _=s({mutationFn:n=>j(e,t).then(e=>({result:e,generation:n})),retry:!1,onSuccess:({result:e,generation:t})=>{if(!m.current||!v.current||t!==h.current){P(e.id).catch(()=>{});return}d.current=e,c(e)}}),v=(0,T.useRef)(r);v.current=r;let y=p({queryKey:[`browser-sign-in`,o?.id],queryFn:()=>M(o.id),enabled:r&&o?.state===`waiting`,retry:!1,refetchInterval:e=>e.state.error||e.state.data?.state&&e.state.data.state!==`waiting`?!1:1e3,gcTime:0}),b=y.data??o,x=s({mutationFn:()=>N(o.id,l),retry:!1,onSuccess:()=>{u(``),y.refetch()}});return(0,T.useEffect)(()=>{b?.state===`connected`&&(d.current=b,c(b),Promise.all([n.invalidateQueries({queryKey:a.agentProfiles}),n.invalidateQueries({queryKey:a.providerStatus}),n.invalidateQueries({queryKey:a.models(e)})]))},[b,n,e]),{open:r,result:b,redirect:l,setRedirect:u,start:_,replay:x,status:y,error:_.error??x.error??y.error,close:g,connect:()=>{i(!0),v.current=!0,_.reset(),x.reset(),_.mutate(++h.current)}}}function I(){return`Open the sign-in link in your browser. After Google consent, the page shows a code. Copy that code, or the full address of that page, and paste it below.`}function L({provider:e,profileId:t,label:n}){let{open:r,result:i,redirect:a,setRedirect:o,start:s,replay:c,status:u,error:d,close:f,connect:p}=F(e,t);return l().data?.capabilities?.settingsAdmin===!0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(_,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:s.isPending,onClick:p,children:`Connect`}),(0,E.jsx)(C,{open:r,onOpenChange:e=>{e||f()},children:(0,E.jsxs)(x,{children:[(0,E.jsxs)(b,{children:[(0,E.jsxs)(S,{children:[`Sign in to `,n]}),(0,E.jsx)(y,{children:`Use a personal Google account. Business and agent-platform sign-in are not supported.`})]}),s.isPending?(0,E.jsx)(`p`,{role:`status`,children:`Preparing sign-in…`}):null,i?.state===`waiting`?(0,E.jsxs)(`div`,{className:`grid min-w-0 gap-3`,children:[(0,E.jsx)(`a`,{href:i.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-action underline`,children:`Open Google sign-in`}),(0,E.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,E.jsx)(I,{})}),(0,E.jsxs)(`label`,{className:`grid gap-2`,children:[`Code or page address`,(0,E.jsx)(w,{type:`text`,autoComplete:`off`,spellCheck:!1,value:a,onChange:e=>o(e.target.value)})]}),(0,E.jsx)(_,{disabled:!a.trim()||c.isPending,onClick:()=>c.mutate(),children:`Complete sign-in`})]}):null,i?.state===`connected`?(0,E.jsx)(`p`,{role:`status`,children:`Connected.`}):null,i?.state===`failed`?(0,E.jsx)(`p`,{role:`alert`,children:i.error}):null,i?.state===`cancelled`?(0,E.jsx)(`p`,{role:`status`,children:`Sign-in cancelled. Close this window and Connect again.`}):null,d?(0,E.jsx)(`p`,{role:`alert`,children:d.message}):null,u.isError&&i?.state===`waiting`?(0,E.jsx)(_,{onClick:()=>void u.refetch(),children:`Retry status`}):null,(0,E.jsx)(v,{children:(0,E.jsx)(_,{variant:`outline`,onClick:f,children:i?.state===`connected`?`Done`:`Cancel`})})]})})]}):null}function R(e){let t=e.label.startsWith(e.runner.pickerLabel)?e.label.slice(e.runner.pickerLabel.length):``;return{...e,label:`${e.runner.displayName}${t}`}}function z(e){let t=(0,T.useRef)(null),n=e.rows.map(R),r=n.find(t=>t.runner.id===e.runner&&t.account===e.accountFor(t.runner.id)),i=n.find(t=>t.runner.id===e.runner)?.runner.displayName;return(0,E.jsxs)(`details`,{ref:t,className:`settings-agent-picker`,children:[(0,E.jsxs)(`summary`,{children:[(0,E.jsx)(h,{"aria-hidden":`true`,className:`size-4 text-accent-text`}),(0,E.jsx)(`span`,{className:`min-w-0 flex-1`,children:r?.label??i??e.runner}),(0,E.jsx)(g,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`})]}),(0,E.jsx)(A,{...e,rows:n,onPick:(...n)=>{e.onPick(...n),t.current&&(t.current.open=!1)}})]})}export{k as a,O as i,L as n,D as r,z as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{$t as i,Gt as a,Zt as o,dn as s,rn as c,yt as l}from"./queries-CIeJg62Y.js";import{In as u,Tr as d,hi as f,ii as p,zn as m}from"./toaster-D0HMoto5.js";import{ot as h,u as g}from"./design-icons-QbNMZniQ.js";import{t as _}from"./button-C8jUIs8Q.js";import{a as v,i as y,o as b,r as x,s as S,t as C}from"./dialog-DRZuXvul.js";import{rr as w}from"./index-zhwJL4R4.js";var T=e(t(),1),E=n();function D(e,t){return o(t).flatMap(t=>{let n=e.filter(e=>e.provider===t.id);return n.length<2?[{runner:t,account:null,label:t.pickerLabel,desc:t.pickerDescription,missing:!1}]:n.map(e=>({runner:t,account:e.isDefault?null:e.id,label:`${t.pickerLabel} · ${e.label}`,desc:e.configDir?e.exists?e.configDir:`${e.configDir} — folder not created yet`:e.exists?``:`Not initialized on host yet`,missing:!e.exists,...e.isDefault||e.status===void 0?{}:{accountStatus:e.status.status}}))})}var O=(e,t)=>e.length>i(t).length;function k(e,t,n){let r=d(e.data,t),i=r!==void 0&&r.status!==`not-installed`&&(n??r.status)===`connected`,a=!e.isPending&&!e.isError&&r?.enabled===!0&&i;return{providerConnected:a,providerReason:e.isPending?`Checking provider authentication…`:e.isError?`Provider authentication could not be verified.`:r?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:a?void 0:`Connect this provider before selecting it.`}}function A({rows:e,runner:t,accountFor:n,providerStatus:i,disabled:a=!1,accountDisabled:o=!1,onPick:s}){let l=c().data,u=l===void 0,d=O(e,l);return(0,E.jsx)(`div`,{role:`radiogroup`,"aria-label":`Default runner`,"data-slot":`agents-runner`,className:r(`gap-0.5 rounded-md border border-border bg-card p-0.5`,d?`flex max-w-md flex-col`:`inline-flex w-fit`),children:e.map(c=>{let{providerConnected:l,providerReason:f}=k(i,c.runner.id,c.accountStatus),p=e.filter(e=>e.runner.id===c.runner.id).length>1,m=c.runner.id===t&&c.account===n(c.runner.id);return(0,E.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":m,"data-value":c.runner.id,"data-account":c.account??``,title:f??c.desc,disabled:a||u||!l||p&&o,onClick:()=>s(c.runner.id,c.account,p),className:r(`rounded-sm px-3 py-1.5 text-left font-mono text-[13px] font-medium transition-colors disabled:opacity-50`,m?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[c.label,d?(0,E.jsx)(`span`,{"data-slot":c.missing?`agents-account-missing`:`agents-account-dir`,"data-runner":c.runner.id,className:`ml-2 font-sans text-xs text-soft-foreground`,children:c.desc}):null]},`${c.runner.id}:${c.account??``}`)})})}async function j(e,t){return m(await u.api.v1.providers[`sign-in`].start.$post({json:{provider:e,...t?{profileId:t}:{}}}),`/providers/sign-in/start`)}async function M(e){return m(await u.api.v1.providers[`sign-in`][`:id`].$get({param:{id:e}}),`/providers/sign-in/:id`)}async function N(e,t){return m(await u.api.v1.providers[`sign-in`][`:id`].redirect.$post({param:{id:e},json:{redirectUrl:t}}),`/providers/sign-in/:id/redirect`)}async function P(e){return m(await u.api.v1.providers[`sign-in`][`:id`].$delete({param:{id:e}}),`/providers/sign-in/:id`)}function F(e,t){let n=f(),[r,i]=(0,T.useState)(!1),[o,c]=(0,T.useState)(null),[l,u]=(0,T.useState)(``),d=(0,T.useRef)(null),m=(0,T.useRef)(!0),h=(0,T.useRef)(0),g=()=>{h.current++,v.current=!1;let e=d.current;d.current=null,e?.state===`waiting`&&P(e.id).catch(()=>{}),c(null),u(``),i(!1)};(0,T.useEffect)(()=>(m.current=!0,()=>{m.current=!1,h.current++;let e=d.current;e?.state===`waiting`&&P(e.id).catch(()=>{})}),[]);let _=s({mutationFn:n=>j(e,t).then(e=>({result:e,generation:n})),retry:!1,onSuccess:({result:e,generation:t})=>{if(!m.current||!v.current||t!==h.current){P(e.id).catch(()=>{});return}d.current=e,c(e)}}),v=(0,T.useRef)(r);v.current=r;let y=p({queryKey:[`browser-sign-in`,o?.id],queryFn:()=>M(o.id),enabled:r&&o?.state===`waiting`,retry:!1,refetchInterval:e=>e.state.error||e.state.data?.state&&e.state.data.state!==`waiting`?!1:1e3,gcTime:0}),b=y.data??o,x=s({mutationFn:()=>N(o.id,l),retry:!1,onSuccess:()=>{u(``),y.refetch()}});return(0,T.useEffect)(()=>{b?.state===`connected`&&(d.current=b,c(b),Promise.all([n.invalidateQueries({queryKey:a.agentProfiles}),n.invalidateQueries({queryKey:a.providerStatus}),n.invalidateQueries({queryKey:a.models(e)})]))},[b,n,e]),{open:r,result:b,redirect:l,setRedirect:u,start:_,replay:x,status:y,error:_.error??x.error??y.error,close:g,connect:()=>{i(!0),v.current=!0,_.reset(),x.reset(),_.mutate(++h.current)}}}function I(){return`Open the sign-in link in your browser. After Google consent, the page shows a code. Copy that code, or the full address of that page, and paste it below.`}function L({provider:e,profileId:t,label:n}){let{open:r,result:i,redirect:a,setRedirect:o,start:s,replay:c,status:u,error:d,close:f,connect:p}=F(e,t);return l().data?.capabilities?.settingsAdmin===!0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(_,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:s.isPending,onClick:p,children:`Connect`}),(0,E.jsx)(C,{open:r,onOpenChange:e=>{e||f()},children:(0,E.jsxs)(x,{children:[(0,E.jsxs)(b,{children:[(0,E.jsxs)(S,{children:[`Sign in to `,n]}),(0,E.jsx)(y,{children:`Use a personal Google account. Business and agent-platform sign-in are not supported.`})]}),s.isPending?(0,E.jsx)(`p`,{role:`status`,children:`Preparing sign-in…`}):null,i?.state===`waiting`?(0,E.jsxs)(`div`,{className:`grid min-w-0 gap-3`,children:[(0,E.jsx)(`a`,{href:i.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-action underline`,children:`Open Google sign-in`}),(0,E.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,E.jsx)(I,{})}),(0,E.jsxs)(`label`,{className:`grid gap-2`,children:[`Code or page address`,(0,E.jsx)(w,{type:`text`,autoComplete:`off`,spellCheck:!1,value:a,onChange:e=>o(e.target.value)})]}),(0,E.jsx)(_,{disabled:!a.trim()||c.isPending,onClick:()=>c.mutate(),children:`Complete sign-in`})]}):null,i?.state===`connected`?(0,E.jsx)(`p`,{role:`status`,children:`Connected.`}):null,i?.state===`failed`?(0,E.jsx)(`p`,{role:`alert`,children:i.error}):null,i?.state===`cancelled`?(0,E.jsx)(`p`,{role:`status`,children:`Sign-in cancelled. Close this window and Connect again.`}):null,d?(0,E.jsx)(`p`,{role:`alert`,children:d.message}):null,u.isError&&i?.state===`waiting`?(0,E.jsx)(_,{onClick:()=>void u.refetch(),children:`Retry status`}):null,(0,E.jsx)(v,{children:(0,E.jsx)(_,{variant:`outline`,onClick:f,children:i?.state===`connected`?`Done`:`Cancel`})})]})})]}):null}function R(e){let t=e.label.startsWith(e.runner.pickerLabel)?e.label.slice(e.runner.pickerLabel.length):``;return{...e,label:`${e.runner.displayName}${t}`}}function z(e){let t=(0,T.useRef)(null),n=e.rows.map(R),r=n.find(t=>t.runner.id===e.runner&&t.account===e.accountFor(t.runner.id)),i=n.find(t=>t.runner.id===e.runner)?.runner.displayName;return(0,E.jsxs)(`details`,{ref:t,className:`settings-agent-picker`,children:[(0,E.jsxs)(`summary`,{children:[(0,E.jsx)(h,{"aria-hidden":`true`,className:`size-4 text-accent-text`}),(0,E.jsx)(`span`,{className:`min-w-0 flex-1`,children:r?.label??i??e.runner}),(0,E.jsx)(g,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`})]}),(0,E.jsx)(A,{...e,rows:n,onPick:(...n)=>{e.onPick(...n),t.current&&(t.current.open=!1)}})]})}export{k as a,O as i,L as n,D as r,z as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{p as r}from"./dist-C_rn70hE.js";import{t as i}from"./button-C8jUIs8Q.js";import{gn as a}from"./index-MCtGGYNa.js";import{n as o}from"./save-cue-CpHgT93o.js";var s=e(t(),1),c=n(),l={dirty:0,invalid:0,busy:0},u=class{entries=new Map;listeners=new Set;snapshot=l;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.snapshot;set(e,t,n){this.entries.set(e,{...t,draft:n}),this.publish()}delete(e){this.entries.delete(e)&&this.publish()}dirtyDrafts(){return[...this.entries.values()].filter(e=>e.dirty).map(e=>e.draft.current)}publish(){let e=0,t=0,n=0;for(let r of this.entries.values())r.dirty&&(e+=1,r.invalid&&(t+=1),r.busy&&(n+=1));let{snapshot:r}=this;if(!(e===r.dirty&&t===r.invalid&&n===r.busy)){this.snapshot=e===0&&t===0&&n===0?l:{dirty:e,invalid:t,busy:n};for(let e of this.listeners)e()}}},d=(0,s.createContext)(null);function f(e){let t=(0,s.useContext)(d);if(!t)throw Error(`useSettingsDraft needs a SettingsDraftScope above it`);let n=(0,s.useId)(),r=(0,s.useRef)(e);(0,s.useLayoutEffect)(()=>{r.current=e});let i=e.dirty,o=e.invalid===!0,c=e.busy===!0;(0,s.useLayoutEffect)(()=>{t.set(n,{dirty:i,invalid:o,busy:c},r)},[t,n,i,o,c]),(0,s.useLayoutEffect)(()=>()=>t.delete(n),[t,n]),a(e.holdsReload??i)}function p({children:e}){let[t]=(0,s.useState)(()=>new u);return(0,c.jsxs)(d.Provider,{value:t,children:[e,(0,c.jsx)(h,{store:t})]})}function m(e){return e===1?`1 field`:`${e} fields`}function h({store:e}){let{dirty:t,invalid:n,busy:a}=(0,s.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot),[l,u]=(0,s.useState)(!1),[d,f]=(0,s.useState)(0),{saved:p,flash:h}=o(),g=(0,s.useRef)(!0);(0,s.useLayoutEffect)(()=>(g.current=!0,()=>{g.current=!1}),[]);let _=async()=>{u(!0),f(0);let t=r(),n=0;for(let i of e.dirtyDrafts()){if(!g.current||r()!==t)return;try{await i.save()}catch{n+=1}}g.current&&(u(!1),n>0?f(n):h())},v=()=>{f(0);for(let t of e.dirtyDrafts())t.discard()},y=l||a>0;if(t===0&&!y)return p?(0,c.jsx)(`div`,{"data-slot":`settings-save-bar`,"data-state":`saved`,className:`settings-save-bar`,children:(0,c.jsx)(`span`,{role:`status`,className:`settings-save-bar-message`,children:`Saved`})}):null;let b=`Unsaved changes`;return y?b=`Saving…`:n>0?b=`Unsaved changes — fix ${m(n)}`:d>0&&(b=`Unsaved changes — ${m(d)} did not save`),(0,c.jsxs)(`div`,{"data-slot":`settings-save-bar`,"data-state":y?`saving`:`dirty`,className:`settings-save-bar`,children:[(0,c.jsx)(`span`,{role:`status`,className:`settings-save-bar-message`,children:b}),(0,c.jsxs)(`span`,{className:`settings-save-bar-actions`,children:[(0,c.jsx)(i,{type:`button`,variant:`outline`,size:`sm`,"data-action":`settings-discard`,disabled:y,onClick:v,children:`Discard`}),(0,c.jsx)(i,{type:`button`,variant:`primary`,size:`sm`,"data-action":`settings-save`,disabled:y||n>0,onClick:()=>void _(),children:`Save`})]})]})}function g(){return(0,c.jsx)(`button`,{type:`submit`,hidden:!0,tabIndex:-1,"aria-hidden":`true`,"data-slot":`settings-implicit-submit`})}export{p as n,f as r,g as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{p as r}from"./dist-C_rn70hE.js";import{t as i}from"./button-C8jUIs8Q.js";import{vn as a}from"./index-zhwJL4R4.js";import{n as o}from"./save-cue-CpHgT93o.js";var s=e(t(),1),c=n(),l={dirty:0,invalid:0,busy:0},u=class{entries=new Map;listeners=new Set;snapshot=l;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.snapshot;set(e,t,n){this.entries.set(e,{...t,draft:n}),this.publish()}delete(e){this.entries.delete(e)&&this.publish()}dirtyDrafts(){return[...this.entries.values()].filter(e=>e.dirty).map(e=>e.draft.current)}publish(){let e=0,t=0,n=0;for(let r of this.entries.values())r.dirty&&(e+=1,r.invalid&&(t+=1),r.busy&&(n+=1));let{snapshot:r}=this;if(!(e===r.dirty&&t===r.invalid&&n===r.busy)){this.snapshot=e===0&&t===0&&n===0?l:{dirty:e,invalid:t,busy:n};for(let e of this.listeners)e()}}},d=(0,s.createContext)(null);function f(e){let t=(0,s.useContext)(d);if(!t)throw Error(`useSettingsDraft needs a SettingsDraftScope above it`);let n=(0,s.useId)(),r=(0,s.useRef)(e);(0,s.useLayoutEffect)(()=>{r.current=e});let i=e.dirty,o=e.invalid===!0,c=e.busy===!0;(0,s.useLayoutEffect)(()=>{t.set(n,{dirty:i,invalid:o,busy:c},r)},[t,n,i,o,c]),(0,s.useLayoutEffect)(()=>()=>t.delete(n),[t,n]),a(e.holdsReload??i)}function p({children:e}){let[t]=(0,s.useState)(()=>new u);return(0,c.jsxs)(d.Provider,{value:t,children:[e,(0,c.jsx)(h,{store:t})]})}function m(e){return e===1?`1 field`:`${e} fields`}function h({store:e}){let{dirty:t,invalid:n,busy:a}=(0,s.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot),[l,u]=(0,s.useState)(!1),[d,f]=(0,s.useState)(0),{saved:p,flash:h}=o(),g=(0,s.useRef)(!0);(0,s.useLayoutEffect)(()=>(g.current=!0,()=>{g.current=!1}),[]);let _=async()=>{u(!0),f(0);let t=r(),n=0;for(let i of e.dirtyDrafts()){if(!g.current||r()!==t)return;try{await i.save()}catch{n+=1}}g.current&&(u(!1),n>0?f(n):h())},v=()=>{f(0);for(let t of e.dirtyDrafts())t.discard()},y=l||a>0;if(t===0&&!y)return p?(0,c.jsx)(`div`,{"data-slot":`settings-save-bar`,"data-state":`saved`,className:`settings-save-bar`,children:(0,c.jsx)(`span`,{role:`status`,className:`settings-save-bar-message`,children:`Saved`})}):null;let b=`Unsaved changes`;return y?b=`Saving…`:n>0?b=`Unsaved changes — fix ${m(n)}`:d>0&&(b=`Unsaved changes — ${m(d)} did not save`),(0,c.jsxs)(`div`,{"data-slot":`settings-save-bar`,"data-state":y?`saving`:`dirty`,className:`settings-save-bar`,children:[(0,c.jsx)(`span`,{role:`status`,className:`settings-save-bar-message`,children:b}),(0,c.jsxs)(`span`,{className:`settings-save-bar-actions`,children:[(0,c.jsx)(i,{type:`button`,variant:`outline`,size:`sm`,"data-action":`settings-discard`,disabled:y,onClick:v,children:`Discard`}),(0,c.jsx)(i,{type:`button`,variant:`primary`,size:`sm`,"data-action":`settings-save`,disabled:y||n>0,onClick:()=>void _(),children:`Save`})]})]})}function g(){return(0,c.jsx)(`button`,{type:`submit`,hidden:!0,tabIndex:-1,"aria-hidden":`true`,"data-slot":`settings-implicit-submit`})}export{p as n,f as r,g as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ft as r,It as i,Mt as a,St as o,gt as s,kt as c}from"./queries-CIeJg62Y.js";import{Cn as l,Dn as u,On as d,Sn as f,n as p,wn as m}from"./toaster-D0HMoto5.js";import{n as h,p as g,r as _}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{d as v,u as y}from"./design-icons-QbNMZniQ.js";import{t as b}from"./plus-CxRU2X8C.js";import{t as x}from"./button-C8jUIs8Q.js";import{n as ee,r as te,t as ne}from"./collapsible-Bx2vViFx.js";import{t as S}from"./switch-CAKeV99j.js";import{t as C}from"./badge-B6B-xYQQ.js";import{n as w,s as T,t as E}from"./project-router-BHFXTx5l.js";import"./attention-V1gJ7gKo.js";import{o as D,u as re}from"./page-shell-Dky5crRl.js";import{V as ie,Zn as O,gn as ae,ht as k,mt as A,pt as oe,tr as j}from"./index-MCtGGYNa.js";import{t as se}from"./textarea-vEsJAUAV.js";import{n as ce}from"./save-cue-CpHgT93o.js";import{n as M}from"./settings-field-Bhh8I9fJ.js";import{t as le}from"./project-location-Db8_ITcg.js";import{n as N,r as ue,t as de}from"./settings-save-bar-CfUNcwW4.js";import{n as fe,t as pe}from"./saved-draft-BwzBc-_Y.js";import{t as me}from"./archive-on-merge-field-BvtuaspW.js";import{a as he,i as ge,n as _e,t as P}from"./projects-section-CFTrO5BI.js";var F=e(t(),1),I={"needs-you":{label:`Needs you`,hint:`Asks a question, asks for permission, or waits for review`},failed:{label:`Failed`,hint:`Failed, with no scheduled resume`},done:{label:`Done`,hint:`Finished`},cancelled:{label:`Cancelled`,hint:`Was cancelled`},running:{label:`Running`,hint:`Runs an agent turn`},"waiting-workers":{label:`Waiting for agents`,hint:`Waits on its workers or their replies`},"waiting-ci":{label:`Waiting on CI`,hint:`Waits on a pull request's checks`},"waiting-timer":{label:`Waiting`,hint:`Waits on a timer`},"waiting-other":{label:`Any other wait`,hint:`Waits on anything else, including wait types added later`}},L=(e,t)=>e.length===t.length&&e.every(e=>t.includes(e)),R={name:``,description:``,url:``,token:``,tasks:!0,triggers:u,agent:!1};function z(e){return{name:e.name,description:e.description??``,url:e.url,token:``,tasks:e.tasks,triggers:e.triggers??u,agent:e.agent}}var B=e=>d.filter(t=>e.includes(t));function ve(e){let t=e.description.trim();return{name:e.name.trim(),url:e.url.trim(),...t?{description:t}:{},...e.token?{token:e.token}:{},tasks:e.tasks,...L(e.triggers,u)?{}:{triggers:B(e.triggers)},agent:e.agent}}function ye(e){return e.name.trim()!==``||e.description.trim()!==``||e.url.trim()!==``||e.token!==``||e.tasks!==R.tasks||e.agent!==R.agent||!L(e.triggers,R.triggers)}function be(e,t){let n={},r=e.name.trim(),i=e.description.trim(),a=e.url.trim();return r!==t.name&&(n.name=r),i!==(t.description??``)&&(n.description=i),a!==t.url&&(n.url=a),e.token&&(n.token=e.token),e.tasks!==t.tasks&&(n.tasks=e.tasks),L(e.triggers,t.triggers??u)||(n.triggers=B(e.triggers)),e.agent!==t.agent&&(n.agent=e.agent),n}var V=n(),H=`flex flex-col gap-1 text-[13px]`,U=`text-xs text-muted-foreground`;function W({draft:e,onChange:t,tokenSet:n}){let r=(0,F.useId)(),i=(0,F.useId)(),a=(0,F.useId)(),o=(0,F.useId)(),s=(0,F.useId)(),c=(0,F.useId)(),u=(0,F.useId)(),p=(0,F.useId)(),h=(0,F.useId)(),g=(0,F.useId)();return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,14rem),1fr))] gap-3`,children:[(0,V.jsxs)(`div`,{className:H,children:[(0,V.jsx)(`label`,{htmlFor:r,className:U,children:`Name`}),(0,V.jsx)(j,{id:r,"data-slot":`webhook-name`,autoComplete:`off`,maxLength:80,placeholder:`e.g. Team bot`,value:e.name,onChange:e=>t({name:e.target.value})})]}),(0,V.jsxs)(`div`,{className:H,children:[(0,V.jsx)(`label`,{htmlFor:o,className:U,children:`URL`}),(0,V.jsx)(j,{id:o,"data-slot":`webhook-url`,type:`url`,inputMode:`url`,autoComplete:`off`,spellCheck:!1,maxLength:m,placeholder:`https://bot.example/hooks/cez`,value:e.url,onChange:e=>t({url:e.target.value})})]})]}),(0,V.jsxs)(`div`,{className:H,children:[(0,V.jsx)(`label`,{htmlFor:i,className:U,children:`Description`}),(0,V.jsx)(se,{id:i,"data-slot":`webhook-description`,"aria-describedby":a,rows:2,maxLength:f,placeholder:`e.g. Posts to the #releases channel. Use it for release notes.`,value:e.description,onChange:e=>t({description:e.target.value})}),(0,V.jsx)(`span`,{id:a,className:`text-xs text-soft-foreground`,children:`Agents read the name and description to decide when to use this webhook.`})]}),(0,V.jsxs)(`div`,{className:H,children:[(0,V.jsx)(`label`,{htmlFor:s,className:U,children:`Token`}),(0,V.jsx)(j,{id:s,"data-slot":`webhook-token`,type:`password`,autoComplete:`new-password`,spellCheck:!1,maxLength:l,"aria-describedby":c,placeholder:n?`Token set — type to replace`:`Optional Bearer token`,value:e.token,onChange:e=>t({token:e.target.value})}),(0,V.jsx)(`span`,{id:c,className:`text-xs text-soft-foreground`,children:n?`The token is stored in ~/.cezar and never shown again. Leave it empty to keep it.`:`The token is stored in ~/.cezar, never in the repo. It is sent as a Bearer header.`})]}),(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,V.jsxs)(`div`,{className:`flex min-h-11 items-center gap-3`,children:[(0,V.jsx)(S,{id:u,"aria-describedby":p,"data-slot":`webhook-tasks`,checked:e.tasks,onCheckedChange:e=>t({tasks:e})}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col text-[13px]`,children:[(0,V.jsx)(`label`,{htmlFor:u,className:`font-medium`,children:`Task notifications`}),(0,V.jsx)(`span`,{id:p,className:`text-xs text-soft-foreground`,children:`Tasks you hand off, or start with notify on, send their status here.`})]})]}),e.tasks?(0,V.jsxs)(`fieldset`,{"data-slot":`webhook-triggers`,className:`flex flex-col gap-1 sm:ps-[3.25rem]`,children:[(0,V.jsx)(`legend`,{className:`pbe-1 text-xs text-muted-foreground`,children:`Send a delivery when a task enters`}),(0,V.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(min(100%,15rem),1fr))] gap-x-3`,children:d.map(n=>(0,V.jsxs)(`label`,{className:`flex min-h-11 items-start gap-2.5 pbs-2 text-[13px]`,children:[(0,V.jsx)(`input`,{type:`checkbox`,"data-trigger":n,checked:e.triggers.includes(n),onChange:r=>t({triggers:r.target.checked?[...e.triggers,n]:e.triggers.filter(e=>e!==n)}),className:`mbs-0.5 size-[18px] shrink-0`}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:I[n].label}),(0,V.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:I[n].hint})]})]},n))}),(0,V.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Handing a task off and Send test always deliver.`})]}):null]}),(0,V.jsxs)(`div`,{className:`flex min-h-11 items-center gap-3`,children:[(0,V.jsx)(S,{id:h,"aria-describedby":g,"data-slot":`webhook-agent`,checked:e.agent,onCheckedChange:e=>t({agent:e})}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col text-[13px]`,children:[(0,V.jsx)(`label`,{htmlFor:h,className:`font-medium`,children:`Let agents send reports`}),(0,V.jsx)(`span`,{id:g,className:`text-xs text-soft-foreground`,children:`Agents in this project may post a report here when the task calls for it.`})]})]})]})}var G=`max-sm:h-11`,K=(e,t)=>({tone:`alert`,text:`Not saved: ${e.message}. Fix the field and select ${t} again.`}),xe=e=>e.dryRun?{tone:`ok`,text:`Dry run: nothing was sent.`}:e.ok?{tone:`ok`,text:`Delivered (HTTP ${e.status??200}).`}:{tone:`danger`,text:`Not delivered: ${e.error??`unknown error`}.`};function q({feedback:e}){return e?(0,V.jsx)(`p`,{"data-slot":e.tone===`alert`?`webhook-error`:`webhook-result`,role:e.tone===`alert`?`alert`:`status`,className:e.tone===`ok`?`text-[13px] text-muted-foreground`:`text-[13px] text-danger`,children:e.text}):null}var J=`rounded-md border border-border bg-background`,Y=`flex flex-col gap-3 border-bs border-border p-3`;function Se({projectId:e,webhook:t,defaultOpen:n=!1}){let i=r(),o=c(),s=a(),[l,u]=(0,F.useState)(n),[d,f]=fe(z(t),pe),[m,h]=(0,F.useState)(null),g=be(d,t),_=Object.keys(g).length>0,v=d.name.trim()!==``&&d.url.trim()!==``,b=i.isPending||o.isPending||s.isPending,S={projectId:e,webhookId:t.id},w=()=>(h(null),i.mutateAsync({...S,...g},{onSuccess:()=>f(e=>({...e,token:``})),onError:e=>h(K(e,`Save`))}));ue({dirty:_,invalid:!v,busy:b,save:w,discard:()=>f(z(t))});let T=()=>s.mutate(S,{onSuccess:e=>h(xe(e)),onError:e=>h({tone:`danger`,text:e.message})});return(0,V.jsx)(`li`,{"data-slot":`webhook-card`,"data-webhook-id":t.id,className:J,children:(0,V.jsxs)(ne,{open:l,onOpenChange:u,children:[(0,V.jsx)(te,{asChild:!0,children:(0,V.jsxs)(`button`,{type:`button`,"data-action":`webhook-toggle`,className:`group flex min-h-11 w-full items-center gap-3 rounded-md p-3 text-start focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-foreground pointer-hover:bg-muted/50 active:bg-muted/50`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,V.jsx)(`span`,{"data-slot":`webhook-card-name`,className:`min-w-0 break-words text-[13px] font-medium`,children:t.name}),t.tasks?(0,V.jsx)(C,{variant:`secondary`,"data-badge":`tasks`,children:`Task notifications`}):null,t.agent?(0,V.jsx)(C,{variant:`secondary`,"data-badge":`agent`,children:`Agents`}):null]}),(0,V.jsx)(`span`,{"data-slot":`webhook-card-url`,className:`truncate text-[12px] text-muted-foreground`,children:ie(t.url)})]}),(0,V.jsx)(y,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground group-data-[state=open]:rotate-180`})]})}),(0,V.jsx)(ee,{children:(0,V.jsxs)(`form`,{"data-slot":`webhook-form`,"data-reports-dirty":``,className:Y,onSubmit:e=>{e.preventDefault(),h(null),v&&_&&!b&&w().catch(()=>{})},children:[(0,V.jsx)(W,{draft:d,tokenSet:t.tokenSet,onChange:e=>f(t=>({...t,...e}))}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(x,{type:`button`,size:`sm`,className:G,variant:`outline`,"data-action":`webhook-test`,disabled:b||!v,onClick:()=>{h(null),_?w().then(T,()=>{}):T()},children:`Send test`}),t.tokenSet?(0,V.jsx)(x,{type:`button`,size:`sm`,className:G,variant:`ghost`,"data-action":`webhook-clear-token`,disabled:b,onClick:()=>i.mutate({...S,token:``},{onSuccess:()=>p(`Webhook token cleared`),onError:e=>h({tone:`danger`,text:`Token not cleared: ${e.message}.`})}),children:`Clear token`}):null,(0,V.jsx)(x,{type:`button`,size:`sm`,className:G,variant:`danger-ghost`,"data-action":`webhook-remove`,"aria-label":`Remove ${t.name}`,disabled:b,onClick:()=>o.mutate(S,{onSuccess:()=>p(`${t.name} removed`),onError:e=>h({tone:`danger`,text:`Not removed: ${e.message}.`})}),children:`Remove`})]}),(0,V.jsx)(q,{feedback:m}),(0,V.jsx)(de,{})]})})]})})}function Ce({projectId:e,onCreated:t,onCancel:n}){let r=s(),[i,a]=(0,F.useState)(R),[o,c]=(0,F.useState)(null),l=i.name.trim()!==``&&i.url.trim()!==``;return ae(ye(i)),(0,V.jsxs)(`li`,{"data-slot":`webhook-card`,"data-draft":``,className:J,children:[(0,V.jsx)(`p`,{className:`p-3 text-[13px] font-medium`,children:`New webhook`}),(0,V.jsxs)(`form`,{"data-slot":`webhook-form`,"data-reports-dirty":``,"aria-label":`New webhook`,className:Y,onSubmit:n=>{n.preventDefault(),c(null),l&&r.mutate({projectId:e,...ve(i)},{onSuccess:({webhook:e})=>{p(`${e.name} created`),t(e)},onError:e=>c(K(e,`Create`))})},children:[(0,V.jsx)(W,{draft:i,tokenSet:!1,onChange:e=>a(t=>({...t,...e}))}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(x,{type:`submit`,size:`sm`,className:G,variant:`outline`,"data-action":`webhook-create`,disabled:r.isPending||!l,children:`Create`}),(0,V.jsx)(x,{type:`button`,size:`sm`,className:G,variant:`ghost`,"data-action":`webhook-cancel`,disabled:r.isPending,onClick:n,children:`Cancel`})]}),(0,V.jsx)(q,{feedback:o})]})]})}function we({project:e}){let t=e.webhooks??[],[n,r]=(0,F.useState)(!1),[i,a]=(0,F.useState)(null),o=t.length>=16;return(0,V.jsx)(M,{wide:!0,title:`Webhooks`,hint:`A webhook gets a POST from Squawk. Tasks can send their status to it, and agents can send it reports.`,children:(0,V.jsxs)(`div`,{"data-slot":`project-webhooks`,className:`flex flex-col gap-3`,children:[t.length===0&&!n?(0,V.jsx)(`p`,{"data-slot":`webhooks-empty`,className:`text-[13px] text-soft-foreground`,children:`No webhooks yet. Add one to send task updates to a bot, or to let agents post reports.`}):null,t.length>0||n?(0,V.jsxs)(`ul`,{className:`flex flex-col gap-2`,children:[t.map(t=>(0,V.jsx)(Se,{projectId:e.id,webhook:t,defaultOpen:t.id===i},t.id)),n?(0,V.jsx)(Ce,{projectId:e.id,onCancel:()=>r(!1),onCreated:e=>{a(e.id),r(!1)}}):null]}):null,n?null:(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsxs)(x,{type:`button`,size:`sm`,variant:`outline`,className:`max-sm:h-11`,"data-action":`webhook-add`,disabled:o,onClick:()=>r(!0),children:[(0,V.jsx)(b,{"aria-hidden":`true`}),`Add webhook`]}),o?(0,V.jsxs)(`span`,{className:`text-xs text-soft-foreground`,children:[`A project holds at most `,16,` webhooks.`]}):null]})]})})}function X(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}function Te(){let e=T(),t=o(),n=i(),r=ce();if(t.isPending)return(0,V.jsx)(`p`,{"data-slot":`project-general-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading project…`});if(t.isError)return(0,V.jsxs)(`p`,{"data-slot":`project-general-error`,className:`text-[13px] text-danger`,children:[`Could not read the project registry — `,t.error.message]});let a=t.data,s=a?.projects.find(t=>t.id===e);return!a||!s?null:(0,V.jsxs)(`div`,{"data-slot":`project-general`,className:`flex w-full flex-col gap-5`,children:[(0,V.jsxs)(`section`,{className:`flex flex-col gap-5 rounded-lg border border-border bg-card p-5 [&_select]:min-h-11 [&_select]:w-full`,children:[(0,V.jsx)(`h2`,{className:`text-lg font-semibold`,children:`General`}),(0,V.jsx)(le,{}),(0,V.jsx)(Z,{project:s}),(0,V.jsx)(M,{title:`Max parallel tasks`,saved:r.saved,hint:n.data?`The workspace limit (${n.data.resources.maxParallel}) still applies as an overall ceiling.`:`How many of this project's tasks may run at once. The workspace limit still applies as an overall ceiling.`,children:n.data?(0,V.jsx)(P,{project:s,workspaceMax:n.data.resources.maxParallel,onSaved:r.flash}):(0,V.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading the workspace limit…`})}),(0,V.jsx)(we,{project:s},s.id)]}),(0,V.jsx)(`section`,{className:`rounded-lg border border-border bg-card p-5`,children:(0,V.jsx)(Ee,{project:s,bootProject:a.bootProject})})]})}function Z({project:e}){return(0,V.jsxs)(`dl`,{"data-slot":`project-facts`,className:`grid grid-cols-1 gap-4 text-[13px] sm:grid-cols-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Project`}),(0,V.jsx)(`dd`,{className:`mt-1 font-medium`,children:e.name})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Branch`}),(0,V.jsx)(`dd`,{className:`mt-1 break-all`,children:e.branch??`—`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Status`}),(0,V.jsxs)(`dd`,{"data-slot":`project-general-status`,className:e.status===`missing`?`mt-1 text-danger`:`mt-1`,children:[_e[e.status],e.status===`missing`?` — remove it below, or restore the folder`:null]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Added`}),(0,V.jsxs)(`dd`,{className:`mt-1`,children:[X(e.addedAt),(0,V.jsx)(`span`,{className:`text-soft-foreground`,children:e.source===`checkout`?` · cloned from GitHub`:` · opened locally`})]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Last opened`}),(0,V.jsx)(`dd`,{className:`mt-1`,children:X(e.lastOpenedAt)})]})]})}function Ee({project:e,bootProject:t}){let[n,r]=(0,F.useState)(null),i=he(),a=g(),o=e.id===t;return(0,V.jsxs)(M,{title:`Remove from workspace`,hint:`Unregisters this project so it leaves the sidebar and the project list. Nothing on disk is deleted — the folder, its git history and its task history all stay, and opening it again re-registers it.`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(x,{type:`button`,variant:`outline`,size:`sm`,"data-action":`project-general-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,title:o?`Squawk is serving this project — it re-registers itself at every start`:void 0,disabled:o||i.isPending,onClick:()=>r(e),className:`text-danger`,children:[`Remove `,e.name]}),o?(0,V.jsx)(`span`,{"data-slot":`project-general-remove-boot`,className:`text-xs text-soft-foreground`,children:`Squawk is serving this project — it re-registers itself at every start.`}):null]}),(0,V.jsx)(ge,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{r(null),i.confirm(e,()=>void a(`/p/${encodeURIComponent(t)}`))}})]})}function De(e){return e===`global`?{Link:h,NavLink:_}:{Link:E,NavLink:w}}function Q({scope:e,title:t,mobileTitle:n,description:r}){let i=O().name,a=e===`global`?`every project`:i??`this project`;return{headerSlot:`settings-main-header`,title:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`md:hidden`,children:n}),(0,V.jsxs)(`span`,{className:`max-md:hidden`,children:[t,` `,(0,V.jsxs)(`span`,{"data-slot":`page-header-scope`,className:`font-normal text-soft-foreground`,children:[`· `,a]})]})]}),subtitle:r,hideSubtitleOnMobile:!0,headerExtra:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{"data-slot":`settings-mobile-scope`,className:`mt-1 text-[13px] text-muted-foreground md:hidden`,children:e===`global`?`Applies to every project`:a}),e===`global`?(0,V.jsx)(`span`,{"data-slot":`settings-scope-chip`,className:`sr-only`,children:`Global settings`}):null]})}}function $({scope:e,activeId:t}){let{NavLink:n}=De(e),r=k(e);return(0,V.jsxs)(`details`,{className:`settings-section-picker md:hidden`,children:[(0,V.jsxs)(`summary`,{children:[r.find(e=>e.id===t)?.title??`General`,(0,V.jsx)(y,{"aria-hidden":`true`,className:`size-5 text-muted-foreground`})]}),(0,V.jsxs)(`nav`,{"aria-label":`Settings sections`,"data-slot":`settings-nav-mobile`,"data-scope":e,children:[e===`project`?(0,V.jsx)(n,{to:`/settings`,end:!0,"data-slot":`settings-nav-index`,children:`General`}):null,r.map(t=>(0,V.jsx)(n,{to:A(e,t.id),"data-section":t.id,children:t.title},t.id))]})]},`${e}-${t}`)}function Oe({section:e,scope:t}){let n=e.component,r=T(),i=Q({scope:t,title:e.title,description:e.description,mobileTitle:t===`global`?`Global settings`:`Project settings`});return(0,V.jsx)(e.id===`agent-config`?re:D,{route:t===`global`?`settings-global-${e.id}`:`settings-${e.id}`,density:`full`,className:`settings-route`,header:i,children:(0,V.jsxs)(`div`,{className:`settings-route-body flex min-w-0 flex-1 flex-col md:flex-row`,children:[(0,V.jsxs)(`div`,{"data-slot":`settings-mobile-section`,className:`flex flex-col gap-2 md:hidden`,children:[(0,V.jsx)($,{scope:t,activeId:e.id}),e.description?(0,V.jsx)(`p`,{"data-slot":`settings-mobile-section-subtitle`,className:`px-1 text-[13px] leading-normal text-muted-foreground`,children:e.description}):null]}),(0,V.jsxs)(`section`,{className:`settings-panel min-w-0 self-start md:flex-1`,"aria-label":e.title,children:[(0,V.jsx)(`h2`,{className:`settings-panel-title sr-only`,children:e.title}),(0,V.jsx)(N,{children:(0,V.jsx)(n,{})},`${r??``}:${e.id}`)]})]})})}function ke(){let e=Q({scope:`project`,title:`General`,mobileTitle:`Project settings`}),t=T();return(0,V.jsx)(D,{route:`settings`,density:`full`,className:`settings-route`,header:e,children:(0,V.jsxs)(`div`,{className:`settings-route-body flex min-w-0 flex-1 flex-col md:flex-row`,children:[(0,V.jsx)($,{scope:`project`,activeId:null}),(0,V.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-5`,children:(0,V.jsxs)(N,{children:[(0,V.jsx)(Te,{}),(0,V.jsx)(`section`,{className:`rounded-lg border border-card-edge bg-card p-5 shadow-card`,children:(0,V.jsx)(me,{})}),(0,V.jsx)(`h2`,{className:`settings-other-title mt-6 rounded-t-lg border border-b-0 border-card-edge bg-card px-5 pt-5 text-base font-semibold shadow-card md:hidden`,children:`Other project settings`}),(0,V.jsx)(`ul`,{"data-slot":`settings-index`,className:`mt-7 flex w-full flex-col gap-5 md:hidden`,children:k(`project`).map(e=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(E,{to:A(`project`,e.id),"data-section":e.id,className:`flex items-center gap-3.5 rounded-lg border border-card-edge bg-card p-4 shadow-card transition-colors hover:bg-card-2`,children:[(0,V.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center text-accent-text`,children:(0,V.jsx)(e.icon,{"aria-hidden":`true`,className:`size-4`})}),(0,V.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:e.title}),(0,V.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description})]}),(0,V.jsx)(v,{"aria-hidden":`true`,className:`size-4 shrink-0 text-soft-foreground`})]})},e.id))}),(0,V.jsxs)(`p`,{className:`mt-5 w-full text-[12px] text-soft-foreground`,children:[`Appearance, preferences, host resources and the project registry live in`,` `,(0,V.jsx)(h,{to:oe,"data-slot":`settings-global-link`,className:`underline underline-offset-2 hover:text-foreground`,children:`Global settings`}),`.`]})]},t??``)})]})})}export{ke as SettingsIndexRoute,Oe as SettingsSectionRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ft as r,It as i,Mt as a,St as o,gt as s,kt as c}from"./queries-CIeJg62Y.js";import{Cn as l,Dn as u,On as d,Sn as f,n as p,wn as m}from"./toaster-D0HMoto5.js";import{n as h,p as g,r as _}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{d as v,u as y}from"./design-icons-QbNMZniQ.js";import{t as b}from"./plus-CxRU2X8C.js";import{t as x}from"./button-C8jUIs8Q.js";import{n as ee,r as te,t as ne}from"./collapsible-Bx2vViFx.js";import{t as S}from"./switch-CAKeV99j.js";import{t as C}from"./badge-B6B-xYQQ.js";import{n as w,s as T,t as E}from"./project-router-BHFXTx5l.js";import"./attention-V1gJ7gKo.js";import{o as D,u as re}from"./page-shell-Dky5crRl.js";import{$n as ie,V as O,ht as k,mt as A,pt as ae,rr as j,vn as oe}from"./index-zhwJL4R4.js";import{t as se}from"./textarea-vEsJAUAV.js";import{n as ce}from"./save-cue-CpHgT93o.js";import{n as M}from"./settings-field-Bhh8I9fJ.js";import{t as le}from"./project-location-CxcuM0pc.js";import{n as N,r as ue,t as de}from"./settings-save-bar-CJjHCAfn.js";import{n as fe,t as pe}from"./saved-draft-BwzBc-_Y.js";import{t as me}from"./archive-on-merge-field-C5oo__jZ.js";import{a as he,i as ge,n as _e,t as P}from"./projects-section-B6ZCAwGT.js";var F=e(t(),1),I={"needs-you":{label:`Needs you`,hint:`Asks a question, asks for permission, or waits for review`},failed:{label:`Failed`,hint:`Failed, with no scheduled resume`},done:{label:`Done`,hint:`Finished`},cancelled:{label:`Cancelled`,hint:`Was cancelled`},running:{label:`Running`,hint:`Runs an agent turn`},"waiting-workers":{label:`Waiting for agents`,hint:`Waits on its workers or their replies`},"waiting-ci":{label:`Waiting on CI`,hint:`Waits on a pull request's checks`},"waiting-timer":{label:`Waiting`,hint:`Waits on a timer`},"waiting-other":{label:`Any other wait`,hint:`Waits on anything else, including wait types added later`}},L=(e,t)=>e.length===t.length&&e.every(e=>t.includes(e)),R={name:``,description:``,url:``,token:``,tasks:!0,triggers:u,agent:!1};function z(e){return{name:e.name,description:e.description??``,url:e.url,token:``,tasks:e.tasks,triggers:e.triggers??u,agent:e.agent}}var B=e=>d.filter(t=>e.includes(t));function ve(e){let t=e.description.trim();return{name:e.name.trim(),url:e.url.trim(),...t?{description:t}:{},...e.token?{token:e.token}:{},tasks:e.tasks,...L(e.triggers,u)?{}:{triggers:B(e.triggers)},agent:e.agent}}function ye(e){return e.name.trim()!==``||e.description.trim()!==``||e.url.trim()!==``||e.token!==``||e.tasks!==R.tasks||e.agent!==R.agent||!L(e.triggers,R.triggers)}function be(e,t){let n={},r=e.name.trim(),i=e.description.trim(),a=e.url.trim();return r!==t.name&&(n.name=r),i!==(t.description??``)&&(n.description=i),a!==t.url&&(n.url=a),e.token&&(n.token=e.token),e.tasks!==t.tasks&&(n.tasks=e.tasks),L(e.triggers,t.triggers??u)||(n.triggers=B(e.triggers)),e.agent!==t.agent&&(n.agent=e.agent),n}var V=n(),H=`flex flex-col gap-1 text-[13px]`,U=`text-xs text-muted-foreground`;function W({draft:e,onChange:t,tokenSet:n}){let r=(0,F.useId)(),i=(0,F.useId)(),a=(0,F.useId)(),o=(0,F.useId)(),s=(0,F.useId)(),c=(0,F.useId)(),u=(0,F.useId)(),p=(0,F.useId)(),h=(0,F.useId)(),g=(0,F.useId)();return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,14rem),1fr))] gap-3`,children:[(0,V.jsxs)(`div`,{className:H,children:[(0,V.jsx)(`label`,{htmlFor:r,className:U,children:`Name`}),(0,V.jsx)(j,{id:r,"data-slot":`webhook-name`,autoComplete:`off`,maxLength:80,placeholder:`e.g. Team bot`,value:e.name,onChange:e=>t({name:e.target.value})})]}),(0,V.jsxs)(`div`,{className:H,children:[(0,V.jsx)(`label`,{htmlFor:o,className:U,children:`URL`}),(0,V.jsx)(j,{id:o,"data-slot":`webhook-url`,type:`url`,inputMode:`url`,autoComplete:`off`,spellCheck:!1,maxLength:m,placeholder:`https://bot.example/hooks/cez`,value:e.url,onChange:e=>t({url:e.target.value})})]})]}),(0,V.jsxs)(`div`,{className:H,children:[(0,V.jsx)(`label`,{htmlFor:i,className:U,children:`Description`}),(0,V.jsx)(se,{id:i,"data-slot":`webhook-description`,"aria-describedby":a,rows:2,maxLength:f,placeholder:`e.g. Posts to the #releases channel. Use it for release notes.`,value:e.description,onChange:e=>t({description:e.target.value})}),(0,V.jsx)(`span`,{id:a,className:`text-xs text-soft-foreground`,children:`Agents read the name and description to decide when to use this webhook.`})]}),(0,V.jsxs)(`div`,{className:H,children:[(0,V.jsx)(`label`,{htmlFor:s,className:U,children:`Token`}),(0,V.jsx)(j,{id:s,"data-slot":`webhook-token`,type:`password`,autoComplete:`new-password`,spellCheck:!1,maxLength:l,"aria-describedby":c,placeholder:n?`Token set — type to replace`:`Optional Bearer token`,value:e.token,onChange:e=>t({token:e.target.value})}),(0,V.jsx)(`span`,{id:c,className:`text-xs text-soft-foreground`,children:n?`The token is stored in ~/.cezar and never shown again. Leave it empty to keep it.`:`The token is stored in ~/.cezar, never in the repo. It is sent as a Bearer header.`})]}),(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,V.jsxs)(`div`,{className:`flex min-h-11 items-center gap-3`,children:[(0,V.jsx)(S,{id:u,"aria-describedby":p,"data-slot":`webhook-tasks`,checked:e.tasks,onCheckedChange:e=>t({tasks:e})}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col text-[13px]`,children:[(0,V.jsx)(`label`,{htmlFor:u,className:`font-medium`,children:`Task notifications`}),(0,V.jsx)(`span`,{id:p,className:`text-xs text-soft-foreground`,children:`Tasks you hand off, or start with notify on, send their status here.`})]})]}),e.tasks?(0,V.jsxs)(`fieldset`,{"data-slot":`webhook-triggers`,className:`flex flex-col gap-1 sm:ps-[3.25rem]`,children:[(0,V.jsx)(`legend`,{className:`pbe-1 text-xs text-muted-foreground`,children:`Send a delivery when a task enters`}),(0,V.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(min(100%,15rem),1fr))] gap-x-3`,children:d.map(n=>(0,V.jsxs)(`label`,{className:`flex min-h-11 items-start gap-2.5 pbs-2 text-[13px]`,children:[(0,V.jsx)(`input`,{type:`checkbox`,"data-trigger":n,checked:e.triggers.includes(n),onChange:r=>t({triggers:r.target.checked?[...e.triggers,n]:e.triggers.filter(e=>e!==n)}),className:`mbs-0.5 size-[18px] shrink-0`}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:I[n].label}),(0,V.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:I[n].hint})]})]},n))}),(0,V.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Handing a task off and Send test always deliver.`})]}):null]}),(0,V.jsxs)(`div`,{className:`flex min-h-11 items-center gap-3`,children:[(0,V.jsx)(S,{id:h,"aria-describedby":g,"data-slot":`webhook-agent`,checked:e.agent,onCheckedChange:e=>t({agent:e})}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col text-[13px]`,children:[(0,V.jsx)(`label`,{htmlFor:h,className:`font-medium`,children:`Let agents send reports`}),(0,V.jsx)(`span`,{id:g,className:`text-xs text-soft-foreground`,children:`Agents in this project may post a report here when the task calls for it.`})]})]})]})}var G=`max-sm:h-11`,K=(e,t)=>({tone:`alert`,text:`Not saved: ${e.message}. Fix the field and select ${t} again.`}),xe=e=>e.dryRun?{tone:`ok`,text:`Dry run: nothing was sent.`}:e.ok?{tone:`ok`,text:`Delivered (HTTP ${e.status??200}).`}:{tone:`danger`,text:`Not delivered: ${e.error??`unknown error`}.`};function q({feedback:e}){return e?(0,V.jsx)(`p`,{"data-slot":e.tone===`alert`?`webhook-error`:`webhook-result`,role:e.tone===`alert`?`alert`:`status`,className:e.tone===`ok`?`text-[13px] text-muted-foreground`:`text-[13px] text-danger`,children:e.text}):null}var J=`rounded-md border border-border bg-background`,Y=`flex flex-col gap-3 border-bs border-border p-3`;function Se({projectId:e,webhook:t,defaultOpen:n=!1}){let i=r(),o=c(),s=a(),[l,u]=(0,F.useState)(n),[d,f]=fe(z(t),pe),[m,h]=(0,F.useState)(null),g=be(d,t),_=Object.keys(g).length>0,v=d.name.trim()!==``&&d.url.trim()!==``,b=i.isPending||o.isPending||s.isPending,S={projectId:e,webhookId:t.id},w=()=>(h(null),i.mutateAsync({...S,...g},{onSuccess:()=>f(e=>({...e,token:``})),onError:e=>h(K(e,`Save`))}));ue({dirty:_,invalid:!v,busy:b,save:w,discard:()=>f(z(t))});let T=()=>s.mutate(S,{onSuccess:e=>h(xe(e)),onError:e=>h({tone:`danger`,text:e.message})});return(0,V.jsx)(`li`,{"data-slot":`webhook-card`,"data-webhook-id":t.id,className:J,children:(0,V.jsxs)(ne,{open:l,onOpenChange:u,children:[(0,V.jsx)(te,{asChild:!0,children:(0,V.jsxs)(`button`,{type:`button`,"data-action":`webhook-toggle`,className:`group flex min-h-11 w-full items-center gap-3 rounded-md p-3 text-start focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-foreground pointer-hover:bg-muted/50 active:bg-muted/50`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,V.jsx)(`span`,{"data-slot":`webhook-card-name`,className:`min-w-0 break-words text-[13px] font-medium`,children:t.name}),t.tasks?(0,V.jsx)(C,{variant:`secondary`,"data-badge":`tasks`,children:`Task notifications`}):null,t.agent?(0,V.jsx)(C,{variant:`secondary`,"data-badge":`agent`,children:`Agents`}):null]}),(0,V.jsx)(`span`,{"data-slot":`webhook-card-url`,className:`truncate text-[12px] text-muted-foreground`,children:O(t.url)})]}),(0,V.jsx)(y,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground group-data-[state=open]:rotate-180`})]})}),(0,V.jsx)(ee,{children:(0,V.jsxs)(`form`,{"data-slot":`webhook-form`,"data-reports-dirty":``,className:Y,onSubmit:e=>{e.preventDefault(),h(null),v&&_&&!b&&w().catch(()=>{})},children:[(0,V.jsx)(W,{draft:d,tokenSet:t.tokenSet,onChange:e=>f(t=>({...t,...e}))}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(x,{type:`button`,size:`sm`,className:G,variant:`outline`,"data-action":`webhook-test`,disabled:b||!v,onClick:()=>{h(null),_?w().then(T,()=>{}):T()},children:`Send test`}),t.tokenSet?(0,V.jsx)(x,{type:`button`,size:`sm`,className:G,variant:`ghost`,"data-action":`webhook-clear-token`,disabled:b,onClick:()=>i.mutate({...S,token:``},{onSuccess:()=>p(`Webhook token cleared`),onError:e=>h({tone:`danger`,text:`Token not cleared: ${e.message}.`})}),children:`Clear token`}):null,(0,V.jsx)(x,{type:`button`,size:`sm`,className:G,variant:`danger-ghost`,"data-action":`webhook-remove`,"aria-label":`Remove ${t.name}`,disabled:b,onClick:()=>o.mutate(S,{onSuccess:()=>p(`${t.name} removed`),onError:e=>h({tone:`danger`,text:`Not removed: ${e.message}.`})}),children:`Remove`})]}),(0,V.jsx)(q,{feedback:m}),(0,V.jsx)(de,{})]})})]})})}function Ce({projectId:e,onCreated:t,onCancel:n}){let r=s(),[i,a]=(0,F.useState)(R),[o,c]=(0,F.useState)(null),l=i.name.trim()!==``&&i.url.trim()!==``;return oe(ye(i)),(0,V.jsxs)(`li`,{"data-slot":`webhook-card`,"data-draft":``,className:J,children:[(0,V.jsx)(`p`,{className:`p-3 text-[13px] font-medium`,children:`New webhook`}),(0,V.jsxs)(`form`,{"data-slot":`webhook-form`,"data-reports-dirty":``,"aria-label":`New webhook`,className:Y,onSubmit:n=>{n.preventDefault(),c(null),l&&r.mutate({projectId:e,...ve(i)},{onSuccess:({webhook:e})=>{p(`${e.name} created`),t(e)},onError:e=>c(K(e,`Create`))})},children:[(0,V.jsx)(W,{draft:i,tokenSet:!1,onChange:e=>a(t=>({...t,...e}))}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(x,{type:`submit`,size:`sm`,className:G,variant:`outline`,"data-action":`webhook-create`,disabled:r.isPending||!l,children:`Create`}),(0,V.jsx)(x,{type:`button`,size:`sm`,className:G,variant:`ghost`,"data-action":`webhook-cancel`,disabled:r.isPending,onClick:n,children:`Cancel`})]}),(0,V.jsx)(q,{feedback:o})]})]})}function we({project:e}){let t=e.webhooks??[],[n,r]=(0,F.useState)(!1),[i,a]=(0,F.useState)(null),o=t.length>=16;return(0,V.jsx)(M,{wide:!0,title:`Webhooks`,hint:`A webhook gets a POST from Squawk. Tasks can send their status to it, and agents can send it reports.`,children:(0,V.jsxs)(`div`,{"data-slot":`project-webhooks`,className:`flex flex-col gap-3`,children:[t.length===0&&!n?(0,V.jsx)(`p`,{"data-slot":`webhooks-empty`,className:`text-[13px] text-soft-foreground`,children:`No webhooks yet. Add one to send task updates to a bot, or to let agents post reports.`}):null,t.length>0||n?(0,V.jsxs)(`ul`,{className:`flex flex-col gap-2`,children:[t.map(t=>(0,V.jsx)(Se,{projectId:e.id,webhook:t,defaultOpen:t.id===i},t.id)),n?(0,V.jsx)(Ce,{projectId:e.id,onCancel:()=>r(!1),onCreated:e=>{a(e.id),r(!1)}}):null]}):null,n?null:(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsxs)(x,{type:`button`,size:`sm`,variant:`outline`,className:`max-sm:h-11`,"data-action":`webhook-add`,disabled:o,onClick:()=>r(!0),children:[(0,V.jsx)(b,{"aria-hidden":`true`}),`Add webhook`]}),o?(0,V.jsxs)(`span`,{className:`text-xs text-soft-foreground`,children:[`A project holds at most `,16,` webhooks.`]}):null]})]})})}function X(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}function Te(){let e=T(),t=o(),n=i(),r=ce();if(t.isPending)return(0,V.jsx)(`p`,{"data-slot":`project-general-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading project…`});if(t.isError)return(0,V.jsxs)(`p`,{"data-slot":`project-general-error`,className:`text-[13px] text-danger`,children:[`Could not read the project registry — `,t.error.message]});let a=t.data,s=a?.projects.find(t=>t.id===e);return!a||!s?null:(0,V.jsxs)(`div`,{"data-slot":`project-general`,className:`flex w-full flex-col gap-5`,children:[(0,V.jsxs)(`section`,{className:`flex flex-col gap-5 rounded-lg border border-border bg-card p-5 [&_select]:min-h-11 [&_select]:w-full`,children:[(0,V.jsx)(`h2`,{className:`text-lg font-semibold`,children:`General`}),(0,V.jsx)(le,{}),(0,V.jsx)(Z,{project:s}),(0,V.jsx)(M,{title:`Max parallel tasks`,saved:r.saved,hint:n.data?`The workspace limit (${n.data.resources.maxParallel}) still applies as an overall ceiling.`:`How many of this project's tasks may run at once. The workspace limit still applies as an overall ceiling.`,children:n.data?(0,V.jsx)(P,{project:s,workspaceMax:n.data.resources.maxParallel,onSaved:r.flash}):(0,V.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading the workspace limit…`})}),(0,V.jsx)(we,{project:s},s.id)]}),(0,V.jsx)(`section`,{className:`rounded-lg border border-border bg-card p-5`,children:(0,V.jsx)(Ee,{project:s,bootProject:a.bootProject})})]})}function Z({project:e}){return(0,V.jsxs)(`dl`,{"data-slot":`project-facts`,className:`grid grid-cols-1 gap-4 text-[13px] sm:grid-cols-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Project`}),(0,V.jsx)(`dd`,{className:`mt-1 font-medium`,children:e.name})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Branch`}),(0,V.jsx)(`dd`,{className:`mt-1 break-all`,children:e.branch??`—`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Status`}),(0,V.jsxs)(`dd`,{"data-slot":`project-general-status`,className:e.status===`missing`?`mt-1 text-danger`:`mt-1`,children:[_e[e.status],e.status===`missing`?` — remove it below, or restore the folder`:null]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Added`}),(0,V.jsxs)(`dd`,{className:`mt-1`,children:[X(e.addedAt),(0,V.jsx)(`span`,{className:`text-soft-foreground`,children:e.source===`checkout`?` · cloned from GitHub`:` · opened locally`})]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Last opened`}),(0,V.jsx)(`dd`,{className:`mt-1`,children:X(e.lastOpenedAt)})]})]})}function Ee({project:e,bootProject:t}){let[n,r]=(0,F.useState)(null),i=he(),a=g(),o=e.id===t;return(0,V.jsxs)(M,{title:`Remove from workspace`,hint:`Unregisters this project so it leaves the sidebar and the project list. Nothing on disk is deleted — the folder, its git history and its task history all stay, and opening it again re-registers it.`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(x,{type:`button`,variant:`outline`,size:`sm`,"data-action":`project-general-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,title:o?`Squawk is serving this project — it re-registers itself at every start`:void 0,disabled:o||i.isPending,onClick:()=>r(e),className:`text-danger`,children:[`Remove `,e.name]}),o?(0,V.jsx)(`span`,{"data-slot":`project-general-remove-boot`,className:`text-xs text-soft-foreground`,children:`Squawk is serving this project — it re-registers itself at every start.`}):null]}),(0,V.jsx)(ge,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{r(null),i.confirm(e,()=>void a(`/p/${encodeURIComponent(t)}`))}})]})}function De(e){return e===`global`?{Link:h,NavLink:_}:{Link:E,NavLink:w}}function Q({scope:e,title:t,mobileTitle:n,description:r}){let i=ie().name,a=e===`global`?`every project`:i??`this project`;return{headerSlot:`settings-main-header`,title:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`md:hidden`,children:n}),(0,V.jsxs)(`span`,{className:`max-md:hidden`,children:[t,` `,(0,V.jsxs)(`span`,{"data-slot":`page-header-scope`,className:`font-normal text-soft-foreground`,children:[`· `,a]})]})]}),subtitle:r,hideSubtitleOnMobile:!0,headerExtra:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{"data-slot":`settings-mobile-scope`,className:`mt-1 text-[13px] text-muted-foreground md:hidden`,children:e===`global`?`Applies to every project`:a}),e===`global`?(0,V.jsx)(`span`,{"data-slot":`settings-scope-chip`,className:`sr-only`,children:`Global settings`}):null]})}}function $({scope:e,activeId:t}){let{NavLink:n}=De(e),r=k(e);return(0,V.jsxs)(`details`,{className:`settings-section-picker md:hidden`,children:[(0,V.jsxs)(`summary`,{children:[r.find(e=>e.id===t)?.title??`General`,(0,V.jsx)(y,{"aria-hidden":`true`,className:`size-5 text-muted-foreground`})]}),(0,V.jsxs)(`nav`,{"aria-label":`Settings sections`,"data-slot":`settings-nav-mobile`,"data-scope":e,children:[e===`project`?(0,V.jsx)(n,{to:`/settings`,end:!0,"data-slot":`settings-nav-index`,children:`General`}):null,r.map(t=>(0,V.jsx)(n,{to:A(e,t.id),"data-section":t.id,children:t.title},t.id))]})]},`${e}-${t}`)}function Oe({section:e,scope:t}){let n=e.component,r=T(),i=Q({scope:t,title:e.title,description:e.description,mobileTitle:t===`global`?`Global settings`:`Project settings`});return(0,V.jsx)(e.id===`agent-config`?re:D,{route:t===`global`?`settings-global-${e.id}`:`settings-${e.id}`,density:`full`,className:`settings-route`,header:i,children:(0,V.jsxs)(`div`,{className:`settings-route-body flex min-w-0 flex-1 flex-col md:flex-row`,children:[(0,V.jsxs)(`div`,{"data-slot":`settings-mobile-section`,className:`flex flex-col gap-2 md:hidden`,children:[(0,V.jsx)($,{scope:t,activeId:e.id}),e.description?(0,V.jsx)(`p`,{"data-slot":`settings-mobile-section-subtitle`,className:`px-1 text-[13px] leading-normal text-muted-foreground`,children:e.description}):null]}),(0,V.jsxs)(`section`,{className:`settings-panel min-w-0 self-start md:flex-1`,"aria-label":e.title,children:[(0,V.jsx)(`h2`,{className:`settings-panel-title sr-only`,children:e.title}),(0,V.jsx)(N,{children:(0,V.jsx)(n,{})},`${r??``}:${e.id}`)]})]})})}function ke(){let e=Q({scope:`project`,title:`General`,mobileTitle:`Project settings`}),t=T();return(0,V.jsx)(D,{route:`settings`,density:`full`,className:`settings-route`,header:e,children:(0,V.jsxs)(`div`,{className:`settings-route-body flex min-w-0 flex-1 flex-col md:flex-row`,children:[(0,V.jsx)($,{scope:`project`,activeId:null}),(0,V.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-5`,children:(0,V.jsxs)(N,{children:[(0,V.jsx)(Te,{}),(0,V.jsx)(`section`,{className:`rounded-lg border border-card-edge bg-card p-5 shadow-card`,children:(0,V.jsx)(me,{})}),(0,V.jsx)(`h2`,{className:`settings-other-title mt-6 rounded-t-lg border border-b-0 border-card-edge bg-card px-5 pt-5 text-base font-semibold shadow-card md:hidden`,children:`Other project settings`}),(0,V.jsx)(`ul`,{"data-slot":`settings-index`,className:`mt-7 flex w-full flex-col gap-5 md:hidden`,children:k(`project`).map(e=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(E,{to:A(`project`,e.id),"data-section":e.id,className:`flex items-center gap-3.5 rounded-lg border border-card-edge bg-card p-4 shadow-card transition-colors hover:bg-card-2`,children:[(0,V.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center text-accent-text`,children:(0,V.jsx)(e.icon,{"aria-hidden":`true`,className:`size-4`})}),(0,V.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:e.title}),(0,V.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description})]}),(0,V.jsx)(v,{"aria-hidden":`true`,className:`size-4 shrink-0 text-soft-foreground`})]})},e.id))}),(0,V.jsxs)(`p`,{className:`mt-5 w-full text-[12px] text-soft-foreground`,children:[`Appearance, preferences, host resources and the project registry live in`,` `,(0,V.jsx)(h,{to:ae,"data-slot":`settings-global-link`,className:`underline underline-offset-2 hover:text-foreground`,children:`Global settings`}),`.`]})]},t??``)})]})})}export{ke as SettingsIndexRoute,Oe as SettingsSectionRoute};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{p as r}from"./dist-C_rn70hE.js";import{dn as i,y as a}from"./queries-CIeJg62Y.js";import{I as o,Rr as s,hi as c,zr as l}from"./toaster-D0HMoto5.js";import{t as u}from"./button-C8jUIs8Q.js";import{r as d,t as f}from"./settings-save-bar-CfUNcwW4.js";var p=e(t(),1),m=n(),h=[[`overall`,`Overall`],[`needsYou`,`Needs You`],[`finished`,`Finished`],[`working`,`Working`]];function g(){let e=r(),t=a(e);return t.isPending?(0,m.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-muted-foreground`,children:`Loading sidebar settings…`}):t.isError?(0,m.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,m.jsxs)(`p`,{role:`alert`,children:[`Sidebar settings did not load: `,t.error.message]}),(0,m.jsx)(u,{className:`min-h-[44px]`,onClick:()=>void t.refetch(),children:`Retry`})]}):(0,m.jsx)(_,{scope:e,initial:t.data.sidebarLimits??{}},e)}function _({scope:e,initial:t}){let n=c(),r=s(void 0),a=v(t),[u,g]=(0,p.useState)(()=>({values:a,saved:a,received:a})),{values:_,saved:b}=u,x=e=>g(t=>({...t,values:e})),S=l.safeParse(Object.fromEntries(h.map(([e])=>[e,_[e]===null?null:Number(_[e])]))),C=e=>_[e]!==null&&(_[e].trim()===``||!Number.isSafeInteger(Number(_[e]))||Number(_[e])<=0),w=h.some(([e])=>_[e]!==b[e]),T=!S.success||h.some(([e])=>C(e)),E=i({onMutate:()=>n.cancelQueries({queryKey:[e,`ui-state`],exact:!0}),mutationFn:t=>o({sidebarLimits:t},e),onSuccess:async t=>{await n.cancelQueries({queryKey:[e,`ui-state`],exact:!0}),n.setQueryData([e,`ui-state`],t);let r=v(t.sidebarLimits);g({values:r,saved:r,received:r})}}),D=()=>S.success?E.mutateAsync(S.data):Promise.reject(Error(`invalid sidebar limits`));return d({dirty:w,invalid:T,busy:E.isPending,save:D,discard:()=>g(e=>({...e,values:e.saved}))}),!E.isPending&&!y(u.received,a)&&g({values:w?_:a,saved:a,received:a}),(0,m.jsxs)(`form`,{"data-slot":`sidebar-settings`,"data-reports-dirty":``,className:`flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6`,onSubmit:e=>{e.preventDefault(),w&&!T&&!E.isPending&&D().catch(()=>{})},children:[(0,m.jsx)(`p`,{id:`sidebar-limits-help`,className:`text-sm text-muted-foreground`,children:`Limits apply to this project on desktop and mobile. The overall budget is shared in section order: Needs You, Finished, then Working. Each section also respects its own limit. Unlimited removes only that constraint.`}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pinned tasks and groups containing a pin bypass both limits. A task group counts as one row. Archived uses only the overall limit; archived pins are not exempt.`}),h.map(([e,t])=>(0,m.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,m.jsx)(`label`,{htmlFor:`sidebar-${e}`,className:`text-sm font-medium`,children:t}),(0,m.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,m.jsx)(`input`,{id:`sidebar-${e}`,type:`number`,inputMode:`numeric`,min:`1`,step:`1`,value:_[e]??``,disabled:_[e]===null||E.isPending,"aria-invalid":C(e),"aria-describedby":C(e)?`sidebar-${e}-error sidebar-limits-help`:`sidebar-limits-help`,onChange:t=>x({..._,[e]:t.target.value}),className:`min-h-[44px] w-28 rounded-md border border-input bg-card px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50`}),(0,m.jsxs)(`label`,{className:`flex min-h-[44px] cursor-pointer items-center gap-2 text-sm`,children:[(0,m.jsx)(`input`,{type:`checkbox`,"aria-label":`${t} Unlimited`,checked:_[e]===null,disabled:E.isPending,onChange:t=>x({..._,[e]:t.target.checked?null:String(r[e]??10)}),className:`size-4 accent-[var(--accent-strong)]`}),`Unlimited`]})]}),C(e)&&(0,m.jsx)(`p`,{id:`sidebar-${e}-error`,className:`text-sm text-danger`,children:`Enter a positive whole number or choose Unlimited.`})]},e)),E.isError&&(0,m.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not save sidebar limits: `,E.error.message]}),(0,m.jsx)(f,{})]})}function v(e){let t=s(e);return Object.fromEntries(h.map(([e])=>[e,t[e]===null?null:String(t[e])]))}function y(e,t){return h.every(([n])=>e[n]===t[n])}export{g as SidebarSection};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{p as r}from"./dist-C_rn70hE.js";import{dn as i,y as a}from"./queries-CIeJg62Y.js";import{I as o,Rr as s,hi as c,zr as l}from"./toaster-D0HMoto5.js";import{t as u}from"./button-C8jUIs8Q.js";import{r as d,t as f}from"./settings-save-bar-CJjHCAfn.js";var p=e(t(),1),m=n(),h=[[`overall`,`Overall`],[`needsYou`,`Needs You`],[`finished`,`Finished`],[`working`,`Working`]];function g(){let e=r(),t=a(e);return t.isPending?(0,m.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-muted-foreground`,children:`Loading sidebar settings…`}):t.isError?(0,m.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,m.jsxs)(`p`,{role:`alert`,children:[`Sidebar settings did not load: `,t.error.message]}),(0,m.jsx)(u,{className:`min-h-[44px]`,onClick:()=>void t.refetch(),children:`Retry`})]}):(0,m.jsx)(_,{scope:e,initial:t.data.sidebarLimits??{}},e)}function _({scope:e,initial:t}){let n=c(),r=s(void 0),a=v(t),[u,g]=(0,p.useState)(()=>({values:a,saved:a,received:a})),{values:_,saved:b}=u,x=e=>g(t=>({...t,values:e})),S=l.safeParse(Object.fromEntries(h.map(([e])=>[e,_[e]===null?null:Number(_[e])]))),C=e=>_[e]!==null&&(_[e].trim()===``||!Number.isSafeInteger(Number(_[e]))||Number(_[e])<=0),w=h.some(([e])=>_[e]!==b[e]),T=!S.success||h.some(([e])=>C(e)),E=i({onMutate:()=>n.cancelQueries({queryKey:[e,`ui-state`],exact:!0}),mutationFn:t=>o({sidebarLimits:t},e),onSuccess:async t=>{await n.cancelQueries({queryKey:[e,`ui-state`],exact:!0}),n.setQueryData([e,`ui-state`],t);let r=v(t.sidebarLimits);g({values:r,saved:r,received:r})}}),D=()=>S.success?E.mutateAsync(S.data):Promise.reject(Error(`invalid sidebar limits`));return d({dirty:w,invalid:T,busy:E.isPending,save:D,discard:()=>g(e=>({...e,values:e.saved}))}),!E.isPending&&!y(u.received,a)&&g({values:w?_:a,saved:a,received:a}),(0,m.jsxs)(`form`,{"data-slot":`sidebar-settings`,"data-reports-dirty":``,className:`flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6`,onSubmit:e=>{e.preventDefault(),w&&!T&&!E.isPending&&D().catch(()=>{})},children:[(0,m.jsx)(`p`,{id:`sidebar-limits-help`,className:`text-sm text-muted-foreground`,children:`Limits apply to this project on desktop and mobile. The overall budget is shared in section order: Needs You, Finished, then Working. Each section also respects its own limit. Unlimited removes only that constraint.`}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pinned tasks and groups containing a pin bypass both limits. A task group counts as one row. Archived uses only the overall limit; archived pins are not exempt.`}),h.map(([e,t])=>(0,m.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,m.jsx)(`label`,{htmlFor:`sidebar-${e}`,className:`text-sm font-medium`,children:t}),(0,m.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,m.jsx)(`input`,{id:`sidebar-${e}`,type:`number`,inputMode:`numeric`,min:`1`,step:`1`,value:_[e]??``,disabled:_[e]===null||E.isPending,"aria-invalid":C(e),"aria-describedby":C(e)?`sidebar-${e}-error sidebar-limits-help`:`sidebar-limits-help`,onChange:t=>x({..._,[e]:t.target.value}),className:`min-h-[44px] w-28 rounded-md border border-input bg-card px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50`}),(0,m.jsxs)(`label`,{className:`flex min-h-[44px] cursor-pointer items-center gap-2 text-sm`,children:[(0,m.jsx)(`input`,{type:`checkbox`,"aria-label":`${t} Unlimited`,checked:_[e]===null,disabled:E.isPending,onChange:t=>x({..._,[e]:t.target.checked?null:String(r[e]??10)}),className:`size-4 accent-[var(--accent-strong)]`}),`Unlimited`]})]}),C(e)&&(0,m.jsx)(`p`,{id:`sidebar-${e}-error`,className:`text-sm text-danger`,children:`Enter a positive whole number or choose Unlimited.`})]},e)),E.isError&&(0,m.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not save sidebar limits: `,E.error.message]}),(0,m.jsx)(f,{})]})}function v(e){let t=s(e);return Object.fromEntries(h.map(([e])=>[e,t[e]===null?null:String(t[e])]))}function y(e,t){return h.every(([n])=>e[n]===t[n])}export{g as SidebarSection};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{Jt as i,Wt as a,_ as o,nn as s,rn as c}from"./queries-CIeJg62Y.js";import{hi as l,n as u,w as d}from"./toaster-D0HMoto5.js";import{g as f}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{E as p,Q as m,Z as h,ct as g,d as _,k as v,rt as y,u as b,ut as x}from"./design-icons-QbNMZniQ.js";import{t as S}from"./button-C8jUIs8Q.js";import{t as C}from"./project-router-BHFXTx5l.js";import{f as w,l as T}from"./skills-pM_PouEs.js";import{c as E,d as D,f as O,n as k,t as A}from"./page-shell-Dky5crRl.js";import{Hn as j,U as M,bn as N,tr as P}from"./index-MCtGGYNa.js";import{t as F}from"./option-select-C7M2fzIw.js";var I=e(t(),1),L=n(),R=e=>e.split(`@`)[0]||e,z={project:0,user:1,plugin:2,system:3,other:4},B={project:`This project`,user:`Your skills`,system:`Built in`,other:`Other`};function V(e){if(e.plugin)return{key:`plugin:${e.plugin}`,label:R(e.plugin),kind:`plugin`};let t=e.scope===`repo`?`project`:e.scope===`user`?`user`:e.scope===`system`?`system`:`other`;return{key:t,label:B[t],kind:t}}function H(e){let t=new Map;for(let n of e){let e=V(n),r=t.get(e.key)??{...e,skills:[]};r.skills.push(n),t.set(e.key,r)}return[...t.values()].sort((e,t)=>z[e.kind]-z[t.kind]||e.label.localeCompare(t.label))}function U(e){let t=e.plugin?`${R(e.plugin)}:`:``;return t&&e.name.startsWith(t)&&e.name.length>t.length?e.name.slice(t.length):e.name}var W={project:p,user:x,plugin:v,system:v,other:v};function G({groups:e,openId:t,searching:n,runner:r,account:i}){let[a,o]=(0,I.useState)(new Set),s=e=>o(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,L.jsx)(`div`,{"data-slot":`skills-list`,className:`overflow-hidden rounded-xl border border-border bg-card`,children:e.map(e=>{let o=n||!a.has(e.key);return(0,L.jsxs)(`section`,{"data-slot":`skill-group`,"aria-label":e.label,className:`border-border not-first:border-t`,children:[(0,L.jsx)(K,{group:e,open:o,onToggle:()=>s(e.key)}),o?e.skills.map(e=>(0,L.jsx)(q,{skill:e,open:e.id===t,runner:r,account:i},w(e))):null]},e.key)})})}function K({group:e,open:t,onToggle:n}){let i=W[e.kind];return(0,L.jsx)(`h2`,{className:`m-0`,children:(0,L.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:n,className:`flex min-h-10 w-full items-center gap-2 bg-muted/45 px-3.5 text-left text-xs font-semibold text-muted-foreground focus-visible:outline-2 focus-visible:-outline-offset-2 pointer-hover:text-foreground`,children:[(0,L.jsx)(_,{"aria-hidden":`true`,className:r(`size-3.5 transition-transform motion-reduce:transition-none`,t&&`rotate-90`)}),(0,L.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label}),(0,L.jsx)(`span`,{className:`font-medium text-soft-foreground`,children:e.skills.length})]})})}function q({skill:e,open:t,runner:n,account:r}){let i=j({skill:e.id,skillPath:e.path,runner:n,...r?{account:r}:{}});return(0,L.jsxs)(`details`,{"data-slot":`skill-row`,"data-skill":e.id,"data-skill-path":e.path,name:`skill-details`,open:t||void 0,className:`group/skill border-t border-border/60 open:bg-sidebar-row-selected`,children:[(0,L.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center gap-3 py-2 pr-3.5 pl-9 focus-visible:outline-2 focus-visible:-outline-offset-2 pointer-hover:bg-sidebar-row-hover [&::-webkit-details-marker]:hidden`,children:[(0,L.jsxs)(`span`,{className:`grid min-w-0 flex-1 grid-cols-1 items-center gap-x-4 gap-y-0.5 sm:grid-cols-[minmax(10rem,15rem)_minmax(0,1fr)]`,children:[(0,L.jsx)(`span`,{className:`truncate text-[13.5px] leading-snug font-semibold text-foreground`,title:e.name,children:U(e)}),e.description?(0,L.jsx)(`span`,{className:`min-w-0 line-clamp-2 text-[13px] leading-snug text-muted-foreground [overflow-wrap:anywhere] group-open/skill:hidden`,title:e.description,children:e.description}):null]}),(0,L.jsx)(b,{"data-slot":`skill-row-cue`,"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground transition-transform group-open/skill:rotate-180 motion-reduce:transition-none`})]}),(0,L.jsx)(`div`,{className:`pr-3.5 pb-4 pl-9`,children:(0,L.jsx)(M,{skill:e,heading:null,actions:(0,L.jsx)(S,{asChild:!0,size:`sm`,"data-action":`start-task`,children:(0,L.jsx)(C,{to:i,children:`Start task`})})})})]})}function J(){let e=o(),[t,n]=(0,I.useState)(null),[a,c]=(0,I.useState)(null),[l,u]=(0,I.useState)(``),[d]=f(),p=t??e.data?.defaultRunner,{runner:g}=s(p??`claude`),_=a?.runner===g?a.id:null,v=e=>c(e===null?null:{runner:g,id:e}),y=i(p,_),b=$(g,y.account),x=y.data??[],w=T(x,l);return(0,L.jsxs)(D,{route:`skills`,density:y.isPending?`full`:O(w.length),className:`max-md:[padding-block-end:5rem]`,bodyClassName:`gap-5`,header:{title:`Skills`,subtitle:`The skills each agent loads in this project, as its runner reports them.`,secondaryActions:(0,L.jsxs)(E,{variant:`outline`,onClick:()=>void b.run(),disabled:b.running||y.isPending,"data-slot":`skills-refresh`,children:[(0,L.jsx)(h,{"aria-hidden":`true`,className:r(`size-3.5`,b.running&&`motion-safe:animate-spin`)}),`Re-read`]})},sparseFooter:!y.isPending&&w.length>0?(0,L.jsx)(k,{summary:`${w.length} ${w.length===1?`skill`:`skills`} available for this runner. Type / in New task to invoke one, or chain them into a workflow.`,actions:(0,L.jsx)(S,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,L.jsx)(C,{to:`/workflows`,children:`Open workflows`})})}):void 0,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(X,{runner:g,onChange:e=>{n(e),v(null)}}),(0,L.jsx)(Z,{runner:g,account:_,onChange:v}),(0,L.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,"data-slot":`skills-count`,children:y.list?`${x.length} ${x.length===1?`skill`:`skills`}${y.list.source===`cache`?` · from cache`:``}`:null})]}),(0,L.jsxs)(`div`,{className:`relative`,children:[(0,L.jsx)(m,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),(0,L.jsx)(P,{"aria-label":`Search skills`,placeholder:`Filter by name or description…`,value:l,onChange:e=>u(e.target.value),className:`h-10 rounded-lg border-border bg-card pl-9 text-[13px]`})]}),(0,L.jsx)(Q,{query:y}),y.isPending?(0,L.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:`Loading skills…`}):(0,L.jsx)(Y,{skills:x,matches:w,search:l,onClearSearch:()=>u(``),onRefresh:()=>void b.run(),openId:d.get(`skill`),runner:g,account:y.account??null,unchecked:y.unchecked})]})}function Y({skills:e,matches:t,search:n,onClearSearch:r,onRefresh:i,openId:a,runner:o,account:s,unchecked:c}){return e.length===0?c?null:(0,L.jsx)(A,{icon:(0,L.jsx)(y,{}),title:`No skills reported by this runner and account.`,description:`Add a skill to this repository or your runner home, then re-read to refresh the inventory.`,actions:(0,L.jsx)(S,{variant:`outline`,className:`max-md:min-h-11`,onClick:i,children:`Re-read skills`})}):t.length===0?(0,L.jsx)(A,{icon:(0,L.jsx)(m,{}),title:`No skills match “${n.trim()}”.`,description:`Try a different keyword or clear the filter to browse every available skill.`,actions:(0,L.jsx)(S,{variant:`outline`,className:`max-md:min-h-11`,onClick:r,children:`Clear filter`})}):(0,L.jsx)(G,{groups:H(t),openId:a,searching:n.trim()!==``,runner:o,account:s})}function X({runner:e,onChange:t}){let n=c().data;return n?(0,L.jsx)(`div`,{role:`group`,"aria-label":`Runner`,className:`flex max-w-full gap-1 overflow-x-auto rounded-lg border border-border bg-muted/60 p-1`,children:n.runners.map(n=>(0,L.jsx)(`button`,{type:`button`,"aria-pressed":n.id===e,onClick:()=>t(n.id),className:`h-8 shrink-0 rounded-md border border-transparent px-3 text-[13px] font-normal text-muted-foreground transition-colors focus-visible:outline-2 aria-pressed:border-border aria-pressed:bg-card aria-pressed:font-semibold aria-pressed:text-foreground aria-pressed:shadow-xs pointer-hover:text-foreground max-md:h-11`,children:n.displayName},n.id))}):null}function Z({runner:e,account:t,onChange:n}){let r=N().accounts.filter(t=>t.provider===e);return r.length===0?null:(0,L.jsx)(F,{"aria-label":`Account`,value:t??``,onValueChange:e=>n(e||null),options:[{value:``,label:`Account: project default`},...r.map(e=>({value:e.id,label:e.label}))],className:`rounded-lg border-border bg-card text-[13px] text-foreground md:data-[size=default]:h-[38px]`})}function Q({query:e}){let t=e.list?.problems??[];return!e.unchecked&&t.length===0?null:(0,L.jsxs)(`div`,{className:`grid gap-1.5 rounded-lg border border-pending/40 bg-pending/10 px-3.5 py-2.5 text-[13px]`,children:[e.unchecked&&!e.isPending?(0,L.jsxs)(`p`,{role:`status`,className:`flex gap-2`,children:[(0,L.jsx)(g,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-pending-strong`}),(0,L.jsxs)(`span`,{children:[`Skill list unavailable. `,e.list?.reason??e.error?.message,` You can still type a skill id when starting a task.`]})]}):null,t.map((e,t)=>(0,L.jsxs)(`p`,{role:`alert`,className:`flex gap-2 break-words`,children:[(0,L.jsx)(g,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-pending-strong`}),(0,L.jsxs)(`span`,{children:[e.message,e.path?` · ${e.path}`:``]})]},t))]})}function $(e,t){let n=l(),[r,i]=(0,I.useState)(!1),o=a.runnerSkills(e,t);return{running:r,run:async()=>{i(!0);try{n.setQueryData(o,await d(e,t,{refresh:!0})),await n.invalidateQueries({queryKey:o.slice(0,3)})}catch(e){u(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{i(!1)}}}}export{J as SkillsRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{Jt as i,Wt as a,_ as o,nn as s,rn as c}from"./queries-CIeJg62Y.js";import{hi as l,n as u,w as d}from"./toaster-D0HMoto5.js";import{g as f}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{E as p,Q as m,Z as h,ct as g,d as _,k as v,rt as y,u as b,ut as x}from"./design-icons-QbNMZniQ.js";import{t as S}from"./button-C8jUIs8Q.js";import{t as C}from"./project-router-BHFXTx5l.js";import{f as w,l as T}from"./skills-pM_PouEs.js";import{c as E,d as D,f as O,n as k,t as A}from"./page-shell-Dky5crRl.js";import{Sn as j,U as M,Wn as N,rr as P}from"./index-zhwJL4R4.js";import{t as F}from"./option-select-Dw55m71E.js";var I=e(t(),1),L=n(),R=e=>e.split(`@`)[0]||e,z={project:0,user:1,plugin:2,system:3,other:4},B={project:`This project`,user:`Your skills`,system:`Built in`,other:`Other`};function V(e){if(e.plugin)return{key:`plugin:${e.plugin}`,label:R(e.plugin),kind:`plugin`};let t=e.scope===`repo`?`project`:e.scope===`user`?`user`:e.scope===`system`?`system`:`other`;return{key:t,label:B[t],kind:t}}function H(e){let t=new Map;for(let n of e){let e=V(n),r=t.get(e.key)??{...e,skills:[]};r.skills.push(n),t.set(e.key,r)}return[...t.values()].sort((e,t)=>z[e.kind]-z[t.kind]||e.label.localeCompare(t.label))}function U(e){let t=e.plugin?`${R(e.plugin)}:`:``;return t&&e.name.startsWith(t)&&e.name.length>t.length?e.name.slice(t.length):e.name}var W={project:p,user:x,plugin:v,system:v,other:v};function G({groups:e,openId:t,searching:n,runner:r,account:i}){let[a,o]=(0,I.useState)(new Set),s=e=>o(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,L.jsx)(`div`,{"data-slot":`skills-list`,className:`overflow-hidden rounded-xl border border-border bg-card`,children:e.map(e=>{let o=n||!a.has(e.key);return(0,L.jsxs)(`section`,{"data-slot":`skill-group`,"aria-label":e.label,className:`border-border not-first:border-t`,children:[(0,L.jsx)(K,{group:e,open:o,onToggle:()=>s(e.key)}),o?e.skills.map(e=>(0,L.jsx)(q,{skill:e,open:e.id===t,runner:r,account:i},w(e))):null]},e.key)})})}function K({group:e,open:t,onToggle:n}){let i=W[e.kind];return(0,L.jsx)(`h2`,{className:`m-0`,children:(0,L.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:n,className:`flex min-h-10 w-full items-center gap-2 bg-muted/45 px-3.5 text-left text-xs font-semibold text-muted-foreground focus-visible:outline-2 focus-visible:-outline-offset-2 pointer-hover:text-foreground`,children:[(0,L.jsx)(_,{"aria-hidden":`true`,className:r(`size-3.5 transition-transform motion-reduce:transition-none`,t&&`rotate-90`)}),(0,L.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label}),(0,L.jsx)(`span`,{className:`font-medium text-soft-foreground`,children:e.skills.length})]})})}function q({skill:e,open:t,runner:n,account:r}){let i=N({skill:e.id,skillPath:e.path,runner:n,...r?{account:r}:{}});return(0,L.jsxs)(`details`,{"data-slot":`skill-row`,"data-skill":e.id,"data-skill-path":e.path,name:`skill-details`,open:t||void 0,className:`group/skill border-t border-border/60 open:bg-sidebar-row-selected`,children:[(0,L.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center gap-3 py-2 pr-3.5 pl-9 focus-visible:outline-2 focus-visible:-outline-offset-2 pointer-hover:bg-sidebar-row-hover [&::-webkit-details-marker]:hidden`,children:[(0,L.jsxs)(`span`,{className:`grid min-w-0 flex-1 grid-cols-1 items-center gap-x-4 gap-y-0.5 sm:grid-cols-[minmax(10rem,15rem)_minmax(0,1fr)]`,children:[(0,L.jsx)(`span`,{className:`truncate text-[13.5px] leading-snug font-semibold text-foreground`,title:e.name,children:U(e)}),e.description?(0,L.jsx)(`span`,{className:`min-w-0 line-clamp-2 text-[13px] leading-snug text-muted-foreground [overflow-wrap:anywhere] group-open/skill:hidden`,title:e.description,children:e.description}):null]}),(0,L.jsx)(b,{"data-slot":`skill-row-cue`,"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground transition-transform group-open/skill:rotate-180 motion-reduce:transition-none`})]}),(0,L.jsx)(`div`,{className:`pr-3.5 pb-4 pl-9`,children:(0,L.jsx)(M,{skill:e,heading:null,actions:(0,L.jsx)(S,{asChild:!0,size:`sm`,"data-action":`start-task`,children:(0,L.jsx)(C,{to:i,children:`Start task`})})})})]})}function J(){let e=o(),[t,n]=(0,I.useState)(null),[a,c]=(0,I.useState)(null),[l,u]=(0,I.useState)(``),[d]=f(),p=t??e.data?.defaultRunner,{runner:g}=s(p??`claude`),_=a?.runner===g?a.id:null,v=e=>c(e===null?null:{runner:g,id:e}),y=i(p,_),b=$(g,y.account),x=y.data??[],w=T(x,l);return(0,L.jsxs)(D,{route:`skills`,density:y.isPending?`full`:O(w.length),className:`max-md:[padding-block-end:5rem]`,bodyClassName:`gap-5`,header:{title:`Skills`,subtitle:`The skills each agent loads in this project, as its runner reports them.`,secondaryActions:(0,L.jsxs)(E,{variant:`outline`,onClick:()=>void b.run(),disabled:b.running||y.isPending,"data-slot":`skills-refresh`,children:[(0,L.jsx)(h,{"aria-hidden":`true`,className:r(`size-3.5`,b.running&&`motion-safe:animate-spin`)}),`Re-read`]})},sparseFooter:!y.isPending&&w.length>0?(0,L.jsx)(k,{summary:`${w.length} ${w.length===1?`skill`:`skills`} available for this runner. Type / in New task to invoke one, or chain them into a workflow.`,actions:(0,L.jsx)(S,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,L.jsx)(C,{to:`/workflows`,children:`Open workflows`})})}):void 0,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(X,{runner:g,onChange:e=>{n(e),v(null)}}),(0,L.jsx)(Z,{runner:g,account:_,onChange:v}),(0,L.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,"data-slot":`skills-count`,children:y.list?`${x.length} ${x.length===1?`skill`:`skills`}${y.list.source===`cache`?` · from cache`:``}`:null})]}),(0,L.jsxs)(`div`,{className:`relative`,children:[(0,L.jsx)(m,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),(0,L.jsx)(P,{"aria-label":`Search skills`,placeholder:`Filter by name or description…`,value:l,onChange:e=>u(e.target.value),className:`h-10 rounded-lg border-border bg-card pl-9 text-[13px]`})]}),(0,L.jsx)(Q,{query:y}),y.isPending?(0,L.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:`Loading skills…`}):(0,L.jsx)(Y,{skills:x,matches:w,search:l,onClearSearch:()=>u(``),onRefresh:()=>void b.run(),openId:d.get(`skill`),runner:g,account:y.account??null,unchecked:y.unchecked})]})}function Y({skills:e,matches:t,search:n,onClearSearch:r,onRefresh:i,openId:a,runner:o,account:s,unchecked:c}){return e.length===0?c?null:(0,L.jsx)(A,{icon:(0,L.jsx)(y,{}),title:`No skills reported by this runner and account.`,description:`Add a skill to this repository or your runner home, then re-read to refresh the inventory.`,actions:(0,L.jsx)(S,{variant:`outline`,className:`max-md:min-h-11`,onClick:i,children:`Re-read skills`})}):t.length===0?(0,L.jsx)(A,{icon:(0,L.jsx)(m,{}),title:`No skills match “${n.trim()}”.`,description:`Try a different keyword or clear the filter to browse every available skill.`,actions:(0,L.jsx)(S,{variant:`outline`,className:`max-md:min-h-11`,onClick:r,children:`Clear filter`})}):(0,L.jsx)(G,{groups:H(t),openId:a,searching:n.trim()!==``,runner:o,account:s})}function X({runner:e,onChange:t}){let n=c().data;return n?(0,L.jsx)(`div`,{role:`group`,"aria-label":`Runner`,className:`flex max-w-full gap-1 overflow-x-auto rounded-lg border border-border bg-muted/60 p-1`,children:n.runners.map(n=>(0,L.jsx)(`button`,{type:`button`,"aria-pressed":n.id===e,onClick:()=>t(n.id),className:`h-8 shrink-0 rounded-md border border-transparent px-3 text-[13px] font-normal text-muted-foreground transition-colors focus-visible:outline-2 aria-pressed:border-border aria-pressed:bg-card aria-pressed:font-semibold aria-pressed:text-foreground aria-pressed:shadow-xs pointer-hover:text-foreground max-md:h-11`,children:n.displayName},n.id))}):null}function Z({runner:e,account:t,onChange:n}){let r=j().accounts.filter(t=>t.provider===e);return r.length===0?null:(0,L.jsx)(F,{"aria-label":`Account`,value:t??``,onValueChange:e=>n(e||null),options:[{value:``,label:`Account: project default`},...r.map(e=>({value:e.id,label:e.label}))],className:`rounded-lg border-border bg-card text-[13px] text-foreground md:data-[size=default]:h-[38px]`})}function Q({query:e}){let t=e.list?.problems??[];return!e.unchecked&&t.length===0?null:(0,L.jsxs)(`div`,{className:`grid gap-1.5 rounded-lg border border-pending/40 bg-pending/10 px-3.5 py-2.5 text-[13px]`,children:[e.unchecked&&!e.isPending?(0,L.jsxs)(`p`,{role:`status`,className:`flex gap-2`,children:[(0,L.jsx)(g,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-pending-strong`}),(0,L.jsxs)(`span`,{children:[`Skill list unavailable. `,e.list?.reason??e.error?.message,` You can still type a skill id when starting a task.`]})]}):null,t.map((e,t)=>(0,L.jsxs)(`p`,{role:`alert`,className:`flex gap-2 break-words`,children:[(0,L.jsx)(g,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-pending-strong`}),(0,L.jsxs)(`span`,{children:[e.message,e.path?` · ${e.path}`:``]})]},t))]})}function $(e,t){let n=l(),[r,i]=(0,I.useState)(!1),o=a.runnerSkills(e,t);return{running:r,run:async()=>{i(!0);try{n.setQueryData(o,await d(e,t,{refresh:!0})),await n.invalidateQueries({queryKey:o.slice(0,3)})}catch(e){u(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{i(!1)}}}}export{J as SkillsRoute};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{C as i,Wt as a,X as o,Y as s,dn as c,yt as l}from"./queries-CIeJg62Y.js";import{Bt as u,Fn as d,Ft as f,Ht as p,Lt as m,Tt as h,at as g,ct as ee,hi as _,n as v,tr as y}from"./toaster-D0HMoto5.js";import{h as b}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{M as x,u as S,w as C}from"./design-icons-QbNMZniQ.js";import{t as w}from"./run-header-BO93V6-R.js";import{i as T,n as E,r as te}from"./git-toolbar-C3mKb8Eo.js";import{t as D}from"./button-C8jUIs8Q.js";import{a as O,i as k,o as A,r as j,s as M,t as N}from"./dialog-DRZuXvul.js";import{b as P,f as F}from"./task-groups-C9pTQm-2.js";import{f as I,l as L,m as R}from"./page-shell-Dky5crRl.js";import{t as z}from"./centered-state-BgSV4e79.js";import{C as B,Q as V,S as H,ln as U,zn as W}from"./index-zhwJL4R4.js";import{t as G}from"./markdown-BBDDg-4t.js";import{t as K}from"./textarea-vEsJAUAV.js";import{t as q}from"./diff-1Cn1zY0x.js";var J=e(t(),1),Y=`no worktree — this task ran directly in the repo working tree`;function X(e){let t=e=>({id:`commit`,label:`Commit`,enabled:!1,reason:e});return e.hasWorktree?e.run.status===`running`?t(`Commit unavailable — the agent is still working in this worktree`):e.changedFiles===void 0?t(`Commit unavailable — changes are still loading`):e.changedFiles===0?t(`Commit unavailable — no changes to commit`):{id:`commit`,label:`Commit`,enabled:!0}:t(`Commit unavailable — ${Y}`)}function Z(e){let t=e=>({id:`push`,label:`Push`,enabled:!1,reason:e});return e.hasWorktree?e.remote===void 0?t(`Push unavailable — no remote configured`):e.branch===void 0?t(`Push unavailable — the run has no branch to push`):e.run.status===`running`?t(`Push unavailable — the agent is still working in this worktree`):{id:`push`,label:`Push`,enabled:!0}:t(`Push unavailable — ${Y}`)}function ne(e){let t=e=>({id:`create-pr`,label:`Draft PR`,enabled:!1,reason:e});return!e.hasWorktree||e.branch===void 0?t(`Draft PR unavailable — ${Y}`):e.forge===null?t(`Draft PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?y(e.run)?t(`Draft PR unavailable — the run is waiting on a usage-limit hold; choose Don’t resume first`):P(e.run)?t(`Draft PR unavailable — the run is still active; wait for the review gate`):{id:`create-pr`,label:`Draft PR`,enabled:!0}:t(`Draft PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function re(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:X(e),n=e.prUrl?[X(e),Z(e)]:[Z(e),ne(e)],r=[];if(e.localHandoff&&e.cliHandoff!==!1){let t=e.hasSession?P(e.run)?{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — the session is still active in the engine`}:{id:`open-terminal`,label:`Open in terminal`,enabled:!0}:{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — no agent session to resume`};r.push(t)}return{primary:t,secondary:n,menu:r}}var Q=n();function $({run:e,open:t,onOpenChange:n}){let r=_(),[i,o]=(0,J.useState)(``),s=F(e),l=(0,J.useRef)(s);l.current=s,(0,J.useEffect)(()=>{t&&o(l.current)},[t]);let u=c({mutationFn:t=>g(e.id,t),onSuccess:t=>{v(`Committed ${W(t.sha)}`),n(!1),r.invalidateQueries({queryKey:a.runs.changes(e.id)}),r.invalidateQueries({queryKey:a.runs.all})},onError:e=>v(e.message,{tone:`danger`})}),d=()=>{let e=i.trim();e.length===0||u.isPending||u.mutate(e)};return(0,Q.jsx)(N,{open:t,onOpenChange:n,children:(0,Q.jsxs)(j,{"data-slot":`commit-dialog`,children:[(0,Q.jsxs)(A,{children:[(0,Q.jsx)(M,{children:`Commit changes`}),(0,Q.jsxs)(k,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,Q.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,`.`]})]}),(0,Q.jsx)(K,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:i,onChange:e=>o(e.target.value),onKeyDown:e=>{V({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(),d())}}),(0,Q.jsxs)(O,{children:[(0,Q.jsx)(D,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,Q.jsx)(D,{"data-slot":`commit-confirm`,disabled:i.trim().length===0||u.isPending,onClick:d,children:u.isPending?`Committing…`:`Commit`})]})]})})}function ie(){let{id:e}=b(),t=s(e);return t.isPending?(0,Q.jsx)(B,{tab:`changes`}):t.isError?(0,Q.jsx)(H,{tab:`changes`,error:t.error}):(0,Q.jsx)(ae,{run:t.data})}function ae({run:e}){let t=l(),n=i(),r=o(e.id,P(e)),s=R(),[p,h]=(0,J.useState)(`unified`),[g,y]=(0,J.useState)(!0),[b,x]=(0,J.useState)(!1),[S,C]=(0,J.useState)(null),[T,D]=(0,J.useState)(!1),O=(0,J.useRef)(null),k=_(),A=()=>k.invalidateQueries({queryKey:a.runs.all}),j=e=>v(e.message,{tone:`danger`}),M=c({mutationFn:()=>u(e.id),onSuccess:e=>v(e.upstreamSet?`Pushed ${e.branch} to ${e.remote} (upstream set)`:`Pushed ${e.branch} to ${e.remote}`),onError:j}),N=c({mutationFn:()=>ee(e.id),onSuccess:e=>{v(`Draft PR created — ${e.url}`),A()},onError:j}),F=c({mutationFn:()=>m(e.id),onError:e=>{if(e instanceof d&&e.command){navigator.clipboard.writeText(e.command).then(()=>v(`No terminal found — command copied to clipboard.`)).catch(()=>v(`Run manually: ${e.command}`));return}j(e)}}),z=c({mutationFn:t=>f(e.id,t),onError:j}),B=r.isError&&r.error instanceof d&&r.error.status===409,V=re({run:e,cliHandoff:e.cliHandoff,hasWorktree:!!e.worktreePath&&!B,branch:e.branch,changedFiles:r.data?.stat.files,remote:n.data?.info?.remote,forge:t.data?.forge??null,localHandoff:t.data?.capabilities.localHandoff??!1,hasSession:U(e)!==void 0,prUrl:e.pullRequestUrl}),H=e=>{switch(e){case`commit`:D(!0);break;case`push`:M.mutate();break;case`create-pr`:N.mutate();break;case`open-terminal`:F.mutate();break;case`view-pr`:break}},W=r.data?.files??[],K=(0,J.useMemo)(()=>te(W),[W]),q=(0,J.useMemo)(()=>W.some(G),[W]),Y=s?p:`unified`;return(0,Q.jsxs)(L,{route:`task-changes`,density:I(W.length),flushPadding:!0,children:[(0,Q.jsx)(w,{run:e,tab:`changes`}),(0,Q.jsx)(E,{bar:V,healthReady:t.data!==void 0,branch:e.branch,stat:r.data?.stat,mode:Y,wrap:g,preview:b,onModeChange:h,onWrapChange:y,onPreviewChange:q?x:void 0,onAction:H}),r.data?.repointedHead?(0,Q.jsxs)(`p`,{"data-slot":`repointed-head-note`,className:`border-b px-4 py-2 text-xs text-soft-foreground md:px-9`,children:[`HEAD is on `,(0,Q.jsx)(`code`,{children:r.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,Q.jsx)(`code`,{children:r.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,(0,Q.jsx)(oe,{changes:r,changesRefused:B,fileCount:W.length,children:(0,Q.jsx)(se,{runId:e.id,files:W,tree:K,selected:S,selectFile:e=>{C(e),O.current?.scrollToPath(e)},diffRef:O,effectiveMode:Y,effectiveWrap:g,preview:b,localHandoff:t.data?.capabilities.localHandoff,onOpenInApp:z.mutate})}),(0,Q.jsx)($,{run:e,open:T,onOpenChange:D})]})}function oe({changes:e,changesRefused:t,fileCount:n,children:r}){return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):e.isError?(0,Q.jsx)(z,{icon:t?(0,Q.jsx)(C,{size:16}):(0,Q.jsx)(x,{size:16}),tone:t?`neutral`:`danger`,heading:`h2`,title:t?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):n===0?(0,Q.jsx)(z,{icon:(0,Q.jsx)(C,{size:16}),tone:`neutral`,heading:`h2`,title:`No changes yet`,subtitle:`The worktree matches its base branch. Changes appear here as the agent works.`}):r}function se({runId:e,files:t,tree:n,selected:i,selectFile:a,diffRef:o,effectiveMode:s,effectiveWrap:c,preview:l,localHandoff:u,onOpenInApp:d}){let[f,m]=(0,J.useState)(!1);return(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-4 px-4 pb-9 pt-0 [--diff-sticky-top:0px] md:flex-row md:items-start md:gap-5 md:px-9`,children:[(0,Q.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`w-full shrink-0 rounded-xl border border-border bg-card md:sticky md:top-4 md:max-h-[calc(100dvh_-_64px_-_2rem)] md:w-60 md:overflow-y-auto md:overscroll-contain md:p-3.5 lg:w-[288px]`,children:[(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`changes-tree-toggle`,"aria-expanded":f,onClick:()=>m(e=>!e),className:`flex min-h-11 w-full items-center justify-between gap-2 px-3.5 py-2 text-left text-xs font-semibold text-foreground md:hidden`,children:[(0,Q.jsxs)(`span`,{children:[`Changed files`,` `,(0,Q.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`(`,t.length,`)`]})]}),(0,Q.jsx)(S,{size:16,"aria-hidden":`true`,className:r(`size-4 shrink-0 text-muted-foreground motion-safe:transition-transform`,f&&`rotate-180`)})]}),(0,Q.jsx)(`h2`,{className:`mb-3 hidden border-b border-border pb-3 text-xs font-semibold md:block`,children:`Changed files`}),(0,Q.jsx)(`div`,{className:r(f?`border-t border-border px-3.5 py-3 md:border-t-0 md:p-0`:`hidden md:block`),children:(0,Q.jsx)(T,{root:n,selected:i,onSelect:e=>{a(e),m(!1)}})})]}),(0,Q.jsx)(q,{files:t,viewRef:o,mode:s,wrap:c,preview:l,loadFileText:t=>ce(e,t),imageSrc:t=>p(e,t),onOpenInApp:u?e=>d(e):void 0,totals:!1,className:`min-w-0 flex-1`})]})}async function ce(e,t){try{let n=await h(e,t);return n.type!==`file`||n.binary||n.tooLarge?null:n.content??null}catch{return null}}export{ie as TaskChangesRoute};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Q as r,Wt as i,Y as a,Z as o,fn as s}from"./queries-CIeJg62Y.js";import{Fn as c,St as l}from"./toaster-D0HMoto5.js";import{h as u}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{C as d,M as f,ct as p}from"./design-icons-QbNMZniQ.js";import{t as m}from"./run-header-DyEbB88q.js";import{n as h}from"./diff-controls-DkJTGyU5.js";import{t as g}from"./project-router-BHFXTx5l.js";import{b as _}from"./task-groups-C9pTQm-2.js";import{f as v,l as y,m as b}from"./page-shell-Dky5crRl.js";import{t as x}from"./centered-state-BgSV4e79.js";import{C as S,In as C,Nn as w,S as T,Vt as E}from"./index-MCtGGYNa.js";import{t as D}from"./diff-2NATw62W.js";import{t as O}from"./change-counts-wqSYI3W8.js";import{r as k,t as A}from"./commit-list-Dg-dPG_J.js";var j=e(t(),1),M=n();function N(){let{id:e}=u(),t=a(e);return t.isPending?(0,M.jsx)(S,{tab:`changes`}):t.isError?(0,M.jsx)(T,{tab:`changes`,error:t.error}):(0,M.jsx)(P,{run:t.data})}function P({run:e}){let{sha:t}=u(),n=r(e.id,_(e)),i=n.data?.commits[0]?.sha;return(0,M.jsxs)(y,{route:`task-commits`,density:v(n.data?.commits.length??0),flushPadding:!0,children:[(0,M.jsx)(m,{run:e,tab:`commits`}),t?(0,M.jsx)(I,{runId:e.id,sha:t}):n.isPending?(0,M.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading commits…`}):n.isError?(0,M.jsx)(x,{icon:(0,M.jsx)(f,{size:16}),tone:n.error instanceof c&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof c&&n.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:n.error.message}):n.data.commits.length===0?(0,M.jsx)(x,{icon:(0,M.jsx)(f,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`This task hasn't committed anything on its branch. Autosave commits and any the agent makes appear here.`}):(0,M.jsx)(F,{run:e,commits:n.data.commits,selectedSha:i})]})}function F({run:e,commits:t,selectedSha:n}){let r=o(e.id,n),i=R(e.id,t),a=(0,j.useRef)(null),s=b(),[c,l]=(0,j.useState)(`unified`),[u,d]=(0,j.useState)(!0),m=s?c:`unified`;return(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5 px-4 py-5 md:px-9 lg:flex-row lg:items-start`,children:[(0,M.jsxs)(`div`,{className:`w-full shrink-0 lg:w-[380px] xl:w-[420px]`,children:[(0,M.jsx)(A,{slot:`task-commits`,selectedSha:n,heading:(0,M.jsxs)(`h2`,{className:`text-sm font-semibold text-foreground`,children:[t.length,` `,t.length===1?`commit`:`commits`,` in this task`]}),className:`w-full`,commits:t.map(t=>({...t,href:`/tasks/${e.id}/commits/${t.sha}`,stat:i.get(t.sha)}))}),n&&r.data&&r.data.files.length>0?(0,M.jsx)(z,{runId:e.id,sha:n,files:r.data.files,onPick:e=>a.current?.scrollToPath(e)}):null]}),n?(0,M.jsx)(`section`,{"data-slot":`task-commit-preview`,"data-sha":n,className:`min-w-0 flex-1 overflow-hidden rounded-xl border border-border bg-card`,children:r.isPending?(0,M.jsx)(`p`,{className:`px-4 py-8 text-center text-xs text-muted-foreground`,children:`Loading commit diff…`}):r.isError?(0,M.jsx)(x,{icon:(0,M.jsx)(p,{size:16}),tone:`danger`,heading:`h2`,title:`Could not load commit diff`,subtitle:r.error.message}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2 border-b border-border px-4 py-3`,children:[(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`h3`,{className:`break-words text-sm leading-snug font-semibold text-foreground`,children:r.data.subject}),(0,M.jsxs)(`p`,{className:`mt-0.5 flex flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[(0,M.jsx)(`span`,{children:r.data.author}),(0,M.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,M.jsx)(`span`,{title:r.data.when,children:E(r.data.when)}),(0,M.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,M.jsx)(C,{sha:r.data.sha??n,variant:`inline`}),r.data.stat?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,M.jsx)(w,{stat:r.data.stat})]}):null]})]}),(0,M.jsx)(`span`,{className:`flex shrink-0 items-center gap-1.5`,children:(0,M.jsx)(h,{mode:c,wrap:u,onModeChange:l,onWrapChange:d})})]}),!r.data.files||r.data.files.length===0?(0,M.jsx)(x,{icon:(0,M.jsx)(f,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,M.jsx)(`div`,{className:`p-4 [--diff-sticky-top:0px]`,children:(0,M.jsx)(D,{viewRef:a,files:r.data.files,mode:m,wrap:u,totals:!1,className:`min-w-0`})})]})}):null]})}function I({runId:e,sha:t}){return(0,M.jsx)(k,{commit:o(e,t),sha:t,backTo:`/tasks/${e}/commits`,backLabel:`All commits`,slot:`task-commit`,className:`mx-auto flex min-h-0 w-full max-w-[var(--measure)] flex-1 flex-col`,diffClassName:`px-4 py-4 [--diff-sticky-top:0px] md:px-9`})}var L=12;function R(e,t){let n=t.length<=L,r=s({queries:t.map(t=>({queryKey:i.runs.commit(e,t.sha),queryFn:({signal:n})=>l(e,t.sha,{signal:n}),enabled:n,retry:!1}))}),a=new Map;return r.forEach((e,n)=>{let r=t[n]?.sha;r&&e.data?.stat&&a.set(r,e.data.stat)}),a}function z({runId:e,sha:t,files:n,onPick:r}){return(0,M.jsxs)(`section`,{"data-slot":`task-commit-files`,className:`mt-4 rounded-xl border border-border bg-card p-4`,children:[(0,M.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1`,children:[(0,M.jsxs)(`h2`,{className:`text-sm font-semibold text-foreground`,children:[n.length,` `,n.length===1?`file`:`files`,` in`,` `,(0,M.jsx)(C,{sha:t,variant:`inline`,className:`text-[13px] font-medium`})]}),(0,M.jsx)(g,{to:`/tasks/${e}/changes`,className:`text-xs text-muted-foreground hover:text-foreground`,children:`All task changes ›`})]}),(0,M.jsx)(`ul`,{className:`space-y-1`,children:n.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{type:`button`,"data-slot":`task-commit-file`,title:e.oldPath?`${e.oldPath} → ${e.path}`:e.path,onClick:()=>r(e.path),className:`flex min-h-11 w-full items-center gap-2 rounded-md px-2 text-left text-xs text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,M.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-[15px] shrink-0`}),(0,M.jsx)(`span`,{className:`min-w-0 flex-1 break-all`,children:e.path}),(0,M.jsx)(O,{adds:e.adds,dels:e.dels,className:`font-mono text-xs`})]})},e.path))})]})}export{N as TaskCommitsRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Q as r,Wt as i,Y as a,Z as o,fn as s}from"./queries-CIeJg62Y.js";import{Fn as c,St as l}from"./toaster-D0HMoto5.js";import{h as u}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{C as d,M as f,ct as p}from"./design-icons-QbNMZniQ.js";import{t as m}from"./run-header-BO93V6-R.js";import{n as h}from"./diff-controls-BXaMnA8A.js";import{t as g}from"./project-router-BHFXTx5l.js";import{b as _}from"./task-groups-C9pTQm-2.js";import{f as v,l as y,m as b}from"./page-shell-Dky5crRl.js";import{t as x}from"./centered-state-BgSV4e79.js";import{C as S,Fn as C,Rn as w,S as T,Ut as E}from"./index-zhwJL4R4.js";import{t as D}from"./diff-1Cn1zY0x.js";import{t as O}from"./change-counts-wqSYI3W8.js";import{r as k,t as A}from"./commit-list-DMTOciIo.js";var j=e(t(),1),M=n();function N(){let{id:e}=u(),t=a(e);return t.isPending?(0,M.jsx)(S,{tab:`changes`}):t.isError?(0,M.jsx)(T,{tab:`changes`,error:t.error}):(0,M.jsx)(P,{run:t.data})}function P({run:e}){let{sha:t}=u(),n=r(e.id,_(e)),i=n.data?.commits[0]?.sha;return(0,M.jsxs)(y,{route:`task-commits`,density:v(n.data?.commits.length??0),flushPadding:!0,children:[(0,M.jsx)(m,{run:e,tab:`commits`}),t?(0,M.jsx)(I,{runId:e.id,sha:t}):n.isPending?(0,M.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading commits…`}):n.isError?(0,M.jsx)(x,{icon:(0,M.jsx)(f,{size:16}),tone:n.error instanceof c&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof c&&n.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:n.error.message}):n.data.commits.length===0?(0,M.jsx)(x,{icon:(0,M.jsx)(f,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`This task hasn't committed anything on its branch. Autosave commits and any the agent makes appear here.`}):(0,M.jsx)(F,{run:e,commits:n.data.commits,selectedSha:i})]})}function F({run:e,commits:t,selectedSha:n}){let r=o(e.id,n),i=R(e.id,t),a=(0,j.useRef)(null),s=b(),[c,l]=(0,j.useState)(`unified`),[u,d]=(0,j.useState)(!0),m=s?c:`unified`;return(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5 px-4 py-5 md:px-9 lg:flex-row lg:items-start`,children:[(0,M.jsxs)(`div`,{className:`w-full shrink-0 lg:w-[380px] xl:w-[420px]`,children:[(0,M.jsx)(A,{slot:`task-commits`,selectedSha:n,heading:(0,M.jsxs)(`h2`,{className:`text-sm font-semibold text-foreground`,children:[t.length,` `,t.length===1?`commit`:`commits`,` in this task`]}),className:`w-full`,commits:t.map(t=>({...t,href:`/tasks/${e.id}/commits/${t.sha}`,stat:i.get(t.sha)}))}),n&&r.data&&r.data.files.length>0?(0,M.jsx)(z,{runId:e.id,sha:n,files:r.data.files,onPick:e=>a.current?.scrollToPath(e)}):null]}),n?(0,M.jsx)(`section`,{"data-slot":`task-commit-preview`,"data-sha":n,className:`min-w-0 flex-1 overflow-hidden rounded-xl border border-border bg-card`,children:r.isPending?(0,M.jsx)(`p`,{className:`px-4 py-8 text-center text-xs text-muted-foreground`,children:`Loading commit diff…`}):r.isError?(0,M.jsx)(x,{icon:(0,M.jsx)(p,{size:16}),tone:`danger`,heading:`h2`,title:`Could not load commit diff`,subtitle:r.error.message}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2 border-b border-border px-4 py-3`,children:[(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`h3`,{className:`break-words text-sm leading-snug font-semibold text-foreground`,children:r.data.subject}),(0,M.jsxs)(`p`,{className:`mt-0.5 flex flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[(0,M.jsx)(`span`,{children:r.data.author}),(0,M.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,M.jsx)(`span`,{title:r.data.when,children:E(r.data.when)}),(0,M.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,M.jsx)(w,{sha:r.data.sha??n,variant:`inline`}),r.data.stat?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,M.jsx)(C,{stat:r.data.stat})]}):null]})]}),(0,M.jsx)(`span`,{className:`flex shrink-0 items-center gap-1.5`,children:(0,M.jsx)(h,{mode:c,wrap:u,onModeChange:l,onWrapChange:d})})]}),!r.data.files||r.data.files.length===0?(0,M.jsx)(x,{icon:(0,M.jsx)(f,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,M.jsx)(`div`,{className:`p-4 [--diff-sticky-top:0px]`,children:(0,M.jsx)(D,{viewRef:a,files:r.data.files,mode:m,wrap:u,totals:!1,className:`min-w-0`})})]})}):null]})}function I({runId:e,sha:t}){return(0,M.jsx)(k,{commit:o(e,t),sha:t,backTo:`/tasks/${e}/commits`,backLabel:`All commits`,slot:`task-commit`,className:`mx-auto flex min-h-0 w-full max-w-[var(--measure)] flex-1 flex-col`,diffClassName:`px-4 py-4 [--diff-sticky-top:0px] md:px-9`})}var L=12;function R(e,t){let n=t.length<=L,r=s({queries:t.map(t=>({queryKey:i.runs.commit(e,t.sha),queryFn:({signal:n})=>l(e,t.sha,{signal:n}),enabled:n,retry:!1}))}),a=new Map;return r.forEach((e,n)=>{let r=t[n]?.sha;r&&e.data?.stat&&a.set(r,e.data.stat)}),a}function z({runId:e,sha:t,files:n,onPick:r}){return(0,M.jsxs)(`section`,{"data-slot":`task-commit-files`,className:`mt-4 rounded-xl border border-border bg-card p-4`,children:[(0,M.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1`,children:[(0,M.jsxs)(`h2`,{className:`text-sm font-semibold text-foreground`,children:[n.length,` `,n.length===1?`file`:`files`,` in`,` `,(0,M.jsx)(w,{sha:t,variant:`inline`,className:`text-[13px] font-medium`})]}),(0,M.jsx)(g,{to:`/tasks/${e}/changes`,className:`text-xs text-muted-foreground hover:text-foreground`,children:`All task changes ›`})]}),(0,M.jsx)(`ul`,{className:`space-y-1`,children:n.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{type:`button`,"data-slot":`task-commit-file`,title:e.oldPath?`${e.oldPath} → ${e.path}`:e.path,onClick:()=>r(e.path),className:`flex min-h-11 w-full items-center gap-2 rounded-md px-2 text-left text-xs text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,M.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-[15px] shrink-0`}),(0,M.jsx)(`span`,{className:`min-w-0 flex-1 break-all`,children:e.path}),(0,M.jsx)(O,{adds:e.adds,dels:e.dels,className:`font-mono text-xs`})]})},e.path))})]})}export{N as TaskCommitsRoute};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{d as r,h as i}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as a}from"./markdown-Vws-ZDQC.js";var o=e(t(),1),s=n();function c({runId:e,children:t}){let n=r(),i=(0,o.useMemo)(()=>({runId:e}),[e]);return n?(0,s.jsx)(l,{runId:e,children:t}):(0,s.jsx)(a.Provider,{value:i,children:t})}function l({runId:e,children:t}){let{projectId:n}=i(),r=(0,o.useMemo)(()=>({runId:e,...n?{projectId:n}:{}}),[e,n]);return(0,s.jsx)(a.Provider,{value:r,children:t})}export{c as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{d as r,h as i}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as a}from"./markdown-C1Qn_3d6.js";var o=e(t(),1),s=n();function c({runId:e,children:t}){let n=r(),i=(0,o.useMemo)(()=>({runId:e}),[e]);return n?(0,s.jsx)(l,{runId:e,children:t}):(0,s.jsx)(a.Provider,{value:i,children:t})}function l({runId:e,children:t}){let{projectId:n}=i(),r=(0,o.useMemo)(()=>({runId:e,...n?{projectId:n}:{}}),[e,n]);return(0,s.jsx)(a.Provider,{value:r,children:t})}export{c as t};