@qodeca/xezar 0.11.2 → 0.13.1

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 (140) hide show
  1. package/README.md +97 -43
  2. package/dist/agent-config/catalog.d.ts +10 -0
  3. package/dist/agent-config/catalog.js.map +1 -1
  4. package/dist/automations/coordinator.js +8 -0
  5. package/dist/automations/coordinator.js.map +1 -1
  6. package/dist/automations/types.d.ts +2 -0
  7. package/dist/contract/automations.d.ts +8 -0
  8. package/dist/contract/events.test.d.ts +1 -0
  9. package/dist/contract/index.js +87 -3
  10. package/dist/contract/runs.d.ts +25 -0
  11. package/dist/contract/runs.test.d.ts +1 -0
  12. package/dist/contract/skills.d.ts +1 -0
  13. package/dist/contract/workflows.d.ts +6 -0
  14. package/dist/contract/workspace.d.ts +37 -4
  15. package/dist/core/agent-env.js +8 -1
  16. package/dist/core/agent-env.js.map +1 -1
  17. package/dist/core/agent-runner.d.ts +13 -0
  18. package/dist/core/agent-runner.js +22 -0
  19. package/dist/core/agent-runner.js.map +1 -1
  20. package/dist/core/backend-detect.js +11 -1
  21. package/dist/core/backend-detect.js.map +1 -1
  22. package/dist/core/claude-cli-runner.js +8 -2
  23. package/dist/core/claude-cli-runner.js.map +1 -1
  24. package/dist/core/codex-app-server-runner.js +6 -2
  25. package/dist/core/codex-app-server-runner.js.map +1 -1
  26. package/dist/core/opencode-server-runner.d.ts +12 -0
  27. package/dist/core/opencode-server-runner.js +326 -17
  28. package/dist/core/opencode-server-runner.js.map +1 -1
  29. package/dist/core/pi-model-catalog.d.ts +52 -0
  30. package/dist/core/pi-model-catalog.js +135 -0
  31. package/dist/core/pi-model-catalog.js.map +1 -0
  32. package/dist/core/pi-runner.d.ts +3 -0
  33. package/dist/core/pi-runner.js +139 -12
  34. package/dist/core/pi-runner.js.map +1 -1
  35. package/dist/core/pi-ui-mapper.js +39 -3
  36. package/dist/core/pi-ui-mapper.js.map +1 -1
  37. package/dist/core/runner-model-catalog.js +11 -2
  38. package/dist/core/runner-model-catalog.js.map +1 -1
  39. package/dist/index.js +2 -0
  40. package/dist/index.js.map +1 -1
  41. package/dist/paths.d.ts +7 -0
  42. package/dist/paths.js +8 -0
  43. package/dist/paths.js.map +1 -1
  44. package/dist/runs/event-corrections.d.ts +12 -0
  45. package/dist/runs/event-corrections.js +141 -0
  46. package/dist/runs/event-corrections.js.map +1 -0
  47. package/dist/runs/event-history.d.ts +5 -1
  48. package/dist/runs/event-history.js +66 -5
  49. package/dist/runs/event-history.js.map +1 -1
  50. package/dist/runs/project-writer.d.ts +11 -0
  51. package/dist/runs/project-writer.js +115 -0
  52. package/dist/runs/project-writer.js.map +1 -0
  53. package/dist/runs/retention.d.ts +1 -1
  54. package/dist/runs/retention.js +1 -1
  55. package/dist/runs/store.d.ts +2 -0
  56. package/dist/runs/store.js +13 -2
  57. package/dist/runs/store.js.map +1 -1
  58. package/dist/runs/task-markers.d.ts +4 -0
  59. package/dist/runs/task-markers.js +63 -5
  60. package/dist/runs/task-markers.js.map +1 -1
  61. package/dist/server/capabilities.d.ts +7 -5
  62. package/dist/server/capabilities.js +11 -7
  63. package/dist/server/capabilities.js.map +1 -1
  64. package/dist/server/project-context.js +2 -0
  65. package/dist/server/project-context.js.map +1 -1
  66. package/dist/server/server.d.ts +199 -47
  67. package/dist/server/server.js +195 -11
  68. package/dist/server/server.js.map +1 -1
  69. package/dist/workflows/run.d.ts +67 -2
  70. package/dist/workflows/run.js +233 -62
  71. package/dist/workflows/run.js.map +1 -1
  72. package/dist/workflows/types.d.ts +41 -0
  73. package/dist/workflows/types.js +72 -0
  74. package/dist/workflows/types.js.map +1 -1
  75. package/dist/workspace/config.d.ts +42 -0
  76. package/dist/workspace/config.js +132 -3
  77. package/dist/workspace/config.js.map +1 -1
  78. package/dist/workspace/semaphore.d.ts +63 -3
  79. package/dist/workspace/semaphore.js +76 -3
  80. package/dist/workspace/semaphore.js.map +1 -1
  81. package/package.json +3 -3
  82. package/web/dist/assets/{alert-dialog-CGskMvgc.js → alert-dialog-BVsVcbFy.js} +1 -1
  83. package/web/dist/assets/arrow-down-CYgAlZtW.js +1 -0
  84. package/web/dist/assets/arrow-left-BOqE0a3k.js +1 -0
  85. package/web/dist/assets/{centered-state-B_V_Ai2h.js → centered-state-Djgly6Ni.js} +1 -1
  86. package/web/dist/assets/chevron-right-Cc9BWnbN.js +1 -0
  87. package/web/dist/assets/{collapsible-B_8uYwHb.js → collapsible-DZ4D-DHG.js} +1 -1
  88. package/web/dist/assets/{commit-list-C4Dv6vUL.js → commit-list-B-z1JL9G.js} +1 -1
  89. package/web/dist/assets/{compare-variants-et0mplGi.js → compare-variants-D62m4j3B.js} +1 -1
  90. package/web/dist/assets/{diff-CbozNUJq.js → diff-BKew9rQX.js} +2 -2
  91. package/web/dist/assets/{diff-stat-btAmKFJr.js → diff-stat-D0mc5V6Z.js} +1 -1
  92. package/web/dist/assets/{diff-view-BpFTcG3R.js → diff-view-xpIcuLIC.js} +1 -1
  93. package/web/dist/assets/{dropdown-menu-Z80KMInL.js → dropdown-menu-CEQziH7X.js} +1 -1
  94. package/web/dist/assets/editable-title-BCX3T2BY.js +1 -0
  95. package/web/dist/assets/{ellipsis-vertical-Bmi2u2TG.js → ellipsis-vertical-ByVdDc4z.js} +1 -1
  96. package/web/dist/assets/{file-DKoYWRsv.js → file-xBSB5hXO.js} +1 -1
  97. package/web/dist/assets/{folder-u01HScRT.js → folder-CldgbZ5A.js} +1 -1
  98. package/web/dist/assets/{git-toolbar-Q2kk2F7v.js → git-toolbar-DJANqg7Y.js} +1 -1
  99. package/web/dist/assets/github-D6vK0jFn.js +1 -0
  100. package/web/dist/assets/{image-preview-BR3iIIhf.js → image-preview-Cv5mZr0n.js} +1 -1
  101. package/web/dist/assets/index-CkmR6h7s.css +2 -0
  102. package/web/dist/assets/index-DVDqF4bM.js +9 -0
  103. package/web/dist/assets/{markdown-5FuCZDA4.js → markdown-CgEEE2ND.js} +1 -1
  104. package/web/dist/assets/{new-task-form-BydHBbef.js → new-task-form-1r2bgsdD.js} +1 -1
  105. package/web/dist/assets/{pill-vNzaaYxj.js → pill-q-x22_ej.js} +1 -1
  106. package/web/dist/assets/{project-router-BbCzrHKs.js → project-router-VDN4jQM8.js} +1 -1
  107. package/web/dist/assets/{prompt-templates-B7Fs2b1S.js → prompt-templates-BmZtCe-L.js} +1 -1
  108. package/web/dist/assets/{refresh-cw-DGliez3E.js → refresh-cw-DcNCj2nu.js} +1 -1
  109. package/web/dist/assets/{repo-git-h1RFfly3.js → repo-git-btG0sdbO.js} +1 -1
  110. package/web/dist/assets/{run-diff-Bq9vkSNK.js → run-diff-vguEMJzh.js} +1 -1
  111. package/web/dist/assets/{run-header-Cd8mSKBG.js → run-header-DM7MiKj9.js} +1 -1
  112. package/web/dist/assets/{search-x-69n_672Y.js → search-x-QmhaAbg5.js} +1 -1
  113. package/web/dist/assets/{skill-empty-hint-CL0g7WBL.js → skill-empty-hint-BrzUwByZ.js} +1 -1
  114. package/web/dist/assets/{skills-BqAzyGS3.js → skills-DMfxQtrD.js} +1 -1
  115. package/web/dist/assets/{sparkles-B8agSxBZ.js → sparkles-CP8QDOgX.js} +1 -1
  116. package/web/dist/assets/{square-terminal-Cf4Og6ct.js → square-terminal-CGypshSD.js} +1 -1
  117. package/web/dist/assets/{tab-link-Cp2-CJS8.js → tab-link-D4lFzzI1.js} +1 -1
  118. package/web/dist/assets/{task-changes-DwXPFXqG.js → task-changes-BtZId14z.js} +1 -1
  119. package/web/dist/assets/{task-commits-Bessua-c.js → task-commits-BoeyJXrv.js} +1 -1
  120. package/web/dist/assets/{task-files-DxFIhRPP.js → task-files-DIy2oUnj.js} +1 -1
  121. package/web/dist/assets/task-thread-CbMPmrWq.js +9 -0
  122. package/web/dist/assets/{textarea--cpYshee.js → textarea-CyBCyKIk.js} +1 -1
  123. package/web/dist/assets/{thread-loading-ZhJref0J.js → thread-loading-Cuq2jchC.js} +1 -1
  124. package/web/dist/assets/{trash-2--ZtrzUx3.js → trash-2-B6Dp3ZNs.js} +1 -1
  125. package/web/dist/assets/{triangle-alert-D5tJwRD2.js → triangle-alert-xBya8FUp.js} +1 -1
  126. package/web/dist/assets/{upload-SnwVxKOA.js → upload-D6MXEB9p.js} +1 -1
  127. package/web/dist/assets/{use-desktop-Sr1QlxhT.js → use-desktop-CPBwzQ7M.js} +1 -1
  128. package/web/dist/assets/{use-submit-shortcut-JY8M_MPL.js → use-submit-shortcut-JTpNzU-u.js} +1 -1
  129. package/web/dist/assets/{utils-Bb8ohcr3.js → utils--z9hRtl3.js} +1 -1
  130. package/web/dist/assets/{workflows-9HC240Wx.js → workflows-DG115scU.js} +3 -3
  131. package/web/dist/assets/{zoomable-image-0G3IBXWC.js → zoomable-image-GTYwLtkS.js} +1 -1
  132. package/web/dist/index.html +23 -23
  133. package/web/dist/assets/arrow-down-G8adPhbu.js +0 -1
  134. package/web/dist/assets/arrow-left-BJsIW6A0.js +0 -1
  135. package/web/dist/assets/chevron-right-CFzn-von.js +0 -1
  136. package/web/dist/assets/editable-title-wS5NWwob.js +0 -1
  137. package/web/dist/assets/github-DjEYCxwt.js +0 -1
  138. package/web/dist/assets/index-BcI5hug3.css +0 -2
  139. package/web/dist/assets/index-Cz4GSAqV.js +0 -7
  140. package/web/dist/assets/task-thread-Dhkupf1-.js +0 -9
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-Bb8ohcr3.js";import{t as i}from"./project-router-BbCzrHKs.js";import{t as a}from"./lib-BQXq3kEf.js";var o=e(t(),1),s=n(),c=41;function l({slot:e,commits:t,className:n}){let i=t.length>150,l=(0,o.useRef)(null),d=(0,o.useRef)(null),[f,p]=(0,o.useState)(0);(0,o.useLayoutEffect)(()=>{if(!i)return;let e=()=>{let e=l.current,t=d.current;!e||!t||p(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[i]);let m=t.map(e=>(0,s.jsx)(u,{commit:e},e.sha));return(0,s.jsx)(`div`,{ref:e=>{l.current=e,e&&(d.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":i,className:r(`flex flex-col divide-y divide-border px-2 py-1 md:px-4`,n),children:i?(0,s.jsx)(a,{scrollRef:d,startMargin:f,itemSize:c,children:m}):m})}function u({commit:e}){return(0,s.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_41px] [content-visibility:auto]`,children:(0,s.jsxs)(i,{"data-slot":`commit-row`,"data-sha":e.sha,to:e.href,className:`flex min-w-0 items-baseline gap-3 rounded-sm px-2 py-2.5 hover:bg-muted`,children:[(0,s.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:e.shaLabel}),(0,s.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:e.subject}),(0,s.jsxs)(`span`,{className:`hidden shrink-0 text-[11px] text-soft-foreground sm:inline`,children:[e.author,` · `,e.when]})]})})}export{l as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils--z9hRtl3.js";import{t as i}from"./project-router-VDN4jQM8.js";import{t as a}from"./lib-BQXq3kEf.js";var o=e(t(),1),s=n(),c=41;function l({slot:e,commits:t,className:n}){let i=t.length>150,l=(0,o.useRef)(null),d=(0,o.useRef)(null),[f,p]=(0,o.useState)(0);(0,o.useLayoutEffect)(()=>{if(!i)return;let e=()=>{let e=l.current,t=d.current;!e||!t||p(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[i]);let m=t.map(e=>(0,s.jsx)(u,{commit:e},e.sha));return(0,s.jsx)(`div`,{ref:e=>{l.current=e,e&&(d.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":i,className:r(`flex flex-col divide-y divide-border px-2 py-1 md:px-4`,n),children:i?(0,s.jsx)(a,{scrollRef:d,startMargin:f,itemSize:c,children:m}):m})}function u({commit:e}){return(0,s.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_41px] [content-visibility:auto]`,children:(0,s.jsxs)(i,{"data-slot":`commit-row`,"data-sha":e.sha,to:e.href,className:`flex min-w-0 items-baseline gap-3 rounded-sm px-2 py-2.5 hover:bg-muted`,children:[(0,s.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:e.shaLabel}),(0,s.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:e.subject}),(0,s.jsxs)(`span`,{className:`hidden shrink-0 text-[11px] text-soft-foreground sm:inline`,children:[e.author,` · `,e.when]})]})})}export{l as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{A as r,Pt as i,Ur as a,Vr as o,X as s,Z as c,Zt as l,a as u,i as d,j as f,lr as p,pn as m,qr as h,t as g,tn as _,wn as v}from"./centered-state-B_V_Ai2h.js";import{t as y}from"./utils-Bb8ohcr3.js";import{t as b}from"./chevron-right-CFzn-von.js";import{t as x}from"./search-x-69n_672Y.js";import{n as S,r as C,t as w}from"./collapsible-B_8uYwHb.js";import{a as T,c as E,i as D,n as O,o as k,r as A,s as j,t as M}from"./alert-dialog-CGskMvgc.js";import{c as N,t as P}from"./project-router-BbCzrHKs.js";import{n as F,o as I,r as L,t as R}from"./pill-vNzaaYxj.js";import{t as z}from"./markdown-5FuCZDA4.js";import{m as B,v as V}from"./index-Cz4GSAqV.js";import{t as H}from"./run-diff-Bq9vkSNK.js";var U=e(t(),1),W=n();function G(){let{groupId:e}=o(),t=s(e),n=F(c().data),r=h();if((0,U.useEffect)(()=>{e&&r.invalidateQueries({queryKey:f.groups.detail(e)})},[r,e,(i().data??[]).filter(t=>t.groupId===e).map(e=>`${e.id}:${e.status}:${e.archived}`).sort().join(`,`)]),t.isPending)return(0,W.jsx)(B,{});if(t.isError){let e=t.error instanceof v&&t.error.status===404;return(0,W.jsx)(`div`,{"data-route":`compare`,className:`flex min-h-full flex-col`,children:(0,W.jsx)(g,{icon:e?(0,W.jsx)(x,{}):(0,W.jsx)(V,{}),tone:e?`neutral`:`danger`,title:e?`No such variant group`:`Could not load the variants`,subtitle:e?`No runs share this group id. The group may have been deleted, or a winner was already picked and the others removed.`:t.error.message,actions:(0,W.jsx)(u,{asChild:!0,variant:`outline`,children:(0,W.jsx)(P,{to:`/`,children:`Back to tasks`})})})})}return(0,W.jsx)(K,{groupId:e,variants:t.data.runs,showTokens:n.tokens,showCost:n.cost})}function K({groupId:e,variants:t,showTokens:n,showCost:i}){let o=N(),s=h(),[c,u]=(0,U.useState)(null),g=t.every(e=>l.has(e.status)),_=t[0]?m(t[0]):``,v=a({mutationFn:t=>p(e,t),onSuccess:(t,n)=>{s.invalidateQueries({queryKey:f.runs.all}),s.invalidateQueries({queryKey:f.groups.detail(e)}),o(`/tasks/${t.winner?.id??n}`)},onError:e=>d(e.message,{tone:`danger`})});return(0,W.jsxs)(`div`,{"data-route":`compare`,className:`mx-auto flex w-full max-w-6xl flex-col gap-4 px-4 py-5 md:px-6`,children:[(0,W.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,W.jsxs)(`h1`,{className:`flex items-center gap-2 text-xl font-semibold`,children:[(0,W.jsx)(V,{className:`size-5 shrink-0 text-violet`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`min-w-0 truncate`,title:_,children:_})]}),(0,W.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[t.length,` variants of the same task, each in its own worktree — pick the diff you want to keep. The others are cancelled and archived, their worktrees and branches removed.`]})]}),(0,W.jsx)(`div`,{"data-slot":`compare-columns`,className:y(`grid grid-cols-1 gap-3`,t.length>=3?`md:grid-cols-3`:`md:grid-cols-2`),children:t.map(e=>(0,W.jsx)(q,{variant:e,allTerminal:g,pickPending:v.isPending,onPick:()=>u(e),showTokens:n,showCost:i},e.id))}),(0,W.jsx)(`section`,{"aria-label":`Full diffs`,className:`flex flex-col gap-2`,children:t.map(e=>(0,W.jsx)(J,{variant:e},e.id))}),(0,W.jsx)(M,{open:c!==null,onOpenChange:e=>!e&&u(null),children:(0,W.jsxs)(D,{children:[(0,W.jsxs)(j,{children:[(0,W.jsxs)(E,{children:[`Pick variant `,c?.variant,`?`]}),(0,W.jsxs)(T,{children:[`Variant `,c?.variant,`'s changes go to the review gate. The other`,` `,t.length-1==1?`variant is`:`${t.length-1} variants are`,` `,`cancelled if still open, archived, and their worktrees and branches removed. There is no undo.`]})]}),(0,W.jsxs)(k,{children:[(0,W.jsx)(A,{children:`Keep comparing`}),(0,W.jsxs)(O,{"data-slot":`confirm-pick`,onClick:()=>{c&&v.mutate(c.id),u(null)},children:[(0,W.jsx)(r,{"aria-hidden":`true`}),`Pick variant `,c?.variant]})]})]})})]})}function q({variant:e,allTerminal:t,pickPending:n,onPick:i,showTokens:a,showCost:o}){let s=I(e),c=_(e.costUsd),l=e.inputTokens!==void 0||e.outputTokens!==void 0;return(0,W.jsxs)(`article`,{"data-slot":`variant-column`,"data-variant":e.variant,className:`flex min-w-0 flex-col gap-3 rounded-lg border border-border bg-card p-3.5 shadow-xs`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{"data-slot":`variant-letter`,"aria-label":`Variant ${e.variant}`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded-full bg-violet/15 font-mono text-xs font-semibold text-violet`,children:e.variant}),(0,W.jsx)(R,{dot:s.tone,pulse:s.pulse,children:s.label}),a&&l||o&&c?(0,W.jsxs)(`span`,{"data-slot":`variant-token-metrics`,className:`ml-auto flex shrink-0 items-center gap-1.5 text-[11px] text-soft-foreground`,children:[a?(0,W.jsx)(L,{inputTokens:e.inputTokens,outputTokens:e.outputTokens}):null,a&&l&&o&&c?(0,W.jsx)(`span`,{"aria-hidden":`true`,children:`·`}):null,o&&c?(0,W.jsx)(`span`,{className:`font-mono tabular-nums`,children:c}):null]}):null]}),(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,W.jsx)(`span`,{className:`text-[10.5px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:`git diff --stat`}),(0,W.jsx)(`pre`,{"data-slot":`variant-diffstat`,className:`max-h-36 overflow-auto rounded-md bg-muted/60 px-2.5 py-2 font-mono text-[11px] leading-[1.6] whitespace-pre text-muted-foreground`,children:e.diffStat.trimEnd()||`(no changes)`})]}),(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,W.jsx)(`span`,{className:`text-[10.5px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:`Progress`}),e.handoffExcerpt?(0,W.jsx)(`div`,{"data-slot":`variant-progress`,className:`max-h-28 min-w-0 overflow-hidden text-[12.5px] text-muted-foreground [mask-image:linear-gradient(to_bottom,black_75%,transparent)]`,children:(0,W.jsx)(z,{children:e.handoffExcerpt})}):(0,W.jsx)(`p`,{"data-slot":`variant-progress`,className:`text-xs text-soft-foreground`,children:`(no progress notes)`})]}),(0,W.jsxs)(u,{"data-slot":`variant-pick`,title:t?`Keep variant ${e.variant}'s changes and archive the others`:`Every variant must finish before you can pick`,disabled:!t||n,onClick:i,children:[(0,W.jsx)(r,{"aria-hidden":`true`}),`Pick this one`]})]})}function J({variant:e}){let[t,n]=(0,U.useState)(!1);return(0,W.jsxs)(w,{open:t,onOpenChange:n,"data-slot":`variant-diff`,"data-variant":e.variant,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card`,children:[(0,W.jsxs)(C,{className:`flex w-full items-center gap-2 px-3.5 py-2.5 text-left text-[13px] font-medium hover:bg-muted/50`,children:[(0,W.jsx)(b,{className:y(`size-3.5 shrink-0 text-soft-foreground transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),`Variant `,e.variant,` — full diff`]}),(0,W.jsx)(S,{children:(0,W.jsx)(`div`,{className:`border-t border-border/50 px-3 py-3`,children:(0,W.jsx)(H,{runId:e.id})})})]})}export{G as CompareVariantsRoute};
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,Pt as i,Ur as a,Vr as o,X as s,Z as c,Zt as l,a as u,i as d,j as f,lr as p,pn as m,qr as h,t as g,tn as _,wn as v}from"./centered-state-Djgly6Ni.js";import{t as y}from"./utils--z9hRtl3.js";import{t as b}from"./chevron-right-Cc9BWnbN.js";import{t as x}from"./search-x-QmhaAbg5.js";import{n as S,r as C,t as w}from"./collapsible-DZ4D-DHG.js";import{a as T,c as E,i as D,n as O,o as k,r as A,s as j,t as M}from"./alert-dialog-BVsVcbFy.js";import{c as N,t as P}from"./project-router-VDN4jQM8.js";import{n as F,o as I,r as L,t as R}from"./pill-q-x22_ej.js";import{t as z}from"./markdown-CgEEE2ND.js";import{m as B,v as V}from"./index-DVDqF4bM.js";import{t as H}from"./run-diff-vguEMJzh.js";var U=e(t(),1),W=n();function G(){let{groupId:e}=o(),t=s(e),n=F(c().data),r=h();if((0,U.useEffect)(()=>{e&&r.invalidateQueries({queryKey:f.groups.detail(e)})},[r,e,(i().data??[]).filter(t=>t.groupId===e).map(e=>`${e.id}:${e.status}:${e.archived}`).sort().join(`,`)]),t.isPending)return(0,W.jsx)(B,{});if(t.isError){let e=t.error instanceof v&&t.error.status===404;return(0,W.jsx)(`div`,{"data-route":`compare`,className:`flex min-h-full flex-col`,children:(0,W.jsx)(g,{icon:e?(0,W.jsx)(x,{}):(0,W.jsx)(V,{}),tone:e?`neutral`:`danger`,title:e?`No such variant group`:`Could not load the variants`,subtitle:e?`No runs share this group id. The group may have been deleted, or a winner was already picked and the others removed.`:t.error.message,actions:(0,W.jsx)(u,{asChild:!0,variant:`outline`,children:(0,W.jsx)(P,{to:`/`,children:`Back to tasks`})})})})}return(0,W.jsx)(K,{groupId:e,variants:t.data.runs,showTokens:n.tokens,showCost:n.cost})}function K({groupId:e,variants:t,showTokens:n,showCost:i}){let o=N(),s=h(),[c,u]=(0,U.useState)(null),g=t.every(e=>l.has(e.status)),_=t[0]?m(t[0]):``,v=a({mutationFn:t=>p(e,t),onSuccess:(t,n)=>{s.invalidateQueries({queryKey:f.runs.all}),s.invalidateQueries({queryKey:f.groups.detail(e)}),o(`/tasks/${t.winner?.id??n}`)},onError:e=>d(e.message,{tone:`danger`})});return(0,W.jsxs)(`div`,{"data-route":`compare`,className:`mx-auto flex w-full max-w-6xl flex-col gap-4 px-4 py-5 md:px-6`,children:[(0,W.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,W.jsxs)(`h1`,{className:`flex items-center gap-2 text-xl font-semibold`,children:[(0,W.jsx)(V,{className:`size-5 shrink-0 text-violet`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`min-w-0 truncate`,title:_,children:_})]}),(0,W.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[t.length,` variants of the same task, each in its own worktree — pick the diff you want to keep. The others are cancelled and archived, their worktrees and branches removed.`]})]}),(0,W.jsx)(`div`,{"data-slot":`compare-columns`,className:y(`grid grid-cols-1 gap-3`,t.length>=3?`md:grid-cols-3`:`md:grid-cols-2`),children:t.map(e=>(0,W.jsx)(q,{variant:e,allTerminal:g,pickPending:v.isPending,onPick:()=>u(e),showTokens:n,showCost:i},e.id))}),(0,W.jsx)(`section`,{"aria-label":`Full diffs`,className:`flex flex-col gap-2`,children:t.map(e=>(0,W.jsx)(J,{variant:e},e.id))}),(0,W.jsx)(M,{open:c!==null,onOpenChange:e=>!e&&u(null),children:(0,W.jsxs)(D,{children:[(0,W.jsxs)(j,{children:[(0,W.jsxs)(E,{children:[`Pick variant `,c?.variant,`?`]}),(0,W.jsxs)(T,{children:[`Variant `,c?.variant,`'s changes go to the review gate. The other`,` `,t.length-1==1?`variant is`:`${t.length-1} variants are`,` `,`cancelled if still open, archived, and their worktrees and branches removed. There is no undo.`]})]}),(0,W.jsxs)(k,{children:[(0,W.jsx)(A,{children:`Keep comparing`}),(0,W.jsxs)(O,{"data-slot":`confirm-pick`,onClick:()=>{c&&v.mutate(c.id),u(null)},children:[(0,W.jsx)(r,{"aria-hidden":`true`}),`Pick variant `,c?.variant]})]})]})})]})}function q({variant:e,allTerminal:t,pickPending:n,onPick:i,showTokens:a,showCost:o}){let s=I(e),c=_(e.costUsd),l=e.inputTokens!==void 0||e.outputTokens!==void 0;return(0,W.jsxs)(`article`,{"data-slot":`variant-column`,"data-variant":e.variant,className:`flex min-w-0 flex-col gap-3 rounded-lg border border-border bg-card p-3.5 shadow-xs`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{"data-slot":`variant-letter`,"aria-label":`Variant ${e.variant}`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded-full bg-violet/15 font-mono text-xs font-semibold text-violet`,children:e.variant}),(0,W.jsx)(R,{dot:s.tone,pulse:s.pulse,children:s.label}),a&&l||o&&c?(0,W.jsxs)(`span`,{"data-slot":`variant-token-metrics`,className:`ml-auto flex shrink-0 items-center gap-1.5 text-[11px] text-soft-foreground`,children:[a?(0,W.jsx)(L,{inputTokens:e.inputTokens,outputTokens:e.outputTokens}):null,a&&l&&o&&c?(0,W.jsx)(`span`,{"aria-hidden":`true`,children:`·`}):null,o&&c?(0,W.jsx)(`span`,{className:`font-mono tabular-nums`,children:c}):null]}):null]}),(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,W.jsx)(`span`,{className:`text-[10.5px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:`git diff --stat`}),(0,W.jsx)(`pre`,{"data-slot":`variant-diffstat`,className:`max-h-36 overflow-auto rounded-md bg-muted/60 px-2.5 py-2 font-mono text-[11px] leading-[1.6] whitespace-pre text-muted-foreground`,children:e.diffStat.trimEnd()||`(no changes)`})]}),(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,W.jsx)(`span`,{className:`text-[10.5px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:`Progress`}),e.handoffExcerpt?(0,W.jsx)(`div`,{"data-slot":`variant-progress`,className:`max-h-28 min-w-0 overflow-hidden text-[12.5px] text-muted-foreground [mask-image:linear-gradient(to_bottom,black_75%,transparent)]`,children:(0,W.jsx)(z,{children:e.handoffExcerpt})}):(0,W.jsx)(`p`,{"data-slot":`variant-progress`,className:`text-xs text-soft-foreground`,children:`(no progress notes)`})]}),(0,W.jsxs)(u,{"data-slot":`variant-pick`,title:t?`Keep variant ${e.variant}'s changes and archive the others`:`Every variant must finish before you can pick`,disabled:!t||n,onClick:i,children:[(0,W.jsx)(r,{"aria-hidden":`true`}),`Pick this one`]})]})}function J({variant:e}){let[t,n]=(0,U.useState)(!1);return(0,W.jsxs)(w,{open:t,onOpenChange:n,"data-slot":`variant-diff`,"data-variant":e.variant,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card`,children:[(0,W.jsxs)(C,{className:`flex w-full items-center gap-2 px-3.5 py-2.5 text-left text-[13px] font-medium hover:bg-muted/50`,children:[(0,W.jsx)(b,{className:y(`size-3.5 shrink-0 text-soft-foreground transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),`Variant `,e.variant,` — full diff`]}),(0,W.jsx)(S,{children:(0,W.jsx)(`div`,{className:`border-t border-border/50 px-3 py-3`,children:(0,W.jsx)(H,{runId:e.id})})})]})}export{G as CompareVariantsRoute};
@@ -1,3 +1,3 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-BpFTcG3R.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/utils-Bb8ohcr3.js","assets/bundle-mjs-BT31bpU6.js","assets/chevron-right-CFzn-von.js","assets/diff-stat-btAmKFJr.js","assets/highlighter-C8DK1_sG.js","assets/lib-BQXq3kEf.js","assets/image-preview-BR3iIIhf.js","assets/zoomable-image-0G3IBXWC.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{t as r}from"./utils-Bb8ohcr3.js";import{i}from"./bundle-mjs-BT31bpU6.js";import{t as a}from"./diff-stat-btAmKFJr.js";import{n as o,t as s}from"./image-preview-BR3iIIhf.js";var c=e(t(),1),l=n();function u(e){let[t,n]=(0,c.useState)(null);return(0,c.useEffect)(()=>{let e=!1;return i(()=>import(`./diff-view-BpFTcG3R.js`).then(t=>{e||n({View:t.DiffView})},()=>{e||n(`failed`)}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])),()=>{e=!0}},[]),e.files.length===0?(0,l.jsx)(`p`,{"data-slot":`diff-empty`,className:r(`px-1 text-xs text-soft-foreground`,e.className),children:`No changes.`}):t===`failed`?(0,l.jsx)(d,{...e}):t===null?(0,l.jsx)(`p`,{"data-slot":`diff-loading`,className:r(`px-1 text-xs text-soft-foreground`,e.className),children:`Loading diff…`}):(0,l.jsx)(t.View,{...e})}function d({files:e,wrap:t=!1,imageSrc:n,onOpenInApp:i,viewRef:o,className:s}){let u={adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length},d=(0,c.useRef)(null);return(0,c.useImperativeHandle)(o,()=>({scrollToPath:e=>{for(let t of d.current?.querySelectorAll(`[data-slot="diff-file"]`)??[])if(t.dataset.path===e){t.scrollIntoView({block:`start`,behavior:`smooth`});return}}})),(0,l.jsxs)(`div`,{ref:d,"data-slot":`diff`,"data-fallback":`true`,className:r(`flex min-w-0 flex-col gap-3`,s),children:[(0,l.jsxs)(`p`,{"data-slot":`diff-totals`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,l.jsxs)(`span`,{children:[u.files,` `,u.files===1?`file`:`files`,` changed`]}),(0,l.jsx)(a,{stat:u})]}),e.map(e=>(0,l.jsx)(f,{file:e,wrap:t,imageSrc:n,onOpenInApp:i},`${e.oldPath??``}→${e.path}`))]})}function f({file:e,wrap:t,imageSrc:n,onOpenInApp:i}){return(0,l.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,l.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-border/50 px-3 py-2`,children:[(0,l.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?`${e.oldPath} → ${e.path}`:e.path}),(0,l.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,l.jsx)(a,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-[11px]`})})]}),o(e)?(0,l.jsx)(s,{file:e,imageSrc:n,onOpenInApp:i}):e.binary?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.patch===``?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,l.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(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-xpIcuLIC.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/utils--z9hRtl3.js","assets/bundle-mjs-BT31bpU6.js","assets/chevron-right-Cc9BWnbN.js","assets/diff-stat-D0mc5V6Z.js","assets/highlighter-C8DK1_sG.js","assets/lib-BQXq3kEf.js","assets/image-preview-Cv5mZr0n.js","assets/zoomable-image-GTYwLtkS.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{t as r}from"./utils--z9hRtl3.js";import{i}from"./bundle-mjs-BT31bpU6.js";import{t as a}from"./diff-stat-D0mc5V6Z.js";import{n as o,t as s}from"./image-preview-Cv5mZr0n.js";var c=e(t(),1),l=n();function u(e){let[t,n]=(0,c.useState)(null);return(0,c.useEffect)(()=>{let e=!1;return i(()=>import(`./diff-view-xpIcuLIC.js`).then(t=>{e||n({View:t.DiffView})},()=>{e||n(`failed`)}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])),()=>{e=!0}},[]),e.files.length===0?(0,l.jsx)(`p`,{"data-slot":`diff-empty`,className:r(`px-1 text-xs text-soft-foreground`,e.className),children:`No changes.`}):t===`failed`?(0,l.jsx)(d,{...e}):t===null?(0,l.jsx)(`p`,{"data-slot":`diff-loading`,className:r(`px-1 text-xs text-soft-foreground`,e.className),children:`Loading diff…`}):(0,l.jsx)(t.View,{...e})}function d({files:e,wrap:t=!1,imageSrc:n,onOpenInApp:i,viewRef:o,className:s}){let u={adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length},d=(0,c.useRef)(null);return(0,c.useImperativeHandle)(o,()=>({scrollToPath:e=>{for(let t of d.current?.querySelectorAll(`[data-slot="diff-file"]`)??[])if(t.dataset.path===e){t.scrollIntoView({block:`start`,behavior:`smooth`});return}}})),(0,l.jsxs)(`div`,{ref:d,"data-slot":`diff`,"data-fallback":`true`,className:r(`flex min-w-0 flex-col gap-3`,s),children:[(0,l.jsxs)(`p`,{"data-slot":`diff-totals`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,l.jsxs)(`span`,{children:[u.files,` `,u.files===1?`file`:`files`,` changed`]}),(0,l.jsx)(a,{stat:u})]}),e.map(e=>(0,l.jsx)(f,{file:e,wrap:t,imageSrc:n,onOpenInApp:i},`${e.oldPath??``}→${e.path}`))]})}function f({file:e,wrap:t,imageSrc:n,onOpenInApp:i}){return(0,l.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,l.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-border/50 px-3 py-2`,children:[(0,l.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?`${e.oldPath} → ${e.path}`:e.path}),(0,l.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,l.jsx)(a,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-[11px]`})})]}),o(e)?(0,l.jsx)(s,{file:e,imageSrc:n,onOpenInApp:i}):e.binary?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.patch===``?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,l.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
3
  `).map((e,t)=>(0,l.jsxs)(`span`,{className:r(`block px-4`,e.startsWith(`+`)&&!e.startsWith(`+++`)&&`bg-diff-add`,e.startsWith(`-`)&&!e.startsWith(`---`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[e,e===``?` `:``]},t))})]})}export{u as t};
@@ -1 +1 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-Bb8ohcr3.js";var n=e();function r({stat:e,className:r}){let i=`+${e.adds} −${e.dels} across ${e.files} ${e.files===1?`file`:`files`}`,a=e.repointed?`${i} — measured against another branch checked out in this task's worktree, as this task found it`:void 0;return(0,n.jsxs)(`span`,{"data-slot":`diff-stat`,...a?{"data-repointed":`true`,"aria-label":a}:{},title:a??i,className:t(`font-mono text-xs font-semibold tabular-nums`,e.repointed&&`cursor-help underline decoration-dotted underline-offset-2`,r),children:[(0,n.jsxs)(`span`,{className:`text-success`,children:[`+`,e.adds]}),` `,(0,n.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.dels]})]})}export{r as t};
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils--z9hRtl3.js";var n=e();function r({stat:e,className:r}){let i=`+${e.adds} −${e.dels} across ${e.files} ${e.files===1?`file`:`files`}`,a=e.repointed?`${i} — measured against another branch checked out in this task's worktree, as this task found it`:void 0;return(0,n.jsxs)(`span`,{"data-slot":`diff-stat`,...a?{"data-repointed":`true`,"aria-label":a}:{},title:a??i,className:t(`font-mono text-xs font-semibold tabular-nums`,e.repointed&&`cursor-help underline decoration-dotted underline-offset-2`,r),children:[(0,n.jsxs)(`span`,{className:`text-success`,children:[`+`,e.adds]}),` `,(0,n.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.dels]})]})}export{r as t};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-Bb8ohcr3.js";import{t as i}from"./chevron-right-CFzn-von.js";import{t as a}from"./diff-stat-btAmKFJr.js";import{a as o,i as s,r as c}from"./highlighter-C8DK1_sG.js";import{t as l}from"./lib-BQXq3kEf.js";import{n as u,t as d}from"./image-preview-BR3iIIhf.js";var f=e(t(),1),p=44;function m(e){if(e.binary===!0||e.patch===``)return 1;let t=e.patch.split(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils--z9hRtl3.js";import{t as i}from"./chevron-right-Cc9BWnbN.js";import{t as a}from"./diff-stat-D0mc5V6Z.js";import{a as o,i as s,r as c}from"./highlighter-C8DK1_sG.js";import{t as l}from"./lib-BQXq3kEf.js";import{n as u,t as d}from"./image-preview-Cv5mZr0n.js";var f=e(t(),1),p=44;function m(e){if(e.binary===!0||e.patch===``)return 1;let t=e.patch.split(`
2
2
  `),n=t.findIndex(e=>e.startsWith(`@@`));return n===-1?t.length:t.length-n}function h(e){return m(e)*20+p}function g(e){return e.reduce((e,t)=>e+m(t),0)}function _(e,t){let n=new URLSearchParams(e).get(`diff`);return n===`flat`||n===`virtual`?n:t>1500?`virtual`:`flat`}function v(e){return`${e.oldPath??``}→${e.path}`}function y(e){let t=0;for(let n of e.split(`
3
3
  `))n.length>t&&(t=n.length);return t}var b=/[A-Za-z0-9_]+|\s+|[^\sA-Za-z0-9_]+/g,x=300,S=.3;function C(e,t){if(e===t)return null;let n=e.match(b)??[],r=t.match(b)??[];if(n.length===0||r.length===0||n.length>x||r.length>x)return null;let i=r.length+1,a=new Uint16Array((n.length+1)*i);for(let e=1;e<=n.length;e++)for(let t=1;t<=r.length;t++)a[e*i+t]=n[e-1]===r[t-1]?(a[(e-1)*i+(t-1)]??0)+1:Math.max(a[(e-1)*i+t]??0,a[e*i+(t-1)]??0);if((a[n.length*i+r.length]??0)/Math.max(n.length,r.length)<S)return null;let o=Array(n.length).fill(!1),s=Array(r.length).fill(!1),c=n.length,l=r.length;for(;c>0&&l>0;)n[c-1]===r[l-1]?(o[c-1]=!0,s[l-1]=!0,c--,l--):(a[(c-1)*i+l]??0)>=(a[c*i+(l-1)]??0)?c--:l--;return{del:w(n,o),add:w(r,s)}}function w(e,t){let n=[];return e.forEach((e,r)=>{let i=!(t[r]??!1),a=n[n.length-1];a&&a.changed===i?a.text+=e:n.push({text:e,changed:i})}),n}function T(e,t,n){if(!t||t.length===0)return e?e.map(e=>({text:e.content,color:e.color,changed:!1})):n===``?[]:[{text:n,changed:!1}];if(!e||e.length===0)return t.map(e=>({text:e.text,changed:e.changed}));let r=[],i=0,a=0,o=0,s=0;for(;i<e.length&&o<t.length;){let n=e[i],c=t[o],l=n.content.length-a,u=c.text.length-s,d=Math.min(l,u);d>0&&(r.push({text:n.content.slice(a,a+d),color:n.color,changed:c.changed}),a+=d,s+=d),n.content.length-a<=0&&(i++,a=0),c.text.length-s<=0&&(o++,s=0)}for(;i<e.length;){let t=e[i],n=t.content.slice(a);n!==``&&r.push({text:n,color:t.color,changed:!1}),i++,a=0}return r}var E=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,D=`… (patch truncated)`;function O(e){let t=[],n=!1,r=null,i=0,a=0,o=e.split(`
4
4
  `);o.at(-1)===``&&o.pop();for(let e of o){let o=E.exec(e);if(o){r={header:e,oldStart:Number(o[1]),oldCount:o[2]===void 0?1:Number(o[2]),newStart:Number(o[3]),newCount:o[4]===void 0?1:Number(o[4]),lines:[]},i=r.oldStart,a=r.newStart,t.push(r);continue}if(e.includes(D)){n=!0,r=null;continue}r&&(e.startsWith(`+`)?r.lines.push({kind:`add`,text:e.slice(1),newLine:a++}):e.startsWith(`-`)?r.lines.push({kind:`del`,text:e.slice(1),oldLine:i++}):e.startsWith(`\\`)||r.lines.push({kind:`context`,text:e.slice(1),oldLine:i++,newLine:a++}))}return{hunks:t,truncated:n}}function k(e,t=!1){let n=[],r=e[0];if(!r)return n;r.newStart>1&&n.push({beforeHunk:0,count:r.newStart-1,oldStart:1,newStart:1});for(let t=1;t<e.length;t++){let r=e[t-1],i=e[t],a=r.oldStart+r.oldCount,o=r.newStart+r.newCount,s=i.newStart-o;s>0&&n.push({beforeHunk:t,count:s,oldStart:a,newStart:o})}if(t){let t=e[e.length-1];n.push({beforeHunk:e.length,oldStart:t.oldStart+t.oldCount,newStart:t.newStart+t.newCount})}return n}function A(e,t){let n=e.count===void 0?t.length:e.newStart+e.count-1,r=e.oldStart-e.newStart,i=[];for(let a=e.newStart;a<=Math.min(n,t.length);a++)i.push({kind:`context`,text:t[a-1]??``,oldLine:a+r,newLine:a});return i}function j(e,t){let n=Array(e.length),r=Array(t.length),i=Math.min(e.length,t.length);for(let a=0;a<i;a++){let i=C(e[a].text,t[a].text);i&&(n[a]=i.del,r[a]=i.add)}return{dels:e,adds:t,delSpans:n,addSpans:r}}function M(e,t,n){let r=0;for(;r<e.lines.length;){let i=e.lines[r];if(i.kind===`del`||i.kind===`add`){let t=[],i=[];for(;r<e.lines.length&&e.lines[r].kind===`del`;)t.push(e.lines[r++]);for(;r<e.lines.length&&e.lines[r].kind===`add`;)i.push(e.lines[r++]);n(j(t,i))}else t(i),r++}}function N(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`line`,cell:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),M(e,e=>i.push({type:`line`,cell:{line:e}}),e=>{e.dels.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.delSpans[n]}})),e.adds.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.addSpans[n]}}))})}),a(e.length),i}function P(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`pair`,left:{line:e},right:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),M(e,e=>i.push({type:`pair`,left:{line:e},right:{line:e}}),e=>{let t=Math.max(e.dels.length,e.adds.length);for(let n=0;n<t;n++){let t=e.dels[n],r=e.adds[n];i.push({type:`pair`,...t?{left:{line:t,spans:e.delSpans[n]}}:{},...r?{right:{line:r,spans:e.addSpans[n]}}:{}})}})}),a(e.length),i}var F=n(),I=1500,L=new Map;function R(e,t){if(e){for(let n of e.querySelectorAll(`[data-slot="diff-file"]`))if(n.dataset.path===t)return n}}function z({files:e,mode:t=`unified`,wrap:n=!1,loadFileText:i,imageSrc:o,onOpenInApp:s,viewRef:c,className:l}){let u=(0,f.useMemo)(()=>({adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length}),[e]),[d,p]=(0,f.useState)(()=>new Set),[m,y]=(0,f.useState)(()=>new Map),b=(0,f.useCallback)(e=>{p(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})},[]),x=(0,f.useCallback)(async(e,t)=>{if(!i)return;let n=await i(e.path);if(n===null)return;let r=A(t,n.split(`
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{D as i,S as a,_ as o,b as s,c,d as l,f as u,g as d,h as f,l as p,m,s as h,u as g,v as _,w as v,x as y,y as b}from"./centered-state-B_V_Ai2h.js";import{r as x,t as S}from"./utils-Bb8ohcr3.js";var C=x(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),w=x(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),T=x(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),E=e(t(),1),D=r();function O(e){let t=e+`CollectionProvider`,[n,r]=s(t),[a,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),c=e=>{let{scope:t,children:n}=e,r=E.useRef(null),i=E.useRef(new Map).current;return(0,D.jsx)(a,{scope:t,itemMap:i,collectionRef:r,children:n})};c.displayName=t;let l=e+`CollectionSlot`,u=v(l),d=E.forwardRef((e,t)=>{let{scope:n,children:r}=e,a=i(t,o(l,n).collectionRef);return(0,D.jsx)(u,{ref:a,children:r})});d.displayName=l;let f=e+`CollectionItemSlot`,p=`data-radix-collection-item`,m=v(f),h=E.forwardRef((e,t)=>{let{scope:n,children:r,...a}=e,s=E.useRef(null),c=i(t,s),l=o(f,n);return E.useEffect(()=>(l.itemMap.set(s,{ref:s,...a}),()=>void l.itemMap.delete(s))),(0,D.jsx)(m,{[p]:``,ref:c,children:r})});h.displayName=f;function g(t){let n=o(e+`CollectionConsumer`,t);return E.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${p}]`));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:c,Slot:d,ItemSlot:h},g,r]}var k=E.createContext(void 0);function A(e){let t=E.useContext(k);return e||t||`ltr`}var j=e(n(),1);function M(e){let[t,n]=E.useState(void 0);return _(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var N=[`top`,`right`,`bottom`,`left`],P=Math.min,F=Math.max,I=Math.round,L=Math.floor,R=e=>({x:e,y:e}),ee={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function te(e,t,n){return F(e,P(t,n))}function z(e,t){return typeof e==`function`?e(t):e}function B(e){return e.split(`-`)[0]}function V(e){return e.split(`-`)[1]}function ne(e){return e===`x`?`y`:`x`}function re(e){return e===`y`?`height`:`width`}function H(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function ie(e){return ne(H(e))}function ae(e,t,n){n===void 0&&(n=!1);let r=V(e),i=ie(e),a=re(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=me(o)),[o,me(o)]}function oe(e){let t=me(e);return[se(e),t,se(t)]}function se(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var ce=[`left`,`right`],le=[`right`,`left`],ue=[`top`,`bottom`],de=[`bottom`,`top`];function fe(e,t,n){switch(e){case`top`:case`bottom`:return n?t?le:ce:t?ce:le;case`left`:case`right`:return t?ue:de;default:return[]}}function pe(e,t,n,r){let i=V(e),a=fe(B(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(se)))),a}function me(e){let t=B(e);return ee[t]+e.slice(t.length)}function he(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function ge(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:he(e)}function _e(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 ve(e,t,n){let{reference:r,floating:i}=e,a=H(t),o=ie(t),s=re(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=V(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function ye(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}=z(t,e),p=ge(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=_e(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},y=_e(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var be=50,xe=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:ye},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ve(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<be&&(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}=ve(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Se=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}=z(e,t)||{};if(l==null)return{};let d=ge(u),f={x:n,y:r},p=ie(i),m=re(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=P(d[_],T),D=P(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=te(E,k,O),j=!c.arrow&&V(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),Ce=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}=z(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=B(r),_=H(o),v=B(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[me(o)]:oe(o)),x=p!==`none`;!d&&x&&b.push(...pe(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=ae(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==H(t))||T.every(e=>H(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.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=T.filter(e=>{if(x){let t=H(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 we(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Te(e){return N.some(t=>e[t]>=0)}var Ee=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=z(e,t);switch(i){case`referenceHidden`:{let e=we(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Te(e)}}}case`escaped`:{let e=we(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Te(e)}}}default:return{}}}}},De=new Set([`left`,`top`]);async function Oe(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=V(n),c=H(n)===`y`,l=De.has(o)?-1:1,u=a&&c?-1:1,d=z(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 ke=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 Oe(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}}}}},Ae=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}=z(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=H(i),p=ne(f),m=u[p],h=u[f],g=(e,t)=>te(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}}}}}},je=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}=z(e,t),u={x:n,y:r},d=H(i),f=ne(d),p=u[f],m=u[d],h=z(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=De.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}}}},Me=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}=z(e,t),c=await i.detectOverflow(t,s),l=B(n),u=V(n),d=H(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=P(p-c[m],g),y=P(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*F(c.left,c.right):S=p-2*F(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Ne(){return typeof window<`u`}function Pe(e){return Fe(e)?(e.nodeName||``).toLowerCase():`#document`}function U(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function W(e){return((Fe(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Fe(e){return Ne()?e instanceof Node||e instanceof U(e).Node:!1}function G(e){return Ne()?e instanceof Element||e instanceof U(e).Element:!1}function K(e){return Ne()?e instanceof HTMLElement||e instanceof U(e).HTMLElement:!1}function Ie(e){return!Ne()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof U(e).ShadowRoot}function Le(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=J(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Re(e){return/^(table|td|th)$/.test(Pe(e))}function ze(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/,Ve=/paint|layout|strict|content/,q=e=>!!e&&e!==`none`,He;function Ue(e){let t=G(e)?J(e):e;return q(t.transform)||q(t.translate)||q(t.scale)||q(t.rotate)||q(t.perspective)||!Ge()&&(q(t.backdropFilter)||q(t.filter))||Be.test(t.willChange||``)||Ve.test(t.contain||``)}function We(e){let t=Y(e);for(;K(t)&&!Ke(t);){if(Ue(t))return t;if(ze(t))return null;t=Y(t)}return null}function Ge(){return He??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),He}function Ke(e){return/^(html|body|#document)$/.test(Pe(e))}function J(e){return U(e).getComputedStyle(e)}function qe(e){return G(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Y(e){if(Pe(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ie(e)&&e.host||W(e);return Ie(t)?t.host:t}function Je(e){let t=Y(e);return Ke(t)?(e.ownerDocument||e).body:K(t)&&Le(t)?t:Je(t)}function Ye(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Je(e),i=r===e.ownerDocument?.body,a=U(r);if(i){let e=Xe(a);return t.concat(a,a.visualViewport||[],Le(r)?r:[],e&&n?Ye(e):[])}else return t.concat(r,Ye(r,[],n))}function Xe(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ze(e){let t=J(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=K(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=I(n)!==a||I(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Qe(e){return G(e)?e:e.contextElement}function $e(e){let t=Qe(e);if(!K(t))return R(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Ze(t),o=(a?I(n.width):n.width)/r,s=(a?I(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var et=R(0);function tt(e){let t=U(e);return!Ge()||!t.visualViewport?et:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function nt(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===U(e)}function X(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Qe(e),o=R(1);t&&(r?G(r)&&(o=$e(r)):o=$e(e));let s=nt(a,n,r)?tt(a):R(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=U(a),t=G(r)?U(r):r,n=e,i=Xe(n);for(;i&&t!==n;){let e=$e(i),t=i.getBoundingClientRect(),r=J(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=U(i),i=Xe(n)}}return _e({width:u,height:d,x:c,y:l})}function rt(e,t){let n=qe(e).scrollLeft;return t?t.left+n:X(W(e)).left+n}function it(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-rt(e,n),y:n.top+t.scrollTop}}function at(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=W(r),s=t?ze(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=R(1),u=R(0),d=K(r);if((d||!a)&&((Pe(r)!==`body`||Le(o))&&(c=qe(r)),d)){let e=X(r);l=$e(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?it(o,c):R(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 ot(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function st(e){let t=qe(e),n=e.ownerDocument.body,r=F(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=F(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+rt(e),o=-t.scrollTop;return J(n).direction===`rtl`&&(a+=F(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var ct=25;function lt(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=U(e),a=W(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Ge()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(rt(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<=ct&&(s-=o)}return{width:s,height:c,x:l,y:u}}function ut(e,t){let n=X(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=$e(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function dt(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=lt(e,n,t);else if(t===`document`)r=st(W(e));else if(G(t))r=ut(t,n);else{let n=tt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return _e(r)}function ft(e,t){let n=t.get(e);if(n)return n;let r=Ye(e,[],!1).filter(e=>G(e)&&Pe(e)!==`body`),i=null,a=J(e).position===`fixed`,o=a?Y(e):e;for(;G(o)&&!Ke(o);){let e=J(o),t=Ue(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Y(o)}return t.set(e,r),r}function pt(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ze(t)?[]:ft(t,this._c):[].concat(n),r],o=dt(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=dt(t,a[e],i);s=F(n.top,s),c=P(n.right,c),l=P(n.bottom,l),u=F(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function mt(e){let{width:t,height:n}=Ze(e);return{width:t,height:n}}function ht(e,t,n){let r=K(t),i=W(t),a=n===`fixed`,o=X(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=R(0);if((r||!a)&&((Pe(t)!==`body`||Le(i))&&(s=qe(t)),r)){let e=X(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=rt(i));let l=i&&!r&&!a?it(i,s):R(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 gt(e){return J(e).position===`static`}function _t(e,t){if(!K(e)||J(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return W(e)===n&&(n=n.ownerDocument.body),n}function vt(e,t){let n=U(e);if(ze(e))return n;if(!K(e)){let t=Y(e);for(;t&&!Ke(t);){if(G(t)&&!gt(t))return t;t=Y(t)}return n}let r=_t(e,t);for(;r&&Re(r)&&gt(r);)r=_t(r,t);return r&&Ke(r)&&gt(r)&&!Ue(r)?n:r||We(e)||n}var yt=async function(e){let t=this.getOffsetParent||vt,n=this.getDimensions,r=await n(e.floating);return{reference:ht(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function bt(e){return J(e).direction===`rtl`}var xt={convertOffsetParentRelativeRectToViewportRelativeRect:at,getDocumentElement:W,getClippingRect:pt,getOffsetParent:vt,getElementRects:yt,getClientRects:ot,getDimensions:mt,getScale:$e,isElement:G,isRTL:bt};function St(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ct(e,t,n){let r=null,i,a=W(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:f,height:p}=l;if(n||t(),!f||!p)return;let m=L(d),h=L(a.clientWidth-(u+f)),g=L(a.clientHeight-(d+p)),_=L(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:F(0,P(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!St(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=U(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function wt(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=Qe(e),u=i||a?[...l?Ye(l):[],...t?Ye(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Ct(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?X(e):null;c&&g();function g(){let t=X(e);h&&!St(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=ke,Et=Ae,Dt=Ce,Ot=Me,kt=Ee,At=Se,jt=je,Mt=(e,t,n)=>{let r=new Map,i=n??{},a={...xt,...i.platform,_c:r};return xe(e,t,{...i,platform:a})},Nt=typeof document<`u`?E.useLayoutEffect:function(){};function Pt(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(!Pt(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)&&!Pt(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 It(e,t){let n=Ft(e);return Math.round(t*n)/n}function Lt(e){let t=E.useRef(e);return Nt(()=>{t.current=e}),t}function Rt(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,[u,d]=E.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=E.useState(r);Pt(f,r)||p(r);let[m,h]=E.useState(null),[g,_]=E.useState(null),v=E.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=E.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=E.useRef(null),C=E.useRef(null),w=E.useRef(u),T=c!=null,D=Lt(c),O=Lt(i),k=Lt(l),A=E.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Mt(S.current,C.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};M.current&&!Pt(w.current,t)&&(w.current=t,j.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Nt(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=E.useRef(!1);Nt(()=>(M.current=!0,()=>{M.current=!1}),[]),Nt(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(D.current)return D.current(b,x,A);A()}},[b,x,A,D,T]);let N=E.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),P=E.useMemo(()=>({reference:b,floating:x}),[b,x]),F=E.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=It(P.floating,u.x),r=It(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Ft(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,u.x,u.y]);return E.useMemo(()=>({...u,update:A,refs:N,elements:P,floatingStyles:F}),[u,A,N,P,F])}var zt=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?{}:At({element:r.current,padding:i}).fn(n):r?At({element:r,padding:i}).fn(n):{}}}},Bt=(e,t)=>{let n=Tt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vt=(e,t)=>{let n=Et(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ht=(e,t)=>({fn:jt(e).fn,options:[e,t]}),Ut=(e,t)=>{let n=Dt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wt=(e,t)=>{let n=Ot(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gt=(e,t)=>{let n=kt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kt=(e,t)=>{let n=zt(e);return{name:n.name,fn:n.fn,options:[e,t]}},qt=`Arrow`,Jt=E.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,D.jsx)(y.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,D.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Jt.displayName=qt;var Yt=Jt,Xt=`Popper`,[Zt,Qt]=s(Xt),[$t,en]=Zt(Xt),tn=e=>{let{__scopePopper:t,children:n}=e,[r,i]=E.useState(null),[a,o]=E.useState(void 0);return(0,D.jsx)($t,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};tn.displayName=Xt;var nn=`PopperAnchor`,rn=E.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...a}=e,o=en(nn,n),s=E.useRef(null),c=o.onAnchorChange,l=i(t,E.useCallback(e=>{s.current=e,e&&c(e)},[c])),u=E.useRef(null);E.useEffect(()=>{if(!r)return;let e=u.current;u.current=r.current,e!==u.current&&c(u.current)});let d=o.placementState&&mn(o.placementState),f=d?.[0],p=d?.[1];return r?null:(0,D.jsx)(y.div,{"data-radix-popper-side":f,"data-radix-popper-align":p,...a,ref:l})});rn.displayName=nn;var an=`PopperContent`,[on,sn]=Zt(an),cn=E.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,arrowPadding:c=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f=`partial`,hideWhenDetached:p=!1,updatePositionStrategy:h=`optimized`,onPlaced:g,...v}=e,b=en(an,n),[x,S]=E.useState(null),C=i(t,S),[w,T]=E.useState(null),O=M(w),k=O?.width??0,A=O?.height??0,j=r+(o===`center`?``:`-`+o),N=typeof d==`number`?d:{top:0,right:0,bottom:0,left:0,...d},P=Array.isArray(u)?u:[u],F=P.length>0,I={padding:N,boundary:P.filter(fn),altBoundary:F},{refs:L,floatingStyles:R,placement:ee,isPositioned:te,middlewareData:z}=Rt({strategy:`fixed`,placement:j,whileElementsMounted:(...e)=>wt(...e,{animationFrame:h===`always`}),elements:{reference:b.anchor},middleware:[Bt({mainAxis:a+A,alignmentAxis:s}),l&&Vt({mainAxis:!0,crossAxis:!1,limiter:f===`partial`?Ht():void 0,...I}),l&&Ut({...I}),Wt({...I,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`)}}),w&&Kt({element:w,padding:c}),pn({arrowWidth:k,arrowHeight:A}),p&&Gt({strategy:`referenceHidden`,...I,boundary:F?I.boundary:void 0})]}),B=b.setPlacementState;_(()=>(B(ee),()=>{B(void 0)}),[ee,B]);let[V,ne]=mn(ee),re=m(g);_(()=>{te&&re?.()},[te,re]);let H=z.arrow?.x,ie=z.arrow?.y,ae=z.arrow?.centerOffset!==0,[oe,se]=E.useState();return _(()=>{x&&se(window.getComputedStyle(x).zIndex)},[x]),(0,D.jsx)(`div`,{ref:L.setFloating,"data-radix-popper-content-wrapper":``,style:{...R,transform:te?R.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(` `),...z.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,D.jsx)(on,{scope:n,placedSide:V,placedAlign:ne,onArrowChange:T,arrowX:H,arrowY:ie,shouldHideArrow:ae,children:(0,D.jsx)(y.div,{"data-side":V,"data-align":ne,...v,ref:C,style:{...v.style,animation:te?void 0:`none`}})})})});cn.displayName=an;var ln=`PopperArrow`,un={top:`bottom`,right:`left`,bottom:`top`,left:`right`},dn=E.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=sn(ln,n),a=un[i.placedSide];return(0,D.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,D.jsx)(Yt,{...r,ref:t,style:{...r.style,display:`block`}})})});dn.displayName=ln;function fn(e){return e!==null}var pn=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]=mn(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 mn(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var hn=tn,gn=rn,_n=cn,vn=dn,yn=!1;function bn(){let[e,t]=E.useState(yn);return E.useEffect(()=>{yn||(yn=!0,t(!0))},[]),e}var xn=E.useSyncExternalStore;function Sn(){return()=>{}}function Cn(){return xn(Sn,()=>!0,()=>!1)}var wn=typeof xn==`function`?Cn:bn,Tn=`rovingFocusGroup.onEntryFocus`,En={bubbles:!1,cancelable:!0},Dn=`RovingFocusGroup`,[On,kn,An]=O(Dn),[jn,Mn]=s(Dn,[An]),[Nn,Pn]=jn(Dn),Fn=E.forwardRef((e,t)=>(0,D.jsx)(On.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,D.jsx)(On.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,D.jsx)(In,{...e,ref:t})})}));Fn.displayName=Dn;var In=E.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:s,currentTabStopId:c,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...p}=e,h=E.useRef(null),g=i(t,h),_=A(s),[v,x]=o({prop:c,defaultProp:l??null,onChange:u,caller:Dn}),[S,C]=E.useState(!1),w=m(d),T=kn(n),O=E.useRef(!1),[k,j]=E.useState(0);return E.useEffect(()=>{let e=h.current;if(e)return e.addEventListener(Tn,w),()=>e.removeEventListener(Tn,w)},[w]),(0,D.jsx)(Nn,{scope:n,orientation:r,dir:_,loop:a,currentTabStopId:v,onItemFocus:E.useCallback(e=>x(e),[x]),onItemShiftTab:E.useCallback(()=>C(!0),[]),onFocusableItemAdd:E.useCallback(()=>j(e=>e+1),[]),onFocusableItemRemove:E.useCallback(()=>j(e=>e-1),[]),children:(0,D.jsx)(y.div,{tabIndex:S||k===0?-1:0,"data-orientation":r,...p,ref:g,style:{outline:`none`,...e.style},onMouseDown:b(e.onMouseDown,()=>{O.current=!0}),onFocus:b(e.onFocus,e=>{let t=!O.current;if(e.target===e.currentTarget&&t&&!S){let t=new CustomEvent(Tn,En);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=T().filter(e=>e.focusable);Hn([e.find(e=>e.active),e.find(e=>e.id===v),...e].filter(Boolean).map(e=>e.ref.current),f)}}O.current=!1}),onBlur:b(e.onBlur,()=>C(!1))})})}),Ln=`RovingFocusGroupItem`,Rn=E.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=f(),l=a||c,u=Pn(Ln,n),d=u.currentTabStopId===l,p=kn(n),{onFocusableItemAdd:m,onFocusableItemRemove:h,currentTabStopId:g}=u,v=wn();return _(()=>{if(!(!v||!r))return m(),()=>h()},[v,r,m,h]),E.useEffect(()=>{if(!(v||!r))return m(),()=>h()},[v,r,m,h]),(0,D.jsx)(On.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,D.jsx)(y.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:b(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:b(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:b(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Vn(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=p().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=u.loop?Un(n,r+1):n.slice(r+1)}setTimeout(()=>Hn(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:g!=null}):o})})});Rn.displayName=Ln;var zn={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Bn(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function Vn(e,t,n){let r=Bn(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return zn[r]}function Hn(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Un(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Wn=Fn,Gn=Rn,Kn=[`Enter`,` `],qn=[`ArrowDown`,`PageUp`,`Home`],Jn=[`ArrowUp`,`PageDown`,`End`],Yn=[...qn,...Jn],Xn={ltr:[...Kn,`ArrowRight`],rtl:[...Kn,`ArrowLeft`]},Zn={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Qn=`Menu`,[$n,er,tr]=O(Qn),[nr,rr]=s(Qn,[tr,Qt,Mn]),ir=Qt(),ar=Mn(),[or,Z]=nr(Qn),[sr,cr]=nr(Qn),lr=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=ir(t),[c,l]=E.useState(null),u=E.useRef(!1),d=m(a),f=A(i);return E.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})}},[]),E.useEffect(()=>{if(!n)return;let e=()=>d(!1);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,D.jsx)(hn,{...s,children:(0,D.jsx)(or,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,D.jsx)(sr,{scope:t,onClose:E.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};lr.displayName=Qn;var ur=`MenuAnchor`,dr=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=ir(n);return(0,D.jsx)(gn,{...i,...r,ref:t})});dr.displayName=ur;var fr=`MenuPortal`,[pr,mr]=nr(fr,{forceMount:void 0}),hr=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Z(fr,t);return(0,D.jsx)(pr,{scope:t,forceMount:n,children:(0,D.jsx)(d,{present:n||a.open,children:(0,D.jsx)(g,{asChild:!0,container:i,children:r})})})};hr.displayName=fr;var Q=`MenuContent`,[gr,_r]=nr(Q),vr=E.forwardRef((e,t)=>{let n=mr(Q,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Z(Q,e.__scopeMenu),o=cr(Q,e.__scopeMenu);return(0,D.jsx)($n.Provider,{scope:e.__scopeMenu,children:(0,D.jsx)(d,{present:r||a.open,children:(0,D.jsx)($n.Slot,{scope:e.__scopeMenu,children:o.modal?(0,D.jsx)(yr,{...i,ref:t}):(0,D.jsx)(br,{...i,ref:t})})})})}),yr=E.forwardRef((e,t)=>{let n=Z(Q,e.__scopeMenu),r=E.useRef(null),a=i(t,r);return E.useEffect(()=>{let e=r.current;if(e)return h(e)},[]),(0,D.jsx)(Sr,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:b(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),br=E.forwardRef((e,t)=>{let n=Z(Q,e.__scopeMenu);return(0,D.jsx)(Sr,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),xr=v(`MenuContent.ScrollLock`),Sr=E.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:d,onEntryFocus:f,onEscapeKeyDown:m,onPointerDownOutside:h,onFocusOutside:g,onInteractOutside:_,onDismiss:v,disableOutsideScroll:y,...x}=e,S=Z(Q,n),C=cr(Q,n),w=ir(n),T=ar(n),O=er(n),[k,A]=E.useState(null),j=E.useRef(null),M=i(t,j,S.onContentChange),N=E.useRef(0),P=E.useRef(``),F=E.useRef(0),I=E.useRef(null),L=E.useRef(`right`),R=E.useRef(0),ee=y?c:E.Fragment,te=y?{as:xr,allowPinchZoom:!0}:void 0,z=e=>{let t=P.current+e,n=O().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=oi(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){P.current=t,window.clearTimeout(N.current),t!==``&&(N.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};E.useEffect(()=>()=>window.clearTimeout(N.current),[]),p();let B=E.useCallback(e=>L.current===I.current?.side&&ci(e,I.current?.area),[]);return(0,D.jsx)(gr,{scope:n,searchRef:P,onItemEnter:E.useCallback(e=>{B(e)&&e.preventDefault()},[B]),onItemLeave:E.useCallback(e=>{B(e)||(j.current?.focus(),A(null))},[B]),onTriggerLeave:E.useCallback(e=>{B(e)&&e.preventDefault()},[B]),pointerGraceTimerRef:F,onPointerGraceIntentChange:E.useCallback(e=>{I.current=e},[]),children:(0,D.jsx)(ee,{...te,children:(0,D.jsx)(l,{asChild:!0,trapped:a,onMountAutoFocus:b(o,e=>{e.preventDefault(),j.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:(0,D.jsx)(u,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:m,onPointerDownOutside:h,onFocusOutside:g,onInteractOutside:_,onDismiss:v,children:(0,D.jsx)(Wn,{asChild:!0,...T,dir:C.dir,orientation:`vertical`,loop:r,currentTabStopId:k,onCurrentTabStopIdChange:A,onEntryFocus:b(f,e=>{C.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,D.jsx)(_n,{role:`menu`,"aria-orientation":`vertical`,"data-state":ti(S.open),"data-radix-menu-content":``,dir:C.dir,...w,...x,ref:M,style:{outline:`none`,...x.style},onKeyDown:b(x.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&&z(e.key));let i=j.current;if(e.target!==i||!Yn.includes(e.key))return;e.preventDefault();let a=O().filter(e=>!e.disabled).map(e=>e.ref.current);Jn.includes(e.key)&&a.reverse(),ii(a)}),onBlur:b(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(N.current),P.current=``)}),onPointerMove:b(e.onPointerMove,li(e=>{let t=e.target,n=R.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>R.current?`right`:`left`;L.current=t,R.current=e.clientX}}))})})})})})})});vr.displayName=Q;var Cr=`MenuGroup`,wr=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,D.jsx)(y.div,{role:`group`,...r,ref:t})});wr.displayName=Cr;var Tr=`MenuLabel`,Er=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,D.jsx)(y.div,{...r,ref:t})});Er.displayName=Tr;var Dr=`MenuItem`,Or=`menu.itemSelect`,kr=E.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...o}=e,s=E.useRef(null),c=cr(Dr,e.__scopeMenu),l=_r(Dr,e.__scopeMenu),u=i(t,s),d=E.useRef(!1),f=()=>{let e=s.current;if(!n&&e){let t=new CustomEvent(Or,{bubbles:!0,cancelable:!0});e.addEventListener(Or,e=>r?.(e),{once:!0}),a(e,t),t.defaultPrevented?d.current=!1:c.onClose()}};return(0,D.jsx)(Ar,{...o,ref:u,disabled:n,onClick:b(e.onClick,f),onPointerDown:t=>{e.onPointerDown?.(t),d.current=!0},onPointerUp:b(e.onPointerUp,e=>{d.current||e.currentTarget?.click()}),onKeyDown:b(e.onKeyDown,e=>{n||e.target!==e.currentTarget||l.searchRef.current!==``&&e.key===` `||Kn.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});kr.displayName=Dr;var Ar=E.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:a,...o}=e,s=_r(Dr,n),c=ar(n),l=E.useRef(null),u=i(t,l),[d,f]=E.useState(!1),[p,m]=E.useState(``);return E.useEffect(()=>{let e=l.current;e&&m((e.textContent??``).trim())},[o.children]),(0,D.jsx)($n.ItemSlot,{scope:n,disabled:r,textValue:a??p,children:(0,D.jsx)(Gn,{asChild:!0,...c,focusable:!r,children:(0,D.jsx)(y.div,{role:`menuitem`,"data-highlighted":d?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...o,ref:u,onPointerMove:b(e.onPointerMove,li(e=>{r?s.onItemLeave(e):(s.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:b(e.onPointerLeave,li(e=>s.onItemLeave(e))),onFocus:b(e.onFocus,()=>f(!0)),onBlur:b(e.onBlur,()=>f(!1))})})})}),jr=`MenuCheckboxItem`,Mr=E.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,D.jsx)(Br,{scope:e.__scopeMenu,checked:n,children:(0,D.jsx)(kr,{role:`menuitemcheckbox`,"aria-checked":ni(n)?`mixed`:n,...i,ref:t,"data-state":ri(n),onSelect:b(i.onSelect,()=>r?.(ni(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Mr.displayName=jr;var Nr=`MenuRadioGroup`,[Pr,Fr]=nr(Nr,{value:void 0,onValueChange:()=>{}}),Ir=E.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=m(r);return(0,D.jsx)(Pr,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,D.jsx)(wr,{...i,ref:t})})});Ir.displayName=Nr;var Lr=`MenuRadioItem`,Rr=E.forwardRef((e,t)=>{let{value:n,...r}=e,i=Fr(Lr,e.__scopeMenu),a=n===i.value;return(0,D.jsx)(Br,{scope:e.__scopeMenu,checked:a,children:(0,D.jsx)(kr,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":ri(a),onSelect:b(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Rr.displayName=Lr;var zr=`MenuItemIndicator`,[Br,Vr]=nr(zr,{checked:!1}),Hr=E.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Vr(zr,n);return(0,D.jsx)(d,{present:r||ni(a.checked)||a.checked===!0,children:(0,D.jsx)(y.span,{...i,ref:t,"data-state":ri(a.checked)})})});Hr.displayName=zr;var Ur=`MenuSeparator`,Wr=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,D.jsx)(y.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Wr.displayName=Ur;var Gr=`MenuArrow`,Kr=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=ir(n);return(0,D.jsx)(vn,{...i,...r,ref:t})});Kr.displayName=Gr;var qr=`MenuSub`,[Jr,Yr]=nr(qr),Xr=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Z(qr,t),o=ir(t),[s,c]=E.useState(null),[l,u]=E.useState(null),d=m(i);return E.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,D.jsx)(hn,{...o,children:(0,D.jsx)(or,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,D.jsx)(Jr,{scope:t,contentId:f(),triggerId:f(),trigger:s,onTriggerChange:c,children:n})})})};Xr.displayName=qr;var Zr=`MenuSubTrigger`,Qr=E.forwardRef((e,t)=>{let n=Z(Zr,e.__scopeMenu),r=cr(Zr,e.__scopeMenu),a=Yr(Zr,e.__scopeMenu),o=_r(Zr,e.__scopeMenu),s=E.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:l}=o,u={__scopeMenu:e.__scopeMenu},d=E.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);E.useEffect(()=>d,[d]),E.useEffect(()=>{let e=c.current;return()=>{window.clearTimeout(e),l(null)}},[c,l]);let f=i(t,a.onTriggerChange);return(0,D.jsx)(dr,{asChild:!0,...u,children:(0,D.jsx)(Ar,{id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?a.contentId:void 0,"data-state":ti(n.open),...e,ref:f,onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:b(e.onPointerMove,li(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:b(e.onPointerLeave,li(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:b(e.onKeyDown,t=>{e.disabled||t.target!==t.currentTarget||o.searchRef.current!==``&&t.key===` `||Xn[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Qr.displayName=Zr;var $r=`MenuSubContent`,ei=E.forwardRef((e,t)=>{let n=mr(Q,e.__scopeMenu),{forceMount:r=n.forceMount,align:a=`start`,...o}=e,s=Z(Q,e.__scopeMenu),c=cr(Q,e.__scopeMenu),l=Yr($r,e.__scopeMenu),u=E.useRef(null),f=i(t,u);return(0,D.jsx)($n.Provider,{scope:e.__scopeMenu,children:(0,D.jsx)(d,{present:r||s.open,children:(0,D.jsx)($n.Slot,{scope:e.__scopeMenu,children:(0,D.jsx)(Sr,{id:l.contentId,"aria-labelledby":l.triggerId,...o,ref:f,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:b(e.onFocusOutside,e=>{e.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:b(e.onEscapeKeyDown,e=>{c.onClose(),e.preventDefault()}),onKeyDown:b(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Zn[c.dir].includes(e.key);t&&n&&(s.onOpenChange(!1),l.trigger?.focus(),e.preventDefault())})})})})})});ei.displayName=$r;function ti(e){return e?`open`:`closed`}function ni(e){return e===`indeterminate`}function ri(e){return ni(e)?`indeterminate`:e?`checked`:`unchecked`}function ii(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function ai(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function oi(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=ai(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 si(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 ci(e,t){return t?si({x:e.clientX,y:e.clientY},t):!1}function li(e){return t=>t.pointerType===`mouse`?e(t):void 0}var ui=lr,di=dr,fi=hr,pi=vr,mi=wr,hi=Er,gi=kr,_i=Mr,vi=Ir,yi=Rr,bi=Hr,xi=Wr,Si=Kr,Ci=Qr,wi=ei,Ti=`DropdownMenu`,[Ei,Di]=s(Ti,[rr]),$=rr(),[Oi,ki]=Ei(Ti),Ai=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:s,modal:c=!0}=e,l=$(t),u=E.useRef(null),[d,p]=o({prop:i,defaultProp:a??!1,onChange:s,caller:Ti});return(0,D.jsx)(Oi,{scope:t,triggerId:f(),triggerRef:u,contentId:f(),open:d,onOpenChange:p,onOpenToggle:E.useCallback(()=>p(e=>!e),[p]),modal:c,children:(0,D.jsx)(ui,{...l,open:d,onOpenChange:p,dir:r,modal:c,children:n})})};Ai.displayName=Ti;var ji=`DropdownMenuTrigger`,Mi=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...a}=e,o=ki(ji,n),s=$(n),c=i(t,o.triggerRef);return(0,D.jsx)(di,{asChild:!0,...s,children:(0,D.jsx)(y.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":r?``:void 0,disabled:r,...a,ref:c,onPointerDown:b(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(o.onOpenToggle(),o.open||e.preventDefault())}),onKeyDown:b(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&o.onOpenToggle(),e.key===`ArrowDown`&&o.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Mi.displayName=ji;var Ni=`DropdownMenuPortal`,Pi=e=>{let{__scopeDropdownMenu:t,...n}=e,r=$(t);return(0,D.jsx)(fi,{...r,...n})};Pi.displayName=Ni;var Fi=`DropdownMenuContent`,Ii=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ki(Fi,n),a=$(n),o=E.useRef(!1);return(0,D.jsx)(pi,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:b(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:b(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)`}})});Ii.displayName=Fi;var Li=`DropdownMenuGroup`,Ri=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(mi,{...i,...r,ref:t})});Ri.displayName=Li;var zi=`DropdownMenuLabel`,Bi=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(hi,{...i,...r,ref:t})});Bi.displayName=zi;var Vi=`DropdownMenuItem`,Hi=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(gi,{...i,...r,ref:t})});Hi.displayName=Vi;var Ui=`DropdownMenuCheckboxItem`,Wi=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(_i,{...i,...r,ref:t})});Wi.displayName=Ui;var Gi=`DropdownMenuRadioGroup`,Ki=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(vi,{...i,...r,ref:t})});Ki.displayName=Gi;var qi=`DropdownMenuRadioItem`,Ji=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(yi,{...i,...r,ref:t})});Ji.displayName=qi;var Yi=`DropdownMenuItemIndicator`,Xi=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(bi,{...i,...r,ref:t})});Xi.displayName=Yi;var Zi=`DropdownMenuSeparator`,Qi=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(xi,{...i,...r,ref:t})});Qi.displayName=Zi;var $i=`DropdownMenuArrow`,ea=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(Si,{...i,...r,ref:t})});ea.displayName=$i;var ta=`DropdownMenuSubTrigger`,na=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(Ci,{...i,...r,ref:t})});na.displayName=ta;var ra=`DropdownMenuSubContent`,ia=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(wi,{...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)`}})});ia.displayName=ra;var aa=Ai,oa=Mi,sa=Pi,ca=Ii,la=Bi,ua=Hi,da=Ki,fa=Ji,pa=Xi,ma=Qi;function ha({...e}){return(0,D.jsx)(aa,{"data-slot":`dropdown-menu`,...e})}function ga({...e}){return(0,D.jsx)(oa,{"data-slot":`dropdown-menu-trigger`,...e})}function _a({className:e,sideOffset:t=4,...n}){return(0,D.jsx)(sa,{children:(0,D.jsx)(ca,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:S(`z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] 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 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...n})})}function va({className:e,inset:t,variant:n=`default`,...r}){return(0,D.jsx)(ua,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:S(`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]:pl-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 ya({...e}){return(0,D.jsx)(da,{"data-slot":`dropdown-menu-radio-group`,...e})}function ba({className:e,children:t,...n}){return(0,D.jsxs)(fa,{"data-slot":`dropdown-menu-radio-item`,className:S(`relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-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,D.jsx)(`span`,{className:`pointer-events-none absolute left-2 flex size-3.5 items-center justify-center`,children:(0,D.jsx)(pa,{children:(0,D.jsx)(C,{className:`size-2 fill-current`})})}),t]})}function xa({className:e,inset:t,...n}){return(0,D.jsx)(la,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:S(`px-2 py-1.5 text-sm font-medium data-[inset]:pl-8`,e),...n})}function Sa({className:e,...t}){return(0,D.jsx)(ma,{"data-slot":`dropdown-menu-separator`,className:S(`-mx-1 my-1 h-px bg-border`,e),...t})}export{M as _,ya as a,w as b,ga as c,Mn as d,gn as f,Qt as g,hn as h,xa as i,Gn as l,_n as m,_a as n,ba as o,vn as p,va as r,Sa as s,ha as t,Wn as u,A as v,C as x,T as y};
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{D as i,S as a,_ as o,b as s,c,d as l,f as u,g as d,h as f,l as p,m,s as h,u as g,v as _,w as v,x as y,y as b}from"./centered-state-Djgly6Ni.js";import{r as x,t as S}from"./utils--z9hRtl3.js";var C=x(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),w=x(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),T=x(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),E=e(t(),1),D=r();function O(e){let t=e+`CollectionProvider`,[n,r]=s(t),[a,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),c=e=>{let{scope:t,children:n}=e,r=E.useRef(null),i=E.useRef(new Map).current;return(0,D.jsx)(a,{scope:t,itemMap:i,collectionRef:r,children:n})};c.displayName=t;let l=e+`CollectionSlot`,u=v(l),d=E.forwardRef((e,t)=>{let{scope:n,children:r}=e,a=i(t,o(l,n).collectionRef);return(0,D.jsx)(u,{ref:a,children:r})});d.displayName=l;let f=e+`CollectionItemSlot`,p=`data-radix-collection-item`,m=v(f),h=E.forwardRef((e,t)=>{let{scope:n,children:r,...a}=e,s=E.useRef(null),c=i(t,s),l=o(f,n);return E.useEffect(()=>(l.itemMap.set(s,{ref:s,...a}),()=>void l.itemMap.delete(s))),(0,D.jsx)(m,{[p]:``,ref:c,children:r})});h.displayName=f;function g(t){let n=o(e+`CollectionConsumer`,t);return E.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${p}]`));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:c,Slot:d,ItemSlot:h},g,r]}var k=E.createContext(void 0);function A(e){let t=E.useContext(k);return e||t||`ltr`}var j=e(n(),1);function M(e){let[t,n]=E.useState(void 0);return _(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var N=[`top`,`right`,`bottom`,`left`],P=Math.min,F=Math.max,I=Math.round,L=Math.floor,R=e=>({x:e,y:e}),ee={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function te(e,t,n){return F(e,P(t,n))}function z(e,t){return typeof e==`function`?e(t):e}function B(e){return e.split(`-`)[0]}function V(e){return e.split(`-`)[1]}function ne(e){return e===`x`?`y`:`x`}function re(e){return e===`y`?`height`:`width`}function H(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function ie(e){return ne(H(e))}function ae(e,t,n){n===void 0&&(n=!1);let r=V(e),i=ie(e),a=re(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=me(o)),[o,me(o)]}function oe(e){let t=me(e);return[se(e),t,se(t)]}function se(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var ce=[`left`,`right`],le=[`right`,`left`],ue=[`top`,`bottom`],de=[`bottom`,`top`];function fe(e,t,n){switch(e){case`top`:case`bottom`:return n?t?le:ce:t?ce:le;case`left`:case`right`:return t?ue:de;default:return[]}}function pe(e,t,n,r){let i=V(e),a=fe(B(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(se)))),a}function me(e){let t=B(e);return ee[t]+e.slice(t.length)}function he(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function ge(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:he(e)}function _e(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 ve(e,t,n){let{reference:r,floating:i}=e,a=H(t),o=ie(t),s=re(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=V(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function ye(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}=z(t,e),p=ge(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=_e(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},y=_e(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var be=50,xe=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:ye},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ve(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<be&&(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}=ve(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Se=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}=z(e,t)||{};if(l==null)return{};let d=ge(u),f={x:n,y:r},p=ie(i),m=re(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=P(d[_],T),D=P(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=te(E,k,O),j=!c.arrow&&V(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),Ce=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}=z(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=B(r),_=H(o),v=B(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[me(o)]:oe(o)),x=p!==`none`;!d&&x&&b.push(...pe(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=ae(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==H(t))||T.every(e=>H(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.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=T.filter(e=>{if(x){let t=H(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 we(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Te(e){return N.some(t=>e[t]>=0)}var Ee=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=z(e,t);switch(i){case`referenceHidden`:{let e=we(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Te(e)}}}case`escaped`:{let e=we(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Te(e)}}}default:return{}}}}},De=new Set([`left`,`top`]);async function Oe(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=V(n),c=H(n)===`y`,l=De.has(o)?-1:1,u=a&&c?-1:1,d=z(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 ke=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 Oe(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}}}}},Ae=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}=z(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=H(i),p=ne(f),m=u[p],h=u[f],g=(e,t)=>te(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}}}}}},je=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}=z(e,t),u={x:n,y:r},d=H(i),f=ne(d),p=u[f],m=u[d],h=z(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=De.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}}}},Me=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}=z(e,t),c=await i.detectOverflow(t,s),l=B(n),u=V(n),d=H(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=P(p-c[m],g),y=P(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*F(c.left,c.right):S=p-2*F(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Ne(){return typeof window<`u`}function Pe(e){return Fe(e)?(e.nodeName||``).toLowerCase():`#document`}function U(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function W(e){return((Fe(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Fe(e){return Ne()?e instanceof Node||e instanceof U(e).Node:!1}function G(e){return Ne()?e instanceof Element||e instanceof U(e).Element:!1}function K(e){return Ne()?e instanceof HTMLElement||e instanceof U(e).HTMLElement:!1}function Ie(e){return!Ne()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof U(e).ShadowRoot}function Le(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=J(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Re(e){return/^(table|td|th)$/.test(Pe(e))}function ze(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/,Ve=/paint|layout|strict|content/,q=e=>!!e&&e!==`none`,He;function Ue(e){let t=G(e)?J(e):e;return q(t.transform)||q(t.translate)||q(t.scale)||q(t.rotate)||q(t.perspective)||!Ge()&&(q(t.backdropFilter)||q(t.filter))||Be.test(t.willChange||``)||Ve.test(t.contain||``)}function We(e){let t=Y(e);for(;K(t)&&!Ke(t);){if(Ue(t))return t;if(ze(t))return null;t=Y(t)}return null}function Ge(){return He??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),He}function Ke(e){return/^(html|body|#document)$/.test(Pe(e))}function J(e){return U(e).getComputedStyle(e)}function qe(e){return G(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Y(e){if(Pe(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ie(e)&&e.host||W(e);return Ie(t)?t.host:t}function Je(e){let t=Y(e);return Ke(t)?(e.ownerDocument||e).body:K(t)&&Le(t)?t:Je(t)}function Ye(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Je(e),i=r===e.ownerDocument?.body,a=U(r);if(i){let e=Xe(a);return t.concat(a,a.visualViewport||[],Le(r)?r:[],e&&n?Ye(e):[])}else return t.concat(r,Ye(r,[],n))}function Xe(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ze(e){let t=J(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=K(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=I(n)!==a||I(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Qe(e){return G(e)?e:e.contextElement}function $e(e){let t=Qe(e);if(!K(t))return R(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Ze(t),o=(a?I(n.width):n.width)/r,s=(a?I(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var et=R(0);function tt(e){let t=U(e);return!Ge()||!t.visualViewport?et:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function nt(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===U(e)}function X(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Qe(e),o=R(1);t&&(r?G(r)&&(o=$e(r)):o=$e(e));let s=nt(a,n,r)?tt(a):R(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=U(a),t=G(r)?U(r):r,n=e,i=Xe(n);for(;i&&t!==n;){let e=$e(i),t=i.getBoundingClientRect(),r=J(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=U(i),i=Xe(n)}}return _e({width:u,height:d,x:c,y:l})}function rt(e,t){let n=qe(e).scrollLeft;return t?t.left+n:X(W(e)).left+n}function it(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-rt(e,n),y:n.top+t.scrollTop}}function at(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=W(r),s=t?ze(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=R(1),u=R(0),d=K(r);if((d||!a)&&((Pe(r)!==`body`||Le(o))&&(c=qe(r)),d)){let e=X(r);l=$e(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?it(o,c):R(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 ot(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function st(e){let t=qe(e),n=e.ownerDocument.body,r=F(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=F(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+rt(e),o=-t.scrollTop;return J(n).direction===`rtl`&&(a+=F(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var ct=25;function lt(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=U(e),a=W(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Ge()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(rt(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<=ct&&(s-=o)}return{width:s,height:c,x:l,y:u}}function ut(e,t){let n=X(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=$e(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function dt(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=lt(e,n,t);else if(t===`document`)r=st(W(e));else if(G(t))r=ut(t,n);else{let n=tt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return _e(r)}function ft(e,t){let n=t.get(e);if(n)return n;let r=Ye(e,[],!1).filter(e=>G(e)&&Pe(e)!==`body`),i=null,a=J(e).position===`fixed`,o=a?Y(e):e;for(;G(o)&&!Ke(o);){let e=J(o),t=Ue(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Y(o)}return t.set(e,r),r}function pt(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ze(t)?[]:ft(t,this._c):[].concat(n),r],o=dt(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=dt(t,a[e],i);s=F(n.top,s),c=P(n.right,c),l=P(n.bottom,l),u=F(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function mt(e){let{width:t,height:n}=Ze(e);return{width:t,height:n}}function ht(e,t,n){let r=K(t),i=W(t),a=n===`fixed`,o=X(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=R(0);if((r||!a)&&((Pe(t)!==`body`||Le(i))&&(s=qe(t)),r)){let e=X(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=rt(i));let l=i&&!r&&!a?it(i,s):R(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 gt(e){return J(e).position===`static`}function _t(e,t){if(!K(e)||J(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return W(e)===n&&(n=n.ownerDocument.body),n}function vt(e,t){let n=U(e);if(ze(e))return n;if(!K(e)){let t=Y(e);for(;t&&!Ke(t);){if(G(t)&&!gt(t))return t;t=Y(t)}return n}let r=_t(e,t);for(;r&&Re(r)&&gt(r);)r=_t(r,t);return r&&Ke(r)&&gt(r)&&!Ue(r)?n:r||We(e)||n}var yt=async function(e){let t=this.getOffsetParent||vt,n=this.getDimensions,r=await n(e.floating);return{reference:ht(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function bt(e){return J(e).direction===`rtl`}var xt={convertOffsetParentRelativeRectToViewportRelativeRect:at,getDocumentElement:W,getClippingRect:pt,getOffsetParent:vt,getElementRects:yt,getClientRects:ot,getDimensions:mt,getScale:$e,isElement:G,isRTL:bt};function St(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ct(e,t,n){let r=null,i,a=W(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:f,height:p}=l;if(n||t(),!f||!p)return;let m=L(d),h=L(a.clientWidth-(u+f)),g=L(a.clientHeight-(d+p)),_=L(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:F(0,P(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!St(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=U(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function wt(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=Qe(e),u=i||a?[...l?Ye(l):[],...t?Ye(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Ct(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?X(e):null;c&&g();function g(){let t=X(e);h&&!St(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=ke,Et=Ae,Dt=Ce,Ot=Me,kt=Ee,At=Se,jt=je,Mt=(e,t,n)=>{let r=new Map,i=n??{},a={...xt,...i.platform,_c:r};return xe(e,t,{...i,platform:a})},Nt=typeof document<`u`?E.useLayoutEffect:function(){};function Pt(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(!Pt(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)&&!Pt(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 It(e,t){let n=Ft(e);return Math.round(t*n)/n}function Lt(e){let t=E.useRef(e);return Nt(()=>{t.current=e}),t}function Rt(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,[u,d]=E.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=E.useState(r);Pt(f,r)||p(r);let[m,h]=E.useState(null),[g,_]=E.useState(null),v=E.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=E.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=E.useRef(null),C=E.useRef(null),w=E.useRef(u),T=c!=null,D=Lt(c),O=Lt(i),k=Lt(l),A=E.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Mt(S.current,C.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};M.current&&!Pt(w.current,t)&&(w.current=t,j.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Nt(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=E.useRef(!1);Nt(()=>(M.current=!0,()=>{M.current=!1}),[]),Nt(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(D.current)return D.current(b,x,A);A()}},[b,x,A,D,T]);let N=E.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),P=E.useMemo(()=>({reference:b,floating:x}),[b,x]),F=E.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=It(P.floating,u.x),r=It(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Ft(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,u.x,u.y]);return E.useMemo(()=>({...u,update:A,refs:N,elements:P,floatingStyles:F}),[u,A,N,P,F])}var zt=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?{}:At({element:r.current,padding:i}).fn(n):r?At({element:r,padding:i}).fn(n):{}}}},Bt=(e,t)=>{let n=Tt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vt=(e,t)=>{let n=Et(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ht=(e,t)=>({fn:jt(e).fn,options:[e,t]}),Ut=(e,t)=>{let n=Dt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wt=(e,t)=>{let n=Ot(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gt=(e,t)=>{let n=kt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kt=(e,t)=>{let n=zt(e);return{name:n.name,fn:n.fn,options:[e,t]}},qt=`Arrow`,Jt=E.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,D.jsx)(y.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,D.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Jt.displayName=qt;var Yt=Jt,Xt=`Popper`,[Zt,Qt]=s(Xt),[$t,en]=Zt(Xt),tn=e=>{let{__scopePopper:t,children:n}=e,[r,i]=E.useState(null),[a,o]=E.useState(void 0);return(0,D.jsx)($t,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};tn.displayName=Xt;var nn=`PopperAnchor`,rn=E.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...a}=e,o=en(nn,n),s=E.useRef(null),c=o.onAnchorChange,l=i(t,E.useCallback(e=>{s.current=e,e&&c(e)},[c])),u=E.useRef(null);E.useEffect(()=>{if(!r)return;let e=u.current;u.current=r.current,e!==u.current&&c(u.current)});let d=o.placementState&&mn(o.placementState),f=d?.[0],p=d?.[1];return r?null:(0,D.jsx)(y.div,{"data-radix-popper-side":f,"data-radix-popper-align":p,...a,ref:l})});rn.displayName=nn;var an=`PopperContent`,[on,sn]=Zt(an),cn=E.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,arrowPadding:c=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f=`partial`,hideWhenDetached:p=!1,updatePositionStrategy:h=`optimized`,onPlaced:g,...v}=e,b=en(an,n),[x,S]=E.useState(null),C=i(t,S),[w,T]=E.useState(null),O=M(w),k=O?.width??0,A=O?.height??0,j=r+(o===`center`?``:`-`+o),N=typeof d==`number`?d:{top:0,right:0,bottom:0,left:0,...d},P=Array.isArray(u)?u:[u],F=P.length>0,I={padding:N,boundary:P.filter(fn),altBoundary:F},{refs:L,floatingStyles:R,placement:ee,isPositioned:te,middlewareData:z}=Rt({strategy:`fixed`,placement:j,whileElementsMounted:(...e)=>wt(...e,{animationFrame:h===`always`}),elements:{reference:b.anchor},middleware:[Bt({mainAxis:a+A,alignmentAxis:s}),l&&Vt({mainAxis:!0,crossAxis:!1,limiter:f===`partial`?Ht():void 0,...I}),l&&Ut({...I}),Wt({...I,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`)}}),w&&Kt({element:w,padding:c}),pn({arrowWidth:k,arrowHeight:A}),p&&Gt({strategy:`referenceHidden`,...I,boundary:F?I.boundary:void 0})]}),B=b.setPlacementState;_(()=>(B(ee),()=>{B(void 0)}),[ee,B]);let[V,ne]=mn(ee),re=m(g);_(()=>{te&&re?.()},[te,re]);let H=z.arrow?.x,ie=z.arrow?.y,ae=z.arrow?.centerOffset!==0,[oe,se]=E.useState();return _(()=>{x&&se(window.getComputedStyle(x).zIndex)},[x]),(0,D.jsx)(`div`,{ref:L.setFloating,"data-radix-popper-content-wrapper":``,style:{...R,transform:te?R.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(` `),...z.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,D.jsx)(on,{scope:n,placedSide:V,placedAlign:ne,onArrowChange:T,arrowX:H,arrowY:ie,shouldHideArrow:ae,children:(0,D.jsx)(y.div,{"data-side":V,"data-align":ne,...v,ref:C,style:{...v.style,animation:te?void 0:`none`}})})})});cn.displayName=an;var ln=`PopperArrow`,un={top:`bottom`,right:`left`,bottom:`top`,left:`right`},dn=E.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=sn(ln,n),a=un[i.placedSide];return(0,D.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,D.jsx)(Yt,{...r,ref:t,style:{...r.style,display:`block`}})})});dn.displayName=ln;function fn(e){return e!==null}var pn=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]=mn(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 mn(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var hn=tn,gn=rn,_n=cn,vn=dn,yn=!1;function bn(){let[e,t]=E.useState(yn);return E.useEffect(()=>{yn||(yn=!0,t(!0))},[]),e}var xn=E.useSyncExternalStore;function Sn(){return()=>{}}function Cn(){return xn(Sn,()=>!0,()=>!1)}var wn=typeof xn==`function`?Cn:bn,Tn=`rovingFocusGroup.onEntryFocus`,En={bubbles:!1,cancelable:!0},Dn=`RovingFocusGroup`,[On,kn,An]=O(Dn),[jn,Mn]=s(Dn,[An]),[Nn,Pn]=jn(Dn),Fn=E.forwardRef((e,t)=>(0,D.jsx)(On.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,D.jsx)(On.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,D.jsx)(In,{...e,ref:t})})}));Fn.displayName=Dn;var In=E.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:s,currentTabStopId:c,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...p}=e,h=E.useRef(null),g=i(t,h),_=A(s),[v,x]=o({prop:c,defaultProp:l??null,onChange:u,caller:Dn}),[S,C]=E.useState(!1),w=m(d),T=kn(n),O=E.useRef(!1),[k,j]=E.useState(0);return E.useEffect(()=>{let e=h.current;if(e)return e.addEventListener(Tn,w),()=>e.removeEventListener(Tn,w)},[w]),(0,D.jsx)(Nn,{scope:n,orientation:r,dir:_,loop:a,currentTabStopId:v,onItemFocus:E.useCallback(e=>x(e),[x]),onItemShiftTab:E.useCallback(()=>C(!0),[]),onFocusableItemAdd:E.useCallback(()=>j(e=>e+1),[]),onFocusableItemRemove:E.useCallback(()=>j(e=>e-1),[]),children:(0,D.jsx)(y.div,{tabIndex:S||k===0?-1:0,"data-orientation":r,...p,ref:g,style:{outline:`none`,...e.style},onMouseDown:b(e.onMouseDown,()=>{O.current=!0}),onFocus:b(e.onFocus,e=>{let t=!O.current;if(e.target===e.currentTarget&&t&&!S){let t=new CustomEvent(Tn,En);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=T().filter(e=>e.focusable);Hn([e.find(e=>e.active),e.find(e=>e.id===v),...e].filter(Boolean).map(e=>e.ref.current),f)}}O.current=!1}),onBlur:b(e.onBlur,()=>C(!1))})})}),Ln=`RovingFocusGroupItem`,Rn=E.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=f(),l=a||c,u=Pn(Ln,n),d=u.currentTabStopId===l,p=kn(n),{onFocusableItemAdd:m,onFocusableItemRemove:h,currentTabStopId:g}=u,v=wn();return _(()=>{if(!(!v||!r))return m(),()=>h()},[v,r,m,h]),E.useEffect(()=>{if(!(v||!r))return m(),()=>h()},[v,r,m,h]),(0,D.jsx)(On.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,D.jsx)(y.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:b(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:b(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:b(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Vn(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=p().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=u.loop?Un(n,r+1):n.slice(r+1)}setTimeout(()=>Hn(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:g!=null}):o})})});Rn.displayName=Ln;var zn={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Bn(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function Vn(e,t,n){let r=Bn(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return zn[r]}function Hn(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Un(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Wn=Fn,Gn=Rn,Kn=[`Enter`,` `],qn=[`ArrowDown`,`PageUp`,`Home`],Jn=[`ArrowUp`,`PageDown`,`End`],Yn=[...qn,...Jn],Xn={ltr:[...Kn,`ArrowRight`],rtl:[...Kn,`ArrowLeft`]},Zn={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Qn=`Menu`,[$n,er,tr]=O(Qn),[nr,rr]=s(Qn,[tr,Qt,Mn]),ir=Qt(),ar=Mn(),[or,Z]=nr(Qn),[sr,cr]=nr(Qn),lr=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=ir(t),[c,l]=E.useState(null),u=E.useRef(!1),d=m(a),f=A(i);return E.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})}},[]),E.useEffect(()=>{if(!n)return;let e=()=>d(!1);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,D.jsx)(hn,{...s,children:(0,D.jsx)(or,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,D.jsx)(sr,{scope:t,onClose:E.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};lr.displayName=Qn;var ur=`MenuAnchor`,dr=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=ir(n);return(0,D.jsx)(gn,{...i,...r,ref:t})});dr.displayName=ur;var fr=`MenuPortal`,[pr,mr]=nr(fr,{forceMount:void 0}),hr=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Z(fr,t);return(0,D.jsx)(pr,{scope:t,forceMount:n,children:(0,D.jsx)(d,{present:n||a.open,children:(0,D.jsx)(g,{asChild:!0,container:i,children:r})})})};hr.displayName=fr;var Q=`MenuContent`,[gr,_r]=nr(Q),vr=E.forwardRef((e,t)=>{let n=mr(Q,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Z(Q,e.__scopeMenu),o=cr(Q,e.__scopeMenu);return(0,D.jsx)($n.Provider,{scope:e.__scopeMenu,children:(0,D.jsx)(d,{present:r||a.open,children:(0,D.jsx)($n.Slot,{scope:e.__scopeMenu,children:o.modal?(0,D.jsx)(yr,{...i,ref:t}):(0,D.jsx)(br,{...i,ref:t})})})})}),yr=E.forwardRef((e,t)=>{let n=Z(Q,e.__scopeMenu),r=E.useRef(null),a=i(t,r);return E.useEffect(()=>{let e=r.current;if(e)return h(e)},[]),(0,D.jsx)(Sr,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:b(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),br=E.forwardRef((e,t)=>{let n=Z(Q,e.__scopeMenu);return(0,D.jsx)(Sr,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),xr=v(`MenuContent.ScrollLock`),Sr=E.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:d,onEntryFocus:f,onEscapeKeyDown:m,onPointerDownOutside:h,onFocusOutside:g,onInteractOutside:_,onDismiss:v,disableOutsideScroll:y,...x}=e,S=Z(Q,n),C=cr(Q,n),w=ir(n),T=ar(n),O=er(n),[k,A]=E.useState(null),j=E.useRef(null),M=i(t,j,S.onContentChange),N=E.useRef(0),P=E.useRef(``),F=E.useRef(0),I=E.useRef(null),L=E.useRef(`right`),R=E.useRef(0),ee=y?c:E.Fragment,te=y?{as:xr,allowPinchZoom:!0}:void 0,z=e=>{let t=P.current+e,n=O().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=oi(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){P.current=t,window.clearTimeout(N.current),t!==``&&(N.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};E.useEffect(()=>()=>window.clearTimeout(N.current),[]),p();let B=E.useCallback(e=>L.current===I.current?.side&&ci(e,I.current?.area),[]);return(0,D.jsx)(gr,{scope:n,searchRef:P,onItemEnter:E.useCallback(e=>{B(e)&&e.preventDefault()},[B]),onItemLeave:E.useCallback(e=>{B(e)||(j.current?.focus(),A(null))},[B]),onTriggerLeave:E.useCallback(e=>{B(e)&&e.preventDefault()},[B]),pointerGraceTimerRef:F,onPointerGraceIntentChange:E.useCallback(e=>{I.current=e},[]),children:(0,D.jsx)(ee,{...te,children:(0,D.jsx)(l,{asChild:!0,trapped:a,onMountAutoFocus:b(o,e=>{e.preventDefault(),j.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:(0,D.jsx)(u,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:m,onPointerDownOutside:h,onFocusOutside:g,onInteractOutside:_,onDismiss:v,children:(0,D.jsx)(Wn,{asChild:!0,...T,dir:C.dir,orientation:`vertical`,loop:r,currentTabStopId:k,onCurrentTabStopIdChange:A,onEntryFocus:b(f,e=>{C.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,D.jsx)(_n,{role:`menu`,"aria-orientation":`vertical`,"data-state":ti(S.open),"data-radix-menu-content":``,dir:C.dir,...w,...x,ref:M,style:{outline:`none`,...x.style},onKeyDown:b(x.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&&z(e.key));let i=j.current;if(e.target!==i||!Yn.includes(e.key))return;e.preventDefault();let a=O().filter(e=>!e.disabled).map(e=>e.ref.current);Jn.includes(e.key)&&a.reverse(),ii(a)}),onBlur:b(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(N.current),P.current=``)}),onPointerMove:b(e.onPointerMove,li(e=>{let t=e.target,n=R.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>R.current?`right`:`left`;L.current=t,R.current=e.clientX}}))})})})})})})});vr.displayName=Q;var Cr=`MenuGroup`,wr=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,D.jsx)(y.div,{role:`group`,...r,ref:t})});wr.displayName=Cr;var Tr=`MenuLabel`,Er=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,D.jsx)(y.div,{...r,ref:t})});Er.displayName=Tr;var Dr=`MenuItem`,Or=`menu.itemSelect`,kr=E.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...o}=e,s=E.useRef(null),c=cr(Dr,e.__scopeMenu),l=_r(Dr,e.__scopeMenu),u=i(t,s),d=E.useRef(!1),f=()=>{let e=s.current;if(!n&&e){let t=new CustomEvent(Or,{bubbles:!0,cancelable:!0});e.addEventListener(Or,e=>r?.(e),{once:!0}),a(e,t),t.defaultPrevented?d.current=!1:c.onClose()}};return(0,D.jsx)(Ar,{...o,ref:u,disabled:n,onClick:b(e.onClick,f),onPointerDown:t=>{e.onPointerDown?.(t),d.current=!0},onPointerUp:b(e.onPointerUp,e=>{d.current||e.currentTarget?.click()}),onKeyDown:b(e.onKeyDown,e=>{n||e.target!==e.currentTarget||l.searchRef.current!==``&&e.key===` `||Kn.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});kr.displayName=Dr;var Ar=E.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:a,...o}=e,s=_r(Dr,n),c=ar(n),l=E.useRef(null),u=i(t,l),[d,f]=E.useState(!1),[p,m]=E.useState(``);return E.useEffect(()=>{let e=l.current;e&&m((e.textContent??``).trim())},[o.children]),(0,D.jsx)($n.ItemSlot,{scope:n,disabled:r,textValue:a??p,children:(0,D.jsx)(Gn,{asChild:!0,...c,focusable:!r,children:(0,D.jsx)(y.div,{role:`menuitem`,"data-highlighted":d?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...o,ref:u,onPointerMove:b(e.onPointerMove,li(e=>{r?s.onItemLeave(e):(s.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:b(e.onPointerLeave,li(e=>s.onItemLeave(e))),onFocus:b(e.onFocus,()=>f(!0)),onBlur:b(e.onBlur,()=>f(!1))})})})}),jr=`MenuCheckboxItem`,Mr=E.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,D.jsx)(Br,{scope:e.__scopeMenu,checked:n,children:(0,D.jsx)(kr,{role:`menuitemcheckbox`,"aria-checked":ni(n)?`mixed`:n,...i,ref:t,"data-state":ri(n),onSelect:b(i.onSelect,()=>r?.(ni(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Mr.displayName=jr;var Nr=`MenuRadioGroup`,[Pr,Fr]=nr(Nr,{value:void 0,onValueChange:()=>{}}),Ir=E.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=m(r);return(0,D.jsx)(Pr,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,D.jsx)(wr,{...i,ref:t})})});Ir.displayName=Nr;var Lr=`MenuRadioItem`,Rr=E.forwardRef((e,t)=>{let{value:n,...r}=e,i=Fr(Lr,e.__scopeMenu),a=n===i.value;return(0,D.jsx)(Br,{scope:e.__scopeMenu,checked:a,children:(0,D.jsx)(kr,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":ri(a),onSelect:b(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Rr.displayName=Lr;var zr=`MenuItemIndicator`,[Br,Vr]=nr(zr,{checked:!1}),Hr=E.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Vr(zr,n);return(0,D.jsx)(d,{present:r||ni(a.checked)||a.checked===!0,children:(0,D.jsx)(y.span,{...i,ref:t,"data-state":ri(a.checked)})})});Hr.displayName=zr;var Ur=`MenuSeparator`,Wr=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,D.jsx)(y.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Wr.displayName=Ur;var Gr=`MenuArrow`,Kr=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=ir(n);return(0,D.jsx)(vn,{...i,...r,ref:t})});Kr.displayName=Gr;var qr=`MenuSub`,[Jr,Yr]=nr(qr),Xr=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Z(qr,t),o=ir(t),[s,c]=E.useState(null),[l,u]=E.useState(null),d=m(i);return E.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,D.jsx)(hn,{...o,children:(0,D.jsx)(or,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,D.jsx)(Jr,{scope:t,contentId:f(),triggerId:f(),trigger:s,onTriggerChange:c,children:n})})})};Xr.displayName=qr;var Zr=`MenuSubTrigger`,Qr=E.forwardRef((e,t)=>{let n=Z(Zr,e.__scopeMenu),r=cr(Zr,e.__scopeMenu),a=Yr(Zr,e.__scopeMenu),o=_r(Zr,e.__scopeMenu),s=E.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:l}=o,u={__scopeMenu:e.__scopeMenu},d=E.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);E.useEffect(()=>d,[d]),E.useEffect(()=>{let e=c.current;return()=>{window.clearTimeout(e),l(null)}},[c,l]);let f=i(t,a.onTriggerChange);return(0,D.jsx)(dr,{asChild:!0,...u,children:(0,D.jsx)(Ar,{id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?a.contentId:void 0,"data-state":ti(n.open),...e,ref:f,onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:b(e.onPointerMove,li(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:b(e.onPointerLeave,li(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:b(e.onKeyDown,t=>{e.disabled||t.target!==t.currentTarget||o.searchRef.current!==``&&t.key===` `||Xn[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Qr.displayName=Zr;var $r=`MenuSubContent`,ei=E.forwardRef((e,t)=>{let n=mr(Q,e.__scopeMenu),{forceMount:r=n.forceMount,align:a=`start`,...o}=e,s=Z(Q,e.__scopeMenu),c=cr(Q,e.__scopeMenu),l=Yr($r,e.__scopeMenu),u=E.useRef(null),f=i(t,u);return(0,D.jsx)($n.Provider,{scope:e.__scopeMenu,children:(0,D.jsx)(d,{present:r||s.open,children:(0,D.jsx)($n.Slot,{scope:e.__scopeMenu,children:(0,D.jsx)(Sr,{id:l.contentId,"aria-labelledby":l.triggerId,...o,ref:f,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:b(e.onFocusOutside,e=>{e.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:b(e.onEscapeKeyDown,e=>{c.onClose(),e.preventDefault()}),onKeyDown:b(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Zn[c.dir].includes(e.key);t&&n&&(s.onOpenChange(!1),l.trigger?.focus(),e.preventDefault())})})})})})});ei.displayName=$r;function ti(e){return e?`open`:`closed`}function ni(e){return e===`indeterminate`}function ri(e){return ni(e)?`indeterminate`:e?`checked`:`unchecked`}function ii(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function ai(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function oi(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=ai(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 si(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 ci(e,t){return t?si({x:e.clientX,y:e.clientY},t):!1}function li(e){return t=>t.pointerType===`mouse`?e(t):void 0}var ui=lr,di=dr,fi=hr,pi=vr,mi=wr,hi=Er,gi=kr,_i=Mr,vi=Ir,yi=Rr,bi=Hr,xi=Wr,Si=Kr,Ci=Qr,wi=ei,Ti=`DropdownMenu`,[Ei,Di]=s(Ti,[rr]),$=rr(),[Oi,ki]=Ei(Ti),Ai=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:s,modal:c=!0}=e,l=$(t),u=E.useRef(null),[d,p]=o({prop:i,defaultProp:a??!1,onChange:s,caller:Ti});return(0,D.jsx)(Oi,{scope:t,triggerId:f(),triggerRef:u,contentId:f(),open:d,onOpenChange:p,onOpenToggle:E.useCallback(()=>p(e=>!e),[p]),modal:c,children:(0,D.jsx)(ui,{...l,open:d,onOpenChange:p,dir:r,modal:c,children:n})})};Ai.displayName=Ti;var ji=`DropdownMenuTrigger`,Mi=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...a}=e,o=ki(ji,n),s=$(n),c=i(t,o.triggerRef);return(0,D.jsx)(di,{asChild:!0,...s,children:(0,D.jsx)(y.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":r?``:void 0,disabled:r,...a,ref:c,onPointerDown:b(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(o.onOpenToggle(),o.open||e.preventDefault())}),onKeyDown:b(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&o.onOpenToggle(),e.key===`ArrowDown`&&o.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Mi.displayName=ji;var Ni=`DropdownMenuPortal`,Pi=e=>{let{__scopeDropdownMenu:t,...n}=e,r=$(t);return(0,D.jsx)(fi,{...r,...n})};Pi.displayName=Ni;var Fi=`DropdownMenuContent`,Ii=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ki(Fi,n),a=$(n),o=E.useRef(!1);return(0,D.jsx)(pi,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:b(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:b(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)`}})});Ii.displayName=Fi;var Li=`DropdownMenuGroup`,Ri=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(mi,{...i,...r,ref:t})});Ri.displayName=Li;var zi=`DropdownMenuLabel`,Bi=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(hi,{...i,...r,ref:t})});Bi.displayName=zi;var Vi=`DropdownMenuItem`,Hi=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(gi,{...i,...r,ref:t})});Hi.displayName=Vi;var Ui=`DropdownMenuCheckboxItem`,Wi=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(_i,{...i,...r,ref:t})});Wi.displayName=Ui;var Gi=`DropdownMenuRadioGroup`,Ki=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(vi,{...i,...r,ref:t})});Ki.displayName=Gi;var qi=`DropdownMenuRadioItem`,Ji=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(yi,{...i,...r,ref:t})});Ji.displayName=qi;var Yi=`DropdownMenuItemIndicator`,Xi=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(bi,{...i,...r,ref:t})});Xi.displayName=Yi;var Zi=`DropdownMenuSeparator`,Qi=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(xi,{...i,...r,ref:t})});Qi.displayName=Zi;var $i=`DropdownMenuArrow`,ea=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(Si,{...i,...r,ref:t})});ea.displayName=$i;var ta=`DropdownMenuSubTrigger`,na=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(Ci,{...i,...r,ref:t})});na.displayName=ta;var ra=`DropdownMenuSubContent`,ia=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,D.jsx)(wi,{...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)`}})});ia.displayName=ra;var aa=Ai,oa=Mi,sa=Pi,ca=Ii,la=Bi,ua=Hi,da=Ki,fa=Ji,pa=Xi,ma=Qi;function ha({...e}){return(0,D.jsx)(aa,{"data-slot":`dropdown-menu`,...e})}function ga({...e}){return(0,D.jsx)(oa,{"data-slot":`dropdown-menu-trigger`,...e})}function _a({className:e,sideOffset:t=4,...n}){return(0,D.jsx)(sa,{children:(0,D.jsx)(ca,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:S(`z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] 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 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...n})})}function va({className:e,inset:t,variant:n=`default`,...r}){return(0,D.jsx)(ua,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:S(`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]:pl-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 ya({...e}){return(0,D.jsx)(da,{"data-slot":`dropdown-menu-radio-group`,...e})}function ba({className:e,children:t,...n}){return(0,D.jsxs)(fa,{"data-slot":`dropdown-menu-radio-item`,className:S(`relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-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,D.jsx)(`span`,{className:`pointer-events-none absolute left-2 flex size-3.5 items-center justify-center`,children:(0,D.jsx)(pa,{children:(0,D.jsx)(C,{className:`size-2 fill-current`})})}),t]})}function xa({className:e,inset:t,...n}){return(0,D.jsx)(la,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:S(`px-2 py-1.5 text-sm font-medium data-[inset]:pl-8`,e),...n})}function Sa({className:e,...t}){return(0,D.jsx)(ma,{"data-slot":`dropdown-menu-separator`,className:S(`-mx-1 my-1 h-px bg-border`,e),...t})}export{M as _,ya as a,w as b,ga as c,Mn as d,gn as f,Qt as g,hn as h,xa as i,Gn as l,_n as m,_a as n,ba as o,vn as p,va as r,Sa as s,ha as t,Wn as u,A as v,C as x,T as y};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Lt as r,V as i,_n as a,a as o,bn as s,ct as c,dt as l,ht as u,i as d,kr as f,wn as p,xn as m}from"./centered-state-Djgly6Ni.js";import{n as h,r as g,t as _}from"./utils--z9hRtl3.js";import{S as v,b as y,h as b,m as x,p as S,v as C,x as w}from"./new-task-form-1r2bgsdD.js";import{b as T,c as E,n as D,r as ee,s as te,t as ne,y as re}from"./dropdown-menu-CEQziH7X.js";import{t as ie}from"./folder-CldgbZ5A.js";import{t as ae}from"./sparkles-CP8QDOgX.js";import{t as oe}from"./square-terminal-CGypshSD.js";import{t as se}from"./triangle-alert-xBya8FUp.js";import{c as ce}from"./pill-q-x22_ej.js";var le=g(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),ue=g(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),de=g(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),O=g(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),fe=g(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),pe=g(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),k=g(`circle-slash`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),me=g(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),A=g(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),he=g(`diamond`,[[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z`,key:`1f1r0c`}]]),ge=g(`feather`,[[`path`,{d:`M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z`,key:`18jl4k`}],[`path`,{d:`M16 8 2 22`,key:`vp34q`}],[`path`,{d:`M17.5 15H9`,key:`1oz8nu`}]]),_e=g(`gem`,[[`path`,{d:`M10.5 3 8 9l4 13 4-13-2.5-6`,key:`b3dvk1`}],[`path`,{d:`M17 3a2 2 0 0 1 1.6.8l3 4a2 2 0 0 1 .013 2.382l-7.99 10.986a2 2 0 0 1-3.247 0l-7.99-10.986A2 2 0 0 1 2.4 7.8l2.998-3.997A2 2 0 0 1 7 3z`,key:`7w4byz`}],[`path`,{d:`M2 9h20`,key:`16fsjt`}]]),ve=g(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),ye=g(`git-pull-request-closed`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 9v12`,key:`1sc30k`}],[`path`,{d:`m21 3-6 6`,key:`16nqsk`}],[`path`,{d:`m21 9-6-6`,key:`9j17rh`}],[`path`,{d:`M18 11.5V15`,key:`65xf6f`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),be=g(`git-pull-request-draft`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M18 6V5`,key:`1oao2s`}],[`path`,{d:`M18 11v-1`,key:`11c8tz`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),j=g(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),xe=g(`hammer`,[[`path`,{d:`m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9`,key:`1hayfq`}],[`path`,{d:`m18 15 4-4`,key:`16gjal`}],[`path`,{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`,key:`15ts47`}]]),Se=g(`hexagon`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]),Ce=g(`message-square-warning`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 15h.01`,key:`q59x07`}],[`path`,{d:`M12 7v4`,key:`xawao1`}]]),we=g(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),Te=g(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Ee=g(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),De=g(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),Oe=g(`shapes`,[[`path`,{d:`M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z`,key:`1bo67w`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`3.5`,key:`w3z12y`}]]),ke=g(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Ae=g(`waves-horizontal`,[[`path`,{d:`M2 12q2.5 2 5 0t5 0 5 0 5 0`,key:`8ddzzs`}],[`path`,{d:`M2 19q2.5 2 5 0t5 0 5 0 5 0`,key:`1wj4st`}],[`path`,{d:`M2 5q2.5 2 5 0t5 0 5 0 5 0`,key:`69x50u`}]]),M=e(t(),1),N=n(),je=[`done`,`failed`,`cancelled`],Me=[`done`,`failed`];function P(e){return e.status===`failed`&&e.autoResumeAt!==void 0}function Ne(e){return je.includes(e)}function F(e){return e.archived||P(e)||!Me.includes(e.status)?!1:e.finishedAt!==void 0}function I(e){let t=e.finishedAt;return t===void 0||!F(e)?!1:e.seenAt===void 0||e.seenAt<t}function Pe(e){return!P(e)&&Ne(e.status)&&!I(e)}function Fe(e){return e.reduce((e,t)=>I(t)?e+1:e,0)}var L={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,pi:`pi`};function Ie(e,t=0){let n=t>1?t-1:0;return n>0?`${L[e]} +${n}`:L[e]}function Le(e){return e?{text:e,auto:!1}:{text:`auto`,auto:!0}}function Re(e){let t=new Set;for(let n of e)n.backend&&t.add(n.backend);return t.size}function ze(e,t,n){if(e)return{runner:e,inherited:!1};for(let e=t.length-1;e>=0;--e){let n=t[e]?.backend;if(n)return{runner:n,inherited:!1}}return{runner:n??`claude`,inherited:!0}}var R=(0,M.createContext)(null);function Be({children:e}){let[t,n]=(0,M.useState)(()=>new Map),r=(0,M.useCallback)((e,t)=>{n(n=>{let r=new Map(n);return r.set(e,t),r})},[]),i=(0,M.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),a=u((0,M.useMemo)(()=>[...t.values()].flat(),[t])),o=(0,M.useMemo)(()=>({publish:r,retract:i,lookup:a}),[r,i,a]);return(0,N.jsx)(R.Provider,{value:o,children:e})}var z=(0,M.createContext)(null);function Ve({projectId:e,requests:t,children:n}){let r=(0,M.useContext)(R),i=(0,M.useId)();(0,M.useEffect)(()=>{if(r)return r.publish(i,t),()=>r.retract(i)},[r,i,t.map(e=>`${e.projectId} ${e.kind}#${e.number}`).sort().join(`|`)]);let a=u(r?He:t),o=r?.lookup??a,s=(0,M.useMemo)(()=>({lookup:o,projectId:e}),[o,e]);return(0,N.jsx)(z.Provider,{value:s,children:n})}var He=[];function Ue(e,t,n){let r=(0,M.useContext)(z),i=n??r?.projectId;return!r||!i||t===void 0?We:r.lookup({projectId:i,kind:e,number:t})}var We=Object.freeze({state:`idle`}),Ge={success:`border-success/40 text-success`,danger:`border-danger/40 text-danger`,violet:`border-violet/35 text-violet`,info:`border-info/40 text-info`,neutral:`border-border text-muted-foreground`,pending:`border-pending-strong/45 text-pending-strong`,conflict:`border-conflict/45 text-conflict`},Ke={success:`hover:bg-success/10`,danger:`hover:bg-danger/10`,violet:`hover:bg-violet/10`,info:`hover:bg-info/10`,neutral:`hover:bg-muted`,pending:`hover:bg-pending-strong/10`,conflict:`hover:bg-conflict/10`},qe={draft:be,"review-required":re,"changes-requested":Ce,"checks-pending":null,"checks-failing":y,ready:v,merged:ve,closed:ye,open:w,completed:v,"not-planned":k};function B({reference:e,taskTitle:t,status:n,conflicting:r,conflictAction:i,projectId:a,className:o,compact:c=!1}){let{kind:l,number:u,url:d}=e,f=Ue(l,u,a),p=n??f.status,g=m(p),v=l===`PR`&&(r??f.conflicting)===!0,y=v?s:g,b=_(`inline-flex h-[22px] items-center gap-1 rounded-full border px-2 font-mono text-[11px] font-semibold`,Ge[y?.tone??`violet`],o),x=Ze(f,y,v?g:void 0),S=u?`${!c&&l===`Issue`?`Issue `:``}#${u}`:l,C=l===`PR`?`pull request`:`issue`,w=`Open the ${C} for ${t}${y?` — ${y.label}`:``}`,T=(0,N.jsxs)(N.Fragment,{children:[v?(0,N.jsx)(se,{className:`size-2.5 shrink-0`,"aria-hidden":`true`}):(0,N.jsx)($e,{status:y?p:void 0}),S]}),E=!d||!h(d)?(0,N.jsx)(`span`,{"data-slot":l===`PR`?`pr-chip`:`issue-chip`,"data-status":p,...v?{"data-conflicting":`true`}:{},"aria-label":y?`${C} ${S} — ${y.label}`:void 0,className:b,children:T}):(0,N.jsxs)(`a`,{"data-slot":l===`PR`?`pr-chip`:`issue-chip`,"data-status":p,...v?{"data-conflicting":`true`}:{},href:d,target:`_blank`,rel:`noopener noreferrer`,title:x?void 0:d,"aria-label":w,className:_(b,Ke[y?.tone??`violet`]),children:[T,(0,N.jsx)(de,{className:`size-2.5`,"aria-hidden":`true`})]});if(!x)return E;let D=(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`span`,{className:`block font-medium`,children:[l===`PR`?`Pull request`:`Issue`,u?` #${u}`:``,` · `,x.headline]}),(0,N.jsx)(`span`,{className:`block`,children:x.detail}),x.also?(0,N.jsx)(`span`,{className:`block opacity-70`,children:x.also}):null,d&&h(d)?(0,N.jsx)(`span`,{className:`block opacity-70`,children:d.replace(/^https?:\/\//,``)}):null]});return(0,N.jsx)(Xe,{chip:E,action:v?i:void 0,state:f.state,children:D})}var V=(0,M.createContext)(()=>{});function Je(){return(0,M.useContext)(V)}var Ye=150,H=120;function Xe({chip:e,action:t,state:n,children:r}){let[i,a]=(0,M.useState)(!1),o=(0,M.useRef)(null),s=(0,M.useRef)(null),c=(0,M.useRef)(void 0),l=(0,M.useCallback)((e,t)=>{clearTimeout(c.current),c.current=setTimeout(()=>a(e),t)},[]),u=(0,M.useCallback)(()=>{clearTimeout(c.current),a(!1)},[]);(0,M.useEffect)(()=>()=>clearTimeout(c.current),[]);let d=e=>e instanceof Node&&(s.current?.contains(e)||o.current?.contains(e));return(0,N.jsxs)(S,{open:i,onOpenChange:e=>e?a(!0):u(),children:[(0,N.jsx)(x,{asChild:!0,ref:o,onPointerEnter:e=>{e.pointerType!==`touch`&&l(!0,Ye)},onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,H)},onFocus:()=>a(!0),onBlur:e=>{d(e.relatedTarget)||u()},onKeyDown:e=>{if(e.key===`Escape`)return u();if(e.key!==`Tab`||e.shiftKey||!t)return;let n=s.current?.querySelector(`button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);n&&(e.preventDefault(),n.focus())},...t?{"aria-haspopup":`dialog`,"aria-expanded":i}:{},children:e}),(0,N.jsxs)(b,{ref:s,side:`top`,role:t?`dialog`:`tooltip`,"data-slot":`reference-status-card`,"data-tooltip-state":n,className:`w-64 space-y-2 p-3 text-xs`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),d(document.activeElement)&&o.current?.focus()},onPointerEnter:()=>clearTimeout(c.current),onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,H)},children:[(0,N.jsx)(`div`,{className:`space-y-0.5`,children:r}),t?(0,N.jsx)(V.Provider,{value:u,children:t}):null]})]})}function Ze(e,t,n){if(t){let{label:r,hint:i}=t,a=n?`also ${Qe(n.label)} — ${n.hint}`:void 0;return e.state===`unavailable`?{headline:r,detail:`last known — GitHub is unreachable${e.reason?` (${e.reason})`:``}`,...a?{also:a}:{}}:{headline:r,detail:i,...a?{also:a}:{}}}switch(e.state){case`loading`:return{headline:`Checking GitHub…`,detail:`the status of this reference is on its way`};case`unavailable`:return{headline:`Status unavailable`,detail:e.reason??`GitHub could not be reached — the chip says nothing rather than guessing`};case`unknown`:return{headline:`Not found on this repository`,detail:`GitHub has no such number here — the reference may point at another repo`};default:return null}}function Qe(e){return e.charAt(0).toLowerCase()+e.slice(1)}function $e({status:e}){if(!e)return null;if(e===`checks-pending`)return(0,N.jsx)(ce,{tone:`pending`,pulse:!0,className:`size-[6px]`,"aria-hidden":`true`});let t=qe[e];return t?(0,N.jsx)(t,{className:`size-2.5 shrink-0`,"aria-hidden":`true`}):null}function U(e){let t=e.currentStepId?e.steps.find(t=>t.id===e.currentStepId):void 0;if(t?.backend)return t.backend;if(e.runner)return e.runner;for(let t=e.steps.length-1;t>=0;--t){let n=e.steps[t]?.backend;if(n)return n}return`claude`}function W(e){return e.runner??`claude`}function G(e,t){let n=f(t,e);return n?.enabled===!1?{provider:e,usable:!1,reason:`${L[e]} is disabled. Enable it in Settings → Agents → Providers.`}:n?.status===`connected`?{provider:e,usable:!0}:{provider:e,usable:!1,reason:`${L[e]} credentials are unavailable. Authorize it in Settings → Agents → Providers.`}}function et(e,t){return G(U(e),t)}function tt(e,t){return G(W(e),t)}function K(e){let t=l(),n=U(e);return t.isSuccess&&t.data?et(e,t.data):{provider:n,usable:!0}}function nt(e){let t=l(),n=W(e);return t.isSuccess&&t.data?tt(e,t.data):t.isError?{provider:n,usable:!1,reason:`Provider authentication could not be verified.`}:{provider:n,usable:!1,reason:`Checking agent providers…`}}var rt={folder:ie,terminal:oe,vscode:me,cursor:we,zed:C,windsurf:Ae,sublime:ge,idea:he,pycharm:Se,webstorm:j,goland:Oe,rubymine:_e,phpstorm:pe,clion:A,rider:fe,"android-studio":ke,xcode:xe,warp:De,claude:O,codex:ae,opencode:O,pi:O};function it(e){return e.icon&&rt[e.icon]||T}function q(e){let t=/^cli:(claude|codex|opencode|pi)$/.exec(e);return t?t[1]:void 0}function at({choices:e,onPick:t,label:n=`Open in…`,title:r,triggerVariant:i=`ghost`,disabled:a=!1,leading:s,trailing:c,slot:l}){return(0,N.jsxs)(ne,{children:[(0,N.jsx)(E,{asChild:!0,children:(0,N.jsxs)(o,{variant:i,size:`sm`,title:r,disabled:a,"data-slot":l,children:[(0,N.jsx)(T,{"aria-hidden":`true`}),n]})}),(0,N.jsxs)(D,{align:`end`,children:[s,s&&e.length>0?(0,N.jsx)(te,{}):null,e.map(({target:e,suffix:n,title:r})=>{let i=it(e);return(0,N.jsxs)(ee,{"data-target":e.id,title:r,onSelect:()=>t(e.id),children:[(0,N.jsx)(i,{"aria-hidden":`true`}),e.label,n??``]},e.id)}),c]})]})}function J(e){return e===`running`||e===`queued`||e===`waiting`}function Y(e){return[...e.steps].reverse().find(e=>e.sessionId)?.sessionId}var ot=/^[A-Za-z0-9._][A-Za-z0-9._-]{0,199}$/;function st(e,t){if(ot.test(t))switch(e){case`codex`:return`codex resume ${t}`;case`opencode`:return`opencode --session ${t}`;default:return`claude --resume ${t}`}}function ct(e){if(J(e.status))return;let t=Y(e);if(t===void 0)return;let n=st(e.runner,t);if(n!==void 0)return e.worktreePath?`cd ${e.worktreePath} && ${n}`:n}function lt(e,t){let n=q(t);return!n||J(e.status)?!1:n===(e.runner??`claude`)&&Y(e)!==void 0}function X(e){let t=J(e.status),n=Y(e)!==void 0;return{finish:e.status===`waiting`||e.status===`review`,continueRun:!t&&n,terminal:!t&&n,notes:!0,archive:!t,pin:!e.archived,markUnread:F(e)&&!I(e),cancel:t,deleteRun:!t}}function ut(e){return`Merge head branch and resolve conflicts in ${e?`PR number ${e}`:`this pull request`}`}function dt(e){return e===`review`?`Accept the changes without a PR`:`Close the session`}function ft(e,t){let n=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt)).findIndex(e=>e.id===t);return n>=0?n+1:void 0}var pt=[50,100,200,400,800,1e3,1e3,1e3,1e3],mt=e=>new Promise(t=>setTimeout(t,e));function ht(e){return e instanceof p&&e.status===409&&e.message===`run is still active`}async function Z(e,t=mt){for(let n=0;;n+=1)try{return await e()}catch(e){let r=pt[n];if(!ht(e)||r===void 0)throw e;await t(r)}}function gt(e){return J(e.status)?`live`:X(e).continueRun?`resume`:`unavailable`}function Q(e,t){let n=r(e.id,t),a=i(e.id,t),o=K(e),s=nt(e),[c,l]=(0,M.useState)(void 0),[u,d]=(0,M.useState)(!1),f=(0,M.useRef)(!1),m=gt(e),h=m===`resume`?!s.usable:m===`live`&&!o.usable,g=m===`unavailable`?`no-session`:h?`provider`:void 0,_=g===`no-session`?`This session has ended and no agent session was recorded, so the answer cannot be delivered.`:g===`provider`?m===`resume`?s.reason:o.reason:void 0,v=e=>s.usable?a.mutateAsync({text:e}):Promise.reject(Error(s.reason??`The run provider is unavailable.`));return{mode:m,blockedBy:g,reason:_,isPending:u||n.isPending||a.isPending,error:c,send:async t=>{if(g||f.current)return _;f.current=!0,d(!0),l(void 0);try{if(m===`resume`){await Z(()=>v(t));return}try{await n.mutateAsync({text:t})}catch(n){if(n instanceof p&&n.status===409&&Y(e)!==void 0){await Z(()=>v(t));return}throw n}return}catch(e){let t=e instanceof Error?e.message:String(e);return l(t),t}finally{f.current=!1,d(!1)}}}}function $({run:e,projectId:t,prNumber:n}){let r=Q(e,t),i=Je(),[a,s]=(0,M.useState)(!1),c=a||r.isPending,l=!!r.blockedBy,u=async()=>{if(c||l)return;let e=r.mode===`resume`;s(!0);try{let t=await r.send(ut(n));t?d(t,{tone:`danger`}):(d(`${e?`Task reopened`:`Sent to the task`} — resolving conflicts${n?` in PR #${n}`:``}`),i())}finally{s(!1)}};return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(o,{type:`button`,size:`sm`,"data-slot":`reference-conflict-action`,disabled:l||c,onClick:()=>void u(),className:`h-7 w-full text-xs`,children:c?`Sending…`:`Resolve conflicts`}),l&&r.reason?(0,N.jsx)(`span`,{className:`block opacity-70`,children:r.reason}):null]})}function _t({projectId:e,runId:t,prNumber:n}){let r=c(e,t);return r.data?(0,N.jsx)($,{run:r.data,projectId:e,prNumber:n}):(0,N.jsx)(o,{type:`button`,size:`sm`,disabled:!0,className:`h-7 w-full text-xs`,children:r.isError?`Unavailable`:`Loading…`})}function vt({run:e,reference:t,className:n,compact:r=!1}){return(0,N.jsx)(B,{reference:t,taskTitle:a(e),conflictAction:(0,N.jsx)($,{run:e,prNumber:t.number}),className:n,compact:r})}function yt(e,t){let[n,r]=(0,M.useState)(!1),[i,a]=(0,M.useState)(``),o=(0,M.useRef)(!1);return{editing:n,draft:i,setDraft:a,begin:()=>{a(e),o.current=!1,r(!0)},commit:()=>{if(o.current)return;o.current=!0,r(!1);let n=i.trim();n.length===0||n===e||t(n)},cancel:()=>{o.current=!0,r(!1)}}}function bt({editor:e,className:t}){return(0,N.jsx)(`input`,{"data-slot":`title-input`,"aria-label":`Task title`,autoFocus:!0,value:e.draft,onChange:t=>e.setDraft(t.target.value),onBlur:e.commit,onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),e.commit()):t.key===`Escape`&&(t.preventDefault(),e.cancel())},className:_(`w-full min-w-0 rounded-sm border border-border bg-card px-1.5 py-0.5 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,t)})}export{Te as A,Re as C,I as D,Pe as E,ue as F,le as I,A as M,k as N,Fe as O,O as P,Ie as S,F as T,B as _,vt as a,L as b,dt as c,ft as d,ct as f,K as g,q as h,_t as i,j,Ee as k,J as l,at as m,yt as n,Q as o,X as p,$ as r,lt as s,bt as t,Y as u,Ve as v,ze as w,Le as x,Be as y};
@@ -1 +1 @@
1
- import{r as e}from"./utils-Bb8ohcr3.js";var t=e(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]);export{t};
1
+ import{r as e}from"./utils--z9hRtl3.js";var t=e(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]);export{t};
@@ -1 +1 @@
1
- import{r as e}from"./utils-Bb8ohcr3.js";var t=e(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]);export{t};
1
+ import{r as e}from"./utils--z9hRtl3.js";var t=e(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]);export{t};
@@ -1 +1 @@
1
- import{r as e}from"./utils-Bb8ohcr3.js";var t=e(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]);export{t};
1
+ import{r as e}from"./utils--z9hRtl3.js";var t=e(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]);export{t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{a as r}from"./centered-state-B_V_Ai2h.js";import{n as i,t as a}from"./utils-Bb8ohcr3.js";import{t as o}from"./chevron-right-CFzn-von.js";import{b as s,c,n as l,r as u,t as d,y as f}from"./dropdown-menu-Z80KMInL.js";import{t as p}from"./ellipsis-vertical-Bmi2u2TG.js";import{t as m}from"./file-DKoYWRsv.js";import{t as h}from"./folder-u01HScRT.js";import{i as g,n as _,r as v}from"./use-desktop-Sr1QlxhT.js";import{t as y}from"./square-terminal-Cf4Og6ct.js";import{t as b}from"./upload-SnwVxKOA.js";import{t as x}from"./diff-stat-btAmKFJr.js";var S=e(t(),1),C=n();function w({root:e,selected:t,onSelect:n}){return(0,C.jsx)(`nav`,{"data-slot":`changes-tree`,"aria-label":`Changed files`,className:`min-w-0 text-[13px]`,children:(0,C.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,C.jsx)(E,{dir:e,depth:0,selected:t,onSelect:n},e.path)),e.files.map(e=>(0,C.jsx)(O,{file:e,depth:0,selected:t,onSelect:n},e.path))]})})}function T({adds:e,dels:t}){return(0,C.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] font-medium tabular-nums`,children:[e>0?(0,C.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}):null,e>0&&t>0?` `:null,t>0?(0,C.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]}):null]})}function E({dir:e,depth:t,selected:n,onSelect:r}){let[i,s]=(0,S.useState)(!0);return(0,C.jsxs)(`li`,{children:[(0,C.jsxs)(`button`,{type:`button`,"data-slot":`tree-dir`,"data-path":e.path,"data-state":i?`open`:`closed`,"aria-expanded":i,onClick:()=>s(e=>!e),className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+t*14}px`},children:[(0,C.jsx)(o,{"aria-hidden":`true`,className:a(`size-3.5 shrink-0 transition-transform`,i&&`rotate-90`)}),(0,C.jsx)(h,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,C.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name}),(0,C.jsx)(T,{adds:e.adds,dels:e.dels})]}),i?(0,C.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,C.jsx)(E,{dir:e,depth:t+1,selected:n,onSelect:r},e.path)),e.files.map(e=>(0,C.jsx)(O,{file:e,depth:t+1,selected:n,onSelect:r},e.path))]}):null]})}var D={added:`text-success`,deleted:`text-danger`};function O({file:e,depth:t,selected:n,onSelect:r}){let i=n===e.path;return(0,C.jsx)(`li`,{children:(0,C.jsxs)(`button`,{type:`button`,"data-slot":`tree-file`,"data-path":e.path,"aria-current":i?`true`:void 0,onClick:()=>r(e.path),className:a(`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,i?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${24+t*14}px`},children:[(0,C.jsx)(m,{"aria-hidden":`true`,className:a(`size-3.5 shrink-0`,D[e.status])}),(0,C.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,C.jsx)(T,{adds:e.adds,dels:e.dels})]})})}function k(e,t){return{kind:`dir`,name:e,path:t,dirs:[],files:[],adds:0,dels:0,fileCount:0}}function A(e){let t=e;for(;t.files.length===0&&t.dirs.length===1;){let e=t.dirs[0];t={...e,name:`${t.name}/${e.name}`}}return{...t,dirs:t.dirs.map(A)}}var j=(e,t)=>e.name.localeCompare(t.name);function M(e){let t=k(``,``),n=new Map([[``,t]]),r=e=>{let t=n.get(e);if(t)return t;let i=e.lastIndexOf(`/`),a=r(i===-1?``:e.slice(0,i)),o=k(i===-1?e:e.slice(i+1),e);return a.dirs.push(o),n.set(e,o),o};for(let t of e){let e=t.path.lastIndexOf(`/`);r(e===-1?``:t.path.slice(0,e)).files.push({kind:`file`,name:e===-1?t.path:t.path.slice(e+1),path:t.path,status:t.status,adds:t.adds,dels:t.dels,binary:t.binary})}let i=e=>{e.dirs.forEach(i),e.adds=e.files.reduce((e,t)=>e+t.adds,0)+e.dirs.reduce((e,t)=>e+t.adds,0),e.dels=e.files.reduce((e,t)=>e+t.dels,0)+e.dirs.reduce((e,t)=>e+t.dels,0),e.fileCount=e.files.length+e.dirs.reduce((e,t)=>e+t.fileCount,0),e.dirs.sort(j),e.files.sort(j)};return i(t),{...t,dirs:t.dirs.map(A)}}function N({bar:e,branch:t,stat:n,mode:i,wrap:a,onModeChange:o,onWrapChange:s,onAction:f}){return(0,C.jsxs)(`div`,{"data-slot":`git-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[t?(0,C.jsx)(_,{branch:t}):null,n?(0,C.jsx)(I,{stat:n}):null,(0,C.jsxs)(`span`,{className:`ml-auto flex items-center gap-1`,children:[(0,C.jsx)(`span`,{className:`hidden items-center gap-1 md:flex`,children:(0,C.jsx)(v,{mode:i,wrap:a,onModeChange:o,onWrapChange:s})}),e.secondary.map(e=>(0,C.jsx)(F,{action:e,variant:`outline`,onAction:f},e.id)),(0,C.jsx)(F,{action:e.primary,variant:`primary`,onAction:f}),e.menu.length>0?(0,C.jsxs)(d,{children:[(0,C.jsx)(c,{asChild:!0,children:(0,C.jsx)(r,{variant:`ghost`,size:`icon-sm`,"aria-label":`More git actions`,children:(0,C.jsx)(p,{"aria-hidden":`true`})})}),(0,C.jsx)(l,{align:`end`,"data-slot":`git-toolbar-menu`,children:e.menu.map(e=>(0,C.jsxs)(u,{disabled:!e.enabled,title:e.reason,onSelect:()=>f(e.id),children:[P[e.id],e.label]},e.id))})]}):null]})]})}var P={commit:(0,C.jsx)(g,{"aria-hidden":`true`}),push:(0,C.jsx)(b,{"aria-hidden":`true`}),"create-pr":(0,C.jsx)(f,{"aria-hidden":`true`}),"view-pr":(0,C.jsx)(s,{"aria-hidden":`true`}),"open-terminal":(0,C.jsx)(y,{"aria-hidden":`true`})};function F({action:e,variant:t,onAction:n}){return e.id===`view-pr`?i(e.href)?(0,C.jsx)(r,{asChild:!0,variant:t,size:`sm`,"data-action":e.id,children:(0,C.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:[P[e.id],e.label]})}):(0,C.jsxs)(r,{variant:t,size:`sm`,"data-action":e.id,disabled:!0,title:`View PR unavailable — the recorded PR link is not an http(s) URL`,children:[P[e.id],e.label]}):(0,C.jsxs)(r,{variant:t,size:`sm`,"data-action":e.id,disabled:!e.enabled,title:e.enabled?void 0:e.reason,onClick:()=>n(e.id),children:[P[e.id],e.label]})}function I({stat:e}){return(0,C.jsx)(`span`,{"data-slot":`changes-stat`,children:(0,C.jsx)(x,{stat:{adds:L(e.adds),dels:L(e.dels),files:e.files}})})}function L(e){let[t,n]=(0,S.useState)(e),r=(0,S.useRef)(e);return(0,S.useEffect)(()=>{let t=r.current;if(t===e)return;if(typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||typeof requestAnimationFrame!=`function`){r.current=e,n(e);return}let i=performance.now(),a=0,o=s=>{let c=Math.min(1,(s-i)/350),l=1-(1-c)**3;n(Math.round(t+(e-t)*l)),c<1?a=requestAnimationFrame(o):r.current=e};return a=requestAnimationFrame(o),()=>{cancelAnimationFrame(a),r.current=e,n(e)}},[e]),t}export{w as i,N as n,M as r,I as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{a as r}from"./centered-state-Djgly6Ni.js";import{n as i,t as a}from"./utils--z9hRtl3.js";import{t as o}from"./chevron-right-Cc9BWnbN.js";import{b as s,c,n as l,r as u,t as d,y as f}from"./dropdown-menu-CEQziH7X.js";import{t as p}from"./ellipsis-vertical-ByVdDc4z.js";import{t as m}from"./file-xBSB5hXO.js";import{t as h}from"./folder-CldgbZ5A.js";import{i as g,n as _,r as v}from"./use-desktop-CPBwzQ7M.js";import{t as y}from"./square-terminal-CGypshSD.js";import{t as b}from"./upload-D6MXEB9p.js";import{t as x}from"./diff-stat-D0mc5V6Z.js";var S=e(t(),1),C=n();function w({root:e,selected:t,onSelect:n}){return(0,C.jsx)(`nav`,{"data-slot":`changes-tree`,"aria-label":`Changed files`,className:`min-w-0 text-[13px]`,children:(0,C.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,C.jsx)(E,{dir:e,depth:0,selected:t,onSelect:n},e.path)),e.files.map(e=>(0,C.jsx)(O,{file:e,depth:0,selected:t,onSelect:n},e.path))]})})}function T({adds:e,dels:t}){return(0,C.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] font-medium tabular-nums`,children:[e>0?(0,C.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}):null,e>0&&t>0?` `:null,t>0?(0,C.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]}):null]})}function E({dir:e,depth:t,selected:n,onSelect:r}){let[i,s]=(0,S.useState)(!0);return(0,C.jsxs)(`li`,{children:[(0,C.jsxs)(`button`,{type:`button`,"data-slot":`tree-dir`,"data-path":e.path,"data-state":i?`open`:`closed`,"aria-expanded":i,onClick:()=>s(e=>!e),className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+t*14}px`},children:[(0,C.jsx)(o,{"aria-hidden":`true`,className:a(`size-3.5 shrink-0 transition-transform`,i&&`rotate-90`)}),(0,C.jsx)(h,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,C.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name}),(0,C.jsx)(T,{adds:e.adds,dels:e.dels})]}),i?(0,C.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,C.jsx)(E,{dir:e,depth:t+1,selected:n,onSelect:r},e.path)),e.files.map(e=>(0,C.jsx)(O,{file:e,depth:t+1,selected:n,onSelect:r},e.path))]}):null]})}var D={added:`text-success`,deleted:`text-danger`};function O({file:e,depth:t,selected:n,onSelect:r}){let i=n===e.path;return(0,C.jsx)(`li`,{children:(0,C.jsxs)(`button`,{type:`button`,"data-slot":`tree-file`,"data-path":e.path,"aria-current":i?`true`:void 0,onClick:()=>r(e.path),className:a(`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,i?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${24+t*14}px`},children:[(0,C.jsx)(m,{"aria-hidden":`true`,className:a(`size-3.5 shrink-0`,D[e.status])}),(0,C.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,C.jsx)(T,{adds:e.adds,dels:e.dels})]})})}function k(e,t){return{kind:`dir`,name:e,path:t,dirs:[],files:[],adds:0,dels:0,fileCount:0}}function A(e){let t=e;for(;t.files.length===0&&t.dirs.length===1;){let e=t.dirs[0];t={...e,name:`${t.name}/${e.name}`}}return{...t,dirs:t.dirs.map(A)}}var j=(e,t)=>e.name.localeCompare(t.name);function M(e){let t=k(``,``),n=new Map([[``,t]]),r=e=>{let t=n.get(e);if(t)return t;let i=e.lastIndexOf(`/`),a=r(i===-1?``:e.slice(0,i)),o=k(i===-1?e:e.slice(i+1),e);return a.dirs.push(o),n.set(e,o),o};for(let t of e){let e=t.path.lastIndexOf(`/`);r(e===-1?``:t.path.slice(0,e)).files.push({kind:`file`,name:e===-1?t.path:t.path.slice(e+1),path:t.path,status:t.status,adds:t.adds,dels:t.dels,binary:t.binary})}let i=e=>{e.dirs.forEach(i),e.adds=e.files.reduce((e,t)=>e+t.adds,0)+e.dirs.reduce((e,t)=>e+t.adds,0),e.dels=e.files.reduce((e,t)=>e+t.dels,0)+e.dirs.reduce((e,t)=>e+t.dels,0),e.fileCount=e.files.length+e.dirs.reduce((e,t)=>e+t.fileCount,0),e.dirs.sort(j),e.files.sort(j)};return i(t),{...t,dirs:t.dirs.map(A)}}function N({bar:e,branch:t,stat:n,mode:i,wrap:a,onModeChange:o,onWrapChange:s,onAction:f}){return(0,C.jsxs)(`div`,{"data-slot":`git-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[t?(0,C.jsx)(_,{branch:t}):null,n?(0,C.jsx)(I,{stat:n}):null,(0,C.jsxs)(`span`,{className:`ml-auto flex items-center gap-1`,children:[(0,C.jsx)(`span`,{className:`hidden items-center gap-1 md:flex`,children:(0,C.jsx)(v,{mode:i,wrap:a,onModeChange:o,onWrapChange:s})}),e.secondary.map(e=>(0,C.jsx)(F,{action:e,variant:`outline`,onAction:f},e.id)),(0,C.jsx)(F,{action:e.primary,variant:`primary`,onAction:f}),e.menu.length>0?(0,C.jsxs)(d,{children:[(0,C.jsx)(c,{asChild:!0,children:(0,C.jsx)(r,{variant:`ghost`,size:`icon-sm`,"aria-label":`More git actions`,children:(0,C.jsx)(p,{"aria-hidden":`true`})})}),(0,C.jsx)(l,{align:`end`,"data-slot":`git-toolbar-menu`,children:e.menu.map(e=>(0,C.jsxs)(u,{disabled:!e.enabled,title:e.reason,onSelect:()=>f(e.id),children:[P[e.id],e.label]},e.id))})]}):null]})]})}var P={commit:(0,C.jsx)(g,{"aria-hidden":`true`}),push:(0,C.jsx)(b,{"aria-hidden":`true`}),"create-pr":(0,C.jsx)(f,{"aria-hidden":`true`}),"view-pr":(0,C.jsx)(s,{"aria-hidden":`true`}),"open-terminal":(0,C.jsx)(y,{"aria-hidden":`true`})};function F({action:e,variant:t,onAction:n}){return e.id===`view-pr`?i(e.href)?(0,C.jsx)(r,{asChild:!0,variant:t,size:`sm`,"data-action":e.id,children:(0,C.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:[P[e.id],e.label]})}):(0,C.jsxs)(r,{variant:t,size:`sm`,"data-action":e.id,disabled:!0,title:`View PR unavailable — the recorded PR link is not an http(s) URL`,children:[P[e.id],e.label]}):(0,C.jsxs)(r,{variant:t,size:`sm`,"data-action":e.id,disabled:!e.enabled,title:e.enabled?void 0:e.reason,onClick:()=>n(e.id),children:[P[e.id],e.label]})}function I({stat:e}){return(0,C.jsx)(`span`,{"data-slot":`changes-stat`,children:(0,C.jsx)(x,{stat:{adds:L(e.adds),dels:L(e.dels),files:e.files}})})}function L(e){let[t,n]=(0,S.useState)(e),r=(0,S.useRef)(e);return(0,S.useEffect)(()=>{let t=r.current;if(t===e)return;if(typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||typeof requestAnimationFrame!=`function`){r.current=e,n(e);return}let i=performance.now(),a=0,o=s=>{let c=Math.min(1,(s-i)/350),l=1-(1-c)**3;n(Math.round(t+(e-t)*l)),c<1?a=requestAnimationFrame(o):r.current=e};return a=requestAnimationFrame(o),()=>{cancelAnimationFrame(a),r.current=e,n(e)}},[e]),t}export{w as i,N as n,M as r,I as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{A as r,G as i,J as a,Jn as o,K as s,Rn as c,Rt as l,Ur as u,Vr as d,Vt as f,Wr as p,Wt as m,Xn as h,Y as g,Yn as _,Z as v,a as y,i as b,j as x,k as S,ni as C,nr as w,pr as ee,q as T,qn as te,qr as ne,t as E}from"./centered-state-Djgly6Ni.js";import{n as D,r as O,t as k}from"./utils--z9hRtl3.js";import{t as A}from"./arrow-left-BOqE0a3k.js";import{C as j,S as re,b as ie,g as M,h as N,p as P,v as ae,x as oe,y as se}from"./new-task-form-1r2bgsdD.js";import{t as ce}from"./chevron-right-Cc9BWnbN.js";import{b as F,x as le,y as ue}from"./dropdown-menu-CEQziH7X.js";import{C as de,S as fe,_ as I,a as pe,g as L,h as me,n as R,o as he,p as z,r as ge,u as B,v as V,y as H}from"./prompt-templates-BmZtCe-L.js";import{t as _e}from"./refresh-cw-DcNCj2nu.js";import{t as U}from"./sparkles-CP8QDOgX.js";import{t as ve}from"./triangle-alert-xBya8FUp.js";import{n as ye,t as be}from"./textarea-CyBCyKIk.js";import{a as W,c as xe,l as G,n as Se,o as K,r as Ce,s as q,t as we}from"./use-submit-shortcut-JTpNzU-u.js";import{r as Te,t as J}from"./project-router-VDN4jQM8.js";import{r as Y,t as X}from"./markdown-CgEEE2ND.js";import{c as Z,d as Ee,f as De,i as Oe,s as ke,t as Ae,u as je}from"./skills-D4P-Hgey.js";import{_ as Me,d as Ne,f as Pe,h as Fe,l as Ie,p as Le,s as Re,u as ze}from"./index-DVDqF4bM.js";import{t as Be}from"./diff-BKew9rQX.js";import{t as Ve}from"./tab-link-D4lFzzI1.js";var He=O(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ue=O(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),We=O(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),Q=e(t(),1),$=n();function Ge({className:e,...t}){return(0,$.jsx)(`div`,{"data-slot":`skeleton`,className:k(`animate-pulse rounded-md bg-accent`,e),...t})}function Ke(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function qe(e,t=[]){let n=Ke(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=Je(t)),n}function Je(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function Ye(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function Xe(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function Ze(e,t,n){let r=(n??``).trim();if(!r)return qe(e,t);let i=Ke(e),a=r.startsWith(i)?i+Ye(r.slice(i.length),e):Ye(r,e),o=Xe(a,e)?a:`${i}\n\n${a}`;return t.length?o+Je(t):o}function Qe(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function $e(e,t,n,r,i={}){return t?{...i,workflow:t,task:Ze(e,n,r)}:n.length?{...i,steps:Qe(n),task:Ze(e,[],r)}:{...i,workflow:`quick-task`,task:Ze(e,[],r)}}function et(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function tt(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body}`.toLowerCase().includes(n))}function nt(e,t){return e.trim()!==``&&t===0}function rt(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}var it={workflow:null,skills:[]},at=`xez-followup-selection`;function ot(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.filter(e=>typeof e==`string`):[]}}function st(){try{let e=localStorage.getItem(at);return e?ot(JSON.parse(e)):{...it}}catch{return{...it}}}function ct(e){try{localStorage.setItem(at,JSON.stringify(e))}catch{}}var lt=`xez-followup-prompt:`;function ut(e){try{return localStorage.getItem(lt+e)??``}catch{return``}}function dt(e,t){try{t===``?localStorage.removeItem(lt+e):localStorage.setItem(lt+e,t)}catch{}}function ft({item:e,workflows:t,skills:n,workflow:i,onWorkflowChange:a,selectedSkills:o,onSkillsChange:s,engine:l,onEngineChange:d,queuedRunId:p,onQueued:m}){let h=ne(),g=f(),_=e.kind===`pr`?`PR`:`issue`,v=o.filter(e=>n.some(t=>t.name===e)),[S]=(0,Q.useState)(()=>Ke(e)),[C,w]=(0,Q.useState)(()=>ut(e.url)||S),T=Pe(l),te=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{dt(e.url,C===S?``:C)},[e.url,C,S]);let E=(0,Q.useMemo)(()=>pe(g.data?.promptTemplates),[g.data?.promptTemplates]),D=e=>{let t=te.current,n=C===S?C.length:t?.selectionStart??C.length,r=ge(C,n,e);w(r.text),requestAnimationFrame(()=>{te.current?.focus(),te.current?.setSelectionRange(r.caret,r.caret)})},O=R(E,v),k=(0,Q.useRef)(C);k.current=C;let A=(0,Q.useRef)(``);(0,Q.useEffect)(()=>{let e=he(k.current,A.current,O,S);A.current=e.applied,e.text!==k.current&&w(e.text)},[O,S]);let j=u({mutationFn:async()=>T.canRun?c($e(e,i,v,C,Ne(T))):null,onSuccess:t=>{if(t===null)return;let n=`runs`in t?t.runs[0]:t;n&&m(e.url,n.id),b(`Added to the queue — ${_} #${e.number}`),v.length>0&&g.data!==void 0&&ee({skillUsage:v.reduce((e,t)=>Ae(e,t),g.data.skillUsage)}).then(()=>h.invalidateQueries({queryKey:x.uiState})).catch(()=>{}),dt(e.url,``),w(S),A.current=``,h.invalidateQueries({queryKey:x.runs.all})},onError:e=>b(e.message,{tone:`danger`})}),re=e=>{we({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),!j.isPending&&T.canRun&&j.mutate())},ie=e=>s(o.includes(e)?o.filter(t=>t!==e):[...o,e]);return(0,$.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,$.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:[(0,$.jsx)(ae,{"aria-hidden":`true`,className:`size-3.5 text-violet`}),`Hand this to the agent`]}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(pt,{workflows:t,value:i,onChange:a}),(0,$.jsx)(mt,{skills:n,skillUsage:g.data?.skillUsage,selected:v,onToggle:ie}),(0,$.jsx)(ze,{pick:l,onChange:d,disabled:j.isPending||!T.canRun,accounts:!0}),!T.providerPending&&!T.canRun?(0,$.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[T.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,$.jsx)(J,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null,(0,$.jsx)(Ie,{templates:E,onInsert:D})]}),v.length>0?(0,$.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:v.map(e=>(0,$.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>ie(e),title:`Remove this skill`,className:`inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-px font-mono text-[11px] font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,$.jsx)(ye,{"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,$.jsx)(be,{ref:te,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:C,onChange:e=>w(e.target.value),onKeyDown:re,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`}),(0,$.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2.5`,children:[(0,$.jsxs)(y,{variant:`contrast`,"data-action":`gh-run`,disabled:j.isPending||!T.canRun,onClick:()=>j.mutate(),children:[(0,$.jsx)(se,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,_]}),(0,$.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[10.5px] font-medium text-muted-foreground`,children:Se()}),p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,$.jsx)(r,{"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,$.jsx)(J,{to:`/tasks/${p}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-violet hover:underline`,children:`View task →`})]}):null]})]})}function pt({workflows:e,value:t,onChange:n}){let[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(``),c=(0,Q.useRef)(null),l=Ee(e,o);return(0,$.jsxs)(P,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,$.jsx)(M,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:k(B,t&&`border-foreground/60 font-mono text-[11.5px] font-semibold text-foreground`),children:[(0,$.jsx)(Me,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),(0,$.jsx)(`span`,{className:`max-w-44 truncate`,children:t??`workflow`}),(0,$.jsx)(j,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,$.jsx)(N,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,$.jsxs)(z,{shouldFilter:!1,children:[(0,$.jsx)(I,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,$.jsxs)(H,{ref:c,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,$.jsx)(me,{children:`Nothing matches.`}):null,(0,$.jsx)(L,{children:l.map(e=>{let i=t===e.name;return(0,$.jsxs)(V,{value:`workflow ${e.name}`,keywords:De(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(i?null:e.name),a(!1)},children:[(0,$.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,i?(0,$.jsx)(r,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},e.name)})})]})]})})]})}function mt({skills:e,skillUsage:t,selected:n,onToggle:i}){let[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(null),d=(0,Q.useRef)(null),{mostUsed:f,project:p,global:m}=Z(je(e,s,t),t),h=(e,t)=>{let a=n.includes(e.name);return(0,$.jsxs)(V,{value:`skill ${e.name} ${e.path}`,keywords:De(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.name,"data-selected":a?`true`:void 0,onSelect:()=>i(e.name),children:[(0,$.jsx)(`span`,{className:k(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,$.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,$.jsx)(de,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,$.jsx)(r,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.path)};return e.length===0?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Re,{skill:l,onClose:()=>u(null)}),(0,$.jsxs)(P,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,$.jsx)(M,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:k(B,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,$.jsx)(U,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),`skills`,n.length>0?` · ${n.length}`:``,(0,$.jsx)(j,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,$.jsx)(N,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,$.jsxs)(z,{shouldFilter:!1,children:[(0,$.jsx)(I,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,$.jsxs)(H,{ref:d,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[f.length===0&&p.length===0&&m.length===0?(0,$.jsx)(me,{children:`Nothing matches.`}):null,f.length>0?(0,$.jsx)(L,{heading:`Most used`,children:f.map(e=>h(e,Oe(e)))}):null,p.length>0?(0,$.jsx)(L,{heading:`Project skills`,children:p.map(e=>h(e,!0))}):null,m.length>0?(0,$.jsx)(L,{heading:`Global`,children:m.map(e=>h(e,!1))}):null]})]})})]})]})}var ht=1e3,gt=100,_t=350;function vt(e,t){let[n,r]=(0,Q.useState)(e);return(0,Q.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function yt({view:e,changes:t=!1,index:n=!1}){let{n:r}=d(),a=i({limit:ht}),c=v().data?.capabilities?.automations===!0,p=a.data,h=r===void 0?null:Number.parseInt(r,10),_=(0,Q.useMemo)(()=>{if(!p?.available)return[];let t=new Set;e===`prs`&&h!==null&&Number.isInteger(h)&&t.add(h);for(let e of p.prs){if(t.size>=gt)break;t.add(e.number)}return[...t]},[p,e,h]),w=s(_,e===`prs`),T=w.data?.available?w.data.checks:void 0,D=ne(),O=e=>{D.setQueryData(x.uiState,t=>({...t,githubView:e})),ee({githubView:e}).then(e=>D.setQueryData(x.uiState,e)).catch(e=>{b(e instanceof Error?e.message:String(e),{tone:`danger`}),D.invalidateQueries({queryKey:x.uiState})})},A=(0,Q.useRef)(null),j=u({mutationFn:()=>te({refresh:!0,limit:ht}),onSuccess:e=>{D.setQueryData(x.github({limit:ht}),e),D.invalidateQueries({queryKey:x.githubChecks(_)});let t=A.current;if(!t){D.removeQueries({queryKey:[`github`,`comments`]});return}let n=x.githubComments(t.kind,t.number);o(t.kind,t.number,{refresh:!0}).then(e=>D.setQueryData(n,e)).catch(()=>{}),D.removeQueries({queryKey:[`github`,`comments`],predicate:e=>e.queryHash!==C(n)})},onError:e=>b(e.message,{tone:`danger`})}),re=m(),ie=l(),M=f(),[N,P]=(0,Q.useState)(()=>st().workflow),[ae,se]=(0,Q.useState)(()=>st().skills),[ce,F]=(0,Q.useState)({runner:null,model:null,account:null});(0,Q.useEffect)(()=>{ct({workflow:N,skills:[...ae]})},[N,ae]);let le=re.data?.workflows;(0,Q.useEffect)(()=>{le&&N!==null&&!le.some(e=>e.name===N)&&P(null)},[le,N]);let de=ie.data,I=M.data?.skillUsage,pe=(0,Q.useMemo)(()=>ke(de??[],I),[de,I]),[L,me]=(0,Q.useState)(new Map),[R,he]=(0,Q.useState)(``),[z,ge]=(0,Q.useState)([]),B=vt(R,_t),V=(0,Q.useMemo)(()=>p?.available?e===`issues`?p.issues:p.prs:[],[p,e]),H=nt(B,(0,Q.useMemo)(()=>tt(V,{query:B,labels:z}).length,[V,B,z])),U=g(e===`issues`?`issue`:`pr`,B,H),ye=M.dataUpdatedAt===0&&M.errorUpdatedAt===0;if(n&&ye)return(0,$.jsx)(Le,{});if(n&&M.data?.githubView===`prs`)return(0,$.jsx)(Te,{to:`/github/prs`,replace:!0});if(!p)return a.isError?(0,$.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(E,{icon:(0,$.jsx)(ve,{}),tone:`danger`,title:`Could not load GitHub`,subtitle:a.error.message})}):(0,$.jsx)(Le,{});if(A.current=null,!p.available)return(0,$.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(E,{icon:(0,$.jsx)(Fe,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:p.reason??`unknown reason`,actions:(0,$.jsx)(y,{variant:`outline`,"data-action":`gh-retry`,disabled:j.isPending,onClick:()=>j.mutate(),children:`Try again`}),children:(0,$.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,$.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,$.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in xezar works without it.`]})})});let be=V,W=tt(be,{query:R,labels:z}),xe=R.trim()!==``||z.length>0,G=H&&U.data?.available?U.data:null,Se=new Set(W.map(e=>e.number)),K=G?tt(G.items,{labels:z}).filter(e=>!Se.has(e.number)):[],Ce=R.trim()!==``&&R.trim()!==B.trim()||H&&U.isPending,q={...G?.labelColors??{},...p.labelColors??{}},we=et(be),X=r===void 0?null:Number.parseInt(r,10),Z=X===null?W[0]??K[0]??null:be.find(e=>e.number===X)??K.find(e=>e.number===X)??null;A.current=Z?{kind:Z.kind,number:Z.number}:null;let Ee=e===`issues`?`/github`:`/github/prs`,De=H&&(U.data?.available===!1||U.isError),Oe=U.data?.available===!1?U.data.reason??`unknown reason`:U.error instanceof Error?U.error.message:`the search request failed`,Ae=xe?Ce?(0,$.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(S,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,R.trim(),`”…`]}):K.length>0?null:De?(0,$.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,` match your filter, and GitHub could not be searched: `,Oe,`.`]}):G?(0,$.jsxs)(`p`,{children:[`No `,e===`issues`?`issues`:`pull requests`,` match your filter — open, closed or merged.`]}):(0,$.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,` match your filter.`]}):(0,$.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,`.`]});return(0,$.jsxs)(`div`,{"data-route":`github`,className:`flex h-full min-h-0 items-stretch`,children:[(0,$.jsxs)(`section`,{"data-slot":`gh-list`,className:k(`w-full min-h-0 flex-col overflow-y-auto overscroll-contain border-border md:flex md:w-[360px] md:shrink-0 md:border-r`,r===void 0?`flex`:`hidden`),children:[(0,$.jsxs)(`header`,{"data-slot":`gh-header`,className:`sticky top-0 z-10 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,$.jsx)(`h1`,{className:`text-lg font-semibold`,children:`GitHub`}),p.repo?(0,$.jsx)(`span`,{"data-slot":`gh-repo`,className:`min-w-0 truncate font-mono text-[11px] text-soft-foreground`,children:p.repo}):null,c?(0,$.jsx)(J,{to:`/automations/new`,className:`ml-auto shrink-0 text-[10px] font-medium text-primary hover:underline`,children:`Set up automations`}):null,(0,$.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:j.isPending,onClick:()=>j.mutate(),className:k(`flex shrink-0 items-center gap-1 rounded-full border border-border px-1.5 py-px text-[10px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,!c&&`ml-auto`),children:[(0,$.jsx)(_e,{"aria-hidden":`true`,className:k(`size-[9px]`,j.isPending&&`motion-safe:animate-spin`)}),p.syncedAt?`synced ${Y(p.syncedAt)} ago`:`refresh`]})]}),(0,$.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,$.jsxs)(Ve,{to:`/github`,active:e===`issues`,onClick:()=>O(`issues`),children:[`Issues · `,bt(p.issues.length)]}),(0,$.jsxs)(Ve,{to:`/github/prs`,active:e===`prs`,onClick:()=>O(`prs`),children:[`Pull requests · `,bt(p.prs.length)]})]}),(0,$.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-2 pb-3`,children:[(0,$.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,$.jsx)(fe,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,$.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:`Search #id, title, author…`,value:R,onChange:e=>he(e.target.value),className:`w-full rounded-md border border-input bg-card py-1 pr-2 pl-7 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,$.jsx)(St,{options:we,colors:q,selected:z,onChange:ge})]})]}),W.length===0?Ae&&(0,$.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-soft-foreground`,children:Ae}):(0,$.jsx)(`ul`,{"data-slot":`gh-rows`,className:`flex flex-col gap-0.5 px-2 py-2`,children:W.map(t=>(0,$.jsx)(xt,{item:t,view:e,colors:q,active:Z?.url===t.url,queued:L.has(t.url),checks:t.kind===`pr`?T?.[t.number]??t.checks:t.checks},t.url))}),K.length>0?(0,$.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,$.jsxs)(`p`,{className:`px-4 pt-2 pb-1 text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:[`Found on GitHub`,G?.truncated?` (first matches)`:``]}),(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:K.map(t=>(0,$.jsx)(xt,{item:t,view:e,colors:q,active:Z?.url===t.url,queued:L.has(t.url),checks:t.kind===`pr`?T?.[t.number]??t.checks:t.checks},t.url))})]}):null]}),(0,$.jsx)(`section`,{"data-slot":`gh-detail`,className:k(`min-w-0 min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain`,r===void 0?`hidden md:flex`:`flex`),children:Z?(0,$.jsx)(wt,{item:Z,listPath:Ee,colors:q,changes:t,checks:Z.kind===`pr`?T?.[Z.number]??Z.checks:Z.checks,children:(0,$.jsx)(ft,{item:Z,workflows:re.data?.workflows??[],skills:pe,workflow:N,onWorkflowChange:P,selectedSkills:ae,onSkillsChange:se,engine:ce,onEngineChange:F,queuedRunId:L.get(Z.url)??null,onQueued:(e,t)=>me(n=>new Map(n).set(e,t))},Z.url)}):(0,$.jsx)(E,{icon:e===`issues`?(0,$.jsx)(oe,{}):(0,$.jsx)(ue,{}),tone:`neutral`,heading:`h2`,title:X===null?`Nothing selected`:`Not found`,subtitle:X===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${X} is not among the open ${e===`issues`?`issues`:`pull requests`}. Search for ${X} above to look it up on GitHub, closed and merged included.`})})]})}function bt(e){return`${e}${e>=ht?`+`:``}`}function xt({item:e,view:t,colors:n,active:r,queued:i,checks:a}){let s=e.kind===`issue`?oe:ue,c=ne(),l=()=>{c.prefetchQuery({queryKey:x.githubComments(e.kind,e.number),queryFn:({signal:t})=>o(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,$.jsx)(`li`,{children:(0,$.jsxs)(J,{to:`${t===`issues`?`/github/issues`:`/github/prs`}/${e.number}`,draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,qe(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},onMouseEnter:l,onFocus:l,"data-slot":`gh-row`,"data-number":e.number,"aria-current":r?`page`:void 0,title:`Drag into the composer to prefill a task`,className:k(`flex flex-col gap-1 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,r&&`bg-muted`),children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(s,{"aria-hidden":`true`,className:k(`size-3.5 shrink-0`,e.kind===`issue`?`text-success`:`text-violet`)}),(0,$.jsx)(`span`,{className:k(`min-w-0 truncate text-[13px] font-medium`,r&&`font-semibold`),children:e.title})]}),(0,$.jsxs)(`span`,{className:`flex items-center gap-2 pl-[22px] font-mono text-[10.5px] text-muted-foreground`,children:[(0,$.jsxs)(`span`,{children:[`#`,e.number]}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:e.author}),(0,$.jsx)(`span`,{children:Y(e.createdAt)}),(0,$.jsx)(Ht,{count:e.comments}),a?(0,$.jsx)(Wt,{checks:a}):null,i?(0,$.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-violet`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,$.jsx)(`span`,{className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,$.jsx)(Ct,{label:e,color:n[e]},e))}):null]})})}function St({options:e,colors:t,selected:n,onChange:i}){let[a,o]=(0,Q.useState)(!1),s=e=>i(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,$.jsxs)(P,{open:a,onOpenChange:o,children:[(0,$.jsx)(M,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:k(`flex shrink-0 items-center gap-1 rounded-md border border-input bg-card px-2 py-1 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50`,n.length>0&&`border-primary/60 text-foreground`),children:[(0,$.jsx)(We,{"aria-hidden":`true`,className:`size-3.5`}),n.length>0?`Labels · ${n.length}`:`Labels`]})}),(0,$.jsx)(N,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,$.jsxs)(z,{children:[(0,$.jsx)(I,{placeholder:`Filter labels…`}),(0,$.jsxs)(H,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,$.jsx)(me,{children:`No labels.`}),n.length>0?(0,$.jsxs)(V,{value:`__clear__`,onSelect:()=>i([]),className:`text-soft-foreground`,children:[`Clear `,n.length,` filter`,n.length>1?`s`:``]}):null,e.map(e=>{let i=n.includes(e);return(0,$.jsxs)(V,{value:e,onSelect:()=>s(e),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:rt(t[e])}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),i?(0,$.jsx)(r,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e)})]})]})})]})}function Ct({label:e,color:t}){return(0,$.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:rt(t),className:`rounded-full border px-1.5 py-px text-[10px] font-medium`,children:e})}function wt({item:e,listPath:t,colors:n,children:r,changes:i,checks:a}){let o=e.kind===`pr`?`pull request`:`issue`,s=e.kind===`pr`&&!!(e.additions||e.deletions);return(0,$.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,$.jsxs)(J,{to:t,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,$.jsx)(A,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),(0,$.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[10.5px] text-soft-foreground`,children:[(0,$.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,$.jsx)(`span`,{children:o}),`·`,(0,$.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,$.jsxs)(`span`,{children:[Y(e.createdAt),` ago`]}),e.comments?(0,$.jsxs)($.Fragment,{children:[`·`,(0,$.jsx)(Ht,{count:e.comments})]}):null,s?(0,$.jsxs)($.Fragment,{children:[`·`,(0,$.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,$.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions??0]}),` `,(0,$.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions??0]})]})]}):null,`·`,D(e.url)?(0,$.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,$.jsx)(F,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,$.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]}),(0,$.jsx)(`h2`,{className:`mt-2 text-xl leading-snug font-semibold`,children:e.title}),e.kind===`pr`?(0,$.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,$.jsx)(Ve,{to:`/github/prs/${e.number}`,active:!i,children:`Conversation`}),(0,$.jsx)(Ve,{to:`/github/prs/${e.number}/changes`,active:i,children:`Changes`})]}):null,e.labels.length>0||a?(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,$.jsx)(Ct,{label:e,color:n[e]},e)),a?(0,$.jsx)(Ut,{checks:a,url:e.url}):null]}):null,i&&e.kind===`pr`?(0,$.jsx)(Ot,{item:e}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:e.body?(0,$.jsx)(X,{children:e.body}):(0,$.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,$.jsx)(kt,{item:e,colors:n}),e.kind===`pr`?(0,$.jsx)(Dt,{number:e.number}):null,r]})]})}var Tt={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function Et({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,$.jsx)(re,{"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:k(t,`text-success`)}):e===`failing`?(0,$.jsx)(ie,{"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:k(t,`text-danger`)}):e===`pending`?(0,$.jsx)(S,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:k(t,`animate-spin text-warning`)}):(0,$.jsx)(le,{"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:k(t,`text-soft-foreground`)})}function Dt({number:e}){let t=ne(),n=p({queryKey:x.githubMergeState(e),queryFn:({signal:t})=>h(e,{},{signal:t}),retry:!1}),i=n.data?.available?n.data.mergeState:null,[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1),[l,d]=(0,Q.useState)(!1),f=u({mutationFn:()=>h(e,{refresh:!0}),onSuccess:n=>t.setQueryData(x.githubMergeState(e),n),onError:e=>b(e instanceof Error?e.message:String(e),{tone:`danger`})}),m=a&&i?.methods.includes(a)?a:i?.defaultMethod??i?.methods[0]??null,g=u({mutationFn:()=>{if(!i||!m)throw Error(`No merge method is available.`);return w(e,{method:m,expectedHeadSha:i.headSha,...l&&i.canOverride?{overrideRules:!0}:{}})},onSuccess:()=>{c(!1),b(`Pull request #${e} merged`),t.invalidateQueries({queryKey:x.githubMergeState(e)}),t.invalidateQueries({queryKey:x.github({limit:ht})}),t.invalidateQueries({queryKey:x.githubComments(`pr`,e)})},onError:n=>{b(n instanceof Error?n.message:String(n),{tone:`danger`}),t.invalidateQueries({queryKey:x.githubMergeState(e)})}});if(n.isPending)return(0,$.jsx)(Ge,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`});if(!i)return(0,$.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,$.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:n.data?.available===!1?n.data.reason:`GitHub could not load merge requirements.`})]});let _=i.state===`merged`?`Merged`:i.state===`closed`?`Closed`:i.isDraft?`Draft`:i.mergeable===`conflicting`?`Conflicts must be resolved`:i.canMerge?`Ready to merge`:`Merge blocked`,v=i.reviewDecision===`approved`?`passing`:i.reviewDecision===`unknown`?`unknown`:`failing`,S=i.mergeable===`mergeable`?`passing`:i.mergeable===`conflicting`?`failing`:`unknown`,C=!!(m&&(i.canMerge||i.canOverride&&l));return(0,$.jsxs)(`section`,{"data-slot":`gh-merge-box`,"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[i.canMerge?(0,$.jsx)(r,{"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,$.jsx)(ve,{"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:_}),(0,$.jsxs)(y,{type:`button`,variant:`ghost`,size:`sm`,disabled:f.isPending,onClick:()=>f.mutate(),children:[(0,$.jsx)(_e,{"aria-hidden":`true`,className:k(`size-3.5`,f.isPending&&`animate-spin`)}),`Refresh`]})]}),(0,$.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[i.headRef,` (`,i.headSha.slice(0,7),`) → `,i.baseRef]}),(0,$.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,$.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Et,{state:v}),(0,$.jsxs)(`span`,{children:[`Reviews: `,i.reviewDecision.replaceAll(`-`,` `)]})]}),(0,$.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Et,{state:S}),(0,$.jsxs)(`span`,{children:[`Conflicts: `,i.mergeable===`conflicting`?`present`:i.mergeable===`mergeable`?`none`:`unknown`]})]}),i.checks.length===0?(0,$.jsx)(`li`,{children:`No checks configured`}):i.checks.map(e=>(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(Et,{state:e.state}),(0,$.jsxs)(`span`,{children:[e.name,` · `,e.state,e.required===!0?` · required`:e.required===null?` · requiredness unknown`:``]})]}),e.url&&D(e.url)?(0,$.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]},e.name)),i.blockers.map(e=>(0,$.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),i.canOverride?(0,$.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-warning/40 bg-warning/5 p-3 text-xs`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>d(e.target.checked),className:`mt-0.5 size-4 accent-primary`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,i.state===`open`&&i.methods.length>0?(0,$.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2 sm:flex-row`,children:[(0,$.jsx)(`select`,{"aria-label":`Merge method`,value:m??``,onChange:e=>o(e.target.value),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm`,children:i.methods.map(e=>(0,$.jsx)(`option`,{value:e,children:Tt[e]},e))}),(0,$.jsx)(y,{disabled:!C,onClick:()=>c(!0),children:m?Tt[m]:`Merge`})]}):null]})]}),(0,$.jsx)(Ce,{open:s,onOpenChange:c,children:(0,$.jsxs)(W,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,$.jsxs)(xe,{children:[(0,$.jsxs)(G,{children:[m?Tt[m]:`Merge`,` pull request #`,e,`?`]}),(0,$.jsxs)(K,{children:[`This will merge “`,i.title,`” into `,i.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`,l&&i.canOverride?` You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`:``]})]}),g.error?(0,$.jsx)(`p`,{className:`text-sm text-danger`,children:g.error.message}):null,(0,$.jsxs)(q,{children:[(0,$.jsx)(y,{variant:`outline`,disabled:g.isPending,onClick:()=>c(!1),children:`Cancel`}),(0,$.jsx)(y,{disabled:g.isPending,onClick:()=>g.mutate(),children:g.isPending?`Merging…`:m?Tt[m]:`Merge`})]})]})})]})}function Ot({item:e}){let t=ne(),n=a(e.number),[r,i]=(0,Q.useState)(``),[o,s]=(0,Q.useState)(null),c=n.data,l=c?.available?c.files.filter(e=>e.path.toLowerCase().includes(r.toLowerCase())):[],u=l.findIndex(e=>e.path===o);(0,Q.useEffect)(()=>{l.length>0&&!l.some(e=>e.path===o)&&s(l[0].path)},[c?.available?c.headSha:``,r]);let d=async()=>{let n=c?.available?c.headSha:null,r=await _(e.number,{refresh:!0});t.setQueryData([`github`,`pr-changes`,e.number],r),r.available&&n&&n!==r.headSha&&(s(r.files[0]?.path??null),b(`The reviewed revision changed.`))};if(n.isPending)return(0,$.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!c)return(0,$.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!c.available)return(0,$.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:c.reason});let f=l.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),p=D(e.url)?`${e.url}/files`:null,m=l.find(e=>e.path===o);return(0,$.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,$.jsxs)(`strong`,{children:[c.files.length,` changed files`]}),(0,$.jsxs)(`span`,{className:`text-success`,children:[`+`,c.additions]}),(0,$.jsxs)(`span`,{className:`text-danger`,children:[`−`,c.deletions]}),(0,$.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:c.headSha,children:[`head `,c.headSha.slice(0,8)]}),(0,$.jsx)(y,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void d(),children:`Refresh`})]}),c.truncated?(0,$.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[c.reason??`This response is incomplete.`,` `,p?(0,$.jsx)(`a`,{href:p,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,$.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,$.jsxs)(`aside`,{className:`min-w-0`,children:[(0,$.jsx)(`input`,{"aria-label":`Filter changed files`,value:r,onChange:e=>i(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,$.jsx)(`select`,{"aria-label":`Select changed file`,value:o??``,onChange:e=>s(e.target.value),className:`mt-2 min-h-11 w-full rounded-md border border-input bg-background px-2 text-sm lg:hidden`,children:l.map(e=>(0,$.jsx)(`option`,{children:e.path},e.path))}),(0,$.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:l.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>s(e.path),className:k(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,o===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,$.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,$.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,$.jsx)(y,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:u<=0,onClick:()=>s(l[u-1]?.path??null),children:(0,$.jsx)(He,{})}),(0,$.jsx)(y,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:u<0||u>=l.length-1,onClick:()=>s(l[u+1]?.path??null),children:(0,$.jsx)(ce,{})})]}),l.length===0?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Be,{files:f.filter(e=>e.path===o),wrap:!0,className:`min-w-0`}),m&&!m.patch?(0,$.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,m.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function kt({item:e,colors:t}){let n=T(e.kind,e.number),r=n.data,i=(0,Q.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(At(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,$.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,$.jsx)(Ge,{className:`mb-3 h-3 w-24`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsx)(Ge,{className:`h-14 w-full`}),(0,$.jsx)(Ge,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,$.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,$.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,$.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,$.jsx)(F,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,$.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,$.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-soft-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,$.jsx)(`ul`,{className:`flex flex-col gap-5`,children:jt(i).map(e=>e.group===`commits`?(0,$.jsx)(Mt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,$.jsx)(Rt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,$.jsx)(Pt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,$.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-soft-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,$.jsx)(F,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var At=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function jt(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function Mt({commits:e,colors:t}){let[n,r]=(0,Q.useState)(!1),i=e[0]?.actor??`?`;return n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:Nt.committed}),(0,$.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,$.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,$.jsx)(Pt,{event:e,colors:t},e.id))]}):(0,$.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:Nt.committed}),(0,$.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,$.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,$.jsx)(`span`,{className:`shrink-0`,children:Y(e[e.length-1].createdAt)})]})})}var Nt={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Pt({event:e,colors:t}){return(0,$.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:k(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:Nt[e.kind]}),(0,$.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,$.jsx)(Ft,{event:e,colors:t}),(0,$.jsx)(`span`,{className:`shrink-0`,children:Y(e.createdAt)}),e.url?(0,$.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,$.jsx)(F,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Ft({event:e,colors:t}){switch(e.kind){case`committed`:return(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,$.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,$.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,$.jsx)(It,{checks:e.checks})]});case`labeled`:case`unlabeled`:return(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,$.jsx)(`span`,{"data-slot":`gh-event-label`,style:rt(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[10px]`,children:e.label.name}):null,(0,$.jsx)(`span`,{className:`shrink-0`,children:`label`})]});case`assigned`:case`unassigned`:return(0,$.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]});case`merged`:return(0,$.jsx)(`span`,{children:`merged this`});case`closed`:return(0,$.jsx)(`span`,{children:`closed this`});case`reopened`:return(0,$.jsx)(`span`,{children:`reopened this`});case`head_ref_force_pushed`:return(0,$.jsx)(`span`,{children:`force-pushed`});case`renamed`:return(0,$.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]});case`cross-referenced`:return(0,$.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}}function It({checks:e}){return e?(0,$.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:k(`shrink-0`,Vt[e]),children:Bt[e]}):null}var Lt={approved:{label:`approved`,tone:`border-success/40 text-success`},changes_requested:{label:`changes requested`,tone:`border-danger/40 text-danger`},commented:{label:`commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`dismissed`,tone:`border-border text-muted-foreground`}};function Rt({comment:e}){let t=e.reviewState?Lt[e.reviewState]:null;return(0,$.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,$.jsx)(zt,{url:e.avatarUrl,login:e.author}),(0,$.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,$.jsx)(`span`,{children:Y(e.createdAt)}),t?(0,$.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:k(`rounded-full border px-1.5 py-px font-sans text-[10px] font-medium`,t.tone),children:t.label}):null,(0,$.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,$.jsx)(F,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,$.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,$.jsx)(X,{children:e.body}):(0,$.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function zt({url:e,login:t}){let[n,r]=(0,Q.useState)(!1);return e&&!n?(0,$.jsx)(`img`,{src:e,alt:``,width:16,height:16,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-4 shrink-0 rounded-full`}):(0,$.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var Bt={passing:`✓`,failing:`✗`,pending:`○`},Vt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function Ht({count:e}){return e?(0,$.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,$.jsx)(Ue,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Ut({checks:e,url:t}){let n=k(`text-[11px] font-medium`,Vt[e],t&&`hover:underline`),r=`${Bt[e]} checks ${e}`;return t?(0,$.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,$.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function Wt({checks:e}){return(0,$.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:k(`shrink-0 font-sans text-[11px] font-semibold`,Vt[e]),children:Bt[e]})}export{yt as GithubRoute};