import c from"../../_util/KeyCode.mjs";function m(e,n){try{return Object.keys(n).some(t=>e.target===n[t].ref)}catch{return!1}}function b(e,{min:n,max:t}){return e<n||e>t}function k(e){return e.touches.length>1||e.type.toLowerCase()==="touchend"&&e.touches.length>0}function a(e,{marks:n,step:t,min:i,max:u}){const s=Object.keys(n).map(Number.parseFloat);if(t!==null){const o=10**d(t),f=Math.floor((u*o-i*o)/(t*o)),l=Math.min((e-i)/t,f),g=Math.round(l)*t+i;s.push(g)}const r=s.map(o=>Math.abs(e-o));return s[r.indexOf(Math.min(...r))]}function d(e){const n=e.toString();let t=0;return n.includes(".")&&(t=n.length-n.indexOf(".")-1),t}function y(e,n){let t=1;return window.visualViewport&&(t=+(window.visualViewport.width/document.body.getBoundingClientRect().width).toFixed(2)),(e?n.clientY:n.pageX)/t}function O(e,n){let t=1;return window.visualViewport&&(t=+(window.visualViewport.width/document.body.getBoundingClientRect().width).toFixed(2)),(e?n.touches[0].clientY:n.touches[0].pageX)/t}function P(e,n){const t=n.getBoundingClientRect();return e?t.top+t.height*.5:window.scrollX+t.left+t.width*.5}function p(e,{max:n,min:t}){return e<=t?t:e>=n?n:e}function x(e,n){const{step:t}=n,i=isFinite(a(e,n))?a(e,n):0;return t===null?i:Number.parseFloat(i.toFixed(d(t)))}function N(e){e.stopPropagation(),e.preventDefault()}function h(e,n,t){const i={increase:(r,o)=>r+o,decrease:(r,o)=>r-o},u=i[e](Object.keys(t.marks).indexOf(JSON.stringify(n)),1),s=Object.keys(t.marks)[u];return t.step?i[e](n,t.step):Object.keys(t.marks).length&&t.marks[s]?t.marks[s]:n}function V(e,n,t){const i="increase",u="decrease";let s=i;switch(e.keyCode){case c.UP:s=n&&t?u:i;break;case c.RIGHT:s=!n&&t?u:i;break;case c.DOWN:s=n&&t?i:u;break;case c.LEFT:s=!n&&t?i:u;break;case c.END:return(r,o)=>o.max;case c.HOME:return(r,o)=>o.min;case c.PAGE_UP:return(r,o)=>r+o.step*2;case c.PAGE_DOWN:return(r,o)=>r-o.step*2;default:return}return(r,o)=>h(s,r,o)}export{h as calculateNextValue,p as ensureValueInRange,x as ensureValuePrecision,a as getClosestPoint,P as getHandleCenterPosition,V as getKeyboardValueMutator,y as getMousePosition,d as getPrecision,O as getTouchPosition,m as isEventFromHandle,k as isNotTouchEvent,b as isValueOutOfRange,N as pauseEvent};
