/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../../chunks/_rollupPluginBabelHelpers","../../core/Error","../../core/maybe","../../layers/support/fieldUtils","../../renderers/support/heatmapUtils","./support/utils","../support/utils","../support/adapters/support/layerUtils"],(function(e,r,a,t,i,s,n,l){"use strict";const p=t.numericTypes;function u(e){return y.apply(this,arguments)}function y(){return(y=e._asyncToGenerator((function*(e){if(!(e&&e.layer&&e.view))throw new r("heatmap-statistics:missing-parameters","'layer' and 'view' parameters are required");const t=[l.LayerType.CSVLayer,l.LayerType.FeatureLayer,l.LayerType.OGCFeatureLayer,l.LayerType.GeoJSONLayer,l.LayerType.WFSLayer],{layer:u,...y}=e,o=l.createLayerAdapter(u,t),d={layerAdapter:o,...y};if(d.radius=null==d.radius?null==d.blurRadius?18:i.gaussianBlurRadiusPxToKernelDensityRadiusPt(d.blurRadius):d.radius,!o)throw new r("heatmap-statistics:invalid-parameters","'layer' must be one of these types: "+l.getLayerTypeLabels(t).join(", "));const c=a.isSome(d.signal)?{signal:d.signal}:null;yield o.load(c);const f=d.field,h=f?o.getField(f):null,m=yield n.getFieldsList({field:f}),L=s.verifyBasicFieldValidity(o,m,"heatmap-statistics:invalid-parameters");if(L)throw L;if(h){const e=s.verifyFieldType(o,h,"heatmap-statistics:invalid-parameters",p);if(e)throw e}return d}))).apply(this,arguments)}function o(e){return d.apply(this,arguments)}function d(){return(d=e._asyncToGenerator((function*(e){const{layerAdapter:r,...a}=yield u(e);return r.heatmapStatistics(a)}))).apply(this,arguments)}return o}));
