(function() {
  var C = { a: 7, c: 6, h: 1, l: 2, m: 2, q: 4, s: 4, t: 2, v: 1, z: 0 }, H = /([astvzqmhlc])([^astvzqmhlc]*)/gi, N = /-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;
  function V(s) {
    const o = s.match(N);
    return o ? o.map(Number) : [];
  }
  function j(s) {
    const o = [], t = String(s).trim();
    return t[0] !== "M" && t[0] !== "m" || t.replace(H, (n, a, c) => {
      const r = V(c);
      let h = a.toLowerCase(), l = a;
      if (h === "m" && r.length > 2 && (o.push([l, ...r.splice(0, 2)]), h = "l", l = l === "m" ? "l" : "L"), r.length < C[h])
        return "";
      for (o.push([l, ...r.splice(0, C[h])]); r.length >= C[h] && r.length && C[h]; )
        o.push([l, ...r.splice(0, C[h])]);
      return "";
    }), o;
  }
  function L(s, o) {
    const t = s.x * Math.cos(o) - s.y * Math.sin(o), n = s.y * Math.cos(o) + s.x * Math.sin(o);
    s.x = t, s.y = n;
  }
  function G(s, o, t) {
    s.x += o, s.y += t;
  }
  function Q(s, o) {
    s.x *= o, s.y *= o;
  }
  var A = class I {
    constructor(o) {
      this.commands = [], o && o instanceof I ? this.commands.push(...o.commands) : o && (this.commands = j(o));
    }
    addPath(o) {
      o && o instanceof I && this.commands.push(...o.commands);
    }
    moveTo(o, t) {
      this.commands.push(["M", o, t]);
    }
    lineTo(o, t) {
      this.commands.push(["L", o, t]);
    }
    arc(o, t, n, a, c, r) {
      this.commands.push(["AC", o, t, n, a, c, !!r]);
    }
    arcTo(o, t, n, a, c) {
      this.commands.push(["AT", o, t, n, a, c]);
    }
    ellipse(o, t, n, a, c, r, h, l) {
      this.commands.push(["E", o, t, n, a, c, r, h, !!l]);
    }
    closePath() {
      this.commands.push(["Z"]);
    }
    bezierCurveTo(o, t, n, a, c, r) {
      this.commands.push(["C", o, t, n, a, c, r]);
    }
    quadraticCurveTo(o, t, n, a) {
      this.commands.push(["Q", o, t, n, a]);
    }
    rect(o, t, n, a) {
      this.commands.push(["R", o, t, n, a]);
    }
    roundRect(o, t, n, a, c) {
      typeof c > "u" ? this.commands.push(["RR", o, t, n, a, 0]) : this.commands.push(["RR", o, t, n, a, c]);
    }
  };
  function E(s, o) {
    let t = 0, n = 0, a, c, r, h, l, i, x, k, D, M, F, Z, R, m, d, q, z, g, T, P, B, f = null, v = null, p = null, y = null, w = null, b = null;
    s.beginPath();
    for (let u = 0; u < o.length; ++u) {
      g = o[u][0], g !== "S" && g !== "s" && g !== "C" && g !== "c" && (f = null, v = null), g !== "T" && g !== "t" && g !== "Q" && g !== "q" && (p = null, y = null);
      let e;
      switch (g) {
        case "m":
        case "M":
          e = o[u], g === "m" ? (t += e[1], n += e[2]) : (t = e[1], n = e[2]), (g === "M" || !w) && (w = { x: t, y: n }), s.moveTo(t, n);
          break;
        case "l":
          e = o[u], t += e[1], n += e[2], s.lineTo(t, n);
          break;
        case "L":
          e = o[u], t = e[1], n = e[2], s.lineTo(t, n);
          break;
        case "H":
          e = o[u], t = e[1], s.lineTo(t, n);
          break;
        case "h":
          e = o[u], t += e[1], s.lineTo(t, n);
          break;
        case "V":
          e = o[u], n = e[1], s.lineTo(t, n);
          break;
        case "v":
          e = o[u], n += e[1], s.lineTo(t, n);
          break;
        case "a":
        case "A":
          if (e = o[u], b === null)
            throw new Error("This should never happen");
          g === "a" ? (t += e[6], n += e[7]) : (t = e[6], n = e[7]), m = e[1], d = e[2], x = e[3] * Math.PI / 180, r = !!e[4], h = !!e[5], l = { x: t, y: n }, i = { x: (b.x - l.x) / 2, y: (b.y - l.y) / 2 }, L(i, -x), k = i.x * i.x / (m * m) + i.y * i.y / (d * d), k > 1 && (k = Math.sqrt(k), m *= k, d *= k), T = { x: m * i.y / d, y: -(d * i.x) / m }, D = m * m * d * d, M = m * m * i.y * i.y + d * d * i.x * i.x, h !== r ? Q(T, Math.sqrt((D - M) / M) || 0) : Q(T, -Math.sqrt((D - M) / M) || 0), c = Math.atan2((i.y - T.y) / d, (i.x - T.x) / m), a = Math.atan2(-(i.y + T.y) / d, -(i.x + T.x) / m), L(T, x), G(T, (l.x + b.x) / 2, (l.y + b.y) / 2), s.save(), s.translate(T.x, T.y), s.rotate(x), s.scale(m, d), s.arc(0, 0, 1, c, a, !h), s.restore();
          break;
        case "C":
          e = o[u], f = e[3], v = e[4], t = e[5], n = e[6], s.bezierCurveTo(e[1], e[2], f, v, t, n);
          break;
        case "c":
          e = o[u], s.bezierCurveTo(e[1] + t, e[2] + n, e[3] + t, e[4] + n, e[5] + t, e[6] + n), f = e[3] + t, v = e[4] + n, t += e[5], n += e[6];
          break;
        case "S":
          e = o[u], (f === null || v === null) && (f = t, v = n), s.bezierCurveTo(2 * t - f, 2 * n - v, e[1], e[2], e[3], e[4]), f = e[1], v = e[2], t = e[3], n = e[4];
          break;
        case "s":
          e = o[u], (f === null || v === null) && (f = t, v = n), s.bezierCurveTo(2 * t - f, 2 * n - v, e[1] + t, e[2] + n, e[3] + t, e[4] + n), f = e[1] + t, v = e[2] + n, t += e[3], n += e[4];
          break;
        case "Q":
          e = o[u], p = e[1], y = e[2], t = e[3], n = e[4], s.quadraticCurveTo(p, y, t, n);
          break;
        case "q":
          e = o[u], p = e[1] + t, y = e[2] + n, t += e[3], n += e[4], s.quadraticCurveTo(p, y, t, n);
          break;
        case "T":
          e = o[u], (p === null || y === null) && (p = t, y = n), p = 2 * t - p, y = 2 * n - y, t = e[1], n = e[2], s.quadraticCurveTo(p, y, t, n);
          break;
        case "t":
          e = o[u], (p === null || y === null) && (p = t, y = n), p = 2 * t - p, y = 2 * n - y, t += e[1], n += e[2], s.quadraticCurveTo(p, y, t, n);
          break;
        case "z":
        case "Z":
          w && (t = w.x, n = w.y), w = null, s.closePath();
          break;
        case "AC":
          e = o[u], t = e[1], n = e[2], R = e[3], c = e[4], a = e[5], P = e[6], s.arc(t, n, R, c, a, P);
          break;
        case "AT":
          e = o[u], F = e[1], Z = e[2], t = e[3], n = e[4], R = e[5], s.arcTo(F, Z, t, n, R);
          break;
        case "E":
          e = o[u], t = e[1], n = e[2], m = e[3], d = e[4], x = e[5], c = e[6], a = e[7], P = e[8], s.save(), s.translate(t, n), s.rotate(x), s.scale(m, d), s.arc(0, 0, 1, c, a, P), s.restore();
          break;
        case "R":
          e = o[u], t = e[1], n = e[2], q = e[3], z = e[4], w = { x: t, y: n }, s.rect(t, n, q, z);
          break;
        case "RR":
          e = o[u], t = e[1], n = e[2], q = e[3], z = e[4], B = e[5], w = { x: t, y: n }, s.roundRect(t, n, q, z, B);
          break;
        default:
          throw new Error("Invalid path command: ".concat(g));
      }
      b ? (b.x = t, b.y = n) : b = { x: t, y: n };
    }
  }
  function S(s, o, t, n) {
    let a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 0;
    if (typeof a == "number" && (a = [a]), Array.isArray(a)) {
      if (a.length === 0 || a.length > 4)
        throw new RangeError("Failed to execute 'roundRect' on '".concat(this.constructor.name, "': ").concat(a.length, " radii provided. Between one and four radii are necessary."));
      a.forEach((x) => {
        if (x < 0)
          throw new RangeError("Failed to execute 'roundRect' on '".concat(this.constructor.name, "': Radius value ").concat(x, " is negative."));
      });
    } else
      return;
    if (a.length === 1 && a[0] === 0) {
      this.rect(s, o, t, n);
      return;
    }
    const c = Math.min(t, n) / 2, r = Math.min(c, a[0]);
    let h = r, l = r, i = r;
    a.length === 2 && (h = Math.min(c, a[1]), i = h), a.length === 3 && (h = Math.min(c, a[1]), i = h, l = Math.min(c, a[2])), a.length === 4 && (h = Math.min(c, a[1]), l = Math.min(c, a[2]), i = Math.min(c, a[3])), this.moveTo(s, o + n - i), this.arcTo(s, o, s + r, o, r), this.arcTo(s + t, o, s + t, o + h, h), this.arcTo(s + t, o + n, s + t - l, o + n, l), this.arcTo(s, o + n, s, o + n - i, i), this.moveTo(s, o);
  }
  function J(s) {
    if (!s)
      return;
    const o = s.prototype.fill, t = s.prototype.stroke, n = s.prototype.isPointInPath;
    s.prototype.fill = function() {
      if ((arguments.length <= 0 ? void 0 : arguments[0]) instanceof A) {
        const c = arguments.length <= 0 ? void 0 : arguments[0], r = (arguments.length <= 1 ? void 0 : arguments[1]) || "nonzero";
        return E(this, c.commands), o.apply(this, [r]);
      }
      const a = (arguments.length <= 0 ? void 0 : arguments[0]) || "nonzero";
      return o.apply(this, [a]);
    }, s.prototype.stroke = function(a) {
      a && E(this, a.commands), t.apply(this);
    }, s.prototype.isPointInPath = function() {
      for (var a = arguments.length, c = new Array(a), r = 0; r < a; r++)
        c[r] = arguments[r];
      if (c[0] instanceof A) {
        const h = c[0], l = c[1], i = c[2], x = c[3] || "nonzero";
        return E(this, h.commands), n.apply(this, [l, i, x]);
      }
      return n.apply(this, c);
    };
  }
  function K(s) {
    s && !s.prototype.roundRect && (s.prototype.roundRect = S);
  }
  function O(s) {
    s && !s.prototype.roundRect && (s.prototype.roundRect = S);
  }
  function U() {
    window && (window.CanvasRenderingContext2D && !window.Path2D && (window.Path2D = A, J(window.CanvasRenderingContext2D)), O(window.Path2D), K(window.CanvasRenderingContext2D));
  }
  U();
})();
//# sourceMappingURL=path2d-polyfill.min-9eeb6fc2.js.map
