function assignClosestArrayPoint(
  flatCoordinates,
  offset,
  ends,
  stride,
  maxDelta,
  isRing,
  x,
  y,
  closestPoint,
  minSquaredDistance,
  tmpPoint,
) {
  tmpPoint = tmpPoint ? tmpPoint : [NaN, NaN];
  for (let i = 0, ii = ends.length; i < ii; ++i) {
    const end = ends[i];
    minSquaredDistance = assignClosestPoint(
      flatCoordinates,
      offset,
      end,
      stride,
      maxDelta,
      isRing,
      x,
      y,
      closestPoint,
      minSquaredDistance,
      tmpPoint,
    );
    offset = end;
  }
  return minSquaredDistance;
}
@param {Array<number>} flatCoordinates Flat coordinates.
@param {number} offset Offset.
@param {Array<number>} ends Ends.
@param {number} stride Stride.
@param {number} maxDelta Max delta.
@param {boolean} isRing Is ring.
@param {number} x X.
@param {number} y Y.
@param {Array<number>} closestPoint Closest point.
@param {number} minSquaredDistance Minimum squared distance.
@param {Array<number>} [tmpPoint] Temporary point object.
@return {number} Minimum squared distance.