AdfRichUIPeer.createPeerClass(AdfRichUIPeer,"AdfDhtmlPanelAccordionPeer",!1);
AdfDhtmlPanelAccordionPeer.InitSubclass=function(){AdfRichUIPeer.addComponentEventHandlers(this,AdfUIInputEvent.CLICK_EVENT_TYPE,AdfUIInputEvent.MOUSE_DOWN_EVENT_TYPE,AdfUIInputEvent.MOUSE_UP_EVENT_TYPE,AdfUIInputEvent.KEY_DOWN_EVENT_TYPE,AdfUIInputEvent.KEY_UP_EVENT_TYPE,AdfUIInputEvent.FOCUS_EVENT_TYPE,AdfUIInputEvent.BLUR_EVENT_TYPE);AdfAgent.AGENT.getCapabilities()[AdfAgent.CAP_TOUCH_SCREEN]==AdfAgent.CAP_TOUCH_SCREEN_NONE&&AdfRichUIPeer.addComponentEventHandlers(this,AdfUIInputEvent.MOUSE_OUT_EVENT_TYPE,
AdfUIInputEvent.MOUSE_IN_EVENT_TYPE,AdfDisclosureEvent.EVENT_TYPE);this._ATTRIBUTE_ROWKEY="_afrPaKey";this._ATTRIBUTE_TOOLBAR="_afrTbr";this._ATTRIBUTE_EVENT_TYPE="_afrEvtTp";this._ATTRIBUTE_DISCLOSED="_afrDscl";this._EVENT_TYPE_DISCLOSURE="disclosure";this._OVERFLOW_START_POPUP="_afrOfwSrt";this._OVERFLOW_END_POPUP="_afrOfwEnd";this._MOVE_UP_SUB_ID="moveUp";this._MOVE_DOWN_SUB_ID="moveDown";this._ITEM_RESIZE_DRAG_SUB_ID="ndrag";this._DISCLOSURE_BTN_SUB_ID="btn";this._DISCLOSURE_SUB_ID="disAcr";this._SELECTED_PSEUDO_CLASS=
"p_AFSelected";this._HIGHLIGHT_PSEUDO_CLASS="p_AFHighlight";this._DISCLOSED_PSEUDO_CLASS="p_AFDisclosed";this._DROP_TARGET_SUB_ID="dropTarget";this._DRAG_GHOST_CLASS="af|panelAccordion::ghost";this._HEADER_CLASS="af|panelAccordion::header";this._HEADER_SUBSEQUENT_CLASS="af|panelAccordion::header-subsequent";this._DISCLOSED_ICON_STYLE_CLASS="af|panelAccordion::disclosed-icon-style";this._UNDISCLOSED_ICON_STYLE_CLASS="af|panelAccordion::undisclosed-icon-style";this._DISCLOSE_PHASE1_ANIMATION_DURATION_FACTOR=
1;this._DISCLOSE_PHASE2_ANIMATION_DURATION_FACTOR=0.5;this._LEADING_NON_ITEM_NODE_COUNT=1;this._TRAILING_NON_ITEM_NODE_COUNT=4;this._BOTTOM_OVERFLOW_OFFSET=3;this._DISCLOSABLE_STYLECLASS="p_AFDisclosable";this._DISCLOSED_STYLECLASS="p_AFDisclosed";this._DISABLED_STYLECLASS="p_AFDisabled";this._DEPRESSED_STYLE_CLASS="p_AFDepressed";this._DRAG_STYLECLASS="p_AFDrag";this._FLOW_STYLECLASS="p_AFFlow";this._MINIMUM_INFLEXIBLE_HEIGHT="af|panelAccordion-tr-minimum-resizable-height"};
AdfDhtmlPanelAccordionPeer.prototype.Init=function(a){AdfDhtmlPanelAccordionPeer.superclass.Init.call(this,a);var b=AdfAgent.AGENT;a=a.getClientId();var d=AdfRichUIPeer.CreateSubId(a,"overflowTop"),d=b.getElementById(d);d.tabIndex=0;var e=this.createCallback(this._startOverflowButtonPressed);b.addBubbleEventListener(d,"mousedown",e);b.addBubbleEventListener(d,"keydown",e);e=this.createCallback(this._mouseAwayFromStartOverflowButton);b.addBubbleEventListener(d,"mouseup",e);b.addBubbleEventListener(d,
"mouseout",e);a=AdfRichUIPeer.CreateSubId(a,"overflowBottom");a=b.getElementById(a);a.tabIndex=0;d=this.createCallback(this._endOverflowButtonPressed);b.addBubbleEventListener(a,"mousedown",d);b.addBubbleEventListener(a,"keydown",d);d=this.createCallback(this._mouseAwayFromEndOverflowButton);b.addBubbleEventListener(a,"mouseup",d);b.addBubbleEventListener(a,"mouseout",d);this._onResizeDrag=this.createCallback(this._handleResizeDrag);this._onResizeDrop=this.createCallback(this._handleResizeDrop)};
AdfDhtmlPanelAccordionPeer.prototype._startOverflowButtonPressed=function(a){var b=AdfAgent.AGENT,d=a.type;if(!("keydown"==d&&a.keyCode!=AdfKeyStroke.ENTER_KEY&&a.keyCode!=AdfKeyStroke.SPACE_KEY&&a.keyCode!=AdfKeyStroke.ARROWDOWN_KEY))if("mousedown"==d&&a.button&&a.button!=AdfUIInputEvent.LEFT_BUTTON_FLAG)b.eatEvent(a);else if(!this._discloseAnimationData){var e=b.getEventTarget(a);"mousedown"==d&&(d=b.getEventTarget(a),this._setDepressedStyle(d,!0));this.hidePopup(this.getComponent(),AdfDhtmlPanelAccordionPeer._OVERFLOW_END_POPUP);
paneCutoffIndex=this._lastTopOverflowPaneIndex;null!=paneCutoffIndex&&this._showOverflowMenu(e,paneCutoffIndex,!1,AdfDhtmlPanelAccordionPeer._OVERFLOW_START_POPUP);b.eatEvent(a)}};
AdfDhtmlPanelAccordionPeer.prototype._endOverflowButtonPressed=function(a){var b=AdfAgent.AGENT,d=a.type;if(!("keydown"==d&&a.keyCode!=AdfKeyStroke.ENTER_KEY&&a.keyCode!=AdfKeyStroke.SPACE_KEY&&a.keyCode!=AdfKeyStroke.ARROWDOWN_KEY))if("mousedown"==d&&a.button&&a.button!=AdfUIInputEvent.LEFT_BUTTON_FLAG)b.eatEvent(a);else if(!this._discloseAnimationData){var e=b.getEventTarget(a);"mousedown"==d&&(d=b.getEventTarget(a),this._setDepressedStyle(d,!0));this.hidePopup(this.getComponent(),AdfDhtmlPanelAccordionPeer._OVERFLOW_START_POPUP);
paneCutoffIndex=this._firstBottomOverflowPaneIndex;null!=paneCutoffIndex&&this._showOverflowMenu(e,paneCutoffIndex,!0,AdfDhtmlPanelAccordionPeer._OVERFLOW_END_POPUP);b.eatEvent(a)}};AdfDhtmlPanelAccordionPeer.prototype._mouseAwayFromStartOverflowButton=function(a){a=AdfAgent.AGENT.getEventTarget(a);this._setDepressedStyle(a,!1)};AdfDhtmlPanelAccordionPeer.prototype._mouseAwayFromEndOverflowButton=function(a){a=AdfAgent.AGENT.getEventTarget(a);this._setDepressedStyle(a,!1)};
AdfDhtmlPanelAccordionPeer.prototype._setDepressedStyle=function(a,b){var d=AdfDhtmlPanelAccordionPeer._DEPRESSED_STYLE_CLASS;b?AdfDomUtils.addCSSClassName(a,d):AdfDomUtils.removeCSSClassName(a,d)};
AdfDhtmlPanelAccordionPeer.prototype.ReplaceDomElement=function(a,b){delete this._headerNodes;if(0<a.id.indexOf("optimizedData")){var d=[],e=[],f=AdfAgent.AGENT,g=f.getAttribute(a,"_afrDiscShw");null!=g&&(f.getElementById(AdfRichUIPeer.CreateSubId(g,"btn")).style.display="",AdfDomUtils.addCSSClassName(f.getElementById(AdfRichUIPeer.CreateSubId(g,"head")),AdfDhtmlPanelAccordionPeer._DISCLOSABLE_STYLECLASS));g=f.getAttribute(a,"_afrDiscHd");null!=g&&(f.getElementById(AdfRichUIPeer.CreateSubId(g,"btn")).style.display=
"none",AdfDomUtils.removeCSSClassName(f.getElementById(AdfRichUIPeer.CreateSubId(g,"head")),AdfDhtmlPanelAccordionPeer._DISCLOSABLE_STYLECLASS));g=a.childNodes;if(null!=g)for(var h=AdfPage.PAGE,k=g.length-1;-1<k;--k){var l=g[k];if(1==l.nodeType){a.removeChild(l);var m=f.getElementById(l.id);if(null==m)AdfLogger.LOGGER.severe('Unexpected unknown target node for accordion optimized DOM replacement with id\x3d"'+l.id+'".');else if(h.removeComponentsInSubtree(m),f.elementsRemoved(m),f.replaceNode(l,m),
f.elementsAdded(l),null!=d){e.push(m);d.push(l);var m=m.style,n=l.style,p=this.getDomElement();AdfDomUtils.containsCSSClassName(p,AdfDhtmlPanelAccordionPeer._FLOW_STYLECLASS)||(n.bottom="",n.top=m.top);if(this._discloseAnimationData&&(this._discloseAnimationData.toBeUnDisclosedData&&this._discloseAnimationData.toBeUnDisclosedData.bodyId==l.id||this._discloseAnimationData.toBeDisclosedData&&this._discloseAnimationData.toBeDisclosedData.bodyId==l.id))n.height=m.height}}}null!=d&&this._completeDisclosureAnimation(e,
d);this._restoreFocus()}else AdfDhtmlPanelAccordionPeer.superclass.ReplaceDomElement.call(this,a,b)};AdfDhtmlPanelAccordionPeer.prototype.DomReplaceNotify=function(a){delete this._headerNodes;var b=this.getDomElement();return 0<a.id.indexOf("optimizedData")?(this._selectedChildId=AdfAgent.AGENT.getAttribute(a,AdfDhtmlPanelAccordionPeer._ATTRIBUTE_ROWKEY),this._reallocateSize=!0,b):a.parentNode==this._getRootWrapper(b)?(this._reallocateSize=!0,b):a};
AdfDhtmlPanelAccordionPeer.prototype.ComponentRemoved=function(a){var b=AdfAgent.AGENT,d=a.getClientId(),e=AdfRichUIPeer.CreateSubId(d,"overflowTop"),e=b.getElementById(e);b.removeBubbleEventListener(e,"mousedown",this._startOverflowButtonPressed);b.removeBubbleEventListener(e,"keydown",this._startOverflowButtonPressed);b.removeBubbleEventListener(e,"mouseup",this._mouseAwayFromStartOverflowButton);b.removeBubbleEventListener(e,"mouseout",this._mouseAwayFromStartOverflowButton);d=AdfRichUIPeer.CreateSubId(d,
"overflowBottom");d=b.getElementById(d);b.removeBubbleEventListener(d,"mousedown",this._endOverflowButtonPressed);b.removeBubbleEventListener(d,"keydown",this._endOverflowButtonPressed);b.removeBubbleEventListener(d,"mouseup",this._mouseAwayFromEndOverflowButton);b.removeBubbleEventListener(d,"mouseout",this._mouseAwayFromEndOverflowButton);AdfDhtmlPanelAccordionPeer.superclass.ComponentRemoved.call(this,a)};
AdfDhtmlPanelAccordionPeer.prototype._restoreFocus=function(){var a=this._getMostRecentDisclosedPaneClientId();null!=a&&(this._selectedChildId=a,a=AdfRichUIPeer.CreateSubId(a,AdfDhtmlPanelAccordionPeer._DISCLOSURE_SUB_ID),a=AdfAgent.AGENT.getElementById(a),null!=a&&AdfFocusUtils.focusElement(a),this._setMostRecentDisclosedPaneClientId(null))};
AdfDhtmlPanelAccordionPeer.prototype._getMostRecentDisclosedPaneClientId=function(){var a=AdfAgent.AGENT.getExpandoProperty(this.getDomElement(),"_afrRctDis");AdfAssert.assert("null"!=a,"The accordion recent disclosed client ID is the string 'null' but should be the literal null");null==a&&(a=AdfDhtmlPanelAccordionPeer._mostRecentDisclosedPaneClientId);return a};
AdfDhtmlPanelAccordionPeer.prototype._setMostRecentDisclosedPaneClientId=function(a){null!=a&&AdfAgent.AGENT.setExpandoProperty(this.getDomElement(),"_afrRctDis",a);AdfDhtmlPanelAccordionPeer._mostRecentDisclosedPaneClientId=a};
AdfDhtmlPanelAccordionPeer.handleOverflowItemClick=function(a,b,d){if(!this._discloseAnimationData){d=AdfPage.PAGE.findComponent(a);if(null==d)AdfLogger.LOGGER.severe("AdfDhtmlPanelAccordionPeer encountered an unexpected null newDisclosed: ",d," where childId \x3d ",childId);else{var e=d.getDisclosed(),f=AdfPage.PAGE.findComponent(b),g=f.getPeer();if(e)g.ReallocateSizesForNewSelection(a,f);else{var h;f.getDiscloseMany()||(b=g._getDiscloseManyFalseDisclosedClientId(),null!=b&&(h=AdfPage.PAGE.findComponent(b),
AdfAssert.assert(null!=h,"Could not find a showDetailItem component with clientId \x3d "+b)));g._setMostRecentDisclosedPaneClientId(a);g._queueClientDisclosureChanges(h,d)}}g.hidePopup(f,AdfDhtmlPanelAccordionPeer._OVERFLOW_END_POPUP);g.hidePopup(f,AdfDhtmlPanelAccordionPeer._OVERFLOW_START_POPUP)}};
AdfDhtmlPanelAccordionPeer.prototype.InitDomElement=function(a,b){AdfDhtmlPanelAccordionPeer.superclass.InitDomElement.call(this,a,b);this._overflowMenuHolderSubId=AdfRichUIPeer.CreateSubId(a.getClientId(),"overflowMenuHolder")};
AdfDhtmlPanelAccordionPeer.prototype.BindToComponent=function(a,b){AdfDhtmlPanelAccordionPeer.superclass.BindToComponent.call(this,a,b);var d=AdfAgent.AGENT,e=d.getElementById(this._overflowMenuHolderSubId);null!=e&&(e=AdfDomUtils.getFirstChildElement(e),null!=e&&(e=AdfRichUIPeer.CreateSubId(e.id,"content"),this._contentElement=AdfDomUtils.getFirstChildElement(d.getElementById(e))));this._restoreFocus()};
AdfDhtmlPanelAccordionPeer.prototype.HandleComponentClick=function(a){if(!a.isCanceled()&&!this._dragInProgress&&!this._discloseAnimationData){var b=a.getNativeEvent();if(this._setDisclosure(b,null))a.cancel();else if(b=AdfAgent.AGENT.getEventTarget(b).id)if(b=b.split("::"),1<b.length){var d=b[b.length-1];d==AdfDhtmlPanelAccordionPeer._MOVE_UP_SUB_ID?(b.pop(),index=this._getIndexOfChildClientId(b.join("::")),AdfAssert.assert(0<=index,"Child not found"),this._reorderPanel(index,index-1),a.cancel()):
d==AdfDhtmlPanelAccordionPeer._MOVE_DOWN_SUB_ID&&(b.pop(),index=this._getIndexOfChildClientId(b.join("::")),AdfAssert.assert(0<=index,"Child not found"),this._reorderPanel(index,index+1),a.cancel())}}};
AdfDhtmlPanelAccordionPeer.prototype.HandleComponentMouseDown=function(a){if(!this._dragInProgress&&!a.isCanceled()&&!this._discloseAnimationData){var b=a.getNativeEvent(),d=AdfAgent.AGENT,e=d.getEventTarget(b);if(this._isElementInToolbar(e))return;var f=e.id;if(f&&(f=f.split("::"),1<f.length)){var g=f[f.length-1];if(g==AdfDhtmlPanelAccordionPeer._ITEM_RESIZE_DRAG_SUB_ID){g=this._getRootWrapper(this.getDomElement());d.disableUserSelect(document.body);this._pageBounds=d.getElementPageBounds(g);f.pop();
d=this._resizeChildId=f.join("::");AdfAssert.assertString(d,"drag invoked without capturing target detail item's client id");this._resizeDivider=this._createResizeDivider(e);AdfPage.PAGE.startDrag(b,this._onResizeDrag,this._onResizeDrop,void 0,!0);this._dragInProgress=!0;a.cancel();return}this._handleSelection(a);if(g==AdfDhtmlPanelAccordionPeer._MOVE_UP_SUB_ID||g==AdfDhtmlPanelAccordionPeer._MOVE_DOWN_SUB_ID)return}}this._handleSelection(a);this._handleDetailDragStart(a);return!1};
AdfDhtmlPanelAccordionPeer.prototype._handleSelection=function(a){if(!this._dragInProgress&&!a.isCanceled()&&!this._discloseAnimationData){var b=a.getNativeEvent();if(a=this._extractItemSubIdFromEvent(b)){var d=AdfAgent.AGENT,b=d.getEventTarget(b);if(!this._isElementInToolbar(b)&&(a=d.getElementById(AdfRichUIPeer.CreateSubId(a.clientId,"head")))&&AdfDomUtils.isAncestorOrSelf(a,b))d=a.nextSibling,AdfDomUtils.addCSSClassName(a,AdfDhtmlPanelAccordionPeer._SELECTED_PSEUDO_CLASS),AdfDomUtils.addCSSClassName(d,
AdfDhtmlPanelAccordionPeer._SELECTED_PSEUDO_CLASS)}}};AdfDhtmlPanelAccordionPeer.prototype._handleRemoveSelection=function(a){if(!this._dragInProgress&&!a.isCanceled()&&(a=this._extractItemSubIdFromEvent(a.getNativeEvent())))if(a=AdfAgent.AGENT.getElementById(AdfRichUIPeer.CreateSubId(a.clientId,"head"))){var b=a.nextSibling;AdfDomUtils.removeCSSClassName(a,AdfDhtmlPanelAccordionPeer._SELECTED_PSEUDO_CLASS);AdfDomUtils.removeCSSClassName(b,AdfDhtmlPanelAccordionPeer._SELECTED_PSEUDO_CLASS)}};
AdfDhtmlPanelAccordionPeer.prototype.HandleComponentMouseUp=AdfDhtmlPanelAccordionPeer.prototype._handleRemoveSelection;
AdfDhtmlPanelAccordionPeer.prototype.HandleComponentMouseOut=function(a){if(!this._dragInProgress&&!a.isCanceled()&&(a=this._extractItemSubIdFromEvent(a.getNativeEvent()))){var b=AdfAgent.AGENT.getElementById(AdfRichUIPeer.CreateSubId(a.clientId,"head"));if(b){var d=b.nextSibling;AdfDomUtils.removeCSSClassName(b,AdfDhtmlPanelAccordionPeer._SELECTED_PSEUDO_CLASS);AdfDomUtils.removeCSSClassName(d,AdfDhtmlPanelAccordionPeer._SELECTED_PSEUDO_CLASS);var e=AdfPage.PAGE.getActiveDomElement();if(e&&(e=this._extractItemSubIdFromElement(e))&&
e.clientId==a.clientId)switch(e.subId){case AdfDhtmlPanelAccordionPeer._MOVE_UP_SUB_ID:case AdfDhtmlPanelAccordionPeer._MOVE_DOWN_SUB_ID:case AdfDhtmlPanelAccordionPeer._DISCLOSURE_SUB_ID:return}AdfDomUtils.removeCSSClassName(b,AdfDhtmlPanelAccordionPeer._HIGHLIGHT_PSEUDO_CLASS);AdfDomUtils.removeCSSClassName(d,AdfDhtmlPanelAccordionPeer._HIGHLIGHT_PSEUDO_CLASS)}}};
AdfDhtmlPanelAccordionPeer.prototype.HandleComponentMouseOver=function(a){if(!this._dragInProgress&&!a.isCanceled()&&!this._discloseAnimationData){var b=a.getNativeEvent();if(a=this._extractItemSubIdFromEvent(b)){var d=AdfAgent.AGENT;if(a=d.getElementById(AdfRichUIPeer.CreateSubId(a.clientId,"head")))b=d.getEventTarget(b),AdfDomUtils.isAncestorOrSelf(a,b)&&!this._isElementInToolbar(b)&&(b=a.nextSibling,AdfDomUtils.addCSSClassName(a,AdfDhtmlPanelAccordionPeer._HIGHLIGHT_PSEUDO_CLASS),AdfDomUtils.addCSSClassName(b,
AdfDhtmlPanelAccordionPeer._HIGHLIGHT_PSEUDO_CLASS))}}};AdfDhtmlPanelAccordionPeer.prototype.HandleComponentDisclosure=function(a){var b=a.getSource(),d=this.getComponent();b instanceof AdfRichShowDetailItem&&(b.getParent()==d&&a.getRoot()==b)&&a.setRoot(d)};
AdfDhtmlPanelAccordionPeer.prototype._handleComponentBlurAndFocus=function(a){if(!this._dragInProgress&&!a.isCanceled()){var b=a instanceof AdfDomComponentFocusEvent?this._extractItemSubIdFromEvent(a.getNativeEvent()):null;if(b){switch(b.subId){case AdfDhtmlPanelAccordionPeer._MOVE_UP_SUB_ID:case AdfDhtmlPanelAccordionPeer._MOVE_DOWN_SUB_ID:case AdfDhtmlPanelAccordionPeer._DISCLOSURE_SUB_ID:break;default:return}if(b=AdfAgent.AGENT.getElementById(AdfRichUIPeer.CreateSubId(b.clientId,"head"))){var d=
b.nextSibling;a=a.getType()==AdfUIInputEvent.FOCUS_EVENT_TYPE;if(!a||!this._discloseAnimationData)AdfDomUtils.addOrRemoveCSSClassName(a,b,AdfDhtmlPanelAccordionPeer._HIGHLIGHT_PSEUDO_CLASS),AdfDomUtils.addOrRemoveCSSClassName(a,d,AdfDhtmlPanelAccordionPeer._HIGHLIGHT_PSEUDO_CLASS)}}}};AdfDhtmlPanelAccordionPeer.prototype.HandleComponentBlur=AdfDhtmlPanelAccordionPeer.prototype._handleComponentBlurAndFocus;AdfDhtmlPanelAccordionPeer.prototype.HandleComponentFocus=AdfDhtmlPanelAccordionPeer.prototype._handleComponentBlurAndFocus;
AdfDhtmlPanelAccordionPeer.prototype._extractItemSubIdFromEvent=function(a){a=AdfAgent.AGENT.getEventTarget(a);return this._extractItemSubIdFromElement(a)};AdfDhtmlPanelAccordionPeer.prototype._extractItemSubIdFromElement=function(a){for(var b=this._getRootWrapper(this.getDomElement()),d=a;d!=b;d=d.parentNode){if(null==d)return null;a=d}a=a.id;if(!a)return null;a=a.split("::");return 1<a.length?{subId:a[a.length-1],clientId:a.slice(0,a.length-1).join("::")}:null};
AdfDhtmlPanelAccordionPeer.prototype._getIndexOfChildClientId=function(a){var b=this._getHeaderElements();a=AdfRichUIPeer.CreateSubId(a,"head");for(var d=0,e=b.length;d<e;++d)if(b[d].id==a)return d;return-1};
AdfDhtmlPanelAccordionPeer.prototype._handleDetailDragStart=function(a){if("disable"==this.getComponent().getReorder()||this._discloseAnimationData)return!1;var b=a.getNativeEventTarget(),d=this._getHeaderElements(),e=null!=this._lastTopOverflowPaneIndex?this._lastTopOverflowPaneIndex+1:0,f=null!=this._firstBottomOverflowPaneIndex?this._firstBottomOverflowPaneIndex-1:d.length-1;if(!(1>f-e)&&!this._isElementInToolbar(b)){for(var g=e;g<=f;++g)if(e=d[g],AdfDomUtils.isAncestorOrSelf(e,b))return b=AdfAgent.AGENT,
a=a.getNativeEvent(),this._dragHeaderNode=e,this._dragHeaderHeight=e.offsetHeight,this._dragSourceTop=b.getElementTop(e),this._dragSourceLeft=b.getElementLeft(e),d=b.getMousePosition(a),e=b.getElementPosition(e),this._dragOffsetX=d.x-e.x,this._dragOffsetY=d.y-e.y,AdfPage.PAGE.startDrag(a,this.createCallback(this._handleReorderDrag),this.createCallback(this._handleReorderDrop),this.createCallback(this._handleReorderAbort)),!0;return!1}};
AdfDhtmlPanelAccordionPeer.prototype._initiateReorderDrag=function(){var a=AdfAgent.AGENT,b=this._dragHeaderNode,d=AdfDomUtils.containsCSSClassName(b,AdfDhtmlPanelAccordionPeer._DISCLOSED_STYLECLASS);this._origDocumentCursor=document.body.style.cursor||"auto";a.setCursor(document.body,"move");a.disableUserSelect(document.body);this._dragInProgress=!0;var e=this.getDomElement().ownerDocument,a=this._ghost=e.createElement("div"),f=AdfPage.PAGE.getLookAndFeel();a.className=f.getSkinProperty(AdfDhtmlPanelAccordionPeer._DRAG_GHOST_CLASS);
f=a.style;f.position="absolute";f.overflow="hidden";f.top="-10000px";f.zIndex=1E3;f.width=b.offsetWidth+"px";e.body.appendChild(a);var g=b.offsetHeight,e=b.nextSibling;d&&(g+=e.offsetHeight);f.height=g+"px";d=AdfSubIdUtils.getSubIdElementById(this.getComponent(),AdfDhtmlPanelAccordionPeer._DROP_TARGET_SUB_ID).style;d.height=g+"px";d.top=b.offsetTop+"px";d.position="absolute";d.overflow="hidden";d.left="0px";d.right="0px";f=b.cloneNode(!0);AdfAgent.AGENT.removeIdsFromDomSubTree(f);a.appendChild(f);
g=f.style;g.top="0px";g.bottom="";g=e.cloneNode(!0);AdfAgent.AGENT.removeIdsFromDomSubTree(g);a.appendChild(g);a=g.style;a.top=f.offsetHeight+"px";a.bottom="0px";e.style.display="none";b.style.display="none";d.display="block"};
AdfDhtmlPanelAccordionPeer.prototype._handleReorderDrag=function(a,b,d){if(null==this._ghost){if(3>Math.abs(d))return;this._reorderData=this._getReorderItemPlacement();this._initiateReorderDrag()}this._positionDragGhost(this._ghost,a);this._reorderForDragEvent(a);AdfAgent.AGENT.eatEvent(a);return!1};
AdfDhtmlPanelAccordionPeer.prototype._getReorderItemPlacement=function(){var a=[],b=this._getHeaderElements(),d=this.getDomElement();AdfDomUtils.containsCSSClassName(d,AdfDhtmlPanelAccordionPeer._FLOW_STYLECLASS)&&this._prepareFlowingStructureForAnimation(d,b);for(var d=b.length,e=0;e<d;++e){var f=b[e],g=f.nextSibling,h=AdfDomUtils.containsCSSClassName(f,AdfDhtmlPanelAccordionPeer._DISCLOSED_STYLECLASS),k=f.offsetHeight,l=k;h&&(k+=g.offsetHeight);this._convertTopBottomToHeight(f);this._convertTopBottomToHeight(g);
a.push({originalIndex:e,header:f,content:g,top:f.offsetTop,origTop:f.offsetTop,height:k,disclosed:h,headerHeight:l,contentHeight:g.offsetHeight,dragged:f==this._dragHeaderNode})}return a};
AdfDhtmlPanelAccordionPeer.prototype._prepareFlowingStructureForAnimation=function(a,b){a=this._getRootWrapper(a);var d=AdfAgent.AGENT.getElementTop(a),e=a.style;e.overflow="hidden";e.height=a.offsetHeight+"px";this._oldWidth=e.width;e.width=a.offsetWidth+"px";for(e=b.length-1;0<=e;--e){var f=b[e];this._convertFlowingElementToPositioned(f.nextSibling,d);this._convertFlowingElementToPositioned(f,d)}};
AdfDhtmlPanelAccordionPeer.prototype._restoreFlowingStructureAfterAnimation=function(a,b){a=this._getRootWrapper(a);for(var d=b.length,e=0;e<d;++e){var f=b[e],g=f.nextSibling;this._restoreFlowingElement(f);this._restoreFlowingElement(g)}a.style.width=this._oldWidth;d=a.style;d.overflow="visible";d.height="auto"};AdfDhtmlPanelAccordionPeer.prototype._convertFlowingElementToPositioned=function(a,b){var d=a.style;d.top=AdfAgent.AGENT.getElementTop(a)-b+"px";d.left="0px";d.right="0px";d.position="absolute"};
AdfDhtmlPanelAccordionPeer.prototype._restoreFlowingElement=function(a){a=a.style;a.position="relative";a.top="auto";a.left="auto";a.right="auto"};AdfDhtmlPanelAccordionPeer.prototype._convertTopBottomToHeight=function(a){var b=a.style;if(b.bottom&&!("auto"==b.bottom||"none"==b.display))a=this._getStyleHeight(a),b.height=a+"px",b.bottom=""};
AdfDhtmlPanelAccordionPeer.prototype._getStyleHeight=function(a){var b=AdfAgent.AGENT.getComputedStyle(a);return a.offsetHeight-AdfAgent.getCSSLengthAsInt(b.borderTopWidth)-AdfAgent.getCSSLengthAsInt(b.borderBottomWidth)-AdfAgent.getCSSLengthAsInt(b.paddingTop)-AdfAgent.getCSSLengthAsInt(b.paddingBottom)};
AdfDhtmlPanelAccordionPeer.prototype._reorderForDragEvent=function(a){if(this._reorderData){var b=AdfAgent.AGENT,d=this._reorderData,e=this._getRootWrapper(this.getDomElement());if(b.isEventInElement(a,e)){var f=b.getMousePosition(a).y,g=b.getElementPosition(e).y,e=null!=this._lastTopOverflowPaneIndex?this._lastTopOverflowPaneIndex+1:0;a=null!=this._firstBottomOverflowPaneIndex?this._firstBottomOverflowPaneIndex-1:d.length-1;var h=-1,k=-1,l;for(l=e;l<=a;++l){var m=d[l];if(-1==h){var n=g+m.top,p=n+
m.height;f>=n&&f<=p&&(h=l)}m.dragged&&(k=l);if(0<=k&&0<=h)break}if(!(0>h||h==k))if(m=d[h],l=f<g+m.top+m.height/2,l=h<k?l?h:h+1:l?h-1:h,l!=k){f=d[k];d.splice(k,1);l==d.length?d.push(f):d.splice(l,0,f);g=AdfPage.PAGE.getLookAndFeel();k=g.getSkinProperty(AdfDhtmlPanelAccordionPeer._HEADER_CLASS);f=g.getSkinProperty(AdfDhtmlPanelAccordionPeer._HEADER_SUBSEQUENT_CLASS);h=0;0<e&&(g=parseInt(g.getSkinProperty("af|panelAccordion-tr-overflow-height")),h+=g);AdfDomUtils.addOrRemoveCSSClassName(0==l,this._ghost.childNodes[0],
k);AdfDomUtils.addOrRemoveCSSClassName(0<l,this._ghost.childNodes[0],f);l=0;for(size=d.length;l<size;++l)g=d[l],m=g.header,n=m.offsetHeight,l>=e&&l<=a?(g.top=h,h+=g.height):g.top=-1E5,AdfDomUtils.addOrRemoveCSSClassName(0==l,m,k),AdfDomUtils.addOrRemoveCSSClassName(0<l,m,f),n!=m.offsetHeight&&b.setOuterHeight(m,n);this._animateReorder()}}}};
AdfDhtmlPanelAccordionPeer.prototype._animateReorder=function(a,b){this._reorderAnimator&&(this._reorderAnimator.stop(),delete this._reorderAnimator);var d=parseInt(AdfPage.PAGE.getLookAndFeel().getSkinProperty("af|panelAccordion-tr-reorder-animation-duration"));isNaN(d)&&(d=0);null==a&&(a=[]);for(var e=this._reorderData,f=0,g=e.length;f<g;++f){var h=e[f],k=h.top;if(h.dragged){var l=AdfSubIdUtils.getSubIdElementById(this.getComponent(),AdfDhtmlPanelAccordionPeer._DROP_TARGET_SUB_ID);h.header.style.top=
k+"px";l.style.top=k+"px"}else a.push({element:h.header,properties:{offsetTop:k}});k+=h.headerHeight;h.disclosed&&!h.dragged?a.push({element:h.content,properties:{offsetTop:k}}):h.content.style.top=k+"px"}this._reorderAnimator=AdfDhtmlElementAnimator.animate(AdfDhtmlElementAnimator.FRAME_METHOD_SLOW_FAST_SLOW,d,a,null,function(a){var b=a[0];delete b._reorderAnimator;if(null!=a[1])a[1](b)},[this,b],null)};
AdfDhtmlPanelAccordionPeer.prototype._terminateReorderDrag=function(){this.DestroyDragGhost();var a=this._dragHeaderNode;a.style.display="block";this._dragHeaderHeight!=a.offsetHeight&&AdfAgent.AGENT.setOuterHeight(a,this._dragHeaderHeight);AdfDomUtils.containsCSSClassName(a,AdfDhtmlPanelAccordionPeer._DISCLOSED_STYLECLASS)&&(a.nextSibling.style.display="block");this._origDocumentCursor&&(AdfAgent.AGENT.setCursor(document.body,this._origDocumentCursor),delete this._origDocumentCursor);delete this._dragHeaderNode;
delete this._dragSourceTop;delete this._dragSourceLeft;delete this._dragOffsetX;delete this._dragOffsetY;a=this.getDomElement();AdfDomUtils.containsCSSClassName(a,AdfDhtmlPanelAccordionPeer._FLOW_STYLECLASS)&&(headerElements=this._getHeaderElements(),this._restoreFlowingStructureAfterAnimation(a,headerElements),delete this._headerNodes)};
AdfDhtmlPanelAccordionPeer.prototype._handleReorderDrop=function(a,b,d){null!=this._ghost&&(b=AdfAgent.AGENT,a=AdfSubIdUtils.getSubIdElementById(this.getComponent(),AdfDhtmlPanelAccordionPeer._DROP_TARGET_SUB_ID),b=b.getElementPosition(a),b=[{element:this._ghost,properties:{top:b.y,left:b.x}}],a.style.display="none",this._animateReorder(b,function(a){a._afterReorderDropAnimation()}))};
AdfDhtmlPanelAccordionPeer.prototype._afterReorderDropAnimation=function(){for(var a=this._reorderData,b=this._dragHeaderNode,d=-1,e=-1,f=0,g=a.length;f<g;++f){var h=a[f];if(h.header==b){d=h.originalIndex;e=f;break}}this._applyReorderChanges(b,d,e)};
AdfDhtmlPanelAccordionPeer.prototype._applyReorderChanges=function(a,b,d){var e=new AdfReorderEvent(this.getComponent(),b,d);e.queue(!0);e.isCanceled()?this._revertReorder():(this._updateOverflowMenuOrder(b,d),this._updateDomOrderAfterReorder(b,d),delete this._reorderData,this._terminateReorderDrag(),this._selectedChildId=this._getClientId(a),this._forceResize())};
AdfDhtmlPanelAccordionPeer.prototype._updateDomOrderAfterReorder=function(a,b){var d=this._getHeaderElements(),e=d[a],f=e.nextSibling;d.splice(a,1);var g=e.parentNode,h=AdfPage.PAGE.getActiveDomElement();b==d.length?(d=this._getRootChildElements(),d=d[d.length-AdfDhtmlPanelAccordionPeer._TRAILING_NON_ITEM_NODE_COUNT]):d=d[b];g.insertBefore(e,d);g.insertBefore(f,d);delete this._headerNodes;h&&h.focus&&(e=AdfAgent.AGENT.getComputedStyle(h),e.style&&"none"!=e.style.display&&h.focus())};
AdfDhtmlPanelAccordionPeer.prototype._revertReorder=function(a){var b=this._reorderData;null==a&&(a=[]);var d=AdfPage.PAGE.getLookAndFeel(),e=d.getSkinProperty(AdfDhtmlPanelAccordionPeer._HEADER_CLASS),d=d.getSkinProperty(AdfDhtmlPanelAccordionPeer._HEADER_SUBSEQUENT_CLASS);b.sort(function(a,b){return a.originalIndex-b.originalIndex});for(var f=0,g=b.length;f<g;++f){var h=b[f];h.top=h.origTop;var h=h.header,k=h.offsetHeight;AdfDomUtils.addOrRemoveCSSClassName(0==f,h,e);AdfDomUtils.addOrRemoveCSSClassName(0<
f,h,d);k!=h.offsetHeight&&AdfAgent.AGENT.setOuterHeight(h,k);b[f].dragged&&(AdfDomUtils.addOrRemoveCSSClassName(0==f,this._ghost.childNodes[0],e),AdfDomUtils.addOrRemoveCSSClassName(0<f,this._ghost.childNodes[0],d))}this._animateReorder(a,function(a){delete a._reorderData;a._terminateReorderDrag()})};AdfDhtmlPanelAccordionPeer.prototype._handleReorderAbort=function(a,b,d){null!=this._ghost&&this._revertReorder([{element:this._ghost,properties:{top:this._dragSourceTop,left:this._dragSourceLeft}}])};
AdfDhtmlPanelAccordionPeer.prototype._handleResizeDrag=function(a,b,d){this._positionResizeDivider(a)};
AdfDhtmlPanelAccordionPeer.prototype._handleResizeDrop=function(a,b,d){a=AdfPage.PAGE.getLookAndFeel();var e=parseInt(a.getSkinProperty(AdfDhtmlPanelAccordionPeer._MINIMUM_INFLEXIBLE_HEIGHT));a=this._resizeChildId;AdfAssert.assertString(a,"drop invoked without capturing target detail item's client id");a=AdfPage.PAGE.findComponent(a);AdfAssert.assertPrototype(a,AdfRichShowDetailItem);a.getPeer().bind(a);b=a.getPeer().getDomNode();var f=b.offsetHeight,f=f+d;f<e&&(f=e);d=this._pageBounds;d=d.bottom-
d.top;f>d&&(f=d);a.ResizeHandlePropertyChange=!0;a.setFlex(0);a.setProperty("inflexibleHeight",f,!0);delete a.ResizeHandlePropertyChange;this._restoreResizeDivider(this._resizeDivider,b.parentNode);delete this._resizeDivider;delete this._dragInProgress;delete this._pageBounds;delete this._resizeChildId;this._forceResize();AdfAgent.AGENT.enableUserSelect(document.body)};AdfDhtmlPanelAccordionPeer.prototype._forceResize=function(){var a=this.getComponent();this._reallocateSize=!0;AdfPage.PAGE.doResizeNotify(a)};
AdfDhtmlPanelAccordionPeer.prototype._positionResizeDivider=function(a){var b=this._pageBounds;a=AdfAgent.AGENT.getMousePosition(a);a=Math.max(a.y,b.top);a=Math.min(a,b.bottom);this._resizeDivider.style.top=a+"px"};
AdfDhtmlPanelAccordionPeer.prototype._createResizeDivider=function(a){AdfAssert.assertDomNode(a);var b=this._pageBounds,d=AdfPage.PAGE;a.parentNode.removeChild(a);d.getZOrderManager().addElementToLayer(a,AdfDhtmlZOrderManager.FLOATINGTYPE_TOOLTIP);AdfDomUtils.addCSSClassName(a,AdfDhtmlPanelAccordionPeer._DRAG_STYLECLASS);d=a.style;d.width=b.right-b.left+"px";d.left=b.left+"px";return a};
AdfDhtmlPanelAccordionPeer.prototype._restoreResizeDivider=function(a,b){AdfAssert.assertDomNode(a);AdfAssert.assertDomNode(b);var d=AdfPage.PAGE;AdfDomUtils.removeCSSClassName(a,AdfDhtmlPanelAccordionPeer._DRAG_STYLECLASS);d.getZOrderManager().removeElement(a);b.appendChild(a);d=a.style;d.width="";d.left="";d.top="";d.zIndex=""};AdfDhtmlPanelAccordionPeer.prototype.HandleComponentKeyDown=function(a){if(!a.isCanceled()&&!this._discloseAnimationData){var b=a.getNativeEvent();switch(AdfAgent.AGENT.getKeyCode(b)){case AdfKeyStroke.ENTER_KEY:case AdfKeyStroke.ARROWUP_KEY:case AdfKeyStroke.ARROWDOWN_KEY:case AdfKeyStroke.SPACE_KEY:this._handleSelection(a)}}};
AdfDhtmlPanelAccordionPeer.prototype.HandleComponentKeyUp=function(a){if(!a.isCanceled()&&!this._discloseAnimationData){var b=a.getNativeEvent(),d=!1;switch(AdfAgent.AGENT.getKeyCode(b)){case AdfKeyStroke.ARROWUP_KEY:this._handleRemoveSelection(a);b.shiftKey&&b.ctrlKey?d=this._handleReorderKeyUp(!0,a):!b.shiftKey&&!b.ctrlKey&&(d=this._setDisclosure(b,!1));break;case AdfKeyStroke.ARROWDOWN_KEY:this._handleRemoveSelection(a);b.shiftKey&&b.ctrlKey?d=this._handleReorderKeyUp(!1,a):!b.shiftKey&&!b.ctrlKey&&
(d=this._setDisclosure(b,!0));break;case AdfKeyStroke.ENTER_KEY:this._handleRemoveSelection(a);break;case AdfKeyStroke.SPACE_KEY:this._handleRemoveSelection(a),d=this._setDisclosure(b,null)}d&&a.cancel()}};
AdfDhtmlPanelAccordionPeer.prototype._handleReorderKeyUp=function(a,b){if(!("disable"==this.getComponent().getReorder()||this._dragInProgress||this._discloseAnimationData)){var d=b.getNativeEvent(),d=AdfAgent.AGENT.getEventTarget(d);if(!d.id)return!1;var e=d.id.split("::");if(e[e.length-1]!=AdfDhtmlPanelAccordionPeer._DISCLOSURE_SUB_ID)return!1;if(d=this._getCurrencyFromDomElement(d,this.getDomElement()))for(var d=d[0],e=this._getHeaderElements(),f=null!=this._lastTopOverflowPaneIndex?this._lastTopOverflowPaneIndex+
1:0,g=null!=this._firstBottomOverflowPaneIndex?this._firstBottomOverflowPaneIndex-1:e.length-1,h=0;h<e.length;++h)if(this._getClientId(e[h])==d){if(a){if(h<=f)return!1;this._reorderPanel(h,h-1)}else{if(h>=g)return!1;this._reorderPanel(h,h+1)}return!0}}};
AdfDhtmlPanelAccordionPeer.prototype._reorderPanel=function(a,b){if(!this._dragInProgress&&!this._discloseAnimationData){var d=this._reorderData=this._getReorderItemPlacement(),e,f=d[a];d.splice(a,1);this._dragInProgress=!0;this._dragHeaderNode=f.header;this._dragHeaderHeight=f.header.offsetHeight;if(0==a||0==b){e=AdfAgent.AGENT;var g=AdfPage.PAGE.getLookAndFeel(),h=g.getSkinProperty(AdfDhtmlPanelAccordionPeer._HEADER_CLASS),g=g.getSkinProperty(AdfDhtmlPanelAccordionPeer._HEADER_SUBSEQUENT_CLASS),
k=d[0].header,l=f.header,m=k.offsetHeight,n=l.offsetHeight;0==a?(AdfDomUtils.addCSSClassName(k,h),AdfDomUtils.removeCSSClassName(k,g),AdfDomUtils.addCSSClassName(l,g),AdfDomUtils.removeCSSClassName(l,h)):(AdfDomUtils.addCSSClassName(k,g),AdfDomUtils.removeCSSClassName(k,h),AdfDomUtils.addCSSClassName(l,h),AdfDomUtils.removeCSSClassName(l,g));e.setOuterHeight(k,m);e.setOuterHeight(l,n)}e=this.getDomElement();AdfDomUtils.containsCSSClassName(e,AdfDhtmlPanelAccordionPeer._FLOW_STYLECLASS)&&this._prepareFlowingStructureForAnimation(e,
this._getHeaderElements());for(e=a;e<b;++e)d[e].top-=f.height,f.top+=d[e].height;for(e=b;e<a;++e)d[e].top+=f.height,f.top-=d[e].height;b==d.length?d.push(f):d.splice(b,0,f);this._animateReorder([],function(a){a._afterReorderDropAnimation()})}};AdfDhtmlPanelAccordionPeer.prototype._updateOverflowMenuOrder=function(a,b){var d=this._contentElement.getElementsByTagName("div"),e=d[a],f=e.parentNode;f.removeChild(e);b==d.length?f.appendChild(e):f.insertBefore(e,d[b])};
AdfDhtmlPanelAccordionPeer.prototype._getOverflowLinks=function(){var a=this._getRootChildElements();return{top:a[0],bottom:a[a.length-AdfDhtmlPanelAccordionPeer._BOTTOM_OVERFLOW_OFFSET]}};AdfDhtmlPanelAccordionPeer.prototype._getHeaderElements=function(){if(null==this._headerNodes){this._headerNodes=[];for(var a=this._getRootChildElements(),b=a.length-AdfDhtmlPanelAccordionPeer._TRAILING_NON_ITEM_NODE_COUNT-1,d=AdfDhtmlPanelAccordionPeer._LEADING_NON_ITEM_NODE_COUNT;d<b;d+=2)this._headerNodes.push(a[d])}return this._headerNodes};
AdfDhtmlPanelAccordionPeer.prototype._getRootWrapper=function(a){if(1==AdfDomUtils.getNonWhitespaceChildCount(a)){var b=AdfDomUtils.getFirstChildElement(a);if(b&&"none"!=b.style.display)return b}return a};AdfDhtmlPanelAccordionPeer.prototype._getRootChildElements=function(){for(var a=this._getRootWrapper(this.getDomElement()).childNodes,b=[],d=0,e=a.length;d<e;d++){var f=a[d];f&&1==f.nodeType&&b.push(f)}return b};AdfDhtmlPanelAccordionPeer.DragAbortAnimationComplete=function(a){a.DestroyDragGhost()};
AdfDhtmlPanelAccordionPeer.prototype.DestroyDragGhost=function(){AdfAgent.AGENT.enableUserSelect(document.body);this._ghost&&this._ghost.parentNode.removeChild(this._ghost);AdfSubIdUtils.getSubIdElementById(this.getComponent(),AdfDhtmlPanelAccordionPeer._DROP_TARGET_SUB_ID).style.display="none";delete this._ghost;this._dragInProgress=!1};
AdfDhtmlPanelAccordionPeer.prototype._positionDragGhost=function(a,b){var d=AdfAgent.AGENT,e=a.ownerDocument,f=d.getMousePosition(b),g=d.getWindowWidth(),h=d.getWindowHeight(),d=e.documentElement.scrollLeft,e=e.documentElement.scrollTop,h=h-a.offsetHeight-1+e,g=Math.min(g-a.offsetWidth-1+d,Math.max(f.x-this._dragOffsetX,d)),f=Math.min(h,Math.max(f.y-this._dragOffsetY,e)),d=a.style;d.left=g+"px";d.top=f+"px"};
AdfDhtmlPanelAccordionPeer.prototype._setDisclosure=function(a,b){if(!this._discloseAnimationData){var d=AdfAgent.AGENT.getEventTarget(a),e=this._getCurrencyFromDomElement(d,this.getDomElement());if(null!=e){var f=e[0];if(e[1]==AdfDhtmlPanelAccordionPeer._EVENT_TYPE_DISCLOSURE)return e[3]?(AdfDhtmlPanelAccordionPeer.handleOverflowItemClick(f,this.getComponent().getClientId(),null),!0):this._doDisclose(f,b,e[2])}else{var e=this.getDomElement(),f=AdfAgent.AGENT,g=!0;if(!AdfDomUtils.isAncestor(e,d))return!1;
for(;null!=d;){var h=d.parentNode;if(!g&&f.getAttribute(d,AdfDhtmlPanelAccordionPeer._ATTRIBUTE_TOOLBAR))break;var g=!1,k=d.id;if(null!=k&&-1!=k.indexOf("::reorder"))break;if(h==this._getRootWrapper(e)){e=this._getClientId(d);if(null==e)break;if(AdfDomUtils.containsCSSClassName(d,AdfDhtmlPanelAccordionPeer._DISABLED_STYLECLASS))break;f=AdfDomUtils.containsCSSClassName(d,AdfDhtmlPanelAccordionPeer._DISCLOSED_STYLECLASS);return this._doDisclose(e,b,f)}d=h}}return!1}};
AdfDhtmlPanelAccordionPeer.prototype._isElementInToolbar=function(a){var b=AdfAgent.AGENT,d=this.getDomElement();for(a=a.parentNode;null!=a&&a!=d;a=a.parentNode)if(1==a.nodeType&&b.getAttribute(a,AdfDhtmlPanelAccordionPeer._ATTRIBUTE_TOOLBAR))return!0;return!1};
AdfDhtmlPanelAccordionPeer.prototype._doDisclose=function(a,b,d){var e=this.getComponent(),f=AdfPage.PAGE.findComponent(a),g="immediate"==e.getContentDelivery(),h="attachment"==AdfPage.PAGE.getOutputMode();if(null==f)AdfLogger.LOGGER.severe("AdfDhtmlPanelAccordionPeer encountered an unexpected null newDisclosed: ",f," where clientIdToDisclose \x3d ",a);else if(g&&!h)AdfLogger.LOGGER.warning("PanelAccordion contentDelivery\x3dimmediate is not supported outside of attachment mode. Disclose ability is disabled while in this state.");
else{if(g)return this._doImmediateDisclose(a,b,d);g=e.getDiscloseMany();h=e.getDiscloseNone();e=null;if(null==b||d!=b){b=!1;if(g){var k=this._getDisclosedClientIds(this.getDomElement()).length;if(d){if(1<k||h)this._queueSingleClientDisclosureChange(f,!1)&&(e={item:f,disclosed:!1,previouslyDisclosedItem:null}),b=!0}else this._queueSingleClientDisclosureChange(f,!0)&&(e={item:f,disclosed:!0,previouslyDisclosedItem:null}),this._selectedChildId=a,b=!0}else d?h&&(this._queueSingleClientDisclosureChange(f,
!1)&&(e={item:f,disclosed:!1,previouslyDisclosedItem:null}),b=!0):(d=this._getDiscloseManyFalseDisclosedClientId(),null!=d&&(k=AdfPage.PAGE.findComponent(d),AdfAssert.assert(null!=k,"Could not find a showDetailItem component with clientId \x3d "+d)),this._queueClientDisclosureChanges(k,f)&&(e={item:f,disclosed:!0,previouslyDisclosedItem:k}),this._selectedChildId=a,b=!0);e&&this._beginDisclosureAnimation(e.item,e.previouslyDisclosedItem,e.disclosed);if(b)return this._setMostRecentDisclosedPaneClientId(a),
!0}}return!1};
AdfDhtmlPanelAccordionPeer.prototype._doImmediateDisclose=function(a,b,d){var e=this.getComponent(),f=e.getDiscloseMany(),e=e.getDiscloseNone();if(!1==f)return AdfLogger.LOGGER.warning("PanelAccordion discloseMany\x3dfalse is not supported in attachment mode."),!1;if(null!=b&&d==b)return!1;b=!d;var f=this._getDisclosedClientIds(this.getDomElement()),g=f.length;if(d&&!e&&1==g)return!1;this._selectedChildId=a;this._setMostRecentDisclosedPaneClientId(a);d=AdfPage.PAGE.findComponent(a);this._beginDisclosureAnimation(d,
null,b);d.setDisclosed(b);var h=AdfRichUIPeer.CreateSubId(a,"head");d=AdfAgent.AGENT;(h=d.getElementById(h))&&(b?AdfDomUtils.addCSSClassName(h,AdfDhtmlPanelAccordionPeer._DISCLOSED_PSEUDO_CLASS):AdfDomUtils.removeCSSClassName(h,AdfDhtmlPanelAccordionPeer._DISCLOSED_PSEUDO_CLASS));h=AdfRichUIPeer.CreateSubId(a,AdfDhtmlPanelAccordionPeer._DISCLOSURE_SUB_ID);h=d.getElementById(h);null!=h&&d.setAttribute(h,AdfDhtmlPanelAccordionPeer._ATTRIBUTE_DISCLOSED,b);var k=AdfPage.PAGE.getLookAndFeel(),l=b?k.getStyleClass(AdfDhtmlPanelAccordionPeer._UNDISCLOSED_ICON_STYLE_CLASS):
k.getStyleClass(AdfDhtmlPanelAccordionPeer._DISCLOSED_ICON_STYLE_CLASS),k=b?k.getStyleClass(AdfDhtmlPanelAccordionPeer._DISCLOSED_ICON_STYLE_CLASS):k.getStyleClass(AdfDhtmlPanelAccordionPeer._UNDISCLOSED_ICON_STYLE_CLASS);AdfDomUtils.removeCSSClassName(h,l);AdfDomUtils.addCSSClassName(h,k);!e&&(b&&1==g)&&(h=AdfRichUIPeer.CreateSubId(f[0],AdfDhtmlPanelAccordionPeer._DISCLOSURE_BTN_SUB_ID),h=d.getElementById(h),null!=h&&(h.style.display=""));!e&&(!b&&2==g)&&(a=AdfRichUIPeer.CreateSubId(f[0]==a?f[1]:
f[0],AdfDhtmlPanelAccordionPeer._DISCLOSURE_BTN_SUB_ID),a=d.getElementById(a),null!=a&&(a.style.display="none"));return!0};
AdfDhtmlPanelAccordionPeer.prototype._beginDisclosureAnimation=function(a,b,d){if(!this._discloseAnimationData){var e=this.getDomElement(),e=AdfDomUtils.containsCSSClassName(e,AdfDhtmlPanelAccordionPeer._FLOW_STYLECLASS),f=a.getClientId(),g=b?b.getClientId():null,h=this._getHeaderElements(),k,l,m,n;b=[];var p=a=null;if(e){var q=null,r=null;k=0;for(l=h.length;k<l;++k)m=h[k],n=this._getClientId(m),n==f?d?q=m.nextSibling:r=m.nextSibling:n==g&&(r=m.nextSibling);null!=q&&(q.style.overflow="hidden",AdfAgent.AGENT.setOpacity(q,
0),q.style.display="block",a={bodyId:q.id},b.push({element:q,properties:{alpha:100}}));null!=r&&(r.style.overflow="hidden",p={bodyId:r.id},b.push({element:r,properties:{height:0}}))}else{q=this._getItemSizingData(this._mostRecentHeight,this._mostRecentWidth);r=[];k=0;for(l=h.length;k<l;++k)m=h[k],n=this._getClientId(m),n==f?r[k]=d:n==g&&(r[k]=!1);d=this._getItemSizingData(this._mostRecentHeight,this._mostRecentWidth,r);k=0;for(l=h.length;k<l;++k)k<q.startIndex&&k<d.startIndex||(k<d.startIndex?this._animateDiscloseIntoOverflow(h[k],
q.visibleItemData[k-q.startIndex],b):k<q.startIndex?this._animateDiscloseOutOfOverflow(h[k],d.visibleItemData[k-d.startIndex],b):k>q.endIndex&&k>d.endIndex||(k>q.endIndex?this._animateDiscloseOutOfOverflow(h[k],d.visibleItemData[k-d.startIndex],b):k>d.endIndex?this._animateDiscloseIntoOverflow(h[k],q.visibleItemData[k-q.startIndex],b):(f=q.visibleItemData[k-q.startIndex],g=d.visibleItemData[k-d.startIndex],m=h[k],n=m.nextSibling,f.top!=g.top&&b.push({element:m,properties:{offsetTop:g.top}}),-1!=g.contentTop&&
-1==f.contentTop?(AdfAgent.AGENT.setOpacity(n,0),n.style.display="block",a={headerId:m.id,bodyId:n.id,sizingData:g},b.push({element:n,properties:{alpha:100}})):-1==g.contentTop&&-1!=f.contentTop?(p={headerId:m.id,bodyId:n.id,sizingData:f},b.push({element:n,properties:{offsetTop:g.top+m.offsetHeight,height:0}})):(g.contentTop!=f.contentTop||g.contentHeight!=f.contentHeight)&&b.push({element:n,properties:{offsetTop:g.contentTop,height:g.contentHeight}}))))}h=parseInt(AdfPage.PAGE.getLookAndFeel().getSkinProperty("af|panelAccordion-tr-disclosure-animation-duration"));
h=isNaN(h)?0:h*AdfDhtmlPanelAccordionPeer._DISCLOSE_PHASE1_ANIMATION_DURATION_FACTOR;this._discloseAnimationData={objects:b,toBeDisclosedData:a,toBeUnDisclosedData:p,dimensionsFromChildren:e};a=null;e&&(a=this.getComponent());this._discloseAnimator=AdfDhtmlElementAnimator.animate(AdfDhtmlElementAnimator.FRAME_METHOD_SLOW_FAST_SLOW,h,b,null,function(a){a[0]._afterDiscloseAnimationInitial()},[this],a)}};
AdfDhtmlPanelAccordionPeer.prototype._completeDisclosureAnimation=function(a,b){if(this._discloseAnimationData){this._discloseAnimator&&(this._discloseAnimator.stop(),delete this._discloseAnimator);for(var d=this._discloseAnimationData.objects,e=this._discloseAnimationData.toBeDisclosedData,f=this._discloseAnimationData.toBeUnDisclosedData,g=AdfAgent.AGENT,h=parseInt(AdfPage.PAGE.getLookAndFeel().getSkinProperty("af|panelAccordion-tr-disclosure-animation-duration")),h=isNaN(h)?0:h*AdfDhtmlPanelAccordionPeer._DISCLOSE_PHASE2_ANIMATION_DURATION_FACTOR,
k=a.length,l,m,n=null,p=null,q=[],r=0,s=d.length;r<s;++r){var u=d[r];l=u.element;for(var t=-1,v=0;v<k;++v)if(m=b[v],m.id==l.id){t=v;break}if(-1!=t){l=a[t];u.element=m;var w=this.getDomElement(),w=AdfDomUtils.containsCSSClassName(w,AdfDhtmlPanelAccordionPeer._FLOW_STYLECLASS),t=m.style;if(e&&m.id==e.bodyId)g.setOpacity(m,0),w||(l=g.getElementById(e.headerId),t.top=l.offsetTop+l.offsetHeight+"px",t.bottom=""),t.display="block",t.visibility="visible",t.height="1px",l=e.sizingData,w?u.properties.height=
AdfDomUtils.getFirstChildElement(m).offsetHeight:(u.properties.height=l.contentHeight,u.properties.offsetTop=l.contentTop),q.push({element:m,sizingData:l});else if(f&&m.id==f.bodyId){"immediate"!=this.getComponent().getContentDelivery()&&g.removeIdsFromDomSubTree(l);m.parentNode.insertBefore(l,m);var n=l,p={element:n,properties:{}},z;for(z in u.properties)p.properties[z]=u.properties[z];q.push({element:l,sizingData:f.sizingData})}}}null!=p&&d.push(p);e=[];r=0;for(s=q.length;r<s;++r)f=q[r],g=f.element,
w?e.push(g):(k=AdfDomUtils.getFirstChildElement(g),m=k.style,p=this._getStyleHeight(g),m.height=f.sizingData.contentHeight-(g.offsetHeight-p)+"px",m.bottom="",e.push(k));q=null;w&&(q=this.getComponent());this._discloseAnimator=AdfDhtmlElementAnimator.animate(AdfDhtmlElementAnimator.FRAME_METHOD_SLOW_FAST_SLOW,h,d,null,function(a){a[0]._afterDiscloseAnimationFinal(a[1],a[2])},[this,n,e],q)}};
AdfDhtmlPanelAccordionPeer.prototype._afterDiscloseAnimationInitial=function(){delete this._discloseAnimator;if("immediate"==this.getComponent().getContentDelivery()){this._reallocateSize=!0;var a=this._getMostRecentDisclosedPaneClientId(),b=AdfRichUIPeer.CreateSubId(a,"head"),b=AdfAgent.getAgent().getElementById(b),a=AdfRichUIPeer.CreateSubId(a,"body");(a=AdfAgent.getAgent().getElementById(a))&&b&&this._completeDisclosureAnimation([a,b],[a,b])}};
AdfDhtmlPanelAccordionPeer.prototype._afterDiscloseAnimationFinal=function(a,b){delete this._discloseAnimator;delete this._discloseAnimationData;var d=AdfAgent.AGENT;a&&("immediate"==this.getComponent().getContentDelivery()?d.setAttribute(a,"style","display: none;"):a.parentNode.removeChild(a));delete this._headerNodes;var e=this.getDomElement(),e=AdfDomUtils.containsCSSClassName(e,AdfDhtmlPanelAccordionPeer._FLOW_STYLECLASS),f=this._getHeaderElements(),g;g=0;for(size=f.length;g<size;++g){var h=f[g],
k=h.nextSibling;d.setOpacity(h,100);d.setOpacity(k,100)}g=0;for(size=b.length;g<size;++g)d=b[g].style,d.height="",e?d.height="auto":d.bottom="0px";this._forceResize()};AdfDhtmlPanelAccordionPeer.prototype._animateDiscloseIntoOverflow=function(a,b,d){d.push({element:a,properties:{alpha:0}});-1!=b.contentTop&&d.push({element:a.nextSibling,properties:{alpha:0}})};
AdfDhtmlPanelAccordionPeer.prototype._animateDiscloseOutOfOverflow=function(a,b,d){var e=AdfAgent.AGENT;e.setOpacity(a,0);this._markPaneAsNotOverflown(a,b.top);d.push({element:a,properties:{alpha:100}});-1!=b.contentTop&&(a=a.nextSibling,e.setOpacity(a,0),this._markPaneAsNotOverflown(a,b.contentTop),a.style.display="block",e.setOuterHeight(a,b.contentHeight),d.push({element:a,properties:{alpha:100}}))};
AdfDhtmlPanelAccordionPeer.prototype._queueClientDisclosureChanges=function(a,b){if(null==a)return this._queueSingleClientDisclosureChange(b,!0);if(!0==a.getDisclosed()){a.getPeer().bind(a);var d=new AdfDisclosureEvent(a,!1,b);d.queue(!0);return!d.isCanceled()}AdfLogger.LOGGER.severe("Unexpected panelAccordion showDetailItem disclosure state for queueing client events");return!1};
AdfDhtmlPanelAccordionPeer.prototype._queueSingleClientDisclosureChange=function(a,b){if(a.getDisclosed()!=b){a.getPeer().bind(a);var d=new AdfDisclosureEvent(a,b,null);d.queue(!0);return!d.isCanceled()}AdfLogger.LOGGER.severe("Unexpected panelAccordion showDetailItem disclosure state for queueing a client event");return!1};
AdfDhtmlPanelAccordionPeer.prototype._getDiscloseManyFalseDisclosedClientId=function(){var a=this._getDisclosedClientIds(this.getDomElement());if(null!=a){var b=a.length;if(0<b)return AdfAssert.assert(1>=b,"There are too many disclosed accordion panes."),a[0]}return null};AdfDhtmlPanelAccordionPeer.prototype.needsResizeNotify=function(a){return!0};
AdfDhtmlPanelAccordionPeer.prototype.ResizeNotify=function(a,b,d,e){if(!this._discloseAnimationData&&(a!=d||b!=e||this._reallocateSize)){a=this._getHeaderElements();var f=a.length;b=AdfAgent.AGENT;var g=this.getDomElement();if(!AdfDomUtils.containsCSSClassName(g,AdfDhtmlPanelAccordionPeer._FLOW_STYLECLASS)){delete this._reallocateSize;this._mostRecentWidth=d;this._mostRecentHeight=e;this._firstOverflowPassComputed=!0;d=this._getItemSizingData(e,d);0<d.startIndex||d.endIndex<f-1?(this._lastTopOverflowPaneIndex=
d.startIndex-1,this._firstBottomOverflowPaneIndex=d.endIndex+1):(delete this._lastTopOverflowPaneIndex,delete this._firstBottomOverflowPaneIndex);var g=this._getOverflowLinks(),h;if(0==d.startIndex)g.top.style.display="none";else{g.top.style.display="block";for(e=0;e<d.startIndex;++e)h=a[e],this._markPaneAsOverflown(h),this._markPaneAsOverflown(h.nextSibling)}if(d.endIndex==f-1)g.bottom.style.display="none";else{g.bottom.style.display="block";for(e=d.endIndex+1;e<f;++e)h=a[e],this._markPaneAsOverflown(h),
this._markPaneAsOverflown(h.nextSibling)}for(e=d.startIndex;e<=d.endIndex;++e)f=d.visibleItemData[e-d.startIndex],g=a[e],this._markPaneAsNotOverflown(g,f.top),-1!=f.contentTop&&(g=g.nextSibling,this._markPaneAsNotOverflown(g,f.contentTop),b.setOuterHeight(g,f.contentHeight),g.style.bottom="")}}};AdfDhtmlPanelAccordionPeer.prototype.ReallocateSizesForNewSelection=function(a,b){this._selectedChildId=a;this._reallocateSize=!0;AdfPage.PAGE.doResizeNotify(b)};
AdfDhtmlPanelAccordionPeer.prototype._markPaneAsNotOverflown=function(a,b){a.style.top=b+"px";null!=this._firstOverflowPassComputed&&(a.style.visibility="visible")};AdfDhtmlPanelAccordionPeer.prototype._markPaneAsOverflown=function(a){a.style.top="-100000px";a.style.visibility="hidden"};
AdfDhtmlPanelAccordionPeer.prototype._getItemSizingData=function(a,b,d){var e={startIndex:0,endIndex:0,visibleItemData:[]},f=AdfPage.PAGE.getLookAndFeel(),g=parseInt(f.getSkinProperty("af|panelAccordion-tr-overflow-height")),f=parseInt(f.getSkinProperty("af|panelAccordion-tr-header-height")),h=this._getHeaderElements(),k=h.length;d=this._gatherHeightAndFlexData(h,d);-1==d.selectedPaneIndex&&(d.selectedPaneIndex=d.firstDisclosedPaneIndex);var l=a-f*k,m=d.minimumTotal-l;if(0<m){l=k;d.selectedPaneIndex<
k-1&&(m+=g,a-=g);for(var n,k=k-1;k>d.selectedPaneIndex&&0<m;--k)n=d.minimumHeights[k],m-=f,null!=n&&(m-=n),--l;var p=-1,q=0;0<m&&0<d.selectedPaneIndex&&(m+=g,q=g,a-=g);for(k=0;k<d.selectedPaneIndex&&0<m;++k)n=d.minimumHeights[k],m-=f,null!=n&&(m-=n),++p;a-=f*(l-p-1);e.startIndex=p+1;e.endIndex=l-1;g=[];m=0;n=[];for(var r=0,k=p+1;k<l;++k)inflexibleHeight=d.inflexibleHeights[k],g.push(inflexibleHeight),null!=inflexibleHeight&&(m+=inflexibleHeight),p=d.flexValues[k],n.push(p),null!=p&&(r+=p);this._addVisiblePaneSizingData(e,
g,m,n,r,h,f,q,b,a)}else e.startIndex=0,e.endIndex=k-1,this._addVisiblePaneSizingData(e,d.inflexibleHeights,d.inflexibleTotal,d.flexValues,d.flexTotal,h,f,0,b,l);return e};
AdfDhtmlPanelAccordionPeer.prototype._addVisiblePaneSizingData=function(a,b,d,e,f,g,h,k,l,m){if(0==f){l=null;for(g=b.length-1;0<=g;--g){var n=b[g];if(null!=n){l=n;b[g]=null;f=e[g]=1;break}}null!=l&&(m=Math.max(0,m-d+l))}else m=Math.max(0,m-d);d=k;for(g=0;g<b.length;g++)k={top:0,contentHeight:-1,contentTop:-1},l=e[g],k.top=d,d+=h,null!=l&&(k.contentTop=d,l=0!=l?Math.floor(m*(l/f)):b[g],d+=l,l=Math.max(1,l),k.contentHeight=l),a.visibleItemData.push(k)};
AdfDhtmlPanelAccordionPeer.prototype._gatherHeightAndFlexData=function(a,b){for(var d={flexValues:[],inflexibleHeights:[],minimumHeights:[],flexTotal:0,inflexibleTotal:0,minimumTotal:0,selectedPaneIndex:-1,firstDisclosedPaneIndex:-1},e=AdfAgent.AGENT,f,g=a.length,h=0;h<g;++h){var k=a[h].nextSibling;f=e.getAttribute(k,AdfDhtmlPanelAccordionPeer._ATTRIBUTE_ROWKEY);var l=b&&b.length?b[h]:null;f==this._selectedChildId&&(d.selectedPaneIndex=h);null==l&&"none"!=k.style.display||l?(-1==d.firstDisclosedPaneIndex&&
(d.firstDisclosedPaneIndex=h),f=AdfPage.PAGE.findComponent(f),k=f.getFlex(),d.flexValues.push(k),0==k?(f=f.getInflexibleHeight()+1,d.inflexibleHeights.push(f),d.minimumHeights.push(f),d.inflexibleTotal+=f):(f=f.getInflexibleHeight()+1,d.inflexibleHeights.push(0),d.minimumHeights.push(f),d.flexTotal+=k),d.minimumTotal+=f):(d.flexValues.push(null),d.inflexibleHeights.push(null),d.minimumHeights.push(null))}return d};
AdfDhtmlPanelAccordionPeer.prototype._getClientId=function(a){return(a=a.nextSibling)?AdfAgent.AGENT.getAttribute(a,AdfDhtmlPanelAccordionPeer._ATTRIBUTE_ROWKEY):null};AdfDhtmlPanelAccordionPeer.prototype._getDisclosedClientIds=function(a){var b=AdfAgent.getAgent(),d=[];if(a&&(a=this._getRootWrapper(a),a=a.childNodes,null!=a))for(var e=0;e<a.length;e++)if(1==a[e].nodeType){var f=a[e],g=b.getAttribute(f,AdfDhtmlPanelAccordionPeer._ATTRIBUTE_ROWKEY);null!=g&&"none"!=f.style.display&&d.push(g)}return d};
AdfDhtmlPanelAccordionPeer.prototype._getCurrencyFromDomElement=function(a,b){AdfAssert.assertDomElement(a);var d=a,e=AdfAgent.getAgent();if(null==d||1!=d.nodeType)return null;for(var f=e.getAttribute(d,AdfDhtmlPanelAccordionPeer._ATTRIBUTE_ROWKEY);null==f;){if(null==d||d==b)return null;d=d.parentNode;if(null==d||1!=d.nodeType)return null;f=e.getAttribute(d,AdfDhtmlPanelAccordionPeer._ATTRIBUTE_ROWKEY);if(e.getAttribute(d,AdfDhtmlPanelAccordionPeer._ATTRIBUTE_TOOLBAR))return null}if(null==f)return null;
var g=e.getAttribute(d,AdfDhtmlPanelAccordionPeer._ATTRIBUTE_EVENT_TYPE),e="true"==e.getAttribute(d,AdfDhtmlPanelAccordionPeer._ATTRIBUTE_DISCLOSED);return[f,g,e,"hidden"==d.style.visibility]};
AdfDhtmlPanelAccordionPeer.prototype._showOverflowMenu=function(a,b,d,e){var f=this.getComponent();if(this.isPopupVisible(f,e))this.hidePopup(f,e);else{var g=this._contentElement.getElementsByTagName("a"),h=g.length,k;if(b<h)for(k=0;k<h;++k)g[k].style.display=d&&k<b?"none":!d&&k>b?"none":"";else{AdfLogger.LOGGER.warning("There were an unexpected number of accordion pane overflow menu items: ",h);for(k=0;k<h;k++)g[k].style.display=""}b={};b[AdfDhtmlPopupHints.ALIGN_ELEMENT]=a;b[AdfDhtmlPopupHints.TYPE]=
AdfDhtmlPopupHints.TYPE_MENU;b[AdfDhtmlPopupHints.AUTODISMISS]=AdfDhtmlPopupHints.AUTODISMISS_ALWAYS;b[AdfDhtmlPopupHints.FOCUS]=!0;a=d;AdfPage.PAGE.getLocaleContext().isRightToLeft()&&(a=!a);b[AdfRichPopup.HINT_ALIGN]=a?AdfRichPopup.ALIGN_AFTER_END:AdfRichPopup.ALIGN_BEFORE_START;this._whereToResorePopupContent=this._contentElement.parentNode;this.showPopup(f,this._contentElement,b,e);AdfFocusUtils.focusFirstTabStop(this._contentElement)}};
AdfDhtmlPanelAccordionPeer.prototype.PopupClosed=function(a,b,d){this._whereToResorePopupContent.appendChild(b)};