react-virtuoso 4.18.16 → 4.18.17

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.
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("react/jsx-runtime"),R=require("react"),po=require("react-dom"),Ce=0,Wt=1,Yt=2,Vn=4;function fn(t){return()=>t}function ho(t){t()}function ne(t,e){return n=>t(e(n))}function mn(t,e){return()=>t(e)}function go(t,e){return n=>t(e,n)}function Ae(t){return t!==void 0}function xo(...t){return()=>{t.map(ho)}}function Zt(){}function we(t,e){return e(t),t}function Io(t,e){return e(t)}function st(...t){return t}function X(t,e){return t(Wt,e)}function A(t,e){t(Ce,e)}function je(t){t(Yt)}function lt(t){return t(Vn)}function L(t,e){return X(t,go(e,Ce))}function bt(t,e){const n=t(Wt,o=>{n(),e(o)});return n}function pn(t){let e,n;return o=>r=>{e=r,n&&clearTimeout(n),n=setTimeout(()=>{o(e)},t)}}function Pn(t,e){return t===e}function ot(t=Pn){let e;return n=>o=>{t(e,o)||(e=o,n(o))}}function G(t){return e=>n=>{t(n)&&e(n)}}function k(t){return e=>ne(e,t)}function kt(t){return e=>()=>{e(t)}}function I(t,...e){const n=So(...e);return((o,r)=>{switch(o){case Yt:je(t);return;case Wt:return X(t,n(r))}})}function Bt(t,e){return n=>o=>{n(e=t(e,o))}}function Nt(t){return e=>n=>{t>0?t--:e(n)}}function zt(t){let e=null,n;return o=>r=>{e=r,!n&&(n=setTimeout(()=>{n=void 0,o(e)},t))}}function N(...t){const e=Array.from({length:t.length});let n=0,o=null;const r=2**t.length-1;return t.forEach((s,i)=>{const l=2**i;X(s,c=>{const d=n;n|=l,e[i]=c,d!==r&&n===r&&o&&(o(),o=null)})}),s=>i=>{const l=()=>{s([i].concat(e))};n===r?l():o=l}}function So(...t){return e=>t.reduceRight(Io,e)}function vo(t){let e,n;const o=()=>e?.();return function(r,s){switch(r){case Wt:return s?n===s?void 0:(o(),n=s,e=X(t,s),e):(o(),Zt);case Yt:o(),n=null;return}}}function w(t){let e=t;const n=U();return((o,r)=>{switch(o){case Ce:e=r;break;case Wt:{r(e);break}case Vn:return e}return n(o,r)})}function gt(t,e){return we(w(e),n=>L(t,n))}function U(){const t=[];return((e,n)=>{switch(e){case Ce:t.slice().forEach(o=>{o(n)});return;case Yt:t.splice(0);return;case Wt:return t.push(n),()=>{const o=t.indexOf(n);o>-1&&t.splice(o,1)}}})}function Ct(t){return we(U(),e=>L(t,e))}const To={singleton:!0};function Z(t,e=[],n=To){const{singleton:o}=n;return{constructor:t,dependencies:e,id:Co(),singleton:o}}const Co=()=>Symbol("id");function wo(t){const e=new Map,n=({constructor:o,dependencies:r,id:s,singleton:i})=>{if(i&&e.has(s))return e.get(s);const l=o(r.map(c=>n(c)));return i&&e.set(s,l),l};return n(t)}function at(...t){const e=U(),n=Array.from({length:t.length});let o=0;const r=2**t.length-1;return t.forEach((s,i)=>{const l=2**i;X(s,c=>{n[i]=c,o|=l,o===r&&A(e,n)})}),function(s,i){switch(s){case Yt:{je(e);return}case Wt:return o===r&&i(n),X(e,i)}}}function W(t,e=Pn){return I(t,ot(e))}function ze(...t){return function(e,n){switch(e){case Yt:return;case Wt:return xo(...t.map(o=>X(o,n)))}}}const dt={DEBUG:0,INFO:1,WARN:2,ERROR:3},yo={[dt.DEBUG]:"debug",[dt.ERROR]:"error",[dt.INFO]:"log",[dt.WARN]:"warn"},bo=()=>typeof globalThis>"u"?window:globalThis,Gt=Z(()=>{const t=w(dt.ERROR);return{log:w((n,o,r=dt.INFO)=>{const s=bo().VIRTUOSO_LOG_LEVEL??lt(t);r>=s&&console[yo[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,o)}),logLevel:t}},[],{singleton:!0});function Ro(t){return"self"in t?t.document.documentElement:t}function Wn(t){const e=Ro(t);return e.ownerDocument.defaultView.getComputedStyle(e).direction==="rtl"}function jt(t,e){return Wn(t)?-e:e}function hn(t,e){return Wn(t)?-e:e}function Ot(t,e,n){return _e(t,e,n).callbackRef}function _e(t,e,n){const o=R.useRef(null);let r=i=>{};const s=R.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(i=>{const l=()=>{const c=i[0].target;c.offsetParent!==null&&t(c)};n?l():requestAnimationFrame(l)}):null,[t,n]);return r=i=>{i&&e?(s?.observe(i),o.current=i):(o.current&&s?.unobserve(o.current),o.current=null)},{callbackRef:r,ref:o}}function Gn(t,e,n,o,r,s,i,l,c){const d=R.useCallback(f=>{const v=Eo(f.children,e,l?"offsetWidth":"offsetHeight",r);let m=f.parentElement;for(;m.dataset.virtuosoScroller===void 0;)m=m.parentElement;const h=m.lastElementChild?.dataset.viewportType==="window";let y;h&&(y=m.ownerDocument.defaultView);const E=i?l?i.scrollWidth:i.scrollHeight:h?l?y.document.documentElement.scrollWidth:y.document.documentElement.scrollHeight:l?m.scrollWidth:m.scrollHeight,x=i?l?i.offsetWidth:i.offsetHeight:h?l?y.innerWidth:y.innerHeight:l?m.offsetWidth:m.offsetHeight,g=i?l?jt(i,i.scrollLeft):i.scrollTop:h?l?jt(y,y.scrollX||y.document.documentElement.scrollLeft):y.scrollY||y.document.documentElement.scrollTop:l?jt(m,m.scrollLeft):m.scrollTop;o({scrollHeight:E,scrollTop:Math.max(g,0),viewportHeight:x}),s?.(l?gn("column-gap",getComputedStyle(f).columnGap,r):gn("row-gap",getComputedStyle(f).rowGap,r)),v!==null&&t(v)},[t,e,r,s,i,o,l]);return _e(d,n,c)}function Eo(t,e,n,o){const r=t.length;if(r===0)return null;const s=[];for(let i=0;i<r;i++){const l=t.item(i);if(l.dataset.index===void 0)continue;const c=parseInt(l.dataset.index,10),d=parseFloat(l.dataset.knownSize),f=e(l,n);if(f===0&&o("Zero-sized element, this should not happen",{child:l},dt.ERROR),f===d)continue;const v=s[s.length-1];s.length===0||v.size!==f||v.endIndex!==c-1?s.push({endIndex:c,size:f,startIndex:c}):s[s.length-1].endIndex++}return s}function gn(t,e,n){return e!=="normal"&&e?.endsWith("px")!==!0&&n(`${t} was not resolved to pixel value correctly`,e,dt.WARN),e==="normal"?0:parseInt(e??"0",10)}const ye=typeof document>"u"?R.useEffect:R.useLayoutEffect;function Ne(t,e,n){const o=R.useRef(null),r=R.useCallback(c=>{if(!c?.offsetParent)return;const d=c.getBoundingClientRect(),f=d.width;let v,m;if(e){const h=e.getBoundingClientRect(),y=d.top-h.top;m=h.height-Math.max(0,y),v=y+e.scrollTop}else{const h=i.current.ownerDocument.defaultView;m=h.innerHeight-Math.max(0,d.top),v=d.top+h.scrollY}o.current={listHeight:d.height,offsetTop:v,visibleHeight:m,visibleWidth:f},t(o.current)},[t,e]),{callbackRef:s,ref:i}=_e(r,!0,n),l=R.useCallback(()=>{r(i.current)},[r,i]);return R.useEffect(()=>{if(e){e.addEventListener("scroll",l);const d=new ResizeObserver(()=>{requestAnimationFrame(l)});return d.observe(e),()=>{e.removeEventListener("scroll",l),d.unobserve(e)}}const c=i.current?.ownerDocument.defaultView;return c?.addEventListener("scroll",l),c?.addEventListener("resize",l),()=>{c?.removeEventListener("scroll",l),c?.removeEventListener("resize",l)}},[l,e,i]),s}const It=Z(()=>{const t=U(),e=U(),n=w(0),o=U(),r=U(),s=w(0),i=U(),l=U(),c=w(0),d=w(0),f=w(0),v=w(0),m=U(),h=U(),y=w(!1),E=w(!1),x=w(!1);return L(I(t,k(({scrollTop:g})=>g)),e),L(I(t,k(({scrollHeight:g})=>g)),l),L(e,s),{deviation:n,deviationCommitted:o,fixedFooterHeight:f,fixedHeaderHeight:d,footerHeight:v,headerHeight:c,horizontalDirection:E,scrollBy:h,scrollContainerState:t,scrollHeight:l,scrollingInProgress:y,scrollTo:m,scrollTop:e,skipAnimationFrameInResizeObserver:x,smoothScrollTargetReached:r,statefulScrollTop:s,viewportHeight:i}},[],{singleton:!0}),oe={lvl:0};function Mn(t,e){const n=t.length;if(n===0)return[];let{index:o,value:r}=e(t[0]);const s=[];for(let i=1;i<n;i++){const{index:l,value:c}=e(t[i]);s.push({end:l-1,start:o,value:r}),o=l,r=c}return s.push({end:1/0,start:o,value:r}),s}function tt(t){return t===oe}function re(t,e){if(!tt(t))return e===t.k?t.v:e<t.k?re(t.l,e):re(t.r,e)}function Rt(t,e,n="k"){if(tt(t))return[-1/0,void 0];if(Number(t[n])===e)return[t.k,t.v];if(Number(t[n])<e){const o=Rt(t.r,e,n);return o[0]===-1/0?[t.k,t.v]:o}return Rt(t.l,e,n)}function vt(t,e,n){return tt(t)?_n(e,n,1):e===t.k?mt(t,{k:e,v:n}):e<t.k?xn(mt(t,{l:vt(t.l,e,n)})):xn(mt(t,{r:vt(t.r,e,n)}))}function Kt(){return oe}function qt(t,e,n){if(tt(t))return[];const o=Rt(t,e)[0];return Ho(Ve(t,o,n))}function Fe(t,e){if(tt(t))return oe;const{k:n,l:o,r}=t;if(e===n){if(tt(o))return r;if(tt(r))return o;const[s,i]=jn(o);return Ie(mt(t,{k:s,l:An(o),v:i}))}return e<n?Ie(mt(t,{l:Fe(o,e)})):Ie(mt(t,{r:Fe(r,e)}))}function _t(t){return tt(t)?[]:[..._t(t.l),{k:t.k,v:t.v},..._t(t.r)]}function Ve(t,e,n){if(tt(t))return[];const{k:o,l:r,r:s,v:i}=t;let l=[];return o>e&&(l=l.concat(Ve(r,e,n))),o>=e&&o<=n&&l.push({k:o,v:i}),o<=n&&(l=l.concat(Ve(s,e,n))),l}function Ie(t){const{l:e,lvl:n,r:o}=t;if(o.lvl>=n-1&&e.lvl>=n-1)return t;if(n>o.lvl+1){if(He(e))return Nn(mt(t,{lvl:n-1}));if(!tt(e)&&!tt(e.r))return mt(e.r,{l:mt(e,{r:e.r.l}),lvl:n,r:mt(t,{l:e.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}if(He(t))return Pe(mt(t,{lvl:n-1}));if(!tt(o)&&!tt(o.l)){const r=o.l,s=He(r)?o.lvl-1:o.lvl;return mt(r,{l:mt(t,{lvl:n-1,r:r.l}),lvl:r.lvl+1,r:Pe(mt(o,{l:r.r,lvl:s}))})}throw new Error("Unexpected empty nodes")}function mt(t,e){return _n(e.k===void 0?t.k:e.k,e.v===void 0?t.v:e.v,e.lvl===void 0?t.lvl:e.lvl,e.l===void 0?t.l:e.l,e.r===void 0?t.r:e.r)}function An(t){return tt(t.r)?t.l:Ie(mt(t,{r:An(t.r)}))}function He(t){return tt(t)||t.lvl>t.r.lvl}function jn(t){return tt(t.r)?[t.k,t.v]:jn(t.r)}function _n(t,e,n,o=oe,r=oe){return{k:t,l:o,lvl:n,r,v:e}}function xn(t){return Pe(Nn(t))}function Nn(t){const{l:e}=t;return!tt(e)&&e.lvl===t.lvl?mt(e,{r:mt(t,{l:e.r})}):t}function Pe(t){const{lvl:e,r:n}=t;return!tt(n)&&!tt(n.r)&&n.lvl===e&&n.r.lvl===e?mt(n,{l:mt(t,{r:n.l}),lvl:e+1}):t}function Ho(t){return Mn(t,({k:e,v:n})=>({index:e,value:n}))}function Dn(t,e){return!!(t&&t.startIndex===e.startIndex&&t.endIndex===e.endIndex)}function se(t,e){return!!(t&&t[0]===e[0]&&t[1]===e[1])}const De=Z(()=>({recalcInProgress:w(!1)}),[],{singleton:!0});function $n(t,e,n){return t[ve(t,e,n)]}function ve(t,e,n,o=0){let r=t.length-1;for(;o<=r;){const s=Math.floor((o+r)/2),i=t[s],l=n(i,e);if(l===0)return s;if(l===-1){if(r-o<2)return s-1;r=s-1}else{if(r===o)return s;o=s+1}}throw new Error(`Failed binary finding record in array - ${t.join(",")}, searched for ${e}`)}function ko(t,e,n,o){const r=ve(t,e,o),s=ve(t,n,o,r);return t.slice(r,s+1)}function Et(t,e){return Math.round(t.getBoundingClientRect()[e])}function be(t){return!tt(t.groupOffsetTree)}function $e({index:t},e){return e===t?0:e<t?-1:1}function Bo(){return{groupIndices:[],groupOffsetTree:Kt(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Kt()}}function Oo(t,e){let n=tt(t)?0:1/0;for(const o of e){const{endIndex:r,size:s,startIndex:i}=o;if(n=Math.min(n,i),tt(t)){t=vt(t,0,s);continue}const l=qt(t,i-1,r+1);if(l.some(Go(o)))continue;let c=!1,d=!1;for(const{end:f,start:v,value:m}of l)c?(r>=v||s===m)&&(t=Fe(t,v)):(d=m!==s,c=!0),f>r&&r>=v&&m!==s&&(t=vt(t,r+1,m));d&&(t=vt(t,i,s))}return[t,n]}function Lo(t){return t.groupIndex!==void 0}function zo({offset:t},e){return e===t?0:e<t?-1:1}function ie(t,e,n){if(e.length===0)return 0;const{index:o,offset:r,size:s}=$n(e,t,$e),i=t-o,l=s*i+(i-1)*n+r;return l>0?l+n:l}function Un(t,e){if(!be(e))return t;let n=0;for(;e.groupIndices[n]<=t+n;)n++;return t+n}function Kn(t,e,n){if(Lo(t))return e.groupIndices[t.groupIndex]+1;const o=t.index==="LAST"?n:t.index;let r=Un(o,e);return r=Math.max(0,Math.min(n,r)),r}function Fo(t,e,n,o=0){return o>0&&(e=Math.max(e,$n(t,o,$e).offset)),Mn(ko(t,e,n,zo),Wo)}function Vo(t,[e,n,o,r]){e.length>0&&o("received item sizes",e,dt.DEBUG);const s=t.sizeTree;let i=s,l=0;if(n.length>0&&tt(s)&&e.length===2){const m=e[0].size,h=e[1].size;i=n.reduce((y,E)=>vt(vt(y,E,m),E+1,h),i)}else[i,l]=Oo(i,e);if(i===s)return t;const{lastIndex:c,lastOffset:d,lastSize:f,offsetTree:v}=We(t.offsetTree,l,i,r);return{groupIndices:n,groupOffsetTree:n.reduce((m,h)=>vt(m,h,ie(h,v,r)),Kt()),lastIndex:c,lastOffset:d,lastSize:f,offsetTree:v,sizeTree:i}}function Po(t){return _t(t).map(({k:e,v:n},o,r)=>{const s=r[o+1];return{endIndex:s===void 0?1/0:s.k-1,size:n,startIndex:e}})}function In(t,e){let n=0,o=0;for(;n<t;)n+=e[o+1]-e[o]-1,o++;return o-(n===t?0:1)}function We(t,e,n,o){let r=t,s=0,i=0,l=0,c=0;if(e===0)r=[];else{c=ve(r,e-1,$e),l=r[c].offset;const f=Rt(n,e-1);s=f[0],i=f[1],r.length&&r[c].size===Rt(n,e)[1]&&(c-=1),r=r.slice(0,c+1)}for(const{start:d,value:f}of qt(n,e,1/0)){const v=d-s,m=v*i+l+v*o;r.push({index:d,offset:m,size:f}),s=d,l=m,i=f}return{lastIndex:s,lastOffset:l,lastSize:i,offsetTree:r}}function Wo(t){return{index:t.index,value:t}}function Go(t){const{endIndex:e,size:n,startIndex:o}=t;return r=>r.start===o&&(r.end===e||r.end===1/0)&&r.value===n}const Mo={offsetHeight:"height",offsetWidth:"width"},Lt=Z(([{log:t},{recalcInProgress:e}])=>{const n=U(),o=U(),r=gt(o,0),s=U(),i=U(),l=w(0),c=w([]),d=w(void 0),f=w(void 0),v=w(void 0),m=w(void 0),h=w((u,p)=>Et(u,Mo[p])),y=w(void 0),E=w(0),x=Bo(),g=gt(I(n,N(c,t,E),Bt(Vo,x),ot()),x),a=gt(I(c,ot(),Bt((u,p)=>({current:p,prev:u.current}),{current:[],prev:[]}),k(({prev:u})=>u)),[]);L(I(c,G(u=>u.length>0),N(g,E),k(([u,p,b])=>{const z=u.reduce((F,O,P)=>vt(F,O,ie(O,p.offsetTree,b)||P),Kt());return{...p,groupIndices:u,groupOffsetTree:z}})),g),L(I(o,N(g),G(([u,{lastIndex:p}])=>u<p),k(([u,{lastIndex:p,lastSize:b}])=>[{endIndex:p,size:b,startIndex:u}])),n),L(d,f);const T=gt(I(d,k(u=>u===void 0)),!0);L(I(f,G(u=>u!==void 0&&tt(lt(g).sizeTree)),k(u=>{const p=lt(v),b=lt(c).length>0;return p!==void 0&&p!==0?b?[{endIndex:0,size:p,startIndex:0},{endIndex:1,size:u,startIndex:1}]:[]:[{endIndex:0,size:u,startIndex:0}]})),n),L(I(m,G(u=>u!==void 0&&u.length>0&&tt(lt(g).sizeTree)),k(u=>{const p=[];let b=u[0],z=0;for(let F=1;F<u.length;F++){const O=u[F];O!==b&&(p.push({endIndex:F-1,size:b,startIndex:z}),b=O,z=F)}return p.push({endIndex:u.length-1,size:b,startIndex:z}),p})),n),L(I(c,N(v,f),G(([,u,p])=>u!==void 0&&p!==void 0),k(([u,p,b])=>{const z=[];for(let F=0;F<u.length;F++){const O=u[F],P=u[F+1];z.push({startIndex:O,endIndex:O,size:p}),P!==void 0&&z.push({startIndex:O+1,endIndex:P-1,size:b})}return z})),n);const S=Ct(I(n,N(g),Bt(({sizes:u},[p,b])=>({changed:b!==u,sizes:b}),{changed:!1,sizes:x}),k(u=>u.changed)));X(I(l,Bt((u,p)=>({diff:u.prev-p,prev:p}),{diff:0,prev:0}),k(u=>u.diff)),u=>{const{groupIndices:p}=lt(g);if(u>0)A(e,!0),A(s,u+In(u,p));else if(u<0){const b=lt(a);b.length>0&&(u-=In(-u,b)),A(i,u)}}),X(I(l,N(t)),([u,p])=>{u<0&&p("`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:l},dt.ERROR)});const C=Ct(s);L(I(s,N(g),k(([u,p])=>{const b=p.groupIndices.length>0,z=[],F=p.lastSize;if(b){const O=re(p.sizeTree,0);let P=0,$=0;for(;P<u;){const K=p.groupIndices[$],J=p.groupIndices.length===$+1?1/0:p.groupIndices[$+1]-K-1;z.push({endIndex:K,size:O,startIndex:K}),z.push({endIndex:K+1+J-1,size:F,startIndex:K+1}),$++,P+=J+1}const q=_t(p.sizeTree);return P!==u&&q.shift(),q.reduce((K,{k:J,v:ft})=>{let pt=K.ranges;return K.prevSize!==0&&(pt=[...K.ranges,{endIndex:J+u-1,size:K.prevSize,startIndex:K.prevIndex}]),{prevIndex:J+u,prevSize:ft,ranges:pt}},{prevIndex:u,prevSize:0,ranges:z}).ranges}return _t(p.sizeTree).reduce((O,{k:P,v:$})=>({prevIndex:P+u,prevSize:$,ranges:[...O.ranges,{endIndex:P+u-1,size:O.prevSize,startIndex:O.prevIndex}]}),{prevIndex:0,prevSize:F,ranges:[]}).ranges})),n);const B=Ct(I(i,N(g,E),k(([u,{offsetTree:p},b])=>{const z=-u;return ie(z,p,b)})));return L(I(i,N(g,E),k(([u,p,b])=>{if(p.groupIndices.length>0){if(tt(p.sizeTree))return p;let O=Kt();const P=lt(a);let $=0,q=0,D=0;for(;$<-u;){D=P[q];const J=P[q+1]-D-1;q++,$+=J+1}if(O=_t(p.sizeTree).reduce((J,{k:ft,v:pt})=>vt(J,Math.max(0,ft+u),pt),O),$!==-u){const J=re(p.sizeTree,D);O=vt(O,0,J);const ft=Rt(p.sizeTree,-u+1)[1];O=vt(O,1,ft)}return{...p,sizeTree:O,...We(p.offsetTree,0,O,b)}}const F=_t(p.sizeTree).reduce((O,{k:P,v:$})=>vt(O,Math.max(0,P+u),$),Kt());return{...p,sizeTree:F,...We(p.offsetTree,0,F,b)}})),g),{beforeUnshiftWith:C,data:y,defaultItemSize:f,firstItemIndex:l,fixedItemSize:d,fixedGroupSize:v,gap:E,groupIndices:c,heightEstimates:m,itemSize:h,listRefresh:S,shiftWith:i,shiftWithOffset:B,sizeRanges:n,sizes:g,statefulTotalCount:r,totalCount:o,trackItemSizes:T,unshiftWith:s}},st(Gt,De),{singleton:!0});function Ao(t){return t.reduce((e,n)=>(e.groupIndices.push(e.totalCount),e.totalCount+=n+1,e),{groupIndices:[],totalCount:0})}const qn=Z(([{groupIndices:t,sizes:e,totalCount:n},{headerHeight:o,scrollTop:r}])=>{const s=U(),i=U(),l=Ct(I(s,k(Ao)));return L(I(l,k(c=>c.totalCount)),n),L(I(l,k(c=>c.groupIndices)),t),L(I(at(r,e,o),G(([c,d])=>be(d)),k(([c,d,f])=>Rt(d.groupOffsetTree,Math.max(c-f,0),"v")[0]),ot(),k(c=>[c])),i),{groupCounts:s,topItemsIndexes:i}},st(Lt,It)),Mt=Z(([{log:t}])=>{const e=w(!1),n=Ct(I(e,G(o=>o),ot()));return X(e,o=>{o&&lt(t)("props updated",{},dt.DEBUG)}),{didMount:n,propsReady:e}},st(Gt),{singleton:!0}),jo=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Yn(t){const e=typeof t=="number"?{index:t}:{...t};return e.align||(e.align="start"),(!e.behavior||!jo)&&(e.behavior="auto"),e.offset===void 0&&(e.offset=0),e}const ae=Z(([{gap:t,listRefresh:e,sizes:n,totalCount:o},{fixedFooterHeight:r,fixedHeaderHeight:s,footerHeight:i,headerHeight:l,scrollingInProgress:c,scrollTo:d,smoothScrollTargetReached:f,viewportHeight:v},{log:m}])=>{const h=U(),y=U(),E=w(0);let x=null,g=null,a=null;function T(){x!==null&&(x(),x=null),a!==null&&(a(),a=null),g&&(clearTimeout(g),g=null),A(c,!1)}return L(I(h,N(n,v,o,E,l,i,m),N(t,s,r),k(([[S,C,B,u,p,b,z,F],O,P,$])=>{const q=Yn(S),{align:D,behavior:K,offset:J}=q,ft=u-1,pt=Kn(q,C,ft);let xt=ie(pt,C.offsetTree,O)+b;D==="end"?(xt+=P+Rt(C.sizeTree,pt)[1]-B+$,pt===ft&&(xt+=z)):D==="center"?xt+=(P+Rt(C.sizeTree,pt)[1]-B+$)/2:xt-=p,J!==void 0&&J!==0&&(xt+=J);const Ft=ht=>{T(),ht?(F("retrying to scroll to",{location:S},dt.DEBUG),A(h,S)):(A(y,!0),F("list did not change, scroll successful",{},dt.DEBUG))};if(T(),K==="smooth"){let ht=!1;a=X(e,$t=>{ht=ht||$t}),x=bt(f,()=>{Ft(ht)})}else x=bt(I(e,_o(150)),Ft);return g=setTimeout(()=>{T()},1200),A(c,!0),F("scrolling from index to",{behavior:K,index:pt,top:xt},dt.DEBUG),{behavior:K,top:xt}})),d),{scrollTargetReached:y,scrollToIndex:h,topListHeight:E}},st(Lt,It,Gt),{singleton:!0});function _o(t){return e=>{const n=setTimeout(()=>{e(!1)},t);return o=>{o&&(e(!0),clearTimeout(n))}}}function Ue(t,e){t===0?e():requestAnimationFrame(()=>{Ue(t-1,e)})}function Ke(t,e){if(t===void 0)return 0;const n=e-1,o=typeof t=="number"?t:t.index==="LAST"?n:t.index;return Math.max(0,Math.min(o,n))}function Ge(t){return t===void 0?!0:typeof t=="number"?t===0:t.index===0&&(t.align===void 0||t.align==="start")&&(t.offset===void 0||t.offset===0)}const de=Z(([{defaultItemSize:t,listRefresh:e,sizes:n},{scrollTop:o},{scrollTargetReached:r,scrollToIndex:s},{didMount:i}])=>{const l=w(!0),c=w(0),d=w(!0);return L(I(i,N(c),G(([f,v])=>!Ge(v)),kt(!1)),l),L(I(i,N(c),G(([f,v])=>!Ge(v)),kt(!1)),d),X(I(at(e,i),N(l,n,t,d),G(([[,f],v,{sizeTree:m},h,y])=>f&&(!tt(m)||Ae(h))&&!v&&!y),N(c)),([,f])=>{if(f===void 0){A(l,!0),A(d,!0);return}bt(r,()=>{A(d,!0)}),Ue(4,()=>{bt(o,()=>{A(l,!0)}),A(s,f)})}),{initialItemFinalLocationReached:d,initialTopMostItemIndex:c,scrolledToInitialItem:l}},st(Lt,It,ae,Mt),{singleton:!0});function Zn(t,e){return Math.abs(t-e)<1.01}const le="up",te="down",No="none",Do={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},$o=0,fe=Z(([{footerHeight:t,headerHeight:e,scrollBy:n,scrollContainerState:o,scrollTop:r,viewportHeight:s}])=>{const i=w(!1),l=w(!0),c=U(),d=U(),f=w(4),v=w($o),m=gt(I(ze(I(W(r),Nt(1),kt(!0)),I(W(r),Nt(1),kt(!1),pn(100))),ot()),!1),h=gt(I(ze(I(n,kt(!0)),I(n,kt(!1),pn(200))),ot()),!1);L(I(at(W(r),W(v)),k(([a,T])=>a<=T),ot()),l),L(I(l,zt(50)),d);const y=Ct(I(at(o,W(s),W(e),W(t),W(f)),Bt((a,[{scrollHeight:T,scrollTop:S},C,B,u,p])=>{const b=S+C-T>-p,z={scrollHeight:T,scrollTop:S,viewportHeight:C};if(b){let O,P;return S>a.state.scrollTop?(O="SCROLLED_DOWN",P=a.state.scrollTop-S):(O="SIZE_DECREASED",P=a.state.scrollTop-S||a.scrollTopDelta),{atBottom:!0,atBottomBecause:O,scrollTopDelta:P,state:z}}let F;return z.scrollHeight>a.state.scrollHeight?F="SIZE_INCREASED":C<a.state.viewportHeight?F="VIEWPORT_HEIGHT_DECREASING":S<a.state.scrollTop?F="SCROLLING_UPWARDS":F="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:F,state:z}},Do),ot((a,T)=>a!==void 0&&a.atBottom===T.atBottom))),E=gt(I(o,Bt((a,{scrollHeight:T,scrollTop:S,viewportHeight:C})=>{if(!Zn(a.scrollHeight,T)){const B=T-(S+C)<1;return a.scrollTop!==S&&B?{changed:!0,jump:a.scrollTop-S,scrollHeight:T,scrollTop:S}:{changed:!0,jump:0,scrollHeight:T,scrollTop:S}}return{changed:!1,jump:0,scrollHeight:T,scrollTop:S}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),G(a=>a.changed),k(a=>a.jump)),0);L(I(y,k(a=>a.atBottom)),i),L(I(i,zt(50)),c);const x=w(te);L(I(o,k(({scrollTop:a})=>a),ot(),Bt((a,T)=>lt(h)?{direction:a.direction,prevScrollTop:T}:{direction:T<a.prevScrollTop?le:te,prevScrollTop:T},{direction:te,prevScrollTop:0}),k(a=>a.direction)),x),L(I(o,zt(50),kt(No)),x);const g=w(0);return L(I(m,G(a=>!a),kt(0)),g),L(I(r,zt(100),N(m),G(([a,T])=>T),Bt(([a,T],[S])=>[T,S],[0,0]),k(([a,T])=>T-a)),g),{atBottomState:y,atBottomStateChange:c,atBottomThreshold:f,atTopStateChange:d,atTopThreshold:v,isAtBottom:i,isAtTop:l,isScrolling:m,lastJumpDueToItemResize:E,scrollDirection:x,scrollVelocity:g}},st(It)),ce="top",ue="bottom",Sn="none";function vn(t,e,n){return typeof t=="number"?n===le&&e===ce||n===te&&e===ue?t:0:n===le?e===ce?t.main:t.reverse:e===ue?t.main:t.reverse}function Tn(t,e){return typeof t=="number"?t:t[e]??0}const qe=Z(([{deviation:t,fixedHeaderHeight:e,headerHeight:n,scrollTop:o,viewportHeight:r}])=>{const s=U(),i=w(0),l=w(0),c=w(0),d=gt(I(at(W(o),W(r),W(n),W(s,se),W(c),W(i),W(e),W(t),W(l)),k(([f,v,m,[h,y],E,x,g,a,T])=>{const S=f-a,C=x+g,B=Math.max(m-S,0);let u=Sn;const p=Tn(T,ce),b=Tn(T,ue);return h-=a,h+=m+g,y+=m+g,y-=a,h>f+C-p&&(u=le),y<f-B+v+b&&(u=te),u!==Sn?[Math.max(S-m-vn(E,ce,u)-p,0),S-B-g+v+vn(E,ue,u)+b]:null}),G(f=>f!==null),ot(se)),[0,0]);return{increaseViewportBy:l,listBoundary:s,overscan:c,topListHeight:i,visibleRange:d}},st(It),{singleton:!0});function Uo(t,e,n){if(be(e)){const o=Un(t,e);return[{index:Rt(e.groupOffsetTree,o)[0],offset:0,size:0},{data:n?.[0],index:o,offset:0,size:0}]}return[{data:n?.[0],index:t,offset:0,size:0}]}const ke={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Se(t,e,n,o,r,s){const{lastIndex:i,lastOffset:l,lastSize:c}=r;let d=0,f=0;if(t.length>0){d=t[0].offset;const E=t[t.length-1];f=E.offset+E.size}const v=n-i,m=l+v*c+(v-1)*o,h=d,y=m-f;return{bottom:f,firstItemIndex:s,items:Cn(t,r,s),offsetBottom:y,offsetTop:d,top:h,topItems:Cn(e,r,s),topListHeight:e.reduce((E,x)=>x.size+E,0),totalCount:n}}function Xn(t,e,n,o,r,s){let i=0;if(n.groupIndices.length>0)for(const h of n.groupIndices){if(h-i>=t)break;i++}const l=t+i,c=s!==void 0,d=s?.length??0,f=Ke(e,c?d:l),v=c?Math.max(0,Math.min(l,d-f)):l,m=Array.from({length:v}).map((h,y)=>({data:s?.[y+f],index:y+f,offset:0,size:0}));return Se(m,[],v,r,n,o)}function Cn(t,e,n){if(t.length===0)return[];if(!be(e))return t.map(d=>({...d,index:d.index+n,originalIndex:d.index}));const o=t[0].index,r=t[t.length-1].index,s=[],i=qt(e.groupOffsetTree,o,r);let l,c=0;for(const d of t){(!l||l.end<d.index)&&(l=i.shift(),c=e.groupIndices.indexOf(l.start));let f;d.index===l.start?f={index:c,type:"group"}:f={groupIndex:c,index:d.index-(c+1)+n},s.push({...f,data:d.data,offset:d.offset,originalIndex:d.index,size:d.size})}return s}function wn(t,e){return t===void 0?0:typeof t=="number"?t:t[e]??0}const Dt=Z(([{data:t,firstItemIndex:e,gap:n,sizes:o,totalCount:r},s,{listBoundary:i,topListHeight:l,visibleRange:c},{initialTopMostItemIndex:d,scrolledToInitialItem:f},{topListHeight:v},m,{didMount:h},{recalcInProgress:y}])=>{const E=w([]),x=w(0),g=U(),a=w(0);L(s.topItemsIndexes,E);const T=gt(I(at(h,y,W(c,se),W(r),W(o),W(d),f,W(E),W(e),W(n),W(a),t,W(x)),G(([u,p,,b,,,,,,,,z])=>{const F=z!==void 0&&z.length!==b;return u&&!p&&!F}),k(([,,[u,p],b,z,F,O,P,$,q,D,K,J])=>{const ft=z,{offsetTree:pt,sizeTree:xt}=ft;if(b===0)return{...ke,totalCount:b};if(u===0&&p===0)return J===0?{...ke,totalCount:b}:Xn(J,F,z,$,q,K);if(tt(xt))return J>0?null:Se(Uo(Ke(F,b),ft,K),[],b,q,ft,$);const Ft=[];if(P.length>0){const _=P[0],Y=P[P.length-1];let it=0;for(const et of qt(xt,_,Y)){const Q=et.value,ct=Math.max(et.start,_),St=Math.min(et.end,Y);for(let ut=ct;ut<=St;ut++)Ft.push({data:K?.[ut],index:ut,offset:it,size:Q}),it+=Q}}if(!O)return Se([],Ft,b,q,ft,$);const ht=P.length>0?P[P.length-1]+1:0,$t=Fo(pt,u,p,ht);if($t.length===0)return null;const Xt=b-1,Ht=we([],_=>{for(const Y of $t){const it=Y.value;let et=it.offset,Q=Y.start;const ct=it.size;if(it.offset<u){Q+=Math.floor((u-it.offset+q)/(ct+q));const ut=Q-Y.start;et+=ut*ct+ut*q}Q<ht&&(et+=(ht-Q)*ct,Q=ht);const St=Math.min(Y.end,Xt);for(let ut=Q;ut<=St&&!(et>=p);ut++)_.push({data:K?.[ut],index:ut,offset:et,size:ct}),et+=ct+q}}),Jt=wn(D,ce),H=wn(D,ue);if(Ht.length>0&&(Jt>0||H>0)){const _=Ht[0],Y=Ht[Ht.length-1];if(Jt>0&&_.index>ht){const it=Math.min(Jt,_.index-ht),et=[];let Q=_.offset;for(let ct=_.index-1;ct>=_.index-it;ct--){const ut=qt(xt,ct,ct)[0]?.value??_.size;Q-=ut+q,et.unshift({data:K?.[ct],index:ct,offset:Q,size:ut})}Ht.unshift(...et)}if(H>0&&Y.index<Xt){const it=Math.min(H,Xt-Y.index);let et=Y.offset+Y.size+q;for(let Q=Y.index+1;Q<=Y.index+it;Q++){const St=qt(xt,Q,Q)[0]?.value??Y.size;Ht.push({data:K?.[Q],index:Q,offset:et,size:St}),et+=St+q}}}return Se(Ht,Ft,b,q,ft,$)}),G(u=>u!==null),ot()),ke);L(I(t,G(Ae),k(u=>u?.length)),r),L(I(T,k(u=>u.topListHeight)),v),L(v,l),L(I(T,k(u=>[u.top,u.bottom])),i),L(I(T,k(u=>u.items)),g);const S=Ct(I(T,G(({items:u})=>u.length>0),N(r,t),G(([{items:u},p])=>u[u.length-1].originalIndex===p-1),k(([,u,p])=>[u-1,p]),ot(se),k(([u])=>u))),C=Ct(I(T,zt(200),G(({items:u,topItems:p})=>u.length>0&&u[0].originalIndex===p.length),k(({items:u})=>u[0].index),ot())),B=Ct(I(T,G(({items:u})=>u.length>0),k(({items:u})=>{let p=0,b=u.length-1;for(;u[p].type==="group"&&p<b;)p++;for(;u[b].type==="group"&&b>p;)b--;return{endIndex:u[b].index,startIndex:u[p].index}}),ot(Dn)));return{endReached:S,initialItemCount:x,itemsRendered:g,listState:T,minOverscanItemCount:a,rangeChanged:B,startReached:C,topItemsIndexes:E,...m}},st(Lt,qn,qe,de,ae,fe,Mt,De),{singleton:!0}),Jn=Z(([{fixedFooterHeight:t,fixedHeaderHeight:e,footerHeight:n,headerHeight:o},{listState:r}])=>{const s=U(),i=gt(I(at(n,t,o,e,r),k(([l,c,d,f,v])=>l+c+d+f+v.offsetBottom+v.bottom)),0);return L(W(i),s),{totalListHeight:i,totalListHeightChanged:s}},st(It,Dt),{singleton:!0}),Ko=Z(([{viewportHeight:t},{totalListHeight:e}])=>{const n=w(!1),o=gt(I(at(n,t,e),G(([r])=>r),k(([,r,s])=>Math.max(0,r-s)),zt(0),ot()),0);return{alignToBottom:n,paddingTopAddition:o}},st(It,Jn),{singleton:!0}),Qn=Z(()=>({context:w(null)})),qo=({itemBottom:t,itemTop:e,locationParams:{align:n,behavior:o,...r},viewportBottom:s,viewportTop:i})=>e<i?{...r,align:n??"start",...o===void 0?{}:{behavior:o}}:t>s?{...r,align:n??"end",...o===void 0?{}:{behavior:o}}:null,to=Z(([{gap:t,sizes:e,totalCount:n},{fixedFooterHeight:o,fixedHeaderHeight:r,headerHeight:s,scrollingInProgress:i,scrollTop:l,viewportHeight:c},{scrollToIndex:d}])=>{const f=U();return L(I(f,N(e,c,n,s,r,o,l),N(t),k(([[v,m,h,y,E,x,g,a],T])=>{const{calculateViewLocation:S=qo,done:C,...B}=v,u=Kn(v,m,y-1),p=ie(u,m.offsetTree,T)+E+x,b=p+Rt(m.sizeTree,u)[1],z=a+x,F=a+h-g,O=S({itemBottom:b,itemTop:p,locationParams:B,viewportBottom:F,viewportTop:z});return O===null?C?.():C&&bt(I(i,G(P=>!P),Nt(lt(i)?1:2)),C),O}),G(v=>v!==null)),d),{scrollIntoView:f}},st(Lt,It,ae,Dt,Gt),{singleton:!0});function yn(t){return t===!1?!1:t==="smooth"?"smooth":"auto"}const Yo=(t,e)=>typeof t=="function"?yn(t(e)):e&&yn(t),Zo=Z(([{listRefresh:t,totalCount:e,fixedItemSize:n,data:o},{atBottomState:r,isAtBottom:s},{scrollToIndex:i},{scrolledToInitialItem:l},{didMount:c,propsReady:d},{log:f},{scrollingInProgress:v},{context:m},{scrollIntoView:h}])=>{const y=w(!1),E=U();let x=null;function g(C){A(i,{align:"end",behavior:C,index:"LAST"})}X(I(at(I(W(e),Nt(1)),c),N(W(y),s,l,v),k(([[C,B],u,p,b,z])=>{let F=B&&b,O="auto";return F&&(O=Yo(u,p||z),F=F&&O!==!1),{followOutputBehavior:O,shouldFollow:F,totalCount:C}}),G(({shouldFollow:C})=>C)),({followOutputBehavior:C,totalCount:B})=>{x!==null&&(x(),x=null),lt(n)===void 0?x=bt(t,()=>{lt(f)("following output to ",{totalCount:B},dt.DEBUG),g(C),x=null}):requestAnimationFrame(()=>{lt(f)("following output to ",{totalCount:B},dt.DEBUG),g(C)})});function a(C){const B=bt(r,u=>{C&&!u.atBottom&&u.notAtBottomBecause==="SIZE_INCREASED"&&x===null&&(lt(f)("scrolling to bottom due to increased size",{},dt.DEBUG),g("auto"))});setTimeout(B,100)}X(I(at(W(y),e,d),G(([C,,B])=>C!==!1&&B),Bt(({value:C},[,B])=>({refreshed:C===B,value:B}),{refreshed:!1,value:0}),G(({refreshed:C})=>C),N(y,e)),([,C])=>{lt(l)&&a(C!==!1)}),X(E,()=>{a(lt(y)!==!1)}),X(at(W(y),r),([C,B])=>{C!==!1&&!B.atBottom&&B.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&g("auto")});const T=w(null),S=U();return L(ze(I(W(o),k(C=>C?.length??0)),I(W(e))),S),X(I(at(I(S,Nt(1)),c),N(W(T),l,v,m),k(([[C,B],u,p,b,z])=>B&&p&&u?.({context:z,totalCount:C,scrollingInProgress:b})),G(C=>!!C),zt(0)),C=>{x!==null&&(x(),x=null),lt(n)===void 0?x=bt(t,()=>{lt(f)("scrolling into view",{}),A(h,C),x=null}):requestAnimationFrame(()=>{lt(f)("scrolling into view",{}),A(h,C)})}),{autoscrollToBottom:E,followOutput:y,scrollIntoViewOnChange:T}},st(Lt,fe,ae,de,Mt,Gt,It,Qn,to)),Xo=Z(([{data:t,firstItemIndex:e,gap:n,sizes:o},{initialTopMostItemIndex:r},{initialItemCount:s,listState:i},{didMount:l}])=>(L(I(l,N(s),G(([,c])=>c!==0),N(r,o,e,n,t),k(([[,c],d,f,v,m,h])=>Xn(c,d,f,v,m,h))),i),{}),st(Lt,de,Dt,Mt),{singleton:!0}),Jo=Z(([{didMount:t},{scrollTo:e},{listState:n}])=>{const o=w(0);return X(I(t,N(o),G(([,r])=>r!==0),k(([,r])=>({top:r}))),r=>{bt(I(n,Nt(1),G(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{A(e,r)})})}),{initialScrollTop:o}},st(Mt,It,Dt),{singleton:!0}),eo=Z(([{scrollVelocity:t}])=>{const e=w(!1),n=U(),o=w(!1);return L(I(t,N(o,e,n),G(([r,s])=>s!==!1&&s!==void 0),k(([r,s,i,l])=>{const{enter:c,exit:d}=s;if(i){if(d(r,l))return!1}else if(c(r,l))return!0;return i}),ot()),e),X(I(at(e,t,n),N(o)),([[r,s,i],l])=>{r&&l!==!1&&l!==void 0&&l.change&&l.change(s,i)}),{isSeeking:e,scrollSeekConfiguration:o,scrollSeekRangeChanged:n,scrollVelocity:t}},st(fe),{singleton:!0}),Ye=Z(([{scrollContainerState:t,scrollTo:e}])=>{const n=U(),o=U(),r=U(),s=w(!1),i=w(void 0);return L(I(at(n,o),k(([{scrollTop:l,viewportHeight:c},{offsetTop:d,listHeight:f}])=>({scrollHeight:f,scrollTop:Math.max(0,l-d),viewportHeight:c}))),t),L(I(e,N(o),k(([l,{offsetTop:c}])=>({...l,top:l.top+c}))),r),{customScrollParent:i,useWindowScroll:s,windowScrollContainerState:n,windowScrollTo:r,windowViewportRect:o}},st(It)),Qo=Z(([{sizeRanges:t,sizes:e},{headerHeight:n,scrollTop:o},{initialTopMostItemIndex:r},{didMount:s},{useWindowScroll:i,windowScrollContainerState:l,windowViewportRect:c}])=>{const d=U(),f=w(void 0),v=w(null),m=w(null);return L(l,v),L(c,m),X(I(d,N(e,o,i,v,m,n)),([h,y,E,x,g,a,T])=>{const S=Po(y.sizeTree);x&&g!==null&&a!==null&&(E=g.scrollTop-a.offsetTop),E-=T,h({ranges:S,scrollTop:E})}),L(I(f,G(Ae),k(tr)),r),L(I(s,N(f),G(([,h])=>h!==void 0),ot(),k(([,h])=>h.ranges)),t),{getState:d,restoreStateFrom:f}},st(Lt,It,de,Mt,Ye));function tr(t){return{align:"start",index:0,offset:t.scrollTop}}const er=Z(([{topItemsIndexes:t}])=>{const e=w(0);return L(I(e,G(n=>n>=0),k(n=>Array.from({length:n}).map((o,r)=>r))),t),{topItemCount:e}},st(Dt));function no(t){let e=!1,n;return(()=>(e||(e=!0,n=t()),n))}const nr=no(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),or=Z(([{deviation:t,deviationCommitted:e,scrollBy:n,scrollingInProgress:o,scrollTop:r},{isAtBottom:s,isScrolling:i,lastJumpDueToItemResize:l,scrollDirection:c},{listState:d},{beforeUnshiftWith:f,gap:v,shiftWithOffset:m,sizes:h},{log:y},{recalcInProgress:E}])=>{const x=Ct(I(d,N(l),Bt(([,S,C,B],[{bottom:u,items:p,offsetBottom:b,totalCount:z},F])=>{const O=u+b;let P=0;return C===z&&S.length>0&&p.length>0&&(p[0].originalIndex===0&&S[0].originalIndex===0||(P=O-B,P!==0&&(P+=F))),[P,p,z,O]},[0,[],0,0]),G(([S])=>S!==0),N(r,c,o,s,y,E),G(([,S,C,B,,,u])=>!u&&!B&&S!==0&&C===le),k(([[S],,,,,C])=>(C("Upward scrolling compensation",{amount:S},dt.DEBUG),S))));function g(S){S>0?(A(n,{behavior:"auto",top:-S}),A(t,0)):(A(t,0),A(n,{behavior:"auto",top:-S}))}X(I(x,N(t,i)),([S,C,B])=>{B&&nr()?A(t,C-S):g(-S)}),X(I(at(gt(i,!1),t,E),G(([S,C,B])=>!S&&!B&&C!==0),k(([S,C])=>C),zt(1)),g),L(I(m,k(S=>({top:-S}))),n);let a=null;function T(){if(a===null)return;const{offset:S}=a;a=null,A(n,{top:S}),requestAnimationFrame(()=>{A(t,0),A(E,!1)})}return X(e,S=>{a===null||!a.acknowledgeable||S===a.offset&&T()}),X(I(f,N(h,v),k(([S,{groupIndices:C,lastSize:B,sizeTree:u},p])=>{function b($){return $*(B+p)}if(C.length===0)return b(S);let z=0;const F=re(u,0);let O=0,P=0;for(;O<S;){O++,z+=F;let $=C.length===P+1?1/0:C[P+1]-C[P]-1;O+$>S&&(z-=F,$=S-O+1),O+=$,z+=b($),P++}return z})),S=>{a={acknowledgeable:lt(t)!==S,offset:S},A(t,S),requestAnimationFrame(T)}),{deviation:t}},st(It,fe,Dt,Lt,Gt,De)),rr=Z(([t,e,n,o,r,s,i,l,c,d,f])=>({...t,...e,...n,...o,...r,...s,...i,...l,...c,...d,...f}),st(qe,Xo,Mt,eo,Jn,Jo,Ko,Ye,to,Gt,Qn)),oo=Z(([{data:t,defaultItemSize:e,firstItemIndex:n,fixedItemSize:o,fixedGroupSize:r,gap:s,groupIndices:i,heightEstimates:l,itemSize:c,sizeRanges:d,sizes:f,statefulTotalCount:v,totalCount:m,trackItemSizes:h},{initialItemFinalLocationReached:y,initialTopMostItemIndex:E,scrolledToInitialItem:x},g,a,T,S,{scrollToIndex:C},B,{topItemCount:u},{groupCounts:p},b])=>{const{listState:z,minOverscanItemCount:F,topItemsIndexes:O,rangeChanged:P,...$}=S;return L(P,b.scrollSeekRangeChanged),L(I(at(b.windowViewportRect,g.headerHeight,g.fixedHeaderHeight),k(([q,D,K])=>Math.max(D+K+1,q.visibleHeight))),g.viewportHeight),{data:t,defaultItemHeight:e,firstItemIndex:n,fixedItemHeight:o,fixedGroupHeight:r,gap:s,groupCounts:p,heightEstimates:l,initialItemFinalLocationReached:y,initialTopMostItemIndex:E,scrolledToInitialItem:x,sizeRanges:d,topItemCount:u,topItemsIndexes:O,totalCount:m,...T,groupIndices:i,itemSize:c,listState:z,minOverscanItemCount:F,scrollToIndex:C,statefulTotalCount:v,trackItemSizes:h,rangeChanged:P,...$,...b,...g,sizes:f,...a}},st(Lt,de,It,Qo,Zo,Dt,ae,or,er,qn,rr));function sr(t,e){const n={},o={};let r=0;const s=t.length;for(;r<s;)o[t[r]]=1,r+=1;for(const i in e)Object.hasOwn(o,i)||(n[i]=e[i]);return n}const ge=typeof document>"u"?R.useEffect:R.useLayoutEffect;function Ze(t,e,n){const o=Object.keys(e.required||{}),r=Object.keys(e.optional||{}),s=Object.keys(e.methods||{}),i=Object.keys(e.events||{}),l=R.createContext({});function c(g,a){g.propsReady!==void 0&&A(g.propsReady,!1);for(const T of o){const S=g[e.required[T]];A(S,a[T])}for(const T of r)if(T in a){const S=g[e.optional[T]];A(S,a[T])}g.propsReady!==void 0&&A(g.propsReady,!0)}function d(g){return s.reduce((a,T)=>(a[T]=S=>{const C=g[e.methods[T]];A(C,S)},a),{})}function f(g){return i.reduce((a,T)=>(a[T]=vo(g[e.events[T]]),a),{})}const v=R.forwardRef(function(a,T){const{children:S,...C}=a,[B]=R.useState(()=>we(wo(t),b=>{c(b,C)})),[u]=R.useState(mn(f,B));ge(()=>{for(const b of i)b in C&&X(u[b],C[b]);return()=>{Object.values(u).map(je)}},[C,u,B]),ge(()=>{c(B,C)}),R.useImperativeHandle(T,fn(d(B)));const p=n;return V.jsx(l.Provider,{value:B,children:n===void 0?S:V.jsx(p,{...sr([...o,...r,...i],C),children:S})})}),m=g=>{const a=R.useContext(l);return R.useCallback(T=>{A(a[g],T)},[a,g])},h=g=>{const T=R.useContext(l)[g],S=R.useCallback(C=>X(T,C),[T]);return R.useSyncExternalStore(S,()=>lt(T),()=>lt(T))},y=g=>{const T=R.useContext(l)[g],[S,C]=R.useState(mn(lt,T));return ge(()=>X(T,B=>{B!==S&&C(fn(B))}),[T,S]),S},E=parseInt(R.version,10)>=18?h:y;return{Component:v,useEmitter:(g,a)=>{const S=R.useContext(l)[g];ge(()=>X(S,a),[a,S])},useEmitterValue:E,usePublisher:m}}const me=R.createContext(void 0),Xe=R.createContext(void 0),Be="-webkit-sticky",bn="sticky",Je=no(()=>{if(typeof document>"u")return bn;const t=document.createElement("div");return t.style.position=Be,t.style.position===Be?Be:bn});function Oe(t){return"self"in t}function ir(t){return"body"in t}function ro(t,e,n,o=Zt,r,s){const i=R.useRef(null),l=R.useRef(null),c=R.useRef(null),d=R.useCallback(m=>{let h,y,E;const x=m.target;if(ir(x)||Oe(x)){const a=Oe(x)?x:x.defaultView;E=s===!0?jt(a,a.scrollX):a.scrollY,h=s===!0?a.document.documentElement.scrollWidth:a.document.documentElement.scrollHeight,y=s===!0?a.innerWidth:a.innerHeight}else E=s===!0?jt(x,x.scrollLeft):x.scrollTop,h=s===!0?x.scrollWidth:x.scrollHeight,y=s===!0?x.offsetWidth:x.offsetHeight;const g=()=>{t({scrollHeight:h,scrollTop:Math.max(E,0),viewportHeight:y})};m.suppressFlushSync===!0?g():po.flushSync(g),l.current!==null&&(E===l.current||E<=0||E===h-y)&&(l.current=null,e(!0),c.current&&(clearTimeout(c.current),c.current=null))},[t,e,s]);R.useEffect(()=>{const m=r??i.current;return o(r??i.current),d({suppressFlushSync:!0,target:m}),m.addEventListener("scroll",d,{passive:!0}),()=>{o(null),m.removeEventListener("scroll",d)}},[i,d,n,o,r]);function f(m){const h=i.current;if(!h||(s===!0?"offsetWidth"in h&&h.offsetWidth===0:"offsetHeight"in h&&h.offsetHeight===0))return;const y=m.behavior==="smooth";let E,x,g;Oe(h)?(x=Math.max(Et(h.document.documentElement,s===!0?"width":"height"),s===!0?h.document.documentElement.scrollWidth:h.document.documentElement.scrollHeight),E=s===!0?h.innerWidth:h.innerHeight,g=s===!0?jt(h,h.scrollX):h.scrollY):(x=h[s===!0?"scrollWidth":"scrollHeight"],E=Et(h,s===!0?"width":"height"),g=s===!0?jt(h,h.scrollLeft):h.scrollTop);const a=x-E;if(m.top===void 0){h.scrollTo(m);return}const T=Math.ceil(Math.max(Math.min(a,m.top),0));if(m.top=T,Zn(E,x)||T===g){t({scrollHeight:x,scrollTop:g,viewportHeight:E}),y&&e(!0);return}y?(l.current=T,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,l.current=null,e(!0)},1e3)):l.current=null,s===!0&&(m={...m.behavior===void 0?{}:{behavior:m.behavior},left:hn(h,T)}),h.scrollTo(m)}return{scrollByCallback:R.useCallback(m=>{s===!0&&(m={...m.behavior===void 0?{}:{behavior:m.behavior},...m.top===void 0?{}:{left:hn(i.current,m.top)}}),i.current.scrollBy(m)},[s]),scrollerRef:i,scrollToCallback:f}}function Qe(t){return t}const lr=Z(()=>{const t=w(l=>`Item ${l}`),e=w(l=>`Group ${l}`),n=w({}),o=w(Qe),r=w("div"),s=w(Zt),i=(l,c=null)=>gt(I(n,k(d=>d[l]),ot()),c);return{components:n,computeItemKey:o,EmptyPlaceholder:i("EmptyPlaceholder"),FooterComponent:i("Footer"),GroupComponent:i("Group","div"),groupContent:e,HeaderComponent:i("Header"),HeaderFooterTag:r,ItemComponent:i("Item","div"),itemContent:t,ListComponent:i("List","div"),ScrollerComponent:i("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:i("ScrollSeekPlaceholder"),TopItemListComponent:i("TopItemList")}}),cr=Z(([t,e])=>({...t,...e}),st(oo,lr)),ur=({height:t})=>V.jsx("div",{style:{height:t}}),ar={overflowAnchor:"none",position:Je(),zIndex:1},so={overflowAnchor:"none"},dr={...so,display:"inline-block",height:"100%"},Rn=R.memo(function({showTopList:e=!1}){const n=M("listState"),o=Tt("sizeRanges"),r=M("useWindowScroll"),s=M("customScrollParent"),i=Tt("windowScrollContainerState"),l=Tt("scrollContainerState"),c=s||r?i:l,d=M("itemContent"),f=M("context"),v=M("groupContent"),m=M("trackItemSizes"),h=M("itemSize"),y=M("log"),E=Tt("gap"),x=M("horizontalDirection"),{callbackRef:g}=Gn(o,h,m,e?Zt:c,y,E,s,x,M("skipAnimationFrameInResizeObserver")),[a,T]=R.useState(0);on("deviation",D=>{a!==D&&T(D)});const S=Tt("deviationCommitted");ye(()=>{S(a)},[a,S]);const C=M("EmptyPlaceholder"),B=M("ScrollSeekPlaceholder")??ur,u=M("ListComponent"),p=M("ItemComponent"),b=M("GroupComponent"),z=M("computeItemKey"),F=M("isSeeking"),O=M("groupIndices").length>0,P=M("alignToBottom"),$=M("initialItemFinalLocationReached"),q=e?{}:{boxSizing:"border-box",...x?{display:"inline-block",height:"100%",marginInlineStart:a===0?P?"auto":0:a,paddingInlineEnd:n.offsetBottom,paddingInlineStart:n.offsetTop,whiteSpace:"nowrap"}:{marginTop:a===0?P?"auto":0:a,paddingBottom:n.offsetBottom,paddingTop:n.offsetTop},...$?{}:{visibility:"hidden"}};return!e&&n.totalCount===0&&C!==null&&C!==void 0?V.jsx(C,{...rt(C,f)}):V.jsx(u,{...rt(u,f),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:g,style:q,children:(e?n.topItems:n.items).map(D=>{const K=D.originalIndex,J=z(K+n.firstItemIndex,D.data,f);return F?R.createElement(B,{...rt(B,f),height:D.size,index:D.index,key:J,type:D.type||"item",...D.type==="group"?{}:{groupIndex:D.groupIndex}}):D.type==="group"?R.createElement(b,{...rt(b,f),"data-index":K,"data-item-index":D.index,"data-known-size":D.size,key:J,style:ar},v(D.index,f)):R.createElement(p,{...rt(p,f),...io(p,D.data),"data-index":K,"data-item-group-index":D.groupIndex,"data-item-index":D.index,"data-known-size":D.size,key:J,style:x?dr:so},O?d(D.index,D.groupIndex,D.data,f):d(D.index,D.data,f))})})}),fr={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},mr={outline:"none",overflowX:"auto",position:"relative"},Re=t=>({height:"100%",position:"absolute",top:0,width:"100%",...t?{display:"flex",flexDirection:"column"}:void 0}),tn=(t,e,n=0)=>({...Re(t),position:e?"relative":"absolute",top:e?-n:0}),pr={position:Je(),top:0,width:"100%",zIndex:1};function rt(t,e){if(typeof t!="string")return{context:e}}function io(t,e){return{item:typeof t=="string"?void 0:e}}const hr=R.memo(function(){const e=M("HeaderComponent"),n=Tt("headerHeight"),o=M("HeaderFooterTag"),r=Ot(R.useMemo(()=>i=>{n(Et(i,"height"))},[n]),!0,M("skipAnimationFrameInResizeObserver")),s=M("context");return e!=null?V.jsx(o,{ref:r,children:V.jsx(e,{...rt(e,s)})}):null}),gr=R.memo(function(){const e=M("FooterComponent"),n=Tt("footerHeight"),o=M("HeaderFooterTag"),r=Ot(R.useMemo(()=>i=>{n(Et(i,"height"))},[n]),!0,M("skipAnimationFrameInResizeObserver")),s=M("context");return e!=null?V.jsx(o,{ref:r,children:V.jsx(e,{...rt(e,s)})}):null});function en({useEmitter:t,useEmitterValue:e,usePublisher:n}){return R.memo(function({children:s,style:i,context:l,...c}){const d=n("scrollContainerState"),f=e("ScrollerComponent"),v=n("smoothScrollTargetReached"),m=e("scrollerRef"),h=e("horizontalDirection")||!1,{scrollByCallback:y,scrollerRef:E,scrollToCallback:x}=ro(d,v,f,m,void 0,h);t("scrollTo",x),t("scrollBy",y);const g=h?mr:fr;return V.jsx(f,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:E,style:{...g,...i},tabIndex:0,...c,...rt(f,l),children:s})})}function nn({useEmitter:t,useEmitterValue:e,usePublisher:n}){return R.memo(function({children:s,style:i,context:l,...c}){const d=n("windowScrollContainerState"),f=e("ScrollerComponent"),v=n("smoothScrollTargetReached"),m=e("totalListHeight"),h=e("deviation"),y=e("customScrollParent"),E=R.useRef(null),x=e("scrollerRef"),{scrollByCallback:g,scrollerRef:a,scrollToCallback:T}=ro(d,v,f,x,y);return ye(()=>(a.current=y??E.current?.ownerDocument.defaultView,()=>{a.current=null}),[a,y]),t("windowScrollTo",T),t("scrollBy",g),V.jsx(f,{ref:E,"data-virtuoso-scroller":!0,style:{position:"relative",...i,...m===0?void 0:{height:m+h}},...c,...rt(f,l),children:s})})}const xr=({children:t})=>{const e=R.useContext(me),n=Tt("viewportHeight"),o=Tt("fixedItemHeight"),r=M("alignToBottom"),s=M("horizontalDirection"),i=R.useMemo(()=>ne(n,c=>Et(c,s?"width":"height")),[n,s]),l=Ot(i,!0,M("skipAnimationFrameInResizeObserver"));return R.useEffect(()=>{e&&(n(e.viewportHeight),o(e.itemHeight))},[e,n,o]),V.jsx("div",{"data-viewport-type":"element",ref:l,style:Re(r),children:t})},Ir=({children:t})=>{const e=R.useContext(me),n=Tt("windowViewportRect"),o=Tt("fixedItemHeight"),r=M("customScrollParent"),s=M("useWindowScroll"),i=M("topListHeight"),l=Ne(n,r,M("skipAnimationFrameInResizeObserver")),c=M("alignToBottom");return R.useEffect(()=>{e&&(o(e.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:e.viewportHeight,visibleWidth:100}))},[e,n,o]),V.jsx("div",{"data-viewport-type":"window",ref:l,style:tn(c,s,i),children:t})},Sr=({children:t})=>{const e=M("TopItemListComponent")??"div",n=M("headerHeight"),o={...pr,marginTop:`${n}px`},r=M("context");return V.jsx(e,{style:o,...rt(e,r),children:t})},vr=R.memo(function(e){const n=M("useWindowScroll"),o=M("topItemsIndexes").length>0,r=M("customScrollParent"),s=M("context"),i=r||n?Cr:Tr,l=r||n?Ir:xr;return V.jsxs(i,{...e,context:s,children:[o&&V.jsx(Sr,{children:V.jsx(Rn,{showTopList:!0})}),V.jsxs(l,{children:[V.jsx(hr,{}),V.jsx(Rn,{}),V.jsx(gr,{})]})]})}),{Component:lo,useEmitter:on,useEmitterValue:M,usePublisher:Tt}=Ze(cr,{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"}},vr),Tr=en({useEmitter:on,useEmitterValue:M,usePublisher:Tt}),Cr=nn({useEmitter:on,useEmitterValue:M,usePublisher:Tt}),wr=lo,yr=lo,br=Z(()=>{const t=w(d=>V.jsxs("td",{children:["Item $",d]})),e=w(null),n=w(d=>V.jsxs("td",{colSpan:1e3,children:["Group ",d]})),o=w(null),r=w(null),s=w({}),i=w(Qe),l=w(Zt),c=(d,f=null)=>gt(I(s,k(v=>v[d]),ot()),f);return{components:s,computeItemKey:i,context:e,EmptyPlaceholder:c("EmptyPlaceholder"),FillerRow:c("FillerRow"),fixedFooterContent:r,fixedHeaderContent:o,itemContent:t,groupContent:n,ScrollerComponent:c("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:c("ScrollSeekPlaceholder"),TableBodyComponent:c("TableBody","tbody"),TableComponent:c("Table","table"),TableFooterComponent:c("TableFoot","tfoot"),TableHeadComponent:c("TableHead","thead"),TableRowComponent:c("TableRow","tr"),GroupComponent:c("Group","tr")}}),Rr=Z(([t,e])=>({...t,...e}),st(oo,br)),Er=({height:t})=>V.jsx("tr",{children:V.jsx("td",{style:{height:t}})}),Hr=({height:t})=>V.jsx("tr",{children:V.jsx("td",{style:{border:0,height:t,padding:0}})}),kr={overflowAnchor:"none"},En={position:Je(),zIndex:2,overflowAnchor:"none"},Hn=R.memo(function({showTopList:e=!1}){const n=j("listState"),o=j("computeItemKey"),r=j("firstItemIndex"),s=j("context"),i=j("isSeeking"),l=j("fixedHeaderHeight"),c=j("groupIndices").length>0,d=j("itemContent"),f=j("groupContent"),v=j("ScrollSeekPlaceholder")??Er,m=j("GroupComponent"),h=j("TableRowComponent"),y=(e?n.topItems:[]).reduce((x,g,a)=>(a===0?x.push(g.size):x.push(x[a-1]+g.size),x),[]);return(e?n.topItems:n.items).map(x=>{const g=x.originalIndex,a=o(g+r,x.data,s),T=e?g===0?0:y[g-1]:0;return i?R.createElement(v,{...rt(v,s),height:x.size,index:x.index,key:a,type:x.type||"item"}):x.type==="group"?R.createElement(m,{...rt(m,s),"data-index":g,"data-item-index":x.index,"data-known-size":x.size,key:a,style:{...En,top:l}},f(x.index,s)):R.createElement(h,{...rt(h,s),...io(h,x.data),"data-index":g,"data-item-index":x.index,"data-known-size":x.size,"data-item-group-index":x.groupIndex,key:a,style:e?{...En,top:l+T}:kr},c?d(x.index,x.groupIndex,x.data,s):d(x.index,x.data,s))})}),Br=R.memo(function(){const e=j("listState"),n=j("topItemsIndexes").length>0,o=wt("sizeRanges"),r=j("useWindowScroll"),s=j("customScrollParent"),i=wt("windowScrollContainerState"),l=wt("scrollContainerState"),c=s||r?i:l,d=j("trackItemSizes"),f=j("itemSize"),v=j("log"),{callbackRef:m,ref:h}=Gn(o,f,d,c,v,void 0,s,!1,j("skipAnimationFrameInResizeObserver")),[y,E]=R.useState(0);rn("deviation",O=>{y!==O&&(h.current.style.marginTop=`${O}px`,E(O))});const x=wt("deviationCommitted");ye(()=>{x(y)},[y,x]);const g=j("EmptyPlaceholder"),a=j("FillerRow")??Hr,T=j("TableBodyComponent"),S=j("paddingTopAddition"),C=j("statefulTotalCount"),B=j("context");if(C===0&&g!==null&&g!==void 0)return V.jsx(g,{...rt(g,B)});const u=(n?e.topItems:[]).reduce((O,P)=>O+P.size,0),p=e.offsetTop+S+y-u,b=e.offsetBottom,z=p>0?V.jsx(a,{context:B,height:p},"padding-top"):null,F=b>0?V.jsx(a,{context:B,height:b},"padding-bottom"):null;return V.jsxs(T,{"data-testid":"virtuoso-item-list",ref:m,...rt(T,B),children:[z,n&&V.jsx(Hn,{showTopList:!0}),V.jsx(Hn,{}),F]})}),Or=({children:t})=>{const e=R.useContext(me),n=wt("viewportHeight"),o=wt("fixedItemHeight"),r=Ot(R.useMemo(()=>ne(n,s=>Et(s,"height")),[n]),!0,j("skipAnimationFrameInResizeObserver"));return R.useEffect(()=>{e&&(n(e.viewportHeight),o(e.itemHeight))},[e,n,o]),V.jsx("div",{"data-viewport-type":"element",ref:r,style:Re(!1),children:t})},Lr=({children:t})=>{const e=R.useContext(me),n=wt("windowViewportRect"),o=wt("fixedItemHeight"),r=j("customScrollParent"),s=j("useWindowScroll"),i=Ne(n,r,j("skipAnimationFrameInResizeObserver"));return R.useEffect(()=>{e&&(o(e.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:e.viewportHeight,visibleWidth:100}))},[e,n,o]),V.jsx("div",{"data-viewport-type":"window",ref:i,style:tn(!1,s),children:t})},zr=R.memo(function(e){const n=j("useWindowScroll"),o=j("customScrollParent"),r=wt("fixedHeaderHeight"),s=wt("fixedFooterHeight"),i=j("fixedHeaderContent"),l=j("fixedFooterContent"),c=j("context"),d=Ot(R.useMemo(()=>ne(r,a=>Et(a,"height")),[r]),!0,j("skipAnimationFrameInResizeObserver")),f=Ot(R.useMemo(()=>ne(s,a=>Et(a,"height")),[s]),!0,j("skipAnimationFrameInResizeObserver")),v=o||n?Vr:Fr,m=o||n?Lr:Or,h=j("TableComponent"),y=j("TableHeadComponent"),E=j("TableFooterComponent"),x=i?V.jsx(y,{ref:d,style:{position:"sticky",top:0,zIndex:2},...rt(y,c),children:i()},"TableHead"):null,g=l?V.jsx(E,{ref:f,style:{bottom:0,position:"sticky",zIndex:1},...rt(E,c),children:l()},"TableFoot"):null;return V.jsx(v,{...e,...rt(v,c),children:V.jsx(m,{children:V.jsxs(h,{style:{borderSpacing:0,overflowAnchor:"none"},...rt(h,c),children:[x,V.jsx(Br,{},"TableBody"),g]})})})}),{Component:co,useEmitter:rn,useEmitterValue:j,usePublisher:wt}=Ze(Rr,{optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",groupContent:"groupContent",fixedHeaderContent:"fixedHeaderContent",fixedFooterContent:"fixedFooterContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},zr),Fr=en({useEmitter:rn,useEmitterValue:j,usePublisher:wt}),Vr=nn({useEmitter:rn,useEmitterValue:j,usePublisher:wt}),Pr=co,Wr=co,kn={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},Gr={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Bn,floor:Te,max:ee,min:Le,round:On}=Math;function Ln(t,e,n){return Array.from({length:e-t+1}).map((o,r)=>({data:n===null?null:n[r+t],index:r+t}))}function Mr(t){return{...Gr,items:t}}function xe(t,e){return t!==void 0&&t.width===e.width&&t.height===e.height}function Ar(t,e){return t!==void 0&&t.column===e.column&&t.row===e.row}const jr=Z(([{increaseViewportBy:t,listBoundary:e,overscan:n,visibleRange:o},{footerHeight:r,headerHeight:s,scrollBy:i,scrollContainerState:l,scrollTo:c,scrollTop:d,smoothScrollTargetReached:f,viewportHeight:v},m,h,{didMount:y,propsReady:E},{customScrollParent:x,useWindowScroll:g,windowScrollContainerState:a,windowScrollTo:T,windowViewportRect:S},C])=>{const B=w(0),u=w(0),p=w(kn),b=w({height:0,width:0}),z=w({height:0,width:0}),F=U(),O=U(),P=w(0),$=w(null),q=w({column:0,row:0}),D=U(),K=U(),J=w(!1),ft=w(0),pt=w(!0),xt=w(!1),Ft=w(!1);X(I(y,N(ft),G(([H,_])=>!Ge(_))),()=>{A(pt,!1)}),X(I(at(y,pt,z,b,ft,xt),G(([H,_,Y,it,,et])=>H&&!_&&Y.height!==0&&it.height!==0&&!et)),([,,,,H])=>{if(H===void 0){A(pt,!0);return}A(xt,!0),Ue(1,()=>{A(F,H)}),bt(I(d),()=>{A(e,[0,0]),A(pt,!0)})}),L(I(K,G(H=>H!=null&&H.scrollTop>0),kt(0)),u),X(I(y,N(K),G(([,H])=>H!=null)),([,H])=>{H&&(A(b,H.viewport),A(z,H.item),A(q,H.gap),H.scrollTop>0&&(A(J,!0),bt(I(d,Nt(1)),_=>{A(J,!1)}),A(c,{top:H.scrollTop})))}),L(I(b,k(({height:H})=>H)),v),L(I(at(W(b,xe),W(z,xe),W(q,(H,_)=>H!==void 0&&H.column===_.column&&H.row===_.row),W(d)),k(([H,_,Y,it])=>({gap:Y,item:_,scrollTop:it,viewport:H}))),D),L(I(at(W(B),o,W(q,Ar),W(z,xe),W(b,xe),W($),W(u),W(J),W(pt),W(ft)),G(([,,,,,,,H])=>!H),k(([H,[_,Y],it,et,Q,ct,St,,ut,Vt])=>{const{column:Pt,row:Qt}=it,{height:pe,width:Ee}=et,{width:sn}=Q;if(St===0&&(H===0||sn===0))return kn;if(Ee===0){const dn=Ke(Vt,H),mo=dn+Math.max(St-1,0);return Mr(Ln(dn,mo,ct))}const he=uo(sn,Ee,Pt);let Ut,At;ut?_===0&&Y===0&&St>0?(Ut=0,At=St-1):(Ut=he*Te((_+Qt)/(pe+Qt)),At=he*Bn((Y+Qt)/(pe+Qt))-1,At=Le(H-1,ee(At,he-1)),Ut=Le(At,ee(0,Ut))):(Ut=0,At=-1);const ln=Ln(Ut,At,ct),{bottom:cn,top:un}=zn(Q,it,et,ln),an=Bn(H/he),fo=an*pe+(an-1)*Qt-cn;return{bottom:cn,itemHeight:pe,items:ln,itemWidth:Ee,offsetBottom:fo,offsetTop:un,top:un}})),p),L(I($,G(H=>H!==null),k(H=>H.length)),B),L(I(at(b,z,p,q),G(([H,_,{items:Y}])=>Y.length>0&&_.height!==0&&H.height!==0),k(([H,_,{items:Y},it])=>{const{bottom:et,top:Q}=zn(H,it,_,Y);return[Q,et]}),ot(se)),e);const ht=w(!1);L(I(d,N(ht),k(([H,_])=>_||H!==0)),ht);const $t=Ct(I(at(p,B),G(([{items:H}])=>H.length>0),N(ht),G(([[H,_],Y])=>{const et=H.items[H.items.length-1].index===_-1;return(Y||H.bottom>0&&H.itemHeight>0&&H.offsetBottom===0&&H.items.length===_)&&et}),k(([[,H]])=>H-1),ot())),Xt=Ct(I(W(p),G(({items:H})=>H.length>0&&H[0].index===0),kt(0),ot())),Ht=Ct(I(W(p),N(J),G(([{items:H},_])=>H.length>0&&!_),k(([{items:H}])=>({endIndex:H[H.length-1].index,startIndex:H[0].index})),ot(Dn),zt(0)));L(Ht,h.scrollSeekRangeChanged),L(I(F,N(b,z,B,q),k(([H,_,Y,it,et])=>{const Q=Yn(H),{align:ct,behavior:St,offset:ut}=Q;let Vt=Q.index;Vt==="LAST"&&(Vt=it-1),Vt=ee(0,Vt,Le(it-1,Vt));let Pt=Me(_,et,Y,Vt);return ct==="end"?Pt=On(Pt-_.height+Y.height):ct==="center"&&(Pt=On(Pt-_.height/2+Y.height/2)),ut!==void 0&&ut!==0&&(Pt+=ut),{behavior:St,top:Pt}})),c);const Jt=gt(I(p,k(H=>H.offsetBottom+H.bottom)),0);return L(I(S,k(H=>({height:H.visibleHeight,width:H.visibleWidth}))),b),{customScrollParent:x,data:$,deviation:P,footerHeight:r,gap:q,headerHeight:s,increaseViewportBy:t,initialItemCount:u,itemDimensions:z,overscan:n,restoreStateFrom:K,scrollBy:i,scrollContainerState:l,scrollHeight:O,scrollTo:c,scrollToIndex:F,scrollTop:d,smoothScrollTargetReached:f,totalCount:B,useWindowScroll:g,viewportDimensions:b,windowScrollContainerState:a,windowScrollTo:T,windowViewportRect:S,...h,gridState:p,horizontalDirection:Ft,initialTopMostItemIndex:ft,totalListHeight:Jt,...m,endReached:$t,propsReady:E,rangeChanged:Ht,startReached:Xt,stateChanged:D,stateRestoreInProgress:J,...C}},st(qe,It,fe,eo,Mt,Ye,Gt));function uo(t,e,n){return ee(1,Te((t+n)/(Te(e)+n)))}function zn(t,e,n,o){const{height:r}=n;if(r===void 0||o.length===0)return{bottom:0,top:0};const s=Me(t,e,n,o[0].index);return{bottom:Me(t,e,n,o[o.length-1].index)+r,top:s}}function Me(t,e,n,o){const r=uo(t.width,n.width,e.column),s=Te(o/r),i=s*n.height+ee(0,s-1)*e.row;return i>0?i+e.row:i}const _r=Z(()=>{const t=w(v=>`Item ${v}`),e=w({}),n=w(null),o=w("virtuoso-grid-item"),r=w("virtuoso-grid-list"),s=w(Qe),i=w("div"),l=w(Zt),c=(v,m=null)=>gt(I(e,k(h=>h[v]),ot()),m),d=w(!1),f=w(!1);return L(W(f),d),{components:e,computeItemKey:s,context:n,FooterComponent:c("Footer"),HeaderComponent:c("Header"),headerFooterTag:i,itemClassName:o,ItemComponent:c("Item","div"),itemContent:t,listClassName:r,ListComponent:c("List","div"),readyStateChanged:d,reportReadyState:f,ScrollerComponent:c("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:c("ScrollSeekPlaceholder","div")}}),Nr=Z(([t,e])=>({...t,...e}),st(jr,_r)),Dr=R.memo(function(){const e=nt("gridState"),n=nt("listClassName"),o=nt("itemClassName"),r=nt("itemContent"),s=nt("computeItemKey"),i=nt("isSeeking"),l=yt("scrollHeight"),c=nt("ItemComponent"),d=nt("ListComponent"),f=nt("ScrollSeekPlaceholder"),v=nt("context"),m=yt("itemDimensions"),h=yt("gap"),y=nt("log"),E=nt("stateRestoreInProgress"),x=yt("reportReadyState"),g=Ot(R.useMemo(()=>a=>{const T=a.parentElement.parentElement.scrollHeight;l(T);const S=a.firstChild;if(S!==null){const{height:C,width:B}=S.getBoundingClientRect();m({height:C,width:B})}h({column:Fn("column-gap",getComputedStyle(a).columnGap,y),row:Fn("row-gap",getComputedStyle(a).rowGap,y)})},[l,m,h,y]),!0,!1);return ye(()=>{e.itemHeight>0&&e.itemWidth>0&&x(!0)},[e]),E?null:V.jsx(d,{className:n,ref:g,...rt(d,v),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(a=>{const T=s(a.index,a.data,v);return i?V.jsx(f,{...rt(f,v),height:e.itemHeight,index:a.index,width:e.itemWidth},T):R.createElement(c,{...rt(c,v),className:o,"data-index":a.index,key:T},r(a.index,a.data,v))})})}),$r=R.memo(function(){const e=nt("HeaderComponent"),n=yt("headerHeight"),o=nt("headerFooterTag"),r=Ot(R.useMemo(()=>i=>{n(Et(i,"height"))},[n]),!0,!1),s=nt("context");return e!=null?V.jsx(o,{ref:r,children:V.jsx(e,{...rt(e,s)})}):null}),Ur=R.memo(function(){const e=nt("FooterComponent"),n=yt("footerHeight"),o=nt("headerFooterTag"),r=Ot(R.useMemo(()=>i=>{n(Et(i,"height"))},[n]),!0,!1),s=nt("context");return e!=null?V.jsx(o,{ref:r,children:V.jsx(e,{...rt(e,s)})}):null}),Kr=({children:t})=>{const e=R.useContext(Xe),n=yt("itemDimensions"),o=yt("viewportDimensions"),r=Ot(R.useMemo(()=>s=>{o(s.getBoundingClientRect())},[o]),!0,!1);return R.useEffect(()=>{e&&(o({height:e.viewportHeight,width:e.viewportWidth}),n({height:e.itemHeight,width:e.itemWidth}))},[e,o,n]),V.jsx("div",{ref:r,style:Re(!1),children:t})},qr=({children:t})=>{const e=R.useContext(Xe),n=yt("windowViewportRect"),o=yt("itemDimensions"),r=nt("customScrollParent"),s=nt("useWindowScroll"),i=Ne(n,r,!1);return R.useEffect(()=>{e&&(o({height:e.itemHeight,width:e.itemWidth}),n({listHeight:0,offsetTop:0,visibleHeight:e.viewportHeight,visibleWidth:e.viewportWidth}))},[e,n,o]),V.jsx("div",{ref:i,style:tn(!1,s),children:t})},Yr=R.memo(function({...e}){const n=nt("useWindowScroll"),o=nt("customScrollParent"),r=o||n?Jr:Xr,s=o||n?qr:Kr,i=nt("context");return V.jsx(r,{...e,...rt(r,i),children:V.jsxs(s,{children:[V.jsx($r,{}),V.jsx(Dr,{}),V.jsx(Ur,{})]})})}),{Component:Zr,useEmitter:ao,useEmitterValue:nt,usePublisher:yt}=Ze(Nr,{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"}},Yr),Xr=en({useEmitter:ao,useEmitterValue:nt,usePublisher:yt}),Jr=nn({useEmitter:ao,useEmitterValue:nt,usePublisher:yt});function Fn(t,e,n){return e!=="normal"&&e?.endsWith("px")!==!0&&n(`${t} was not resolved to pixel value correctly`,e,dt.WARN),e==="normal"?0:parseInt(e??"0",10)}const Qr=Zr;exports.GroupedTableVirtuoso=Wr;exports.GroupedVirtuoso=yr;exports.LogLevel=dt;exports.TableVirtuoso=Pr;exports.Virtuoso=wr;exports.VirtuosoGrid=Qr;exports.VirtuosoGridMockContext=Xe;exports.VirtuosoMockContext=me;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("react/jsx-runtime"),R=require("react"),po=require("react-dom"),Ce=0,Wt=1,Yt=2,Vn=4;function fn(t){return()=>t}function ho(t){t()}function ne(t,e){return n=>t(e(n))}function mn(t,e){return()=>t(e)}function go(t,e){return n=>t(e,n)}function Ae(t){return t!==void 0}function xo(...t){return()=>{t.map(ho)}}function Zt(){}function we(t,e){return e(t),t}function Io(t,e){return e(t)}function st(...t){return t}function X(t,e){return t(Wt,e)}function A(t,e){t(Ce,e)}function je(t){t(Yt)}function lt(t){return t(Vn)}function z(t,e){return X(t,go(e,Ce))}function bt(t,e){const n=t(Wt,o=>{n(),e(o)});return n}function pn(t){let e,n;return o=>r=>{e=r,n&&clearTimeout(n),n=setTimeout(()=>{o(e)},t)}}function Pn(t,e){return t===e}function ot(t=Pn){let e;return n=>o=>{t(e,o)||(e=o,n(o))}}function G(t){return e=>n=>{t(n)&&e(n)}}function k(t){return e=>ne(e,t)}function kt(t){return e=>()=>{e(t)}}function I(t,...e){const n=So(...e);return((o,r)=>{switch(o){case Yt:je(t);return;case Wt:return X(t,n(r))}})}function Bt(t,e){return n=>o=>{n(e=t(e,o))}}function Nt(t){return e=>n=>{t>0?t--:e(n)}}function zt(t){let e=null,n;return o=>r=>{e=r,!n&&(n=setTimeout(()=>{n=void 0,o(e)},t))}}function N(...t){const e=Array.from({length:t.length});let n=0,o=null;const r=2**t.length-1;return t.forEach((s,i)=>{const l=2**i;X(s,c=>{const d=n;n|=l,e[i]=c,d!==r&&n===r&&o&&(o(),o=null)})}),s=>i=>{const l=()=>{s([i].concat(e))};n===r?l():o=l}}function So(...t){return e=>t.reduceRight(Io,e)}function vo(t){let e,n;const o=()=>e?.();return function(r,s){switch(r){case Wt:return s?n===s?void 0:(o(),n=s,e=X(t,s),e):(o(),Zt);case Yt:o(),n=null;return}}}function w(t){let e=t;const n=U();return((o,r)=>{switch(o){case Ce:e=r;break;case Wt:{r(e);break}case Vn:return e}return n(o,r)})}function gt(t,e){return we(w(e),n=>z(t,n))}function U(){const t=[];return((e,n)=>{switch(e){case Ce:t.slice().forEach(o=>{o(n)});return;case Yt:t.splice(0);return;case Wt:return t.push(n),()=>{const o=t.indexOf(n);o>-1&&t.splice(o,1)}}})}function Ct(t){return we(U(),e=>z(t,e))}const To={singleton:!0};function Z(t,e=[],n=To){const{singleton:o}=n;return{constructor:t,dependencies:e,id:Co(),singleton:o}}const Co=()=>Symbol("id");function wo(t){const e=new Map,n=({constructor:o,dependencies:r,id:s,singleton:i})=>{if(i&&e.has(s))return e.get(s);const l=o(r.map(c=>n(c)));return i&&e.set(s,l),l};return n(t)}function at(...t){const e=U(),n=Array.from({length:t.length});let o=0;const r=2**t.length-1;return t.forEach((s,i)=>{const l=2**i;X(s,c=>{n[i]=c,o|=l,o===r&&A(e,n)})}),function(s,i){switch(s){case Yt:{je(e);return}case Wt:return o===r&&i(n),X(e,i)}}}function W(t,e=Pn){return I(t,ot(e))}function ze(...t){return function(e,n){switch(e){case Yt:return;case Wt:return xo(...t.map(o=>X(o,n)))}}}const dt={DEBUG:0,INFO:1,WARN:2,ERROR:3},yo={[dt.DEBUG]:"debug",[dt.ERROR]:"error",[dt.INFO]:"log",[dt.WARN]:"warn"},bo=()=>typeof globalThis>"u"?window:globalThis,Gt=Z(()=>{const t=w(dt.ERROR);return{log:w((n,o,r=dt.INFO)=>{const s=bo().VIRTUOSO_LOG_LEVEL??lt(t);r>=s&&console[yo[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,o)}),logLevel:t}},[],{singleton:!0});function Ro(t){return"self"in t?t.document.documentElement:t}function Wn(t){const e=Ro(t);return e.ownerDocument.defaultView.getComputedStyle(e).direction==="rtl"}function jt(t,e){return Wn(t)?-e:e}function hn(t,e){return Wn(t)?-e:e}function Ot(t,e,n){return _e(t,e,n).callbackRef}function _e(t,e,n){const o=R.useRef(null);let r=i=>{};const s=R.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(i=>{const l=()=>{const c=i[0].target;c.offsetParent!==null&&t(c)};n?l():requestAnimationFrame(l)}):null,[t,n]);return r=i=>{i&&e?(s?.observe(i),o.current=i):(o.current&&s?.unobserve(o.current),o.current=null)},{callbackRef:r,ref:o}}function Gn(t,e,n,o,r,s,i,l,c){const d=R.useCallback(f=>{const v=Eo(f.children,e,l?"offsetWidth":"offsetHeight",r);let m=f.parentElement;for(;m.dataset.virtuosoScroller===void 0;)m=m.parentElement;const h=m.lastElementChild?.dataset.viewportType==="window";let y;h&&(y=m.ownerDocument.defaultView);const E=i?l?i.scrollWidth:i.scrollHeight:h?l?y.document.documentElement.scrollWidth:y.document.documentElement.scrollHeight:l?m.scrollWidth:m.scrollHeight,x=i?l?i.offsetWidth:i.offsetHeight:h?l?y.innerWidth:y.innerHeight:l?m.offsetWidth:m.offsetHeight,g=i?l?jt(i,i.scrollLeft):i.scrollTop:h?l?jt(y,y.scrollX||y.document.documentElement.scrollLeft):y.scrollY||y.document.documentElement.scrollTop:l?jt(m,m.scrollLeft):m.scrollTop;o({scrollHeight:E,scrollTop:Math.max(g,0),viewportHeight:x}),s?.(l?gn("column-gap",getComputedStyle(f).columnGap,r):gn("row-gap",getComputedStyle(f).rowGap,r)),v!==null&&t(v)},[t,e,r,s,i,o,l]);return _e(d,n,c)}function Eo(t,e,n,o){const r=t.length;if(r===0)return null;const s=[];for(let i=0;i<r;i++){const l=t.item(i);if(l.dataset.index===void 0)continue;const c=parseInt(l.dataset.index,10),d=parseFloat(l.dataset.knownSize),f=e(l,n);if(f===0&&o("Zero-sized element, this should not happen",{child:l},dt.ERROR),f===d)continue;const v=s[s.length-1];s.length===0||v.size!==f||v.endIndex!==c-1?s.push({endIndex:c,size:f,startIndex:c}):s[s.length-1].endIndex++}return s}function gn(t,e,n){return e!=="normal"&&e?.endsWith("px")!==!0&&n(`${t} was not resolved to pixel value correctly`,e,dt.WARN),e==="normal"?0:parseInt(e??"0",10)}const ye=typeof document>"u"?R.useEffect:R.useLayoutEffect;function Ne(t,e,n){const o=R.useRef(null),r=R.useCallback(c=>{if(!c?.offsetParent)return;const d=c.getBoundingClientRect(),f=d.width;let v,m;if(e){const h=e.getBoundingClientRect(),y=d.top-h.top;m=h.height-Math.max(0,y),v=y+e.scrollTop}else{const h=i.current.ownerDocument.defaultView;m=h.innerHeight-Math.max(0,d.top),v=d.top+h.scrollY}o.current={listHeight:d.height,offsetTop:v,visibleHeight:m,visibleWidth:f},t(o.current)},[t,e]),{callbackRef:s,ref:i}=_e(r,!0,n),l=R.useCallback(()=>{r(i.current)},[r,i]);return R.useEffect(()=>{if(e){e.addEventListener("scroll",l);const d=new ResizeObserver(()=>{requestAnimationFrame(l)});return d.observe(e),()=>{e.removeEventListener("scroll",l),d.unobserve(e)}}const c=i.current?.ownerDocument.defaultView;return c?.addEventListener("scroll",l),c?.addEventListener("resize",l),()=>{c?.removeEventListener("scroll",l),c?.removeEventListener("resize",l)}},[l,e,i]),s}const It=Z(()=>{const t=U(),e=U(),n=w(0),o=U(),r=U(),s=w(0),i=U(),l=U(),c=w(0),d=w(0),f=w(0),v=w(0),m=U(),h=U(),y=w(!1),E=w(!1),x=w(!1);return z(I(t,k(({scrollTop:g})=>g)),e),z(I(t,k(({scrollHeight:g})=>g)),l),z(e,s),{deviation:n,deviationCommitted:o,fixedFooterHeight:f,fixedHeaderHeight:d,footerHeight:v,headerHeight:c,horizontalDirection:E,scrollBy:h,scrollContainerState:t,scrollHeight:l,scrollingInProgress:y,scrollTo:m,scrollTop:e,skipAnimationFrameInResizeObserver:x,smoothScrollTargetReached:r,statefulScrollTop:s,viewportHeight:i}},[],{singleton:!0}),oe={lvl:0};function Mn(t,e){const n=t.length;if(n===0)return[];let{index:o,value:r}=e(t[0]);const s=[];for(let i=1;i<n;i++){const{index:l,value:c}=e(t[i]);s.push({end:l-1,start:o,value:r}),o=l,r=c}return s.push({end:1/0,start:o,value:r}),s}function tt(t){return t===oe}function re(t,e){if(!tt(t))return e===t.k?t.v:e<t.k?re(t.l,e):re(t.r,e)}function Rt(t,e,n="k"){if(tt(t))return[-1/0,void 0];if(Number(t[n])===e)return[t.k,t.v];if(Number(t[n])<e){const o=Rt(t.r,e,n);return o[0]===-1/0?[t.k,t.v]:o}return Rt(t.l,e,n)}function vt(t,e,n){return tt(t)?_n(e,n,1):e===t.k?mt(t,{k:e,v:n}):e<t.k?xn(mt(t,{l:vt(t.l,e,n)})):xn(mt(t,{r:vt(t.r,e,n)}))}function Kt(){return oe}function qt(t,e,n){if(tt(t))return[];const o=Rt(t,e)[0];return Ho(Ve(t,o,n))}function Fe(t,e){if(tt(t))return oe;const{k:n,l:o,r}=t;if(e===n){if(tt(o))return r;if(tt(r))return o;const[s,i]=jn(o);return Ie(mt(t,{k:s,l:An(o),v:i}))}return e<n?Ie(mt(t,{l:Fe(o,e)})):Ie(mt(t,{r:Fe(r,e)}))}function _t(t){return tt(t)?[]:[..._t(t.l),{k:t.k,v:t.v},..._t(t.r)]}function Ve(t,e,n){if(tt(t))return[];const{k:o,l:r,r:s,v:i}=t;let l=[];return o>e&&(l=l.concat(Ve(r,e,n))),o>=e&&o<=n&&l.push({k:o,v:i}),o<=n&&(l=l.concat(Ve(s,e,n))),l}function Ie(t){const{l:e,lvl:n,r:o}=t;if(o.lvl>=n-1&&e.lvl>=n-1)return t;if(n>o.lvl+1){if(He(e))return Nn(mt(t,{lvl:n-1}));if(!tt(e)&&!tt(e.r))return mt(e.r,{l:mt(e,{r:e.r.l}),lvl:n,r:mt(t,{l:e.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}if(He(t))return Pe(mt(t,{lvl:n-1}));if(!tt(o)&&!tt(o.l)){const r=o.l,s=He(r)?o.lvl-1:o.lvl;return mt(r,{l:mt(t,{lvl:n-1,r:r.l}),lvl:r.lvl+1,r:Pe(mt(o,{l:r.r,lvl:s}))})}throw new Error("Unexpected empty nodes")}function mt(t,e){return _n(e.k===void 0?t.k:e.k,e.v===void 0?t.v:e.v,e.lvl===void 0?t.lvl:e.lvl,e.l===void 0?t.l:e.l,e.r===void 0?t.r:e.r)}function An(t){return tt(t.r)?t.l:Ie(mt(t,{r:An(t.r)}))}function He(t){return tt(t)||t.lvl>t.r.lvl}function jn(t){return tt(t.r)?[t.k,t.v]:jn(t.r)}function _n(t,e,n,o=oe,r=oe){return{k:t,l:o,lvl:n,r,v:e}}function xn(t){return Pe(Nn(t))}function Nn(t){const{l:e}=t;return!tt(e)&&e.lvl===t.lvl?mt(e,{r:mt(t,{l:e.r})}):t}function Pe(t){const{lvl:e,r:n}=t;return!tt(n)&&!tt(n.r)&&n.lvl===e&&n.r.lvl===e?mt(n,{l:mt(t,{r:n.l}),lvl:e+1}):t}function Ho(t){return Mn(t,({k:e,v:n})=>({index:e,value:n}))}function Dn(t,e){return!!(t&&t.startIndex===e.startIndex&&t.endIndex===e.endIndex)}function se(t,e){return!!(t&&t[0]===e[0]&&t[1]===e[1])}const De=Z(()=>({recalcInProgress:w(!1)}),[],{singleton:!0});function $n(t,e,n){return t[ve(t,e,n)]}function ve(t,e,n,o=0){let r=t.length-1;for(;o<=r;){const s=Math.floor((o+r)/2),i=t[s],l=n(i,e);if(l===0)return s;if(l===-1){if(r-o<2)return s-1;r=s-1}else{if(r===o)return s;o=s+1}}throw new Error(`Failed binary finding record in array - ${t.join(",")}, searched for ${e}`)}function ko(t,e,n,o){const r=ve(t,e,o),s=ve(t,n,o,r);return t.slice(r,s+1)}function Et(t,e){return Math.round(t.getBoundingClientRect()[e])}function be(t){return!tt(t.groupOffsetTree)}function $e({index:t},e){return e===t?0:e<t?-1:1}function Bo(){return{groupIndices:[],groupOffsetTree:Kt(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Kt()}}function Oo(t,e){let n=tt(t)?0:1/0;for(const o of e){const{endIndex:r,size:s,startIndex:i}=o;if(n=Math.min(n,i),tt(t)){t=vt(t,0,s);continue}const l=qt(t,i-1,r+1);if(l.some(Go(o)))continue;let c=!1,d=!1;for(const{end:f,start:v,value:m}of l)c?(r>=v||s===m)&&(t=Fe(t,v)):(d=m!==s,c=!0),f>r&&r>=v&&m!==s&&(t=vt(t,r+1,m));d&&(t=vt(t,i,s))}return[t,n]}function Lo(t){return t.groupIndex!==void 0}function zo({offset:t},e){return e===t?0:e<t?-1:1}function ie(t,e,n){if(e.length===0)return 0;const{index:o,offset:r,size:s}=$n(e,t,$e),i=t-o,l=s*i+(i-1)*n+r;return l>0?l+n:l}function Un(t,e){if(!be(e))return t;let n=0;for(;e.groupIndices[n]<=t+n;)n++;return t+n}function Kn(t,e,n){if(Lo(t))return e.groupIndices[t.groupIndex]+1;const o=t.index==="LAST"?n:t.index;let r=Un(o,e);return r=Math.max(0,Math.min(n,r)),r}function Fo(t,e,n,o=0){return o>0&&(e=Math.max(e,$n(t,o,$e).offset)),Mn(ko(t,e,n,zo),Wo)}function Vo(t,[e,n,o,r]){e.length>0&&o("received item sizes",e,dt.DEBUG);const s=t.sizeTree;let i=s,l=0;if(n.length>0&&tt(s)&&e.length===2){const m=e[0].size,h=e[1].size;i=n.reduce((y,E)=>vt(vt(y,E,m),E+1,h),i)}else[i,l]=Oo(i,e);if(i===s)return t;const{lastIndex:c,lastOffset:d,lastSize:f,offsetTree:v}=We(t.offsetTree,l,i,r);return{groupIndices:n,groupOffsetTree:n.reduce((m,h)=>vt(m,h,ie(h,v,r)),Kt()),lastIndex:c,lastOffset:d,lastSize:f,offsetTree:v,sizeTree:i}}function Po(t){return _t(t).map(({k:e,v:n},o,r)=>{const s=r[o+1];return{endIndex:s===void 0?1/0:s.k-1,size:n,startIndex:e}})}function In(t,e){let n=0,o=0;for(;n<t;)n+=e[o+1]-e[o]-1,o++;return o-(n===t?0:1)}function We(t,e,n,o){let r=t,s=0,i=0,l=0,c=0;if(e===0)r=[];else{c=ve(r,e-1,$e),l=r[c].offset;const f=Rt(n,e-1);s=f[0],i=f[1],r.length&&r[c].size===Rt(n,e)[1]&&(c-=1),r=r.slice(0,c+1)}for(const{start:d,value:f}of qt(n,e,1/0)){const v=d-s,m=v*i+l+v*o;r.push({index:d,offset:m,size:f}),s=d,l=m,i=f}return{lastIndex:s,lastOffset:l,lastSize:i,offsetTree:r}}function Wo(t){return{index:t.index,value:t}}function Go(t){const{endIndex:e,size:n,startIndex:o}=t;return r=>r.start===o&&(r.end===e||r.end===1/0)&&r.value===n}const Mo={offsetHeight:"height",offsetWidth:"width"},Lt=Z(([{log:t},{recalcInProgress:e}])=>{const n=U(),o=U(),r=gt(o,0),s=U(),i=U(),l=w(0),c=w([]),d=w(void 0),f=w(void 0),v=w(void 0),m=w(void 0),h=w((u,p)=>Et(u,Mo[p])),y=w(void 0),E=w(0),x=Bo(),g=gt(I(n,N(c,t,E),Bt(Vo,x),ot()),x),a=gt(I(c,ot(),Bt((u,p)=>({current:p,prev:u.current}),{current:[],prev:[]}),k(({prev:u})=>u)),[]);z(I(c,G(u=>u.length>0),N(g,E),k(([u,p,b])=>{const L=u.reduce((F,O,P)=>vt(F,O,ie(O,p.offsetTree,b)||P),Kt());return{...p,groupIndices:u,groupOffsetTree:L}})),g),z(I(o,N(g),G(([u,{lastIndex:p}])=>u<p),k(([u,{lastIndex:p,lastSize:b}])=>[{endIndex:p,size:b,startIndex:u}])),n),z(d,f);const T=gt(I(d,k(u=>u===void 0)),!0);z(I(f,G(u=>u!==void 0&&tt(lt(g).sizeTree)),k(u=>{const p=lt(v),b=lt(c).length>0;return p!==void 0&&p!==0?b?[{endIndex:0,size:p,startIndex:0},{endIndex:1,size:u,startIndex:1}]:[]:[{endIndex:0,size:u,startIndex:0}]})),n),z(I(m,G(u=>u!==void 0&&u.length>0&&tt(lt(g).sizeTree)),k(u=>{const p=[];let b=u[0],L=0;for(let F=1;F<u.length;F++){const O=u[F];O!==b&&(p.push({endIndex:F-1,size:b,startIndex:L}),b=O,L=F)}return p.push({endIndex:u.length-1,size:b,startIndex:L}),p})),n),z(I(c,N(v,f),G(([,u,p])=>u!==void 0&&p!==void 0),k(([u,p,b])=>{const L=[];for(let F=0;F<u.length;F++){const O=u[F],P=u[F+1];L.push({startIndex:O,endIndex:O,size:p}),P!==void 0&&L.push({startIndex:O+1,endIndex:P-1,size:b})}return L})),n);const S=Ct(I(n,N(g),Bt(({sizes:u},[p,b])=>({changed:b!==u,sizes:b}),{changed:!1,sizes:x}),k(u=>u.changed)));X(I(l,Bt((u,p)=>({diff:u.prev-p,prev:p}),{diff:0,prev:0}),k(u=>u.diff)),u=>{const{groupIndices:p}=lt(g);if(u>0)A(e,!0),A(s,u+In(u,p));else if(u<0){const b=lt(a);b.length>0&&(u-=In(-u,b)),A(i,u)}}),X(I(l,N(t)),([u,p])=>{u<0&&p("`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:l},dt.ERROR)});const C=Ct(s);z(I(s,N(g),k(([u,p])=>{const b=p.groupIndices.length>0,L=[],F=p.lastSize;if(b){const O=re(p.sizeTree,0);let P=0,$=0;for(;P<u;){const K=p.groupIndices[$],J=p.groupIndices.length===$+1?1/0:p.groupIndices[$+1]-K-1;L.push({endIndex:K,size:O,startIndex:K}),L.push({endIndex:K+1+J-1,size:F,startIndex:K+1}),$++,P+=J+1}const q=_t(p.sizeTree);return P!==u&&q.shift(),q.reduce((K,{k:J,v:ft})=>{let pt=K.ranges;return K.prevSize!==0&&(pt=[...K.ranges,{endIndex:J+u-1,size:K.prevSize,startIndex:K.prevIndex}]),{prevIndex:J+u,prevSize:ft,ranges:pt}},{prevIndex:u,prevSize:0,ranges:L}).ranges}return _t(p.sizeTree).reduce((O,{k:P,v:$})=>({prevIndex:P+u,prevSize:$,ranges:[...O.ranges,{endIndex:P+u-1,size:O.prevSize,startIndex:O.prevIndex}]}),{prevIndex:0,prevSize:F,ranges:[]}).ranges})),n);const B=Ct(I(i,N(g,E),k(([u,{offsetTree:p},b])=>{const L=-u;return ie(L,p,b)})));return z(I(i,N(g,E),k(([u,p,b])=>{if(p.groupIndices.length>0){if(tt(p.sizeTree))return p;let O=Kt();const P=lt(a);let $=0,q=0,D=0;for(;$<-u;){D=P[q];const J=P[q+1]-D-1;q++,$+=J+1}if(O=_t(p.sizeTree).reduce((J,{k:ft,v:pt})=>vt(J,Math.max(0,ft+u),pt),O),$!==-u){const J=re(p.sizeTree,D);O=vt(O,0,J);const ft=Rt(p.sizeTree,-u+1)[1];O=vt(O,1,ft)}return{...p,sizeTree:O,...We(p.offsetTree,0,O,b)}}const F=_t(p.sizeTree).reduce((O,{k:P,v:$})=>vt(O,Math.max(0,P+u),$),Kt());return{...p,sizeTree:F,...We(p.offsetTree,0,F,b)}})),g),{beforeUnshiftWith:C,data:y,defaultItemSize:f,firstItemIndex:l,fixedItemSize:d,fixedGroupSize:v,gap:E,groupIndices:c,heightEstimates:m,itemSize:h,listRefresh:S,shiftWith:i,shiftWithOffset:B,sizeRanges:n,sizes:g,statefulTotalCount:r,totalCount:o,trackItemSizes:T,unshiftWith:s}},st(Gt,De),{singleton:!0});function Ao(t){return t.reduce((e,n)=>(e.groupIndices.push(e.totalCount),e.totalCount+=n+1,e),{groupIndices:[],totalCount:0})}const qn=Z(([{groupIndices:t,sizes:e,totalCount:n},{headerHeight:o,scrollTop:r}])=>{const s=U(),i=U(),l=Ct(I(s,k(Ao)));return z(I(l,k(c=>c.totalCount)),n),z(I(l,k(c=>c.groupIndices)),t),z(I(at(r,e,o),G(([c,d])=>be(d)),k(([c,d,f])=>Rt(d.groupOffsetTree,Math.max(c-f,0),"v")[0]),ot(),k(c=>[c])),i),{groupCounts:s,topItemsIndexes:i}},st(Lt,It)),Mt=Z(([{log:t}])=>{const e=w(!1),n=Ct(I(e,G(o=>o),ot()));return X(e,o=>{o&&lt(t)("props updated",{},dt.DEBUG)}),{didMount:n,propsReady:e}},st(Gt),{singleton:!0}),jo=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Yn(t){const e=typeof t=="number"?{index:t}:{...t};return e.align||(e.align="start"),(!e.behavior||!jo)&&(e.behavior="auto"),e.offset===void 0&&(e.offset=0),e}const ae=Z(([{gap:t,listRefresh:e,sizes:n,totalCount:o},{fixedFooterHeight:r,fixedHeaderHeight:s,footerHeight:i,headerHeight:l,scrollingInProgress:c,scrollTo:d,smoothScrollTargetReached:f,viewportHeight:v},{log:m}])=>{const h=U(),y=U(),E=w(0);let x=null,g=null,a=null;function T(){x!==null&&(x(),x=null),a!==null&&(a(),a=null),g&&(clearTimeout(g),g=null),A(c,!1)}return z(I(h,N(n,v,o,E,l,i,m),N(t,s,r),k(([[S,C,B,u,p,b,L,F],O,P,$])=>{const q=Yn(S),{align:D,behavior:K,offset:J}=q,ft=u-1,pt=Kn(q,C,ft);let xt=ie(pt,C.offsetTree,O)+b;D==="end"?(xt+=P+Rt(C.sizeTree,pt)[1]-B+$,pt===ft&&(xt+=L)):D==="center"?xt+=(P+Rt(C.sizeTree,pt)[1]-B+$)/2:xt-=p,J!==void 0&&J!==0&&(xt+=J);const Ft=ht=>{T(),ht?(F("retrying to scroll to",{location:S},dt.DEBUG),A(h,S)):(A(y,!0),F("list did not change, scroll successful",{},dt.DEBUG))};if(T(),K==="smooth"){let ht=!1;a=X(e,$t=>{ht=ht||$t}),x=bt(f,()=>{Ft(ht)})}else x=bt(I(e,_o(150)),Ft);return g=setTimeout(()=>{T()},1200),A(c,!0),F("scrolling from index to",{behavior:K,index:pt,top:xt},dt.DEBUG),{behavior:K,top:xt}})),d),{scrollTargetReached:y,scrollToIndex:h,topListHeight:E}},st(Lt,It,Gt),{singleton:!0});function _o(t){return e=>{const n=setTimeout(()=>{e(!1)},t);return o=>{o&&(e(!0),clearTimeout(n))}}}function Ue(t,e){t===0?e():requestAnimationFrame(()=>{Ue(t-1,e)})}function Ke(t,e){if(t===void 0)return 0;const n=e-1,o=typeof t=="number"?t:t.index==="LAST"?n:t.index;return Math.max(0,Math.min(o,n))}function Ge(t){return t===void 0?!0:typeof t=="number"?t===0:t.index===0&&(t.align===void 0||t.align==="start")&&(t.offset===void 0||t.offset===0)}const de=Z(([{defaultItemSize:t,listRefresh:e,sizes:n},{scrollTop:o},{scrollTargetReached:r,scrollToIndex:s},{didMount:i}])=>{const l=w(!0),c=w(0),d=w(!0);return z(I(i,N(c),G(([f,v])=>!Ge(v)),kt(!1)),l),z(I(i,N(c),G(([f,v])=>!Ge(v)),kt(!1)),d),X(I(at(e,i),N(l,n,t,d),G(([[,f],v,{sizeTree:m},h,y])=>f&&(!tt(m)||Ae(h))&&!v&&!y),N(c)),([,f])=>{if(f===void 0){A(l,!0),A(d,!0);return}bt(r,()=>{A(d,!0)}),Ue(4,()=>{bt(o,()=>{A(l,!0)}),A(s,f)})}),{initialItemFinalLocationReached:d,initialTopMostItemIndex:c,scrolledToInitialItem:l}},st(Lt,It,ae,Mt),{singleton:!0});function Zn(t,e){return Math.abs(t-e)<1.01}const le="up",te="down",No="none",Do={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},$o=0,fe=Z(([{footerHeight:t,headerHeight:e,scrollBy:n,scrollContainerState:o,scrollTop:r,viewportHeight:s}])=>{const i=w(!1),l=w(!0),c=U(),d=U(),f=w(4),v=w($o),m=gt(I(ze(I(W(r),Nt(1),kt(!0)),I(W(r),Nt(1),kt(!1),pn(100))),ot()),!1),h=gt(I(ze(I(n,kt(!0)),I(n,kt(!1),pn(200))),ot()),!1);z(I(at(W(r),W(v)),k(([a,T])=>a<=T),ot()),l),z(I(l,zt(50)),d);const y=Ct(I(at(o,W(s),W(e),W(t),W(f)),Bt((a,[{scrollHeight:T,scrollTop:S},C,B,u,p])=>{const b=S+C-T>-p,L={scrollHeight:T,scrollTop:S,viewportHeight:C};if(b){let O,P;return S>a.state.scrollTop?(O="SCROLLED_DOWN",P=a.state.scrollTop-S):(O="SIZE_DECREASED",P=a.state.scrollTop-S||a.scrollTopDelta),{atBottom:!0,atBottomBecause:O,scrollTopDelta:P,state:L}}let F;return L.scrollHeight>a.state.scrollHeight?F="SIZE_INCREASED":C<a.state.viewportHeight?F="VIEWPORT_HEIGHT_DECREASING":S<a.state.scrollTop?F="SCROLLING_UPWARDS":F="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:F,state:L}},Do),ot((a,T)=>a!==void 0&&a.atBottom===T.atBottom))),E=gt(I(o,Bt((a,{scrollHeight:T,scrollTop:S,viewportHeight:C})=>{if(!Zn(a.scrollHeight,T)){const B=T-(S+C)<1;return a.scrollTop!==S&&B?{changed:!0,jump:a.scrollTop-S,scrollHeight:T,scrollTop:S}:{changed:!0,jump:0,scrollHeight:T,scrollTop:S}}return{changed:!1,jump:0,scrollHeight:T,scrollTop:S}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),G(a=>a.changed),k(a=>a.jump)),0);z(I(y,k(a=>a.atBottom)),i),z(I(i,zt(50)),c);const x=w(te);z(I(o,k(({scrollTop:a})=>a),ot(),Bt((a,T)=>lt(h)?{direction:a.direction,prevScrollTop:T}:{direction:T<a.prevScrollTop?le:te,prevScrollTop:T},{direction:te,prevScrollTop:0}),k(a=>a.direction)),x),z(I(o,zt(50),kt(No)),x);const g=w(0);return z(I(m,G(a=>!a),kt(0)),g),z(I(r,zt(100),N(m),G(([a,T])=>T),Bt(([a,T],[S])=>[T,S],[0,0]),k(([a,T])=>T-a)),g),{atBottomState:y,atBottomStateChange:c,atBottomThreshold:f,atTopStateChange:d,atTopThreshold:v,isAtBottom:i,isAtTop:l,isScrolling:m,lastJumpDueToItemResize:E,scrollDirection:x,scrollVelocity:g}},st(It)),ce="top",ue="bottom",Sn="none";function vn(t,e,n){return typeof t=="number"?n===le&&e===ce||n===te&&e===ue?t:0:n===le?e===ce?t.main:t.reverse:e===ue?t.main:t.reverse}function Tn(t,e){return typeof t=="number"?t:t[e]??0}const qe=Z(([{deviation:t,fixedHeaderHeight:e,headerHeight:n,scrollTop:o,viewportHeight:r}])=>{const s=U(),i=w(0),l=w(0),c=w(0),d=gt(I(at(W(o),W(r),W(n),W(s,se),W(c),W(i),W(e),W(t),W(l)),k(([f,v,m,[h,y],E,x,g,a,T])=>{const S=f-a,C=x+g,B=Math.max(m-S,0);let u=Sn;const p=Tn(T,ce),b=Tn(T,ue);return h-=a,h+=m+g,y+=m+g,y-=a,h>f+C-p&&(u=le),y<f-B+v+b&&(u=te),u!==Sn?[Math.max(S-m-vn(E,ce,u)-p,0),S-B-g+v+vn(E,ue,u)+b]:null}),G(f=>f!==null),ot(se)),[0,0]);return{increaseViewportBy:l,listBoundary:s,overscan:c,topListHeight:i,visibleRange:d}},st(It),{singleton:!0});function Uo(t,e,n){if(be(e)){const o=Un(t,e);return[{index:Rt(e.groupOffsetTree,o)[0],offset:0,size:0},{data:n?.[0],index:o,offset:0,size:0}]}return[{data:n?.[0],index:t,offset:0,size:0}]}const ke={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Se(t,e,n,o,r,s){const{lastIndex:i,lastOffset:l,lastSize:c}=r;let d=0,f=0;if(t.length>0){d=t[0].offset;const E=t[t.length-1];f=E.offset+E.size}const v=n-i,m=l+v*c+(v-1)*o,h=d,y=m-f;return{bottom:f,firstItemIndex:s,items:Cn(t,r,s),offsetBottom:y,offsetTop:d,top:h,topItems:Cn(e,r,s),topListHeight:e.reduce((E,x)=>x.size+E,0),totalCount:n}}function Xn(t,e,n,o,r,s){let i=0;if(n.groupIndices.length>0)for(const h of n.groupIndices){if(h-i>=t)break;i++}const l=t+i,c=s!==void 0,d=s?.length??0,f=Ke(e,c?d:l),v=c?Math.max(0,Math.min(l,d-f)):l,m=Array.from({length:v}).map((h,y)=>({data:s?.[y+f],index:y+f,offset:0,size:0}));return Se(m,[],v,r,n,o)}function Cn(t,e,n){if(t.length===0)return[];if(!be(e))return t.map(d=>({...d,index:d.index+n,originalIndex:d.index}));const o=t[0].index,r=t[t.length-1].index,s=[],i=qt(e.groupOffsetTree,o,r);let l,c=0;for(const d of t){(!l||l.end<d.index)&&(l=i.shift(),c=e.groupIndices.indexOf(l.start));let f;d.index===l.start?f={index:c,type:"group"}:f={groupIndex:c,index:d.index-(c+1)+n},s.push({...f,data:d.data,offset:d.offset,originalIndex:d.index,size:d.size})}return s}function wn(t,e){return t===void 0?0:typeof t=="number"?t:t[e]??0}const Dt=Z(([{data:t,firstItemIndex:e,gap:n,sizes:o,totalCount:r},s,{listBoundary:i,topListHeight:l,visibleRange:c},{initialTopMostItemIndex:d,scrolledToInitialItem:f},{topListHeight:v},m,{didMount:h},{recalcInProgress:y}])=>{const E=w([]),x=w(0),g=U(),a=w(0);z(s.topItemsIndexes,E);const T=gt(I(at(h,y,W(c,se),W(r),W(o),W(d),f,W(E),W(e),W(n),W(a),t,W(x)),G(([u,p,,b,,,,,,,,L])=>{const F=L!==void 0&&L.length!==b;return u&&!p&&!F}),k(([,,[u,p],b,L,F,O,P,$,q,D,K,J])=>{const ft=L,{offsetTree:pt,sizeTree:xt}=ft;if(b===0)return{...ke,totalCount:b};if(u===0&&p===0)return J===0?{...ke,totalCount:b}:Xn(J,F,L,$,q,K);if(tt(xt))return J>0?null:Se(Uo(Ke(F,b),ft,K),[],b,q,ft,$);const Ft=[];if(P.length>0){const _=P[0],Y=P[P.length-1];let it=0;for(const et of qt(xt,_,Y)){const Q=et.value,ct=Math.max(et.start,_),St=Math.min(et.end,Y);for(let ut=ct;ut<=St;ut++)Ft.push({data:K?.[ut],index:ut,offset:it,size:Q}),it+=Q}}if(!O)return Se([],Ft,b,q,ft,$);const ht=P.length>0?P[P.length-1]+1:0,$t=Fo(pt,u,p,ht);if($t.length===0)return null;const Xt=b-1,Ht=we([],_=>{for(const Y of $t){const it=Y.value;let et=it.offset,Q=Y.start;const ct=it.size;if(it.offset<u){Q+=Math.floor((u-it.offset+q)/(ct+q));const ut=Q-Y.start;et+=ut*ct+ut*q}Q<ht&&(et+=(ht-Q)*ct,Q=ht);const St=Math.min(Y.end,Xt);for(let ut=Q;ut<=St&&!(et>=p);ut++)_.push({data:K?.[ut],index:ut,offset:et,size:ct}),et+=ct+q}}),Jt=wn(D,ce),H=wn(D,ue);if(Ht.length>0&&(Jt>0||H>0)){const _=Ht[0],Y=Ht[Ht.length-1];if(Jt>0&&_.index>ht){const it=Math.min(Jt,_.index-ht),et=[];let Q=_.offset;for(let ct=_.index-1;ct>=_.index-it;ct--){const ut=qt(xt,ct,ct)[0]?.value??_.size;Q-=ut+q,et.unshift({data:K?.[ct],index:ct,offset:Q,size:ut})}Ht.unshift(...et)}if(H>0&&Y.index<Xt){const it=Math.min(H,Xt-Y.index);let et=Y.offset+Y.size+q;for(let Q=Y.index+1;Q<=Y.index+it;Q++){const St=qt(xt,Q,Q)[0]?.value??Y.size;Ht.push({data:K?.[Q],index:Q,offset:et,size:St}),et+=St+q}}}return Se(Ht,Ft,b,q,ft,$)}),G(u=>u!==null),ot()),ke);z(I(t,G(Ae),k(u=>u?.length)),r),z(I(T,k(u=>u.topListHeight)),v),z(v,l),z(I(T,k(u=>[u.top,u.bottom])),i),z(I(T,k(u=>u.items)),g);const S=Ct(I(T,G(({items:u})=>u.length>0),N(r,t),G(([{items:u},p])=>u[u.length-1].originalIndex===p-1),k(([{items:u},p,b])=>{const L=u[u.length-1],F=L.type==="group"?L.index+1:(L.groupIndex??-1)+1;return[p-1-F,b]}),ot(se),G(([u])=>u>=0),k(([u])=>u))),C=Ct(I(T,zt(200),G(({items:u,topItems:p})=>u.length>0&&u[0].originalIndex===p.length),k(({items:u})=>u[0].index),ot())),B=Ct(I(T,G(({items:u})=>u.length>0),k(({items:u})=>{let p=0,b=u.length-1;for(;u[p].type==="group"&&p<b;)p++;for(;u[b].type==="group"&&b>p;)b--;return{endIndex:u[b].index,startIndex:u[p].index}}),ot(Dn)));return{endReached:S,initialItemCount:x,itemsRendered:g,listState:T,minOverscanItemCount:a,rangeChanged:B,startReached:C,topItemsIndexes:E,...m}},st(Lt,qn,qe,de,ae,fe,Mt,De),{singleton:!0}),Jn=Z(([{fixedFooterHeight:t,fixedHeaderHeight:e,footerHeight:n,headerHeight:o},{listState:r}])=>{const s=U(),i=gt(I(at(n,t,o,e,r),k(([l,c,d,f,v])=>l+c+d+f+v.offsetBottom+v.bottom)),0);return z(W(i),s),{totalListHeight:i,totalListHeightChanged:s}},st(It,Dt),{singleton:!0}),Ko=Z(([{viewportHeight:t},{totalListHeight:e}])=>{const n=w(!1),o=gt(I(at(n,t,e),G(([r])=>r),k(([,r,s])=>Math.max(0,r-s)),zt(0),ot()),0);return{alignToBottom:n,paddingTopAddition:o}},st(It,Jn),{singleton:!0}),Qn=Z(()=>({context:w(null)})),qo=({itemBottom:t,itemTop:e,locationParams:{align:n,behavior:o,...r},viewportBottom:s,viewportTop:i})=>e<i?{...r,align:n??"start",...o===void 0?{}:{behavior:o}}:t>s?{...r,align:n??"end",...o===void 0?{}:{behavior:o}}:null,to=Z(([{gap:t,sizes:e,totalCount:n},{fixedFooterHeight:o,fixedHeaderHeight:r,headerHeight:s,scrollingInProgress:i,scrollTop:l,viewportHeight:c},{scrollToIndex:d}])=>{const f=U();return z(I(f,N(e,c,n,s,r,o,l),N(t),k(([[v,m,h,y,E,x,g,a],T])=>{const{calculateViewLocation:S=qo,done:C,...B}=v,u=Kn(v,m,y-1),p=ie(u,m.offsetTree,T)+E+x,b=p+Rt(m.sizeTree,u)[1],L=a+x,F=a+h-g,O=S({itemBottom:b,itemTop:p,locationParams:B,viewportBottom:F,viewportTop:L});return O===null?C?.():C&&bt(I(i,G(P=>!P),Nt(lt(i)?1:2)),C),O}),G(v=>v!==null)),d),{scrollIntoView:f}},st(Lt,It,ae,Dt,Gt),{singleton:!0});function yn(t){return t===!1?!1:t==="smooth"?"smooth":"auto"}const Yo=(t,e)=>typeof t=="function"?yn(t(e)):e&&yn(t),Zo=Z(([{listRefresh:t,totalCount:e,fixedItemSize:n,data:o},{atBottomState:r,isAtBottom:s},{scrollToIndex:i},{scrolledToInitialItem:l},{didMount:c,propsReady:d},{log:f},{scrollingInProgress:v},{context:m},{scrollIntoView:h}])=>{const y=w(!1),E=U();let x=null;function g(C){A(i,{align:"end",behavior:C,index:"LAST"})}X(I(at(I(W(e),Nt(1)),c),N(W(y),s,l,v),k(([[C,B],u,p,b,L])=>{let F=B&&b,O="auto";return F&&(O=Yo(u,p||L),F=F&&O!==!1),{followOutputBehavior:O,shouldFollow:F,totalCount:C}}),G(({shouldFollow:C})=>C)),({followOutputBehavior:C,totalCount:B})=>{x!==null&&(x(),x=null),lt(n)===void 0?x=bt(t,()=>{lt(f)("following output to ",{totalCount:B},dt.DEBUG),g(C),x=null}):requestAnimationFrame(()=>{lt(f)("following output to ",{totalCount:B},dt.DEBUG),g(C)})});function a(C){const B=bt(r,u=>{C&&!u.atBottom&&u.notAtBottomBecause==="SIZE_INCREASED"&&x===null&&(lt(f)("scrolling to bottom due to increased size",{},dt.DEBUG),g("auto"))});setTimeout(B,100)}X(I(at(W(y),e,d),G(([C,,B])=>C!==!1&&B),Bt(({value:C},[,B])=>({refreshed:C===B,value:B}),{refreshed:!1,value:0}),G(({refreshed:C})=>C),N(y,e)),([,C])=>{lt(l)&&a(C!==!1)}),X(E,()=>{a(lt(y)!==!1)}),X(at(W(y),r),([C,B])=>{C!==!1&&!B.atBottom&&B.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&g("auto")});const T=w(null),S=U();return z(ze(I(W(o),k(C=>C?.length??0)),I(W(e))),S),X(I(at(I(S,Nt(1)),c),N(W(T),l,v,m),k(([[C,B],u,p,b,L])=>B&&p&&u?.({context:L,totalCount:C,scrollingInProgress:b})),G(C=>!!C),zt(0)),C=>{x!==null&&(x(),x=null),lt(n)===void 0?x=bt(t,()=>{lt(f)("scrolling into view",{}),A(h,C),x=null}):requestAnimationFrame(()=>{lt(f)("scrolling into view",{}),A(h,C)})}),{autoscrollToBottom:E,followOutput:y,scrollIntoViewOnChange:T}},st(Lt,fe,ae,de,Mt,Gt,It,Qn,to)),Xo=Z(([{data:t,firstItemIndex:e,gap:n,sizes:o},{initialTopMostItemIndex:r},{initialItemCount:s,listState:i},{didMount:l}])=>(z(I(l,N(s),G(([,c])=>c!==0),N(r,o,e,n,t),k(([[,c],d,f,v,m,h])=>Xn(c,d,f,v,m,h))),i),{}),st(Lt,de,Dt,Mt),{singleton:!0}),Jo=Z(([{didMount:t},{scrollTo:e},{listState:n}])=>{const o=w(0);return X(I(t,N(o),G(([,r])=>r!==0),k(([,r])=>({top:r}))),r=>{bt(I(n,Nt(1),G(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{A(e,r)})})}),{initialScrollTop:o}},st(Mt,It,Dt),{singleton:!0}),eo=Z(([{scrollVelocity:t}])=>{const e=w(!1),n=U(),o=w(!1);return z(I(t,N(o,e,n),G(([r,s])=>s!==!1&&s!==void 0),k(([r,s,i,l])=>{const{enter:c,exit:d}=s;if(i){if(d(r,l))return!1}else if(c(r,l))return!0;return i}),ot()),e),X(I(at(e,t,n),N(o)),([[r,s,i],l])=>{r&&l!==!1&&l!==void 0&&l.change&&l.change(s,i)}),{isSeeking:e,scrollSeekConfiguration:o,scrollSeekRangeChanged:n,scrollVelocity:t}},st(fe),{singleton:!0}),Ye=Z(([{scrollContainerState:t,scrollTo:e}])=>{const n=U(),o=U(),r=U(),s=w(!1),i=w(void 0);return z(I(at(n,o),k(([{scrollTop:l,viewportHeight:c},{offsetTop:d,listHeight:f}])=>({scrollHeight:f,scrollTop:Math.max(0,l-d),viewportHeight:c}))),t),z(I(e,N(o),k(([l,{offsetTop:c}])=>({...l,top:l.top+c}))),r),{customScrollParent:i,useWindowScroll:s,windowScrollContainerState:n,windowScrollTo:r,windowViewportRect:o}},st(It)),Qo=Z(([{sizeRanges:t,sizes:e},{headerHeight:n,scrollTop:o},{initialTopMostItemIndex:r},{didMount:s},{useWindowScroll:i,windowScrollContainerState:l,windowViewportRect:c}])=>{const d=U(),f=w(void 0),v=w(null),m=w(null);return z(l,v),z(c,m),X(I(d,N(e,o,i,v,m,n)),([h,y,E,x,g,a,T])=>{const S=Po(y.sizeTree);x&&g!==null&&a!==null&&(E=g.scrollTop-a.offsetTop),E-=T,h({ranges:S,scrollTop:E})}),z(I(f,G(Ae),k(tr)),r),z(I(s,N(f),G(([,h])=>h!==void 0),ot(),k(([,h])=>h.ranges)),t),{getState:d,restoreStateFrom:f}},st(Lt,It,de,Mt,Ye));function tr(t){return{align:"start",index:0,offset:t.scrollTop}}const er=Z(([{topItemsIndexes:t}])=>{const e=w(0);return z(I(e,G(n=>n>=0),k(n=>Array.from({length:n}).map((o,r)=>r))),t),{topItemCount:e}},st(Dt));function no(t){let e=!1,n;return(()=>(e||(e=!0,n=t()),n))}const nr=no(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),or=Z(([{deviation:t,deviationCommitted:e,scrollBy:n,scrollingInProgress:o,scrollTop:r},{isAtBottom:s,isScrolling:i,lastJumpDueToItemResize:l,scrollDirection:c},{listState:d},{beforeUnshiftWith:f,gap:v,shiftWithOffset:m,sizes:h},{log:y},{recalcInProgress:E}])=>{const x=Ct(I(d,N(l),Bt(([,S,C,B],[{bottom:u,items:p,offsetBottom:b,totalCount:L},F])=>{const O=u+b;let P=0;return C===L&&S.length>0&&p.length>0&&(p[0].originalIndex===0&&S[0].originalIndex===0||(P=O-B,P!==0&&(P+=F))),[P,p,L,O]},[0,[],0,0]),G(([S])=>S!==0),N(r,c,o,s,y,E),G(([,S,C,B,,,u])=>!u&&!B&&S!==0&&C===le),k(([[S],,,,,C])=>(C("Upward scrolling compensation",{amount:S},dt.DEBUG),S))));function g(S){S>0?(A(n,{behavior:"auto",top:-S}),A(t,0)):(A(t,0),A(n,{behavior:"auto",top:-S}))}X(I(x,N(t,i)),([S,C,B])=>{B&&nr()?A(t,C-S):g(-S)}),X(I(at(gt(i,!1),t,E),G(([S,C,B])=>!S&&!B&&C!==0),k(([S,C])=>C),zt(1)),g),z(I(m,k(S=>({top:-S}))),n);let a=null;function T(){if(a===null)return;const{offset:S}=a;a=null,A(n,{top:S}),requestAnimationFrame(()=>{A(t,0),A(E,!1)})}return X(e,S=>{a===null||!a.acknowledgeable||S===a.offset&&T()}),X(I(f,N(h,v),k(([S,{groupIndices:C,lastSize:B,sizeTree:u},p])=>{function b($){return $*(B+p)}if(C.length===0)return b(S);let L=0;const F=re(u,0);let O=0,P=0;for(;O<S;){O++,L+=F;let $=C.length===P+1?1/0:C[P+1]-C[P]-1;O+$>S&&(L-=F,$=S-O+1),O+=$,L+=b($),P++}return L})),S=>{a={acknowledgeable:lt(t)!==S,offset:S},A(t,S),requestAnimationFrame(T)}),{deviation:t}},st(It,fe,Dt,Lt,Gt,De)),rr=Z(([t,e,n,o,r,s,i,l,c,d,f])=>({...t,...e,...n,...o,...r,...s,...i,...l,...c,...d,...f}),st(qe,Xo,Mt,eo,Jn,Jo,Ko,Ye,to,Gt,Qn)),oo=Z(([{data:t,defaultItemSize:e,firstItemIndex:n,fixedItemSize:o,fixedGroupSize:r,gap:s,groupIndices:i,heightEstimates:l,itemSize:c,sizeRanges:d,sizes:f,statefulTotalCount:v,totalCount:m,trackItemSizes:h},{initialItemFinalLocationReached:y,initialTopMostItemIndex:E,scrolledToInitialItem:x},g,a,T,S,{scrollToIndex:C},B,{topItemCount:u},{groupCounts:p},b])=>{const{listState:L,minOverscanItemCount:F,topItemsIndexes:O,rangeChanged:P,...$}=S;return z(P,b.scrollSeekRangeChanged),z(I(at(b.windowViewportRect,g.headerHeight,g.fixedHeaderHeight),k(([q,D,K])=>Math.max(D+K+1,q.visibleHeight))),g.viewportHeight),{data:t,defaultItemHeight:e,firstItemIndex:n,fixedItemHeight:o,fixedGroupHeight:r,gap:s,groupCounts:p,heightEstimates:l,initialItemFinalLocationReached:y,initialTopMostItemIndex:E,scrolledToInitialItem:x,sizeRanges:d,topItemCount:u,topItemsIndexes:O,totalCount:m,...T,groupIndices:i,itemSize:c,listState:L,minOverscanItemCount:F,scrollToIndex:C,statefulTotalCount:v,trackItemSizes:h,rangeChanged:P,...$,...b,...g,sizes:f,...a}},st(Lt,de,It,Qo,Zo,Dt,ae,or,er,qn,rr));function sr(t,e){const n={},o={};let r=0;const s=t.length;for(;r<s;)o[t[r]]=1,r+=1;for(const i in e)Object.hasOwn(o,i)||(n[i]=e[i]);return n}const ge=typeof document>"u"?R.useEffect:R.useLayoutEffect;function Ze(t,e,n){const o=Object.keys(e.required||{}),r=Object.keys(e.optional||{}),s=Object.keys(e.methods||{}),i=Object.keys(e.events||{}),l=R.createContext({});function c(g,a){g.propsReady!==void 0&&A(g.propsReady,!1);for(const T of o){const S=g[e.required[T]];A(S,a[T])}for(const T of r)if(T in a){const S=g[e.optional[T]];A(S,a[T])}g.propsReady!==void 0&&A(g.propsReady,!0)}function d(g){return s.reduce((a,T)=>(a[T]=S=>{const C=g[e.methods[T]];A(C,S)},a),{})}function f(g){return i.reduce((a,T)=>(a[T]=vo(g[e.events[T]]),a),{})}const v=R.forwardRef(function(a,T){const{children:S,...C}=a,[B]=R.useState(()=>we(wo(t),b=>{c(b,C)})),[u]=R.useState(mn(f,B));ge(()=>{for(const b of i)b in C&&X(u[b],C[b]);return()=>{Object.values(u).map(je)}},[C,u,B]),ge(()=>{c(B,C)}),R.useImperativeHandle(T,fn(d(B)));const p=n;return V.jsx(l.Provider,{value:B,children:n===void 0?S:V.jsx(p,{...sr([...o,...r,...i],C),children:S})})}),m=g=>{const a=R.useContext(l);return R.useCallback(T=>{A(a[g],T)},[a,g])},h=g=>{const T=R.useContext(l)[g],S=R.useCallback(C=>X(T,C),[T]);return R.useSyncExternalStore(S,()=>lt(T),()=>lt(T))},y=g=>{const T=R.useContext(l)[g],[S,C]=R.useState(mn(lt,T));return ge(()=>X(T,B=>{B!==S&&C(fn(B))}),[T,S]),S},E=parseInt(R.version,10)>=18?h:y;return{Component:v,useEmitter:(g,a)=>{const S=R.useContext(l)[g];ge(()=>X(S,a),[a,S])},useEmitterValue:E,usePublisher:m}}const me=R.createContext(void 0),Xe=R.createContext(void 0),Be="-webkit-sticky",bn="sticky",Je=no(()=>{if(typeof document>"u")return bn;const t=document.createElement("div");return t.style.position=Be,t.style.position===Be?Be:bn});function Oe(t){return"self"in t}function ir(t){return"body"in t}function ro(t,e,n,o=Zt,r,s){const i=R.useRef(null),l=R.useRef(null),c=R.useRef(null),d=R.useCallback(m=>{let h,y,E;const x=m.target;if(ir(x)||Oe(x)){const a=Oe(x)?x:x.defaultView;E=s===!0?jt(a,a.scrollX):a.scrollY,h=s===!0?a.document.documentElement.scrollWidth:a.document.documentElement.scrollHeight,y=s===!0?a.innerWidth:a.innerHeight}else E=s===!0?jt(x,x.scrollLeft):x.scrollTop,h=s===!0?x.scrollWidth:x.scrollHeight,y=s===!0?x.offsetWidth:x.offsetHeight;const g=()=>{t({scrollHeight:h,scrollTop:Math.max(E,0),viewportHeight:y})};m.suppressFlushSync===!0?g():po.flushSync(g),l.current!==null&&(E===l.current||E<=0||E===h-y)&&(l.current=null,e(!0),c.current&&(clearTimeout(c.current),c.current=null))},[t,e,s]);R.useEffect(()=>{const m=r??i.current;return o(r??i.current),d({suppressFlushSync:!0,target:m}),m.addEventListener("scroll",d,{passive:!0}),()=>{o(null),m.removeEventListener("scroll",d)}},[i,d,n,o,r]);function f(m){const h=i.current;if(!h||(s===!0?"offsetWidth"in h&&h.offsetWidth===0:"offsetHeight"in h&&h.offsetHeight===0))return;const y=m.behavior==="smooth";let E,x,g;Oe(h)?(x=Math.max(Et(h.document.documentElement,s===!0?"width":"height"),s===!0?h.document.documentElement.scrollWidth:h.document.documentElement.scrollHeight),E=s===!0?h.innerWidth:h.innerHeight,g=s===!0?jt(h,h.scrollX):h.scrollY):(x=h[s===!0?"scrollWidth":"scrollHeight"],E=Et(h,s===!0?"width":"height"),g=s===!0?jt(h,h.scrollLeft):h.scrollTop);const a=x-E;if(m.top===void 0){h.scrollTo(m);return}const T=Math.ceil(Math.max(Math.min(a,m.top),0));if(m.top=T,Zn(E,x)||T===g){t({scrollHeight:x,scrollTop:g,viewportHeight:E}),y&&e(!0);return}y?(l.current=T,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,l.current=null,e(!0)},1e3)):l.current=null,s===!0&&(m={...m.behavior===void 0?{}:{behavior:m.behavior},left:hn(h,T)}),h.scrollTo(m)}return{scrollByCallback:R.useCallback(m=>{s===!0&&(m={...m.behavior===void 0?{}:{behavior:m.behavior},...m.top===void 0?{}:{left:hn(i.current,m.top)}}),i.current.scrollBy(m)},[s]),scrollerRef:i,scrollToCallback:f}}function Qe(t){return t}const lr=Z(()=>{const t=w(l=>`Item ${l}`),e=w(l=>`Group ${l}`),n=w({}),o=w(Qe),r=w("div"),s=w(Zt),i=(l,c=null)=>gt(I(n,k(d=>d[l]),ot()),c);return{components:n,computeItemKey:o,EmptyPlaceholder:i("EmptyPlaceholder"),FooterComponent:i("Footer"),GroupComponent:i("Group","div"),groupContent:e,HeaderComponent:i("Header"),HeaderFooterTag:r,ItemComponent:i("Item","div"),itemContent:t,ListComponent:i("List","div"),ScrollerComponent:i("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:i("ScrollSeekPlaceholder"),TopItemListComponent:i("TopItemList")}}),cr=Z(([t,e])=>({...t,...e}),st(oo,lr)),ur=({height:t})=>V.jsx("div",{style:{height:t}}),ar={overflowAnchor:"none",position:Je(),zIndex:1},so={overflowAnchor:"none"},dr={...so,display:"inline-block",height:"100%"},Rn=R.memo(function({showTopList:e=!1}){const n=M("listState"),o=Tt("sizeRanges"),r=M("useWindowScroll"),s=M("customScrollParent"),i=Tt("windowScrollContainerState"),l=Tt("scrollContainerState"),c=s||r?i:l,d=M("itemContent"),f=M("context"),v=M("groupContent"),m=M("trackItemSizes"),h=M("itemSize"),y=M("log"),E=Tt("gap"),x=M("horizontalDirection"),{callbackRef:g}=Gn(o,h,m,e?Zt:c,y,E,s,x,M("skipAnimationFrameInResizeObserver")),[a,T]=R.useState(0);on("deviation",D=>{a!==D&&T(D)});const S=Tt("deviationCommitted");ye(()=>{S(a)},[a,S]);const C=M("EmptyPlaceholder"),B=M("ScrollSeekPlaceholder")??ur,u=M("ListComponent"),p=M("ItemComponent"),b=M("GroupComponent"),L=M("computeItemKey"),F=M("isSeeking"),O=M("groupIndices").length>0,P=M("alignToBottom"),$=M("initialItemFinalLocationReached"),q=e?{}:{boxSizing:"border-box",...x?{display:"inline-block",height:"100%",marginInlineStart:a===0?P?"auto":0:a,paddingInlineEnd:n.offsetBottom,paddingInlineStart:n.offsetTop,whiteSpace:"nowrap"}:{marginTop:a===0?P?"auto":0:a,paddingBottom:n.offsetBottom,paddingTop:n.offsetTop},...$?{}:{visibility:"hidden"}};return!e&&n.totalCount===0&&C!==null&&C!==void 0?V.jsx(C,{...rt(C,f)}):V.jsx(u,{...rt(u,f),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:g,style:q,children:(e?n.topItems:n.items).map(D=>{const K=D.originalIndex,J=L(K+n.firstItemIndex,D.data,f);return F?R.createElement(B,{...rt(B,f),height:D.size,index:D.index,key:J,type:D.type||"item",...D.type==="group"?{}:{groupIndex:D.groupIndex}}):D.type==="group"?R.createElement(b,{...rt(b,f),"data-index":K,"data-item-index":D.index,"data-known-size":D.size,key:J,style:ar},v(D.index,f)):R.createElement(p,{...rt(p,f),...io(p,D.data),"data-index":K,"data-item-group-index":D.groupIndex,"data-item-index":D.index,"data-known-size":D.size,key:J,style:x?dr:so},O?d(D.index,D.groupIndex,D.data,f):d(D.index,D.data,f))})})}),fr={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},mr={outline:"none",overflowX:"auto",position:"relative"},Re=t=>({height:"100%",position:"absolute",top:0,width:"100%",...t?{display:"flex",flexDirection:"column"}:void 0}),tn=(t,e,n=0)=>({...Re(t),position:e?"relative":"absolute",top:e?-n:0}),pr={position:Je(),top:0,width:"100%",zIndex:1};function rt(t,e){if(typeof t!="string")return{context:e}}function io(t,e){return{item:typeof t=="string"?void 0:e}}const hr=R.memo(function(){const e=M("HeaderComponent"),n=Tt("headerHeight"),o=M("HeaderFooterTag"),r=Ot(R.useMemo(()=>i=>{n(Et(i,"height"))},[n]),!0,M("skipAnimationFrameInResizeObserver")),s=M("context");return e!=null?V.jsx(o,{ref:r,children:V.jsx(e,{...rt(e,s)})}):null}),gr=R.memo(function(){const e=M("FooterComponent"),n=Tt("footerHeight"),o=M("HeaderFooterTag"),r=Ot(R.useMemo(()=>i=>{n(Et(i,"height"))},[n]),!0,M("skipAnimationFrameInResizeObserver")),s=M("context");return e!=null?V.jsx(o,{ref:r,children:V.jsx(e,{...rt(e,s)})}):null});function en({useEmitter:t,useEmitterValue:e,usePublisher:n}){return R.memo(function({children:s,style:i,context:l,...c}){const d=n("scrollContainerState"),f=e("ScrollerComponent"),v=n("smoothScrollTargetReached"),m=e("scrollerRef"),h=e("horizontalDirection")||!1,{scrollByCallback:y,scrollerRef:E,scrollToCallback:x}=ro(d,v,f,m,void 0,h);t("scrollTo",x),t("scrollBy",y);const g=h?mr:fr;return V.jsx(f,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:E,style:{...g,...i},tabIndex:0,...c,...rt(f,l),children:s})})}function nn({useEmitter:t,useEmitterValue:e,usePublisher:n}){return R.memo(function({children:s,style:i,context:l,...c}){const d=n("windowScrollContainerState"),f=e("ScrollerComponent"),v=n("smoothScrollTargetReached"),m=e("totalListHeight"),h=e("deviation"),y=e("customScrollParent"),E=R.useRef(null),x=e("scrollerRef"),{scrollByCallback:g,scrollerRef:a,scrollToCallback:T}=ro(d,v,f,x,y);return ye(()=>(a.current=y??E.current?.ownerDocument.defaultView,()=>{a.current=null}),[a,y]),t("windowScrollTo",T),t("scrollBy",g),V.jsx(f,{ref:E,"data-virtuoso-scroller":!0,style:{position:"relative",...i,...m===0?void 0:{height:m+h}},...c,...rt(f,l),children:s})})}const xr=({children:t})=>{const e=R.useContext(me),n=Tt("viewportHeight"),o=Tt("fixedItemHeight"),r=M("alignToBottom"),s=M("horizontalDirection"),i=R.useMemo(()=>ne(n,c=>Et(c,s?"width":"height")),[n,s]),l=Ot(i,!0,M("skipAnimationFrameInResizeObserver"));return R.useEffect(()=>{e&&(n(e.viewportHeight),o(e.itemHeight))},[e,n,o]),V.jsx("div",{"data-viewport-type":"element",ref:l,style:Re(r),children:t})},Ir=({children:t})=>{const e=R.useContext(me),n=Tt("windowViewportRect"),o=Tt("fixedItemHeight"),r=M("customScrollParent"),s=M("useWindowScroll"),i=M("topListHeight"),l=Ne(n,r,M("skipAnimationFrameInResizeObserver")),c=M("alignToBottom");return R.useEffect(()=>{e&&(o(e.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:e.viewportHeight,visibleWidth:100}))},[e,n,o]),V.jsx("div",{"data-viewport-type":"window",ref:l,style:tn(c,s,i),children:t})},Sr=({children:t})=>{const e=M("TopItemListComponent")??"div",n=M("headerHeight"),o={...pr,marginTop:`${n}px`},r=M("context");return V.jsx(e,{style:o,...rt(e,r),children:t})},vr=R.memo(function(e){const n=M("useWindowScroll"),o=M("topItemsIndexes").length>0,r=M("customScrollParent"),s=M("context"),i=r||n?Cr:Tr,l=r||n?Ir:xr;return V.jsxs(i,{...e,context:s,children:[o&&V.jsx(Sr,{children:V.jsx(Rn,{showTopList:!0})}),V.jsxs(l,{children:[V.jsx(hr,{}),V.jsx(Rn,{}),V.jsx(gr,{})]})]})}),{Component:lo,useEmitter:on,useEmitterValue:M,usePublisher:Tt}=Ze(cr,{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"}},vr),Tr=en({useEmitter:on,useEmitterValue:M,usePublisher:Tt}),Cr=nn({useEmitter:on,useEmitterValue:M,usePublisher:Tt}),wr=lo,yr=lo,br=Z(()=>{const t=w(d=>V.jsxs("td",{children:["Item $",d]})),e=w(null),n=w(d=>V.jsxs("td",{colSpan:1e3,children:["Group ",d]})),o=w(null),r=w(null),s=w({}),i=w(Qe),l=w(Zt),c=(d,f=null)=>gt(I(s,k(v=>v[d]),ot()),f);return{components:s,computeItemKey:i,context:e,EmptyPlaceholder:c("EmptyPlaceholder"),FillerRow:c("FillerRow"),fixedFooterContent:r,fixedHeaderContent:o,itemContent:t,groupContent:n,ScrollerComponent:c("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:c("ScrollSeekPlaceholder"),TableBodyComponent:c("TableBody","tbody"),TableComponent:c("Table","table"),TableFooterComponent:c("TableFoot","tfoot"),TableHeadComponent:c("TableHead","thead"),TableRowComponent:c("TableRow","tr"),GroupComponent:c("Group","tr")}}),Rr=Z(([t,e])=>({...t,...e}),st(oo,br)),Er=({height:t})=>V.jsx("tr",{children:V.jsx("td",{style:{height:t}})}),Hr=({height:t})=>V.jsx("tr",{children:V.jsx("td",{style:{border:0,height:t,padding:0}})}),kr={overflowAnchor:"none"},En={position:Je(),zIndex:2,overflowAnchor:"none"},Hn=R.memo(function({showTopList:e=!1}){const n=j("listState"),o=j("computeItemKey"),r=j("firstItemIndex"),s=j("context"),i=j("isSeeking"),l=j("fixedHeaderHeight"),c=j("groupIndices").length>0,d=j("itemContent"),f=j("groupContent"),v=j("ScrollSeekPlaceholder")??Er,m=j("GroupComponent"),h=j("TableRowComponent"),y=(e?n.topItems:[]).reduce((x,g,a)=>(a===0?x.push(g.size):x.push(x[a-1]+g.size),x),[]);return(e?n.topItems:n.items).map(x=>{const g=x.originalIndex,a=o(g+r,x.data,s),T=e?g===0?0:y[g-1]:0;return i?R.createElement(v,{...rt(v,s),height:x.size,index:x.index,key:a,type:x.type||"item"}):x.type==="group"?R.createElement(m,{...rt(m,s),"data-index":g,"data-item-index":x.index,"data-known-size":x.size,key:a,style:{...En,top:l}},f(x.index,s)):R.createElement(h,{...rt(h,s),...io(h,x.data),"data-index":g,"data-item-index":x.index,"data-known-size":x.size,"data-item-group-index":x.groupIndex,key:a,style:e?{...En,top:l+T}:kr},c?d(x.index,x.groupIndex,x.data,s):d(x.index,x.data,s))})}),Br=R.memo(function(){const e=j("listState"),n=j("topItemsIndexes").length>0,o=wt("sizeRanges"),r=j("useWindowScroll"),s=j("customScrollParent"),i=wt("windowScrollContainerState"),l=wt("scrollContainerState"),c=s||r?i:l,d=j("trackItemSizes"),f=j("itemSize"),v=j("log"),{callbackRef:m,ref:h}=Gn(o,f,d,c,v,void 0,s,!1,j("skipAnimationFrameInResizeObserver")),[y,E]=R.useState(0);rn("deviation",O=>{y!==O&&(h.current.style.marginTop=`${O}px`,E(O))});const x=wt("deviationCommitted");ye(()=>{x(y)},[y,x]);const g=j("EmptyPlaceholder"),a=j("FillerRow")??Hr,T=j("TableBodyComponent"),S=j("paddingTopAddition"),C=j("statefulTotalCount"),B=j("context");if(C===0&&g!==null&&g!==void 0)return V.jsx(g,{...rt(g,B)});const u=(n?e.topItems:[]).reduce((O,P)=>O+P.size,0),p=e.offsetTop+S+y-u,b=e.offsetBottom,L=p>0?V.jsx(a,{context:B,height:p},"padding-top"):null,F=b>0?V.jsx(a,{context:B,height:b},"padding-bottom"):null;return V.jsxs(T,{"data-testid":"virtuoso-item-list",ref:m,...rt(T,B),children:[L,n&&V.jsx(Hn,{showTopList:!0}),V.jsx(Hn,{}),F]})}),Or=({children:t})=>{const e=R.useContext(me),n=wt("viewportHeight"),o=wt("fixedItemHeight"),r=Ot(R.useMemo(()=>ne(n,s=>Et(s,"height")),[n]),!0,j("skipAnimationFrameInResizeObserver"));return R.useEffect(()=>{e&&(n(e.viewportHeight),o(e.itemHeight))},[e,n,o]),V.jsx("div",{"data-viewport-type":"element",ref:r,style:Re(!1),children:t})},Lr=({children:t})=>{const e=R.useContext(me),n=wt("windowViewportRect"),o=wt("fixedItemHeight"),r=j("customScrollParent"),s=j("useWindowScroll"),i=Ne(n,r,j("skipAnimationFrameInResizeObserver"));return R.useEffect(()=>{e&&(o(e.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:e.viewportHeight,visibleWidth:100}))},[e,n,o]),V.jsx("div",{"data-viewport-type":"window",ref:i,style:tn(!1,s),children:t})},zr=R.memo(function(e){const n=j("useWindowScroll"),o=j("customScrollParent"),r=wt("fixedHeaderHeight"),s=wt("fixedFooterHeight"),i=j("fixedHeaderContent"),l=j("fixedFooterContent"),c=j("context"),d=Ot(R.useMemo(()=>ne(r,a=>Et(a,"height")),[r]),!0,j("skipAnimationFrameInResizeObserver")),f=Ot(R.useMemo(()=>ne(s,a=>Et(a,"height")),[s]),!0,j("skipAnimationFrameInResizeObserver")),v=o||n?Vr:Fr,m=o||n?Lr:Or,h=j("TableComponent"),y=j("TableHeadComponent"),E=j("TableFooterComponent"),x=i?V.jsx(y,{ref:d,style:{position:"sticky",top:0,zIndex:2},...rt(y,c),children:i()},"TableHead"):null,g=l?V.jsx(E,{ref:f,style:{bottom:0,position:"sticky",zIndex:1},...rt(E,c),children:l()},"TableFoot"):null;return V.jsx(v,{...e,...rt(v,c),children:V.jsx(m,{children:V.jsxs(h,{style:{borderSpacing:0,overflowAnchor:"none"},...rt(h,c),children:[x,V.jsx(Br,{},"TableBody"),g]})})})}),{Component:co,useEmitter:rn,useEmitterValue:j,usePublisher:wt}=Ze(Rr,{optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",groupContent:"groupContent",fixedHeaderContent:"fixedHeaderContent",fixedFooterContent:"fixedFooterContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},zr),Fr=en({useEmitter:rn,useEmitterValue:j,usePublisher:wt}),Vr=nn({useEmitter:rn,useEmitterValue:j,usePublisher:wt}),Pr=co,Wr=co,kn={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},Gr={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Bn,floor:Te,max:ee,min:Le,round:On}=Math;function Ln(t,e,n){return Array.from({length:e-t+1}).map((o,r)=>({data:n===null?null:n[r+t],index:r+t}))}function Mr(t){return{...Gr,items:t}}function xe(t,e){return t!==void 0&&t.width===e.width&&t.height===e.height}function Ar(t,e){return t!==void 0&&t.column===e.column&&t.row===e.row}const jr=Z(([{increaseViewportBy:t,listBoundary:e,overscan:n,visibleRange:o},{footerHeight:r,headerHeight:s,scrollBy:i,scrollContainerState:l,scrollTo:c,scrollTop:d,smoothScrollTargetReached:f,viewportHeight:v},m,h,{didMount:y,propsReady:E},{customScrollParent:x,useWindowScroll:g,windowScrollContainerState:a,windowScrollTo:T,windowViewportRect:S},C])=>{const B=w(0),u=w(0),p=w(kn),b=w({height:0,width:0}),L=w({height:0,width:0}),F=U(),O=U(),P=w(0),$=w(null),q=w({column:0,row:0}),D=U(),K=U(),J=w(!1),ft=w(0),pt=w(!0),xt=w(!1),Ft=w(!1);X(I(y,N(ft),G(([H,_])=>!Ge(_))),()=>{A(pt,!1)}),X(I(at(y,pt,L,b,ft,xt),G(([H,_,Y,it,,et])=>H&&!_&&Y.height!==0&&it.height!==0&&!et)),([,,,,H])=>{if(H===void 0){A(pt,!0);return}A(xt,!0),Ue(1,()=>{A(F,H)}),bt(I(d),()=>{A(e,[0,0]),A(pt,!0)})}),z(I(K,G(H=>H!=null&&H.scrollTop>0),kt(0)),u),X(I(y,N(K),G(([,H])=>H!=null)),([,H])=>{H&&(A(b,H.viewport),A(L,H.item),A(q,H.gap),H.scrollTop>0&&(A(J,!0),bt(I(d,Nt(1)),_=>{A(J,!1)}),A(c,{top:H.scrollTop})))}),z(I(b,k(({height:H})=>H)),v),z(I(at(W(b,xe),W(L,xe),W(q,(H,_)=>H!==void 0&&H.column===_.column&&H.row===_.row),W(d)),k(([H,_,Y,it])=>({gap:Y,item:_,scrollTop:it,viewport:H}))),D),z(I(at(W(B),o,W(q,Ar),W(L,xe),W(b,xe),W($),W(u),W(J),W(pt),W(ft)),G(([,,,,,,,H])=>!H),k(([H,[_,Y],it,et,Q,ct,St,,ut,Vt])=>{const{column:Pt,row:Qt}=it,{height:pe,width:Ee}=et,{width:sn}=Q;if(St===0&&(H===0||sn===0))return kn;if(Ee===0){const dn=Ke(Vt,H),mo=dn+Math.max(St-1,0);return Mr(Ln(dn,mo,ct))}const he=uo(sn,Ee,Pt);let Ut,At;ut?_===0&&Y===0&&St>0?(Ut=0,At=St-1):(Ut=he*Te((_+Qt)/(pe+Qt)),At=he*Bn((Y+Qt)/(pe+Qt))-1,At=Le(H-1,ee(At,he-1)),Ut=Le(At,ee(0,Ut))):(Ut=0,At=-1);const ln=Ln(Ut,At,ct),{bottom:cn,top:un}=zn(Q,it,et,ln),an=Bn(H/he),fo=an*pe+(an-1)*Qt-cn;return{bottom:cn,itemHeight:pe,items:ln,itemWidth:Ee,offsetBottom:fo,offsetTop:un,top:un}})),p),z(I($,G(H=>H!==null),k(H=>H.length)),B),z(I(at(b,L,p,q),G(([H,_,{items:Y}])=>Y.length>0&&_.height!==0&&H.height!==0),k(([H,_,{items:Y},it])=>{const{bottom:et,top:Q}=zn(H,it,_,Y);return[Q,et]}),ot(se)),e);const ht=w(!1);z(I(d,N(ht),k(([H,_])=>_||H!==0)),ht);const $t=Ct(I(at(p,B),G(([{items:H}])=>H.length>0),N(ht),G(([[H,_],Y])=>{const et=H.items[H.items.length-1].index===_-1;return(Y||H.bottom>0&&H.itemHeight>0&&H.offsetBottom===0&&H.items.length===_)&&et}),k(([[,H]])=>H-1),ot())),Xt=Ct(I(W(p),G(({items:H})=>H.length>0&&H[0].index===0),kt(0),ot())),Ht=Ct(I(W(p),N(J),G(([{items:H},_])=>H.length>0&&!_),k(([{items:H}])=>({endIndex:H[H.length-1].index,startIndex:H[0].index})),ot(Dn),zt(0)));z(Ht,h.scrollSeekRangeChanged),z(I(F,N(b,L,B,q),k(([H,_,Y,it,et])=>{const Q=Yn(H),{align:ct,behavior:St,offset:ut}=Q;let Vt=Q.index;Vt==="LAST"&&(Vt=it-1),Vt=ee(0,Vt,Le(it-1,Vt));let Pt=Me(_,et,Y,Vt);return ct==="end"?Pt=On(Pt-_.height+Y.height):ct==="center"&&(Pt=On(Pt-_.height/2+Y.height/2)),ut!==void 0&&ut!==0&&(Pt+=ut),{behavior:St,top:Pt}})),c);const Jt=gt(I(p,k(H=>H.offsetBottom+H.bottom)),0);return z(I(S,k(H=>({height:H.visibleHeight,width:H.visibleWidth}))),b),{customScrollParent:x,data:$,deviation:P,footerHeight:r,gap:q,headerHeight:s,increaseViewportBy:t,initialItemCount:u,itemDimensions:L,overscan:n,restoreStateFrom:K,scrollBy:i,scrollContainerState:l,scrollHeight:O,scrollTo:c,scrollToIndex:F,scrollTop:d,smoothScrollTargetReached:f,totalCount:B,useWindowScroll:g,viewportDimensions:b,windowScrollContainerState:a,windowScrollTo:T,windowViewportRect:S,...h,gridState:p,horizontalDirection:Ft,initialTopMostItemIndex:ft,totalListHeight:Jt,...m,endReached:$t,propsReady:E,rangeChanged:Ht,startReached:Xt,stateChanged:D,stateRestoreInProgress:J,...C}},st(qe,It,fe,eo,Mt,Ye,Gt));function uo(t,e,n){return ee(1,Te((t+n)/(Te(e)+n)))}function zn(t,e,n,o){const{height:r}=n;if(r===void 0||o.length===0)return{bottom:0,top:0};const s=Me(t,e,n,o[0].index);return{bottom:Me(t,e,n,o[o.length-1].index)+r,top:s}}function Me(t,e,n,o){const r=uo(t.width,n.width,e.column),s=Te(o/r),i=s*n.height+ee(0,s-1)*e.row;return i>0?i+e.row:i}const _r=Z(()=>{const t=w(v=>`Item ${v}`),e=w({}),n=w(null),o=w("virtuoso-grid-item"),r=w("virtuoso-grid-list"),s=w(Qe),i=w("div"),l=w(Zt),c=(v,m=null)=>gt(I(e,k(h=>h[v]),ot()),m),d=w(!1),f=w(!1);return z(W(f),d),{components:e,computeItemKey:s,context:n,FooterComponent:c("Footer"),HeaderComponent:c("Header"),headerFooterTag:i,itemClassName:o,ItemComponent:c("Item","div"),itemContent:t,listClassName:r,ListComponent:c("List","div"),readyStateChanged:d,reportReadyState:f,ScrollerComponent:c("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:c("ScrollSeekPlaceholder","div")}}),Nr=Z(([t,e])=>({...t,...e}),st(jr,_r)),Dr=R.memo(function(){const e=nt("gridState"),n=nt("listClassName"),o=nt("itemClassName"),r=nt("itemContent"),s=nt("computeItemKey"),i=nt("isSeeking"),l=yt("scrollHeight"),c=nt("ItemComponent"),d=nt("ListComponent"),f=nt("ScrollSeekPlaceholder"),v=nt("context"),m=yt("itemDimensions"),h=yt("gap"),y=nt("log"),E=nt("stateRestoreInProgress"),x=yt("reportReadyState"),g=Ot(R.useMemo(()=>a=>{const T=a.parentElement.parentElement.scrollHeight;l(T);const S=a.firstChild;if(S!==null){const{height:C,width:B}=S.getBoundingClientRect();m({height:C,width:B})}h({column:Fn("column-gap",getComputedStyle(a).columnGap,y),row:Fn("row-gap",getComputedStyle(a).rowGap,y)})},[l,m,h,y]),!0,!1);return ye(()=>{e.itemHeight>0&&e.itemWidth>0&&x(!0)},[e]),E?null:V.jsx(d,{className:n,ref:g,...rt(d,v),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(a=>{const T=s(a.index,a.data,v);return i?V.jsx(f,{...rt(f,v),height:e.itemHeight,index:a.index,width:e.itemWidth},T):R.createElement(c,{...rt(c,v),className:o,"data-index":a.index,key:T},r(a.index,a.data,v))})})}),$r=R.memo(function(){const e=nt("HeaderComponent"),n=yt("headerHeight"),o=nt("headerFooterTag"),r=Ot(R.useMemo(()=>i=>{n(Et(i,"height"))},[n]),!0,!1),s=nt("context");return e!=null?V.jsx(o,{ref:r,children:V.jsx(e,{...rt(e,s)})}):null}),Ur=R.memo(function(){const e=nt("FooterComponent"),n=yt("footerHeight"),o=nt("headerFooterTag"),r=Ot(R.useMemo(()=>i=>{n(Et(i,"height"))},[n]),!0,!1),s=nt("context");return e!=null?V.jsx(o,{ref:r,children:V.jsx(e,{...rt(e,s)})}):null}),Kr=({children:t})=>{const e=R.useContext(Xe),n=yt("itemDimensions"),o=yt("viewportDimensions"),r=Ot(R.useMemo(()=>s=>{o(s.getBoundingClientRect())},[o]),!0,!1);return R.useEffect(()=>{e&&(o({height:e.viewportHeight,width:e.viewportWidth}),n({height:e.itemHeight,width:e.itemWidth}))},[e,o,n]),V.jsx("div",{ref:r,style:Re(!1),children:t})},qr=({children:t})=>{const e=R.useContext(Xe),n=yt("windowViewportRect"),o=yt("itemDimensions"),r=nt("customScrollParent"),s=nt("useWindowScroll"),i=Ne(n,r,!1);return R.useEffect(()=>{e&&(o({height:e.itemHeight,width:e.itemWidth}),n({listHeight:0,offsetTop:0,visibleHeight:e.viewportHeight,visibleWidth:e.viewportWidth}))},[e,n,o]),V.jsx("div",{ref:i,style:tn(!1,s),children:t})},Yr=R.memo(function({...e}){const n=nt("useWindowScroll"),o=nt("customScrollParent"),r=o||n?Jr:Xr,s=o||n?qr:Kr,i=nt("context");return V.jsx(r,{...e,...rt(r,i),children:V.jsxs(s,{children:[V.jsx($r,{}),V.jsx(Dr,{}),V.jsx(Ur,{})]})})}),{Component:Zr,useEmitter:ao,useEmitterValue:nt,usePublisher:yt}=Ze(Nr,{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"}},Yr),Xr=en({useEmitter:ao,useEmitterValue:nt,usePublisher:yt}),Jr=nn({useEmitter:ao,useEmitterValue:nt,usePublisher:yt});function Fn(t,e,n){return e!=="normal"&&e?.endsWith("px")!==!0&&n(`${t} was not resolved to pixel value correctly`,e,dt.WARN),e==="normal"?0:parseInt(e??"0",10)}const Qr=Zr;exports.GroupedTableVirtuoso=Wr;exports.GroupedVirtuoso=yr;exports.LogLevel=dt;exports.TableVirtuoso=Pr;exports.Virtuoso=wr;exports.VirtuosoGrid=Qr;exports.VirtuosoGridMockContext=Xe;exports.VirtuosoMockContext=me;
package/dist/index.mjs CHANGED
@@ -48,7 +48,7 @@ function De(t) {
48
48
  function lt(t) {
49
49
  return t(Pn);
50
50
  }
51
- function L(t, e) {
51
+ function z(t, e) {
52
52
  return X(t, So(e, we));
53
53
  }
54
54
  function bt(t, e) {
@@ -169,7 +169,7 @@ function w(t) {
169
169
  });
170
170
  }
171
171
  function gt(t, e) {
172
- return ye(w(e), (n) => L(t, n));
172
+ return ye(w(e), (n) => z(t, n));
173
173
  }
174
174
  function K() {
175
175
  const t = [];
@@ -192,7 +192,7 @@ function K() {
192
192
  });
193
193
  }
194
194
  function Ct(t) {
195
- return ye(K(), (e) => L(t, e));
195
+ return ye(K(), (e) => z(t, e));
196
196
  }
197
197
  const wo = { singleton: !0 };
198
198
  function Z(t, e = [], n = wo) {
@@ -401,19 +401,19 @@ function Ue(t, e, n) {
401
401
  const St = Z(
402
402
  () => {
403
403
  const t = K(), e = K(), n = w(0), o = K(), r = K(), s = w(0), i = K(), l = K(), c = w(0), d = w(0), f = w(0), v = w(0), m = K(), h = K(), y = w(!1), R = w(!1), I = w(!1);
404
- return L(
404
+ return z(
405
405
  S(
406
406
  t,
407
407
  k(({ scrollTop: g }) => g)
408
408
  ),
409
409
  e
410
- ), L(
410
+ ), z(
411
411
  S(
412
412
  t,
413
413
  k(({ scrollHeight: g }) => g)
414
414
  ),
415
415
  l
416
- ), L(e, s), {
416
+ ), z(e, s), {
417
417
  deviation: n,
418
418
  deviationCommitted: o,
419
419
  fixedFooterHeight: f,
@@ -762,22 +762,22 @@ const _o = {
762
762
  ),
763
763
  []
764
764
  );
765
- L(
765
+ z(
766
766
  S(
767
767
  c,
768
768
  W((u) => u.length > 0),
769
769
  D(g, R),
770
770
  k(([u, p, b]) => {
771
- const z = u.reduce((F, O, V) => vt(F, O, ce(O, p.offsetTree, b) || V), Yt());
771
+ const L = u.reduce((F, O, V) => vt(F, O, ce(O, p.offsetTree, b) || V), Yt());
772
772
  return {
773
773
  ...p,
774
774
  groupIndices: u,
775
- groupOffsetTree: z
775
+ groupOffsetTree: L
776
776
  };
777
777
  })
778
778
  ),
779
779
  g
780
- ), L(
780
+ ), z(
781
781
  S(
782
782
  o,
783
783
  D(g),
@@ -791,7 +791,7 @@ const _o = {
791
791
  ])
792
792
  ),
793
793
  n
794
- ), L(d, f);
794
+ ), z(d, f);
795
795
  const T = gt(
796
796
  S(
797
797
  d,
@@ -799,7 +799,7 @@ const _o = {
799
799
  ),
800
800
  !0
801
801
  );
802
- L(
802
+ z(
803
803
  S(
804
804
  f,
805
805
  W((u) => u !== void 0 && tt(lt(g).sizeTree)),
@@ -812,49 +812,49 @@ const _o = {
812
812
  })
813
813
  ),
814
814
  n
815
- ), L(
815
+ ), z(
816
816
  S(
817
817
  m,
818
818
  W((u) => u !== void 0 && u.length > 0 && tt(lt(g).sizeTree)),
819
819
  k((u) => {
820
820
  const p = [];
821
- let b = u[0], z = 0;
821
+ let b = u[0], L = 0;
822
822
  for (let F = 1; F < u.length; F++) {
823
823
  const O = u[F];
824
824
  O !== b && (p.push({
825
825
  endIndex: F - 1,
826
826
  size: b,
827
- startIndex: z
828
- }), b = O, z = F);
827
+ startIndex: L
828
+ }), b = O, L = F);
829
829
  }
830
830
  return p.push({
831
831
  endIndex: u.length - 1,
832
832
  size: b,
833
- startIndex: z
833
+ startIndex: L
834
834
  }), p;
835
835
  })
836
836
  ),
837
837
  n
838
- ), L(
838
+ ), z(
839
839
  S(
840
840
  c,
841
841
  D(v, f),
842
842
  W(([, u, p]) => u !== void 0 && p !== void 0),
843
843
  k(([u, p, b]) => {
844
- const z = [];
844
+ const L = [];
845
845
  for (let F = 0; F < u.length; F++) {
846
846
  const O = u[F], V = u[F + 1];
847
- z.push({
847
+ L.push({
848
848
  startIndex: O,
849
849
  endIndex: O,
850
850
  size: p
851
- }), V !== void 0 && z.push({
851
+ }), V !== void 0 && L.push({
852
852
  startIndex: O + 1,
853
853
  endIndex: V - 1,
854
854
  size: b
855
855
  });
856
856
  }
857
- return z;
857
+ return L;
858
858
  })
859
859
  ),
860
860
  n
@@ -899,22 +899,22 @@ const _o = {
899
899
  );
900
900
  });
901
901
  const C = Ct(s);
902
- L(
902
+ z(
903
903
  S(
904
904
  s,
905
905
  D(g),
906
906
  k(([u, p]) => {
907
- const b = p.groupIndices.length > 0, z = [], F = p.lastSize;
907
+ const b = p.groupIndices.length > 0, L = [], F = p.lastSize;
908
908
  if (b) {
909
909
  const O = ie(p.sizeTree, 0);
910
910
  let V = 0, U = 0;
911
911
  for (; V < u; ) {
912
912
  const j = p.groupIndices[U], J = p.groupIndices.length === U + 1 ? 1 / 0 : p.groupIndices[U + 1] - j - 1;
913
- z.push({
913
+ L.push({
914
914
  endIndex: j,
915
915
  size: O,
916
916
  startIndex: j
917
- }), z.push({
917
+ }), L.push({
918
918
  endIndex: j + 1 + J - 1,
919
919
  size: F,
920
920
  startIndex: j + 1
@@ -940,7 +940,7 @@ const _o = {
940
940
  {
941
941
  prevIndex: u,
942
942
  prevSize: 0,
943
- ranges: z
943
+ ranges: L
944
944
  }
945
945
  ).ranges;
946
946
  }
@@ -965,12 +965,12 @@ const _o = {
965
965
  i,
966
966
  D(g, R),
967
967
  k(([u, { offsetTree: p }, b]) => {
968
- const z = -u;
969
- return ce(z, p, b);
968
+ const L = -u;
969
+ return ce(L, p, b);
970
970
  })
971
971
  )
972
972
  );
973
- return L(
973
+ return z(
974
974
  S(
975
975
  i,
976
976
  D(g, R),
@@ -1046,19 +1046,19 @@ function No(t) {
1046
1046
  const Yn = Z(
1047
1047
  ([{ groupIndices: t, sizes: e, totalCount: n }, { headerHeight: o, scrollTop: r }]) => {
1048
1048
  const s = K(), i = K(), l = Ct(S(s, k(No)));
1049
- return L(
1049
+ return z(
1050
1050
  S(
1051
1051
  l,
1052
1052
  k((c) => c.totalCount)
1053
1053
  ),
1054
1054
  n
1055
- ), L(
1055
+ ), z(
1056
1056
  S(
1057
1057
  l,
1058
1058
  k((c) => c.groupIndices)
1059
1059
  ),
1060
1060
  t
1061
- ), L(
1061
+ ), z(
1062
1062
  S(
1063
1063
  at(r, e, o),
1064
1064
  W(([c, d]) => Re(d)),
@@ -1110,21 +1110,21 @@ const fe = Z(
1110
1110
  function T() {
1111
1111
  I !== null && (I(), I = null), a !== null && (a(), a = null), g && (clearTimeout(g), g = null), M(c, !1);
1112
1112
  }
1113
- return L(
1113
+ return z(
1114
1114
  S(
1115
1115
  h,
1116
1116
  D(n, v, o, R, l, i, m),
1117
1117
  D(t, s, r),
1118
1118
  k(
1119
1119
  ([
1120
- [x, C, B, u, p, b, z, F],
1120
+ [x, C, B, u, p, b, L, F],
1121
1121
  O,
1122
1122
  V,
1123
1123
  U
1124
1124
  ]) => {
1125
1125
  const q = Zn(x), { align: $, behavior: j, offset: J } = q, dt = u - 1, pt = qn(q, C, dt);
1126
1126
  let It = ce(pt, C.offsetTree, O) + b;
1127
- $ === "end" ? (It += V + Rt(C.sizeTree, pt)[1] - B + U, pt === dt && (It += z)) : $ === "center" ? It += (V + Rt(C.sizeTree, pt)[1] - B + U) / 2 : It -= p, J !== void 0 && J !== 0 && (It += J);
1127
+ $ === "end" ? (It += V + Rt(C.sizeTree, pt)[1] - B + U, pt === dt && (It += L)) : $ === "center" ? It += (V + Rt(C.sizeTree, pt)[1] - B + U) / 2 : It -= p, J !== void 0 && J !== 0 && (It += J);
1128
1128
  const Ft = (ht) => {
1129
1129
  T(), ht ? (F("retrying to scroll to", { location: x }, mt.DEBUG), M(h, x)) : (M(y, !0), F("list did not change, scroll successful", {}, mt.DEBUG));
1130
1130
  };
@@ -1180,7 +1180,7 @@ function Me(t) {
1180
1180
  const me = Z(
1181
1181
  ([{ defaultItemSize: t, listRefresh: e, sizes: n }, { scrollTop: o }, { scrollTargetReached: r, scrollToIndex: s }, { didMount: i }]) => {
1182
1182
  const l = w(!0), c = w(0), d = w(!0);
1183
- return L(
1183
+ return z(
1184
1184
  S(
1185
1185
  i,
1186
1186
  D(c),
@@ -1188,7 +1188,7 @@ const me = Z(
1188
1188
  kt(!1)
1189
1189
  ),
1190
1190
  l
1191
- ), L(
1191
+ ), z(
1192
1192
  S(
1193
1193
  i,
1194
1194
  D(c),
@@ -1248,19 +1248,19 @@ const ue = "up", ne = "down", Uo = "none", Ko = {
1248
1248
  S(Ve(S(n, kt(!0)), S(n, kt(!1), hn(200))), ot()),
1249
1249
  !1
1250
1250
  );
1251
- L(
1251
+ z(
1252
1252
  S(
1253
1253
  at(P(r), P(v)),
1254
1254
  k(([a, T]) => a <= T),
1255
1255
  ot()
1256
1256
  ),
1257
1257
  l
1258
- ), L(S(l, zt(50)), d);
1258
+ ), z(S(l, zt(50)), d);
1259
1259
  const y = Ct(
1260
1260
  S(
1261
1261
  at(o, P(s), P(e), P(t), P(f)),
1262
1262
  Bt((a, [{ scrollHeight: T, scrollTop: x }, C, B, u, p]) => {
1263
- const b = x + C - T > -p, z = {
1263
+ const b = x + C - T > -p, L = {
1264
1264
  scrollHeight: T,
1265
1265
  scrollTop: x,
1266
1266
  viewportHeight: C
@@ -1271,14 +1271,14 @@ const ue = "up", ne = "down", Uo = "none", Ko = {
1271
1271
  atBottom: !0,
1272
1272
  atBottomBecause: O,
1273
1273
  scrollTopDelta: V,
1274
- state: z
1274
+ state: L
1275
1275
  };
1276
1276
  }
1277
1277
  let F;
1278
- return z.scrollHeight > a.state.scrollHeight ? F = "SIZE_INCREASED" : C < a.state.viewportHeight ? F = "VIEWPORT_HEIGHT_DECREASING" : x < a.state.scrollTop ? F = "SCROLLING_UPWARDS" : F = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", {
1278
+ return L.scrollHeight > a.state.scrollHeight ? F = "SIZE_INCREASED" : C < a.state.viewportHeight ? F = "VIEWPORT_HEIGHT_DECREASING" : x < a.state.scrollTop ? F = "SCROLLING_UPWARDS" : F = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", {
1279
1279
  atBottom: !1,
1280
1280
  notAtBottomBecause: F,
1281
- state: z
1281
+ state: L
1282
1282
  };
1283
1283
  }, Ko),
1284
1284
  ot((a, T) => a !== void 0 && a.atBottom === T.atBottom)
@@ -1316,15 +1316,15 @@ const ue = "up", ne = "down", Uo = "none", Ko = {
1316
1316
  ),
1317
1317
  0
1318
1318
  );
1319
- L(
1319
+ z(
1320
1320
  S(
1321
1321
  y,
1322
1322
  k((a) => a.atBottom)
1323
1323
  ),
1324
1324
  i
1325
- ), L(S(i, zt(50)), c);
1325
+ ), z(S(i, zt(50)), c);
1326
1326
  const I = w(ne);
1327
- L(
1327
+ z(
1328
1328
  S(
1329
1329
  o,
1330
1330
  k(({ scrollTop: a }) => a),
@@ -1336,16 +1336,16 @@ const ue = "up", ne = "down", Uo = "none", Ko = {
1336
1336
  k((a) => a.direction)
1337
1337
  ),
1338
1338
  I
1339
- ), L(S(o, zt(50), kt(Uo)), I);
1339
+ ), z(S(o, zt(50), kt(Uo)), I);
1340
1340
  const g = w(0);
1341
- return L(
1341
+ return z(
1342
1342
  S(
1343
1343
  m,
1344
1344
  W((a) => !a),
1345
1345
  kt(0)
1346
1346
  ),
1347
1347
  g
1348
- ), L(
1348
+ ), z(
1349
1349
  S(
1350
1350
  r,
1351
1351
  zt(100),
@@ -1528,7 +1528,7 @@ const Kt = Z(
1528
1528
  { recalcInProgress: y }
1529
1529
  ]) => {
1530
1530
  const R = w([]), I = w(0), g = K(), a = w(0);
1531
- L(s.topItemsIndexes, R);
1531
+ z(s.topItemsIndexes, R);
1532
1532
  const T = gt(
1533
1533
  S(
1534
1534
  at(
@@ -1546,8 +1546,8 @@ const Kt = Z(
1546
1546
  t,
1547
1547
  P(I)
1548
1548
  ),
1549
- W(([u, p, , b, , , , , , , , z]) => {
1550
- const F = z !== void 0 && z.length !== b;
1549
+ W(([u, p, , b, , , , , , , , L]) => {
1550
+ const F = L !== void 0 && L.length !== b;
1551
1551
  return u && !p && !F;
1552
1552
  }),
1553
1553
  k(
@@ -1556,7 +1556,7 @@ const Kt = Z(
1556
1556
  ,
1557
1557
  [u, p],
1558
1558
  b,
1559
- z,
1559
+ L,
1560
1560
  F,
1561
1561
  O,
1562
1562
  V,
@@ -1566,11 +1566,11 @@ const Kt = Z(
1566
1566
  j,
1567
1567
  J
1568
1568
  ]) => {
1569
- const dt = z, { offsetTree: pt, sizeTree: It } = dt;
1569
+ const dt = L, { offsetTree: pt, sizeTree: It } = dt;
1570
1570
  if (b === 0)
1571
1571
  return { ...Oe, totalCount: b };
1572
1572
  if (u === 0 && p === 0)
1573
- return J === 0 ? { ...Oe, totalCount: b } : Jn(J, F, z, U, q, j);
1573
+ return J === 0 ? { ...Oe, totalCount: b } : Jn(J, F, L, U, q, j);
1574
1574
  if (tt(It))
1575
1575
  return J > 0 ? null : ve(
1576
1576
  qo(Ye(F, b), dt, j),
@@ -1640,26 +1640,26 @@ const Kt = Z(
1640
1640
  ),
1641
1641
  Oe
1642
1642
  );
1643
- L(
1643
+ z(
1644
1644
  S(
1645
1645
  t,
1646
1646
  W(Ne),
1647
1647
  k((u) => u?.length)
1648
1648
  ),
1649
1649
  r
1650
- ), L(
1650
+ ), z(
1651
1651
  S(
1652
1652
  T,
1653
1653
  k((u) => u.topListHeight)
1654
1654
  ),
1655
1655
  v
1656
- ), L(v, l), L(
1656
+ ), z(v, l), z(
1657
1657
  S(
1658
1658
  T,
1659
1659
  k((u) => [u.top, u.bottom])
1660
1660
  ),
1661
1661
  i
1662
- ), L(
1662
+ ), z(
1663
1663
  S(
1664
1664
  T,
1665
1665
  k((u) => u.items)
@@ -1672,8 +1672,14 @@ const Kt = Z(
1672
1672
  W(({ items: u }) => u.length > 0),
1673
1673
  D(r, t),
1674
1674
  W(([{ items: u }, p]) => u[u.length - 1].originalIndex === p - 1),
1675
- k(([, u, p]) => [u - 1, p]),
1675
+ k(([{ items: u }, p, b]) => {
1676
+ const L = u[u.length - 1], F = L.type === "group" ? L.index + 1 : (L.groupIndex ?? -1) + 1;
1677
+ return [p - 1 - F, b];
1678
+ }),
1676
1679
  ot(le),
1680
+ // when every group is empty, only headers render and there is no item index to report.
1681
+ // Filter after the distinct check, so that the same index fires again once an item returns.
1682
+ W(([u]) => u >= 0),
1677
1683
  k(([u]) => u)
1678
1684
  )
1679
1685
  ), C = Ct(
@@ -1735,7 +1741,7 @@ const Kt = Z(
1735
1741
  ),
1736
1742
  0
1737
1743
  );
1738
- return L(P(i), s), { totalListHeight: i, totalListHeightChanged: s };
1744
+ return z(P(i), s), { totalListHeight: i, totalListHeightChanged: s };
1739
1745
  },
1740
1746
  st(St, Kt),
1741
1747
  { singleton: !0 }
@@ -1770,18 +1776,18 @@ const Kt = Z(
1770
1776
  { scrollToIndex: d }
1771
1777
  ]) => {
1772
1778
  const f = K();
1773
- return L(
1779
+ return z(
1774
1780
  S(
1775
1781
  f,
1776
1782
  D(e, c, n, s, r, o, l),
1777
1783
  D(t),
1778
1784
  k(([[v, m, h, y, R, I, g, a], T]) => {
1779
- const { calculateViewLocation: x = Zo, done: C, ...B } = v, u = qn(v, m, y - 1), p = ce(u, m.offsetTree, T) + R + I, b = p + Rt(m.sizeTree, u)[1], z = a + I, F = a + h - g, O = x({
1785
+ const { calculateViewLocation: x = Zo, done: C, ...B } = v, u = qn(v, m, y - 1), p = ce(u, m.offsetTree, T) + R + I, b = p + Rt(m.sizeTree, u)[1], L = a + I, F = a + h - g, O = x({
1780
1786
  itemBottom: b,
1781
1787
  itemTop: p,
1782
1788
  locationParams: B,
1783
1789
  viewportBottom: F,
1784
- viewportTop: z
1790
+ viewportTop: L
1785
1791
  });
1786
1792
  return O === null ? C?.() : C && bt(
1787
1793
  S(
@@ -1832,9 +1838,9 @@ const Xo = (t, e) => typeof t == "function" ? bn(t(e)) : e && bn(t), Jo = Z(
1832
1838
  S(
1833
1839
  at(S(P(e), Ut(1)), c),
1834
1840
  D(P(y), s, l, v),
1835
- k(([[C, B], u, p, b, z]) => {
1841
+ k(([[C, B], u, p, b, L]) => {
1836
1842
  let F = B && b, O = "auto";
1837
- return F && (O = Xo(u, p || z), F = F && O !== !1), { followOutputBehavior: O, shouldFollow: F, totalCount: C };
1843
+ return F && (O = Xo(u, p || L), F = F && O !== !1), { followOutputBehavior: O, shouldFollow: F, totalCount: C };
1838
1844
  }),
1839
1845
  W(({ shouldFollow: C }) => C)
1840
1846
  ),
@@ -1872,7 +1878,7 @@ const Xo = (t, e) => typeof t == "function" ? bn(t(e)) : e && bn(t), Jo = Z(
1872
1878
  C !== !1 && !B.atBottom && B.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && g("auto");
1873
1879
  });
1874
1880
  const T = w(null), x = K();
1875
- return L(
1881
+ return z(
1876
1882
  Ve(
1877
1883
  S(
1878
1884
  P(o),
@@ -1885,7 +1891,7 @@ const Xo = (t, e) => typeof t == "function" ? bn(t(e)) : e && bn(t), Jo = Z(
1885
1891
  S(
1886
1892
  at(S(x, Ut(1)), c),
1887
1893
  D(P(T), l, v, m),
1888
- k(([[C, B], u, p, b, z]) => B && p && u?.({ context: z, totalCount: C, scrollingInProgress: b })),
1894
+ k(([[C, B], u, p, b, L]) => B && p && u?.({ context: L, totalCount: C, scrollingInProgress: b })),
1889
1895
  W((C) => !!C),
1890
1896
  zt(0)
1891
1897
  ),
@@ -1910,7 +1916,7 @@ const Xo = (t, e) => typeof t == "function" ? bn(t(e)) : e && bn(t), Jo = Z(
1910
1916
  eo
1911
1917
  )
1912
1918
  ), Qo = Z(
1913
- ([{ data: t, firstItemIndex: e, gap: n, sizes: o }, { initialTopMostItemIndex: r }, { initialItemCount: s, listState: i }, { didMount: l }]) => (L(
1919
+ ([{ data: t, firstItemIndex: e, gap: n, sizes: o }, { initialTopMostItemIndex: r }, { initialItemCount: s, listState: i }, { didMount: l }]) => (z(
1914
1920
  S(
1915
1921
  l,
1916
1922
  D(s),
@@ -1955,7 +1961,7 @@ const Xo = (t, e) => typeof t == "function" ? bn(t(e)) : e && bn(t), Jo = Z(
1955
1961
  ), no = Z(
1956
1962
  ([{ scrollVelocity: t }]) => {
1957
1963
  const e = w(!1), n = K(), o = w(!1);
1958
- return L(
1964
+ return z(
1959
1965
  S(
1960
1966
  t,
1961
1967
  D(o, e, n),
@@ -1983,7 +1989,7 @@ const Xo = (t, e) => typeof t == "function" ? bn(t(e)) : e && bn(t), Jo = Z(
1983
1989
  { singleton: !0 }
1984
1990
  ), Xe = Z(([{ scrollContainerState: t, scrollTo: e }]) => {
1985
1991
  const n = K(), o = K(), r = K(), s = w(!1), i = w(void 0);
1986
- return L(
1992
+ return z(
1987
1993
  S(
1988
1994
  at(n, o),
1989
1995
  k(([{ scrollTop: l, viewportHeight: c }, { offsetTop: d, listHeight: f }]) => ({
@@ -1993,7 +1999,7 @@ const Xo = (t, e) => typeof t == "function" ? bn(t(e)) : e && bn(t), Jo = Z(
1993
1999
  }))
1994
2000
  ),
1995
2001
  t
1996
- ), L(
2002
+ ), z(
1997
2003
  S(
1998
2004
  e,
1999
2005
  D(o),
@@ -2022,7 +2028,7 @@ const Xo = (t, e) => typeof t == "function" ? bn(t(e)) : e && bn(t), Jo = Z(
2022
2028
  { useWindowScroll: i, windowScrollContainerState: l, windowViewportRect: c }
2023
2029
  ]) => {
2024
2030
  const d = K(), f = w(void 0), v = w(null), m = w(null);
2025
- return L(l, v), L(c, m), X(
2031
+ return z(l, v), z(c, m), X(
2026
2032
  S(
2027
2033
  d,
2028
2034
  D(e, o, i, v, m, n)
@@ -2031,7 +2037,7 @@ const Xo = (t, e) => typeof t == "function" ? bn(t(e)) : e && bn(t), Jo = Z(
2031
2037
  const x = Go(y.sizeTree);
2032
2038
  I && g !== null && a !== null && (R = g.scrollTop - a.offsetTop), R -= T, h({ ranges: x, scrollTop: R });
2033
2039
  }
2034
- ), L(S(f, W(Ne), k(nr)), r), L(
2040
+ ), z(S(f, W(Ne), k(nr)), r), z(
2035
2041
  S(
2036
2042
  s,
2037
2043
  D(f),
@@ -2052,7 +2058,7 @@ function nr(t) {
2052
2058
  }
2053
2059
  const or = Z(([{ topItemsIndexes: t }]) => {
2054
2060
  const e = w(0);
2055
- return L(
2061
+ return z(
2056
2062
  S(
2057
2063
  e,
2058
2064
  W((n) => n >= 0),
@@ -2079,10 +2085,10 @@ const rr = oo(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
2079
2085
  d,
2080
2086
  D(l),
2081
2087
  Bt(
2082
- ([, x, C, B], [{ bottom: u, items: p, offsetBottom: b, totalCount: z }, F]) => {
2088
+ ([, x, C, B], [{ bottom: u, items: p, offsetBottom: b, totalCount: L }, F]) => {
2083
2089
  const O = u + b;
2084
2090
  let V = 0;
2085
- return C === z && x.length > 0 && p.length > 0 && (p[0].originalIndex === 0 && x[0].originalIndex === 0 || (V = O - B, V !== 0 && (V += F))), [V, p, z, O];
2091
+ return C === L && x.length > 0 && p.length > 0 && (p[0].originalIndex === 0 && x[0].originalIndex === 0 || (V = O - B, V !== 0 && (V += F))), [V, p, L, O];
2086
2092
  },
2087
2093
  [0, [], 0, 0]
2088
2094
  ),
@@ -2105,7 +2111,7 @@ const rr = oo(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
2105
2111
  zt(1)
2106
2112
  ),
2107
2113
  g
2108
- ), L(
2114
+ ), z(
2109
2115
  S(
2110
2116
  m,
2111
2117
  k((x) => ({ top: -x }))
@@ -2133,15 +2139,15 @@ const rr = oo(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
2133
2139
  }
2134
2140
  if (C.length === 0)
2135
2141
  return b(x);
2136
- let z = 0;
2142
+ let L = 0;
2137
2143
  const F = ie(u, 0);
2138
2144
  let O = 0, V = 0;
2139
2145
  for (; O < x; ) {
2140
- O++, z += F;
2146
+ O++, L += F;
2141
2147
  let U = C.length === V + 1 ? 1 / 0 : C[V + 1] - C[V] - 1;
2142
- O + U > x && (z -= F, U = x - O + 1), O += U, z += b(U), V++;
2148
+ O + U > x && (L -= F, U = x - O + 1), O += U, L += b(U), V++;
2143
2149
  }
2144
- return z;
2150
+ return L;
2145
2151
  })
2146
2152
  ),
2147
2153
  (x) => {
@@ -2218,8 +2224,8 @@ const rr = oo(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
2218
2224
  { groupCounts: p },
2219
2225
  b
2220
2226
  ]) => {
2221
- const { listState: z, minOverscanItemCount: F, topItemsIndexes: O, rangeChanged: V, ...U } = x;
2222
- return L(V, b.scrollSeekRangeChanged), L(
2227
+ const { listState: L, minOverscanItemCount: F, topItemsIndexes: O, rangeChanged: V, ...U } = x;
2228
+ return z(V, b.scrollSeekRangeChanged), z(
2223
2229
  S(
2224
2230
  at(b.windowViewportRect, g.headerHeight, g.fixedHeaderHeight),
2225
2231
  // Keep a measurement range active when a window-scrolling list starts below the viewport.
@@ -2247,7 +2253,7 @@ const rr = oo(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
2247
2253
  ...T,
2248
2254
  groupIndices: i,
2249
2255
  itemSize: c,
2250
- listState: z,
2256
+ listState: L,
2251
2257
  minOverscanItemCount: F,
2252
2258
  scrollToIndex: C,
2253
2259
  // output
@@ -2491,7 +2497,7 @@ const ur = /* @__PURE__ */ Z(() => {
2491
2497
  be(() => {
2492
2498
  x(a);
2493
2499
  }, [a, x]);
2494
- const C = A("EmptyPlaceholder"), B = A("ScrollSeekPlaceholder") ?? dr, u = A("ListComponent"), p = A("ItemComponent"), b = A("GroupComponent"), z = A("computeItemKey"), F = A("isSeeking"), O = A("groupIndices").length > 0, V = A("alignToBottom"), U = A("initialItemFinalLocationReached"), q = e ? {} : {
2500
+ const C = A("EmptyPlaceholder"), B = A("ScrollSeekPlaceholder") ?? dr, u = A("ListComponent"), p = A("ItemComponent"), b = A("GroupComponent"), L = A("computeItemKey"), F = A("isSeeking"), O = A("groupIndices").length > 0, V = A("alignToBottom"), U = A("initialItemFinalLocationReached"), q = e ? {} : {
2495
2501
  boxSizing: "border-box",
2496
2502
  ...I ? {
2497
2503
  display: "inline-block",
@@ -2515,7 +2521,7 @@ const ur = /* @__PURE__ */ Z(() => {
2515
2521
  ref: g,
2516
2522
  style: q,
2517
2523
  children: (e ? n.topItems : n.items).map(($) => {
2518
- const j = $.originalIndex, J = z(j + n.firstItemIndex, $.data, f);
2524
+ const j = $.originalIndex, J = L(j + n.firstItemIndex, $.data, f);
2519
2525
  return F ? /* @__PURE__ */ Dt(
2520
2526
  B,
2521
2527
  {
@@ -2860,9 +2866,9 @@ const xr = ({ children: t }) => {
2860
2866
  const g = _("EmptyPlaceholder"), a = _("FillerRow") ?? Er, T = _("TableBodyComponent"), x = _("paddingTopAddition"), C = _("statefulTotalCount"), B = _("context");
2861
2867
  if (C === 0 && g !== null && g !== void 0)
2862
2868
  return /* @__PURE__ */ G(g, { ...rt(g, B) });
2863
- const u = (n ? e.topItems : []).reduce((O, V) => O + V.size, 0), p = e.offsetTop + x + y - u, b = e.offsetBottom, z = p > 0 ? /* @__PURE__ */ G(a, { context: B, height: p }, "padding-top") : null, F = b > 0 ? /* @__PURE__ */ G(a, { context: B, height: b }, "padding-bottom") : null;
2869
+ const u = (n ? e.topItems : []).reduce((O, V) => O + V.size, 0), p = e.offsetTop + x + y - u, b = e.offsetBottom, L = p > 0 ? /* @__PURE__ */ G(a, { context: B, height: p }, "padding-top") : null, F = b > 0 ? /* @__PURE__ */ G(a, { context: B, height: b }, "padding-bottom") : null;
2864
2870
  return /* @__PURE__ */ $t(T, { "data-testid": "virtuoso-item-list", ref: m, ...rt(T, B), children: [
2865
- z,
2871
+ L,
2866
2872
  n && /* @__PURE__ */ G(kn, { showTopList: !0 }),
2867
2873
  /* @__PURE__ */ G(kn, {}),
2868
2874
  F
@@ -3024,7 +3030,7 @@ const Ar = /* @__PURE__ */ Z(
3024
3030
  { customScrollParent: I, useWindowScroll: g, windowScrollContainerState: a, windowScrollTo: T, windowViewportRect: x },
3025
3031
  C
3026
3032
  ]) => {
3027
- const B = w(0), u = w(0), p = w(Bn), b = w({ height: 0, width: 0 }), z = w({ height: 0, width: 0 }), F = K(), O = K(), V = w(0), U = w(null), q = w({ column: 0, row: 0 }), $ = K(), j = K(), J = w(!1), dt = w(0), pt = w(!0), It = w(!1), Ft = w(!1);
3033
+ const B = w(0), u = w(0), p = w(Bn), b = w({ height: 0, width: 0 }), L = w({ height: 0, width: 0 }), F = K(), O = K(), V = w(0), U = w(null), q = w({ column: 0, row: 0 }), $ = K(), j = K(), J = w(!1), dt = w(0), pt = w(!0), It = w(!1), Ft = w(!1);
3028
3034
  X(
3029
3035
  S(
3030
3036
  y,
@@ -3036,7 +3042,7 @@ const Ar = /* @__PURE__ */ Z(
3036
3042
  }
3037
3043
  ), X(
3038
3044
  S(
3039
- at(y, pt, z, b, dt, It),
3045
+ at(y, pt, L, b, dt, It),
3040
3046
  W(([H, N, Y, it, , et]) => H && !N && Y.height !== 0 && it.height !== 0 && !et)
3041
3047
  ),
3042
3048
  ([, , , , H]) => {
@@ -3050,7 +3056,7 @@ const Ar = /* @__PURE__ */ Z(
3050
3056
  M(e, [0, 0]), M(pt, !0);
3051
3057
  });
3052
3058
  }
3053
- ), L(
3059
+ ), z(
3054
3060
  S(
3055
3061
  j,
3056
3062
  W((H) => H != null && H.scrollTop > 0),
@@ -3064,21 +3070,21 @@ const Ar = /* @__PURE__ */ Z(
3064
3070
  W(([, H]) => H != null)
3065
3071
  ),
3066
3072
  ([, H]) => {
3067
- H && (M(b, H.viewport), M(z, H.item), M(q, H.gap), H.scrollTop > 0 && (M(J, !0), bt(S(d, Ut(1)), (N) => {
3073
+ H && (M(b, H.viewport), M(L, H.item), M(q, H.gap), H.scrollTop > 0 && (M(J, !0), bt(S(d, Ut(1)), (N) => {
3068
3074
  M(J, !1);
3069
3075
  }), M(c, { top: H.scrollTop })));
3070
3076
  }
3071
- ), L(
3077
+ ), z(
3072
3078
  S(
3073
3079
  b,
3074
3080
  k(({ height: H }) => H)
3075
3081
  ),
3076
3082
  v
3077
- ), L(
3083
+ ), z(
3078
3084
  S(
3079
3085
  at(
3080
3086
  P(b, Se),
3081
- P(z, Se),
3087
+ P(L, Se),
3082
3088
  P(q, (H, N) => H !== void 0 && H.column === N.column && H.row === N.row),
3083
3089
  P(d)
3084
3090
  ),
@@ -3090,13 +3096,13 @@ const Ar = /* @__PURE__ */ Z(
3090
3096
  }))
3091
3097
  ),
3092
3098
  $
3093
- ), L(
3099
+ ), z(
3094
3100
  S(
3095
3101
  at(
3096
3102
  P(B),
3097
3103
  o,
3098
3104
  P(q, Gr),
3099
- P(z, Se),
3105
+ P(L, Se),
3100
3106
  P(b, Se),
3101
3107
  P(U),
3102
3108
  P(u),
@@ -3134,16 +3140,16 @@ const Ar = /* @__PURE__ */ Z(
3134
3140
  )
3135
3141
  ),
3136
3142
  p
3137
- ), L(
3143
+ ), z(
3138
3144
  S(
3139
3145
  U,
3140
3146
  W((H) => H !== null),
3141
3147
  k((H) => H.length)
3142
3148
  ),
3143
3149
  B
3144
- ), L(
3150
+ ), z(
3145
3151
  S(
3146
- at(b, z, p, q),
3152
+ at(b, L, p, q),
3147
3153
  W(([H, N, { items: Y }]) => Y.length > 0 && N.height !== 0 && H.height !== 0),
3148
3154
  k(([H, N, { items: Y }, it]) => {
3149
3155
  const { bottom: et, top: Q } = Fn(H, it, N, Y);
@@ -3154,7 +3160,7 @@ const Ar = /* @__PURE__ */ Z(
3154
3160
  e
3155
3161
  );
3156
3162
  const ht = w(!1);
3157
- L(
3163
+ z(
3158
3164
  S(
3159
3165
  d,
3160
3166
  D(ht),
@@ -3194,10 +3200,10 @@ const Ar = /* @__PURE__ */ Z(
3194
3200
  zt(0)
3195
3201
  )
3196
3202
  );
3197
- L(Et, h.scrollSeekRangeChanged), L(
3203
+ z(Et, h.scrollSeekRangeChanged), z(
3198
3204
  S(
3199
3205
  F,
3200
- D(b, z, B, q),
3206
+ D(b, L, B, q),
3201
3207
  k(([H, N, Y, it, et]) => {
3202
3208
  const Q = Zn(H), { align: ct, behavior: xt, offset: ut } = Q;
3203
3209
  let Vt = Q.index;
@@ -3215,7 +3221,7 @@ const Ar = /* @__PURE__ */ Z(
3215
3221
  ),
3216
3222
  0
3217
3223
  );
3218
- return L(
3224
+ return z(
3219
3225
  S(
3220
3226
  x,
3221
3227
  k((H) => ({ height: H.visibleHeight, width: H.visibleWidth }))
@@ -3231,7 +3237,7 @@ const Ar = /* @__PURE__ */ Z(
3231
3237
  headerHeight: s,
3232
3238
  increaseViewportBy: t,
3233
3239
  initialItemCount: u,
3234
- itemDimensions: z,
3240
+ itemDimensions: L,
3235
3241
  overscan: n,
3236
3242
  restoreStateFrom: j,
3237
3243
  scrollBy: i,
@@ -3288,7 +3294,7 @@ const Mr = /* @__PURE__ */ Z(() => {
3288
3294
  ),
3289
3295
  m
3290
3296
  ), d = w(!1), f = w(!1);
3291
- return L(P(f), d), {
3297
+ return z(P(f), d), {
3292
3298
  components: e,
3293
3299
  computeItemKey: s,
3294
3300
  context: n,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-virtuoso",
3
- "version": "4.18.16",
3
+ "version": "4.18.17",
4
4
  "description": "A virtual scroll React component for efficiently rendering large scrollable lists, grids, tables, and feeds",
5
5
  "keywords": [
6
6
  "chat",