import path_default from "../../../d3-path/src/path.js";
import constant_default from "../constant.js";
import { x, y } from "../point.js";
import { slice } from "../array.js";
function linkSource(e) {
	return e.source;
}
function linkTarget(e) {
	return e.target;
}
function link(s) {
	var c = linkSource, l = linkTarget, u = x, d = y, f = null;
	function p() {
		var n, r = slice.call(arguments), i = c.apply(this, r), o = l.apply(this, r);
		if (f ||= n = path_default(), s(f, +u.apply(this, (r[0] = i, r)), +d.apply(this, r), +u.apply(this, (r[0] = o, r)), +d.apply(this, r)), n) return f = null, n + "" || null;
	}
	return p.source = function(e) {
		return arguments.length ? (c = e, p) : c;
	}, p.target = function(e) {
		return arguments.length ? (l = e, p) : l;
	}, p.x = function(e) {
		return arguments.length ? (u = typeof e == "function" ? e : constant_default(+e), p) : u;
	}, p.y = function(e) {
		return arguments.length ? (d = typeof e == "function" ? e : constant_default(+e), p) : d;
	}, p.context = function(e) {
		return arguments.length ? (f = e ?? null, p) : f;
	}, p;
}
function curveHorizontal(e, n, r, i, a) {
	e.moveTo(n, r), e.bezierCurveTo(n = (n + i) / 2, r, n, a, i, a);
}
function linkHorizontal() {
	return link(curveHorizontal);
}
export { linkHorizontal };
