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