import { useSlots as He, ref as i, computed as g, watch as Ge, onMounted as je, onBeforeUnmount as Xe, createElementBlock as v, openBlock as n, unref as r, normalizeStyle as I, normalizeClass as M, createBlock as O, createCommentVNode as m, createElementVNode as _, createVNode as J, createSlots as we, withCtx as h, renderSlot as d, normalizeProps as P, guardReactiveProps as F, 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 Te, t as Ke, p as N, a as Qe, o as Ze, e as Z, g as et, b as tt, H as lt, d as xe, f as S, X as ot, s as at, w as st, v as H, i as Ie, q as nt, r as ut, x as rt, y as it } from "./index-lwwgkcGL.js";
import { t as vt, u as ct } from "./useResponsive-JZ9xq-JV.js";
import { _ as dt } from "./Title-C9AEelQ1.js";
import { u as pt, U as ht } from "./usePrinter-BCTMiyK9.js";
import { _ as gt } from "./Tooltip-5snNLRyR.js";
import { D as ft } from "./DataTable-C0D_esqj.js";
import { L as yt } from "./Legend-0b4003Zt.js";
import mt from "./vue-ui-skeleton-BufuSja5.js";
import bt from "./vue-ui-accordion-CJnR6fHi.js";
import { u as Oe } from "./useNestedProp-TXT2IHSL.js";
import { _ as kt } from "./PackageVersion-C-ytTlJe.js";
import { _ as Ct } from "./PenAndPaper-__UJ-k8q.js";
import { u as $t } from "./useUserOptionState-BIvW1Kz7.js";
import { _ as wt } from "./Shape-C0Zlk88G.js";
import { u as _t } from "./useChartAccessibility-BWojgys7.js";
import { _ as Tt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const xt = ["id"], It = ["xmlns", "viewBox"], Ot = ["width", "height"], Nt = ["id"], St = ["stop-color"], At = ["stop-color"], Pt = { key: 1 }, Ft = ["stroke", "cx", "cy", "r", "fill"], Lt = ["stroke", "stroke-width", "cx", "cy", "r", "fill"], Rt = ["stroke", "stroke-width", "cx", "cy", "r", "fill"], Mt = ["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: Se, emit: Ae }) {
    const { vue_ui_rings: Pe } = Je(), Fe = He(), b = Ne, x = i(!1), V = g(() => !!b.dataset && b.dataset.length), $ = i(Te()), Le = i(null), z = i(!1), G = i(""), w = i(null), ee = i(0), L = i(null), te = i(null), le = i(null), oe = i(null), ae = i(null), se = i(0), ne = i(0), ue = i(0), e = g({
      get: () => ce(),
      set: (t) => t
    }), { userOptionsVisible: j, setUserOptionsVisibility: re, keepUserOptionState: ie } = $t({ config: e.value }), { svgRef: ve } = _t({ config: e.value.style.chart.title });
    function ce() {
      const t = Oe({
        userConfig: b.config,
        defaultConfig: Pe
      });
      return t.theme ? {
        ...Oe({
          userConfig: Qe.vue_ui_rings[t.theme] || b.config,
          defaultConfig: t
        }),
        customPalette: Ke[t.theme] || N
      } : t;
    }
    Ge(() => b.config, (t) => {
      e.value = ce(), j.value = !e.value.userOptions.showOnChartHover, de(), se.value += 1, ne.value += 1, ue.value += 1, k.value.showTable = e.value.table.show, k.value.showTooltip = e.value.style.chart.tooltip.show;
    }, { deep: !0 });
    const U = i(null);
    je(() => {
      de();
    });
    function de() {
      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: L.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(L.value.parentNode);
      }
      setTimeout(() => {
        x.value = !0;
      }, 600);
    }
    Xe(() => {
      U.value && U.value.disconnect();
    });
    const { isPrinting: pe, isImaging: he, generatePdf: ge, generateImage: fe } = pt({
      elementId: `rings_${$.value}`,
      fileName: e.value.style.chart.title.text || "vue-ui-rings",
      options: e.value.userOptions.print
    }), Re = g(() => e.value.userOptions.show && !e.value.style.chart.title.text), ye = g(() => tt(e.value.customPalette)), k = i({
      showTable: e.value.table.show,
      showTooltip: e.value.style.chart.tooltip.show
    }), s = i({
      height: 360,
      width: 360
    }), Me = g(() => Math.min(s.value.height, s.value.width)), Ve = Ae, f = i([]);
    function X(t) {
      f.value.includes(t) ? f.value = f.value.filter((o) => o !== t) : f.value.push(t), Ve("selectLegend", p.value.map((o) => ({
        name: o.name,
        color: o.color,
        value: o.value
      })));
    }
    const ze = g(() => Math.max(
      ...W.value.filter((t) => !f.value.includes(t.uid)).map(({ value: t }) => t)
    ));
    function me(t) {
      return t / ze.value;
    }
    const W = g(() => b.dataset.map(({ values: t, name: o, color: l = null }, a) => {
      const u = lt(t).reduce((y, R) => y + R, 0);
      return {
        name: o,
        color: l || xe(l) || ye.value[a] || N[a] || N[a % N.length],
        value: u,
        proportion: u / b.dataset.map((y) => (y.values || []).reduce((R, Ee) => R + Ee, 0)).reduce((y, R) => y + R, 0),
        uid: Te(),
        absoluteIndex: a
      };
    })), be = g(() => 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 = g(() => ({
      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 = g(() => W.value.filter((t) => !f.value.includes(t.uid)).map(({ value: t }) => t).reduce((t, o) => t + o, 0)), p = g(() => W.value.filter((t) => !f.value.includes(t.uid)).map(({ name: t, value: o, color: l = null, uid: a, absoluteIndex: u }, y) => ({
      absoluteIndex: u,
      uid: a,
      name: t,
      color: l || xe(l) || ye.value[y] || N[y] || N[y % N.length],
      value: o,
      proportion: me(o),
      percentage: o / C.value * 100,
      strokeWidth: e.value.style.chart.layout.rings.strokeWidth * me(o)
    })).toSorted((t, o) => o.value - t.value));
    function We() {
      return p.value.map(
        ({ name: t, color: o, value: l, absoluteValues: a, percentage: u }) => ({
          name: t,
          color: o,
          value: l,
          absoluteValues: a,
          percentage: u
        })
      );
    }
    const c = g(() => Me.value - e.value.style.chart.layout.rings.strokeWidth * 2), q = i(null);
    function Be(t, o) {
      if (f.value.length === b.dataset.length) return;
      q.value = {
        datapoint: o,
        seriesIndex: t,
        series: p.value,
        config: e.value
      }, w.value = t;
      const l = p.value[t], a = e.value.style.chart.tooltip.customFormat;
      if (rt(a) && it(() => a({
        seriesIndex: t,
        datapoint: o,
        series: p.value,
        config: e.value
      })))
        G.value = a({
          seriesIndex: t,
          datapoint: o,
          series: p.value,
          config: e.value
        });
      else {
        let u = "";
        u += `<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>`, u += `<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}" />${Fe.pattern ? `<circle cx="30" cy="30" r="30" stroke="none" fill="url(#pattern_${$.value}_${o.absoluteIndex})" />` : ""}</svg>`, e.value.style.chart.tooltip.showValue && (u += `<b>${Ie(
          e.value.style.chart.layout.labels.dataLabels.formatter,
          l.value,
          S({
            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 ? u += `<span>(${S({
          v: l.value / C.value * 100,
          s: "%",
          r: e.value.style.chart.tooltip.roundingPercentage
        })})</span></div>` : u += `<b>${S({
          v: l.value / C.value * 100,
          s: "%",
          r: e.value.style.chart.tooltip.roundingPercentage
        })}</b></div>`), G.value = u;
      }
      z.value = !0;
    }
    const T = g(() => {
      const t = p.value.map((l) => ({
        name: l.name,
        color: l.color
      })), o = p.value.map((l) => l.value);
      return { head: t, body: o };
    }), B = g(() => {
      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>',
        S({ 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((u, y) => [
        {
          color: u.color,
          name: u.name
        },
        S({ 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 ke() {
      Ye(() => {
        const t = T.value.head.map((a, u) => [[
          a.name
        ], [T.value.body[u]], [isNaN(T.value.body[u] / C.value) ? "-" : T.value.body[u] / C.value * 100]]), o = [[e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [[""], ["val"], ["%"]]].concat(t), l = nt(o);
        ut({ csvContent: l, title: e.value.style.chart.title.text || "vue-ui-rings" });
      });
    }
    const A = i(!1);
    function De(t) {
      A.value = t, ee.value += 1;
    }
    function Ce() {
      k.value.showTable = !k.value.showTable;
    }
    function $e() {
      k.value.showTooltip = !k.value.showTooltip;
    }
    const D = i(!1);
    function Y() {
      D.value = !D.value;
    }
    return Se({
      getData: We,
      generatePdf: ge,
      generateCsv: ke,
      generateImage: fe,
      toggleTable: Ce,
      toggleTooltip: $e,
      toggleAnnotator: Y
    }), (t, o) => (n(), v("div", {
      ref_key: "ringsChart",
      ref: L,
      class: M(`vue-ui-rings ${A.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${e.value.useCssAnimation ? "" : "vue-ui-dna"}`),
      style: I(`font-family:${e.value.style.fontFamily};text-align:center;width:100%;background:${e.value.style.chart.backgroundColor};${e.value.responsive ? "height: 100%" : ""}`),
      id: `rings_${$.value}`,
      onMouseleave: o[3] || (o[3] = (l) => {
        w.value = null, z.value = !1, r(re)(!1);
      }),
      onMouseenter: o[4] || (o[4] = () => r(re)(!0))
    }, [
      e.value.userOptions.buttons.annotator ? (n(), O(Ct, {
        key: 0,
        svgRef: r(ve),
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        active: D.value,
        onClose: Y
      }, null, 8, ["svgRef", "backgroundColor", "color", "active"])) : m("", !0),
      Re.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(), O(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 && (r(ie) || r(j)) ? (n(), O(ht, {
        ref_key: "details",
        ref: Le,
        key: `user_options_${ee.value}`,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        isPrinting: r(pe),
        isImaging: r(he),
        uid: $.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: L.value,
        position: e.value.userOptions.position,
        hasAnnotator: e.value.userOptions.buttons.annotator,
        isAnnotation: D.value,
        onToggleFullscreen: De,
        onGeneratePdf: r(ge),
        onGenerateCsv: ke,
        onGenerateImage: r(fe),
        onToggleTable: Ce,
        onToggleTooltip: $e,
        onToggleAnnotator: Y,
        style: I({
          visibility: r(ie) ? r(j) ? "visible" : "hidden" : "visible"
        })
      }, we({ _: 2 }, [
        t.$slots.menuIcon ? {
          name: "menuIcon",
          fn: h(({ isOpen: l, color: a }) => [
            d(t.$slots, "menuIcon", P(F({ isOpen: l, color: a })), void 0, !0)
          ]),
          key: "0"
        } : void 0,
        t.$slots.optionTooltip ? {
          name: "optionTooltip",
          fn: h(() => [
            d(t.$slots, "optionTooltip", {}, void 0, !0)
          ]),
          key: "1"
        } : void 0,
        t.$slots.optionPdf ? {
          name: "optionPdf",
          fn: h(() => [
            d(t.$slots, "optionPdf", {}, void 0, !0)
          ]),
          key: "2"
        } : void 0,
        t.$slots.optionCsv ? {
          name: "optionCsv",
          fn: h(() => [
            d(t.$slots, "optionCsv", {}, void 0, !0)
          ]),
          key: "3"
        } : void 0,
        t.$slots.optionImg ? {
          name: "optionImg",
          fn: h(() => [
            d(t.$slots, "optionImg", {}, void 0, !0)
          ]),
          key: "4"
        } : void 0,
        t.$slots.optionTable ? {
          name: "optionTable",
          fn: h(() => [
            d(t.$slots, "optionTable", {}, void 0, !0)
          ]),
          key: "5"
        } : void 0,
        t.$slots.optionFullscreen ? {
          name: "optionFullscreen",
          fn: h(({ toggleFullscreen: l, isFullscreen: a }) => [
            d(t.$slots, "optionFullscreen", P(F({ toggleFullscreen: l, isFullscreen: a })), void 0, !0)
          ]),
          key: "6"
        } : void 0,
        t.$slots.optionAnnotator ? {
          name: "optionAnnotator",
          fn: h(({ toggleAnnotator: l, isAnnotator: a }) => [
            d(t.$slots, "optionAnnotator", P(F({ toggleAnnotator: l, isAnnotator: a })), void 0, !0)
          ]),
          key: "7"
        } : 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: ve,
        xmlns: r(ot),
        class: M({ "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: I(`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"
          }
        }, [
          d(t.$slots, "chart-background", {}, void 0, !0)
        ], 8, Ot)) : m("", !0),
        _("defs", null, [
          (n(!0), v(K, null, Q(p.value, (l, a) => (n(), v("radialGradient", {
            cx: "50%",
            cy: "30%",
            r: "50%",
            fx: "50%",
            fy: "50%",
            id: `gradient_${$.value}_${a}`
          }, [
            _("stop", {
              offset: "0%",
              "stop-color": r(at)(r(st)(l.color, 0.05), 100 - e.value.style.chart.layout.rings.gradient.intensity)
            }, null, 8, St),
            _("stop", {
              offset: "100%",
              "stop-color": l.color
            }, null, 8, At)
          ], 8, Nt))), 256))
        ]),
        t.$slots.pattern ? (n(), v("g", Pt, [
          (n(!0), v(K, null, Q(p.value, (l) => (n(), v("defs", null, [
            d(t.$slots, "pattern", qe({ ref_for: !0 }, { seriesIndex: l.absoluteIndex, patternId: `pattern_${$.value}_${l.absoluteIndex}` }), void 0, !0)
          ]))), 256))
        ])) : m("", !0),
        (n(!0), v(K, null, Q(p.value, (l, a) => (n(), v("g", null, [
          _("circle", {
            class: M({
              "vue-ui-rings-item": x.value && e.value.useCssAnimation,
              "vue-rings-item-onload": !x.value && e.value.useCssAnimation,
              "vue-ui-rings-opacity": w.value !== null && w.value !== a
            }),
            style: I(`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 * p.value[0].proportion / 2 - c.value * l.proportion / 2 - 2 * (a + 1),
            r: r(H)(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: M({
              "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": w.value !== null && w.value !== a
            }),
            style: I(`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 * p.value[0].proportion / 2 - c.value * l.proportion / 2 - 2 * (a + 1),
            r: r(H)(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_${$.value}_${a})` : l.color
          }, null, 14, Lt),
          t.$slots.pattern ? (n(), v("circle", {
            key: 0,
            class: M({
              "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": w.value !== null && w.value !== a
            }),
            style: I(`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 * p.value[0].proportion / 2 - c.value * l.proportion / 2 - 2 * (a + 1),
            r: r(H)(c.value * l.proportion / 2 * 0.9 <= 0 ? 1e-4 : c.value * l.proportion / 2 * 0.9),
            fill: `url(#pattern_${$.value}_${l.absoluteIndex})`
          }, null, 14, Rt)) : m("", !0),
          _("circle", {
            stroke: "none",
            cx: s.value.width / 2,
            cy: a === 0 ? s.value.height / 2 : s.value.height / 2 + c.value * p.value[0].proportion / 2 - c.value * l.proportion / 2 - 2 * (a + 1),
            r: r(H)(c.value * l.proportion / 2 * 0.9 <= 0 ? 1e-4 : c.value * l.proportion / 2 * 0.9),
            fill: "transparent",
            onMouseenter: (u) => Be(a, l),
            onMouseleave: o[0] || (o[0] = (u) => {
              w.value = null, z.value = !1;
            })
          }, null, 40, Mt)
        ]))), 256)),
        d(t.$slots, "svg", { svg: s.value }, void 0, !0)
      ], 14, It)) : m("", !0),
      t.$slots.watermark ? (n(), v("div", Vt, [
        d(t.$slots, "watermark", P(F({ isPrinting: r(pe) || r(he) })), void 0, !0)
      ])) : m("", !0),
      V.value ? m("", !0) : (n(), O(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(), O(yt, {
          key: `legend_${ue.value}`,
          legendSet: be.value,
          config: Ue.value,
          onClickMarker: o[1] || (o[1] = ({ legend: l }) => X(l.uid))
        }, we({
          item: h(({ legend: l, index: a }) => [
            _("div", {
              onClick: (u) => X(l.uid),
              style: I(`opacity:${f.value.includes(l.uid) ? 0.5 : 1}`)
            }, [
              _e(E(l.name) + ": " + E(r(Ie)(
                e.value.style.chart.layout.labels.dataLabels.formatter,
                l.value,
                r(S)({
                  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) ? "-" : r(S)({
                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: h(({ legend: l, index: a }) => [
              J(wt, {
                shape: l.shape,
                radius: 30,
                stroke: "none",
                plot: { x: 30, y: 30 },
                fill: `url(#pattern_${$.value}_${a})`
              }, null, 8, ["shape", "fill"])
            ]),
            key: "0"
          } : void 0
        ]), 1032, ["legendSet", "config"])) : d(t.$slots, "legend", {
          key: 1,
          legend: be.value
        }, void 0, !0)
      ], 512),
      t.$slots.source ? (n(), v("div", {
        key: 7,
        ref_key: "source",
        ref: oe,
        dir: "auto"
      }, [
        d(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: L.value,
        content: G.value,
        isFullscreen: A.value,
        isCustom: e.value.style.chart.tooltip.customFormat && typeof e.value.style.chart.tooltip.customFormat == "function"
      }, {
        "tooltip-before": h(() => [
          d(t.$slots, "tooltip-before", P(F({ ...q.value })), void 0, !0)
        ]),
        "tooltip-after": h(() => [
          d(t.$slots, "tooltip-after", P(F({ ...q.value })), void 0, !0)
        ]),
        _: 3
      }, 8, ["show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "fontSize", "backgroundOpacity", "position", "offsetY", "parent", "content", "isFullscreen", "isCustom"]),
      V.value ? (n(), O(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: h(() => [
          (n(), O(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: h(({ th: l }) => [
              _("div", {
                innerHTML: l,
                style: { display: "flex", "align-items": "center" }
              }, null, 8, Bt)
            ]),
            td: h(({ 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-be9fc972"]]);
export {
  nl as default
};
