@hearsay-tools/squawk 0.19.0-dev.8890 → 0.19.0-dev.8893

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 (138) hide show
  1. package/dist/contract/index.js +2 -0
  2. package/dist/contract/workspace.d.ts +1 -0
  3. package/dist/server/models-routes.d.ts +12 -12
  4. package/dist/server/projects-routes.d.ts +45 -45
  5. package/dist/server/reports-api.d.ts +2 -2
  6. package/dist/server/server.d.ts +2 -0
  7. package/dist/server/workspace-routes.d.ts +2 -0
  8. package/dist/server/workspace-routes.js +1 -0
  9. package/dist/server/workspace-routes.js.map +1 -1
  10. package/package.json +4 -4
  11. package/web/dist/assets/accounts-section-DV18K14j.js +1 -0
  12. package/web/dist/assets/{activity-motion-B_nzNpf8.js → activity-motion-U0gkYTm-.js} +1 -1
  13. package/web/dist/assets/{activity-route-B7vQBQJ9.js → activity-route-CKFb-IYI.js} +1 -1
  14. package/web/dist/assets/agent-config-section-X66FRjsE.js +7 -0
  15. package/web/dist/assets/agent-defaults-section-EEYiGk_Q.js +1 -0
  16. package/web/dist/assets/appearance-D4I-ANZ_.js +1 -0
  17. package/web/dist/assets/archive-on-merge-field-D6y7pCov.js +1 -0
  18. package/web/dist/assets/attention-V1gJ7gKo.js +1 -0
  19. package/web/dist/assets/automations-route-4ahsnx6z.js +2 -0
  20. package/web/dist/assets/collapsible-Bx2vViFx.js +1 -0
  21. package/web/dist/assets/command-ppU3xBNs.js +1 -0
  22. package/web/dist/assets/commit-list-Dp0c_x8b.js +1 -0
  23. package/web/dist/assets/{dialog-Dbu3HnqC.js → dialog-DXCws12U.js} +1 -1
  24. package/web/dist/assets/{diff-controls-DbAm3vyj.js → diff-controls-7hWjGeWp.js} +1 -1
  25. package/web/dist/assets/diff-n7BcLjSi.js +3 -0
  26. package/web/dist/assets/{diff-view-Bxr3btKH.js → diff-view-CJNrRCRI.js} +1 -1
  27. package/web/dist/assets/discard-changes-dialog-Bd3w4xOW.js +1 -0
  28. package/web/dist/assets/dist--f2yFdPY.js +1 -0
  29. package/web/dist/assets/dist-BSUJIXeE.js +1 -0
  30. package/web/dist/assets/dist-BuF3mvCA.js +1 -0
  31. package/web/dist/assets/dist-DudPJH39.js +1 -0
  32. package/web/dist/assets/dropdown-menu-B60L-d_4.js +1 -0
  33. package/web/dist/assets/es2015-CUEfzDjB.js +41 -0
  34. package/web/dist/assets/{file-preview-INgFZHXM.js → file-preview-DS5j5uFi.js} +1 -1
  35. package/web/dist/assets/{folder-browser-CK1mNIQi.js → folder-browser-BSGB9hhQ.js} +1 -1
  36. package/web/dist/assets/{git-toolbar-DNHCL6Li.js → git-toolbar-D5N_Ucqr.js} +1 -1
  37. package/web/dist/assets/github-Bhj0PA8h.js +1 -0
  38. package/web/dist/assets/{global-activity-route-B2mVzJEQ.js → global-activity-route-DqyHJiZz.js} +2 -2
  39. package/web/dist/assets/index-UMSYsh9P.css +1 -0
  40. package/web/dist/assets/index-i4Bu7SvU.js +21 -0
  41. package/web/dist/assets/label-CV8tuTOO.js +1 -0
  42. package/web/dist/assets/{markdown-DkzcTJZ1.js → markdown-9FIYg1nH.js} +1 -1
  43. package/web/dist/assets/{open-in-menu-CSbpfQy7.js → open-in-menu-L5v_AQZt.js} +1 -1
  44. package/web/dist/assets/{option-select-C9D7zD0s.js → option-select-CYbw9rk4.js} +1 -1
  45. package/web/dist/assets/page-shell-Dky5crRl.js +1 -0
  46. package/web/dist/assets/popover-CvL6hQ5c.js +1 -0
  47. package/web/dist/assets/preferences-section-Do1nZwKg.js +1 -0
  48. package/web/dist/assets/{preview-pane-connected-C7yWN61O.js → preview-pane-connected-o7nx7h4-.js} +2 -2
  49. package/web/dist/assets/project-location-BFN7mvbZ.js +1 -0
  50. package/web/dist/assets/{project-router-CEnizJ8F.js → project-router-BHFXTx5l.js} +1 -1
  51. package/web/dist/assets/projects-section-Bq9DzRDF.js +1 -0
  52. package/web/dist/assets/prompt-templates-section-CNa_K7AU.js +2 -0
  53. package/web/dist/assets/{queries-ByqTmyCs.js → queries-CIeJg62Y.js} +1 -1
  54. package/web/dist/assets/{reference-chip-hn8jj_Mo.js → reference-chip-O8Bfl1Oi.js} +1 -1
  55. package/web/dist/assets/{remote-settings-notice-CCAvpXI2.js → remote-settings-notice-CbCCb3QA.js} +1 -1
  56. package/web/dist/assets/repo-git-Dz3fhj6j.js +1 -0
  57. package/web/dist/assets/{report-reader-B4vS0JHP.js → report-reader-BfsdCLq-.js} +1 -1
  58. package/web/dist/assets/{report-selection-BkBJw-sm.js → report-selection-cuFCCxDW.js} +1 -1
  59. package/web/dist/assets/reports-Df83TkE3.js +1 -0
  60. package/web/dist/assets/resources-section-CKJGgLWa.js +1 -0
  61. package/web/dist/assets/{review-panel-DpUBM9JE.js → review-panel-BaUd88ko.js} +5 -5
  62. package/web/dist/assets/{run-detail-refresh-BJ4laDVB.js → run-detail-refresh-DTnwaDy2.js} +1 -1
  63. package/web/dist/assets/run-header-BWNapiIC.js +2 -0
  64. package/web/dist/assets/save-cue-CpHgT93o.js +1 -0
  65. package/web/dist/assets/select-Cy2NunWj.js +1 -0
  66. package/web/dist/assets/session-context-section-CSDtUgJI.js +119 -0
  67. package/web/dist/assets/{settings-agent-picker-DrZ3Y_T4.js → settings-agent-picker-pMZcMiW4.js} +1 -1
  68. package/web/dist/assets/settings-field-Bhh8I9fJ.js +1 -0
  69. package/web/dist/assets/settings-list-detail-Ch1KMPjr.js +1 -0
  70. package/web/dist/assets/settings-save-bar-CFkofH5G.js +1 -0
  71. package/web/dist/assets/settings-shell-B6-ofejE.js +1 -0
  72. package/web/dist/assets/settings-shell-Ct_qn_MM.css +1 -0
  73. package/web/dist/assets/sidebar-section-DwcXrxn2.js +1 -0
  74. package/web/dist/assets/{skills-Beb8A11l.js → skills-DD5hhynR.js} +1 -1
  75. package/web/dist/assets/switch-CAKeV99j.js +1 -0
  76. package/web/dist/assets/{tab-link-3A_SF95U.js → tab-link-BYYXdpLn.js} +1 -1
  77. package/web/dist/assets/task-changes-CbWxyOEd.js +1 -0
  78. package/web/dist/assets/task-commits-D8Pzk4b3.js +1 -0
  79. package/web/dist/assets/{task-file-scope-Nl1DkfPy.js → task-file-scope-DPJOeknI.js} +1 -1
  80. package/web/dist/assets/{task-files-ClNa5Me9.js → task-files-DJnNyynG.js} +1 -1
  81. package/web/dist/assets/{task-github-item-C-YZ1Y6E.js → task-github-item-Di9HWGn6.js} +1 -1
  82. package/web/dist/assets/{task-groups-BRrlyl5P.js → task-groups-C9pTQm-2.js} +1 -1
  83. package/web/dist/assets/{task-thread-BN1MvuuJ.js → task-thread-gXImKbGN.js} +2 -2
  84. package/web/dist/assets/{tasks-table-DtLW8U-4.js → tasks-table-CvZ2ZyCa.js} +1 -1
  85. package/web/dist/assets/thread-state-B2dX4psn.js +4 -0
  86. package/web/dist/assets/{toaster-Lf_4oY96.js → toaster-D0HMoto5.js} +1 -1
  87. package/web/dist/assets/{use-hand-to-agent-state-BE2hugZT.js → use-hand-to-agent-state-DhUiLIQg.js} +1 -1
  88. package/web/dist/assets/use-path-bases-BzlzA9bw.js +1 -0
  89. package/web/dist/assets/use-workspace-config-save-bZksgjRK.js +1 -0
  90. package/web/dist/assets/{workflows-BD1UEj-z.js → workflows-slzqyi2_.js} +3 -3
  91. package/web/dist/assets/{workspace-tools-CTUdraaY.js → workspace-tools-6fvZHbrZ.js} +1 -1
  92. package/web/dist/assets/worktrees-section-C1fpzChO.js +5 -0
  93. package/web/dist/index.html +25 -26
  94. package/web/dist/assets/accounts-section-DghVB9OC.js +0 -1
  95. package/web/dist/assets/agent-config-section-BwZA2KUT.js +0 -7
  96. package/web/dist/assets/agent-defaults-section-BV6e1x_k.js +0 -1
  97. package/web/dist/assets/appearance-DfQqAytS.js +0 -1
  98. package/web/dist/assets/archive-on-merge-field-ux_-X6cJ.js +0 -1
  99. package/web/dist/assets/attention-CnhIF76m.js +0 -1
  100. package/web/dist/assets/automations-route-BW1xqdPJ.js +0 -2
  101. package/web/dist/assets/collapsible-CW6CfTJO.js +0 -1
  102. package/web/dist/assets/command-DuxcX6Hr.js +0 -1
  103. package/web/dist/assets/commit-list-B1QvE2mb.js +0 -1
  104. package/web/dist/assets/diff-CVDYtR5f.js +0 -3
  105. package/web/dist/assets/discard-changes-dialog-fxi67ueM.js +0 -1
  106. package/web/dist/assets/dist-BS5vYfFC.js +0 -1
  107. package/web/dist/assets/dist-CtdIjNlG.js +0 -1
  108. package/web/dist/assets/dist-DDhqweuB.js +0 -1
  109. package/web/dist/assets/dist-Tubgdd25.js +0 -1
  110. package/web/dist/assets/dist-VPUfzsfL.js +0 -1
  111. package/web/dist/assets/dropdown-menu-BaqO-x7U.js +0 -1
  112. package/web/dist/assets/es2015-DpKptHDx.js +0 -41
  113. package/web/dist/assets/github-DK8q8brO.js +0 -1
  114. package/web/dist/assets/index-CflkzdUL.css +0 -1
  115. package/web/dist/assets/index-Cmj0hLCQ.js +0 -21
  116. package/web/dist/assets/label-eNfbfYFG.js +0 -1
  117. package/web/dist/assets/notifications-section-Bac0sdHD.js +0 -1
  118. package/web/dist/assets/page-shell-CpdYMj52.js +0 -1
  119. package/web/dist/assets/popover-CVo54-aS.js +0 -1
  120. package/web/dist/assets/project-location-CBzVRz73.js +0 -1
  121. package/web/dist/assets/projects-section-i7nQVg42.js +0 -1
  122. package/web/dist/assets/prompt-templates-section-Caje-66x.js +0 -1
  123. package/web/dist/assets/repo-git-Bj603ZUl.js +0 -1
  124. package/web/dist/assets/reports-BdpQw6YT.js +0 -1
  125. package/web/dist/assets/resources-section-DUZUN6C_.js +0 -1
  126. package/web/dist/assets/run-header-yU2n8t1w.js +0 -2
  127. package/web/dist/assets/save-cue-Cd3ZAPBS.js +0 -1
  128. package/web/dist/assets/select-CRYap6qE.js +0 -1
  129. package/web/dist/assets/session-context-section-CYwshrXd.js +0 -119
  130. package/web/dist/assets/settings-field-DP9sYv5a.js +0 -1
  131. package/web/dist/assets/settings-shell-1FhhEiGa.css +0 -1
  132. package/web/dist/assets/settings-shell-CDMj5KA9.js +0 -1
  133. package/web/dist/assets/sidebar-section-Dt5jgm8T.js +0 -1
  134. package/web/dist/assets/switch-DfPCm1H_.js +0 -1
  135. package/web/dist/assets/task-changes-CkQP1FOg.js +0 -1
  136. package/web/dist/assets/task-commits-Ctwi85ad.js +0 -1
  137. package/web/dist/assets/thread-state--bqdO3Qp.js +0 -4
  138. package/web/dist/assets/worktrees-section-HcsME2YD.js +0 -4
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$t as r,Ct as i,Dt as a,Gt as o,It as s,Nt as c,Qt as l,Xt as u,Yt as d,dn as f,dt as p,mt as m,on as h,pt as g,rn as _,ut as v,wt as y,yt as b}from"./queries-ByqTmyCs.js";import{Fn as x,Fr as S,In as C,hi as w,ii as T,n as E,sn as ee,zn as D}from"./toaster-Lf_4oY96.js";import{f as O}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{y as k}from"./design-icons-CzEoMH9c.js";import{t as A}from"./createLucideIcon-BHp8sXmF.js";import{t as te}from"./folder-browser-CK1mNIQi.js";import{t as j}from"./button-C8jUIs8Q.js";import{t as ne}from"./badge-B6B-xYQQ.js";import{a as re,i as ie,o as ae,r as oe,s as se,t as M}from"./dialog-Dbu3HnqC.js";import{t as N}from"./status-dot-BXf-Ubd0.js";import{n as P}from"./agents-settings-path-7X6_cvUg.js";import{t as F}from"./centered-state-BgSV4e79.js";import{A as I,Cn as L,Dn as R,En as z,Gt as B,Jt as V,Kt as H,M as U,P as W,Ut as G,Wt as K,Xt as ce,Yt as le,qt as ue}from"./index-Cmj0hLCQ.js";import{t as q}from"./option-select-C9D7zD0s.js";import{n as J,r as de,t as fe}from"./settings-agent-picker-DrZ3Y_T4.js";import{n as pe,r as me,t as he}from"./remote-settings-notice-CCAvpXI2.js";var ge=A(`id-card`,[[`path`,{d:`M16 10h2`,key:`8sgtl7`}],[`path`,{d:`M16 14h2`,key:`epxaof`}],[`path`,{d:`M6.17 15a3 3 0 0 1 5.66 0`,key:`n6f512`}],[`circle`,{cx:`9`,cy:`11`,r:`2`,key:`yxgjnd`}],[`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`,key:`qneu4z`}]]),Y=e(t(),1),X=n(),_e=`~/.claude-second`;function ve({open:e,onOpenChange:t,providers:n,initialProvider:r}){let i=_().data,[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(r??n[0]??`claude`),[p,h]=(0,Y.useState)(``),[g,v]=(0,Y.useState)(``),[y,b]=(0,Y.useState)(!1),x=m(),S=g.trim();return(0,X.jsx)(M,{open:e,onOpenChange:t,children:(0,X.jsxs)(oe,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(ae,{children:[(0,X.jsx)(se,{children:`Add agent account`}),(0,X.jsx)(ie,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,X.jsx)(q,{"aria-label":`Agent`,"data-slot":`add-account-provider`,value:d,onValueChange:e=>f(e),className:`settings-select max-w-full bg-card text-[13px]`,options:n.map(e=>({value:e,label:u(i,e)}))})]}),(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,X.jsx)(`input`,{type:`text`,"aria-label":`Account name`,"data-slot":`add-account-label`,value:p,placeholder:`Work`,onChange:e=>h(e.target.value),className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,X.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:g,placeholder:l(i,d)?.accountFolderExample??_e,onChange:e=>{v(e.target.value),c(null),x.reset()},className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 font-mono text-[13px] outline-none focus-visible:border-ring`}),(0,X.jsx)(j,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":y,onClick:()=>b(e=>!e),children:y?`Hide folders`:`Browse…`})]}),(0,X.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[`A `,(0,X.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),y?(0,X.jsx)(te,{path:a,selected:s,onSelect:e=>{c(e),v(e.path),x.reset()},onEnter:e=>{o(e),c(null),x.reset()},showHidden:!0,emptyHint:`No subfolders here — pick this folder by typing its path above.`}):null,x.isError?(0,X.jsx)(`p`,{"data-slot":`add-account-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:x.error instanceof Error?x.error.message:`could not add that folder`}):null,(0,X.jsxs)(re,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,X.jsx)(j,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(j,{"data-slot":`add-account-confirm`,disabled:S===``||x.isPending,onClick:()=>{S===``||x.isPending||x.mutate({provider:d,configDir:S,...p.trim()?{label:p.trim()}:{}},{onSuccess:()=>{t(!1),h(``),v(``),c(null),b(!1),E(`Account added — use Connect to sign in`)}})},children:x.isPending?`Adding…`:`Add account`})]})]})})}async function ye(e){return D(await C.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function be(e,t){return D(await C.api.v1[`runner-install`][`:runner`].$post({param:{runner:e},json:{action:t}}),`/runner-install/:runner`)}var xe={idle:``,checking:`Checking for updates…`,downloading:`Downloading CLI…`,verifying:`Verifying CLI…`,extracting:`Extracting CLI…`,activating:`Activating CLI…`,removing:`Removing CLI…`,failed:``};function Se(e){let t=b().data?.capabilities?.settingsAdmin===!0,n=w(),r=[`runner-install`,e],i=T({queryKey:r,queryFn:()=>ye(e),enabled:t,retry:!1,refetchInterval:e=>{if(e.state.error)return!1;let t=e.state.data?.phase;return t&&t!==`idle`&&t!==`failed`?1e3:6e4}}),a=f({mutationFn:t=>be(e,t),retry:!1,onSuccess:e=>{n.setQueryData(r,e)}}),o=i.data;return{allowed:t,data:o,busy:a.isPending||!!o&&o.phase!==`idle`&&o.phase!==`failed`,error:a.error?.message??i.error?.message??o?.error,action:a,status:i}}function Ce({state:e}){let{data:t,busy:n,action:r,status:i}=e;if(t?.supported===!1)return(0,X.jsx)(`p`,{children:`This host is not supported by the CLI installer.`});let a=!!t?.installedVersion;return(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsx)(j,{className:`min-h-11 active:opacity-80`,disabled:n||!t,onClick:()=>r.mutate(a?`update`:`install`),children:a?`Update CLI`:`Install CLI`}),a?(0,X.jsx)(j,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,X.jsx)(j,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>{i.isError?i.refetch():r.mutate(`check`)},children:`Check for updates`})]})}function we({runner:e}){let t=Se(e),{allowed:n,data:r,busy:i,error:a}=t;return n?(0,X.jsxs)(`section`,{"aria-label":`CLI installation`,className:`grid gap-3`,children:[(0,X.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[r?.installedVersion?`Installed CLI ${r.installedVersion}`:`CLI not installed`,r?.latestVersion?` · Latest ${r.latestVersion}`:``,i&&r?` · ${xe[r.phase]}`:``]}),a?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}):null,(0,X.jsx)(Ce,{state:t}),r?.installedVersion?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Removing the CLI keeps account data and lets running tasks finish.`}):null]}):null}var Te={connected:R(`connected`),disconnected:R(`disconnected`),"not-installed":R(`not-installed`),unknown:R(`unknown`)};function Ee(){let e=p(),t=_();if(e.isPending||t.isPending)return(0,X.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agents…`});let n=e.error??t.error;return n?(0,X.jsx)(F,{icon:(0,X.jsx)(ge,{}),tone:`danger`,title:`Agents did not load`,subtitle:n.message,heading:`h2`}):(0,X.jsx)(ke,{data:e.data,runners:t.data})}function De(e){let t=e.replace(/^\/(?:home|Users)\/[^/]+/,`~`),n=t.split(`/`);return n.length>4?`…/${n.slice(-3).join(`/`)}`:t}function Oe(){let{hash:e}=O();(0,Y.useEffect)(()=>{if(!e)return;let t=document.getElementById(decodeURIComponent(e.slice(1)));t&&(t.scrollIntoView?.({block:`start`}),t.focus({preventScroll:!0}))},[e])}function ke({data:e,runners:t}){let n=b(),[r,i]=(0,Y.useState)(null),[o,s]=(0,Y.useState)(null),c=a();return Oe(),me(),(0,X.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsx)(pe,{risk:`Agent accounts run each CLI with the configured host folder`}),e.editable?null:(0,X.jsxs)(`p`,{"data-slot":`accounts-hosted`,className:`text-[13px] text-muted-foreground`,children:[`Agent accounts are read-only on this remote cockpit. Run`,` `,(0,X.jsx)(`code`,{children:he}),` on the host to add, edit, or sign in to accounts here.`]}),(0,X.jsx)(`div`,{"data-slot":`agent-cards`,className:`flex flex-col gap-3`,children:t.runners.map(r=>(0,X.jsx)(Me,{entry:r,check:n.data?.checks?.find(e=>e.name===r.id),settingsAdmin:n.data?.capabilities?.settingsAdmin===!0,runners:t,editable:e.editable,accounts:e.profiles.filter(e=>e.provider===r.id),canCarryAccounts:e.profileCapableProviders.includes(r.id),onAdd:()=>i(r.id),onRemove:s},r.id))}),(0,X.jsx)(Ne,{runners:t}),r===null?null:(0,X.jsx)(ve,{open:!0,onOpenChange:e=>!e&&i(null),providers:e.profileCapableProviders,initialProvider:r},r),(0,X.jsx)(G,{open:o!==null,onOpenChange:e=>!e&&s(null),children:(0,X.jsxs)(H,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(le,{children:[(0,X.jsxs)(ce,{children:[`Remove “`,o?.label,`”?`]}),(0,X.jsxs)(ue,{children:[`This only forgets the account. Nothing in `,o?.configDir??`this account’s folder`,` is deleted — not your login, not your sessions. Projects using it fall back to the default account, and tasks that ran under it can no longer be resumed from here.`]})]}),(0,X.jsxs)(V,{children:[(0,X.jsx)(B,{children:`Cancel`}),(0,X.jsx)(K,{"data-action":`accounts-remove-confirm`,disabled:c.isPending,onClick:()=>{let e=o;e&&c.mutate(e.id,{onSuccess:()=>{s(null),E(`Removed ${e.label}`)},onError:e=>E(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]})}function Z({entry:e,check:t}){return t===void 0?(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:`Checking CLI…`}):t.available?(0,X.jsxs)(`span`,{className:`whitespace-nowrap`,children:[(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:z(t.version)?`CLI simulated`:`CLI installed`}),t.version?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}),(0,X.jsx)(Ae,{version:t.version})]}):null]}):(0,X.jsxs)(`span`,{"data-slot":`agent-installed`,children:[`CLI not installed`,e.installHint?(0,X.jsxs)(X.Fragment,{children:[` — `,(0,X.jsx)(`code`,{className:`break-all`,children:e.installHint})]}):null]})}function Ae({version:e}){return z(e)?(0,X.jsx)(`span`,{"data-slot":`agent-version`,"data-dry-run":``,title:e,className:`rounded-full border border-border bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground`,children:L.label}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`sr-only`,children:`, version `}),(0,X.jsx)(`span`,{"data-slot":`agent-version`,className:`text-muted-foreground`,children:e})]})}function je({items:e}){let t=e.filter(e=>e!=null&&e!==!1);return t.length===0?null:(0,X.jsx)(`p`,{"data-slot":`agent-summary`,className:`settings-agent-summary`,children:t.map((e,t)=>(0,X.jsxs)(`span`,{className:`settings-agent-summary-item`,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}):null,e]},t))})}function Q({titleId:e,title:t,summary:n,actions:r,actionsSlot:i}){return(0,X.jsxs)(`div`,{"data-slot":`agent-head`,className:`settings-agent-head`,children:[(0,X.jsxs)(`div`,{className:`settings-agent-heading`,children:[(0,X.jsx)(`h3`,{id:e,className:`settings-account-provider-title`,children:t}),(0,X.jsx)(je,{items:n})]}),r?(0,X.jsx)(`div`,{"data-slot":i,className:`settings-account-actions`,children:r}):null]})}function Me({entry:e,check:t,settingsAdmin:n,runners:r,editable:i,accounts:a,canCarryAccounts:o,onAdd:s,onRemove:c}){let l=e.id,u=e.displayName,d=e.managedInstall===!0&&n,f=a.filter(e=>e.isDefault).length,p=`${P(l)}-title`,m=i&&o?(0,X.jsx)(j,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":l,onClick:s,children:`Add account`}):null,h={titleId:p,title:u,facts:[d?null:(0,X.jsx)(Z,{entry:e,check:t}),i||a.length>0?(0,X.jsxs)(`span`,{className:`settings-account-count`,title:`${f} discovered, ${a.length-f} added`,children:[a.length,` `,a.length===1?`account`:`accounts`]}):null],addButton:m},[g,..._]=a;return(0,X.jsxs)(`section`,{id:P(l),tabIndex:-1,"aria-labelledby":p,"data-slot":`accounts-provider`,"data-provider":l,className:`settings-agent-card flex flex-col rounded-lg border border-border bg-card`,children:[g===void 0?(0,X.jsx)(Q,{titleId:p,title:u,summary:h.facts,actions:m,actionsSlot:`accounts-actions`}):null,d?(0,X.jsx)(we,{runner:l}):null,g===void 0?null:(0,X.jsxs)(`ul`,{className:`settings-agent-accounts`,children:[(0,X.jsx)($,{account:g,runners:r,editable:i,onRemove:()=>c(g),agent:h}),_.map(e=>(0,X.jsx)($,{account:e,runners:r,editable:i,onRemove:()=>c(e)},e.id))]}),i&&!o?(0,X.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`settings-agent-note`,children:[`One account only: `,u,` keeps its login outside its config folder, so a second folder would change settings without changing who is billed.`]}):!i&&a.length===0&&e.browserLogin?(0,X.jsxs)(`div`,{"data-slot":`hosted-sign-in`,className:`settings-agent-note flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(`span`,{children:`Discovered account`}),(0,X.jsx)(J,{provider:l,label:u})]}):null]})}function Ne({runners:e}){let[t,n]=(0,Y.useState)(null),a=w(),c=s(),l=i(),u=h(r(e)),p=f({mutationFn:e=>ee(e),onSuccess:e=>a.setQueryData(o.config,e),onError:e=>E(e.message,{tone:`danger`})});if(c.data===void 0)return null;let m=de([],e),g=c.data.agentDefaults.runner??`claude`,_=d(t??g,r(e))??t??g,v=c.data.agentDefaults.models??{};return(0,X.jsxs)(`section`,{"data-slot":`accounts-defaults`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card/40 p-3.5`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`What a project runs when it has not chosen for itself — set once instead of per repository. A project that has chosen keeps its own.`})]}),(0,X.jsx)(fe,{rows:m,runner:g,accountFor:()=>null,providerStatus:l,disabled:p.isPending,onPick:e=>{e!==g&&p.mutate({agentDefaults:{runner:e}})}}),(0,X.jsxs)(`div`,{className:`settings-account-models flex flex-col gap-2`,children:[(0,X.jsxs)(`label`,{className:`settings-model-agent-choice`,children:[(0,X.jsx)(`span`,{children:`Default model for`}),(0,X.jsx)(q,{"aria-label":`Model agent`,className:`settings-select max-w-full`,value:_,onValueChange:e=>n(e),options:e.runners.map(e=>({value:e.id,label:e.displayName}))})]}),e.runners.filter(e=>e.id===_).map(t=>(0,X.jsxs)(`label`,{className:`settings-account-model flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(k,{className:`size-4 text-accent-icon shrink-0`}),(0,X.jsx)(`span`,{className:`w-28 shrink-0 text-xs text-muted-foreground`,children:t.displayName}),(0,X.jsx)(q,{"aria-label":`Default model for ${t.pickerLabel}`,"data-slot":`accounts-default-model`,"data-runner":t.id,value:v[t.id]??``,disabled:p.isPending,onValueChange:e=>p.mutate({agentDefaults:{models:{[t.id]:e||null}}}),className:`settings-select w-64 max-w-full bg-card`,options:[...W(t.id,e,u[t.id]?.data,[v[t.id]]).map(e=>({value:e.id,label:e.id===``?`Native default`:e.label})),...Pe(t.id,e,u[t.id])]})]},t.id))]})]})}function Pe(e,t,n){let r=U(e,t,n);return r?[{value:I,label:r,disabled:!0}]:[]}function Fe({account:e,runners:t,status:n,editable:r}){let i=g();return(0,X.jsxs)(X.Fragment,{children:[n&&n.status!==`connected`&&l(t,e.provider)?.browserLogin?(0,X.jsx)(J,{provider:e.provider,...e.isDefault?{}:{profileId:e.id},label:e.label}):null,r&&n&&n.status!==`connected`&&l(t,e.provider)?.terminalLogin!==!1?(0,X.jsx)(j,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:i.isPending,onClick:()=>i.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>E(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>E(e instanceof x&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}):null]})}function Ie(e,t,n,r){return!n||n.requiresAccountHome===!1?null:e.exists?!e.looksValid&&e.configDir?{slot:`account-unrecognised`,label:`Unrecognized folder`,guidance:`This folder does not look like ${u(t,e.provider)} config yet.`}:null:{slot:`account-missing`,label:`Not initialized`,guidance:r?n.status===`connected`?`Folder not created yet. Use Check again to refresh.`:`Folder not created yet. Connect will make it.`:`Folder not created on the host yet.`}}function $({account:e,runners:t,editable:n,onRemove:r,agent:i}){let a=S(e),o=y(),s=v(a,e.status===void 0),c=e.status??s.data?.status,l=c?Te[c.status]:void 0,u=Ie(e,t,c,n),d=u?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:l?`Sign-in: ${l.label}`:void 0,children:[(0,X.jsx)(N,{tone:`pending`}),(0,X.jsx)(`span`,{"data-slot":u.slot,className:`text-foreground`,children:u.label})]}):(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,X.jsx)(N,{tone:l?.tone??`neutral`,pulse:l===void 0}),(0,X.jsx)(`span`,{"data-slot":`account-status`,className:`text-foreground`,children:l?.label??`Checking…`})]}),f=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Fe,{account:e,runners:t,status:c,editable:n}),(0,X.jsx)(j,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-recheck`,disabled:o.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>o.mutate(a,{onError:e=>E(e.message,{tone:`danger`})}),children:`Check again`})]}),p=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`settings-account-label`,children:e.label}),e.isDefault?(0,X.jsx)(ne,{variant:`outline`,"data-slot":`account-discovered`,className:`shrink-0 text-xs font-normal text-muted-foreground`,children:`discovered`}):null]}),m=e.configDir?(0,X.jsx)(`span`,{"data-slot":`account-path`,className:`settings-account-path`,title:e.path,children:De(e.configDir)}):null,h=u?(0,X.jsx)(`p`,{"data-slot":`account-folder-guidance`,className:`settings-account-hint`,children:u.guidance}):null,g=c?.hint?(0,X.jsx)(`p`,{className:`settings-account-hint`,children:c.hint}):null,_=n&&!e.isDefault?(0,X.jsx)(Le,{account:e,onRemove:r}):null,b=(0,X.jsxs)(`div`,{className:`settings-account-readout`,children:[(0,X.jsxs)(`div`,{className:`settings-account-meta-line`,children:[p,d]}),m,h,g]});return i?(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,"data-primary":``,className:`settings-account-primary`,children:[(0,X.jsx)(Q,{titleId:i.titleId,title:i.title,summary:i.facts,actions:(0,X.jsxs)(X.Fragment,{children:[f,i.addButton]}),actionsSlot:`account-actions`}),(0,X.jsxs)(`div`,{className:`settings-account-meta`,children:[b,_?(0,X.jsx)(`div`,{className:`settings-account-actions`,children:_}):null]})]}):(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`settings-account-line`,children:[b,(0,X.jsxs)(`div`,{"data-slot":`account-actions`,className:`settings-account-actions`,children:[f,_]})]})}function Le({account:e,onRemove:t}){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(e.label),o=c();return(0,X.jsx)(X.Fragment,{children:e.isDefault?null:(0,X.jsx)(`div`,{"data-slot":`account-manage`,className:`settings-account-management`,children:n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:i,onChange:e=>a(e.target.value),className:`w-48 rounded-md border border-input bg-card px-2 py-1 text-xs outline-none focus-visible:border-ring`}),(0,X.jsx)(j,{type:`button`,size:`sm`,"data-action":`account-rename-save`,disabled:o.isPending||i.trim()===``||i.trim()===e.label,onClick:()=>o.mutate({id:e.id,label:i.trim()},{onSuccess:()=>r(!1),onError:e=>E(e.message,{tone:`danger`})}),children:`Save`}),(0,X.jsx)(j,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(j,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,X.jsx)(j,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:t,children:`Remove account`}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what Squawk calls this account, not its folder.`})]})})})}export{Ee as GlobalAgentsSection};
@@ -1,7 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{$t as i,Wt as a,Zt as o,g as s,h as c,rn as l,x as u,yt as d}from"./queries-ByqTmyCs.js";import{Fn as f,hi as p,n as m}from"./toaster-Lf_4oY96.js";import{t as h}from"./button-C8jUIs8Q.js";import{t as g}from"./badge-B6B-xYQQ.js";import{t as _}from"./centered-state-BgSV4e79.js";import{hn as v,j as y,ur as b}from"./index-Cmj0hLCQ.js";import{n as x,r as S,t as C}from"./remote-settings-notice-CCAvpXI2.js";import{t as w}from"./code-editor-GfQChdgl.js";import{t as T}from"./discard-changes-dialog-fxi67ueM.js";var E=e(t(),1);function D(e){return t=>t.runners.includes(e)}function O(e,t){let n=D(e);return e=>n(e)&&e.kind===t}function k(e){let{label:t,note:n,groups:r}=e.agentConfig;return{id:e.id,label:t,note:n,groups:r.map(({id:t,label:n,note:r,empty:i,showsUserMcp:a})=>({id:t,label:n,note:r,...i?{empty:i}:{},...a?{showsUserMcp:a}:{},files:O(e.id,t)}))}}function A(e){return o(e).map(k)}var j=n();function M(e){return e.seeded?`Copied into each run’s worktree — takes effect on your next run.`:e.tracked===`tracked`?`Runs read the committed copy — this edit applies after you commit it.`:e.tracked===`outside-repo`?`Applies to every session on this machine.`:`Personal, git-ignored.`}function N(){let e=c(),t=S(),n=d(),r=l(),a=r.data,o=(0,E.useMemo)(()=>A(a),[a]),s=(0,E.useMemo)(()=>n.data?y(n.data.checks,a):i(a),[n.data,a]);return r.isError?(0,j.jsx)(_,{icon:(0,j.jsx)(b,{}),tone:`danger`,title:`Runners did not load`,subtitle:r.error.message,heading:`h2`}):e.isError?(0,j.jsx)(_,{icon:(0,j.jsx)(b,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):e.isPending||a===void 0?(0,j.jsx)(`p`,{"data-slot":`agent-config-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent config…`}):(0,j.jsx)(P,{listing:e.data,descriptors:o,installed:s,onOpenFile:t})}function P({listing:e,descriptors:t,installed:n,onOpenFile:i}){let[a,o]=(0,E.useState)(`claude`),[s,c]=(0,E.useState)(null),[l,u]=(0,E.useState)(!1),[d,f]=(0,E.useState)(null),p=t.find(e=>e.id===a)??t[0];if(p===void 0)return null;let m=F(p,e),h=m.find(e=>e.id===s)??I(m),_=e=>{l?f(()=>e):e()},v=e=>{e!==p.id&&_(()=>{o(e),c(null)})};return(0,j.jsxs)(`div`,{"data-slot":`agent-config`,className:`flex flex-col gap-5 p-4 md:p-6`,children:[(0,j.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Edit project, local, and user-wide config files for each coding agent.`}),!e.editable&&(0,j.jsxs)(`div`,{"data-slot":`agent-config-readonly`,className:`rounded-md border border-border bg-muted/40 px-3 py-2 text-[13px] text-muted-foreground`,children:[`Read-only: this remote cockpit cannot edit agent config. You can still see every file and which one wins. To edit here, the host operator runs `,(0,j.jsx)(`code`,{children:C}),`.`]}),(0,j.jsx)(x,{risk:`Agent config can define hooks and MCP servers that run commands on the machine running Squawk`}),(0,j.jsx)(`div`,{"data-slot":`agent-config-agents`,role:`tablist`,className:`flex flex-wrap gap-1`,children:t.map(e=>(0,j.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===p.id,"data-slot":`agent-config-agent`,"data-agent":e.id,"data-selected":e.id===p.id,onClick:()=>v(e.id),className:r(`flex min-w-11 items-center justify-center gap-2 rounded-md px-3 py-1.5 text-[13px] transition-colors`,e.id===p.id?`bg-background font-semibold shadow-sm`:`hover:bg-muted/60`),children:[e.label,!n.includes(e.id)&&(0,j.jsx)(g,{variant:`outline`,className:`text-xs text-soft-foreground`,children:`Not installed`})]},e.id))}),p.note&&(0,j.jsx)(`p`,{"data-slot":`agent-config-agent-note`,className:`text-xs text-muted-foreground`,children:p.note}),(0,j.jsxs)(`div`,{className:`grid min-w-0 gap-6 lg:grid-cols-[minmax(17rem,24rem)_minmax(0,1fr)]`,children:[(0,j.jsx)(`nav`,{"data-slot":`agent-config-nav`,className:`flex min-w-0 flex-col gap-5`,children:(0,j.jsx)(z,{agent:p,listing:e,selectedId:h?.id??null,onSelect:e=>{if(e===h?.id){i();return}_(()=>{c(e),i()})}})}),(0,j.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,className:`min-w-0`,children:h?(0,j.jsx)(V,{file:h,onDirtyChange:u},h.id):(0,j.jsx)(`p`,{"data-slot":`agent-config-editor-empty`,className:`rounded-md border border-border bg-muted/40 px-4 py-3 text-[13px] text-soft-foreground`,children:`This agent has no config files to show.`})})]}),(0,j.jsx)(T,{open:d!==null,subject:h?.label??`this file`,onKeep:()=>f(null),onDiscard:()=>{let e=d;f(null),u(!1),e?.()}})]})}function F(e,t){return e.groups.flatMap(e=>t.files.filter(e.files))}function I(e){return e.find(e=>e.scope===`project`)??e[0]??null}var L={project:`Project scope`,local:`Local scope`,user:`User scope`};function R(e,t){for(let n of t){if(!n.label.startsWith(`~/`))continue;let t=n.label.slice(1);if(!n.path.endsWith(t))continue;let r=n.path.slice(0,n.path.length-t.length);if(r&&(e===r||e.startsWith(`${r}/`)))return`~${e.slice(r.length)}`}return e.replace(/^\/(?:home|Users)\/[^/]+(?=\/|$)/,`~`)}function z({agent:e,listing:t,selectedId:n,onSelect:i}){return(0,j.jsx)(j.Fragment,{children:e.groups.map(a=>{let o=t.files.filter(a.files),s=a.showsUserMcp?t.userMcp:void 0;return o.length===0&&!s&&!a.empty?null:(0,j.jsxs)(`section`,{"data-slot":`agent-config-group`,"data-group":a.id,"data-agent":e.id,children:[(0,j.jsx)(`p`,{className:`mb-1 text-xs font-medium uppercase tracking-wide text-soft-foreground`,children:a.label}),a.note&&(0,j.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:a.note}),o.length===0&&a.empty&&(0,j.jsx)(`p`,{"data-slot":`agent-config-group-empty`,className:`rounded-md border border-dashed border-border px-3 py-2 text-xs text-muted-foreground`,children:a.empty}),(0,j.jsx)(`ul`,{className:`flex flex-col gap-1`,children:o.map(e=>(0,j.jsx)(`li`,{children:(0,j.jsxs)(`button`,{type:`button`,"data-slot":`agent-config-file`,"data-selected":e.id===n,onClick:()=>i(e.id),title:e.label,className:r(`flex w-full flex-col items-start gap-1 rounded-md px-2 py-1.5 text-left text-[13px] transition-colors`,e.id===n?`bg-accent-strong/15 text-foreground`:`hover:bg-muted/60`),children:[(0,j.jsx)(`span`,{"data-slot":`agent-config-file-name`,className:`min-w-0 max-w-full break-all font-mono text-[12px]`,children:e.label}),e.seeded||!e.exists?(0,j.jsxs)(`span`,{"data-slot":`agent-config-file-meta`,className:`flex flex-wrap items-center gap-1.5`,children:[e.seeded&&(0,j.jsx)(g,{variant:`outline`,className:`text-xs`,children:`Default template`}),!e.exists&&(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Not created`})]}):null]})},e.id))}),s&&(0,j.jsx)(B,{userMcp:s,path:R(s.path,t.files)})]},a.id)})})}function B({userMcp:e,path:t}){return(0,j.jsxs)(`div`,{"data-slot":`agent-config-user-mcp`,className:`mt-3`,children:[(0,j.jsx)(`h4`,{className:`mb-1 text-[12px] font-semibold`,children:`User & local scopes`}),(0,j.jsxs)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:[`Managed by `,(0,j.jsx)(`code`,{"data-slot":`agent-config-user-mcp-command`,className:`whitespace-nowrap font-mono`,children:`claude mcp add`}),` in`,` `,(0,j.jsx)(`code`,{"data-slot":`agent-config-user-mcp-path`,title:e.path,className:`break-all font-mono text-foreground`,children:t}),` — Squawk does not edit Claude’s state file.`]}),e.readable?e.servers.length>0?(0,j.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:e.servers.map(e=>(0,j.jsx)(`li`,{children:(0,j.jsx)(g,{variant:`outline`,className:`font-mono text-xs`,children:e})},e))}):(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No user-scoped MCP servers.`}):(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Could not read the file.`})]})}function V({file:e,onDirtyChange:t}){let n=s(e.id),[r,i]=(0,E.useState)(null),[a,o]=(0,E.useState)(!1),[c,l]=(0,E.useState)(null),u=n.data?.version??null,d=r??n.data?.content??``,f=n.data?d!==n.data.content:!1,p=e.writable,m=e.kind===`mcp`||e.holdsMcp,h=p&&f;v(h),(0,E.useEffect)(()=>{t?.(h)},[h,t]),(0,E.useEffect)(()=>()=>t?.(!1),[t]);let{save:_,isSaving:y}=q({file:e,content:d,loadedVersion:u,setDraft:i,setConflict:o,setFormatError:l});return(0,E.useEffect)(()=>{n.data&&(i(n.data.content),o(!1),l(null))},[n.data?.version,n.data]),(0,j.jsxs)(`div`,{"data-slot":`settings-config-editor`,"data-reports-dirty":``,className:`flex flex-col gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,j.jsx)(`h3`,{className:`text-sm`,children:`Configuration file`}),(0,j.jsx)(g,{variant:`outline`,"data-slot":`agent-config-scope`,"data-scope":e.scope,className:`text-[12px]`,children:L[e.scope]})]}),(0,j.jsx)(`p`,{"data-slot":`agent-config-path`,title:e.path,className:`font-mono text-xs text-foreground`,children:R(e.path,[e])}),(0,j.jsxs)(`div`,{className:`settings-readout flex flex-wrap items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.label}),(0,j.jsx)(g,{variant:`outline`,className:`text-[12px] uppercase`,children:e.format}),(0,j.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[12px] text-soft-foreground underline hover:text-foreground`,children:`docs`})]}),(0,j.jsxs)(`div`,{className:`settings-config-content-heading`,children:[(0,j.jsx)(`h3`,{children:m?`MCP configuration`:`File contents`}),m&&(0,j.jsx)(`p`,{children:`Review server commands before saving. MCP servers execute locally.`})]}),n.isPending?(0,j.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading file…`}):n.isError?(0,j.jsx)(`p`,{className:`text-[13px] text-destructive`,children:n.error.message}):(0,j.jsx)(H,{file:e,content:d,isMcp:m,onChange:i}),(0,j.jsx)(G,{formatError:c,conflict:a,onReload:()=>void n.refetch()}),p&&(0,j.jsx)(U,{exists:e.exists,dirty:f,isSaving:y,onSave:_,onReset:()=>i(null)}),(0,j.jsxs)(`div`,{className:`settings-config-save-help`,children:[(0,j.jsx)(`p`,{"data-slot":`agent-config-precedence`,className:`text-xs text-muted-foreground`,children:e.precedence}),(0,j.jsxs)(`p`,{"data-slot":`agent-config-effect`,className:`text-xs text-foreground`,children:[M(e),e.hotReload?` ${e.hotReload}`:``]}),(0,j.jsx)(K,{reason:e.readOnlyReason})]})]})}function H({file:e,content:t,isMcp:n,onChange:r}){return(0,j.jsxs)(`div`,{"data-slot":`agent-config-editor-frame`,className:`relative`,children:[(0,j.jsx)(w,{value:t,language:e.format,readOnly:!e.writable,onChange:r,"aria-label":`${e.label} contents`,className:`h-[210px]`}),!e.exists&&t===``&&(0,j.jsx)(`pre`,{"data-slot":`agent-config-placeholder`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-px m-0 overflow-hidden whitespace-pre px-3 py-2 font-mono text-xs leading-[1.7] text-soft-foreground`,children:W(e,n)})]})}function U({exists:e,dirty:t,isSaving:n,onSave:r,onReset:i}){return(0,j.jsxs)(`div`,{className:`settings-form-actions`,children:[(0,j.jsx)(h,{size:`sm`,onClick:r,disabled:!t||n,children:e?`Save file`:`Create file`}),(0,j.jsx)(h,{size:`sm`,variant:`outline`,onClick:i,disabled:!t||n,children:`Reset`}),!n&&(0,j.jsx)(`span`,{"data-slot":`agent-config-save-cue`,className:`self-center text-xs text-muted-foreground`,children:t?`Unsaved changes`:e?`No unsaved changes`:`Enter content above to create this file`})]})}function W(e,t){switch(e.format){case`json`:case`jsonc`:return`// File not created yet — example:\n${t?`{
2
- "mcpServers": {}
3
- }`:`{
4
- "permissions": {}
5
- }`}`;case`markdown`:return`<!-- File not created yet — write instructions here -->`;case`toml`:return`# File not created yet — example:
6
- # key = "value"`;case`yaml`:return`# File not created yet — example:
7
- # key: value`}}function G({formatError:e,conflict:t,onReload:n}){return(0,j.jsxs)(j.Fragment,{children:[e&&(0,j.jsx)(`p`,{"data-slot":`agent-config-format-error`,className:`text-[12px] text-destructive`,children:e}),t&&(0,j.jsxs)(`div`,{"data-slot":`agent-config-conflict`,className:`flex items-center justify-between gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px]`,children:[(0,j.jsx)(`span`,{children:`The file changed on disk since you opened it.`}),(0,j.jsx)(h,{size:`sm`,variant:`outline`,onClick:n,children:`Reload from disk`})]})]})}function K({reason:e}){return e&&(0,j.jsx)(`p`,{children:e})}function q({file:e,content:t,loadedVersion:n,setDraft:r,setConflict:i,setFormatError:o}){let s=u(e.id),c=p(),l=S();return{save:()=>{o(null),i(!1),s.mutate({content:t,version:n},{onSuccess:()=>{r(null),m(`${e.exists?`Saved`:`Created`} ${e.label}`)},onError:e=>{e instanceof f&&e.status===409?l().then(()=>{c.getQueryData(a.health)?.capabilities.settingsAdmin===!1?m(e.message,{tone:`danger`}):i(!0)}):e instanceof f&&e.status===400?o(e.message):m(e.message,{tone:`danger`})}})},isSaving:s.isPending}}export{N as AgentConfigSection};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$t as r,At as i,C as a,Ct as o,Gt as s,St as c,Tt as l,Wt as u,Xt as d,Zt as f,_ as p,an as m,dn as h,dt as g,jt as _,on as v,rn as y}from"./queries-ByqTmyCs.js";import{Fn as b,Jt as ee,P as x,Tr as S,a as C,hi as w,hn as T,n as E}from"./toaster-Lf_4oY96.js";import{s as D}from"./design-icons-CzEoMH9c.js";import{t as O}from"./button-C8jUIs8Q.js";import{t as k}from"./switch-DfPCm1H_.js";import{t as A}from"./status-dot-BXf-Ubd0.js";import{t as j}from"./centered-state-BgSV4e79.js";import{A as M,Dn as N,M as te,P as ne,hn as re,vn as P}from"./index-Cmj0hLCQ.js";import{t as F}from"./textarea-vEsJAUAV.js";import{t as I}from"./option-select-C9D7zD0s.js";import{a as L,i as R,n as z,r as B,t as V}from"./settings-agent-picker-DrZ3Y_T4.js";import{n as H}from"./saved-draft-BwzBc-_Y.js";import{t as U}from"./save-cue-Cd3ZAPBS.js";var W=e(t(),1),G=n(),K={connected:N(`connected`),disconnected:N(`disconnected`),"not-installed":N(`not-installed`),unknown:N(`unknown`)};function q(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function J(e,t){return e?K[e]:t?{label:`Checking…`,tone:`neutral`}:K.unknown}function Y(e,t){return e===`unknown`||t&&!e}function ie({provider:e,state:t,current:n,statusIsError:r}){return t===`not-installed`?(0,G.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,e.displayName,`, then run `,(0,G.jsx)(`code`,{children:e.loginCommand}),`.`]}):Y(t,r)?(0,G.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Verification failed. Check again when the provider is available.`}):n?.hint?(0,G.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:n.hint}):null}function ae({provider:e,state:t,current:n,isConnecting:r,incidentId:i,refresh:a,connect:o,retry:s,queueToggle:c}){let l=t===`disconnected`||t===`unknown`;return(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t===`not-installed`?null:(0,G.jsx)(k,{checked:n?.enabled??!0,"aria-label":`Use ${e.displayName}`,onCheckedChange:t=>c(e.id,t)}),l?(0,G.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,disabled:a.isPending,onClick:()=>a.mutate(void 0,{onError:e=>E(e.message,{tone:`danger`})}),children:`Check again`}):null,t===`disconnected`&&e.browserLogin?(0,G.jsx)(z,{provider:e.id,label:e.displayName}):null,t===`disconnected`&&e.terminalLogin!==!1?(0,G.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(e.id),children:r?`Opening…`:`Connect`}):null,i===void 0?null:(0,G.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,disabled:s.isPending,onClick:()=>s.mutate({provider:e.id,authFailureId:i},{onSuccess:()=>E(`${e.displayName} can be tried again.`),onError:e=>E(e.message,{tone:`danger`})}),children:`Try again`})]})}function oe({manual:e,provider:t,connected:n,onCopy:r}){return e===null||e.provider!==t||n?null:(0,G.jsxs)(`div`,{role:`region`,"aria-label":`${e.label} manual sign-in`,className:`rounded-md border border-pending/40 bg-pending/5 px-3.5 py-3`,children:[(0,G.jsx)(`p`,{className:`text-[13px] text-foreground`,children:e.message}),(0,G.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded-sm bg-muted px-2 py-1.5 text-xs`,children:e.command}),(0,G.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void r(e.command),children:`Copy command`})]})]})}function se(){let e=y(),t=o(),n=l(),r=i(),a=w(),[c,u]=(0,W.useState)(null),p=(0,W.useRef)(Promise.resolve()),g=(0,W.useRef)({}),_=(0,W.useRef)({}),v=(0,W.useRef)(t.data);(0,W.useEffect)(()=>{c&&S(t.data,c.provider)?.status===`connected`&&u(null)},[c,t.data]),(0,W.useEffect)(()=>{if(t.data){if(Object.values(_.current).every(e=>e===0)||!v.current){v.current=t.data;return}v.current={providers:t.data.providers.map(e=>({...e,enabled:(_.current[e.provider]??0)>0?S(v.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[t.data]);let x=(0,W.useCallback)((e,t)=>{let n=s.providerStatus,r=a.getQueryData(n);if(!r)return;v.current||=r;let i=q(r,e,t);_.current[e]=(_.current[e]??0)+1,a.setQueryData(n,i);let o=(g.current[e]??0)+1;g.current[e]=o,p.current=p.current.then(async()=>{try{let r=await T(e,t),i=S(r,e)?.enabled;if(i===void 0)return;if(v.current=q(v.current??r,e,i),o===g.current[e]){let t=a.getQueryData(n);a.setQueryData(n,t?q(t,e,i):r)}}catch(t){if(o===g.current[e]){let r=S(v.current,e)?.enabled,i=a.getQueryData(n);i&&r!==void 0?a.setQueryData(n,q(i,e,r)):v.current?a.setQueryData(n,v.current):a.removeQueries({queryKey:n,exact:!0}),E(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{_.current[e]=(_.current[e]??0)-1}})},[a]),C=h({mutationFn:e=>ee(e),onSuccess:async(e,t)=>{u(null),E(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await a.invalidateQueries({queryKey:s.providerStatus}),await m(a,t,`none`)},onError:(t,n)=>{if(t instanceof b&&t.command){let r=d(e.data,n);u({provider:n,label:r,message:t.message,command:t.command});return}E(t.message,{tone:`danger`})}}),D=async e=>{try{await navigator.clipboard.writeText(e),E(`Command copied`)}catch{E(`Could not copy the command`,{tone:`danger`})}};return(0,G.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,G.jsxs)(`div`,{className:`mb-2`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,G.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),t.isError?(0,G.jsxs)(`div`,{role:`alert`,className:`mb-3 flex flex-wrap items-center justify-between gap-2 rounded-md border border-danger/30 bg-danger/5 px-3 py-2.5`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.error.message})]}),(0,G.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,disabled:t.isFetching,onClick:()=>void t.refetch(),children:`Retry`})]}):null,(0,G.jsx)(`div`,{className:`flex flex-col gap-2`,children:f(e.data).map(e=>{let i=S(t.data,e.id),a=i?.status,o=J(a,t.isPending),s=C.isPending&&C.variables===e.id,l=i?.authFailureId;return(0,G.jsxs)(W.Fragment,{children:[(0,G.jsxs)(`div`,{"data-slot":`provider-card`,"data-provider":e.id,className:`rounded-md border border-border bg-card px-3.5 py-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:e.displayName}),(0,G.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,G.jsx)(A,{tone:o.tone,pulse:t.isPending}),(0,G.jsx)(`span`,{children:o.label}),i?.enabled===!1?(0,G.jsx)(`span`,{children:`Disabled`}):null]}),(0,G.jsx)(ie,{provider:e,state:a,current:i,statusIsError:t.isError})]}),(0,G.jsx)(ae,{provider:e,state:a,current:i,isConnecting:s,incidentId:l,refresh:n,connect:C,retry:r,queueToggle:x})]}),l===void 0?null:(0,G.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Use this after completing the provider sign-in flow. Squawk cannot validate the credential without a task/model request; it will verify it on the next task.`})]}),(0,G.jsx)(oe,{manual:c,provider:e.id,connected:a===`connected`,onCopy:D})]},e.id)})})]})}var X=2e4;function ce(){let e=p(),t=y(),n=v(r(t.data)),i=o();return e.isPending?(0,G.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,G.jsx)(j,{icon:(0,G.jsx)(D,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,G.jsx)(Z,{config:e.data,catalogs:n,providerStatus:i,runners:t.data})}function Z({config:e,catalogs:t,providerStatus:n,runners:r}){let i=a(),o=w(),s=h({mutationFn:e=>x(e),onSuccess:e=>{o.setQueryData(u.config,e),o.invalidateQueries({queryKey:u.health}),o.invalidateQueries({queryKey:u.repo})},onError:e=>E(e.message,{tone:`danger`})}),[c,l]=H(e.systemPrompt??``),d=c.trim(),p=d===(e.systemPrompt??``),m=d.length>X;return re(!p),(0,G.jsxs)(`div`,{"data-slot":`agent-defaults-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,G.jsx)(le,{defaultRunner:e.defaultRunner,providerStatus:n,saving:s.isPending,onPick:e=>s.mutate({defaultRunner:e})}),(0,G.jsx)(Q,{title:`Default model`,hint:e.modelsLocked?`Models are locked to the defaults configured in the native coding-agent settings.`:`The model preselected in the composer for each runner. Auto lets the runner decide per task.`,children:(0,G.jsx)(`div`,{"data-slot":`agents-model-rows`,className:`flex flex-col gap-2.5`,children:f(r).map(i=>{let{providerConnected:a,providerReason:o}=L(n,i.id),c=t[i.id],l=te(i.id,r,c),u=ne(i.id,r,c?.data,[e.defaultModels[i.id]]),d=e.defaultModels[i.id]??``,f=u.find(e=>e.id===d)?.label??d??`auto (default)`;return(0,G.jsxs)(`label`,{className:`settings-option-row`,children:[(0,G.jsx)(`div`,{children:(0,G.jsx)(`h3`,{children:i.displayName})}),e.modelsLocked?(0,G.jsx)(`output`,{"aria-label":`Default model for ${i.pickerLabel}`,"data-slot":`agents-model`,"data-runner":i.id,title:`Model selection is locked to native coding-agent settings.`,className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs`,children:f}):(0,G.jsx)(I,{"aria-label":`Default model for ${i.pickerLabel}`,"data-slot":`agents-model`,"data-runner":i.id,value:d,title:o??i.pickerDescription,disabled:s.isPending||!a,onValueChange:e=>s.mutate({defaultModels:{[i.id]:e||null}}),className:`settings-select max-w-full bg-card`,options:[...u.map(e=>({value:e.id,label:e.id===``?`Native agent default`:e.label})),...l?[{value:M,label:l,disabled:!0}]:[]]})]},i.id)})})}),(0,G.jsxs)(Q,{title:`System prompt`,hint:`Extra instructions for every run in this project.`,reportsDirty:!0,children:[(0,G.jsx)(F,{"aria-label":`System prompt`,"data-slot":`agents-system-prompt`,value:c,onChange:e=>l(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-48 w-full`}),(0,G.jsx)(ue,{length:d.length,overLimit:m,saved:p,pending:s.isPending,onSave:()=>s.mutate({systemPrompt:d===``?null:d},{onSuccess:()=>E(d===``?`System prompt cleared`:`System prompt saved`)})})]}),(0,G.jsxs)(`section`,{"data-slot":`agents-task-runs`,className:`settings-field flex flex-col gap-5`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Task runs`}),(0,G.jsx)($,{title:`Live title updates`,hint:`Refresh a task's short title through the namer model as the run progresses. A manual rename always wins and stops updates for that task.`,children:(0,G.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,G.jsx)(k,{"aria-label":`Live title updates`,"data-slot":`agents-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:s.isPending,onCheckedChange:e=>s.mutate({liveTitleUpdates:e},{onSuccess:()=>E(e?`Live title updates on`:`Live title updates off`)})}),(0,G.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,G.jsx)($,{title:`Review changes before finishing`,hint:`When on, a task with changes pauses so you can Accept, Send back, or open a Draft PR. Autonomous tasks always skip this and finish on their own. Default: off — tasks finish without asking.`,children:(0,G.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,G.jsx)(k,{"aria-label":`Review changes before finishing`,"data-slot":`agents-review-gate`,checked:e.reviewGate??!1,disabled:s.isPending,onCheckedChange:e=>s.mutate({reviewGate:e},{onSuccess:()=>E(e?`Review gate on`:`Review gate off`)})}),(0,G.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,G.jsx)($,{title:`Base branch`,hint:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,children:i.data?.info?(0,G.jsx)(I,{"aria-label":`Base branch`,"data-slot":`agents-base-branch`,value:e.baseBranch??``,disabled:s.isPending,onValueChange:e=>s.mutate({baseBranch:e||null}),className:`settings-select max-w-full bg-card`,options:[{value:``,label:`follow checked-out branch (default)`},...i.data.branches.map(e=>({value:e,label:e}))]}):(0,G.jsx)(`p`,{"data-slot":`agents-base-branch-unavailable`,className:`text-[13px] text-soft-foreground`,children:i.isPending?`Loading branches…`:`Not a git repository — tasks run in place, no branching.`})})]}),(0,G.jsxs)(`details`,{className:`settings-disclosure`,children:[(0,G.jsx)(`summary`,{children:`Provider connections`}),(0,G.jsx)(se,{})]})]})}function le({defaultRunner:e,providerStatus:t,saving:n,onPick:r}){let i=g(),o=c(),s=C(),l=a(),u=_(),d=s.projectId??`default`,f=l.data?.info?.root,p=P(i.data,s.projectId,f),m=y().data,h=B(i.data?.profiles??[],m),v=R(h,m);return(0,G.jsxs)(Q,{title:`Default runner`,hint:`Project defaults. A task can override these choices.`,children:[(0,G.jsx)(V,{rows:h,runner:e,accountFor:e=>p?.[e]??null,providerStatus:t,disabled:n,accountDisabled:u.isPending||o.data===void 0,onPick:(t,n,i)=>{t!==e&&r(t),i&&u.mutate({projectId:d,provider:t,profileId:n},{onError:e=>E(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&S(t.data,e)?.enabled===!1?(0,G.jsx)(`p`,{"data-slot":`agents-runner-disabled`,className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null,v?(0,G.jsx)(`p`,{className:`max-w-md text-[13px] text-muted-foreground`,children:`The account is personal and never committed. Tasks already started under another account can’t be resumed here — their sessions live in that account’s folder.`}):null]})}function Q({title:e,hint:t,reportsDirty:n,children:r}){return(0,G.jsxs)(`section`,{"data-reports-dirty":n?``:void 0,className:`settings-field flex flex-col gap-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,G.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),r]})}function $({title:e,hint:t,children:n}){return(0,G.jsxs)(`section`,{className:`settings-option-row`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{children:e}),(0,G.jsx)(`p`,{children:t})]}),n]})}function ue({length:e,overLimit:t,saved:n,pending:r,onSave:i}){return(0,G.jsxs)(G.Fragment,{children:[t?(0,G.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-xs text-danger`,children:[e.toLocaleString(),` characters — the limit is `,X.toLocaleString(),`.`]}):(0,G.jsx)(`p`,{"data-slot":`agents-prompt-help`,className:`text-xs text-muted-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`}),(0,G.jsx)(`div`,{className:`settings-form-actions`,children:(0,G.jsx)(U,{show:n&&!t&&!r,children:(0,G.jsx)(O,{type:`button`,variant:`primary`,size:`sm`,"data-action":`agents-save-prompt`,disabled:n||t||r,onClick:i,children:`Save prompt`})})})]})}export{ce as AgentDefaultsSection};
@@ -1 +0,0 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{o as t}from"./dist-C_rn70hE.js";import{St as n}from"./queries-ByqTmyCs.js";import{t as r}from"./createLucideIcon-BHp8sXmF.js";import{n as i,t as a}from"./moon-CRE9nU5R.js";import{t as o}from"./button-C8jUIs8Q.js";import{Jn as s,dt as c,xn as l}from"./index-Cmj0hLCQ.js";var u=r(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),d=e(),f=[{value:`system`,label:`System`,icon:i},{value:`light`,label:`Light`,icon:u},{value:`dark`,label:`Dark`,icon:a}],p=[{value:`cezarion`,label:`Squawk`,swatch:`var(--accent-strong)`}],m=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`},{value:`ultra`,label:`Ultra-compact`}],h=[{value:`narrow`,label:`Narrow`},{value:`wide`,label:`Wide`}];function g({slot:e,label:n,value:r,options:i,onChange:a}){return(0,d.jsx)(`div`,{role:`radiogroup`,"aria-label":n,"data-slot":e,className:`inline-flex w-fit gap-0.5 rounded-lg border border-border bg-muted/60 p-1 max-md:max-w-full max-md:flex-wrap`,children:i.map(e=>{let n=e.value===r;return(0,d.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"data-value":e.value,onClick:()=>a(e.value),className:t(`flex min-h-11 items-center gap-2 whitespace-nowrap rounded-md border border-transparent px-3 py-1.5 text-[13px] font-medium transition-colors`,n?`border border-border bg-card text-foreground shadow-xs`:`text-muted-foreground hover:text-foreground`),children:[e.icon?(0,d.jsx)(e.icon,{"aria-hidden":`true`,className:`size-3.5`}):null,e.swatch?(0,d.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-border`,style:{background:e.swatch}}):null,e.label]},e.value)})})}function _({title:e,hint:t,children:n}){return(0,d.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,d.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}function v(){let e=n(),{order:t,canReorder:r,reset:i}=l();return!((e.data?.projects.length??0)>1)||t.length===0?null:(0,d.jsx)(_,{title:`Project order`,hint:`The project rail is in the order you dragged it into. Reset puts it back in the order the projects were added. Saved with your workspace, so every browser sees it.`,children:(0,d.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`appearance-project-order-reset`,disabled:!r,onClick:i,className:`w-fit`,children:`Reset order`})})}function y(){let{theme:e,setTheme:t}=s(),{accent:n,density:r,width:i,setAccent:a,setDensity:o,setWidth:l}=c();return(0,d.jsxs)(`div`,{"data-slot":`appearance-section`,className:`flex w-full flex-col gap-7 rounded-lg border border-border bg-card p-5`,children:[(0,d.jsx)(_,{title:`Theme`,hint:`System follows your OS preference. Applies to this browser.`,children:(0,d.jsx)(g,{slot:`appearance-theme`,label:`Theme`,value:e,options:f,onChange:t})}),p.length>1?(0,d.jsx)(_,{title:`Accent`,hint:`The cockpit brand accent. Saved with your workspace appearance.`,children:(0,d.jsx)(g,{slot:`appearance-accent`,label:`Accent`,value:n,options:p,onChange:a})}):null,(0,d.jsx)(_,{title:`Density`,hint:`Compact tightens spacing across the cockpit — text stays the same size.`,children:(0,d.jsx)(g,{slot:`appearance-density`,label:`Density`,value:r,options:m,onChange:o})}),(0,d.jsx)(_,{title:`Reading width`,hint:`Wide lets a task's session and commits use more of the screen. Narrow keeps a comfortable reading column. The Changes tab is always full-width.`,children:(0,d.jsx)(g,{slot:`appearance-width`,label:`Reading width`,value:i,options:h,onChange:l})}),(0,d.jsx)(v,{}),(0,d.jsxs)(`div`,{className:`settings-appearance-preview settings-readout`,children:[(0,d.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`PREVIEW`}),(0,d.jsx)(`p`,{className:`mt-3 text-base`,children:`Review finalization retries`}),(0,d.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Needs you · Squawk · Task `,`#`,`227`]}),(0,d.jsx)(`span`,{className:`mt-3 inline-flex rounded-md border border-border bg-card px-4 py-3 text-xs text-foreground shadow-xs`,children:`Open task`})]}),(0,d.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`Changes apply immediately. Theme is browser-local; density and reading width are saved with your workspace.`})]})}export{y as AppearanceSection};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Gt as r,It as i,Wt as a,_ as o,dn as s}from"./queries-ByqTmyCs.js";import{P as c,hi as l,sn as u}from"./toaster-Lf_4oY96.js";import{t as d}from"./option-select-C9D7zD0s.js";var f=e(t(),1),p=n();function m(){let e=o();return e.isPending?(0,p.jsx)(`p`,{role:`status`,children:`Loading task settings…`}):e.isError?(0,p.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,p.jsx)(g,{config:e.data,scope:`project`})}function h(){let e=i();return e.isPending?(0,p.jsx)(`p`,{role:`status`,className:`p-4 text-sm`,children:`Loading task settings…`}):e.isError?(0,p.jsxs)(`p`,{role:`alert`,className:`p-4 text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,p.jsx)(`div`,{className:`flex w-full flex-col gap-4`,children:(0,p.jsx)(g,{config:e.data,scope:`global`})})}function g({config:e,scope:t}){let n=(0,f.useId)(),i=l(),o=s({mutationFn:async({archiveOnMerge:e,projectKey:n})=>t===`project`?c({archiveOnMerge:e},n[0]):u({archiveOnMerge:e}),onSuccess:(e,{projectKey:n})=>{t===`project`?i.setQueryData(n,e):(i.setQueryData(r.config,e),i.invalidateQueries({predicate:e=>e.queryKey.at(-1)===`config`&&e.queryKey!==r.config}))}});return(0,p.jsxs)(`section`,{"data-slot":`archive-on-merge-field`,className:`flex min-w-0 flex-col gap-3`,children:[(0,p.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,p.jsx)(`label`,{htmlFor:n,className:`text-sm font-semibold text-foreground`,children:`Archive tasks after PRs merge`}),(0,p.jsx)(`p`,{id:`${n}-hint`,className:`text-[13px] text-muted-foreground`,children:`Automatically archive a settled task and its workers once all their associated pull requests merge. History stays available in Archived.`})]}),(0,p.jsx)(d,{id:n,"aria-describedby":`${n}-hint ${n}-effective`,className:`settings-select w-64 max-w-full bg-background`,value:e.archiveOnMerge===null?`inherit`:e.archiveOnMerge?`enabled`:`disabled`,disabled:o.isPending,onValueChange:e=>o.mutate({archiveOnMerge:e===`inherit`?null:e===`enabled`,projectKey:a.config}),options:[{value:`inherit`,label:t===`project`?`Inherit global setting`:`Use default`},{value:`enabled`,label:`Enabled`},{value:`disabled`,label:`Disabled`}]}),(0,p.jsxs)(`p`,{id:`${n}-effective`,className:`text-[13px] text-muted-foreground`,children:[`Currently `,e.effectiveArchiveOnMerge?`enabled`:`disabled`,` · `,e.archiveOnMergeSource,` setting.`]}),(0,p.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Unarchive restores the task. It stays visible until a later associated PR merges.`}),o.isPending?(0,p.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Saving…`}):null,o.isError?(0,p.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not save: `,o.error.message]}):null]})}export{m as ArchiveOnMergeField,h as TasksSection};
@@ -1 +0,0 @@
1
- import{An as e,Tn as t}from"./toaster-Lf_4oY96.js";function n(n){return t[e(n).bucket]<=t.waiting}export{n as t};
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{A as i,_ as a,nn as o,rn as s,sn as c,tn as l}from"./queries-ByqTmyCs.js";import{B as u,Fn as d,H as f,Ur as p,V as m,_ as h,ar as g,c as ee,d as _,g as v,ir as y,ni as b,nr as x,o as te,s as S,sr as ne,ti as re,v as ie,z as ae}from"./toaster-Lf_4oY96.js";import{B as C,G as oe,H as se,I as w,K as ce,N as T,P as E,V as le,W as D,j as O,z as k}from"./live-protocol-DMhTnCmf.js";import{h as ue,n as de}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as fe,t as A}from"./label-eNfbfYFG.js";import{I as pe,J as me,Y as he,it as ge,l as _e,pt as ve,ut as ye,y as be}from"./design-icons-CzEoMH9c.js";import{t as xe}from"./check-OP-CVgZG.js";import{t as j}from"./button-C8jUIs8Q.js";import{n as Se,r as Ce,t as we}from"./collapsible-CW6CfTJO.js";import{a as M,i as N,n as P,r as F,t as I}from"./select-CRYap6qE.js";import{t as Te}from"./switch-DfPCm1H_.js";import{c as Ee,s as De,t as L}from"./project-router-CEnizJ8F.js";import{r as Oe}from"./agents-settings-path-7X6_cvUg.js";import{a as ke,c as Ae,d as je,n as Me,s as R,u as z}from"./page-shell-CpdYMj52.js";import{t as Ne}from"./centered-state-BgSV4e79.js";import{$n as B,D as Pe,G as Fe,J as Ie,K as Le,O as Re,P as ze,Rn as Be,bn as Ve,fr as He,gn as Ue,k as We,r as Ge,t as Ke,wn as qe,zn as Je}from"./index-Cmj0hLCQ.js";import{t as Ye}from"./textarea-vEsJAUAV.js";import{_ as Xe,a as Ze,c as Qe,d as $e,f as et,g as tt,h as nt,i as rt,l as it,m as at,n as ot,o as st,p as ct,r as lt,s as ut,t as V,u as dt,v as ft}from"./automation-format-DB34jUyF.js";var H=e(t(),1),U=O([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),pt=C({includeExisting:E().optional(),authors:T(D()).optional(),assignees:T(D()).optional(),requireCurrentLabels:E().optional(),allLabels:T(D()).optional(),anyLabels:T(D()).optional(),excludeLabels:T(D()).optional(),changedLabels:T(D()).optional(),lookbackDays:k(),maxRecords:k()}),mt=O([`github`,`schedule`]),ht=x.omit({task:!0,images:!0,systemPrompt:!0}).extend({prompt:D(),variants:oe([w(1),w(2),w(3)]).optional(),systemPrompt:D().optional()}),gt=C({at:D(),outcome:O([`launched`,`cancelled`]),runId:D().optional(),receiptId:D().optional(),trigger:O([`schedule`,`late`,`manual`,`retry`]).optional()}),W=C({id:D(),revision:k(),name:D(),description:D().optional(),enabled:E(),kind:mt,events:T(U).optional(),intervalSeconds:k().optional(),filters:pt.optional(),schedule:Qe.optional(),task:ht,archived:gt.optional(),createdAt:D(),updatedAt:D()}),G=C({timestamp:D(),tieBreaker:D().optional()}),_t=C({since:D().datetime(),until:D().datetime(),source:k().int().min(0).max(2),page:k().int().min(1).max(10),item:k().int().min(0).max(100),event:k().int().min(0).max(1e3),cursor:G.optional()}),vt={lastError:D().max(1e3).optional(),lastErrorAt:D().datetime().optional()},yt=C({revision:k().optional(),baselineAt:D().optional(),armedAt:D().optional(),historyScan:_t.optional(),cursor:G.optional(),frozenHighWatermark:G.extend({tieBreaker:D()}).optional(),backlogAfter:G.extend({tieBreaker:D()}).optional(),nextCheckAt:D().optional(),lastSuccessAt:D().optional(),nextRunAt:D().optional(),lastRunAt:D().optional(),etags:se(D(),D()).optional(),backoffUntil:D().optional(),consecutiveFailures:k().optional(),...vt,onceOutcome:O([`failed`,`missed`]).optional()});function bt(e){let t=e?.consecutiveFailures??0;if(!(t<3||!e?.lastError))return{consecutiveFailures:t,lastError:e.lastError,...e.lastErrorAt?{lastErrorAt:e.lastErrorAt}:{},...e.backoffUntil?{retryAt:e.backoffUntil}:{}}}var xt=O([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]),St=C({seq:k(),ts:D(),automationId:D(),revision:k(),event:U.optional(),result:xt,reason:D().optional(),durationMs:k().optional(),receiptId:D().optional(),runId:D().optional(),githubNumber:k().optional(),githubTitle:D().optional(),githubUrl:D().optional(),rateLimit:C({bucket:O([`core`,`search`]),remaining:k().optional(),resetAt:D().optional()}).optional()}),Ct=C({matches:k(),launched:k(),duplicates:k(),errors:k()}),wt=W.extend({state:yt.optional(),latestLog:St.optional(),counts:Ct,nextRunAt:D().optional(),onceStatus:ct.optional()});C({available:E(),reason:D().optional(),timeZone:D(),scheduler:C({state:O([`scheduled`,`idle`]),nextDue:D().optional()}),automations:T(wt)}),C({automation:W}).extend({once:C({dueAt:D(),timeZone:D(),resolvedInstant:D(),note:D()}).optional()}),C({automation:W,state:yt.optional(),latestLog:St.optional(),onceStatus:ct.optional()}),C({id:D(),automationId:D(),mode:O([`preview`,`execute`]),status:O([`queued`,`running`,`complete`,`error`]),createdAt:D(),completedAt:D().optional(),matches:k().optional(),truncated:E().optional(),error:D().optional()}),C({checkId:D()}),C({records:T(St)}),C({receiptId:D(),runId:D()}),C({runId:D()}),W.omit({id:!0,revision:!0,createdAt:!0,updatedAt:!0,enabled:!0,kind:!0,archived:!0}).extend({kind:mt.optional(),task:ht.omit({variants:!0}).strict(),enable:E().optional()}).omit({enable:!0}).extend({enabled:E().optional(),expectedRevision:k()}),C({archived:O([`include`,`only`]).optional()}),C({mode:O([`preview`,`execute`])});var K=n();function q({text:e}){return(0,K.jsx)(`div`,{role:`status`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:e})}var Tt={launched:`success`,manual:`success`,"catch-up":`success`,skipped:`neutral`,missed:`pending`,"no-match":`neutral`,preview:`neutral`,baseline:`neutral`,duplicate:`neutral`,failed:`danger`,error:`danger`,"rate-limited":`danger`},Et={launched:`Launched`,manual:`Manual`,"catch-up":`Catch up`,skipped:`Skipped`,missed:`Missed`,"no-match":`No match`,preview:`Preview`,baseline:`Baseline`,duplicate:`Duplicate`,failed:`Failed`,error:`Error`,"rate-limited":`Rate limited`};function Dt(e){let[t,n]=(0,H.useState)(),[r,i]=(0,H.useState)(``),a=(0,H.useCallback)(t=>h(e,{signal:t}).then(({records:e})=>{t?.aborted||(n(e),i(``))}).catch(e=>{t?.aborted||i(String(e))}),[e]);return(0,H.useEffect)(()=>{a()},[a]),(0,H.useEffect)(()=>p(a),[a]),(0,H.useEffect)(()=>fe((t,n)=>{t===`automation-change`&&n.automationId===e&&a()}),[e,a]),{records:t,error:r,refresh:a}}function Ot(e,t){return e.result!==`failed`&&e.result!==`error`||!e.receiptId||e.runId?!1:!t.some(t=>t.receiptId===e.receiptId&&(t.runId||t.seq>e.seq))}function kt({records:e,all:t,timeZone:n,onRetried:r,readOnly:i=!1}){let a=e=>!i&&Ot(e,t),[o,s]=(0,H.useState)(),[c,l]=(0,H.useState)(),u=Date.now(),d=async e=>{s(e),l(void 0);try{await ae(e),r()}catch(t){l({receiptId:e,message:t instanceof Error?t.message:String(t)})}finally{s(void 0)}};return(0,K.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:e.map(e=>(0,K.jsxs)(`li`,{className:`min-w-0 rounded-xl border border-card-edge bg-card p-4 shadow-card`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsx)(Ge,{dot:Tt[e.result],children:Et[e.result]}),(0,K.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,title:e.ts,children:ot(e.ts,n,u)})]}),e.reason?(0,K.jsx)(`p`,{className:`mt-2 text-sm break-words text-muted-foreground`,children:e.reason}):null,e.githubUrl||e.runId||a(e)?(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-sm`,children:[e.githubUrl?(0,K.jsx)(`a`,{className:`inline-flex min-h-11 items-center underline underline-offset-4 break-all`,href:e.githubUrl,target:`_blank`,rel:`noreferrer`,children:e.githubTitle??`GitHub #${e.githubNumber??``}`}):null,e.runId?(0,K.jsx)(L,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`}):null,a(e)?(0,K.jsx)(j,{variant:`outline`,disabled:o===e.receiptId,onClick:()=>void d(e.receiptId),children:`Retry task`}):null]}):null,c&&c.receiptId===e.receiptId?(0,K.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm break-words text-destructive`,children:c.message}):null]},e.seq))})}var J=`all`;function At({label:e,value:t,onChange:n,options:r}){return(0,K.jsxs)(I,{value:t,onValueChange:n,children:[(0,K.jsx)(N,{"aria-label":e,className:`w-full sm:w-52`,children:(0,K.jsx)(M,{})}),(0,K.jsx)(P,{children:r.map(e=>(0,K.jsx)(F,{value:e.value,children:e.label},e.value))})]})}function jt({automationId:e,automationName:t,timeZone:n,readOnly:r=!1}){let{records:i,error:a,refresh:o}=Dt(e),[s,c]=(0,H.useState)(J),[l,u]=(0,H.useState)(J),d=(0,H.useMemo)(()=>(i??[]).filter(e=>(s===J||e.result===s)&&(l===J||e.event===l)),[i,s,l]),f=(i??[]).some(e=>e.event);return(0,K.jsx)(Ae,{route:`automations`,density:i?je(d.length):`full`,header:{title:`Execution log`,subtitle:t??`Automation activity`,secondaryActions:(0,K.jsx)(R,{variant:`outline`,asChild:!0,children:(0,K.jsx)(L,{to:`/automations`,children:`Back to automations`})})},children:a&&!i?(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,K.jsx)(q,{text:a}),(0,K.jsx)(j,{variant:`outline`,onClick:()=>void o(),children:`Retry`})]}):i?i.length===0?(0,K.jsx)(q,{text:`Nothing has run yet.`}):(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(At,{label:`Result`,value:s,onChange:c,options:[{value:J,label:`All results`},...xt.options.map(e=>({value:e,label:Et[e]}))]}),f?(0,K.jsx)(At,{label:`Event`,value:l,onChange:u,options:[{value:J,label:`All events`},...U.options.map(e=>({value:e,label:e}))]}):null]}),d.length===0?(0,K.jsx)(q,{text:`No rows match these filters.`}):(0,K.jsx)(kt,{records:d,all:i,timeZone:n,onRetried:()=>void o(),readOnly:r})]}):(0,K.jsx)(q,{text:`Loading execution log…`})})}function Mt({automationId:e,automationName:t,timeZone:n,showName:r=!1,readOnly:i=!1}){let{records:a,error:o,refresh:s}=Dt(e),c=`Recent activity${r&&t?` · ${t}`:``}`;return!o&&a&&a.length===0?(0,K.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`flex flex-wrap items-center gap-x-2 border-t border-border pt-2.5 text-xs text-muted-foreground`,children:[(0,K.jsx)(`h3`,{className:`font-medium text-foreground`,children:c}),(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,K.jsx)(`p`,{children:`Nothing has run yet.`})]}):(0,K.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`min-w-0 border-t border-border pt-2.5`,children:[(0,K.jsx)(`h3`,{className:`mb-1.5 text-xs font-medium text-muted-foreground`,children:c}),o&&!a?(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,K.jsx)(q,{text:o}),(0,K.jsx)(j,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]}):a?(0,K.jsx)(kt,{records:a.slice(0,5),all:a,timeZone:n,onRetried:()=>void s(),readOnly:i}):(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading activity…`})]})}function Nt({automation:e,timeZone:t,onDeleted:n}){let r=e.archived,i=e.schedule,a=i?lt(i):null,[o,s]=(0,H.useState)(!1),[c,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)(``),f=(0,H.useRef)(null),p=(0,H.useRef)(null),m=(0,H.useRef)(null);(0,H.useEffect)(()=>{let e=m.current===`keep`?p.current:m.current===`delete`?f.current:null;m.current=null,e?.focus()},[o]);let h=async()=>{l(!0);try{await _(e.id),n()}catch(e){d(e instanceof Error?e.message:String(e)),l(!1)}},g=[[`Workflow`,e.task.workflow],[`Runner`,e.task.runner],[`Model`,e.task.model],[`Effort`,e.task.effort]];return(0,K.jsx)(Ae,{route:`automations`,density:`sparse`,header:{title:e.name,subtitle:`Archived one-time schedule. It cannot change; delete it when you no longer need the record.`},children:(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-5`,children:[(0,K.jsxs)(`section`,{className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-4`,children:[(0,K.jsxs)(`p`,{className:`text-sm break-words`,children:[(0,K.jsx)(`span`,{children:r.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`}),r.runId?(0,K.jsxs)(K.Fragment,{children:[` · `,(0,K.jsx)(L,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${r.runId}`,children:`Open task`})]}):null]}),(0,K.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Archived ${V(r.at,t)} (${t}).`}),a&&i?.timeZone?(0,K.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Was due ${a.date} ${a.time} (${i.timeZone}).`}):null]}),(0,K.jsxs)(`section`,{"aria-labelledby":`archived-inputs`,className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-4`,children:[(0,K.jsx)(`h2`,{id:`archived-inputs`,className:`mb-3 text-[15px] font-medium`,children:`What it ran with`}),(0,K.jsxs)(`dl`,{className:`grid gap-3 text-sm`,children:[(0,K.jsxs)(`div`,{className:`grid gap-1`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:`Prompt`}),(0,K.jsx)(`dd`,{className:`break-words whitespace-pre-wrap`,children:e.task.prompt})]}),g.filter(([,e])=>e).map(([e,t])=>(0,K.jsxs)(`div`,{className:`grid gap-1`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,K.jsx)(`dd`,{className:`break-words`,children:t})]},e))]})]}),(0,K.jsxs)(`section`,{className:`min-w-0`,children:[(0,K.jsx)(Mt,{automationId:e.id,automationName:e.name,timeZone:t,readOnly:!0}),(0,K.jsx)(j,{variant:`outline`,asChild:!0,className:`mt-3`,children:(0,K.jsx)(L,{to:`/automations/${e.id}/log`,children:`Execution log`})})]}),(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[o?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? Its record and log are removed; the task stays.`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(j,{variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:c,onClick:()=>void h(),children:`Delete schedule`}),(0,K.jsx)(j,{ref:p,variant:`outline`,disabled:c,onClick:()=>{m.current=`delete`,s(!1)},children:`Keep`})]})]}):(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(j,{ref:f,variant:`outline`,"data-action":`automation-delete`,onClick:()=>{m.current=`keep`,s(!0)},children:`Delete`}),(0,K.jsx)(j,{variant:`outline`,asChild:!0,children:(0,K.jsx)(L,{to:`/automations`,children:`Back to automations`})})]}),u?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:u}):null]})]})})}var Pt=O([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),Y=T(D().trim().min(1).max(200)).max(100).optional(),Ft=C({includeExisting:E().optional(),requireCurrentLabels:E().optional(),authors:Y,assignees:Y,allLabels:Y,anyLabels:Y,excludeLabels:Y,changedLabels:Y,lookbackDays:k().int().min(1).max(90).default(7),maxRecords:k().int().min(1).max(100).default(25)}).passthrough(),It=C({prompt:D().min(1).max(1e5),workflow:D().trim().min(1).max(200).optional(),steps:T(y).min(1).max(100).optional(),runner:re.optional(),model:D().trim().min(1).max(200).optional(),effort:D().trim().min(1).max(32).optional(),variants:oe([w(1),w(2),w(3)]).optional(),worktree:E().optional(),autonomous:E().optional(),...g,...ne,systemPrompt:D().max(1e5).optional()}).passthrough().refine(e=>!(e.workflow&&e.steps),{message:`task selects either a named workflow or inline steps, not both`}),Lt=new Set(Object.keys(It.shape).filter(e=>e!==`variants`));function Rt(e){return Object.fromEntries(Object.entries(e).filter(([e])=>Lt.has(e)))}le(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return e;let t=e;return t.kind===`schedule`?e:{...t,intervalSeconds:t.intervalSeconds??300,filters:t.filters??{}}},C({id:D().min(1).max(100),revision:k().int().positive(),name:D().trim().min(1).max(200),description:D().max(2e3).optional(),enabled:E().default(!1),kind:mt.default(`github`),events:T(Pt).min(1).max(4).optional(),intervalSeconds:k().int().min(60).max(86400).optional(),filters:Ft.optional(),schedule:Qe.passthrough().optional(),task:It,archived:C({at:D().datetime(),outcome:O([`launched`,`cancelled`]),runId:D().optional(),receiptId:D().optional(),trigger:O([`schedule`,`late`,`manual`,`retry`]).optional()}).passthrough().optional(),createdAt:D().datetime(),updatedAt:D().datetime()}).passthrough().superRefine((e,t)=>{if(e.kind===`schedule`){e.schedule||t.addIssue({code:b.custom,path:[`schedule`],message:`a scheduled automation needs a schedule`});return}e.events?.length||t.addIssue({code:b.custom,path:[`events`],message:`a GitHub automation needs at least one event`}),e.intervalSeconds===void 0&&t.addIssue({code:b.custom,path:[`intervalSeconds`],message:`a GitHub automation needs a poll interval`}),e.filters||t.addIssue({code:b.custom,path:[`filters`],message:`a GitHub automation needs its bounded filter`}),e.events?.some(e=>e===`issue.labeled`||e===`issue.unlabeled`)&&!e.filters?.changedLabels?.length&&t.addIssue({code:b.custom,path:[`filters`,`changedLabels`],message:`changedLabels is required for issue label events`})})),C({version:w(1).default(1),automations:T(ce()).default([]),tombstones:se(D(),D().datetime()).optional()}).passthrough();var X=C({timestamp:D().datetime(),tieBreaker:D().optional()}).passthrough(),zt=_t.extend({cursor:X.optional()}),Bt=C({revision:k().int().positive().optional(),baselineAt:D().datetime().optional(),armedAt:D().datetime().optional(),historyScan:zt.optional(),cursor:X.optional(),frozenHighWatermark:X.extend({tieBreaker:D()}).optional(),backlogAfter:X.extend({tieBreaker:D()}).optional(),nextCheckAt:D().datetime().optional(),lastSuccessAt:D().datetime().optional(),nextRunAt:D().datetime().optional(),lastRunAt:D().datetime().optional(),etags:se(D(),D()).optional(),backoffUntil:D().datetime().optional(),consecutiveFailures:k().int().nonnegative().optional(),...vt,onceOutcome:O([`failed`,`missed`]).optional()}).passthrough();C({version:w(1).default(1),states:se(D(),Bt).default({})}).passthrough(),C({receiptId:D().min(1),receiptKey:D().min(1),eventId:D().min(1),automationId:D().min(1),revision:k().int().positive(),status:O([`reserved`,`launched`,`launch-error`,`released`]),runId:D().optional(),observedAt:D().datetime(),updatedAt:D().datetime(),error:D().max(2e3).optional(),occurrenceAt:D().datetime().optional(),candidate:C({eventId:D(),event:Pt,timestamp:D().datetime(),tieBreaker:D(),repo:D(),nodeId:D(),number:k().int().positive(),title:D().max(500),url:D().url(),author:D().max(200),assignees:T(D().max(200)).max(100),labels:T(D().max(200)).max(100),changedLabel:D().max(200).optional()}).passthrough().optional()}).passthrough();var Vt=O([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]);C({seq:k().int().positive(),ts:D().datetime(),automationId:D().min(1),revision:k().int().positive(),event:Pt.optional(),result:Vt,reason:D().max(2e3).optional(),durationMs:k().int().nonnegative().optional(),receiptId:D().optional(),runId:D().optional(),githubNumber:k().int().positive().optional(),githubTitle:D().max(500).optional(),githubUrl:D().url().optional(),rateLimit:C({bucket:O([`core`,`search`]),remaining:k().int().nonnegative().optional(),resetAt:D().datetime().optional()}).passthrough().optional()}).passthrough();var Ht=`quick-task`;function Ut(e={}){let{prompt:t,workflow:n,runner:r,model:i,autonomous:a,archiveWhenDone:o,autoMergePr:s,allowWorkers:c,allowMessaging:l,...u}=Rt(e.task??{prompt:``}),d=e.task===void 0;return{name:e.name??``,description:e.description??``,kind:e.kind??`schedule`,schedule:dt(e.schedule??{type:`daily`}),events:e.events??[U.options[0]],intervalSeconds:e.intervalSeconds??300,filters:e.filters??{lookbackDays:7,maxRecords:25},prompt:t,...n===void 0?d?{workflow:Ht}:{}:{workflow:n},...r===void 0?{}:{runner:r},...i===void 0?{}:{model:i},autonomous:a??!0,archiveWhenDone:o??!1,autoMergePr:s??!1,allowWorkers:c!==!1,allowMessaging:l!==!1,enabled:e.enabled??e.enable??!1,taskExtra:u}}function Wt(e){switch(e.type){case`daily`:case`weekdays`:return{type:e.type,hour:e.hour,minute:e.minute};case`weekly`:return{type:`weekly`,hour:e.hour,minute:e.minute,day:e.day};case`hours`:return{type:`hours`,every:e.every};case`once`:return{type:`once`,at:e.at??``,timeZone:e.timeZone??``,...e.latestStartMinutes===void 0?{}:{latestStartMinutes:e.latestStartMinutes}}}}function Gt(e){return{...e.taskExtra,prompt:e.prompt,...e.workflow?{workflow:e.workflow}:{},...e.runner?{runner:e.runner}:{},...e.model?{model:e.model}:{},autonomous:e.autonomous,...e.archiveWhenDone?{archiveWhenDone:!0}:{},...e.autoMergePr?{autoMergePr:!0}:{},...e.allowWorkers?{}:{allowWorkers:!1},...e.allowMessaging?{}:{allowMessaging:!1}}}function Kt(e){return{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},kind:e.kind,...e.kind===`schedule`?{schedule:Wt(e.schedule)}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:Gt(e)}}function qt(e){return{...Kt(e),enable:e.enabled}}function Jt(e,t){return{...Kt(e),task:{...Gt(e),archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging},enabled:e.enabled,expectedRevision:t}}function Z(e){return`'${e.replace(/'/g,`'\\''`)}'`}var Yt=new Set([`prompt`,`workflow`,`runner`,`model`,`autonomous`,`worktree`,`archiveWhenDone`,`autoMergePr`,`allowWorkers`,`allowMessaging`]),Xt=new Set([`anyLabels`,`authors`,`changedLabels`]);function Zt(e){if(e.description!==void 0||!e.name.trim()||!e.task.prompt.trim())return!1;let t=e.task;if(Object.keys(t).some(e=>!Yt.has(e))||t.archiveWhenDone===!1||t.autoMergePr===!1||t.allowWorkers===!0||t.allowMessaging===!0||t.worktree!==!0)return!1;if(e.kind===`schedule`)return e.schedule!==void 0;let{events:n,filters:r}=e;return!n?.length||n.some(e=>e.includes(`,`))||!r||r.lookbackDays!==7||r.maxRecords!==25?!1:Object.entries(r).every(([e,t])=>e===`lookbackDays`||e===`maxRecords`||e===`includeExisting`&&t===!0||Xt.has(e)&&Array.isArray(t)&&t.length>0)}function Qt(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function $t(e){return e%1440==0?`${e/1440}d`:e%60==0?`${e/60}h`:`${e}m`}function Q(e,t){return t.startsWith(`-`)?`--${e}=${Z(t)}`:`--${e} ${Z(t)}`}function en(e){let t=[`${Ue()} automation add`,Q(`name`,e.name)];if(e.schedule?.type===`once`)t.push(Q(`at`,e.schedule.at),Q(`tz`,e.schedule.timeZone)),e.schedule.latestStartMinutes!==void 0&&t.push(Q(`latest-start`,$t(e.schedule.latestStartMinutes)));else if(e.kind===`schedule`)t.push(Q(`cron`,it(e.schedule)));else{t.push(Q(`on`,e.events.join(`,`)),`--every ${Qt(e.intervalSeconds??300)}`),e.filters?.includeExisting&&t.push(`--include-existing`);for(let n of e.filters?.anyLabels??[])t.push(Q(`label`,n));for(let n of e.filters?.authors??[])t.push(Q(`author`,n));for(let n of e.filters?.changedLabels??[])t.push(Q(`changed-label`,n))}return t.push(...tn(e.task)),e.enable===!0&&t.push(`--enable`),t.push(Q(`prompt`,e.task.prompt)),t.join(` `)}function tn(e){let t=[];return e.workflow&&t.push(Q(`workflow`,e.workflow)),e.runner&&t.push(Q(`runner`,e.runner)),e.model&&t.push(Q(`model`,e.model)),e.autonomous===!1&&t.push(`--no-autonomous`),e.archiveWhenDone&&t.push(`--archive-when-done`),e.autoMergePr&&t.push(`--auto-merge-pr`),e.allowWorkers===!1&&t.push(`--no-workers`),e.allowMessaging===!1&&t.push(`--no-messaging`),t}function nn(e,t){let n=qt(e),r=Zt(n)?en(n):`${Ue()} automation create --json ${Z(JSON.stringify(n))}`;return t?`CEZ_COCKPIT_URL=${Z(t.origin)} CEZ_PROJECT_ID=${Z(t.projectId)} HSQ_COCKPIT_URL=${Z(t.origin)} HSQ_PROJECT_ID=${Z(t.projectId)} ${r}`:r}function rn(e){let t=[],n=!1;for(let r of an(e)){let e=t.length-1;!n&&/^[A-Z_][A-Z0-9_]*=/.test(r)?t.push(r):r.startsWith(`--`)||!n?(t.push(r),n=!0):t[e]=`${t[e]} ${r}`}return t.map((e,t)=>t===0?e:` ${e}`).join(` \\
2
- `)}function an(e){let t=[],n=``,r=!1;for(let i=0;i<e.length;i+=1){let a=e[i];!r&&a===`\\`&&i+1<e.length?(n+=a+e[i+1],i+=1):a===`'`?(r=!r,n+=a):a===` `&&!r?(n&&t.push(n),n=``):n+=a}return n&&t.push(n),t}function on({draft:e}){let t=De(),n=window.location.origin,i=(0,H.useMemo)(()=>{let r=nn(e);return t?`HSQ_COCKPIT_URL=${Z(n)} HSQ_PROJECT_ID=${Z(t)} ${r}`:r},[e,n,t]),a=(0,H.useMemo)(()=>rn(i),[i]),[o,s]=(0,H.useState)(`idle`),[c,l]=(0,H.useState)(!1),u=(0,H.useId)(),d=(0,H.useRef)(void 0);(0,H.useEffect)(()=>()=>clearTimeout(d.current),[]),(0,H.useEffect)(()=>s(`idle`),[i]);let f=async()=>{clearTimeout(d.current);try{await navigator.clipboard.writeText(a),s(`copied`),d.current=setTimeout(()=>s(`idle`),1600)}catch{s(`failed`)}};return(0,K.jsxs)(`section`,{"aria-labelledby":`copy-as-cli-heading`,"data-slot":`copy-as-cli`,className:`min-w-0 max-w-full overflow-hidden rounded-xl border border-card-edge bg-card shadow-card px-4 py-3.5`,children:[(0,K.jsxs)(`div`,{className:`flex min-h-8 min-w-0 flex-nowrap items-center justify-between gap-x-2`,children:[(0,K.jsx)(`h2`,{id:`copy-as-cli-heading`,className:`shrink-0 text-[13px] font-medium text-muted-foreground`,children:`Copy as CLI`}),(0,K.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`copy-as-cli-toggle`,"aria-expanded":c,"aria-controls":u,"aria-label":c?`Hide command`:`Show command`,className:`min-w-0 shrink gap-1 px-1.5 text-[12px] font-medium max-md:h-11 no-hover:h-11`,onClick:()=>l(e=>!e),children:[(0,K.jsx)(`span`,{className:`truncate`,children:c?`Hide`:`Show`}),(0,K.jsx)(_e,{"aria-hidden":`true`,className:r(`size-3.5 transition-transform`,c&&`rotate-180`)})]}),(0,K.jsxs)(j,{type:`button`,variant:`outline`,size:`sm`,className:`ms-auto gap-1.5 px-2 text-[12px] font-medium max-md:h-11 no-hover:h-11`,onClick:()=>void f(),children:[o===`copied`?(0,K.jsx)(xe,{"aria-hidden":`true`,className:`size-3.5`}):(0,K.jsx)(He,{"aria-hidden":`true`,className:`size-3.5`}),o===`copied`?`Copied`:`Copy`]})]}),(0,K.jsx)(`div`,{id:u,hidden:!c,className:`mbs-2 max-w-full rounded-lg border border-border bg-muted has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-ring`,children:(0,K.jsx)(`pre`,{"data-slot":`copy-as-cli-line`,tabIndex:0,"aria-label":`Command line`,className:`m-0 max-w-full px-3 pt-2.5 pb-3 font-mono text-xs leading-5 break-all whitespace-pre-wrap text-muted-foreground outline-none`,children:a})}),(0,K.jsx)(`p`,{role:`status`,className:`mbs-2 text-xs break-words text-muted-foreground`,children:o===`failed`?`Could not copy — select the line and copy it by hand.`:(0,K.jsxs)(K.Fragment,{children:[`The definition Save paused would create. `,(0,K.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-px font-mono text-xs whitespace-nowrap text-foreground [word-spacing:-0.2em]`,children:`${Ue()} automation schema`}),` prints its shape.`]})})]})}function sn({pressed:e,onClick:t,disabled:n,children:i}){return(0,K.jsx)(`button`,{type:`button`,"aria-pressed":e,disabled:n,onClick:t,className:r(`inline-flex min-h-11 items-center justify-center rounded-md border px-3.5 text-[13px] font-medium transition-colors outline-hidden focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50`,e?`border-border bg-card font-semibold text-foreground shadow-xs`:`border-transparent bg-transparent text-muted-foreground hover:text-foreground`),children:i})}var cn={"pull_request.opened":`a pull request opens`,"issue.opened":`an issue opens`,"issue.labeled":`an issue is labeled`,"issue.unlabeled":`an issue is unlabeled`},ln={"pull_request.opened":`Pull request opened`,"issue.opened":`Issue opened`,"issue.labeled":`Issue labeled`,"issue.unlabeled":`Issue unlabeled`};function un(e){let t=e.map(e=>cn[e]);if(t.length===0)return`When GitHub changes`;let n=t.slice(0,-1),r=t[t.length-1];return`When ${n.length>0?`${n.join(`, `)} or ${r}`:r}`}var dn=U.options,fn=[{seconds:60,label:`1 minute`},{seconds:300,label:`5 minutes`},{seconds:900,label:`15 minutes`},{seconds:1800,label:`30 minutes`},{seconds:3600,label:`1 hour`}],pn=[{key:`authors`,label:`Authors`},{key:`assignees`,label:`Assignees`},{key:`allLabels`,label:`Has all labels`},{key:`anyLabels`,label:`Has any label`},{key:`excludeLabels`,label:`Excludes labels`},{key:`changedLabels`,label:`Changed labels`,hint:`Required for the two label events.`}],mn=e=>(e??[]).join(`, `),hn=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean);function gn(e){return e?`Existing matches within the lookback are eligible on the next check. Previously processed matches will not run again.`:`Enabling starts from a current-time baseline. Existing matches will not launch tasks.`}function _n(e){let t=Math.max(1,Math.round(e.intervalSeconds/60));return`Polls GitHub every ${t} minute${t===1?``:`s`} for ${e.events.join(`, `)||`no events`}. ${gn(e.filters.includeExisting)}`}function vn({draft:e,onChange:t,disabledReason:n}){let r=n=>{t({events:e.events.includes(n)?e.events.filter(e=>e!==n):[...e.events,n]})},i=n=>t({filters:{...e.filters,...n}}),a=(n,r)=>{let i=hn(r),{[n]:a,...o}=e.filters;t({filters:i.length?{...o,[n]:i}:o})},o=fn.some(t=>t.seconds===e.intervalSeconds)?fn:[...fn,{seconds:e.intervalSeconds,label:`${Math.round(e.intervalSeconds/60)} minutes`}].sort((e,t)=>e.seconds-t.seconds);return(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[n?(0,K.jsx)(`p`,{className:`text-xs text-pending-strong`,children:`GitHub unavailable · ${n}`}):null,(0,K.jsx)(`div`,{role:`group`,"aria-label":`GitHub events`,className:`inline-flex w-fit max-w-full flex-wrap gap-1 rounded-lg border border-border bg-muted/60 p-1`,children:dn.map(t=>(0,K.jsx)(sn,{pressed:e.events.includes(t),onClick:()=>r(t),children:ln[t]},t))}),(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(A,{htmlFor:`automation-interval`,children:`Check every`}),(0,K.jsxs)(I,{value:String(e.intervalSeconds),onValueChange:e=>t({intervalSeconds:Number(e)}),children:[(0,K.jsx)(N,{id:`automation-interval`,className:`w-full sm:w-48`,"aria-label":`Check every`,children:(0,K.jsx)(M,{})}),(0,K.jsx)(P,{children:o.map(e=>(0,K.jsx)(F,{value:String(e.seconds),children:e.label},e.seconds))})]})]}),(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,K.jsx)(Te,{"aria-label":`Include existing items`,"aria-describedby":`automation-history-hint`,checked:e.filters.includeExisting??!1,onCheckedChange:e=>i({includeExisting:e})}),(0,K.jsx)(`span`,{children:`Include existing items`})]}),(0,K.jsx)(`p`,{id:`automation-history-hint`,className:`text-xs text-muted-foreground`,children:gn(e.filters.includeExisting)})]}),(0,K.jsxs)(we,{children:[(0,K.jsxs)(Ce,{className:`group flex min-h-11 items-center gap-2 text-sm font-medium`,children:[`Filters`,(0,K.jsx)(_e,{"aria-hidden":`true`,className:`size-4 text-soft-foreground transition-transform motion-reduce:transition-none group-data-[state=open]:rotate-180`})]}),(0,K.jsx)(Se,{children:(0,K.jsxs)(`div`,{className:`grid gap-4 pt-2 sm:grid-cols-2`,children:[pn.map(t=>(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,K.jsx)(A,{htmlFor:`automation-filter-${t.key}`,children:t.label}),(0,K.jsx)(B,{id:`automation-filter-${t.key}`,className:`border-border`,placeholder:`comma separated`,value:mn(e.filters[t.key]),onChange:e=>a(t.key,e.target.value)}),t.hint?(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.hint}):null]},t.key)),(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,K.jsx)(A,{htmlFor:`automation-filter-lookback`,children:`Look back (days)`}),(0,K.jsx)(B,{id:`automation-filter-lookback`,className:`border-border`,type:`number`,min:1,value:e.filters.lookbackDays,onChange:e=>i({lookbackDays:Math.max(1,Number(e.target.value)||1)})})]}),(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,K.jsx)(A,{htmlFor:`automation-filter-max`,children:`Max records per check`}),(0,K.jsx)(B,{id:`automation-filter-max`,className:`border-border`,type:`number`,min:1,value:e.filters.maxRecords,onChange:e=>i({maxRecords:Math.max(1,Number(e.target.value)||1)})})]})]})})]})]})}var yn=e=>String(e).padStart(2,`0`);function bn({label:e,value:t,max:n,onCommit:r}){let[i,a]=(0,H.useState)(yn(t)),o=(0,H.useRef)(null),s=!(/^\d{1,2}$/.test(i)&&Number(i)===t),c=`${e} must be 00–${yn(n)}.`,l=(0,H.useId)();return(0,H.useEffect)(()=>{o.current?.setCustomValidity(s?c:``)},[s,c]),(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{ref:o,"aria-label":e,"aria-invalid":s||void 0,"aria-describedby":s?l:void 0,inputMode:`numeric`,maxLength:2,className:`w-20 border-border text-center tabular-nums`,value:i,onChange:e=>{a(e.target.value),/^\d{1,2}$/.test(e.target.value)&&Number(e.target.value)<=n&&r(Number(e.target.value))},onBlur:()=>a(yn(t))}),s?(0,K.jsx)(`p`,{id:l,className:`order-last basis-full text-xs text-destructive`,children:c}):null]})}var xn=[{minutes:void 0,label:`No limit`},{minutes:30,label:`30 minutes`},{minutes:120,label:`2 hours`},{minutes:360,label:`6 hours`},{minutes:1440,label:`1 day`},{minutes:10080,label:`7 days`}],Sn=`none`,Cn=e=>String(e).padStart(2,`0`);function wn(e,t=Date.now()){let n=ft(t,e)??ft(t,`UTC`),r=new Date(Date.UTC(n.year,n.month-1,n.day+1));return`${r.getUTCFullYear()}-${Cn(r.getUTCMonth()+1)}-${Cn(r.getUTCDate())}T09:00`}function Tn(){let e=typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[];return e.includes(`UTC`)?e:[`UTC`,...e]}function En({value:e,stored:t,onChange:n}){let r=t=>n({...e,...t}),i=e.at?at(e.at):null,a=e.at?.slice(0,10)??``,o=i?.hour??9,s=i?.minute??0,c=(e,t,n)=>r({at:`${e}T${Cn(t)}:${Cn(n)}`}),l=(0,H.useRef)(null),u=(0,H.useId)(),d=et(e),f=!(t?.type===`once`&&t.at===e.at&&t.timeZone===e.timeZone)&&d!==null&&d<=Date.now();(0,H.useEffect)(()=>{l.current?.setCustomValidity(f?Ze:``)},[f]);let p=lt(e);return(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-4 gap-y-3`,children:[(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(A,{htmlFor:`automation-once-date`,children:`Date`}),(0,K.jsx)(B,{ref:l,id:`automation-once-date`,type:`date`,className:`w-44 max-w-full border-border`,value:a,"aria-invalid":f||void 0,"aria-describedby":f?u:void 0,onChange:e=>{/^\d{4}-\d{2}-\d{2}$/.test(e.target.value)&&c(e.target.value,o,s)},required:!0})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,K.jsx)(bn,{label:`Hour`,value:o,max:23,onCommit:e=>c(a,e,s)}),(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,K.jsx)(bn,{label:`Minute`,value:s,max:59,onCommit:e=>c(a,o,e)})]})]}),f?(0,K.jsx)(`p`,{id:u,className:`text-xs text-destructive`,children:Ze}):null,(0,K.jsx)(On,{value:e.timeZone??``,onCommit:e=>r({timeZone:e})}),(0,K.jsx)(kn,{value:e.latestStartMinutes,onChange:t=>n(Dn(e,t))}),p?(0,K.jsx)(`p`,{className:`text-sm break-words`,children:`Runs once at ${p.time} on ${p.date} (${e.timeZone}). ${p.note?`${p.note} `:``}Squawk must be running then.`}):null]})}function Dn(e,t){let{latestStartMinutes:n,...r}=e;return t===void 0?r:{...r,latestStartMinutes:t}}function On({value:e,onCommit:t}){let[n,r]=(0,H.useState)(e),i=(0,H.useRef)(null),a=(0,H.useId)(),o=(0,H.useId)(),[s]=(0,H.useState)(Tn),c=n!==e||!Xe(n),l=tt(n);return(0,H.useEffect)(()=>{i.current?.setCustomValidity(c?l:``)},[c,l]),(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(A,{htmlFor:`automation-once-zone`,children:`Time zone`}),(0,K.jsx)(B,{ref:i,id:`automation-once-zone`,list:a,autoComplete:`off`,spellCheck:!1,className:`w-full border-border sm:w-72`,value:n,"aria-invalid":c||void 0,"aria-describedby":c?o:void 0,onChange:e=>{r(e.target.value),Xe(e.target.value)&&t(e.target.value)}}),(0,K.jsx)(`datalist`,{id:a,children:s.map(e=>(0,K.jsx)(`option`,{value:e},e))}),c?(0,K.jsx)(`p`,{id:o,className:`text-xs break-words text-destructive`,children:l}):null]})}function kn({value:e,onChange:t}){let n=xn.some(t=>t.minutes===e)||e===void 0?xn:[...xn,{minutes:e,label:`${e} minutes`}];return(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(A,{htmlFor:`automation-once-latest`,children:`Latest start`}),(0,K.jsxs)(I,{value:e===void 0?Sn:String(e),onValueChange:e=>t(e===Sn?void 0:Number(e)),children:[(0,K.jsx)(N,{id:`automation-once-latest`,className:`w-full sm:w-48`,"aria-label":`Latest start`,children:(0,K.jsx)(M,{})}),(0,K.jsx)(P,{children:n.map(e=>(0,K.jsx)(F,{value:e.minutes===void 0?Sn:String(e.minutes),children:e.label},e.label))})]}),(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`If Squawk was not running at the time, it still starts the task this long afterwards; later, the schedule is marked missed.`})]})}var An=[{type:`daily`,label:`Every day`},{type:`weekdays`,label:`Weekdays`},{type:`weekly`,label:`Weekly`},{type:`hours`,label:`Every N hours`},{type:`once`,label:`Once`}];function jn({value:e,stored:t,onChange:n,timeZone:r}){let i=t=>n({...e,...t}),a=t=>i(t===`once`?{type:t,at:e.at??wn(r),timeZone:e.timeZone??r}:{type:t});return(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[(0,K.jsx)(`div`,{role:`group`,"aria-label":`Repeat`,className:`inline-flex w-fit max-w-full flex-wrap gap-1 rounded-lg border border-border bg-muted/60 p-1`,children:An.map(t=>(0,K.jsx)(sn,{pressed:e.type===t.type,onClick:()=>a(t.type),children:t.label},t.type))}),e.type===`once`?(0,K.jsx)(En,{value:e,stored:t,onChange:n}):null,e.type===`weekly`?(0,K.jsx)(`div`,{role:`group`,"aria-label":`Day of the week`,className:`inline-flex w-fit max-w-full flex-wrap gap-1 rounded-lg border border-border bg-muted/60 p-1`,children:ut.map((t,n)=>(0,K.jsx)(sn,{pressed:e.day===n+1,onClick:()=>i({day:n+1}),children:t},t))}):null,e.type===`once`?null:e.type===`hours`?(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(A,{htmlFor:`automation-every`,children:`Run every`}),(0,K.jsxs)(I,{value:String(e.every),onValueChange:e=>i({every:Number(e)}),children:[(0,K.jsx)(N,{id:`automation-every`,className:`w-full sm:w-48`,"aria-label":`Run every`,children:(0,K.jsx)(M,{})}),(0,K.jsx)(P,{children:st.map(e=>(0,K.jsx)(F,{value:String(e),children:e===1?`hour`:`${e} hours`},e))})]}),(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Counted from midnight, so “every 6 hours” runs at 00:00, 06:00, 12:00 and 18:00.`})]}):(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,K.jsx)(bn,{label:`Hour`,value:e.hour,max:23,onCommit:e=>i({hour:e})}),(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,K.jsx)(bn,{label:`Minute`,value:e.minute,max:59,onCommit:e=>i({minute:e})}),(0,K.jsx)(`span`,{className:`text-sm break-all text-muted-foreground`,children:r})]}),e.type===`once`?null:(0,K.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Cron: `,(0,K.jsx)(`code`,{className:`font-mono text-foreground`,children:it(e)})]})]})}var Mn=40*864e5,Nn=5;function Pn({schedule:e,timeZone:t,now:n=Date.now()}){if(e.type===`once`)return(0,K.jsx)(Fn,{schedule:e,now:n});let r=$e(e,n+1,n+Mn,t,Nn);return(0,K.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,"data-slot":`next-runs`,className:`min-w-0 rounded-xl border bg-card p-5`,children:[(0,K.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-2 text-base font-semibold`,children:`Next 5 runs`}),r.length===0?(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No runs in the next 40 days.`}):(0,K.jsx)(`ol`,{"aria-label":`Next 5 runs`,className:`grid divide-y divide-border text-sm`,children:r.map((e,r)=>(0,K.jsxs)(`li`,{className:`flex min-h-10 items-center justify-between gap-3 py-1.5`,children:[(0,K.jsx)(`span`,{className:r===0?`font-semibold tabular-nums text-foreground`:`font-medium tabular-nums`,children:V(new Date(e).toISOString(),t)}),(0,K.jsx)(`span`,{className:r===0?`font-medium text-accent-text`:`text-muted-foreground`,children:rt(n,e)})]},e))}),(0,K.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Times are in `,t,`, the zone this Squawk runs in.`]})]})}function Fn({schedule:e,now:t}){let n=et(e),r=lt(e);return(0,K.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,"data-slot":`next-runs`,className:`min-w-0 rounded-xl border bg-card p-5`,children:[(0,K.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-base font-semibold`,children:`Runs once`}),n===null||!r?(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pick a date, a time and a time zone.`}):(0,K.jsxs)(`p`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 text-sm`,children:[(0,K.jsx)(`span`,{className:`font-medium tabular-nums`,children:`${r.date} ${r.time}`}),n>t?(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:rt(t,n)}):null]}),r?.note?(0,K.jsx)(`p`,{className:`mt-2 text-sm break-words`,children:r.note}):null,n!==null&&n<=t?(0,K.jsx)(`p`,{className:`mt-2 text-sm text-destructive`,children:`The due time has passed.`}):null,(0,K.jsx)(`p`,{className:`mt-3 text-xs break-words text-muted-foreground`,children:`Times are in ${e.timeZone??`UTC`}. Squawk must be running then; afterwards the schedule is archived with its task.`})]})}var In={schedule:`On a schedule`,github:`When GitHub changes`};function Ln(e){return/time zone|due time/i.test(e)?`when`:/placeholder|prompt|workflow|runner|model|task|autonomous/i.test(e)?`run`:/\bname\b/i.test(e)?`name`:/schedule|github|event|filter|label|interval|remote|forge|lookback|records?|hour|minute|poll|kind|archived/i.test(e)?`when`:`form`}function Rn({title:e,hideLegend:t=!1,failure:n,section:r,children:i}){let a=(0,H.useId)();return(0,K.jsxs)(`section`,{role:t?void 0:`group`,"aria-labelledby":t?void 0:a,className:`grid min-w-0 gap-3.5 rounded-xl border border-card-edge bg-card shadow-card p-5`,children:[t?null:(0,K.jsx)(`h2`,{id:a,className:`text-sm font-semibold text-foreground`,children:e}),i,n?.section===r&&!n.conflict?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:n.message}):null]})}function zn({draft:e,patch:t,forge:n,automation:r}){return(0,K.jsx)(K.Fragment,{children:r?(0,K.jsxs)(`p`,{className:`text-sm`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`Trigger · `}),In[e.kind]]}):(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,K.jsx)(Ke,{slot:`automation-kind`,label:`Trigger`,size:`touch`,value:e.kind,onChange:e=>t({kind:e}),options:[{value:`schedule`,label:In.schedule},{value:`github`,label:In.github,disabled:!n.available,...n.available?{}:{title:n.reason??`GitHub is unavailable`}}]}),n.available?null:(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`GitHub unavailable · ${n.reason??`no GitHub access`}`})]})})}function Bn({draft:e,patch:t,forge:n,timeZone:r,automation:i}){return e.kind===`schedule`?(0,K.jsx)(jn,{value:e.schedule,stored:i?.schedule,onChange:e=>t({schedule:e}),timeZone:r}):(0,K.jsx)(vn,{draft:e,onChange:t,...n.available?{}:{disabledReason:n.reason??`no GitHub access`}})}function Vn({draft:e,patch:t,saving:n,automation:r}){let i=e.kind===`schedule`?[`date`,`time`,`project`,`automation`]:[`github.kind`,`github.number`,`github.title`,`github.url`,`github.author`,`github.assignees`,`github.labels`,`github.event`],a=[...new Set([...e.prompt.matchAll(/\{\{([^{}]+)\}\}/g)].map(e=>e[1]))].filter(e=>!i.includes(e));return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,K.jsx)(A,{htmlFor:`automation-prompt`,children:`Prompt`}),(0,K.jsx)(Ye,{id:`automation-prompt`,value:e.prompt,onChange:e=>t({prompt:e.target.value}),rows:3,className:`[field-sizing:fixed] min-h-[88px] resize-none border-border bg-background`,required:!0}),(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:e.kind===`schedule`?(0,K.jsxs)(K.Fragment,{children:[`Available: `,`{{date}}`,` `,`{{time}}`,` `,`{{project}}`,` `,`{{automation}}`,`. A run-context block is appended automatically.`]}):(0,K.jsxs)(K.Fragment,{children:[`Available: `,`{{github.number}}`,` `,`{{github.title}}`,` `,`{{github.url}}`,` `,`{{github.labels}}`,`. GitHub content is appended as untrusted context.`]})})]}),a.length?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:`Unavailable for this trigger: ${a.map(e=>`{{${e}}}`).join(`, `)}`}):null,(0,K.jsx)(Kn,{draft:e,patch:t}),(0,K.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,K.jsx)(Te,{"aria-label":`Autonomous`,checked:e.autonomous,onCheckedChange:e=>t({autonomous:e})}),(0,K.jsxs)(`span`,{children:[`Autonomous `,(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`· runs without waiting for answers`})]})]}),(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`Each run is an ordinary task in its own worktree, queued behind the parallel cap.`}),(0,K.jsx)(We,{archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,onChange:t,disabled:n}),(0,K.jsx)(Re,{allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging,onChange:t,disabled:n}),r?(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`These settings apply to future tasks. Existing tasks keep their settings.`}):null]})}function Hn({draft:e,patch:t,automation:n}){let r=e.kind===`schedule`;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,K.jsx)(Te,{"aria-label":n?`Enabled`:`Enable after saving`,checked:e.enabled,onCheckedChange:e=>t({enabled:e})}),(0,K.jsx)(`span`,{children:n?`Enabled`:`Enable after saving`})]}),(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:r&&e.schedule.type===`once`?`It runs once at the time set above, then moves to Archived with its task.`:r?`The first run is the next occurrence shown beside the schedule.`:gn(e.filters.includeExisting)})]})}function Un({automation:e,forge:t,timeZone:n,onSaved:r,onReload:i}){let[a,o]=(0,H.useState)(()=>Ut(e)),[s,c]=(0,H.useState)(e?.revision),[l,u]=(0,H.useState)(),[p,h]=(0,H.useState)(!1),[g,v]=(0,H.useState)(!1),[y,b]=(0,H.useState)(!1),[x,te]=(0,H.useState)(``),S=e=>o(t=>({...t,...e})),ne=async t=>{if(t.preventDefault(),p)return;let n=t.currentTarget;if(n instanceof HTMLFormElement&&!n.checkValidity()){n.reportValidity();return}h(!0),u(void 0);let i=`save`;try{if(e&&s!==void 0){let{automation:t}=await f(e.id,Jt({...a,enabled:e.enabled},s));c(t.revision),a.enabled!==e.enabled&&(i=`enable`,await m(e.id,a.enabled))}else await ee(qt(a));r()}catch(t){let n=t instanceof Error?t.message:String(t);i===`save`&&e&&t instanceof d&&t.status===409&&/revision conflict/i.test(n)?u({section:`form`,message:`Edited elsewhere — reload to see the latest version`,conflict:!0}):u({section:i===`enable`?`enable`:Ln(n),message:n})}finally{h(!1)}},re=async()=>{if(!(!e||y)){b(!0),te(``);try{await _(e.id),r()}catch(e){te(e instanceof Error?e.message:String(e))}finally{b(!1)}}},ie=(0,H.useId)(),ae=(0,H.useId)(),C=a.kind===`schedule`;return(0,K.jsx)(ke,{route:`automations`,density:a.name.trim()===``&&a.prompt.trim()===``?`sparse`:`full`,header:Gn({automation:e,draft:a,formId:ie,saveHintId:ae,saving:p}),children:(0,K.jsxs)(`form`,{id:ie,className:`automation-editor grid min-w-0 gap-4 md:grid-cols-[minmax(0,1fr)_320px] md:items-start`,onSubmit:ne,children:[(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-3.5`,children:[(0,K.jsx)(Rn,{title:`Name`,hideLegend:!0,section:`name`,failure:l,children:(0,K.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,K.jsx)(A,{htmlFor:`automation-name`,className:`text-sm font-semibold text-foreground`,children:`Name`}),(0,K.jsx)(B,{id:`automation-name`,className:`border-border`,value:a.name,placeholder:`Daily dependency audit`,onChange:e=>S({name:e.target.value}),required:!0})]})}),(0,K.jsxs)(Rn,{title:`When`,section:`when`,failure:l,children:[(0,K.jsx)(zn,{draft:a,patch:S,forge:t,automation:e}),(0,K.jsx)(Bn,{draft:a,patch:S,forge:t,timeZone:n,automation:e})]}),(0,K.jsx)(Rn,{title:`What to run`,section:`run`,failure:l,children:(0,K.jsx)(Vn,{draft:a,patch:S,saving:p,automation:e})}),(0,K.jsx)(Rn,{title:`Enable`,section:`enable`,failure:l,children:(0,K.jsx)(Hn,{draft:a,patch:S,automation:e})}),l?.section===`form`?(0,K.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 text-sm text-destructive`,children:[(0,K.jsx)(`span`,{className:`break-words`,children:l.message}),l.conflict&&i?(0,K.jsx)(j,{type:`button`,variant:`outline`,onClick:i,children:`Reload`}):null]}):null,e?(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2 border-t pt-4`,children:[g?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? It will stop running and cannot be restored.`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(j,{type:`button`,variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:y,onClick:()=>void re(),children:`Delete automation`}),(0,K.jsx)(j,{type:`button`,variant:`outline`,disabled:y,onClick:()=>{v(!1),te(``)},children:`Keep`})]})]}):(0,K.jsx)(j,{type:`button`,variant:`outline`,"data-action":`automation-delete`,onClick:()=>v(!0),children:`Delete`}),x?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:x}):null]}):null]}),(0,K.jsxs)(`aside`,{className:`grid min-w-0 max-w-full grid-cols-[minmax(0,1fr)] gap-4 md:sticky md:top-4`,children:[C?(0,K.jsx)(Pn,{schedule:a.schedule,timeZone:n}):(0,K.jsxs)(`section`,{className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-5`,children:[(0,K.jsx)(`h2`,{className:`mb-2 text-base font-semibold`,children:`How it polls`}),(0,K.jsx)(`p`,{className:`text-sm break-words text-muted-foreground`,children:_n(a)})]}),(0,K.jsx)(on,{draft:a})]})]})})}function Wn(e){let t=[!e.name.trim()&&`a name`,!e.prompt.trim()&&`a prompt`].filter(Boolean);return t.length?`Add ${t.join(` and `)} to save.`:``}function Gn({automation:e,draft:t,formId:n,saveHintId:r,saving:i}){let a=t.name.trim()?t.prompt.trim()?``:`Prompt`:`Name`,o=Wn(t),s=e?`Save changes`:t.enabled?`Save and enable`:`Save paused`;return{title:e?`Edit automation`:`New automation`,subtitle:`Define when it runs and the ordinary task it launches.`,status:(0,K.jsx)(`p`,{id:r,"data-slot":`automation-save-hint`,className:`min-h-[1lh] text-xs text-muted-foreground`,children:o}),secondaryActions:(0,K.jsx)(R,{type:`button`,variant:`outline`,asChild:!0,children:(0,K.jsx)(L,{to:`/automations`,children:`Cancel`})}),primaryAction:(0,K.jsx)(R,{type:`submit`,form:n,variant:`primary`,disabled:i||a!==``,title:a?`${a} is required`:void 0,"aria-describedby":o?r:void 0,children:i?`Saving…`:s})}}function Kn({draft:e,patch:t}){let n=i(),r=Ve(),{runners:u,signedOut:d}=r.runnersOn(e=>r.repoAccount?.[e]),f=a(),p=s(),{runner:m,ready:h}=o(e.runner??f.data?.defaultRunner??`claude`),g=c(m,h,r.repoAccount?.[m]),ee=[...new Set([...(n.data?.workflows??[]).map(e=>e.name),...e.workflow?[e.workflow]:[]])],_=[...new Set([...u,...e.runner?[e.runner]:[]])],v=ze(m,p.data,g.data,[e.model]),y=v.find(t=>t.id===(e.model??``))?.label??e.model??`auto`,b=e=>(0,K.jsx)(e,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`});return(0,K.jsx)(Le,{children:(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(Fe,{slot:`automation-workflow-pill`,icon:b(ye),fieldLabel:!0,ariaLabel:`Workflow`,label:e.workflow??`inline steps`,value:e.workflow??``,disabled:e.workflow===void 0,disabledHint:`This automation carries its own steps.`,options:ee.map(e=>({value:e,label:e})),onPick:e=>t({workflow:e})}),(0,K.jsx)(Fe,{slot:`automation-runner-pill`,icon:b(ge),fieldLabel:!0,ariaLabel:`Runner`,label:e.runner?l(p.data,e.runner):`default`,value:e.runner??``,disabled:!p.data,options:[{value:``,label:`default`,desc:`The project’s default runner`},..._.map(e=>({value:e,label:l(p.data,e)}))],footer:(0,K.jsx)(Ie,{uninstalled:r.uninstalled,signedOut:d.filter(t=>t!==e.runner)}),onPick:e=>{t({runner:e||void 0,model:void 0})}}),(0,K.jsx)(Fe,{slot:`automation-model-pill`,icon:b(be),fieldLabel:!0,ariaLabel:`Model`,label:y,value:e.model??``,options:v.map(e=>({value:e.id,label:e.label,desc:e.desc})),onPick:e=>t({model:e||void 0})})]})})}function qn(e){return{text:/\bauth\b|sign.?in|\blogin\b|\btoken\b|credentials|HTTP 401/i.test(e)?`GitHub CLI is not signed in`:/ENOENT|not found.*gh|gh.*not found/i.test(e)?`GitHub CLI is not installed`:`GitHub filter check failed`,tone:`error`,details:e}}function Jn({data:e,error:t,refresh:n,archived:i=!1,onArchivedChange:a}){let[o,s]=(0,H.useState)({}),[c,l]=(0,H.useState)({}),d=(e,t)=>s(n=>{let{[e]:r,...i}=n;return t?{...i,[e]:t}:i}),f=async(e,t,n=!1)=>{l(t=>({...t,[e]:!0}));try{await t()}catch(t){let r=t instanceof Error?t.message:String(t);d(e,n?qn(r):{text:r,tone:`error`})}finally{l(t=>({...t,[e]:!1}))}},p=e=>f(e.id,async()=>{d(e.id,{text:`Starting…`,tone:`info`});let{runId:t}=await u(e.id);d(e.id,{text:`Started task`,tone:`info`,runId:t}),n()}),h=e=>f(e.id,async()=>{d(e.id,void 0),await m(e.id,!e.enabled),await n()}),g=e=>f(e.id,async()=>{d(e.id,void 0),await te(e.id),await n()}),ee=e=>f(e.id,async()=>{d(e.id,{text:`Checking…`,tone:`info`});let{checkId:t}=await S(e.id,`preview`);for(let r=0;r<60;r+=1){let r=await v(t);if(r.status===`complete`){d(e.id,{text:`${r.matches??0} filter match${r.matches===1?``:`es`} found; no tasks launched. Counts can include closed items and previously processed events.`,tone:`info`}),n();return}if(r.status===`error`){let t=r.error??`Preview failed`;d(e.id,qn(t));return}await new Promise(e=>setTimeout(e,500))}throw Error(`Preview is still running`)},!0),_=e?.automations??[],y=_.filter(e=>!e.archived),b=_.filter(e=>!!e.archived),x=i?b:y;return(0,K.jsx)(z,{route:`automations`,density:e?je(x.length):`full`,headerSpacing:`compact`,header:{title:`Automations`,subtitle:`Schedules and GitHub checks run while Squawk is open.`,primaryAction:(0,K.jsx)(R,{variant:`primary`,asChild:!0,children:(0,K.jsxs)(L,{to:`/automations/new`,children:[(0,K.jsx)(me,{"aria-hidden":`true`,className:`size-4`}),`New automation`]})})},sparseFooter:e&&x.length>0&&!i?(0,K.jsx)(Me,{summary:`${x.length} active ${x.length===1?`automation`:`automations`} configured. New automations start paused so you can test filters before enabling them.`,actions:(0,K.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,K.jsx)(L,{to:`/automations/new`,children:`Add another`})})}):void 0,children:t&&!e?(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,K.jsx)(q,{text:t}),(0,K.jsx)(j,{variant:`outline`,onClick:()=>void n(),children:`Retry`})]}):e?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-end justify-between gap-3 border-b border-border`,children:[a?(0,K.jsxs)(`div`,{className:`flex gap-6`,role:`group`,"aria-label":`Filter automations`,children:[(0,K.jsxs)(`button`,{type:`button`,"data-slot":`automations-tab`,"data-view":`active`,"aria-pressed":!i,onClick:()=>a(!1),className:r(`-mb-px flex min-h-11 items-center justify-center gap-1.5 border-b-2 border-transparent text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground`,!i&&`border-accent-text text-foreground`),children:[`Current`,(0,K.jsx)(Yn,{count:y.length})]}),(0,K.jsxs)(`button`,{type:`button`,"data-slot":`automations-tab`,"data-view":`archived`,"aria-pressed":i,onClick:()=>a(!0),className:r(`-mb-px flex min-h-11 items-center justify-center gap-1.5 border-b-2 border-transparent text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground`,i&&`border-accent-text text-foreground`),children:[`Archived`,(0,K.jsx)(Yn,{count:b.length})]})]}):(0,K.jsx)(`span`,{}),(0,K.jsx)(`div`,{className:`pb-2.5`,children:(0,K.jsx)(Xn,{data:e})})]}),i&&x.length===0?(0,K.jsx)(q,{text:`No archived automations.`}):x.length===0?(0,K.jsx)(Ne,{icon:(0,K.jsx)(ve,{}),tone:`neutral`,title:`No automations yet`,subtitle:`Create one paused, preview it, then enable it.`,heading:`h2`,actions:(0,K.jsx)(j,{variant:`primary`,asChild:!0,children:(0,K.jsxs)(L,{to:`/automations/new`,children:[(0,K.jsx)(me,{"aria-hidden":`true`,className:`size-4`}),`New automation`]})})}):(0,K.jsx)(`ul`,{className:`grid gap-3`,"aria-label":`Automations`,children:x.map(t=>(0,K.jsx)(ar,{automation:t,timeZone:e.timeZone,note:o[t.id],busy:c[t.id]===!0,onRun:()=>void p(t),onToggle:()=>void h(t),onPreview:()=>void ee(t),onCancel:()=>void g(t)},t.id))})]}):(0,K.jsx)(q,{text:`Loading automations…`})})}function Yn({count:e}){return e===0?null:(0,K.jsx)(`span`,{"data-slot":`automations-tab-count`,className:`tabular-nums text-muted-foreground`,children:`· ${e}`})}function Xn({data:e}){return(0,K.jsx)(`p`,{"data-slot":`automation-scheduler`,className:r(`text-xs break-words`,e.scheduler.state===`scheduled`?`text-success`:`text-muted-foreground`),children:`Scheduler ${e.scheduler.state===`scheduled`?`running`:`idle`} · GitHub ${e.available?`available`:`unavailable`}${e.reason?` · ${e.reason}`:``} · ${e.timeZone}`})}function Zn(e){return e.kind===`schedule`&&e.schedule?nt(e.schedule):`${un(e.events??[])} · every ${Math.round((e.intervalSeconds??300)/60)} min`}function Qn({automation:e,nextRun:t}){let n=e.kind===`schedule`?he:pe,r=qe(e);return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`h2`,{className:`flex items-center gap-2 font-semibold break-words`,children:[(0,K.jsx)(n,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),e.name]}),(0,K.jsxs)(`p`,{"data-slot":`automation-meta`,className:`mt-1 flex flex-wrap items-baseline gap-x-1.5 ps-6 text-xs break-words text-muted-foreground`,children:[(0,K.jsx)(`span`,{children:Zn(e)}),t?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),t]}):null]})]}),(0,K.jsx)(Ge,{dot:r.tone,shape:r.shape,pulse:r.pulse,children:r.label})]})}function $n({automation:e,archive:t}){return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:`text-sm break-words`,children:[t.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`,t.runId?(0,K.jsxs)(K.Fragment,{children:[` · `,(0,K.jsx)(L,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${t.runId}`,children:`Open task`})]}):null]}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,K.jsx)(j,{variant:`outline`,asChild:!0,children:(0,K.jsx)(L,{to:`/automations/${e.id}`,children:`Details`})})})]})}function er({automation:e,timeZone:t}){let n=e.kind===`schedule`,r=e.enabled&&n?e.nextRunAt:void 0;return!n&&e.enabled?(0,K.jsx)(`span`,{children:`continuous`}):r?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`text-foreground`,children:`Next run: ${V(r,t)}`}),(0,K.jsx)(`span`,{children:`· ${rt(Date.now(),Date.parse(r))}`})]}):(0,K.jsx)(`span`,{children:`Next run: —`})}function tr({automation:e,timeZone:t}){let n=e.enabled?bt(e.state):void 0;return n?(0,K.jsxs)(`p`,{role:`alert`,"data-slot":`automation-failing`,className:`text-sm break-words text-destructive`,children:[`The last ${n.consecutiveFailures} checks failed: ${n.lastError}`,n.retryAt?(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:` · Next try ${V(n.retryAt,t)}`}):null]}):null}var $=`h-8 px-3 max-md:h-11 no-hover:h-11`;function nr({automation:e,busy:t,confirmingCancel:n,cancelRef:i,onToggle:a,onRun:o,onPreview:s,onOpenCancel:c}){let l=e.kind===`schedule`,u=e.schedule?.type===`once`;return(0,K.jsxs)(`div`,{"data-slot":`automation-actions`,className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(j,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-toggle`,disabled:t,onClick:a,children:e.enabled?`Pause`:`Enable`}),l?(0,K.jsx)(j,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-run`,disabled:t,onClick:o,children:`Run now`}):(0,K.jsx)(j,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-preview`,disabled:t,onClick:s,children:`Test filter`}),(0,K.jsx)(j,{variant:`outline`,size:`sm`,className:$,asChild:!0,children:(0,K.jsx)(L,{to:`/automations/${e.id}`,children:`Edit`})}),u&&!n?(0,K.jsx)(j,{variant:`outline`,size:`sm`,className:r($,`text-destructive`),ref:i,"data-action":`automation-cancel`,disabled:t,onClick:c,children:`Cancel`}):null,(0,K.jsx)(j,{variant:`outline`,size:`sm`,className:r($,`sm:ms-auto`),asChild:!0,children:(0,K.jsx)(L,{to:`/automations/${e.id}/log`,children:`Execution log`})})]})}function rr({automation:e,busy:t,keepRef:n,onConfirm:r,onKeep:i}){return(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,K.jsx)(`p`,{className:`text-sm break-words`,children:`Cancel “${e.name}”? It will never run, and it moves to Archived.`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(j,{variant:`danger-ghost`,"data-action":`automation-cancel-confirm`,disabled:t,onClick:r,children:`Cancel schedule`}),(0,K.jsx)(j,{ref:n,variant:`outline`,disabled:t,onClick:i,children:`Keep`})]})]})}function ir({note:e}){return(0,K.jsxs)(`div`,{role:e.tone===`error`?`alert`:`status`,className:r(`text-sm break-words`,e.tone===`error`?`text-destructive`:`text-muted-foreground`),children:[e.text,e.details?(0,K.jsxs)(K.Fragment,{children:[` · `,(0,K.jsx)(de,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:Oe(`gh`),children:`Set up`}),(0,K.jsxs)(`details`,{children:[(0,K.jsx)(`summary`,{className:`min-h-11 cursor-pointer`,children:`Command details`}),(0,K.jsx)(`pre`,{className:`whitespace-pre-wrap break-words`,children:e.details})]})]}):null,e.runId?(0,K.jsxs)(K.Fragment,{children:[` · `,(0,K.jsx)(L,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`})]}):null]})}function ar({automation:e,timeZone:t,note:n,busy:r,onRun:i,onToggle:a,onPreview:o,onCancel:s}){let[c,l]=(0,H.useState)(!1),u=(0,H.useRef)(null),d=(0,H.useRef)(null),f=(0,H.useRef)(null);(0,H.useEffect)(()=>{let e=f.current===`keep`?d.current:f.current===`cancel`?u.current:null;f.current=null,e?.focus()},[c]);let p=()=>{f.current=`keep`,l(!0)},m=()=>{f.current=`cancel`,l(!1)},h=e.archived;return(0,K.jsxs)(`li`,{"data-slot":`automation-card`,"data-kind":e.kind,className:`flex min-w-0 flex-col gap-2.5 rounded-xl border border-card-edge bg-card p-4 shadow-card`,children:[(0,K.jsx)(Qn,{automation:e,nextRun:h?void 0:(0,K.jsx)(er,{automation:e,timeZone:t})}),h?(0,K.jsx)($n,{automation:e,archive:h}):null,h?null:(0,K.jsx)(tr,{automation:e,timeZone:t}),h?null:(0,K.jsx)(nr,{automation:e,busy:r,confirmingCancel:c,cancelRef:u,onToggle:a,onRun:i,onPreview:o,onOpenCancel:p}),e.schedule?.type===`once`&&!h&&c?(0,K.jsx)(rr,{automation:e,busy:r,keepRef:d,onConfirm:()=>{l(!1),s()},onKeep:m}):null,n?(0,K.jsx)(ir,{note:n}):null,(0,K.jsx)(Mt,{automationId:e.id,automationName:e.name,timeZone:t})]})}function or(e){let t=De(),n=Je(),[r,i]=(0,H.useState)(),[a,o]=(0,H.useState)(``),s=(0,H.useCallback)(t=>ie({signal:t,...e?{archived:e}:{}}).then(e=>{t?.aborted||(i(e),o(``))}).catch(e=>{t?.aborted||o(String(e))}),[e]);return(0,H.useEffect)(()=>{n&&s()},[n,s]),(0,H.useEffect)(()=>p(async e=>{n&&await s(e)}),[n,s]),(0,H.useEffect)(()=>fe((e,n)=>{if(e!==`automation-change`)return;let r=n;typeof r.project==`string`&&(t===null||r.project===t)&&s()}),[t,s]),{data:r,error:a,refresh:s}}function sr({mode:e=`list`}){let{automationId:t}=ue(),n=Ee(),[r,i]=(0,H.useState)(!1),{data:a,error:o,refresh:s}=or(`include`),[c,l]=(0,H.useState)(0),u=Be();if(u===`unknown`)return(0,K.jsx)(z,{route:`automations`,density:`empty`,children:(0,K.jsx)(q,{text:`Loading automations…`})});if(u===`absent`)return(0,K.jsx)(Pe,{});if(u===`disabled`)return(0,K.jsx)(z,{route:`automations`,density:`empty`,children:(0,K.jsx)(Ne,{icon:(0,K.jsx)(ve,{}),tone:`neutral`,title:`Automations are off`,subtitle:`This server does not run schedules, poll GitHub or launch tasks from them. Unset CEZ_AUTOMATIONS or set it to 1 and restart Squawk to turn automations on.`,heading:`h2`})});let d=()=>{n(`/automations`),s()},f=a?.automations.find(e=>e.id===t);if(e===`list`)return(0,K.jsx)(Jn,{data:a,error:o,refresh:s,archived:r,onArchivedChange:i});if(!a)return o?(0,K.jsx)(z,{route:`automations`,density:`empty`,header:{title:`Automations`,subtitle:`Could not load automations.`},children:(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,K.jsx)(q,{text:o}),(0,K.jsx)(j,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]})}):(0,K.jsx)(z,{route:`automations`,density:`empty`,children:(0,K.jsx)(q,{text:`Loading automations…`})});let p={available:a.available,...a.reason?{reason:a.reason}:{}};return e===`new`?(0,K.jsx)(Un,{forge:p,timeZone:a.timeZone,onSaved:d}):e===`edit`?f?f.archived?(0,K.jsx)(Nt,{automation:f,timeZone:a.timeZone,onDeleted:d}):(0,K.jsx)(Un,{automation:f,forge:p,timeZone:a.timeZone,onSaved:d,onReload:()=>void s().then(()=>l(e=>e+1))},`${f.id}:${c}`):(0,K.jsx)(z,{route:`automations`,density:`empty`,header:{title:`Automation not found`,subtitle:`This automation may have been removed.`},children:(0,K.jsx)(j,{asChild:!0,variant:`outline`,children:(0,K.jsx)(L,{to:`/automations`,children:`Back to automations`})})}):t?(0,K.jsx)(jt,{automationId:t,automationName:f?.name,timeZone:a.timeZone,readOnly:!!f?.archived}):(0,K.jsx)(q,{text:`Automation not found.`})}export{sr as AutomationsRoute};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{a as r}from"./dist-C_rn70hE.js";import{a as i,i as a,n as o,r as s,t as c}from"./dist-Tubgdd25.js";import{l,u}from"./es2015-DpKptHDx.js";var d=e(t(),1),f=n(),p=`Collapsible`,[m,h]=a(p),[g,_]=m(p),v=d.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:a,disabled:o,onOpenChange:s,...u}=e,[m,h]=c({prop:r,defaultProp:a??!1,onChange:s,caller:p});return(0,f.jsx)(g,{scope:n,disabled:o,contentId:l(),open:m,onOpenToggle:d.useCallback(()=>h(e=>!e),[h]),children:(0,f.jsx)(i.div,{"data-state":w(m),"data-disabled":o?``:void 0,...u,ref:t})})});v.displayName=p;var y=`CollapsibleTrigger`,b=d.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,a=_(y,n);return(0,f.jsx)(i.button,{type:`button`,"aria-controls":a.open?a.contentId:void 0,"aria-expanded":a.open||!1,"data-state":w(a.open),"data-disabled":a.disabled?``:void 0,disabled:a.disabled,...r,ref:t,onClick:s(e.onClick,a.onOpenToggle)})});b.displayName=y;var x=`CollapsibleContent`,S=d.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=_(x,e.__scopeCollapsible);return(0,f.jsx)(u,{present:n||i.open,children:({present:e})=>(0,f.jsx)(C,{...r,ref:t,present:e})})});S.displayName=x;var C=d.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:a,children:s,...c}=e,l=_(x,n),[u,p]=d.useState(a),m=d.useRef(null),h=r(t,m),g=d.useRef(0),v=g.current,y=d.useRef(0),b=y.current,S=l.open||u,C=d.useRef(S),T=d.useRef(void 0);return d.useEffect(()=>{let e=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(e)},[]),o(()=>{let e=m.current;if(e){T.current=T.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();g.current=t.height,y.current=t.width,C.current||(e.style.transitionDuration=T.current.transitionDuration,e.style.animationName=T.current.animationName),p(a)}},[l.open,a]),(0,f.jsx)(i.div,{"data-state":w(l.open),"data-disabled":l.disabled?``:void 0,id:l.contentId,hidden:!S,...c,ref:h,style:{"--radix-collapsible-content-height":v?`${v}px`:void 0,"--radix-collapsible-content-width":b?`${b}px`:void 0,...e.style},children:S&&s})});function w(e){return e?`open`:`closed`}var T=v;function E({...e}){return(0,f.jsx)(T,{"data-slot":`collapsible`,...e})}function D({...e}){return(0,f.jsx)(b,{"data-slot":`collapsible-trigger`,...e})}function O({...e}){return(0,f.jsx)(S,{"data-slot":`collapsible-content`,...e})}export{O as n,D as r,E as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{c as r,i,o as a}from"./dist-C_rn70hE.js";import{X as o}from"./design-icons-CzEoMH9c.js";import{a as s}from"./dist-Tubgdd25.js";import{l as c}from"./es2015-DpKptHDx.js";import{a as l,o as u,r as d,t as f}from"./dist-BS5vYfFC.js";import{i as p,o as m,r as h,s as g,t as _}from"./dialog-Dbu3HnqC.js";var v=e(t(),1),y=1,b=.9,x=.8,S=.17,C=.1,w=.999,T=.9999,E=.99,D=/[\\\/_+.#"@\[\(\{&]/,O=/[\\\/_+.#"@\[\(\{&]/g,k=/[\s-]/,A=/[\s-]/g;function j(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?y:E;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=j(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=y:D.test(e.charAt(l-1))?(d*=x,p=e.slice(i,l-1).match(O),p&&i>0&&(d*=w**+p.length)):k.test(e.charAt(l-1))?(d*=b,m=e.slice(i,l-1).match(A),m&&i>0&&(d*=w**+m.length)):(d*=S,i>0&&(d*=w**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=T)),(d<C&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=j(e,t,n,r,l+1,a+2,o),f*C>d&&(d=f*C)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function M(e){return e.toLowerCase().replace(A,` `)}function N(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,j(e,t,M(e),M(t),0,0,{})}var P=`[cmdk-group=""]`,F=`[cmdk-group-items=""]`,ee=`[cmdk-group-heading=""]`,I=`[cmdk-item=""]`,L=`${I}:not([aria-disabled="true"])`,R=`cmdk-item-select`,z=`data-value`,te=(e,t,n)=>N(e,t,n),ne=v.createContext(void 0),B=()=>v.useContext(ne),re=v.createContext(void 0),V=()=>v.useContext(re),H=v.createContext(void 0),U=v.forwardRef((e,t)=>{let n=X(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=X(()=>new Set),i=X(()=>new Map),a=X(()=>new Map),o=X(()=>new Set),l=J(e),{label:u,children:d,value:f,onValueChange:p,filter:m,shouldFilter:h,loop:g,disablePointerSelection:_=!1,vimBindings:y=!0,...b}=e,x=c(),S=c(),C=c(),w=v.useRef(null),T=fe();Y(()=>{if(f!==void 0){let e=f.trim();n.current.value=e,E.emit()}},[f]),Y(()=>{T(6,M)},[]);let E=v.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)j(),k(),T(1,A);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(C);e?e.focus():(i=document.getElementById(x))==null||i.focus()}if(T(7,()=>{n.current.selectedItemId=N()?.id,E.emit()}),r||T(5,M),l.current?.value!==void 0){let e=t??``;(o=(a=l.current).onValueChange)==null||o.call(a,e);return}}E.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),D=v.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,O(t,r)),T(2,()=>{k(),E.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),T(3,()=>{j(),k(),n.current.value||A(),E.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=N();T(4,()=>{j(),t?.getAttribute(`id`)===e&&A(),E.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>l.current.shouldFilter,label:u||e[`aria-label`],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:x,inputId:C,labelId:S,listInnerRef:w}),[]);function O(e,t){let r=l.current?.filter??te;return e?r(e,n.current.search,t):0}function k(){if(!n.current.search||l.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=w.current;B().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(F);t?t.appendChild(e.parentElement===t?e:e.closest(`${F} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${F} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=w.current?.querySelector(`${P}[${z}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function A(){let e=B().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(z);E.setState(`value`,e||void 0)}function j(){if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=O(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function M(){var e;let t=N();t&&(t.parentElement?.firstChild===t&&((e=t.closest(P)?.querySelector(ee))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function N(){return w.current?.querySelector(`${I}[aria-selected="true"]`)}function B(){return Array.from(w.current?.querySelectorAll(L)||[])}function V(e){let t=B()[e];t&&E.setState(`value`,t.getAttribute(z))}function H(e){var t;let n=N(),r=B(),i=r.findIndex(e=>e===n),a=r[i+e];(t=l.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&E.setState(`value`,a.getAttribute(z))}function U(e){let t=N()?.closest(P),n;for(;t&&!n;)t=e>0?le(t,P):ue(t,P),n=t?.querySelector(L);n?E.setState(`value`,n.getAttribute(z)):H(e)}let W=()=>V(B().length-1),G=e=>{e.preventDefault(),e.metaKey?W():e.altKey?U(1):H(1)},K=e=>{e.preventDefault(),e.metaKey?V(0):e.altKey?U(-1):H(-1)};return v.createElement(s.div,{ref:t,tabIndex:-1,...b,"cmdk-root":``,onKeyDown:e=>{var t;(t=b.onKeyDown)==null||t.call(b,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:y&&e.ctrlKey&&G(e);break;case`ArrowDown`:G(e);break;case`p`:case`k`:y&&e.ctrlKey&&K(e);break;case`ArrowUp`:K(e);break;case`Home`:e.preventDefault(),V(0);break;case`End`:e.preventDefault(),W();break;case`Enter`:{e.preventDefault();let t=N();if(t){let e=new Event(R);t.dispatchEvent(e)}}}}},v.createElement(`label`,{"cmdk-label":``,htmlFor:D.inputId,id:D.labelId,style:me},u),Q(e,e=>v.createElement(re.Provider,{value:E},v.createElement(ne.Provider,{value:D},e))))}),W=v.forwardRef((e,t)=>{let n=c(),r=v.useRef(null),a=v.useContext(H),o=B(),l=J(e),u=l.current?.forceMount??a?.forceMount;Y(()=>{if(!u)return o.item(n,a?.id)},[u]);let d=de(n,r,[e.value,e.children,r],e.keywords),f=V(),p=Z(e=>e.value&&e.value===d.current),m=Z(e=>u||o.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);v.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(R,h),()=>t.removeEventListener(R,h)},[m,e.onSelect,e.disabled]);function h(){var e,t;g(),(t=(e=l.current).onSelect)==null||t.call(e,d.current)}function g(){f.setState(`value`,d.current,!0)}if(!m)return null;let{disabled:_,value:y,onSelect:b,forceMount:x,keywords:S,...C}=e;return v.createElement(s.div,{ref:i(r,t),...C,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!_,"aria-selected":!!p,"data-disabled":!!_,"data-selected":!!p,onPointerMove:_||o.getDisablePointerSelection()?void 0:g,onClick:_?void 0:h},e.children)}),G=v.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:a,...o}=e,l=c(),u=v.useRef(null),d=v.useRef(null),f=c(),p=B(),m=Z(e=>a||p.filter()===!1?!0:!e.search||e.filtered.groups.has(l));Y(()=>p.group(l),[]),de(l,u,[e.value,e.heading,d]);let h=v.useMemo(()=>({id:l,forceMount:a}),[a]);return v.createElement(s.div,{ref:i(u,t),...o,"cmdk-group":``,role:`presentation`,hidden:!m||void 0},n&&v.createElement(`div`,{ref:d,"cmdk-group-heading":``,"aria-hidden":!0,id:f},n),Q(e,e=>v.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?f:void 0},v.createElement(H.Provider,{value:h},e))))}),K=v.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,a=v.useRef(null),o=Z(e=>!e.search);return!n&&!o?null:v.createElement(s.div,{ref:i(a,t),...r,"cmdk-separator":``,role:`separator`})}),ie=v.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=V(),o=Z(e=>e.search),c=Z(e=>e.selectedItemId),l=B();return v.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),v.createElement(s.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":c,id:l.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),ae=v.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...a}=e,o=v.useRef(null),c=v.useRef(null),l=Z(e=>e.selectedItemId),u=B();return v.useEffect(()=>{if(c.current&&o.current){let e=c.current,t=o.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),v.createElement(s.div,{ref:i(o,t),...a,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:u.listId},Q(e,e=>v.createElement(`div`,{ref:i(c,u.listInnerRef),"cmdk-list-sizer":``},e)))}),oe=v.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return v.createElement(f,{open:n,onOpenChange:r},v.createElement(u,{container:o},v.createElement(l,{"cmdk-overlay":``,className:i}),v.createElement(d,{"aria-label":e.label,"cmdk-dialog":``,className:a},v.createElement(U,{ref:t,...s}))))}),se=v.forwardRef((e,t)=>Z(e=>e.filtered.count===0)?v.createElement(s.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),ce=v.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return v.createElement(s.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Q(e,e=>v.createElement(`div`,{"aria-hidden":!0},e)))}),q=Object.assign(U,{List:ae,Item:W,Input:ie,Group:G,Separator:K,Dialog:oe,Empty:se,Loading:ce});function le(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function ue(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function J(e){let t=v.useRef(e);return Y(()=>{t.current=e}),t}var Y=typeof window>`u`?v.useEffect:v.useLayoutEffect;function X(e){let t=v.useRef();return t.current===void 0&&(t.current=e()),t}function Z(e){let t=V(),n=()=>e(t.snapshot());return v.useSyncExternalStore(t.subscribe,n,n)}function de(e,t,n,r=[]){let i=v.useRef(),a=B();return Y(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(z,s),i.current=s}),i}var fe=()=>{let[e,t]=v.useState(),n=X(()=>new Map);return Y(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function pe(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function Q({asChild:e,children:t},n){return e&&v.isValidElement(t)?v.cloneElement(pe(t),{ref:t.ref},n(t.props.children)):n(t)}var me={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},$=n();function he({className:e,...t}){return(0,$.jsx)(q,{"data-slot":`command`,className:a(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t})}function ge({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:i,showCloseButton:o=!0,filter:s,...c}){return(0,$.jsxs)(_,{...c,children:[(0,$.jsxs)(m,{className:`sr-only`,children:[(0,$.jsx)(g,{children:e}),(0,$.jsx)(p,{children:t})]}),(0,$.jsx)(h,{className:a(`overflow-hidden p-0`,i),showCloseButton:o,children:(0,$.jsx)(he,{...r({filter:s}),className:`**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:n})})]})}function _e({className:e,...t}){return(0,$.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex min-h-11 shrink-0 items-center gap-2 rounded-ss-[inherit] rounded-se-[inherit] border-b px-3`,children:[(0,$.jsx)(o,{className:`size-4 shrink-0 opacity-50`}),(0,$.jsx)(q.Input,{"data-slot":`command-input`,className:a(`flex h-11 min-w-0 flex-1 rounded-md bg-transparent py-3 text-base md:text-sm placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]})}function ve({className:e,onPointerMoveCapture:t,...n}){return(0,$.jsx)(q.List,{"data-slot":`command-list`,onPointerMoveCapture:e=>{t?.(e),e.pointerType===`touch`&&e.stopPropagation()},className:a(`max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto`,e),...n})}function ye({...e}){return(0,$.jsx)(q.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e})}function be({className:e,...t}){return(0,$.jsx)(q.Group,{"data-slot":`command-group`,className:a(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function xe({className:e,...t}){return(0,$.jsx)(q.Separator,{"data-slot":`command-separator`,className:a(`-mx-1 h-px bg-border`,e),...t})}function Se({className:e,...t}){return(0,$.jsx)(q.Item,{"data-slot":`command-item`,className:a(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...t})}function Ce({className:e,...t}){return(0,$.jsx)(`span`,{"data-slot":`command-shortcut`,className:a(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}export{_e as a,xe as c,be as i,Ce as l,ge as n,Se as o,ye as r,ve as s,he as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{Fn as i}from"./toaster-Lf_4oY96.js";import{X as a,j as o,ot as s,r as c}from"./design-icons-CzEoMH9c.js";import{n as l}from"./diff-controls-DbAm3vyj.js";import{l as u}from"./reference-chip-hn8jj_Mo.js";import{t as d}from"./button-C8jUIs8Q.js";import{t as f}from"./project-router-CEnizJ8F.js";import{t as p}from"./centered-state-BgSV4e79.js";import{$n as m,Bt as h,Fn as g,Mn as _,Qt as v,Vt as y,s as b}from"./index-Cmj0hLCQ.js";import{t as x}from"./diff-CVDYtR5f.js";var S=e(t(),1),C=n();function w({commit:e,sha:t,backTo:n,backLabel:r,slot:a,className:m,diffClassName:y}){let b=v(),[w,T]=(0,S.useState)(`unified`),[E,D]=(0,S.useState)(!0),O=e.isError&&e.error instanceof i&&e.error.status===409,k=b?w:`unified`;return(0,C.jsxs)(`section`,{"data-slot":a,"data-sha":t,className:m,children:[(0,C.jsxs)(`div`,{className:`mx-4 flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border py-2 md:mx-9`,children:[(0,C.jsx)(d,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,C.jsxs)(f,{to:n,children:[(0,C.jsx)(c,{size:16,"aria-hidden":`true`}),r]})}),(0,C.jsx)(`span`,{className:`ml-auto flex items-center gap-1`,children:(0,C.jsx)(l,{mode:w,wrap:E,onModeChange:T,onWrapChange:D})})]}),e.isPending?(0,C.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-muted-foreground md:px-9`,children:`Loading commit…`}):e.isError?(0,C.jsx)(p,{icon:O?(0,C.jsx)(u,{}):(0,C.jsx)(s,{size:16}),tone:O?`neutral`:`danger`,heading:`h2`,title:O?`Commit not found`:`Could not load the commit`,subtitle:e.error.message}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`div`,{"data-slot":`commit-meta`,className:`mx-4 border-b border-border py-3 md:mx-9`,children:[(0,C.jsx)(`h2`,{className:`text-sm font-semibold`,children:e.data.subject}),(0,C.jsxs)(`p`,{className:`mt-0.5 flex flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[(0,C.jsx)(`span`,{children:e.data.author}),(0,C.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,C.jsx)(`span`,{title:e.data.when,children:h(e.data.when)}),(0,C.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,C.jsx)(g,{sha:e.data.sha,variant:`inline`}),(0,C.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,C.jsx)(`span`,{"data-slot":`commit-stat`,children:(0,C.jsx)(_,{stat:e.data.stat})})]})]}),e.data.files.length===0?(0,C.jsx)(p,{icon:(0,C.jsx)(o,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,C.jsx)(`div`,{className:y,children:(0,C.jsx)(x,{files:e.data.files,mode:k,wrap:E,totals:!1,className:`min-w-0`})})]})]})}var T=56;function E({slot:e,commits:t,selectedSha:n,className:i,heading:o}){let[s,c]=(0,S.useState)(``),l=s.trim().toLowerCase(),u=l?t.filter(e=>e.subject.toLowerCase().includes(l)):t,d=u.length>150,f=(0,S.useRef)(null),p=(0,S.useRef)(null),[h,g]=(0,S.useState)(0);(0,S.useLayoutEffect)(()=>{if(!d)return;let e=()=>{let e=f.current,t=p.current;!e||!t||g(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[d]);let _=u.map(e=>(0,C.jsx)(D,{commit:e,selected:n!==void 0&&e.sha===n},e.sha));return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`label`,{className:`relative mb-3 block`,children:[(0,C.jsx)(a,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3 left-3 size-4 text-muted-foreground`}),(0,C.jsx)(m,{"aria-label":`Search commit messages`,placeholder:`Search commit messages…`,value:s,onChange:e=>c(e.target.value),className:`h-10 rounded-lg border-border bg-card pl-10`})]}),(0,C.jsxs)(`div`,{ref:e=>{f.current=e,e&&(p.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":d,className:r(`flex flex-col divide-y divide-border rounded-xl border border-border bg-card px-3 py-1 md:px-4`,i),children:[o?(0,C.jsx)(`div`,{className:`flex min-h-11 flex-wrap items-center gap-2 py-2.5`,children:o}):null,u.length===0?(0,C.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,d?(0,C.jsx)(b,{scrollRef:p,startMargin:h,itemSize:T,children:_}):_]})]})}function D({commit:e,selected:t}){return(0,C.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_56px] [content-visibility:auto]`,children:(0,C.jsxs)(f,{"data-slot":`commit-row`,"data-sha":e.sha,"data-selected":t?`true`:void 0,"aria-current":t?`true`:void 0,to:e.href,className:r(`flex min-h-11 min-w-0 items-start gap-2.5 rounded-md px-2 py-2.5 transition-colors hover:bg-muted`,t&&`bg-muted/70`),children:[(0,C.jsx)(o,{size:16,"aria-hidden":`true`,className:`mt-px size-4 shrink-0 text-accent-text`}),(0,C.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`span`,{"data-slot":`commit-row-subject`,title:e.subject,className:`line-clamp-2 text-[13px] leading-snug font-medium break-words text-foreground`,children:e.subject}),(0,C.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground`,children:[(0,C.jsx)(O,{sha:e.sha}),(0,C.jsxs)(`span`,{className:`min-w-0 truncate`,children:[e.author,` · `,(0,C.jsx)(`span`,{title:y(e.when,e.at),children:h(e.when,e.at)})]}),e.stat?(0,C.jsx)(_,{stat:e.stat}):null]})]})]})})}function O({sha:e}){return(0,C.jsx)(g,{"data-slot":`commit-sha`,sha:e,variant:`chip`})}export{O as n,w as r,E as t};
@@ -1,3 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-Bxr3btKH.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/dist-C_rn70hE.js","assets/bundle-mjs-rHxsej31.js","assets/chevron-right-BENZ-1ZN.js","assets/createLucideIcon-BHp8sXmF.js","assets/eye-B8okNWXU.js","assets/diff-stat-Dy4uLuyP.js","assets/index-Cmj0hLCQ.js","assets/queries-ByqTmyCs.js","assets/toaster-Lf_4oY96.js","assets/live-protocol-DMhTnCmf.js","assets/preload-helper-Czpn1I53.js","assets/chunk-KS7C4IRE-Cg8l-LDN.js","assets/label-eNfbfYFG.js","assets/cez-idle-CdswdDRd.js","assets/run-detail-refresh-BJ4laDVB.js","assets/dist-Tubgdd25.js","assets/tasks-table-DtLW8U-4.js","assets/attention-CnhIF76m.js","assets/task-groups-BRrlyl5P.js","assets/design-icons-CzEoMH9c.js","assets/open-in-menu-CSbpfQy7.js","assets/bot-TkDIw4y-.js","assets/external-link-BE6y205O.js","assets/folder-o-AvL3y3.js","assets/smartphone-Lr8Ug2z_.js","assets/square-terminal-B6RYYieR.js","assets/button-C8jUIs8Q.js","assets/dropdown-menu-BaqO-x7U.js","assets/dist-VPUfzsfL.js","assets/es2015-DpKptHDx.js","assets/dist-DDhqweuB.js","assets/dist-CtdIjNlG.js","assets/own-lookup-DS54wXvD.js","assets/check-OP-CVgZG.js","assets/chevron-down-CHGyCDBH.js","assets/nav-row-styles-CgP5uNp4.js","assets/folder-browser-CK1mNIQi.js","assets/loader-circle-CPBhhDbB.js","assets/play-CmVAj_fu.js","assets/reference-chip-hn8jj_Mo.js","assets/popover-CVo54-aS.js","assets/dist-BS5vYfFC.js","assets/switch-DfPCm1H_.js","assets/dist-Czz3Y5qH.js","assets/badge-B6B-xYQQ.js","assets/dialog-Dbu3HnqC.js","assets/project-router-CEnizJ8F.js","assets/status-dot-BXf-Ubd0.js","assets/report-selection-BkBJw-sm.js","assets/use-search-params-writer-ClMScnNe.js","assets/format-BU7D3IfE.js","assets/command-DuxcX6Hr.js","assets/project-order-AcHI4Dcl.js","assets/skills-pM_PouEs.js","assets/agents-settings-path-7X6_cvUg.js","assets/page-shell-CpdYMj52.js","assets/page-shell-DQPYcKyL.css","assets/centered-state-BgSV4e79.js","assets/index-CflkzdUL.css","assets/highlighter-Cfo7mLVB.js","assets/image-preview-CeEKI2T5.js","assets/zoomable-image-BUTgYpld.js","assets/markdown-BBDDg-4t.js","assets/markdown-DkzcTJZ1.js","assets/chunk-BO2N2NFS-DQrpGzb-.js","assets/lib-DrPFkMXk.js","assets/html-report-BX3msvci.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{t as a}from"./diff-stat-Dy4uLuyP.js";import{n as o,r as s,t as c}from"./image-preview-CeEKI2T5.js";var l=e(t(),1),u=n();function d(e){let[t,n]=(0,l.useState)(null);return(0,l.useEffect)(()=>{let e=!1;return i(()=>import(`./diff-view-Bxr3btKH.js`).then(t=>{e||n({View:t.DiffView})},()=>{e||n(`failed`)}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69])),()=>{e=!0}},[]),e.files.length===0?(0,u.jsx)(`p`,{"data-slot":`diff-empty`,className:r(`px-1 text-xs text-muted-foreground`,e.className),children:`No changes.`}):t===`failed`?(0,u.jsx)(f,{...e}):t===null?(0,u.jsx)(`p`,{"data-slot":`diff-loading`,className:r(`px-1 text-xs text-muted-foreground`,e.className),children:`Loading diff…`}):(0,u.jsx)(t.View,{...e})}function f({files:e,wrap:t=!1,imageSrc:n,onOpenInApp:i,viewRef:a,totals:o=!0,actions:c,className:d}){let f={adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length},m=(0,l.useRef)(null);return(0,l.useImperativeHandle)(a,()=>({scrollToPath:e=>{for(let t of m.current?.querySelectorAll(`[data-slot="diff-file"]`)??[])if(t.dataset.path===e){t.scrollIntoView({block:`start`,behavior:`smooth`});return}}})),(0,u.jsxs)(`div`,{ref:m,"data-slot":`diff`,"data-fallback":`true`,className:r(`flex min-w-0 flex-col gap-3`,d),children:[(0,u.jsxs)(`div`,{"data-slot":`diff-header`,hidden:!o&&!c,className:`flex min-h-9 flex-wrap items-center gap-x-2 gap-y-1.5 px-1`,children:[(0,u.jsx)(s,{stat:f,hidden:!o}),c?(0,u.jsx)(`div`,{"data-slot":`diff-actions`,className:`ms-auto flex items-center gap-1.5`,children:c}):null]}),e.map(e=>(0,u.jsx)(p,{file:e,wrap:t,imageSrc:n,onOpenInApp:i},`${e.oldPath??``}→${e.path}`))]})}function p({file:e,wrap:t,imageSrc:n,onOpenInApp:i}){let s=e.oldPath?`${e.oldPath} → ${e.path}`:e.path;return(0,u.jsxs)(`section`,{"data-slot":`diff-file`,"data-path":e.path,className:`min-w-0 overflow-clip rounded-md border border-border bg-card`,children:[(0,u.jsxs)(`header`,{className:`flex items-start gap-2 border-b border-border px-3 py-2`,children:[(0,u.jsx)(`span`,{"data-slot":`diff-file-path`,title:s,className:`min-w-0 wrap-anywhere font-mono text-xs font-medium`,children:s}),(0,u.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,u.jsx)(a,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-xs`})})]}),o(e)?(0,u.jsx)(c,{file:e,imageSrc:n,onOpenInApp:i}):e.binary?(0,u.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-muted-foreground`,children:`Binary file — no text diff.`}):e.patch===``?(0,u.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-muted-foreground`,children:`No content changes (metadata only).`}):(0,u.jsx)(`pre`,{className:r(`py-2 font-mono text-xs leading-[1.7]`,t?`break-words whitespace-pre-wrap`:`overflow-x-auto whitespace-pre`),children:e.patch.split(`
3
- `).map((e,t)=>(0,u.jsxs)(`span`,{className:r(`block px-4`,e.startsWith(`+`)&&!e.startsWith(`+++`)&&`bg-diff-add`,e.startsWith(`-`)&&!e.startsWith(`---`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-muted-foreground`),children:[e,e===``?` `:``]},t))})]})}export{d as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{Gt as t,Jt as n,Kt as r,Ut as i,Wt as a,Xt as o,Yt as s,qt as c}from"./index-Cmj0hLCQ.js";var l=e();function u({open:e,subject:u,onKeep:d,onDiscard:f}){return(0,l.jsx)(i,{open:e,onOpenChange:e=>!e&&d(),children:(0,l.jsxs)(r,{"data-slot":`discard-changes-dialog`,className:`sm:max-w-[560px]`,children:[(0,l.jsxs)(s,{children:[(0,l.jsx)(o,{children:`Discard unsaved changes?`}),(0,l.jsxs)(c,{children:[`Your edits to `,(0,l.jsx)(`span`,{className:`font-medium text-foreground`,children:u}),` are not saved. They are lost if you continue.`]})]}),(0,l.jsxs)(n,{children:[(0,l.jsx)(t,{"data-slot":`discard-changes-keep`,children:`Keep editing`}),(0,l.jsx)(a,{"data-slot":`discard-changes-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:f,children:`Discard changes`})]})]})})}export{u as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{a as r,n as i}from"./dist-C_rn70hE.js";import{a,i as o,r as s,t as c}from"./dist-Tubgdd25.js";import{a as l,i as u,l as d,n as f,o as p,r as m,s as h,t as g,u as _}from"./es2015-DpKptHDx.js";var v=e(t(),1),y=n(),b=`Dialog`,[x,S]=o(b),[C,w]=x(b),T=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=v.useRef(null),l=v.useRef(null),[u,f]=c({prop:r,defaultProp:i??!1,onChange:a,caller:b});return(0,y.jsx)(C,{scope:t,triggerRef:s,contentRef:l,contentId:d(),titleId:d(),descriptionId:d(),open:u,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(e=>!e),[f]),modal:o,children:n})};T.displayName=b;var E=`DialogTrigger`,D=v.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,o=w(E,n),c=r(t,o.triggerRef);return(0,y.jsx)(a.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":q(o.open),...i,ref:c,onClick:s(e.onClick,o.onOpenToggle)})});D.displayName=E;var O=`DialogPortal`,[k,A]=x(O,{forceMount:void 0}),j=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=w(O,t);return(0,y.jsx)(k,{scope:t,forceMount:n,children:v.Children.map(r,e=>(0,y.jsx)(_,{present:n||a.open,children:(0,y.jsx)(u,{asChild:!0,container:i,children:e})}))})};j.displayName=O;var M=`DialogOverlay`,N=v.forwardRef((e,t)=>{let n=A(M,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=w(M,e.__scopeDialog);return a.modal?(0,y.jsx)(_,{present:r||a.open,children:(0,y.jsx)(F,{...i,ref:t})}):null});N.displayName=M;var P=i(`DialogOverlay.RemoveScroll`),F=v.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,o=w(M,n),s=r(t,h());return(0,y.jsx)(f,{as:P,allowPinchZoom:!0,shards:[o.contentRef],children:(0,y.jsx)(a.div,{"data-state":q(o.open),...i,ref:s,style:{pointerEvents:`auto`,...i.style}})})}),I=`DialogContent`,L=v.forwardRef((e,t)=>{let n=A(I,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=w(I,e.__scopeDialog);return(0,y.jsx)(_,{present:r||a.open,children:a.modal?(0,y.jsx)(R,{...i,ref:t}):(0,y.jsx)(z,{...i,ref:t})})});L.displayName=I;var R=v.forwardRef((e,t)=>{let n=w(I,e.__scopeDialog),i=v.useRef(null),a=r(t,n.contentRef,i);return v.useEffect(()=>{let e=i.current;if(e)return g(e)},[]),(0,y.jsx)(B,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:s(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:s(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:s(e.onFocusOutside,e=>e.preventDefault())})}),z=v.forwardRef((e,t)=>{let n=w(I,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return(0,y.jsx)(B,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),B=v.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=w(I,n);return m(),(0,y.jsx)(y.Fragment,{children:(0,y.jsx)(l,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,y.jsx)(p,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":q(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})}),V=`DialogTitle`,H=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(V,n);return(0,y.jsx)(a.h2,{id:i.titleId,...r,ref:t})});H.displayName=V;var U=`DialogDescription`,W=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(U,n);return(0,y.jsx)(a.p,{id:i.descriptionId,...r,ref:t})});W.displayName=U;var G=`DialogClose`,K=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(G,n);return(0,y.jsx)(a.button,{type:`button`,...r,ref:t,onClick:s(e.onClick,()=>i.onOpenChange(!1))})});K.displayName=G;function q(e){return e?`open`:`closed`}export{N as a,D as c,W as i,S as l,K as n,j as o,L as r,H as s,T as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{n}from"./dist-Tubgdd25.js";var r=e(t(),1);function i(e){let[t,i]=r.useState(void 0);return n(()=>{if(e){i({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let n=t[0],r,a;if(`borderBoxSize`in n){let e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;r=t.inlineSize,a=t.blockSize}else r=e.offsetWidth,a=e.offsetHeight;i({width:r,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else i(void 0)},[e]),t}export{i as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{a as i}from"./dist-C_rn70hE.js";import{a,i as o,n as s}from"./dist-Tubgdd25.js";import{c}from"./es2015-DpKptHDx.js";import{t as l}from"./dist-CtdIjNlG.js";var u=e(t(),1),d=[`top`,`right`,`bottom`,`left`],f=Math.min,p=Math.max,m=Math.round,h=Math.floor,g=e=>({x:e,y:e}),_={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function v(e,t,n){return p(e,f(t,n))}function y(e,t){return typeof e==`function`?e(t):e}function b(e){return e.split(`-`)[0]}function x(e){return e.split(`-`)[1]}function S(e){return e===`x`?`y`:`x`}function C(e){return e===`y`?`height`:`width`}function w(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function T(e){return S(w(e))}function E(e,t,n){n===void 0&&(n=!1);let r=x(e),i=T(e),a=C(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=F(o)),[o,F(o)]}function D(e){let t=F(e);return[O(e),t,O(t)]}function O(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var k=[`left`,`right`],A=[`right`,`left`],j=[`top`,`bottom`],M=[`bottom`,`top`];function N(e,t,n){switch(e){case`top`:case`bottom`:return n?t?A:k:t?k:A;case`left`:case`right`:return t?j:M;default:return[]}}function P(e,t,n,r){let i=x(e),a=N(b(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(O)))),a}function F(e){let t=b(e);return _[t]+e.slice(t.length)}function I(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function ee(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:I(e)}function L(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function R(e,t,n){let{reference:r,floating:i}=e,a=w(t),o=T(t),s=C(o),c=b(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=x(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function z(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=y(t,e),p=ee(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=L(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},b=L(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-b.top+p.top)/v.y,bottom:(b.bottom-h.bottom+p.bottom)/v.y,left:(h.left-b.left+p.left)/v.x,right:(b.right-h.right+p.right)/v.x}}var te=50,ne=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:z},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=R(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<te&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=R(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},re=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=y(e,t)||{};if(l==null)return{};let d=ee(u),p={x:n,y:r},m=T(i),h=C(m),g=await o.getDimensions(l),_=m===`y`,b=_?`top`:`left`,S=_?`bottom`:`right`,w=_?`clientHeight`:`clientWidth`,E=a.reference[h]+a.reference[m]-p[m]-a.floating[h],D=p[m]-a.reference[m],O=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),k=O?O[w]:0;(!k||!await(o.isElement==null?void 0:o.isElement(O)))&&(k=s.floating[w]||a.floating[h]);let A=E/2-D/2,j=k/2-g[h]/2-1,M=f(d[b],j),N=f(d[S],j),P=k-g[h]-N,F=k/2-g[h]/2+A,I=v(M,F,P),L=!c.arrow&&x(i)!=null&&F!==I&&a.reference[h]/2-(F<M?M:N)-g[h]/2<0,R=L?F<M?F-M:F-P:0;return{[m]:p[m]+R,data:{[m]:I,centerOffset:F-I-R,...L&&{alignmentOffset:R}},reset:L}}}),ie=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=y(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=b(r),_=w(o),v=b(o)===o,x=await(s.isRTL==null?void 0:s.isRTL(c.floating)),S=d||(v||!m?[F(o)]:D(o)),C=p!==`none`;!d&&C&&S.push(...P(o,m,p,x));let T=[o,...S],O=await s.detectOverflow(t,h),k=[],A=i.flip?.overflows||[];if(l&&k.push(O[g]),u){let e=E(r,a,x);k.push(O[e[0]],O[e[1]])}if(A=[...A,{placement:r,overflows:k}],!k.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=T[e];if(t&&(!(u===`alignment`&&_!==w(t))||A.every(e=>w(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:A},reset:{placement:t}};let n=A.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=A.filter(e=>{if(C){let t=w(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function ae(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function oe(e){return d.some(t=>e[t]>=0)}var se=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=y(e,t);switch(i){case`referenceHidden`:{let e=ae(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:oe(e)}}}case`escaped`:{let e=ae(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:oe(e)}}}default:return{}}}}},ce=new Set([`left`,`top`]);async function le(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=b(n),s=x(n),c=w(n)===`y`,l=ce.has(o)?-1:1,u=a&&c?-1:1,d=y(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var ue=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await le(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},de=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=y(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=w(i),p=S(f),m=u[p],h=u[f],g=(e,t)=>v(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},fe=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=y(e,t),u={x:n,y:r},d=w(i),f=S(d),p=u[f],m=u[d],h=y(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=ce.has(b(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},pe=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=y(e,t),c=await i.detectOverflow(t,s),l=b(n),u=x(n),d=w(n)===`y`,{width:m,height:h}=r.floating,g,_;l===`top`||l===`bottom`?(g=l,_=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(_=l,g=u===`end`?`top`:`bottom`);let v=h-c.top-c.bottom,S=m-c.left-c.right,C=f(h-c[g],v),T=f(m-c[_],S),E=t.middlewareData.shift,D=!E,O=C,k=T;E!=null&&E.enabled.x&&(k=S),E!=null&&E.enabled.y&&(O=v),D&&!u&&(d?k=m-2*p(c.left,c.right):O=h-2*p(c.top,c.bottom)),await o({...t,availableWidth:k,availableHeight:O});let A=await i.getDimensions(a.floating);return m!==A.width||h!==A.height?{reset:{rects:!0}}:{}}}};function me(){return typeof window<`u`}function B(e){return he(e)?(e.nodeName||``).toLowerCase():`#document`}function V(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function H(e){return((he(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function he(e){return me()?e instanceof Node||e instanceof V(e).Node:!1}function U(e){return me()?e instanceof Element||e instanceof V(e).Element:!1}function W(e){return me()?e instanceof HTMLElement||e instanceof V(e).HTMLElement:!1}function ge(e){return!me()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof V(e).ShadowRoot}function _e(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=q(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ve(e){return/^(table|td|th)$/.test(B(e))}function ye(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var be=/transform|translate|scale|rotate|perspective|filter/,xe=/paint|layout|strict|content/,G=e=>!!e&&e!==`none`,Se;function Ce(e){let t=U(e)?q(e):e;return G(t.transform)||G(t.translate)||G(t.scale)||G(t.rotate)||G(t.perspective)||!Te()&&(G(t.backdropFilter)||G(t.filter))||be.test(t.willChange||``)||xe.test(t.contain||``)}function we(e){let t=J(e);for(;W(t)&&!K(t);){if(Ce(t))return t;if(ye(t))return null;t=J(t)}return null}function Te(){return Se??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Se}function K(e){return/^(html|body|#document)$/.test(B(e))}function q(e){return V(e).getComputedStyle(e)}function Ee(e){return U(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function J(e){if(B(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ge(e)&&e.host||H(e);return ge(t)?t.host:t}function De(e){let t=J(e);return K(t)?(e.ownerDocument||e).body:W(t)&&_e(t)?t:De(t)}function Y(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=De(e),i=r===e.ownerDocument?.body,a=V(r);if(i){let e=Oe(a);return t.concat(a,a.visualViewport||[],_e(r)?r:[],e&&n?Y(e):[])}else return t.concat(r,Y(r,[],n))}function Oe(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ke(e){let t=q(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=W(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=m(n)!==a||m(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Ae(e){return U(e)?e:e.contextElement}function X(e){let t=Ae(e);if(!W(t))return g(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=ke(t),o=(a?m(n.width):n.width)/r,s=(a?m(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var je=g(0);function Me(e){let t=V(e);return!Te()||!t.visualViewport?je:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ne(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===V(e)}function Z(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Ae(e),o=g(1);t&&(r?U(r)&&(o=X(r)):o=X(e));let s=Ne(a,n,r)?Me(a):g(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=V(a),t=U(r)?V(r):r,n=e,i=Oe(n);for(;i&&t!==n;){let e=X(i),t=i.getBoundingClientRect(),r=q(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=V(i),i=Oe(n)}}return L({width:u,height:d,x:c,y:l})}function Q(e,t){let n=Ee(e).scrollLeft;return t?t.left+n:Z(H(e)).left+n}function Pe(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Q(e,n),y:n.top+t.scrollTop}}function Fe(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=H(r),s=t?ye(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=g(1),u=g(0),d=W(r);if((d||!a)&&((B(r)!==`body`||_e(o))&&(c=Ee(r)),d)){let e=Z(r);l=X(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Pe(o,c):g(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Ie(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Le(e){let t=Ee(e),n=e.ownerDocument.body,r=p(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=p(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Q(e),o=-t.scrollTop;return q(n).direction===`rtl`&&(a+=p(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Re=25;function ze(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=V(e),a=H(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Te()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Q(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=Re&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Be(e,t){let n=Z(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=X(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Ve(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=ze(e,n,t);else if(t===`document`)r=Le(H(e));else if(U(t))r=Be(t,n);else{let n=Me(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return L(r)}function He(e,t){let n=t.get(e);if(n)return n;let r=Y(e,[],!1).filter(e=>U(e)&&B(e)!==`body`),i=null,a=q(e).position===`fixed`,o=a?J(e):e;for(;U(o)&&!K(o);){let e=q(o),t=Ce(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=J(o)}return t.set(e,r),r}function Ue(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ye(t)?[]:He(t,this._c):[].concat(n),r],o=Ve(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Ve(t,a[e],i);s=p(n.top,s),c=f(n.right,c),l=f(n.bottom,l),u=p(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function We(e){let{width:t,height:n}=ke(e);return{width:t,height:n}}function Ge(e,t,n){let r=W(t),i=H(t),a=n===`fixed`,o=Z(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=g(0);if((r||!a)&&((B(t)!==`body`||_e(i))&&(s=Ee(t)),r)){let e=Z(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Q(i));let l=i&&!r&&!a?Pe(i,s):g(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function Ke(e){return q(e).position===`static`}function qe(e,t){if(!W(e)||q(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return H(e)===n&&(n=n.ownerDocument.body),n}function Je(e,t){let n=V(e);if(ye(e))return n;if(!W(e)){let t=J(e);for(;t&&!K(t);){if(U(t)&&!Ke(t))return t;t=J(t)}return n}let r=qe(e,t);for(;r&&ve(r)&&Ke(r);)r=qe(r,t);return r&&K(r)&&Ke(r)&&!Ce(r)?n:r||we(e)||n}var Ye=async function(e){let t=this.getOffsetParent||Je,n=this.getDimensions,r=await n(e.floating);return{reference:Ge(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Xe(e){return q(e).direction===`rtl`}var Ze={convertOffsetParentRelativeRectToViewportRelativeRect:Fe,getDocumentElement:H,getClippingRect:Ue,getOffsetParent:Je,getElementRects:Ye,getClientRects:Ie,getDimensions:We,getScale:X,isElement:U,isRTL:Xe};function Qe(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function $e(e,t,n){let r=null,i,a=H(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:m,height:g}=l;if(n||t(),!m||!g)return;let _=h(d),v=h(a.clientWidth-(u+m)),y=h(a.clientHeight-(d+g)),b=h(u),x={rootMargin:-_+`px `+-v+`px `+-y+`px `+-b+`px`,threshold:p(0,f(1,c))||1},S=!0;function C(t){let n=t[0].intersectionRatio;if(!Qe(l,e.getBoundingClientRect()))return s();if(n!==c){if(!S)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}S=!1}try{r=new IntersectionObserver(C,{...x,root:a.ownerDocument})}catch{r=new IntersectionObserver(C,x)}r.observe(e)}let c=V(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function et(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Ae(e),u=i||a?[...l?Y(l):[],...t?Y(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?$e(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Z(e):null;c&&g();function g(){let t=Z(e);h&&!Qe(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var tt=ue,nt=de,rt=ie,it=pe,at=se,ot=re,st=fe,ct=(e,t,n)=>{let r=new Map,i=n??{},a={...Ze,...i.platform,_c:r};return ne(e,t,{...i,platform:a})},lt=e(n(),1),ut=typeof document<`u`?u.useLayoutEffect:function(){};function dt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!dt(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!dt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function ft(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function pt(e,t){let n=ft(e);return Math.round(t*n)/n}function mt(e){let t=u.useRef(e);return ut(()=>{t.current=e}),t}function ht(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[d,f]=u.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=u.useState(r);dt(p,r)||m(r);let[h,g]=u.useState(null),[_,v]=u.useState(null),y=u.useCallback(e=>{e!==C.current&&(C.current=e,g(e))},[]),b=u.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||h,S=o||_,C=u.useRef(null),w=u.useRef(null),T=u.useRef(d),E=c!=null,D=mt(c),O=mt(i),k=mt(l),A=u.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:p};O.current&&(e.platform=O.current),ct(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!dt(T.current,t)&&(T.current=t,lt.flushSync(()=>{f(t)}))})},[p,t,n,O,k]);ut(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[l]);let j=u.useRef(!1);ut(()=>(j.current=!0,()=>{j.current=!1}),[]),ut(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=u.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),N=u.useMemo(()=>({reference:x,floating:S}),[x,S]),P=u.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=pt(N.floating,d.x),r=pt(N.floating,d.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...ft(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,d.x,d.y]);return u.useMemo(()=>({...d,update:A,refs:M,elements:N,floatingStyles:P}),[d,A,M,N,P])}var gt=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:ot({element:r.current,padding:i}).fn(n):r?ot({element:r,padding:i}).fn(n):{}}}},_t=(e,t)=>{let n=tt(e);return{name:n.name,fn:n.fn,options:[e,t]}},vt=(e,t)=>{let n=nt(e);return{name:n.name,fn:n.fn,options:[e,t]}},yt=(e,t)=>({fn:st(e).fn,options:[e,t]}),bt=(e,t)=>{let n=rt(e);return{name:n.name,fn:n.fn,options:[e,t]}},xt=(e,t)=>{let n=it(e);return{name:n.name,fn:n.fn,options:[e,t]}},St=(e,t)=>{let n=at(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ct=(e,t)=>{let n=gt(e);return{name:n.name,fn:n.fn,options:[e,t]}},$=r(),wt=`Arrow`,Tt=u.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...o}=e;return(0,$.jsx)(a.svg,{...o,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,$.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Tt.displayName=wt;var Et=Tt,Dt=`Popper`,[Ot,kt]=o(Dt),[At,jt]=Ot(Dt),Mt=e=>{let{__scopePopper:t,children:n}=e,[r,i]=u.useState(null),[a,o]=u.useState(void 0);return(0,$.jsx)(At,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};Mt.displayName=Dt;var Nt=`PopperAnchor`,Pt=u.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...o}=e,s=jt(Nt,n),c=u.useRef(null),l=s.onAnchorChange,d=i(t,u.useCallback(e=>{c.current=e,e&&l(e)},[l])),f=u.useRef(null);u.useEffect(()=>{if(!r)return;let e=f.current;f.current=r.current,e!==f.current&&l(f.current)});let p=s.placementState&&Wt(s.placementState),m=p?.[0],h=p?.[1];return r?null:(0,$.jsx)(a.div,{"data-radix-popper-side":m,"data-radix-popper-align":h,...o,ref:d})});Pt.displayName=Nt;var Ft=`PopperContent`,[It,Lt]=Ot(Ft),Rt=u.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:o=0,align:d=`center`,alignOffset:f=0,arrowPadding:p=0,avoidCollisions:m=!0,collisionBoundary:h=[],collisionPadding:g=0,sticky:_=`partial`,hideWhenDetached:v=!1,updatePositionStrategy:y=`optimized`,onPlaced:b,...x}=e,S=jt(Ft,n),[C,w]=u.useState(null),T=i(t,w),[E,D]=u.useState(null),O=l(E),k=O?.width??0,A=O?.height??0,j=r+(d===`center`?``:`-`+d),M=typeof g==`number`?g:{top:0,right:0,bottom:0,left:0,...g},N=Array.isArray(h)?h:[h],P=N.length>0,F={padding:M,boundary:N.filter(Ht),altBoundary:P},{refs:I,floatingStyles:ee,placement:L,isPositioned:R,middlewareData:z}=ht({strategy:`fixed`,placement:j,whileElementsMounted:(...e)=>et(...e,{animationFrame:y===`always`}),elements:{reference:S.anchor},middleware:[_t({mainAxis:o+A,alignmentAxis:f}),m&&vt({mainAxis:!0,crossAxis:!1,limiter:_===`partial`?yt():void 0,...F}),m&&bt({...F}),xt({...F,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),E&&Ct({element:E,padding:p}),Ut({arrowWidth:k,arrowHeight:A}),v&&St({strategy:`referenceHidden`,...F,boundary:P?F.boundary:void 0})]}),te=S.setPlacementState;s(()=>(te(L),()=>{te(void 0)}),[L,te]);let[ne,re]=Wt(L),ie=c(b);s(()=>{R&&ie?.()},[R,ie]);let ae=z.arrow?.x,oe=z.arrow?.y,se=z.arrow?.centerOffset!==0,[ce,le]=u.useState();return s(()=>{C&&le(window.getComputedStyle(C).zIndex)},[C]),(0,$.jsx)(`div`,{ref:I.setFloating,"data-radix-popper-content-wrapper":``,style:{...ee,transform:R?ee.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ce,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(` `),...z.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,$.jsx)(It,{scope:n,placedSide:ne,placedAlign:re,onArrowChange:D,arrowX:ae,arrowY:oe,shouldHideArrow:se,children:(0,$.jsx)(a.div,{"data-side":ne,"data-align":re,...x,ref:T,style:{...x.style,animation:R?void 0:`none`}})})})});Rt.displayName=Ft;var zt=`PopperArrow`,Bt={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Vt=u.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Lt(zt,n),a=Bt[i.placedSide];return(0,$.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,$.jsx)(Et,{...r,ref:t,style:{...r.style,display:`block`}})})});Vt.displayName=zt;function Ht(e){return e!==null}var Ut=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Wt(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function Wt(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Gt=Mt,Kt=Pt,qt=Rt,Jt=Vt;export{kt as a,Gt as i,Jt as n,qt as r,Kt as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{n as i}from"./dist-C_rn70hE.js";var a=e(t(),1),o=e(n(),1),s=r(),c=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=i(`Primitive.${t}`),r=a.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,s.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function l(e,t){e&&o.flushSync(()=>e.dispatchEvent(t))}function u(e,t=[]){let n=[];function r(t,r){let i=a.createContext(r);i.displayName=t+`Context`;let o=n.length;n=[...n,r];let c=t=>{let{scope:n,children:r,...c}=t,l=n?.[e]?.[o]||i,u=a.useMemo(()=>c,Object.values(c));return(0,s.jsx)(l.Provider,{value:u,children:r})};c.displayName=t+`Provider`;function l(n,s,c={}){let{optional:l=!1}=c,u=s?.[e]?.[o]||i,d=a.useContext(u);if(d)return d;if(r!==void 0)return r;if(!l)throw Error(`\`${n}\` must be used within \`${t}\``)}return[c,l]}let i=()=>{let t=n.map(e=>a.createContext(e));return function(n){let r=n?.[e]||t;return a.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,d(i,...t)]}function d(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}typeof window<`u`&&window.document&&window.document.createElement;function f(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)}}var p=globalThis?.document?a.useLayoutEffect:()=>{},m=a.useInsertionEffect||p;function h({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,o,s]=g({defaultProp:t,onChange:n}),c=e!==void 0,l=c?e:i;{let t=a.useRef(e!==void 0);a.useEffect(()=>{let e=t.current;e!==c&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${c?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=c},[c,r])}return[l,a.useCallback(t=>{if(c){let n=_(t)?t(e):t;n!==e&&s.current?.(n)}else o(t)},[c,e,o,s])]}function g({defaultProp:e,onChange:t}){let[n,r]=a.useState(e),i=a.useRef(n),o=a.useRef(t);return m(()=>{o.current=t},[t]),a.useEffect(()=>{i.current!==n&&(o.current?.(n),i.current=n)},[n,i]),[n,r,o]}function _(e){return typeof e==`function`}export{c as a,u as i,p as n,l as o,f as r,h as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{a as r,n as i}from"./dist-C_rn70hE.js";import{i as a}from"./dist-Tubgdd25.js";var o=e(t(),1),s=n();function c(e){let t=e+`CollectionProvider`,[n,c]=a(t),[l,u]=n(t,{collectionRef:{current:null},itemMap:new Map}),d=e=>{let{scope:t,children:n}=e,r=o.useRef(null),i=o.useRef(new Map).current;return(0,s.jsx)(l,{scope:t,itemMap:i,collectionRef:r,children:n})};d.displayName=t;let f=e+`CollectionSlot`,p=i(f),m=o.forwardRef((e,t)=>{let{scope:n,children:i}=e,a=r(t,u(f,n).collectionRef);return(0,s.jsx)(p,{ref:a,children:i})});m.displayName=f;let h=e+`CollectionItemSlot`,g=`data-radix-collection-item`,_=i(h),v=o.forwardRef((e,t)=>{let{scope:n,children:i,...a}=e,c=o.useRef(null),l=r(t,c),d=u(h,n);return o.useEffect(()=>(d.itemMap.set(c,{ref:c,...a}),()=>void d.itemMap.delete(c))),(0,s.jsx)(_,{[g]:``,ref:l,children:i})});v.displayName=h;function y(t){let n=u(e+`CollectionConsumer`,t);return o.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${g}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:d,Slot:m,ItemSlot:v},y,c]}var l=o.createContext(void 0);function u(e){let t=o.useContext(l);return e||t||`ltr`}export{c as n,u as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{a as r,c as i,n as a,o}from"./dist-C_rn70hE.js";import{c as s,m as c,u as l}from"./design-icons-CzEoMH9c.js";import{a as u,i as d,n as f,o as p,r as m,t as h}from"./dist-Tubgdd25.js";import{n as g,t as _}from"./dist-VPUfzsfL.js";import{a as ee,c as v,i as y,l as b,n as te,o as ne,r as x,t as S,u as C}from"./es2015-DpKptHDx.js";import{a as w,i as T,n as E,r as re,t as ie}from"./dist-DDhqweuB.js";var D=e(t(),1),O=!1;function k(){let[e,t]=D.useState(O);return D.useEffect(()=>{O||(O=!0,t(!0))},[]),e}var A=D.useSyncExternalStore;function j(){return()=>{}}function ae(){return A(j,()=>!0,()=>!1)}var M=typeof A==`function`?ae:k,N=n(),P=`rovingFocusGroup.onEntryFocus`,oe={bubbles:!1,cancelable:!0},F=`RovingFocusGroup`,[I,se,ce]=g(F),[le,ue]=d(F,[ce]),[de,fe]=le(F),pe=D.forwardRef((e,t)=>(0,N.jsx)(I.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,N.jsx)(I.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,N.jsx)(me,{...e,ref:t})})}));pe.displayName=F;var me=D.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:i,loop:a=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:l,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...p}=e,g=D.useRef(null),ee=r(t,g),y=_(o),[b,te]=h({prop:s,defaultProp:c??null,onChange:l,caller:F}),[ne,x]=D.useState(!1),S=v(d),C=se(n),w=D.useRef(!1),[T,E]=D.useState(0);return D.useEffect(()=>{let e=g.current;if(e)return e.addEventListener(P,S),()=>e.removeEventListener(P,S)},[S]),(0,N.jsx)(de,{scope:n,orientation:i,dir:y,loop:a,currentTabStopId:b,onItemFocus:D.useCallback(e=>te(e),[te]),onItemShiftTab:D.useCallback(()=>x(!0),[]),onFocusableItemAdd:D.useCallback(()=>E(e=>e+1),[]),onFocusableItemRemove:D.useCallback(()=>E(e=>e-1),[]),children:(0,N.jsx)(u.div,{tabIndex:ne||T===0?-1:0,"data-orientation":i,...p,ref:ee,style:{outline:`none`,...e.style},onMouseDown:m(e.onMouseDown,()=>{w.current=!0}),onFocus:m(e.onFocus,e=>{let t=!w.current;if(e.target===e.currentTarget&&t&&!ne){let t=new CustomEvent(P,oe);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=C().filter(e=>e.focusable);be([e.find(e=>e.active),e.find(e=>e.id===b),...e].filter(Boolean).map(e=>e.ref.current),f)}}w.current=!1}),onBlur:m(e.onBlur,()=>x(!1))})})}),he=`RovingFocusGroupItem`,ge=D.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=b(),l=a||c,d=fe(he,n),p=d.currentTabStopId===l,h=se(n),{onFocusableItemAdd:g,onFocusableItemRemove:_,currentTabStopId:ee}=d,v=M();return f(()=>{if(!(!v||!r))return g(),()=>_()},[v,r,g,_]),D.useEffect(()=>{if(!(v||!r))return g(),()=>_()},[v,r,g,_]),(0,N.jsx)(I.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,N.jsx)(u.span,{tabIndex:p?0:-1,"data-orientation":d.orientation,...s,ref:t,onMouseDown:m(e.onMouseDown,e=>{r?d.onItemFocus(l):e.preventDefault()}),onFocus:m(e.onFocus,()=>d.onItemFocus(l)),onKeyDown:m(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){d.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=ye(e,d.orientation,d.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=h().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=d.loop?xe(n,r+1):n.slice(r+1)}setTimeout(()=>be(n))}}),children:typeof o==`function`?o({isCurrentTabStop:p,hasTabStop:ee!=null}):o})})});ge.displayName=he;var _e={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function ve(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function ye(e,t,n){let r=ve(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return _e[r]}function be(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function xe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Se=pe,Ce=ge,we=[`Enter`,` `],Te=[`ArrowDown`,`PageUp`,`Home`],Ee=[`ArrowUp`,`PageDown`,`End`],De=[...Te,...Ee],Oe={ltr:[...we,`ArrowRight`],rtl:[...we,`ArrowLeft`]},ke={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},L=`Menu`,[R,Ae,je]=g(L),[z,Me]=d(L,[je,w,ue]),B=w(),Ne=ue(),[Pe,V]=z(L),[Fe,H]=z(L),Ie=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=B(t),[c,l]=D.useState(null),u=D.useRef(!1),d=v(a),f=_(i);return D.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),D.useEffect(()=>{if(!n)return;let e=()=>d(!1);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,N.jsx)(T,{...s,children:(0,N.jsx)(Pe,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,N.jsx)(Fe,{scope:t,onClose:D.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};Ie.displayName=L;var Le=`MenuAnchor`,Re=D.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=B(n);return(0,N.jsx)(ie,{...i,...r,ref:t})});Re.displayName=Le;var ze=`MenuPortal`,[Be,Ve]=z(ze,{forceMount:void 0}),He=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=V(ze,t);return(0,N.jsx)(Be,{scope:t,forceMount:n,children:(0,N.jsx)(C,{present:n||a.open,children:(0,N.jsx)(y,{asChild:!0,container:i,children:r})})})};He.displayName=ze;var U=`MenuContent`,[Ue,W]=z(U),We=D.forwardRef((e,t)=>{let n=Ve(U,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=V(U,e.__scopeMenu),o=H(U,e.__scopeMenu);return(0,N.jsx)(R.Provider,{scope:e.__scopeMenu,children:(0,N.jsx)(C,{present:r||a.open,children:(0,N.jsx)(R.Slot,{scope:e.__scopeMenu,children:o.modal?(0,N.jsx)(Ge,{...i,ref:t}):(0,N.jsx)(Ke,{...i,ref:t})})})})}),Ge=D.forwardRef((e,t)=>{let n=V(U,e.__scopeMenu),i=D.useRef(null),a=r(t,i);return D.useEffect(()=>{let e=i.current;if(e)return S(e)},[]),(0,N.jsx)(G,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:m(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Ke=D.forwardRef((e,t)=>{let n=V(U,e.__scopeMenu);return(0,N.jsx)(G,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),qe=a(`MenuContent.ScrollLock`),G=D.forwardRef((e,t)=>{let{__scopeMenu:n,loop:i=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:p,onDismiss:h,disableOutsideScroll:g,..._}=e,v=V(U,n),y=H(U,n),b=B(n),S=Ne(n),C=Ae(n),[w,T]=D.useState(null),E=D.useRef(null),ie=r(t,E,v.onContentChange),O=D.useRef(0),k=D.useRef(``),A=D.useRef(0),j=D.useRef(null),ae=D.useRef(`right`),M=D.useRef(0),P=g?te:D.Fragment,oe=g?{as:qe,allowPinchZoom:!0}:void 0,F=e=>{let t=k.current+e,n=C().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Et(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){k.current=t,window.clearTimeout(O.current),t!==``&&(O.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};D.useEffect(()=>()=>window.clearTimeout(O.current),[]),x();let I=D.useCallback(e=>ae.current===j.current?.side&&Ot(e,j.current?.area),[]);return(0,N.jsx)(Ue,{scope:n,searchRef:k,onItemEnter:D.useCallback(e=>{I(e)&&e.preventDefault()},[I]),onItemLeave:D.useCallback(e=>{I(e)||(E.current?.focus(),T(null))},[I]),onTriggerLeave:D.useCallback(e=>{I(e)&&e.preventDefault()},[I]),pointerGraceTimerRef:A,onPointerGraceIntentChange:D.useCallback(e=>{j.current=e},[]),children:(0,N.jsx)(P,{...oe,children:(0,N.jsx)(ee,{asChild:!0,trapped:a,onMountAutoFocus:m(o,e=>{e.preventDefault(),E.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:(0,N.jsx)(ne,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:p,onDismiss:h,children:(0,N.jsx)(Se,{asChild:!0,...S,dir:y.dir,orientation:`vertical`,loop:i,currentTabStopId:w,onCurrentTabStopIdChange:T,onEntryFocus:m(l,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,N.jsx)(re,{role:`menu`,"aria-orientation":`vertical`,"data-state":St(v.open),"data-radix-menu-content":``,dir:y.dir,...b,..._,ref:ie,style:{outline:`none`,..._.style},onKeyDown:m(_.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&F(e.key));let i=E.current;if(e.target!==i||!De.includes(e.key))return;e.preventDefault();let a=C().filter(e=>!e.disabled).map(e=>e.ref.current);Ee.includes(e.key)&&a.reverse(),wt(a)}),onBlur:m(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(O.current),k.current=``)}),onPointerMove:m(e.onPointerMove,Z(e=>{let t=e.target,n=M.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>M.current?`right`:`left`;ae.current=t,M.current=e.clientX}}))})})})})})})});We.displayName=U;var Je=`MenuGroup`,K=D.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,N.jsx)(u.div,{role:`group`,...r,ref:t})});K.displayName=Je;var Ye=`MenuLabel`,Xe=D.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,N.jsx)(u.div,{...r,ref:t})});Xe.displayName=Ye;var q=`MenuItem`,Ze=`menu.itemSelect`,J=D.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:i,...a}=e,o=D.useRef(null),s=H(q,e.__scopeMenu),c=W(q,e.__scopeMenu),l=r(t,o),u=D.useRef(!1),d=()=>{let e=o.current;if(!n&&e){let t=new CustomEvent(Ze,{bubbles:!0,cancelable:!0});e.addEventListener(Ze,e=>i?.(e),{once:!0}),p(e,t),t.defaultPrevented?u.current=!1:s.onClose()}};return(0,N.jsx)(Qe,{...a,ref:l,disabled:n,onClick:m(e.onClick,d),onPointerDown:t=>{e.onPointerDown?.(t),u.current=!0},onPointerUp:m(e.onPointerUp,e=>{u.current||e.currentTarget?.click()}),onKeyDown:m(e.onKeyDown,e=>{n||e.target!==e.currentTarget||c.searchRef.current!==``&&e.key===` `||we.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});J.displayName=q;var Qe=D.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:i=!1,textValue:a,...o}=e,s=W(q,n),c=Ne(n),l=D.useRef(null),d=r(t,l),[f,p]=D.useState(!1),[h,g]=D.useState(``);return D.useEffect(()=>{let e=l.current;e&&g((e.textContent??``).trim())},[o.children]),(0,N.jsx)(R.ItemSlot,{scope:n,disabled:i,textValue:a??h,children:(0,N.jsx)(Ce,{asChild:!0,...c,focusable:!i,children:(0,N.jsx)(u.div,{role:`menuitem`,"data-highlighted":f?``:void 0,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,...o,ref:d,onPointerMove:m(e.onPointerMove,Z(e=>{i?s.onItemLeave(e):(s.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:m(e.onPointerLeave,Z(e=>s.onItemLeave(e))),onFocus:m(e.onFocus,()=>p(!0)),onBlur:m(e.onBlur,()=>p(!1))})})})}),$e=`MenuCheckboxItem`,et=D.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,N.jsx)(ct,{scope:e.__scopeMenu,checked:n,children:(0,N.jsx)(J,{role:`menuitemcheckbox`,"aria-checked":X(n)?`mixed`:n,...i,ref:t,"data-state":Ct(n),onSelect:m(i.onSelect,()=>r?.(X(n)?!0:!n),{checkForDefaultPrevented:!1})})})});et.displayName=$e;var tt=`MenuRadioGroup`,[nt,rt]=z(tt,{value:void 0,onValueChange:()=>{}}),it=D.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=v(r);return(0,N.jsx)(nt,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,N.jsx)(K,{...i,ref:t})})});it.displayName=tt;var at=`MenuRadioItem`,ot=D.forwardRef((e,t)=>{let{value:n,...r}=e,i=rt(at,e.__scopeMenu),a=n===i.value;return(0,N.jsx)(ct,{scope:e.__scopeMenu,checked:a,children:(0,N.jsx)(J,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Ct(a),onSelect:m(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});ot.displayName=at;var st=`MenuItemIndicator`,[ct,lt]=z(st,{checked:!1}),ut=D.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=lt(st,n);return(0,N.jsx)(C,{present:r||X(a.checked)||a.checked===!0,children:(0,N.jsx)(u.span,{...i,ref:t,"data-state":Ct(a.checked)})})});ut.displayName=st;var dt=`MenuSeparator`,ft=D.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,N.jsx)(u.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});ft.displayName=dt;var pt=`MenuArrow`,mt=D.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=B(n);return(0,N.jsx)(E,{...i,...r,ref:t})});mt.displayName=pt;var ht=`MenuSub`,[gt,_t]=z(ht),vt=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=V(ht,t),o=B(t),[s,c]=D.useState(null),[l,u]=D.useState(null),d=v(i);return D.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,N.jsx)(T,{...o,children:(0,N.jsx)(Pe,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,N.jsx)(gt,{scope:t,contentId:b(),triggerId:b(),trigger:s,onTriggerChange:c,children:n})})})};vt.displayName=ht;var Y=`MenuSubTrigger`,yt=D.forwardRef((e,t)=>{let n=V(Y,e.__scopeMenu),i=H(Y,e.__scopeMenu),a=_t(Y,e.__scopeMenu),o=W(Y,e.__scopeMenu),s=D.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:l}=o,u={__scopeMenu:e.__scopeMenu},d=D.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);D.useEffect(()=>d,[d]),D.useEffect(()=>{let e=c.current;return()=>{window.clearTimeout(e),l(null)}},[c,l]);let f=r(t,a.onTriggerChange);return(0,N.jsx)(Re,{asChild:!0,...u,children:(0,N.jsx)(Qe,{id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?a.contentId:void 0,"data-state":St(n.open),...e,ref:f,onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:m(e.onPointerMove,Z(t=>{o.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:m(e.onPointerLeave,Z(e=>{d();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,a=i?-5:5,s=t[i?`left`:`right`],l=t[i?`right`:`left`];o.onPointerGraceIntentChange({area:[{x:e.clientX+a,y:e.clientY},{x:s,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:s,y:t.bottom}],side:r}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(e),e.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:m(e.onKeyDown,t=>{e.disabled||t.target!==t.currentTarget||o.searchRef.current!==``&&t.key===` `||Oe[i.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});yt.displayName=Y;var bt=`MenuSubContent`,xt=D.forwardRef((e,t)=>{let n=Ve(U,e.__scopeMenu),{forceMount:i=n.forceMount,align:a=`start`,...o}=e,s=V(U,e.__scopeMenu),c=H(U,e.__scopeMenu),l=_t(bt,e.__scopeMenu),u=D.useRef(null),d=r(t,u);return(0,N.jsx)(R.Provider,{scope:e.__scopeMenu,children:(0,N.jsx)(C,{present:i||s.open,children:(0,N.jsx)(R.Slot,{scope:e.__scopeMenu,children:(0,N.jsx)(G,{id:l.contentId,"aria-labelledby":l.triggerId,...o,ref:d,align:a,side:c.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{c.isUsingKeyboardRef.current&&u.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:m(e.onFocusOutside,e=>{e.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:m(e.onEscapeKeyDown,e=>{c.onClose(),e.preventDefault()}),onKeyDown:m(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=ke[c.dir].includes(e.key);t&&n&&(s.onOpenChange(!1),l.trigger?.focus(),e.preventDefault())})})})})})});xt.displayName=bt;function St(e){return e?`open`:`closed`}function X(e){return e===`indeterminate`}function Ct(e){return X(e)?`indeterminate`:e?`checked`:`unchecked`}function wt(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Tt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}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.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Dt(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Ot(e,t){return t?Dt({x:e.clientX,y:e.clientY},t):!1}function Z(e){return t=>t.pointerType===`mouse`?e(t):void 0}var kt=Ie,At=Re,jt=He,Mt=We,Nt=K,Pt=Xe,Ft=J,It=et,Lt=it,Rt=ot,zt=ut,Bt=ft,Vt=mt,Ht=vt,Ut=yt,Wt=xt,Q=`DropdownMenu`,[Gt,Kt]=d(Q,[Me]),$=Me(),[qt,Jt]=Gt(Q),Yt=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=$(t),l=D.useRef(null),[u,d]=h({prop:i,defaultProp:a??!1,onChange:o,caller:Q});return(0,N.jsx)(qt,{scope:t,triggerId:b(),triggerRef:l,contentId:b(),open:u,onOpenChange:d,onOpenToggle:D.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,N.jsx)(kt,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};Yt.displayName=Q;var Xt=`DropdownMenuTrigger`,Zt=D.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:i=!1,...a}=e,o=Jt(Xt,n),s=$(n),c=r(t,o.triggerRef);return(0,N.jsx)(At,{asChild:!0,...s,children:(0,N.jsx)(u.button,{type:`button`,id:o.triggerId,"aria-haspopup":`menu`,"aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?`open`:`closed`,"data-disabled":i?``:void 0,disabled:i,...a,ref:c,onPointerDown:m(e.onPointerDown,e=>{!i&&e.button===0&&e.ctrlKey===!1&&(o.onOpenToggle(),o.open||e.preventDefault())}),onKeyDown:m(e.onKeyDown,e=>{i||([`Enter`,` `].includes(e.key)&&o.onOpenToggle(),e.key===`ArrowDown`&&o.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Zt.displayName=Xt;var Qt=`DropdownMenuPortal`,$t=e=>{let{__scopeDropdownMenu:t,...n}=e,r=$(t);return(0,N.jsx)(jt,{...r,...n})};$t.displayName=Qt;var en=`DropdownMenuContent`,tn=D.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Jt(en,n),a=$(n),o=D.useRef(!1);return(0,N.jsx)(Mt,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:m(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:m(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});tn.displayName=en;var nn=`DropdownMenuGroup`,rn=D.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,N.jsx)(Nt,{...i,...r,ref:t})});rn.displayName=nn;var an=`DropdownMenuLabel`,on=D.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,N.jsx)(Pt,{...i,...r,ref:t})});on.displayName=an;var sn=`DropdownMenuItem`,cn=D.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,N.jsx)(Ft,{...i,...r,ref:t})});cn.displayName=sn;var ln=`DropdownMenuCheckboxItem`,un=D.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,N.jsx)(It,{...i,...r,ref:t})});un.displayName=ln;var dn=`DropdownMenuRadioGroup`,fn=D.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,N.jsx)(Lt,{...i,...r,ref:t})});fn.displayName=dn;var pn=`DropdownMenuRadioItem`,mn=D.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,N.jsx)(Rt,{...i,...r,ref:t})});mn.displayName=pn;var hn=`DropdownMenuItemIndicator`,gn=D.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,N.jsx)(zt,{...i,...r,ref:t})});gn.displayName=hn;var _n=`DropdownMenuSeparator`,vn=D.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,N.jsx)(Bt,{...i,...r,ref:t})});vn.displayName=_n;var yn=`DropdownMenuArrow`,bn=D.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,N.jsx)(Vt,{...i,...r,ref:t})});bn.displayName=yn;var xn=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=$(t),[s,c]=h({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,N.jsx)(Ht,{...o,open:s,onOpenChange:c,children:n})},Sn=`DropdownMenuSubTrigger`,Cn=D.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,N.jsx)(Ut,{...i,...r,ref:t})});Cn.displayName=Sn;var wn=`DropdownMenuSubContent`,Tn=D.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,N.jsx)(Wt,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Tn.displayName=wn;var En=Yt,Dn=Zt,On=$t,kn=tn,An=on,jn=cn,Mn=un,Nn=fn,Pn=mn,Fn=gn,In=vn,Ln=xn,Rn=Cn,zn=Tn;function Bn({...e}){return(0,N.jsx)(En,{"data-slot":`dropdown-menu`,...e})}function Vn({...e}){return(0,N.jsx)(On,{"data-slot":`dropdown-menu-portal`,...e})}function Hn({...e}){return(0,N.jsx)(Dn,{"data-slot":`dropdown-menu-trigger`,...e})}function Un({className:e,sideOffset:t=4,...n}){return(0,N.jsx)(On,{children:(0,N.jsx)(kn,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:o(`z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] max-w-(--radix-dropdown-menu-content-available-width) [overflow-wrap:anywhere] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 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`,e),...n})})}function Wn({className:e,inset:t,variant:n=`default`,...r}){return(0,N.jsx)(jn,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:o(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:ps-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!`,e),...r})}function Gn({className:e,children:t,checked:n,...r}){return(0,N.jsxs)(Mn,{"data-slot":`dropdown-menu-checkbox-item`,className:o(`relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pe-2 ps-8 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`,e),...i({checked:n}),...r,children:[(0,N.jsx)(`span`,{className:`pointer-events-none absolute start-2 flex size-3.5 items-center justify-center`,children:(0,N.jsx)(Fn,{children:(0,N.jsx)(s,{className:`size-4`})})}),t]})}function Kn({...e}){return(0,N.jsx)(Nn,{"data-slot":`dropdown-menu-radio-group`,...e})}function qn({className:e,children:t,...n}){return(0,N.jsxs)(Pn,{"data-slot":`dropdown-menu-radio-item`,className:o(`relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pe-2 ps-8 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`,e),...n,children:[(0,N.jsx)(`span`,{className:`pointer-events-none absolute start-2 flex size-3.5 items-center justify-center`,children:(0,N.jsx)(Fn,{children:(0,N.jsx)(c,{className:`size-2 fill-current`})})}),t]})}function Jn({className:e,inset:t,...n}){return(0,N.jsx)(An,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:o(`px-2 py-1.5 text-sm font-medium data-[inset]:ps-8`,e),...n})}function Yn({className:e,...t}){return(0,N.jsx)(In,{"data-slot":`dropdown-menu-separator`,className:o(`-mx-1 my-1 h-px bg-border`,e),...t})}function Xn({...e}){return(0,N.jsx)(Ln,{"data-slot":`dropdown-menu-sub`,...e})}function Zn({className:e,inset:t,children:n,...r}){return(0,N.jsxs)(Rn,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":t,className:o(`flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:ps-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_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,N.jsx)(l,{className:`ms-auto size-4`})]})}function Qn({className:e,...t}){return(0,N.jsx)(zn,{"data-slot":`dropdown-menu-sub-content`,className:o(`z-50 min-w-[8rem] max-w-(--radix-dropdown-menu-content-available-width) [overflow-wrap:anywhere] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 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`,e),...t})}export{Jn as a,qn as c,Qn as d,Zn as f,Wn as i,Yn as l,Gn as n,Vn as o,Hn as p,Un as r,Kn as s,Bn as t,Xn as u};