text: /*!
   * ui-grid - v4.6.0 - 2018-06-21
   * Copyright (c) 2018 ; License: MIT 
   */
  
  
  !function(){"use strict";var n=angular.module("ui.grid.pagination",["ng","ui.grid"]);n.service("uiGridPaginationService",["gridUtil",function(i){var n={initializeGrid:function(o){n.defaultGridOptions(o.options);var g={events:{pagination:{paginationChanged:function(n,i){}}},methods:{pagination:{getPage:function(){return o.options.enablePagination?o.options.paginationCurrentPage:null},getFirstRowIndex:function(){return o.options.useCustomPagination?o.options.paginationPageSizes.reduce(function(n,i,a){return a<o.options.paginationCurrentPage-1?n+i:n},0):(o.options.paginationCurrentPage-1)*o.options.paginationPageSize},getLastRowIndex:function(){return o.options.useCustomPagination?g.methods.pagination.getFirstRowIndex()+o.options.paginationPageSizes[o.options.paginationCurrentPage-1]-1:Math.min(o.options.paginationCurrentPage*o.options.paginationPageSize,o.options.totalItems)-1},getTotalPages:function(){return o.options.enablePagination?o.options.useCustomPagination?o.options.paginationPageSizes.length:0===o.options.totalItems?1:Math.ceil(o.options.totalItems/o.options.paginationPageSize):null},nextPage:function(){o.options.enablePagination&&(0<o.options.totalItems?o.options.paginationCurrentPage=Math.min(o.options.paginationCurrentPage+1,g.methods.pagination.getTotalPages()):o.options.paginationCurrentPage++)},previousPage:function(){o.options.enablePagination&&(o.options.paginationCurrentPage=Math.max(o.options.paginationCurrentPage-1,1))},seek:function(n){if(o.options.enablePagination){if(!angular.isNumber(n)||n<1)throw"Invalid page number: "+n;o.options.paginationCurrentPage=Math.min(n,g.methods.pagination.getTotalPages())}}}}};o.api.registerEventsFromObject(g.events),o.api.registerMethodsFromObject(g.methods);o.registerRowsProcessor(function(n){if(o.options.useExternalPagination||!o.options.enablePagination)return n;var i=parseInt(o.options.paginationPageSize,10),a=(parseInt(o.options.paginationCurrentPage,10),n.filter(function(n){return n.visible}));o.options.totalItems=a.length;var t=g.methods.pagination.getFirstRowIndex(),e=g.methods.pagination.getLastRowIndex();return t>a.length&&(t=((o.options.paginationCurrentPage=1)-1)*i),a.slice(t,e+1)},900)},defaultGridOptions:function(n){n.enablePagination=!1!==n.enablePagination,n.enablePaginationControls=!1!==n.enablePaginationControls,n.useExternalPagination=!0===n.useExternalPagination,n.useCustomPagination=!0===n.useCustomPagination,i.isNullOrUndefined(n.totalItems)&&(n.totalItems=0),i.isNullOrUndefined(n.paginationPageSizes)&&(n.paginationPageSizes=[250,500,1e3]),i.isNullOrUndefined(n.paginationPageSize)&&(0<n.paginationPageSizes.length?n.paginationPageSize=n.paginationPageSizes[0]:n.paginationPageSize=0),i.isNullOrUndefined(n.paginationCurrentPage)&&(n.paginationCurrentPage=1),i.isNullOrUndefined(n.paginationTemplate)&&(n.paginationTemplate="ui-grid/pagination")},onPaginationChanged:function(n,i,a){n.api.pagination.raise.paginationChanged(i,a),n.options.useExternalPagination||n.queueGridRefresh()}};return n}]),n.directive("uiGridPagination",["gridUtil","uiGridPaginationService",function(e,o){return{priority:-200,scope:!1,require:"uiGrid",link:{pre:function(n,a,i,t){o.initializeGrid(t.grid),e.getTemplate(t.grid.options.paginationTemplate).then(function(n){var i=angular.element(n);a.append(i),t.innerCompile(i)})}}}}]),n.directive("uiGridPager",["uiGridPaginationService","uiGridConstants","gridUtil","i18nService","i18nConstants",function(s,u,P,l,d){return{priority:-200,scope:!0,require:"^uiGrid",link:function(a,i,n,t){a.aria=l.getSafeText("pagination.aria");var e=function(){a.paginationApi=t.grid.api.pagination,a.sizesLabel=l.getSafeText("pagination.sizes"),a.totalItemsLabel=l.getSafeText("pagination.totalItems"),a.paginationOf=l.getSafeText("pagination.of"),a.paginationThrough=l.getSafeText("pagination.through")};e(),a.$on(d.UPDATE_EVENT,e);var o=t.grid.options;t.grid.renderContainers.body.registerViewportAdjuster(function(n){return o.enablePaginationControls&&(n.height=n.height-P.elementHeight(i,"padding")),n});var g=t.grid.registerDataChangeCallback(function(n){n.options.useExternalPagination||(n.options.totalItems=n.rows.length)},[u.dataChange.ROW]);a.$on("$destroy",g);var r=a.$watch("grid.options.paginationCurrentPage + grid.options.paginationPageSize",function(n,i){n!==i&&void 0!==i&&(!angular.isNumber(o.paginationCurrentPage)||o.paginationCurrentPage<1?o.paginationCurrentPage=1:0<o.totalItems&&o.paginationCurrentPage>a.paginationApi.getTotalPages()?o.paginationCurrentPage=a.paginationApi.getTotalPages():s.onPaginationChanged(a.grid,o.paginationCurrentPage,o.paginationPageSize))});a.$on("$destroy",function(){r()}),a.cantPageForward=function(){return a.paginationApi.getTotalPages()?a.cantPageToLast():o.data.length<1},a.cantPageToLast=function(){var n=a.paginationApi.getTotalPages();return!n||o.paginationCurrentPage>=n},a.cantPageBackward=function(){return o.paginationCurrentPage<=1};var p=function(n){n&&P.focus.bySelector(i,".ui-grid-pager-control-input")};a.pageFirstPageClick=function(){a.paginationApi.seek(1),p(a.cantPageBackward())},a.pagePreviousPageClick=function(){a.paginationApi.previousPage(),p(a.cantPageBackward())},a.pageNextPageClick=function(){a.paginationApi.nextPage(),p(a.cantPageForward())},a.pageLastPageClick=function(){a.paginationApi.seek(a.paginationApi.getTotalPages()),p(a.cantPageToLast())}}}}])}();