react-virtuoso 4.12.3 → 4.12.5

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/README.md CHANGED
@@ -1,101 +1,8 @@
1
- <img src="https://user-images.githubusercontent.com/13347/101237112-ec4c6000-36de-11eb-936d-4b6b7ec94976.png" width="229" />
2
-
3
- [![npm version](https://img.shields.io/npm/v/react-virtuoso.svg?style=flat)](//badge.fury.io/js/react-virtuoso)
1
+ # React Virtuoso
4
2
 
5
3
  **React Virtuoso** - the most complete React virtualization rendering list/table/grid family of components.
6
4
 
7
- - Variable sized items out of the box; no manual measurements or hard-coding item heights is necessary;
8
- - [Chat message list UI](https://virtuoso.dev/virtuoso-message-list/) **NEW**;
9
- - [Grouped mode with sticky headers](https://virtuoso.dev/grouped-by-first-letter/);
10
- - [Responsive grid layout](https://virtuoso.dev/grid-responsive-columns/);
11
- - [Table Support](https://virtuoso.dev/hello-table/);
12
- - [Automatic handling of content resize](https://virtuoso.dev/auto-resizing/);
13
- - [Custom Header, Footer, and empty list components](https://virtuoso.dev/customize-structure/);
14
- - [Pinned top items](https://virtuoso.dev/top-items/);
15
- - [Endless scrolling](https://virtuoso.dev/endless-scrolling/), [press to load more](https://virtuoso.dev/press-to-load-more/);
16
- - [Initial top most item index](https://virtuoso.dev/initial-index/);
17
- - [Scroll to index method](https://virtuoso.dev/scroll-to-index/).
18
-
19
- For live examples and documentation, check the [documentation website](https://virtuoso.dev).
20
-
21
- ## Sponsors
22
-
23
- If you are using Virtuoso for work, [sponsor it](https://github.com/sponsors/petyosi). Any donation helps a lot with the project development and maintenance.
24
-
25
- ## Get Started
26
-
27
- ```sh
28
- npm install react-virtuoso
29
- ```
30
-
31
- ```jsx
32
- import * as React from 'react'
33
- import * as ReactDOM from 'react-dom'
34
- import { Virtuoso } from 'react-virtuoso'
35
-
36
- const App = () => {
37
- return <Virtuoso style={{ height: '400px' }} totalCount={200} itemContent={index => <div>Item {index}</div>} />
38
- }
39
-
40
- ReactDOM.render(<App />, document.getElementById('root'))
41
- ```
42
-
43
- ## [Message List](https://virtuoso.dev/virtuoso-message-list/)
44
-
45
- The Virtuoso message list component is built specifically for human/chatbot conversations. In addition to the virtualized rendering, the component exposes an imperative data management
46
- API that gives you the necessary control over the scroll position when older messages are loaded, new messages arrive, and when the user submits a message. The scroll position can update instantly or with a smooth scroll animation.
47
-
48
- ## [Grouped Mode](https://virtuoso.dev/grouped-by-first-letter/)
49
-
50
- The `GroupedVirtuoso` component is a variant of the "flat" `Virtuoso`, with the following differences:
51
-
52
- - Instead of `totalCount`, the component exposes `groupCounts: number[]` property, which specifies the amount of items in each group.
53
- For example, passing `[20, 30]` will render two groups with 20 and 30 items each;
54
- - In addition the `itemContent` property, the component requires an additional `groupContent` property,
55
- which renders the **group header**. The `groupContent` callback receives the zero-based group index as a parameter.
56
-
57
- ## [Grid](https://virtuoso.dev/grid-responsive-columns/)
58
-
59
- The `VirtuosoGrid` component displays **same sized items** in multiple columns.
60
- The layout and item sizing is controlled through CSS class properties, which allows you to use media queries, min-width, percentage, etc.
61
-
62
- ## [Table](https://virtuoso.dev/hello-table/)
63
-
64
- The `TableVirtuoso` component works just like `Virtuoso`, but with HTML tables.
65
- It supports window scrolling, sticky headers, sticky columns, and works with React Table and MUI Table.
66
-
67
- ## Works With Your UI Library of Choice
68
-
69
- You can customize the markup up to your requirements - check [the Material UI list demo](https://virtuoso.dev/material-ui-endless-scrolling/).
70
- If you need to support reordering, [check the React Sortable HOC example](https://virtuoso.dev/react-sortable-hoc/).
71
-
72
- ## Documentation and Demos
73
-
74
- For in-depth documentation and live examples of the supported features and live demos, check the [documentation website](https://virtuoso.dev).
75
-
76
- ## Browser support
77
-
78
- To support [legacy browsers](https://caniuse.com/resizeobserver), you might have to load a [ResizeObserver Polyfill](https://www.npmjs.com/package/resize-observer-polyfill) before using `react-virtuoso`:
79
-
80
- ```
81
- import ResizeObserver from 'resize-observer-polyfill'
82
- if (!window.ResizeObserver)
83
- window.ResizeObserver = ResizeObserver
84
- ```
85
-
86
- ## Author
87
-
88
- Petyo Ivanov [@petyosi](//twitter.com/petyosi).
89
-
90
- ## Contributing
91
-
92
- ### Fixes and new Features
93
-
94
- To run the tests, use `npm run test`.
95
- An end-to-end browser-based test suite is runnable with `npm run e2e`, with the pages being `e2e/*.tsx` and the tests `e2e/*.test.ts`.
96
-
97
- A convenient way to debug something is to preview the test cases in the browser.
98
- To do that, run `npm run dev` - it will launch a Ladle server that lets you browse the components in the `examples` folder.
5
+ [virtuoso.dev](https://virtuoso.dev).
99
6
 
100
7
  ## License
101
8
 
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),o=require("react-dom"),n=0,r=1,i=2,l=4;function s(e,t){return o=>e(t(o))}function c(e,t){return t(e)}function a(e,t){return o=>e(t,o)}function u(e,t){return()=>e(t)}function d(e,t){return t(e),e}function h(...e){return e}function f(e){e()}function m(e){return()=>e}function p(e){return void 0!==e}function g(){}function x(e,t){return e(r,t)}function v(e,t){e(n,t)}function I(e){e(i)}function T(e){return e(l)}function w(e,t){return x(e,a(t,n))}function S(e,t){const o=e(r,(e=>{o(),t(e)}));return o}function C(){const e=[];return(t,o)=>{switch(t){case i:return void e.splice(0,e.length);case r:return e.push(o),()=>{const t=e.indexOf(o);t>-1&&e.splice(t,1)};case n:return void e.slice().forEach((e=>{e(o)}));default:throw new Error(`unrecognized action ${t}`)}}}function H(e){let t=e;const o=C();return(e,i)=>{switch(e){case r:i(t);break;case n:t=i;break;case l:return t}return o(e,i)}}function y(e){return d(C(),(t=>w(e,t)))}function b(e,t){return d(H(t),(t=>w(e,t)))}function z(e,...t){const o=function(...e){return t=>e.reduceRight(c,t)}(...t);return(t,n)=>{switch(t){case r:return x(e,o(n));case i:return void I(e)}}}function R(e,t){return e===t}function E(e=R){let t;return o=>n=>{e(t,n)||(t=n,o(n))}}function B(e){return t=>o=>{e(o)&&t(o)}}function k(e){return t=>s(t,e)}function L(e){return t=>()=>t(e)}function F(e,t){return o=>n=>o(t=e(t,n))}function O(e){return t=>o=>{e>0?e--:t(o)}}function M(e){let t,o=null;return n=>r=>{o=r,t||(t=setTimeout((()=>{t=void 0,n(o)}),e))}}function j(e){let t,o;return n=>r=>{t=r,o&&clearTimeout(o),o=setTimeout((()=>{n(t)}),e)}}function P(...e){const t=new Array(e.length);let o=0,n=null;const r=Math.pow(2,e.length)-1;return e.forEach(((e,i)=>{const l=Math.pow(2,i);x(e,(e=>{const s=o;o|=l,t[i]=e,s!==r&&o===r&&n&&(n(),n=null)}))})),e=>i=>{const l=()=>e([i].concat(t));o===r?l():n=l}}function W(...e){return function(t,o){switch(t){case r:return function(...e){return()=>{e.map(f)}}(...e.map((e=>x(e,o))));case i:return;default:throw new Error(`unrecognized action ${t}`)}}}function A(e,t=R){return z(e,E(t))}function V(...e){const t=C(),o=new Array(e.length);let n=0;const l=Math.pow(2,e.length)-1;return e.forEach(((e,r)=>{const i=Math.pow(2,r);x(e,(e=>{o[r]=e,n|=i,n===l&&v(t,o)}))})),function(e,s){switch(e){case r:return n===l&&s(o),x(t,s);case i:return I(t);default:throw new Error(`unrecognized action ${e}`)}}}function D(e,t=[],{singleton:o}={singleton:!0}){return{id:G(),constructor:e,dependencies:t,singleton:o}}const G=()=>Symbol();function N(e,t){const o={},n={};let r=0;const i=e.length;for(;r<i;)n[e[r]]=1,r+=1;for(const l in t)n.hasOwnProperty(l)||(o[l]=t[l]);return o}const _="undefined"!=typeof document?t.useLayoutEffect:t.useEffect;function U(o,n,l){const s=Object.keys(n.required||{}),c=Object.keys(n.optional||{}),h=Object.keys(n.methods||{}),f=Object.keys(n.events||{}),p=t.createContext({});function w(e,t){e.propsReady&&v(e.propsReady,!1);for(const o of s){v(e[n.required[o]],t[o])}for(const o of c)if(o in t){v(e[n.optional[o]],t[o])}e.propsReady&&v(e.propsReady,!0)}function S(e){return f.reduce(((t,o)=>(t[o]=function(e){let t,o;const n=()=>t&&t();return function(l,s){switch(l){case r:if(s){if(o===s)return;return n(),o=s,t=x(e,s),t}return n(),g;case i:return n(),void(o=null);default:throw new Error(`unrecognized action ${l}`)}}}(e[n.events[o]]),t)),{})}const C=t.forwardRef(((r,i)=>{const{children:a,...g}=r,[T]=t.useState((()=>d(function(e){const t=new Map,o=({id:e,constructor:n,dependencies:r,singleton:i})=>{if(i&&t.has(e))return t.get(e);const l=n(r.map((e=>o(e))));return i&&t.set(e,l),l};return o(e)}(o),(e=>w(e,g))))),[C]=t.useState(u(S,T));_((()=>{for(const e of f)e in g&&x(C[e],g[e]);return()=>{Object.values(C).map(I)}}),[g,C,T]),_((()=>{w(T,g)})),t.useImperativeHandle(i,m(function(e){return h.reduce(((t,o)=>(t[o]=t=>{v(e[n.methods[o]],t)},t)),{})}(T)));const H=l;return e.jsx(p.Provider,{value:T,children:l?e.jsx(H,{...N([...s,...c,...f],g),children:a}):a})}));return{Component:C,usePublisher:e=>t.useCallback(a(v,t.useContext(p)[e]),[e]),useEmitterValue:t.version.startsWith("18")?e=>{const o=t.useContext(p)[e],n=t.useCallback((e=>x(o,e)),[o]);return t.useSyncExternalStore(n,(()=>T(o)),(()=>T(o)))}:e=>{const o=t.useContext(p)[e],[n,r]=t.useState(u(T,o));return _((()=>x(o,(e=>{e!==n&&r(m(e))}))),[o,n]),n},useEmitter:(e,o)=>{const n=t.useContext(p)[e];_((()=>x(n,o)),[o,n])}}}const $="undefined"!=typeof document?t.useLayoutEffect:t.useEffect;var q=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(q||{});const K={0:"debug",1:"log",2:"warn",3:"error"},Y=D((()=>{const e=H(3);return{log:H(((t,o,n=1)=>{var r;n>=(null!=(r=("undefined"==typeof globalThis?window:globalThis).VIRTUOSO_LOG_LEVEL)?r:T(e))&&console[K[n]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,o)})),logLevel:e}}),[],{singleton:!0});function Z(e,o,n){const r=t.useRef(null);let i=e=>{};if("undefined"!=typeof ResizeObserver){const l=t.useMemo((()=>new ResizeObserver((t=>{const o=()=>{const o=t[0].target;null!==o.offsetParent&&e(o)};n?o():requestAnimationFrame(o)}))),[e]);i=e=>{e&&o?(l.observe(e),r.current=e):(r.current&&l.unobserve(r.current),r.current=null)}}return{ref:r,callbackRef:i}}function X(e,t,o){return Z(e,t,o).callbackRef}function J(e,o,n,r,i,l,s,c,a){const u=t.useCallback((t=>{const n=function(e,t,o,n){const r=e.length;if(0===r)return null;const i=[];for(let l=0;l<r;l++){const r=e.item(l);if(!r||void 0===r.dataset.index)continue;const s=parseInt(r.dataset.index),c=parseFloat(r.dataset.knownSize),a=t(r,o);if(0===a&&n("Zero-sized element, this should not happen",{child:r},q.ERROR),a===c)continue;const u=i[i.length-1];0===i.length||u.size!==a||u.endIndex!==s-1?i.push({startIndex:s,endIndex:s,size:a}):i[i.length-1].endIndex++}return i}(t.children,o,c?"offsetWidth":"offsetHeight",i);let a=t.parentElement;for(;!a.dataset.virtuosoScroller;)a=a.parentElement;const u="window"===a.lastElementChild.dataset.viewportType,d=s?c?s.scrollLeft:s.scrollTop:u?c?window.pageXOffset||document.documentElement.scrollLeft:window.pageYOffset||document.documentElement.scrollTop:c?a.scrollLeft:a.scrollTop,h=s?c?s.scrollWidth:s.scrollHeight:u?c?document.documentElement.scrollWidth:document.documentElement.scrollHeight:c?a.scrollWidth:a.scrollHeight,f=s?c?s.offsetWidth:s.offsetHeight:u?c?window.innerWidth:window.innerHeight:c?a.offsetWidth:a.offsetHeight;r({scrollTop:Math.max(d,0),scrollHeight:h,viewportHeight:f}),null==l||l(c?Q("column-gap",getComputedStyle(t).columnGap,i):Q("row-gap",getComputedStyle(t).rowGap,i)),null!==n&&e(n)}),[e,o,i,l,s,r]);return Z(u,n,a)}function Q(e,t,o){return"normal"===t||(null==t?void 0:t.endsWith("px"))||o(`${e} was not resolved to pixel value correctly`,t,q.WARN),"normal"===t?0:parseInt(null!=t?t:"0",10)}function ee(e,t){return Math.round(e.getBoundingClientRect()[t])}function te(e,t){return Math.abs(e-t)<1.01}function oe(e,n,r,i=g,l,s){const c=t.useRef(null),a=t.useRef(null),u=t.useRef(null),d=t.useCallback((t=>{const r=t.target,i=r===window||r===document,l=s?i?window.pageXOffset||document.documentElement.scrollLeft:r.scrollLeft:i?window.pageYOffset||document.documentElement.scrollTop:r.scrollTop,c=s?i?document.documentElement.scrollWidth:r.scrollWidth:i?document.documentElement.scrollHeight:r.scrollHeight,d=s?i?window.innerWidth:r.offsetWidth:i?window.innerHeight:r.offsetHeight,h=()=>{e({scrollTop:Math.max(l,0),scrollHeight:c,viewportHeight:d})};t.suppressFlushSync?h():o.flushSync(h),null!==a.current&&(l===a.current||l<=0||l===c-d)&&(a.current=null,n(!0),u.current&&(clearTimeout(u.current),u.current=null))}),[e,n]);return t.useEffect((()=>{const e=l||c.current;return i(l||c.current),d({target:e,suppressFlushSync:!0}),e.addEventListener("scroll",d,{passive:!0}),()=>{i(null),e.removeEventListener("scroll",d)}}),[c,d,r,i,l]),{scrollerRef:c,scrollByCallback:function(e){s&&(e={left:e.top,behavior:e.behavior}),c.current.scrollBy(e)},scrollToCallback:function(t){const o=c.current;if(!o||(s?"offsetWidth"in o&&0===o.offsetWidth:"offsetHeight"in o&&0===o.offsetHeight))return;const r="smooth"===t.behavior;let i,l,d;o===window?(l=Math.max(ee(document.documentElement,s?"width":"height"),s?document.documentElement.scrollWidth:document.documentElement.scrollHeight),i=s?window.innerWidth:window.innerHeight,d=s?document.documentElement.scrollLeft:document.documentElement.scrollTop):(l=o[s?"scrollWidth":"scrollHeight"],i=ee(o,s?"width":"height"),d=o[s?"scrollLeft":"scrollTop"]);const h=l-i;if(t.top=Math.ceil(Math.max(Math.min(h,t.top),0)),te(i,l)||t.top===d)return e({scrollTop:d,scrollHeight:l,viewportHeight:i}),void(r&&n(!0));r?(a.current=t.top,u.current&&clearTimeout(u.current),u.current=setTimeout((()=>{u.current=null,a.current=null,n(!0)}),1e3)):a.current=null,s&&(t={left:t.top,behavior:t.behavior}),o.scrollTo(t)}}}const ne=D((()=>{const e=C(),t=C(),o=H(0),n=C(),r=H(0),i=C(),l=C(),s=H(0),c=H(0),a=H(0),u=H(0),d=C(),h=C(),f=H(!1),m=H(!1),p=H(!1);return w(z(e,k((({scrollTop:e})=>e))),t),w(z(e,k((({scrollHeight:e})=>e))),l),w(t,r),{scrollContainerState:e,scrollTop:t,viewportHeight:i,headerHeight:s,fixedHeaderHeight:c,fixedFooterHeight:a,footerHeight:u,scrollHeight:l,smoothScrollTargetReached:n,horizontalDirection:m,skipAnimationFrameInResizeObserver:p,scrollTo:d,scrollBy:h,statefulScrollTop:r,deviation:o,scrollingInProgress:f}}),[],{singleton:!0}),re={lvl:0};function ie(e,t,o,n=re,r=re){return{k:e,v:t,lvl:o,l:n,r:r}}function le(e){return e===re}function se(){return re}function ce(e,t){if(le(e))return re;const{k:o,l:n,r:r}=e;if(t===o){if(le(n))return r;if(le(r))return n;{const[t,o]=me(n);return Ie(ge(e,{k:t,v:o,l:pe(n)}))}}return Ie(ge(e,t<o?{l:ce(n,t)}:{r:ce(r,t)}))}function ae(e,t){if(!le(e))return t===e.k?e.v:t<e.k?ae(e.l,t):ae(e.r,t)}function ue(e,t,o="k"){if(le(e))return[-1/0,void 0];if(Number(e[o])===t)return[e.k,e.v];if(Number(e[o])<t){const n=ue(e.r,t,o);return n[0]===-1/0?[e.k,e.v]:n}return ue(e.l,t,o)}function de(e,t,o){return le(e)?ie(t,o,1):t===e.k?ge(e,{k:t,v:o}):t<e.k?ve(ge(e,{l:de(e.l,t,o)})):ve(ge(e,{r:de(e.r,t,o)}))}function he(e,t,o){if(le(e))return[];const{k:n,v:r,l:i,r:l}=e;let s=[];return n>t&&(s=s.concat(he(i,t,o))),n>=t&&n<=o&&s.push({k:n,v:r}),n<=o&&(s=s.concat(he(l,t,o))),s}function fe(e){return le(e)?[]:[...fe(e.l),{k:e.k,v:e.v},...fe(e.r)]}function me(e){return le(e.r)?[e.k,e.v]:me(e.r)}function pe(e){return le(e.r)?e.l:Ie(ge(e,{r:pe(e.r)}))}function ge(e,t){return ie(void 0!==t.k?t.k:e.k,void 0!==t.v?t.v:e.v,void 0!==t.lvl?t.lvl:e.lvl,void 0!==t.l?t.l:e.l,void 0!==t.r?t.r:e.r)}function xe(e){return le(e)||e.lvl>e.r.lvl}function ve(e){return Se(Ce(e))}function Ie(e){const{l:t,r:o,lvl:n}=e;if(o.lvl>=n-1&&t.lvl>=n-1)return e;if(n>o.lvl+1){if(xe(t))return Ce(ge(e,{lvl:n-1}));if(le(t)||le(t.r))throw new Error("Unexpected empty nodes");return ge(t.r,{l:ge(t,{r:t.r.l}),r:ge(e,{l:t.r.r,lvl:n-1}),lvl:n})}if(xe(e))return Se(ge(e,{lvl:n-1}));if(le(o)||le(o.l))throw new Error("Unexpected empty nodes");{const t=o.l,r=xe(t)?o.lvl-1:o.lvl;return ge(t,{l:ge(e,{r:t.l,lvl:n-1}),r:Se(ge(o,{l:t.r,lvl:r})),lvl:t.lvl+1})}}function Te(e,t,o){if(le(e))return[];const n=ue(e,t)[0];return we(he(e,n,o),(({k:e,v:t})=>({index:e,value:t})))}function we(e,t){const o=e.length;if(0===o)return[];let{index:n,value:r}=t(e[0]);const i=[];for(let l=1;l<o;l++){const{index:o,value:s}=t(e[l]);i.push({start:n,end:o-1,value:r}),n=o,r=s}return i.push({start:n,end:1/0,value:r}),i}function Se(e){const{r:t,lvl:o}=e;return le(t)||le(t.r)||t.lvl!==o||t.r.lvl!==o?e:ge(t,{l:ge(e,{r:t.l}),lvl:o+1})}function Ce(e){const{l:t}=e;return le(t)||t.lvl!==e.lvl?e:ge(t,{r:ge(e,{l:t.r})})}function He(e,t,o,n=0){let r=e.length-1;for(;n<=r;){const i=Math.floor((n+r)/2),l=o(e[i],t);if(0===l)return i;if(-1===l){if(r-n<2)return i-1;r=i-1}else{if(r===n)return i;n=i+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function ye(e,t,o){return e[He(e,t,o)]}const be=D((()=>({recalcInProgress:H(!1)})),[],{singleton:!0});function ze(e){const{size:t,startIndex:o,endIndex:n}=e;return e=>e.start===o&&(e.end===n||e.end===1/0)&&e.value===t}function Re(e,t){let o=0,n=0;for(;o<e;)o+=t[n+1]-t[n]-1,n++;return n-(o===e?0:1)}function Ee({index:e},t){return t===e?0:t<e?-1:1}function Be({offset:e},t){return t===e?0:t<e?-1:1}function ke(e){return{index:e.index,value:e}}function Le(e,t,o,n=0){return n>0&&(t=Math.max(t,ye(e,n,Ee).offset)),we(function(e,t,o,n){const r=He(e,t,n),i=He(e,o,n,r);return e.slice(r,i+1)}(e,t,o,Be),ke)}function Fe(e,t,o,n){let r=e,i=0,l=0,s=0,c=0;if(0!==t){c=He(r,t-1,Ee);s=r[c].offset;const e=ue(o,t-1);i=e[0],l=e[1],r.length&&r[c].size===ue(o,t)[1]&&(c-=1),r=r.slice(0,c+1)}else r=[];for(const{start:a,value:u}of Te(o,t,1/0)){const e=a-i,t=e*l+s+e*n;r.push({offset:t,size:u,index:a}),i=a,s=t,l=u}return{offsetTree:r,lastIndex:i,lastOffset:s,lastSize:l}}function Oe(e,[t,o,n,r]){t.length>0&&n("received item sizes",t,q.DEBUG);const i=e.sizeTree;let l=i,s=0;if(o.length>0&&le(i)&&2===t.length){const e=t[0].size,n=t[1].size;l=o.reduce(((t,o)=>de(de(t,o,e),o+1,n)),l)}else[l,s]=function(e,t){let o=le(e)?0:1/0;for(const n of t){const{size:t,startIndex:r,endIndex:i}=n;if(o=Math.min(o,r),le(e)){e=de(e,0,t);continue}const l=Te(e,r-1,i+1);if(l.some(ze(n)))continue;let s=!1,c=!1;for(const{start:o,end:n,value:a}of l)s?(i>=o||t===a)&&(e=ce(e,o)):(c=a!==t,s=!0),n>i&&i>=o&&a!==t&&(e=de(e,i+1,a));c&&(e=de(e,r,t))}return[e,o]}(l,t);if(l===i)return e;const{offsetTree:c,lastIndex:a,lastSize:u,lastOffset:d}=Fe(e.offsetTree,s,l,r);return{sizeTree:l,offsetTree:c,lastIndex:a,lastOffset:d,lastSize:u,groupOffsetTree:o.reduce(((e,t)=>de(e,t,Me(t,c,r))),se()),groupIndices:o}}function Me(e,t,o){if(0===t.length)return 0;const{offset:n,index:r,size:i}=ye(t,e,Ee),l=e-r,s=i*l+(l-1)*o+n;return s>0?s+o:s}function je(e,t,o){if(function(e){return void 0!==e.groupIndex}(e))return t.groupIndices[e.groupIndex]+1;{let n=Pe("LAST"===e.index?o:e.index,t);return n=Math.max(0,n,Math.min(o,n)),n}}function Pe(e,t){if(!We(t))return e;let o=0;for(;t.groupIndices[o]<=e+o;)o++;return e+o}function We(e){return!le(e.groupOffsetTree)}const Ae={offsetHeight:"height",offsetWidth:"width"},Ve=D((([{log:e},{recalcInProgress:t}])=>{const o=C(),n=C(),r=b(n,0),i=C(),l=C(),s=H(0),c=H([]),a=H(void 0),u=H(void 0),d=H(((e,t)=>ee(e,Ae[t]))),h=H(void 0),f=H(0),m={offsetTree:[],sizeTree:se(),groupOffsetTree:se(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},p=b(z(o,P(c,e,f),F(Oe,m),E()),m),g=b(z(c,E(),F(((e,t)=>({prev:e.current,current:t})),{prev:[],current:[]}),k((({prev:e})=>e))),[]);w(z(c,B((e=>e.length>0)),P(p,f),k((([e,t,o])=>{const n=e.reduce(((e,n,r)=>de(e,n,Me(n,t.offsetTree,o)||r)),se());return{...t,groupIndices:e,groupOffsetTree:n}}))),p),w(z(n,P(p),B((([e,{lastIndex:t}])=>e<t)),k((([e,{lastIndex:t,lastSize:o}])=>[{startIndex:e,endIndex:t,size:o}]))),o),w(a,u);const I=b(z(a,k((e=>void 0===e))),!0);w(z(u,B((e=>void 0!==e&&le(T(p).sizeTree))),k((e=>[{startIndex:0,endIndex:0,size:e}]))),o);const S=y(z(o,P(p),F((({sizes:e},[t,o])=>({changed:o!==e,sizes:o})),{changed:!1,sizes:m}),k((e=>e.changed))));x(z(s,F(((e,t)=>({diff:e.prev-t,prev:t})),{diff:0,prev:0}),k((e=>e.diff))),(e=>{const{groupIndices:o}=T(p);if(e>0)v(t,!0),v(i,e+Re(e,o));else if(e<0){const t=T(g);t.length>0&&(e-=Re(-e,t)),v(l,e)}})),x(z(s,P(e)),(([e,t])=>{e<0&&t("`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:s},q.ERROR)}));const R=y(i);w(z(i,P(p),k((([e,t])=>{const o=t.groupIndices.length>0,n=[],r=t.lastSize;if(o){const o=ae(t.sizeTree,0);let i=0,l=0;for(;i<e;){const e=t.groupIndices[l],s=t.groupIndices.length===l+1?1/0:t.groupIndices[l+1]-e-1;n.push({startIndex:e,endIndex:e,size:o}),n.push({startIndex:e+1,endIndex:e+1+s-1,size:r}),l++,i+=s+1}const s=fe(t.sizeTree);return i!==e&&s.shift(),s.reduce(((t,{k:o,v:n})=>{let r=t.ranges;return 0!==t.prevSize&&(r=[...t.ranges,{startIndex:t.prevIndex,endIndex:o+e-1,size:t.prevSize}]),{ranges:r,prevIndex:o+e,prevSize:n}}),{ranges:n,prevIndex:e,prevSize:0}).ranges}return fe(t.sizeTree).reduce(((t,{k:o,v:n})=>({ranges:[...t.ranges,{startIndex:t.prevIndex,endIndex:o+e-1,size:t.prevSize}],prevIndex:o+e,prevSize:n})),{ranges:[],prevIndex:0,prevSize:r}).ranges}))),o);const L=y(z(l,P(p,f),k((([e,{offsetTree:t},o])=>Me(-e,t,o)))));return w(z(l,P(p,f),k((([e,t,o])=>{if(t.groupIndices.length>0){if(le(t.sizeTree))return t;let n=se();const r=T(g);let i=0,l=0,s=0;for(;i<-e;){s=r[l];const e=r[l+1]-s-1;l++,i+=e+1}n=fe(t.sizeTree).reduce(((t,{k:o,v:n})=>de(t,Math.max(0,o+e),n)),n);if(i!==-e){n=de(n,0,ae(t.sizeTree,s));n=de(n,1,ue(t.sizeTree,1-e)[1])}return{...t,sizeTree:n,...Fe(t.offsetTree,0,n,o)}}{const n=fe(t.sizeTree).reduce(((t,{k:o,v:n})=>de(t,Math.max(0,o+e),n)),se());return{...t,sizeTree:n,...Fe(t.offsetTree,0,n,o)}}}))),p),{data:h,totalCount:n,sizeRanges:o,groupIndices:c,defaultItemSize:u,fixedItemSize:a,unshiftWith:i,shiftWith:l,shiftWithOffset:L,beforeUnshiftWith:R,firstItemIndex:s,gap:f,sizes:p,listRefresh:S,statefulTotalCount:r,trackItemSizes:I,itemSize:d}}),h(Y,be),{singleton:!0}),De="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style;function Ge(e){const t="number"==typeof e?{index:e}:e;return t.align||(t.align="start"),t.behavior&&De||(t.behavior="auto"),t.offset||(t.offset=0),t}const Ne=D((([{sizes:e,totalCount:t,listRefresh:o,gap:n},{scrollingInProgress:r,viewportHeight:i,scrollTo:l,smoothScrollTargetReached:s,headerHeight:c,footerHeight:a,fixedHeaderHeight:u,fixedFooterHeight:d},{log:h}])=>{const f=C(),m=C(),p=H(0);let g=null,I=null,T=null;function y(){g&&(g(),g=null),T&&(T(),T=null),I&&(clearTimeout(I),I=null),v(r,!1)}return w(z(f,P(e,i,t,p,c,a,h),P(n,u,d),k((([[e,t,n,i,l,c,a,u],d,h,p])=>{const w=Ge(e),{align:C,behavior:H,offset:b}=w,R=i-1,E=je(w,t,R);let B=Me(E,t.offsetTree,d)+c;"end"===C?(B+=h+ue(t.sizeTree,E)[1]-n+p,E===R&&(B+=a)):"center"===C?B+=(h+ue(t.sizeTree,E)[1]-n+p)/2:B-=l,b&&(B+=b);const k=t=>{y(),t?(u("retrying to scroll to",{location:e},q.DEBUG),v(f,e)):(v(m,!0),u("list did not change, scroll successful",{},q.DEBUG))};if(y(),"smooth"===H){let e=!1;T=x(o,(t=>{e=e||t})),g=S(s,(()=>{k(e)}))}else g=S(z(o,(L=150,e=>{const t=setTimeout((()=>{e(!1)}),L);return o=>{o&&(e(!0),clearTimeout(t))}})),k);var L;return I=setTimeout((()=>{y()}),1200),v(r,!0),u("scrolling from index to",{index:E,top:B,behavior:H},q.DEBUG),{top:B,behavior:H}}))),l),{scrollToIndex:f,scrollTargetReached:m,topListHeight:p}}),h(Ve,ne,Y),{singleton:!0});const _e="up",Ue="down",$e={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},qe=D((([{scrollContainerState:e,scrollTop:t,viewportHeight:o,headerHeight:n,footerHeight:r,scrollBy:i}])=>{const l=H(!1),s=H(!0),c=C(),a=C(),u=H(4),d=H(0),h=b(z(W(z(A(t),O(1),L(!0)),z(A(t),O(1),L(!1),j(100))),E()),!1),f=b(z(W(z(i,L(!0)),z(i,L(!1),j(200))),E()),!1);w(z(V(A(t),A(d)),k((([e,t])=>e<=t)),E()),s),w(z(s,M(50)),a);const m=y(z(V(e,A(o),A(n),A(r),A(u)),F(((e,[{scrollTop:t,scrollHeight:o},n,r,i,l])=>{const s={viewportHeight:n,scrollTop:t,scrollHeight:o};if(t+n-o>-l){let o,n;return t>e.state.scrollTop?(o="SCROLLED_DOWN",n=e.state.scrollTop-t):(o="SIZE_DECREASED",n=e.state.scrollTop-t||e.scrollTopDelta),{atBottom:!0,state:s,atBottomBecause:o,scrollTopDelta:n}}let c;return c=s.scrollHeight>e.state.scrollHeight?"SIZE_INCREASED":n<e.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":t<e.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:c,state:s}}),$e),E(((e,t)=>e&&e.atBottom===t.atBottom)))),p=b(z(e,F(((e,{scrollTop:t,scrollHeight:o,viewportHeight:n})=>{if(te(e.scrollHeight,o))return{scrollTop:t,scrollHeight:o,jump:0,changed:!1};{const r=o-(t+n)<1;return e.scrollTop!==t&&r?{scrollHeight:o,scrollTop:t,jump:e.scrollTop-t,changed:!0}:{scrollHeight:o,scrollTop:t,jump:0,changed:!0}}}),{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),B((e=>e.changed)),k((e=>e.jump))),0);w(z(m,k((e=>e.atBottom))),l),w(z(l,M(50)),c);const g=H(Ue);w(z(e,k((({scrollTop:e})=>e)),E(),F(((e,t)=>T(f)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?_e:Ue,prevScrollTop:t}),{direction:Ue,prevScrollTop:0}),k((e=>e.direction))),g),w(z(e,M(50),L("none")),g);const x=H(0);return w(z(h,B((e=>!e)),L(0)),x),w(z(t,M(100),P(h),B((([e,t])=>!!t)),F((([e,t],[o])=>[t,o]),[0,0]),k((([e,t])=>t-e))),x),{isScrolling:h,isAtTop:s,isAtBottom:l,atBottomState:m,atTopStateChange:a,atBottomStateChange:c,scrollDirection:g,atBottomThreshold:u,atTopThreshold:d,scrollVelocity:x,lastJumpDueToItemResize:p}}),h(ne)),Ke=D((([{log:e}])=>{const t=H(!1),o=y(z(t,B((e=>e)),E()));return x(t,(t=>{t&&T(e)("props updated",{},q.DEBUG)})),{propsReady:t,didMount:o}}),h(Y),{singleton:!0});function Ye(e,t){0==e?t():requestAnimationFrame((()=>Ye(e-1,t)))}function Ze(e,t){const o=t-1;return"number"==typeof e?e:"LAST"===e.index?o:e.index}const Xe=D((([{sizes:e,listRefresh:t,defaultItemSize:o},{scrollTop:n},{scrollToIndex:r,scrollTargetReached:i},{didMount:l}])=>{const s=H(!0),c=H(0),a=H(!0);return w(z(l,P(c),B((([e,t])=>!!t)),L(!1)),s),w(z(l,P(c),B((([e,t])=>!!t)),L(!1)),a),x(z(V(t,l),P(s,e,o,a),B((([[,e],t,{sizeTree:o},n,r])=>e&&(!le(o)||p(n))&&!t&&!r)),P(c)),(([,e])=>{S(i,(()=>{v(a,!0)})),Ye(4,(()=>{S(n,(()=>{v(s,!0)})),v(r,e)}))})),{scrolledToInitialItem:s,initialTopMostItemIndex:c,initialItemFinalLocationReached:a}}),h(Ve,ne,Ne,Ke),{singleton:!0});function Je(e){return!!e&&("smooth"===e?"smooth":"auto")}const Qe=D((([{totalCount:e,listRefresh:t},{isAtBottom:o,atBottomState:n},{scrollToIndex:r},{scrolledToInitialItem:i},{propsReady:l,didMount:s},{log:c},{scrollingInProgress:a}])=>{const u=H(!1),d=C();let h=null;function f(e){v(r,{index:"LAST",align:"end",behavior:e})}function m(e){const t=S(n,(t=>{!e||t.atBottom||"SIZE_INCREASED"!==t.notAtBottomBecause||h||(T(c)("scrolling to bottom due to increased size",{},q.DEBUG),f("auto"))}));setTimeout(t,100)}return x(z(V(z(A(e),O(1)),s),P(A(u),o,i,a),k((([[e,t],o,n,r,i])=>{let l=t&&r,s="auto";return l&&(s=((e,t)=>"function"==typeof e?Je(e(t)):t&&Je(e))(o,n||i),l=l&&!!s),{totalCount:e,shouldFollow:l,followOutputBehavior:s}})),B((({shouldFollow:e})=>e))),(({totalCount:e,followOutputBehavior:o})=>{h&&(h(),h=null),h=S(t,(()=>{T(c)("following output to ",{totalCount:e},q.DEBUG),f(o),h=null}))})),x(z(V(A(u),e,l),B((([e,,t])=>e&&t)),F((({value:e},[,t])=>({refreshed:e===t,value:t})),{refreshed:!1,value:0}),B((({refreshed:e})=>e)),P(u,e)),(([,e])=>{T(i)&&m(!1!==e)})),x(d,(()=>{m(!1!==T(u))})),x(V(A(u),n),(([e,t])=>{e&&!t.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===t.notAtBottomBecause&&f("auto")})),{followOutput:u,autoscrollToBottom:d}}),h(Ve,qe,Ne,Xe,Ke,Y,ne));function et(e){return e.reduce(((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e)),{totalCount:0,groupIndices:[]})}const tt=D((([{totalCount:e,groupIndices:t,sizes:o},{scrollTop:n,headerHeight:r}])=>{const i=C(),l=C(),s=y(z(i,k(et)));return w(z(s,k((e=>e.totalCount))),e),w(z(s,k((e=>e.groupIndices))),t),w(z(V(n,o,r),B((([e,t])=>We(t))),k((([e,t,o])=>ue(t.groupOffsetTree,Math.max(e-o,0),"v")[0])),E(),k((e=>[e]))),l),{groupCounts:i,topItemsIndexes:l}}),h(Ve,ne));function ot(e,t){return!(!e||e[0]!==t[0]||e[1]!==t[1])}function nt(e,t){return!(!e||e.startIndex!==t.startIndex||e.endIndex!==t.endIndex)}const rt="top",it="bottom",lt="none";function st(e,t,o){return"number"==typeof e?o===_e&&t===rt||o===Ue&&t===it?e:0:o===_e?t===rt?e.main:e.reverse:t===it?e.main:e.reverse}function ct(e,t){return"number"==typeof e?e:e[t]||0}const at=D((([{scrollTop:e,viewportHeight:t,deviation:o,headerHeight:n,fixedHeaderHeight:r}])=>{const i=C(),l=H(0),s=H(0),c=H(0);return{listBoundary:i,overscan:c,topListHeight:l,increaseViewportBy:s,visibleRange:b(z(V(A(e),A(t),A(n),A(i,ot),A(c),A(l),A(r),A(o),A(s)),k((([e,t,o,[n,r],i,l,s,c,a])=>{const u=e-c,d=l+s,h=Math.max(o-u,0);let f=lt;const m=ct(a,rt),p=ct(a,it);return n-=c,r+=o+s,(n+=o+s)>e+d-m&&(f=_e),(r-=c)<e-h+t+p&&(f=Ue),f!==lt?[Math.max(u-o-st(i,rt,f)-m,0),u-h-s+t+st(i,it,f)+p]:null})),B((e=>null!=e)),E(ot)),[0,0])}}),h(ne),{singleton:!0});const ut={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function dt(e,t,o){if(0===e.length)return[];if(!We(t))return e.map((e=>({...e,index:e.index+o,originalIndex:e.index})));const n=e[0].index,r=e[e.length-1].index,i=[],l=Te(t.groupOffsetTree,n,r);let s,c=0;for(const a of e){let e;(!s||s.end<a.index)&&(s=l.shift(),c=t.groupIndices.indexOf(s.start)),e=a.index===s.start?{type:"group",index:c}:{index:a.index-(c+1)+o,groupIndex:c},i.push({...e,size:a.size,offset:a.offset,originalIndex:a.index,data:a.data})}return i}function ht(e,t,o,n,r,i){const{lastSize:l,lastOffset:s,lastIndex:c}=r;let a=0,u=0;if(e.length>0){a=e[0].offset;const t=e[e.length-1];u=t.offset+t.size}const d=o-c,h=a,f=s+d*l+(d-1)*n-u;return{items:dt(e,r,i),topItems:dt(t,r,i),topListHeight:t.reduce(((e,t)=>t.size+e),0),offsetTop:a,offsetBottom:f,top:h,bottom:u,totalCount:o,firstItemIndex:i}}function ft(e,t,o,n,r,i){let l=0;if(o.groupIndices.length>0)for(const a of o.groupIndices){if(a-l>=e)break;l++}const s=e+l,c=Ze(t,s);return ht(Array.from({length:s}).map(((e,t)=>({index:t+c,size:0,offset:0,data:i[t+c]}))),[],s,r,o,n)}const mt=D((([{sizes:e,totalCount:t,data:o,firstItemIndex:n,gap:r},i,{visibleRange:l,listBoundary:s,topListHeight:c},{scrolledToInitialItem:a,initialTopMostItemIndex:u},{topListHeight:h},f,{didMount:m},{recalcInProgress:g}])=>{const x=H([]),v=H(0),I=C();w(i.topItemsIndexes,x);const S=b(z(V(m,g,A(l,ot),A(t),A(e),A(u),a,A(x),A(n),A(r),o),B((([e,t,,o,,,,,,,n])=>{const r=n&&n.length!==o;return e&&!t&&!r})),k((([,,[e,t],o,n,r,i,l,s,c,a])=>{const u=n,{sizeTree:h,offsetTree:f}=u,m=T(v);if(0===o)return{...ut,totalCount:o};if(0===e&&0===t)return 0===m?{...ut,totalCount:o}:ft(m,r,n,s,c,a||[]);if(le(h)){if(m>0)return null;const e=ht(function(e,t,o){if(We(t)){const n=Pe(e,t);return[{index:ue(t.groupOffsetTree,n)[0],size:0,offset:0},{index:n,size:0,offset:0,data:o&&o[0]}]}return[{index:e,size:0,offset:0,data:o&&o[0]}]}(Ze(r,o),u,a),[],o,c,u,s);return e}const p=[];if(l.length>0){const e=l[0],t=l[l.length-1];let o=0;for(const n of Te(h,e,t)){const r=n.value,i=Math.max(n.start,e),l=Math.min(n.end,t);for(let e=i;e<=l;e++)p.push({index:e,size:r,offset:o,data:a&&a[e]}),o+=r}}if(!i)return ht([],p,o,c,u,s);const g=l.length>0?l[l.length-1]+1:0,x=Le(f,e,t,g);if(0===x.length)return null;const I=o-1;return ht(d([],(o=>{for(const n of x){const r=n.value;let i=r.offset,l=n.start;const s=r.size;if(r.offset<e){l+=Math.floor((e-r.offset+c)/(s+c));const t=l-n.start;i+=t*s+t*c}l<g&&(i+=(g-l)*s,l=g);const u=Math.min(n.end,I);for(let e=l;e<=u&&!(i>=t);e++)o.push({index:e,size:s,offset:i,data:a&&a[e]}),i+=s+c}})),p,o,c,u,s)})),B((e=>null!==e)),E()),ut);w(z(o,B(p),k((e=>null==e?void 0:e.length))),t),w(z(S,k((e=>e.topListHeight))),h),w(h,c),w(z(S,k((e=>[e.top,e.bottom]))),s),w(z(S,k((e=>e.items))),I);return{listState:S,topItemsIndexes:x,endReached:y(z(S,B((({items:e})=>e.length>0)),P(t,o),B((([{items:e},t])=>e[e.length-1].originalIndex===t-1)),k((([,e,t])=>[e-1,t])),E(ot),k((([e])=>e)))),startReached:y(z(S,M(200),B((({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length)),k((({items:e})=>e[0].index)),E())),rangeChanged:y(z(S,B((({items:e})=>e.length>0)),k((({items:e})=>{let t=0,o=e.length-1;for(;"group"===e[t].type&&t<o;)t++;for(;"group"===e[o].type&&o>t;)o--;return{startIndex:e[t].index,endIndex:e[o].index}})),E(nt))),itemsRendered:I,initialItemCount:v,...f}}),h(Ve,tt,at,Xe,Ne,qe,Ke,be),{singleton:!0}),pt=D((([{sizes:e,firstItemIndex:t,data:o,gap:n},{initialTopMostItemIndex:r},{initialItemCount:i,listState:l},{didMount:s}])=>(w(z(s,P(i),B((([,e])=>0!==e)),P(r,e,t,n,o),k((([[,e],t,o,n,r,i=[]])=>ft(e,t,o,n,r,i)))),l),{})),h(Ve,Xe,mt,Ke),{singleton:!0}),gt=D((([{scrollVelocity:e}])=>{const t=H(!1),o=C(),n=H(!1);return w(z(e,P(n,t,o),B((([e,t])=>!!t)),k((([e,t,o,n])=>{const{exit:r,enter:i}=t;if(o){if(r(e,n))return!1}else if(i(e,n))return!0;return o})),E()),t),x(z(V(t,e,o),P(n)),(([[e,t,o],n])=>e&&n&&n.change&&n.change(t,o))),{isSeeking:t,scrollSeekConfiguration:n,scrollVelocity:e,scrollSeekRangeChanged:o}}),h(qe),{singleton:!0}),xt=D((([{topItemsIndexes:e}])=>{const t=H(0);return w(z(t,B((e=>e>=0)),k((e=>Array.from({length:e}).map(((e,t)=>t))))),e),{topItemCount:t}}),h(mt)),vt=D((([{footerHeight:e,headerHeight:t,fixedHeaderHeight:o,fixedFooterHeight:n},{listState:r}])=>{const i=C(),l=b(z(V(e,n,t,o,r),k((([e,t,o,n,r])=>e+t+o+n+r.offsetBottom+r.bottom))),0);return w(A(l),i),{totalListHeight:l,totalListHeightChanged:i}}),h(ne,mt),{singleton:!0});function It(e){let t,o=!1;return()=>(o||(o=!0,t=e()),t)}const Tt=It((()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent))),wt=D((([{scrollBy:e,scrollTop:t,deviation:o,scrollingInProgress:n},{isScrolling:r,isAtBottom:i,scrollDirection:l,lastJumpDueToItemResize:s},{listState:c},{beforeUnshiftWith:a,shiftWithOffset:u,sizes:d,gap:h},{log:f},{recalcInProgress:m}])=>{const p=y(z(c,P(s),F((([,e,t,o],[{items:n,totalCount:r,bottom:i,offsetBottom:l},s])=>{const c=i+l;let a=0;if(t===r&&e.length>0&&n.length>0){0===n[0].originalIndex&&0===e[0].originalIndex||(a=c-o,0!==a&&(a+=s))}return[a,n,r,c]}),[0,[],0,0]),B((([e])=>0!==e)),P(t,l,n,i,f,m),B((([,e,t,o,,,n])=>!n&&!o&&0!==e&&t===_e)),k((([[e],,,,,t])=>(t("Upward scrolling compensation",{amount:e},q.DEBUG),e)))));function g(t){t>0?(v(e,{top:-t,behavior:"auto"}),v(o,0)):(v(o,0),v(e,{top:-t,behavior:"auto"}))}return x(z(p,P(o,r)),(([e,t,n])=>{n&&Tt()?v(o,t-e):g(-e)})),x(z(V(b(r,!1),o,m),B((([e,t,o])=>!e&&!o&&0!==t)),k((([e,t])=>t)),M(1)),g),w(z(u,k((e=>({top:-e})))),e),x(z(a,P(d,h),k((([e,{lastSize:t,groupIndices:o,sizeTree:n},r])=>{function i(e){return e*(t+r)}if(0===o.length)return i(e);{let t=0;const r=ae(n,0);let l=0,s=0;for(;l<e;){l++,t+=r;let n=o.length===s+1?1/0:o[s+1]-o[s]-1;l+n>e&&(t-=r,n=e-l+1),l+=n,t+=i(n),s++}return t}}))),(t=>{v(o,t),requestAnimationFrame((()=>{v(e,{top:t}),requestAnimationFrame((()=>{v(o,0),v(m,!1)}))}))})),{deviation:o}}),h(ne,qe,mt,Ve,Y,be)),St=D((([{didMount:e},{scrollTo:t},{listState:o}])=>{const n=H(0);return x(z(e,P(n),B((([,e])=>0!==e)),k((([,e])=>({top:e})))),(e=>{S(z(o,O(1),B((e=>e.items.length>1))),(()=>{requestAnimationFrame((()=>{v(t,e)}))}))})),{initialScrollTop:n}}),h(Ke,ne,mt),{singleton:!0}),Ct=D((([{viewportHeight:e},{totalListHeight:t}])=>{const o=H(!1);return{alignToBottom:o,paddingTopAddition:b(z(V(o,e,t),B((([e])=>e)),k((([,e,t])=>Math.max(0,e-t))),M(0),E()),0)}}),h(ne,vt),{singleton:!0}),Ht=D((([{scrollTo:e,scrollContainerState:t}])=>{const o=C(),n=C(),r=C(),i=H(!1),l=H(void 0);return w(z(V(o,n),k((([{viewportHeight:e,scrollTop:t,scrollHeight:o},{offsetTop:n}])=>({scrollTop:Math.max(0,t-n),scrollHeight:o,viewportHeight:e})))),t),w(z(e,P(n),k((([e,{offsetTop:t}])=>({...e,top:e.top+t})))),r),{useWindowScroll:i,customScrollParent:l,windowScrollContainerState:o,windowViewportRect:n,windowScrollTo:r}}),h(ne)),yt=({itemTop:e,itemBottom:t,viewportTop:o,viewportBottom:n,locationParams:{behavior:r,align:i,...l}})=>e<o?{...l,behavior:r,align:null!=i?i:"start"}:t>n?{...l,behavior:r,align:null!=i?i:"end"}:null,bt=D((([{sizes:e,totalCount:t,gap:o},{scrollTop:n,viewportHeight:r,headerHeight:i,fixedHeaderHeight:l,fixedFooterHeight:s,scrollingInProgress:c},{scrollToIndex:a}])=>{const u=C();return w(z(u,P(e,r,t,i,l,s,n),P(o),k((([[e,t,o,n,r,i,l,s],a])=>{const{done:u,behavior:d,align:h,calculateViewLocation:f=yt,...m}=e,p=je(e,t,n-1),g=Me(p,t.offsetTree,a)+r+i,x=f({itemTop:g,itemBottom:g+ue(t.sizeTree,p)[1],viewportTop:s+i,viewportBottom:s+o-l,locationParams:{behavior:d,align:h,...m}});return x?u&&S(z(c,B((e=>!1===e)),O(T(c)?1:2)),u):u&&u(),x})),B((e=>null!==e))),a),{scrollIntoView:u}}),h(Ve,ne,Ne,mt,Y),{singleton:!0}),zt=D((([{sizes:e,sizeRanges:t},{scrollTop:o,headerHeight:n},{initialTopMostItemIndex:r},{didMount:i},{useWindowScroll:l,windowScrollContainerState:s,windowViewportRect:c}])=>{const a=C(),u=H(void 0),d=H(null),h=H(null);return w(s,d),w(c,h),x(z(a,P(e,o,l,d,h,n)),(([e,t,o,n,r,i,l])=>{const s=fe(t.sizeTree).map((({k:e,v:t},o,n)=>{const r=n[o+1];return{startIndex:e,endIndex:r?r.k-1:1/0,size:t}}));n&&null!==r&&null!==i&&(o=r.scrollTop-i.offsetTop),e({ranges:s,scrollTop:o-=l})})),w(z(u,B(p),k(Rt)),r),w(z(i,P(u),B((([,e])=>void 0!==e)),E(),k((([,e])=>e.ranges))),t),{getState:a,restoreStateFrom:u}}),h(Ve,ne,Xe,Ke,Ht));function Rt(e){return{offset:e.scrollTop,index:0,align:"start"}}const Et=D((([e,t,o,n,r,i,l,s,c,a])=>({...e,...t,...o,...n,...r,...i,...l,...s,...c,...a})),h(at,pt,Ke,gt,vt,St,Ct,Ht,bt,Y)),Bt=D((([{totalCount:e,sizeRanges:t,fixedItemSize:o,defaultItemSize:n,trackItemSizes:r,itemSize:i,data:l,firstItemIndex:s,groupIndices:c,statefulTotalCount:a,gap:u,sizes:d},{initialTopMostItemIndex:h,scrolledToInitialItem:f,initialItemFinalLocationReached:m},p,g,x,{listState:v,topItemsIndexes:I,...T},{scrollToIndex:S},C,{topItemCount:H},{groupCounts:y},b])=>(w(T.rangeChanged,b.scrollSeekRangeChanged),w(z(b.windowViewportRect,k((e=>e.visibleHeight))),p.viewportHeight),{totalCount:e,data:l,firstItemIndex:s,sizeRanges:t,initialTopMostItemIndex:h,scrolledToInitialItem:f,initialItemFinalLocationReached:m,topItemsIndexes:I,topItemCount:H,groupCounts:y,fixedItemHeight:o,defaultItemHeight:n,gap:u,...x,statefulTotalCount:a,listState:v,scrollToIndex:S,trackItemSizes:r,itemSize:i,groupIndices:c,...T,...b,...p,sizes:d,...g})),h(Ve,Xe,ne,zt,Qe,mt,Ne,wt,xt,tt,Et)),kt="-webkit-sticky",Lt="sticky",Ft=It((()=>{if("undefined"==typeof document)return Lt;const e=document.createElement("div");return e.style.position=kt,e.style.position===kt?kt:Lt}));function Ot(e,o,n){const r=t.useRef(null),i=t.useCallback((t=>{if(null===t||!t.offsetParent)return;const n=t.getBoundingClientRect(),i=n.width;let l,s;if(o){const e=o.getBoundingClientRect(),t=n.top-e.top;l=e.height-Math.max(0,t),s=t+o.scrollTop}else l=window.innerHeight-Math.max(0,n.top),s=n.top+window.pageYOffset;r.current={offsetTop:s,visibleHeight:l,visibleWidth:i},e(r.current)}),[e,o]),{callbackRef:l,ref:s}=Z(i,!0,n),c=t.useCallback((()=>{i(s.current)}),[i,s]);return t.useEffect((()=>{if(o){o.addEventListener("scroll",c);const e=new ResizeObserver((()=>{requestAnimationFrame(c)}));return e.observe(o),()=>{o.removeEventListener("scroll",c),e.unobserve(o)}}return window.addEventListener("scroll",c),window.addEventListener("resize",c),()=>{window.removeEventListener("scroll",c),window.removeEventListener("resize",c)}}),[c,o]),l}const Mt=t.createContext(void 0),jt=t.createContext(void 0);function Pt(e){return e}const Wt=D((([e,t])=>({...e,...t})),h(Bt,D((()=>{const e=H((e=>`Item ${e}`)),t=H(null),o=H((e=>`Group ${e}`)),n=H({}),r=H(Pt),i=H("div"),l=H(g),s=(e,t=null)=>b(z(n,k((t=>t[e])),E()),t);return{context:t,itemContent:e,groupContent:o,components:n,computeItemKey:r,HeaderFooterTag:i,scrollerRef:l,FooterComponent:s("Footer"),HeaderComponent:s("Header"),TopItemListComponent:s("TopItemList"),ListComponent:s("List","div"),ItemComponent:s("Item","div"),GroupComponent:s("Group","div"),ScrollerComponent:s("Scroller","div"),EmptyPlaceholder:s("EmptyPlaceholder"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder")}})))),At=({height:t})=>e.jsx("div",{style:{height:t}}),Vt={position:Ft(),zIndex:1,overflowAnchor:"none"},Dt={overflowAnchor:"none"},Gt={...Dt,display:"inline-block",height:"100%"},Nt=t.memo((function({showTopList:o=!1}){const n=lo("listState"),r=io("sizeRanges"),i=lo("useWindowScroll"),l=lo("customScrollParent"),s=io("windowScrollContainerState"),c=io("scrollContainerState"),a=l||i?s:c,u=lo("itemContent"),d=lo("context"),h=lo("groupContent"),f=lo("trackItemSizes"),m=lo("itemSize"),p=lo("log"),x=io("gap"),v=lo("horizontalDirection"),{callbackRef:I}=J(r,m,f,o?g:a,p,x,l,v,lo("skipAnimationFrameInResizeObserver")),[T,w]=t.useState(0);so("deviation",(e=>{T!==e&&w(e)}));const S=lo("EmptyPlaceholder"),C=lo("ScrollSeekPlaceholder")||At,H=lo("ListComponent"),y=lo("ItemComponent"),b=lo("GroupComponent"),z=lo("computeItemKey"),R=lo("isSeeking"),E=lo("groupIndices").length>0,B=lo("alignToBottom"),k=lo("initialItemFinalLocationReached"),L=o?{}:{boxSizing:"border-box",...v?{whiteSpace:"nowrap",display:"inline-block",height:"100%",paddingLeft:n.offsetTop,paddingRight:n.offsetBottom,marginLeft:0!==T?T:B?"auto":0}:{marginTop:0!==T?T:B?"auto":0,paddingTop:n.offsetTop,paddingBottom:n.offsetBottom},...k?{}:{visibility:"hidden"}};return!o&&0===n.totalCount&&S?e.jsx(S,{...Kt(S,d)}):e.jsx(H,{...Kt(H,d),ref:I,style:L,"data-testid":o?"virtuoso-top-item-list":"virtuoso-item-list",children:(o?n.topItems:n.items).map((e=>{const o=e.originalIndex,r=z(o+n.firstItemIndex,e.data,d);return R?t.createElement(C,{...Kt(C,d),key:r,index:e.index,height:e.size,type:e.type||"item",..."group"===e.type?{}:{groupIndex:e.groupIndex}}):"group"===e.type?t.createElement(b,{...Kt(b,d),key:r,"data-index":o,"data-known-size":e.size,"data-item-index":e.index,style:Vt},h(e.index,d)):t.createElement(y,{...Kt(y,d),...Yt(y,e.data),key:r,"data-index":o,"data-known-size":e.size,"data-item-index":e.index,"data-item-group-index":e.groupIndex,style:v?Gt:Dt},E?u(e.index,e.groupIndex,e.data,d):u(e.index,e.data,d))}))})})),_t={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Ut={outline:"none",overflowX:"auto",position:"relative"},$t=e=>({width:"100%",height:"100%",position:"absolute",top:0,...e?{display:"flex",flexDirection:"column"}:{}}),qt={width:"100%",position:Ft(),top:0,zIndex:1};function Kt(e,t){if("string"!=typeof e)return{context:t}}function Yt(e,t){return{item:"string"==typeof e?void 0:t}}const Zt=t.memo((function(){const o=lo("HeaderComponent"),n=io("headerHeight"),r=lo("HeaderFooterTag"),i=X(t.useMemo((()=>e=>n(ee(e,"height"))),[n]),!0,lo("skipAnimationFrameInResizeObserver")),l=lo("context");return o?e.jsx(r,{ref:i,children:e.jsx(o,{...Kt(o,l)})}):null})),Xt=t.memo((function(){const o=lo("FooterComponent"),n=io("footerHeight"),r=lo("HeaderFooterTag"),i=X(t.useMemo((()=>e=>n(ee(e,"height"))),[n]),!0,lo("skipAnimationFrameInResizeObserver")),l=lo("context");return o?e.jsx(r,{ref:i,children:e.jsx(o,{...Kt(o,l)})}):null}));function Jt({usePublisher:o,useEmitter:n,useEmitterValue:r}){return t.memo((function({style:t,children:i,...l}){const s=o("scrollContainerState"),c=r("ScrollerComponent"),a=o("smoothScrollTargetReached"),u=r("scrollerRef"),d=r("context"),h=r("horizontalDirection")||!1,{scrollerRef:f,scrollByCallback:m,scrollToCallback:p}=oe(s,a,c,u,void 0,h);n("scrollTo",p),n("scrollBy",m);const g=h?Ut:_t;return e.jsx(c,{ref:f,style:{...g,...t},"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...l,...Kt(c,d),children:i})}))}function Qt({usePublisher:o,useEmitter:n,useEmitterValue:r}){return t.memo((function({style:t,children:i,...l}){const s=o("windowScrollContainerState"),c=r("ScrollerComponent"),a=o("smoothScrollTargetReached"),u=r("totalListHeight"),d=r("deviation"),h=r("customScrollParent"),f=r("context"),{scrollerRef:m,scrollByCallback:p,scrollToCallback:x}=oe(s,a,c,g,h);return $((()=>(m.current=h||window,()=>{m.current=null})),[m,h]),n("windowScrollTo",x),n("scrollBy",p),e.jsx(c,{style:{position:"relative",...t,...0!==u?{height:u+d}:{}},"data-virtuoso-scroller":!0,...l,...Kt(c,f),children:i})}))}const eo=({children:o})=>{const n=t.useContext(Mt),r=io("viewportHeight"),i=io("fixedItemHeight"),l=lo("alignToBottom"),c=lo("horizontalDirection"),a=X(t.useMemo((()=>s(r,(e=>ee(e,c?"width":"height")))),[r,c]),!0,lo("skipAnimationFrameInResizeObserver"));return t.useEffect((()=>{n&&(r(n.viewportHeight),i(n.itemHeight))}),[n,r,i]),e.jsx("div",{style:$t(l),ref:a,"data-viewport-type":"element",children:o})},to=({children:o})=>{const n=t.useContext(Mt),r=io("windowViewportRect"),i=io("fixedItemHeight"),l=lo("customScrollParent"),s=Ot(r,l,lo("skipAnimationFrameInResizeObserver")),c=lo("alignToBottom");return t.useEffect((()=>{n&&(i(n.itemHeight),r({offsetTop:0,visibleHeight:n.viewportHeight,visibleWidth:100}))}),[n,r,i]),e.jsx("div",{ref:s,style:$t(c),"data-viewport-type":"window",children:o})},oo=({children:t})=>{const o=lo("TopItemListComponent")||"div",n=lo("headerHeight"),r={...qt,marginTop:`${n}px`},i=lo("context");return e.jsx(o,{style:r,...Kt(o,i),children:t})},no=t.memo((function(t){const o=lo("useWindowScroll"),n=lo("topItemsIndexes").length>0,r=lo("customScrollParent"),i=r||o?ao:co,l=r||o?to:eo;return e.jsxs(i,{...t,children:[n&&e.jsx(oo,{children:e.jsx(Nt,{showTopList:!0})}),e.jsxs(l,{children:[e.jsx(Zt,{}),e.jsx(Nt,{}),e.jsx(Xt,{})]})]})})),{Component:ro,usePublisher:io,useEmitterValue:lo,useEmitter:so}=U(Wt,{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"}},no),co=Jt({usePublisher:io,useEmitterValue:lo,useEmitter:so}),ao=Qt({usePublisher:io,useEmitterValue:lo,useEmitter:so}),uo=ro,ho=ro,fo={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},mo={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:po,ceil:go,floor:xo,min:vo,max:Io}=Math;function To(e,t,o){return Array.from({length:t-e+1}).map(((t,n)=>{const r=null===o?null:o[n+e];return{index:n+e,data:r}}))}function wo(e,t){return e&&e.column===t.column&&e.row===t.row}function So(e,t){return e&&e.width===t.width&&e.height===t.height}const Co=D((([{overscan:e,visibleRange:t,listBoundary:o,increaseViewportBy:n},{scrollTop:r,viewportHeight:i,scrollBy:l,scrollTo:s,smoothScrollTargetReached:c,scrollContainerState:a,footerHeight:u,headerHeight:d},h,f,{propsReady:m,didMount:p},{windowViewportRect:g,useWindowScroll:I,customScrollParent:T,windowScrollContainerState:R,windowScrollTo:F},j])=>{const W=H(0),D=H(0),G=H(fo),N=H({height:0,width:0}),_=H({height:0,width:0}),U=C(),$=C(),q=H(0),K=H(null),Y=H({row:0,column:0}),Z=C(),X=C(),J=H(!1),Q=H(0),ee=H(!0),te=H(!1),oe=H(!1);x(z(p,P(Q),B((([e,t])=>!!t))),(()=>{v(ee,!1)})),x(z(V(p,ee,_,N,Q,te),B((([e,t,o,n,,r])=>e&&!t&&0!==o.height&&0!==n.height&&!r))),(([,,,,e])=>{v(te,!0),Ye(1,(()=>{v(U,e)})),S(z(r),(()=>{v(o,[0,0]),v(ee,!0)}))})),w(z(X,B((e=>null!=e&&e.scrollTop>0)),L(0)),D),x(z(p,P(X),B((([,e])=>null!=e))),(([,e])=>{e&&(v(N,e.viewport),v(_,null==e?void 0:e.item),v(Y,e.gap),e.scrollTop>0&&(v(J,!0),S(z(r,O(1)),(e=>{v(J,!1)})),v(s,{top:e.scrollTop})))})),w(z(N,k((({height:e})=>e))),i),w(z(V(A(N,So),A(_,So),A(Y,((e,t)=>e&&e.column===t.column&&e.row===t.row)),A(r)),k((([e,t,o,n])=>({viewport:e,item:t,gap:o,scrollTop:n})))),Z),w(z(V(A(W),t,A(Y,wo),A(_,So),A(N,So),A(K),A(D),A(J),A(ee),A(Q)),B((([,,,,,,,e])=>!e)),k((([e,[t,o],n,r,i,l,s,,c,a])=>{const{row:u,column:d}=n,{height:h,width:f}=r,{width:m}=i;if(0===s&&(0===e||0===m))return fo;if(0===f){const t=Ze(a,e);return function(e){return{...mo,items:e}}(To(t,t+Math.max(s-1,0),l))}const p=bo(m,f,d);let g,x;c?0===t&&0===o&&s>0?(g=0,x=s-1):(g=p*xo((t+u)/(h+u)),x=p*go((o+u)/(h+u))-1,x=vo(e-1,Io(x,p-1)),g=vo(x,Io(0,g))):(g=0,x=-1);const v=To(g,x,l),{top:I,bottom:T}=Ho(i,n,r,v),w=go(e/p);return{items:v,offsetTop:I,offsetBottom:w*h+(w-1)*u-T,top:I,bottom:T,itemHeight:h,itemWidth:f}}))),G),w(z(K,B((e=>null!==e)),k((e=>e.length))),W),w(z(V(N,_,G,Y),B((([e,t,{items:o}])=>o.length>0&&0!==t.height&&0!==e.height)),k((([e,t,{items:o},n])=>{const{top:r,bottom:i}=Ho(e,n,t,o);return[r,i]})),E(ot)),o);const ne=H(!1);w(z(r,P(ne),k((([e,t])=>t||0!==e))),ne);const re=y(z(V(G,W),B((([{items:e}])=>e.length>0)),P(ne),B((([[e,t],o])=>{const n=e.items[e.items.length-1].index===t-1;if(o)return n;return e.bottom>0&&e.itemHeight>0&&0===e.offsetBottom&&e.items.length===t&&n})),k((([[,e]])=>e-1)),E())),ie=y(z(A(G),B((({items:e})=>e.length>0&&0===e[0].index)),L(0),E())),le=y(z(A(G),P(J),B((([{items:e},t])=>e.length>0&&!t)),k((([{items:e}])=>({startIndex:e[0].index,endIndex:e[e.length-1].index}))),E(nt),M(0)));w(le,f.scrollSeekRangeChanged),w(z(U,P(N,_,W,Y),k((([e,t,o,n,r])=>{const i=Ge(e),{align:l,behavior:s,offset:c}=i;let a=i.index;"LAST"===a&&(a=n-1),a=Io(0,a,vo(n-1,a));let u=yo(t,r,o,a);return"end"===l?u=po(u-t.height+o.height):"center"===l&&(u=po(u-t.height/2+o.height/2)),c&&(u+=c),{top:u,behavior:s}}))),s);const se=b(z(G,k((e=>e.offsetBottom+e.bottom))),0);return w(z(g,k((e=>({width:e.visibleWidth,height:e.visibleHeight})))),N),{data:K,totalCount:W,viewportDimensions:N,itemDimensions:_,scrollTop:r,scrollHeight:$,overscan:e,increaseViewportBy:n,scrollBy:l,scrollTo:s,scrollToIndex:U,smoothScrollTargetReached:c,windowViewportRect:g,windowScrollTo:F,useWindowScroll:I,customScrollParent:T,windowScrollContainerState:R,deviation:q,scrollContainerState:a,footerHeight:u,headerHeight:d,initialItemCount:D,gap:Y,restoreStateFrom:X,...f,initialTopMostItemIndex:Q,horizontalDirection:oe,gridState:G,totalListHeight:se,...h,startReached:ie,endReached:re,rangeChanged:le,stateChanged:Z,propsReady:m,stateRestoreInProgress:J,...j}}),h(at,ne,qe,gt,Ke,Ht,Y));function Ho(e,t,o,n){const{height:r}=o;if(void 0===r||0===n.length)return{top:0,bottom:0};return{top:yo(e,t,o,n[0].index),bottom:yo(e,t,o,n[n.length-1].index)+r}}function yo(e,t,o,n){const r=bo(e.width,o.width,t.column),i=xo(n/r),l=i*o.height+Io(0,i-1)*t.row;return l>0?l+t.row:l}function bo(e,t,o){return Io(1,xo((e+o)/(xo(t)+o)))}const zo=D((([e,t])=>({...e,...t})),h(Co,D((()=>{const e=H((e=>`Item ${e}`)),t=H({}),o=H(null),n=H("virtuoso-grid-item"),r=H("virtuoso-grid-list"),i=H(Pt),l=H("div"),s=H(g),c=(e,o=null)=>b(z(t,k((t=>t[e])),E()),o),a=H(!1),u=H(!1);return w(A(u),a),{readyStateChanged:a,reportReadyState:u,context:o,itemContent:e,components:t,computeItemKey:i,itemClassName:n,listClassName:r,headerFooterTag:l,scrollerRef:s,FooterComponent:c("Footer"),HeaderComponent:c("Header"),ListComponent:c("List","div"),ItemComponent:c("Item","div"),ScrollerComponent:c("Scroller","div"),ScrollSeekPlaceholder:c("ScrollSeekPlaceholder","div")}})))),Ro=t.memo((function(){const o=jo("gridState"),n=jo("listClassName"),r=jo("itemClassName"),i=jo("itemContent"),l=jo("computeItemKey"),s=jo("isSeeking"),c=Mo("scrollHeight"),a=jo("ItemComponent"),u=jo("ListComponent"),d=jo("ScrollSeekPlaceholder"),h=jo("context"),f=Mo("itemDimensions"),m=Mo("gap"),p=jo("log"),g=jo("stateRestoreInProgress"),x=Mo("reportReadyState"),v=X(t.useMemo((()=>e=>{const t=e.parentElement.parentElement.scrollHeight;c(t);const o=e.firstChild;if(o){const{width:e,height:t}=o.getBoundingClientRect();f({width:e,height:t})}m({row:Vo("row-gap",getComputedStyle(e).rowGap,p),column:Vo("column-gap",getComputedStyle(e).columnGap,p)})}),[c,f,m,p]),!0,!1);return $((()=>{o.itemHeight>0&&o.itemWidth>0&&x(!0)}),[o]),g?null:e.jsx(u,{ref:v,className:n,...Kt(u,h),style:{paddingTop:o.offsetTop,paddingBottom:o.offsetBottom},"data-testid":"virtuoso-item-list",children:o.items.map((n=>{const c=l(n.index,n.data,h);return s?e.jsx(d,{...Kt(d,h),index:n.index,height:o.itemHeight,width:o.itemWidth},c):t.createElement(a,{...Kt(a,h),className:r,"data-index":n.index,key:c},i(n.index,n.data,h))}))})})),Eo=t.memo((function(){const o=jo("HeaderComponent"),n=Mo("headerHeight"),r=jo("headerFooterTag"),i=X(t.useMemo((()=>e=>n(ee(e,"height"))),[n]),!0,!1),l=jo("context");return o?e.jsx(r,{ref:i,children:e.jsx(o,{...Kt(o,l)})}):null})),Bo=t.memo((function(){const o=jo("FooterComponent"),n=Mo("footerHeight"),r=jo("headerFooterTag"),i=X(t.useMemo((()=>e=>n(ee(e,"height"))),[n]),!0,!1),l=jo("context");return o?e.jsx(r,{ref:i,children:e.jsx(o,{...Kt(o,l)})}):null})),ko=({children:o})=>{const n=t.useContext(jt),r=Mo("itemDimensions"),i=Mo("viewportDimensions"),l=X(t.useMemo((()=>e=>{i(e.getBoundingClientRect())}),[i]),!0,!1);return t.useEffect((()=>{n&&(i({height:n.viewportHeight,width:n.viewportWidth}),r({height:n.itemHeight,width:n.itemWidth}))}),[n,i,r]),e.jsx("div",{style:$t(!1),ref:l,children:o})},Lo=({children:o})=>{const n=t.useContext(jt),r=Mo("windowViewportRect"),i=Mo("itemDimensions"),l=jo("customScrollParent"),s=Ot(r,l,!1);return t.useEffect((()=>{n&&(i({height:n.itemHeight,width:n.itemWidth}),r({offsetTop:0,visibleHeight:n.viewportHeight,visibleWidth:n.viewportWidth}))}),[n,r,i]),e.jsx("div",{ref:s,style:$t(!1),children:o})},Fo=t.memo((function({...t}){const o=jo("useWindowScroll"),n=jo("customScrollParent"),r=n||o?Ao:Wo,i=n||o?Lo:ko;return e.jsx(r,{...t,children:e.jsxs(i,{children:[e.jsx(Eo,{}),e.jsx(Ro,{}),e.jsx(Bo,{})]})})})),{Component:Oo,usePublisher:Mo,useEmitterValue:jo,useEmitter:Po}=U(zo,{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"}},Fo),Wo=Jt({usePublisher:Mo,useEmitterValue:jo,useEmitter:Po}),Ao=Qt({usePublisher:Mo,useEmitterValue:jo,useEmitter:Po});function Vo(e,t,o){return"normal"===t||(null==t?void 0:t.endsWith("px"))||o(`${e} was not resolved to pixel value correctly`,t,q.WARN),"normal"===t?0:parseInt(null!=t?t:"0",10)}const Do=Oo,Go=D((([e,t])=>({...e,...t})),h(Bt,D((()=>{const t=H((t=>e.jsxs("td",{children:["Item $",t]}))),o=H(null),n=H(null),r=H(null),i=H({}),l=H(Pt),s=H(g),c=(e,t=null)=>b(z(i,k((t=>t[e])),E()),t);return{context:o,itemContent:t,fixedHeaderContent:n,fixedFooterContent:r,components:i,computeItemKey:l,scrollerRef:s,TableComponent:c("Table","table"),TableHeadComponent:c("TableHead","thead"),TableFooterComponent:c("TableFoot","tfoot"),TableBodyComponent:c("TableBody","tbody"),TableRowComponent:c("TableRow","tr"),ScrollerComponent:c("Scroller","div"),EmptyPlaceholder:c("EmptyPlaceholder"),ScrollSeekPlaceholder:c("ScrollSeekPlaceholder"),FillerRow:c("FillerRow")}})))),No=({height:t})=>e.jsx("tr",{children:e.jsx("td",{style:{height:t}})}),_o=({height:t})=>e.jsx("tr",{children:e.jsx("td",{style:{height:t,padding:0,border:0}})}),Uo={overflowAnchor:"none"},$o=t.memo((function({showTopList:o=!1}){const n=Qo("listState"),r=Qo("computeItemKey"),i=Qo("firstItemIndex"),l=Qo("isSeeking"),s=Qo("ScrollSeekPlaceholder")||No,c=Qo("context"),a=Qo("TableRowComponent"),u=Qo("fixedHeaderHeight"),d=Qo("itemContent"),h=(o?n.topItems:[]).reduce(((e,t,o)=>(0===o?e.push(t.size):e.push(e[o-1]+t.size),e)),[]),f=(o?n.topItems:n.items).map((e=>{const n=e.originalIndex,f=r(n+i,e.data,c),m=o?0===n?0:h[n-1]:0;return l?t.createElement(s,{...Kt(s,c),key:f,index:e.index,height:e.size,type:e.type||"item"}):t.createElement(a,{...Kt(a,c),...Yt(a,e.data),key:f,"data-index":n,"data-known-size":e.size,"data-item-index":e.index,style:o?{overflowAnchor:"none",position:"sticky",zIndex:2,top:u+m}:Uo},d(e.index,e.data,c))}));return e.jsx(e.Fragment,{children:f})})),qo=t.memo((function(){const o=Qo("listState"),n=Qo("topItemsIndexes").length>0,r=Jo("sizeRanges"),i=Qo("useWindowScroll"),l=Qo("customScrollParent"),s=Jo("windowScrollContainerState"),c=Jo("scrollContainerState"),a=l||i?s:c,u=Qo("trackItemSizes"),d=Qo("itemSize"),h=Qo("log"),{callbackRef:f,ref:m}=J(r,d,u,a,h,void 0,l,!1,Qo("skipAnimationFrameInResizeObserver")),[p,g]=t.useState(0);en("deviation",(e=>{p!==e&&(m.current.style.marginTop=`${e}px`,g(e))}));const x=Qo("EmptyPlaceholder"),v=Qo("FillerRow")||_o,I=Qo("TableBodyComponent"),T=Qo("paddingTopAddition"),w=Qo("statefulTotalCount"),S=Qo("context");if(0===w&&x)return e.jsx(x,{...Kt(x,S)});const C=(n?o.topItems:[]).reduce(((e,t)=>e+t.size),0),H=o.offsetTop+T+p-C,y=o.offsetBottom,b=H>0?e.jsx(v,{height:H,context:S},"padding-top"):null,z=y>0?e.jsx(v,{height:y,context:S},"padding-bottom"):null;return e.jsxs(I,{ref:f,"data-testid":"virtuoso-item-list",...Kt(I,S),children:[b,n&&e.jsx($o,{showTopList:!0}),e.jsx($o,{}),z]})})),Ko=({children:o})=>{const n=t.useContext(Mt),r=Jo("viewportHeight"),i=Jo("fixedItemHeight"),l=X(t.useMemo((()=>s(r,(e=>ee(e,"height")))),[r]),!0,Qo("skipAnimationFrameInResizeObserver"));return t.useEffect((()=>{n&&(r(n.viewportHeight),i(n.itemHeight))}),[n,r,i]),e.jsx("div",{style:$t(!1),ref:l,"data-viewport-type":"element",children:o})},Yo=({children:o})=>{const n=t.useContext(Mt),r=Jo("windowViewportRect"),i=Jo("fixedItemHeight"),l=Qo("customScrollParent"),s=Ot(r,l,Qo("skipAnimationFrameInResizeObserver"));return t.useEffect((()=>{n&&(i(n.itemHeight),r({offsetTop:0,visibleHeight:n.viewportHeight,visibleWidth:100}))}),[n,r,i]),e.jsx("div",{ref:s,style:$t(!1),"data-viewport-type":"window",children:o})},Zo=t.memo((function(o){const n=Qo("useWindowScroll"),r=Qo("customScrollParent"),i=Jo("fixedHeaderHeight"),l=Jo("fixedFooterHeight"),c=Qo("fixedHeaderContent"),a=Qo("fixedFooterContent"),u=Qo("context"),d=X(t.useMemo((()=>s(i,(e=>ee(e,"height")))),[i]),!0,Qo("skipAnimationFrameInResizeObserver")),h=X(t.useMemo((()=>s(l,(e=>ee(e,"height")))),[l]),!0,Qo("skipAnimationFrameInResizeObserver")),f=r||n?on:tn,m=r||n?Yo:Ko,p=Qo("TableComponent"),g=Qo("TableHeadComponent"),x=Qo("TableFooterComponent"),v=c?e.jsx(g,{style:{zIndex:2,position:"sticky",top:0},ref:d,...Kt(g,u),children:c()},"TableHead"):null,I=a?e.jsx(x,{style:{zIndex:1,position:"sticky",bottom:0},ref:h,...Kt(x,u),children:a()},"TableFoot"):null;return e.jsx(f,{...o,children:e.jsx(m,{children:e.jsxs(p,{style:{borderSpacing:0,overflowAnchor:"none"},...Kt(p,u),children:[v,e.jsx(qo,{},"TableBody"),I]})})})})),{Component:Xo,usePublisher:Jo,useEmitterValue:Qo,useEmitter:en}=U(Go,{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"}},Zo),tn=Jt({usePublisher:Jo,useEmitterValue:Qo,useEmitter:en}),on=Qt({usePublisher:Jo,useEmitterValue:Qo,useEmitter:en}),nn=Xo;exports.GroupedVirtuoso=ho,exports.LogLevel=q,exports.TableVirtuoso=nn,exports.Virtuoso=uo,exports.VirtuosoGrid=Do,exports.VirtuosoGridMockContext=jt,exports.VirtuosoMockContext=Mt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("react/jsx-runtime"),R=require("react"),oo=require("react-dom"),we=0,zt=1,Kt=2,Rn=4;function rn(t){return()=>t}function ro(t){t()}function te(t,e){return n=>t(e(n))}function sn(t,e){return()=>t(e)}function En(t,e){return n=>t(e,n)}function Ve(t){return t!==void 0}function so(...t){return()=>{t.map(ro)}}function Gt(){}function Ce(t,e){return e(t),t}function io(t,e){return e(t)}function X(...t){return t}function U(t,e){return t(zt,e)}function A(t,e){t(we,e)}function Pe(t){t(Kt)}function lt(t){return t(Rn)}function F(t,e){return U(t,En(e,we))}function Rt(t,e){const n=t(zt,o=>{n(),e(o)});return n}function ln(t){let e,n;return o=>r=>{e=r,n&&clearTimeout(n),n=setTimeout(()=>{o(e)},t)}}function Hn(t,e){return t===e}function Y(t=Hn){let e;return n=>o=>{t(e,o)||(e=o,n(o))}}function P(t){return e=>n=>{t(n)&&e(n)}}function H(t){return e=>te(e,t)}function vt(t){return e=>()=>{e(t)}}function S(t,...e){const n=lo(...e);return(o,r)=>{switch(o){case Kt:Pe(t);return;case zt:return U(t,n(r))}}}function bt(t,e){return n=>o=>{n(e=t(e,o))}}function Ut(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 d=n;n=n|l,e[i]=c,d!==r&&n===r&&o&&(o(),o=null)})}),s=>i=>{const l=()=>{s([i].concat(e))};n===r?l():o=l}}function lo(...t){return e=>t.reduceRight(io,e)}function co(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(),Gt);case Kt:o(),n=null;return}}}function w(t){let e=t;const n=D();return(o,r)=>{switch(o){case we:e=r;break;case zt:{r(e);break}case Rn:return e}return n(o,r)}}function ct(t,e){return Ce(w(e),n=>F(t,n))}function D(){const t=[];return(e,n)=>{switch(e){case we:t.slice().forEach(o=>{o(n)});return;case Kt: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 Ce(D(),e=>F(t,e))}function $(t,e=[],{singleton:n}={singleton:!0}){return{constructor:t,dependencies:e,id:uo(),singleton:n}}const uo=()=>Symbol();function ao(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 Kt:{Pe(e);return}case zt:return o===r&&i(n),U(e,i)}}}function M(t,e=Hn){return S(t,Y(e))}function cn(...t){return function(e,n){switch(e){case Kt:return;case zt:return so(...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 fo={0:"debug",3:"error",1:"log",2:"warn"},mo=()=>typeof globalThis>"u"?window:globalThis,Vt=$(()=>{const t=w(3);return{log:w((n,o,r=1)=>{var i;const s=(i=mo().VIRTUOSO_LOG_LEVEL)!=null?i:lt(t);r>=s&&console[fo[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,o)}),logLevel:t}},[],{singleton:!0});function Et(t,e,n){return Me(t,e,n).callbackRef}function Me(t,e,n){const o=R.useRef(null);let r=s=>{};if(typeof ResizeObserver<"u"){const s=R.useMemo(()=>new ResizeObserver(i=>{const l=()=>{const c=i[0].target;c.offsetParent!==null&&t(c)};n?l():requestAnimationFrame(l)}),[t]);r=i=>{i&&e?(s.observe(i),o.current=i):(o.current&&s.unobserve(o.current),o.current=null)}}return{callbackRef:r,ref:o}}function kn(t,e,n,o,r,s,i,l,c){const d=R.useCallback(f=>{const I=po(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",C=i?l?i.scrollLeft:i.scrollTop:m?l?window.pageXOffset||document.documentElement.scrollLeft:window.pageYOffset||document.documentElement.scrollTop:l?p.scrollLeft:p.scrollTop,x=i?l?i.scrollWidth:i.scrollHeight:m?l?document.documentElement.scrollWidth:document.documentElement.scrollHeight:l?p.scrollWidth:p.scrollHeight,y=i?l?i.offsetWidth:i.offsetHeight:m?l?window.innerWidth:window.innerHeight:l?p.offsetWidth:p.offsetHeight;o({scrollHeight:x,scrollTop:Math.max(C,0),viewportHeight:y}),s==null||s(l?un("column-gap",getComputedStyle(f).columnGap,r):un("row-gap",getComputedStyle(f).rowGap,r)),I!==null&&t(I)},[t,e,r,s,i,o]);return Me(d,n,c)}function po(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),d=parseFloat(l.dataset.knownSize),f=e(l,n);if(f===0&&o("Zero-sized element, this should not happen",{child:l},mt.ERROR),f===d)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 un(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 je(t,e,n){const o=R.useRef(null),r=R.useCallback(c=>{if(!(c!=null&&c.offsetParent))return;const d=c.getBoundingClientRect(),f=d.width;let I,p;if(e){const m=e.getBoundingClientRect(),C=d.top-m.top;p=m.height-Math.max(0,C),I=C+e.scrollTop}else p=window.innerHeight-Math.max(0,d.top),I=d.top+window.pageYOffset;o.current={offsetTop:I,visibleHeight:p,visibleWidth:f},t(o.current)},[t,e]),{callbackRef:s,ref:i}=Me(r,!0,n),l=R.useCallback(()=>{r(i.current)},[r,i]);return R.useEffect(()=>{if(e){e.addEventListener("scroll",l);const c=new ResizeObserver(()=>{requestAnimationFrame(l)});return c.observe(e),()=>{e.removeEventListener("scroll",l),c.unobserve(e)}}else return window.addEventListener("scroll",l),window.addEventListener("resize",l),()=>{window.removeEventListener("scroll",l),window.removeEventListener("resize",l)}},[l,e]),s}const at=$(()=>{const t=D(),e=D(),n=w(0),o=D(),r=w(0),s=D(),i=D(),l=w(0),c=w(0),d=w(0),f=w(0),I=D(),p=D(),m=w(!1),C=w(!1),x=w(!1);return F(S(t,H(({scrollTop:y})=>y)),e),F(S(t,H(({scrollHeight:y})=>y)),i),F(e,r),{deviation:n,fixedFooterHeight:d,fixedHeaderHeight:c,footerHeight:f,headerHeight:l,horizontalDirection:C,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 wt(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=wt(t.r,e,n);return o[0]===-1/0?[t.k,t.v]:o}return wt(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?an(ot(t,{l:pt(t.l,e,n)})):an(ot(t,{r:pt(t.r,e,n)}))}function $t(){return ee}function ye(t,e,n){if(K(t))return[];const o=wt(t,e)[0];return ho(Oe(t,o,n))}function Be(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:Be(o,e)})):he(ot(t,{r:Be(r,e)}))}function Wt(t){return K(t)?[]:[...Wt(t.l),{k:t.k,v:t.v},...Wt(t.r)]}function Oe(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(Oe(r,e,n))),o>=e&&o<=n&&l.push({k:o,v:i}),o<=n&&(l=l.concat(Oe(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(Re(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(Re(t))return Fe(ot(t,{lvl:n-1}));if(!K(o)&&!K(o.l)){const r=o.l,s=Re(r)?o.lvl-1:o.lvl;return ot(r,{l:ot(t,{lvl:n-1,r:r.l}),lvl:r.lvl+1,r:Fe(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 Re(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 an(t){return Fe(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 Fe(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 ho(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 Ae=$(()=>({recalcInProgress:w(!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 go(t,e,n,o){const r=xe(t,e,o),s=xe(t,n,o,r);return t.slice(r,s+1)}function Ct(t,e){return Math.round(t.getBoundingClientRect()[e])}function ve(t){return!K(t.groupOffsetTree)}function We({index:t},e){return e===t?0:e<t?-1:1}function xo(){return{groupIndices:[],groupOffsetTree:$t(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:$t()}}function Io(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=ye(t,i-1,r+1);if(l.some(bo(o)))continue;let c=!1,d=!1;for(const{end:f,start:I,value:p}of l)c?(r>=I||s===p)&&(t=Be(t,I)):(d=p!==s,c=!0),f>r&&r>=I&&p!==s&&(t=pt(t,r+1,p));d&&(t=pt(t,i,s))}return[t,n]}function So(t){return typeof t.groupIndex<"u"}function To({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,We),i=t-o,l=s*i+(i-1)*n+r;return l>0?l+n:l}function Mn(t,e){if(!ve(e))return t;let n=0;for(;e.groupIndices[n]<=t+n;)n++;return t+n}function jn(t,e,n){if(So(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,We).offset)),Bn(go(t,e,n,To),vo)}function Co(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((C,x)=>pt(pt(C,x,p),x+1,m),i)}else[i,l]=Io(i,e);if(i===s)return t;const{lastIndex:c,lastOffset:d,lastSize:f,offsetTree:I}=Le(t.offsetTree,l,i,r);return{groupIndices:n,groupOffsetTree:n.reduce((p,m)=>pt(p,m,re(m,I,r)),$t()),lastIndex:c,lastOffset:d,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 dn(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 Le(t,e,n,o){let r=t,s=0,i=0,l=0,c=0;if(e!==0){c=xe(r,e-1,We),l=r[c].offset;const f=wt(n,e-1);s=f[0],i=f[1],r.length&&r[c].size===wt(n,e)[1]&&(c-=1),r=r.slice(0,c+1)}else r=[];for(const{start:d,value:f}of ye(n,e,1/0)){const I=d-s,p=I*i+l+I*o;r.push({index:d,offset:p,size:f}),s=d,l=p,i=f}return{lastIndex:s,lastOffset:l,lastSize:i,offsetTree:r}}function vo(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 Ro={offsetHeight:"height",offsetWidth:"width"},Ht=$(([{log:t},{recalcInProgress:e}])=>{const n=D(),o=D(),r=ct(o,0),s=D(),i=D(),l=w(0),c=w([]),d=w(void 0),f=w(void 0),I=w((h,a)=>Ct(h,Ro[a])),p=w(void 0),m=w(0),C=xo(),x=ct(S(n,G(c,t,m),bt(Co,C),Y()),C),y=ct(S(c,Y(),bt((h,a)=>({current:a,prev:h.current}),{current:[],prev:[]}),H(({prev:h})=>h)),[]);F(S(c,P(h=>h.length>0),G(x,m),H(([h,a,E])=>{const B=h.reduce((O,z,V)=>pt(O,z,re(z,a.offsetTree,E)||V),$t());return{...a,groupIndices:h,groupOffsetTree:B}})),x),F(S(o,G(x),P(([h,{lastIndex:a}])=>h<a),H(([h,{lastIndex:a,lastSize:E}])=>[{endIndex:a,size:E,startIndex:h}])),n),F(d,f);const g=ct(S(d,H(h=>h===void 0)),!0);F(S(f,P(h=>h!==void 0&&K(lt(x).sizeTree)),H(h=>[{endIndex:0,size:h,startIndex:0}])),n);const u=ht(S(n,G(x),bt(({sizes:h},[a,E])=>({changed:E!==h,sizes:E}),{changed:!1,sizes:C}),H(h=>h.changed)));U(S(l,bt((h,a)=>({diff:h.prev-a,prev:a}),{diff:0,prev:0}),H(h=>h.diff)),h=>{const{groupIndices:a}=lt(x);if(h>0)A(e,!0),A(s,h+dn(h,a));else if(h<0){const E=lt(y);E.length>0&&(h-=dn(-h,E)),A(i,h)}}),U(S(l,G(t)),([h,a])=>{h<0&&a("`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),H(([h,a])=>{const E=a.groupIndices.length>0,B=[],O=a.lastSize;if(E){const z=ne(a.sizeTree,0);let V=0,N=0;for(;V<h;){const k=a.groupIndices[N],q=a.groupIndices.length===N+1?1/0:a.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(a.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(a.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 b=ht(S(i,G(x,m),H(([h,{offsetTree:a},E])=>{const B=-h;return re(B,a,E)})));return F(S(i,G(x,m),H(([h,a,E])=>{if(a.groupIndices.length>0){if(K(a.sizeTree))return a;let O=$t();const z=lt(y);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(a.sizeTree).reduce((k,{k:q,v:st})=>pt(k,Math.max(0,q+h),st),O),V!==-h){const k=ne(a.sizeTree,J);O=pt(O,0,k);const q=wt(a.sizeTree,-h+1)[1];O=pt(O,1,q)}return{...a,sizeTree:O,...Le(a.offsetTree,0,O,E)}}else{const O=Wt(a.sizeTree).reduce((z,{k:V,v:N})=>pt(z,Math.max(0,V+h),N),$t());return{...a,sizeTree:O,...Le(a.offsetTree,0,O,E)}}})),x),{beforeUnshiftWith:T,data:p,defaultItemSize:f,firstItemIndex:l,fixedItemSize:d,gap:m,groupIndices:c,itemSize:I,listRefresh:u,shiftWith:i,shiftWithOffset:b,sizeRanges:n,sizes:x,statefulTotalCount:r,totalCount:o,trackItemSizes:g,unshiftWith:s}},X(Vt,Ae),{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,H(Eo)));return F(S(l,H(c=>c.totalCount)),n),F(S(l,H(c=>c.groupIndices)),t),F(S(rt(r,e,o),P(([c,d])=>ve(d)),H(([c,d,f])=>wt(d.groupOffsetTree,Math.max(c-f,0),"v")[0]),Y(),H(c=>[c])),i),{groupCounts:s,topItemsIndexes:i}},X(Ht,at)),Pt=$(([{log:t}])=>{const e=w(!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}),Ho=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||!Ho)&&(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:d,smoothScrollTargetReached:f,viewportHeight:I},{log:p}])=>{const m=D(),C=D(),x=w(0);let y=null,g=null,u=null;function T(){y&&(y(),y=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),H(([[b,h,a,E,B,O,z,V],N,J,nt])=>{const k=Wn(b),{align:q,behavior:st,offset:dt}=k,It=E-1,ft=jn(k,h,It);let ut=re(ft,h.offsetTree,N)+O;q==="end"?(ut+=J+wt(h.sizeTree,ft)[1]-a+nt,ft===It&&(ut+=z)):q==="center"?ut+=(J+wt(h.sizeTree,ft)[1]-a+nt)/2:ut-=B,dt&&(ut+=dt);const Mt=St=>{T(),St?(V("retrying to scroll to",{location:b},mt.DEBUG),A(m,b)):(A(C,!0),V("list did not change, scroll successful",{},mt.DEBUG))};if(T(),st==="smooth"){let St=!1;u=U(e,Yt=>{St=St||Yt}),y=Rt(f,()=>{Mt(St)})}else y=Rt(S(e,ko(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}})),d),{scrollTargetReached:C,scrollToIndex:m,topListHeight:x}},X(Ht,at,Vt),{singleton:!0});function ko(t){return e=>{const n=setTimeout(()=>{e(!1)},t);return o=>{o&&(e(!0),clearTimeout(n))}}}function Ge(t,e){t==0?e():requestAnimationFrame(()=>{Ge(t-1,e)})}function _e(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=w(!0),c=w(0),d=w(!0);return F(S(i,G(c),P(([f,I])=>!!I),vt(!1)),l),F(S(i,G(c),P(([f,I])=>!!I),vt(!1)),d),U(S(rt(e,i),G(l,n,t,d),P(([[,f],I,{sizeTree:p},m,C])=>f&&(!K(p)||Ve(m))&&!I&&!C),G(c)),([,f])=>{Rt(r,()=>{A(d,!0)}),Ge(4,()=>{Rt(o,()=>{A(l,!0)}),A(s,f)})}),{initialItemFinalLocationReached:d,initialTopMostItemIndex:c,scrolledToInitialItem:l}},X(Ht,at,ie,Pt),{singleton:!0});function Gn(t,e){return Math.abs(t-e)<1.01}const se="up",Jt="down",Bo="none",Oo={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Fo=0,ce=$(([{footerHeight:t,headerHeight:e,scrollBy:n,scrollContainerState:o,scrollTop:r,viewportHeight:s}])=>{const i=w(!1),l=w(!0),c=D(),d=D(),f=w(4),I=w(Fo),p=ct(S(cn(S(M(r),Ut(1),vt(!0)),S(M(r),Ut(1),vt(!1),ln(100))),Y()),!1),m=ct(S(cn(S(n,vt(!0)),S(n,vt(!1),ln(200))),Y()),!1);F(S(rt(M(r),M(I)),H(([u,T])=>u<=T),Y()),l),F(S(l,Lt(50)),d);const C=ht(S(rt(o,M(s),M(e),M(t),M(f)),bt((u,[{scrollHeight:T,scrollTop:b},h,a,E,B])=>{const O=b+h-T>-B,z={scrollHeight:T,scrollTop:b,viewportHeight:h};if(O){let N,J;return b>u.state.scrollTop?(N="SCROLLED_DOWN",J=u.state.scrollTop-b):(N="SIZE_DECREASED",J=u.state.scrollTop-b||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":b<u.state.scrollTop?V="SCROLLING_UPWARDS":V="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:V,state:z}},Oo),Y((u,T)=>u&&u.atBottom===T.atBottom))),x=ct(S(o,bt((u,{scrollHeight:T,scrollTop:b,viewportHeight:h})=>{if(Gn(u.scrollHeight,T))return{changed:!1,jump:0,scrollHeight:T,scrollTop:b};{const a=T-(b+h)<1;return u.scrollTop!==b&&a?{changed:!0,jump:u.scrollTop-b,scrollHeight:T,scrollTop:b}:{changed:!0,jump:0,scrollHeight:T,scrollTop:b}}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),P(u=>u.changed),H(u=>u.jump)),0);F(S(C,H(u=>u.atBottom)),i),F(S(i,Lt(50)),c);const y=w(Jt);F(S(o,H(({scrollTop:u})=>u),Y(),bt((u,T)=>lt(m)?{direction:u.direction,prevScrollTop:T}:{direction:T<u.prevScrollTop?se:Jt,prevScrollTop:T},{direction:Jt,prevScrollTop:0}),H(u=>u.direction)),y),F(S(o,Lt(50),vt(Bo)),y);const g=w(0);return F(S(p,P(u=>!u),vt(0)),g),F(S(r,Lt(100),G(p),P(([u,T])=>!!T),bt(([u,T],[b])=>[T,b],[0,0]),H(([u,T])=>T-u)),g),{atBottomState:C,atBottomStateChange:c,atBottomThreshold:f,atTopStateChange:d,atTopThreshold:I,isAtBottom:i,isAtTop:l,isScrolling:p,lastJumpDueToItemResize:x,scrollDirection:y,scrollVelocity:g}},X(at)),Ie="top",Se="bottom",fn="none";function mn(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 pn(t,e){var n;return typeof t=="number"?t:(n=t[e])!=null?n:0}const Ne=$(([{deviation:t,fixedHeaderHeight:e,headerHeight:n,scrollTop:o,viewportHeight:r}])=>{const s=D(),i=w(0),l=w(0),c=w(0),d=ct(S(rt(M(o),M(r),M(n),M(s,oe),M(c),M(i),M(e),M(t),M(l)),H(([f,I,p,[m,C],x,y,g,u,T])=>{const b=f-u,h=y+g,a=Math.max(p-b,0);let E=fn;const B=pn(T,Ie),O=pn(T,Se);return m-=u,m+=p+g,C+=p+g,C-=u,m>f+h-B&&(E=se),C<f-a+I+O&&(E=Jt),E!==fn?[Math.max(b-p-mn(x,Ie,E)-B,0),b-a-g+I+mn(x,Se,E)+O]:null}),P(f=>f!=null),Y(oe)),[0,0]);return{increaseViewportBy:l,listBoundary:s,overscan:c,topListHeight:i,visibleRange:d}},X(at),{singleton:!0});function Lo(t,e,n){if(ve(e)){const o=Mn(t,e);return[{index:wt(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 Ee={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 d=0,f=0;if(t.length>0){d=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=d,C=p-f;return{bottom:f,firstItemIndex:s,items:hn(t,r,s),offsetBottom:C,offsetTop:d,top:m,topItems:hn(e,r,s),topListHeight:e.reduce((x,y)=>y.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=_e(e,l),d=Array.from({length:l}).map((f,I)=>({data:s[I+c],index:I+c,offset:0,size:0}));return ge(d,[],l,r,n,o)}function hn(t,e,n){if(t.length===0)return[];if(!ve(e))return t.map(d=>({...d,index:d.index+n,originalIndex:d.index}));const o=t[0].index,r=t[t.length-1].index,s=[],i=ye(e.groupOffsetTree,o,r);let l,c=0;for(const d of t){(!l||l.end<d.index)&&(l=i.shift(),c=e.groupIndices.indexOf(l.start));let f;d.index===l.start?f={index:c,type:"group"}:f={groupIndex:c,index:d.index-(c+1)+n},s.push({...f,data:d.data,offset:d.offset,originalIndex:d.index,size:d.size})}return s}const _t=$(([{data:t,firstItemIndex:e,gap:n,sizes:o,totalCount:r},s,{listBoundary:i,topListHeight:l,visibleRange:c},{initialTopMostItemIndex:d,scrolledToInitialItem:f},{topListHeight:I},p,{didMount:m},{recalcInProgress:C}])=>{const x=w([]),y=w(0),g=D();F(s.topItemsIndexes,x);const u=ct(S(rt(m,C,M(c,oe),M(r),M(o),M(d),f,M(x),M(e),M(n),t),P(([a,E,,B,,,,,,,O])=>{const z=O&&O.length!==B;return a&&!E&&!z}),H(([,,[a,E],B,O,z,V,N,J,nt,k])=>{const q=O,{offsetTree:st,sizeTree:dt}=q,It=lt(y);if(B===0)return{...Ee,totalCount:B};if(a===0&&E===0)return It===0?{...Ee,totalCount:B}:_n(It,z,O,J,nt,k||[]);if(K(dt))return It>0?null:ge(Lo(_e(z,B),q,k),[],B,nt,q,J);const ft=[];if(N.length>0){const jt=N[0],yt=N[N.length-1];let kt=0;for(const v of ye(dt,jt,yt)){const _=v.value,Q=Math.max(v.start,jt),it=Math.min(v.end,yt);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,a,E,ut);if(Mt.length===0)return null;const St=B-1,Yt=Ce([],jt=>{for(const yt of Mt){const kt=yt.value;let v=kt.offset,_=yt.start;const Q=kt.size;if(kt.offset<a){_+=Math.floor((a-kt.offset+nt)/(Q+nt));const tt=_-yt.start;v+=tt*Q+tt*nt}_<ut&&(v+=(ut-_)*Q,_=ut);const it=Math.min(yt.end,St);for(let tt=_;tt<=it&&!(v>=E);tt++)jt.push({data:k==null?void 0:k[tt],index:tt,offset:v,size:Q}),v+=Q+nt}});return ge(Yt,ft,B,nt,q,J)}),P(a=>a!==null),Y()),Ee);F(S(t,P(Ve),H(a=>a==null?void 0:a.length)),r),F(S(u,H(a=>a.topListHeight)),I),F(I,l),F(S(u,H(a=>[a.top,a.bottom])),i),F(S(u,H(a=>a.items)),g);const T=ht(S(u,P(({items:a})=>a.length>0),G(r,t),P(([{items:a},E])=>a[a.length-1].originalIndex===E-1),H(([,a,E])=>[a-1,E]),Y(oe),H(([a])=>a))),b=ht(S(u,Lt(200),P(({items:a,topItems:E})=>a.length>0&&a[0].originalIndex===E.length),H(({items:a})=>a[0].index),Y())),h=ht(S(u,P(({items:a})=>a.length>0),H(({items:a})=>{let E=0,B=a.length-1;for(;a[E].type==="group"&&E<B;)E++;for(;a[B].type==="group"&&B>E;)B--;return{endIndex:a[B].index,startIndex:a[E].index}}),Y(Vn)));return{endReached:T,initialItemCount:y,itemsRendered:g,listState:u,rangeChanged:h,startReached:b,topItemsIndexes:x,...p}},X(Ht,An,Ne,le,ie,ce,Pt,Ae),{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),H(([l,c,d,f,I])=>l+c+d+f+I.offsetBottom+I.bottom)),0);return F(M(i),s),{totalListHeight:i,totalListHeightChanged:s}},X(at,_t),{singleton:!0}),zo=$(([{viewportHeight:t},{totalListHeight:e}])=>{const n=w(!1),o=ct(S(rt(n,t,e),P(([r])=>r),H(([,r,s])=>Math.max(0,r-s)),Lt(0),Y()),0);return{alignToBottom:n,paddingTopAddition:o}},X(at,Nn),{singleton:!0});function gn(t){return t?t==="smooth"?"smooth":"auto":!1}const Vo=(t,e)=>typeof t=="function"?gn(t(e)):e&&gn(t),Po=$(([{listRefresh:t,totalCount:e},{atBottomState:n,isAtBottom:o},{scrollToIndex:r},{scrolledToInitialItem:s},{didMount:i,propsReady:l},{log:c},{scrollingInProgress:d}])=>{const f=w(!1),I=D();let p=null;function m(x){A(r,{align:"end",behavior:x,index:"LAST"})}U(S(rt(S(M(e),Ut(1)),i),G(M(f),o,s,d),H(([[x,y],g,u,T,b])=>{let h=y&&T,a="auto";return h&&(a=Vo(g,u||b),h=h&&!!a),{followOutputBehavior:a,shouldFollow:h,totalCount:x}}),P(({shouldFollow:x})=>x)),({followOutputBehavior:x,totalCount:y})=>{p&&(p(),p=null),p=Rt(t,()=>{lt(c)("following output to ",{totalCount:y},mt.DEBUG),m(x),p=null})});function C(x){const y=Rt(n,g=>{x&&!g.atBottom&&g.notAtBottomBecause==="SIZE_INCREASED"&&!p&&(lt(c)("scrolling to bottom due to increased size",{},mt.DEBUG),m("auto"))});setTimeout(y,100)}return U(S(rt(M(f),e,l),P(([x,,y])=>x&&y),bt(({value:x},[,y])=>({refreshed:x===y,value:y}),{refreshed:!1,value:0}),P(({refreshed:x})=>x),G(f,e)),([,x])=>{lt(s)&&C(x!==!1)}),U(I,()=>{C(lt(f)!==!1)}),U(rt(M(f),n),([x,y])=>{x&&!y.atBottom&&y.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&m("auto")}),{autoscrollToBottom:I,followOutput:f}},X(Ht,ce,ie,le,Pt,Vt,at)),Mo=$(([{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),H(([[,c],d,f,I,p,m=[]])=>_n(c,d,f,I,p,m))),i),{}),X(Ht,le,_t,Pt),{singleton:!0}),jo=$(([{didMount:t},{scrollTo:e},{listState:n}])=>{const o=w(0);return U(S(t,G(o),P(([,r])=>r!==0),H(([,r])=>({top:r}))),r=>{Rt(S(n,Ut(1),P(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{A(e,r)})})}),{initialScrollTop:o}},X(Pt,at,_t),{singleton:!0}),Ao=({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,Wo=$(([{gap:t,sizes:e,totalCount:n},{fixedFooterHeight:o,fixedHeaderHeight:r,headerHeight:s,scrollingInProgress:i,scrollTop:l,viewportHeight:c},{scrollToIndex:d}])=>{const f=D();return F(S(f,G(e,c,n,s,r,o,l),G(t),H(([[I,p,m,C,x,y,g,u],T])=>{const{align:b,behavior:h,calculateViewLocation:a=Ao,done:E,...B}=I,O=jn(I,p,C-1),z=re(O,p.offsetTree,T)+x+y,V=z+wt(p.sizeTree,O)[1],N=u+y,J=u+m-g,nt=a({itemBottom:V,itemTop:z,locationParams:{align:b,behavior:h,...B},viewportBottom:J,viewportTop:N});return nt?E&&Rt(S(i,P(k=>!k),Ut(lt(i)?1:2)),E):E&&E(),nt}),P(I=>I!==null)),d),{scrollIntoView:f}},X(Ht,at,ie,_t,Vt),{singleton:!0}),Dn=$(([{scrollVelocity:t}])=>{const e=w(!1),n=D(),o=w(!1);return F(S(t,G(o,e,n),P(([r,s])=>!!s),H(([r,s,i,l])=>{const{enter:c,exit:d}=s;if(i){if(d(r,l))return!1}else if(c(r,l))return!0;return i}),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}),De=$(([{scrollContainerState:t,scrollTo:e}])=>{const n=D(),o=D(),r=D(),s=w(!1),i=w(void 0);return F(S(rt(n,o),H(([{scrollHeight:l,scrollTop:c,viewportHeight:d},{offsetTop:f}])=>({scrollHeight:l,scrollTop:Math.max(0,c-f),viewportHeight:d}))),t),F(S(e,G(o),H(([l,{offsetTop:c}])=>({...l,top:l.top+c}))),r),{customScrollParent:i,useWindowScroll:s,windowScrollContainerState:n,windowScrollTo:r,windowViewportRect:o}},X(at)),Go=$(([{sizeRanges:t,sizes:e},{headerHeight:n,scrollTop:o},{initialTopMostItemIndex:r},{didMount:s},{useWindowScroll:i,windowScrollContainerState:l,windowViewportRect:c}])=>{const d=D(),f=w(void 0),I=w(null),p=w(null);return F(l,I),F(c,p),U(S(d,G(e,o,i,I,p,n)),([m,C,x,y,g,u,T])=>{const b=yo(C.sizeTree);y&&g!==null&&u!==null&&(x=g.scrollTop-u.offsetTop),x-=T,m({ranges:b,scrollTop:x})}),F(S(f,P(Ve),H(_o)),r),F(S(s,G(f),P(([,m])=>m!==void 0),Y(),H(([,m])=>m.ranges)),t),{getState:d,restoreStateFrom:f}},X(Ht,at,le,Pt,De));function _o(t){return{align:"start",index:0,offset:t.scrollTop}}const No=$(([{topItemsIndexes:t}])=>{const e=w(0);return F(S(e,P(n=>n>=0),H(n=>Array.from({length:n}).map((o,r)=>r))),t),{topItemCount:e}},X(_t));function $n(t){let e=!1,n;return()=>(e||(e=!0,n=t()),n)}const Do=$n(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),$o=$(([{deviation:t,scrollBy:e,scrollingInProgress:n,scrollTop:o},{isAtBottom:r,isScrolling:s,lastJumpDueToItemResize:i,scrollDirection:l},{listState:c},{beforeUnshiftWith:d,gap:f,shiftWithOffset:I,sizes:p},{log:m},{recalcInProgress:C}])=>{const x=ht(S(c,G(i),bt(([,g,u,T],[{bottom:b,items:h,offsetBottom:a,totalCount:E},B])=>{const O=b+a;let z=0;return u===E&&g.length>0&&h.length>0&&(h[0].originalIndex===0&&g[0].originalIndex===0||(z=O-T,z!==0&&(z+=B))),[z,h,E,O]},[0,[],0,0]),P(([g])=>g!==0),G(o,l,n,r,m,C),P(([,g,u,T,,,b])=>!b&&!T&&g!==0&&u===se),H(([[g],,,,,u])=>(u("Upward scrolling compensation",{amount:g},mt.DEBUG),g))));function y(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&&Do()?A(t,u-g):y(-g)}),U(S(rt(ct(s,!1),t,C),P(([g,u,T])=>!g&&!T&&u!==0),H(([g,u])=>u),Lt(1)),y),F(S(I,H(g=>({top:-g}))),e),U(S(d,G(p,f),H(([g,{groupIndices:u,lastSize:T,sizeTree:b},h])=>{function a(E){return E*(T+h)}if(u.length===0)return a(g);{let E=0;const B=ne(b,0);let O=0,z=0;for(;O<g;){O++,E+=B;let V=u.length===z+1?1/0:u[z+1]-u[z]-1;O+V>g&&(E-=B,V=g-O+1),O+=V,E+=a(V),z++}return E}})),g=>{A(t,g),requestAnimationFrame(()=>{A(e,{top:g}),requestAnimationFrame(()=>{A(t,0),A(C,!1)})})}),{deviation:t}},X(at,ce,_t,Ht,Vt,Ae)),Uo=$(([t,e,n,o,r,s,i,l,c,d])=>({...t,...e,...n,...o,...r,...s,...i,...l,...c,...d}),X(Ne,Mo,Pt,Dn,Nn,jo,zo,De,Wo,Vt)),Un=$(([{data:t,defaultItemSize:e,firstItemIndex:n,fixedItemSize:o,gap:r,groupIndices:s,itemSize:i,sizeRanges:l,sizes:c,statefulTotalCount:d,totalCount:f,trackItemSizes:I},{initialItemFinalLocationReached:p,initialTopMostItemIndex:m,scrolledToInitialItem:C},x,y,g,{listState:u,topItemsIndexes:T,...b},{scrollToIndex:h},a,{topItemCount:E},{groupCounts:B},O])=>(F(b.rangeChanged,O.scrollSeekRangeChanged),F(S(O.windowViewportRect,H(z=>z.visibleHeight)),x.viewportHeight),{data:t,defaultItemHeight:e,firstItemIndex:n,fixedItemHeight:o,gap:r,groupCounts:B,initialItemFinalLocationReached:p,initialTopMostItemIndex:m,scrolledToInitialItem:C,sizeRanges:l,topItemCount:E,topItemsIndexes:T,totalCount:f,...g,groupIndices:s,itemSize:i,listState:u,scrollToIndex:h,statefulTotalCount:d,trackItemSizes:I,...b,...O,...x,sizes:c,...y}),X(Ht,le,at,Go,Po,_t,ie,$o,No,An,Uo));function Ko(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"?R.useLayoutEffect:R.useEffect;function $e(t,e,n){const o=Object.keys(e.required||{}),r=Object.keys(e.optional||{}),s=Object.keys(e.methods||{}),i=Object.keys(e.events||{}),l=R.createContext({});function c(g,u){g.propsReady&&A(g.propsReady,!1);for(const T of o){const b=g[e.required[T]];A(b,u[T])}for(const T of r)if(T in u){const b=g[e.optional[T]];A(b,u[T])}g.propsReady&&A(g.propsReady,!0)}function d(g){return s.reduce((u,T)=>(u[T]=b=>{const h=g[e.methods[T]];A(h,b)},u),{})}function f(g){return i.reduce((u,T)=>(u[T]=co(g[e.events[T]]),u),{})}const I=R.forwardRef((g,u)=>{const{children:T,...b}=g,[h]=R.useState(()=>Ce(ao(t),B=>{c(B,b)})),[a]=R.useState(sn(f,h));me(()=>{for(const B of i)B in b&&U(a[B],b[B]);return()=>{Object.values(a).map(Pe)}},[b,a,h]),me(()=>{c(h,b)}),R.useImperativeHandle(u,rn(d(h)));const E=n;return L.jsx(l.Provider,{value:h,children:n?L.jsx(E,{...Ko([...o,...r,...i],b),children:T}):T})}),p=g=>R.useCallback(En(A,R.useContext(l)[g]),[g]),m=g=>{const T=R.useContext(l)[g],b=R.useCallback(h=>U(T,h),[T]);return R.useSyncExternalStore(b,()=>lt(T),()=>lt(T))},C=g=>{const T=R.useContext(l)[g],[b,h]=R.useState(sn(lt,T));return me(()=>U(T,a=>{a!==b&&h(rn(a))}),[T,b]),b},x=R.version.startsWith("18")?m:C;return{Component:I,useEmitter:(g,u)=>{const b=R.useContext(l)[g];me(()=>U(b,u),[u,b])},useEmitterValue:x,usePublisher:p}}const ue=R.createContext(void 0),Ue=R.createContext(void 0),Kn=typeof document<"u"?R.useLayoutEffect:R.useEffect;function qn(t,e,n,o=Gt,r,s){const i=R.useRef(null),l=R.useRef(null),c=R.useRef(null),d=R.useCallback(p=>{const m=p.target,C=m===window||m===document,x=s?C?window.pageXOffset||document.documentElement.scrollLeft:m.scrollLeft:C?window.pageYOffset||document.documentElement.scrollTop:m.scrollTop,y=s?C?document.documentElement.scrollWidth:m.scrollWidth:C?document.documentElement.scrollHeight:m.scrollHeight,g=s?C?window.innerWidth:m.offsetWidth:C?window.innerHeight:m.offsetHeight,u=()=>{t({scrollHeight:y,scrollTop:Math.max(x,0),viewportHeight:g})};p.suppressFlushSync?u():oo.flushSync(u),l.current!==null&&(x===l.current||x<=0||x===y-g)&&(l.current=null,e(!0),c.current&&(clearTimeout(c.current),c.current=null))},[t,e]);R.useEffect(()=>{const p=r||i.current;return o(r||i.current),d({suppressFlushSync:!0,target:p}),p.addEventListener("scroll",d,{passive:!0}),()=>{o(null),p.removeEventListener("scroll",d)}},[i,d,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 C=p.behavior==="smooth";let x,y,g;m===window?(y=Math.max(Ct(document.documentElement,s?"width":"height"),s?document.documentElement.scrollWidth:document.documentElement.scrollHeight),x=s?window.innerWidth:window.innerHeight,g=s?document.documentElement.scrollLeft:document.documentElement.scrollTop):(y=m[s?"scrollWidth":"scrollHeight"],x=Ct(m,s?"width":"height"),g=m[s?"scrollLeft":"scrollTop"]);const u=y-x;if(p.top=Math.ceil(Math.max(Math.min(u,p.top),0)),Gn(x,y)||p.top===g){t({scrollHeight:y,scrollTop:g,viewportHeight:x}),C&&e(!0);return}C?(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 He="-webkit-sticky",xn="sticky",Yn=$n(()=>{if(typeof document>"u")return xn;const t=document.createElement("div");return t.style.position=He,t.style.position===He?He:xn});function Ke(t){return t}const qo=$(()=>{const t=w(c=>`Item ${c}`),e=w(null),n=w(c=>`Group ${c}`),o=w({}),r=w(Ke),s=w("div"),i=w(Gt),l=(c,d=null)=>ct(S(o,H(f=>f[c]),Y()),d);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")}}),Yo=$(([t,e])=>({...t,...e}),X(Un,qo)),Zo=({height:t})=>L.jsx("div",{style:{height:t}}),Xo={overflowAnchor:"none",position:Yn(),zIndex:1},Zn={overflowAnchor:"none"},Jo={...Zn,display:"inline-block",height:"100%"},In=R.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,d=j("itemContent"),f=j("context"),I=j("groupContent"),p=j("trackItemSizes"),m=j("itemSize"),C=j("log"),x=gt("gap"),y=j("horizontalDirection"),{callbackRef:g}=kn(o,m,p,e?Gt:c,C,x,s,y,j("skipAnimationFrameInResizeObserver")),[u,T]=R.useState(0);Ze("deviation",k=>{u!==k&&T(k)});const b=j("EmptyPlaceholder"),h=j("ScrollSeekPlaceholder")||Zo,a=j("ListComponent"),E=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",...y?{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&&b?L.jsx(b,{...Z(b,f)}):L.jsx(a,{...Z(a,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?R.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"?R.createElement(B,{...Z(B,f),"data-index":q,"data-item-index":k.index,"data-known-size":k.size,key:st,style:Xo},I(k.index,f)):R.createElement(E,{...Z(E,f),...Xn(E,k.data),"data-index":q,"data-item-group-index":k.groupIndex,"data-item-index":k.index,"data-known-size":k.size,key:st,style:y?Jo:Zn},V?d(k.index,k.groupIndex,k.data,f):d(k.index,k.data,f))})})}),Qo={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},tr={outline:"none",overflowX:"auto",position:"relative"},qt=t=>({height:"100%",position:"absolute",top:0,width:"100%",...t?{display:"flex",flexDirection:"column"}:{}}),er={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 nr=R.memo(function(){const e=j("HeaderComponent"),n=gt("headerHeight"),o=j("HeaderFooterTag"),r=Et(R.useMemo(()=>i=>{n(Ct(i,"height"))},[n]),!0,j("skipAnimationFrameInResizeObserver")),s=j("context");return e?L.jsx(o,{ref:r,children:L.jsx(e,{...Z(e,s)})}):null}),or=R.memo(function(){const e=j("FooterComponent"),n=gt("footerHeight"),o=j("HeaderFooterTag"),r=Et(R.useMemo(()=>i=>{n(Ct(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 qe({useEmitter:t,useEmitterValue:e,usePublisher:n}){return R.memo(function({children:s,style:i,...l}){const c=n("scrollContainerState"),d=e("ScrollerComponent"),f=n("smoothScrollTargetReached"),I=e("scrollerRef"),p=e("context"),m=e("horizontalDirection")||!1,{scrollByCallback:C,scrollerRef:x,scrollToCallback:y}=qn(c,f,d,I,void 0,m);t("scrollTo",y),t("scrollBy",C);const g=m?tr:Qo;return L.jsx(d,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:x,style:{...g,...i},tabIndex:0,...l,...Z(d,p),children:s})})}function Ye({useEmitter:t,useEmitterValue:e,usePublisher:n}){return R.memo(function({children:s,style:i,...l}){const c=n("windowScrollContainerState"),d=e("ScrollerComponent"),f=n("smoothScrollTargetReached"),I=e("totalListHeight"),p=e("deviation"),m=e("customScrollParent"),C=e("context"),{scrollByCallback:x,scrollerRef:y,scrollToCallback:g}=qn(c,f,d,Gt,m);return Kn(()=>(y.current=m||window,()=>{y.current=null}),[y,m]),t("windowScrollTo",g),t("scrollBy",x),L.jsx(d,{"data-virtuoso-scroller":!0,style:{position:"relative",...i,...I!==0?{height:I+p}:{}},...l,...Z(d,C),children:s})})}const rr=({children:t})=>{const e=R.useContext(ue),n=gt("viewportHeight"),o=gt("fixedItemHeight"),r=j("alignToBottom"),s=j("horizontalDirection"),i=R.useMemo(()=>te(n,c=>Ct(c,s?"width":"height")),[n,s]),l=Et(i,!0,j("skipAnimationFrameInResizeObserver"));return R.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})},sr=({children:t})=>{const e=R.useContext(ue),n=gt("windowViewportRect"),o=gt("fixedItemHeight"),r=j("customScrollParent"),s=je(n,r,j("skipAnimationFrameInResizeObserver")),i=j("alignToBottom");return R.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})},ir=({children:t})=>{const e=j("TopItemListComponent")||"div",n=j("headerHeight"),o={...er,marginTop:`${n}px`},r=j("context");return L.jsx(e,{style:o,...Z(e,r),children:t})},lr=R.memo(function(e){const n=j("useWindowScroll"),o=j("topItemsIndexes").length>0,r=j("customScrollParent"),s=j("context"),i=r||n?ur:cr,l=r||n?sr:rr;return L.jsxs(i,{...e,...Z(i,s),children:[o&&L.jsx(ir,{children:L.jsx(In,{showTopList:!0})}),L.jsxs(l,{children:[L.jsx(nr,{}),L.jsx(In,{}),L.jsx(or,{})]})]})}),{Component:Jn,useEmitter:Ze,useEmitterValue:j,usePublisher:gt}=$e(Yo,{events:{atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",endReached:"endReached",groupIndices:"groupIndices",isScrolling:"isScrolling",itemsRendered:"itemsRendered",rangeChanged:"rangeChanged",startReached:"startReached",totalListHeightChanged:"totalListHeightChanged"},methods:{autoscrollToBottom:"autoscrollToBottom",getState:"getState",scrollBy:"scrollBy",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollToIndex:"scrollToIndex"},optional:{alignToBottom:"alignToBottom",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",components:"components",computeItemKey:"computeItemKey",context:"context",customScrollParent:"customScrollParent",data:"data",defaultItemHeight:"defaultItemHeight",firstItemIndex:"firstItemIndex",fixedItemHeight:"fixedItemHeight",followOutput:"followOutput",groupContent:"groupContent",groupCounts:"groupCounts",headerFooterTag:"HeaderFooterTag",horizontalDirection:"horizontalDirection",increaseViewportBy:"increaseViewportBy",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",initialTopMostItemIndex:"initialTopMostItemIndex",itemContent:"itemContent",itemSize:"itemSize",logLevel:"logLevel",overscan:"overscan",restoreStateFrom:"restoreStateFrom",scrollerRef:"scrollerRef",scrollSeekConfiguration:"scrollSeekConfiguration",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver",topItemCount:"topItemCount",totalCount:"totalCount",useWindowScroll:"useWindowScroll"},required:{}},lr),cr=qe({useEmitter:Ze,useEmitterValue:j,usePublisher:gt}),ur=Ye({useEmitter:Ze,useEmitterValue:j,usePublisher:gt}),ar=Jn,dr=Jn,fr=$(()=>{const t=w(c=>L.jsxs("td",{children:["Item $",c]})),e=w(null),n=w(null),o=w(null),r=w({}),s=w(Ke),i=w(Gt),l=(c,d=null)=>ct(S(r,H(f=>f[c]),Y()),d);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")}}),mr=$(([t,e])=>({...t,...e}),X(Un,fr)),pr=({height:t})=>L.jsx("tr",{children:L.jsx("td",{style:{height:t}})}),hr=({height:t})=>L.jsx("tr",{children:L.jsx("td",{style:{border:0,height:t,padding:0}})}),gr={overflowAnchor:"none"},Sn=R.memo(function({showTopList:e=!1}){const n=W("listState"),o=W("computeItemKey"),r=W("firstItemIndex"),s=W("isSeeking"),i=W("ScrollSeekPlaceholder")||pr,l=W("context"),c=W("TableRowComponent"),d=W("fixedHeaderHeight"),f=W("itemContent"),I=(e?n.topItems:[]).reduce((m,C,x)=>(x===0?m.push(C.size):m.push(m[x-1]+C.size),m),[]),p=(e?n.topItems:n.items).map(m=>{const C=m.originalIndex,x=o(C+r,m.data,l),y=e?C===0?0:I[C-1]:0;return s?R.createElement(i,{...Z(i,l),height:m.size,index:m.index,key:x,type:m.type||"item"}):R.createElement(c,{...Z(c,l),...Xn(c,m.data),"data-index":C,"data-item-index":m.index,"data-known-size":m.size,key:x,style:e?{overflowAnchor:"none",position:"sticky",top:d+y,zIndex:2}:gr},f(m.index,m.data,l))});return L.jsx(L.Fragment,{children:p})}),xr=R.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,d=W("trackItemSizes"),f=W("itemSize"),I=W("log"),{callbackRef:p,ref:m}=kn(o,f,d,c,I,void 0,s,!1,W("skipAnimationFrameInResizeObserver")),[C,x]=R.useState(0);Xe("deviation",V=>{C!==V&&(m.current.style.marginTop=`${V}px`,x(V))});const y=W("EmptyPlaceholder"),g=W("FillerRow")||hr,u=W("TableBodyComponent"),T=W("paddingTopAddition"),b=W("statefulTotalCount"),h=W("context");if(b===0&&y)return L.jsx(y,{...Z(y,h)});const a=(n?e.topItems:[]).reduce((V,N)=>V+N.size,0),E=e.offsetTop+T+C-a,B=e.offsetBottom,O=E>0?L.jsx(g,{context:h,height:E},"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(Sn,{showTopList:!0}),L.jsx(Sn,{}),z]})}),Ir=({children:t})=>{const e=R.useContext(ue),n=Tt("viewportHeight"),o=Tt("fixedItemHeight"),r=Et(R.useMemo(()=>te(n,s=>Ct(s,"height")),[n]),!0,W("skipAnimationFrameInResizeObserver"));return R.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})},Sr=({children:t})=>{const e=R.useContext(ue),n=Tt("windowViewportRect"),o=Tt("fixedItemHeight"),r=W("customScrollParent"),s=je(n,r,W("skipAnimationFrameInResizeObserver"));return R.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})},Tr=R.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"),d=Et(R.useMemo(()=>te(r,u=>Ct(u,"height")),[r]),!0,W("skipAnimationFrameInResizeObserver")),f=Et(R.useMemo(()=>te(s,u=>Ct(u,"height")),[s]),!0,W("skipAnimationFrameInResizeObserver")),I=o||n?yr:Cr,p=o||n?Sr:Ir,m=W("TableComponent"),C=W("TableHeadComponent"),x=W("TableFooterComponent"),y=i?L.jsx(C,{ref:d,style:{position:"sticky",top:0,zIndex:2},...Z(C,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:[y,L.jsx(xr,{},"TableBody"),g]})})})}),{Component:wr,useEmitter:Xe,useEmitterValue:W,usePublisher:Tt}=$e(mr,{events:{atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",endReached:"endReached",groupIndices:"groupIndices",isScrolling:"isScrolling",itemsRendered:"itemsRendered",rangeChanged:"rangeChanged",startReached:"startReached",totalListHeightChanged:"totalListHeightChanged"},methods:{getState:"getState",scrollBy:"scrollBy",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollToIndex:"scrollToIndex"},optional:{alignToBottom:"alignToBottom",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",components:"components",computeItemKey:"computeItemKey",context:"context",customScrollParent:"customScrollParent",data:"data",defaultItemHeight:"defaultItemHeight",firstItemIndex:"firstItemIndex",fixedFooterContent:"fixedFooterContent",fixedHeaderContent:"fixedHeaderContent",fixedItemHeight:"fixedItemHeight",followOutput:"followOutput",groupCounts:"groupCounts",increaseViewportBy:"increaseViewportBy",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",initialTopMostItemIndex:"initialTopMostItemIndex",itemContent:"itemContent",itemSize:"itemSize",logLevel:"logLevel",overscan:"overscan",restoreStateFrom:"restoreStateFrom",scrollerRef:"scrollerRef",scrollSeekConfiguration:"scrollSeekConfiguration",topItemCount:"topItemCount",totalCount:"totalCount",useWindowScroll:"useWindowScroll"},required:{}},Tr),Cr=qe({useEmitter:Xe,useEmitterValue:W,usePublisher:Tt}),yr=Ye({useEmitter:Xe,useEmitterValue:W,usePublisher:Tt}),vr=wr,Tn={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},br={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:wn,floor:Te,max:Qt,min:ke,round:Cn}=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 Rr(t){return{...br,items:t}}function pe(t,e){return t&&t.width===e.width&&t.height===e.height}function Er(t,e){return t&&t.column===e.column&&t.row===e.row}const Hr=$(([{increaseViewportBy:t,listBoundary:e,overscan:n,visibleRange:o},{footerHeight:r,headerHeight:s,scrollBy:i,scrollContainerState:l,scrollTo:c,scrollTop:d,smoothScrollTargetReached:f,viewportHeight:I},p,m,{didMount:C,propsReady:x},{customScrollParent:y,useWindowScroll:g,windowScrollContainerState:u,windowScrollTo:T,windowViewportRect:b},h])=>{const a=w(0),E=w(0),B=w(Tn),O=w({height:0,width:0}),z=w({height:0,width:0}),V=D(),N=D(),J=w(0),nt=w(null),k=w({column:0,row:0}),q=D(),st=D(),dt=w(!1),It=w(0),ft=w(!0),ut=w(!1),Mt=w(!1);U(S(C,G(It),P(([v,_])=>!!_)),()=>{A(ft,!1)}),U(S(rt(C,ft,z,O,It,ut),P(([v,_,Q,it,,tt])=>v&&!_&&Q.height!==0&&it.height!==0&&!tt)),([,,,,v])=>{A(ut,!0),Ge(1,()=>{A(V,v)}),Rt(S(d),()=>{A(e,[0,0]),A(ft,!0)})}),F(S(st,P(v=>v!=null&&v.scrollTop>0),vt(0)),E),U(S(C,G(st),P(([,v])=>v!=null)),([,v])=>{v&&(A(O,v.viewport),A(z,v.item),A(k,v.gap),v.scrollTop>0&&(A(dt,!0),Rt(S(d,Ut(1)),_=>{A(dt,!1)}),A(c,{top:v.scrollTop})))}),F(S(O,H(({height:v})=>v)),I),F(S(rt(M(O,pe),M(z,pe),M(k,(v,_)=>v&&v.column===_.column&&v.row===_.row),M(d)),H(([v,_,Q,it])=>({gap:Q,item:_,scrollTop:it,viewport:v}))),q),F(S(rt(M(a),o,M(k,Er),M(z,pe),M(O,pe),M(nt),M(E),M(dt),M(ft),M(It)),P(([,,,,,,,v])=>!v),H(([v,[_,Q],it,tt,Bt,Zt,Nt,,ae,Ot])=>{const{column:Ft,row:Xt}=it,{height:de,width:be}=tt,{width:Je}=Bt;if(Nt===0&&(v===0||Je===0))return Tn;if(be===0){const on=_e(Ot,v),no=on+Math.max(Nt-1,0);return Rr(yn(on,no,Zt))}const fe=Qn(Je,be,Ft);let Dt,At;ae?_===0&&Q===0&&Nt>0?(Dt=0,At=Nt-1):(Dt=fe*Te((_+Xt)/(de+Xt)),At=fe*wn((Q+Xt)/(de+Xt))-1,At=ke(v-1,Qt(At,fe-1)),Dt=ke(At,Qt(0,Dt))):(Dt=0,At=-1);const Qe=yn(Dt,At,Zt),{bottom:tn,top:en}=vn(Bt,it,tt,Qe),nn=wn(v/fe),eo=nn*de+(nn-1)*Xt-tn;return{bottom:tn,itemHeight:de,items:Qe,itemWidth:be,offsetBottom:eo,offsetTop:en,top:en}})),B),F(S(nt,P(v=>v!==null),H(v=>v.length)),a),F(S(rt(O,z,B,k),P(([v,_,{items:Q}])=>Q.length>0&&_.height!==0&&v.height!==0),H(([v,_,{items:Q},it])=>{const{bottom:tt,top:Bt}=vn(v,it,_,Q);return[Bt,tt]}),Y(oe)),e);const St=w(!1);F(S(d,G(St),H(([v,_])=>_||v!==0)),St);const Yt=ht(S(rt(B,a),P(([{items:v}])=>v.length>0),G(St),P(([[v,_],Q])=>{const tt=v.items[v.items.length-1].index===_-1;return(Q||v.bottom>0&&v.itemHeight>0&&v.offsetBottom===0&&v.items.length===_)&&tt}),H(([[,v]])=>v-1),Y())),jt=ht(S(M(B),P(({items:v})=>v.length>0&&v[0].index===0),vt(0),Y())),yt=ht(S(M(B),G(dt),P(([{items:v},_])=>v.length>0&&!_),H(([{items:v}])=>({endIndex:v[v.length-1].index,startIndex:v[0].index})),Y(Vn),Lt(0)));F(yt,m.scrollSeekRangeChanged),F(S(V,G(O,z,a,k),H(([v,_,Q,it,tt])=>{const Bt=Wn(v),{align:Zt,behavior:Nt,offset:ae}=Bt;let Ot=Bt.index;Ot==="LAST"&&(Ot=it-1),Ot=Qt(0,Ot,ke(it-1,Ot));let Ft=ze(_,tt,Q,Ot);return Zt==="end"?Ft=Cn(Ft-_.height+Q.height):Zt==="center"&&(Ft=Cn(Ft-_.height/2+Q.height/2)),ae&&(Ft+=ae),{behavior:Nt,top:Ft}})),c);const kt=ct(S(B,H(v=>v.offsetBottom+v.bottom)),0);return F(S(b,H(v=>({height:v.visibleHeight,width:v.visibleWidth}))),O),{customScrollParent:y,data:nt,deviation:J,footerHeight:r,gap:k,headerHeight:s,increaseViewportBy:t,initialItemCount:E,itemDimensions:z,overscan:n,restoreStateFrom:st,scrollBy:i,scrollContainerState:l,scrollHeight:N,scrollTo:c,scrollToIndex:V,scrollTop:d,smoothScrollTargetReached:f,totalCount:a,useWindowScroll:g,viewportDimensions:O,windowScrollContainerState:u,windowScrollTo:T,windowViewportRect:b,...m,gridState:B,horizontalDirection:Mt,initialTopMostItemIndex:It,totalListHeight:kt,...p,endReached:Yt,propsReady:x,rangeChanged:yt,startReached:jt,stateChanged:q,stateRestoreInProgress:dt,...h}},X(Ne,at,ce,Dn,Pt,De,Vt));function Qn(t,e,n){return Qt(1,Te((t+n)/(Te(e)+n)))}function vn(t,e,n,o){const{height:r}=n;if(r===void 0||o.length===0)return{bottom:0,top:0};const s=ze(t,e,n,o[0].index);return{bottom:ze(t,e,n,o[o.length-1].index)+r,top:s}}function ze(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 kr=$(()=>{const t=w(I=>`Item ${I}`),e=w({}),n=w(null),o=w("virtuoso-grid-item"),r=w("virtuoso-grid-list"),s=w(Ke),i=w("div"),l=w(Gt),c=(I,p=null)=>ct(S(e,H(m=>m[I]),Y()),p),d=w(!1),f=w(!1);return F(M(f),d),{components:e,computeItemKey:s,context:n,FooterComponent:c("Footer"),HeaderComponent:c("Header"),headerFooterTag:i,itemClassName:o,ItemComponent:c("Item","div"),itemContent:t,listClassName:r,ListComponent:c("List","div"),readyStateChanged:d,reportReadyState:f,ScrollerComponent:c("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:c("ScrollSeekPlaceholder","div")}}),Br=$(([t,e])=>({...t,...e}),X(Hr,kr)),Or=R.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"),d=et("ListComponent"),f=et("ScrollSeekPlaceholder"),I=et("context"),p=xt("itemDimensions"),m=xt("gap"),C=et("log"),x=et("stateRestoreInProgress"),y=xt("reportReadyState"),g=Et(R.useMemo(()=>u=>{const T=u.parentElement.parentElement.scrollHeight;l(T);const b=u.firstChild;if(b){const{height:h,width:a}=b.getBoundingClientRect();p({height:h,width:a})}m({column:bn("column-gap",getComputedStyle(u).columnGap,C),row:bn("row-gap",getComputedStyle(u).rowGap,C)})},[l,p,m,C]),!0,!1);return Kn(()=>{e.itemHeight>0&&e.itemWidth>0&&y(!0)},[e]),x?null:L.jsx(d,{className:n,ref:g,...Z(d,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):R.createElement(c,{...Z(c,I),className:o,"data-index":u.index,key:T},r(u.index,u.data,I))})})}),Fr=R.memo(function(){const e=et("HeaderComponent"),n=xt("headerHeight"),o=et("headerFooterTag"),r=Et(R.useMemo(()=>i=>{n(Ct(i,"height"))},[n]),!0,!1),s=et("context");return e?L.jsx(o,{ref:r,children:L.jsx(e,{...Z(e,s)})}):null}),Lr=R.memo(function(){const e=et("FooterComponent"),n=xt("footerHeight"),o=et("headerFooterTag"),r=Et(R.useMemo(()=>i=>{n(Ct(i,"height"))},[n]),!0,!1),s=et("context");return e?L.jsx(o,{ref:r,children:L.jsx(e,{...Z(e,s)})}):null}),zr=({children:t})=>{const e=R.useContext(Ue),n=xt("itemDimensions"),o=xt("viewportDimensions"),r=Et(R.useMemo(()=>s=>{o(s.getBoundingClientRect())},[o]),!0,!1);return R.useEffect(()=>{e&&(o({height:e.viewportHeight,width:e.viewportWidth}),n({height:e.itemHeight,width:e.itemWidth}))},[e,o,n]),L.jsx("div",{ref:r,style:qt(!1),children:t})},Vr=({children:t})=>{const e=R.useContext(Ue),n=xt("windowViewportRect"),o=xt("itemDimensions"),r=et("customScrollParent"),s=je(n,r,!1);return R.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})},Pr=R.memo(function({...e}){const n=et("useWindowScroll"),o=et("customScrollParent"),r=o||n?Ar:jr,s=o||n?Vr:zr,i=et("context");return L.jsx(r,{...e,...Z(r,i),children:L.jsxs(s,{children:[L.jsx(Fr,{}),L.jsx(Or,{}),L.jsx(Lr,{})]})})}),{Component:Mr,useEmitter:to,useEmitterValue:et,usePublisher:xt}=$e(Br,{events:{atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",endReached:"endReached",isScrolling:"isScrolling",rangeChanged:"rangeChanged",readyStateChanged:"readyStateChanged",startReached:"startReached",stateChanged:"stateChanged"},methods:{scrollBy:"scrollBy",scrollTo:"scrollTo",scrollToIndex:"scrollToIndex"},optional:{components:"components",computeItemKey:"computeItemKey",context:"context",customScrollParent:"customScrollParent",data:"data",headerFooterTag:"headerFooterTag",increaseViewportBy:"increaseViewportBy",initialItemCount:"initialItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",itemClassName:"itemClassName",itemContent:"itemContent",listClassName:"listClassName",logLevel:"logLevel",overscan:"overscan",restoreStateFrom:"restoreStateFrom",scrollerRef:"scrollerRef",scrollSeekConfiguration:"scrollSeekConfiguration",totalCount:"totalCount",useWindowScroll:"useWindowScroll"}},Pr),jr=qe({useEmitter:to,useEmitterValue:et,usePublisher:xt}),Ar=Ye({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 Wr=Mr;exports.GroupedVirtuoso=dr;exports.LogLevel=mt;exports.TableVirtuoso=vr;exports.Virtuoso=ar;exports.VirtuosoGrid=Wr;exports.VirtuosoGridMockContext=Ue;exports.VirtuosoMockContext=ue;