"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@babel/runtime/helpers/defineProperty"),e=require("./constants.js");function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var o=r(t);function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,o)}return r}function i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){o.default(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var u=function(t){var e=t.min,r=t.step,o=t.value,n=void 0===o?0:o;return r&&r>0?e+Math.round((n-e)/r)*r:n};exports.calculatePercentForValue=function(t,e,r){return 100*(t-e)/(r-e)},exports.calculateValueFromPercent=function(t,e,r){return e+t*(r-e)/100},exports.getMaxValueSymbols=function(t,e){return String(Math.floor(t)).length+e},exports.getSteppedValue=u,exports.getTooltipAnchor=function(t){var e=t.isHorizontalOrientation,r=t.tooltipPosition,o=t.rail,n=o.getBoundingClientRect(),u=Math.min(o.clientWidth,o.clientHeight),l=e?{top:n.y,left:r.x-u/2,right:r.x+u/2,bottom:n.y+u}:{top:r.y-u/2,left:n.x,right:n.x+u,bottom:r.y+u/2};return{clientHeight:u,clientWidth:u,getBoundingClientRect:function(){return i(i({},l),{},{width:u,height:u,x:l.left,y:l.top,toJSON:function(){return""}})}}},exports.getTooltipTitle=function(t){var r=t.tooltipTitle,o=t.focusedEl,n=t.from,i=t.to;return o[e.RangeSliderControl.BAR]?"":o[e.RangeSliderControl.FROM]?String(n):o[e.RangeSliderControl.TO]?String(i):String(r)},exports.updateFromValue=function(t){var e=t.value,r=t.step,o=t.min,n=t.minRange,i=t.to,l=u({min:o,value:e,step:r});return l<o?{from:o,to:i}:l>i-n?{from:i-n,to:i}:{from:l,to:i}},exports.updateToValue=function(t){var e=t.value,r=t.step,o=t.min,n=t.max,i=t.from,l=t.minRange,a=u({min:o,value:e,step:r});return a>n?{from:i,to:n}:a<i+l?{from:i,to:i+l}:{from:i,to:a}};
//# sourceMappingURL=utils.js.map
