/*
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","../../TimeExtent","../../core/Accessor","../../core/accessorSupport/decorators/property","../../core/arrayUtils","../../core/has","../../core/accessorSupport/ensureType","../../core/accessorSupport/decorators/subclass","../../geometry/Extent","../../geometry/SpatialReference","../../layers/support/LayerTimeOptions","../../layers/support/layerUtils"],(function(e,t,r,o,i,p,n,l,a,s,y,c,u){"use strict";let d=function(t){function r(e){var r;return(r=t.call(this,e)||this).extent=null,r.width=null,r.height=null,r.dpi=null,r.format=null,r.imageSpatialReference=null,r.layerDefinitions=[],r.layerOption=null,r.layerIds=null,r.transparent=!0,r.timeExtent=null,r.layerTimeOptions=null,r}return e._inheritsLoose(r,t),r.prototype.toJSON=function(){let e,t=this.extent;if(t=t&&t.clone()._normalize(!0),this.timeExtent){const t=this.timeExtent.toJSON(),{start:r,end:o}=t;null==r&&null==o||(e=r===o?""+r:`${null==r?"null":r},${null==o?"null":o}`)}const r=this.layerOption,o=t?t.spatialReference.wkid||JSON.stringify(t.spatialReference.toJSON()):null,i=this.imageSpatialReference,p={dpi:this.dpi,format:this.format,transparent:this.transparent,size:null!==this.width&&null!==this.height?this.width+","+this.height:null,bbox:t?t.xmin+","+t.ymin+","+t.xmax+","+t.ymax:null,bboxSR:o,layers:r?r+":"+this.layerIds.join(","):null,layerDefs:u.serializeLayerDefinitions(this.layerDefinitions),layerTimeOptions:u.serializeTimeOptions(this.layerTimeOptions),imageSR:i?i.wkid||JSON.stringify(i.toJSON()):o,time:e},n={};return Object.keys(p).filter((e=>null!==p[e])).forEach((e=>n[e]=p[e])),n},r}(o);t.__decorate([i.property({type:s})],d.prototype,"extent",void 0),t.__decorate([i.property()],d.prototype,"width",void 0),t.__decorate([i.property()],d.prototype,"height",void 0),t.__decorate([i.property()],d.prototype,"dpi",void 0),t.__decorate([i.property()],d.prototype,"format",void 0),t.__decorate([i.property({type:y})],d.prototype,"imageSpatialReference",void 0),t.__decorate([i.property()],d.prototype,"layerDefinitions",void 0),t.__decorate([i.property()],d.prototype,"layerOption",void 0),t.__decorate([i.property()],d.prototype,"layerIds",void 0),t.__decorate([i.property()],d.prototype,"transparent",void 0),t.__decorate([i.property({type:r})],d.prototype,"timeExtent",void 0),t.__decorate([i.property({type:[c]})],d.prototype,"layerTimeOptions",void 0),d=t.__decorate([a.subclass("esri.rest.support.ImageParameters")],d);return d}));
