/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{getDataValues as i,quantizeFeatures as e,calculateHeatmapStats as a}from"./utils.js";import{calculateClassBreaks as n,resolveCBResult as t,calculateHistogram as o,isNullCountSupported as l,calculateStringStatistics as s,calculateStatistics as r,processSummaryStatisticsResult as m,calculateUniqueValuesCount as u,createUVResult as f}from"../../../statistics/utils.js";async function d(e){const{attribute:a,features:n}=e,{normalizationType:t,normalizationField:o,minValue:u,maxValue:f,fieldType:d,outStatisticTypes:p}=a,c=await i({field:a.field,valueExpression:a.valueExpression,normalizationType:t,normalizationField:o,normalizationTotal:a.normalizationTotal,viewInfoParams:a.viewInfoParams,timeZone:a.timeZone,fieldInfos:a.fieldInfos},n),v=l({normalizationType:t,normalizationField:o,minValue:u,maxValue:f}),z={value:.5,fieldType:d},T="esriFieldTypeString"===d?s({values:c,supportsNullCount:v,percentileParams:z,outStatisticTypes:p}):r({values:c,minValue:u,maxValue:f,useSampleStdDev:!t,supportsNullCount:v,percentileParams:z,outStatisticTypes:p});return m(T,p,"esriFieldTypeDate"===d)}async function p(e){const{attribute:a,features:n}=e,t=await i({field:a.field,field2:a.field2,field3:a.field3,fieldDelimiter:a.fieldDelimiter,valueExpression:a.valueExpression,viewInfoParams:a.viewInfoParams,timeZone:a.timeZone,fieldInfos:a.fieldInfos},n,!1),o=u(t);return f(o,a.domains,a.returnAllCodedValues,a.fieldDelimiter)}async function c(e){const{attribute:a,features:o}=e,{field:l,normalizationType:s,normalizationField:r,normalizationTotal:m,classificationMethod:u}=a,f=await i({field:l,valueExpression:a.valueExpression,normalizationType:s,normalizationField:r,normalizationTotal:m,viewInfoParams:a.viewInfoParams,timeZone:a.timeZone,fieldInfos:a.fieldInfos},o),d=n(f,{field:l,normalizationType:s,normalizationField:r,normalizationTotal:m,classificationMethod:u,standardDeviationInterval:a.standardDeviationInterval,numClasses:a.numClasses,minValue:a.minValue,maxValue:a.maxValue});return t(d,u)}async function v(e){const{attribute:a,features:n}=e,{field:t,normalizationType:l,normalizationField:s,normalizationTotal:r,classificationMethod:m}=a,u=await i({field:t,valueExpression:a.valueExpression,sqlExpression:a.sqlExpression,normalizationType:l,normalizationField:s,normalizationTotal:r,viewInfoParams:a.viewInfoParams,timeZone:a.timeZone,fieldInfos:a.fieldInfos},n);return o(u,{field:t,normalizationType:l,normalizationField:s,normalizationTotal:r,classificationMethod:m,standardDeviationInterval:a.standardDeviationInterval,numBins:a.numBins,minValue:a.minValue,maxValue:a.maxValue})}async function z(i){const{attribute:n,features:t}=i,{field:o,radius:l,transform:s,spatialReference:r}=n,m=n.size??[0,0],u=e(t??[],s,r,m);return a(u,l??void 0,o,m[0],m[1])}export{c as classBreaks,z as heatmapStatistics,v as histogram,d as summaryStatistics,p as uniqueValues};
