/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../chunks/_rollupPluginBabelHelpers","../../../core/Error","../../../core/maybe","../../../intl/number","../../../renderers/support/rasterRendererHelper","../support/utils"],(function(e,r,t,a,s,n,o){"use strict";function i(e){return l.apply(this,arguments)}function l(){return(l=r._asyncToGenerator((function*(e){const r=(e=yield o.processRasterRendererParameters(e)).layer,{rasterInfo:s}=r;if(s.bandCount>1)throw new t("raster-class-breaks-renderer:not-supported","Multiband raster is not supported");e.field||(e.field=a.isSome(s.attributeTable)?n.getField(s.attributeTable,"value").name:"value");if(!(a.isSome(s.attributeTable)&&s.attributeTable.fields.find((r=>r.name.toLowerCase()===e.field.toLowerCase())))&&!a.isSome(s.histograms)&&(yield r.updateRasterInfoWithEstimatedStats({renderingRule:e.renderingRule,signal:e.signal}),a.isNone(s.histograms)))throw new t("raster-class-breaks-renderer:not-supported","Histograms or raster attribute table is required on the source raster. Unable to estimate histograms");const{colors:i,numClasses:l}=e;if(i&&l&&i.length!==l)throw new t("raster-class-breaks-renderer:not-supported","The size of the `colors` parameter does not match 'numClasses'");return e.classificationMethod||(e.classificationMethod="natural-breaks"),e}))).apply(this,arguments)}function u(e){return c.apply(this,arguments)}function c(){return(c=r._asyncToGenerator((function*(e){e=yield i(e);const r=n.createClassBreaksRenderer(e.layer.rasterInfo,e);if(a.isNone(r))throw new t("raster-class-breaks-renderer:not-supported","Class breaks renderer is not supported on this data");const s={minValue:r.minValue,maxValue:r.classBreakInfos[r.classBreakInfos.length-1].maxValue,normalizationTotal:null,classBreakInfos:r.classBreakInfos.map((e=>{const r=d(e.minValue,e.maxValue);return e.label=r,{minValue:e.minValue,maxValue:e.maxValue,label:r}}))};return{renderer:r,classBreaksResult:s}}))).apply(this,arguments)}function d(e,r){return s.formatNumber(e,{maximumFractionDigits:3})+" - "+s.formatNumber(r,{maximumFractionDigits:3})}e.createRenderer=u,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
