// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://@sbaseurl@/jsapi/jsapi/esri/copyright.txt and http://www.arcgis.com/apps/webappbuilder/copyright.txt for details.

//>>built
define("dojo/_base/lang dojo/_base/html dojo/query dojo/on dojo/keys ./../utils".split(" "),function(k,d,n,l,f,h){var c={frameSectionIndex:"91"};c.panelNls=window.jimuNls.panelHeader;c._addTagToGroupPanel=function(){var a=this.config.widgets;this.isGroupPanel=!0;a.forEach(function(e){e.inGroupPanel=!0})};c._setAriaLabel=function(a,e){if(a.folded){var g=c.panelNls.expanded;d.setStyle(a.containerNode,"display","inherit")}else g=c.panelNls.collapsed,d.setStyle(a.containerNode,"display","none");e=h.getSubstituteString(e,
g);d.setAttr(a.titleNode,"aria-label",e)};c._initFrameEvents=function(a,e,g){if(this.isGroupPanel){var p=h.getSubstituteString(e.label,c.panelNls.expanded);e=h.getSubstituteString(e.label,c.panelNls.pressToFocus);d.setAttr(a.titleNode,"aria-label",p);d.setAttr(a.titleNode,"tabindex",c.frameSectionIndex);d.setAttr(a.containerNode,"aria-label",e);d.setAttr(a.containerNode,"tabindex",c.frameSectionIndex);0===g?this.firstTitleNode=a.titleNode:g===this.config.widgets.length-1&&(this.lastTitleNode=a.titleNode,
this.lastContent=a.containerNode);this.own(l(a.titleNode,"click",k.hitch(this,function(){a.foldEnable&&this._setAriaLabel(a,a.label)})));this.own(l(a.titleNode,"keydown",k.hitch(this,function(b){d.hasClass(b.target,"title")&&(b.keyCode===f.TAB?b.target===this.firstTitleNode&&b.shiftKey?(b.preventDefault(),this.lastContent.focus()):b.target!==this.lastTitleNode||b.shiftKey||"none"!==d.getStyle(this.lastContent,"display")||(b.preventDefault(),this.firstTitleNode.focus()):!a.foldEnable||b.keyCode!==
f.ENTER&&b.keyCode!==f.SPACE||(b.stopPropagation(),this._setAriaLabel(a,a.label),a.onFoldableNodeClick()))})));this.own(l(a.containerNode,"keydown",k.hitch(this,function(b){var m=b.target;d.hasClass(m,"jimu-panel-content")?b.keyCode===f.ENTER?(b=n(".jimu-widget",m)[0])&&h.focusFirstFocusNode(b):b.target!==this.lastContent||b.shiftKey||b.keyCode!==f.TAB||(b.preventDefault(),this.firstTitleNode.focus()):b.keyCode===f.ESCAPE&&(b.stopPropagation(),a.containerNode.focus())})))}};c._onOpenAndFocus=function(){this.config.openAtStart&&
!this._isFirstOpenAtStart?this._isFirstOpenAtStart=!0:this.isGroupPanel&&this.firstTitleNode&&this.firstTitleNode.focus()};return c});