/*!
 * ui-grid - v4.10.0 - 2021-02-01
 * Copyright (c) 2021 ; License: MIT 
 */


!function(){"use strict";var e=angular.module("ui.grid.selection",["ui.grid"]);e.constant("uiGridSelectionConstants",{featureName:"selection",selectionRowHeaderColName:"selectionRowHeaderCol"}),angular.module("ui.grid").config(["$provide",function(e){e.decorator("GridRow",["$delegate",function(e){return e.prototype.setSelected=function(e){e!==this.isSelected&&(this.isSelected=e,this.grid.selection.selectedCount+=e?1:-1)},e.prototype.setFocused=function(e){e!==this.isFocused&&(this.grid.selection.focusedRow&&(this.grid.selection.focusedRow.isFocused=!1),this.grid.selection.focusedRow=e?this:null,this.isFocused=e)},e}])}]),e.service("uiGridSelectionService",function(){var a={initializeGrid:function(o){o.selection={lastSelectedRow:null,focusedRow:null,selectAll:!1},o.selection.selectedCount=0,a.defaultGridOptions(o.options);var e={events:{selection:{rowFocusChanged:function(e,t,i){},rowSelectionChanged:function(e,t,i){},rowSelectionChangedBatch:function(e,t,i){}}},methods:{selection:{toggleRowSelection:function(e,t){var i=o.getRow(e);null!==i&&a.toggleRowSelection(o,i,t,o.options.multiSelect,o.options.noUnselect)},selectRow:function(e,t){var i=o.getRow(e);null===i||i.isSelected||a.toggleRowSelection(o,i,t,o.options.multiSelect,o.options.noUnselect)},selectRowByVisibleIndex:function(e,t){var i=o.renderContainers.body.visibleRowCache[e];null==i||i.isSelected||a.toggleRowSelection(o,i,t,o.options.multiSelect,o.options.noUnselect)},unSelectRow:function(e,t){var i=o.getRow(e);null!==i&&i.isSelected&&a.toggleRowSelection(o,i,t,o.options.multiSelect,o.options.noUnselect)},unSelectRowByVisibleIndex:function(e,t){var i=o.renderContainers.body.visibleRowCache[e];null!=i&&i.isSelected&&a.toggleRowSelection(o,i,t,o.options.multiSelect,o.options.noUnselect)},selectAllRows:function(t){if(!1!==o.options.multiSelect){var i=[];o.rows.forEach(function(e){e.isSelected||!1===e.enableSelection||!1===o.options.isRowSelectable(e)||(e.setSelected(!0),a.decideRaiseSelectionEvent(o,e,i,t))}),o.selection.selectAll=!0,a.decideRaiseSelectionBatchEvent(o,i,t)}},selectAllVisibleRows:function(t){if(!1!==o.options.multiSelect){var i=[];o.rows.forEach(function(e){e.visible?e.isSelected||!1===e.enableSelection||!1===o.options.isRowSelectable(e)||(e.setSelected(!0),a.decideRaiseSelectionEvent(o,e,i,t)):e.isSelected&&(e.setSelected(!1),a.decideRaiseSelectionEvent(o,e,i,t))}),o.selection.selectAll=!0,a.decideRaiseSelectionBatchEvent(o,i,t)}},clearSelectedRows:function(e){a.clearSelectedRows(o,e)},getSelectedRows:function(){return a.getSelectedRows(o).map(function(e){return e.entity}).filter(function(e){return e.hasOwnProperty("$$hashKey")||!angular.isObject(e)})},getSelectedGridRows:function(){return a.getSelectedRows(o)},getSelectedCount:function(){return o.selection.selectedCount},setMultiSelect:function(e){o.options.multiSelect=e},setModifierKeysToMultiSelect:function(e){o.options.modifierKeysToMultiSelect=e},getSelectAllState:function(){return o.selection.selectAll}}}};o.api.registerEventsFromObject(e.events),o.api.registerMethodsFromObject(e.methods)},defaultGridOptions:function(e){e.enableRowSelection=!1!==e.enableRowSelection,e.multiSelect=!1!==e.multiSelect,e.noUnselect=!0===e.noUnselect,e.modifierKeysToMultiSelect=!0===e.modifierKeysToMultiSelect,e.enableRowHeaderSelection=!1!==e.enableRowHeaderSelection,void 0===e.enableFullRowSelection&&(e.enableFullRowSelection=!e.enableRowHeaderSelection),e.enableFocusRowOnRowHeaderClick=!1!==e.enableFocusRowOnRowHeaderClick||!e.enableRowHeaderSelection,e.enableSelectRowOnFocus=!1!==e.enableSelectRowOnFocus,e.enableSelectAll=!1!==e.enableSelectAll,e.enableSelectionBatchEvent=!1!==e.enableSelectionBatchEvent,e.selectionRowHeaderWidth=angular.isDefined(e.selectionRowHeaderWidth)?e.selectionRowHeaderWidth:30,e.enableFooterTotalSelected=!1!==e.enableFooterTotalSelected,e.isRowSelectable=angular.isDefined(e.isRowSelectable)?e.isRowSelectable:angular.noop},toggleRowSelection:function(e,t,i,o,n){if(!1!==t.enableSelection){var l,c=t.isSelected;o||(c?1<(l=a.getSelectedRows(e)).length&&(c=!1,a.clearSelectedRows(e,i)):a.clearSelectedRows(e,i)),c&&n||(t.setSelected(!c),!0===t.isSelected&&(e.selection.lastSelectedRow=t),l=a.getSelectedRows(e),e.selection.selectAll=e.rows.length===l.length,e.api.selection.raise.rowSelectionChanged(t,i))}},shiftSelect:function(e,t,i,o){if(o){var n=0<a.getSelectedRows(e).length?e.renderContainers.body.visibleRowCache.indexOf(e.selection.lastSelectedRow):0,l=e.renderContainers.body.visibleRowCache.indexOf(t);if(l<n){var c=n;n=l,l=c}for(var s=[],r=n;r<=l;r++){var d=e.renderContainers.body.visibleRowCache[r];d&&(d.isSelected||!1===d.enableSelection||(d.setSelected(!0),e.selection.lastSelectedRow=d,a.decideRaiseSelectionEvent(e,d,s,i)))}a.decideRaiseSelectionBatchEvent(e,s,i)}},getSelectedRows:function(e){return e.rows.filter(function(e){return e.isSelected})},clearSelectedRows:function(t,i){var o=[];a.getSelectedRows(t).forEach(function(e){e.isSelected&&(e.setSelected(!1),a.decideRaiseSelectionEvent(t,e,o,i))}),t.selection.selectAll=!1,t.selection.selectedCount=0,a.decideRaiseSelectionBatchEvent(t,o,i)},decideRaiseSelectionEvent:function(e,t,i,o){e.options.enableSelectionBatchEvent?i.push(t):e.api.selection.raise.rowSelectionChanged(t,o)},decideRaiseSelectionBatchEvent:function(e,t,i){0<t.length&&e.api.selection.raise.rowSelectionChangedBatch(t,i)}};return a}),e.directive("uiGridSelection",["uiGridSelectionConstants","uiGridSelectionService","uiGridConstants",function(d,a,u){return{replace:!0,priority:0,require:"^uiGrid",scope:!1,compile:function(){return{pre:function(e,t,i,o){if(a.initializeGrid(o.grid),o.grid.options.enableRowHeaderSelection){var n={name:d.selectionRowHeaderColName,displayName:"",width:o.grid.options.selectionRowHeaderWidth,minWidth:10,cellTemplate:"ui-grid/selectionRowHeader",headerCellTemplate:"ui-grid/selectionHeaderCell",enableColumnResizing:!1,enableColumnMenu:!1,exporterSuppressExport:!0,allowCellFocus:!0};o.grid.addRowHeaderColumn(n,0)}var l=!1,c=function(e){return e.forEach(function(e){e.enableSelection=o.grid.options.isRowSelectable(e)}),e},s=function(){o.grid.options.isRowSelectable!==angular.noop&&!0!==l&&(o.grid.registerRowsProcessor(c,500),l=!0)};s();var r=o.grid.registerDataChangeCallback(s,[u.dataChange.OPTIONS]);e.$on("$destroy",r)},post:function(e,t,i,o){}}}}}]),e.directive("uiGridSelectionRowHeaderButtons",["$templateCache","uiGridSelectionService","gridUtil",function(e,c,s){return{replace:!0,restrict:"E",template:e.get("ui-grid/selectionRowHeaderButtons"),scope:!0,require:"^uiGrid",link:function(e,t,i,o){var n=o.grid;function l(e,t){if(t.stopPropagation(),t.shiftKey)c.shiftSelect(n,e,t,n.options.multiSelect);else if(t.ctrlKey||t.metaKey)c.toggleRowSelection(n,e,t,n.options.multiSelect,n.options.noUnselect);else if(e.groupHeader){c.toggleRowSelection(n,e,t,n.options.multiSelect,n.options.noUnselect);for(var i=0;i<e.treeNode.children.length;i++)c.toggleRowSelection(n,e.treeNode.children[i].row,t,n.options.multiSelect,n.options.noUnselect)}else c.toggleRowSelection(n,e,t,n.options.multiSelect&&!n.options.modifierKeysToMultiSelect,n.options.noUnselect);n.options.enableFocusRowOnRowHeaderClick&&e.setFocused(!e.isFocused)&&n.api.selection.raise.rowFocusChanged(e,t)}e.selectButtonClick=l,e.selectButtonKeyDown=function(e,t){32!==t.keyCode&&13!==t.keyCode||(t.preventDefault(),l(e,t))},"ie"===s.detectBrowser()&&t.on("mousedown",function(e){(e.ctrlKey||e.shiftKey)&&(e.target.onselectstart=function(){return!1},window.setTimeout(function(){e.target.onselectstart=null},0))}),e.$on("$destroy",function(){t.off()})}}}]),e.directive("uiGridSelectionSelectAllButtons",["$templateCache","uiGridSelectionService",function(e,o){return{replace:!0,restrict:"E",template:e.get("ui-grid/selectionSelectAllButtons"),scope:!1,link:function(t){var i=t.col.grid;t.headerButtonKeyDown=function(e){32!==e.keyCode&&13!==e.keyCode||(e.preventDefault(),t.headerButtonClick(e))},t.headerButtonClick=function(e){i.selection.selectAll?(o.clearSelectedRows(i,e),i.options.noUnselect&&i.api.selection.selectRowByVisibleIndex(0,e),i.selection.selectAll=!1):i.options.multiSelect&&(i.api.selection.selectAllVisibleRows(e),i.selection.selectAll=!0)}}}}]),e.directive("uiGridViewport",function(){return{priority:-200,scope:!1,compile:function(e){var t=angular.element(e[0].querySelector(".ui-grid-canvas:not(.ui-grid-empty-base-layer-container)").children[0]),i="'ui-grid-row-selected': row.isSelected, 'ui-grid-row-focused': row.isFocused}",o=t.attr("ng-class");return i=o?o.slice(0,-1)+","+i:"{"+i,t.attr("ng-class",i),{pre:function(e,t,i,o){},post:function(e,t,i,o){}}}}}),e.directive("uiGridCell",["uiGridConstants","uiGridSelectionService",function(u,g){return{priority:-200,restrict:"A",require:"?^uiGrid",scope:!1,link:function(i,c,e,t){var s=0,r={};t.grid.api.cellNav&&t.grid.api.cellNav.on.viewPortKeyDown(i,function(e,t){null!==t&&t.row===i.row&&t.col===i.col&&e.keyCode===u.keymap.SPACE&&"selectionRowHeaderCol"===i.col.colDef.name&&(e.preventDefault(),g.toggleRowSelection(i.grid,i.row,e,i.grid.options.multiSelect&&!i.grid.options.modifierKeysToMultiSelect,i.grid.options.noUnselect),i.$apply())});var d=function(e){"ui-grid-icon-minus-squared"!==e.target.className&&"ui-grid-icon-plus-squared"!==e.target.className&&(c.off("touchend",n),e.shiftKey?g.shiftSelect(i.grid,i.row,e,i.grid.options.multiSelect):e.ctrlKey||e.metaKey?g.toggleRowSelection(i.grid,i.row,e,i.grid.options.multiSelect,i.grid.options.noUnselect):i.grid.options.enableSelectRowOnFocus&&g.toggleRowSelection(i.grid,i.row,e,i.grid.options.multiSelect&&!i.grid.options.modifierKeysToMultiSelect,i.grid.options.noUnselect),i.row.setFocused(!i.row.isFocused),i.grid.api.selection.raise.rowFocusChanged(i.row,e),i.$apply(),window.setTimeout(function(){c.on("touchend",n)},300))},o=function(e){s=(new Date).getTime(),r=e.changedTouches[0],c.off("click",d)},n=function(e){var t=(new Date).getTime(),i=e.changedTouches[0],o=t-s,n=Math.abs(r.clientX-i.clientX),l=Math.abs(r.clientY-i.clientY);n<100&&l<100&&o<300&&d(e),window.setTimeout(function(){c.on("click",d)},300)};function l(){i.grid.options.enableRowSelection&&i.grid.options.enableFullRowSelection&&"selectionRowHeaderCol"!==i.col.colDef.name&&(c.addClass("ui-grid-disable-selection"),c.on("touchstart",o),c.on("touchend",n),c.on("click",d),i.registered=!0)}l();var a=i.grid.registerDataChangeCallback(function(){i.grid.options.enableRowSelection&&i.grid.options.enableFullRowSelection&&!i.registered?l():i.grid.options.enableRowSelection&&i.grid.options.enableFullRowSelection||!i.registered||i.registered&&(c.removeClass("ui-grid-disable-selection"),c.off("touchstart",o),c.off("touchend",n),c.off("click",d),i.registered=!1)},[u.dataChange.OPTIONS]);c.on("$destroy",a)}}}]),e.directive("uiGridGridFooter",["$compile","gridUtil",function(l,i){return{restrict:"EA",replace:!0,priority:-1e3,require:"^uiGrid",scope:!0,compile:function(){return{pre:function(o,n,e,t){t.grid.options.showGridFooter&&i.getTemplate("ui-grid/gridFooterSelectedItems").then(function(e){var t=angular.element(e),i=l(t)(o);angular.element(n[0].getElementsByClassName("ui-grid-grid-footer")[0]).append(i)})},post:function(e,t,i,o){}}}}}])}(),angular.module("ui.grid.selection").run(["$templateCache",function(e){"use strict";e.put("ui-grid/gridFooterSelectedItems",'<span ng-if="grid.selection.selectedCount !== 0 && grid.options.enableFooterTotalSelected">({{"search.selectedItems" | t}} {{grid.selection.selectedCount}})</span>'),e.put("ui-grid/selectionHeaderCell",'<div>\x3c!-- <div class="ui-grid-vertical-bar">&nbsp;</div> --\x3e<div class="ui-grid-cell-contents" col-index="renderIndex"><ui-grid-selection-select-all-buttons ng-if="grid.options.enableSelectAll" role="checkbox" ng-model="grid.selection.selectAll"></ui-grid-selection-select-all-buttons></div></div>'),e.put("ui-grid/selectionRowHeader",'<div class="ui-grid-cell-contents ui-grid-disable-selection clickable"><ui-grid-selection-row-header-buttons></ui-grid-selection-row-header-buttons></div>'),e.put("ui-grid/selectionRowHeaderButtons",'<div class="ui-grid-selection-row-header-buttons ui-grid-icon-ok clickable" ng-class="{\'ui-grid-row-selected\': row.isSelected}" tabindex="0" ng-click="selectButtonClick(row, $event)" ng-keydown="selectButtonKeyDown(row, $event)" role="checkbox" ng-model="row.isSelected">&nbsp;</div>'),e.put("ui-grid/selectionSelectAllButtons",'<div role="button" tabindex="0" class="ui-grid-selection-row-header-buttons ui-grid-icon-ok" ng-class="{\'ui-grid-all-selected\': grid.selection.selectAll}" ng-click="headerButtonClick($event)" ng-keydown="headerButtonKeyDown($event)"></div>')}]);