// 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("dijit/_WidgetBase dojo/_base/declare dojo/Evented dojo/_base/array dojo/_base/lang dojo/on dojo/query dojo/dom-construct dojo/dom-class dojo/dom-style dojo/dom-attr ./ChartLayout jimu/utils dojo/keys dijit/focus".split(" "),function(x,y,z,q,g,r,h,l,c,A,t,B,C,w,D){return y([x,z],{openPanels:[],chartArray:[],constructor:function(){},postCreate:function(){this.inherited(arguments)},initAccordionPane:function(){var a,b;(this.config.charts.highlightedChartIndex||0===this.config.charts.highlightedChartIndex)&&
-1===q.indexOf(this.openPanels,"Chart"+this.config.charts.highlightedChartIndex)&&this.openPanels.push("Chart"+this.config.charts.highlightedChartIndex);var n=l.create("div",{"class":"esriCTAccordionWrapper"},this.node);this.chartArray=[];q.forEach(this.config.charts,g.hitch(this,function(d,k){var u="Chart"+k;var v=l.create("div",{"class":"esriCTChartRow",chartIndex:u},n);var e=C.sanitizeHTML(d.chartConfig.sectionTitle);e=l.create("div",{"class":"esriCTChartTitle",innerHTML:e,title:e,role:"button",
tabindex:0,"aria-label":e,"aria-expanded":"false"},v);var p=l.create("div",{"class":"esriCTChartContent"},v);d.chartData&&d.selectedFeature?(a=new B({nls:this.nls,config:d},l.create("div",{},p)),this.own(r(a,"setFocusNodes",g.hitch(this,function(){this.emit("setFocusNodes")}))),a.onChartCreated=g.hitch(this,function(){this.openPanels.length?-1===this.openPanels.indexOf(u)&&c.add(p,"esriCTHidden"):0!==k&&c.add(p,"esriCTHidden")}),a.onChartResize=g.hitch(this,function(){this.openPanels.length&&this._setFocusOnChart()}),
this.chartArray.push(a),a.startup(),r(e,"click",g.hitch(this,function(m){this._expandChart(m,k)})),r(e,"keydown",g.hitch(this,function(m){m.keyCode!==w.ENTER&&m.keyCode!==w.SPACE||this._expandChart(m,k)}))):(this.chartArray.push(null),c.add(v,"esriCTDisabledRow"),c.add(p,"esriCTHidden"));-1!==this.openPanels.indexOf(u)&&this._toggleSelectedChart(e,!1);0!==k||this.openPanels.length||(this.config.charts.highlightedChartIndex=k,this._toggleSelectedChart(e,!1))}));var f=h(".esriCTChartTitle",this.node);
0<f.length&&(b=f[0]);""!==b&&null!==b&&void 0!==b&&D.focus(b)},_setFocusOnChart:function(){var a=this.config.charts.highlightedChartIndex;a=h(".esriCTChartRow",this.node)[a];var b=h(".esriCTResultsPanel")[0];a&&b&&(b.scrollTop=a.offsetTop-81);this.emit("setFocusNodes")},_toggleSelectedChart:function(a,b){var n=h(".esriCTChartContent",a.parentElement)[0];var f=t.get(a.parentElement,"chartIndex");var d=f.split("Chart")[1];b?(c.add(n,"esriCTHidden"),c.remove(a,"esriCTChartSelected"),-1!==this.openPanels.indexOf(f)&&
this.openPanels.splice(this.openPanels.indexOf(f),1),t.set(a,"aria-expanded","false")):(this.config.charts[d].chartData&&(c.remove(n,"esriCTHidden"),c.add(a,"esriCTChartSelected"),this.chartArray[d]&&this.chartArray[d].resizeChart(0),this.config.charts.highlightedChartIndex===parseInt(d,10)&&this._highlightChart(a,d),t.set(a,"aria-expanded","true")),-1===this.openPanels.indexOf(f)&&this.openPanels.push(f));this.emit("setFocusNodes")},_highlightChart:function(a,b){this.emit("chartSelected",b);h(".esriCTChartHighlighted").length&&
(c.remove(h(".esriCTChartHighlighted")[0],"esriCTSelectedChartBorder"),c.remove(h(".esriCTChartHighlighted")[0],"esriCTChartHighlighted"));c.add(a,"esriCTChartHighlighted");c.add(a,"esriCTSelectedChartBorder");A.set(a,"border-color",this.config.selectedThemeColor)},resizeContents:function(){q.forEach(this.chartArray,g.hitch(this,function(a,b){a&&a.config.chartData&&-1!==this.openPanels.indexOf("Chart"+b)&&a.resizeChart(300)}))},_expandChart:function(a,b){c.contains(a.currentTarget,"esriCTChartSelected")?
c.contains(a.currentTarget,"esriCTChartHighlighted")?this._toggleSelectedChart(a.currentTarget,!0):(this.config.charts.highlightedChartIndex=b,this._highlightChart(a.currentTarget,b)):(this.config.charts.highlightedChartIndex=b,this._toggleSelectedChart(a.currentTarget,!1))}})});