react-virtuoso
Advanced tools
Comparing version 2.19.0 to 2.19.1
@@ -1,2 +0,2 @@ | ||
"use strict";var e=require("@virtuoso.dev/react-urx"),t=require("@virtuoso.dev/urx"),n=require("react"),o=require("react-dom");function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t}var i=r(t),a=r(n);function l(){return l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},l.apply(this,arguments)}function s(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)t.indexOf(n=i[o])>=0||(r[n]=e[n]);return r}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function c(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var m,f,d="undefined"!=typeof document?n.useLayoutEffect:n.useEffect;exports.LogLevel=void 0,(f=exports.LogLevel||(exports.LogLevel={}))[f.DEBUG=0]="DEBUG",f[f.INFO=1]="INFO",f[f.WARN=2]="WARN",f[f.ERROR=3]="ERROR";var p=((m={})[exports.LogLevel.DEBUG]="debug",m[exports.LogLevel.INFO]="log",m[exports.LogLevel.WARN]="warn",m[exports.LogLevel.ERROR]="error",m),h=i.system(function(){var e=i.statefulStream(exports.LogLevel.ERROR);return{log:i.statefulStream(function(t,n,o){var r;void 0===o&&(o=exports.LogLevel.INFO),o>=(null!=(r=("undefined"==typeof globalThis?window:globalThis).VIRTUOSO_LOG_LEVEL)?r:i.getValue(e))&&console[p[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function g(e,t){void 0===t&&(t=!0);var o=n.useRef(null),r=function(e){};if("undefined"!=typeof ResizeObserver){var i=new ResizeObserver(function(t){var n=t[0].target;null!==n.offsetParent&&e(n)});r=function(e){e&&t?(i.observe(e),o.current=e):(o.current&&i.unobserve(o.current),o.current=null)}}return{ref:o,callbackRef:r}}function v(e,t){return void 0===t&&(t=!0),g(e,t).callbackRef}function S(e,t,n,o,r,i,a){return g(function(n){for(var l=function(e,t,n,o){var r=e.length;if(0===r)return null;for(var i=[],a=0;a<r;a++){var l=e.item(a);if(l&&void 0!==l.dataset.index){var s=parseInt(l.dataset.index),u=parseFloat(l.dataset.knownSize),c=t(l,"offsetHeight");if(0===c&&o("Zero-sized element, this should not happen",{child:l},exports.LogLevel.ERROR),c!==u){var m=i[i.length-1];0===i.length||m.size!==c||m.endIndex!==s-1?i.push({startIndex:s,endIndex:s,size:c}):i[i.length-1].endIndex++}}}return i}(n.children,t,0,r),s=n.parentElement;!s.dataset.virtuosoScroller;)s=s.parentElement;var u="window"===s.firstElementChild.dataset.viewportType,c=a?a.scrollTop:u?window.pageYOffset||document.documentElement.scrollTop:s.scrollTop,m=a?a.scrollHeight:u?document.documentElement.scrollHeight:s.scrollHeight,f=a?a.offsetHeight:u?window.innerHeight:s.offsetHeight;o({scrollTop:Math.max(c,0),scrollHeight:m,viewportHeight:f}),null==i||i(function(e,t,n){return"normal"===t||null!=t&&t.endsWith("px")||n("row-gap was not resolved to pixel value correctly",t,exports.LogLevel.WARN),"normal"===t?0:parseInt(null!=t?t:"0",10)}(0,getComputedStyle(n).rowGap,r)),null!==l&&e(l)},n)}function C(e,t){return Math.round(e.getBoundingClientRect()[t])}function I(e,t){return Math.abs(e-t)<1.01}function x(e,t,r,a,l){void 0===a&&(a=i.noop);var s=n.useRef(null),u=n.useRef(null),c=n.useRef(null),m=n.useRef(!1),f=n.useCallback(function(n){var r=n.target,i=r===window||r===document,a=i?window.pageYOffset||document.documentElement.scrollTop:r.scrollTop,l=i?document.documentElement.scrollHeight:r.scrollHeight,s=i?window.innerHeight:r.offsetHeight,f=function(){e({scrollTop:Math.max(a,0),scrollHeight:l,viewportHeight:s})};m.current?o.flushSync(f):f(),m.current=!1,null!==u.current&&(a===u.current||a<=0||a===l-s)&&(u.current=null,t(!0),c.current&&(clearTimeout(c.current),c.current=null))},[e,t]);return n.useEffect(function(){var e=l||s.current;return a(l||s.current),f({target:e}),e.addEventListener("scroll",f,{passive:!0}),function(){a(null),e.removeEventListener("scroll",f)}},[s,f,r,a,l]),{scrollerRef:s,scrollByCallback:function(e){m.current=!0,s.current.scrollBy(e)},scrollToCallback:function(n){var o=s.current;if(o&&(!("offsetHeight"in o)||0!==o.offsetHeight)){var r,i,a,l="smooth"===n.behavior;if(o===window?(i=Math.max(C(document.documentElement,"height"),document.documentElement.scrollHeight),r=window.innerHeight,a=document.documentElement.scrollTop):(i=o.scrollHeight,r=C(o,"height"),a=o.scrollTop),n.top=Math.ceil(Math.max(Math.min(i-r,n.top),0)),I(r,i)||n.top===a)return e({scrollTop:a,scrollHeight:i,viewportHeight:r}),void(l&&t(!0));l?(u.current=n.top,c.current&&clearTimeout(c.current),c.current=setTimeout(function(){c.current=null,u.current=null,t(!0)},1e3)):u.current=null,o.scrollTo(n)}}}}var T=i.system(function(){var e=i.stream(),t=i.stream(),n=i.statefulStream(0),o=i.stream(),r=i.statefulStream(0),a=i.stream(),l=i.stream(),s=i.statefulStream(0),u=i.statefulStream(0),c=i.statefulStream(0),m=i.statefulStream(0),f=i.stream(),d=i.stream(),p=i.statefulStream(!1),h=i.statefulStream(!1);return i.connect(i.pipe(e,i.map(function(e){return e.scrollTop})),t),i.connect(i.pipe(e,i.map(function(e){return e.scrollHeight})),l),i.connect(t,r),{scrollContainerState:e,scrollTop:t,viewportHeight:a,headerHeight:s,fixedHeaderHeight:u,fixedFooterHeight:c,footerHeight:m,scrollHeight:l,smoothScrollTargetReached:o,react18ConcurrentRendering:h,scrollTo:f,scrollBy:d,statefulScrollTop:r,deviation:n,scrollingInProgress:p}},[],{singleton:!0}),w={lvl:0};function b(e,t,n,o,r){return void 0===o&&(o=w),void 0===r&&(r=w),{k:e,v:t,lvl:n,l:o,r:r}}function y(e){return e===w}function E(){return w}function H(e,t){if(y(e))return w;var n=e.k,o=e.l,r=e.r;if(t===n){if(y(o))return r;if(y(r))return o;var i=F(o);return V(P(e,{k:i[0],v:i[1],l:B(o)}))}return V(P(e,t<n?{l:H(o,t)}:{r:H(r,t)}))}function L(e,t,n){if(void 0===n&&(n="k"),y(e))return[-Infinity,void 0];if(e[n]===t)return[e.k,e.v];if(e[n]<t){var o=L(e.r,t,n);return-Infinity===o[0]?[e.k,e.v]:o}return L(e.l,t,n)}function R(e,t,n){return y(e)?b(t,n,1):t===e.k?P(e,{k:t,v:n}):function(e){return A(W(e))}(P(e,t<e.k?{l:R(e.l,t,n)}:{r:R(e.r,t,n)}))}function k(e,t,n){if(y(e))return[];var o=e.k,r=e.v,i=e.r,a=[];return o>t&&(a=a.concat(k(e.l,t,n))),o>=t&&o<=n&&a.push({k:o,v:r}),o<=n&&(a=a.concat(k(i,t,n))),a}function z(e){return y(e)?[]:[].concat(z(e.l),[{k:e.k,v:e.v}],z(e.r))}function F(e){return y(e.r)?[e.k,e.v]:F(e.r)}function B(e){return y(e.r)?e.l:V(P(e,{r:B(e.r)}))}function P(e,t){return b(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 O(e){return y(e)||e.lvl>e.r.lvl}function V(e){var t=e.l,n=e.r,o=e.lvl;if(n.lvl>=o-1&&t.lvl>=o-1)return e;if(o>n.lvl+1){if(O(t))return W(P(e,{lvl:o-1}));if(y(t)||y(t.r))throw new Error("Unexpected empty nodes");return P(t.r,{l:P(t,{r:t.r.l}),r:P(e,{l:t.r.r,lvl:o-1}),lvl:o})}if(O(e))return A(P(e,{lvl:o-1}));if(y(n)||y(n.l))throw new Error("Unexpected empty nodes");var r=n.l,i=O(r)?n.lvl-1:n.lvl;return P(r,{l:P(e,{r:r.l,lvl:o-1}),r:A(P(n,{l:r.r,lvl:i})),lvl:r.lvl+1})}function M(e,t,n){return y(e)?[]:U(k(e,L(e,t)[0],n),function(e){return{index:e.k,value:e.v}})}function U(e,t){var n=e.length;if(0===n)return[];for(var o=t(e[0]),r=o.index,i=o.value,a=[],l=1;l<n;l++){var s=t(e[l]),u=s.index,c=s.value;a.push({start:r,end:u-1,value:i}),r=u,i=c}return a.push({start:r,end:Infinity,value:i}),a}function A(e){var t=e.r,n=e.lvl;return y(t)||y(t.r)||t.lvl!==n||t.r.lvl!==n?e:P(t,{l:P(e,{r:t.l}),lvl:n+1})}function W(e){var t=e.l;return y(t)||t.lvl!==e.lvl?e:P(t,{r:P(e,{l:t.r})})}function N(e,t,n,o){void 0===o&&(o=0);for(var r=e.length-1;o<=r;){var i=Math.floor((o+r)/2),a=n(e[i],t);if(0===a)return i;if(-1===a){if(r-o<2)return i-1;r=i-1}else{if(r===o)return i;o=i+1}}throw new Error("Failed binary finding record in array - "+e.join(",")+", searched for "+t)}function G(e,t,n){return e[N(e,t,n)]}var D=i.system(function(){return{recalcInProgress:i.statefulStream(!1)}},[],{singleton:!0});function j(e){var t=e.size,n=e.startIndex,o=e.endIndex;return function(e){return e.start===n&&(e.end===o||Infinity===e.end)&&e.value===t}}function _(e,t){var n=e.index;return t===n?0:t<n?-1:1}function K(e,t){var n=e.offset;return t===n?0:t<n?-1:1}function q(e){return{index:e.index,value:e}}function Y(e,t,n,o){var r=e,i=0,a=0,l=0,s=0;if(0!==t){l=r[s=N(r,t-1,_)].offset;var u=L(n,t-1);i=u[0],a=u[1],r.length&&r[s].size===L(n,t)[1]&&(s-=1),r=r.slice(0,s+1)}else r=[];for(var m,f=c(M(n,t,Infinity));!(m=f()).done;){var d=m.value,p=d.start,h=d.value,g=p-i,v=g*a+l+g*o;r.push({offset:v,size:h,index:p}),i=p,l=v,a=h}return{offsetTree:r,lastIndex:i,lastOffset:l,lastSize:a}}function Z(e,t){var n=t[0],o=t[1],r=t[3];n.length>0&&(0,t[2])("received item sizes",n,exports.LogLevel.DEBUG);var i=e.sizeTree,a=i,l=0;if(o.length>0&&y(i)&&2===n.length){var s=n[0].size,u=n[1].size;a=o.reduce(function(e,t){return R(R(e,t,s),t+1,u)},a)}else{var m=function(e,t){for(var n,o=y(e)?0:Infinity,r=c(t);!(n=r()).done;){var i=n.value,a=i.size,l=i.startIndex,s=i.endIndex;if(o=Math.min(o,l),y(e))e=R(e,0,a);else{var u=M(e,l-1,s+1);if(!u.some(j(i))){for(var m,f=!1,d=!1,p=c(u);!(m=p()).done;){var h=m.value,g=h.start,v=h.end,S=h.value;f?(s>=g||a===S)&&(e=H(e,g)):(d=S!==a,f=!0),v>s&&s>=g&&S!==a&&(e=R(e,s+1,S))}d&&(e=R(e,l,a))}}}return[e,o]}(a,n);a=m[0],l=m[1]}if(a===i)return e;var f=Y(e.offsetTree,l,a,r),d=f.offsetTree;return{sizeTree:a,offsetTree:d,lastIndex:f.lastIndex,lastOffset:f.lastOffset,lastSize:f.lastSize,groupOffsetTree:o.reduce(function(e,t){return R(e,t,J(t,d,r))},E()),groupIndices:o}}function J(e,t,n){if(0===t.length)return 0;var o=G(t,e,_),r=e-o.index,i=o.size*r+(r-1)*n+o.offset;return i>0?i+n:i}function $(e,t,n){if(function(e){return void 0!==e.groupIndex}(e))return t.groupIndices[e.groupIndex]+1;var o=Q("LAST"===e.index?n:e.index,t);return Math.max(0,o,Math.min(n,o))}function Q(e,t){if(!X(t))return e;for(var n=0;t.groupIndices[n]<=e+n;)n++;return e+n}function X(e){return!y(e.groupOffsetTree)}var ee={offsetHeight:"height",offsetWidth:"width"},te=i.system(function(e){var t=e[0].log,n=e[1].recalcInProgress,o=i.stream(),r=i.stream(),a=i.statefulStreamFromEmitter(r,0),s=i.stream(),u=i.stream(),c=i.statefulStream(0),m=i.statefulStream([]),f=i.statefulStream(void 0),d=i.statefulStream(void 0),p=i.statefulStream(function(e,t){return C(e,ee[t])}),h=i.statefulStream(void 0),g=i.statefulStream(0),v={offsetTree:[],sizeTree:E(),groupOffsetTree:E(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},S=i.statefulStreamFromEmitter(i.pipe(o,i.withLatestFrom(m,t,g),i.scan(Z,v),i.distinctUntilChanged()),v);i.connect(i.pipe(m,i.filter(function(e){return e.length>0}),i.withLatestFrom(S,g),i.map(function(e){var t=e[0],n=e[1],o=e[2],r=t.reduce(function(e,t,r){return R(e,t,J(t,n.offsetTree,o)||r)},E());return l({},n,{groupIndices:t,groupOffsetTree:r})})),S),i.connect(i.pipe(r,i.withLatestFrom(S),i.filter(function(e){return e[0]<e[1].lastIndex}),i.map(function(e){var t=e[1];return[{startIndex:e[0],endIndex:t.lastIndex,size:t.lastSize}]})),o),i.connect(f,d);var I=i.statefulStreamFromEmitter(i.pipe(f,i.map(function(e){return void 0===e})),!0);i.connect(i.pipe(d,i.filter(function(e){return void 0!==e&&y(i.getValue(S).sizeTree)}),i.map(function(e){return[{startIndex:0,endIndex:0,size:e}]})),o);var x=i.streamFromEmitter(i.pipe(o,i.withLatestFrom(S),i.scan(function(e,t){var n=t[1];return{changed:n!==e.sizes,sizes:n}},{changed:!1,sizes:v}),i.map(function(e){return e.changed})));i.subscribe(i.pipe(c,i.scan(function(e,t){return{diff:e.prev-t,prev:t}},{diff:0,prev:0}),i.map(function(e){return e.diff})),function(e){e>0?(i.publish(n,!0),i.publish(s,e)):e<0&&i.publish(u,e)}),i.subscribe(i.pipe(c,i.withLatestFrom(t)),function(e){e[0]<0&&(0,e[1])("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:c},exports.LogLevel.ERROR)});var T=i.streamFromEmitter(s);i.connect(i.pipe(s,i.withLatestFrom(S),i.map(function(e){var t=e[0],n=e[1];if(n.groupIndices.length>0)throw new Error("Virtuoso: prepending items does not work with groups");return z(n.sizeTree).reduce(function(e,n){var o=n.k,r=n.v;return{ranges:[].concat(e.ranges,[{startIndex:e.prevIndex,endIndex:o+t-1,size:e.prevSize}]),prevIndex:o+t,prevSize:r}},{ranges:[],prevIndex:0,prevSize:n.lastSize}).ranges})),o);var w=i.streamFromEmitter(i.pipe(u,i.withLatestFrom(S,g),i.map(function(e){return J(-e[0],e[1].offsetTree,e[2])})));return i.connect(i.pipe(u,i.withLatestFrom(S,g),i.map(function(e){var t=e[0],n=e[1],o=e[2];if(n.groupIndices.length>0)throw new Error("Virtuoso: shifting items does not work with groups");var r=z(n.sizeTree).reduce(function(e,n){var o=n.v;return R(e,Math.max(0,n.k+t),o)},E());return l({},n,{sizeTree:r},Y(n.offsetTree,0,r,o))})),S),{data:h,totalCount:r,sizeRanges:o,groupIndices:m,defaultItemSize:d,fixedItemSize:f,unshiftWith:s,shiftWith:u,shiftWithOffset:w,beforeUnshiftWith:T,firstItemIndex:c,gap:g,sizes:S,listRefresh:x,statefulTotalCount:a,trackItemSizes:I,itemSize:p}},i.tup(h,D),{singleton:!0}),ne="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style;function oe(e){var t="number"==typeof e?{index:e}:e;return t.align||(t.align="start"),t.behavior&&ne||(t.behavior="auto"),t.offset||(t.offset=0),t}var re=i.system(function(e){var t=e[0],n=t.sizes,o=t.totalCount,r=t.listRefresh,a=t.gap,l=e[1],s=l.scrollingInProgress,u=l.viewportHeight,c=l.scrollTo,m=l.smoothScrollTargetReached,f=l.headerHeight,d=l.footerHeight,p=l.fixedHeaderHeight,h=l.fixedFooterHeight,g=e[2].log,v=i.stream(),S=i.statefulStream(0),C=null,I=null,x=null;function T(){C&&(C(),C=null),x&&(x(),x=null),I&&(clearTimeout(I),I=null),i.publish(s,!1)}return i.connect(i.pipe(v,i.withLatestFrom(n,u,o,S,f,d,g),i.withLatestFrom(a,p,h),i.map(function(e){var t=e[0],n=t[0],o=t[1],a=t[2],l=t[3],u=t[4],c=t[5],f=t[6],d=t[7],p=e[1],h=e[2],g=e[3],S=oe(n),w=S.align,b=S.behavior,y=S.offset,E=l-1,H=$(S,o,E),R=J(H,o.offsetTree,p)+c;"end"===w?(R+=h+L(o.sizeTree,H)[1]-a+g,H===E&&(R+=f)):"center"===w?R+=(h+L(o.sizeTree,H)[1]-a+g)/2:R-=u,y&&(R+=y);var k=function(e){T(),e?(d("retrying to scroll to",{location:n},exports.LogLevel.DEBUG),i.publish(v,n)):d("list did not change, scroll successful",{},exports.LogLevel.DEBUG)};if(T(),"smooth"===b){var z=!1;x=i.subscribe(r,function(e){z=z||e}),C=i.handleNext(m,function(){k(z)})}else C=i.handleNext(i.pipe(r,function(e){var t=setTimeout(function(){e(!1)},150);return function(n){n&&(e(!0),clearTimeout(t))}}),k);return I=setTimeout(function(){T()},1200),i.publish(s,!0),d("scrolling from index to",{index:H,top:R,behavior:b},exports.LogLevel.DEBUG),{top:R,behavior:b}})),c),{scrollToIndex:v,topListHeight:S}},i.tup(te,T,h),{singleton:!0}),ie="up",ae={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},le=i.system(function(e){var t=e[0],n=t.scrollContainerState,o=t.scrollTop,r=t.viewportHeight,a=t.headerHeight,l=t.footerHeight,s=t.scrollBy,u=i.statefulStream(!1),c=i.statefulStream(!0),m=i.stream(),f=i.stream(),d=i.statefulStream(4),p=i.statefulStream(0),h=i.statefulStreamFromEmitter(i.pipe(i.merge(i.pipe(i.duc(o),i.skip(1),i.mapTo(!0)),i.pipe(i.duc(o),i.skip(1),i.mapTo(!1),i.debounceTime(100))),i.distinctUntilChanged()),!1),g=i.statefulStreamFromEmitter(i.pipe(i.merge(i.pipe(s,i.mapTo(!0)),i.pipe(s,i.mapTo(!1),i.debounceTime(200))),i.distinctUntilChanged()),!1);i.connect(i.pipe(i.combineLatest(i.duc(o),i.duc(p)),i.map(function(e){return e[0]<=e[1]}),i.distinctUntilChanged()),c),i.connect(i.pipe(c,i.throttleTime(50)),f);var v=i.streamFromEmitter(i.pipe(i.combineLatest(n,i.duc(r),i.duc(a),i.duc(l),i.duc(d)),i.scan(function(e,t){var n,o,r=t[0],i=r.scrollTop,a=r.scrollHeight,l=t[1],s={viewportHeight:l,scrollTop:i,scrollHeight:a};return i+l-a>-t[4]?(i>e.state.scrollTop?(n="SCROLLED_DOWN",o=e.state.scrollTop-i):(n="SIZE_DECREASED",o=e.state.scrollTop-i||e.scrollTopDelta),{atBottom:!0,state:s,atBottomBecause:n,scrollTopDelta:o}):{atBottom:!1,notAtBottomBecause:s.scrollHeight>e.state.scrollHeight?"SIZE_INCREASED":l<e.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":i<e.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",state:s}},ae),i.distinctUntilChanged(function(e,t){return e&&e.atBottom===t.atBottom}))),S=i.statefulStreamFromEmitter(i.pipe(n,i.scan(function(e,t){var n=t.scrollTop,o=t.scrollHeight,r=t.viewportHeight;return I(e.scrollHeight,o)?{scrollTop:n,scrollHeight:o,jump:0,changed:!1}:e.scrollTop!==n&&o-(n+r)<1?{scrollHeight:o,scrollTop:n,jump:e.scrollTop-n,changed:!0}:{scrollHeight:o,scrollTop:n,jump:0,changed:!0}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),i.filter(function(e){return e.changed}),i.map(function(e){return e.jump})),0);i.connect(i.pipe(v,i.map(function(e){return e.atBottom})),u),i.connect(i.pipe(u,i.throttleTime(50)),m);var C=i.statefulStream("down");i.connect(i.pipe(n,i.map(function(e){return e.scrollTop}),i.distinctUntilChanged(),i.scan(function(e,t){return i.getValue(g)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?ie:"down",prevScrollTop:t}},{direction:"down",prevScrollTop:0}),i.map(function(e){return e.direction})),C),i.connect(i.pipe(n,i.throttleTime(50),i.mapTo("none")),C);var x=i.statefulStream(0);return i.connect(i.pipe(h,i.filter(function(e){return!e}),i.mapTo(0)),x),i.connect(i.pipe(o,i.throttleTime(100),i.withLatestFrom(h),i.filter(function(e){return!!e[1]}),i.scan(function(e,t){return[e[1],t[0]]},[0,0]),i.map(function(e){return e[1]-e[0]})),x),{isScrolling:h,isAtTop:c,isAtBottom:u,atBottomState:v,atTopStateChange:f,atBottomStateChange:m,scrollDirection:C,atBottomThreshold:d,atTopThreshold:p,scrollVelocity:x,lastJumpDueToItemResize:S}},i.tup(T)),se=i.system(function(e){var t=e[0].log,n=i.statefulStream(!1),o=i.streamFromEmitter(i.pipe(n,i.filter(function(e){return e}),i.distinctUntilChanged()));return i.subscribe(n,function(e){e&&i.getValue(t)("props updated",{},exports.LogLevel.DEBUG)}),{propsReady:n,didMount:o}},i.tup(h),{singleton:!0}),ue=i.system(function(e){var t=e[0],n=t.sizes,o=t.listRefresh,r=t.defaultItemSize,a=e[1].scrollTop,l=e[2].scrollToIndex,s=e[3].didMount,u=i.statefulStream(!0),c=i.statefulStream(0);return i.connect(i.pipe(s,i.withLatestFrom(c),i.filter(function(e){return!!e[1]}),i.mapTo(!1)),u),i.subscribe(i.pipe(i.combineLatest(o,s),i.withLatestFrom(u,n,r),i.filter(function(e){var t=e[1],n=e[3];return e[0][1]&&(!y(e[2].sizeTree)||void 0!==n)&&!t}),i.withLatestFrom(c)),function(e){var t=e[1];setTimeout(function(){i.handleNext(a,function(){i.publish(u,!0)}),i.publish(l,t)})}),{scrolledToInitialItem:u,initialTopMostItemIndex:c}},i.tup(te,T,re,se),{singleton:!0});function ce(e){return!!e&&("smooth"===e?"smooth":"auto")}var me=i.system(function(e){var t=e[0],n=t.totalCount,o=t.listRefresh,r=e[1],a=r.isAtBottom,l=r.atBottomState,s=e[2].scrollToIndex,u=e[3].scrolledToInitialItem,c=e[4],m=c.propsReady,f=c.didMount,d=e[5].log,p=e[6].scrollingInProgress,h=i.statefulStream(!1),g=i.stream(),v=null;function S(e){i.publish(s,{index:"LAST",align:"end",behavior:e})}function C(e){var t=i.handleNext(l,function(t){!e||t.atBottom||"SIZE_INCREASED"!==t.notAtBottomBecause||v||(i.getValue(d)("scrolling to bottom due to increased size",{},exports.LogLevel.DEBUG),S("auto"))});setTimeout(t,100)}return i.subscribe(i.pipe(i.combineLatest(i.pipe(i.duc(n),i.skip(1)),f),i.withLatestFrom(i.duc(h),a,u,p),i.map(function(e){var t=e[0],n=t[0],o=t[1]&&e[3],r="auto";return o&&(r=function(e,t){return"function"==typeof e?ce(e(t)):t&&ce(e)}(e[1],e[2]||e[4]),o=o&&!!r),{totalCount:n,shouldFollow:o,followOutputBehavior:r}}),i.filter(function(e){return e.shouldFollow})),function(e){var t=e.totalCount,n=e.followOutputBehavior;v&&(v(),v=null),v=i.handleNext(o,function(){i.getValue(d)("following output to ",{totalCount:t},exports.LogLevel.DEBUG),S(n),v=null})}),i.subscribe(i.pipe(i.combineLatest(i.duc(h),n,m),i.filter(function(e){return e[0]&&e[2]}),i.scan(function(e,t){var n=t[1];return{refreshed:e.value===n,value:n}},{refreshed:!1,value:0}),i.filter(function(e){return e.refreshed}),i.withLatestFrom(h,n)),function(e){C(!1!==e[1])}),i.subscribe(g,function(){C(!1!==i.getValue(h))}),i.subscribe(i.combineLatest(i.duc(h),l),function(e){var t=e[1];e[0]&&!t.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===t.notAtBottomBecause&&S("auto")}),{followOutput:h,autoscrollToBottom:g}},i.tup(te,le,re,ue,se,h,T));function fe(e){return e.reduce(function(e,t){return e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e},{totalCount:0,groupIndices:[]})}var de=i.system(function(e){var t=e[0],n=t.totalCount,o=t.groupIndices,r=t.sizes,a=e[1],l=a.scrollTop,s=a.headerHeight,u=i.stream(),c=i.stream(),m=i.streamFromEmitter(i.pipe(u,i.map(fe)));return i.connect(i.pipe(m,i.map(function(e){return e.totalCount})),n),i.connect(i.pipe(m,i.map(function(e){return e.groupIndices})),o),i.connect(i.pipe(i.combineLatest(l,r,s),i.filter(function(e){return X(e[1])}),i.map(function(e){return L(e[1].groupOffsetTree,Math.max(e[0]-e[2],0),"v")[0]}),i.distinctUntilChanged(),i.map(function(e){return[e]})),c),{groupCounts:u,topItemsIndexes:c}},i.tup(te,T));function pe(e,t){return!(!e||e[0]!==t[0]||e[1]!==t[1])}function he(e,t){return!(!e||e.startIndex!==t.startIndex||e.endIndex!==t.endIndex)}function ge(e,t,n){return"number"==typeof e?n===ie&&"top"===t||"down"===n&&"bottom"===t?e:0:n===ie?"top"===t?e.main:e.reverse:"bottom"===t?e.main:e.reverse}function ve(e,t){return"number"==typeof e?e:e[t]||0}var Se=i.system(function(e){var t=e[0],n=t.scrollTop,o=t.viewportHeight,r=t.deviation,a=t.headerHeight,l=t.fixedHeaderHeight,s=i.stream(),u=i.statefulStream(0),c=i.statefulStream(0),m=i.statefulStream(0),f=i.statefulStreamFromEmitter(i.pipe(i.combineLatest(i.duc(n),i.duc(o),i.duc(a),i.duc(s,pe),i.duc(m),i.duc(u),i.duc(l),i.duc(r),i.duc(c)),i.map(function(e){var t=e[0],n=e[1],o=e[2],r=e[3],i=r[0],a=r[1],l=e[4],s=e[6],u=e[7],c=e[8],m=t-u,f=e[5]+s,d=Math.max(o-m,0),p="none",h=ve(c,"top"),g=ve(c,"bottom");return i-=u,a+=o+s,(i+=o+s)>t+f-h&&(p=ie),(a-=u)<t-d+n+g&&(p="down"),"none"!==p?[Math.max(m-o-ge(l,"top",p)-h,0),m-d-s+n+ge(l,"bottom",p)+g]:null}),i.filter(function(e){return null!=e}),i.distinctUntilChanged(pe)),[0,0]);return{listBoundary:s,overscan:m,topListHeight:u,increaseViewportBy:c,visibleRange:f}},i.tup(T),{singleton:!0}),Ce={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function Ie(e,t,n){if(0===e.length)return[];if(!X(t))return e.map(function(e){return l({},e,{index:e.index+n,originalIndex:e.index})});for(var o,r=[],i=M(t.groupOffsetTree,e[0].index,e[e.length-1].index),a=void 0,s=0,u=c(e);!(o=u()).done;){var m=o.value;(!a||a.end<m.index)&&(a=i.shift(),s=t.groupIndices.indexOf(a.start)),r.push(l({},m.index===a.start?{type:"group",index:s}:{index:m.index-(s+1)+n,groupIndex:s},{size:m.size,offset:m.offset,originalIndex:m.index,data:m.data}))}return r}function xe(e,t,n,o,r,i){var a=0,l=0;if(e.length>0){a=e[0].offset;var s=e[e.length-1];l=s.offset+s.size}var u=n-r.lastIndex,c=a,m=r.lastOffset+u*r.lastSize+(u-1)*o-l;return{items:Ie(e,r,i),topItems:Ie(t,r,i),topListHeight:t.reduce(function(e,t){return t.size+e},0),offsetTop:a,offsetBottom:m,top:c,bottom:l,totalCount:n,firstItemIndex:i}}var Te=i.system(function(e){var t=e[0],n=t.sizes,o=t.totalCount,r=t.data,a=t.firstItemIndex,s=t.gap,u=e[1],m=e[2],f=m.visibleRange,d=m.listBoundary,p=m.topListHeight,h=e[3],g=h.scrolledToInitialItem,v=h.initialTopMostItemIndex,S=e[4].topListHeight,C=e[5],I=e[6].didMount,x=e[7].recalcInProgress,T=i.statefulStream([]),w=i.stream();i.connect(u.topItemsIndexes,T);var b=i.statefulStreamFromEmitter(i.pipe(i.combineLatest(I,x,i.duc(f,pe),i.duc(o),i.duc(n),i.duc(v),g,i.duc(T),i.duc(a),i.duc(s),r),i.filter(function(e){return e[0]&&!e[1]}),i.map(function(e){var t=e[2],n=t[0],o=t[1],r=e[3],a=e[5],s=e[6],u=e[7],m=e[8],f=e[9],d=e[10],p=e[4],h=p.sizeTree,g=p.offsetTree;if(0===r||0===n&&0===o)return l({},Ce,{totalCount:r});if(y(h))return xe(function(e,t,n){if(X(t)){var o=Q(e,t);return[{index:L(t.groupOffsetTree,o)[0],size:0,offset:0},{index:o,size:0,offset:0,data:n&&n[0]}]}return[{index:e,size:0,offset:0,data:n&&n[0]}]}(function(e,t){return"number"==typeof e?e:"LAST"===e.index?t-1:e.index}(a,r),p,d),[],r,f,p,m);var v=[];if(u.length>0)for(var S,C=u[0],I=u[u.length-1],x=0,T=c(M(h,C,I));!(S=T()).done;)for(var w=S.value,b=w.value,E=Math.max(w.start,C),H=Math.min(w.end,I),R=E;R<=H;R++)v.push({index:R,size:b,offset:x,data:d&&d[R]}),x+=b;if(!s)return xe([],v,r,f,p,m);var k=u.length>0?u[u.length-1]+1:0,z=function(e,t,n,o){return void 0===o&&(o=0),o>0&&(t=Math.max(t,G(e,o,_).offset)),U((i=n,l=N(r=e,t,a=K),s=N(r,i,a,l),r.slice(l,s+1)),q);var r,i,a,l,s}(g,n,o,k);if(0===z.length)return null;var F=r-1;return xe(i.tap([],function(e){for(var t,r=c(z);!(t=r()).done;){var i=t.value,a=i.value,l=a.offset,s=i.start,u=a.size;if(a.offset<n){var m=(s+=Math.floor((n-a.offset+f)/(u+f)))-i.start;l+=m*u+m*f}s<k&&(l+=(k-s)*u,s=k);for(var p=Math.min(i.end,F),h=s;h<=p&&!(l>=o);h++)e.push({index:h,size:u,offset:l,data:d&&d[h]}),l+=u+f}}),v,r,f,p,m)}),i.filter(function(e){return null!==e}),i.distinctUntilChanged()),Ce);return i.connect(i.pipe(r,i.filter(function(e){return void 0!==e}),i.map(function(e){return e.length})),o),i.connect(i.pipe(b,i.map(function(e){return e.topListHeight})),S),i.connect(S,p),i.connect(i.pipe(b,i.map(function(e){return[e.top,e.bottom]})),d),i.connect(i.pipe(b,i.map(function(e){return e.items})),w),l({listState:b,topItemsIndexes:T,endReached:i.streamFromEmitter(i.pipe(b,i.filter(function(e){return e.items.length>0}),i.withLatestFrom(o,r),i.filter(function(e){var t=e[0].items;return t[t.length-1].originalIndex===e[1]-1}),i.map(function(e){return[e[1]-1,e[2]]}),i.distinctUntilChanged(pe),i.map(function(e){return e[0]}))),startReached:i.streamFromEmitter(i.pipe(b,i.throttleTime(200),i.filter(function(e){var t=e.items;return t.length>0&&t[0].originalIndex===e.topItems.length}),i.map(function(e){return e.items[0].index}),i.distinctUntilChanged())),rangeChanged:i.streamFromEmitter(i.pipe(b,i.filter(function(e){return e.items.length>0}),i.map(function(e){for(var t=e.items,n=0,o=t.length-1;"group"===t[n].type&&n<o;)n++;for(;"group"===t[o].type&&o>n;)o--;return{startIndex:t[n].index,endIndex:t[o].index}}),i.distinctUntilChanged(he))),itemsRendered:w},C)},i.tup(te,de,Se,ue,re,le,se,D),{singleton:!0}),we=i.system(function(e){var t=e[0],n=t.sizes,o=t.firstItemIndex,r=t.data,a=t.gap,l=e[1].listState,s=e[2].didMount,u=i.statefulStream(0);return i.connect(i.pipe(s,i.withLatestFrom(u),i.filter(function(e){return 0!==e[1]}),i.withLatestFrom(n,o,a,r),i.map(function(e){var t=e[0][1],n=e[1],o=e[2],r=e[3],i=e[4],a=void 0===i?[]:i,l=0;if(n.groupIndices.length>0)for(var s,u=c(n.groupIndices);!((s=u()).done||s.value-l>=t);)l++;var m=t+l;return xe(Array.from({length:m}).map(function(e,t){return{index:t,size:0,offset:0,data:a[t]}}),[],m,r,n,o)})),l),{initialItemCount:u}},i.tup(te,Te,se),{singleton:!0}),be=i.system(function(e){var t=e[0].scrollVelocity,n=i.statefulStream(!1),o=i.stream(),r=i.statefulStream(!1);return i.connect(i.pipe(t,i.withLatestFrom(r,n,o),i.filter(function(e){return!!e[1]}),i.map(function(e){var t=e[0],n=e[1],o=e[2],r=e[3],i=n.enter;if(o){if((0,n.exit)(t,r))return!1}else if(i(t,r))return!0;return o}),i.distinctUntilChanged()),n),i.subscribe(i.pipe(i.combineLatest(n,t,o),i.withLatestFrom(r)),function(e){var t=e[0],n=e[1];return t[0]&&n&&n.change&&n.change(t[1],t[2])}),{isSeeking:n,scrollSeekConfiguration:r,scrollVelocity:t,scrollSeekRangeChanged:o}},i.tup(le),{singleton:!0}),ye=i.system(function(e){var t=e[0].topItemsIndexes,n=i.statefulStream(0);return i.connect(i.pipe(n,i.filter(function(e){return e>0}),i.map(function(e){return Array.from({length:e}).map(function(e,t){return t})})),t),{topItemCount:n}},i.tup(Te)),Ee=i.system(function(e){var t=e[0],n=t.footerHeight,o=t.headerHeight,r=t.fixedHeaderHeight,a=t.fixedFooterHeight,l=e[1].listState,s=i.stream(),u=i.statefulStreamFromEmitter(i.pipe(i.combineLatest(n,a,o,r,l),i.map(function(e){var t=e[4];return e[0]+e[1]+e[2]+e[3]+t.offsetBottom+t.bottom})),0);return i.connect(i.duc(u),s),{totalListHeight:u,totalListHeightChanged:s}},i.tup(T,Te),{singleton:!0});function He(e){var t,n=!1;return function(){return n||(n=!0,t=e()),t}}var Le=He(function(){return/iP(ad|hone|od).+Version\/[\d.]+.*Safari/i.test(navigator.userAgent)}),Re=i.system(function(e){var t=e[0],n=t.scrollBy,o=t.scrollTop,r=t.deviation,a=t.scrollingInProgress,l=e[1],s=l.isScrolling,u=l.isAtBottom,c=l.scrollDirection,m=e[3],f=m.beforeUnshiftWith,d=m.shiftWithOffset,p=m.sizes,h=m.gap,g=e[4].log,v=e[5].recalcInProgress,S=i.streamFromEmitter(i.pipe(e[2].listState,i.withLatestFrom(l.lastJumpDueToItemResize),i.scan(function(e,t){var n=e[1],o=t[0],r=o.items,i=o.totalCount,a=o.bottom+o.offsetBottom,l=0;return e[2]===i&&n.length>0&&r.length>0&&(0===r[0].originalIndex&&0===n[0].originalIndex||0!=(l=a-e[3])&&(l+=t[1])),[l,r,i,a]},[0,[],0,0]),i.filter(function(e){return 0!==e[0]}),i.withLatestFrom(o,c,a,u,g),i.filter(function(e){return!e[3]&&0!==e[1]&&e[2]===ie}),i.map(function(e){var t=e[0][0];return(0,e[5])("Upward scrolling compensation",{amount:t},exports.LogLevel.DEBUG),t})));function C(e){e>0?(i.publish(n,{top:-e,behavior:"auto"}),i.publish(r,0)):(i.publish(r,0),i.publish(n,{top:-e,behavior:"auto"}))}return i.subscribe(i.pipe(S,i.withLatestFrom(r,s)),function(e){var t=e[0],n=e[1];e[2]&&Le()?i.publish(r,n-t):C(-t)}),i.subscribe(i.pipe(i.combineLatest(i.statefulStreamFromEmitter(s,!1),r,v),i.filter(function(e){return!e[0]&&!e[2]&&0!==e[1]}),i.map(function(e){return e[1]}),i.throttleTime(1)),C),i.connect(i.pipe(d,i.map(function(e){return{top:-e}})),n),i.subscribe(i.pipe(f,i.withLatestFrom(p,h),i.map(function(e){var t=e[0];return t*e[1].lastSize+t*e[2]})),function(e){i.publish(r,e),requestAnimationFrame(function(){i.publish(n,{top:e}),requestAnimationFrame(function(){i.publish(r,0),i.publish(v,!1)})})}),{deviation:r}},i.tup(T,le,Te,te,h,D)),ke=i.system(function(e){var t=e[0].totalListHeight,n=e[1].didMount,o=e[2].scrollTo,r=i.statefulStream(0);return i.subscribe(i.pipe(n,i.withLatestFrom(r),i.filter(function(e){return 0!==e[1]}),i.map(function(e){return{top:e[1]}})),function(e){i.handleNext(i.pipe(t,i.filter(function(e){return 0!==e})),function(){setTimeout(function(){i.publish(o,e)})})}),{initialScrollTop:r}},i.tup(Ee,se,T),{singleton:!0}),ze=i.system(function(e){var t=e[0].viewportHeight,n=e[1].totalListHeight,o=i.statefulStream(!1);return{alignToBottom:o,paddingTopAddition:i.statefulStreamFromEmitter(i.pipe(i.combineLatest(o,t,n),i.filter(function(e){return e[0]}),i.map(function(e){return Math.max(0,e[1]-e[2])}),i.distinctUntilChanged()),0)}},i.tup(T,Ee),{singleton:!0}),Fe=i.system(function(e){var t=e[0],n=t.scrollTo,o=t.scrollContainerState,r=i.stream(),a=i.stream(),s=i.stream(),u=i.statefulStream(!1),c=i.statefulStream(void 0);return i.connect(i.pipe(i.combineLatest(r,a),i.map(function(e){var t=e[0],n=t.viewportHeight,o=t.scrollHeight;return{scrollTop:Math.max(0,t.scrollTop-e[1].offsetTop),scrollHeight:o,viewportHeight:n}})),o),i.connect(i.pipe(n,i.withLatestFrom(a),i.map(function(e){var t=e[0];return l({},t,{top:t.top+e[1].offsetTop})})),s),{useWindowScroll:u,customScrollParent:c,windowScrollContainerState:r,windowViewportRect:a,windowScrollTo:s}},i.tup(T)),Be=["done","behavior","align"],Pe=i.system(function(e){var t=e[0],n=t.sizes,o=t.totalCount,r=t.gap,a=e[1],u=a.scrollTop,c=a.viewportHeight,m=a.headerHeight,f=a.scrollingInProgress,d=e[2].scrollToIndex,p=i.stream();return i.connect(i.pipe(p,i.withLatestFrom(n,c,o,m,u,r),i.map(function(e){var t=e[0],n=e[1],o=e[2],r=e[3],a=e[4],u=e[5],c=e[6],m=t.done,d=t.behavior,p=t.align,h=s(t,Be),g=null,v=$(t,n,r-1),S=J(v,n.offsetTree,c)+a;return S<u?g=l({},h,{behavior:d,align:null!=p?p:"start"}):S+L(n.sizeTree,v)[1]>u+o&&(g=l({},h,{behavior:d,align:null!=p?p:"end"})),g?m&&i.handleNext(i.pipe(f,i.skip(1),i.filter(function(e){return!1===e})),m):m&&m(),g}),i.filter(function(e){return null!==e})),d),{scrollIntoView:p}},i.tup(te,T,re,Te,h),{singleton:!0}),Oe=["listState","topItemsIndexes"],Ve=i.system(function(e){return l({},e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},i.tup(Se,we,se,be,Ee,ke,ze,Fe,Pe)),Me=i.system(function(e){var t=e[0],n=t.totalCount,o=t.sizeRanges,r=t.fixedItemSize,a=t.defaultItemSize,u=t.trackItemSizes,c=t.itemSize,m=t.data,f=t.firstItemIndex,d=t.groupIndices,p=t.statefulTotalCount,h=t.gap,g=e[1],v=g.initialTopMostItemIndex,S=g.scrolledToInitialItem,C=e[2],I=e[3],x=e[4],T=x.listState,w=x.topItemsIndexes,b=s(x,Oe),y=e[5].scrollToIndex,E=e[7].topItemCount,H=e[8].groupCounts,L=e[9],R=e[10];return i.connect(b.rangeChanged,L.scrollSeekRangeChanged),i.connect(i.pipe(L.windowViewportRect,i.map(function(e){return e.visibleHeight})),C.viewportHeight),l({totalCount:n,data:m,firstItemIndex:f,sizeRanges:o,initialTopMostItemIndex:v,scrolledToInitialItem:S,topItemsIndexes:w,topItemCount:E,groupCounts:H,fixedItemHeight:r,defaultItemHeight:a,gap:h},I,{statefulTotalCount:p,listState:T,scrollToIndex:y,trackItemSizes:u,itemSize:c,groupIndices:d},b,L,C,R)},i.tup(te,ue,T,me,Te,re,Re,ye,de,Ve,h)),Ue=He(function(){if("undefined"==typeof document)return"sticky";var e=document.createElement("div");return e.style.position="-webkit-sticky","-webkit-sticky"===e.style.position?"-webkit-sticky":"sticky"});function Ae(e,t){var o=n.useRef(null),r=n.useCallback(function(n){if(null!==n&&n.offsetParent){var r,i,a=n.getBoundingClientRect(),l=a.width;if(t){var s=t.getBoundingClientRect(),u=a.top-s.top;r=s.height-Math.max(0,u),i=u+t.scrollTop}else r=window.innerHeight-Math.max(0,a.top),i=a.top+window.pageYOffset;o.current={offsetTop:i,visibleHeight:r,visibleWidth:l},e(o.current)}},[e,t]),i=g(r),a=i.callbackRef,l=i.ref,s=n.useCallback(function(){r(l.current)},[r,l]);return n.useEffect(function(){if(t){t.addEventListener("scroll",s);var e=new ResizeObserver(s);return e.observe(t),function(){t.removeEventListener("scroll",s),e.unobserve(t)}}return window.addEventListener("scroll",s),window.addEventListener("resize",s),function(){window.removeEventListener("scroll",s),window.removeEventListener("resize",s)}},[s,t]),a}var We=a.createContext(void 0),Ne=["placeholder"],Ge=["style","children"],De=["style","children"];function je(e){return e}var _e=i.system(function(){var e=i.statefulStream(function(e){return"Item "+e}),t=i.statefulStream(null),n=i.statefulStream(function(e){return"Group "+e}),o=i.statefulStream({}),r=i.statefulStream(je),a=i.statefulStream("div"),l=i.statefulStream(i.noop),s=function(e,t){return void 0===t&&(t=null),i.statefulStreamFromEmitter(i.pipe(o,i.map(function(t){return t[e]}),i.distinctUntilChanged()),t)};return{context:t,itemContent:e,groupContent:n,components:o,computeItemKey:r,headerFooterTag:a,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")}});function Ke(e,t){var n=i.stream();return i.subscribe(n,function(){return console.warn("react-virtuoso: You are using a deprecated property. "+t,"color: red;","color: inherit;","color: blue;")}),i.connect(n,e),n}var qe=i.system(function(e){var t=e[0],n=e[1],o={item:Ke(n.itemContent,"Rename the %citem%c prop to %citemContent."),group:Ke(n.groupContent,"Rename the %cgroup%c prop to %cgroupContent."),topItems:Ke(t.topItemCount,"Rename the %ctopItems%c prop to %ctopItemCount."),itemHeight:Ke(t.fixedItemHeight,"Rename the %citemHeight%c prop to %cfixedItemHeight."),scrollingStateChange:Ke(t.isScrolling,"Rename the %cscrollingStateChange%c prop to %cisScrolling."),adjustForPrependedItems:i.stream(),maxHeightCacheSize:i.stream(),footer:i.stream(),header:i.stream(),HeaderContainer:i.stream(),FooterContainer:i.stream(),ItemContainer:i.stream(),ScrollContainer:i.stream(),GroupContainer:i.stream(),ListContainer:i.stream(),emptyComponent:i.stream(),scrollSeek:i.stream()};function r(e,t,o){i.connect(i.pipe(e,i.withLatestFrom(n.components),i.map(function(e){var n,r=e[0],i=e[1];return console.warn("react-virtuoso: "+o+" property is deprecated. Pass components."+t+" instead."),l({},i,((n={})[t]=r,n))})),n.components)}return i.subscribe(o.adjustForPrependedItems,function(){console.warn("react-virtuoso: adjustForPrependedItems is no longer supported. Use the firstItemIndex property instead - https://virtuoso.dev/prepend-items.","color: red;","color: inherit;","color: blue;")}),i.subscribe(o.maxHeightCacheSize,function(){console.warn("react-virtuoso: maxHeightCacheSize is no longer necessary. Setting it has no effect - remove it from your code.")}),i.subscribe(o.HeaderContainer,function(){console.warn("react-virtuoso: HeaderContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the header component and pass components.Header to change its contents.")}),i.subscribe(o.FooterContainer,function(){console.warn("react-virtuoso: FooterContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the footer component and pass components.Footer to change its contents.")}),i.subscribe(o.scrollSeek,function(e){var o=e.placeholder,r=s(e,Ne);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),i.publish(n.components,l({},i.getValue(n.components),{ScrollSeekPlaceholder:o})),i.publish(t.scrollSeekConfiguration,r)}),r(o.footer,"Footer","footer"),r(o.header,"Header","header"),r(o.ItemContainer,"Item","ItemContainer"),r(o.ListContainer,"List","ListContainer"),r(o.ScrollContainer,"Scroller","ScrollContainer"),r(o.emptyComponent,"EmptyPlaceholder","emptyComponent"),r(o.GroupContainer,"Group","GroupContainer"),l({},t,n,o)},i.tup(Me,_e)),Ye=function(e){return a.createElement("div",{style:{height:e.height}})},Ze={position:Ue(),zIndex:1,overflowAnchor:"none"},Je={overflowAnchor:"none"},$e=a.memo(function(e){var t=e.showTopList,o=void 0!==t&&t,r=dt("listState"),s=ft("sizeRanges"),u=dt("useWindowScroll"),c=dt("customScrollParent"),m=ft("windowScrollContainerState"),f=ft("scrollContainerState"),d=c||u?m:f,p=dt("itemContent"),h=dt("context"),g=dt("groupContent"),v=dt("trackItemSizes"),C=dt("itemSize"),I=dt("log"),x=ft("gap"),T=S(s,C,v,o?i.noop:d,I,x,c).callbackRef,w=a.useState(0),b=w[0],y=w[1];pt("deviation",function(e){b!==e&&y(e)});var E=dt("EmptyPlaceholder"),H=dt("ScrollSeekPlaceholder")||Ye,L=dt("ListComponent"),R=dt("ItemComponent"),k=dt("GroupComponent"),z=dt("computeItemKey"),F=dt("isSeeking"),B=dt("groupIndices").length>0,P=dt("paddingTopAddition"),O=o?{}:{boxSizing:"border-box",paddingTop:r.offsetTop+P,paddingBottom:r.offsetBottom,marginTop:b};return!o&&0===r.totalCount&&E?n.createElement(E,tt(E,h)):n.createElement(L,l({},tt(L,h),{ref:T,style:O,"data-test-id":o?"virtuoso-top-item-list":"virtuoso-item-list"}),(o?r.topItems:r.items).map(function(e){var t=e.originalIndex,o=z(t+r.firstItemIndex,e.data,h);return F?n.createElement(H,l({},tt(H,h),{key:o,index:e.index,height:e.size,type:e.type||"item"},"group"===e.type?{}:{groupIndex:e.groupIndex})):"group"===e.type?n.createElement(k,l({},tt(k,h),{key:o,"data-index":t,"data-known-size":e.size,"data-item-index":e.index,style:Ze}),g(e.index)):n.createElement(R,l({},tt(R,h),{key:o,"data-index":t,"data-known-size":e.size,"data-item-index":e.index,"data-item-group-index":e.groupIndex,style:Je}),B?p(e.index,e.groupIndex,e.data,h):p(e.index,e.data,h))}))}),Qe={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Xe={width:"100%",height:"100%",position:"absolute",top:0},et={width:"100%",position:Ue(),top:0};function tt(e,t){if("string"!=typeof e)return{context:t}}var nt=a.memo(function(){var e=dt("HeaderComponent"),t=ft("headerHeight"),o=dt("headerFooterTag"),r=v(function(e){return t(C(e,"height"))}),i=dt("context");return e?n.createElement(o,{ref:r},n.createElement(e,tt(e,i))):null}),ot=a.memo(function(){var e=dt("FooterComponent"),t=ft("footerHeight"),o=dt("headerFooterTag"),r=v(function(e){return t(C(e,"height"))}),i=dt("context");return e?n.createElement(o,{ref:r},n.createElement(e,tt(e,i))):null});function rt(e){var t=e.usePublisher,o=e.useEmitter,r=e.useEmitterValue;return a.memo(function(e){var i=e.style,a=e.children,u=s(e,Ge),c=t("scrollContainerState"),m=r("ScrollerComponent"),f=t("smoothScrollTargetReached"),d=r("scrollerRef"),p=r("context"),h=x(c,f,m,d),g=h.scrollerRef,v=h.scrollByCallback;return o("scrollTo",h.scrollToCallback),o("scrollBy",v),n.createElement(m,l({ref:g,style:l({},Qe,i),"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0},u,tt(m,p)),a)})}function it(e){var t=e.usePublisher,o=e.useEmitter,r=e.useEmitterValue;return a.memo(function(e){var a=e.style,u=e.children,c=s(e,De),m=t("windowScrollContainerState"),f=r("ScrollerComponent"),p=t("smoothScrollTargetReached"),h=r("totalListHeight"),g=r("deviation"),v=r("customScrollParent"),S=r("context"),C=x(m,p,f,i.noop,v),I=C.scrollerRef,T=C.scrollByCallback,w=C.scrollToCallback;return d(function(){return I.current=v||window,function(){I.current=null}},[I,v]),o("windowScrollTo",w),o("scrollBy",T),n.createElement(f,l({style:l({position:"relative"},a,0!==h?{height:h+g}:{}),"data-virtuoso-scroller":!0},c,tt(f,S)),u)})}var at=function(e){var t=e.children,o=n.useContext(We),r=ft("viewportHeight"),l=ft("fixedItemHeight"),s=v(i.compose(r,function(e){return C(e,"height")}));return a.useEffect(function(){o&&(r(o.viewportHeight),l(o.itemHeight))},[o,r,l]),a.createElement("div",{style:Xe,ref:s,"data-viewport-type":"element"},t)},lt=function(e){var t=e.children,o=n.useContext(We),r=ft("windowViewportRect"),i=ft("fixedItemHeight"),l=dt("customScrollParent"),s=Ae(r,l);return a.useEffect(function(){o&&(i(o.itemHeight),r({offsetTop:0,visibleHeight:o.viewportHeight,visibleWidth:100}))},[o,r,i]),a.createElement("div",{ref:s,style:Xe,"data-viewport-type":"window"},t)},st=function(e){var t=e.children,o=dt("TopItemListComponent"),r=dt("headerHeight"),i=l({},et,{marginTop:r+"px"}),a=dt("context");return n.createElement(o||"div",{style:i,context:a},t)},ut=a.memo(function(e){var t=dt("useWindowScroll"),n=dt("topItemsIndexes").length>0,o=dt("customScrollParent"),r=o||t?lt:at;return a.createElement(o||t?gt:ht,l({},e),a.createElement(r,null,a.createElement(nt,null),a.createElement($e,null),a.createElement(ot,null)),n&&a.createElement(st,null,a.createElement($e,{showTopList:!0})))}),ct=e.systemToComponent(qe,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",groupContent:"groupContent",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",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",react18ConcurrentRendering:"react18ConcurrentRendering",item:"item",group:"group",topItems:"topItems",itemHeight:"itemHeight",scrollingStateChange:"scrollingStateChange",maxHeightCacheSize:"maxHeightCacheSize",footer:"footer",header:"header",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",GroupContainer:"GroupContainer",emptyComponent:"emptyComponent",HeaderContainer:"HeaderContainer",FooterContainer:"FooterContainer",scrollSeek:"scrollSeek"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",adjustForPrependedItems:"adjustForPrependedItems",autoscrollToBottom:"autoscrollToBottom"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},ut),mt=ct.Component,ft=ct.usePublisher,dt=ct.useEmitterValue,pt=ct.useEmitter,ht=rt({usePublisher:ft,useEmitterValue:dt,useEmitter:pt}),gt=it({usePublisher:ft,useEmitterValue:dt,useEmitter:pt}),vt={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},St={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Ct=Math.round,It=Math.ceil,xt=Math.floor,Tt=Math.min,wt=Math.max;function bt(e,t){return Array.from({length:t-e+1}).map(function(t,n){return{index:n+e}})}function yt(e,t){return e&&e.column===t.column&&e.row===t.row}var Et=i.system(function(e){var t=e[0],n=t.overscan,o=t.visibleRange,r=t.listBoundary,a=e[1],s=a.scrollTop,u=a.viewportHeight,c=a.scrollBy,m=a.scrollTo,f=a.smoothScrollTargetReached,d=a.scrollContainerState,p=e[2],h=e[3],g=e[4],v=g.propsReady,S=g.didMount,C=e[5],I=C.windowViewportRect,x=C.windowScrollTo,T=C.useWindowScroll,w=C.customScrollParent,b=C.windowScrollContainerState,y=e[6],E=i.statefulStream(0),H=i.statefulStream(0),L=i.statefulStream(vt),R=i.statefulStream({height:0,width:0}),k=i.statefulStream({height:0,width:0}),z=i.stream(),F=i.stream(),B=i.statefulStream(0),P=i.statefulStream({row:0,column:0});i.connect(i.pipe(S,i.withLatestFrom(H),i.filter(function(e){return 0!==e[1]}),i.map(function(e){return{items:bt(0,e[1]-1),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0}})),L),i.connect(i.pipe(i.combineLatest(i.duc(E),o,i.duc(P,yt),i.duc(k,function(e,t){return e&&e.width===t.width&&e.height===t.height})),i.withLatestFrom(R),i.map(function(e){var t=e[0],n=t[0],o=t[1],r=o[0],i=o[1],a=t[2],l=t[3],s=e[1],u=a.row,c=l.height,m=l.width,f=s.width;if(0===n||0===f)return vt;if(0===m)return St;var d=Rt(f,m,a.column),p=d*xt((r+u)/(c+u)),h=d*It((i+u)/(c+u))-1;h=wt(0,Tt(n-1,h));var g=bt(p=Tt(h,wt(0,p)),h),v=Ht(s,a,l,g),S=v.top,C=v.bottom,I=It(n/d);return{items:g,offsetTop:S,offsetBottom:I*c+(I-1)*u-C,top:S,bottom:C,itemHeight:c,itemWidth:m}})),L),i.connect(i.pipe(R,i.map(function(e){return e.height})),u),i.connect(i.pipe(i.combineLatest(R,k,L,P),i.map(function(e){var t=Ht(e[0],e[3],e[1],e[2].items);return[t.top,t.bottom]}),i.distinctUntilChanged(pe)),r);var O=i.streamFromEmitter(i.pipe(i.duc(L),i.filter(function(e){return e.items.length>0}),i.withLatestFrom(E),i.filter(function(e){var t=e[0].items;return t[t.length-1].index===e[1]-1}),i.map(function(e){return e[1]-1}),i.distinctUntilChanged())),V=i.streamFromEmitter(i.pipe(i.duc(L),i.filter(function(e){var t=e.items;return t.length>0&&0===t[0].index}),i.mapTo(0),i.distinctUntilChanged())),M=i.streamFromEmitter(i.pipe(i.duc(L),i.filter(function(e){return e.items.length>0}),i.map(function(e){var t=e.items;return{startIndex:t[0].index,endIndex:t[t.length-1].index}}),i.distinctUntilChanged(he)));i.connect(M,h.scrollSeekRangeChanged),i.connect(i.pipe(z,i.withLatestFrom(R,k,E,P),i.map(function(e){var t=e[1],n=e[2],o=e[3],r=e[4],i=oe(e[0]),a=i.align,l=i.behavior,s=i.offset,u=i.index;"LAST"===u&&(u=o-1);var c=Lt(t,r,n,u=wt(0,u,Tt(o-1,u)));return"end"===a?c=Ct(c-t.height+n.height):"center"===a&&(c=Ct(c-t.height/2+n.height/2)),s&&(c+=s),{top:c,behavior:l}})),m);var U=i.statefulStreamFromEmitter(i.pipe(L,i.map(function(e){return e.offsetBottom+e.bottom})),0);return i.connect(i.pipe(I,i.map(function(e){return{width:e.visibleWidth,height:e.visibleHeight}})),R),l({totalCount:E,viewportDimensions:R,itemDimensions:k,scrollTop:s,scrollHeight:F,overscan:n,scrollBy:c,scrollTo:m,scrollToIndex:z,smoothScrollTargetReached:f,windowViewportRect:I,windowScrollTo:x,useWindowScroll:T,customScrollParent:w,windowScrollContainerState:b,deviation:B,scrollContainerState:d,initialItemCount:H,gap:P},h,{gridState:L,totalListHeight:U},p,{startReached:V,endReached:O,rangeChanged:M,propsReady:v},y)},i.tup(Se,T,le,be,se,Fe,h));function Ht(e,t,n,o){var r=n.height;return void 0===r||0===o.length?{top:0,bottom:0}:{top:Lt(e,t,n,o[0].index),bottom:Lt(e,t,n,o[o.length-1].index)+r}}function Lt(e,t,n,o){var r=Rt(e.width,n.width,t.column),i=xt(o/r),a=i*n.height+wt(0,i-1)*t.row;return a>0?a+t.row:a}function Rt(e,t,n){return wt(1,xt((e+n)/(t+n)))}var kt=["placeholder"],zt=i.system(function(){var e=i.statefulStream(function(e){return"Item "+e}),t=i.statefulStream({}),n=i.statefulStream(null),o=i.statefulStream("virtuoso-grid-item"),r=i.statefulStream("virtuoso-grid-list"),a=i.statefulStream(je),l=i.statefulStream(i.noop),s=function(e,n){return void 0===n&&(n=null),i.statefulStreamFromEmitter(i.pipe(t,i.map(function(t){return t[e]}),i.distinctUntilChanged()),n)};return{context:n,itemContent:e,components:t,computeItemKey:a,itemClassName:o,listClassName:r,scrollerRef:l,ListComponent:s("List","div"),ItemComponent:s("Item","div"),ScrollerComponent:s("Scroller","div"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder","div")}}),Ft=i.system(function(e){var t=e[0],n=e[1],o={item:Ke(n.itemContent,"Rename the %citem%c prop to %citemContent."),ItemContainer:i.stream(),ScrollContainer:i.stream(),ListContainer:i.stream(),emptyComponent:i.stream(),scrollSeek:i.stream()};function r(e,t,o){i.connect(i.pipe(e,i.withLatestFrom(n.components),i.map(function(e){var n,r=e[0],i=e[1];return console.warn("react-virtuoso: "+o+" property is deprecated. Pass components."+t+" instead."),l({},i,((n={})[t]=r,n))})),n.components)}return i.subscribe(o.scrollSeek,function(e){var o=e.placeholder,r=s(e,kt);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),i.publish(n.components,l({},i.getValue(n.components),{ScrollSeekPlaceholder:o})),i.publish(t.scrollSeekConfiguration,r)}),r(o.ItemContainer,"Item","ItemContainer"),r(o.ListContainer,"List","ListContainer"),r(o.ScrollContainer,"Scroller","ScrollContainer"),l({},t,n,o)},i.tup(Et,zt)),Bt=a.memo(function(){var e=Wt("gridState"),t=Wt("listClassName"),o=Wt("itemClassName"),r=Wt("itemContent"),i=Wt("computeItemKey"),a=Wt("isSeeking"),s=At("scrollHeight"),u=Wt("ItemComponent"),c=Wt("ListComponent"),m=Wt("ScrollSeekPlaceholder"),f=Wt("context"),d=At("itemDimensions"),p=At("gap"),h=Wt("log"),g=v(function(e){s(e.parentElement.parentElement.scrollHeight);var t=e.firstChild;t&&d(t.getBoundingClientRect()),p({row:jt("row-gap",getComputedStyle(e).rowGap,h),column:jt("column-gap",getComputedStyle(e).columnGap,h)})});return n.createElement(c,l({ref:g,className:t},tt(c,f),{style:{paddingTop:e.offsetTop,paddingBottom:e.offsetBottom}}),e.items.map(function(t){var s=i(t.index);return a?n.createElement(m,l({key:s},tt(m,f),{index:t.index,height:e.itemHeight,width:e.itemWidth})):n.createElement(u,l({},tt(u,f),{className:o,"data-index":t.index,key:s}),r(t.index,f))}))}),Pt=function(e){var t=e.children,n=At("viewportDimensions"),o=v(function(e){n(e.getBoundingClientRect())});return a.createElement("div",{style:Xe,ref:o},t)},Ot=function(e){var t=e.children,n=Ae(At("windowViewportRect"),Wt("customScrollParent"));return a.createElement("div",{ref:n,style:Xe},t)},Vt=a.memo(function(e){var t=l({},e),n=Wt("useWindowScroll"),o=Wt("customScrollParent"),r=o||n?Ot:Pt;return a.createElement(o||n?Dt:Gt,l({},t),a.createElement(r,null,a.createElement(Bt,null)))}),Mt=e.systemToComponent(Ft,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",item:"item",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",scrollSeek:"scrollSeek"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange"}},Vt),Ut=Mt.Component,At=Mt.usePublisher,Wt=Mt.useEmitterValue,Nt=Mt.useEmitter,Gt=rt({usePublisher:At,useEmitterValue:Wt,useEmitter:Nt}),Dt=it({usePublisher:At,useEmitterValue:Wt,useEmitter:Nt});function jt(e,t,n){return"normal"===t||null!=t&&t.endsWith("px")||n(e+" was not resolved to pixel value correctly",t,exports.LogLevel.WARN),"normal"===t?0:parseInt(null!=t?t:"0",10)}var _t=i.system(function(){var e=i.statefulStream(function(e){return a.createElement("td",null,"Item $",e)}),t=i.statefulStream(null),n=i.statefulStream(null),o=i.statefulStream(null),r=i.statefulStream({}),l=i.statefulStream(je),s=i.statefulStream(i.noop),u=function(e,t){return void 0===t&&(t=null),i.statefulStreamFromEmitter(i.pipe(r,i.map(function(t){return t[e]}),i.distinctUntilChanged()),t)};return{context:t,itemContent:e,fixedHeaderContent:n,fixedFooterContent:o,components:r,computeItemKey:l,scrollerRef:s,TableComponent:u("Table","table"),TableHeadComponent:u("TableHead","thead"),TableFooterComponent:u("TableFoot","tfoot"),TableBodyComponent:u("TableBody","tbody"),TableRowComponent:u("TableRow","tr"),ScrollerComponent:u("Scroller","div"),EmptyPlaceholder:u("EmptyPlaceholder"),ScrollSeekPlaceholder:u("ScrollSeekPlaceholder"),FillerRow:u("FillerRow")}}),Kt=i.system(function(e){return l({},e[0],e[1])},i.tup(Me,_t)),qt=function(e){return a.createElement("tr",null,a.createElement("td",{style:{height:e.height}}))},Yt=function(e){return a.createElement("tr",null,a.createElement("td",{style:{height:e.height,padding:0,border:0}}))},Zt=a.memo(function(){var e=nn("listState"),t=tn("sizeRanges"),o=nn("useWindowScroll"),r=nn("customScrollParent"),i=tn("windowScrollContainerState"),s=tn("scrollContainerState"),u=r||o?i:s,c=nn("itemContent"),m=nn("trackItemSizes"),f=S(t,nn("itemSize"),m,u,nn("log"),void 0,r),d=f.callbackRef,p=f.ref,h=a.useState(0),g=h[0],v=h[1];on("deviation",function(e){g!==e&&(p.current.style.marginTop=e+"px",v(e))});var C=nn("EmptyPlaceholder"),I=nn("ScrollSeekPlaceholder")||qt,x=nn("FillerRow")||Yt,T=nn("TableBodyComponent"),w=nn("TableRowComponent"),b=nn("computeItemKey"),y=nn("isSeeking"),E=nn("paddingTopAddition"),H=nn("firstItemIndex"),L=nn("statefulTotalCount"),R=nn("context");if(0===L&&C)return n.createElement(C,tt(C,R));var k=e.offsetTop+E+g,z=e.offsetBottom,F=k>0?a.createElement(x,{height:k,key:"padding-top"}):null,B=z>0?a.createElement(x,{height:z,key:"padding-bottom"}):null,P=e.items.map(function(e){var t=e.originalIndex,o=b(t+H,e.data,R);return y?n.createElement(I,l({},tt(I,R),{key:o,index:e.index,height:e.size,type:e.type||"item"})):n.createElement(w,l({},tt(w,R),{key:o,"data-index":t,"data-known-size":e.size,"data-item-index":e.index,style:{overflowAnchor:"none"}}),c(e.index,e.data,R))});return n.createElement(T,l({ref:d,"data-test-id":"virtuoso-item-list"},tt(T,R)),[F].concat(P,[B]))}),Jt=function(e){var t=e.children,o=n.useContext(We),r=tn("viewportHeight"),l=tn("fixedItemHeight"),s=v(i.compose(r,function(e){return C(e,"height")}));return a.useEffect(function(){o&&(r(o.viewportHeight),l(o.itemHeight))},[o,r,l]),a.createElement("div",{style:Xe,ref:s,"data-viewport-type":"element"},t)},$t=function(e){var t=e.children,o=n.useContext(We),r=tn("windowViewportRect"),i=tn("fixedItemHeight"),l=nn("customScrollParent"),s=Ae(r,l);return a.useEffect(function(){o&&(i(o.itemHeight),r({offsetTop:0,visibleHeight:o.viewportHeight,visibleWidth:100}))},[o,r,i]),a.createElement("div",{ref:s,style:Xe,"data-viewport-type":"window"},t)},Qt=a.memo(function(e){var t=nn("useWindowScroll"),n=nn("customScrollParent"),o=tn("fixedHeaderHeight"),r=tn("fixedFooterHeight"),s=nn("fixedHeaderContent"),u=nn("fixedFooterContent"),c=nn("context"),m=v(i.compose(o,function(e){return C(e,"height")})),f=v(i.compose(r,function(e){return C(e,"height")})),d=n||t?an:rn,p=n||t?$t:Jt,h=nn("TableComponent"),g=nn("TableHeadComponent"),S=nn("TableFooterComponent"),I=s?a.createElement(g,l({key:"TableHead",style:{zIndex:1,position:"sticky",top:0},ref:m},tt(g,c)),s()):null,x=u?a.createElement(S,l({key:"TableFoot",style:{zIndex:1,position:"sticky",bottom:0},ref:f},tt(S,c)),u()):null;return a.createElement(d,l({},e),a.createElement(p,null,a.createElement(h,l({style:{borderSpacing:0}},tt(h,c)),[I,a.createElement(Zt,{key:"TableBody"}),x])))}),Xt=e.systemToComponent(Kt,{required:{},optional:{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",react18ConcurrentRendering:"react18ConcurrentRendering"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Qt),en=Xt.Component,tn=Xt.usePublisher,nn=Xt.useEmitterValue,on=Xt.useEmitter,rn=rt({usePublisher:tn,useEmitterValue:nn,useEmitter:on}),an=it({usePublisher:tn,useEmitterValue:nn,useEmitter:on}),ln=mt,sn=en,un=Ut;exports.GroupedVirtuoso=mt,exports.TableVirtuoso=sn,exports.Virtuoso=ln,exports.VirtuosoGrid=un,exports.VirtuosoMockContext=We; | ||
"use strict";var e=require("@virtuoso.dev/react-urx"),t=require("@virtuoso.dev/urx"),n=require("react"),o=require("react-dom");function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t}var i=r(t),a=r(n);function l(){return l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},l.apply(this,arguments)}function s(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)t.indexOf(n=i[o])>=0||(r[n]=e[n]);return r}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function c(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var m,f,d="undefined"!=typeof document?n.useLayoutEffect:n.useEffect;exports.LogLevel=void 0,(f=exports.LogLevel||(exports.LogLevel={}))[f.DEBUG=0]="DEBUG",f[f.INFO=1]="INFO",f[f.WARN=2]="WARN",f[f.ERROR=3]="ERROR";var p=((m={})[exports.LogLevel.DEBUG]="debug",m[exports.LogLevel.INFO]="log",m[exports.LogLevel.WARN]="warn",m[exports.LogLevel.ERROR]="error",m),h=i.system(function(){var e=i.statefulStream(exports.LogLevel.ERROR);return{log:i.statefulStream(function(t,n,o){var r;void 0===o&&(o=exports.LogLevel.INFO),o>=(null!=(r=("undefined"==typeof globalThis?window:globalThis).VIRTUOSO_LOG_LEVEL)?r:i.getValue(e))&&console[p[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function g(e,t){void 0===t&&(t=!0);var o=n.useRef(null),r=function(e){};if("undefined"!=typeof ResizeObserver){var i=new ResizeObserver(function(t){var n=t[0].target;null!==n.offsetParent&&e(n)});r=function(e){e&&t?(i.observe(e),o.current=e):(o.current&&i.unobserve(o.current),o.current=null)}}return{ref:o,callbackRef:r}}function v(e,t){return void 0===t&&(t=!0),g(e,t).callbackRef}function S(e,t,n,o,r,i,a){return g(function(n){for(var l=function(e,t,n,o){var r=e.length;if(0===r)return null;for(var i=[],a=0;a<r;a++){var l=e.item(a);if(l&&void 0!==l.dataset.index){var s=parseInt(l.dataset.index),u=parseFloat(l.dataset.knownSize),c=t(l,"offsetHeight");if(0===c&&o("Zero-sized element, this should not happen",{child:l},exports.LogLevel.ERROR),c!==u){var m=i[i.length-1];0===i.length||m.size!==c||m.endIndex!==s-1?i.push({startIndex:s,endIndex:s,size:c}):i[i.length-1].endIndex++}}}return i}(n.children,t,0,r),s=n.parentElement;!s.dataset.virtuosoScroller;)s=s.parentElement;var u="window"===s.firstElementChild.dataset.viewportType,c=a?a.scrollTop:u?window.pageYOffset||document.documentElement.scrollTop:s.scrollTop,m=a?a.scrollHeight:u?document.documentElement.scrollHeight:s.scrollHeight,f=a?a.offsetHeight:u?window.innerHeight:s.offsetHeight;o({scrollTop:Math.max(c,0),scrollHeight:m,viewportHeight:f}),null==i||i(function(e,t,n){return"normal"===t||null!=t&&t.endsWith("px")||n("row-gap was not resolved to pixel value correctly",t,exports.LogLevel.WARN),"normal"===t?0:parseInt(null!=t?t:"0",10)}(0,getComputedStyle(n).rowGap,r)),null!==l&&e(l)},n)}function C(e,t){return Math.round(e.getBoundingClientRect()[t])}function I(e,t){return Math.abs(e-t)<1.01}function x(e,t,r,a,l){void 0===a&&(a=i.noop);var s=n.useRef(null),u=n.useRef(null),c=n.useRef(null),m=n.useRef(!1),f=n.useCallback(function(n){var r=n.target,i=r===window||r===document,a=i?window.pageYOffset||document.documentElement.scrollTop:r.scrollTop,l=i?document.documentElement.scrollHeight:r.scrollHeight,s=i?window.innerHeight:r.offsetHeight,f=function(){e({scrollTop:Math.max(a,0),scrollHeight:l,viewportHeight:s})};m.current?o.flushSync(f):f(),m.current=!1,null!==u.current&&(a===u.current||a<=0||a===l-s)&&(u.current=null,t(!0),c.current&&(clearTimeout(c.current),c.current=null))},[e,t]);return n.useEffect(function(){var e=l||s.current;return a(l||s.current),f({target:e}),e.addEventListener("scroll",f,{passive:!0}),function(){a(null),e.removeEventListener("scroll",f)}},[s,f,r,a,l]),{scrollerRef:s,scrollByCallback:function(e){m.current=!0,s.current.scrollBy(e)},scrollToCallback:function(n){var o=s.current;if(o&&(!("offsetHeight"in o)||0!==o.offsetHeight)){var r,i,a,l="smooth"===n.behavior;if(o===window?(i=Math.max(C(document.documentElement,"height"),document.documentElement.scrollHeight),r=window.innerHeight,a=document.documentElement.scrollTop):(i=o.scrollHeight,r=C(o,"height"),a=o.scrollTop),n.top=Math.ceil(Math.max(Math.min(i-r,n.top),0)),I(r,i)||n.top===a)return e({scrollTop:a,scrollHeight:i,viewportHeight:r}),void(l&&t(!0));l?(u.current=n.top,c.current&&clearTimeout(c.current),c.current=setTimeout(function(){c.current=null,u.current=null,t(!0)},1e3)):u.current=null,o.scrollTo(n)}}}}var T=i.system(function(){var e=i.stream(),t=i.stream(),n=i.statefulStream(0),o=i.stream(),r=i.statefulStream(0),a=i.stream(),l=i.stream(),s=i.statefulStream(0),u=i.statefulStream(0),c=i.statefulStream(0),m=i.statefulStream(0),f=i.stream(),d=i.stream(),p=i.statefulStream(!1),h=i.statefulStream(!1);return i.connect(i.pipe(e,i.map(function(e){return e.scrollTop})),t),i.connect(i.pipe(e,i.map(function(e){return e.scrollHeight})),l),i.connect(t,r),{scrollContainerState:e,scrollTop:t,viewportHeight:a,headerHeight:s,fixedHeaderHeight:u,fixedFooterHeight:c,footerHeight:m,scrollHeight:l,smoothScrollTargetReached:o,react18ConcurrentRendering:h,scrollTo:f,scrollBy:d,statefulScrollTop:r,deviation:n,scrollingInProgress:p}},[],{singleton:!0}),w={lvl:0};function b(e,t,n,o,r){return void 0===o&&(o=w),void 0===r&&(r=w),{k:e,v:t,lvl:n,l:o,r:r}}function y(e){return e===w}function E(){return w}function H(e,t){if(y(e))return w;var n=e.k,o=e.l,r=e.r;if(t===n){if(y(o))return r;if(y(r))return o;var i=z(o);return V(P(e,{k:i[0],v:i[1],l:B(o)}))}return V(P(e,t<n?{l:H(o,t)}:{r:H(r,t)}))}function L(e,t,n){if(void 0===n&&(n="k"),y(e))return[-Infinity,void 0];if(e[n]===t)return[e.k,e.v];if(e[n]<t){var o=L(e.r,t,n);return-Infinity===o[0]?[e.k,e.v]:o}return L(e.l,t,n)}function R(e,t,n){return y(e)?b(t,n,1):t===e.k?P(e,{k:t,v:n}):function(e){return A(W(e))}(P(e,t<e.k?{l:R(e.l,t,n)}:{r:R(e.r,t,n)}))}function k(e,t,n){if(y(e))return[];var o=e.k,r=e.v,i=e.r,a=[];return o>t&&(a=a.concat(k(e.l,t,n))),o>=t&&o<=n&&a.push({k:o,v:r}),o<=n&&(a=a.concat(k(i,t,n))),a}function F(e){return y(e)?[]:[].concat(F(e.l),[{k:e.k,v:e.v}],F(e.r))}function z(e){return y(e.r)?[e.k,e.v]:z(e.r)}function B(e){return y(e.r)?e.l:V(P(e,{r:B(e.r)}))}function P(e,t){return b(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 O(e){return y(e)||e.lvl>e.r.lvl}function V(e){var t=e.l,n=e.r,o=e.lvl;if(n.lvl>=o-1&&t.lvl>=o-1)return e;if(o>n.lvl+1){if(O(t))return W(P(e,{lvl:o-1}));if(y(t)||y(t.r))throw new Error("Unexpected empty nodes");return P(t.r,{l:P(t,{r:t.r.l}),r:P(e,{l:t.r.r,lvl:o-1}),lvl:o})}if(O(e))return A(P(e,{lvl:o-1}));if(y(n)||y(n.l))throw new Error("Unexpected empty nodes");var r=n.l,i=O(r)?n.lvl-1:n.lvl;return P(r,{l:P(e,{r:r.l,lvl:o-1}),r:A(P(n,{l:r.r,lvl:i})),lvl:r.lvl+1})}function M(e,t,n){return y(e)?[]:U(k(e,L(e,t)[0],n),function(e){return{index:e.k,value:e.v}})}function U(e,t){var n=e.length;if(0===n)return[];for(var o=t(e[0]),r=o.index,i=o.value,a=[],l=1;l<n;l++){var s=t(e[l]),u=s.index,c=s.value;a.push({start:r,end:u-1,value:i}),r=u,i=c}return a.push({start:r,end:Infinity,value:i}),a}function A(e){var t=e.r,n=e.lvl;return y(t)||y(t.r)||t.lvl!==n||t.r.lvl!==n?e:P(t,{l:P(e,{r:t.l}),lvl:n+1})}function W(e){var t=e.l;return y(t)||t.lvl!==e.lvl?e:P(t,{r:P(e,{l:t.r})})}function N(e,t,n,o){void 0===o&&(o=0);for(var r=e.length-1;o<=r;){var i=Math.floor((o+r)/2),a=n(e[i],t);if(0===a)return i;if(-1===a){if(r-o<2)return i-1;r=i-1}else{if(r===o)return i;o=i+1}}throw new Error("Failed binary finding record in array - "+e.join(",")+", searched for "+t)}function G(e,t,n){return e[N(e,t,n)]}var D=i.system(function(){return{recalcInProgress:i.statefulStream(!1)}},[],{singleton:!0});function j(e){var t=e.size,n=e.startIndex,o=e.endIndex;return function(e){return e.start===n&&(e.end===o||Infinity===e.end)&&e.value===t}}function _(e,t){var n=e.index;return t===n?0:t<n?-1:1}function K(e,t){var n=e.offset;return t===n?0:t<n?-1:1}function q(e){return{index:e.index,value:e}}function Y(e,t,n,o){var r=e,i=0,a=0,l=0,s=0;if(0!==t){l=r[s=N(r,t-1,_)].offset;var u=L(n,t-1);i=u[0],a=u[1],r.length&&r[s].size===L(n,t)[1]&&(s-=1),r=r.slice(0,s+1)}else r=[];for(var m,f=c(M(n,t,Infinity));!(m=f()).done;){var d=m.value,p=d.start,h=d.value,g=p-i,v=g*a+l+g*o;r.push({offset:v,size:h,index:p}),i=p,l=v,a=h}return{offsetTree:r,lastIndex:i,lastOffset:l,lastSize:a}}function Z(e,t){var n=t[0],o=t[1],r=t[3];n.length>0&&(0,t[2])("received item sizes",n,exports.LogLevel.DEBUG);var i=e.sizeTree,a=i,l=0;if(o.length>0&&y(i)&&2===n.length){var s=n[0].size,u=n[1].size;a=o.reduce(function(e,t){return R(R(e,t,s),t+1,u)},a)}else{var m=function(e,t){for(var n,o=y(e)?0:Infinity,r=c(t);!(n=r()).done;){var i=n.value,a=i.size,l=i.startIndex,s=i.endIndex;if(o=Math.min(o,l),y(e))e=R(e,0,a);else{var u=M(e,l-1,s+1);if(!u.some(j(i))){for(var m,f=!1,d=!1,p=c(u);!(m=p()).done;){var h=m.value,g=h.start,v=h.end,S=h.value;f?(s>=g||a===S)&&(e=H(e,g)):(d=S!==a,f=!0),v>s&&s>=g&&S!==a&&(e=R(e,s+1,S))}d&&(e=R(e,l,a))}}}return[e,o]}(a,n);a=m[0],l=m[1]}if(a===i)return e;var f=Y(e.offsetTree,l,a,r),d=f.offsetTree;return{sizeTree:a,offsetTree:d,lastIndex:f.lastIndex,lastOffset:f.lastOffset,lastSize:f.lastSize,groupOffsetTree:o.reduce(function(e,t){return R(e,t,J(t,d,r))},E()),groupIndices:o}}function J(e,t,n){if(0===t.length)return 0;var o=G(t,e,_),r=e-o.index,i=o.size*r+(r-1)*n+o.offset;return i>0?i+n:i}function $(e,t,n){if(function(e){return void 0!==e.groupIndex}(e))return t.groupIndices[e.groupIndex]+1;var o=Q("LAST"===e.index?n:e.index,t);return Math.max(0,o,Math.min(n,o))}function Q(e,t){if(!X(t))return e;for(var n=0;t.groupIndices[n]<=e+n;)n++;return e+n}function X(e){return!y(e.groupOffsetTree)}var ee={offsetHeight:"height",offsetWidth:"width"},te=i.system(function(e){var t=e[0].log,n=e[1].recalcInProgress,o=i.stream(),r=i.stream(),a=i.statefulStreamFromEmitter(r,0),s=i.stream(),u=i.stream(),c=i.statefulStream(0),m=i.statefulStream([]),f=i.statefulStream(void 0),d=i.statefulStream(void 0),p=i.statefulStream(function(e,t){return C(e,ee[t])}),h=i.statefulStream(void 0),g=i.statefulStream(0),v={offsetTree:[],sizeTree:E(),groupOffsetTree:E(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},S=i.statefulStreamFromEmitter(i.pipe(o,i.withLatestFrom(m,t,g),i.scan(Z,v),i.distinctUntilChanged()),v);i.connect(i.pipe(m,i.filter(function(e){return e.length>0}),i.withLatestFrom(S,g),i.map(function(e){var t=e[0],n=e[1],o=e[2],r=t.reduce(function(e,t,r){return R(e,t,J(t,n.offsetTree,o)||r)},E());return l({},n,{groupIndices:t,groupOffsetTree:r})})),S),i.connect(i.pipe(r,i.withLatestFrom(S),i.filter(function(e){return e[0]<e[1].lastIndex}),i.map(function(e){var t=e[1];return[{startIndex:e[0],endIndex:t.lastIndex,size:t.lastSize}]})),o),i.connect(f,d);var I=i.statefulStreamFromEmitter(i.pipe(f,i.map(function(e){return void 0===e})),!0);i.connect(i.pipe(d,i.filter(function(e){return void 0!==e&&y(i.getValue(S).sizeTree)}),i.map(function(e){return[{startIndex:0,endIndex:0,size:e}]})),o);var x=i.streamFromEmitter(i.pipe(o,i.withLatestFrom(S),i.scan(function(e,t){var n=t[1];return{changed:n!==e.sizes,sizes:n}},{changed:!1,sizes:v}),i.map(function(e){return e.changed})));i.subscribe(i.pipe(c,i.scan(function(e,t){return{diff:e.prev-t,prev:t}},{diff:0,prev:0}),i.map(function(e){return e.diff})),function(e){e>0?(i.publish(n,!0),i.publish(s,e)):e<0&&i.publish(u,e)}),i.subscribe(i.pipe(c,i.withLatestFrom(t)),function(e){e[0]<0&&(0,e[1])("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:c},exports.LogLevel.ERROR)});var T=i.streamFromEmitter(s);i.connect(i.pipe(s,i.withLatestFrom(S),i.map(function(e){var t=e[0],n=e[1];if(n.groupIndices.length>0)throw new Error("Virtuoso: prepending items does not work with groups");return F(n.sizeTree).reduce(function(e,n){var o=n.k,r=n.v;return{ranges:[].concat(e.ranges,[{startIndex:e.prevIndex,endIndex:o+t-1,size:e.prevSize}]),prevIndex:o+t,prevSize:r}},{ranges:[],prevIndex:0,prevSize:n.lastSize}).ranges})),o);var w=i.streamFromEmitter(i.pipe(u,i.withLatestFrom(S,g),i.map(function(e){return J(-e[0],e[1].offsetTree,e[2])})));return i.connect(i.pipe(u,i.withLatestFrom(S,g),i.map(function(e){var t=e[0],n=e[1],o=e[2];if(n.groupIndices.length>0)throw new Error("Virtuoso: shifting items does not work with groups");var r=F(n.sizeTree).reduce(function(e,n){var o=n.v;return R(e,Math.max(0,n.k+t),o)},E());return l({},n,{sizeTree:r},Y(n.offsetTree,0,r,o))})),S),{data:h,totalCount:r,sizeRanges:o,groupIndices:m,defaultItemSize:d,fixedItemSize:f,unshiftWith:s,shiftWith:u,shiftWithOffset:w,beforeUnshiftWith:T,firstItemIndex:c,gap:g,sizes:S,listRefresh:x,statefulTotalCount:a,trackItemSizes:I,itemSize:p}},i.tup(h,D),{singleton:!0}),ne="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style;function oe(e){var t="number"==typeof e?{index:e}:e;return t.align||(t.align="start"),t.behavior&&ne||(t.behavior="auto"),t.offset||(t.offset=0),t}var re=i.system(function(e){var t=e[0],n=t.sizes,o=t.totalCount,r=t.listRefresh,a=t.gap,l=e[1],s=l.scrollingInProgress,u=l.viewportHeight,c=l.scrollTo,m=l.smoothScrollTargetReached,f=l.headerHeight,d=l.footerHeight,p=l.fixedHeaderHeight,h=l.fixedFooterHeight,g=e[2].log,v=i.stream(),S=i.statefulStream(0),C=null,I=null,x=null;function T(){C&&(C(),C=null),x&&(x(),x=null),I&&(clearTimeout(I),I=null),i.publish(s,!1)}return i.connect(i.pipe(v,i.withLatestFrom(n,u,o,S,f,d,g),i.withLatestFrom(a,p,h),i.map(function(e){var t=e[0],n=t[0],o=t[1],a=t[2],l=t[3],u=t[4],c=t[5],f=t[6],d=t[7],p=e[1],h=e[2],g=e[3],S=oe(n),w=S.align,b=S.behavior,y=S.offset,E=l-1,H=$(S,o,E),R=J(H,o.offsetTree,p)+c;"end"===w?(R+=h+L(o.sizeTree,H)[1]-a+g,H===E&&(R+=f)):"center"===w?R+=(h+L(o.sizeTree,H)[1]-a+g)/2:R-=u,y&&(R+=y);var k=function(e){T(),e?(d("retrying to scroll to",{location:n},exports.LogLevel.DEBUG),i.publish(v,n)):d("list did not change, scroll successful",{},exports.LogLevel.DEBUG)};if(T(),"smooth"===b){var F=!1;x=i.subscribe(r,function(e){F=F||e}),C=i.handleNext(m,function(){k(F)})}else C=i.handleNext(i.pipe(r,function(e){var t=setTimeout(function(){e(!1)},150);return function(n){n&&(e(!0),clearTimeout(t))}}),k);return I=setTimeout(function(){T()},1200),i.publish(s,!0),d("scrolling from index to",{index:H,top:R,behavior:b},exports.LogLevel.DEBUG),{top:R,behavior:b}})),c),{scrollToIndex:v,topListHeight:S}},i.tup(te,T,h),{singleton:!0}),ie="up",ae={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},le=i.system(function(e){var t=e[0],n=t.scrollContainerState,o=t.scrollTop,r=t.viewportHeight,a=t.headerHeight,l=t.footerHeight,s=t.scrollBy,u=i.statefulStream(!1),c=i.statefulStream(!0),m=i.stream(),f=i.stream(),d=i.statefulStream(4),p=i.statefulStream(0),h=i.statefulStreamFromEmitter(i.pipe(i.merge(i.pipe(i.duc(o),i.skip(1),i.mapTo(!0)),i.pipe(i.duc(o),i.skip(1),i.mapTo(!1),i.debounceTime(100))),i.distinctUntilChanged()),!1),g=i.statefulStreamFromEmitter(i.pipe(i.merge(i.pipe(s,i.mapTo(!0)),i.pipe(s,i.mapTo(!1),i.debounceTime(200))),i.distinctUntilChanged()),!1);i.connect(i.pipe(i.combineLatest(i.duc(o),i.duc(p)),i.map(function(e){return e[0]<=e[1]}),i.distinctUntilChanged()),c),i.connect(i.pipe(c,i.throttleTime(50)),f);var v=i.streamFromEmitter(i.pipe(i.combineLatest(n,i.duc(r),i.duc(a),i.duc(l),i.duc(d)),i.scan(function(e,t){var n,o,r=t[0],i=r.scrollTop,a=r.scrollHeight,l=t[1],s={viewportHeight:l,scrollTop:i,scrollHeight:a};return i+l-a>-t[4]?(i>e.state.scrollTop?(n="SCROLLED_DOWN",o=e.state.scrollTop-i):(n="SIZE_DECREASED",o=e.state.scrollTop-i||e.scrollTopDelta),{atBottom:!0,state:s,atBottomBecause:n,scrollTopDelta:o}):{atBottom:!1,notAtBottomBecause:s.scrollHeight>e.state.scrollHeight?"SIZE_INCREASED":l<e.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":i<e.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",state:s}},ae),i.distinctUntilChanged(function(e,t){return e&&e.atBottom===t.atBottom}))),S=i.statefulStreamFromEmitter(i.pipe(n,i.scan(function(e,t){var n=t.scrollTop,o=t.scrollHeight,r=t.viewportHeight;return I(e.scrollHeight,o)?{scrollTop:n,scrollHeight:o,jump:0,changed:!1}:e.scrollTop!==n&&o-(n+r)<1?{scrollHeight:o,scrollTop:n,jump:e.scrollTop-n,changed:!0}:{scrollHeight:o,scrollTop:n,jump:0,changed:!0}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),i.filter(function(e){return e.changed}),i.map(function(e){return e.jump})),0);i.connect(i.pipe(v,i.map(function(e){return e.atBottom})),u),i.connect(i.pipe(u,i.throttleTime(50)),m);var C=i.statefulStream("down");i.connect(i.pipe(n,i.map(function(e){return e.scrollTop}),i.distinctUntilChanged(),i.scan(function(e,t){return i.getValue(g)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?ie:"down",prevScrollTop:t}},{direction:"down",prevScrollTop:0}),i.map(function(e){return e.direction})),C),i.connect(i.pipe(n,i.throttleTime(50),i.mapTo("none")),C);var x=i.statefulStream(0);return i.connect(i.pipe(h,i.filter(function(e){return!e}),i.mapTo(0)),x),i.connect(i.pipe(o,i.throttleTime(100),i.withLatestFrom(h),i.filter(function(e){return!!e[1]}),i.scan(function(e,t){return[e[1],t[0]]},[0,0]),i.map(function(e){return e[1]-e[0]})),x),{isScrolling:h,isAtTop:c,isAtBottom:u,atBottomState:v,atTopStateChange:f,atBottomStateChange:m,scrollDirection:C,atBottomThreshold:d,atTopThreshold:p,scrollVelocity:x,lastJumpDueToItemResize:S}},i.tup(T)),se=i.system(function(e){var t=e[0].log,n=i.statefulStream(!1),o=i.streamFromEmitter(i.pipe(n,i.filter(function(e){return e}),i.distinctUntilChanged()));return i.subscribe(n,function(e){e&&i.getValue(t)("props updated",{},exports.LogLevel.DEBUG)}),{propsReady:n,didMount:o}},i.tup(h),{singleton:!0}),ue=i.system(function(e){var t=e[0],n=t.sizes,o=t.listRefresh,r=t.defaultItemSize,a=e[1].scrollTop,l=e[2].scrollToIndex,s=e[3].didMount,u=i.statefulStream(!0),c=i.statefulStream(0);return i.connect(i.pipe(s,i.withLatestFrom(c),i.filter(function(e){return!!e[1]}),i.mapTo(!1)),u),i.subscribe(i.pipe(i.combineLatest(o,s),i.withLatestFrom(u,n,r),i.filter(function(e){var t=e[1],n=e[3];return e[0][1]&&(!y(e[2].sizeTree)||void 0!==n)&&!t}),i.withLatestFrom(c)),function(e){var t=e[1];setTimeout(function(){i.handleNext(a,function(){i.publish(u,!0)}),i.publish(l,t)})}),{scrolledToInitialItem:u,initialTopMostItemIndex:c}},i.tup(te,T,re,se),{singleton:!0});function ce(e){return!!e&&("smooth"===e?"smooth":"auto")}var me=i.system(function(e){var t=e[0],n=t.totalCount,o=t.listRefresh,r=e[1],a=r.isAtBottom,l=r.atBottomState,s=e[2].scrollToIndex,u=e[3].scrolledToInitialItem,c=e[4],m=c.propsReady,f=c.didMount,d=e[5].log,p=e[6].scrollingInProgress,h=i.statefulStream(!1),g=i.stream(),v=null;function S(e){i.publish(s,{index:"LAST",align:"end",behavior:e})}function C(e){var t=i.handleNext(l,function(t){!e||t.atBottom||"SIZE_INCREASED"!==t.notAtBottomBecause||v||(i.getValue(d)("scrolling to bottom due to increased size",{},exports.LogLevel.DEBUG),S("auto"))});setTimeout(t,100)}return i.subscribe(i.pipe(i.combineLatest(i.pipe(i.duc(n),i.skip(1)),f),i.withLatestFrom(i.duc(h),a,u,p),i.map(function(e){var t=e[0],n=t[0],o=t[1]&&e[3],r="auto";return o&&(r=function(e,t){return"function"==typeof e?ce(e(t)):t&&ce(e)}(e[1],e[2]||e[4]),o=o&&!!r),{totalCount:n,shouldFollow:o,followOutputBehavior:r}}),i.filter(function(e){return e.shouldFollow})),function(e){var t=e.totalCount,n=e.followOutputBehavior;v&&(v(),v=null),v=i.handleNext(o,function(){i.getValue(d)("following output to ",{totalCount:t},exports.LogLevel.DEBUG),S(n),v=null})}),i.subscribe(i.pipe(i.combineLatest(i.duc(h),n,m),i.filter(function(e){return e[0]&&e[2]}),i.scan(function(e,t){var n=t[1];return{refreshed:e.value===n,value:n}},{refreshed:!1,value:0}),i.filter(function(e){return e.refreshed}),i.withLatestFrom(h,n)),function(e){C(!1!==e[1])}),i.subscribe(g,function(){C(!1!==i.getValue(h))}),i.subscribe(i.combineLatest(i.duc(h),l),function(e){var t=e[1];e[0]&&!t.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===t.notAtBottomBecause&&S("auto")}),{followOutput:h,autoscrollToBottom:g}},i.tup(te,le,re,ue,se,h,T));function fe(e){return e.reduce(function(e,t){return e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e},{totalCount:0,groupIndices:[]})}var de=i.system(function(e){var t=e[0],n=t.totalCount,o=t.groupIndices,r=t.sizes,a=e[1],l=a.scrollTop,s=a.headerHeight,u=i.stream(),c=i.stream(),m=i.streamFromEmitter(i.pipe(u,i.map(fe)));return i.connect(i.pipe(m,i.map(function(e){return e.totalCount})),n),i.connect(i.pipe(m,i.map(function(e){return e.groupIndices})),o),i.connect(i.pipe(i.combineLatest(l,r,s),i.filter(function(e){return X(e[1])}),i.map(function(e){return L(e[1].groupOffsetTree,Math.max(e[0]-e[2],0),"v")[0]}),i.distinctUntilChanged(),i.map(function(e){return[e]})),c),{groupCounts:u,topItemsIndexes:c}},i.tup(te,T));function pe(e,t){return!(!e||e[0]!==t[0]||e[1]!==t[1])}function he(e,t){return!(!e||e.startIndex!==t.startIndex||e.endIndex!==t.endIndex)}function ge(e,t,n){return"number"==typeof e?n===ie&&"top"===t||"down"===n&&"bottom"===t?e:0:n===ie?"top"===t?e.main:e.reverse:"bottom"===t?e.main:e.reverse}function ve(e,t){return"number"==typeof e?e:e[t]||0}var Se=i.system(function(e){var t=e[0],n=t.scrollTop,o=t.viewportHeight,r=t.deviation,a=t.headerHeight,l=t.fixedHeaderHeight,s=i.stream(),u=i.statefulStream(0),c=i.statefulStream(0),m=i.statefulStream(0),f=i.statefulStreamFromEmitter(i.pipe(i.combineLatest(i.duc(n),i.duc(o),i.duc(a),i.duc(s,pe),i.duc(m),i.duc(u),i.duc(l),i.duc(r),i.duc(c)),i.map(function(e){var t=e[0],n=e[1],o=e[2],r=e[3],i=r[0],a=r[1],l=e[4],s=e[6],u=e[7],c=e[8],m=t-u,f=e[5]+s,d=Math.max(o-m,0),p="none",h=ve(c,"top"),g=ve(c,"bottom");return i-=u,a+=o+s,(i+=o+s)>t+f-h&&(p=ie),(a-=u)<t-d+n+g&&(p="down"),"none"!==p?[Math.max(m-o-ge(l,"top",p)-h,0),m-d-s+n+ge(l,"bottom",p)+g]:null}),i.filter(function(e){return null!=e}),i.distinctUntilChanged(pe)),[0,0]);return{listBoundary:s,overscan:m,topListHeight:u,increaseViewportBy:c,visibleRange:f}},i.tup(T),{singleton:!0}),Ce={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function Ie(e,t,n){if(0===e.length)return[];if(!X(t))return e.map(function(e){return l({},e,{index:e.index+n,originalIndex:e.index})});for(var o,r=[],i=M(t.groupOffsetTree,e[0].index,e[e.length-1].index),a=void 0,s=0,u=c(e);!(o=u()).done;){var m=o.value;(!a||a.end<m.index)&&(a=i.shift(),s=t.groupIndices.indexOf(a.start)),r.push(l({},m.index===a.start?{type:"group",index:s}:{index:m.index-(s+1)+n,groupIndex:s},{size:m.size,offset:m.offset,originalIndex:m.index,data:m.data}))}return r}function xe(e,t,n,o,r,i){var a=0,l=0;if(e.length>0){a=e[0].offset;var s=e[e.length-1];l=s.offset+s.size}var u=n-r.lastIndex,c=a,m=r.lastOffset+u*r.lastSize+(u-1)*o-l;return{items:Ie(e,r,i),topItems:Ie(t,r,i),topListHeight:t.reduce(function(e,t){return t.size+e},0),offsetTop:a,offsetBottom:m,top:c,bottom:l,totalCount:n,firstItemIndex:i}}var Te=i.system(function(e){var t=e[0],n=t.sizes,o=t.totalCount,r=t.data,a=t.firstItemIndex,s=t.gap,u=e[1],m=e[2],f=m.visibleRange,d=m.listBoundary,p=m.topListHeight,h=e[3],g=h.scrolledToInitialItem,v=h.initialTopMostItemIndex,S=e[4].topListHeight,C=e[5],I=e[6].didMount,x=e[7].recalcInProgress,T=i.statefulStream([]),w=i.stream();i.connect(u.topItemsIndexes,T);var b=i.statefulStreamFromEmitter(i.pipe(i.combineLatest(I,x,i.duc(f,pe),i.duc(o),i.duc(n),i.duc(v),g,i.duc(T),i.duc(a),i.duc(s),r),i.filter(function(e){return e[0]&&!e[1]}),i.map(function(e){var t=e[2],n=t[0],o=t[1],r=e[3],a=e[5],s=e[6],u=e[7],m=e[8],f=e[9],d=e[10],p=e[4],h=p.sizeTree,g=p.offsetTree;if(0===r||0===n&&0===o)return l({},Ce,{totalCount:r});if(y(h))return xe(function(e,t,n){if(X(t)){var o=Q(e,t);return[{index:L(t.groupOffsetTree,o)[0],size:0,offset:0},{index:o,size:0,offset:0,data:n&&n[0]}]}return[{index:e,size:0,offset:0,data:n&&n[0]}]}(function(e,t){return"number"==typeof e?e:"LAST"===e.index?t-1:e.index}(a,r),p,d),[],r,f,p,m);var v=[];if(u.length>0)for(var S,C=u[0],I=u[u.length-1],x=0,T=c(M(h,C,I));!(S=T()).done;)for(var w=S.value,b=w.value,E=Math.max(w.start,C),H=Math.min(w.end,I),R=E;R<=H;R++)v.push({index:R,size:b,offset:x,data:d&&d[R]}),x+=b;if(!s)return xe([],v,r,f,p,m);var k=u.length>0?u[u.length-1]+1:0,F=function(e,t,n,o){return void 0===o&&(o=0),o>0&&(t=Math.max(t,G(e,o,_).offset)),U((i=n,l=N(r=e,t,a=K),s=N(r,i,a,l),r.slice(l,s+1)),q);var r,i,a,l,s}(g,n,o,k);if(0===F.length)return null;var z=r-1;return xe(i.tap([],function(e){for(var t,r=c(F);!(t=r()).done;){var i=t.value,a=i.value,l=a.offset,s=i.start,u=a.size;if(a.offset<n){var m=(s+=Math.floor((n-a.offset+f)/(u+f)))-i.start;l+=m*u+m*f}s<k&&(l+=(k-s)*u,s=k);for(var p=Math.min(i.end,z),h=s;h<=p&&!(l>=o);h++)e.push({index:h,size:u,offset:l,data:d&&d[h]}),l+=u+f}}),v,r,f,p,m)}),i.filter(function(e){return null!==e}),i.distinctUntilChanged()),Ce);return i.connect(i.pipe(r,i.filter(function(e){return void 0!==e}),i.map(function(e){return e.length})),o),i.connect(i.pipe(b,i.map(function(e){return e.topListHeight})),S),i.connect(S,p),i.connect(i.pipe(b,i.map(function(e){return[e.top,e.bottom]})),d),i.connect(i.pipe(b,i.map(function(e){return e.items})),w),l({listState:b,topItemsIndexes:T,endReached:i.streamFromEmitter(i.pipe(b,i.filter(function(e){return e.items.length>0}),i.withLatestFrom(o,r),i.filter(function(e){var t=e[0].items;return t[t.length-1].originalIndex===e[1]-1}),i.map(function(e){return[e[1]-1,e[2]]}),i.distinctUntilChanged(pe),i.map(function(e){return e[0]}))),startReached:i.streamFromEmitter(i.pipe(b,i.throttleTime(200),i.filter(function(e){var t=e.items;return t.length>0&&t[0].originalIndex===e.topItems.length}),i.map(function(e){return e.items[0].index}),i.distinctUntilChanged())),rangeChanged:i.streamFromEmitter(i.pipe(b,i.filter(function(e){return e.items.length>0}),i.map(function(e){for(var t=e.items,n=0,o=t.length-1;"group"===t[n].type&&n<o;)n++;for(;"group"===t[o].type&&o>n;)o--;return{startIndex:t[n].index,endIndex:t[o].index}}),i.distinctUntilChanged(he))),itemsRendered:w},C)},i.tup(te,de,Se,ue,re,le,se,D),{singleton:!0}),we=i.system(function(e){var t=e[0],n=t.sizes,o=t.firstItemIndex,r=t.data,a=t.gap,l=e[1].listState,s=e[2].didMount,u=i.statefulStream(0);return i.connect(i.pipe(s,i.withLatestFrom(u),i.filter(function(e){return 0!==e[1]}),i.withLatestFrom(n,o,a,r),i.map(function(e){var t=e[0][1],n=e[1],o=e[2],r=e[3],i=e[4],a=void 0===i?[]:i,l=0;if(n.groupIndices.length>0)for(var s,u=c(n.groupIndices);!((s=u()).done||s.value-l>=t);)l++;var m=t+l;return xe(Array.from({length:m}).map(function(e,t){return{index:t,size:0,offset:0,data:a[t]}}),[],m,r,n,o)})),l),{initialItemCount:u}},i.tup(te,Te,se),{singleton:!0}),be=i.system(function(e){var t=e[0].scrollVelocity,n=i.statefulStream(!1),o=i.stream(),r=i.statefulStream(!1);return i.connect(i.pipe(t,i.withLatestFrom(r,n,o),i.filter(function(e){return!!e[1]}),i.map(function(e){var t=e[0],n=e[1],o=e[2],r=e[3],i=n.enter;if(o){if((0,n.exit)(t,r))return!1}else if(i(t,r))return!0;return o}),i.distinctUntilChanged()),n),i.subscribe(i.pipe(i.combineLatest(n,t,o),i.withLatestFrom(r)),function(e){var t=e[0],n=e[1];return t[0]&&n&&n.change&&n.change(t[1],t[2])}),{isSeeking:n,scrollSeekConfiguration:r,scrollVelocity:t,scrollSeekRangeChanged:o}},i.tup(le),{singleton:!0}),ye=i.system(function(e){var t=e[0].topItemsIndexes,n=i.statefulStream(0);return i.connect(i.pipe(n,i.filter(function(e){return e>0}),i.map(function(e){return Array.from({length:e}).map(function(e,t){return t})})),t),{topItemCount:n}},i.tup(Te)),Ee=i.system(function(e){var t=e[0],n=t.footerHeight,o=t.headerHeight,r=t.fixedHeaderHeight,a=t.fixedFooterHeight,l=e[1].listState,s=i.stream(),u=i.statefulStreamFromEmitter(i.pipe(i.combineLatest(n,a,o,r,l),i.map(function(e){var t=e[4];return e[0]+e[1]+e[2]+e[3]+t.offsetBottom+t.bottom})),0);return i.connect(i.duc(u),s),{totalListHeight:u,totalListHeightChanged:s}},i.tup(T,Te),{singleton:!0});function He(e){var t,n=!1;return function(){return n||(n=!0,t=e()),t}}var Le=He(function(){return/iP(ad|hone|od).+Version\/[\d.]+.*Safari/i.test(navigator.userAgent)}),Re=i.system(function(e){var t=e[0],n=t.scrollBy,o=t.scrollTop,r=t.deviation,a=t.scrollingInProgress,l=e[1],s=l.isScrolling,u=l.isAtBottom,c=l.scrollDirection,m=e[3],f=m.beforeUnshiftWith,d=m.shiftWithOffset,p=m.sizes,h=m.gap,g=e[4].log,v=e[5].recalcInProgress,S=i.streamFromEmitter(i.pipe(e[2].listState,i.withLatestFrom(l.lastJumpDueToItemResize),i.scan(function(e,t){var n=e[1],o=t[0],r=o.items,i=o.totalCount,a=o.bottom+o.offsetBottom,l=0;return e[2]===i&&n.length>0&&r.length>0&&(0===r[0].originalIndex&&0===n[0].originalIndex||0!=(l=a-e[3])&&(l+=t[1])),[l,r,i,a]},[0,[],0,0]),i.filter(function(e){return 0!==e[0]}),i.withLatestFrom(o,c,a,u,g),i.filter(function(e){return!e[3]&&0!==e[1]&&e[2]===ie}),i.map(function(e){var t=e[0][0];return(0,e[5])("Upward scrolling compensation",{amount:t},exports.LogLevel.DEBUG),t})));function C(e){e>0?(i.publish(n,{top:-e,behavior:"auto"}),i.publish(r,0)):(i.publish(r,0),i.publish(n,{top:-e,behavior:"auto"}))}return i.subscribe(i.pipe(S,i.withLatestFrom(r,s)),function(e){var t=e[0],n=e[1];e[2]&&Le()?i.publish(r,n-t):C(-t)}),i.subscribe(i.pipe(i.combineLatest(i.statefulStreamFromEmitter(s,!1),r,v),i.filter(function(e){return!e[0]&&!e[2]&&0!==e[1]}),i.map(function(e){return e[1]}),i.throttleTime(1)),C),i.connect(i.pipe(d,i.map(function(e){return{top:-e}})),n),i.subscribe(i.pipe(f,i.withLatestFrom(p,h),i.map(function(e){var t=e[0];return t*e[1].lastSize+t*e[2]})),function(e){i.publish(r,e),requestAnimationFrame(function(){i.publish(n,{top:e}),requestAnimationFrame(function(){i.publish(r,0),i.publish(v,!1)})})}),{deviation:r}},i.tup(T,le,Te,te,h,D)),ke=i.system(function(e){var t=e[0].totalListHeight,n=e[1].didMount,o=e[2].scrollTo,r=i.statefulStream(0);return i.subscribe(i.pipe(n,i.withLatestFrom(r),i.filter(function(e){return 0!==e[1]}),i.map(function(e){return{top:e[1]}})),function(e){i.handleNext(i.pipe(t,i.filter(function(e){return 0!==e})),function(){setTimeout(function(){i.publish(o,e)})})}),{initialScrollTop:r}},i.tup(Ee,se,T),{singleton:!0}),Fe=i.system(function(e){var t=e[0].viewportHeight,n=e[1].totalListHeight,o=i.statefulStream(!1);return{alignToBottom:o,paddingTopAddition:i.statefulStreamFromEmitter(i.pipe(i.combineLatest(o,t,n),i.filter(function(e){return e[0]}),i.map(function(e){return Math.max(0,e[1]-e[2])}),i.distinctUntilChanged()),0)}},i.tup(T,Ee),{singleton:!0}),ze=i.system(function(e){var t=e[0],n=t.scrollTo,o=t.scrollContainerState,r=i.stream(),a=i.stream(),s=i.stream(),u=i.statefulStream(!1),c=i.statefulStream(void 0);return i.connect(i.pipe(i.combineLatest(r,a),i.map(function(e){var t=e[0],n=t.viewportHeight,o=t.scrollHeight;return{scrollTop:Math.max(0,t.scrollTop-e[1].offsetTop),scrollHeight:o,viewportHeight:n}})),o),i.connect(i.pipe(n,i.withLatestFrom(a),i.map(function(e){var t=e[0];return l({},t,{top:t.top+e[1].offsetTop})})),s),{useWindowScroll:u,customScrollParent:c,windowScrollContainerState:r,windowViewportRect:a,windowScrollTo:s}},i.tup(T)),Be=["done","behavior","align"],Pe=i.system(function(e){var t=e[0],n=t.sizes,o=t.totalCount,r=t.gap,a=e[1],u=a.scrollTop,c=a.viewportHeight,m=a.headerHeight,f=a.fixedHeaderHeight,d=a.fixedFooterHeight,p=a.scrollingInProgress,h=e[2].scrollToIndex,g=i.stream();return i.connect(i.pipe(g,i.withLatestFrom(n,c,o,m,f,d,u),i.withLatestFrom(r),i.map(function(e){var t=e[0],n=t[0],o=t[1],r=t[2],a=t[3],u=t[4],c=t[5],m=t[6],f=t[7],d=e[1],h=n.done,g=n.behavior,v=n.align,S=s(n,Be),C=null,I=$(n,o,a-1),x=J(I,o.offsetTree,d)+u+c;return x<f+c?C=l({},S,{behavior:g,align:null!=v?v:"start"}):x+L(o.sizeTree,I)[1]>f+r-m&&(C=l({},S,{behavior:g,align:null!=v?v:"end"})),C?h&&i.handleNext(i.pipe(p,i.skip(1),i.filter(function(e){return!1===e})),h):h&&h(),C}),i.filter(function(e){return null!==e})),h),{scrollIntoView:g}},i.tup(te,T,re,Te,h),{singleton:!0}),Oe=["listState","topItemsIndexes"],Ve=i.system(function(e){return l({},e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},i.tup(Se,we,se,be,Ee,ke,Fe,ze,Pe)),Me=i.system(function(e){var t=e[0],n=t.totalCount,o=t.sizeRanges,r=t.fixedItemSize,a=t.defaultItemSize,u=t.trackItemSizes,c=t.itemSize,m=t.data,f=t.firstItemIndex,d=t.groupIndices,p=t.statefulTotalCount,h=t.gap,g=e[1],v=g.initialTopMostItemIndex,S=g.scrolledToInitialItem,C=e[2],I=e[3],x=e[4],T=x.listState,w=x.topItemsIndexes,b=s(x,Oe),y=e[5].scrollToIndex,E=e[7].topItemCount,H=e[8].groupCounts,L=e[9],R=e[10];return i.connect(b.rangeChanged,L.scrollSeekRangeChanged),i.connect(i.pipe(L.windowViewportRect,i.map(function(e){return e.visibleHeight})),C.viewportHeight),l({totalCount:n,data:m,firstItemIndex:f,sizeRanges:o,initialTopMostItemIndex:v,scrolledToInitialItem:S,topItemsIndexes:w,topItemCount:E,groupCounts:H,fixedItemHeight:r,defaultItemHeight:a,gap:h},I,{statefulTotalCount:p,listState:T,scrollToIndex:y,trackItemSizes:u,itemSize:c,groupIndices:d},b,L,C,R)},i.tup(te,ue,T,me,Te,re,Re,ye,de,Ve,h)),Ue=He(function(){if("undefined"==typeof document)return"sticky";var e=document.createElement("div");return e.style.position="-webkit-sticky","-webkit-sticky"===e.style.position?"-webkit-sticky":"sticky"});function Ae(e,t){var o=n.useRef(null),r=n.useCallback(function(n){if(null!==n&&n.offsetParent){var r,i,a=n.getBoundingClientRect(),l=a.width;if(t){var s=t.getBoundingClientRect(),u=a.top-s.top;r=s.height-Math.max(0,u),i=u+t.scrollTop}else r=window.innerHeight-Math.max(0,a.top),i=a.top+window.pageYOffset;o.current={offsetTop:i,visibleHeight:r,visibleWidth:l},e(o.current)}},[e,t]),i=g(r),a=i.callbackRef,l=i.ref,s=n.useCallback(function(){r(l.current)},[r,l]);return n.useEffect(function(){if(t){t.addEventListener("scroll",s);var e=new ResizeObserver(s);return e.observe(t),function(){t.removeEventListener("scroll",s),e.unobserve(t)}}return window.addEventListener("scroll",s),window.addEventListener("resize",s),function(){window.removeEventListener("scroll",s),window.removeEventListener("resize",s)}},[s,t]),a}var We=a.createContext(void 0),Ne=["placeholder"],Ge=["style","children"],De=["style","children"];function je(e){return e}var _e=i.system(function(){var e=i.statefulStream(function(e){return"Item "+e}),t=i.statefulStream(null),n=i.statefulStream(function(e){return"Group "+e}),o=i.statefulStream({}),r=i.statefulStream(je),a=i.statefulStream("div"),l=i.statefulStream(i.noop),s=function(e,t){return void 0===t&&(t=null),i.statefulStreamFromEmitter(i.pipe(o,i.map(function(t){return t[e]}),i.distinctUntilChanged()),t)};return{context:t,itemContent:e,groupContent:n,components:o,computeItemKey:r,headerFooterTag:a,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")}});function Ke(e,t){var n=i.stream();return i.subscribe(n,function(){return console.warn("react-virtuoso: You are using a deprecated property. "+t,"color: red;","color: inherit;","color: blue;")}),i.connect(n,e),n}var qe=i.system(function(e){var t=e[0],n=e[1],o={item:Ke(n.itemContent,"Rename the %citem%c prop to %citemContent."),group:Ke(n.groupContent,"Rename the %cgroup%c prop to %cgroupContent."),topItems:Ke(t.topItemCount,"Rename the %ctopItems%c prop to %ctopItemCount."),itemHeight:Ke(t.fixedItemHeight,"Rename the %citemHeight%c prop to %cfixedItemHeight."),scrollingStateChange:Ke(t.isScrolling,"Rename the %cscrollingStateChange%c prop to %cisScrolling."),adjustForPrependedItems:i.stream(),maxHeightCacheSize:i.stream(),footer:i.stream(),header:i.stream(),HeaderContainer:i.stream(),FooterContainer:i.stream(),ItemContainer:i.stream(),ScrollContainer:i.stream(),GroupContainer:i.stream(),ListContainer:i.stream(),emptyComponent:i.stream(),scrollSeek:i.stream()};function r(e,t,o){i.connect(i.pipe(e,i.withLatestFrom(n.components),i.map(function(e){var n,r=e[0],i=e[1];return console.warn("react-virtuoso: "+o+" property is deprecated. Pass components."+t+" instead."),l({},i,((n={})[t]=r,n))})),n.components)}return i.subscribe(o.adjustForPrependedItems,function(){console.warn("react-virtuoso: adjustForPrependedItems is no longer supported. Use the firstItemIndex property instead - https://virtuoso.dev/prepend-items.","color: red;","color: inherit;","color: blue;")}),i.subscribe(o.maxHeightCacheSize,function(){console.warn("react-virtuoso: maxHeightCacheSize is no longer necessary. Setting it has no effect - remove it from your code.")}),i.subscribe(o.HeaderContainer,function(){console.warn("react-virtuoso: HeaderContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the header component and pass components.Header to change its contents.")}),i.subscribe(o.FooterContainer,function(){console.warn("react-virtuoso: FooterContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the footer component and pass components.Footer to change its contents.")}),i.subscribe(o.scrollSeek,function(e){var o=e.placeholder,r=s(e,Ne);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),i.publish(n.components,l({},i.getValue(n.components),{ScrollSeekPlaceholder:o})),i.publish(t.scrollSeekConfiguration,r)}),r(o.footer,"Footer","footer"),r(o.header,"Header","header"),r(o.ItemContainer,"Item","ItemContainer"),r(o.ListContainer,"List","ListContainer"),r(o.ScrollContainer,"Scroller","ScrollContainer"),r(o.emptyComponent,"EmptyPlaceholder","emptyComponent"),r(o.GroupContainer,"Group","GroupContainer"),l({},t,n,o)},i.tup(Me,_e)),Ye=function(e){return a.createElement("div",{style:{height:e.height}})},Ze={position:Ue(),zIndex:1,overflowAnchor:"none"},Je={overflowAnchor:"none"},$e=a.memo(function(e){var t=e.showTopList,o=void 0!==t&&t,r=dt("listState"),s=ft("sizeRanges"),u=dt("useWindowScroll"),c=dt("customScrollParent"),m=ft("windowScrollContainerState"),f=ft("scrollContainerState"),d=c||u?m:f,p=dt("itemContent"),h=dt("context"),g=dt("groupContent"),v=dt("trackItemSizes"),C=dt("itemSize"),I=dt("log"),x=ft("gap"),T=S(s,C,v,o?i.noop:d,I,x,c).callbackRef,w=a.useState(0),b=w[0],y=w[1];pt("deviation",function(e){b!==e&&y(e)});var E=dt("EmptyPlaceholder"),H=dt("ScrollSeekPlaceholder")||Ye,L=dt("ListComponent"),R=dt("ItemComponent"),k=dt("GroupComponent"),F=dt("computeItemKey"),z=dt("isSeeking"),B=dt("groupIndices").length>0,P=dt("paddingTopAddition"),O=o?{}:{boxSizing:"border-box",paddingTop:r.offsetTop+P,paddingBottom:r.offsetBottom,marginTop:b};return!o&&0===r.totalCount&&E?n.createElement(E,tt(E,h)):n.createElement(L,l({},tt(L,h),{ref:T,style:O,"data-test-id":o?"virtuoso-top-item-list":"virtuoso-item-list"}),(o?r.topItems:r.items).map(function(e){var t=e.originalIndex,o=F(t+r.firstItemIndex,e.data,h);return z?n.createElement(H,l({},tt(H,h),{key:o,index:e.index,height:e.size,type:e.type||"item"},"group"===e.type?{}:{groupIndex:e.groupIndex})):"group"===e.type?n.createElement(k,l({},tt(k,h),{key:o,"data-index":t,"data-known-size":e.size,"data-item-index":e.index,style:Ze}),g(e.index)):n.createElement(R,l({},tt(R,h),{key:o,"data-index":t,"data-known-size":e.size,"data-item-index":e.index,"data-item-group-index":e.groupIndex,style:Je}),B?p(e.index,e.groupIndex,e.data,h):p(e.index,e.data,h))}))}),Qe={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Xe={width:"100%",height:"100%",position:"absolute",top:0},et={width:"100%",position:Ue(),top:0};function tt(e,t){if("string"!=typeof e)return{context:t}}var nt=a.memo(function(){var e=dt("HeaderComponent"),t=ft("headerHeight"),o=dt("headerFooterTag"),r=v(function(e){return t(C(e,"height"))}),i=dt("context");return e?n.createElement(o,{ref:r},n.createElement(e,tt(e,i))):null}),ot=a.memo(function(){var e=dt("FooterComponent"),t=ft("footerHeight"),o=dt("headerFooterTag"),r=v(function(e){return t(C(e,"height"))}),i=dt("context");return e?n.createElement(o,{ref:r},n.createElement(e,tt(e,i))):null});function rt(e){var t=e.usePublisher,o=e.useEmitter,r=e.useEmitterValue;return a.memo(function(e){var i=e.style,a=e.children,u=s(e,Ge),c=t("scrollContainerState"),m=r("ScrollerComponent"),f=t("smoothScrollTargetReached"),d=r("scrollerRef"),p=r("context"),h=x(c,f,m,d),g=h.scrollerRef,v=h.scrollByCallback;return o("scrollTo",h.scrollToCallback),o("scrollBy",v),n.createElement(m,l({ref:g,style:l({},Qe,i),"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0},u,tt(m,p)),a)})}function it(e){var t=e.usePublisher,o=e.useEmitter,r=e.useEmitterValue;return a.memo(function(e){var a=e.style,u=e.children,c=s(e,De),m=t("windowScrollContainerState"),f=r("ScrollerComponent"),p=t("smoothScrollTargetReached"),h=r("totalListHeight"),g=r("deviation"),v=r("customScrollParent"),S=r("context"),C=x(m,p,f,i.noop,v),I=C.scrollerRef,T=C.scrollByCallback,w=C.scrollToCallback;return d(function(){return I.current=v||window,function(){I.current=null}},[I,v]),o("windowScrollTo",w),o("scrollBy",T),n.createElement(f,l({style:l({position:"relative"},a,0!==h?{height:h+g}:{}),"data-virtuoso-scroller":!0},c,tt(f,S)),u)})}var at=function(e){var t=e.children,o=n.useContext(We),r=ft("viewportHeight"),l=ft("fixedItemHeight"),s=v(i.compose(r,function(e){return C(e,"height")}));return a.useEffect(function(){o&&(r(o.viewportHeight),l(o.itemHeight))},[o,r,l]),a.createElement("div",{style:Xe,ref:s,"data-viewport-type":"element"},t)},lt=function(e){var t=e.children,o=n.useContext(We),r=ft("windowViewportRect"),i=ft("fixedItemHeight"),l=dt("customScrollParent"),s=Ae(r,l);return a.useEffect(function(){o&&(i(o.itemHeight),r({offsetTop:0,visibleHeight:o.viewportHeight,visibleWidth:100}))},[o,r,i]),a.createElement("div",{ref:s,style:Xe,"data-viewport-type":"window"},t)},st=function(e){var t=e.children,o=dt("TopItemListComponent"),r=dt("headerHeight"),i=l({},et,{marginTop:r+"px"}),a=dt("context");return n.createElement(o||"div",{style:i,context:a},t)},ut=a.memo(function(e){var t=dt("useWindowScroll"),n=dt("topItemsIndexes").length>0,o=dt("customScrollParent"),r=o||t?lt:at;return a.createElement(o||t?gt:ht,l({},e),a.createElement(r,null,a.createElement(nt,null),a.createElement($e,null),a.createElement(ot,null)),n&&a.createElement(st,null,a.createElement($e,{showTopList:!0})))}),ct=e.systemToComponent(qe,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",groupContent:"groupContent",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",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",react18ConcurrentRendering:"react18ConcurrentRendering",item:"item",group:"group",topItems:"topItems",itemHeight:"itemHeight",scrollingStateChange:"scrollingStateChange",maxHeightCacheSize:"maxHeightCacheSize",footer:"footer",header:"header",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",GroupContainer:"GroupContainer",emptyComponent:"emptyComponent",HeaderContainer:"HeaderContainer",FooterContainer:"FooterContainer",scrollSeek:"scrollSeek"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",adjustForPrependedItems:"adjustForPrependedItems",autoscrollToBottom:"autoscrollToBottom"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},ut),mt=ct.Component,ft=ct.usePublisher,dt=ct.useEmitterValue,pt=ct.useEmitter,ht=rt({usePublisher:ft,useEmitterValue:dt,useEmitter:pt}),gt=it({usePublisher:ft,useEmitterValue:dt,useEmitter:pt}),vt={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},St={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Ct=Math.round,It=Math.ceil,xt=Math.floor,Tt=Math.min,wt=Math.max;function bt(e,t){return Array.from({length:t-e+1}).map(function(t,n){return{index:n+e}})}function yt(e,t){return e&&e.column===t.column&&e.row===t.row}var Et=i.system(function(e){var t=e[0],n=t.overscan,o=t.visibleRange,r=t.listBoundary,a=e[1],s=a.scrollTop,u=a.viewportHeight,c=a.scrollBy,m=a.scrollTo,f=a.smoothScrollTargetReached,d=a.scrollContainerState,p=e[2],h=e[3],g=e[4],v=g.propsReady,S=g.didMount,C=e[5],I=C.windowViewportRect,x=C.windowScrollTo,T=C.useWindowScroll,w=C.customScrollParent,b=C.windowScrollContainerState,y=e[6],E=i.statefulStream(0),H=i.statefulStream(0),L=i.statefulStream(vt),R=i.statefulStream({height:0,width:0}),k=i.statefulStream({height:0,width:0}),F=i.stream(),z=i.stream(),B=i.statefulStream(0),P=i.statefulStream({row:0,column:0});i.connect(i.pipe(S,i.withLatestFrom(H),i.filter(function(e){return 0!==e[1]}),i.map(function(e){return{items:bt(0,e[1]-1),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0}})),L),i.connect(i.pipe(i.combineLatest(i.duc(E),o,i.duc(P,yt),i.duc(k,function(e,t){return e&&e.width===t.width&&e.height===t.height})),i.withLatestFrom(R),i.map(function(e){var t=e[0],n=t[0],o=t[1],r=o[0],i=o[1],a=t[2],l=t[3],s=e[1],u=a.row,c=l.height,m=l.width,f=s.width;if(0===n||0===f)return vt;if(0===m)return St;var d=Rt(f,m,a.column),p=d*xt((r+u)/(c+u)),h=d*It((i+u)/(c+u))-1;h=wt(0,Tt(n-1,h));var g=bt(p=Tt(h,wt(0,p)),h),v=Ht(s,a,l,g),S=v.top,C=v.bottom,I=It(n/d);return{items:g,offsetTop:S,offsetBottom:I*c+(I-1)*u-C,top:S,bottom:C,itemHeight:c,itemWidth:m}})),L),i.connect(i.pipe(R,i.map(function(e){return e.height})),u),i.connect(i.pipe(i.combineLatest(R,k,L,P),i.map(function(e){var t=Ht(e[0],e[3],e[1],e[2].items);return[t.top,t.bottom]}),i.distinctUntilChanged(pe)),r);var O=i.streamFromEmitter(i.pipe(i.duc(L),i.filter(function(e){return e.items.length>0}),i.withLatestFrom(E),i.filter(function(e){var t=e[0].items;return t[t.length-1].index===e[1]-1}),i.map(function(e){return e[1]-1}),i.distinctUntilChanged())),V=i.streamFromEmitter(i.pipe(i.duc(L),i.filter(function(e){var t=e.items;return t.length>0&&0===t[0].index}),i.mapTo(0),i.distinctUntilChanged())),M=i.streamFromEmitter(i.pipe(i.duc(L),i.filter(function(e){return e.items.length>0}),i.map(function(e){var t=e.items;return{startIndex:t[0].index,endIndex:t[t.length-1].index}}),i.distinctUntilChanged(he)));i.connect(M,h.scrollSeekRangeChanged),i.connect(i.pipe(F,i.withLatestFrom(R,k,E,P),i.map(function(e){var t=e[1],n=e[2],o=e[3],r=e[4],i=oe(e[0]),a=i.align,l=i.behavior,s=i.offset,u=i.index;"LAST"===u&&(u=o-1);var c=Lt(t,r,n,u=wt(0,u,Tt(o-1,u)));return"end"===a?c=Ct(c-t.height+n.height):"center"===a&&(c=Ct(c-t.height/2+n.height/2)),s&&(c+=s),{top:c,behavior:l}})),m);var U=i.statefulStreamFromEmitter(i.pipe(L,i.map(function(e){return e.offsetBottom+e.bottom})),0);return i.connect(i.pipe(I,i.map(function(e){return{width:e.visibleWidth,height:e.visibleHeight}})),R),l({totalCount:E,viewportDimensions:R,itemDimensions:k,scrollTop:s,scrollHeight:z,overscan:n,scrollBy:c,scrollTo:m,scrollToIndex:F,smoothScrollTargetReached:f,windowViewportRect:I,windowScrollTo:x,useWindowScroll:T,customScrollParent:w,windowScrollContainerState:b,deviation:B,scrollContainerState:d,initialItemCount:H,gap:P},h,{gridState:L,totalListHeight:U},p,{startReached:V,endReached:O,rangeChanged:M,propsReady:v},y)},i.tup(Se,T,le,be,se,ze,h));function Ht(e,t,n,o){var r=n.height;return void 0===r||0===o.length?{top:0,bottom:0}:{top:Lt(e,t,n,o[0].index),bottom:Lt(e,t,n,o[o.length-1].index)+r}}function Lt(e,t,n,o){var r=Rt(e.width,n.width,t.column),i=xt(o/r),a=i*n.height+wt(0,i-1)*t.row;return a>0?a+t.row:a}function Rt(e,t,n){return wt(1,xt((e+n)/(t+n)))}var kt=["placeholder"],Ft=i.system(function(){var e=i.statefulStream(function(e){return"Item "+e}),t=i.statefulStream({}),n=i.statefulStream(null),o=i.statefulStream("virtuoso-grid-item"),r=i.statefulStream("virtuoso-grid-list"),a=i.statefulStream(je),l=i.statefulStream(i.noop),s=function(e,n){return void 0===n&&(n=null),i.statefulStreamFromEmitter(i.pipe(t,i.map(function(t){return t[e]}),i.distinctUntilChanged()),n)};return{context:n,itemContent:e,components:t,computeItemKey:a,itemClassName:o,listClassName:r,scrollerRef:l,ListComponent:s("List","div"),ItemComponent:s("Item","div"),ScrollerComponent:s("Scroller","div"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder","div")}}),zt=i.system(function(e){var t=e[0],n=e[1],o={item:Ke(n.itemContent,"Rename the %citem%c prop to %citemContent."),ItemContainer:i.stream(),ScrollContainer:i.stream(),ListContainer:i.stream(),emptyComponent:i.stream(),scrollSeek:i.stream()};function r(e,t,o){i.connect(i.pipe(e,i.withLatestFrom(n.components),i.map(function(e){var n,r=e[0],i=e[1];return console.warn("react-virtuoso: "+o+" property is deprecated. Pass components."+t+" instead."),l({},i,((n={})[t]=r,n))})),n.components)}return i.subscribe(o.scrollSeek,function(e){var o=e.placeholder,r=s(e,kt);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),i.publish(n.components,l({},i.getValue(n.components),{ScrollSeekPlaceholder:o})),i.publish(t.scrollSeekConfiguration,r)}),r(o.ItemContainer,"Item","ItemContainer"),r(o.ListContainer,"List","ListContainer"),r(o.ScrollContainer,"Scroller","ScrollContainer"),l({},t,n,o)},i.tup(Et,Ft)),Bt=a.memo(function(){var e=Wt("gridState"),t=Wt("listClassName"),o=Wt("itemClassName"),r=Wt("itemContent"),i=Wt("computeItemKey"),a=Wt("isSeeking"),s=At("scrollHeight"),u=Wt("ItemComponent"),c=Wt("ListComponent"),m=Wt("ScrollSeekPlaceholder"),f=Wt("context"),d=At("itemDimensions"),p=At("gap"),h=Wt("log"),g=v(function(e){s(e.parentElement.parentElement.scrollHeight);var t=e.firstChild;t&&d(t.getBoundingClientRect()),p({row:jt("row-gap",getComputedStyle(e).rowGap,h),column:jt("column-gap",getComputedStyle(e).columnGap,h)})});return n.createElement(c,l({ref:g,className:t},tt(c,f),{style:{paddingTop:e.offsetTop,paddingBottom:e.offsetBottom}}),e.items.map(function(t){var s=i(t.index);return a?n.createElement(m,l({key:s},tt(m,f),{index:t.index,height:e.itemHeight,width:e.itemWidth})):n.createElement(u,l({},tt(u,f),{className:o,"data-index":t.index,key:s}),r(t.index,f))}))}),Pt=function(e){var t=e.children,n=At("viewportDimensions"),o=v(function(e){n(e.getBoundingClientRect())});return a.createElement("div",{style:Xe,ref:o},t)},Ot=function(e){var t=e.children,n=Ae(At("windowViewportRect"),Wt("customScrollParent"));return a.createElement("div",{ref:n,style:Xe},t)},Vt=a.memo(function(e){var t=l({},e),n=Wt("useWindowScroll"),o=Wt("customScrollParent"),r=o||n?Ot:Pt;return a.createElement(o||n?Dt:Gt,l({},t),a.createElement(r,null,a.createElement(Bt,null)))}),Mt=e.systemToComponent(zt,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",item:"item",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",scrollSeek:"scrollSeek"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange"}},Vt),Ut=Mt.Component,At=Mt.usePublisher,Wt=Mt.useEmitterValue,Nt=Mt.useEmitter,Gt=rt({usePublisher:At,useEmitterValue:Wt,useEmitter:Nt}),Dt=it({usePublisher:At,useEmitterValue:Wt,useEmitter:Nt});function jt(e,t,n){return"normal"===t||null!=t&&t.endsWith("px")||n(e+" was not resolved to pixel value correctly",t,exports.LogLevel.WARN),"normal"===t?0:parseInt(null!=t?t:"0",10)}var _t=i.system(function(){var e=i.statefulStream(function(e){return a.createElement("td",null,"Item $",e)}),t=i.statefulStream(null),n=i.statefulStream(null),o=i.statefulStream(null),r=i.statefulStream({}),l=i.statefulStream(je),s=i.statefulStream(i.noop),u=function(e,t){return void 0===t&&(t=null),i.statefulStreamFromEmitter(i.pipe(r,i.map(function(t){return t[e]}),i.distinctUntilChanged()),t)};return{context:t,itemContent:e,fixedHeaderContent:n,fixedFooterContent:o,components:r,computeItemKey:l,scrollerRef:s,TableComponent:u("Table","table"),TableHeadComponent:u("TableHead","thead"),TableFooterComponent:u("TableFoot","tfoot"),TableBodyComponent:u("TableBody","tbody"),TableRowComponent:u("TableRow","tr"),ScrollerComponent:u("Scroller","div"),EmptyPlaceholder:u("EmptyPlaceholder"),ScrollSeekPlaceholder:u("ScrollSeekPlaceholder"),FillerRow:u("FillerRow")}}),Kt=i.system(function(e){return l({},e[0],e[1])},i.tup(Me,_t)),qt=function(e){return a.createElement("tr",null,a.createElement("td",{style:{height:e.height}}))},Yt=function(e){return a.createElement("tr",null,a.createElement("td",{style:{height:e.height,padding:0,border:0}}))},Zt=a.memo(function(){var e=nn("listState"),t=tn("sizeRanges"),o=nn("useWindowScroll"),r=nn("customScrollParent"),i=tn("windowScrollContainerState"),s=tn("scrollContainerState"),u=r||o?i:s,c=nn("itemContent"),m=nn("trackItemSizes"),f=S(t,nn("itemSize"),m,u,nn("log"),void 0,r),d=f.callbackRef,p=f.ref,h=a.useState(0),g=h[0],v=h[1];on("deviation",function(e){g!==e&&(p.current.style.marginTop=e+"px",v(e))});var C=nn("EmptyPlaceholder"),I=nn("ScrollSeekPlaceholder")||qt,x=nn("FillerRow")||Yt,T=nn("TableBodyComponent"),w=nn("TableRowComponent"),b=nn("computeItemKey"),y=nn("isSeeking"),E=nn("paddingTopAddition"),H=nn("firstItemIndex"),L=nn("statefulTotalCount"),R=nn("context");if(0===L&&C)return n.createElement(C,tt(C,R));var k=e.offsetTop+E+g,F=e.offsetBottom,z=k>0?a.createElement(x,{height:k,key:"padding-top"}):null,B=F>0?a.createElement(x,{height:F,key:"padding-bottom"}):null,P=e.items.map(function(e){var t=e.originalIndex,o=b(t+H,e.data,R);return y?n.createElement(I,l({},tt(I,R),{key:o,index:e.index,height:e.size,type:e.type||"item"})):n.createElement(w,l({},tt(w,R),{key:o,"data-index":t,"data-known-size":e.size,"data-item-index":e.index,style:{overflowAnchor:"none"}}),c(e.index,e.data,R))});return n.createElement(T,l({ref:d,"data-test-id":"virtuoso-item-list"},tt(T,R)),[z].concat(P,[B]))}),Jt=function(e){var t=e.children,o=n.useContext(We),r=tn("viewportHeight"),l=tn("fixedItemHeight"),s=v(i.compose(r,function(e){return C(e,"height")}));return a.useEffect(function(){o&&(r(o.viewportHeight),l(o.itemHeight))},[o,r,l]),a.createElement("div",{style:Xe,ref:s,"data-viewport-type":"element"},t)},$t=function(e){var t=e.children,o=n.useContext(We),r=tn("windowViewportRect"),i=tn("fixedItemHeight"),l=nn("customScrollParent"),s=Ae(r,l);return a.useEffect(function(){o&&(i(o.itemHeight),r({offsetTop:0,visibleHeight:o.viewportHeight,visibleWidth:100}))},[o,r,i]),a.createElement("div",{ref:s,style:Xe,"data-viewport-type":"window"},t)},Qt=a.memo(function(e){var t=nn("useWindowScroll"),n=nn("customScrollParent"),o=tn("fixedHeaderHeight"),r=tn("fixedFooterHeight"),s=nn("fixedHeaderContent"),u=nn("fixedFooterContent"),c=nn("context"),m=v(i.compose(o,function(e){return C(e,"height")})),f=v(i.compose(r,function(e){return C(e,"height")})),d=n||t?an:rn,p=n||t?$t:Jt,h=nn("TableComponent"),g=nn("TableHeadComponent"),S=nn("TableFooterComponent"),I=s?a.createElement(g,l({key:"TableHead",style:{zIndex:1,position:"sticky",top:0},ref:m},tt(g,c)),s()):null,x=u?a.createElement(S,l({key:"TableFoot",style:{zIndex:1,position:"sticky",bottom:0},ref:f},tt(S,c)),u()):null;return a.createElement(d,l({},e),a.createElement(p,null,a.createElement(h,l({style:{borderSpacing:0}},tt(h,c)),[I,a.createElement(Zt,{key:"TableBody"}),x])))}),Xt=e.systemToComponent(Kt,{required:{},optional:{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",react18ConcurrentRendering:"react18ConcurrentRendering"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Qt),en=Xt.Component,tn=Xt.usePublisher,nn=Xt.useEmitterValue,on=Xt.useEmitter,rn=rt({usePublisher:tn,useEmitterValue:nn,useEmitter:on}),an=it({usePublisher:tn,useEmitterValue:nn,useEmitter:on}),ln=mt,sn=en,un=Ut;exports.GroupedVirtuoso=mt,exports.TableVirtuoso=sn,exports.Virtuoso=ln,exports.VirtuosoGrid=un,exports.VirtuosoMockContext=We; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import{systemToComponent as t}from"@virtuoso.dev/react-urx";import*as e from"@virtuoso.dev/urx";import*as n from"react";import{useLayoutEffect as o,useEffect as r,useRef as i,useCallback as a,createElement as l,useContext as s}from"react";import{flushSync as u}from"react-dom";function c(){return c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},c.apply(this,arguments)}function m(t,e){if(null==t)return{};var n,o,r={},i=Object.keys(t);for(o=0;o<i.length;o++)e.indexOf(n=i[o])>=0||(r[n]=t[n]);return r}function d(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}function f(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return d(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var p,h,g="undefined"!=typeof document?o:r;!function(t){t[t.DEBUG=0]="DEBUG",t[t.INFO=1]="INFO",t[t.WARN=2]="WARN",t[t.ERROR=3]="ERROR"}(h||(h={}));var v=((p={})[h.DEBUG]="debug",p[h.INFO]="log",p[h.WARN]="warn",p[h.ERROR]="error",p),S=e.system(function(){var t=e.statefulStream(h.ERROR);return{log:e.statefulStream(function(n,o,r){var i;void 0===r&&(r=h.INFO),r>=(null!=(i=("undefined"==typeof globalThis?window:globalThis).VIRTUOSO_LOG_LEVEL)?i:e.getValue(t))&&console[v[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,o)}),logLevel:t}},[],{singleton:!0});function I(t,e){void 0===e&&(e=!0);var n=i(null),o=function(t){};if("undefined"!=typeof ResizeObserver){var r=new ResizeObserver(function(e){var n=e[0].target;null!==n.offsetParent&&t(n)});o=function(t){t&&e?(r.observe(t),n.current=t):(n.current&&r.unobserve(n.current),n.current=null)}}return{ref:n,callbackRef:o}}function C(t,e){return void 0===e&&(e=!0),I(t,e).callbackRef}function T(t,e,n,o,r,i,a){return I(function(n){for(var l=function(t,e,n,o){var r=t.length;if(0===r)return null;for(var i=[],a=0;a<r;a++){var l=t.item(a);if(l&&void 0!==l.dataset.index){var s=parseInt(l.dataset.index),u=parseFloat(l.dataset.knownSize),c=e(l,"offsetHeight");if(0===c&&o("Zero-sized element, this should not happen",{child:l},h.ERROR),c!==u){var m=i[i.length-1];0===i.length||m.size!==c||m.endIndex!==s-1?i.push({startIndex:s,endIndex:s,size:c}):i[i.length-1].endIndex++}}}return i}(n.children,e,0,r),s=n.parentElement;!s.dataset.virtuosoScroller;)s=s.parentElement;var u="window"===s.firstElementChild.dataset.viewportType,c=a?a.scrollTop:u?window.pageYOffset||document.documentElement.scrollTop:s.scrollTop,m=a?a.scrollHeight:u?document.documentElement.scrollHeight:s.scrollHeight,d=a?a.offsetHeight:u?window.innerHeight:s.offsetHeight;o({scrollTop:Math.max(c,0),scrollHeight:m,viewportHeight:d}),null==i||i(function(t,e,n){return"normal"===e||null!=e&&e.endsWith("px")||n("row-gap was not resolved to pixel value correctly",e,h.WARN),"normal"===e?0:parseInt(null!=e?e:"0",10)}(0,getComputedStyle(n).rowGap,r)),null!==l&&t(l)},n)}function w(t,e){return Math.round(t.getBoundingClientRect()[e])}function x(t,e){return Math.abs(t-e)<1.01}function b(t,n,o,l,s){void 0===l&&(l=e.noop);var c=i(null),m=i(null),d=i(null),f=i(!1),p=a(function(e){var o=e.target,r=o===window||o===document,i=r?window.pageYOffset||document.documentElement.scrollTop:o.scrollTop,a=r?document.documentElement.scrollHeight:o.scrollHeight,l=r?window.innerHeight:o.offsetHeight,s=function(){t({scrollTop:Math.max(i,0),scrollHeight:a,viewportHeight:l})};f.current?u(s):s(),f.current=!1,null!==m.current&&(i===m.current||i<=0||i===a-l)&&(m.current=null,n(!0),d.current&&(clearTimeout(d.current),d.current=null))},[t,n]);return r(function(){var t=s||c.current;return l(s||c.current),p({target:t}),t.addEventListener("scroll",p,{passive:!0}),function(){l(null),t.removeEventListener("scroll",p)}},[c,p,o,l,s]),{scrollerRef:c,scrollByCallback:function(t){f.current=!0,c.current.scrollBy(t)},scrollToCallback:function(e){var o=c.current;if(o&&(!("offsetHeight"in o)||0!==o.offsetHeight)){var r,i,a,l="smooth"===e.behavior;if(o===window?(i=Math.max(w(document.documentElement,"height"),document.documentElement.scrollHeight),r=window.innerHeight,a=document.documentElement.scrollTop):(i=o.scrollHeight,r=w(o,"height"),a=o.scrollTop),e.top=Math.ceil(Math.max(Math.min(i-r,e.top),0)),x(r,i)||e.top===a)return t({scrollTop:a,scrollHeight:i,viewportHeight:r}),void(l&&n(!0));l?(m.current=e.top,d.current&&clearTimeout(d.current),d.current=setTimeout(function(){d.current=null,m.current=null,n(!0)},1e3)):m.current=null,o.scrollTo(e)}}}}var y=e.system(function(){var t=e.stream(),n=e.stream(),o=e.statefulStream(0),r=e.stream(),i=e.statefulStream(0),a=e.stream(),l=e.stream(),s=e.statefulStream(0),u=e.statefulStream(0),c=e.statefulStream(0),m=e.statefulStream(0),d=e.stream(),f=e.stream(),p=e.statefulStream(!1),h=e.statefulStream(!1);return e.connect(e.pipe(t,e.map(function(t){return t.scrollTop})),n),e.connect(e.pipe(t,e.map(function(t){return t.scrollHeight})),l),e.connect(n,i),{scrollContainerState:t,scrollTop:n,viewportHeight:a,headerHeight:s,fixedHeaderHeight:u,fixedFooterHeight:c,footerHeight:m,scrollHeight:l,smoothScrollTargetReached:r,react18ConcurrentRendering:h,scrollTo:d,scrollBy:f,statefulScrollTop:i,deviation:o,scrollingInProgress:p}},[],{singleton:!0}),H={lvl:0};function E(t,e,n,o,r){return void 0===o&&(o=H),void 0===r&&(r=H),{k:t,v:e,lvl:n,l:o,r:r}}function R(t){return t===H}function L(){return H}function k(t,e){if(R(t))return H;var n=t.k,o=t.l,r=t.r;if(e===n){if(R(o))return r;if(R(r))return o;var i=O(o);return A(V(t,{k:i[0],v:i[1],l:M(o)}))}return A(V(t,e<n?{l:k(o,e)}:{r:k(r,e)}))}function z(t,e,n){if(void 0===n&&(n="k"),R(t))return[-Infinity,void 0];if(t[n]===e)return[t.k,t.v];if(t[n]<e){var o=z(t.r,e,n);return-Infinity===o[0]?[t.k,t.v]:o}return z(t.l,e,n)}function F(t,e,n){return R(t)?E(e,n,1):e===t.k?V(t,{k:e,v:n}):function(t){return D(G(t))}(V(t,e<t.k?{l:F(t.l,e,n)}:{r:F(t.r,e,n)}))}function B(t,e,n){if(R(t))return[];var o=t.k,r=t.v,i=t.r,a=[];return o>e&&(a=a.concat(B(t.l,e,n))),o>=e&&o<=n&&a.push({k:o,v:r}),o<=n&&(a=a.concat(B(i,e,n))),a}function P(t){return R(t)?[]:[].concat(P(t.l),[{k:t.k,v:t.v}],P(t.r))}function O(t){return R(t.r)?[t.k,t.v]:O(t.r)}function M(t){return R(t.r)?t.l:A(V(t,{r:M(t.r)}))}function V(t,e){return E(void 0!==e.k?e.k:t.k,void 0!==e.v?e.v:t.v,void 0!==e.lvl?e.lvl:t.lvl,void 0!==e.l?e.l:t.l,void 0!==e.r?e.r:t.r)}function U(t){return R(t)||t.lvl>t.r.lvl}function A(t){var e=t.l,n=t.r,o=t.lvl;if(n.lvl>=o-1&&e.lvl>=o-1)return t;if(o>n.lvl+1){if(U(e))return G(V(t,{lvl:o-1}));if(R(e)||R(e.r))throw new Error("Unexpected empty nodes");return V(e.r,{l:V(e,{r:e.r.l}),r:V(t,{l:e.r.r,lvl:o-1}),lvl:o})}if(U(t))return D(V(t,{lvl:o-1}));if(R(n)||R(n.l))throw new Error("Unexpected empty nodes");var r=n.l,i=U(r)?n.lvl-1:n.lvl;return V(r,{l:V(t,{r:r.l,lvl:o-1}),r:D(V(n,{l:r.r,lvl:i})),lvl:r.lvl+1})}function W(t,e,n){return R(t)?[]:N(B(t,z(t,e)[0],n),function(t){return{index:t.k,value:t.v}})}function N(t,e){var n=t.length;if(0===n)return[];for(var o=e(t[0]),r=o.index,i=o.value,a=[],l=1;l<n;l++){var s=e(t[l]),u=s.index,c=s.value;a.push({start:r,end:u-1,value:i}),r=u,i=c}return a.push({start:r,end:Infinity,value:i}),a}function D(t){var e=t.r,n=t.lvl;return R(e)||R(e.r)||e.lvl!==n||e.r.lvl!==n?t:V(e,{l:V(t,{r:e.l}),lvl:n+1})}function G(t){var e=t.l;return R(e)||e.lvl!==t.lvl?t:V(e,{r:V(t,{l:e.r})})}function _(t,e,n,o){void 0===o&&(o=0);for(var r=t.length-1;o<=r;){var i=Math.floor((o+r)/2),a=n(t[i],e);if(0===a)return i;if(-1===a){if(r-o<2)return i-1;r=i-1}else{if(r===o)return i;o=i+1}}throw new Error("Failed binary finding record in array - "+t.join(",")+", searched for "+e)}function j(t,e,n){return t[_(t,e,n)]}var K=e.system(function(){return{recalcInProgress:e.statefulStream(!1)}},[],{singleton:!0});function Y(t){var e=t.size,n=t.startIndex,o=t.endIndex;return function(t){return t.start===n&&(t.end===o||Infinity===t.end)&&t.value===e}}function q(t,e){var n=t.index;return e===n?0:e<n?-1:1}function Z(t,e){var n=t.offset;return e===n?0:e<n?-1:1}function J(t){return{index:t.index,value:t}}function $(t,e,n,o){var r=t,i=0,a=0,l=0,s=0;if(0!==e){l=r[s=_(r,e-1,q)].offset;var u=z(n,e-1);i=u[0],a=u[1],r.length&&r[s].size===z(n,e)[1]&&(s-=1),r=r.slice(0,s+1)}else r=[];for(var c,m=f(W(n,e,Infinity));!(c=m()).done;){var d=c.value,p=d.start,h=d.value,g=p-i,v=g*a+l+g*o;r.push({offset:v,size:h,index:p}),i=p,l=v,a=h}return{offsetTree:r,lastIndex:i,lastOffset:l,lastSize:a}}function Q(t,e){var n=e[0],o=e[1],r=e[3];n.length>0&&(0,e[2])("received item sizes",n,h.DEBUG);var i=t.sizeTree,a=i,l=0;if(o.length>0&&R(i)&&2===n.length){var s=n[0].size,u=n[1].size;a=o.reduce(function(t,e){return F(F(t,e,s),e+1,u)},a)}else{var c=function(t,e){for(var n,o=R(t)?0:Infinity,r=f(e);!(n=r()).done;){var i=n.value,a=i.size,l=i.startIndex,s=i.endIndex;if(o=Math.min(o,l),R(t))t=F(t,0,a);else{var u=W(t,l-1,s+1);if(!u.some(Y(i))){for(var c,m=!1,d=!1,p=f(u);!(c=p()).done;){var h=c.value,g=h.start,v=h.end,S=h.value;m?(s>=g||a===S)&&(t=k(t,g)):(d=S!==a,m=!0),v>s&&s>=g&&S!==a&&(t=F(t,s+1,S))}d&&(t=F(t,l,a))}}}return[t,o]}(a,n);a=c[0],l=c[1]}if(a===i)return t;var m=$(t.offsetTree,l,a,r),d=m.offsetTree;return{sizeTree:a,offsetTree:d,lastIndex:m.lastIndex,lastOffset:m.lastOffset,lastSize:m.lastSize,groupOffsetTree:o.reduce(function(t,e){return F(t,e,X(e,d,r))},L()),groupIndices:o}}function X(t,e,n){if(0===e.length)return 0;var o=j(e,t,q),r=t-o.index,i=o.size*r+(r-1)*n+o.offset;return i>0?i+n:i}function tt(t,e,n){if(function(t){return void 0!==t.groupIndex}(t))return e.groupIndices[t.groupIndex]+1;var o=et("LAST"===t.index?n:t.index,e);return Math.max(0,o,Math.min(n,o))}function et(t,e){if(!nt(e))return t;for(var n=0;e.groupIndices[n]<=t+n;)n++;return t+n}function nt(t){return!R(t.groupOffsetTree)}var ot={offsetHeight:"height",offsetWidth:"width"},rt=e.system(function(t){var n=t[0].log,o=t[1].recalcInProgress,r=e.stream(),i=e.stream(),a=e.statefulStreamFromEmitter(i,0),l=e.stream(),s=e.stream(),u=e.statefulStream(0),m=e.statefulStream([]),d=e.statefulStream(void 0),f=e.statefulStream(void 0),p=e.statefulStream(function(t,e){return w(t,ot[e])}),g=e.statefulStream(void 0),v=e.statefulStream(0),S={offsetTree:[],sizeTree:L(),groupOffsetTree:L(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},I=e.statefulStreamFromEmitter(e.pipe(r,e.withLatestFrom(m,n,v),e.scan(Q,S),e.distinctUntilChanged()),S);e.connect(e.pipe(m,e.filter(function(t){return t.length>0}),e.withLatestFrom(I,v),e.map(function(t){var e=t[0],n=t[1],o=t[2],r=e.reduce(function(t,e,r){return F(t,e,X(e,n.offsetTree,o)||r)},L());return c({},n,{groupIndices:e,groupOffsetTree:r})})),I),e.connect(e.pipe(i,e.withLatestFrom(I),e.filter(function(t){return t[0]<t[1].lastIndex}),e.map(function(t){var e=t[1];return[{startIndex:t[0],endIndex:e.lastIndex,size:e.lastSize}]})),r),e.connect(d,f);var C=e.statefulStreamFromEmitter(e.pipe(d,e.map(function(t){return void 0===t})),!0);e.connect(e.pipe(f,e.filter(function(t){return void 0!==t&&R(e.getValue(I).sizeTree)}),e.map(function(t){return[{startIndex:0,endIndex:0,size:t}]})),r);var T=e.streamFromEmitter(e.pipe(r,e.withLatestFrom(I),e.scan(function(t,e){var n=e[1];return{changed:n!==t.sizes,sizes:n}},{changed:!1,sizes:S}),e.map(function(t){return t.changed})));e.subscribe(e.pipe(u,e.scan(function(t,e){return{diff:t.prev-e,prev:e}},{diff:0,prev:0}),e.map(function(t){return t.diff})),function(t){t>0?(e.publish(o,!0),e.publish(l,t)):t<0&&e.publish(s,t)}),e.subscribe(e.pipe(u,e.withLatestFrom(n)),function(t){t[0]<0&&(0,t[1])("`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:u},h.ERROR)});var x=e.streamFromEmitter(l);e.connect(e.pipe(l,e.withLatestFrom(I),e.map(function(t){var e=t[0],n=t[1];if(n.groupIndices.length>0)throw new Error("Virtuoso: prepending items does not work with groups");return P(n.sizeTree).reduce(function(t,n){var o=n.k,r=n.v;return{ranges:[].concat(t.ranges,[{startIndex:t.prevIndex,endIndex:o+e-1,size:t.prevSize}]),prevIndex:o+e,prevSize:r}},{ranges:[],prevIndex:0,prevSize:n.lastSize}).ranges})),r);var b=e.streamFromEmitter(e.pipe(s,e.withLatestFrom(I,v),e.map(function(t){return X(-t[0],t[1].offsetTree,t[2])})));return e.connect(e.pipe(s,e.withLatestFrom(I,v),e.map(function(t){var e=t[0],n=t[1],o=t[2];if(n.groupIndices.length>0)throw new Error("Virtuoso: shifting items does not work with groups");var r=P(n.sizeTree).reduce(function(t,n){var o=n.v;return F(t,Math.max(0,n.k+e),o)},L());return c({},n,{sizeTree:r},$(n.offsetTree,0,r,o))})),I),{data:g,totalCount:i,sizeRanges:r,groupIndices:m,defaultItemSize:f,fixedItemSize:d,unshiftWith:l,shiftWith:s,shiftWithOffset:b,beforeUnshiftWith:x,firstItemIndex:u,gap:v,sizes:I,listRefresh:T,statefulTotalCount:a,trackItemSizes:C,itemSize:p}},e.tup(S,K),{singleton:!0}),it="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style;function at(t){var e="number"==typeof t?{index:t}:t;return e.align||(e.align="start"),e.behavior&&it||(e.behavior="auto"),e.offset||(e.offset=0),e}var lt=e.system(function(t){var n=t[0],o=n.sizes,r=n.totalCount,i=n.listRefresh,a=n.gap,l=t[1],s=l.scrollingInProgress,u=l.viewportHeight,c=l.scrollTo,m=l.smoothScrollTargetReached,d=l.headerHeight,f=l.footerHeight,p=l.fixedHeaderHeight,g=l.fixedFooterHeight,v=t[2].log,S=e.stream(),I=e.statefulStream(0),C=null,T=null,w=null;function x(){C&&(C(),C=null),w&&(w(),w=null),T&&(clearTimeout(T),T=null),e.publish(s,!1)}return e.connect(e.pipe(S,e.withLatestFrom(o,u,r,I,d,f,v),e.withLatestFrom(a,p,g),e.map(function(t){var n=t[0],o=n[0],r=n[1],a=n[2],l=n[3],u=n[4],c=n[5],d=n[6],f=n[7],p=t[1],g=t[2],v=t[3],I=at(o),b=I.align,y=I.behavior,H=I.offset,E=l-1,R=tt(I,r,E),L=X(R,r.offsetTree,p)+c;"end"===b?(L+=g+z(r.sizeTree,R)[1]-a+v,R===E&&(L+=d)):"center"===b?L+=(g+z(r.sizeTree,R)[1]-a+v)/2:L-=u,H&&(L+=H);var k=function(t){x(),t?(f("retrying to scroll to",{location:o},h.DEBUG),e.publish(S,o)):f("list did not change, scroll successful",{},h.DEBUG)};if(x(),"smooth"===y){var F=!1;w=e.subscribe(i,function(t){F=F||t}),C=e.handleNext(m,function(){k(F)})}else C=e.handleNext(e.pipe(i,function(t){var e=setTimeout(function(){t(!1)},150);return function(n){n&&(t(!0),clearTimeout(e))}}),k);return T=setTimeout(function(){x()},1200),e.publish(s,!0),f("scrolling from index to",{index:R,top:L,behavior:y},h.DEBUG),{top:L,behavior:y}})),c),{scrollToIndex:S,topListHeight:I}},e.tup(rt,y,S),{singleton:!0}),st="up",ut={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},ct=e.system(function(t){var n=t[0],o=n.scrollContainerState,r=n.scrollTop,i=n.viewportHeight,a=n.headerHeight,l=n.footerHeight,s=n.scrollBy,u=e.statefulStream(!1),c=e.statefulStream(!0),m=e.stream(),d=e.stream(),f=e.statefulStream(4),p=e.statefulStream(0),h=e.statefulStreamFromEmitter(e.pipe(e.merge(e.pipe(e.duc(r),e.skip(1),e.mapTo(!0)),e.pipe(e.duc(r),e.skip(1),e.mapTo(!1),e.debounceTime(100))),e.distinctUntilChanged()),!1),g=e.statefulStreamFromEmitter(e.pipe(e.merge(e.pipe(s,e.mapTo(!0)),e.pipe(s,e.mapTo(!1),e.debounceTime(200))),e.distinctUntilChanged()),!1);e.connect(e.pipe(e.combineLatest(e.duc(r),e.duc(p)),e.map(function(t){return t[0]<=t[1]}),e.distinctUntilChanged()),c),e.connect(e.pipe(c,e.throttleTime(50)),d);var v=e.streamFromEmitter(e.pipe(e.combineLatest(o,e.duc(i),e.duc(a),e.duc(l),e.duc(f)),e.scan(function(t,e){var n,o,r=e[0],i=r.scrollTop,a=r.scrollHeight,l=e[1],s={viewportHeight:l,scrollTop:i,scrollHeight:a};return i+l-a>-e[4]?(i>t.state.scrollTop?(n="SCROLLED_DOWN",o=t.state.scrollTop-i):(n="SIZE_DECREASED",o=t.state.scrollTop-i||t.scrollTopDelta),{atBottom:!0,state:s,atBottomBecause:n,scrollTopDelta:o}):{atBottom:!1,notAtBottomBecause:s.scrollHeight>t.state.scrollHeight?"SIZE_INCREASED":l<t.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":i<t.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",state:s}},ut),e.distinctUntilChanged(function(t,e){return t&&t.atBottom===e.atBottom}))),S=e.statefulStreamFromEmitter(e.pipe(o,e.scan(function(t,e){var n=e.scrollTop,o=e.scrollHeight,r=e.viewportHeight;return x(t.scrollHeight,o)?{scrollTop:n,scrollHeight:o,jump:0,changed:!1}:t.scrollTop!==n&&o-(n+r)<1?{scrollHeight:o,scrollTop:n,jump:t.scrollTop-n,changed:!0}:{scrollHeight:o,scrollTop:n,jump:0,changed:!0}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),e.filter(function(t){return t.changed}),e.map(function(t){return t.jump})),0);e.connect(e.pipe(v,e.map(function(t){return t.atBottom})),u),e.connect(e.pipe(u,e.throttleTime(50)),m);var I=e.statefulStream("down");e.connect(e.pipe(o,e.map(function(t){return t.scrollTop}),e.distinctUntilChanged(),e.scan(function(t,n){return e.getValue(g)?{direction:t.direction,prevScrollTop:n}:{direction:n<t.prevScrollTop?st:"down",prevScrollTop:n}},{direction:"down",prevScrollTop:0}),e.map(function(t){return t.direction})),I),e.connect(e.pipe(o,e.throttleTime(50),e.mapTo("none")),I);var C=e.statefulStream(0);return e.connect(e.pipe(h,e.filter(function(t){return!t}),e.mapTo(0)),C),e.connect(e.pipe(r,e.throttleTime(100),e.withLatestFrom(h),e.filter(function(t){return!!t[1]}),e.scan(function(t,e){return[t[1],e[0]]},[0,0]),e.map(function(t){return t[1]-t[0]})),C),{isScrolling:h,isAtTop:c,isAtBottom:u,atBottomState:v,atTopStateChange:d,atBottomStateChange:m,scrollDirection:I,atBottomThreshold:f,atTopThreshold:p,scrollVelocity:C,lastJumpDueToItemResize:S}},e.tup(y)),mt=e.system(function(t){var n=t[0].log,o=e.statefulStream(!1),r=e.streamFromEmitter(e.pipe(o,e.filter(function(t){return t}),e.distinctUntilChanged()));return e.subscribe(o,function(t){t&&e.getValue(n)("props updated",{},h.DEBUG)}),{propsReady:o,didMount:r}},e.tup(S),{singleton:!0}),dt=e.system(function(t){var n=t[0],o=n.sizes,r=n.listRefresh,i=n.defaultItemSize,a=t[1].scrollTop,l=t[2].scrollToIndex,s=t[3].didMount,u=e.statefulStream(!0),c=e.statefulStream(0);return e.connect(e.pipe(s,e.withLatestFrom(c),e.filter(function(t){return!!t[1]}),e.mapTo(!1)),u),e.subscribe(e.pipe(e.combineLatest(r,s),e.withLatestFrom(u,o,i),e.filter(function(t){var e=t[1],n=t[3];return t[0][1]&&(!R(t[2].sizeTree)||void 0!==n)&&!e}),e.withLatestFrom(c)),function(t){var n=t[1];setTimeout(function(){e.handleNext(a,function(){e.publish(u,!0)}),e.publish(l,n)})}),{scrolledToInitialItem:u,initialTopMostItemIndex:c}},e.tup(rt,y,lt,mt),{singleton:!0});function ft(t){return!!t&&("smooth"===t?"smooth":"auto")}var pt=e.system(function(t){var n=t[0],o=n.totalCount,r=n.listRefresh,i=t[1],a=i.isAtBottom,l=i.atBottomState,s=t[2].scrollToIndex,u=t[3].scrolledToInitialItem,c=t[4],m=c.propsReady,d=c.didMount,f=t[5].log,p=t[6].scrollingInProgress,g=e.statefulStream(!1),v=e.stream(),S=null;function I(t){e.publish(s,{index:"LAST",align:"end",behavior:t})}function C(t){var n=e.handleNext(l,function(n){!t||n.atBottom||"SIZE_INCREASED"!==n.notAtBottomBecause||S||(e.getValue(f)("scrolling to bottom due to increased size",{},h.DEBUG),I("auto"))});setTimeout(n,100)}return e.subscribe(e.pipe(e.combineLatest(e.pipe(e.duc(o),e.skip(1)),d),e.withLatestFrom(e.duc(g),a,u,p),e.map(function(t){var e=t[0],n=e[0],o=e[1]&&t[3],r="auto";return o&&(r=function(t,e){return"function"==typeof t?ft(t(e)):e&&ft(t)}(t[1],t[2]||t[4]),o=o&&!!r),{totalCount:n,shouldFollow:o,followOutputBehavior:r}}),e.filter(function(t){return t.shouldFollow})),function(t){var n=t.totalCount,o=t.followOutputBehavior;S&&(S(),S=null),S=e.handleNext(r,function(){e.getValue(f)("following output to ",{totalCount:n},h.DEBUG),I(o),S=null})}),e.subscribe(e.pipe(e.combineLatest(e.duc(g),o,m),e.filter(function(t){return t[0]&&t[2]}),e.scan(function(t,e){var n=e[1];return{refreshed:t.value===n,value:n}},{refreshed:!1,value:0}),e.filter(function(t){return t.refreshed}),e.withLatestFrom(g,o)),function(t){C(!1!==t[1])}),e.subscribe(v,function(){C(!1!==e.getValue(g))}),e.subscribe(e.combineLatest(e.duc(g),l),function(t){var e=t[1];t[0]&&!e.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===e.notAtBottomBecause&&I("auto")}),{followOutput:g,autoscrollToBottom:v}},e.tup(rt,ct,lt,dt,mt,S,y));function ht(t){return t.reduce(function(t,e){return t.groupIndices.push(t.totalCount),t.totalCount+=e+1,t},{totalCount:0,groupIndices:[]})}var gt=e.system(function(t){var n=t[0],o=n.totalCount,r=n.groupIndices,i=n.sizes,a=t[1],l=a.scrollTop,s=a.headerHeight,u=e.stream(),c=e.stream(),m=e.streamFromEmitter(e.pipe(u,e.map(ht)));return e.connect(e.pipe(m,e.map(function(t){return t.totalCount})),o),e.connect(e.pipe(m,e.map(function(t){return t.groupIndices})),r),e.connect(e.pipe(e.combineLatest(l,i,s),e.filter(function(t){return nt(t[1])}),e.map(function(t){return z(t[1].groupOffsetTree,Math.max(t[0]-t[2],0),"v")[0]}),e.distinctUntilChanged(),e.map(function(t){return[t]})),c),{groupCounts:u,topItemsIndexes:c}},e.tup(rt,y));function vt(t,e){return!(!t||t[0]!==e[0]||t[1]!==e[1])}function St(t,e){return!(!t||t.startIndex!==e.startIndex||t.endIndex!==e.endIndex)}function It(t,e,n){return"number"==typeof t?n===st&&"top"===e||"down"===n&&"bottom"===e?t:0:n===st?"top"===e?t.main:t.reverse:"bottom"===e?t.main:t.reverse}function Ct(t,e){return"number"==typeof t?t:t[e]||0}var Tt=e.system(function(t){var n=t[0],o=n.scrollTop,r=n.viewportHeight,i=n.deviation,a=n.headerHeight,l=n.fixedHeaderHeight,s=e.stream(),u=e.statefulStream(0),c=e.statefulStream(0),m=e.statefulStream(0),d=e.statefulStreamFromEmitter(e.pipe(e.combineLatest(e.duc(o),e.duc(r),e.duc(a),e.duc(s,vt),e.duc(m),e.duc(u),e.duc(l),e.duc(i),e.duc(c)),e.map(function(t){var e=t[0],n=t[1],o=t[2],r=t[3],i=r[0],a=r[1],l=t[4],s=t[6],u=t[7],c=t[8],m=e-u,d=t[5]+s,f=Math.max(o-m,0),p="none",h=Ct(c,"top"),g=Ct(c,"bottom");return i-=u,a+=o+s,(i+=o+s)>e+d-h&&(p=st),(a-=u)<e-f+n+g&&(p="down"),"none"!==p?[Math.max(m-o-It(l,"top",p)-h,0),m-f-s+n+It(l,"bottom",p)+g]:null}),e.filter(function(t){return null!=t}),e.distinctUntilChanged(vt)),[0,0]);return{listBoundary:s,overscan:m,topListHeight:u,increaseViewportBy:c,visibleRange:d}},e.tup(y),{singleton:!0}),wt={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function xt(t,e,n){if(0===t.length)return[];if(!nt(e))return t.map(function(t){return c({},t,{index:t.index+n,originalIndex:t.index})});for(var o,r=[],i=W(e.groupOffsetTree,t[0].index,t[t.length-1].index),a=void 0,l=0,s=f(t);!(o=s()).done;){var u=o.value;(!a||a.end<u.index)&&(a=i.shift(),l=e.groupIndices.indexOf(a.start)),r.push(c({},u.index===a.start?{type:"group",index:l}:{index:u.index-(l+1)+n,groupIndex:l},{size:u.size,offset:u.offset,originalIndex:u.index,data:u.data}))}return r}function bt(t,e,n,o,r,i){var a=0,l=0;if(t.length>0){a=t[0].offset;var s=t[t.length-1];l=s.offset+s.size}var u=n-r.lastIndex,c=a,m=r.lastOffset+u*r.lastSize+(u-1)*o-l;return{items:xt(t,r,i),topItems:xt(e,r,i),topListHeight:e.reduce(function(t,e){return e.size+t},0),offsetTop:a,offsetBottom:m,top:c,bottom:l,totalCount:n,firstItemIndex:i}}var yt=e.system(function(t){var n=t[0],o=n.sizes,r=n.totalCount,i=n.data,a=n.firstItemIndex,l=n.gap,s=t[1],u=t[2],m=u.visibleRange,d=u.listBoundary,p=u.topListHeight,h=t[3],g=h.scrolledToInitialItem,v=h.initialTopMostItemIndex,S=t[4].topListHeight,I=t[5],C=t[6].didMount,T=t[7].recalcInProgress,w=e.statefulStream([]),x=e.stream();e.connect(s.topItemsIndexes,w);var b=e.statefulStreamFromEmitter(e.pipe(e.combineLatest(C,T,e.duc(m,vt),e.duc(r),e.duc(o),e.duc(v),g,e.duc(w),e.duc(a),e.duc(l),i),e.filter(function(t){return t[0]&&!t[1]}),e.map(function(t){var n=t[2],o=n[0],r=n[1],i=t[3],a=t[5],l=t[6],s=t[7],u=t[8],m=t[9],d=t[10],p=t[4],h=p.sizeTree,g=p.offsetTree;if(0===i||0===o&&0===r)return c({},wt,{totalCount:i});if(R(h))return bt(function(t,e,n){if(nt(e)){var o=et(t,e);return[{index:z(e.groupOffsetTree,o)[0],size:0,offset:0},{index:o,size:0,offset:0,data:n&&n[0]}]}return[{index:t,size:0,offset:0,data:n&&n[0]}]}(function(t,e){return"number"==typeof t?t:"LAST"===t.index?e-1:t.index}(a,i),p,d),[],i,m,p,u);var v=[];if(s.length>0)for(var S,I=s[0],C=s[s.length-1],T=0,w=f(W(h,I,C));!(S=w()).done;)for(var x=S.value,b=x.value,y=Math.max(x.start,I),H=Math.min(x.end,C),E=y;E<=H;E++)v.push({index:E,size:b,offset:T,data:d&&d[E]}),T+=b;if(!l)return bt([],v,i,m,p,u);var L=s.length>0?s[s.length-1]+1:0,k=function(t,e,n,o){return void 0===o&&(o=0),o>0&&(e=Math.max(e,j(t,o,q).offset)),N((i=n,l=_(r=t,e,a=Z),s=_(r,i,a,l),r.slice(l,s+1)),J);var r,i,a,l,s}(g,o,r,L);if(0===k.length)return null;var F=i-1;return bt(e.tap([],function(t){for(var e,n=f(k);!(e=n()).done;){var i=e.value,a=i.value,l=a.offset,s=i.start,u=a.size;if(a.offset<o){var c=(s+=Math.floor((o-a.offset+m)/(u+m)))-i.start;l+=c*u+c*m}s<L&&(l+=(L-s)*u,s=L);for(var p=Math.min(i.end,F),h=s;h<=p&&!(l>=r);h++)t.push({index:h,size:u,offset:l,data:d&&d[h]}),l+=u+m}}),v,i,m,p,u)}),e.filter(function(t){return null!==t}),e.distinctUntilChanged()),wt);return e.connect(e.pipe(i,e.filter(function(t){return void 0!==t}),e.map(function(t){return t.length})),r),e.connect(e.pipe(b,e.map(function(t){return t.topListHeight})),S),e.connect(S,p),e.connect(e.pipe(b,e.map(function(t){return[t.top,t.bottom]})),d),e.connect(e.pipe(b,e.map(function(t){return t.items})),x),c({listState:b,topItemsIndexes:w,endReached:e.streamFromEmitter(e.pipe(b,e.filter(function(t){return t.items.length>0}),e.withLatestFrom(r,i),e.filter(function(t){var e=t[0].items;return e[e.length-1].originalIndex===t[1]-1}),e.map(function(t){return[t[1]-1,t[2]]}),e.distinctUntilChanged(vt),e.map(function(t){return t[0]}))),startReached:e.streamFromEmitter(e.pipe(b,e.throttleTime(200),e.filter(function(t){var e=t.items;return e.length>0&&e[0].originalIndex===t.topItems.length}),e.map(function(t){return t.items[0].index}),e.distinctUntilChanged())),rangeChanged:e.streamFromEmitter(e.pipe(b,e.filter(function(t){return t.items.length>0}),e.map(function(t){for(var e=t.items,n=0,o=e.length-1;"group"===e[n].type&&n<o;)n++;for(;"group"===e[o].type&&o>n;)o--;return{startIndex:e[n].index,endIndex:e[o].index}}),e.distinctUntilChanged(St))),itemsRendered:x},I)},e.tup(rt,gt,Tt,dt,lt,ct,mt,K),{singleton:!0}),Ht=e.system(function(t){var n=t[0],o=n.sizes,r=n.firstItemIndex,i=n.data,a=n.gap,l=t[1].listState,s=t[2].didMount,u=e.statefulStream(0);return e.connect(e.pipe(s,e.withLatestFrom(u),e.filter(function(t){return 0!==t[1]}),e.withLatestFrom(o,r,a,i),e.map(function(t){var e=t[0][1],n=t[1],o=t[2],r=t[3],i=t[4],a=void 0===i?[]:i,l=0;if(n.groupIndices.length>0)for(var s,u=f(n.groupIndices);!((s=u()).done||s.value-l>=e);)l++;var c=e+l;return bt(Array.from({length:c}).map(function(t,e){return{index:e,size:0,offset:0,data:a[e]}}),[],c,r,n,o)})),l),{initialItemCount:u}},e.tup(rt,yt,mt),{singleton:!0}),Et=e.system(function(t){var n=t[0].scrollVelocity,o=e.statefulStream(!1),r=e.stream(),i=e.statefulStream(!1);return e.connect(e.pipe(n,e.withLatestFrom(i,o,r),e.filter(function(t){return!!t[1]}),e.map(function(t){var e=t[0],n=t[1],o=t[2],r=t[3],i=n.enter;if(o){if((0,n.exit)(e,r))return!1}else if(i(e,r))return!0;return o}),e.distinctUntilChanged()),o),e.subscribe(e.pipe(e.combineLatest(o,n,r),e.withLatestFrom(i)),function(t){var e=t[0],n=t[1];return e[0]&&n&&n.change&&n.change(e[1],e[2])}),{isSeeking:o,scrollSeekConfiguration:i,scrollVelocity:n,scrollSeekRangeChanged:r}},e.tup(ct),{singleton:!0}),Rt=e.system(function(t){var n=t[0].topItemsIndexes,o=e.statefulStream(0);return e.connect(e.pipe(o,e.filter(function(t){return t>0}),e.map(function(t){return Array.from({length:t}).map(function(t,e){return e})})),n),{topItemCount:o}},e.tup(yt)),Lt=e.system(function(t){var n=t[0],o=n.footerHeight,r=n.headerHeight,i=n.fixedHeaderHeight,a=n.fixedFooterHeight,l=t[1].listState,s=e.stream(),u=e.statefulStreamFromEmitter(e.pipe(e.combineLatest(o,a,r,i,l),e.map(function(t){var e=t[4];return t[0]+t[1]+t[2]+t[3]+e.offsetBottom+e.bottom})),0);return e.connect(e.duc(u),s),{totalListHeight:u,totalListHeightChanged:s}},e.tup(y,yt),{singleton:!0});function kt(t){var e,n=!1;return function(){return n||(n=!0,e=t()),e}}var zt=kt(function(){return/iP(ad|hone|od).+Version\/[\d.]+.*Safari/i.test(navigator.userAgent)}),Ft=e.system(function(t){var n=t[0],o=n.scrollBy,r=n.scrollTop,i=n.deviation,a=n.scrollingInProgress,l=t[1],s=l.isScrolling,u=l.isAtBottom,c=l.scrollDirection,m=t[3],d=m.beforeUnshiftWith,f=m.shiftWithOffset,p=m.sizes,g=m.gap,v=t[4].log,S=t[5].recalcInProgress,I=e.streamFromEmitter(e.pipe(t[2].listState,e.withLatestFrom(l.lastJumpDueToItemResize),e.scan(function(t,e){var n=t[1],o=e[0],r=o.items,i=o.totalCount,a=o.bottom+o.offsetBottom,l=0;return t[2]===i&&n.length>0&&r.length>0&&(0===r[0].originalIndex&&0===n[0].originalIndex||0!=(l=a-t[3])&&(l+=e[1])),[l,r,i,a]},[0,[],0,0]),e.filter(function(t){return 0!==t[0]}),e.withLatestFrom(r,c,a,u,v),e.filter(function(t){return!t[3]&&0!==t[1]&&t[2]===st}),e.map(function(t){var e=t[0][0];return(0,t[5])("Upward scrolling compensation",{amount:e},h.DEBUG),e})));function C(t){t>0?(e.publish(o,{top:-t,behavior:"auto"}),e.publish(i,0)):(e.publish(i,0),e.publish(o,{top:-t,behavior:"auto"}))}return e.subscribe(e.pipe(I,e.withLatestFrom(i,s)),function(t){var n=t[0],o=t[1];t[2]&&zt()?e.publish(i,o-n):C(-n)}),e.subscribe(e.pipe(e.combineLatest(e.statefulStreamFromEmitter(s,!1),i,S),e.filter(function(t){return!t[0]&&!t[2]&&0!==t[1]}),e.map(function(t){return t[1]}),e.throttleTime(1)),C),e.connect(e.pipe(f,e.map(function(t){return{top:-t}})),o),e.subscribe(e.pipe(d,e.withLatestFrom(p,g),e.map(function(t){var e=t[0];return e*t[1].lastSize+e*t[2]})),function(t){e.publish(i,t),requestAnimationFrame(function(){e.publish(o,{top:t}),requestAnimationFrame(function(){e.publish(i,0),e.publish(S,!1)})})}),{deviation:i}},e.tup(y,ct,yt,rt,S,K)),Bt=e.system(function(t){var n=t[0].totalListHeight,o=t[1].didMount,r=t[2].scrollTo,i=e.statefulStream(0);return e.subscribe(e.pipe(o,e.withLatestFrom(i),e.filter(function(t){return 0!==t[1]}),e.map(function(t){return{top:t[1]}})),function(t){e.handleNext(e.pipe(n,e.filter(function(t){return 0!==t})),function(){setTimeout(function(){e.publish(r,t)})})}),{initialScrollTop:i}},e.tup(Lt,mt,y),{singleton:!0}),Pt=e.system(function(t){var n=t[0].viewportHeight,o=t[1].totalListHeight,r=e.statefulStream(!1);return{alignToBottom:r,paddingTopAddition:e.statefulStreamFromEmitter(e.pipe(e.combineLatest(r,n,o),e.filter(function(t){return t[0]}),e.map(function(t){return Math.max(0,t[1]-t[2])}),e.distinctUntilChanged()),0)}},e.tup(y,Lt),{singleton:!0}),Ot=e.system(function(t){var n=t[0],o=n.scrollTo,r=n.scrollContainerState,i=e.stream(),a=e.stream(),l=e.stream(),s=e.statefulStream(!1),u=e.statefulStream(void 0);return e.connect(e.pipe(e.combineLatest(i,a),e.map(function(t){var e=t[0],n=e.viewportHeight,o=e.scrollHeight;return{scrollTop:Math.max(0,e.scrollTop-t[1].offsetTop),scrollHeight:o,viewportHeight:n}})),r),e.connect(e.pipe(o,e.withLatestFrom(a),e.map(function(t){var e=t[0];return c({},e,{top:e.top+t[1].offsetTop})})),l),{useWindowScroll:s,customScrollParent:u,windowScrollContainerState:i,windowViewportRect:a,windowScrollTo:l}},e.tup(y)),Mt=["done","behavior","align"],Vt=e.system(function(t){var n=t[0],o=n.sizes,r=n.totalCount,i=n.gap,a=t[1],l=a.scrollTop,s=a.viewportHeight,u=a.headerHeight,d=a.scrollingInProgress,f=t[2].scrollToIndex,p=e.stream();return e.connect(e.pipe(p,e.withLatestFrom(o,s,r,u,l,i),e.map(function(t){var n=t[0],o=t[1],r=t[2],i=t[3],a=t[4],l=t[5],s=t[6],u=n.done,f=n.behavior,p=n.align,h=m(n,Mt),g=null,v=tt(n,o,i-1),S=X(v,o.offsetTree,s)+a;return S<l?g=c({},h,{behavior:f,align:null!=p?p:"start"}):S+z(o.sizeTree,v)[1]>l+r&&(g=c({},h,{behavior:f,align:null!=p?p:"end"})),g?u&&e.handleNext(e.pipe(d,e.skip(1),e.filter(function(t){return!1===t})),u):u&&u(),g}),e.filter(function(t){return null!==t})),f),{scrollIntoView:p}},e.tup(rt,y,lt,yt,S),{singleton:!0}),Ut=["listState","topItemsIndexes"],At=e.system(function(t){return c({},t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},e.tup(Tt,Ht,mt,Et,Lt,Bt,Pt,Ot,Vt)),Wt=e.system(function(t){var n=t[0],o=n.totalCount,r=n.sizeRanges,i=n.fixedItemSize,a=n.defaultItemSize,l=n.trackItemSizes,s=n.itemSize,u=n.data,d=n.firstItemIndex,f=n.groupIndices,p=n.statefulTotalCount,h=n.gap,g=t[1],v=g.initialTopMostItemIndex,S=g.scrolledToInitialItem,I=t[2],C=t[3],T=t[4],w=T.listState,x=T.topItemsIndexes,b=m(T,Ut),y=t[5].scrollToIndex,H=t[7].topItemCount,E=t[8].groupCounts,R=t[9],L=t[10];return e.connect(b.rangeChanged,R.scrollSeekRangeChanged),e.connect(e.pipe(R.windowViewportRect,e.map(function(t){return t.visibleHeight})),I.viewportHeight),c({totalCount:o,data:u,firstItemIndex:d,sizeRanges:r,initialTopMostItemIndex:v,scrolledToInitialItem:S,topItemsIndexes:x,topItemCount:H,groupCounts:E,fixedItemHeight:i,defaultItemHeight:a,gap:h},C,{statefulTotalCount:p,listState:w,scrollToIndex:y,trackItemSizes:l,itemSize:s,groupIndices:f},b,R,I,L)},e.tup(rt,dt,y,pt,yt,lt,Ft,Rt,gt,At,S)),Nt=kt(function(){if("undefined"==typeof document)return"sticky";var t=document.createElement("div");return t.style.position="-webkit-sticky","-webkit-sticky"===t.style.position?"-webkit-sticky":"sticky"});function Dt(t,e){var n=i(null),o=a(function(o){if(null!==o&&o.offsetParent){var r,i,a=o.getBoundingClientRect(),l=a.width;if(e){var s=e.getBoundingClientRect(),u=a.top-s.top;r=s.height-Math.max(0,u),i=u+e.scrollTop}else r=window.innerHeight-Math.max(0,a.top),i=a.top+window.pageYOffset;n.current={offsetTop:i,visibleHeight:r,visibleWidth:l},t(n.current)}},[t,e]),l=I(o),s=l.callbackRef,u=l.ref,c=a(function(){o(u.current)},[o,u]);return r(function(){if(e){e.addEventListener("scroll",c);var t=new ResizeObserver(c);return t.observe(e),function(){e.removeEventListener("scroll",c),t.unobserve(e)}}return window.addEventListener("scroll",c),window.addEventListener("resize",c),function(){window.removeEventListener("scroll",c),window.removeEventListener("resize",c)}},[c,e]),s}var Gt=n.createContext(void 0),_t=["placeholder"],jt=["style","children"],Kt=["style","children"];function Yt(t){return t}var qt=e.system(function(){var t=e.statefulStream(function(t){return"Item "+t}),n=e.statefulStream(null),o=e.statefulStream(function(t){return"Group "+t}),r=e.statefulStream({}),i=e.statefulStream(Yt),a=e.statefulStream("div"),l=e.statefulStream(e.noop),s=function(t,n){return void 0===n&&(n=null),e.statefulStreamFromEmitter(e.pipe(r,e.map(function(e){return e[t]}),e.distinctUntilChanged()),n)};return{context:n,itemContent:t,groupContent:o,components:r,computeItemKey:i,headerFooterTag:a,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")}});function Zt(t,n){var o=e.stream();return e.subscribe(o,function(){return console.warn("react-virtuoso: You are using a deprecated property. "+n,"color: red;","color: inherit;","color: blue;")}),e.connect(o,t),o}var Jt=e.system(function(t){var n=t[0],o=t[1],r={item:Zt(o.itemContent,"Rename the %citem%c prop to %citemContent."),group:Zt(o.groupContent,"Rename the %cgroup%c prop to %cgroupContent."),topItems:Zt(n.topItemCount,"Rename the %ctopItems%c prop to %ctopItemCount."),itemHeight:Zt(n.fixedItemHeight,"Rename the %citemHeight%c prop to %cfixedItemHeight."),scrollingStateChange:Zt(n.isScrolling,"Rename the %cscrollingStateChange%c prop to %cisScrolling."),adjustForPrependedItems:e.stream(),maxHeightCacheSize:e.stream(),footer:e.stream(),header:e.stream(),HeaderContainer:e.stream(),FooterContainer:e.stream(),ItemContainer:e.stream(),ScrollContainer:e.stream(),GroupContainer:e.stream(),ListContainer:e.stream(),emptyComponent:e.stream(),scrollSeek:e.stream()};function i(t,n,r){e.connect(e.pipe(t,e.withLatestFrom(o.components),e.map(function(t){var e,o=t[0],i=t[1];return console.warn("react-virtuoso: "+r+" property is deprecated. Pass components."+n+" instead."),c({},i,((e={})[n]=o,e))})),o.components)}return e.subscribe(r.adjustForPrependedItems,function(){console.warn("react-virtuoso: adjustForPrependedItems is no longer supported. Use the firstItemIndex property instead - https://virtuoso.dev/prepend-items.","color: red;","color: inherit;","color: blue;")}),e.subscribe(r.maxHeightCacheSize,function(){console.warn("react-virtuoso: maxHeightCacheSize is no longer necessary. Setting it has no effect - remove it from your code.")}),e.subscribe(r.HeaderContainer,function(){console.warn("react-virtuoso: HeaderContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the header component and pass components.Header to change its contents.")}),e.subscribe(r.FooterContainer,function(){console.warn("react-virtuoso: FooterContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the footer component and pass components.Footer to change its contents.")}),e.subscribe(r.scrollSeek,function(t){var r=t.placeholder,i=m(t,_t);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),e.publish(o.components,c({},e.getValue(o.components),{ScrollSeekPlaceholder:r})),e.publish(n.scrollSeekConfiguration,i)}),i(r.footer,"Footer","footer"),i(r.header,"Header","header"),i(r.ItemContainer,"Item","ItemContainer"),i(r.ListContainer,"List","ListContainer"),i(r.ScrollContainer,"Scroller","ScrollContainer"),i(r.emptyComponent,"EmptyPlaceholder","emptyComponent"),i(r.GroupContainer,"Group","GroupContainer"),c({},n,o,r)},e.tup(Wt,qt)),$t=function(t){return n.createElement("div",{style:{height:t.height}})},Qt={position:Nt(),zIndex:1,overflowAnchor:"none"},Xt={overflowAnchor:"none"},te=n.memo(function(t){var o=t.showTopList,r=void 0!==o&&o,i=he("listState"),a=pe("sizeRanges"),s=he("useWindowScroll"),u=he("customScrollParent"),m=pe("windowScrollContainerState"),d=pe("scrollContainerState"),f=u||s?m:d,p=he("itemContent"),h=he("context"),g=he("groupContent"),v=he("trackItemSizes"),S=he("itemSize"),I=he("log"),C=pe("gap"),w=T(a,S,v,r?e.noop:f,I,C,u).callbackRef,x=n.useState(0),b=x[0],y=x[1];ge("deviation",function(t){b!==t&&y(t)});var H=he("EmptyPlaceholder"),E=he("ScrollSeekPlaceholder")||$t,R=he("ListComponent"),L=he("ItemComponent"),k=he("GroupComponent"),z=he("computeItemKey"),F=he("isSeeking"),B=he("groupIndices").length>0,P=he("paddingTopAddition"),O=r?{}:{boxSizing:"border-box",paddingTop:i.offsetTop+P,paddingBottom:i.offsetBottom,marginTop:b};return!r&&0===i.totalCount&&H?l(H,re(H,h)):l(R,c({},re(R,h),{ref:w,style:O,"data-test-id":r?"virtuoso-top-item-list":"virtuoso-item-list"}),(r?i.topItems:i.items).map(function(t){var e=t.originalIndex,n=z(e+i.firstItemIndex,t.data,h);return F?l(E,c({},re(E,h),{key:n,index:t.index,height:t.size,type:t.type||"item"},"group"===t.type?{}:{groupIndex:t.groupIndex})):"group"===t.type?l(k,c({},re(k,h),{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,style:Qt}),g(t.index)):l(L,c({},re(L,h),{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,"data-item-group-index":t.groupIndex,style:Xt}),B?p(t.index,t.groupIndex,t.data,h):p(t.index,t.data,h))}))}),ee={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},ne={width:"100%",height:"100%",position:"absolute",top:0},oe={width:"100%",position:Nt(),top:0};function re(t,e){if("string"!=typeof t)return{context:e}}var ie=n.memo(function(){var t=he("HeaderComponent"),e=pe("headerHeight"),n=he("headerFooterTag"),o=C(function(t){return e(w(t,"height"))}),r=he("context");return t?l(n,{ref:o},l(t,re(t,r))):null}),ae=n.memo(function(){var t=he("FooterComponent"),e=pe("footerHeight"),n=he("headerFooterTag"),o=C(function(t){return e(w(t,"height"))}),r=he("context");return t?l(n,{ref:o},l(t,re(t,r))):null});function le(t){var e=t.usePublisher,o=t.useEmitter,r=t.useEmitterValue;return n.memo(function(t){var n=t.style,i=t.children,a=m(t,jt),s=e("scrollContainerState"),u=r("ScrollerComponent"),d=e("smoothScrollTargetReached"),f=r("scrollerRef"),p=r("context"),h=b(s,d,u,f),g=h.scrollerRef,v=h.scrollByCallback;return o("scrollTo",h.scrollToCallback),o("scrollBy",v),l(u,c({ref:g,style:c({},ee,n),"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0},a,re(u,p)),i)})}function se(t){var o=t.usePublisher,r=t.useEmitter,i=t.useEmitterValue;return n.memo(function(t){var n=t.style,a=t.children,s=m(t,Kt),u=o("windowScrollContainerState"),d=i("ScrollerComponent"),f=o("smoothScrollTargetReached"),p=i("totalListHeight"),h=i("deviation"),v=i("customScrollParent"),S=i("context"),I=b(u,f,d,e.noop,v),C=I.scrollerRef,T=I.scrollByCallback,w=I.scrollToCallback;return g(function(){return C.current=v||window,function(){C.current=null}},[C,v]),r("windowScrollTo",w),r("scrollBy",T),l(d,c({style:c({position:"relative"},n,0!==p?{height:p+h}:{}),"data-virtuoso-scroller":!0},s,re(d,S)),a)})}var ue=function(t){var o=t.children,r=s(Gt),i=pe("viewportHeight"),a=pe("fixedItemHeight"),l=C(e.compose(i,function(t){return w(t,"height")}));return n.useEffect(function(){r&&(i(r.viewportHeight),a(r.itemHeight))},[r,i,a]),n.createElement("div",{style:ne,ref:l,"data-viewport-type":"element"},o)},ce=function(t){var e=t.children,o=s(Gt),r=pe("windowViewportRect"),i=pe("fixedItemHeight"),a=he("customScrollParent"),l=Dt(r,a);return n.useEffect(function(){o&&(i(o.itemHeight),r({offsetTop:0,visibleHeight:o.viewportHeight,visibleWidth:100}))},[o,r,i]),n.createElement("div",{ref:l,style:ne,"data-viewport-type":"window"},e)},me=function(t){var e=t.children,n=he("TopItemListComponent"),o=he("headerHeight"),r=c({},oe,{marginTop:o+"px"}),i=he("context");return l(n||"div",{style:r,context:i},e)},de=t(Jt,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",groupContent:"groupContent",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",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",react18ConcurrentRendering:"react18ConcurrentRendering",item:"item",group:"group",topItems:"topItems",itemHeight:"itemHeight",scrollingStateChange:"scrollingStateChange",maxHeightCacheSize:"maxHeightCacheSize",footer:"footer",header:"header",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",GroupContainer:"GroupContainer",emptyComponent:"emptyComponent",HeaderContainer:"HeaderContainer",FooterContainer:"FooterContainer",scrollSeek:"scrollSeek"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",adjustForPrependedItems:"adjustForPrependedItems",autoscrollToBottom:"autoscrollToBottom"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},n.memo(function(t){var e=he("useWindowScroll"),o=he("topItemsIndexes").length>0,r=he("customScrollParent"),i=r||e?ce:ue;return n.createElement(r||e?Se:ve,c({},t),n.createElement(i,null,n.createElement(ie,null),n.createElement(te,null),n.createElement(ae,null)),o&&n.createElement(me,null,n.createElement(te,{showTopList:!0})))})),fe=de.Component,pe=de.usePublisher,he=de.useEmitterValue,ge=de.useEmitter,ve=le({usePublisher:pe,useEmitterValue:he,useEmitter:ge}),Se=se({usePublisher:pe,useEmitterValue:he,useEmitter:ge}),Ie={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Ce={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Te=Math.round,we=Math.ceil,xe=Math.floor,be=Math.min,ye=Math.max;function He(t,e){return Array.from({length:e-t+1}).map(function(e,n){return{index:n+t}})}function Ee(t,e){return t&&t.column===e.column&&t.row===e.row}var Re=e.system(function(t){var n=t[0],o=n.overscan,r=n.visibleRange,i=n.listBoundary,a=t[1],l=a.scrollTop,s=a.viewportHeight,u=a.scrollBy,m=a.scrollTo,d=a.smoothScrollTargetReached,f=a.scrollContainerState,p=t[2],h=t[3],g=t[4],v=g.propsReady,S=g.didMount,I=t[5],C=I.windowViewportRect,T=I.windowScrollTo,w=I.useWindowScroll,x=I.customScrollParent,b=I.windowScrollContainerState,y=t[6],H=e.statefulStream(0),E=e.statefulStream(0),R=e.statefulStream(Ie),L=e.statefulStream({height:0,width:0}),k=e.statefulStream({height:0,width:0}),z=e.stream(),F=e.stream(),B=e.statefulStream(0),P=e.statefulStream({row:0,column:0});e.connect(e.pipe(S,e.withLatestFrom(E),e.filter(function(t){return 0!==t[1]}),e.map(function(t){return{items:He(0,t[1]-1),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0}})),R),e.connect(e.pipe(e.combineLatest(e.duc(H),r,e.duc(P,Ee),e.duc(k,function(t,e){return t&&t.width===e.width&&t.height===e.height})),e.withLatestFrom(L),e.map(function(t){var e=t[0],n=e[0],o=e[1],r=o[0],i=o[1],a=e[2],l=e[3],s=t[1],u=a.row,c=l.height,m=l.width,d=s.width;if(0===n||0===d)return Ie;if(0===m)return Ce;var f=ze(d,m,a.column),p=f*xe((r+u)/(c+u)),h=f*we((i+u)/(c+u))-1;h=ye(0,be(n-1,h));var g=He(p=be(h,ye(0,p)),h),v=Le(s,a,l,g),S=v.top,I=v.bottom,C=we(n/f);return{items:g,offsetTop:S,offsetBottom:C*c+(C-1)*u-I,top:S,bottom:I,itemHeight:c,itemWidth:m}})),R),e.connect(e.pipe(L,e.map(function(t){return t.height})),s),e.connect(e.pipe(e.combineLatest(L,k,R,P),e.map(function(t){var e=Le(t[0],t[3],t[1],t[2].items);return[e.top,e.bottom]}),e.distinctUntilChanged(vt)),i);var O=e.streamFromEmitter(e.pipe(e.duc(R),e.filter(function(t){return t.items.length>0}),e.withLatestFrom(H),e.filter(function(t){var e=t[0].items;return e[e.length-1].index===t[1]-1}),e.map(function(t){return t[1]-1}),e.distinctUntilChanged())),M=e.streamFromEmitter(e.pipe(e.duc(R),e.filter(function(t){var e=t.items;return e.length>0&&0===e[0].index}),e.mapTo(0),e.distinctUntilChanged())),V=e.streamFromEmitter(e.pipe(e.duc(R),e.filter(function(t){return t.items.length>0}),e.map(function(t){var e=t.items;return{startIndex:e[0].index,endIndex:e[e.length-1].index}}),e.distinctUntilChanged(St)));e.connect(V,h.scrollSeekRangeChanged),e.connect(e.pipe(z,e.withLatestFrom(L,k,H,P),e.map(function(t){var e=t[1],n=t[2],o=t[3],r=t[4],i=at(t[0]),a=i.align,l=i.behavior,s=i.offset,u=i.index;"LAST"===u&&(u=o-1);var c=ke(e,r,n,u=ye(0,u,be(o-1,u)));return"end"===a?c=Te(c-e.height+n.height):"center"===a&&(c=Te(c-e.height/2+n.height/2)),s&&(c+=s),{top:c,behavior:l}})),m);var U=e.statefulStreamFromEmitter(e.pipe(R,e.map(function(t){return t.offsetBottom+t.bottom})),0);return e.connect(e.pipe(C,e.map(function(t){return{width:t.visibleWidth,height:t.visibleHeight}})),L),c({totalCount:H,viewportDimensions:L,itemDimensions:k,scrollTop:l,scrollHeight:F,overscan:o,scrollBy:u,scrollTo:m,scrollToIndex:z,smoothScrollTargetReached:d,windowViewportRect:C,windowScrollTo:T,useWindowScroll:w,customScrollParent:x,windowScrollContainerState:b,deviation:B,scrollContainerState:f,initialItemCount:E,gap:P},h,{gridState:R,totalListHeight:U},p,{startReached:M,endReached:O,rangeChanged:V,propsReady:v},y)},e.tup(Tt,y,ct,Et,mt,Ot,S));function Le(t,e,n,o){var r=n.height;return void 0===r||0===o.length?{top:0,bottom:0}:{top:ke(t,e,n,o[0].index),bottom:ke(t,e,n,o[o.length-1].index)+r}}function ke(t,e,n,o){var r=ze(t.width,n.width,e.column),i=xe(o/r),a=i*n.height+ye(0,i-1)*e.row;return a>0?a+e.row:a}function ze(t,e,n){return ye(1,xe((t+n)/(e+n)))}var Fe=["placeholder"],Be=e.system(function(){var t=e.statefulStream(function(t){return"Item "+t}),n=e.statefulStream({}),o=e.statefulStream(null),r=e.statefulStream("virtuoso-grid-item"),i=e.statefulStream("virtuoso-grid-list"),a=e.statefulStream(Yt),l=e.statefulStream(e.noop),s=function(t,o){return void 0===o&&(o=null),e.statefulStreamFromEmitter(e.pipe(n,e.map(function(e){return e[t]}),e.distinctUntilChanged()),o)};return{context:o,itemContent:t,components:n,computeItemKey:a,itemClassName:r,listClassName:i,scrollerRef:l,ListComponent:s("List","div"),ItemComponent:s("Item","div"),ScrollerComponent:s("Scroller","div"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder","div")}}),Pe=e.system(function(t){var n=t[0],o=t[1],r={item:Zt(o.itemContent,"Rename the %citem%c prop to %citemContent."),ItemContainer:e.stream(),ScrollContainer:e.stream(),ListContainer:e.stream(),emptyComponent:e.stream(),scrollSeek:e.stream()};function i(t,n,r){e.connect(e.pipe(t,e.withLatestFrom(o.components),e.map(function(t){var e,o=t[0],i=t[1];return console.warn("react-virtuoso: "+r+" property is deprecated. Pass components."+n+" instead."),c({},i,((e={})[n]=o,e))})),o.components)}return e.subscribe(r.scrollSeek,function(t){var r=t.placeholder,i=m(t,Fe);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),e.publish(o.components,c({},e.getValue(o.components),{ScrollSeekPlaceholder:r})),e.publish(n.scrollSeekConfiguration,i)}),i(r.ItemContainer,"Item","ItemContainer"),i(r.ListContainer,"List","ListContainer"),i(r.ScrollContainer,"Scroller","ScrollContainer"),c({},n,o,r)},e.tup(Re,Be)),Oe=n.memo(function(){var t=Ne("gridState"),e=Ne("listClassName"),n=Ne("itemClassName"),o=Ne("itemContent"),r=Ne("computeItemKey"),i=Ne("isSeeking"),a=We("scrollHeight"),s=Ne("ItemComponent"),u=Ne("ListComponent"),m=Ne("ScrollSeekPlaceholder"),d=Ne("context"),f=We("itemDimensions"),p=We("gap"),h=Ne("log"),g=C(function(t){a(t.parentElement.parentElement.scrollHeight);var e=t.firstChild;e&&f(e.getBoundingClientRect()),p({row:je("row-gap",getComputedStyle(t).rowGap,h),column:je("column-gap",getComputedStyle(t).columnGap,h)})});return l(u,c({ref:g,className:e},re(u,d),{style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom}}),t.items.map(function(e){var a=r(e.index);return i?l(m,c({key:a},re(m,d),{index:e.index,height:t.itemHeight,width:t.itemWidth})):l(s,c({},re(s,d),{className:n,"data-index":e.index,key:a}),o(e.index,d))}))}),Me=function(t){var e=t.children,o=We("viewportDimensions"),r=C(function(t){o(t.getBoundingClientRect())});return n.createElement("div",{style:ne,ref:r},e)},Ve=function(t){var e=t.children,o=Dt(We("windowViewportRect"),Ne("customScrollParent"));return n.createElement("div",{ref:o,style:ne},e)},Ue=t(Pe,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",item:"item",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",scrollSeek:"scrollSeek"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange"}},n.memo(function(t){var e=c({},t),o=Ne("useWindowScroll"),r=Ne("customScrollParent"),i=r||o?Ve:Me;return n.createElement(r||o?_e:Ge,c({},e),n.createElement(i,null,n.createElement(Oe,null)))})),Ae=Ue.Component,We=Ue.usePublisher,Ne=Ue.useEmitterValue,De=Ue.useEmitter,Ge=le({usePublisher:We,useEmitterValue:Ne,useEmitter:De}),_e=se({usePublisher:We,useEmitterValue:Ne,useEmitter:De});function je(t,e,n){return"normal"===e||null!=e&&e.endsWith("px")||n(t+" was not resolved to pixel value correctly",e,h.WARN),"normal"===e?0:parseInt(null!=e?e:"0",10)}var Ke=e.system(function(){var t=e.statefulStream(function(t){return n.createElement("td",null,"Item $",t)}),o=e.statefulStream(null),r=e.statefulStream(null),i=e.statefulStream(null),a=e.statefulStream({}),l=e.statefulStream(Yt),s=e.statefulStream(e.noop),u=function(t,n){return void 0===n&&(n=null),e.statefulStreamFromEmitter(e.pipe(a,e.map(function(e){return e[t]}),e.distinctUntilChanged()),n)};return{context:o,itemContent:t,fixedHeaderContent:r,fixedFooterContent:i,components:a,computeItemKey:l,scrollerRef:s,TableComponent:u("Table","table"),TableHeadComponent:u("TableHead","thead"),TableFooterComponent:u("TableFoot","tfoot"),TableBodyComponent:u("TableBody","tbody"),TableRowComponent:u("TableRow","tr"),ScrollerComponent:u("Scroller","div"),EmptyPlaceholder:u("EmptyPlaceholder"),ScrollSeekPlaceholder:u("ScrollSeekPlaceholder"),FillerRow:u("FillerRow")}}),Ye=e.system(function(t){return c({},t[0],t[1])},e.tup(Wt,Ke)),qe=function(t){return n.createElement("tr",null,n.createElement("td",{style:{height:t.height}}))},Ze=function(t){return n.createElement("tr",null,n.createElement("td",{style:{height:t.height,padding:0,border:0}}))},Je=n.memo(function(){var t=nn("listState"),e=en("sizeRanges"),o=nn("useWindowScroll"),r=nn("customScrollParent"),i=en("windowScrollContainerState"),a=en("scrollContainerState"),s=r||o?i:a,u=nn("itemContent"),m=nn("trackItemSizes"),d=T(e,nn("itemSize"),m,s,nn("log"),void 0,r),f=d.callbackRef,p=d.ref,h=n.useState(0),g=h[0],v=h[1];on("deviation",function(t){g!==t&&(p.current.style.marginTop=t+"px",v(t))});var S=nn("EmptyPlaceholder"),I=nn("ScrollSeekPlaceholder")||qe,C=nn("FillerRow")||Ze,w=nn("TableBodyComponent"),x=nn("TableRowComponent"),b=nn("computeItemKey"),y=nn("isSeeking"),H=nn("paddingTopAddition"),E=nn("firstItemIndex"),R=nn("statefulTotalCount"),L=nn("context");if(0===R&&S)return l(S,re(S,L));var k=t.offsetTop+H+g,z=t.offsetBottom,F=k>0?n.createElement(C,{height:k,key:"padding-top"}):null,B=z>0?n.createElement(C,{height:z,key:"padding-bottom"}):null,P=t.items.map(function(t){var e=t.originalIndex,n=b(e+E,t.data,L);return y?l(I,c({},re(I,L),{key:n,index:t.index,height:t.size,type:t.type||"item"})):l(x,c({},re(x,L),{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,style:{overflowAnchor:"none"}}),u(t.index,t.data,L))});return l(w,c({ref:f,"data-test-id":"virtuoso-item-list"},re(w,L)),[F].concat(P,[B]))}),$e=function(t){var o=t.children,r=s(Gt),i=en("viewportHeight"),a=en("fixedItemHeight"),l=C(e.compose(i,function(t){return w(t,"height")}));return n.useEffect(function(){r&&(i(r.viewportHeight),a(r.itemHeight))},[r,i,a]),n.createElement("div",{style:ne,ref:l,"data-viewport-type":"element"},o)},Qe=function(t){var e=t.children,o=s(Gt),r=en("windowViewportRect"),i=en("fixedItemHeight"),a=nn("customScrollParent"),l=Dt(r,a);return n.useEffect(function(){o&&(i(o.itemHeight),r({offsetTop:0,visibleHeight:o.viewportHeight,visibleWidth:100}))},[o,r,i]),n.createElement("div",{ref:l,style:ne,"data-viewport-type":"window"},e)},Xe=t(Ye,{required:{},optional:{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",react18ConcurrentRendering:"react18ConcurrentRendering"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},n.memo(function(t){var o=nn("useWindowScroll"),r=nn("customScrollParent"),i=en("fixedHeaderHeight"),a=en("fixedFooterHeight"),l=nn("fixedHeaderContent"),s=nn("fixedFooterContent"),u=nn("context"),m=C(e.compose(i,function(t){return w(t,"height")})),d=C(e.compose(a,function(t){return w(t,"height")})),f=r||o?an:rn,p=r||o?Qe:$e,h=nn("TableComponent"),g=nn("TableHeadComponent"),v=nn("TableFooterComponent"),S=l?n.createElement(g,c({key:"TableHead",style:{zIndex:1,position:"sticky",top:0},ref:m},re(g,u)),l()):null,I=s?n.createElement(v,c({key:"TableFoot",style:{zIndex:1,position:"sticky",bottom:0},ref:d},re(v,u)),s()):null;return n.createElement(f,c({},t),n.createElement(p,null,n.createElement(h,c({style:{borderSpacing:0}},re(h,u)),[S,n.createElement(Je,{key:"TableBody"}),I])))})),tn=Xe.Component,en=Xe.usePublisher,nn=Xe.useEmitterValue,on=Xe.useEmitter,rn=le({usePublisher:en,useEmitterValue:nn,useEmitter:on}),an=se({usePublisher:en,useEmitterValue:nn,useEmitter:on}),ln=fe,sn=fe,un=tn,cn=Ae;export{sn as GroupedVirtuoso,h as LogLevel,un as TableVirtuoso,ln as Virtuoso,cn as VirtuosoGrid,Gt as VirtuosoMockContext}; | ||
import{systemToComponent as t}from"@virtuoso.dev/react-urx";import*as e from"@virtuoso.dev/urx";import*as n from"react";import{useLayoutEffect as o,useEffect as r,useRef as i,useCallback as a,createElement as l,useContext as s}from"react";import{flushSync as u}from"react-dom";function c(){return c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},c.apply(this,arguments)}function m(t,e){if(null==t)return{};var n,o,r={},i=Object.keys(t);for(o=0;o<i.length;o++)e.indexOf(n=i[o])>=0||(r[n]=t[n]);return r}function d(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}function f(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return d(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var p,h,g="undefined"!=typeof document?o:r;!function(t){t[t.DEBUG=0]="DEBUG",t[t.INFO=1]="INFO",t[t.WARN=2]="WARN",t[t.ERROR=3]="ERROR"}(h||(h={}));var v=((p={})[h.DEBUG]="debug",p[h.INFO]="log",p[h.WARN]="warn",p[h.ERROR]="error",p),S=e.system(function(){var t=e.statefulStream(h.ERROR);return{log:e.statefulStream(function(n,o,r){var i;void 0===r&&(r=h.INFO),r>=(null!=(i=("undefined"==typeof globalThis?window:globalThis).VIRTUOSO_LOG_LEVEL)?i:e.getValue(t))&&console[v[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,o)}),logLevel:t}},[],{singleton:!0});function I(t,e){void 0===e&&(e=!0);var n=i(null),o=function(t){};if("undefined"!=typeof ResizeObserver){var r=new ResizeObserver(function(e){var n=e[0].target;null!==n.offsetParent&&t(n)});o=function(t){t&&e?(r.observe(t),n.current=t):(n.current&&r.unobserve(n.current),n.current=null)}}return{ref:n,callbackRef:o}}function C(t,e){return void 0===e&&(e=!0),I(t,e).callbackRef}function T(t,e,n,o,r,i,a){return I(function(n){for(var l=function(t,e,n,o){var r=t.length;if(0===r)return null;for(var i=[],a=0;a<r;a++){var l=t.item(a);if(l&&void 0!==l.dataset.index){var s=parseInt(l.dataset.index),u=parseFloat(l.dataset.knownSize),c=e(l,"offsetHeight");if(0===c&&o("Zero-sized element, this should not happen",{child:l},h.ERROR),c!==u){var m=i[i.length-1];0===i.length||m.size!==c||m.endIndex!==s-1?i.push({startIndex:s,endIndex:s,size:c}):i[i.length-1].endIndex++}}}return i}(n.children,e,0,r),s=n.parentElement;!s.dataset.virtuosoScroller;)s=s.parentElement;var u="window"===s.firstElementChild.dataset.viewportType,c=a?a.scrollTop:u?window.pageYOffset||document.documentElement.scrollTop:s.scrollTop,m=a?a.scrollHeight:u?document.documentElement.scrollHeight:s.scrollHeight,d=a?a.offsetHeight:u?window.innerHeight:s.offsetHeight;o({scrollTop:Math.max(c,0),scrollHeight:m,viewportHeight:d}),null==i||i(function(t,e,n){return"normal"===e||null!=e&&e.endsWith("px")||n("row-gap was not resolved to pixel value correctly",e,h.WARN),"normal"===e?0:parseInt(null!=e?e:"0",10)}(0,getComputedStyle(n).rowGap,r)),null!==l&&t(l)},n)}function w(t,e){return Math.round(t.getBoundingClientRect()[e])}function x(t,e){return Math.abs(t-e)<1.01}function b(t,n,o,l,s){void 0===l&&(l=e.noop);var c=i(null),m=i(null),d=i(null),f=i(!1),p=a(function(e){var o=e.target,r=o===window||o===document,i=r?window.pageYOffset||document.documentElement.scrollTop:o.scrollTop,a=r?document.documentElement.scrollHeight:o.scrollHeight,l=r?window.innerHeight:o.offsetHeight,s=function(){t({scrollTop:Math.max(i,0),scrollHeight:a,viewportHeight:l})};f.current?u(s):s(),f.current=!1,null!==m.current&&(i===m.current||i<=0||i===a-l)&&(m.current=null,n(!0),d.current&&(clearTimeout(d.current),d.current=null))},[t,n]);return r(function(){var t=s||c.current;return l(s||c.current),p({target:t}),t.addEventListener("scroll",p,{passive:!0}),function(){l(null),t.removeEventListener("scroll",p)}},[c,p,o,l,s]),{scrollerRef:c,scrollByCallback:function(t){f.current=!0,c.current.scrollBy(t)},scrollToCallback:function(e){var o=c.current;if(o&&(!("offsetHeight"in o)||0!==o.offsetHeight)){var r,i,a,l="smooth"===e.behavior;if(o===window?(i=Math.max(w(document.documentElement,"height"),document.documentElement.scrollHeight),r=window.innerHeight,a=document.documentElement.scrollTop):(i=o.scrollHeight,r=w(o,"height"),a=o.scrollTop),e.top=Math.ceil(Math.max(Math.min(i-r,e.top),0)),x(r,i)||e.top===a)return t({scrollTop:a,scrollHeight:i,viewportHeight:r}),void(l&&n(!0));l?(m.current=e.top,d.current&&clearTimeout(d.current),d.current=setTimeout(function(){d.current=null,m.current=null,n(!0)},1e3)):m.current=null,o.scrollTo(e)}}}}var y=e.system(function(){var t=e.stream(),n=e.stream(),o=e.statefulStream(0),r=e.stream(),i=e.statefulStream(0),a=e.stream(),l=e.stream(),s=e.statefulStream(0),u=e.statefulStream(0),c=e.statefulStream(0),m=e.statefulStream(0),d=e.stream(),f=e.stream(),p=e.statefulStream(!1),h=e.statefulStream(!1);return e.connect(e.pipe(t,e.map(function(t){return t.scrollTop})),n),e.connect(e.pipe(t,e.map(function(t){return t.scrollHeight})),l),e.connect(n,i),{scrollContainerState:t,scrollTop:n,viewportHeight:a,headerHeight:s,fixedHeaderHeight:u,fixedFooterHeight:c,footerHeight:m,scrollHeight:l,smoothScrollTargetReached:r,react18ConcurrentRendering:h,scrollTo:d,scrollBy:f,statefulScrollTop:i,deviation:o,scrollingInProgress:p}},[],{singleton:!0}),H={lvl:0};function E(t,e,n,o,r){return void 0===o&&(o=H),void 0===r&&(r=H),{k:t,v:e,lvl:n,l:o,r:r}}function R(t){return t===H}function L(){return H}function k(t,e){if(R(t))return H;var n=t.k,o=t.l,r=t.r;if(e===n){if(R(o))return r;if(R(r))return o;var i=O(o);return A(V(t,{k:i[0],v:i[1],l:M(o)}))}return A(V(t,e<n?{l:k(o,e)}:{r:k(r,e)}))}function F(t,e,n){if(void 0===n&&(n="k"),R(t))return[-Infinity,void 0];if(t[n]===e)return[t.k,t.v];if(t[n]<e){var o=F(t.r,e,n);return-Infinity===o[0]?[t.k,t.v]:o}return F(t.l,e,n)}function z(t,e,n){return R(t)?E(e,n,1):e===t.k?V(t,{k:e,v:n}):function(t){return D(G(t))}(V(t,e<t.k?{l:z(t.l,e,n)}:{r:z(t.r,e,n)}))}function B(t,e,n){if(R(t))return[];var o=t.k,r=t.v,i=t.r,a=[];return o>e&&(a=a.concat(B(t.l,e,n))),o>=e&&o<=n&&a.push({k:o,v:r}),o<=n&&(a=a.concat(B(i,e,n))),a}function P(t){return R(t)?[]:[].concat(P(t.l),[{k:t.k,v:t.v}],P(t.r))}function O(t){return R(t.r)?[t.k,t.v]:O(t.r)}function M(t){return R(t.r)?t.l:A(V(t,{r:M(t.r)}))}function V(t,e){return E(void 0!==e.k?e.k:t.k,void 0!==e.v?e.v:t.v,void 0!==e.lvl?e.lvl:t.lvl,void 0!==e.l?e.l:t.l,void 0!==e.r?e.r:t.r)}function U(t){return R(t)||t.lvl>t.r.lvl}function A(t){var e=t.l,n=t.r,o=t.lvl;if(n.lvl>=o-1&&e.lvl>=o-1)return t;if(o>n.lvl+1){if(U(e))return G(V(t,{lvl:o-1}));if(R(e)||R(e.r))throw new Error("Unexpected empty nodes");return V(e.r,{l:V(e,{r:e.r.l}),r:V(t,{l:e.r.r,lvl:o-1}),lvl:o})}if(U(t))return D(V(t,{lvl:o-1}));if(R(n)||R(n.l))throw new Error("Unexpected empty nodes");var r=n.l,i=U(r)?n.lvl-1:n.lvl;return V(r,{l:V(t,{r:r.l,lvl:o-1}),r:D(V(n,{l:r.r,lvl:i})),lvl:r.lvl+1})}function W(t,e,n){return R(t)?[]:N(B(t,F(t,e)[0],n),function(t){return{index:t.k,value:t.v}})}function N(t,e){var n=t.length;if(0===n)return[];for(var o=e(t[0]),r=o.index,i=o.value,a=[],l=1;l<n;l++){var s=e(t[l]),u=s.index,c=s.value;a.push({start:r,end:u-1,value:i}),r=u,i=c}return a.push({start:r,end:Infinity,value:i}),a}function D(t){var e=t.r,n=t.lvl;return R(e)||R(e.r)||e.lvl!==n||e.r.lvl!==n?t:V(e,{l:V(t,{r:e.l}),lvl:n+1})}function G(t){var e=t.l;return R(e)||e.lvl!==t.lvl?t:V(e,{r:V(t,{l:e.r})})}function _(t,e,n,o){void 0===o&&(o=0);for(var r=t.length-1;o<=r;){var i=Math.floor((o+r)/2),a=n(t[i],e);if(0===a)return i;if(-1===a){if(r-o<2)return i-1;r=i-1}else{if(r===o)return i;o=i+1}}throw new Error("Failed binary finding record in array - "+t.join(",")+", searched for "+e)}function j(t,e,n){return t[_(t,e,n)]}var K=e.system(function(){return{recalcInProgress:e.statefulStream(!1)}},[],{singleton:!0});function Y(t){var e=t.size,n=t.startIndex,o=t.endIndex;return function(t){return t.start===n&&(t.end===o||Infinity===t.end)&&t.value===e}}function q(t,e){var n=t.index;return e===n?0:e<n?-1:1}function Z(t,e){var n=t.offset;return e===n?0:e<n?-1:1}function J(t){return{index:t.index,value:t}}function $(t,e,n,o){var r=t,i=0,a=0,l=0,s=0;if(0!==e){l=r[s=_(r,e-1,q)].offset;var u=F(n,e-1);i=u[0],a=u[1],r.length&&r[s].size===F(n,e)[1]&&(s-=1),r=r.slice(0,s+1)}else r=[];for(var c,m=f(W(n,e,Infinity));!(c=m()).done;){var d=c.value,p=d.start,h=d.value,g=p-i,v=g*a+l+g*o;r.push({offset:v,size:h,index:p}),i=p,l=v,a=h}return{offsetTree:r,lastIndex:i,lastOffset:l,lastSize:a}}function Q(t,e){var n=e[0],o=e[1],r=e[3];n.length>0&&(0,e[2])("received item sizes",n,h.DEBUG);var i=t.sizeTree,a=i,l=0;if(o.length>0&&R(i)&&2===n.length){var s=n[0].size,u=n[1].size;a=o.reduce(function(t,e){return z(z(t,e,s),e+1,u)},a)}else{var c=function(t,e){for(var n,o=R(t)?0:Infinity,r=f(e);!(n=r()).done;){var i=n.value,a=i.size,l=i.startIndex,s=i.endIndex;if(o=Math.min(o,l),R(t))t=z(t,0,a);else{var u=W(t,l-1,s+1);if(!u.some(Y(i))){for(var c,m=!1,d=!1,p=f(u);!(c=p()).done;){var h=c.value,g=h.start,v=h.end,S=h.value;m?(s>=g||a===S)&&(t=k(t,g)):(d=S!==a,m=!0),v>s&&s>=g&&S!==a&&(t=z(t,s+1,S))}d&&(t=z(t,l,a))}}}return[t,o]}(a,n);a=c[0],l=c[1]}if(a===i)return t;var m=$(t.offsetTree,l,a,r),d=m.offsetTree;return{sizeTree:a,offsetTree:d,lastIndex:m.lastIndex,lastOffset:m.lastOffset,lastSize:m.lastSize,groupOffsetTree:o.reduce(function(t,e){return z(t,e,X(e,d,r))},L()),groupIndices:o}}function X(t,e,n){if(0===e.length)return 0;var o=j(e,t,q),r=t-o.index,i=o.size*r+(r-1)*n+o.offset;return i>0?i+n:i}function tt(t,e,n){if(function(t){return void 0!==t.groupIndex}(t))return e.groupIndices[t.groupIndex]+1;var o=et("LAST"===t.index?n:t.index,e);return Math.max(0,o,Math.min(n,o))}function et(t,e){if(!nt(e))return t;for(var n=0;e.groupIndices[n]<=t+n;)n++;return t+n}function nt(t){return!R(t.groupOffsetTree)}var ot={offsetHeight:"height",offsetWidth:"width"},rt=e.system(function(t){var n=t[0].log,o=t[1].recalcInProgress,r=e.stream(),i=e.stream(),a=e.statefulStreamFromEmitter(i,0),l=e.stream(),s=e.stream(),u=e.statefulStream(0),m=e.statefulStream([]),d=e.statefulStream(void 0),f=e.statefulStream(void 0),p=e.statefulStream(function(t,e){return w(t,ot[e])}),g=e.statefulStream(void 0),v=e.statefulStream(0),S={offsetTree:[],sizeTree:L(),groupOffsetTree:L(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},I=e.statefulStreamFromEmitter(e.pipe(r,e.withLatestFrom(m,n,v),e.scan(Q,S),e.distinctUntilChanged()),S);e.connect(e.pipe(m,e.filter(function(t){return t.length>0}),e.withLatestFrom(I,v),e.map(function(t){var e=t[0],n=t[1],o=t[2],r=e.reduce(function(t,e,r){return z(t,e,X(e,n.offsetTree,o)||r)},L());return c({},n,{groupIndices:e,groupOffsetTree:r})})),I),e.connect(e.pipe(i,e.withLatestFrom(I),e.filter(function(t){return t[0]<t[1].lastIndex}),e.map(function(t){var e=t[1];return[{startIndex:t[0],endIndex:e.lastIndex,size:e.lastSize}]})),r),e.connect(d,f);var C=e.statefulStreamFromEmitter(e.pipe(d,e.map(function(t){return void 0===t})),!0);e.connect(e.pipe(f,e.filter(function(t){return void 0!==t&&R(e.getValue(I).sizeTree)}),e.map(function(t){return[{startIndex:0,endIndex:0,size:t}]})),r);var T=e.streamFromEmitter(e.pipe(r,e.withLatestFrom(I),e.scan(function(t,e){var n=e[1];return{changed:n!==t.sizes,sizes:n}},{changed:!1,sizes:S}),e.map(function(t){return t.changed})));e.subscribe(e.pipe(u,e.scan(function(t,e){return{diff:t.prev-e,prev:e}},{diff:0,prev:0}),e.map(function(t){return t.diff})),function(t){t>0?(e.publish(o,!0),e.publish(l,t)):t<0&&e.publish(s,t)}),e.subscribe(e.pipe(u,e.withLatestFrom(n)),function(t){t[0]<0&&(0,t[1])("`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:u},h.ERROR)});var x=e.streamFromEmitter(l);e.connect(e.pipe(l,e.withLatestFrom(I),e.map(function(t){var e=t[0],n=t[1];if(n.groupIndices.length>0)throw new Error("Virtuoso: prepending items does not work with groups");return P(n.sizeTree).reduce(function(t,n){var o=n.k,r=n.v;return{ranges:[].concat(t.ranges,[{startIndex:t.prevIndex,endIndex:o+e-1,size:t.prevSize}]),prevIndex:o+e,prevSize:r}},{ranges:[],prevIndex:0,prevSize:n.lastSize}).ranges})),r);var b=e.streamFromEmitter(e.pipe(s,e.withLatestFrom(I,v),e.map(function(t){return X(-t[0],t[1].offsetTree,t[2])})));return e.connect(e.pipe(s,e.withLatestFrom(I,v),e.map(function(t){var e=t[0],n=t[1],o=t[2];if(n.groupIndices.length>0)throw new Error("Virtuoso: shifting items does not work with groups");var r=P(n.sizeTree).reduce(function(t,n){var o=n.v;return z(t,Math.max(0,n.k+e),o)},L());return c({},n,{sizeTree:r},$(n.offsetTree,0,r,o))})),I),{data:g,totalCount:i,sizeRanges:r,groupIndices:m,defaultItemSize:f,fixedItemSize:d,unshiftWith:l,shiftWith:s,shiftWithOffset:b,beforeUnshiftWith:x,firstItemIndex:u,gap:v,sizes:I,listRefresh:T,statefulTotalCount:a,trackItemSizes:C,itemSize:p}},e.tup(S,K),{singleton:!0}),it="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style;function at(t){var e="number"==typeof t?{index:t}:t;return e.align||(e.align="start"),e.behavior&&it||(e.behavior="auto"),e.offset||(e.offset=0),e}var lt=e.system(function(t){var n=t[0],o=n.sizes,r=n.totalCount,i=n.listRefresh,a=n.gap,l=t[1],s=l.scrollingInProgress,u=l.viewportHeight,c=l.scrollTo,m=l.smoothScrollTargetReached,d=l.headerHeight,f=l.footerHeight,p=l.fixedHeaderHeight,g=l.fixedFooterHeight,v=t[2].log,S=e.stream(),I=e.statefulStream(0),C=null,T=null,w=null;function x(){C&&(C(),C=null),w&&(w(),w=null),T&&(clearTimeout(T),T=null),e.publish(s,!1)}return e.connect(e.pipe(S,e.withLatestFrom(o,u,r,I,d,f,v),e.withLatestFrom(a,p,g),e.map(function(t){var n=t[0],o=n[0],r=n[1],a=n[2],l=n[3],u=n[4],c=n[5],d=n[6],f=n[7],p=t[1],g=t[2],v=t[3],I=at(o),b=I.align,y=I.behavior,H=I.offset,E=l-1,R=tt(I,r,E),L=X(R,r.offsetTree,p)+c;"end"===b?(L+=g+F(r.sizeTree,R)[1]-a+v,R===E&&(L+=d)):"center"===b?L+=(g+F(r.sizeTree,R)[1]-a+v)/2:L-=u,H&&(L+=H);var k=function(t){x(),t?(f("retrying to scroll to",{location:o},h.DEBUG),e.publish(S,o)):f("list did not change, scroll successful",{},h.DEBUG)};if(x(),"smooth"===y){var z=!1;w=e.subscribe(i,function(t){z=z||t}),C=e.handleNext(m,function(){k(z)})}else C=e.handleNext(e.pipe(i,function(t){var e=setTimeout(function(){t(!1)},150);return function(n){n&&(t(!0),clearTimeout(e))}}),k);return T=setTimeout(function(){x()},1200),e.publish(s,!0),f("scrolling from index to",{index:R,top:L,behavior:y},h.DEBUG),{top:L,behavior:y}})),c),{scrollToIndex:S,topListHeight:I}},e.tup(rt,y,S),{singleton:!0}),st="up",ut={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},ct=e.system(function(t){var n=t[0],o=n.scrollContainerState,r=n.scrollTop,i=n.viewportHeight,a=n.headerHeight,l=n.footerHeight,s=n.scrollBy,u=e.statefulStream(!1),c=e.statefulStream(!0),m=e.stream(),d=e.stream(),f=e.statefulStream(4),p=e.statefulStream(0),h=e.statefulStreamFromEmitter(e.pipe(e.merge(e.pipe(e.duc(r),e.skip(1),e.mapTo(!0)),e.pipe(e.duc(r),e.skip(1),e.mapTo(!1),e.debounceTime(100))),e.distinctUntilChanged()),!1),g=e.statefulStreamFromEmitter(e.pipe(e.merge(e.pipe(s,e.mapTo(!0)),e.pipe(s,e.mapTo(!1),e.debounceTime(200))),e.distinctUntilChanged()),!1);e.connect(e.pipe(e.combineLatest(e.duc(r),e.duc(p)),e.map(function(t){return t[0]<=t[1]}),e.distinctUntilChanged()),c),e.connect(e.pipe(c,e.throttleTime(50)),d);var v=e.streamFromEmitter(e.pipe(e.combineLatest(o,e.duc(i),e.duc(a),e.duc(l),e.duc(f)),e.scan(function(t,e){var n,o,r=e[0],i=r.scrollTop,a=r.scrollHeight,l=e[1],s={viewportHeight:l,scrollTop:i,scrollHeight:a};return i+l-a>-e[4]?(i>t.state.scrollTop?(n="SCROLLED_DOWN",o=t.state.scrollTop-i):(n="SIZE_DECREASED",o=t.state.scrollTop-i||t.scrollTopDelta),{atBottom:!0,state:s,atBottomBecause:n,scrollTopDelta:o}):{atBottom:!1,notAtBottomBecause:s.scrollHeight>t.state.scrollHeight?"SIZE_INCREASED":l<t.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":i<t.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",state:s}},ut),e.distinctUntilChanged(function(t,e){return t&&t.atBottom===e.atBottom}))),S=e.statefulStreamFromEmitter(e.pipe(o,e.scan(function(t,e){var n=e.scrollTop,o=e.scrollHeight,r=e.viewportHeight;return x(t.scrollHeight,o)?{scrollTop:n,scrollHeight:o,jump:0,changed:!1}:t.scrollTop!==n&&o-(n+r)<1?{scrollHeight:o,scrollTop:n,jump:t.scrollTop-n,changed:!0}:{scrollHeight:o,scrollTop:n,jump:0,changed:!0}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),e.filter(function(t){return t.changed}),e.map(function(t){return t.jump})),0);e.connect(e.pipe(v,e.map(function(t){return t.atBottom})),u),e.connect(e.pipe(u,e.throttleTime(50)),m);var I=e.statefulStream("down");e.connect(e.pipe(o,e.map(function(t){return t.scrollTop}),e.distinctUntilChanged(),e.scan(function(t,n){return e.getValue(g)?{direction:t.direction,prevScrollTop:n}:{direction:n<t.prevScrollTop?st:"down",prevScrollTop:n}},{direction:"down",prevScrollTop:0}),e.map(function(t){return t.direction})),I),e.connect(e.pipe(o,e.throttleTime(50),e.mapTo("none")),I);var C=e.statefulStream(0);return e.connect(e.pipe(h,e.filter(function(t){return!t}),e.mapTo(0)),C),e.connect(e.pipe(r,e.throttleTime(100),e.withLatestFrom(h),e.filter(function(t){return!!t[1]}),e.scan(function(t,e){return[t[1],e[0]]},[0,0]),e.map(function(t){return t[1]-t[0]})),C),{isScrolling:h,isAtTop:c,isAtBottom:u,atBottomState:v,atTopStateChange:d,atBottomStateChange:m,scrollDirection:I,atBottomThreshold:f,atTopThreshold:p,scrollVelocity:C,lastJumpDueToItemResize:S}},e.tup(y)),mt=e.system(function(t){var n=t[0].log,o=e.statefulStream(!1),r=e.streamFromEmitter(e.pipe(o,e.filter(function(t){return t}),e.distinctUntilChanged()));return e.subscribe(o,function(t){t&&e.getValue(n)("props updated",{},h.DEBUG)}),{propsReady:o,didMount:r}},e.tup(S),{singleton:!0}),dt=e.system(function(t){var n=t[0],o=n.sizes,r=n.listRefresh,i=n.defaultItemSize,a=t[1].scrollTop,l=t[2].scrollToIndex,s=t[3].didMount,u=e.statefulStream(!0),c=e.statefulStream(0);return e.connect(e.pipe(s,e.withLatestFrom(c),e.filter(function(t){return!!t[1]}),e.mapTo(!1)),u),e.subscribe(e.pipe(e.combineLatest(r,s),e.withLatestFrom(u,o,i),e.filter(function(t){var e=t[1],n=t[3];return t[0][1]&&(!R(t[2].sizeTree)||void 0!==n)&&!e}),e.withLatestFrom(c)),function(t){var n=t[1];setTimeout(function(){e.handleNext(a,function(){e.publish(u,!0)}),e.publish(l,n)})}),{scrolledToInitialItem:u,initialTopMostItemIndex:c}},e.tup(rt,y,lt,mt),{singleton:!0});function ft(t){return!!t&&("smooth"===t?"smooth":"auto")}var pt=e.system(function(t){var n=t[0],o=n.totalCount,r=n.listRefresh,i=t[1],a=i.isAtBottom,l=i.atBottomState,s=t[2].scrollToIndex,u=t[3].scrolledToInitialItem,c=t[4],m=c.propsReady,d=c.didMount,f=t[5].log,p=t[6].scrollingInProgress,g=e.statefulStream(!1),v=e.stream(),S=null;function I(t){e.publish(s,{index:"LAST",align:"end",behavior:t})}function C(t){var n=e.handleNext(l,function(n){!t||n.atBottom||"SIZE_INCREASED"!==n.notAtBottomBecause||S||(e.getValue(f)("scrolling to bottom due to increased size",{},h.DEBUG),I("auto"))});setTimeout(n,100)}return e.subscribe(e.pipe(e.combineLatest(e.pipe(e.duc(o),e.skip(1)),d),e.withLatestFrom(e.duc(g),a,u,p),e.map(function(t){var e=t[0],n=e[0],o=e[1]&&t[3],r="auto";return o&&(r=function(t,e){return"function"==typeof t?ft(t(e)):e&&ft(t)}(t[1],t[2]||t[4]),o=o&&!!r),{totalCount:n,shouldFollow:o,followOutputBehavior:r}}),e.filter(function(t){return t.shouldFollow})),function(t){var n=t.totalCount,o=t.followOutputBehavior;S&&(S(),S=null),S=e.handleNext(r,function(){e.getValue(f)("following output to ",{totalCount:n},h.DEBUG),I(o),S=null})}),e.subscribe(e.pipe(e.combineLatest(e.duc(g),o,m),e.filter(function(t){return t[0]&&t[2]}),e.scan(function(t,e){var n=e[1];return{refreshed:t.value===n,value:n}},{refreshed:!1,value:0}),e.filter(function(t){return t.refreshed}),e.withLatestFrom(g,o)),function(t){C(!1!==t[1])}),e.subscribe(v,function(){C(!1!==e.getValue(g))}),e.subscribe(e.combineLatest(e.duc(g),l),function(t){var e=t[1];t[0]&&!e.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===e.notAtBottomBecause&&I("auto")}),{followOutput:g,autoscrollToBottom:v}},e.tup(rt,ct,lt,dt,mt,S,y));function ht(t){return t.reduce(function(t,e){return t.groupIndices.push(t.totalCount),t.totalCount+=e+1,t},{totalCount:0,groupIndices:[]})}var gt=e.system(function(t){var n=t[0],o=n.totalCount,r=n.groupIndices,i=n.sizes,a=t[1],l=a.scrollTop,s=a.headerHeight,u=e.stream(),c=e.stream(),m=e.streamFromEmitter(e.pipe(u,e.map(ht)));return e.connect(e.pipe(m,e.map(function(t){return t.totalCount})),o),e.connect(e.pipe(m,e.map(function(t){return t.groupIndices})),r),e.connect(e.pipe(e.combineLatest(l,i,s),e.filter(function(t){return nt(t[1])}),e.map(function(t){return F(t[1].groupOffsetTree,Math.max(t[0]-t[2],0),"v")[0]}),e.distinctUntilChanged(),e.map(function(t){return[t]})),c),{groupCounts:u,topItemsIndexes:c}},e.tup(rt,y));function vt(t,e){return!(!t||t[0]!==e[0]||t[1]!==e[1])}function St(t,e){return!(!t||t.startIndex!==e.startIndex||t.endIndex!==e.endIndex)}function It(t,e,n){return"number"==typeof t?n===st&&"top"===e||"down"===n&&"bottom"===e?t:0:n===st?"top"===e?t.main:t.reverse:"bottom"===e?t.main:t.reverse}function Ct(t,e){return"number"==typeof t?t:t[e]||0}var Tt=e.system(function(t){var n=t[0],o=n.scrollTop,r=n.viewportHeight,i=n.deviation,a=n.headerHeight,l=n.fixedHeaderHeight,s=e.stream(),u=e.statefulStream(0),c=e.statefulStream(0),m=e.statefulStream(0),d=e.statefulStreamFromEmitter(e.pipe(e.combineLatest(e.duc(o),e.duc(r),e.duc(a),e.duc(s,vt),e.duc(m),e.duc(u),e.duc(l),e.duc(i),e.duc(c)),e.map(function(t){var e=t[0],n=t[1],o=t[2],r=t[3],i=r[0],a=r[1],l=t[4],s=t[6],u=t[7],c=t[8],m=e-u,d=t[5]+s,f=Math.max(o-m,0),p="none",h=Ct(c,"top"),g=Ct(c,"bottom");return i-=u,a+=o+s,(i+=o+s)>e+d-h&&(p=st),(a-=u)<e-f+n+g&&(p="down"),"none"!==p?[Math.max(m-o-It(l,"top",p)-h,0),m-f-s+n+It(l,"bottom",p)+g]:null}),e.filter(function(t){return null!=t}),e.distinctUntilChanged(vt)),[0,0]);return{listBoundary:s,overscan:m,topListHeight:u,increaseViewportBy:c,visibleRange:d}},e.tup(y),{singleton:!0}),wt={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function xt(t,e,n){if(0===t.length)return[];if(!nt(e))return t.map(function(t){return c({},t,{index:t.index+n,originalIndex:t.index})});for(var o,r=[],i=W(e.groupOffsetTree,t[0].index,t[t.length-1].index),a=void 0,l=0,s=f(t);!(o=s()).done;){var u=o.value;(!a||a.end<u.index)&&(a=i.shift(),l=e.groupIndices.indexOf(a.start)),r.push(c({},u.index===a.start?{type:"group",index:l}:{index:u.index-(l+1)+n,groupIndex:l},{size:u.size,offset:u.offset,originalIndex:u.index,data:u.data}))}return r}function bt(t,e,n,o,r,i){var a=0,l=0;if(t.length>0){a=t[0].offset;var s=t[t.length-1];l=s.offset+s.size}var u=n-r.lastIndex,c=a,m=r.lastOffset+u*r.lastSize+(u-1)*o-l;return{items:xt(t,r,i),topItems:xt(e,r,i),topListHeight:e.reduce(function(t,e){return e.size+t},0),offsetTop:a,offsetBottom:m,top:c,bottom:l,totalCount:n,firstItemIndex:i}}var yt=e.system(function(t){var n=t[0],o=n.sizes,r=n.totalCount,i=n.data,a=n.firstItemIndex,l=n.gap,s=t[1],u=t[2],m=u.visibleRange,d=u.listBoundary,p=u.topListHeight,h=t[3],g=h.scrolledToInitialItem,v=h.initialTopMostItemIndex,S=t[4].topListHeight,I=t[5],C=t[6].didMount,T=t[7].recalcInProgress,w=e.statefulStream([]),x=e.stream();e.connect(s.topItemsIndexes,w);var b=e.statefulStreamFromEmitter(e.pipe(e.combineLatest(C,T,e.duc(m,vt),e.duc(r),e.duc(o),e.duc(v),g,e.duc(w),e.duc(a),e.duc(l),i),e.filter(function(t){return t[0]&&!t[1]}),e.map(function(t){var n=t[2],o=n[0],r=n[1],i=t[3],a=t[5],l=t[6],s=t[7],u=t[8],m=t[9],d=t[10],p=t[4],h=p.sizeTree,g=p.offsetTree;if(0===i||0===o&&0===r)return c({},wt,{totalCount:i});if(R(h))return bt(function(t,e,n){if(nt(e)){var o=et(t,e);return[{index:F(e.groupOffsetTree,o)[0],size:0,offset:0},{index:o,size:0,offset:0,data:n&&n[0]}]}return[{index:t,size:0,offset:0,data:n&&n[0]}]}(function(t,e){return"number"==typeof t?t:"LAST"===t.index?e-1:t.index}(a,i),p,d),[],i,m,p,u);var v=[];if(s.length>0)for(var S,I=s[0],C=s[s.length-1],T=0,w=f(W(h,I,C));!(S=w()).done;)for(var x=S.value,b=x.value,y=Math.max(x.start,I),H=Math.min(x.end,C),E=y;E<=H;E++)v.push({index:E,size:b,offset:T,data:d&&d[E]}),T+=b;if(!l)return bt([],v,i,m,p,u);var L=s.length>0?s[s.length-1]+1:0,k=function(t,e,n,o){return void 0===o&&(o=0),o>0&&(e=Math.max(e,j(t,o,q).offset)),N((i=n,l=_(r=t,e,a=Z),s=_(r,i,a,l),r.slice(l,s+1)),J);var r,i,a,l,s}(g,o,r,L);if(0===k.length)return null;var z=i-1;return bt(e.tap([],function(t){for(var e,n=f(k);!(e=n()).done;){var i=e.value,a=i.value,l=a.offset,s=i.start,u=a.size;if(a.offset<o){var c=(s+=Math.floor((o-a.offset+m)/(u+m)))-i.start;l+=c*u+c*m}s<L&&(l+=(L-s)*u,s=L);for(var p=Math.min(i.end,z),h=s;h<=p&&!(l>=r);h++)t.push({index:h,size:u,offset:l,data:d&&d[h]}),l+=u+m}}),v,i,m,p,u)}),e.filter(function(t){return null!==t}),e.distinctUntilChanged()),wt);return e.connect(e.pipe(i,e.filter(function(t){return void 0!==t}),e.map(function(t){return t.length})),r),e.connect(e.pipe(b,e.map(function(t){return t.topListHeight})),S),e.connect(S,p),e.connect(e.pipe(b,e.map(function(t){return[t.top,t.bottom]})),d),e.connect(e.pipe(b,e.map(function(t){return t.items})),x),c({listState:b,topItemsIndexes:w,endReached:e.streamFromEmitter(e.pipe(b,e.filter(function(t){return t.items.length>0}),e.withLatestFrom(r,i),e.filter(function(t){var e=t[0].items;return e[e.length-1].originalIndex===t[1]-1}),e.map(function(t){return[t[1]-1,t[2]]}),e.distinctUntilChanged(vt),e.map(function(t){return t[0]}))),startReached:e.streamFromEmitter(e.pipe(b,e.throttleTime(200),e.filter(function(t){var e=t.items;return e.length>0&&e[0].originalIndex===t.topItems.length}),e.map(function(t){return t.items[0].index}),e.distinctUntilChanged())),rangeChanged:e.streamFromEmitter(e.pipe(b,e.filter(function(t){return t.items.length>0}),e.map(function(t){for(var e=t.items,n=0,o=e.length-1;"group"===e[n].type&&n<o;)n++;for(;"group"===e[o].type&&o>n;)o--;return{startIndex:e[n].index,endIndex:e[o].index}}),e.distinctUntilChanged(St))),itemsRendered:x},I)},e.tup(rt,gt,Tt,dt,lt,ct,mt,K),{singleton:!0}),Ht=e.system(function(t){var n=t[0],o=n.sizes,r=n.firstItemIndex,i=n.data,a=n.gap,l=t[1].listState,s=t[2].didMount,u=e.statefulStream(0);return e.connect(e.pipe(s,e.withLatestFrom(u),e.filter(function(t){return 0!==t[1]}),e.withLatestFrom(o,r,a,i),e.map(function(t){var e=t[0][1],n=t[1],o=t[2],r=t[3],i=t[4],a=void 0===i?[]:i,l=0;if(n.groupIndices.length>0)for(var s,u=f(n.groupIndices);!((s=u()).done||s.value-l>=e);)l++;var c=e+l;return bt(Array.from({length:c}).map(function(t,e){return{index:e,size:0,offset:0,data:a[e]}}),[],c,r,n,o)})),l),{initialItemCount:u}},e.tup(rt,yt,mt),{singleton:!0}),Et=e.system(function(t){var n=t[0].scrollVelocity,o=e.statefulStream(!1),r=e.stream(),i=e.statefulStream(!1);return e.connect(e.pipe(n,e.withLatestFrom(i,o,r),e.filter(function(t){return!!t[1]}),e.map(function(t){var e=t[0],n=t[1],o=t[2],r=t[3],i=n.enter;if(o){if((0,n.exit)(e,r))return!1}else if(i(e,r))return!0;return o}),e.distinctUntilChanged()),o),e.subscribe(e.pipe(e.combineLatest(o,n,r),e.withLatestFrom(i)),function(t){var e=t[0],n=t[1];return e[0]&&n&&n.change&&n.change(e[1],e[2])}),{isSeeking:o,scrollSeekConfiguration:i,scrollVelocity:n,scrollSeekRangeChanged:r}},e.tup(ct),{singleton:!0}),Rt=e.system(function(t){var n=t[0].topItemsIndexes,o=e.statefulStream(0);return e.connect(e.pipe(o,e.filter(function(t){return t>0}),e.map(function(t){return Array.from({length:t}).map(function(t,e){return e})})),n),{topItemCount:o}},e.tup(yt)),Lt=e.system(function(t){var n=t[0],o=n.footerHeight,r=n.headerHeight,i=n.fixedHeaderHeight,a=n.fixedFooterHeight,l=t[1].listState,s=e.stream(),u=e.statefulStreamFromEmitter(e.pipe(e.combineLatest(o,a,r,i,l),e.map(function(t){var e=t[4];return t[0]+t[1]+t[2]+t[3]+e.offsetBottom+e.bottom})),0);return e.connect(e.duc(u),s),{totalListHeight:u,totalListHeightChanged:s}},e.tup(y,yt),{singleton:!0});function kt(t){var e,n=!1;return function(){return n||(n=!0,e=t()),e}}var Ft=kt(function(){return/iP(ad|hone|od).+Version\/[\d.]+.*Safari/i.test(navigator.userAgent)}),zt=e.system(function(t){var n=t[0],o=n.scrollBy,r=n.scrollTop,i=n.deviation,a=n.scrollingInProgress,l=t[1],s=l.isScrolling,u=l.isAtBottom,c=l.scrollDirection,m=t[3],d=m.beforeUnshiftWith,f=m.shiftWithOffset,p=m.sizes,g=m.gap,v=t[4].log,S=t[5].recalcInProgress,I=e.streamFromEmitter(e.pipe(t[2].listState,e.withLatestFrom(l.lastJumpDueToItemResize),e.scan(function(t,e){var n=t[1],o=e[0],r=o.items,i=o.totalCount,a=o.bottom+o.offsetBottom,l=0;return t[2]===i&&n.length>0&&r.length>0&&(0===r[0].originalIndex&&0===n[0].originalIndex||0!=(l=a-t[3])&&(l+=e[1])),[l,r,i,a]},[0,[],0,0]),e.filter(function(t){return 0!==t[0]}),e.withLatestFrom(r,c,a,u,v),e.filter(function(t){return!t[3]&&0!==t[1]&&t[2]===st}),e.map(function(t){var e=t[0][0];return(0,t[5])("Upward scrolling compensation",{amount:e},h.DEBUG),e})));function C(t){t>0?(e.publish(o,{top:-t,behavior:"auto"}),e.publish(i,0)):(e.publish(i,0),e.publish(o,{top:-t,behavior:"auto"}))}return e.subscribe(e.pipe(I,e.withLatestFrom(i,s)),function(t){var n=t[0],o=t[1];t[2]&&Ft()?e.publish(i,o-n):C(-n)}),e.subscribe(e.pipe(e.combineLatest(e.statefulStreamFromEmitter(s,!1),i,S),e.filter(function(t){return!t[0]&&!t[2]&&0!==t[1]}),e.map(function(t){return t[1]}),e.throttleTime(1)),C),e.connect(e.pipe(f,e.map(function(t){return{top:-t}})),o),e.subscribe(e.pipe(d,e.withLatestFrom(p,g),e.map(function(t){var e=t[0];return e*t[1].lastSize+e*t[2]})),function(t){e.publish(i,t),requestAnimationFrame(function(){e.publish(o,{top:t}),requestAnimationFrame(function(){e.publish(i,0),e.publish(S,!1)})})}),{deviation:i}},e.tup(y,ct,yt,rt,S,K)),Bt=e.system(function(t){var n=t[0].totalListHeight,o=t[1].didMount,r=t[2].scrollTo,i=e.statefulStream(0);return e.subscribe(e.pipe(o,e.withLatestFrom(i),e.filter(function(t){return 0!==t[1]}),e.map(function(t){return{top:t[1]}})),function(t){e.handleNext(e.pipe(n,e.filter(function(t){return 0!==t})),function(){setTimeout(function(){e.publish(r,t)})})}),{initialScrollTop:i}},e.tup(Lt,mt,y),{singleton:!0}),Pt=e.system(function(t){var n=t[0].viewportHeight,o=t[1].totalListHeight,r=e.statefulStream(!1);return{alignToBottom:r,paddingTopAddition:e.statefulStreamFromEmitter(e.pipe(e.combineLatest(r,n,o),e.filter(function(t){return t[0]}),e.map(function(t){return Math.max(0,t[1]-t[2])}),e.distinctUntilChanged()),0)}},e.tup(y,Lt),{singleton:!0}),Ot=e.system(function(t){var n=t[0],o=n.scrollTo,r=n.scrollContainerState,i=e.stream(),a=e.stream(),l=e.stream(),s=e.statefulStream(!1),u=e.statefulStream(void 0);return e.connect(e.pipe(e.combineLatest(i,a),e.map(function(t){var e=t[0],n=e.viewportHeight,o=e.scrollHeight;return{scrollTop:Math.max(0,e.scrollTop-t[1].offsetTop),scrollHeight:o,viewportHeight:n}})),r),e.connect(e.pipe(o,e.withLatestFrom(a),e.map(function(t){var e=t[0];return c({},e,{top:e.top+t[1].offsetTop})})),l),{useWindowScroll:s,customScrollParent:u,windowScrollContainerState:i,windowViewportRect:a,windowScrollTo:l}},e.tup(y)),Mt=["done","behavior","align"],Vt=e.system(function(t){var n=t[0],o=n.sizes,r=n.totalCount,i=n.gap,a=t[1],l=a.scrollTop,s=a.viewportHeight,u=a.headerHeight,d=a.fixedHeaderHeight,f=a.fixedFooterHeight,p=a.scrollingInProgress,h=t[2].scrollToIndex,g=e.stream();return e.connect(e.pipe(g,e.withLatestFrom(o,s,r,u,d,f,l),e.withLatestFrom(i),e.map(function(t){var n=t[0],o=n[0],r=n[1],i=n[2],a=n[3],l=n[4],s=n[5],u=n[6],d=n[7],f=t[1],h=o.done,g=o.behavior,v=o.align,S=m(o,Mt),I=null,C=tt(o,r,a-1),T=X(C,r.offsetTree,f)+l+s;return T<d+s?I=c({},S,{behavior:g,align:null!=v?v:"start"}):T+F(r.sizeTree,C)[1]>d+i-u&&(I=c({},S,{behavior:g,align:null!=v?v:"end"})),I?h&&e.handleNext(e.pipe(p,e.skip(1),e.filter(function(t){return!1===t})),h):h&&h(),I}),e.filter(function(t){return null!==t})),h),{scrollIntoView:g}},e.tup(rt,y,lt,yt,S),{singleton:!0}),Ut=["listState","topItemsIndexes"],At=e.system(function(t){return c({},t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},e.tup(Tt,Ht,mt,Et,Lt,Bt,Pt,Ot,Vt)),Wt=e.system(function(t){var n=t[0],o=n.totalCount,r=n.sizeRanges,i=n.fixedItemSize,a=n.defaultItemSize,l=n.trackItemSizes,s=n.itemSize,u=n.data,d=n.firstItemIndex,f=n.groupIndices,p=n.statefulTotalCount,h=n.gap,g=t[1],v=g.initialTopMostItemIndex,S=g.scrolledToInitialItem,I=t[2],C=t[3],T=t[4],w=T.listState,x=T.topItemsIndexes,b=m(T,Ut),y=t[5].scrollToIndex,H=t[7].topItemCount,E=t[8].groupCounts,R=t[9],L=t[10];return e.connect(b.rangeChanged,R.scrollSeekRangeChanged),e.connect(e.pipe(R.windowViewportRect,e.map(function(t){return t.visibleHeight})),I.viewportHeight),c({totalCount:o,data:u,firstItemIndex:d,sizeRanges:r,initialTopMostItemIndex:v,scrolledToInitialItem:S,topItemsIndexes:x,topItemCount:H,groupCounts:E,fixedItemHeight:i,defaultItemHeight:a,gap:h},C,{statefulTotalCount:p,listState:w,scrollToIndex:y,trackItemSizes:l,itemSize:s,groupIndices:f},b,R,I,L)},e.tup(rt,dt,y,pt,yt,lt,zt,Rt,gt,At,S)),Nt=kt(function(){if("undefined"==typeof document)return"sticky";var t=document.createElement("div");return t.style.position="-webkit-sticky","-webkit-sticky"===t.style.position?"-webkit-sticky":"sticky"});function Dt(t,e){var n=i(null),o=a(function(o){if(null!==o&&o.offsetParent){var r,i,a=o.getBoundingClientRect(),l=a.width;if(e){var s=e.getBoundingClientRect(),u=a.top-s.top;r=s.height-Math.max(0,u),i=u+e.scrollTop}else r=window.innerHeight-Math.max(0,a.top),i=a.top+window.pageYOffset;n.current={offsetTop:i,visibleHeight:r,visibleWidth:l},t(n.current)}},[t,e]),l=I(o),s=l.callbackRef,u=l.ref,c=a(function(){o(u.current)},[o,u]);return r(function(){if(e){e.addEventListener("scroll",c);var t=new ResizeObserver(c);return t.observe(e),function(){e.removeEventListener("scroll",c),t.unobserve(e)}}return window.addEventListener("scroll",c),window.addEventListener("resize",c),function(){window.removeEventListener("scroll",c),window.removeEventListener("resize",c)}},[c,e]),s}var Gt=n.createContext(void 0),_t=["placeholder"],jt=["style","children"],Kt=["style","children"];function Yt(t){return t}var qt=e.system(function(){var t=e.statefulStream(function(t){return"Item "+t}),n=e.statefulStream(null),o=e.statefulStream(function(t){return"Group "+t}),r=e.statefulStream({}),i=e.statefulStream(Yt),a=e.statefulStream("div"),l=e.statefulStream(e.noop),s=function(t,n){return void 0===n&&(n=null),e.statefulStreamFromEmitter(e.pipe(r,e.map(function(e){return e[t]}),e.distinctUntilChanged()),n)};return{context:n,itemContent:t,groupContent:o,components:r,computeItemKey:i,headerFooterTag:a,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")}});function Zt(t,n){var o=e.stream();return e.subscribe(o,function(){return console.warn("react-virtuoso: You are using a deprecated property. "+n,"color: red;","color: inherit;","color: blue;")}),e.connect(o,t),o}var Jt=e.system(function(t){var n=t[0],o=t[1],r={item:Zt(o.itemContent,"Rename the %citem%c prop to %citemContent."),group:Zt(o.groupContent,"Rename the %cgroup%c prop to %cgroupContent."),topItems:Zt(n.topItemCount,"Rename the %ctopItems%c prop to %ctopItemCount."),itemHeight:Zt(n.fixedItemHeight,"Rename the %citemHeight%c prop to %cfixedItemHeight."),scrollingStateChange:Zt(n.isScrolling,"Rename the %cscrollingStateChange%c prop to %cisScrolling."),adjustForPrependedItems:e.stream(),maxHeightCacheSize:e.stream(),footer:e.stream(),header:e.stream(),HeaderContainer:e.stream(),FooterContainer:e.stream(),ItemContainer:e.stream(),ScrollContainer:e.stream(),GroupContainer:e.stream(),ListContainer:e.stream(),emptyComponent:e.stream(),scrollSeek:e.stream()};function i(t,n,r){e.connect(e.pipe(t,e.withLatestFrom(o.components),e.map(function(t){var e,o=t[0],i=t[1];return console.warn("react-virtuoso: "+r+" property is deprecated. Pass components."+n+" instead."),c({},i,((e={})[n]=o,e))})),o.components)}return e.subscribe(r.adjustForPrependedItems,function(){console.warn("react-virtuoso: adjustForPrependedItems is no longer supported. Use the firstItemIndex property instead - https://virtuoso.dev/prepend-items.","color: red;","color: inherit;","color: blue;")}),e.subscribe(r.maxHeightCacheSize,function(){console.warn("react-virtuoso: maxHeightCacheSize is no longer necessary. Setting it has no effect - remove it from your code.")}),e.subscribe(r.HeaderContainer,function(){console.warn("react-virtuoso: HeaderContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the header component and pass components.Header to change its contents.")}),e.subscribe(r.FooterContainer,function(){console.warn("react-virtuoso: FooterContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the footer component and pass components.Footer to change its contents.")}),e.subscribe(r.scrollSeek,function(t){var r=t.placeholder,i=m(t,_t);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),e.publish(o.components,c({},e.getValue(o.components),{ScrollSeekPlaceholder:r})),e.publish(n.scrollSeekConfiguration,i)}),i(r.footer,"Footer","footer"),i(r.header,"Header","header"),i(r.ItemContainer,"Item","ItemContainer"),i(r.ListContainer,"List","ListContainer"),i(r.ScrollContainer,"Scroller","ScrollContainer"),i(r.emptyComponent,"EmptyPlaceholder","emptyComponent"),i(r.GroupContainer,"Group","GroupContainer"),c({},n,o,r)},e.tup(Wt,qt)),$t=function(t){return n.createElement("div",{style:{height:t.height}})},Qt={position:Nt(),zIndex:1,overflowAnchor:"none"},Xt={overflowAnchor:"none"},te=n.memo(function(t){var o=t.showTopList,r=void 0!==o&&o,i=he("listState"),a=pe("sizeRanges"),s=he("useWindowScroll"),u=he("customScrollParent"),m=pe("windowScrollContainerState"),d=pe("scrollContainerState"),f=u||s?m:d,p=he("itemContent"),h=he("context"),g=he("groupContent"),v=he("trackItemSizes"),S=he("itemSize"),I=he("log"),C=pe("gap"),w=T(a,S,v,r?e.noop:f,I,C,u).callbackRef,x=n.useState(0),b=x[0],y=x[1];ge("deviation",function(t){b!==t&&y(t)});var H=he("EmptyPlaceholder"),E=he("ScrollSeekPlaceholder")||$t,R=he("ListComponent"),L=he("ItemComponent"),k=he("GroupComponent"),F=he("computeItemKey"),z=he("isSeeking"),B=he("groupIndices").length>0,P=he("paddingTopAddition"),O=r?{}:{boxSizing:"border-box",paddingTop:i.offsetTop+P,paddingBottom:i.offsetBottom,marginTop:b};return!r&&0===i.totalCount&&H?l(H,re(H,h)):l(R,c({},re(R,h),{ref:w,style:O,"data-test-id":r?"virtuoso-top-item-list":"virtuoso-item-list"}),(r?i.topItems:i.items).map(function(t){var e=t.originalIndex,n=F(e+i.firstItemIndex,t.data,h);return z?l(E,c({},re(E,h),{key:n,index:t.index,height:t.size,type:t.type||"item"},"group"===t.type?{}:{groupIndex:t.groupIndex})):"group"===t.type?l(k,c({},re(k,h),{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,style:Qt}),g(t.index)):l(L,c({},re(L,h),{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,"data-item-group-index":t.groupIndex,style:Xt}),B?p(t.index,t.groupIndex,t.data,h):p(t.index,t.data,h))}))}),ee={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},ne={width:"100%",height:"100%",position:"absolute",top:0},oe={width:"100%",position:Nt(),top:0};function re(t,e){if("string"!=typeof t)return{context:e}}var ie=n.memo(function(){var t=he("HeaderComponent"),e=pe("headerHeight"),n=he("headerFooterTag"),o=C(function(t){return e(w(t,"height"))}),r=he("context");return t?l(n,{ref:o},l(t,re(t,r))):null}),ae=n.memo(function(){var t=he("FooterComponent"),e=pe("footerHeight"),n=he("headerFooterTag"),o=C(function(t){return e(w(t,"height"))}),r=he("context");return t?l(n,{ref:o},l(t,re(t,r))):null});function le(t){var e=t.usePublisher,o=t.useEmitter,r=t.useEmitterValue;return n.memo(function(t){var n=t.style,i=t.children,a=m(t,jt),s=e("scrollContainerState"),u=r("ScrollerComponent"),d=e("smoothScrollTargetReached"),f=r("scrollerRef"),p=r("context"),h=b(s,d,u,f),g=h.scrollerRef,v=h.scrollByCallback;return o("scrollTo",h.scrollToCallback),o("scrollBy",v),l(u,c({ref:g,style:c({},ee,n),"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0},a,re(u,p)),i)})}function se(t){var o=t.usePublisher,r=t.useEmitter,i=t.useEmitterValue;return n.memo(function(t){var n=t.style,a=t.children,s=m(t,Kt),u=o("windowScrollContainerState"),d=i("ScrollerComponent"),f=o("smoothScrollTargetReached"),p=i("totalListHeight"),h=i("deviation"),v=i("customScrollParent"),S=i("context"),I=b(u,f,d,e.noop,v),C=I.scrollerRef,T=I.scrollByCallback,w=I.scrollToCallback;return g(function(){return C.current=v||window,function(){C.current=null}},[C,v]),r("windowScrollTo",w),r("scrollBy",T),l(d,c({style:c({position:"relative"},n,0!==p?{height:p+h}:{}),"data-virtuoso-scroller":!0},s,re(d,S)),a)})}var ue=function(t){var o=t.children,r=s(Gt),i=pe("viewportHeight"),a=pe("fixedItemHeight"),l=C(e.compose(i,function(t){return w(t,"height")}));return n.useEffect(function(){r&&(i(r.viewportHeight),a(r.itemHeight))},[r,i,a]),n.createElement("div",{style:ne,ref:l,"data-viewport-type":"element"},o)},ce=function(t){var e=t.children,o=s(Gt),r=pe("windowViewportRect"),i=pe("fixedItemHeight"),a=he("customScrollParent"),l=Dt(r,a);return n.useEffect(function(){o&&(i(o.itemHeight),r({offsetTop:0,visibleHeight:o.viewportHeight,visibleWidth:100}))},[o,r,i]),n.createElement("div",{ref:l,style:ne,"data-viewport-type":"window"},e)},me=function(t){var e=t.children,n=he("TopItemListComponent"),o=he("headerHeight"),r=c({},oe,{marginTop:o+"px"}),i=he("context");return l(n||"div",{style:r,context:i},e)},de=t(Jt,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",groupContent:"groupContent",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",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",react18ConcurrentRendering:"react18ConcurrentRendering",item:"item",group:"group",topItems:"topItems",itemHeight:"itemHeight",scrollingStateChange:"scrollingStateChange",maxHeightCacheSize:"maxHeightCacheSize",footer:"footer",header:"header",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",GroupContainer:"GroupContainer",emptyComponent:"emptyComponent",HeaderContainer:"HeaderContainer",FooterContainer:"FooterContainer",scrollSeek:"scrollSeek"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",adjustForPrependedItems:"adjustForPrependedItems",autoscrollToBottom:"autoscrollToBottom"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},n.memo(function(t){var e=he("useWindowScroll"),o=he("topItemsIndexes").length>0,r=he("customScrollParent"),i=r||e?ce:ue;return n.createElement(r||e?Se:ve,c({},t),n.createElement(i,null,n.createElement(ie,null),n.createElement(te,null),n.createElement(ae,null)),o&&n.createElement(me,null,n.createElement(te,{showTopList:!0})))})),fe=de.Component,pe=de.usePublisher,he=de.useEmitterValue,ge=de.useEmitter,ve=le({usePublisher:pe,useEmitterValue:he,useEmitter:ge}),Se=se({usePublisher:pe,useEmitterValue:he,useEmitter:ge}),Ie={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Ce={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Te=Math.round,we=Math.ceil,xe=Math.floor,be=Math.min,ye=Math.max;function He(t,e){return Array.from({length:e-t+1}).map(function(e,n){return{index:n+t}})}function Ee(t,e){return t&&t.column===e.column&&t.row===e.row}var Re=e.system(function(t){var n=t[0],o=n.overscan,r=n.visibleRange,i=n.listBoundary,a=t[1],l=a.scrollTop,s=a.viewportHeight,u=a.scrollBy,m=a.scrollTo,d=a.smoothScrollTargetReached,f=a.scrollContainerState,p=t[2],h=t[3],g=t[4],v=g.propsReady,S=g.didMount,I=t[5],C=I.windowViewportRect,T=I.windowScrollTo,w=I.useWindowScroll,x=I.customScrollParent,b=I.windowScrollContainerState,y=t[6],H=e.statefulStream(0),E=e.statefulStream(0),R=e.statefulStream(Ie),L=e.statefulStream({height:0,width:0}),k=e.statefulStream({height:0,width:0}),F=e.stream(),z=e.stream(),B=e.statefulStream(0),P=e.statefulStream({row:0,column:0});e.connect(e.pipe(S,e.withLatestFrom(E),e.filter(function(t){return 0!==t[1]}),e.map(function(t){return{items:He(0,t[1]-1),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0}})),R),e.connect(e.pipe(e.combineLatest(e.duc(H),r,e.duc(P,Ee),e.duc(k,function(t,e){return t&&t.width===e.width&&t.height===e.height})),e.withLatestFrom(L),e.map(function(t){var e=t[0],n=e[0],o=e[1],r=o[0],i=o[1],a=e[2],l=e[3],s=t[1],u=a.row,c=l.height,m=l.width,d=s.width;if(0===n||0===d)return Ie;if(0===m)return Ce;var f=Fe(d,m,a.column),p=f*xe((r+u)/(c+u)),h=f*we((i+u)/(c+u))-1;h=ye(0,be(n-1,h));var g=He(p=be(h,ye(0,p)),h),v=Le(s,a,l,g),S=v.top,I=v.bottom,C=we(n/f);return{items:g,offsetTop:S,offsetBottom:C*c+(C-1)*u-I,top:S,bottom:I,itemHeight:c,itemWidth:m}})),R),e.connect(e.pipe(L,e.map(function(t){return t.height})),s),e.connect(e.pipe(e.combineLatest(L,k,R,P),e.map(function(t){var e=Le(t[0],t[3],t[1],t[2].items);return[e.top,e.bottom]}),e.distinctUntilChanged(vt)),i);var O=e.streamFromEmitter(e.pipe(e.duc(R),e.filter(function(t){return t.items.length>0}),e.withLatestFrom(H),e.filter(function(t){var e=t[0].items;return e[e.length-1].index===t[1]-1}),e.map(function(t){return t[1]-1}),e.distinctUntilChanged())),M=e.streamFromEmitter(e.pipe(e.duc(R),e.filter(function(t){var e=t.items;return e.length>0&&0===e[0].index}),e.mapTo(0),e.distinctUntilChanged())),V=e.streamFromEmitter(e.pipe(e.duc(R),e.filter(function(t){return t.items.length>0}),e.map(function(t){var e=t.items;return{startIndex:e[0].index,endIndex:e[e.length-1].index}}),e.distinctUntilChanged(St)));e.connect(V,h.scrollSeekRangeChanged),e.connect(e.pipe(F,e.withLatestFrom(L,k,H,P),e.map(function(t){var e=t[1],n=t[2],o=t[3],r=t[4],i=at(t[0]),a=i.align,l=i.behavior,s=i.offset,u=i.index;"LAST"===u&&(u=o-1);var c=ke(e,r,n,u=ye(0,u,be(o-1,u)));return"end"===a?c=Te(c-e.height+n.height):"center"===a&&(c=Te(c-e.height/2+n.height/2)),s&&(c+=s),{top:c,behavior:l}})),m);var U=e.statefulStreamFromEmitter(e.pipe(R,e.map(function(t){return t.offsetBottom+t.bottom})),0);return e.connect(e.pipe(C,e.map(function(t){return{width:t.visibleWidth,height:t.visibleHeight}})),L),c({totalCount:H,viewportDimensions:L,itemDimensions:k,scrollTop:l,scrollHeight:z,overscan:o,scrollBy:u,scrollTo:m,scrollToIndex:F,smoothScrollTargetReached:d,windowViewportRect:C,windowScrollTo:T,useWindowScroll:w,customScrollParent:x,windowScrollContainerState:b,deviation:B,scrollContainerState:f,initialItemCount:E,gap:P},h,{gridState:R,totalListHeight:U},p,{startReached:M,endReached:O,rangeChanged:V,propsReady:v},y)},e.tup(Tt,y,ct,Et,mt,Ot,S));function Le(t,e,n,o){var r=n.height;return void 0===r||0===o.length?{top:0,bottom:0}:{top:ke(t,e,n,o[0].index),bottom:ke(t,e,n,o[o.length-1].index)+r}}function ke(t,e,n,o){var r=Fe(t.width,n.width,e.column),i=xe(o/r),a=i*n.height+ye(0,i-1)*e.row;return a>0?a+e.row:a}function Fe(t,e,n){return ye(1,xe((t+n)/(e+n)))}var ze=["placeholder"],Be=e.system(function(){var t=e.statefulStream(function(t){return"Item "+t}),n=e.statefulStream({}),o=e.statefulStream(null),r=e.statefulStream("virtuoso-grid-item"),i=e.statefulStream("virtuoso-grid-list"),a=e.statefulStream(Yt),l=e.statefulStream(e.noop),s=function(t,o){return void 0===o&&(o=null),e.statefulStreamFromEmitter(e.pipe(n,e.map(function(e){return e[t]}),e.distinctUntilChanged()),o)};return{context:o,itemContent:t,components:n,computeItemKey:a,itemClassName:r,listClassName:i,scrollerRef:l,ListComponent:s("List","div"),ItemComponent:s("Item","div"),ScrollerComponent:s("Scroller","div"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder","div")}}),Pe=e.system(function(t){var n=t[0],o=t[1],r={item:Zt(o.itemContent,"Rename the %citem%c prop to %citemContent."),ItemContainer:e.stream(),ScrollContainer:e.stream(),ListContainer:e.stream(),emptyComponent:e.stream(),scrollSeek:e.stream()};function i(t,n,r){e.connect(e.pipe(t,e.withLatestFrom(o.components),e.map(function(t){var e,o=t[0],i=t[1];return console.warn("react-virtuoso: "+r+" property is deprecated. Pass components."+n+" instead."),c({},i,((e={})[n]=o,e))})),o.components)}return e.subscribe(r.scrollSeek,function(t){var r=t.placeholder,i=m(t,ze);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),e.publish(o.components,c({},e.getValue(o.components),{ScrollSeekPlaceholder:r})),e.publish(n.scrollSeekConfiguration,i)}),i(r.ItemContainer,"Item","ItemContainer"),i(r.ListContainer,"List","ListContainer"),i(r.ScrollContainer,"Scroller","ScrollContainer"),c({},n,o,r)},e.tup(Re,Be)),Oe=n.memo(function(){var t=Ne("gridState"),e=Ne("listClassName"),n=Ne("itemClassName"),o=Ne("itemContent"),r=Ne("computeItemKey"),i=Ne("isSeeking"),a=We("scrollHeight"),s=Ne("ItemComponent"),u=Ne("ListComponent"),m=Ne("ScrollSeekPlaceholder"),d=Ne("context"),f=We("itemDimensions"),p=We("gap"),h=Ne("log"),g=C(function(t){a(t.parentElement.parentElement.scrollHeight);var e=t.firstChild;e&&f(e.getBoundingClientRect()),p({row:je("row-gap",getComputedStyle(t).rowGap,h),column:je("column-gap",getComputedStyle(t).columnGap,h)})});return l(u,c({ref:g,className:e},re(u,d),{style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom}}),t.items.map(function(e){var a=r(e.index);return i?l(m,c({key:a},re(m,d),{index:e.index,height:t.itemHeight,width:t.itemWidth})):l(s,c({},re(s,d),{className:n,"data-index":e.index,key:a}),o(e.index,d))}))}),Me=function(t){var e=t.children,o=We("viewportDimensions"),r=C(function(t){o(t.getBoundingClientRect())});return n.createElement("div",{style:ne,ref:r},e)},Ve=function(t){var e=t.children,o=Dt(We("windowViewportRect"),Ne("customScrollParent"));return n.createElement("div",{ref:o,style:ne},e)},Ue=t(Pe,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",item:"item",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",scrollSeek:"scrollSeek"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange"}},n.memo(function(t){var e=c({},t),o=Ne("useWindowScroll"),r=Ne("customScrollParent"),i=r||o?Ve:Me;return n.createElement(r||o?_e:Ge,c({},e),n.createElement(i,null,n.createElement(Oe,null)))})),Ae=Ue.Component,We=Ue.usePublisher,Ne=Ue.useEmitterValue,De=Ue.useEmitter,Ge=le({usePublisher:We,useEmitterValue:Ne,useEmitter:De}),_e=se({usePublisher:We,useEmitterValue:Ne,useEmitter:De});function je(t,e,n){return"normal"===e||null!=e&&e.endsWith("px")||n(t+" was not resolved to pixel value correctly",e,h.WARN),"normal"===e?0:parseInt(null!=e?e:"0",10)}var Ke=e.system(function(){var t=e.statefulStream(function(t){return n.createElement("td",null,"Item $",t)}),o=e.statefulStream(null),r=e.statefulStream(null),i=e.statefulStream(null),a=e.statefulStream({}),l=e.statefulStream(Yt),s=e.statefulStream(e.noop),u=function(t,n){return void 0===n&&(n=null),e.statefulStreamFromEmitter(e.pipe(a,e.map(function(e){return e[t]}),e.distinctUntilChanged()),n)};return{context:o,itemContent:t,fixedHeaderContent:r,fixedFooterContent:i,components:a,computeItemKey:l,scrollerRef:s,TableComponent:u("Table","table"),TableHeadComponent:u("TableHead","thead"),TableFooterComponent:u("TableFoot","tfoot"),TableBodyComponent:u("TableBody","tbody"),TableRowComponent:u("TableRow","tr"),ScrollerComponent:u("Scroller","div"),EmptyPlaceholder:u("EmptyPlaceholder"),ScrollSeekPlaceholder:u("ScrollSeekPlaceholder"),FillerRow:u("FillerRow")}}),Ye=e.system(function(t){return c({},t[0],t[1])},e.tup(Wt,Ke)),qe=function(t){return n.createElement("tr",null,n.createElement("td",{style:{height:t.height}}))},Ze=function(t){return n.createElement("tr",null,n.createElement("td",{style:{height:t.height,padding:0,border:0}}))},Je=n.memo(function(){var t=nn("listState"),e=en("sizeRanges"),o=nn("useWindowScroll"),r=nn("customScrollParent"),i=en("windowScrollContainerState"),a=en("scrollContainerState"),s=r||o?i:a,u=nn("itemContent"),m=nn("trackItemSizes"),d=T(e,nn("itemSize"),m,s,nn("log"),void 0,r),f=d.callbackRef,p=d.ref,h=n.useState(0),g=h[0],v=h[1];on("deviation",function(t){g!==t&&(p.current.style.marginTop=t+"px",v(t))});var S=nn("EmptyPlaceholder"),I=nn("ScrollSeekPlaceholder")||qe,C=nn("FillerRow")||Ze,w=nn("TableBodyComponent"),x=nn("TableRowComponent"),b=nn("computeItemKey"),y=nn("isSeeking"),H=nn("paddingTopAddition"),E=nn("firstItemIndex"),R=nn("statefulTotalCount"),L=nn("context");if(0===R&&S)return l(S,re(S,L));var k=t.offsetTop+H+g,F=t.offsetBottom,z=k>0?n.createElement(C,{height:k,key:"padding-top"}):null,B=F>0?n.createElement(C,{height:F,key:"padding-bottom"}):null,P=t.items.map(function(t){var e=t.originalIndex,n=b(e+E,t.data,L);return y?l(I,c({},re(I,L),{key:n,index:t.index,height:t.size,type:t.type||"item"})):l(x,c({},re(x,L),{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,style:{overflowAnchor:"none"}}),u(t.index,t.data,L))});return l(w,c({ref:f,"data-test-id":"virtuoso-item-list"},re(w,L)),[z].concat(P,[B]))}),$e=function(t){var o=t.children,r=s(Gt),i=en("viewportHeight"),a=en("fixedItemHeight"),l=C(e.compose(i,function(t){return w(t,"height")}));return n.useEffect(function(){r&&(i(r.viewportHeight),a(r.itemHeight))},[r,i,a]),n.createElement("div",{style:ne,ref:l,"data-viewport-type":"element"},o)},Qe=function(t){var e=t.children,o=s(Gt),r=en("windowViewportRect"),i=en("fixedItemHeight"),a=nn("customScrollParent"),l=Dt(r,a);return n.useEffect(function(){o&&(i(o.itemHeight),r({offsetTop:0,visibleHeight:o.viewportHeight,visibleWidth:100}))},[o,r,i]),n.createElement("div",{ref:l,style:ne,"data-viewport-type":"window"},e)},Xe=t(Ye,{required:{},optional:{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",react18ConcurrentRendering:"react18ConcurrentRendering"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},n.memo(function(t){var o=nn("useWindowScroll"),r=nn("customScrollParent"),i=en("fixedHeaderHeight"),a=en("fixedFooterHeight"),l=nn("fixedHeaderContent"),s=nn("fixedFooterContent"),u=nn("context"),m=C(e.compose(i,function(t){return w(t,"height")})),d=C(e.compose(a,function(t){return w(t,"height")})),f=r||o?an:rn,p=r||o?Qe:$e,h=nn("TableComponent"),g=nn("TableHeadComponent"),v=nn("TableFooterComponent"),S=l?n.createElement(g,c({key:"TableHead",style:{zIndex:1,position:"sticky",top:0},ref:m},re(g,u)),l()):null,I=s?n.createElement(v,c({key:"TableFoot",style:{zIndex:1,position:"sticky",bottom:0},ref:d},re(v,u)),s()):null;return n.createElement(f,c({},t),n.createElement(p,null,n.createElement(h,c({style:{borderSpacing:0}},re(h,u)),[S,n.createElement(Je,{key:"TableBody"}),I])))})),tn=Xe.Component,en=Xe.usePublisher,nn=Xe.useEmitterValue,on=Xe.useEmitter,rn=le({usePublisher:en,useEmitterValue:nn,useEmitter:on}),an=se({usePublisher:en,useEmitterValue:nn,useEmitter:on}),ln=fe,sn=fe,un=tn,cn=Ae;export{sn as GroupedVirtuoso,h as LogLevel,un as TableVirtuoso,ln as Virtuoso,cn as VirtuosoGrid,Gt as VirtuosoMockContext}; | ||
//# sourceMappingURL=index.m.js.map |
@@ -5,3 +5,3 @@ { | ||
"sideEffects": false, | ||
"version": "2.19.0", | ||
"version": "2.19.1", | ||
"homepage": "https://virtuoso.dev/", | ||
@@ -8,0 +8,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
666473