Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-virtuoso

Package Overview
Dependencies
Maintainers
1
Versions
288
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-virtuoso - npm Package Compare versions

Comparing version 0.8.2 to 0.9.0

2

dist/react-virtuoso.cjs.production.min.js

@@ -1,2 +0,2 @@

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("react"),n=e(t),r=e(require("resize-observer-polyfill"));function i(){return(i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function o(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e,t,n){return(u=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&a(i,n.prototype),i}).apply(null,arguments)}function l(e){var t="function"==typeof Map?new Map:void 0;return(l=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return u(e,arguments,s(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),a(n,e)})(e)}var f=t.createContext(void 0);function c(e){return function(){var t=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e,t){return t(e)}:1===t.length?t[0]:function(e,n){var r=function(e){return n(e)};t.slice().reverse().forEach(function(e){var t=r;r=function(n){return e(n,t)}}),r(e)}}.apply(void 0,arguments);return function(e,t){var n=function(n){return e(function(e){return t(e,n)})};return{subscribe:n,pipe:c(n)}}(e,t)}}function h(e,t){void 0===t&&(t=!0);var n=[],r=e,i=function(e){return n.push(e),void 0!==r&&e(r),function(){n=n.filter(function(t){return t!==e})}};return{next:function(e){t&&e===r||(r=e,n.forEach(function(t){return t(e)}))},subscribe:i,pipe:c(i),subscribers:n}}function p(){var e=[],t=function(t){return e.push(t),function(){e=e.filter(function(e){return e!==t})}};return{next:function(t){e.forEach(function(e){return e(t)})},subscribe:t,pipe:c(t)}}function v(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=Array(t.length).fill(!1),i=Array(t.length),o=[],s=function(e){r.every(function(e){return e})&&e.forEach(function(e){return e(i)})};t.forEach(function(e,t){e.subscribe(function(e){r[t]=!0,i[t]=e,s(o)})});var a=function(e){return o.push(e),s([e]),function(){o=o.filter(function(t){return t!==e})}};return{subscribe:a,pipe:c(a)}}function d(e){return function(t,n){n(e(t))}}function g(e){return function(t,n){return n(e)}}function y(e){return function(t,n){e>0?e--:n(t)}}function m(e){return function(t,n){e(t)&&n(t)}}function x(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=Array(t.length).fill(!1),i=Array(t.length);return t.forEach(function(e,t){e.subscribe(function(e){i[t]=e,r[t]=!0})}),function(e,t){r.every(function(e){return e})&&t([e].concat(i))}}var b=new(function(){function e(){this.level=0}var t=e.prototype;return t.rebalance=function(){return this},t.adjust=function(){return this},t.remove=function(){return this},t.find=function(){},t.findWith=function(){},t.findMax=function(){return-Infinity},t.findMaxValue=function(){},t.insert=function(e,t){return new w({key:e,value:t,level:1})},t.walkWithin=function(){return[]},t.walk=function(){return[]},t.ranges=function(){return[]},t.rangesWithin=function(){return[]},t.empty=function(){return!0},t.isSingle=function(){return!0},t.isInvariant=function(){return!0},t.keys=function(){return[]},e}());Object.freeze(b);var k=function(e){function t(t){return e.call(this,"Unreachable case: "+t)||this}return o(t,e),t}(l(Error)),w=function(){function e(e){var t=e.value,n=e.level,r=e.left,i=void 0===r?b:r,o=e.right,s=void 0===o?b:o;this.key=e.key,this.value=t,this.level=n,this.left=i,this.right=s}var t=e.prototype;return t.remove=function(e){var t=this.left,n=this.right;if(e===this.key){if(t.empty())return n;if(n.empty())return t;var r=t.last();return this.clone({key:r[0],value:r[1],left:t.deleteLast()}).adjust()}return e<this.key?this.clone({left:t.remove(e)}).adjust():this.clone({right:n.remove(e)}).adjust()},t.empty=function(){return!1},t.find=function(e){return e===this.key?this.value:e<this.key?this.left.find(e):this.right.find(e)},t.findWith=function(e){var t=e(this.value);switch(t){case-1:return this.left.findWith(e);case 0:return[this.key,this.value];case 1:return this.right.findWith(e);default:throw new k(t)}},t.findMax=function(e){if(this.key===e)return e;if(this.key<e){var t=this.right.findMax(e);return-Infinity===t?this.key:t}return this.left.findMax(e)},t.findMaxValue=function(e){if(this.key===e)return this.value;if(this.key<e){var t=this.right.findMaxValue(e);return void 0===t?this.value:t}return this.left.findMaxValue(e)},t.insert=function(e,t){return e===this.key?this.clone({key:e,value:t}):e<this.key?this.clone({left:this.left.insert(e,t)}).rebalance():this.clone({right:this.right.insert(e,t)}).rebalance()},t.walkWithin=function(e,t){var n=this.key,r=this.value,i=[];return n>e&&(i=i.concat(this.left.walkWithin(e,t))),n>=e&&n<=t&&i.push({key:n,value:r}),n<=t&&(i=i.concat(this.right.walkWithin(e,t))),i},t.walk=function(){return[].concat(this.left.walk(),[{key:this.key,value:this.value}],this.right.walk())},t.last=function(){return this.right.empty()?[this.key,this.value]:this.right.last()},t.deleteLast=function(){return this.right.empty()?this.left:this.clone({right:this.right.deleteLast()}).adjust()},t.clone=function(t){return new e({key:void 0!==t.key?t.key:this.key,value:void 0!==t.value?t.value:this.value,level:void 0!==t.level?t.level:this.level,left:void 0!==t.left?t.left:this.left,right:void 0!==t.right?t.right:this.right})},t.isSingle=function(){return this.level>this.right.level},t.rebalance=function(){return this.skew().split()},t.adjust=function(){var e=this.left,t=this.right,n=this.level;if(t.level>=n-1&&e.level>=n-1)return this;if(n>t.level+1){if(e.isSingle())return this.clone({level:n-1}).skew();if(e.empty()||e.right.empty())throw new Error("Unexpected empty nodes");return e.right.clone({left:e.clone({right:e.right.left}),right:this.clone({left:e.right.right,level:n-1}),level:n})}if(this.isSingle())return this.clone({level:n-1}).split();if(t.empty()||t.left.empty())throw new Error("Unexpected empty nodes");var r=t.left,i=r.isSingle()?t.level-1:t.level;return r.clone({left:this.clone({right:r.left,level:n-1}),right:t.clone({left:r.right,level:i}).split(),level:r.level+1})},t.isInvariant=function(){var e=this.left,t=this.right,n=this.level;return n===e.level+1&&(n===t.level||n===t.level+1)&&!(!t.empty()&&n<=t.right.level)&&e.isInvariant()&&t.isInvariant()},t.keys=function(){return[].concat(this.left.keys(),[this.key],this.right.keys())},t.ranges=function(){return this.toRanges(this.walk())},t.rangesWithin=function(e,t){return this.toRanges(this.walkWithin(e,t))},t.toRanges=function(e){if(0===e.length)return[];for(var t=e[0],n=t.key,r=t.value,i=[],o=1;o<=e.length;o++){var s=e[o];i.push({start:n,end:s?s.key-1:Infinity,value:r}),s&&(n=s.key,r=s.value)}return i},t.split=function(){var e=this.right,t=this.level;return e.empty()||e.right.empty()||e.level!=t||e.right.level!=t?this:e.clone({left:this.clone({right:e.left}),level:t+1})},t.skew=function(){var e=this.left;return e.empty()||e.level!==this.level?this:e.clone({right:this.clone({left:e.right})})},e}(),C=function(){function e(e){this.root=e}e.empty=function(){return new e(b)};var t=e.prototype;return t.find=function(e){return this.root.find(e)},t.findMax=function(e){return this.root.findMax(e)},t.findMaxValue=function(e){if(this.empty())throw new Error("Searching for max value in an empty tree");return this.root.findMaxValue(e)},t.findWith=function(e){return this.root.findWith(e)},t.insert=function(t,n){return new e(this.root.insert(t,n))},t.remove=function(t){return new e(this.root.remove(t))},t.empty=function(){return this.root.empty()},t.keys=function(){return this.root.keys()},t.walk=function(){return this.root.walk()},t.walkWithin=function(e,t){var n=this.root.findMax(e);return this.root.walkWithin(n,t)},t.ranges=function(){return this.root.ranges()},t.rangesWithin=function(e,t){var n=this.root.findMax(e);return this.root.rangesWithin(n,t)},t.isInvariant=function(){return this.root.isInvariant()},e}(),I=function(){function e(e){this.nanIndices=[],this.rangeTree=e;var t=C.empty(),n=0,r=!1,i=e.ranges(),o=Array.isArray(i),s=0;for(i=o?i:i[Symbol.iterator]();;){var a;if(o){if(s>=i.length)break;a=i[s++]}else{if((s=i.next()).done)break;a=s.value}var u=a.start,l=a.end,f=a.value;isNaN(f)?(this.nanIndices.push(u),r||(t=t.insert(n,{startIndex:u,endIndex:Infinity,size:f})),r=!0):r||(t=t.insert(n,{startIndex:u,endIndex:l,size:f}),n+=(l-u+1)*f)}this.offsetTree=t}e.create=function(){return new e(C.empty())};var t=e.prototype;return t.empty=function(){return this.rangeTree.empty()},t.insert=function(t,n,r){var i=this.rangeTree;if(i.empty())return new e(i.insert(0,r));if(this.nanIndices.length&&this.nanIndices.indexOf(n)>-1){if(i.find(this.nanIndices[0]-1)===r)return new e(C.empty().insert(0,r));var o=this.nanIndices,s=Array.isArray(o),a=0;for(o=s?o:o[Symbol.iterator]();;){var u;if(s){if(a>=o.length)break;u=o[a++]}else{if((a=o.next()).done)break;u=a.value}i=i.insert(u,r)}return new e(i)}var l=i.rangesWithin(t-1,n+1);if(l.some(function(e){return e.start===t&&(e.end===n||Infinity===e.end)&&e.value===r}))return this;var f=!1,c=!1,h=l,p=Array.isArray(h),v=0;for(h=p?h:h[Symbol.iterator]();;){var d;if(p){if(v>=h.length)break;d=h[v++]}else{if((v=h.next()).done)break;d=v.value}var g=d.start,y=d.end,m=d.value;f?(n>=g||r===m)&&(i=i.remove(g)):(c=m!==r,f=!0),y>n&&n>=g&&(m===r||isNaN(m)||(i=i.insert(n+1,m)))}return c&&(i=i.insert(t,r)),i===this.rangeTree?this:new e(i)},t.insertSpots=function(t,n){if(this.empty()){var r=this.rangeTree,i=t,o=Array.isArray(i),s=0;for(i=o?i:i[Symbol.iterator]();;){var a;if(o){if(s>=i.length)break;a=i[s++]}else{if((s=i.next()).done)break;a=s.value}var u=a;r=r.insert(u,n).insert(u+1,NaN)}return new e(r)}throw new Error("attempting to overwrite non-empty tree")},t.offsetOf=function(e){if(this.offsetTree.empty())return 0;var t=this.offsetTree.findWith(function(t){return t.startIndex>e?-1:t.endIndex<e?1:0});if(t){var n=t[1];return t[0]+(e-n.startIndex)*n.size}throw new Error("Requested offset outside of the known ones, index: "+e)},t.itemAt=function(e){return{index:e,size:this.rangeTree.findMaxValue(e),offset:NaN}},t.indexRange=function(e,t){if(0===t)return[];if(this.rangeTree.empty())return[{index:0,size:0,offset:NaN}];var n=[],r=this.rangeTree.rangesWithin(e,t),i=Array.isArray(r),o=0;for(r=i?r:r[Symbol.iterator]();;){var s;if(i){if(o>=r.length)break;s=r[o++]}else{if((o=r.next()).done)break;s=o.value}for(var a=s,u=Math.max(e,a.start),l=Math.min(t,void 0===a.end?Infinity:a.end),f=u;f<=l;f++)n.push({index:f,size:a.value,offset:NaN})}return n},t.range=function(e,t,n,r){if(void 0===n&&(n=0),void 0===r&&(r=Infinity),this.offsetTree.empty())return[{index:0,size:0,offset:0}];var i=[],o=this.offsetTree.rangesWithin(e,t),s=Array.isArray(o),a=0;for(o=s?o:o[Symbol.iterator]();;){var u;if(s){if(a>=o.length)break;u=o[a++]}else{if((a=o.next()).done)break;u=a.value}var l=u.start,f=u.value,c=f.startIndex,h=f.endIndex,p=f.size,v=l,d=c;if(l<e&&(v+=((d+=Math.floor((e-l)/p))-c)*p),d<n&&(v+=(n-d)*p,d=n),isNaN(p))return i.push({index:d,size:0,offset:v}),i;h=Math.min(h,r);for(var g=d;g<=h&&!(v>t);g++)i.push({index:g,size:p,offset:v}),v+=p}return i},t.total=function(e){var t=0,n=this.rangeTree.rangesWithin(0,e),r=Array.isArray(n),i=0;for(n=r?n:n[Symbol.iterator]();;){var o;if(r){if(i>=n.length)break;o=n[i++]}else{if((i=n.next()).done)break;o=i.value}var s=o.start,a=o.end,u=o.value;t+=((a=Math.min(a,e))-s+1)*(isNaN(u)?0:u)}return t},t.getOffsets=function(e){var t=this,n=C.empty();return e.forEach(function(e){var r=t.offsetOf(e);n=n.insert(r,e)}),new E(n)},e}(),E=function(){function e(e){this.tree=e}var t=e.prototype;return t.findMaxValue=function(e){return this.tree.findMaxValue(e)},t.empty=function(){return this.tree.empty()},e}(),S=function(){function e(){}return e.prototype.transpose=function(e){return e.map(function(e){return{groupIndex:0,index:e.index,offset:e.offset,size:e.size,transposedIndex:e.index,type:"item"}})},e}(),T=function(){function e(e){this.count=e.reduce(function(e,t){return e+t+1},0);var t=C.empty(),n=0,r=0,i=e,o=Array.isArray(i),s=0;for(i=o?i:i[Symbol.iterator]();;){var a;if(o){if(s>=i.length)break;a=i[s++]}else{if((s=i.next()).done)break;a=s.value}var u=a;t=t.insert(r,[n,r]),n++,r+=u+1}this.tree=t}var t=e.prototype;return t.totalCount=function(){return this.count},t.transpose=function(e){var t=this;return e.map(function(e){var n=t.tree.find(e.index);if(n)return{groupIndex:n[0],index:e.index,offset:e.offset,size:e.size,type:"group"};var r=t.tree.findMaxValue(e.index)[0];return{groupIndex:r,index:e.index,offset:e.offset,size:e.size,transposedIndex:e.index-r-1,type:"item"}})},t.groupIndices=function(){return this.tree.keys()},e}();function M(e){var t;return function(n){t&&t(),n&&(t=e.subscribe(n))}}function N(e){return e.next}var O=function(e){var t,n,r=h(!1);return e.pipe(y(1),g(!0)).subscribe(r.next),e.pipe(y(1),g(!1),function(e,r){t=e,n&&clearTimeout(n),n=setTimeout(function(){r(t)},200)}).subscribe(r.next),r},R=function(e){return e.length>0?e[0].offset:0},z=function(e){return e[0].total(e[1]-1)},A=function(e){var t=e.overscan,n=void 0===t?0:t,r=e.totalCount,i=void 0===r?0:r,o=e.itemHeight,s=h(0),a=h(0),u=h(0),l=h(0),f=h(),c=h(i),g=h(),y=h(),b=I.create(),k=h([]),w=p();o&&(b=b.insert(0,0,o));var C=h(b);o||f.pipe(x(C,k)).subscribe(function(e){var t=e[1],n=e[2],r=t,i=e[0],o=Array.isArray(i),s=0;for(i=o?i:i[Symbol.iterator]();;){var a;if(o){if(s>=i.length)break;a=i[s++]}else{if((s=i.next()).done)break;a=s.value}var u=a.start,l=a.end,f=a.size;r=r.empty()&&u==l&&n.indexOf(u)>-1?r.insertSpots(n,f):r.insert(u,l,f)}r!==t&&C.next(r)});var E=new S;g.subscribe(function(e){E=new T(e),c.next(E.totalCount()),k.next(E.groupIndices())});var A=v(C,c).pipe(d(z)),j=v(A,l).pipe(d(function(e){return e[0]+e[1]})),H=v(C,k).pipe(d(function(e){return e[0].getOffsets(e[1])})),W=h([]);v(C,y,c).pipe(m(function(e){return e[1]>0}),d(function(e){var t=e[0],n=Math.max(0,Math.min(e[1]-1,e[2]));return E.transpose(t.indexRange(0,n))})).subscribe(W.next),v(C,H,u).pipe(m(function(e){return!e[1].empty()&&!e[0].empty()}),x(W),d(function(e){var t=e[0],n=t[0],r=e[1],i=t[1].findMaxValue(Math.max(t[2],0));if(1===r.length&&r[0].index===i)return r;var o=n.itemAt(i);return E.transpose([o])})).subscribe(W.next);var L,V,F=W.pipe(d(function(e){return e.reduce(function(e,t){return e+t.size},0)})),P=v(s,u,F,a,l,W.pipe(d(function(e){return e.length&&e[e.length-1].index+1})),c,C).pipe((L=function(e){return function(t,n){var r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],u=n[5],l=n[6],f=n[7],c=t.length;if(0===l)return[];var h=R(t),p=h-i+s-a-o,v=Math.max(l-1,0);if(p<r||c>0&&(t[0].index<u||t[c-1].index>v)){var d=Math.max(i+o,o);return E.transpose(f.range(d,i+r+2*e-1,u,v))}if(h>i+o){var g=Math.max(i+o-2*e,o);return E.transpose(f.range(g,i+r-1,u,v))}return t}}(n),V=[],function(e,t){t(V=L(V,e))})),_=p(),D=0;P.pipe(d(function(e){return e.length?e[e.length-1].index:0})).pipe(x(c)).subscribe(function(e){var t=e[0],n=e[1];0!==n&&t===n-1&&D!==t&&(D=t,_.next(t))});var q=v(P,u,F).pipe(d(function(e){return R(e[0])})),G=w.pipe(x(C,F,k,s,c),d(function(e){var t=e[0],n=e[1],r=e[2],i=e[3],o=e[4];"number"==typeof t&&(t={index:t,align:"start"});var s=t.index,a=t.align,u=void 0===a?"start":a;s=Math.max(0,s,Math.min(e[5]-1,s));var l=n.offsetOf(s);return"end"==u?l=l-o+n.itemAt(s).size:"center"===u?l=Math.round(l-o/2+n.itemAt(s).size/2):-1===i.indexOf(s)&&(l-=r),l})),U=k.pipe(),Y=q.pipe(d(function(e){return-e})),B=O(u);return{groupCounts:N(g),itemHeights:N(f),footerHeight:N(l),listHeight:N(a),viewportHeight:N(s),scrollTop:N(u),topItemCount:N(y),totalCount:N(c),scrollToIndex:N(w),list:M(P),topList:M(W),listOffset:M(q),totalHeight:M(j),endReached:M(_),isScrolling:M(B),stickyItems:M(k),groupIndices:M(U),stickyItemsOffset:M(Y),scrollTo:M(G)}},j=function(e,n,i){var o=t.useRef(null),s=t.useRef(0),a=new r(function(t){var n=t[0].contentRect.height;s.current!==n&&(s.current=n,i&&i(t[0].target),e(n))});return function(e){e?(a.observe(e),n&&n(e),o.current=e):(a.unobserve(o.current),o.current=null)}};function H(e,n){var r=t.useState(n),i=r[0],o=r[1];return t.useLayoutEffect(function(){return e(o),function(){e(void 0)}},[]),i}var W={height:"40rem",overflowY:"auto",WebkitOverflowScrolling:"touch",position:"relative",outline:"none"},L=function(e){var r=e.className,i=e.style,o=e.reportScrollTop,s=e.scrollTo,a=e.children,u=t.useRef(null),l=t.useCallback(function(e){o(e.target.scrollTop)},[]),f=t.useCallback(function(e){e?(e.addEventListener("scroll",l,{passive:!0}),u.current=e):u.current.removeEventListener("scroll",l)},[]);return s(function(e){u.current.scrollTo({top:e})}),n.createElement("div",{ref:f,style:i,tabIndex:0,className:r},a)},V=function(e){var t=e.children,r=e.className,o=e.ScrollContainer,s=e.scrollTop,a=e.scrollTo;return n.createElement(void 0===o?L:o,{style:i({},W,e.style),reportScrollTop:s,scrollTo:a,className:r},t)},F=function(e){var r=e.render,i=e.stickyClassName,o=t.useContext(f),s=o.topList,a=H(o.list,[]),u=H(s,[]),l=[],c=0,h=[],p=u.reduce(function(e,t){return e+t.size},0);return u.forEach(function(e,t){var n=e.index;h.push(n),l.push(r(e,{key:n,"data-index":n,"data-known-size":e.size,className:i,style:{top:c+"px",marginTop:0===t?-p+"px":void 0}})),c+=e.size}),a.forEach(function(e){h.indexOf(e.index)>-1||l.push(r(e,{key:e.index,"data-index":e.index,"data-known-size":e.size}))}),n.createElement(n.Fragment,null," ",l," ")},P=function(e){var n=e.stickyClassName,r=t.useRef(null);return t.useLayoutEffect(function(){var e=document.createElement("style");return document.head.appendChild(e),e.sheet.insertRule("."+n+" {\n position: sticky;\n position: -webkit-sticky;\n z-index: 2;\n } ",0),r.current=e,function(){document.head.removeChild(r.current),r.current=null}},[]),null},_=function(){return String.fromCharCode(Math.round(25*Math.random()+97))},D=function(){return new Array(12).fill(0).map(_).join("")},q={top:0,position:"absolute",height:"100%",width:"100%",overflow:"absolute"},G=function(e){return n.createElement("div",{style:{height:e.height+"px",position:"absolute",top:0}}," ")},U=function(e){return n.createElement("footer",{ref:e.footerRef},e.children)},Y=function(e){return n.createElement("div",{ref:e.listRef,style:e.style},e.children)},B=function(e){var r=e.footer,i=e.FooterContainer,o=void 0===i?U:i,s=j(t.useContext(f).footerHeight);return n.createElement(o,{footerRef:s},r())},J=function(e){var r=e.fixedItemHeight,i=e.children,o=e.ListContainer,s=t.useContext(f),a=s.listHeight,u=s.itemHeights,l={marginTop:H(s.listOffset,0)+"px"},c=j(a,function(){},function(e){if(!r){var t=function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e.item(n);if(i&&void 0!==i.dataset.index){var o=parseInt(i.dataset.index),s=parseInt(i.dataset.knownSize),a=i.offsetHeight;if(a!==s){var u=t[t.length-1];0===t.length||u.size!==a||u.end!==o-1?t.push({start:o,end:o,size:a}):t[t.length-1].end++}}}return t}(e.children);t.length>0&&u(t)}});return n.createElement(o,{listRef:c,style:l},i)},K=function(e){var r=e.style,i=e.footer,o=e.item,s=e.fixedItemHeight,a=e.ScrollContainer,u=e.ListContainer,l=e.FooterContainer,c=e.className,h=t.useContext(f),p=h.scrollTo,v=h.scrollTop,d=h.viewportHeight,g=H(h.totalHeight,0),y=t.useMemo(D,[]),m=j(d);return n.createElement(V,{style:r,ScrollContainer:a,className:c,scrollTo:p,scrollTop:v},n.createElement("div",{ref:m,style:q},n.createElement(J,{fixedItemHeight:s,ListContainer:u},n.createElement(F,{render:o,stickyClassName:y}),i&&n.createElement(B,{footer:i,FooterContainer:l}))),n.createElement(G,{height:g}),n.createElement(P,Object.assign({},{stickyClassName:y})))},Q=function(e){return n.createElement(f.Provider,{value:e.contextValue},n.createElement(K,{style:e.style||{},className:e.className,item:e.item,footer:e.footer,fixedItemHeight:void 0!==e.itemHeight,ScrollContainer:e.ScrollContainer,FooterContainer:e.FooterContainer,ListContainer:e.ListContainer||Y}))},X=function(e){function t(t){var r;return(r=e.call(this,t)||this).itemRender=function(e,t){var i=r.props.ItemContainer,o=r.props.item(e.index);return i?n.createElement(i,Object.assign({key:t.key},t),o):n.createElement("div",Object.assign({},t),o)},r.state=A(t),r}o(t,e),t.getDerivedStateFromProps=function(e,t){return t.isScrolling(e.scrollingStateChange),t.endReached(e.endReached),t.topItemCount(e.topItems||0),t.totalCount(e.totalCount),null};var r=t.prototype;return r.scrollToIndex=function(e){this.state.scrollToIndex(e)},r.render=function(){return n.createElement(Q,{contextValue:this.state,style:this.props.style,className:this.props.className,item:this.itemRender,footer:this.props.footer,itemHeight:this.props.itemHeight,ScrollContainer:this.props.ScrollContainer,FooterContainer:this.props.FooterContainer,ListContainer:this.props.ListContainer})},t}(t.PureComponent),Z=function(e){function t(t){var r;return(r=e.call(this,t)||this).itemRender=function(e,t){var i=r.props.ItemContainer,o=r.props.GroupContainer||i;if("group"==e.type){var s=r.props.group(e.groupIndex);return o?n.createElement(o,Object.assign({key:t.key},t),s):n.createElement("div",Object.assign({},t),s)}var a=r.props.item(e.transposedIndex,e.groupIndex);return i?n.createElement(i,Object.assign({key:t.key},t),a):n.createElement("div",Object.assign({},t),a)},r.state=A(t),r}o(t,e),t.getDerivedStateFromProps=function(e,t){return t.endReached(e.endReached),t.isScrolling(e.scrollingStateChange),t.groupCounts(e.groupCounts),t.groupIndices(e.groupIndices),null};var r=t.prototype;return r.scrollToIndex=function(e){this.state.scrollToIndex(e)},r.render=function(){return n.createElement(Q,{contextValue:this.state,style:this.props.style,className:this.props.className,item:this.itemRender,footer:this.props.footer,itemHeight:this.props.itemHeight,ScrollContainer:this.props.ScrollContainer,FooterContainer:this.props.FooterContainer,ListContainer:this.props.ListContainer})},t}(t.PureComponent),$=Math.ceil,ee=Math.floor,te=Math.min,ne=Math.max,re=function(e){return $(e)-e<.03?$(e):ee(e)},ie=function(){var e=h([0,0,void 0,void 0]),t=h(0),n=h(0),r=h(0),i=h([0,0]),o=h(0),s=h(0),a=p();v(e,n,r,t).pipe(x(i)).subscribe(function(e){var t=e[0],n=t[0],r=n[1],a=n[2],u=n[3],l=t[1],f=t[2],c=t[3],h=e[1];if(void 0!==a&&void 0!==u&&0!=c){var p=h[0],v=h[1],d=re(n[0]/a),g=function(e,t){return void 0===t&&(t=ee),t(e/d)},y=function(e){var t=e?[0,f]:[f,0],n=t[1],o=d*ee((l-t[0])/u),a=d*$((l+r+n)/u)-1;a=te(c-1,a),o=te(a,ne(0,o)),i.next([o,a]),s.next(g(o)*u)},m=u*g(p),x=u*g(v)+u;m>l?y(!1):x<l+r&&y(!0),o.next(u*g(c,$))}});var u=a.pipe(x(e,t),d(function(e){var t=e[0],n=e[1],r=n[0],i=n[1],o=n[2],s=n[3];if(void 0===o||void 0===s)return 0;"number"==typeof t&&(t={index:t,align:"start"});var a=t.index,u=t.align,l=void 0===u?"start":u;a=Math.max(0,a,Math.min(e[2]-1,a));var f=re(r/o),c=ee(a/f)*s;return"end"==l?c=c-i+s:"center"===l&&(c=Math.round(c-i/2+s/2)),c})),l=O(n),f=p(),c=0;return i.pipe(x(t)).subscribe(function(e){var t=e[0][1],n=e[1];0!==n&&t===n-1&&c!==t&&(c=t,f.next(t))}),{gridDimensions:N(e),totalCount:N(t),scrollTop:N(n),overscan:N(r),scrollToIndex:N(a),itemRange:M(i),totalHeight:M(o),listOffset:M(s),scrollTo:M(u),isScrolling:M(l),endReached:M(f)}},oe=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).state=ie(),t}o(t,e),t.getDerivedStateFromProps=function(e,t){return t.overscan(e.overscan||0),t.totalCount(e.totalCount),t.isScrolling(e.scrollingStateChange),t.endReached(e.endReached),null};var r=t.prototype;return r.scrollToIndex=function(e){this.state.scrollToIndex(e)},r.render=function(){return n.createElement(se,Object.assign({},this.props,{engine:this.state}))},t}(n.PureComponent),se=function(e){var i,o,s,a,u=e.ScrollContainer,l=e.className,f=e.item,c=e.itemClassName,h=void 0===c?"virtuoso-grid-item":c,p=e.listClassName,v=void 0===p?"virtuoso-grid-list":p,d=e.engine,g=e.style,y=void 0===g?{height:"40rem"}:g,m=d.itemRange,x=d.listOffset,b=d.gridDimensions,k=d.scrollTo,w=d.scrollTop,C=H(d.totalHeight,0),I={marginTop:H(x,0)+"px"},E=H(m,[0,0]),S=(i=function(e){var t=e.element.firstChild.firstChild;b([e.width,e.height,t.offsetWidth,t.offsetHeight])},o=t.useRef(null),s=t.useRef([0,0]),a=new r(function(e){var t=e[0].contentRect,n=t.width,r=t.height;s.current[0]===n&&s.current[1]===r||(s.current=[n,r],i({element:e[0].target,width:n,height:r}))}),function(e){e?(a.observe(e),o.current=e):(a.unobserve(o.current),o.current=null)});return n.createElement(V,{style:y,ScrollContainer:u,className:l,scrollTo:k,scrollTop:w},n.createElement("div",{ref:S,style:q},n.createElement("div",{style:I,className:v},function(e,t,r){for(var i=E[1],o=[],s=E[0];s<=i;s++)o.push(n.createElement("div",{key:s,className:r},t(s)));return o}(0,f,h))),n.createElement(G,{height:C}))};exports.GroupedVirtuoso=Z,exports.Virtuoso=X,exports.VirtuosoGrid=oe,exports.VirtuosoPresentation=Q;
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("react"),n=e(t),r=e(require("resize-observer-polyfill"));function i(){return(i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function o(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e,t,n){return(u=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&a(i,n.prototype),i}).apply(null,arguments)}function l(e){var t="function"==typeof Map?new Map:void 0;return(l=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return u(e,arguments,s(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),a(n,e)})(e)}var f=t.createContext(void 0);function c(e){return function(){var t=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e,t){return t(e)}:1===t.length?t[0]:function(e,n){var r=function(e){return n(e)};t.slice().reverse().forEach(function(e){var t=r;r=function(n){return e(n,t)}}),r(e)}}.apply(void 0,arguments);return function(e,t){var n=function(n){return e(function(e){return t(e,n)})};return{subscribe:n,pipe:c(n)}}(e,t)}}function h(e,t){void 0===t&&(t=!0);var n=[],r=e,i=function(e){return n.push(e),void 0!==r&&e(r),function(){n=n.filter(function(t){return t!==e})}};return{next:function(e){t&&e===r||(r=e,n.forEach(function(t){return t(e)}))},subscribe:i,pipe:c(i),subscribers:n}}function v(){var e=[],t=function(t){return e.push(t),function(){e=e.filter(function(e){return e!==t})}};return{next:function(t){e.forEach(function(e){return e(t)})},subscribe:t,pipe:c(t)}}function p(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=Array(t.length).fill(!1),i=Array(t.length),o=[],s=function(e){r.every(function(e){return e})&&e.forEach(function(e){return e(i)})};t.forEach(function(e,t){e.subscribe(function(e){r[t]=!0,i[t]=e,s(o)})});var a=function(e){return o.push(e),s([e]),function(){o=o.filter(function(t){return t!==e})}};return{subscribe:a,pipe:c(a)}}function d(e){return function(t,n){n(e(t))}}function g(e){return function(t,n){return n(e)}}function m(e){return function(t,n){e>0?e--:n(t)}}function y(e){return function(t,n){e(t)&&n(t)}}function x(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=Array(t.length).fill(!1),i=Array(t.length);return t.forEach(function(e,t){e.subscribe(function(e){i[t]=e,r[t]=!0})}),function(e,t){r.every(function(e){return e})&&t([e].concat(i))}}var b=new(function(){function e(){this.level=0}var t=e.prototype;return t.rebalance=function(){return this},t.adjust=function(){return this},t.remove=function(){return this},t.find=function(){},t.findWith=function(){},t.findMax=function(){return-Infinity},t.findMaxValue=function(){},t.insert=function(e,t){return new C({key:e,value:t,level:1})},t.walkWithin=function(){return[]},t.walk=function(){return[]},t.ranges=function(){return[]},t.rangesWithin=function(){return[]},t.empty=function(){return!0},t.isSingle=function(){return!0},t.isInvariant=function(){return!0},t.keys=function(){return[]},e}());Object.freeze(b);var k=function(e){function t(t){return e.call(this,"Unreachable case: "+t)||this}return o(t,e),t}(l(Error)),C=function(){function e(e){var t=e.value,n=e.level,r=e.left,i=void 0===r?b:r,o=e.right,s=void 0===o?b:o;this.key=e.key,this.value=t,this.level=n,this.left=i,this.right=s}var t=e.prototype;return t.remove=function(e){var t=this.left,n=this.right;if(e===this.key){if(t.empty())return n;if(n.empty())return t;var r=t.last();return this.clone({key:r[0],value:r[1],left:t.deleteLast()}).adjust()}return e<this.key?this.clone({left:t.remove(e)}).adjust():this.clone({right:n.remove(e)}).adjust()},t.empty=function(){return!1},t.find=function(e){return e===this.key?this.value:e<this.key?this.left.find(e):this.right.find(e)},t.findWith=function(e){var t=e(this.value);switch(t){case-1:return this.left.findWith(e);case 0:return[this.key,this.value];case 1:return this.right.findWith(e);default:throw new k(t)}},t.findMax=function(e){if(this.key===e)return e;if(this.key<e){var t=this.right.findMax(e);return-Infinity===t?this.key:t}return this.left.findMax(e)},t.findMaxValue=function(e){if(this.key===e)return this.value;if(this.key<e){var t=this.right.findMaxValue(e);return void 0===t?this.value:t}return this.left.findMaxValue(e)},t.insert=function(e,t){return e===this.key?this.clone({key:e,value:t}):e<this.key?this.clone({left:this.left.insert(e,t)}).rebalance():this.clone({right:this.right.insert(e,t)}).rebalance()},t.walkWithin=function(e,t){var n=this.key,r=this.value,i=[];return n>e&&(i=i.concat(this.left.walkWithin(e,t))),n>=e&&n<=t&&i.push({key:n,value:r}),n<=t&&(i=i.concat(this.right.walkWithin(e,t))),i},t.walk=function(){return[].concat(this.left.walk(),[{key:this.key,value:this.value}],this.right.walk())},t.last=function(){return this.right.empty()?[this.key,this.value]:this.right.last()},t.deleteLast=function(){return this.right.empty()?this.left:this.clone({right:this.right.deleteLast()}).adjust()},t.clone=function(t){return new e({key:void 0!==t.key?t.key:this.key,value:void 0!==t.value?t.value:this.value,level:void 0!==t.level?t.level:this.level,left:void 0!==t.left?t.left:this.left,right:void 0!==t.right?t.right:this.right})},t.isSingle=function(){return this.level>this.right.level},t.rebalance=function(){return this.skew().split()},t.adjust=function(){var e=this.left,t=this.right,n=this.level;if(t.level>=n-1&&e.level>=n-1)return this;if(n>t.level+1){if(e.isSingle())return this.clone({level:n-1}).skew();if(e.empty()||e.right.empty())throw new Error("Unexpected empty nodes");return e.right.clone({left:e.clone({right:e.right.left}),right:this.clone({left:e.right.right,level:n-1}),level:n})}if(this.isSingle())return this.clone({level:n-1}).split();if(t.empty()||t.left.empty())throw new Error("Unexpected empty nodes");var r=t.left,i=r.isSingle()?t.level-1:t.level;return r.clone({left:this.clone({right:r.left,level:n-1}),right:t.clone({left:r.right,level:i}).split(),level:r.level+1})},t.isInvariant=function(){var e=this.left,t=this.right,n=this.level;return n===e.level+1&&(n===t.level||n===t.level+1)&&!(!t.empty()&&n<=t.right.level)&&e.isInvariant()&&t.isInvariant()},t.keys=function(){return[].concat(this.left.keys(),[this.key],this.right.keys())},t.ranges=function(){return this.toRanges(this.walk())},t.rangesWithin=function(e,t){return this.toRanges(this.walkWithin(e,t))},t.toRanges=function(e){if(0===e.length)return[];for(var t=e[0],n=t.key,r=t.value,i=[],o=1;o<=e.length;o++){var s=e[o];i.push({start:n,end:s?s.key-1:Infinity,value:r}),s&&(n=s.key,r=s.value)}return i},t.split=function(){var e=this.right,t=this.level;return e.empty()||e.right.empty()||e.level!=t||e.right.level!=t?this:e.clone({left:this.clone({right:e.left}),level:t+1})},t.skew=function(){var e=this.left;return e.empty()||e.level!==this.level?this:e.clone({right:this.clone({left:e.right})})},e}(),w=function(){function e(e){this.root=e}e.empty=function(){return new e(b)};var t=e.prototype;return t.find=function(e){return this.root.find(e)},t.findMax=function(e){return this.root.findMax(e)},t.findMaxValue=function(e){if(this.empty())throw new Error("Searching for max value in an empty tree");return this.root.findMaxValue(e)},t.findWith=function(e){return this.root.findWith(e)},t.insert=function(t,n){return new e(this.root.insert(t,n))},t.remove=function(t){return new e(this.root.remove(t))},t.empty=function(){return this.root.empty()},t.keys=function(){return this.root.keys()},t.walk=function(){return this.root.walk()},t.walkWithin=function(e,t){var n=this.root.findMax(e);return this.root.walkWithin(n,t)},t.ranges=function(){return this.root.ranges()},t.rangesWithin=function(e,t){var n=this.root.findMax(e);return this.root.rangesWithin(n,t)},t.isInvariant=function(){return this.root.isInvariant()},e}(),I=function(){function e(e){this.nanIndices=[],this.rangeTree=e;var t=w.empty(),n=0,r=!1,i=e.ranges(),o=Array.isArray(i),s=0;for(i=o?i:i[Symbol.iterator]();;){var a;if(o){if(s>=i.length)break;a=i[s++]}else{if((s=i.next()).done)break;a=s.value}var u=a.start,l=a.end,f=a.value;isNaN(f)?(this.nanIndices.push(u),r||(t=t.insert(n,{startIndex:u,endIndex:Infinity,size:f})),r=!0):r||(t=t.insert(n,{startIndex:u,endIndex:l,size:f}),n+=(l-u+1)*f)}this.offsetTree=t}e.create=function(){return new e(w.empty())};var t=e.prototype;return t.empty=function(){return this.rangeTree.empty()},t.insert=function(t,n,r){var i=this.rangeTree;if(i.empty())return new e(i.insert(0,r));if(this.nanIndices.length&&this.nanIndices.indexOf(n)>-1){if(i.find(this.nanIndices[0]-1)===r)return new e(w.empty().insert(0,r));var o=this.nanIndices,s=Array.isArray(o),a=0;for(o=s?o:o[Symbol.iterator]();;){var u;if(s){if(a>=o.length)break;u=o[a++]}else{if((a=o.next()).done)break;u=a.value}i=i.insert(u,r)}return new e(i)}var l=i.rangesWithin(t-1,n+1);if(l.some(function(e){return e.start===t&&(e.end===n||Infinity===e.end)&&e.value===r}))return this;var f=!1,c=!1,h=l,v=Array.isArray(h),p=0;for(h=v?h:h[Symbol.iterator]();;){var d;if(v){if(p>=h.length)break;d=h[p++]}else{if((p=h.next()).done)break;d=p.value}var g=d.start,m=d.end,y=d.value;f?(n>=g||r===y)&&(i=i.remove(g)):(c=y!==r,f=!0),m>n&&n>=g&&(y===r||isNaN(y)||(i=i.insert(n+1,y)))}return c&&(i=i.insert(t,r)),i===this.rangeTree?this:new e(i)},t.insertSpots=function(t,n){if(this.empty()){var r=this.rangeTree,i=t,o=Array.isArray(i),s=0;for(i=o?i:i[Symbol.iterator]();;){var a;if(o){if(s>=i.length)break;a=i[s++]}else{if((s=i.next()).done)break;a=s.value}var u=a;r=r.insert(u,n).insert(u+1,NaN)}return new e(r)}throw new Error("attempting to overwrite non-empty tree")},t.offsetOf=function(e){if(this.offsetTree.empty())return 0;var t=this.offsetTree.findWith(function(t){return t.startIndex>e?-1:t.endIndex<e?1:0});if(t){var n=t[1];return t[0]+(e-n.startIndex)*n.size}throw new Error("Requested offset outside of the known ones, index: "+e)},t.itemAt=function(e){return{index:e,size:this.rangeTree.findMaxValue(e),offset:NaN}},t.indexRange=function(e,t){if(0===t)return[];if(this.rangeTree.empty())return[{index:0,size:0,offset:NaN}];var n=[],r=this.rangeTree.rangesWithin(e,t),i=Array.isArray(r),o=0;for(r=i?r:r[Symbol.iterator]();;){var s;if(i){if(o>=r.length)break;s=r[o++]}else{if((o=r.next()).done)break;s=o.value}for(var a=s,u=Math.max(e,a.start),l=Math.min(t,void 0===a.end?Infinity:a.end),f=u;f<=l;f++)n.push({index:f,size:a.value,offset:NaN})}return n},t.range=function(e,t,n,r){if(void 0===n&&(n=0),void 0===r&&(r=Infinity),this.offsetTree.empty())return[{index:0,size:0,offset:0}];var i=[],o=this.offsetTree.rangesWithin(e,t),s=Array.isArray(o),a=0;for(o=s?o:o[Symbol.iterator]();;){var u;if(s){if(a>=o.length)break;u=o[a++]}else{if((a=o.next()).done)break;u=a.value}var l=u.start,f=u.value,c=f.startIndex,h=f.endIndex,v=f.size,p=l,d=c;if(l<e&&(p+=((d+=Math.floor((e-l)/v))-c)*v),d<n&&(p+=(n-d)*v,d=n),isNaN(v))return i.push({index:d,size:0,offset:p}),i;h=Math.min(h,r);for(var g=d;g<=h&&!(p>t);g++)i.push({index:g,size:v,offset:p}),p+=v}return i},t.total=function(e){var t=0,n=this.rangeTree.rangesWithin(0,e),r=Array.isArray(n),i=0;for(n=r?n:n[Symbol.iterator]();;){var o;if(r){if(i>=n.length)break;o=n[i++]}else{if((i=n.next()).done)break;o=i.value}var s=o.start,a=o.end,u=o.value;t+=((a=Math.min(a,e))-s+1)*(isNaN(u)?0:u)}return t},t.getOffsets=function(e){var t=this,n=w.empty();return e.forEach(function(e){var r=t.offsetOf(e);n=n.insert(r,e)}),new E(n)},e}(),E=function(){function e(e){this.tree=e}var t=e.prototype;return t.findMaxValue=function(e){return this.tree.findMaxValue(e)},t.empty=function(){return this.tree.empty()},e}(),S=function(){function e(){}return e.prototype.transpose=function(e){return e.map(function(e){return{groupIndex:0,index:e.index,offset:e.offset,size:e.size,transposedIndex:e.index,type:"item"}})},e}(),T=function(){function e(e){this.count=e.reduce(function(e,t){return e+t+1},0);var t=w.empty(),n=0,r=0,i=e,o=Array.isArray(i),s=0;for(i=o?i:i[Symbol.iterator]();;){var a;if(o){if(s>=i.length)break;a=i[s++]}else{if((s=i.next()).done)break;a=s.value}var u=a;t=t.insert(r,[n,r]),n++,r+=u+1}this.tree=t}var t=e.prototype;return t.totalCount=function(){return this.count},t.transpose=function(e){var t=this;return e.map(function(e){var n=t.tree.find(e.index);if(n)return{groupIndex:n[0],index:e.index,offset:e.offset,size:e.size,type:"group"};var r=t.tree.findMaxValue(e.index)[0];return{groupIndex:r,index:e.index,offset:e.offset,size:e.size,transposedIndex:e.index-r-1,type:"item"}})},t.groupIndices=function(){return this.tree.keys()},e}();function M(e){var t;return function(n){t&&t(),n&&(t=e.subscribe(n))}}function N(e){return e.next}var O=function(e){var t,n,r=h(!1);return e.pipe(m(1),g(!0)).subscribe(r.next),e.pipe(m(1),g(!1),function(e,r){t=e,n&&clearTimeout(n),n=setTimeout(function(){r(t)},200)}).subscribe(r.next),r},R=function(e){return e.length>0?e[0].offset:0},z=function(e){return e[0].total(e[1]-1)},A=function(e){var t=e.overscan,n=void 0===t?0:t,r=e.totalCount,i=void 0===r?0:r,o=e.itemHeight,s=h(0),a=h(0),u=h(0),l=h(0),f=h(),c=h(i),g=h(),m=h(),b=I.create(),k=h([]),C=v();o&&(b=b.insert(0,0,o));var w=h(b);o||f.pipe(x(w,k)).subscribe(function(e){var t=e[1],n=e[2],r=t,i=e[0],o=Array.isArray(i),s=0;for(i=o?i:i[Symbol.iterator]();;){var a;if(o){if(s>=i.length)break;a=i[s++]}else{if((s=i.next()).done)break;a=s.value}var u=a.start,l=a.end,f=a.size;r=r.empty()&&u==l&&n.indexOf(u)>-1?r.insertSpots(n,f):r.insert(u,l,f)}r!==t&&w.next(r)});var E=new S;g.subscribe(function(e){E=new T(e),c.next(E.totalCount()),k.next(E.groupIndices())});var A=p(w,c).pipe(d(z)),j=p(A,l).pipe(d(function(e){return e[0]+e[1]})),H=p(w,k).pipe(d(function(e){return e[0].getOffsets(e[1])})),W=h([]);p(w,m,c).pipe(y(function(e){return e[1]>0}),d(function(e){var t=e[0],n=Math.max(0,Math.min(e[1]-1,e[2]));return E.transpose(t.indexRange(0,n))})).subscribe(W.next),p(w,H,u).pipe(y(function(e){return!e[1].empty()&&!e[0].empty()}),x(W),d(function(e){var t=e[0],n=t[0],r=e[1],i=t[1].findMaxValue(Math.max(t[2],0));if(1===r.length&&r[0].index===i)return r;var o=n.itemAt(i);return E.transpose([o])})).subscribe(W.next);var L,V,F=W.pipe(d(function(e){return e.reduce(function(e,t){return e+t.size},0)})),P=p(s,u,F,a,l,W.pipe(d(function(e){return e.length&&e[e.length-1].index+1})),c,w).pipe((L=function(e){return function(t,n){var r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],u=n[5],l=n[6],f=n[7],c=t.length;if(0===l)return[];var h=R(t),v=h-i+s-a-o,p=Math.max(l-1,0);if(v<r||c>0&&(t[0].index<u||t[c-1].index>p)){var d=Math.max(i+o,o);return E.transpose(f.range(d,i+r+2*e-1,u,p))}if(h>i+o){var g=Math.max(i+o-2*e,o);return E.transpose(f.range(g,i+r-1,u,p))}return t}}(n),V=[],function(e,t){t(V=L(V,e))})),_=v(),D=0;P.pipe(d(function(e){return e.length?e[e.length-1].index:0})).pipe(x(c)).subscribe(function(e){var t=e[0],n=e[1];0!==n&&t===n-1&&D!==t&&(D=t,_.next(t))});var q=p(P,u,F).pipe(d(function(e){return R(e[0])})),G=C.pipe(x(w,F,k,s,c),d(function(e){var t=e[0],n=e[1],r=e[2],i=e[3],o=e[4];"number"==typeof t&&(t={index:t,align:"start"});var s=t.index,a=t.align,u=void 0===a?"start":a;s=Math.max(0,s,Math.min(e[5]-1,s));var l=n.offsetOf(s);return"end"==u?l=l-o+n.itemAt(s).size:"center"===u?l=Math.round(l-o/2+n.itemAt(s).size/2):-1===i.indexOf(s)&&(l-=r),l})),U=k.pipe(),Y=q.pipe(d(function(e){return-e})),B=O(u);return{groupCounts:N(g),itemHeights:N(f),footerHeight:N(l),listHeight:N(a),viewportHeight:N(s),scrollTop:N(u),topItemCount:N(m),totalCount:N(c),scrollToIndex:N(C),list:M(P),topList:M(W),listOffset:M(q),totalHeight:M(j),endReached:M(_),isScrolling:M(B),stickyItems:M(k),groupIndices:M(U),stickyItemsOffset:M(Y),scrollTo:M(G)}},j=function(e,n,i){var o=t.useRef(null),s=t.useRef(0),a=new r(function(t){var n=t[0].contentRect.height;s.current!==n&&(s.current=n,i&&i(t[0].target),e(n))});return function(e){e?(a.observe(e),n&&n(e),o.current=e):(a.unobserve(o.current),o.current=null)}};function H(e,n){var r=t.useState(n),i=r[0],o=r[1];return t.useLayoutEffect(function(){return e(o),function(){e(void 0)}},[]),i}var W={height:"40rem",overflowY:"auto",WebkitOverflowScrolling:"touch",position:"relative",outline:"none"},L=function(e){var r=e.className,i=e.style,o=e.reportScrollTop,s=e.scrollTo,a=e.children,u=t.useRef(null),l=t.useCallback(function(e){o(e.target.scrollTop)},[]),f=t.useCallback(function(e){e?(e.addEventListener("scroll",l,{passive:!0}),u.current=e):u.current.removeEventListener("scroll",l)},[]);return s(function(e){u.current.scrollTo({top:e})}),n.createElement("div",{ref:f,style:i,tabIndex:0,className:r},a)},V=function(e){var t=e.children,r=e.className,o=e.ScrollContainer,s=e.scrollTop,a=e.scrollTo;return n.createElement(void 0===o?L:o,{style:i({},W,e.style),reportScrollTop:s,scrollTo:a,className:r},t)},F=function(e){var r=e.render,i=e.stickyClassName,o=t.useContext(f),s=o.topList,a=H(o.list,[]),u=H(s,[]),l=[],c=0,h=[],v=u.reduce(function(e,t){return e+t.size},0);return u.forEach(function(e,t){var n=e.index;h.push(n),l.push(r(e,{key:n,"data-index":n,"data-known-size":e.size,className:i,style:{top:c+"px",marginTop:0===t?-v+"px":void 0}})),c+=e.size}),a.forEach(function(e){h.indexOf(e.index)>-1||l.push(r(e,{key:e.index,"data-index":e.index,"data-known-size":e.size}))}),n.createElement(n.Fragment,null," ",l," ")},P=function(e){var n=e.stickyClassName,r=t.useRef(null);return t.useLayoutEffect(function(){var e=document.createElement("style");return document.head.appendChild(e),e.sheet.insertRule("."+n+" {\n position: sticky;\n position: -webkit-sticky;\n z-index: 2;\n } ",0),r.current=e,function(){document.head.removeChild(r.current),r.current=null}},[]),null},_=function(){return String.fromCharCode(Math.round(25*Math.random()+97))},D=function(){return new Array(12).fill(0).map(_).join("")},q={top:0,position:"absolute",height:"100%",width:"100%",overflow:"absolute"},G=function(e){return n.createElement("div",{style:{height:e.height+"px",position:"absolute",top:0}}," ")},U=function(e){return n.createElement("footer",{ref:e.footerRef},e.children)},Y=function(e){return n.createElement("div",{ref:e.listRef,style:e.style},e.children)},B=function(e){var r=e.footer,i=e.FooterContainer,o=void 0===i?U:i,s=j(t.useContext(f).footerHeight);return n.createElement(o,{footerRef:s},r())},J=function(e){var r=e.fixedItemHeight,i=e.children,o=e.ListContainer,s=t.useContext(f),a=s.listHeight,u=s.itemHeights,l={marginTop:H(s.listOffset,0)+"px"},c=j(a,function(){},function(e){if(!r){var t=function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e.item(n);if(i&&void 0!==i.dataset.index){var o=parseInt(i.dataset.index),s=parseInt(i.dataset.knownSize),a=i.offsetHeight;if(a!==s){var u=t[t.length-1];0===t.length||u.size!==a||u.end!==o-1?t.push({start:o,end:o,size:a}):t[t.length-1].end++}}}return t}(e.children);t.length>0&&u(t)}});return n.createElement(o,{listRef:c,style:l},i)},K=function(e){var r=e.style,i=e.footer,o=e.item,s=e.fixedItemHeight,a=e.ScrollContainer,u=e.ListContainer,l=e.FooterContainer,c=e.className,h=t.useContext(f),v=h.scrollTo,p=h.scrollTop,d=h.viewportHeight,g=H(h.totalHeight,0),m=t.useMemo(D,[]),y=j(d);return n.createElement(V,{style:r,ScrollContainer:a,className:c,scrollTo:v,scrollTop:p},n.createElement("div",{ref:y,style:q},n.createElement(J,{fixedItemHeight:s,ListContainer:u},n.createElement(F,{render:o,stickyClassName:m}),i&&n.createElement(B,{footer:i,FooterContainer:l}))),n.createElement(G,{height:g}),n.createElement(P,Object.assign({},{stickyClassName:m})))},Q=function(e){return n.createElement(f.Provider,{value:e.contextValue},n.createElement(K,{style:e.style||{},className:e.className,item:e.item,footer:e.footer,fixedItemHeight:void 0!==e.itemHeight,ScrollContainer:e.ScrollContainer,FooterContainer:e.FooterContainer,ListContainer:e.ListContainer||Y}))},X=function(e){function t(t){var r;return(r=e.call(this,t)||this).itemRender=function(e,t){var i=r.props.ItemContainer,o=r.props.item(e.index);return i?n.createElement(i,Object.assign({key:t.key},t),o):n.createElement("div",Object.assign({},t),o)},r.state=A(t),r}o(t,e),t.getDerivedStateFromProps=function(e,t){return t.isScrolling(e.scrollingStateChange),t.endReached(e.endReached),t.topItemCount(e.topItems||0),t.totalCount(e.totalCount),null};var r=t.prototype;return r.scrollToIndex=function(e){this.state.scrollToIndex(e)},r.render=function(){return n.createElement(Q,{contextValue:this.state,style:this.props.style,className:this.props.className,item:this.itemRender,footer:this.props.footer,itemHeight:this.props.itemHeight,ScrollContainer:this.props.ScrollContainer,FooterContainer:this.props.FooterContainer,ListContainer:this.props.ListContainer})},t}(t.PureComponent),Z=function(e){function t(t){var r;return(r=e.call(this,t)||this).itemRender=function(e,t){var i=r.props.ItemContainer,o=r.props.GroupContainer||i;if("group"==e.type){var s=r.props.group(e.groupIndex);return o?n.createElement(o,Object.assign({key:t.key},t),s):n.createElement("div",Object.assign({},t),s)}var a=r.props.item(e.transposedIndex,e.groupIndex);return i?n.createElement(i,Object.assign({key:t.key},t),a):n.createElement("div",Object.assign({},t),a)},r.state=A(t),r}o(t,e),t.getDerivedStateFromProps=function(e,t){return t.endReached(e.endReached),t.isScrolling(e.scrollingStateChange),t.groupCounts(e.groupCounts),t.groupIndices(e.groupIndices),null};var r=t.prototype;return r.scrollToIndex=function(e){this.state.scrollToIndex(e)},r.render=function(){return n.createElement(Q,{contextValue:this.state,style:this.props.style,className:this.props.className,item:this.itemRender,footer:this.props.footer,itemHeight:this.props.itemHeight,ScrollContainer:this.props.ScrollContainer,FooterContainer:this.props.FooterContainer,ListContainer:this.props.ListContainer})},t}(t.PureComponent),$=Math.ceil,ee=Math.floor,te=Math.min,ne=Math.max,re=function(e){return $(e)-e<.03?$(e):ee(e)},ie=function(){var e=h([0,0,void 0,void 0]),t=h(0),n=h(0),r=h(0),i=h([0,0]),o=h(0),s=h(0),a=v();p(e,n,r,t).pipe(x(i)).subscribe(function(e){var t=e[0],n=t[0],r=n[1],a=n[2],u=n[3],l=t[1],f=t[2],c=t[3],h=e[1];if(void 0!==a&&void 0!==u&&0!=c){var v=h[0],p=h[1],d=re(n[0]/a),g=function(e,t){return void 0===t&&(t=ee),t(e/d)},m=function(e){var t=e?[0,f]:[f,0],n=t[1],o=d*ee((l-t[0])/u),a=d*$((l+r+n)/u)-1;a=te(c-1,a),o=te(a,ne(0,o)),i.next([o,a]),s.next(g(o)*u)},y=u*g(v),x=u*g(p)+u;y>l?m(!1):x<l+r&&m(!0),o.next(u*g(c,$))}});var u=a.pipe(x(e,t),d(function(e){var t=e[0],n=e[1],r=n[0],i=n[1],o=n[2],s=n[3];if(void 0===o||void 0===s)return 0;"number"==typeof t&&(t={index:t,align:"start"});var a=t.index,u=t.align,l=void 0===u?"start":u;a=Math.max(0,a,Math.min(e[2]-1,a));var f=re(r/o),c=ee(a/f)*s;return"end"==l?c=c-i+s:"center"===l&&(c=Math.round(c-i/2+s/2)),c})),l=O(n),f=v(),c=0;return i.pipe(x(t)).subscribe(function(e){var t=e[0][1],n=e[1];0!==n&&t===n-1&&c!==t&&(c=t,f.next(t))}),{gridDimensions:N(e),totalCount:N(t),scrollTop:N(n),overscan:N(r),scrollToIndex:N(a),itemRange:M(i),totalHeight:M(o),listOffset:M(s),scrollTo:M(u),isScrolling:M(l),endReached:M(f)}},oe=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).state=ie(),t}o(t,e),t.getDerivedStateFromProps=function(e,t){return t.overscan(e.overscan||0),t.totalCount(e.totalCount),t.isScrolling(e.scrollingStateChange),t.endReached(e.endReached),null};var r=t.prototype;return r.scrollToIndex=function(e){this.state.scrollToIndex(e)},r.render=function(){return n.createElement(se,Object.assign({},this.props,{engine:this.state}))},t}(n.PureComponent),se=function(e){var i,o,s,a,u=e.ScrollContainer,l=e.ItemContainer,f=void 0===l?"div":l,c=e.ListContainer,h=void 0===c?"div":c,v=e.className,p=e.item,d=e.itemClassName,g=void 0===d?"virtuoso-grid-item":d,m=e.listClassName,y=void 0===m?"virtuoso-grid-list":m,x=e.engine,b=e.style,k=void 0===b?{height:"40rem"}:b,C=x.itemRange,w=x.listOffset,I=x.gridDimensions,E=x.scrollTo,S=x.scrollTop,T=H(x.totalHeight,0),M={marginTop:H(w,0)+"px"},N=H(C,[0,0]),O=(i=function(e){var t=e.element.firstChild.firstChild;I([e.width,e.height,t.offsetWidth,t.offsetHeight])},o=t.useRef(null),s=t.useRef([0,0]),a=new r(function(e){var t=e[0].contentRect,n=t.width,r=t.height;s.current[0]===n&&s.current[1]===r||(s.current=[n,r],i({element:e[0].target,width:n,height:r}))}),function(e){e?(a.observe(e),o.current=e):(a.unobserve(o.current),o.current=null)});return n.createElement(V,{style:k,ScrollContainer:u,className:v,scrollTo:E,scrollTop:S},n.createElement("div",{ref:O,style:q},n.createElement(h,{style:M,className:y},function(e,t,r,i){for(var o=N[1],s=[],a=N[0];a<=o;a++)s.push(n.createElement(i,{key:a,className:r},t(a)));return s}(0,p,g,f))),n.createElement(G,{height:T}))};exports.GroupedVirtuoso=Z,exports.Virtuoso=X,exports.VirtuosoGrid=oe,exports.VirtuosoPresentation=Q;
//# sourceMappingURL=react-virtuoso.cjs.production.min.js.map

@@ -2316,3 +2316,3 @@ import React, { createContext, useState, useLayoutEffect, useRef, useCallback, useContext, useMemo, PureComponent } from 'react';

var buildItems = function buildItems(_ref, item, itemClassName) {
var buildItems = function buildItems(_ref, item, itemClassName, ItemContainer) {
var startIndex = _ref[0],

@@ -2323,3 +2323,3 @@ endIndex = _ref[1];

for (var index = startIndex; index <= endIndex; index++) {
items.push(React.createElement("div", {
items.push(React.createElement(ItemContainer, {
key: index,

@@ -2335,2 +2335,6 @@ className: itemClassName

var ScrollContainer = _ref2.ScrollContainer,
_ref2$ItemContainer = _ref2.ItemContainer,
ItemContainer = _ref2$ItemContainer === void 0 ? 'div' : _ref2$ItemContainer,
_ref2$ListContainer = _ref2.ListContainer,
ListContainer = _ref2$ListContainer === void 0 ? 'div' : _ref2$ListContainer,
className = _ref2.className,

@@ -2375,6 +2379,6 @@ item = _ref2.item,

style: viewportStyle
}, React.createElement("div", {
}, React.createElement(ListContainer, {
style: listStyle,
className: listClassName
}, buildItems(itemIndexRange, item, itemClassName))), React.createElement(VirtuosoFiller, {
}, buildItems(itemIndexRange, item, itemClassName, ItemContainer))), React.createElement(VirtuosoFiller, {
height: fillerHeight

@@ -2381,0 +2385,0 @@ }));

@@ -5,2 +5,7 @@ import React, { CSSProperties, ReactElement } from 'react';

import { TScrollLocation } from './EngineCommons';
declare type TContainer = React.ComponentType<{
className: string;
style?: CSSProperties;
key?: number;
}> | keyof JSX.IntrinsicElements;
export interface VirtuosoGridProps {

@@ -13,2 +18,4 @@ totalCount: number;

ScrollContainer?: TScrollContainer;
ListContainer?: TContainer;
ItemContainer?: TContainer;
listClassName?: string;

@@ -15,0 +22,0 @@ itemClassName?: string;

{
"name": "react-virtuoso",
"version": "0.8.2",
"version": "0.9.0",
"homepage": "https://virtuoso.dev",

@@ -5,0 +5,0 @@ "license": "MIT",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc