react-virtuoso 4.18.20 → 4.18.22

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"),ho=require("react-dom"),we=0,Wt=1,Xt=2,Mn=4;function fn(t){return()=>t}function go(t){t()}function oe(t,e){return n=>t(e(n))}function mn(t,e){return()=>t(e)}function xo(t,e){return n=>t(e,n)}function Ae(t){return t!==void 0}function Io(...t){return()=>{t.map(go)}}function Jt(){}function ye(t,e){return e(t),t}function So(t,e){return e(t)}function st(...t){return t}function X(t,e){return t(Wt,e)}function _(t,e){t(we,e)}function je(t){t(Xt)}function tt(t){return t(Mn)}function z(t,e){return X(t,xo(e,we))}function Et(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 M(t){return e=>n=>{t(n)&&e(n)}}function L(t){return e=>oe(e,t)}function Ct(t){return e=>()=>{e(t)}}function v(t,...e){const n=vo(...e);return((o,r)=>{switch(o){case Xt:je(t);return;case Wt:return X(t,n(r))}})}function Ht(t,e){return n=>o=>{n(e=t(e,o))}}function $t(t){return e=>n=>{t>0?t--:e(n)}}function Mt(t){let e=null,n;return o=>r=>{e=r,!n&&(n=setTimeout(()=>{n=void 0,o(e)},t))}}function D(...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,u=>{const d=n;n|=l,e[i]=u,d!==r&&n===r&&o&&(o(),o=null)})}),s=>i=>{const l=()=>{s([i].concat(e))};n===r?l():o=l}}function vo(...t){return e=>t.reduceRight(So,e)}function To(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(),Jt);case Xt:o(),n=null;return}}}function y(t){let e=t;const n=$();return((o,r)=>{switch(o){case we:e=r;break;case Wt:{r(e);break}case Mn:return e}return n(o,r)})}function gt(t,e){return ye(y(e),n=>z(t,n))}function $(){const t=[];return((e,n)=>{switch(e){case we:t.slice().forEach(o=>{o(n)});return;case Xt:t.splice(0);return;case Wt:return t.push(n),()=>{const o=t.indexOf(n);o>-1&&t.splice(o,1)}}})}function yt(t){return ye($(),e=>z(t,e))}const Co={singleton:!0};function Y(t,e=[],n=Co){const{singleton:o}=n;return{constructor:t,dependencies:e,id:wo(),singleton:o}}const wo=()=>Symbol("id");function yo(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(u=>n(u)));return i&&e.set(s,l),l};return n(t)}function mt(...t){const e=$(),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,u=>{n[i]=u,o|=l,o===r&&_(e,n)})}),function(s,i){switch(s){case Xt:{je(e);return}case Wt:return o===r&&i(n),X(e,i)}}}function W(t,e=Pn){return v(t,ot(e))}function ve(...t){return function(e,n){switch(e){case Xt:return;case Wt:return Io(...t.map(o=>X(o,n)))}}}const pt={DEBUG:0,INFO:1,WARN:2,ERROR:3},bo={[pt.DEBUG]:"debug",[pt.ERROR]:"error",[pt.INFO]:"log",[pt.WARN]:"warn"},Ro=()=>typeof globalThis>"u"?window:globalThis,Gt=Y(()=>{const t=y(pt.ERROR);return{log:y((n,o,r=pt.INFO)=>{const s=Ro().VIRTUOSO_LOG_LEVEL??tt(t);r>=s&&console[bo[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,o)}),logLevel:t}},[],{singleton:!0});function Ho(t){return"self"in t?t.document.documentElement:t}function Wn(t){const e=Ho(t);return e.ownerDocument.defaultView.getComputedStyle(e).direction==="rtl"}function _t(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 u=i[0].target;u.offsetParent!==null&&t(u)};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,u){const d=R.useCallback(f=>{const I=Eo(f.children,e,l?"offsetWidth":"offsetHeight",r);let h=f.parentElement;for(;h.dataset.virtuosoScroller===void 0;)h=h.parentElement;const m=h.lastElementChild?.dataset.viewportType==="window";let T;m&&(T=h.ownerDocument.defaultView);const H=i?l?i.scrollWidth:i.scrollHeight:m?l?T.document.documentElement.scrollWidth:T.document.documentElement.scrollHeight:l?h.scrollWidth:h.scrollHeight,g=i?l?i.offsetWidth:i.offsetHeight:m?l?T.innerWidth:T.innerHeight:l?h.offsetWidth:h.offsetHeight,S=i?l?_t(i,i.scrollLeft):i.scrollTop:m?l?_t(T,T.scrollX||T.document.documentElement.scrollLeft):T.scrollY||T.document.documentElement.scrollTop:l?_t(h,h.scrollLeft):h.scrollTop;o({scrollHeight:H,scrollTop:Math.max(S,0),viewportHeight:g}),s?.(l?gn("column-gap",getComputedStyle(f).columnGap,r):gn("row-gap",getComputedStyle(f).rowGap,r)),I!==null&&t(I)},[t,e,r,s,i,o,l]);return _e(d,n,u)}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 u=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},pt.ERROR),f===d)continue;const I=s[s.length-1];s.length===0||I.size!==f||I.endIndex!==u-1?s.push({endIndex:u,size:f,startIndex:u}):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,pt.WARN),e==="normal"?0:parseInt(e??"0",10)}const be=typeof document>"u"?R.useEffect:R.useLayoutEffect;function Ne(t,e,n){const o=R.useRef(null),r=R.useCallback(u=>{if(!u?.offsetParent)return;const d=u.getBoundingClientRect(),f=d.width;let I,h;if(e){const m=e.getBoundingClientRect(),T=d.top-m.top;h=m.height-Math.max(0,T),I=T+e.scrollTop}else{const m=i.current.ownerDocument.defaultView;h=m.innerHeight-Math.max(0,d.top),I=d.top+m.scrollY}o.current={listHeight:d.height,offsetTop:I,visibleHeight:h,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 u=i.current?.ownerDocument.defaultView;return u?.addEventListener("scroll",l),u?.addEventListener("resize",l),()=>{u?.removeEventListener("scroll",l),u?.removeEventListener("resize",l)}},[l,e,i]),s}const It=Y(()=>{const t=$(),e=$(),n=y(0),o=$(),r=$(),s=y(0),i=$(),l=$(),u=y(0),d=y(0),f=y(0),I=y(0),h=$(),m=$(),T=y(!1),H=y(!1),g=y(!1);return z(v(t,L(({scrollTop:S})=>S)),e),z(v(t,L(({scrollHeight:S})=>S)),l),z(e,s),{deviation:n,deviationCommitted:o,fixedFooterHeight:f,fixedHeaderHeight:d,footerHeight:I,headerHeight:u,horizontalDirection:H,scrollBy:m,scrollContainerState:t,scrollHeight:l,scrollingInProgress:T,scrollTo:h,scrollTop:e,skipAnimationFrameInResizeObserver:g,smoothScrollTargetReached:r,statefulScrollTop:s,viewportHeight:i}},[],{singleton:!0}),re={lvl:0};function An(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:u}=e(t[i]);s.push({end:l-1,start:o,value:r}),o=l,r=u}return s.push({end:1/0,start:o,value:r}),s}function J(t){return t===re}function se(t,e){if(!J(t))return e===t.k?t.v:e<t.k?se(t.l,e):se(t.r,e)}function kt(t,e,n="k"){if(J(t))return[-1/0,void 0];if(Number(t[n])===e)return[t.k,t.v];if(Number(t[n])<e){const o=kt(t.r,e,n);return o[0]===-1/0?[t.k,t.v]:o}return kt(t.l,e,n)}function St(t,e,n){return J(t)?Nn(e,n,1):e===t.k?ht(t,{k:e,v:n}):e<t.k?xn(ht(t,{l:St(t.l,e,n)})):xn(ht(t,{r:St(t.r,e,n)}))}function Nt(){return re}function Yt(t,e,n){if(J(t))return[];const o=kt(t,e)[0];return ko(Ve(t,o,n))}function Fe(t,e){if(J(t))return re;const{k:n,l:o,r}=t;if(e===n){if(J(o))return r;if(J(r))return o;const[s,i]=_n(o);return Ie(ht(t,{k:s,l:jn(o),v:i}))}return e<n?Ie(ht(t,{l:Fe(o,e)})):Ie(ht(t,{r:Fe(r,e)}))}function Dt(t){return J(t)?[]:[...Dt(t.l),{k:t.k,v:t.v},...Dt(t.r)]}function Ve(t,e,n){if(J(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(ke(e))return Dn(ht(t,{lvl:n-1}));if(!J(e)&&!J(e.r))return ht(e.r,{l:ht(e,{r:e.r.l}),lvl:n,r:ht(t,{l:e.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}if(ke(t))return Me(ht(t,{lvl:n-1}));if(!J(o)&&!J(o.l)){const r=o.l,s=ke(r)?o.lvl-1:o.lvl;return ht(r,{l:ht(t,{lvl:n-1,r:r.l}),lvl:r.lvl+1,r:Me(ht(o,{l:r.r,lvl:s}))})}throw new Error("Unexpected empty nodes")}function ht(t,e){return Nn(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 jn(t){return J(t.r)?t.l:Ie(ht(t,{r:jn(t.r)}))}function ke(t){return J(t)||t.lvl>t.r.lvl}function _n(t){return J(t.r)?[t.k,t.v]:_n(t.r)}function Nn(t,e,n,o=re,r=re){return{k:t,l:o,lvl:n,r,v:e}}function xn(t){return Me(Dn(t))}function Dn(t){const{l:e}=t;return!J(e)&&e.lvl===t.lvl?ht(e,{r:ht(t,{l:e.r})}):t}function Me(t){const{lvl:e,r:n}=t;return!J(n)&&!J(n.r)&&n.lvl===e&&n.r.lvl===e?ht(n,{l:ht(t,{r:n.l}),lvl:e+1}):t}function ko(t){return An(t,({k:e,v:n})=>({index:e,value:n}))}function $n(t,e){return!!(t&&t.startIndex===e.startIndex&&t.endIndex===e.endIndex)}function Zt(t,e){return!!(t&&t[0]===e[0]&&t[1]===e[1])}const De=Y(()=>({recalcInProgress:y(!1)}),[],{singleton:!0});function Un(t,e,n){return t[Te(t,e,n)]}function Te(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 Lo(t,e,n,o){const r=Te(t,e,o),s=Te(t,n,o,r);return t.slice(r,s+1)}function Lt(t,e){return Math.round(t.getBoundingClientRect()[e])}function Re(t){return!J(t.groupOffsetTree)}function $e({index:t},e){return e===t?0:e<t?-1:1}function In(){return{groupIndices:[],groupOffsetTree:Nt(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Nt()}}function Bo(t,e){let n=J(t)?0:1/0;for(const o of e){const{endIndex:r,size:s,startIndex:i}=o;if(n=Math.min(n,i),J(t)){t=St(t,0,s);continue}const l=Yt(t,i-1,r+1);if(l.some(Wo(o)))continue;let u=!1,d=!1;for(const{end:f,start:I,value:h}of l)u?(r>=I||s===h)&&(t=Fe(t,I)):(d=h!==s,u=!0),f>r&&r>=I&&h!==s&&(t=St(t,r+1,h));d&&(t=St(t,i,s))}return[t,n]}function Oo(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}=Un(e,t,$e),i=t-o,l=s*i+(i-1)*n+r;return l>0?l+n:l}function Kn(t,e){if(!Re(e))return t;let n=0;for(;e.groupIndices[n]<=t+n;)n++;return t+n}function qn(t,e,n){if(Oo(t))return e.groupIndices[t.groupIndex]+1;const o=t.index==="LAST"?n:t.index;let r=Kn(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,Un(t,o,$e).offset)),An(Lo(t,e,n,zo),Po)}function Vo(t,[e,n,o,r]){e.length>0&&o("received item sizes",e,pt.DEBUG);const s=t.sizeTree;let i=s,l=0;if(n.length>0&&J(s)&&e.length===2){const h=e[0].size,m=e[1].size;i=n.reduce((T,H)=>St(St(T,H,h),H+1,m),i)}else[i,l]=Bo(i,e);if(i===s)return t;const{lastIndex:u,lastOffset:d,lastSize:f,offsetTree:I}=Pe(t.offsetTree,l,i,r);return{groupIndices:n,groupOffsetTree:n.reduce((h,m)=>St(h,m,ie(m,I,r)),Nt()),lastIndex:u,lastOffset:d,lastSize:f,offsetTree:I,sizeTree:i}}function Mo(t){return Dt(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 Sn(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 Pe(t,e,n,o){let r=t,s=0,i=0,l=0,u=0;if(e===0)r=[];else{u=Te(r,e-1,$e),l=r[u].offset;const f=kt(n,e-1);s=f[0],i=f[1],r.length&&r[u].size===kt(n,e)[1]&&(u-=1),r=r.slice(0,u+1)}for(const{start:d,value:f}of Yt(n,e,1/0)){const I=d-s,h=I*i+l+I*o;r.push({index:d,offset:h,size:f}),s=d,l=h,i=f}return{lastIndex:s,lastOffset:l,lastSize:i,offsetTree:r}}function Po(t){return{index:t.index,value:t}}function Wo(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 Go={offsetHeight:"height",offsetWidth:"width"},zt=Y(([{log:t},{recalcInProgress:e}])=>{const n=$(),o=$(),r=gt(o,0),s=$(),i=$(),l=y(0),u=y([]),d=y(void 0),f=y(void 0),I=y(void 0),h=y(void 0),m=y((c,p)=>Lt(c,Go[p])),T=y(void 0),H=y(0),g=In(),S=$(),a=gt(v(ve(n,S),D(u,t,H),Ht((c,[p,...b])=>{if(p===null){const[B]=b;return{...In(),groupIndices:B,groupOffsetTree:B.reduce((O,F,G)=>St(O,F,G),Nt())}}return Vo(c,[p,...b])},g),ot()),g),C=gt(v(u,ot(),Ht((c,p)=>({current:p,prev:c.current}),{current:[],prev:[]}),L(({prev:c})=>c)),[]);z(v(u,M(c=>c.length>0),D(a,H),L(([c,p,b])=>{const B=c.reduce((O,F,G)=>St(O,F,ie(F,p.offsetTree,b)||G),Nt());return{...p,groupIndices:c,groupOffsetTree:B}})),a),z(v(o,D(a),M(([c,{lastIndex:p}])=>c<p),L(([c,{lastIndex:p,lastSize:b}])=>[{endIndex:p,size:b,startIndex:c}])),n),z(d,f);const x=gt(v(d,L(c=>c===void 0)),!0);z(v(f,M(c=>c!==void 0&&J(tt(a).sizeTree)),L(c=>{const p=tt(I),b=tt(u).length>0;return p!==void 0&&p!==0?b?[{endIndex:0,size:p,startIndex:0},{endIndex:1,size:c,startIndex:1}]:[]:[{endIndex:0,size:c,startIndex:0}]})),n),z(v(h,M(c=>c!==void 0&&c.length>0&&J(tt(a).sizeTree)),L(c=>{const p=[];let b=c[0],B=0;for(let O=1;O<c.length;O++){const F=c[O];F!==b&&(p.push({endIndex:O-1,size:b,startIndex:B}),b=F,B=O)}return p.push({endIndex:c.length-1,size:b,startIndex:B}),p})),n),z(v(u,D(I,f),M(([,c,p])=>c!==void 0&&p!==void 0),L(([c,p,b])=>{const B=[];for(let O=0;O<c.length;O++){const F=c[O],G=c[O+1];B.push({startIndex:F,endIndex:F,size:p}),G!==void 0&&B.push({startIndex:F+1,endIndex:G-1,size:b})}return B})),n);const w=yt(v(n,D(a),Ht(({sizes:c},[p,b])=>({changed:b!==c,sizes:b}),{changed:!1,sizes:g}),L(c=>c.changed)));X(v(l,Ht((c,p)=>({diff:c.prev-p,prev:p}),{diff:0,prev:0}),L(c=>c.diff)),c=>{const{groupIndices:p}=tt(a);if(c>0)_(e,!0),_(s,c+Sn(c,p));else if(c<0){const b=tt(C);b.length>0&&(c-=Sn(-c,b)),_(i,c)}}),X(v(l,D(t)),([c,p])=>{c<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},pt.ERROR)});const k=yt(s);z(v(s,D(a),L(([c,p])=>{const b=p.groupIndices.length>0,B=[],O=p.lastSize;if(b){const F=se(p.sizeTree,0);let G=0,Z=0;for(;G<c;){const U=p.groupIndices[Z],lt=p.groupIndices.length===Z+1?1/0:p.groupIndices[Z+1]-U-1;B.push({endIndex:U,size:F,startIndex:U}),B.push({endIndex:U+1+lt-1,size:O,startIndex:U+1}),Z++,G+=lt+1}const P=Dt(p.sizeTree);return G!==c&&P.shift(),P.reduce((U,{k:lt,v:ct})=>{let xt=U.ranges;return U.prevSize!==0&&(xt=[...U.ranges,{endIndex:lt+c-1,size:U.prevSize,startIndex:U.prevIndex}]),{prevIndex:lt+c,prevSize:ct,ranges:xt}},{prevIndex:c,prevSize:0,ranges:B}).ranges}return Dt(p.sizeTree).reduce((F,{k:G,v:Z})=>({prevIndex:G+c,prevSize:Z,ranges:[...F.ranges,{endIndex:G+c-1,size:F.prevSize,startIndex:F.prevIndex}]}),{prevIndex:0,prevSize:O,ranges:[]}).ranges})),n);const A=yt(v(i,D(a,H),L(([c,{offsetTree:p},b])=>{const B=-c;return ie(B,p,b)})));return z(v(i,D(a,H),L(([c,p,b])=>{if(p.groupIndices.length>0){if(J(p.sizeTree))return p;let F=Nt();const G=tt(C);let Z=0,P=0,ft=0;for(;Z<-c;){ft=G[P];const lt=G[P+1]-ft-1;P++,Z+=lt+1}if(F=Dt(p.sizeTree).reduce((lt,{k:ct,v:xt})=>St(lt,Math.max(0,ct+c),xt),F),Z!==-c){const lt=se(p.sizeTree,ft);F=St(F,0,lt);const ct=kt(p.sizeTree,-c+1)[1];F=St(F,1,ct)}return{...p,sizeTree:F,...Pe(p.offsetTree,0,F,b)}}const O=Dt(p.sizeTree).reduce((F,{k:G,v:Z})=>St(F,Math.max(0,G+c),Z),Nt());return{...p,sizeTree:O,...Pe(p.offsetTree,0,O,b)}})),a),{beforeUnshiftWith:k,data:T,defaultItemSize:f,firstItemIndex:l,fixedItemSize:d,fixedGroupSize:I,gap:H,groupIndices:u,heightEstimates:h,itemSize:m,listRefresh:w,resetSizes:S,shiftWith:i,shiftWithOffset:A,sizeRanges:n,sizes:a,statefulTotalCount:r,totalCount:o,trackItemSizes:x,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 Yn=Y(([{groupIndices:t,resetSizes:e,sizeRanges:n,sizes:o,statefulTotalCount:r,totalCount:s,trackItemSizes:i},{headerHeight:l,scrollTop:u}])=>{const d=$(),f=$(),I=yt(v(d,L(Ao))),h=gt(v(n,D(r,t),M(([,m,T])=>m>T.length),Ct(!0)),!1);return z(v(I,Ht(([,m],T)=>[m,T],[{groupIndices:[],totalCount:0},{groupIndices:[],totalCount:0}]),D(o,i,h),M(([[m,T],{sizeTree:H},g,S])=>{const a=m.groupIndices.length>0&&m.totalCount===m.groupIndices.length,C=T.totalCount>T.groupIndices.length;return g&&!S&&a&&C&&!J(H)}),Ct(null)),e),z(v(I,L(m=>m.totalCount)),s),z(v(I,L(m=>m.groupIndices)),t),z(v(mt(u,o,l),M(([m,T])=>Re(T)),L(([m,T,H])=>kt(T.groupOffsetTree,Math.max(m-H,0),"v")[0]),ot(),L(m=>[m])),f),{groupCounts:d,topItemsIndexes:f}},st(zt,It)),At=Y(([{log:t}])=>{const e=y(!1),n=yt(v(e,M(o=>o),ot()));return X(e,o=>{o&&tt(t)("props updated",{},pt.DEBUG)}),{didMount:n,propsReady:e}},st(Gt),{singleton:!0}),jo=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Zn(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=Y(([{gap:t,listRefresh:e,sizes:n,totalCount:o},{fixedFooterHeight:r,fixedHeaderHeight:s,footerHeight:i,headerHeight:l,scrollingInProgress:u,scrollTo:d,smoothScrollTargetReached:f,viewportHeight:I},{log:h}])=>{const m=$(),T=$(),H=y(0);let g=null,S=null,a=null;function C(){g!==null&&(g(),g=null),a!==null&&(a(),a=null),S&&(clearTimeout(S),S=null),_(u,!1)}return z(v(m,D(n,I,o,H,l,i,h),D(t,s,r),L(([[x,w,k,A,c,p,b,B],O,F,G])=>{const Z=Zn(x),{align:P,behavior:ft,offset:U}=Z,lt=A-1,ct=qn(Z,w,lt);let xt=ie(ct,w.offsetTree,O)+p;P==="end"?(xt+=F+kt(w.sizeTree,ct)[1]-k+G,ct===lt&&(xt+=b)):P==="center"?xt+=(F+kt(w.sizeTree,ct)[1]-k+G)/2:xt-=c,U!==void 0&&U!==0&&(xt+=U);const Ft=vt=>{C(),vt?(B("retrying to scroll to",{location:x},pt.DEBUG),_(m,x)):(_(T,!0),B("list did not change, scroll successful",{},pt.DEBUG))};if(C(),ft==="smooth"){let vt=!1;a=X(e,Bt=>{vt=vt||Bt}),g=Et(f,()=>{Ft(vt)})}else g=Et(v(e,_o(150)),Ft);return S=setTimeout(()=>{C()},1200),_(u,!0),B("scrolling from index to",{behavior:ft,index:ct,top:xt},pt.DEBUG),{behavior:ft,top:xt}})),d),{scrollTargetReached:T,scrollToIndex:m,topListHeight:H}},st(zt,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 We(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=Y(([{defaultItemSize:t,listRefresh:e,sizes:n},{scrollTop:o},{scrollTargetReached:r,scrollToIndex:s},{didMount:i}])=>{const l=y(!0),u=y(0),d=y(!0);return z(v(i,D(u),M(([f,I])=>!We(I)),Ct(!1)),l),z(v(i,D(u),M(([f,I])=>!We(I)),Ct(!1)),d),X(v(mt(e,i),D(l,n,t,d),M(([[,f],I,{sizeTree:h},m,T])=>f&&(!J(h)||Ae(m))&&!I&&!T),D(u)),([,f])=>{if(f===void 0){_(l,!0),_(d,!0);return}Et(r,()=>{_(d,!0)}),Ue(4,()=>{Et(o,()=>{_(l,!0)}),_(s,f)})}),{initialItemFinalLocationReached:d,initialTopMostItemIndex:u,scrolledToInitialItem:l}},st(zt,It,ae,At),{singleton:!0});function Xn(t,e){return Math.abs(t-e)<1.01}const le="up",ee="down",No="none",Do={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},$o=0,fe=Y(([{footerHeight:t,headerHeight:e,scrollBy:n,scrollContainerState:o,scrollTop:r,viewportHeight:s}])=>{const i=y(!1),l=y(!0),u=$(),d=$(),f=y(4),I=y($o),h=gt(v(ve(v(W(r),$t(1),Ct(!0)),v(W(r),$t(1),Ct(!1),pn(100))),ot()),!1),m=gt(v(ve(v(n,Ct(!0)),v(n,Ct(!1),pn(200))),ot()),!1);z(v(mt(W(r),W(I)),L(([a,C])=>a<=C),ot()),l),z(v(l,Mt(50)),d);const T=yt(v(mt(o,W(s),W(e),W(t),W(f)),Ht((a,[{scrollHeight:C,scrollTop:x},w,k,A,c])=>{const p=x+w-C>-c,b={scrollHeight:C,scrollTop:x,viewportHeight:w};if(p){let O,F;return x>a.state.scrollTop?(O="SCROLLED_DOWN",F=a.state.scrollTop-x):(O="SIZE_DECREASED",F=a.state.scrollTop-x||a.scrollTopDelta),{atBottom:!0,atBottomBecause:O,scrollTopDelta:F,state:b}}let B;return b.scrollHeight>a.state.scrollHeight?B="SIZE_INCREASED":w<a.state.viewportHeight?B="VIEWPORT_HEIGHT_DECREASING":x<a.state.scrollTop?B="SCROLLING_UPWARDS":B="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:B,state:b}},Do),ot((a,C)=>a!==void 0&&a.atBottom===C.atBottom))),H=gt(v(o,Ht((a,{scrollHeight:C,scrollTop:x,viewportHeight:w})=>{if(!Xn(a.scrollHeight,C)){const k=C-(x+w)<1;return a.scrollTop!==x&&k?{changed:!0,jump:a.scrollTop-x,scrollHeight:C,scrollTop:x}:{changed:!0,jump:0,scrollHeight:C,scrollTop:x}}return{changed:!1,jump:0,scrollHeight:C,scrollTop:x}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),M(a=>a.changed),L(a=>a.jump)),0);z(v(T,L(a=>a.atBottom)),i),z(v(i,Mt(50)),u);const g=y(ee);z(v(o,L(({scrollTop:a})=>a),ot(),Ht((a,C)=>tt(m)?{direction:a.direction,prevScrollTop:C}:{direction:C<a.prevScrollTop?le:ee,prevScrollTop:C},{direction:ee,prevScrollTop:0}),L(a=>a.direction)),g),z(v(o,Mt(50),Ct(No)),g);const S=y(0);return z(v(h,M(a=>!a),Ct(0)),S),z(v(r,Mt(100),D(h),M(([a,C])=>C),Ht(([a,C],[x])=>[C,x],[0,0]),L(([a,C])=>C-a)),S),{atBottomState:T,atBottomStateChange:u,atBottomThreshold:f,atTopStateChange:d,atTopThreshold:I,isAtBottom:i,isAtTop:l,isScrolling:h,lastJumpDueToItemResize:H,scrollDirection:g,scrollVelocity:S}},st(It)),ce="top",ue="bottom",vn="none";function Tn(t,e,n){return typeof t=="number"?n===le&&e===ce||n===ee&&e===ue?t:0:n===le?e===ce?t.main:t.reverse:e===ue?t.main:t.reverse}function Cn(t,e){return typeof t=="number"?t:t[e]??0}const qe=Y(([{deviation:t,fixedHeaderHeight:e,headerHeight:n,scrollTop:o,viewportHeight:r}])=>{const s=$(),i=y(0),l=y(0),u=y(0),d=gt(v(mt(W(o),W(r),W(n),W(s,Zt),W(u),W(i),W(e),W(t),W(l)),L(([f,I,h,[m,T],H,g,S,a,C])=>{const x=f-a,w=g+S,k=Math.max(h-x,0);let A=vn;const c=Cn(C,ce),p=Cn(C,ue);return m-=a,m+=h+S,T+=h+S,T-=a,m>f+w-c&&(A=le),T<f-k+I+p&&(A=ee),A!==vn?[Math.max(x-h-Tn(H,ce,A)-c,0),x-k-S+I+Tn(H,ue,A)+p]:null}),M(f=>f!==null),ot(Zt)),[0,0]);return{increaseViewportBy:l,listBoundary:s,overscan:u,topListHeight:i,visibleRange:d}},st(It),{singleton:!0});function Uo(t,e,n,o){if(Re(e)){const r=o-e.groupIndices.length;if(r<=0)return[{index:e.groupIndices[0],offset:0,size:0}];const s=Kn(Math.min(t,r-1),e);return[{index:kt(e.groupOffsetTree,s)[0],offset:0,size:0},{data:n?.[0],index:s,offset:0,size:0}]}return[{data:n?.[0],index:t,offset:0,size:0}]}const Le={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:u}=r;let d=0,f=0;if(t.length>0){d=t[0].offset;const H=t[t.length-1];f=H.offset+H.size}const I=n-i,h=l+I*u+(I-1)*o,m=d,T=h-f;return{bottom:f,firstItemIndex:s,items:wn(t,r,s),offsetBottom:T,offsetTop:d,top:m,topItems:wn(e,r,s),topListHeight:e.reduce((H,g)=>g.size+H,0),totalCount:n}}function Jn(t,e,n,o,r,s){let i=0;if(n.groupIndices.length>0)for(const m of n.groupIndices){if(m-i>=t)break;i++}const l=t+i,u=s!==void 0,d=s?.length??0,f=Ke(e,u?d:l),I=u?Math.max(0,Math.min(l,d-f)):l,h=Array.from({length:I}).map((m,T)=>({data:s?.[T+f],index:T+f,offset:0,size:0}));return Se(h,[],I,r,n,o)}function wn(t,e,n){if(t.length===0)return[];if(!Re(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=Yt(e.groupOffsetTree,o,r);let l,u=0;for(const d of t){(!l||l.end<d.index)&&(l=i.shift(),u=e.groupIndices.indexOf(l.start));let f;d.index===l.start?f={index:u,type:"group"}:f={groupIndex:u,index:d.index-(u+1)+n},s.push({...f,data:d.data,offset:d.offset,originalIndex:d.index,size:d.size})}return s}function yn(t,e){return t===void 0?0:typeof t=="number"?t:t[e]??0}const Ut=Y(([{data:t,firstItemIndex:e,gap:n,sizes:o,totalCount:r},s,{listBoundary:i,topListHeight:l,visibleRange:u},{initialTopMostItemIndex:d,scrolledToInitialItem:f},{topListHeight:I},h,{didMount:m},{recalcInProgress:T}])=>{const H=y([]),g=y(0),S=gt(v(o,M(({sizeTree:c})=>!J(c)),Ct(!0)),!1),a=$(),C=y(0);z(s.topItemsIndexes,H);const x=gt(v(mt(m,T,W(u,Zt),W(r),W(o),W(d),f,W(H),W(e),W(n),W(C),t,W(g)),M(([c,p,,b,,,,,,,,B])=>{const O=B!==void 0&&B.length!==b;return c&&!p&&!O}),L(([,,[c,p],b,B,O,F,G,Z,P,ft,U,lt])=>{const ct=B,{offsetTree:xt,sizeTree:Ft}=ct;if(b===0)return{...Le,totalCount:b};if(c===0&&p===0)return lt===0?{...Le,totalCount:b}:Jn(lt,O,B,Z,P,U);if(J(Ft))return lt>0&&!tt(S)?null:Se(Uo(Ke(O,b),ct,U,b),[],b,P,ct,Z);const vt=[];if(G.length>0){const q=G[0],Q=G[G.length-1];let ut=0;for(const it of Yt(Ft,q,Q)){const et=it.value,dt=Math.max(it.start,q),Tt=Math.min(it.end,Q);for(let at=dt;at<=Tt;at++)vt.push({data:U?.[at],index:at,offset:ut,size:et}),ut+=et}}if(!F)return Se([],vt,b,P,ct,Z);const Bt=G.length>0?G[G.length-1]+1:0,me=Fo(xt,c,p,Bt);if(me.length===0)return null;const Kt=b-1,Vt=ye([],q=>{for(const Q of me){const ut=Q.value;let it=ut.offset,et=Q.start;const dt=ut.size;if(ut.offset<c){et+=Math.floor((c-ut.offset+P)/(dt+P));const at=et-Q.start;it+=at*dt+at*P}et<Bt&&(it+=(Bt-et)*dt,et=Bt);const Tt=Math.min(Q.end,Kt);for(let at=et;at<=Tt&&!(it>=p);at++)q.push({data:U?.[at],index:at,offset:it,size:dt}),it+=dt+P}}),E=yn(ft,ce),K=yn(ft,ue);if(Vt.length>0&&(E>0||K>0)){const q=Vt[0],Q=Vt[Vt.length-1];if(E>0&&q.index>Bt){const ut=Math.min(E,q.index-Bt),it=[];let et=q.offset;for(let dt=q.index-1;dt>=q.index-ut;dt--){const at=Yt(Ft,dt,dt)[0]?.value??q.size;et-=at+P,it.unshift({data:U?.[dt],index:dt,offset:et,size:at})}Vt.unshift(...it)}if(K>0&&Q.index<Kt){const ut=Math.min(K,Kt-Q.index);let it=Q.offset+Q.size+P;for(let et=Q.index+1;et<=Q.index+ut;et++){const Tt=Yt(Ft,et,et)[0]?.value??Q.size;Vt.push({data:U?.[et],index:et,offset:it,size:Tt}),it+=Tt+P}}}return Se(Vt,vt,b,P,ct,Z)}),M(c=>c!==null),ot()),Le);z(v(t,M(Ae),L(c=>c?.length)),r),z(v(x,L(c=>c.topListHeight)),I),z(I,l),z(v(x,L(c=>[c.top,c.bottom])),i),z(v(x,L(c=>c.items)),a);const w=yt(v(x,M(({items:c})=>c.length>0),D(r,t),M(([{items:c},p])=>c[c.length-1].originalIndex===p-1),L(([{items:c},p,b])=>{const B=c[c.length-1],O=B.type==="group"?B.index+1:(B.groupIndex??-1)+1;return[p-1-O,b]}),ot(Zt),M(([c])=>c>=0),L(([c])=>c))),k=yt(v(x,Mt(200),M(({items:c,topItems:p})=>c.length>0&&c[0].originalIndex===p.length),L(({items:c})=>c[0].index),ot())),A=yt(v(x,M(({items:c})=>c.length>0),L(({items:c})=>{let p=0,b=c.length-1;for(;c[p].type==="group"&&p<b;)p++;for(;c[b].type==="group"&&b>p;)b--;return{endIndex:c[b].index,startIndex:c[p].index}}),ot($n)));return{endReached:w,initialItemCount:g,itemsRendered:a,listState:x,minOverscanItemCount:C,rangeChanged:A,startReached:k,topItemsIndexes:H,...h}},st(zt,Yn,qe,de,ae,fe,At,De),{singleton:!0}),Qn=Y(([{fixedFooterHeight:t,fixedHeaderHeight:e,footerHeight:n,headerHeight:o},{listState:r}])=>{const s=$(),i=gt(v(mt(n,t,o,e,r),L(([l,u,d,f,I])=>l+u+d+f+I.offsetBottom+I.bottom)),0);return z(W(i),s),{totalListHeight:i,totalListHeightChanged:s}},st(It,Ut),{singleton:!0}),Ko=Y(([{viewportHeight:t},{totalListHeight:e}])=>{const n=y(!1),o=gt(v(mt(n,t,e),M(([r])=>r),L(([,r,s])=>Math.max(0,r-s)),Mt(0),ot()),0);return{alignToBottom:n,paddingTopAddition:o}},st(It,Qn),{singleton:!0}),to=Y(()=>({context:y(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,eo=Y(([{gap:t,sizes:e,totalCount:n},{fixedFooterHeight:o,fixedHeaderHeight:r,headerHeight:s,scrollingInProgress:i,scrollTop:l,viewportHeight:u},{scrollToIndex:d}])=>{const f=$();return z(v(f,D(e,u,n,s,r,o,l),D(t),L(([[I,h,m,T,H,g,S,a],C])=>{const{calculateViewLocation:x=qo,done:w,...k}=I,A=qn(I,h,T-1),c=ie(A,h.offsetTree,C)+H+g,p=c+kt(h.sizeTree,A)[1],b=a+g,B=a+m-S,O=x({itemBottom:p,itemTop:c,locationParams:k,viewportBottom:B,viewportTop:b});return O===null?w?.():w&&Et(v(i,M(F=>!F),$t(tt(i)?1:2)),w),O}),M(I=>I!==null)),d),{scrollIntoView:f}},st(zt,It,ae,Ut,Gt),{singleton:!0});function bn(t){return t===!1?!1:t==="smooth"?"smooth":"auto"}const Yo=(t,e)=>typeof t=="function"?bn(t(e)):e&&bn(t),Zo=Y(([{listRefresh:t,totalCount:e,fixedItemSize:n,data:o},{atBottomState:r,isAtBottom:s},{scrollToIndex:i},{scrolledToInitialItem:l},{didMount:u,propsReady:d},{log:f},{scrollingInProgress:I},{context:h},{scrollIntoView:m}])=>{const T=y(!1),H=$();let g=null;function S(w){_(i,{align:"end",behavior:w,index:"LAST"})}X(v(mt(v(W(e),$t(1)),u),D(W(T),s,l,I),L(([[w,k],A,c,p,b])=>{let B=k&&p,O="auto";return B&&(O=Yo(A,c||b),B=B&&O!==!1),{followOutputBehavior:O,shouldFollow:B,totalCount:w}}),M(({shouldFollow:w})=>w)),({followOutputBehavior:w,totalCount:k})=>{g!==null&&(g(),g=null),tt(n)===void 0?g=Et(t,()=>{tt(f)("following output to ",{totalCount:k},pt.DEBUG),S(w),g=null}):requestAnimationFrame(()=>{tt(f)("following output to ",{totalCount:k},pt.DEBUG),S(w)})});function a(w){const k=Et(r,A=>{w&&!A.atBottom&&A.notAtBottomBecause==="SIZE_INCREASED"&&g===null&&(tt(f)("scrolling to bottom due to increased size",{},pt.DEBUG),S("auto"))});setTimeout(k,100)}X(v(mt(W(T),e,d),M(([w,,k])=>w!==!1&&k),Ht(({value:w},[,k])=>({refreshed:w===k,value:k}),{refreshed:!1,value:0}),M(({refreshed:w})=>w),D(T,e)),([,w])=>{tt(l)&&a(w!==!1)}),X(H,()=>{a(tt(T)!==!1)}),X(mt(W(T),r),([w,k])=>{w!==!1&&!k.atBottom&&k.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&S("auto")});const C=y(null),x=$();return z(ve(v(W(o),L(w=>w?.length??0)),v(W(e))),x),X(v(mt(v(x,$t(1)),u),D(W(C),l,I,h),L(([[w,k],A,c,p,b])=>k&&c&&A?.({context:b,totalCount:w,scrollingInProgress:p})),M(w=>!!w),Mt(0)),w=>{g!==null&&(g(),g=null),tt(n)===void 0?g=Et(t,()=>{tt(f)("scrolling into view",{}),_(m,w),g=null}):requestAnimationFrame(()=>{tt(f)("scrolling into view",{}),_(m,w)})}),{autoscrollToBottom:H,followOutput:T,scrollIntoViewOnChange:C}},st(zt,fe,ae,de,At,Gt,It,to,eo)),Xo=Y(([{data:t,firstItemIndex:e,gap:n,sizes:o},{initialTopMostItemIndex:r},{initialItemCount:s,listState:i},{didMount:l}])=>(z(v(l,D(s),M(([,u])=>u!==0),D(r,o,e,n,t),L(([[,u],d,f,I,h,m])=>Jn(u,d,f,I,h,m))),i),{}),st(zt,de,Ut,At),{singleton:!0}),Jo=Y(([{didMount:t},{scrollTo:e},{listState:n}])=>{const o=y(0);return X(v(t,D(o),M(([,r])=>r!==0),L(([,r])=>({top:r}))),r=>{Et(v(n,$t(1),M(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{_(e,r)})})}),{initialScrollTop:o}},st(At,It,Ut),{singleton:!0}),no=Y(([{scrollVelocity:t}])=>{const e=y(!1),n=$(),o=y(!1);return z(v(t,D(o,e,n),M(([r,s])=>s!==!1&&s!==void 0),L(([r,s,i,l])=>{const{enter:u,exit:d}=s;if(i){if(d(r,l))return!1}else if(u(r,l))return!0;return i}),ot()),e),X(v(mt(e,t,n),D(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=Y(([{scrollContainerState:t,scrollTo:e}])=>{const n=$(),o=$(),r=$(),s=y(!1),i=y(void 0);return z(v(mt(n,o),L(([{scrollTop:l,viewportHeight:u},{offsetTop:d,listHeight:f}])=>({scrollHeight:f,scrollTop:Math.max(0,l-d),viewportHeight:u}))),t),z(v(e,D(o),L(([l,{offsetTop:u}])=>({...l,top:l.top+u}))),r),{customScrollParent:i,useWindowScroll:s,windowScrollContainerState:n,windowScrollTo:r,windowViewportRect:o}},st(It)),Qo=Y(([{sizeRanges:t,sizes:e},{headerHeight:n,scrollTop:o},{initialTopMostItemIndex:r},{didMount:s},{useWindowScroll:i,windowScrollContainerState:l,windowViewportRect:u}])=>{const d=$(),f=y(void 0),I=y(null),h=y(null);return z(l,I),z(u,h),X(v(d,D(e,o,i,I,h,n)),([m,T,H,g,S,a,C])=>{const x=Mo(T.sizeTree);g&&S!==null&&a!==null&&(H=S.scrollTop-a.offsetTop),H-=C,m({ranges:x,scrollTop:H})}),z(v(f,M(Ae),L(tr)),r),z(v(s,D(f),M(([,m])=>m!==void 0),ot(),L(([,m])=>m.ranges)),t),{getState:d,restoreStateFrom:f}},st(zt,It,de,At,Ye));function tr(t){return{align:"start",index:0,offset:t.scrollTop}}const er=Y(([{topItemsIndexes:t}])=>{const e=y(0);return z(v(e,M(n=>n>=0),L(n=>Array.from({length:n}).map((o,r)=>r))),t),{topItemCount:e}},st(Ut));function oo(t){let e=!1,n;return(()=>(e||(e=!0,n=t()),n))}const nr=oo(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),or=Y(([{deviation:t,deviationCommitted:e,scrollBy:n,scrollingInProgress:o,scrollTop:r},{isAtBottom:s,isScrolling:i,lastJumpDueToItemResize:l,scrollDirection:u},{listState:d},{beforeUnshiftWith:f,gap:I,shiftWithOffset:h,sizes:m},{log:T},{recalcInProgress:H}])=>{const g=yt(v(d,D(l),Ht(([,x,w,k],[{bottom:A,items:c,offsetBottom:p,totalCount:b},B])=>{const O=A+p;let F=0;return w===b&&x.length>0&&c.length>0&&(c[0].originalIndex===0&&x[0].originalIndex===0||(F=O-k,F!==0&&(F+=B))),[F,c,b,O]},[0,[],0,0]),M(([x])=>x!==0),D(r,u,o,s,T,H),M(([,x,w,k,,,A])=>!A&&!k&&x!==0&&w===le),L(([[x],,,,,w])=>(w("Upward scrolling compensation",{amount:x},pt.DEBUG),x))));function S(x){x>0?(_(n,{behavior:"auto",top:-x}),_(t,0)):(_(t,0),_(n,{behavior:"auto",top:-x}))}X(v(g,D(t,i)),([x,w,k])=>{k&&nr()?_(t,w-x):S(-x)}),X(v(mt(gt(i,!1),t,H),M(([x,w,k])=>!x&&!k&&w!==0),L(([x,w])=>w),Mt(1)),S),z(v(h,L(x=>({top:-x}))),n);let a=null;function C(){if(a===null)return;const{offset:x}=a;a=null,_(n,{top:x}),requestAnimationFrame(()=>{_(t,0),_(H,!1)})}return X(e,x=>{a===null||!a.acknowledgeable||x===a.offset&&C()}),X(v(f,D(m,I),L(([x,{groupIndices:w,lastSize:k,sizeTree:A},c])=>{function p(G){return G*(k+c)}if(w.length===0)return p(x);let b=0;const B=se(A,0);let O=0,F=0;for(;O<x;){O++,b+=B;let G=w.length===F+1?1/0:w[F+1]-w[F]-1;O+G>x&&(b-=B,G=x-O+1),O+=G,b+=p(G),F++}return b})),x=>{a={acknowledgeable:tt(t)!==x,offset:x},_(t,x),requestAnimationFrame(C)}),{deviation:t}},st(It,fe,Ut,zt,Gt,De)),rr=Y(([t,e,n,o,r,s,i,l,u,d,f])=>({...t,...e,...n,...o,...r,...s,...i,...l,...u,...d,...f}),st(qe,Xo,At,no,Qn,Jo,Ko,Ye,eo,Gt,to)),ro=Y(([{data:t,defaultItemSize:e,firstItemIndex:n,fixedItemSize:o,fixedGroupSize:r,gap:s,groupIndices:i,heightEstimates:l,itemSize:u,sizeRanges:d,sizes:f,statefulTotalCount:I,totalCount:h,trackItemSizes:m},{initialItemFinalLocationReached:T,initialTopMostItemIndex:H,scrolledToInitialItem:g},S,a,C,x,{scrollToIndex:w},k,{topItemCount:A},{groupCounts:c},p])=>{const{listState:b,minOverscanItemCount:B,topItemsIndexes:O,rangeChanged:F,...G}=x;return z(F,p.scrollSeekRangeChanged),z(v(mt(p.windowViewportRect,S.headerHeight,S.fixedHeaderHeight),L(([Z,P,ft])=>Math.max(P+ft+1,Z.visibleHeight))),S.viewportHeight),{data:t,defaultItemHeight:e,firstItemIndex:n,fixedItemHeight:o,fixedGroupHeight:r,gap:s,groupCounts:c,heightEstimates:l,initialItemFinalLocationReached:T,initialTopMostItemIndex:H,scrolledToInitialItem:g,sizeRanges:d,topItemCount:A,topItemsIndexes:O,totalCount:h,...C,groupIndices:i,itemSize:u,listState:b,minOverscanItemCount:B,scrollToIndex:w,statefulTotalCount:I,trackItemSizes:m,rangeChanged:F,...G,...p,...S,sizes:f,...a}},st(zt,de,It,Qo,Zo,Ut,ae,or,er,Yn,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 u(S,a){S.propsReady!==void 0&&_(S.propsReady,!1);for(const C of o){const x=S[e.required[C]];_(x,a[C])}for(const C of r)if(C in a){const x=S[e.optional[C]];_(x,a[C])}S.propsReady!==void 0&&_(S.propsReady,!0)}function d(S){return s.reduce((a,C)=>(a[C]=x=>{const w=S[e.methods[C]];_(w,x)},a),{})}function f(S){return i.reduce((a,C)=>(a[C]=To(S[e.events[C]]),a),{})}const I=R.forwardRef(function(a,C){const{children:x,...w}=a,[k]=R.useState(()=>ye(yo(t),p=>{u(p,w)})),[A]=R.useState(mn(f,k));ge(()=>{for(const p of i)p in w&&X(A[p],w[p]);return()=>{Object.values(A).map(je)}},[w,A,k]),ge(()=>{u(k,w)}),R.useImperativeHandle(C,fn(d(k)));const c=n;return V.jsx(l.Provider,{value:k,children:n===void 0?x:V.jsx(c,{...sr([...o,...r,...i],w),children:x})})}),h=S=>{const a=R.useContext(l);return R.useCallback(C=>{_(a[S],C)},[a,S])},m=S=>{const C=R.useContext(l)[S],x=R.useCallback(w=>X(C,w),[C]);return R.useSyncExternalStore(x,()=>tt(C),()=>tt(C))},T=S=>{const C=R.useContext(l)[S],[x,w]=R.useState(mn(tt,C));return ge(()=>X(C,k=>{k!==x&&w(fn(k))}),[C,x]),x},H=parseInt(R.version,10)>=18?m:T;return{Component:I,useEmitter:(S,a)=>{const x=R.useContext(l)[S];ge(()=>X(x,a),[a,x])},useEmitterValue:H,usePublisher:h}}const Qt=R.createContext(void 0),Xe=R.createContext(void 0),Be="-webkit-sticky",Rn="sticky",Je=oo(()=>{if(typeof document>"u")return Rn;const t=document.createElement("div");return t.style.position=Be,t.style.position===Be?Be:Rn});function Oe(t){return"self"in t}function ir(t){return"body"in t}function so(t,e,n,o=Jt,r,s){const i=R.useRef(null),l=R.useRef(null),u=R.useRef(null),d=R.useCallback(h=>{let m,T,H;const g=h.target;if(ir(g)||Oe(g)){const a=Oe(g)?g:g.defaultView;H=s===!0?_t(a,a.scrollX):a.scrollY,m=s===!0?a.document.documentElement.scrollWidth:a.document.documentElement.scrollHeight,T=s===!0?a.innerWidth:a.innerHeight}else H=s===!0?_t(g,g.scrollLeft):g.scrollTop,m=s===!0?g.scrollWidth:g.scrollHeight,T=s===!0?g.offsetWidth:g.offsetHeight;const S=()=>{t({scrollHeight:m,scrollTop:Math.max(H,0),viewportHeight:T})};h.suppressFlushSync===!0?S():ho.flushSync(S),l.current!==null&&(H===l.current||H<=0||H===m-T)&&(l.current=null,e(!0),u.current&&(clearTimeout(u.current),u.current=null))},[t,e,s]);R.useEffect(()=>{const h=r??i.current;return o(r??i.current),d({suppressFlushSync:!0,target:h}),h.addEventListener("scroll",d,{passive:!0}),()=>{o(null),h.removeEventListener("scroll",d)}},[i,d,n,o,r]);function f(h){const m=i.current;if(!m||(s===!0?"offsetWidth"in m&&m.offsetWidth===0:"offsetHeight"in m&&m.offsetHeight===0))return;const T=h.behavior==="smooth";let H,g,S;Oe(m)?(g=Math.max(Lt(m.document.documentElement,s===!0?"width":"height"),s===!0?m.document.documentElement.scrollWidth:m.document.documentElement.scrollHeight),H=s===!0?m.innerWidth:m.innerHeight,S=s===!0?_t(m,m.scrollX):m.scrollY):(g=m[s===!0?"scrollWidth":"scrollHeight"],H=Lt(m,s===!0?"width":"height"),S=s===!0?_t(m,m.scrollLeft):m.scrollTop);const a=g-H;if(h.top===void 0){m.scrollTo(h);return}const C=Math.ceil(Math.max(Math.min(a,h.top),0));if(h.top=C,Xn(H,g)||C===S){t({scrollHeight:g,scrollTop:S,viewportHeight:H}),T&&e(!0);return}T?(l.current=C,u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{u.current=null,l.current=null,e(!0)},1e3)):l.current=null,s===!0&&(h={...h.behavior===void 0?{}:{behavior:h.behavior},left:hn(m,C)}),m.scrollTo(h)}return{scrollByCallback:R.useCallback(h=>{s===!0&&(h={...h.behavior===void 0?{}:{behavior:h.behavior},...h.top===void 0?{}:{left:hn(i.current,h.top)}}),i.current.scrollBy(h)},[s]),scrollerRef:i,scrollToCallback:f}}function Qe(t){return t}const lr=Y(()=>{const t=y(l=>`Item ${l}`),e=y(l=>`Group ${l}`),n=y({}),o=y(Qe),r=y("div"),s=y(Jt),i=(l,u=null)=>gt(v(n,L(d=>d[l]),ot()),u);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=Y(([t,e])=>({...t,...e}),st(ro,lr)),ur=({height:t})=>V.jsx("div",{style:{height:t}}),ar={overflowAnchor:"none",position:Je(),zIndex:1},io={overflowAnchor:"none"},dr={...io,display:"inline-block",height:"100%"},Hn=R.memo(function({showTopList:e=!1}){const n=j("listState"),o=wt("sizeRanges"),r=j("useWindowScroll"),s=j("customScrollParent"),i=wt("windowScrollContainerState"),l=wt("scrollContainerState"),u=s||r?i:l,d=j("itemContent"),f=j("context"),I=j("groupContent"),h=j("trackItemSizes"),m=j("itemSize"),T=j("log"),H=wt("gap"),g=j("horizontalDirection"),{callbackRef:S}=Gn(o,m,h,e?Jt:u,T,H,s,g,j("skipAnimationFrameInResizeObserver")),[a,C]=R.useState(0);on("deviation",P=>{a!==P&&C(P)});const x=wt("deviationCommitted");be(()=>{x(a)},[a,x]);const w=j("EmptyPlaceholder"),k=j("ScrollSeekPlaceholder")??ur,A=j("ListComponent"),c=j("ItemComponent"),p=j("GroupComponent"),b=j("computeItemKey"),B=j("isSeeking"),O=j("groupIndices").length>0,F=j("alignToBottom"),G=j("initialItemFinalLocationReached"),Z=e?{}:{boxSizing:"border-box",...g?{display:"inline-block",height:"100%",marginInlineStart:a===0?F?"auto":0:a,paddingInlineEnd:n.offsetBottom,paddingInlineStart:n.offsetTop,whiteSpace:"nowrap"}:{marginTop:a===0?F?"auto":0:a,paddingBottom:n.offsetBottom,paddingTop:n.offsetTop},...G?{}:{visibility:"hidden"}};return!e&&n.totalCount===0&&w!==null&&w!==void 0?V.jsx(w,{...rt(w,f)}):V.jsx(A,{...rt(A,f),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:S,style:Z,children:(e?n.topItems:n.items).map(P=>{const ft=P.originalIndex,U=b(ft+n.firstItemIndex,P.data,f);return B?R.createElement(k,{...rt(k,f),height:P.size,index:P.index,key:U,type:P.type||"item",...P.type==="group"?{}:{groupIndex:P.groupIndex}}):P.type==="group"?R.createElement(p,{...rt(p,f),"data-index":ft,"data-item-index":P.index,"data-known-size":P.size,key:U,style:ar},I(P.index,f)):R.createElement(c,{...rt(c,f),...lo(c,P.data),"data-index":ft,"data-item-group-index":P.groupIndex,"data-item-index":P.index,"data-known-size":P.size,key:U,style:g?dr:io},O?d(P.index,P.groupIndex,P.data,f):d(P.index,P.data,f))})})}),fr={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},mr={outline:"none",overflowX:"auto",position:"relative"},He=t=>({height:"100%",position:"absolute",top:0,width:"100%",...t?{display:"flex",flexDirection:"column"}:void 0}),tn=(t,e,n=0)=>({...He(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 lo(t,e){return{item:typeof t=="string"?void 0:e}}const hr=R.memo(function(){const e=j("HeaderComponent"),n=wt("headerHeight"),o=j("HeaderFooterTag"),r=Ot(R.useMemo(()=>i=>{n(Lt(i,"height"))},[n]),!0,j("skipAnimationFrameInResizeObserver")),s=j("context");return e!=null?V.jsx(o,{ref:r,children:V.jsx(e,{...rt(e,s)})}):null}),gr=R.memo(function(){const e=j("FooterComponent"),n=wt("footerHeight"),o=j("HeaderFooterTag"),r=Ot(R.useMemo(()=>i=>{n(Lt(i,"height"))},[n]),!0,j("skipAnimationFrameInResizeObserver")),s=j("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,...u}){const d=n("scrollContainerState"),f=e("ScrollerComponent"),I=n("smoothScrollTargetReached"),h=e("scrollerRef"),m=e("horizontalDirection")||!1,{scrollByCallback:T,scrollerRef:H,scrollToCallback:g}=so(d,I,f,h,void 0,m),S=R.useContext(Qt),a=R.useRef(0),C=R.useCallback(k=>{a.current=k},[]);t("totalListHeight",C);const x=R.useCallback(k=>{if(!S||k.top===void 0)return;const A=Math.max(a.current,S.viewportHeight),c=Math.ceil(Math.max(Math.min(A-S.viewportHeight,k.top),0));d({scrollHeight:A,scrollTop:c,viewportHeight:S.viewportHeight}),k.behavior==="smooth"&&I(!0)},[S,d,I]);t("scrollTo",S?x:g),t("scrollBy",T);const w=m?mr:fr;return V.jsx(f,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:H,style:{...w,...i},tabIndex:0,...u,...rt(f,l),children:s})})}function nn({useEmitter:t,useEmitterValue:e,usePublisher:n}){return R.memo(function({children:s,style:i,context:l,...u}){const d=n("windowScrollContainerState"),f=e("ScrollerComponent"),I=n("smoothScrollTargetReached"),h=e("totalListHeight"),m=e("deviation"),T=e("customScrollParent"),H=R.useRef(null),g=e("scrollerRef"),{scrollByCallback:S,scrollerRef:a,scrollToCallback:C}=so(d,I,f,g,T);return be(()=>(a.current=T??H.current?.ownerDocument.defaultView,()=>{a.current=null}),[a,T]),t("windowScrollTo",C),t("scrollBy",S),V.jsx(f,{ref:H,"data-virtuoso-scroller":!0,style:{position:"relative",...i,...h===0?void 0:{height:h+m}},...u,...rt(f,l),children:s})})}const xr=({children:t})=>{const e=R.useContext(Qt),n=wt("viewportHeight"),o=wt("fixedItemHeight"),r=j("alignToBottom"),s=j("horizontalDirection"),i=R.useMemo(()=>oe(n,u=>Lt(u,s?"width":"height")),[n,s]),l=Ot(i,!0,j("skipAnimationFrameInResizeObserver"));return R.useEffect(()=>{e&&(n(e.viewportHeight),o(e.itemHeight))},[e,n,o]),V.jsx("div",{"data-viewport-type":"element",ref:l,style:He(r),children:t})},Ir=({children:t})=>{const e=R.useContext(Qt),n=wt("windowViewportRect"),o=wt("fixedItemHeight"),r=j("customScrollParent"),s=j("useWindowScroll"),i=j("topListHeight"),l=Ne(n,r,j("skipAnimationFrameInResizeObserver")),u=j("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(u,s,i),children:t})},Sr=({children:t})=>{const e=j("TopItemListComponent")??"div",n=j("headerHeight"),o={...pr,marginTop:`${n}px`},r=j("context");return V.jsx(e,{style:o,...rt(e,r),children:t})},vr=R.memo(function(e){const n=j("useWindowScroll"),o=j("topItemsIndexes").length>0,r=j("customScrollParent"),s=j("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(Hn,{showTopList:!0})}),V.jsxs(l,{children:[V.jsx(hr,{}),V.jsx(Hn,{}),V.jsx(gr,{})]})]})}),{Component:co,useEmitter:on,useEmitterValue:j,usePublisher:wt}=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:j,usePublisher:wt}),Cr=nn({useEmitter:on,useEmitterValue:j,usePublisher:wt}),wr=co,yr=co,br=Y(()=>{const t=y(d=>V.jsxs("td",{children:["Item $",d]})),e=y(null),n=y(d=>V.jsxs("td",{colSpan:1e3,children:["Group ",d]})),o=y(null),r=y(null),s=y({}),i=y(Qe),l=y(Jt),u=(d,f=null)=>gt(v(s,L(I=>I[d]),ot()),f);return{components:s,computeItemKey:i,context:e,EmptyPlaceholder:u("EmptyPlaceholder"),FillerRow:u("FillerRow"),fixedFooterContent:r,fixedHeaderContent:o,itemContent:t,groupContent:n,ScrollerComponent:u("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:u("ScrollSeekPlaceholder"),TableBodyComponent:u("TableBody","tbody"),TableComponent:u("Table","table"),TableFooterComponent:u("TableFoot","tfoot"),TableHeadComponent:u("TableHead","thead"),TableRowComponent:u("TableRow","tr"),GroupComponent:u("Group","tr")}}),Rr=Y(([t,e])=>({...t,...e}),st(ro,br)),Hr=({height:t})=>V.jsx("tr",{children:V.jsx("td",{style:{height:t}})}),Er=({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"},kn=R.memo(function({showTopList:e=!1}){const n=N("listState"),o=N("computeItemKey"),r=N("firstItemIndex"),s=N("context"),i=N("isSeeking"),l=N("fixedHeaderHeight"),u=N("groupIndices").length>0,d=N("itemContent"),f=N("groupContent"),I=N("ScrollSeekPlaceholder")??Hr,h=N("GroupComponent"),m=N("TableRowComponent"),T=(e?n.topItems:[]).reduce((g,S,a)=>(a===0?g.push(S.size):g.push(g[a-1]+S.size),g),[]);return(e?n.topItems:n.items).map(g=>{const S=g.originalIndex,a=o(S+r,g.data,s),C=e?S===0?0:T[S-1]:0;return i?R.createElement(I,{...rt(I,s),height:g.size,index:g.index,key:a,type:g.type||"item"}):g.type==="group"?R.createElement(h,{...rt(h,s),"data-index":S,"data-item-index":g.index,"data-known-size":g.size,key:a,style:{...En,top:l}},f(g.index,s)):R.createElement(m,{...rt(m,s),...lo(m,g.data),"data-index":S,"data-item-index":g.index,"data-known-size":g.size,"data-item-group-index":g.groupIndex,key:a,style:e?{...En,top:l+C}:kr},u?d(g.index,g.groupIndex,g.data,s):d(g.index,g.data,s))})}),Lr=R.memo(function(){const e=N("listState"),n=N("topItemsIndexes").length>0,o=bt("sizeRanges"),r=N("useWindowScroll"),s=N("customScrollParent"),i=bt("windowScrollContainerState"),l=bt("scrollContainerState"),u=s||r?i:l,d=N("trackItemSizes"),f=N("itemSize"),I=N("log"),{callbackRef:h,ref:m}=Gn(o,f,d,u,I,void 0,s,!1,N("skipAnimationFrameInResizeObserver")),[T,H]=R.useState(0);rn("deviation",O=>{T!==O&&(m.current.style.marginTop=`${O}px`,H(O))});const g=bt("deviationCommitted");be(()=>{g(T)},[T,g]);const S=N("EmptyPlaceholder"),a=N("FillerRow")??Er,C=N("TableBodyComponent"),x=N("paddingTopAddition"),w=N("statefulTotalCount"),k=N("context");if(w===0&&S!==null&&S!==void 0)return V.jsx(S,{...rt(S,k)});const A=(n?e.topItems:[]).reduce((O,F)=>O+F.size,0),c=e.offsetTop+x+T-A,p=e.offsetBottom,b=c>0?V.jsx(a,{context:k,height:c},"padding-top"):null,B=p>0?V.jsx(a,{context:k,height:p},"padding-bottom"):null;return V.jsxs(C,{"data-testid":"virtuoso-item-list",ref:h,...rt(C,k),children:[b,n&&V.jsx(kn,{showTopList:!0}),V.jsx(kn,{}),B]})}),Br=({children:t})=>{const e=R.useContext(Qt),n=bt("viewportHeight"),o=bt("fixedItemHeight"),r=Ot(R.useMemo(()=>oe(n,s=>Lt(s,"height")),[n]),!0,N("skipAnimationFrameInResizeObserver"));return R.useEffect(()=>{e&&(n(e.viewportHeight),o(e.itemHeight))},[e,n,o]),V.jsx("div",{"data-viewport-type":"element",ref:r,style:He(!1),children:t})},Or=({children:t})=>{const e=R.useContext(Qt),n=bt("windowViewportRect"),o=bt("fixedItemHeight"),r=N("customScrollParent"),s=N("useWindowScroll"),i=Ne(n,r,N("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=N("useWindowScroll"),o=N("customScrollParent"),r=bt("fixedHeaderHeight"),s=bt("fixedFooterHeight"),i=N("fixedHeaderContent"),l=N("fixedFooterContent"),u=N("context"),d=Ot(R.useMemo(()=>oe(r,a=>Lt(a,"height")),[r]),!0,N("skipAnimationFrameInResizeObserver")),f=Ot(R.useMemo(()=>oe(s,a=>Lt(a,"height")),[s]),!0,N("skipAnimationFrameInResizeObserver")),I=o||n?Vr:Fr,h=o||n?Or:Br,m=N("TableComponent"),T=N("TableHeadComponent"),H=N("TableFooterComponent"),g=i?V.jsx(T,{ref:d,style:{position:"sticky",top:0,zIndex:2},...rt(T,u),children:i()},"TableHead"):null,S=l?V.jsx(H,{ref:f,style:{bottom:0,position:"sticky",zIndex:1},...rt(H,u),children:l()},"TableFoot"):null;return V.jsx(I,{...e,...rt(I,u),children:V.jsx(h,{children:V.jsxs(m,{style:{borderSpacing:0,overflowAnchor:"none"},...rt(m,u),children:[g,V.jsx(Lr,{},"TableBody"),S]})})})}),{Component:uo,useEmitter:rn,useEmitterValue:N,usePublisher:bt}=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:N,usePublisher:bt}),Vr=nn({useEmitter:rn,useEmitterValue:N,usePublisher:bt}),Mr=uo,Pr=uo,Ln={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},Wr={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Bn,floor:Ce,max:ne,min:ze,round:On}=Math;function zn(t,e,n){return Array.from({length:e-t+1}).map((o,r)=>({data:n===null?null:n[r+t],index:r+t}))}function Gr(t){return{...Wr,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=Y(([{increaseViewportBy:t,listBoundary:e,overscan:n,visibleRange:o},{footerHeight:r,headerHeight:s,scrollBy:i,scrollContainerState:l,scrollTo:u,scrollTop:d,smoothScrollTargetReached:f,viewportHeight:I},h,m,{didMount:T,propsReady:H},{customScrollParent:g,useWindowScroll:S,windowScrollContainerState:a,windowScrollTo:C,windowViewportRect:x},w])=>{const k=y(0),A=y(0),c=y(Ln),p=y({height:0,width:0}),b=y({height:0,width:0}),B=$(),O=$(),F=y(0),G=y(null),Z=y({column:0,row:0}),P=$(),ft=$(),U=y(!1),lt=y(0),ct=y(!0),xt=y(!1),Ft=y(!1);X(v(T,D(lt),M(([E,K])=>!We(K))),()=>{_(ct,!1)}),X(v(mt(T,ct,b,p,lt,xt),M(([E,K,q,Q,,ut])=>E&&!K&&q.height!==0&&Q.height!==0&&!ut)),([,,,,E])=>{if(E===void 0){_(ct,!0);return}_(xt,!0),Ue(1,()=>{_(B,E)}),Et(v(d),()=>{_(e,[0,0]),_(ct,!0)})}),z(v(ft,M(E=>E!=null&&E.scrollTop>0),Ct(0)),A),X(v(T,D(ft),M(([,E])=>E!=null)),([,E])=>{E&&(_(p,E.viewport),_(b,E.item),_(Z,E.gap),E.scrollTop>0&&(_(U,!0),Et(v(d,$t(1)),K=>{_(U,!1)}),_(u,{top:E.scrollTop})))}),z(v(p,L(({height:E})=>E)),I),z(v(mt(W(p,xe),W(b,xe),W(Z,(E,K)=>E!==void 0&&E.column===K.column&&E.row===K.row),W(d)),L(([E,K,q,Q])=>({gap:q,item:K,scrollTop:Q,viewport:E}))),P),z(v(mt(W(k),o,W(Z,Ar),W(b,xe),W(p,xe),W(G),W(A),W(U),W(ct),W(lt)),M(([,,,,,,,E])=>!E),L(([E,[K,q],Q,ut,it,et,dt,,Tt,at])=>{const{column:Pt,row:te}=Q,{height:pe,width:Ee}=ut,{width:sn}=it;if(dt===0&&(E===0||sn===0))return Ln;if(Ee===0){const dn=Ke(at,E),po=dn+Math.max(dt-1,0);return Gr(zn(dn,po,et))}const he=ao(sn,Ee,Pt);let qt,jt;Tt?K===0&&q===0&&dt>0?(qt=0,jt=dt-1):(qt=he*Ce((K+te)/(pe+te)),jt=he*Bn((q+te)/(pe+te))-1,jt=ze(E-1,ne(jt,he-1)),qt=ze(jt,ne(0,qt))):(qt=0,jt=-1);const ln=zn(qt,jt,et),{bottom:cn,top:un}=Fn(it,Q,ut,ln),an=Bn(E/he),mo=an*pe+(an-1)*te-cn;return{bottom:cn,itemHeight:pe,items:ln,itemWidth:Ee,offsetBottom:mo,offsetTop:un,top:un}})),c),z(v(G,M(E=>E!==null),L(E=>E.length)),k),z(v(mt(p,b,c,Z),M(([E,K,{items:q}])=>q.length>0&&K.height!==0&&E.height!==0),L(([E,K,{items:q},Q])=>{const{bottom:ut,top:it}=Fn(E,Q,K,q);return[it,ut]}),ot(Zt)),e);const vt=y(!1);z(v(d,D(vt),L(([E,K])=>K||E!==0)),vt);const Bt=yt(v(mt(c,k),M(([{items:E},K])=>{const q=tt(G);return E.length>0&&(q===null||q.length===K)}),D(vt),M(([[E,K],q])=>{const ut=E.items[E.items.length-1].index===K-1;return(q||E.bottom>0&&E.itemHeight>0&&E.offsetBottom===0&&E.items.length===K)&&ut}),L(([[,E]])=>[E-1,tt(G)]),ot(Zt),L(([E])=>E))),me=yt(v(W(c),M(({items:E})=>E.length>0&&E[0].index===0),Ct(0),ot())),Kt=yt(v(W(c),D(U),M(([{items:E},K])=>E.length>0&&!K),L(([{items:E}])=>({endIndex:E[E.length-1].index,startIndex:E[0].index})),ot($n),Mt(0)));z(Kt,m.scrollSeekRangeChanged),z(v(B,D(p,b,k,Z),L(([E,K,q,Q,ut])=>{const it=Zn(E),{align:et,behavior:dt,offset:Tt}=it;let at=it.index;at==="LAST"&&(at=Q-1),at=ne(0,ze(Q-1,at));let Pt=Ge(K,ut,q,at);return et==="end"?Pt=On(Pt-K.height+q.height):et==="center"&&(Pt=On(Pt-K.height/2+q.height/2)),Tt!==void 0&&Tt!==0&&(Pt+=Tt),{behavior:dt,top:Pt}})),u);const Vt=gt(v(c,L(E=>E.offsetBottom+E.bottom)),0);return z(v(x,L(E=>({height:E.visibleHeight,width:E.visibleWidth}))),p),{customScrollParent:g,data:G,deviation:F,footerHeight:r,gap:Z,headerHeight:s,increaseViewportBy:t,initialItemCount:A,itemDimensions:b,overscan:n,restoreStateFrom:ft,scrollBy:i,scrollContainerState:l,scrollHeight:O,scrollTo:u,scrollToIndex:B,scrollTop:d,smoothScrollTargetReached:f,totalCount:k,useWindowScroll:S,viewportDimensions:p,windowScrollContainerState:a,windowScrollTo:C,windowViewportRect:x,...m,gridState:c,horizontalDirection:Ft,initialTopMostItemIndex:lt,totalListHeight:Vt,...h,endReached:Bt,propsReady:H,rangeChanged:Kt,startReached:me,stateChanged:P,stateRestoreInProgress:U,...w}},st(qe,It,fe,no,At,Ye,Gt));function ao(t,e,n){return ne(1,Ce((t+n)/(Ce(e)+n)))}function Fn(t,e,n,o){const{height:r}=n;if(r===void 0||o.length===0)return{bottom:0,top:0};const s=Ge(t,e,n,o[0].index);return{bottom:Ge(t,e,n,o[o.length-1].index)+r,top:s}}function Ge(t,e,n,o){const r=ao(t.width,n.width,e.column),s=Ce(o/r),i=s*n.height+ne(0,s-1)*e.row;return i>0?i+e.row:i}const _r=Y(()=>{const t=y(I=>`Item ${I}`),e=y({}),n=y(null),o=y("virtuoso-grid-item"),r=y("virtuoso-grid-list"),s=y(Qe),i=y("div"),l=y(Jt),u=(I,h=null)=>gt(v(e,L(m=>m[I]),ot()),h),d=y(!1),f=y(!1);return z(W(f),d),{components:e,computeItemKey:s,context:n,FooterComponent:u("Footer"),HeaderComponent:u("Header"),headerFooterTag:i,itemClassName:o,ItemComponent:u("Item","div"),itemContent:t,listClassName:r,ListComponent:u("List","div"),readyStateChanged:d,reportReadyState:f,ScrollerComponent:u("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:u("ScrollSeekPlaceholder","div")}}),Nr=Y(([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=Rt("scrollHeight"),u=nt("ItemComponent"),d=nt("ListComponent"),f=nt("ScrollSeekPlaceholder"),I=nt("context"),h=Rt("itemDimensions"),m=Rt("gap"),T=nt("log"),H=nt("stateRestoreInProgress"),g=Rt("reportReadyState"),S=Ot(R.useMemo(()=>a=>{const C=a.parentElement.parentElement.scrollHeight;l(C);const x=a.firstChild;if(x!==null){const{height:w,width:k}=x.getBoundingClientRect();h({height:w,width:k})}m({column:Vn("column-gap",getComputedStyle(a).columnGap,T),row:Vn("row-gap",getComputedStyle(a).rowGap,T)})},[l,h,m,T]),!0,!1);return be(()=>{e.itemHeight>0&&e.itemWidth>0&&g(!0)},[e]),H?null:V.jsx(d,{className:n,ref:S,...rt(d,I),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(a=>{const C=s(a.index,a.data,I);return i?V.jsx(f,{...rt(f,I),height:e.itemHeight,index:a.index,width:e.itemWidth},C):R.createElement(u,{...rt(u,I),className:o,"data-index":a.index,key:C},r(a.index,a.data,I))})})}),$r=R.memo(function(){const e=nt("HeaderComponent"),n=Rt("headerHeight"),o=nt("headerFooterTag"),r=Ot(R.useMemo(()=>i=>{n(Lt(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=Rt("footerHeight"),o=nt("headerFooterTag"),r=Ot(R.useMemo(()=>i=>{n(Lt(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=Rt("itemDimensions"),o=Rt("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:He(!1),children:t})},qr=({children:t})=>{const e=R.useContext(Xe),n=Rt("windowViewportRect"),o=Rt("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:fo,useEmitterValue:nt,usePublisher:Rt}=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:fo,useEmitterValue:nt,usePublisher:Rt}),Jr=nn({useEmitter:fo,useEmitterValue:nt,usePublisher:Rt});function Vn(t,e,n){return e!=="normal"&&e?.endsWith("px")!==!0&&n(`${t} was not resolved to pixel value correctly`,e,pt.WARN),e==="normal"?0:parseInt(e??"0",10)}const Qr=Zr;exports.GroupedTableVirtuoso=Pr;exports.GroupedVirtuoso=yr;exports.LogLevel=pt;exports.TableVirtuoso=Mr;exports.Virtuoso=wr;exports.VirtuosoGrid=Qr;exports.VirtuosoGridMockContext=Xe;exports.VirtuosoMockContext=Qt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("react/jsx-runtime"),H=require("react"),So=require("react-dom"),Re=0,Gt=1,Xt=2,An=4;function gn(t){return()=>t}function vo(t){t()}function se(t,e){return n=>t(e(n))}function xn(t,e){return()=>t(e)}function To(t,e){return n=>t(e,n)}function De(t){return t!==void 0}function Co(...t){return()=>{t.map(vo)}}function Jt(){}function He(t,e){return e(t),t}function wo(t,e){return e(t)}function st(...t){return t}function Z(t,e){return t(Gt,e)}function j(t,e){t(Re,e)}function $e(t){t(Xt)}function et(t){return t(An)}function B(t,e){return Z(t,To(e,Re))}function kt(t,e){const n=t(Gt,o=>{n(),e(o)});return n}function In(t){let e,n;return o=>r=>{e=r,n&&clearTimeout(n),n=setTimeout(()=>{o(e)},t)}}function jn(t,e){return t===e}function ot(t=jn){let e;return n=>o=>{t(e,o)||(e=o,n(o))}}function W(t){return e=>n=>{t(n)&&e(n)}}function k(t){return e=>se(e,t)}function vt(t){return e=>()=>{e(t)}}function v(t,...e){const n=yo(...e);return((o,r)=>{switch(o){case Xt:$e(t);return;case Gt:return Z(t,n(r))}})}function Et(t,e){return n=>o=>{n(e=t(e,o))}}function Ut(t){return e=>n=>{t>0?t--:e(n)}}function Mt(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;Z(s,u=>{const f=n;n|=l,e[i]=u,f!==r&&n===r&&o&&(o(),o=null)})}),s=>i=>{const l=()=>{s([i].concat(e))};n===r?l():o=l}}function yo(...t){return e=>t.reduceRight(wo,e)}function bo(t){let e,n;const o=()=>e?.();return function(r,s){switch(r){case Gt:return s?n===s?void 0:(o(),n=s,e=Z(t,s),e):(o(),Jt);case Xt:o(),n=null;return}}}function y(t){let e=t;const n=U();return((o,r)=>{switch(o){case Re:e=r;break;case Gt:{r(e);break}case An:return e}return n(o,r)})}function gt(t,e){return He(y(e),n=>B(t,n))}function U(){const t=[];return((e,n)=>{switch(e){case Re:t.slice().forEach(o=>{o(n)});return;case Xt:t.splice(0);return;case Gt:return t.push(n),()=>{const o=t.indexOf(n);o>-1&&t.splice(o,1)}}})}function Ct(t){return He(U(),e=>B(t,e))}const Ro={singleton:!0};function q(t,e=[],n=Ro){const{singleton:o}=n;return{constructor:t,dependencies:e,id:Ho(),singleton:o}}const Ho=()=>Symbol("id");function Eo(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(u=>n(u)));return i&&e.set(s,l),l};return n(t)}function dt(...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;Z(s,u=>{n[i]=u,o|=l,o===r&&j(e,n)})}),function(s,i){switch(s){case Xt:{$e(e);return}case Gt:return o===r&&i(n),Z(e,i)}}}function G(t,e=jn){return v(t,ot(e))}function we(...t){return function(e,n){switch(e){case Xt:return;case Gt:return Co(...t.map(o=>Z(o,n)))}}}const ht={DEBUG:0,INFO:1,WARN:2,ERROR:3},ko={[ht.DEBUG]:"debug",[ht.ERROR]:"error",[ht.INFO]:"log",[ht.WARN]:"warn"},Lo=()=>typeof globalThis>"u"?window:globalThis,Pt=q(()=>{const t=y(ht.ERROR);return{log:y((n,o,r=ht.INFO)=>{const s=Lo().VIRTUOSO_LOG_LEVEL??et(t);r>=s&&console[ko[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,o)}),logLevel:t}},[],{singleton:!0});function Oo(t){return"self"in t?t.document.documentElement:t}function _n(t){const e=Oo(t);return e.ownerDocument.defaultView.getComputedStyle(e).direction==="rtl"}function Nt(t,e){return _n(t)?-e:e}function Sn(t,e){return _n(t)?-e:e}function Ft(t,e,n){return Ue(t,e,n).callbackRef}function Ue(t,e,n){const o=H.useRef(null);let r=i=>{};const s=H.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(i=>{const l=()=>{const u=i[0].target;u.offsetParent!==null&&t(u)};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 Nn(t,e,n,o,r,s,i,l,u){const f=H.useCallback(d=>{const g=zo(d.children,e,l?"offsetWidth":"offsetHeight",r);let h=d.parentElement;for(;h.dataset.virtuosoScroller===void 0;)h=h.parentElement;const m=h.lastElementChild?.dataset.viewportType==="window";let S;m&&(S=h.ownerDocument.defaultView);const R=i?l?i.scrollWidth:i.scrollHeight:m?l?S.document.documentElement.scrollWidth:S.document.documentElement.scrollHeight:l?h.scrollWidth:h.scrollHeight,x=i?l?i.offsetWidth:i.offsetHeight:m?l?S.innerWidth:S.innerHeight:l?h.offsetWidth:h.offsetHeight,T=i?l?Nt(i,i.scrollLeft):i.scrollTop:m?l?Nt(S,S.scrollX||S.document.documentElement.scrollLeft):S.scrollY||S.document.documentElement.scrollTop:l?Nt(h,h.scrollLeft):h.scrollTop;o({scrollHeight:R,scrollTop:Math.max(T,0),viewportHeight:x}),s?.(l?vn("column-gap",getComputedStyle(d).columnGap,r):vn("row-gap",getComputedStyle(d).rowGap,r)),g!==null&&t(g)},[t,e,r,s,i,o,l]);return Ue(f,n,u)}function zo(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 u=parseInt(l.dataset.index,10),f=parseFloat(l.dataset.knownSize),d=e(l,n);if(d===0&&o("Zero-sized element, this should not happen",{child:l},ht.ERROR),d===f)continue;const g=s[s.length-1];s.length===0||g.size!==d||g.endIndex!==u-1?s.push({endIndex:u,size:d,startIndex:u}):s[s.length-1].endIndex++}return s}function vn(t,e,n){return e!=="normal"&&e?.endsWith("px")!==!0&&n(`${t} was not resolved to pixel value correctly`,e,ht.WARN),e==="normal"?0:parseInt(e??"0",10)}const Ee=typeof document>"u"?H.useEffect:H.useLayoutEffect;function We(t){return t?.currentCSSZoom??1}function Ht(t,e){return e===1?t:Math.round(t*e*64)/64}function ie(t,e,n=t.parentElement){return Ht(t.getBoundingClientRect()[e],1/We(n))}function Lt(t,e,n=t.parentElement){return Math.round(ie(t,e,n))}function Ke(t,e,n){const o=H.useRef(null),r=H.useCallback(u=>{if(!u?.offsetParent)return;const f=u.getBoundingClientRect(),d=We(u);let g,h,m;if(e){const S=e.getBoundingClientRect(),R=f.top-S.top;h=We(e),m=Ht(S.height-Math.max(0,R),1/d),g=Ht(R,1/h)+e.scrollTop}else{const S=i.current.ownerDocument.defaultView;h=1,m=Ht(S.innerHeight-Math.max(0,f.top),1/d),g=f.top+S.scrollY}o.current={listHeight:Ht(f.height,1/d),offsetTop:g,visibleHeight:m,visibleWidth:Ht(f.width,1/d),zoomRatio:h/d},t(o.current)},[t,e]),{callbackRef:s,ref:i}=Ue(r,!0,n),l=H.useCallback(()=>{r(i.current)},[r,i]);return H.useEffect(()=>{if(e){e.addEventListener("scroll",l);const f=new ResizeObserver(()=>{requestAnimationFrame(l)});return f.observe(e),()=>{e.removeEventListener("scroll",l),f.unobserve(e)}}const u=i.current?.ownerDocument.defaultView;return u?.addEventListener("scroll",l),u?.addEventListener("resize",l),()=>{u?.removeEventListener("scroll",l),u?.removeEventListener("resize",l)}},[l,e,i]),s}const xt=q(()=>{const t=U(),e=U(),n=y(0),o=U(),r=U(),s=y(0),i=U(),l=U(),u=y(0),f=y(0),d=y(0),g=y(0),h=U(),m=U(),S=y(!1),R=y(!1),x=y(!1);return B(v(t,k(({scrollTop:T})=>T)),e),B(v(t,k(({scrollHeight:T})=>T)),l),B(e,s),{deviation:n,deviationCommitted:o,fixedFooterHeight:d,fixedHeaderHeight:f,footerHeight:g,headerHeight:u,horizontalDirection:R,scrollBy:m,scrollContainerState:t,scrollHeight:l,scrollingInProgress:S,scrollTo:h,scrollTop:e,skipAnimationFrameInResizeObserver:x,smoothScrollTargetReached:r,statefulScrollTop:s,viewportHeight:i}},[],{singleton:!0}),le={lvl:0};function Dn(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:u}=e(t[i]);s.push({end:l-1,start:o,value:r}),o=l,r=u}return s.push({end:1/0,start:o,value:r}),s}function J(t){return t===le}function ce(t,e){if(!J(t))return e===t.k?t.v:e<t.k?ce(t.l,e):ce(t.r,e)}function Ot(t,e,n="k"){if(J(t))return[-1/0,void 0];if(Number(t[n])===e)return[t.k,t.v];if(Number(t[n])<e){const o=Ot(t.r,e,n);return o[0]===-1/0?[t.k,t.v]:o}return Ot(t.l,e,n)}function St(t,e,n){return J(t)?Kn(e,n,1):e===t.k?pt(t,{k:e,v:n}):e<t.k?Tn(pt(t,{l:St(t.l,e,n)})):Tn(pt(t,{r:St(t.r,e,n)}))}function Dt(){return le}function Yt(t,e,n){if(J(t))return[];const o=Ot(t,e)[0];return Bo(Pe(t,o,n))}function Ge(t,e){if(J(t))return le;const{k:n,l:o,r}=t;if(e===n){if(J(o))return r;if(J(r))return o;const[s,i]=Un(o);return Te(pt(t,{k:s,l:$n(o),v:i}))}return e<n?Te(pt(t,{l:Ge(o,e)})):Te(pt(t,{r:Ge(r,e)}))}function $t(t){return J(t)?[]:[...$t(t.l),{k:t.k,v:t.v},...$t(t.r)]}function Pe(t,e,n){if(J(t))return[];const{k:o,l:r,r:s,v:i}=t;let l=[];return o>e&&(l=l.concat(Pe(r,e,n))),o>=e&&o<=n&&l.push({k:o,v:i}),o<=n&&(l=l.concat(Pe(s,e,n))),l}function Te(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(ze(e))return qn(pt(t,{lvl:n-1}));if(!J(e)&&!J(e.r))return pt(e.r,{l:pt(e,{r:e.r.l}),lvl:n,r:pt(t,{l:e.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}if(ze(t))return Ae(pt(t,{lvl:n-1}));if(!J(o)&&!J(o.l)){const r=o.l,s=ze(r)?o.lvl-1:o.lvl;return pt(r,{l:pt(t,{lvl:n-1,r:r.l}),lvl:r.lvl+1,r:Ae(pt(o,{l:r.r,lvl:s}))})}throw new Error("Unexpected empty nodes")}function pt(t,e){return Kn(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 $n(t){return J(t.r)?t.l:Te(pt(t,{r:$n(t.r)}))}function ze(t){return J(t)||t.lvl>t.r.lvl}function Un(t){return J(t.r)?[t.k,t.v]:Un(t.r)}function Kn(t,e,n,o=le,r=le){return{k:t,l:o,lvl:n,r,v:e}}function Tn(t){return Ae(qn(t))}function qn(t){const{l:e}=t;return!J(e)&&e.lvl===t.lvl?pt(e,{r:pt(t,{l:e.r})}):t}function Ae(t){const{lvl:e,r:n}=t;return!J(n)&&!J(n.r)&&n.lvl===e&&n.r.lvl===e?pt(n,{l:pt(t,{r:n.l}),lvl:e+1}):t}function Bo(t){return Dn(t,({k:e,v:n})=>({index:e,value:n}))}function Yn(t,e){return!!(t&&t.startIndex===e.startIndex&&t.endIndex===e.endIndex)}function Zt(t,e){return!!(t&&t[0]===e[0]&&t[1]===e[1])}const qe=q(()=>({recalcInProgress:y(!1)}),[],{singleton:!0});function Zn(t,e,n){return t[ye(t,e,n)]}function ye(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 Fo(t,e,n,o){const r=ye(t,e,o),s=ye(t,n,o,r);return t.slice(r,s+1)}function ke(t){return!J(t.groupOffsetTree)}function Ye({index:t},e){return e===t?0:e<t?-1:1}function Cn(){return{groupIndices:[],groupOffsetTree:Dt(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Dt()}}function Vo(t,e){let n=J(t)?0:1/0;for(const o of e){const{endIndex:r,size:s,startIndex:i}=o;if(n=Math.min(n,i),J(t)){t=St(t,0,s);continue}const l=Yt(t,i-1,r+1);if(l.some(_o(o)))continue;let u=!1,f=!1;for(const{end:d,start:g,value:h}of l)u?(r>=g||s===h)&&(t=Ge(t,g)):(f=h!==s,u=!0),d>r&&r>=g&&h!==s&&(t=St(t,r+1,h));f&&(t=St(t,i,s))}return[t,n]}function Mo(t){return t.groupIndex!==void 0}function Wo({offset:t},e){return e===t?0:e<t?-1:1}function ue(t,e,n){if(e.length===0)return 0;const{index:o,offset:r,size:s}=Zn(e,t,Ye);return r+(t-o)*(s+n)}function Xn(t,e){if(!ke(e))return t;let n=0;for(;e.groupIndices[n]<=t+n;)n++;return t+n}function Jn(t,e,n){if(Mo(t))return e.groupIndices[t.groupIndex]+1;const o=t.index==="LAST"?n:t.index;let r=Xn(o,e);return r=Math.max(0,Math.min(n,r)),r}function Go(t,e,n,o=0){return o>0&&(e=Math.max(e,Zn(t,o,Ye).offset)),Dn(Fo(t,e,n,Wo),jo)}function Po(t,[e,n,o,r]){e.length>0&&o("received item sizes",e,ht.DEBUG);const s=t.sizeTree;let i=s,l=0;if(n.length>0&&J(s)&&e.length===2){const h=e[0].size,m=e[1].size;i=n.reduce((S,R)=>St(St(S,R,h),R+1,m),i)}else[i,l]=Vo(i,e);if(i===s)return t;const{lastIndex:u,lastOffset:f,lastSize:d,offsetTree:g}=je(t.offsetTree,l,i,r);return{groupIndices:n,groupOffsetTree:n.reduce((h,m)=>St(h,m,ue(m,g,r)),Dt()),lastIndex:u,lastOffset:f,lastSize:d,offsetTree:g,sizeTree:i}}function Ao(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 wn(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 je(t,e,n,o){let r=t,s=0,i=0,l=0,u=0;if(e===0)r=[];else{u=ye(r,e-1,Ye),l=r[u].offset;const d=Ot(n,e-1);s=d[0],i=d[1],r.length&&r[u].size===Ot(n,e)[1]&&(u-=1),r=r.slice(0,u+1)}for(const{start:f,value:d}of Yt(n,e,1/0)){const g=f-s,h=g*i+l+g*o;r.push({index:f,offset:h,size:d}),s=f,l=h,i=d}return{lastIndex:s,lastOffset:l,lastSize:i,offsetTree:r}}function jo(t){return{index:t.index,value:t}}function _o(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 No={offsetHeight:"height",offsetWidth:"width"},Vt=q(([{log:t},{recalcInProgress:e}])=>{const n=U(),o=U(),r=gt(o,0),s=U(),i=U(),l=y(0),u=y([]),f=y(void 0),d=y(void 0),g=y(void 0),h=y(void 0),m=y((a,p)=>Lt(a,No[p])),S=y(void 0),R=y(0),x=Cn(),T=U(),c=gt(v(we(n,T),N(u,t,R),Et((a,[p,...b])=>{if(p===null){const[O]=b;return{...Cn(),groupIndices:O,groupOffsetTree:O.reduce((z,F,_)=>St(z,F,_),Dt())}}return Po(a,[p,...b])},x),ot()),x),C=gt(v(u,ot(),Et((a,p)=>({current:p,prev:a.current}),{current:[],prev:[]}),k(({prev:a})=>a)),[]);B(v(u,W(a=>a.length>0),N(c,R),k(([a,p,b])=>{const O=a.reduce((z,F,_)=>St(z,F,ue(F,p.offsetTree,b)||_),Dt());return{...p,groupIndices:a,groupOffsetTree:O}})),c),B(v(o,N(c),W(([a,{lastIndex:p}])=>a<p),k(([a,{lastIndex:p,lastSize:b}])=>[{endIndex:p,size:b,startIndex:a}])),n),B(f,d);const I=gt(v(f,k(a=>a===void 0)),!0);B(v(d,W(a=>a!==void 0&&J(et(c).sizeTree)),k(a=>{const p=et(g),b=et(u).length>0;return p!==void 0&&p!==0?b?[{endIndex:0,size:p,startIndex:0},{endIndex:1,size:a,startIndex:1}]:[]:[{endIndex:0,size:a,startIndex:0}]})),n),B(v(h,W(a=>a!==void 0&&a.length>0&&J(et(c).sizeTree)),k(a=>{const p=[];let b=a[0],O=0;for(let z=1;z<a.length;z++){const F=a[z];F!==b&&(p.push({endIndex:z-1,size:b,startIndex:O}),b=F,O=z)}return p.push({endIndex:a.length-1,size:b,startIndex:O}),p})),n),B(v(u,N(g,d),W(([,a,p])=>a!==void 0&&p!==void 0),k(([a,p,b])=>{const O=[];for(let z=0;z<a.length;z++){const F=a[z],_=a[z+1];O.push({startIndex:F,endIndex:F,size:p}),_!==void 0&&O.push({startIndex:F+1,endIndex:_-1,size:b})}return O})),n);const w=Ct(v(n,N(c),Et(({sizes:a},[p,b])=>({changed:b!==a,sizes:b}),{changed:!1,sizes:x}),k(a=>a.changed)));Z(v(l,Et((a,p)=>({diff:a.prev-p,prev:p}),{diff:0,prev:0}),k(a=>a.diff)),a=>{const{groupIndices:p}=et(c);if(a>0)j(e,!0),j(s,a+wn(a,p));else if(a<0){const b=et(C);b.length>0&&(a-=wn(-a,b)),j(i,a)}}),Z(v(l,N(t)),([a,p])=>{a<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},ht.ERROR)});const L=Ct(s);B(v(s,N(c),k(([a,p])=>{const b=p.groupIndices.length>0,O=[],z=p.lastSize;if(b){const F=ce(p.sizeTree,0);let _=0,X=0;for(;_<a;){const Y=p.groupIndices[X],it=p.groupIndices.length===X+1?1/0:p.groupIndices[X+1]-Y-1;O.push({endIndex:Y,size:F,startIndex:Y}),O.push({endIndex:Y+1+it-1,size:z,startIndex:Y+1}),X++,_+=it+1}const V=$t(p.sizeTree);return _!==a&&V.shift(),V.reduce((Y,{k:it,v:ct})=>{let mt=Y.ranges;return Y.prevSize!==0&&(mt=[...Y.ranges,{endIndex:it+a-1,size:Y.prevSize,startIndex:Y.prevIndex}]),{prevIndex:it+a,prevSize:ct,ranges:mt}},{prevIndex:a,prevSize:0,ranges:O}).ranges}return $t(p.sizeTree).reduce((F,{k:_,v:X})=>({prevIndex:_+a,prevSize:X,ranges:[...F.ranges,{endIndex:_+a-1,size:F.prevSize,startIndex:F.prevIndex}]}),{prevIndex:0,prevSize:z,ranges:[]}).ranges})),n);const P=Ct(v(i,N(c,R),k(([a,{offsetTree:p},b])=>{const O=-a;return ue(O,p,b)})));return B(v(i,N(c,R),k(([a,p,b])=>{if(p.groupIndices.length>0){if(J(p.sizeTree))return p;let F=Dt();const _=et(C);let X=0,V=0,ft=0;for(;X<-a;){ft=_[V];const it=_[V+1]-ft-1;V++,X+=it+1}if(F=$t(p.sizeTree).reduce((it,{k:ct,v:mt})=>St(it,Math.max(0,ct+a),mt),F),X!==-a){const it=ce(p.sizeTree,ft);F=St(F,0,it);const ct=Ot(p.sizeTree,-a+1)[1];F=St(F,1,ct)}return{...p,sizeTree:F,...je(p.offsetTree,0,F,b)}}const z=$t(p.sizeTree).reduce((F,{k:_,v:X})=>St(F,Math.max(0,_+a),X),Dt());return{...p,sizeTree:z,...je(p.offsetTree,0,z,b)}})),c),{beforeUnshiftWith:L,data:S,defaultItemSize:d,firstItemIndex:l,fixedItemSize:f,fixedGroupSize:g,gap:R,groupIndices:u,heightEstimates:h,itemSize:m,listRefresh:w,resetSizes:T,shiftWith:i,shiftWithOffset:P,sizeRanges:n,sizes:c,statefulTotalCount:r,totalCount:o,trackItemSizes:I,unshiftWith:s}},st(Pt,qe),{singleton:!0});function Do(t){return t.reduce((e,n)=>(e.groupIndices.push(e.totalCount),e.totalCount+=n+1,e),{groupIndices:[],totalCount:0})}const Qn=q(([{groupIndices:t,resetSizes:e,sizeRanges:n,sizes:o,statefulTotalCount:r,totalCount:s,trackItemSizes:i},{headerHeight:l,scrollTop:u}])=>{const f=U(),d=U(),g=Ct(v(f,k(Do))),h=gt(v(n,N(r,t),W(([,m,S])=>m>S.length),vt(!0)),!1);return B(v(g,Et(([,m],S)=>[m,S],[{groupIndices:[],totalCount:0},{groupIndices:[],totalCount:0}]),N(o,i,h),W(([[m,S],{sizeTree:R},x,T])=>{const c=m.groupIndices.length>0&&m.totalCount===m.groupIndices.length,C=S.totalCount>S.groupIndices.length;return x&&!T&&c&&C&&!J(R)}),vt(null)),e),B(v(g,k(m=>m.totalCount)),s),B(v(g,k(m=>m.groupIndices)),t),B(v(dt(u,o,l),W(([m,S])=>ke(S)),k(([m,S,R])=>Ot(S.groupOffsetTree,Math.max(m-R,0),"v")[0]),ot(),k(m=>[m])),d),{groupCounts:f,topItemsIndexes:d}},st(Vt,xt)),At=q(([{log:t}])=>{const e=y(!1),n=Ct(v(e,W(o=>o),ot()));return Z(e,o=>{o&&et(t)("props updated",{},ht.DEBUG)}),{didMount:n,propsReady:e}},st(Pt),{singleton:!0}),$o=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function to(t){const e=typeof t=="number"?{index:t}:{...t};return e.align||(e.align="start"),(!e.behavior||!$o)&&(e.behavior="auto"),e.offset===void 0&&(e.offset=0),e}const me=q(([{gap:t,listRefresh:e,sizes:n,totalCount:o},{fixedFooterHeight:r,fixedHeaderHeight:s,footerHeight:i,headerHeight:l,scrollingInProgress:u,scrollTo:f,smoothScrollTargetReached:d,viewportHeight:g},{log:h}])=>{const m=U(),S=U(),R=y(0);let x=null,T=null,c=null;function C(){x!==null&&(x(),x=null),c!==null&&(c(),c=null),T&&(clearTimeout(T),T=null),j(u,!1)}return B(v(m,N(n,g,o,R,l,i,h),N(t,s,r),k(([[I,w,L,P,a,p,b,O],z,F,_])=>{const X=to(I),{align:V,behavior:ft,offset:Y}=X,it=P-1,ct=Jn(X,w,it);let mt=ue(ct,w.offsetTree,z)+p;V==="end"?(mt+=F+Ot(w.sizeTree,ct)[1]-L+_,ct===it&&(mt+=b)):V==="center"?mt+=(F+Ot(w.sizeTree,ct)[1]-L+_)/2:mt-=a,Y!==void 0&&Y!==0&&(mt+=Y);const zt=Rt=>{C(),Rt?(O("retrying to scroll to",{location:I},ht.DEBUG),j(m,I)):(j(S,!0),O("list did not change, scroll successful",{},ht.DEBUG))};if(C(),ft==="smooth"){let Rt=!1;c=Z(e,wt=>{Rt=Rt||wt}),x=kt(d,()=>{zt(Rt)})}else x=kt(v(e,Uo(150)),zt);return T=setTimeout(()=>{C()},1200),j(u,!0),O("scrolling from index to",{behavior:ft,index:ct,top:mt},ht.DEBUG),{behavior:ft,top:mt}})),f),{scrollTargetReached:S,scrollToIndex:m,topListHeight:R}},st(Vt,xt,Pt),{singleton:!0});function Uo(t){return e=>{const n=setTimeout(()=>{e(!1)},t);return o=>{o&&(e(!0),clearTimeout(n))}}}function Ze(t,e){t===0?e():requestAnimationFrame(()=>{Ze(t-1,e)})}function Xe(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 _e(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 he=q(([{defaultItemSize:t,listRefresh:e,sizes:n},{scrollTop:o},{scrollTargetReached:r,scrollToIndex:s},{didMount:i}])=>{const l=y(!0),u=y(0),f=y(!0);return B(v(i,N(u),W(([d,g])=>!_e(g)),vt(!1)),l),B(v(i,N(u),W(([d,g])=>!_e(g)),vt(!1)),f),Z(v(dt(e,i),N(l,n,t,f),W(([[,d],g,{sizeTree:h},m,S])=>d&&(!J(h)||De(m))&&!g&&!S),N(u)),([,d])=>{if(d===void 0){j(l,!0),j(f,!0);return}kt(r,()=>{j(f,!0)}),Ze(4,()=>{kt(o,()=>{j(l,!0)}),j(s,d)})}),{initialItemFinalLocationReached:f,initialTopMostItemIndex:u,scrolledToInitialItem:l}},st(Vt,xt,me,At),{singleton:!0});function eo(t,e){return Math.abs(t-e)<1.01}const ae="up",oe="down",Ko="none",qo={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Yo=0,pe=q(([{footerHeight:t,headerHeight:e,scrollBy:n,scrollContainerState:o,scrollTop:r,viewportHeight:s}])=>{const i=y(!1),l=y(!0),u=U(),f=U(),d=y(4),g=y(Yo),h=gt(v(we(v(G(r),Ut(1),vt(!0)),v(G(r),Ut(1),vt(!1),In(100))),ot()),!1),m=gt(v(we(v(n,vt(!0)),v(n,vt(!1),In(200))),ot()),!1);B(v(dt(G(r),G(g)),k(([c,C])=>c<=C),ot()),l),B(v(l,Mt(50)),f);const S=Ct(v(dt(o,G(s),G(e),G(t),G(d)),Et((c,[{scrollHeight:C,scrollTop:I},w,L,P,a])=>{const p=I+w-C>-a,b={scrollHeight:C,scrollTop:I,viewportHeight:w};if(p){let z,F;return I>c.state.scrollTop?(z="SCROLLED_DOWN",F=c.state.scrollTop-I):(z="SIZE_DECREASED",F=c.state.scrollTop-I||c.scrollTopDelta),{atBottom:!0,atBottomBecause:z,scrollTopDelta:F,state:b}}let O;return b.scrollHeight>c.state.scrollHeight?O="SIZE_INCREASED":w<c.state.viewportHeight?O="VIEWPORT_HEIGHT_DECREASING":I<c.state.scrollTop?O="SCROLLING_UPWARDS":O="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:O,state:b}},qo),ot((c,C)=>c!==void 0&&c.atBottom===C.atBottom))),R=gt(v(o,Et((c,{scrollHeight:C,scrollTop:I,viewportHeight:w})=>{if(!eo(c.scrollHeight,C)){const L=C-(I+w)<1;return c.scrollTop!==I&&L?{changed:!0,jump:c.scrollTop-I,scrollHeight:C,scrollTop:I}:{changed:!0,jump:0,scrollHeight:C,scrollTop:I}}return{changed:!1,jump:0,scrollHeight:C,scrollTop:I}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),W(c=>c.changed),k(c=>c.jump)),0);B(v(S,k(c=>c.atBottom)),i),B(v(i,Mt(50)),u);const x=y(oe);B(v(o,k(({scrollTop:c})=>c),ot(),Et((c,C)=>et(m)?{direction:c.direction,prevScrollTop:C}:{direction:C<c.prevScrollTop?ae:oe,prevScrollTop:C},{direction:oe,prevScrollTop:0}),k(c=>c.direction)),x),B(v(o,Mt(50),vt(Ko)),x);const T=y(0);return B(v(h,W(c=>!c),vt(0)),T),B(v(r,Mt(100),N(h),W(([c,C])=>C),Et(([c,C],[I])=>[C,I],[0,0]),k(([c,C])=>C-c)),T),{atBottomState:S,atBottomStateChange:u,atBottomThreshold:d,atTopStateChange:f,atTopThreshold:g,isAtBottom:i,isAtTop:l,isScrolling:h,lastJumpDueToItemResize:R,scrollDirection:x,scrollVelocity:T}},st(xt)),de="top",fe="bottom",yn="none";function bn(t,e,n){return typeof t=="number"?n===ae&&e===de||n===oe&&e===fe?t:0:n===ae?e===de?t.main:t.reverse:e===fe?t.main:t.reverse}function Rn(t,e){return typeof t=="number"?t:t[e]??0}const Je=q(([{deviation:t,fixedHeaderHeight:e,headerHeight:n,scrollTop:o,viewportHeight:r}])=>{const s=U(),i=y(0),l=y(0),u=y(0),f=gt(v(dt(G(o),G(r),G(n),G(s,Zt),G(u),G(i),G(e),G(t),G(l)),k(([d,g,h,[m,S],R,x,T,c,C])=>{const I=d-c,w=x+T,L=Math.max(h-I,0);let P=yn;const a=Rn(C,de),p=Rn(C,fe);return m-=c,m+=h+T,S+=h+T,S-=c,m>d+w-a&&(P=ae),S<d-L+g+p&&(P=oe),P!==yn?[Math.max(I-h-bn(R,de,P)-a,0),I-L-T+g+bn(R,fe,P)+p]:null}),W(d=>d!==null),ot(Zt)),[0,0]);return{increaseViewportBy:l,listBoundary:s,overscan:u,topListHeight:i,visibleRange:f}},st(xt),{singleton:!0});function Zo(t,e,n,o){if(ke(e)){const r=o-e.groupIndices.length;if(r<=0)return[{index:e.groupIndices[0],offset:0,size:0}];const s=Xn(Math.min(t,r-1),e);return[{index:Ot(e.groupOffsetTree,s)[0],offset:0,size:0},{data:n?.[0],index:s,offset:0,size:0}]}return[{data:n?.[0],index:t,offset:0,size:0}]}const Be={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Ce(t,e,n,o,r,s){const{lastIndex:i,lastOffset:l,lastSize:u}=r;let f=0,d=0;if(t.length>0){f=t[0].offset;const R=t[t.length-1];d=R.offset+R.size}const g=n-i,h=l+g*u+(g-1)*o,m=f,S=h-d;return{bottom:d,firstItemIndex:s,items:Hn(t,r,s),offsetBottom:S,offsetTop:f,top:m,topItems:Hn(e,r,s),topListHeight:e.reduce((R,x)=>x.size+R,0),totalCount:n}}function no(t,e,n,o,r,s){let i=0;if(n.groupIndices.length>0)for(const m of n.groupIndices){if(m-i>=t)break;i++}const l=t+i,u=s!==void 0,f=s?.length??0,d=Xe(e,u?f:l),g=u?Math.max(0,Math.min(l,f-d)):l,h=Array.from({length:g}).map((m,S)=>({data:s?.[S+d],index:S+d,offset:0,size:0}));return Ce(h,[],g,r,n,o)}function Hn(t,e,n){if(t.length===0)return[];if(!ke(e))return t.map(f=>({...f,index:f.index+n,originalIndex:f.index}));const o=t[0].index,r=t[t.length-1].index,s=[],i=Yt(e.groupOffsetTree,o,r);let l,u=0;for(const f of t){(!l||l.end<f.index)&&(l=i.shift(),u=e.groupIndices.indexOf(l.start));let d;f.index===l.start?d={index:u,type:"group"}:d={groupIndex:u,index:f.index-(u+1)+n},s.push({...d,data:f.data,offset:f.offset,originalIndex:f.index,size:f.size})}return s}function En(t,e){return t===void 0?0:typeof t=="number"?t:t[e]??0}const Kt=q(([{data:t,firstItemIndex:e,gap:n,sizes:o,totalCount:r},s,{listBoundary:i,topListHeight:l,visibleRange:u},{initialTopMostItemIndex:f,scrolledToInitialItem:d},{topListHeight:g},h,{didMount:m},{recalcInProgress:S}])=>{const R=y([]),x=y(0),T=gt(v(o,W(({sizeTree:a})=>!J(a)),vt(!0)),!1),c=U(),C=y(0);B(s.topItemsIndexes,R);const I=gt(v(dt(m,S,G(u,Zt),G(r),G(o),G(f),d,G(R),G(e),G(n),G(C),t,G(x)),W(([a,p,,b,,,,,,,,O])=>{const z=O!==void 0&&O.length!==b;return a&&!p&&!z}),k(([,,[a,p],b,O,z,F,_,X,V,ft,Y,it])=>{const ct=O,{offsetTree:mt,sizeTree:zt}=ct;if(b===0)return{...Be,totalCount:b};if(a===0&&p===0)return it===0?{...Be,totalCount:b}:no(it,z,O,X,V,Y);if(J(zt))return it>0&&!et(T)?null:Ce(Zo(Xe(z,b),ct,Y,b),[],b,V,ct,X);const Rt=[];if(_.length>0){const D=_[0],K=_[_.length-1];let lt=0;for(const tt of Yt(zt,D,K)){const Q=tt.value,ut=Math.max(tt.start,D),It=Math.min(tt.end,K);for(let at=ut;at<=It;at++)Rt.push({data:Y?.[at],index:at,offset:lt,size:Q}),lt+=Q}}if(!F)return Ce([],Rt,b,V,ct,X);const wt=_.length>0?_[_.length-1]+1:0,ge=Go(mt,a,p,wt);if(ge.length===0)return null;const te=b-1,Bt=He([],D=>{for(const K of ge){const lt=K.value;let tt=lt.offset,Q=K.start;const ut=lt.size;if(lt.offset<a){Q+=Math.floor((a-lt.offset+V)/(ut+V));const at=Q-K.start;tt+=at*ut+at*V}Q<wt&&(tt+=(wt-Q)*ut,Q=wt);const It=Math.min(K.end,te);for(let at=Q;at<=It&&!(tt>=p);at++)D.push({data:Y?.[at],index:at,offset:tt,size:ut}),tt+=ut+V}}),ee=En(ft,de),E=En(ft,fe);if(Bt.length>0&&(ee>0||E>0)){const D=Bt[0],K=Bt[Bt.length-1];if(ee>0&&D.index>wt){const lt=Math.min(ee,D.index-wt),tt=[];let Q=D.offset;for(let ut=D.index-1;ut>=D.index-lt;ut--){const at=Yt(zt,ut,ut)[0]?.value??D.size;Q-=at+V,tt.unshift({data:Y?.[ut],index:ut,offset:Q,size:at})}Bt.unshift(...tt)}if(E>0&&K.index<te){const lt=Math.min(E,te-K.index);let tt=K.offset+K.size+V;for(let Q=K.index+1;Q<=K.index+lt;Q++){const It=Yt(zt,Q,Q)[0]?.value??K.size;Bt.push({data:Y?.[Q],index:Q,offset:tt,size:It}),tt+=It+V}}}return Ce(Bt,Rt,b,V,ct,X)}),W(a=>a!==null),ot()),Be);B(v(t,W(De),k(a=>a?.length)),r),B(v(I,k(a=>a.topListHeight)),g),B(g,l),B(v(I,k(a=>[a.top,a.bottom])),i),B(v(I,k(a=>a.items)),c);const w=Ct(v(I,W(({items:a})=>a.length>0),N(r,t),W(([{items:a},p])=>a[a.length-1].originalIndex===p-1),k(([{items:a},p,b])=>{const O=a[a.length-1],z=O.type==="group"?O.index+1:(O.groupIndex??-1)+1;return[p-1-z,b]}),ot(Zt),W(([a])=>a>=0),k(([a])=>a))),L=Ct(v(I,Mt(200),W(({items:a,topItems:p})=>a.length>0&&a[0].originalIndex===p.length),k(({items:a})=>a[0].index),ot())),P=Ct(v(I,W(({items:a})=>a.length>0),k(({items:a})=>{let p=0,b=a.length-1;for(;a[p].type==="group"&&p<b;)p++;for(;a[b].type==="group"&&b>p;)b--;return{endIndex:a[b].index,startIndex:a[p].index}}),ot(Yn)));return{endReached:w,initialItemCount:x,itemsRendered:c,listState:I,minOverscanItemCount:C,rangeChanged:P,startReached:L,topItemsIndexes:R,...h}},st(Vt,Qn,Je,he,me,pe,At,qe),{singleton:!0}),oo=q(([{fixedFooterHeight:t,fixedHeaderHeight:e,footerHeight:n,headerHeight:o},{listState:r}])=>{const s=U(),i=gt(v(dt(n,t,o,e,r),k(([l,u,f,d,g])=>l+u+f+d+g.offsetBottom+g.bottom)),0);return B(G(i),s),{totalListHeight:i,totalListHeightChanged:s}},st(xt,Kt),{singleton:!0}),Xo=q(([{viewportHeight:t},{totalListHeight:e}])=>{const n=y(!1),o=gt(v(dt(n,t,e),W(([r])=>r),k(([,r,s])=>Math.max(0,r-s)),Mt(0),ot()),0);return{alignToBottom:n,paddingTopAddition:o}},st(xt,oo),{singleton:!0}),ro=q(()=>({context:y(null)})),Jo=({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,so=q(([{gap:t,sizes:e,totalCount:n},{fixedFooterHeight:o,fixedHeaderHeight:r,headerHeight:s,scrollingInProgress:i,scrollTop:l,viewportHeight:u},{scrollToIndex:f}])=>{const d=U();return B(v(d,N(e,u,n,s,r,o,l),N(t),k(([[g,h,m,S,R,x,T,c],C])=>{const{calculateViewLocation:I=Jo,done:w,...L}=g,P=Jn(g,h,S-1),a=ue(P,h.offsetTree,C)+R+x,p=a+Ot(h.sizeTree,P)[1],b=c+x,O=c+m-T,z=I({itemBottom:p,itemTop:a,locationParams:L,viewportBottom:O,viewportTop:b});return z===null?w?.():w&&kt(v(i,W(F=>!F),Ut(et(i)?1:2)),w),z}),W(g=>g!==null)),f),{scrollIntoView:d}},st(Vt,xt,me,Kt,Pt),{singleton:!0});function kn(t){return t===!1?!1:t==="smooth"?"smooth":"auto"}const Qo=(t,e)=>typeof t=="function"?kn(t(e)):e&&kn(t),tr=q(([{listRefresh:t,totalCount:e,fixedItemSize:n,data:o},{atBottomState:r,isAtBottom:s},{scrollToIndex:i},{scrolledToInitialItem:l},{didMount:u,propsReady:f},{log:d},{scrollingInProgress:g},{context:h},{scrollIntoView:m}])=>{const S=y(!1),R=U();let x=null;function T(w){j(i,{align:"end",behavior:w,index:"LAST"})}Z(v(dt(v(G(e),Ut(1)),u),N(G(S),s,l,g),k(([[w,L],P,a,p,b])=>{let O=L&&p,z="auto";return O&&(z=Qo(P,a||b),O=O&&z!==!1),{followOutputBehavior:z,shouldFollow:O,totalCount:w}}),W(({shouldFollow:w})=>w)),({followOutputBehavior:w,totalCount:L})=>{x!==null&&(x(),x=null),et(n)===void 0?x=kt(t,()=>{et(d)("following output to ",{totalCount:L},ht.DEBUG),T(w),x=null}):requestAnimationFrame(()=>{et(d)("following output to ",{totalCount:L},ht.DEBUG),T(w)})});function c(w){const L=kt(r,P=>{w&&!P.atBottom&&P.notAtBottomBecause==="SIZE_INCREASED"&&x===null&&(et(d)("scrolling to bottom due to increased size",{},ht.DEBUG),T("auto"))});setTimeout(L,100)}Z(v(dt(G(S),e,f),W(([w,,L])=>w!==!1&&L),Et(({value:w},[,L])=>({refreshed:w===L,value:L}),{refreshed:!1,value:0}),W(({refreshed:w})=>w),N(S,e)),([,w])=>{et(l)&&c(w!==!1)}),Z(R,()=>{c(et(S)!==!1)}),Z(dt(G(S),r),([w,L])=>{w!==!1&&!L.atBottom&&L.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&T("auto")});const C=y(null),I=U();return B(we(v(G(o),k(w=>w?.length??0)),v(G(e))),I),Z(v(dt(v(I,Ut(1)),u),N(G(C),l,g,h),k(([[w,L],P,a,p,b])=>L&&a&&P?.({context:b,totalCount:w,scrollingInProgress:p})),W(w=>!!w),Mt(0)),w=>{x!==null&&(x(),x=null),et(n)===void 0?x=kt(t,()=>{et(d)("scrolling into view",{}),j(m,w),x=null}):requestAnimationFrame(()=>{et(d)("scrolling into view",{}),j(m,w)})}),{autoscrollToBottom:R,followOutput:S,scrollIntoViewOnChange:C}},st(Vt,pe,me,he,At,Pt,xt,ro,so)),er=q(([{data:t,firstItemIndex:e,gap:n,sizes:o},{initialTopMostItemIndex:r},{initialItemCount:s,listState:i},{didMount:l}])=>(B(v(l,N(s),W(([,u])=>u!==0),N(r,o,e,n,t),k(([[,u],f,d,g,h,m])=>no(u,f,d,g,h,m))),i),{}),st(Vt,he,Kt,At),{singleton:!0}),nr=q(([{didMount:t},{scrollTo:e},{listState:n}])=>{const o=y(0);return Z(v(t,N(o),W(([,r])=>r!==0),k(([,r])=>({top:r}))),r=>{kt(v(n,Ut(1),W(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{j(e,r)})})}),{initialScrollTop:o}},st(At,xt,Kt),{singleton:!0}),io=q(([{scrollVelocity:t}])=>{const e=y(!1),n=U(),o=y(!1);return B(v(t,N(o,e,n),W(([r,s])=>s!==!1&&s!==void 0),k(([r,s,i,l])=>{const{enter:u,exit:f}=s;if(i){if(f(r,l))return!1}else if(u(r,l))return!0;return i}),ot()),e),Z(v(dt(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(pe),{singleton:!0}),Qe=q(([{scrollBy:t,scrollContainerState:e,scrollTo:n}])=>{const o=U(),r=U(),s=U(),i=U(),l=y(!1),u=y(void 0),f=gt(v(r,k(({zoomRatio:d})=>d??1)),1);return B(v(dt(o,r),k(([{scrollTop:d,viewportHeight:g},{listHeight:h,offsetTop:m,zoomRatio:S=1}])=>({scrollHeight:h,scrollTop:Math.max(0,Ht(d-m,S)),viewportHeight:Ht(g,S)}))),e),B(v(n,N(r),k(([d,{offsetTop:g,zoomRatio:h=1}])=>({...d,top:Ht(d.top,1/h)+g}))),s),B(v(t,N(f),k(([d,g])=>d.top===void 0?d:{...d,top:Ht(d.top,1/g)})),i),{customScrollParent:u,useWindowScroll:l,windowScrollContainerState:o,windowScrollBy:i,windowScrollTo:s,windowViewportRect:r}},st(xt)),or=q(([{sizeRanges:t,sizes:e},{headerHeight:n,scrollTop:o},{initialTopMostItemIndex:r},{didMount:s},{useWindowScroll:i,windowScrollContainerState:l,windowViewportRect:u}])=>{const f=U(),d=y(void 0),g=y(null),h=y(null);return B(l,g),B(u,h),Z(v(f,N(e,o,i,g,h,n)),([m,S,R,x,T,c,C])=>{const I=Ao(S.sizeTree);x&&T!==null&&c!==null&&(R=Ht(T.scrollTop-c.offsetTop,c.zoomRatio??1)),R-=C,m({ranges:I,scrollTop:R})}),B(v(d,W(De),k(rr)),r),B(v(s,N(d),W(([,m])=>m!==void 0),ot(),k(([,m])=>m.ranges)),t),{getState:f,restoreStateFrom:d}},st(Vt,xt,he,At,Qe));function rr(t){return{align:"start",index:0,offset:t.scrollTop}}const sr=q(([{topItemsIndexes:t}])=>{const e=y(0);return B(v(e,W(n=>n>=0),k(n=>Array.from({length:n}).map((o,r)=>r))),t),{topItemCount:e}},st(Kt));function lo(t){let e=!1,n;return(()=>(e||(e=!0,n=t()),n))}const ir=lo(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),lr=q(([{deviation:t,deviationCommitted:e,scrollBy:n,scrollingInProgress:o,scrollTop:r},{isAtBottom:s,isScrolling:i,lastJumpDueToItemResize:l,scrollDirection:u},{listState:f},{beforeUnshiftWith:d,gap:g,shiftWithOffset:h,sizes:m},{log:S},{recalcInProgress:R}])=>{const x=Ct(v(f,N(l),Et(([,I,w,L],[{bottom:P,items:a,offsetBottom:p,totalCount:b},O])=>{const z=P+p;let F=0;return w===b&&I.length>0&&a.length>0&&(a[0].originalIndex===0&&I[0].originalIndex===0||(F=z-L,F!==0&&(F+=O))),[F,a,b,z]},[0,[],0,0]),W(([I])=>I!==0),N(r,u,o,s,S,R),W(([,I,w,L,,,P])=>!P&&!L&&I!==0&&w===ae),k(([[I],,,,,w])=>(w("Upward scrolling compensation",{amount:I},ht.DEBUG),I))));function T(I){I>0?(j(n,{behavior:"auto",top:-I}),j(t,0)):(j(t,0),j(n,{behavior:"auto",top:-I}))}Z(v(x,N(t,i)),([I,w,L])=>{L&&ir()?j(t,w-I):T(-I)}),Z(v(dt(gt(i,!1),t,R),W(([I,w,L])=>!I&&!L&&w!==0),k(([I,w])=>w),Mt(1)),T),B(v(h,k(I=>({top:-I}))),n);let c=null;function C(){if(c===null)return;const{offset:I}=c;c=null,j(n,{top:I}),requestAnimationFrame(()=>{j(t,0),j(R,!1)})}return Z(e,I=>{c===null||!c.acknowledgeable||I===c.offset&&C()}),Z(v(d,N(m,g),k(([I,{groupIndices:w,lastSize:L,sizeTree:P},a])=>{function p(_){return _*(L+a)}if(w.length===0)return p(I);let b=0;const O=ce(P,0);let z=0,F=0;for(;z<I;){z++,b+=O;let _=w.length===F+1?1/0:w[F+1]-w[F]-1;z+_>I&&(b-=O,_=I-z+1),z+=_,b+=p(_),F++}return b})),I=>{c={acknowledgeable:et(t)!==I,offset:I},j(t,I),requestAnimationFrame(C)}),{deviation:t}},st(xt,pe,Kt,Vt,Pt,qe)),cr=q(([t,e,n,o,r,s,i,l,u,f,d])=>({...t,...e,...n,...o,...r,...s,...i,...l,...u,...f,...d}),st(Je,er,At,io,oo,nr,Xo,Qe,so,Pt,ro)),co=q(([{data:t,defaultItemSize:e,firstItemIndex:n,fixedItemSize:o,fixedGroupSize:r,gap:s,groupIndices:i,heightEstimates:l,itemSize:u,sizeRanges:f,sizes:d,statefulTotalCount:g,totalCount:h,trackItemSizes:m},{initialItemFinalLocationReached:S,initialTopMostItemIndex:R,scrolledToInitialItem:x},T,c,C,I,{scrollToIndex:w},L,{topItemCount:P},{groupCounts:a},p])=>{const{listState:b,minOverscanItemCount:O,topItemsIndexes:z,rangeChanged:F,..._}=I;return B(F,p.scrollSeekRangeChanged),B(v(dt(p.windowViewportRect,T.headerHeight,T.fixedHeaderHeight),k(([X,V,ft])=>Math.max(V+ft+1,X.visibleHeight))),T.viewportHeight),{data:t,defaultItemHeight:e,firstItemIndex:n,fixedItemHeight:o,fixedGroupHeight:r,gap:s,groupCounts:a,heightEstimates:l,initialItemFinalLocationReached:S,initialTopMostItemIndex:R,scrolledToInitialItem:x,sizeRanges:f,topItemCount:P,topItemsIndexes:z,totalCount:h,...C,groupIndices:i,itemSize:u,listState:b,minOverscanItemCount:O,scrollToIndex:w,statefulTotalCount:g,trackItemSizes:m,rangeChanged:F,..._,...p,...T,sizes:d,...c}},st(Vt,he,xt,or,tr,Kt,me,lr,sr,Qn,cr));function ur(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 Se=typeof document>"u"?H.useEffect:H.useLayoutEffect;function tn(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=H.createContext({});function u(T,c){T.propsReady!==void 0&&j(T.propsReady,!1);for(const C of o){const I=T[e.required[C]];j(I,c[C])}for(const C of r)if(C in c){const I=T[e.optional[C]];j(I,c[C])}T.propsReady!==void 0&&j(T.propsReady,!0)}function f(T){return s.reduce((c,C)=>(c[C]=I=>{const w=T[e.methods[C]];j(w,I)},c),{})}function d(T){return i.reduce((c,C)=>(c[C]=bo(T[e.events[C]]),c),{})}const g=H.forwardRef(function(c,C){const{children:I,...w}=c,[L]=H.useState(()=>He(Eo(t),p=>{u(p,w)})),[P]=H.useState(xn(d,L));Se(()=>{for(const p of i)p in w&&Z(P[p],w[p]);return()=>{Object.values(P).map($e)}},[w,P,L]),Se(()=>{u(L,w)}),H.useImperativeHandle(C,gn(f(L)));const a=n;return M.jsx(l.Provider,{value:L,children:n===void 0?I:M.jsx(a,{...ur([...o,...r,...i],w),children:I})})}),h=T=>{const c=H.useContext(l);return H.useCallback(C=>{j(c[T],C)},[c,T])},m=T=>{const C=H.useContext(l)[T],I=H.useCallback(w=>Z(C,w),[C]);return H.useSyncExternalStore(I,()=>et(C),()=>et(C))},S=T=>{const C=H.useContext(l)[T],[I,w]=H.useState(xn(et,C));return Se(()=>Z(C,L=>{L!==I&&w(gn(L))}),[C,I]),I},R=parseInt(H.version,10)>=18?m:S;return{Component:g,useEmitter:(T,c)=>{const I=H.useContext(l)[T];Se(()=>Z(I,c),[c,I])},useEmitterValue:R,usePublisher:h}}const Qt=H.createContext(void 0),en=H.createContext(void 0),Fe="-webkit-sticky",Ln="sticky",nn=lo(()=>{if(typeof document>"u")return Ln;const t=document.createElement("div");return t.style.position=Fe,t.style.position===Fe?Fe:Ln});function Ve(t){return"self"in t}function ar(t){return"body"in t}function uo(t,e,n,o=Jt,r,s){const i=H.useRef(null),l=H.useRef(null),u=H.useRef(null),f=H.useCallback(h=>{let m,S,R;const x=h.target;if(ar(x)||Ve(x)){const c=Ve(x)?x:x.defaultView;R=s===!0?Nt(c,c.scrollX):c.scrollY,m=s===!0?c.document.documentElement.scrollWidth:c.document.documentElement.scrollHeight,S=s===!0?c.innerWidth:c.innerHeight}else R=s===!0?Nt(x,x.scrollLeft):x.scrollTop,m=s===!0?x.scrollWidth:x.scrollHeight,S=s===!0?x.offsetWidth:x.offsetHeight;const T=()=>{t({scrollHeight:m,scrollTop:Math.max(R,0),viewportHeight:S})};h.suppressFlushSync===!0?T():So.flushSync(T),l.current!==null&&(Math.abs(R-l.current)<1||R<=0||R===m-S)&&(l.current=null,e(!0),u.current&&(clearTimeout(u.current),u.current=null))},[t,e,s]);H.useEffect(()=>{const h=r??i.current;return o(r??i.current),f({suppressFlushSync:!0,target:h}),h.addEventListener("scroll",f,{passive:!0}),()=>{o(null),h.removeEventListener("scroll",f)}},[i,f,n,o,r]);function d(h){const m=i.current;if(!m||(s===!0?"offsetWidth"in m&&m.offsetWidth===0:"offsetHeight"in m&&m.offsetHeight===0))return;const S=h.behavior==="smooth";let R,x,T;Ve(m)?(x=Math.max(Lt(m.document.documentElement,s===!0?"width":"height"),s===!0?m.document.documentElement.scrollWidth:m.document.documentElement.scrollHeight),R=s===!0?m.innerWidth:m.innerHeight,T=s===!0?Nt(m,m.scrollX):m.scrollY):(x=m[s===!0?"scrollWidth":"scrollHeight"],R=Lt(m,s===!0?"width":"height",m),T=s===!0?Nt(m,m.scrollLeft):m.scrollTop);const c=x-R;if(h.top===void 0){m.scrollTo(h);return}const C=Math.ceil(Math.max(Math.min(c,h.top),0));if(h.top=C,eo(R,x)||C===T){t({scrollHeight:x,scrollTop:T,viewportHeight:R}),S&&e(!0);return}S?(l.current=C,u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{u.current=null,l.current=null,e(!0)},1e3)):l.current=null,s===!0&&(h={...h.behavior===void 0?{}:{behavior:h.behavior},left:Sn(m,C)}),m.scrollTo(h)}return{scrollByCallback:H.useCallback(h=>{s===!0&&(h={...h.behavior===void 0?{}:{behavior:h.behavior},...h.top===void 0?{}:{left:Sn(i.current,h.top)}}),i.current.scrollBy(h)},[s]),scrollerRef:i,scrollToCallback:d}}function on(t){return t}const dr=q(()=>{const t=y(l=>`Item ${l}`),e=y(l=>`Group ${l}`),n=y({}),o=y(on),r=y("div"),s=y(Jt),i=(l,u=null)=>gt(v(n,k(f=>f[l]),ot()),u);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")}}),fr=q(([t,e])=>({...t,...e}),st(co,dr)),mr=({height:t})=>M.jsx("div",{style:{height:t}}),hr={overflowAnchor:"none",position:nn(),zIndex:1},ao={overflowAnchor:"none"},pr={...ao,display:"inline-block",height:"100%"},On=H.memo(function({showTopList:e=!1}){const n=A("listState"),o=Tt("sizeRanges"),r=A("useWindowScroll"),s=A("customScrollParent"),i=Tt("windowScrollContainerState"),l=Tt("scrollContainerState"),u=s||r?i:l,f=A("itemContent"),d=A("context"),g=A("groupContent"),h=A("trackItemSizes"),m=A("itemSize"),S=A("log"),R=Tt("gap"),x=A("horizontalDirection"),{callbackRef:T}=Nn(o,m,h,e?Jt:u,S,R,s,x,A("skipAnimationFrameInResizeObserver")),[c,C]=H.useState(0);cn("deviation",V=>{c!==V&&C(V)});const I=Tt("deviationCommitted");Ee(()=>{I(c)},[c,I]);const w=A("EmptyPlaceholder"),L=A("ScrollSeekPlaceholder")??mr,P=A("ListComponent"),a=A("ItemComponent"),p=A("GroupComponent"),b=A("computeItemKey"),O=A("isSeeking"),z=A("groupIndices").length>0,F=A("alignToBottom"),_=A("initialItemFinalLocationReached"),X=e?{}:{boxSizing:"border-box",...x?{display:"inline-block",height:"100%",marginInlineStart:c===0?F?"auto":0:c,paddingInlineEnd:n.offsetBottom,paddingInlineStart:n.offsetTop,whiteSpace:"nowrap"}:{marginTop:c===0?F?"auto":0:c,paddingBottom:n.offsetBottom,paddingTop:n.offsetTop},..._?{}:{visibility:"hidden"}};return!e&&n.totalCount===0&&w!==null&&w!==void 0?M.jsx(w,{...rt(w,d)}):M.jsx(P,{...rt(P,d),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:T,style:X,children:(e?n.topItems:n.items).map(V=>{const ft=V.originalIndex,Y=b(ft+n.firstItemIndex,V.data,d);return O?H.createElement(L,{...rt(L,d),height:V.size,index:V.index,key:Y,type:V.type||"item",...V.type==="group"?{}:{groupIndex:V.groupIndex}}):V.type==="group"?H.createElement(p,{...rt(p,d),"data-index":ft,"data-item-index":V.index,"data-known-size":V.size,key:Y,style:hr},g(V.index,d)):H.createElement(a,{...rt(a,d),...fo(a,V.data),"data-index":ft,"data-item-group-index":V.groupIndex,"data-item-index":V.index,"data-known-size":V.size,key:Y,style:x?pr:ao},z?f(V.index,V.groupIndex,V.data,d):f(V.index,V.data,d))})})}),gr={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},xr={outline:"none",overflowX:"auto",position:"relative"},Le=t=>({height:"100%",position:"absolute",top:0,width:"100%",...t?{display:"flex",flexDirection:"column"}:void 0}),rn=(t,e,n=0)=>({...Le(t),position:e?"relative":"absolute",top:e?-n:0}),Ir={position:nn(),top:0,width:"100%",zIndex:1};function rt(t,e){if(typeof t!="string")return{context:e}}function fo(t,e){return{item:typeof t=="string"?void 0:e}}const Sr=H.memo(function(){const e=A("HeaderComponent"),n=Tt("headerHeight"),o=A("HeaderFooterTag"),r=Ft(H.useMemo(()=>i=>{n(Lt(i,"height"))},[n]),!0,A("skipAnimationFrameInResizeObserver")),s=A("context");return e!=null?M.jsx(o,{ref:r,children:M.jsx(e,{...rt(e,s)})}):null}),vr=H.memo(function(){const e=A("FooterComponent"),n=Tt("footerHeight"),o=A("HeaderFooterTag"),r=Ft(H.useMemo(()=>i=>{n(Lt(i,"height"))},[n]),!0,A("skipAnimationFrameInResizeObserver")),s=A("context");return e!=null?M.jsx(o,{ref:r,children:M.jsx(e,{...rt(e,s)})}):null});function sn({useEmitter:t,useEmitterValue:e,usePublisher:n}){return H.memo(function({children:s,style:i,context:l,...u}){const f=n("scrollContainerState"),d=e("ScrollerComponent"),g=n("smoothScrollTargetReached"),h=e("scrollerRef"),m=e("horizontalDirection")||!1,{scrollByCallback:S,scrollerRef:R,scrollToCallback:x}=uo(f,g,d,h,void 0,m),T=H.useContext(Qt),c=H.useRef(0),C=H.useCallback(L=>{c.current=L},[]);t("totalListHeight",C);const I=H.useCallback(L=>{if(!T||L.top===void 0)return;const P=Math.max(c.current,T.viewportHeight),a=Math.ceil(Math.max(Math.min(P-T.viewportHeight,L.top),0));f({scrollHeight:P,scrollTop:a,viewportHeight:T.viewportHeight}),L.behavior==="smooth"&&g(!0)},[T,f,g]);t("scrollTo",T?I:x),t("scrollBy",S);const w=m?xr:gr;return M.jsx(d,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:R,style:{...w,...i},tabIndex:0,...u,...rt(d,l),children:s})})}function ln({useEmitter:t,useEmitterValue:e,usePublisher:n}){return H.memo(function({children:s,style:i,context:l,...u}){const f=n("windowScrollContainerState"),d=e("ScrollerComponent"),g=n("smoothScrollTargetReached"),h=e("totalListHeight"),m=e("deviation"),S=e("customScrollParent"),R=H.useRef(null),x=e("scrollerRef"),{scrollByCallback:T,scrollerRef:c,scrollToCallback:C}=uo(f,g,d,x,S);return Ee(()=>(c.current=S??R.current?.ownerDocument.defaultView,()=>{c.current=null}),[c,S]),t("windowScrollTo",C),t("windowScrollBy",T),M.jsx(d,{ref:R,"data-virtuoso-scroller":!0,style:{position:"relative",...i,...h===0?void 0:{height:h+m}},...u,...rt(d,l),children:s})})}const Tr=({children:t})=>{const e=H.useContext(Qt),n=Tt("viewportHeight"),o=Tt("fixedItemHeight"),r=A("alignToBottom"),s=A("horizontalDirection"),i=H.useMemo(()=>se(n,u=>Lt(u,s?"width":"height")),[n,s]),l=Ft(i,!0,A("skipAnimationFrameInResizeObserver"));return H.useEffect(()=>{e&&(n(e.viewportHeight),o(e.itemHeight))},[e,n,o]),M.jsx("div",{"data-viewport-type":"element",ref:l,style:Le(r),children:t})},Cr=({children:t})=>{const e=H.useContext(Qt),n=Tt("windowViewportRect"),o=Tt("fixedItemHeight"),r=A("customScrollParent"),s=A("useWindowScroll"),i=A("topListHeight"),l=Ke(n,r,A("skipAnimationFrameInResizeObserver")),u=A("alignToBottom");return H.useEffect(()=>{e&&(o(e.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:e.viewportHeight,visibleWidth:100}))},[e,n,o]),M.jsx("div",{"data-viewport-type":"window",ref:l,style:rn(u,s,i),children:t})},wr=({children:t})=>{const e=A("TopItemListComponent")??"div",n=A("headerHeight"),o={...Ir,marginTop:`${n}px`},r=A("context");return M.jsx(e,{style:o,...rt(e,r),children:t})},yr=H.memo(function(e){const n=A("useWindowScroll"),o=A("topItemsIndexes").length>0,r=A("customScrollParent"),s=A("context"),i=r||n?Rr:br,l=r||n?Cr:Tr;return M.jsxs(i,{...e,context:s,children:[o&&M.jsx(wr,{children:M.jsx(On,{showTopList:!0})}),M.jsxs(l,{children:[M.jsx(Sr,{}),M.jsx(On,{}),M.jsx(vr,{})]})]})}),{Component:mo,useEmitter:cn,useEmitterValue:A,usePublisher:Tt}=tn(fr,{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"}},yr),br=sn({useEmitter:cn,useEmitterValue:A,usePublisher:Tt}),Rr=ln({useEmitter:cn,useEmitterValue:A,usePublisher:Tt}),Hr=mo,Er=mo,kr=q(()=>{const t=y(f=>M.jsxs("td",{children:["Item $",f]})),e=y(null),n=y(f=>M.jsxs("td",{colSpan:1e3,children:["Group ",f]})),o=y(null),r=y(null),s=y({}),i=y(on),l=y(Jt),u=(f,d=null)=>gt(v(s,k(g=>g[f]),ot()),d);return{components:s,computeItemKey:i,context:e,EmptyPlaceholder:u("EmptyPlaceholder"),FillerRow:u("FillerRow"),fixedFooterContent:r,fixedHeaderContent:o,itemContent:t,groupContent:n,ScrollerComponent:u("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:u("ScrollSeekPlaceholder"),TableBodyComponent:u("TableBody","tbody"),TableComponent:u("Table","table"),TableFooterComponent:u("TableFoot","tfoot"),TableHeadComponent:u("TableHead","thead"),TableRowComponent:u("TableRow","tr"),GroupComponent:u("Group","tr")}}),Lr=q(([t,e])=>({...t,...e}),st(co,kr)),Or=({height:t})=>M.jsx("tr",{children:M.jsx("td",{style:{height:t}})}),zr=({height:t})=>M.jsx("tr",{children:M.jsx("td",{style:{border:0,height:t,padding:0}})}),Br={overflowAnchor:"none"},zn={position:nn(),zIndex:2,overflowAnchor:"none"},Bn=H.memo(function({showTopList:e=!1}){const n=$("listState"),o=$("computeItemKey"),r=$("firstItemIndex"),s=$("context"),i=$("isSeeking"),l=$("fixedHeaderHeight"),u=$("groupIndices").length>0,f=$("itemContent"),d=$("groupContent"),g=$("ScrollSeekPlaceholder")??Or,h=$("GroupComponent"),m=$("TableRowComponent"),S=(e?n.topItems:[]).reduce((x,T,c)=>(c===0?x.push(T.size):x.push(x[c-1]+T.size),x),[]);return(e?n.topItems:n.items).map(x=>{const T=x.originalIndex,c=o(T+r,x.data,s),C=e?T===0?0:S[T-1]:0;return i?H.createElement(g,{...rt(g,s),height:x.size,index:x.index,key:c,type:x.type||"item"}):x.type==="group"?H.createElement(h,{...rt(h,s),"data-index":T,"data-item-index":x.index,"data-known-size":x.size,key:c,style:{...zn,top:l}},d(x.index,s)):H.createElement(m,{...rt(m,s),...fo(m,x.data),"data-index":T,"data-item-index":x.index,"data-known-size":x.size,"data-item-group-index":x.groupIndex,key:c,style:e?{...zn,top:l+C}:Br},u?f(x.index,x.groupIndex,x.data,s):f(x.index,x.data,s))})}),Fr=H.memo(function(){const e=$("listState"),n=$("topItemsIndexes").length>0,o=yt("sizeRanges"),r=$("useWindowScroll"),s=$("customScrollParent"),i=yt("windowScrollContainerState"),l=yt("scrollContainerState"),u=s||r?i:l,f=$("trackItemSizes"),d=$("itemSize"),g=$("log"),{callbackRef:h,ref:m}=Nn(o,d,f,u,g,void 0,s,!1,$("skipAnimationFrameInResizeObserver")),[S,R]=H.useState(0);un("deviation",z=>{S!==z&&(m.current.style.marginTop=`${z}px`,R(z))});const x=yt("deviationCommitted");Ee(()=>{x(S)},[S,x]);const T=$("EmptyPlaceholder"),c=$("FillerRow")??zr,C=$("TableBodyComponent"),I=$("paddingTopAddition"),w=$("statefulTotalCount"),L=$("context");if(w===0&&T!==null&&T!==void 0)return M.jsx(T,{...rt(T,L)});const P=(n?e.topItems:[]).reduce((z,F)=>z+F.size,0),a=e.offsetTop+I+S-P,p=e.offsetBottom,b=a>0?M.jsx(c,{context:L,height:a},"padding-top"):null,O=p>0?M.jsx(c,{context:L,height:p},"padding-bottom"):null;return M.jsxs(C,{"data-testid":"virtuoso-item-list",ref:h,...rt(C,L),children:[b,n&&M.jsx(Bn,{showTopList:!0}),M.jsx(Bn,{}),O]})}),Vr=({children:t})=>{const e=H.useContext(Qt),n=yt("viewportHeight"),o=yt("fixedItemHeight"),r=Ft(H.useMemo(()=>se(n,s=>Lt(s,"height")),[n]),!0,$("skipAnimationFrameInResizeObserver"));return H.useEffect(()=>{e&&(n(e.viewportHeight),o(e.itemHeight))},[e,n,o]),M.jsx("div",{"data-viewport-type":"element",ref:r,style:Le(!1),children:t})},Mr=({children:t})=>{const e=H.useContext(Qt),n=yt("windowViewportRect"),o=yt("fixedItemHeight"),r=$("customScrollParent"),s=$("useWindowScroll"),i=Ke(n,r,$("skipAnimationFrameInResizeObserver"));return H.useEffect(()=>{e&&(o(e.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:e.viewportHeight,visibleWidth:100}))},[e,n,o]),M.jsx("div",{"data-viewport-type":"window",ref:i,style:rn(!1,s),children:t})},Wr=H.memo(function(e){const n=$("useWindowScroll"),o=$("customScrollParent"),r=yt("fixedHeaderHeight"),s=yt("fixedFooterHeight"),i=$("fixedHeaderContent"),l=$("fixedFooterContent"),u=$("context"),f=Ft(H.useMemo(()=>se(r,c=>Lt(c,"height")),[r]),!0,$("skipAnimationFrameInResizeObserver")),d=Ft(H.useMemo(()=>se(s,c=>Lt(c,"height")),[s]),!0,$("skipAnimationFrameInResizeObserver")),g=o||n?Pr:Gr,h=o||n?Mr:Vr,m=$("TableComponent"),S=$("TableHeadComponent"),R=$("TableFooterComponent"),x=i?M.jsx(S,{ref:f,style:{position:"sticky",top:0,zIndex:2},...rt(S,u),children:i()},"TableHead"):null,T=l?M.jsx(R,{ref:d,style:{bottom:0,position:"sticky",zIndex:1},...rt(R,u),children:l()},"TableFoot"):null;return M.jsx(g,{...e,...rt(g,u),children:M.jsx(h,{children:M.jsxs(m,{style:{borderSpacing:0,overflowAnchor:"none"},...rt(m,u),children:[x,M.jsx(Fr,{},"TableBody"),T]})})})}),{Component:ho,useEmitter:un,useEmitterValue:$,usePublisher:yt}=tn(Lr,{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"}},Wr),Gr=sn({useEmitter:un,useEmitterValue:$,usePublisher:yt}),Pr=ln({useEmitter:un,useEmitterValue:$,usePublisher:yt}),Ar=ho,jr=ho,Fn={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},_r={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Vn,floor:be,max:re,min:Me,round:Mn}=Math;function Wn(t,e,n){return Array.from({length:e-t+1}).map((o,r)=>({data:n===null?null:n[r+t],index:r+t}))}function Nr(t){return{..._r,items:t}}function ve(t,e){return t!==void 0&&t.width===e.width&&t.height===e.height}function Dr(t,e){return t!==void 0&&t.column===e.column&&t.row===e.row}const $r=q(([{increaseViewportBy:t,listBoundary:e,overscan:n,visibleRange:o},{footerHeight:r,headerHeight:s,scrollBy:i,scrollContainerState:l,scrollTo:u,scrollTop:f,smoothScrollTargetReached:d,viewportHeight:g},h,m,{didMount:S,propsReady:R},{customScrollParent:x,useWindowScroll:T,windowScrollBy:c,windowScrollContainerState:C,windowScrollTo:I,windowViewportRect:w},L])=>{const P=y(0),a=y(0),p=y(Fn),b=y({height:0,width:0}),O=y({height:0,width:0}),z=U(),F=U(),_=y(0),X=y(null),V=y({column:0,row:0}),ft=U(),Y=U(),it=y(!1),ct=y(0),mt=y(!0),zt=y(!1),Rt=y(!1);Z(v(S,N(ct),W(([E,D])=>!_e(D))),()=>{j(mt,!1)}),Z(v(dt(S,mt,O,b,ct,zt),W(([E,D,K,lt,,tt])=>E&&!D&&K.height!==0&&lt.height!==0&&!tt)),([,,,,E])=>{if(E===void 0){j(mt,!0);return}j(zt,!0),Ze(1,()=>{j(z,E)}),kt(v(f),()=>{j(e,[0,0]),j(mt,!0)})}),B(v(Y,W(E=>E!=null&&E.scrollTop>0),vt(0)),a),Z(v(S,N(Y),W(([,E])=>E!=null)),([,E])=>{E&&(j(b,E.viewport),j(O,E.item),j(V,E.gap),E.scrollTop>0&&(j(it,!0),kt(v(f,Ut(1)),D=>{j(it,!1)}),j(u,{top:E.scrollTop})))}),B(v(b,k(({height:E})=>E)),g),B(v(dt(G(b,ve),G(O,ve),G(V,(E,D)=>E!==void 0&&E.column===D.column&&E.row===D.row),G(f)),k(([E,D,K,lt])=>({gap:K,item:D,scrollTop:lt,viewport:E}))),ft),B(v(dt(G(P),o,G(V,Dr),G(O,ve),G(b,ve),G(X),G(a),G(it),G(mt),G(ct)),W(([,,,,,,,E])=>!E),k(([E,[D,K],lt,tt,Q,ut,It,,at,jt])=>{const{column:Wt,row:ne}=lt,{height:xe,width:Oe}=tt,{width:an}=Q;if(It===0&&(E===0||an===0))return Fn;if(Oe===0){const pn=Xe(jt,E),Io=pn+Math.max(It-1,0);return Nr(Wn(pn,Io,ut))}const Ie=po(an,Oe,Wt);let qt,_t;at?D===0&&K===0&&It>0?(qt=0,_t=It-1):(qt=Ie*be((D+ne)/(xe+ne)),_t=Ie*Vn((K+ne)/(xe+ne))-1,_t=Me(E-1,re(_t,Ie-1)),qt=Me(_t,re(0,qt))):(qt=0,_t=-1);const dn=Wn(qt,_t,ut),{bottom:fn,top:mn}=Gn(Q,lt,tt,dn),hn=Vn(E/Ie),xo=hn*xe+(hn-1)*ne-fn;return{bottom:fn,itemHeight:xe,items:dn,itemWidth:Oe,offsetBottom:xo,offsetTop:mn,top:mn}})),p),B(v(X,W(E=>E!==null),k(E=>E.length)),P),B(v(dt(b,O,p,V),W(([E,D,{items:K}])=>K.length>0&&D.height!==0&&E.height!==0),k(([E,D,{items:K},lt])=>{const{bottom:tt,top:Q}=Gn(E,lt,D,K);return[Q,tt]}),ot(Zt)),e);const wt=y(!1);B(v(f,N(wt),k(([E,D])=>D||E!==0)),wt);const ge=Ct(v(dt(p,P),W(([{items:E},D])=>{const K=et(X);return E.length>0&&(K===null||K.length===D)}),N(wt),W(([[E,D],K])=>{const tt=E.items[E.items.length-1].index===D-1;return(K||E.bottom>0&&E.itemHeight>0&&E.offsetBottom===0&&E.items.length===D)&&tt}),k(([[,E]])=>[E-1,et(X)]),ot(Zt),k(([E])=>E))),te=Ct(v(G(p),W(({items:E})=>E.length>0&&E[0].index===0),vt(0),ot())),Bt=Ct(v(G(p),N(it),W(([{items:E},D])=>E.length>0&&!D),k(([{items:E}])=>({endIndex:E[E.length-1].index,startIndex:E[0].index})),ot(Yn),Mt(0)));B(Bt,m.scrollSeekRangeChanged),B(v(z,N(b,O,P,V),k(([E,D,K,lt,tt])=>{const Q=to(E),{align:ut,behavior:It,offset:at}=Q;let jt=Q.index;jt==="LAST"&&(jt=lt-1),jt=re(0,Me(lt-1,jt));let Wt=Ne(D,tt,K,jt);return ut==="end"?Wt=Mn(Wt-D.height+K.height):ut==="center"&&(Wt=Mn(Wt-D.height/2+K.height/2)),at!==void 0&&at!==0&&(Wt+=at),{behavior:It,top:Wt}})),u);const ee=gt(v(p,k(E=>E.offsetBottom+E.bottom)),0);return B(v(w,k(E=>({height:E.visibleHeight,width:E.visibleWidth}))),b),{customScrollParent:x,data:X,deviation:_,footerHeight:r,gap:V,headerHeight:s,increaseViewportBy:t,initialItemCount:a,itemDimensions:O,overscan:n,restoreStateFrom:Y,scrollBy:i,scrollContainerState:l,scrollHeight:F,scrollTo:u,scrollToIndex:z,scrollTop:f,smoothScrollTargetReached:d,totalCount:P,useWindowScroll:T,viewportDimensions:b,windowScrollBy:c,windowScrollContainerState:C,windowScrollTo:I,windowViewportRect:w,...m,gridState:p,horizontalDirection:Rt,initialTopMostItemIndex:ct,totalListHeight:ee,...h,endReached:ge,propsReady:R,rangeChanged:Bt,startReached:te,stateChanged:ft,stateRestoreInProgress:it,...L}},st(Je,xt,pe,io,At,Qe,Pt));function po(t,e,n){return re(1,be((t+n)/(be(e)+n)))}function Gn(t,e,n,o){const{height:r}=n;if(r===void 0||o.length===0)return{bottom:0,top:0};const s=Ne(t,e,n,o[0].index);return{bottom:Ne(t,e,n,o[o.length-1].index)+r,top:s}}function Ne(t,e,n,o){const r=po(t.width,n.width,e.column),s=be(o/r),i=s*n.height+re(0,s-1)*e.row;return i>0?i+e.row:i}const Ur=q(()=>{const t=y(g=>`Item ${g}`),e=y({}),n=y(null),o=y("virtuoso-grid-item"),r=y("virtuoso-grid-list"),s=y(on),i=y("div"),l=y(Jt),u=(g,h=null)=>gt(v(e,k(m=>m[g]),ot()),h),f=y(!1),d=y(!1);return B(G(d),f),{components:e,computeItemKey:s,context:n,FooterComponent:u("Footer"),HeaderComponent:u("Header"),headerFooterTag:i,itemClassName:o,ItemComponent:u("Item","div"),itemContent:t,listClassName:r,ListComponent:u("List","div"),readyStateChanged:f,reportReadyState:d,ScrollerComponent:u("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:u("ScrollSeekPlaceholder","div")}}),Kr=q(([t,e])=>({...t,...e}),st($r,Ur)),qr=H.memo(function(){const e=nt("gridState"),n=nt("listClassName"),o=nt("itemClassName"),r=nt("itemContent"),s=nt("computeItemKey"),i=nt("isSeeking"),l=bt("scrollHeight"),u=nt("ItemComponent"),f=nt("ListComponent"),d=nt("ScrollSeekPlaceholder"),g=nt("context"),h=bt("itemDimensions"),m=bt("gap"),S=nt("log"),R=nt("stateRestoreInProgress"),x=bt("reportReadyState"),T=Ft(H.useMemo(()=>c=>{const C=c.parentElement.parentElement.scrollHeight;l(C);const I=c.firstChild;I!==null&&h({height:ie(I,"height"),width:ie(I,"width")}),m({column:Pn("column-gap",getComputedStyle(c).columnGap,S),row:Pn("row-gap",getComputedStyle(c).rowGap,S)})},[l,h,m,S]),!0,!1);return Ee(()=>{e.itemHeight>0&&e.itemWidth>0&&x(!0)},[e]),R?null:M.jsx(f,{className:n,ref:T,...rt(f,g),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(c=>{const C=s(c.index,c.data,g);return i?M.jsx(d,{...rt(d,g),height:e.itemHeight,index:c.index,width:e.itemWidth},C):H.createElement(u,{...rt(u,g),className:o,"data-index":c.index,key:C},r(c.index,c.data,g))})})}),Yr=H.memo(function(){const e=nt("HeaderComponent"),n=bt("headerHeight"),o=nt("headerFooterTag"),r=Ft(H.useMemo(()=>i=>{n(Lt(i,"height"))},[n]),!0,!1),s=nt("context");return e!=null?M.jsx(o,{ref:r,children:M.jsx(e,{...rt(e,s)})}):null}),Zr=H.memo(function(){const e=nt("FooterComponent"),n=bt("footerHeight"),o=nt("headerFooterTag"),r=Ft(H.useMemo(()=>i=>{n(Lt(i,"height"))},[n]),!0,!1),s=nt("context");return e!=null?M.jsx(o,{ref:r,children:M.jsx(e,{...rt(e,s)})}):null}),Xr=({children:t})=>{const e=H.useContext(en),n=bt("itemDimensions"),o=bt("viewportDimensions"),r=Ft(H.useMemo(()=>s=>{o({height:ie(s,"height"),width:ie(s,"width")})},[o]),!0,!1);return H.useEffect(()=>{e&&(o({height:e.viewportHeight,width:e.viewportWidth}),n({height:e.itemHeight,width:e.itemWidth}))},[e,o,n]),M.jsx("div",{ref:r,style:Le(!1),children:t})},Jr=({children:t})=>{const e=H.useContext(en),n=bt("windowViewportRect"),o=bt("itemDimensions"),r=nt("customScrollParent"),s=nt("useWindowScroll"),i=Ke(n,r,!1);return H.useEffect(()=>{e&&(o({height:e.itemHeight,width:e.itemWidth}),n({listHeight:0,offsetTop:0,visibleHeight:e.viewportHeight,visibleWidth:e.viewportWidth}))},[e,n,o]),M.jsx("div",{ref:i,style:rn(!1,s),children:t})},Qr=H.memo(function({...e}){const n=nt("useWindowScroll"),o=nt("customScrollParent"),r=o||n?ns:es,s=o||n?Jr:Xr,i=nt("context");return M.jsx(r,{...e,...rt(r,i),children:M.jsxs(s,{children:[M.jsx(Yr,{}),M.jsx(qr,{}),M.jsx(Zr,{})]})})}),{Component:ts,useEmitter:go,useEmitterValue:nt,usePublisher:bt}=tn(Kr,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},Qr),es=sn({useEmitter:go,useEmitterValue:nt,usePublisher:bt}),ns=ln({useEmitter:go,useEmitterValue:nt,usePublisher:bt});function Pn(t,e,n){return e!=="normal"&&e?.endsWith("px")!==!0&&n(`${t} was not resolved to pixel value correctly`,e,ht.WARN),e==="normal"?0:parseInt(e??"0",10)}const os=ts;exports.GroupedTableVirtuoso=jr;exports.GroupedVirtuoso=Er;exports.LogLevel=ht;exports.TableVirtuoso=Ar;exports.Virtuoso=Hr;exports.VirtuosoGrid=os;exports.VirtuosoGridMockContext=en;exports.VirtuosoMockContext=Qt;
package/dist/index.d.ts CHANGED
@@ -1267,7 +1267,8 @@ export declare interface TableVirtuosoProps<Data, Context> extends Omit<Virtuoso
1267
1267
  /**
1268
1268
  * Allows customizing the height/width calculation of `Item` elements.
1269
1269
  *
1270
- * The default implementation reads `el.getBoundingClientRect().height` and `el.getBoundingClientRect().width`.
1270
+ * The default implementation reads `el.getBoundingClientRect().height` and `el.getBoundingClientRect().width`,
1271
+ * divided by the CSS `zoom` of the item's parent.
1271
1272
  */
1272
1273
  itemSize?: SizeFunction;
1273
1274
  /**
@@ -1856,7 +1857,8 @@ export declare interface VirtuosoProps<Data, Context> extends ListRootProps {
1856
1857
  /**
1857
1858
  * Allows customizing the height/width calculation of `Item` elements.
1858
1859
  *
1859
- * The default implementation reads `el.getBoundingClientRect().height` and `el.getBoundingClientRect().width`.
1860
+ * The default implementation reads `el.getBoundingClientRect().height` and `el.getBoundingClientRect().width`,
1861
+ * divided by the CSS `zoom` of the item's parent.
1860
1862
  */
1861
1863
  itemSize?: SizeFunction;
1862
1864
  /**
@@ -1937,14 +1939,19 @@ export declare interface VirtuosoProps<Data, Context> extends ListRootProps {
1937
1939
  * @group Common
1938
1940
  */
1939
1941
  export declare interface WindowViewportInfo {
1940
- /** The rendered height of the list container element in pixels */
1942
+ /** The rendered height of the list container element, in the list's CSS pixels */
1941
1943
  listHeight: number;
1942
- /** The offset from the top of the document to the list container in pixels */
1944
+ /** The offset from the top of the scrollable content to the list container, in the scroll container's CSS pixels */
1943
1945
  offsetTop: number;
1944
- /** The visible height of the window viewport in pixels */
1946
+ /** The visible height of the window viewport, in the list's CSS pixels */
1945
1947
  visibleHeight: number;
1946
- /** The visible width of the window viewport in pixels */
1948
+ /** The visible width of the window viewport, in the list's CSS pixels */
1947
1949
  visibleWidth: number;
1950
+ /**
1951
+ * The CSS zoom of the scroll container divided by the CSS zoom of the list, used to convert `offsetTop` and the scroll position
1952
+ * into the list's pixels. `1` unless CSS `zoom` is set between the scroll container and the list.
1953
+ */
1954
+ zoomRatio?: number;
1948
1955
  }
1949
1956
 
1950
1957
  export { }