import { point } from "./basis.js";
function BasisOpen(e) {
	this._context = e;
}
BasisOpen.prototype = {
	areaStart: function() {
		this._line = 0;
	},
	areaEnd: function() {
		this._line = NaN;
	},
	lineStart: function() {
		this._x0 = this._x1 = this._y0 = this._y1 = NaN, this._point = 0;
	},
	lineEnd: function() {
		(this._line || this._line !== 0 && this._point === 3) && this._context.closePath(), this._line = 1 - this._line;
	},
	point: function(t, n) {
		switch (t = +t, n = +n, this._point) {
			case 0:
				this._point = 1;
				break;
			case 1:
				this._point = 2;
				break;
			case 2:
				this._point = 3;
				var r = (this._x0 + 4 * this._x1 + t) / 6, i = (this._y0 + 4 * this._y1 + n) / 6;
				this._line ? this._context.lineTo(r, i) : this._context.moveTo(r, i);
				break;
			case 3: this._point = 4;
			default:
				point(this, t, n);
				break;
		}
		this._x0 = this._x1, this._x1 = t, this._y0 = this._y1, this._y1 = n;
	}
};
function basisOpen_default(e) {
	return new BasisOpen(e);
}
export { basisOpen_default as default };
