/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../../chunks/_rollupPluginBabelHelpers","../../../../core/maybe","../../../../symbols/support/unitConversionUtils","./featureExpressionInfoUtils"],(function(t,e,n,s,i){"use strict";let o=function(){function t(){this._meterUnitOffset=0,this._renderUnitOffset=0,this._unit="meters",this._metersPerElevationInfoUnit=1,this._featureExpressionInfoContext=null,this.centerPointInElevationSR=null,this.mode=null}var o=t.prototype;return o.reset=function(){this.mode=null,this._meterUnitOffset=0,this._renderUnitOffset=0,this._featureExpressionInfoContext=null,this.unit="meters"},o.addOffsetRenderUnits=function(t){this._renderUnitOffset+=t},o.geometryZWithOffset=function(t,e){const n=this.calculateOffsetRenderUnits(e);return null!=this.featureExpressionInfoContext?n:t+n},o.calculateOffsetRenderUnits=function(t){let e=this._meterUnitOffset;const n=this.featureExpressionInfoContext;return null!=n&&(e+=i.execute(n)*this._metersPerElevationInfoUnit),e/t.unitInMeters+this._renderUnitOffset},o.setFromElevationInfo=function(t){this.mode=t.mode,this.unit=s.supportsUnit(t.unit)?t.unit:"meters",this.offsetElevationInfoUnits=n.unwrapOr(t.offset,0)},o.updateFeatureExpressionInfoContext=function(t,e,s){if(n.isNone(t))return void(this._featureExpressionInfoContext=null);const o=t&&t.arcade;o&&n.isSome(e)&&n.isSome(s)?(this._featureExpressionInfoContext=i.clone(t),i.setContextFeature(this._featureExpressionInfoContext,i.createFeature(o.modules,e,s))):this._featureExpressionInfoContext=t},t.fromElevationInfo=function(e){const s=new t;return n.isSome(e)&&s.setFromElevationInfo(e),s},e._createClass(t,[{key:"featureExpressionInfoContext",get:function(){return this._featureExpressionInfoContext}},{key:"meterUnitOffset",get:function(){return this._meterUnitOffset}},{key:"unit",get:function(){return this._unit},set:function(t){this._unit=t,this._metersPerElevationInfoUnit=s.getMetersPerUnit(t)}},{key:"requiresSampledElevationInfo",get:function(){return"absolute-height"!==this.mode}},{key:"offsetMeters",set:function(t){this._meterUnitOffset=t,this._renderUnitOffset=0}},{key:"offsetElevationInfoUnits",set:function(t){this._meterUnitOffset=t*this._metersPerElevationInfoUnit,this._renderUnitOffset=0}}]),t}();t.ElevationContext=o,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
