// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.23/esri/copyright.txt for details.
//>>built
require({cache:{"url:esri/dijit/geoenrichment/ReportPlayer/core/templates/DynamicInfographic.html":'\x3cdiv data-dojo-attach-point\x3d"viewDiv" class\x3d"dynamicInfographic_viewDiv"\x3e\r\n    \x3cdiv data-dojo-attach-point\x3d"infographicDiv"\x3e\x3c/div\x3e\r\n    \x3cdiv data-dojo-attach-point\x3d"errorDiv" class\x3d"esriGEReportPlayerErrorMessage"\x3e${nls.dynamicInfographicError}\x3c/div\x3e\r\n\x3c/div\x3e'}});
define("esri/dijit/geoenrichment/ReportPlayer/core/infographics/DynamicInfographic","dojo/_base/declare dojo/_base/lang dojo/aspect dojo/when dojo/dom-class dojo/dom-style dojo/on dojo/query dijit/focus dijit/_WidgetBase dijit/_TemplatedMixin esri/geometry/Point esri/dijit/geoenrichment/Infographic esri/dijit/geoenrichment/AgePyramid esri/dijit/geoenrichment/RelatedVariables esri/dijit/geoenrichment/OneVar esri/dijit/geoenrichment/Tapestry esri/dijit/geoenrichment/config esri/dijit/geoenrichment/theme esri/tasks/geoenrichment/GeometryStudyArea ./InfographicTypes esri/dijit/geoenrichment/utils/DelayUtil esri/dijit/geoenrichment/utils/DomUtil esri/dijit/geoenrichment/utils/InvokeUtil esri/dijit/geoenrichment/utils/WaitingUtil esri/dijit/geoenrichment/utils/DynamicStyleUtil ./infographicUtils/InfographicJsonUtil ./extentions/BaseSelectComparisonExt dojo/text!../templates/DynamicInfographic.html dojo/i18n!../../../../../nls/jsapi ../../_devConfig".split(" "),
function(e,h,p,m,q,f,B,z,M,C,D,N,E,r,t,u,v,O,F,P,g,G,w,H,I,n,x,J,K,y,L){y=y.geoenrichment.dijit.ReportPlayer.ReportPlayer;var k={};k[g.ONE_VAR]=230;k[g.AGE_PYRAMID]=0;k[g.RELATED_VARS]=320;k[g.TAPESTRY]=300;p=e(null,{getSelectedFeatureID:function(){return this.select&&this.select.get("value")},setSelectedFeatureID:function(a){this.select&&this.select.set("value",a)}});r=e([r,p],{infographicStyleProvider:null,_onThemeLoad:function(a){var b=this.infographicStyleProvider&&this.infographicStyleProvider.agePyramid;
b&&(a=h.mixin({},a),a.male=a.male||{},a.male.fill=b.male.backgroundColor,a.female=a.female||{},a.female.fill=b.female.backgroundColor);this.inherited(arguments,[a]);if(b){var d=function(a){f.set(a,"color",q.contains(a,"AgePyramid_TextMale")?b.male.backgroundColor:b.female.backgroundColor)};d(this.min);d(this.max)}},resize:function(){this.inherited(arguments);var a=this.min&&this.min.parentNode;if(a&&this.parent)for(var b=400>f.get(this.parent,"width"),d=0;d<a.children.length;d++)q[b?"add":"remove"](a.children[d],
"TrimWithEllipses")}});t=e([t,p],{infographicStyleProvider:null,_themeAddedFlag:!1,updateUI:function(){this.inherited(arguments);if(!this._themeAddedFlag){var a=this.infographicStyleProvider&&this.infographicStyleProvider.agePyramid;if(a){var b=this.parent.id;n.addStyle(["#"+b+" .RelatedVariables_PositiveBar { background-color:"+a.male.backgroundColor+"; } #"+b+" .RelatedVariables_NegativeBar { background-color:"+a.female.backgroundColor+"; } #"+b+" .RelatedVariables_DifferenceColumn_Positive { color:"+
a.male.backgroundColor+"; } #"+b+" .RelatedVariables_DifferenceColumn_Negative { color:"+a.female.backgroundColor+"; }"],b);this._themeAddedFlag=!0}}},destroy:function(){n.removeStyle(this.parent.id);this.inherited(arguments)}});u=e(u,{infographicStyleProvider:null,_themeAddedFlag:!1,updateUI:function(){this.inherited(arguments);if(!this._themeAddedFlag){var a=this.infographicStyleProvider&&this.infographicStyleProvider.agePyramid;if(a){var b=this.parent.id;n.addStyle(["#"+b+" .OneVarMultiComparison_Expanded_Value_Primary { color:"+
a.male.backgroundColor+"; } #"+b+" .OneVarMultiComparison_Expanded_CurrentBar { background-color:"+a.male.backgroundColor+"; }"],b);this._themeAddedFlag=!0}}},destroy:function(){n.removeStyle(this.parent.id);this.inherited(arguments)}});v=e(v,{_toDetailView:function(a){this.inherited(arguments);this.onExpandedStateChanged()},collapseContent:function(){this._mainTable&&q.remove(this._mainTable,"clicked");this._toMainView();this.onExpandedStateChanged()},onExpandedStateChanged:function(){}});var l=
{};l[g.ONE_VAR]=u;l[g.AGE_PYRAMID]=r;l[g.RELATED_VARS]=t;l[g.TAPESTRY]=v;var A=e(E,{infographicStyleProvider:null,widgetParams:null,_requireReport:function(){this.type&&(l[this.type]?this._createReportWidget(this.type,l[this.type]):require([this._getAbsMid("./"+this.type)],h.hitch(this,this._createReportWidget,this.type)))},_createReportWidget:function(a,b){var d=this;if(!this._destroyed&&this.type===a)if(this._ge&&this._ge.isBusy())B.once(this._ge,"end",h.hitch(this,this._createReportWidget,this.type,
b));else if(this._autoTitlePromise)this._autoTitlePromise.then(h.hitch(this,this._createReportWidget,this.type,b));else if(this.type){var c=this._widget=new b(this.domNode);h.mixin(c,this.widgetParams);c.onExpandedStateChanged=function(){d.onExpandedStateChanged()};c.infographicStyleProvider=this.infographicStyleProvider;c.title="string"===typeof this.title?this.title:this._autoTitle;c.subtitle=this.subtitle;c.expanded=this.expanded;c.on("resize",h.hitch(this,this._onResize));isNaN(this._lastSelectedComparison)||
c.setState({selectedComparison:this._lastSelectedComparison});c.setDataProvider(this.dataProvider)}},collapseContent:function(){this._widget&&this._widget.collapseContent&&this._widget.collapseContent()},getSelectedFeatureID:function(){return this._widget&&this._widget.getSelectedFeatureID&&this._widget.getSelectedFeatureID()},setSelectedFeatureID:function(a){this._widget&&this._widget.setSelectedFeatureID&&this._widget.setSelectedFeatureID(a)},onExpandedStateChanged:function(){}});e=e([C,D],{templateString:K,
nls:y,viewModel:null,themeContext:null,theme:null,_infographic:null,_progressHanlder:null,buildRendering:function(){J.init();this.inherited(arguments)},postCreate:function(){this.inherited(arguments);this._showError(!1)},_currentInfographicJson:null,_getWidgetCreationParams:function(a){var b={};switch(a.type){case g.AGE_PYRAMID:b.showVerticalAxis=a.showVerticalAxis}return b},updateInfographic:function(a){var b=this;if(this.viewDiv){this._destroyCurrentInfographic();this._currentInfographicJson=a;
var d=this.viewModel.getInfographicDefaultStyles(this.theme||this.themeContext);this._enrichInfographicJsonWithProps(a);if(this.viewModel.dynamicReportInfo&&this.viewModel.dynamicReportInfo.infographicOptions){var c=this.viewModel.dynamicReportInfo.infographicOptions;this.viewModel.dynamicReportInfo.isFixedDataMode||this.viewModel.dynamicReportInfo.geClient.hasCapability("ComparisonLevelsInCalculators")||(a.calcData=null);this._infographic=(new A({infographicStyleProvider:d,widgetParams:this._getWidgetCreationParams(a),
returnGeometry:!1,autoTitle:!1,subtitle:!1,levels:x.getSubLevels(a),highestLevel:x.getHighestLevel(a),onDataRequest:function(){b._showProgress(!0,"data")},onDataReady:function(){m(b.resize(),function(){b._showProgress(!1,"data")})},onDataError:function(){b._showProgress(!1,"data");b._showError(!0)},onExpandedStateChanged:function(){b._doResize()}})).placeAt(this.infographicDiv);this._showProgress(!0,"item");m(function(){return a.calcData?{title:a.title,type:a.type,variables:a.variables}:m(c.getOptions().getItems(c.countryID),
function(b){var c;b.some(function(b){if(b.variables&&b.variables.length){var d,f;1<a.variables.length&&(a.variables=[a.variables[0].substr(0,a.variables[0].lastIndexOf("."))+".*"]);var e=a.variables[0];-1!==e.indexOf(".*")?d=e.replace(".*",""):f=e;e=b.variables[0];if(f&&-1!==e.indexOf(f)||d&&0===e.indexOf(d))return c=b,!0}});return c})}(),function(d){b._showProgress(!1,"item");if(d){var e=c.createGeoenrichment(a,b.viewModel.dynamicReportInfo.fieldData.areaData[0]);b._infographic.setGeoenrichment(e);
b._infographic.set("studyArea",c.studyArea);b._infographic.set("countryID",c.countryID);b._infographic.set("type",a.type);b._infographic.set("variables",d.variables);b._infographic.set("title",d.title);b._infographic.startup();var f=!e.isBusy();a.title=a.title||d.title;m(b.resize(),function(){f&&b._showProgress(!1,"data")})}else b._showError(!0)})}else this._createDummyInfographic(a);F.set(this.viewDiv,d&&d.agePyramid&&d.agePyramid.theme||"light");f.set(this._infographic.domNode,"backgroundColor",
a.style&&a.style.backgroundColor||d&&d.backgroundColor);f.set(this._infographic.domNode,"fontFamily","inherit")}},_enrichInfographicJsonWithProps:function(a){x.setLevels(a,a.levels);a.variables||(a.variables=a.dataCollectionID?[a.dataCollectionID+".*"]:[a.variableID]);delete a.dataCollectionID;delete a.variableID},_createDummyInfographic:function(a){},_destroyCurrentInfographic:function(){this._showError(!1);this._showProgress(!1);this._infographic&&this._infographic.destroy();this._infographic=null},
_itemLoadingState:0,_dataLoadingState:0,_contentLoadingState:0,_showProgress:function(a,b){I[a?"showProgress":"removeProgress"](this.domNode);"item"===b?this._itemLoadingState=a?1:2:"data"===b&&(this._dataLoadingState=a?1:2);1!==this._itemLoadingState&&1!==this._dataLoadingState||0!==this._contentLoadingState||(this._contentLoadingState=1,this.onContentLoadingStart());2===this._itemLoadingState&&2===this._dataLoadingState&&1===this._contentLoadingState&&(this._contentLoadingState=2,this.onContentLoadingEnd())},
_showError:function(a){L.emulateErrors.contentErrors&&(a=!0);w[a?"show":"hide"](this.errorDiv);w[a?"hide":"show"](this.infographicDiv)},_adjustErrorMessage:function(){f.set(this.errorDiv,"paddingTop",f.get(this.domNode,"height")/2-20+"px")},notifyShown:function(){},width:null,height:null,resize:function(a,b){void 0!==a&&(this.width=a,this.height=b);return H.invoke(this,"_doResize",50)},_doResize:function(){var a=this;if(this._infographic&&this._infographic.domNode&&w.isNodeInLayout(this.domNode)){var b=
this._currentInfographicJson.type,d=Math.max(function(){if("OneVar"===b){var c=z(".OneVarMultiComparison_Table",a.domNode)[0],c=c?f.get(c,"height")+120:0;return Math.max(c,k[b])}return"Tapestry"===b?(c=(c=z(".Tapestry_Main_Table",a.domNode)[0])?f.get(c,"height")+60:0,Math.max(c,k[b])):k[b]}(),this.height);f.set(this._infographic.domNode,{width:this.width-(d>this.height?20:0)+"px",height:d+"px"});f.set(this.viewDiv,{height:this.height+"px",overflowY:"auto"});this._infographic.resize();this._adjustErrorMessage();
return G.delay()}},getPreferredHeight:function(){return this._infographic&&f.get(this._infographic.domNode,"height")},collapseContent:function(){this._infographic&&this._infographic.collapseContent()},getVisualState:function(){return{selectedFeatureId:this._infographic&&this._infographic.getSelectedFeatureID()}},setVisualState:function(a){a&&a.selectedFeatureId&&this._infographic&&this._infographic.setSelectedFeatureID(a.selectedFeatureId)},toJson:function(){return h.clone(this._currentInfographicJson)},
onContentLoadingStart:function(){},onContentLoadingEnd:function(){},destroy:function(){this._destroyCurrentInfographic();this.inherited(arguments)}});e.ThemableInfographic=A;return e});