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