/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{createScreenPoint as e}from"../../../core/screenUtils.js";const t=40,n=t+10,r=()=>({maximumClickDelay:"test"===process.env.NODE_ENV?t:300}),o=(e={})=>({...r(),movementUntilMouseDrag:1.5,movementUntilPenDrag:6,movementUntilTouchDrag:6,holdDelay:500,...e}),c=(e={})=>({...r(),maximumDoubleClickDistance:10,maximumDoubleTouchDistance:35,maximumDoubleClickDelay:"test"===process.env.NODE_ENV?n:250,maximumDoubleTouchDelay:"test"===process.env.NODE_ENV?n:350,...e});function s(e,t){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)}function u(e,t){const n=t.x-e.x,r=t.y-e.y;return Math.sqrt(n*n+r*r)}function i(t,n){if(n?(n.radius=0,n.center.x=0,n.center.y=0):n={radius:0,center:e()},0===t.length)return n;if(1===t.length)return n.center.x=t[0].x,n.center.y=t[0].y,n;if(2===t.length){const[e,r]=t,[o,c]=[r.x-e.x,r.y-e.y];return n.radius=Math.sqrt(o*o+c*c)/2,n.center.x=(e.x+r.x)/2,n.center.y=(e.y+r.y)/2,n}let r=0,o=0;for(let e=0;e<t.length;e++)r+=t[e].x,o+=t[e].y;r/=t.length,o/=t.length;const c=t.map(e=>e.x-r),s=t.map(e=>e.y-o);let u=0,i=0,a=0,l=0,m=0,x=0,y=0;for(let e=0;e<c.length;e++){const t=c[e],n=s[e],r=t*t,o=n*n;u+=r,i+=o,a+=t*n,l+=r*t,m+=o*n,x+=t*o,y+=n*r}const h=.5*(l+x),D=.5*(m+y),g=u*i-a*a,f=(h*i-D*a)/g,p=(u*D-a*h)/g,b=e(f+r,p+o);return{radius:Math.sqrt(f*f+p*p+(u+i)/t.length),center:b}}function a(e){const{native:t}=e,{pointerId:n,button:r,pointerType:o}=t;return"mouse"===o?`${n}:${r}`:`${o}`}export{u as euclideanDistance,i as fitCircleLSQ,c as getDoubleClickParameters,o as getHoldAndDragParameters,a as getPointerId,s as manhattanDistance};
