/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../../../core/mathUtils","../../../../../renderers/support/lengthUtils","../../../../../renderers/visualVariables/support/sizeVariableUtils"],(function(e,n,t,a){"use strict";const r=Math.PI;function i(e,n){switch(n.transformationType){case a.TransformationType.Additive:return s(e,n);case a.TransformationType.Constant:return u(n,e);case a.TransformationType.ClampedLinear:return l(e,n);case a.TransformationType.Proportional:return c(e,n);case a.TransformationType.Stops:return m(e,n);case a.TransformationType.RealWorldSize:return p(e,n);case a.TransformationType.Identity:return e;case a.TransformationType.Unknown:return null}}function o(e,n){return"number"==typeof e?e:i(n,e)}function s(e,n){return e+(o(n.minSize,e)||n.minDataValue)}function u(e,n){const t=e.stops;let a=t&&t.length&&t[0].size;return null==a&&(a=e.minSize),o(a,n)}function l(e,n){const t=(e-n.minDataValue)/(n.maxDataValue-n.minDataValue),a=o(n.minSize,e),r=o(n.maxSize,e);return e<=n.minDataValue?a:e>=n.maxDataValue?r:a+t*(r-a)}function c(e,t){const a=e/t.minDataValue,r=o(t.minSize,e),i=o(t.maxSize,e);let s=null;return s=a*r,n.clamp(s,r,i)}function m(e,n){const[t,a,r]=f(e,n.cache.ipData);if(t===a)return o(n.stops[t].size,e);{const i=o(n.stops[t].size,e);return i+(o(n.stops[a].size,e)-i)*r}}function p(e,a){const i=t.meterIn[a.valueUnit],s=o(a.minSize,e),u=o(a.maxSize,e),{valueRepresentation:l}=a;let c=null;return c="area"===l?2*Math.sqrt(e/r)/i:"radius"===l||"distance"===l?2*e/i:e/i,n.clamp(c,s,u)}function f(e,n){if(!n)return;let t=0,a=n.length-1;return n.some(((n,r)=>e<n?(a=r,!0):(t=r,!1))),[t,a,(e-n[t])/(n[a]-n[t])]}e.getSizeForValueSimple=i,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
