import { computed as b, ref as y, watch as Tt, onMounted as At, openBlock as r, createElementBlock as n, normalizeClass as ht, unref as t, normalizeStyle as W, createBlock as S, createCommentVNode as h, createSlots as Lt, withCtx as p, renderSlot as f, normalizeProps as I, guardReactiveProps as F, createVNode as ft, createElementVNode as d, Fragment as z, renderList as P, toDisplayString as w, createTextVNode as ct, nextTick as St } from "vue";
import { u as zt, c as Ot, t as It, o as Ft, e as Pt, v as c, X as Mt, s as X, w as gt, i as k, f as _, x as Nt, y as Rt, q as Dt, r as Gt } from "./index-WrV3SAID.js";
import { t as Ut, u as Bt } from "./useResponsive-CoxXLe23.js";
import { _ as Et } from "./Title-BR-xoRp4.js";
import { u as Vt, U as Wt } from "./usePrinter-kVpf1iV8.js";
import { _ as Xt } from "./Tooltip-ho4JxRm-.js";
import { D as jt } from "./DataTable-DNPvKWC0.js";
import Ht from "./vue-ui-skeleton-Qec_XSRf.js";
import Yt from "./vue-ui-accordion-BQCDXXDs.js";
import { u as vt } from "./useNestedProp-Cj0kHD7k.js";
import { _ as qt } from "./PackageVersion-1NslmM8M.js";
import { P as Jt } from "./PenAndPaper-BF1ZRVm3.js";
import { u as Kt } from "./useUserOptionState-BIvW1Kz7.js";
import { _ as Qt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const Zt = ["id"], te = ["xmlns", "viewBox"], ee = ["x", "y", "width", "height"], oe = ["id"], le = ["stop-color"], ae = ["stop-color"], se = ["id"], ie = ["stop-color"], re = ["stop-color"], ne = ["x", "y", "width", "height", "fill", "rx"], ue = ["x", "y", "width", "height", "fill", "rx"], de = ["x", "y", "width", "height", "fill", "rx"], ye = ["x", "y", "width", "height", "fill", "rx"], he = { key: 0 }, fe = ["x", "y", "fill", "font-size", "font-weight"], ce = ["x", "y", "fill", "font-size", "font-weight"], ge = { key: 1 }, ve = ["x", "y", "font-size", "fill", "font-weight"], pe = { key: 2 }, be = { key: 0 }, xe = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], me = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], we = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], ke = ["x", "y", "font-size", "fill", "font-weight"], _e = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Ce = ["x", "y", "font-size", "fill", "font-weight"], $e = ["x", "y", "font-size", "fill", "font-weight"], Te = ["x", "y", "width", "height", "fill", "onMouseover"], Ae = {
  key: 5,
  class: "vue-data-ui-watermark"
}, Le = {
  __name: "vue-ui-age-pyramid",
  props: {
    config: {
      type: Object,
      default() {
        return {};
      }
    },
    dataset: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  setup(j, { expose: pt }) {
    const { vue_ui_age_pyramid: bt } = zt(), g = j, M = b(() => !!g.dataset && g.dataset.length), x = y(Ot()), xt = y(null), G = y(!1), U = y(""), N = y(null), H = y(0), C = y(null), Y = y(null), q = y(null), J = y(null), K = y(0), Q = y(0), e = b({
      get: () => et(),
      set: (o) => o
    }), { userOptionsVisible: B, setUserOptionsVisibility: Z, keepUserOptionState: tt } = Kt({ config: e.value });
    function et() {
      const o = vt({
        userConfig: g.config,
        defaultConfig: bt
      });
      return o.theme ? {
        ...vt({
          userConfig: It.vue_ui_age_pyramid[o.theme] || g.config,
          defaultConfig: o
        })
      } : o;
    }
    Tt(() => g.config, (o) => {
      e.value = et(), B.value = !e.value.showOnChartHover, lt(), K.value += 1, Q.value += 1;
    }, { deep: !0 });
    const ot = y(null);
    At(() => {
      lt();
    });
    function lt() {
      if (Ft(g.dataset) && Pt({
        componentName: "VueUiAgePyramid",
        type: "dataset"
      }), e.value.responsive) {
        const o = Ut(() => {
          const { width: i, height: l } = Bt({
            chart: C.value,
            title: e.value.style.title.text ? Y.value : null,
            source: q.value,
            noTitle: J.value
          });
          v.value.width = i, v.value.height = l;
        });
        ot.value = new ResizeObserver(o), ot.value.observe(C.value.parentNode);
      }
    }
    const { isPrinting: at, isImaging: st, generatePdf: it, generateImage: rt } = Vt({
      elementId: `vue-ui-age-pyramid_${x.value}`,
      fileName: e.value.style.title.text || "vue-ui-age-pyramid"
    }), mt = b(() => e.value.userOptions.show && !e.value.style.title.text), m = y({
      showTable: e.value.table.show,
      showTooltip: e.value.style.tooltip.show
    }), v = y({
      height: e.value.style.height,
      width: e.value.style.width
    }), s = b(() => {
      const o = v.value.width - e.value.style.layout.padding.right - e.value.style.layout.padding.left, i = e.value.style.layout.padding.left, l = v.value.width - e.value.style.layout.padding.right;
      return {
        top: e.value.style.layout.padding.top,
        left: i,
        right: l,
        bottom: v.value.height - e.value.style.layout.padding.bottom,
        width: o,
        height: v.value.height - e.value.style.layout.padding.top - e.value.style.layout.padding.bottom,
        centerX: e.value.style.layout.padding.left + o / 2,
        leftChart: {
          width: o / 2 - e.value.style.layout.centerSlit.width,
          right: i + o / 2 - e.value.style.layout.centerSlit.width
        },
        rightChart: {
          width: o / 2 - e.value.style.layout.centerSlit.width,
          left: i + o / 2 + e.value.style.layout.centerSlit.width
        }
      };
    }), wt = b(() => g.dataset.map((o) => e.value.style.layout.dataLabels.yAxis.display === "age" ? o[1] : o[0])), $ = b(() => {
      const o = kt(O.value / 5), i = [], l = [];
      for (let a = 0; a <= 5; a += 1) {
        const u = o * a, yt = o * (a - 5);
        i.push({
          value: u,
          x: s.value.left + s.value.width / 2 + e.value.style.layout.centerSlit.width + u / O.value * s.value.leftChart.width
        }), l.push({
          value: Math.abs(yt),
          x: s.value.left + s.value.width / 2 + yt / O.value * s.value.leftChart.width - e.value.style.layout.centerSlit.width
        });
      }
      return {
        right: i,
        left: l
      };
    });
    function kt(o) {
      if (o === 0) return 0;
      const l = 10 ** Math.floor(Math.log10(Math.abs(o)));
      let a;
      return o < 0, a = Math.round(o / l) * l, a;
    }
    const O = b(() => Math.max(...g.dataset.flatMap((o) => o.slice(-2).map((i) => c(i))))), T = b(() => g.dataset.length), _t = b(() => g.dataset.map((o) => ({
      segment: o[0],
      age: o[1],
      left: {
        value: o[2],
        proportionToMax: o[2] / O.value
      },
      right: {
        value: o[3],
        proportionToMax: o[3] / O.value
      }
    }))), A = b(() => _t.value.map((o, i) => {
      const l = s.value.top + s.value.height / T.value * i, a = s.value.height / T.value - e.value.style.layout.bars.gap;
      return {
        segment: o.segment,
        age: o.age,
        left: {
          ...o.left,
          y: l,
          color: e.value.style.layout.bars.left.color,
          x: s.value.leftChart.right - o.left.proportionToMax * s.value.leftChart.width,
          width: c(o.left.proportionToMax * s.value.leftChart.width),
          height: a
        },
        right: {
          ...o.right,
          y: l,
          color: e.value.style.layout.bars.right.color,
          x: s.value.rightChart.left,
          width: c(o.right.proportionToMax * s.value.rightChart.width),
          height: a
        }
      };
    })), E = y(null);
    function Ct(o, i) {
      N.value = o, E.value = {
        datapoint: i,
        seriesIndex: o,
        series: A.value,
        config: e.value
      };
      const l = e.value.style.tooltip.customFormat;
      if (Nt(l) && Rt(() => l({
        seriesIndex: o,
        datapoint: {
          segment: i[0],
          index: i[1],
          left: i[2],
          right: i[3]
        },
        series: A.value,
        config: e.value
      })))
        U.value = l({
          seriesIndex: o,
          datapoint: {
            segment: i[0],
            index: i[1],
            left: i[2],
            right: i[3]
          },
          series: A.value,
          config: e.value
        });
      else {
        let a = "";
        const u = A.value[o];
        a += `<div><b>${u.segment}</b></div>`, a += `<div>${e.value.translations.age}: ${k(
          e.value.style.layout.dataLabels.yAxis.formatter,
          c(u.age),
          _({ v: c(u.age) }),
          { datapoint: i, seriesIndex: o }
        )}</div>`, a += `<div style="margin-top:6px;padding-top:6px;border-top:1px solid ${e.value.style.tooltip.borderColor}">`, a += '<div style="display:flex; flex-direction:row;gap:12px">', a += `<div style="display:flex;flex-direction:column;align-items:center;justify-content:center"><svg viewBox="0 0 12 12" height="12" width="12"><rect stroke="none" x="0" y="0" height="12" width="12" rx="2" fill="${e.value.style.layout.bars.gradient.underlayer}"/><rect stroke="none" x="0" y="0" height="12" width="12" rx="2" fill="${e.value.style.layout.bars.gradient.show ? `url(#age_pyramid_left_${x.value})` : e.value.style.layout.bars.left.color}"/></svg><div>${e.value.translations.female}</div><div><b>${k(
          e.value.style.layout.dataLabels.xAxis.formatter,
          c(u.left.value),
          _({ v: c(u.left.value) }),
          { datapoint: i, seriesIndex: o }
        )}</b></div></div>`, a += `<div style="display:flex;flex-direction:column;align-items:center;justify-content:center"><svg viewBox="0 0 12 12" height="12" width="12"><rect stroke="none" x="0" y="0" height="12" width="12" rx="2" fill="${e.value.style.layout.bars.gradient.underlayer}"/><rect stroke="none" x="0" y="0" height="12" width="12" rx="2" fill="${e.value.style.layout.bars.gradient.show ? `url(#age_pyramid_right_${x.value})` : e.value.style.layout.bars.right.color}"/></svg><div>${e.value.translations.male}</div><div><b>${k(
          e.value.style.layout.dataLabels.xAxis.formatter,
          c(u.right.value),
          _({ v: c(u.right.value) }),
          { datapoint: i, seriesIndex: o }
        )}</b></div></div>`, a += "</div>", a += `<div style="margin-top:6px;padding-top:6px;border-top:1px solid ${e.value.style.tooltip.borderColor}"><div>${e.value.translations.total}</div><div><b>${k(
          e.value.style.layout.dataLabels.xAxis.formatter,
          c(u.right.value) + c(u.left.value),
          _({ v: c(u.right.value) + c(u.left.value) }),
          { datapoint: i, seriesIndex: o }
        )}</b></div></div>`, a += "</div>", U.value = `<div>${a}</div>`;
      }
      G.value = !0;
    }
    function nt() {
      St(() => {
        const o = [e.value.translations.year, e.value.translations.age, e.value.translations.female, e.value.translations.male, e.value.translations.total], i = g.dataset.map((u) => [
          u[0],
          u[1],
          u[2],
          u[3],
          u[2] + u[3]
        ]), l = [[e.value.style.title.text], [e.value.style.title.subtitle.text], [[""], [""], [""]]].concat([o]).concat(i), a = Dt(l);
        Gt({ csvContent: a, title: e.value.style.title.text || "vue-ui-heatmap" });
      });
    }
    const R = b(() => {
      const o = [
        e.value.translations.year,
        e.value.translations.age,
        e.value.translations.female,
        e.value.translations.male,
        e.value.translations.total
      ], i = g.dataset.map((a) => [
        a[0],
        a[1],
        a[2].toLocaleString(),
        a[3].toLocaleString(),
        (a[2] + a[3]).toLocaleString()
      ]), l = {
        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
      };
      return { head: o, body: i, config: l, colNames: o };
    }), L = y(!1);
    function $t(o) {
      L.value = o, H.value += 1;
    }
    function ut() {
      m.value.showTable = !m.value.showTable;
    }
    function dt() {
      m.value.showTooltip = !m.value.showTooltip;
    }
    const D = y(!1);
    function V() {
      D.value = !D.value;
    }
    return pt({
      generatePdf: it,
      generateCsv: nt,
      generateImage: rt,
      toggleTable: ut,
      toggleTooltip: dt,
      toggleAnnotator: V
    }), (o, i) => (r(), n("div", {
      class: ht(`vue-ui-age-pyramid ${t(L) ? "vue-data-ui-wrapper-fullscreen" : ""}`),
      ref_key: "agePyramid",
      ref: C,
      id: `vue-ui-age-pyramid_${t(x)}`,
      style: W(`font-family:${t(e).style.fontFamily};width:100%; text-align:center;background:${t(e).style.backgroundColor};${t(e).responsive ? "height:100%" : ""}`),
      onMouseenter: i[2] || (i[2] = () => t(Z)(!0)),
      onMouseleave: i[3] || (i[3] = () => t(Z)(!1))
    }, [
      t(e).userOptions.buttons.annotator ? (r(), S(Jt, {
        key: 0,
        parent: t(C),
        backgroundColor: t(e).style.backgroundColor,
        color: t(e).style.color,
        active: t(D),
        onClose: V
      }, null, 8, ["parent", "backgroundColor", "color", "active"])) : h("", !0),
      t(mt) ? (r(), n("div", {
        key: 1,
        ref_key: "noTitle",
        ref: J,
        class: "vue-data-ui-no-title-space",
        style: "height:36px; width: 100%;background:transparent"
      }, null, 512)) : h("", !0),
      t(e).style.title.text ? (r(), n("div", {
        key: 2,
        ref_key: "chartTitle",
        ref: Y,
        style: "width:100%;background:transparent"
      }, [
        (r(), S(Et, {
          key: `title_${t(K)}`,
          config: {
            title: {
              cy: "pyramid-div-title",
              ...t(e).style.title
            },
            subtitle: {
              cy: "pyramid-div-subtitle",
              ...t(e).style.title.subtitle
            }
          }
        }, null, 8, ["config"]))
      ], 512)) : h("", !0),
      t(e).userOptions.show && t(M) && (t(tt) || t(B)) ? (r(), S(Wt, {
        ref_key: "details",
        ref: xt,
        key: `user_options_${t(H)}`,
        backgroundColor: t(e).style.backgroundColor,
        color: t(e).style.color,
        isImaging: t(st),
        isPrinting: t(at),
        uid: t(x),
        hasTooltip: t(e).userOptions.buttons.tooltip && t(e).style.tooltip.show,
        hasPdf: t(e).userOptions.buttons.pdf,
        hasXls: t(e).userOptions.buttons.csv,
        hasImg: t(e).userOptions.buttons.img,
        hasTable: t(e).userOptions.buttons.table,
        hasFullscreen: t(e).userOptions.buttons.fullscreen,
        isFullscreen: t(L),
        isTooltip: t(m).showTooltip,
        titles: { ...t(e).userOptions.buttonTitles },
        chartElement: t(C),
        position: t(e).userOptions.position,
        hasAnnotator: t(e).userOptions.buttons.annotator,
        isAnnotation: t(D),
        onToggleFullscreen: $t,
        onGeneratePdf: t(it),
        onGenerateCsv: nt,
        onGenerateImage: t(rt),
        onToggleTable: ut,
        onToggleTooltip: dt,
        onToggleAnnotator: V,
        style: W({
          visibility: t(tt) ? t(B) ? "visible" : "hidden" : "visible"
        })
      }, Lt({ _: 2 }, [
        o.$slots.optionTooltip ? {
          name: "optionTooltip",
          fn: p(() => [
            f(o.$slots, "optionTooltip", {}, void 0, !0)
          ]),
          key: "0"
        } : void 0,
        o.$slots.optionPdf ? {
          name: "optionPdf",
          fn: p(() => [
            f(o.$slots, "optionPdf", {}, void 0, !0)
          ]),
          key: "1"
        } : void 0,
        o.$slots.optionCsv ? {
          name: "optionCsv",
          fn: p(() => [
            f(o.$slots, "optionCsv", {}, void 0, !0)
          ]),
          key: "2"
        } : void 0,
        o.$slots.optionImg ? {
          name: "optionImg",
          fn: p(() => [
            f(o.$slots, "optionImg", {}, void 0, !0)
          ]),
          key: "3"
        } : void 0,
        o.$slots.optionTable ? {
          name: "optionTable",
          fn: p(() => [
            f(o.$slots, "optionTable", {}, void 0, !0)
          ]),
          key: "4"
        } : void 0,
        o.$slots.optionFullscreen ? {
          name: "optionFullscreen",
          fn: p(({ toggleFullscreen: l, isFullscreen: a }) => [
            f(o.$slots, "optionFullscreen", I(F({ toggleFullscreen: l, isFullscreen: a })), void 0, !0)
          ]),
          key: "5"
        } : void 0,
        o.$slots.optionAnnotator ? {
          name: "optionAnnotator",
          fn: p(({ toggleAnnotator: l, isAnnotator: a }) => [
            f(o.$slots, "optionAnnotator", I(F({ toggleAnnotator: l, isAnnotator: a })), void 0, !0)
          ]),
          key: "6"
        } : void 0
      ]), 1032, ["backgroundColor", "color", "isImaging", "isPrinting", "uid", "hasTooltip", "hasPdf", "hasXls", "hasImg", "hasTable", "hasFullscreen", "isFullscreen", "isTooltip", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage", "style"])) : h("", !0),
      t(M) ? (r(), n("svg", {
        key: 4,
        xmlns: t(Mt),
        class: ht({ "vue-data-ui-fullscreen--on": t(L), "vue-data-ui-fulscreen--off": !t(L) }),
        viewBox: `0 0 ${t(v).width <= 0 ? 10 : t(v).width} ${t(v).height <= 0 ? 10 : t(v).height}`,
        style: W(`max-width:100%;overflow:visible;background:transparent;color:${t(e).style.color}`)
      }, [
        ft(qt),
        o.$slots["chart-background"] ? (r(), n("foreignObject", {
          key: 0,
          x: t(s).left,
          y: t(s).top,
          width: t(s).width,
          height: t(s).height,
          style: {
            pointerEvents: "none"
          }
        }, [
          f(o.$slots, "chart-background", {}, void 0, !0)
        ], 8, ee)) : h("", !0),
        d("defs", null, [
          d("linearGradient", {
            id: `age_pyramid_left_${t(x)}`,
            x1: "0%",
            y1: "0%",
            x2: "100%",
            y2: "0%"
          }, [
            d("stop", {
              offset: "0%",
              "stop-color": t(e).style.layout.bars.left.color
            }, null, 8, le),
            d("stop", {
              offset: "100%",
              "stop-color": t(X)(t(gt)(t(e).style.layout.bars.left.color, t(e).style.layout.bars.gradient.shiftHue), 100 - t(e).style.layout.bars.gradient.intensity)
            }, null, 8, ae)
          ], 8, oe),
          d("linearGradient", {
            id: `age_pyramid_right_${t(x)}`,
            x1: "0%",
            y1: "0%",
            x2: "100%",
            y2: "0%"
          }, [
            d("stop", {
              offset: "0%",
              "stop-color": t(X)(t(gt)(t(e).style.layout.bars.right.color, t(e).style.layout.bars.gradient.shiftHue), 100 - t(e).style.layout.bars.gradient.intensity)
            }, null, 8, ie),
            d("stop", {
              offset: "100%",
              "stop-color": t(e).style.layout.bars.right.color
            }, null, 8, re)
          ], 8, se)
        ]),
        (r(!0), n(z, null, P(t(A), (l, a) => (r(), n("g", null, [
          d("rect", {
            x: l.left.x,
            y: l.left.y,
            width: t(c)(l.left.width <= 0 ? 1e-4 : l.left.width),
            height: l.left.height <= 0 ? 1e-4 : l.left.height,
            fill: t(e).style.layout.bars.gradient.underlayer,
            rx: t(e).style.layout.bars.borderRadius
          }, null, 8, ne),
          d("rect", {
            x: l.left.x,
            y: l.left.y,
            width: l.left.width <= 0 ? 1e-4 : l.left.width,
            height: l.left.height <= 0 ? 1e-4 : l.left.height,
            fill: t(e).style.layout.bars.gradient.show ? `url(#age_pyramid_left_${t(x)})` : l.left.color,
            rx: t(e).style.layout.bars.borderRadius
          }, null, 8, ue),
          d("rect", {
            x: l.right.x,
            y: l.right.y,
            width: l.right.width <= 0 ? 1e-4 : l.right.width,
            height: l.right.height <= 0 ? 1e-4 : l.right.height,
            fill: t(e).style.layout.bars.gradient.underlayer,
            rx: t(e).style.layout.bars.borderRadius
          }, null, 8, de),
          d("rect", {
            x: l.right.x,
            y: l.right.y,
            width: l.right.width <= 0 ? 1e-4 : l.right.width,
            height: l.right.height <= 0 ? 1e-4 : l.right.height,
            fill: t(e).style.layout.bars.gradient.show ? `url(#age_pyramid_right_${t(x)})` : l.right.color,
            rx: t(e).style.layout.bars.borderRadius
          }, null, 8, ye)
        ]))), 256)),
        d("g", null, [
          t(e).style.layout.dataLabels.sideTitles.show ? (r(), n("g", he, [
            d("text", {
              x: t(s).left,
              y: t(s).top + t(e).style.layout.dataLabels.sideTitles.offsetY,
              fill: t(e).style.layout.dataLabels.sideTitles.useSideColor ? t(e).style.layout.bars.left.color : t(e).style.layout.dataLabels.sideTitles.color,
              "font-size": t(e).style.layout.dataLabels.sideTitles.fontSize,
              "text-anchor": "start",
              "font-weight": t(e).style.layout.dataLabels.sideTitles.bold ? "bold" : "normal"
            }, w(t(e).translations.female), 9, fe),
            d("text", {
              x: t(s).right,
              y: t(s).top + t(e).style.layout.dataLabels.sideTitles.offsetY,
              fill: t(e).style.layout.dataLabels.sideTitles.useSideColor ? t(e).style.layout.bars.right.color : t(e).style.layout.dataLabels.sideTitles.color,
              "font-size": t(e).style.layout.dataLabels.sideTitles.fontSize,
              "text-anchor": "end",
              "font-weight": t(e).style.layout.dataLabels.sideTitles.bold ? "bold" : "normal"
            }, w(t(e).translations.male), 9, ce)
          ])) : h("", !0),
          t(e).style.layout.dataLabels.yAxis.show ? (r(), n("g", ge, [
            (r(!0), n(z, null, P(t(wt), (l, a) => (r(), n(z, null, [
              a % t(e).style.layout.dataLabels.yAxis.showEvery === 0 ? (r(), n("text", {
                key: 0,
                x: t(s).centerX,
                y: t(s).top + t(s).height / t(T) * a + t(e).style.layout.dataLabels.yAxis.fontSize / 3,
                "text-anchor": "middle",
                "font-size": t(e).style.layout.dataLabels.yAxis.fontSize,
                fill: t(e).style.layout.dataLabels.yAxis.color,
                "font-weight": t(e).style.layout.dataLabels.yAxis.bold ? "bold" : "normal"
              }, w(t(k)(
                t(e).style.layout.dataLabels.yAxis.formatter,
                l,
                t(_)({ v: l }),
                { datapoint: l, seriesIndex: a }
              )), 9, ve)) : h("", !0)
            ], 64))), 256))
          ])) : h("", !0),
          t(e).style.layout.dataLabels.xAxis.show ? (r(), n("g", pe, [
            t(e).style.layout.grid.show ? (r(), n("g", be, [
              d("line", {
                x1: t($).right[0].x,
                x2: t($).right.at(-1).x,
                y1: t(s).bottom + t(e).style.layout.dataLabels.xAxis.fontSize / 2,
                y2: t(s).bottom + t(e).style.layout.dataLabels.xAxis.fontSize / 2,
                stroke: t(e).style.layout.grid.stroke,
                "stroke-width": t(e).style.layout.grid.strokeWidth,
                "stroke-linecap": "round"
              }, null, 8, xe),
              d("line", {
                x1: t($).left[0].x,
                x2: t($).left.at(-1).x,
                y1: t(s).bottom + t(e).style.layout.dataLabels.xAxis.fontSize / 2,
                y2: t(s).bottom + t(e).style.layout.dataLabels.xAxis.fontSize / 2,
                stroke: t(e).style.layout.grid.stroke,
                "stroke-width": t(e).style.layout.grid.strokeWidth,
                "stroke-linecap": "round"
              }, null, 8, me)
            ])) : h("", !0),
            (r(!0), n(z, null, P(t($).right, (l, a) => (r(), n("g", null, [
              t(e).style.layout.grid.show ? (r(), n("line", {
                key: 0,
                x1: l.x,
                x2: l.x,
                y1: t(s).bottom + t(e).style.layout.dataLabels.xAxis.fontSize / 2,
                y2: t(s).bottom + t(e).style.layout.dataLabels.xAxis.fontSize / 4,
                stroke: t(e).style.layout.grid.stroke,
                "stroke-width": t(e).style.layout.grid.strokeWidth,
                "stroke-linecap": "round"
              }, null, 8, we)) : h("", !0),
              d("text", {
                x: l.x,
                y: t(s).bottom + t(e).style.layout.dataLabels.xAxis.fontSize * 2,
                "font-size": t(e).style.layout.dataLabels.xAxis.fontSize,
                fill: t(e).style.layout.dataLabels.xAxis.color,
                "text-anchor": "middle",
                "font-weight": t(e).style.layout.dataLabels.xAxis.bold ? "bold" : "normal"
              }, w(t(k)(
                t(e).style.layout.dataLabels.xAxis.formatter,
                l.value / t(e).style.layout.dataLabels.xAxis.scale,
                t(_)({
                  v: l.value / t(e).style.layout.dataLabels.xAxis.scale
                }),
                { datapoint: l, seriesIndex: a }
              )), 9, ke)
            ]))), 256)),
            (r(!0), n(z, null, P(t($).left, (l, a) => (r(), n("g", null, [
              t(e).style.layout.grid.show ? (r(), n("line", {
                key: 0,
                x1: l.x,
                x2: l.x,
                y1: t(s).bottom + t(e).style.layout.dataLabels.xAxis.fontSize / 2,
                y2: t(s).bottom + t(e).style.layout.dataLabels.xAxis.fontSize / 4,
                stroke: t(e).style.layout.grid.stroke,
                "stroke-width": t(e).style.layout.grid.strokeWidth,
                "stroke-linecap": "round"
              }, null, 8, _e)) : h("", !0),
              d("text", {
                x: l.x,
                y: t(s).bottom + t(e).style.layout.dataLabels.xAxis.fontSize * 2,
                "font-size": t(e).style.layout.dataLabels.xAxis.fontSize,
                fill: t(e).style.layout.dataLabels.xAxis.color,
                "text-anchor": "middle",
                "font-weight": t(e).style.layout.dataLabels.xAxis.bold ? "bold" : "normal"
              }, w(t(k)(
                t(e).style.layout.dataLabels.xAxis.formatter,
                l.value / t(e).style.layout.dataLabels.xAxis.scale,
                t(_)({
                  v: l.value / t(e).style.layout.dataLabels.xAxis.scale
                }),
                { datapoint: l, seriesIndex: a }
              )), 9, Ce)
            ]))), 256)),
            d("text", {
              x: t(s).right,
              y: t(v).height,
              "text-anchor": "end",
              "font-size": t(e).style.layout.dataLabels.xAxis.fontSize,
              fill: t(e).style.layout.dataLabels.xAxis.color,
              "font-weight": t(e).style.layout.dataLabels.xAxis.bold ? "bold" : "normal"
            }, w(t(e).style.layout.dataLabels.xAxis.translation), 9, $e)
          ])) : h("", !0)
        ]),
        (r(!0), n(z, null, P(j.dataset, (l, a) => (r(), n("g", null, [
          d("rect", {
            x: t(s).left,
            y: t(s).top + t(s).height / t(T) * a - t(e).style.layout.bars.gap / 2,
            width: t(s).width <= 0 ? 1e-4 : t(s).width,
            height: t(s).height / t(T) <= 0 ? 1e-4 : t(s).height / t(T),
            fill: t(N) !== null && t(N) === a ? t(X)(t(e).style.highlighter.color, t(e).style.highlighter.opacity) : "transparent",
            onMouseover: (u) => Ct(a, l),
            onMouseleave: i[0] || (i[0] = (u) => {
              N.value = null, G.value = !1;
            })
          }, null, 40, Te)
        ]))), 256)),
        f(o.$slots, "svg", { svg: t(v) }, void 0, !0)
      ], 14, te)) : h("", !0),
      o.$slots.watermark ? (r(), n("div", Ae, [
        f(o.$slots, "watermark", I(F({ isPrinting: t(at) || t(st) })), void 0, !0)
      ])) : h("", !0),
      t(M) ? h("", !0) : (r(), S(Ht, {
        key: 6,
        config: {
          type: "pyramid",
          style: {
            backgroundColor: t(e).style.backgroundColor,
            pyramid: {
              color: "#CCCCCC"
            }
          }
        }
      }, null, 8, ["config"])),
      f(o.$slots, "legend", { legend: t(A) }, void 0, !0),
      o.$slots.source ? (r(), n("div", {
        key: 7,
        ref_key: "source",
        ref: q,
        dir: "auto"
      }, [
        f(o.$slots, "source", {}, void 0, !0)
      ], 512)) : h("", !0),
      ft(Xt, {
        show: t(m).showTooltip && t(G),
        backgroundColor: t(e).style.tooltip.backgroundColor,
        color: t(e).style.tooltip.color,
        borderRadius: t(e).style.tooltip.borderRadius,
        borderColor: t(e).style.tooltip.borderColor,
        borderWidth: t(e).style.tooltip.borderWidth,
        fontSize: t(e).style.tooltip.fontSize,
        backgroundOpacity: t(e).style.tooltip.backgroundOpacity,
        position: t(e).style.tooltip.position,
        offsetY: t(e).style.tooltip.offsetY,
        parent: t(C),
        content: t(U),
        isFullscreen: t(L),
        isCustom: t(e).style.tooltip.customFormat && typeof t(e).style.tooltip.customFormat == "function"
      }, {
        "tooltip-before": p(() => [
          f(o.$slots, "tooltip-before", I(F({ ...t(E) })), void 0, !0)
        ]),
        "tooltip-after": p(() => [
          f(o.$slots, "tooltip-after", I(F({ ...t(E) })), void 0, !0)
        ]),
        _: 3
      }, 8, ["show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "fontSize", "backgroundOpacity", "position", "offsetY", "parent", "content", "isFullscreen", "isCustom"]),
      t(M) ? (r(), S(Yt, {
        key: 8,
        hideDetails: "",
        config: {
          open: t(m).showTable,
          maxHeight: 1e4,
          body: {
            backgroundColor: t(e).style.backgroundColor,
            color: t(e).style.color
          },
          head: {
            backgroundColor: t(e).style.backgroundColor,
            color: t(e).style.color
          }
        }
      }, {
        content: p(() => [
          (r(), S(jt, {
            key: `table_${t(Q)}`,
            colNames: t(R).colNames,
            head: t(R).head,
            body: t(R).body,
            config: t(R).config,
            title: `${t(e).style.title.text}${t(e).style.title.subtitle.text ? ` : ${t(e).style.title.subtitle.text}` : ""}`,
            onClose: i[1] || (i[1] = (l) => t(m).showTable = !1)
          }, {
            th: p(({ th: l }) => [
              ct(w(l), 1)
            ]),
            td: p(({ td: l }) => [
              ct(w(l), 1)
            ]),
            _: 1
          }, 8, ["colNames", "head", "body", "config", "title"]))
        ]),
        _: 1
      }, 8, ["config"])) : h("", !0)
    ], 46, Zt));
  }
}, Ve = /* @__PURE__ */ Qt(Le, [["__scopeId", "data-v-5ebef784"]]);
export {
  Ve as default
};
