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