export const __webpack_esm_id__=91179;export const __webpack_esm_ids__=[91179];export const __webpack_esm_modules__={91179(e,t,s){s.r(t),s.d(t,{ontotext_pagination:()=>o});var i=s(90408);class a{constructor(e,t){this._pageSize=e,this._pageNumber=t}get pageSize(){return this._pageSize}get pageNumber(){return this._pageNumber}}const o=class{constructor(e){(0,i.r)(this,e),this.pageSelected=(0,i.c)(this,"pageSelected",7),this.VISIBLE_PAGES_COUNT=5,this.PAGES_COUNT_AROUND_CURRENT=2,this.pageNumber=1,this.pageSize=10,this.totalElements=0,this.pageElements=void 0,this.hasMorePages=void 0,this.selectPage(this.pageNumber)}getShownPageNumbers(){const e=this.fetchLastShownPage(),t=[];for(let s=this.fetchFirstShownPage(e);s<=e;s++)t.push(s);return t}fetchLastShownPage(){const e=this.pageNumber;let t=e;const s=e<=3?this.VISIBLE_PAGES_COUNT-e:this.PAGES_COUNT_AROUND_CURRENT;for(let i=0;i<s;i++)(e+i)*this.pageSize<this.totalElements&&(t+=1);return t}fetchFirstShownPage(e){const t=e-this.VISIBLE_PAGES_COUNT+1;return t<1?1:t}previousButtonDisabled(){return this.pageNumber<this.PAGES_COUNT_AROUND_CURRENT}nextButtonDisabled(){return this.totalElements&&this.totalElements>=0?this.pageNumber*this.pageSize>=this.totalElements:!this.hasMorePages}nextPage(){this.pageSelected.emit(new a(this.pageSize,this.pageNumber+1))}previousPage(){this.pageSelected.emit(new a(this.pageSize,this.pageNumber-1))}selectPage(e){this.pageNumber!==e&&this.pageSelected.emit(new a(this.pageSize,e))}render(){return(0,i.h)(i.H,{class:"ontotext-pagination"},(0,i.h)("div",{class:"page-selectors"},(0,i.h)("button",{class:"page-selector previous-button",onClick:()=>this.previousPage(),disabled:this.previousButtonDisabled()},"‹"),this.getShownPageNumbers().map(e=>(0,i.h)("button",{class:"page-button page-selector "+(this.pageNumber===e?"selected-page":""),onClick:()=>this.selectPage(e),disabled:this.pageNumber===e},e)),(0,i.h)("button",{class:"page-selector next-button",onClick:()=>this.nextPage(),disabled:this.nextButtonDisabled()},"›")))}};o.style=".ontotext-pagination .page-selectors{height:100%;display:flex;justify-content:space-around;align-items:center;min-width:100px}.ontotext-pagination .page-selector{color:#0060b0;padding:2px 5px;background-color:#FFF;border:none;cursor:pointer}.ontotext-pagination .page-selector:disabled{cursor:unset}.ontotext-pagination .previous-button:disabled,.ontotext-pagination .next-button:disabled{opacity:0.4}.ontotext-pagination .selected-page{background-color:#e84e0f;color:#FFFFFF}"}};
//# sourceMappingURL=91179.e7fdcf0fcd9e62e6476b.bundle.js.map