import{getSteps}from"../useSliderStationing";export var isRangeParams=function(a){return!!a.range};export var isNotRangeParams=function(a){return!a.range};export var trackPosition=function(a){return"clientX"in a?{x:a.clientX,y:a.clientY}:{x:a.changedTouches[0].clientX,y:a.changedTouches[0].clientY}};export var getActiveValue=function(a,b){return Array.isArray(a)?a["number"==typeof b?b:0]:a};export var detectActiveButton=function(a,b){var c=null;return b.forEach(function(b,d){var e=b.current;if(e&&a){var f=e.getBoundingClientRect(),g=f.x,h=f.y,i=f.width,j=f.height;g<=a.x&&g+i>=a.x&&h<=a.y&&h+j>=a.y&&(c=d,e.focus())}}),c};export var getValidValue=function(a,b,c,d){if("number"==typeof a){if(a>=c)return c;if(a<=b)return b;if(!Array.isArray(d)){var e=null===d||void 0===d?void 0:d.toString().split(".")[1],f=d||1;if(1>Math.abs(a))return+a.toFixed(e?e.length:0);if(a<b)return b;for(var g=b;g<=c;g+=f)if(a>=g&&a<g+f)return+(a<g+f/2?g:g+f).toFixed(e?e.length:0);return c}var h=a;return d.forEach(function(e,f){var g=b,i=c;0===f?i=d[f+1]:f===d.length-1?(g=e,i=c):(i=d[f+1],g=e),a<=i&&a>=g&&((i+g)/2>a?h=g:h=i)}),h}return a};export var isValidValue=function(a,b,c,d){return getValidValue(a,b,c,d)===a};export var getValueByPosition=function(a,b,c,d,e){if(b.current&&a){var f=b.current.getBoundingClientRect(),g=f.x,h=f.width,i=Math.abs(d-c),j=c+(a.x-g)*i/h;return getValidValue(j,c,d,e)}return 0};export var getNewValue=function(a,b,c,d,e,f){var g=getValidValue(analyzeDivisionValue(a,c,d,e),d,e,c);return Array.isArray(b)?1===f?[b[0],g]:[g,b[1]]:g};export var analyzeDivisionValue=function(a,b,c,d){var e=a;if(Array.isArray(b)){var f=getSteps(b,c,d);f.forEach(function(b){a&&b.min<a&&b.max>=a&&((b.max+b.min)/2>a?e=b.min:e=b.max)})}else{if(a>=d)return d;if(a<=c)return c;var g=(a-c)%b;e=g>b/2?b-g+a:a-g}return e};
//# sourceMappingURL=helper.js.map