import { a$ as ln, b0 as an, b1 as y, aC as tn, b2 as F, b3 as w, b4 as _, b5 as un, b6 as rn, b7 as J, b8 as o, aB as S, b9 as sn, ba as on, bb as fn } from "./main-255328c3.mjs";
function cn(l) {
  return l.innerRadius;
}
function yn(l) {
  return l.outerRadius;
}
function gn(l) {
  return l.startAngle;
}
function dn(l) {
  return l.endAngle;
}
function mn(l) {
  return l && l.padAngle;
}
function pn(l, h, C, q, v, A, $, a) {
  var D = C - l, i = q - h, n = $ - v, d = a - A, u = d * D - n * i;
  if (!(u * u < y))
    return u = (n * (h - A) - d * (l - v)) / u, [l + u * D, h + u * i];
}
function U(l, h, C, q, v, A, $) {
  var a = l - C, D = h - q, i = ($ ? A : -A) / J(a * a + D * D), n = i * D, d = -i * a, u = l + n, s = h + d, f = C + n, c = q + d, j = (u + f) / 2, t = (s + c) / 2, m = f - u, g = c - s, R = m * m + g * g, b = v - A, T = u * c - f * s, E = (g < 0 ? -1 : 1) * J(fn(0, b * b * R - T * T)), I = (T * g - m * E) / R, O = (-T * m - g * E) / R, P = (T * g + m * E) / R, p = (-T * m + g * E) / R, x = I - j, e = O - t, r = P - j, z = p - t;
  return x * x + e * e > r * r + z * z && (I = P, O = p), {
    cx: I,
    cy: O,
    x01: -n,
    y01: -d,
    x11: I * (v / b - 1),
    y11: O * (v / b - 1)
  };
}
function hn() {
  var l = cn, h = yn, C = S(0), q = null, v = gn, A = dn, $ = mn, a = null, D = ln(i);
  function i() {
    var n, d, u = +l.apply(this, arguments), s = +h.apply(this, arguments), f = v.apply(this, arguments) - an, c = A.apply(this, arguments) - an, j = un(c - f), t = c > f;
    if (a || (a = n = D()), s < u && (d = s, s = u, u = d), !(s > y))
      a.moveTo(0, 0);
    else if (j > tn - y)
      a.moveTo(s * F(f), s * w(f)), a.arc(0, 0, s, f, c, !t), u > y && (a.moveTo(u * F(c), u * w(c)), a.arc(0, 0, u, c, f, t));
    else {
      var m = f, g = c, R = f, b = c, T = j, E = j, I = $.apply(this, arguments) / 2, O = I > y && (q ? +q.apply(this, arguments) : J(u * u + s * s)), P = _(un(s - u) / 2, +C.apply(this, arguments)), p = P, x = P, e, r;
      if (O > y) {
        var z = sn(O / u * w(I)), K = sn(O / s * w(I));
        (T -= z * 2) > y ? (z *= t ? 1 : -1, R += z, b -= z) : (T = 0, R = b = (f + c) / 2), (E -= K * 2) > y ? (K *= t ? 1 : -1, m += K, g -= K) : (E = 0, m = g = (f + c) / 2);
      }
      var G = s * F(m), H = s * w(m), L = u * F(b), M = u * w(b);
      if (P > y) {
        var N = s * F(g), Q = s * w(g), V = u * F(R), W = u * w(R), B;
        if (j < rn)
          if (B = pn(G, H, V, W, N, Q, L, M)) {
            var X = G - B[0], Y = H - B[1], Z = N - B[0], k = Q - B[1], nn = 1 / w(on((X * Z + Y * k) / (J(X * X + Y * Y) * J(Z * Z + k * k))) / 2), en = J(B[0] * B[0] + B[1] * B[1]);
            p = _(P, (u - en) / (nn - 1)), x = _(P, (s - en) / (nn + 1));
          } else
            p = x = 0;
      }
      E > y ? x > y ? (e = U(V, W, G, H, s, x, t), r = U(N, Q, L, M, s, x, t), a.moveTo(e.cx + e.x01, e.cy + e.y01), x < P ? a.arc(e.cx, e.cy, x, o(e.y01, e.x01), o(r.y01, r.x01), !t) : (a.arc(e.cx, e.cy, x, o(e.y01, e.x01), o(e.y11, e.x11), !t), a.arc(0, 0, s, o(e.cy + e.y11, e.cx + e.x11), o(r.cy + r.y11, r.cx + r.x11), !t), a.arc(r.cx, r.cy, x, o(r.y11, r.x11), o(r.y01, r.x01), !t))) : (a.moveTo(G, H), a.arc(0, 0, s, m, g, !t)) : a.moveTo(G, H), !(u > y) || !(T > y) ? a.lineTo(L, M) : p > y ? (e = U(L, M, N, Q, u, -p, t), r = U(G, H, V, W, u, -p, t), a.lineTo(e.cx + e.x01, e.cy + e.y01), p < P ? a.arc(e.cx, e.cy, p, o(e.y01, e.x01), o(r.y01, r.x01), !t) : (a.arc(e.cx, e.cy, p, o(e.y01, e.x01), o(e.y11, e.x11), !t), a.arc(0, 0, u, o(e.cy + e.y11, e.cx + e.x11), o(r.cy + r.y11, r.cx + r.x11), t), a.arc(r.cx, r.cy, p, o(r.y11, r.x11), o(r.y01, r.x01), !t))) : a.arc(0, 0, u, b, R, t);
    }
    if (a.closePath(), n)
      return a = null, n + "" || null;
  }
  return i.centroid = function() {
    var n = (+l.apply(this, arguments) + +h.apply(this, arguments)) / 2, d = (+v.apply(this, arguments) + +A.apply(this, arguments)) / 2 - rn / 2;
    return [F(d) * n, w(d) * n];
  }, i.innerRadius = function(n) {
    return arguments.length ? (l = typeof n == "function" ? n : S(+n), i) : l;
  }, i.outerRadius = function(n) {
    return arguments.length ? (h = typeof n == "function" ? n : S(+n), i) : h;
  }, i.cornerRadius = function(n) {
    return arguments.length ? (C = typeof n == "function" ? n : S(+n), i) : C;
  }, i.padRadius = function(n) {
    return arguments.length ? (q = n == null ? null : typeof n == "function" ? n : S(+n), i) : q;
  }, i.startAngle = function(n) {
    return arguments.length ? (v = typeof n == "function" ? n : S(+n), i) : v;
  }, i.endAngle = function(n) {
    return arguments.length ? (A = typeof n == "function" ? n : S(+n), i) : A;
  }, i.padAngle = function(n) {
    return arguments.length ? ($ = typeof n == "function" ? n : S(+n), i) : $;
  }, i.context = function(n) {
    return arguments.length ? (a = n ?? null, i) : a;
  }, i;
}
export {
  hn as d
};
