// 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/Legend/utils",["dojo/_base/lang","../../lang","dojo/i18n!../../nls/jsapi"],function(h,l,r){var m=r.widgets.legend;return{getVisualVariableTitle:function(a,d){var e,b=a.field,c=a.normalizationField,f=!1,n=!1,p=!1,k,b=h.isFunction(b)?null:b,c=h.isFunction(c)?null:c;if(a.legendOptions&&a.legendOptions.title)e=a.legendOptions.title;else if(a.valueExpressionTitle)e=a.valueExpressionTitle;else{if(d.renderer&&d.renderer.authoringInfo&&d.renderer.authoringInfo.visualVariables){var q=d.renderer.authoringInfo.visualVariables;
for(k=0;k<q.length;k++){var g=q[k];if("colorInfo"===g.type&&"ratio"===g.style){f=!0;break}else if("colorInfo"===g.type&&"percent"===g.style){n=!0;break}else if("colorInfo"===g.type&&"percentTotal"===g.style){p=!0;break}}}(f=p&&"showRatioPercentTotal"||n&&"showRatioPercent"||f&&"showRatio"||c&&"showNormField"||b&&"showField"||null)&&(e=l.substitute({field:b&&d.getFieldLabel(b),normField:c&&d.getFieldLabel(c)},m[f]))}return e},getRendererTitle:function(a,d){var e;if(a){var b,c,f;"esri.renderer.ClassBreaksRenderer"===
a.declaredClass&&(b=a.attributeField,c=a.normalizationField,f="percent-of-total"===a.normalizationType);b=h.isFunction(b)?null:b;c=h.isFunction(c)?null:c;a.legendOptions&&a.legendOptions.title?e=a.legendOptions.title:a.valueExpressionTitle?e=a.valueExpressionTitle:(f=c&&"showNormField"||(f?"showNormPct":null)||b&&"showField"||null)&&(e=l.substitute({field:b&&d.getFieldLabel(b),normField:c&&d.getFieldLabel(c)},m[f]))}return e}}});