import {g,at as Mn,L as qp,R as tl,C as Cpe,ff as $c,e9 as Wd,fQ as qd,aN as $,bE as $d,fR as so,dl as Ie,bK as sn}from'./main-BiUBeaMj.js';var L=(()=>{class r{el=g(Mn);percentLimit=qp(70);onItself=qp(false,{transform:tl});dataObservable=qp(void 0);nearOfBottom=Cpe();decimalLimit=0;lastCurrentBottom;scrollDownSub;container;checkScroll=false;constructor(){this.decimalLimit=this.percentLimit()/100;}ngAfterViewChecked(){this.checkScroll&&(this.checkScroll=false,setTimeout(()=>{this.hasScroll()===false&&this.nearOfBottom.emit();}));}ngOnInit(){this.initialize();}ngOnDestroy(){this.scrollDownSub&&this.scrollDownSub.unsubscribe();}initialize(){this.container=this.onItself()?this.el.nativeElement:document.documentElement;let t={leading:true,trailing:true},i=this.onItself()?this.container:window,v=$c(i,"scroll").pipe(Wd(true),qd(200,void 0,t),$(()=>this.getScrollInfo()),$d((e,l)=>e.current===l.current),so());this.scrollDownSub=v.pipe(Ie(({current:e})=>this.isScrollingDown(e)),Ie(({current:e,maximumScroll:l})=>e/l>this.decimalLimit)).subscribe(()=>{this.nearOfBottom.emit();});let s=this.dataObservable();s&&s.pipe(Ie(e=>e.length!==0)).subscribe(()=>this.checkScroll=true);}getScrollInfo(){return {current:this.container.scrollTop,maximumScroll:this.getMaximumScroll()}}getMaximumScroll(){let t=this.onItself()?this.container.clientHeight:window.innerHeight;return this.container.scrollHeight-t}hasScroll(){return this.getMaximumScroll()>0}isScrollingDown(t){if(this.lastCurrentBottom===void 0)return this.lastCurrentBottom=t,false;let i=this.lastCurrentBottom<t;return this.lastCurrentBottom=t,i}static \u0275fac=function(i){return new(i||r)};static \u0275dir=sn({type:r,selectors:[["","myInfiniteScroller",""]],inputs:{percentLimit:[1,"percentLimit"],onItself:[1,"onItself"],dataObservable:[1,"dataObservable"]},outputs:{nearOfBottom:"nearOfBottom"}})}return r})();/**i18n:fad79908930cbb4c308e7550a5fe49bb3841dbb330066a6429aebaa006173605*/export{L};//# sourceMappingURL=chunk-CVz8lsM6.js.map
