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