import { jsx as t, jsxs as g } from "react/jsx-runtime";
import { mb0_25 as C, mt0_25 as x, alignItemsCenter as F, dFlexColumn as N, dFlex as v } from "./index-general.module.js";
import { classNames as s } from "./index-classNames.js";
import { DonutChart as W } from "./index-DonutChart.js";
import { IconNames as o } from "./index-IconNames.js";
import { StatusBadge as w } from "./index-StatusBadge.js";
import { Text as i, TextTypes as l, FontWeights as d } from "./index-Text.js";
import { useCallback as D } from "react";
const L = (m) => {
  const {
    badgeText: a,
    total: T,
    totalBadgeText: r,
    roundNumbers: u = !1,
    showBadge: h,
    totalText: y = "Total views",
    replacements: f
  } = m;
  function p(e, c) {
    return c ? e < 1e3 ? e.toString() : `${parseFloat((e / 1e3).toFixed(1))}K` : e.toLocaleString();
  }
  const n = D((e) => e.includes("-") ? "danger" : e.includes("+") ? "success" : "neutral", [a, r]);
  return t(W, {
    ...m,
    renderChildrenFn: (e, c, S) => g("div", {
      className: s(v, N, F),
      children: [t(i, {
        fontWeight: d.medium,
        type: l.textCaption,
        replacements: f,
        children: S
      }), t(i, {
        fontWeight: d.bold,
        type: l.heading3,
        className: s(x, C),
        translate: !1,
        children: p(c, u)
      }), h && t(w, {
        status: n(a[e]),
        text: a[e],
        icon: n(a[e]) == "success" ? o.arrowUp : n(a[e]) == "danger" ? o.arrowDown : o.remove,
        iconVariant: "reverse"
      })]
    }),
    renderChildrenNotHoveredFn: () => g("div", {
      className: s(v, N, F),
      children: [t(i, {
        fontWeight: d.medium,
        type: l.textCaption,
        replacements: f,
        children: y
      }), t(i, {
        fontWeight: d.bold,
        type: l.heading3,
        className: s(x, C),
        translate: !1,
        children: p(T, u)
      }), h && t(w, {
        status: n(r),
        text: r,
        icon: n(r) == "success" ? o.arrowUp : n(r) == "danger" ? o.arrowDown : o.remove,
        iconVariant: "reverse"
      })]
    })
  }, r);
};
export {
  L as DonutChartStatistics
};
