AdfDhtmlPivotTablePeer.prototype.handleMouseHeaderSelection=function(a,b){if(this.isSelectionUiEnabled()){var c=this.newHeaderCellIndexWithEdgeFromCell(a.headerContext.cell);this.handleHeaderSelection(c,b)&&(this._headerSelectionDragState=!0,AdfPage.PAGE.startDrag(b,this._selectionDragCallback,this._selectionDropCallback))}};
AdfDhtmlPivotTablePeer.prototype.handleHeaderSelection=function(a,b){if(!this.isSelectionUiEnabled())return!1;var c=!0;if(AdfPivotTableUtils.isMobileTouchDevice()){var c=!1,d=a.edge,e=a.layer;if(this._findElement(AdfAgent.AGENT.getEventTarget(b),"_sorted"))for(var f=this.getSelectionForEdge(d),g=f.length-1;0<=g;--g){var h=f[g];if(this.isRangeIndexPopulated(h)){var l=h.startIndex;if(l.layer==e){var m=a.slice;if(!(l.slice>m)&&(h=h.endIndex,null==h&&(h=l),!(h.slice<m)))return c}}}this.toggleHeaderSelectionAndFocus(a,
!0);f=this.getPivotHandle(d,e);if(null==this._currentPivotHandle||null!=f&&f.id!=this._currentPivotHandle.id)this.hidePivotHandle(),null!=f&&this.showPivotHandle(d,e,f)}else d="keydown"==b.type?b.ctrlKey:this.ctrlEquivalent(b),e=b.shiftKey,!d&&!e?this.selectAndFocusHeaderCell(a):c=!d&&e?this.extendHeaderSelection(a,AdfPivotTableUtils.MAYBE):this.toggleHeaderSelectionAndFocus(a,!1);return c};
AdfDhtmlPivotTablePeer.prototype.handleMouseDatabodySelection=function(a,b){if(this.isSelectionUiEnabled()){var c=this.newDataCellIndexFromCell(a.databodyContext.cell);if(AdfPivotTableUtils.isMobileTouchDevice())if(this.isSelected(c)){var d=this.newDataCellRange(c);this.highlightCellRange(d,AdfPivotTableUtils.DATABODY,AdfDhtmlPivotTablePeer.HIGHLIGHTING_NORMAL);for(var d=this.copySelection(),e=this.getSelectionForEdge(AdfPivotTableUtils.DATABODY,d),f=c.row,c=c.column,g=e.length-1;-1<g;g--){var h=
e[g];if(this.isRangeIndexPopulated(h))if(null==h.endIndex)h.startIndex.column==c&&h.startIndex.row==f&&e.splice(g,1);else{var l=h.startIndex,m=l.row,l=l.column;if(!(m>f||l>c)){var n=this.getEndIndex(h),h=n.row,n=n.column;if(!(h<f||n<c)){var p=[g,1];if(f>m){var q=this.newDataCellIndex(m,l);n>l||1<f-m?(m=this.newDataCellIndex(f-1,n),m=this.newDataCellRange(q,m)):m=this.newDataCellRange(q);p.push(m)}c>l&&(q=this.newDataCellIndex(f,l),1<c-l?(m=this.newDataCellIndex(f,c-1),m=this.newDataCellRange(q,m)):
m=this.newDataCellRange(q),p.push(m));n>c&&(q=this.newDataCellIndex(f,c+1),1<n-c?(m=this.newDataCellIndex(f,n),m=this.newDataCellRange(q,m)):m=this.newDataCellRange(q),p.push(m));h>f&&(q=this.newDataCellIndex(f+1,l),n>l||1<h-f?(m=this.newDataCellIndex(h,n),m=this.newDataCellRange(q,m)):m=this.newDataCellRange(q),p.push(m));Array.prototype.splice.apply(e,p)}}}}null!=this._focusCellIndex&&(this._focusCellIndex.row==f&&this._focusCellIndex.column==c)&&(0!=e.length?(h=e[e.length-1],this.isRangeIndexPopulated(h)?
this.setFocusCell(h.startIndex,null,!0,d):this._focusCellIndex=null):this._focusCellIndex=null);this.displaySelectionInStatusBar(d);this.setSelectionProperty(d)}else this.augmentDatabodySelectionAndFocus(c,!0);else this._databodySelectionDragState=!0,AdfPage.PAGE.startDrag(b,this._selectionDragCallback,this._selectionDropCallback),d=this.ctrlEquivalent(b),e=b.shiftKey,!d&&!e?this.selectAndFocusDataCell(c):!d&&e?this.extendDatabodySelection(c):this.augmentDatabodySelectionAndFocus(c,!1)}};
AdfDhtmlPivotTablePeer.prototype.handleHeaderSelectionDrag=function(a,b){if(this.isSelectionUiEnabled()&&a.headerContext&&a.headerContext.cell){var c=this.newHeaderCellIndexWithEdgeFromCell(a.headerContext.cell),d=c.edge;d===this.getSelectedEdge()&&(AdfAgent.AGENT.getPlatform()==AdfAgent.IE_PLATFORM&&8<=AdfAgent.AGENT.getVersion()||AdfDhtmlPivotTablePeer._setCursor(a.headerContext.cell,this._headerSelectionCursors[d]),d=this.getCurrentRange().startIndex.layer,c.layer==d&&(this._dismissClickToEditIfNeeded(null),
this.extendHeaderSelection(c,!1)))}};
AdfDhtmlPivotTablePeer.prototype.handleDatabodySelectionDrag=function(a,b){if(this.isSelectionUiEnabled())if(a.databodyContext){!b.shiftKey&&!this.ctrlEquivalent(b)&&this._dismissClickToEditIfNeeded(null);var c=this.newDataCellIndexFromCell(a.databodyContext.cell);this.extendDatabodySelection(c)}else a.headerContext&&a.headerContext.cell&&(AdfAgent.AGENT.getPlatform()==AdfAgent.IE_PLATFORM&&8<=AdfAgent.AGENT.getVersion()||AdfDhtmlPivotTablePeer._setCursor(a.headerContext.cell,""))};
AdfDhtmlPivotTablePeer.prototype.handleSelectionDrag=function(a,b,c){b=this._getMouseContext(a);this._headerSelectionDragState?this.handleHeaderSelectionDrag(b,a):this._databodySelectionDragState&&this.handleDatabodySelectionDrag(b,a)};AdfDhtmlPivotTablePeer.prototype.handleSelectionDrop=function(a,b,c){this._databodySelectionDragState=this._headerSelectionDragState=!1};
AdfDhtmlPivotTablePeer.prototype.handleKeyboardNavigation=function(a,b,c){if(this.isSelectionUiEnabled()&&(c||!this.isInEditMode()))c=this._focusCellIndex,null!=c&&(c=this.getEdge(c),this._ptUtils._rightToLeft&&(b==AdfKeyStroke.ARROWLEFT_KEY?b=AdfKeyStroke.ARROWRIGHT_KEY:b==AdfKeyStroke.ARROWRIGHT_KEY&&(b=AdfKeyStroke.ARROWLEFT_KEY)),c==AdfPivotTableUtils.DATABODY?this.handleDatabodyKeyboardNavigation(a,b):this.handleHeaderKeyboardNavigation(a,b))};
AdfDhtmlPivotTablePeer.prototype.handleDatabodyKeyboardNavigation=function(a,b){var c;if(a){if(c=this._selectionFrontier,null==c)return}else{c=this._selectionAnchor;if(null==c)return;c=c.startIndex}var d=c.row,e=c.column;switch(b){case AdfKeyStroke.ARROWLEFT_KEY:0==e?this.handleDatabodyToHeaderNavigation(AdfPivotTableUtils.ROW_EDGE,d,a):e==this._ptUtils._splitSlice[0]?this.jumpToDatabodyPane(0,0,!1,d):(c=this.newDataCellIndex(d,e-1),a?this.extendDatabodySelection(c):this.selectAndFocusDataCell(c),
this.scrollToDataCell(c));break;case AdfKeyStroke.ARROWRIGHT_KEY:e==this._ptUtils._splitSlice[0]-1?this.jumpToDatabodyPane(0,1,!0,d):e+1<this._ptUtils._colExtent?(c=this.newDataCellIndex(d,e+1),a?this.extendDatabodySelection(c):this.selectAndFocusDataCell(c),this.scrollToDataCell(c)):a||(this.selectAndFocusDataCell(c),this.scrollToDataCell(c));break;case AdfKeyStroke.ARROWUP_KEY:0==d?this.handleDatabodyToHeaderNavigation(AdfPivotTableUtils.COLUMN_EDGE,e,a):d==this._ptUtils._splitSlice[1]?this.jumpToDatabodyPane(1,
0,!1,e):(c=this.newDataCellIndex(d-1,e),a?this.extendDatabodySelection(c):this.selectAndFocusDataCell(c),this.scrollToDataCell(c));break;case AdfKeyStroke.ARROWDOWN_KEY:d==this._ptUtils._splitSlice[1]-1?this.jumpToDatabodyPane(1,1,!0,e):d+1<this._ptUtils._rowExtent?(c=this.newDataCellIndex(d+1,e),a?this.extendDatabodySelection(c):this.selectAndFocusDataCell(c),this.scrollToDataCell(c)):a||(this.selectAndFocusDataCell(c),this.scrollToDataCell(c));break;default:AdfAssert.assert(AdfPivotTableUtils.assertsOff,
"unexpected keyCode in handleDatabodyKeyboardNavigation")}};
AdfDhtmlPivotTablePeer.prototype.handleCtrlArrowNavigation=function(a){var b=this._focusCellIndex;if(null!=b){this._ptUtils._rightToLeft&&(a==AdfKeyStroke.ARROWLEFT_KEY?a=AdfKeyStroke.ARROWRIGHT_KEY:a==AdfKeyStroke.ARROWRIGHT_KEY&&(a=AdfKeyStroke.ARROWLEFT_KEY));var c=a==AdfKeyStroke.ARROWRIGHT_KEY||a==AdfKeyStroke.ARROWDOWN_KEY;a=a==AdfKeyStroke.ARROWUP_KEY||a==AdfKeyStroke.ARROWDOWN_KEY?AdfPivotTableUtils.ROW_EDGE:AdfPivotTableUtils.COLUMN_EDGE;var d=this.getEdge(b);if(d==AdfPivotTableUtils.DATABODY){var e;
a?(d=b.column,e=b.row):(d=b.row,e=b.column);var f=this._ptUtils._splitSlice[a];e=e<f?0:1;c?0==e&&this.jumpToDatabodyPane(a,1,c,d):e==this._ptUtils._startPane[a]?this.handleDatabodyToHeaderNavigation(1-a,d,!1):this.jumpToDatabodyPane(a,0,c,d)}else d==a?(f=this._ptUtils._splitSlice[a],e=b.slice,e=e<f?0:1,c?0==e&&this.jumpAmongHeaderPanes(a,1,c,b.layer):e==this._ptUtils._startPane[a]?(a=1-a,d=this._ptUtils._startPane[a],this.jumpAmongHeaderPanes(a,d,!c,b.layer)):this.jumpAmongHeaderPanes(a,0,c,b.layer)):
c&&(d=this._ptUtils._startPane[a],this.jumpToDatabodyPane(a,d,c,b.slice))}};AdfDhtmlPivotTablePeer.prototype.jumpToDatabodyPane=function(a,b,c,d){this.isSelectionUiEnabled()&&(d=this.closestSliceInViewport(1-a,d),a=this.closestVisibleDataCellIndex(a,b,c,d),this.selectAndFocusDataCell(a),!this.preserveEditingBehavior()&&!this._isReadOnly()&&!this._isNavigationMode?this.editCellWithFocus():this.scrollToDataCell(a))};
AdfDhtmlPivotTablePeer.prototype.closestVisibleDataCellIndex=function(a,b,c,d){b=c?this.getViewportStartSlice(a,b):this.getViewportEndSlice(a,b);a?a=b:(a=d,d=b);return this.newDataCellIndex(a,d)};
AdfDhtmlPivotTablePeer.prototype.jumpAmongHeaderPanes=function(a,b,c,d){if(this.isSelectionUiEnabled()&&0!=(a?this._ptUtils._rowLayerCount:this._ptUtils._colLayerCount))d=this.closestLayerInViewport(a,d),b=c?this.getViewportStartSlice(a,b):this.getViewportEndSlice(a,b),a=this.getHeaderCellInfo(a,d,b,!1,!1),this.setFocusCell(a)};
AdfDhtmlPivotTablePeer.prototype.handleDatabodyToHeaderNavigation=function(a,b,c){if(this.isSelectionUiEnabled()){var d=a==AdfPivotTableUtils.COLUMN_EDGE?this._ptUtils._colLayerCount:this._ptUtils._rowLayerCount;if(!c&&0<d){this.highlightSelection(!0);c=this.newSelection();this._selectionFrontier=this._selectionAnchor=null;var d=this.getViewportEndLayer(a),e=this.getHeaderCellInfo(a,d,b,!1,!1);null==e&&(b=this.closestSliceInViewport(a,b),e=this.getHeaderCellInfo(a,d,b,!1,!1));this.setFocusCell(e,
a,!1,c);this._currentLayer=d;this._currentSlice=b;this.displaySelectionInStatusBar(c);this.setSelectionProperty(c)}}};
AdfDhtmlPivotTablePeer.prototype.getNavigationType=function(a,b){if(a==AdfPivotTableUtils.COLUMN_EDGE)switch(b){case AdfKeyStroke.ARROWLEFT_KEY:return AdfDhtmlPivotTablePeer.NAV_SLICE_DECREASE;case AdfKeyStroke.ARROWRIGHT_KEY:return AdfDhtmlPivotTablePeer.NAV_SLICE_INCREASE;case AdfKeyStroke.ARROWUP_KEY:return AdfDhtmlPivotTablePeer.NAV_LAYER_DECREASE;case AdfKeyStroke.ARROWDOWN_KEY:return AdfDhtmlPivotTablePeer.NAV_LAYER_INCREASE;default:AdfAssert.assert(AdfPivotTableUtils.assertsOff,"unexpected keyCode in getNavigationType")}else switch(b){case AdfKeyStroke.ARROWLEFT_KEY:return AdfDhtmlPivotTablePeer.NAV_LAYER_DECREASE;
case AdfKeyStroke.ARROWRIGHT_KEY:return AdfDhtmlPivotTablePeer.NAV_LAYER_INCREASE;case AdfKeyStroke.ARROWUP_KEY:return AdfDhtmlPivotTablePeer.NAV_SLICE_DECREASE;case AdfKeyStroke.ARROWDOWN_KEY:return AdfDhtmlPivotTablePeer.NAV_SLICE_INCREASE;default:AdfAssert.assert(AdfPivotTableUtils.assertsOff,"unexpected keyCode in getNavigationType")}};
AdfDhtmlPivotTablePeer.prototype.handleHeaderKeyboardNavigation=function(a,b){var c=this._focusCellIndex,d=c.edge,e=c.layer,f=c.slice,g,h;switch(this.getNavigationType(d,b)){case AdfDhtmlPivotTablePeer.NAV_LAYER_DECREASE:0!=e&&(g=e-1,h=f,this.overlapsViewport(c)||(g=this.closestLayerInViewport(d,g),h=this.closestSliceInViewport(d,h)),this._currentLayer=g,this._currentSlice=h,c=this.getHeaderCellInfo(d,g,h,!1,!1),e=h<this._ptUtils._splitSlice[d]?0:1,null==c?(c=h<this.getBufferStartSlice(d,e)?-100:
100,this.postponeHandlingHeaderKeyboardNavigation(c,d,g,h,!1,!1,a)):this.finishHandlingHeaderKeyboardNavigation(c,e,a));break;case AdfDhtmlPivotTablePeer.NAV_LAYER_INCREASE:g=this.convertHeaderCellIndexWithEdgeToInfo(c);var l=d?this._ptUtils._rowLayerCount:this._ptUtils._colLayerCount;g=e+(g?c.depth:1);h=f;g>=l?a||(d=1-d,this.jumpToDatabodyPane(d,this._ptUtils._startPane[d],!0,h)):(this.overlapsViewport(c)||(g=this.closestLayerInViewport(d,g),h=this.closestSliceInViewport(d,h)),this._currentLayer=
g,this._currentSlice=h,c=this.getHeaderCellInfo(d,g,h,!1,!1),e=h<this._ptUtils._splitSlice[d]?0:1,null==c?(c=h<this.getBufferStartSlice(d,e)?-100:100,this.postponeHandlingHeaderKeyboardNavigation(c,d,g,h,!1,!1,a)):this.finishHandlingHeaderKeyboardNavigation(c,e,a));break;case AdfDhtmlPivotTablePeer.NAV_SLICE_DECREASE:f==this._ptUtils._splitSlice[d]?this.jumpAmongHeaderPanes(d,0,!1,e):(g=e,h=f-1,this.overlapsViewport(c)||(g=this.closestLayerInViewport(d,g),h=this.closestSliceInViewport(d,h)),-1==h?
this.jumpAmongHeaderPanes(1-d,this._ptUtils._startPane[1-d],!0,g):(this._currentLayer=g,this._currentSlice=h,c=this.getHeaderCellInfo(d,g,h,!1,!1),null==c?this.postponeHandlingHeaderKeyboardNavigation(-100,d,g,h,!1,!1,a):(e=h<this._ptUtils._splitSlice[d]?0:1,this.finishHandlingHeaderKeyboardNavigation(c,e,a))));break;case AdfDhtmlPivotTablePeer.NAV_SLICE_INCREASE:h=(g=this.convertHeaderCellIndexWithEdgeToInfo(c))?c.extent:1;g=e;h=f+h;l=this._ptUtils._splitSlice[d];if(f<l&&h>=l)this.jumpAmongHeaderPanes(d,
1,!0,e);else if(this.overlapsViewport(c)||(g=this.closestLayerInViewport(d,g),h=this.closestSliceInViewport(d,h)),h<(d?this._ptUtils._rowExtent:this._ptUtils._colExtent))this._currentLayer=g,this._currentSlice=h,c=this.getHeaderCellInfo(d,g,h,!1,!1),null==c?this.postponeHandlingHeaderKeyboardNavigation(100,d,g,h,!1,!1,a):(e=h<this._ptUtils._splitSlice[d]?0:1,this.finishHandlingHeaderKeyboardNavigation(c,e,a));break;default:AdfAssert.assert(AdfPivotTableUtils.assertsOff,"unexpected navType in handleHeaderKeyboardNavigation")}};
AdfDhtmlPivotTablePeer.prototype.postponeHandlingHeaderKeyboardNavigation=function(a,b,c,d,e,f,g){e=d<this._ptUtils._splitSlice[b]?0:1;f=this._ptUtils.getScrollPos(b,e);this.__logEnabled&&this.putInTestLog("postponeHandlingHeaderKeyboardNavigation calling setScrollPos("+b+", "+e+", "+(f+a)+", true)");this._ptUtils.setScrollPos(b,e,f+a,!0);this.HandleDomScroll(this._component,null);this._unfinishedHeaderKeyboardNavigation=!0;this._unfinishedNavContext={edge:b,newLayer:c,newSlice:d,isStartLayer:!1,
isStartSlice:!1,extend:g,pane:e}};AdfDhtmlPivotTablePeer.prototype.restartHandlingHeaderKeyboardNavigation=function(){this._unfinishedHeaderKeyboardNavigation=!1;var a=this._unfinishedNavContext,b=this.getHeaderCellInfo(a.edge,a.newLayer,a.newSlice,a.isStartLayer,a.isStartSlice);null!=b&&this.finishHandlingHeaderKeyboardNavigation(b,a.pane,a.extend)};
AdfDhtmlPivotTablePeer.prototype.finishHandlingHeaderKeyboardNavigation=function(a,b,c){c?this.extendHeaderSelection(a,!0):this.setFocusCell(a);this.scrollToHeaderCell(a,b)};AdfDhtmlPivotTablePeer.prototype.setSelectionProperty=function(a){this.getComponent().setProperty(AdfRichPivotTable.__SELECTION_KEY,a);this.selectionChangedSinceLastCmRequest=!0};
AdfDhtmlPivotTablePeer.prototype.getArrivingSelectionString=function(a){a=a.childNodes;for(var b=0;b<a.length;b++){var c=a[b];if(c.id&&-1!=c.id.indexOf(AdfDhtmlPivotTablePeer._SELECTION_DIV_ID))return c.getAttribute("_selection")}AdfLogger.LOGGER.severe("Selection String not found.  This is unexpected.");return null};
AdfDhtmlPivotTablePeer.prototype.initializeSelection=function(a){a=eval(a);this.initializeAnchorAndFrontierCells(a);this.displaySelectionInStatusBar(a);var b=!1;this.containsFocus(this.getDomElement())?b=this.initializeFocusCell(a):this._focusCellNeedsInit=!0;b||this.setSelectionProperty(a)};AdfDhtmlPivotTablePeer.prototype.setUnchangedSelection=function(a){a=eval(a);this.displaySelectionInStatusBar(a);this.setSelectionProperty(a)};
AdfDhtmlPivotTablePeer.prototype.mergeSelection=function(a){var b=eval(a),c=this.getSelectedEdge(b),d=this.getSelectedEdge();if(!(null==c||c!=d)){a=this.copySelection();d=this.getSelectionForEdge(d,a);b=this.getSelectionForEdge(c,b);for(c=0;c<d.length;++c){var e=d[c],f=b[c];if(null==e.startIndex)if(f&&this.cellKeyEquals(f.startKey,e.startKey))e.startIndex=f.startIndex;else for(var g=0;g<b.length;++g){var h=b[g];if(this.cellKeyEquals(h.startKey,e.startKey)){e.startIndex=h.startIndex;break}}else null==
e.startKey&&f&&this.cellIndexEquals(f.startIndex,e.startIndex)&&(e.startKey=f.startKey);null!=e.endIndex&&null==e.endKey&&f&&this.cellIndexEquals(f.endIndex,e.endIndex)&&(e.endKey=f.endKey)}this.displaySelectionInStatusBar(a);this.setSelectionProperty(a)}};
AdfDhtmlPivotTablePeer.prototype.initializeAnchorAndFrontierCells=function(a){var b=this.getSelectedEdge(a);switch(b){case AdfPivotTableUtils.DATABODY:var c=this.getCurrentRange(a),d=c.startIndex,e=this.getEndIndex(c),f=this._selectionAnchor,f=null==f?null:f.startIndex,b=this._selectionFrontier,g=null!=f&&this.getEdge(f)==AdfPivotTableUtils.DATABODY&&null!=b;if(g){a=d.row;var g=e.row,h=d.column,l=e.column,h=f.column==h&&b.column==l||f.column==l&&b.column==h,f=!(f.row==a&&b.row==g||f.row==g&&b.row==
a)||!h}else f=!0;f&&(this.setAnchorCell(d,null,c.startKey),this._selectionFrontier=e);break;case AdfPivotTableUtils.ROW_EDGE:case AdfPivotTableUtils.COLUMN_EDGE:c=this.getCurrentRange(a);d=c.startIndex;e=this.getEndIndex(c);f=this._selectionAnchor;f=null==f?null:f.startIndex;(g=null!=f&&this.getEdge(f)==b)?(g=f.layer==d.layer,e=this._selectionAnchorSelected?f.slice==d.slice||f.slice==e.slice:this.isHeaderCellIndexValid(f)&&!this.isSelected(f,a),f=!g||!e):f=!0;f&&(this.setAnchorCell(d,b,c.startKey),
this._selectionAnchorSelected=!0);break;case null:break;default:AdfAssert.assert(AdfPivotTableUtils.assertsOff,"unexpected selectedEdge in initializeAnchorAndFrontierCells")}};
AdfDhtmlPivotTablePeer.prototype.initializeFocusCell=function(a){var b=this.getSelectedEdge(a),c=!1;null==this._focusCellIndex?null==b?(a=this.getFirstVisibleDataCellIndex(),this.selectAndFocusDataCell(a,!0),c=!0):b==AdfPivotTableUtils.DATABODY?this.setFocusCell(this._selectionAnchor.startIndex,void 0,!0,a):this.setFocusCellToCurrentRangeEndpoint(a,b):null==b?this.getEdge(this._focusCellIndex)==AdfPivotTableUtils.DATABODY?(a=this.getFirstVisibleDataCellIndex(),this.selectAndFocusDataCell(a,!0),c=
!0):this.isHeaderCellIndexValid(this._focusCellIndex)?this.highlightFocusCell(!1,a):(a=this.getFirstVisibleDataCellIndex(),this.selectAndFocusDataCell(a,!0),c=!0):b==AdfPivotTableUtils.DATABODY?this.setFocusCell(this._selectionAnchor.startIndex,void 0,!0,a):this.getEdge(this._focusCellIndex)==AdfPivotTableUtils.DATABODY?this.setFocusCellToCurrentRangeEndpoint(a,b):this.isHeaderCellIndexValid(this._focusCellIndex)?this.highlightFocusCell(!1,a):this.setFocusCellToCurrentRangeEndpoint(a,b);this._focusCellNeedsInit=
!1;return c};AdfDhtmlPivotTablePeer.prototype.setFocusCellToCurrentRangeEndpoint=function(a,b){var c=this.getCurrentRange(a),d=this.getEndIndex(c);this.headerCellIndexEquals(this._selectionAnchor.startIndex,this._selectionAnchor.startIndex.edge,d,b)?this.setFocusCell(c.startIndex,b,!0,a):this.setFocusCell(d,b,!0,a)};
AdfDhtmlPivotTablePeer.prototype.highlightSelection=function(a,b){var c=this.getSelection();this.highlightSetOfCellRanges(c.columnHeaderCells,AdfPivotTableUtils.COLUMN_EDGE,a,b);this.highlightSetOfCellRanges(c.rowHeaderCells,AdfPivotTableUtils.ROW_EDGE,a,b);this.highlightSetOfCellRanges(c.dataCells,AdfPivotTableUtils.DATABODY,a,b)};
AdfDhtmlPivotTablePeer.prototype.highlightSetOfCellRanges=function(a,b,c,d){c=c?AdfDhtmlPivotTablePeer.HIGHLIGHTING_NORMAL:AdfDhtmlPivotTablePeer.HIGHLIGHTING_SELECTED;for(var e=0;e<a.length;++e)this.highlightCellRange(a[e],b,c,!1,d)};
AdfDhtmlPivotTablePeer.prototype.highlightCellRange=function(a,b,c,d,e,f){var g;if(d)switch(c){case AdfDhtmlPivotTablePeer.HIGHLIGHTING_NORMAL:g=!1;break;case AdfDhtmlPivotTablePeer.HIGHLIGHTING_SELECTED:g=!0;break;case AdfDhtmlPivotTablePeer.HIGHLIGHTING_FOCUSED:case AdfDhtmlPivotTablePeer.HIGHLIGHTING_FOCUSED_AND_SELECTED:g=void 0;break;default:AdfAssert.assert(AdfPivotTableUtils.assertsOff,"unexpected highlightType in highlightCellRange")}else g=void 0;var h=b!=AdfPivotTableUtils.DATABODY;d=h&&
e?[]:void 0;a=h?this.getNodesInHeaderCellRange(a,b,g,d,f):this.getNodesInDataCellRange(a,g,e,f);this.highlightCells(a,c,b,d)};
AdfDhtmlPivotTablePeer.prototype.highlightCells=function(a,b,c,d){var e,f,g;switch(b){case AdfDhtmlPivotTablePeer.HIGHLIGHTING_NORMAL:switch(c){case AdfPivotTableUtils.COLUMN_EDGE:e=this._getStyleClass(AdfPivotTableUtils.COLUMN_HEADER_CELL_STYLE);f=this._getStyleClass(AdfPivotTableUtils.COLUMN_HEADER_CELL_SELECTED_STYLE);g=this._getStyleClass(AdfPivotTableUtils.COLUMN_HEADER_CELL_FOCUSED_STYLE);break;case AdfPivotTableUtils.ROW_EDGE:e=this._getStyleClass(AdfPivotTableUtils.ROW_HEADER_CELL_STYLE);
f=this._getStyleClass(AdfPivotTableUtils.ROW_HEADER_CELL_SELECTED_STYLE);g=this._getStyleClass(AdfPivotTableUtils.ROW_HEADER_CELL_FOCUSED_STYLE);break;case AdfPivotTableUtils.DATABODY:e=this._getStyleClass(AdfPivotTableUtils.DATABODY_CELL_STYLE);f=this._getStyleClass(AdfPivotTableUtils.DATABODY_CELL_SELECTED_STYLE);g=this._getStyleClass(AdfPivotTableUtils.DATABODY_CELL_FOCUSED_STYLE);break;default:AdfAssert.assert(AdfPivotTableUtils.assertsOff,"unexpected edge in highlightCells")}break;case AdfDhtmlPivotTablePeer.HIGHLIGHTING_SELECTED:switch(c){case AdfPivotTableUtils.COLUMN_EDGE:e=
this._getStyleClass(AdfPivotTableUtils.COLUMN_HEADER_CELL_SELECTED_STYLE);f=this._getStyleClass(AdfPivotTableUtils.COLUMN_HEADER_CELL_STYLE);g=this._getStyleClass(AdfPivotTableUtils.COLUMN_HEADER_CELL_FOCUSED_STYLE);break;case AdfPivotTableUtils.ROW_EDGE:e=this._getStyleClass(AdfPivotTableUtils.ROW_HEADER_CELL_SELECTED_STYLE);f=this._getStyleClass(AdfPivotTableUtils.ROW_HEADER_CELL_STYLE);g=this._getStyleClass(AdfPivotTableUtils.ROW_HEADER_CELL_FOCUSED_STYLE);break;case AdfPivotTableUtils.DATABODY:e=
this._getStyleClass(AdfPivotTableUtils.DATABODY_CELL_SELECTED_STYLE);f=this._getStyleClass(AdfPivotTableUtils.DATABODY_CELL_STYLE);g=this._getStyleClass(AdfPivotTableUtils.DATABODY_CELL_FOCUSED_STYLE);break;default:AdfAssert.assert(AdfPivotTableUtils.assertsOff,"unexpected edge in highlightCells")}break;case AdfDhtmlPivotTablePeer.HIGHLIGHTING_FOCUSED:case AdfDhtmlPivotTablePeer.HIGHLIGHTING_FOCUSED_AND_SELECTED:switch(c){case AdfPivotTableUtils.COLUMN_EDGE:e=this._getStyleClass(AdfPivotTableUtils.COLUMN_HEADER_CELL_FOCUSED_STYLE);
f=this._getStyleClass(AdfPivotTableUtils.COLUMN_HEADER_CELL_STYLE);g=this._getStyleClass(AdfPivotTableUtils.COLUMN_HEADER_CELL_SELECTED_STYLE);break;case AdfPivotTableUtils.ROW_EDGE:e=this._getStyleClass(AdfPivotTableUtils.ROW_HEADER_CELL_FOCUSED_STYLE);f=this._getStyleClass(AdfPivotTableUtils.ROW_HEADER_CELL_STYLE);g=this._getStyleClass(AdfPivotTableUtils.ROW_HEADER_CELL_SELECTED_STYLE);break;case AdfPivotTableUtils.DATABODY:e=this._getStyleClass(AdfPivotTableUtils.DATABODY_CELL_FOCUSED_STYLE);f=
this._getStyleClass(AdfPivotTableUtils.DATABODY_CELL_STYLE);g=this._getStyleClass(AdfPivotTableUtils.DATABODY_CELL_SELECTED_STYLE);break;default:AdfAssert.assert(AdfPivotTableUtils.assertsOff,"unexpected edge in highlightCells")}break;default:AdfAssert.assert(AdfPivotTableUtils.assertsOff,"unexpected highlightType in highlightCells")}var h;if(c==AdfPivotTableUtils.DATABODY)for(var l=0;l<a.length;++l)h=a[l],AdfDhtmlCommonUtils.removeCSSClassName(h,f),AdfDhtmlCommonUtils.removeCSSClassName(h,g),this.appendCSSClassName(h,
e),this._highlightOneCell(h,b,c);else{for(var m=b==AdfDhtmlPivotTablePeer.HIGHLIGHTING_SELECTED||b==AdfDhtmlPivotTablePeer.HIGHLIGHTING_FOCUSED_AND_SELECTED,n=null!=d,l=0;l<a.length;++l){h=a[l];var p="true"==AdfAgent.AGENT.getAttribute(h,"_selected");(n||p^m)&&this.highlightDataSlices(c,h,!m,n);AdfDhtmlCommonUtils.removeCSSClassName(h,f);AdfDhtmlCommonUtils.removeCSSClassName(h,g);this.appendCSSClassName(h,e);this._highlightOneCell(h,b,c);AdfAgent.AGENT.setAttribute(h,"_selected",String(m))}if(n)for(l=
0;l<d.length;++l)h=d[l],this.highlightDataSlices(c,h,!m,n)}};AdfDhtmlPivotTablePeer.prototype._standardizeColor=function(a){a=a.replace(AdfDhtmlPivotTablePeer._WHITESPACE_REGEXP,"").toUpperCase();if(0==a.indexOf("RGB"))a="rgb"+a.substring(3);else if(0!=a.indexOf("#")){var b=AdfDhtmlPivotTablePeer._NAMED_COLOR_MAP[a];b&&(a=b)}return a};
AdfDhtmlPivotTablePeer.prototype._getHighlightColor=function(a,b,c){var d=-1,e=-1,f=-1;7==a.length&&"#"==a.charAt(0)?(d=parseInt(a.substring(1,3),16),e=parseInt(a.substring(3,5),16),f=parseInt(a.substring(5,7),16)):0==a.indexOf("rgb(")&&(a=a.match(AdfDhtmlPivotTablePeer._DIGIT_REGEXP),null!=a&&2<a.length&&(d=a[0]-0,e=a[1]-0,f=a[2]-0));if(0<=d&&0<=e&&0<=f&&256>d&&256>e&&256>f){if(c==AdfPivotTableUtils.DATABODY&&255==d&&255==e&&255==f)return"";var g;c==AdfPivotTableUtils.DATABODY?b==AdfDhtmlPivotTablePeer.HIGHLIGHTING_FOCUSED||
b==AdfDhtmlPivotTablePeer.HIGHLIGHTING_FOCUSED_AND_SELECTED?g=0.9:b==AdfDhtmlPivotTablePeer.HIGHLIGHTING_SELECTED&&(g=0.8):b==AdfDhtmlPivotTablePeer.HIGHLIGHTING_FOCUSED||b==AdfDhtmlPivotTablePeer.HIGHLIGHTING_FOCUSED_AND_SELECTED?g=0.5:b==AdfDhtmlPivotTablePeer.HIGHLIGHTING_SELECTED&&(g=0.8);0==f&&(0==d&&0==e)&&(d=e=f=200);d=Math.round(d*g);e=Math.round(e*g);f=Math.round(f*g);75>f&&75>d&&75>e?(f+=100*g,d+=100*g):30>d+e&&(d+=100*g);b=d.toString(16).toUpperCase();1==b.length&&(b="0"+b);e=e.toString(16).toUpperCase();
1==e.length&&(e="0"+e);f=f.toString(16).toUpperCase();1==f.length&&(f="0"+f);return"#"+b+e+f}return null};AdfDhtmlPivotTablePeer.prototype._isBackgroundColorSpecialCase=function(a){var b=a[AdfDhtmlPivotTablePeer.BACKGROUND_COLOR_NEEDS_RESTORING];null==b&&(b=AdfAgent.AGENT.getAttribute(a,AdfDhtmlPivotTablePeer.BACKGROUND_COLOR_NEEDS_RESTORING));return null!=b};
AdfDhtmlPivotTablePeer.prototype._highlightOneCell=function(a,b,c){if(!(null==a||null==a.style||null==a.style.backgroundColor||""==a.style.backgroundColor&&!this._isBackgroundColorSpecialCase(a))){var d=a[AdfDhtmlPivotTablePeer.ORIGINAL_COLOR];null==d&&(d=AdfAgent.AGENT.getAttribute(a,AdfDhtmlPivotTablePeer.ORIGINAL_COLOR));null==d&&(d=this._standardizeColor(a.style.backgroundColor),a[AdfDhtmlPivotTablePeer.ORIGINAL_COLOR]=d);b=b==AdfDhtmlPivotTablePeer.HIGHLIGHTING_NORMAL?d:this._getHighlightColor(d,
b,c);null!=b&&(a.style.backgroundColor=b,""==b&&(a[AdfDhtmlPivotTablePeer.BACKGROUND_COLOR_NEEDS_RESTORING]="t"))}};AdfDhtmlPivotTablePeer.prototype.highlightDataSlices=function(a,b,c,d){var e=this.getHeaderNodeStartSlice(b,a);for(b=e+(a?b.rowSpan:b.colSpan);e<b;e++)this.highlightDataSlice(a,e,c,d)};
AdfDhtmlPivotTablePeer.prototype.highlightDataSlice=function(a,b,c,d){var e,f,g;c?(c=this._getStyleClass(AdfPivotTableUtils.DATABODY_CELL_STYLE),e=this._getStyleClass(AdfPivotTableUtils.DATABODY_CELL_SELECTED_STYLE),f=this._getStyleClass(AdfPivotTableUtils.DATABODY_CELL_FOCUSED_STYLE),g=AdfDhtmlPivotTablePeer.HIGHLIGHTING_NORMAL):(c=this._getStyleClass(AdfPivotTableUtils.DATABODY_CELL_SELECTED_STYLE),e=this._getStyleClass(AdfPivotTableUtils.DATABODY_CELL_STYLE),f=this._getStyleClass(AdfPivotTableUtils.DATABODY_CELL_FOCUSED_STYLE),
g=AdfDhtmlPivotTablePeer.HIGHLIGHTING_SELECTED);for(var h=b<this._ptUtils._splitSlice[a]?0:1,l=this._ptUtils._startPane[1-a];2>l;++l)for(var m=a?this._ptUtils._databodyBuffers[h][l]:this._ptUtils._databodyBuffers[l][h],n=m.length,p=0;p<n;p++)for(var q=m[p].length,r=0;r<q;r++){var v=m[p][r];if(v&&(!d||v._new)){var u=v.childNodes[0],w=u.rows.length-1,y=u.rows[0].cells.length-1,t;a?(v=AdfAgent.AGENT.getIntAttribute(v,"_startRow"),t=w):(v=AdfAgent.AGENT.getIntAttribute(v,"_startCol"),t=y);if(b>=v&&b<
v+t)if(v=b-v,a){w=u.rows[v+1];for(v=0;v<y;v++)u=w.cells[v+1],AdfDhtmlCommonUtils.removeCSSClassName(u,e),AdfDhtmlCommonUtils.removeCSSClassName(u,f),this.appendCSSClassName(u,c),this._highlightOneCell(u,g,AdfPivotTableUtils.DATABODY)}else{y=u.rows;for(t=0;t<w;t++)u=y[t+1].cells[v+1],AdfDhtmlCommonUtils.removeCSSClassName(u,e),AdfDhtmlCommonUtils.removeCSSClassName(u,f),this.appendCSSClassName(u,c),this._highlightOneCell(u,g,AdfPivotTableUtils.DATABODY)}}}};
AdfDhtmlPivotTablePeer.prototype.highlightFocusCell=function(a,b){if(a||this.containsFocus(this.getDomElement())){var c=this._focusCellIndex;if(null!=c){if(this.isHeaderCellIndex(c))var d=this.newHeaderCellRange(c),d=this.getNodesInHeaderCellRange(d,c.edge),e=c.edge;else d=this.newDataCellRange(c),d=this.getNodesInDataCellRange(d),e=AdfPivotTableUtils.DATABODY;highlightType=a?this.isSelected(c,b)?AdfDhtmlPivotTablePeer.HIGHLIGHTING_SELECTED:AdfDhtmlPivotTablePeer.HIGHLIGHTING_NORMAL:this.isSelected(c,
b)?AdfDhtmlPivotTablePeer.HIGHLIGHTING_FOCUSED_AND_SELECTED:AdfDhtmlPivotTablePeer.HIGHLIGHTING_FOCUSED;this.highlightCells(d,highlightType,e)}}};AdfDhtmlPivotTablePeer.prototype.selectAndFocusHeaderCell=function(a){this.highlightSelection(!0);var b=this.newSelection(),c=this.newHeaderCellRange(a);this.getSelectionForEdge(a.edge,b).push(c);this.setAnchorCell(a);this._selectionAnchorSelected=!0;this.setFocusCell(a,null,!1,b);this.displaySelectionInStatusBar(b);this.setSelectionProperty(b)};
AdfDhtmlPivotTablePeer.prototype.extendHeaderSelection=function(a,b){var c=!0,d=!0,e=this._selectionAnchor;if(null==e)d=c=!1;else{var f=e.startIndex,g=this.getEdge(f);if(g!=a.edge||f.layer!=a.layer)d=c=!1}if(c){var h=this.newHeaderCellRange(f,a,e.startKey,null,!0),e=this.getSelectionForEdge(g),l;0<e.length&&this._selectionAnchorSelected&&(l=e[e.length-1],e=l.endIndex?h.endIndex&&l.endIndex.slice==h.endIndex.slice:null==h.endIndex,l.startIndex.slice==h.startIndex.slice&&e&&(d=!1))}if(d){var m=this.copySelection(),
e=this.getSelectionForEdge(g,m);l&&(l=e.pop());e.push(h);this._selectionAnchorSelected=!0;l&&this.highlightCellRange(l,g,AdfDhtmlPivotTablePeer.HIGHLIGHTING_NORMAL,!0,void 0,m);this.highlightCellRange(h,g,AdfDhtmlPivotTablePeer.HIGHLIGHTING_SELECTED,!1,void 0,m)}!0===b||b===AdfPivotTableUtils.MAYBE&&c?this.setFocusCell(a,null,!1,m):d&&this.highlightFocusCell(!1,m);d&&(this.displaySelectionInStatusBar(m),this.setSelectionProperty(m));return c};
AdfDhtmlPivotTablePeer.prototype.extendDatabodySelection=function(a){var b=this._selectionAnchor;if(null!=b){var c=b.startIndex;if(this.getEdge(c)==AdfPivotTableUtils.DATABODY){var b=this.newDataCellRange(c,a,b.startKey,null,!0),d=this.getSelectionForEdge(AdfPivotTableUtils.DATABODY),c=d[d.length-1],d=c.endIndex?b.endIndex&&c.endIndex.row==b.endIndex.row&&c.endIndex.column==b.endIndex.column:null==b.endIndex;if(!(c.startIndex.row==b.startIndex.row&&c.startIndex.column==b.startIndex.column)||!d){var e=
this.copySelection(),d=this.getSelectionForEdge(AdfPivotTableUtils.DATABODY,e),c=d.pop();d.push(b);this.highlightCellRange(c,AdfPivotTableUtils.DATABODY,AdfDhtmlPivotTablePeer.HIGHLIGHTING_NORMAL,!0,void 0,e);this.highlightCellRange(b,AdfPivotTableUtils.DATABODY,AdfDhtmlPivotTablePeer.HIGHLIGHTING_SELECTED,!1,void 0,e);this.highlightFocusCell(!1,e);this._selectionFrontier=a;this.displaySelectionInStatusBar(e);this.setSelectionProperty(e)}}}};
AdfDhtmlPivotTablePeer.prototype.toggleHeaderSelectionAndFocus=function(a,b){var c=a.edge,d=this.getSelectedEdge(),e=null==d||d==c&&this.getLayerOfSelection()==a.layer;b?(d=!0,e=!e):(d=e,e=!1);if(d){e?(this.highlightSelection(!0),d=this.newSelection()):d=this.copySelection();this.setAnchorCell(a);if(e=this.removeHeaderCellFromSelection(a,d))this._selectionAnchorSelected=!1;else{var f=this.newHeaderCellRange(a);this.getSelectionForEdge(c,d).push(f);this._selectionAnchorSelected=!0}this.setFocusCell(a,
null,!1,d);this.displaySelectionInStatusBar(d);this.setSelectionProperty(d);return!e}return!1};
AdfDhtmlPivotTablePeer.prototype.removeHeaderCellFromSelection=function(a,b){for(var c=a.edge,d=a.layer,e=a.slice,f=this.getSelectionForEdge(c,b),g=!1,h=f.length-1;0<=h;--h){var l=f[h];if(this.isRangeIndexPopulated(l)){var m=l.startIndex;if(m.layer==d&&!(m.slice>e)){var n=l.endIndex;null==n&&(n=m);if(!(n.slice<e))if(g=!0,n=l.endIndex,null==n)f.splice(h,1);else if(m.slice==e){this.convertHeaderCellIndexWithEdgeToInfo(a);var p=this.walkLayer(c,d,e+a.extent,!0);if(null==p)break;f[h]=this.newHeaderCellRange(p,
n,null,l.endKey)}else if(n.slice==e){var q=this.walkLayer(c,d,e-1,!1);if(null==q)break;f[h]=this.newHeaderCellRange(m,q,l.startKey,null)}else{q=this.walkLayer(c,d,e-1,!1);if(null==q)break;this.convertHeaderCellIndexWithEdgeToInfo(a);p=this.walkLayer(c,d,e+a.extent,!0);if(null==p)break;f[h]=this.newHeaderCellRange(m,q,l.startKey,null);l=this.newHeaderCellRange(p,n,null,l.endKey);f.splice(h+1,0,l)}}}}return g};
AdfDhtmlPivotTablePeer.prototype.walkLayer=function(a,b,c,d){for(;;){var e=this.getHeaderCellInfo(a,b,c,!1,d);if(null==e)break;else if(e.layer==b)break;else c=d?c+e.extent:e.slice-1}return e};
AdfDhtmlPivotTablePeer.prototype.augmentDatabodySelectionAndFocus=function(a,b){var c=this.getSelection(),d=0==c.columnHeaderCells.length&&0==c.rowHeaderCells.length;b?(c=!0,d=!d):(c=d,d=!1);c&&(d?(this.highlightSelection(!0),c=this.newSelection()):c=this.copySelection(),d=this.newDataCellRange(a),c.dataCells.push(d),this.setFocusCell(a,null,!1,c),this._selectionAnchor=this.newDataCellRange(a),this._selectionFrontier=a,this.displaySelectionInStatusBar(c),this.setSelectionProperty(c))};
AdfDhtmlPivotTablePeer.prototype.selectAndFocusDataCell=function(a,b){this.highlightSelection(!0);var c=this.newSelection(),d=this.newDataCellRange(a);this.getSelectionForEdge(AdfPivotTableUtils.DATABODY,c).push(d);this._selectionAnchor=this.newDataCellRange(a);this._selectionFrontier=a;this.setFocusCell(a,void 0,b,c);this.displaySelectionInStatusBar(c);this.setSelectionProperty(c)};
AdfDhtmlPivotTablePeer.prototype.setFocusCell=function(a,b,c,d){!c&&null!=this._focusCellIndex&&this.highlightFocusCell(!0,d);this.isHeaderCellIndex(a)&&null==a.edge&&(a.edge=b);this._focusCellIndex=a;this.highlightFocusCell(!1,d);this._setLabelledBy(a)};
AdfDhtmlPivotTablePeer.prototype._setLabelledBy=function(a,b,c){var d={startIndex:a},e="";if(this.isHeaderCellIndex(a)){edge=a.edge;b=b||this.getNodesInHeaderCellRange(d,edge)[0];if(!b)return;var d=a.layer+1,f=a.slice,e=e+this._buildLabelledBy(edge,d,f);a=b.getAttribute("id")}else{b=b||this.getNodesInDataCellRange(d)[0];if(!b)return;for(edge=1;0<=edge;--edge)d=this._ptUtils._layerCount[edge],f=edge?a.row:a.column,e+=this._buildLabelledBy(edge,d,f);a=b.getAttribute("id");e+=a}AdfAgent.AGENT.setAttribute(b,
"aria-labelledby",e);AdfAgent.AGENT.setAttribute(this._ptUtils._container,"aria-activedescendant",a);c=c||this._getInputElementsInNode(b);for(b=0;b<c.length;++b)AdfAgent.AGENT.setAttribute(c[b],"aria-labelledby",e)};AdfDhtmlPivotTablePeer.prototype._buildLabelledBy=function(a,b,c){for(var d="",e=0;e<b;){var f=this.getHeaderCellInfo(a,e,c,!0,e==b-1,!0);if(null==f)return"";d+=f.cell.getAttribute("id");d+=" ";e+=f.depth}return d};
AdfDhtmlPivotTablePeer.prototype.setAnchorCell=function(a,b,c){var d=this.isHeaderCellIndex(a);d&&null==a.edge&&(a.edge=b);this._selectionAnchor=d?this.newHeaderCellRange(a,null,c,null):this.newDataCellRange(a,null,c,null,!1)};AdfDhtmlPivotTablePeer.prototype.displaySelectionInStatusBar=function(a){this.setStatusBarText(this.getSelectionStringsForStatusBar(a))};
AdfDhtmlPivotTablePeer.prototype.setStatusBarText=function(a){if(this._ptUtils._hasStatusBar){var b=this._ptUtils._statusBar.childNodes,c=b[0],b=b[1],d=a[0];a=a[1];""==d&&(d="\u00a0");""==a&&(a="\u00a0");AdfAgent.AGENT.setTextContent(c,d);AdfAgent.AGENT.setTextContent(b,a)}};
AdfDhtmlPivotTablePeer.prototype.getSelectionStringsForStatusBar=function(a){if(!this._ptUtils._hasStatusBar)return"";var b=this.getSelectedEdge(a);switch(b){case null:return["",""];case AdfPivotTableUtils.DATABODY:return a=this.getSelectionForEdge(b,a),a=this.getCellCountOfDataCellRanges(a),-1==a?[this._cellSelected,this._multiple]:[this._cellSelected,a];case AdfPivotTableUtils.COLUMN_EDGE:return a=this.getSelectionForEdge(b,a),a=this.getSliceCountOfHeaderCellRanges(a),-1==a?[this._colSelected,this._multiple]:
[this._colSelected,a];case AdfPivotTableUtils.ROW_EDGE:return a=this.getSelectionForEdge(b,a),a=this.getSliceCountOfHeaderCellRanges(a),-1==a?[this._rowSelected,this._multiple]:[this._rowSelected,a];default:AdfAssert.assert(AdfPivotTableUtils.assertsOff,"unexpected edge in getSelectionStringsForStatusBar")}};
AdfDhtmlPivotTablePeer.prototype.scrollToHeaderCell=function(a,b){var c=a.edge,d=a.slice,e=this.getBufferStartSlice(c,b),f=this.getBufferEndSlice(c,b);if(d>=f)e=30;else{var g=this.convertHeaderCellIndexWithEdgeToInfo(a)?a.extent:1,g=d+g;if(g<=e)e=-30;else if(d=Math.max(d,e),g=Math.min(g,f),f=this.getSlicePosition(c,b,d),e=f.position,g==d+1?(d=f.size,g=e+d):(f=this.getSlicePosition(c,b,g),g=f.position,d=g-e),f=this._ptUtils._databodyScrollersByEdgeAndPane[c][b],f=c?f._usableHeight:f._usableWidth,d<=
f){if(!(0>e))if(g>f)e=g-f;else return}else if(g<f)e=g-f;else if(!(0<e))return}d=this._ptUtils.getScrollPos(c,b);this.__logEnabled&&this.putInTestLog("scrollToHeaderCell calling setScrollPos("+c+", "+b+", "+(d+e)+", true)");this._ptUtils.setScrollPos(c,b,d+e,!0);this.HandleDomScroll(this._component,null)};
AdfDhtmlPivotTablePeer.prototype.scrollToDataCell=function(a){var b=this.getScrollDelta(AdfPivotTableUtils.COLUMN_EDGE,a.column),c=this.getScrollDelta(AdfPivotTableUtils.ROW_EDGE,a.row),d=a.row<this._ptUtils._splitSlice[1]?0:1,e=a.column<this._ptUtils._splitSlice[0]?0:1;if(0!=b){var f=this._ptUtils.getScrollPos(AdfPivotTableUtils.COLUMN_EDGE,e);this.__logEnabled&&this.putInTestLog("scrollToDataCell calling setScrollPos(0, "+e+", "+(f+b)+", true)");this._ptUtils.setScrollPos(AdfPivotTableUtils.COLUMN_EDGE,
e,f+b,!0)}0!=c&&(e=this._ptUtils.getScrollPos(AdfPivotTableUtils.ROW_EDGE,d),this.__logEnabled&&this.putInTestLog("scrollToDataCell calling setScrollPos(1, "+d+", "+(e+c)+", true)"),this._ptUtils.setScrollPos(AdfPivotTableUtils.ROW_EDGE,d,e+c,!0));this._ptUtils._horizScrollOutOfBlock=this.isScrollOutOfBlock(AdfPivotTableUtils.COLUMN_EDGE,a.column);this._ptUtils._vertScrollOutOfBlock=this.isScrollOutOfBlock(AdfPivotTableUtils.ROW_EDGE,a.row);(0!=b||0!=c)&&this.HandleDomScroll(this._component,null)};
AdfDhtmlPivotTablePeer.prototype.newSelection=function(){return{columnHeaderCells:[],rowHeaderCells:[],dataCells:[]}};AdfDhtmlPivotTablePeer.prototype.copySelection=function(){return this.deepCopy(this.getSelection())};AdfDhtmlPivotTablePeer.prototype.newHeaderCellRange=function(a,b,c,d,e){null!=b&&a.slice==b.slice&&(b=null);null==b&&(null==c&&null!=d&&(c=d),endkey=null);e&&(b&&b.slice<a.slice)&&(e=a,a=b,b=e,e=c,c=d,d=e);return{startKey:c,endKey:d,startIndex:a,endIndex:b}};
AdfDhtmlPivotTablePeer.prototype.newHeaderCellIndexWithEdge=function(a,b,c,d){return{edge:a,layer:b,slice:c,extent:d}};
AdfDhtmlPivotTablePeer.prototype.newDataCellRange=function(a,b,c,d,e){null!=b&&this.dataCellIndexEquals(a,b)&&(b=null);null==b&&(null==c&&null!=d&&(c=d),endkey=null);if(e&&b){var f,g,h,l,m;a.row<b.row?(e=a.row,h=null==c?null:c.rowKey,f=b.row,l=null==d?null:d.rowKey):(e=b.row,h=null==d?null:d.rowKey,f=a.row,l=null==c?null:c.rowKey);a.column<b.column?(g=a.column,m=null==c?null:c.columnKey,b=b.column,d=null==d?null:d.columnKey):(g=b.column,m=null==d?null:d.columnKey,b=a.column,d=null==c?null:c.columnKey);
a=this.newDataCellIndex(e,g);b=this.newDataCellIndex(f,b);c=h&&m?this.newDataCellKey(h,m):null;d=l&&d?this.newDataCellKey(l,d):null}return{startKey:c,endKey:d,startIndex:a,endIndex:b}};AdfDhtmlPivotTablePeer.prototype.newDataCellIndex=function(a,b){return{row:a,column:b}};AdfDhtmlPivotTablePeer.prototype.newDataCellKey=function(a,b){return{rowKey:a,columnKey:b}};
AdfDhtmlPivotTablePeer.prototype.newHeaderCellIndexWithEdgeFromCell=function(a){var b=this.getHeaderCellCoordinates(a),c=Number(b.edge);a=this.getMemberExtent(c,a,b);return this.newHeaderCellIndexWithEdge(c,Number(b.startLayer),Number(b.startSlice),a)};
AdfDhtmlPivotTablePeer.prototype.getHeaderCellCoordinates=function(a){a=AdfAgent.AGENT.getAttribute(a,"_coords");if(void 0!=a)return a=a.split(":"),4==a.length?{edge:a[0],startLayer:a[1],startSlice:a[2],extent:a[3]}:{edge:a[0],startLayer:a[1],startSlice:a[2],extent:null}};AdfDhtmlPivotTablePeer.prototype.newDataCellIndexFromCell=function(a){a=this.getCoordinates(a);return this.newDataCellIndex(a.row,a.col)};
AdfDhtmlPivotTablePeer.prototype.isSelectionUiEnabled=function(){return this._currentRequest!=AdfDhtmlPivotTablePeer.PARTIAL};AdfDhtmlPivotTablePeer.prototype.getSelection=function(){var a=this.getComponent().getProperty(AdfRichPivotTable.__SELECTION_KEY);null==a&&(a=this.newSelection(),this.setSelectionProperty(a));return a};AdfDhtmlPivotTablePeer.prototype.isHeaderCellKey=function(a){return null==a.rowKey};AdfDhtmlPivotTablePeer.prototype.isHeaderCellIndex=function(a){return null==a.row};
AdfDhtmlPivotTablePeer.prototype.cellKeyEquals=function(a,b){return null==a||null==b?!1:this.isHeaderCellKey(a)?this.isHeaderCellKey(b)?this.headerCellKeyEquals(a,b):!1:this.isHeaderCellKey(b)?!1:this.dataCellKeyEquals(a,b)};AdfDhtmlPivotTablePeer.prototype.headerCellKeyEquals=function(a,b){if(null==a||null==b||a.length!=b.length)return!1;for(var c=0;c<a.length;++c)if(a[c]!=b[c])return!1;return!0};
AdfDhtmlPivotTablePeer.prototype.dataCellKeyEquals=function(a,b){return null==a||null==b?!1:this.headerCellKeyEquals(a.rowKey,b.rowKey)&&this.headerCellKeyEquals(a.columnKey,b.columnKey)};AdfDhtmlPivotTablePeer.prototype.cellIndexEquals=function(a,b){return null==a||null==b?!1:a.layer==b.layer&&a.slice==b.slice&&a.row==b.row&&a.column==b.column};AdfDhtmlPivotTablePeer.prototype.headerCellIndexEquals=function(a,b,c,d){return null!=a&&null!=c&&b==d&&a.layer==c.layer&&a.slice==c.slice};
AdfDhtmlPivotTablePeer.prototype.dataCellIndexEquals=function(a,b){return null!=a&&null!=b&&a.row==b.row&&a.column==b.column};AdfDhtmlPivotTablePeer.prototype.getEndIndex=function(a){return null==a.endIndex?a.startIndex:a.endIndex};AdfDhtmlPivotTablePeer.prototype.getEdge=function(a){a=a.edge;void 0===a&&(a=AdfPivotTableUtils.DATABODY);return a};
AdfDhtmlPivotTablePeer.prototype.isHeaderCellIndexValid=function(a,b){var c=void 0==a.edge?b:a.edge,d=a.layer,e=a.slice,f=c?this._ptUtils._rowLayerCount:this._ptUtils._colLayerCount;if(0>d||d>=f)return!1;c=this.getHeaderCellInfo(c,d,e,!1,!1);return null!=c&&c.layer==d&&c.slice==e};AdfDhtmlPivotTablePeer.prototype.getCellCountOfDataCellRange=function(a){if(!this.isRangeIndexPopulated(a))return 1;var b=a.startIndex;a=this.getEndIndex(a);return(a.row-b.row+1)*(a.column-b.column+1)};
AdfDhtmlPivotTablePeer.prototype.getCellCountOfDataCellRanges=function(a){if(2<a.length)return-1;for(var b=0,c=0;c<a.length;++c)b+=this.getCellCountOfDataCellRange(a[c]);if(2==a.length){if(-1==this.getOverlappingCellCount(a[0],a[1]))return-1;b-=this.getOverlappingCellCount(a[0],a[1])}return b};
AdfDhtmlPivotTablePeer.prototype.getOverlappingCellCount=function(a,b){if(!this.isRangeIndexPopulated(a)||!this.isRangeIndexPopulated(b))return-1;var c=a.startIndex,d=this.getEndIndex(a),e=b.startIndex,f=this.getEndIndex(b),g=Math.max(c.row,e.row),c=Math.max(c.column,e.column),e=Math.min(d.row,f.row),d=Math.min(d.column,f.column),g=Math.max(0,e-g+1),d=Math.max(0,d-c+1);return g*d};
AdfDhtmlPivotTablePeer.prototype.getSliceCountOfHeaderCellRange=function(a){if(!this.isRangeIndexPopulated(a))return-1;var b=a.startIndex;a=this.getEndIndex(a);return a.slice+a.extent-b.slice};AdfDhtmlPivotTablePeer.prototype.getSliceCountOfHeaderCellRanges=function(a){if(2<a.length)return-1;for(var b=0,c=0;c<a.length;++c){var d=this.getSliceCountOfHeaderCellRange(a[c]);if(-1==d)return-1;b+=d}if(2==a.length){a=this.getOverlappingSliceCount(a[0],a[1]);if(-1==a)return-1;b-=a}return b};
AdfDhtmlPivotTablePeer.prototype.getOverlappingSliceCount=function(a,b){if(!this.isRangeIndexPopulated(a)||!this.isRangeIndexPopulated(b))return-1;var c=a.startIndex,d=this.getEndIndex(a),e=b.startIndex,f=this.getEndIndex(b),d=d.slice+d.extent,f=f.slice+f.extent,c=Math.max(c.slice,e.slice),e=Math.min(d,f);return Math.max(0,e-c)};
AdfDhtmlPivotTablePeer.prototype.isSelected=function(a,b){if(this.isHeaderCellIndex(a))for(var c=a.layer,d=a.slice,e=this.getSelectionForEdge(a.edge,b),f=0;f<e.length;++f){var g=e[f];if(this.isRangeIndexPopulated(g)){var h=g.startIndex;if(h.layer==c&&!(h.slice>d)&&(g=this.getEndIndex(g),!(g.slice<d)))return!0}}else{c=a.row;d=a.column;e=this.getSelectionForEdge(AdfPivotTableUtils.DATABODY,b);for(f=0;f<e.length;++f)if(g=e[f],this.isRangeIndexPopulated(g)&&(h=g.startIndex,!(h.row>c||h.column>d)))if(g=
this.getEndIndex(g),!(g.row<c||g.column<d))return!0}return!1};
AdfDhtmlPivotTablePeer.prototype.isInHeaderSelection=function(a,b,c){if(void 0==b)return(b=this.isInHeaderSelection(a,AdfPivotTableUtils.COLUMN_EDGE,c))?!0:(c=this.isInHeaderSelection(a,AdfPivotTableUtils.ROW_EDGE,c))?!0:!1==b&&!1==c?!1:null;a=b?a.row:a.column;for(var d=this.getSelectionForEdge(b),e=!1,f=-42,g=0;g<d.length;++g){var h=d[g];if(this.isRangeIndexPopulated(h)){var l=h.startIndex;if(!(l.slice>a)){var m=this.getEndIndex(h);if(!(m.slice+m.extent-1<a)){if(!this.isSingleCellRange(h))if(h=l.layer,
-42==f&&(f=this.getMemberStartLayer(b,h,a)),null==f){e=null;continue}else if(f!=h)continue;return!0}}}else c||(e=null)}return e};AdfDhtmlPivotTablePeer.prototype.getMemberStartLayer=function(a,b,c){a=this.getHeaderCellInfo(a,b,c);return null!=a?a.layer:null};AdfDhtmlPivotTablePeer.prototype.getNodesInHeaderCellRange=function(a,b,c,d,e){for(var f=[],g=this._ptUtils._startPane[b];2>g;++g)this.getNodesInHeaderCellRange2(a,b,c,d,f,g,e);return f};
AdfDhtmlPivotTablePeer.prototype.getNodesInHeaderCellRange2=function(a,b,c,d,e,f,g){var h;if(this.isRangeIndexPopulated(a)){var l=!0===c;c=!1===c;var m=!l&&!c,n=a.startIndex,p=n.layer,n=n.slice;a=this.getEndIndex(a).slice;f=this._ptUtils._buffers2[b][f];var q=!1;if(b==AdfPivotTableUtils.COLUMN_EDGE)for(var r=0,v=f.length;r<v;++r){var u=f[r];if(!q){h=AdfAgent.AGENT.getIntAttribute(u,"_startSlice");var w=AdfAgent.AGENT.getIntAttribute(u,"_numSlices");h+=w;if(h<=n)continue}h=null!=d&&!u._new?d:e;for(var y=
u.firstChild.firstChild.rows,t=y[p+1],y=t.cells,u=1,w=y.length;u<w;++u){var t=y[u],A=this.getHeaderCellCoordinates(t),D=Number(A.startSlice);if(a<D)return;if(n<=D&&(m||l&&this.isSelected(this.newHeaderCellIndexWithEdge(b,p,D,0),g)||c&&!this.isSelected(this.newHeaderCellIndexWithEdge(b,p,D,0),g)))h.push(t),q=!0}}else{r=0;for(v=f.length;r<v;++r){u=f[r];if(!q&&(h=AdfAgent.AGENT.getIntAttribute(u,"_startSlice"),w=AdfAgent.AGENT.getIntAttribute(u,"_numSlices"),h+=w,h<=n))continue;h=null!=d&&!u._new?d:
e;y=u.firstChild.firstChild.rows;u=1;for(w=y.length;u<w;){t=y[u];t=this.getCellSpanningLayer(t,p);if(!t)return;A=this.getHeaderCellCoordinates(t);D=Number(A.startSlice);if(a<D)return;if(n<=D&&p==Number(A.startLayer)&&(m||l&&this.isSelected(this.newHeaderCellIndexWithEdge(b,p,D,0),g)||c&&!this.isSelected(this.newHeaderCellIndexWithEdge(b,p,D,0),g)))h.push(t),q=!0;u+=t.rowSpan}}}}};
AdfDhtmlPivotTablePeer.prototype.getNodesInDataCellRange=function(a,b,c,d){for(var e=[],f=this._ptUtils._startPane[1];2>f;++f)for(var g=this._ptUtils._startPane[0];2>g;++g)this.getNodesInDataCellRange2(a,b,c,e,f,g,d);return e};
AdfDhtmlPivotTablePeer.prototype.getNodesInDataCellRange2=function(a,b,c,d,e,f,g){if(this.isRangeIndexPopulated(a)){var h=!0===b;b=!1===b;var l=!h&&!b,m=!0===c;c=!1===c;var n=a.startIndex,p=n.row,n=n.column,q=this.getEndIndex(a);a=q.row+1;var q=q.column+1,r=this._ptUtils._colHeaderBuffers[f],v=AdfAgent.AGENT.getIntAttribute(r[0],"_startSlice");if(!(q<=v)){var u=r[r.length-1],v=AdfAgent.AGENT.getIntAttribute(u,"_startSlice"),u=AdfAgent.AGENT.getIntAttribute(u,"_numSlices");if(!(v+u<=n)){for(var v=
0,u=r.length,w=0,y=r.length;w<y;++w){var t=r[w],A=AdfAgent.AGENT.getIntAttribute(t,"_startSlice"),D=AdfAgent.AGENT.getIntAttribute(t,"_numSlices"),C=A+D;A<=n&&n<C&&(v=w);if(A<q&&q<=C){u=w+1;break}}y=this._ptUtils._rowHeaderBuffers[e];e=this._ptUtils._databodyBuffers[e][f];f=0;for(C=y.length;f<C;++f){var w=y[f],z=AdfAgent.AGENT.getIntAttribute(w,"_startSlice"),w=AdfAgent.AGENT.getIntAttribute(w,"_numSlices");if(!(z+w<=p)){if(a<=z)break;for(var x=Math.max(1,p-z+1),E=Math.min(w+1,a-z+1),F=e[f],w=v;w<
u;++w){var t=r[w],A=AdfAgent.AGENT.getIntAttribute(t,"_startSlice"),D=AdfAgent.AGENT.getIntAttribute(t,"_numSlices"),t=Math.max(1,n-A+1),D=Math.min(D+1,q-A+1),G=F[w];if(!(m&&!G._new||c&&G._new))for(var G=G.firstChild.firstChild.rows,H=x;H<E;++H)for(var s=G[H].cells,B=t;B<D;++B)(l||h&&this.isSelected(this.newDataCellIndex(z+H-1,A+B-1),g)||b&&!this.isSelected(this.newDataCellIndex(z+H-1,A+B-1),g))&&d.push(s[B])}}}}}}};AdfDhtmlPivotTablePeer.prototype.isRangeIndexPopulated=function(a){return null!=a.startIndex};
AdfDhtmlPivotTablePeer.prototype.convertHeaderCellIndexWithEdgeToInfo=function(a){if(null!=a.depth)return!0;var b=this.getHeaderCellInfo(a.edge,a.layer,a.slice,!0,!0);if(null==b)return!1;a.depth=b.depth;a.extent=b.extent;return!0};
AdfDhtmlPivotTablePeer.prototype.getHeaderCellInfo=function(a,b,c,d,e,f){d=this._ptUtils._buffers2[a];e=this._ptUtils._startPane[a];var g=d[e],h=g[0],l=AdfAgent.AGENT.getIntAttribute(h,"_startSlice");if(c<l)return d=this.getHeaderCellInfoFromBlock(h,a,b,0,f),d.slice<=c?d:null;var h=d[1],l=h[h.length-1],m=AdfAgent.AGENT.getIntAttribute(l,"_startSlice"),n=AdfAgent.AGENT.getIntAttribute(l,"_numSlices");if(m+n<=c)return d=this.getHeaderCellInfoFromBlock(l,a,b,n-1,f),c<d.slice+d.extent?d:null;if(0==e&&
(h=h[0],l=AdfAgent.AGENT.getIntAttribute(h,"_startSlice"),c<l&&(l=g[g.length-1],m=AdfAgent.AGENT.getIntAttribute(l,"_startSlice"),n=AdfAgent.AGENT.getIntAttribute(l,"_numSlices"),m+n<=c))){d=this.getHeaderCellInfoFromBlock(h,a,b,0,f);if(d.slice<=c)return d;d=this.getHeaderCellInfoFromBlock(l,a,b,n-1,f);return c<d.slice+d.extent?d:null}e=c<this._ptUtils._splitSlice[a]?0:1;d=d[e];e=this.getBlockNumOfSlice(a,c,e);d=d[e];e=AdfAgent.AGENT.getIntAttribute(d,"_startSlice");return this.getHeaderCellInfoFromBlock(d,
a,b,c-e,f)};AdfDhtmlPivotTablePeer.prototype.getHeaderCellInfoFromBlock=function(a,b,c,d,e){b==AdfPivotTableUtils.COLUMN_EDGE?(c=this.getTableCell(a,c,d),a=c.cell,c=a.parentNode.rowIndex-1,d=a.rowSpan):(c=this.getTableCell(a,d,c),a=c.cell,c=c.startColumn,d=a.colSpan);var f=this.getHeaderCellCoordinates(a),g=Number(f.startSlice),f=this.getMemberExtent(b,a,f);return e?{edge:b,layer:c,slice:g,depth:d,extent:f,cell:a}:{edge:b,layer:c,slice:g,depth:d,extent:f}};
AdfDhtmlPivotTablePeer.prototype.getTableCell=function(a,b,c){var d;c+=1;var e=0;a=a.firstChild.firstChild.rows;for(var f=[],g=0;g<=b;++g)f[g]=0;for(g=0;g<=b;++g){for(var h=a[g+1].cells,l=0;f[g]<c;++l){d=h[l+1];for(var m=d.rowSpan,n=Math.min(d.colSpan,c-f[g]),p=g,q=Math.min(g+m,b+1);p<q;++p)f[p]+=n}if(g==e){if(g+m>b)return{cell:d,startColumn:c-n};e=g+m}}return d};AdfDhtmlPivotTablePeer.prototype.getMemberExtent=function(a,b,c){return null!=c.extent?Number(c.extent):a?b.rowSpan:b.colSpan};
AdfDhtmlPivotTablePeer.prototype.getCellSpanningLayer=function(a,b){for(var c=a.cells,d=c.length-1;1<=d;--d){cell=c[d];var e=this.getHeaderCellCoordinates(cell);if(Number(e.startLayer)<=b)return cell}};AdfDhtmlPivotTablePeer.prototype.getLayerOfSelection=function(){var a=this.getSelectedEdge();return null==a||a==AdfPivotTableUtils.DATABODY?-1:this._selectionAnchor.startIndex.layer};
AdfDhtmlPivotTablePeer.prototype.getSelectionForEdge=function(a,b){void 0==b&&(b=this.getSelection());switch(a){case AdfPivotTableUtils.COLUMN_EDGE:return b.columnHeaderCells;case AdfPivotTableUtils.ROW_EDGE:return b.rowHeaderCells;case AdfPivotTableUtils.DATABODY:return b.dataCells;default:AdfAssert.assert(AdfPivotTableUtils.assertsOff,"unexpected edge in getSelectionForEdge")}};
AdfDhtmlPivotTablePeer.prototype.getSelectedEdge=function(a){void 0==a&&(a=this.getSelection());return 0<a.columnHeaderCells.length?AdfPivotTableUtils.COLUMN_EDGE:0<a.rowHeaderCells.length?AdfPivotTableUtils.ROW_EDGE:0<a.dataCells.length?AdfPivotTableUtils.DATABODY:null};AdfDhtmlPivotTablePeer.prototype.getCurrentRange=function(a){var b=this.getSelectedEdge(a);if(null==b)return null;a=this.getSelectionForEdge(b,a);return a[a.length-1]};
AdfDhtmlPivotTablePeer.prototype.isScrollOutOfBlock=function(a,b){var c=b<this._ptUtils._splitSlice[a]?0:1,d=this.getBufferStartSlice(a,c),c=this.getBufferEndSlice(a,c);return b>=c||b<d};
AdfDhtmlPivotTablePeer.prototype.getApproximateScrollDelta=function(a){if(null==this._ptUtils._cachedCellWidth||null==this._ptUtils._cachedCellHeight){var b=this.getComponent().getProperty(AdfRichPivotTable.__START_ROW_KEY),c=this.getComponent().getProperty(AdfRichPivotTable.__START_COLUMN_KEY),b=this._getDataCellFromCellIndex(this.newDataCellIndex(b,c));this._ptUtils._cachedCellWidth=b.offsetWidth;this._ptUtils._cachedCellHeight=b.offsetHeight}return a==AdfPivotTableUtils.ROW_EDGE?Math.max(17,this._ptUtils._cachedCellHeight):
a==AdfPivotTableUtils.COLUMN_EDGE?Math.max(1,this._ptUtils._cachedCellWidth):30};
AdfDhtmlPivotTablePeer.prototype.getScrollDelta=function(a,b){var c=b<this._ptUtils._splitSlice[a]?0:1,d=this.getBufferStartSlice(a,c),e=this.getBufferEndSlice(a,c);if(b>=e)return this.getApproximateScrollDelta(a);if(b<d)return 0-this.getApproximateScrollDelta(a);var e=this.getSlicePosition(a,c,b),d=e.position,e=e.size,f=d+e,c=this._ptUtils._databodyScrollersByEdgeAndPane[a][c],c=a?c._usableHeight:c._usableWidth;return e<=c?0>d?d:f>c?f-c:0:f<c?f-c:0<d?d:0};
AdfDhtmlPivotTablePeer.prototype.getSlicePosition=function(a,b,c){b=this._ptUtils._buffers2[a][b];var d=b[b.length-1],e=AdfAgent.AGENT.getIntAttribute(d,"_startSlice"),f=AdfAgent.AGENT.getIntAttribute(d,"_numSlices");if(c==e+f)return a==AdfPivotTableUtils.ROW_EDGE?{position:d._top+d._height,size:null}:{position:d._horizPos+d._width,size:null};d=this.getBlockNumOfSlice(a,c);if(-1==d)return null;f=b[d];d=f.firstChild.rows;b=f[this._ptUtils._posAttr[a]];d=a?d:d[0].cells;e=this._ptUtils.offsetSizeAttr[a];
f=AdfAgent.AGENT.getIntAttribute(f,"_startSlice");c=c-f+1;a=a==AdfPivotTableUtils.ROW_EDGE&&AdfAgent.AGENT.getPlatform()==AdfAgent.IE_PLATFORM;for(f=1;f<c;++f)b+=a?d[f].firstChild[e]:d[f][e];return{position:b,size:a?d[c].firstChild[e]:d[c][e]}};
AdfDhtmlPivotTablePeer.prototype.getBlockNumOfSlice=function(a,b,c){void 0===c&&(c=b<this._ptUtils._splitSlice[a]?0:1);a=this._ptUtils._buffers2[a][c];c=0;for(var d=a.length;c<d;++c){var e=a[c],f=AdfAgent.AGENT.getIntAttribute(e,"_startSlice"),e=AdfAgent.AGENT.getIntAttribute(e,"_numSlices");if(f<=b&&b<f+e)return c}return-1};AdfDhtmlPivotTablePeer.prototype.getFirstVisibleDataCellIndex=function(){return this.newDataCellIndexFromCell(this._ptUtils._databodyBuffers[this._ptUtils._startPane[1]][this._ptUtils._startPane[0]][0][0].firstChild.rows[1].cells[1])};
AdfDhtmlPivotTablePeer.prototype.getBufferStartSlice=function(a,b){return AdfAgent.AGENT.getIntAttribute(this._ptUtils._buffers2[a][b][0],"_startSlice")};AdfDhtmlPivotTablePeer.prototype.getBufferEndSlice=function(a,b){var c=this._ptUtils._buffers2[a][b],d=c[c.length-1],c=AdfAgent.AGENT.getIntAttribute(d,"_startSlice"),d=AdfAgent.AGENT.getIntAttribute(d,"_numSlices");return c+d};
AdfDhtmlPivotTablePeer.prototype.getViewportStartSlice=function(a,b){return this._ptUtils.firstSliceInShiftedViewport(a,b,0).slice};AdfDhtmlPivotTablePeer.prototype.getViewportEndSlice=function(a,b){return this._ptUtils.lastSliceInShiftedViewport(a,b,0).slice};AdfDhtmlPivotTablePeer.prototype.getViewportStartLayer=function(a){return 0};AdfDhtmlPivotTablePeer.prototype.getViewportEndLayer=function(a){return(a?this._ptUtils._rowLayerCount:this._ptUtils._colLayerCount)-1};
AdfDhtmlPivotTablePeer.prototype.closestSliceInViewport=function(a,b){var c=b<this._ptUtils._splitSlice[a]?0:1,d=this.getViewportStartSlice(a,c);if(b<d)return d;c=this.getViewportEndSlice(a,c);return c<b?c:b};AdfDhtmlPivotTablePeer.prototype.closestLayerInViewport=function(a,b){var c=this.getViewportStartLayer(a);if(b<c)return c;c=this.getViewportEndLayer(a);return c<b?c:b};
AdfDhtmlPivotTablePeer.prototype.overlapsViewport=function(a){var b=a.edge,c=a.layer;if(this.getViewportEndLayer(b)<c)return!1;var d=a.slice;if(this.getViewportEndSlice(b,1)<d||!1==this.convertHeaderCellIndexWithEdgeToInfo(a))return!1;var c=c+a.depth,e=this.getViewportStartLayer(b);if(c<=e)return!1;c=this._ptUtils._startPane[b];a=d+a.extent;e=this.getViewportStartSlice(b,c);return a<=e||0==c&&(c=this.getViewportEndSlice(b,0),b=this.getViewportStartSlice(b,1),c<d&&a<=b)?!1:!0};
AdfDhtmlPivotTablePeer.prototype.containsFocus=function(a){for(var b=AdfPage.PAGE.getActiveDomElement();null!=b;){if(b==a)return!0;b=b.parentNode}return!1};AdfDhtmlPivotTablePeer.prototype.isMultipleDatabodyCellsSelected=function(){var a=this.getSelectionForEdge(AdfPivotTableUtils.DATABODY);return 1<a.length||1==a.length&&!this.isSingleCellRange(a[0])?!0:!1};AdfDhtmlPivotTablePeer.prototype.isSingleCellRange=function(a){return null==a.endIndex&&null==a.endKey};
AdfDhtmlPivotTablePeer.prototype.getHeaderSelectionCursor=function(a,b){var c=AdfAgent.AGENT.getAttribute(a,b?"_row_header_cursor":"_col_header_cursor");return AdfAgent.AGENT.getPlatform()==AdfAgent.WEBKIT_PLATFORM?"url("+c+") 15 16,default":"url("+c+"),default"};AdfDhtmlPivotTablePeer.prototype.getHeaderNodeStartSlice=function(a,b){var c=b?a.parentNode.rowIndex-1:AdfAgent.AGENT.getIntAttribute(a,"_iCol",0),d=this.getParentBlock(a),d=AdfAgent.AGENT.getIntAttribute(d,"_startSlice");return c+d};
AdfDhtmlPivotTablePeer.prototype.initializeSelectionAda=function(a,b,c){if(0==this._adaEdgeExtent[0]||0==this._adaEdgeExtent[1])c=this.newSelection(),this._adaSelectionLayer=-1;else{for(a=0;a<c.length;++a){var d=c[a];if(d.id&&-1!=d.id.indexOf(AdfDhtmlPivotTablePeer._SELECTION_DIV_ID)){var e=d.getAttribute("_selection");break}}c=eval(e);this._adaSelectionLayer=this.getLayerOfInitialSelection(c);this._graphScreenReaderMode||(this.initializeAdaSelectionCheckboxes(b),this._adaCheckboxesVisible=!0,this.setEventHandler(AdfDhtmlPivotTablePeer._ADA_CLEAR_SELECTION_LINK_ID,
"click",this.handleAdaClearSelectionLinkClick),this.setEventHandler(AdfDhtmlPivotTablePeer._ADA_TOGGLE_SELECTION_CHECKBOXES_LINK_ID,"click",this.handleAdaToggleSelectionCheckboxVisibilityLinkClick))}this.setSelectionProperty(c)};AdfDhtmlPivotTablePeer.prototype.setEventHandler=function(a,b,c){a=AdfRichUIPeer.CreateSubId(this.getComponent().getClientId(),a);a=document.getElementById(a);c=this.createCallback(c);AdfAgent.getAgent().addBubbleEventListener(a,b,c)};
AdfDhtmlPivotTablePeer.prototype.initializeAdaSelectionCheckboxes=function(a){var b=AdfAgent.getAgent(),c=this.createCallback(this.handleAdaSelectionCheckboxChange);a=a.getElementsByTagName("input");for(var d=[],e=0;e<a.length;++e){var f=a[e];f.id&&-1!=f.id.indexOf(AdfDhtmlPivotTablePeer._ADA_SELECTION_CHECKBOX_ID)&&(d.push(f),b.addBubbleEventListener(f,"click",c))}this._adaSelectionCheckboxes=d};
AdfDhtmlPivotTablePeer.prototype.handleAdaSelectionCheckboxChange=function(a){a=AdfAgent.getAgent().getEventTarget(a);var b=this.getCellIndexFromAdaSelectionCheckbox(a);a.checked?this.addCellToSelectionAda(b,a):this.removeCellFromSelectionAda(b)};AdfDhtmlPivotTablePeer.prototype.handleAdaClearSelectionLinkClick=function(a){this.clearAdaCheckboxes();this._adaSelectionLayer=-1;this.setSelectionProperty(this.newSelection())};
AdfDhtmlPivotTablePeer.prototype.handleAdaToggleSelectionCheckboxVisibilityLinkClick=function(a){var b=AdfAgent.getAgent().getEventTarget(a),c;this._adaCheckboxesVisible?(c=b.getAttribute("_showText"),a="none"):(c=b.getAttribute("_hideText"),a="");b.firstChild.data=c;b=this._adaSelectionCheckboxes;for(c=0;c<b.length;++c)b[c].style.display=a;this._adaCheckboxesVisible=!this._adaCheckboxesVisible};
AdfDhtmlPivotTablePeer.prototype.clearAdaCheckboxes=function(a){for(var b=this._adaSelectionCheckboxes,c=0;c<b.length;++c){var d=b[c];d!=a&&d.checked&&(d.checked=!1)}};
AdfDhtmlPivotTablePeer.prototype.addCellToSelectionAda=function(a,b){var c=this.getSelectedEdge(),d=this.getEdge(a),e=!1;null==c?c=!1:c!=d||c!=AdfPivotTableUtils.DATABODY&&this._adaSelectionLayer!=a.layer?(this.clearAdaCheckboxes(b),c=!1,e=!0):c=this.isSelected(a);c||(d==AdfPivotTableUtils.DATABODY?(c=this.newDataCellRange(a),this._adaSelectionLayer=-1):(c=this.newHeaderCellRange(a),this._adaSelectionLayer=a.layer),e=e?this.newSelection():this.copySelection(),this.getSelectionForEdge(d,e).push(c),
this.setSelectionProperty(e))};AdfDhtmlPivotTablePeer.prototype.removeCellFromSelectionAda=function(a){for(var b=this.getEdge(a),c=this.copySelection(),b=this.getSelectionForEdge(b,c),d=b.length-1;0<=d;--d)if(this.cellIndexEquals(a,b[d].startIndex)){b.splice(d,1);0==b.length&&(this._adaSelectionLayer=-1);break}this.setSelectionProperty(c)};
AdfDhtmlPivotTablePeer.prototype.getCellIndexFromAdaSelectionCheckbox=function(a){var b=a.id.split("::"),c=b.length,d=Number(b[c-3]),e=Number(b[c-2]),b=Number(b[c-1]);if(d==AdfPivotTableUtils.DATABODY)return this.newDataCellIndex(e,b);a=a.parentNode.parentNode;c=this.getHeaderCellCoordinates(a);a=this.getMemberExtent(d,a,c);return this.newHeaderCellIndexWithEdge(d,e,b,a)};
AdfDhtmlPivotTablePeer.prototype.getLayerOfInitialSelection=function(a){a=this.getCurrentRange(a);if(null==a)return-1;a=a.startIndex.layer;return null==a?-1:a};