//#region ../../node_modules/d3-shape/src/curve/monotone.js
function e(e) {
	return e < 0 ? -1 : 1;
}
function t(t, n, r) {
	var i = t._x1 - t._x0, a = n - t._x1, o = (t._y1 - t._y0) / (i || a < 0 && -0), s = (r - t._y1) / (a || i < 0 && -0), c = (o * a + s * i) / (i + a);
	return (e(o) + e(s)) * Math.min(Math.abs(o), Math.abs(s), .5 * Math.abs(c)) || 0;
}
function n(e, t) {
	var n = e._x1 - e._x0;
	return n ? (3 * (e._y1 - e._y0) / n - t) / 2 : t;
}
function r(e, t, n) {
	var r = e._x0, i = e._y0, a = e._x1, o = e._y1, s = (a - r) / 3;
	e._context.bezierCurveTo(r + s, i + s * t, a - s, o - s * n, a, o);
}
function i(e) {
	this._context = e;
}
i.prototype = {
	areaStart: function() {
		this._line = 0;
	},
	areaEnd: function() {
		this._line = NaN;
	},
	lineStart: function() {
		this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN, this._point = 0;
	},
	lineEnd: function() {
		switch (this._point) {
			case 2:
				this._context.lineTo(this._x1, this._y1);
				break;
			case 3:
				r(this, this._t0, n(this, this._t0));
				break;
		}
		(this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
	},
	point: function(e, i) {
		var a = NaN;
		if (e = +e, i = +i, !(e === this._x1 && i === this._y1)) {
			switch (this._point) {
				case 0:
					this._point = 1, this._line ? this._context.lineTo(e, i) : this._context.moveTo(e, i);
					break;
				case 1:
					this._point = 2;
					break;
				case 2:
					this._point = 3, r(this, n(this, a = t(this, e, i)), a);
					break;
				default:
					r(this, this._t0, a = t(this, e, i));
					break;
			}
			this._x0 = this._x1, this._x1 = e, this._y0 = this._y1, this._y1 = i, this._t0 = a;
		}
	}
};
function a(e) {
	this._context = new o(e);
}
(a.prototype = Object.create(i.prototype)).point = function(e, t) {
	i.prototype.point.call(this, t, e);
};
function o(e) {
	this._context = e;
}
o.prototype = {
	moveTo: function(e, t) {
		this._context.moveTo(t, e);
	},
	closePath: function() {
		this._context.closePath();
	},
	lineTo: function(e, t) {
		this._context.lineTo(t, e);
	},
	bezierCurveTo: function(e, t, n, r, i, a) {
		this._context.bezierCurveTo(t, e, r, n, a, i);
	}
};
function s(e) {
	return new i(e);
}
function c(e) {
	return new a(e);
}
//#endregion
export { s as monotoneX, c as monotoneY };
