import { computed as v, ref as c, watch as Ae, onMounted as Je, onBeforeUnmount as Ke, openBlock as s, createElementBlock as n, normalizeClass as Fe, normalizeStyle as Z, createBlock as N, createCommentVNode as f, unref as h, createSlots as Qe, withCtx as m, renderSlot as g, normalizeProps as G, guardReactiveProps as R, createVNode as ze, createElementVNode as k, Fragment as I, renderList as U, toDisplayString as S, createTextVNode as Ne, nextTick as Ze, pushScopeId as et, popScopeId as tt } from "vue";
import { u as at, c as lt, t as ot, a as ut, p as O, o as st, e as se, g as rt, b as nt, i as j, f as x, X as it, s as ct, w as vt, G as dt, L as ht, d as pt, x as yt, y as ft, q as gt, r as mt } from "./index-Cm2_6s9o.js";
import { t as bt, u as wt } from "./useResponsive-CoxXLe23.js";
import { _ as kt } from "./Title-Coit3NcT.js";
import { u as xt, U as Ct } from "./usePrinter-Cx8U1e30.js";
import { _ as _t } from "./Tooltip-BBgfUr4a.js";
import { D as $t } from "./DataTable-NGi-FgLM.js";
import { L as Tt } from "./Legend-DRozxv9L.js";
import It from "./vue-ui-skeleton-BUS6A44x.js";
import St from "./vue-ui-accordion-CxrNF8BI.js";
import { u as Oe } from "./useNestedProp-BYPZJNhi.js";
import { _ as Pt } from "./PackageVersion-CTMY4zeY.js";
import { P as Lt } from "./PenAndPaper-DJ_d10S-.js";
import { _ as At } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const Be = (E) => (et("data-v-6c74341a"), E = E(), tt(), E), Ft = ["id"], zt = ["xmlns", "viewBox"], Nt = ["id"], Ot = ["stop-color"], Bt = ["stop-color"], Vt = ["id"], Mt = /* @__PURE__ */ Be(() => /* @__PURE__ */ k("feGaussianBlur", {
  in: "SourceGraphic",
  stdDeviation: 2
}, null, -1)), Dt = /* @__PURE__ */ Be(() => /* @__PURE__ */ k("feColorMatrix", {
  type: "saturate",
  values: "0"
}, null, -1)), Gt = [
  Mt,
  Dt
], Rt = ["x", "y", "height", "width"], Ut = ["height", "width"], jt = ["rx", "x", "y", "height", "width", "stroke", "stroke-width", "filter"], Et = ["rx", "x", "y", "height", "width", "fill", "stroke", "stroke-width", "filter"], Wt = ["x", "y", "height", "width", "filter"], qt = { key: 0 }, Ht = { key: 1 }, Xt = { key: 2 }, Yt = { key: 3 }, Jt = ["onMouseover", "x", "y", "height", "width"], Kt = {
  key: 5,
  class: "vue-data-ui-watermark"
}, Qt = ["onClick"], Zt = { key: 0 }, ea = { key: 1 }, ta = ["innerHTML"], aa = {
  __name: "vue-ui-waffle",
  props: {
    config: {
      type: Object,
      default() {
        return {};
      }
    },
    dataset: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  emits: ["selectLegend"],
  setup(E, { expose: Ve, emit: Me }) {
    const b = E, { vue_ui_waffle: De } = at(), X = v(() => !!b.dataset && b.dataset.length), P = c(lt()), Ge = c(null), ee = c(!1), te = c(""), B = c(null), re = c(0), V = c(null), ne = c(null), ie = c(null), ce = c(null), ve = c(null), de = c(0), he = c(0), pe = c(0), e = v({
      get: () => ye(),
      set: (t) => t
    });
    function ye() {
      const t = Oe({
        userConfig: b.config,
        defaultConfig: De
      });
      return t.theme ? {
        ...Oe({
          userConfig: ot.vue_ui_waffle[t.theme] || b.config,
          defaultConfig: t
        }),
        customPalette: ut[t.theme] || O
      } : t;
    }
    Ae(() => b.config, (t) => {
      e.value = ye(), fe(), de.value += 1, he.value += 1, pe.value += 1;
    }, { deep: !0 });
    const Y = c(null);
    function fe() {
      if (st(b.dataset) ? se({
        componentName: "VueUiWaffle",
        type: "dataset"
      }) : b.dataset.forEach((t, o) => {
        rt({
          datasetObject: t,
          requiredAttributes: ["name", "values"]
        }).forEach((a) => {
          se({
            componentName: "VueUiWaffle",
            type: "datasetSerieAttribute",
            property: a,
            index: o
          });
        });
      }), e.value.responsive) {
        const t = bt(() => {
          const { width: o, height: a } = wt({
            chart: V.value,
            title: e.value.style.chart.title.text ? ne.value : null,
            legend: e.value.style.chart.legend.show ? ie.value : null,
            source: ce.value,
            noTitle: ve.value
          });
          L.value.width = o, L.value.height = a, C.value.width = o, C.value.height = a;
        });
        Y.value = new ResizeObserver(t), Y.value.observe(V.value.parentNode);
      }
    }
    Je(() => {
      fe();
    }), Ke(() => {
      Y.value && Y.value.disconnect();
    });
    const { isPrinting: ge, isImaging: me, generatePdf: be, generateImage: we } = xt({
      elementId: `vue-ui-waffle_${P.value}`,
      fileName: e.value.style.chart.title.text || "vue-ui-waffle"
    }), Re = v(() => e.value.userOptions.show && !e.value.style.chart.title.text), ke = v(() => nt(e.value.customPalette)), T = c({
      showTable: e.value.table.show,
      showTooltip: e.value.style.chart.tooltip.show
    }), L = c({
      height: 512,
      width: 512
    }), C = c({
      top: 0,
      left: 0,
      height: 512,
      width: 512
    }), A = v(() => (C.value.width - e.value.style.chart.layout.grid.size * e.value.style.chart.layout.grid.spaceBetween) / e.value.style.chart.layout.grid.size), F = v(() => (C.value.height - e.value.style.chart.layout.grid.size * e.value.style.chart.layout.grid.spaceBetween) / e.value.style.chart.layout.grid.size), W = v(() => C.value.width / e.value.style.chart.layout.grid.size), J = v(() => C.value.height / e.value.style.chart.layout.grid.size);
    function xe(t) {
      const o = e.value.style.chart.layout.grid.size * e.value.style.chart.layout.grid.size, a = t.reduce((w, ue) => w + ue, 0), l = t.map((w) => w / a * o), u = l.map(Math.floor), i = l.map((w) => w % 1);
      let y = o - u.reduce((w, ue) => w + ue, 0);
      for (; y > 0; ) {
        let w = i.indexOf(Math.max(...i));
        u[w] += 1, i[w] = 0, y -= 1;
      }
      return u;
    }
    function Ce() {
      return b.dataset.map((t, o) => ({
        ...t,
        color: pt(t.color) || ke.value[o] || O[o] || O[o % O.length],
        uid: `serie_${o}`,
        absoluteIndex: o
      }));
    }
    const _e = v(() => Ce()), d = c(_e.value);
    Ae(() => b.dataset, (t) => {
      d.value = Ce();
    }, { deep: !0 });
    const Ue = v(() => {
      const t = d.value.filter((o, a) => !p.value.includes(o.uid)).map((o, a) => (o.values || []).reduce((l, u) => l + u, 0));
      return xe(t);
    }), je = v(() => {
      const t = d.value.map((o, a) => (o.values || []).reduce((l, u) => l + u));
      return xe(t);
    }), q = v(() => (b.dataset.forEach((t, o) => {
      [null, void 0].includes(t.values) && se({
        componentName: "VueUiWaffle",
        type: "datasetSerieAttribute",
        property: "values (number[])",
        index: o
      });
    }), d.value.filter((t, o) => !p.value.includes(t.uid)).map((t, o) => ({
      absoluteIndex: t.absoluteIndex,
      uid: t.uid,
      name: t.name,
      color: t.color,
      value: (t.values || []).reduce((a, l) => a + l, 0),
      absoluteValues: t.values || [],
      proportion: Ue.value[o]
    })))), Ee = v(() => d.value.map((t, o) => ({
      absoluteIndex: t.absoluteIndex,
      uid: t.uid,
      name: t.name,
      color: t.color,
      value: (t.values || []).reduce((a, l) => a + l, 0),
      absoluteValues: t.values || [],
      proportion: je.value[o]
    })));
    function We() {
      return Ee.value.map((t) => ({
        name: t.name,
        color: t.color,
        value: t.value,
        proportion: t.proportion
      }));
    }
    const qe = v(() => {
      let t = 0;
      return q.value.map((o, a) => {
        const l = t, u = l + o.proportion, i = [];
        for (let y = Math.floor(l); y < Math.floor(u); y += 1)
          i.push(y);
        return t = u, {
          ...o,
          start: l,
          rects: i
        };
      });
    }), r = v(() => qe.value.flatMap((t, o) => t.rects.map((a, l) => ({
      isFirst: l === 0,
      isLongEnough: a.length > 2,
      name: t.name,
      color: t.color,
      value: t.value,
      serieIndex: o,
      absoluteStartIndex: l < 3,
      serieId: t.uid,
      ...t
    }))).map((t, o) => ({
      ...t,
      isAbsoluteFirst: o % e.value.style.chart.layout.grid.size === 0
    }))), H = v(() => {
      const t = [];
      for (let o = 0; o < e.value.style.chart.layout.grid.size; o += 1)
        for (let a = 0; a < e.value.style.chart.layout.grid.size; a += 1)
          t.push({
            isStartOfLine: a === 0,
            position: e.value.style.chart.layout.grid.vertical ? o : a,
            x: (e.value.style.chart.layout.grid.vertical ? o : a) * (A.value + e.value.style.chart.layout.grid.spaceBetween),
            y: (e.value.style.chart.layout.grid.vertical ? a : o) * (F.value + e.value.style.chart.layout.grid.spaceBetween) + C.value.top
          });
      return t;
    }), p = c([]), z = c(!1), $e = c(null), Te = c(null);
    function Ie(t) {
      if (!e.value.useAnimation) {
        p.value.includes(t) ? p.value = p.value.filter((u) => u !== t) : p.value.length < M.value.length - 1 && M.value.length > 1 && p.value.push(t);
        return;
      }
      const o = _e.value.find((u) => u.uid === t).values.reduce((u, i) => u + i, 0);
      let l = d.value.find((u) => u.uid === t).values.reduce((u, i) => u + i, 0);
      if (p.value.includes(t)) {
        let i = function() {
          l > u ? (cancelAnimationFrame($e.value), d.value = d.value.map((y, w) => y.uid === t ? {
            ...y,
            values: [u]
          } : y), z.value = !1) : (z.value = !0, l += u * 0.025, d.value = d.value.map((y, w) => y.uid === t ? {
            ...y,
            values: [l]
          } : y), $e.value = requestAnimationFrame(i));
        };
        p.value = p.value.filter((y) => y !== t);
        const u = o;
        i();
      } else if (p.value.length < M.value.length - 1 && M.value.length > 1) {
        let u = function() {
          l < 0.1 ? (cancelAnimationFrame(Te.value), p.value.push(t), d.value = d.value.map((i, y) => i.uid === t ? {
            ...i,
            values: [0]
          } : i), z.value = !1) : (z.value = !0, l /= 1.5, d.value = d.value.map((i, y) => i.uid === t ? {
            ...i,
            values: [l]
          } : i), Te.value = requestAnimationFrame(u));
        };
        u();
      }
      Me("selectLegend", q.value.map((u) => ({
        name: u.name,
        color: u.color,
        value: u.value,
        proportion: u.proportion / Math.pow(e.value.style.chart.layout.grid.size, 2)
      })));
    }
    const M = v(() => d.value.map((t, o) => ({
      name: t.name,
      color: t.color || ke[o] || O[o] || O[o % O.length],
      value: (t.values || []).reduce((a, l) => a + l, 0),
      uid: t.uid,
      shape: "square"
    })).map((t, o) => ({
      ...t,
      proportion: t.value / d.value.map((a) => (a.values || []).reduce((l, u) => l + u, 0)).reduce((a, l) => a + l, 0),
      opacity: p.value.includes(t.uid) ? 0.5 : 1,
      segregate: () => Ie(t.uid),
      isSegregated: p.value.includes(t.uid)
    }))), He = v(() => ({
      cy: "waffle-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" : ""
    })), _ = v(() => q.value.map((t) => t.value).reduce((t, o) => t + o, 0)), ae = c(null);
    function Xe(t) {
      if (p.value.length === b.dataset.length) return;
      const o = r.value[t];
      ae.value = {
        datapoint: o,
        seriesIndex: o.absoluteIndex,
        series: d.value,
        config: e.value
      }, ee.value = !0, B.value = r.value[t].serieIndex;
      const a = e.value.style.chart.tooltip.customFormat;
      if (yt(a) && ft(() => a({
        seriesIndex: r.value[t].absoluteIndex,
        datapoint: o,
        series: d.value,
        config: e.value
      })))
        te.value = a({
          seriesIndex: r.value[t].absoluteIndex,
          datapoint: o,
          series: d.value,
          config: e.value
        });
      else {
        let l = "";
        if (l += `<div style="width:100%;text-align:center;border-bottom:1px solid ${e.value.style.chart.tooltip.borderColor};padding-bottom:6px;margin-bottom:3px;">${o.name}</div>`, l += `<div style="display:flex;flex-direction:row;gap:6px;align-items:center;"><svg viewBox="0 0 12 12" height="14" width="14"><rect x="0" y="0" height="12" width="12" stroke="none" rx="1" fill="${o.color}" /></svg>`, e.value.style.chart.tooltip.showValue && (l += `<b>${j(
          e.value.style.chart.layout.labels.dataLabels.formatter,
          o.value,
          x({
            p: e.value.style.chart.layout.labels.dataLabels.prefix,
            v: o.value,
            s: e.value.style.chart.layout.labels.dataLabels.suffix,
            r: e.value.style.chart.tooltip.roundingValue
          }),
          {
            datapoint: o,
            seriesIndex: r.value[t].absoluteIndex,
            series: d.value
          }
        )}</b>`), e.value.style.chart.tooltip.showPercentage) {
          const u = x({
            v: o.value / _.value * 100,
            s: "%",
            r: e.value.style.chart.tooltip.roundingPercentage
          });
          e.value.style.chart.tooltip.showValue ? l += `<span>(${u})</span></div>` : l += `<b>${u}%</b></div>`;
        }
        te.value = l;
      }
    }
    const $ = v(() => {
      const t = q.value.map((a) => ({
        name: a.name,
        color: a.color
      })), o = q.value.map((a) => a.value);
      return { head: t, body: o };
    });
    function le(t) {
      return e.value.useBlurOnHover && ![null, void 0].includes(B.value) && B.value !== t ? `url(#blur_${P.value})` : "";
    }
    function Se() {
      Ze(() => {
        const t = $.value.head.map((l, u) => [[
          l.name
        ], [$.value.body[u]], [isNaN($.value.body[u] / _.value) ? "-" : $.value.body[u] / _.value * 100]]), o = [[e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [[""], ["val"], ["%"]]].concat(t), a = gt(o);
        mt({ csvContent: a, title: e.value.style.chart.title.text || "vue-ui-waffle" });
      });
    }
    const K = v(() => {
      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>',
        j(
          e.value.style.chart.layout.labels.dataLabels.formatter,
          _.value,
          x({
            p: e.value.style.chart.layout.labels.dataLabels.prefix,
            v: _.value,
            s: e.value.style.chart.layout.labels.dataLabels.suffix,
            r: e.value.table.td.roundingValue
          })
        ),
        "100%"
      ], o = $.value.head.map((u, i) => [
        {
          color: u.color,
          name: u.name
        },
        j(
          e.value.style.chart.layout.labels.dataLabels.formatter,
          $.value.body[i],
          x({
            p: e.value.style.chart.layout.labels.dataLabels.prefix,
            v: $.value.body[i],
            s: e.value.style.chart.layout.labels.dataLabels.suffix,
            r: e.value.table.td.roundingValue
          })
        ),
        isNaN($.value.body[i] / _.value) ? "-" : x({
          v: $.value.body[i] / _.value * 100,
          s: "%",
          r: e.value.table.td.roundingPercentage
        })
      ]), a = {
        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
        },
        shape: "square",
        breakpoint: e.value.table.responsiveBreakpoint
      }, l = [
        e.value.table.columnNames.series,
        e.value.table.columnNames.value,
        e.value.table.columnNames.percentage
      ];
      return {
        head: t,
        body: o,
        config: a,
        colNames: l
      };
    }), D = c(!1);
    function Ye(t) {
      D.value = t, re.value += 1;
    }
    function Pe() {
      T.value.showTable = !T.value.showTable;
    }
    function Le() {
      T.value.showTooltip = !T.value.showTooltip;
    }
    const Q = c(!1);
    function oe() {
      Q.value = !Q.value;
    }
    return Ve({
      getData: We,
      generatePdf: be,
      generateCsv: Se,
      generateImage: we,
      toggleTable: Pe,
      toggleTooltip: Le,
      toggleAnnotator: oe
    }), (t, o) => (s(), n("div", {
      class: Fe(`vue-ui-waffle ${D.value ? "vue-data-ui-wrapper-fullscreen" : ""}`),
      ref_key: "waffleChart",
      ref: V,
      id: `vue-ui-waffle_${P.value}`,
      style: Z(`font-family:${e.value.style.fontFamily};width:100%; text-align:center;background:${e.value.style.chart.backgroundColor};${e.value.responsive ? "height: 100%" : ""}`)
    }, [
      e.value.userOptions.buttons.annotator ? (s(), N(Lt, {
        key: 0,
        parent: V.value,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        active: Q.value,
        onClose: oe
      }, null, 8, ["parent", "backgroundColor", "color", "active"])) : f("", !0),
      Re.value ? (s(), n("div", {
        key: 1,
        ref_key: "noTitle",
        ref: ve,
        class: "vue-data-ui-no-title-space",
        style: "height:36px; width: 100%;background:transparent"
      }, null, 512)) : f("", !0),
      e.value.style.chart.title.text ? (s(), n("div", {
        key: 2,
        ref_key: "chartTitle",
        ref: ne,
        style: "width:100%;background:transparent;padding-bottom:12px"
      }, [
        (s(), N(kt, {
          key: `title_${de.value}`,
          config: {
            title: {
              cy: "waffle-title",
              ...e.value.style.chart.title
            },
            subtitle: {
              cy: "waffle-subtitle",
              ...e.value.style.chart.title.subtitle
            }
          }
        }, null, 8, ["config"]))
      ], 512)) : f("", !0),
      e.value.userOptions.show && X.value ? (s(), N(Ct, {
        ref_key: "details",
        ref: Ge,
        key: `user_options_${re.value}`,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        isPrinting: h(ge),
        isImaging: h(me),
        uid: P.value,
        hasTooltip: e.value.userOptions.buttons.tooltip && e.value.style.chart.tooltip.show,
        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: D.value,
        isTooltip: T.value.showTooltip,
        titles: { ...e.value.userOptions.buttonTitles },
        chartElement: V.value,
        position: e.value.userOptions.position,
        hasAnnotator: e.value.userOptions.buttons.annotator,
        isAnnotation: Q.value,
        onToggleFullscreen: Ye,
        onGeneratePdf: h(be),
        onGenerateCsv: Se,
        onGenerateImage: h(we),
        onToggleTable: Pe,
        onToggleTooltip: Le,
        onToggleAnnotator: oe
      }, Qe({ _: 2 }, [
        t.$slots.optionTooltip ? {
          name: "optionTooltip",
          fn: m(() => [
            g(t.$slots, "optionTooltip", {}, void 0, !0)
          ]),
          key: "0"
        } : void 0,
        t.$slots.optionPdf ? {
          name: "optionPdf",
          fn: m(() => [
            g(t.$slots, "optionPdf", {}, void 0, !0)
          ]),
          key: "1"
        } : void 0,
        t.$slots.optionCsv ? {
          name: "optionCsv",
          fn: m(() => [
            g(t.$slots, "optionCsv", {}, void 0, !0)
          ]),
          key: "2"
        } : void 0,
        t.$slots.optionImg ? {
          name: "optionImg",
          fn: m(() => [
            g(t.$slots, "optionImg", {}, void 0, !0)
          ]),
          key: "3"
        } : void 0,
        t.$slots.optionTable ? {
          name: "optionTable",
          fn: m(() => [
            g(t.$slots, "optionTable", {}, void 0, !0)
          ]),
          key: "4"
        } : void 0,
        t.$slots.optionFullscreen ? {
          name: "optionFullscreen",
          fn: m(({ toggleFullscreen: a, isFullscreen: l }) => [
            g(t.$slots, "optionFullscreen", G(R({ toggleFullscreen: a, isFullscreen: l })), void 0, !0)
          ]),
          key: "5"
        } : void 0,
        t.$slots.optionAnnotator ? {
          name: "optionAnnotator",
          fn: m(({ toggleAnnotator: a, isAnnotator: l }) => [
            g(t.$slots, "optionAnnotator", G(R({ toggleAnnotator: a, isAnnotator: l })), void 0, !0)
          ]),
          key: "6"
        } : void 0
      ]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasTooltip", "hasPdf", "hasImg", "hasXls", "hasTable", "hasFullscreen", "isFullscreen", "isTooltip", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage"])) : f("", !0),
      X.value ? (s(), n("svg", {
        key: 4,
        xmlns: h(it),
        class: Fe({ "vue-data-ui-fullscreen--on": D.value, "vue-data-ui-fulscreen--off": !D.value }),
        viewBox: `0 0 ${L.value.width <= 0 ? 10 : L.value.width} ${L.value.height <= 0 ? 10 : L.value.height}`,
        style: Z(`max-width:100%;overflow:visible;background:transparent;color:${e.value.style.chart.color}`)
      }, [
        ze(Pt),
        k("defs", null, [
          (s(!0), n(I, null, U(r.value, (a, l) => (s(), n("radialGradient", {
            cx: "50%",
            cy: "50%",
            r: "50%",
            fx: "50%",
            fy: "50%",
            id: `gradient_${P.value}_${l}`
          }, [
            k("stop", {
              offset: "0%",
              "stop-color": h(ct)(h(vt)(a.color, 0.05), 100 - e.value.style.chart.layout.rect.gradientIntensity)
            }, null, 8, Ot),
            k("stop", {
              offset: "100%",
              "stop-color": a.color
            }, null, 8, Bt)
          ], 8, Nt))), 256))
        ]),
        k("defs", null, [
          k("filter", {
            id: `blur_${P.value}`,
            x: "-50%",
            y: "-50%",
            width: "200%",
            height: "200%"
          }, Gt, 8, Vt)
        ]),
        e.value.useCustomCells && r.value.length ? (s(!0), n(I, { key: 0 }, U(H.value, (a, l) => (s(), n("foreignObject", {
          x: a.x,
          y: a.y,
          height: F.value <= 0 ? 1e-4 : F.value,
          width: A.value <= 0 ? 1e-4 : A.value,
          class: "vue-ui-waffle-custom-cell-foreignObject"
        }, [
          g(t.$slots, "cell", G(R({ cell: { ...a, color: r.value[l].color, ...r.value[l] }, isSelected: [null, void 0].includes(B.value) ? !0 : r.value[l].serieIndex === B.value })), void 0, !0)
        ], 8, Rt))), 256)) : f("", !0),
        !r.value.length && !e.value.useCustomCells ? (s(), n("rect", {
          key: 1,
          x: 12,
          y: 12,
          height: C.value.height - 24,
          width: C.value.width - 24,
          rx: 3,
          fill: "none",
          stroke: "black"
        }, null, 8, Ut)) : r.value.length && !e.value.useCustomCells ? (s(), n(I, { key: 2 }, [
          (s(!0), n(I, null, U(H.value, (a, l) => (s(), n("rect", {
            rx: e.value.style.chart.layout.rect.rounded ? e.value.style.chart.layout.rect.rounding : 0,
            x: a.x + e.value.style.chart.layout.grid.spaceBetween / 2,
            y: a.y + e.value.style.chart.layout.grid.spaceBetween / 2,
            height: F.value <= 0 ? 1e-4 : F.value,
            width: A.value <= 0 ? 1e-4 : A.value,
            fill: "white",
            stroke: e.value.style.chart.layout.rect.stroke,
            "stroke-width": e.value.style.chart.layout.rect.strokeWidth,
            filter: le(r.value[l].serieIndex)
          }, null, 8, jt))), 256)),
          (s(!0), n(I, null, U(H.value, (a, l) => (s(), n("rect", {
            rx: e.value.style.chart.layout.rect.rounded ? e.value.style.chart.layout.rect.rounding : 0,
            x: a.x + e.value.style.chart.layout.grid.spaceBetween / 2,
            y: a.y + e.value.style.chart.layout.grid.spaceBetween / 2,
            height: F.value <= 0 ? 1e-4 : F.value,
            width: A.value <= 0 ? 1e-4 : A.value,
            fill: e.value.style.chart.layout.rect.useGradient && e.value.style.chart.layout.rect.gradientIntensity > 0 ? `url(#gradient_${P.value}_${l})` : r.value[l].color,
            stroke: e.value.style.chart.layout.rect.stroke,
            "stroke-width": e.value.style.chart.layout.rect.strokeWidth,
            filter: le(r.value[l].serieIndex)
          }, null, 8, Et))), 256))
        ], 64)) : f("", !0),
        (s(!0), n(I, null, U(H.value, (a, l) => (s(), n(I, null, [
          r.value.length && !z.value && !e.value.style.chart.layout.grid.vertical && e.value.style.chart.layout.labels.captions.show && (r.value[l].isFirst && a.position < e.value.style.chart.layout.grid.size - 2 || r.value[l].isAbsoluteFirst && l % e.value.style.chart.layout.grid.size === 0 && r.value[l].absoluteStartIndex) ? (s(), n("foreignObject", {
            key: 0,
            x: a.x + e.value.style.chart.layout.labels.captions.offsetX + e.value.style.chart.layout.grid.spaceBetween / 2,
            y: a.y + e.value.style.chart.layout.labels.captions.offsetY + e.value.style.chart.layout.grid.spaceBetween / 2,
            height: J.value <= 0 ? 1e-4 : J.value,
            width: W.value * e.value.style.chart.layout.grid.size <= 0 ? 1e-4 : W.value * e.value.style.chart.layout.grid.size,
            filter: le(r.value[l].serieIndex)
          }, [
            k("div", {
              class: "vue-ui-waffle-caption",
              style: Z(`height: 100%; width: 100%; font-size:${e.value.style.chart.layout.labels.captions.fontSize}px;display:flex;align-items:center;justify-content:flex-start;padding: 0 ${W.value / 12}px;color:${h(dt)(r.value[l].color)};gap:2px`)
            }, [
              e.value.style.chart.layout.labels.captions.showSerieName ? (s(), n("span", qt, S(e.value.style.chart.layout.labels.captions.serieNameAbbreviation ? h(ht)({ source: r.value[l].name, length: e.value.style.chart.layout.labels.captions.serieNameMaxAbbreviationSize }) : r.value[l].name) + ": ", 1)) : f("", !0),
              e.value.style.chart.layout.labels.captions.showPercentage ? (s(), n("span", Ht, S(h(x)({ v: r.value[l].proportion, s: "%", r: e.value.style.chart.layout.labels.captions.roundingPercentage })), 1)) : f("", !0),
              e.value.style.chart.layout.labels.captions.showPercentage && e.value.style.chart.layout.labels.captions.showValue ? (s(), n("span", Xt, " (" + S(h(j)(
                e.value.style.chart.layout.labels.dataLabels.formatter,
                r.value[l].value,
                h(x)({
                  p: e.value.style.chart.layout.labels.dataLabels.prefix,
                  v: r.value[l].value,
                  s: e.value.style.chart.layout.labels.dataLabels.suffix,
                  r: e.value.style.chart.layout.labels.captions.roundingValue
                }),
                { datapoint: r.value[l], position: a }
              )) + ") ", 1)) : f("", !0),
              !e.value.style.chart.layout.labels.captions.showPercentage && e.value.style.chart.layout.labels.captions.showValue ? (s(), n("span", Yt, S(h(j)(
                e.value.style.chart.layout.labels.dataLabels.formatter,
                r.value[l].value,
                h(x)({
                  p: e.value.style.chart.layout.labels.dataLabels.prefix,
                  v: r.value[l].value,
                  s: e.value.style.chart.layout.labels.dataLabels.suffix,
                  r: e.value.style.chart.layout.labels.captions.roundingValue
                }),
                { datapoint: r.value[l], position: a }
              )), 1)) : f("", !0)
            ], 4)
          ], 8, Wt)) : f("", !0)
        ], 64))), 256)),
        (s(!0), n(I, null, U(H.value, (a, l) => (s(), n("rect", {
          onMouseover: (u) => Xe(l),
          onMouseleave: o[0] || (o[0] = (u) => {
            ee.value = !1, B.value = null;
          }),
          x: a.x + e.value.style.chart.layout.grid.spaceBetween / 2,
          y: a.y + e.value.style.chart.layout.grid.spaceBetween / 2,
          height: J.value <= 0 ? 1e-4 : J.value,
          width: W.value <= 0 ? 1e-4 : W.value,
          fill: "transparent",
          stroke: "none"
        }, null, 40, Jt))), 256)),
        g(t.$slots, "svg", { svg: L.value }, void 0, !0)
      ], 14, zt)) : f("", !0),
      t.$slots.watermark ? (s(), n("div", Kt, [
        g(t.$slots, "watermark", G(R({ isPrinting: h(ge) || h(me) })), void 0, !0)
      ])) : f("", !0),
      X.value ? f("", !0) : (s(), N(It, {
        key: 6,
        config: {
          type: "waffle",
          style: {
            backgroundColor: e.value.style.chart.backgroundColor,
            waffle: {
              color: "#CCCCCC"
            }
          }
        }
      }, null, 8, ["config"])),
      k("div", {
        ref_key: "chartLegend",
        ref: ie
      }, [
        e.value.style.chart.legend.show ? (s(), N(Tt, {
          key: `legend_${pe.value}`,
          legendSet: M.value,
          config: He.value,
          onClickMarker: o[1] || (o[1] = ({ legend: a }) => Ie(a.uid))
        }, {
          item: m(({ legend: a }) => [
            k("div", {
              onClick: (l) => a.segregate(),
              style: Z(`opacity:${p.value.includes(a.uid) ? 0.5 : 1}`)
            }, [
              Ne(S(a.name) + ": " + S(h(j)(
                e.value.style.chart.layout.labels.dataLabels.formatter,
                a.value,
                h(x)({
                  p: e.value.style.chart.layout.labels.dataLabels.prefix,
                  v: a.value,
                  s: e.value.style.chart.layout.labels.dataLabels.suffix,
                  r: e.value.style.chart.legend.roundingValue,
                  isAnimating: z.value
                }),
                { datapoint: a }
              )) + " ", 1),
              p.value.includes(a.uid) ? (s(), n("span", ea, " ( - % ) ")) : (s(), n("span", Zt, " (" + S(isNaN(a.value / _.value) ? "-" : h(x)({ v: a.value / _.value * 100, s: "%", r: e.value.style.chart.legend.roundingPercentage, isAnimating: z.value })) + ") ", 1))
            ], 12, Qt)
          ]),
          _: 1
        }, 8, ["legendSet", "config"])) : g(t.$slots, "legend", {
          key: 1,
          legend: M.value
        }, void 0, !0)
      ], 512),
      t.$slots.source ? (s(), n("div", {
        key: 7,
        ref_key: "source",
        ref: ce,
        dir: "auto"
      }, [
        g(t.$slots, "source", {}, void 0, !0)
      ], 512)) : f("", !0),
      ze(_t, {
        show: T.value.showTooltip && ee.value && p.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,
        backgroundOpacity: e.value.style.chart.tooltip.backgroundOpacity,
        position: e.value.style.chart.tooltip.position,
        offsetY: e.value.style.chart.tooltip.offsetY,
        parent: V.value,
        content: te.value,
        isCustom: e.value.style.chart.tooltip.customFormat && typeof e.value.style.chart.tooltip.customFormat == "function",
        fontSize: e.value.style.chart.tooltip.fontSize,
        isFullscreen: D.value
      }, {
        "tooltip-before": m(() => [
          g(t.$slots, "tooltip-before", G(R({ ...ae.value })), void 0, !0)
        ]),
        "tooltip-after": m(() => [
          g(t.$slots, "tooltip-after", G(R({ ...ae.value })), void 0, !0)
        ]),
        _: 3
      }, 8, ["show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "backgroundOpacity", "position", "offsetY", "parent", "content", "isCustom", "fontSize", "isFullscreen"]),
      X.value ? (s(), N(St, {
        key: 8,
        hideDetails: "",
        config: {
          open: T.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: m(() => [
          (s(), N($t, {
            key: `table_${he.value}`,
            colNames: K.value.colNames,
            head: K.value.head,
            body: K.value.body,
            config: K.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] = (a) => T.value.showTable = !1)
          }, {
            th: m(({ th: a }) => [
              k("div", {
                innerHTML: a,
                style: { display: "flex", "align-items": "center" }
              }, null, 8, ta)
            ]),
            td: m(({ td: a }) => [
              Ne(S(a.name || a), 1)
            ]),
            _: 1
          }, 8, ["colNames", "head", "body", "config", "title"]))
        ]),
        _: 1
      }, 8, ["config"])) : f("", !0)
    ], 14, Ft));
  }
}, ga = /* @__PURE__ */ At(aa, [["__scopeId", "data-v-6c74341a"]]);
export {
  ga as default
};
