react-virtuoso 4.12.7 → 4.12.8

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