virtual-scroller 1.12.1 → 1.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -86,9 +86,21 @@ The main `state` properties are:
86
86
 
87
87
  The following `state` properties are only used for saving and restoring `VirtualScroller` `state`, and normally shouldn't be accessed:
88
88
 
89
- * `itemStates: any[]` — The states of all items. Any change in an item's appearance while it's rendered must be reflected in changing that item's state by calling `.setItemState(i, itemState)` instance method (described below): this way, the item's state is preserved when it's shown next time after being hidden due to going off screen. For example, if an item is a social media comment, and there's a "Show more"/"Show less" button that shows the full text of the comment, then it must call `.setItemState(i, { showMore: true/false })` every time.
89
+ * `itemStates: any[]` — The "states" of all items. If an item's appearance is not "static" and could change, then every aspect of the item's appearance that could change should be represented in the item's "state", and that "state" must be preserved somewhere. That's because of the nature of how `VirtualScroller` works: no-longer-visible items get un-rendered, and when they later become visible again, they should precisely restore their latest-rendered appearance by re-rendering from a previously preserved "state".
90
90
 
91
- * `itemHeights: number[]` — The measured heights of all items. If an item's height hasn't been measured yet then it's `undefined`. By default, items are only measured once: when they're initially rendered. If an item's height changes afterwards, then `.onItemHeightDidChange(i)` instance method must be called right after it happens (described later in the document), otherwise `VirtualScroller`'s calculations will be off. For example, if an item is a social media comment, and there's a "Show more"/"Show less" button that shows the full text of the comment, then it must call `.onItemHeightDidChange(i)` every time the comment text has been expanded or collapsed. And every change in an item's height must conceptually be a result of changing some kind of "state", be it the item's state in `VirtualScroller` updated via `.setItemState()`, or some other "state" that got updated by the application.
91
+ * The item "state" could be preserved anywhere in the application, or the developer could use `VirtualScroller`'s built-in item "state" storage. To preserve an item's state in the built-in storage, call `.setItemState(i, itemState)` instance method (described below) immediately after an item's state has changed.
92
+
93
+ * An example would be an item representing a social media comment, with a "Show more"/"Show less" button that shows or hides the full text of the comment. Immediately after the full text of a comment has been shown or hidden, it should call `.setItemState(i, { showMore: true/false })` instance method along with `.onItemHeightDidChange(i)` instance method (described below), so that next time when the item is rendered, it could restore its appearance from `virtualScroller.getState().itemStates[i]`.
94
+
95
+ * For another similar example, consider a social network feed, where each post optionally has an attachment. Suppose there's a post in the feed having a YouTube video attachment. The attachment is initially shown as a small thumbnail that expands into a full-sized embedded YouTube video player when a user clicks on it. If the expanded/collapsed state of such attachment wasn't preserved, then the following "glitch" would be observed: the user expands the video, then scrolls down so that the post with the video is no longer visible, the post gets unmounted due to going off screen, then the user scrolls back up so that the post with the video is visible again, the post gets mounted again, but the video is not expanded and instead a small thumbnail is shown because there's no previous "state" to restore from.
96
+
97
+ * In this example, besides preserving the item state itself, one should also call `.onItemHeightDidChange(i)` instance method (described below) right after the YouTube video has been expanded/collapsed.
98
+
99
+ * `itemHeights: number[]` — The measured heights of all items. If an item's height hasn't been measured yet then it's `undefined`.
100
+
101
+ * By default, items are only measured once: when they're initially rendered. If an item's height changes afterwards, then `.onItemHeightDidChange(i)` instance method must be called right after it happens (described later in the document), otherwise `VirtualScroller`'s calculations will be off. For example, if an item is a social media comment, and there's a "Show more"/"Show less" button that shows the full text of the comment, then it must call `.onItemHeightDidChange(i)` immediately after the comment text has been expanded or collapsed.
102
+
103
+ * Besides the requirement of calling `.onItemHeightDidChange(i)`, every change in an item's height must also be reflected in the actual data: the change in height must be either a result of the item's internal properties changing or it could be a result of changing the item's "state". The reason is that when an item gets hidden, it's no longer rendered, so when it becomes visible again, it should precisely restore its last-rendered appearance based on the item's properties and any persisted "state".
92
104
 
93
105
  * `verticalSpacing: number?` — Vertical item spacing. Is `undefined` until it has been measured. Is only measured once, when at least two rows of items have been rendered.
94
106
 
@@ -284,7 +296,12 @@ virtualScroller.start()
284
296
 
285
297
  * `getItemId(item)` — (advanced) When `items` are dynamically updated via `.setItems()`, `VirtualScroller` detects an "incremental" update by comparing "new" and "old" item ["references"](https://codeburst.io/explaining-value-vs-reference-in-javascript-647a975e12a0): this way, `VirtualScroller` can understand that the "new" `items` are (mostly) the same as the "old" `items` when some items get prepended or appended to the list, in which case it doesn't re-render the whole list from scratch, but rather just renders the "new" items that got prepended or appended. Sometimes though, some of the "old" items might get updated: for example, if `items` is a list of comments, then some of those comments might get edited in-between the refreshes. In that case, the edited comment object reference should change in order to indicate that the comment's content has changed and that the comment should be re-rendered (at least that's how it has to be done in React world). At the same time, changing the edited comment object reference would break `VirtualScroller`'s "incremental" update detection, and it would re-render the whole list of comments from scratch, which is not what it should be doing in such cases. So, in cases like this, `VirtualScroller` should have some way to understand that the updated item, even if its object reference has changed, is still the same as the old one, so that it doesn't break "incremental" update detection. For that, `getItemId(item)` parameter could be passed, which `VirtualScroller` would use to compare "old" and "new" items (instead of the default "reference equality" check), and that would fix the "re-rendering the whole list from scratch" issue. It can also be used when `items` are fetched from an external API, in which case all item object references change on every such fetch.
286
298
 
287
- * `onItemInitialRender(item)` — (advanced) Is called for each `item` when it's about to be rendered for the first time. Is guaranteed to be called at least once for each item rendered, though, in "asynchronous" rendering systems like React, it could be called multiple times for a given item, because "an item is calculated to be rendered" doesn't necessarily mean that the actual rendering will take place before a later calculation supercedes the former one. This function can be used to somehow "initialize" items before they're rendered for the first time. For example, consider a list of items that must be somehow "preprocessed" (parsed, enhanced, etc) before being rendered, and such "preprocessing" puts some load on the CPU (and therefore takes some time). In such case, instead of "preprocessing" the whole list of items up front, a developer could "preprocess" the items as they're being rendered, thereby eliminating any associated lag or freezing that would be inevitable have all the items been "preprocessed" up front. If a user only wants to see a few of the items, "preprocessing" all the items up front would simply be a waste.
299
+ * `onItemInitialRender(item)` — (advanced) Will be called for each `item` when it's about to be rendered for the first time. This function could be used to somehow "initialize" an item before it gets rendered for the first time. For example, consider a list of items that must be somehow "preprocessed" (parsed, enhanced, etc) before being rendered, and such "preprocessing" puts some load on the CPU (and therefore takes some time). In such case, instead of "preprocessing" the whole list of items up front, the application could "preprocess" only the items that're actually visible, preventing the unnecessary work and reducing the "time to first render".
300
+ * The function is guaranteed to be called at least once for each item that ever gets rendered.
301
+ * In more complex and non-trivial cases it could be called multiple times for a given item, so it should be written in such a way that calling it multiple times wouldn't do anything. For example, it could set a boolean flag on an item and then check that flag on each subsequent invocation.
302
+
303
+ * One example of the function being called multiple times would be when run in an "asynchronous" rendering framework like React. In such frameworks, "rendering" and "painting" are two separate actions separated in time, so one doesn't necessarily cause the other. For example, React could render a component multiple times before it actually gets painted on screen. In that example, the function would be called for a given item on each render until it finally gets painted on screen.
304
+ * Another example would be calling `VirtualScroller.setItems()` function with a "non-incremental" `items` update. An `items` update would be "non-incremental", for example, if some items got removed from the list, or some new items got inserted in the middle of the list, or the order of the items changed. In case of a "non-incremental" `items` update, `VirtualScroller` resets then previous state and basically "forgets" everything about the previous items, including the fact that the function has already been called for some of the items.
288
305
 
289
306
  <!-- * `shouldUpdateLayoutOnScreenResize(event: Event): boolean` — By default, `VirtualScroller` always performs a re-layout on window `resize` event. The `resize` event is not only triggered when a user resizes the window itself: it's also [triggered](https://developer.mozilla.org/en-US/docs/Web/API/Window/fullScreen#Notes) when the user switches into (and out of) fullscreen mode. By default, `VirtualScroller` performs a re-layout on all window `resize` events, except for ones that don't result in actual window width or height change, and except for cases when, for example, a video somewhere in a list is maximized into fullscreen. There still can be other "custom" cases: for example, when an application uses a custom "slideshow" component (rendered outside of the list DOM element) that goes into fullscreen when a user clicks a picture or a video in the list. For such "custom" cases `shouldUpdateLayoutOnScreenResize(event)` option / property can be specified. -->
290
307
 
@@ -347,17 +364,15 @@ When using custom (external) state management, contrary to the default (internal
347
364
 
348
365
  * `onItemHeightDidChange(i: number)` — (advanced) If an item's height could've changed, this function should be called immediately after the item's height has potentially changed. The function re-measures the item's height (the item must still be rendered) and re-calculates `VirtualScroller` layout. An example for using this function would be having an "Expand"/"Collapse" button in a list item.
349
366
 
350
- * There's also a convention that every change in an item's height must come as a result of changing its "state", be it the item's state that is stored internally in the `VirtualScroller` state (see `.setItemState()` function) or some other application-level state that is stored outside of the `VirtualScroller` state.
367
+ * There's also a convention that every change in an item's height must come as a result of changing the item's "state". See the descripton of `itemStates` and `itemHeights` properties of the `VirtualScroller` [state](#state) for more details.
351
368
 
352
369
  * Implementation-wise, calling `onItemHeightDidChange()` manually could be replaced with detecting item height changes automatically via [Resize Observer](https://caniuse.com/#search=Resize%20Observer) in some future version.
353
370
 
354
- * `setItemState(i: number, itemState: any?)` — (advanced) Replaces a list item's state inside `VirtualScroller` state. Use it to preserve an item's state because offscreen items get unmounted and any unsaved state is lost in the process. If an item's state is correctly preserved, it will be restored when an item gets mounted again due to becoming visible.
355
-
356
- * Calling `setItemState()` doesn't trigger a re-layout of `VirtualScroller` because changing a list item's state doesn't necessarily mean a change of its height, so a re-layout might not be required. If an item's height did change as a result of changing its state, then `VirtualScroller` layout must be updated, and to do that, call `onItemHeightDidChange(i)` right after calling `setItemState()` has taken effect.
371
+ * `setItemState(i: number, itemState: any?)` — (advanced) Preserves a list item's "state" inside `VirtualScroller`'s built-in item "state" storage. See the descripton of `itemStates` property of the `VirtualScroller` [state](#state) for more details.
357
372
 
358
- * For example, consider a social network feed, where each post optionally has an attachment. Suppose there's a post in the feed having a YouTube video attachment. The attachment is initially shown as a small thumbnail that expands into a full-sized embedded YouTube video player when a user clicks on it. If the expanded/collapsed state of such attachment wasn't stored in `VirtualScroller` state then the following scenario would be possible: the user expands the video, then scrolls down so that the post with the video is no longer visible, the post gets unmounted due to going off screen, then the user scrolls back up so that the post with the video is visible again, the post gets mounted, but the video is not expanded and instead of it a small thumbnail is shown because there's no previous "state" to restore.
373
+ * A developer could use it to preserve an item's "state" if it could change. The reason is that offscreen items get unmounted and any unsaved state is lost in the process. If an item's state is correctly preserved, the item's latest-rendered appearance could be restored from that state when the item gets mounted again due to becoming visible again.
359
374
 
360
- * In the example above, one should also call `onItemHeightDidChange(i)` right after the YouTube video has been expanded/collapsed. Otherwise, the scroll position would "jump" when the item goes off screen, because `VirtualScroller` would have based its calculations on the initially measured item height, not the "expanded" one, so it would subtract an incorrect value from the list's top margin, resulting in a "jump of content".
375
+ * Calling `setItemState()` doesn't trigger a re-layout of `VirtualScroller` because changing a list item's state doesn't necessarily mean a change of its height, so a re-layout might not be required. If an item's height did change as a result of changing its state, then `VirtualScroller` layout must be updated, and to do that, one should call `onItemHeightDidChange(i)` right after the change in the item's state has been reflected on screen.
361
376
 
362
377
  * `getItemScrollPosition(i: number): number?` — (advanced) Returns an item's scroll position inside the scrollable container. Returns `undefined` if any of the items before this item haven't been rendered yet.
363
378
 
@@ -928,6 +943,56 @@ Due to the [inherent limitations](https://gitlab.com/catamphetamine/virtual-scro
928
943
 
929
944
  Due to offscreen list items not being rendered native browser features like "Find on page", moving focus through items via `Tab` key, screen reader announcement and such won't work. A workaround for "search on page" is adding a custom "🔍 Search" input field that would filter items by their content and then call `VirtualScroller.setItems()`.
930
945
 
946
+ ### "Item index N height changed unexpectedly" warning on page load in dev mode.
947
+
948
+ `VirtualScroller` assumes there'd be no "unexpected" (unannounced) changes in items' heights. If an item's height changes for whatever reason, a developer must announce it immediately by calling `.onItemHeightDidChange(i)` instance method.
949
+
950
+ There might still be cases outside of a developer's control when items' heights do change "unexpectedly". One such case is when running an application in "development" mode and the CSS styles or custom fonts haven't loaded yet, resulting in different item height measurements "before" and "after" the page has fully loaded.
951
+
952
+ <details>
953
+
954
+ <summary>To filter out such "false" warnings, one could temporarily override <code>console.warn</code> function in development mode.</summary>
955
+
956
+ ######
957
+
958
+ ```js
959
+ const PAGE_LOAD_TIMEOUT = 1000
960
+
961
+ let consoleWarnHasBeenInstrumented = false
962
+
963
+ export default function suppressVirtualScrollerDevModePageLoadWarnings() {
964
+ if (consoleWarnHasBeenInstrumented) {
965
+ return
966
+ }
967
+ // `virtual-scroller` might produce false warnings about items changing their height unexpectedly.
968
+ // https://gitlab.com/catamphetamine/virtual-scroller/#item-index-n-height-changed-unexpectedly-warning-on-page-load-in-dev-mode
969
+ // That might be the case because Webpack hasn't yet loaded the styles by the time `virtual-scroller`
970
+ // performs its initial items measurement.
971
+ // To clear the console from such false warnings, a "page load timeout" is introduced in development mode.
972
+ if (process.env.NODE_ENV !== 'production') {
973
+ consoleWarnHasBeenInstrumented = true
974
+ const originalConsoleWarn = console.warn
975
+ const startedAt = Date.now()
976
+ let muteVirtualScrollerUnexpectedHeightChangeWarnings = true
977
+ console.warn = (...args) => {
978
+ if (muteVirtualScrollerUnexpectedHeightChangeWarnings) {
979
+ if (Date.now() - startedAt < PAGE_LOAD_TIMEOUT) {
980
+ if (args[0] === '[virtual-scroller]' && args[1] === 'Item index' && args[3] === 'height changed unexpectedly: it was') {
981
+ // Mute the warning.
982
+ console.log('(muted `virtual-scroller` warning because the page hasn\'t loaded yet)')
983
+ return
984
+ }
985
+ } else {
986
+ muteVirtualScrollerUnexpectedHeightChangeWarnings = false
987
+ }
988
+ }
989
+ return originalConsoleWarn(...args)
990
+ }
991
+ }
992
+ }
993
+ ```
994
+ </details>
995
+
931
996
  ### If only the first item is rendered on page load in dev mode.
932
997
 
933
998
  <details>
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).VirtualScroller=t()}(this,(function(){"use strict";function e(e){return(e%1==0?e:e.toFixed(2))+"px"}var t="It looks like you're using Internet Explorer which doesn't support CSS variables required for a <tbody/> container. VirtualScroller has been switched into \"bypass\" mode (render all items). See: https://gitlab.com/catamphetamine/virtual-scroller/-/issues/1";function n(){return"undefined"==typeof window||!window.document.documentMode}var i="VirtualScroller",r="VirtualScrollerStyle";function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function s(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function a(e,t){if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function l(e){var t="function"==typeof Map?new Map:void 0;return l=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;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,i)}function i(){return u(e,arguments,f(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),c(i,e)},l(e)}function u(e,t,n){return u=h()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var r=new(Function.bind.apply(e,i));return n&&c(r,n.prototype),r},u.apply(null,arguments)}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function c(e,t){return c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},c(e,t)}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}var d=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(u,e);var t,n,i,r,o,l=(t=u,n=h(),function(){var e,i=f(t);if(n){var r=f(this).constructor;e=Reflect.construct(i,arguments,r)}else e=i.apply(this,arguments);return a(this,e)});function u(e){var t=e.renderedElementIndex,n=e.renderedElementsCount,i=e.message;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),l.call(this,i||function(e){var t=e.renderedElementIndex,n=e.renderedElementsCount;return"Element with index ".concat(t," was not found in the list of Rendered Item Elements in the Items Container of Virtual Scroller. There're only ").concat(n," Elements there.")}({renderedElementIndex:t,renderedElementsCount:n}))}return i=u,r&&s(i.prototype,r),o&&s(i,o),Object.defineProperty(i,"prototype",{writable:!1}),i}(l(Error));function m(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var g=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.getElement=t}var t,n,i;return t=e,(n=[{key:"_getNthRenderedItemElement",value:function(e){var t=this.getElement().childNodes;if(e>t.length-1)throw new d({renderedElementIndex:e,renderedElementsCount:t.length});return t[e]}},{key:"getNthRenderedItemTopOffset",value:function(e){return this._getNthRenderedItemElement(e).getBoundingClientRect().top-this.getElement().getBoundingClientRect().top}},{key:"getNthRenderedItemHeight",value:function(e){return this._getNthRenderedItemElement(e).getBoundingClientRect().height}},{key:"getHeight",value:function(){return this.getElement().getBoundingClientRect().height}},{key:"clear",value:function(){for(;this.getElement().firstChild;)this.getElement().removeChild(this.getElement().firstChild)}}])&&m(t.prototype,n),i&&m(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();function p(e){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p(e)}function I(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function v(e,t){if(t&&("object"===p(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function y(e){var t="function"==typeof Map?new Map:void 0;return y=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;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,i)}function i(){return b(e,arguments,C(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),w(i,e)},y(e)}function b(e,t,n){return b=S()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var r=new(Function.bind.apply(e,i));return n&&w(r,n.prototype),r},b.apply(null,arguments)}function S(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function w(e,t){return w=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},w(e,t)}function C(e){return C=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},C(e)}var O=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&w(e,t)}(a,e);var t,n,i,r,o,s=(t=a,n=S(),function(){var e,i=C(t);if(n){var r=C(this).constructor;e=Reflect.construct(i,arguments,r)}else e=i.apply(this,arguments);return v(this,e)});function a(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),s.call(this,"[virtual-scroller] Scrollable container not found")}return i=a,r&&I(i.prototype,r),o&&I(i,o),Object.defineProperty(i,"prototype",{writable:!1}),i}(y(Error));function x(e){return x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},x(e)}function H(e,t){return H=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},H(e,t)}function R(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=P(e);if(t){var r=P(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return T(this,n)}}function T(e,t){if(t&&("object"===x(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function P(e){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},P(e)}function j(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function E(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function L(e,t,n){return t&&E(e.prototype,t),n&&E(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var B=function(){function e(t,n){j(this,e),this.getElement=t,this.getItemsContainerElement=n}return L(e,[{key:"getScrollY",value:function(){return this.getElement().scrollTop}},{key:"scrollToY",value:function(e){this.getElement().scrollTo?this.getElement().scrollTo(0,e):this.getElement().scrollTop=e}},{key:"getWidth",value:function(){if(!this.getElement())throw new O;return this.getElement().offsetWidth}},{key:"getHeight",value:function(){if(!this.getElement())throw new O;return this.getElement().offsetHeight}},{key:"getItemsContainerTopOffset",value:function(){var e=this.getElement().getBoundingClientRect().top,t=this.getElement().clientTop;return this.getItemsContainerElement().getBoundingClientRect().top-e+this.getScrollY()-t}},{key:"onScroll",value:function(e){var t=this.getElement();return t.addEventListener("scroll",e),function(){return t.removeEventListener("scroll",e)}}},{key:"onResize",value:function(e){var t;if("undefined"!=typeof ResizeObserver){var n=new ResizeObserver((function(t){t[0],e()})),i=this.getElement();n.observe(i),t=function(){return n.unobserve(i)}}var r=A(e,{itemsContainerElement:this.getItemsContainerElement()});return function(){t&&t(),r()}}}]),e}(),z=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&H(e,t)}(n,e);var t=R(n);function n(e){return j(this,n),t.call(this,(function(){return window}),e)}return L(n,[{key:"getScrollY",value:function(){return window.pageYOffset}},{key:"getWidth",value:function(){return window.innerWidth}},{key:"getHeight",value:function(){return window.innerHeight}},{key:"getItemsContainerTopOffset",value:function(){var e=document.clientTop||document.body.clientTop||0;return this.getItemsContainerElement().getBoundingClientRect().top+this.getScrollY()-e}},{key:"onResize",value:function(e){return A(e,{itemsContainerElement:this.getItemsContainerElement()})}}]),n}(B);function A(e,t){var n=t.itemsContainerElement,i=function(){document.fullscreenElement&&!document.fullscreenElement.contains(n)||e()};return window.addEventListener("resize",i),function(){return window.removeEventListener("resize",i)}}var M="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};for(var k=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){(function(){var t,n,i,r,o,s;"undefined"!=typeof performance&&null!==performance&&performance.now?e.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(e.exports=function(){return(t()-o)/1e6},n=process.hrtime,r=(t=function(){var e;return 1e9*(e=n())[0]+e[1]})(),s=1e9*process.uptime(),o=r-s):Date.now?(e.exports=function(){return Date.now()-i},i=Date.now()):(e.exports=function(){return(new Date).getTime()-i},i=(new Date).getTime())}).call(M)})),_="undefined"==typeof window?M:window,V=["moz","webkit"],D="AnimationFrame",N=_["request"+D],W=_["cancel"+D]||_["cancelRequest"+D],F=0;!N&&F<V.length;F++)N=_[V[F]+"Request"+D],W=_[V[F]+"Cancel"+D]||_[V[F]+"CancelRequest"+D];if(!N||!W){var U=0,Y=0,q=[];N=function(e){if(0===q.length){var t=k(),n=Math.max(0,16.666666666666668-(t-U));U=n+t,setTimeout((function(){var e=q.slice(0);q.length=0;for(var t=0;t<e.length;t++)if(!e[t].cancelled)try{e[t].callback(U)}catch(e){setTimeout((function(){throw e}),0)}}),Math.round(n))}return q.push({handle:++Y,callback:e,cancelled:!1}),Y},W=function(e){for(var t=0;t<q.length;t++)q[t].handle===e&&(q[t].cancelled=!0)}}var G=function(e){return N.call(_,e)};G.cancel=function(){W.apply(_,arguments)},G.polyfill=function(e){e||(e=_),e.requestAnimationFrame=N,e.cancelAnimationFrame=W};var J=G.cancel;function $(e,t){var n=Date.now(),i=G((function r(){Date.now()-n>=t?e():i=G(r)}));return{clear:function(){return J(i)}}}function K(e){e&&e.clear()}function Q(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var X=function(){function e(t){var n=t.getListTopOffset,i=t.onListTopOffsetChange;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.getListTopOffset=n,this.onListTopOffsetChange=i}var t,n,i;return t=e,(n=[{key:"onListTopOffset",value:function(e){void 0===this.listTopOffsetInsideScrollableContainer&&this.start(),this.listTopOffsetInsideScrollableContainer=e}},{key:"start",value:function(){this._isActive=!0,this.watchListTopOffset()}},{key:"isStarted",value:function(){return this._isActive}},{key:"stop",value:function(){this._isActive=!1,this.watchListTopOffsetTimer&&(K(this.watchListTopOffsetTimer),this.watchListTopOffsetTimer=void 0)}},{key:"watchListTopOffset",value:function(){var e=this,t=Date.now();!function n(){e._isActive&&(void 0!==e.listTopOffsetInsideScrollableContainer&&e.getListTopOffset()!==e.listTopOffsetInsideScrollableContainer&&e.onListTopOffsetChange(),Date.now()-t<3e3&&(e.watchListTopOffsetTimer=$(n,500)))}()}}])&&Q(t.prototype,n),i&&Q(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}(),Z={createItemsContainer:function(e){return new g(e)},createScrollableContainer:function(e,t){return e?new B(e,t):"undefined"!=typeof window?new z(t):void 0},watchListTopOffset:function(e){var t=e.getListTopOffset,n=e.onListTopOffsetChange;return new X({getListTopOffset:t,onListTopOffsetChange:n})}};function ee(e){return function(e){if(Array.isArray(e))return te(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return te(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return te(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function ne(){if(se()){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];(e=console).log.apply(e,ee(["[virtual-scroller]"].concat(n)))}}function ie(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];if(ae())return oe.apply(this,n);(e=console).warn.apply(e,ee(["[virtual-scroller]"].concat(n)))}function re(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];(e=console).error.apply(e,ee(["[virtual-scroller]"].concat(n)))}function oe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var i=function(){return new Error(["[virtual-scroller]"].concat(t).join(" "))};if("undefined"!=typeof window)re.apply(this,["ERROR"].concat(t)),setTimeout((function(){throw i()}),0);else{var r=le("VirtualScrollerCatchError");if(r)return r(i());if(le("VirtualScrollerThrowErrors"))throw i();re.apply(this,["ERROR"].concat(t))}}function se(){var e=le("VirtualScrollerDebug");if(void 0!==e)return!0===e||"debug"===e}function ae(){return le("VirtualScrollerWarningsAreErrors")}function le(e){return"undefined"!=typeof window?window[e]:"undefined"!=typeof global?global[e]:void 0}function ue(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function he(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ue(Object(n),!0).forEach((function(t){ce(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ue(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ce(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fe(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var de=function(){function e(t){var n=t.bypass,i=t.getInitialEstimatedItemHeight,r=t.getInitialEstimatedVisibleItemRowsCount,o=t.measureItemsBatchSize,s=t.getPrerenderMargin,a=t.getVerticalSpacing,l=t.getVerticalSpacingBeforeResize,u=t.getColumnsCount,h=t.getColumnsCountBeforeResize,c=t.getItemHeight,f=t.getItemHeightBeforeResize,d=t.getBeforeResizeItemsCount,m=t.getAverageItemHeight,g=t.getMaxVisibleAreaHeight,p=t.getPreviouslyCalculatedLayout;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.bypass=n,this.getInitialEstimatedItemHeight=i,this.getInitialEstimatedVisibleItemRowsCount=r,this.measureItemsBatchSize=o,this.getPrerenderMargin=s,this.getVerticalSpacing=a,this.getVerticalSpacingBeforeResize=l,this.getColumnsCount=u,this.getColumnsCountBeforeResize=h,this.getItemHeight=c,this.getItemHeightBeforeResize=f,this.getBeforeResizeItemsCount=d,this.getAverageItemHeight=m,this.getMaxVisibleAreaHeight=g,this.getPreviouslyCalculatedLayout=p}var t,n,i;return t=e,n=[{key:"getInitialLayoutValueWithFallback",value:function(e,t,n){try{return t()}catch(t){if(t instanceof O)return ne("Couldn't calculate",e,"before scrollable container is ready. Default to",n),n;throw t}}},{key:"getInitialLayoutValues",value:function(e){var t,n,i=this,r=e.itemsCount,o=e.columnsCount,s=e.beforeStart;if(r>0){var a=function(){return i.getInitialLastShownItemIndex({itemsCount:r,columnsCount:o,firstShownItemIndex:t})};t=0,n=s?this.getInitialLayoutValueWithFallback("lastShownItemIndex",a,0):a()}return{beforeItemsHeight:0,afterItemsHeight:0,firstShownItemIndex:t,lastShownItemIndex:n}}},{key:"getInitialLastShownItemIndex",value:function(e){var t=e.itemsCount,n=e.columnsCount,i=e.firstShownItemIndex;if(this.bypass)return t-1;var r=1;if(this.getMaxVisibleAreaHeight())r=this.getEstimatedRowsCountForHeight(this.getMaxVisibleAreaHeight()+this.getPrerenderMargin());else if(this.getInitialEstimatedVisibleItemRowsCount&&(r=this.getInitialEstimatedVisibleItemRowsCount(),isNaN(r)))throw new Error("[virtual-scroller] `getEstimatedVisibleItemRowsCount()` must return a number");return Math.min(i+(r*n-1),t-1)}},{key:"getEstimatedRowsCountForHeight",value:function(e){var t=this.getEstimatedItemHeight(),n=this.getVerticalSpacing();return t?Math.ceil((e+n)/(t+n)):1}},{key:"getEstimatedItemHeight",value:function(){var e=this.getAverageItemHeight();if(e)return e;if(this.getInitialEstimatedItemHeight){var t=this.getInitialEstimatedItemHeight();if(isNaN(t))throw new Error("[virtual-scroller] `getInitialEstimatedItemHeight()` must return a number");return t}return 0}},{key:"getLayoutUpdateForItemsDiff",value:function(e,t,n){var i=e.firstShownItemIndex,r=e.lastShownItemIndex,o=e.beforeItemsHeight,s=e.afterItemsHeight,a=t.prependedItemsCount,l=t.appendedItemsCount,u=n.itemsCount,h=n.columnsCount,c=n.shouldRestoreScrollPosition,f=n.onResetGridLayout,d=this.getAverageItemHeight(),m=this.getVerticalSpacing();if(l>0&&(s+=Math.ceil(l/h)*(m+d)),a>0&&(i+=a,r+=a,o+=Math.ceil(a/h)*(d+m),c&&(i=0,o=0),a%h>0)){f(),ie("~ Prepended items count",a,"is not divisible by Columns Count",h,"~"),ie("Layout reset required");var g=r-i+1;if(i=0,o=0,!c&&a>g){var p=u-((r=this.getInitialLastShownItemIndex({itemsCount:u,columnsCount:h,firstShownItemIndex:i}))+1);s=Math.ceil(p/h)*(m+d)}}return{beforeItemsHeight:o,afterItemsHeight:s,firstShownItemIndex:i,lastShownItemIndex:r}}},{key:"getItemNotMeasuredIndexes",value:function(e,t){var n=t.itemsCount,i=t.firstShownItemIndex,r=t.nonMeasuredAreaHeight,o=t.indexOfTheFirstItemInTheRow;ne("Item index",e,"height is required for calculations but hasn't been measured yet. Mark the item as \"shown\", rerender the list, measure the item's height and redo the layout.");var s=this.getColumnsCount(),a=Math.min(this.getEstimatedRowsCountForHeight(r)*s,this.measureItemsBatchSize||1/0);return void 0===i&&(i=o),{firstNonMeasuredItemIndex:e,firstShownItemIndex:i,lastShownItemIndex:Math.min(o+a-1,n-1)}}},{key:"getShownItemIndexes",value:function(e){var t=e.itemsCount,n=e.visibleAreaTop,i=e.visibleAreaBottom,r=this._getShownItemIndex({itemsCount:t,fromIndex:0,visibleAreaTop:n,visibleAreaBottom:i,findFirstShownItemIndex:!0});if(null===r)return this.getNonVisibleListShownItemIndexes();if(void 0!==r.firstNonMeasuredItemIndex)return r;var o=r,s=o.firstShownItemIndex,a=o.beforeItemsHeight;return null===(r=this._getShownItemIndex({itemsCount:t,fromIndex:s,beforeItemsHeight:a,visibleAreaTop:n,visibleAreaBottom:i,findLastShownItemIndex:!0}))?this.getNonVisibleListShownItemIndexes():void 0!==r.firstNonMeasuredItemIndex?r:{firstShownItemIndex:s,lastShownItemIndex:r.lastShownItemIndex}}},{key:"_getShownItemIndex",value:function(e){var t=e.beforeResize,n=e.itemsCount,i=e.visibleAreaTop,r=e.visibleAreaBottom,o=e.findFirstShownItemIndex,s=e.findLastShownItemIndex,a=e.fromIndex,l=e.beforeItemsHeight;if(0===a&&(l=0),void 0===l)throw new Error("[virtual-scroller] `beforeItemsHeight` not passed to `Layout.getShownItemIndexes()` when starting from index "+a);if(!t){var u=this.getBeforeResizeItemsCount();if(u>a){var h=this._getShownItemIndex(he(he({},e),{},{beforeResize:!0,itemsCount:u})),c=h.notFound,f=h.beforeItemsHeight,d=h.firstShownItemIndex,m=h.lastShownItemIndex;if(!c){var g=this.getColumnsCount();return{firstShownItemIndex:void 0===d?void 0:Math.floor(d/g)*g,lastShownItemIndex:void 0===m?void 0:Math.floor(m/g)*g,beforeItemsHeight:f}}l=f,a+=u}}for(var p=t?this.getColumnsCountBeforeResize():this.getColumnsCount(),I=t?this.getVerticalSpacingBeforeResize():this.getVerticalSpacing(),v=a;v<n;){for(var y=v,b=n>y+p?I:0,S=0,w=0;w<p&&v<n;){var C=t?this.getItemHeightBeforeResize(v):this.getItemHeight(v);if(void 0===C)return this.getItemNotMeasuredIndexes(v,{itemsCount:n,firstShownItemIndex:s?a:void 0,indexOfTheFirstItemInTheRow:y,nonMeasuredAreaHeight:r+this.getPrerenderMargin()-l});S=Math.max(S,C),w++,v++}var O=l+S,x=O>i-this.getPrerenderMargin(),H=O+b>=r+this.getPrerenderMargin();if(o){if(x)return{firstShownItemIndex:y,beforeItemsHeight:l}}else if(s&&H)return{lastShownItemIndex:Math.min(y+p-1,n-1)};l+=S+b}return t?{notFound:!0,beforeItemsHeight:l}:o?(ie("The list is supposed to be visible but no visible item has been found"),null):s?{lastShownItemIndex:n-1}:void 0}},{key:"getNonVisibleListShownItemIndexes",value:function(){var e={firstShownItemIndex:0,lastShownItemIndex:0};return void 0===this.getItemHeight(0)&&(e.firstNonMeasuredItemIndex=0),e}},{key:"getBeforeItemsHeight",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.beforeResize,i=0,r=0;if(!n){var o=this.getBeforeResizeItemsCount();o>0&&(i=this.getBeforeItemsHeight(Math.min(e,o),{beforeResize:!0}),r=o)}for(var s=n?this.getColumnsCountBeforeResize():this.getColumnsCount(),a=n?this.getVerticalSpacingBeforeResize():this.getVerticalSpacing();r<e;){for(var l=0,u=0;u<s;){var h=n?this.getItemHeightBeforeResize(r):this.getItemHeight(r);void 0===h&&(h=this.getAverageItemHeight()),l=Math.max(l,h),r++,u++}i+=l,i+=a}return i}},{key:"getAfterItemsHeight",value:function(e,t){for(var n=this.getColumnsCount(),i=0,r=e+1;r<t;){for(var o=0,s=0;s<n&&r<t;){var a=this.getItemHeight(r);void 0===a&&(a=this.getAverageItemHeight()),o=Math.max(o,a),r++,s++}i+=this.getVerticalSpacing(),i+=o}return i}},{key:"getItemTopOffset",value:function(e){for(var t=0,n=this.getBeforeResizeItemsCount(),i=0===n?0:Math.ceil(n/this.getColumnsCountBeforeResize()),r=e<n?Math.floor(e/this.getColumnsCountBeforeResize()):i,o=0;o<r;)t+=this.getItemHeightBeforeResize(o*this.getColumnsCountBeforeResize()),t+=this.getVerticalSpacingBeforeResize(),o++;for(var s=Math.floor((e-n)/this.getColumnsCount()),a=0;a<s;){for(var l=0,u=0;u<this.getColumnsCount();){var h=this.getItemHeight(n+a*this.getColumnsCount()+u);if(void 0===h)return;l=Math.max(l,h),u++}t+=l,t+=this.getVerticalSpacing(),a++}return t}}],n&&fe(t.prototype,n),i&&fe(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}(),me="scroll",ge="stopped scrolling",pe="manual",Ie="started",ve="non-measured item heights have been measured",ye="viewport width changed",be="viewport height changed",Se="viewport size unchanged",we="item height changed",Ce="items changed",Oe="list top offset changed";function xe(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var He=function(){function e(t){var n,i,r,o=this,s=t.bypass,a=t.getWidth,l=t.getHeight,u=t.listenForResize,h=t.onResizeStart,c=t.onResizeStop,f=t.onHeightChange,d=t.onWidthChange,m=t.onNoChange;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),r=function(){if(o.isActive){var e=o.width,t=o.height;o.width=o.getWidth(),o.height=o.getHeight(),o.width===e?o.height===t?o.onNoChange():o.onHeightChange(t,o.height):o.onWidthChange(e,o.width)}},(i="_onResize")in(n=this)?Object.defineProperty(n,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[i]=r,this.bypass=s,this.onHeightChange=f,this.onWidthChange=d,this.onNoChange=m,this.getWidth=a,this.getHeight=l,this.listenForResize=u,this.onResize=function(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=i.onStart,o=i.onStop;return function(){for(var i=this,s=arguments.length,a=new Array(s),l=0;l<s;l++)a[l]=arguments[l];return new Promise((function(s){n?K(n):r&&r(),n=$((function(){n=void 0,o&&o(),e.apply(i,a),s()}),t)}))}}(this._onResize,Re,{onStart:h,onStop:c})}var t,n,i;return t=e,(n=[{key:"start",value:function(){this.isActive=!0,this.bypass||(this.width=this.getWidth(),this.height=this.getHeight(),this.unlistenResize=this.listenForResize(this.onResize))}},{key:"stop",value:function(){this.isActive=!1,this.width=void 0,this.height=void 0,this.unlistenResize&&(this.unlistenResize(),this.unlistenResize=void 0)}}])&&xe(t.prototype,n),i&&xe(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}(),Re=250;function Te(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Pe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Te(Object(n),!0).forEach((function(t){je(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Te(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function je(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ee(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var Le=function(){function e(t){var n=t.getState,i=t.getVerticalSpacing,r=t.getColumnsCount;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.getState=n,this.getVerticalSpacing=i,this.getColumnsCount=r}var t,n,i;return t=e,n=[{key:"initializeFromState",value:function(e){this._includesBeforeResizeInState=Boolean(e.beforeResize)}},{key:"cleanUpBeforeResizeItemHeights",value:function(){var e=this.getState(),t=e.firstShownItemIndex,n=e.lastShownItemIndex,i=e.itemHeights,r=e.beforeResize;if(r&&t<r.itemHeights.length){ne('~ Clean up "before resize" item heights and correct scroll position ~');for(var o=0,s=Math.floor(r.itemHeights.length/this.getColumnsCount()),a=Math.min(s*this.getColumnsCount()-1,n),l=t;l<=a;){for(var u=0,h=0;h<this.getColumnsCount()&&l<=a;){var c=i[l];void 0===c&&(c=this.getAverageItemHeight()),u=Math.max(u,c),l++,h++}o+=u,o+=this.getVerticalSpacing()}for(var f=0,d=Math.min(r.itemHeights.length,n+1),m=Math.ceil(d/r.columnsCount),g=0===t?0:Math.floor((t-1)/r.columnsCount)+1;g<m;)f+=r.itemHeights[g*r.columnsCount],f+=r.verticalSpacing,g++;if(0===t)ne('Drop all "before resize" item heights');else{var p=t,I=r.itemHeights.length-1;p===I?ne("For item index",p,'— drop "before resize" height',r.itemHeights[p]):ne("For item indexes from",p,"to",I,'— drop "before resize" heights',r.itemHeights.slice(p))}return r.itemHeights.splice(t,r.itemHeights.length-t),{scrollBy:o-f,beforeResize:0===t?void 0:Pe({},r)}}}},{key:"snapshotBeforeResizeItemHeights",value:function(e){var t=e.firstShownItemIndex,n=e.newFirstShownItemIndex;e.newColumnsCount;var i=this.getColumnsCount(),r=this.getVerticalSpacing();this._includesBeforeResizeInState=!0;var o=this.getState(),s=o.beforeResize,a=o.itemHeights,l=s?s.itemHeights.length:0;if(l>0){if(s.columnsCount!==i||s.verticalSpacing!==r){for(var u=0,h=Math.ceil(l/s.columnsCount),c=0;c<h;)u+=s.itemHeights[c*s.columnsCount],u+=s.verticalSpacing,c++;for(var f=0,d=t;d<n;){for(var m=0,g=0;g<i&&d<n;)m=Math.max(m,a[d]),g++,d++;f+=m,f+=r}var p=u+f,I=Math.ceil(n/i);return new Array(n).fill(Math.max(0,p/I-r))}return s.itemHeights.concat(Be(a,n,i).slice(s.itemHeights.length))}return Be(a,n,i)}},{key:"shouldIncludeBeforeResizeValuesInState",value:function(){return this._includesBeforeResizeInState}}],n&&Ee(t.prototype,n),i&&Ee(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Be(e,t,n){e=e.slice(0,Math.ceil(t/n)*n);for(var i=0;i*n<t;){for(var r=0,o=0;o<n;)r=Math.max(r,e[i*n+o]),o++;for(o=0;o<n;)e[i*n+o]=r,o++;i++}return e.slice(0,t)}function ze(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Ae(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Me=function(){function e(t){var n=this,i=t.bypass,r=t.scrollableContainer,o=t.itemsContainer,s=t.onScroll,a=t.initialScrollPosition,l=t.onScrollPositionChange,u=t.isImmediateLayoutScheduled,h=t.hasNonRenderedItemsAtTheTop,c=t.hasNonRenderedItemsAtTheBottom,f=t.getLatestLayoutVisibleArea,d=t.getListTopOffset,m=t.getPrerenderMargin,g=t.onScrolledToTop,p=t.waitForScrollingToStop;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ae(this,"scrollByY",(function(e){n.scrollToY(n.getScrollY()+e)})),Ae(this,"onScrollListener",(function(){if(n.onScrollPositionChange&&n.onScrollPositionChange(n.getScrollY()),n.onScrolledToTop&&n.getScrollY()<n.getListTopOffset()&&n.onScrolledToTop(),!n.bypass&&!n.ignoreScrollEvents){n.cancelOnStopScrollingTimer();var e=n.getLatestLayoutVisibleArea()&&(n.getScrollY()<n.getLatestLayoutVisibleArea().top-n.getPrerenderMargin()&&n.hasNonRenderedItemsAtTheTop()||n.getScrollY()+n.scrollableContainer.getHeight()>n.getLatestLayoutVisibleArea().bottom+n.getPrerenderMargin()&&n.hasNonRenderedItemsAtTheBottom());if(ne(e?"The user has scrolled far enough: perform a re-layout":"The user is scrolling: perform a re-layout when they stop scrolling"),e||!1===n.waitForScrollingToStop)return n.onScroll();n.isImmediateLayoutScheduled()||(n.shouldCallOnScrollListenerWhenStopsScrolling=!0,n.watchOnStopScrolling())}})),this.bypass=i,this.scrollableContainer=r,this.itemsContainer=o,this.onScroll=s,this.initialScrollPosition=a,this.onScrollPositionChange=l,this.isImmediateLayoutScheduled=u,this.hasNonRenderedItemsAtTheTop=h,this.hasNonRenderedItemsAtTheBottom=c,this.getLatestLayoutVisibleArea=f,this.getListTopOffset=d,this.getPrerenderMargin=m,this.onScrolledToTop=g,this.waitForScrollingToStop=p}var t,n,i;return t=e,(n=[{key:"start",value:function(){void 0!==this.initialScrollPosition&&(this.scrollToY(this.initialScrollPosition),this.initialScrollPosition=void 0),this.onScrollPositionChange&&this.onScrollPositionChange(this.getScrollY()),this.stopListeningToScroll=this.scrollableContainer.onScroll(this.onScrollListener)}},{key:"stop",value:function(){this.stopListeningToScroll(),this.stopListeningToScroll=void 0,this.shouldCallOnScrollListenerWhenStopsScrolling=void 0,this.cancelOnStopScrollingTimer()}},{key:"scrollToY",value:function(e){this.ignoreScrollEvents=!0,this.scrollableContainer.scrollToY(e),this.ignoreScrollEvents=void 0}},{key:"getScrollY",value:function(){return this.scrollableContainer.getScrollY()}},{key:"cancelOnStopScrollingTimer",value:function(){this.onStopScrollingTimer&&(K(this.onStopScrollingTimer),this.onStopScrollingTimer=void 0)}},{key:"cancelScheduledLayout",value:function(){this.cancelOnStopScrollingTimer()}},{key:"watchOnStopScrolling",value:function(){var e=this;this.onStopScrollingTimer=$((function(){e.onStopScrollingTimer=void 0,e.shouldCallOnScrollListenerWhenStopsScrolling&&(e.shouldCallOnScrollListenerWhenStopsScrolling=void 0,e.onScroll({delayed:!0}))}),ke)}},{key:"getVisibleAreaBounds",value:function(){var e=this.getScrollY();return{top:e,bottom:e+this.scrollableContainer.getHeight()}}}])&&ze(t.prototype,n),i&&ze(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}(),ke=100;function _e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var Ve=function(){function e(t){var n=t.itemsContainer,i=t.getListTopOffset;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.itemsContainer=n,this.getListTopOffset=i}var t,n,i;return t=e,(n=[{key:"snapshotListHeightBeforeAddingNewItems",value:function(e){var t=e.previousItems,n=e.newItems,i=e.prependedItemsCount;0!==t.length&&0!==i&&(this._snapshot={previousItems:t,newItems:n,itemIndex:i,itemTopOffset:this.itemsContainer.getNthRenderedItemTopOffset(0),listTopOffset:this.getListTopOffset()})}},{key:"getAnchorItemIndex",value:function(){return this._snapshot.itemIndex}},{key:"hasSnapshot",value:function(){return void 0!==this._snapshot}},{key:"getListBottomOffsetChange",value:function(){var e=this._snapshot,t=e.itemIndex,n=e.itemTopOffset,i=e.listTopOffset;return this.itemsContainer.getNthRenderedItemTopOffset(t)-n+(this.getListTopOffset()-i)}},{key:"reset",value:function(){this._snapshot=void 0}}])&&_e(t.prototype,n),i&&_e(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();function De(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var Ne=function(){function e(t){var n=t.container;t.itemHeights;var i=t.getItemHeight,r=t.setItemHeight;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.container=n,this._get=i,this._set=r,this.reset()}var t,n,i;return t=e,n=[{key:"reset",value:function(){this.measuredItemsHeight=0,this.firstMeasuredItemIndex=void 0,this.lastMeasuredItemIndex=void 0}},{key:"readItemHeightsFromState",value:function(e){for(var t=e.itemHeights,n=0;n<t.length;){if(void 0===t[n]){if(void 0!==this.firstMeasuredItemIndex){this.lastMeasuredItemIndex=n-1;break}}else void 0===this.firstMeasuredItemIndex&&(this.firstMeasuredItemIndex=n),this.measuredItemsHeight+=t[n];n++}}},{key:"_measureItemHeight",value:function(e,t){return this.container.getNthRenderedItemHeight(e-t)}},{key:"measureItemHeights",value:function(e,t){if(ne("~ Measure item heights ~"),void 0!==e){void 0!==this.firstMeasuredItemIndex&&(e>this.lastMeasuredItemIndex+1||t<this.firstMeasuredItemIndex-1)&&(ne("Non-measured items gap detected. Reset first and last measured item indexes."),this.reset());for(var n=[],i=this.firstMeasuredItemIndex,r=this.lastMeasuredItemIndex,o=!1,s=e;s<=t;){if(void 0===this._get(s)){n.push(s);var a=this._measureItemHeight(s,e);ne("Item index",s,"height",a),this._set(s,a),(void 0===i||s<i)&&(this.measuredItemsHeight+=a,o||(this.firstMeasuredItemIndex=s,o=!0)),(void 0===r||s>r)&&(void 0!==r&&(this.measuredItemsHeight+=a),this.lastMeasuredItemIndex=s)}else{var l=this._get(s),u=this._measureItemHeight(s,e);l!==u&&(ie("Item index",s,"height changed unexpectedly: it was",l,"before, but now it is",u,'. An item\'s height is allowed to change only in two cases: when the item\'s "state" changes and the developer calls `setItemState(i, newState)`, or when the item\'s height changes for any reason and the developer calls `onItemHeightDidChange(i)` right after that happens. Perhaps you forgot to persist the item\'s "state" by calling `setItemState(i, newState)` when it changed, and that "state" got lost when the item element was unmounted, which resulted in a different height when the item was shown again having its "state" reset.'),this._set(s,u))}s++}return n}}},{key:"remeasureItemHeight",value:function(e,t){var n=this._get(e),i=this._measureItemHeight(e,t);return this._set(e,i),this.measuredItemsHeight+=i-n,i}},{key:"getAverage",value:function(){return void 0===this.lastMeasuredItemIndex?0:this.measuredItemsHeight/(this.lastMeasuredItemIndex-this.firstMeasuredItemIndex+1)}},{key:"onPrepend",value:function(e){void 0!==this.firstMeasuredItemIndex&&(this.firstMeasuredItemIndex+=e,this.lastMeasuredItemIndex+=e)}}],n&&De(t.prototype,n),i&&De(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();function We(e,t){for(var n=0;n<e.length;)e[n]=t(n),n++;return e}function Fe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Ue(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fe(Object(n),!0).forEach((function(t){Ye(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ye(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qe(e){var t=Ue({},e);return e.itemHeights&&(t.itemHeights=e.itemHeights.slice()),e.itemStates&&(t.itemStates=e.itemStates.slice()),e.beforeResize&&(t.beforeResize=Ue({},e.beforeResize),t.beforeResize.itemHeights=e.beforeResize.itemHeights.slice()),t}function Ge(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Je(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ge(Object(n),!0).forEach((function(t){$e(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ge(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function $e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ke(e){var t=this,n=e.state,i=e.getInitialItemState,r=e.onStateChange,o=e.render,s=e.items;function a(){return this.state}function l(e){this.state=e}function u(e,t){this.state=e,o(this.state,this.previousState),this.onRender()}function h(e){var t=e.getInitialItemState,n=s,i=Je(Je({},f.call(this,n,{beforeStart:!0})),{},{items:n,itemStates:We(new Array(n.length),(function(e){return t(n[e])}))});return se()&&ne("Initial state (autogenerated)",qe(i)),ne("First shown item index",i.firstShownItemIndex),ne("Last shown item index",i.lastShownItemIndex),i}function c(e){return se()&&ne("Restore state",qe(e)),function(e,t){var n=t.columnsCount,i=e.columnsCount||1;if(i!==n)return ie("~ Columns Count changed from",i,"to",n,"~"),!0;if(Math.floor(e.firstShownItemIndex/n)*n!==e.firstShownItemIndex)return ie("~ First Shown Item Index",e.firstShownItemIndex,"is not divisible by Columns Count",n,"~"),!0}(e=Je(Je({},e=function(e){return e.beforeResize&&0===e.beforeResize.itemHeights.length&&(e.beforeResize=void 0),e}(e)),{},{verticalSpacing:void 0}),{columnsCount:this.getActualColumnsCount()})&&(ie("Reset Layout"),e=Je(Je({},e),f.call(this,e.items,{beforeStart:!1}))),e}function f(e,t){var n=this,i=t.beforeStart,r=e.length,o=function(){return n.getActualColumnsCount()};i?this.layout.getInitialLayoutValueWithFallback("columnsCount",o,1):o();var s=this.layout.getInitialLayoutValues({itemsCount:r,columnsCount:this.getActualColumnsCount(),beforeStart:i}),a=s.firstShownItemIndex,l=s.lastShownItemIndex,u=s.beforeItemsHeight,h=s.afterItemsHeight,c=new Array(r);return this.onBeforeShowItems(e,c,a,l),{itemHeights:c,columnsCount:this.getActualColumnsCountForState(),verticalSpacing:this.verticalSpacing,firstShownItemIndex:a,lastShownItemIndex:l,beforeItemsHeight:u,afterItemsHeight:h}}this.onStateChange=r,this._render=o,this.getInitialItemState=i,this._setItemState=function(e,n){se()&&(ne("~ Item state changed ~"),ne("Item index",e),ne("Previous state\n"+JSON.stringify(t.getState().itemStates[e],null,2)),ne("New state\n"+JSON.stringify(n,null,2))),t.getState().itemStates[e]=n,t.newItemsWillBeRendered&&(t.itemStatesThatChangedWhileNewItemsWereBeingRendered||(t.itemStatesThatChangedWhileNewItemsWereBeingRendered={}),t.itemStatesThatChangedWhileNewItemsWereBeingRendered[String(e)]=n)},this.getState=function(){return t._getState()},this.updateState=function(e){se()&&(ne("~ Set state ~"),ne(qe(e))),e.items&&(t._isSettingNewItems||oe("A `stateUpdate` can only contain `items` property as a result of calling `.setItems()`")),t._isSettingNewItems=void 0,t.waitingForRender=!0,t.previousState=t.getState(),t.mostRecentSetStateValue||(t.mostRecentSetStateValue=t.getState()),t.mostRecentSetStateValue=Je(Je({},t.mostRecentSetStateValue),e),t._setState(t.mostRecentSetStateValue,e)},this.getInitialState=function(){return n?c.call(t,n):h.call(t,{getInitialItemState:i})},this.useState=function(e){var n=e.getState,i=e.setState,r=e.updateState;if(t._isActive)throw new Error("[virtual-scroller] `VirtualScroller` has already been started");if(t._getState)throw new Error("[virtual-scroller] Custom state storage has already been configured");if(o)throw new Error("[virtual-scroller] Creating a `VirtualScroller` class instance with a `render()` parameter implies using the default (internal) state storage");if(i&&r)throw new Error("[virtual-scroller] When using a custom state storage, one must supply either `setState()` or `updateState()` function but not both");if(!n||!i&&!r)throw new Error("[virtual-scroller] When using a custom state storage, one must supply both `getState()` and `setState()`/`updateState()` functions");t._usesCustomStateStorage=!0,t._getState=n,t._setState=function(e,t){i?i(e):r(t)}},this.useDefaultStateStorage=function(){if(!o)throw new Error("[virtual-scroller] When using the default (internal) state management, one must supply a `render(state, prevState)` function parameter");t._getState=a.bind(t),t._setState=u.bind(t),l.bind(t)(t.getInitialState())}}function Qe(){var e=this;function t(){var e=this.getState(),t=e.firstShownItemIndex,n=e.lastShownItemIndex;ne("~ Measure item vertical spacing ~");var i=function(e){var t=e.itemsContainer,n=e.renderedItemsCount;if(n>1)for(var i=t.getNthRenderedItemTopOffset(0),r=t.getNthRenderedItemHeight(0),o=1;o<n;){var s=t.getNthRenderedItemTopOffset(o),a=t.getNthRenderedItemHeight(o);if(s!==i)return s-(i+r);r=Math.max(r,a),o++}}({itemsContainer:this.itemsContainer,renderedItemsCount:n-t+1});if(void 0!==i)return ne("Item vertical spacing",i),i;ne("Not enough items rendered to measure vertical spacing")}this.getVerticalSpacing=function(){return e.verticalSpacing||0},this.getVerticalSpacingBeforeResize=function(){var t=e.getState().beforeResize;return t&&t.verticalSpacing||0},this.measureVerticalSpacingIfNotMeasured=function(){if(void 0===e.verticalSpacing)return e.verticalSpacing=t.call(e),e.verticalSpacing}}function Xe(e){var t=this,n=e.getColumnsCount;if(n){var i={getWidth:function(){return t.scrollableContainer.getWidth()}};this.getActualColumnsCountForState=function(){var e=n(i);if(1!==e)return e}}else this.getActualColumnsCountForState=function(){};this.getActualColumnsCount=function(){return t.getActualColumnsCountForState()||1},this.getColumnsCount=function(){return t.getState()&&t.getState().columnsCount||1}}function Ze(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function et(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ze(Object(n),!0).forEach((function(t){tt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ze(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function tt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nt(){var e=this;function t(e){var n=e.stateUpdate,o=Date.now(),s=i.call(this),a=s.firstShownItemIndex,l=s.lastShownItemIndex,u=s.shownItemsHeight,h=s.firstNonMeasuredItemIndex;if(this.listHeightMeasurement.hasSnapshot()&&(l<this.listHeightMeasurement.getAnchorItemIndex()&&(l=this.listHeightMeasurement.getAnchorItemIndex()),h=void 0),!r.call(this,a,l))return ne("~ Because some of the will-be-hidden item heights (listed above) have changed since they've last been measured, redo layout. ~"),t.call(this,{stateUpdate:n});var c=this.layout.getBeforeItemsHeight(a),f=this.layout.getAfterItemsHeight(l,this.getItemsCount()),d=Date.now()-o;ne("~ Calculated Layout"+(this.bypass?" (bypass)":"")+" ~"),d<it||ie("Layout calculated in",d,"ms"),this.getColumnsCount()&&ne("Columns count",this.getColumnsCount()),ne("First shown item index",a),ne("Last shown item index",l),ne("Before items height",c),ne("After items height (actual or estimated)",f),ne("Average item height (used for estimated after items height calculation)",this.itemHeights.getAverage()),se()&&(ne("Item heights",this.getState().itemHeights.slice()),ne("Item states",this.getState().itemStates.slice())),this.onBeforeShowItems(this.getState().items,this.getState().itemHeights,a,l),this.firstNonMeasuredItemIndex=h,this.previouslyCalculatedLayout=void 0===u?void 0:{firstShownItemIndex:a,lastShownItemIndex:l,beforeItemsHeight:c,shownItemsHeight:u},this.updateState(et({firstShownItemIndex:a,lastShownItemIndex:l,beforeItemsHeight:c,afterItemsHeight:f},n))}function n(){var e=this.scroll.getVisibleAreaBounds();this.latestLayoutVisibleArea=e;var t=this.getListTopOffsetInsideScrollableContainer();return{top:e.top-t,bottom:e.bottom-t}}function i(){var e=this.getItemsCount(),t=n.call(this),i=t.top,r=t.bottom;return this.bypass?{firstShownItemIndex:0,lastShownItemIndex:e-1}:i<this.itemsContainer.getHeight()&&r>0?this.layout.getShownItemIndexes({itemsCount:this.getItemsCount(),visibleAreaTop:i,visibleAreaBottom:r}):(ne("The entire list is off-screen. No items are visible."),this.layout.getNonVisibleListShownItemIndexes())}function r(e,t){for(var n=!0,i=this.getState().firstShownItemIndex;i<=this.getState().lastShownItemIndex;){if(i>=e&&i<=t);else{var r=this.getState().itemHeights[i],a=o.call(this,i);a!==r&&(n&&(ne("~ Validate will-be-hidden item heights. ~"),s.call(this,i,r,a)),n=!1,ie("Item index",i,"is no longer visible and will be unmounted. Its height has changed from",r,"to",a,"since it was last measured. This is not necessarily a bug, and could happen, for example, on screen width change, or when there're several `onItemHeightDidChange(i)` calls issued at the same time, and the first one triggers a re-layout before the rest of them have had a chance to be executed."))}i++}return n}function o(e){var t=this.getState().firstShownItemIndex;return this.itemHeights.remeasureItemHeight(e,t)}function s(e,t,n){var i=this.previouslyCalculatedLayout;if(i){var r=n-t;e<i.firstShownItemIndex?i.beforeItemsHeight+=r:e>i.lastShownItemIndex?void 0!==i.afterItemsHeight&&(i.afterItemsHeight+=r):i.shownItemsHeight+=n-t}}this.onUpdateShownItemIndexes=function(n){var i=n.reason,r=n.stateUpdate,o=function(){r&&e.updateState(r)};return e.newItemsWillBeRendered||e.widthHasChanged||e._isResizing||0===e.getItemsCount()?o():(e.scroll.cancelScheduledLayout(),r=e.cancelLayoutTimer({stateUpdate:r}),ne("~ Update Layout (on ".concat(i,") ~")),void t.call(e,{stateUpdate:r}))},this.getListTopOffsetInsideScrollableContainer=function(){var t=e.scrollableContainer.getItemsContainerTopOffset();return e.listTopOffsetWatcher&&e.listTopOffsetWatcher.onListTopOffset(t),t},this._onItemHeightDidChange=function(t){ne("~ On Item Height Did Change was called ~"),ne("Item index",t);var n=e.getState(),i=n.itemHeights,r=n.firstShownItemIndex,a=n.lastShownItemIndex;if(!(t>=r&&t<=a))return ie("The item is no longer rendered. This is not necessarily a bug, and could happen, for example, when when a developer calls `onItemHeightDidChange(i)` while looping through a batch of items.");var l,u=i[t];if(void 0===u)return oe('"onItemHeightDidChange()" has been called for item index '.concat(t," but the item hasn't been rendered before."));ne("~ Re-measure item height ~");try{l=o.call(e,t)}catch(e){if(e instanceof d)return oe('"onItemHeightDidChange()" has been called for item index '.concat(t," but the item is not currently rendered and can't be measured. The exact error was: ").concat(e.message))}ne("Previous height",u),ne("New height",l),u!==l&&(ne("~ Item height has changed. Should update layout. ~"),s.call(e,t,u,l),e.waitingForRender?(ne("~ Another state update is already waiting to be rendered. Delay the layout update until then. ~"),e.updateLayoutAfterRenderBecauseItemHeightChanged=!0):e.onUpdateShownItemIndexes({reason:we}),e.newItemsWillBeRendered&&(e.itemHeightsThatChangedWhileNewItemsWereBeingRendered||(e.itemHeightsThatChangedWhileNewItemsWereBeingRendered={}),e.itemHeightsThatChangedWhileNewItemsWereBeingRendered[String(t)]=l))},this.getPrerenderMargin=function(){return 1*e.scrollableContainer.getHeight()},this.onBeforeShowItems=function(t,n,i,r){if(e.onItemInitialRender)for(var o=i;o<=r;)void 0===n[o]&&e.onItemInitialRender(t[o]),o++},this.measureItemHeightsAndSpacing=function(){e.itemHeights.measureItemHeights(e.getState().firstShownItemIndex,e.getState().lastShownItemIndex);var t=e.measureVerticalSpacingIfNotMeasured();if(t&&0!==t)return{verticalSpacing:t}},this.cancelLayoutTimer=function(t){var n=t.stateUpdate;return e.layoutTimer?(K(e.layoutTimer),e.layoutTimer=void 0,n||e.layoutTimerStateUpdate?(n=et(et({},e.layoutTimerStateUpdate),n),e.layoutTimerStateUpdate=void 0,n):void 0):n},this.scheduleLayoutTimer=function(t){var n=t.reason,i=t.stateUpdate;e.layoutTimerStateUpdate=i,e.layoutTimer=$((function(){e.layoutTimerStateUpdate=void 0,e.layoutTimer=void 0,e.onUpdateShownItemIndexes({reason:n,stateUpdate:i})}),0)}}var it=15;function rt(e){return rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rt(e)}var ot=Object.prototype.hasOwnProperty;function st(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function at(e,t){if(st(e,t))return!0;if("object"!==rt(e)||null===e||"object"!==rt(t)||null===t)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(var r=0;r<n.length;r++)if(!ot.call(t,n[r])||!st(e[n[r]],t[n[r]]))return!1;return!0}function lt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function ut(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?lt(Object(n),!0).forEach((function(t){ht(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ht(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ct(){var t=this;function n(e,t){if(e){var n=e.prependedItemsCount;e.appendedItemsCount;var i=this.getState(),r=i.itemHeights,o=i.itemStates;if(this.itemHeightsThatChangedWhileNewItemsWereBeingRendered)for(var s=0,a=Object.keys(this.itemHeightsThatChangedWhileNewItemsWereBeingRendered);s<a.length;s++){var l=a[s];r[n+Number(l)]=this.itemHeightsThatChangedWhileNewItemsWereBeingRendered[l]}if(this.itemStatesThatChangedWhileNewItemsWereBeingRendered)for(var u=0,h=Object.keys(this.itemStatesThatChangedWhileNewItemsWereBeingRendered);u<h.length;u++){var c=h[u];o[n+Number(c)]=this.itemStatesThatChangedWhileNewItemsWereBeingRendered[c]}if(0===n)return this.previouslyCalculatedLayout&&(this.previouslyCalculatedLayout.firstShownItemIndex===t.firstShownItemIndex&&this.previouslyCalculatedLayout.lastShownItemIndex===t.lastShownItemIndex||(ie('Unexpected (non-matching) "firstShownItemIndex" or "lastShownItemIndex" encountered in "onRender()" after appending items'),ie("Previously calculated layout",this.previouslyCalculatedLayout),ie("New layout",t),this.previouslyCalculatedLayout=void 0)),"SEAMLESS_APPEND";if(this.listHeightMeasurement.hasSnapshot()){if(0===t.firstShownItemIndex){ne("~ Restore Scroll Position ~");var f=this.listHeightMeasurement.getListBottomOffsetChange({beforeItemsHeight:t.beforeItemsHeight});return this.listHeightMeasurement.reset(),f?(ne("Scroll down by",f),this.scroll.scrollByY(f)):ne("Scroll position hasn't changed"),this.previouslyCalculatedLayout&&(0===this.previouslyCalculatedLayout.firstShownItemIndex&&this.previouslyCalculatedLayout.lastShownItemIndex===t.lastShownItemIndex-n?this.previouslyCalculatedLayout={beforeItemsHeight:0,shownItemsHeight:this.previouslyCalculatedLayout.shownItemsHeight+f,firstShownItemIndex:0,lastShownItemIndex:t.lastShownItemIndex}:(ie('Unexpected (non-matching) "firstShownItemIndex" or "lastShownItemIndex" encountered in "onRender()" after prepending items'),ie("Previously calculated layout",this.previouslyCalculatedLayout),ie("New layout",t),this.previouslyCalculatedLayout=void 0)),"SEAMLESS_PREPEND"}ie('Unexpected "firstShownItemIndex" '.concat(t.firstShownItemIndex,' encountered in "onRender()" after prepending items. Expected 0.'))}}this.previouslyCalculatedLayout=void 0}function i(e){var t=e.reason,n=e.stateUpdate;this._useTimeoutInRenderLoop?(n=this.cancelLayoutTimer({stateUpdate:n}),this.scheduleLayoutTimer({reason:t,stateUpdate:n})):this.onUpdateShownItemIndexes({reason:t,stateUpdate:n})}function r(){var e=Boolean(this.widthHasChanged);this.widthHasChanged=void 0;var t=void 0!==this.firstNonMeasuredItemIndex;t&&ne("Non-measured item index",this.firstNonMeasuredItemIndex),this.firstNonMeasuredItemIndex=void 0,this.newItemsWillBeRendered=void 0,this.itemHeightsThatChangedWhileNewItemsWereBeingRendered=void 0,this.itemStatesThatChangedWhileNewItemsWereBeingRendered=void 0;var n=this.updateLayoutAfterRenderBecauseItemHeightChanged;return this.updateLayoutAfterRenderBecauseItemHeightChanged=void 0,{nonMeasuredItemsHaveBeenRendered:t,itemHeightHasChanged:n,widthHasChanged:e}}this._onRender=function(o,s){var a,l,u;t.waitingForRender=!1,ne("~ Rendered ~"),se()&&ne("State",qe(o)),t.onStateChange&&(at(o,s)||t.onStateChange(o)),t.tbody&&(a=t.getItemsContainerElement(),l=o.beforeItemsHeight,u=o.afterItemsHeight,a.style.setProperty("--VirtualScroller-paddingTop",e(l)),a.style.setProperty("--VirtualScroller-paddingBottom",e(u))),t.mostRecentSetStateValue&&(at(o,t.mostRecentSetStateValue)||(ie("The most recent state that was set",qe(t.mostRecentSetStateValue)),oe("The state that has been rendered is not the most recent one that was set")));var h,c=r.call(t),f=c.nonMeasuredItemsHaveBeenRendered,d=c.itemHeightHasChanged,m=c.widthHasChanged;if(d&&(h=we),s||h){if(f&&(h=ve),m&&(h=ye,t.itemHeights.reset(),t.verticalSpacing=void 0),s){var g=s.items,p=o.items;if(p!==g){var I=t.getItemsDiff(g,p);if(I){var v=I.prependedItemsCount;t.itemHeights.onPrepend(v)}else t.itemHeights.reset();m||"SEAMLESS_PREPEND"!==n.call(t,I,o)&&(h=Ce)}}var y;if(s&&(o.firstShownItemIndex!==s.firstShownItemIndex||o.lastShownItemIndex!==s.lastShownItemIndex||o.items!==s.items)||m){var b=t.measureItemHeightsAndSpacing();b&&(y=ut(ut({},y),b))}var S=t.beforeResize.cleanUpBeforeResizeItemHeights();if(void 0!==S){var w=S.scrollBy,C=S.beforeResize;ne("Correct scroll position by",w),t.scroll.scrollByY(w),y=ut(ut({},y),{},{beforeResize:C})}t._isActive?h?i.call(t,{stateUpdate:y,reason:h}):y?t.updateState(y):ne("~ Finished Layout ~"):t._stoppedStateUpdate=y}}}function ft(){var e=this;this.onResize=function(){e.previouslyCalculatedLayout=void 0,e.listHeightMeasurement.reset();var t=e.newItemsWillBeRendered?e.newItemsWillBeRendered.count:e.getState().itemHeights.length,n=e.newItemsWillBeRendered?e.newItemsWillBeRendered.layout:e.getState(),i={scrollableContainerWidth:e.scrollableContainer.getWidth(),firstShownItemIndex:n.firstShownItemIndex,lastShownItemIndex:n.lastShownItemIndex,beforeItemsHeight:n.beforeItemsHeight,afterItemsHeight:n.afterItemsHeight,itemHeights:new Array(t),columnsCount:e.getActualColumnsCountForState(),verticalSpacing:void 0},r=n.firstShownItemIndex,o=n.lastShownItemIndex,s=e.getActualColumnsCount(),a=Math.floor(r/s)*s,l=Math.min(Math.ceil((o+1)/s)*s,t)-1;a!==r&&(ne("Columns Count changed from",e.getState().columnsCount||1,"to",s),ne("First Shown Item Index needs to change from",r,"to",a)),i.firstShownItemIndex=a,i.lastShownItemIndex=l;var u=e.getVerticalSpacing(),h=e.getColumnsCount();e.shouldDiscardBeforeResizeItemHeights()||0===a?e.beforeResize.shouldIncludeBeforeResizeValuesInState()&&(i.beforeResize=void 0):i.beforeResize={verticalSpacing:u,columnsCount:h,itemHeights:e.beforeResize.snapshotBeforeResizeItemHeights({firstShownItemIndex:r,newFirstShownItemIndex:a,newColumnsCount:s})},e.widthHasChanged={stateUpdate:i},e.updateState(i)},this.shouldDiscardBeforeResizeItemHeights=function(){if(e.newItemsWillBeRendered){var t=e.newItemsWillBeRendered,n=t.prepend,i=t.replace;return n||i}}}function dt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function mt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?dt(Object(n),!0).forEach((function(t){gt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function gt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pt(){var e=this;this.getItemsCount=function(){return e.getState().items.length},this._setItems=function(t){var n,i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=e.getState(),s=o.items,a=e.getState(),l=a.itemStates,u=e.widthHasChanged?e.widthHasChanged.stateUpdate:e.getState(),h=u.itemHeights;ne("~ Update items ~");var c=e.getItemsDiff(s,t);if(c){var f,d=e.widthHasChanged?e.widthHasChanged.stateUpdate:e.getState(),m=d.firstShownItemIndex,g=d.lastShownItemIndex,p=d.beforeItemsHeight,I=d.afterItemsHeight,v=0===m&&(r.preserveScrollPositionOnPrependItems||r.preserveScrollPosition),y=c.prependedItemsCount,b=c.appendedItemsCount;n=e.layout.getLayoutUpdateForItemsDiff({firstShownItemIndex:m,lastShownItemIndex:g,beforeItemsHeight:p,afterItemsHeight:I},{prependedItemsCount:y,appendedItemsCount:b},{itemsCount:t.length,columnsCount:e.getActualColumnsCount(),shouldRestoreScrollPosition:v,onResetGridLayout:function(){return f=!0}}),y>0&&(ne("Prepend",y,"items"),h=new Array(y).concat(h),l=We(new Array(y),(function(n){return e.getInitialItemState(t[n])})).concat(l),v?(ne("Will restore scroll position"),e.listHeightMeasurement.snapshotListHeightBeforeAddingNewItems({previousItems:s,newItems:t,prependedItemsCount:y}),void 0!==e.firstNonMeasuredItemIndex&&(e.firstNonMeasuredItemIndex+=y)):(ne("Reset layout"),f?(ne("Reason: Prepended items count",y,"is not divisible by Columns Count",e.getActualColumnsCount()),h=new Array(t.length)):ne("Reason: Prepended items' heights are unknown"),n=e.layout.getInitialLayoutValues({itemsCount:t.length,columnsCount:e.getActualColumnsCount()}),e.firstNonMeasuredItemIndex=void 0)),b>0&&(ne("Append",b,"items"),h=h.concat(new Array(b)),l=l.concat(We(new Array(b),(function(n){return e.getInitialItemState(t[y+s.length+n])})))),i={prepend:y>0,append:b>0}}else ne("Items have changed, and",c?"a re-layout from scratch has been requested.":"it's not a simple append and/or prepend.","Rerender the entire list from scratch."),ne("Previous items",s),ne("New items",t),h=new Array(t.length),l=We(new Array(t.length),(function(n){return e.getInitialItemState(t[n])})),n=e.layout.getInitialLayoutValues({itemsCount:t.length,columnsCount:e.getActualColumnsCount()}),e.firstNonMeasuredItemIndex=void 0,e.listHeightMeasurement.reset(),i={replace:!0};ne("~ Update state ~"),ne("First shown item index",n.firstShownItemIndex),ne("Last shown item index",n.lastShownItemIndex),ne("Before items height",n.beforeItemsHeight),ne("After items height (actual or estimated)",n.afterItemsHeight),e.onBeforeShowItems(t,h,n.firstShownItemIndex,n.lastShownItemIndex),e.newItemsWillBeRendered=mt(mt({},i),{},{count:t.length,layout:n});var S=mt(mt({},n),{},{items:t,itemStates:l,itemHeights:h});e.beforeResize.shouldIncludeBeforeResizeValuesInState()&&(e.shouldDiscardBeforeResizeItemHeights()?S.beforeResize=void 0:S.beforeResize=e.widthHasChanged?e.widthHasChanged.stateUpdate.beforeResize:e.getState().beforeResize),e._isSettingNewItems=!0,e.updateState(S)},this.getItemsDiff=function(t,n){return function(e,t,n){var i=-1,r=-1;if(e.length>0&&(i=function(e,t,n){for(var i=0;i<e.length;){if(n(e[i],t))return i;i++}return-1}(t,e[0],n),i>=0&&function(e,t,n,i){for(var r=0;r<e.length;){if(t.length<=n+r||!i(t[n+r],e[r]))return!1;r++}return!0}(e,t,i,n)&&(r=i+e.length-1)),i>=0&&r>=0)return{prependedItemsCount:i,appendedItemsCount:t.length-(r+1)}}(t,n,e.isItemEqual)}}function It(e,i){var r=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=o.render,a=o.state,l=o.getInitialItemState,u=void 0===l?function(){}:l,h=o.onStateChange,c=o.initialScrollPosition,f=o.onScrollPositionChange,d=o.scrollableContainer,m=o.measureItemsBatchSize,g=void 0===m?50:m,p=o.getColumnsCount,I=o.getItemId,v=o.tbody,y=o.estimatedItemHeight,b=o.getEstimatedVisibleItemRowsCount,S=o.onItemInitialRender,w=o.onItemFirstRender,C=o._useTimeoutInRenderLoop,O=o._waitForScrollingToStop,x=o.engine,H=o.bypass,R=o.getEstimatedItemHeight,T=o.getScrollableContainer;if(ne("~ Initialize ~"),this.engine=x||Z,R||"number"!=typeof y||(R=function(){return y}),!T&&d&&(T=function(){return d}),this.getItemsContainerElement=e,o.getState||o.setState)throw new Error("[virtual-scroller] `getState`/`setState` options usage has changed in the new version. See the readme for more details.");if(v){if(this.engine!==Z)throw new Error("[virtual-scroller] `tbody` option is only supported for DOM rendering engine");ne("~ <tbody/> detected ~"),this.tbody=!0,n()||(ne("~ <tbody/> not supported ~"),oe(t),H=!0)}H&&ne('~ "bypass" mode ~'),this.bypass=H,this._useTimeoutInRenderLoop=C,this.isItemEqual=I?function(e,t){return I(e)===I(t)}:function(e,t){return e===t},S?this.onItemInitialRender=S:w&&(this.onItemInitialRender=function(e){ie("`onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.");var t=r.getState().items.indexOf(e);t>=0&&w(t)}),a&&(i=a.items),ne("Items count",i.length),R&&ne("Estimated item height",R()),Ke.call(this,{state:a,getInitialItemState:u,onStateChange:h,render:s,items:i}),Qe.call(this),Xe.call(this,{getColumnsCount:p}),nt.call(this),ct.call(this),ft.call(this),pt.call(this),vt.call(this,{getScrollableContainer:T,getEstimatedItemHeight:R,getEstimatedVisibleItemRowsCount:b,measureItemsBatchSize:g,initialScrollPosition:c,onScrollPositionChange:f,waitForScrollingToStop:O}),a&&(this.itemHeights.readItemHeightsFromState(a),this.beforeResize.initializeFromState(a))}function vt(e){var t=this,n=e.getScrollableContainer,i=e.getEstimatedItemHeight,r=e.getEstimatedVisibleItemRowsCount,o=e.measureItemsBatchSize,s=e.initialScrollPosition,a=e.onScrollPositionChange,l=e.waitForScrollingToStop;this.itemsContainer=this.engine.createItemsContainer(this.getItemsContainerElement),this.getItemsContainerElement()&&this.itemsContainer.clear(),this.scrollableContainer=this.engine.createScrollableContainer(n,this.getItemsContainerElement),this.itemHeights=new Ne({container:this.itemsContainer,getItemHeight:function(e){return t.getState().itemHeights[e]},setItemHeight:function(e,n){return t.getState().itemHeights[e]=n}}),this.layout=new de({bypass:this.bypass,getInitialEstimatedItemHeight:i,getInitialEstimatedVisibleItemRowsCount:r,measureItemsBatchSize:o,getPrerenderMargin:function(){return t.getPrerenderMargin()},getVerticalSpacing:function(){return t.getVerticalSpacing()},getVerticalSpacingBeforeResize:function(){return t.getVerticalSpacingBeforeResize()},getColumnsCount:function(){return t.getColumnsCount()},getColumnsCountBeforeResize:function(){return t.getState().beforeResize&&t.getState().beforeResize.columnsCount},getItemHeight:function(e){return t.getState().itemHeights[e]},getItemHeightBeforeResize:function(e){return t.getState().beforeResize&&t.getState().beforeResize.itemHeights[e]},getBeforeResizeItemsCount:function(){return t.getState().beforeResize?t.getState().beforeResize.itemHeights.length:0},getAverageItemHeight:function(){return t.itemHeights.getAverage()},getMaxVisibleAreaHeight:function(){return t.scrollableContainer&&t.scrollableContainer.getHeight()},getPreviouslyCalculatedLayout:function(){return t.previouslyCalculatedLayout}}),this.resize=new He({bypass:this.bypass,getWidth:function(){return t.scrollableContainer.getWidth()},getHeight:function(){return t.scrollableContainer.getHeight()},listenForResize:function(e){return t.scrollableContainer.onResize(e)},onResizeStart:function(){ne("~ Scrollable container resize started ~"),t._isResizing=!0},onResizeStop:function(){ne("~ Scrollable container resize finished ~"),t._isResizing=void 0},onNoChange:function(){t.onUpdateShownItemIndexes({reason:Se})},onHeightChange:function(){return t.onUpdateShownItemIndexes({reason:be})},onWidthChange:function(e,n){ne("~ Scrollable container width changed from",e,"to",n,"~"),t.onResize()}}),this.scroll=new Me({bypass:this.bypass,scrollableContainer:this.scrollableContainer,itemsContainer:this.itemsContainer,waitForScrollingToStop:l,onScroll:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.delayed;t.onUpdateShownItemIndexes({reason:n?ge:me})},initialScrollPosition:s,onScrollPositionChange:a,isImmediateLayoutScheduled:function(){return Boolean(t.layoutTimer)},hasNonRenderedItemsAtTheTop:function(){return t.getState().firstShownItemIndex>0},hasNonRenderedItemsAtTheBottom:function(){return t.getState().lastShownItemIndex<t.getItemsCount()-1},getLatestLayoutVisibleArea:function(){return t.latestLayoutVisibleArea},getListTopOffset:this.getListTopOffsetInsideScrollableContainer,getPrerenderMargin:function(){return t.getPrerenderMargin()}}),this.listHeightMeasurement=new Ve({itemsContainer:this.itemsContainer,getListTopOffset:this.getListTopOffsetInsideScrollableContainer}),this.engine.watchListTopOffset&&(this.listTopOffsetWatcher=this.engine.watchListTopOffset({getListTopOffset:this.getListTopOffsetInsideScrollableContainer,onListTopOffsetChange:function(e){return e.reason,t.onUpdateShownItemIndexes({reason:Oe})}})),this.beforeResize=new Le({getState:this.getState,getVerticalSpacing:this.getVerticalSpacing,getColumnsCount:this.getColumnsCount})}function yt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function bt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?yt(Object(n),!0).forEach((function(t){Ct(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function St(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wt(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Ct(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ot=function(){function e(t,n){var i=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};St(this,e),Ct(this,"stop",(function(){if(!i._isActive)throw new Error("[virtual-scroller] Can't stop a `VirtualScroller` that hasn't been started");i._isActive=!1,ne("~ Stop ~"),i.resize.stop(),i.scroll.stop(),i.listTopOffsetWatcher&&i.listTopOffsetWatcher.isStarted()&&i.listTopOffsetWatcher.stop(),i.cancelLayoutTimer({})})),Ct(this,"updateLayout",(function(){i.hasToBeStarted(),i.onUpdateShownItemIndexes({reason:pe})})),Ct(this,"onRender",(function(){i._onRender(i.getState(),i.previousState)})),It.call(this,t,n,r)}var t,n,o;return t=e,n=[{key:"start",value:function(){if(this._isActive)throw new Error("[virtual-scroller] `VirtualScroller` has already been started");!1===this._isActive||(this.waitingForRender=!0,this._usesCustomStateStorage||this.useDefaultStateStorage(),this._render&&this._render(this.getState())),ne("~ Start ~"),this._isActive=!0,this.listHeightMeasurement.reset(),this._isResizing=void 0,this._isSettingNewItems=void 0,this.tbody&&(this.getItemsContainerElement().classList.contains(i)&&Boolean(document.getElementById(r))||function(e){e.classList.add(i);var t=document.createElement("style");t.id=r,t.innerText="\n\t\ttbody.".concat(i,":before {\n\t\t\tcontent: '';\n\t\t\tdisplay: table-row;\n\t\t\theight: var(--VirtualScroller-paddingTop);\n\t\t}\n\t\ttbody.").concat(i,":after {\n\t\t\tcontent: '';\n\t\t\tdisplay: table-row;\n\t\t\theight: var(--VirtualScroller-paddingBottom);\n\t\t}\n\t").replace(/[\n\t]/g,""),document.head.appendChild(t)}(this.getItemsContainerElement()));var e=this._stoppedStateUpdate;this._stoppedStateUpdate=void 0,this.verticalSpacing=void 0;var t=this.measureItemHeightsAndSpacing();if(t&&(e=bt(bt({},e),t)),this.resize.start(),this.scroll.start(),void 0===this.getState().scrollableContainerWidth){var n=this.scrollableContainer.getWidth();e=bt(bt({},e),{},{scrollableContainerWidth:n})}else{var o=this.scrollableContainer.getWidth(),s=this.getState().scrollableContainerWidth;if(o!==s)return ne("~ Scrollable container width changed from",s,"to",o,"~"),this.onResize()}if(this._usesCustomStateStorage&&this.getActualColumnsCount()!==(this.getState().columnsCount||1))return this.onResize();this.onUpdateShownItemIndexes({reason:Ie,stateUpdate:e})}},{key:"hasToBeStarted",value:function(){if(!this._isActive)throw new Error("[virtual-scroller] `VirtualScroller` hasn't been started")}},{key:"getItemScrollPosition",value:function(e){var t=this.layout.getItemTopOffset(e);if(void 0!==t)return this.getListTopOffsetInsideScrollableContainer()+t}},{key:"onItemHeightChange",value:function(e){ie("`.onItemHeightChange(i)` method was renamed to `.onItemHeightDidChange(i)`"),this.onItemHeightDidChange(e)}},{key:"onItemHeightDidChange",value:function(e){this.hasToBeStarted(),this._onItemHeightDidChange(e)}},{key:"setItemState",value:function(e,t){this.hasToBeStarted(),this._setItemState(e,t)}},{key:"onItemStateChange",value:function(e,t){this.setItemState(e,t)}},{key:"setItems",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.hasToBeStarted(),this._setItems(e,t)}}],n&&wt(t.prototype,n),o&&wt(t,o),Object.defineProperty(t,"prototype",{writable:!1}),e}(),xt=["onMount","onItemUnmount"];function Ht(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Rt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ht(Object(n),!0).forEach((function(t){Et(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ht(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Tt(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},o=Object.keys(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Pt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jt(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Et(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Lt=function(){function t(n,i,r){var o=this,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Pt(this,t),Et(this,"render",(function(t,n){var i=t.items,r=t.firstShownItemIndex,s=t.lastShownItemIndex,a=t.beforeItemsHeight,l=t.afterItemsHeight;o.tbody||(o.container.style.paddingTop=e(a),o.container.style.paddingBottom=e(l));var u=n&&i===n.items&&i.length>0;if(u)for(var h=n.lastShownItemIndex;h>=n.firstShownItemIndex;)h>=r&&h<=s||(ne("DOM: Remove element for item index",h),o.unmountItem(o.container.childNodes[h-n.firstShownItemIndex])),h--;else for(ne("DOM: Rerender the list from scratch");o.container.firstChild;)o.unmountItem(o.container.firstChild);for(var c=u,f=c&&o.container.firstChild,d=r;d<=s;){if(u&&d>=n.firstShownItemIndex&&d<=n.lastShownItemIndex)c&&(c=!1);else{var m=o.renderItem(i[d]);c?(ne("DOM: Prepend element for item index",d),o.container.insertBefore(m,f)):(ne("DOM: Append element for item index",d),o.container.appendChild(m))}d++}})),Et(this,"onUnmount",(function(){ie("`.onUnmount()` instance method name is deprecated, use `.stop()` instance method name instead."),o.stop()})),Et(this,"destroy",(function(){ie("`.destroy()` instance method name is deprecated, use `.stop()` instance method name instead."),o.stop()})),Et(this,"stop",(function(){o.virtualScroller.stop()})),Et(this,"start",(function(){o.virtualScroller.start()})),this.container=n,this.renderItem=r;var a=s.onMount,l=s.onItemUnmount,u=Tt(s,xt);this.onItemUnmount=l,this.tbody="TBODY"===this.container.tagName,this.virtualScroller=new Ot((function(){return o.container}),i,Rt(Rt({},u),{},{render:this.render,tbody:this.tbody})),this.start(),a&&a()}var n,i,r;return n=t,i=[{key:"unmountItem",value:function(e){this.container.removeChild(e),this.onItemUnmount&&this.onItemUnmount(e)}},{key:"onItemHeightChange",value:function(e){ie("`.onItemHeightChange(i)` method was renamed to `.onItemHeightDidChange(i)`"),this.onItemHeightDidChange(e)}},{key:"onItemHeightDidChange",value:function(e){this.virtualScroller.onItemHeightDidChange(e)}},{key:"setItemState",value:function(e,t){this.virtualScroller.setItemState(e,t)}},{key:"updateItems",value:function(e,t){ie("`.updateItems()` method was renamed to `.setItems(i)`"),this.setItems(e,t)}},{key:"setItems",value:function(e,t){this.virtualScroller.setItems(e,t)}}],i&&jt(n.prototype,i),r&&jt(n,r),Object.defineProperty(n,"prototype",{writable:!1}),t}();return Lt}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).VirtualScroller=t()}(this,(function(){"use strict";function e(e){return(e%1==0?e:e.toFixed(2))+"px"}var t="It looks like you're using Internet Explorer which doesn't support CSS variables required for a <tbody/> container. VirtualScroller has been switched into \"bypass\" mode (render all items). See: https://gitlab.com/catamphetamine/virtual-scroller/-/issues/1";function n(){return"undefined"==typeof window||!window.document.documentMode}var i="VirtualScroller",r="VirtualScrollerStyle";function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function s(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function a(e,t){if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function l(e){var t="function"==typeof Map?new Map:void 0;return l=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;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,i)}function i(){return u(e,arguments,f(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),c(i,e)},l(e)}function u(e,t,n){return u=h()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var r=new(Function.bind.apply(e,i));return n&&c(r,n.prototype),r},u.apply(null,arguments)}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function c(e,t){return c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},c(e,t)}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}var d=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(u,e);var t,n,i,r,o,l=(t=u,n=h(),function(){var e,i=f(t);if(n){var r=f(this).constructor;e=Reflect.construct(i,arguments,r)}else e=i.apply(this,arguments);return a(this,e)});function u(e){var t=e.renderedElementIndex,n=e.renderedElementsCount,i=e.message;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),l.call(this,i||function(e){var t=e.renderedElementIndex,n=e.renderedElementsCount;return"Element with index ".concat(t," was not found in the list of Rendered Item Elements in the Items Container of Virtual Scroller. There're only ").concat(n," Elements there.")}({renderedElementIndex:t,renderedElementsCount:n}))}return i=u,r&&s(i.prototype,r),o&&s(i,o),Object.defineProperty(i,"prototype",{writable:!1}),i}(l(Error));function m(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var g=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.getElement=t}var t,n,i;return t=e,(n=[{key:"_getNthRenderedItemElement",value:function(e){var t=this.getElement().childNodes;if(e>t.length-1)throw new d({renderedElementIndex:e,renderedElementsCount:t.length});return t[e]}},{key:"getNthRenderedItemTopOffset",value:function(e){return this._getNthRenderedItemElement(e).getBoundingClientRect().top-this.getElement().getBoundingClientRect().top}},{key:"getNthRenderedItemHeight",value:function(e){return this._getNthRenderedItemElement(e).getBoundingClientRect().height}},{key:"getHeight",value:function(){return this.getElement().getBoundingClientRect().height}},{key:"clear",value:function(){for(;this.getElement().firstChild;)this.getElement().removeChild(this.getElement().firstChild)}}])&&m(t.prototype,n),i&&m(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();function p(e){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p(e)}function I(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function v(e,t){if(t&&("object"===p(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function y(e){var t="function"==typeof Map?new Map:void 0;return y=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;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,i)}function i(){return b(e,arguments,C(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),w(i,e)},y(e)}function b(e,t,n){return b=S()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var r=new(Function.bind.apply(e,i));return n&&w(r,n.prototype),r},b.apply(null,arguments)}function S(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function w(e,t){return w=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},w(e,t)}function C(e){return C=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},C(e)}var O=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&w(e,t)}(a,e);var t,n,i,r,o,s=(t=a,n=S(),function(){var e,i=C(t);if(n){var r=C(this).constructor;e=Reflect.construct(i,arguments,r)}else e=i.apply(this,arguments);return v(this,e)});function a(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),s.call(this,"[virtual-scroller] Scrollable container not found")}return i=a,r&&I(i.prototype,r),o&&I(i,o),Object.defineProperty(i,"prototype",{writable:!1}),i}(y(Error));function x(e){return x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},x(e)}function H(e,t){return H=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},H(e,t)}function R(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=P(e);if(t){var r=P(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return T(this,n)}}function T(e,t){if(t&&("object"===x(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function P(e){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},P(e)}function j(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function E(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function L(e,t,n){return t&&E(e.prototype,t),n&&E(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var B=function(){function e(t,n){j(this,e),this.getElement=t,this.getItemsContainerElement=n}return L(e,[{key:"getScrollY",value:function(){return this.getElement().scrollTop}},{key:"scrollToY",value:function(e){this.getElement().scrollTo?this.getElement().scrollTo(0,e):this.getElement().scrollTop=e}},{key:"getWidth",value:function(){if(!this.getElement())throw new O;return this.getElement().offsetWidth}},{key:"getHeight",value:function(){if(!this.getElement())throw new O;return this.getElement().offsetHeight}},{key:"getItemsContainerTopOffset",value:function(){var e=this.getElement().getBoundingClientRect().top,t=this.getElement().clientTop;return this.getItemsContainerElement().getBoundingClientRect().top-e+this.getScrollY()-t}},{key:"onScroll",value:function(e){var t=this.getElement();return t.addEventListener("scroll",e),function(){return t.removeEventListener("scroll",e)}}},{key:"onResize",value:function(e){var t;if("undefined"!=typeof ResizeObserver){var n=new ResizeObserver((function(t){t[0],e()})),i=this.getElement();n.observe(i),t=function(){return n.unobserve(i)}}var r=A(e,{itemsContainerElement:this.getItemsContainerElement()});return function(){t&&t(),r()}}}]),e}(),z=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&H(e,t)}(n,e);var t=R(n);function n(e){return j(this,n),t.call(this,(function(){return window}),e)}return L(n,[{key:"getScrollY",value:function(){return window.pageYOffset}},{key:"getWidth",value:function(){return window.innerWidth}},{key:"getHeight",value:function(){return window.innerHeight}},{key:"getItemsContainerTopOffset",value:function(){var e=document.clientTop||document.body.clientTop||0;return this.getItemsContainerElement().getBoundingClientRect().top+this.getScrollY()-e}},{key:"onResize",value:function(e){return A(e,{itemsContainerElement:this.getItemsContainerElement()})}}]),n}(B);function A(e,t){var n=t.itemsContainerElement,i=function(){document.fullscreenElement&&!document.fullscreenElement.contains(n)||e()};return window.addEventListener("resize",i),function(){return window.removeEventListener("resize",i)}}var M="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};for(var k=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){(function(){var t,n,i,r,o,s;"undefined"!=typeof performance&&null!==performance&&performance.now?e.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(e.exports=function(){return(t()-o)/1e6},n=process.hrtime,r=(t=function(){var e;return 1e9*(e=n())[0]+e[1]})(),s=1e9*process.uptime(),o=r-s):Date.now?(e.exports=function(){return Date.now()-i},i=Date.now()):(e.exports=function(){return(new Date).getTime()-i},i=(new Date).getTime())}).call(M)})),_="undefined"==typeof window?M:window,V=["moz","webkit"],D="AnimationFrame",N=_["request"+D],W=_["cancel"+D]||_["cancelRequest"+D],F=0;!N&&F<V.length;F++)N=_[V[F]+"Request"+D],W=_[V[F]+"Cancel"+D]||_[V[F]+"CancelRequest"+D];if(!N||!W){var U=0,Y=0,q=[];N=function(e){if(0===q.length){var t=k(),n=Math.max(0,16.666666666666668-(t-U));U=n+t,setTimeout((function(){var e=q.slice(0);q.length=0;for(var t=0;t<e.length;t++)if(!e[t].cancelled)try{e[t].callback(U)}catch(e){setTimeout((function(){throw e}),0)}}),Math.round(n))}return q.push({handle:++Y,callback:e,cancelled:!1}),Y},W=function(e){for(var t=0;t<q.length;t++)q[t].handle===e&&(q[t].cancelled=!0)}}var G=function(e){return N.call(_,e)};G.cancel=function(){W.apply(_,arguments)},G.polyfill=function(e){e||(e=_),e.requestAnimationFrame=N,e.cancelAnimationFrame=W};var J=G.cancel;function $(e,t){var n=Date.now(),i=G((function r(){Date.now()-n>=t?e():i=G(r)}));return{clear:function(){return J(i)}}}function K(e){e&&e.clear()}function Q(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var X=function(){function e(t){var n=t.getListTopOffset,i=t.onListTopOffsetChange;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.getListTopOffset=n,this.onListTopOffsetChange=i}var t,n,i;return t=e,(n=[{key:"onListTopOffset",value:function(e){void 0===this.listTopOffsetInsideScrollableContainer&&this.start(),this.listTopOffsetInsideScrollableContainer=e}},{key:"start",value:function(){this._isActive=!0,this.watchListTopOffset()}},{key:"isStarted",value:function(){return this._isActive}},{key:"stop",value:function(){this._isActive=!1,this.watchListTopOffsetTimer&&(K(this.watchListTopOffsetTimer),this.watchListTopOffsetTimer=void 0)}},{key:"watchListTopOffset",value:function(){var e=this,t=Date.now();!function n(){e._isActive&&(void 0!==e.listTopOffsetInsideScrollableContainer&&e.getListTopOffset()!==e.listTopOffsetInsideScrollableContainer&&e.onListTopOffsetChange(),Date.now()-t<3e3&&(e.watchListTopOffsetTimer=$(n,500)))}()}}])&&Q(t.prototype,n),i&&Q(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}(),Z={createItemsContainer:function(e){return new g(e)},createScrollableContainer:function(e,t){return e?new B(e,t):"undefined"!=typeof window?new z(t):void 0},watchListTopOffset:function(e){var t=e.getListTopOffset,n=e.onListTopOffsetChange;return new X({getListTopOffset:t,onListTopOffsetChange:n})}};function ee(e){return function(e){if(Array.isArray(e))return te(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return te(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return te(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function ne(){if(se()){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];(e=console).log.apply(e,ee(["[virtual-scroller]"].concat(n)))}}function ie(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];if(ae())return oe.apply(this,n);(e=console).warn.apply(e,ee(["[virtual-scroller]"].concat(n)))}function re(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];(e=console).error.apply(e,ee(["[virtual-scroller]"].concat(n)))}function oe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var i=function(){return new Error(["[virtual-scroller]"].concat(t).join(" "))};if("undefined"!=typeof window)re.apply(this,["ERROR"].concat(t)),setTimeout((function(){throw i()}),0);else{var r=le("VirtualScrollerCatchError");if(r)return r(i());if(le("VirtualScrollerThrowErrors"))throw i();re.apply(this,["ERROR"].concat(t))}}function se(){var e=le("VirtualScrollerDebug");if(void 0!==e)return!0===e||"debug"===e}function ae(){return le("VirtualScrollerWarningsAreErrors")}function le(e){return"undefined"!=typeof window?window[e]:"undefined"!=typeof global?global[e]:void 0}function ue(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function he(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ue(Object(n),!0).forEach((function(t){ce(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ue(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ce(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fe(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var de=function(){function e(t){var n=t.bypass,i=t.getInitialEstimatedItemHeight,r=t.getInitialEstimatedVisibleItemRowsCount,o=t.measureItemsBatchSize,s=t.getPrerenderMargin,a=t.getVerticalSpacing,l=t.getVerticalSpacingBeforeResize,u=t.getColumnsCount,h=t.getColumnsCountBeforeResize,c=t.getItemHeight,f=t.getItemHeightBeforeResize,d=t.getBeforeResizeItemsCount,m=t.getAverageItemHeight,g=t.getMaxVisibleAreaHeight,p=t.getPreviouslyCalculatedLayout;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.bypass=n,this.getInitialEstimatedItemHeight=i,this.getInitialEstimatedVisibleItemRowsCount=r,this.measureItemsBatchSize=o,this.getPrerenderMargin=s,this.getVerticalSpacing=a,this.getVerticalSpacingBeforeResize=l,this.getColumnsCount=u,this.getColumnsCountBeforeResize=h,this.getItemHeight=c,this.getItemHeightBeforeResize=f,this.getBeforeResizeItemsCount=d,this.getAverageItemHeight=m,this.getMaxVisibleAreaHeight=g,this.getPreviouslyCalculatedLayout=p}var t,n,i;return t=e,n=[{key:"getInitialLayoutValueWithFallback",value:function(e,t,n){try{return t()}catch(t){if(t instanceof O)return ne("Couldn't calculate",e,"before scrollable container is ready. Default to",n),n;throw t}}},{key:"getInitialLayoutValues",value:function(e){var t,n,i=this,r=e.itemsCount,o=e.columnsCount,s=e.beforeStart;if(r>0){var a=function(){return i.getInitialLastShownItemIndex({itemsCount:r,columnsCount:o,firstShownItemIndex:t})};t=0,n=s?this.getInitialLayoutValueWithFallback("lastShownItemIndex",a,0):a()}return{beforeItemsHeight:0,afterItemsHeight:0,firstShownItemIndex:t,lastShownItemIndex:n}}},{key:"getInitialLastShownItemIndex",value:function(e){var t=e.itemsCount,n=e.columnsCount,i=e.firstShownItemIndex;if(this.bypass)return t-1;var r=1;if(this.getMaxVisibleAreaHeight())r=this.getEstimatedRowsCountForHeight(this.getMaxVisibleAreaHeight()+this.getPrerenderMargin());else if(this.getInitialEstimatedVisibleItemRowsCount&&(r=this.getInitialEstimatedVisibleItemRowsCount(),isNaN(r)))throw new Error("[virtual-scroller] `getEstimatedVisibleItemRowsCount()` must return a number");return Math.min(i+(r*n-1),t-1)}},{key:"getEstimatedRowsCountForHeight",value:function(e){var t=this.getEstimatedItemHeight(),n=this.getVerticalSpacing();return t?Math.ceil((e+n)/(t+n)):1}},{key:"getEstimatedItemHeight",value:function(){var e=this.getAverageItemHeight();if(e)return e;if(this.getInitialEstimatedItemHeight){var t=this.getInitialEstimatedItemHeight();if(isNaN(t))throw new Error("[virtual-scroller] `getInitialEstimatedItemHeight()` must return a number");return t}return 0}},{key:"getLayoutUpdateForItemsDiff",value:function(e,t,n){var i=e.firstShownItemIndex,r=e.lastShownItemIndex,o=e.beforeItemsHeight,s=e.afterItemsHeight,a=t.prependedItemsCount,l=t.appendedItemsCount,u=n.itemsCount,h=n.columnsCount,c=n.shouldRestoreScrollPosition,f=n.onResetGridLayout,d=this.getAverageItemHeight(),m=this.getVerticalSpacing();if(l>0&&(s+=Math.ceil(l/h)*(m+d)),a>0&&(i+=a,r+=a,o+=Math.ceil(a/h)*(d+m),c&&(i=0,o=0),a%h>0)){f(),ie("~ Prepended items count",a,"is not divisible by Columns Count",h,"~"),ie("Layout reset required");var g=r-i+1;if(i=0,o=0,!c&&a>g){var p=u-((r=this.getInitialLastShownItemIndex({itemsCount:u,columnsCount:h,firstShownItemIndex:i}))+1);s=Math.ceil(p/h)*(m+d)}}return{beforeItemsHeight:o,afterItemsHeight:s,firstShownItemIndex:i,lastShownItemIndex:r}}},{key:"getItemNotMeasuredIndexes",value:function(e,t){var n=t.itemsCount,i=t.firstShownItemIndex,r=t.nonMeasuredAreaHeight,o=t.indexOfTheFirstItemInTheRow;ne("Item index",e,"height is required for calculations but hasn't been measured yet. Mark the item as \"shown\", rerender the list, measure the item's height and redo the layout.");var s=this.getColumnsCount(),a=Math.min(this.getEstimatedRowsCountForHeight(r)*s,this.measureItemsBatchSize||1/0);return void 0===i&&(i=o),{firstNonMeasuredItemIndex:e,firstShownItemIndex:i,lastShownItemIndex:Math.min(o+a-1,n-1)}}},{key:"getShownItemIndexes",value:function(e){var t=e.itemsCount,n=e.visibleAreaTop,i=e.visibleAreaBottom,r=this._getShownItemIndex({itemsCount:t,fromIndex:0,visibleAreaTop:n,visibleAreaBottom:i,findFirstShownItemIndex:!0});if(null===r)return this.getNonVisibleListShownItemIndexes();if(void 0!==r.firstNonMeasuredItemIndex)return r;var o=r,s=o.firstShownItemIndex,a=o.beforeItemsHeight;return null===(r=this._getShownItemIndex({itemsCount:t,fromIndex:s,beforeItemsHeight:a,visibleAreaTop:n,visibleAreaBottom:i,findLastShownItemIndex:!0}))?this.getNonVisibleListShownItemIndexes():void 0!==r.firstNonMeasuredItemIndex?r:{firstShownItemIndex:s,lastShownItemIndex:r.lastShownItemIndex}}},{key:"_getShownItemIndex",value:function(e){var t=e.beforeResize,n=e.itemsCount,i=e.visibleAreaTop,r=e.visibleAreaBottom,o=e.findFirstShownItemIndex,s=e.findLastShownItemIndex,a=e.fromIndex,l=e.beforeItemsHeight;if(0===a&&(l=0),void 0===l)throw new Error("[virtual-scroller] `beforeItemsHeight` not passed to `Layout.getShownItemIndexes()` when starting from index "+a);if(!t){var u=this.getBeforeResizeItemsCount();if(u>a){var h=this._getShownItemIndex(he(he({},e),{},{beforeResize:!0,itemsCount:u})),c=h.notFound,f=h.beforeItemsHeight,d=h.firstShownItemIndex,m=h.lastShownItemIndex;if(!c){var g=this.getColumnsCount();return{firstShownItemIndex:void 0===d?void 0:Math.floor(d/g)*g,lastShownItemIndex:void 0===m?void 0:Math.floor(m/g)*g,beforeItemsHeight:f}}l=f,a+=u}}for(var p=t?this.getColumnsCountBeforeResize():this.getColumnsCount(),I=t?this.getVerticalSpacingBeforeResize():this.getVerticalSpacing(),v=a;v<n;){for(var y=v,b=n>y+p?I:0,S=0,w=0;w<p&&v<n;){var C=t?this.getItemHeightBeforeResize(v):this.getItemHeight(v);if(void 0===C)return this.getItemNotMeasuredIndexes(v,{itemsCount:n,firstShownItemIndex:s?a:void 0,indexOfTheFirstItemInTheRow:y,nonMeasuredAreaHeight:r+this.getPrerenderMargin()-l});S=Math.max(S,C),w++,v++}var O=l+S,x=O>i-this.getPrerenderMargin(),H=O+b>=r+this.getPrerenderMargin();if(o){if(x)return{firstShownItemIndex:y,beforeItemsHeight:l}}else if(s&&H)return{lastShownItemIndex:Math.min(y+p-1,n-1)};l+=S+b}return t?{notFound:!0,beforeItemsHeight:l}:o?(ie("The list is supposed to be visible but no visible item has been found"),null):s?{lastShownItemIndex:n-1}:void 0}},{key:"getNonVisibleListShownItemIndexes",value:function(){var e={firstShownItemIndex:0,lastShownItemIndex:0};return void 0===this.getItemHeight(0)&&(e.firstNonMeasuredItemIndex=0),e}},{key:"getBeforeItemsHeight",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.beforeResize,i=0,r=0;if(!n){var o=this.getBeforeResizeItemsCount();o>0&&(i=this.getBeforeItemsHeight(Math.min(e,o),{beforeResize:!0}),r=o)}for(var s=n?this.getColumnsCountBeforeResize():this.getColumnsCount(),a=n?this.getVerticalSpacingBeforeResize():this.getVerticalSpacing();r<e;){for(var l=0,u=0;u<s;){var h=n?this.getItemHeightBeforeResize(r):this.getItemHeight(r);void 0===h&&(h=this.getAverageItemHeight()),l=Math.max(l,h),r++,u++}i+=l,i+=a}return i}},{key:"getAfterItemsHeight",value:function(e,t){for(var n=this.getColumnsCount(),i=0,r=e+1;r<t;){for(var o=0,s=0;s<n&&r<t;){var a=this.getItemHeight(r);void 0===a&&(a=this.getAverageItemHeight()),o=Math.max(o,a),r++,s++}i+=this.getVerticalSpacing(),i+=o}return i}},{key:"getItemTopOffset",value:function(e){for(var t=0,n=this.getBeforeResizeItemsCount(),i=0===n?0:Math.ceil(n/this.getColumnsCountBeforeResize()),r=e<n?Math.floor(e/this.getColumnsCountBeforeResize()):i,o=0;o<r;)t+=this.getItemHeightBeforeResize(o*this.getColumnsCountBeforeResize()),t+=this.getVerticalSpacingBeforeResize(),o++;for(var s=Math.floor((e-n)/this.getColumnsCount()),a=0;a<s;){for(var l=0,u=0;u<this.getColumnsCount();){var h=this.getItemHeight(n+a*this.getColumnsCount()+u);if(void 0===h)return;l=Math.max(l,h),u++}t+=l,t+=this.getVerticalSpacing(),a++}return t}}],n&&fe(t.prototype,n),i&&fe(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}(),me="scroll",ge="stopped scrolling",pe="manual",Ie="started",ve="non-measured item heights have been measured",ye="viewport width changed",be="viewport height changed",Se="viewport size unchanged",we="item height changed",Ce="items changed",Oe="list top offset changed";function xe(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var He=function(){function e(t){var n,i,r,o=this,s=t.bypass,a=t.getWidth,l=t.getHeight,u=t.listenForResize,h=t.onResizeStart,c=t.onResizeStop,f=t.onHeightChange,d=t.onWidthChange,m=t.onNoChange;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),r=function(){if(o.isActive){var e=o.width,t=o.height;o.width=o.getWidth(),o.height=o.getHeight(),o.width===e?o.height===t?o.onNoChange():o.onHeightChange(t,o.height):o.onWidthChange(e,o.width)}},(i="_onResize")in(n=this)?Object.defineProperty(n,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[i]=r,this.bypass=s,this.onHeightChange=f,this.onWidthChange=d,this.onNoChange=m,this.getWidth=a,this.getHeight=l,this.listenForResize=u,this.onResize=function(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=i.onStart,o=i.onStop;return function(){for(var i=this,s=arguments.length,a=new Array(s),l=0;l<s;l++)a[l]=arguments[l];return new Promise((function(s){n?K(n):r&&r(),n=$((function(){n=void 0,o&&o(),e.apply(i,a),s()}),t)}))}}(this._onResize,Re,{onStart:h,onStop:c})}var t,n,i;return t=e,(n=[{key:"start",value:function(){this.isActive=!0,this.bypass||(this.width=this.getWidth(),this.height=this.getHeight(),this.unlistenResize=this.listenForResize(this.onResize))}},{key:"stop",value:function(){this.isActive=!1,this.width=void 0,this.height=void 0,this.unlistenResize&&(this.unlistenResize(),this.unlistenResize=void 0)}}])&&xe(t.prototype,n),i&&xe(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}(),Re=250;function Te(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Pe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Te(Object(n),!0).forEach((function(t){je(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Te(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function je(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ee(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var Le=function(){function e(t){var n=t.getState,i=t.getVerticalSpacing,r=t.getColumnsCount;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.getState=n,this.getVerticalSpacing=i,this.getColumnsCount=r}var t,n,i;return t=e,n=[{key:"initializeFromState",value:function(e){this._includesBeforeResizeInState=Boolean(e.beforeResize)}},{key:"cleanUpBeforeResizeItemHeights",value:function(){var e=this.getState(),t=e.firstShownItemIndex,n=e.lastShownItemIndex,i=e.itemHeights,r=e.beforeResize;if(r&&t<r.itemHeights.length){ne('~ Clean up "before resize" item heights and correct scroll position ~');for(var o=0,s=Math.floor(r.itemHeights.length/this.getColumnsCount()),a=Math.min(s*this.getColumnsCount()-1,n),l=t;l<=a;){for(var u=0,h=0;h<this.getColumnsCount()&&l<=a;){var c=i[l];void 0===c&&(c=this.getAverageItemHeight()),u=Math.max(u,c),l++,h++}o+=u,o+=this.getVerticalSpacing()}for(var f=0,d=Math.min(r.itemHeights.length,n+1),m=Math.ceil(d/r.columnsCount),g=0===t?0:Math.floor((t-1)/r.columnsCount)+1;g<m;)f+=r.itemHeights[g*r.columnsCount],f+=r.verticalSpacing,g++;if(0===t)ne('Drop all "before resize" item heights');else{var p=t,I=r.itemHeights.length-1;p===I?ne("For item index",p,'— drop "before resize" height',r.itemHeights[p]):ne("For item indexes from",p,"to",I,'— drop "before resize" heights',r.itemHeights.slice(p))}return r.itemHeights.splice(t,r.itemHeights.length-t),{scrollBy:o-f,beforeResize:0===t?void 0:Pe({},r)}}}},{key:"snapshotBeforeResizeItemHeights",value:function(e){var t=e.firstShownItemIndex,n=e.newFirstShownItemIndex;e.newColumnsCount;var i=this.getColumnsCount(),r=this.getVerticalSpacing();this._includesBeforeResizeInState=!0;var o=this.getState(),s=o.beforeResize,a=o.itemHeights,l=s?s.itemHeights.length:0;if(l>0){if(s.columnsCount!==i||s.verticalSpacing!==r){for(var u=0,h=Math.ceil(l/s.columnsCount),c=0;c<h;)u+=s.itemHeights[c*s.columnsCount],u+=s.verticalSpacing,c++;for(var f=0,d=t;d<n;){for(var m=0,g=0;g<i&&d<n;)m=Math.max(m,a[d]),g++,d++;f+=m,f+=r}var p=u+f,I=Math.ceil(n/i);return new Array(n).fill(Math.max(0,p/I-r))}return s.itemHeights.concat(Be(a,n,i).slice(s.itemHeights.length))}return Be(a,n,i)}},{key:"shouldIncludeBeforeResizeValuesInState",value:function(){return this._includesBeforeResizeInState}}],n&&Ee(t.prototype,n),i&&Ee(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Be(e,t,n){e=e.slice(0,Math.ceil(t/n)*n);for(var i=0;i*n<t;){for(var r=0,o=0;o<n;)r=Math.max(r,e[i*n+o]),o++;for(o=0;o<n;)e[i*n+o]=r,o++;i++}return e.slice(0,t)}function ze(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Ae(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Me=function(){function e(t){var n=this,i=t.bypass,r=t.scrollableContainer,o=t.itemsContainer,s=t.onScroll,a=t.initialScrollPosition,l=t.onScrollPositionChange,u=t.isImmediateLayoutScheduled,h=t.hasNonRenderedItemsAtTheTop,c=t.hasNonRenderedItemsAtTheBottom,f=t.getLatestLayoutVisibleArea,d=t.getListTopOffset,m=t.getPrerenderMargin,g=t.onScrolledToTop,p=t.waitForScrollingToStop;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ae(this,"scrollByY",(function(e){n.scrollToY(n.getScrollY()+e)})),Ae(this,"onScrollListener",(function(){if(n.onScrollPositionChange&&n.onScrollPositionChange(n.getScrollY()),n.onScrolledToTop&&n.getScrollY()<n.getListTopOffset()&&n.onScrolledToTop(),!n.bypass&&!n.ignoreScrollEvents){n.cancelOnStopScrollingTimer();var e=n.getLatestLayoutVisibleArea()&&(n.getScrollY()<n.getLatestLayoutVisibleArea().top-n.getPrerenderMargin()&&n.hasNonRenderedItemsAtTheTop()||n.getScrollY()+n.scrollableContainer.getHeight()>n.getLatestLayoutVisibleArea().bottom+n.getPrerenderMargin()&&n.hasNonRenderedItemsAtTheBottom());if(ne(e?"The user has scrolled far enough: perform a re-layout":"The user is scrolling: perform a re-layout when they stop scrolling"),e||!1===n.waitForScrollingToStop)return n.onScroll();n.isImmediateLayoutScheduled()||(n.shouldCallOnScrollListenerWhenStopsScrolling=!0,n.watchOnStopScrolling())}})),this.bypass=i,this.scrollableContainer=r,this.itemsContainer=o,this.onScroll=s,this.initialScrollPosition=a,this.onScrollPositionChange=l,this.isImmediateLayoutScheduled=u,this.hasNonRenderedItemsAtTheTop=h,this.hasNonRenderedItemsAtTheBottom=c,this.getLatestLayoutVisibleArea=f,this.getListTopOffset=d,this.getPrerenderMargin=m,this.onScrolledToTop=g,this.waitForScrollingToStop=p}var t,n,i;return t=e,(n=[{key:"start",value:function(){void 0!==this.initialScrollPosition&&(this.scrollToY(this.initialScrollPosition),this.initialScrollPosition=void 0),this.onScrollPositionChange&&this.onScrollPositionChange(this.getScrollY()),this.stopListeningToScroll=this.scrollableContainer.onScroll(this.onScrollListener)}},{key:"stop",value:function(){this.stopListeningToScroll(),this.stopListeningToScroll=void 0,this.shouldCallOnScrollListenerWhenStopsScrolling=void 0,this.cancelOnStopScrollingTimer()}},{key:"scrollToY",value:function(e){this.ignoreScrollEvents=!0,this.scrollableContainer.scrollToY(e),this.ignoreScrollEvents=void 0}},{key:"getScrollY",value:function(){return this.scrollableContainer.getScrollY()}},{key:"cancelOnStopScrollingTimer",value:function(){this.onStopScrollingTimer&&(K(this.onStopScrollingTimer),this.onStopScrollingTimer=void 0)}},{key:"cancelScheduledLayout",value:function(){this.cancelOnStopScrollingTimer()}},{key:"watchOnStopScrolling",value:function(){var e=this;this.onStopScrollingTimer=$((function(){e.onStopScrollingTimer=void 0,e.shouldCallOnScrollListenerWhenStopsScrolling&&(e.shouldCallOnScrollListenerWhenStopsScrolling=void 0,e.onScroll({delayed:!0}))}),ke)}},{key:"getVisibleAreaBounds",value:function(){var e=this.getScrollY();return{top:e,bottom:e+this.scrollableContainer.getHeight()}}}])&&ze(t.prototype,n),i&&ze(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}(),ke=100;function _e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var Ve=function(){function e(t){var n=t.itemsContainer,i=t.getListTopOffset;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.itemsContainer=n,this.getListTopOffset=i}var t,n,i;return t=e,(n=[{key:"snapshotListHeightBeforeAddingNewItems",value:function(e){var t=e.previousItems,n=e.newItems,i=e.prependedItemsCount;0!==t.length&&0!==i&&(this._snapshot={previousItems:t,newItems:n,itemIndex:i,itemTopOffset:this.itemsContainer.getNthRenderedItemTopOffset(0),listTopOffset:this.getListTopOffset()})}},{key:"getAnchorItemIndex",value:function(){return this._snapshot.itemIndex}},{key:"hasSnapshot",value:function(){return void 0!==this._snapshot}},{key:"getListBottomOffsetChange",value:function(){var e=this._snapshot,t=e.itemIndex,n=e.itemTopOffset,i=e.listTopOffset;return this.itemsContainer.getNthRenderedItemTopOffset(t)-n+(this.getListTopOffset()-i)}},{key:"reset",value:function(){this._snapshot=void 0}}])&&_e(t.prototype,n),i&&_e(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();function De(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var Ne=function(){function e(t){var n=t.container;t.itemHeights;var i=t.getItemHeight,r=t.setItemHeight;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.container=n,this._get=i,this._set=r,this.reset()}var t,n,i;return t=e,n=[{key:"reset",value:function(){this.measuredItemsHeight=0,this.firstMeasuredItemIndex=void 0,this.lastMeasuredItemIndex=void 0}},{key:"readItemHeightsFromState",value:function(e){for(var t=e.itemHeights,n=0;n<t.length;){if(void 0===t[n]){if(void 0!==this.firstMeasuredItemIndex){this.lastMeasuredItemIndex=n-1;break}}else void 0===this.firstMeasuredItemIndex&&(this.firstMeasuredItemIndex=n),this.measuredItemsHeight+=t[n];n++}}},{key:"_measureItemHeight",value:function(e,t){return this.container.getNthRenderedItemHeight(e-t)}},{key:"measureItemHeights",value:function(e,t){if(ne("~ Measure item heights ~"),void 0!==e){void 0!==this.firstMeasuredItemIndex&&(e>this.lastMeasuredItemIndex+1||t<this.firstMeasuredItemIndex-1)&&(ne("Non-measured items gap detected. Reset first and last measured item indexes."),this.reset());for(var n=[],i=this.firstMeasuredItemIndex,r=this.lastMeasuredItemIndex,o=!1,s=e;s<=t;){if(void 0===this._get(s)){n.push(s);var a=this._measureItemHeight(s,e);ne("Item index",s,"height",a),this._set(s,a),(void 0===i||s<i)&&(this.measuredItemsHeight+=a,o||(this.firstMeasuredItemIndex=s,o=!0)),(void 0===r||s>r)&&(void 0!==r&&(this.measuredItemsHeight+=a),this.lastMeasuredItemIndex=s)}else{var l=this._get(s),u=this._measureItemHeight(s,e);l!==u&&(ie("Item index",s,"height changed unexpectedly: it was",l,"before, but now it is",u,'. Whenever an item\'s height changes for whatever reason, a developer must call `onItemHeightDidChange(i)` right after that change. If you are calling `onItemHeightDidChange(i)` correctly, then there\'re several other possible causes. For example, perhaps you forgot to persist the item\'s "state" by calling `setItemState(i, newState)` when that "state" did change, and so the item\'s "state" got lost when the item element was unmounted, which resulted in a different item height when the item was shown again with no previous "state". Or perhaps you\'re running your application in "devleopment" mode and `VirtualScroller` has initially rendered the list before your CSS styles or custom fonts have loaded, resulting in different item height measurements "before" and "after" the page has fully loaded.'),this._set(s,u))}s++}return n}}},{key:"remeasureItemHeight",value:function(e,t){var n=this._get(e),i=this._measureItemHeight(e,t);return this._set(e,i),this.measuredItemsHeight+=i-n,i}},{key:"getAverage",value:function(){return void 0===this.lastMeasuredItemIndex?0:this.measuredItemsHeight/(this.lastMeasuredItemIndex-this.firstMeasuredItemIndex+1)}},{key:"onPrepend",value:function(e){void 0!==this.firstMeasuredItemIndex&&(this.firstMeasuredItemIndex+=e,this.lastMeasuredItemIndex+=e)}}],n&&De(t.prototype,n),i&&De(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();function We(e,t){for(var n=0;n<e.length;)e[n]=t(n),n++;return e}function Fe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Ue(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fe(Object(n),!0).forEach((function(t){Ye(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ye(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qe(e){var t=Ue({},e);return e.itemHeights&&(t.itemHeights=e.itemHeights.slice()),e.itemStates&&(t.itemStates=e.itemStates.slice()),e.beforeResize&&(t.beforeResize=Ue({},e.beforeResize),t.beforeResize.itemHeights=e.beforeResize.itemHeights.slice()),t}function Ge(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Je(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ge(Object(n),!0).forEach((function(t){$e(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ge(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function $e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ke(e){var t=this,n=e.state,i=e.getInitialItemState,r=e.onStateChange,o=e.render,s=e.items;function a(){return this.state}function l(e){this.state=e}function u(e,t){this.state=e,o(this.state,this.previousState),this.onRender()}function h(e){var t=e.getInitialItemState,n=s,i=Je(Je({},f.call(this,n,{beforeStart:!0})),{},{items:n,itemStates:We(new Array(n.length),(function(e){return t(n[e])}))});return se()&&ne("Initial state (autogenerated)",qe(i)),ne("First shown item index",i.firstShownItemIndex),ne("Last shown item index",i.lastShownItemIndex),i}function c(e){return se()&&ne("Restore state",qe(e)),function(e,t){var n=t.columnsCount,i=e.columnsCount||1;if(i!==n)return ie("~ Columns Count changed from",i,"to",n,"~"),!0;if(Math.floor(e.firstShownItemIndex/n)*n!==e.firstShownItemIndex)return ie("~ First Shown Item Index",e.firstShownItemIndex,"is not divisible by Columns Count",n,"~"),!0}(e=Je(Je({},e=function(e){return e.beforeResize&&0===e.beforeResize.itemHeights.length&&(e.beforeResize=void 0),e}(e)),{},{verticalSpacing:void 0}),{columnsCount:this.getActualColumnsCount()})&&(ie("Reset Layout"),e=Je(Je({},e),f.call(this,e.items,{beforeStart:!1}))),e}function f(e,t){var n=this,i=t.beforeStart,r=e.length,o=function(){return n.getActualColumnsCount()};i?this.layout.getInitialLayoutValueWithFallback("columnsCount",o,1):o();var s=this.layout.getInitialLayoutValues({itemsCount:r,columnsCount:this.getActualColumnsCount(),beforeStart:i}),a=s.firstShownItemIndex,l=s.lastShownItemIndex,u=s.beforeItemsHeight,h=s.afterItemsHeight,c=new Array(r);return this.onBeforeShowItems(e,c,a,l),{itemHeights:c,columnsCount:this.getActualColumnsCountForState(),verticalSpacing:this.verticalSpacing,firstShownItemIndex:a,lastShownItemIndex:l,beforeItemsHeight:u,afterItemsHeight:h}}this.onStateChange=r,this._render=o,this.getInitialItemState=i,this._setItemState=function(e,n){se()&&(ne("~ Item state changed ~"),ne("Item index",e),ne("Previous state\n"+JSON.stringify(t.getState().itemStates[e],null,2)),ne("New state\n"+JSON.stringify(n,null,2))),t.getState().itemStates[e]=n,t.newItemsWillBeRendered&&(t.itemStatesThatChangedWhileNewItemsWereBeingRendered||(t.itemStatesThatChangedWhileNewItemsWereBeingRendered={}),t.itemStatesThatChangedWhileNewItemsWereBeingRendered[String(e)]=n)},this.getState=function(){return t._getState()},this.updateState=function(e){se()&&(ne("~ Set state ~"),ne(qe(e))),e.items&&(t._isSettingNewItems||oe("A `stateUpdate` can only contain `items` property as a result of calling `.setItems()`")),t._isSettingNewItems=void 0,t.waitingForRender=!0,t.previousState=t.getState(),t.mostRecentSetStateValue||(t.mostRecentSetStateValue=t.getState()),t.mostRecentSetStateValue=Je(Je({},t.mostRecentSetStateValue),e),t._setState(t.mostRecentSetStateValue,e)},this.getInitialState=function(){return n?c.call(t,n):h.call(t,{getInitialItemState:i})},this.useState=function(e){var n=e.getState,i=e.setState,r=e.updateState;if(t._isActive)throw new Error("[virtual-scroller] `VirtualScroller` has already been started");if(t._getState)throw new Error("[virtual-scroller] Custom state storage has already been configured");if(o)throw new Error("[virtual-scroller] Creating a `VirtualScroller` class instance with a `render()` parameter implies using the default (internal) state storage");if(i&&r)throw new Error("[virtual-scroller] When using a custom state storage, one must supply either `setState()` or `updateState()` function but not both");if(!n||!i&&!r)throw new Error("[virtual-scroller] When using a custom state storage, one must supply both `getState()` and `setState()`/`updateState()` functions");t._usesCustomStateStorage=!0,t._getState=n,t._setState=function(e,t){i?i(e):r(t)}},this.useDefaultStateStorage=function(){if(!o)throw new Error("[virtual-scroller] When using the default (internal) state management, one must supply a `render(state, prevState)` function parameter");t._getState=a.bind(t),t._setState=u.bind(t),l.bind(t)(t.getInitialState())}}function Qe(){var e=this;function t(){var e=this.getState(),t=e.firstShownItemIndex,n=e.lastShownItemIndex;ne("~ Measure item vertical spacing ~");var i=function(e){var t=e.itemsContainer,n=e.renderedItemsCount;if(n>1)for(var i=t.getNthRenderedItemTopOffset(0),r=t.getNthRenderedItemHeight(0),o=1;o<n;){var s=t.getNthRenderedItemTopOffset(o),a=t.getNthRenderedItemHeight(o);if(s>=i+r)return s-(i+r);r=Math.max(r,a),o++}}({itemsContainer:this.itemsContainer,renderedItemsCount:n-t+1});if(void 0!==i)return ne("Item vertical spacing",i),i;ne("Not enough items rendered to measure vertical spacing")}this.getVerticalSpacing=function(){return e.verticalSpacing||0},this.getVerticalSpacingBeforeResize=function(){var t=e.getState().beforeResize;return t&&t.verticalSpacing||0},this.measureVerticalSpacingIfNotMeasured=function(){if(void 0===e.verticalSpacing)return e.verticalSpacing=t.call(e),e.verticalSpacing}}function Xe(e){var t=this,n=e.getColumnsCount;if(n){var i={getWidth:function(){return t.scrollableContainer.getWidth()}};this.getActualColumnsCountForState=function(){var e=n(i);if(1!==e)return e}}else this.getActualColumnsCountForState=function(){};this.getActualColumnsCount=function(){return t.getActualColumnsCountForState()||1},this.getColumnsCount=function(){return t.getState()&&t.getState().columnsCount||1}}function Ze(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function et(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ze(Object(n),!0).forEach((function(t){tt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ze(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function tt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nt(){var e=this;function t(e){var n=e.stateUpdate,o=Date.now(),s=i.call(this),a=s.firstShownItemIndex,l=s.lastShownItemIndex,u=s.shownItemsHeight,h=s.firstNonMeasuredItemIndex;if(this.listHeightMeasurement.hasSnapshot()&&(l<this.listHeightMeasurement.getAnchorItemIndex()&&(l=this.listHeightMeasurement.getAnchorItemIndex()),h=void 0),!r.call(this,a,l))return ne("~ Because some of the will-be-hidden item heights (listed above) have changed since they've last been measured, redo layout. ~"),t.call(this,{stateUpdate:n});var c=this.layout.getBeforeItemsHeight(a),f=this.layout.getAfterItemsHeight(l,this.getItemsCount()),d=Date.now()-o;ne("~ Calculated Layout"+(this.bypass?" (bypass)":"")+" ~"),d<it||ie("Layout calculated in",d,"ms"),this.getColumnsCount()&&ne("Columns count",this.getColumnsCount()),ne("First shown item index",a),ne("Last shown item index",l),ne("Before items height",c),ne("After items height (actual or estimated)",f),ne("Average item height (used for estimated after items height calculation)",this.itemHeights.getAverage()),se()&&(ne("Item heights",this.getState().itemHeights.slice()),ne("Item states",this.getState().itemStates.slice())),this.onBeforeShowItems(this.getState().items,this.getState().itemHeights,a,l),this.firstNonMeasuredItemIndex=h,this.previouslyCalculatedLayout=void 0===u?void 0:{firstShownItemIndex:a,lastShownItemIndex:l,beforeItemsHeight:c,shownItemsHeight:u},this.updateState(et({firstShownItemIndex:a,lastShownItemIndex:l,beforeItemsHeight:c,afterItemsHeight:f},n))}function n(){var e=this.scroll.getVisibleAreaBounds();this.latestLayoutVisibleArea=e;var t=this.getListTopOffsetInsideScrollableContainer();return{top:e.top-t,bottom:e.bottom-t}}function i(){var e=this.getItemsCount(),t=n.call(this),i=t.top,r=t.bottom;return this.bypass?{firstShownItemIndex:0,lastShownItemIndex:e-1}:i<this.itemsContainer.getHeight()&&r>0?this.layout.getShownItemIndexes({itemsCount:this.getItemsCount(),visibleAreaTop:i,visibleAreaBottom:r}):(ne("The entire list is off-screen. No items are visible."),this.layout.getNonVisibleListShownItemIndexes())}function r(e,t){for(var n=!0,i=this.getState().firstShownItemIndex;i<=this.getState().lastShownItemIndex;){if(i>=e&&i<=t);else{var r=this.getState().itemHeights[i],a=o.call(this,i);a!==r&&(n&&(ne("~ Validate will-be-hidden item heights. ~"),s.call(this,i,r,a)),n=!1,ie("Item index",i,"is no longer visible and will be unmounted. Its height has changed from",r,"to",a,"since it was last measured. This is not necessarily a bug, and could happen, for example, on screen width change, or when there're several `onItemHeightDidChange(i)` calls issued at the same time, and the first one triggers a re-layout before the rest of them have had a chance to be executed."))}i++}return n}function o(e){var t=this.getState().firstShownItemIndex;return this.itemHeights.remeasureItemHeight(e,t)}function s(e,t,n){var i=this.previouslyCalculatedLayout;if(i){var r=n-t;e<i.firstShownItemIndex?i.beforeItemsHeight+=r:e>i.lastShownItemIndex?void 0!==i.afterItemsHeight&&(i.afterItemsHeight+=r):i.shownItemsHeight+=n-t}}this.onUpdateShownItemIndexes=function(n){var i=n.reason,r=n.stateUpdate,o=function(){r&&e.updateState(r)};return e.newItemsWillBeRendered||e.widthHasChanged||e._isResizing||0===e.getItemsCount()?o():(e.scroll.cancelScheduledLayout(),r=e.cancelLayoutTimer({stateUpdate:r}),ne("~ Update Layout (on ".concat(i,") ~")),void t.call(e,{stateUpdate:r}))},this.getListTopOffsetInsideScrollableContainer=function(){var t=e.scrollableContainer.getItemsContainerTopOffset();return e.listTopOffsetWatcher&&e.listTopOffsetWatcher.onListTopOffset(t),t},this._onItemHeightDidChange=function(t){ne("~ On Item Height Did Change was called ~"),ne("Item index",t);var n=e.getState(),i=n.itemHeights,r=n.firstShownItemIndex,a=n.lastShownItemIndex;if(!(t>=r&&t<=a))return ie("The item is no longer rendered. This is not necessarily a bug, and could happen, for example, when when a developer calls `onItemHeightDidChange(i)` while looping through a batch of items.");var l,u=i[t];if(void 0===u)return oe('"onItemHeightDidChange()" has been called for item index '.concat(t," but the item hasn't been rendered before."));ne("~ Re-measure item height ~");try{l=o.call(e,t)}catch(e){if(e instanceof d)return oe('"onItemHeightDidChange()" has been called for item index '.concat(t," but the item is not currently rendered and can't be measured. The exact error was: ").concat(e.message))}ne("Previous height",u),ne("New height",l),u!==l&&(ne("~ Item height has changed. Should update layout. ~"),s.call(e,t,u,l),e.waitingForRender?(ne("~ Another state update is already waiting to be rendered. Delay the layout update until then. ~"),e.updateLayoutAfterRenderBecauseItemHeightChanged=!0):e.onUpdateShownItemIndexes({reason:we}),e.newItemsWillBeRendered&&(e.itemHeightsThatChangedWhileNewItemsWereBeingRendered||(e.itemHeightsThatChangedWhileNewItemsWereBeingRendered={}),e.itemHeightsThatChangedWhileNewItemsWereBeingRendered[String(t)]=l))},this.getPrerenderMargin=function(){return 1*e.scrollableContainer.getHeight()},this.onBeforeShowItems=function(t,n,i,r){if(e.onItemInitialRender)for(var o=i;o<=r;)void 0===n[o]&&e.onItemInitialRender(t[o]),o++},this.measureItemHeightsAndSpacing=function(){e.itemHeights.measureItemHeights(e.getState().firstShownItemIndex,e.getState().lastShownItemIndex);var t=e.measureVerticalSpacingIfNotMeasured();if(t&&0!==t)return{verticalSpacing:t}},this.cancelLayoutTimer=function(t){var n=t.stateUpdate;return e.layoutTimer?(K(e.layoutTimer),e.layoutTimer=void 0,n||e.layoutTimerStateUpdate?(n=et(et({},e.layoutTimerStateUpdate),n),e.layoutTimerStateUpdate=void 0,n):void 0):n},this.scheduleLayoutTimer=function(t){var n=t.reason,i=t.stateUpdate;e.layoutTimerStateUpdate=i,e.layoutTimer=$((function(){e.layoutTimerStateUpdate=void 0,e.layoutTimer=void 0,e.onUpdateShownItemIndexes({reason:n,stateUpdate:i})}),0)}}var it=15;function rt(e){return rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rt(e)}var ot=Object.prototype.hasOwnProperty;function st(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function at(e,t){if(st(e,t))return!0;if("object"!==rt(e)||null===e||"object"!==rt(t)||null===t)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(var r=0;r<n.length;r++)if(!ot.call(t,n[r])||!st(e[n[r]],t[n[r]]))return!1;return!0}function lt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function ut(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?lt(Object(n),!0).forEach((function(t){ht(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ht(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ct(){var t=this;function n(e,t){if(e){var n=e.prependedItemsCount;e.appendedItemsCount;var i=this.getState(),r=i.itemHeights,o=i.itemStates;if(this.itemHeightsThatChangedWhileNewItemsWereBeingRendered)for(var s=0,a=Object.keys(this.itemHeightsThatChangedWhileNewItemsWereBeingRendered);s<a.length;s++){var l=a[s];r[n+Number(l)]=this.itemHeightsThatChangedWhileNewItemsWereBeingRendered[l]}if(this.itemStatesThatChangedWhileNewItemsWereBeingRendered)for(var u=0,h=Object.keys(this.itemStatesThatChangedWhileNewItemsWereBeingRendered);u<h.length;u++){var c=h[u];o[n+Number(c)]=this.itemStatesThatChangedWhileNewItemsWereBeingRendered[c]}if(0===n)return this.previouslyCalculatedLayout&&(this.previouslyCalculatedLayout.firstShownItemIndex===t.firstShownItemIndex&&this.previouslyCalculatedLayout.lastShownItemIndex===t.lastShownItemIndex||(ie('Unexpected (non-matching) "firstShownItemIndex" or "lastShownItemIndex" encountered in "onRender()" after appending items'),ie("Previously calculated layout",this.previouslyCalculatedLayout),ie("New layout",t),this.previouslyCalculatedLayout=void 0)),"SEAMLESS_APPEND";if(this.listHeightMeasurement.hasSnapshot()){if(0===t.firstShownItemIndex){ne("~ Restore Scroll Position ~");var f=this.listHeightMeasurement.getListBottomOffsetChange({beforeItemsHeight:t.beforeItemsHeight});return this.listHeightMeasurement.reset(),f?(ne("Scroll down by",f),this.scroll.scrollByY(f)):ne("Scroll position hasn't changed"),this.previouslyCalculatedLayout&&(0===this.previouslyCalculatedLayout.firstShownItemIndex&&this.previouslyCalculatedLayout.lastShownItemIndex===t.lastShownItemIndex-n?this.previouslyCalculatedLayout={beforeItemsHeight:0,shownItemsHeight:this.previouslyCalculatedLayout.shownItemsHeight+f,firstShownItemIndex:0,lastShownItemIndex:t.lastShownItemIndex}:(ie('Unexpected (non-matching) "firstShownItemIndex" or "lastShownItemIndex" encountered in "onRender()" after prepending items'),ie("Previously calculated layout",this.previouslyCalculatedLayout),ie("New layout",t),this.previouslyCalculatedLayout=void 0)),"SEAMLESS_PREPEND"}ie('Unexpected "firstShownItemIndex" '.concat(t.firstShownItemIndex,' encountered in "onRender()" after prepending items. Expected 0.'))}}this.previouslyCalculatedLayout=void 0}function i(e){var t=e.reason,n=e.stateUpdate;this._useTimeoutInRenderLoop?(n=this.cancelLayoutTimer({stateUpdate:n}),this.scheduleLayoutTimer({reason:t,stateUpdate:n})):this.onUpdateShownItemIndexes({reason:t,stateUpdate:n})}function r(){var e=Boolean(this.widthHasChanged);this.widthHasChanged=void 0;var t=void 0!==this.firstNonMeasuredItemIndex;t&&ne("Non-measured item index",this.firstNonMeasuredItemIndex),this.firstNonMeasuredItemIndex=void 0,this.newItemsWillBeRendered=void 0,this.itemHeightsThatChangedWhileNewItemsWereBeingRendered=void 0,this.itemStatesThatChangedWhileNewItemsWereBeingRendered=void 0;var n=this.updateLayoutAfterRenderBecauseItemHeightChanged;return this.updateLayoutAfterRenderBecauseItemHeightChanged=void 0,{nonMeasuredItemsHaveBeenRendered:t,itemHeightHasChanged:n,widthHasChanged:e}}this._onRender=function(o,s){var a,l,u;t.waitingForRender=!1,ne("~ Rendered ~"),se()&&ne("State",qe(o)),t.onStateChange&&(at(o,s)||t.onStateChange(o)),t.tbody&&(a=t.getItemsContainerElement(),l=o.beforeItemsHeight,u=o.afterItemsHeight,a.style.setProperty("--VirtualScroller-paddingTop",e(l)),a.style.setProperty("--VirtualScroller-paddingBottom",e(u))),t.mostRecentSetStateValue&&(at(o,t.mostRecentSetStateValue)||(ie("The most recent state that was set",qe(t.mostRecentSetStateValue)),oe("The state that has been rendered is not the most recent one that was set")));var h,c=r.call(t),f=c.nonMeasuredItemsHaveBeenRendered,d=c.itemHeightHasChanged,m=c.widthHasChanged;if(d&&(h=we),s||h){if(f&&(h=ve),m&&(h=ye,t.itemHeights.reset(),t.verticalSpacing=void 0),s){var g=s.items,p=o.items;if(p!==g){var I=t.getItemsDiff(g,p);if(I){var v=I.prependedItemsCount;t.itemHeights.onPrepend(v)}else t.itemHeights.reset();m||"SEAMLESS_PREPEND"!==n.call(t,I,o)&&(h=Ce)}}var y;if(s&&(o.firstShownItemIndex!==s.firstShownItemIndex||o.lastShownItemIndex!==s.lastShownItemIndex||o.items!==s.items)||m){var b=t.measureItemHeightsAndSpacing();b&&(y=ut(ut({},y),b))}var S=t.beforeResize.cleanUpBeforeResizeItemHeights();if(void 0!==S){var w=S.scrollBy,C=S.beforeResize;ne("Correct scroll position by",w),t.scroll.scrollByY(w),y=ut(ut({},y),{},{beforeResize:C})}t._isActive?h?i.call(t,{stateUpdate:y,reason:h}):y?t.updateState(y):ne("~ Finished Layout ~"):t._stoppedStateUpdate=y}}}function ft(){var e=this;this.onResize=function(){e.previouslyCalculatedLayout=void 0,e.listHeightMeasurement.reset();var t=e.newItemsWillBeRendered?e.newItemsWillBeRendered.count:e.getState().itemHeights.length,n=e.newItemsWillBeRendered?e.newItemsWillBeRendered.layout:e.getState(),i={scrollableContainerWidth:e.scrollableContainer.getWidth(),firstShownItemIndex:n.firstShownItemIndex,lastShownItemIndex:n.lastShownItemIndex,beforeItemsHeight:n.beforeItemsHeight,afterItemsHeight:n.afterItemsHeight,itemHeights:new Array(t),columnsCount:e.getActualColumnsCountForState(),verticalSpacing:void 0},r=n.firstShownItemIndex,o=n.lastShownItemIndex,s=e.getActualColumnsCount(),a=Math.floor(r/s)*s,l=Math.min(Math.ceil((o+1)/s)*s,t)-1;a!==r&&(ne("Columns Count changed from",e.getState().columnsCount||1,"to",s),ne("First Shown Item Index needs to change from",r,"to",a)),i.firstShownItemIndex=a,i.lastShownItemIndex=l;var u=e.getVerticalSpacing(),h=e.getColumnsCount();e.shouldDiscardBeforeResizeItemHeights()||0===a?e.beforeResize.shouldIncludeBeforeResizeValuesInState()&&(i.beforeResize=void 0):i.beforeResize={verticalSpacing:u,columnsCount:h,itemHeights:e.beforeResize.snapshotBeforeResizeItemHeights({firstShownItemIndex:r,newFirstShownItemIndex:a,newColumnsCount:s})},e.widthHasChanged={stateUpdate:i},e.updateState(i)},this.shouldDiscardBeforeResizeItemHeights=function(){if(e.newItemsWillBeRendered){var t=e.newItemsWillBeRendered,n=t.prepend,i=t.replace;return n||i}}}function dt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function mt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?dt(Object(n),!0).forEach((function(t){gt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function gt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pt(){var e=this;this.getItemsCount=function(){return e.getState().items.length},this._setItems=function(t){var n,i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=e.getState(),s=o.items,a=e.getState(),l=a.itemStates,u=e.widthHasChanged?e.widthHasChanged.stateUpdate:e.getState(),h=u.itemHeights;ne("~ Update items ~");var c=e.getItemsDiff(s,t);if(c){var f,d=e.widthHasChanged?e.widthHasChanged.stateUpdate:e.getState(),m=d.firstShownItemIndex,g=d.lastShownItemIndex,p=d.beforeItemsHeight,I=d.afterItemsHeight,v=0===m&&(r.preserveScrollPositionOnPrependItems||r.preserveScrollPosition),y=c.prependedItemsCount,b=c.appendedItemsCount;n=e.layout.getLayoutUpdateForItemsDiff({firstShownItemIndex:m,lastShownItemIndex:g,beforeItemsHeight:p,afterItemsHeight:I},{prependedItemsCount:y,appendedItemsCount:b},{itemsCount:t.length,columnsCount:e.getActualColumnsCount(),shouldRestoreScrollPosition:v,onResetGridLayout:function(){return f=!0}}),y>0&&(ne("Prepend",y,"items"),h=new Array(y).concat(h),l=We(new Array(y),(function(n){return e.getInitialItemState(t[n])})).concat(l),v?(ne("Will restore scroll position"),e.listHeightMeasurement.snapshotListHeightBeforeAddingNewItems({previousItems:s,newItems:t,prependedItemsCount:y}),void 0!==e.firstNonMeasuredItemIndex&&(e.firstNonMeasuredItemIndex+=y)):(ne("Reset layout"),f?(ne("Reason: Prepended items count",y,"is not divisible by Columns Count",e.getActualColumnsCount()),h=new Array(t.length)):ne("Reason: Prepended items' heights are unknown"),n=e.layout.getInitialLayoutValues({itemsCount:t.length,columnsCount:e.getActualColumnsCount()}),e.firstNonMeasuredItemIndex=void 0)),b>0&&(ne("Append",b,"items"),h=h.concat(new Array(b)),l=l.concat(We(new Array(b),(function(n){return e.getInitialItemState(t[y+s.length+n])})))),i={prepend:y>0,append:b>0}}else ne("Items have changed, and",c?"a re-layout from scratch has been requested.":"it's not a simple append and/or prepend.","Rerender the entire list from scratch."),ne("Previous items",s),ne("New items",t),h=new Array(t.length),l=We(new Array(t.length),(function(n){return e.getInitialItemState(t[n])})),n=e.layout.getInitialLayoutValues({itemsCount:t.length,columnsCount:e.getActualColumnsCount()}),e.firstNonMeasuredItemIndex=void 0,e.listHeightMeasurement.reset(),i={replace:!0};ne("~ Update state ~"),ne("First shown item index",n.firstShownItemIndex),ne("Last shown item index",n.lastShownItemIndex),ne("Before items height",n.beforeItemsHeight),ne("After items height (actual or estimated)",n.afterItemsHeight),e.onBeforeShowItems(t,h,n.firstShownItemIndex,n.lastShownItemIndex),e.newItemsWillBeRendered=mt(mt({},i),{},{count:t.length,layout:n});var S=mt(mt({},n),{},{items:t,itemStates:l,itemHeights:h});e.beforeResize.shouldIncludeBeforeResizeValuesInState()&&(e.shouldDiscardBeforeResizeItemHeights()?S.beforeResize=void 0:S.beforeResize=e.widthHasChanged?e.widthHasChanged.stateUpdate.beforeResize:e.getState().beforeResize),e._isSettingNewItems=!0,e.updateState(S)},this.getItemsDiff=function(t,n){return function(e,t,n){var i=-1,r=-1;if(e.length>0&&(i=function(e,t,n){for(var i=0;i<e.length;){if(n(e[i],t))return i;i++}return-1}(t,e[0],n),i>=0&&function(e,t,n,i){for(var r=0;r<e.length;){if(t.length<=n+r||!i(t[n+r],e[r]))return!1;r++}return!0}(e,t,i,n)&&(r=i+e.length-1)),i>=0&&r>=0)return{prependedItemsCount:i,appendedItemsCount:t.length-(r+1)}}(t,n,e.isItemEqual)}}function It(e,i){var r=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=o.render,a=o.state,l=o.getInitialItemState,u=void 0===l?function(){}:l,h=o.onStateChange,c=o.initialScrollPosition,f=o.onScrollPositionChange,d=o.scrollableContainer,m=o.measureItemsBatchSize,g=void 0===m?50:m,p=o.getColumnsCount,I=o.getItemId,v=o.tbody,y=o.estimatedItemHeight,b=o.getEstimatedVisibleItemRowsCount,S=o.onItemInitialRender,w=o.onItemFirstRender,C=o._useTimeoutInRenderLoop,O=o._waitForScrollingToStop,x=o.engine,H=o.bypass,R=o.getEstimatedItemHeight,T=o.getScrollableContainer;if(ne("~ Initialize ~"),this.engine=x||Z,R||"number"!=typeof y||(R=function(){return y}),!T&&d&&(T=function(){return d}),this.getItemsContainerElement=e,o.getState||o.setState)throw new Error("[virtual-scroller] `getState`/`setState` options usage has changed in the new version. See the readme for more details.");if(v){if(this.engine!==Z)throw new Error("[virtual-scroller] `tbody` option is only supported for DOM rendering engine");ne("~ <tbody/> detected ~"),this.tbody=!0,n()||(ne("~ <tbody/> not supported ~"),oe(t),H=!0)}H&&ne('~ "bypass" mode ~'),this.bypass=H,this._useTimeoutInRenderLoop=C,this.isItemEqual=I?function(e,t){return I(e)===I(t)}:function(e,t){return e===t},S?this.onItemInitialRender=S:w&&(this.onItemInitialRender=function(e){ie("`onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.");var t=r.getState().items.indexOf(e);t>=0&&w(t)}),a&&(i=a.items),ne("Items count",i.length),R&&ne("Estimated item height",R()),Ke.call(this,{state:a,getInitialItemState:u,onStateChange:h,render:s,items:i}),Qe.call(this),Xe.call(this,{getColumnsCount:p}),nt.call(this),ct.call(this),ft.call(this),pt.call(this),vt.call(this,{getScrollableContainer:T,getEstimatedItemHeight:R,getEstimatedVisibleItemRowsCount:b,measureItemsBatchSize:g,initialScrollPosition:c,onScrollPositionChange:f,waitForScrollingToStop:O}),a&&(this.itemHeights.readItemHeightsFromState(a),this.beforeResize.initializeFromState(a))}function vt(e){var t=this,n=e.getScrollableContainer,i=e.getEstimatedItemHeight,r=e.getEstimatedVisibleItemRowsCount,o=e.measureItemsBatchSize,s=e.initialScrollPosition,a=e.onScrollPositionChange,l=e.waitForScrollingToStop;this.itemsContainer=this.engine.createItemsContainer(this.getItemsContainerElement),this.getItemsContainerElement()&&this.itemsContainer.clear(),this.scrollableContainer=this.engine.createScrollableContainer(n,this.getItemsContainerElement),this.itemHeights=new Ne({container:this.itemsContainer,getItemHeight:function(e){return t.getState().itemHeights[e]},setItemHeight:function(e,n){return t.getState().itemHeights[e]=n}}),this.layout=new de({bypass:this.bypass,getInitialEstimatedItemHeight:i,getInitialEstimatedVisibleItemRowsCount:r,measureItemsBatchSize:o,getPrerenderMargin:function(){return t.getPrerenderMargin()},getVerticalSpacing:function(){return t.getVerticalSpacing()},getVerticalSpacingBeforeResize:function(){return t.getVerticalSpacingBeforeResize()},getColumnsCount:function(){return t.getColumnsCount()},getColumnsCountBeforeResize:function(){return t.getState().beforeResize&&t.getState().beforeResize.columnsCount},getItemHeight:function(e){return t.getState().itemHeights[e]},getItemHeightBeforeResize:function(e){return t.getState().beforeResize&&t.getState().beforeResize.itemHeights[e]},getBeforeResizeItemsCount:function(){return t.getState().beforeResize?t.getState().beforeResize.itemHeights.length:0},getAverageItemHeight:function(){return t.itemHeights.getAverage()},getMaxVisibleAreaHeight:function(){return t.scrollableContainer&&t.scrollableContainer.getHeight()},getPreviouslyCalculatedLayout:function(){return t.previouslyCalculatedLayout}}),this.resize=new He({bypass:this.bypass,getWidth:function(){return t.scrollableContainer.getWidth()},getHeight:function(){return t.scrollableContainer.getHeight()},listenForResize:function(e){return t.scrollableContainer.onResize(e)},onResizeStart:function(){ne("~ Scrollable container resize started ~"),t._isResizing=!0},onResizeStop:function(){ne("~ Scrollable container resize finished ~"),t._isResizing=void 0},onNoChange:function(){t.onUpdateShownItemIndexes({reason:Se})},onHeightChange:function(){return t.onUpdateShownItemIndexes({reason:be})},onWidthChange:function(e,n){ne("~ Scrollable container width changed from",e,"to",n,"~"),t.onResize()}}),this.scroll=new Me({bypass:this.bypass,scrollableContainer:this.scrollableContainer,itemsContainer:this.itemsContainer,waitForScrollingToStop:l,onScroll:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.delayed;t.onUpdateShownItemIndexes({reason:n?ge:me})},initialScrollPosition:s,onScrollPositionChange:a,isImmediateLayoutScheduled:function(){return Boolean(t.layoutTimer)},hasNonRenderedItemsAtTheTop:function(){return t.getState().firstShownItemIndex>0},hasNonRenderedItemsAtTheBottom:function(){return t.getState().lastShownItemIndex<t.getItemsCount()-1},getLatestLayoutVisibleArea:function(){return t.latestLayoutVisibleArea},getListTopOffset:this.getListTopOffsetInsideScrollableContainer,getPrerenderMargin:function(){return t.getPrerenderMargin()}}),this.listHeightMeasurement=new Ve({itemsContainer:this.itemsContainer,getListTopOffset:this.getListTopOffsetInsideScrollableContainer}),this.engine.watchListTopOffset&&(this.listTopOffsetWatcher=this.engine.watchListTopOffset({getListTopOffset:this.getListTopOffsetInsideScrollableContainer,onListTopOffsetChange:function(e){return e.reason,t.onUpdateShownItemIndexes({reason:Oe})}})),this.beforeResize=new Le({getState:this.getState,getVerticalSpacing:this.getVerticalSpacing,getColumnsCount:this.getColumnsCount})}function yt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function bt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?yt(Object(n),!0).forEach((function(t){Ct(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function St(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wt(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Ct(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ot=function(){function e(t,n){var i=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};St(this,e),Ct(this,"stop",(function(){if(!i._isActive)throw new Error("[virtual-scroller] Can't stop a `VirtualScroller` that hasn't been started");i._isActive=!1,ne("~ Stop ~"),i.resize.stop(),i.scroll.stop(),i.listTopOffsetWatcher&&i.listTopOffsetWatcher.isStarted()&&i.listTopOffsetWatcher.stop(),i.cancelLayoutTimer({})})),Ct(this,"updateLayout",(function(){i.hasToBeStarted(),i.onUpdateShownItemIndexes({reason:pe})})),Ct(this,"onRender",(function(){i._onRender(i.getState(),i.previousState)})),It.call(this,t,n,r)}var t,n,o;return t=e,n=[{key:"start",value:function(){if(this._isActive)throw new Error("[virtual-scroller] `VirtualScroller` has already been started");!1===this._isActive||(this.waitingForRender=!0,this._usesCustomStateStorage||this.useDefaultStateStorage(),this._render&&this._render(this.getState())),ne("~ Start ~"),this._isActive=!0,this.listHeightMeasurement.reset(),this._isResizing=void 0,this._isSettingNewItems=void 0,this.tbody&&(this.getItemsContainerElement().classList.contains(i)&&Boolean(document.getElementById(r))||function(e){e.classList.add(i);var t=document.createElement("style");t.id=r,t.innerText="\n\t\ttbody.".concat(i,":before {\n\t\t\tcontent: '';\n\t\t\tdisplay: table-row;\n\t\t\theight: var(--VirtualScroller-paddingTop);\n\t\t}\n\t\ttbody.").concat(i,":after {\n\t\t\tcontent: '';\n\t\t\tdisplay: table-row;\n\t\t\theight: var(--VirtualScroller-paddingBottom);\n\t\t}\n\t").replace(/[\n\t]/g,""),document.head.appendChild(t)}(this.getItemsContainerElement()));var e=this._stoppedStateUpdate;this._stoppedStateUpdate=void 0,this.verticalSpacing=void 0;var t=this.measureItemHeightsAndSpacing();if(t&&(e=bt(bt({},e),t)),this.resize.start(),this.scroll.start(),void 0===this.getState().scrollableContainerWidth){var n=this.scrollableContainer.getWidth();e=bt(bt({},e),{},{scrollableContainerWidth:n})}else{var o=this.scrollableContainer.getWidth(),s=this.getState().scrollableContainerWidth;if(o!==s)return ne("~ Scrollable container width changed from",s,"to",o,"~"),this.onResize()}if(this._usesCustomStateStorage&&this.getActualColumnsCount()!==(this.getState().columnsCount||1))return this.onResize();this.onUpdateShownItemIndexes({reason:Ie,stateUpdate:e})}},{key:"hasToBeStarted",value:function(){if(!this._isActive)throw new Error("[virtual-scroller] `VirtualScroller` hasn't been started")}},{key:"getItemScrollPosition",value:function(e){var t=this.layout.getItemTopOffset(e);if(void 0!==t)return this.getListTopOffsetInsideScrollableContainer()+t}},{key:"onItemHeightChange",value:function(e){ie("`.onItemHeightChange(i)` method was renamed to `.onItemHeightDidChange(i)`"),this.onItemHeightDidChange(e)}},{key:"onItemHeightDidChange",value:function(e){this.hasToBeStarted(),this._onItemHeightDidChange(e)}},{key:"setItemState",value:function(e,t){this.hasToBeStarted(),this._setItemState(e,t)}},{key:"onItemStateChange",value:function(e,t){this.setItemState(e,t)}},{key:"setItems",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.hasToBeStarted(),this._setItems(e,t)}}],n&&wt(t.prototype,n),o&&wt(t,o),Object.defineProperty(t,"prototype",{writable:!1}),e}(),xt=["onMount","onItemUnmount"];function Ht(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Rt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ht(Object(n),!0).forEach((function(t){Et(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ht(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Tt(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},o=Object.keys(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Pt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jt(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Et(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Lt=function(){function t(n,i,r){var o=this,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Pt(this,t),Et(this,"render",(function(t,n){var i=t.items,r=t.firstShownItemIndex,s=t.lastShownItemIndex,a=t.beforeItemsHeight,l=t.afterItemsHeight;o.tbody||(o.container.style.paddingTop=e(a),o.container.style.paddingBottom=e(l));var u=n&&i===n.items&&i.length>0;if(u)for(var h=n.lastShownItemIndex;h>=n.firstShownItemIndex;)h>=r&&h<=s||(ne("DOM: Remove element for item index",h),o.unmountItem(o.container.childNodes[h-n.firstShownItemIndex])),h--;else for(ne("DOM: Rerender the list from scratch");o.container.firstChild;)o.unmountItem(o.container.firstChild);for(var c=u,f=c&&o.container.firstChild,d=r;d<=s;){if(u&&d>=n.firstShownItemIndex&&d<=n.lastShownItemIndex)c&&(c=!1);else{var m=o.renderItem(i[d]);c?(ne("DOM: Prepend element for item index",d),o.container.insertBefore(m,f)):(ne("DOM: Append element for item index",d),o.container.appendChild(m))}d++}})),Et(this,"onUnmount",(function(){ie("`.onUnmount()` instance method name is deprecated, use `.stop()` instance method name instead."),o.stop()})),Et(this,"destroy",(function(){ie("`.destroy()` instance method name is deprecated, use `.stop()` instance method name instead."),o.stop()})),Et(this,"stop",(function(){o.virtualScroller.stop()})),Et(this,"start",(function(){o.virtualScroller.start()})),this.container=n,this.renderItem=r;var a=s.onMount,l=s.onItemUnmount,u=Tt(s,xt);this.onItemUnmount=l,this.tbody="TBODY"===this.container.tagName,this.virtualScroller=new Ot((function(){return o.container}),i,Rt(Rt({},u),{},{render:this.render,tbody:this.tbody})),this.start(),a&&a()}var n,i,r;return n=t,i=[{key:"unmountItem",value:function(e){this.container.removeChild(e),this.onItemUnmount&&this.onItemUnmount(e)}},{key:"onItemHeightChange",value:function(e){ie("`.onItemHeightChange(i)` method was renamed to `.onItemHeightDidChange(i)`"),this.onItemHeightDidChange(e)}},{key:"onItemHeightDidChange",value:function(e){this.virtualScroller.onItemHeightDidChange(e)}},{key:"setItemState",value:function(e,t){this.virtualScroller.setItemState(e,t)}},{key:"updateItems",value:function(e,t){ie("`.updateItems()` method was renamed to `.setItems(i)`"),this.setItems(e,t)}},{key:"setItems",value:function(e,t){this.virtualScroller.setItems(e,t)}}],i&&jt(n.prototype,i),r&&jt(n,r),Object.defineProperty(n,"prototype",{writable:!1}),t}();return Lt}));
2
2
  //# sourceMappingURL=virtual-scroller-dom.js.map