text: "use strict";
  /**
   * PAGINATION widget
   * @version 1.0.0
   * @license MIT License
   * 
   * Copyright (c) 2019 Guido Donnari (gmdonnari@yahoo.com.ar)
   * 
   * Permission is hereby granted, free of charge, to any person obtaining a copy
   * of this software and associated documentation files (the "Software"), to deal
   * in the Software without restriction, including without limitation the rights
   * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   * copies of the Software, and to permit persons to whom the Software is
   * furnished to do so, subject to the following conditions:
   * 
   * The above copyright notice and this permission notice shall be included in all
   * copies or substantial portions of the Software.
   * 
   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   * SOFTWARE.
   */jQuery.widget("gmd.paginator",{options:{currentPage:1,offset:0,pageSize:10,maxPages:5,totalRecordCount:500,messages:{pagingInfo:"Showing from {0} to {1} of {2} records"}},_data:{},_create:function(){this._data=this._calculate(this.options.currentPage,this.options.offset,this.options.totalRecordCount,this.options.pageSize,this.options.maxPages),this.element.html(JSON.stringify(this._data))},_calculate:function(t,a,e,i,s){var n={},o=t;o?a=(o-1)*i:o=a/i+1,e<=a&&(o=1,a=0);var p=Math.ceil(e/i),g=o-Math.floor(s/2);g<1&&(g=1);var r=g+s-1,h=r-p;0<h&&(r=p,(g-=h)<1&&(g=1));var l=(o-1)*i+1,u=o*i;e<u&&(u=e);for(var d=[],_=g;_<=r;_++)d.push(_);return n.firstRec=l,n.lastRec=u,n.rowCount=e,n.currPage=o,n.offset=a,n.lastPage=r,n.pages=d,n.totalPages=p,n.shownPages=s,n.pageSize=i,n.info=this._formatString(this.options.messages.pagingInfo,l,u,e),n},_formatString:function(){if(0===arguments.length)return null;for(var t=arguments[0],a=1;a<arguments.length;a++){var e="{"+(a-1)+"}";t=t.replace(e,arguments[a])}return t}}),
  /**
   * PAGINATION widget
   * @version 1.0.0
   * @license MIT License
   * 
   * Copyright (c) 2019 Guido Donnari (gmdonnari@yahoo.com.ar)
   * 
   * Permission is hereby granted, free of charge, to any person obtaining a copy
   * of this software and associated documentation files (the "Software"), to deal
   * in the Software without restriction, including without limitation the rights
   * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   * copies of the Software, and to permit persons to whom the Software is
   * furnished to do so, subject to the following conditions:
   * 
   * The above copyright notice and this permission notice shall be included in all
   * copies or substantial portions of the Software.
   * 
   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   * SOFTWARE.
   */
  function(s){s.widget("gmd.twbspaginator",s.gmd.paginator,{options:{debug:!1,first:"&lt;&lt;",previous:"&lt;",next:"&gt;",last:"&gt;&gt;",pages:!0,gotoPageInput:!0,pageSizeInput:!0,pageSizes:[10,25,50,100,250,500],onLoad:function(t,a,e){console.log("twbspaginator loaded")},onPageChange:function(t,a,e){alert("Change to page number "+e.currPage)},onPageSizeChange:function(t,a,e,i){console.log("Change page size to "+t)},messages:{first:"First page",previous:"Previous page",next:"Next page",last:"Last page"}},_$container:null,_$ul:null,_$first:!1,_$previous:!1,_$next:!1,_$last:!1,_$current:!1,_$pageSizeInput:null,_$gotoPageInput:null,_create:function(){this._$container=s("<div />").addClass("dl-pagination"),this._$ul=s("<ul>").addClass("dl-pagination-ul pagination").appendTo(this._$container),this._load(),this._$container.appendTo(this.element)},_debug:function(t){this.options.debug&&console.log(t)},_load:function(){this._debug(this.options),this._data=this._calculate(this.options.currentPage,this.options.offset,this.options.totalRecordCount,this.options.pageSize,this.options.maxPages),this._debug(this._data),this._$ul.empty(),this._createLeftControls(),this.options.pages&&this._createPages(),this._createRightControls(),this._createPageSizeInput(),this._createGotoPageInput(),this.options.onLoad(this._data,this._$pageSizeInput,this._$gotoPageInput)},_pageChange:function(t){var a=(t-1)*this._data.pageSize;this.options.onPageChange(t,a,this._data)},_changePageSize:function(t){var a=(this._data.currPage-1)*t;this.options.onPageSizeChange(t,this._data.currPage,a,this._data)},_createLeftControls:function(){var a=this;this.options.first&&(this._$first=s("<li>").addClass("dl-pagination-first").html('<a href="#" aria-label="'+this.options.messages.first+'" title="'+this.options.messages.first+'"><span aria-hidden="true">'+this.options.first+"</span></a>").appendTo(this._$ul),this._data.currPage<=1?this._$first.addClass("disabled"):this._$first.click(function(t){t.preventDefault(),a._pageChange(1)})),this.options.previous&&(this._$previous=s("<li>").addClass("dl-pagination-previous").html('<a href="#" aria-label="'+this.options.messages.previous+'" title="'+this.options.messages.previous+'"><span aria-hidden="true">'+this.options.previous+"</span></a>").appendTo(this._$ul),this._data.currPage<=1?this._$previous.addClass("disabled"):this._$previous.click(function(t){t.preventDefault(),a._pageChange(a._data.currPage-1)}))},_createRightControls:function(){var a=this;this.options.next&&(this._$next=s("<li>").addClass("dl-pagination-next").html('<a href="#" aria-label="'+this.options.messages.next+'" title="'+this.options.messages.next+'"><span aria-hidden="true">'+this.options.next+"</span></a>").appendTo(this._$ul),this._data.currPage>=this._data.totalPages?this._$next.addClass("disabled"):this._$next.click(function(t){t.preventDefault(),a._pageChange(a._data.currPage+1)})),this.options.last&&(this._$last=s("<li>").addClass("dl-pagination-last").html('<a href="#" aria-label="'+this.options.messages.last+'" title="'+this.options.messages.last+'"><span aria-hidden="true">'+this.options.last+"</span></a>").appendTo(this._$ul),this._data.currPage>=this._data.totalPages?this._$last.addClass("disabled"):this._$last.click(function(t){t.preventDefault(),a._pageChange(a._data.totalPages)}))},_createPages:function(){for(var a=this,t=0;t<this._data.pages.length;t++){var e=this._data.pages[t],i=s("<li>").addClass("dl-pagination-number").html('<a href="#" aria-label="Page '+e+'" title="Page'+e+'"><span aria-hidden="true">'+e+"</span></a>").data("pageNumber",e).click(function(t){t.preventDefault(),a._pageChange(s(this).data("pageNumber"))}).appendTo(this._$ul);e===this._data.currPage&&i.addClass("dl-pagination-current active")}},_createPageSizeInput:function(){var t=this;if(this.options.pageSizeInput){this._$pageSizeInput=s('<select name="dl_page_size"></select>').addClass("form-control"),s.inArray(this._data.pageSize,this.options.pageSizes)<0&&this.options.pageSizes.push(this._data.pageSize),this.options.pageSizes.sort(function(t,a){return t-a});for(var a=0;a<this.options.pageSizes.length;a++)this._$pageSizeInput.append('<option value="'+this.options.pageSizes[a]+'">'+this.options.pageSizes[a]+"</option>");this._$pageSizeInput.val(this._data.pageSize).change(function(){t._changePageSize(parseInt(s(this).val()))})}else this._$pageSizeInput=null},_createGotoPageInput:function(){var t=this;if(this.options.gotoPageInput){this._$gotoPageInput=s('<select name="dl_go_to_page"></select>').addClass("form-control").change(function(){t._pageChange(parseInt(s(this).val()))});var a=1;s.inArray(a,this._data.pages)<0&&this._$gotoPageInput.append('<option value="'+a+'">'+a+"</option>"),0<(a=t._data.currPage-1)&&s.inArray(a,this._data.pages)<0&&this._$gotoPageInput.append('<option value="'+a+'">'+a+"</option>");for(var e=0;e<this._data.pages.length;e++)a=this._data.pages[e],this._$gotoPageInput.append('<option value="'+a+'">'+a+"</option>");(a=t._data.currPage+1)<this._data.totalPages&&s.inArray(a,this._data.pages)<0&&this._$gotoPageInput.append('<option value="'+a+'">'+a+"</option>"),a=t._data.totalPages,s.inArray(a,this._data.pages)<0&&this._$gotoPageInput.append('<option value="'+a+'">'+a+"</option>"),this._$gotoPageInput.val(this._data.currPage)}else this._$gotoPageInput=null},reload:function(t){s.extend(!0,this.options,t),this._load()}})}(jQuery);