// 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/AreaDetailsInfographic.html":'\x3cdiv class\x3d"esriGEAreaDetailsInfographic"\x3e\r\n    \x3cdiv data-dojo-attach-point\x3d"noDetailsPlaceHolder" class\x3d"areaDetails_noDetailsPlaceHolder"\x3e\r\n        \x3cdiv class\x3d"areaDetails_noDetailsPlaceHolderImage"\x3e\x3c/div\x3e\r\n        \x3cdiv class\x3d"areaDetails_noDetailsPlaceHolderLabel"\x3e${nls.noDetails}\x3c/div\x3e\r\n    \x3c/div\x3e\r\n    \x3cdiv data-dojo-attach-point\x3d"contentDiv" class\x3d"areaDetails_contentDiv"\x3e\x3c/div\x3e\r\n\x3c/div\x3e\r\n\r\n\r\n'}});
define("esri/dijit/geoenrichment/ReportPlayer/core/infographics/AreaDetailsInfographic","dojo/_base/declare dojo/_base/lang dojo/promise/all dojo/when dojo/dom-construct dojo/dom-style dijit/_WidgetBase dijit/_TemplatedMixin esri/dijit/geoenrichment/_Invoke ./infographicUtils/InfographicThemeUtil ./infographicUtils/InfographicLayoutResizer ../supportClasses/TableUtil esri/dijit/geoenrichment/utils/DomUtil esri/dijit/geoenrichment/utils/WaitingUtil ./supportClasses/AreaDetailsLayouts ../../dataProviders/supportClasses/attachments/AttributesUtil esri/dijit/geoenrichment/ReportPlayer/core/sections/SectionTypes dojo/text!../templates/AreaDetailsInfographic.html dojo/i18n!../../../../../nls/jsapi".split(" "),
function(v,p,w,t,K,k,x,y,z,A,B,f,C,D,u,E,F,G,m){function H(){return n?n:n={getAttributes:function(){return[{alias:"Building Area (sq. feet)",value:1E3,type:"esriFieldTypeDouble"},{alias:"Frontage (feet)",value:100,type:"esriFieldTypeDouble"},{alias:"Parking",value:30,type:"esriFieldTypeInteger"},{alias:"Site Area (sq. feet)",value:500.5,type:"esriFieldTypeDouble"},{alias:"Number of Employees",value:300,type:"esriFieldTypeInteger"},{alias:"Address",value:"123 Main Street, City, State 55555",type:"esriFieldTypeString"}]},
getNotes:function(){return[{text:"This is a placeholder note. Here will be displayed some information about the area."},{text:"This is a placeholder note. Here will be displayed some information about the area."}]}}}m=m.geoenrichment.dijit.ReportPlayer.ReportPlayer;var n,I={_calcBuildInfo:function(a,c){return a?w([a.getAttributes(),a.getNotes()]).then(function(a){var b=a[0]||[];a=a[1]||[];c.showAttributes||(b=[]);c.showNotes||(a=[]);if(!b.length&&!a.length)return null;var g=c.attributesLayout===u.ATTRS_2COLUMNS,
h=g?Math.round(b.length/2):b.length,h=(h?h+1:0)+(a.length?a.length+1:0),l=c.style.height-f.getTableHeight(c.header);return{attrs:b,notes:a,numRows:h,numColumns:g?4:2,width:c.style.width,rowH:Math.max(f.DEFAULT_ROW_HEIGHT,l/h)}}):null},buildStack:function(a,c,g,b,k){return t(this._calcBuildInfo(a,c),function(a){function l(a,c,d){c=p.mixin({verticalAlign:"middle",horizontalAlign:c?"right":void 0,horizontalPadding:a?5:20},d?g:b);a&&(c.fontSize*=1.2);k&&(c.backgroundColor=k);return c}if(!a)return null;
var d=f.createTable({numColumns:a.numColumns,numRows:a.numRows,style:{width:a.width},useDefaultTheme:!1});d.scaleToFitHeight=!0;var e=0;if(a.attrs.length){var h=function(c,b){b=b||0;f.modifyTableJson(d,e,0+b,{text:c?c.alias:"",cellStyle:l(!1,!1,!0),height:a.rowH});f.modifyTableJson(d,e,1+b,{text:E.formatAttributeValue(c),cellStyle:l(!1,!0,!0)})},n=c.attributesLayout===u.ATTRS_2COLUMNS;f.modifyTableJson(d,e,0,{text:m.attributes,columnSpan:a.numColumns,cellStyle:l(!0,!1,!0),height:a.rowH});e++;for(var q=
0;q<a.attrs.length;q++){var r=a.attrs[q];h(r);n&&(r=a.attrs[++q],h(r,a.numColumns/2));e++}}a.notes.length&&(f.modifyTableJson(d,e,0,{text:m.notes,columnSpan:a.numColumns,cellStyle:l(!0),height:a.rowH}),e++,a.notes.forEach(function(c){f.modifyTableJson(d,e,0,{text:c.text,columnSpan:a.numColumns,cellStyle:l(),height:a.rowH});e++}));return[d]})}},J={adjustContent:function(a){var c=[];a.getFieldCells().forEach(function(a){if(a.valueLabel&&a.valueLabel.innerHTML){var b=c[a.gridData.index]=c[a.gridData.index]||
{};b.cells=b.cells||[];b.cells.push(a);b.h=Math.max(b.h||0,a.getHeight());b.minH=Math.max(b.minH||0,k.get(a.valueLabel,"height"))}});var g=0,b=0,f=[],h=[],l;for(l in c){var d=c[l];if(d.h>d.minH){var e=d.h-d.minH,g=g+e;f.push({cells:d.cells,maxHR:e,rowH:d.h})}else d.h<d.minH&&(e=d.minH-d.h+4,b+=e,h.push({cells:d.cells,hInc:e,rowH:d.h}))}if(0<b){var m=Math.min(1,b/g),n=Math.min(1,g/b);f.forEach(function(b){b.cells.forEach(function(c){a.setCellHeight(c,b.rowH-b.maxHR*m)})});h.forEach(function(b){b.cells.forEach(function(c){a.setCellHeight(c,
b.rowH+b.hInc*n)})})}}};return v([x,y,z],{templateString:G,nls:m,viewModel:null,themeContext:null,theme:null,parentWidget:null,_sections:null,_currentInfographicJson:null,postCreate:function(){this.inherited(arguments);this._showEmptyView(!1)},_getInfographicBackgroundColor:function(){var a=this.viewModel.getStaticInfographicDefaultStyles(this.theme||this.themeContext);return this._currentInfographicJson.style.backgroundColor||a&&a.backgroundColor},updateInfographic:function(a){this.domNode&&(this._currentInfographicJson=
this._applyThemeToJson(a),k.set(this.domNode,"backgroundColor",this._getInfographicBackgroundColor()),this.invoke("_doUpdateContent",50))},_resizeContent:function(){this._syncJsonDimensions();k.set(this.domNode,{width:this.width+"px",height:this.height+"px"});setTimeout(function(){k.set(this.noDetailsPlaceHolder,"paddingTop",(this.height-k.get(this.noDetailsPlaceHolder,"height"))/2+"px")}.bind(this))},_syncJsonDimensions:function(){this._currentInfographicJson&&B.resizeLayout(this._currentInfographicJson,
{w:this.width,h:this.height})},_doUpdateContent:function(){this._resizeContent();return this._createSections()},_getDetailsSectionStack:function(){var a=this.viewModel.dynamicReportInfo?this.viewModel.dynamicReportInfo.attachmentsStore:H();return I.buildStack(a,this._currentInfographicJson,this._getAttributesStyle(),this._getNotesStyle(),this._getInfographicBackgroundColor())},_createSections:function(){this._destroySections();this.onContentLoadingStart();return D.showProgressPromise(this.domNode,
t(this._getDetailsSectionStack(),function(a){if(a){this._showEmptyView(!1);var c=this._currentInfographicJson.header;this._createSection([c],0,!0);this._createSection(a,f.getTableHeight(c));this.onContentLoadingEnd()}else this._showEmptyView(!0)}.bind(this)))},_createSection:function(a,c,g){c=c||0;var b={"class":"infographicContainer_Section"};b.initialWidth=f.getTableWidth(a[0]);b.json={type:F.DETAILS,stack:a};b.viewModel=this.viewModel;b.themeContext=this.themeContext;b.theme=this.theme;b.tableClass=
"infographicContainerAreaDetailsTable";b.tableParams={trimTextIfOverflows:!0};b.hasFixedLayout=!0;b.parentWidget=this;p.mixin(b,this._prepareSectionCreationParams());b=this.viewModel.layoutBuilder.createElement("section",b,this.contentDiv);b.setResizedHeight(f.getTableHeight(a[0]));k.set(b.domNode,{position:"absolute",left:"0px",top:c+"px"});this._sections.push(b);!g&&J.adjustContent(b.getTables()[0]);g||k.set(this.contentDiv,"height",c+b.getResizedHeight()+"px")},_prepareSectionCreationParams:function(a){return null},
_destroySections:function(){this._sections=this._sections||[];this._sections.forEach(function(a){a.destroy()});this._sections.length=0},_getAttributesStyle:function(){return this.__getContentStyle("attributesStyle")},_getNotesStyle:function(){return this.__getContentStyle("notesStyle")},__getContentStyle:function(a){var c=this.viewModel.getDocumentDefaultStyles(this.theme||this.themeContext);return p.mixin({},c,this.viewModel.getTableDefaultStyles(this.theme||this.themeContext,"Default"),this._currentInfographicJson[a])},
_showEmptyView:function(a){C[a?"show":"hide"](this.noDetailsPlaceHolder)},width:null,height:null,resize:function(a,c){void 0!==a&&(this.width=a,this.height=c);this._syncJsonDimensions();this.invoke("_doUpdateContent",50)},notifyShown:function(){},_applyThemeToJson:function(a){var c=this.viewModel.getStaticInfographicDefaultStyles(this.theme||this.themeContext);return A.applyThemeSettingsToJson(a,c)},_undoThemeFromJson:function(a){return a},onContentLoadingStart:function(){},onContentLoadingEnd:function(){},
toJson:function(){var a=p.clone(this._currentInfographicJson);return this._undoThemeFromJson(a)},destroy:function(){this._destroySections();this.inherited(arguments)}})});