/*
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","../../core/jsonMap","../../core/JSONSupport","../../core/accessorSupport/decorators/property","../../core/arrayUtils","../../core/has","../../core/accessorSupport/ensureType","../../core/accessorSupport/decorators/subclass","../../geometry/Polygon","../../geometry/SpatialReference","../../geometry/support/jsonUtils"],(function(e,t,o,r,s,i,n,p,a,c,u,l,y){"use strict";const d=new r.JSONMap({9001:"meters",9002:"feet",9036:"kilometers",9093:"miles",109012:"nautical-miles",109001:"yards"});let f=function(t){function o(e){var o;return(o=t.call(this,e)||this).bufferSpatialReference=null,o.distances=null,o.geodesic=!1,o.geometries=null,o.outSpatialReference=null,o.unionResults=!1,o.unit=null,o}return e._inheritsLoose(o,t),o.prototype.toJSON=function(){const e={unit:d.toJSON(this.unit),unionResults:this.unionResults,geodesic:this.geodesic},t=this.distances,o=this.outSpatialReference,r=this.bufferSpatialReference,s=this.geometries;if(s&&s.length>0){const t=s.map((e=>(e="extent"===e.type?u.fromExtent(e):e).toJSON())),o="extent"===s[0].type?"esriGeometryPolygon":y.getJsonType(s[0]);e.geometries=JSON.stringify({geometryType:o,geometries:t}),e.inSR=s[0].spatialReference.wkid?s[0].spatialReference.wkid:JSON.stringify(s[0].spatialReference.toJSON())}return t&&(e.distances=t.join(",")),o&&(e.outSR=o.wkid?o.wkid:JSON.stringify(o.toJSON())),r&&(e.bufferSR=r.wkid?r.wkid:JSON.stringify(r.toJSON())),e},o}(s.JSONSupport);t.__decorate([i.property({type:l,json:{write:!0}})],f.prototype,"bufferSpatialReference",void 0),t.__decorate([i.property({type:[Number],json:{write:!0}})],f.prototype,"distances",void 0),t.__decorate([i.property({type:Boolean,json:{write:!0}})],f.prototype,"geodesic",void 0),t.__decorate([i.property({types:[o.geometryTypes],json:{write:!0}})],f.prototype,"geometries",void 0),t.__decorate([i.property({type:l,json:{write:!0}})],f.prototype,"outSpatialReference",void 0),t.__decorate([i.property({type:Boolean,json:{write:!0}})],f.prototype,"unionResults",void 0),t.__decorate([i.property({type:String,json:{write:!0}})],f.prototype,"unit",void 0),f=t.__decorate([c.subclass("esri.rest.support.BufferParameters")],f);return f}));
