text: // All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  // See http://js.arcgis.com/3.34/esri/copyright.txt for details.
  //>>built
  define("esri/dijit/geoenrichment/ReportPlayer/core/dataDrilling/DataDrillingVisualizer","dojo/_base/declare dojo/_base/lang dojo/aspect esri/dijit/geoenrichment/when dojo/on dojo/keys dojo/query dojo/dom-class dojo/dom-construct dojo/dom-geometry dojo/dom-style dijit/Destroyable esri/dijit/geoenrichment/utils/DelayUtil esri/dijit/geoenrichment/utils/DeviceUtil esri/dijit/geoenrichment/utils/DomUtil esri/dijit/geoenrichment/utils/MouseUtil esri/dijit/geoenrichment/utils/TooltipUtil esri/dijit/geoenrichment/utils/WaitingUtil esri/dijit/geoenrichment/utils/animation/AnimationUtil esri/dijit/geoenrichment/utils/mobile/GesturesUtil ../sections/sectionUtils/SectionJsonUtil ../supportClasses/ViewModes ./DataDrillingBackgroundUtil ./DataDrillingExportUtil ../../ReportPlayerState dojo/i18n!esri/nls/jsapi".split(" "),
  function(q,C,D,x,k,E,y,l,v,F,m,G,w,g,n,H,z,I,h,A,J,K,L,r,B,t){t=t.geoenrichment.dijit.ReportPlayer.Infographics;var f={w:700,h:600,minW:400,minH:500};q=q(G,{viewModel:null,theme:null,parentWidget:null,currentFeatureIndex:null,currentFeatureAttributes:null,getPreviewValueFunction:null,ddZoomScreenClass:null,closeZoomedDDWhenClickedOutside:!0,closeZoomedDDOnEsc:!0,zIndex:null,domNode:null,ddZoomScreen:null,dataDrillingViewDiv:null,_drillingSections:null,_currentTriggerButtonBox:null,_toDataDrillingScale:1,
  constructor:function(a){C.mixin(this,a);this._buildLayout();g.isMobileDevice()&&A.preventDefaultOverflow(this.dataDrillingViewDiv)},_buildLayout:function(){function a(b,a){return v.create("div",{"class":b},a)}var b=this;this.dataDrillingViewDiv=a("dataDrilling_dataDrillingViewDiv esriGEReportPlayer esriGENonSelectable");this.drilledDataViewDiv=a("dataDrilling_drilledDataViewDiv esriGEAbsoluteStretched",this.dataDrillingViewDiv);this.drilledDataViewDivScaler=a("",this.drilledDataViewDiv);this.topToolbar=
  a("dataDrilling_topToolbar",this.dataDrillingViewDiv);this.dynamicSettingsToolbarRoot=a("dijitInline dataDrilling_dynamicSettingsToolbarRoot",this.topToolbar);this.exportButton=a("dijitInline dataDrilling_exportButton",this.topToolbar);this.printButton=a("dijitInline dataDrilling_printButton",this.topToolbar);this.backToMainViewButton=a("dijitInline dataDrilling_backToMainViewButton",this.topToolbar);k(this.backToMainViewButton,"click",function(){b.onClose()});var c=this.exportButton,d=this.printButton;
  n.hide([c,d]);this.viewModel.dynamicReportInfo&&(r.canExportDataDrilling(this.parentWidget)&&(z.setTooltipToNode(c,t.exportInfographic),n.show(c),k(c,"click",function(){r.exportDataDrilling(b)})),r.canPrintDataDrilling(this.parentWidget)&&(z.setTooltipToNode(d,t.printInfographic),n.show(d),k(d,"click",function(){r.printDataDrilling(b)})))},play:function(a,b,c,d,p){function u(b){b?(n.show(e.dataDrillingViewDiv),e.dataDrillingViewDiv.parentNode!==document.body&&document.body.appendChild(e.dataDrillingViewDiv),
  e.zIndex&&m.set(e.dataDrillingViewDiv,"zIndex",e.zIndex)):(e.dataDrillingViewDiv.parentNode===document.body&&document.body.removeChild(e.dataDrillingViewDiv),n.hide(e.dataDrillingViewDiv))}function f(){u(a);e._setZoomScreen(a,!1);e._setCloseHandlers(a);B.isViewingDataDrillingZoom=a;l[a?"add":"remove"](e.domNode,"isDrillingData");l.remove(e.domNode,"isShowingAnimation")}var e=this;this.viewModel.setBenchmarkDisabled&&this.viewModel.setBenchmarkDisabled(a);this._currentTriggerButtonBox=c?F.position(c):
  this._currentTriggerButtonBox;l.add(this.domNode,"isShowingAnimation");if(b)return u(!0),a?(b=this.getDataDrillingPanelDimensions(d),m.set(this.dataDrillingViewDiv,{width:b.w+"px",height:b.h+"px"})):b={w:this.dataDrillingViewDiv.clientWidth,h:this.dataDrillingViewDiv.clientHeight,scale:this._toDataDrillingScale},this._setZoomScreen(a,!0),a?(c=this._toDataDrillingScale=b.scale||1,b=h.animateResize({duration:200,domNode:this.dataDrillingViewDiv,fromBox:b.animateFromCenter||!this._currentTriggerButtonBox?
  {x:0,y:0,w:document.body.clientWidth,h:document.body.clientHeight}:this._currentTriggerButtonBox,startScaleX:.7*c,startScaleY:.7*c,fromOffset:{x:"c",y:"c"},toBox:{x:(document.body.clientWidth-b.w*c)/2,y:(document.body.clientHeight-b.h*c)/2+(b.yOffset||0),w:b.w,h:b.h},endScaleX:b.scale,endScaleY:b.scale,onEnd:f}),h.animateFadeIn({domNode:e.dataDrillingViewDiv,duration:100})):(b=h.animateResize({duration:200,domNode:this.dataDrillingViewDiv,toBox:this._currentTriggerButtonBox,startScaleX:b.scale,startScaleY:b.scale,
  endScaleX:.7*(b.scale||1),endScaleY:.7*(b.scale||1),toOffset:{x:"c",y:"c"},onEnd:f}),h.animateFadeOut({domNode:this.dataDrillingViewDiv,duration:100})),b=b&&b.then(function(){return w.delay(100)}),a&&d&&e.renderCustomSectionJson({sectionJson:d,fieldInfo:p,promise:b}),b;f()},_setZoomScreen:function(a,b){var c=this;a!==!!this.ddZoomScreen&&(a?(this.ddZoomScreen=v.create("div",{"class":"esriGEAbsoluteStretched dataDrilling_dataDrillingViewDivScreen"+(g.isMobileDevice()?" mobile":"")},this.dataDrillingViewDiv,
  "before"),g.isMobileDevice()&&A.preventDefaultOverflow(this.ddZoomScreen),this.zIndex&&m.set(this.ddZoomScreen,"zIndex",this.zIndex),this.ddZoomScreenClass&&l.add(this.ddZoomScreen,this.ddZoomScreenClass),b&&h.animateFadeIn({domNode:this.ddZoomScreen,duration:100})):(a=function(){c.ddZoomScreen&&v.destroy(c.ddZoomScreen);c.ddZoomScreen=null},b?h.animateFadeOut({domNode:this.ddZoomScreen,duration:100,onEnd:a}):a()))},_clickOutsideHandler:null,_keyboardHandler:null,_setCloseHandlers:function(a){var b=
  this;this._clickOutsideHandler&&this._clickOutsideHandler.remove();this._clickOutsideHandler=null;this._keyboardHandler&&this._keyboardHandler.remove();this._keyboardHandler=null;a&&(this.closeZoomedDDWhenClickedOutside&&(this._clickOutsideHandler=k(document.body,g.press,function(){if(!B.isViewingDynamicSettings&&!H.isMouseOver(b.dataDrillingViewDiv,{checkAllChildren:!0})&&!b._drillingSections[0].isMouseOver())b.onClose()})),this.closeZoomedDDOnEsc&&(this._keyboardHandler=k(document.body,"keyup",
  function(a){if(a.keyCode===E.ESCAPE)b.onClose()})))},updateView:function(){var a=this.getSection();if(a){var b=this.dataDrillingViewDiv,c=a.getWidth(),a=a.getHeight(),d=b.clientWidth,f=b.clientHeight,u=m.get(b,"left"),g=m.get(b,"top");b.style.width=c+"px";b.style.height=a+"px";b.style.left=u+-(c-d)/2+"px";b.style.top=g+-(a-f)/2+"px"}},getDataDrillingPanelDimensions:function(a){var b=document.body.clientWidth-(g.isLandscape()?80:40),c=document.body.clientHeight-80;if(a){var d=J.calcSectionJsonBox(a),
  p=a.style&&a.style.width||d.w||f.w;a=a.style&&a.style.height||d.h||f.h;d=Math.min(1,b/p,c/a);return g.isMobileDevice()?{w:p,h:a,scale:d,yOffset:10,animateFromCenter:!0}:{w:p,h:a,scale:d,yOffset:c-30>a?0:15}}d=Math.max(.7,Math.min(1,b/f.minW,c/f.minH));return g.isMobileDevice()?{w:b/d,h:c/d,scale:d,yOffset:10,animateFromCenter:!0}:{w:Math.min(b/d,f.w),h:Math.min(c/d,f.h),scale:d,yOffset:c-30>f.h?0:15}},renderCustomSectionJson:function(a){var b=this;this.destroyContent();var c,d=this.getDataDrillingPanelSectionParams(a.sectionJson);
  this._showDDProgress(!0);return x(a.promise).then(function(){return w.delay(function(){c=b._createDataDrillingSection(d);c.fitContentNicely();c.domNode.style.opacity="0.01";return x(c.getRenderPromise(),function(){return w.delay(function(){c.domNode.style.opacity="";c.notifyShown();b._showDDProgress(!1);b.onCustomSectionRendered(a)})})})})},getDataDrillingPanelSectionParams:function(a){var b={"class":"infographicContainer_dataDrillingSection"},c=this.getDataDrillingPanelDimensions(a);b.json=a;b.initialWidth=
  c.w;b.initialHeight=c.h;b.viewModel=this.viewModel;b.theme=this.theme;b.parentWidget=this;b.isDataDrillingView=!0;b.currentFeatureIndex=this.currentFeatureIndex||0;b.currentFeatureAttributes=this.currentFeatureAttributes;b.getPreviewValueFunction=this.getPreviewValueFunction;b.initialViewMode=K.PREVIEW_VALUES;this.dynamicSettingsToolbarRoot.innerHTML="";b.dynamicSettingsToolbarRoot=this.dynamicSettingsToolbarRoot;return b},_createDataDrillingSection:function(a){var b=this.getDataDrillingPanelDimensions(a.json);
  a=this.viewModel.layoutBuilder.createElement("section",a,this.drilledDataViewDivScaler);this._drillingSections.push(a);l[y(".sectionDynamicSettings_settingsButton",this.dataDrillingViewDiv)[0]?"add":"remove"](this.dataDrillingViewDiv,"hasChartSettingsButton");this.setUpDDPanelBackgroundColor();b.scale&&(a.notifyPanelScaleChanged(b.scale),this._applyScaleToDataDrillingToolbarButtons(b.buttonScale||b.scale),D.after(a,"onDynamicSettingsButtonsCreated",function(){this._applyScaleToDataDrillingToolbarButtons(b.buttonScale||
  b.scale)}.bind(this)));return a},getSection:function(){return this._drillingSections[0]},_applyScaleToDataDrillingToolbarButtons:function(a){var b=1/a;a=[];var c=y(".sectionDynamicSettings_buttonBar",this.dynamicSettingsToolbarRoot)[0];if(c)for(var d=0;d<c.children.length;d++)a.push(c.children[d]);a.push(this.exportButton);a.push(this.printButton);a.push(this.backToMainViewButton);a.forEach(function(a,c){a.style.transformOrigin="100% 100%";a.style.transform="scale("+b+")";a.style["webkit-transform"]=
  "scale("+b+")";0<c&&(c=26*b,c+=32*(b-1),a.style.marginLeft=c+"px")})},setUpDDPanelBackgroundColor:function(){L.setUpDDPanelBackgroundColor({viewModel:this.viewModel,theme:this.theme,infographicJson:this.getInfographicJson(),node:this.dataDrillingViewDiv})},getInfographicJson:function(){return null},_showDDProgress:function(a){I[a?"showProgress":"removeProgress"](this.dataDrillingViewDiv);this.topToolbar&&(this.topToolbar.style.opacity=a?"0.001":"")},destroyContent:function(){this._drillingSections=
  this._drillingSections||[];this._drillingSections.forEach(function(a){a.destroy()});this._drillingSections.length=0;this.drilledDataViewDivScaler.innerHTML=""},onClose:function(){},onCustomSectionRendered:function(a){},destroy:function(){this.destroyContent();this._setCloseHandlers(!1)}});q.DATA_DRILLING_BOX_ZOOM=f;return q});