import{H as u,M as f,P as b,T as d,Ua as O,aa as p,n as m,s as h,sa as g,ta as o,tc as w,ua as S,x as n}from"./chunk-GKQGDBUU.js";import{i as c}from"./chunk-QVFSZZWQ.js";var k=(()=>{let i=class i{el=p(S);percentLimit=o(70);onItself=o(!1,{transform:w});dataObservable=o(void 0);nearOfBottom=g();decimalLimit=0;lastCurrentBottom;scrollDownSub;container;checkScroll=!1;constructor(){this.decimalLimit=this.percentLimit()/100}ngAfterViewChecked(){this.checkScroll&&(this.checkScroll=!1,setTimeout(()=>{this.hasScroll()===!1&&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:!0,trailing:!0},r=this.onItself()?this.container:window,B=h(r,"scroll").pipe(b(!0),d(200,void 0,t),m(()=>this.getScrollInfo()),u((e,l)=>e.current===l.current),f());this.scrollDownSub=B.pipe(n(({current:e})=>this.isScrollingDown(e)),n(({current:e,maximumScroll:l})=>e/l>this.decimalLimit)).subscribe(()=>{this.nearOfBottom.emit()});let a=this.dataObservable();a&&a.pipe(n(e=>e.length!==0)).subscribe(()=>this.checkScroll=!0)}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,!1;let r=this.lastCurrentBottom<t;return this.lastCurrentBottom=t,r}};c(i,"\u0275fac",function(r){return new(r||i)}),c(i,"\u0275dir",O({type:i,selectors:[["","myInfiniteScroller",""]],inputs:{percentLimit:[1,"percentLimit"],onItself:[1,"onItself"],dataObservable:[1,"dataObservable"]},outputs:{nearOfBottom:"nearOfBottom"}}));let s=i;return s})();export{k as a};
/**i18n:42345378061bf3c93df67acfa161b751a7b03cc91f3ede7c1f1cdf2bba62fe26*/
//# sourceMappingURL=chunk-JTA5GQKU.js.map
