import { useSlots as Ge, ref as u, computed as h, watch as He, onMounted as je, onBeforeUnmount as Xe, createElementBlock as v, openBlock as n, unref as i, normalizeStyle as O, normalizeClass as L, createBlock as N, createCommentVNode as m, createElementVNode as _, createVNode as J, createSlots as we, withCtx as g, renderSlot as p, normalizeProps as M, guardReactiveProps as R, Fragment as K, renderList as Q, mergeProps as qe, createTextVNode as $e, toDisplayString as E, nextTick as Ye } from "vue";
import { u as Je, c as _e, t as Ke, p as P, a as Qe, o as Ze, e as Z, g as et, b as tt, J as lt, d as Te, f as I, X as ot, s as at, w as st, v as G, i as xe, q as nt, r as rt, x as ut, y as it } from "./index-CjXfhpMA.js";
import { t as vt, u as ct } from "./useResponsive-BWapHhVH.js";
import { _ as dt } from "./Title-BfzkycPl.js";
import { u as pt, U as ht } from "./usePrinter-bLtFFBkj.js";
import { _ as gt } from "./Tooltip-p85hmQvg.js";
import { D as ft } from "./DataTable-BfXSoPx-.js";
import { L as yt } from "./Legend-ChuNykfI.js";
import mt from "./vue-ui-skeleton-B1q5j9VT.js";
import bt from "./vue-ui-accordion-CEdZMQD4.js";
import { u as Oe } from "./useNestedProp-CmXi5M93.js";
import { _ as kt } from "./PackageVersion-ChIRiDpv.js";
import { P as Ct } from "./PenAndPaper-OV0eQPcd.js";
import { u as wt } from "./useUserOptionState-BIvW1Kz7.js";
import { _ as $t } from "./Shape-C8uhInZ8.js";
import { u as _t } from "./useChartAccessibility-BWojgys7.js";
import { _ as Tt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const xt = ["id"], Ot = ["xmlns", "viewBox"], Nt = ["width", "height"], Pt = ["id"], It = ["stop-color"], St = ["stop-color"], At = { key: 1 }, Ft = ["stroke", "cx", "cy", "r", "fill"], Lt = ["stroke", "stroke-width", "cx", "cy", "r", "fill"], Mt = ["stroke", "stroke-width", "cx", "cy", "r", "fill"], Rt = ["cx", "cy", "r", "onMouseenter"], Vt = {
  key: 5,
  class: "vue-data-ui-watermark"
}, zt = ["onClick"], Ut = { key: 0 }, Wt = { key: 1 }, Bt = ["innerHTML"], Dt = {
  __name: "vue-ui-rings",
  props: {
    config: {
      type: Object,
      default() {
        return {};
      }
    },
    dataset: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  emits: ["selectLegend"],
  setup(Ne, { expose: Pe, emit: Ie }) {
    const { vue_ui_rings: Se } = Je(), Ae = Ge(), b = Ne, x = u(!1), V = h(() => !!b.dataset && b.dataset.length), w = u(_e()), Fe = u(null), z = u(!1), H = u(""), $ = u(null), ee = u(0), S = u(null), te = u(null), le = u(null), oe = u(null), ae = u(null), se = u(0), ne = u(0), re = u(0), e = h({
      get: () => ve(),
      set: (t) => t
    }), { userOptionsVisible: j, setUserOptionsVisibility: ue, keepUserOptionState: ie } = wt({ config: e.value }), { svgRef: Le } = _t({ config: e.value.style.chart.title });
    function ve() {
      const t = Oe({
        userConfig: b.config,
        defaultConfig: Se
      });
      return t.theme ? {
        ...Oe({
          userConfig: Qe.vue_ui_rings[t.theme] || b.config,
          defaultConfig: t
        }),
        customPalette: Ke[t.theme] || P
      } : t;
    }
    He(() => b.config, (t) => {
      e.value = ve(), j.value = !e.value.userOptions.showOnChartHover, ce(), se.value += 1, ne.value += 1, re.value += 1, k.value.showTable = e.value.table.show, k.value.showTooltip = e.value.style.chart.tooltip.show;
    }, { deep: !0 });
    const U = u(null);
    je(() => {
      ce();
    });
    function ce() {
      if (Ze(b.dataset) ? Z({
        componentName: "VueUiRings",
        type: "dataset"
      }) : b.dataset.forEach((t, o) => {
        t.values.length || Z({
          componentName: "VueUiRings",
          type: "dataset"
        }), et({
          datasetObject: t,
          requiredAttributes: ["name", "values"]
        }).forEach((l) => {
          Z({
            componentName: "VueUiRings",
            type: "datasetSerieAttribute",
            property: l,
            index: o
          });
        });
      }), e.value.responsive) {
        const t = vt(() => {
          const { width: o, height: l } = ct({
            chart: S.value,
            title: e.value.style.chart.title.text ? te.value : null,
            legend: e.value.style.chart.legend.show ? le.value : null,
            source: oe.value,
            noTitle: ae.value
          });
          requestAnimationFrame(() => {
            s.value.width = o, s.value.height = l;
          });
        });
        U.value = new ResizeObserver(t), U.value.observe(S.value.parentNode);
      }
      setTimeout(() => {
        x.value = !0;
      }, 600);
    }
    Xe(() => {
      U.value && U.value.disconnect();
    });
    const { isPrinting: de, isImaging: pe, generatePdf: he, generateImage: ge } = pt({
      elementId: `rings_${w.value}`,
      fileName: e.value.style.chart.title.text || "vue-ui-rings"
    }), Me = h(() => e.value.userOptions.show && !e.value.style.chart.title.text), fe = h(() => tt(e.value.customPalette)), k = u({
      showTable: e.value.table.show,
      showTooltip: e.value.style.chart.tooltip.show
    }), s = u({
      height: 360,
      width: 360
    }), Re = h(() => Math.min(s.value.height, s.value.width)), Ve = Ie, f = u([]);
    function X(t) {
      f.value.includes(t) ? f.value = f.value.filter((o) => o !== t) : f.value.push(t), Ve("selectLegend", d.value.map((o) => ({
        name: o.name,
        color: o.color,
        value: o.value
      })));
    }
    const ze = h(() => Math.max(
      ...W.value.filter((t) => !f.value.includes(t.uid)).map(({ value: t }) => t)
    ));
    function ye(t) {
      return t / ze.value;
    }
    const W = h(() => b.dataset.map(({ values: t, name: o, color: l = null }, a) => {
      const r = lt(t).reduce((y, F) => y + F, 0);
      return {
        name: o,
        color: l || Te(l) || fe.value[a] || P[a] || P[a % P.length],
        value: r,
        proportion: r / b.dataset.map((y) => (y.values || []).reduce((F, Ee) => F + Ee, 0)).reduce((y, F) => y + F, 0),
        uid: _e(),
        absoluteIndex: a
      };
    })), me = h(() => W.value.map((t) => ({
      ...t,
      shape: "circle",
      opacity: f.value.includes(t.uid) ? 0.5 : 1,
      segregate: () => X(t.uid),
      isSegregated: f.value.includes(t.uid)
    })).toSorted((t, o) => o.value - t.value)), Ue = h(() => ({
      cy: "rings-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" : ""
    })), C = h(() => W.value.filter((t) => !f.value.includes(t.uid)).map(({ value: t }) => t).reduce((t, o) => t + o, 0)), d = h(() => W.value.filter((t) => !f.value.includes(t.uid)).map(({ name: t, value: o, color: l = null, uid: a, absoluteIndex: r }, y) => ({
      absoluteIndex: r,
      uid: a,
      name: t,
      color: l || Te(l) || fe.value[y] || P[y] || P[y % P.length],
      value: o,
      proportion: ye(o),
      percentage: o / C.value * 100,
      strokeWidth: e.value.style.chart.layout.rings.strokeWidth * ye(o)
    })).toSorted((t, o) => o.value - t.value));
    function We() {
      return d.value.map(
        ({ name: t, color: o, value: l, absoluteValues: a, percentage: r }) => ({
          name: t,
          color: o,
          value: l,
          absoluteValues: a,
          percentage: r
        })
      );
    }
    const c = h(() => Re.value - e.value.style.chart.layout.rings.strokeWidth * 2), q = u(null);
    function Be(t, o) {
      if (f.value.length === b.dataset.length) return;
      q.value = {
        datapoint: o,
        seriesIndex: t,
        series: d.value,
        config: e.value
      }, $.value = t;
      const l = d.value[t], a = e.value.style.chart.tooltip.customFormat;
      if (ut(a) && it(() => a({
        seriesIndex: t,
        datapoint: o,
        series: d.value,
        config: e.value
      })))
        H.value = a({
          seriesIndex: t,
          datapoint: o,
          series: d.value,
          config: e.value
        });
      else {
        let r = "";
        r += `<div style="width:100%;text-align:center;border-bottom:1px solid ${e.value.style.chart.tooltip.borderColor};padding-bottom:6px;margin-bottom:3px;">${l.name}</div>`, r += `<div style="display:flex;flex-direction:row;gap:6px;align-items:center;"><svg viewBox="0 0 60 60" height="14" width="14"><circle cx="30" cy="30" r="30" stroke="none" fill="${l.color}" />${Ae.pattern ? `<circle cx="30" cy="30" r="30" stroke="none" fill="url(#pattern_${w.value}_${o.absoluteIndex})" />` : ""}</svg>`, e.value.style.chart.tooltip.showValue && (r += `<b>${xe(
          e.value.style.chart.layout.labels.dataLabels.formatter,
          l.value,
          I({
            p: e.value.style.chart.layout.labels.dataLabels.prefix,
            v: l.value,
            s: e.value.style.chart.layout.labels.dataLabels.suffix,
            r: e.value.style.chart.tooltip.roundingValue
          }),
          { datapoint: o, seriesIndex: t }
        )}
      </b>`), e.value.style.chart.tooltip.showPercentage && (e.value.style.chart.tooltip.showValue ? r += `<span>(${I({
          v: l.value / C.value * 100,
          s: "%",
          r: e.value.style.chart.tooltip.roundingPercentage
        })})</span></div>` : r += `<b>${I({
          v: l.value / C.value * 100,
          s: "%",
          r: e.value.style.chart.tooltip.roundingPercentage
        })}</b></div>`), H.value = r;
      }
      z.value = !0;
    }
    const T = h(() => {
      const t = d.value.map((l) => ({
        name: l.name,
        color: l.color
      })), o = d.value.map((l) => l.value);
      return { head: t, body: o };
    }), B = h(() => {
      const t = [
        ' <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M18 16v2a1 1 0 0 1 -1 1h-11l6 -7l-6 -7h11a1 1 0 0 1 1 1v2" /></svg>',
        I({ p: e.value.style.chart.layout.labels.dataLabels.prefix, v: C.value, s: e.value.style.chart.layout.labels.dataLabels.suffix, r: e.value.table.td.roundingValue }),
        "100%"
      ], o = T.value.head.map((r, y) => [
        {
          color: r.color,
          name: r.name
        },
        I({ p: e.value.style.chart.layout.labels.dataLabels.prefix, v: T.value.body[y], s: e.value.style.chart.layout.labels.dataLabels.suffix, r: e.value.table.td.roundingValue }),
        isNaN(T.value.body[y] / C.value) ? "-" : (T.value.body[y] / C.value * 100).toFixed(e.value.table.td.roundingPercentage) + "%"
      ]), l = {
        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
      }, a = [
        e.value.table.columnNames.series,
        e.value.table.columnNames.value,
        e.value.table.columnNames.percentage
      ];
      return {
        head: t,
        body: o,
        config: l,
        colNames: a
      };
    });
    function be() {
      Ye(() => {
        const t = T.value.head.map((a, r) => [[
          a.name
        ], [T.value.body[r]], [isNaN(T.value.body[r] / C.value) ? "-" : T.value.body[r] / C.value * 100]]), o = [[e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [[""], ["val"], ["%"]]].concat(t), l = nt(o);
        rt({ csvContent: l, title: e.value.style.chart.title.text || "vue-ui-rings" });
      });
    }
    const A = u(!1);
    function De(t) {
      A.value = t, ee.value += 1;
    }
    function ke() {
      k.value.showTable = !k.value.showTable;
    }
    function Ce() {
      k.value.showTooltip = !k.value.showTooltip;
    }
    const D = u(!1);
    function Y() {
      D.value = !D.value;
    }
    return Pe({
      getData: We,
      generatePdf: he,
      generateCsv: be,
      generateImage: ge,
      toggleTable: ke,
      toggleTooltip: Ce,
      toggleAnnotator: Y
    }), (t, o) => (n(), v("div", {
      ref_key: "ringsChart",
      ref: S,
      class: L(`vue-ui-rings ${A.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${e.value.useCssAnimation ? "" : "vue-ui-dna"}`),
      style: O(`font-family:${e.value.style.fontFamily};text-align:center;width:100%;background:${e.value.style.chart.backgroundColor};${e.value.responsive ? "height: 100%" : ""}`),
      id: `rings_${w.value}`,
      onMouseleave: o[3] || (o[3] = (l) => {
        $.value = null, z.value = !1, i(ue)(!1);
      }),
      onMouseenter: o[4] || (o[4] = () => i(ue)(!0))
    }, [
      e.value.userOptions.buttons.annotator ? (n(), N(Ct, {
        key: 0,
        parent: S.value,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        active: D.value,
        onClose: Y
      }, null, 8, ["parent", "backgroundColor", "color", "active"])) : m("", !0),
      Me.value ? (n(), v("div", {
        key: 1,
        ref_key: "noTitle",
        ref: ae,
        class: "vue-data-ui-no-title-space",
        style: "height:36px; width: 100%;background:transparent"
      }, null, 512)) : m("", !0),
      e.value.style.chart.title.text ? (n(), v("div", {
        key: 2,
        ref_key: "chartTitle",
        ref: te,
        style: "width:100%;background:transparent"
      }, [
        (n(), N(dt, {
          key: `title_${se.value}`,
          config: {
            title: {
              cy: "rings-div-title",
              ...e.value.style.chart.title
            },
            subtitle: {
              cy: "rings-div-subtitle",
              ...e.value.style.chart.title.subtitle
            }
          }
        }, null, 8, ["config"]))
      ], 512)) : m("", !0),
      e.value.userOptions.show && V.value && (i(ie) || i(j)) ? (n(), N(ht, {
        ref_key: "details",
        ref: Fe,
        key: `user_options_${ee.value}`,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        isPrinting: i(de),
        isImaging: i(pe),
        uid: w.value,
        hasTooltip: e.value.userOptions.buttons.tooltip && e.value.style.chart.tooltip.show,
        hasPdf: e.value.userOptions.buttons.pdf,
        hasXls: e.value.userOptions.buttons.csv,
        hasImg: e.value.userOptions.buttons.img,
        hasTable: e.value.userOptions.buttons.table,
        hasFullscreen: e.value.userOptions.buttons.fullscreen,
        isTooltip: k.value.showTooltip,
        isFullscreen: A.value,
        titles: { ...e.value.userOptions.buttonTitles },
        chartElement: S.value,
        position: e.value.userOptions.position,
        hasAnnotator: e.value.userOptions.buttons.annotator,
        isAnnotation: D.value,
        onToggleFullscreen: De,
        onGeneratePdf: i(he),
        onGenerateCsv: be,
        onGenerateImage: i(ge),
        onToggleTable: ke,
        onToggleTooltip: Ce,
        onToggleAnnotator: Y,
        style: O({
          visibility: i(ie) ? i(j) ? "visible" : "hidden" : "visible"
        })
      }, we({ _: 2 }, [
        t.$slots.optionTooltip ? {
          name: "optionTooltip",
          fn: g(() => [
            p(t.$slots, "optionTooltip", {}, void 0, !0)
          ]),
          key: "0"
        } : void 0,
        t.$slots.optionPdf ? {
          name: "optionPdf",
          fn: g(() => [
            p(t.$slots, "optionPdf", {}, void 0, !0)
          ]),
          key: "1"
        } : void 0,
        t.$slots.optionCsv ? {
          name: "optionCsv",
          fn: g(() => [
            p(t.$slots, "optionCsv", {}, void 0, !0)
          ]),
          key: "2"
        } : void 0,
        t.$slots.optionImg ? {
          name: "optionImg",
          fn: g(() => [
            p(t.$slots, "optionImg", {}, void 0, !0)
          ]),
          key: "3"
        } : void 0,
        t.$slots.optionTable ? {
          name: "optionTable",
          fn: g(() => [
            p(t.$slots, "optionTable", {}, void 0, !0)
          ]),
          key: "4"
        } : void 0,
        t.$slots.optionFullscreen ? {
          name: "optionFullscreen",
          fn: g(({ toggleFullscreen: l, isFullscreen: a }) => [
            p(t.$slots, "optionFullscreen", M(R({ toggleFullscreen: l, isFullscreen: a })), void 0, !0)
          ]),
          key: "5"
        } : void 0,
        t.$slots.optionAnnotator ? {
          name: "optionAnnotator",
          fn: g(({ toggleAnnotator: l, isAnnotator: a }) => [
            p(t.$slots, "optionAnnotator", M(R({ toggleAnnotator: l, isAnnotator: a })), void 0, !0)
          ]),
          key: "6"
        } : void 0
      ]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasTooltip", "hasPdf", "hasXls", "hasImg", "hasTable", "hasFullscreen", "isTooltip", "isFullscreen", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage", "style"])) : m("", !0),
      V.value ? (n(), v("svg", {
        key: 4,
        ref_key: "svgRef",
        ref: Le,
        xmlns: i(ot),
        class: L({ "vue-data-ui-fullscreen--on": A.value, "vue-data-ui-fulscreen--off": !A.value }),
        viewBox: `0 0 ${s.value.width <= 0 ? 10 : s.value.width} ${s.value.height <= 0 ? 10 : s.value.height}`,
        style: O(`max-width:100%;overflow:visible;background:transparent;color:${e.value.style.chart.color}`)
      }, [
        J(kt),
        t.$slots["chart-background"] ? (n(), v("foreignObject", {
          key: 0,
          x: 0,
          y: 0,
          width: s.value.width <= 0 ? 10 : s.value.width,
          height: s.value.height <= 0 ? 10 : s.value.height,
          style: {
            pointerEvents: "none"
          }
        }, [
          p(t.$slots, "chart-background", {}, void 0, !0)
        ], 8, Nt)) : m("", !0),
        _("defs", null, [
          (n(!0), v(K, null, Q(d.value, (l, a) => (n(), v("radialGradient", {
            cx: "50%",
            cy: "30%",
            r: "50%",
            fx: "50%",
            fy: "50%",
            id: `gradient_${w.value}_${a}`
          }, [
            _("stop", {
              offset: "0%",
              "stop-color": i(at)(i(st)(l.color, 0.05), 100 - e.value.style.chart.layout.rings.gradient.intensity)
            }, null, 8, It),
            _("stop", {
              offset: "100%",
              "stop-color": l.color
            }, null, 8, St)
          ], 8, Pt))), 256))
        ]),
        t.$slots.pattern ? (n(), v("g", At, [
          (n(!0), v(K, null, Q(d.value, (l) => (n(), v("defs", null, [
            p(t.$slots, "pattern", qe({ ref_for: !0 }, { seriesIndex: l.absoluteIndex, patternId: `pattern_${w.value}_${l.absoluteIndex}` }), void 0, !0)
          ]))), 256))
        ])) : m("", !0),
        (n(!0), v(K, null, Q(d.value, (l, a) => (n(), v("g", null, [
          _("circle", {
            class: L({
              "vue-ui-rings-item": x.value && e.value.useCssAnimation,
              "vue-rings-item-onload": !x.value && e.value.useCssAnimation,
              "vue-ui-rings-opacity": $.value !== null && $.value !== a
            }),
            style: O(`animation-delay:${a * 100}ms`),
            stroke: e.value.style.chart.layout.rings.stroke,
            cx: s.value.width / 2,
            cy: a === 0 ? s.value.height / 2 : s.value.height / 2 + c.value * d.value[0].proportion / 2 - c.value * l.proportion / 2 - 2 * (a + 1),
            r: i(G)(c.value * l.proportion / 2 * 0.9 <= 0 ? 1e-4 : c.value * l.proportion / 2 * 0.9),
            fill: e.value.style.chart.layout.rings.gradient.underlayerColor
          }, null, 14, Ft),
          _("circle", {
            class: L({
              "vue-ui-rings-item": x.value && e.value.useCssAnimation,
              "vue-rings-item-onload": !x.value && e.value.useCssAnimation,
              "vue-ui-rings-shadow": e.value.style.chart.layout.rings.useShadow,
              "vue-ui-rings-blur": $.value !== null && $.value !== a
            }),
            style: O(`animation-delay:${a * 100}ms`),
            stroke: e.value.style.chart.layout.rings.stroke,
            "stroke-width": l.strokeWidth < 0.5 ? 0.5 : l.strokeWidth,
            cx: s.value.width / 2,
            cy: a === 0 ? s.value.height / 2 : s.value.height / 2 + c.value * d.value[0].proportion / 2 - c.value * l.proportion / 2 - 2 * (a + 1),
            r: i(G)(c.value * l.proportion / 2 * 0.9 <= 0 ? 1e-4 : c.value * l.proportion / 2 * 0.9),
            fill: e.value.style.chart.layout.rings.gradient.show ? `url(#gradient_${w.value}_${a})` : l.color
          }, null, 14, Lt),
          t.$slots.pattern ? (n(), v("circle", {
            key: 0,
            class: L({
              "vue-ui-rings-item": x.value && e.value.useCssAnimation,
              "vue-rings-item-onload": !x.value && e.value.useCssAnimation,
              "vue-ui-rings-shadow": e.value.style.chart.layout.rings.useShadow,
              "vue-ui-rings-blur": $.value !== null && $.value !== a
            }),
            style: O(`animation-delay:${a * 100}ms`),
            stroke: e.value.style.chart.layout.rings.stroke,
            "stroke-width": l.strokeWidth < 0.5 ? 0.5 : l.strokeWidth,
            cx: s.value.width / 2,
            cy: a === 0 ? s.value.height / 2 : s.value.height / 2 + c.value * d.value[0].proportion / 2 - c.value * l.proportion / 2 - 2 * (a + 1),
            r: i(G)(c.value * l.proportion / 2 * 0.9 <= 0 ? 1e-4 : c.value * l.proportion / 2 * 0.9),
            fill: `url(#pattern_${w.value}_${l.absoluteIndex})`
          }, null, 14, Mt)) : m("", !0),
          _("circle", {
            stroke: "none",
            cx: s.value.width / 2,
            cy: a === 0 ? s.value.height / 2 : s.value.height / 2 + c.value * d.value[0].proportion / 2 - c.value * l.proportion / 2 - 2 * (a + 1),
            r: i(G)(c.value * l.proportion / 2 * 0.9 <= 0 ? 1e-4 : c.value * l.proportion / 2 * 0.9),
            fill: "transparent",
            onMouseenter: (r) => Be(a, l),
            onMouseleave: o[0] || (o[0] = (r) => {
              $.value = null, z.value = !1;
            })
          }, null, 40, Rt)
        ]))), 256)),
        p(t.$slots, "svg", { svg: s.value }, void 0, !0)
      ], 14, Ot)) : m("", !0),
      t.$slots.watermark ? (n(), v("div", Vt, [
        p(t.$slots, "watermark", M(R({ isPrinting: i(de) || i(pe) })), void 0, !0)
      ])) : m("", !0),
      V.value ? m("", !0) : (n(), N(mt, {
        key: 6,
        config: {
          type: "rings",
          style: {
            backgroundColor: e.value.style.chart.backgroundColor,
            rings: {
              color: "#CCCCCC"
            }
          }
        }
      }, null, 8, ["config"])),
      _("div", {
        ref_key: "chartLegend",
        ref: le
      }, [
        e.value.style.chart.legend.show ? (n(), N(yt, {
          key: `legend_${re.value}`,
          legendSet: me.value,
          config: Ue.value,
          onClickMarker: o[1] || (o[1] = ({ legend: l }) => X(l.uid))
        }, we({
          item: g(({ legend: l, index: a }) => [
            _("div", {
              onClick: (r) => X(l.uid),
              style: O(`opacity:${f.value.includes(l.uid) ? 0.5 : 1}`)
            }, [
              $e(E(l.name) + ": " + E(i(xe)(
                e.value.style.chart.layout.labels.dataLabels.formatter,
                l.value,
                i(I)({
                  p: e.value.style.chart.layout.labels.dataLabels.prefix,
                  v: l.value,
                  s: e.value.style.chart.layout.labels.dataLabels.suffix,
                  r: e.value.style.chart.legend.roundingValue
                }),
                { datapoint: l, seriesIndex: a }
              )) + " ", 1),
              f.value.includes(l.uid) ? (n(), v("span", Wt, " ( - % ) ")) : (n(), v("span", Ut, " (" + E(isNaN(l.value / C.value) ? "-" : i(I)({
                v: l.value / C.value * 100,
                s: "%",
                r: e.value.style.chart.legend.roundingPercentage
              })) + ") ", 1))
            ], 12, zt)
          ]),
          _: 2
        }, [
          t.$slots.pattern ? {
            name: "legend-pattern",
            fn: g(({ legend: l, index: a }) => [
              J($t, {
                shape: l.shape,
                radius: 30,
                stroke: "none",
                plot: { x: 30, y: 30 },
                fill: `url(#pattern_${w.value}_${a})`
              }, null, 8, ["shape", "fill"])
            ]),
            key: "0"
          } : void 0
        ]), 1032, ["legendSet", "config"])) : p(t.$slots, "legend", {
          key: 1,
          legend: me.value
        }, void 0, !0)
      ], 512),
      t.$slots.source ? (n(), v("div", {
        key: 7,
        ref_key: "source",
        ref: oe,
        dir: "auto"
      }, [
        p(t.$slots, "source", {}, void 0, !0)
      ], 512)) : m("", !0),
      J(gt, {
        show: k.value.showTooltip && z.value && f.value.length < b.dataset.length,
        backgroundColor: e.value.style.chart.tooltip.backgroundColor,
        color: e.value.style.chart.tooltip.color,
        borderRadius: e.value.style.chart.tooltip.borderRadius,
        borderColor: e.value.style.chart.tooltip.borderColor,
        borderWidth: e.value.style.chart.tooltip.borderWidth,
        fontSize: e.value.style.chart.tooltip.fontSize,
        backgroundOpacity: e.value.style.chart.tooltip.backgroundOpacity,
        position: e.value.style.chart.tooltip.position,
        offsetY: e.value.style.chart.tooltip.offsetY,
        parent: S.value,
        content: H.value,
        isFullscreen: A.value,
        isCustom: e.value.style.chart.tooltip.customFormat && typeof e.value.style.chart.tooltip.customFormat == "function"
      }, {
        "tooltip-before": g(() => [
          p(t.$slots, "tooltip-before", M(R({ ...q.value })), void 0, !0)
        ]),
        "tooltip-after": g(() => [
          p(t.$slots, "tooltip-after", M(R({ ...q.value })), void 0, !0)
        ]),
        _: 3
      }, 8, ["show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "fontSize", "backgroundOpacity", "position", "offsetY", "parent", "content", "isFullscreen", "isCustom"]),
      V.value ? (n(), N(bt, {
        key: 8,
        hideDetails: "",
        config: {
          open: k.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: g(() => [
          (n(), N(ft, {
            key: `table_${ne.value}`,
            colNames: B.value.colNames,
            head: B.value.head,
            body: B.value.body,
            config: B.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[2] || (o[2] = (l) => k.value.showTable = !1)
          }, {
            th: g(({ th: l }) => [
              _("div", {
                innerHTML: l,
                style: { display: "flex", "align-items": "center" }
              }, null, 8, Bt)
            ]),
            td: g(({ td: l }) => [
              $e(E(l.name || l), 1)
            ]),
            _: 1
          }, 8, ["colNames", "head", "body", "config", "title"]))
        ]),
        _: 1
      }, 8, ["config"])) : m("", !0)
    ], 46, xt));
  }
}, nl = /* @__PURE__ */ Tt(Dt, [["__scopeId", "data-v-f6a0352e"]]);
export {
  nl as default
};
