/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{clamp as t}from"../../../core/mathUtils.js";import{interpolateSegment as o,distance2 as r}from"./mathUtils.js";function s(s,i,n){const[c,e]=s,[m,a]=i,[f,h]=n,[l,p]=[m-c,a-e];let u=l*(f-c)+p*(h-e);u/=l**2+p**2,u=isNaN(u)?0:t(u,0,1);const j=o([0,0],s,i,u);return{t:u,curvePoint:j,distance:Math.sqrt(r(j,n))}}export{s as closestPointOnLine};
