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