cezarion 0.19.0-dev.8776 → 0.19.0-dev.8780

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 (51) hide show
  1. package/package.json +3 -3
  2. package/web/dist/assets/{accounts-section-DyE8nZhG.js → accounts-section-DCrnOzct.js} +1 -1
  3. package/web/dist/assets/{activity-motion-BbCsI0zQ.js → activity-motion-B0Z3t5nA.js} +1 -1
  4. package/web/dist/assets/{activity-route-BBHWMCvF.js → activity-route-ArgzdAf9.js} +1 -1
  5. package/web/dist/assets/{agent-config-section-7k8wATxQ.js → agent-config-section-iYfy4gke.js} +1 -1
  6. package/web/dist/assets/{agent-defaults-section-DwjS2zpP.js → agent-defaults-section-DGHS6Q38.js} +1 -1
  7. package/web/dist/assets/{appearance-Cz_Xisdp.js → appearance-DFnuUMY5.js} +1 -1
  8. package/web/dist/assets/{automations-route-331MoIW6.js → automations-route-CNjy-2lp.js} +1 -1
  9. package/web/dist/assets/{commit-list-Ogvgv0V9.js → commit-list-BmsyGw2n.js} +1 -1
  10. package/web/dist/assets/{diff-ZGlCIC2o.js → diff-CnLNYz2W.js} +2 -2
  11. package/web/dist/assets/{diff-controls-CY3bqJPO.js → diff-controls-C_p185Fn.js} +1 -1
  12. package/web/dist/assets/{diff-view-9-FcV8NQ.js → diff-view-D1goMhTw.js} +1 -1
  13. package/web/dist/assets/{file-preview-CBme1fo_.js → file-preview-XKouJ-Is.js} +1 -1
  14. package/web/dist/assets/{git-toolbar-p0Gt04pZ.js → git-toolbar-WY8SwcX9.js} +1 -1
  15. package/web/dist/assets/{github-ohX3f9y8.js → github-CFT6xwCN.js} +1 -1
  16. package/web/dist/assets/{global-activity-route-Do0nIcLb.js → global-activity-route-CJXBM3Tw.js} +1 -1
  17. package/web/dist/assets/index-BhB5uLZf.js +21 -0
  18. package/web/dist/assets/index-DFE-_e4t.css +1 -0
  19. package/web/dist/assets/{markdown-BZgLow5j.js → markdown-DBT-WT_u.js} +1 -1
  20. package/web/dist/assets/{notifications-section-UWrIuuqK.js → notifications-section-DNX9bbaP.js} +1 -1
  21. package/web/dist/assets/{preview-pane-connected-D-NHVwVK.js → preview-pane-connected-9-f9BQdW.js} +1 -1
  22. package/web/dist/assets/{projects-section-ZvcZ3_Gf.js → projects-section-BNzu8IpH.js} +1 -1
  23. package/web/dist/assets/{prompt-templates-section-C41o3_cn.js → prompt-templates-section-Dx5-qcFM.js} +1 -1
  24. package/web/dist/assets/{remote-settings-notice-BsKK4zWt.js → remote-settings-notice-Br28V7x_.js} +1 -1
  25. package/web/dist/assets/{repo-git-CaKYihkq.js → repo-git-DFouc9De.js} +1 -1
  26. package/web/dist/assets/{report-reader-MQRVVGOV.js → report-reader-DdELAmi8.js} +1 -1
  27. package/web/dist/assets/{reports-BkkJOinX.js → reports-ClQR3qHs.js} +1 -1
  28. package/web/dist/assets/{resources-section-D4cLySUg.js → resources-section-kZct7PFl.js} +1 -1
  29. package/web/dist/assets/{review-panel-DwoLnSOz.js → review-panel-Bh26jn0o.js} +1 -1
  30. package/web/dist/assets/{run-header-DXt2EtCb.js → run-header-D85oMtBY.js} +1 -1
  31. package/web/dist/assets/{select-DsxHxI9X.js → select-Nk0ajm24.js} +1 -1
  32. package/web/dist/assets/{session-context-section-Dq7kwhFC.js → session-context-section-BYCPnD3r.js} +1 -1
  33. package/web/dist/assets/{settings-agent-picker--LZQKc3H.js → settings-agent-picker-BF9IyaFy.js} +1 -1
  34. package/web/dist/assets/{settings-shell-BLI4CANd.js → settings-shell-DzPrWEVy.js} +1 -1
  35. package/web/dist/assets/{sidebar-section-BZKlFvG9.js → sidebar-section-YVFQ5UiX.js} +1 -1
  36. package/web/dist/assets/{skills-Dvzt9DdF.js → skills-dpjWFHUH.js} +1 -1
  37. package/web/dist/assets/{switch-SP8pw5uU.js → switch-DKqVf8-p.js} +1 -1
  38. package/web/dist/assets/{task-changes-Bj8vcfpY.js → task-changes-DlSANSgv.js} +1 -1
  39. package/web/dist/assets/{task-commits-D2sgt47s.js → task-commits-CK4Wzu7z.js} +1 -1
  40. package/web/dist/assets/{task-file-scope-BEi9o8Ur.js → task-file-scope-DM9imAKF.js} +1 -1
  41. package/web/dist/assets/{task-files-CSGqLTZ9.js → task-files-BOMZRLv2.js} +1 -1
  42. package/web/dist/assets/{task-github-item-DyMsNAdL.js → task-github-item-TF92x7E2.js} +1 -1
  43. package/web/dist/assets/{task-thread-D7iB5aiK.js → task-thread-EIeHbWxs.js} +1 -1
  44. package/web/dist/assets/{thread-state-D8MmuQvJ.js → thread-state-DNC75EjO.js} +1 -1
  45. package/web/dist/assets/{use-hand-to-agent-state-BFCOOUq3.js → use-hand-to-agent-state-D4YKAgJF.js} +1 -1
  46. package/web/dist/assets/{workflows-V_D7FZYN.js → workflows-CWvMdl2z.js} +1 -1
  47. package/web/dist/assets/{workspace-tools-BwNE3W6C.js → workspace-tools-BapdVS_s.js} +1 -1
  48. package/web/dist/assets/{worktrees-section-DLigjWPB.js → worktrees-section-BIP3TrYs.js} +1 -1
  49. package/web/dist/index.html +3 -3
  50. package/web/dist/assets/index-BSZD2aai.js +0 -21
  51. package/web/dist/assets/index-BwvwfpYW.css +0 -1
@@ -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{c as r,t as i}from"./utils-DSMR_WLb.js";import{N as a,Rt as o,ct as s}from"./queries-EvENG6TN.js";import{Hr as c,In as l,Ln as u,Wr as d,br as f,hi as p,pi as m,ri as h,zn as g}from"./toaster-Cer2NOxt.js";import{B as _,F as v,I as y,J as b,N as x,W as S,Y as C,z as w}from"./live-protocol-DMhTnCmf.js";import{f as T,m as E}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{X as D}from"./design-icons-CzEoMH9c.js";import{t as O}from"./arrow-up-right-DKGzsMqY.js";import{t as k}from"./chevron-right-BENZ-1ZN.js";import{t as A}from"./eye-B8okNWXU.js";import{t as j}from"./button-B7MKxYjT.js";import{t as M}from"./project-router-BypHPat0.js";import{a as ee}from"./format-BU7D3IfE.js";import{d as te,l as ne,n as re,r as N,t as P}from"./page-shell-7pLJMOgh.js";import{t as F}from"./use-search-params-writer-ClMScnNe.js";import{Xn as I,Xt as L,ar as R,pn as z}from"./index-BSZD2aai.js";import{t as B}from"./report-title-D4Mbu2Er.js";import{t as V}from"./html-report-frame-uuqkBC0u.js";var H=e(t(),1),U=1e3,W=S().min(1).max(1024);_({q:S().max(U).optional(),before:W.optional(),limit:S().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()}).strict();var G=_({reports:x(_({id:b(),runId:b(),name:S(),title:S(),createdAt:C(),size:w().int().nonnegative(),taskTitle:S(),taskStatus:f}).strict()),nextCursor:W.nullable(),total:w().int().nonnegative()}).strict(),K=_({epoch:b(),generation:w().int().nonnegative(),metadataGeneration:w().int().nonnegative()}).strict(),q=_({runId:b(),taskTitle:S(),taskStatus:f}).strict(),J=v(`type`,[K.extend({type:y(`snapshot`)}),K.extend({type:y(`content`)}),K.extend({type:y(`metadata`),runs:x(q)})]),Y=new WeakMap;function ie(e,t){if(!e)return{content:t.type===`content`,metadata:t.type===`metadata`,reset:!1};if(e.epoch!==t.epoch)return{content:!0,metadata:!0,reset:!0};if(!(t.generation<e.generation||t.metadataGeneration<e.metadataGeneration)&&!(e.generation===t.generation&&e.metadataGeneration===t.metadataGeneration))return{content:t.generation!==e.generation,metadata:t.metadataGeneration!==e.metadataGeneration,reset:!1}}var ae=class{client;project;state;content=0;metadata=0;patches=new Map;trailing=new Set;flights=new Map;constructor(e,t){this.client=e,this.project=t,e.getQueryCache().subscribe(n=>{if(n.type===`removed`){this.trailing.delete(n.query),this.flights.delete(n.query);return}if(!(n.query.queryKey[0]!==t||n.query.queryKey[1]!==`reports`)){if(n.type===`updated`&&n.action.type===`fetch`&&this.flights.set(n.query,this.metadata),n.query.state.fetchStatus===`idle`&&this.flights.has(n.query)){let e=this.flights.get(n.query);this.flights.delete(n.query),e!==this.metadata&&String(n.query.queryKey[2]??``).trim()===``&&this.client.setQueryData(n.query.queryKey,t=>t&&{...t,pages:t.pages.map(t=>this.patch(t,e))})}!this.trailing.has(n.query)||n.query.state.fetchStatus!==`idle`||(this.trailing.delete(n.query),queueMicrotask(()=>{e.invalidateQueries({queryKey:n.query.queryKey,exact:!0,refetchType:`active`},{cancelRefetch:!1})}))}})}patch(e,t=-1){return{...e,reports:e.reports.map(e=>{let n=this.patches.get(e.runId);return n&&n.version>t?{...e,taskTitle:n.value.taskTitle,taskStatus:n.value.taskStatus}:e})}}async read(e,t){for(;;){let n=this.content,r=this.metadata,i=await t();if(!(n!==this.content||e.trim()!==``&&r!==this.metadata))return e.trim()===``?this.patch(i,r):i}}receive(e,t=!1){let n=this.state;if(!n&&e.type===`snapshot`){this.state=e,this.content++,this.client.getQueryCache().findAll({queryKey:[this.project,`reports`]}).some(e=>e.state.data!==void 0)&&this.invalidate(!0);return}let r=ie(n,e);if(!r){t&&e.type===`snapshot`&&(this.content++,this.invalidate(!0));return}let{metadata:i,reset:a}=r,o=r.content||t&&e.type===`snapshot`;this.state=e,a&&this.patches.clear(),i&&this.metadata++,o&&this.content++,e.type===`metadata`&&!a&&this.patchCaches(e);let s=o||i&&e.type!==`metadata`;(s||i)&&this.invalidate(s)}patchCaches(e){for(let t of e.runs)this.patches.set(t.runId,{value:t,version:this.metadata});this.client.setQueriesData({queryKey:[this.project,`reports`],predicate:e=>String(e.queryKey[2]??``).trim()===``},e=>e&&{...e,pages:e.pages.map(e=>this.patch(e,this.metadata-1))})}invalidate(e){let t={queryKey:[this.project,`reports`],refetchType:`active`,...e?{}:{predicate:e=>String(e.queryKey[2]??``).trim()!==``}};for(let e of this.client.getQueryCache().findAll(t))e.state.fetchStatus===`fetching`&&this.trailing.add(e);this.client.invalidateQueries(t,{cancelRefetch:!1})}};function oe(e,t){let n=Y.get(e);n||(n=new Map,Y.set(e,n));let r=n.get(t);return r||(r=new ae(e,t),n.set(t,r)),r}async function se(e,t){let n=await l.api.v1.p[`:projectId`].reports.state.$get({param:{projectId:e}},u({signal:t}));return K.parse(await g(n,`/reports/state`))}function ce(e){let t=oe(p(),e);return(0,H.useEffect)(()=>{let n=o(`reports:project:${e}`,e=>{let n=J.safeParse(e);n.success&&t.receive(n.data,n.data.type===`snapshot`)}),r,i,a=()=>{if(c()===`finite`&&!r){i=new AbortController;let n=i.signal;se(e,n).then(e=>{n.aborted||t.receive({type:`snapshot`,...e})}).catch(()=>void 0),r=s({path:`/api/v1/p/${encodeURIComponent(e)}/reports/state`,intervalMs:5e3},(e,n)=>{let r=K.safeParse(e);!n&&r.success&&t.receive({type:`snapshot`,...r.data})})}else c()!==`finite`&&(i?.abort(),r?.(),r=void 0)};a();let l=d(a);return()=>{l(),i?.abort(),r?.(),n()}},[t,e]),t}async function le(e,t,n,r){let i=await l.api.v1.p[`:projectId`].reports.$get({param:{projectId:e},query:{q:t.slice(0,U),...n?{before:n}:{}}},u(r?{signal:r}:void 0));return G.parse(await g(i,`/reports`))}function X(e){let t=r(),n=ce(t);return h({queryKey:[t,`reports`,e],initialPageParam:void 0,queryFn:({pageParam:r,signal:i})=>n.read(e,()=>le(t,e,r,i)),getNextPageParam:e=>e.nextCursor??void 0,staleTime:0,refetchOnWindowFocus:!0})}var Z=n(),Q=new Map;function ue(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(t)}function de(e){let t=L(),[n,r]=(0,H.useState)(!1);return(0,H.useLayoutEffect)(()=>{let n=e.current;if(!n)return;let i=e=>{r(e>0?e>=660:t)};if(i(n.getBoundingClientRect().width),typeof ResizeObserver!=`function`)return;let a=new ResizeObserver(e=>{let t=e[0]?.contentRect.width??n.getBoundingClientRect().width;i(t)});return a.observe(n),()=>a.disconnect()},[e,t]),n}function fe(){let e=T(),t=E(),[n,r]=F(),a=(n.get(`q`)??``).slice(0,U),o=X(a),s=(0,H.useRef)(null),c=(0,H.useRef)(null),l=(0,H.useRef)(``),u=e.pathname+e.search,d=o.data?.pages.flatMap(e=>e.reports)??[],f=e=>{Q.set(u,{scroll:c.current?.scrollTop??0,row:e,pages:o.data?.pages.length??1})},[p,m]=(0,H.useState)(null),h=de(s);(0,H.useLayoutEffect)(()=>{if(!o.data||l.current===u)return;let n=Q.get(u),r=e.state?.filesRestoreKey===u;if(!n||!c.current||t!==`POP`&&!r){l.current=u;return}let i=c.current.querySelector(`[data-report-id="${n.row}"]`);if(o.isFetchNextPageError){l.current=u,c.current.scrollTop=0;return}if((!i||o.data.pages.length<n.pages)&&o.hasNextPage){o.isFetchingNextPage||o.fetchNextPage();return}l.current=u,c.current.scrollTop=i?n.scroll:0,i?.focus({preventScroll:!0})},[u,o.data,o.hasNextPage,o.isFetchingNextPage,o.isFetchNextPageError,o.fetchNextPage,e.state,t]);let g=t=>r(n=>(t?n.set(`q`,t.slice(0,U)):n.delete(`q`),Q.delete(e.pathname+`?`+n.toString()),n)),_=d.find(e=>e.id===p)??d[0]??null,v=o.isPending?`full`:te(d.length);return(0,Z.jsx)(ne,{route:`reports`,density:v,fillHeight:!0,bodyClassName:`gap-4`,header:{title:`Reports`,subtitle:`Published HTML snapshots from tasks in this project.`},children:(0,Z.jsxs)(`div`,{ref:s,"data-slot":`reports-content`,className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`relative w-full shrink-0`,children:[(0,Z.jsx)(D,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),(0,Z.jsx)(I,{maxLength:U,"aria-label":`Search reports`,placeholder:`Search reports or source tasks…`,value:a,onChange:e=>g(e.target.value),className:`h-10 w-full rounded-lg border-border bg-card pl-9 text-sm max-md:h-11`})]}),o.isPending?(0,Z.jsx)(`div`,{ref:c,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsx)(`p`,{role:`status`,className:`py-4 text-sm text-muted-foreground`,children:`Loading reports…`})}):o.isError&&d.length===0?(0,Z.jsx)(`div`,{ref:c,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-3 rounded-xl border border-border bg-card p-5`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Could not load reports`}),(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o.error.message}),(0,Z.jsx)(j,{variant:`outline`,className:`min-h-11`,onClick:()=>void o.refetch(),children:`Retry`})]})}):d.length===0?(0,Z.jsx)(`div`,{ref:c,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsx)(P,{icon:(0,Z.jsx)(R,{}),title:a?`No matching reports`:`No published reports yet`,description:a?`Try a different keyword or clear the search filter.`:(0,Z.jsxs)(Z.Fragment,{children:[`Publish an HTML snapshot with`,` `,(0,Z.jsxs)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:[z(),` artifact publish`]}),` `,`to list it here.`]}),actions:a?(0,Z.jsx)(j,{"data-slot":`reports-clear-search`,variant:`outline`,className:`min-h-11`,onClick:()=>g(``),children:`Clear search`}):(0,Z.jsx)(j,{variant:`outline`,className:`min-h-11`,asChild:!0,children:(0,Z.jsx)(M,{to:`/new`,children:`Start a task`})})})}):(0,Z.jsx)(N,{list:(0,Z.jsxs)(`div`,{ref:c,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1.5`,"aria-label":`Reports`,children:d.map(e=>{let t=_?.id===e.id;return(0,Z.jsxs)(`li`,{"data-slot":`report-row`,"data-selected":h&&t?`true`:void 0,className:i(`reports-row flex items-center gap-3 rounded-xl border border-border bg-card px-4 py-3 transition-colors`,h&&t&&`border-accent-strong/60 bg-sidebar-row-selected/40`),children:[(0,Z.jsx)(R,{"aria-hidden":`true`,className:`reports-icon mt-0.5 size-4 shrink-0 self-start text-accent-text`}),(0,Z.jsxs)(`div`,{className:`reports-lines flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(`h2`,{className:`flex min-w-0 text-[14px] leading-5 font-semibold text-foreground`,title:B(e),children:(0,Z.jsx)(M,{"data-report-id":e.id,className:`reports-open text-foreground no-underline`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:u,filesRestoreKey:u},onClick:()=>f(e.id),children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:B(e)})})}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-xs leading-4 text-muted-foreground`,children:[(0,Z.jsx)(M,{className:`reports-task min-w-0 truncate text-xs text-muted-foreground no-underline hover:text-foreground hover:underline`,to:`/tasks/${e.runId}`,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,title:e.taskTitle,children:e.taskTitle})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`}),(0,Z.jsx)(`time`,{className:`shrink-0 tabular-nums`,dateTime:e.createdAt,title:ue(e.createdAt),children:$(e.createdAt)})]})]}),h?(0,Z.jsx)(`button`,{type:`button`,"data-slot":`report-preview-select`,"aria-label":`Preview ${B(e)}`,"aria-pressed":t,onClick:()=>m(e.id),className:`reports-preview-btn inline-flex min-h-8 min-w-8 shrink-0 items-center justify-center gap-1 rounded-md border border-border bg-background px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:(0,Z.jsx)(A,{"aria-hidden":`true`,className:`size-3.5`})}):(0,Z.jsx)(k,{"aria-hidden":`true`,"data-slot":`report-open-cue`,className:`reports-cue size-4 shrink-0 text-muted-foreground`})]},e.id)})}),o.hasNextPage?(0,Z.jsx)(`div`,{className:`mt-4`,children:(0,Z.jsx)(j,{variant:`outline`,className:`min-h-11`,disabled:o.isFetchingNextPage,onClick:()=>void o.fetchNextPage(),children:`Load more reports`})}):null,v===`sparse`?(0,Z.jsx)(re,{summary:`${d.length} published ${d.length===1?`report`:`reports`}. Select a row to open full screen or preview beside the list.`}):null]}),detail:h&&_?(0,Z.jsx)(pe,{report:_,restoreKey:u,onOpenReader:()=>f(_.id)}):null})]})})}function pe({report:e,restoreKey:t,onOpenReader:n}){let r=(0,H.useContext)(m)!==void 0;return(0,Z.jsxs)(`section`,{"data-slot":`reports-preview-pane`,"aria-label":`Preview of ${B(e)}`,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-border bg-card`,children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2 border-b border-border px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`h2`,{className:`truncate text-sm font-semibold text-foreground`,children:B(e)}),(0,Z.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-muted-foreground`,children:[e.taskTitle,` · `,$(e.createdAt)]})]}),(0,Z.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,className:`h-auto min-h-8 shrink-0 py-1.5`,children:(0,Z.jsxs)(M,{"data-slot":`reports-preview-open`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:t,filesRestoreKey:t},onClick:n,children:[`Open reader`,(0,Z.jsx)(O,{"aria-hidden":`true`,className:`size-3.5`})]})})]}),r?(0,Z.jsx)(me,{report:e}):(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-xs text-muted-foreground`,children:`Open reader to view this HTML report.`})]})}function me({report:e}){let t=a(e.runId,e.id);if(t.isPending)return(0,Z.jsx)(`p`,{role:`status`,className:`p-6 text-xs text-muted-foreground`,children:`Loading preview…`});if(t.isError)return(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 p-6 text-xs text-muted-foreground`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-foreground`,children:`Could not load report preview`}),(0,Z.jsx)(`p`,{children:t.error.message}),(0,Z.jsx)(j,{variant:`outline`,size:`sm`,onClick:()=>void t.refetch(),children:`Retry`})]});let n=t.data;return!n||n.type!==`file`||n.binary||n.content===void 0?(0,Z.jsx)(`p`,{className:`p-6 text-xs text-muted-foreground`,children:`Preview unavailable for this artifact.`}):(0,Z.jsx)(V,{html:n.content,title:B(e),className:`min-h-0 flex-1`})}function $(e){let t=ee(e);return t?t===`just now`?`Published just now`:`Published · ${t}`:``}export{fe as ReportsRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{c as r,t as i}from"./utils-DSMR_WLb.js";import{N as a,Rt as o,ct as s}from"./queries-EvENG6TN.js";import{Hr as c,In as l,Ln as u,Wr as d,br as f,hi as p,pi as m,ri as h,zn as g}from"./toaster-Cer2NOxt.js";import{B as _,F as v,I as y,J as b,N as x,W as S,Y as C,z as w}from"./live-protocol-DMhTnCmf.js";import{f as T,m as E}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{X as D}from"./design-icons-CzEoMH9c.js";import{t as O}from"./arrow-up-right-DKGzsMqY.js";import{t as k}from"./chevron-right-BENZ-1ZN.js";import{t as A}from"./eye-B8okNWXU.js";import{t as j}from"./button-B7MKxYjT.js";import{t as M}from"./project-router-BypHPat0.js";import{a as ee}from"./format-BU7D3IfE.js";import{d as te,l as ne,n as re,r as N,t as P}from"./page-shell-7pLJMOgh.js";import{t as F}from"./use-search-params-writer-ClMScnNe.js";import{Xn as I,Xt as L,ar as R,pn as z}from"./index-BhB5uLZf.js";import{t as B}from"./report-title-D4Mbu2Er.js";import{t as V}from"./html-report-frame-uuqkBC0u.js";var H=e(t(),1),U=1e3,W=S().min(1).max(1024);_({q:S().max(U).optional(),before:W.optional(),limit:S().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()}).strict();var G=_({reports:x(_({id:b(),runId:b(),name:S(),title:S(),createdAt:C(),size:w().int().nonnegative(),taskTitle:S(),taskStatus:f}).strict()),nextCursor:W.nullable(),total:w().int().nonnegative()}).strict(),K=_({epoch:b(),generation:w().int().nonnegative(),metadataGeneration:w().int().nonnegative()}).strict(),q=_({runId:b(),taskTitle:S(),taskStatus:f}).strict(),J=v(`type`,[K.extend({type:y(`snapshot`)}),K.extend({type:y(`content`)}),K.extend({type:y(`metadata`),runs:x(q)})]),Y=new WeakMap;function ie(e,t){if(!e)return{content:t.type===`content`,metadata:t.type===`metadata`,reset:!1};if(e.epoch!==t.epoch)return{content:!0,metadata:!0,reset:!0};if(!(t.generation<e.generation||t.metadataGeneration<e.metadataGeneration)&&!(e.generation===t.generation&&e.metadataGeneration===t.metadataGeneration))return{content:t.generation!==e.generation,metadata:t.metadataGeneration!==e.metadataGeneration,reset:!1}}var ae=class{client;project;state;content=0;metadata=0;patches=new Map;trailing=new Set;flights=new Map;constructor(e,t){this.client=e,this.project=t,e.getQueryCache().subscribe(n=>{if(n.type===`removed`){this.trailing.delete(n.query),this.flights.delete(n.query);return}if(!(n.query.queryKey[0]!==t||n.query.queryKey[1]!==`reports`)){if(n.type===`updated`&&n.action.type===`fetch`&&this.flights.set(n.query,this.metadata),n.query.state.fetchStatus===`idle`&&this.flights.has(n.query)){let e=this.flights.get(n.query);this.flights.delete(n.query),e!==this.metadata&&String(n.query.queryKey[2]??``).trim()===``&&this.client.setQueryData(n.query.queryKey,t=>t&&{...t,pages:t.pages.map(t=>this.patch(t,e))})}!this.trailing.has(n.query)||n.query.state.fetchStatus!==`idle`||(this.trailing.delete(n.query),queueMicrotask(()=>{e.invalidateQueries({queryKey:n.query.queryKey,exact:!0,refetchType:`active`},{cancelRefetch:!1})}))}})}patch(e,t=-1){return{...e,reports:e.reports.map(e=>{let n=this.patches.get(e.runId);return n&&n.version>t?{...e,taskTitle:n.value.taskTitle,taskStatus:n.value.taskStatus}:e})}}async read(e,t){for(;;){let n=this.content,r=this.metadata,i=await t();if(!(n!==this.content||e.trim()!==``&&r!==this.metadata))return e.trim()===``?this.patch(i,r):i}}receive(e,t=!1){let n=this.state;if(!n&&e.type===`snapshot`){this.state=e,this.content++,this.client.getQueryCache().findAll({queryKey:[this.project,`reports`]}).some(e=>e.state.data!==void 0)&&this.invalidate(!0);return}let r=ie(n,e);if(!r){t&&e.type===`snapshot`&&(this.content++,this.invalidate(!0));return}let{metadata:i,reset:a}=r,o=r.content||t&&e.type===`snapshot`;this.state=e,a&&this.patches.clear(),i&&this.metadata++,o&&this.content++,e.type===`metadata`&&!a&&this.patchCaches(e);let s=o||i&&e.type!==`metadata`;(s||i)&&this.invalidate(s)}patchCaches(e){for(let t of e.runs)this.patches.set(t.runId,{value:t,version:this.metadata});this.client.setQueriesData({queryKey:[this.project,`reports`],predicate:e=>String(e.queryKey[2]??``).trim()===``},e=>e&&{...e,pages:e.pages.map(e=>this.patch(e,this.metadata-1))})}invalidate(e){let t={queryKey:[this.project,`reports`],refetchType:`active`,...e?{}:{predicate:e=>String(e.queryKey[2]??``).trim()!==``}};for(let e of this.client.getQueryCache().findAll(t))e.state.fetchStatus===`fetching`&&this.trailing.add(e);this.client.invalidateQueries(t,{cancelRefetch:!1})}};function oe(e,t){let n=Y.get(e);n||(n=new Map,Y.set(e,n));let r=n.get(t);return r||(r=new ae(e,t),n.set(t,r)),r}async function se(e,t){let n=await l.api.v1.p[`:projectId`].reports.state.$get({param:{projectId:e}},u({signal:t}));return K.parse(await g(n,`/reports/state`))}function ce(e){let t=oe(p(),e);return(0,H.useEffect)(()=>{let n=o(`reports:project:${e}`,e=>{let n=J.safeParse(e);n.success&&t.receive(n.data,n.data.type===`snapshot`)}),r,i,a=()=>{if(c()===`finite`&&!r){i=new AbortController;let n=i.signal;se(e,n).then(e=>{n.aborted||t.receive({type:`snapshot`,...e})}).catch(()=>void 0),r=s({path:`/api/v1/p/${encodeURIComponent(e)}/reports/state`,intervalMs:5e3},(e,n)=>{let r=K.safeParse(e);!n&&r.success&&t.receive({type:`snapshot`,...r.data})})}else c()!==`finite`&&(i?.abort(),r?.(),r=void 0)};a();let l=d(a);return()=>{l(),i?.abort(),r?.(),n()}},[t,e]),t}async function le(e,t,n,r){let i=await l.api.v1.p[`:projectId`].reports.$get({param:{projectId:e},query:{q:t.slice(0,U),...n?{before:n}:{}}},u(r?{signal:r}:void 0));return G.parse(await g(i,`/reports`))}function X(e){let t=r(),n=ce(t);return h({queryKey:[t,`reports`,e],initialPageParam:void 0,queryFn:({pageParam:r,signal:i})=>n.read(e,()=>le(t,e,r,i)),getNextPageParam:e=>e.nextCursor??void 0,staleTime:0,refetchOnWindowFocus:!0})}var Z=n(),Q=new Map;function ue(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(t)}function de(e){let t=L(),[n,r]=(0,H.useState)(!1);return(0,H.useLayoutEffect)(()=>{let n=e.current;if(!n)return;let i=e=>{r(e>0?e>=660:t)};if(i(n.getBoundingClientRect().width),typeof ResizeObserver!=`function`)return;let a=new ResizeObserver(e=>{let t=e[0]?.contentRect.width??n.getBoundingClientRect().width;i(t)});return a.observe(n),()=>a.disconnect()},[e,t]),n}function fe(){let e=T(),t=E(),[n,r]=F(),a=(n.get(`q`)??``).slice(0,U),o=X(a),s=(0,H.useRef)(null),c=(0,H.useRef)(null),l=(0,H.useRef)(``),u=e.pathname+e.search,d=o.data?.pages.flatMap(e=>e.reports)??[],f=e=>{Q.set(u,{scroll:c.current?.scrollTop??0,row:e,pages:o.data?.pages.length??1})},[p,m]=(0,H.useState)(null),h=de(s);(0,H.useLayoutEffect)(()=>{if(!o.data||l.current===u)return;let n=Q.get(u),r=e.state?.filesRestoreKey===u;if(!n||!c.current||t!==`POP`&&!r){l.current=u;return}let i=c.current.querySelector(`[data-report-id="${n.row}"]`);if(o.isFetchNextPageError){l.current=u,c.current.scrollTop=0;return}if((!i||o.data.pages.length<n.pages)&&o.hasNextPage){o.isFetchingNextPage||o.fetchNextPage();return}l.current=u,c.current.scrollTop=i?n.scroll:0,i?.focus({preventScroll:!0})},[u,o.data,o.hasNextPage,o.isFetchingNextPage,o.isFetchNextPageError,o.fetchNextPage,e.state,t]);let g=t=>r(n=>(t?n.set(`q`,t.slice(0,U)):n.delete(`q`),Q.delete(e.pathname+`?`+n.toString()),n)),_=d.find(e=>e.id===p)??d[0]??null,v=o.isPending?`full`:te(d.length);return(0,Z.jsx)(ne,{route:`reports`,density:v,fillHeight:!0,bodyClassName:`gap-4`,header:{title:`Reports`,subtitle:`Published HTML snapshots from tasks in this project.`},children:(0,Z.jsxs)(`div`,{ref:s,"data-slot":`reports-content`,className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`relative w-full shrink-0`,children:[(0,Z.jsx)(D,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),(0,Z.jsx)(I,{maxLength:U,"aria-label":`Search reports`,placeholder:`Search reports or source tasks…`,value:a,onChange:e=>g(e.target.value),className:`h-10 w-full rounded-lg border-border bg-card pl-9 text-sm max-md:h-11`})]}),o.isPending?(0,Z.jsx)(`div`,{ref:c,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsx)(`p`,{role:`status`,className:`py-4 text-sm text-muted-foreground`,children:`Loading reports…`})}):o.isError&&d.length===0?(0,Z.jsx)(`div`,{ref:c,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-3 rounded-xl border border-border bg-card p-5`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Could not load reports`}),(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o.error.message}),(0,Z.jsx)(j,{variant:`outline`,className:`min-h-11`,onClick:()=>void o.refetch(),children:`Retry`})]})}):d.length===0?(0,Z.jsx)(`div`,{ref:c,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsx)(P,{icon:(0,Z.jsx)(R,{}),title:a?`No matching reports`:`No published reports yet`,description:a?`Try a different keyword or clear the search filter.`:(0,Z.jsxs)(Z.Fragment,{children:[`Publish an HTML snapshot with`,` `,(0,Z.jsxs)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:[z(),` artifact publish`]}),` `,`to list it here.`]}),actions:a?(0,Z.jsx)(j,{"data-slot":`reports-clear-search`,variant:`outline`,className:`min-h-11`,onClick:()=>g(``),children:`Clear search`}):(0,Z.jsx)(j,{variant:`outline`,className:`min-h-11`,asChild:!0,children:(0,Z.jsx)(M,{to:`/new`,children:`Start a task`})})})}):(0,Z.jsx)(N,{list:(0,Z.jsxs)(`div`,{ref:c,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1.5`,"aria-label":`Reports`,children:d.map(e=>{let t=_?.id===e.id;return(0,Z.jsxs)(`li`,{"data-slot":`report-row`,"data-selected":h&&t?`true`:void 0,className:i(`reports-row flex items-center gap-3 rounded-xl border border-border bg-card px-4 py-3 transition-colors`,h&&t&&`border-accent-strong/60 bg-sidebar-row-selected/40`),children:[(0,Z.jsx)(R,{"aria-hidden":`true`,className:`reports-icon mt-0.5 size-4 shrink-0 self-start text-accent-text`}),(0,Z.jsxs)(`div`,{className:`reports-lines flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(`h2`,{className:`flex min-w-0 text-[14px] leading-5 font-semibold text-foreground`,title:B(e),children:(0,Z.jsx)(M,{"data-report-id":e.id,className:`reports-open text-foreground no-underline`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:u,filesRestoreKey:u},onClick:()=>f(e.id),children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:B(e)})})}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-xs leading-4 text-muted-foreground`,children:[(0,Z.jsx)(M,{className:`reports-task min-w-0 truncate text-xs text-muted-foreground no-underline hover:text-foreground hover:underline`,to:`/tasks/${e.runId}`,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,title:e.taskTitle,children:e.taskTitle})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`}),(0,Z.jsx)(`time`,{className:`shrink-0 tabular-nums`,dateTime:e.createdAt,title:ue(e.createdAt),children:$(e.createdAt)})]})]}),h?(0,Z.jsx)(`button`,{type:`button`,"data-slot":`report-preview-select`,"aria-label":`Preview ${B(e)}`,"aria-pressed":t,onClick:()=>m(e.id),className:`reports-preview-btn inline-flex min-h-8 min-w-8 shrink-0 items-center justify-center gap-1 rounded-md border border-border bg-background px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:(0,Z.jsx)(A,{"aria-hidden":`true`,className:`size-3.5`})}):(0,Z.jsx)(k,{"aria-hidden":`true`,"data-slot":`report-open-cue`,className:`reports-cue size-4 shrink-0 text-muted-foreground`})]},e.id)})}),o.hasNextPage?(0,Z.jsx)(`div`,{className:`mt-4`,children:(0,Z.jsx)(j,{variant:`outline`,className:`min-h-11`,disabled:o.isFetchingNextPage,onClick:()=>void o.fetchNextPage(),children:`Load more reports`})}):null,v===`sparse`?(0,Z.jsx)(re,{summary:`${d.length} published ${d.length===1?`report`:`reports`}. Select a row to open full screen or preview beside the list.`}):null]}),detail:h&&_?(0,Z.jsx)(pe,{report:_,restoreKey:u,onOpenReader:()=>f(_.id)}):null})]})})}function pe({report:e,restoreKey:t,onOpenReader:n}){let r=(0,H.useContext)(m)!==void 0;return(0,Z.jsxs)(`section`,{"data-slot":`reports-preview-pane`,"aria-label":`Preview of ${B(e)}`,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-border bg-card`,children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2 border-b border-border px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`h2`,{className:`truncate text-sm font-semibold text-foreground`,children:B(e)}),(0,Z.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-muted-foreground`,children:[e.taskTitle,` · `,$(e.createdAt)]})]}),(0,Z.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,className:`h-auto min-h-8 shrink-0 py-1.5`,children:(0,Z.jsxs)(M,{"data-slot":`reports-preview-open`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:t,filesRestoreKey:t},onClick:n,children:[`Open reader`,(0,Z.jsx)(O,{"aria-hidden":`true`,className:`size-3.5`})]})})]}),r?(0,Z.jsx)(me,{report:e}):(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-xs text-muted-foreground`,children:`Open reader to view this HTML report.`})]})}function me({report:e}){let t=a(e.runId,e.id);if(t.isPending)return(0,Z.jsx)(`p`,{role:`status`,className:`p-6 text-xs text-muted-foreground`,children:`Loading preview…`});if(t.isError)return(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 p-6 text-xs text-muted-foreground`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-foreground`,children:`Could not load report preview`}),(0,Z.jsx)(`p`,{children:t.error.message}),(0,Z.jsx)(j,{variant:`outline`,size:`sm`,onClick:()=>void t.refetch(),children:`Retry`})]});let n=t.data;return!n||n.type!==`file`||n.binary||n.content===void 0?(0,Z.jsx)(`p`,{className:`p-6 text-xs text-muted-foreground`,children:`Preview unavailable for this artifact.`}):(0,Z.jsx)(V,{html:n.content,title:B(e),className:`min-h-0 flex-1`})}function $(e){let t=ee(e);return t?t===`just now`?`Published just now`:`Published · ${t}`:``}export{fe as ReportsRoute};
@@ -1 +1 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{Gt as t,It as n,dn as r}from"./queries-EvENG6TN.js";import{hi as i,n as a,sn as o}from"./toaster-Cer2NOxt.js";import{n as s}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{k as c}from"./design-icons-CzEoMH9c.js";import{t as l}from"./button-B7MKxYjT.js";import{r as u}from"./switch-SP8pw5uU.js";import{t as d}from"./centered-state-V15AR_qo.js";import{fn as f}from"./index-BSZD2aai.js";import{t as p}from"./settings-select-CCIMGnyA.js";import{n as m}from"./saved-draft-BwzBc-_Y.js";import{t as h}from"./save-cue-Cd3ZAPBS.js";import{n as g,t as _}from"./settings-field-DP9sYv5a.js";var v=e(),y=1,b=1,x=60,S=256;function C(){let e=n();return e.isPending?(0,v.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,v.jsx)(d,{icon:(0,v.jsx)(c,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,v.jsx)(w,{config:e.data})}function w({config:e}){let n=i(),s=r({mutationFn:e=>o(e),onSuccess:e=>n.setQueryData(t.config,e),onError:e=>a(e.message,{tone:`danger`})}),[c,l]=m(e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``),d=e.resources.monitoringWakeIntervalMinutes??null,[f,p]=m(d===null?`park`:`interval`),[h,_]=m(String(d??5)),y=Number(h),C=!Number.isInteger(y)||y<b||y>x,w=f===`park`?d===null:!C&&d===y,k=f===`interval`&&C,j=()=>s.mutate({resources:{monitoringWakeIntervalMinutes:f===`park`?null:y}},{onSuccess:()=>a(f===`park`?`Monitoring will stay parked`:`Monitoring will re-check every ${y} minutes`)}),M=e.resources.autoResumeOnUsageLimit??!0,N=e=>s.mutate({resources:{autoResumeOnUsageLimit:e}},{onSuccess:()=>a(e?`Tasks stopped by a usage limit will resume themselves`:`Tasks stopped by a usage limit will stay failed`)}),P=c.trim()===``?0:Number(c),F=c.trim()!==``&&(!Number.isInteger(P)||P<S),I=(e.resources.memoryLimitMb??0)===(F?-1:P),L=()=>s.mutate({resources:{memoryLimitMb:P===0?null:P}},{onSuccess:()=>a(P===0?`Memory limit cleared`:`Memory limit set to ${P} MiB`)}),R=e.composerDefaults??{autonomous:null,worktree:null,inheritedAutonomous:`source-dependent`,inheritedWorktree:!0};return(0,v.jsxs)(`div`,{"data-slot":`resources-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,v.jsx)(T,{maxParallel:e.resources.maxParallel,onSelect:e=>s.mutate({resources:{maxParallel:e}}),disabled:s.isPending}),(0,v.jsx)(E,{maxParallel:e.resources.maxParallel,maxMonitoringSessions:e.resources.maxMonitoringSessions,onSelect:e=>s.mutate({resources:{maxMonitoringSessions:e}}),disabled:s.isPending}),(0,v.jsx)(D,{wakeMode:f,setWakeMode:p,wakeInterval:h,setWakeInterval:_,showInvalid:k,wakeSaved:w,saveWake:j,saveIsPending:s.isPending}),(0,v.jsx)(g,{title:`Auto-resume after a usage limit`,hint:`Resumes eligible tasks at the reset time the provider reports. Saves automatically.`,children:(0,v.jsx)(u,{"aria-label":`Auto-resume after a usage limit`,"data-slot":`resources-auto-resume`,checked:M,disabled:s.isPending,onCheckedChange:N})}),(0,v.jsx)(O,{memory:c,setMemory:l,memoryInvalid:F,memorySaved:I,saveMemory:L,saveIsPending:s.isPending}),(0,v.jsx)(A,{composerDefaults:R,saveComposerDefault:(e,t)=>s.mutate({composerDefaults:{[e]:t===`inherit`?null:t===`on`}}),saveIsPending:s.isPending})]})}function T({maxParallel:e,onSelect:t,disabled:n}){return(0,v.jsxs)(g,{title:`Max parallel tasks`,hint:`Limits how many tasks run at once. Saves automatically.`,children:[(0,v.jsx)(p,{"aria-label":`Max parallel tasks`,"data-slot":`resources-max-parallel`,value:e,disabled:n,onChange:e=>t(Number(e.target.value)),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:Array.from({length:16},(e,t)=>t+y).map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))}),(0,v.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Need a different limit for one project?`,` `,(0,v.jsx)(s,{to:`/settings/global/projects`,"data-slot":`resources-project-limits-link`,className:`font-medium text-link-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring`,children:`Configure per-project limits`}),`.`]})]})}function E({maxParallel:e,maxMonitoringSessions:t,onSelect:n,disabled:r}){return(0,v.jsxs)(g,{title:`Extra monitoring sessions`,hint:`Extra slots reserved for monitoring sessions. Saves automatically.`,children:[(0,v.jsx)(p,{"aria-label":`Extra monitoring sessions`,"data-slot":`resources-max-monitoring`,value:t??2,disabled:r,onChange:e=>n(Number(e.target.value)),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:Array.from({length:17},(e,t)=>(0,v.jsx)(`option`,{value:t,children:t},t))}),(0,v.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Capacity: `,e,` active + `,t??2,` monitoring. 0 shares the active slots.`]})]})}function D({wakeMode:e,setWakeMode:t,wakeInterval:n,setWakeInterval:r,showInvalid:i,wakeSaved:a,saveWake:o,saveIsPending:s}){return f(!a),(0,v.jsxs)(g,{title:`Monitoring wake-up`,hint:`Wake monitoring sessions periodically.`,children:[(0,v.jsxs)(`div`,{"data-reports-dirty":``,className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(u,{"aria-label":`Monitoring wake-up`,"data-slot":`resources-monitoring-wake-mode`,checked:e===`interval`,disabled:s,onCheckedChange:e=>t(e?`interval`:`park`)}),e===`interval`?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`label`,{htmlFor:`monitoring-wake-interval`,className:`w-full ${_}`,children:`Wake interval`}),(0,v.jsx)(`input`,{id:`monitoring-wake-interval`,type:`number`,min:b,max:x,"aria-label":`Wake interval in minutes`,"data-slot":`resources-monitoring-wake-interval`,value:n,disabled:s,onChange:e=>r(e.target.value),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,v.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`minutes`})]}):null,(0,v.jsx)(h,{show:a&&!i&&!s,children:(0,v.jsx)(l,{type:`button`,variant:`primary`,size:`sm`,"data-action":`resources-save-monitoring-wake`,disabled:a||i||s,onClick:o,children:`Save`})})]}),i?(0,v.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-xs text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):null]})}function O({memory:e,setMemory:t,memoryInvalid:n,memorySaved:r,saveMemory:i,saveIsPending:a}){return f(!r),(0,v.jsxs)(g,{title:`Per-task memory limit`,hint:`Applies to newly started tasks. Leave blank for no limit.`,children:[(0,v.jsxs)(`div`,{"data-reports-dirty":``,className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:S,step:256,"aria-label":`Per-task memory limit in MiB`,"data-slot":`resources-memory-limit`,value:e,disabled:a,placeholder:`no limit`,onChange:e=>t(e.target.value),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,v.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`MiB`}),(0,v.jsx)(h,{show:r&&!n&&!a,children:(0,v.jsx)(l,{type:`button`,variant:`primary`,size:`sm`,"data-action":`resources-save-memory`,disabled:r||n||a,onClick:i,children:`Save`})})]}),n?(0,v.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-xs text-danger`,children:[`Enter a whole number of at least `,S,` MiB, or leave empty for no limit.`]}):null]})}function k(e){return e===null?`inherit`:e?`on`:`off`}function A({composerDefaults:e,saveComposerDefault:t,saveIsPending:n}){return(0,v.jsxs)(g,{title:`New task defaults`,hint:`Apply to new tasks unless overridden.`,children:[(0,v.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,v.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:grid-cols-1`,children:[(0,v.jsx)(`span`,{className:_,children:`Autonomous by default`}),(0,v.jsxs)(p,{"aria-label":`Autonomous by default`,value:k(e.autonomous),disabled:n,onChange:e=>t(`autonomous`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,v.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,v.jsx)(`option`,{value:`on`,children:`On`}),(0,v.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,v.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Inherited: `,e.inheritedAutonomous===`source-dependent`?`Source-dependent — skills on, workflows off`:e.inheritedAutonomous?`On`:`Off`]})]}),(0,v.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:grid-cols-1`,children:[(0,v.jsx)(`span`,{className:_,children:`Use a worktree by default`}),(0,v.jsxs)(p,{"aria-label":`Use a worktree by default`,value:k(e.worktree),disabled:n,onChange:e=>t(`worktree`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,v.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,v.jsx)(`option`,{value:`on`,children:`On`}),(0,v.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,v.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Inherited: `,e.inheritedWorktree?`On`:`Off`]})]})]}),(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated. Saves automatically.`})]})}export{C as ResourcesSection};
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{Gt as t,It as n,dn as r}from"./queries-EvENG6TN.js";import{hi as i,n as a,sn as o}from"./toaster-Cer2NOxt.js";import{n as s}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{k as c}from"./design-icons-CzEoMH9c.js";import{t as l}from"./button-B7MKxYjT.js";import{t as u}from"./switch-DKqVf8-p.js";import{t as d}from"./centered-state-V15AR_qo.js";import{fn as f}from"./index-BhB5uLZf.js";import{t as p}from"./settings-select-CCIMGnyA.js";import{n as m}from"./saved-draft-BwzBc-_Y.js";import{t as h}from"./save-cue-Cd3ZAPBS.js";import{n as g,t as _}from"./settings-field-DP9sYv5a.js";var v=e(),y=1,b=1,x=60,S=256;function C(){let e=n();return e.isPending?(0,v.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,v.jsx)(d,{icon:(0,v.jsx)(c,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,v.jsx)(w,{config:e.data})}function w({config:e}){let n=i(),s=r({mutationFn:e=>o(e),onSuccess:e=>n.setQueryData(t.config,e),onError:e=>a(e.message,{tone:`danger`})}),[c,l]=m(e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``),d=e.resources.monitoringWakeIntervalMinutes??null,[f,p]=m(d===null?`park`:`interval`),[h,_]=m(String(d??5)),y=Number(h),C=!Number.isInteger(y)||y<b||y>x,w=f===`park`?d===null:!C&&d===y,k=f===`interval`&&C,j=()=>s.mutate({resources:{monitoringWakeIntervalMinutes:f===`park`?null:y}},{onSuccess:()=>a(f===`park`?`Monitoring will stay parked`:`Monitoring will re-check every ${y} minutes`)}),M=e.resources.autoResumeOnUsageLimit??!0,N=e=>s.mutate({resources:{autoResumeOnUsageLimit:e}},{onSuccess:()=>a(e?`Tasks stopped by a usage limit will resume themselves`:`Tasks stopped by a usage limit will stay failed`)}),P=c.trim()===``?0:Number(c),F=c.trim()!==``&&(!Number.isInteger(P)||P<S),I=(e.resources.memoryLimitMb??0)===(F?-1:P),L=()=>s.mutate({resources:{memoryLimitMb:P===0?null:P}},{onSuccess:()=>a(P===0?`Memory limit cleared`:`Memory limit set to ${P} MiB`)}),R=e.composerDefaults??{autonomous:null,worktree:null,inheritedAutonomous:`source-dependent`,inheritedWorktree:!0};return(0,v.jsxs)(`div`,{"data-slot":`resources-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,v.jsx)(T,{maxParallel:e.resources.maxParallel,onSelect:e=>s.mutate({resources:{maxParallel:e}}),disabled:s.isPending}),(0,v.jsx)(E,{maxParallel:e.resources.maxParallel,maxMonitoringSessions:e.resources.maxMonitoringSessions,onSelect:e=>s.mutate({resources:{maxMonitoringSessions:e}}),disabled:s.isPending}),(0,v.jsx)(D,{wakeMode:f,setWakeMode:p,wakeInterval:h,setWakeInterval:_,showInvalid:k,wakeSaved:w,saveWake:j,saveIsPending:s.isPending}),(0,v.jsx)(g,{title:`Auto-resume after a usage limit`,hint:`Resumes eligible tasks at the reset time the provider reports. Saves automatically.`,children:(0,v.jsx)(u,{"aria-label":`Auto-resume after a usage limit`,"data-slot":`resources-auto-resume`,checked:M,disabled:s.isPending,onCheckedChange:N})}),(0,v.jsx)(O,{memory:c,setMemory:l,memoryInvalid:F,memorySaved:I,saveMemory:L,saveIsPending:s.isPending}),(0,v.jsx)(A,{composerDefaults:R,saveComposerDefault:(e,t)=>s.mutate({composerDefaults:{[e]:t===`inherit`?null:t===`on`}}),saveIsPending:s.isPending})]})}function T({maxParallel:e,onSelect:t,disabled:n}){return(0,v.jsxs)(g,{title:`Max parallel tasks`,hint:`Limits how many tasks run at once. Saves automatically.`,children:[(0,v.jsx)(p,{"aria-label":`Max parallel tasks`,"data-slot":`resources-max-parallel`,value:e,disabled:n,onChange:e=>t(Number(e.target.value)),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:Array.from({length:16},(e,t)=>t+y).map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))}),(0,v.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Need a different limit for one project?`,` `,(0,v.jsx)(s,{to:`/settings/global/projects`,"data-slot":`resources-project-limits-link`,className:`font-medium text-link-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring`,children:`Configure per-project limits`}),`.`]})]})}function E({maxParallel:e,maxMonitoringSessions:t,onSelect:n,disabled:r}){return(0,v.jsxs)(g,{title:`Extra monitoring sessions`,hint:`Extra slots reserved for monitoring sessions. Saves automatically.`,children:[(0,v.jsx)(p,{"aria-label":`Extra monitoring sessions`,"data-slot":`resources-max-monitoring`,value:t??2,disabled:r,onChange:e=>n(Number(e.target.value)),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:Array.from({length:17},(e,t)=>(0,v.jsx)(`option`,{value:t,children:t},t))}),(0,v.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Capacity: `,e,` active + `,t??2,` monitoring. 0 shares the active slots.`]})]})}function D({wakeMode:e,setWakeMode:t,wakeInterval:n,setWakeInterval:r,showInvalid:i,wakeSaved:a,saveWake:o,saveIsPending:s}){return f(!a),(0,v.jsxs)(g,{title:`Monitoring wake-up`,hint:`Wake monitoring sessions periodically.`,children:[(0,v.jsxs)(`div`,{"data-reports-dirty":``,className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(u,{"aria-label":`Monitoring wake-up`,"data-slot":`resources-monitoring-wake-mode`,checked:e===`interval`,disabled:s,onCheckedChange:e=>t(e?`interval`:`park`)}),e===`interval`?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`label`,{htmlFor:`monitoring-wake-interval`,className:`w-full ${_}`,children:`Wake interval`}),(0,v.jsx)(`input`,{id:`monitoring-wake-interval`,type:`number`,min:b,max:x,"aria-label":`Wake interval in minutes`,"data-slot":`resources-monitoring-wake-interval`,value:n,disabled:s,onChange:e=>r(e.target.value),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,v.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`minutes`})]}):null,(0,v.jsx)(h,{show:a&&!i&&!s,children:(0,v.jsx)(l,{type:`button`,variant:`primary`,size:`sm`,"data-action":`resources-save-monitoring-wake`,disabled:a||i||s,onClick:o,children:`Save`})})]}),i?(0,v.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-xs text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):null]})}function O({memory:e,setMemory:t,memoryInvalid:n,memorySaved:r,saveMemory:i,saveIsPending:a}){return f(!r),(0,v.jsxs)(g,{title:`Per-task memory limit`,hint:`Applies to newly started tasks. Leave blank for no limit.`,children:[(0,v.jsxs)(`div`,{"data-reports-dirty":``,className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:S,step:256,"aria-label":`Per-task memory limit in MiB`,"data-slot":`resources-memory-limit`,value:e,disabled:a,placeholder:`no limit`,onChange:e=>t(e.target.value),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,v.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`MiB`}),(0,v.jsx)(h,{show:r&&!n&&!a,children:(0,v.jsx)(l,{type:`button`,variant:`primary`,size:`sm`,"data-action":`resources-save-memory`,disabled:r||n||a,onClick:i,children:`Save`})})]}),n?(0,v.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-xs text-danger`,children:[`Enter a whole number of at least `,S,` MiB, or leave empty for no limit.`]}):null]})}function k(e){return e===null?`inherit`:e?`on`:`off`}function A({composerDefaults:e,saveComposerDefault:t,saveIsPending:n}){return(0,v.jsxs)(g,{title:`New task defaults`,hint:`Apply to new tasks unless overridden.`,children:[(0,v.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,v.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:grid-cols-1`,children:[(0,v.jsx)(`span`,{className:_,children:`Autonomous by default`}),(0,v.jsxs)(p,{"aria-label":`Autonomous by default`,value:k(e.autonomous),disabled:n,onChange:e=>t(`autonomous`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,v.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,v.jsx)(`option`,{value:`on`,children:`On`}),(0,v.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,v.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Inherited: `,e.inheritedAutonomous===`source-dependent`?`Source-dependent — skills on, workflows off`:e.inheritedAutonomous?`On`:`Off`]})]}),(0,v.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:grid-cols-1`,children:[(0,v.jsx)(`span`,{className:_,children:`Use a worktree by default`}),(0,v.jsxs)(p,{"aria-label":`Use a worktree by default`,value:k(e.worktree),disabled:n,onChange:e=>t(`worktree`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,v.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,v.jsx)(`option`,{value:`on`,children:`On`}),(0,v.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,v.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Inherited: `,e.inheritedWorktree?`On`:`Off`]})]})]}),(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated. Saves automatically.`})]})}export{C as ResourcesSection};
@@ -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{l as r,n as i,t as a}from"./utils-DSMR_WLb.js";import{$ as o,$t as s,Ct as c,P as l,Wt as u,Xt as d,Yt as f,_ as p,dn as m,lt as h,rn as g,un as _}from"./queries-EvENG6TN.js";import{Fn as v,ct as y,dr as b,hi as x,n as S,ot as C,pt as w,rr as T}from"./toaster-Cer2NOxt.js";import{f as E,n as D,p as O}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{B as k,F as ee,K as A,X as te,at as j,c as ne,dt as M,ft as re,s as ie,u as N,v as ae}from"./design-icons-CzEoMH9c.js";import{t as P}from"./createLucideIcon-BHp8sXmF.js";import{t as oe}from"./check-OP-CVgZG.js";import{t as se}from"./chevron-right-BENZ-1ZN.js";import{t as ce}from"./external-link-BE6y205O.js";import{t as F}from"./eye-B8okNWXU.js";import{n as le}from"./smartphone-Lr8Ug2z_.js";import{t as I}from"./loader-circle-CPBhhDbB.js";import{t as ue}from"./message-square-B-MD-8rD.js";import{n as de,t as fe}from"./tool-display-B9NN44oU.js";import{t as pe}from"./square-terminal-B6RYYieR.js";import{t as L}from"./button-B7MKxYjT.js";import{n as R,r as z,t as B}from"./collapsible-BEV4FO-1.js";import{t as V}from"./project-router-BypHPat0.js";import{O as me}from"./task-groups-nvRvmVHf.js";import{a as he,c as ge,i as _e,l as ve,o as ye,s as be,t as xe}from"./report-selection-CXF3VYjA.js";import{n as Se}from"./centered-state-V15AR_qo.js";import{F as Ce,Qt as we,Y as Te,_n as Ee,ar as De,dr as Oe,en as ke,er as Ae,fn as je,ln as Me,nn as Ne}from"./index-BSZD2aai.js";import{i as Pe,r as Fe}from"./highlighter-DvLzHjjY.js";import{t as Ie}from"./zoomable-image-6RTKhLGE.js";import{i as Le,r as Re,t as H}from"./markdown-BZgLow5j.js";import{r as ze}from"./html-report-BX3msvci.js";import{t as U}from"./textarea-vJt9undk.js";import{t as Be}from"./task-file-scope-BEi9o8Ur.js";import{t as Ve}from"./report-title-D4Mbu2Er.js";var He=P(`anchor`,[[`path`,{d:`M12 6v16`,key:`nqf5sj`}],[`path`,{d:`m19 13 2-1a9 9 0 0 1-18 0l2 1`,key:`y7qv08`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}]]),Ue=P(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),We=P(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),Ge=P(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Ke=P(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),qe=P(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),W=e(t(),1),G=n();function Je(e,t){if(e.length===1)return[t.replace(RegExp(`^${Ye(e[0].header)}: ?`),``)];let n=t,r=[];for(let[t,i]of e.entries()){let a=`${i.header}: `;if(!n.startsWith(a))return;n=n.slice(a.length);let o=e[t+1],s=o?n.indexOf(`\n${o.header}: `):n.length;if(s<0)return;r.push(n.slice(0,s)),n=n.slice(s+1)}return r}function Ye(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Xe(e,t){if(t===void 0)return[];let n=e.options??[];if(!e.multiSelect)return n.filter(e=>e.label===t).map(e=>e.label);let r=[];function i(e,t){for(let{label:a}of n)t.includes(a)||(e===a?r.push([...t,a]):e.startsWith(`${a}, `)&&i(e.slice(a.length+2),[...t,a]))}return i(t,[]),r.length===1?r[0]:[]}var Ze=`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{l as r,n as i,t as a}from"./utils-DSMR_WLb.js";import{$ as o,$t as s,Ct as c,P as l,Wt as u,Xt as d,Yt as f,_ as p,dn as m,lt as h,rn as g,un as _}from"./queries-EvENG6TN.js";import{Fn as v,ct as y,dr as b,hi as x,n as S,ot as C,pt as w,rr as T}from"./toaster-Cer2NOxt.js";import{f as E,n as D,p as O}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{B as k,F as ee,K as A,X as te,at as j,c as ne,dt as M,ft as re,s as ie,u as N,v as ae}from"./design-icons-CzEoMH9c.js";import{t as P}from"./createLucideIcon-BHp8sXmF.js";import{t as oe}from"./check-OP-CVgZG.js";import{t as se}from"./chevron-right-BENZ-1ZN.js";import{t as ce}from"./external-link-BE6y205O.js";import{t as F}from"./eye-B8okNWXU.js";import{n as le}from"./smartphone-Lr8Ug2z_.js";import{t as I}from"./loader-circle-CPBhhDbB.js";import{t as ue}from"./message-square-B-MD-8rD.js";import{n as de,t as fe}from"./tool-display-B9NN44oU.js";import{t as pe}from"./square-terminal-B6RYYieR.js";import{t as L}from"./button-B7MKxYjT.js";import{n as R,r as z,t as B}from"./collapsible-BEV4FO-1.js";import{t as V}from"./project-router-BypHPat0.js";import{O as me}from"./task-groups-nvRvmVHf.js";import{a as he,c as ge,i as _e,l as ve,o as ye,s as be,t as xe}from"./report-selection-CXF3VYjA.js";import{n as Se}from"./centered-state-V15AR_qo.js";import{F as Ce,Qt as we,Y as Te,_n as Ee,ar as De,dr as Oe,en as ke,er as Ae,fn as je,ln as Me,nn as Ne}from"./index-BhB5uLZf.js";import{i as Pe,r as Fe}from"./highlighter-DvLzHjjY.js";import{t as Ie}from"./zoomable-image-6RTKhLGE.js";import{i as Le,r as Re,t as H}from"./markdown-DBT-WT_u.js";import{r as ze}from"./html-report-BX3msvci.js";import{t as U}from"./textarea-vJt9undk.js";import{t as Be}from"./task-file-scope-DM9imAKF.js";import{t as Ve}from"./report-title-D4Mbu2Er.js";var He=P(`anchor`,[[`path`,{d:`M12 6v16`,key:`nqf5sj`}],[`path`,{d:`m19 13 2-1a9 9 0 0 1-18 0l2 1`,key:`y7qv08`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}]]),Ue=P(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),We=P(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),Ge=P(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Ke=P(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),qe=P(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),W=e(t(),1),G=n();function Je(e,t){if(e.length===1)return[t.replace(RegExp(`^${Ye(e[0].header)}: ?`),``)];let n=t,r=[];for(let[t,i]of e.entries()){let a=`${i.header}: `;if(!n.startsWith(a))return;n=n.slice(a.length);let o=e[t+1],s=o?n.indexOf(`\n${o.header}: `):n.length;if(s<0)return;r.push(n.slice(0,s)),n=n.slice(s+1)}return r}function Ye(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Xe(e,t){if(t===void 0)return[];let n=e.options??[];if(!e.multiSelect)return n.filter(e=>e.label===t).map(e=>e.label);let r=[];function i(e,t){for(let{label:a}of n)t.includes(a)||(e===a?r.push([...t,a]):e.startsWith(`${a}, `)&&i(e.slice(a.length+2),[...t,a]))}return i(t,[]),r.length===1?r[0]:[]}var Ze=`
2
2
 
3
3
  Additional comments:
4
4
  `;function Qe(e){let t=e.indexOf(Ze);if(t<0)return{body:e,comment:void 0};let n=e.slice(t+23).trim();return{body:e.slice(0,t),comment:n||void 0}}function $e({ask:e}){let t=e.answer===void 0?void 0:Qe(e.answer),n=t===void 0?void 0:Je(e.questions,t.body);return(0,G.jsxs)(`div`,{"data-slot":`ask-answers`,className:`flex flex-col gap-4 text-sm`,children:[e.questions.map((t,r)=>{let i=n?.[r],a=Xe(t,i),o=i!==void 0&&a.length===0;return(0,G.jsxs)(`section`,{className:`flex flex-col gap-2`,"aria-label":t.question,children:[(0,G.jsxs)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:[t.header,` · Question `,r+1,` of `,e.questions.length]}),(0,G.jsx)(`p`,{className:`break-words font-semibold`,children:t.question}),t.options?(0,G.jsxs)(`ul`,{className:`flex list-none flex-col gap-1.5`,children:[t.options.map(e=>(0,G.jsxs)(`li`,{"data-selected":a.includes(e.label),className:`flex items-start gap-2 rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border data-[selected=true]:bg-message-user-accent/5`,children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-message-user-accent`,children:a.includes(e.label)?`✓`:`○`}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 break-words`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:e.label}),e.description?(0,G.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description}):null]}),a.includes(e.label)?(0,G.jsx)(`span`,{className:`shrink-0 text-xs text-message-user-accent`,children:`Selected`}):null]},e.label)),(0,G.jsxs)(`li`,{"data-selected":o,className:`rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border`,children:[(0,G.jsxs)(`p`,{className:`flex items-start gap-2 font-medium`,children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`text-message-user-accent`,children:o?`✓`:`○`}),(0,G.jsx)(`span`,{className:`flex-1`,children:`Other`}),o?(0,G.jsx)(`span`,{className:`text-xs text-message-user-accent`,children:`Selected`}):null]}),o?(0,G.jsx)(K,{text:i}):null]})]}):i===void 0?null:(0,G.jsx)(K,{text:i})]},t.id??r)}),n&&t?.comment?(0,G.jsxs)(`section`,{className:`flex flex-col gap-1`,"aria-label":`Additional comments`,children:[(0,G.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:`Additional comments`}),(0,G.jsx)(K,{text:t.comment})]}):null,!n&&e.answer!==void 0?(0,G.jsx)(K,{text:e.answer}):null]})}function K({text:e}){return(0,G.jsx)(`blockquote`,{className:`[margin-block-start:0.5rem] border-s-2 border-message-user-accent ps-3 break-words whitespace-pre-wrap`,children:e})}function q(e,t,n){let r=n[e];return r===void 0?(t[e]?.length??0)>0:r.trim().length>0}function et(e,t,n){let r=n[e]?.trim();if(r)return r;let i=t[e]??[];return i.length>0?i.join(`, `):`Not answered yet`}function tt({stepped:e,mode:t,onModeChange:n,showModeSwitch:r,stepLabel:i,hasSheetContext:o,showContextButtonRef:s,onOpenContext:c,onShowOrigin:l}){return(0,G.jsxs)(`div`,{"data-slot":`ask-header`,className:`flex shrink-0 flex-wrap items-center gap-x-2 gap-y-1 border-b border-border/70 px-2.5 py-1.5 md:px-3 md:py-2`,children:[(0,G.jsx)(`span`,{className:`text-xs font-semibold text-link-foreground`,children:`Needs your answer`}),e&&t===`options`?(0,G.jsx)(`span`,{"data-slot":`ask-step-indicator`,className:`rounded-full bg-accent-strong/15 px-2 py-0.5 text-xs font-semibold text-foreground tabular-nums`,children:i}):null,(0,G.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-1.5`,children:[o?(0,G.jsxs)(L,{ref:s,type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-context`,className:`min-h-11 min-w-11 px-2 text-xs font-medium text-link-foreground underline underline-offset-4 md:min-h-8 md:min-w-0`,onClick:c,children:[(0,G.jsx)(De,{"aria-hidden":`true`,className:`size-3.5`}),`Show context`]}):l?(0,G.jsx)(ct,{onShowOrigin:l}):null,r?(0,G.jsxs)(`div`,{"data-slot":`ask-mode-switch`,role:`group`,"aria-label":`Reply mode`,className:`inline-flex items-center rounded-lg border border-border bg-card p-0.5`,children:[(0,G.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-options`,"aria-pressed":t===`options`,onClick:()=>n(`options`),className:a(`min-h-11 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring md:min-h-7`,t===`options`?`bg-accent-strong text-accent-strong-foreground`:`text-foreground hover:bg-muted/60`),children:`Options`}),(0,G.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-reply`,"aria-pressed":t===`reply`,onClick:()=>n(`reply`),className:a(`min-h-11 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring md:min-h-7`,t===`reply`?`bg-accent-strong text-accent-strong-foreground`:`text-foreground hover:bg-muted/60`),children:`Write a reply`})]}):null]})]})}function nt({questions:e,stepIndex:t,selections:n,otherAnswers:r,hasComment:i,onSelectStep:o}){let s=e.length;return(0,G.jsxs)(`div`,{"data-slot":`ask-step-pills`,role:`group`,"aria-label":`Question steps`,className:`hidden shrink-0 flex-wrap items-center gap-1.5 border-b border-border/60 px-3 py-1.5 md:flex`,children:[e.map((e,i)=>{let s=t===i,c=q(i,n,r);return(0,G.jsxs)(`button`,{type:`button`,"aria-current":s?`step`:void 0,onClick:()=>o(i),className:a(`inline-flex min-h-8 items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring`,s?`border-accent-strong bg-accent-strong/15 text-foreground`:c?`border-border bg-card text-foreground hover:border-accent-strong/50`:`border-border bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,G.jsx)(`span`,{className:`tabular-nums text-xs font-semibold`,children:c?(0,G.jsx)(oe,{"aria-hidden":`true`,className:`size-3 text-semantic-green`}):`${i+1}.`}),(0,G.jsx)(`span`,{className:`max-w-[140px] truncate`,children:e.header})]},e.id??i)}),(0,G.jsxs)(`button`,{type:`button`,"aria-current":t===s?`step`:void 0,onClick:()=>o(s),className:a(`inline-flex min-h-8 items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring`,t===s?`border-accent-strong bg-accent-strong/15 text-foreground`:i?`border-border bg-card text-foreground hover:border-accent-strong/50`:`border-dashed border-border bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,G.jsx)(Ke,{"aria-hidden":`true`,className:`size-3`}),(0,G.jsx)(`span`,{children:`Comment`})]})]})}function rt({questions:e,selections:t,otherAnswers:n,comment:r,disabled:i,onCommentChange:o,onJumpToQuestion:s}){let c=(0,W.useId)();return(0,G.jsxs)(`div`,{"data-slot":`ask-comment-step`,className:`flex flex-col gap-2.5`,children:[(0,G.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-2.5`,children:[(0,G.jsx)(`p`,{className:`mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Selected answers`}),(0,G.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.map((e,r)=>{let i=q(r,t,n);return(0,G.jsxs)(`li`,{className:`flex items-baseline justify-between gap-2 text-xs`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>s(r),className:`min-h-11 text-start font-medium text-link-foreground underline-offset-4 hover:underline md:min-h-6`,children:e.header}),(0,G.jsx)(`span`,{className:a(`min-w-0 truncate text-end`,i?`text-foreground`:`text-semantic-red`),children:et(r,t,n)})]},e.id??r)})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{htmlFor:c,className:`mb-1 block text-xs font-medium text-foreground`,children:`Additional comments (optional)`}),(0,G.jsx)(U,{id:c,"data-slot":`ask-additional-comment`,rows:2,value:r,disabled:i,placeholder:`Optional extra notes to send with your selections…`,onChange:e=>o(e.target.value),className:`bg-card text-base md:text-[13px]`})]})]})}function it({value:e,onValueChange:t,disabled:n,renderFreeTextReply:r}){let i=(0,W.useId)();return r?(0,G.jsx)(`div`,{"data-slot":`ask-free-text`,children:r({value:e,onValueChange:t,disabled:n})}):(0,G.jsxs)(`div`,{"data-slot":`ask-free-text`,className:`flex flex-col gap-2`,children:[(0,G.jsx)(`label`,{htmlFor:i,className:`text-xs font-medium text-foreground`,children:`Reply to the agent`}),(0,G.jsx)(U,{id:i,rows:2,value:e,disabled:n,placeholder:`Write a free-text reply…`,onChange:e=>t(e.target.value),className:`bg-card text-base md:text-[13px]`})]})}function at({stepIndex:e,questionCount:t,answeredCount:n,allAnswered:r,hasComment:i,resuming:o,disabled:s,onBack:c,onNext:l,onOpenComment:u,onSend:d,questions:f,selections:p,otherAnswers:m,stopControl:h}){let g=e===t-1,_=e===t,v=o?`Send answer & reopen`:`Send answer`;return(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e>0?(0,G.jsxs)(L,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:c,children:[(0,G.jsx)(Oe,{"aria-hidden":`true`,className:`size-4`}),`Back`]}):null,(0,G.jsxs)(`span`,{"data-slot":`ask-progress-dots`,"aria-hidden":`true`,className:`flex items-center gap-1.5 px-1 md:hidden`,children:[f.map((t,n)=>{let r=n===e,i=q(n,p,m);return(0,G.jsx)(`span`,{className:a(`size-2 rounded-full motion-safe:transition-colors`,r?`bg-accent-strong`:i?`bg-success`:`bg-border`)},t.id??n)}),(0,G.jsx)(`span`,{className:a(`size-2 rounded-full motion-safe:transition-colors`,_?`bg-accent-strong`:i?`bg-success`:`bg-border/60`)})]}),(0,G.jsxs)(`span`,{"data-slot":`ask-progress-summary`,className:`hidden text-xs text-soft-foreground tabular-nums sm:inline`,children:[n,` of `,t,` answered`]}),o?(0,G.jsx)(`span`,{"data-slot":`ask-resume-hint`,className:`text-xs text-soft-foreground`,children:`Reopens the closed session.`}):null,(0,G.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-2`,children:[h,!g&&!_?(0,G.jsxs)(L,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:l,children:[`Next`,(0,G.jsx)(se,{"aria-hidden":`true`,className:`size-4`})]}):null,g?(0,G.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:u,children:i?`Edit comment`:`+ Comment`}):null,g||_||r?(0,G.jsx)(L,{type:`button`,size:`sm`,className:`min-h-11 min-w-11 px-3.5 md:min-h-8 md:min-w-0`,disabled:s||!r,onClick:d,children:v}):null]})]})}function ot({oneTap:e,hasOtherAnswer:t,allowComment:n,commentOpen:r,hasComment:i,resuming:a,disabled:o,onToggleComment:s,onSend:c,stopControl:l}){return(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n?(0,G.jsxs)(L,{type:`button`,variant:`ghost`,size:`sm`,className:`min-h-11 min-w-11 px-2 text-xs text-muted-foreground hover:text-foreground md:min-h-8 md:min-w-0`,onClick:s,children:[(0,G.jsx)(Ke,{"aria-hidden":`true`,className:`size-3.5`}),r?`Hide comment`:i?`Edit comment`:`+ Add comment`]}):null,(0,G.jsx)(`span`,{"data-slot":a?`ask-resume-hint`:`ask-hint`,className:`text-xs text-soft-foreground`,children:a?`Reopens the closed session.`:e?`Tap an option to send.`:`Choose an answer, then send.`}),(0,G.jsxs)(`div`,{className:`ms-auto flex items-center gap-2`,children:[l,!e||t||r||i?(0,G.jsx)(L,{type:`button`,size:`sm`,className:`min-h-11 min-w-11 px-3.5 md:min-h-8 md:min-w-0`,disabled:o,onClick:c,children:a?`Send answer & reopen`:`Send answer`}):null]})]})}function st({blockedBy:e,reason:t,error:n}){return(0,G.jsxs)(G.Fragment,{children:[t?(0,G.jsxs)(`p`,{"data-slot":`ask-blocked-reason`,className:`text-xs text-muted-foreground`,children:[t,` `,e===`provider`?(0,G.jsx)(V,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null]}):null,n?(0,G.jsx)(`p`,{role:`alert`,className:`text-xs text-semantic-red`,children:n}):null]})}function ct({onShowOrigin:e,className:t}){return(0,G.jsx)(L,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-origin`,onClick:e,className:a(`min-h-11 min-w-11 px-2 text-xs font-medium text-link-foreground underline underline-offset-4 md:min-h-8 md:min-w-0`,t),children:`Show where it was asked`})}function lt({open:e,onOpenChange:t,runId:n,context:r,onShowOrigin:i,returnFocusRef:a}){let o=(0,W.useRef)(!1);return(0,G.jsx)(_e,{open:e,onOpenChange:t,children:(0,G.jsxs)(ye,{side:`right`,showCloseButton:!1,"data-slot":`ask-context-sheet`,className:`flex w-full max-w-[540px] flex-col gap-0 p-0 sm:max-w-[540px]`,onCloseAutoFocus:e=>{if(e.preventDefault(),o.current){o.current=!1,i?.();return}a?.current?.focus()},children:[(0,G.jsxs)(ge,{className:`relative shrink-0 border-b border-border px-5 py-4 pr-14`,children:[(0,G.jsx)(ve,{children:`Question context`}),(0,G.jsx)(be,{children:`Your selections and drafts stay intact while you read.`}),(0,G.jsx)(he,{asChild:!0,children:(0,G.jsx)(L,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,className:`absolute inset-bs-2 end-2 size-11 md:size-9`,children:(0,G.jsx)(re,{"aria-hidden":`true`,className:`size-4`})})})]}),(0,G.jsx)(`div`,{"data-slot":`ask-context`,role:`region`,"aria-label":`Context`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain break-words px-5 py-4 text-sm text-foreground`,children:(0,G.jsx)(Be,{runId:n,children:(0,G.jsx)(H,{breaks:!0,children:r})})}),i?(0,G.jsx)(`div`,{className:`flex shrink-0 items-center justify-end border-t border-border px-5 py-3`,children:(0,G.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`ask-show-origin`,className:`min-h-11 md:min-h-8`,onClick:()=>{o.current=!0,t(!1),i()},children:`Show where it was asked`})}):null]})})}function ut(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var dt=/^[A-Za-z0-9_./:=+,@%-]+$/;function ft(e){return e.replaceAll(`'`,`'\\''`)}function pt(e){return e===``?`''`:dt.test(e)?e:`\u0027${ft(e)}\u0027`}function mt(e){if(!ut(e))return;let t=e.command;if(typeof t==`string`&&t!==``)return t;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return e.map(pt).join(` `)}}function ht(e){let t="`".repeat(3),n=`~`.repeat(3);return e.split(t).filter((e,t)=>t%2==0).join(` `).split(n).filter((e,t)=>t%2==0).join(` `).split("`").filter((e,t)=>t%2==0).join(` `)}function gt(e){return e.replace(/!\[(?:\\.|[^\]\\])*\]\([^)\s]*(?:\s+"[^"]*")?\)/g,` `)}function _t(e){return e.replace(/(?<!\\)(?:\*\*|\*|__|~~|`)/g,``).replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~])/g,`$1`)}function J(e){let t=e.trim();return t===``||t.startsWith(`#`)||/^(https?:|mailto:)/i.test(t)?!0:!/^[a-z][a-z0-9+.-]*:/i.test(t)}function vt(e){let t=ht(gt(e)),n=new Map;for(let e of t.matchAll(/^\s*\[([^\]]+)\]:\s*(\S+)/gm))J(e[2])&&n.set(e[1].toLowerCase(),e[2]);let r=t.replace(/^\s*\[[^\]]+\]:\s*\S+.*$/gm,` `),i=[];for(let e of r.matchAll(/(?<!!)\[((?:\\.|[^\]\\])+)\](?:\(((?:[^()\s]|\([^)]*\))+)(?:\s+"[^"]*")?\)|\[([^\]]*)\])|<(https?:\/\/[^>\s]+)>|(https?:\/\/[^\s<]+)/g)){if(e[2]){J(e[2])&&i.push({label:_t(e[1]),href:e[2]});continue}if(e[1]!==void 0&&e[3]!==void 0){let t=(e[3].length>0?e[3]:e[1]).toLowerCase(),r=n.get(t);r&&i.push({label:_t(e[1]),href:r});continue}let t=(e[4]??e[5])?.replace(/[.,;:!?]+$/,``);t&&J(t)&&i.push({label:t,href:t})}return i}var yt=(0,W.createContext)(void 0),bt=(0,W.createContext)(void 0);function xt(e,t){let n=new Map;for(let r of vt(e)){let e=Le(r.href,t);if(!e)continue;let i=new URL(e,`https://cockpit.invalid`),a=/^\/p\/([^/]+)\/tasks\/([^/]+)\/report$/.exec(i.pathname),o=/^\/tasks\/([^/]+)\/report$/.exec(i.pathname),s=i.searchParams.get(`artifact`);if(!s||(a?decodeURIComponent(a[1])!==t.projectId:!o))continue;let c=decodeURIComponent(a?a[2]:o[1]),l=`${c}:${s}`;n.has(l)||n.set(l,{runId:c,artifactId:s,label:r.label,href:e})}return[...n.values()]}function St(e,t){return`report-card-${encodeURIComponent(e)}-${t}`}function Ct({text:e,messageKey:t}){let n=(0,W.useContext)(Re),r=(0,W.useContext)(bt),i=t??r;if(!n||i===void 0)return null;let a=xt(e,n);return a.length===0?null:(0,G.jsx)(`div`,{"data-slot":`report-cards`,className:`flex flex-col gap-3 [margin-block-start:1rem]`,children:a.map(e=>(0,G.jsx)(wt,{reference:e,messageKey:i},`${e.runId}:${e.artifactId}`))})}function wt({reference:e,messageKey:t}){let{artifactId:n,runId:r,label:i,href:a}=e,o=(0,W.useContext)(yt),s=(0,W.useContext)(xe);(0,W.useLayoutEffect)(()=>s?.register(n,r),[s,n,r]);let c=l(r,n),u=E(),d=O();if(c.isError)return(0,G.jsx)(D,{id:St(t,n),"data-slot":`report-card-fallback`,to:a,state:{readerFrom:u.pathname+u.search},children:i});let f=c.data?.artifact;if(f&&!ze(f.name))return null;let p=new URLSearchParams(u.search);p.set(`report`,n),p.set(`card`,t);let m=new URLSearchParams(u.search).has(`report`)?u.state:null,h=new URLSearchParams(u.search);h.delete(`report`),h.delete(`card`);let g=`${u.pathname}${h.size?`?${h}`:``}`,_=window.navigation,v={reportCardEntry:!0,reportReturnTo:m?.reportReturnTo??g,reportReturnKey:m?.reportReturnKey??_?.currentEntry?.key,reportScrollTop:m?.reportScrollTop},y={pathname:u.pathname,search:`?${p}`,hash:new URL(a,`https://cockpit.invalid`).hash};return(0,G.jsxs)(`section`,{"data-slot":`report-card`,"data-artifact-id":n,"data-report-run-id":r,"aria-busy":c.isPending,className:`flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-card p-3 text-foreground`,children:[(0,G.jsx)(`h3`,{className:`break-words text-sm font-medium`,children:f?Ve(f):i}),(0,G.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`HTML report`}),(0,G.jsx)(D,{id:St(t,n),to:y,state:v,onClick:e=>{if(e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault(),o?.(t);let n=v.reportScrollTop??(document.querySelector(`[data-slot="thread-transcript"]`)??document.querySelector(`[data-slot="main"]`))?.scrollTop;d(y,{state:{...v,reportScrollTop:n}})},className:`inline-flex min-h-11 min-w-11 items-center self-start rounded-md border border-border px-3 text-sm active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring ${c.isPending?`text-soft-foreground`:`text-accent-text`}`,children:`Read report`})]})}var Tt={message:!0,reasoning:!0,tool:!0,hook:!0};function Et(e){return Object.hasOwn(Tt,e)&&Tt[e]}var Dt=e=>e.kind===`tool`,Ot=e=>e.kind===`conversation`,kt=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,At=(e,t,n)=>`${e} ${e===1?t:n}`;function jt(e,t){let n=[];return e>0&&n.push(At(e,`file`,`files`)),t>0&&n.push(At(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function Mt(e){return`${e} earlier tool call${e===1?``:`s`}`}var Nt=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function Pt(e){for(let t of Nt)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}var Ft=new WeakMap;function It(e){let t=Ft.get(e);if(t)return t;let n=Lt(e);return Ft.set(e,n),n}function Lt(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!((e.kind===`reasoning`||e.kind===`message`)&&e.text.trim()===``)),n=new Set(t.filter(Dt).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=Et(e.kind)&&`parentItemId`in e&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:jt(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]},c=[],l=()=>{if(c.length!==0){for(let e of Rt(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(Ot(e)){s(),c.push(e);continue}l(),Dt(e)&&kt(e)&&!r.has(e.id)?o.push(e):(s(),Dt(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}))}s(),l();let u=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,d=e=>e.kind===`context-group`?e.tools.length:1,f=[],p=[],m=()=>{if(p.length>3){let e=p.slice(0,p.length-3);f.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+d(t),0),blocks:e}),f.push(...p.slice(p.length-3))}else f.push(...p);p=[]};for(let e of a)u(e)?p.push(e):(m(),f.push(e));return m(),f}function Rt(e){let t=[];for(let n of e){let e=t.at(-1);n.messageKind===`request`&&e?.kind===`request`&&e.senderRunId===n.senderRunId&&e.text===n.text&&e.messages[0].relationship===`peer`==(n.relationship===`peer`)&&!e.messages.some(e=>e.recipientRunId===n.recipientRunId)?e.messages.push(n):t.push({id:`worker-batch:${n.messageId}`,kind:n.messageKind,text:n.text,senderRunId:n.senderRunId,messages:[n]})}return{kind:`worker-conversation`,id:`worker:${e[0].id}`,batches:t}}var zt=new Map,Bt=(0,W.createContext)(null);function Vt(){return(0,W.useContext)(Bt)}function Ht({runId:e,children:t}){let n=(0,W.useMemo)(()=>({get:t=>zt.get(e)?.get(t),set:(t,n)=>{let r=zt.get(e)??new Map;r.set(t,n),zt.set(e,r)}}),[e]);return(0,G.jsx)(Bt.Provider,{value:n,children:t})}function Ut(e){return e.scrollTop<Math.max(600,e.clientHeight)}function Wt(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function Gt(e,t,n,r,i){if(n===void 0)return i;let a=r.find(({key:e})=>e===n.key);return a===void 0?i:e+(a.top-t-n.offset)}function Kt(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function qt(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var Jt=new Map;function Yt(e,t){Jt.set(e,t)}function Xt(e){return Jt.get(e)}var Zt=new Map;function Qt(e,t){Zt.set(e,{...t,...t.rowKeys?{rowKeys:[...t.rowKeys]}:{}})}function $t(e){return Zt.get(e)}function en(e,t,n){let r=Zt.get(e);if(!r||r.rows!==t)return;let i=r.rowKeys;if(!(n&&i&&(n.length!==t||i.length!==t||!n.every((e,t)=>e===i[t]))))return r.cache}var tn=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),nn=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),rn=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),an=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),on=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function Y(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function X(e){let t=Y(e);return t===void 0?void 0:tn.format(t)}function sn(e){let t=Y(e);return t===void 0?void 0:nn.format(t)}var Z=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function cn(e){let t=Y(e);return t===void 0?void 0:Z(t)}function ln(e,t=new Date){let n=Y(e);if(n===void 0)return;let r=Z(n);return r===Z(t)?`Today`:r===Z(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?rn:an).format(n)}function un(e,t){let n=Y(e),r=Y(t);if(n===void 0||r===void 0)return;let i=Math.round((r.getTime()-n.getTime())/1e3);if(i<0)return;if(i<60)return`${i}s`;let a=Math.floor(i/60);return a<60?`${a}m ${String(i%60).padStart(2,`0`)}s`:`${Math.floor(a/60)}h ${String(a%60).padStart(2,`0`)}m`}function dn({ts:e}){let t=X(e);return t===void 0?null:(0,G.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:sn(e),className:`text-xs leading-none text-soft-foreground`,children:t})}function fn({startedAt:e,completedAt:t}){let n=X(t);if(n===void 0)return null;let r=un(e,t);return(0,G.jsxs)(`div`,{"data-slot":`turn-time`,className:`flex items-center gap-1.5 px-0.5 text-xs leading-none text-soft-foreground`,children:[(0,G.jsx)(`time`,{dateTime:t,title:sn(t),children:n}),r===void 0?null:(0,G.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function pn({ts:e}){let t=ln(e),n=Y(e);if(t===void 0||n===void 0)return null;let r=on.format(n);return(0,G.jsxs)(`div`,{"data-slot":`day-separator`,role:`separator`,"aria-label":t===`Today`||t===`Yesterday`?`${t}, ${r}`:r,className:`flex items-center gap-3 py-1 text-xs font-medium text-soft-foreground`,children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,G.jsx)(`time`,{dateTime:cn(e),title:r,children:t}),(0,G.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}var mn={assistant:`Agent message`,error:`Runner error`,"session.error":`Session error`,"step-end":`Step status`,lifecycle:`Run status`};function hn({note:e}){return e.icon===`handoff`?(0,G.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,"data-icon":`handoff`,className:`flex items-start gap-2 px-0.5 text-xs text-muted-foreground`,children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`mt-[-1px] flex size-5 shrink-0 items-center justify-center rounded-full border border-border text-success`,children:(0,G.jsx)(Ae,{className:`size-3`})}),(0,G.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}):e.details&&e.details.length>0?(0,G.jsxs)(B,{"data-slot":`note-line`,"data-tone":e.tone,className:`group/failure min-w-0 px-0.5 text-xs`,children:[(0,G.jsxs)(`div`,{className:a(`flex items-start gap-2`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap wrap-anywhere`,children:[e.tone===`danger`?`✗ `:null,e.text]}),(0,G.jsxs)(z,{"data-slot":`note-details-toggle`,className:`inline-flex shrink-0 items-center gap-1 rounded-sm px-1.5 py-0.5 text-xs font-medium text-muted-foreground hover:bg-muted/50 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 max-md:min-w-11 max-md:justify-center pointer-coarse:min-h-11 pointer-coarse:min-w-11 pointer-coarse:justify-center`,children:[(0,G.jsx)(N,{"aria-hidden":`true`,className:`size-3 shrink-0 motion-safe:transition-transform group-data-[state=open]/failure:rotate-90`}),`Details`]})]}),(0,G.jsx)(R,{children:(0,G.jsx)(`ul`,{"data-slot":`note-details`,className:`mbs-1.5 flex flex-col gap-1 border-s border-border ps-3 font-mono text-xs text-muted-foreground`,children:e.details.map((e,t)=>(0,G.jsxs)(`li`,{className:`min-w-0 whitespace-pre-wrap wrap-anywhere`,children:[(0,G.jsxs)(`span`,{className:`font-sans font-medium text-foreground`,children:[mn[e.source],`:`,` `]}),e.text]},`${e.source}:${t}`))})})]}):(0,G.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:a(`px-0.5 text-xs`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:null,e.text]})}var gn={user:{label:`YOUR MESSAGE`,speaker:`Your message`,classes:`border-message-user-border bg-message-user-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-user-accent`,accent:`text-message-user-accent`,body:`max-md:text-[12px]`},agent:{label:`AGENT RESPONSE`,speaker:`Agent response`,classes:`border-message-agent-border bg-message-agent-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-agent-accent`,accent:`text-message-agent-accent`,body:`text-[15px] md:text-[14px]`}};function Q({role:e,children:t,className:n,ts:r,headerActions:i,...o}){let s=gn[e],c=r===void 0?void 0:X(r);return(0,G.jsxs)(`article`,{...o,"data-role":e,"aria-label":s.speaker,className:a(`flex w-full min-w-0 flex-col gap-2 self-stretch rounded-[8px] border p-3 md:px-4 md:py-[14px]`,s.classes,n),children:[(0,G.jsxs)(`p`,{className:a(`m-0 flex w-full min-w-0 items-start gap-2 text-xs leading-[1.2] font-semibold tracking-[0.6px] uppercase`,s.accent),children:[(0,G.jsxs)(`span`,{className:`inline-flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1 normal-case tracking-normal`,children:[(0,G.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 uppercase tracking-[0.6px]`,children:[(0,G.jsx)(ue,{"aria-hidden":`true`,className:`size-4 shrink-0`}),s.label]}),i]}),c===void 0?null:(0,G.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,G.jsx)(dn,{ts:r})})]}),(0,G.jsx)(`div`,{className:a(`min-w-0 break-words text-[14px] text-foreground select-text [overflow-wrap:anywhere]`,s.body,`leading-[1.6]`),children:t})]})}var _n=[],vn=(0,W.memo)(function({text:e,imageCount:t=0,images:n=_n,ts:i,onEdit:a,onRemove:o,editLabel:s=`Edit message`,removeLabel:c=`Remove message`,children:l}){let u=t-n.length,[d,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(e),[h,g]=(0,W.useState)(!1),[_,v]=(0,W.useState)(),y=()=>{m(e),v(void 0),f(!0)},x=async()=>{let t=p.trim();if(!t||t===e){f(!1);return}g(!0),v(void 0);try{await a?.(t),f(!1)}catch(e){v(e instanceof Error?e.message:`Could not save the message`)}finally{g(!1)}},S=async()=>{g(!0),v(void 0);try{await o?.()}catch(e){v(e instanceof Error?e.message:`Could not remove the message`)}finally{g(!1)}};return d?(0,G.jsxs)(Q,{role:`user`,ts:i,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,G.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),f(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),x())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[14px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,G.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>f(!1),disabled:h,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm px-2 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>void x(),disabled:h,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm bg-action px-2 text-xs font-semibold text-action-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:h?(0,G.jsx)(I,{className:`size-3.5 animate-spin`}):`Save`})]}),_?(0,G.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:_}):null]}):(0,G.jsxs)(Q,{role:`user`,ts:i,"data-slot":`user-bubble`,className:`group`,children:[a||o?(0,G.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[a?(0,G.jsx)(`button`,{type:`button`,"aria-label":s,onClick:y,disabled:h,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,G.jsx)(qe,{className:`size-3.5`})}):null,o?(0,G.jsx)(`button`,{type:`button`,"aria-label":c,onClick:()=>void S(),disabled:h,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,G.jsx)(j,{className:`size-3.5`})}):null]}):null,_?(0,G.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:_}):null,l??(0,G.jsx)(H,{breaks:!0,children:e}),n.length>0?(0,G.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>b(e.split(`/`).pop()??``)?(0,G.jsx)(Ie,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,G.jsxs)(`a`,{href:r(e),download:!0,"data-slot":`user-file`,className:`inline-flex min-h-11 min-w-11 max-w-[220px] items-center gap-1.5 rounded-md border border-border bg-background/60 px-2 py-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,G.jsx)(A,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,G.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,u>0?(0,G.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[u,` image`,u>1?`s`:``,` attached`]}):null]})}),yn=`inline-flex h-11 min-w-11 items-center justify-center gap-1 rounded-sm px-2 text-xs font-medium text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,bn=[`[data-streamdown="code-block-actions"]`,`[data-streamdown="code-copy-button"]`,`[data-streamdown="code-block-copy-button"]`,`[data-streamdown="code-block-header"]`].join(`,`);function xn(e,t){let n=e.cloneNode(!0);n.querySelectorAll(bn).forEach(e=>e.remove());let r=vt(t);return[...n.querySelectorAll(`button[data-streamdown="link"]`)].forEach(e=>{let t=e.textContent??``,i=r.findIndex(e=>e.label===t);if(i<0)return;let a=r.splice(i,1)[0];if(!a||!J(a.href))return;let o=n.ownerDocument.createElement(`a`);o.setAttribute(`href`,a.href),o.setAttribute(`data-streamdown`,`link`),o.textContent=e.textContent,e.replaceWith(o)}),n.innerHTML}async function Sn(e,t,n){if(e===`markdown`){if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(t);return}if(!navigator.clipboard?.write||typeof ClipboardItem>`u`||!n)throw Error(`Clipboard unavailable`);let r=xn(n,t);await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([r],{type:`text/html`}),"text/plain":new Blob([t],{type:`text/plain`})})])}var Cn=(0,W.memo)(function({text:e,ts:t,messageKey:n}){let r=(0,W.useRef)(null),[i,a]=(0,W.useState)(null),[o,s]=(0,W.useState)(null),c=(0,W.useRef)(null);(0,W.useEffect)(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]);let l=async t=>{c.current!==null&&clearTimeout(c.current),a(null),s(null);try{await Sn(t,e,r.current),a(t),c.current=setTimeout(()=>a(null),2e3)}catch{s(`Couldn't copy to the clipboard`)}};return(0,G.jsxs)(Q,{role:`agent`,ts:t,"data-slot":`assistant-message`,headerActions:(0,G.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`flex items-center gap-0.5`,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply`,onClick:()=>void l(`html`),className:yn,children:[(0,G.jsx)(ae,{className:`size-3.5`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{"aria-live":`polite`,children:i===`html`?`Copied`:`Copy`})]}),(0,G.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply as markdown`,onClick:()=>void l(`markdown`),className:yn,children:[(0,G.jsx)(De,{className:`size-3.5`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{"aria-live":`polite`,children:i===`markdown`?`Copied`:`Copy markdown`})]})]}),children:[o?(0,G.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:o}):null,(0,G.jsx)(`div`,{ref:r,children:(0,G.jsx)(H,{breaks:!0,children:e})}),(0,G.jsx)(Ct,{text:e,messageKey:n})]})});function wn({incident:e}){let t=g().data;if(!t)return null;let n=d(t,e.provider);return(0,G.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,G.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,n,` authorization`]}),(0,G.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,n,` settings before retrying.`]}),(0,G.jsx)(V,{to:`/settings/agent-defaults#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}var Tn=(0,W.memo)(function({text:e}){let t=(0,W.useId)();if(e.trim()===``)return null;let n=e.split(`
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{n as r,t as i}from"./utils-DSMR_WLb.js";import{Ct as a,G as o,H as s,K as c,St as l,U as u,W as d,Wt as f,Y as p,dn as m,f as h,ln as g,lt as _,rn as v,rt as ee,tt as y,un as te,xt as b,yt as ne}from"./queries-EvENG6TN.js";import{An as re,Fn as ie,It as ae,Lt as x,cr as oe,hi as se,n as S,or as C,tt as w,ut as ce,yr as le}from"./toaster-Cer2NOxt.js";import{a as ue,d as de,f as fe,g as T,m as pe,o as me,p as he,s as ge}from"./tasks-table-DGBiE6ux.js";import{F as _e,at as ve,ft as ye,i as be,l as xe,p as Se,q as Ce,t as we,v as E,x as Te}from"./design-icons-CzEoMH9c.js";import{t as D}from"./createLucideIcon-BHp8sXmF.js";import{t as Ee}from"./app-window-CSHwDX9N.js";import{n as De,r as Oe,t as ke}from"./open-in-menu-C09BLcfQ.js";import{t as Ae}from"./info-DA1x_4bz.js";import{t as je}from"./message-square-B-MD-8rD.js";import{i as Me,n as Ne,t as O}from"./reference-chip-BLHAGMsc.js";import{t as Pe}from"./square-terminal-B6RYYieR.js";import{t as k}from"./button-B7MKxYjT.js";import{a as A,i as j,l as M,n as N,p as P,r as F,t as I}from"./dropdown-menu-4e2iKSMT.js";import{i as Fe,r as Ie,t as Le}from"./popover-CZV6tz9i.js";import{a as Re,i as ze,o as Be,r as Ve,s as He,t as Ue}from"./dialog-B531GGAo.js";import{c as We,s as Ge,t as L}from"./project-router-BypHPat0.js";import"./attention-wzzAdp4t.js";import{T as Ke,f as R,u as qe}from"./task-groups-nvRvmVHf.js";import{t as Je}from"./status-dot-BRzVlF2X.js";import{t as Ye}from"./format-BU7D3IfE.js";import{$t as Xe,Dn as Ze,Gt as z,Hn as Qe,Ht as B,Jt as V,Kt as H,L as $e,R as U,Un as et,Ut as tt,Vt as nt,Wn as rt,Wt as it,Zt as at,_n as ot,a as st,ar as ct,cn as W,er as lt,m as ut,o as dt,pr as ft,qt as pt,r as G,rn as mt,sn as K,tr as ht,yn as q,z as gt}from"./index-BSZD2aai.js";import{t as _t}from"./markdown-BZgLow5j.js";import{t as vt}from"./textarea-vJt9undk.js";import{t as yt}from"./task-file-scope-BEi9o8Ur.js";import{t as J}from"./tab-link-Bjo_gEiX.js";var bt=D(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),xt=D(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),St=D(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),Y=e(t(),1),X=n();function Ct(e){let t=_();return m({mutationFn:t=>w(te(e),t),onSuccess:()=>t.invalidateAfter(`runs`,()=>g()),onError:e=>S(e.message,{tone:`danger`})})}function wt(e){return e.archived?`Unarchive`:`Archive task`}function Tt({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,X.jsx)(nt,{open:t,onOpenChange:n,children:(0,X.jsxs)(it,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,X.jsxs)(pt,{children:[(0,X.jsx)(V,{children:`Archive task?`}),(0,X.jsxs)(z,{children:[`Move “`,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,title:R(e),children:R(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,X.jsxs)(H,{children:[(0,X.jsx)(tt,{children:`Cancel`}),(0,X.jsx)(B,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function Et({run:e,className:t}){let[n,r]=(0,Y.useState)(!1),a=Ct(e.id),o=wt(e);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(k,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":o,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:a.isPending,className:i(`h-11 gap-[7px] px-3`,t),onClick:()=>e.archived?a.mutate(!1):r(!0),children:[e.archived?(0,X.jsx)(ft,{"aria-hidden":`true`}):(0,X.jsx)(we,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:o})]}),(0,X.jsx)(Tt,{run:e,open:n,onOpenChange:r,onConfirm:()=>{a.mutate(!0),r(!1)}})]})}function Dt({run:e,action:t,prUrl:n,patch:i}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:t.phase===`blocked`?`Completion blocked`:`Completion pending`}),` · `,t.message||(t.phase===`blocked`?`Completion needs attention.`:`Checking completion actions.`)]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&r(n)?(0,X.jsx)(k,{variant:`outline`,asChild:!0,children:(0,X.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:`Open PR`})}):null,e.autoMergePr?(0,X.jsx)(k,{variant:`outline`,disabled:i.isPending,onClick:()=>i.mutate({autoMergePr:!1},{onError:e=>S(e.message,{tone:`danger`})}),children:i.isPending?`Saving…`:`Disable auto-merge`}):null]})]})}function Ot({run:e,blocker:t,flags:n}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:`Archive blocked`}),` · `,t.message]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.runId?(0,X.jsx)(k,{variant:`outline`,asChild:!0,children:(0,X.jsx)(L,{to:`/tasks/${t.runId}`,children:`Open blocking task`})}):null,t.pullRequestUrl&&r(t.pullRequestUrl)?(0,X.jsx)(k,{variant:`outline`,asChild:!0,children:(0,X.jsx)(`a`,{href:t.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,children:`Open blocking PR`})}):null,n.archive?(0,X.jsx)(Et,{run:e}):null]})]})}function kt({run:e}){let t=o(e.id),n=W(e),r=e.status===`done`?e.completionAction:void 0,i=n.archive?e.archiveBlocker:void 0,a=r&&r.phase!==`complete`?r:void 0;if(!a&&!i)return null;let s=e.pullRequestUrl??e.pullRequests?.find(e=>e.url)?.url;return(0,X.jsxs)(`section`,{"data-slot":`completion-status`,"aria-label":`Completion action`,className:`grid min-w-0 gap-2 rounded-lg border border-card-edge bg-card p-3 shadow-card [margin-block:0.75rem]`,children:[a?(0,X.jsx)(Dt,{run:e,action:a,prUrl:s,patch:t}):null,i?(0,X.jsx)(Ot,{run:e,blocker:i,flags:n}):null]})}var At=[`running`,`queued`,`waiting`];function jt(e,{queuePosition:t,now:n=new Date}){let r=re(e),i=Ze(e,r).label,a=t===void 0?i:`${i} #${t}`,o=At.includes(e.status)?Nt(e,n):void 0;return o?{attention:r,label:a,nextCheck:o}:{attention:r,label:a}}function Mt(e){return e.nextCheck?`${e.label} · Next check ${e.nextCheck.text}`:e.label}function Nt(e,t){let n;for(let t of Array.isArray(e.waits)?e.waits:[]){if(t?.kind!==`timer`||t.phase!==`open`)continue;let e=new Date(t.deadline);Number.isFinite(e.getTime())&&(!n||e<n)&&(n=e)}if(n)return{at:n.toISOString(),text:Ye(n,t)}}async function Z(e,t){try{await navigator.clipboard.writeText(e),S(t)}catch{S(`Run manually: ${e}`)}}function Pt(e){let t=b(),n=h(),r=(0,Y.useMemo)(()=>T(e,t),[e,t]);return{referenceProjectId:n,repoBase:t,references:r,requests:(0,Y.useMemo)(()=>n===void 0?[]:r.filter(e=>ue(e,t)).map(e=>({projectId:n,kind:e.kind,number:e.number})),[r,n,t])}}function Ft(e){return m({mutationFn:()=>x(e.id),onError:e=>{if(e instanceof ie&&e.command){Z(e.command,`No terminal found — command copied to clipboard.`);return}S(e.message,{tone:`danger`})}})}function Q(e,t){let n=d(),r=a(),i=v(),o=m({mutationFn:t=>ae(e.id,t),onError:e=>S(e.message,{tone:`danger`})}),s=ot(),c=Ke(e),l=s.runnersOn(e=>t&&c.sessionId!==void 0&&e===c.backend?c.profileId??`default`:s.repoAccount?.[e]).runners,u=e=>!r.isSuccess||!i.isSuccess||l.includes(e??`claude`);return{canResumeHere:t&&u(mt(e)),choices:e.worktreePath?(n.data?.targets??[]).filter(e=>{let t=De(e.id);return t===void 0||i.isSuccess&&u(t)}).map(t=>({target:t,...Xe(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[],open:o}}function It({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Q(e,t),o=v().data,s=K(e);return!r&&i.length===0&&!s?null:(0,X.jsxs)(X.Fragment,{children:[r||i.length>0?(0,X.jsxs)(`div`,{className:`task-open-targets flex flex-wrap gap-3`,children:[r?(0,X.jsxs)(k,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,X.jsx)(Pe,{}),`Terminal (resume session)`]}):null,i.map(({target:e,suffix:t,title:n})=>{let r=Oe(e,o);return(0,X.jsxs)(k,{variant:`outline`,"data-target":e.id,title:n,disabled:a.isPending,onClick:()=>a.mutate(e.id),children:[(0,X.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,X.jsxs)(k,{variant:`outline`,onClick:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>S(`Worktree path copied`)).catch(()=>S(`Path: ${t}`))},children:[(0,X.jsx)(E,{}),`Copy worktree path`]}):null]}):null,s?(0,X.jsxs)(`div`,{"data-slot":`resume-command`,className:`mt-5 border-t border-border pt-5`,children:[(0,X.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,X.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:s}),(0,X.jsxs)(k,{variant:`outline`,onClick:()=>void Z(s,`Command copied to clipboard.`),children:[(0,X.jsx)(E,{}),`Copy resume command`]})]}):null]})}function Lt({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Q(e,t),o=K(e),s=e.worktreePath;if(!r&&i.length===0&&!o&&!s)return null;let c=`max-md:min-h-11`;return(0,X.jsxs)(`div`,{"data-slot":`workspace-tools`,className:`flex min-w-0 flex-wrap gap-2`,children:[r||i.length>0?(0,X.jsx)(ke,{choices:i,onPick:e=>a.mutate(e),disabled:a.isPending,triggerVariant:`outline`,className:c,leading:r?(0,X.jsxs)(j,{"data-target":`terminal-resume`,onSelect:n,children:[(0,X.jsx)(Pe,{"aria-hidden":`true`}),`Terminal (resume session)`]}):void 0}):null,s?(0,X.jsxs)(k,{variant:`outline`,size:`sm`,className:c,onClick:()=>void Z(s,`Worktree path copied`),children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Copy worktree path`]}):null,o?(0,X.jsxs)(k,{variant:`outline`,size:`sm`,"data-slot":`resume-command`,title:o,className:c,onClick:()=>void Z(o,`Command copied to clipboard.`),children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Copy resume command`]}):null]})}function Rt({run:e,canResume:t,onResume:n,onOpen:r,onClose:i}){let{canResumeHere:a,choices:o}=Q(e,t);return!a&&o.length===0?null:r?(0,X.jsx)(j,{onSelect:r,children:`Open in…`}):(0,X.jsxs)(`section`,{"aria-label":`Open task worktree in…`,className:`task-action-panel my-5 rounded-xl border border-border bg-card p-6`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,X.jsx)(k,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,X.jsx)(ye,{})})]}),e.worktreePath?(0,X.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,X.jsx)(`div`,{className:`mt-4`,children:(0,X.jsx)(It,{run:e,canResume:t,onResume:n})})]})}function zt({branch:e}){let[t,n]=(0,Y.useState)(null),r=(0,Y.useRef)(null);(0,Y.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);let i=t===e,a=async()=>{r.current!==null&&clearTimeout(r.current),n(null);try{if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(e),n(e),r.current=setTimeout(()=>n(null),2e3)}catch{S(`Could not copy branch. Select and copy: ${e}`)}};return(0,X.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,children:[(0,X.jsx)(`span`,{"data-slot":`branch-chip`,className:`min-w-0 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-xs font-medium break-all`,children:e}),(0,X.jsxs)(`button`,{type:`button`,"aria-label":i?`Copied branch name`:`Copy branch name`,onClick:()=>void a(),className:`inline-flex min-h-11 shrink-0 items-center gap-1 rounded-sm px-2 text-xs font-medium text-foreground hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground md:min-h-8`,children:[(0,X.jsx)(E,{className:`size-3.5`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{"aria-live":`polite`,children:i?`Copied`:`Copy`})]})]})}function Bt({run:e}){let t=b(),n=h(),i=r=>n===void 0?void 0:fe(n,e.id,r,t),a=(0,Y.useMemo)(()=>T(e,t),[e,t]),o=[],s=[],c=a.filter(e=>e.kind===`PR`);for(let t of c)o.push((0,X.jsx)(O,{reference:t,to:i(t),taskTitle:R(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`,conflictAction:(0,X.jsx)(at,{run:e,prNumber:t.number})},ge(t)));let l=pe(e);l&&r(l)&&!c.some(e=>e.url===l)&&o.push((0,X.jsx)(O,{reference:{kind:`PR`,url:l},taskTitle:R(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`pr`));let u=a.filter(e=>e.kind===`Issue`);for(let t of u)s.push((0,X.jsx)(O,{reference:t,to:i(t),taskTitle:R(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},ge(t)));let d=de(e,t);if(d&&r(d)&&!u.some(e=>e.url===d)){let t=me(d);s.push((0,X.jsx)(O,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:d},to:t?i({kind:`Issue`,number:Number(t),url:d}):void 0,taskTitle:R(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`issue`))}return o.length===0&&s.length===0?null:(0,X.jsx)(`div`,{"data-slot":`linked-references`,className:`flex min-w-0 flex-col gap-3`,children:[[`PR`,`PRs`,o],[`Issue`,`Issues`,s]].map(([e,t,n])=>n.length>0?(0,X.jsxs)(`div`,{"data-reference-kind":e,className:`grid min-w-0 grid-cols-[5rem_minmax(0,1fr)] items-center gap-x-2 gap-y-1`,children:[(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,X.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:n})]},e):null)})}function Vt(){let e=Ge(),t=l();return $e(t.data?.projects?.find(n=>n.id===(e??t.data?.bootProject)))}var Ht=e=>e.map(e=>`${e.name}: ${U(e.url)}`).join(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{n as r,t as i}from"./utils-DSMR_WLb.js";import{Ct as a,G as o,H as s,K as c,St as l,U as u,W as d,Wt as f,Y as p,dn as m,f as h,ln as g,lt as _,rn as v,rt as ee,tt as y,un as te,xt as b,yt as ne}from"./queries-EvENG6TN.js";import{An as re,Fn as ie,It as ae,Lt as x,cr as oe,hi as se,n as S,or as C,tt as w,ut as ce,yr as le}from"./toaster-Cer2NOxt.js";import{a as ue,d as de,f as fe,g as T,m as pe,o as me,p as he,s as ge}from"./tasks-table-DGBiE6ux.js";import{F as _e,at as ve,ft as ye,i as be,l as xe,p as Se,q as Ce,t as we,v as E,x as Te}from"./design-icons-CzEoMH9c.js";import{t as D}from"./createLucideIcon-BHp8sXmF.js";import{t as Ee}from"./app-window-CSHwDX9N.js";import{n as De,r as Oe,t as ke}from"./open-in-menu-C09BLcfQ.js";import{t as Ae}from"./info-DA1x_4bz.js";import{t as je}from"./message-square-B-MD-8rD.js";import{i as Me,n as Ne,t as O}from"./reference-chip-BLHAGMsc.js";import{t as Pe}from"./square-terminal-B6RYYieR.js";import{t as k}from"./button-B7MKxYjT.js";import{a as A,i as j,l as M,n as N,p as P,r as F,t as I}from"./dropdown-menu-4e2iKSMT.js";import{i as Fe,r as Ie,t as Le}from"./popover-CZV6tz9i.js";import{a as Re,i as ze,o as Be,r as Ve,s as He,t as Ue}from"./dialog-B531GGAo.js";import{c as We,s as Ge,t as L}from"./project-router-BypHPat0.js";import"./attention-wzzAdp4t.js";import{T as Ke,f as R,u as qe}from"./task-groups-nvRvmVHf.js";import{t as Je}from"./status-dot-BRzVlF2X.js";import{t as Ye}from"./format-BU7D3IfE.js";import{$t as Xe,Dn as Ze,Gt as z,Hn as Qe,Ht as B,Jt as V,Kt as H,L as $e,R as U,Un as et,Ut as tt,Vt as nt,Wn as rt,Wt as it,Zt as at,_n as ot,a as st,ar as ct,cn as W,er as lt,m as ut,o as dt,pr as ft,qt as pt,r as G,rn as mt,sn as K,tr as ht,yn as q,z as gt}from"./index-BhB5uLZf.js";import{t as _t}from"./markdown-DBT-WT_u.js";import{t as vt}from"./textarea-vJt9undk.js";import{t as yt}from"./task-file-scope-DM9imAKF.js";import{t as J}from"./tab-link-Bjo_gEiX.js";var bt=D(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),xt=D(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),St=D(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),Y=e(t(),1),X=n();function Ct(e){let t=_();return m({mutationFn:t=>w(te(e),t),onSuccess:()=>t.invalidateAfter(`runs`,()=>g()),onError:e=>S(e.message,{tone:`danger`})})}function wt(e){return e.archived?`Unarchive`:`Archive task`}function Tt({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,X.jsx)(nt,{open:t,onOpenChange:n,children:(0,X.jsxs)(it,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,X.jsxs)(pt,{children:[(0,X.jsx)(V,{children:`Archive task?`}),(0,X.jsxs)(z,{children:[`Move “`,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,title:R(e),children:R(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,X.jsxs)(H,{children:[(0,X.jsx)(tt,{children:`Cancel`}),(0,X.jsx)(B,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function Et({run:e,className:t}){let[n,r]=(0,Y.useState)(!1),a=Ct(e.id),o=wt(e);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(k,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":o,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:a.isPending,className:i(`h-11 gap-[7px] px-3`,t),onClick:()=>e.archived?a.mutate(!1):r(!0),children:[e.archived?(0,X.jsx)(ft,{"aria-hidden":`true`}):(0,X.jsx)(we,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:o})]}),(0,X.jsx)(Tt,{run:e,open:n,onOpenChange:r,onConfirm:()=>{a.mutate(!0),r(!1)}})]})}function Dt({run:e,action:t,prUrl:n,patch:i}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:t.phase===`blocked`?`Completion blocked`:`Completion pending`}),` · `,t.message||(t.phase===`blocked`?`Completion needs attention.`:`Checking completion actions.`)]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&r(n)?(0,X.jsx)(k,{variant:`outline`,asChild:!0,children:(0,X.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:`Open PR`})}):null,e.autoMergePr?(0,X.jsx)(k,{variant:`outline`,disabled:i.isPending,onClick:()=>i.mutate({autoMergePr:!1},{onError:e=>S(e.message,{tone:`danger`})}),children:i.isPending?`Saving…`:`Disable auto-merge`}):null]})]})}function Ot({run:e,blocker:t,flags:n}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:`Archive blocked`}),` · `,t.message]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.runId?(0,X.jsx)(k,{variant:`outline`,asChild:!0,children:(0,X.jsx)(L,{to:`/tasks/${t.runId}`,children:`Open blocking task`})}):null,t.pullRequestUrl&&r(t.pullRequestUrl)?(0,X.jsx)(k,{variant:`outline`,asChild:!0,children:(0,X.jsx)(`a`,{href:t.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,children:`Open blocking PR`})}):null,n.archive?(0,X.jsx)(Et,{run:e}):null]})]})}function kt({run:e}){let t=o(e.id),n=W(e),r=e.status===`done`?e.completionAction:void 0,i=n.archive?e.archiveBlocker:void 0,a=r&&r.phase!==`complete`?r:void 0;if(!a&&!i)return null;let s=e.pullRequestUrl??e.pullRequests?.find(e=>e.url)?.url;return(0,X.jsxs)(`section`,{"data-slot":`completion-status`,"aria-label":`Completion action`,className:`grid min-w-0 gap-2 rounded-lg border border-card-edge bg-card p-3 shadow-card [margin-block:0.75rem]`,children:[a?(0,X.jsx)(Dt,{run:e,action:a,prUrl:s,patch:t}):null,i?(0,X.jsx)(Ot,{run:e,blocker:i,flags:n}):null]})}var At=[`running`,`queued`,`waiting`];function jt(e,{queuePosition:t,now:n=new Date}){let r=re(e),i=Ze(e,r).label,a=t===void 0?i:`${i} #${t}`,o=At.includes(e.status)?Nt(e,n):void 0;return o?{attention:r,label:a,nextCheck:o}:{attention:r,label:a}}function Mt(e){return e.nextCheck?`${e.label} · Next check ${e.nextCheck.text}`:e.label}function Nt(e,t){let n;for(let t of Array.isArray(e.waits)?e.waits:[]){if(t?.kind!==`timer`||t.phase!==`open`)continue;let e=new Date(t.deadline);Number.isFinite(e.getTime())&&(!n||e<n)&&(n=e)}if(n)return{at:n.toISOString(),text:Ye(n,t)}}async function Z(e,t){try{await navigator.clipboard.writeText(e),S(t)}catch{S(`Run manually: ${e}`)}}function Pt(e){let t=b(),n=h(),r=(0,Y.useMemo)(()=>T(e,t),[e,t]);return{referenceProjectId:n,repoBase:t,references:r,requests:(0,Y.useMemo)(()=>n===void 0?[]:r.filter(e=>ue(e,t)).map(e=>({projectId:n,kind:e.kind,number:e.number})),[r,n,t])}}function Ft(e){return m({mutationFn:()=>x(e.id),onError:e=>{if(e instanceof ie&&e.command){Z(e.command,`No terminal found — command copied to clipboard.`);return}S(e.message,{tone:`danger`})}})}function Q(e,t){let n=d(),r=a(),i=v(),o=m({mutationFn:t=>ae(e.id,t),onError:e=>S(e.message,{tone:`danger`})}),s=ot(),c=Ke(e),l=s.runnersOn(e=>t&&c.sessionId!==void 0&&e===c.backend?c.profileId??`default`:s.repoAccount?.[e]).runners,u=e=>!r.isSuccess||!i.isSuccess||l.includes(e??`claude`);return{canResumeHere:t&&u(mt(e)),choices:e.worktreePath?(n.data?.targets??[]).filter(e=>{let t=De(e.id);return t===void 0||i.isSuccess&&u(t)}).map(t=>({target:t,...Xe(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[],open:o}}function It({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Q(e,t),o=v().data,s=K(e);return!r&&i.length===0&&!s?null:(0,X.jsxs)(X.Fragment,{children:[r||i.length>0?(0,X.jsxs)(`div`,{className:`task-open-targets flex flex-wrap gap-3`,children:[r?(0,X.jsxs)(k,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,X.jsx)(Pe,{}),`Terminal (resume session)`]}):null,i.map(({target:e,suffix:t,title:n})=>{let r=Oe(e,o);return(0,X.jsxs)(k,{variant:`outline`,"data-target":e.id,title:n,disabled:a.isPending,onClick:()=>a.mutate(e.id),children:[(0,X.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,X.jsxs)(k,{variant:`outline`,onClick:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>S(`Worktree path copied`)).catch(()=>S(`Path: ${t}`))},children:[(0,X.jsx)(E,{}),`Copy worktree path`]}):null]}):null,s?(0,X.jsxs)(`div`,{"data-slot":`resume-command`,className:`mt-5 border-t border-border pt-5`,children:[(0,X.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,X.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:s}),(0,X.jsxs)(k,{variant:`outline`,onClick:()=>void Z(s,`Command copied to clipboard.`),children:[(0,X.jsx)(E,{}),`Copy resume command`]})]}):null]})}function Lt({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Q(e,t),o=K(e),s=e.worktreePath;if(!r&&i.length===0&&!o&&!s)return null;let c=`max-md:min-h-11`;return(0,X.jsxs)(`div`,{"data-slot":`workspace-tools`,className:`flex min-w-0 flex-wrap gap-2`,children:[r||i.length>0?(0,X.jsx)(ke,{choices:i,onPick:e=>a.mutate(e),disabled:a.isPending,triggerVariant:`outline`,className:c,leading:r?(0,X.jsxs)(j,{"data-target":`terminal-resume`,onSelect:n,children:[(0,X.jsx)(Pe,{"aria-hidden":`true`}),`Terminal (resume session)`]}):void 0}):null,s?(0,X.jsxs)(k,{variant:`outline`,size:`sm`,className:c,onClick:()=>void Z(s,`Worktree path copied`),children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Copy worktree path`]}):null,o?(0,X.jsxs)(k,{variant:`outline`,size:`sm`,"data-slot":`resume-command`,title:o,className:c,onClick:()=>void Z(o,`Command copied to clipboard.`),children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Copy resume command`]}):null]})}function Rt({run:e,canResume:t,onResume:n,onOpen:r,onClose:i}){let{canResumeHere:a,choices:o}=Q(e,t);return!a&&o.length===0?null:r?(0,X.jsx)(j,{onSelect:r,children:`Open in…`}):(0,X.jsxs)(`section`,{"aria-label":`Open task worktree in…`,className:`task-action-panel my-5 rounded-xl border border-border bg-card p-6`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,X.jsx)(k,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,X.jsx)(ye,{})})]}),e.worktreePath?(0,X.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,X.jsx)(`div`,{className:`mt-4`,children:(0,X.jsx)(It,{run:e,canResume:t,onResume:n})})]})}function zt({branch:e}){let[t,n]=(0,Y.useState)(null),r=(0,Y.useRef)(null);(0,Y.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);let i=t===e,a=async()=>{r.current!==null&&clearTimeout(r.current),n(null);try{if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(e),n(e),r.current=setTimeout(()=>n(null),2e3)}catch{S(`Could not copy branch. Select and copy: ${e}`)}};return(0,X.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,children:[(0,X.jsx)(`span`,{"data-slot":`branch-chip`,className:`min-w-0 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-xs font-medium break-all`,children:e}),(0,X.jsxs)(`button`,{type:`button`,"aria-label":i?`Copied branch name`:`Copy branch name`,onClick:()=>void a(),className:`inline-flex min-h-11 shrink-0 items-center gap-1 rounded-sm px-2 text-xs font-medium text-foreground hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground md:min-h-8`,children:[(0,X.jsx)(E,{className:`size-3.5`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{"aria-live":`polite`,children:i?`Copied`:`Copy`})]})]})}function Bt({run:e}){let t=b(),n=h(),i=r=>n===void 0?void 0:fe(n,e.id,r,t),a=(0,Y.useMemo)(()=>T(e,t),[e,t]),o=[],s=[],c=a.filter(e=>e.kind===`PR`);for(let t of c)o.push((0,X.jsx)(O,{reference:t,to:i(t),taskTitle:R(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`,conflictAction:(0,X.jsx)(at,{run:e,prNumber:t.number})},ge(t)));let l=pe(e);l&&r(l)&&!c.some(e=>e.url===l)&&o.push((0,X.jsx)(O,{reference:{kind:`PR`,url:l},taskTitle:R(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`pr`));let u=a.filter(e=>e.kind===`Issue`);for(let t of u)s.push((0,X.jsx)(O,{reference:t,to:i(t),taskTitle:R(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},ge(t)));let d=de(e,t);if(d&&r(d)&&!u.some(e=>e.url===d)){let t=me(d);s.push((0,X.jsx)(O,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:d},to:t?i({kind:`Issue`,number:Number(t),url:d}):void 0,taskTitle:R(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`issue`))}return o.length===0&&s.length===0?null:(0,X.jsx)(`div`,{"data-slot":`linked-references`,className:`flex min-w-0 flex-col gap-3`,children:[[`PR`,`PRs`,o],[`Issue`,`Issues`,s]].map(([e,t,n])=>n.length>0?(0,X.jsxs)(`div`,{"data-reference-kind":e,className:`grid min-w-0 grid-cols-[5rem_minmax(0,1fr)] items-center gap-x-2 gap-y-1`,children:[(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,X.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:n})]},e):null)})}function Vt(){let e=Ge(),t=l();return $e(t.data?.projects?.find(n=>n.id===(e??t.data?.bootProject)))}var Ht=e=>e.map(e=>`${e.name}: ${U(e.url)}`).join(`
2
2
  `);function Ut(e){return Vt().length>0||e.notify===!0}function $({run:e}){let t=Vt(),n=t.length>0,r=u(e.id),[i,a]=(0,Y.useState)(null),o=e.notify===!0;return!n&&!o?null:(0,X.jsxs)(X.Fragment,{children:[o?(0,X.jsxs)(I,{children:[(0,X.jsx)(P,{asChild:!0,children:(0,X.jsxs)(k,{variant:`outline`,size:`sm`,"data-slot":`notifying-chip`,className:`h-11 gap-1.5 md:h-[30px]`,"aria-label":n?`Notifying ${gt(t)} — webhook actions`:`Notifying — webhook actions`,title:n?Ht(t):void 0,children:[(0,X.jsx)(Je,{tone:`success`}),(0,X.jsx)(`span`,{children:`Notifying`}),(0,X.jsx)(xe,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,X.jsxs)(F,{align:`end`,"data-slot":`notifying-menu`,className:`w-[240px] max-w-[calc(100vw-2rem)] p-2`,children:[n?(0,X.jsx)(A,{"data-slot":`notifying-targets`,className:`flex flex-col gap-0.5 px-2 py-1.5 text-xs font-normal text-muted-foreground`,children:t.map(e=>(0,X.jsx)(`span`,{"data-webhook-target":e.id,className:`truncate`,title:U(e.url),children:e.name},e.id))}):null,n?(0,X.jsxs)(j,{className:`min-h-11`,onSelect:()=>a(`note`),children:[(0,X.jsx)(je,{"aria-hidden":`true`}),` Send a note…`]}):null,(0,X.jsxs)(j,{variant:`destructive`,className:`min-h-11`,disabled:r.isPending,onSelect:()=>r.mutate({notify:!1},{onSuccess:()=>S(`Stopped notifying the webhook`),onError:e=>S(`Could not stop notifying. ${e.message}`,{tone:`danger`})}),children:[(0,X.jsx)(bt,{"aria-hidden":`true`}),` Stop notifying`]})]})]}):(0,X.jsxs)(k,{variant:`outline`,size:`sm`,"data-action":`handoff`,className:`size-11 px-0 md:h-[30px] md:w-auto md:px-2.5`,"aria-label":`Hand off to webhook`,onClick:()=>a(`handoff`),children:[(0,X.jsx)(lt,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`max-md:sr-only`,children:`Hand off`})]}),n?(0,X.jsx)(Wt,{mode:i,targets:t,pending:r.isPending,onOpenChange:e=>!e&&a(null),onSubmit:e=>r.mutate({notify:!0,...e?{message:e}:{}},{onSuccess:()=>{a(null),S(i===`note`?`Note sent to the webhook`:`Handed off to the webhook`)},onError:e=>S(`Could not hand off. ${e.message}`,{tone:`danger`})})}):null]})}function Wt({mode:e,targets:t,pending:n,onOpenChange:r,onSubmit:i}){let a=(0,Y.useId)(),o=(0,Y.useId)(),[s,c]=(0,Y.useState)(``);(0,Y.useEffect)(()=>{e!==null&&c(``)},[e]);let l=e===`note`,u=gt(t);return(0,X.jsx)(Ue,{open:e!==null,onOpenChange:e=>{e||c(``),r(e)},children:(0,X.jsx)(Ve,{"data-slot":`handoff-dialog`,className:`max-sm:top-auto max-sm:bottom-0 max-sm:left-0 max-sm:max-w-none max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none max-sm:rounded-t-xl max-sm:border-x-0 max-sm:border-b-0 max-sm:pb-[max(1.5rem,env(safe-area-inset-bottom))] max-sm:data-[state=open]:slide-in-from-bottom max-sm:data-[state=open]:zoom-in-100 max-sm:data-[state=closed]:slide-out-to-bottom max-sm:data-[state=closed]:zoom-out-100`,children:(0,X.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),i(s.trim())},children:[(0,X.jsxs)(Be,{className:`text-left`,children:[(0,X.jsx)(He,{children:l?`Send a note to ${t.length===1?`the webhook`:`the webhooks`}`:`Hand off to webhook`}),(0,X.jsx)(ze,{children:(0,X.jsx)(`span`,{"data-webhook-destination":``,title:Ht(t),children:l?`${u} ${t.length===1?`gets`:`get`} this note with the task's current status.`:`${u} will start receiving this task's status updates. Add a note (optional).`})})]}),(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(`label`,{htmlFor:a,className:`text-[13px] font-medium`,children:`Note`}),(0,X.jsx)(vt,{id:a,"data-slot":`handoff-note`,"aria-describedby":o,rows:4,maxLength:1e5,className:`min-h-24`,placeholder:`e.g. Take over from here, ping me when the PR is green`,value:s,onChange:e=>c(e.target.value)}),(0,X.jsxs)(`p`,{id:o,className:`flex items-center gap-1.5 text-[12px] text-muted-foreground`,children:[(0,X.jsx)(Ae,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`The note goes to the webhook only, not to the agent.`]})]}),(0,X.jsxs)(Re,{className:`gap-2 max-sm:flex-col-reverse max-sm:[&>button]:h-11 max-sm:[&>button]:w-full`,children:[(0,X.jsx)(k,{type:`button`,variant:`ghost`,className:`sm:h-9`,onClick:()=>r(!1),children:`Cancel`}),(0,X.jsxs)(k,{type:`submit`,variant:`contrast`,className:`sm:h-9`,"data-action":`handoff-submit`,disabled:n||l&&s.trim()===``,children:[(0,X.jsx)(lt,{"aria-hidden":`true`}),l?`Send note`:`Hand off`]})]})]})})})}function Gt({id:e}){return(0,X.jsxs)(L,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,"data-slot":`mobile-parent-task-link`,className:`inline-flex shrink-0 items-center justify-center gap-1 rounded-sm px-2 text-[13px] text-muted-foreground [min-block-size:2.75rem] [min-inline-size:2.75rem] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:bg-muted active:text-foreground`,children:[(0,X.jsx)(be,{"aria-hidden":!0,className:`shrink-0 [block-size:1.2cap] [inline-size:auto]`}),`Parent`]})}function Kt({id:e}){let t=p(e),n=t.data?R(t.data):e;return(0,X.jsxs)(`div`,{"data-slot":`parent-task`,className:`flex min-w-0 flex-wrap items-center gap-x-2 text-[13px] text-muted-foreground`,children:[(0,X.jsxs)(L,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,title:`Parent · ${n}`,"data-slot":`parent-task-link`,className:`flex min-h-11 min-w-0 max-w-full items-center gap-2 rounded-sm text-muted-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:text-foreground`,children:[(0,X.jsx)(be,{"aria-hidden":!0,className:`h-[1.2cap] w-auto shrink-0`}),(0,X.jsx)(`span`,{className:`shrink-0`,children:`Parent`}),(0,X.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,X.jsx)(`span`,{className:`min-w-0 overflow-clip text-ellipsis whitespace-nowrap`,children:n})]}),t.isError?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:`Parent record unavailable or deleted`}),(0,X.jsx)(k,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry parent task`})]}):null]})}var qt=3,Jt=(e,t)=>e.kind===t.kind&&e.number===t.number;function Yt(e,t,n=qt){let r=t?e.findIndex(e=>Jt(e,t)):-1;if(e.length<=n||r<n)return{inline:e.slice(0,n),overflow:e.slice(n)};let i=[...e.slice(0,n-1),e[r]];return{inline:i,overflow:e.filter(e=>!i.includes(e))}}var Xt=(e,t)=>`/tasks/${e}/${t.kind}/${t.number}`;function Zt({tab:e}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(e.kind===`pr`?_e:Se,{"aria-hidden":`true`,className:`mr-1 size-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`sr-only`,children:e.kind===`pr`?`Pull request`:`Issue`}),` #`,e.number,(0,X.jsx)(Ne,{kind:e.kind===`pr`?`PR`:`Issue`,number:e.number,className:`ml-1`})]})}function Qt(e,t){let n=e[0],r=e.length+ +!!t;return n?`Preview :${n.port}${r>1?` +${r-1}`:``}`:t?`Preview · agent`:`Preview`}function $t({servers:e}){let t=ut();if(t===null)return null;let n=t.agentLive===!0,r=e[0],i=e.length+ +!!n===1?r?{port:r.port}:{agent:!0}:{};return(0,X.jsxs)(k,{variant:`outline`,size:`sm`,"data-slot":`preview-toggle`,className:`max-md:h-11`,"aria-pressed":t.open,onClick:()=>t.openPane(i),children:[(0,X.jsx)(Ee,{"aria-hidden":`true`}),Qt(e,n),t.live?(0,X.jsx)(Je,{tone:`success`,"aria-label":`Preview is live`}):null]})}function en(e){return e?.role===`worker`?`Worker session`:e?.role===`root`?`Parent session`:`Task session`}function tn({run:e,compact:t=!1}){if(e.delegation?.role!==`worker`)return null;let n=e.delegation.supervisorRunId??e.delegation.parentRunId;return t?(0,X.jsx)(Gt,{id:n}):(0,X.jsx)(Kt,{id:n})}function nn({isDesktop:e,desktopActivitySlot:t,attention:n,statusLine:r}){return e&&t?(0,X.jsx)(X.Fragment,{children:t}):(0,X.jsx)(G,{dot:n.tone,shape:n.shape,pulse:n.pulse,className:`max-md:hidden`,children:Mt(r)})}function rn(e,t,n){return n&&!e.archiveBlocker&&t.archive?(0,X.jsx)(Et,{run:e}):null}function an({archived:e,className:t}){return e?(0,X.jsx)(G,{"data-slot":`run-archived-pill`,dot:q.tone,shape:q.shape,className:t,children:q.label}):null}function on({run:e}){return e.archived&&e.autoArchive?.reason===`pull-requests-merged`&&e.autoArchive.archivedAt===e.archivedAt?(0,X.jsx)(`p`,{"data-slot":`auto-archive-reason`,className:`text-[13px] text-muted-foreground`,children:`Archived automatically after all associated PRs merged.`}):null}function sn({shown:e,run:t,previewToggle:n}){let r=Ut(t);return e&&(n||r)?(0,X.jsxs)(`div`,{"data-slot":`run-mobile-actions`,className:`flex flex-wrap items-center gap-2 pt-2`,children:[n,(0,X.jsx)($,{run:t})]}):null}function cn({isDesktop:e,phoneBar:t,run:n,previewToggle:r,mobileActivitySlot:a}){let o=Ut(n);if(e||!a)return null;let s=t&&(!!r||o);return(0,X.jsxs)(`div`,{"data-slot":s?`run-mobile-actions`:void 0,"data-mobile-session-bar":t||void 0,className:i(`flex flex-wrap items-center gap-2 md:hidden`,t&&`border-t border-border py-1`),children:[a,s?(0,X.jsxs)(`span`,{className:`ms-auto flex shrink-0 flex-wrap items-center gap-2`,children:[r,(0,X.jsx)($,{run:n})]}):null]})}function ln({run:e,tab:t,activeItem:n,inlineItemTabs:r,overflowItemTabs:a,phoneBar:o,isDesktop:s}){let c=(0,Y.useRef)(null),l=n?`${n.kind}#${n.number}`:null;return(0,Y.useEffect)(()=>{!l||s||c.current?.querySelector(`[aria-current="page"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[l,r.map(e=>`${e.kind}#${e.number}`).join(`,`),s]),(0,X.jsxs)(`div`,{ref:c,"data-slot":`run-tabs`,"data-phone-bar":o||void 0,className:i(`flex flex-wrap items-end gap-1 border-b border-border md:mt-5 max-md:flex-nowrap max-md:overflow-x-auto max-md:border-b-0 max-md:shadow-[inset_0_-1px_0_var(--border)] max-md:gap-0 max-md:[&>*]:mb-0 max-md:[&>*]:shrink-0 max-md:[&>a]:min-h-11 max-md:[&>a]:px-3.5 max-md:[&>a]:text-[13.5px]`,o?`mt-0`:`mt-3`),children:[(0,X.jsx)(J,{to:`/tasks/${e.id}`,active:t===`session`,replace:o,children:`Session`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/changes`,active:t===`changes`,replace:o,count:e.diffStat&&e.diffStat.files>0?e.diffStat.files:void 0,children:`Changes`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/commits`,active:t===`commits`,replace:o,children:`Commits`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/files`,active:t===`files`,replace:o,children:`Files`}),r.map(t=>(0,X.jsx)(J,{to:Xt(e.id,t),active:n!==null&&Jt(t,n),replace:o,children:(0,X.jsx)(Zt,{tab:t})},`${t.kind}-${t.number}`)),a.length>0?(0,X.jsxs)(I,{children:[(0,X.jsxs)(P,{"data-slot":`run-tabs-more`,"aria-label":`${a.length} more linked items`,className:`-mb-px flex h-8 items-center rounded-t-md border-b-2 border-transparent px-3 text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground max-md:min-h-11 max-md:px-3.5 max-md:text-[13.5px]`,children:[`+`,a.length]}),(0,X.jsx)(F,{align:`end`,children:a.map(t=>(0,X.jsx)(j,{asChild:!0,children:(0,X.jsx)(L,{to:Xt(e.id,t),replace:o,children:(0,X.jsx)(Zt,{tab:t})})},`${t.kind}-${t.number}`))})]}):null]})}function un({run:e,tab:t=`session`,onMarkedUnread:n,desktopActivitySlot:r,mobileActivitySlot:a}){let o=re(e),s=W(e),[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(!1),f=dn(e,n),p=ee(),m=ne(),h=jt(e,{queuePosition:e.status===`queued`?qe(p.data??[]).get(e.id):void 0}),g=rt(),_=et(),v=g!==null&&!_?g:null,y=v!==null,{referenceProjectId:te,repoBase:b,requests:ie}=Pt(e),ae=(0,Y.useMemo)(()=>he(e,b),[e,b]),x=typeof t==`object`?t:null,{inline:oe,overflow:se}=Yt(ae,x),S=m.data?.capabilities?.preview===!0,C=e.worktreePath&&S?(0,X.jsx)($t,{servers:e.previewServers??[]}):null,w=(0,X.jsx)(hn,{run:e,actions:f,onOpenChooser:()=>d(!0),onToggleNotes:()=>l(e=>!e)}),ce=rn(e,s,_);return(0,X.jsx)(Me,{projectId:te,repoBase:b,requests:ie,children:(0,X.jsxs)(`header`,{"data-slot":`run-header`,"data-sticky":t===`session`||void 0,className:i(`relative z-20 shrink-0 bg-background px-4 md:px-9 md:pt-7`,y?`pt-0`:`pt-[18px]`,t===`session`&&`border-b border-border`),children:[(0,X.jsx)(on,{run:e}),(0,X.jsx)(kt,{run:e}),(0,X.jsxs)(`div`,{className:`w-full`,children:[(0,X.jsx)(tn,{run:e}),v?(0,X.jsxs)(Qe,{slot:v,children:[(0,X.jsx)(mn,{run:e,status:(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(G,{"data-slot":`mobile-run-status`,dot:o.tone,shape:o.shape,pulse:o.pulse,className:`max-w-full self-start truncate px-2 py-px text-xs leading-4`,children:h.label}),(0,X.jsx)(an,{archived:e.archived,className:`px-2 py-px text-xs leading-4`})]})}),(0,X.jsx)(tn,{run:e,compact:!0}),w]}):(0,X.jsxs)(`div`,{"data-slot":`run-title-row`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 md:flex-nowrap`,children:[(0,X.jsx)(`p`,{"data-slot":`session-kind`,className:`text-[12px] font-semibold tracking-[0.14em] text-muted-foreground uppercase md:hidden`,children:en(e.delegation)}),(0,X.jsx)(pn,{run:e}),(0,X.jsx)(nn,{isDesktop:_,desktopActivitySlot:r,attention:o,statusLine:h}),(0,X.jsx)(an,{archived:e.archived,className:`max-md:hidden`}),(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[ce,C,(0,X.jsx)($,{run:e}),w]})]}),(0,X.jsx)(sn,{shown:v!==null&&!a,run:e,previewToggle:C}),(0,X.jsx)(ln,{run:e,tab:t,activeItem:x,inlineItemTabs:oe,overflowItemTabs:se,phoneBar:y,isDesktop:_}),(0,X.jsx)(cn,{isDesktop:_,phoneBar:y,run:e,previewToggle:C,mobileActivitySlot:a}),c?(0,X.jsx)(vn,{runId:e.id,onClose:()=>l(!1)}):null,u?(0,X.jsx)(Rt,{run:e,canResume:W(e).terminal,onResume:()=>f.terminal.mutate(),onClose:()=>d(!1)}):null]}),(0,X.jsx)(_n,{run:e,actions:f})]})})}function dn(e,t){let n=se(),r=We(),[i,a]=(0,Y.useState)(null),o=()=>n.invalidateQueries({queryKey:f.runs.all}),l=e=>S(e.message,{tone:`danger`}),u=c(),d={isPending:u.isPending,mutate:()=>u.mutate({id:e.id,pinned:!e.pinned})},p=s();return{pin:d,markUnread:{isPending:p.isPending,mutate:()=>{t?.(),p.mutate(e.id,{onError:l})}},delete:m({mutationFn:()=>ce(e.id),onSuccess:()=>{o(),r(`/`)},onError:l}),terminal:Ft(e),confirming:i,setConfirming:a}}function fn(e){let t=o(e.id),n=R(e);return{title:n,editor:dt(n,e=>t.mutate({title:e},{onError:e=>S(e.message,{tone:`danger`})}))}}function pn({run:e}){let{title:t,editor:n}=fn(e);return n.editing?(0,X.jsx)(st,{editor:n,className:`flex-1 text-[16px] font-semibold`}):(0,X.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,X.jsx)(`h1`,{className:`line-clamp-2 min-w-0 break-words text-2xl font-semibold tracking-tight`,title:e.task,children:t}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,onClick:n.begin,className:`shrink-0 rounded-sm p-1 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,X.jsx)(ht,{className:`size-3.5`,"aria-hidden":`true`})})]})}function mn({run:e,status:t}){let{title:n,editor:r}=fn(e);return(0,X.jsxs)(Le,{open:r.editing,onOpenChange:e=>{e?r.begin():r.commit()},children:[(0,X.jsxs)(`div`,{"data-slot":`mobile-run-title`,className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,X.jsx)(`h1`,{className:`line-clamp-2 break-words text-[15px] leading-[18px] font-semibold text-foreground`,title:e.task,children:n}),t]}),(0,X.jsx)(Fe,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,className:`flex size-11 shrink-0 items-center justify-center rounded-sm text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,X.jsx)(ht,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,X.jsx)(Ie,{align:`end`,className:`w-64 max-w-[calc(100vw-16px)] p-2`,onEscapeKeyDown:e=>{e.preventDefault(),r.cancel()},children:(0,X.jsx)(st,{editor:r,className:`text-[16px] font-semibold`})})]})}function hn({run:e,actions:t,onToggleNotes:n,onOpenChooser:r}){let i=W(e),a=K(e),s=et(),c=Ct(e.id),[l,u]=(0,Y.useState)(!1),d=o(e.id),f=(0,Y.useId)();return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Tt,{run:e,open:l,onOpenChange:u,onConfirm:()=>{c.mutate(!0),u(!1)}}),(0,X.jsxs)(I,{children:[(0,X.jsx)(P,{asChild:!0,children:(0,X.jsx)(k,{variant:`ghost`,size:`icon-sm`,className:`size-11`,"aria-label":`Run actions`,children:(0,X.jsx)(Te,{"aria-hidden":`true`})})}),(0,X.jsxs)(F,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,children:[(0,X.jsx)(A,{className:`px-2 py-3 text-[12px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),!s&&i.archive&&!e.archiveBlocker?(0,X.jsx)(j,{disabled:c.isPending,onSelect:()=>e.archived?c.mutate(!1):u(!0),children:wt(e)}):null,(0,X.jsxs)(j,{onSelect:n,children:[(0,X.jsx)(ct,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,X.jsx)(Rt,{run:e,canResume:i.terminal,onResume:()=>t.terminal.mutate(),onOpen:r}),a?(0,X.jsxs)(j,{onSelect:()=>void Z(a,`Command copied to clipboard.`),children:[(0,X.jsx)(E,{"aria-hidden":`true`}),` Copy resume command`]}):null,i.markUnread?(0,X.jsxs)(j,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,X.jsx)(xt,{"aria-hidden":`true`}),` Mark unread`]}):null,i.pin?(0,X.jsxs)(N,{"data-slot":`pin-run`,className:`min-h-11`,checked:!!e.pinned,disabled:t.pin.isPending,onCheckedChange:()=>t.pin.mutate(),children:[e.pinned?(0,X.jsx)(St,{"aria-hidden":`true`}):(0,X.jsx)(Ce,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,(0,X.jsx)(M,{}),(0,X.jsx)(A,{className:`text-xs text-muted-foreground`,children:`AFTER DONE`}),(0,X.jsx)(N,{"data-slot":`archive-when-done`,className:`min-h-11`,checked:e.archiveWhenDone===!0,disabled:d.isPending,onCheckedChange:e=>d.mutate({archiveWhenDone:e},{onError:e=>S(e.message,{tone:`danger`})}),children:`Archive when Done`}),(0,X.jsx)(N,{"data-slot":`auto-merge-pr`,className:`min-h-11`,checked:e.autoMergePr===!0,disabled:d.isPending,"aria-describedby":f,onCheckedChange:e=>d.mutate({autoMergePr:e},{onError:e=>S(e.message,{tone:`danger`})}),children:`Auto-merge PR`}),(0,X.jsx)(`p`,{id:f,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block:0.5rem]`,children:`After Done, auto-merge can mark a draft PR ready. It waits for current-head CI and GitHub rules. Merge comes before archive.`}),e.delegation?.role===`worker`?null:(0,X.jsx)(gn,{run:e,patch:d}),i.deleteRun?(0,X.jsx)(M,{}):null,i.deleteRun?(0,X.jsxs)(j,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,X.jsx)(ve,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})]})}function gn({run:e,patch:t}){let n=(0,Y.useId)(),r=(0,Y.useId)(),i=(0,Y.useId)(),a=e=>S(e.message,{tone:`danger`});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(M,{}),(0,X.jsx)(A,{className:`text-xs text-muted-foreground`,children:`TASK ACCESS`}),(0,X.jsx)(N,{"data-slot":`allow-workers`,className:`min-h-11`,checked:oe(e),disabled:t.isPending,"aria-describedby":`${n} ${i}`,onCheckedChange:e=>t.mutate({allowWorkers:e},{onError:a}),children:`Allow Squawk workers`}),(0,X.jsx)(`p`,{id:n,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can start Squawk workers. Each worker is a separate paid agent session. Worker limits cap resources, not spending.`}),(0,X.jsx)(N,{"data-slot":`allow-messaging`,className:`min-h-11`,checked:C(e),disabled:t.isPending,"aria-describedby":`${r} ${i}`,onCheckedChange:e=>t.mutate({allowMessaging:e},{onError:a}),children:`Allow task messaging`}),(0,X.jsx)(`p`,{id:r,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can message other tasks in this project.`}),(0,X.jsx)(`p`,{id:i,"data-slot":`task-access-session-note`,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Turning one off applies at once. Turning one on reaches a running agent at its next session.`})]})}function _n({run:e,actions:t}){let n=t.confirming;return(0,X.jsx)(nt,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,X.jsxs)(it,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,X.jsxs)(pt,{children:[(0,X.jsx)(V,{className:`text-danger`,children:`Delete task permanently?`}),(0,X.jsx)(z,{children:(0,X.jsxs)(X.Fragment,{children:[`Delete “`,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,title:R(e),children:R(e)}),`” and its transcript`,e.delegation?.role===`worker`&&!le(e.delegation.workspace)?``:`, worktree and branch`,`. This cannot be undone.`]})})]}),(0,X.jsxs)(H,{children:[(0,X.jsx)(tt,{children:`Cancel`}),(0,X.jsx)(B,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t.delete.mutate(),t.setConfirming(null)},children:`Delete task`})]})]})})}function vn({runId:e,onClose:t}){let n=y(e);return(0,X.jsxs)(`div`,{"data-slot":`notes-panel`,className:`my-5 flex max-h-[min(45dvh,420px)] flex-col overflow-hidden rounded-xl border border-border bg-card p-6`,children:[(0,X.jsxs)(`div`,{className:`mb-4 flex shrink-0 items-center justify-between gap-3`,children:[(0,X.jsx)(`h2`,{className:`text-lg font-medium`,children:`Notes / handoff`}),(0,X.jsx)(k,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,X.jsx)(ye,{})})]}),(0,X.jsx)(`div`,{"data-slot":`notes-panel-body`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:n.isPending?(0,X.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):n.isError?(0,X.jsx)(`p`,{className:`text-xs text-danger`,children:n.error.message}):n.data.trim().length>0?(0,X.jsx)(yt,{runId:e,children:(0,X.jsx)(_t,{children:n.data})}):(0,X.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`})}),(0,X.jsxs)(`div`,{className:`mt-4 flex shrink-0 gap-3`,children:[(0,X.jsx)(k,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void Z(n.data??``,`Notes copied`),children:`Copy notes`}),(0,X.jsx)(k,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{Ft as a,Lt as i,zt as n,Pt as o,Bt as r,jt as s,un as t};
@@ -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{t as i}from"./utils-DSMR_WLb.js";import{c as a,d as o,l as s}from"./design-icons-CzEoMH9c.js";import{a as c,n as l}from"./dist-BW234Kg5.js";import{a as u,i as d,n as f,r as p,t as m}from"./dist-C5mlVBmd.js";import{h,m as g}from"./dropdown-menu-4e2iKSMT.js";import{a as _,c as v,i as y,l as b,n as x,o as S,r as C,t as w,u as T}from"./es2015-CQth82uv.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-BAoXdNsT.js";import{Qn as ee}from"./index-BSZD2aai.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]=h(R),[H,U]=d(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:f,required:p,form:h,internal_do_not_use_render:_}=e,v=W(t),[y,x]=M.useState(null),[S,C]=M.useState(null),[w,T]=M.useState(!1),E=g(l),[D,k]=m({prop:r,defaultProp:i??!1,onChange:a,caller:R}),[A,j]=m({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=b(),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:p,trigger:y,onTriggerChange:x,valueNode:S,onValueNodeChange:C,valueNodeHasChildren:w,onValueNodeHasChildrenChange:T,contentId:B,value:A,onValueChange:j,open:D,onOpenChange:k,dir:E,triggerPointerDownPosRef:ee,disabled:f,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,...i}=e,a=W(n),o=G(ae,n),s=o.disabled||r,l=c(t,o.onTriggerChange),d=B(n),f=M.useRef(`touch`),[m,h,g]=$e(e=>{let t=d().filter(e=>!e.disabled),n=et(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),_=e=>{s||(o.onOpenChange(!0),g()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,F.jsx)(j,{asChild:!0,...a,children:(0,F.jsx)(u.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":$(o.value)?``:void 0,...i,ref:l,onClick:p(i.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&_(e)}),onPointerDown:p(i.onPointerDown,e=>{f.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(_(e),e.preventDefault())}),onKeyDown:p(i.onKeyDown,e=>{let t=m.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&h(e.key),!(t&&e.key===` `)&&I.includes(e.key)&&(_(),e.preventDefault())})})})});oe.displayName=ae;var se=`SelectValue`,ce=M.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,l=G(se,n),{onValueNodeHasChildrenChange:d}=l,p=a!==void 0,m=c(t,l.onValueNodeChange);f(()=>{d(p)},[d,p]);let h=$(l.value);return(0,F.jsx)(u.span,{...s,asChild:!h&&s.asChild,ref:m,style:{pointerEvents:`none`},children:(0,F.jsx)(M.Fragment,{children:h?o:a},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)(u.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)(y,{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 f(()=>{s(new DocumentFragment)},[]),(0,F.jsx)(T,{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=l(`SelectContent.RemoveScroll`),be=M.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:y,...b}=e,T=G(J,n),[E,D]=M.useState(null),[O,k]=M.useState(null),A=c(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 w(E)},[E]),C();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:s,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:y}:{};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)(x,{as:ye,allowPinchZoom:!0,children:(0,F.jsx)(_,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:p(i,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,F.jsx)(S,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,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(),...b,...ae,onPlaced:()=>R(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...b.style},onKeyDown:p(b.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,...i}=e,a=G(J,n),o=X(J,n),[s,l]=M.useState(null),[d,p]=M.useState(null),m=c(t,p),h=B(n),g=M.useRef(!1),_=M.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=o,S=M.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&d&&v&&y&&b){let e=a.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=b.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=h(),c=window.innerHeight-Y*2,l=v.scrollHeight,u=window.getComputedStyle(d),f=parseInt(u.borderTopWidth,10),p=parseInt(u.paddingTop,10),m=parseInt(u.borderBottomWidth,10),_=parseInt(u.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=c-E,O=y.offsetHeight/2,k=y.offsetTop+O,A=f+p+k,j=x-A;if(A<=E){let e=o.length>0&&y===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=d.clientHeight-v.offsetTop-v.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+m);s.style.height=n+`px`}else{let e=o.length>0&&y===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,f+v.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,v.scrollTop=A-E+v.offsetTop}s.style.margin=`${Y}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>g.current=!0)}},[h,a.trigger,a.valueNode,s,d,v,y,b,a.dir,r]);f(()=>S(),[S]);let[C,w]=M.useState();return f(()=>{d&&w(window.getComputedStyle(d).zIndex)},[d]),(0,F.jsx)(Te,{scope:n,contentWrapper:s,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)(u.div,{...i,ref:m,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.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,...i}=e,a=X(De,n),o=Ee(De,n),s=c(t,a.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)(u.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:p(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;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=b();return(0,F.jsx)(Ae,{scope:n,id:i,children:(0,F.jsx)(u.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)(u.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:i=!1,textValue:a,...o}=e,s=G(Z,n),l=X(Z,n),d=s.value===r,[f,m]=M.useState(a??``),[h,g]=M.useState(!1),_=c(t,v(e=>l.itemRefCallback?.(e,r,i))),y=b(),x=M.useRef(`touch`),S=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,F.jsx)(Fe,{scope:n,value:r,disabled:i,textId:y,isSelected:d,onItemTextChange:M.useCallback(e=>{m(t=>t||(e?.textContent??``).trim())},[]),children:(0,F.jsx)(z.ItemSlot,{scope:n,value:r,disabled:i,textValue:f,children:(0,F.jsx)(u.div,{role:`option`,"aria-labelledby":y,"data-highlighted":h?``:void 0,"aria-selected":d&&h,"data-state":d?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:_,onFocus:p(o.onFocus,()=>g(!0)),onBlur:p(o.onBlur,()=>g(!1)),onClick:p(o.onClick,()=>{x.current!==`mouse`&&S()}),onPointerUp:p(o.onPointerUp,()=>{x.current===`mouse`&&S()}),onPointerDown:p(o.onPointerDown,e=>{x.current=e.pointerType}),onPointerMove:p(o.onPointerMove,e=>{x.current=e.pointerType,i?l.onItemLeave?.():x.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:p(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:p(o.onKeyDown,e=>{i||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:i,...a}=e,o=G(Q,n),s=X(Q,n),l=Ie(Q,n),d=re(Q,n),[p,m]=M.useState(null),h=v(e=>s.itemTextRefCallback?.(e,l.value,l.disabled)),g=c(t,m,l.onItemTextChange,h),_=p?.textContent,y=M.useMemo(()=>(0,F.jsx)(`option`,{value:l.value,disabled:l.disabled,children:_},l.value),[l.disabled,l.value,_]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=d;return f(()=>(b(y),()=>x(y)),[b,x,y]),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(u.span,{id:l.textId,...a,ref:g}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!$(o.value)?N.createPortal(a.children,o.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)(u.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),[i,a]=M.useState(!1),o=c(t,r.onScrollButtonChange);return f(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,F.jsx)(Ge,{...e,ref:o,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),[i,a]=M.useState(!1),o=c(t,r.onScrollButtonChange);return f(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,F.jsx)(Ge,{...e,ref:o,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]),f(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,F.jsx)(u.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:p(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:p(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:p(i.onPointerLeave,()=>{c()})})}),Ke=`SelectSeparator`,qe=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,F.jsx)(u.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:i,onValueChange:a,required:o,disabled:s,name:l,autoComplete:d,form:f}=r,{nativeOptions:p,nativeSelectKey:m}=r,h=M.useRef(null),g=c(n,h),_=i??``,v=E(_),y=Array.from(p).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)(u.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:l,autoComplete:d,disabled:s,form:f,onChange:e=>a(e.target.value),...t,style:{...ee,...t.style},ref:g,defaultValue:_,children:[$(i)&&!y?(0,F.jsx)(`option`,{value:``}):null,Array.from(p)]},m)});Ze.displayName=Xe;function Qe(e){return typeof e==`function`}function $(e){return e===``||e===void 0}function $e(e){let t=v(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:i(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-[var(--task-brand-bg)] px-3 py-2 text-sm whitespace-nowrap shadow-none transition-[color,box-shadow] outline-hidden focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-11 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 pointer-hover:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,F.jsx)(ue,{asChild:!0,children:(0,F.jsx)(s,{className:`size-4 opacity-50`})})]})}function at({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...a}){return(0,F.jsx)(me,{children:(0,F.jsxs)(he,{"data-slot":`select-content`,className:i(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...a,children:[(0,F.jsx)(st,{}),(0,F.jsx)(Oe,{className:i(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,F.jsx)(ct,{})]})})}function ot({className:e,children:t,...n}){return(0,F.jsxs)(Le,{"data-slot":`select-item`,className:i(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pe-8 ps-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,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)(a,{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:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,F.jsx)(o,{className:`size-4`})})}function ct({className:e,...t}){return(0,F.jsx)(We,{"data-slot":`select-scroll-down-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,F.jsx)(s,{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{t as i}from"./utils-DSMR_WLb.js";import{c as a,d as o,l as s}from"./design-icons-CzEoMH9c.js";import{a as c,n as l}from"./dist-BW234Kg5.js";import{a as u,i as d,n as f,r as p,t as m}from"./dist-C5mlVBmd.js";import{h,m as g}from"./dropdown-menu-4e2iKSMT.js";import{a as _,c as v,i as y,l as b,n as x,o as S,r as C,t as w,u as T}from"./es2015-CQth82uv.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-BAoXdNsT.js";import{Qn as ee}from"./index-BhB5uLZf.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]=h(R),[H,U]=d(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:f,required:p,form:h,internal_do_not_use_render:_}=e,v=W(t),[y,x]=M.useState(null),[S,C]=M.useState(null),[w,T]=M.useState(!1),E=g(l),[D,k]=m({prop:r,defaultProp:i??!1,onChange:a,caller:R}),[A,j]=m({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=b(),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:p,trigger:y,onTriggerChange:x,valueNode:S,onValueNodeChange:C,valueNodeHasChildren:w,onValueNodeHasChildrenChange:T,contentId:B,value:A,onValueChange:j,open:D,onOpenChange:k,dir:E,triggerPointerDownPosRef:ee,disabled:f,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,...i}=e,a=W(n),o=G(ae,n),s=o.disabled||r,l=c(t,o.onTriggerChange),d=B(n),f=M.useRef(`touch`),[m,h,g]=$e(e=>{let t=d().filter(e=>!e.disabled),n=et(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),_=e=>{s||(o.onOpenChange(!0),g()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,F.jsx)(j,{asChild:!0,...a,children:(0,F.jsx)(u.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":$(o.value)?``:void 0,...i,ref:l,onClick:p(i.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&_(e)}),onPointerDown:p(i.onPointerDown,e=>{f.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(_(e),e.preventDefault())}),onKeyDown:p(i.onKeyDown,e=>{let t=m.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&h(e.key),!(t&&e.key===` `)&&I.includes(e.key)&&(_(),e.preventDefault())})})})});oe.displayName=ae;var se=`SelectValue`,ce=M.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,l=G(se,n),{onValueNodeHasChildrenChange:d}=l,p=a!==void 0,m=c(t,l.onValueNodeChange);f(()=>{d(p)},[d,p]);let h=$(l.value);return(0,F.jsx)(u.span,{...s,asChild:!h&&s.asChild,ref:m,style:{pointerEvents:`none`},children:(0,F.jsx)(M.Fragment,{children:h?o:a},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)(u.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)(y,{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 f(()=>{s(new DocumentFragment)},[]),(0,F.jsx)(T,{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=l(`SelectContent.RemoveScroll`),be=M.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:y,...b}=e,T=G(J,n),[E,D]=M.useState(null),[O,k]=M.useState(null),A=c(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 w(E)},[E]),C();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:s,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:y}:{};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)(x,{as:ye,allowPinchZoom:!0,children:(0,F.jsx)(_,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:p(i,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,F.jsx)(S,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,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(),...b,...ae,onPlaced:()=>R(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...b.style},onKeyDown:p(b.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,...i}=e,a=G(J,n),o=X(J,n),[s,l]=M.useState(null),[d,p]=M.useState(null),m=c(t,p),h=B(n),g=M.useRef(!1),_=M.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=o,S=M.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&d&&v&&y&&b){let e=a.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=b.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=h(),c=window.innerHeight-Y*2,l=v.scrollHeight,u=window.getComputedStyle(d),f=parseInt(u.borderTopWidth,10),p=parseInt(u.paddingTop,10),m=parseInt(u.borderBottomWidth,10),_=parseInt(u.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=c-E,O=y.offsetHeight/2,k=y.offsetTop+O,A=f+p+k,j=x-A;if(A<=E){let e=o.length>0&&y===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=d.clientHeight-v.offsetTop-v.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+m);s.style.height=n+`px`}else{let e=o.length>0&&y===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,f+v.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,v.scrollTop=A-E+v.offsetTop}s.style.margin=`${Y}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>g.current=!0)}},[h,a.trigger,a.valueNode,s,d,v,y,b,a.dir,r]);f(()=>S(),[S]);let[C,w]=M.useState();return f(()=>{d&&w(window.getComputedStyle(d).zIndex)},[d]),(0,F.jsx)(Te,{scope:n,contentWrapper:s,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)(u.div,{...i,ref:m,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.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,...i}=e,a=X(De,n),o=Ee(De,n),s=c(t,a.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)(u.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:p(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;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=b();return(0,F.jsx)(Ae,{scope:n,id:i,children:(0,F.jsx)(u.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)(u.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:i=!1,textValue:a,...o}=e,s=G(Z,n),l=X(Z,n),d=s.value===r,[f,m]=M.useState(a??``),[h,g]=M.useState(!1),_=c(t,v(e=>l.itemRefCallback?.(e,r,i))),y=b(),x=M.useRef(`touch`),S=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,F.jsx)(Fe,{scope:n,value:r,disabled:i,textId:y,isSelected:d,onItemTextChange:M.useCallback(e=>{m(t=>t||(e?.textContent??``).trim())},[]),children:(0,F.jsx)(z.ItemSlot,{scope:n,value:r,disabled:i,textValue:f,children:(0,F.jsx)(u.div,{role:`option`,"aria-labelledby":y,"data-highlighted":h?``:void 0,"aria-selected":d&&h,"data-state":d?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:_,onFocus:p(o.onFocus,()=>g(!0)),onBlur:p(o.onBlur,()=>g(!1)),onClick:p(o.onClick,()=>{x.current!==`mouse`&&S()}),onPointerUp:p(o.onPointerUp,()=>{x.current===`mouse`&&S()}),onPointerDown:p(o.onPointerDown,e=>{x.current=e.pointerType}),onPointerMove:p(o.onPointerMove,e=>{x.current=e.pointerType,i?l.onItemLeave?.():x.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:p(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:p(o.onKeyDown,e=>{i||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:i,...a}=e,o=G(Q,n),s=X(Q,n),l=Ie(Q,n),d=re(Q,n),[p,m]=M.useState(null),h=v(e=>s.itemTextRefCallback?.(e,l.value,l.disabled)),g=c(t,m,l.onItemTextChange,h),_=p?.textContent,y=M.useMemo(()=>(0,F.jsx)(`option`,{value:l.value,disabled:l.disabled,children:_},l.value),[l.disabled,l.value,_]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=d;return f(()=>(b(y),()=>x(y)),[b,x,y]),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(u.span,{id:l.textId,...a,ref:g}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!$(o.value)?N.createPortal(a.children,o.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)(u.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),[i,a]=M.useState(!1),o=c(t,r.onScrollButtonChange);return f(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,F.jsx)(Ge,{...e,ref:o,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),[i,a]=M.useState(!1),o=c(t,r.onScrollButtonChange);return f(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,F.jsx)(Ge,{...e,ref:o,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]),f(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,F.jsx)(u.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:p(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:p(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:p(i.onPointerLeave,()=>{c()})})}),Ke=`SelectSeparator`,qe=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,F.jsx)(u.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:i,onValueChange:a,required:o,disabled:s,name:l,autoComplete:d,form:f}=r,{nativeOptions:p,nativeSelectKey:m}=r,h=M.useRef(null),g=c(n,h),_=i??``,v=E(_),y=Array.from(p).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)(u.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:l,autoComplete:d,disabled:s,form:f,onChange:e=>a(e.target.value),...t,style:{...ee,...t.style},ref:g,defaultValue:_,children:[$(i)&&!y?(0,F.jsx)(`option`,{value:``}):null,Array.from(p)]},m)});Ze.displayName=Xe;function Qe(e){return typeof e==`function`}function $(e){return e===``||e===void 0}function $e(e){let t=v(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:i(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-[var(--task-brand-bg)] px-3 py-2 text-sm whitespace-nowrap shadow-none transition-[color,box-shadow] outline-hidden focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-11 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 pointer-hover:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,F.jsx)(ue,{asChild:!0,children:(0,F.jsx)(s,{className:`size-4 opacity-50`})})]})}function at({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...a}){return(0,F.jsx)(me,{children:(0,F.jsxs)(he,{"data-slot":`select-content`,className:i(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...a,children:[(0,F.jsx)(st,{}),(0,F.jsx)(Oe,{className:i(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,F.jsx)(ct,{})]})})}function ot({className:e,children:t,...n}){return(0,F.jsxs)(Le,{"data-slot":`select-item`,className:i(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pe-8 ps-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,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)(a,{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:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,F.jsx)(o,{className:`size-4`})})}function ct({className:e,...t}){return(0,F.jsx)(We,{"data-slot":`select-scroll-down-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,F.jsx)(s,{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{t as r}from"./utils-DSMR_WLb.js";import{D as i,O as a,S as o}from"./queries-EvENG6TN.js";import{Fn as s,n as c}from"./toaster-Cer2NOxt.js";import{t as l}from"./plus-CxRU2X8C.js";import{t as u}from"./button-B7MKxYjT.js";import{t as d}from"./badge-DQ3U69Ht.js";import{t as f}from"./centered-state-V15AR_qo.js";import{Jn as p,fn as m,or as h}from"./index-BSZD2aai.js";import{t as g}from"./code-editor-B4baSOhz.js";var _=e(t(),1);function v(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 y=n(),b={"built-in":`built in`,parent:`parent`,worker:`worker`,both:`both`},x={"built-in":`built in`,shared:`shared`,local:`local`},S={applied:`border-success/40 text-success`,skipped:`border-conflict/50 text-conflict`,"not-for-role":`text-soft-foreground`},C=e=>`${e.toLocaleString(`en-US`)} B`;function ee({id:e,preview:t,role:n,onRole:i,pending:a,className:o}){return(0,y.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,y.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-border p-3`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`h3`,{id:`session-context-preview-title`,className:`text-sm font-semibold`,children:`Combined preview`}),(0,y.jsx)(`span`,{className:`ml-auto text-[12px] text-soft-foreground`,children:`Updates as you type`})]}),(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,y.jsx)(`span`,{id:`session-context-role`,className:`text-[12px] text-soft-foreground`,children:`Preview as`}),(0,y.jsx)(te,{role:n,onRole:i}),(0,y.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`Handoff, shared, then local. Files come from the project checkout.`})]}),t?(0,y.jsx)(ne,{used:t.usedBytes,limit:t.limitBytes,blocks:t.blocks}):(0,y.jsx)(`div`,{className:`h-[38px]`})]}),(0,y.jsx)(`ul`,{"data-slot":`session-context-blocks`,className:`divide-y divide-border`,children:t?.blocks.map((e,t)=>(0,y.jsx)(T,{block:e,role:n},`${e.source}-${e.id}-${t}`))})]})}var w=[`parent`,`worker`];function te({role:e,onRole:t}){let n=(0,_.useRef)(new Map);return(0,y.jsx)(`div`,{role:`radiogroup`,"aria-labelledby":`session-context-role`,onKeyDown:r=>{let i=v(w,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:w.map(i=>(0,y.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,y.jsxs)(`div`,{"data-slot":`session-context-meter`,children:[(0,y.jsx)(`div`,{role:`meter`,"aria-label":`Session context size`,"aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":e,"aria-valuetext":`${C(e)} of ${C(t)}`,className:`h-2 overflow-hidden rounded-full bg-muted`,children:(0,y.jsx)(`div`,{className:`h-full rounded-full bg-accent-strong`,style:{width:`${a}%`}})}),(0,y.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-x-3 text-[12px]`,children:[(0,y.jsxs)(`span`,{className:`text-muted-foreground`,children:[C(e),` used: `,r,` `,r===1?`block`:`blocks`,` applied`,i>0?`, ${i} skipped`:``]}),(0,y.jsxs)(`span`,{className:`ml-auto text-soft-foreground`,children:[`Limit 64 KiB (`,C(t),`)`]})]})]})}function T({block:e,role:t}){let n=e.status===`not-for-role`?`not for ${t}`:e.status,i=e.overridesShared?`local · overrides shared`:x[e.source],a=e.source===`built-in`||e.overridesShared,o=e.reason!==null&&!(e.status===`applied`&&e.overridesShared);return(0,y.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,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:e.id}),(0,y.jsx)(d,{"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,y.jsx)(d,{variant:`outline`,className:`text-xs`,children:b[e.target]}),(0,y.jsx)(`span`,{className:`ml-auto font-mono text-[12px] text-soft-foreground`,children:e.bytes===null?`—`:C(e.bytes)}),(0,y.jsx)(d,{variant:`outline`,className:r(`text-xs`,S[e.status]),children:n})]}),o&&(0,y.jsx)(`p`,{className:`text-[12px] text-conflict`,children:e.reason}),e.text!==null&&(0,y.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{t as r}from"./utils-DSMR_WLb.js";import{D as i,O as a,S as o}from"./queries-EvENG6TN.js";import{Fn as s,n as c}from"./toaster-Cer2NOxt.js";import{t as l}from"./plus-CxRU2X8C.js";import{t as u}from"./button-B7MKxYjT.js";import{t as d}from"./badge-DQ3U69Ht.js";import{t as f}from"./centered-state-V15AR_qo.js";import{Jn as p,fn as m,or as h}from"./index-BhB5uLZf.js";import{t as g}from"./code-editor-B4baSOhz.js";var _=e(t(),1);function v(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 y=n(),b={"built-in":`built in`,parent:`parent`,worker:`worker`,both:`both`},x={"built-in":`built in`,shared:`shared`,local:`local`},S={applied:`border-success/40 text-success`,skipped:`border-conflict/50 text-conflict`,"not-for-role":`text-soft-foreground`},C=e=>`${e.toLocaleString(`en-US`)} B`;function ee({id:e,preview:t,role:n,onRole:i,pending:a,className:o}){return(0,y.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,y.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-border p-3`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`h3`,{id:`session-context-preview-title`,className:`text-sm font-semibold`,children:`Combined preview`}),(0,y.jsx)(`span`,{className:`ml-auto text-[12px] text-soft-foreground`,children:`Updates as you type`})]}),(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,y.jsx)(`span`,{id:`session-context-role`,className:`text-[12px] text-soft-foreground`,children:`Preview as`}),(0,y.jsx)(te,{role:n,onRole:i}),(0,y.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`Handoff, shared, then local. Files come from the project checkout.`})]}),t?(0,y.jsx)(ne,{used:t.usedBytes,limit:t.limitBytes,blocks:t.blocks}):(0,y.jsx)(`div`,{className:`h-[38px]`})]}),(0,y.jsx)(`ul`,{"data-slot":`session-context-blocks`,className:`divide-y divide-border`,children:t?.blocks.map((e,t)=>(0,y.jsx)(T,{block:e,role:n},`${e.source}-${e.id}-${t}`))})]})}var w=[`parent`,`worker`];function te({role:e,onRole:t}){let n=(0,_.useRef)(new Map);return(0,y.jsx)(`div`,{role:`radiogroup`,"aria-labelledby":`session-context-role`,onKeyDown:r=>{let i=v(w,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:w.map(i=>(0,y.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,y.jsxs)(`div`,{"data-slot":`session-context-meter`,children:[(0,y.jsx)(`div`,{role:`meter`,"aria-label":`Session context size`,"aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":e,"aria-valuetext":`${C(e)} of ${C(t)}`,className:`h-2 overflow-hidden rounded-full bg-muted`,children:(0,y.jsx)(`div`,{className:`h-full rounded-full bg-accent-strong`,style:{width:`${a}%`}})}),(0,y.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-x-3 text-[12px]`,children:[(0,y.jsxs)(`span`,{className:`text-muted-foreground`,children:[C(e),` used: `,r,` `,r===1?`block`:`blocks`,` applied`,i>0?`, ${i} skipped`:``]}),(0,y.jsxs)(`span`,{className:`ml-auto text-soft-foreground`,children:[`Limit 64 KiB (`,C(t),`)`]})]})]})}function T({block:e,role:t}){let n=e.status===`not-for-role`?`not for ${t}`:e.status,i=e.overridesShared?`local · overrides shared`:x[e.source],a=e.source===`built-in`||e.overridesShared,o=e.reason!==null&&!(e.status===`applied`&&e.overridesShared);return(0,y.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,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:e.id}),(0,y.jsx)(d,{"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,y.jsx)(d,{variant:`outline`,className:`text-xs`,children:b[e.target]}),(0,y.jsx)(`span`,{className:`ml-auto font-mono text-[12px] text-soft-foreground`,children:e.bytes===null?`—`:C(e.bytes)}),(0,y.jsx)(d,{variant:`outline`,className:r(`text-xs`,S[e.status]),children:n})]}),o&&(0,y.jsx)(`p`,{className:`text-[12px] text-conflict`,children:e.reason}),e.text!==null&&(0,y.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`),E=Symbol.for(`yaml.document`),D=Symbol.for(`yaml.map`),ie=Symbol.for(`yaml.pair`),O=Symbol.for(`yaml.scalar`),k=Symbol.for(`yaml.seq`),A=Symbol.for(`yaml.node.type`),j=e=>!!e&&typeof e==`object`&&e[A]===re,ae=e=>!!e&&typeof e==`object`&&e[A]===E,oe=e=>!!e&&typeof e==`object`&&e[A]===D,M=e=>!!e&&typeof e==`object`&&e[A]===ie,N=e=>!!e&&typeof e==`object`&&e[A]===O,se=e=>!!e&&typeof e==`object`&&e[A]===k;function P(e){if(e&&typeof e==`object`)switch(e[A]){case D:case k:return!0}return!1}function F(e){if(e&&typeof e==`object`)switch(e[A]){case re:case D:case O:case k:return!0}return!1}var ce=e=>(N(e)||P(e))&&!!e.anchor,I=Symbol(`break visit`),le=Symbol(`skip children`),L=Symbol(`remove node`);function ue(e,t){let n=pe(t);ae(e)?de(null,e.contents,n,Object.freeze([e]))===L&&(e.contents=null):de(null,e,n,Object.freeze([]))}ue.BREAK=I,ue.SKIP=le,ue.REMOVE=L;function de(e,t,n,r){let i=me(e,t,n,r);if(F(i)||M(i))return he(e,r,i),de(e,i,n,r);if(typeof i!=`symbol`){if(P(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===I)return I;else i===L&&(t.items.splice(e,1),--e)}}else if(M(t)){r=Object.freeze(r.concat(t));let e=de(`key`,t.key,n,r);if(e===I)return I;e===L&&(t.key=null);let i=de(`value`,t.value,n,r);if(i===I)return I;i===L&&(t.value=null)}}return i}async function fe(e,t){let n=pe(t);ae(e)?await R(null,e.contents,n,Object.freeze([e]))===L&&(e.contents=null):await R(null,e,n,Object.freeze([]))}fe.BREAK=I,fe.SKIP=le,fe.REMOVE=L;async function R(e,t,n,r){let i=await me(e,t,n,r);if(F(i)||M(i))return he(e,r,i),R(e,i,n,r);if(typeof i!=`symbol`){if(P(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=await R(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===I)return I;else i===L&&(t.items.splice(e,1),--e)}}else if(M(t)){r=Object.freeze(r.concat(t));let e=await R(`key`,t.key,n,r);if(e===I)return I;e===L&&(t.key=null);let i=await R(`value`,t.value,n,r);if(i===I)return I;i===L&&(t.value=null)}}return i}function pe(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 me(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(oe(t))return n.Map?.(e,t,r);if(se(t))return n.Seq?.(e,t,r);if(M(t))return n.Pair?.(e,t,r);if(N(t))return n.Scalar?.(e,t,r);if(j(t))return n.Alias?.(e,t,r)}function he(e,t,n){let r=t[t.length-1];if(P(r))r.items[e]=n;else if(M(r))e===`key`?r.key=n:r.value=n;else if(ae(r))r.contents=n;else{let e=j(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var ge={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},_e=e=>e.replace(/[!,[\]{}]/g,e=>ge[e]),z=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+_e(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&&F(e.contents)){let t={};ue(e.contents,(e,n)=>{F(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
  `)}};z.defaultYaml={explicit:!1,version:`1.2`},z.defaultTags={"!!":`tag:yaml.org,2002:`};function ve(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 ye(e){let t=new Set;return ue(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function be(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function xe(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=ye(e);let a=be(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(N(t.node)||P(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 Se(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=Se(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=Se(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=Se(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=Se(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}return e.call(t,n,r)}function B(e,t,n){if(Array.isArray(e))return e.map((e,t)=>B(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,A,{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(!ae(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=B(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?Se(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)=>{(j(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||=(B(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(ve(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(j(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(P(t)){let r=0;for(let i of t.items){let t=Te(e,i,n);t>r&&(r=t)}return r}else if(M(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`,V=class extends Ce{constructor(e){super(O),this.value=e}toJSON(e,t){return t?.keep?this.value:B(this.value,e,t)}toString(){return String(this.value)}};V.BLOCK_FOLDED=`BLOCK_FOLDED`,V.BLOCK_LITERAL=`BLOCK_LITERAL`,V.PLAIN=`PLAIN`,V.QUOTE_DOUBLE=`QUOTE_DOUBLE`,V.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(ae(e)&&(e=e.contents),F(e))return e;if(M(e)){let t=n.schema[D].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 V(e);return c&&(c.node=t),t}l=e instanceof Map?o[D]:Symbol.iterator in Object(e)?o[k]:o[D]}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 V(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=>F(t)||M(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(P(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(P(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&&N(i)?i.value:i:P(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!M(t))return!1;let n=t.value;return n==null||e&&N(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 P(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(P(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 H(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var U=(e,t,n)=>e.endsWith(`
4
4
  `)?H(n,t):n.includes(`
@@ -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{t as r}from"./utils-DSMR_WLb.js";import{$t as i,Gt as a,Zt as o,dn as s,rn as c,yt as l}from"./queries-EvENG6TN.js";import{In as u,Tr as d,hi as f,ii as p,zn as m}from"./toaster-Cer2NOxt.js";import{it as h,l as g}from"./design-icons-CzEoMH9c.js";import{t as _}from"./button-B7MKxYjT.js";import{a as v,i as y,o as b,r as x,s as S,t as C}from"./dialog-B531GGAo.js";import{Xn as w}from"./index-BSZD2aai.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{t as r}from"./utils-DSMR_WLb.js";import{$t as i,Gt as a,Zt as o,dn as s,rn as c,yt as l}from"./queries-EvENG6TN.js";import{In as u,Tr as d,hi as f,ii as p,zn as m}from"./toaster-Cer2NOxt.js";import{it as h,l as g}from"./design-icons-CzEoMH9c.js";import{t as _}from"./button-B7MKxYjT.js";import{a as v,i as y,o as b,r as x,s as S,t as C}from"./dialog-B531GGAo.js";import{Xn as w}from"./index-BhB5uLZf.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};