(function(e){var t={init:function(n){var r=e.extend({items:1,itemsOnPage:1,pages:0,displayedPages:3,edges:2,currentPage:1,hrefTextPrefix:"#page-",hrefTextSuffix:"",prevText:"Prev",nextText:"Next",ellipseText:"&hellip;",cssStyle:"light-theme",labelMap:[],selectOnClick:true,onPageClick:function(e,t){},onInit:function(){}},n||{});var i=this;r.pages=r.pages?r.pages:Math.ceil(r.items/r.itemsOnPage)?Math.ceil(r.items/r.itemsOnPage):1;r.currentPage=r.currentPage-1;r.halfDisplayed=r.displayedPages/2;this.each(function(){i.addClass(r.cssStyle+" simple-pagination").data("pagination",r);t._draw.call(i)});r.onInit();return this},selectPage:function(e){t._selectPage.call(this,e-1);return this},prevPage:function(){var e=this.data("pagination");if(e.currentPage>0){t._selectPage.call(this,e.currentPage-1)}return this},nextPage:function(){var e=this.data("pagination");if(e.currentPage<e.pages-1){t._selectPage.call(this,e.currentPage+1)}return this},getPagesCount:function(){return this.data("pagination").pages},getCurrentPage:function(){return this.data("pagination").currentPage+1},destroy:function(){this.empty();return this},drawPage:function(e){var n=this.data("pagination");n.currentPage=e-1;this.data("pagination",n);t._draw.call(this);return this},redraw:function(){t._draw.call(this);return this},disable:function(){var e=this.data("pagination");e.disabled=true;this.data("pagination",e);t._draw.call(this);return this},enable:function(){var e=this.data("pagination");e.disabled=false;this.data("pagination",e);t._draw.call(this);return this},updateItems:function(e){var n=this.data("pagination");n.items=e;n.pages=t._getPages(n);this.data("pagination",n);t._draw.call(this)},updateItemsOnPage:function(e){var n=this.data("pagination");n.itemsOnPage=e;n.pages=t._getPages(n);this.data("pagination",n);t._selectPage.call(this,0);return this},_draw:function(){var n=this.data("pagination"),r=t._getInterval(n),i;t.destroy.call(this);var s=this.prop("tagName")==="UL"?this:e("<ul></ul>").appendTo(this);if(n.prevText){t._appendItem.call(this,n.currentPage-1,{text:n.prevText,classes:"prev"})}if(r.start>0&&n.edges>0){var o=Math.min(n.edges,r.start);for(i=0;i<o;i++){t._appendItem.call(this,i)}if(n.edges<r.start&&r.start-n.edges!=1){s.append('<li class="disabled"><span class="ellipse">'+n.ellipseText+"</span></li>")}else if(r.start-n.edges==1){t._appendItem.call(this,n.edges)}}for(i=r.start;i<r.end;i++){t._appendItem.call(this,i)}if(r.end<n.pages&&n.edges>0){if(n.pages-n.edges>r.end&&n.pages-n.edges-r.end!=1){s.append('<li class="disabled"><span class="ellipse">'+n.ellipseText+"</span></li>")}else if(n.pages-n.edges-r.end==1){t._appendItem.call(this,r.end++)}var u=Math.max(n.pages-n.edges,r.end);for(i=u;i<n.pages;i++){t._appendItem.call(this,i)}}if(n.nextText){t._appendItem.call(this,n.currentPage+1,{text:n.nextText,classes:"next"})}},_getPages:function(e){var t=Math.ceil(e.items/e.itemsOnPage);return t||1},_getInterval:function(e){return{start:Math.ceil(e.currentPage>e.halfDisplayed?Math.max(Math.min(e.currentPage-e.halfDisplayed,e.pages-e.displayedPages),0):0),end:Math.ceil(e.currentPage>e.halfDisplayed?Math.min(e.currentPage+e.halfDisplayed,e.pages):Math.min(e.displayedPages,e.pages))}},_appendItem:function(n,r){var i=this,s,o,u=i.data("pagination"),a=e("<li></li>"),f=i.find("ul");n=n<0?0:n<u.pages?n:u.pages-1;s={text:n+1,classes:""};if(u.labelMap.length&&u.labelMap[n]){s.text=u.labelMap[n]}s=e.extend(s,r||{});if(n==u.currentPage||u.disabled){if(u.disabled){a.addClass("disabled")}else{a.addClass("active")}o=e('<span class="current">'+s.text+"</span>")}else{o=e('<a href="'+u.hrefTextPrefix+(n+1)+u.hrefTextSuffix+'" class="page-link">'+s.text+"</a>");o.click(function(e){return t._selectPage.call(i,n,e)})}if(s.classes){o.addClass(s.classes)}a.append(o);if(f.length){f.append(a)}else{i.append(a)}},_selectPage:function(e,n){var r=this.data("pagination");r.currentPage=e;if(r.selectOnClick){t._draw.call(this)}return r.onPageClick(e+1,n)}};e.fn.pagination=function(n){if(t[n]&&n.charAt(0)!="_"){return t[n].apply(this,Array.prototype.slice.call(arguments,1))}else if(typeof n==="object"||!n){return t.init.apply(this,arguments)}else{e.error("Method "+n+" does not exist on jQuery.pagination")}}})(jQuery)