import x from "../../../@babel/runtime/helpers/esm/typeof.mjs";
import * as t from "react";
var m = function(a) {
  var c = a.bg, r = a.children;
  return /* @__PURE__ */ t.createElement("div", {
    style: {
      width: "100%",
      height: "100%",
      background: c
    }
  }, r);
};
function f(e, a) {
  return Object.keys(e).map(function(c) {
    var r = parseFloat(c), n = "".concat(Math.floor(r * a), "%");
    return "".concat(e[c], " ").concat(n);
  });
}
var N = /* @__PURE__ */ t.forwardRef(function(e, a) {
  var c = e.prefixCls, r = e.color, n = e.gradientId, v = e.radius, u = e.style, k = e.ptg, h = e.strokeLinecap, y = e.strokeWidth, i = e.size, o = e.gapDegree, l = r && x(r) === "object", b = l ? "#FFF" : void 0, d = i / 2, g = /* @__PURE__ */ t.createElement("circle", {
    className: "".concat(c, "-circle-path"),
    r: v,
    cx: d,
    cy: d,
    stroke: b,
    strokeLinecap: h,
    strokeWidth: y,
    opacity: k === 0 ? 0 : 1,
    style: u,
    ref: a
  });
  if (!l)
    return g;
  var s = "".concat(n, "-conic"), C = o ? "".concat(180 + o / 2, "deg") : "0deg", E = f(r, (360 - o) / 360), F = f(r, 1), j = "conic-gradient(from ".concat(C, ", ").concat(E.join(", "), ")"), p = "linear-gradient(to ".concat(o ? "bottom" : "top", ", ").concat(F.join(", "), ")");
  return /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement("mask", {
    id: s
  }, g), /* @__PURE__ */ t.createElement("foreignObject", {
    x: 0,
    y: 0,
    width: i,
    height: i,
    mask: "url(#".concat(s, ")")
  }, /* @__PURE__ */ t.createElement(m, {
    bg: p
  }, /* @__PURE__ */ t.createElement(m, {
    bg: j
  }))));
});
process.env.NODE_ENV !== "production" && (N.displayName = "PtgCircle");
export {
  N as default
};
