import { useSlots as Pt, computed as w, ref as g, onMounted as at, watch as lt, nextTick as he, createElementBlock as s, openBlock as o, unref as b, normalizeStyle as U, normalizeClass as te, createBlock as q, createCommentVNode as v, renderSlot as x, createElementVNode as Y, createVNode as ae, createSlots as rt, withCtx as z, normalizeProps as V, guardReactiveProps as F, Fragment as h, renderList as y, mergeProps as _e, toDisplayString as S, createTextVNode as At } from "vue";
import { u as Vt, c as ot, t as Ft, p as ve, a as Dt, C as de, b as Et, o as Ht, e as st, g as Wt, d as Bt, ak as ye, ah as it, D as nt, X as Ut, l as Yt, a6 as ge, G as ut, f as X, x as ct, q as Xt, r as Gt, i as ht, y as Jt } from "./index-lwwgkcGL.js";
import { u as vt } from "./useNestedProp-TXT2IHSL.js";
import { t as qt, u as Zt } from "./useResponsive-JZ9xq-JV.js";
import { u as Kt, U as Qt } from "./usePrinter-BCTMiyK9.js";
import { S as jt } from "./Slicer-CWCYtaVJ.js";
import { _ as ea } from "./Tooltip-5snNLRyR.js";
import { _ as ta } from "./Title-C9AEelQ1.js";
import { L as aa } from "./Legend-0b4003Zt.js";
import la from "./vue-ui-accordion-CJnR6fHi.js";
import { D as ra } from "./DataTable-C0D_esqj.js";
import oa from "./vue-ui-skeleton-BufuSja5.js";
import { _ as sa } from "./PackageVersion-C-ytTlJe.js";
import { _ as ia } from "./PenAndPaper-__UJ-k8q.js";
import { u as na } from "./useUserOptionState-BIvW1Kz7.js";
import { _ as ua } from "./Shape-C0Zlk88G.js";
import { u as ca } from "./useChartAccessibility-BWojgys7.js";
import { _ as ha } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const va = ["id"], da = ["xmlns", "viewBox"], ya = ["x", "y", "width", "height"], ga = { key: 1 }, ba = ["id"], fa = ["stop-color"], ma = ["stop-color"], pa = ["stop-color"], xa = ["x1", "x2", "y1", "y2", "stroke"], ka = ["x1", "x2", "y1", "y2", "stroke"], wa = ["x1", "x2", "y1", "y2", "stroke"], _a = ["x1", "x2", "y1", "y2", "stroke"], za = { key: 0 }, Ca = ["x", "y", "height", "rx", "width", "fill", "stroke", "stroke-width"], La = { key: 0 }, $a = ["x", "y", "height", "rx", "width", "fill", "stroke", "stroke-width"], Sa = ["x", "y", "width", "rx", "height", "fill", "stroke", "stroke-width"], Ma = { key: 0 }, Ta = ["x", "y", "width", "rx", "height", "fill", "stroke", "stroke-width"], Na = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Ia = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Oa = ["x", "y", "font-size", "fill", "font-weight"], Ra = ["transform", "font-size", "fill", "font-weight"], Pa = ["x", "y", "font-size", "fill", "font-weight"], Aa = { key: 0 }, Va = ["x", "y", "font-size", "font-weight", "fill"], Fa = ["x", "y", "font-size", "fill", "font-weight"], Da = { key: 0 }, Ea = ["x", "y", "font-size", "font-weight", "fill"], Ha = ["x1", "x2", "y1", "y2", "stroke"], Wa = ["x", "y", "font-size", "font-weight", "fill"], Ba = ["x1", "x2", "y1", "y2", "stroke"], Ua = ["font-size", "font-weight", "fill", "text-anchor", "transform"], Ya = { key: 0 }, Xa = { key: 1 }, Ga = ["text-anchor", "font-size", "font-weight", "fill", "transform", "onClick"], Ja = { key: 0 }, qa = { key: 1 }, Za = ["font-size", "font-weight", "fill", "x", "y", "onClick"], Ka = ["x", "y", "width", "height", "onClick", "onMouseenter", "fill"], Qa = ["x", "y", "width", "height", "onClick", "onMouseenter", "fill"], ja = {
  key: 4,
  class: "vue-data-ui-watermark"
}, el = ["onClick"], tl = ["innerHTML"], al = {
  __name: "vue-ui-stackbar",
  props: {
    config: {
      type: Object,
      default() {
        return {};
      }
    },
    dataset: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  emits: ["selectDatapoint", "selectLegend", "selectTimeLabel"],
  setup(be, { expose: dt, emit: yt }) {
    const { vue_ui_stackbar: gt } = Vt(), bt = Pt(), f = be, fe = yt, G = w({
      get() {
        return !!f.dataset && f.dataset.length;
      },
      set(a) {
        return a;
      }
    }), Z = g(null), O = g(ot()), le = g(!1), me = g(null), pe = g(""), L = g([]), ze = g(0), Ce = g(null), Le = g(null), $e = g(null), Se = g(null), Me = g(0), re = g(!1), K = g(null), D = g(!1), ft = g(0), mt = g(0), pt = g(0), J = g(null);
    at(() => {
      ke();
    });
    const e = w({
      get: () => Oe(),
      set: (a) => a
    }), { userOptionsVisible: xe, setUserOptionsVisibility: Te, keepUserOptionState: Ne } = na({ config: e.value }), { svgRef: Ie } = ca({ config: e.value.style.chart.title });
    function Oe() {
      const a = vt({
        userConfig: f.config,
        defaultConfig: gt
      });
      let r = {};
      return a.theme ? r = {
        ...vt({
          userConfig: Dt.vue_ui_stackbar[a.theme] || f.config,
          defaultConfig: a
        }),
        customPalette: Ft[a.theme] || ve
      } : r = a, f.config && de(f.config, "style.chart.grid.scale.scaleMin") ? r.style.chart.grid.scale.scaleMin = f.config.style.chart.grid.scale.scaleMin : r.style.chart.grid.scale.scaleMin = null, f.config && de(f.config, "style.chart.grid.scale.scaleMax") ? r.style.chart.grid.scale.scaleMax = f.config.style.chart.grid.scale.scaleMax : r.style.chart.grid.scale.scaleMax = null, f.config && de(f.config, "style.chart.zoom.startIndex") ? r.style.chart.zoom.startIndex = f.config.style.chart.zoom.startIndex : r.style.chart.zoom.startIndex = null, f.config && de(f.config, "style.chart.zoom.endIndex") ? r.style.chart.zoom.endIndex = f.config.style.chart.zoom.endIndex : r.style.chart.zoom.endIndex = null, r;
    }
    lt(() => f.config, (a) => {
      e.value = Oe(), xe.value = !e.value.userOptions.showOnChartHover, ke(), ft.value += 1, mt.value += 1, pt.value += 1, _.value.dataLabels.show = e.value.style.chart.bars.dataLabels.show, _.value.showTable = e.value.table.show, _.value.showTooltip = e.value.style.chart.tooltip.show;
    }, { deep: !0 }), lt(() => f.dataset, (a) => {
      Ee();
    }, { deep: !0 });
    const _ = g({
      dataLabels: {
        show: e.value.style.chart.bars.dataLabels.show
      },
      showTable: e.value.table.show,
      showTooltip: e.value.style.chart.tooltip.show
    }), { isPrinting: Re, isImaging: Pe, generatePdf: Ae, generateImage: Ve } = Kt({
      elementId: `stackbar_${O.value}`,
      fileName: e.value.style.chart.title.text || "vue-ui-stackbar",
      options: e.value.userOptions.print
    }), oe = g({
      width: e.value.style.chart.width,
      height: e.value.style.chart.height,
      paddingRatio: {
        top: e.value.style.chart.padding.top / e.value.style.chart.height,
        right: e.value.style.chart.padding.right / e.value.style.chart.width,
        bottom: e.value.style.chart.padding.bottom / e.value.style.chart.height,
        left: e.value.style.chart.padding.left / e.value.style.chart.width
      }
    }), xt = w(() => Et(e.value.customPalette)), Fe = g(null), De = g(null);
    at(() => {
      ke();
    });
    function ke() {
      if (Ht(f.dataset) ? st({
        componentName: "VueUiStackbar",
        type: "dataset"
      }) : f.dataset.forEach((a, r) => {
        Wt({
          datasetObject: a,
          requiredAttributes: ["name", "series"]
        }).forEach((t) => {
          G.value = !1, st({
            componentName: "VueUiStackbar",
            type: "datasetSerieAttribute",
            property: t,
            index: r
          });
        });
      }), setTimeout(() => {
        D.value = !0;
      }, 10), e.value.responsive) {
        const a = qt(() => {
          D.value = !1;
          const { width: r, height: t } = Zt({
            chart: Z.value,
            title: e.value.style.chart.title.text ? Ce.value : null,
            legend: e.value.style.chart.legend.show ? Le.value : null,
            slicer: e.value.style.chart.zoom.show && P.value > 1 ? $e.value : null,
            source: Se.value
          });
          requestAnimationFrame(() => {
            oe.value.width = r, oe.value.height = t, clearTimeout(De.value), De.value = setTimeout(() => {
              D.value = !0;
            }, 10);
          });
        });
        Fe.value = new ResizeObserver(a), Fe.value.observe(Z.value.parentNode);
      }
      He();
    }
    const i = w(() => {
      const { height: a, width: r } = oe.value, { right: t } = oe.value.paddingRatio, l = e.value.style.chart.padding.top, u = r - r * t, n = a - e.value.style.chart.padding.bottom, C = e.value.style.chart.padding.left, E = r - C - r * t, H = a - l - e.value.style.chart.padding.bottom;
      return {
        chartHeight: a,
        chartWidth: r,
        top: l,
        right: u,
        bottom: n,
        left: C,
        width: E,
        height: H < 0 ? 0 : H
      };
    }), R = w(() => f.dataset.map((a, r) => {
      const t = Bt(a.color) || xt.value[r] || ve[r] || ve[r % ve.length];
      return {
        ...a,
        // In distributed mode, all values are converted to positive
        series: JSON.parse(JSON.stringify(a.series)).map((l) => e.value.style.chart.bars.distributed ? Math.abs(l) : l),
        // Store signs to manage display of neg values in distributed mode
        signedSeries: a.series.map((l) => l >= 0 ? 1 : -1),
        absoluteIndex: r,
        id: ot(),
        color: t
      };
    })), P = w(() => Math.max(...R.value.filter((a) => !L.value.includes(a.id)).map((a) => a.series.length))), c = g({
      start: 0,
      end: Math.max(...f.dataset.map((a) => a.series.length))
    });
    function Ee() {
      He();
    }
    async function He() {
      (e.value.style.chart.zoom.startIndex !== null || e.value.style.chart.zoom.endIndex !== null) && J.value ? (e.value.style.chart.zoom.startIndex !== null && (await he(), await he(), J.value && J.value.setStartValue(e.value.style.chart.zoom.startIndex)), e.value.style.chart.zoom.endIndex !== null && (await he(), await he(), J.value && J.value.setEndValue(kt(e.value.style.chart.zoom.endIndex + 1)))) : (c.value = {
        start: 0,
        end: Math.max(...f.dataset.map((a) => a.series.length))
      }, Me.value += 1);
    }
    function kt(a) {
      const r = Math.max(...f.dataset.map((t) => t.series.length));
      return a > r ? r : a < 0 || e.value.style.chart.zoom.startIndex !== null && a < e.value.style.chart.zoom.startIndex ? e.value.style.chart.zoom.startIndex !== null ? e.value.style.chart.zoom.startIndex + 1 : 1 : a;
    }
    const d = w(() => {
      let a;
      return e.value.orientation === "vertical" ? a = i.value.width / (c.value.end - c.value.start) : a = i.value.height / (c.value.end - c.value.start), a <= 0 ? 0 : a;
    }), Q = w(() => ye(R.value.filter((a) => !L.value.includes(a.id))).slice(c.value.start, c.value.end)), wt = w(() => ye(R.value.filter((a) => !L.value.includes(a.id)).map((a) => ({
      ...a,
      series: a.series.map((r, t) => a.signedSeries[t] === -1 && r >= 0 ? -r : r)
    }))).slice(c.value.start, c.value.end)), se = w(() => {
      const a = R.value.filter((r) => !L.value.includes(r.id));
      return {
        positive: ye(a.map((r) => ({
          ...r,
          series: r.series.slice(c.value.start, c.value.end).map((t) => t >= 0 ? t : 0)
        }))),
        negative: ye(a.map((r) => ({
          ...r,
          series: r.series.slice(c.value.start, c.value.end).map((t) => t < 0 ? t : 0)
        })))
      };
    }), N = w(() => {
      const a = e.value.style.chart.grid.scale.scaleMax !== null && !e.value.style.chart.bars.distributed ? e.value.style.chart.grid.scale.scaleMax : Math.max(...se.value.positive), r = Math.min(...se.value.negative), t = e.value.style.chart.grid.scale.scaleMin !== null && !e.value.style.chart.bars.distributed ? e.value.style.chart.grid.scale.scaleMin : [-1 / 0, 1 / 0, NaN, void 0, null].includes(r) ? 0 : r, l = !e.value.style.chart.bars.distributed && (e.value.style.chart.grid.scale.scaleMax !== null || e.value.style.chart.grid.scale.scaleMin !== null) ? it(t > 0 ? 0 : t, a < 0 ? 0 : a, e.value.style.chart.grid.scale.ticks) : nt(t > 0 ? 0 : t, a < 0 ? 0 : a, e.value.style.chart.grid.scale.ticks);
      return l.ticks.map((u) => ({
        zero: i.value.bottom - i.value.height * (Math.abs(l.min) / (l.max + Math.abs(l.min))),
        y: i.value.bottom - i.value.height * ((u + Math.abs(l.min)) / (l.max + Math.abs(l.min))),
        x: i.value.left - 8,
        horizontal_zero: i.value.left + i.value.width * (Math.abs(l.min) / (l.max + Math.abs(l.min))),
        horizontal_x: i.value.left + i.value.width * ((u + Math.abs(l.min)) / (l.max + Math.abs(l.min))),
        horizontal_y: i.value.bottom - 8,
        value: u
      }));
    }), A = w(() => {
      const a = [];
      for (let r = 0; r < P.value; r += 1)
        a.push({
          text: e.value.style.chart.grid.x.timeLabels.values[r] || String(r),
          absoluteIndex: r
        });
      return a.slice(c.value.start, c.value.end);
    }), k = w(() => {
      if (!G.value) return [];
      let a = Array(P.value).fill(0), r = Array(P.value).fill(0), t = Array(P.value).fill(0), l = Array(P.value).fill(0);
      const u = Math.max(...se.value.positive) || 0, n = Math.min(...se.value.negative), C = [-1 / 0, 1 / 0, NaN, void 0, null].includes(n) ? 0 : n, E = !e.value.style.chart.bars.distributed && (e.value.style.chart.grid.scale.scaleMax !== null || e.value.style.chart.grid.scale.scaleMin !== null) ? it(e.value.style.chart.grid.scale.scaleMin !== null ? e.value.style.chart.grid.scale.scaleMin : C > 0 ? 0 : C, e.value.style.chart.grid.scale.scaleMax !== null ? e.value.style.chart.grid.scale.scaleMax : u < 0 ? 0 : u, e.value.style.chart.grid.scale.ticks) : nt(e.value.style.chart.grid.scale.scaleMin !== null ? e.value.style.chart.grid.scale.scaleMin : C > 0 ? 0 : C, e.value.style.chart.grid.scale.scaleMax !== null ? e.value.style.chart.grid.scale.scaleMax : u < 0 ? 0 : u, e.value.style.chart.grid.scale.ticks), { min: H, max: j } = E, W = j + (H >= 0 ? 0 : Math.abs(H)) || 1, $ = i.value.height, ce = i.value.width, et = N.value[0] ? N.value[0].zero : i.value.bottom, tt = N.value[0] ? N.value[0].horizontal_zero : i.value.left;
      return R.value.filter((ee) => !L.value.includes(ee.id)).map((ee) => {
        const I = ee.series.slice(c.value.start, c.value.end), $t = ee.signedSeries.slice(c.value.start, c.value.end), St = I.map((m, p) => i.value.left + d.value * p + d.value * e.value.style.chart.bars.gapRatio / 4), Mt = I.map((m, p) => i.value.top + d.value * p + d.value * e.value.style.chart.bars.gapRatio / 4), Tt = I.map((m, p) => {
          const M = e.value.style.chart.bars.distributed ? (m || 0) / Q.value[p] : (m || 0) / W;
          let B, T;
          return m > 0 ? (T = $ * M, B = et - T - a[p], a[p] += T) : (T = $ * M, B = et + t[p], t[p] += Math.abs(T)), B;
        }), Nt = I.map((m, p) => {
          const M = e.value.style.chart.bars.distributed ? (m || 0) / Q.value[p] : (m || 0) / W;
          let B, T;
          return m > 0 ? (T = ce * M, B = tt + r[p], r[p] += T) : (T = ce * M, B = tt - Math.abs(T) - l[p], l[p] += Math.abs(T)), B;
        }), It = I.map((m, p) => {
          const M = e.value.style.chart.bars.distributed ? (m || 0) / Q.value[p] : (m || 0) / W;
          return m > 0 ? $ * M : $ * Math.abs(M);
        }), Ot = I.map((m, p) => {
          const M = e.value.style.chart.bars.distributed ? (m || 0) / Q.value[p] : (m || 0) / W;
          return m > 0 ? ce * M : ce * Math.abs(M);
        }), Rt = I.map((m) => Math.abs(m)).reduce((m, p) => m + p, 0);
        return {
          ...ee,
          proportions: I.map((m, p) => e.value.style.chart.bars.distributed ? (m || 0) / Q.value[p] : (m || 0) / Rt),
          series: I,
          signedSeries: $t,
          x: St,
          y: Tt,
          height: It,
          horizontal_width: Ot,
          horizontal_y: Mt,
          horizontal_x: Nt
        };
      });
    }), We = w(() => wt.value.map((a, r) => ({
      value: a,
      sign: a >= 0 ? 1 : -1
    })));
    function ie(a, r, t, l, u) {
      const n = u === -1 && a >= 0 ? -a : a;
      return ht(
        e.value.style.chart.bars.dataLabels.formatter,
        n,
        X({
          p: e.value.style.chart.bars.dataLabels.prefix,
          v: n,
          s: e.value.style.chart.bars.dataLabels.suffix,
          r: e.value.style.chart.bars.dataLabels.rounding
        }),
        { datapoint: r, seriesIndex: t, datapointIndex: l }
      );
    }
    function Be(a, r, t, l) {
      return ht(
        e.value.style.chart.bars.dataLabels.formatter,
        a,
        X({
          v: isNaN(a) ? 0 : a,
          s: "%",
          r: e.value.style.chart.bars.dataLabels.rounding
        }),
        { datapoint: r, seriesIndex: t, datapointIndex: l }
      );
    }
    function Ue(a) {
      const r = JSON.parse(JSON.stringify(k.value)).map((t) => ({
        name: t.name,
        value: t.series[a] === 0 ? 0 : t.series[a] || null,
        proportion: t.proportions[a] || null,
        color: t.color,
        id: t.id
      }));
      fe("selectDatapoint", { datapoint: r, period: A.value[a] });
    }
    function Ye(a) {
      K.value = a, le.value = !0;
      const r = e.value.style.chart.tooltip.customFormat, t = JSON.parse(JSON.stringify(k.value)).map((u) => ({
        name: u.name,
        absoluteIndex: u.absoluteIndex,
        value: u.series[a] === 0 ? 0 : (u.signedSeries[a] === -1 && u.series[a] >= 0 ? -u.series[a] : u.series[a]) || null,
        proportion: u.proportions[a] || null,
        color: u.color,
        id: u.id
      }));
      me.value = {
        datapoint: t,
        seriesIndex: a,
        config: e.value,
        series: k.value
      };
      const l = t.map((u) => Math.abs(u.value)).reduce((u, n) => u + n, 0);
      if (ct(r) && Jt(() => r({
        seriesIndex: a,
        datapoint: t,
        series: k.value,
        config: e.value
      })))
        pe.value = r({
          seriesIndex: a,
          datapoint: t,
          series: k.value,
          config: e.value
        });
      else {
        const {
          showValue: u,
          showPercentage: n,
          borderColor: C,
          roundingValue: E,
          roundingPercentage: H
        } = e.value.style.chart.tooltip;
        let j = "";
        A.value[a] && A.value[a].text && e.value.style.chart.tooltip.showTimeLabel && (j += `<div style="width:100%;text-align:center;border-bottom:1px solid ${C};padding-bottom:6px;margin-bottom:3px;">${A.value[a].text}</div>`);
        const W = [
          u && n ? "(" : "",
          u && n ? ")" : ""
        ];
        t.reverse().forEach(($) => {
          j += `
                <div style="display:flex;flex-direction:row;align-items:center;gap:4px">
                    <svg viewBox="0 0 60 60" height="14" width="14"><rect rx="5" x="0" y="0" height="60" width="60" stroke="none" fill="${e.value.style.chart.bars.gradient.show ? `url(#gradient_${$.id})` : $.color}"/>${bt.pattern ? `<rect rx="5" x="0" y="0" height="60" width="60" stroke="none" fill="url(#pattern_${O.value}_${$.absoluteIndex})"/>` : ""}</svg>
                    ${$.name}${u || n ? ":" : ""} ${u ? X({
            p: e.value.style.chart.bars.dataLabels.prefix,
            v: $.value,
            s: e.value.style.chart.bars.dataLabels.suffix,
            r: E
          }) : ""} ${W[0]}${n ? X({
            v: isNaN($.value / l) ? 0 : Math.abs($.value) / l * 100,
            // Negs are absed to show relative proportion to absolute total. It's opinionated.
            s: "%",
            r: H
          }) : ""}${W[1]}
                </div>
            `;
        }), pe.value = `<div>${j}</div>`;
      }
    }
    function _t(a) {
      re.value = a, ze.value += 1;
    }
    function Xe() {
      _.value.showTable = !_.value.showTable;
    }
    function Ge() {
      _.value.dataLabels.show = !_.value.dataLabels.show;
    }
    function Je() {
      _.value.showTooltip = !_.value.showTooltip;
    }
    function zt() {
      return k.value;
    }
    const qe = w(() => {
      if (k.value.length === 0) return { head: [], body: [], config: {}, columnNames: [] };
      const a = k.value.map(({ name: t, color: l }) => ({
        label: t,
        color: l
      })), r = [];
      for (let t = c.value.start; t < c.value.end; t += 1) {
        const l = [e.value.style.chart.grid.x.timeLabels.values[t] || t + 1];
        R.value.forEach((u) => {
          l.push(Number((u.series[t] || 0).toFixed(e.value.table.td.roundingValue)));
        }), r.push(l);
      }
      return { head: a, body: r };
    });
    function Ze() {
      const a = [[e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [""]], r = ["", ...qe.value.head.map((n) => n.label)], t = qe.value.body, l = a.concat([r]).concat(t), u = Xt(l);
      Gt({ csvContent: u, title: e.value.style.chart.title.text || "vue-ui-stackbar" });
    }
    const ne = w(() => {
      const a = [""].concat(k.value.map((u) => u.name)).concat(' <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>');
      let r = [];
      for (let u = 0; u < P.value; u += 1) {
        const n = k.value.map((C) => C.series[u] ?? 0).reduce((C, E) => C + E, 0);
        r.push([e.value.style.chart.grid.x.timeLabels.values.slice(c.value.start, c.value.end)[u] ?? u + 1].concat(k.value.map((C) => (C.series[u] ?? 0).toFixed(e.value.table.td.roundingValue))).concat((n ?? 0).toFixed(e.value.table.td.roundingValue)));
      }
      const t = {
        th: {
          backgroundColor: e.value.table.th.backgroundColor,
          color: e.value.table.th.color,
          outline: e.value.table.th.outline
        },
        td: {
          backgroundColor: e.value.table.td.backgroundColor,
          color: e.value.table.td.color,
          outline: e.value.table.td.outline
        },
        breakpoint: e.value.table.responsiveBreakpoint
      }, l = [e.value.table.columnNames.period].concat(k.value.map((u) => u.name)).concat(e.value.table.columnNames.total);
      return { head: a, body: r.slice(0, c.value.end - c.value.start), config: t, colNames: l };
    });
    function Ct(a, r) {
      if (fe("selectLegend", k.value.find((t) => t.absoluteIndex === a)), L.value.includes(r.id))
        L.value = L.value.filter((t) => t !== r.id);
      else {
        if (L.value.length === R.value.length - 1) return;
        L.value.push(r.id);
      }
    }
    const Ke = w(() => R.value.map((a, r) => ({
      ...a,
      shape: "square"
    })).map((a) => ({
      ...a,
      opacity: L.value.includes(a.id) ? 0.5 : 1,
      segregate: () => Ct(a.absoluteIndex, a),
      isSegregated: L.value.includes(a.id)
    }))), Lt = w(() => ({
      cy: "stackbar-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" : ""
    })), ue = g(!1);
    function we() {
      ue.value = !ue.value;
    }
    function Qe(a, r) {
      const t = JSON.parse(JSON.stringify(k.value)).map((l) => ({
        name: l.name,
        value: l.series[r] === 0 ? 0 : (l.signedSeries[r] === -1 && l.series[r] >= 0 ? -l.series[r] : l.series[r]) || null,
        proportion: l.proportions[r] || null,
        color: l.color,
        id: l.id
      }));
      fe("selectTimeLabel", {
        datapoint: t,
        absoluteIndex: a.absoluteIndex,
        label: a.text
      });
    }
    function je(a, r) {
      return e.value.style.chart.bars.showDistributedPercentage && e.value.style.chart.bars.distributed ? e.value.style.chart.bars.dataLabels.hideEmptyPercentages ? r > 0 : !0 : e.value.style.chart.bars.dataLabels.hideEmptyValues ? a !== 0 : !0;
    }
    return dt({
      getData: zt,
      generatePdf: Ae,
      generateCsv: Ze,
      generateImage: Ve,
      toggleTable: Xe,
      toggleLabels: Ge,
      toggleTooltip: Je,
      toggleAnnotator: we
    }), (a, r) => (o(), s("div", {
      id: `stackbar_${O.value}`,
      ref_key: "stackbarChart",
      ref: Z,
      class: te({ "vue-ui-stackbar": !0, "vue-data-ui-wrapper-fullscreen": re.value }),
      style: U(`background:${e.value.style.chart.backgroundColor};color:${e.value.style.chart.color};font-family:${e.value.style.fontFamily}; position: relative; ${e.value.responsive ? "height: 100%" : ""}`),
      onMouseenter: r[6] || (r[6] = () => b(Te)(!0)),
      onMouseleave: r[7] || (r[7] = () => b(Te)(!1))
    }, [
      e.value.userOptions.buttons.annotator ? (o(), q(ia, {
        key: 0,
        svgRef: b(Ie),
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        active: ue.value,
        onClose: we
      }, null, 8, ["svgRef", "backgroundColor", "color", "active"])) : v("", !0),
      x(a.$slots, "userConfig", {}, void 0, !0),
      e.value.style.chart.title.text ? (o(), s("div", {
        key: 1,
        ref_key: "chartTitle",
        ref: Ce,
        style: "width:100%;background:transparent;padding-bottom:24px"
      }, [
        ae(ta, {
          config: {
            title: {
              cy: "stackbar-title",
              ...e.value.style.chart.title
            },
            subtitle: {
              cy: "stackbar-subtitle",
              ...e.value.style.chart.title.subtitle
            }
          }
        }, null, 8, ["config"])
      ], 512)) : v("", !0),
      e.value.userOptions.show && G.value && (b(Ne) || b(xe)) ? (o(), q(Qt, {
        ref: "details",
        key: `user_option_${ze.value}`,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        isPrinting: b(Re),
        isImaging: b(Pe),
        uid: O.value,
        hasTooltip: e.value.style.chart.tooltip.show && e.value.userOptions.buttons.tooltip,
        hasPdf: e.value.userOptions.buttons.pdf,
        hasImg: e.value.userOptions.buttons.img,
        hasXls: e.value.userOptions.buttons.csv,
        hasTable: e.value.userOptions.buttons.table,
        hasLabel: e.value.userOptions.buttons.labels,
        hasFullscreen: e.value.userOptions.buttons.fullscreen,
        isFullscreen: re.value,
        chartElement: Z.value,
        position: e.value.userOptions.position,
        isTooltip: _.value.showTooltip,
        titles: { ...e.value.userOptions.buttonTitles },
        hasAnnotator: e.value.userOptions.buttons.annotator,
        isAnnotation: ue.value,
        onToggleFullscreen: _t,
        onGeneratePdf: b(Ae),
        onGenerateCsv: Ze,
        onGenerateImage: b(Ve),
        onToggleTable: Xe,
        onToggleLabels: Ge,
        onToggleTooltip: Je,
        onToggleAnnotator: we,
        style: U({
          visibility: b(Ne) ? b(xe) ? "visible" : "hidden" : "visible"
        })
      }, rt({ _: 2 }, [
        a.$slots.menuIcon ? {
          name: "menuIcon",
          fn: z(({ isOpen: t, color: l }) => [
            x(a.$slots, "menuIcon", V(F({ isOpen: t, color: l })), void 0, !0)
          ]),
          key: "0"
        } : void 0,
        a.$slots.optionTooltip ? {
          name: "optionTooltip",
          fn: z(() => [
            x(a.$slots, "optionTooltip", {}, void 0, !0)
          ]),
          key: "1"
        } : void 0,
        a.$slots.optionPdf ? {
          name: "optionPdf",
          fn: z(() => [
            x(a.$slots, "optionPdf", {}, void 0, !0)
          ]),
          key: "2"
        } : void 0,
        a.$slots.optionCsv ? {
          name: "optionCsv",
          fn: z(() => [
            x(a.$slots, "optionCsv", {}, void 0, !0)
          ]),
          key: "3"
        } : void 0,
        a.$slots.optionImg ? {
          name: "optionImg",
          fn: z(() => [
            x(a.$slots, "optionImg", {}, void 0, !0)
          ]),
          key: "4"
        } : void 0,
        a.$slots.optionTable ? {
          name: "optionTable",
          fn: z(() => [
            x(a.$slots, "optionTable", {}, void 0, !0)
          ]),
          key: "5"
        } : void 0,
        a.$slots.optionLabels ? {
          name: "optionLabels",
          fn: z(() => [
            x(a.$slots, "optionLabels", {}, void 0, !0)
          ]),
          key: "6"
        } : void 0,
        a.$slots.optionFullscreen ? {
          name: "optionFullscreen",
          fn: z(({ toggleFullscreen: t, isFullscreen: l }) => [
            x(a.$slots, "optionFullscreen", V(F({ toggleFullscreen: t, isFullscreen: l })), void 0, !0)
          ]),
          key: "7"
        } : void 0,
        a.$slots.optionAnnotator ? {
          name: "optionAnnotator",
          fn: z(({ toggleAnnotator: t, isAnnotator: l }) => [
            x(a.$slots, "optionAnnotator", V(F({ toggleAnnotator: t, isAnnotator: l })), void 0, !0)
          ]),
          key: "8"
        } : void 0
      ]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasTooltip", "hasPdf", "hasImg", "hasXls", "hasTable", "hasLabel", "hasFullscreen", "isFullscreen", "chartElement", "position", "isTooltip", "titles", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage", "style"])) : v("", !0),
      G.value ? (o(), s("svg", {
        key: 3,
        ref_key: "svgRef",
        ref: Ie,
        xmlns: b(Ut),
        viewBox: `0 0 ${i.value.chartWidth <= 0 ? 10 : i.value.chartWidth} ${i.value.chartHeight <= 0 ? 10 : i.value.chartHeight}`,
        style: U(`max-width:100%;overflow:visible;background:transparent;color:${e.value.style.chart.color}`)
      }, [
        ae(sa),
        a.$slots["chart-background"] ? (o(), s("foreignObject", {
          key: 0,
          x: i.value.left,
          y: i.value.top,
          width: i.value.width <= 0 ? 10 : i.value.width,
          height: i.value.height <= 0 ? 10 : i.value.height,
          style: {
            pointerEvents: "none"
          }
        }, [
          x(a.$slots, "chart-background", {}, void 0, !0)
        ], 8, ya)) : v("", !0),
        e.value.style.chart.bars.gradient.show ? (o(), s("defs", ga, [
          (o(!0), s(h, null, y(k.value, (t, l) => (o(), s("linearGradient", {
            id: `gradient_${t.id}`,
            x1: "0%",
            y1: "0%",
            x2: "0%",
            y2: "100%"
          }, [
            Y("stop", {
              offset: "0%",
              "stop-color": t.color
            }, null, 8, fa),
            Y("stop", {
              offset: "61.8%",
              "stop-color": b(Yt)(t.color, e.value.style.chart.bars.gradient.intensity / 100)
            }, null, 8, ma),
            Y("stop", {
              offset: "100%",
              "stop-color": t.color
            }, null, 8, pa)
          ], 8, ba))), 256))
        ])) : v("", !0),
        e.value.style.chart.grid.x.showHorizontalLines && e.value.orientation === "vertical" ? (o(!0), s(h, { key: 2 }, y(N.value, (t, l) => (o(), s("line", {
          x1: i.value.left,
          x2: i.value.right,
          y1: t.y,
          y2: t.y,
          stroke: e.value.style.chart.grid.x.axisColor,
          "stroke-width": 1,
          "stroke-linecap": "round"
        }, null, 8, xa))), 256)) : v("", !0),
        e.value.style.chart.grid.x.showHorizontalLines && e.value.orientation === "horizontal" ? (o(!0), s(h, { key: 3 }, y(c.value.end - c.value.start + 1, (t, l) => (o(), s("line", {
          x1: i.value.left,
          x2: i.value.right,
          y1: i.value.top + d.value * l,
          y2: i.value.top + d.value * l,
          stroke: e.value.style.chart.grid.y.axisColor,
          "stroke-width": 1,
          "stroke-linecap": "round"
        }, null, 8, ka))), 256)) : v("", !0),
        e.value.style.chart.grid.y.showVerticalLines && e.value.orientation === "vertical" ? (o(!0), s(h, { key: 4 }, y(c.value.end - c.value.start + 1, (t, l) => (o(), s("line", {
          x1: i.value.left + d.value * l,
          x2: i.value.left + d.value * l,
          y1: i.value.top,
          y2: i.value.bottom,
          stroke: e.value.style.chart.grid.y.axisColor,
          "stroke-width": 1,
          "stroke-linecap": "round"
        }, null, 8, wa))), 256)) : v("", !0),
        e.value.style.chart.grid.x.showHorizontalLines && e.value.orientation === "horizontal" ? (o(!0), s(h, { key: 5 }, y(N.value, (t, l) => (o(), s("line", {
          x1: t.horizontal_x,
          x2: t.horizontal_x,
          y1: i.value.top,
          y2: i.value.bottom,
          stroke: e.value.style.chart.grid.x.axisColor,
          "stroke-width": 1,
          "stroke-linecap": "round"
        }, null, 8, _a))), 256)) : v("", !0),
        (o(!0), s(h, null, y(k.value, (t, l) => (o(), s("g", null, [
          a.$slots.pattern ? (o(), s("defs", za, [
            x(a.$slots, "pattern", _e({ ref_for: !0 }, { seriesIndex: t.absoluteIndex, patternId: `pattern_${O.value}_${t.absoluteIndex}` }), void 0, !0)
          ])) : v("", !0),
          e.value.orientation === "vertical" ? (o(), s(h, { key: 1 }, [
            (o(!0), s(h, null, y(t.x, (u, n) => (o(), s("rect", {
              x: u,
              y: t.y[n] < 0 ? 0 : t.y[n],
              height: t.height[n] < 0 ? 1e-4 : t.height[n] || 0,
              rx: e.value.style.chart.bars.borderRadius > t.height[n] / 2 ? (t.height[n] < 0 ? 0 : t.height[n]) / 2 : e.value.style.chart.bars.borderRadius,
              width: d.value * (1 - e.value.style.chart.bars.gapRatio / 2),
              fill: e.value.style.chart.bars.gradient.show ? `url(#gradient_${t.id})` : t.color,
              stroke: e.value.style.chart.backgroundColor,
              "stroke-width": e.value.style.chart.bars.strokeWidth,
              "stroke-linecap": "round",
              "stroke-linejoin": "round",
              class: te({ "vue-data-ui-bar-animated": e.value.useCssAnimation, "vue-data-ui-bar-transition": D.value })
            }, null, 10, Ca))), 256)),
            a.$slots.pattern ? (o(), s("g", La, [
              (o(!0), s(h, null, y(t.x, (u, n) => (o(), s("rect", {
                x: u,
                y: t.y[n] < 0 ? 0 : t.y[n],
                height: t.height[n] < 0 ? 1e-4 : t.height[n] || 0,
                rx: e.value.style.chart.bars.borderRadius > t.height[n] / 2 ? (t.height[n] < 0 ? 0 : t.height[n]) / 2 : e.value.style.chart.bars.borderRadius,
                width: d.value * (1 - e.value.style.chart.bars.gapRatio / 2),
                fill: `url(#pattern_${O.value}_${t.absoluteIndex})`,
                stroke: e.value.style.chart.backgroundColor,
                "stroke-width": e.value.style.chart.bars.strokeWidth,
                "stroke-linecap": "round",
                "stroke-linejoin": "round",
                class: te({ "vue-data-ui-bar-animated": e.value.useCssAnimation, "vue-data-ui-bar-transition": D.value })
              }, null, 10, $a))), 256))
            ])) : v("", !0)
          ], 64)) : (o(), s(h, { key: 2 }, [
            (o(!0), s(h, null, y(t.horizontal_x, (u, n) => (o(), s("rect", {
              x: b(ge)(u, i.value.left),
              y: t.horizontal_y[n] < 0 ? 0 : t.horizontal_y[n],
              width: b(ge)(t.horizontal_width[n] < 0 ? 1e-4 : t.horizontal_width[n]),
              rx: e.value.style.chart.bars.borderRadius > t.height[n] / 2 ? (t.height[n] < 0 ? 0 : t.height[n]) / 2 : e.value.style.chart.bars.borderRadius,
              height: d.value * (1 - e.value.style.chart.bars.gapRatio / 2),
              fill: e.value.style.chart.bars.gradient.show ? `url(#gradient_${t.id})` : t.color,
              stroke: e.value.style.chart.backgroundColor,
              "stroke-width": e.value.style.chart.bars.strokeWidth,
              "stroke-linecap": "round",
              "stroke-linejoin": "round",
              class: te({ "vue-data-ui-bar-animated": e.value.useCssAnimation, "vue-data-ui-bar-transition": D.value })
            }, null, 10, Sa))), 256)),
            a.$slots.pattern ? (o(), s("g", Ma, [
              (o(!0), s(h, null, y(t.horizontal_x, (u, n) => (o(), s("rect", {
                x: b(ge)(u, i.value.left),
                y: t.horizontal_y[n] < 0 ? 0 : t.horizontal_y[n],
                width: b(ge)(t.horizontal_width[n] < 0 ? 1e-4 : t.horizontal_width[n]),
                rx: e.value.style.chart.bars.borderRadius > t.height[n] / 2 ? (t.height[n] < 0 ? 0 : t.height[n]) / 2 : e.value.style.chart.bars.borderRadius,
                height: d.value * (1 - e.value.style.chart.bars.gapRatio / 2),
                fill: `url(#pattern_${O.value}_${t.absoluteIndex})`,
                stroke: e.value.style.chart.backgroundColor,
                "stroke-width": e.value.style.chart.bars.strokeWidth,
                "stroke-linecap": "round",
                "stroke-linejoin": "round",
                class: te({ "vue-data-ui-bar-animated": e.value.useCssAnimation, "vue-data-ui-bar-transition": D.value })
              }, null, 10, Ta))), 256))
            ])) : v("", !0)
          ], 64))
        ]))), 256)),
        e.value.style.chart.grid.x.showAxis ? (o(), s("line", {
          key: 6,
          x1: i.value.left,
          x2: i.value.right,
          y1: i.value.bottom,
          y2: i.value.bottom,
          stroke: e.value.style.chart.grid.x.axisColor,
          "stroke-width": e.value.style.chart.grid.x.axisThickness,
          "stroke-linecap": "round",
          "stroke-linejoin": "round"
        }, null, 8, Na)) : v("", !0),
        e.value.style.chart.grid.y.showAxis && !e.value.style.chart.bars.distributed ? (o(), s("line", {
          key: 7,
          x1: i.value.left,
          x2: i.value.left,
          y1: i.value.top,
          y2: i.value.bottom,
          stroke: e.value.style.chart.grid.y.axisColor,
          "stroke-width": e.value.style.chart.grid.y.axisThickness,
          "stroke-linecap": "round",
          "stroke-linejoin": "round"
        }, null, 8, Ia)) : v("", !0),
        e.value.style.chart.grid.x.axisName.show && e.value.style.chart.grid.x.axisName.text ? (o(), s("text", {
          key: 8,
          x: i.value.left + i.value.width / 2,
          y: i.value.chartHeight + e.value.style.chart.grid.x.axisName.offsetY,
          "font-size": e.value.style.chart.grid.x.axisName.fontSize,
          fill: e.value.style.chart.grid.x.axisName.color,
          "font-weight": e.value.style.chart.grid.x.axisName.bold ? "bold" : "normal",
          "text-anchor": "middle"
        }, S(e.value.style.chart.grid.x.axisName.text), 9, Oa)) : v("", !0),
        e.value.style.chart.grid.y.axisName.show && e.value.style.chart.grid.y.axisName.text ? (o(), s("text", {
          key: 9,
          transform: `translate(${e.value.style.chart.grid.y.axisName.fontSize + e.value.style.chart.grid.y.axisName.offsetX}, ${i.value.top + i.value.height / 2}) rotate(-90)`,
          "font-size": e.value.style.chart.grid.y.axisName.fontSize,
          fill: e.value.style.chart.grid.y.axisName.color,
          "font-weight": e.value.style.chart.grid.y.axisName.bold ? "bold" : "normal",
          "text-anchor": "middle"
        }, S(e.value.style.chart.grid.y.axisName.text), 9, Ra)) : v("", !0),
        _.value.dataLabels.show && e.value.orientation === "vertical" ? (o(), s(h, { key: 10 }, [
          (o(!0), s(h, null, y(k.value, (t, l) => (o(), s("g", null, [
            (o(!0), s(h, null, y(t.x, (u, n) => (o(), s(h, null, [
              je(t.series[n], t.proportions[n]) ? (o(), s("text", {
                key: 0,
                x: u + d.value * (1 - e.value.style.chart.bars.gapRatio / 2) / 2,
                y: t.y[n] + t.height[n] / 2 + e.value.style.chart.bars.dataLabels.fontSize / 3,
                "font-size": e.value.style.chart.bars.dataLabels.fontSize,
                fill: e.value.style.chart.bars.dataLabels.adaptColorToBackground ? b(ut)(t.color) : e.value.style.chart.bars.dataLabels.color,
                "font-weight": e.value.style.chart.bars.dataLabels.bold ? "bold" : "normal",
                "text-anchor": "middle"
              }, S(e.value.style.chart.bars.showDistributedPercentage && e.value.style.chart.bars.distributed ? Be(t.proportions[n] * 100, t, l, n) : ie(t.series[n], t, l, n, t.signedSeries[n])), 9, Pa)) : v("", !0)
            ], 64))), 256))
          ]))), 256)),
          e.value.style.chart.bars.totalValues.show && k.value.length > 1 ? (o(), s("g", Aa, [
            (o(!0), s(h, null, y(We.value, (t, l) => (o(), s(h, null, [
              !e.value.style.chart.bars.dataLabels.hideEmptyValues || t.value !== 0 ? (o(), s("text", {
                key: 0,
                x: i.value.left + d.value * l + d.value / 2,
                y: i.value.top - e.value.style.chart.bars.totalValues.fontSize / 3,
                "text-anchor": "middle",
                "font-size": e.value.style.chart.bars.totalValues.fontSize,
                "font-weight": e.value.style.chart.bars.totalValues.bold ? "bold" : "normal",
                fill: e.value.style.chart.bars.totalValues.color
              }, S(ie(t.value, t, l, t.sign)), 9, Va)) : v("", !0)
            ], 64))), 256))
          ])) : v("", !0)
        ], 64)) : v("", !0),
        _.value.dataLabels.show && e.value.orientation === "horizontal" ? (o(), s(h, { key: 11 }, [
          (o(!0), s(h, null, y(k.value, (t, l) => (o(), s("g", null, [
            (o(!0), s(h, null, y(t.horizontal_x, (u, n) => (o(), s(h, null, [
              je(t.series[n], t.proportions[n]) ? (o(), s("text", {
                key: 0,
                x: u + (t.horizontal_width[n] < 0 ? 1e-4 : t.horizontal_width[n]) / 2,
                y: t.horizontal_y[n] + d.value * (1 - e.value.style.chart.bars.gapRatio / 2) / 2 + e.value.style.chart.bars.dataLabels.fontSize / 3,
                "font-size": e.value.style.chart.bars.dataLabels.fontSize,
                fill: e.value.style.chart.bars.dataLabels.adaptColorToBackground ? b(ut)(t.color) : e.value.style.chart.bars.dataLabels.color,
                "font-weight": e.value.style.chart.bars.dataLabels.bold ? "bold" : "normal",
                "text-anchor": "middle"
              }, S(e.value.style.chart.bars.showDistributedPercentage && e.value.style.chart.bars.distributed ? Be(t.proportions[n] * 100, t, l, n) : ie(t.series[n], t, l, n, t.signedSeries[n])), 9, Fa)) : v("", !0)
            ], 64))), 256))
          ]))), 256)),
          e.value.style.chart.bars.totalValues.show && k.value.length > 1 ? (o(), s("g", Da, [
            (o(!0), s(h, null, y(We.value, (t, l) => (o(), s(h, null, [
              !e.value.style.chart.bars.dataLabels.hideEmptyValues || t.value !== 0 ? (o(), s("text", {
                key: 0,
                x: i.value.right + e.value.style.chart.bars.totalValues.fontSize / 3,
                y: i.value.top + d.value * l + d.value / 2,
                "text-anchor": "start",
                "font-size": e.value.style.chart.bars.totalValues.fontSize,
                "font-weight": e.value.style.chart.bars.totalValues.bold ? "bold" : "normal",
                fill: e.value.style.chart.bars.totalValues.color
              }, S(ie(t.value, t, l, t.sign)), 9, Ea)) : v("", !0)
            ], 64))), 256))
          ])) : v("", !0)
        ], 64)) : v("", !0),
        e.value.style.chart.grid.y.axisLabels.show && !e.value.style.chart.bars.distributed && e.value.orientation === "vertical" ? (o(), s(h, { key: 12 }, [
          (o(!0), s(h, null, y(N.value, (t, l) => (o(), s("line", {
            x1: i.value.left,
            x2: i.value.left - 6,
            y1: t.y,
            y2: t.y,
            stroke: e.value.style.chart.grid.x.axisColor,
            "stroke-width": 1
          }, null, 8, Ha))), 256)),
          (o(!0), s(h, null, y(N.value, (t, l) => (o(), s("text", {
            x: t.x,
            y: t.y + e.value.style.chart.grid.y.axisLabels.fontSize / 3,
            "font-size": e.value.style.chart.grid.y.axisLabels.fontSize,
            "font-weight": e.value.style.chart.grid.y.axisLabels.bold ? "bold" : "normal",
            fill: e.value.style.chart.grid.y.axisLabels.color,
            "text-anchor": "end"
          }, S(b(X)({
            p: e.value.style.chart.bars.dataLabels.prefix,
            v: t.value,
            s: e.value.style.chart.bars.dataLabels.suffix,
            r: e.value.style.chart.grid.y.axisLabels.rounding
          })), 9, Wa))), 256))
        ], 64)) : v("", !0),
        e.value.style.chart.grid.y.axisLabels.show && !e.value.style.chart.bars.distributed && e.value.orientation === "horizontal" ? (o(), s(h, { key: 13 }, [
          (o(!0), s(h, null, y(N.value, (t, l) => (o(), s("line", {
            x1: t.horizontal_x,
            x2: t.horizontal_x,
            y1: i.value.bottom,
            y2: i.value.bottom + 6,
            stroke: e.value.style.chart.grid.x.axisColor,
            "stroke-width": 1,
            "stroke-linecap": "round"
          }, null, 8, Ba))), 256)),
          (o(!0), s(h, null, y(N.value, (t, l) => (o(), s("text", {
            "font-size": e.value.style.chart.grid.x.timeLabels.fontSize,
            "font-weight": e.value.style.chart.grid.y.axisLabels.bold ? "bold" : "normal",
            fill: e.value.style.chart.grid.y.axisLabels.color,
            "text-anchor": e.value.style.chart.grid.x.timeLabels.rotation > 0 ? "start" : e.value.style.chart.grid.x.timeLabels.rotation < 0 ? "end" : "middle",
            transform: `translate(${t.horizontal_x}, ${i.value.bottom + e.value.style.chart.grid.x.timeLabels.fontSize * 1.3 + e.value.style.chart.grid.x.timeLabels.offsetY}), rotate(${e.value.style.chart.grid.x.timeLabels.rotation})`
          }, S(b(X)({
            p: e.value.style.chart.bars.dataLabels.prefix,
            v: t.value,
            s: e.value.style.chart.bars.dataLabels.suffix,
            r: e.value.style.chart.grid.y.axisLabels.rounding
          })), 9, Ua))), 256))
        ], 64)) : v("", !0),
        e.value.style.chart.grid.x.timeLabels.show && e.value.orientation === "vertical" ? (o(), s(h, { key: 14 }, [
          a.$slots["time-label"] ? (o(), s("g", Ya, [
            (o(!0), s(h, null, y(A.value, (t, l) => (o(), s("g", null, [
              x(a.$slots, "time-label", _e({ ref_for: !0 }, {
                x: i.value.left + d.value * l + d.value / 2,
                y: i.value.bottom + e.value.style.chart.grid.x.timeLabels.fontSize * 1.3 + e.value.style.chart.grid.x.timeLabels.offsetY,
                fontSize: e.value.style.chart.grid.x.timeLabels.fontSize,
                fill: e.value.style.chart.grid.x.timeLabels.color,
                transform: `translate(${i.value.left + d.value * l + d.value / 2}, ${i.value.bottom + e.value.style.chart.grid.x.timeLabels.fontSize * 1.3 + e.value.style.chart.grid.x.timeLabels.offsetY}), rotate(${e.value.style.chart.grid.x.timeLabels.rotation})`,
                absoluteIndex: t.absoluteIndex,
                content: t.text,
                textAnchor: e.value.style.chart.grid.x.timeLabels.rotation > 0 ? "start" : e.value.style.chart.grid.x.timeLabels.rotation < 0 ? "end" : "middle",
                show: !0
              }), void 0, !0)
            ]))), 256))
          ])) : (o(), s("g", Xa, [
            (o(!0), s(h, null, y(A.value, (t, l) => (o(), s("text", {
              "text-anchor": e.value.style.chart.grid.x.timeLabels.rotation > 0 ? "start" : e.value.style.chart.grid.x.timeLabels.rotation < 0 ? "end" : "middle",
              "font-size": e.value.style.chart.grid.x.timeLabels.fontSize,
              "font-weight": e.value.style.chart.grid.x.timeLabels.bold ? "bold" : "normal",
              fill: e.value.style.chart.grid.x.timeLabels.color,
              transform: `translate(${i.value.left + d.value * l + d.value / 2}, ${i.value.bottom + e.value.style.chart.grid.x.timeLabels.fontSize * 1.3 + e.value.style.chart.grid.x.timeLabels.offsetY}), rotate(${e.value.style.chart.grid.x.timeLabels.rotation})`,
              style: {
                cursor: "pointer"
              },
              onClick: () => Qe(t, l)
            }, S(t.text), 9, Ga))), 256))
          ]))
        ], 64)) : v("", !0),
        e.value.style.chart.grid.x.timeLabels.show && e.value.orientation === "horizontal" ? (o(), s(h, { key: 15 }, [
          a.$slots["time-label"] ? (o(), s("g", Ja, [
            (o(!0), s(h, null, y(A.value, (t, l) => (o(), s("g", null, [
              x(a.$slots, "time-label", _e({ ref_for: !0 }, {
                x: i.value.left - 8,
                y: i.value.top + d.value * l + d.value / 2 + e.value.style.chart.grid.y.axisLabels.fontSize / 3,
                fontSize: e.value.style.chart.grid.x.timeLabels.fontSize,
                fill: e.value.style.chart.grid.x.timeLabels.color,
                transform: null,
                absoluteIndex: t.absoluteIndex,
                content: t.text,
                textAnchor: "end",
                show: !0
              }), void 0, !0)
            ]))), 256))
          ])) : (o(), s("g", qa, [
            (o(!0), s(h, null, y(A.value, (t, l) => (o(), s("text", {
              "text-anchor": "end",
              "font-size": e.value.style.chart.grid.y.axisLabels.fontSize,
              "font-weight": e.value.style.chart.grid.y.axisLabels.bold ? "bold" : "normal",
              fill: e.value.style.chart.grid.y.axisLabels.color,
              x: i.value.left - 8,
              y: i.value.top + d.value * l + d.value / 2 + e.value.style.chart.grid.y.axisLabels.fontSize / 3,
              style: {
                cursor: "pointer"
              },
              onClick: () => Qe(t, l)
            }, S(t.text), 9, Za))), 256))
          ]))
        ], 64)) : v("", !0),
        _.value.showTooltip && e.value.orientation === "vertical" ? (o(!0), s(h, { key: 16 }, y(c.value.end - c.value.start, (t, l) => (o(), s("rect", {
          x: i.value.left + l * d.value,
          y: i.value.top,
          width: d.value,
          height: i.value.height < 0 ? 0 : i.value.height,
          onClick: (u) => Ue(l),
          onMouseenter: (u) => Ye(l),
          onMouseleave: r[0] || (r[0] = (u) => {
            K.value = null, le.value = !1;
          }),
          fill: l === K.value ? e.value.style.chart.highlighter.color : "transparent",
          style: U({ opacity: e.value.style.chart.highlighter.opacity / 100 })
        }, null, 44, Ka))), 256)) : v("", !0),
        _.value.showTooltip && e.value.orientation === "horizontal" ? (o(!0), s(h, { key: 17 }, y(c.value.end - c.value.start, (t, l) => (o(), s("rect", {
          x: i.value.left,
          y: i.value.top + l * d.value,
          width: i.value.width < 0 ? 0 : i.value.width,
          height: d.value,
          onClick: (u) => Ue(l),
          onMouseenter: (u) => Ye(l),
          onMouseleave: r[1] || (r[1] = (u) => {
            K.value = null, le.value = !1;
          }),
          fill: l === K.value ? e.value.style.chart.highlighter.color : "transparent",
          style: U({ opacity: e.value.style.chart.highlighter.opacity / 100 })
        }, null, 44, Qa))), 256)) : v("", !0),
        x(a.$slots, "svg", V(F({ ...i.value })), void 0, !0)
      ], 12, da)) : v("", !0),
      a.$slots.watermark ? (o(), s("div", ja, [
        x(a.$slots, "watermark", V(F({ isPrinting: b(Re) || b(Pe) })), void 0, !0)
      ])) : v("", !0),
      G.value ? v("", !0) : (o(), q(oa, {
        key: 5,
        config: {
          type: "bar",
          style: {
            backgroundColor: e.value.style.chart.backgroundColor,
            bar: {
              axis: {
                color: "#CCCCCC"
              },
              color: "#CCCCCC"
            }
          }
        }
      }, null, 8, ["config"])),
      Y("div", {
        ref_key: "chartSlicer",
        ref: $e,
        style: U(`width:100%;background:${e.value.style.chart.backgroundColor}`),
        "data-dom-to-png-ignore": ""
      }, [
        e.value.style.chart.zoom.show && P.value > 1 ? (o(), q(jt, {
          ref_key: "slicerComponent",
          ref: J,
          key: `slicer_${Me.value}`,
          background: e.value.style.chart.zoom.color,
          borderColor: e.value.style.chart.backgroundColor,
          fontSize: e.value.style.chart.zoom.fontSize,
          useResetSlot: e.value.style.chart.zoom.useResetSlot,
          labelLeft: e.value.style.chart.grid.x.timeLabels.values[c.value.start] ? e.value.style.chart.grid.x.timeLabels.values[c.value.start] : "",
          labelRight: e.value.style.chart.grid.x.timeLabels.values[c.value.end - 1] ? e.value.style.chart.grid.x.timeLabels.values[c.value.end - 1] : "",
          textColor: e.value.style.chart.color,
          inputColor: e.value.style.chart.zoom.color,
          selectColor: e.value.style.chart.zoom.highlightColor,
          max: Math.max(...be.dataset.map((t) => t.series.length)),
          min: 0,
          valueStart: c.value.start,
          valueEnd: c.value.end,
          start: c.value.start,
          "onUpdate:start": r[2] || (r[2] = (t) => c.value.start = t),
          end: c.value.end,
          "onUpdate:end": r[3] || (r[3] = (t) => c.value.end = t),
          refreshStartPoint: e.value.style.chart.zoom.startIndex !== null ? e.value.style.chart.zoom.startIndex : 0,
          refreshEndPoint: e.value.style.chart.zoom.endIndex !== null ? e.value.style.chart.zoom.endIndex + 1 : Math.max(...be.dataset.map((t) => t.series.length)),
          enableRangeHandles: e.value.style.chart.zoom.enableRangeHandles,
          enableSelectionDrag: e.value.style.chart.zoom.enableSelectionDrag,
          onReset: Ee
        }, {
          "reset-action": z(({ reset: t }) => [
            x(a.$slots, "reset-action", V(F({ reset: t })), void 0, !0)
          ]),
          _: 3
        }, 8, ["background", "borderColor", "fontSize", "useResetSlot", "labelLeft", "labelRight", "textColor", "inputColor", "selectColor", "max", "valueStart", "valueEnd", "start", "end", "refreshStartPoint", "refreshEndPoint", "enableRangeHandles", "enableSelectionDrag"])) : v("", !0)
      ], 4),
      ae(ea, {
        show: _.value.showTooltip && le.value,
        backgroundColor: e.value.style.chart.tooltip.backgroundColor,
        color: e.value.style.chart.tooltip.color,
        fontSize: e.value.style.chart.tooltip.fontSize,
        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: Z.value,
        content: pe.value,
        isFullscreen: re.value,
        isCustom: b(ct)(e.value.style.chart.tooltip.customFormat)
      }, {
        "tooltip-before": z(() => [
          x(a.$slots, "tooltip-before", V(F({ ...me.value })), void 0, !0)
        ]),
        "tooltip-after": z(() => [
          x(a.$slots, "tooltip-after", V(F({ ...me.value })), void 0, !0)
        ]),
        _: 3
      }, 8, ["show", "backgroundColor", "color", "fontSize", "borderRadius", "borderColor", "borderWidth", "backgroundOpacity", "position", "offsetY", "parent", "content", "isFullscreen", "isCustom"]),
      Y("div", {
        ref_key: "chartLegend",
        ref: Le
      }, [
        e.value.style.chart.legend.show && G.value ? (o(), q(aa, {
          key: 0,
          legendSet: Ke.value,
          config: Lt.value,
          onClickMarker: r[4] || (r[4] = ({ legend: t }) => t.segregate())
        }, rt({
          item: z(({ legend: t }) => [
            Y("div", {
              onClick: (l) => t.segregate(),
              style: U(`opacity:${L.value.includes(t.id) ? 0.5 : 1}`)
            }, S(t.name), 13, el)
          ]),
          _: 2
        }, [
          a.$slots.pattern ? {
            name: "legend-pattern",
            fn: z(({ legend: t, index: l }) => [
              ae(ua, {
                shape: t.shape,
                radius: 30,
                stroke: "none",
                plot: { x: 30, y: 30 },
                fill: `url(#pattern_${O.value}_${l})`
              }, null, 8, ["shape", "fill"])
            ]),
            key: "0"
          } : void 0
        ]), 1032, ["legendSet", "config"])) : x(a.$slots, "legend", {
          key: 1,
          legend: Ke.value
        }, void 0, !0)
      ], 512),
      a.$slots.source ? (o(), s("div", {
        key: 6,
        ref_key: "source",
        ref: Se,
        dir: "auto"
      }, [
        x(a.$slots, "source", {}, void 0, !0)
      ], 512)) : v("", !0),
      c.value.end - c.value.start < 200 ? (o(), q(la, {
        key: 7,
        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: z(() => [
          ae(ra, {
            colNames: ne.value.colNames,
            head: ne.value.head,
            body: ne.value.body,
            config: ne.value.config,
            title: `${e.value.style.chart.title.text}${e.value.style.chart.title.subtitle.text ? ` : ${e.value.style.chart.title.subtitle.text}` : ""}`,
            onClose: r[5] || (r[5] = (t) => _.value.showTable = !1)
          }, {
            th: z(({ th: t }) => [
              Y("div", { innerHTML: t }, null, 8, tl)
            ]),
            td: z(({ td: t }) => [
              At(S(isNaN(Number(t)) ? t : b(X)({
                p: e.value.style.chart.bars.dataLabels.prefix,
                v: t,
                s: e.value.style.chart.bars.dataLabels.suffix,
                r: e.value.table.td.roundingValue
              })), 1)
            ]),
            _: 1
          }, 8, ["colNames", "head", "body", "config", "title"])
        ]),
        _: 1
      }, 8, ["config"])) : v("", !0)
    ], 46, va));
  }
}, kl = /* @__PURE__ */ ha(al, [["__scopeId", "data-v-1c876490"]]);
export {
  kl as default
};
