function _class_call_check(instance, Constructor) {
    if (!(instance instanceof Constructor)) {
        throw new TypeError("Cannot call a class as a function");
    }
}
function _defineProperties(target, props) {
    for(var i = 0; i < props.length; i++){
        var descriptor = props[i];
        descriptor.enumerable = descriptor.enumerable || false;
        descriptor.configurable = true;
        if ("value" in descriptor) descriptor.writable = true;
        Object.defineProperty(target, descriptor.key, descriptor);
    }
}
function _create_class(Constructor, protoProps, staticProps) {
    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
    return Constructor;
}
function _tagged_template_literal(strings, raw) {
    if (!raw) {
        raw = strings.slice(0);
    }
    return Object.freeze(Object.defineProperties(strings, {
        raw: {
            value: Object.freeze(raw)
        }
    }));
}
function _templateObject() {
    var data = _tagged_template_literal([
        "M",
        ",",
        ""
    ]);
    _templateObject = function _templateObject() {
        return data;
    };
    return data;
}
function _templateObject1() {
    var data = _tagged_template_literal([
        "Z"
    ]);
    _templateObject1 = function _templateObject() {
        return data;
    };
    return data;
}
function _templateObject2() {
    var data = _tagged_template_literal([
        "L",
        ",",
        ""
    ]);
    _templateObject2 = function _templateObject() {
        return data;
    };
    return data;
}
function _templateObject3() {
    var data = _tagged_template_literal([
        "Q",
        ",",
        ",",
        ",",
        ""
    ]);
    _templateObject3 = function _templateObject() {
        return data;
    };
    return data;
}
function _templateObject4() {
    var data = _tagged_template_literal([
        "C",
        ",",
        ",",
        ",",
        ",",
        ",",
        ""
    ]);
    _templateObject4 = function _templateObject() {
        return data;
    };
    return data;
}
function _templateObject5() {
    var data = _tagged_template_literal([
        "M",
        ",",
        ""
    ]);
    _templateObject5 = function _templateObject() {
        return data;
    };
    return data;
}
function _templateObject6() {
    var data = _tagged_template_literal([
        "L",
        ",",
        ""
    ]);
    _templateObject6 = function _templateObject() {
        return data;
    };
    return data;
}
function _templateObject7() {
    var data = _tagged_template_literal([
        "L",
        ",",
        ""
    ]);
    _templateObject7 = function _templateObject() {
        return data;
    };
    return data;
}
function _templateObject8() {
    var data = _tagged_template_literal([
        "A",
        ",",
        ",0,0,",
        ",",
        ",",
        ""
    ]);
    _templateObject8 = function _templateObject() {
        return data;
    };
    return data;
}
function _templateObject9() {
    var data = _tagged_template_literal([
        "M",
        ",",
        ""
    ]);
    _templateObject9 = function _templateObject() {
        return data;
    };
    return data;
}
function _templateObject10() {
    var data = _tagged_template_literal([
        "L",
        ",",
        ""
    ]);
    _templateObject10 = function _templateObject() {
        return data;
    };
    return data;
}
function _templateObject11() {
    var data = _tagged_template_literal([
        "A",
        ",",
        ",0,1,",
        ",",
        ",",
        "A",
        ",",
        ",0,1,",
        ",",
        ",",
        ""
    ]);
    _templateObject11 = function _templateObject() {
        return data;
    };
    return data;
}
function _templateObject12() {
    var data = _tagged_template_literal([
        "A",
        ",",
        ",0,",
        ",",
        ",",
        ",",
        ""
    ]);
    _templateObject12 = function _templateObject() {
        return data;
    };
    return data;
}
function _templateObject13() {
    var data = _tagged_template_literal([
        "M",
        ",",
        "h",
        "v",
        "h",
        "Z"
    ]);
    _templateObject13 = function _templateObject() {
        return data;
    };
    return data;
}
var c = Math.PI, x = 2 * c, u = 1e-6, m = x - u;
function E(e) {
    this._ += e[0];
    for(var t = 1, h = e.length; t < h; ++t)this._ += arguments[t] + e[t];
}
function A(e) {
    var t = Math.floor(e);
    if (!(t >= 0)) throw new Error("invalid digits: ".concat(e));
    if (t > 15) return E;
    var h = Math.pow(10, t);
    return function(i) {
        this._ += i[0];
        for(var s = 1, n = i.length; s < n; ++s)this._ += Math.round(arguments[s] * h) / h + i[s];
    };
}
var L = /*#__PURE__*/ function() {
    function L(t) {
        _class_call_check(this, L);
        this._x0 = this._y0 = this._x1 = this._y1 = null, this._ = "", this._append = t == null ? E : A(t);
    }
    _create_class(L, [
        {
            key: "moveTo",
            value: function moveTo(t, h) {
                this._append(_templateObject(), this._x0 = this._x1 = +t, this._y0 = this._y1 = +h);
            }
        },
        {
            key: "closePath",
            value: function closePath() {
                this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._append(_templateObject1()));
            }
        },
        {
            key: "lineTo",
            value: function lineTo(t, h) {
                this._append(_templateObject2(), this._x1 = +t, this._y1 = +h);
            }
        },
        {
            key: "quadraticCurveTo",
            value: function quadraticCurveTo(t, h, i, s) {
                this._append(_templateObject3(), +t, +h, this._x1 = +i, this._y1 = +s);
            }
        },
        {
            key: "bezierCurveTo",
            value: function bezierCurveTo(t, h, i, s, n, $) {
                this._append(_templateObject4(), +t, +h, +i, +s, this._x1 = +n, this._y1 = +$);
            }
        },
        {
            key: "arcTo",
            value: function arcTo(t, h, i, s, n) {
                if (t = +t, h = +h, i = +i, s = +s, n = +n, n < 0) throw new Error("negative radius: ".concat(n));
                var $ = this._x1, r = this._y1, p = i - t, l = s - h, _ = $ - t, o = r - h, a = _ * _ + o * o;
                if (this._x1 === null) this._append(_templateObject5(), this._x1 = t, this._y1 = h);
                else if (a > u) if (!(Math.abs(o * p - l * _) > u) || !n) this._append(_templateObject6(), this._x1 = t, this._y1 = h);
                else {
                    var d = i - $, f = s - r, y = p * p + l * l, T = d * d + f * f, g = Math.sqrt(y), v = Math.sqrt(a), w = n * Math.tan((c - Math.acos((y + a - T) / (2 * g * v))) / 2), M = w / v, b = w / g;
                    Math.abs(M - 1) > u && this._append(_templateObject7(), t + M * _, h + M * o), this._append(_templateObject8(), n, n, +(o * d > _ * f), this._x1 = t + b * p, this._y1 = h + b * l);
                }
            }
        },
        {
            key: "arc",
            value: function arc(t, h, i, s, n, $) {
                if (t = +t, h = +h, i = +i, $ = !!$, i < 0) throw new Error("negative radius: ".concat(i));
                var r = i * Math.cos(s), p = i * Math.sin(s), l = t + r, _ = h + p, o = 1 ^ $, a = $ ? s - n : n - s;
                this._x1 === null ? this._append(_templateObject9(), l, _) : (Math.abs(this._x1 - l) > u || Math.abs(this._y1 - _) > u) && this._append(_templateObject10(), l, _), i && (a < 0 && (a = a % x + x), a > m ? this._append(_templateObject11(), i, i, o, t - r, h - p, i, i, o, this._x1 = l, this._y1 = _) : a > u && this._append(_templateObject12(), i, i, +(a >= c), o, this._x1 = t + i * Math.cos(n), this._y1 = h + i * Math.sin(n)));
            }
        },
        {
            key: "rect",
            value: function rect(t, h, i, s) {
                this._append(_templateObject13(), this._x0 = this._x1 = +t, this._y0 = this._y1 = +h, i = +i, +s, -i);
            }
        },
        {
            key: "toString",
            value: function toString() {
                return this._;
            }
        }
    ]);
    return L;
}();
function P(e) {
    return function() {
        return e;
    };
}
function q(e) {
    var t = 3;
    return e.digits = function(h) {
        if (!arguments.length) return t;
        if (h == null) t = null;
        else {
            var i = Math.floor(h);
            if (!(i >= 0)) throw new RangeError("invalid digits: ".concat(h));
            t = i;
        }
        return e;
    }, function() {
        return new L(t);
    };
}

export { P, q };
