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