// 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/dataProviders/commands/CreatePlayerCommand","dojo/_base/declare dojo/promise/all dojo/when dijit/Dialog ./createHTML/HTMLStringBuilder esri/dijit/geoenrichment/utils/FileUtil ./supportClasses/MapToImageUtil ./supportClasses/PlayerCommands ../supportClasses/GEUtil dojo/i18n!../../../../../nls/jsapi ../../_devConfig".split(" "),function(l,u,d,m,n,g,p,q,r,c,e){c=c.geoenrichment.dijit.ReportPlayer.ReportPlayer;var t={buildHTMLPageString:function(b,a,d){b=
a.config.createPlayerCommand.prettifyDataJson||e.createPlayerCommand.saveDataJsonAsTextFile?JSON.stringify(b,void 0,4):JSON.stringify(b);e.createPlayerCommand.saveDataJsonAsTextFile&&g.saveTextFile(b,"reportDataJson");var c=[];c.push('html, body, #layoutNode { padding: 0px; margin: 0px; height: 100%; overflow: hidden; font-size: 13px; font-family: "Avenir Next"; }');return n.composeHtmlStringFromParts({reportTitle:a.getReportTitle(),links:[a.config.esriDijitCssUrl,a.config.esriCssUrl],cssFiles:c,
scripts:[{src:a.config.playerSourceRootUrl+a.config.playerConfigUrl},{"data-dojo-config":"baseUrl: '"+a.config.playerSourceRootUrl+"', isDebug: 1, waitSeconds: 60",src:a.config.playerSourceRootUrl+a.config.playerMainUrl},'require(["require", "esri/dijit/geoenrichment/nlsFix"],\nfunction (relativeRequire, nlsFix) {\n   nlsFix.load(null, relativeRequire);\n   require([\n       "dojo/when",\n       "dojo/sniff",\n       "esri/dijit/geoenrichment/ReportPlayer/ReportPlayer",\n       "esri/dijit/geoenrichment/ReportPlayer/dataProviders/DataProviderGE",\n       "esri/dijit/geoenrichment/ReportPlayer/PlayerResizeModes",\n       "esri/dijit/geoenrichment/ReportPlayer/PlayerZoomBehaviors",\n       "esri/dijit/geoenrichment/ReportPlayer/dataProviders/commands/supportClasses/PlayerCommands",\n       "esri/dijit/geoenrichment/utils/UrlUtil",\n       "dojo/domReady!"\n   ],\n   function (\n       when,\n       has,\n       ReportPlayer,\n       DataProviderGE,\n       PlayerResizeModes,\n       PlayerZoomBehaviors,\n       PlayerCommands,\n       UrlUtil\n   ) {\n       esriConfig.defaults.io.proxyUrl \x3d UrlUtil.getVariableValue(window.location.href, "proxy") || null;\n       var reportDataJson \x3d '+
b+';\n       var dataProvider \x3d new DataProviderGE();\n       dataProvider.registerCommand(PlayerCommands.PRINT);\n       if (!has("ie") \x26\x26 !has("trident"))\n       dataProvider.registerCommand(PlayerCommands.IMAGE);\n       var player \x3d new ReportPlayer({\n           isSlidesView: UrlUtil.getVariableValue(window.location.href, "slidesView"),\n           dataProvider: dataProvider,\n           enableDataDrilling: '+d+",\n           resizeMode: PlayerResizeModes.FIT_WINDOW,\n           defaultZoomBehavior: PlayerZoomBehaviors.FIT_PAGE,\n           onError: function(e) {\n               console.log(e);\n           }\n       }).placeAt(layoutNode);\n       when(dataProvider.reportDataFromJson(reportDataJson), function (reportData) {\n           player.setReportData(reportData);\n       });\n   });\n});"],
contentString:'\x3cdiv id\x3d"layoutNode"\x3e\x3c/div\x3e'})}};return l(null,{id:q.DYNAMIC_HTML,label:c.createDynamicHTMLCommandLabel,errorMessage:c.exportInfographicError,execute:function(b,a){function c(a){var c=t.buildHTMLPageString(a,b,h);f.htmlString=c;var d=b.getReportTitle()+".html";return c&&e._confirmSaveFile(d,function(){g.saveTextFile(c,d,"text/html")})}a=a||{};var e=this,k=a.printableContainer,h=k.allowDataDrilling(),f={htmlString:null};return d(p.collectMapsAsImages(b,{saveImagesAsBase64:!0}),
function(e){return d(b.dataProvider.reportDataToJson(b.getReportData(),{allowDataDrilling:h,mapImageInfos:e}),function(e){if(a.returnReportDataJson)f=e;else return d(c(e),function(){a.creditsTaskID&&r.consumeCredits(b.getReportData().config.geoenrichmentUrl,a.creditsTaskID)})})}).otherwise(this._handleError.bind(this)).always(function(){return d(k.stop(),function(){return f})})},_handleError:function(b){console.log(b);(new m({title:"Error",content:this.errorMessage})).show()},_confirmSaveFile:function(b,
a){return a()}})});