// 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/supportClasses/AreasPreprocessor","dojo/_base/Color dojo/when dojo/promise/all esri/graphic esri/symbols/SimpleFillSymbol esri/symbols/SimpleLineSymbol esri/tasks/FeatureSet ./FeatureNameUtil ./tasks/EnrichAreasTask ./CustomReportsManager esri/dijit/geoenrichment/utils/GeometryUtil".split(" "),function(f,d,m,n,p,g,q,r,t,u,h){var k={},e={symbolizeFeature:function(b){function c(){var a=new p;a.setOutline(new g(g.STYLE_SOLID,new f([105,134,
68,.55]),2));a.setColor(new f([105,134,68,.55]));return a}b.symbol||b.setSymbol(c())},symbolizeAreas:function(b){b.forEach(function(b){b.feature&&e.symbolizeFeature(b.feature)})}},w={generalize:function(b){var c=[],a=[];b.forEach(function(b,v){!b.feature||b.geographies&&b.geographies.length||(c.push(b.feature),a.push(v))});return d(function(a,b){b=void 0!==b?b:0;var c=h.needGeneralizeGeometry(a,0<b?3*b:-3,0),l;c&&(a=a.map(function(a){return new n(a.geometry,a.symbol,a.attributes)}),l=h.generalizeGeometry(a,
c,0,!0));return d(l,function(){return a})}(c),function(c){a.forEach(function(a){b[a].feature=c[a]})})}},x={provideAreaFeatures:function(b){return d(u.getCustomReportByID(b),function(c){return m(b.analysisAreas.map(function(a){if(!a.feature&&a.geographies&&a.geographies.length)return(new t).createFeatureForGeographies(a.geographies,{countryID:b.countryID,hierarchy:c.hierarchy,geoenrichmentUrl:b.geoenrichmentUrl}).then(function(b){b=new q(b[0]);a.feature=b.features[0];e.symbolizeFeature(a.feature)})}))})}};
k.preprocessAreas=function(b,c){b.analysisAreas=b.analysisAreas.filter(function(a){return a.feature&&a.feature.geometry&&"polygon"===a.feature.geometry.type||a.geographies&&a.geographies.length});-1!==c.analysisAreasLimit&&(c.analysisAreasLimit=c.analysisAreasLimit||10,b.analysisAreas.length=Math.min(b.analysisAreas.length,c.analysisAreasLimit));b.analysisAreas.forEach(function(a){a.feature&&!a.feature.attributes&&(a.feature.attributes={})});!1!==c.provideNames&&b.analysisAreas.forEach(function(a){a.name=
a.name||a.shortName;if(!a.name&&a.feature){var b=r.guessFeatureName(a.feature);b&&(a.name=a.shortName=b)}});c.symbolizeAreas&&e.symbolizeAreas(b.analysisAreas);return d(!1!==c.generalize&&w.generalize(b.analysisAreas),function(){return!1!==c.provideFeaturesForGeographies&&x.provideAreaFeatures(b)})};return k});