/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{getDataValues as i,quantizeFeatures as e,calculateHeatmapStats as a}from"./utils.js";import{calculateStringStatistics as n,calculateStatistics as t,processSummaryStatisticsResult as o,calculateUniqueValuesCount as l,createUVResult as s,calculateClassBreaks as r,resolveCBResult as m,calculateHistogram as u,isNullCountSupported as f}from"../../../statistics/utils.js";async function d(e){const{attribute:a,features:l}=e,{normalizationType:s,normalizationField:r,minValue:m,maxValue:u,fieldType:d,outStatisticTypes:p}=a,c=await i({field:a.field,valueExpression:a.valueExpression,normalizationType:s,normalizationField:r,normalizationTotal:a.normalizationTotal,viewInfoParams:a.viewInfoParams,timeZone:a.timeZone,fieldInfos:a.fieldInfos},l),v=f({normalizationType:s,normalizationField:r,minValue:m,maxValue:u}),z={value:.5,fieldType:d},T="esriFieldTypeString"===d?n({values:c,supportsNullCount:v,percentileParams:z,outStatisticTypes:p}):t({values:c,minValue:m,maxValue:u,useSampleStdDev:!s,supportsNullCount:v,percentileParams:z,outStatisticTypes:p});return o(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=l(t);return s(o,a.domains,a.returnAllCodedValues,a.fieldDelimiter)}async function c(e){const{attribute:a,features:n}=e,{field:t,normalizationType:o,normalizationField:l,normalizationTotal:s,classificationMethod:u}=a,f=await i({field:t,valueExpression:a.valueExpression,normalizationType:o,normalizationField:l,normalizationTotal:s,viewInfoParams:a.viewInfoParams,timeZone:a.timeZone,fieldInfos:a.fieldInfos},n),d=r(f,{field:t,normalizationType:o,normalizationField:l,normalizationTotal:s,classificationMethod:u,standardDeviationInterval:a.standardDeviationInterval,numClasses:a.numClasses,minValue:a.minValue,maxValue:a.maxValue});return m(d,u)}async function v(e){const{attribute:a,features:n}=e,{field:t,normalizationType:o,normalizationField:l,normalizationTotal:s,classificationMethod:r}=a,m=await i({field:t,valueExpression:a.valueExpression,sqlExpression:a.sqlExpression,normalizationType:o,normalizationField:l,normalizationTotal:s,viewInfoParams:a.viewInfoParams,timeZone:a.timeZone,fieldInfos:a.fieldInfos},n);return u(m,{field:t,normalizationType:o,normalizationField:l,normalizationTotal:s,classificationMethod:r,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};
