Alpine.data("Pagination",()=>({rangeMax:3,get rangeFirstPage(){return this.currentPage===1?1:this.currentPage===this.totalPage?this.totalPage-this.rangeMax<0?1:this.totalPage-this.rangeMax+1:this.currentPage-1},get rangeLastPage(){return Math.min(this.rangeFirstPage+this.rangeMax-1,this.totalPage)},get range(){let t=[];for(let e=this.rangeFirstPage;e<=this.rangeLastPage;e+=1)t.push(e);return t},get hasFirst(){return this.currentPage===1},get hasLast(){return this.currentPage===this.totalPage},init(){this.currentPage>this.totalPage&&this.$dispatch("page-changed",{page:this.totalPage})},prev(){this.$dispatch("page-changed",{page:this.currentPage-1})},next(){this.$dispatch("page-changed",{page:this.currentPage+1})},goto(t){this.currentPage!==t&&this.$dispatch("page-changed",{page:t})},hasActive(t){return t===this.currentPage}}));
