// 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/ReportContainerGrid.html":'\x3cdiv class\x3d"esriGEReportPlayer_reportContainerGrid esriGENonSelectable"\x3e\r\n    \x3cdiv data-dojo-attach-point\x3d"mainContainer" class\x3d"reportContainerGrid_mainContainer"\x3e\r\n        \x3cdiv data-dojo-attach-point\x3d"fillerContainer" class\x3d"reportContainerGrid_gridZoomFillerContainer"\x3e\r\n            \x3cdiv data-dojo-attach-point\x3d"scalableContainer" class\x3d"reportContainerGrid_gridZoomScalableContainer"\x3e\r\n                \x3cdiv data-dojo-attach-point\x3d"stackContainer" class\x3d"reportContainerGrid_gridStackContainer"\x3e\x3c/div\x3e\r\n            \x3c/div\x3e\r\n        \x3c/div\x3e\r\n    \x3c/div\x3e\r\n\x3c/div\x3e'}});
define("esri/dijit/geoenrichment/ReportPlayer/core/reportContainers/ReportContainerGrid","dojo/_base/declare dojo/_base/lang dojo/Deferred dojo/when dojo/on dojo/sniff dojo/dom-construct dojo/dom-class dojo/dom-geometry dojo/dom-style dojo/store/Memory dijit/_WidgetBase dijit/_TemplatedMixin ./reportContainerGridSupports/_HiddenContentSupport ./reportContainerGridSupports/_ScrollSupport ./reportContainerGridSupports/_ZoomSupport ../grid/coreUtils/GridDataUtil ./containerGridUtils/QueryUtil ./containerGridUtils/SerializationManager ./containerGridUtils/ContentLoadingEventManager ../supportClasses/DocumentOptions ../supportClasses/templateJsonUtils/fieldInfo/FieldInfoBuilder ../themes/BackgroundThemeUtil esri/dijit/geoenrichment/utils/DomUtil esri/dijit/geoenrichment/ReportPlayer/core/sections/SectionTypes esri/dijit/geoenrichment/ReportPlayer/core/supportClasses/ViewModes dojo/text!../templates/ReportContainerGrid.html".split(" "),
function(p,l,q,k,H,r,e,g,f,d,t,u,v,w,x,y,m,h,z,A,B,C,D,E,F,n,G){return p([u,v,w,x,y],{templateString:G,viewModel:null,themeContext:null,theme:null,parentWidget:null,isSourceContainer:!0,showWatermark:!0,documentOptions:null,loadingManager:null,serializationManager:null,renderOptions:{center:!1,minTop:0},_grids:null,_enableAsyncRendering:!0,postCreate:function(){this.serializationManager=(new this._getSerializationManagerClass)(this);this._grids=[];this.inherited(arguments);this.updateLayout();this.setViewMode(n.PREVIEW_VALUES);
this.isSourceContainer&&g.add(this.domNode,"reportContainerGrid_sourceContainer")},_getSerializationManagerClass:function(){return z},setDocumentOptions:function(a,b){this.documentOptions&&l.mixin(this.documentOptions,a);this.updateLayout(b)},updateLayout:function(a){var b=this;this.documentOptions&&(this._updateContainerSize(),this._grids.forEach(function(c,d){a&&void 0!==a.pageIndex&&a.pageIndex!==d||(b._updateGridWrappingNodeForCurrentDocumentLayout(c),c.setMaxWidth(b._getAllowedPageWidth()),c.resizeToFitAllowedWidth(),
c.resizeToFitHeight(b._getPageHeight()))}),this._syncFillerContainer())},getFirstPageDomNode:function(){var a=this.stackContainer.children[0];return a&&a.children[0]},getPageDomNodes:function(){return this._getGridContainers()},_getGridContainers:function(){for(var a=[],b=0;b<this.stackContainer.children.length;b++){var c=this.stackContainer.children[b];c&&a.push(c.children[0])}return a},_placeGridContainer:function(a,b){var c=e.create("div",{"class":"reportContainerGrid_gridContainerWrapper"}),d=
void 0!==b&&this.stackContainer.children[b];d?e.place(c,d,"before"):e.place(c,this.stackContainer);e.place(a,c);a.backgroundImage=e.create("div",{"class":"reportContainerGrid_stackContainerBackgroundImage esriGEAbsoluteStretched"},a);r("ie")||this.viewModel.dynamicReportInfo||!this.showWatermark||(this._sampleWatermarkDiv=e.create("div",{"class":"sampleValuesWatermark esriGEAbsoluteStretched"},a,"first"))},getGridContainer:function(a){return this._getGridContainer(a)},_getGridContainer:function(a){a=
a.isFloatingTable?a.parentGrid:a;return a.domNode&&a.domNode.parentNode},_getGridContainerWrapper:function(a){return(a=this._getGridContainer(a))&&a.parentNode},_updateGridWrappingNodeForCurrentDocumentLayout:function(a){a.isEmptyTable()&&d.set(a.domNode,{width:this._getAllowedPageWidth()+"px",height:this._getPageHeight()+"px"});if(a=this._getGridContainer(a)){var b=this.viewModel.getDocumentDefaultStyles(this.theme||this.themeContext);d.set(a,{paddingLeft:(this.documentOptions.left||0)+"px",paddingRight:(this.documentOptions.right||
0)+"px",paddingTop:(this.documentOptions.top||0)+"px",paddingBottom:(this.documentOptions.bottom||0)+"px",backgroundColor:this.documentOptions.backgroundColor||b.backgroundColor})}D.applyBackgroundImageFromSettings(a.backgroundImage,b.backgroundImage)},_updateContainerSize:function(){var a=0===this._heigth?"auto":d.get(this.domNode,"height")+"px";d.set(this.mainContainer,"height",a);d.set(this.mainContainer,"maxWidth",this._maxWidth?this._maxWidth+"px":"");d.set(this.mainContainer,"maxHeight",this._maxHeight?
this._maxHeight+"px":"");this._syncFillerContainer()},getCurrentPageDim:function(){return B.getPageBox(this.documentOptions)},_getAllowedPageWidth:function(){return this.getCurrentPageDim().contentW},_getPageHeight:function(){return this.getCurrentPageDim().contentH},getCanvasOffsets:function(){var a=f.position(this.mainContainer),b=f.position(this.fillerContainer);return{l:b.x-a.x,r:a.x+a.w-b.x-b.w}},_currentPageIndex:-1,getFullWidth:function(){var a=this.getFirstPageDomNode();return f.getMarginBox(a).w+
f.getMarginExtents(this.stackContainer).w},getFullHeight:function(){var a=this.getFirstPageDomNode();return f.getMarginBox(a).h+f.getMarginExtents(this.stackContainer).h},getNumberOfPages:function(){return this._grids.length},showAllPages:function(){this.showPageAt(-1)},showPageAt:function(a){this._grids.forEach(function(b,c){var d=-1===a||a===c;E[d?"showNodeFromBackground":"hideNodeInBackground"](this._getGridContainerWrapper(b),"reportContainerPage_"+c);this.isCurrentContainer()&&d&&b.notifyShown()},
this);this._currentPageIndex=a;this._syncFillerContainer()},getShownGrid:function(){return this._grids[this._currentPageIndex]},getCurrentPageIndex:function(){return this._currentPageIndex},getGrids:function(){return this._grids},isCurrentContainer:function(){return!1},_width:0,_heigth:0,resize:function(a,b){this._width=void 0===a?this._width:a;this._heigth=void 0===b?this._heigth:b;void 0!==a&&d.set(this.domNode,"width",0===this._width?"auto":this._width+"px");void 0!==b&&d.set(this.domNode,"height",
0===this._heigth?"auto":this._heigth+"px");this._updateContainerSize()},_maxWidth:0,_maxHeight:0,setMaxWidth:function(a){this._maxWidth=a},setMaxHeight:function(a){this._maxHeight=a},screenToPageCoords:function(a,b){return h.screenToPageCoords(this,a,b)},getLayoutCells:function(a,b){return h.getLayoutCells(this,a,b)},getCellPageGrid:function(a){return a&&a.parentGrid?a.parentGrid.isFloatingTable?a.parentGrid.parentGrid:a.parentGrid:null},clear:function(a){this._grids.forEach(function(a,c){a.destroy()},
this);this._grids.length=0;this.stackContainer&&e.empty(this.stackContainer);this._syncFillerContainer()},_removeGrid:function(a){if(a){var b=this._getGridContainerWrapper(a);a.destroy();b&&e.destroy(b);a=this._grids.indexOf(a);this._grids.splice(a,1);this._syncFillerContainer()}},removeGridAt:function(a){this._removeGrid(this._grids[a])},getGridJsonAt:function(a){return this._grids[a].toJson()},setHeight:function(a){d.set(this.mainContainer,"height",a+"px")},_viewMode:null,getViewMode:function(){return this._viewMode},
setViewMode:function(a){this._viewMode!==a&&(this._viewMode=a,a===n.EDIT?(g.add(this.domNode,"reportContainerEditMode"),g.remove(this.domNode,"reportContainerPreviewMode")):(g.remove(this.domNode,"reportContainerEditMode"),g.add(this.domNode,"reportContainerPreviewMode")),this._updateContainerSize(),this._grids.forEach(function(b,c){b.setViewMode(a)},this))},hasFocusedChild:function(){return h.hasFocusedChild(this)},collectFieldInfos:function(a){return h.collectFieldInfos(this,a)},createGridFromSectionTableJson:function(a,
b,c){void 0!==b&&"replace"===c&&this._removeGrid(this._grids[b]);c=e.create("div",{"class":"reportContainerGrid_stackContainer"});this._placeGridContainer(c,b);a=this._createGridFromTableJson(a,c);a.setMaxWidth(this._getAllowedPageWidth());a.setSettings({style:{width:this._getAllowedPageWidth(),left:0,spaceBefore:0,spaceAfter:0}});this._updateGridWrappingNodeForCurrentDocumentLayout(a);void 0!==b?this._grids.splice(b,0,a):this._grids.push(a);this._syncFillerContainer();return a},_getGridClass:function(){return this.viewModel.layoutBuilder.getClass("grid")},
_createGridFromTableJson:function(a,b){var c=this;a.data=a.data||{};var d=new (this._getGridClass())(l.mixin({"class":"outerAdjustableGrid",fieldCellClass:"outerAdjustableGridCell",viewModel:this.viewModel,themeContext:this.themeContext,theme:this.theme,parentWidget:this,viewPortContainer:this.mainContainer,reportContainerPageNode:b,columns:a.data.columns||[],store:new t({data:a.data.data||[],idProperty:"id"}),backgroundSectionJson:a.backgroundSectionJson,foregroundSectionJson:a.foregroundSectionJson,
floatingTablesSectionJson:a.floatingTablesSectionJson,stickToRight:!0,keepGridSizeWhenResized:!1,looseResize:!0,layoutDefaults:{defaultRowHeight:250,rowMinHeight:100,columnMinWidth:100},renderBordersFromTheme:!0,hasRealBorders:!0,inheritThemeBackground:!1,enableBackgroundForeground:!0,enableAsyncRendering:this._enableAsyncRendering,_preRenderFieldCell:function(a){m.getFieldInfo(a)||c.isSourceContainer||m.setFieldInfo(a,c.createEmptySectionJson())},_postCreateFieldCell:function(a){c._postCreateFieldCell(a)},
onContentLoadingStart:function(){c.loadingManager&&c.loadingManager.onContentLoadingStart()},onContentLoadingEnd:function(){c.loadingManager&&c.loadingManager.onContentLoadingEnd()}},this._getGridCreationParams(b)),e.create("div",null,b));d.setViewMode(this._viewMode);return d},_postCreateFieldCell:function(a){},createEmptySectionJson:function(){return C.createFieldInfoFromSection({type:F.EMPTY})},_getGridCreationParams:function(a){return null},notifyShown:function(){this.serializationManager.notifyShown()},
getVisualState:function(){return{pages:this._grids.map(function(a,b){return{grid:a.getVisualState()}})}},setVisualState:function(a){a&&a.pages&&a.pages.length===this._grids.length&&this._grids.forEach(function(b,c){b.setVisualState(a.pages[c].grid)})},_syncFillerContainer:function(){if(this.domNode){var a=this.getZoomInfo().scale;d.set(this.fillerContainer,"marginTop","");d.set(this.fillerContainer,{width:d.get(this.scalableContainer,"width")*a+"px",height:d.get(this.scalableContainer,"height")*a+
"px"});this.renderOptions&&this.renderOptions.center&&(a=(d.get(this.mainContainer,"height")-d.get(this.fillerContainer,"height"))/2,d.set(this.fillerContainer,"marginTop",Math.max(this.renderOptions.minTop||0,a)+"px"));this.onViewSyncronized()}},onViewSyncronized:function(){},_pagePromise:null,_contentPromise:null,fromJson:function(a,b){b=b||{};var c=this;this._enableAsyncRendering=!b.renderSync;this._contentPromise=this._pagePromise=null;var d;b.keepZoom?d=this.getZoomInfo():this.resetZoom();this._currentPageIndex=
-1;this.loadingManager&&this.loadingManager.destroy();this.loadingManager=null;var e=new q;b.waitUntilAllContentIsReady?(this.loadingManager=new A,this.loadingManager.init(),this._pagePromise=this.serializationManager.fromJson(a,b),this._contentPromise=k(this._pagePromise,function(){this.loadingManager.notifyPagesLoaded();return this.loadingManager.returnOnLoadEnd()}.bind(this))):this._pagePromise=this.serializationManager.fromJson(a,b);k(b.waitUntilAllContentIsReady?this._contentPromise:this._pagePromise,
e.resolve,e.reject);return k(e.promise,function(){d&&c.setZoomInfo(d)})},getPagePromise:function(){return this._pagePromise},getContentPromise:function(){return this._contentPromise},toJson:function(a){return this.serializationManager.toJson(a)},onPendingDataApplied:function(){},destroy:function(){this.loadingManager&&this.loadingManager.destroy();this.loadingManager=null;this.clear();this.inherited(arguments)}})});