import{executeQuery as e,executeCount as t}from"../../support/_query.js";import{isFeatureCollectionLayerExtension as r,isFeatureLayerExtension as o}from"../../utilities/extensions.js";import{removeZValues as s}from"../../utilities/geometry.js";import{isFeatureLayer as a}from"../../utilities/layers.js";import{IdentifyProviderBase as i}from"./IdentifyProviderBase.js";export class FeatureLayerQueryIdentifyProvider extends i{isSupported(e,t,s){return(o(e)||r(e))&&a(e.layer)}_identify(t,r,o){const s=t,a=s.layer.createQuery(),i=r;return a.geometry=i,a.outFields=o.outFields??t.featureSettings.outFields,a.returnGeometry=o.returnGeometry,a.outSpatialReference=o.outSpatialReference,a.maxAllowableOffset=o.maxAllowableOffset,s.layer.capabilities.query.supportsPagination&&(a.num=o.maxResults),a.returnZ=s.layer.hasZ,e(a,s,s.layer,o.cancelToken)}_count(e,r,o){const a=e,i=a.layer.createQuery();let l=r;return!l||a.layer.hasZ&&a.layer.capabilities?.data?.supportsZ||(l=s(l.clone())),i.geometry=l,i.num=o.maxResults,i.returnGeometry=o.returnGeometry,i.outFields=o.outFields??e.featureSettings.outFields,t(i,a,a.layer,o.cancelToken)}}