import { useCssVars as nt, useSlots as ut, computed as b, ref as d, watch as Be, onMounted as st, onBeforeUnmount as rt, openBlock as u, createElementBlock as r, normalizeClass as z, normalizeStyle as c, unref as i, createBlock as A, createCommentVNode as p, createSlots as de, withCtx as k, renderSlot as m, normalizeProps as X, guardReactiveProps as E, createElementVNode as n, toDisplayString as h, createVNode as Y, Fragment as H, renderList as G, withKeys as it, createTextVNode as dt } from "vue";
import { u as vt, c as ct, t as ht, a as pt, p as B, b as yt, o as De, e as ee, v as N, d as ve, i as te, f as D, X as gt, s as ce, w as ft, x as bt, y as mt, q as _t, r as kt } from "./index-BVNcFEqn.js";
import { t as $t, u as xt } from "./useResponsive-CoxXLe23.js";
import { _ as wt } from "./Title-DyUTj8GI.js";
import { u as Ct, U as Tt } from "./usePrinter-Bcfs_I6G.js";
import { _ as Lt } from "./Tooltip-B-0uEV3l.js";
import { L as Re } from "./Legend-DGUxLqhs.js";
import Nt from "./vue-ui-skeleton-Bgf16k10.js";
import Pt from "./BaseIcon-DpaRUsHC.js";
import St from "./vue-ui-accordion-GNblUy42.js";
import { u as Ue } from "./useNestedProp-D79dWdel.js";
import { _ as Vt } from "./PackageVersion-B9_Ed72C.js";
import { P as It } from "./PenAndPaper-CzjoEhsO.js";
import { u as Ot } from "./useUserOptionState-BIvW1Kz7.js";
import { _ as Xe } from "./Shape-aXd72O71.js";
import { _ as Ft } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const Mt = ["id"], zt = ["onClick"], At = ["xmlns", "viewBox"], Bt = ["width", "height"], Dt = ["id"], Rt = ["stop-color"], Ut = ["stop-color"], Xt = { key: 1 }, Et = ["x", "y", "width", "height", "fill", "rx"], Ht = ["x", "y", "width", "height", "fill", "rx", "stroke", "stroke-width"], Gt = ["x", "y", "width", "height", "fill", "rx", "stroke", "stroke-width"], Wt = ["x2", "y1", "y2", "stroke", "stroke-width"], jt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Yt = ["x", "y", "text-anchor", "font-size", "fill", "font-weight"], qt = ["x", "y", "font-size", "fill", "font-weight"], Kt = ["x", "y", "font-size", "fill", "font-weight"], Jt = ["x", "y", "font-size", "fill", "font-weight"], Qt = ["y", "width", "height", "fill", "onMouseenter"], Zt = {
  key: 6,
  class: "vue-data-ui-watermark"
}, ea = ["onClick"], ta = { style: "width:100%;padding-top: 36px;position:relative" }, aa = { class: "vue-ui-data-table" }, la = { key: 0 }, oa = { style: { width: "100%" } }, na = ["data-cell"], ua = { style: { display: "flex", "align-items": "center", gap: "5px", "justify-content": "flex-end", width: "100%", "padding-right": "3px" } }, sa = ["data-cell"], ra = { style: { display: "flex", "align-items": "center", gap: "5px", "justify-content": "flex-end", width: "100%", "padding-right": "3px" } }, ia = ["data-cell"], da = { style: { display: "flex", "align-items": "center", gap: "5px", "justify-content": "flex-end", width: "100%", "padding-right": "3px" } }, va = ["data-cell"], ca = { style: { display: "flex", "align-items": "center", gap: "5px", "justify-content": "flex-end", width: "100%", "padding-right": "3px" } }, ha = ["data-cell"], pa = { style: { display: "flex", "align-items": "center", gap: "5px", "justify-content": "flex-end", width: "100%", "padding-right": "3px" } }, ya = ["data-cell"], ga = { style: { display: "flex", "align-items": "center", gap: "5px", "justify-content": "flex-end", width: "100%", "padding-right": "3px" } }, fa = ["data-cell"], ba = { style: { display: "flex", "align-items": "center", gap: "5px", "justify-content": "flex-end", width: "100%", "padding-right": "3px" } }, ma = {
  __name: "vue-ui-vertical-bar",
  props: {
    config: {
      type: Object,
      default() {
        return {};
      }
    },
    dataset: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  emits: ["selectLegend"],
  setup(Ee, { expose: He, emit: Ge }) {
    const T = Ee;
    nt((a) => ({
      "646b6c72": a.tdo
    }));
    const { vue_ui_vertical_bar: We } = vt(), je = ut(), q = b(() => !!T.dataset && T.dataset.length), w = d(ct()), Ye = d(null), ae = d(!1), le = d(""), K = d(0), qe = d(null), he = d(0), R = d(null), pe = d(null), oe = d(null), ye = d(null), ge = d(null), fe = d(0), ne = d(0), e = b({
      get: () => _e(),
      set: (a) => a
    }), { userOptionsVisible: ue, setUserOptionsVisibility: be, keepUserOptionState: me } = Ot({ config: e.value });
    function _e() {
      const a = Ue({
        userConfig: T.config,
        defaultConfig: We
      });
      return a.theme ? {
        ...Ue({
          userConfig: ht.vue_ui_vertical_bar[a.theme] || T.config,
          defaultConfig: a
        }),
        customPalette: pt[a.theme] || B
      } : a;
    }
    Be(() => T.config, (a) => {
      e.value = _e(), ue.value = !e.value.showOnChartHover, Ne(), fe.value += 1, ne.value += 1, v.value = e.value.style.chart.layout.bars.height, g.value = e.value.style.chart.layout.bars.gap;
    }, { deep: !0 }), Be(() => T.dataset, Q, { deep: !0 });
    const { isPrinting: ke, isImaging: $e, generatePdf: xe, generateImage: we } = Ct({
      elementId: `vue-ui-vertical-bar_${w.value}`,
      fileName: e.value.style.chart.title.text || "vue-ui-vertical-bar"
    }), Ke = b(() => e.value.userOptions.show && !e.value.style.chart.title.text), Ce = b(() => yt(e.value.customPalette)), Te = d(null), Le = d(!1), Je = b(() => e.value.table.responsiveBreakpoint), J = d(null);
    st(() => {
      Ne();
    });
    function Ne() {
      if (De(T.dataset) && ee({
        componentName: "VueUiVerticalBar",
        type: "dataset"
      }), K.value = T.dataset.flatMap((a) => a.children && a.children.length > 0 ? a.children.length : 1).reduce((a, l) => a + l, 0), Qe(), e.value.responsive) {
        const a = $t(() => {
          const { width: l, height: t } = xt({
            chart: R.value,
            title: e.value.style.chart.title.text ? pe.value : null,
            legend: e.value.style.chart.legend.show ? oe.value : null,
            source: ye.value,
            noTitle: ge.value
          });
          Ve.value = l, v.value = t / K.value - g.value * 2;
        });
        J.value = new ResizeObserver(a), J.value.observe(R.value.parentNode);
      }
    }
    rt(() => {
      J.value && J.value.disconnect();
    });
    function Qe() {
      new ResizeObserver((l) => {
        l.forEach((t) => {
          Le.value = t.contentRect.width < Je.value;
        });
      }).observe(Te.value);
    }
    const C = d({
      showTable: e.value.table.show,
      sortDesc: e.value.style.chart.layout.bars.sort === "desc",
      showTooltip: e.value.style.chart.tooltip.show
    }), Pe = b(() => C.value.sortDesc), I = b(() => (T.dataset.forEach((a, l) => {
      !a.value && !a.children && ee({
        componentName: "VueUiVerticalBar",
        type: "datasetAttributeEmpty",
        property: `value (index ${l})`
      }), a.children && (De(a.children) ? ee({
        componentName: "VueUiVerticalBar",
        type: "datasetAttributeEmpty",
        property: `children (index ${l})`
      }) : a.children.forEach((t, o) => {
        [null, void 0].includes(t.name) && ee({
          componentName: "VueUiVerticalBar",
          type: "datasetSerieAttribute",
          property: "name",
          key: "children",
          index: o
        });
      }));
    }), T.dataset.map((a, l) => {
      const t = `vertical_parent_${l}_${w.value}`, o = a.children && a.children.length > 0, _ = N(a.value ? a.value : o ? a.children.map((x) => x.value || 0).reduce((x, V) => x + V, 0) : 0), f = _ >= 0 ? 1 : -1;
      return {
        ...a,
        id: t,
        absoluteIndex: l,
        shape: "square",
        opacity: P.value.includes(t) ? 0.5 : 1,
        value: Math.abs(_),
        sign: f,
        hasChildren: o,
        isChild: !1,
        segregate: () => W(t),
        isSegregated: P.value.includes(t),
        color: ve(a.color) || Ce.value[l] || B[l] || B[l % B.length],
        children: !a.children || !a.children.length ? [] : a.children.toSorted((x, V) => Pe.value ? V.value - x.value : x.value - V.value).map((x, V) => ({
          ...x,
          value: N(Math.abs(x.value)),
          absoluteIndex: l,
          sign: x.value >= 0 ? 1 : -1,
          isChild: !0,
          parentId: t,
          parentName: a.name,
          parentValue: _,
          parentSign: f,
          id: `vertical_child_${l}_${V}_${w.value}`,
          childIndex: V,
          color: ve(x.color) || ve(a.color) || Ce.value[l] || B[l] || B[l % B.length]
        })).map((x, V) => ({
          ...x,
          isFirstChild: V === 0,
          isLastChild: V === a.children.length - 1
        }))
      };
    }).toSorted((a, l) => Pe.value ? l.value - a.value : a.value - l.value))), Se = b(() => ({
      cy: "vertical-bar-div-legend",
      backgroundColor: e.value.style.chart.legend.backgroundColor,
      color: e.value.style.chart.legend.color,
      fontSize: e.value.style.chart.legend.fontSize,
      paddingBottom: 12,
      fontWeight: e.value.style.chart.legend.bold ? "bold" : ""
    })), v = d(e.value.style.chart.layout.bars.height), g = d(e.value.style.chart.layout.bars.gap), Ze = b(() => (v.value + g.value) * K.value), Ve = d(512), y = b(() => ({
      width: Ve.value,
      height: Ze.value,
      padding: {
        top: 12,
        left: 128 + e.value.style.chart.layout.bars.offsetX,
        right: 64 + e.value.style.chart.layout.bars.paddingRight,
        bottom: 12
      }
    })), s = b(() => ({
      fullHeight: y.value.padding.top + y.value.padding.bottom + y.value.height,
      top: y.value.padding.top,
      left: y.value.padding.left,
      right: y.value.width - y.value.padding.right,
      bottom: y.value.padding.top + y.value.height,
      width: y.value.width - (y.value.padding.left + y.value.padding.right)
    }));
    function Q() {
      K.value = O.value.flatMap((a) => a.children && a.children.length > 0 ? a.children.length : 1).reduce((a, l) => a + l, 0);
    }
    const P = d([]);
    function W(a) {
      P.value.includes(a) ? P.value = P.value.filter((l) => l !== a) : P.value.push(a), Q(), Ge("selectLegend", O.value);
    }
    const O = b(() => I.value.filter((a) => !P.value.includes(a.id))), S = b(() => O.value.map((a) => Math.abs(a.value)).reduce((a, l) => a + l, 0));
    function Ie(a, l = !1, t = 0) {
      return l ? D({
        v: N(Math.abs(a) / S.value * 100),
        s: "%",
        r: t
      }) : Math.abs(a) / S.value;
    }
    const F = b(() => O.value.flatMap((a) => a.hasChildren ? a.children : a)), M = b(() => F.value.map((a) => a.sign).includes(-1)), et = b(() => Math.max(...O.value.flatMap((a) => a.children && a.children.length ? Math.max(...a.children.map((l) => l.value)) : a.value)));
    function $(a) {
      const l = a / et.value;
      return s.value.width / (M.value ? 2 : 1) * l;
    }
    function tt(a) {
      return $(a) + s.value.left;
    }
    function j(a, l) {
      const t = O.value.find((f) => f.id === a.parentId), o = s.value.top + (g.value + v.value) * l, _ = t.children.length * (g.value + v.value);
      return {
        y: o + _ / 2 - e.value.style.chart.layout.bars.parentLabels.fontSize,
        name: t.name,
        value: [void 0, NaN, null].includes(t.value) ? "" : t.sign === 1 ? t.value : -t.value,
        percentageToTotal: isNaN(t.value / S.value) ? "" : Ie(t.value, !0, e.value.style.chart.layout.bars.dataLabels.percentage.roundingPercentage),
        sign: t.sign
      };
    }
    function at() {
      return O.value;
    }
    const se = d(null), re = d(null);
    function lt(a, l) {
      re.value = {
        datapoint: a,
        seriesIndex: l,
        series: I.value,
        config: e.value
      }, ae.value = !0, se.value = a.id;
      let t = "";
      const o = a.isChild ? a.parentName : a.name, _ = a.isChild ? a.name : "", f = e.value.style.chart.tooltip.customFormat;
      bt(f) && mt(() => f({
        datapoint: a,
        series: I.value,
        config: e.value,
        seriesIndex: l
      })) ? le.value = f({
        datapoint: a,
        series: I.value,
        config: e.value,
        seriesIndex: l
      }) : (t += `<div style="width:100%;text-align:center;border-bottom:1px solid ${e.value.style.chart.tooltip.borderColor};padding-bottom:6px;margin-bottom:3px;text-align:left;">
                <div style="display:flex;align-items:center;gap:4px;"><svg viewBox="0 0 60 60" height="14" width="14"><rect x="0" y="0" height="60" width="60" rx="5" stroke="none" fill="${a.color}"/>${je.pattern ? `<rect x="0" y="0" height="60" width="60" rx="5" stroke="none" fill="url(#pattern_${w.value}_${a.absoluteIndex})"/>` : ""}</svg> ${o}</div>
                ${_ ? `<div>${_}</div>` : ""}
            </div>`, e.value.style.chart.tooltip.showValue && (t += `<div>${e.value.translations.value}: <b>${te(
        e.value.style.chart.layout.bars.dataLabels.value.formatter,
        a.sign === 1 ? a.value : -a.value,
        D({
          p: e.value.style.chart.tooltip.prefix,
          v: a.sign === 1 ? a.value : -a.value,
          s: e.value.style.chart.tooltip.suffix,
          r: e.value.style.chart.tooltip.roundingValue
        }),
        { datapoint: a, seriesIndex: l }
      )}</b></div>`), e.value.style.chart.tooltip.showPercentage && (t += `<div>${e.value.translations.percentageToTotal} : <b>${D({
        v: Math.abs(a.value) / S.value * 100,
        s: "%",
        r: e.value.style.chart.tooltip.roundingPercentage
      })}</b></div>`, a.isChild && (t += `<div>${e.value.translations.percentageToSerie}: <b>${D({
        v: Math.abs(a.value) / Math.abs(a.parentValue) * 100,
        s: "%",
        r: e.value.style.chart.tooltip.roundingPercentage
      })}</b></div>`)), le.value = `<div style="text-align:left">${t}</div>`);
    }
    function Oe(a, l, t, o) {
      if (!e.value.style.chart.layout.bars.dataLabels.value.show)
        return "";
      const _ = te(
        e.value.style.chart.layout.bars.dataLabels.value.formatter,
        N(o === -1 && a >= 0 ? -a : a),
        D({
          p: e.value.style.chart.layout.bars.dataLabels.value.prefix,
          v: N(o === -1 && a >= 0 ? -a : a),
          s: e.value.style.chart.layout.bars.dataLabels.value.suffix,
          r: e.value.style.chart.layout.bars.dataLabels.value.roundingValue
        }),
        { datapoint: l, seriesIndex: t }
      ), f = `(${Ie(a, !0, e.value.style.chart.layout.bars.dataLabels.percentage.roundingPercentage)})`;
      return `${_}${e.value.style.chart.layout.bars.dataLabels.percentage.show ? ` ${f}` : ""}`;
    }
    const L = b(() => {
      const a = [
        e.value.translations.parentName,
        e.value.translations.value,
        e.value.translations.percentageToTotal,
        e.value.translations.childName,
        e.value.translations.value,
        e.value.translations.percentageToSerie,
        e.value.translations.percentageToTotal
      ], l = F.value.map((t) => t.isChild ? t.isFirstChild ? {
        color: t.color,
        parentName: t.parentName,
        parentValue: t.parentValue,
        percentageToTotal: t.parentValue / S.value,
        childName: t.name,
        childValue: t.sign === 1 ? t.value : -t.value,
        childPercentageToParent: Math.abs(t.value) / Math.abs(t.parentValue),
        childPercentageToTotal: Math.abs(t.value) / S.value
      } : {
        color: "",
        parentName: "",
        parentValue: "",
        percentageToTotal: "",
        childName: t.name,
        childValue: t.sign === 1 ? t.value : -t.value,
        childPercentageToParent: Math.abs(t.value) / Math.abs(t.parentValue),
        childPercentageToTotal: Math.abs(t.value) / S.value
      } : {
        color: t.color,
        parentName: t.name,
        parentValue: t.sign === 1 ? t.value : -t.value,
        percentageToTotal: Math.abs(t.value) / S.value,
        childName: "",
        childValue: "",
        childPercentageToParent: "",
        childPercentageToTotal: ""
      });
      return { head: a, body: l };
    });
    function Fe() {
      const a = [[e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [""]], l = L.value.head, t = L.value.body.map((f) => [
        f.parentName,
        f.parentValue,
        f.percentageToTotal,
        f.childName,
        f.childValue,
        f.childPercentageToParent,
        f.childPercentageToTotal
      ]), o = a.concat([l]).concat(t), _ = _t(o);
      kt({ csvContent: _, title: e.value.style.chart.title.text || "vue-ui-vertical-bar" });
    }
    const U = d(!1);
    function ot(a) {
      U.value = a, he.value += 1;
    }
    function Me() {
      C.value.showTable = !C.value.showTable;
    }
    function ze() {
      C.value.sortDesc = !C.value.sortDesc, Q();
    }
    function Ae() {
      C.value.showTooltip = !C.value.showTooltip;
    }
    const Z = d(!1);
    function ie() {
      Z.value = !Z.value;
    }
    return He({
      getData: at,
      recalculateHeight: Q,
      generatePdf: xe,
      generateCsv: Fe,
      generateImage: we,
      toggleTable: Me,
      toggleSort: ze,
      toggleTooltip: Ae,
      toggleAnnotator: ie
    }), (a, l) => (u(), r("div", {
      class: z(`vue-ui-vertical-bar ${U.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${e.value.useCssAnimation ? "" : "vue-ui-dna"}`),
      ref_key: "verticalBarChart",
      ref: R,
      id: `vue-ui-vertical-bar_${w.value}`,
      style: c(`font-family:${e.value.style.fontFamily};width:100%; text-align:center;background:${e.value.style.chart.backgroundColor};${e.value.responsive ? "height: 100%" : ""}`),
      onMouseenter: l[5] || (l[5] = () => i(be)(!0)),
      onMouseleave: l[6] || (l[6] = () => i(be)(!1))
    }, [
      e.value.userOptions.buttons.annotator ? (u(), A(It, {
        key: 0,
        parent: R.value,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        active: Z.value,
        onClose: ie
      }, null, 8, ["parent", "backgroundColor", "color", "active"])) : p("", !0),
      Ke.value ? (u(), r("div", {
        key: 1,
        ref_key: "noTitle",
        ref: ge,
        class: "vue-data-ui-no-title-space",
        style: "height:36px; width: 100%;background:transparent"
      }, null, 512)) : p("", !0),
      e.value.style.chart.title.text ? (u(), r("div", {
        key: 2,
        ref_key: "chartTitle",
        ref: pe,
        style: "width:100%;background:transparent;padding-bottom:12px"
      }, [
        (u(), A(wt, {
          key: `title_${fe.value}`,
          config: {
            title: {
              cy: "vertical-bar-div-title",
              ...e.value.style.chart.title
            },
            subtitle: {
              cy: "vertical-bar-div-subtitle",
              ...e.value.style.chart.title.subtitle
            }
          }
        }, null, 8, ["config"]))
      ], 512)) : p("", !0),
      e.value.userOptions.show && q.value && (i(me) || i(ue)) ? (u(), A(Tt, {
        ref_key: "details",
        ref: Ye,
        key: `user_options_${he.value}`,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        isImaging: i($e),
        isPrinting: i(ke),
        uid: w.value,
        hasTooltip: e.value.userOptions.buttons.tooltip && e.value.style.chart.tooltip.show,
        hasPdf: e.value.userOptions.buttons.pdf,
        hasImg: e.value.userOptions.buttons.img,
        hasXls: e.value.userOptions.buttons.csv,
        hasTable: e.value.userOptions.buttons.table,
        hasSort: e.value.userOptions.buttons.sort,
        hasFullscreen: e.value.userOptions.buttons.fullscreen,
        isFullscreen: U.value,
        isTooltip: C.value.showTooltip,
        titles: { ...e.value.userOptions.buttonTitles },
        chartElement: R.value,
        position: e.value.userOptions.position,
        hasAnnotator: e.value.userOptions.buttons.annotator,
        isAnnotation: Z.value,
        onToggleFullscreen: ot,
        onGeneratePdf: i(xe),
        onGenerateCsv: Fe,
        onGenerateImage: i(we),
        onToggleTable: Me,
        onToggleSort: ze,
        onToggleTooltip: Ae,
        onToggleAnnotator: ie,
        style: c({
          visibility: i(me) ? i(ue) ? "visible" : "hidden" : "visible"
        })
      }, de({ _: 2 }, [
        a.$slots.optionTooltip ? {
          name: "optionTooltip",
          fn: k(() => [
            m(a.$slots, "optionTooltip", {}, void 0, !0)
          ]),
          key: "0"
        } : void 0,
        a.$slots.optionPdf ? {
          name: "optionPdf",
          fn: k(() => [
            m(a.$slots, "optionPdf", {}, void 0, !0)
          ]),
          key: "1"
        } : void 0,
        a.$slots.optionCsv ? {
          name: "optionCsv",
          fn: k(() => [
            m(a.$slots, "optionCsv", {}, void 0, !0)
          ]),
          key: "2"
        } : void 0,
        a.$slots.optionImg ? {
          name: "optionImg",
          fn: k(() => [
            m(a.$slots, "optionImg", {}, void 0, !0)
          ]),
          key: "3"
        } : void 0,
        a.$slots.optionTable ? {
          name: "optionTable",
          fn: k(() => [
            m(a.$slots, "optionTable", {}, void 0, !0)
          ]),
          key: "4"
        } : void 0,
        a.$slots.optionLabels ? {
          name: "optionLabels",
          fn: k(() => [
            m(a.$slots, "optionLabels", {}, void 0, !0)
          ]),
          key: "5"
        } : void 0,
        a.$slots.optionSort ? {
          name: "optionSort",
          fn: k(() => [
            m(a.$slots, "optionSort", {}, void 0, !0)
          ]),
          key: "6"
        } : void 0,
        a.$slots.optionFullscreen ? {
          name: "optionFullscreen",
          fn: k(({ toggleFullscreen: t, isFullscreen: o }) => [
            m(a.$slots, "optionFullscreen", X(E({ toggleFullscreen: t, isFullscreen: o })), void 0, !0)
          ]),
          key: "7"
        } : void 0,
        a.$slots.optionAnnotator ? {
          name: "optionAnnotator",
          fn: k(({ toggleAnnotator: t, isAnnotator: o }) => [
            m(a.$slots, "optionAnnotator", X(E({ toggleAnnotator: t, isAnnotator: o })), void 0, !0)
          ]),
          key: "8"
        } : void 0
      ]), 1032, ["backgroundColor", "color", "isImaging", "isPrinting", "uid", "hasTooltip", "hasPdf", "hasImg", "hasXls", "hasTable", "hasSort", "hasFullscreen", "isFullscreen", "isTooltip", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage", "style"])) : p("", !0),
      e.value.style.chart.legend.show && e.value.style.chart.legend.position === "top" ? (u(), r("div", {
        key: 4,
        ref_key: "chartLegend",
        ref: oe
      }, [
        (u(), A(Re, {
          key: `legend_top_${ne.value}`,
          legendSet: I.value,
          config: Se.value,
          onClickMarker: l[0] || (l[0] = ({ legend: t }) => W(t.id))
        }, de({
          item: k(({ legend: t, index: o }) => [
            n("div", {
              "data-cy-legend-item": "",
              onClick: (_) => W(t.id),
              style: c(`opacity:${P.value.includes(t.id) ? 0.5 : 1}`)
            }, h(t.name) + ": " + h(i(te)(
              e.value.style.chart.layout.bars.dataLabels.value.formatter,
              t.value,
              i(D)({
                p: e.value.style.chart.legend.prefix,
                v: t.value,
                s: e.value.style.chart.legend.suffix,
                r: e.value.style.chart.legend.roundingValue
              }),
              { datapoint: t, seriesIndex: o }
            )), 13, zt)
          ]),
          _: 2
        }, [
          a.$slots.pattern ? {
            name: "legend-pattern",
            fn: k(({ legend: t, index: o }) => [
              Y(Xe, {
                shape: t.shape,
                radius: 30,
                stroke: "none",
                plot: { x: 30, y: 30 },
                fill: `url(#pattern_${w.value}_${o})`
              }, null, 8, ["shape", "fill"])
            ]),
            key: "0"
          } : void 0
        ]), 1032, ["legendSet", "config"]))
      ], 512)) : p("", !0),
      q.value ? (u(), r("svg", {
        key: 5,
        xmlns: i(gt),
        class: z({ "vue-data-ui-fullscreen--on": U.value, "vue-data-ui-fulscreen--off": !U.value }),
        viewBox: `0 0 ${y.value.width <= 0 ? 10 : y.value.width} ${s.value.fullHeight <= 0 ? 10 : s.value.fullHeight}`,
        style: c(`max-width:100%;overflow:visible;background:transparent;color:${e.value.style.chart.color}`)
      }, [
        Y(Vt),
        a.$slots["chart-background"] ? (u(), r("foreignObject", {
          key: 0,
          x: 0,
          y: 0,
          width: y.value.width <= 0 ? 10 : y.value.width,
          height: s.value.fullHeight <= 0 ? 10 : s.value.fullHeight,
          style: {
            pointerEvents: "none"
          }
        }, [
          m(a.$slots, "chart-background", {}, void 0, !0)
        ], 8, Bt)) : p("", !0),
        (u(!0), r(H, null, G(F.value, (t, o) => (u(), r("linearGradient", {
          x1: "0%",
          y1: "0%",
          x2: "100%",
          y2: "0%",
          id: `vertical_bar_gradient_${w.value}_${o}`
        }, [
          n("stop", {
            offset: "0%",
            "stop-color": t.color
          }, null, 8, Rt),
          n("stop", {
            offset: "100%",
            "stop-color": i(ce)(i(ft)(t.color, 0.03), 100 - e.value.style.chart.layout.bars.gradientIntensity)
          }, null, 8, Ut)
        ], 8, Dt))), 256)),
        a.$slots.pattern ? (u(), r("g", Xt, [
          (u(!0), r(H, null, G(F.value, (t) => (u(), r("defs", null, [
            m(a.$slots, "pattern", X(E({ seriesIndex: t.absoluteIndex, patternId: `pattern_${w.value}_${t.absoluteIndex}` })), void 0, !0)
          ]))), 256))
        ])) : p("", !0),
        (u(!0), r(H, null, G(F.value, (t, o) => (u(), r("g", null, [
          n("rect", {
            x: i(N)(M.value ? s.value.left + s.value.width / 2 - (t.sign === 1 ? 0 : $(t.value) <= 0 ? 1e-4 : $(t.value)) : s.value.left),
            y: s.value.top + (g.value + v.value) * o,
            width: i(N)($(t.value) <= 0 ? 1e-4 : $(t.value)),
            height: v.value <= 0 ? 1e-4 : v.value,
            fill: e.value.style.chart.layout.bars.underlayerColor,
            rx: e.value.style.chart.layout.bars.borderRadius,
            class: z({ animated: e.value.useCssAnimation })
          }, null, 10, Et)
        ]))), 256)),
        (u(!0), r(H, null, G(F.value, (t, o) => (u(), r("g", null, [
          n("rect", {
            x: i(N)(M.value ? s.value.left + s.value.width / 2 - (t.sign === 1 ? 0 : $(t.value) <= 0 ? 1e-4 : $(t.value)) : s.value.left),
            y: s.value.top + (g.value + v.value) * o,
            width: i(N)($(t.value) <= 0 ? 1e-4 : $(t.value)),
            height: v.value <= 0 ? 1e-4 : v.value,
            fill: e.value.style.chart.layout.bars.useGradient ? `url(#vertical_bar_gradient_${w.value}_${o})` : i(ce)(t.color, e.value.style.chart.layout.bars.fillOpacity),
            rx: e.value.style.chart.layout.bars.borderRadius,
            stroke: e.value.style.chart.layout.bars.useStroke ? t.color : "none",
            "stroke-width": e.value.style.chart.layout.bars.useStroke ? e.value.style.chart.layout.bars.strokeWidth : 0,
            class: z({ animated: e.value.useCssAnimation })
          }, null, 10, Ht),
          a.$slots.pattern ? (u(), r("rect", {
            key: 0,
            x: i(N)(M.value ? s.value.left + s.value.width / 2 - (t.sign === 1 ? 0 : $(t.value) <= 0 ? 1e-4 : $(t.value)) : s.value.left),
            y: s.value.top + (g.value + v.value) * o,
            width: i(N)($(t.value) <= 0 ? 1e-4 : $(t.value)),
            height: v.value <= 0 ? 1e-4 : v.value,
            fill: `url(#pattern_${w.value}_${t.absoluteIndex})`,
            rx: e.value.style.chart.layout.bars.borderRadius,
            stroke: e.value.style.chart.layout.bars.useStroke ? t.color : "none",
            "stroke-width": e.value.style.chart.layout.bars.useStroke ? e.value.style.chart.layout.bars.strokeWidth : 0,
            class: z({ animated: e.value.useCssAnimation })
          }, null, 10, Gt)) : p("", !0),
          (!t.isChild || t.isLastChild) && e.value.style.chart.layout.separators.show && o !== F.value.length - 1 ? (u(), r("line", {
            key: 1,
            x1: 0,
            x2: s.value.left,
            y1: v.value + g.value / 2 + s.value.top + (g.value + v.value) * o,
            y2: v.value + g.value / 2 + s.value.top + (g.value + v.value) * o,
            stroke: e.value.style.chart.layout.separators.color,
            "stroke-width": e.value.style.chart.layout.separators.strokeWidth,
            "stroke-linecap": "round"
          }, null, 8, Wt)) : p("", !0),
          M.value && e.value.style.chart.layout.separators.show ? (u(), r("line", {
            key: 2,
            x1: s.value.left + s.value.width / 2,
            x2: s.value.left + s.value.width / 2,
            y1: s.value.top,
            y2: s.value.bottom,
            stroke: e.value.style.chart.layout.separators.color,
            "stroke-width": e.value.style.chart.layout.separators.strokeWidth,
            "stroke-linecap": "round"
          }, null, 8, jt)) : p("", !0),
          n("text", {
            x: M.value ? s.value.left + s.value.width / 2 + (t.sign === 1 ? -12 : 12) + (t.sign === 1 ? -e.value.style.chart.layout.bars.dataLabels.offsetX : e.value.style.chart.layout.bars.dataLabels.offsetX) : tt(t.value) + 3 + e.value.style.chart.layout.bars.dataLabels.offsetX,
            y: s.value.top + (g.value + v.value) * o + v.value / 2 + e.value.style.chart.layout.bars.dataLabels.fontSize / 2,
            "text-anchor": !M.value || t.sign === -1 ? "start" : "end",
            "font-size": e.value.style.chart.layout.bars.dataLabels.fontSize,
            fill: e.value.style.chart.layout.bars.dataLabels.color,
            "font-weight": e.value.style.chart.layout.bars.dataLabels.bold ? "bold" : "normal"
          }, h(Oe(t.value, t, o, t.sign)), 9, Yt),
          (t.isChild || !t.hasChildren) && e.value.style.chart.layout.bars.nameLabels.show ? (u(), r("text", {
            key: 3,
            "text-anchor": "end",
            x: s.value.left - 3 + e.value.style.chart.layout.bars.nameLabels.offsetX,
            y: s.value.top + (g.value + v.value) * o + v.value / 2 + e.value.style.chart.layout.bars.nameLabels.fontSize / 2,
            "font-size": e.value.style.chart.layout.bars.nameLabels.fontSize,
            fill: e.value.style.chart.layout.bars.nameLabels.color,
            "font-weight": e.value.style.chart.layout.bars.nameLabels.bold ? "bold" : "normal"
          }, h(t.name), 9, qt)) : p("", !0),
          t.isChild && t.childIndex === 0 && e.value.style.chart.layout.bars.parentLabels.show ? (u(), r("text", {
            key: 4,
            x: 3 + e.value.style.chart.layout.bars.parentLabels.offsetX,
            y: j(t, o).y,
            "font-size": e.value.style.chart.layout.bars.parentLabels.fontSize,
            fill: e.value.style.chart.layout.bars.parentLabels.color,
            "font-weight": e.value.style.chart.layout.bars.parentLabels.bold ? "bold" : "normal",
            "text-anchor": "start"
          }, h(j(t, o).name), 9, Kt)) : p("", !0),
          t.isChild && t.childIndex === 0 && e.value.style.chart.layout.bars.parentLabels.show ? (u(), r("text", {
            key: 5,
            x: 3 + e.value.style.chart.layout.bars.parentLabels.offsetX,
            y: j(t, o).y + e.value.style.chart.layout.bars.parentLabels.fontSize + 6,
            "font-size": e.value.style.chart.layout.bars.parentLabels.fontSize,
            fill: e.value.style.chart.layout.bars.parentLabels.color,
            "font-weight": e.value.style.chart.layout.bars.dataLabels.bold ? "bold" : "normal",
            "text-anchor": "start"
          }, h(Oe(j(t, o).value), j(t, o), o, t.parentSign || t.sign), 9, Jt)) : p("", !0),
          n("rect", {
            "data-cy-trap": "",
            x: 0,
            y: s.value.top + (g.value + v.value) * o - g.value / 2,
            width: y.value.width <= 0 ? 1e-4 : y.value.width,
            height: v.value + g.value <= 0 ? 1e-4 : v.value + g.value,
            fill: se.value === t.id ? i(ce)(e.value.style.chart.layout.highlighter.color, e.value.style.chart.layout.highlighter.opacity) : "transparent",
            onMouseenter: (_) => lt(t, o),
            onMouseleave: l[1] || (l[1] = (_) => {
              qe.value = null, ae.value = !1, se.value = null;
            })
          }, null, 40, Qt)
        ]))), 256)),
        m(a.$slots, "svg", { svg: y.value }, void 0, !0)
      ], 14, At)) : p("", !0),
      a.$slots.watermark ? (u(), r("div", Zt, [
        m(a.$slots, "watermark", X(E({ isPrinting: i(ke) || i($e) })), void 0, !0)
      ])) : p("", !0),
      q.value ? p("", !0) : (u(), A(Nt, {
        key: 7,
        config: {
          type: "verticalBar",
          style: {
            backgroundColor: e.value.style.chart.backgroundColor,
            verticalBar: {
              axis: {
                color: "#CCCCCC"
              },
              color: "#CCCCCC"
            }
          }
        }
      }, null, 8, ["config"])),
      e.value.style.chart.legend.show && e.value.style.chart.legend.position === "bottom" ? (u(), r("div", {
        key: 8,
        ref_key: "chartLegend",
        ref: oe
      }, [
        (u(), A(Re, {
          key: `legend_bottom_${ne.value}`,
          legendSet: I.value,
          config: Se.value,
          onClickMarker: l[2] || (l[2] = ({ legend: t }) => W(t.id))
        }, de({
          item: k(({ legend: t, index: o }) => [
            n("div", {
              onClick: (_) => W(t.id),
              style: c(`opacity:${P.value.includes(t.id) ? 0.5 : 1}`)
            }, h(t.name) + ": " + h(i(te)(
              e.value.style.chart.layout.bars.dataLabels.value.formatter,
              t.value,
              i(D)({
                p: e.value.style.chart.legend.prefix,
                v: t.value,
                s: e.value.style.chart.legend.suffix,
                r: e.value.style.chart.legend.roundingValue
              }),
              { datapoint: t, seriesIndex: o }
            )), 13, ea)
          ]),
          _: 2
        }, [
          a.$slots.pattern ? {
            name: "legend-pattern",
            fn: k(({ legend: t, index: o }) => [
              Y(Xe, {
                shape: t.shape,
                radius: 30,
                stroke: "none",
                plot: { x: 30, y: 30 },
                fill: `url(#pattern_${w.value}_${o})`
              }, null, 8, ["shape", "fill"])
            ]),
            key: "0"
          } : void 0
        ]), 1032, ["legendSet", "config"]))
      ], 512)) : p("", !0),
      m(a.$slots, "legend", { legend: I.value }, void 0, !0),
      a.$slots.source ? (u(), r("div", {
        key: 9,
        ref_key: "source",
        ref: ye,
        dir: "auto"
      }, [
        m(a.$slots, "source", {}, void 0, !0)
      ], 512)) : p("", !0),
      Y(Lt, {
        show: C.value.showTooltip && ae.value && P.value.length < T.dataset.length,
        backgroundColor: e.value.style.chart.tooltip.backgroundColor,
        color: e.value.style.chart.tooltip.color,
        borderRadius: e.value.style.chart.tooltip.borderRadius,
        borderColor: e.value.style.chart.tooltip.borderColor,
        borderWidth: e.value.style.chart.tooltip.borderWidth,
        fontSize: e.value.style.chart.tooltip.fontSize,
        backgroundOpacity: e.value.style.chart.tooltip.backgroundOpacity,
        position: e.value.style.chart.tooltip.position,
        offsetY: e.value.style.chart.tooltip.offsetY,
        parent: R.value,
        content: le.value,
        isFullscreen: U.value,
        isCustom: e.value.style.chart.tooltip.customFormat && typeof e.value.style.chart.tooltip.customFormat == "function"
      }, {
        "tooltip-before": k(() => [
          m(a.$slots, "tooltip-before", X(E({ ...re.value })), void 0, !0)
        ]),
        "tooltip-after": k(() => [
          m(a.$slots, "tooltip-after", X(E({ ...re.value })), void 0, !0)
        ]),
        _: 3
      }, 8, ["show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "fontSize", "backgroundOpacity", "position", "offsetY", "parent", "content", "isFullscreen", "isCustom"]),
      q.value ? (u(), A(St, {
        key: 10,
        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: k(() => [
          n("div", {
            ref_key: "tableContainer",
            ref: Te,
            class: "vue-ui-vertical-bar-table"
          }, [
            n("div", ta, [
              n("div", {
                role: "button",
                tabindex: "0",
                style: c(`width:32px; position: absolute; top: 0; right:4px; padding: 0 0px; display: flex; align-items:center;justify-content:center;height: 36px; width: 32px; cursor:pointer; background:${e.value.table.th.backgroundColor};`),
                onClick: l[3] || (l[3] = (t) => C.value.showTable = !1),
                onKeypress: l[4] || (l[4] = it((t) => C.value.showTable = !1, ["enter"]))
              }, [
                Y(Pt, {
                  name: "close",
                  stroke: e.value.table.th.color,
                  "stroke-width": 2
                }, null, 8, ["stroke"])
              ], 36),
              n("div", {
                style: { width: "100%", "container-type": "inline-size" },
                class: z({ "vue-ui-responsive": Le.value })
              }, [
                n("table", aa, [
                  n("caption", {
                    style: c({ backgroundColor: e.value.table.th.backgroundColor, color: e.value.table.th.color, outline: e.value.table.th.outline }),
                    class: "vue-ui-data-table__caption"
                  }, [
                    dt(h(e.value.style.chart.title.text) + " ", 1),
                    e.value.style.chart.title.subtitle.text ? (u(), r("span", la, h(e.value.style.chart.title.subtitle.text), 1)) : p("", !0)
                  ], 4),
                  n("thead", null, [
                    n("tr", {
                      role: "row",
                      style: c(`background:${e.value.table.th.backgroundColor};color:${e.value.table.th.color}`)
                    }, [
                      (u(!0), r(H, null, G(L.value.head, (t) => (u(), r("th", {
                        style: c(`outline:${e.value.table.th.outline}`)
                      }, [
                        n("div", oa, h(t), 1)
                      ], 4))), 256))
                    ], 4),
                    n("tr", null, [
                      n("th", {
                        style: c(`background:${e.value.table.th.backgroundColor};color:${e.value.table.th.color};outline:${e.value.table.th.outline}`)
                      }, null, 4),
                      n("th", {
                        style: c(`background:${e.value.table.th.backgroundColor};color:${e.value.table.th.color};outline:${e.value.table.th.outline};text-align:right;padding-right:5px;font-weight:bold`)
                      }, "∑ " + h(e.value.table.td.prefix) + h(isNaN(S.value) ? "" : S.value.toFixed(e.value.table.td.roundingValue)) + h(e.value.table.td.suffix), 5),
                      n("th", {
                        style: c(`background:${e.value.table.th.backgroundColor};color:${e.value.table.th.color};outline:${e.value.table.th.outline};text-align:right;padding-right:5px;font-weight:bold`)
                      }, "100%", 4),
                      n("th", {
                        style: c(`background:${e.value.table.th.backgroundColor};color:${e.value.table.th.color};outline:${e.value.table.th.outline}`)
                      }, null, 4),
                      n("th", {
                        style: c(`background:${e.value.table.th.backgroundColor};color:${e.value.table.th.color};outline:${e.value.table.th.outline}`)
                      }, null, 4),
                      n("th", {
                        style: c(`background:${e.value.table.th.backgroundColor};color:${e.value.table.th.color};outline:${e.value.table.th.outline}`)
                      }, null, 4),
                      n("th", {
                        style: c(`background:${e.value.table.th.backgroundColor};color:${e.value.table.th.color};outline:${e.value.table.th.outline}`)
                      }, null, 4)
                    ])
                  ]),
                  n("tbody", null, [
                    (u(!0), r(H, null, G(L.value.body, (t, o) => (u(), r("tr", {
                      class: z({ "vue-ui-data-table__tbody__row": !0, "vue-ui-data-table__tbody__row-even": o % 2 === 0, "vue-ui-data-table__tbody__row-odd": o % 2 !== 0 }),
                      style: c(`background:${e.value.table.td.backgroundColor};color:${e.value.table.td.color}`)
                    }, [
                      n("td", {
                        class: "vue-ui-data-table__tbody__td",
                        style: c(`outline:${e.value.table.td.outline};font-variant-numeric: tabular-nums;`),
                        "data-cell": L.value.head[0] ?? ""
                      }, [
                        n("div", ua, [
                          t.color ? (u(), r("span", {
                            key: 0,
                            style: c(`color:${t.color};margin-right:3px`)
                          }, "⬤", 4)) : p("", !0),
                          n("span", null, h(t.parentName), 1)
                        ])
                      ], 12, na),
                      n("td", {
                        class: "vue-ui-data-table__tbody__td",
                        style: c(`outline:${e.value.table.td.outline}`),
                        "data-cell": L.value.head[1] ?? ""
                      }, [
                        n("div", ra, h(e.value.table.td.prefix) + h(["", NaN, void 0].includes(t.parentValue) ? "" : t.parentValue.toFixed(e.value.table.td.roundingValue)) + h(e.value.table.td.suffix), 1)
                      ], 12, sa),
                      n("td", {
                        class: "vue-ui-data-table__tbody__td",
                        style: c(`outline:${e.value.table.td.outline}`),
                        "data-cell": L.value.head[2] ?? ""
                      }, [
                        n("div", da, h(["", NaN, void 0].includes(t.percentageToTotal) ? "" : `${(t.percentageToTotal * 100).toFixed(e.value.table.td.roundingPercentage)}%`), 1)
                      ], 12, ia),
                      n("td", {
                        class: "vue-ui-data-table__tbody__td",
                        style: c(`outline:${e.value.table.td.outline}`),
                        "data-cell": L.value.head[3] ?? ""
                      }, [
                        n("div", ca, h(t.childName), 1)
                      ], 12, va),
                      n("td", {
                        class: "vue-ui-data-table__tbody__td",
                        style: c(`outline:${e.value.table.td.outline}`),
                        "data-cell": L.value.head[4] ?? ""
                      }, [
                        n("div", pa, h(e.value.table.td.prefix) + h(["", NaN, void 0].includes(t.childValue) ? "" : t.childValue.toFixed(e.value.table.td.roundingValue)) + h(e.value.table.td.suffix), 1)
                      ], 12, ha),
                      n("td", {
                        class: "vue-ui-data-table__tbody__td",
                        style: c(`outline:${e.value.table.td.outline}`),
                        "data-cell": L.value.head[5] ?? ""
                      }, [
                        n("div", ga, h(["", NaN, void 0].includes(t.childPercentageToParent) ? "" : `${(t.childPercentageToParent * 100).toFixed(e.value.table.td.roundingPercentage)}%`), 1)
                      ], 12, ya),
                      n("td", {
                        class: "vue-ui-data-table__tbody__td",
                        style: c(`outline:${e.value.table.td.outline}`),
                        "data-cell": L.value.head[6] ?? ""
                      }, [
                        n("div", ba, h(["", NaN, void 0].includes(t.childPercentageToTotal) ? "" : `${(t.childPercentageToTotal * 100).toFixed(e.value.table.td.roundingPercentage)}%`), 1)
                      ], 12, fa)
                    ], 6))), 256))
                  ])
                ])
              ], 2)
            ])
          ], 512)
        ]),
        _: 1
      }, 8, ["config"])) : p("", !0)
    ], 46, Mt));
  }
}, za = /* @__PURE__ */ Ft(ma, [["__scopeId", "data-v-b7b6fe7f"]]);
export {
  za as default
};
