maestro-flow 0.3.6 → 0.3.8

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 (106) hide show
  1. package/.claude/commands/learn-retro.md +303 -0
  2. package/.claude/commands/maestro-execute.md +3 -2
  3. package/.claude/commands/maestro-learn.md +74 -298
  4. package/.claude/commands/manage-learn.md +21 -15
  5. package/.claude/commands/manage-memory-capture.md +13 -15
  6. package/.claude/commands/manage-memory.md +1 -1
  7. package/.claude/commands/quality-retrospective.md +5 -5
  8. package/.claude/commands/spec-load.md +7 -2
  9. package/.claude/commands/wiki-digest.md +27 -2
  10. package/README.md +103 -220
  11. package/README.zh-CN.md +159 -181
  12. package/dashboard/dist/assets/{ArtifactsPage-A9yzYtpj.js → ArtifactsPage-BmPOu8sO.js} +1 -1
  13. package/dashboard/dist/assets/{ChatInput-PuCvZZ3y.js → ChatInput-CL8YDfOU.js} +1 -1
  14. package/dashboard/dist/assets/ChatPage-CT-ozBK2.js +8 -0
  15. package/dashboard/dist/assets/{CollabPage-I5k_mCbG.js → CollabPage-C0rWMden.js} +1 -1
  16. package/dashboard/dist/assets/{KanbanPage-PDDBv5-9.js → KanbanPage-C6WbAlwI.js} +1 -1
  17. package/dashboard/dist/assets/{MarkdownRenderer-CCXHaut3.js → MarkdownRenderer-BjZ43aSa.js} +1 -1
  18. package/dashboard/dist/assets/{McpPage-CiqXpCHg.js → McpPage-BPIXADQi.js} +1 -1
  19. package/dashboard/dist/assets/{RequirementBoardPage-CEOvppGn.js → RequirementBoardPage-B7yRL0s_.js} +1 -1
  20. package/dashboard/dist/assets/{RequirementPage-DpnbTEqY.js → RequirementPage-D8J_-b6O.js} +1 -1
  21. package/dashboard/dist/assets/{SpecsPage-CYqOfFkB.js → SpecsPage-6lO8v8_C.js} +1 -1
  22. package/dashboard/dist/assets/{SupervisorPage-B2sZwkq8.js → SupervisorPage-Ds5N378a.js} +1 -1
  23. package/dashboard/dist/assets/{TeamsPage-CkZdCAVZ.js → TeamsPage-DrkKr17T.js} +1 -1
  24. package/dashboard/dist/assets/{TreeBrowser-0VIMWclo.js → TreeBrowser-g_QUKemL.js} +1 -1
  25. package/dashboard/dist/assets/WorkflowPage-X8aNkDEr.js +6 -0
  26. package/dashboard/dist/assets/{arrow-left-6fktHyjN.js → arrow-left-CadP5YgU.js} +1 -1
  27. package/dashboard/dist/assets/{check-Cbxq2l1-.js → check-5xufDzS8.js} +1 -1
  28. package/dashboard/dist/assets/{chevron-right-Yts3bi8p.js → chevron-right-CYbpR4ev.js} +1 -1
  29. package/dashboard/dist/assets/{circle-4Ci4Xolf.js → circle-Bm-5Q-Yh.js} +1 -1
  30. package/dashboard/dist/assets/{circle-alert-B25g9BTL.js → circle-alert-BqcYuT7x.js} +1 -1
  31. package/dashboard/dist/assets/{circle-check-BA5_XqeV.js → circle-check-DEVzW_lm.js} +1 -1
  32. package/dashboard/dist/assets/{circle-check-big-DzO2BlL7.js → circle-check-big-yyzAFysU.js} +1 -1
  33. package/dashboard/dist/assets/{code-zxwuybO8.js → code-BBdC8Wmw.js} +1 -1
  34. package/dashboard/dist/assets/{columns-3-DV4oeCfU.js → columns-3-CQ9Trztr.js} +1 -1
  35. package/dashboard/dist/assets/{download-CXCyQw8M.js → download-DayuF-sn.js} +1 -1
  36. package/dashboard/dist/assets/{folder-Bvjj8Vn9.js → folder-CqXeSKeC.js} +1 -1
  37. package/dashboard/dist/assets/{git-branch-DL8p9kVC.js → git-branch-SqFf4Ru5.js} +1 -1
  38. package/dashboard/dist/assets/{index-BvScJmJM.js → index-Dru5HYy0.js} +1 -1
  39. package/dashboard/dist/assets/{index-11DuhKhc.js → index-nufWop4p.js} +18 -18
  40. package/dashboard/dist/assets/{list-Dj4i9N75.js → list-DBOD6IUt.js} +1 -1
  41. package/dashboard/dist/assets/{minus-DwlFabsT.js → minus-fQI1Syn2.js} +1 -1
  42. package/dashboard/dist/assets/{pen-line-D7UzECt6.js → pen-line-Bkbbngl5.js} +1 -1
  43. package/dashboard/dist/assets/{proxy-B9XRqHD9.js → proxy-teW12DdZ.js} +1 -1
  44. package/dashboard/dist/assets/{search-BQbBTIYl.js → search-Bq3ygFUW.js} +1 -1
  45. package/dashboard/dist/assets/{shallow-Clb1Lyd_.js → shallow-22ZN8sFt.js} +1 -1
  46. package/dashboard/dist/assets/{table-BqxCXid2.js → table-BEYtdWc4.js} +1 -1
  47. package/dashboard/dist/assets/{trash-2-6rN9B-EQ.js → trash-2-DMqGBgcF.js} +1 -1
  48. package/dashboard/dist/assets/{wrench-BScEJFqC.js → wrench-B84-zdLI.js} +1 -1
  49. package/dashboard/dist/assets/{zap-DxUhG-gk.js → zap-9DVkGVtt.js} +1 -1
  50. package/dashboard/dist/index.html +1 -1
  51. package/dashboard/dist-server/dashboard/src/server/agents/agent-sdk-adapter.d.ts +1 -1
  52. package/dashboard/dist-server/dashboard/src/server/agents/agent-sdk-adapter.js +5 -4
  53. package/dashboard/dist-server/dashboard/src/server/agents/agent-sdk-adapter.js.map +1 -1
  54. package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js +1 -1
  55. package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js.map +1 -1
  56. package/dashboard/dist-server/dashboard/src/server/agents/tools/issue-mcp-server.d.ts +1 -1
  57. package/dashboard/dist-server/dashboard/src/server/agents/tools/issue-mcp-server.js +3 -4
  58. package/dashboard/dist-server/dashboard/src/server/agents/tools/issue-mcp-server.js.map +1 -1
  59. package/dashboard/dist-server/dashboard/src/server/agents/tools/issue-mcp-server.test.js +4 -4
  60. package/dashboard/dist-server/dashboard/src/server/agents/tools/issue-mcp-server.test.js.map +1 -1
  61. package/dashboard/dist-server/dashboard/src/server/commander/commander-agent.js +4 -3
  62. package/dashboard/dist-server/dashboard/src/server/commander/commander-agent.js.map +1 -1
  63. package/dashboard/dist-server/dashboard/src/server/commander/commander-agent.test.js +20 -7
  64. package/dashboard/dist-server/dashboard/src/server/commander/commander-agent.test.js.map +1 -1
  65. package/dashboard/dist-server/dashboard/src/server/execution/wave-executor.d.ts +1 -1
  66. package/dashboard/dist-server/dashboard/src/server/execution/wave-executor.js +4 -4
  67. package/dashboard/dist-server/dashboard/src/server/execution/wave-executor.js.map +1 -1
  68. package/dashboard/dist-server/dashboard/src/server/index.js +2 -1
  69. package/dashboard/dist-server/dashboard/src/server/index.js.map +1 -1
  70. package/dashboard/dist-server/dashboard/src/server/routes/issues.js +14 -14
  71. package/dashboard/dist-server/dashboard/src/server/routes/issues.js.map +1 -1
  72. package/dashboard/dist-server/dashboard/src/server/routes/linear.js +7 -5
  73. package/dashboard/dist-server/dashboard/src/server/routes/linear.js.map +1 -1
  74. package/dashboard/dist-server/dashboard/src/server/state/state-manager.js +144 -23
  75. package/dashboard/dist-server/dashboard/src/server/state/state-manager.js.map +1 -1
  76. package/dashboard/dist-server/dashboard/src/server/utils/issue-store.d.ts +6 -0
  77. package/dashboard/dist-server/dashboard/src/server/utils/issue-store.js +24 -2
  78. package/dashboard/dist-server/dashboard/src/server/utils/issue-store.js.map +1 -1
  79. package/dashboard/dist-server/dashboard/src/server/ws/handlers/execution-handler.js +4 -7
  80. package/dashboard/dist-server/dashboard/src/server/ws/handlers/execution-handler.js.map +1 -1
  81. package/dashboard/dist-server/dashboard/src/shared/constants.js +2 -1
  82. package/dashboard/dist-server/dashboard/src/shared/constants.js.map +1 -1
  83. package/dashboard/dist-server/dashboard/src/shared/constants.test.js +5 -5
  84. package/dashboard/dist-server/dashboard/src/shared/constants.test.js.map +1 -1
  85. package/dashboard/dist-server/dashboard/src/shared/issue-types.test.js +4 -4
  86. package/dashboard/dist-server/dashboard/src/shared/issue-types.test.js.map +1 -1
  87. package/dashboard/dist-server/src/commands/delegate.js +7 -1
  88. package/dashboard/dist-server/src/commands/delegate.js.map +1 -1
  89. package/dist/src/commands/delegate.d.ts.map +1 -1
  90. package/dist/src/commands/delegate.js +7 -1
  91. package/dist/src/commands/delegate.js.map +1 -1
  92. package/package.json +1 -1
  93. package/workflows/delegate-usage.md +39 -41
  94. package/workflows/execute.md +154 -34
  95. package/workflows/init.md +1 -1
  96. package/workflows/maestro-coordinate.codex.md +1 -1
  97. package/workflows/maestro-coordinate.md +1 -1
  98. package/workflows/maestro.md +2 -2
  99. package/workflows/memory.md +2 -1
  100. package/workflows/plan.md +9 -2
  101. package/workflows/retrospective.md +2 -2
  102. package/workflows/roadmap.md +1 -1
  103. package/.claude/commands/learn-retro-decision.md +0 -198
  104. package/.claude/commands/learn-retro-git.md +0 -160
  105. package/dashboard/dist/assets/ChatPage-v19GURYH.js +0 -8
  106. package/dashboard/dist/assets/WorkflowPage-Csm23wUS.js +0 -6
@@ -1,4 +1,4 @@
1
- import{E as M,j as s,r as N,x as gn,d as Se,y as vn,k as Pe,s as yt,p as bn,i as Le,c as yn,R as wn,P as Cn,O as kn,f as Tn,T as In,h as uo,v as Sn,t as zt}from"./index-11DuhKhc.js";import{Z as Dt}from"./zap-DxUhG-gk.js";import{M as jn}from"./MarkdownRenderer-CCXHaut3.js";import{W as Rn,T as Nn}from"./wrench-BScEJFqC.js";import{C as Mo}from"./chevron-right-Yts3bi8p.js";import{C as zn}from"./circle-alert-B25g9BTL.js";const It=0,Ae=1,qe=2,Lo=4;function po(e){return()=>e}function En(e){e()}function Oo(e,t){return o=>e(t(o))}function mo(e,t){return()=>e(t)}function Hn(e,t){return o=>e(t,o)}function Ut(e){return e!==void 0}function Bn(...e){return()=>{e.map(En)}}function Ze(){}function St(e,t){return t(e),e}function Mn(e,t){return t(e)}function oe(...e){return e}function Q(e,t){return e(Ae,t)}function $(e,t){e(It,t)}function Kt(e){e(qe)}function se(e){return e(Lo)}function L(e,t){return Q(e,Hn(t,It))}function je(e,t){const o=e(Ae,n=>{o(),t(n)});return o}function ho(e){let t,o;return n=>r=>{t=r,o&&clearTimeout(o),o=setTimeout(()=>{n(t)},e)}}function Ao(e,t){return e===t}function te(e=Ao){let t;return o=>n=>{e(t,n)||(t=n,o(n))}}function W(e){return t=>o=>{e(o)&&t(o)}}function z(e){return t=>Oo(t,e)}function ze(e){return t=>()=>{t(e)}}function C(e,...t){const o=Ln(...t);return((n,r)=>{switch(n){case qe:Kt(e);return;case Ae:return Q(e,o(r))}})}function Ee(e,t){return o=>n=>{o(t=e(t,n))}}function Ve(e){return t=>o=>{e>0?e--:t(o)}}function Be(e){let t=null,o;return n=>r=>{t=r,!o&&(o=setTimeout(()=>{o=void 0,n(t)},e))}}function G(...e){const t=new Array(e.length);let o=0,n=null;const r=2**e.length-1;return e.forEach((l,i)=>{const c=2**i;Q(l,a=>{const u=o;o|=c,t[i]=a,u!==r&&o===r&&n&&(n(),n=null)})}),l=>i=>{const c=()=>{l([i].concat(t))};o===r?c():n=c}}function Ln(...e){return t=>e.reduceRight(Mn,t)}function On(e){let t,o;const n=()=>t==null?void 0:t();return function(r,l){switch(r){case Ae:return l?o===l?void 0:(n(),o=l,t=Q(e,l),t):(n(),Ze);case qe:n(),o=null;return}}}function T(e){let t=e;const o=K();return((n,r)=>{switch(n){case It:t=r;break;case Ae:{r(t);break}case Lo:return t}return o(n,r)})}function ve(e,t){return St(T(t),o=>L(e,o))}function K(){const e=[];return((t,o)=>{switch(t){case It:e.slice().forEach(n=>{n(o)});return;case qe:e.splice(0,e.length);return;case Ae:return e.push(o),()=>{const n=e.indexOf(o);n>-1&&e.splice(n,1)}}})}function ke(e){return St(K(),t=>L(e,t))}function Y(e,t=[],{singleton:o}={singleton:!0}){return{constructor:e,dependencies:t,id:An(),singleton:o}}const An=()=>Symbol();function _n(e){const t=new Map,o=({constructor:n,dependencies:r,id:l,singleton:i})=>{if(i&&t.has(l))return t.get(l);const c=n(r.map(a=>o(a)));return i&&t.set(l,c),c};return o(e)}function ue(...e){const t=K(),o=new Array(e.length);let n=0;const r=2**e.length-1;return e.forEach((l,i)=>{const c=2**i;Q(l,a=>{o[i]=a,n|=c,n===r&&$(t,o)})}),function(l,i){switch(l){case qe:{Kt(t);return}case Ae:return n===r&&i(o),Q(t,i)}}}function D(e,t=Ao){return C(e,te(t))}function Wt(...e){return function(t,o){switch(t){case qe:return;case Ae:return Bn(...e.map(n=>Q(n,o)))}}}const he={DEBUG:0,INFO:1,WARN:2,ERROR:3},Dn={[he.DEBUG]:"debug",[he.ERROR]:"error",[he.INFO]:"log",[he.WARN]:"warn"},Wn=()=>typeof globalThis>"u"?window:globalThis,_e=Y(()=>{const e=T(he.ERROR);return{log:T((t,o,n=he.INFO)=>{const r=Wn().VIRTUOSO_LOG_LEVEL??se(e);n>=r&&console[Dn[n]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,o)}),logLevel:e}},[],{singleton:!0});function $e(e,t,o){return Yt(e,t,o).callbackRef}function Yt(e,t,o){const n=M.useRef(null);let r=i=>{};const l=M.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(i=>{const c=()=>{const a=i[0].target;a.offsetParent!==null&&e(a)};o?c():requestAnimationFrame(c)}):null,[e,o]);return r=i=>{i&&t?(l==null||l.observe(i),n.current=i):(n.current&&(l==null||l.unobserve(n.current)),n.current=null)},{callbackRef:r,ref:n}}function Fn(e,t,o,n,r,l,i,c,a){const u=M.useCallback(h=>{const v=Pn(h.children,t,c?"offsetWidth":"offsetHeight",r);let x=h.parentElement;for(;x.dataset.virtuosoScroller===void 0;)x=x.parentElement;const f=x.lastElementChild.dataset.viewportType==="window";let w;f&&(w=x.ownerDocument.defaultView);const b=i?c?i.scrollLeft:i.scrollTop:f?c?w.scrollX||w.document.documentElement.scrollLeft:w.scrollY||w.document.documentElement.scrollTop:c?x.scrollLeft:x.scrollTop,g=i?c?i.scrollWidth:i.scrollHeight:f?c?w.document.documentElement.scrollWidth:w.document.documentElement.scrollHeight:c?x.scrollWidth:x.scrollHeight,m=i?c?i.offsetWidth:i.offsetHeight:f?c?w.innerWidth:w.innerHeight:c?x.offsetWidth:x.offsetHeight;n({scrollHeight:g,scrollTop:Math.max(b,0),viewportHeight:m}),l==null||l(c?fo("column-gap",getComputedStyle(h).columnGap,r):fo("row-gap",getComputedStyle(h).rowGap,r)),v!==null&&e(v)},[e,t,r,l,i,n,c]);return Yt(u,o,a)}function Pn(e,t,o,n){const r=e.length;if(r===0)return null;const l=[];for(let i=0;i<r;i++){const c=e.item(i);if(c.dataset.index===void 0)continue;const a=parseInt(c.dataset.index),u=parseFloat(c.dataset.knownSize),h=t(c,o);if(h===0&&n("Zero-sized element, this should not happen",{child:c},he.ERROR),h===u)continue;const v=l[l.length-1];l.length===0||v.size!==h||v.endIndex!==a-1?l.push({endIndex:a,size:h,startIndex:a}):l[l.length-1].endIndex++}return l}function fo(e,t,o){return t!=="normal"&&(t==null?void 0:t.endsWith("px"))!==!0&&o(`${e} was not resolved to pixel value correctly`,t,he.WARN),t==="normal"?0:parseInt(t??"0",10)}function _o(e,t,o){const n=M.useRef(null),r=M.useCallback(a=>{if(!(a!=null&&a.offsetParent))return;const u=a.getBoundingClientRect(),h=u.width;let v,x;if(t){const f=t.getBoundingClientRect(),w=u.top-f.top;x=f.height-Math.max(0,w),v=w+t.scrollTop}else{const f=i.current.ownerDocument.defaultView;x=f.innerHeight-Math.max(0,u.top),v=u.top+f.scrollY}n.current={listHeight:u.height,offsetTop:v,visibleHeight:x,visibleWidth:h},e(n.current)},[e,t]),{callbackRef:l,ref:i}=Yt(r,!0,o),c=M.useCallback(()=>{r(i.current)},[r,i]);return M.useEffect(()=>{var u;if(t){t.addEventListener("scroll",c);const h=new ResizeObserver(()=>{requestAnimationFrame(c)});return h.observe(t),()=>{t.removeEventListener("scroll",c),h.unobserve(t)}}const a=(u=i.current)==null?void 0:u.ownerDocument.defaultView;return a==null||a.addEventListener("scroll",c),a==null||a.addEventListener("resize",c),()=>{a==null||a.removeEventListener("scroll",c),a==null||a.removeEventListener("resize",c)}},[c,t,i]),l}const ye=Y(()=>{const e=K(),t=K(),o=T(0),n=K(),r=T(0),l=K(),i=K(),c=T(0),a=T(0),u=T(0),h=T(0),v=K(),x=K(),f=T(!1),w=T(!1),b=T(!1);return L(C(e,z(({scrollTop:g})=>g)),t),L(C(e,z(({scrollHeight:g})=>g)),i),L(t,r),{deviation:o,fixedFooterHeight:u,fixedHeaderHeight:a,footerHeight:h,headerHeight:c,horizontalDirection:w,scrollBy:x,scrollContainerState:e,scrollHeight:i,scrollingInProgress:f,scrollTo:v,scrollTop:t,skipAnimationFrameInResizeObserver:b,smoothScrollTargetReached:n,statefulScrollTop:r,viewportHeight:l}},[],{singleton:!0}),rt={lvl:0};function Do(e,t){const o=e.length;if(o===0)return[];let{index:n,value:r}=t(e[0]);const l=[];for(let i=1;i<o;i++){const{index:c,value:a}=t(e[i]);l.push({end:c-1,start:n,value:r}),n=c,r=a}return l.push({end:1/0,start:n,value:r}),l}function q(e){return e===rt}function st(e,t){if(!q(e))return t===e.k?e.v:t<e.k?st(e.l,t):st(e.r,t)}function Re(e,t,o="k"){if(q(e))return[-1/0,void 0];if(Number(e[o])===t)return[e.k,e.v];if(Number(e[o])<t){const n=Re(e.r,t,o);return n[0]===-1/0?[e.k,e.v]:n}return Re(e.l,t,o)}function Ce(e,t,o){return q(e)?Po(t,o,1):t===e.k?me(e,{k:t,v:o}):t<e.k?xo(me(e,{l:Ce(e.l,t,o)})):xo(me(e,{r:Ce(e.r,t,o)}))}function Ye(){return rt}function Xe(e,t,o){if(q(e))return[];const n=Re(e,t)[0];return Vn(Pt(e,n,o))}function Ft(e,t){if(q(e))return rt;const{k:o,l:n,r}=e;if(t===o){if(q(n))return r;if(q(r))return n;const[l,i]=Fo(n);return wt(me(e,{k:l,l:Wo(n),v:i}))}return t<o?wt(me(e,{l:Ft(n,t)})):wt(me(e,{r:Ft(r,t)}))}function Fe(e){return q(e)?[]:[...Fe(e.l),{k:e.k,v:e.v},...Fe(e.r)]}function Pt(e,t,o){if(q(e))return[];const{k:n,l:r,r:l,v:i}=e;let c=[];return n>t&&(c=c.concat(Pt(r,t,o))),n>=t&&n<=o&&c.push({k:n,v:i}),n<=o&&(c=c.concat(Pt(l,t,o))),c}function wt(e){const{l:t,lvl:o,r:n}=e;if(n.lvl>=o-1&&t.lvl>=o-1)return e;if(o>n.lvl+1){if(Et(t))return Vo(me(e,{lvl:o-1}));if(!q(t)&&!q(t.r))return me(t.r,{l:me(t,{r:t.r.l}),lvl:o,r:me(e,{l:t.r.r,lvl:o-1})});throw new Error("Unexpected empty nodes")}if(Et(e))return Vt(me(e,{lvl:o-1}));if(!q(n)&&!q(n.l)){const r=n.l,l=Et(r)?n.lvl-1:n.lvl;return me(r,{l:me(e,{lvl:o-1,r:r.l}),lvl:r.lvl+1,r:Vt(me(n,{l:r.r,lvl:l}))})}throw new Error("Unexpected empty nodes")}function me(e,t){return Po(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Wo(e){return q(e.r)?e.l:wt(me(e,{r:Wo(e.r)}))}function Et(e){return q(e)||e.lvl>e.r.lvl}function Fo(e){return q(e.r)?[e.k,e.v]:Fo(e.r)}function Po(e,t,o,n=rt,r=rt){return{k:e,l:n,lvl:o,r,v:t}}function xo(e){return Vt(Vo(e))}function Vo(e){const{l:t}=e;return!q(t)&&t.lvl===e.lvl?me(t,{r:me(e,{l:t.r})}):e}function Vt(e){const{lvl:t,r:o}=e;return!q(o)&&!q(o.r)&&o.lvl===t&&o.r.lvl===t?me(o,{l:me(e,{r:o.l}),lvl:t+1}):e}function Vn(e){return Do(e,({k:t,v:o})=>({index:t,value:o}))}function $o(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function lt(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const Xt=Y(()=>({recalcInProgress:T(!1)}),[],{singleton:!0});function Go(e,t,o){return e[kt(e,t,o)]}function kt(e,t,o,n=0){let r=e.length-1;for(;n<=r;){const l=Math.floor((n+r)/2),i=e[l],c=o(i,t);if(c===0)return l;if(c===-1){if(r-n<2)return l-1;r=l-1}else{if(r===n)return l;n=l+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function $n(e,t,o,n){const r=kt(e,t,n),l=kt(e,o,n,r);return e.slice(r,l+1)}function Oe(e,t){return Math.round(e.getBoundingClientRect()[t])}function jt(e){return!q(e.groupOffsetTree)}function Qt({index:e},t){return t===e?0:t<e?-1:1}function Gn(){return{groupIndices:[],groupOffsetTree:Ye(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Ye()}}function Un(e,t){let o=q(e)?0:1/0;for(const n of t){const{endIndex:r,size:l,startIndex:i}=n;if(o=Math.min(o,i),q(e)){e=Ce(e,0,l);continue}const c=Xe(e,i-1,r+1);if(c.some(Jn(n)))continue;let a=!1,u=!1;for(const{end:h,start:v,value:x}of c)a?(r>=v||l===x)&&(e=Ft(e,v)):(u=x!==l,a=!0),h>r&&r>=v&&x!==l&&(e=Ce(e,r+1,x));u&&(e=Ce(e,i,l))}return[e,o]}function Kn(e){return typeof e.groupIndex<"u"}function Yn({offset:e},t){return t===e?0:t<e?-1:1}function it(e,t,o){if(t.length===0)return 0;const{index:n,offset:r,size:l}=Go(t,e,Qt),i=e-n,c=l*i+(i-1)*o+r;return c>0?c+o:c}function Uo(e,t){if(!jt(t))return e;let o=0;for(;t.groupIndices[o]<=e+o;)o++;return e+o}function Ko(e,t,o){if(Kn(e))return t.groupIndices[e.groupIndex]+1;const n=e.index==="LAST"?o:e.index;let r=Uo(n,t);return r=Math.max(0,r,Math.min(o,r)),r}function Xn(e,t,o,n=0){return n>0&&(t=Math.max(t,Go(e,n,Qt).offset)),Do($n(e,t,o,Yn),Zn)}function Qn(e,[t,o,n,r]){t.length>0&&n("received item sizes",t,he.DEBUG);const l=e.sizeTree;let i=l,c=0;if(o.length>0&&q(l)&&t.length===2){const x=t[0].size,f=t[1].size;i=o.reduce((w,b)=>Ce(Ce(w,b,x),b+1,f),i)}else[i,c]=Un(i,t);if(i===l)return e;const{lastIndex:a,lastOffset:u,lastSize:h,offsetTree:v}=$t(e.offsetTree,c,i,r);return{groupIndices:o,groupOffsetTree:o.reduce((x,f)=>Ce(x,f,it(f,v,r)),Ye()),lastIndex:a,lastOffset:u,lastSize:h,offsetTree:v,sizeTree:i}}function qn(e){return Fe(e).map(({k:t,v:o},n,r)=>{const l=r[n+1];return{endIndex:l!==void 0?l.k-1:1/0,size:o,startIndex:t}})}function go(e,t){let o=0,n=0;for(;o<e;)o+=t[n+1]-t[n]-1,n++;return n-(o===e?0:1)}function $t(e,t,o,n){let r=e,l=0,i=0,c=0,a=0;if(t!==0){a=kt(r,t-1,Qt),c=r[a].offset;const u=Re(o,t-1);l=u[0],i=u[1],r.length&&r[a].size===Re(o,t)[1]&&(a-=1),r=r.slice(0,a+1)}else r=[];for(const{start:u,value:h}of Xe(o,t,1/0)){const v=u-l,x=v*i+c+v*n;r.push({index:u,offset:x,size:h}),l=u,c=x,i=h}return{lastIndex:l,lastOffset:c,lastSize:i,offsetTree:r}}function Zn(e){return{index:e.index,value:e}}function Jn(e){const{endIndex:t,size:o,startIndex:n}=e;return r=>r.start===n&&(r.end===t||r.end===1/0)&&r.value===o}const er={offsetHeight:"height",offsetWidth:"width"},He=Y(([{log:e},{recalcInProgress:t}])=>{const o=K(),n=K(),r=ve(n,0),l=K(),i=K(),c=T(0),a=T([]),u=T(void 0),h=T(void 0),v=T(void 0),x=T(void 0),f=T((d,y)=>Oe(d,er[y])),w=T(void 0),b=T(0),g=Gn(),m=ve(C(o,G(a,e,b),Ee(Qn,g),te()),g),p=ve(C(a,te(),Ee((d,y)=>({current:y,prev:d.current}),{current:[],prev:[]}),z(({prev:d})=>d)),[]);L(C(a,W(d=>d.length>0),G(m,b),z(([d,y,S])=>{const B=d.reduce((H,P,V)=>Ce(H,P,it(P,y.offsetTree,S)||V),Ye());return{...y,groupIndices:d,groupOffsetTree:B}})),m),L(C(n,G(m),W(([d,{lastIndex:y}])=>d<y),z(([d,{lastIndex:y,lastSize:S}])=>[{endIndex:y,size:S,startIndex:d}])),o),L(u,h);const k=ve(C(u,z(d=>d===void 0)),!0);L(C(h,W(d=>d!==void 0&&q(se(m).sizeTree)),z(d=>{const y=se(v),S=se(a).length>0;return y!==void 0&&y!==0?S?[{endIndex:0,size:y,startIndex:0},{endIndex:1,size:d,startIndex:1}]:[]:[{endIndex:0,size:d,startIndex:0}]})),o),L(C(x,W(d=>d!==void 0&&d.length>0&&q(se(m).sizeTree)),z(d=>{const y=[];let S=d[0],B=0;for(let H=1;H<d.length;H++){const P=d[H];P!==S&&(y.push({endIndex:H-1,size:S,startIndex:B}),S=P,B=H)}return y.push({endIndex:d.length-1,size:S,startIndex:B}),y})),o),L(C(a,G(v,h),W(([,d,y])=>d!==void 0&&y!==void 0),z(([d,y,S])=>{const B=[];for(let H=0;H<d.length;H++){const P=d[H],V=d[H+1];B.push({startIndex:P,endIndex:P,size:y}),V!==void 0&&B.push({startIndex:P+1,endIndex:V-1,size:S})}return B})),o);const E=ke(C(o,G(m),Ee(({sizes:d},[y,S])=>({changed:S!==d,sizes:S}),{changed:!1,sizes:g}),z(d=>d.changed)));Q(C(c,Ee((d,y)=>({diff:d.prev-y,prev:y}),{diff:0,prev:0}),z(d=>d.diff)),d=>{const{groupIndices:y}=se(m);if(d>0)$(t,!0),$(l,d+go(d,y));else if(d<0){const S=se(p);S.length>0&&(d-=go(-d,S)),$(i,d)}}),Q(C(c,G(e)),([d,y])=>{d<0&&y("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:c},he.ERROR)});const j=ke(l);L(C(l,G(m),z(([d,y])=>{const S=y.groupIndices.length>0,B=[],H=y.lastSize;if(S){const P=st(y.sizeTree,0);let V=0,A=0;for(;V<d;){const I=y.groupIndices[A],_=y.groupIndices.length===A+1?1/0:y.groupIndices[A+1]-I-1;B.push({endIndex:I,size:P,startIndex:I}),B.push({endIndex:I+1+_-1,size:H,startIndex:I+1}),A++,V+=_+1}const U=Fe(y.sizeTree);return V!==d&&U.shift(),U.reduce((I,{k:_,v:J})=>{let fe=I.ranges;return I.prevSize!==0&&(fe=[...I.ranges,{endIndex:_+d-1,size:I.prevSize,startIndex:I.prevIndex}]),{prevIndex:_+d,prevSize:J,ranges:fe}},{prevIndex:d,prevSize:0,ranges:B}).ranges}return Fe(y.sizeTree).reduce((P,{k:V,v:A})=>({prevIndex:V+d,prevSize:A,ranges:[...P.ranges,{endIndex:V+d-1,size:P.prevSize,startIndex:P.prevIndex}]}),{prevIndex:0,prevSize:H,ranges:[]}).ranges})),o);const O=ke(C(i,G(m,b),z(([d,{offsetTree:y},S])=>{const B=-d;return it(B,y,S)})));return L(C(i,G(m,b),z(([d,y,S])=>{if(y.groupIndices.length>0){if(q(y.sizeTree))return y;let H=Ye();const P=se(p);let V=0,A=0,U=0;for(;V<-d;){U=P[A];const I=P[A+1]-U-1;A++,V+=I+1}if(H=Fe(y.sizeTree).reduce((I,{k:_,v:J})=>Ce(I,Math.max(0,_+d),J),H),V!==-d){const I=st(y.sizeTree,U);H=Ce(H,0,I);const _=Re(y.sizeTree,-d+1)[1];H=Ce(H,1,_)}return{...y,sizeTree:H,...$t(y.offsetTree,0,H,S)}}const B=Fe(y.sizeTree).reduce((H,{k:P,v:V})=>Ce(H,Math.max(0,P+d),V),Ye());return{...y,sizeTree:B,...$t(y.offsetTree,0,B,S)}})),m),{beforeUnshiftWith:j,data:w,defaultItemSize:h,firstItemIndex:c,fixedItemSize:u,fixedGroupSize:v,gap:b,groupIndices:a,heightEstimates:x,itemSize:f,listRefresh:E,shiftWith:i,shiftWithOffset:O,sizeRanges:o,sizes:m,statefulTotalCount:r,totalCount:n,trackItemSizes:k,unshiftWith:l}},oe(_e,Xt),{singleton:!0});function tr(e){return e.reduce((t,o)=>(t.groupIndices.push(t.totalCount),t.totalCount+=o+1,t),{groupIndices:[],totalCount:0})}const Yo=Y(([{groupIndices:e,sizes:t,totalCount:o},{headerHeight:n,scrollTop:r}])=>{const l=K(),i=K(),c=ke(C(l,z(tr)));return L(C(c,z(a=>a.totalCount)),o),L(C(c,z(a=>a.groupIndices)),e),L(C(ue(r,t,n),W(([a,u])=>jt(u)),z(([a,u,h])=>Re(u.groupOffsetTree,Math.max(a-h,0),"v")[0]),te(),z(a=>[a])),i),{groupCounts:l,topItemsIndexes:i}},oe(He,ye)),De=Y(([{log:e}])=>{const t=T(!1),o=ke(C(t,W(n=>n),te()));return Q(t,n=>{n&&se(e)("props updated",{},he.DEBUG)}),{didMount:o,propsReady:t}},oe(_e),{singleton:!0}),or=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Xo(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!or)&&(t.behavior="auto"),t.offset===void 0&&(t.offset=0),t}const dt=Y(([{gap:e,listRefresh:t,sizes:o,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:l,footerHeight:i,headerHeight:c,scrollingInProgress:a,scrollTo:u,smoothScrollTargetReached:h,viewportHeight:v},{log:x}])=>{const f=K(),w=K(),b=T(0);let g=null,m=null,p=null;function k(){g!==null&&(g(),g=null),p!==null&&(p(),p=null),m&&(clearTimeout(m),m=null),$(a,!1)}return L(C(f,G(o,v,n,b,c,i,x),G(e,l,r),z(([[E,j,O,d,y,S,B,H],P,V,A])=>{const U=Xo(E),{align:I,behavior:_,offset:J}=U,fe=d-1,ie=Ko(U,j,fe);let we=it(ie,j.offsetTree,P)+S;I==="end"?(we+=V+Re(j.sizeTree,ie)[1]-O+A,ie===fe&&(we+=B)):I==="center"?we+=(V+Re(j.sizeTree,ie)[1]-O+A)/2:we-=y,J!==void 0&&J!==0&&(we+=J);const Me=xe=>{k(),xe?(H("retrying to scroll to",{location:E},he.DEBUG),$(f,E)):($(w,!0),H("list did not change, scroll successful",{},he.DEBUG))};if(k(),_==="smooth"){let xe=!1;p=Q(t,Ue=>{xe=xe||Ue}),g=je(h,()=>{Me(xe)})}else g=je(C(t,nr(150)),Me);return m=setTimeout(()=>{k()},1200),$(a,!0),H("scrolling from index to",{behavior:_,index:ie,top:we},he.DEBUG),{behavior:_,top:we}})),u),{scrollTargetReached:w,scrollToIndex:f,topListHeight:b}},oe(He,ye,_e),{singleton:!0});function nr(e){return t=>{const o=setTimeout(()=>{t(!1)},e);return n=>{n&&(t(!0),clearTimeout(o))}}}function qt(e,t){e===0?t():requestAnimationFrame(()=>{qt(e-1,t)})}function Zt(e,t){const o=t-1;return typeof e=="number"?e:e.index==="LAST"?o:e.index}const pt=Y(([{defaultItemSize:e,listRefresh:t,sizes:o},{scrollTop:n},{scrollTargetReached:r,scrollToIndex:l},{didMount:i}])=>{const c=T(!0),a=T(0),u=T(!0);return L(C(i,G(a),W(([h,v])=>v!==0),ze(!1)),c),L(C(i,G(a),W(([h,v])=>v!==0),ze(!1)),u),Q(C(ue(t,i),G(c,o,e,u),W(([[,h],v,{sizeTree:x},f,w])=>h&&(!q(x)||Ut(f))&&!v&&!w),G(a)),([,h])=>{je(r,()=>{$(u,!0)}),qt(4,()=>{je(n,()=>{$(c,!0)}),$(l,h)})}),{initialItemFinalLocationReached:u,initialTopMostItemIndex:a,scrolledToInitialItem:c}},oe(He,ye,dt,De),{singleton:!0});function Qo(e,t){return Math.abs(e-t)<1.01}const at="up",ot="down",rr="none",sr={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},lr=0,mt=Y(([{footerHeight:e,headerHeight:t,scrollBy:o,scrollContainerState:n,scrollTop:r,viewportHeight:l}])=>{const i=T(!1),c=T(!0),a=K(),u=K(),h=T(4),v=T(lr),x=ve(C(Wt(C(D(r),Ve(1),ze(!0)),C(D(r),Ve(1),ze(!1),ho(100))),te()),!1),f=ve(C(Wt(C(o,ze(!0)),C(o,ze(!1),ho(200))),te()),!1);L(C(ue(D(r),D(v)),z(([p,k])=>p<=k),te()),c),L(C(c,Be(50)),u);const w=ke(C(ue(n,D(l),D(t),D(e),D(h)),Ee((p,[{scrollHeight:k,scrollTop:E},j,O,d,y])=>{const S=E+j-k>-y,B={scrollHeight:k,scrollTop:E,viewportHeight:j};if(S){let P,V;return E>p.state.scrollTop?(P="SCROLLED_DOWN",V=p.state.scrollTop-E):(P="SIZE_DECREASED",V=p.state.scrollTop-E||p.scrollTopDelta),{atBottom:!0,atBottomBecause:P,scrollTopDelta:V,state:B}}let H;return B.scrollHeight>p.state.scrollHeight?H="SIZE_INCREASED":j<p.state.viewportHeight?H="VIEWPORT_HEIGHT_DECREASING":E<p.state.scrollTop?H="SCROLLING_UPWARDS":H="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:H,state:B}},sr),te((p,k)=>p!==void 0&&p.atBottom===k.atBottom))),b=ve(C(n,Ee((p,{scrollHeight:k,scrollTop:E,viewportHeight:j})=>{if(!Qo(p.scrollHeight,k)){const O=k-(E+j)<1;return p.scrollTop!==E&&O?{changed:!0,jump:p.scrollTop-E,scrollHeight:k,scrollTop:E}:{changed:!0,jump:0,scrollHeight:k,scrollTop:E}}return{changed:!1,jump:0,scrollHeight:k,scrollTop:E}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),W(p=>p.changed),z(p=>p.jump)),0);L(C(w,z(p=>p.atBottom)),i),L(C(i,Be(50)),a);const g=T(ot);L(C(n,z(({scrollTop:p})=>p),te(),Ee((p,k)=>se(f)?{direction:p.direction,prevScrollTop:k}:{direction:k<p.prevScrollTop?at:ot,prevScrollTop:k},{direction:ot,prevScrollTop:0}),z(p=>p.direction)),g),L(C(n,Be(50),ze(rr)),g);const m=T(0);return L(C(x,W(p=>!p),ze(0)),m),L(C(r,Be(100),G(x),W(([p,k])=>k),Ee(([p,k],[E])=>[k,E],[0,0]),z(([p,k])=>k-p)),m),{atBottomState:w,atBottomStateChange:a,atBottomThreshold:h,atTopStateChange:u,atTopThreshold:v,isAtBottom:i,isAtTop:c,isScrolling:x,lastJumpDueToItemResize:b,scrollDirection:g,scrollVelocity:m}},oe(ye)),ct="top",ut="bottom",vo="none";function bo(e,t,o){return typeof e=="number"?o===at&&t===ct||o===ot&&t===ut?e:0:o===at?t===ct?e.main:e.reverse:t===ut?e.main:e.reverse}function yo(e,t){return typeof e=="number"?e:e[t]??0}const Jt=Y(([{deviation:e,fixedHeaderHeight:t,headerHeight:o,scrollTop:n,viewportHeight:r}])=>{const l=K(),i=T(0),c=T(0),a=T(0),u=ve(C(ue(D(n),D(r),D(o),D(l,lt),D(a),D(i),D(t),D(e),D(c)),z(([h,v,x,[f,w],b,g,m,p,k])=>{const E=h-p,j=g+m,O=Math.max(x-E,0);let d=vo;const y=yo(k,ct),S=yo(k,ut);return f-=p,f+=x+m,w+=x+m,w-=p,f>h+j-y&&(d=at),w<h-O+v+S&&(d=ot),d!==vo?[Math.max(E-x-bo(b,ct,d)-y,0),E-O-m+v+bo(b,ut,d)+S]:null}),W(h=>h!==null),te(lt)),[0,0]);return{increaseViewportBy:c,listBoundary:l,overscan:a,topListHeight:i,visibleRange:u}},oe(ye),{singleton:!0});function ir(e,t,o){if(jt(t)){const n=Uo(e,t);return[{index:Re(t.groupOffsetTree,n)[0],offset:0,size:0},{data:o==null?void 0:o[0],index:n,offset:0,size:0}]}return[{data:o==null?void 0:o[0],index:e,offset:0,size:0}]}const Ht={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Ct(e,t,o,n,r,l){const{lastIndex:i,lastOffset:c,lastSize:a}=r;let u=0,h=0;if(e.length>0){u=e[0].offset;const b=e[e.length-1];h=b.offset+b.size}const v=o-i,x=c+v*a+(v-1)*n,f=u,w=x-h;return{bottom:h,firstItemIndex:l,items:wo(e,r,l),offsetBottom:w,offsetTop:u,top:f,topItems:wo(t,r,l),topListHeight:t.reduce((b,g)=>g.size+b,0),totalCount:o}}function qo(e,t,o,n,r,l){let i=0;if(o.groupIndices.length>0)for(const h of o.groupIndices){if(h-i>=e)break;i++}const c=e+i,a=Zt(t,c),u=Array.from({length:c}).map((h,v)=>({data:l[v+a],index:v+a,offset:0,size:0}));return Ct(u,[],c,r,o,n)}function wo(e,t,o){if(e.length===0)return[];if(!jt(t))return e.map(u=>({...u,index:u.index+o,originalIndex:u.index}));const n=e[0].index,r=e[e.length-1].index,l=[],i=Xe(t.groupOffsetTree,n,r);let c,a=0;for(const u of e){(!c||c.end<u.index)&&(c=i.shift(),a=t.groupIndices.indexOf(c.start));let h;u.index===c.start?h={index:a,type:"group"}:h={groupIndex:a,index:u.index-(a+1)+o},l.push({...h,data:u.data,offset:u.offset,originalIndex:u.index,size:u.size})}return l}function Co(e,t){return e===void 0?0:typeof e=="number"?e:e[t]??0}const Ge=Y(([{data:e,firstItemIndex:t,gap:o,sizes:n,totalCount:r},l,{listBoundary:i,topListHeight:c,visibleRange:a},{initialTopMostItemIndex:u,scrolledToInitialItem:h},{topListHeight:v},x,{didMount:f},{recalcInProgress:w}])=>{const b=T([]),g=T(0),m=K(),p=T(0);L(l.topItemsIndexes,b);const k=ve(C(ue(f,w,D(a,lt),D(r),D(n),D(u),h,D(b),D(t),D(o),D(p),e),W(([d,y,,S,,,,,,,,B])=>{const H=B!==void 0&&B.length!==S;return d&&!y&&!H}),z(([,,[d,y],S,B,H,P,V,A,U,I,_])=>{var X,de;const J=B,{offsetTree:fe,sizeTree:ie}=J,we=se(g);if(S===0)return{...Ht,totalCount:S};if(d===0&&y===0)return we===0?{...Ht,totalCount:S}:qo(we,H,B,A,U,_||[]);if(q(ie))return we>0?null:Ct(ir(Zt(H,S),J,_),[],S,U,J,A);const Me=[];if(V.length>0){const ee=V[0],ne=V[V.length-1];let pe=0;for(const ae of Xe(ie,ee,ne)){const Z=ae.value,le=Math.max(ae.start,ee),be=Math.min(ae.end,ne);for(let ce=le;ce<=be;ce++)Me.push({data:_==null?void 0:_[ce],index:ce,offset:pe,size:Z}),pe+=Z}}if(!P)return Ct([],Me,S,U,J,A);const xe=V.length>0?V[V.length-1]+1:0,Ue=Xn(fe,d,y,xe);if(Ue.length===0)return null;const Je=S-1,Ne=St([],ee=>{for(const ne of Ue){const pe=ne.value;let ae=pe.offset,Z=ne.start;const le=pe.size;if(pe.offset<d){Z+=Math.floor((d-pe.offset+U)/(le+U));const ce=Z-ne.start;ae+=ce*le+ce*U}Z<xe&&(ae+=(xe-Z)*le,Z=xe);const be=Math.min(ne.end,Je);for(let ce=Z;ce<=be&&!(ae>=y);ce++)ee.push({data:_==null?void 0:_[ce],index:ce,offset:ae,size:le}),ae+=le+U}}),et=Co(I,ct),R=Co(I,ut);if(Ne.length>0&&(et>0||R>0)){const ee=Ne[0],ne=Ne[Ne.length-1];if(et>0&&ee.index>xe){const pe=Math.min(et,ee.index-xe),ae=[];let Z=ee.offset;for(let le=ee.index-1;le>=ee.index-pe;le--){const be=((X=Xe(ie,le,le)[0])==null?void 0:X.value)??ee.size;Z-=be+U,ae.unshift({data:_==null?void 0:_[le],index:le,offset:Z,size:be})}Ne.unshift(...ae)}if(R>0&&ne.index<Je){const pe=Math.min(R,Je-ne.index);let ae=ne.offset+ne.size+U;for(let Z=ne.index+1;Z<=ne.index+pe;Z++){const le=((de=Xe(ie,Z,Z)[0])==null?void 0:de.value)??ne.size;Ne.push({data:_==null?void 0:_[Z],index:Z,offset:ae,size:le}),ae+=le+U}}}return Ct(Ne,Me,S,U,J,A)}),W(d=>d!==null),te()),Ht);L(C(e,W(Ut),z(d=>d==null?void 0:d.length)),r),L(C(k,z(d=>d.topListHeight)),v),L(v,c),L(C(k,z(d=>[d.top,d.bottom])),i),L(C(k,z(d=>d.items)),m);const E=ke(C(k,W(({items:d})=>d.length>0),G(r,e),W(([{items:d},y])=>d[d.length-1].originalIndex===y-1),z(([,d,y])=>[d-1,y]),te(lt),z(([d])=>d))),j=ke(C(k,Be(200),W(({items:d,topItems:y})=>d.length>0&&d[0].originalIndex===y.length),z(({items:d})=>d[0].index),te())),O=ke(C(k,W(({items:d})=>d.length>0),z(({items:d})=>{let y=0,S=d.length-1;for(;d[y].type==="group"&&y<S;)y++;for(;d[S].type==="group"&&S>y;)S--;return{endIndex:d[S].index,startIndex:d[y].index}}),te($o)));return{endReached:E,initialItemCount:g,itemsRendered:m,listState:k,minOverscanItemCount:p,rangeChanged:O,startReached:j,topItemsIndexes:b,...x}},oe(He,Yo,Jt,pt,dt,mt,De,Xt),{singleton:!0}),Zo=Y(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:o,headerHeight:n},{listState:r}])=>{const l=K(),i=ve(C(ue(o,e,n,t,r),z(([c,a,u,h,v])=>c+a+u+h+v.offsetBottom+v.bottom)),0);return L(D(i),l),{totalListHeight:i,totalListHeightChanged:l}},oe(ye,Ge),{singleton:!0}),ar=Y(([{viewportHeight:e},{totalListHeight:t}])=>{const o=T(!1),n=ve(C(ue(o,e,t),W(([r])=>r),z(([,r,l])=>Math.max(0,r-l)),Be(0),te()),0);return{alignToBottom:o,paddingTopAddition:n}},oe(ye,Zo),{singleton:!0}),Jo=Y(()=>({context:T(null)})),cr=({itemBottom:e,itemTop:t,locationParams:{align:o,behavior:n,...r},viewportBottom:l,viewportTop:i})=>t<i?{...r,align:o??"start",...n!==void 0?{behavior:n}:{}}:e>l?{...r,align:o??"end",...n!==void 0?{behavior:n}:{}}:null,en=Y(([{gap:e,sizes:t,totalCount:o},{fixedFooterHeight:n,fixedHeaderHeight:r,headerHeight:l,scrollingInProgress:i,scrollTop:c,viewportHeight:a},{scrollToIndex:u}])=>{const h=K();return L(C(h,G(t,a,o,l,r,n,c),G(e),z(([[v,x,f,w,b,g,m,p],k])=>{const{calculateViewLocation:E=cr,done:j,...O}=v,d=Ko(v,x,w-1),y=it(d,x.offsetTree,k)+b+g,S=y+Re(x.sizeTree,d)[1],B=p+g,H=p+f-m,P=E({itemBottom:S,itemTop:y,locationParams:O,viewportBottom:H,viewportTop:B});return P!==null?j&&je(C(i,W(V=>!V),Ve(se(i)?1:2)),j):j==null||j(),P}),W(v=>v!==null)),u),{scrollIntoView:h}},oe(He,ye,dt,Ge,_e),{singleton:!0});function ko(e){return e===!1?!1:e==="smooth"?"smooth":"auto"}const ur=(e,t)=>typeof e=="function"?ko(e(t)):t&&ko(e),dr=Y(([{listRefresh:e,totalCount:t,fixedItemSize:o,data:n},{atBottomState:r,isAtBottom:l},{scrollToIndex:i},{scrolledToInitialItem:c},{didMount:a,propsReady:u},{log:h},{scrollingInProgress:v},{context:x},{scrollIntoView:f}])=>{const w=T(!1),b=K();let g=null;function m(j){$(i,{align:"end",behavior:j,index:"LAST"})}Q(C(ue(C(D(t),Ve(1)),a),G(D(w),l,c,v),z(([[j,O],d,y,S,B])=>{let H=O&&S,P="auto";return H&&(P=ur(d,y||B),H=H&&P!==!1),{followOutputBehavior:P,shouldFollow:H,totalCount:j}}),W(({shouldFollow:j})=>j)),({followOutputBehavior:j,totalCount:O})=>{g!==null&&(g(),g=null),se(o)!==void 0?requestAnimationFrame(()=>{se(h)("following output to ",{totalCount:O},he.DEBUG),m(j)}):g=je(e,()=>{se(h)("following output to ",{totalCount:O},he.DEBUG),m(j),g=null})});function p(j){const O=je(r,d=>{j&&!d.atBottom&&d.notAtBottomBecause==="SIZE_INCREASED"&&g===null&&(se(h)("scrolling to bottom due to increased size",{},he.DEBUG),m("auto"))});setTimeout(O,100)}Q(C(ue(D(w),t,u),W(([j,,O])=>j!==!1&&O),Ee(({value:j},[,O])=>({refreshed:j===O,value:O}),{refreshed:!1,value:0}),W(({refreshed:j})=>j),G(w,t)),([,j])=>{se(c)&&p(j!==!1)}),Q(b,()=>{p(se(w)!==!1)}),Q(ue(D(w),r),([j,O])=>{j!==!1&&!O.atBottom&&O.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&m("auto")});const k=T(null),E=K();return L(Wt(C(D(n),z(j=>(j==null?void 0:j.length)??0)),C(D(t))),E),Q(C(ue(C(E,Ve(1)),a),G(D(k),c,v,x),z(([[j,O],d,y,S,B])=>O&&y&&(d==null?void 0:d({context:B,totalCount:j,scrollingInProgress:S}))),W(j=>!!j),Be(0)),j=>{g!==null&&(g(),g=null),se(o)!==void 0?requestAnimationFrame(()=>{se(h)("scrolling into view",{}),$(f,j)}):g=je(e,()=>{se(h)("scrolling into view",{}),$(f,j),g=null})}),{autoscrollToBottom:b,followOutput:w,scrollIntoViewOnChange:k}},oe(He,mt,dt,pt,De,_e,ye,Jo,en)),pr=Y(([{data:e,firstItemIndex:t,gap:o,sizes:n},{initialTopMostItemIndex:r},{initialItemCount:l,listState:i},{didMount:c}])=>(L(C(c,G(l),W(([,a])=>a!==0),G(r,n,t,o,e),z(([[,a],u,h,v,x,f=[]])=>qo(a,u,h,v,x,f))),i),{}),oe(He,pt,Ge,De),{singleton:!0}),mr=Y(([{didMount:e},{scrollTo:t},{listState:o}])=>{const n=T(0);return Q(C(e,G(n),W(([,r])=>r!==0),z(([,r])=>({top:r}))),r=>{je(C(o,Ve(1),W(l=>l.items.length>1)),()=>{requestAnimationFrame(()=>{$(t,r)})})}),{initialScrollTop:n}},oe(De,ye,Ge),{singleton:!0}),tn=Y(([{scrollVelocity:e}])=>{const t=T(!1),o=K(),n=T(!1);return L(C(e,G(n,t,o),W(([r,l])=>l!==!1&&l!==void 0),z(([r,l,i,c])=>{const{enter:a,exit:u}=l;if(i){if(u(r,c))return!1}else if(a(r,c))return!0;return i}),te()),t),Q(C(ue(t,e,o),G(n)),([[r,l,i],c])=>{r&&c!==!1&&c!==void 0&&c.change&&c.change(l,i)}),{isSeeking:t,scrollSeekConfiguration:n,scrollSeekRangeChanged:o,scrollVelocity:e}},oe(mt),{singleton:!0}),eo=Y(([{scrollContainerState:e,scrollTo:t}])=>{const o=K(),n=K(),r=K(),l=T(!1),i=T(void 0);return L(C(ue(o,n),z(([{scrollTop:c,viewportHeight:a},{offsetTop:u,listHeight:h}])=>({scrollHeight:h,scrollTop:Math.max(0,c-u),viewportHeight:a}))),e),L(C(t,G(n),z(([c,{offsetTop:a}])=>({...c,top:c.top+a}))),r),{customScrollParent:i,useWindowScroll:l,windowScrollContainerState:o,windowScrollTo:r,windowViewportRect:n}},oe(ye)),hr=Y(([{sizeRanges:e,sizes:t},{headerHeight:o,scrollTop:n},{initialTopMostItemIndex:r},{didMount:l},{useWindowScroll:i,windowScrollContainerState:c,windowViewportRect:a}])=>{const u=K(),h=T(void 0),v=T(null),x=T(null);return L(c,v),L(a,x),Q(C(u,G(t,n,i,v,x,o)),([f,w,b,g,m,p,k])=>{const E=qn(w.sizeTree);g&&m!==null&&p!==null&&(b=m.scrollTop-p.offsetTop),b-=k,f({ranges:E,scrollTop:b})}),L(C(h,W(Ut),z(fr)),r),L(C(l,G(h),W(([,f])=>f!==void 0),te(),z(([,f])=>f.ranges)),e),{getState:u,restoreStateFrom:h}},oe(He,ye,pt,De,eo));function fr(e){return{align:"start",index:0,offset:e.scrollTop}}const xr=Y(([{topItemsIndexes:e}])=>{const t=T(0);return L(C(t,W(o=>o>=0),z(o=>Array.from({length:o}).map((n,r)=>r))),e),{topItemCount:t}},oe(Ge));function on(e){let t=!1,o;return(()=>(t||(t=!0,o=e()),o))}const gr=on(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),vr=Y(([{deviation:e,scrollBy:t,scrollingInProgress:o,scrollTop:n},{isAtBottom:r,isScrolling:l,lastJumpDueToItemResize:i,scrollDirection:c},{listState:a},{beforeUnshiftWith:u,gap:h,shiftWithOffset:v,sizes:x},{log:f},{recalcInProgress:w}])=>{const b=ke(C(a,G(i),Ee(([,m,p,k],[{bottom:E,items:j,offsetBottom:O,totalCount:d},y])=>{const S=E+O;let B=0;return p===d&&m.length>0&&j.length>0&&(j[0].originalIndex===0&&m[0].originalIndex===0||(B=S-k,B!==0&&(B+=y))),[B,j,d,S]},[0,[],0,0]),W(([m])=>m!==0),G(n,c,o,r,f,w),W(([,m,p,k,,,E])=>!E&&!k&&m!==0&&p===at),z(([[m],,,,,p])=>(p("Upward scrolling compensation",{amount:m},he.DEBUG),m))));function g(m){m>0?($(t,{behavior:"auto",top:-m}),$(e,0)):($(e,0),$(t,{behavior:"auto",top:-m}))}return Q(C(b,G(e,l)),([m,p,k])=>{k&&gr()?$(e,p-m):g(-m)}),Q(C(ue(ve(l,!1),e,w),W(([m,p,k])=>!m&&!k&&p!==0),z(([m,p])=>p),Be(1)),g),L(C(v,z(m=>({top:-m}))),t),Q(C(u,G(x,h),z(([m,{groupIndices:p,lastSize:k,sizeTree:E},j])=>{function O(H){return H*(k+j)}if(p.length===0)return O(m);let d=0;const y=st(E,0);let S=0,B=0;for(;S<m;){S++,d+=y;let H=p.length===B+1?1/0:p[B+1]-p[B]-1;S+H>m&&(d-=y,H=m-S+1),S+=H,d+=O(H),B++}return d})),m=>{$(e,m),requestAnimationFrame(()=>{$(t,{top:m}),requestAnimationFrame(()=>{$(e,0),$(w,!1)})})}),{deviation:e}},oe(ye,mt,Ge,He,_e,Xt)),br=Y(([e,t,o,n,r,l,i,c,a,u,h])=>({...e,...t,...o,...n,...r,...l,...i,...c,...a,...u,...h}),oe(Jt,pr,De,tn,Zo,mr,ar,eo,en,_e,Jo)),nn=Y(([{data:e,defaultItemSize:t,firstItemIndex:o,fixedItemSize:n,fixedGroupSize:r,gap:l,groupIndices:i,heightEstimates:c,itemSize:a,sizeRanges:u,sizes:h,statefulTotalCount:v,totalCount:x,trackItemSizes:f},{initialItemFinalLocationReached:w,initialTopMostItemIndex:b,scrolledToInitialItem:g},m,p,k,E,{scrollToIndex:j},O,{topItemCount:d},{groupCounts:y},S])=>{const{listState:B,minOverscanItemCount:H,topItemsIndexes:P,rangeChanged:V,...A}=E;return L(V,S.scrollSeekRangeChanged),L(C(S.windowViewportRect,z(U=>U.visibleHeight)),m.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:o,fixedItemHeight:n,fixedGroupHeight:r,gap:l,groupCounts:y,heightEstimates:c,initialItemFinalLocationReached:w,initialTopMostItemIndex:b,scrolledToInitialItem:g,sizeRanges:u,topItemCount:d,topItemsIndexes:P,totalCount:x,...k,groupIndices:i,itemSize:a,listState:B,minOverscanItemCount:H,scrollToIndex:j,statefulTotalCount:v,trackItemSizes:f,rangeChanged:V,...A,...S,...m,sizes:h,...p}},oe(He,pt,ye,hr,dr,Ge,dt,vr,xr,Yo,br));function yr(e,t){const o={},n={};let r=0;const l=e.length;for(;r<l;)n[e[r]]=1,r+=1;for(const i in t)Object.hasOwn(n,i)||(o[i]=t[i]);return o}const xt=typeof document<"u"?M.useLayoutEffect:M.useEffect;function rn(e,t,o){const n=Object.keys(t.required||{}),r=Object.keys(t.optional||{}),l=Object.keys(t.methods||{}),i=Object.keys(t.events||{}),c=M.createContext({});function a(g,m){g.propsReady!==void 0&&$(g.propsReady,!1);for(const p of n){const k=g[t.required[p]];$(k,m[p])}for(const p of r)if(p in m){const k=g[t.optional[p]];$(k,m[p])}g.propsReady!==void 0&&$(g.propsReady,!0)}function u(g){return l.reduce((m,p)=>(m[p]=k=>{const E=g[t.methods[p]];$(E,k)},m),{})}function h(g){return i.reduce((m,p)=>(m[p]=On(g[t.events[p]]),m),{})}const v=M.forwardRef(function(g,m){const{children:p,...k}=g,[E]=M.useState(()=>St(_n(e),d=>{a(d,k)})),[j]=M.useState(mo(h,E));xt(()=>{for(const d of i)d in k&&Q(j[d],k[d]);return()=>{Object.values(j).map(Kt)}},[k,j,E]),xt(()=>{a(E,k)}),M.useImperativeHandle(m,po(u(E)));const O=o;return s.jsx(c.Provider,{value:E,children:o!==void 0?s.jsx(O,{...yr([...n,...r,...i],k),children:p}):p})}),x=g=>{const m=M.useContext(c);return M.useCallback(p=>{$(m[g],p)},[m,g])},f=g=>{const m=M.useContext(c)[g],p=M.useCallback(k=>Q(m,k),[m]);return M.useSyncExternalStore(p,()=>se(m),()=>se(m))},w=g=>{const m=M.useContext(c)[g],[p,k]=M.useState(mo(se,m));return xt(()=>Q(m,E=>{E!==p&&k(po(E))}),[m,p]),p},b=M.version.startsWith("18")?f:w;return{Component:v,useEmitter:(g,m)=>{const p=M.useContext(c)[g];xt(()=>Q(p,m),[m,p])},useEmitterValue:b,usePublisher:x}}const sn=M.createContext(void 0),ln=M.createContext(void 0),Bt="-webkit-sticky",To="sticky",to=on(()=>{if(typeof document>"u")return To;const e=document.createElement("div");return e.style.position=Bt,e.style.position===Bt?Bt:To}),an=typeof document<"u"?M.useLayoutEffect:M.useEffect;function Mt(e){return"self"in e}function wr(e){return"body"in e}function cn(e,t,o,n=Ze,r,l){const i=M.useRef(null),c=M.useRef(null),a=M.useRef(null),u=M.useCallback(x=>{let f,w,b;const g=x.target;if(wr(g)||Mt(g)){const p=Mt(g)?g:g.defaultView;b=l===!0?p.scrollX:p.scrollY,f=l===!0?p.document.documentElement.scrollWidth:p.document.documentElement.scrollHeight,w=l===!0?p.innerWidth:p.innerHeight}else b=l===!0?g.scrollLeft:g.scrollTop,f=l===!0?g.scrollWidth:g.scrollHeight,w=l===!0?g.offsetWidth:g.offsetHeight;const m=()=>{e({scrollHeight:f,scrollTop:Math.max(b,0),viewportHeight:w})};x.suppressFlushSync===!0?m():gn.flushSync(m),c.current!==null&&(b===c.current||b<=0||b===f-w)&&(c.current=null,t(!0),a.current&&(clearTimeout(a.current),a.current=null))},[e,t,l]);M.useEffect(()=>{const x=r||i.current;return n(r||i.current),u({suppressFlushSync:!0,target:x}),x.addEventListener("scroll",u,{passive:!0}),()=>{n(null),x.removeEventListener("scroll",u)}},[i,u,o,n,r]);function h(x){const f=i.current;if(!f||(l===!0?"offsetWidth"in f&&f.offsetWidth===0:"offsetHeight"in f&&f.offsetHeight===0))return;const w=x.behavior==="smooth";let b,g,m;Mt(f)?(g=Math.max(Oe(f.document.documentElement,l===!0?"width":"height"),l===!0?f.document.documentElement.scrollWidth:f.document.documentElement.scrollHeight),b=l===!0?f.innerWidth:f.innerHeight,m=l===!0?window.scrollX:window.scrollY):(g=f[l===!0?"scrollWidth":"scrollHeight"],b=Oe(f,l===!0?"width":"height"),m=f[l===!0?"scrollLeft":"scrollTop"]);const p=g-b;if(x.top=Math.ceil(Math.max(Math.min(p,x.top),0)),Qo(b,g)||x.top===m){e({scrollHeight:g,scrollTop:m,viewportHeight:b}),w&&t(!0);return}w?(c.current=x.top,a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,c.current=null,t(!0)},1e3)):c.current=null,l===!0&&(x={...x.behavior!==void 0?{behavior:x.behavior}:{},left:x.top}),f.scrollTo(x)}function v(x){l===!0&&(x={...x.behavior!==void 0?{behavior:x.behavior}:{},...x.top!==void 0?{left:x.top}:{}}),i.current.scrollBy(x)}return{scrollByCallback:v,scrollerRef:i,scrollToCallback:h}}function oo(e){return e}const Cr=Y(()=>{const e=T(c=>`Item ${c}`),t=T(c=>`Group ${c}`),o=T({}),n=T(oo),r=T("div"),l=T(Ze),i=(c,a=null)=>ve(C(o,z(u=>u[c]),te()),a);return{components:o,computeItemKey:n,EmptyPlaceholder:i("EmptyPlaceholder"),FooterComponent:i("Footer"),GroupComponent:i("Group","div"),groupContent:t,HeaderComponent:i("Header"),HeaderFooterTag:r,ItemComponent:i("Item","div"),itemContent:e,ListComponent:i("List","div"),ScrollerComponent:i("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:i("ScrollSeekPlaceholder"),TopItemListComponent:i("TopItemList")}}),kr=Y(([e,t])=>({...e,...t}),oe(nn,Cr)),Tr=({height:e})=>s.jsx("div",{style:{height:e}}),Ir={overflowAnchor:"none",position:to(),zIndex:1},un={overflowAnchor:"none"},Sr={...un,display:"inline-block",height:"100%"},Io=M.memo(function({showTopList:e=!1}){const t=F("listState"),o=Te("sizeRanges"),n=F("useWindowScroll"),r=F("customScrollParent"),l=Te("windowScrollContainerState"),i=Te("scrollContainerState"),c=r||n?l:i,a=F("itemContent"),u=F("context"),h=F("groupContent"),v=F("trackItemSizes"),x=F("itemSize"),f=F("log"),w=Te("gap"),b=F("horizontalDirection"),{callbackRef:g}=Fn(o,x,v,e?Ze:c,f,w,r,b,F("skipAnimationFrameInResizeObserver")),[m,p]=M.useState(0);no("deviation",A=>{m!==A&&p(A)});const k=F("EmptyPlaceholder"),E=F("ScrollSeekPlaceholder")??Tr,j=F("ListComponent"),O=F("ItemComponent"),d=F("GroupComponent"),y=F("computeItemKey"),S=F("isSeeking"),B=F("groupIndices").length>0,H=F("alignToBottom"),P=F("initialItemFinalLocationReached"),V=e?{}:{boxSizing:"border-box",...b?{display:"inline-block",height:"100%",marginLeft:m!==0?m:H?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:m!==0?m:H?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...P?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&k!==null&&k!==void 0?s.jsx(k,{...ge(k,u)}):s.jsx(j,{...ge(j,u),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:g,style:V,children:(e?t.topItems:t.items).map(A=>{const U=A.originalIndex,I=y(U+t.firstItemIndex,A.data,u);return S?N.createElement(E,{...ge(E,u),height:A.size,index:A.index,key:I,type:A.type||"item",...A.type==="group"?{}:{groupIndex:A.groupIndex}}):A.type==="group"?N.createElement(d,{...ge(d,u),"data-index":U,"data-item-index":A.index,"data-known-size":A.size,key:I,style:Ir},h(A.index,u)):N.createElement(O,{...ge(O,u),...zr(O,A.data),"data-index":U,"data-item-group-index":A.groupIndex,"data-item-index":A.index,"data-known-size":A.size,key:I,style:b?Sr:un},B?a(A.index,A.groupIndex,A.data,u):a(A.index,A.data,u))})})}),jr={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Rr={outline:"none",overflowX:"auto",position:"relative"},Rt=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:void 0}),Nr={position:to(),top:0,width:"100%",zIndex:1};function ge(e,t){if(typeof e!="string")return{context:t}}function zr(e,t){return{item:typeof e=="string"?void 0:t}}const Er=M.memo(function(){const e=F("HeaderComponent"),t=Te("headerHeight"),o=F("HeaderFooterTag"),n=$e(M.useMemo(()=>l=>{t(Oe(l,"height"))},[t]),!0,F("skipAnimationFrameInResizeObserver")),r=F("context");return e!=null?s.jsx(o,{ref:n,children:s.jsx(e,{...ge(e,r)})}):null}),Hr=M.memo(function(){const e=F("FooterComponent"),t=Te("footerHeight"),o=F("HeaderFooterTag"),n=$e(M.useMemo(()=>l=>{t(Oe(l,"height"))},[t]),!0,F("skipAnimationFrameInResizeObserver")),r=F("context");return e!=null?s.jsx(o,{ref:n,children:s.jsx(e,{...ge(e,r)})}):null});function dn({useEmitter:e,useEmitterValue:t,usePublisher:o}){return M.memo(function({children:n,style:r,context:l,...i}){const c=o("scrollContainerState"),a=t("ScrollerComponent"),u=o("smoothScrollTargetReached"),h=t("scrollerRef"),v=t("horizontalDirection")||!1,{scrollByCallback:x,scrollerRef:f,scrollToCallback:w}=cn(c,u,a,h,void 0,v);return e("scrollTo",w),e("scrollBy",x),s.jsx(a,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:f,style:{...v?Rr:jr,...r},tabIndex:0,...i,...ge(a,l),children:n})})}function pn({useEmitter:e,useEmitterValue:t,usePublisher:o}){return M.memo(function({children:n,style:r,context:l,...i}){const c=o("windowScrollContainerState"),a=t("ScrollerComponent"),u=o("smoothScrollTargetReached"),h=t("totalListHeight"),v=t("deviation"),x=t("customScrollParent"),f=M.useRef(null),w=t("scrollerRef"),{scrollByCallback:b,scrollerRef:g,scrollToCallback:m}=cn(c,u,a,w,x);return an(()=>{var p;return g.current=x||((p=f.current)==null?void 0:p.ownerDocument.defaultView),()=>{g.current=null}},[g,x]),e("windowScrollTo",m),e("scrollBy",b),s.jsx(a,{ref:f,"data-virtuoso-scroller":!0,style:{position:"relative",...r,...h!==0?{height:h+v}:void 0},...i,...ge(a,l),children:n})})}const Br=({children:e})=>{const t=M.useContext(sn),o=Te("viewportHeight"),n=Te("fixedItemHeight"),r=F("alignToBottom"),l=F("horizontalDirection"),i=M.useMemo(()=>Oo(o,a=>Oe(a,l?"width":"height")),[o,l]),c=$e(i,!0,F("skipAnimationFrameInResizeObserver"));return M.useEffect(()=>{t&&(o(t.viewportHeight),n(t.itemHeight))},[t,o,n]),s.jsx("div",{"data-viewport-type":"element",ref:c,style:Rt(r),children:e})},Mr=({children:e})=>{const t=M.useContext(sn),o=Te("windowViewportRect"),n=Te("fixedItemHeight"),r=F("customScrollParent"),l=_o(o,r,F("skipAnimationFrameInResizeObserver")),i=F("alignToBottom");return M.useEffect(()=>{t&&(n(t.itemHeight),o({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,o,n]),s.jsx("div",{"data-viewport-type":"window",ref:l,style:Rt(i),children:e})},Lr=({children:e})=>{const t=F("TopItemListComponent")??"div",o=F("headerHeight"),n={...Nr,marginTop:`${o}px`},r=F("context");return s.jsx(t,{style:n,...ge(t,r),children:e})},Or=M.memo(function(e){const t=F("useWindowScroll"),o=F("topItemsIndexes").length>0,n=F("customScrollParent"),r=F("context");return s.jsxs(n||t?Dr:_r,{...e,context:r,children:[o&&s.jsx(Lr,{children:s.jsx(Io,{showTopList:!0})}),s.jsxs(n||t?Mr:Br,{children:[s.jsx(Er,{}),s.jsx(Io,{}),s.jsx(Hr,{})]})]})}),{Component:Ar,useEmitter:no,useEmitterValue:F,usePublisher:Te}=rn(kr,{optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Or),_r=dn({useEmitter:no,useEmitterValue:F,usePublisher:Te}),Dr=pn({useEmitter:no,useEmitterValue:F,usePublisher:Te}),Wr=Ar,Fr=Y(()=>{const e=T(u=>s.jsxs("td",{children:["Item $",u]})),t=T(null),o=T(u=>s.jsxs("td",{colSpan:1e3,children:["Group ",u]})),n=T(null),r=T(null),l=T({}),i=T(oo),c=T(Ze),a=(u,h=null)=>ve(C(l,z(v=>v[u]),te()),h);return{components:l,computeItemKey:i,context:t,EmptyPlaceholder:a("EmptyPlaceholder"),FillerRow:a("FillerRow"),fixedFooterContent:r,fixedHeaderContent:n,itemContent:e,groupContent:o,ScrollerComponent:a("Scroller","div"),scrollerRef:c,ScrollSeekPlaceholder:a("ScrollSeekPlaceholder"),TableBodyComponent:a("TableBody","tbody"),TableComponent:a("Table","table"),TableFooterComponent:a("TableFoot","tfoot"),TableHeadComponent:a("TableHead","thead"),TableRowComponent:a("TableRow","tr"),GroupComponent:a("Group","tr")}});oe(nn,Fr);to();const So={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},Pr={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:jo,floor:Tt,max:nt,min:Lt,round:Ro}=Math;function No(e,t,o){return Array.from({length:t-e+1}).map((n,r)=>({data:o===null?null:o[r+e],index:r+e}))}function Vr(e){return{...Pr,items:e}}function gt(e,t){return e!==void 0&&e.width===t.width&&e.height===t.height}function $r(e,t){return e!==void 0&&e.column===t.column&&e.row===t.row}const Gr=Y(([{increaseViewportBy:e,listBoundary:t,overscan:o,visibleRange:n},{footerHeight:r,headerHeight:l,scrollBy:i,scrollContainerState:c,scrollTo:a,scrollTop:u,smoothScrollTargetReached:h,viewportHeight:v},x,f,{didMount:w,propsReady:b},{customScrollParent:g,useWindowScroll:m,windowScrollContainerState:p,windowScrollTo:k,windowViewportRect:E},j])=>{const O=T(0),d=T(0),y=T(So),S=T({height:0,width:0}),B=T({height:0,width:0}),H=K(),P=K(),V=T(0),A=T(null),U=T({column:0,row:0}),I=K(),_=K(),J=T(!1),fe=T(0),ie=T(!0),we=T(!1),Me=T(!1);Q(C(w,G(fe),W(([R,X])=>X!==0)),()=>{$(ie,!1)}),Q(C(ue(w,ie,B,S,fe,we),W(([R,X,de,ee,,ne])=>R&&!X&&de.height!==0&&ee.height!==0&&!ne)),([,,,,R])=>{$(we,!0),qt(1,()=>{$(H,R)}),je(C(u),()=>{$(t,[0,0]),$(ie,!0)})}),L(C(_,W(R=>R!=null&&R.scrollTop>0),ze(0)),d),Q(C(w,G(_),W(([,R])=>R!=null)),([,R])=>{R&&($(S,R.viewport),$(B,R.item),$(U,R.gap),R.scrollTop>0&&($(J,!0),je(C(u,Ve(1)),X=>{$(J,!1)}),$(a,{top:R.scrollTop})))}),L(C(S,z(({height:R})=>R)),v),L(C(ue(D(S,gt),D(B,gt),D(U,(R,X)=>R!==void 0&&R.column===X.column&&R.row===X.row),D(u)),z(([R,X,de,ee])=>({gap:de,item:X,scrollTop:ee,viewport:R}))),I),L(C(ue(D(O),n,D(U,$r),D(B,gt),D(S,gt),D(A),D(d),D(J),D(ie),D(fe)),W(([,,,,,,,R])=>!R),z(([R,[X,de],ee,ne,pe,ae,Z,,le,be])=>{const{column:ce,row:tt}=ee,{height:ht,width:Nt}=ne,{width:ro}=pe;if(Z===0&&(R===0||ro===0))return So;if(Nt===0){const co=Zt(be,R),xn=co+Math.max(Z-1,0);return Vr(No(co,xn,ae))}const ft=mn(ro,Nt,ce);let Ke,We;le?X===0&&de===0&&Z>0?(Ke=0,We=Z-1):(Ke=ft*Tt((X+tt)/(ht+tt)),We=ft*jo((de+tt)/(ht+tt))-1,We=Lt(R-1,nt(We,ft-1)),Ke=Lt(We,nt(0,Ke))):(Ke=0,We=-1);const so=No(Ke,We,ae),{bottom:lo,top:io}=zo(pe,ee,ne,so),ao=jo(R/ft),fn=ao*ht+(ao-1)*tt-lo;return{bottom:lo,itemHeight:ht,items:so,itemWidth:Nt,offsetBottom:fn,offsetTop:io,top:io}})),y),L(C(A,W(R=>R!==null),z(R=>R.length)),O),L(C(ue(S,B,y,U),W(([R,X,{items:de}])=>de.length>0&&X.height!==0&&R.height!==0),z(([R,X,{items:de},ee])=>{const{bottom:ne,top:pe}=zo(R,ee,X,de);return[pe,ne]}),te(lt)),t);const xe=T(!1);L(C(u,G(xe),z(([R,X])=>X||R!==0)),xe);const Ue=ke(C(ue(y,O),W(([{items:R}])=>R.length>0),G(xe),W(([[R,X],de])=>{const ee=R.items[R.items.length-1].index===X-1;return(de||R.bottom>0&&R.itemHeight>0&&R.offsetBottom===0&&R.items.length===X)&&ee}),z(([[,R]])=>R-1),te())),Je=ke(C(D(y),W(({items:R})=>R.length>0&&R[0].index===0),ze(0),te())),Ne=ke(C(D(y),G(J),W(([{items:R},X])=>R.length>0&&!X),z(([{items:R}])=>({endIndex:R[R.length-1].index,startIndex:R[0].index})),te($o),Be(0)));L(Ne,f.scrollSeekRangeChanged),L(C(H,G(S,B,O,U),z(([R,X,de,ee,ne])=>{const pe=Xo(R),{align:ae,behavior:Z,offset:le}=pe;let be=pe.index;be==="LAST"&&(be=ee-1),be=nt(0,be,Lt(ee-1,be));let ce=Gt(X,ne,de,be);return ae==="end"?ce=Ro(ce-X.height+de.height):ae==="center"&&(ce=Ro(ce-X.height/2+de.height/2)),le!==void 0&&le!==0&&(ce+=le),{behavior:Z,top:ce}})),a);const et=ve(C(y,z(R=>R.offsetBottom+R.bottom)),0);return L(C(E,z(R=>({height:R.visibleHeight,width:R.visibleWidth}))),S),{customScrollParent:g,data:A,deviation:V,footerHeight:r,gap:U,headerHeight:l,increaseViewportBy:e,initialItemCount:d,itemDimensions:B,overscan:o,restoreStateFrom:_,scrollBy:i,scrollContainerState:c,scrollHeight:P,scrollTo:a,scrollToIndex:H,scrollTop:u,smoothScrollTargetReached:h,totalCount:O,useWindowScroll:m,viewportDimensions:S,windowScrollContainerState:p,windowScrollTo:k,windowViewportRect:E,...f,gridState:y,horizontalDirection:Me,initialTopMostItemIndex:fe,totalListHeight:et,...x,endReached:Ue,propsReady:b,rangeChanged:Ne,startReached:Je,stateChanged:I,stateRestoreInProgress:J,...j}},oe(Jt,ye,mt,tn,De,eo,_e));function mn(e,t,o){return nt(1,Tt((e+o)/(Tt(t)+o)))}function zo(e,t,o,n){const{height:r}=o;if(r===void 0||n.length===0)return{bottom:0,top:0};const l=Gt(e,t,o,n[0].index);return{bottom:Gt(e,t,o,n[n.length-1].index)+r,top:l}}function Gt(e,t,o,n){const r=mn(e.width,o.width,t.column),l=Tt(n/r),i=l*o.height+nt(0,l-1)*t.row;return i>0?i+t.row:i}const Ur=Y(()=>{const e=T(v=>`Item ${v}`),t=T({}),o=T(null),n=T("virtuoso-grid-item"),r=T("virtuoso-grid-list"),l=T(oo),i=T("div"),c=T(Ze),a=(v,x=null)=>ve(C(t,z(f=>f[v]),te()),x),u=T(!1),h=T(!1);return L(D(h),u),{components:t,computeItemKey:l,context:o,FooterComponent:a("Footer"),HeaderComponent:a("Header"),headerFooterTag:i,itemClassName:n,ItemComponent:a("Item","div"),itemContent:e,listClassName:r,ListComponent:a("List","div"),readyStateChanged:u,reportReadyState:h,ScrollerComponent:a("Scroller","div"),scrollerRef:c,ScrollSeekPlaceholder:a("ScrollSeekPlaceholder","div")}}),Kr=Y(([e,t])=>({...e,...t}),oe(Gr,Ur)),Yr=M.memo(function(){const e=re("gridState"),t=re("listClassName"),o=re("itemClassName"),n=re("itemContent"),r=re("computeItemKey"),l=re("isSeeking"),i=Ie("scrollHeight"),c=re("ItemComponent"),a=re("ListComponent"),u=re("ScrollSeekPlaceholder"),h=re("context"),v=Ie("itemDimensions"),x=Ie("gap"),f=re("log"),w=re("stateRestoreInProgress"),b=Ie("reportReadyState"),g=$e(M.useMemo(()=>m=>{const p=m.parentElement.parentElement.scrollHeight;i(p);const k=m.firstChild;if(k!==null){const{height:E,width:j}=k.getBoundingClientRect();v({height:E,width:j})}x({column:Eo("column-gap",getComputedStyle(m).columnGap,f),row:Eo("row-gap",getComputedStyle(m).rowGap,f)})},[i,v,x,f]),!0,!1);return an(()=>{e.itemHeight>0&&e.itemWidth>0&&b(!0)},[e]),w?null:s.jsx(a,{className:t,ref:g,...ge(a,h),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(m=>{const p=r(m.index,m.data,h);return l?s.jsx(u,{...ge(u,h),height:e.itemHeight,index:m.index,width:e.itemWidth},p):N.createElement(c,{...ge(c,h),className:o,"data-index":m.index,key:p},n(m.index,m.data,h))})})}),Xr=M.memo(function(){const e=re("HeaderComponent"),t=Ie("headerHeight"),o=re("headerFooterTag"),n=$e(M.useMemo(()=>l=>{t(Oe(l,"height"))},[t]),!0,!1),r=re("context");return e!=null?s.jsx(o,{ref:n,children:s.jsx(e,{...ge(e,r)})}):null}),Qr=M.memo(function(){const e=re("FooterComponent"),t=Ie("footerHeight"),o=re("headerFooterTag"),n=$e(M.useMemo(()=>l=>{t(Oe(l,"height"))},[t]),!0,!1),r=re("context");return e!=null?s.jsx(o,{ref:n,children:s.jsx(e,{...ge(e,r)})}):null}),qr=({children:e})=>{const t=M.useContext(ln),o=Ie("itemDimensions"),n=Ie("viewportDimensions"),r=$e(M.useMemo(()=>l=>{n(l.getBoundingClientRect())},[n]),!0,!1);return M.useEffect(()=>{t&&(n({height:t.viewportHeight,width:t.viewportWidth}),o({height:t.itemHeight,width:t.itemWidth}))},[t,n,o]),s.jsx("div",{ref:r,style:Rt(!1),children:e})},Zr=({children:e})=>{const t=M.useContext(ln),o=Ie("windowViewportRect"),n=Ie("itemDimensions"),r=re("customScrollParent"),l=_o(o,r,!1);return M.useEffect(()=>{t&&(n({height:t.itemHeight,width:t.itemWidth}),o({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,o,n]),s.jsx("div",{ref:l,style:Rt(!1),children:e})},Jr=M.memo(function({...e}){const t=re("useWindowScroll"),o=re("customScrollParent"),n=o||t?ts:es,r=o||t?Zr:qr,l=re("context");return s.jsx(n,{...e,...ge(n,l),children:s.jsxs(r,{children:[s.jsx(Xr,{}),s.jsx(Yr,{}),s.jsx(Qr,{})]})})}),{useEmitter:hn,useEmitterValue:re,usePublisher:Ie}=rn(Kr,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},Jr),es=dn({useEmitter:hn,useEmitterValue:re,usePublisher:Ie}),ts=pn({useEmitter:hn,useEmitterValue:re,usePublisher:Ie});function Eo(e,t,o){return t!=="normal"&&(t==null?void 0:t.endsWith("px"))!==!0&&o(`${e} was not resolved to pixel value correctly`,t,he.WARN),t==="normal"?0:parseInt(t??"0",10)}const os=150;function ns({entries:e,itemCount:t}){const o=N.useRef(null),[n,r]=N.useState(!1),l=N.useRef(!1),i=N.useRef(0),c=N.useRef(e.length),a=N.useRef(0),u=N.useCallback((f="smooth")=>{o.current&&(a.current=Date.now(),o.current.scrollToIndex({index:t-1,behavior:f,align:"end"}))},[t]),h=N.useCallback(f=>l.current||!f?!1:"auto",[]),v=N.useCallback(f=>{r(!f),f&&(l.current=!1)},[]),x=N.useCallback(f=>{const b=f.target.scrollTop;if(Date.now()-a.current<os){i.current=b;return}b-i.current<-10&&(l.current=!0),i.current=b},[]);return N.useEffect(()=>{const f=e.length,w=c.current,b=f>w;if(c.current=f,!b)return;const g=e[e.length-1];(g==null?void 0:g.type)==="user_message"&&(l.current=!1,requestAnimationFrame(()=>{requestAnimationFrame(()=>{o.current&&(a.current=Date.now(),o.current.scrollToIndex({index:"LAST",behavior:"auto",align:"end"}))})}))},[e]),{virtuosoRef:o,handleScroll:x,handleAtBottomStateChange:v,handleFollowOutput:h,showScrollButton:n,scrollToBottom:u}}/**
1
+ import{E as M,j as s,r as N,x as gn,d as Se,y as vn,k as Pe,s as yt,p as bn,i as Le,c as yn,R as wn,P as Cn,O as kn,f as Tn,T as In,h as uo,v as Sn,t as zt}from"./index-nufWop4p.js";import{Z as Dt}from"./zap-9DVkGVtt.js";import{M as jn}from"./MarkdownRenderer-BjZ43aSa.js";import{W as Rn,T as Nn}from"./wrench-B84-zdLI.js";import{C as Mo}from"./chevron-right-CYbpR4ev.js";import{C as zn}from"./circle-alert-BqcYuT7x.js";const It=0,Ae=1,qe=2,Lo=4;function po(e){return()=>e}function En(e){e()}function Oo(e,t){return o=>e(t(o))}function mo(e,t){return()=>e(t)}function Hn(e,t){return o=>e(t,o)}function Ut(e){return e!==void 0}function Bn(...e){return()=>{e.map(En)}}function Ze(){}function St(e,t){return t(e),e}function Mn(e,t){return t(e)}function oe(...e){return e}function Q(e,t){return e(Ae,t)}function $(e,t){e(It,t)}function Kt(e){e(qe)}function se(e){return e(Lo)}function L(e,t){return Q(e,Hn(t,It))}function je(e,t){const o=e(Ae,n=>{o(),t(n)});return o}function ho(e){let t,o;return n=>r=>{t=r,o&&clearTimeout(o),o=setTimeout(()=>{n(t)},e)}}function Ao(e,t){return e===t}function te(e=Ao){let t;return o=>n=>{e(t,n)||(t=n,o(n))}}function W(e){return t=>o=>{e(o)&&t(o)}}function z(e){return t=>Oo(t,e)}function ze(e){return t=>()=>{t(e)}}function C(e,...t){const o=Ln(...t);return((n,r)=>{switch(n){case qe:Kt(e);return;case Ae:return Q(e,o(r))}})}function Ee(e,t){return o=>n=>{o(t=e(t,n))}}function Ve(e){return t=>o=>{e>0?e--:t(o)}}function Be(e){let t=null,o;return n=>r=>{t=r,!o&&(o=setTimeout(()=>{o=void 0,n(t)},e))}}function G(...e){const t=new Array(e.length);let o=0,n=null;const r=2**e.length-1;return e.forEach((l,i)=>{const c=2**i;Q(l,a=>{const u=o;o|=c,t[i]=a,u!==r&&o===r&&n&&(n(),n=null)})}),l=>i=>{const c=()=>{l([i].concat(t))};o===r?c():n=c}}function Ln(...e){return t=>e.reduceRight(Mn,t)}function On(e){let t,o;const n=()=>t==null?void 0:t();return function(r,l){switch(r){case Ae:return l?o===l?void 0:(n(),o=l,t=Q(e,l),t):(n(),Ze);case qe:n(),o=null;return}}}function T(e){let t=e;const o=K();return((n,r)=>{switch(n){case It:t=r;break;case Ae:{r(t);break}case Lo:return t}return o(n,r)})}function ve(e,t){return St(T(t),o=>L(e,o))}function K(){const e=[];return((t,o)=>{switch(t){case It:e.slice().forEach(n=>{n(o)});return;case qe:e.splice(0,e.length);return;case Ae:return e.push(o),()=>{const n=e.indexOf(o);n>-1&&e.splice(n,1)}}})}function ke(e){return St(K(),t=>L(e,t))}function Y(e,t=[],{singleton:o}={singleton:!0}){return{constructor:e,dependencies:t,id:An(),singleton:o}}const An=()=>Symbol();function _n(e){const t=new Map,o=({constructor:n,dependencies:r,id:l,singleton:i})=>{if(i&&t.has(l))return t.get(l);const c=n(r.map(a=>o(a)));return i&&t.set(l,c),c};return o(e)}function ue(...e){const t=K(),o=new Array(e.length);let n=0;const r=2**e.length-1;return e.forEach((l,i)=>{const c=2**i;Q(l,a=>{o[i]=a,n|=c,n===r&&$(t,o)})}),function(l,i){switch(l){case qe:{Kt(t);return}case Ae:return n===r&&i(o),Q(t,i)}}}function D(e,t=Ao){return C(e,te(t))}function Wt(...e){return function(t,o){switch(t){case qe:return;case Ae:return Bn(...e.map(n=>Q(n,o)))}}}const he={DEBUG:0,INFO:1,WARN:2,ERROR:3},Dn={[he.DEBUG]:"debug",[he.ERROR]:"error",[he.INFO]:"log",[he.WARN]:"warn"},Wn=()=>typeof globalThis>"u"?window:globalThis,_e=Y(()=>{const e=T(he.ERROR);return{log:T((t,o,n=he.INFO)=>{const r=Wn().VIRTUOSO_LOG_LEVEL??se(e);n>=r&&console[Dn[n]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,o)}),logLevel:e}},[],{singleton:!0});function $e(e,t,o){return Yt(e,t,o).callbackRef}function Yt(e,t,o){const n=M.useRef(null);let r=i=>{};const l=M.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(i=>{const c=()=>{const a=i[0].target;a.offsetParent!==null&&e(a)};o?c():requestAnimationFrame(c)}):null,[e,o]);return r=i=>{i&&t?(l==null||l.observe(i),n.current=i):(n.current&&(l==null||l.unobserve(n.current)),n.current=null)},{callbackRef:r,ref:n}}function Fn(e,t,o,n,r,l,i,c,a){const u=M.useCallback(h=>{const v=Pn(h.children,t,c?"offsetWidth":"offsetHeight",r);let x=h.parentElement;for(;x.dataset.virtuosoScroller===void 0;)x=x.parentElement;const f=x.lastElementChild.dataset.viewportType==="window";let w;f&&(w=x.ownerDocument.defaultView);const b=i?c?i.scrollLeft:i.scrollTop:f?c?w.scrollX||w.document.documentElement.scrollLeft:w.scrollY||w.document.documentElement.scrollTop:c?x.scrollLeft:x.scrollTop,g=i?c?i.scrollWidth:i.scrollHeight:f?c?w.document.documentElement.scrollWidth:w.document.documentElement.scrollHeight:c?x.scrollWidth:x.scrollHeight,m=i?c?i.offsetWidth:i.offsetHeight:f?c?w.innerWidth:w.innerHeight:c?x.offsetWidth:x.offsetHeight;n({scrollHeight:g,scrollTop:Math.max(b,0),viewportHeight:m}),l==null||l(c?fo("column-gap",getComputedStyle(h).columnGap,r):fo("row-gap",getComputedStyle(h).rowGap,r)),v!==null&&e(v)},[e,t,r,l,i,n,c]);return Yt(u,o,a)}function Pn(e,t,o,n){const r=e.length;if(r===0)return null;const l=[];for(let i=0;i<r;i++){const c=e.item(i);if(c.dataset.index===void 0)continue;const a=parseInt(c.dataset.index),u=parseFloat(c.dataset.knownSize),h=t(c,o);if(h===0&&n("Zero-sized element, this should not happen",{child:c},he.ERROR),h===u)continue;const v=l[l.length-1];l.length===0||v.size!==h||v.endIndex!==a-1?l.push({endIndex:a,size:h,startIndex:a}):l[l.length-1].endIndex++}return l}function fo(e,t,o){return t!=="normal"&&(t==null?void 0:t.endsWith("px"))!==!0&&o(`${e} was not resolved to pixel value correctly`,t,he.WARN),t==="normal"?0:parseInt(t??"0",10)}function _o(e,t,o){const n=M.useRef(null),r=M.useCallback(a=>{if(!(a!=null&&a.offsetParent))return;const u=a.getBoundingClientRect(),h=u.width;let v,x;if(t){const f=t.getBoundingClientRect(),w=u.top-f.top;x=f.height-Math.max(0,w),v=w+t.scrollTop}else{const f=i.current.ownerDocument.defaultView;x=f.innerHeight-Math.max(0,u.top),v=u.top+f.scrollY}n.current={listHeight:u.height,offsetTop:v,visibleHeight:x,visibleWidth:h},e(n.current)},[e,t]),{callbackRef:l,ref:i}=Yt(r,!0,o),c=M.useCallback(()=>{r(i.current)},[r,i]);return M.useEffect(()=>{var u;if(t){t.addEventListener("scroll",c);const h=new ResizeObserver(()=>{requestAnimationFrame(c)});return h.observe(t),()=>{t.removeEventListener("scroll",c),h.unobserve(t)}}const a=(u=i.current)==null?void 0:u.ownerDocument.defaultView;return a==null||a.addEventListener("scroll",c),a==null||a.addEventListener("resize",c),()=>{a==null||a.removeEventListener("scroll",c),a==null||a.removeEventListener("resize",c)}},[c,t,i]),l}const ye=Y(()=>{const e=K(),t=K(),o=T(0),n=K(),r=T(0),l=K(),i=K(),c=T(0),a=T(0),u=T(0),h=T(0),v=K(),x=K(),f=T(!1),w=T(!1),b=T(!1);return L(C(e,z(({scrollTop:g})=>g)),t),L(C(e,z(({scrollHeight:g})=>g)),i),L(t,r),{deviation:o,fixedFooterHeight:u,fixedHeaderHeight:a,footerHeight:h,headerHeight:c,horizontalDirection:w,scrollBy:x,scrollContainerState:e,scrollHeight:i,scrollingInProgress:f,scrollTo:v,scrollTop:t,skipAnimationFrameInResizeObserver:b,smoothScrollTargetReached:n,statefulScrollTop:r,viewportHeight:l}},[],{singleton:!0}),rt={lvl:0};function Do(e,t){const o=e.length;if(o===0)return[];let{index:n,value:r}=t(e[0]);const l=[];for(let i=1;i<o;i++){const{index:c,value:a}=t(e[i]);l.push({end:c-1,start:n,value:r}),n=c,r=a}return l.push({end:1/0,start:n,value:r}),l}function q(e){return e===rt}function st(e,t){if(!q(e))return t===e.k?e.v:t<e.k?st(e.l,t):st(e.r,t)}function Re(e,t,o="k"){if(q(e))return[-1/0,void 0];if(Number(e[o])===t)return[e.k,e.v];if(Number(e[o])<t){const n=Re(e.r,t,o);return n[0]===-1/0?[e.k,e.v]:n}return Re(e.l,t,o)}function Ce(e,t,o){return q(e)?Po(t,o,1):t===e.k?me(e,{k:t,v:o}):t<e.k?xo(me(e,{l:Ce(e.l,t,o)})):xo(me(e,{r:Ce(e.r,t,o)}))}function Ye(){return rt}function Xe(e,t,o){if(q(e))return[];const n=Re(e,t)[0];return Vn(Pt(e,n,o))}function Ft(e,t){if(q(e))return rt;const{k:o,l:n,r}=e;if(t===o){if(q(n))return r;if(q(r))return n;const[l,i]=Fo(n);return wt(me(e,{k:l,l:Wo(n),v:i}))}return t<o?wt(me(e,{l:Ft(n,t)})):wt(me(e,{r:Ft(r,t)}))}function Fe(e){return q(e)?[]:[...Fe(e.l),{k:e.k,v:e.v},...Fe(e.r)]}function Pt(e,t,o){if(q(e))return[];const{k:n,l:r,r:l,v:i}=e;let c=[];return n>t&&(c=c.concat(Pt(r,t,o))),n>=t&&n<=o&&c.push({k:n,v:i}),n<=o&&(c=c.concat(Pt(l,t,o))),c}function wt(e){const{l:t,lvl:o,r:n}=e;if(n.lvl>=o-1&&t.lvl>=o-1)return e;if(o>n.lvl+1){if(Et(t))return Vo(me(e,{lvl:o-1}));if(!q(t)&&!q(t.r))return me(t.r,{l:me(t,{r:t.r.l}),lvl:o,r:me(e,{l:t.r.r,lvl:o-1})});throw new Error("Unexpected empty nodes")}if(Et(e))return Vt(me(e,{lvl:o-1}));if(!q(n)&&!q(n.l)){const r=n.l,l=Et(r)?n.lvl-1:n.lvl;return me(r,{l:me(e,{lvl:o-1,r:r.l}),lvl:r.lvl+1,r:Vt(me(n,{l:r.r,lvl:l}))})}throw new Error("Unexpected empty nodes")}function me(e,t){return Po(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Wo(e){return q(e.r)?e.l:wt(me(e,{r:Wo(e.r)}))}function Et(e){return q(e)||e.lvl>e.r.lvl}function Fo(e){return q(e.r)?[e.k,e.v]:Fo(e.r)}function Po(e,t,o,n=rt,r=rt){return{k:e,l:n,lvl:o,r,v:t}}function xo(e){return Vt(Vo(e))}function Vo(e){const{l:t}=e;return!q(t)&&t.lvl===e.lvl?me(t,{r:me(e,{l:t.r})}):e}function Vt(e){const{lvl:t,r:o}=e;return!q(o)&&!q(o.r)&&o.lvl===t&&o.r.lvl===t?me(o,{l:me(e,{r:o.l}),lvl:t+1}):e}function Vn(e){return Do(e,({k:t,v:o})=>({index:t,value:o}))}function $o(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function lt(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const Xt=Y(()=>({recalcInProgress:T(!1)}),[],{singleton:!0});function Go(e,t,o){return e[kt(e,t,o)]}function kt(e,t,o,n=0){let r=e.length-1;for(;n<=r;){const l=Math.floor((n+r)/2),i=e[l],c=o(i,t);if(c===0)return l;if(c===-1){if(r-n<2)return l-1;r=l-1}else{if(r===n)return l;n=l+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function $n(e,t,o,n){const r=kt(e,t,n),l=kt(e,o,n,r);return e.slice(r,l+1)}function Oe(e,t){return Math.round(e.getBoundingClientRect()[t])}function jt(e){return!q(e.groupOffsetTree)}function Qt({index:e},t){return t===e?0:t<e?-1:1}function Gn(){return{groupIndices:[],groupOffsetTree:Ye(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Ye()}}function Un(e,t){let o=q(e)?0:1/0;for(const n of t){const{endIndex:r,size:l,startIndex:i}=n;if(o=Math.min(o,i),q(e)){e=Ce(e,0,l);continue}const c=Xe(e,i-1,r+1);if(c.some(Jn(n)))continue;let a=!1,u=!1;for(const{end:h,start:v,value:x}of c)a?(r>=v||l===x)&&(e=Ft(e,v)):(u=x!==l,a=!0),h>r&&r>=v&&x!==l&&(e=Ce(e,r+1,x));u&&(e=Ce(e,i,l))}return[e,o]}function Kn(e){return typeof e.groupIndex<"u"}function Yn({offset:e},t){return t===e?0:t<e?-1:1}function it(e,t,o){if(t.length===0)return 0;const{index:n,offset:r,size:l}=Go(t,e,Qt),i=e-n,c=l*i+(i-1)*o+r;return c>0?c+o:c}function Uo(e,t){if(!jt(t))return e;let o=0;for(;t.groupIndices[o]<=e+o;)o++;return e+o}function Ko(e,t,o){if(Kn(e))return t.groupIndices[e.groupIndex]+1;const n=e.index==="LAST"?o:e.index;let r=Uo(n,t);return r=Math.max(0,r,Math.min(o,r)),r}function Xn(e,t,o,n=0){return n>0&&(t=Math.max(t,Go(e,n,Qt).offset)),Do($n(e,t,o,Yn),Zn)}function Qn(e,[t,o,n,r]){t.length>0&&n("received item sizes",t,he.DEBUG);const l=e.sizeTree;let i=l,c=0;if(o.length>0&&q(l)&&t.length===2){const x=t[0].size,f=t[1].size;i=o.reduce((w,b)=>Ce(Ce(w,b,x),b+1,f),i)}else[i,c]=Un(i,t);if(i===l)return e;const{lastIndex:a,lastOffset:u,lastSize:h,offsetTree:v}=$t(e.offsetTree,c,i,r);return{groupIndices:o,groupOffsetTree:o.reduce((x,f)=>Ce(x,f,it(f,v,r)),Ye()),lastIndex:a,lastOffset:u,lastSize:h,offsetTree:v,sizeTree:i}}function qn(e){return Fe(e).map(({k:t,v:o},n,r)=>{const l=r[n+1];return{endIndex:l!==void 0?l.k-1:1/0,size:o,startIndex:t}})}function go(e,t){let o=0,n=0;for(;o<e;)o+=t[n+1]-t[n]-1,n++;return n-(o===e?0:1)}function $t(e,t,o,n){let r=e,l=0,i=0,c=0,a=0;if(t!==0){a=kt(r,t-1,Qt),c=r[a].offset;const u=Re(o,t-1);l=u[0],i=u[1],r.length&&r[a].size===Re(o,t)[1]&&(a-=1),r=r.slice(0,a+1)}else r=[];for(const{start:u,value:h}of Xe(o,t,1/0)){const v=u-l,x=v*i+c+v*n;r.push({index:u,offset:x,size:h}),l=u,c=x,i=h}return{lastIndex:l,lastOffset:c,lastSize:i,offsetTree:r}}function Zn(e){return{index:e.index,value:e}}function Jn(e){const{endIndex:t,size:o,startIndex:n}=e;return r=>r.start===n&&(r.end===t||r.end===1/0)&&r.value===o}const er={offsetHeight:"height",offsetWidth:"width"},He=Y(([{log:e},{recalcInProgress:t}])=>{const o=K(),n=K(),r=ve(n,0),l=K(),i=K(),c=T(0),a=T([]),u=T(void 0),h=T(void 0),v=T(void 0),x=T(void 0),f=T((d,y)=>Oe(d,er[y])),w=T(void 0),b=T(0),g=Gn(),m=ve(C(o,G(a,e,b),Ee(Qn,g),te()),g),p=ve(C(a,te(),Ee((d,y)=>({current:y,prev:d.current}),{current:[],prev:[]}),z(({prev:d})=>d)),[]);L(C(a,W(d=>d.length>0),G(m,b),z(([d,y,S])=>{const B=d.reduce((H,P,V)=>Ce(H,P,it(P,y.offsetTree,S)||V),Ye());return{...y,groupIndices:d,groupOffsetTree:B}})),m),L(C(n,G(m),W(([d,{lastIndex:y}])=>d<y),z(([d,{lastIndex:y,lastSize:S}])=>[{endIndex:y,size:S,startIndex:d}])),o),L(u,h);const k=ve(C(u,z(d=>d===void 0)),!0);L(C(h,W(d=>d!==void 0&&q(se(m).sizeTree)),z(d=>{const y=se(v),S=se(a).length>0;return y!==void 0&&y!==0?S?[{endIndex:0,size:y,startIndex:0},{endIndex:1,size:d,startIndex:1}]:[]:[{endIndex:0,size:d,startIndex:0}]})),o),L(C(x,W(d=>d!==void 0&&d.length>0&&q(se(m).sizeTree)),z(d=>{const y=[];let S=d[0],B=0;for(let H=1;H<d.length;H++){const P=d[H];P!==S&&(y.push({endIndex:H-1,size:S,startIndex:B}),S=P,B=H)}return y.push({endIndex:d.length-1,size:S,startIndex:B}),y})),o),L(C(a,G(v,h),W(([,d,y])=>d!==void 0&&y!==void 0),z(([d,y,S])=>{const B=[];for(let H=0;H<d.length;H++){const P=d[H],V=d[H+1];B.push({startIndex:P,endIndex:P,size:y}),V!==void 0&&B.push({startIndex:P+1,endIndex:V-1,size:S})}return B})),o);const E=ke(C(o,G(m),Ee(({sizes:d},[y,S])=>({changed:S!==d,sizes:S}),{changed:!1,sizes:g}),z(d=>d.changed)));Q(C(c,Ee((d,y)=>({diff:d.prev-y,prev:y}),{diff:0,prev:0}),z(d=>d.diff)),d=>{const{groupIndices:y}=se(m);if(d>0)$(t,!0),$(l,d+go(d,y));else if(d<0){const S=se(p);S.length>0&&(d-=go(-d,S)),$(i,d)}}),Q(C(c,G(e)),([d,y])=>{d<0&&y("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:c},he.ERROR)});const j=ke(l);L(C(l,G(m),z(([d,y])=>{const S=y.groupIndices.length>0,B=[],H=y.lastSize;if(S){const P=st(y.sizeTree,0);let V=0,A=0;for(;V<d;){const I=y.groupIndices[A],_=y.groupIndices.length===A+1?1/0:y.groupIndices[A+1]-I-1;B.push({endIndex:I,size:P,startIndex:I}),B.push({endIndex:I+1+_-1,size:H,startIndex:I+1}),A++,V+=_+1}const U=Fe(y.sizeTree);return V!==d&&U.shift(),U.reduce((I,{k:_,v:J})=>{let fe=I.ranges;return I.prevSize!==0&&(fe=[...I.ranges,{endIndex:_+d-1,size:I.prevSize,startIndex:I.prevIndex}]),{prevIndex:_+d,prevSize:J,ranges:fe}},{prevIndex:d,prevSize:0,ranges:B}).ranges}return Fe(y.sizeTree).reduce((P,{k:V,v:A})=>({prevIndex:V+d,prevSize:A,ranges:[...P.ranges,{endIndex:V+d-1,size:P.prevSize,startIndex:P.prevIndex}]}),{prevIndex:0,prevSize:H,ranges:[]}).ranges})),o);const O=ke(C(i,G(m,b),z(([d,{offsetTree:y},S])=>{const B=-d;return it(B,y,S)})));return L(C(i,G(m,b),z(([d,y,S])=>{if(y.groupIndices.length>0){if(q(y.sizeTree))return y;let H=Ye();const P=se(p);let V=0,A=0,U=0;for(;V<-d;){U=P[A];const I=P[A+1]-U-1;A++,V+=I+1}if(H=Fe(y.sizeTree).reduce((I,{k:_,v:J})=>Ce(I,Math.max(0,_+d),J),H),V!==-d){const I=st(y.sizeTree,U);H=Ce(H,0,I);const _=Re(y.sizeTree,-d+1)[1];H=Ce(H,1,_)}return{...y,sizeTree:H,...$t(y.offsetTree,0,H,S)}}const B=Fe(y.sizeTree).reduce((H,{k:P,v:V})=>Ce(H,Math.max(0,P+d),V),Ye());return{...y,sizeTree:B,...$t(y.offsetTree,0,B,S)}})),m),{beforeUnshiftWith:j,data:w,defaultItemSize:h,firstItemIndex:c,fixedItemSize:u,fixedGroupSize:v,gap:b,groupIndices:a,heightEstimates:x,itemSize:f,listRefresh:E,shiftWith:i,shiftWithOffset:O,sizeRanges:o,sizes:m,statefulTotalCount:r,totalCount:n,trackItemSizes:k,unshiftWith:l}},oe(_e,Xt),{singleton:!0});function tr(e){return e.reduce((t,o)=>(t.groupIndices.push(t.totalCount),t.totalCount+=o+1,t),{groupIndices:[],totalCount:0})}const Yo=Y(([{groupIndices:e,sizes:t,totalCount:o},{headerHeight:n,scrollTop:r}])=>{const l=K(),i=K(),c=ke(C(l,z(tr)));return L(C(c,z(a=>a.totalCount)),o),L(C(c,z(a=>a.groupIndices)),e),L(C(ue(r,t,n),W(([a,u])=>jt(u)),z(([a,u,h])=>Re(u.groupOffsetTree,Math.max(a-h,0),"v")[0]),te(),z(a=>[a])),i),{groupCounts:l,topItemsIndexes:i}},oe(He,ye)),De=Y(([{log:e}])=>{const t=T(!1),o=ke(C(t,W(n=>n),te()));return Q(t,n=>{n&&se(e)("props updated",{},he.DEBUG)}),{didMount:o,propsReady:t}},oe(_e),{singleton:!0}),or=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Xo(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!or)&&(t.behavior="auto"),t.offset===void 0&&(t.offset=0),t}const dt=Y(([{gap:e,listRefresh:t,sizes:o,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:l,footerHeight:i,headerHeight:c,scrollingInProgress:a,scrollTo:u,smoothScrollTargetReached:h,viewportHeight:v},{log:x}])=>{const f=K(),w=K(),b=T(0);let g=null,m=null,p=null;function k(){g!==null&&(g(),g=null),p!==null&&(p(),p=null),m&&(clearTimeout(m),m=null),$(a,!1)}return L(C(f,G(o,v,n,b,c,i,x),G(e,l,r),z(([[E,j,O,d,y,S,B,H],P,V,A])=>{const U=Xo(E),{align:I,behavior:_,offset:J}=U,fe=d-1,ie=Ko(U,j,fe);let we=it(ie,j.offsetTree,P)+S;I==="end"?(we+=V+Re(j.sizeTree,ie)[1]-O+A,ie===fe&&(we+=B)):I==="center"?we+=(V+Re(j.sizeTree,ie)[1]-O+A)/2:we-=y,J!==void 0&&J!==0&&(we+=J);const Me=xe=>{k(),xe?(H("retrying to scroll to",{location:E},he.DEBUG),$(f,E)):($(w,!0),H("list did not change, scroll successful",{},he.DEBUG))};if(k(),_==="smooth"){let xe=!1;p=Q(t,Ue=>{xe=xe||Ue}),g=je(h,()=>{Me(xe)})}else g=je(C(t,nr(150)),Me);return m=setTimeout(()=>{k()},1200),$(a,!0),H("scrolling from index to",{behavior:_,index:ie,top:we},he.DEBUG),{behavior:_,top:we}})),u),{scrollTargetReached:w,scrollToIndex:f,topListHeight:b}},oe(He,ye,_e),{singleton:!0});function nr(e){return t=>{const o=setTimeout(()=>{t(!1)},e);return n=>{n&&(t(!0),clearTimeout(o))}}}function qt(e,t){e===0?t():requestAnimationFrame(()=>{qt(e-1,t)})}function Zt(e,t){const o=t-1;return typeof e=="number"?e:e.index==="LAST"?o:e.index}const pt=Y(([{defaultItemSize:e,listRefresh:t,sizes:o},{scrollTop:n},{scrollTargetReached:r,scrollToIndex:l},{didMount:i}])=>{const c=T(!0),a=T(0),u=T(!0);return L(C(i,G(a),W(([h,v])=>v!==0),ze(!1)),c),L(C(i,G(a),W(([h,v])=>v!==0),ze(!1)),u),Q(C(ue(t,i),G(c,o,e,u),W(([[,h],v,{sizeTree:x},f,w])=>h&&(!q(x)||Ut(f))&&!v&&!w),G(a)),([,h])=>{je(r,()=>{$(u,!0)}),qt(4,()=>{je(n,()=>{$(c,!0)}),$(l,h)})}),{initialItemFinalLocationReached:u,initialTopMostItemIndex:a,scrolledToInitialItem:c}},oe(He,ye,dt,De),{singleton:!0});function Qo(e,t){return Math.abs(e-t)<1.01}const at="up",ot="down",rr="none",sr={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},lr=0,mt=Y(([{footerHeight:e,headerHeight:t,scrollBy:o,scrollContainerState:n,scrollTop:r,viewportHeight:l}])=>{const i=T(!1),c=T(!0),a=K(),u=K(),h=T(4),v=T(lr),x=ve(C(Wt(C(D(r),Ve(1),ze(!0)),C(D(r),Ve(1),ze(!1),ho(100))),te()),!1),f=ve(C(Wt(C(o,ze(!0)),C(o,ze(!1),ho(200))),te()),!1);L(C(ue(D(r),D(v)),z(([p,k])=>p<=k),te()),c),L(C(c,Be(50)),u);const w=ke(C(ue(n,D(l),D(t),D(e),D(h)),Ee((p,[{scrollHeight:k,scrollTop:E},j,O,d,y])=>{const S=E+j-k>-y,B={scrollHeight:k,scrollTop:E,viewportHeight:j};if(S){let P,V;return E>p.state.scrollTop?(P="SCROLLED_DOWN",V=p.state.scrollTop-E):(P="SIZE_DECREASED",V=p.state.scrollTop-E||p.scrollTopDelta),{atBottom:!0,atBottomBecause:P,scrollTopDelta:V,state:B}}let H;return B.scrollHeight>p.state.scrollHeight?H="SIZE_INCREASED":j<p.state.viewportHeight?H="VIEWPORT_HEIGHT_DECREASING":E<p.state.scrollTop?H="SCROLLING_UPWARDS":H="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:H,state:B}},sr),te((p,k)=>p!==void 0&&p.atBottom===k.atBottom))),b=ve(C(n,Ee((p,{scrollHeight:k,scrollTop:E,viewportHeight:j})=>{if(!Qo(p.scrollHeight,k)){const O=k-(E+j)<1;return p.scrollTop!==E&&O?{changed:!0,jump:p.scrollTop-E,scrollHeight:k,scrollTop:E}:{changed:!0,jump:0,scrollHeight:k,scrollTop:E}}return{changed:!1,jump:0,scrollHeight:k,scrollTop:E}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),W(p=>p.changed),z(p=>p.jump)),0);L(C(w,z(p=>p.atBottom)),i),L(C(i,Be(50)),a);const g=T(ot);L(C(n,z(({scrollTop:p})=>p),te(),Ee((p,k)=>se(f)?{direction:p.direction,prevScrollTop:k}:{direction:k<p.prevScrollTop?at:ot,prevScrollTop:k},{direction:ot,prevScrollTop:0}),z(p=>p.direction)),g),L(C(n,Be(50),ze(rr)),g);const m=T(0);return L(C(x,W(p=>!p),ze(0)),m),L(C(r,Be(100),G(x),W(([p,k])=>k),Ee(([p,k],[E])=>[k,E],[0,0]),z(([p,k])=>k-p)),m),{atBottomState:w,atBottomStateChange:a,atBottomThreshold:h,atTopStateChange:u,atTopThreshold:v,isAtBottom:i,isAtTop:c,isScrolling:x,lastJumpDueToItemResize:b,scrollDirection:g,scrollVelocity:m}},oe(ye)),ct="top",ut="bottom",vo="none";function bo(e,t,o){return typeof e=="number"?o===at&&t===ct||o===ot&&t===ut?e:0:o===at?t===ct?e.main:e.reverse:t===ut?e.main:e.reverse}function yo(e,t){return typeof e=="number"?e:e[t]??0}const Jt=Y(([{deviation:e,fixedHeaderHeight:t,headerHeight:o,scrollTop:n,viewportHeight:r}])=>{const l=K(),i=T(0),c=T(0),a=T(0),u=ve(C(ue(D(n),D(r),D(o),D(l,lt),D(a),D(i),D(t),D(e),D(c)),z(([h,v,x,[f,w],b,g,m,p,k])=>{const E=h-p,j=g+m,O=Math.max(x-E,0);let d=vo;const y=yo(k,ct),S=yo(k,ut);return f-=p,f+=x+m,w+=x+m,w-=p,f>h+j-y&&(d=at),w<h-O+v+S&&(d=ot),d!==vo?[Math.max(E-x-bo(b,ct,d)-y,0),E-O-m+v+bo(b,ut,d)+S]:null}),W(h=>h!==null),te(lt)),[0,0]);return{increaseViewportBy:c,listBoundary:l,overscan:a,topListHeight:i,visibleRange:u}},oe(ye),{singleton:!0});function ir(e,t,o){if(jt(t)){const n=Uo(e,t);return[{index:Re(t.groupOffsetTree,n)[0],offset:0,size:0},{data:o==null?void 0:o[0],index:n,offset:0,size:0}]}return[{data:o==null?void 0:o[0],index:e,offset:0,size:0}]}const Ht={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Ct(e,t,o,n,r,l){const{lastIndex:i,lastOffset:c,lastSize:a}=r;let u=0,h=0;if(e.length>0){u=e[0].offset;const b=e[e.length-1];h=b.offset+b.size}const v=o-i,x=c+v*a+(v-1)*n,f=u,w=x-h;return{bottom:h,firstItemIndex:l,items:wo(e,r,l),offsetBottom:w,offsetTop:u,top:f,topItems:wo(t,r,l),topListHeight:t.reduce((b,g)=>g.size+b,0),totalCount:o}}function qo(e,t,o,n,r,l){let i=0;if(o.groupIndices.length>0)for(const h of o.groupIndices){if(h-i>=e)break;i++}const c=e+i,a=Zt(t,c),u=Array.from({length:c}).map((h,v)=>({data:l[v+a],index:v+a,offset:0,size:0}));return Ct(u,[],c,r,o,n)}function wo(e,t,o){if(e.length===0)return[];if(!jt(t))return e.map(u=>({...u,index:u.index+o,originalIndex:u.index}));const n=e[0].index,r=e[e.length-1].index,l=[],i=Xe(t.groupOffsetTree,n,r);let c,a=0;for(const u of e){(!c||c.end<u.index)&&(c=i.shift(),a=t.groupIndices.indexOf(c.start));let h;u.index===c.start?h={index:a,type:"group"}:h={groupIndex:a,index:u.index-(a+1)+o},l.push({...h,data:u.data,offset:u.offset,originalIndex:u.index,size:u.size})}return l}function Co(e,t){return e===void 0?0:typeof e=="number"?e:e[t]??0}const Ge=Y(([{data:e,firstItemIndex:t,gap:o,sizes:n,totalCount:r},l,{listBoundary:i,topListHeight:c,visibleRange:a},{initialTopMostItemIndex:u,scrolledToInitialItem:h},{topListHeight:v},x,{didMount:f},{recalcInProgress:w}])=>{const b=T([]),g=T(0),m=K(),p=T(0);L(l.topItemsIndexes,b);const k=ve(C(ue(f,w,D(a,lt),D(r),D(n),D(u),h,D(b),D(t),D(o),D(p),e),W(([d,y,,S,,,,,,,,B])=>{const H=B!==void 0&&B.length!==S;return d&&!y&&!H}),z(([,,[d,y],S,B,H,P,V,A,U,I,_])=>{var X,de;const J=B,{offsetTree:fe,sizeTree:ie}=J,we=se(g);if(S===0)return{...Ht,totalCount:S};if(d===0&&y===0)return we===0?{...Ht,totalCount:S}:qo(we,H,B,A,U,_||[]);if(q(ie))return we>0?null:Ct(ir(Zt(H,S),J,_),[],S,U,J,A);const Me=[];if(V.length>0){const ee=V[0],ne=V[V.length-1];let pe=0;for(const ae of Xe(ie,ee,ne)){const Z=ae.value,le=Math.max(ae.start,ee),be=Math.min(ae.end,ne);for(let ce=le;ce<=be;ce++)Me.push({data:_==null?void 0:_[ce],index:ce,offset:pe,size:Z}),pe+=Z}}if(!P)return Ct([],Me,S,U,J,A);const xe=V.length>0?V[V.length-1]+1:0,Ue=Xn(fe,d,y,xe);if(Ue.length===0)return null;const Je=S-1,Ne=St([],ee=>{for(const ne of Ue){const pe=ne.value;let ae=pe.offset,Z=ne.start;const le=pe.size;if(pe.offset<d){Z+=Math.floor((d-pe.offset+U)/(le+U));const ce=Z-ne.start;ae+=ce*le+ce*U}Z<xe&&(ae+=(xe-Z)*le,Z=xe);const be=Math.min(ne.end,Je);for(let ce=Z;ce<=be&&!(ae>=y);ce++)ee.push({data:_==null?void 0:_[ce],index:ce,offset:ae,size:le}),ae+=le+U}}),et=Co(I,ct),R=Co(I,ut);if(Ne.length>0&&(et>0||R>0)){const ee=Ne[0],ne=Ne[Ne.length-1];if(et>0&&ee.index>xe){const pe=Math.min(et,ee.index-xe),ae=[];let Z=ee.offset;for(let le=ee.index-1;le>=ee.index-pe;le--){const be=((X=Xe(ie,le,le)[0])==null?void 0:X.value)??ee.size;Z-=be+U,ae.unshift({data:_==null?void 0:_[le],index:le,offset:Z,size:be})}Ne.unshift(...ae)}if(R>0&&ne.index<Je){const pe=Math.min(R,Je-ne.index);let ae=ne.offset+ne.size+U;for(let Z=ne.index+1;Z<=ne.index+pe;Z++){const le=((de=Xe(ie,Z,Z)[0])==null?void 0:de.value)??ne.size;Ne.push({data:_==null?void 0:_[Z],index:Z,offset:ae,size:le}),ae+=le+U}}}return Ct(Ne,Me,S,U,J,A)}),W(d=>d!==null),te()),Ht);L(C(e,W(Ut),z(d=>d==null?void 0:d.length)),r),L(C(k,z(d=>d.topListHeight)),v),L(v,c),L(C(k,z(d=>[d.top,d.bottom])),i),L(C(k,z(d=>d.items)),m);const E=ke(C(k,W(({items:d})=>d.length>0),G(r,e),W(([{items:d},y])=>d[d.length-1].originalIndex===y-1),z(([,d,y])=>[d-1,y]),te(lt),z(([d])=>d))),j=ke(C(k,Be(200),W(({items:d,topItems:y})=>d.length>0&&d[0].originalIndex===y.length),z(({items:d})=>d[0].index),te())),O=ke(C(k,W(({items:d})=>d.length>0),z(({items:d})=>{let y=0,S=d.length-1;for(;d[y].type==="group"&&y<S;)y++;for(;d[S].type==="group"&&S>y;)S--;return{endIndex:d[S].index,startIndex:d[y].index}}),te($o)));return{endReached:E,initialItemCount:g,itemsRendered:m,listState:k,minOverscanItemCount:p,rangeChanged:O,startReached:j,topItemsIndexes:b,...x}},oe(He,Yo,Jt,pt,dt,mt,De,Xt),{singleton:!0}),Zo=Y(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:o,headerHeight:n},{listState:r}])=>{const l=K(),i=ve(C(ue(o,e,n,t,r),z(([c,a,u,h,v])=>c+a+u+h+v.offsetBottom+v.bottom)),0);return L(D(i),l),{totalListHeight:i,totalListHeightChanged:l}},oe(ye,Ge),{singleton:!0}),ar=Y(([{viewportHeight:e},{totalListHeight:t}])=>{const o=T(!1),n=ve(C(ue(o,e,t),W(([r])=>r),z(([,r,l])=>Math.max(0,r-l)),Be(0),te()),0);return{alignToBottom:o,paddingTopAddition:n}},oe(ye,Zo),{singleton:!0}),Jo=Y(()=>({context:T(null)})),cr=({itemBottom:e,itemTop:t,locationParams:{align:o,behavior:n,...r},viewportBottom:l,viewportTop:i})=>t<i?{...r,align:o??"start",...n!==void 0?{behavior:n}:{}}:e>l?{...r,align:o??"end",...n!==void 0?{behavior:n}:{}}:null,en=Y(([{gap:e,sizes:t,totalCount:o},{fixedFooterHeight:n,fixedHeaderHeight:r,headerHeight:l,scrollingInProgress:i,scrollTop:c,viewportHeight:a},{scrollToIndex:u}])=>{const h=K();return L(C(h,G(t,a,o,l,r,n,c),G(e),z(([[v,x,f,w,b,g,m,p],k])=>{const{calculateViewLocation:E=cr,done:j,...O}=v,d=Ko(v,x,w-1),y=it(d,x.offsetTree,k)+b+g,S=y+Re(x.sizeTree,d)[1],B=p+g,H=p+f-m,P=E({itemBottom:S,itemTop:y,locationParams:O,viewportBottom:H,viewportTop:B});return P!==null?j&&je(C(i,W(V=>!V),Ve(se(i)?1:2)),j):j==null||j(),P}),W(v=>v!==null)),u),{scrollIntoView:h}},oe(He,ye,dt,Ge,_e),{singleton:!0});function ko(e){return e===!1?!1:e==="smooth"?"smooth":"auto"}const ur=(e,t)=>typeof e=="function"?ko(e(t)):t&&ko(e),dr=Y(([{listRefresh:e,totalCount:t,fixedItemSize:o,data:n},{atBottomState:r,isAtBottom:l},{scrollToIndex:i},{scrolledToInitialItem:c},{didMount:a,propsReady:u},{log:h},{scrollingInProgress:v},{context:x},{scrollIntoView:f}])=>{const w=T(!1),b=K();let g=null;function m(j){$(i,{align:"end",behavior:j,index:"LAST"})}Q(C(ue(C(D(t),Ve(1)),a),G(D(w),l,c,v),z(([[j,O],d,y,S,B])=>{let H=O&&S,P="auto";return H&&(P=ur(d,y||B),H=H&&P!==!1),{followOutputBehavior:P,shouldFollow:H,totalCount:j}}),W(({shouldFollow:j})=>j)),({followOutputBehavior:j,totalCount:O})=>{g!==null&&(g(),g=null),se(o)!==void 0?requestAnimationFrame(()=>{se(h)("following output to ",{totalCount:O},he.DEBUG),m(j)}):g=je(e,()=>{se(h)("following output to ",{totalCount:O},he.DEBUG),m(j),g=null})});function p(j){const O=je(r,d=>{j&&!d.atBottom&&d.notAtBottomBecause==="SIZE_INCREASED"&&g===null&&(se(h)("scrolling to bottom due to increased size",{},he.DEBUG),m("auto"))});setTimeout(O,100)}Q(C(ue(D(w),t,u),W(([j,,O])=>j!==!1&&O),Ee(({value:j},[,O])=>({refreshed:j===O,value:O}),{refreshed:!1,value:0}),W(({refreshed:j})=>j),G(w,t)),([,j])=>{se(c)&&p(j!==!1)}),Q(b,()=>{p(se(w)!==!1)}),Q(ue(D(w),r),([j,O])=>{j!==!1&&!O.atBottom&&O.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&m("auto")});const k=T(null),E=K();return L(Wt(C(D(n),z(j=>(j==null?void 0:j.length)??0)),C(D(t))),E),Q(C(ue(C(E,Ve(1)),a),G(D(k),c,v,x),z(([[j,O],d,y,S,B])=>O&&y&&(d==null?void 0:d({context:B,totalCount:j,scrollingInProgress:S}))),W(j=>!!j),Be(0)),j=>{g!==null&&(g(),g=null),se(o)!==void 0?requestAnimationFrame(()=>{se(h)("scrolling into view",{}),$(f,j)}):g=je(e,()=>{se(h)("scrolling into view",{}),$(f,j),g=null})}),{autoscrollToBottom:b,followOutput:w,scrollIntoViewOnChange:k}},oe(He,mt,dt,pt,De,_e,ye,Jo,en)),pr=Y(([{data:e,firstItemIndex:t,gap:o,sizes:n},{initialTopMostItemIndex:r},{initialItemCount:l,listState:i},{didMount:c}])=>(L(C(c,G(l),W(([,a])=>a!==0),G(r,n,t,o,e),z(([[,a],u,h,v,x,f=[]])=>qo(a,u,h,v,x,f))),i),{}),oe(He,pt,Ge,De),{singleton:!0}),mr=Y(([{didMount:e},{scrollTo:t},{listState:o}])=>{const n=T(0);return Q(C(e,G(n),W(([,r])=>r!==0),z(([,r])=>({top:r}))),r=>{je(C(o,Ve(1),W(l=>l.items.length>1)),()=>{requestAnimationFrame(()=>{$(t,r)})})}),{initialScrollTop:n}},oe(De,ye,Ge),{singleton:!0}),tn=Y(([{scrollVelocity:e}])=>{const t=T(!1),o=K(),n=T(!1);return L(C(e,G(n,t,o),W(([r,l])=>l!==!1&&l!==void 0),z(([r,l,i,c])=>{const{enter:a,exit:u}=l;if(i){if(u(r,c))return!1}else if(a(r,c))return!0;return i}),te()),t),Q(C(ue(t,e,o),G(n)),([[r,l,i],c])=>{r&&c!==!1&&c!==void 0&&c.change&&c.change(l,i)}),{isSeeking:t,scrollSeekConfiguration:n,scrollSeekRangeChanged:o,scrollVelocity:e}},oe(mt),{singleton:!0}),eo=Y(([{scrollContainerState:e,scrollTo:t}])=>{const o=K(),n=K(),r=K(),l=T(!1),i=T(void 0);return L(C(ue(o,n),z(([{scrollTop:c,viewportHeight:a},{offsetTop:u,listHeight:h}])=>({scrollHeight:h,scrollTop:Math.max(0,c-u),viewportHeight:a}))),e),L(C(t,G(n),z(([c,{offsetTop:a}])=>({...c,top:c.top+a}))),r),{customScrollParent:i,useWindowScroll:l,windowScrollContainerState:o,windowScrollTo:r,windowViewportRect:n}},oe(ye)),hr=Y(([{sizeRanges:e,sizes:t},{headerHeight:o,scrollTop:n},{initialTopMostItemIndex:r},{didMount:l},{useWindowScroll:i,windowScrollContainerState:c,windowViewportRect:a}])=>{const u=K(),h=T(void 0),v=T(null),x=T(null);return L(c,v),L(a,x),Q(C(u,G(t,n,i,v,x,o)),([f,w,b,g,m,p,k])=>{const E=qn(w.sizeTree);g&&m!==null&&p!==null&&(b=m.scrollTop-p.offsetTop),b-=k,f({ranges:E,scrollTop:b})}),L(C(h,W(Ut),z(fr)),r),L(C(l,G(h),W(([,f])=>f!==void 0),te(),z(([,f])=>f.ranges)),e),{getState:u,restoreStateFrom:h}},oe(He,ye,pt,De,eo));function fr(e){return{align:"start",index:0,offset:e.scrollTop}}const xr=Y(([{topItemsIndexes:e}])=>{const t=T(0);return L(C(t,W(o=>o>=0),z(o=>Array.from({length:o}).map((n,r)=>r))),e),{topItemCount:t}},oe(Ge));function on(e){let t=!1,o;return(()=>(t||(t=!0,o=e()),o))}const gr=on(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),vr=Y(([{deviation:e,scrollBy:t,scrollingInProgress:o,scrollTop:n},{isAtBottom:r,isScrolling:l,lastJumpDueToItemResize:i,scrollDirection:c},{listState:a},{beforeUnshiftWith:u,gap:h,shiftWithOffset:v,sizes:x},{log:f},{recalcInProgress:w}])=>{const b=ke(C(a,G(i),Ee(([,m,p,k],[{bottom:E,items:j,offsetBottom:O,totalCount:d},y])=>{const S=E+O;let B=0;return p===d&&m.length>0&&j.length>0&&(j[0].originalIndex===0&&m[0].originalIndex===0||(B=S-k,B!==0&&(B+=y))),[B,j,d,S]},[0,[],0,0]),W(([m])=>m!==0),G(n,c,o,r,f,w),W(([,m,p,k,,,E])=>!E&&!k&&m!==0&&p===at),z(([[m],,,,,p])=>(p("Upward scrolling compensation",{amount:m},he.DEBUG),m))));function g(m){m>0?($(t,{behavior:"auto",top:-m}),$(e,0)):($(e,0),$(t,{behavior:"auto",top:-m}))}return Q(C(b,G(e,l)),([m,p,k])=>{k&&gr()?$(e,p-m):g(-m)}),Q(C(ue(ve(l,!1),e,w),W(([m,p,k])=>!m&&!k&&p!==0),z(([m,p])=>p),Be(1)),g),L(C(v,z(m=>({top:-m}))),t),Q(C(u,G(x,h),z(([m,{groupIndices:p,lastSize:k,sizeTree:E},j])=>{function O(H){return H*(k+j)}if(p.length===0)return O(m);let d=0;const y=st(E,0);let S=0,B=0;for(;S<m;){S++,d+=y;let H=p.length===B+1?1/0:p[B+1]-p[B]-1;S+H>m&&(d-=y,H=m-S+1),S+=H,d+=O(H),B++}return d})),m=>{$(e,m),requestAnimationFrame(()=>{$(t,{top:m}),requestAnimationFrame(()=>{$(e,0),$(w,!1)})})}),{deviation:e}},oe(ye,mt,Ge,He,_e,Xt)),br=Y(([e,t,o,n,r,l,i,c,a,u,h])=>({...e,...t,...o,...n,...r,...l,...i,...c,...a,...u,...h}),oe(Jt,pr,De,tn,Zo,mr,ar,eo,en,_e,Jo)),nn=Y(([{data:e,defaultItemSize:t,firstItemIndex:o,fixedItemSize:n,fixedGroupSize:r,gap:l,groupIndices:i,heightEstimates:c,itemSize:a,sizeRanges:u,sizes:h,statefulTotalCount:v,totalCount:x,trackItemSizes:f},{initialItemFinalLocationReached:w,initialTopMostItemIndex:b,scrolledToInitialItem:g},m,p,k,E,{scrollToIndex:j},O,{topItemCount:d},{groupCounts:y},S])=>{const{listState:B,minOverscanItemCount:H,topItemsIndexes:P,rangeChanged:V,...A}=E;return L(V,S.scrollSeekRangeChanged),L(C(S.windowViewportRect,z(U=>U.visibleHeight)),m.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:o,fixedItemHeight:n,fixedGroupHeight:r,gap:l,groupCounts:y,heightEstimates:c,initialItemFinalLocationReached:w,initialTopMostItemIndex:b,scrolledToInitialItem:g,sizeRanges:u,topItemCount:d,topItemsIndexes:P,totalCount:x,...k,groupIndices:i,itemSize:a,listState:B,minOverscanItemCount:H,scrollToIndex:j,statefulTotalCount:v,trackItemSizes:f,rangeChanged:V,...A,...S,...m,sizes:h,...p}},oe(He,pt,ye,hr,dr,Ge,dt,vr,xr,Yo,br));function yr(e,t){const o={},n={};let r=0;const l=e.length;for(;r<l;)n[e[r]]=1,r+=1;for(const i in t)Object.hasOwn(n,i)||(o[i]=t[i]);return o}const xt=typeof document<"u"?M.useLayoutEffect:M.useEffect;function rn(e,t,o){const n=Object.keys(t.required||{}),r=Object.keys(t.optional||{}),l=Object.keys(t.methods||{}),i=Object.keys(t.events||{}),c=M.createContext({});function a(g,m){g.propsReady!==void 0&&$(g.propsReady,!1);for(const p of n){const k=g[t.required[p]];$(k,m[p])}for(const p of r)if(p in m){const k=g[t.optional[p]];$(k,m[p])}g.propsReady!==void 0&&$(g.propsReady,!0)}function u(g){return l.reduce((m,p)=>(m[p]=k=>{const E=g[t.methods[p]];$(E,k)},m),{})}function h(g){return i.reduce((m,p)=>(m[p]=On(g[t.events[p]]),m),{})}const v=M.forwardRef(function(g,m){const{children:p,...k}=g,[E]=M.useState(()=>St(_n(e),d=>{a(d,k)})),[j]=M.useState(mo(h,E));xt(()=>{for(const d of i)d in k&&Q(j[d],k[d]);return()=>{Object.values(j).map(Kt)}},[k,j,E]),xt(()=>{a(E,k)}),M.useImperativeHandle(m,po(u(E)));const O=o;return s.jsx(c.Provider,{value:E,children:o!==void 0?s.jsx(O,{...yr([...n,...r,...i],k),children:p}):p})}),x=g=>{const m=M.useContext(c);return M.useCallback(p=>{$(m[g],p)},[m,g])},f=g=>{const m=M.useContext(c)[g],p=M.useCallback(k=>Q(m,k),[m]);return M.useSyncExternalStore(p,()=>se(m),()=>se(m))},w=g=>{const m=M.useContext(c)[g],[p,k]=M.useState(mo(se,m));return xt(()=>Q(m,E=>{E!==p&&k(po(E))}),[m,p]),p},b=M.version.startsWith("18")?f:w;return{Component:v,useEmitter:(g,m)=>{const p=M.useContext(c)[g];xt(()=>Q(p,m),[m,p])},useEmitterValue:b,usePublisher:x}}const sn=M.createContext(void 0),ln=M.createContext(void 0),Bt="-webkit-sticky",To="sticky",to=on(()=>{if(typeof document>"u")return To;const e=document.createElement("div");return e.style.position=Bt,e.style.position===Bt?Bt:To}),an=typeof document<"u"?M.useLayoutEffect:M.useEffect;function Mt(e){return"self"in e}function wr(e){return"body"in e}function cn(e,t,o,n=Ze,r,l){const i=M.useRef(null),c=M.useRef(null),a=M.useRef(null),u=M.useCallback(x=>{let f,w,b;const g=x.target;if(wr(g)||Mt(g)){const p=Mt(g)?g:g.defaultView;b=l===!0?p.scrollX:p.scrollY,f=l===!0?p.document.documentElement.scrollWidth:p.document.documentElement.scrollHeight,w=l===!0?p.innerWidth:p.innerHeight}else b=l===!0?g.scrollLeft:g.scrollTop,f=l===!0?g.scrollWidth:g.scrollHeight,w=l===!0?g.offsetWidth:g.offsetHeight;const m=()=>{e({scrollHeight:f,scrollTop:Math.max(b,0),viewportHeight:w})};x.suppressFlushSync===!0?m():gn.flushSync(m),c.current!==null&&(b===c.current||b<=0||b===f-w)&&(c.current=null,t(!0),a.current&&(clearTimeout(a.current),a.current=null))},[e,t,l]);M.useEffect(()=>{const x=r||i.current;return n(r||i.current),u({suppressFlushSync:!0,target:x}),x.addEventListener("scroll",u,{passive:!0}),()=>{n(null),x.removeEventListener("scroll",u)}},[i,u,o,n,r]);function h(x){const f=i.current;if(!f||(l===!0?"offsetWidth"in f&&f.offsetWidth===0:"offsetHeight"in f&&f.offsetHeight===0))return;const w=x.behavior==="smooth";let b,g,m;Mt(f)?(g=Math.max(Oe(f.document.documentElement,l===!0?"width":"height"),l===!0?f.document.documentElement.scrollWidth:f.document.documentElement.scrollHeight),b=l===!0?f.innerWidth:f.innerHeight,m=l===!0?window.scrollX:window.scrollY):(g=f[l===!0?"scrollWidth":"scrollHeight"],b=Oe(f,l===!0?"width":"height"),m=f[l===!0?"scrollLeft":"scrollTop"]);const p=g-b;if(x.top=Math.ceil(Math.max(Math.min(p,x.top),0)),Qo(b,g)||x.top===m){e({scrollHeight:g,scrollTop:m,viewportHeight:b}),w&&t(!0);return}w?(c.current=x.top,a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,c.current=null,t(!0)},1e3)):c.current=null,l===!0&&(x={...x.behavior!==void 0?{behavior:x.behavior}:{},left:x.top}),f.scrollTo(x)}function v(x){l===!0&&(x={...x.behavior!==void 0?{behavior:x.behavior}:{},...x.top!==void 0?{left:x.top}:{}}),i.current.scrollBy(x)}return{scrollByCallback:v,scrollerRef:i,scrollToCallback:h}}function oo(e){return e}const Cr=Y(()=>{const e=T(c=>`Item ${c}`),t=T(c=>`Group ${c}`),o=T({}),n=T(oo),r=T("div"),l=T(Ze),i=(c,a=null)=>ve(C(o,z(u=>u[c]),te()),a);return{components:o,computeItemKey:n,EmptyPlaceholder:i("EmptyPlaceholder"),FooterComponent:i("Footer"),GroupComponent:i("Group","div"),groupContent:t,HeaderComponent:i("Header"),HeaderFooterTag:r,ItemComponent:i("Item","div"),itemContent:e,ListComponent:i("List","div"),ScrollerComponent:i("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:i("ScrollSeekPlaceholder"),TopItemListComponent:i("TopItemList")}}),kr=Y(([e,t])=>({...e,...t}),oe(nn,Cr)),Tr=({height:e})=>s.jsx("div",{style:{height:e}}),Ir={overflowAnchor:"none",position:to(),zIndex:1},un={overflowAnchor:"none"},Sr={...un,display:"inline-block",height:"100%"},Io=M.memo(function({showTopList:e=!1}){const t=F("listState"),o=Te("sizeRanges"),n=F("useWindowScroll"),r=F("customScrollParent"),l=Te("windowScrollContainerState"),i=Te("scrollContainerState"),c=r||n?l:i,a=F("itemContent"),u=F("context"),h=F("groupContent"),v=F("trackItemSizes"),x=F("itemSize"),f=F("log"),w=Te("gap"),b=F("horizontalDirection"),{callbackRef:g}=Fn(o,x,v,e?Ze:c,f,w,r,b,F("skipAnimationFrameInResizeObserver")),[m,p]=M.useState(0);no("deviation",A=>{m!==A&&p(A)});const k=F("EmptyPlaceholder"),E=F("ScrollSeekPlaceholder")??Tr,j=F("ListComponent"),O=F("ItemComponent"),d=F("GroupComponent"),y=F("computeItemKey"),S=F("isSeeking"),B=F("groupIndices").length>0,H=F("alignToBottom"),P=F("initialItemFinalLocationReached"),V=e?{}:{boxSizing:"border-box",...b?{display:"inline-block",height:"100%",marginLeft:m!==0?m:H?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:m!==0?m:H?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...P?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&k!==null&&k!==void 0?s.jsx(k,{...ge(k,u)}):s.jsx(j,{...ge(j,u),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:g,style:V,children:(e?t.topItems:t.items).map(A=>{const U=A.originalIndex,I=y(U+t.firstItemIndex,A.data,u);return S?N.createElement(E,{...ge(E,u),height:A.size,index:A.index,key:I,type:A.type||"item",...A.type==="group"?{}:{groupIndex:A.groupIndex}}):A.type==="group"?N.createElement(d,{...ge(d,u),"data-index":U,"data-item-index":A.index,"data-known-size":A.size,key:I,style:Ir},h(A.index,u)):N.createElement(O,{...ge(O,u),...zr(O,A.data),"data-index":U,"data-item-group-index":A.groupIndex,"data-item-index":A.index,"data-known-size":A.size,key:I,style:b?Sr:un},B?a(A.index,A.groupIndex,A.data,u):a(A.index,A.data,u))})})}),jr={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Rr={outline:"none",overflowX:"auto",position:"relative"},Rt=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:void 0}),Nr={position:to(),top:0,width:"100%",zIndex:1};function ge(e,t){if(typeof e!="string")return{context:t}}function zr(e,t){return{item:typeof e=="string"?void 0:t}}const Er=M.memo(function(){const e=F("HeaderComponent"),t=Te("headerHeight"),o=F("HeaderFooterTag"),n=$e(M.useMemo(()=>l=>{t(Oe(l,"height"))},[t]),!0,F("skipAnimationFrameInResizeObserver")),r=F("context");return e!=null?s.jsx(o,{ref:n,children:s.jsx(e,{...ge(e,r)})}):null}),Hr=M.memo(function(){const e=F("FooterComponent"),t=Te("footerHeight"),o=F("HeaderFooterTag"),n=$e(M.useMemo(()=>l=>{t(Oe(l,"height"))},[t]),!0,F("skipAnimationFrameInResizeObserver")),r=F("context");return e!=null?s.jsx(o,{ref:n,children:s.jsx(e,{...ge(e,r)})}):null});function dn({useEmitter:e,useEmitterValue:t,usePublisher:o}){return M.memo(function({children:n,style:r,context:l,...i}){const c=o("scrollContainerState"),a=t("ScrollerComponent"),u=o("smoothScrollTargetReached"),h=t("scrollerRef"),v=t("horizontalDirection")||!1,{scrollByCallback:x,scrollerRef:f,scrollToCallback:w}=cn(c,u,a,h,void 0,v);return e("scrollTo",w),e("scrollBy",x),s.jsx(a,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:f,style:{...v?Rr:jr,...r},tabIndex:0,...i,...ge(a,l),children:n})})}function pn({useEmitter:e,useEmitterValue:t,usePublisher:o}){return M.memo(function({children:n,style:r,context:l,...i}){const c=o("windowScrollContainerState"),a=t("ScrollerComponent"),u=o("smoothScrollTargetReached"),h=t("totalListHeight"),v=t("deviation"),x=t("customScrollParent"),f=M.useRef(null),w=t("scrollerRef"),{scrollByCallback:b,scrollerRef:g,scrollToCallback:m}=cn(c,u,a,w,x);return an(()=>{var p;return g.current=x||((p=f.current)==null?void 0:p.ownerDocument.defaultView),()=>{g.current=null}},[g,x]),e("windowScrollTo",m),e("scrollBy",b),s.jsx(a,{ref:f,"data-virtuoso-scroller":!0,style:{position:"relative",...r,...h!==0?{height:h+v}:void 0},...i,...ge(a,l),children:n})})}const Br=({children:e})=>{const t=M.useContext(sn),o=Te("viewportHeight"),n=Te("fixedItemHeight"),r=F("alignToBottom"),l=F("horizontalDirection"),i=M.useMemo(()=>Oo(o,a=>Oe(a,l?"width":"height")),[o,l]),c=$e(i,!0,F("skipAnimationFrameInResizeObserver"));return M.useEffect(()=>{t&&(o(t.viewportHeight),n(t.itemHeight))},[t,o,n]),s.jsx("div",{"data-viewport-type":"element",ref:c,style:Rt(r),children:e})},Mr=({children:e})=>{const t=M.useContext(sn),o=Te("windowViewportRect"),n=Te("fixedItemHeight"),r=F("customScrollParent"),l=_o(o,r,F("skipAnimationFrameInResizeObserver")),i=F("alignToBottom");return M.useEffect(()=>{t&&(n(t.itemHeight),o({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,o,n]),s.jsx("div",{"data-viewport-type":"window",ref:l,style:Rt(i),children:e})},Lr=({children:e})=>{const t=F("TopItemListComponent")??"div",o=F("headerHeight"),n={...Nr,marginTop:`${o}px`},r=F("context");return s.jsx(t,{style:n,...ge(t,r),children:e})},Or=M.memo(function(e){const t=F("useWindowScroll"),o=F("topItemsIndexes").length>0,n=F("customScrollParent"),r=F("context");return s.jsxs(n||t?Dr:_r,{...e,context:r,children:[o&&s.jsx(Lr,{children:s.jsx(Io,{showTopList:!0})}),s.jsxs(n||t?Mr:Br,{children:[s.jsx(Er,{}),s.jsx(Io,{}),s.jsx(Hr,{})]})]})}),{Component:Ar,useEmitter:no,useEmitterValue:F,usePublisher:Te}=rn(kr,{optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Or),_r=dn({useEmitter:no,useEmitterValue:F,usePublisher:Te}),Dr=pn({useEmitter:no,useEmitterValue:F,usePublisher:Te}),Wr=Ar,Fr=Y(()=>{const e=T(u=>s.jsxs("td",{children:["Item $",u]})),t=T(null),o=T(u=>s.jsxs("td",{colSpan:1e3,children:["Group ",u]})),n=T(null),r=T(null),l=T({}),i=T(oo),c=T(Ze),a=(u,h=null)=>ve(C(l,z(v=>v[u]),te()),h);return{components:l,computeItemKey:i,context:t,EmptyPlaceholder:a("EmptyPlaceholder"),FillerRow:a("FillerRow"),fixedFooterContent:r,fixedHeaderContent:n,itemContent:e,groupContent:o,ScrollerComponent:a("Scroller","div"),scrollerRef:c,ScrollSeekPlaceholder:a("ScrollSeekPlaceholder"),TableBodyComponent:a("TableBody","tbody"),TableComponent:a("Table","table"),TableFooterComponent:a("TableFoot","tfoot"),TableHeadComponent:a("TableHead","thead"),TableRowComponent:a("TableRow","tr"),GroupComponent:a("Group","tr")}});oe(nn,Fr);to();const So={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},Pr={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:jo,floor:Tt,max:nt,min:Lt,round:Ro}=Math;function No(e,t,o){return Array.from({length:t-e+1}).map((n,r)=>({data:o===null?null:o[r+e],index:r+e}))}function Vr(e){return{...Pr,items:e}}function gt(e,t){return e!==void 0&&e.width===t.width&&e.height===t.height}function $r(e,t){return e!==void 0&&e.column===t.column&&e.row===t.row}const Gr=Y(([{increaseViewportBy:e,listBoundary:t,overscan:o,visibleRange:n},{footerHeight:r,headerHeight:l,scrollBy:i,scrollContainerState:c,scrollTo:a,scrollTop:u,smoothScrollTargetReached:h,viewportHeight:v},x,f,{didMount:w,propsReady:b},{customScrollParent:g,useWindowScroll:m,windowScrollContainerState:p,windowScrollTo:k,windowViewportRect:E},j])=>{const O=T(0),d=T(0),y=T(So),S=T({height:0,width:0}),B=T({height:0,width:0}),H=K(),P=K(),V=T(0),A=T(null),U=T({column:0,row:0}),I=K(),_=K(),J=T(!1),fe=T(0),ie=T(!0),we=T(!1),Me=T(!1);Q(C(w,G(fe),W(([R,X])=>X!==0)),()=>{$(ie,!1)}),Q(C(ue(w,ie,B,S,fe,we),W(([R,X,de,ee,,ne])=>R&&!X&&de.height!==0&&ee.height!==0&&!ne)),([,,,,R])=>{$(we,!0),qt(1,()=>{$(H,R)}),je(C(u),()=>{$(t,[0,0]),$(ie,!0)})}),L(C(_,W(R=>R!=null&&R.scrollTop>0),ze(0)),d),Q(C(w,G(_),W(([,R])=>R!=null)),([,R])=>{R&&($(S,R.viewport),$(B,R.item),$(U,R.gap),R.scrollTop>0&&($(J,!0),je(C(u,Ve(1)),X=>{$(J,!1)}),$(a,{top:R.scrollTop})))}),L(C(S,z(({height:R})=>R)),v),L(C(ue(D(S,gt),D(B,gt),D(U,(R,X)=>R!==void 0&&R.column===X.column&&R.row===X.row),D(u)),z(([R,X,de,ee])=>({gap:de,item:X,scrollTop:ee,viewport:R}))),I),L(C(ue(D(O),n,D(U,$r),D(B,gt),D(S,gt),D(A),D(d),D(J),D(ie),D(fe)),W(([,,,,,,,R])=>!R),z(([R,[X,de],ee,ne,pe,ae,Z,,le,be])=>{const{column:ce,row:tt}=ee,{height:ht,width:Nt}=ne,{width:ro}=pe;if(Z===0&&(R===0||ro===0))return So;if(Nt===0){const co=Zt(be,R),xn=co+Math.max(Z-1,0);return Vr(No(co,xn,ae))}const ft=mn(ro,Nt,ce);let Ke,We;le?X===0&&de===0&&Z>0?(Ke=0,We=Z-1):(Ke=ft*Tt((X+tt)/(ht+tt)),We=ft*jo((de+tt)/(ht+tt))-1,We=Lt(R-1,nt(We,ft-1)),Ke=Lt(We,nt(0,Ke))):(Ke=0,We=-1);const so=No(Ke,We,ae),{bottom:lo,top:io}=zo(pe,ee,ne,so),ao=jo(R/ft),fn=ao*ht+(ao-1)*tt-lo;return{bottom:lo,itemHeight:ht,items:so,itemWidth:Nt,offsetBottom:fn,offsetTop:io,top:io}})),y),L(C(A,W(R=>R!==null),z(R=>R.length)),O),L(C(ue(S,B,y,U),W(([R,X,{items:de}])=>de.length>0&&X.height!==0&&R.height!==0),z(([R,X,{items:de},ee])=>{const{bottom:ne,top:pe}=zo(R,ee,X,de);return[pe,ne]}),te(lt)),t);const xe=T(!1);L(C(u,G(xe),z(([R,X])=>X||R!==0)),xe);const Ue=ke(C(ue(y,O),W(([{items:R}])=>R.length>0),G(xe),W(([[R,X],de])=>{const ee=R.items[R.items.length-1].index===X-1;return(de||R.bottom>0&&R.itemHeight>0&&R.offsetBottom===0&&R.items.length===X)&&ee}),z(([[,R]])=>R-1),te())),Je=ke(C(D(y),W(({items:R})=>R.length>0&&R[0].index===0),ze(0),te())),Ne=ke(C(D(y),G(J),W(([{items:R},X])=>R.length>0&&!X),z(([{items:R}])=>({endIndex:R[R.length-1].index,startIndex:R[0].index})),te($o),Be(0)));L(Ne,f.scrollSeekRangeChanged),L(C(H,G(S,B,O,U),z(([R,X,de,ee,ne])=>{const pe=Xo(R),{align:ae,behavior:Z,offset:le}=pe;let be=pe.index;be==="LAST"&&(be=ee-1),be=nt(0,be,Lt(ee-1,be));let ce=Gt(X,ne,de,be);return ae==="end"?ce=Ro(ce-X.height+de.height):ae==="center"&&(ce=Ro(ce-X.height/2+de.height/2)),le!==void 0&&le!==0&&(ce+=le),{behavior:Z,top:ce}})),a);const et=ve(C(y,z(R=>R.offsetBottom+R.bottom)),0);return L(C(E,z(R=>({height:R.visibleHeight,width:R.visibleWidth}))),S),{customScrollParent:g,data:A,deviation:V,footerHeight:r,gap:U,headerHeight:l,increaseViewportBy:e,initialItemCount:d,itemDimensions:B,overscan:o,restoreStateFrom:_,scrollBy:i,scrollContainerState:c,scrollHeight:P,scrollTo:a,scrollToIndex:H,scrollTop:u,smoothScrollTargetReached:h,totalCount:O,useWindowScroll:m,viewportDimensions:S,windowScrollContainerState:p,windowScrollTo:k,windowViewportRect:E,...f,gridState:y,horizontalDirection:Me,initialTopMostItemIndex:fe,totalListHeight:et,...x,endReached:Ue,propsReady:b,rangeChanged:Ne,startReached:Je,stateChanged:I,stateRestoreInProgress:J,...j}},oe(Jt,ye,mt,tn,De,eo,_e));function mn(e,t,o){return nt(1,Tt((e+o)/(Tt(t)+o)))}function zo(e,t,o,n){const{height:r}=o;if(r===void 0||n.length===0)return{bottom:0,top:0};const l=Gt(e,t,o,n[0].index);return{bottom:Gt(e,t,o,n[n.length-1].index)+r,top:l}}function Gt(e,t,o,n){const r=mn(e.width,o.width,t.column),l=Tt(n/r),i=l*o.height+nt(0,l-1)*t.row;return i>0?i+t.row:i}const Ur=Y(()=>{const e=T(v=>`Item ${v}`),t=T({}),o=T(null),n=T("virtuoso-grid-item"),r=T("virtuoso-grid-list"),l=T(oo),i=T("div"),c=T(Ze),a=(v,x=null)=>ve(C(t,z(f=>f[v]),te()),x),u=T(!1),h=T(!1);return L(D(h),u),{components:t,computeItemKey:l,context:o,FooterComponent:a("Footer"),HeaderComponent:a("Header"),headerFooterTag:i,itemClassName:n,ItemComponent:a("Item","div"),itemContent:e,listClassName:r,ListComponent:a("List","div"),readyStateChanged:u,reportReadyState:h,ScrollerComponent:a("Scroller","div"),scrollerRef:c,ScrollSeekPlaceholder:a("ScrollSeekPlaceholder","div")}}),Kr=Y(([e,t])=>({...e,...t}),oe(Gr,Ur)),Yr=M.memo(function(){const e=re("gridState"),t=re("listClassName"),o=re("itemClassName"),n=re("itemContent"),r=re("computeItemKey"),l=re("isSeeking"),i=Ie("scrollHeight"),c=re("ItemComponent"),a=re("ListComponent"),u=re("ScrollSeekPlaceholder"),h=re("context"),v=Ie("itemDimensions"),x=Ie("gap"),f=re("log"),w=re("stateRestoreInProgress"),b=Ie("reportReadyState"),g=$e(M.useMemo(()=>m=>{const p=m.parentElement.parentElement.scrollHeight;i(p);const k=m.firstChild;if(k!==null){const{height:E,width:j}=k.getBoundingClientRect();v({height:E,width:j})}x({column:Eo("column-gap",getComputedStyle(m).columnGap,f),row:Eo("row-gap",getComputedStyle(m).rowGap,f)})},[i,v,x,f]),!0,!1);return an(()=>{e.itemHeight>0&&e.itemWidth>0&&b(!0)},[e]),w?null:s.jsx(a,{className:t,ref:g,...ge(a,h),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(m=>{const p=r(m.index,m.data,h);return l?s.jsx(u,{...ge(u,h),height:e.itemHeight,index:m.index,width:e.itemWidth},p):N.createElement(c,{...ge(c,h),className:o,"data-index":m.index,key:p},n(m.index,m.data,h))})})}),Xr=M.memo(function(){const e=re("HeaderComponent"),t=Ie("headerHeight"),o=re("headerFooterTag"),n=$e(M.useMemo(()=>l=>{t(Oe(l,"height"))},[t]),!0,!1),r=re("context");return e!=null?s.jsx(o,{ref:n,children:s.jsx(e,{...ge(e,r)})}):null}),Qr=M.memo(function(){const e=re("FooterComponent"),t=Ie("footerHeight"),o=re("headerFooterTag"),n=$e(M.useMemo(()=>l=>{t(Oe(l,"height"))},[t]),!0,!1),r=re("context");return e!=null?s.jsx(o,{ref:n,children:s.jsx(e,{...ge(e,r)})}):null}),qr=({children:e})=>{const t=M.useContext(ln),o=Ie("itemDimensions"),n=Ie("viewportDimensions"),r=$e(M.useMemo(()=>l=>{n(l.getBoundingClientRect())},[n]),!0,!1);return M.useEffect(()=>{t&&(n({height:t.viewportHeight,width:t.viewportWidth}),o({height:t.itemHeight,width:t.itemWidth}))},[t,n,o]),s.jsx("div",{ref:r,style:Rt(!1),children:e})},Zr=({children:e})=>{const t=M.useContext(ln),o=Ie("windowViewportRect"),n=Ie("itemDimensions"),r=re("customScrollParent"),l=_o(o,r,!1);return M.useEffect(()=>{t&&(n({height:t.itemHeight,width:t.itemWidth}),o({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,o,n]),s.jsx("div",{ref:l,style:Rt(!1),children:e})},Jr=M.memo(function({...e}){const t=re("useWindowScroll"),o=re("customScrollParent"),n=o||t?ts:es,r=o||t?Zr:qr,l=re("context");return s.jsx(n,{...e,...ge(n,l),children:s.jsxs(r,{children:[s.jsx(Xr,{}),s.jsx(Yr,{}),s.jsx(Qr,{})]})})}),{useEmitter:hn,useEmitterValue:re,usePublisher:Ie}=rn(Kr,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},Jr),es=dn({useEmitter:hn,useEmitterValue:re,usePublisher:Ie}),ts=pn({useEmitter:hn,useEmitterValue:re,usePublisher:Ie});function Eo(e,t,o){return t!=="normal"&&(t==null?void 0:t.endsWith("px"))!==!0&&o(`${e} was not resolved to pixel value correctly`,t,he.WARN),t==="normal"?0:parseInt(t??"0",10)}const os=150;function ns({entries:e,itemCount:t}){const o=N.useRef(null),[n,r]=N.useState(!1),l=N.useRef(!1),i=N.useRef(0),c=N.useRef(e.length),a=N.useRef(0),u=N.useCallback((f="smooth")=>{o.current&&(a.current=Date.now(),o.current.scrollToIndex({index:t-1,behavior:f,align:"end"}))},[t]),h=N.useCallback(f=>l.current||!f?!1:"auto",[]),v=N.useCallback(f=>{r(!f),f&&(l.current=!1)},[]),x=N.useCallback(f=>{const b=f.target.scrollTop;if(Date.now()-a.current<os){i.current=b;return}b-i.current<-10&&(l.current=!0),i.current=b},[]);return N.useEffect(()=>{const f=e.length,w=c.current,b=f>w;if(c.current=f,!b)return;const g=e[e.length-1];(g==null?void 0:g.type)==="user_message"&&(l.current=!1,requestAnimationFrame(()=>{requestAnimationFrame(()=>{o.current&&(a.current=Date.now(),o.current.scrollToIndex({index:"LAST",behavior:"auto",align:"end"}))})}))},[e]),{virtuosoRef:o,handleScroll:x,handleAtBottomStateChange:v,handleFollowOutput:h,showScrollButton:n,scrollToBottom:u}}/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1,8 @@
1
+ import{d as ae,r as c,j as e,k as M,s as W,q as re,t as oe,v as se,X as B,F as ce,w as q,m as ie,M as de}from"./index-nufWop4p.js";import{S as ue}from"./search-Bq3ygFUW.js";import{G as pe}from"./git-branch-SqFf4Ru5.js";import{Z as xe}from"./zap-9DVkGVtt.js";import{M as H,C as A,L as fe}from"./ChatInput-CL8YDfOU.js";import{T as ge,a as ye}from"./TreeBrowser-g_QUKemL.js";import"./MarkdownRenderer-BjZ43aSa.js";import"./wrench-B84-zdLI.js";import"./chevron-right-CYbpR4ev.js";import"./circle-alert-BqcYuT7x.js";import"./folder-CqXeSKeC.js";/**
2
+ * @license lucide-react v0.577.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const he=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],ve=ae("columns-2",he),L=(t,r)=>(window.addEventListener(t,r),()=>window.removeEventListener(t,r)),me=(...t)=>()=>{const r=t.slice();for(;r.length;)r.pop()()};function be(t,r,o,n){if(!t)return r;try{const s=localStorage.getItem(t);if(s){const a=parseFloat(s);if(!isNaN(a)&&a>=o&&a<=n)return a}}catch{}return r}function je(t={}){const{defaultRatio:r=50,minRatio:o=25,maxRatio:n=75,storageKey:s}=t,[a,d]=c.useState(()=>be(s,r,o,n)),f=c.useCallback(u=>{if(d(u),s)try{localStorage.setItem(s,u.toString())}catch{}},[s]),l=c.useCallback((u=!1)=>i=>{if(i.pointerType!=="touch"&&i.button!==0)return;i.preventDefault();const v=i.currentTarget,N=v.parentElement,w=N==null?void 0:N.parentElement,T=(w==null?void 0:w.offsetWidth)||0;if(!T)return;const b=i.clientX,j=a,k=i.pointerId;let h=null,C=null,E=j,S=!0,I=null;const D=()=>{C!==null&&(E=C,d(C))},z=()=>{const y=document.body.style.userSelect;return document.body.style.userSelect="none",document.body.style.cursor="col-resize",()=>{document.body.style.userSelect=y,document.body.style.cursor="",h!==null&&(cancelAnimationFrame(h),h=null)}},R=y=>{if(!S)return;S=!1,h!==null&&(cancelAnimationFrame(h),h=null),D();let P=E;if(y&&"clientX"in y&&typeof y.clientX=="number"){const le=(u?b-y.clientX:y.clientX-b)/T*100;P=Math.max(o,Math.min(n,j+le))}f(P),I==null||I()},X=y=>{if(!S)return;if(y.buttons===0){R(y);return}const U=(u?b-y.clientX:y.clientX-b)/T*100;C=Math.max(o,Math.min(n,j+U)),h===null&&(h=requestAnimationFrame(()=>{h=null,D()}))},$=()=>R(),F=y=>R(y),O=y=>R(y),g=y=>R(y);if(v.setPointerCapture)try{v.setPointerCapture(k),v.addEventListener("lostpointercapture",$)}catch{}const p=()=>{var y;v.releasePointerCapture&&((y=v.hasPointerCapture)!=null&&y.call(v,k))&&v.releasePointerCapture(k),v.removeEventListener("lostpointercapture",$)};I=me(z(),p,L("pointermove",X),L("pointerup",F),L("pointercancel",O),L("mouseup",g),L("blur",()=>R()))},[a,o,n,f]),x=c.useCallback((u={})=>{const{className:i="",style:v,reverse:N,linePlacement:w,lineClassName:T="",lineStyle:b}=u,j=w?w==="start"?"justify-start":"justify-end":N?"justify-start":"justify-end";return e.jsx("div",{className:`group absolute top-0 bottom-0 z-20 cursor-col-resize flex items-center ${j} ${i}`,style:{width:"12px",...v},onPointerDown:l(N),onDoubleClick:()=>f(r),children:e.jsx("span",{className:`pointer-events-none block h-full rounded-full transition-all duration-150 w-[2px] opacity-60 group-hover:w-[5px] group-hover:opacity-100 group-active:w-[5px] group-active:opacity-100 ${T}`,style:{backgroundColor:"var(--color-border)",...b}})})},[l,f,r]),m=x({className:"right-0"});return{ratio:a,setRatio:f,dragHandle:m,createDragHandle:x}}function ke(t){const r=M(n=>n.pendingApprovals),o=c.useMemo(()=>t?Object.values(r).find(n=>n.processId===t)??null:null,[t,r]);c.useEffect(()=>{if(!o)return;function n(s){const a=s.target;if(a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.isContentEditable)return;const d=s.key;if(d==="y"||d==="Y"){s.preventDefault(),W({action:"approve",processId:o.processId,requestId:o.id,allow:!0});return}if(d==="Escape"){s.preventDefault(),W({action:"approve",processId:o.processId,requestId:o.id,allow:!1});return}if(d==="a"||d==="A"){s.preventDefault(),W({action:"approve",processId:o.processId,requestId:o.id,allow:!0});return}}return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[o])}function we(){const[t,r]=c.useState([]),[o,n]=c.useState(!0),s=c.useCallback(async()=>{n(!0);try{const a=await fetch("/api/workspace?tree=true");a.ok&&r(await a.json())}catch{}finally{n(!1)}},[]);return c.useEffect(()=>{s()},[s]),{tree:t,loading:o,refreshTree:s}}function Y(t){if(t<60)return`${t}s`;const r=Math.floor(t/60),o=t%60;return`${r}m ${o}s`}function G({processId:t}){const r=M(l=>t?l.processThoughts[t]:void 0),o=M(l=>t?l.processStreaming[t]??!1:!1),[n,s]=c.useState(0),a=c.useRef(Date.now());if(c.useEffect(()=>{if(!o&&!(r!=null&&r.subject)){s(0);return}a.current=Date.now(),s(0);const l=setInterval(()=>{s(Math.floor((Date.now()-a.current)/1e3))},1e3);return()=>clearInterval(l)},[o,r==null?void 0:r.subject]),!o&&!(r!=null&&r.subject))return null;const d=()=>{t&&W({action:"stop",processId:t})};if(o&&!(r!=null&&r.subject))return e.jsx("div",{style:K,children:e.jsxs("div",{style:V,children:[e.jsx(Q,{}),e.jsxs("span",{style:{color:"var(--color-text-secondary)",fontSize:12},children:["Processing...",e.jsxs("span",{style:{marginLeft:6,opacity:.6},children:["(",Y(n),")"]})]}),e.jsx(Z,{onClick:d})]})});const f=r&&r.description&&r.description!==r.subject;return e.jsx("div",{style:K,children:e.jsxs("div",{style:V,children:[o&&e.jsx(Q,{}),(r==null?void 0:r.subject)&&e.jsx("span",{style:Ce,children:r.subject}),f&&e.jsx("span",{style:{flex:1,fontSize:12,color:"var(--color-text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.description}),o&&e.jsxs("span",{style:{fontSize:11,color:"var(--color-text-tertiary)",whiteSpace:"nowrap"},children:["(",Y(n),")"]}),o&&e.jsx(Z,{onClick:d})]})})}const K={background:"linear-gradient(135deg, var(--color-bg-card) 0%, var(--color-bg-primary) 100%)",borderRadius:10,padding:"8px 12px",margin:"0 16px 4px 16px",border:"1px solid var(--color-border-divider)"},V={display:"flex",alignItems:"center",gap:8},Ce={display:"inline-block",fontSize:11,fontWeight:600,padding:"2px 8px",borderRadius:6,backgroundColor:"var(--color-tint-exploring)",color:"var(--color-accent-blue)",whiteSpace:"nowrap"};function Q(){return e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-accent-blue)",strokeWidth:"2.5",strokeLinecap:"round",style:{animation:"spin 1s linear infinite",flexShrink:0},children:[e.jsx("path",{d:"M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"}),e.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"})]})}function Z({onClick:t}){return e.jsx("button",{type:"button",onClick:t,style:{marginLeft:"auto",display:"flex",alignItems:"center",justifyContent:"center",width:22,height:22,borderRadius:6,border:"1px solid var(--color-border)",backgroundColor:"var(--color-bg-card)",cursor:"pointer",color:"var(--color-text-tertiary)",flexShrink:0,padding:0,transition:"all 150ms"},onMouseEnter:r=>{const o=r.currentTarget;o.style.borderColor="var(--color-accent-red)",o.style.backgroundColor="var(--color-tint-blocked)",o.style.color="var(--color-accent-red)"},onMouseLeave:r=>{const o=r.currentTarget;o.style.borderColor="var(--color-border)",o.style.backgroundColor="var(--color-bg-card)",o.style.color="var(--color-text-tertiary)"},"aria-label":"Stop process",children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"})})})}function Se(t){try{return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}function Ne(t){try{return new Date(t).toLocaleDateString([],{month:"short",day:"numeric"})}catch{return""}}function J(t){return t.asyncDelegate===!0}function Te(t,r){const o=[];for(const n of r)n.status!=="dispatched"&&(o.push({id:`${n.messageId}:user`,processId:t,timestamp:n.createdAt,type:"user_message",content:n.message}),n.status==="dropped"&&o.push({id:`${n.messageId}:error`,processId:t,timestamp:n.dispatchedAt??n.createdAt,type:"error",message:n.dispatchReason?`Follow-up dropped: ${n.dispatchReason}`:"Follow-up dropped"}));return o}function Me(t){return t.delegateStatus==="cancelling"?{label:"Cancelling",bg:"var(--color-tint-planning)",fg:"var(--color-accent-orange)"}:t.cancelledAt||t.delegateStatus==="cancelled"?{label:"Cancelled",bg:"var(--color-bg-hover)",fg:"var(--color-text-secondary)"}:t.exitCode!==void 0?{label:t.exitCode===0?"OK":`Exit ${t.exitCode}`,bg:t.exitCode===0?"var(--color-tint-exploring)":"var(--color-tint-blocked)",fg:t.exitCode===0?"var(--color-accent-green)":"var(--color-accent-red)"}:t.delegateStatus?{label:t.delegateStatus,bg:"var(--color-tint-exploring)",fg:"var(--color-accent-blue)"}:null}function Ie({open:t}){const[r,o]=c.useState([]),[n,s]=c.useState("async"),a=M(l=>l.processes);c.useEffect(()=>{t&&fetch("/api/cli-history?limit=20").then(l=>l.ok?l.json():[]).then(l=>o(l)).catch(()=>{})},[t]);const d=c.useMemo(()=>new Set(Object.keys(a)),[a]),f=c.useMemo(()=>{const l=r.filter(x=>!d.has(x.execId)&&!d.has(`cli-history-${x.execId}`));switch(n){case"async":return l.filter(J);case"other":return l.filter(x=>!J(x));default:return l}},[r,d,n]);return e.jsxs("div",{className:"absolute right-0 top-0 bottom-0 z-40 overflow-y-auto flex flex-col",style:{width:280,backgroundColor:"var(--color-bg-secondary)",borderLeft:"1px solid var(--color-border)",boxShadow:t?"-4px 0 16px rgba(0,0,0,0.06)":"none",transform:t?"translateX(0)":"translateX(100%)",opacity:t?1:0,transition:"transform 200ms cubic-bezier(0.34,1.56,0.64,1), opacity 180ms ease",pointerEvents:t?"auto":"none"},children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 border-b shrink-0",style:{borderColor:"var(--color-border-divider)"},children:[e.jsx(re,{size:14,strokeWidth:1.8,style:{color:"var(--color-text-tertiary)"}}),e.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--color-text-primary)"},children:"History"})]}),e.jsx("div",{className:"flex gap-1 px-2 py-2 border-b shrink-0",style:{borderColor:"var(--color-border-divider)"},children:[["async","Async"],["all","All"],["other","Other CLI"]].map(([l,x])=>e.jsx("button",{type:"button",onClick:()=>s(l),className:"px-2 py-1 rounded-md text-[11px] border-none cursor-pointer transition-colors duration-150",style:{backgroundColor:n===l?"var(--color-bg-active)":"transparent",color:n===l?"var(--color-text-primary)":"var(--color-text-tertiary)"},children:x},l))}),e.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:f.length===0?e.jsx("div",{className:"px-3 py-4 text-center text-[12px]",style:{color:"var(--color-text-tertiary)"},children:"No history entries"}):f.map(l=>e.jsx(Re,{meta:l,onRemove:x=>o(m=>m.filter(u=>u.execId!==x))},l.execId))})]})}function Re({meta:t,onRemove:r}){const{addProcess:o,addEntry:n,setActiveProcessId:s}=M.getState(),a=t.tool==="claude"?"claude-code":t.tool,d=se[a]??"var(--color-text-tertiary)",f=oe[a]??t.tool,l=async()=>{const i=`cli-history-${t.execId}`;if(M.getState().processes[i]){s(i);return}const v={id:i,type:a,status:t.delegateStatus==="cancelling"?"stopping":t.delegateStatus==="queued"?"spawning":t.delegateStatus==="running"?"running":"stopped",config:{type:a,prompt:t.prompt,workDir:t.workDir},startedAt:t.startedAt,interactive:t.asyncDelegate===!0};o(v),s(i);try{const[N,w]=await Promise.all([fetch(`/api/cli-history/${encodeURIComponent(t.execId)}/entries`),t.asyncDelegate?fetch(`/api/cli-history/${encodeURIComponent(t.execId)}/messages`):Promise.resolve(null)]);if(N.ok){const T=await N.json(),b=[];for(const j of T){const k={...j,processId:i};if(k.type==="assistant_message"){k.partial=!1;const h=b[b.length-1];if(h&&h.type==="assistant_message"){h.content+=k.content;continue}}if(k.type==="tool_use"&&(k.status==="completed"||k.status==="failed")){const h=b.findLastIndex(C=>C.type==="tool_use"&&C.status==="running");if(h!==-1){const C=b[h];b[h]={...C,status:k.status,result:k.result??C.result,input:C.input&&Object.keys(C.input).length>0?C.input:k.input};continue}}b.push(k)}for(const j of b)n(i,j)}if(w!=null&&w.ok){const T=await w.json();for(const b of Te(i,T))n(i,b)}}catch{}},x=i=>{i.stopPropagation();const v=`cli-history-${t.execId}`;M.getState().dismissProcess(v),r(t.execId)},m=Me(t),u=m?e.jsx("span",{className:"text-[10px] font-medium px-[5px] py-[1px] rounded",style:{backgroundColor:m.bg,color:m.fg},children:m.label}):null;return e.jsxs("div",{className:"group relative",children:[e.jsxs("button",{type:"button",onClick:l,className:"w-full text-left px-3 py-[10px] rounded-lg border-none bg-transparent cursor-pointer transition-colors duration-150",style:{color:"var(--color-text-secondary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--color-bg-hover)"},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent"},children:[e.jsxs("div",{className:"flex items-center gap-[6px] mb-[4px]",children:[e.jsx("span",{className:"w-[7px] h-[7px] rounded-full shrink-0",style:{backgroundColor:d}}),e.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--color-text-primary)"},children:f}),t.asyncDelegate&&e.jsx("span",{className:"text-[9px] font-semibold px-[4px] py-[1px] rounded",style:{backgroundColor:"var(--color-tint-exploring)",color:"var(--color-accent-blue)"},children:"ASYNC"}),u]}),e.jsxs("div",{className:"text-[11px] truncate mb-[4px]",style:{color:"var(--color-text-tertiary)"},children:[t.prompt.slice(0,60),t.prompt.length>60?"...":""]}),e.jsxs("div",{className:"flex items-center gap-2 text-[10px]",style:{color:"var(--color-text-placeholder)"},children:[e.jsx("span",{children:Ne(t.startedAt)}),e.jsx("span",{children:Se(t.startedAt)}),t.model&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:"var(--color-border-divider)"},children:"·"}),e.jsx("span",{children:t.model})]})]})]}),e.jsx("button",{type:"button",onClick:x,className:"absolute top-1 right-1 w-5 h-5 rounded flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity border-none bg-transparent cursor-pointer",style:{color:"var(--color-text-placeholder)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--color-tint-blocked)",i.currentTarget.style.color="var(--color-accent-red)"},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent",i.currentTarget.style.color="var(--color-text-placeholder)"},"aria-label":"Remove history item",children:e.jsx(B,{size:12,strokeWidth:2})})]})}function ee({filePath:t,onClose:r}){const[o,n]=c.useState(null),[s,a]=c.useState(!0),[d,f]=c.useState(null);c.useEffect(()=>{let x=!1;return a(!0),f(null),fetch(`/api/workspace/file?path=${encodeURIComponent(t)}`).then(async m=>{x||(m.ok?n(await m.text()):(f(`Failed to load: ${m.status}`),n(null)))}).catch(()=>{x||f("Failed to fetch file")}).finally(()=>{x||a(!1)}),()=>{x=!0}},[t]);const l=t.split("/").pop()??t;return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"shrink-0 flex items-center gap-2 px-4 py-2 border-b",style:{borderColor:"var(--color-border-divider)",backgroundColor:"var(--color-bg-secondary)"},children:[e.jsx(ce,{size:13,strokeWidth:1.8,style:{color:"var(--color-text-tertiary)"}}),e.jsx("span",{className:"text-[12px] font-medium truncate flex-1",style:{color:"var(--color-text-primary)"},title:t,children:l}),e.jsx("span",{className:"text-[10px] truncate max-w-[200px]",style:{color:"var(--color-text-tertiary)"},children:t}),e.jsx("button",{type:"button",onClick:r,className:"w-6 h-6 rounded flex items-center justify-center transition-colors",style:{color:"var(--color-text-tertiary)"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor="var(--color-bg-hover)",x.currentTarget.style.color="var(--color-text-primary)"},onMouseLeave:x=>{x.currentTarget.style.backgroundColor="transparent",x.currentTarget.style.color="var(--color-text-tertiary)"},"aria-label":"Close file viewer",children:e.jsx(B,{size:12,strokeWidth:2})})]}),e.jsxs("div",{className:"flex-1 overflow-auto",children:[s&&e.jsx("div",{className:"p-4 text-[12px] animate-pulse",style:{color:"var(--color-text-tertiary)"},children:"Loading..."}),d&&e.jsx("div",{className:"p-4 text-[12px]",style:{color:"var(--color-accent-red)"},children:d}),!s&&!d&&o!==null&&e.jsx("pre",{className:"p-4 m-0 text-[12px] leading-[1.7] whitespace-pre-wrap break-words",style:{color:"var(--color-text-secondary)",fontFamily:"var(--font-mono)",tabSize:2},children:o})]})]})}function Ee(t){try{return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}const Pe={spawning:"Starting…",running:"Running",paused:"Paused",stopping:"Stopping…",stopped:"Stopped",error:"Error"};function De(t){return t.id.startsWith("cli-history-")}const Le=[{title:"Explore your codebase",desc:"Ask questions, trace code paths, understand architecture",icon:ue,iconColor:"var(--color-accent-blue)",iconBg:"var(--color-tint-exploring)"},{title:"Plan a feature",desc:"Break down requirements into phases and tasks",icon:pe,iconColor:"var(--color-accent-purple)",iconBg:"var(--color-tint-planning)"},{title:"Execute a workflow",desc:"Run parallel tasks with automatic verification",icon:xe,iconColor:"var(--color-accent-orange)",iconBg:"var(--color-tint-verifying)"},{title:"Review & debug",desc:"Multi-dimensional code review and hypothesis-driven debugging",icon:fe,iconColor:"var(--color-accent-green)",iconBg:"var(--color-tint-completed)"}];function We(){return ie(r=>r.stylePreset)==="cowork"?e.jsx("div",{className:"flex-1 flex flex-col",style:{paddingTop:"12vh"},children:e.jsxs("div",{className:"w-full px-6",style:{maxWidth:680},children:[e.jsx("h1",{style:{fontFamily:"var(--style-heading-font)",fontSize:"var(--style-heading-size)",fontWeight:"var(--style-heading-weight)",letterSpacing:"var(--style-heading-letter-spacing)",color:"var(--color-text-primary)",margin:0},children:"Let's build something together"}),e.jsx("p",{className:"mt-2 mb-6",style:{color:"var(--color-text-tertiary)",fontSize:14,margin:"8px 0 24px"},children:"Maestro workflow orchestration."}),e.jsx(A,{}),e.jsxs("div",{className:"mt-8",children:[e.jsx("p",{className:"mb-3",style:{color:"var(--color-text-tertiary)",fontSize:12,fontWeight:500},children:"Get started with Maestro"}),e.jsx("div",{className:"flex flex-col gap-[2px]",children:Le.map(r=>e.jsxs("div",{className:"flex items-center gap-3 px-2 py-[6px] rounded-[8px] cursor-pointer transition-colors duration-150",onMouseEnter:o=>{o.currentTarget.style.backgroundColor="var(--color-bg-hover)"},onMouseLeave:o=>{o.currentTarget.style.backgroundColor="transparent"},children:[e.jsx("div",{className:"shrink-0 flex items-center justify-center rounded-[10px]",style:{width:36,height:36,backgroundColor:r.iconBg},children:e.jsx(r.icon,{size:18,strokeWidth:1.5,style:{color:r.iconColor}})}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:14,fontWeight:600,color:"var(--color-text-primary)"},children:r.title}),e.jsx("div",{style:{fontSize:12,color:"var(--color-text-tertiary)"},children:r.desc})]})]},r.title))})]})]})}):e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center",style:{marginTop:"-5vh"},children:e.jsxs("div",{className:"w-full px-4",style:{maxWidth:"clamp(360px, calc(100% - 32px), 780px)"},children:[e.jsxs("div",{className:"flex flex-col items-center mb-8",children:[e.jsx("div",{className:"w-12 h-12 rounded-2xl flex items-center justify-center mb-4",style:{backgroundColor:"var(--color-tint-exploring)"},children:e.jsx(de,{size:24,strokeWidth:1.5,style:{color:"var(--color-accent-blue)"}})}),e.jsx("h1",{className:"text-xl font-semibold mb-2 text-center",style:{color:"var(--color-text-primary)"},children:"Start a new conversation"}),e.jsx("p",{className:"text-[13px] text-center",style:{color:"var(--color-text-tertiary)"},children:"Select an agent, type a message, and press Enter to begin."})]}),e.jsx(A,{})]})})}function ne({process:t,isActive:r,onClick:o,onDismiss:n}){const s=se[t.type]??"var(--color-text-tertiary)",a=oe[t.type]??t.type,d=De(t),f=`${a}${d?" · Async Delegate":""} · ${Pe[t.status]??t.status}
7
+ ${t.config.prompt.slice(0,100)}${t.config.prompt.length>100?"…":""}
8
+ ${Ee(t.startedAt)} · ${t.type}`;return e.jsxs("button",{type:"button",onClick:o,title:f,className:"group/tab flex items-center gap-[6px] px-3 py-[5px] rounded-[9px] border-none text-[11px] font-medium cursor-pointer transition-all duration-150 shrink-0 relative",style:{backgroundColor:r?"var(--color-text-primary)":"transparent",color:r?"#fff":"var(--color-text-tertiary)",paddingRight:n?"22px":void 0},onMouseEnter:l=>{r||(l.currentTarget.style.backgroundColor="var(--color-bg-hover)",l.currentTarget.style.color="var(--color-text-primary)")},onMouseLeave:l=>{r||(l.currentTarget.style.backgroundColor="transparent",l.currentTarget.style.color="var(--color-text-tertiary)")},children:[e.jsx("span",{className:"w-[6px] h-[6px] rounded-full shrink-0",style:{backgroundColor:r?"#fff":s}}),a,d&&e.jsx("span",{className:"px-[4px] py-[1px] rounded text-[9px] font-semibold",style:{backgroundColor:r?"rgba(255,255,255,0.16)":"var(--color-tint-exploring)",color:r?"#fff":"var(--color-accent-blue)"},children:"ASYNC"}),n&&e.jsx("span",{onClick:l=>{l.stopPropagation(),n()},className:"absolute right-[6px] top-1/2 -translate-y-1/2 w-[14px] h-[14px] rounded-sm flex items-center justify-center opacity-0 group-hover/tab:opacity-100 transition-opacity duration-100",style:{color:r?"rgba(255,255,255,0.6)":"var(--color-text-placeholder)"},onMouseEnter:l=>{l.currentTarget.style.color=r?"#fff":"var(--color-accent-red)",l.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.15)":"var(--color-tint-blocked)"},onMouseLeave:l=>{l.currentTarget.style.color=r?"rgba(255,255,255,0.6)":"var(--color-text-placeholder)",l.currentTarget.style.backgroundColor="transparent"},children:e.jsx(B,{size:10,strokeWidth:2})})]})}function Ae({sortedProcesses:t,activeProcessId:r,splitOpen:o,historyOpen:n,fileTreeOpen:s,onSelectProcess:a,onDismissProcess:d,onNewSession:f,onToggleSplit:l,onToggleHistory:x,onToggleFileTree:m}){return e.jsx("div",{className:"sticky top-0 z-30 flex justify-center pt-2 pointer-events-none shrink-0",children:e.jsxs("div",{className:"inline-flex items-center gap-[2px] border rounded-[12px] p-[3px] pointer-events-auto",style:{backgroundColor:"var(--color-bg-card)",borderColor:"var(--color-border)",boxShadow:"0 4px 20px rgba(0,0,0,0.06)",maxWidth:"calc(100% - 32px)"},children:[!o&&(t.length>0||r===null)&&e.jsxs("div",{className:"flex items-center gap-[2px] overflow-x-auto",style:{scrollbarWidth:"thin",maxWidth:"min(600px, 60vw)"},onWheel:u=>{Math.abs(u.deltaY)>Math.abs(u.deltaX)&&(u.currentTarget.scrollLeft+=u.deltaY,u.preventDefault())},children:[t.map(u=>e.jsx(ne,{process:u,isActive:u.id===r,onClick:()=>a(u.id),onDismiss:()=>d(u.id)},u.id)),r===null&&e.jsxs("button",{type:"button",className:"flex items-center gap-[6px] px-3 py-[5px] rounded-[9px] border-none text-[11px] font-medium cursor-pointer shrink-0",style:{backgroundColor:"var(--color-text-primary)",color:"#fff"},children:[e.jsx(q,{size:10,strokeWidth:2.5}),"New"]})]}),t.length>1&&e.jsxs(e.Fragment,{children:[!o&&t.length>0&&e.jsx("div",{className:"w-px h-4 shrink-0",style:{backgroundColor:"var(--color-border-divider)",margin:"0 2px"}}),e.jsx(_,{icon:e.jsx(ve,{size:14,strokeWidth:1.8}),isActive:o,onClick:l,label:"Toggle split view"})]}),e.jsx("button",{type:"button",onClick:f,className:"w-7 h-7 rounded-[8px] border-none bg-transparent flex items-center justify-center cursor-pointer transition-all duration-150 shrink-0",style:{color:"var(--color-text-tertiary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--color-bg-hover)",u.currentTarget.style.color="var(--color-text-primary)"},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent",u.currentTarget.style.color="var(--color-text-tertiary)"},"aria-label":"New session",children:e.jsx(q,{size:14,strokeWidth:2})}),e.jsx("div",{className:"w-px h-4 shrink-0",style:{backgroundColor:"var(--color-border-divider)",margin:"0 2px"}}),e.jsx(_,{icon:e.jsx(ye,{size:14,strokeWidth:1.8}),isActive:s,onClick:m,label:"Toggle file tree"}),e.jsx(_,{icon:e.jsx(re,{size:14,strokeWidth:1.8}),isActive:n,onClick:x,label:"Toggle history"})]})})}function te({sortedProcesses:t,currentProcessId:r,onSelectProcess:o,onClose:n}){return e.jsx("div",{className:"flex justify-center pt-[6px] pb-[2px] pointer-events-none shrink-0",children:e.jsxs("div",{className:"inline-flex items-center gap-[2px] border rounded-[10px] p-[2px] pointer-events-auto",style:{backgroundColor:"var(--color-bg-card)",borderColor:"var(--color-border)",boxShadow:"0 2px 12px rgba(0,0,0,0.04)",maxWidth:"calc(100% - 16px)"},children:[e.jsx("div",{className:"flex items-center gap-[2px] overflow-x-auto",style:{scrollbarWidth:"thin",maxWidth:"min(400px, 100%)"},onWheel:s=>{Math.abs(s.deltaY)>Math.abs(s.deltaX)&&(s.currentTarget.scrollLeft+=s.deltaY,s.preventDefault())},children:t.map(s=>e.jsx(ne,{process:s,isActive:s.id===r,onClick:()=>o(s.id)},s.id))}),n&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-3 shrink-0",style:{backgroundColor:"var(--color-border-divider)",margin:"0 1px"}}),e.jsx("button",{type:"button",onClick:n,className:"w-[22px] h-[22px] rounded-[6px] border-none bg-transparent flex items-center justify-center cursor-pointer transition-all duration-100 shrink-0",style:{color:"var(--color-text-placeholder)"},onMouseEnter:s=>{s.currentTarget.style.backgroundColor="var(--color-tint-blocked)",s.currentTarget.style.color="var(--color-accent-red)"},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="transparent",s.currentTarget.style.color="var(--color-text-placeholder)"},"aria-label":"Close pane",children:e.jsx(B,{size:10,strokeWidth:2})})]})]})})}function _({icon:t,isActive:r,onClick:o,label:n}){return e.jsx("button",{type:"button",onClick:o,className:"flex items-center px-2 py-[5px] rounded-[9px] border-none bg-transparent cursor-pointer transition-all duration-150 shrink-0",style:{color:r?"var(--color-accent-blue)":"var(--color-text-tertiary)",backgroundColor:r?"var(--color-tint-exploring)":"transparent"},onMouseEnter:s=>{r||(s.currentTarget.style.backgroundColor="var(--color-bg-hover)",s.currentTarget.style.color="var(--color-text-primary)")},onMouseLeave:s=>{r||(s.currentTarget.style.backgroundColor="transparent",s.currentTarget.style.color="var(--color-text-tertiary)")},"aria-label":n,children:t})}function Ge(){var O;const t=M(g=>g.processes),r=M(g=>g.activeProcessId),o=M(g=>g.setActiveProcessId),n=M(g=>g.dismissProcess),[s,a]=c.useState(!1),[d,f]=c.useState(null),[l,x]=c.useState(!1),[m,u]=c.useState(!1),[i,v]=c.useState(null),{ratio:N,setRatio:w,createDragHandle:T}=je({defaultRatio:50,minRatio:25,maxRatio:75,storageKey:"chat-split-ratio"}),b=we(),j=c.useMemo(()=>Object.values(t).sort((g,p)=>new Date(p.startedAt).getTime()-new Date(g.startedAt).getTime()),[t]),k=c.useRef(!1),h=Object.keys(t).length,C=c.useRef(h),E=c.useRef(j);E.current=j,c.useEffect(()=>{const g=C.current;if(C.current=h,k.current){if(h>g){k.current=!1;const p=E.current[0];p&&o(p.id)}return}if(!r&&h>0){const p=E.current[0];p&&o(p.id)}},[r,h,o]);const S=c.useRef({});c.useEffect(()=>{for(const p of j){const y=p.status==="stopped"||p.status==="error",P=p.id===r;y&&!P&&!S.current[p.id]&&(S.current[p.id]=setTimeout(()=>{delete S.current[p.id],n(p.id)},12e4)),(!y||P)&&S.current[p.id]&&(clearTimeout(S.current[p.id]),delete S.current[p.id])}for(const p of Object.keys(S.current))t[p]||(clearTimeout(S.current[p]),delete S.current[p])},[j,r,n,t]);const I=d?t[d]:null,D=!r;ke(r),c.useEffect(()=>{s&&d&&!t[d]&&(a(!1),f(null))},[s,d,t]);const z=c.useCallback(()=>{if(s)a(!1),f(null),v(null);else{const g=j.find(p=>p.id!==r);g&&(f(g.id),a(!0),w(50))}},[s,j,r,w]),R=c.useCallback(g=>{const p=t[g];p&&(p.status==="running"||p.status==="spawning")&&W({action:"stop",processId:g}),n(g)},[t,n]),X=c.useCallback(()=>{k.current=!0,o(null)},[o]),$=c.useCallback(g=>{i!==null?v(g):(v(g),a(!0),f(null),w(50))},[i,w]),F=c.useCallback(()=>{v(null),a(!1),f(null)},[]);return e.jsxs("div",{className:"h-full flex min-w-0 overflow-hidden relative",children:[e.jsx("div",{className:"shrink-0 flex flex-col overflow-hidden border-r transition-[width] duration-200 ease-[var(--ease-notion)]",style:{width:m?260:0,borderColor:m?"var(--color-border)":"transparent"},children:m&&e.jsx(ge,{tree:b.tree,selectedPath:i,onSelectFile:$,loading:b.loading})}),e.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[e.jsx(Ae,{sortedProcesses:j,activeProcessId:r,splitOpen:s,historyOpen:l,fileTreeOpen:m,onSelectProcess:o,onDismissProcess:R,onNewSession:X,onToggleSplit:z,onToggleHistory:()=>x(!l),onToggleFileTree:()=>u(!m)}),D&&i?e.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:e.jsx(ee,{filePath:i,onClose:F})}):D?e.jsx(We,{}):e.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0 relative",children:[e.jsxs("div",{className:"flex flex-col min-w-0 overflow-hidden",style:{flex:s?`0 0 ${N}%`:"1"},children:[s&&!i&&e.jsx(te,{sortedProcesses:j,currentProcessId:r,onSelectProcess:o}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",children:e.jsx(H,{processId:r})}),e.jsx(G,{processId:r}),s&&!i?e.jsx(A,{processId:r,executor:(O=t[r])==null?void 0:O.type}):e.jsx(A,{})]}),s&&e.jsx("div",{className:"relative shrink-0",style:{width:0},children:T({className:"left-[-6px]",linePlacement:"end",lineClassName:"opacity-40 group-hover:opacity-100 group-active:opacity-100",lineStyle:{backgroundColor:"var(--color-accent-orange)"}})}),s&&e.jsx("div",{className:"flex flex-col min-w-0 overflow-hidden border-l",style:{flex:`0 0 ${100-N}%`,borderColor:"var(--color-border)"},children:i?e.jsx(ee,{filePath:i,onClose:F}):e.jsxs(e.Fragment,{children:[e.jsx(te,{sortedProcesses:j,currentProcessId:d,onSelectProcess:f,onClose:z}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",children:e.jsx(H,{processId:d})}),e.jsx(G,{processId:d}),e.jsx(A,{processId:d,executor:I==null?void 0:I.type})]})})]})]}),e.jsx(Ie,{open:l})]})}export{Ge as ChatPage};
@@ -1 +1 @@
1
- import{j as e,Z as L,_ as c,$ as w,r as d,V as z}from"./index-11DuhKhc.js";import{A as M}from"./index-BvScJmJM.js";import{m as T}from"./proxy-B9XRqHD9.js";function $(t){const a=Date.now()-new Date(t).getTime(),r=Math.floor(a/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const s=Math.floor(r/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}function D({member:t}){return e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-[var(--radius-md)] border border-border bg-bg-secondary hover:shadow-sm transition-shadow",children:[e.jsxs("div",{className:"relative flex-shrink-0 rounded-full flex items-center justify-center",style:{width:40,height:40,backgroundColor:"#6b7280"},children:[e.jsx("span",{className:"text-white text-[length:14px] font-semibold select-none",children:t.name.charAt(0).toUpperCase()}),e.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 w-3 h-3 rounded-full border-2 border-bg-secondary",style:{backgroundColor:L[t.status]}})]}),e.jsxs("div",{className:"flex flex-col min-w-0 gap-0.5",children:[e.jsx("span",{className:"text-[length:var(--font-size-sm)] font-[var(--font-weight-medium)] text-text-primary truncate",children:t.name}),(t.currentPhase||t.currentTask)&&e.jsx("span",{className:"text-[length:var(--font-size-xs)] text-text-tertiary truncate",children:[t.currentPhase,t.currentTask].filter(Boolean).join(" / ")}),e.jsx("span",{className:"text-[length:10px] text-text-tertiary",children:$(t.lastSeen)})]})]})}function R(){const t=c(a=>a.filteredMembers());return t.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 gap-2",children:[e.jsx("span",{className:"text-text-secondary text-[length:var(--font-size-sm)]",children:"No team members found"}),e.jsxs("span",{className:"text-text-tertiary text-[length:var(--font-size-xs)]",children:["Run ",e.jsx("code",{className:"px-1 py-0.5 bg-bg-hover rounded text-[10px]",children:"maestro team join"})," to join the team"]})]}):e.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(240px, 1fr))"},children:t.map(a=>e.jsx(D,{member:a},a.uid))})}function O(t){const a=Date.now()-new Date(t).getTime(),r=Math.floor(a/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const s=Math.floor(r/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}function _({entry:t}){const a=w[t.action]??"#9ca3af";return e.jsxs("div",{className:"flex items-start gap-2 px-2 py-1.5 rounded text-[length:var(--font-size-xs)]",style:{borderLeft:`3px solid ${a}`},children:[e.jsx("span",{className:"text-text-tertiary flex-shrink-0 tabular-nums w-12",children:O(t.ts)}),e.jsx("span",{className:"font-[var(--font-weight-medium)] text-text-primary flex-shrink-0",children:t.user}),e.jsxs("span",{className:"text-text-secondary truncate",children:[t.action,t.target?` → ${t.target}`:""]})]})}function E(){const t=c(s=>s.activity),a=d.useRef(null),r=t.slice(-100);return d.useEffect(()=>{const s=a.current;s&&(s.scrollTop=s.scrollHeight)},[r.length]),r.length===0?e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("span",{className:"text-text-tertiary text-[length:var(--font-size-sm)]",children:"No activity yet"})}):e.jsx("div",{ref:a,className:"flex flex-col gap-1 overflow-y-auto h-full pr-1",children:r.map(s=>e.jsx(_,{entry:s},`${s.ts}-${s.user}-${s.action}`))})}const k={high:{label:"High",color:"#dc2626",bg:"rgba(239,68,68,0.08)",border:"rgba(239,68,68,0.2)"},medium:{label:"Medium",color:"#ca8a04",bg:"rgba(234,179,8,0.08)",border:"rgba(234,179,8,0.2)"},low:{label:"Low",color:"#16a34a",bg:"rgba(34,197,94,0.08)",border:"rgba(34,197,94,0.2)"},none:{label:"None",color:"var(--color-text-tertiary, #9ca3af)",bg:"var(--color-bg-secondary)",border:"var(--color-border)"}};function A(t){return k[t]??k.none}function I(){const t=c(i=>i.aggregated),a=c(i=>i.members);if(c(i=>i.loading)&&t.length===0)return e.jsxs("div",{className:"flex items-center justify-center h-64 text-text-secondary text-[length:var(--font-size-sm)]",children:[e.jsxs("svg",{className:"animate-spin h-5 w-5 mr-2 text-text-secondary",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading analysis data..."]});if(t.length===0)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 gap-3",children:[e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-text-quaternary",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("path",{d:"M3 9h18"}),e.jsx("path",{d:"M9 21V9"})]}),e.jsx("span",{className:"text-text-tertiary text-[length:var(--font-size-sm)]",children:"No activity data available for analysis"}),e.jsx("span",{className:"text-text-quaternary text-[length:var(--font-size-xs)]",children:"Activity will appear here as team members work on phases and tasks"})]});const s=t.reduce((i,m)=>i+m.count,0),o=new Set(t.flatMap(i=>i.members)).size,h=t.filter(i=>i.risk==="high").length,p=t.filter(i=>i.risk==="medium").length,x=[...t].sort((i,m)=>{const g={high:0,medium:1,low:2,none:3},v=g[i.risk]??3,u=g[m.risk]??3;return v!==u?v-u:m.count-i.count});return e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[e.jsx(N,{label:"Total Activity",value:s}),e.jsx(N,{label:"Active Members",value:o,total:a.length}),e.jsx(N,{label:"High Risk",value:h,color:h>0?"#dc2626":void 0}),e.jsx(N,{label:"Medium Risk",value:p,color:p>0?"#ca8a04":void 0})]}),e.jsxs("div",{className:"flex items-center gap-4 text-[length:var(--font-size-xs)] text-text-tertiary",children:[e.jsx("span",{children:"Risk levels:"}),["none","low","medium","high"].map(i=>{const m=A(i);return e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:m.color,opacity:.7}}),e.jsx("span",{children:m.label}),e.jsxs("span",{className:"text-text-quaternary",children:["(",i==="none"?"1":i==="low"?"2":i==="medium"?"3":"4+",i==="none"?" member":" members",")"]})]},i)})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("h3",{className:"text-[length:var(--font-size-xs)] font-semibold text-text-secondary uppercase tracking-wider",children:"Activity Concentration"}),e.jsx("div",{className:"grid grid-cols-1 gap-2",children:x.map((i,m)=>e.jsx(q,{entry:i},`${i.phase}::${i.task}::${m}`))})]})]})}function N({label:t,value:a,total:r,color:s}){return e.jsxs("div",{className:"rounded-[var(--radius-md,6px)] border border-border bg-bg-secondary px-4 py-3",children:[e.jsx("div",{className:"text-[10px] text-text-tertiary uppercase tracking-wider mb-1",children:t}),e.jsxs("div",{className:"text-[length:var(--font-size-xl)] font-bold",style:{color:s??"var(--color-text-primary)"},children:[a,r!=null&&e.jsxs("span",{className:"text-[length:var(--font-size-sm)] font-normal text-text-quaternary",children:[" / ",r]})]})]})}function q({entry:t}){const a=A(t.risk),r=t.phase||"(no phase)",s=t.task||"(general)";return e.jsxs("div",{className:"flex items-center gap-4 rounded-[var(--radius-md,6px)] px-4 py-3 border transition-colors",style:{backgroundColor:a.bg,borderColor:a.border},children:[e.jsx("div",{className:"flex flex-col items-center gap-1 shrink-0 w-[52px]",children:e.jsx("span",{className:"text-[11px] font-semibold px-2 py-0.5 rounded-full",style:{color:a.color,backgroundColor:`${a.color}15`},children:a.label})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[length:var(--font-size-sm)] font-medium text-text-primary truncate",children:r}),t.task&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-text-quaternary",children:"/"}),e.jsx("span",{className:"text-[length:var(--font-size-sm)] text-text-secondary truncate",children:s})]})]})}),e.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[e.jsx("span",{className:"text-[length:var(--font-size-sm)] font-bold text-text-primary",children:t.count}),e.jsx("span",{className:"text-[10px] text-text-tertiary",children:"actions"})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[t.members.slice(0,5).map(o=>e.jsx("span",{className:"w-6 h-6 rounded-full bg-bg-secondary border border-border flex items-center justify-center text-[10px] font-medium text-text-secondary uppercase",title:o,children:o.charAt(0)},o)),t.members.length>5&&e.jsxs("span",{className:"text-[10px] text-text-tertiary",children:["+",t.members.length-5]})]})]})}const B={init:"⚡",join:"→",leave:"←",phase_change:"◆",task_update:"●",message:"✉",sync:"↻",report:"📋",discussion:"💬"},P=[{value:"all",label:"All types"},{value:"init",label:"Init"},{value:"join",label:"Join"},{value:"phase_change",label:"Phase changes"},{value:"task_update",label:"Task updates"},{value:"message",label:"Messages"},{value:"sync",label:"Sync"}];function F(t){const a=new Date(t),r=new Date,s=new Date(r);return s.setDate(s.getDate()-1),a.toDateString()===r.toDateString()?"Today":a.toDateString()===s.toDateString()?"Yesterday":a.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"})}function H(t){return new Date(t).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function W(t){const a=Date.now()-new Date(t).getTime(),r=Math.floor(a/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const s=Math.floor(r/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}function V(t){return new Date(t).toDateString()}function U(t){switch(t){case"init":return"Initialized collaboration";case"join":return"Joined the team";case"leave":return"Left the team";case"phase_change":return"Changed phase";case"task_update":return"Updated task";case"message":return"Sent a message";case"sync":return"Synced activity";case"report":return"Generated report";case"discussion":return"Started discussion";default:return t}}function K(t){return`${w[t]??"#9ca3af"}12`}function G(){const t=c(n=>n.filteredActivity()),a=c(n=>n.members),r=c(n=>n.memberFilter),s=c(n=>n.typeFilter),o=c(n=>n.setMemberFilter),h=c(n=>n.setTypeFilter),p=c(n=>n.fetchActivity),x=c(n=>n.loading),[i,m]=d.useState(200);d.useEffect(()=>{p(i)},[p,i]);const g=d.useMemo(()=>{const n=[];let f="";for(const y of t){const j=V(y.ts);j!==f&&(f=j,n.push({day:j,label:F(y.ts),entries:[]})),n[n.length-1].entries.push(y)}return n},[t]),v=new Set(t.map(n=>n.user)).size,u=new Set(t.map(n=>n.action)).size;return x&&t.length===0?e.jsx("div",{className:"flex items-center justify-center h-64 text-text-secondary text-[length:var(--font-size-sm)]",children:"Loading history..."}):e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0 pb-4",children:[e.jsxs("select",{value:r,onChange:n=>o(n.target.value),className:"text-[length:var(--font-size-xs)] px-2.5 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-text-primary outline-none focus:border-text-tertiary",children:[e.jsx("option",{value:"all",children:"All members"}),a.map(n=>e.jsx("option",{value:n.uid,children:n.name},n.uid))]}),e.jsx("select",{value:s,onChange:n=>h(n.target.value),className:"text-[length:var(--font-size-xs)] px-2.5 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-text-primary outline-none focus:border-text-tertiary",children:P.map(n=>e.jsx("option",{value:n.value,children:n.label},n.value))}),(r!=="all"||s!=="all")&&e.jsx("button",{type:"button",onClick:()=>{o("all"),h("all")},className:"text-[11px] text-text-tertiary hover:text-text-primary transition-colors",children:"Clear"}),e.jsxs("div",{className:"ml-auto flex items-center gap-4 text-[11px] text-text-quaternary",children:[e.jsxs("span",{children:[t.length," events"]}),e.jsxs("span",{children:[v," users"]}),e.jsxs("span",{children:[u," types"]})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0",children:[t.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-48 gap-2",children:[e.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-text-quaternary",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}),e.jsx("span",{className:"text-text-tertiary text-[length:var(--font-size-sm)]",children:"No events match filters"})]}):e.jsx("div",{className:"flex flex-col gap-5",children:g.map(n=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3 sticky top-0 bg-bg-primary z-10 py-1",children:[e.jsx("span",{className:"text-[length:var(--font-size-xs)] font-semibold text-text-primary",children:n.label}),e.jsx("div",{className:"flex-1 h-px bg-border"}),e.jsxs("span",{className:"text-[10px] text-text-quaternary",children:[n.entries.length," events"]})]}),e.jsx("div",{className:"relative ml-5 pl-5 border-l-2 border-border",children:e.jsx("div",{className:"flex flex-col gap-1",children:n.entries.map((f,y)=>e.jsx(J,{entry:f},`${f.ts}-${f.user}-${f.action}-${y}`))})})]},n.day))}),t.length>=i&&e.jsx("div",{className:"flex justify-center py-4",children:e.jsx("button",{type:"button",onClick:()=>m(n=>n+200),className:"px-3 py-1.5 rounded-[var(--radius-md,6px)] text-[11px] font-semibold text-text-secondary hover:text-text-primary transition-all border border-border",children:"Load more"})})]})]})}function J({entry:t}){const a=w[t.action]??"#9ca3af",r=B[t.action]??"•",s=t.user.charAt(0).toUpperCase();return e.jsxs("div",{className:"relative flex items-start gap-3 py-2 group hover:bg-bg-secondary/50 rounded-r-[var(--radius-md,6px)] px-3 -ml-[21px] transition-colors",children:[e.jsx("div",{className:"absolute -left-[8px] top-[14px] w-[14px] h-[14px] rounded-full border-2 flex items-center justify-center",style:{borderColor:a,backgroundColor:"var(--color-bg-primary)"},children:e.jsx("span",{style:{fontSize:"7px",lineHeight:1,color:a},children:r})}),e.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-semibold shrink-0 ml-2",style:{backgroundColor:K(t.action),color:a},children:s}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:"text-[length:var(--font-size-sm)] font-semibold text-text-primary",children:t.user}),e.jsx("span",{className:"text-[length:var(--font-size-xs)] text-text-secondary",children:U(t.action)})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-0.5",children:[t.phase_id&&e.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-secondary border border-border text-text-tertiary",children:["Phase ",t.phase_id]}),t.task_id&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-secondary border border-border text-text-tertiary",children:t.task_id}),t.target&&e.jsx("span",{className:"text-[10px] text-text-tertiary truncate max-w-[200px]",title:t.target,children:t.target}),t.host&&e.jsxs("span",{className:"text-[10px] text-text-quaternary flex items-center gap-1",children:[e.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),e.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),e.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),t.host]})]})]}),e.jsxs("div",{className:"flex flex-col items-end shrink-0 gap-0.5",children:[e.jsx("span",{className:"text-[11px] text-text-tertiary tabular-nums",children:H(t.ts)}),e.jsx("span",{className:"text-[10px] text-text-quaternary",children:W(t.ts)})]})]})}const Y=[{label:"Overview",key:"overview",shortcut:"1"},{label:"Analysis",key:"analysis",shortcut:"2"},{label:"History",key:"history",shortcut:"3"}],C=["overview","analysis","history"],Q={initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8}};function ae(){const t=c(l=>l.members);c(l=>l.loading);const a=c(l=>l.error),r=c(l=>l.activeTab),s=c(l=>l.fetchMembers),o=c(l=>l.fetchActivity),h=c(l=>l.fetchPresence),p=c(l=>l.fetchAggregated),x=c(l=>l.fetchPreflight),i=c(l=>l.setActiveTab),m=c(l=>l.clearAll),[g,v]=d.useState(null),[u,n]=d.useState(!0),{register:f,unregister:y}=d.useContext(z),j=d.useCallback(l=>i(C[l]),[i]);return d.useEffect(()=>{f({items:Y.map(l=>({label:l.label,icon:null,shortcut:l.shortcut})),activeIndex:C.indexOf(r),onSwitch:j})},[r,f,j]),d.useEffect(()=>()=>y(),[y]),d.useEffect(()=>{function l(b){b.target instanceof HTMLInputElement||b.target instanceof HTMLTextAreaElement||(b.key==="1"?i("overview"):b.key==="2"?i("analysis"):b.key==="3"&&i("history"))}return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[i]),d.useEffect(()=>{let l=!1;return(async()=>{n(!0);const b=await x();l||(v(b),n(!1),b!=null&&b.exists&&(s(),o(),h(),p()))})(),()=>{l=!0,m()}},[]),u?e.jsx("div",{className:"flex items-center justify-center h-full text-text-secondary text-[length:var(--font-size-sm)]",children:"Loading..."}):g!=null&&g.exists?a&&t.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[e.jsx("span",{className:"text-accent-red text-[length:var(--font-size-sm)]",children:"Failed to load collaboration data"}),e.jsx("span",{className:"text-text-tertiary text-[length:var(--font-size-xs)]",children:a}),e.jsx("button",{type:"button",onClick:()=>{s(),o(),h()},className:"px-3 py-1.5 rounded-[var(--radius-md)] text-[11px] font-semibold bg-bg-secondary border border-border text-text-secondary hover:text-text-primary transition-all",children:"Retry"})]}):e.jsx("div",{className:"flex flex-col h-full overflow-hidden",children:e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(M,{mode:"popLayout",children:e.jsxs(T.div,{className:"h-full flex flex-col overflow-hidden",variants:Q,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.15},children:[r==="overview"&&e.jsx(X,{}),r==="analysis"&&e.jsx("div",{className:"p-4 h-full overflow-y-auto",children:e.jsx(I,{})}),r==="history"&&e.jsx("div",{className:"px-4 pt-4 pb-0 h-full flex flex-col overflow-visible",children:e.jsx(G,{})})]},r)})})}):e.jsx(Z,{onRefresh:async()=>{const l=await x();v(l),l!=null&&l.exists&&(s(),o(),h(),p())}})}function Z({onRefresh:t}){const a=c(x=>x.initCollab),[r,s]=d.useState(!1),[o,h]=d.useState(null);async function p(){s(!0),h(null);const x=await a();x.success?t():(h(x.error??"Unknown error"),s(!1))}return e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"max-w-[480px] w-full px-6",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"w-12 h-12 rounded-[12px] bg-bg-secondary border border-border flex items-center justify-center mx-auto mb-4",children:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-text-secondary",children:[e.jsx("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"}),e.jsx("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),e.jsx("h2",{className:"text-[length:var(--font-size-xl)] font-bold text-text-primary mb-2",children:"Team Collaboration"}),e.jsx("p",{className:"text-[length:var(--font-size-sm)] text-text-secondary leading-relaxed",children:"Track team activity, detect file conflicts, and coordinate phase assignments across multiple developers."})]}),e.jsx("div",{className:"border border-border rounded-[var(--radius-md,6px)] bg-bg-secondary p-4 mb-6",children:e.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2",children:[{label:"Member presence",desc:"Online/away/offline status"},{label:"Activity feed",desc:"Real-time team actions"},{label:"Conflict detection",desc:"Overlapping file edits"},{label:"Phase coordination",desc:"Who works on what"},{label:"Activity heatmap",desc:"Concentration analysis"},{label:"Collaboration timeline",desc:"Historical view"}].map(x=>e.jsxs("div",{className:"flex items-start gap-2 py-1",children:[e.jsx("span",{className:"w-1 h-1 rounded-full bg-accent-green mt-[7px] shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[length:var(--font-size-xs)] text-text-primary font-medium",children:x.label}),e.jsx("div",{className:"text-[10px] text-text-tertiary",children:x.desc})]})]},x.label))})}),e.jsxs("div",{className:"text-center",children:[e.jsx("button",{type:"button",onClick:p,disabled:r,className:"px-5 py-2.5 rounded-[var(--radius-md,6px)] text-[length:var(--font-size-sm)] font-semibold bg-text-primary text-bg-primary hover:opacity-90 transition-opacity disabled:opacity-50",children:r?"Initializing...":"Enable Team Collaboration"}),o&&e.jsx("p",{className:"text-[length:var(--font-size-xs)] text-accent-red mt-2",children:o}),e.jsx("p",{className:"text-[10px] text-text-quaternary mt-2",children:"Creates .workflow/collab/ and registers you as the team owner"})]})]})})}function X(){const t=c(o=>o.members),a=c(o=>o.presence),r=a.filter(o=>o.status==="online").length,s=a.filter(o=>o.status==="away").length;return e.jsxs("div",{className:"flex h-full overflow-hidden",children:[e.jsxs("div",{className:"flex-1 min-w-0 overflow-y-auto p-4",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-4 text-[length:var(--font-size-xs)]",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-[#22c55e]"}),e.jsxs("span",{className:"text-text-secondary",children:[r," online"]})]}),s>0&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-[#eab308]"}),e.jsxs("span",{className:"text-text-secondary",children:[s," away"]})]}),e.jsxs("span",{className:"text-text-quaternary",children:[t.length," members total"]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[e.jsx(ee,{}),e.jsx(S,{label:"Sync Activity",command:"maestro team sync",icon:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"23 4 23 10 17 10"}),e.jsx("polyline",{points:"1 20 1 14 7 14"}),e.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]})}),e.jsx(S,{label:"Team Status",command:"maestro team status",icon:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M22 12h-4l-3 9L9 3l-3 9H2"})})})]}),e.jsx(R,{})]}),e.jsxs("div",{className:"w-[320px] shrink-0 border-l border-border flex flex-col h-full bg-bg-primary",children:[e.jsx("div",{className:"px-4 py-3 border-b border-border",children:e.jsx("h3",{className:"text-[length:var(--font-size-sm)] font-semibold text-text-primary",children:"Activity"})}),e.jsx("div",{className:"flex-1 overflow-hidden px-4 py-2",children:e.jsx(E,{})})]})]})}function ee(){const t=c(u=>u.addMember),[a,r]=d.useState(!1),[s,o]=d.useState(""),[h,p]=d.useState("member"),[x,i]=d.useState(!1),[m,g]=d.useState(null);async function v(u){u.preventDefault();const n=s.trim();if(!n)return;i(!0),g(null);const f=await t(n,"",h);i(!1),f.success?(o(""),p("member"),r(!1)):g(f.error??"Failed to add member")}return a?e.jsxs("form",{onSubmit:v,className:"flex items-center gap-1.5",children:[e.jsx("input",{autoFocus:!0,value:s,onChange:u=>o(u.target.value),placeholder:"Name",className:"w-[120px] px-2 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-[11px] text-text-primary placeholder:text-text-quaternary outline-none focus:border-text-tertiary"}),e.jsxs("select",{value:h,onChange:u=>p(u.target.value),className:"px-1.5 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-[11px] text-text-secondary outline-none",children:[e.jsx("option",{value:"member",children:"Member"}),e.jsx("option",{value:"admin",children:"Admin"}),e.jsx("option",{value:"viewer",children:"Viewer"})]}),e.jsx("button",{type:"submit",disabled:x||!s.trim(),className:"px-2.5 py-1.5 rounded-[var(--radius-md,6px)] text-[11px] font-semibold bg-text-primary text-bg-primary hover:opacity-90 transition-opacity disabled:opacity-40",children:x?"...":"Add"}),e.jsx("button",{type:"button",onClick:()=>{r(!1),g(null)},className:"px-1.5 py-1.5 text-[11px] text-text-tertiary hover:text-text-primary",children:"Cancel"}),m&&e.jsx("span",{className:"text-[10px] text-accent-red",children:m})]}):e.jsxs("button",{type:"button",onClick:()=>r(!0),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-[11px] font-medium text-text-secondary hover:text-text-primary hover:bg-bg-secondary transition-all",children:[e.jsx("span",{className:"text-text-tertiary",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"8.5",cy:"7",r:"4"}),e.jsx("line",{x1:"20",y1:"8",x2:"20",y2:"14"}),e.jsx("line",{x1:"23",y1:"11",x2:"17",y2:"11"})]})}),e.jsx("span",{children:"Add Member"})]})}function S({label:t,command:a,icon:r}){const[s,o]=d.useState(!1);return e.jsxs("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(a),o(!0),setTimeout(()=>o(!1),1500)},title:`Copy: ${a}`,className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-[11px] font-medium text-text-secondary hover:text-text-primary hover:bg-bg-secondary transition-all",children:[e.jsx("span",{className:"text-text-tertiary",children:r}),e.jsx("span",{children:s?"Copied!":t})]})}export{ae as CollabPage};
1
+ import{j as e,Z as L,_ as c,$ as w,r as d,V as z}from"./index-nufWop4p.js";import{A as M}from"./index-Dru5HYy0.js";import{m as T}from"./proxy-teW12DdZ.js";function $(t){const a=Date.now()-new Date(t).getTime(),r=Math.floor(a/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const s=Math.floor(r/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}function D({member:t}){return e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-[var(--radius-md)] border border-border bg-bg-secondary hover:shadow-sm transition-shadow",children:[e.jsxs("div",{className:"relative flex-shrink-0 rounded-full flex items-center justify-center",style:{width:40,height:40,backgroundColor:"#6b7280"},children:[e.jsx("span",{className:"text-white text-[length:14px] font-semibold select-none",children:t.name.charAt(0).toUpperCase()}),e.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 w-3 h-3 rounded-full border-2 border-bg-secondary",style:{backgroundColor:L[t.status]}})]}),e.jsxs("div",{className:"flex flex-col min-w-0 gap-0.5",children:[e.jsx("span",{className:"text-[length:var(--font-size-sm)] font-[var(--font-weight-medium)] text-text-primary truncate",children:t.name}),(t.currentPhase||t.currentTask)&&e.jsx("span",{className:"text-[length:var(--font-size-xs)] text-text-tertiary truncate",children:[t.currentPhase,t.currentTask].filter(Boolean).join(" / ")}),e.jsx("span",{className:"text-[length:10px] text-text-tertiary",children:$(t.lastSeen)})]})]})}function R(){const t=c(a=>a.filteredMembers());return t.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 gap-2",children:[e.jsx("span",{className:"text-text-secondary text-[length:var(--font-size-sm)]",children:"No team members found"}),e.jsxs("span",{className:"text-text-tertiary text-[length:var(--font-size-xs)]",children:["Run ",e.jsx("code",{className:"px-1 py-0.5 bg-bg-hover rounded text-[10px]",children:"maestro team join"})," to join the team"]})]}):e.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(240px, 1fr))"},children:t.map(a=>e.jsx(D,{member:a},a.uid))})}function O(t){const a=Date.now()-new Date(t).getTime(),r=Math.floor(a/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const s=Math.floor(r/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}function _({entry:t}){const a=w[t.action]??"#9ca3af";return e.jsxs("div",{className:"flex items-start gap-2 px-2 py-1.5 rounded text-[length:var(--font-size-xs)]",style:{borderLeft:`3px solid ${a}`},children:[e.jsx("span",{className:"text-text-tertiary flex-shrink-0 tabular-nums w-12",children:O(t.ts)}),e.jsx("span",{className:"font-[var(--font-weight-medium)] text-text-primary flex-shrink-0",children:t.user}),e.jsxs("span",{className:"text-text-secondary truncate",children:[t.action,t.target?` → ${t.target}`:""]})]})}function E(){const t=c(s=>s.activity),a=d.useRef(null),r=t.slice(-100);return d.useEffect(()=>{const s=a.current;s&&(s.scrollTop=s.scrollHeight)},[r.length]),r.length===0?e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("span",{className:"text-text-tertiary text-[length:var(--font-size-sm)]",children:"No activity yet"})}):e.jsx("div",{ref:a,className:"flex flex-col gap-1 overflow-y-auto h-full pr-1",children:r.map(s=>e.jsx(_,{entry:s},`${s.ts}-${s.user}-${s.action}`))})}const k={high:{label:"High",color:"#dc2626",bg:"rgba(239,68,68,0.08)",border:"rgba(239,68,68,0.2)"},medium:{label:"Medium",color:"#ca8a04",bg:"rgba(234,179,8,0.08)",border:"rgba(234,179,8,0.2)"},low:{label:"Low",color:"#16a34a",bg:"rgba(34,197,94,0.08)",border:"rgba(34,197,94,0.2)"},none:{label:"None",color:"var(--color-text-tertiary, #9ca3af)",bg:"var(--color-bg-secondary)",border:"var(--color-border)"}};function A(t){return k[t]??k.none}function I(){const t=c(i=>i.aggregated),a=c(i=>i.members);if(c(i=>i.loading)&&t.length===0)return e.jsxs("div",{className:"flex items-center justify-center h-64 text-text-secondary text-[length:var(--font-size-sm)]",children:[e.jsxs("svg",{className:"animate-spin h-5 w-5 mr-2 text-text-secondary",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading analysis data..."]});if(t.length===0)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 gap-3",children:[e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-text-quaternary",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("path",{d:"M3 9h18"}),e.jsx("path",{d:"M9 21V9"})]}),e.jsx("span",{className:"text-text-tertiary text-[length:var(--font-size-sm)]",children:"No activity data available for analysis"}),e.jsx("span",{className:"text-text-quaternary text-[length:var(--font-size-xs)]",children:"Activity will appear here as team members work on phases and tasks"})]});const s=t.reduce((i,m)=>i+m.count,0),o=new Set(t.flatMap(i=>i.members)).size,h=t.filter(i=>i.risk==="high").length,p=t.filter(i=>i.risk==="medium").length,x=[...t].sort((i,m)=>{const g={high:0,medium:1,low:2,none:3},v=g[i.risk]??3,u=g[m.risk]??3;return v!==u?v-u:m.count-i.count});return e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[e.jsx(N,{label:"Total Activity",value:s}),e.jsx(N,{label:"Active Members",value:o,total:a.length}),e.jsx(N,{label:"High Risk",value:h,color:h>0?"#dc2626":void 0}),e.jsx(N,{label:"Medium Risk",value:p,color:p>0?"#ca8a04":void 0})]}),e.jsxs("div",{className:"flex items-center gap-4 text-[length:var(--font-size-xs)] text-text-tertiary",children:[e.jsx("span",{children:"Risk levels:"}),["none","low","medium","high"].map(i=>{const m=A(i);return e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:m.color,opacity:.7}}),e.jsx("span",{children:m.label}),e.jsxs("span",{className:"text-text-quaternary",children:["(",i==="none"?"1":i==="low"?"2":i==="medium"?"3":"4+",i==="none"?" member":" members",")"]})]},i)})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("h3",{className:"text-[length:var(--font-size-xs)] font-semibold text-text-secondary uppercase tracking-wider",children:"Activity Concentration"}),e.jsx("div",{className:"grid grid-cols-1 gap-2",children:x.map((i,m)=>e.jsx(q,{entry:i},`${i.phase}::${i.task}::${m}`))})]})]})}function N({label:t,value:a,total:r,color:s}){return e.jsxs("div",{className:"rounded-[var(--radius-md,6px)] border border-border bg-bg-secondary px-4 py-3",children:[e.jsx("div",{className:"text-[10px] text-text-tertiary uppercase tracking-wider mb-1",children:t}),e.jsxs("div",{className:"text-[length:var(--font-size-xl)] font-bold",style:{color:s??"var(--color-text-primary)"},children:[a,r!=null&&e.jsxs("span",{className:"text-[length:var(--font-size-sm)] font-normal text-text-quaternary",children:[" / ",r]})]})]})}function q({entry:t}){const a=A(t.risk),r=t.phase||"(no phase)",s=t.task||"(general)";return e.jsxs("div",{className:"flex items-center gap-4 rounded-[var(--radius-md,6px)] px-4 py-3 border transition-colors",style:{backgroundColor:a.bg,borderColor:a.border},children:[e.jsx("div",{className:"flex flex-col items-center gap-1 shrink-0 w-[52px]",children:e.jsx("span",{className:"text-[11px] font-semibold px-2 py-0.5 rounded-full",style:{color:a.color,backgroundColor:`${a.color}15`},children:a.label})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[length:var(--font-size-sm)] font-medium text-text-primary truncate",children:r}),t.task&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-text-quaternary",children:"/"}),e.jsx("span",{className:"text-[length:var(--font-size-sm)] text-text-secondary truncate",children:s})]})]})}),e.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[e.jsx("span",{className:"text-[length:var(--font-size-sm)] font-bold text-text-primary",children:t.count}),e.jsx("span",{className:"text-[10px] text-text-tertiary",children:"actions"})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[t.members.slice(0,5).map(o=>e.jsx("span",{className:"w-6 h-6 rounded-full bg-bg-secondary border border-border flex items-center justify-center text-[10px] font-medium text-text-secondary uppercase",title:o,children:o.charAt(0)},o)),t.members.length>5&&e.jsxs("span",{className:"text-[10px] text-text-tertiary",children:["+",t.members.length-5]})]})]})}const B={init:"⚡",join:"→",leave:"←",phase_change:"◆",task_update:"●",message:"✉",sync:"↻",report:"📋",discussion:"💬"},P=[{value:"all",label:"All types"},{value:"init",label:"Init"},{value:"join",label:"Join"},{value:"phase_change",label:"Phase changes"},{value:"task_update",label:"Task updates"},{value:"message",label:"Messages"},{value:"sync",label:"Sync"}];function F(t){const a=new Date(t),r=new Date,s=new Date(r);return s.setDate(s.getDate()-1),a.toDateString()===r.toDateString()?"Today":a.toDateString()===s.toDateString()?"Yesterday":a.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"})}function H(t){return new Date(t).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function W(t){const a=Date.now()-new Date(t).getTime(),r=Math.floor(a/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const s=Math.floor(r/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}function V(t){return new Date(t).toDateString()}function U(t){switch(t){case"init":return"Initialized collaboration";case"join":return"Joined the team";case"leave":return"Left the team";case"phase_change":return"Changed phase";case"task_update":return"Updated task";case"message":return"Sent a message";case"sync":return"Synced activity";case"report":return"Generated report";case"discussion":return"Started discussion";default:return t}}function K(t){return`${w[t]??"#9ca3af"}12`}function G(){const t=c(n=>n.filteredActivity()),a=c(n=>n.members),r=c(n=>n.memberFilter),s=c(n=>n.typeFilter),o=c(n=>n.setMemberFilter),h=c(n=>n.setTypeFilter),p=c(n=>n.fetchActivity),x=c(n=>n.loading),[i,m]=d.useState(200);d.useEffect(()=>{p(i)},[p,i]);const g=d.useMemo(()=>{const n=[];let f="";for(const y of t){const j=V(y.ts);j!==f&&(f=j,n.push({day:j,label:F(y.ts),entries:[]})),n[n.length-1].entries.push(y)}return n},[t]),v=new Set(t.map(n=>n.user)).size,u=new Set(t.map(n=>n.action)).size;return x&&t.length===0?e.jsx("div",{className:"flex items-center justify-center h-64 text-text-secondary text-[length:var(--font-size-sm)]",children:"Loading history..."}):e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0 pb-4",children:[e.jsxs("select",{value:r,onChange:n=>o(n.target.value),className:"text-[length:var(--font-size-xs)] px-2.5 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-text-primary outline-none focus:border-text-tertiary",children:[e.jsx("option",{value:"all",children:"All members"}),a.map(n=>e.jsx("option",{value:n.uid,children:n.name},n.uid))]}),e.jsx("select",{value:s,onChange:n=>h(n.target.value),className:"text-[length:var(--font-size-xs)] px-2.5 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-text-primary outline-none focus:border-text-tertiary",children:P.map(n=>e.jsx("option",{value:n.value,children:n.label},n.value))}),(r!=="all"||s!=="all")&&e.jsx("button",{type:"button",onClick:()=>{o("all"),h("all")},className:"text-[11px] text-text-tertiary hover:text-text-primary transition-colors",children:"Clear"}),e.jsxs("div",{className:"ml-auto flex items-center gap-4 text-[11px] text-text-quaternary",children:[e.jsxs("span",{children:[t.length," events"]}),e.jsxs("span",{children:[v," users"]}),e.jsxs("span",{children:[u," types"]})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0",children:[t.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-48 gap-2",children:[e.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-text-quaternary",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}),e.jsx("span",{className:"text-text-tertiary text-[length:var(--font-size-sm)]",children:"No events match filters"})]}):e.jsx("div",{className:"flex flex-col gap-5",children:g.map(n=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3 sticky top-0 bg-bg-primary z-10 py-1",children:[e.jsx("span",{className:"text-[length:var(--font-size-xs)] font-semibold text-text-primary",children:n.label}),e.jsx("div",{className:"flex-1 h-px bg-border"}),e.jsxs("span",{className:"text-[10px] text-text-quaternary",children:[n.entries.length," events"]})]}),e.jsx("div",{className:"relative ml-5 pl-5 border-l-2 border-border",children:e.jsx("div",{className:"flex flex-col gap-1",children:n.entries.map((f,y)=>e.jsx(J,{entry:f},`${f.ts}-${f.user}-${f.action}-${y}`))})})]},n.day))}),t.length>=i&&e.jsx("div",{className:"flex justify-center py-4",children:e.jsx("button",{type:"button",onClick:()=>m(n=>n+200),className:"px-3 py-1.5 rounded-[var(--radius-md,6px)] text-[11px] font-semibold text-text-secondary hover:text-text-primary transition-all border border-border",children:"Load more"})})]})]})}function J({entry:t}){const a=w[t.action]??"#9ca3af",r=B[t.action]??"•",s=t.user.charAt(0).toUpperCase();return e.jsxs("div",{className:"relative flex items-start gap-3 py-2 group hover:bg-bg-secondary/50 rounded-r-[var(--radius-md,6px)] px-3 -ml-[21px] transition-colors",children:[e.jsx("div",{className:"absolute -left-[8px] top-[14px] w-[14px] h-[14px] rounded-full border-2 flex items-center justify-center",style:{borderColor:a,backgroundColor:"var(--color-bg-primary)"},children:e.jsx("span",{style:{fontSize:"7px",lineHeight:1,color:a},children:r})}),e.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-semibold shrink-0 ml-2",style:{backgroundColor:K(t.action),color:a},children:s}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:"text-[length:var(--font-size-sm)] font-semibold text-text-primary",children:t.user}),e.jsx("span",{className:"text-[length:var(--font-size-xs)] text-text-secondary",children:U(t.action)})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-0.5",children:[t.phase_id&&e.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-secondary border border-border text-text-tertiary",children:["Phase ",t.phase_id]}),t.task_id&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-secondary border border-border text-text-tertiary",children:t.task_id}),t.target&&e.jsx("span",{className:"text-[10px] text-text-tertiary truncate max-w-[200px]",title:t.target,children:t.target}),t.host&&e.jsxs("span",{className:"text-[10px] text-text-quaternary flex items-center gap-1",children:[e.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),e.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),e.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),t.host]})]})]}),e.jsxs("div",{className:"flex flex-col items-end shrink-0 gap-0.5",children:[e.jsx("span",{className:"text-[11px] text-text-tertiary tabular-nums",children:H(t.ts)}),e.jsx("span",{className:"text-[10px] text-text-quaternary",children:W(t.ts)})]})]})}const Y=[{label:"Overview",key:"overview",shortcut:"1"},{label:"Analysis",key:"analysis",shortcut:"2"},{label:"History",key:"history",shortcut:"3"}],C=["overview","analysis","history"],Q={initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8}};function ae(){const t=c(l=>l.members);c(l=>l.loading);const a=c(l=>l.error),r=c(l=>l.activeTab),s=c(l=>l.fetchMembers),o=c(l=>l.fetchActivity),h=c(l=>l.fetchPresence),p=c(l=>l.fetchAggregated),x=c(l=>l.fetchPreflight),i=c(l=>l.setActiveTab),m=c(l=>l.clearAll),[g,v]=d.useState(null),[u,n]=d.useState(!0),{register:f,unregister:y}=d.useContext(z),j=d.useCallback(l=>i(C[l]),[i]);return d.useEffect(()=>{f({items:Y.map(l=>({label:l.label,icon:null,shortcut:l.shortcut})),activeIndex:C.indexOf(r),onSwitch:j})},[r,f,j]),d.useEffect(()=>()=>y(),[y]),d.useEffect(()=>{function l(b){b.target instanceof HTMLInputElement||b.target instanceof HTMLTextAreaElement||(b.key==="1"?i("overview"):b.key==="2"?i("analysis"):b.key==="3"&&i("history"))}return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[i]),d.useEffect(()=>{let l=!1;return(async()=>{n(!0);const b=await x();l||(v(b),n(!1),b!=null&&b.exists&&(s(),o(),h(),p()))})(),()=>{l=!0,m()}},[]),u?e.jsx("div",{className:"flex items-center justify-center h-full text-text-secondary text-[length:var(--font-size-sm)]",children:"Loading..."}):g!=null&&g.exists?a&&t.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[e.jsx("span",{className:"text-accent-red text-[length:var(--font-size-sm)]",children:"Failed to load collaboration data"}),e.jsx("span",{className:"text-text-tertiary text-[length:var(--font-size-xs)]",children:a}),e.jsx("button",{type:"button",onClick:()=>{s(),o(),h()},className:"px-3 py-1.5 rounded-[var(--radius-md)] text-[11px] font-semibold bg-bg-secondary border border-border text-text-secondary hover:text-text-primary transition-all",children:"Retry"})]}):e.jsx("div",{className:"flex flex-col h-full overflow-hidden",children:e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(M,{mode:"popLayout",children:e.jsxs(T.div,{className:"h-full flex flex-col overflow-hidden",variants:Q,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.15},children:[r==="overview"&&e.jsx(X,{}),r==="analysis"&&e.jsx("div",{className:"p-4 h-full overflow-y-auto",children:e.jsx(I,{})}),r==="history"&&e.jsx("div",{className:"px-4 pt-4 pb-0 h-full flex flex-col overflow-visible",children:e.jsx(G,{})})]},r)})})}):e.jsx(Z,{onRefresh:async()=>{const l=await x();v(l),l!=null&&l.exists&&(s(),o(),h(),p())}})}function Z({onRefresh:t}){const a=c(x=>x.initCollab),[r,s]=d.useState(!1),[o,h]=d.useState(null);async function p(){s(!0),h(null);const x=await a();x.success?t():(h(x.error??"Unknown error"),s(!1))}return e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"max-w-[480px] w-full px-6",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"w-12 h-12 rounded-[12px] bg-bg-secondary border border-border flex items-center justify-center mx-auto mb-4",children:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-text-secondary",children:[e.jsx("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"}),e.jsx("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),e.jsx("h2",{className:"text-[length:var(--font-size-xl)] font-bold text-text-primary mb-2",children:"Team Collaboration"}),e.jsx("p",{className:"text-[length:var(--font-size-sm)] text-text-secondary leading-relaxed",children:"Track team activity, detect file conflicts, and coordinate phase assignments across multiple developers."})]}),e.jsx("div",{className:"border border-border rounded-[var(--radius-md,6px)] bg-bg-secondary p-4 mb-6",children:e.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2",children:[{label:"Member presence",desc:"Online/away/offline status"},{label:"Activity feed",desc:"Real-time team actions"},{label:"Conflict detection",desc:"Overlapping file edits"},{label:"Phase coordination",desc:"Who works on what"},{label:"Activity heatmap",desc:"Concentration analysis"},{label:"Collaboration timeline",desc:"Historical view"}].map(x=>e.jsxs("div",{className:"flex items-start gap-2 py-1",children:[e.jsx("span",{className:"w-1 h-1 rounded-full bg-accent-green mt-[7px] shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[length:var(--font-size-xs)] text-text-primary font-medium",children:x.label}),e.jsx("div",{className:"text-[10px] text-text-tertiary",children:x.desc})]})]},x.label))})}),e.jsxs("div",{className:"text-center",children:[e.jsx("button",{type:"button",onClick:p,disabled:r,className:"px-5 py-2.5 rounded-[var(--radius-md,6px)] text-[length:var(--font-size-sm)] font-semibold bg-text-primary text-bg-primary hover:opacity-90 transition-opacity disabled:opacity-50",children:r?"Initializing...":"Enable Team Collaboration"}),o&&e.jsx("p",{className:"text-[length:var(--font-size-xs)] text-accent-red mt-2",children:o}),e.jsx("p",{className:"text-[10px] text-text-quaternary mt-2",children:"Creates .workflow/collab/ and registers you as the team owner"})]})]})})}function X(){const t=c(o=>o.members),a=c(o=>o.presence),r=a.filter(o=>o.status==="online").length,s=a.filter(o=>o.status==="away").length;return e.jsxs("div",{className:"flex h-full overflow-hidden",children:[e.jsxs("div",{className:"flex-1 min-w-0 overflow-y-auto p-4",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-4 text-[length:var(--font-size-xs)]",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-[#22c55e]"}),e.jsxs("span",{className:"text-text-secondary",children:[r," online"]})]}),s>0&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-[#eab308]"}),e.jsxs("span",{className:"text-text-secondary",children:[s," away"]})]}),e.jsxs("span",{className:"text-text-quaternary",children:[t.length," members total"]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[e.jsx(ee,{}),e.jsx(S,{label:"Sync Activity",command:"maestro team sync",icon:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"23 4 23 10 17 10"}),e.jsx("polyline",{points:"1 20 1 14 7 14"}),e.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]})}),e.jsx(S,{label:"Team Status",command:"maestro team status",icon:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M22 12h-4l-3 9L9 3l-3 9H2"})})})]}),e.jsx(R,{})]}),e.jsxs("div",{className:"w-[320px] shrink-0 border-l border-border flex flex-col h-full bg-bg-primary",children:[e.jsx("div",{className:"px-4 py-3 border-b border-border",children:e.jsx("h3",{className:"text-[length:var(--font-size-sm)] font-semibold text-text-primary",children:"Activity"})}),e.jsx("div",{className:"flex-1 overflow-hidden px-4 py-2",children:e.jsx(E,{})})]})]})}function ee(){const t=c(u=>u.addMember),[a,r]=d.useState(!1),[s,o]=d.useState(""),[h,p]=d.useState("member"),[x,i]=d.useState(!1),[m,g]=d.useState(null);async function v(u){u.preventDefault();const n=s.trim();if(!n)return;i(!0),g(null);const f=await t(n,"",h);i(!1),f.success?(o(""),p("member"),r(!1)):g(f.error??"Failed to add member")}return a?e.jsxs("form",{onSubmit:v,className:"flex items-center gap-1.5",children:[e.jsx("input",{autoFocus:!0,value:s,onChange:u=>o(u.target.value),placeholder:"Name",className:"w-[120px] px-2 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-[11px] text-text-primary placeholder:text-text-quaternary outline-none focus:border-text-tertiary"}),e.jsxs("select",{value:h,onChange:u=>p(u.target.value),className:"px-1.5 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-[11px] text-text-secondary outline-none",children:[e.jsx("option",{value:"member",children:"Member"}),e.jsx("option",{value:"admin",children:"Admin"}),e.jsx("option",{value:"viewer",children:"Viewer"})]}),e.jsx("button",{type:"submit",disabled:x||!s.trim(),className:"px-2.5 py-1.5 rounded-[var(--radius-md,6px)] text-[11px] font-semibold bg-text-primary text-bg-primary hover:opacity-90 transition-opacity disabled:opacity-40",children:x?"...":"Add"}),e.jsx("button",{type:"button",onClick:()=>{r(!1),g(null)},className:"px-1.5 py-1.5 text-[11px] text-text-tertiary hover:text-text-primary",children:"Cancel"}),m&&e.jsx("span",{className:"text-[10px] text-accent-red",children:m})]}):e.jsxs("button",{type:"button",onClick:()=>r(!0),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-[11px] font-medium text-text-secondary hover:text-text-primary hover:bg-bg-secondary transition-all",children:[e.jsx("span",{className:"text-text-tertiary",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"8.5",cy:"7",r:"4"}),e.jsx("line",{x1:"20",y1:"8",x2:"20",y2:"14"}),e.jsx("line",{x1:"23",y1:"11",x2:"17",y2:"11"})]})}),e.jsx("span",{children:"Add Member"})]})}function S({label:t,command:a,icon:r}){const[s,o]=d.useState(!1);return e.jsxs("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(a),o(!0),setTimeout(()=>o(!1),1500)},title:`Copy: ${a}`,className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-[11px] font-medium text-text-secondary hover:text-text-primary hover:bg-bg-secondary transition-all",children:[e.jsx("span",{className:"text-text-tertiary",children:r}),e.jsx("span",{children:s?"Copied!":t})]})}export{ae as CollabPage};