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