import { useSlots as De, ref as r, computed as h, watch as Ee, onMounted as Ge, onBeforeUnmount as He, openBlock as n, createElementBlock as v, normalizeClass as V, normalizeStyle as N, unref as i, createBlock as O, createCommentVNode as m, createSlots as $e, withCtx as g, renderSlot as p, normalizeProps as L, guardReactiveProps as F, createVNode as J, createElementVNode as w, Fragment as K, renderList as Q, createTextVNode as we, toDisplayString as E, nextTick as je } from "vue";
import { u as Xe, c as _e, t as Ye, a as qe, p as I, o as Je, e as Z, g as Ke, b as Qe, J as Ze, d as Te, f as P, X as et, s as tt, w as lt, v as G, i as xe, x as ot, y as at, q as st, r as nt } from "./index-BVNcFEqn.js";
import { t as ut, u as rt } from "./useResponsive-CoxXLe23.js";
import { _ as it } from "./Title-DyUTj8GI.js";
import { u as vt, U as ct } from "./usePrinter-Bcfs_I6G.js";
import { _ as dt } from "./Tooltip-B-0uEV3l.js";
import { D as pt } from "./DataTable-DX_jYNWG.js";
import { L as ht } from "./Legend-DGUxLqhs.js";
import gt from "./vue-ui-skeleton-Bgf16k10.js";
import ft from "./vue-ui-accordion-GNblUy42.js";
import { u as Ne } from "./useNestedProp-D79dWdel.js";
import { _ as yt } from "./PackageVersion-B9_Ed72C.js";
import { P as mt } from "./PenAndPaper-CzjoEhsO.js";
import { u as bt } from "./useUserOptionState-BIvW1Kz7.js";
import { _ as kt } from "./Shape-aXd72O71.js";
import { _ as Ct } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const $t = ["id"], wt = ["xmlns", "viewBox"], _t = ["width", "height"], Tt = ["id"], xt = ["stop-color"], Nt = ["stop-color"], Ot = { key: 1 }, It = ["stroke", "cx", "cy", "r", "fill"], Pt = ["stroke", "stroke-width", "cx", "cy", "r", "fill"], St = ["stroke", "stroke-width", "cx", "cy", "r", "fill"], At = ["cx", "cy", "r", "onMouseenter"], Lt = {
  key: 5,
  class: "vue-data-ui-watermark"
}, Ft = ["onClick"], Mt = { key: 0 }, Vt = { key: 1 }, zt = ["innerHTML"], Rt = {
  __name: "vue-ui-rings",
  props: {
    config: {
      type: Object,
      default() {
        return {};
      }
    },
    dataset: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  emits: ["selectLegend"],
  setup(Oe, { expose: Ie, emit: Pe }) {
    const b = Oe, { vue_ui_rings: Se } = Xe(), Ae = De(), x = r(!1), z = h(() => !!b.dataset && b.dataset.length), C = r(_e()), Le = r(null), R = r(!1), H = r(""), $ = r(null), ee = r(0), S = r(null), te = r(null), le = r(null), oe = r(null), ae = r(null), se = r(0), ne = r(0), ue = r(0), e = h({
      get: () => ve(),
      set: (t) => t
    }), { userOptionsVisible: j, setUserOptionsVisibility: re, keepUserOptionState: ie } = bt({ config: e.value });
    function ve() {
      const t = Ne({
        userConfig: b.config,
        defaultConfig: Se
      });
      return t.theme ? {
        ...Ne({
          userConfig: Ye.vue_ui_rings[t.theme] || b.config,
          defaultConfig: t
        }),
        customPalette: qe[t.theme] || I
      } : t;
    }
    Ee(() => b.config, (t) => {
      e.value = ve(), j.value = !e.value.showOnChartHover, ce(), se.value += 1, ne.value += 1, ue.value += 1;
    }, { deep: !0 });
    const U = r(null);
    Ge(() => {
      ce();
    });
    function ce() {
      if (Je(b.dataset) ? Z({
        componentName: "VueUiRings",
        type: "dataset"
      }) : b.dataset.forEach((t, o) => {
        t.values.length || Z({
          componentName: "VueUiRings",
          type: "dataset"
        }), Ke({
          datasetObject: t,
          requiredAttributes: ["name", "values"]
        }).forEach((l) => {
          Z({
            componentName: "VueUiRings",
            type: "datasetSerieAttribute",
            property: l,
            index: o
          });
        });
      }), e.value.responsive) {
        const t = ut(() => {
          const { width: o, height: l } = rt({
            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
          });
          s.value.width = o, s.value.height = l;
        });
        U.value = new ResizeObserver(t), U.value.observe(S.value.parentNode);
      }
      setTimeout(() => {
        x.value = !0;
      }, 600);
    }
    He(() => {
      U.value && U.value.disconnect();
    });
    const { isPrinting: de, isImaging: pe, generatePdf: he, generateImage: ge } = vt({
      elementId: `rings_${C.value}`,
      fileName: e.value.style.chart.title.text || "vue-ui-rings"
    }), Fe = h(() => e.value.userOptions.show && !e.value.style.chart.title.text), fe = h(() => Qe(e.value.customPalette)), _ = r({
      showTable: e.value.table.show,
      showTooltip: e.value.style.chart.tooltip.show
    }), s = r({
      height: 360,
      width: 360
    }), Me = h(() => Math.min(s.value.height, s.value.width)), f = r([]);
    function X(t) {
      f.value.includes(t) ? f.value = f.value.filter((o) => o !== t) : f.value.push(t), Pe("selectLegend", d.value.map((o) => ({
        name: o.name,
        color: o.color,
        value: o.value
      })));
    }
    const Ve = h(() => Math.max(
      ...W.value.filter((t) => !f.value.includes(t.uid)).map(({ value: t }) => t)
    ));
    function ye(t) {
      return t / Ve.value;
    }
    const W = h(() => b.dataset.map(({ values: t, name: o, color: l = null }, a) => {
      const u = Ze(t).reduce((y, M) => y + M, 0);
      return {
        name: o,
        color: l || Te(l) || fe.value[a] || I[a] || I[a % I.length],
        value: u,
        proportion: u / b.dataset.map((y) => (y.values || []).reduce((M, Be) => M + Be, 0)).reduce((y, M) => y + M, 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)), ze = 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" : ""
    })), k = 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: u }, y) => ({
      absoluteIndex: u,
      uid: a,
      name: t,
      color: l || Te(l) || fe.value[y] || I[y] || I[y % I.length],
      value: o,
      proportion: ye(o),
      percentage: o / k.value * 100,
      strokeWidth: e.value.style.chart.layout.rings.strokeWidth * ye(o)
    })).toSorted((t, o) => o.value - t.value));
    function Re() {
      return d.value.map(
        ({ name: t, color: o, value: l, absoluteValues: a, percentage: u }) => ({
          name: t,
          color: o,
          value: l,
          absoluteValues: a,
          percentage: u
        })
      );
    }
    const c = h(() => Me.value - e.value.style.chart.layout.rings.strokeWidth * 2), Y = r(null);
    function Ue(t, o) {
      if (f.value.length === b.dataset.length) return;
      Y.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 (ot(a) && at(() => 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 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}" />${Ae.pattern ? `<circle cx="30" cy="30" r="30" stroke="none" fill="url(#pattern_${C.value}_${o.absoluteIndex})" />` : ""}</svg>`, e.value.style.chart.tooltip.showValue && (u += `<b>${xe(
          e.value.style.chart.layout.labels.dataLabels.formatter,
          l.value,
          P({
            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>(${P({
          v: l.value / k.value * 100,
          s: "%",
          r: e.value.style.chart.tooltip.roundingPercentage
        })})</span></div>` : u += `<b>${P({
          v: l.value / k.value * 100,
          s: "%",
          r: e.value.style.chart.tooltip.roundingPercentage
        })}</b></div>`), H.value = u;
      }
      R.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>',
        P({ p: e.value.style.chart.layout.labels.dataLabels.prefix, v: k.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
        },
        P({ 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] / k.value) ? "-" : (T.value.body[y] / k.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() {
      je(() => {
        const t = T.value.head.map((a, u) => [[
          a.name
        ], [T.value.body[u]], [isNaN(T.value.body[u] / k.value) ? "-" : T.value.body[u] / k.value * 100]]), o = [[e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [[""], ["val"], ["%"]]].concat(t), l = st(o);
        nt({ csvContent: l, title: e.value.style.chart.title.text || "vue-ui-rings" });
      });
    }
    const A = r(!1);
    function We(t) {
      A.value = t, ee.value += 1;
    }
    function ke() {
      _.value.showTable = !_.value.showTable;
    }
    function Ce() {
      _.value.showTooltip = !_.value.showTooltip;
    }
    const D = r(!1);
    function q() {
      D.value = !D.value;
    }
    return Ie({
      getData: Re,
      generatePdf: he,
      generateCsv: be,
      generateImage: ge,
      toggleTable: ke,
      toggleTooltip: Ce,
      toggleAnnotator: q
    }), (t, o) => (n(), v("div", {
      ref_key: "ringsChart",
      ref: S,
      class: V(`vue-ui-rings ${A.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${e.value.useCssAnimation ? "" : "vue-ui-dna"}`),
      style: N(`font-family:${e.value.style.fontFamily};text-align:center;width:100%;background:${e.value.style.chart.backgroundColor};${e.value.responsive ? "height: 100%" : ""}`),
      id: `rings_${C.value}`,
      onMouseleave: o[3] || (o[3] = (l) => {
        $.value = null, R.value = !1, i(re)(!1);
      }),
      onMouseenter: o[4] || (o[4] = () => i(re)(!0))
    }, [
      e.value.userOptions.buttons.annotator ? (n(), O(mt, {
        key: 0,
        parent: S.value,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        active: D.value,
        onClose: q
      }, null, 8, ["parent", "backgroundColor", "color", "active"])) : m("", !0),
      Fe.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(it, {
          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 && z.value && (i(ie) || i(j)) ? (n(), O(ct, {
        ref_key: "details",
        ref: Le,
        key: `user_options_${ee.value}`,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        isPrinting: i(de),
        isImaging: i(pe),
        uid: C.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: _.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: We,
        onGeneratePdf: i(he),
        onGenerateCsv: be,
        onGenerateImage: i(ge),
        onToggleTable: ke,
        onToggleTooltip: Ce,
        onToggleAnnotator: q,
        style: N({
          visibility: i(ie) ? i(j) ? "visible" : "hidden" : "visible"
        })
      }, $e({ _: 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", L(F({ 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", L(F({ 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),
      z.value ? (n(), v("svg", {
        key: 4,
        xmlns: i(et),
        class: V({ "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: N(`max-width:100%;overflow:visible;background:transparent;color:${e.value.style.chart.color}`)
      }, [
        J(yt),
        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, _t)) : m("", !0),
        w("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_${C.value}_${a}`
          }, [
            w("stop", {
              offset: "0%",
              "stop-color": i(tt)(i(lt)(l.color, 0.05), 100 - e.value.style.chart.layout.rings.gradient.intensity)
            }, null, 8, xt),
            w("stop", {
              offset: "100%",
              "stop-color": l.color
            }, null, 8, Nt)
          ], 8, Tt))), 256))
        ]),
        t.$slots.pattern ? (n(), v("g", Ot, [
          (n(!0), v(K, null, Q(d.value, (l) => (n(), v("defs", null, [
            p(t.$slots, "pattern", L(F({ seriesIndex: l.absoluteIndex, patternId: `pattern_${C.value}_${l.absoluteIndex}` })), void 0, !0)
          ]))), 256))
        ])) : m("", !0),
        (n(!0), v(K, null, Q(d.value, (l, a) => (n(), v("g", null, [
          w("circle", {
            class: V({
              "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: N(`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, It),
          w("circle", {
            class: V({
              "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: N(`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_${C.value}_${a})` : l.color
          }, null, 14, Pt),
          t.$slots.pattern ? (n(), v("circle", {
            key: 0,
            class: V({
              "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: N(`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_${C.value}_${l.absoluteIndex})`
          }, null, 14, St)) : m("", !0),
          w("circle", {
            "data-cy-trap": "",
            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: (u) => Ue(a, l),
            onMouseleave: o[0] || (o[0] = (u) => {
              $.value = null, R.value = !1;
            })
          }, null, 40, At)
        ]))), 256)),
        p(t.$slots, "svg", { svg: s.value }, void 0, !0)
      ], 14, wt)) : m("", !0),
      t.$slots.watermark ? (n(), v("div", Lt, [
        p(t.$slots, "watermark", L(F({ isPrinting: i(de) || i(pe) })), void 0, !0)
      ])) : m("", !0),
      z.value ? m("", !0) : (n(), O(gt, {
        key: 6,
        config: {
          type: "rings",
          style: {
            backgroundColor: e.value.style.chart.backgroundColor,
            rings: {
              color: "#CCCCCC"
            }
          }
        }
      }, null, 8, ["config"])),
      w("div", {
        ref_key: "chartLegend",
        ref: le
      }, [
        e.value.style.chart.legend.show ? (n(), O(ht, {
          key: `legend_${ue.value}`,
          legendSet: me.value,
          config: ze.value,
          onClickMarker: o[1] || (o[1] = ({ legend: l }) => X(l.uid))
        }, $e({
          item: g(({ legend: l, index: a }) => [
            w("div", {
              "data-cy-legend-item": "",
              onClick: (u) => X(l.uid),
              style: N(`opacity:${f.value.includes(l.uid) ? 0.5 : 1}`)
            }, [
              we(E(l.name) + ": " + E(i(xe)(
                e.value.style.chart.layout.labels.dataLabels.formatter,
                l.value,
                i(P)({
                  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", Vt, " ( - % ) ")) : (n(), v("span", Mt, " (" + E(isNaN(l.value / k.value) ? "-" : i(P)({
                v: l.value / k.value * 100,
                s: "%",
                r: e.value.style.chart.legend.roundingPercentage
              })) + ") ", 1))
            ], 12, Ft)
          ]),
          _: 2
        }, [
          t.$slots.pattern ? {
            name: "legend-pattern",
            fn: g(({ legend: l, index: a }) => [
              J(kt, {
                shape: l.shape,
                radius: 30,
                stroke: "none",
                plot: { x: 30, y: 30 },
                fill: `url(#pattern_${C.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(dt, {
        show: _.value.showTooltip && R.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", L(F({ ...Y.value })), void 0, !0)
        ]),
        "tooltip-after": g(() => [
          p(t.$slots, "tooltip-after", L(F({ ...Y.value })), void 0, !0)
        ]),
        _: 3
      }, 8, ["show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "fontSize", "backgroundOpacity", "position", "offsetY", "parent", "content", "isFullscreen", "isCustom"]),
      z.value ? (n(), O(ft, {
        key: 8,
        hideDetails: "",
        config: {
          open: _.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(), O(pt, {
            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) => _.value.showTable = !1)
          }, {
            th: g(({ th: l }) => [
              w("div", {
                innerHTML: l,
                style: { display: "flex", "align-items": "center" }
              }, null, 8, zt)
            ]),
            td: g(({ td: l }) => [
              we(E(l.name || l), 1)
            ]),
            _: 1
          }, 8, ["colNames", "head", "body", "config", "title"]))
        ]),
        _: 1
      }, 8, ["config"])) : m("", !0)
    ], 46, $t));
  }
}, tl = /* @__PURE__ */ Ct(Rt, [["__scopeId", "data-v-966f63d3"]]);
export {
  tl as default
};
