import { computed as m, ref as p, onMounted as Ze, watch as Te, openBlock as a, createElementBlock as o, normalizeClass as T, normalizeStyle as re, createBlock as I, createCommentVNode as v, unref as c, createSlots as et, withCtx as F, renderSlot as P, normalizeProps as Y, guardReactiveProps as K, createVNode as tt, createElementVNode as d, Fragment as x, renderList as k, toDisplayString as b, withKeys as lt, createTextVNode as De, nextTick as at } from "vue";
import { u as ot, o as ut, e as q, g as st, c as Ie, t as nt, a as rt, p as J, b as it, I as ct, d as ie, C as Oe, m as ce, X as vt, s as U, D as dt, i as ve, f as Q, j as Ee, k as Z, n as Ve, J as He, q as ht, r as yt } from "./index-Co2zPDEB.js";
import { _ as ft } from "./Title-Ct3mhgnX.js";
import { u as gt, U as bt } from "./usePrinter-B9fZzpeu.js";
import { D as mt } from "./DataTable-CkKLsY_o.js";
import { L as pt } from "./Legend-Gsy5kJ0j.js";
import xt from "./vue-ui-skeleton-fxdPT2Rk.js";
import { S as kt } from "./Slicer-Cm1QQUOg.js";
import _t from "./vue-ui-accordion-xaJlG5z1.js";
import { u as Me } from "./useNestedProp-BkJbU8lx.js";
import { _ as Ct } from "./PackageVersion-wA829kRV.js";
import { P as wt } from "./PenAndPaper-XIxRCYAM.js";
import { _ as Lt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const At = ["id"], $t = ["xmlns", "viewBox"], St = ["id"], Nt = ["stop-color"], zt = ["stop-color"], Ft = ["id"], Pt = ["stop-color"], Tt = ["stop-color"], Dt = ["stop-color"], It = { key: 0 }, Ot = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Et = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Vt = { key: 0 }, Ht = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Mt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Wt = ["x", "y", "font-size", "fill", "font-weight"], Rt = ["text-anchor", "font-size", "fill", "transform"], Ut = ["x1", "y1", "x2", "y2", "stroke", "stroke-width"], Xt = { key: 1 }, Gt = ["cx", "cy", "r", "fill"], jt = { key: 0 }, Bt = { key: 0 }, Yt = ["d", "stroke"], Kt = ["text-anchor", "x", "y", "fill"], qt = ["cx", "cy", "r", "fill"], Jt = { key: 0 }, Qt = ["cx", "cy", "fill"], Zt = { key: 1 }, el = ["d", "fill", "stroke"], tl = { key: 2 }, ll = ["d", "fill", "stroke"], al = ["x", "y", "font-size", "fill"], ol = ["x", "y", "width", "fill", "onClick"], ul = ["x", "y", "width", "height", "onMouseenter", "onClick"], sl = {
  key: 3,
  "data-cy-zoom": "",
  class: "vue-ui-donut-evolution-dialog"
}, nl = ["x", "y", "width", "height", "fill"], rl = ["x1", "y1", "x2", "y2", "stroke"], il = ["x1", "y2", "x2", "y1", "stroke"], cl = ["onKeypress", "cx", "cy", "r"], vl = ["d", "stroke"], dl = ["cx", "cy", "r", "fill"], hl = ["d", "fill", "stroke"], yl = { class: "vue-ui-donut-evolution-focus" }, fl = ["text-anchor", "x", "y", "fill"], gl = ["cx", "cy", "r", "fill"], bl = ["cx", "cy", "r", "fill"], ml = ["x", "y", "fill"], pl = ["x", "y", "font-size", "fill"], xl = {
  key: 5,
  class: "vue-data-ui-watermark"
}, kl = ["onClick"], _l = { key: 0 }, Cl = { key: 1 }, wl = {
  key: 9,
  ref: "source",
  dir: "auto"
}, Ll = { key: 0 }, Al = { key: 1 }, $l = {
  __name: "vue-ui-donut-evolution",
  props: {
    config: {
      type: Object,
      default() {
        return {};
      }
    },
    dataset: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  emits: ["selectLegend"],
  setup(We, { expose: Re, emit: de }) {
    const A = We, { vue_ui_donut_evolution: Ue } = ot(), X = m(() => !!A.dataset && A.dataset.length), h = p({
      start: 0,
      end: Math.max(...A.dataset.map((l) => l.values.length))
    });
    function he() {
      h.value = {
        start: 0,
        end: W.value
      }, ge.value += 1;
    }
    Ze(() => {
      ye();
    });
    function ye() {
      ut(A.dataset) ? q({
        componentName: "VueUiDonutEvolution",
        type: "dataset"
      }) : A.dataset.length && A.dataset.forEach((l, i) => {
        st({
          datasetObject: l,
          requiredAttributes: ["name", "values"]
        }).forEach((t) => {
          q({
            componentName: "VueUiDonutEvolution",
            type: "datasetSerieAttribute",
            property: t,
            index: i
          });
        });
      });
    }
    const O = p(Ie()), _ = p([]), g = p(null), ee = p(null), $ = p(!1), S = p(null), te = p(null), Xe = p(null), fe = p(0), ge = p(0), be = p(0), me = p(0), pe = p(0), e = m({
      get: () => xe(),
      set: (l) => l
    });
    function xe() {
      const l = Me({
        userConfig: A.config,
        defaultConfig: Ue
      });
      return l.theme ? {
        ...Me({
          userConfig: nt.vue_ui_donut_evolution[l.theme] || A.config,
          defaultConfig: l
        }),
        customPalette: rt[l.theme] || J
      } : l;
    }
    Te(() => A.config, (l) => {
      e.value = xe(), ye(), be.value += 1, me.value += 1, pe.value += 1;
    }, { deep: !0 }), Te(() => A.dataset, (l) => {
      he();
    }, { deep: !0 });
    const { isPrinting: ke, isImaging: _e, generatePdf: Ce, generateImage: we } = gt({
      elementId: O.value,
      fileName: e.value.style.chart.title.text || "vue-ui-donut-evolution"
    }), Ge = m(() => e.value.userOptions.show && !e.value.style.chart.title.text), je = m(() => it(e.value.customPalette)), G = p({
      showTable: e.value.table.show
    }), s = m(() => ({
      top: e.value.style.chart.layout.padding.top,
      right: e.value.style.chart.layout.padding.right,
      bottom: e.value.style.chart.layout.padding.bottom,
      left: e.value.style.chart.layout.padding.left
    })), r = m(() => {
      const l = e.value.style.chart.layout.height, i = e.value.style.chart.layout.width, t = l - s.value.top - s.value.bottom, n = i - s.value.left - s.value.right;
      return {
        absoluteHeight: l,
        absoluteWidth: i,
        centerX: s.value.left + n / 2,
        centerY: s.value.top + t / 2,
        height: t,
        width: n
      };
    }), D = m(() => (A.dataset.forEach((l, i) => {
      [null, void 0].includes(l.name) && q({
        componentName: "VueUiDonutEvolution",
        type: "datasetSerieAttribute",
        property: "name",
        index: i
      }), [null, void 0].includes(l.values) && q({
        componentName: "VueUiDonutEvolution",
        type: "datasetSerieAttribute",
        property: "values",
        index: i
      });
    }), A.dataset.map((l, i) => ({
      ...l,
      values: ct(l.values),
      color: ie(l.color) || je.value[i] || J[i] || J[i % J.length],
      length: (l.values || []).length,
      uid: Ie()
    })))), M = m(() => D.value.filter((l) => !_.value.includes(l.uid)).map((l) => ({
      ...l,
      values: l.values.filter((i, t) => t >= h.value.start && t <= h.value.end)
    }))), W = m(() => Math.max(...M.value.map((l) => l.length))), w = m(() => r.value.width / (h.value.end - h.value.start)), C = m(() => {
      const l = [];
      for (let u = 0; u < h.value.end - h.value.start; u += 1) {
        const f = M.value.map((z) => z.values[u] ?? null), y = f.filter((z) => [void 0, null].includes(z)).length === f.length, N = f.reduce((z, L) => z + L, 0), ne = f.map((z) => z / N), H = s.value.left + w.value * u + w.value / 2;
        l.push({
          index: u,
          percentages: ne,
          subtotal: y || N < 0 ? null : N,
          values: f,
          x: H
        });
      }
      const i = 0, t = Math.max(...l.map((u) => u.subtotal)), n = l.length === 1 ? t * 2 : t;
      return l.map((u, f) => {
        const y = w.value / 2 * 0.7, N = y > r.value.width / 16 ? r.value.width / 16 : y, ne = g.value === u.index ? r.value.width / 16 : N, H = l.length > 4 ? y * 2 : y * 2 > w.value / 2 * 0.7 ? w.value / 2 * 0.7 : y * 2, z = r.value.absoluteHeight - s.value.bottom - r.value.height * u.subtotal / Oe(i, n, e.value.style.chart.layout.grid.yAxis.dataLabels.steps).max;
        return {
          ...u,
          y: z,
          radius: N,
          activeRadius: ne,
          hoverRadius: H,
          donut: ce({
            series: M.value.map((L, Pe) => ({
              color: L.color,
              name: L.name,
              value: L.values[f] ?? 0
            }))
          }, u.x, z, N, N, 1.99999, 2, 1, 360, 105.25, N / 2),
          donutHover: ce({
            series: M.value.map((L, Pe) => ({
              color: L.color,
              name: L.name,
              value: L.values[f] ?? 0
            }))
          }, u.x, z, H, H, 1.99999, 2, 1, 360, 105.25, H / 2),
          donutFocus: ce({
            series: M.value.map((L, Pe) => ({
              color: L.color,
              name: L.name,
              value: L.values[f] ?? 0
            }))
          }, r.value.centerX, r.value.centerY, r.value.height / 3.6, r.value.height / 3.6, 1.99999, 2, 1, 360, 105.25, r.value.height / 6)
        };
      });
    });
    function j(l, i, t) {
      return ve(
        e.value.style.chart.layout.dataLabels.formatter,
        l,
        Q({
          p: e.value.style.chart.layout.dataLabels.prefix,
          v: l,
          s: e.value.style.chart.layout.dataLabels.suffix,
          r: e.value.style.chart.layout.dataLabels.rounding
        }),
        { datapoint: i, index: t }
      );
    }
    const le = m(() => ({
      max: Math.max(...C.value.map((l) => l.subtotal)),
      min: 0
    })), E = m(() => {
      const l = C.value.length === 1 ? le.value.max * 2 : le.value.max;
      return Oe(le.value.min, l, e.value.style.chart.layout.grid.yAxis.dataLabels.steps);
    });
    function Be(l) {
      return l / E.value.max;
    }
    const Ye = m(() => E.value.ticks.map((l) => ({
      y: r.value.absoluteHeight - s.value.bottom - r.value.height * Be(l),
      value: l
    })));
    function Le(l, i) {
      return isNaN(l.value / He(i, "value")) ? 0 : (l.value / He(i, "value") * 100).toFixed(0) + "%";
    }
    function Ae() {
      $.value || (g.value = null, ee.value = null);
    }
    function Ke(l) {
      $.value || (g.value = l.index, ee.value = l);
    }
    const ae = p(null);
    function oe(l, i) {
      l.subtotal && (ee.value = null, g.value = null, $.value = !0, S.value = l, [null, void 0].includes(i) || (ae.value = i));
    }
    function $e() {
      S.value = null, $.value = !1, ae.value = null;
    }
    const Se = m(() => D.value.map((l, i) => ({
      name: l.name,
      value: l.values.slice(h.value.start, h.value.end).reduce((t, n) => t + n, 0),
      shape: "circle",
      uid: l.uid,
      color: l.color
    })).sort((l, i) => i.value - l.value).map((l) => ({
      ...l,
      opacity: _.value.includes(l.uid) ? 0.5 : 1,
      segregate: () => ue(l.uid),
      isSegregated: _.value.includes(l.uid)
    }))), Ne = m(() => C.value.map((l) => l.subtotal).reduce((l, i) => l + i, 0)), qe = m(() => ({
      cy: "donut-div-legend",
      backgroundColor: e.value.style.chart.legend.backgroundColor,
      color: e.value.style.chart.legend.color,
      fontSize: e.value.style.chart.legend.fontSize,
      paddingBottom: 12,
      fontWeight: e.value.style.chart.legend.bold ? "bold" : ""
    }));
    function ue(l) {
      if (_.value.includes(l))
        _.value = _.value.filter((i) => i !== l), de("selectLegend", null);
      else {
        if (_.value.length === D.value.length - 1) return;
        _.value.push(l), de("selectLegend", D.value.find((i) => i.uid === l));
      }
      S.value && oe(C.value.find((i, t) => t === ae.value));
    }
    const V = m(() => {
      const l = [""].concat(D.value.filter((u) => !_.value.includes(u.uid)).map((u) => ({
        name: u.name,
        color: u.color
      }))).concat(["Σ"]);
      let i = [];
      for (let u = 0; u < W.value; u += 1) {
        const f = D.value.filter((y) => !_.value.includes(y.uid)).map((y) => y.values[u] ?? 0).reduce((y, N) => y + N, 0);
        i.push([e.value.style.chart.layout.grid.xAxis.dataLabels.values[u] ?? "-"].concat(D.value.filter((y) => !_.value.includes(y.uid)).map((y) => ({
          value: y.values[u] ?? 0,
          percentage: y.values[u] ? y.values[u] / f * 100 : 0
        }))).concat([`${e.value.style.chart.layout.dataLabels.prefix}${Number(f.toFixed(e.value.table.td.roundingValue))}${e.value.style.chart.layout.dataLabels.suffix}`]));
      }
      const t = {
        th: {
          backgroundColor: e.value.table.th.backgroundColor,
          color: e.value.table.th.color,
          outline: e.value.table.th.outline
        },
        td: {
          backgroundColor: e.value.table.td.backgroundColor,
          color: e.value.table.td.color,
          outline: e.value.table.td.outline
        },
        breakpoint: e.value.table.responsiveBreakpoint
      }, n = [
        e.value.table.columnNames.period
      ].concat(D.value.filter((u) => !_.value.includes(u.uid)).map((u) => u.name)).concat(e.value.table.columnNames.total);
      return { head: l, body: i, config: t, colNames: n };
    });
    function Je() {
      return D.value;
    }
    function ze() {
      at(() => {
        const l = [[e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [""]], i = [...V.value.head.map((f) => f.name ?? f)], t = [...V.value.body.map((f) => f.map((y) => y.value ?? y))], n = l.concat([i]).concat(t), u = ht(n);
        yt({ csvContent: u, title: e.value.style.chart.title.text || "vue-ui-donut-evolution" });
      });
    }
    const R = p(!1);
    function Qe(l) {
      R.value = l, fe.value += 1;
    }
    function Fe() {
      G.value.showTable = !G.value.showTable;
    }
    const B = p(!1);
    function se() {
      B.value = !B.value;
    }
    return Re({
      getData: Je,
      generatePdf: Ce,
      generateCsv: ze,
      generateImage: we,
      toggleTable: Fe,
      toggleAnnotator: se
    }), (l, i) => (a(), o("div", {
      ref_key: "donutEvolutionChart",
      ref: te,
      class: T(`vue-ui-donut-evolution ${R.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${e.value.useCssAnimation ? "" : "vue-ui-dna"}`),
      style: re(`font-family:${e.value.style.fontFamily};width:100%; text-align:center;background:${e.value.style.chart.backgroundColor}`),
      id: O.value
    }, [
      e.value.userOptions.buttons.annotator ? (a(), I(wt, {
        key: 0,
        parent: te.value,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        active: B.value,
        onClose: se
      }, null, 8, ["parent", "backgroundColor", "color", "active"])) : v("", !0),
      Ge.value ? (a(), o("div", {
        key: 1,
        ref_key: "noTitle",
        ref: Xe,
        class: "vue-data-ui-no-title-space",
        style: "height:36px; width: 100%;background:transparent"
      }, null, 512)) : v("", !0),
      e.value.style.chart.title.text ? (a(), o("div", {
        key: 2,
        style: "width:100%;background:transparent;padding-bottom:24px",
        onMouseleave: Ae
      }, [
        (a(), I(ft, {
          key: `title_${be.value}`,
          config: {
            title: {
              cy: "donut-evolution-div-title",
              ...e.value.style.chart.title
            },
            subtitle: {
              cy: "donut-evolution-div-subtitle",
              ...e.value.style.chart.title.subtitle
            }
          }
        }, null, 8, ["config"]))
      ], 32)) : v("", !0),
      e.value.userOptions.show && X.value ? (a(), I(bt, {
        ref: "details",
        key: `user_options_${fe.value}`,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        isPrinting: c(ke),
        isImaging: c(_e),
        uid: O.value,
        hasPdf: e.value.userOptions.buttons.pdf,
        hasImg: e.value.userOptions.buttons.img,
        hasXls: e.value.userOptions.buttons.csv,
        hasTable: e.value.userOptions.buttons.table,
        hasFullscreen: e.value.userOptions.buttons.fullscreen,
        isFullscreen: R.value,
        titles: { ...e.value.userOptions.buttonTitles },
        chartElement: te.value,
        position: e.value.userOptions.position,
        hasAnnotator: e.value.userOptions.buttons.annotator,
        isAnnotation: B.value,
        onToggleFullscreen: Qe,
        onGeneratePdf: c(Ce),
        onGenerateCsv: ze,
        onGenerateImage: c(we),
        onToggleTable: Fe,
        onToggleAnnotator: se
      }, et({ _: 2 }, [
        l.$slots.optionPdf ? {
          name: "optionPdf",
          fn: F(() => [
            P(l.$slots, "optionPdf", {}, void 0, !0)
          ]),
          key: "0"
        } : void 0,
        l.$slots.optionCsv ? {
          name: "optionCsv",
          fn: F(() => [
            P(l.$slots, "optionCsv", {}, void 0, !0)
          ]),
          key: "1"
        } : void 0,
        l.$slots.optionImg ? {
          name: "optionImg",
          fn: F(() => [
            P(l.$slots, "optionImg", {}, void 0, !0)
          ]),
          key: "2"
        } : void 0,
        l.$slots.optionTable ? {
          name: "optionTable",
          fn: F(() => [
            P(l.$slots, "optionTable", {}, void 0, !0)
          ]),
          key: "3"
        } : void 0,
        l.$slots.optionFullscreen ? {
          name: "optionFullscreen",
          fn: F(({ toggleFullscreen: t, isFullscreen: n }) => [
            P(l.$slots, "optionFullscreen", Y(K({ toggleFullscreen: t, isFullscreen: n })), void 0, !0)
          ]),
          key: "4"
        } : void 0,
        l.$slots.optionAnnotator ? {
          name: "optionAnnotator",
          fn: F(({ toggleAnnotator: t, isAnnotator: n }) => [
            P(l.$slots, "optionAnnotator", Y(K({ toggleAnnotator: t, isAnnotator: n })), void 0, !0)
          ]),
          key: "5"
        } : void 0
      ]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasPdf", "hasImg", "hasXls", "hasTable", "hasFullscreen", "isFullscreen", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage"])) : v("", !0),
      X.value ? (a(), o("svg", {
        key: 4,
        xmlns: c(vt),
        class: T({ "vue-data-ui-fullscreen--on": R.value, "vue-data-ui-fulscreen--off": !R.value }),
        viewBox: `0 0 ${r.value.absoluteWidth} ${r.value.absoluteHeight}`,
        style: re(`max-width:100%; overflow: visible; background:transparent;color:${e.value.style.chart.color}`)
      }, [
        tt(Ct),
        d("defs", null, [
          d("linearGradient", {
            id: `hover_${O.value}`,
            x1: "0%",
            y1: "0%",
            x2: "0%",
            y2: "100%"
          }, [
            d("stop", {
              offset: "0%",
              "stop-color": c(U)(e.value.style.chart.backgroundColor, e.value.style.chart.layout.highlighter.opacity)
            }, null, 8, Nt),
            d("stop", {
              offset: "100%",
              "stop-color": c(U)(e.value.style.chart.layout.highlighter.color, e.value.style.chart.layout.highlighter.opacity)
            }, null, 8, zt)
          ], 8, St),
          d("radialGradient", {
            id: `focus_${O.value}`
          }, [
            d("stop", {
              offset: "0%",
              "stop-color": c(U)(c(ie)(e.value.style.chart.backgroundColor), 0)
            }, null, 8, Pt),
            d("stop", {
              offset: "77%",
              "stop-color": c(U)("#FFFFFF", 30)
            }, null, 8, Tt),
            d("stop", {
              offset: "100%",
              "stop-color": c(U)(c(ie)(e.value.style.chart.backgroundColor), 0)
            }, null, 8, Dt)
          ], 8, Ft)
        ]),
        e.value.style.chart.layout.grid.show ? (a(), o("g", It, [
          d("line", {
            x1: s.value.left,
            x2: s.value.left,
            y1: s.value.top,
            y2: s.value.top + r.value.height,
            stroke: e.value.style.chart.layout.grid.stroke,
            "stroke-width": e.value.style.chart.layout.grid.strokeWidth,
            "stroke-linecap": "round"
          }, null, 8, Ot),
          d("line", {
            x1: s.value.left,
            x2: r.value.absoluteWidth - s.value.right,
            y1: r.value.absoluteHeight - s.value.bottom,
            y2: r.value.absoluteHeight - s.value.bottom,
            stroke: e.value.style.chart.layout.grid.stroke,
            "stroke-width": e.value.style.chart.layout.grid.strokeWidth,
            "stroke-linecap": "round"
          }, null, 8, Et),
          e.value.style.chart.layout.grid.showVerticalLines ? (a(), o("g", Vt, [
            (a(!0), o(x, null, k(h.value.end - h.value.start, (t, n) => (a(), o("line", {
              x1: s.value.left + (n + 1) * w.value,
              x2: s.value.left + (n + 1) * w.value,
              y1: s.value.top,
              y2: r.value.absoluteHeight - s.value.bottom,
              stroke: e.value.style.chart.layout.grid.stroke,
              "stroke-width": e.value.style.chart.layout.grid.strokeWidth,
              "stroke-linecap": "round"
            }, null, 8, Ht))), 256))
          ])) : v("", !0)
        ])) : v("", !0),
        e.value.style.chart.layout.grid.yAxis.dataLabels.show ? (a(), o("g", {
          key: 1,
          class: T({ "donut-opacity": !0, "donut-behind": g.value !== null || $.value })
        }, [
          (a(!0), o(x, null, k(Ye.value, (t, n) => (a(), o("g", null, [
            t.value >= E.value.min && t.value <= E.value.max ? (a(), o("line", {
              key: 0,
              x1: s.value.left,
              x2: s.value.left - 5,
              y1: t.y,
              y2: t.y,
              stroke: e.value.style.chart.layout.grid.stroke,
              "stroke-width": e.value.style.chart.layout.grid.strokeWidth
            }, null, 8, Mt)) : v("", !0),
            t.value >= E.value.min && t.value <= E.value.max ? (a(), o("text", {
              key: 1,
              x: s.value.left - 8 + e.value.style.chart.layout.grid.yAxis.dataLabels.offsetX,
              y: t.y + e.value.style.chart.layout.grid.yAxis.dataLabels.fontSize / 3,
              "font-size": e.value.style.chart.layout.grid.yAxis.dataLabels.fontSize,
              "text-anchor": "end",
              fill: e.value.style.chart.layout.grid.yAxis.dataLabels.color,
              "font-weight": e.value.style.chart.layout.grid.yAxis.dataLabels.bold ? "bold" : "normal"
            }, b(c(dt)(t.value) ? c(ve)(
              e.value.style.chart.layout.dataLabels.formatter,
              t.value,
              c(Q)({
                p: e.value.style.chart.layout.dataLabels.prefix,
                v: t.value,
                s: e.value.style.chart.layout.dataLabels.suffix,
                r: e.value.style.chart.layout.grid.yAxis.dataLabels.roundingValue
              }),
              { datapoint: t, seriesIndex: n }
            ) : ""), 9, Wt)) : v("", !0)
          ]))), 256))
        ], 2)) : v("", !0),
        e.value.style.chart.layout.grid.xAxis.dataLabels.show ? (a(), o("g", {
          key: 2,
          class: T({ "donut-opacity": !0, "donut-behind": $.value })
        }, [
          (a(!0), o(x, null, k(h.value.end - h.value.start, (t, n) => (a(), o("g", null, [
            e.value.style.chart.layout.grid.xAxis.dataLabels.showOnlyFirstAndLast && (n === 0 || n === W.value - 1) || !e.value.style.chart.layout.grid.xAxis.dataLabels.showOnlyFirstAndLast ? (a(), o("text", {
              key: 0,
              "text-anchor": e.value.style.chart.layout.grid.xAxis.dataLabels.rotation > 0 ? "start" : e.value.style.chart.layout.grid.xAxis.dataLabels.rotation < 0 ? "end" : "middle",
              "font-size": e.value.style.chart.layout.grid.xAxis.dataLabels.fontSize,
              fill: e.value.style.chart.layout.grid.xAxis.dataLabels.color,
              transform: `translate(${s.value.left + w.value * n + w.value / 2}, ${e.value.style.chart.layout.grid.xAxis.dataLabels.offsetY + r.value.absoluteHeight - s.value.bottom + e.value.style.chart.layout.grid.xAxis.dataLabels.fontSize * 2}), rotate(${e.value.style.chart.layout.grid.xAxis.dataLabels.rotation})`
            }, b(e.value.style.chart.layout.grid.xAxis.dataLabels.values[Number(n) + Number(h.value.start)] ?? ""), 9, Rt)) : v("", !0)
          ]))), 256))
        ], 2)) : v("", !0),
        (a(!0), o(x, null, k(C.value, (t, n) => (a(), o("g", null, [
          e.value.style.chart.layout.line.show && n < C.value.length - 1 && ![t.subtotal, C.value[n + 1].subtotal].includes(null) ? (a(), o("line", {
            key: 0,
            class: T({ "donut-opacity": !0, "donut-behind": g.value !== null || $.value }),
            x1: t.x,
            y1: t.y,
            x2: C.value[n + 1].x,
            y2: C.value[n + 1].y,
            stroke: e.value.style.chart.layout.line.stroke,
            "stroke-width": e.value.style.chart.layout.line.strokeWidth,
            "stroke-linecap": "round",
            "stroke-linejoin": "round"
          }, null, 10, Ut)) : v("", !0),
          t.subtotal !== null ? (a(), o("g", Xt, [
            t.subtotal ? (a(), o("circle", {
              key: 0,
              cx: t.x,
              cy: t.y,
              r: t.activeRadius,
              fill: e.value.style.chart.backgroundColor
            }, null, 8, Gt)) : v("", !0)
          ])) : v("", !0)
        ]))), 256)),
        (a(!0), o(x, null, k(C.value, (t, n) => (a(), o("g", {
          class: T({ "donut-opacity": !0, "donut-behind": n !== g.value && g.value !== null || $.value })
        }, [
          t.subtotal ? (a(), o("g", jt, [
            g.value !== null && g.value === n ? (a(), o("g", Bt, [
              (a(!0), o(x, null, k(t.donutHover, (u) => (a(), o("g", null, [
                d("path", {
                  d: c(Ee)(u, { x: u.center.endX, y: u.center.endY }, 12, 12, { x: t.x, y: t.y }, !0, 20),
                  stroke: u.color,
                  "stroke-width": "1",
                  "stroke-linecap": "round",
                  "stroke-linejoin": "round",
                  fill: "none"
                }, null, 8, Yt)
              ]))), 256)),
              (a(!0), o(x, null, k(t.donutHover, (u, f) => (a(), o("g", null, [
                d("text", {
                  "data-cy-hover-label": "",
                  "text-anchor": c(Z)(u, !0, 0).anchor,
                  x: c(Z)(u, !0, 3).x,
                  y: c(Ve)(u),
                  fill: e.value.style.chart.layout.grid.yAxis.dataLabels.color,
                  "font-size": 8,
                  "font-weight": "bold"
                }, b(u.name) + ": " + b(Le(u, t.donut)) + " (" + b(u.value === null ? "-" : j(u.value, u, f)) + ") ", 9, Kt)
              ]))), 256)),
              d("g", null, [
                d("circle", {
                  cx: t.x,
                  cy: t.y,
                  r: t.hoverRadius,
                  fill: e.value.style.chart.backgroundColor
                }, null, 8, qt)
              ])
            ])) : v("", !0)
          ])) : v("", !0)
        ], 2))), 256)),
        (a(!0), o(x, null, k(C.value, (t, n) => (a(), o("g", {
          class: T({ "donut-opacity": !0, "donut-behind": n !== g.value && g.value !== null || $.value })
        }, [
          t.subtotal !== null ? (a(), o("g", Jt, [
            t.subtotal === 0 ? (a(), o("circle", {
              key: 0,
              cx: t.x,
              cy: t.y,
              r: 3,
              fill: e.value.style.chart.color
            }, null, 8, Qt)) : g.value !== null && g.value === n ? (a(), o("g", Zt, [
              (a(!0), o(x, null, k(t.donutHover, (u, f) => (a(), o("path", {
                d: u.arcSlice,
                fill: `${u.color}`,
                "stroke-width": 1,
                stroke: e.value.style.chart.backgroundColor
              }, null, 8, el))), 256))
            ])) : (a(), o("g", tl, [
              (a(!0), o(x, null, k(t.donut, (u, f) => (a(), o("path", {
                d: u.arcSlice,
                fill: `${u.color}`,
                "stroke-width": 0.5,
                stroke: e.value.style.chart.backgroundColor
              }, null, 8, ll))), 256))
            ]))
          ])) : v("", !0)
        ], 2))), 256)),
        (a(!0), o(x, null, k(C.value, (t, n) => (a(), o("g", {
          class: T({ "donut-opacity": !0, "donut-behind": n !== g.value && g.value !== null || $.value })
        }, [
          t.subtotal !== null && e.value.style.chart.layout.dataLabels.show ? (a(), o("text", {
            key: 0,
            "text-anchor": "middle",
            x: t.x,
            y: g.value === t.index && t.subtotal ? t.y + e.value.style.chart.layout.dataLabels.fontSize / 3 : t.y - t.radius - e.value.style.chart.layout.dataLabels.fontSize + e.value.style.chart.layout.dataLabels.offsetY,
            "font-size": e.value.style.chart.layout.dataLabels.fontSize,
            "font-weight": "bold",
            fill: e.value.style.chart.layout.dataLabels.color
          }, b(j(t.subtotal, t, n)), 9, al)) : v("", !0)
        ], 2))), 256)),
        (a(!0), o(x, null, k(C.value, (t, n) => (a(), o("rect", {
          x: s.value.left + n * w.value,
          y: r.value.absoluteHeight - s.value.bottom - 10,
          width: w.value,
          height: 10,
          fill: g.value === t.index ? `url(#hover_${O.value})` : "transparent",
          onClick: (u) => oe(t, n),
          class: T({ "donut-hover": g.value === t.index && t.subtotal })
        }, null, 10, ol))), 256)),
        (a(!0), o(x, null, k(C.value, (t, n) => (a(), o("rect", {
          "data-cy-trap": "",
          x: s.value.left + n * w.value,
          y: s.value.top,
          width: w.value,
          height: r.value.height,
          fill: "transparent",
          onMouseenter: (u) => Ke(t),
          onMouseleave: Ae,
          onClick: (u) => oe(t, n),
          class: T({ "donut-hover": g.value === t.index && t.subtotal })
        }, null, 42, ul))), 256)),
        $.value ? (a(), o("g", sl, [
          d("rect", {
            rx: 4,
            x: s.value.left,
            y: s.value.top,
            width: r.value.width,
            height: r.value.height,
            fill: e.value.style.chart.backgroundColor,
            style: { filter: "drop-shadow(0 12px 12px rgba(0,0,0,0.3))" }
          }, null, 8, nl),
          d("line", {
            "data-html2canvas-ignore": "",
            x1: r.value.absoluteWidth - s.value.right - 15,
            y1: s.value.top + 5,
            x2: r.value.absoluteWidth - s.value.right - 4,
            y2: s.value.top + 15.5,
            "stroke-linecap": "round",
            stroke: e.value.style.chart.color,
            "stroke-width": "1.5"
          }, null, 8, rl),
          d("line", {
            "data-html2canvas-ignore": "",
            x1: r.value.absoluteWidth - s.value.right - 15,
            y2: s.value.top + 5,
            x2: r.value.absoluteWidth - s.value.right - 4,
            y1: s.value.top + 15.5,
            "stroke-linecap": "round",
            stroke: e.value.style.chart.color,
            "stroke-width": "1.5"
          }, null, 8, il),
          d("circle", {
            "data-cy-close": "",
            onClick: $e,
            onKeypress: lt($e, ["enter"]),
            cx: r.value.absoluteWidth - s.value.right - r.value.width / 40,
            cy: s.value.top + r.value.height / 30,
            r: r.value.height / 12,
            fill: "transparent",
            style: { cursor: "pointer" },
            tabindex: "0"
          }, null, 40, cl),
          (a(!0), o(x, null, k(S.value.donutFocus, (t) => (a(), o("g", null, [
            d("path", {
              "data-cy-zoom-donut": "",
              d: c(Ee)(t, { x: r.value.centerX, y: r.value.centerY }, 12, 12, !1, !1, 15),
              stroke: t.color,
              "stroke-width": "1",
              "stroke-linecap": "round",
              "stroke-linejoin": "round",
              fill: "none",
              class: "vue-ui-donut-evolution-focus"
            }, null, 8, vl)
          ]))), 256)),
          d("circle", {
            cx: s.value.left + r.value.width / 2,
            cy: s.value.top + r.value.height / 2,
            r: r.value.height / 7,
            fill: e.value.style.chart.backgroundColor
          }, null, 8, dl),
          (a(!0), o(x, null, k(S.value.donutFocus, (t, n) => (a(), o("path", {
            d: t.arcSlice,
            fill: `${t.color}`,
            "stroke-width": 1,
            stroke: e.value.style.chart.backgroundColor,
            class: "vue-ui-donut-evolution-focus"
          }, null, 8, hl))), 256)),
          (a(!0), o(x, null, k(S.value.donutFocus, (t, n) => (a(), o("g", yl, [
            d("text", {
              "text-anchor": c(Z)(t, !0, 20).anchor,
              x: c(Z)(t, !0, 10).x,
              y: c(Ve)(t),
              fill: e.value.style.chart.layout.grid.yAxis.dataLabels.color,
              "font-size": 10,
              "font-weight": "bold"
            }, b(t.name) + ": " + b(Le(t, S.value.donutFocus)) + " (" + b(t.value === null ? "-" : j(t.value, t, n)) + ") ", 9, fl)
          ]))), 256)),
          d("circle", {
            cx: s.value.left + r.value.width / 2,
            cy: s.value.top + r.value.height / 2,
            r: r.value.height / 3.8,
            fill: `url(#focus_${O.value})`
          }, null, 8, gl),
          d("circle", {
            cx: s.value.left + r.value.width / 2,
            cy: s.value.top + r.value.height / 2,
            r: r.value.height / 7.7,
            fill: e.value.style.chart.backgroundColor
          }, null, 8, bl),
          d("text", {
            "text-anchor": "middle",
            x: s.value.left + r.value.width / 2,
            y: s.value.top + r.value.height / 2 + 14 / 3,
            "font-size": 14,
            "font-weight": "bold",
            fill: e.value.style.chart.layout.dataLabels.color,
            class: "vue-ui-donut-evolution-focus"
          }, b(j(S.value.subtotal, S.value, null)), 9, ml),
          e.value.style.chart.layout.grid.xAxis.dataLabels.values[S.value.index] ? (a(), o("text", {
            key: 0,
            x: s.value.left + 6,
            y: s.value.top + e.value.style.chart.layout.grid.xAxis.dataLabels.fontSize * 2,
            "font-size": e.value.style.chart.layout.grid.xAxis.dataLabels.fontSize * 1.6,
            fill: e.value.style.chart.layout.dataLabels.color
          }, b(e.value.style.chart.layout.grid.xAxis.dataLabels.values[Number(S.value.index) + Number(h.value.start)]), 9, pl)) : v("", !0)
        ])) : v("", !0),
        P(l.$slots, "svg", { svg: r.value }, void 0, !0)
      ], 14, $t)) : v("", !0),
      l.$slots.watermark ? (a(), o("div", xl, [
        P(l.$slots, "watermark", Y(K({ isPrinting: c(ke) || c(_e) })), void 0, !0)
      ])) : v("", !0),
      X.value ? v("", !0) : (a(), I(xt, {
        key: 6,
        config: {
          type: "donutEvolution",
          style: {
            backgroundColor: e.value.style.chart.backgroundColor,
            donutEvolution: {
              axis: {
                color: "#CCCCCC"
              },
              donuts: {
                color: "#CCCCCC"
              }
            }
          }
        }
      }, null, 8, ["config"])),
      W.value > 1 && e.value.style.chart.zoom.show ? (a(), I(kt, {
        key: `slicer_${ge.value}`,
        background: e.value.style.chart.zoom.color,
        borderColor: e.value.style.chart.backgroundColor,
        fontSize: e.value.style.chart.zoom.fontSize,
        useResetSlot: e.value.style.chart.zoom.useResetSlot,
        labelLeft: e.value.style.chart.layout.grid.xAxis.dataLabels.values[Number(h.value.start)] || "",
        labelRight: e.value.style.chart.layout.grid.xAxis.dataLabels.values[Number(h.value.end) - 1] || "",
        textColor: e.value.style.chart.color,
        inputColor: e.value.style.chart.zoom.color,
        selectColor: e.value.style.chart.zoom.highlightColor,
        max: W.value,
        min: 0,
        valueStart: h.value.start,
        valueEnd: h.value.end,
        start: h.value.start,
        "onUpdate:start": i[0] || (i[0] = (t) => h.value.start = t),
        end: h.value.end,
        "onUpdate:end": i[1] || (i[1] = (t) => h.value.end = t),
        onReset: he
      }, {
        "reset-action": F(({ reset: t }) => [
          P(l.$slots, "reset-action", Y(K({ reset: t })), void 0, !0)
        ]),
        _: 3
      }, 8, ["background", "borderColor", "fontSize", "useResetSlot", "labelLeft", "labelRight", "textColor", "inputColor", "selectColor", "max", "valueStart", "valueEnd", "start", "end"])) : v("", !0),
      e.value.style.chart.legend.show ? (a(), I(pt, {
        key: `legend_${pe.value}`,
        legendSet: Se.value,
        config: qe.value,
        onClickMarker: i[2] || (i[2] = ({ legend: t }) => ue(t.uid))
      }, {
        item: F(({ legend: t, index: n }) => [
          d("div", {
            "data-cy-legend-item": "",
            onClick: (u) => ue(t.uid),
            style: re(`opacity:${_.value.includes(t.uid) ? 0.5 : 1}`)
          }, [
            De(b(t.name) + ": " + b(c(ve)(
              e.value.style.chart.layout.dataLabels.formatter,
              t.value,
              c(Q)({
                p: e.value.style.chart.layout.dataLabels.prefix,
                v: t.value,
                s: e.value.style.chart.layout.dataLabels.suffix,
                r: e.value.style.chart.legend.roundingValue
              }),
              { datapoint: t, seriesIndex: n }
            )) + " ", 1),
            _.value.includes(t.uid) ? (a(), o("span", Cl, " ( - % ) ")) : (a(), o("span", _l, " (" + b(isNaN(t.value / Ne.value) ? "-" : c(Q)({
              v: t.value / Ne.value * 100,
              s: "%",
              r: e.value.style.chart.legend.roundingPercentage
            })) + ") ", 1))
          ], 12, kl)
        ]),
        _: 1
      }, 8, ["legendSet", "config"])) : v("", !0),
      P(l.$slots, "legend", { legend: Se.value }, void 0, !0),
      l.$slots.source ? (a(), o("div", wl, [
        P(l.$slots, "source", {}, void 0, !0)
      ], 512)) : v("", !0),
      X.value ? (a(), I(_t, {
        key: 10,
        hideDetails: "",
        config: {
          open: G.value.showTable,
          maxHeight: 1e4,
          body: {
            backgroundColor: e.value.style.chart.backgroundColor,
            color: e.value.style.chart.color
          },
          head: {
            backgroundColor: e.value.style.chart.backgroundColor,
            color: e.value.style.chart.color
          }
        }
      }, {
        content: F(() => [
          (a(), I(mt, {
            key: `table_${me.value}`,
            colNames: V.value.colNames,
            head: V.value.head,
            body: V.value.body,
            config: V.value.config,
            title: `${e.value.style.chart.title.text}${e.value.style.chart.title.subtitle.text ? ` : ${e.value.style.chart.title.subtitle.text}` : ""}`,
            onClose: i[3] || (i[3] = (t) => G.value.showTable = !1)
          }, {
            th: F(({ th: t }) => [
              De(b(t.name ?? t), 1)
            ]),
            td: F(({ td: t }) => [
              t.value === null ? (a(), o("span", Ll, "-")) : (a(), o("b", Al, b(isNaN(t.value) ? "" : e.value.style.chart.layout.dataLabels.prefix) + b(!isNaN(t.value) && t.value !== null ? Number(t.value.toFixed(e.value.table.td.roundingValue)).toLocaleString() : t) + b(isNaN(t.value) ? "" : e.value.style.chart.layout.dataLabels.suffix), 1)),
              d("span", null, b(t.percentage && !isNaN(t.percentage) ? `(${Number(t.percentage.toFixed(e.value.table.td.roundingPercentage)).toLocaleString()}%)` : ""), 1)
            ]),
            _: 1
          }, 8, ["colNames", "head", "body", "config", "title"]))
        ]),
        _: 1
      }, 8, ["config"])) : v("", !0)
    ], 14, At));
  }
}, Wl = /* @__PURE__ */ Lt($l, [["__scopeId", "data-v-800b47b9"]]);
export {
  Wl as default
};
