// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.23/esri/copyright.txt for details.
//>>built
define("esri/dijit/geoenrichment/ReportPlayer/core/reportContainers/containerGridUtils/SerializationManager","dojo/_base/declare dojo/_base/lang dojo/dom-style dojo/when ../../supportClasses/DocumentOptions ../../supportClasses/templateJsonUtils/fieldInfo/FieldInfoBuilder ../../supportClasses/templateJsonUtils/PageJsonUtil ../../supportClasses/templateJsonUtils/TemplateJsonModificationUtil ../../themes/ReportThemes esri/dijit/geoenrichment/utils/DomUtil esri/dijit/geoenrichment/utils/async/AsyncQueue".split(" "),
function(c,e,d,m,n,p,q,r,f,t,u){return c(null,{_wizard:null,_pendingJsonObj:null,constructor:function(a){this._wizard=a},notifyShown:function(){if(this._canApplyJson()&&this._pendingJsonObj){var a=this._pendingJsonObj;this._pendingJsonObj=null;d.set(this._wizard.domNode,"visibility","visible");this.fromJson(a);!this._pendingJsonObj&&this._wizard.onPendingDataApplied()}},_canApplyJson:function(){return t.isNodeInLayout(this._wizard.domNode)},fromJson:function(a,b){b=b||{};b.progressCallback=b.progressCallback||
function(){};a=a&&a.sectionsTables&&a.sectionsTables.length?a:this.getEmptyPageJson();if(this._canApplyJson()){this._pendingJsonObj=null;d.set(this._wizard.domNode,"visibility","visible");this._wizard.clear();a.documentOptions&&r.adjustDocumentOptions(a);a.theme&&a.theme.id!==f.GRAPHIC?(this._wizard.themeContext=a.theme.id,this._wizard.theme=a.theme):(this._wizard.themeContext=null,this._wizard.theme=null);this._wizard.documentOptions=e.mixin(n.getDefaultDocumentOptions(),a.documentOptions);this._wizard.updateLayout();
var g=this;if(b.renderSync)a.sectionsTables.forEach(function(a){g._wizard.createGridFromSectionTableJson(a)});else{var c=(new Date).getTime(),h=[],k=new u,l=0;a.sectionsTables.forEach(function(c){k.add(function(){var d=(new Date).getTime(),e=g._wizard.createGridFromSectionTableJson(c);return m(e.getRenderPromise(),function(){l+=1/a.sectionsTables.length;b.progressCallback(l);h.push((new Date).getTime()-d)})},{delayBefore:0,delayAfter:0})});return k.getPromise().then(function(){console.log("ReportContainer.js BUILD PAGES \x3d\x3e "+
((new Date).getTime()-c)+" \x3d\x3e "+h.join("; "))})}}else this._pendingJsonObj=a,d.set(this._wizard.domNode,"visibility","hidden")},getEmptyPageJson:function(a){return q.getGraphicReportEmptyPageJson({numRows:3,numColumns:2,documentOptions:this._wizard.documentOptions,jsonToCopy:a?this._wizard.toJson():null})},addSectionFromJson:function(a,b){if(b.parentGrid)return b.parentGrid.insertFieldInfoToCell(b,p.createFieldInfoFromSection(a)),b.content},toJson:function(a){var b={};b.documentOptions=e.clone(this._wizard.documentOptions||
{});b.sectionsTables=a&&void 0!==a.pageIndex?[this._wizard.getGrids()[a.pageIndex].toJson()]:this._wizard.getGrids().map(function(a){return a.toJson()});(this._wizard.theme&&this._wizard.theme.id||this._wizard.themeContext)!==f.GRAPHIC&&(b.theme=this._wizard.theme||this._wizard.viewModel.getCurrentTheme(this._wizard.themeContext));return b}})});