1 | {"version":3,"sources":["src/cdk/cdk-scrolling.umd.js"],"names":["global","factory","exports","module","require","define","amd","self","ng","cdk","scrolling","coercion","core","rxjs","operators","platform","common","bidi","collections","this","i0","i1","i2","VIRTUAL_SCROLL_STRATEGY","InjectionToken","FixedSizeVirtualScrollStrategy","itemSize","minBufferPx","maxBufferPx","_scrolledIndexChange","Subject","scrolledIndexChange","pipe","distinctUntilChanged","_viewport","_itemSize","_minBufferPx","_maxBufferPx","prototype","attach","viewport","_updateTotalContentSize","_updateRenderedRange","detach","complete","updateItemAndBufferSize","Error","onContentScrolled","onDataLengthChanged","onContentRendered","onRenderedOffsetChanged","scrollToIndex","index","behavior","scrollToOffset","setTotalContentSize","getDataLength","renderedRange","getRenderedRange","newRange","start","end","viewportSize","getViewportSize","dataLength","scrollOffset","measureScrollOffset","firstVisibleIndex","maxVisibleItems","Math","ceil","newVisibleIndex","max","min","floor","startBuffer","expandStart","endBuffer","expandEnd","setRenderedRange","setRenderedContentOffset","next","_fixedSizeVirtualScrollStrategyFactory","fixedSizeDir","_scrollStrategy","CdkFixedSizeVirtualScroll","Object","defineProperty","get","set","value","coerceNumberProperty","enumerable","configurable","ngOnChanges","decorators","type","Directive","args","selector","providers","provide","useFactory","deps","forwardRef","propDecorators","Input","ScrollDispatcher","_ngZone","_platform","document","_scrolled","_globalSubscription","_scrolledCount","scrollContainers","Map","_document","register","scrollable","_this","has","elementScrolled","subscribe","deregister","scrollableReference","unsubscribe","delete","scrolled","auditTimeInMs","isBrowser","Observable","observer","_addGlobalListener","subscription","auditTime","_removeGlobalListener","of","ngOnDestroy","forEach","_","container","ancestorScrolled","elementRef","ancestors","getAncestorScrollContainers","filter","target","indexOf","scrollingContainers","_subscription","_scrollableContainsElement","push","_getDocument","_getWindow","defaultView","window","element","nativeElement","scrollableElement","getElementRef","parentElement","runOutsideAngular","fromEvent","ɵprov","ɵɵdefineInjectable","ScrollDispatcher_Factory","ɵɵinject","NgZone","Platform","DOCUMENT","token","providedIn","Injectable","ctorParameters","undefined","Optional","Inject","CdkScrollable","scrollDispatcher","ngZone","dir","_destroyed","_elementScrolled","takeUntil","ngOnInit","scrollTo","options","el","isRtl","left","right","bottom","top","scrollHeight","clientHeight","getRtlScrollAxisType","scrollWidth","clientWidth","_applyScrollToOptions","supportsScrollBehavior","scrollTop","scrollLeft","from","ElementRef","Directionality","extendStatics","d","b","setPrototypeOf","__proto__","Array","p","hasOwnProperty","__values","o","s","Symbol","iterator","m","i","call","length","done","TypeError","ViewportRuler","_change","_changeListener","event","addEventListener","change","_updateViewportSize","removeEventListener","_viewportSize","output","width","height","getViewportRect","scrollPosition","getViewportScrollPosition","_a","documentElement","documentRect","getBoundingClientRect","body","scrollY","scrollX","throttleTime","innerWidth","innerHeight","ViewportRuler_Factory","SCROLL_SCHEDULER","requestAnimationFrame","animationFrameScheduler","asapScheduler","CdkVirtualScrollViewport","_super","_changeDetectorRef","viewportRuler","_detachedSubject","_renderedRangeSubject","_orientation","Promise","resolve","then","run","renderedRangeStream","asObservable","_totalContentSize","_totalContentWidth","_totalContentHeight","_renderedRange","_dataLength","_renderedContentOffset","_renderedContentOffsetNeedsRewrite","_isChangeDetectionPending","_runAfterChangeDetection","_viewportChanges","Subscription","EMPTY","checkViewportSize","__extends","__","constructor","create","orientation","_calculateSpacerSize","_measureViewportSize","startWith","_markChangeDetectionNeeded","forOf","_forOf","dataStream","data","newLength","_doChangeDetection","size","range","rangesEqual","r1","r2","getOffsetToRenderedContentStart","offset","to","isHorizontal","axis","transform","Number","_renderedContentTransform","measureRenderedContentSize","contentEl","_contentWrapper","offsetWidth","offsetHeight","measureRangeSize","viewportEl","runAfter","e_1","style","markForCheck","runAfterChangeDetection","runAfterChangeDetection_1","runAfterChangeDetection_1_1","fn","e_1_1","error","return","getOffset","direction","node","rect","Component","template","host","class","[class.cdk-virtual-scroll-orientation-horizontal]","[class.cdk-virtual-scroll-orientation-vertical]","encapsulation","ViewEncapsulation","None","changeDetection","ChangeDetectionStrategy","OnPush","useExisting","styles","ChangeDetectorRef","Output","ViewChild","static","CdkScrollableModule","ScrollingModule","CdkVirtualForOf","_viewContainerRef","_template","_differs","viewChange","_dataSourceChanges","cdkVirtualForTemplateCacheSize","pairwise","switchMap","_b","__read","n","r","e","ar","_changeDataSource","shareReplay","_differ","_templateCache","_needsUpdate","_data","_onRenderedDataChange","_cdkVirtualForOf","isDataSource","ArrayDataSource","isObservable","slice","_cdkVirtualForTrackBy","item","firstNode","lastNode","renderedStartIndex","rangeLen","view","rootNodes","ngDoCheck","changes","diff","_renderedItems","_applyChanges","_updateContext","_c","destroy","find","cdkVirtualForTrackBy","oldDs","newDs","disconnect","connect","count","context","_updateComputedContextProperties","detectChanges","forEachOperation","record","adjustedPreviousIndex","currentIndex","previousIndex","_insertViewForNewItem","$implicit","_cacheView","_detachView","move","forEachIdentityChange","remove","_insertViewFromCache","_createEmbeddedViewAt","first","last","even","odd","createEmbeddedView","cdkVirtualForOf","cachedView","pop","insert","ViewContainerRef","TemplateRef","IterableDiffers","SkipSelf","cdkVirtualForTemplate","NgModule","declarations","imports","BidiModule","PlatformModule","DEFAULT_RESIZE_TIME","DEFAULT_SCROLL_TIME"],"mappings":"CAAC,SAAUA,EAAQC,GACI,iBAAZC,SAA0C,oBAAXC,OAAyBF,EAAQC,QAASE,QAAQ,yBAA0BA,QAAQ,iBAAkBA,QAAQ,QAASA,QAAQ,kBAAmBA,QAAQ,yBAA0BA,QAAQ,mBAAoBA,QAAQ,qBAAsBA,QAAQ,6BAC1Q,mBAAXC,QAAyBA,OAAOC,IAAMD,OAAO,yBAA0B,CAAC,UAAW,wBAAyB,gBAAiB,OAAQ,iBAAkB,wBAAyB,kBAAmB,oBAAqB,4BAA6BJ,GAClOA,IAAzBD,EAASA,GAAUO,MAAsBC,GAAKR,EAAOQ,IAAM,GAAIR,EAAOQ,GAAGC,IAAMT,EAAOQ,GAAGC,KAAO,GAAIT,EAAOQ,GAAGC,IAAIC,UAAY,IAAKV,EAAOQ,GAAGC,IAA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AAM5E,EAAG2Z,SAAU7U,KAAM,CAAC,CAChBhG,QAAS,CAAC+K,GACV+P,aAAc,CAAC/P,QAM3B4K,EACA,SAASA,OAIG9P,WAAa,CACzB,CAAEC,KAAM5E,EAAG2Z,SAAU7U,KAAM,CAAC,CAChB+U,QAAS,CACLha,EAAKia,WACL7Z,EAAG8Z,eACHvF,GAEJ1V,QAAS,CACLe,EAAKia,WACLtF,EACAvQ,EACAyQ,EACAhG,GAEJkL,aAAc,CACV3V,EACAyQ,EACAhG;;;;;;;;;;;;;;;AAyBpB5P,EAAQmF,0BAA4BA,EACpCnF,EAAQ+K,cAAgBA,EACxB/K,EAAQ0V,oBAAsBA,EAC9B1V,EAAQ4V,gBAAkBA,EAC1B5V,EAAQ4P,yBAA2BA,EACnC5P,EAAQkb,oBA95BkB,GA+5B1Blb,EAAQmb,oBA7hDkB,GA8hD1Bnb,EAAQuB,+BAAiCA,EACzCvB,EAAQyG,iBAAmBA,EAC3BzG,EAAQ2V,gBAAkBA,EAC1B3V,EAAQqB,wBAA0BA,EAClCrB,EAAQ8N,cAAgBA,EACxB9N,EAAQgF,uCAAyCA,EAEjDI,OAAOC,eAAerF,EAAS,aAAc,CAAEwF,OAAO","sourcesContent":["(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/cdk/coercion'), require('@angular/core'), require('rxjs'), require('rxjs/operators'), require('@angular/cdk/platform'), require('@angular/common'), require('@angular/cdk/bidi'), require('@angular/cdk/collections')) :\n typeof define === 'function' && define.amd ? define('@angular/cdk/scrolling', ['exports', '@angular/cdk/coercion', '@angular/core', 'rxjs', 'rxjs/operators', '@angular/cdk/platform', '@angular/common', '@angular/cdk/bidi', '@angular/cdk/collections'], factory) :\n (global = global || self, factory((global.ng = global.ng || {}, global.ng.cdk = global.ng.cdk || {}, global.ng.cdk.scrolling = {}), global.ng.cdk.coercion, global.ng.core, global.rxjs, global.rxjs.operators, global.ng.cdk.platform, global.ng.common, global.ng.cdk.bidi, global.ng.cdk.collections));\n}(this, (function (exports, coercion, i0, rxjs, operators, i1, i2, bidi, collections) { 'use strict';\n\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n /** The injection token used to specify the virtual scrolling strategy. */\n var VIRTUAL_SCROLL_STRATEGY = new i0.InjectionToken('VIRTUAL_SCROLL_STRATEGY');\n\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n /** Virtual scrolling strategy for lists with items of known fixed size. */\n var FixedSizeVirtualScrollStrategy = /** @class */ (function () {\n /**\n * @param itemSize The size of the items in the virtually scrolling list.\n * @param minBufferPx The minimum amount of buffer (in pixels) before needing to render more\n * @param maxBufferPx The amount of buffer (in pixels) to render when rendering more.\n */\n function FixedSizeVirtualScrollStrategy(itemSize, minBufferPx, maxBufferPx) {\n this._scrolledIndexChange = new rxjs.Subject();\n /** @docs-private Implemented as part of VirtualScrollStrategy. */\n this.scrolledIndexChange = this._scrolledIndexChange.pipe(operators.distinctUntilChanged());\n /** The attached viewport. */\n this._viewport = null;\n this._itemSize = itemSize;\n this._minBufferPx = minBufferPx;\n this._maxBufferPx = maxBufferPx;\n }\n /**\n * Attaches this scroll strategy to a viewport.\n * @param viewport The viewport to attach this strategy to.\n */\n FixedSizeVirtualScrollStrategy.prototype.attach = function (viewport) {\n this._viewport = viewport;\n this._updateTotalContentSize();\n this._updateRenderedRange();\n };\n /** Detaches this scroll strategy from the currently attached viewport. */\n FixedSizeVirtualScrollStrategy.prototype.detach = function () {\n this._scrolledIndexChange.complete();\n this._viewport = null;\n };\n /**\n * Update the item size and buffer size.\n * @param itemSize The size of the items in the virtually scrolling list.\n * @param minBufferPx The minimum amount of buffer (in pixels) before needing to render more\n * @param maxBufferPx The amount of buffer (in pixels) to render when rendering more.\n */\n FixedSizeVirtualScrollStrategy.prototype.updateItemAndBufferSize = function (itemSize, minBufferPx, maxBufferPx) {\n if (maxBufferPx < minBufferPx) {\n throw Error('CDK virtual scroll: maxBufferPx must be greater than or equal to minBufferPx');\n }\n this._itemSize = itemSize;\n this._minBufferPx = minBufferPx;\n this._maxBufferPx = maxBufferPx;\n this._updateTotalContentSize();\n this._updateRenderedRange();\n };\n /** @docs-private Implemented as part of VirtualScrollStrategy. */\n FixedSizeVirtualScrollStrategy.prototype.onContentScrolled = function () {\n this._updateRenderedRange();\n };\n /** @docs-private Implemented as part of VirtualScrollStrategy. */\n FixedSizeVirtualScrollStrategy.prototype.onDataLengthChanged = function () {\n this._updateTotalContentSize();\n this._updateRenderedRange();\n };\n /** @docs-private Implemented as part of VirtualScrollStrategy. */\n FixedSizeVirtualScrollStrategy.prototype.onContentRendered = function () { };\n /** @docs-private Implemented as part of VirtualScrollStrategy. */\n FixedSizeVirtualScrollStrategy.prototype.onRenderedOffsetChanged = function () { };\n /**\n * Scroll to the offset for the given index.\n * @param index The index of the element to scroll to.\n * @param behavior The ScrollBehavior to use when scrolling.\n */\n FixedSizeVirtualScrollStrategy.prototype.scrollToIndex = function (index, behavior) {\n if (this._viewport) {\n this._viewport.scrollToOffset(index * this._itemSize, behavior);\n }\n };\n /** Update the viewport's total content size. */\n FixedSizeVirtualScrollStrategy.prototype._updateTotalContentSize = function () {\n if (!this._viewport) {\n return;\n }\n this._viewport.setTotalContentSize(this._viewport.getDataLength() * this._itemSize);\n };\n /** Update the viewport's rendered range. */\n FixedSizeVirtualScrollStrategy.prototype._updateRenderedRange = function () {\n if (!this._viewport) {\n return;\n }\n var renderedRange = this._viewport.getRenderedRange();\n var newRange = { start: renderedRange.start, end: renderedRange.end };\n var viewportSize = this._viewport.getViewportSize();\n var dataLength = this._viewport.getDataLength();\n var scrollOffset = this._viewport.measureScrollOffset();\n var firstVisibleIndex = scrollOffset / this._itemSize;\n // If user scrolls to the bottom of the list and data changes to a smaller list\n if (newRange.end > dataLength) {\n // We have to recalculate the first visible index based on new data length and viewport size.\n var maxVisibleItems = Math.ceil(viewportSize / this._itemSize);\n var newVisibleIndex = Math.max(0, Math.min(firstVisibleIndex, dataLength - maxVisibleItems));\n // If first visible index changed we must update scroll offset to handle start/end buffers\n // Current range must also be adjusted to cover the new position (bottom of new list).\n if (firstVisibleIndex != newVisibleIndex) {\n firstVisibleIndex = newVisibleIndex;\n scrollOffset = newVisibleIndex * this._itemSize;\n newRange.start = Math.floor(firstVisibleIndex);\n }\n newRange.end = Math.max(0, Math.min(dataLength, newRange.start + maxVisibleItems));\n }\n var startBuffer = scrollOffset - newRange.start * this._itemSize;\n if (startBuffer < this._minBufferPx && newRange.start != 0) {\n var expandStart = Math.ceil((this._maxBufferPx - startBuffer) / this._itemSize);\n newRange.start = Math.max(0, newRange.start - expandStart);\n newRange.end = Math.min(dataLength, Math.ceil(firstVisibleIndex + (viewportSize + this._minBufferPx) / this._itemSize));\n }\n else {\n var endBuffer = newRange.end * this._itemSize - (scrollOffset + viewportSize);\n if (endBuffer < this._minBufferPx && newRange.end != dataLength) {\n var expandEnd = Math.ceil((this._maxBufferPx - endBuffer) / this._itemSize);\n if (expandEnd > 0) {\n newRange.end = Math.min(dataLength, newRange.end + expandEnd);\n newRange.start = Math.max(0, Math.floor(firstVisibleIndex - this._minBufferPx / this._itemSize));\n }\n }\n }\n this._viewport.setRenderedRange(newRange);\n this._viewport.setRenderedContentOffset(this._itemSize * newRange.start);\n this._scrolledIndexChange.next(Math.floor(firstVisibleIndex));\n };\n return FixedSizeVirtualScrollStrategy;\n }());\n /**\n * Provider factory for `FixedSizeVirtualScrollStrategy` that simply extracts the already created\n * `FixedSizeVirtualScrollStrategy` from the given directive.\n * @param fixedSizeDir The instance of `CdkFixedSizeVirtualScroll` to extract the\n * `FixedSizeVirtualScrollStrategy` from.\n */\n function _fixedSizeVirtualScrollStrategyFactory(fixedSizeDir) {\n return fixedSizeDir._scrollStrategy;\n }\n /** A virtual scroll strategy that supports fixed-size items. */\n var CdkFixedSizeVirtualScroll = /** @class */ (function () {\n function CdkFixedSizeVirtualScroll() {\n this._itemSize = 20;\n this._minBufferPx = 100;\n this._maxBufferPx = 200;\n /** The scroll strategy used by this directive. */\n this._scrollStrategy = new FixedSizeVirtualScrollStrategy(this.itemSize, this.minBufferPx, this.maxBufferPx);\n }\n Object.defineProperty(CdkFixedSizeVirtualScroll.prototype, \"itemSize\", {\n /** The size of the items in the list (in pixels). */\n get: function () { return this._itemSize; },\n set: function (value) { this._itemSize = coercion.coerceNumberProperty(value); },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(CdkFixedSizeVirtualScroll.prototype, \"minBufferPx\", {\n /**\n * The minimum amount of buffer rendered beyond the viewport (in pixels).\n * If the amount of buffer dips below this number, more items will be rendered. Defaults to 100px.\n */\n get: function () { return this._minBufferPx; },\n set: function (value) { this._minBufferPx = coercion.coerceNumberProperty(value); },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(CdkFixedSizeVirtualScroll.prototype, \"maxBufferPx\", {\n /**\n * The number of pixels worth of buffer to render for when rendering new items. Defaults to 200px.\n */\n get: function () { return this._maxBufferPx; },\n set: function (value) { this._maxBufferPx = coercion.coerceNumberProperty(value); },\n enumerable: false,\n configurable: true\n });\n CdkFixedSizeVirtualScroll.prototype.ngOnChanges = function () {\n this._scrollStrategy.updateItemAndBufferSize(this.itemSize, this.minBufferPx, this.maxBufferPx);\n };\n return CdkFixedSizeVirtualScroll;\n }());\n CdkFixedSizeVirtualScroll.decorators = [\n { type: i0.Directive, args: [{\n selector: 'cdk-virtual-scroll-viewport[itemSize]',\n providers: [{\n provide: VIRTUAL_SCROLL_STRATEGY,\n useFactory: _fixedSizeVirtualScrollStrategyFactory,\n deps: [i0.forwardRef(function () { return CdkFixedSizeVirtualScroll; })],\n }],\n },] }\n ];\n CdkFixedSizeVirtualScroll.propDecorators = {\n itemSize: [{ type: i0.Input }],\n minBufferPx: [{ type: i0.Input }],\n maxBufferPx: [{ type: i0.Input }]\n };\n\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n /** Time in ms to throttle the scrolling events by default. */\n var DEFAULT_SCROLL_TIME = 20;\n /**\n * Service contained all registered Scrollable references and emits an event when any one of the\n * Scrollable references emit a scrolled event.\n */\n var ScrollDispatcher = /** @class */ (function () {\n function ScrollDispatcher(_ngZone, _platform, \n /** @breaking-change 11.0.0 make document required */\n document) {\n this._ngZone = _ngZone;\n this._platform = _platform;\n /** Subject for notifying that a registered scrollable reference element has been scrolled. */\n this._scrolled = new rxjs.Subject();\n /** Keeps track of the global `scroll` and `resize` subscriptions. */\n this._globalSubscription = null;\n /** Keeps track of the amount of subscriptions to `scrolled`. Used for cleaning up afterwards. */\n this._scrolledCount = 0;\n /**\n * Map of all the scrollable references that are registered with the service and their\n * scroll event subscriptions.\n */\n this.scrollContainers = new Map();\n this._document = document;\n }\n /**\n * Registers a scrollable instance with the service and listens for its scrolled events. When the\n * scrollable is scrolled, the service emits the event to its scrolled observable.\n * @param scrollable Scrollable instance to be registered.\n */\n ScrollDispatcher.prototype.register = function (scrollable) {\n var _this = this;\n if (!this.scrollContainers.has(scrollable)) {\n this.scrollContainers.set(scrollable, scrollable.elementScrolled()\n .subscribe(function () { return _this._scrolled.next(scrollable); }));\n }\n };\n /**\n * Deregisters a Scrollable reference and unsubscribes from its scroll event observable.\n * @param scrollable Scrollable instance to be deregistered.\n */\n ScrollDispatcher.prototype.deregister = function (scrollable) {\n var scrollableReference = this.scrollContainers.get(scrollable);\n if (scrollableReference) {\n scrollableReference.unsubscribe();\n this.scrollContainers.delete(scrollable);\n }\n };\n /**\n * Returns an observable that emits an event whenever any of the registered Scrollable\n * references (or window, document, or body) fire a scrolled event. Can provide a time in ms\n * to override the default \"throttle\" time.\n *\n * **Note:** in order to avoid hitting change detection for every scroll event,\n * all of the events emitted from this stream will be run outside the Angular zone.\n * If you need to update any data bindings as a result of a scroll event, you have\n * to run the callback using `NgZone.run`.\n */\n ScrollDispatcher.prototype.scrolled = function (auditTimeInMs) {\n var _this = this;\n if (auditTimeInMs === void 0) { auditTimeInMs = DEFAULT_SCROLL_TIME; }\n if (!this._platform.isBrowser) {\n return rxjs.of();\n }\n return new rxjs.Observable(function (observer) {\n if (!_this._globalSubscription) {\n _this._addGlobalListener();\n }\n // In the case of a 0ms delay, use an observable without auditTime\n // since it does add a perceptible delay in processing overhead.\n var subscription = auditTimeInMs > 0 ?\n _this._scrolled.pipe(operators.auditTime(auditTimeInMs)).subscribe(observer) :\n _this._scrolled.subscribe(observer);\n _this._scrolledCount++;\n return function () {\n subscription.unsubscribe();\n _this._scrolledCount--;\n if (!_this._scrolledCount) {\n _this._removeGlobalListener();\n }\n };\n });\n };\n ScrollDispatcher.prototype.ngOnDestroy = function () {\n var _this = this;\n this._removeGlobalListener();\n this.scrollContainers.forEach(function (_, container) { return _this.deregister(container); });\n this._scrolled.complete();\n };\n /**\n * Returns an observable that emits whenever any of the\n * scrollable ancestors of an element are scrolled.\n * @param elementRef Element whose ancestors to listen for.\n * @param auditTimeInMs Time to throttle the scroll events.\n */\n ScrollDispatcher.prototype.ancestorScrolled = function (elementRef, auditTimeInMs) {\n var ancestors = this.getAncestorScrollContainers(elementRef);\n return this.scrolled(auditTimeInMs).pipe(operators.filter(function (target) {\n return !target || ancestors.indexOf(target) > -1;\n }));\n };\n /** Returns all registered Scrollables that contain the provided element. */\n ScrollDispatcher.prototype.getAncestorScrollContainers = function (elementRef) {\n var _this = this;\n var scrollingContainers = [];\n this.scrollContainers.forEach(function (_subscription, scrollable) {\n if (_this._scrollableContainsElement(scrollable, elementRef)) {\n scrollingContainers.push(scrollable);\n }\n });\n return scrollingContainers;\n };\n /** Access injected document if available or fallback to global document reference */\n ScrollDispatcher.prototype._getDocument = function () {\n return this._document || document;\n };\n /** Use defaultView of injected document if available or fallback to global window reference */\n ScrollDispatcher.prototype._getWindow = function () {\n var doc = this._getDocument();\n return doc.defaultView || window;\n };\n /** Returns true if the element is contained within the provided Scrollable. */\n ScrollDispatcher.prototype._scrollableContainsElement = function (scrollable, elementRef) {\n var element = elementRef.nativeElement;\n var scrollableElement = scrollable.getElementRef().nativeElement;\n // Traverse through the element parents until we reach null, checking if any of the elements\n // are the scrollable's element.\n do {\n if (element == scrollableElement) {\n return true;\n }\n } while (element = element.parentElement);\n return false;\n };\n /** Sets up the global scroll listeners. */\n ScrollDispatcher.prototype._addGlobalListener = function () {\n var _this = this;\n this._globalSubscription = this._ngZone.runOutsideAngular(function () {\n var window = _this._getWindow();\n return rxjs.fromEvent(window.document, 'scroll').subscribe(function () { return _this._scrolled.next(); });\n });\n };\n /** Cleans up the global scroll listener. */\n ScrollDispatcher.prototype._removeGlobalListener = function () {\n if (this._globalSubscription) {\n this._globalSubscription.unsubscribe();\n this._globalSubscription = null;\n }\n };\n return ScrollDispatcher;\n }());\n ScrollDispatcher.ɵprov = i0.ɵɵdefineInjectable({ factory: function ScrollDispatcher_Factory() { return new ScrollDispatcher(i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(i1.Platform), i0.ɵɵinject(i2.DOCUMENT, 8)); }, token: ScrollDispatcher, providedIn: \"root\" });\n ScrollDispatcher.decorators = [\n { type: i0.Injectable, args: [{ providedIn: 'root' },] }\n ];\n ScrollDispatcher.ctorParameters = function () { return [\n { type: i0.NgZone },\n { type: i1.Platform },\n { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [i2.DOCUMENT,] }] }\n ]; };\n\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n /**\n * Sends an event when the directive's element is scrolled. Registers itself with the\n * ScrollDispatcher service to include itself as part of its collection of scrolling events that it\n * can be listened to through the service.\n */\n var CdkScrollable = /** @class */ (function () {\n function CdkScrollable(elementRef, scrollDispatcher, ngZone, dir) {\n var _this = this;\n this.elementRef = elementRef;\n this.scrollDispatcher = scrollDispatcher;\n this.ngZone = ngZone;\n this.dir = dir;\n this._destroyed = new rxjs.Subject();\n this._elementScrolled = new rxjs.Observable(function (observer) { return _this.ngZone.runOutsideAngular(function () { return rxjs.fromEvent(_this.elementRef.nativeElement, 'scroll').pipe(operators.takeUntil(_this._destroyed))\n .subscribe(observer); }); });\n }\n CdkScrollable.prototype.ngOnInit = function () {\n this.scrollDispatcher.register(this);\n };\n CdkScrollable.prototype.ngOnDestroy = function () {\n this.scrollDispatcher.deregister(this);\n this._destroyed.next();\n this._destroyed.complete();\n };\n /** Returns observable that emits when a scroll event is fired on the host element. */\n CdkScrollable.prototype.elementScrolled = function () {\n return this._elementScrolled;\n };\n /** Gets the ElementRef for the viewport. */\n CdkScrollable.prototype.getElementRef = function () {\n return this.elementRef;\n };\n /**\n * Scrolls to the specified offsets. This is a normalized version of the browser's native scrollTo\n * method, since browsers are not consistent about what scrollLeft means in RTL. For this method\n * left and right always refer to the left and right side of the scrolling container irrespective\n * of the layout direction. start and end refer to left and right in an LTR context and vice-versa\n * in an RTL context.\n * @param options specified the offsets to scroll to.\n */\n CdkScrollable.prototype.scrollTo = function (options) {\n var el = this.elementRef.nativeElement;\n var isRtl = this.dir && this.dir.value == 'rtl';\n // Rewrite start & end offsets as right or left offsets.\n if (options.left == null) {\n options.left = isRtl ? options.end : options.start;\n }\n if (options.right == null) {\n options.right = isRtl ? options.start : options.end;\n }\n // Rewrite the bottom offset as a top offset.\n if (options.bottom != null) {\n options.top =\n el.scrollHeight - el.clientHeight - options.bottom;\n }\n // Rewrite the right offset as a left offset.\n if (isRtl && i1.getRtlScrollAxisType() != 0 /* NORMAL */) {\n if (options.left != null) {\n options.right =\n el.scrollWidth - el.clientWidth - options.left;\n }\n if (i1.getRtlScrollAxisType() == 2 /* INVERTED */) {\n options.left = options.right;\n }\n else if (i1.getRtlScrollAxisType() == 1 /* NEGATED */) {\n options.left = options.right ? -options.right : options.right;\n }\n }\n else {\n if (options.right != null) {\n options.left =\n el.scrollWidth - el.clientWidth - options.right;\n }\n }\n this._applyScrollToOptions(options);\n };\n CdkScrollable.prototype._applyScrollToOptions = function (options) {\n var el = this.elementRef.nativeElement;\n if (i1.supportsScrollBehavior()) {\n el.scrollTo(options);\n }\n else {\n if (options.top != null) {\n el.scrollTop = options.top;\n }\n if (options.left != null) {\n el.scrollLeft = options.left;\n }\n }\n };\n /**\n * Measures the scroll offset relative to the specified edge of the viewport. This method can be\n * used instead of directly checking scrollLeft or scrollTop, since browsers are not consistent\n * about what scrollLeft means in RTL. The values returned by this method are normalized such that\n * left and right always refer to the left and right side of the scrolling container irrespective\n * of the layout direction. start and end refer to left and right in an LTR context and vice-versa\n * in an RTL context.\n * @param from The edge to measure from.\n */\n CdkScrollable.prototype.measureScrollOffset = function (from) {\n var LEFT = 'left';\n var RIGHT = 'right';\n var el = this.elementRef.nativeElement;\n if (from == 'top') {\n return el.scrollTop;\n }\n if (from == 'bottom') {\n return el.scrollHeight - el.clientHeight - el.scrollTop;\n }\n // Rewrite start & end as left or right offsets.\n var isRtl = this.dir && this.dir.value == 'rtl';\n if (from == 'start') {\n from = isRtl ? RIGHT : LEFT;\n }\n else if (from == 'end') {\n from = isRtl ? LEFT : RIGHT;\n }\n if (isRtl && i1.getRtlScrollAxisType() == 2 /* INVERTED */) {\n // For INVERTED, scrollLeft is (scrollWidth - clientWidth) when scrolled all the way left and\n // 0 when scrolled all the way right.\n if (from == LEFT) {\n return el.scrollWidth - el.clientWidth - el.scrollLeft;\n }\n else {\n return el.scrollLeft;\n }\n }\n else if (isRtl && i1.getRtlScrollAxisType() == 1 /* NEGATED */) {\n // For NEGATED, scrollLeft is -(scrollWidth - clientWidth) when scrolled all the way left and\n // 0 when scrolled all the way right.\n if (from == LEFT) {\n return el.scrollLeft + el.scrollWidth - el.clientWidth;\n }\n else {\n return -el.scrollLeft;\n }\n }\n else {\n // For NORMAL, as well as non-RTL contexts, scrollLeft is 0 when scrolled all the way left and\n // (scrollWidth - clientWidth) when scrolled all the way right.\n if (from == LEFT) {\n return el.scrollLeft;\n }\n else {\n return el.scrollWidth - el.clientWidth - el.scrollLeft;\n }\n }\n };\n return CdkScrollable;\n }());\n CdkScrollable.decorators = [\n { type: i0.Directive, args: [{\n selector: '[cdk-scrollable], [cdkScrollable]'\n },] }\n ];\n CdkScrollable.ctorParameters = function () { return [\n { type: i0.ElementRef },\n { type: ScrollDispatcher },\n { type: i0.NgZone },\n { type: bidi.Directionality, decorators: [{ type: i0.Optional }] }\n ]; };\n\n /*! *****************************************************************************\n Copyright (c) Microsoft Corporation.\n\n Permission to use, copy, modify, and/or distribute this software for any\n purpose with or without fee is hereby granted.\n\n THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n PERFORMANCE OF THIS SOFTWARE.\n ***************************************************************************** */\n /* global Reflect, Promise */\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b)\n if (b.hasOwnProperty(p))\n d[p] = b[p]; };\n return extendStatics(d, b);\n };\n function __extends(d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n }\n var __assign = function () {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s)\n if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };\n function __rest(s, e) {\n var t = {};\n for (var p in s)\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n }\n function __decorate(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n r = Reflect.decorate(decorators, target, key, desc);\n else\n for (var i = decorators.length - 1; i >= 0; i--)\n if (d = decorators[i])\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n }\n function __param(paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); };\n }\n function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\")\n return Reflect.metadata(metadataKey, metadataValue);\n }\n function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try {\n step(generator.next(value));\n }\n catch (e) {\n reject(e);\n } }\n function rejected(value) { try {\n step(generator[\"throw\"](value));\n }\n catch (e) {\n reject(e);\n } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n }\n function __generator(thisArg, body) {\n var _ = { label: 0, sent: function () { if (t[0] & 1)\n throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f)\n throw new TypeError(\"Generator is already executing.\");\n while (_)\n try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)\n return t;\n if (y = 0, t)\n op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n case 4:\n _.label++;\n return { value: op[1], done: false };\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n case 7:\n op = _.ops.pop();\n _.trys.pop();\n continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {\n _.label = op[1];\n break;\n }\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n if (t && _.label < t[2]) {\n _.label = t[2];\n _.ops.push(op);\n break;\n }\n if (t[2])\n _.ops.pop();\n _.trys.pop();\n continue;\n }\n op = body.call(thisArg, _);\n }\n catch (e) {\n op = [6, e];\n y = 0;\n }\n finally {\n f = t = 0;\n }\n if (op[0] & 5)\n throw op[1];\n return { value: op[0] ? op[1] : void 0, done: true };\n }\n }\n var __createBinding = Object.create ? (function (o, m, k, k2) {\n if (k2 === undefined)\n k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });\n }) : (function (o, m, k, k2) {\n if (k2 === undefined)\n k2 = k;\n o[k2] = m[k];\n });\n function __exportStar(m, exports) {\n for (var p in m)\n if (p !== \"default\" && !exports.hasOwnProperty(p))\n __createBinding(exports, m, p);\n }\n function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m)\n return m.call(o);\n if (o && typeof o.length === \"number\")\n return {\n next: function () {\n if (o && i >= o.length)\n o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n }\n function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m)\n return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done)\n ar.push(r.value);\n }\n catch (error) {\n e = { error: error };\n }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"]))\n m.call(i);\n }\n finally {\n if (e)\n throw e.error;\n }\n }\n return ar;\n }\n function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n }\n function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++)\n s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n }\n ;\n function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n }\n function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator)\n throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { if (g[n])\n i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\n function resume(n, v) { try {\n step(g[n](v));\n }\n catch (e) {\n settle(q[0][3], e);\n } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length)\n resume(q[0][0], q[0][1]); }\n }\n function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\n }\n function __asyncValues(o) {\n if (!Symbol.asyncIterator)\n throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }\n }\n function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) {\n Object.defineProperty(cooked, \"raw\", { value: raw });\n }\n else {\n cooked.raw = raw;\n }\n return cooked;\n }\n ;\n var __setModuleDefault = Object.create ? (function (o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n }) : function (o, v) {\n o[\"default\"] = v;\n };\n function __importStar(mod) {\n if (mod && mod.__esModule)\n return mod;\n var result = {};\n if (mod != null)\n for (var k in mod)\n if (Object.hasOwnProperty.call(mod, k))\n __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n }\n function __importDefault(mod) {\n return (mod && mod.__esModule) ? mod : { default: mod };\n }\n function __classPrivateFieldGet(receiver, privateMap) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to get private field on non-instance\");\n }\n return privateMap.get(receiver);\n }\n function __classPrivateFieldSet(receiver, privateMap, value) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to set private field on non-instance\");\n }\n privateMap.set(receiver, value);\n return value;\n }\n\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n /** Time in ms to throttle the resize events by default. */\n var DEFAULT_RESIZE_TIME = 20;\n /**\n * Simple utility for getting the bounds of the browser viewport.\n * @docs-private\n */\n var ViewportRuler = /** @class */ (function () {\n function ViewportRuler(_platform, ngZone, \n /** @breaking-change 11.0.0 make document required */\n document) {\n var _this = this;\n this._platform = _platform;\n /** Stream of viewport change events. */\n this._change = new rxjs.Subject();\n /** Event listener that will be used to handle the viewport change events. */\n this._changeListener = function (event) {\n _this._change.next(event);\n };\n this._document = document;\n ngZone.runOutsideAngular(function () {\n if (_platform.isBrowser) {\n var window = _this._getWindow();\n // Note that bind the events ourselves, rather than going through something like RxJS's\n // `fromEvent` so that we can ensure that they're bound outside of the NgZone.\n window.addEventListener('resize', _this._changeListener);\n window.addEventListener('orientationchange', _this._changeListener);\n }\n // We don't need to keep track of the subscription,\n // because we complete the `change` stream on destroy.\n _this.change().subscribe(function () { return _this._updateViewportSize(); });\n });\n }\n ViewportRuler.prototype.ngOnDestroy = function () {\n if (this._platform.isBrowser) {\n var window = this._getWindow();\n window.removeEventListener('resize', this._changeListener);\n window.removeEventListener('orientationchange', this._changeListener);\n }\n this._change.complete();\n };\n /** Returns the viewport's width and height. */\n ViewportRuler.prototype.getViewportSize = function () {\n if (!this._viewportSize) {\n this._updateViewportSize();\n }\n var output = { width: this._viewportSize.width, height: this._viewportSize.height };\n // If we're not on a browser, don't cache the size since it'll be mocked out anyway.\n if (!this._platform.isBrowser) {\n this._viewportSize = null;\n }\n return output;\n };\n /** Gets a ClientRect for the viewport's bounds. */\n ViewportRuler.prototype.getViewportRect = function () {\n // Use the document element's bounding rect rather than the window scroll properties\n // (e.g. pageYOffset, scrollY) due to in issue in Chrome and IE where window scroll\n // properties and client coordinates (boundingClientRect, clientX/Y, etc.) are in different\n // conceptual viewports. Under most circumstances these viewports are equivalent, but they\n // can disagree when the page is pinch-zoomed (on devices that support touch).\n // See https://bugs.chromium.org/p/chromium/issues/detail?id=489206#c4\n // We use the documentElement instead of the body because, by default (without a css reset)\n // browsers typically give the document body an 8px margin, which is not included in\n // getBoundingClientRect().\n var scrollPosition = this.getViewportScrollPosition();\n var _a = this.getViewportSize(), width = _a.width, height = _a.height;\n return {\n top: scrollPosition.top,\n left: scrollPosition.left,\n bottom: scrollPosition.top + height,\n right: scrollPosition.left + width,\n height: height,\n width: width,\n };\n };\n /** Gets the (top, left) scroll position of the viewport. */\n ViewportRuler.prototype.getViewportScrollPosition = function () {\n // While we can get a reference to the fake document\n // during SSR, it doesn't have getBoundingClientRect.\n if (!this._platform.isBrowser) {\n return { top: 0, left: 0 };\n }\n // The top-left-corner of the viewport is determined by the scroll position of the document\n // body, normally just (scrollLeft, scrollTop). However, Chrome and Firefox disagree about\n // whether `document.body` or `document.documentElement` is the scrolled element, so reading\n // `scrollTop` and `scrollLeft` is inconsistent. However, using the bounding rect of\n // `document.documentElement` works consistently, where the `top` and `left` values will\n // equal negative the scroll position.\n var document = this._getDocument();\n var window = this._getWindow();\n var documentElement = document.documentElement;\n var documentRect = documentElement.getBoundingClientRect();\n var top = -documentRect.top || document.body.scrollTop || window.scrollY ||\n documentElement.scrollTop || 0;\n var left = -documentRect.left || document.body.scrollLeft || window.scrollX ||\n documentElement.scrollLeft || 0;\n return { top: top, left: left };\n };\n /**\n * Returns a stream that emits whenever the size of the viewport changes.\n * @param throttleTime Time in milliseconds to throttle the stream.\n */\n ViewportRuler.prototype.change = function (throttleTime) {\n if (throttleTime === void 0) { throttleTime = DEFAULT_RESIZE_TIME; }\n return throttleTime > 0 ? this._change.pipe(operators.auditTime(throttleTime)) : this._change;\n };\n /** Access injected document if available or fallback to global document reference */\n ViewportRuler.prototype._getDocument = function () {\n return this._document || document;\n };\n /** Use defaultView of injected document if available or fallback to global window reference */\n ViewportRuler.prototype._getWindow = function () {\n var doc = this._getDocument();\n return doc.defaultView || window;\n };\n /** Updates the cached viewport size. */\n ViewportRuler.prototype._updateViewportSize = function () {\n var window = this._getWindow();\n this._viewportSize = this._platform.isBrowser ?\n { width: window.innerWidth, height: window.innerHeight } :\n { width: 0, height: 0 };\n };\n return ViewportRuler;\n }());\n ViewportRuler.ɵprov = i0.ɵɵdefineInjectable({ factory: function ViewportRuler_Factory() { return new ViewportRuler(i0.ɵɵinject(i1.Platform), i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(i2.DOCUMENT, 8)); }, token: ViewportRuler, providedIn: \"root\" });\n ViewportRuler.decorators = [\n { type: i0.Injectable, args: [{ providedIn: 'root' },] }\n ];\n ViewportRuler.ctorParameters = function () { return [\n { type: i1.Platform },\n { type: i0.NgZone },\n { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [i2.DOCUMENT,] }] }\n ]; };\n\n /** Checks if the given ranges are equal. */\n function rangesEqual(r1, r2) {\n return r1.start == r2.start && r1.end == r2.end;\n }\n /**\n * Scheduler to be used for scroll events. Needs to fall back to\n * something that doesn't rely on requestAnimationFrame on environments\n * that don't support it (e.g. server-side rendering).\n */\n var SCROLL_SCHEDULER = typeof requestAnimationFrame !== 'undefined' ? rxjs.animationFrameScheduler : rxjs.asapScheduler;\n /** A viewport that virtualizes its scrolling with the help of `CdkVirtualForOf`. */\n var CdkVirtualScrollViewport = /** @class */ (function (_super) {\n __extends(CdkVirtualScrollViewport, _super);\n function CdkVirtualScrollViewport(elementRef, _changeDetectorRef, ngZone, _scrollStrategy, dir, scrollDispatcher, \n /**\n * @deprecated `viewportRuler` parameter to become required.\n * @breaking-change 11.0.0\n */\n viewportRuler) {\n var _this = _super.call(this, elementRef, scrollDispatcher, ngZone, dir) || this;\n _this.elementRef = elementRef;\n _this._changeDetectorRef = _changeDetectorRef;\n _this._scrollStrategy = _scrollStrategy;\n /** Emits when the viewport is detached from a CdkVirtualForOf. */\n _this._detachedSubject = new rxjs.Subject();\n /** Emits when the rendered range changes. */\n _this._renderedRangeSubject = new rxjs.Subject();\n _this._orientation = 'vertical';\n // Note: we don't use the typical EventEmitter here because we need to subscribe to the scroll\n // strategy lazily (i.e. only if the user is actually listening to the events). We do this because\n // depending on how the strategy calculates the scrolled index, it may come at a cost to\n // performance.\n /** Emits when the index of the first element visible in the viewport changes. */\n _this.scrolledIndexChange = new rxjs.Observable(function (observer) { return _this._scrollStrategy.scrolledIndexChange.subscribe(function (index) { return Promise.resolve().then(function () { return _this.ngZone.run(function () { return observer.next(index); }); }); }); });\n /** A stream that emits whenever the rendered range changes. */\n _this.renderedRangeStream = _this._renderedRangeSubject.asObservable();\n /**\n * The total size of all content (in pixels), including content that is not currently rendered.\n */\n _this._totalContentSize = 0;\n /** A string representing the `style.width` property value to be used for the spacer element. */\n _this._totalContentWidth = '';\n /** A string representing the `style.height` property value to be used for the spacer element. */\n _this._totalContentHeight = '';\n /** The currently rendered range of indices. */\n _this._renderedRange = { start: 0, end: 0 };\n /** The length of the data bound to this viewport (in number of items). */\n _this._dataLength = 0;\n /** The size of the viewport (in pixels). */\n _this._viewportSize = 0;\n /** The last rendered content offset that was set. */\n _this._renderedContentOffset = 0;\n /**\n * Whether the last rendered content offset was to the end of the content (and therefore needs to\n * be rewritten as an offset to the start of the content).\n */\n _this._renderedContentOffsetNeedsRewrite = false;\n /** Whether there is a pending change detection cycle. */\n _this._isChangeDetectionPending = false;\n /** A list of functions to run after the next change detection cycle. */\n _this._runAfterChangeDetection = [];\n /** Subscription to changes in the viewport size. */\n _this._viewportChanges = rxjs.Subscription.EMPTY;\n if (!_scrollStrategy) {\n throw Error('Error: cdk-virtual-scroll-viewport requires the \"itemSize\" property to be set.');\n }\n // @breaking-change 11.0.0 Remove null check for `viewportRuler`.\n if (viewportRuler) {\n _this._viewportChanges = viewportRuler.change().subscribe(function () {\n _this.checkViewportSize();\n });\n }\n return _this;\n }\n Object.defineProperty(CdkVirtualScrollViewport.prototype, \"orientation\", {\n /** The direction the viewport scrolls. */\n get: function () {\n return this._orientation;\n },\n set: function (orientation) {\n if (this._orientation !== orientation) {\n this._orientation = orientation;\n this._calculateSpacerSize();\n }\n },\n enumerable: false,\n configurable: true\n });\n CdkVirtualScrollViewport.prototype.ngOnInit = function () {\n var _this = this;\n _super.prototype.ngOnInit.call(this);\n // It's still too early to measure the viewport at this point. Deferring with a promise allows\n // the Viewport to be rendered with the correct size before we measure. We run this outside the\n // zone to avoid causing more change detection cycles. We handle the change detection loop\n // ourselves instead.\n this.ngZone.runOutsideAngular(function () { return Promise.resolve().then(function () {\n _this._measureViewportSize();\n _this._scrollStrategy.attach(_this);\n _this.elementScrolled()\n .pipe(\n // Start off with a fake scroll event so we properly detect our initial position.\n operators.startWith(null), \n // Collect multiple events into one until the next animation frame. This way if\n // there are multiple scroll events in the same frame we only need to recheck\n // our layout once.\n operators.auditTime(0, SCROLL_SCHEDULER))\n .subscribe(function () { return _this._scrollStrategy.onContentScrolled(); });\n _this._markChangeDetectionNeeded();\n }); });\n };\n CdkVirtualScrollViewport.prototype.ngOnDestroy = function () {\n this.detach();\n this._scrollStrategy.detach();\n // Complete all subjects\n this._renderedRangeSubject.complete();\n this._detachedSubject.complete();\n this._viewportChanges.unsubscribe();\n _super.prototype.ngOnDestroy.call(this);\n };\n /** Attaches a `CdkVirtualScrollRepeater` to this viewport. */\n CdkVirtualScrollViewport.prototype.attach = function (forOf) {\n var _this = this;\n if (this._forOf) {\n throw Error('CdkVirtualScrollViewport is already attached.');\n }\n // Subscribe to the data stream of the CdkVirtualForOf to keep track of when the data length\n // changes. Run outside the zone to avoid triggering change detection, since we're managing the\n // change detection loop ourselves.\n this.ngZone.runOutsideAngular(function () {\n _this._forOf = forOf;\n _this._forOf.dataStream.pipe(operators.takeUntil(_this._detachedSubject)).subscribe(function (data) {\n var newLength = data.length;\n if (newLength !== _this._dataLength) {\n _this._dataLength = newLength;\n _this._scrollStrategy.onDataLengthChanged();\n }\n _this._doChangeDetection();\n });\n });\n };\n /** Detaches the current `CdkVirtualForOf`. */\n CdkVirtualScrollViewport.prototype.detach = function () {\n this._forOf = null;\n this._detachedSubject.next();\n };\n /** Gets the length of the data bound to this viewport (in number of items). */\n CdkVirtualScrollViewport.prototype.getDataLength = function () {\n return this._dataLength;\n };\n /** Gets the size of the viewport (in pixels). */\n CdkVirtualScrollViewport.prototype.getViewportSize = function () {\n return this._viewportSize;\n };\n // TODO(mmalerba): This is technically out of sync with what's really rendered until a render\n // cycle happens. I'm being careful to only call it after the render cycle is complete and before\n // setting it to something else, but its error prone and should probably be split into\n // `pendingRange` and `renderedRange`, the latter reflecting whats actually in the DOM.\n /** Get the current rendered range of items. */\n CdkVirtualScrollViewport.prototype.getRenderedRange = function () {\n return this._renderedRange;\n };\n /**\n * Sets the total size of all content (in pixels), including content that is not currently\n * rendered.\n */\n CdkVirtualScrollViewport.prototype.setTotalContentSize = function (size) {\n if (this._totalContentSize !== size) {\n this._totalContentSize = size;\n this._calculateSpacerSize();\n this._markChangeDetectionNeeded();\n }\n };\n /** Sets the currently rendered range of indices. */\n CdkVirtualScrollViewport.prototype.setRenderedRange = function (range) {\n var _this = this;\n if (!rangesEqual(this._renderedRange, range)) {\n this._renderedRangeSubject.next(this._renderedRange = range);\n this._markChangeDetectionNeeded(function () { return _this._scrollStrategy.onContentRendered(); });\n }\n };\n /**\n * Gets the offset from the start of the viewport to the start of the rendered data (in pixels).\n */\n CdkVirtualScrollViewport.prototype.getOffsetToRenderedContentStart = function () {\n return this._renderedContentOffsetNeedsRewrite ? null : this._renderedContentOffset;\n };\n /**\n * Sets the offset from the start of the viewport to either the start or end of the rendered data\n * (in pixels).\n */\n CdkVirtualScrollViewport.prototype.setRenderedContentOffset = function (offset, to) {\n var _this = this;\n if (to === void 0) { to = 'to-start'; }\n // For a horizontal viewport in a right-to-left language we need to translate along the x-axis\n // in the negative direction.\n var isRtl = this.dir && this.dir.value == 'rtl';\n var isHorizontal = this.orientation == 'horizontal';\n var axis = isHorizontal ? 'X' : 'Y';\n var axisDirection = isHorizontal && isRtl ? -1 : 1;\n var transform = \"translate\" + axis + \"(\" + Number(axisDirection * offset) + \"px)\";\n this._renderedContentOffset = offset;\n if (to === 'to-end') {\n transform += \" translate\" + axis + \"(-100%)\";\n // The viewport should rewrite this as a `to-start` offset on the next render cycle. Otherwise\n // elements will appear to expand in the wrong direction (e.g. `mat-expansion-panel` would\n // expand upward).\n this._renderedContentOffsetNeedsRewrite = true;\n }\n if (this._renderedContentTransform != transform) {\n // We know this value is safe because we parse `offset` with `Number()` before passing it\n // into the string.\n this._renderedContentTransform = transform;\n this._markChangeDetectionNeeded(function () {\n if (_this._renderedContentOffsetNeedsRewrite) {\n _this._renderedContentOffset -= _this.measureRenderedContentSize();\n _this._renderedContentOffsetNeedsRewrite = false;\n _this.setRenderedContentOffset(_this._renderedContentOffset);\n }\n else {\n _this._scrollStrategy.onRenderedOffsetChanged();\n }\n });\n }\n };\n /**\n * Scrolls to the given offset from the start of the viewport. Please note that this is not always\n * the same as setting `scrollTop` or `scrollLeft`. In a horizontal viewport with right-to-left\n * direction, this would be the equivalent of setting a fictional `scrollRight` property.\n * @param offset The offset to scroll to.\n * @param behavior The ScrollBehavior to use when scrolling. Default is behavior is `auto`.\n */\n CdkVirtualScrollViewport.prototype.scrollToOffset = function (offset, behavior) {\n if (behavior === void 0) { behavior = 'auto'; }\n var options = { behavior: behavior };\n if (this.orientation === 'horizontal') {\n options.start = offset;\n }\n else {\n options.top = offset;\n }\n this.scrollTo(options);\n };\n /**\n * Scrolls to the offset for the given index.\n * @param index The index of the element to scroll to.\n * @param behavior The ScrollBehavior to use when scrolling. Default is behavior is `auto`.\n */\n CdkVirtualScrollViewport.prototype.scrollToIndex = function (index, behavior) {\n if (behavior === void 0) { behavior = 'auto'; }\n this._scrollStrategy.scrollToIndex(index, behavior);\n };\n /**\n * Gets the current scroll offset from the start of the viewport (in pixels).\n * @param from The edge to measure the offset from. Defaults to 'top' in vertical mode and 'start'\n * in horizontal mode.\n */\n CdkVirtualScrollViewport.prototype.measureScrollOffset = function (from) {\n return from ?\n _super.prototype.measureScrollOffset.call(this, from) :\n _super.prototype.measureScrollOffset.call(this, this.orientation === 'horizontal' ? 'start' : 'top');\n };\n /** Measure the combined size of all of the rendered items. */\n CdkVirtualScrollViewport.prototype.measureRenderedContentSize = function () {\n var contentEl = this._contentWrapper.nativeElement;\n return this.orientation === 'horizontal' ? contentEl.offsetWidth : contentEl.offsetHeight;\n };\n /**\n * Measure the total combined size of the given range. Throws if the range includes items that are\n * not rendered.\n */\n CdkVirtualScrollViewport.prototype.measureRangeSize = function (range) {\n if (!this._forOf) {\n return 0;\n }\n return this._forOf.measureRangeSize(range, this.orientation);\n };\n /** Update the viewport dimensions and re-render. */\n CdkVirtualScrollViewport.prototype.checkViewportSize = function () {\n // TODO: Cleanup later when add logic for handling content resize\n this._measureViewportSize();\n this._scrollStrategy.onDataLengthChanged();\n };\n /** Measure the viewport size. */\n CdkVirtualScrollViewport.prototype._measureViewportSize = function () {\n var viewportEl = this.elementRef.nativeElement;\n this._viewportSize = this.orientation === 'horizontal' ?\n viewportEl.clientWidth : viewportEl.clientHeight;\n };\n /** Queue up change detection to run. */\n CdkVirtualScrollViewport.prototype._markChangeDetectionNeeded = function (runAfter) {\n var _this = this;\n if (runAfter) {\n this._runAfterChangeDetection.push(runAfter);\n }\n // Use a Promise to batch together calls to `_doChangeDetection`. This way if we set a bunch of\n // properties sequentially we only have to run `_doChangeDetection` once at the end.\n if (!this._isChangeDetectionPending) {\n this._isChangeDetectionPending = true;\n this.ngZone.runOutsideAngular(function () { return Promise.resolve().then(function () {\n _this._doChangeDetection();\n }); });\n }\n };\n /** Run change detection. */\n CdkVirtualScrollViewport.prototype._doChangeDetection = function () {\n var e_1, _a;\n var _this = this;\n this._isChangeDetectionPending = false;\n // Apply the content transform. The transform can't be set via an Angular binding because\n // bypassSecurityTrustStyle is banned in Google. However the value is safe, it's composed of\n // string literals, a variable that can only be 'X' or 'Y', and user input that is run through\n // the `Number` function first to coerce it to a numeric value.\n this._contentWrapper.nativeElement.style.transform = this._renderedContentTransform;\n // Apply changes to Angular bindings. Note: We must call `markForCheck` to run change detection\n // from the root, since the repeated items are content projected in. Calling `detectChanges`\n // instead does not properly check the projected content.\n this.ngZone.run(function () { return _this._changeDetectorRef.markForCheck(); });\n var runAfterChangeDetection = this._runAfterChangeDetection;\n this._runAfterChangeDetection = [];\n try {\n for (var runAfterChangeDetection_1 = __values(runAfterChangeDetection), runAfterChangeDetection_1_1 = runAfterChangeDetection_1.next(); !runAfterChangeDetection_1_1.done; runAfterChangeDetection_1_1 = runAfterChangeDetection_1.next()) {\n var fn = runAfterChangeDetection_1_1.value;\n fn();\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (runAfterChangeDetection_1_1 && !runAfterChangeDetection_1_1.done && (_a = runAfterChangeDetection_1.return)) _a.call(runAfterChangeDetection_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n };\n /** Calculates the `style.width` and `style.height` for the spacer element. */\n CdkVirtualScrollViewport.prototype._calculateSpacerSize = function () {\n this._totalContentHeight =\n this.orientation === 'horizontal' ? '' : this._totalContentSize + \"px\";\n this._totalContentWidth =\n this.orientation === 'horizontal' ? this._totalContentSize + \"px\" : '';\n };\n return CdkVirtualScrollViewport;\n }(CdkScrollable));\n CdkVirtualScrollViewport.decorators = [\n { type: i0.Component, args: [{\n selector: 'cdk-virtual-scroll-viewport',\n template: \"<!--\\n Wrap the rendered content in an element that will be used to offset it based on the scroll\\n position.\\n-->\\n<div #contentWrapper class=\\\"cdk-virtual-scroll-content-wrapper\\\">\\n <ng-content></ng-content>\\n</div>\\n<!--\\n Spacer used to force the scrolling container to the correct size for the *total* number of items\\n so that the scrollbar captures the size of the entire data set.\\n-->\\n<div class=\\\"cdk-virtual-scroll-spacer\\\"\\n [style.width]=\\\"_totalContentWidth\\\" [style.height]=\\\"_totalContentHeight\\\"></div>\\n\",\n host: {\n 'class': 'cdk-virtual-scroll-viewport',\n '[class.cdk-virtual-scroll-orientation-horizontal]': 'orientation === \"horizontal\"',\n '[class.cdk-virtual-scroll-orientation-vertical]': 'orientation !== \"horizontal\"',\n },\n encapsulation: i0.ViewEncapsulation.None,\n changeDetection: i0.ChangeDetectionStrategy.OnPush,\n providers: [{\n provide: CdkScrollable,\n useExisting: CdkVirtualScrollViewport,\n }],\n styles: [\"cdk-virtual-scroll-viewport{display:block;position:relative;overflow:auto;contain:strict;transform:translateZ(0);will-change:scroll-position;-webkit-overflow-scrolling:touch}.cdk-virtual-scroll-content-wrapper{position:absolute;top:0;left:0;contain:content}[dir=rtl] .cdk-virtual-scroll-content-wrapper{right:0;left:auto}.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper{min-height:100%}.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>dl:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>ol:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>table:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>ul:not([cdkVirtualFor]){padding-left:0;padding-right:0;margin-left:0;margin-right:0;border-left-width:0;border-right-width:0;outline:none}.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper{min-width:100%}.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>dl:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>ol:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>table:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>ul:not([cdkVirtualFor]){padding-top:0;padding-bottom:0;margin-top:0;margin-bottom:0;border-top-width:0;border-bottom-width:0;outline:none}.cdk-virtual-scroll-spacer{position:absolute;top:0;left:0;height:1px;width:1px;transform-origin:0 0}[dir=rtl] .cdk-virtual-scroll-spacer{right:0;left:auto;transform-origin:100% 0}\\n\"]\n },] }\n ];\n CdkVirtualScrollViewport.ctorParameters = function () { return [\n { type: i0.ElementRef },\n { type: i0.ChangeDetectorRef },\n { type: i0.NgZone },\n { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [VIRTUAL_SCROLL_STRATEGY,] }] },\n { type: bidi.Directionality, decorators: [{ type: i0.Optional }] },\n { type: ScrollDispatcher },\n { type: ViewportRuler, decorators: [{ type: i0.Optional }] }\n ]; };\n CdkVirtualScrollViewport.propDecorators = {\n orientation: [{ type: i0.Input }],\n scrolledIndexChange: [{ type: i0.Output }],\n _contentWrapper: [{ type: i0.ViewChild, args: ['contentWrapper', { static: true },] }]\n };\n\n /** Helper to extract the offset of a DOM Node in a certain direction. */\n function getOffset(orientation, direction, node) {\n var el = node;\n if (!el.getBoundingClientRect) {\n return 0;\n }\n var rect = el.getBoundingClientRect();\n if (orientation === 'horizontal') {\n return direction === 'start' ? rect.left : rect.right;\n }\n return direction === 'start' ? rect.top : rect.bottom;\n }\n /**\n * A directive similar to `ngForOf` to be used for rendering data inside a virtual scrolling\n * container.\n */\n var CdkVirtualForOf = /** @class */ (function () {\n function CdkVirtualForOf(\n /** The view container to add items to. */\n _viewContainerRef, \n /** The template to use when stamping out new items. */\n _template, \n /** The set of available differs. */\n _differs, \n /** The virtual scrolling viewport that these items are being rendered in. */\n _viewport, ngZone) {\n var _this = this;\n this._viewContainerRef = _viewContainerRef;\n this._template = _template;\n this._differs = _differs;\n this._viewport = _viewport;\n /** Emits when the rendered view of the data changes. */\n this.viewChange = new rxjs.Subject();\n /** Subject that emits when a new DataSource instance is given. */\n this._dataSourceChanges = new rxjs.Subject();\n /**\n * The size of the cache used to store templates that are not being used for re-use later.\n * Setting the cache size to `0` will disable caching. Defaults to 20 templates.\n */\n this.cdkVirtualForTemplateCacheSize = 20;\n /** Emits whenever the data in the current DataSource changes. */\n this.dataStream = this._dataSourceChanges\n .pipe(\n // Start off with null `DataSource`.\n operators.startWith(null), \n // Bundle up the previous and current data sources so we can work with both.\n operators.pairwise(), \n // Use `_changeDataSource` to disconnect from the previous data source and connect to the\n // new one, passing back a stream of data changes which we run through `switchMap` to give\n // us a data stream that emits the latest data from whatever the current `DataSource` is.\n operators.switchMap(function (_a) {\n var _b = __read(_a, 2), prev = _b[0], cur = _b[1];\n return _this._changeDataSource(prev, cur);\n }), \n // Replay the last emitted data when someone subscribes.\n operators.shareReplay(1));\n /** The differ used to calculate changes to the data. */\n this._differ = null;\n /**\n * The template cache used to hold on ot template instancess that have been stamped out, but don't\n * currently need to be rendered. These instances will be reused in the future rather than\n * stamping out brand new ones.\n */\n this._templateCache = [];\n /** Whether the rendered data should be updated during the next ngDoCheck cycle. */\n this._needsUpdate = false;\n this._destroyed = new rxjs.Subject();\n this.dataStream.subscribe(function (data) {\n _this._data = data;\n _this._onRenderedDataChange();\n });\n this._viewport.renderedRangeStream.pipe(operators.takeUntil(this._destroyed)).subscribe(function (range) {\n _this._renderedRange = range;\n ngZone.run(function () { return _this.viewChange.next(_this._renderedRange); });\n _this._onRenderedDataChange();\n });\n this._viewport.attach(this);\n }\n Object.defineProperty(CdkVirtualForOf.prototype, \"cdkVirtualForOf\", {\n /** The DataSource to display. */\n get: function () {\n return this._cdkVirtualForOf;\n },\n set: function (value) {\n this._cdkVirtualForOf = value;\n if (collections.isDataSource(value)) {\n this._dataSourceChanges.next(value);\n }\n else {\n // Slice the value if its an NgIterable to ensure we're working with an array.\n this._dataSourceChanges.next(new collections.ArrayDataSource(rxjs.isObservable(value) ? value : Array.prototype.slice.call(value || [])));\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(CdkVirtualForOf.prototype, \"cdkVirtualForTrackBy\", {\n /**\n * The `TrackByFunction` to use for tracking changes. The `TrackByFunction` takes the index and\n * the item and produces a value to be used as the item's identity when tracking changes.\n */\n get: function () {\n return this._cdkVirtualForTrackBy;\n },\n set: function (fn) {\n var _this = this;\n this._needsUpdate = true;\n this._cdkVirtualForTrackBy = fn ?\n function (index, item) { return fn(index + (_this._renderedRange ? _this._renderedRange.start : 0), item); } :\n undefined;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(CdkVirtualForOf.prototype, \"cdkVirtualForTemplate\", {\n /** The template used to stamp out new elements. */\n set: function (value) {\n if (value) {\n this._needsUpdate = true;\n this._template = value;\n }\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Measures the combined size (width for horizontal orientation, height for vertical) of all items\n * in the specified range. Throws an error if the range includes items that are not currently\n * rendered.\n */\n CdkVirtualForOf.prototype.measureRangeSize = function (range, orientation) {\n if (range.start >= range.end) {\n return 0;\n }\n if (range.start < this._renderedRange.start || range.end > this._renderedRange.end) {\n throw Error(\"Error: attempted to measure an item that isn't rendered.\");\n }\n // The index into the list of rendered views for the first item in the range.\n var renderedStartIndex = range.start - this._renderedRange.start;\n // The length of the range we're measuring.\n var rangeLen = range.end - range.start;\n // Loop over all the views, find the first and land node and compute the size by subtracting\n // the top of the first node from the bottom of the last one.\n var firstNode;\n var lastNode;\n // Find the first node by starting from the beginning and going forwards.\n for (var i = 0; i < rangeLen; i++) {\n var view = this._viewContainerRef.get(i + renderedStartIndex);\n if (view && view.rootNodes.length) {\n firstNode = lastNode = view.rootNodes[0];\n break;\n }\n }\n // Find the last node by starting from the end and going backwards.\n for (var i = rangeLen - 1; i > -1; i--) {\n var view = this._viewContainerRef.get(i + renderedStartIndex);\n if (view && view.rootNodes.length) {\n lastNode = view.rootNodes[view.rootNodes.length - 1];\n break;\n }\n }\n return firstNode && lastNode ?\n getOffset(orientation, 'end', lastNode) - getOffset(orientation, 'start', firstNode) : 0;\n };\n CdkVirtualForOf.prototype.ngDoCheck = function () {\n if (this._differ && this._needsUpdate) {\n // TODO(mmalerba): We should differentiate needs update due to scrolling and a new portion of\n // this list being rendered (can use simpler algorithm) vs needs update due to data actually\n // changing (need to do this diff).\n var changes = this._differ.diff(this._renderedItems);\n if (!changes) {\n this._updateContext();\n }\n else {\n this._applyChanges(changes);\n }\n this._needsUpdate = false;\n }\n };\n CdkVirtualForOf.prototype.ngOnDestroy = function () {\n var e_1, _a;\n this._viewport.detach();\n this._dataSourceChanges.next(undefined);\n this._dataSourceChanges.complete();\n this.viewChange.complete();\n this._destroyed.next();\n this._destroyed.complete();\n try {\n for (var _b = __values(this._templateCache), _c = _b.next(); !_c.done; _c = _b.next()) {\n var view = _c.value;\n view.destroy();\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n };\n /** React to scroll state changes in the viewport. */\n CdkVirtualForOf.prototype._onRenderedDataChange = function () {\n if (!this._renderedRange) {\n return;\n }\n this._renderedItems = this._data.slice(this._renderedRange.start, this._renderedRange.end);\n if (!this._differ) {\n this._differ = this._differs.find(this._renderedItems).create(this.cdkVirtualForTrackBy);\n }\n this._needsUpdate = true;\n };\n /** Swap out one `DataSource` for another. */\n CdkVirtualForOf.prototype._changeDataSource = function (oldDs, newDs) {\n if (oldDs) {\n oldDs.disconnect(this);\n }\n this._needsUpdate = true;\n return newDs ? newDs.connect(this) : rxjs.of();\n };\n /** Update the `CdkVirtualForOfContext` for all views. */\n CdkVirtualForOf.prototype._updateContext = function () {\n var count = this._data.length;\n var i = this._viewContainerRef.length;\n while (i--) {\n var view = this._viewContainerRef.get(i);\n view.context.index = this._renderedRange.start + i;\n view.context.count = count;\n this._updateComputedContextProperties(view.context);\n view.detectChanges();\n }\n };\n /** Apply changes to the DOM. */\n CdkVirtualForOf.prototype._applyChanges = function (changes) {\n var _this = this;\n // Rearrange the views to put them in the right location.\n changes.forEachOperation(function (record, adjustedPreviousIndex, currentIndex) {\n if (record.previousIndex == null) { // Item added.\n var view = _this._insertViewForNewItem(currentIndex);\n view.context.$implicit = record.item;\n }\n else if (currentIndex == null) { // Item removed.\n _this._cacheView(_this._detachView(adjustedPreviousIndex));\n }\n else { // Item moved.\n var view = _this._viewContainerRef.get(adjustedPreviousIndex);\n _this._viewContainerRef.move(view, currentIndex);\n view.context.$implicit = record.item;\n }\n });\n // Update $implicit for any items that had an identity change.\n changes.forEachIdentityChange(function (record) {\n var view = _this._viewContainerRef.get(record.currentIndex);\n view.context.$implicit = record.item;\n });\n // Update the context variables on all items.\n var count = this._data.length;\n var i = this._viewContainerRef.length;\n while (i--) {\n var view = this._viewContainerRef.get(i);\n view.context.index = this._renderedRange.start + i;\n view.context.count = count;\n this._updateComputedContextProperties(view.context);\n }\n };\n /** Cache the given detached view. */\n CdkVirtualForOf.prototype._cacheView = function (view) {\n if (this._templateCache.length < this.cdkVirtualForTemplateCacheSize) {\n this._templateCache.push(view);\n }\n else {\n var index = this._viewContainerRef.indexOf(view);\n // It's very unlikely that the index will ever be -1, but just in case,\n // destroy the view on its own, otherwise destroy it through the\n // container to ensure that all the references are removed.\n if (index === -1) {\n view.destroy();\n }\n else {\n this._viewContainerRef.remove(index);\n }\n }\n };\n /** Inserts a view for a new item, either from the cache or by creating a new one. */\n CdkVirtualForOf.prototype._insertViewForNewItem = function (index) {\n return this._insertViewFromCache(index) || this._createEmbeddedViewAt(index);\n };\n /** Update the computed properties on the `CdkVirtualForOfContext`. */\n CdkVirtualForOf.prototype._updateComputedContextProperties = function (context) {\n context.first = context.index === 0;\n context.last = context.index === context.count - 1;\n context.even = context.index % 2 === 0;\n context.odd = !context.even;\n };\n /** Creates a new embedded view and moves it to the given index */\n CdkVirtualForOf.prototype._createEmbeddedViewAt = function (index) {\n // Note that it's important that we insert the item directly at the proper index,\n // rather than inserting it and the moving it in place, because if there's a directive\n // on the same node that injects the `ViewContainerRef`, Angular will insert another\n // comment node which can throw off the move when it's being repeated for all items.\n return this._viewContainerRef.createEmbeddedView(this._template, {\n $implicit: null,\n // It's guaranteed that the iterable is not \"undefined\" or \"null\" because we only\n // generate views for elements if the \"cdkVirtualForOf\" iterable has elements.\n cdkVirtualForOf: this._cdkVirtualForOf,\n index: -1,\n count: -1,\n first: false,\n last: false,\n odd: false,\n even: false\n }, index);\n };\n /** Inserts a recycled view from the cache at the given index. */\n CdkVirtualForOf.prototype._insertViewFromCache = function (index) {\n var cachedView = this._templateCache.pop();\n if (cachedView) {\n this._viewContainerRef.insert(cachedView, index);\n }\n return cachedView || null;\n };\n /** Detaches the embedded view at the given index. */\n CdkVirtualForOf.prototype._detachView = function (index) {\n return this._viewContainerRef.detach(index);\n };\n return CdkVirtualForOf;\n }());\n CdkVirtualForOf.decorators = [\n { type: i0.Directive, args: [{\n selector: '[cdkVirtualFor][cdkVirtualForOf]',\n },] }\n ];\n CdkVirtualForOf.ctorParameters = function () { return [\n { type: i0.ViewContainerRef },\n { type: i0.TemplateRef },\n { type: i0.IterableDiffers },\n { type: CdkVirtualScrollViewport, decorators: [{ type: i0.SkipSelf }] },\n { type: i0.NgZone }\n ]; };\n CdkVirtualForOf.propDecorators = {\n cdkVirtualForOf: [{ type: i0.Input }],\n cdkVirtualForTrackBy: [{ type: i0.Input }],\n cdkVirtualForTemplate: [{ type: i0.Input }],\n cdkVirtualForTemplateCacheSize: [{ type: i0.Input }]\n };\n\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n var CdkScrollableModule = /** @class */ (function () {\n function CdkScrollableModule() {\n }\n return CdkScrollableModule;\n }());\n CdkScrollableModule.decorators = [\n { type: i0.NgModule, args: [{\n exports: [CdkScrollable],\n declarations: [CdkScrollable]\n },] }\n ];\n /**\n * @docs-primary-export\n */\n var ScrollingModule = /** @class */ (function () {\n function ScrollingModule() {\n }\n return ScrollingModule;\n }());\n ScrollingModule.decorators = [\n { type: i0.NgModule, args: [{\n imports: [\n bidi.BidiModule,\n i1.PlatformModule,\n CdkScrollableModule\n ],\n exports: [\n bidi.BidiModule,\n CdkScrollableModule,\n CdkFixedSizeVirtualScroll,\n CdkVirtualForOf,\n CdkVirtualScrollViewport,\n ],\n declarations: [\n CdkFixedSizeVirtualScroll,\n CdkVirtualForOf,\n CdkVirtualScrollViewport,\n ],\n },] }\n ];\n\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n /**\n * Generated bundle index. Do not edit.\n */\n\n exports.CdkFixedSizeVirtualScroll = CdkFixedSizeVirtualScroll;\n exports.CdkScrollable = CdkScrollable;\n exports.CdkScrollableModule = CdkScrollableModule;\n exports.CdkVirtualForOf = CdkVirtualForOf;\n exports.CdkVirtualScrollViewport = CdkVirtualScrollViewport;\n exports.DEFAULT_RESIZE_TIME = DEFAULT_RESIZE_TIME;\n exports.DEFAULT_SCROLL_TIME = DEFAULT_SCROLL_TIME;\n exports.FixedSizeVirtualScrollStrategy = FixedSizeVirtualScrollStrategy;\n exports.ScrollDispatcher = ScrollDispatcher;\n exports.ScrollingModule = ScrollingModule;\n exports.VIRTUAL_SCROLL_STRATEGY = VIRTUAL_SCROLL_STRATEGY;\n exports.ViewportRuler = ViewportRuler;\n exports._fixedSizeVirtualScrollStrategyFactory = _fixedSizeVirtualScrollStrategyFactory;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n})));\n//# sourceMappingURL=cdk-scrolling.umd.js.map\n"]} |