@open-mercato/cezar 0.9.0-pr646.708 → 0.9.0

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 (109) hide show
  1. package/README.md +1 -17
  2. package/dist/config.d.ts +0 -14
  3. package/dist/config.js +0 -39
  4. package/dist/config.js.map +1 -1
  5. package/dist/core/claude-ui-mapper.d.ts +0 -9
  6. package/dist/core/claude-ui-mapper.js +2 -31
  7. package/dist/core/claude-ui-mapper.js.map +1 -1
  8. package/dist/core/codex-app-server-runner.js +18 -19
  9. package/dist/core/codex-app-server-runner.js.map +1 -1
  10. package/dist/core/opencode-server-runner.js +5 -25
  11. package/dist/core/opencode-server-runner.js.map +1 -1
  12. package/dist/core/tool-display.d.ts +1 -2
  13. package/dist/core/tool-display.js +1 -6
  14. package/dist/core/tool-display.js.map +1 -1
  15. package/dist/index.js +4 -40
  16. package/dist/index.js.map +1 -1
  17. package/dist/runs/auto-name.js +0 -6
  18. package/dist/runs/auto-name.js.map +1 -1
  19. package/dist/runs/store.js +9 -34
  20. package/dist/runs/store.js.map +1 -1
  21. package/dist/server/capabilities.d.ts +0 -6
  22. package/dist/server/capabilities.js +0 -6
  23. package/dist/server/capabilities.js.map +1 -1
  24. package/dist/server/server.d.ts +0 -8
  25. package/dist/server/server.js +7 -146
  26. package/dist/server/server.js.map +1 -1
  27. package/dist/server-install/engine.d.ts +0 -5
  28. package/dist/server-install/engine.js +0 -6
  29. package/dist/server-install/engine.js.map +1 -1
  30. package/dist/server-install/platforms/ubuntu-vps.d.ts +2 -11
  31. package/dist/server-install/platforms/ubuntu-vps.js +10 -123
  32. package/dist/server-install/platforms/ubuntu-vps.js.map +1 -1
  33. package/dist/server-install/types.d.ts +0 -39
  34. package/dist/server-install/types.js +0 -13
  35. package/dist/server-install/types.js.map +1 -1
  36. package/dist/skills-remote.d.ts +0 -11
  37. package/dist/skills-remote.js +2 -31
  38. package/dist/skills-remote.js.map +1 -1
  39. package/dist/skills.d.ts +0 -29
  40. package/dist/skills.js +14 -72
  41. package/dist/skills.js.map +1 -1
  42. package/dist/workflows/run.d.ts +10 -50
  43. package/dist/workflows/run.js +103 -216
  44. package/dist/workflows/run.js.map +1 -1
  45. package/dist/workspace/config.d.ts +0 -30
  46. package/dist/workspace/config.js +0 -5
  47. package/dist/workspace/config.js.map +1 -1
  48. package/dist/workspace/projects-cli.d.ts +0 -2
  49. package/dist/workspace/projects-cli.js +4 -21
  50. package/dist/workspace/projects-cli.js.map +1 -1
  51. package/dist/workspace/projects.d.ts +1 -5
  52. package/dist/workspace/projects.js +8 -5
  53. package/dist/workspace/projects.js.map +1 -1
  54. package/dist/workspace/semaphore.d.ts +2 -53
  55. package/dist/workspace/semaphore.js +5 -93
  56. package/dist/workspace/semaphore.js.map +1 -1
  57. package/package.json +1 -1
  58. package/web/dist/assets/centered-state-zzWBfO_1.js +43 -0
  59. package/web/dist/assets/command-ylf8-fG0.js +1 -0
  60. package/web/dist/assets/compare-variants-BcR3zdtB.js +1 -0
  61. package/web/dist/assets/dialog-BYr_BAil.js +1 -0
  62. package/web/dist/assets/diff-view-DPCR7gon.js +4 -0
  63. package/web/dist/assets/{dist-CqH67S8q.js → dist-Cw_CDvC3.js} +1 -1
  64. package/web/dist/assets/dropdown-menu-C3GD8eLA.js +1 -0
  65. package/web/dist/assets/git-toolbar-CiMaCi03.js +1 -0
  66. package/web/dist/assets/github-BJEZbEOp.js +1 -0
  67. package/web/dist/assets/index-DmW_TYjO.js +16 -0
  68. package/web/dist/assets/index-Qbs-JRWQ.css +2 -0
  69. package/web/dist/assets/loader-circle-CGwIVNTv.js +1 -0
  70. package/web/dist/assets/{project-router-BaWVyqc8.js → project-router-CT8Rt5Eu.js} +1 -1
  71. package/web/dist/assets/prompt-templates-DW7_d8Ys.js +15 -0
  72. package/web/dist/assets/repo-git-BkmyKcvN.js +1 -0
  73. package/web/dist/assets/{run-diff-Cksr4Dk5.js → run-diff-CxIDdRwy.js} +2 -2
  74. package/web/dist/assets/run-header-8nwDIWWO.js +1 -0
  75. package/web/dist/assets/skill-empty-hint-Cl3ESoPu.js +1 -0
  76. package/web/dist/assets/skills-BIpb0mqO.js +1 -0
  77. package/web/dist/assets/{tab-link-vtgjgL_M.js → tab-link-C_bk_Kvn.js} +1 -1
  78. package/web/dist/assets/task-changes-D1bJx2uW.js +1 -0
  79. package/web/dist/assets/task-commits-DlhB21mR.js +1 -0
  80. package/web/dist/assets/task-files-ChJDOFg5.js +2 -0
  81. package/web/dist/assets/task-thread-J7ckxJJh.js +9 -0
  82. package/web/dist/assets/tasks-table--V1pKwuK.js +1 -0
  83. package/web/dist/assets/use-desktop-CuDnWju1.js +3 -0
  84. package/web/dist/assets/workflows-BksgdYAQ.js +11 -0
  85. package/web/dist/assets/x-DgoqYQOJ.js +1 -0
  86. package/web/dist/index.html +12 -6
  87. package/dist/core/v1-text-coalescer.d.ts +0 -36
  88. package/dist/core/v1-text-coalescer.js +0 -72
  89. package/dist/core/v1-text-coalescer.js.map +0 -1
  90. package/web/dist/assets/centered-state-CLmJ67EV.js +0 -43
  91. package/web/dist/assets/commit-list-CSaWuw-x.js +0 -1
  92. package/web/dist/assets/compare-variants-B5BlnpUb.js +0 -1
  93. package/web/dist/assets/diff-view-CYKPGL2w.js +0 -6
  94. package/web/dist/assets/git-toolbar-CDII-3Uv.js +0 -1
  95. package/web/dist/assets/github-C7SNDPf3.js +0 -1
  96. package/web/dist/assets/index-CcfkF2Ey.js +0 -30
  97. package/web/dist/assets/index-DzroxqBG.css +0 -2
  98. package/web/dist/assets/lib-DPEZDBUN.js +0 -1
  99. package/web/dist/assets/repo-git-4l-2tm7d.js +0 -1
  100. package/web/dist/assets/run-header-B3kW2sWC.js +0 -1
  101. package/web/dist/assets/skill-empty-hint-DTUSp6Vl.js +0 -1
  102. package/web/dist/assets/skills-D7hPgl4y.js +0 -1
  103. package/web/dist/assets/task-changes-DvIUGL9a.js +0 -1
  104. package/web/dist/assets/task-commits-QD2JI3zj.js +0 -1
  105. package/web/dist/assets/task-files-BE7JDEwK.js +0 -2
  106. package/web/dist/assets/task-thread-CRjuPhsl.js +0 -9
  107. package/web/dist/assets/textarea-Bj_LCreg.js +0 -1
  108. package/web/dist/assets/use-desktop-4e8LLqMG.js +0 -3
  109. package/web/dist/assets/workflows-bPYx0nbO.js +0 -11
@@ -0,0 +1,9 @@
1
+ import{a as e,o as t,s as n,u as r}from"./bundle-mjs-BegPhL5c.js";import{Ct as i,M as a,N as o,O as s,R as c,V as l,Z as u,a as d,at as f,bt as p,cn as m,ht as h,i as g,in as _,it as v,n as y,on as b,ot as x,q as S,t as C,un as w}from"./centered-state-zzWBfO_1.js";import{n as T,o as E,r as D,t as O}from"./utils-B8s5qIcK.js";import{c as k,l as A,n as ee,o as te,r as ne,s as re,t as ie}from"./run-header-8nwDIWWO.js";import{n as ae,t as oe}from"./loader-circle-CGwIVNTv.js";import{d as se,u as ce}from"./command-ylf8-fG0.js";import{n as le,t as ue}from"./trash-2-DAyZ0VSi.js";import{n as de}from"./tab-link-C_bk_Kvn.js";import{C as fe,E as pe,S as me,_ as he,b as ge,d as _e,f as ve,p as ye,y as be}from"./prompt-templates-DW7_d8Ys.js";import{t as xe}from"./git-pull-request-DnR8Xh4_.js";import{t as Se}from"./search-x-BDjaMrzG.js";import{t as Ce}from"./square-terminal-Ckjjn0vb.js";import{i as j,n as M,r as N,t as we}from"./run-diff-CxIDdRwy.js";import{t as Te}from"./project-router-CT8Rt5Eu.js";import{b as Ee,s as De}from"./tasks-table--V1pKwuK.js";import{B as Oe,E as ke,I as Ae,L as je,O as Me,R as Ne,T as Pe,a as Fe,dt as P,ft as Ie,ot as Le,pt as Re,x as F,z as ze}from"./index-DmW_TYjO.js";import{t as Be}from"./zoomable-image-PEDOqyLQ.js";var Ve=D(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),He=D(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),Ue=D(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),We=D(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),Ge=D(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),Ke=D(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),qe=D(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),I=r(n(),1),Je=[`run-event`,`ui-event`];function Ye(e){let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t||Array.isArray(t))return null;let{seq:n,type:r}=t;return typeof n!=`number`||typeof r!=`string`||r===``?null:t}function Xe(e){let[t,n]=(0,I.useState)([]);return(0,I.useEffect)(()=>{if(n([]),!e)return;let t=globalThis.EventSource;if(typeof t!=`function`)return;let r=0,i=null,a,o=!1,s=Date.now(),c,l=e=>{s=Date.now();let t=Ye(e.data);!t||!(t.seq>r)||(r=t.seq,n(e=>[...e,t]))},u=()=>{s=Date.now()},d=()=>{o||a!==void 0||(a=setTimeout(()=>{a=void 0,o||f()},1500))},f=()=>{i?.close(),s=Date.now(),i=new t(E(`/api/runs/${encodeURIComponent(e)}/events`));for(let e of Je)i.addEventListener(e,l);i.addEventListener(`ping`,u),i.addEventListener(`error`,()=>{i?.readyState===2&&d()})},p=()=>{document.visibilityState===`visible`&&(!i||i.readyState===2)&&(clearTimeout(a),a=void 0,f())},m=()=>{clearTimeout(a),a=void 0,i?.close()},h=e=>{e.persisted&&f()};return c=setInterval(()=>{o||document.visibilityState!==`visible`||Date.now()-s<=4e4||(clearTimeout(a),a=void 0,f())},1e4),document.addEventListener(`visibilitychange`,p),window.addEventListener(`pagehide`,m),window.addEventListener(`pageshow`,h),f(),()=>{o=!0,clearTimeout(a),clearInterval(c),document.removeEventListener(`visibilitychange`,p),window.removeEventListener(`pagehide`,m),window.removeEventListener(`pageshow`,h),i?.close()}},[e]),t}var Ze=e=>e.kind===`tool`,Qe=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,$e=(e,t,n)=>`${e} ${e===1?t:n}`;function et(e,t){let n=[];return e>0&&n.push($e(e,`file`,`files`)),t>0&&n.push($e(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function tt(e){return`${e} earlier tool call${e===1?``:`s`}`}var nt=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function rt(e){for(let t of nt)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}function it(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(Ze).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=(e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`)&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:et(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]};for(let e of i)Ze(e)&&Qe(e)&&!r.has(e.id)?o.push(e):(s(),Ze(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}));s();let c=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,l=e=>e.kind===`context-group`?e.tools.length:1,u=[],d=[],f=()=>{if(d.length>3){let e=d.slice(0,d.length-3);u.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+l(t),0),blocks:e}),u.push(...d.slice(d.length-3))}else u.push(...d);d=[]};for(let e of a)c(e)?d.push(e):(f(),u.push(e));return f(),u}var L=e(),at=new Map,ot=(0,I.createContext)(null);function st(){return(0,I.useContext)(ot)}function ct({runId:e,children:t}){let n=(0,I.useMemo)(()=>({get:t=>at.get(e)?.get(t),set:(t,n)=>{let r=at.get(e)??new Map;r.set(t,n),at.set(e,r)}}),[e]);return(0,L.jsx)(ot.Provider,{value:n,children:t})}function lt(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function ut(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var dt=new Map;function ft(e,t){dt.set(e,t)}function pt(e){return dt.get(e)}var mt=new Map;function ht(e,t){mt.set(e,t)}function gt(e,t){let n=mt.get(e);return n!==void 0&&n.rows===t?n.cache:void 0}function R({text:e,imageCount:t=0,images:n=[],onEdit:r,onRemove:i,editLabel:a=`Edit message`,removeLabel:o=`Remove message`}){let s=t-n.length,[c,l]=(0,I.useState)(!1),[u,d]=(0,I.useState)(e),[f,p]=(0,I.useState)(!1),[m,h]=(0,I.useState)(),g=()=>{d(e),h(void 0),l(!0)},_=async()=>{let t=u.trim();if(!t||t===e){l(!1);return}p(!0),h(void 0);try{await r?.(t),l(!1)}catch(e){h(e instanceof Error?e.message:`Could not save the message`)}finally{p(!1)}},v=async()=>{p(!0),h(void 0);try{await i?.()}catch(e){h(e instanceof Error?e.message:`Could not remove the message`)}finally{p(!1)}};return c?(0,L.jsxs)(`div`,{"data-slot":`user-bubble`,"data-editing":`true`,className:`max-w-[78%] self-end rounded-2xl rounded-br-md bg-muted px-[15px] py-2.5 text-[13.5px] leading-[1.55] md:max-w-[70%]`,children:[(0,L.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),l(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),_())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[13.5px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,L.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:()=>l(!1),disabled:f,className:`rounded-sm px-2 py-1 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>void _(),disabled:f,className:`rounded-sm bg-primary px-2 py-1 text-xs font-semibold text-primary-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:f?(0,L.jsx)(oe,{className:`size-3.5 animate-spin`}):`Save`})]}),m?(0,L.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:m}):null]}):(0,L.jsxs)(`div`,{"data-slot":`user-bubble`,className:`group max-w-[78%] min-w-0 self-end rounded-2xl rounded-br-md bg-muted px-[15px] py-2.5 text-[13.5px] leading-[1.55] md:max-w-[70%]`,children:[r||i?(0,L.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[r?(0,L.jsx)(`button`,{type:`button`,"aria-label":a,onClick:g,disabled:f,className:`rounded-sm p-1 text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,L.jsx)(Ke,{className:`size-3.5`})}):null,i?(0,L.jsx)(`button`,{type:`button`,"aria-label":o,onClick:()=>void v(),disabled:f,className:`rounded-sm p-1 text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,L.jsx)(ue,{className:`size-3.5`})}):null]}):null,m?(0,L.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:m}):null,(0,L.jsx)(F,{breaks:!0,children:e}),n.length>0?(0,L.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap justify-end gap-1.5`,children:n.map(e=>(0,L.jsx)(Be,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e))}):null,s>0?(0,L.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[s,` image`,s>1?`s`:``,` attached`]}):null]})}function _t({text:e}){return(0,L.jsx)(`div`,{"data-slot":`assistant-message`,className:`min-w-0 text-[15px] leading-[1.65]`,children:(0,L.jsx)(F,{children:e})})}function vt({note:e}){return(0,L.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:O(`px-0.5 text-xs`,e.tone===`danger`?`text-danger`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:`· `,e.text]})}function yt({text:e}){let t=(0,I.useId)();if(e.trim()===``)return null;let n=e.split(`
2
+ `,1)[0]??``,r=n.length<e.length;return(0,L.jsxs)(M,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,L.jsxs)(`div`,{id:t,className:`relative flex w-full items-center gap-1.5 rounded-md p-0.5 text-left text-[13px] text-soft-foreground hover:text-muted-foreground`,children:[(0,L.jsx)(P,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,L.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,L.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,L.jsx)(F,{inline:!0,children:n})}),r?(0,L.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,L.jsx)(j,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,L.jsx)(N,{children:(0,L.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,L.jsx)(F,{children:e})})})]})}function bt(){return(0,L.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex items-center gap-2 py-1 text-[13px] text-soft-foreground`,children:[(0,L.jsx)(oe,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,L.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`})]})}var xt={read:A,edit:Ke,delete:ue,move:Ue,search:ce,execute:Ce,think:Ve,fetch:k,task:Ie,plan:We,other:qe},St=e=>e.split(`
3
+ `).length;function Ct({text:e,streaming:t}){let[n,r]=(0,I.useState)(!1),i=(0,I.useRef)(null),a=(0,I.useRef)(!0);(0,I.useEffect)(()=>{let e=i.current;t&&e&&a.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let o=St(e),s=!t&&!n&&o>12;return(0,L.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":s?`true`:void 0,children:[(0,L.jsxs)(`div`,{className:`relative`,children:[(0,L.jsx)(`div`,{ref:i,onScroll:t?e=>{a.current=lt(e.currentTarget)}:void 0,className:O(`overflow-x-auto`,t&&`max-h-[216px] overflow-y-auto`,s&&`max-h-[216px] overflow-y-hidden`),children:(0,L.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),s?(0,L.jsx)(`div`,{"data-slot":`tool-output-fade`,"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-14 bg-gradient-to-b from-transparent to-card-2`}):null]}),!t&&o>12?(0,L.jsx)(`button`,{type:`button`,"data-slot":`tool-output-toggle`,onClick:()=>r(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-[11px] font-medium text-soft-foreground hover:text-foreground`,children:n?`Show less`:`Show all ${o} lines`}):null]})}function wt({diffs:e}){return(0,L.jsx)(L.Fragment,{children:e.map((e,t)=>(0,L.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,L.jsx)(`div`,{className:`border-b border-border/50 px-4 py-1.5 font-mono text-[11px] text-soft-foreground`,children:e.path}),(0,L.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...Tt(e.oldText).map((e,t)=>(0,L.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...Tt(e.newText).map((e,t)=>(0,L.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
4
+ `).map((e,t)=>(0,L.jsx)(Et,{text:e},t))})]},`${e.path}:${t}`))})}function Tt(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`
5
+ `)}function Et({text:e}){return(0,L.jsx)(`span`,{className:O(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del text-muted-foreground`,e.startsWith(`@@`)&&`text-soft-foreground`),children:e})}function Dt(e){return e.status===`failed`||e.toolKind===`execute`&&e.status===`running`&&e.output!==void 0}function z({item:e,nested:t=[],cacheKey:n}){let r=st(),[i,a]=(0,I.useState)(()=>n===void 0?null:r?.get(n)??null),o=e=>{n!==void 0&&r?.set(n,e),a(e)},s=e.status===`running`||e.status===`pending`,c=e.output!==void 0&&e.output!==``||e.error!==void 0&&e.error!==``||e.diffs!==void 0&&e.diffs.length>0||t.length>0,l=c&&(i??Dt(e)),{verb:u,detail:d}=rt(e.title),f=xt[e.toolKind]??qe;return(0,L.jsxs)(M,{"data-slot":`tool-card`,"data-status":e.status,"data-kind":e.toolKind,open:l,onOpenChange:o,className:O(`min-w-0 overflow-hidden rounded-md border bg-card`,e.status===`failed`?`border-danger/40`:`border-border`),children:[(0,L.jsxs)(j,{disabled:!c,className:`group flex min-h-[28px] w-full items-center gap-1.5 px-2.5 py-0.5 text-left text-[13px] enabled:hover:bg-muted`,children:[(0,L.jsx)(P,{"aria-hidden":!0,className:O(`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`,!c&&`invisible`)}),(0,L.jsx)(f,{"aria-hidden":!0,className:O(`size-3.5 shrink-0`,e.status===`failed`?`text-danger`:`text-muted-foreground`)}),(0,L.jsx)(`span`,{className:O(`shrink-0 font-semibold`,s&&`shimmer`,e.status===`failed`&&`text-danger`,e.status===`declined`&&`text-muted-foreground`),children:u}),d===void 0?null:(0,L.jsx)(`code`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:d}),(0,L.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[s?(0,L.jsx)(oe,{role:`status`,"aria-label":`Running`,className:`size-3.5 animate-spin text-soft-foreground`}):null,e.status===`failed`?(0,L.jsx)(`span`,{className:`text-xs text-danger`,children:`failed`}):null,e.status===`declined`?(0,L.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`declined`}):null,e.toolKind===`execute`&&typeof e.exitCode==`number`?(0,L.jsx)(`span`,{"data-slot":`tool-exit`,className:O(`rounded-full px-2 py-px font-mono text-[10.5px] font-semibold`,e.exitCode===0?`bg-success/10 text-success`:`bg-danger/10 text-danger`),children:e.exitCode}):null]})]}),(0,L.jsx)(N,{children:(0,L.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[e.error!==void 0&&e.error!==``?(0,L.jsx)(`div`,{"data-slot":`tool-error`,className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre-wrap text-danger`,children:e.error}):null,e.diffs!==void 0&&e.diffs.length>0?(0,L.jsx)(wt,{diffs:e.diffs}):null,e.output!==void 0&&e.output!==``?(0,L.jsx)(Ct,{text:e.output,streaming:s}):null,t.length>0?(0,L.jsx)(`div`,{"data-slot":`tool-nested`,className:`flex flex-col gap-2 border-l-2 border-border py-2.5 pr-3 pl-3 ml-4 my-2`,children:t.map(e=>(0,L.jsx)(Ot,{entry:e,scope:n},e.id))}):null]})})]})}function Ot({entry:e,scope:t}){switch(e.kind){case`message`:return(0,L.jsx)(_t,{text:e.text});case`reasoning`:return(0,L.jsx)(yt,{text:e.text});case`tool`:return(0,L.jsx)(z,{item:e,cacheKey:t===void 0?void 0:`${t}:${e.id}`});case`note`:return(0,L.jsx)(vt,{note:e});case`image`:return(0,L.jsx)(jt,{image:e});case`ask`:return null}}function kt({group:e,scope:t}){return(0,L.jsxs)(M,{"data-slot":`ctx-group`,className:`min-w-0`,children:[(0,L.jsxs)(j,{className:`group flex h-[34px] w-full items-center gap-2 rounded-md px-2 -mx-2 text-left text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,L.jsx)(P,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),e.label]}),(0,L.jsx)(N,{children:(0,L.jsx)(`div`,{className:`flex flex-col gap-1.5 pt-1.5 pl-4`,children:e.tools.map(e=>(0,L.jsx)(z,{item:e,cacheKey:t===void 0?void 0:`${t}:${e.id}`},e.id))})})]})}function At({count:e,children:t}){return(0,L.jsxs)(M,{"data-slot":`tool-streak`,className:`min-w-0`,children:[(0,L.jsxs)(j,{className:`group flex items-center gap-1.5 rounded-md p-0.5 text-left text-xs text-soft-foreground hover:text-muted-foreground`,children:[(0,L.jsx)(P,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),tt(e)]}),(0,L.jsx)(N,{children:(0,L.jsx)(`div`,{className:`flex flex-col gap-2 pt-2`,children:t})})]})}function jt({image:e}){return(0,L.jsx)(Be,{"data-slot":`thread-image`,src:e.url,alt:e.name??`image from the agent session`,className:`max-h-72 max-w-full self-start rounded-lg border border-border`})}function Mt({run:e}){let t=w(),n=c(),r=a(),i=v(),[o,l]=(0,I.useState)(null),[u,f]=(0,I.useState)(null),h=he(n.data?.checks??[]),_=e.runner??`claude`,y=fe(o,h,_),b=y===_&&e.model?{...r.data?.defaultModels,[y]:e.model}:r.data?.defaultModels,x=ge(y,i.data,[u,b?.[y]]),S=me(u,y,b,i.data),C=m({mutationFn:()=>p(e.id,{runner:o===null?void 0:y,model:u===null?void 0:S}),onSuccess:()=>t.invalidateQueries({queryKey:s.runs.all}),onError:e=>g(e.message,{tone:`danger`})});return re(e).continueRun?(0,L.jsxs)(`div`,{"data-slot":`follow-up-engine`,className:`flex flex-wrap items-center gap-1.5`,children:[h.length>1?(0,L.jsx)(ye,{runners:h,value:y,onPick:e=>{l(e),f(null)}}):null,(0,L.jsx)(ve,{slot:`follow-up-model-pill`,ariaLabel:`Model`,label:x.find(e=>e.id===S)?.label??`auto`,value:S,onPick:e=>f(e),options:x.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:be(y,i.data,i.isError)}),(0,L.jsxs)(d,{type:`button`,variant:`outline`,size:`sm`,disabled:C.isPending,onClick:()=>C.mutate(),children:[(0,L.jsx)(Le,{"aria-hidden":`true`,className:`size-3.5`}),`Continue`]})]}):null}var Nt=120,Pt=e=>e!==`pending`&&e!==`running`,Ft=e=>e.kind===`tool`&&e.toolKind===`task`,B=e=>Ft(e)&&e.parentItemId===void 0,It=e=>(e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`)&&!(e.kind===`tool`&&e.toolKind===`plan`);function Lt(e,t){for(let n=0;n<e.length;n+=1)if(e[n].items.some(e=>B(e)&&t.has(e.id)))return n;return 0}function Rt(e){let t=e.input;if(typeof t!=`object`||!t)return;let n=t;for(let e of[`subagent_type`,`subagentType`,`agent`]){let t=n[e];if(typeof t==`string`&&t.trim()!==``)return t.trim()}}function zt(e){if(e.kind===`tool`)return Bt(e.title);if(e.kind===`message`||e.kind===`reasoning`){let t=e.text.split(`
6
+ `);for(let e=t.length-1;e>=0;--e){let n=t[e].trim();if(n!==``)return Bt(n)}}}function Bt(e){return e.length>Nt?`${e.slice(0,Nt-1).trimEnd()}…`:e}function Vt(e,t=!1){let n=Kt(e,e=>e.items.some(B));if(n===-1)return[];let r=e=>!t&&!Pt(e.status),i=[];for(let t=n-1;t>=0;--t){let n=e[t].items.filter(B);if(n.length!==0){if(!n.some(r))break;i.unshift(...n)}}let a=[...i,...e[n].items.filter(B)];if(n!==e.length-1&&!a.some(r))return[];let o=new Set(a.map(e=>e.id)),s=i.length>0?Lt(e,o):n,c=new Map;for(let t=s;t<e.length;t+=1)for(let n of e[t].items){if(!It(n))continue;let e=n.parentItemId;if(e===void 0||!o.has(e))continue;let t=c.get(e);t?t.push(n):c.set(e,[n])}return a.map(e=>Ht(e,c.get(e.id)??[],t))}function Ht(e,t,n){let r={id:e.id,title:rt(e.title).detail??e.title,status:e.status,toolCalls:t.filter(e=>e.kind===`tool`).length},i=Rt(e);i!==void 0&&(r.agentType=i),n&&!Pt(e.status)&&(r.stalled=!0);for(let e=t.length-1;e>=0;--e){let n=zt(t[e]);if(n!==void 0){r.activity=n;break}}return r}function Ut(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.length}}function Wt(e){return e.activity??(e.stalled===!0?`never finished`:`starting…`)}function Gt(e){return e.find(e=>!Pt(e.status))??e[0]}function Kt(e,t){for(let n=e.length-1;n>=0;--n)if(t(e[n]))return n;return-1}function qt(e,t,n=!1){for(let r=e.length-1;r>=0;--r){let i=e[r].items.find(e=>e.id===t&&B(e));if(i!==void 0)return Ht(i,Jt(e,t),n)}}function Jt(e,t){let n=e.findIndex(e=>e.items.some(e=>e.id===t&&B(e)));if(n===-1)return[];let r=[];for(let i=n;i<e.length;i+=1)for(let n of e[i].items)It(n)&&n.parentItemId===t&&n.id!==t&&r.push(n);return r}var Yt=new Map;function Xt(){return typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 768px)`).matches}function Zt({runId:e,agents:t,onSelect:n}){let[r,i]=(0,I.useState)(()=>Yt.get(e)??Xt());if(t.length===0)return null;let{done:a,total:o}=Ut(t),s=Gt(t);return(0,L.jsxs)(`section`,{"data-slot":`agents-dock`,"data-state":r?`open`:`collapsed`,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card shadow-xs`,children:[(0,L.jsx)(`div`,{"aria-hidden":!0,"data-slot":`grad-edge`,className:`h-[3px]`,style:{background:`var(--grad)`}}),(0,L.jsxs)(`button`,{type:`button`,onClick:()=>i(t=>(Yt.set(e,!t),!t)),"aria-expanded":r,className:O(`flex w-full items-center gap-2 px-3.5 text-left text-[13px]`,r?`pt-2 pb-1.5`:`py-2`),children:[(0,L.jsx)(Ie,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,L.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Agents`}),(0,L.jsxs)(`span`,{"data-slot":`agents-count`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[`· `,a,`/`,o]}),!r&&s!==void 0?(0,L.jsxs)(`span`,{"data-slot":`agents-current`,className:`min-w-0 truncate text-muted-foreground`,children:[`— `,Wt(s)]}):null,(0,L.jsx)(se,{"aria-hidden":!0,className:O(`ml-auto size-3.5 shrink-0 text-soft-foreground transition-transform`,!r&&`rotate-180`)})]}),r?(0,L.jsx)(`ul`,{"data-slot":`agents-list`,className:`flex flex-col gap-[7px] px-3.5 pb-3`,children:t.map(e=>(0,L.jsx)(Qt,{agent:e,onSelect:n},e.id))}):null]})}function Qt({agent:e,onSelect:t}){let n=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)($t,{status:e.status,stalled:e.stalled===!0}),(0,L.jsx)(`span`,{className:`min-w-0 shrink truncate font-medium`,children:e.title}),e.agentType===void 0?null:(0,L.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:e.agentType}),(0,L.jsx)(`span`,{"data-slot":`agent-activity`,className:`min-w-0 flex-1 truncate text-muted-foreground`,children:Wt(e)}),(0,L.jsxs)(`span`,{"data-slot":`agent-tools`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[e.toolCalls,` `,e.toolCalls===1?`tool`:`tools`]})]});return(0,L.jsx)(`li`,{"data-slot":`agent-item`,"data-status":e.status,className:`min-w-0 text-[13px]`,children:t?(0,L.jsx)(`button`,{type:`button`,onClick:()=>t(e.id),"aria-haspopup":`dialog`,className:`flex min-h-5 w-full min-w-0 items-center gap-2.5 rounded-sm text-left hover:bg-muted/50`,children:n}):(0,L.jsx)(`div`,{className:`flex min-h-5 min-w-0 items-center gap-2.5`,children:n})})}function $t({status:e,stalled:t=!1}){return t?(0,L.jsx)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,"data-stalled":`true`,className:`size-[15px] shrink-0 text-soft-foreground`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeDasharray:`3 2.5`,children:(0,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})}):e===`completed`?(0,L.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 text-success`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,L.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`failed`||e===`declined`?(0,L.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 text-danger`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,L.jsx)(`path`,{d:`m9 9 6 6M15 9l-6 6`})]}):(0,L.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 animate-pulse motion-reduce:animate-none`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,L.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,L.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]})}var en=new Map;function tn(){return typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 768px)`).matches}function nn(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.filter(e=>e.status!==`cancelled`).length}}function rn(e){return e.find(e=>e.status===`in_progress`)??e.find(e=>e.status===`pending`)}function an({runId:e,entries:t}){let[n,r]=(0,I.useState)(()=>en.get(e)??tn());if(t.length===0)return null;let{done:i,total:a}=nn(t),o=rn(t);return(0,L.jsxs)(`section`,{"data-slot":`plan-dock`,"data-state":n?`open`:`collapsed`,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card shadow-xs`,children:[(0,L.jsx)(`div`,{"aria-hidden":!0,"data-slot":`grad-edge`,className:`h-[3px]`,style:{background:`var(--grad)`}}),(0,L.jsxs)(`button`,{type:`button`,onClick:()=>r(t=>(en.set(e,!t),!t)),"aria-expanded":n,className:O(`flex w-full items-center gap-2 px-3.5 text-left text-[13px]`,n?`pt-2 pb-1.5`:`py-2`),children:[(0,L.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Plan`}),(0,L.jsxs)(`span`,{"data-slot":`plan-count`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[`· `,i,`/`,a]}),!n&&o!==void 0?(0,L.jsxs)(`span`,{"data-slot":`plan-current`,className:`min-w-0 truncate text-muted-foreground`,children:[`— `,o.activeForm??o.content]}):null,(0,L.jsx)(se,{"aria-hidden":!0,className:O(`ml-auto size-3.5 shrink-0 text-soft-foreground transition-transform`,!n&&`rotate-180`)})]}),n?(0,L.jsx)(`ul`,{"data-slot":`plan-list`,className:`flex flex-col gap-[7px] px-3.5 pb-3`,children:t.map((e,t)=>(0,L.jsx)(on,{entry:e},`${t}:${e.content}`))}):null]})}function on({entry:e}){return(0,L.jsxs)(`li`,{"data-slot":`plan-item`,"data-status":e.status,className:O(`flex min-h-5 min-w-0 items-center gap-2.5 text-[13px]`,e.status===`completed`&&`text-soft-foreground line-through`,e.status===`in_progress`&&`font-medium`,e.status===`pending`&&`text-muted-foreground`,e.status===`cancelled`&&`text-soft-foreground/70 line-through`),children:[(0,L.jsx)(sn,{status:e.status}),(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:e.content}),e.status===`in_progress`?(0,L.jsx)(`span`,{"data-slot":`plan-tag`,className:`ml-auto shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:`in progress`}):null]})}function sn({status:e}){return e===`cancelled`?(0,L.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-soft-foreground/70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`,opacity:`.5`}),(0,L.jsx)(`path`,{d:`m8.5 15.5 7-7`})]}):e===`completed`?(0,L.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-success`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,L.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`in_progress`?(0,L.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 animate-pulse motion-reduce:animate-none`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,L.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,L.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]}):(0,L.jsx)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-soft-foreground`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})})}function cn({agent:e,entries:t,onClose:n}){return(0,L.jsx)(Ae,{open:e!==void 0,onOpenChange:e=>{e||n()},children:(0,L.jsx)(je,{"data-slot":`subagent-sheet`,side:`right`,className:`w-full gap-0 p-0 sm:max-w-xl`,children:e===void 0?null:(0,L.jsx)(ln,{agent:e,entries:t})})})}function ln({agent:e,entries:t}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(ze,{className:`gap-1.5 border-b border-border px-5 py-4`,children:[(0,L.jsxs)(Oe,{className:`flex min-w-0 items-center gap-2 pr-8 text-[15px]`,children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title}),e.agentType===void 0?null:(0,L.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:e.agentType})]}),(0,L.jsxs)(Ne,{"data-slot":`subagent-meta`,className:`flex items-center gap-2 text-xs`,children:[(0,L.jsx)(dn,{status:e.status}),(0,L.jsxs)(`span`,{className:`tabular-nums`,children:[e.toolCalls,` `,e.toolCalls===1?`tool call`:`tool calls`]})]})]}),(0,L.jsx)(un,{entries:t,scope:e.id})]})}function un({entries:e,scope:t}){let n=(0,I.useRef)(null),r=(0,I.useRef)(!0);return(0,I.useEffect)(()=>{let e=n.current;e===null||!r.current||(e.scrollTop=e.scrollHeight)},[e.reduce((e,t)=>e+(t.kind===`message`||t.kind===`reasoning`?t.text.length:t.kind===`tool`?(t.output?.length??0)+(t.error?.length??0):0),e.length)]),e.length===0?(0,L.jsx)(`div`,{"data-slot":`subagent-empty`,className:`px-5 py-6 text-[13px] text-muted-foreground`,children:`No attributed output — see the thread card for this agent's result.`}):(0,L.jsx)(`div`,{ref:n,"data-slot":`subagent-stream`,onScroll:e=>{let t=e.currentTarget;r.current=t.scrollHeight-t.scrollTop-t.clientHeight<24},className:`flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto px-5 py-4`,children:e.map(e=>(0,L.jsx)(Ot,{entry:e,scope:`subagent:${t}`},e.id))})}function dn({status:e}){let t=e===`completed`?`Completed`:e===`failed`?`Failed`:e===`declined`?`Declined`:e===`pending`?`Pending`:`Running`;return(0,L.jsx)(`span`,{"data-slot":`subagent-status`,"data-status":e,className:O(`rounded-full px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] uppercase`,e===`completed`&&`bg-success/15 text-success`,(e===`failed`||e===`declined`)&&`bg-danger/15 text-danger`,(e===`running`||e===`pending`)&&`bg-muted text-muted-foreground`),children:t})}function fn({run:e}){return(0,L.jsxs)(`section`,{"data-slot":`review-panel`,"aria-label":`Review the changes`,className:`flex flex-col gap-3`,children:[(0,L.jsxs)(`div`,{"data-slot":`review-banner`,className:`flex items-center gap-2.5 rounded-md border border-violet/30 bg-violet/10 px-3.5 py-2.5`,children:[(0,L.jsx)(pe,{className:`size-4 shrink-0 text-violet`,"aria-hidden":`true`}),(0,L.jsxs)(`p`,{className:`min-w-0 text-[13px]`,children:[(0,L.jsx)(`span`,{className:`font-semibold`,children:`Review the changes before anything lands.`}),` `,(0,L.jsx)(`span`,{className:`text-muted-foreground`,children:`Read the diff, send notes back, draft a PR — or accept. Nothing merges on its own.`})]})]}),(0,L.jsx)(we,{runId:e.id}),(0,L.jsx)(pn,{run:e})]})}function pn({run:e}){let t=w(),n=(0,I.useRef)(null),[r,a]=(0,I.useState)(``),[o,c]=(0,I.useState)(null),l=ee(e.id),u=()=>t.invalidateQueries({queryKey:s.runs.all}),f=m({mutationFn:t=>p(e.id,{text:`Review feedback:\n${t}`}),onSuccess:()=>{a(``),u()},onError:e=>g(e.message,{tone:`danger`})}),_=m({mutationFn:()=>i(e.id),onSuccess:e=>{g(`Draft PR created — ${e.url}`),u()},onError:e=>{e instanceof h&&e.manual!==void 0&&c(e.manual),g(e.message,{tone:`danger`})}}),v=()=>{let e=r.trim();if(e.length===0){g(`Write what to change first.`),n.current?.focus();return}f.mutate(e)};return(0,L.jsxs)(`div`,{"data-slot":`review-actions`,className:`flex flex-col gap-2`,children:[(0,L.jsx)(Me,{ref:n,"data-slot":`review-notes`,"aria-label":`Notes for the agent`,placeholder:`Notes for the agent — what should change?`,rows:2,value:r,onChange:e=>a(e.target.value),onKeyDown:e=>{ke({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(),v())},className:`min-h-[52px] text-[13px]`}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsxs)(d,{"data-slot":`review-send-back`,variant:`outline`,size:`sm`,title:`Send the notes back into the agent's session`,disabled:f.isPending,onClick:v,children:[(0,L.jsx)(He,{"aria-hidden":`true`}),`Send back`]}),T(e.pullRequestUrl)?(0,L.jsx)(d,{asChild:!0,variant:`outline`,size:`sm`,children:(0,L.jsxs)(`a`,{"data-slot":`pr-link`,href:e.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,title:`The PR for this task is already open`,children:[(0,L.jsx)(de,{"aria-hidden":`true`}),`PR ↗`]})}):(0,L.jsxs)(d,{"data-slot":`review-draft-pr`,variant:`outline`,size:`sm`,title:`Push the branch and open a draft PR`,disabled:_.isPending,onClick:()=>_.mutate(),children:[(0,L.jsx)(xe,{"aria-hidden":`true`}),`Draft PR`]}),(0,L.jsxs)(d,{"data-slot":`review-accept`,variant:`contrast`,size:`sm`,className:`ml-auto`,title:ne(`review`),disabled:l.isPending,onClick:()=>l.mutate(),children:[(0,L.jsx)(ae,{"aria-hidden":`true`}),`Accept`]})]}),o===null?null:(0,L.jsx)(mn,{command:o})]})}function mn({command:e}){return(0,L.jsxs)(`button`,{type:`button`,"data-slot":`review-manual`,title:`Copy the command`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>g(`Command copied to clipboard.`)).catch(()=>g(`Run manually: ${e}`))},className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1 py-0.5 text-left font-mono text-[11px] text-soft-foreground hover:bg-muted hover:text-foreground`,children:[(0,L.jsx)(le,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,L.jsxs)(`span`,{className:`truncate`,children:[`manual path: `,e]})]})}function hn(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var gn=1500;function _n({status:e}){let t=(0,I.useRef)(e),[n,r]=(0,I.useState)(!1);return(0,I.useEffect)(()=>{let n=t.current;if(t.current=e,n!==`review`||e!==`done`||hn())return;r(!0);let i=setTimeout(()=>r(!1),gn);return()=>clearTimeout(i)},[e]),n?(0,L.jsxs)(`div`,{"data-slot":`accept-celebration`,"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 isolate z-40`,children:[(0,L.jsx)(y,{}),(0,L.jsx)(`div`,{className:`flex justify-center pt-24`,children:(0,L.jsx)(`span`,{className:`rounded-full border border-violet/30 bg-violet/15 px-4 py-1.5 text-[13px] font-medium text-violet shadow-modal`,children:`✓ Changes accepted`})})]}):null}function vn(e,t){return`${e.header}: ${t.join(`, `)}`}function yn({ask:e,runId:t}){let n=x(t),r=e.questions,i=r.length===1&&r[0]?.multiSelect!==!0,[a,o]=(0,I.useState)({});if(e.resolved)return(0,L.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`true`,className:`rounded-lg border border-border bg-card px-3.5 py-2.5 text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`text-soft-foreground`,children:`Answered`}),e.answer?(0,L.jsx)(`span`,{className:`ml-1.5 whitespace-pre-line text-foreground`,children:e.answer}):null]});let s=(e,t)=>o(n=>({...n,[e]:t})),c=r.every((e,t)=>(a[t]?.length??0)>0);return(0,L.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,className:`rounded-lg border border-primary/25 bg-primary/[0.04] px-4 pt-3.5 pb-3.5`,children:[(0,L.jsx)(`div`,{className:`mb-2.5 flex items-center gap-2`,children:(0,L.jsx)(`span`,{className:`text-xs font-medium text-primary`,children:`The agent is asking`})}),(0,L.jsx)(`div`,{className:`flex flex-col gap-4`,children:r.map((e,t)=>(0,L.jsx)(bn,{question:e,disabled:n.isPending,selected:a[t]??[],onSelect:r=>{i?n.mutateAsync({text:vn(e,r)}):s(t,r)}},e.id??t))}),i?null:(0,L.jsxs)(`div`,{className:`mt-3 flex items-center gap-2.5`,children:[(0,L.jsx)(d,{size:`sm`,disabled:n.isPending||!c,onClick:()=>void n.mutateAsync({text:r.map((e,t)=>vn(e,a[t]??[])).join(`
7
+ `)}),children:`Send answer`}),(0,L.jsxs)(`span`,{className:`text-[11.5px] text-soft-foreground`,children:[r.length>1?`answer each question`:`pick one or more`,` — or type a reply below`]})]})]})}function bn({question:e,disabled:t,selected:n,onSelect:r}){let i=e.multiSelect===!0,a=e=>{if(!i){r([e]);return}r(n.includes(e)?n.filter(t=>t!==e):[...n,e])};return(0,L.jsxs)(`div`,{role:`group`,"aria-label":e.question,children:[(0,L.jsxs)(`div`,{className:`mb-0.5 flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`rounded-md bg-primary px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-primary-foreground`,children:e.header}),i?(0,L.jsx)(`span`,{className:`ml-auto text-[10.5px] text-soft-foreground`,children:`select all that apply`}):null]}),(0,L.jsx)(`p`,{className:`mb-2.5 text-sm font-semibold text-foreground`,children:e.question}),(0,L.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.options.map(e=>{let r=n.includes(e.label);return(0,L.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":r,onClick:()=>a(e.label),className:O(`flex w-full flex-col gap-0.5 rounded-md border px-3.5 py-2.5 text-left transition-colors`,`hover:border-primary/50 hover:bg-primary/[0.06] disabled:pointer-events-none disabled:opacity-50`,r?`border-primary/60 bg-primary/[0.06]`:`border-border bg-card`),children:[(0,L.jsxs)(`span`,{className:`flex items-center gap-2 text-[13.5px] font-semibold text-foreground`,children:[i?(0,L.jsx)(`span`,{"aria-hidden":!0,className:O(`flex size-4 items-center justify-center rounded border text-[10px]`,r?`border-primary bg-primary text-primary-foreground`:`border-soft-foreground`),children:r?`✓`:``}):null,e.label]}),e.description?(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.description}):null]},e.label)})})]})}var xn=r(t(),1),V=null,{min:H,max:U,abs:Sn,floor:Cn}=Math,wn=(e,t,n)=>H(n,U(t,e)),Tn=e=>[...e].sort((e,t)=>e-t),En=typeof queueMicrotask==`function`?queueMicrotask:e=>{Promise.resolve().then(e)},Dn=()=>{let e;return[new Promise(t=>{e=t}),e]},On=e=>{let t;return()=>(e&&=(t=e(),void 0),t)},W=(e,t,n)=>{let r=n?`unshift`:`push`;for(let n=0;n<t;n++)e[r](-1);return e},kn=(e,t)=>{let n=e.t[t];return n===-1?e.o:n},An=(e,t,n)=>{let r=e.t[t]===-1;return e.t[t]=n,e.i=H(t,e.i),r},G=(e,t)=>{if(!e.l)return 0;if(e.i>=t)return e.u[t];e.i<0&&(e.u[0]=0,e.i=0);let n=e.i,r=e.u[n];for(;n<t;)r+=kn(e,n),e.u[++n]=r;return e.i=t,r},K=(e,t,n=0,r=e.l-1)=>{let i=n;for(;n<=r;){let a=Cn((n+r)/2);G(e,a)<=t?(i=a,n=a+1):r=a-1}return wn(i,0,e.l-1)},jn=(e,t,n)=>{let r=t-e.l;return e.i=n?-1:H(t-1,e.i),e.l=t,r>0?(W(e.u,r),W(e.t,r,n),e.o*r):(e.u.splice(r),(n?e.t.splice(0,-r):e.t.splice(r)).reduce((t,n)=>t-(n===-1?e.o:n),0))},Mn=typeof window<`u`,Nn=e=>e.documentElement,Pn=e=>e.ownerDocument,Fn=e=>e.defaultView,In=On(()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>0),Ln=On(()=>`scrollBehavior`in Nn(document).style),Rn=e=>U(e.h(),e.p()),zn=(e,t=40,n=0,r,i=!1)=>{let a=!!n,o=1,s=0,c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=V,g=[0,a?U(n-1,0):-1],_=0,v=!1,y=((e,t,n)=>({o:t,t:n?W(n.slice(0,H(e,n.length)),U(0,e-n.length)):W([],e),l:e,i:-1,u:W([],e+1)}))(e,r?r[1]:t,r&&r[0]),b=new Set,x=()=>l-c,S=()=>x()+d+u,C=(e,t)=>((e,t,n,r)=>{if(r=H(r,e.l-1),G(e,r)<=t){let i=K(e,n,r);return[K(e,t,r,i),i]}{let i=K(e,t,void 0,r);return[i,K(e,n,i)]}})(y,e,t,g[0]),w=()=>G(y,y.l),T=(e,t)=>{let n=G(y,e)-d;return t?w()-n-E(e):n},E=e=>kn(y,e),D=(e,t=-1)=>y.t[e]===t,O=e=>{e&&(In()&&p!==0||h&&m===1?d+=e:u+=e)};return{v:()=>{b.clear()},m:()=>o,_:()=>(e=>[e.t.slice(),e.o])(y),S:(e=200)=>{if(!v||a)return g;let t,n;if(f)[t,n]=g;else{let r=U(0,S()),a=r+s;i||(e=U(0,e),p!==1&&(r-=e),p!==2&&(a+=e)),[t,n]=g=C(U(0,r),U(0,a)),h&&(t=H(t,h[0]),n=U(n,h[1]))}return[U(t,0),H(n,y.l-1)]},$:e=>K(y,e-c),I:D,k:T,R:E,T:()=>y.l,C:()=>l,M:()=>p!==0,p:()=>s,O:()=>c,h:w,H:()=>(f=u,u=0,[f,m===2]),W:(e,t)=>{let n=[e,t];return b.add(n),()=>{b.delete(n)}},B:(e,t)=>{let n,r,g=0;switch(e){case 1:{if(t===l&&m===0)break;let e=f;f=0;let n=t-l,i=Sn(n);e&&i<Sn(e)+1||m!==0||(p=n<0?2:1),a&&=!1,l=t,g=4;let o=x();o>=-s&&o<=w()&&(g+=1,r=i>s);break}case 2:g=8,p!==0&&(n=!0,g+=1),p=0,m=0,h=V;break;case 3:{let e=t.filter(([e,t])=>!D(e,t));if(!e.length)break;O(e.reduce((e,[t,n])=>{let r;if(m===2)r=!0;else if(h&&m===1)r=t<h[0];else{let e=x(),n=T(t),i=E(t);r=p!==1&&m===0?n+i<=e:n<e&&n+i<e+s}return r&&(e+=n-E(t)),e},0));for(let[t,n]of e){let e=E(t),r=An(y,t,n);i&&(_+=r?n:n-e)}i&&s&&_>s&&(O(((e,t)=>{let n=0,r=[];e.t.forEach((e,i)=>{e!==-1&&(r.push(e),i<t&&n++)}),e.i=-1;let i=Tn(r),a=i.length,o=a/2|0,s=a%2==0?(i[o-1]+i[o])/2:i[o],c=e.o;return((e.o=s)-c)*U(t-n,0)})(y,K(y,S()))),i=!1),g=3,r=!0;break}case 4:s!==t&&(s||(v=r=!0),s=t,g=3);break;case 5:t[1]?(O(jn(y,t[0],!0)),m=2,g=1):(jn(y,t[0]),g=1);break;case 6:c=t;break;case 7:m=1;break;case 8:h=C(t,t+s),g=1}g&&(o=1+(2147483647&o),n&&d&&(u+=d,d=0),b.forEach(([e,t])=>{g&e&&t(r)}))}}},Bn=setTimeout,Vn=(e,t)=>t?-e:e,Hn=(e,t,n,r,i,a)=>{let o=Date.now,s=0,c=!1,l=!1,u=!1,d=!1,f=(()=>{let t,n=()=>{t!=V&&clearTimeout(t)},r=()=>{n(),t=Bn(()=>{t=V,(()=>{if(c||l)return c=!1,void f();u=!1,e.B(2)})()},150)};return r.J=n,r})(),p=()=>{s=o(),u&&(d=!0),a&&e.B(6,a()),e.B(1,r()),f()},m=t=>{if(c||!e.M()||t.ctrlKey)return;let r=o()-s;150>r&&50<r&&(n?t.deltaX:t.deltaY)&&(c=!0)},h=()=>{l=!0,u=d=!1},g=()=>{l=!1,In()&&(u=!0)};return t.addEventListener(`scroll`,p),t.addEventListener(`wheel`,m,{passive:!0}),t.addEventListener(`touchstart`,h,{passive:!0}),t.addEventListener(`touchend`,g,{passive:!0}),{A:()=>{t.removeEventListener(`scroll`,p),t.removeEventListener(`wheel`,m),t.removeEventListener(`touchstart`,h),t.removeEventListener(`touchend`,g),f.J()},L:()=>{let[t,n]=e.H();t&&(i(t,n,d),d=!1,n&&e.p()>e.h()&&e.B(1,r()))}}},Un=(e,t,n)=>{let r;return[async(i,a)=>{if(!await t())return;r&&r();let o=()=>{let[t,n]=Dn();return r=()=>{n(!1)},e.p()&&Bn(r,150),[t,e.W(2,()=>{n(!0)})]};if(a&&Ln())e.B(8,i()),En(async()=>{for(;;){let t=!0;for(let[n,r]=e.S();n<=r;n++)if(e.I(n)){t=!1;break}if(t)break;let[n,r]=o();try{if(!await n)return}finally{r()}}e.B(7),n(i(),a)});else for(;;){let[t,r]=o();try{if(e.B(7),n(i()),!await t)return}finally{r()}}},()=>{r&&r()}]},Wn=(e,t)=>{let n,r,i=Dn(),a=!1,o=t?`scrollLeft`:`scrollTop`,s=t?`overflowX`:`overflowY`,[c,l]=Un(e,()=>i[0],(e,r)=>{e=Vn(e,a),r?n.scrollTo({[t?`left`:`top`]:e,behavior:`smooth`}):n[o]=e});return{N(c,u){n=u,t&&(a=getComputedStyle(u).direction===`rtl`),r=Hn(e,u,t,()=>Vn(u[o],a),(t,n,r)=>{if(r){let e=u.style,t=e[s];e[s]=`hidden`,Bn(()=>{e[s]=t})}u[o]=Vn(e.C()+t,a),n&&l()}),i[1](!0)},v(){r&&r.A(),i[1](!1),i=Dn()},P:()=>a,V(e){c(()=>e)},X(t){t+=e.C(),c(()=>t)},Y(t,{align:n,smooth:r,offset:i=0}={}){if(t=wn(t,0,e.T()-1),n===`nearest`){let r=e.k(t),i=e.C();if(r<i)n=`start`;else{if(!(r+e.R(t)>i+e.p()))return;n=`end`}}c(()=>i+e.O()+e.k(t)+(n===`end`?e.R(t)-e.p():n===`center`?(e.R(t)-e.p())/2:0),r)},q:()=>{r&&r.L()}}},Gn=e=>{let t;return{j(n){(t||=new(Fn(Pn(n))).ResizeObserver(e)).observe(n)},D(e){t.unobserve(e)},A(){t&&t.disconnect()}}},Kn=(e,t)=>{let n,r=t?`width`:`height`,i=new WeakMap,a=Gn(t=>{let a=[];for(let{target:o,contentRect:s}of t)if(o.offsetParent)if(o===n)e.B(4,s[r]);else{let e=i.get(o);e!=V&&a.push([e,s[r]])}a.length&&e.B(3,a)});return{G(e){a.j(n=e)},U:(e,t)=>(i.set(e,t),a.j(e),()=>{i.delete(e),a.D(e)}),v:a.A}},q=Mn?I.useLayoutEffect:I.useEffect,J=`current`,qn=(e,t)=>{if(Array.isArray(e))for(let n of e)qn(n,t);else e==null||typeof e==`boolean`||t.push(e)},Jn=(e,t)=>e.key??`_`+t,Yn=e=>{let t=(0,I.useRef)(null);return t[J]||(t[J]=e())},Xn=e=>{let t=(0,I.useRef)(e);return q(()=>{t[J]=e},[e]),t},Zn=(0,I.memo)(({Z:e,ee:t,te:n,oe:r,ne:i,re:a,se:o,ie:s})=>{let c=(0,I.useRef)(null);q(()=>t(c[J],n),[n]);let l=(0,I.useMemo)(()=>{let e={contain:`layout style`,position:i&&s?void 0:`absolute`,[o?`height`:`width`]:`100%`,[o?`top`:`left`]:0,[o?`left`:`top`]:r,visibility:!i||s?void 0:`hidden`};return o&&(e.display=`inline-flex`),e},[r,i,s,o]);return(0,L.jsx)(a,typeof a==`string`?{ref:c,style:l,children:e}:{ref:c,style:l,index:n,children:e})}),Qn=(e,t)=>(0,I.useMemo)(()=>{if(typeof e==`function`)return[n=>e(t[n],n),t.length];let n=(e=>{let t=[];return qn(e,t),t})(e);return[e=>n[e],n.length]},[e,t]),$n=(0,I.forwardRef)(({children:e,data:t,bufferSize:n,itemSize:r,shift:i,horizontal:a,keepMounted:o,cache:s,startMargin:c=0,ssrCount:l,as:u=`div`,item:d=`div`,scrollRef:f,onScroll:p,onScrollEnd:m},h)=>{let[g,_]=Qn(e,t),v=(0,I.useRef)(null),y=(0,I.useRef)(!!l),b=Xn(p),x=Xn(m),[S,C,w,T]=Yn(()=>{let e=!!a,t=zn(_,r,l,s,!r);return[t,Kn(t,e),Wn(t,e),e]});_!==S.T()&&S.B(5,[_,i]),c!==S.O()&&S.B(6,c);let[E,D]=(0,I.useReducer)(S.m,void 0,S.m),O=S.M(),k=S.h(),A=w.P(),ee=[],te=e=>{let t=g(e);return(0,L.jsx)(Zn,{ee:C.U,te:e,oe:S.k(e,A),ne:S.I(e),re:d,Z:t,se:T,ie:y[J]},Jn(t,e))};if(q(()=>{y[J]=!1,S.W(1,e=>{e?(0,xn.flushSync)(D):D()}),S.W(4,()=>{b[J]&&b[J](S.C())}),S.W(8,()=>{x[J]&&x[J]()});let e=v[J],t=t=>{C.G(t),w.N(e,t)};return f?En(()=>{f[J]&&t(f[J])}):t(e.parentElement),()=>{S.v(),C.v(),w.v()}},[]),q(()=>{w.q()},[E]),(0,I.useImperativeHandle)(h,()=>({get cache(){return S._()},get scrollOffset(){return S.C()},get scrollSize(){return Rn(S)},get viewportSize(){return S.p()},findItemIndex:S.$,getItemOffset:S.k,getItemSize:S.R,scrollToIndex:w.Y,scrollTo:w.V,scrollBy:w.X}),[]),o){let e=new Set(o);for(let[t,r]=S.S(n);t<=r;t++)e.add(t);Tn([...e]).forEach(e=>{ee.push(te(e))})}else for(let[e,t]=S.S(n);e<=t;e++)ee.push(te(e));return(0,L.jsx)(u,{ref:v,style:{contain:`size style`,overflowAnchor:`none`,flex:`none`,position:`relative`,width:T?k:`100%`,height:T?`100%`:k,pointerEvents:O?`none`:void 0},children:ee})});function er(e){let t=(0,I.useRef)(null),[n,r]=(0,I.useState)(null),[i,a]=(0,I.useState)(!1),o=(0,I.useRef)(!0),s=(0,I.useRef)(null),c=(0,I.useRef)(null),l=(0,I.useRef)(null),u=(0,I.useCallback)(e=>{r(e),e&&(t.current=e.closest(`[data-slot="main"]`))},[]),d=(0,I.useCallback)(e=>{let n=t.current;if(!n)return;let r=l.current;r?r.scrollTo(e):n.scrollTop=e},[]),f=(0,I.useCallback)(()=>{let e=t.current;e&&d(e.scrollHeight-e.clientHeight)},[d]),p=(0,I.useCallback)(()=>{o.current&&f()},[f]),m=(0,I.useCallback)(()=>{let e=t.current;e&&(s.current=null,o.current=!0,e.scrollTo({top:e.scrollHeight-e.clientHeight,behavior:`smooth`}))},[]);return(0,I.useEffect)(()=>{let r=t.current,i=n;if(!r||!i)return;if(c.current!==e){c.current=e;let t=pt(e);t&&!t.atBottom?(o.current=!1,s.current=t.top,r.scrollTop=t.top):(o.current=!0,f())}let l=0,u=null,p=()=>{s.current=null,o.current=!1,l=0},m=()=>{l=Date.now()},h=e=>{e.deltaY<0?p():m()},g=e=>{[`ArrowUp`,`PageUp`,`Home`].includes(e.key)?p():[`ArrowDown`,`PageDown`,`End`].includes(e.key)&&m()},_=()=>{lt(r,80)||(p(),m())},v=e=>{u=e.touches[0]?.clientY??null},y=e=>{let t=e.touches[0]?.clientY;t!==void 0&&(u!==null&&t>u+1?p():u!==null&&t<u-1&&m(),u=t)},b=()=>{let t=lt(r,80);t&&s.current===null&&(o.current||Date.now()-l<2e3)&&(o.current=!0),a(!t),s.current===null&&ft(e,{top:r.scrollTop,atBottom:t})};r.addEventListener(`scroll`,b,{passive:!0}),r.addEventListener(`wheel`,h,{passive:!0}),r.addEventListener(`touchstart`,v,{passive:!0}),r.addEventListener(`touchmove`,y,{passive:!0}),r.addEventListener(`pointerdown`,_,{passive:!0}),r.addEventListener(`keydown`,g);let x;return typeof ResizeObserver<`u`&&(x=new ResizeObserver(()=>{let e=s.current;if(e!==null){let t=r.scrollHeight-r.clientHeight;d(Math.min(e,t)),t>=e&&(s.current=null)}else o.current&&f()}),x.observe(i)),()=>{r.removeEventListener(`scroll`,b),r.removeEventListener(`wheel`,h),r.removeEventListener(`touchstart`,v),r.removeEventListener(`touchmove`,y),r.removeEventListener(`pointerdown`,_),r.removeEventListener(`keydown`,g),x?.disconnect()}},[e,n,d,f]),{attachContent:u,scrollElRef:t,virtualizerRef:l,pillVisible:i,jumpToLatest:m,restickIfStuck:p}}function tr({runId:e,rows:t,mode:n,controls:r}){return n===`virtual`?(0,L.jsx)(nr,{runId:e,rows:t,controls:r}):(0,L.jsx)(`div`,{ref:r.attachContent,"data-slot":`thread-rows`,"data-virtualized":`false`,children:t.map(e=>(0,L.jsx)(`div`,{"data-slot":`thread-row`,className:`flex flex-col pb-2.5 [contain-intrinsic-block-size:auto_3rem] [content-visibility:auto]`,children:e.node},e.key))})}function nr({runId:e,rows:t,controls:n}){let r=(0,I.useRef)(null),[i]=(0,I.useState)(()=>gt(e,t.length)),a=(0,I.useRef)(t.length);a.current=t.length;let o=(0,I.useRef)(null),s=(0,I.useCallback)(t=>{n.virtualizerRef.current=t,t?o.current=t:o.current&&=(ht(e,{rows:a.current,cache:o.current.cache}),null)},[e,n.virtualizerRef]),[c,l]=(0,I.useState)(0);return(0,I.useLayoutEffect)(()=>{let e=()=>{let e=r.current,t=n.scrollElRef.current;!e||!t||l(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[n.scrollElRef]),(0,L.jsx)(`div`,{ref:e=>{r.current=e,n.attachContent(e)},"data-slot":`thread-rows`,"data-virtualized":`true`,children:(0,L.jsx)($n,{ref:s,scrollRef:n.scrollElRef,startMargin:c,...i===void 0?{}:{cache:i},children:t.map(e=>(0,L.jsx)(`div`,{"data-slot":`thread-row`,className:`flex flex-col pb-2.5`,children:e.node},e.key))})})}function rr({onJump:e}){return(0,L.jsxs)(`button`,{type:`button`,"data-slot":`jump-to-latest`,onClick:e,className:`pointer-events-auto inline-flex min-h-8 items-center gap-1.5 rounded-full border border-border bg-background px-3.5 text-xs font-medium text-muted-foreground shadow-modal hover:text-foreground`,children:[(0,L.jsx)(Re,{"aria-hidden":!0,className:`size-3.5`}),`Jump to latest`]})}var ir=120;function Y(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function X(e){let t=e.replace(/\s+/g,` `).trim();return t.length>ir?`${t.slice(0,ir-1)}…`:t}function Z(e,...t){if(Y(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return X(t)}}function ar(e){if(!Y(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return X(t);if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return X(e.join(` `))}}function or(e){if(!Y(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)Y(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function sr(e){return Z(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function Q(e,t){return t?`${e} ${t}`:e}function cr(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(n){case`bash`:case`commandexecution`:return{toolKind:`execute`,title:Q(`Ran`,ar(t)),subtitle:Z(t,`description`)};case`edit`:case`multiedit`:return{toolKind:`edit`,title:Q(`Edit`,Z(t,`file_path`,`filePath`,`path`))};case`write`:return{toolKind:`edit`,title:Q(`Write`,Z(t,`file_path`,`filePath`,`path`))};case`notebookedit`:return{toolKind:`edit`,title:Q(`Edit`,Z(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`))};case`filechange`:{let e=or(t);return{toolKind:`edit`,title:Q(`Edit`,e.length===1?e[0]:e.length>1?`${e.length} files`:void 0)}}case`read`:return{toolKind:`read`,title:Q(`Read`,Z(t,`file_path`,`filePath`,`path`))};case`glob`:case`grep`:return{toolKind:`search`,title:Q(`Search`,Z(t,`pattern`,`query`)),subtitle:Z(t,`path`)};case`webfetch`:return{toolKind:`fetch`,title:Q(`Fetch`,Z(t,`url`))};case`websearch`:return{toolKind:`fetch`,title:Q(`Web search`,Z(t,`query`))};case`task`:case`agent`:{let e=n===`agent`?`Agent`:`Task`,r=Z(t,`subagent_type`,`subagentType`),i=Z(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${e}: ${i}`:e,subtitle:i===r?void 0:r}}case`skill`:{let e=Z(t,`skill`,`name`,`command`);return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:Z(t,`args`,`description`)}}case`todowrite`:case`todolist`:case`plan`:case`taskcreate`:case`taskupdate`:case`tasklist`:return{toolKind:`plan`,title:`Update plan`};case`mcptoolcall`:{let e=Z(t,`server`),n=Z(t,`tool`);return e&&n?{toolKind:`other`,title:`${e}.${n}`}:{toolKind:`other`,title:`MCP tool`,subtitle:sr(t)}}}if(n.startsWith(`mcp__`)){let t=e.split(`__`).filter(e=>e!==``);if(t.length>=3)return{toolKind:`other`,title:`${t[1]}.${t.slice(2).join(`__`)}`}}return{toolKind:`other`,title:typeof e==`string`&&e.trim()!==``?X(e):`Tool`,subtitle:sr(t)}}function lr(e){for(let t=e.turns.length-1;t>=0;--t){let n=e.turns[t].planEntries;if(n!==void 0)return n}}function ur(e){let t=[];for(let n of e.turns)for(let e of n.items)if(e.kind===`tool`){for(let n of e.locations??[])t.push(n.path);for(let n of e.diffs??[])t.push(n.path)}let n=[];for(let e=t.length-1;e>=0;--e)n.includes(t[e])||n.push(t[e]);return n}function dr(e,t){switch(e){case`waiting`:return{state:`waiting`};case`failed`:return{state:`closed`,tone:`danger`,label:t?`Session failed — ${t}`:`Session failed`};case`review`:return{state:`closed`,tone:`dim`,label:`Session closed — waiting for your review`};case`done`:case`cancelled`:return{state:`closed`,tone:`dim`,label:`Session closed`};default:return null}}function fr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function $(e){return typeof e==`string`?e:void 0}function pr(e){let t=e.replace(/\s*CEZ:DONE\s*$/,``).replace(/\s*CEZ:MONITORING\s*$/,``).replace(/\s*CEZ:ASK[ \t]+\{[\s\S]*\}\s*$/,``);return t.includes(`CEZ:`)?t.split(`
8
+ `).filter(e=>!/^CEZ:(?:PR=\d+|ISSUE=\d+|TITLE=.+)\s*$/.test(e)).join(`
9
+ `):t}function mr(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return String(e)}}var hr=e=>e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`,gr=new Set([`pending`,`in_progress`,`completed`,`cancelled`]);function _r(e){if(!fr(e)||!Array.isArray(e.todos))return;let t=[];for(let n of e.todos){if(!fr(n)||typeof n.content!=`string`)return;t.push({content:n.content,status:gr.has(n.status)?n.status:`pending`,...typeof n.activeForm==`string`?{activeForm:n.activeForm}:{}})}return t}function vr(e){let t=[],n=new Map,r,i=0,a,o=()=>{i+=1;let e={id:`turn-${i}`,entries:[],v2Items:!1};return t.push(e),e},s=()=>t.at(-1)??o(),c=(e,t)=>{let n=$(e.stepId);return n===void 0?t:`${n}:${t}`},l=(e,t,r)=>{let i={...t};if(!e.v2Items){e.v2Items=!0;for(let t of e.entries)t.origin===`v1`&&hr(t.entry)&&n.delete(t.entry.id);e.entries=e.entries.filter(e=>!(e.origin===`v1`&&hr(e.entry)))}let a=n.get(r);if(a&&a.turn===e){a.entry.entry=i,n.set(r,a);return}let o={origin:`v2`,entry:i};e.entries.push(o),n.set(r,{turn:e,entry:o})};for(let i of e)switch(i.type){case`user-message`:{let e=$(i.text)??``;a&&!a.resolved&&(a.resolved=!0,e!==``&&(a.answer=e),a=void 0);let t=o();t.userMessage={text:e,imageCount:typeof i.imageCount==`number`?i.imageCount:0,images:Array.isArray(i.images)?i.images.filter(e=>typeof e==`string`):[]};break}case`turn.started`:{let e=$(i.turnId),n=t.at(-1);n&&n.turnId===void 0&&!n.v2Items?n.turnId=e:o().turnId=e;break}case`turn.completed`:{let e=$(i.turnId),n;for(let r=t.length-1;r>=0&&!n;--r)t[r].turnId===e&&(n=t[r]);let r=n??t.at(-1);r&&(r.completed={stopReason:$(i.stopReason)??`end_turn`,...typeof i.costUsd==`number`?{costUsd:i.costUsd}:{}});break}case`item.started`:case`item.updated`:case`item.completed`:{if(!fr(i.item))break;let e=i.item.kind,t=i.item.id;if(e!==`message`&&e!==`reasoning`&&e!==`tool`||typeof t!=`string`||t===``)break;let r=i.item,a=c(i,r.id);l(n.get(a)?.turn??s(),r,a);break}case`item.delta`:{let e=$(i.itemId)??``,t=n.get(c(i,e)),r=$(i.delta)??``;if(!t||r===``||!hr(t.entry.entry))break;let a=t.entry.entry;i.field===`output`&&a.kind===`tool`?a.output=(a.output??``)+r:i.field!==`output`&&a.kind!==`tool`&&(a.text+=r);break}case`text`:{let e=s();if(e.v2Items)break;let t=$(i.text)??``;if(t===``)break;e.entries.push({origin:`v1`,entry:{kind:`message`,id:`v1:${i.seq}`,role:`assistant`,text:t}});break}case`tool-call`:{let e=s();if(e.v2Items)break;let t=$(i.tool)??`Tool`,r=cr(t,i.input);if(r.toolKind===`plan`){let t=_r(i.input);t!==void 0&&(e.planEntries=t)}let a={kind:`tool`,id:$(i.id)??`v1:${i.seq}`,name:t,toolKind:r.toolKind,title:r.title,status:`running`,input:i.input},o={origin:`v1`,entry:a};e.entries.push(o),n.set(a.id,{turn:e,entry:o});break}case`tool-result`:{let e=n.get($(i.toolCallId)??``);if(!e||e.turn.v2Items||e.entry.origin!==`v1`)break;let t=e.entry.entry;if(t.kind!==`tool`)break;t.status=`completed`,t.output=mr(i.result);break}case`note`:case`lifecycle`:{let e=$(i.message)??``;if(e===``)break;s().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${i.seq}`,text:e,tone:`dim`}});break}case`error`:{let e=$(i.message)??``;if(e===``)break;s().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${i.seq}`,text:e,tone:`danger`}});break}case`session.error`:{let e=$(i.message)??``;if(e===``)break;s().entries.push({origin:`meta`,entry:{kind:`note`,id:`v2:${i.seq}`,text:e,tone:`danger`}});break}case`step-end`:{if(i.status!==`failed`)break;let e=$(i.error)?` — ${$(i.error)}`:``;s().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${i.seq}`,text:`step ${$(i.stepId)??`?`} failed${e}`,tone:`danger`}});break}case`check-output`:{let e=$(i.command)??`check`,t=typeof i.exitCode==`number`?i.exitCode:-1,n={kind:`tool`,id:`v1:${i.seq}`,name:`check`,toolKind:`execute`,title:`Ran ${e}`,status:t===0?`completed`:`failed`,output:$(i.text)??``,exitCode:t};s().entries.push({origin:`meta`,entry:n});break}case`image`:{let e=$(i.url);if(e===void 0)break;let t={kind:`image`,id:`v1:${i.seq}`,url:e},n=$(i.name);n!==void 0&&(t.name=n),s().entries.push({origin:`meta`,entry:t});break}case`plan.updated`:Array.isArray(i.entries)&&(s().planEntries=i.entries);break;case`session.ended`:r={reason:$(i.reason)??`end_turn`,...$(i.message)===void 0?{}:{message:$(i.message)}};break;case`ask.requested`:{let e=$(i.requestId);if(e===void 0||!Array.isArray(i.questions))break;let t=i.questions.filter(e=>fr(e)&&typeof e.header==`string`&&Array.isArray(e.options));if(t.length===0)break;let n={kind:`ask`,id:e,questions:t,resolved:!1};s().entries.push({origin:`meta`,entry:n}),a=n;break}case`step-start`:case`token-usage`:case`cost`:case`turn-end`:case`done`:case`session`:break;default:break}return{turns:t.map(e=>({id:e.id,...e.turnId===void 0?{}:{turnId:e.turnId},...e.userMessage===void 0?{}:{userMessage:e.userMessage},...e.planEntries===void 0?{}:{planEntries:e.planEntries},...e.completed===void 0?{}:{completed:e.completed},items:e.entries.map(({entry:e})=>e.kind===`message`&&e.role===`assistant`?{...e,text:pr(e.text)}:e)})),...r===void 0?{}:{sessionEnded:r}}}function yr(){let{id:e}=b(),t=u(e),n=Xe(e),r=(0,I.useMemo)(()=>vr(n),[n]);if(t.isPending)return(0,L.jsx)(Fe,{});if(t.isError){let e=t.error instanceof h&&t.error.status===404;return(0,L.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,L.jsx)(C,{icon:e?(0,L.jsx)(Se,{}):(0,L.jsx)(Ge,{}),tone:e?`neutral`:`danger`,title:e?`Task not found`:`Could not load this task`,subtitle:e?`No run has this id. It may have been deleted, or the link is from another machine.`:t.error.message,actions:(0,L.jsx)(d,{asChild:!0,variant:`outline`,children:(0,L.jsx)(Te,{to:`/`,children:`Back to tasks`})})})})}return(0,L.jsx)(xr,{run:t.data,thread:r})}function br(e,t,n){let r=[];e.task&&r.push({key:`task`,node:(0,L.jsx)(R,{text:e.task,images:e.taskImages??[],onEdit:n?n.onEditTask:void 0,editLabel:`Edit the prompt`})});for(let t of e.queuedMessages??[])r.push({key:`queued:${t.id}`,node:(0,L.jsx)(R,{text:t.text,images:t.images??[],onEdit:n?e=>n.onEditMessage(t.id,e):void 0,onRemove:n?()=>n.onRemoveMessage(t.id):void 0})});for(let n of t.turns){n.userMessage&&r.push({key:`${n.id}:user`,node:(0,L.jsx)(R,{text:n.userMessage.text,imageCount:n.userMessage.imageCount,images:n.userMessage.images})});for(let t of it(n.items))r.push({key:`${n.id}:${t.id}`,node:(0,L.jsx)(Cr,{block:t,scope:n.id,runId:e.id})})}return r}function xr({run:e,thread:t}){let n=dr(e.status,e.error),r=lr(t),i=r!==void 0&&r.length>0?nn(r):void 0,a=e.status===`running`||e.status===`waiting`,s=e.status===`queued`,c=!a&&e.status!==`queued`,u=(0,I.useMemo)(()=>Vt(t.turns,c),[t.turns,c]),[d,f]=(0,I.useState)(void 0),[p,m]=(0,I.useState)(e.id);p!==e.id&&(m(e.id),f(void 0));let h=(0,I.useMemo)(()=>d===void 0?void 0:qt(t.turns,d,c),[t.turns,d,c]),g=(0,I.useMemo)(()=>d===void 0?[]:Jt(t.turns,d),[t.turns,d]),v=x(e.id),{mutateAsync:y}=l(e.id),{mutateAsync:b}=o(e.id),{mutateAsync:C}=S(e.id),w=(0,I.useMemo)(()=>s?{onEditTask:async e=>{await y({task:e})},onEditMessage:(e,t)=>b({msgId:e,message:{text:t}}).then(()=>void 0),onRemoveMessage:e=>C(e).then(()=>void 0)}:void 0,[s,y,b,C]),E=(0,I.useMemo)(()=>br(e,t,w),[e,t,w]),{search:D}=_(),k=ut(D,E.length),A=er(e.id);return _e(A.restickIfStuck),(0,L.jsxs)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:[(0,L.jsx)(ie,{run:e,planTally:i}),(0,L.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[820px] flex-1 flex-col gap-3.5 px-4 py-5 md:px-6`,children:[(0,L.jsx)(ct,{runId:e.id,children:(0,L.jsx)(tr,{runId:e.id,rows:E,mode:k,controls:A})}),t.turns.length===0?e.status===`queued`?(0,L.jsx)(Sr,{run:e}):(0,L.jsx)(`p`,{"data-slot":`thread-empty`,className:`py-6 text-center text-xs text-soft-foreground`,children:`No session events yet.`}):null,e.status===`running`?(0,L.jsx)(bt,{}):null,n&&n.state===`closed`?(0,L.jsxs)(`div`,{"data-slot":`thread-footer`,"data-state":n.state,className:O(`mt-auto flex items-center gap-2 border-t border-border pt-3 text-xs`,n.tone===`danger`?`text-danger`:`text-soft-foreground`),children:[n.label,T(De(e))?(0,L.jsx)(`a`,{"data-slot":`pr-link`,href:De(e),target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`PR ↗`}):null]}):null,e.status===`review`?(0,L.jsx)(fn,{run:e}):null]}),(0,L.jsx)(_n,{status:e.status}),(0,L.jsx)(ct,{runId:e.id,children:(0,L.jsx)(cn,{agent:h,entries:g,onClose:()=>f(void 0)})}),(0,L.jsxs)(`div`,{"data-slot":`thread-dock`,className:`sticky bottom-[var(--kb,0px)] z-10 bg-background px-4 pt-1.5 pb-3 max-md:border-t max-md:border-border md:px-6 md:pb-4`,children:[A.pillVisible?(0,L.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 -top-12 flex justify-center`,children:(0,L.jsx)(rr,{onJump:A.jumpToLatest})}):null,(0,L.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[820px] flex-col gap-2.5`,children:[(0,L.jsx)(Zt,{runId:e.id,agents:u,onSelect:f},`agents:${e.id}`),r!==void 0&&r.length>0?(0,L.jsx)(an,{runId:e.id,entries:r},e.id):null,e.status===`waiting`?(0,L.jsxs)(`div`,{"data-slot":`paused-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,L.jsx)(Ee,{tone:`pending`,pulse:!0}),`The agent is paused, waiting for your reply`]}):null,s?(0,L.jsxs)(`div`,{"data-slot":`queued-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,L.jsx)(Ee,{tone:`pending`}),`Messages you add now are folded into the prompt before the run starts.`]}):null,(0,L.jsx)(Pe,{onSubmit:(e,t)=>v.mutateAsync({text:e,images:t}),disabled:!a&&!s,disabledReason:`Session closed — Continue to reopen.`,disabledAction:(0,L.jsx)(Mt,{run:e}),placeholder:s?`Add to the prompt — sent when the run starts…`:e.status===`waiting`?`Reply — / for skills, @ for files…`:`Message the agent — / for skills, @ for files…`,autocompleteSkills:!0,quickReplies:!0,getMentionCandidates:()=>ur(t)})]})]})]})}function Sr({run:e}){let t=te(f().data??[],e.id);return(0,L.jsxs)(`div`,{"data-slot":`queued-state`,className:`flex flex-col items-center gap-1.5 py-10 text-center`,children:[(0,L.jsx)(Ee,{tone:`pending`,pulse:!0}),(0,L.jsxs)(`p`,{className:`text-[13px] font-medium`,children:[`Waiting for a free agent slot`,t===void 0?``:` — #${t} in queue`]}),(0,L.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[e.workflow,` · starts automatically when a slot frees up`]})]})}function Cr({block:e,scope:t,runId:n}){switch(e.kind){case`entry`:return(0,L.jsx)(wr,{entry:e.entry,scope:t,runId:n});case`tool-card`:return(0,L.jsx)(z,{item:e.item,nested:e.children,cacheKey:`${t}:${e.id}`});case`context-group`:return(0,L.jsx)(kt,{group:e,scope:t});case`streak`:return(0,L.jsx)(At,{count:e.count,children:e.blocks.map(e=>(0,L.jsx)(Cr,{block:e,scope:t,runId:n},e.id))})}}function wr({entry:e,scope:t,runId:n}){switch(e.kind){case`message`:return e.role===`assistant`?(0,L.jsx)(_t,{text:e.text}):(0,L.jsx)(R,{text:e.text});case`reasoning`:return(0,L.jsx)(yt,{text:e.text});case`tool`:return(0,L.jsx)(z,{item:e,cacheKey:`${t}:${e.id}`});case`note`:return(0,L.jsx)(vt,{note:e});case`image`:return(0,L.jsx)(jt,{image:e});case`ask`:return(0,L.jsx)(yn,{ask:e,runId:n})}}export{yr as TaskThreadRoute};
@@ -0,0 +1 @@
1
+ import{a as e,s as t}from"./bundle-mjs-BegPhL5c.js";import{D as n}from"./centered-state-zzWBfO_1.js";import{t as r}from"./utils-B8s5qIcK.js";t();var i=e(),a=n(`inline-block size-[7px] shrink-0 rounded-full`,{variants:{tone:{success:`bg-success`,pending:`bg-pending`,danger:`bg-danger`,violet:`bg-violet`,neutral:`bg-soft-foreground`},pulse:{true:`animate-pulse`,false:``}},defaultVariants:{tone:`neutral`,pulse:!1}});function o({className:e,tone:t=`neutral`,pulse:n=!1,...o}){return(0,i.jsx)(`span`,{"data-slot":`status-dot`,"data-tone":t,className:r(a({tone:t,pulse:n,className:e})),...o})}var s={permission:0,error:1,waiting:2,running:3,unseen:4,none:5};function c(e){return!1}function l(e){return!1}function u(e){return c(e)?{bucket:`permission`,tone:`violet`,pulse:!0,label:`needs permission`}:e.status===`failed`?{bucket:`error`,tone:`danger`,pulse:!1,label:`failed`}:e.status===`waiting`?{bucket:`waiting`,tone:`pending`,pulse:!0,label:`needs you`}:e.status===`review`?{bucket:`waiting`,tone:`violet`,pulse:!0,label:`needs review`}:e.status===`running`&&e.activity===`monitoring`?{bucket:`running`,tone:`violet`,pulse:!0,label:`monitoring`}:e.status===`running`?{bucket:`running`,tone:`violet`,pulse:!0,label:`running`}:l(e)?{bucket:`unseen`,tone:`violet`,pulse:!1,label:`unseen`}:e.status===`queued`?{bucket:`none`,tone:`neutral`,pulse:!1,label:`queued`}:e.status===`done`?{bucket:`none`,tone:`success`,pulse:!1,label:`done`}:{bucket:`none`,tone:`neutral`,pulse:!1,label:`cancelled`}}function d(e){return s[u(e).bucket]<=s.waiting}var f=[`Needs you`,`Working`,`Recent`,`Archived`],p={waiting:0,review:1,running:2,queued:3},m=e=>p[e.status]??9;function h(e,t){return t===`archived`?`Archived`:e.status===`waiting`||e.status===`review`?`Needs you`:e.status===`running`||e.status===`queued`?`Working`:`Recent`}function g(e){return e.titleSummary??e.title}function _(e){return e.title.replace(/ \([A-C]\)$/,``)}function v(e){let t=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));return new Map(t.map((e,t)=>[e.id,t+1]))}function y(e,t){return e.filter(e=>t===`archived`?e.archived:!e.archived).sort((e,t)=>{let n=m(e)-m(t);return n===0?t.createdAt.localeCompare(e.createdAt):n})}function b(e,t){let n=v(e),r=y(e,t),i=new Map,a=(e,t)=>{let n=i.get(e);n?n.push(t):i.set(e,[t])},o=new Set;for(let e of r){if(e.groupId){if(o.has(e.groupId))continue;o.add(e.groupId);let n=r.filter(t=>t.groupId===e.groupId).sort((e,t)=>(e.variant??``).localeCompare(t.variant??``));if(n.length>1){a(h(e,t),{kind:`group`,groupId:e.groupId,title:_(e),members:n});continue}}a(h(e,t),{kind:`run`,run:e,queuePosition:n.get(e.id)??null})}return f.filter(e=>i.has(e)).map(e=>({label:e,rows:i.get(e)}))}function x(e,t){let n=[],r=t;for(let t of e){if(r<=0)break;let e=t.rows.slice(0,r);r-=e.length,n.push({label:t.label,rows:e})}return n}function S(e){let t=0,n=0,r=0;for(let i of e){if(i.archived){n+=1;continue}t+=1,(i.status===`waiting`||i.status===`review`)&&(r+=1)}return{active:t,archived:n,waiting:r}}var C=new Set([`running`,`waiting`]),w=new Set([`done`,`failed`,`review`,`cancelled`]),T=new Set([`done`,`failed`,`cancelled`]);function E(e){return e?e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} kB`:``}function D(e){return e?`$${e>=10?e.toFixed(0):e.toFixed(2)}`:``}function O(e){if(e.workflow===`(planned)`||e.workflow===`(inbox)`){let t=e.steps.find(e=>e.kind===`agent`);if(t?.name)return t.name}return e.workflow}function k(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[g(e),e.branch??``,e.workflow,O(e)].some(e=>e.toLowerCase().includes(n))):[...e]}function A(e){return e.filter(e=>!e.archived&&T.has(e.status)).length}function j(e){return e.pullRequestUrl??e.referencedPullRequestUrl}function M(e){let t=j(e),n=t?Number(N(t)):e.prNumber;if(n&&Number.isInteger(n))return{kind:`PR`,number:n,...t?{url:t}:{}};let r=e.issueNumber??(e.referencedIssueUrl?Number(N(e.referencedIssueUrl)):void 0);if(r&&Number.isInteger(r))return{kind:`Issue`,number:r,...e.referencedIssueUrl?{url:e.referencedIssueUrl}:{}}}function N(e){let t=e.split(`/`).pop()??``;return/^\d+$/.test(t)?t:null}function P(e,t){let n=C.has(e.status)?t:void 0;if(n)return{cpu:{text:`${n.cpuPct.toFixed(0)}%`,kind:`live`},mem:{text:E(n.rssBytes),kind:`live`}};let r=E(e.peakRssBytes);return{cpu:{text:``,kind:`none`},mem:r?{text:`peak ${r}`,kind:`peak`,title:`peak — run finished${e.peakProcCount?` · ${e.peakProcCount} procs`:``}`}:{text:``,kind:`none`}}}function F(e,t){let n=e.filter(e=>t===`archived`?e.archived:!e.archived),r=new Map;for(let e of n){if(!e.groupId)continue;let t=r.get(e.groupId);t?t.push(e):r.set(e.groupId,[e])}return[...r.entries()].flatMap(([e,t])=>{let n=t[0];return!n||t.length<2||!t.every(e=>w.has(e.status))?[]:[{groupId:e,title:_(n),count:t.length}]})}export{y as _,D as a,o as b,M as c,x as d,b as f,g,v as h,A as i,P as l,S as m,F as n,E as o,_ as p,k as r,j as s,w as t,O as u,u as v,d as y};
@@ -0,0 +1,3 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-DPCR7gon.js","assets/bundle-mjs-BegPhL5c.js","assets/utils-B8s5qIcK.js","assets/index-DmW_TYjO.js","assets/centered-state-zzWBfO_1.js","assets/loader-circle-CGwIVNTv.js","assets/command-ylf8-fG0.js","assets/dist-Cw_CDvC3.js","assets/dialog-BYr_BAil.js","assets/x-DgoqYQOJ.js","assets/dropdown-menu-C3GD8eLA.js","assets/prompt-templates-DW7_d8Ys.js","assets/search-x-BDjaMrzG.js","assets/triangle-alert-Uy8rokUh.js","assets/project-router-CT8Rt5Eu.js","assets/tasks-table--V1pKwuK.js","assets/chunk-BO2N2NFS-DtrdTCWa.js","assets/lib-uHpeUPzK.js","assets/index-Qbs-JRWQ.css","assets/image-preview-DEhW0TFz.js","assets/zoomable-image-PEDOqyLQ.js"])))=>i.map(i=>d[i]);
2
+ import{a as e,i as t,s as n,u as r}from"./bundle-mjs-BegPhL5c.js";import{a as i}from"./centered-state-zzWBfO_1.js";import{r as a,t as o}from"./utils-B8s5qIcK.js";import{F as s,lt as c}from"./index-DmW_TYjO.js";import{n as l,t as u}from"./image-preview-DEhW0TFz.js";var d=a(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),f=a(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),p=e();function m({mode:e,wrap:t,onModeChange:n,onWrapChange:r}){return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`span`,{"data-slot":`diff-mode-toggle`,role:`group`,"aria-label":`Diff layout`,className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,p.jsx)(h,{current:e,value:`unified`,onModeChange:n}),(0,p.jsx)(h,{current:e,value:`split`,onModeChange:n})]}),(0,p.jsx)(i,{variant:`ghost`,size:`icon-sm`,"data-slot":`wrap-toggle`,"aria-pressed":t,"aria-label":`Wrap long lines`,title:`Wrap long lines`,className:o(t&&`bg-muted text-foreground`),onClick:()=>r(!t),children:(0,p.jsx)(f,{"aria-hidden":`true`})})]})}function h({current:e,value:t,onModeChange:n}){let r=e===t;return(0,p.jsx)(`button`,{type:`button`,"data-mode":t,"aria-pressed":r,onClick:()=>n(t),className:o(`rounded-[5px] px-2 py-0.5 text-[11px] font-medium capitalize`,r?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:t})}function g({branch:e}){return(0,p.jsxs)(`span`,{"data-slot":`branch-chip`,className:`flex min-w-0 items-center gap-1 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium`,children:[(0,p.jsx)(c,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,p.jsx)(`span`,{className:`truncate`,children:e})]})}var _=r(n(),1);function v(e){let[n,r]=(0,_.useState)(null);return(0,_.useEffect)(()=>{let e=!1;return t(()=>import(`./diff-view-DPCR7gon.js`).then(t=>{e||r({View:t.DiffView})},()=>{e||r(`failed`)}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])),()=>{e=!0}},[]),e.files.length===0?(0,p.jsx)(`p`,{"data-slot":`diff-empty`,className:o(`px-1 text-xs text-soft-foreground`,e.className),children:`No changes.`}):n===`failed`?(0,p.jsx)(y,{...e}):n===null?(0,p.jsx)(`p`,{"data-slot":`diff-loading`,className:o(`px-1 text-xs text-soft-foreground`,e.className),children:`Loading diff…`}):(0,p.jsx)(n.View,{...e})}function y({files:e,wrap:t=!1,imageSrc:n,onOpenInApp:r,className:i}){let a={adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length};return(0,p.jsxs)(`div`,{"data-slot":`diff`,"data-fallback":`true`,className:o(`flex min-w-0 flex-col gap-3`,i),children:[(0,p.jsxs)(`p`,{"data-slot":`diff-totals`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,p.jsxs)(`span`,{children:[a.files,` `,a.files===1?`file`:`files`,` changed`]}),(0,p.jsx)(s,{stat:a})]}),e.map(e=>(0,p.jsx)(b,{file:e,wrap:t,imageSrc:n,onOpenInApp:r},`${e.oldPath??``}→${e.path}`))]})}function b({file:e,wrap:t,imageSrc:n,onOpenInApp:r}){return(0,p.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,p.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-border/50 px-3 py-2`,children:[(0,p.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,p.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,p.jsx)(s,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-[11px]`})})]}),l(e)?(0,p.jsx)(u,{file:e,imageSrc:n,onOpenInApp:r}):e.binary?(0,p.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.patch===``?(0,p.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,p.jsx)(`pre`,{className:o(`py-2 font-mono text-xs leading-[1.7]`,t?`break-words whitespace-pre-wrap`:`overflow-x-auto whitespace-pre`),children:e.patch.split(`
3
+ `).map((e,t)=>(0,p.jsxs)(`span`,{className:o(`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))})]})}function x(){let[e,t]=(0,_.useState)(()=>typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 768px)`).matches);return(0,_.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(min-width: 768px)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}export{d as a,m as i,v as n,g as r,x as t};
@@ -0,0 +1,11 @@
1
+ import{a as e,o as t,s as n,u as r}from"./bundle-mjs-BegPhL5c.js";import{Et as i,Ft as a,O as o,Rt as s,a as c,cn as l,ht as u,i as d,lt as f,on as p,st as m,t as h,un as g,ut as _,wt as v}from"./centered-state-zzWBfO_1.js";import{r as y,t as b}from"./utils-B8s5qIcK.js";import{n as x}from"./loader-circle-CGwIVNTv.js";import{n as S,t as C}from"./trash-2-DAyZ0VSi.js";import{t as w}from"./square-terminal-Ckjjn0vb.js";import{t as ee}from"./triangle-alert-Uy8rokUh.js";import{t as te}from"./upload-CDdyPPo_.js";import{t as T}from"./x-DgoqYQOJ.js";import{G as ne,O as E,U as re,_ as ie,at as D,c as ae,ct as oe,d as se,et as O,f as ce,g as k,h as le,m as A,p as ue,pt as j,rt as M,u as N}from"./index-DmW_TYjO.js";import{n as de}from"./skill-empty-hint-Cl3ESoPu.js";var fe=y(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),pe=y(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),me=r(t()),P=r(n());function he(){var e=[...arguments];return(0,P.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var F=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function I(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function L(e){return`nodeType`in e}function R(e){return e?I(e)?e:L(e)?e.ownerDocument?.defaultView??window:window:window}function ge(e){let{Document:t}=R(e);return e instanceof t}function _e(e){return!I(e)&&e instanceof R(e).HTMLElement}function ve(e){return e instanceof R(e).SVGElement}function z(e){return e?I(e)?e.document:L(e)?ge(e)?e:_e(e)||ve(e)?e.ownerDocument:document:document:document}var B=F?P.useLayoutEffect:P.useEffect;function ye(e){let t=(0,P.useRef)(e);return B(()=>{t.current=e}),(0,P.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function be(){let e=(0,P.useRef)(null);return[(0,P.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,P.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function xe(e,t){t===void 0&&(t=[e]);let n=(0,P.useRef)(e);return B(()=>{n.current!==e&&(n.current=e)},t),n}function V(e,t){let n=(0,P.useRef)();return(0,P.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function H(e){let t=ye(e),n=(0,P.useRef)(null);return[n,(0,P.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Se(e){let t=(0,P.useRef)();return(0,P.useEffect)(()=>{t.current=e},[e]),t.current}var U={};function Ce(e,t){return(0,P.useMemo)(()=>{if(t)return t;let n=U[e]==null?0:U[e]+1;return U[e]=n,e+`-`+n},[e,t])}function we(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var Te=we(1),Ee=we(-1);function De(e){return`clientX`in e&&`clientY`in e}function W(e){if(!e)return!1;let{KeyboardEvent:t}=R(e.target);return t&&e instanceof t}function G(e){if(!e)return!1;let{TouchEvent:t}=R(e.target);return t&&e instanceof t}function Oe(e){if(G(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return De(e)?{x:e.clientX,y:e.clientY}:null}var K=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[K.Translate.toString(e),K.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),ke=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Ae(e){return e.matches(ke)?e:e.querySelector(ke)}var je={display:`none`};function Me(e){let{id:t,value:n}=e;return P.createElement(`div`,{id:t,style:je},n)}function Ne(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return P.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function Pe(){let[e,t]=(0,P.useState)(``);return{announce:(0,P.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var Fe=(0,P.createContext)(null);function Ie(e){let t=(0,P.useContext)(Fe);(0,P.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Le(){let[e]=(0,P.useState)(()=>new Set),t=(0,P.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,P.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var Re={draggable:`
2
+ To pick up a draggable item, press the space bar.
3
+ While dragging, use the arrow keys to move the item.
4
+ Press space again to drop the item in its new position, or press escape to cancel.
5
+ `},ze={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function Be(e){let{announcements:t=ze,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Re}=e,{announce:a,announcement:o}=Pe(),s=Ce(`DndLiveRegion`),[c,l]=(0,P.useState)(!1);if((0,P.useEffect)(()=>{l(!0)},[]),Ie((0,P.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=P.createElement(P.Fragment,null,P.createElement(Me,{id:r,value:i.draggable}),P.createElement(Ne,{id:s,announcement:o}));return n?(0,me.createPortal)(u,n):u}var q;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(q||={});function Ve(){}function He(e,t){return(0,P.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function Ue(){var e=[...arguments];return(0,P.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var J=Object.freeze({x:0,y:0});function We(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function Ge(e,t){let n=Oe(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function Ke(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function qe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Je(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function Ye(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function Xe(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var Ze=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=Xe(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=We(Xe(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(Ke)},Qe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=Je(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=Je(r),o=i.reduce((e,t,r)=>e+We(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(Ke)};function $e(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var et=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=$e(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(qe)};function tt(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function nt(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:J}function rt(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var it=rt(1);function at(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function ot(e,t,n){let r=at(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var st={ignoreTransform:!1};function ct(e,t){t===void 0&&(t=st);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=R(e).getComputedStyle(e);t&&(n=ot(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function lt(e){return ct(e,{ignoreTransform:!0})}function ut(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function dt(e,t){return t===void 0&&(t=R(e).getComputedStyle(e)),t.position===`fixed`}function ft(e,t){t===void 0&&(t=R(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`&&n.test(r)})}function pt(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(ge(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!_e(i)||ve(i)||n.includes(i))return n;let a=R(e).getComputedStyle(i);return i!==e&&ft(i,a)&&n.push(i),dt(i,a)?n:r(i.parentNode)}return e?r(e):n}function mt(e){let[t]=pt(e,1);return t??null}function ht(e){return!F||!e?null:I(e)?e:L(e)?ge(e)||e===z(e).scrollingElement?window:_e(e)?e:null:null}function gt(e){return I(e)?e.scrollX:e.scrollLeft}function _t(e){return I(e)?e.scrollY:e.scrollTop}function vt(e){return{x:gt(e),y:_t(e)}}var Y;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(Y||={});function yt(e){return!F||!e?!1:e===document.scrollingElement}function bt(e){let t={x:0,y:0},n=yt(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var xt={x:.2,y:.2};function St(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=xt);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=bt(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=Y.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=Y.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=Y.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=Y.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function Ct(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function wt(e){return e.reduce((e,t)=>Te(e,vt(t)),J)}function Tt(e){return e.reduce((e,t)=>e+gt(t),0)}function Et(e){return e.reduce((e,t)=>e+_t(t),0)}function Dt(e,t){if(t===void 0&&(t=ct),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);mt(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Ot=[[`x`,[`left`,`right`],Tt],[`y`,[`top`,`bottom`],Et]],kt=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=pt(t),r=wt(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Ot)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},At=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function jt(e){let{EventTarget:t}=R(e);return e instanceof t?e:z(e)}function Mt(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t&&r>t.y}var X;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(X||={});function Nt(e){e.preventDefault()}function Pt(e){e.stopPropagation()}var Z;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(Z||={});var Ft={start:[Z.Space,Z.Enter],cancel:[Z.Esc],end:[Z.Space,Z.Enter,Z.Tab]},It=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Z.Right:return{...n,x:n.x+25};case Z.Left:return{...n,x:n.x-25};case Z.Down:return{...n,y:n.y+25};case Z.Up:return{...n,y:n.y-25}}},Lt=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new At(z(t)),this.windowListeners=new At(R(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(X.Resize,this.handleCancel),this.windowListeners.add(X.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(X.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Dt(n),t(J)}handleKeyDown(e){if(W(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=Ft,coordinateGetter:a=It,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:J;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=Ee(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=bt(n),p=Ct(n),m={x:Math.min(i===Z.Right?p.right-p.width/2:p.right,Math.max(i===Z.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===Z.Down?p.bottom-p.height/2:p.bottom,Math.max(i===Z.Down?p.top:p.top+p.height/2,u.y))},h=i===Z.Right&&!s||i===Z.Left&&!c,g=i===Z.Down&&!l||i===Z.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===Z.Right&&e<=d.x||i===Z.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===Z.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===Z.Down&&e<=d.y||i===Z.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===Z.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,Te(Ee(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};Lt.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=Ft,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function Rt(e){return!!(e&&`distance`in e)}function zt(e){return!!(e&&`delay`in e)}var Bt=class{constructor(e,t,n){n===void 0&&(n=jt(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=z(i),this.documentListeners=new At(this.document),this.listeners=new At(n),this.windowListeners=new At(R(i)),this.initialCoordinates=Oe(r)??J,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(X.Resize,this.handleCancel),this.windowListeners.add(X.DragStart,Nt),this.windowListeners.add(X.VisibilityChange,this.handleCancel),this.windowListeners.add(X.ContextMenu,Nt),this.documentListeners.add(X.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(zt(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Rt(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(X.Click,Pt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(X.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=Oe(e)??J,s=Ee(n,o);if(!t&&a){if(Rt(a)){if(a.tolerance!=null&&Mt(s,a.tolerance))return this.handleCancel();if(Mt(s,a.distance))return this.handleStart()}if(zt(a)&&Mt(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Z.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Vt={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},Ht=class extends Bt{constructor(e){let{event:t}=e,n=z(t.target);super(e,Vt,n)}};Ht.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var Ut={move:{name:`mousemove`},end:{name:`mouseup`}},Wt;(function(e){e[e.RightClick=2]=`RightClick`})(Wt||={});var Gt=class extends Bt{constructor(e){super(e,Ut,z(e.event.target))}};Gt.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Wt.RightClick?!1:(r?.({event:n}),!0)}}];var Kt={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},qt=class extends Bt{constructor(e){super(e,Kt)}static setup(){return window.addEventListener(Kt.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Kt.move.name,e)};function e(){}}};qt.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var Jt;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(Jt||={});var Yt;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(Yt||={});function Xt(e){let{acceleration:t,activator:n=Jt.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=Yt.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=Qt({delta:d,disabled:!a}),[m,h]=be(),g=(0,P.useRef)({x:0,y:0}),_=(0,P.useRef)({x:0,y:0}),v=(0,P.useMemo)(()=>{switch(n){case Jt.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Jt.DraggableRect:return i}},[n,i,c]),y=(0,P.useRef)(null),b=(0,P.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,P.useMemo)(()=>s===Yt.TreeOrder?[...l].reverse():l,[s,l]);(0,P.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=l.indexOf(e),i=u[n];if(!i)continue;let{direction:a,speed:s}=St(e,i,v,t,f);for(let e of[`x`,`y`])p[e][a[e]]||(s[e]=0,a[e]=0);if(s.x>0||s.y>0){h(),y.current=e,m(b,o),g.current=s,_.current=a;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var Zt={x:{[Y.Backward]:!1,[Y.Forward]:!1},y:{[Y.Backward]:!1,[Y.Forward]:!1}};function Qt(e){let{delta:t,disabled:n}=e,r=Se(t);return V(e=>{if(n||!r||!e)return Zt;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Y.Backward]:e.x[Y.Backward]||i.x===-1,[Y.Forward]:e.x[Y.Forward]||i.x===1},y:{[Y.Backward]:e.y[Y.Backward]||i.y===-1,[Y.Forward]:e.y[Y.Forward]||i.y===1}}},[n,t,r])}function $t(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return V(e=>t==null?null:r??e??null,[r,t])}function en(e,t){return(0,P.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var tn;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(tn||={});var nn;(function(e){e.Optimized=`optimized`})(nn||={});var rn=new Map;function an(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,P.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,P.useRef)(e),d=g(),f=xe(d),p=(0,P.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,P.useRef)(null),h=V(t=>{if(d&&!n)return rn;if(!t||t===rn||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new kt(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,P.useEffect)(()=>{u.current=e},[e]),(0,P.useEffect)(()=>{d||p()},[n,d]),(0,P.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,P.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case tn.Always:return!1;case tn.BeforeDragging:return n;default:return!n}}}function on(e,t){return V(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function sn(e,t){return on(e,t)}function cn(e){let{callback:t,disabled:n}=e,r=ye(t),i=(0,P.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,P.useEffect)(()=>()=>i?.disconnect(),[i]),i}function ln(e){let{callback:t,disabled:n}=e,r=ye(t),i=(0,P.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,P.useEffect)(()=>()=>i?.disconnect(),[i]),i}function un(e){return new kt(ct(e),e)}function dn(e,t,n){t===void 0&&(t=un);let[r,i]=(0,P.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=cn({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=ln({callback:a});return B(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function fn(e){return nt(e,on(e))}var pn=[];function mn(e){let t=(0,P.useRef)(e),n=V(n=>e?n&&n!==pn&&e&&t.current&&e.parentNode===t.current.parentNode?n:pt(e):pn,[e]);return(0,P.useEffect)(()=>{t.current=e},[e]),n}function hn(e){let[t,n]=(0,P.useState)(null),r=(0,P.useRef)(e),i=(0,P.useCallback)(e=>{let t=ht(e.target);t&&n(e=>e?(e.set(t,vt(t)),new Map(e)):null)},[]);return(0,P.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=ht(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,vt(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{ht(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,P.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>Te(e,t),J):wt(e):J,[e,t])}function gn(e,t){t===void 0&&(t=[]);let n=(0,P.useRef)(null);return(0,P.useEffect)(()=>{n.current=null},t),(0,P.useEffect)(()=>{let t=e!==J;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Ee(e,n.current):J}function _n(e){(0,P.useEffect)(()=>{if(!F)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function vn(e,t){return(0,P.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function yn(e){return(0,P.useMemo)(()=>e?ut(e):null,[e])}var bn=[];function xn(e,t){t===void 0&&(t=ct);let[n]=e,r=yn(n?R(n):null),[i,a]=(0,P.useState)(bn);function o(){a(()=>e.length?e.map(e=>yt(e)?r:new kt(t(e),e)):bn)}let s=ln({callback:o});return B(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Sn(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return _e(t)?t:e}function Cn(e){let{measure:t}=e,[n,r]=(0,P.useState)(null),i=ln({callback:(0,P.useCallback)(e=>{for(let{target:n}of e)if(_e(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=H((0,P.useCallback)(e=>{let n=Sn(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,P.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var wn=[{sensor:Ht,options:{}},{sensor:Lt,options:{}}],Tn={current:{}},En={draggable:{measure:lt},droppable:{measure:lt,strategy:tn.WhileDragging,frequency:nn.Optimized},dragOverlay:{measure:ct}},Dn=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},On={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Dn,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Ve},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:En,measureDroppableContainers:Ve,windowRect:null,measuringScheduled:!1},kn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:Ve,draggableNodes:new Map,over:null,measureDroppableContainers:Ve},An=(0,P.createContext)(kn),jn=(0,P.createContext)(On);function Mn(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Dn}}}function Nn(e,t){switch(t.type){case q.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case q.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case q.DragEnd:case q.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case q.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new Dn(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case q.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new Dn(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case q.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new Dn(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Pn(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,P.useContext)(An),a=Se(r),o=Se(n?.id);return(0,P.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!W(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=Ae(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function Fn(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function In(e){return(0,P.useMemo)(()=>({draggable:{...En.draggable,...e?.draggable},droppable:{...En.droppable,...e?.droppable},dragOverlay:{...En.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ln(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,P.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;B(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=nt(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=mt(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var Rn=(0,P.createContext)({...J,scaleX:1,scaleY:1}),zn;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(zn||={});var Bn=(0,P.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=wn,collisionDetection:o=et,measuring:s,modifiers:c,...l}=e,[u,d]=(0,P.useReducer)(Nn,void 0,Mn),[f,p]=Le(),[m,h]=(0,P.useState)(zn.Uninitialized),g=m===zn.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,P.useRef)({initial:null,translated:null}),C=(0,P.useMemo)(()=>_==null?null:{id:_,data:x?.data??Tn,rect:S},[_,x]),w=(0,P.useRef)(null),[ee,te]=(0,P.useState)(null),[T,ne]=(0,P.useState)(null),E=xe(l,Object.values(l)),re=Ce(`DndDescribedBy`,t),ie=(0,P.useMemo)(()=>b.getEnabled(),[b]),D=In(s),{droppableRects:ae,measureDroppableContainers:oe,measuringScheduled:se}=an(ie,{dragging:g,dependencies:[y.x,y.y],config:D.droppable}),O=$t(v,_),ce=(0,P.useMemo)(()=>T?Oe(T):null,[T]),k=Ae(),le=sn(O,D.draggable.measure);Ln({activeNode:_==null?null:v.get(_),config:k.layoutShiftCompensation,initialRect:le,measure:D.draggable.measure});let A=dn(O,D.draggable.measure,le),ue=dn(O?O.parentElement:null),j=(0,P.useRef)({activatorEvent:null,active:null,activeNode:O,collisionRect:null,collisions:null,droppableRects:ae,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),M=b.getNodeFor(j.current.over?.id),N=Cn({measure:D.dragOverlay.measure}),de=N.nodeRef.current??O,fe=g?N.rect??A:null,pe=!!(N.nodeRef.current&&N.rect),he=fn(pe?null:A),F=yn(de?R(de):null),I=mn(g?M??O:null),L=xn(I),ge=Fn(c,{transform:{x:y.x-he.x,y:y.y-he.y,scaleX:1,scaleY:1},activatorEvent:T,active:C,activeNodeRect:A,containerNodeRect:ue,draggingNodeRect:fe,over:j.current.over,overlayNodeRect:N.rect,scrollableAncestors:I,scrollableAncestorRects:L,windowRect:F}),_e=ce?Te(ce,y):null,ve=hn(I),z=gn(ve),ye=gn(ve,[A]),be=Te(ge,z),V=fe?it(fe,ge):null,H=C&&V?o({active:C,collisionRect:V,droppableRects:ae,droppableContainers:ie,pointerCoordinates:_e}):null,Se=Ye(H,`id`),[U,we]=(0,P.useState)(null),Ee=tt(pe?ge:Te(ge,ye),U?.rect??null,A),De=(0,P.useRef)(null),W=(0,P.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent,o=new n({active:w.current,activeNode:i,event:a,options:r,context:j,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=E.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=E.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=E.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,me.unstable_batchedUpdates)(()=>{r?.(i),h(zn.Initializing),d({type:q.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),te(De.current),ne(a)})},onMove(e){d({type:q.DragMove,coordinates:e})},onEnd:s(q.DragEnd),onCancel:s(q.DragCancel)});De.current=o;function s(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=j.current,o=null;if(t&&i){let{cancelDrop:s}=E.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===q.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=q.DragCancel)}w.current=null,(0,me.unstable_batchedUpdates)(()=>{d({type:e}),h(zn.Uninitialized),we(null),te(null),ne(null),De.current=null;let t=e===q.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=E.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),G=en(a,(0,P.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,W(n,t))},[v,W]));_n(a),B(()=>{A&&m===zn.Initializing&&h(zn.Initialized)},[A,m]),(0,P.useEffect)(()=>{let{onDragMove:e}=E.current,{active:t,activatorEvent:n,collisions:r,over:i}=j.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:be.x,y:be.y},over:i};(0,me.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[be.x,be.y]),(0,P.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=j.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=E.current,o=r.get(Se),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,me.unstable_batchedUpdates)(()=>{we(s),a?.(c),f({type:`onDragOver`,event:c})})},[Se]),B(()=>{j.current={activatorEvent:T,active:C,activeNode:O,collisionRect:V,collisions:H,droppableRects:ae,draggableNodes:v,draggingNode:de,draggingNodeRect:fe,droppableContainers:b,over:U,scrollableAncestors:I,scrollAdjustedTranslate:be},S.current={initial:fe,translated:V}},[C,O,H,V,v,de,fe,ae,b,U,I,be]),Xt({...k,delta:y,draggingRect:V,pointerCoordinates:_e,scrollableAncestors:I,scrollableAncestorRects:L});let K=(0,P.useMemo)(()=>({active:C,activeNode:O,activeNodeRect:A,activatorEvent:T,collisions:H,containerNodeRect:ue,dragOverlay:N,draggableNodes:v,droppableContainers:b,droppableRects:ae,over:U,measureDroppableContainers:oe,scrollableAncestors:I,scrollableAncestorRects:L,measuringConfiguration:D,measuringScheduled:se,windowRect:F}),[C,O,A,T,H,ue,N,v,b,ae,U,oe,I,L,D,se,F]),ke=(0,P.useMemo)(()=>({activatorEvent:T,activators:G,active:C,activeNodeRect:A,ariaDescribedById:{draggable:re},dispatch:d,draggableNodes:v,over:U,measureDroppableContainers:oe}),[T,G,C,A,d,re,v,U,oe]);return P.createElement(Fe.Provider,{value:p},P.createElement(An.Provider,{value:ke},P.createElement(jn.Provider,{value:K},P.createElement(Rn.Provider,{value:Ee},i)),P.createElement(Pn,{disabled:n?.restoreFocus===!1})),P.createElement(Be,{...n,hiddenTextDescribedById:re}));function Ae(){let e=ee?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),Vn=(0,P.createContext)(null),Hn=`button`,Un=`Draggable`;function Wn(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=Ce(Un),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,P.useContext)(An),{role:p=Hn,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,P.useContext)(g?Rn:Vn),[v,y]=H(),[b,x]=H(),S=vn(o,t),C=xe(n);return B(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,P.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===Hn?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function Gn(){return(0,P.useContext)(jn)}var Kn=`Droppable`,qn={timeout:25};function Jn(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=Ce(Kn),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,P.useContext)(An),u=(0,P.useRef)({disabled:n}),d=(0,P.useRef)(!1),f=(0,P.useRef)(null),p=(0,P.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...qn,...i},_=xe(h??r),v=ln({callback:(0,P.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=H((0,P.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=xe(t);return(0,P.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,P.useEffect)(()=>(s({type:q.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:q.UnregisterDroppable,key:a,id:r})),[r]),(0,P.useEffect)(()=>{n!==u.current.disabled&&(s({type:q.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function Yn(e){let{animation:t,children:n}=e,[r,i]=(0,P.useState)(null),[a,o]=(0,P.useState)(null),s=Se(n);return!n&&!r&&s&&i(s),B(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),P.createElement(P.Fragment,null,n,r?(0,P.cloneElement)(r,{ref:o}):null)}var Xn={x:0,y:0,scaleX:1,scaleY:1};function Zn(e){let{children:t}=e;return P.createElement(An.Provider,{value:kn},P.createElement(Rn.Provider,{value:Xn},t))}var Qn={position:`fixed`,touchAction:`none`},$n=e=>W(e)?`transform 250ms ease`:void 0,er=(0,P.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=$n}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...Qn,width:s.width,height:s.height,top:s.top,left:s.left,transform:K.Transform.toString(d),transformOrigin:i&&r?Ge(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return P.createElement(n,{className:o,style:f,ref:t},a)}),tr={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:K.Transform.toString(t)},{transform:K.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function nr(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return ye((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=Sn(a);if(!c)return;let{transform:l}=R(a).getComputedStyle(a),u=at(l);if(!u)return;let d=typeof t==`function`?t:rr(t);return Dt(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function rr(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...tr,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var ir=0;function ar(e){return(0,P.useMemo)(()=>{if(e!=null)return ir++,ir},[e])}var or=P.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=Gn(),S=(0,P.useContext)(Rn),C=ar(d?.id),w=Fn(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:S,windowRect:x}),ee=on(f),te=nr({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),T=ee?g.setRef:void 0;return P.createElement(Zn,null,P.createElement(Yn,{animation:te},d&&C?P.createElement(er,{key:C,id:d.id,ref:T,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:ee,style:{zIndex:l,...i},transform:w},n):null))});function sr(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function cr(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function lr(e){return e!==null&&e>=0}function ur(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function dr(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var fr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=sr(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},pr={scaleX:1,scaleY:1},mr=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...pr}:null}let s=hr(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...pr}:r<t&&r>=a?{x:0,y:o.height+s,...pr}:{x:0,y:0,...pr}};function hr(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var gr=`Sortable`,_r=P.createContext({activeIndex:-1,containerId:gr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:fr,disabled:{draggable:!1,droppable:!1}});function vr(e){let{children:t,id:n,items:r,strategy:i=fr,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=Gn(),d=Ce(gr,n),f=s.rect!==null,p=(0,P.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,P.useRef)(p),v=!ur(p,_.current),y=g!==-1&&h===-1||v,b=dr(a);B(()=>{v&&m&&u(p)},[v,p,m,u]),(0,P.useEffect)(()=>{_.current=p},[p]);let x=(0,P.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:cr(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return P.createElement(_r.Provider,{value:x},t)}var yr=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return sr(n,r,i).indexOf(t)},br=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},xr={duration:200,easing:`ease`},Sr=`transform`,Cr=K.Transition.toString({property:Sr,duration:0,easing:`linear`}),wr={roleDescription:`sortable`};function Tr(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,P.useState)(null),s=(0,P.useRef)(n);return B(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=ct(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,P.useEffect)(()=>{a&&o(null)},[a]),a}function Er(e){let{animateLayoutChanges:t=br,attributes:n,disabled:r,data:i,getNewIndex:a=yr,id:o,strategy:s,resizeObserverConfig:c,transition:l=xr}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,P.useContext)(_r),y=Dr(r,p),b=u.indexOf(o),x=(0,P.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,P.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:ee,setNodeRef:te}=Jn({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:T,activatorEvent:ne,activeNodeRect:E,attributes:re,setNodeRef:ie,listeners:D,isDragging:ae,over:oe,setActivatorNodeRef:se,transform:O}=Wn({id:o,data:x,attributes:{...wr,...n},disabled:y.draggable}),ce=he(te,ie),k=!!T,le=k&&!m&&lr(f)&&lr(g),A=!_&&ae,ue=le?(A&&le?O:null)??(s??v)({rects:h,activeNodeRect:E,activeIndex:f,overIndex:g,index:b}):null,j=lr(f)&&lr(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,M=T?.id,N=(0,P.useRef)({activeId:M,items:u,newIndex:j,containerId:d}),de=u!==N.current.items,fe=t({active:T,containerId:d,isDragging:ae,isSorting:k,id:o,index:b,items:u,newIndex:N.current.newIndex,previousItems:N.current.items,previousContainerId:N.current.containerId,transition:l,wasDragging:N.current.activeId!=null}),pe=Tr({disabled:!fe,index:b,node:w,rect:C});return(0,P.useEffect)(()=>{k&&N.current.newIndex!==j&&(N.current.newIndex=j),d!==N.current.containerId&&(N.current.containerId=d),u!==N.current.items&&(N.current.items=u)},[k,j,d,u]),(0,P.useEffect)(()=>{if(M===N.current.activeId)return;if(M!=null&&N.current.activeId==null){N.current.activeId=M;return}let e=setTimeout(()=>{N.current.activeId=M},50);return()=>clearTimeout(e)},[M]),{active:T,activeIndex:f,attributes:re,data:x,rect:C,index:b,newIndex:j,items:u,isOver:ee,isSorting:k,isDragging:ae,listeners:D,node:w,overIndex:g,over:oe,setNodeRef:ce,setActivatorNodeRef:se,setDroppableNodeRef:te,setDraggableNodeRef:ie,transform:pe??ue,transition:me()};function me(){if(pe||de&&N.current.newIndex===b)return Cr;if(!(A&&!W(ne)||!l)&&(k||fe))return K.Transition.toString({...l,property:Sr})}}function Dr(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function Or(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var kr=[Z.Down,Z.Right,Z.Up,Z.Left],Ar=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(kr.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case Z.Down:r.top<a.top&&t.push(n);break;case Z.Up:r.top>a.top&&t.push(n);break;case Z.Left:r.left>a.left&&t.push(n);break;case Z.Right:r.left<a.left&&t.push(n);break}});let c=Qe({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=Ye(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=pt(c).some((e,t)=>s[t]!==e),i=jr(e,t),a=Mr(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:Ee(u,l)}}}};function jr(e,t){return!Or(e)||!Or(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Mr(e,t){return!Or(e)||!Or(t)||!jr(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function Nr(e){let t=[];for(let n of e){if(n.command||!n.skill||n.prompt!==void 0&&n.prompt!==`{{task}}`||n.name!==void 0&&n.name!==n.skill||n.model||n.runner||n.allowedTools||n.bashAllowlist||n.onFail)return null;t.push(n.skill)}return t.length?t:null}function Pr(e,t){let n=new Set(t.map(e=>e.id)),r=e;for(let t=2;n.has(r);t++)r=`${e}-${t}`;return{id:r,name:e,skill:e,prompt:`{{task}}`}}function Fr(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function Ir(e,t,n){if(t===n||t<0||t>=e.length||n<0||n>=e.length)return[...e];let r=[...e],[i]=r.splice(t,1);return i===void 0?[...e]:(r.splice(n,0,i),r)}function Lr(e,t){return e.filter((e,n)=>n!==t)}function Q(e){let t=String(e),n=/^[A-Za-z0-9._][A-Za-z0-9 ._/-]*$/.test(t)&&!t.endsWith(` `),r=/^(true|false|yes|no|on|off|null|~)$/i.test(t)||/^[-+.]?\d/.test(t);return n&&!r?t:JSON.stringify(t)}function Rr(e,t,n){let r=` `.repeat(n);return t.includes(`
6
+ `)?[`${r}${e}: |`,...t.split(`
7
+ `).map(e=>`${r} ${e}`)]:[`${r}${e}: ${Q(t)}`]}function zr(e,t,n){let r=[`name: ${Q(e.trim()||`my-workflow`)}`];t.trim()&&r.push(...Rr(`description`,t.trim(),0));let i=Nr(n);if(i){r.push(`skills:`);for(let e of i)r.push(` - ${Q(e)}`)}else if(n.length){r.push(`steps:`);for(let e of n)r.push(` - id: ${Q(e.id)}`),e.name&&e.name!==e.id&&r.push(` name: ${Q(e.name)}`),e.skill&&r.push(` skill: ${Q(e.skill)}`),e.prompt&&r.push(...Rr(`prompt`,e.prompt,4)),e.model&&r.push(` model: ${Q(e.model)}`),e.runner&&r.push(` runner: ${Q(e.runner)}`),e.allowedTools&&r.push(` allowedTools: [${e.allowedTools.map(Q).join(`, `)}]`),e.bashAllowlist&&r.push(` bashAllowlist: [${e.bashAllowlist.map(Q).join(`, `)}]`),e.command&&r.push(...Rr(`command`,e.command,4)),e.onFail&&r.push(` onFail:`,` retry: ${Q(e.onFail.retry)}`,` max: ${e.onFail.max??2}`)}else r.push(`skills: []`);return`${r.join(`
8
+ `)}\n`}function Br(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`workflow`}function Vr(e){let t=Nr(e)?`skill`:`step`;return`${e.length} ${t}${e.length===1?``:`s`}`}function Hr(e,t){let n=new Set,r=[];for(let t of e.steps.slice(0,8)){let e=t.id||`step`,i=e;for(let t=2;n.has(i);t++)i=`${e}-${t}`;n.add(i),r.push({...t,id:i})}return{name:e.name?.trim()||t,steps:r}}function Ur(e,t,n){let r=Nr(n);return{name:e.trim(),...t.trim()?{description:t.trim()}:{},...r?{skills:r}:{steps:[...n]}}}var $=e(),Wr=`wb-canvas`;function Gr(){return{name:`my-workflow`,description:``,steps:[]}}function Kr(e){return{name:e.name,description:e.description??``,steps:structuredClone(e.steps??[])}}function qr(){let{name:e}=p();return(0,$.jsx)(Jr,{routeName:e},e??``)}function Jr({routeName:e}){let t=_(),n=m(),r=f(),p=g(),[y,S]=(0,P.useState)(null),[w,T]=(0,P.useState)(``),[re,D]=(0,P.useState)(!1),[oe,j]=(0,P.useState)(``),[de,me]=(0,P.useState)(``),[he,F]=(0,P.useState)(!1),[I,L]=(0,P.useState)(``),[R,ge]=(0,P.useState)(!1),[_e,ve]=(0,P.useState)(!1),[z,B]=(0,P.useState)(null),[ye,be]=(0,P.useState)(null),xe=(0,P.useRef)(null),V=t.data?.workflows??[],H=n.data??[],Se=ne(H,r.data?.skillUsage);(0,P.useEffect)(()=>{if(y!==null||t.data===void 0)return;let n=t.data.workflows,r=(e?n.find(t=>t.name===e):void 0)??n.find(e=>e.source===`file`);S(r?Kr(r):Gr())},[y,t.data,e]);let U=e=>S(t=>t===null?t:{...t,steps:e}),Ce=l({mutationFn:e=>a(e),onSuccess:e=>{S({name:e.name,description:e.description??``,steps:e.steps}),D(!1),j(``),me(``),d(`Imported "${e.name}" — review, then Save.`)},onError:e=>me(e.message)}),we=l({mutationFn:e=>s(e),onSuccess:e=>{S(t=>{let n=t??Gr(),{name:r,steps:i}=Hr(e,n.name);return{...n,name:r,steps:i}}),F(!1),L(``),d(e.fallback?`Planner unavailable — added a single step. Edit, then Save.`:`Built "${e.name??y?.name??`workflow`}" — review, tweak, then Save.`,e.fallback?{tone:`danger`}:void 0)},onError:e=>d(e instanceof Error?e.message:String(e),{tone:`danger`})}),Te=l({mutationFn:e=>v({...Ur(y?.name??``,y?.description??``,y?.steps??[]),...e?{overwrite:!0}:{}}),onSuccess:e=>{ge(!1),d(`Saved — ${e.path.split(`/`).pop()??e.path}`),p.invalidateQueries({queryKey:o.workflows})},onError:e=>{e instanceof u&&e.exists===!0?ge(!0):d(e instanceof Error?e.message:String(e),{tone:`danger`})}}),Ee=l({mutationFn:e=>i(e),onSuccess:(e,t)=>{ve(!1),d(`Deleted "${t}".`),S(Gr()),p.invalidateQueries({queryKey:o.workflows})},onError:e=>{ve(!1),d(e instanceof Error?e.message:String(e),{tone:`danger`})}}),De=Ue(He(Ht,{activationConstraint:{distance:4}}),He(Lt,{coordinateGetter:Ar}));if(t.isError)return(0,$.jsx)(`div`,{"data-route":`workflows`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(h,{icon:(0,$.jsx)(ee,{}),tone:`danger`,title:`Could not load workflows`,subtitle:t.error.message})});if(y===null)return(0,$.jsx)(ae,{});let W=y.steps,G=y.name.trim(),Oe=V.find(e=>e.name===G&&e.source===`file`),K=zr(y.name,y.description,W),ke=(e,t=W.length)=>{if(W.length>=8){d(`A workflow holds at most 8 steps.`,{tone:`danger`});return}U(Fr(W,Pr(e,W),t))},Ae=e=>{let t=e.active.data.current;B(t??null)},je=e=>{be(e.over?String(e.over.id):null)},Me=e=>{B(null),be(null);let{active:t,over:n}=e;if(n===null)return;let r=t.data.current;if(r?.type===`palette`){let e=n.id===Wr?W.length:W.findIndex(e=>e.id===n.id);ke(r.skill,e===-1?W.length:e);return}if(n.id===t.id)return;let i=W.findIndex(e=>e.id===t.id),a=W.findIndex(e=>e.id===n.id);i!==-1&&a!==-1&&U(Ir(W,i,a))},Ne=()=>{let e=oe.trim();e!==``&&Ce.mutate(e)},Pe=()=>{let e=I.trim();e===``||we.isPending||we.mutate(e)};return(0,$.jsxs)(`div`,{"data-route":`workflows`,className:`flex min-h-full flex-col`,children:[(0,$.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,$.jsx)(`h1`,{className:`text-base font-semibold`,children:`Workflows`}),(0,$.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Portable skill chains — the agent applies them top to bottom.`})]}),(0,$.jsxs)(Bn,{sensors:De,collisionDetection:Ze,onDragStart:Ae,onDragOver:je,onDragEnd:Me,onDragCancel:()=>{B(null),be(null)},children:[(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col gap-6 p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:flex-row md:p-5 md:pb-5`,children:[(0,$.jsxs)(`section`,{"data-slot":`wb-main`,className:`mx-auto w-full min-w-0 max-w-3xl flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2.5`,children:[(0,$.jsx)(O,{ref:xe,"data-slot":`wb-name`,"aria-label":`Workflow name`,spellCheck:!1,value:y.name,onChange:e=>S({...y,name:e.target.value}),className:`h-8 max-w-56 font-mono text-[13px] font-semibold`}),(0,$.jsx)(`span`,{"data-slot":`wb-count`,className:`shrink-0 font-mono text-xs text-soft-foreground`,children:Vr(W)})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[Oe?(0,$.jsxs)(c,{type:`button`,variant:`danger-ghost`,size:`sm`,"data-slot":`wb-delete`,title:`Delete the saved workflow file`,onClick:()=>ve(!0),children:[(0,$.jsx)(C,{"aria-hidden":`true`,className:`size-3`}),`Delete`]}):null,(0,$.jsxs)(c,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto`,"aria-expanded":he,title:`Describe a chain — the agent builds it`,onClick:()=>{D(!1),F(e=>!e)},children:[(0,$.jsx)(pe,{"aria-hidden":`true`,className:`size-3`}),`Auto`]}),(0,$.jsxs)(c,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import`,onClick:()=>{me(``),F(!1),D(e=>!e)},children:[(0,$.jsx)(te,{"aria-hidden":`true`,className:`size-3`}),`Import`]}),(0,$.jsxs)(c,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-export`,title:`Download workflow.yaml`,onClick:()=>{let e=new Blob([K],{type:`text/yaml`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${Br(y.name)}.yaml`,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)},children:[(0,$.jsx)(fe,{"aria-hidden":`true`,className:`size-3`}),`Export`]}),(0,$.jsxs)(c,{type:`button`,variant:`contrast`,size:`sm`,"data-slot":`wb-save`,disabled:Te.isPending,onClick:()=>{if(G===``){xe.current?.focus();return}if(W.length===0){d(`Add at least one step first.`,{tone:`danger`});return}Te.mutate(!1)},children:[(0,$.jsx)(x,{"aria-hidden":`true`,className:`size-3`}),`Save`]})]})]}),(0,$.jsxs)(`div`,{"data-slot":`wb-load`,className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`mr-0.5 text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:`edit`}),V.map(e=>(0,$.jsx)(`button`,{type:`button`,"data-slot":`wb-load-chip`,"data-name":e.name,title:e.description??``,"aria-pressed":G===e.name,onClick:()=>S(Kr(e)),className:b(`rounded-full border border-border bg-card px-2.5 py-1 font-mono text-[11.5px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,G===e.name&&`border-primary/40 bg-primary/10 text-foreground`),children:e.name},e.name)),(0,$.jsx)(`button`,{type:`button`,"data-slot":`wb-new`,title:`Start an empty workflow`,onClick:()=>S(Gr()),className:`rounded-full border border-dashed border-border px-2.5 py-1 font-mono text-[11.5px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:`+ new`})]}),he?(0,$.jsxs)(`div`,{"data-slot":`wb-auto-panel`,className:`mt-4 rounded-lg border border-border bg-card p-3 shadow-xs`,children:[(0,$.jsx)(`div`,{className:`text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:`Build a chain from a prompt`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-soft-foreground`,children:`Describe what the chain should do. An agent proposes a title and an ordered set of skill / check steps — land it on the canvas, then tweak and Save.`}),(0,$.jsx)(E,{"data-slot":`wb-auto-text`,"aria-label":`Describe the chain to build`,rows:3,autoFocus:!0,placeholder:`e.g. Fix the bug, run the tests, then review the diff for regressions.`,value:I,onChange:e=>L(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),Pe())},className:`mt-2 min-h-20 text-[13px]`}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,$.jsxs)(c,{type:`button`,variant:`contrast`,size:`sm`,"data-slot":`wb-auto-run`,disabled:we.isPending||I.trim()===``,onClick:Pe,children:[(0,$.jsx)(pe,{"aria-hidden":`true`,className:`size-3`}),we.isPending?`Building…`:`Build chain`]}),(0,$.jsx)(c,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto-cancel`,onClick:()=>{F(!1),L(``)},children:`Cancel`})]})]}):null,re?(0,$.jsxs)(`div`,{"data-slot":`wb-import-panel`,className:`mt-4 rounded-lg border border-border bg-card p-3 shadow-xs`,children:[(0,$.jsx)(`div`,{className:`text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:`Import workflow YAML`}),(0,$.jsx)(E,{"data-slot":`wb-import-text`,"aria-label":`Workflow YAML to import`,rows:6,spellCheck:!1,placeholder:`name: my-flow
9
+ skills:
10
+ - test-conventions
11
+ - commit-style`,value:oe,onChange:e=>j(e.target.value),className:`mt-2 min-h-28 font-mono text-xs`}),de===``?null:(0,$.jsx)(`p`,{"data-slot":`wb-import-error`,className:`mt-2 text-xs text-danger`,children:de}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,$.jsx)(c,{type:`button`,variant:`contrast`,size:`sm`,"data-slot":`wb-import-run`,disabled:Ce.isPending,onClick:Ne,children:`Import`}),(0,$.jsx)(c,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import-cancel`,onClick:()=>{D(!1),j(``),me(``)},children:`Cancel`})]})]}):null,(0,$.jsx)(Yr,{steps:W,skills:H,dragging:z!==null,overId:ye,activeStepId:z?.type===`step`?z.step.id:null,onRemove:e=>U(Lr(W,e))})]}),(0,$.jsxs)(`aside`,{"data-slot":`wb-aside`,className:`w-full shrink-0 md:w-[320px]`,children:[(0,$.jsx)(`div`,{className:`text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:`Skills`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-soft-foreground`,children:`Drag into the flow. Order is execution order — the agent applies them top to bottom.`}),(0,$.jsx)(O,{"data-slot":`wb-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:w,onChange:e=>T(e.target.value),className:`mt-2.5 h-8 text-[13px]`}),(0,$.jsx)(Qr,{skills:Se,query:w,error:n.isError?n.error.message:null,inFlow:new Set(W.map(e=>e.skill).filter(e=>!!e)),onAdd:e=>ke(e)}),(0,$.jsxs)(`div`,{className:`mt-5 flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:`workflow.yaml`}),(0,$.jsx)(`span`,{className:`flex-1`}),(0,$.jsx)(ei,{yaml:K})]}),(0,$.jsx)(`pre`,{"data-slot":`wb-yaml`,className:`mt-2 overflow-x-auto rounded-lg border border-border bg-card p-3 font-mono text-[11.5px] leading-relaxed whitespace-pre text-muted-foreground shadow-xs`,children:K}),(0,$.jsx)(`p`,{className:`mt-2 text-[11.5px] leading-relaxed text-soft-foreground`,children:`Portable — export this file and import it in any repo running cezar.`})]})]}),(0,$.jsx)(or,{children:z?.type===`palette`?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[13px] font-medium shadow-md`,children:[(0,$.jsx)(M,{"aria-hidden":`true`,className:`size-3.5 text-primary`}),z.skill]}):z?.type===`step`?(0,$.jsx)(Zr,{step:z.step,index:W.findIndex(e=>e.id===z.step.id),skills:H,overlay:!0}):null})]}),(0,$.jsx)(N,{open:R,onOpenChange:e=>!e&&ge(!1),children:(0,$.jsxs)(ue,{"data-slot":`wb-overwrite-dialog`,children:[(0,$.jsxs)(k,{children:[(0,$.jsxs)(ie,{children:[`“`,G,`” already exists`]}),(0,$.jsx)(A,{children:`Saving overwrites the existing workflow file. There is no undo.`})]}),(0,$.jsxs)(le,{children:[(0,$.jsx)(ce,{children:`Keep the file`}),(0,$.jsx)(se,{"data-slot":`wb-overwrite-confirm`,onClick:()=>Te.mutate(!0),children:`Overwrite`})]})]})}),(0,$.jsx)(N,{open:_e,onOpenChange:e=>!e&&ve(!1),children:(0,$.jsxs)(ue,{"data-slot":`wb-delete-dialog`,children:[(0,$.jsxs)(k,{children:[(0,$.jsxs)(ie,{children:[`Delete workflow “`,G,`”?`]}),(0,$.jsxs)(A,{children:[`Removes `,Oe?.path?.split(`/`).pop()??`the saved file`,` from`,` `,(0,$.jsx)(`span`,{className:`font-mono`,children:`.ai/cezar/workflows/`}),`. There is no undo.`]})]}),(0,$.jsxs)(le,{children:[(0,$.jsx)(ce,{children:`Keep it`}),(0,$.jsx)(se,{"data-slot":`wb-delete-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>Ee.mutate(G),children:`Delete`})]})]})})]})}function Yr({steps:e,skills:t,dragging:n,overId:r,activeStepId:i,onRemove:a}){let{setNodeRef:o,isOver:s}=Jn({id:Wr}),c=n&&r===Wr;return(0,$.jsx)(`div`,{ref:o,"data-slot":`wb-steps`,"data-dragging":n||void 0,className:b(`mt-4 rounded-lg border border-dashed p-2 transition-colors`,s?`border-primary/60 bg-primary/5`:`border-muted-foreground/25`),children:e.length===0?(0,$.jsx)(`p`,{className:b(`rounded-md px-3 py-10 text-center text-[13px] transition-colors`,s?`text-primary`:`text-muted-foreground`),children:`Drop a skill here — or Import a workflow.yaml`}):(0,$.jsxs)(vr,{items:e.map(e=>e.id),strategy:mr,children:[(0,$.jsx)(`ol`,{className:`flex flex-col gap-2.5`,children:e.map((e,o)=>(0,$.jsx)(Xr,{step:e,index:o,skills:t,connector:o>0,dragging:n,insertBefore:n&&r===e.id&&i!==e.id,onRemove:()=>a(o)},e.id))}),(0,$.jsx)(`div`,{"aria-hidden":`true`,className:b(`mx-1 mt-2.5 h-[3px] rounded-full transition-colors`,c?`bg-primary`:`bg-transparent`)}),(0,$.jsxs)(`div`,{className:`flex items-center justify-center gap-1.5 pt-1.5 pb-1 text-[11px] text-muted-foreground`,children:[(0,$.jsx)(j,{"aria-hidden":`true`,className:`size-3`}),`runs top to bottom`]})]})})}function Xr({step:e,index:t,skills:n,connector:r,dragging:i,insertBefore:a,onRemove:o}){let{attributes:s,listeners:c,setNodeRef:l,transform:u,transition:d,isDragging:f}=Er({id:e.id,data:{type:`step`,step:e}});return(0,$.jsxs)(`li`,{ref:l,style:{transform:K.Transform.toString(u),transition:d},className:b(`relative`,f&&`opacity-40`),children:[r&&!i?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute -top-[11px] left-1/2 h-[9px] w-px -translate-x-1/2 bg-muted-foreground/30`}):null,a?(0,$.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-drop-line`,className:`pointer-events-none absolute -top-[7px] right-0 left-0 h-[3px] rounded-full bg-primary`}):null,(0,$.jsx)(Zr,{step:e,index:t,skills:n,onRemove:o,gripProps:{...s,...c}})]})}function Zr({step:e,index:t,skills:n,onRemove:r,gripProps:i,overlay:a=!1}){let o=n.find(t=>t.name===e.skill),s=!!e.command,c=s||!e.skill?e.name??e.id:e.skill,l=s?`$ ${e.command}${e.onFail?` — on fail retry from "${e.onFail.retry}" (×${e.onFail.max??2})`:``}`:e.skill?o?.description??`Not in this repo or the team skills — the step runs on its plain prompt.`:e.prompt??``,u=s?`check`:e.skill?o?null:`unknown`:`prompt`;return(0,$.jsxs)(`div`,{"data-slot":`wb-step`,"data-id":e.id,"data-index":t,className:b(`flex items-center gap-2.5 rounded-md border border-muted-foreground/20 bg-card-2 px-2.5 py-2 shadow-xs`,a&&`shadow-md`),children:[(0,$.jsx)(`button`,{type:`button`,"data-slot":`wb-step-grip`,"aria-label":`Reorder step ${t+1}: ${c}`,className:`shrink-0 cursor-grab rounded text-muted-foreground outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,...i,children:(0,$.jsx)(oe,{"aria-hidden":`true`,className:`size-3.5`})}),(0,$.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:String(t+1).padStart(2,`0`)}),s?(0,$.jsx)(w,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-success`}):(0,$.jsx)(M,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`truncate font-mono text-[13px] font-medium`,children:c}),l?(0,$.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:l}):null]}),u?(0,$.jsx)(`span`,{"data-slot":`wb-step-badge`,className:b(`shrink-0 rounded-full border px-2 py-px font-mono text-[10.5px]`,u===`check`&&`border-success/30 text-success`,u===`unknown`&&`border-danger/35 text-danger`,u===`prompt`&&`border-border text-soft-foreground`),children:u}):null,r?(0,$.jsx)(`button`,{type:`button`,"data-slot":`wb-step-remove`,"aria-label":`Remove step ${t+1}: ${c}`,title:`Remove from flow`,onClick:r,className:`shrink-0 rounded p-0.5 text-soft-foreground transition-colors outline-none hover:text-danger focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:(0,$.jsx)(T,{"aria-hidden":`true`,className:`size-3.5`})}):null]})}function Qr({skills:e,query:t,error:n,inFlow:r,onAdd:i}){if(n!==null)return(0,$.jsxs)(`p`,{"data-slot":`wb-palette`,className:`mt-2.5 text-xs text-danger`,children:[`Could not load skills: `,n]});let a=t.trim().toLowerCase(),o=e.filter(e=>a===``||e.name.toLowerCase().includes(a)||(e.description??``).toLowerCase().includes(a));return(0,$.jsx)(`div`,{"data-slot":`wb-palette`,className:`mt-2.5 flex flex-col gap-1`,children:o.length>0?o.map(e=>(0,$.jsx)($r,{skill:e,inFlow:r.has(e.name),onAdd:i},e.path)):(0,$.jsx)(`p`,{className:`py-1 text-xs leading-relaxed text-soft-foreground`,children:e.length>0?`No skills match.`:(0,$.jsx)(de,{})})})}function $r({skill:e,inFlow:t,onAdd:n}){let{attributes:r,listeners:i,setNodeRef:a,isDragging:o}=Wn({id:`palette:${e.name}`,data:{type:`palette`,skill:e.name}});return(0,$.jsxs)(`div`,{ref:a,"data-slot":`wb-skill`,"data-skill":e.name,title:e.description??``,className:b(`flex cursor-grab items-center gap-2 rounded-md border border-border bg-card px-2.5 py-1.5 shadow-xs transition-colors hover:bg-muted`,o&&`opacity-40`),...r,...i,children:[(0,$.jsx)(M,{"aria-hidden":`true`,className:b(`size-3.5 shrink-0`,re(e)?`text-violet`:`text-soft-foreground`)}),(0,$.jsx)(`span`,{className:b(`min-w-0 flex-1 truncate font-mono text-[13px]`,re(e)?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:e.name}),t?(0,$.jsx)(x,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-success`}):null,(0,$.jsx)(`button`,{type:`button`,"data-slot":`wb-skill-add`,"aria-label":`Add ${e.name} to the flow`,title:`Add to the flow`,onClick:()=>n(e.name),className:`shrink-0 rounded p-0.5 text-soft-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:(0,$.jsx)(D,{"aria-hidden":`true`,className:`size-3.5`})})]})}function ei({yaml:e}){let[t,n]=(0,P.useState)(!1),r=(0,P.useRef)(null);return(0,P.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]),(0,$.jsx)(`button`,{type:`button`,"data-slot":`wb-copy`,title:`Copy the YAML`,onClick:()=>{navigator.clipboard?.writeText(e).catch(()=>{}),n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),1600)},className:`flex items-center gap-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:t?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(x,{"aria-hidden":`true`,className:`size-3 text-success`}),`Copied`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(S,{"aria-hidden":`true`,className:`size-3`}),`Copy`]})})}export{qr as WorkflowsRoute};
@@ -0,0 +1 @@
1
+ import{r as e}from"./utils-B8s5qIcK.js";var t=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t};
@@ -41,18 +41,24 @@
41
41
  }
42
42
  })()
43
43
  </script>
44
- <script type="module" crossorigin src="/assets/index-CcfkF2Ey.js"></script>
44
+ <script type="module" crossorigin src="/assets/index-DmW_TYjO.js"></script>
45
45
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-BegPhL5c.js">
46
46
  <link rel="modulepreload" crossorigin href="/assets/utils-B8s5qIcK.js">
47
- <link rel="modulepreload" crossorigin href="/assets/centered-state-CLmJ67EV.js">
47
+ <link rel="modulepreload" crossorigin href="/assets/centered-state-zzWBfO_1.js">
48
+ <link rel="modulepreload" crossorigin href="/assets/loader-circle-CGwIVNTv.js">
49
+ <link rel="modulepreload" crossorigin href="/assets/dist-Cw_CDvC3.js">
50
+ <link rel="modulepreload" crossorigin href="/assets/x-DgoqYQOJ.js">
51
+ <link rel="modulepreload" crossorigin href="/assets/dialog-BYr_BAil.js">
52
+ <link rel="modulepreload" crossorigin href="/assets/command-ylf8-fG0.js">
53
+ <link rel="modulepreload" crossorigin href="/assets/dropdown-menu-C3GD8eLA.js">
54
+ <link rel="modulepreload" crossorigin href="/assets/prompt-templates-DW7_d8Ys.js">
48
55
  <link rel="modulepreload" crossorigin href="/assets/search-x-BDjaMrzG.js">
49
56
  <link rel="modulepreload" crossorigin href="/assets/triangle-alert-Uy8rokUh.js">
50
- <link rel="modulepreload" crossorigin href="/assets/textarea-Bj_LCreg.js">
51
- <link rel="modulepreload" crossorigin href="/assets/dist-CqH67S8q.js">
52
- <link rel="modulepreload" crossorigin href="/assets/project-router-BaWVyqc8.js">
57
+ <link rel="modulepreload" crossorigin href="/assets/project-router-CT8Rt5Eu.js">
58
+ <link rel="modulepreload" crossorigin href="/assets/tasks-table--V1pKwuK.js">
53
59
  <link rel="modulepreload" crossorigin href="/assets/lib-uHpeUPzK.js">
54
60
  <link rel="modulepreload" crossorigin href="/assets/chunk-BO2N2NFS-DtrdTCWa.js">
55
- <link rel="stylesheet" crossorigin href="/assets/index-DzroxqBG.css">
61
+ <link rel="stylesheet" crossorigin href="/assets/index-Qbs-JRWQ.css">
56
62
  </head>
57
63
  <body>
58
64
  <div id="root"></div>
@@ -1,36 +0,0 @@
1
- /**
2
- * Per-item coalescing of streamed assistant text into whole v1 `text` events.
3
- *
4
- * The v1 `AgentEvent` contract treats `text` as a complete assistant block —
5
- * that is what claude emits, what the RunManager persists one NDJSON line per
6
- * event, and what every consumer renders as one paragraph (cockpit thread,
7
- * headless CLI). Codex and opencode stream deltas, so emitting each delta as
8
- * its own `text` event persisted one line per token: transcripts rendered one
9
- * paragraph per token, and turn-end markers split across deltas (`CE`+`Z`+
10
- * `:D`+`ONE`) slipped past the server's per-event marker stripping.
11
- *
12
- * Streaming display does not go through v1 at all — protocol v2's
13
- * `item.delta` (coalesced by `UiEventSink`) carries it — so v1 can afford
14
- * whole-block granularity.
15
- */
16
- export declare class V1TextCoalescer {
17
- private readonly emitText;
18
- /** Accumulated deltas per open item. Deltas with no item id share the ''
19
- * bucket (at most one anonymous item streams at a time). */
20
- private readonly pending;
21
- /** Items already emitted — a late snapshot/delta must not double-emit. */
22
- private readonly done;
23
- constructor(emitText: (text: string) => void);
24
- /** Buffer one streamed delta of an item. */
25
- append(itemId: string | undefined, delta: string): void;
26
- /**
27
- * The item is final: emit its text exactly once — the wire snapshot when the
28
- * backend sent one (authoritative full text), else the accumulated deltas.
29
- */
30
- complete(itemId: string | undefined, snapshotText?: string): void;
31
- /** Turn/session boundary: emit whatever never saw its item complete, in
32
- * arrival order, so interrupted turns still surface their partial prose.
33
- * The `done` latch survives on purpose — item/part ids are unique per
34
- * session, and a re-sent snapshot after the boundary must not re-emit. */
35
- flush(): void;
36
- }
@@ -1,72 +0,0 @@
1
- /**
2
- * Per-item coalescing of streamed assistant text into whole v1 `text` events.
3
- *
4
- * The v1 `AgentEvent` contract treats `text` as a complete assistant block —
5
- * that is what claude emits, what the RunManager persists one NDJSON line per
6
- * event, and what every consumer renders as one paragraph (cockpit thread,
7
- * headless CLI). Codex and opencode stream deltas, so emitting each delta as
8
- * its own `text` event persisted one line per token: transcripts rendered one
9
- * paragraph per token, and turn-end markers split across deltas (`CE`+`Z`+
10
- * `:D`+`ONE`) slipped past the server's per-event marker stripping.
11
- *
12
- * Streaming display does not go through v1 at all — protocol v2's
13
- * `item.delta` (coalesced by `UiEventSink`) carries it — so v1 can afford
14
- * whole-block granularity.
15
- */
16
- export class V1TextCoalescer {
17
- emitText;
18
- /** Accumulated deltas per open item. Deltas with no item id share the ''
19
- * bucket (at most one anonymous item streams at a time). */
20
- pending = new Map();
21
- /** Items already emitted — a late snapshot/delta must not double-emit. */
22
- done = new Set();
23
- constructor(emitText) {
24
- this.emitText = emitText;
25
- }
26
- /** Buffer one streamed delta of an item. */
27
- append(itemId, delta) {
28
- if (delta === '')
29
- return;
30
- const key = itemId ?? '';
31
- if (this.done.has(key))
32
- return;
33
- this.pending.set(key, (this.pending.get(key) ?? '') + delta);
34
- }
35
- /**
36
- * The item is final: emit its text exactly once — the wire snapshot when the
37
- * backend sent one (authoritative full text), else the accumulated deltas.
38
- */
39
- complete(itemId, snapshotText) {
40
- const key = itemId ?? '';
41
- if (this.done.has(key))
42
- return;
43
- // The anonymous bucket is never latched: without an identity, "already
44
- // emitted" can't be told apart from "the next id-less item".
45
- if (key !== '')
46
- this.done.add(key);
47
- let buffered = this.pending.get(key);
48
- this.pending.delete(key);
49
- if (buffered === undefined && key !== '') {
50
- // Deltas that arrived without an item id belong to the only in-flight item.
51
- buffered = this.pending.get('');
52
- this.pending.delete('');
53
- }
54
- const text = snapshotText !== undefined && snapshotText !== '' ? snapshotText : (buffered ?? '');
55
- if (text !== '')
56
- this.emitText(text);
57
- }
58
- /** Turn/session boundary: emit whatever never saw its item complete, in
59
- * arrival order, so interrupted turns still surface their partial prose.
60
- * The `done` latch survives on purpose — item/part ids are unique per
61
- * session, and a re-sent snapshot after the boundary must not re-emit. */
62
- flush() {
63
- for (const [key, text] of this.pending) {
64
- if (text !== '')
65
- this.emitText(text);
66
- if (key !== '')
67
- this.done.add(key);
68
- }
69
- this.pending.clear();
70
- }
71
- }
72
- //# sourceMappingURL=v1-text-coalescer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"v1-text-coalescer.js","sourceRoot":"","sources":["../../src/core/v1-text-coalescer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,eAAe;IAOG,QAAQ;IANrC;iEAC6D;IAC5C,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IACrD,0EAA0E;IACzD,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAE1C,YAA6B,QAAgC;wBAAhC,QAAQ;IAA2B,CAAC;IAEjE,4CAA4C;IAC5C,MAAM,CAAC,MAA0B,EAAE,KAAa;QAC9C,IAAI,KAAK,KAAK,EAAE;YAAE,OAAO;QACzB,MAAM,GAAG,GAAG,MAAM,IAAI,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO;QAC/B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC;IAC/D,CAAC;IAED;;;OAGG;IACH,QAAQ,CAAC,MAA0B,EAAE,YAAqB;QACxD,MAAM,GAAG,GAAG,MAAM,IAAI,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO;QAC/B,uEAAuE;QACvE,6DAA6D;QAC7D,IAAI,GAAG,KAAK,EAAE;YAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACnC,IAAI,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACzB,IAAI,QAAQ,KAAK,SAAS,IAAI,GAAG,KAAK,EAAE,EAAE,CAAC;YACzC,4EAA4E;YAC5E,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAChC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC1B,CAAC;QACD,MAAM,IAAI,GAAG,YAAY,KAAK,SAAS,IAAI,YAAY,KAAK,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;QACjG,IAAI,IAAI,KAAK,EAAE;YAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAED;;;+EAG2E;IAC3E,KAAK;QACH,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACvC,IAAI,IAAI,KAAK,EAAE;gBAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACrC,IAAI,GAAG,KAAK,EAAE;gBAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACrC,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;CACF"}