/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{__decorate as t}from"tslib";import{JSONSupport as e}from"../core/JSONSupport.js";import{clone as r}from"../core/lang.js";import{property as o,subclass as s}from"../core/accessorSupport/decorators.js";import{stretchTypeJSONDict as i,stretchTypeFunctionEnum as a}from"./support/stretchRendererUtils.js";import{fromJSON as m,types as p}from"../rest/support/colorRamps.js";import{reader as n}from"../core/accessorSupport/decorators/reader.js";import{writer as u}from"../core/accessorSupport/decorators/writer.js";import{enumeration as c}from"../core/accessorSupport/decorators/enumeration.js";var d;let h=d=class extends e{constructor(t){super(t),this.colorRamp=null,this.computeGamma=!1,this.dynamicRangeAdjustment=!1,this.gamma=[],this.maxPercent=null,this.minPercent=null,this.numberOfStandardDeviations=null,this.outputMax=null,this.outputMin=null,this.sigmoidStrengthLevel=null,this.histograms=null,this.customStatistics=null,this.useGamma=!1,this.stretchType="none",this.type="raster-stretch"}readColorRamp(t){if(t)return m(t)}readCustomStatistics(t){return t?.map(t=>({min:t[0],max:t[1],avg:t[2],stddev:t[3]}))}writeCustomStatistics(t,e,r){t?.length&&(e[r]=t.map(t=>[t.min,t.max,t.avg??0,t.stddev??1]))}readStretchType(t,e){let r=e.stretchType;return"number"==typeof r&&(r=a[r]),i.read(r)}clone(){return new d({stretchType:this.stretchType,outputMin:this.outputMin,outputMax:this.outputMax,useGamma:this.useGamma,computeGamma:this.computeGamma,customStatistics:r(this.customStatistics),gamma:r(this.gamma),sigmoidStrengthLevel:this.sigmoidStrengthLevel,numberOfStandardDeviations:this.numberOfStandardDeviations,minPercent:this.minPercent,maxPercent:this.maxPercent,colorRamp:r(this.colorRamp),histograms:r(this.histograms),dynamicRangeAdjustment:this.dynamicRangeAdjustment})}};t([o({types:p,json:{write:!0}})],h.prototype,"colorRamp",void 0),t([n("colorRamp")],h.prototype,"readColorRamp",null),t([o({type:Boolean,json:{write:!0}})],h.prototype,"computeGamma",void 0),t([o({type:Boolean,json:{write:{target:"dra"},read:{source:"dra"}}})],h.prototype,"dynamicRangeAdjustment",void 0),t([o({type:[Number],json:{write:!0}})],h.prototype,"gamma",void 0),t([o({type:Number,json:{write:!0}})],h.prototype,"maxPercent",void 0),t([o({type:Number,json:{write:!0}})],h.prototype,"minPercent",void 0),t([o({type:Number,json:{write:!0}})],h.prototype,"numberOfStandardDeviations",void 0),t([o({type:Number,json:{read:{source:"max"},write:{target:"max"}}})],h.prototype,"outputMax",void 0),t([o({type:Number,json:{read:{source:"min"},write:{target:"min"}}})],h.prototype,"outputMin",void 0),t([o({type:Number,json:{write:!0}})],h.prototype,"sigmoidStrengthLevel",void 0),t([o()],h.prototype,"histograms",void 0),t([o({json:{type:[[Number]],name:"statistics",write:!0}})],h.prototype,"customStatistics",void 0),t([n("customStatistics")],h.prototype,"readCustomStatistics",null),t([u("customStatistics")],h.prototype,"writeCustomStatistics",null),t([o({type:Boolean,json:{write:!0}})],h.prototype,"useGamma",void 0),t([o({type:i.apiValues,json:{type:i.jsonValues,write:i.write}})],h.prototype,"stretchType",void 0),t([n("stretchType",["stretchType"])],h.prototype,"readStretchType",null),t([c({rasterStretch:"raster-stretch"})],h.prototype,"type",void 0),h=d=t([s("esri.renderers.RasterStretchRenderer")],h);export{h as default};
