/*
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","../../chunks/tslib.es6","../../geometry","../../TimeExtent","../../core/jsonMap","../../core/JSONSupport","../../core/lang","../../core/accessorSupport/decorators/property","../../core/accessorSupport/ensureType","../../core/accessorSupport/decorators/subclass","../../core/accessorSupport/decorators/writer","../../geometry/support/jsonUtils","./TopFilter","../../geometry/SpatialReference"],(function(e,t,r,o,i,s,p,n,a,l,c,d,u,y){"use strict";var _;const h=new i.JSONMap({esriSpatialRelIntersects:"intersects",esriSpatialRelContains:"contains",esriSpatialRelCrosses:"crosses",esriSpatialRelDisjoint:"disjoint",esriSpatialRelEnvelopeIntersects:"envelope-intersects",esriSpatialRelIndexIntersects:"index-intersects",esriSpatialRelOverlaps:"overlaps",esriSpatialRelTouches:"touches",esriSpatialRelWithin:"within",esriSpatialRelRelation:"relation"}),m=new i.JSONMap({esriSRUnit_Meter:"meters",esriSRUnit_Kilometer:"kilometers",esriSRUnit_Foot:"feet",esriSRUnit_StatuteMile:"miles",esriSRUnit_NauticalMile:"nautical-miles",esriSRUnit_USNauticalMile:"us-nautical-miles"});let S=_=function(t){function r(e){var r;return(r=t.call(this,e)||this).cacheHint=void 0,r.distance=void 0,r.geometry=null,r.geometryPrecision=void 0,r.maxAllowableOffset=void 0,r.num=void 0,r.objectIds=null,r.orderByFields=null,r.outFields=null,r.outSpatialReference=null,r.resultType=null,r.returnGeometry=!1,r.returnM=void 0,r.returnZ=void 0,r.start=void 0,r.spatialRelationship="intersects",r.timeExtent=null,r.topFilter=void 0,r.units=null,r.where="1=1",r}e._inheritsLoose(r,t);var o=r.prototype;return o.writeStart=function(e,t){t.resultOffset=this.start,t.resultRecordCount=this.num||10},o.clone=function(){return new _(p.clone({cacheHint:this.cacheHint,distance:this.distance,geometry:this.geometry,geometryPrecision:this.geometryPrecision,maxAllowableOffset:this.maxAllowableOffset,num:this.num,objectIds:this.objectIds,orderByFields:this.orderByFields,outFields:this.outFields,outSpatialReference:this.outSpatialReference,resultType:this.resultType,returnGeometry:this.returnGeometry,returnZ:this.returnZ,returnM:this.returnM,start:this.start,spatialRelationship:this.spatialRelationship,timeExtent:this.timeExtent,topFilter:this.topFilter,units:this.units,where:this.where}))},r}(s.JSONSupport);t.__decorate([n.property({type:Boolean,json:{write:!0}})],S.prototype,"cacheHint",void 0),t.__decorate([n.property({type:Number,json:{write:{overridePolicy:e=>({enabled:e>0})}}})],S.prototype,"distance",void 0),t.__decorate([n.property({types:r.geometryTypes,json:{read:d.fromJSON,write:!0}})],S.prototype,"geometry",void 0),t.__decorate([n.property({type:Number,json:{write:!0}})],S.prototype,"geometryPrecision",void 0),t.__decorate([n.property({type:Number,json:{write:!0}})],S.prototype,"maxAllowableOffset",void 0),t.__decorate([n.property({type:Number,json:{read:{source:"resultRecordCount"}}})],S.prototype,"num",void 0),t.__decorate([n.property({json:{write:!0}})],S.prototype,"objectIds",void 0),t.__decorate([n.property({type:[String],json:{write:!0}})],S.prototype,"orderByFields",void 0),t.__decorate([n.property({type:[String],json:{write:!0}})],S.prototype,"outFields",void 0),t.__decorate([n.property({type:y,json:{read:{source:"outSR"},write:{target:"outSR"}}})],S.prototype,"outSpatialReference",void 0),t.__decorate([n.property({type:String,json:{write:!0}})],S.prototype,"resultType",void 0),t.__decorate([n.property({json:{write:!0}})],S.prototype,"returnGeometry",void 0),t.__decorate([n.property({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],S.prototype,"returnM",void 0),t.__decorate([n.property({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],S.prototype,"returnZ",void 0),t.__decorate([n.property({type:Number,json:{read:{source:"resultOffset"}}})],S.prototype,"start",void 0),t.__decorate([c.writer("start"),c.writer("num")],S.prototype,"writeStart",null),t.__decorate([n.property({type:String,json:{read:{source:"spatialRel",reader:h.read},write:{target:"spatialRel",writer:h.write}}})],S.prototype,"spatialRelationship",void 0),t.__decorate([n.property({type:o,json:{write:!0}})],S.prototype,"timeExtent",void 0),t.__decorate([n.property({type:u,json:{write:!0}})],S.prototype,"topFilter",void 0),t.__decorate([n.property({type:String,json:{read:m.read,write:{writer:m.write,overridePolicy(e){return{enabled:e&&this.distance>0}}}}})],S.prototype,"units",void 0),t.__decorate([n.property({type:String,json:{write:!0}})],S.prototype,"where",void 0),S=_=t.__decorate([l.subclass("esri.rest.support.TopFeaturesQuery")],S),S.from=a.ensureType(S);return S}));
