import { create, attr } from "../../../tiny-svg/dist/index.esm.mjs";
function componentsToPath(elements) {
  return elements.join(",").replace(/,?([A-z]),?/g, "$1");
}
function toSVGPoints(points) {
  var result = "";
  for (var i = 0, p; p = points[i]; i++) {
    result += p.x + "," + p.y + " ";
  }
  return result;
}
function createLine(points, attrs) {
  var line = create("polyline");
  attr(line, { points: toSVGPoints(points) });
  if (attrs) {
    attr(line, attrs);
  }
  return line;
}
function updateLine(gfx, points) {
  attr(gfx, { points: toSVGPoints(points) });
  return gfx;
}
export {
  componentsToPath,
  createLine,
  toSVGPoints,
  updateLine
};
