import { computed as m, ref as v, watch as de, onMounted as ve, onBeforeUnmount as Ne, openBlock as o, createElementBlock as r, normalizeClass as he, normalizeStyle as H, createBlock as L, createCommentVNode as y, unref as d, createSlots as Te, withCtx as _, renderSlot as k, normalizeProps as W, guardReactiveProps as R, createVNode as Pe, Fragment as w, renderList as $, createElementVNode as n, toDisplayString as A, createTextVNode as ye, nextTick as Ge } from "vue";
import { u as De, c as fe, t as Ie, o as Me, e as be, g as Oe, v as ge, D as Fe, f as z, X as pe, i as B, l as me, h as _e, q as Ve, r as Ee } from "./index-Cm2_6s9o.js";
import { t as He, u as We } from "./useResponsive-CoxXLe23.js";
import { _ as Re } from "./Title-Coit3NcT.js";
import { u as Be, U as Ue } from "./usePrinter-Cx8U1e30.js";
import { D as je } from "./DataTable-NGi-FgLM.js";
import qe from "./vue-ui-skeleton-BUS6A44x.js";
import { L as Ye } from "./Legend-DRozxv9L.js";
import Ze from "./vue-ui-accordion-CxrNF8BI.js";
import { u as ke } from "./useNestedProp-BYPZJNhi.js";
import { _ as Je } from "./PackageVersion-CTMY4zeY.js";
import { P as Ke } from "./PenAndPaper-DJ_d10S-.js";
import { _ as Qe } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const et = ["id"], tt = ["xmlns", "viewBox"], lt = { key: 0 }, at = ["x1", "x2", "y1", "y2", "stroke", "stroke-width", "stroke-dasharray"], st = { key: 1 }, ot = ["x1", "x2", "y1", "y2", "stroke", "stroke-width", "stroke-dasharray"], rt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width", "stroke-dasharray"], nt = { key: 2 }, ut = ["x", "y", "font-size", "fill", "font-weight"], it = ["x", "y", "font-size", "fill"], ct = { key: 3 }, dt = ["x", "y", "font-size", "fill", "font-weight"], vt = ["id"], ht = ["stop-color"], yt = ["stop-color"], ft = ["stop-color"], bt = ["id"], gt = ["stop-color"], pt = ["stop-color"], mt = ["stop-color"], _t = ["id"], kt = ["stop-color"], xt = ["stop-color"], Ct = ["id"], wt = ["stop-color"], $t = ["stop-color"], Lt = { key: 0 }, At = ["d", "fill"], zt = { key: 1 }, Xt = ["x", "y", "height", "width", "fill"], St = ["cx", "cy", "r", "fill", "stroke", "stroke-width"], Nt = ["cx", "cy", "r", "fill", "stroke", "stroke-width"], Tt = { key: 2 }, Pt = ["x", "y", "fill", "font-size"], Gt = { key: 3 }, Dt = ["x", "y", "fill", "font-size"], It = {
  key: 5,
  class: "vue-data-ui-watermark"
}, Mt = ["xmlns", "height", "width"], Ot = ["fill"], Ft = ["innerHTML"], Vt = {
  __name: "vue-ui-dumbbell",
  props: {
    config: {
      type: Object,
      default() {
        return {};
      }
    },
    dataset: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  emits: ["selectDatapoint"],
  setup(xe, { expose: Ce, emit: Et }) {
    const p = xe, { vue_ui_dumbbell: we } = De(), X = m({
      get() {
        return !!p.dataset && p.dataset.length;
      },
      set(l) {
        return l;
      }
    }), f = v(fe()), U = v(0), S = v(null), j = v(null), q = v(null), Y = v(null), Z = v(null), J = v(0), K = v(0), Q = v(0), e = m({
      get: () => ee(),
      set: (l) => l
    });
    function ee() {
      const l = ke({
        userConfig: p.config,
        defaultConfig: we
      });
      return l.theme ? {
        ...ke({
          userConfig: Ie.vue_ui_dumbbell[l.theme] || p.config,
          defaultConfig: l
        })
      } : l;
    }
    de(() => p.config, (l) => {
      e.value = ee(), te(), J.value += 1, K.value += 1, Q.value += 1, h.value = e.value.style.chart.rowHeight, N.value = e.value.style.chart.width;
    }, { deep: !0 }), de(() => p.dataset, (l) => {
      ne();
    }, { deep: !0 });
    const P = v(null);
    ve(() => {
      te();
    });
    function te() {
      if (Me(p.dataset) ? be({
        componentName: "VueUiDumbbell",
        type: "dataset"
      }) : p.dataset.forEach((l, u) => {
        Oe({
          datasetObject: l,
          requiredAttributes: ["name", "start", "end"]
        }).forEach((t) => {
          X.value = !1, be({
            componentName: "VueUiDumbbell",
            type: "datasetSerieAttribute",
            property: t,
            index: u
          });
        });
      }), e.value.responsive) {
        const l = He(() => {
          const { width: u, height: t } = We({
            chart: S.value,
            title: e.value.style.chart.title.text ? j.value : null,
            legend: e.value.style.chart.legend.show ? q.value : null,
            source: Y.value,
            noTitle: Z.value
          });
          N.value = u, h.value = t / p.dataset.length, b.value = D();
        });
        P.value = new ResizeObserver(l), P.value.observe(S.value.parentNode);
      }
    }
    Ne(() => {
      P.value && P.value.disconnect();
    });
    const { isPrinting: le, isImaging: ae, generatePdf: se, generateImage: oe } = Be({
      elementId: `dumbbell_${f.value}`,
      fileName: e.value.style.chart.title.text || "vue-ui-dumbbell"
    }), $e = m(() => e.value.userOptions.show && !e.value.style.chart.title.text), G = v({
      showTable: e.value.table.show
    }), x = m(() => p.dataset.map((l, u) => ({
      ...l,
      start: ge(l.start),
      end: ge(l.end),
      id: fe()
    }))), F = m(() => ({
      max: Math.max(...x.value.flatMap((l) => [l.start, l.end])),
      min: Math.min(...x.value.flatMap((l) => [l.start, l.end]))
    })), c = m(() => Fe(F.value.min < 0 ? F.value.min : 0, F.value.max, e.value.style.chart.grid.scaleSteps)), h = v(e.value.style.chart.rowHeight), N = v(e.value.style.chart.width), s = m(() => {
      const l = h.value, u = e.value.style.chart.padding.left + e.value.style.chart.padding.right + N.value, t = e.value.style.chart.padding.top + e.value.style.chart.padding.bottom + l * p.dataset.length, a = c.value.ticks.length * (N.value / c.value.ticks.length);
      return {
        left: e.value.style.chart.padding.left,
        right: u - e.value.style.chart.padding.right,
        top: e.value.style.chart.padding.top,
        bottom: t - e.value.style.chart.padding.bottom,
        width: N.value,
        height: l * p.dataset.length,
        rowHeight: l,
        absoluteHeight: t,
        absoluteWidth: u,
        widthPlotReference: a
      };
    });
    function D() {
      return x.value.map((l, u) => {
        const t = s.value.left + (l.start + Math.abs(c.value.min)) / (c.value.max + Math.abs(c.value.min)) * s.value.widthPlotReference, a = s.value.left + (l.end + Math.abs(c.value.min)) / (c.value.max + Math.abs(c.value.min)) * s.value.widthPlotReference, i = t + (a - t) / 2;
        return {
          ...l,
          startX: t,
          endX: a,
          centerX: i,
          y: s.value.top + u * h.value + h.value / 2,
          endVal: l.start
        };
      });
    }
    const b = v([]), re = v(null), Le = m(() => x.value.map((l) => l.end).reduce((l, u) => l + u, 0));
    ve(() => {
      ne();
    });
    function ne() {
      b.value = D();
      let l = b.value.map((t) => t.start).reduce((t, a) => t + a, 0);
      function u() {
        const t = x.value.map((a) => a.end - a.start);
        l >= Le.value ? (cancelAnimationFrame(re.value), b.value = D()) : (b.value = b.value.map((a, i) => {
          a.endVal += t[i] * (e.value.animationSpeed / 100);
          const g = s.value.left + (a.start + Math.abs(c.value.min)) / (c.value.max + Math.abs(c.value.min)) * s.value.widthPlotReference, O = s.value.left + (a.endVal + Math.abs(c.value.min)) / (c.value.max + Math.abs(c.value.min)) * s.value.widthPlotReference, E = g + (O - g) / 2;
          return {
            ...a,
            startX: g,
            endX: O,
            centerX: E,
            y: s.value.top + i * h.value + h.value / 2,
            endVal: a.endVal
          };
        }), l = b.value.map((a) => a.endVal).reduce((a, i) => a + i, 0), re.value = requestAnimationFrame(u));
      }
      e.value.useAnimation ? u() : b.value = D();
    }
    const ue = m(() => [
      { name: e.value.style.chart.legend.labelStart, color: e.value.style.chart.plots.gradient.show ? `url(#start_grad_${f.value})` : e.value.style.chart.plots.startColor },
      { name: e.value.style.chart.legend.labelEnd, color: e.value.style.chart.plots.gradient.show ? `url(#end_grad_${f.value})` : e.value.style.chart.plots.endColor }
    ]), Ae = m(() => ({
      cy: "donut-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,
      paddingTop: 12,
      fontWeight: e.value.style.chart.legend.bold ? "bold" : ""
    })), C = m(() => {
      const l = b.value.map((t) => ({
        name: t.name
      })), u = b.value.map((t) => ({
        start: t.start,
        end: t.end
      }));
      return { head: l, body: u };
    }), I = m(() => {
      const l = [
        e.value.table.columnNames.series,
        e.value.table.columnNames.start,
        e.value.table.columnNames.end,
        e.value.table.columnNames.progression
      ], u = C.value.head.map((i, g) => {
        const O = z({
          p: e.value.style.chart.labels.prefix,
          v: C.value.body[g].start,
          s: e.value.style.chart.labels.suffix,
          r: e.value.table.td.roundingValue
        }), E = z({
          p: e.value.style.chart.labels.prefix,
          v: C.value.body[g].end,
          s: e.value.style.chart.labels.suffix,
          r: e.value.table.td.roundingValue
        }), Se = z({
          v: 100 * (C.value.body[g].end / C.value.body[g].start - 1),
          s: "%",
          r: e.value.table.td.roundingPercentage
        });
        return [
          { name: i.name },
          O,
          E,
          Se
        ];
      }), t = {
        th: {
          backgroundColor: e.value.table.th.backgroundColor,
          color: e.value.table.th.color,
          outline: e.value.table.th.outline
        },
        td: {
          backgroundColor: e.value.table.td.backgroundColor,
          color: e.value.table.td.color,
          outline: e.value.table.td.outline
        },
        breakpoint: e.value.table.responsiveBreakpoint
      };
      return {
        colNames: [
          e.value.table.columnNames.series,
          e.value.table.columnNames.start,
          e.value.table.columnNames.end,
          e.value.table.columnNames.progression
        ],
        head: l,
        body: u,
        config: t
      };
    });
    function ie() {
      Ge(() => {
        const l = C.value.head.map((a, i) => [[
          a.name
        ], [C.value.body[i].start], [C.value.body[i].end]]), u = [[e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [[e.value.table.columnNames.series], [e.value.table.columnNames.start], [e.value.table.columnNames.end]]].concat(l), t = Ve(u);
        Ee({ csvContent: t, title: e.value.style.chart.title.text || "vue-ui-dumbbell" });
      });
    }
    const T = v(!1);
    function ze(l) {
      T.value = l, U.value += 1;
    }
    function Xe() {
      return b.value;
    }
    function ce() {
      G.value.showTable = !G.value.showTable;
    }
    const M = v(!1);
    function V() {
      M.value = !M.value;
    }
    return Ce({
      getData: Xe,
      generatePdf: se,
      generateCsv: ie,
      generateImage: oe,
      toggleTable: ce,
      toggleAnnotator: V
    }), (l, u) => (o(), r("div", {
      ref_key: "dumbbellChart",
      ref: S,
      class: he(`vue-ui-dumbbell ${T.value ? "vue-data-ui-wrapper-fullscreen" : ""}`),
      style: H(`font-family:${e.value.style.fontFamily};width:100%; text-align:center;background:${e.value.style.chart.backgroundColor};${e.value.responsive ? "height:100%" : ""}`),
      id: `dumbbell_${f.value}`
    }, [
      e.value.userOptions.buttons.annotator ? (o(), L(Ke, {
        key: 0,
        parent: S.value,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        active: M.value,
        onClose: V
      }, null, 8, ["parent", "backgroundColor", "color", "active"])) : y("", !0),
      $e.value ? (o(), r("div", {
        key: 1,
        ref_key: "noTitle",
        ref: Z,
        class: "vue-data-ui-no-title-space",
        style: "height:36px; width: 100%;background:transparent"
      }, null, 512)) : y("", !0),
      e.value.style.chart.title.text ? (o(), r("div", {
        key: 2,
        ref_key: "chartTitle",
        ref: j,
        style: "width:100%;background:transparent;padding-bottom:24px"
      }, [
        (o(), L(Re, {
          key: `title_${J.value}`,
          config: {
            title: {
              cy: "donut-div-title",
              ...e.value.style.chart.title
            },
            subtitle: {
              cy: "donut-div-subtitle",
              ...e.value.style.chart.title.subtitle
            }
          }
        }, null, 8, ["config"]))
      ], 512)) : y("", !0),
      e.value.userOptions.show && X.value ? (o(), L(Ue, {
        ref: "details",
        key: `user_option_${U.value}`,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        isPrinting: d(le),
        isImaging: d(ae),
        uid: f.value,
        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: T.value,
        titles: { ...e.value.userOptions.buttonTitles },
        chartElement: S.value,
        position: e.value.userOptions.position,
        hasAnnotator: e.value.userOptions.buttons.annotator,
        isAnnotation: M.value,
        onToggleFullscreen: ze,
        onGeneratePdf: d(se),
        onGenerateCsv: ie,
        onGenerateImage: d(oe),
        onToggleTable: ce,
        onToggleAnnotator: V
      }, Te({ _: 2 }, [
        l.$slots.optionPdf ? {
          name: "optionPdf",
          fn: _(() => [
            k(l.$slots, "optionPdf", {}, void 0, !0)
          ]),
          key: "0"
        } : void 0,
        l.$slots.optionCsv ? {
          name: "optionCsv",
          fn: _(() => [
            k(l.$slots, "optionCsv", {}, void 0, !0)
          ]),
          key: "1"
        } : void 0,
        l.$slots.optionImg ? {
          name: "optionImg",
          fn: _(() => [
            k(l.$slots, "optionImg", {}, void 0, !0)
          ]),
          key: "2"
        } : void 0,
        l.$slots.optionTable ? {
          name: "optionTable",
          fn: _(() => [
            k(l.$slots, "optionTable", {}, void 0, !0)
          ]),
          key: "3"
        } : void 0,
        l.$slots.optionFullscreen ? {
          name: "optionFullscreen",
          fn: _(({ toggleFullscreen: t, isFullscreen: a }) => [
            k(l.$slots, "optionFullscreen", W(R({ toggleFullscreen: t, isFullscreen: a })), void 0, !0)
          ]),
          key: "4"
        } : void 0,
        l.$slots.optionAnnotator ? {
          name: "optionAnnotator",
          fn: _(({ toggleAnnotator: t, isAnnotator: a }) => [
            k(l.$slots, "optionAnnotator", W(R({ toggleAnnotator: t, isAnnotator: a })), void 0, !0)
          ]),
          key: "5"
        } : void 0
      ]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasPdf", "hasXls", "hasImg", "hasTable", "hasFullscreen", "isFullscreen", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage"])) : y("", !0),
      X.value ? (o(), r("svg", {
        key: 4,
        xmlns: d(pe),
        class: he({ "vue-data-ui-fullscreen--on": T.value, "vue-data-ui-fulscreen--off": !T.value }),
        viewBox: `0 0 ${s.value.absoluteWidth <= 0 ? 10 : s.value.absoluteWidth} ${s.value.absoluteHeight <= 0 ? 10 : s.value.absoluteHeight}`,
        style: H(`max-width:100%; overflow: visible; background:transparent;color:${e.value.style.chart.color}`)
      }, [
        Pe(Je),
        e.value.style.chart.grid.verticalGrid.show ? (o(), r("g", lt, [
          (o(!0), r(w, null, $(c.value.ticks, (t, a) => (o(), r("line", {
            x1: s.value.left + a * s.value.width / (c.value.ticks.length - 1),
            x2: s.value.left + a * s.value.width / (c.value.ticks.length - 1),
            y1: s.value.top,
            y2: s.value.bottom,
            stroke: e.value.style.chart.grid.verticalGrid.stroke,
            "stroke-width": e.value.style.chart.grid.verticalGrid.strokeWidth,
            "stroke-dasharray": e.value.style.chart.grid.verticalGrid.strokeDasharray
          }, null, 8, at))), 256))
        ])) : y("", !0),
        e.value.style.chart.grid.horizontalGrid.show ? (o(), r("g", st, [
          (o(!0), r(w, null, $(x.value, (t, a) => (o(), r("line", {
            x1: s.value.left,
            x2: s.value.right,
            y1: s.value.top + a * h.value,
            y2: s.value.top + a * h.value,
            stroke: e.value.style.chart.grid.horizontalGrid.stroke,
            "stroke-width": e.value.style.chart.grid.horizontalGrid.strokeWidth,
            "stroke-dasharray": e.value.style.chart.grid.horizontalGrid.strokeDasharray
          }, null, 8, ot))), 256)),
          n("line", {
            x1: s.value.left,
            x2: s.value.right,
            y1: s.value.bottom,
            y2: s.value.bottom,
            stroke: e.value.style.chart.grid.horizontalGrid.stroke,
            "stroke-width": e.value.style.chart.grid.horizontalGrid.strokeWidth,
            "stroke-dasharray": e.value.style.chart.grid.horizontalGrid.strokeDasharray
          }, null, 8, rt)
        ])) : y("", !0),
        e.value.style.chart.labels.yAxisLabels.show ? (o(), r("g", nt, [
          (o(!0), r(w, null, $(x.value, (t, a) => (o(), r("text", {
            x: s.value.left - 6 + e.value.style.chart.labels.yAxisLabels.offsetX,
            y: s.value.top + a * h.value + (e.value.style.chart.labels.yAxisLabels.showProgression ? h.value / 3 : h.value / 2) + e.value.style.chart.labels.yAxisLabels.fontSize / 3,
            "font-size": e.value.style.chart.labels.yAxisLabels.fontSize,
            fill: e.value.style.chart.labels.yAxisLabels.color,
            "font-weight": e.value.style.chart.labels.yAxisLabels.bold ? "bold" : "normal",
            "text-anchor": "end"
          }, A(t.name), 9, ut))), 256)),
          e.value.style.chart.labels.yAxisLabels.showProgression ? (o(!0), r(w, { key: 0 }, $(x.value, (t, a) => (o(), r("text", {
            x: s.value.left - 6 + e.value.style.chart.labels.yAxisLabels.offsetX,
            y: s.value.top + a * h.value + h.value / 1.3 + e.value.style.chart.labels.yAxisLabels.fontSize / 3,
            "font-size": e.value.style.chart.labels.yAxisLabels.fontSize,
            fill: e.value.style.chart.labels.yAxisLabels.color,
            "text-anchor": "end"
          }, A(d(z)({
            v: 100 * (t.end / t.start - 1),
            s: "%",
            r: e.value.style.chart.labels.yAxisLabels.rounding
          })), 9, it))), 256)) : y("", !0)
        ])) : y("", !0),
        e.value.style.chart.labels.xAxisLabels.show ? (o(), r("g", ct, [
          (o(!0), r(w, null, $(c.value.ticks, (t, a) => (o(), r("text", {
            x: s.value.left + a * (s.value.width / (c.value.ticks.length - 1)),
            y: s.value.bottom + e.value.style.chart.labels.xAxisLabels.fontSize + e.value.style.chart.labels.xAxisLabels.offsetY,
            "font-size": e.value.style.chart.labels.xAxisLabels.fontSize,
            fill: e.value.style.chart.labels.xAxisLabels.color,
            "font-weight": e.value.style.chart.labels.xAxisLabels.bold ? "bold" : "normal",
            "text-anchor": "middle"
          }, A(d(B)(
            e.value.style.chart.labels.formatter,
            t,
            d(z)({
              p: e.value.style.chart.labels.prefix,
              v: t,
              s: e.value.style.chart.labels.suffix,
              r: e.value.style.chart.labels.xAxisLabels.rounding
            }),
            { datapoint: t, seriesIndex: a }
          )), 9, dt))), 256))
        ])) : y("", !0),
        n("defs", null, [
          n("radialGradient", {
            id: `start_grad_${f.value}`,
            fy: "30%"
          }, [
            n("stop", {
              offset: "10%",
              "stop-color": d(me)(e.value.style.chart.plots.startColor, e.value.style.chart.plots.gradient.intensity / 100)
            }, null, 8, ht),
            n("stop", {
              offset: "90%",
              "stop-color": d(_e)(e.value.style.chart.plots.startColor, 0.1)
            }, null, 8, yt),
            n("stop", {
              offset: "100%",
              "stop-color": e.value.style.chart.plots.startColor
            }, null, 8, ft)
          ], 8, vt),
          n("radialGradient", {
            id: `end_grad_${f.value}`,
            fy: "30%"
          }, [
            n("stop", {
              offset: "10%",
              "stop-color": d(me)(e.value.style.chart.plots.endColor, e.value.style.chart.plots.gradient.intensity / 100)
            }, null, 8, gt),
            n("stop", {
              offset: "90%",
              "stop-color": d(_e)(e.value.style.chart.plots.endColor, 0.1)
            }, null, 8, pt),
            n("stop", {
              offset: "100%",
              "stop-color": e.value.style.chart.plots.endColor
            }, null, 8, mt)
          ], 8, bt)
        ]),
        (o(!0), r(w, null, $(b.value, (t, a) => (o(), r("g", null, [
          n("defs", null, [
            n("linearGradient", {
              id: `grad_positive_${f.value}`,
              x1: "0%",
              x2: "100%",
              y1: "0%",
              y2: "0%"
            }, [
              n("stop", {
                offset: "0%",
                "stop-color": e.value.style.chart.plots.startColor
              }, null, 8, kt),
              n("stop", {
                offset: "100%",
                "stop-color": e.value.style.chart.plots.endColor
              }, null, 8, xt)
            ], 8, _t),
            n("linearGradient", {
              id: `grad_negative_${f.value}`,
              x1: "0%",
              x2: "100%",
              y1: "0%",
              y2: "0%"
            }, [
              n("stop", {
                offset: "0%",
                "stop-color": e.value.style.chart.plots.endColor
              }, null, 8, wt),
              n("stop", {
                offset: "100%",
                "stop-color": e.value.style.chart.plots.startColor
              }, null, 8, $t)
            ], 8, Ct)
          ]),
          e.value.style.chart.plots.link.type === "curved" ? (o(), r("g", Lt, [
            n("path", {
              d: `M 
                            ${t.startX},${t.y + e.value.style.chart.plots.radius / 2} 
                            C ${t.centerX},${t.y} ${t.centerX},${t.y} 
                            ${t.endX},${t.y + e.value.style.chart.plots.radius / 2}
                            L ${t.endX},${t.y - e.value.style.chart.plots.radius / 2}
                            C ${t.centerX},${t.y} ${t.centerX},${t.y}
                            ${t.startX},${t.y - e.value.style.chart.plots.radius / 2}
                            Z
                        `,
              fill: t.endX > t.startX ? `url(#grad_positive_${f.value})` : `url(#grad_negative_${f.value})`
            }, null, 8, At)
          ])) : (o(), r("g", zt, [
            n("rect", {
              x: t.endX > t.startX ? t.startX : t.endX,
              y: t.y - e.value.style.chart.plots.link.strokeWidth / 2,
              height: e.value.style.chart.plots.link.strokeWidth,
              width: Math.abs(t.endX - t.startX),
              fill: t.endX > t.startX ? `url(#grad_positive_${f.value})` : `url(#grad_negative_${f.value})`
            }, null, 8, Xt)
          ])),
          n("circle", {
            cx: t.startX,
            cy: t.y,
            r: e.value.style.chart.plots.radius,
            fill: e.value.style.chart.plots.gradient.show ? `url(#start_grad_${f.value})` : e.value.style.chart.plots.startColor,
            stroke: e.value.style.chart.plots.stroke,
            "stroke-width": e.value.style.chart.plots.strokeWidth
          }, null, 8, St),
          n("circle", {
            cx: t.endX,
            cy: t.y,
            r: e.value.style.chart.plots.radius,
            fill: e.value.style.chart.plots.gradient.show ? `url(#end_grad_${f.value})` : e.value.style.chart.plots.endColor,
            stroke: e.value.style.chart.plots.stroke,
            "stroke-width": e.value.style.chart.plots.strokeWidth
          }, null, 8, Nt),
          e.value.style.chart.labels.startLabels.show ? (o(), r("g", Tt, [
            (o(!0), r(w, null, $(b.value, (i, g) => (o(), r("text", {
              x: i.startX,
              y: s.value.top + (g + 1) * h.value - e.value.style.chart.labels.startLabels.fontSize / 3 + e.value.style.chart.labels.startLabels.offsetY,
              fill: e.value.style.chart.labels.startLabels.useStartColor ? e.value.style.chart.plots.startColor : e.value.style.chart.labels.startLabels.color,
              "font-size": e.value.style.chart.labels.startLabels.fontSize,
              "text-anchor": "middle"
            }, A(d(B)(
              e.value.style.chart.labels.formatter,
              i.start,
              d(z)({
                p: e.value.style.chart.labels.prefix,
                v: i.start,
                s: e.value.style.chart.labels.suffix,
                r: e.value.style.chart.labels.startLabels.rounding
              }),
              { datapoint: i, seriesIndex: g }
            )), 9, Pt))), 256))
          ])) : y("", !0),
          e.value.style.chart.labels.endLabels.show ? (o(), r("g", Gt, [
            (o(!0), r(w, null, $(b.value, (i, g) => (o(), r("text", {
              x: i.endX,
              y: s.value.top + g * h.value + e.value.style.chart.labels.endLabels.fontSize + e.value.style.chart.labels.endLabels.offsetY,
              fill: e.value.style.chart.labels.endLabels.useEndColor ? e.value.style.chart.plots.endColor : e.value.style.chart.labels.endLabels.color,
              "font-size": e.value.style.chart.labels.endLabels.fontSize,
              "text-anchor": "middle"
            }, A(d(B)(
              e.value.style.chart.labels.formatter,
              i.end,
              d(z)({
                p: e.value.style.chart.labels.prefix,
                v: i.end,
                s: e.value.style.chart.labels.suffix,
                r: e.value.style.chart.labels.endLabels.rounding
              }),
              { datapoint: i, seriesIndex: g }
            )), 9, Dt))), 256))
          ])) : y("", !0)
        ]))), 256)),
        k(l.$slots, "svg", { svg: s.value }, void 0, !0)
      ], 14, tt)) : y("", !0),
      l.$slots.watermark ? (o(), r("div", It, [
        k(l.$slots, "watermark", W(R({ isPrinting: d(le) || d(ae) })), void 0, !0)
      ])) : y("", !0),
      X.value ? y("", !0) : (o(), L(qe, {
        key: 6,
        config: {
          type: "dumbbell",
          style: {
            backgroundColor: e.value.style.chart.backgroundColor,
            dumbbell: {
              color: "#CCCCCC"
            }
          }
        }
      }, null, 8, ["config"])),
      n("div", {
        ref_key: "chartLegend",
        ref: q
      }, [
        e.value.style.chart.legend.show && X.value ? (o(), L(Ye, {
          key: `legend_${Q.value}`,
          legendSet: ue.value,
          config: Ae.value
        }, {
          item: _(({ legend: t }) => [
            n("div", {
              style: H(`display:flex;align-items:center;gap:4px;font-size:${e.value.style.chart.legend.fontSize}px`)
            }, [
              (o(), r("svg", {
                xmlns: d(pe),
                viewBox: "0 0 20 20",
                height: e.value.style.chart.legend.fontSize,
                width: e.value.style.chart.legend.fontSize
              }, [
                n("circle", {
                  cx: 10,
                  cy: 10,
                  r: 9,
                  fill: t.color
                }, null, 8, Ot)
              ], 8, Mt)),
              ye(" " + A(t.name), 1)
            ], 4)
          ]),
          _: 1
        }, 8, ["legendSet", "config"])) : k(l.$slots, "legend", {
          key: 1,
          legend: ue.value
        }, void 0, !0)
      ], 512),
      l.$slots.source ? (o(), r("div", {
        key: 7,
        ref_key: "source",
        ref: Y,
        dir: "auto"
      }, [
        k(l.$slots, "source", {}, void 0, !0)
      ], 512)) : y("", !0),
      X.value ? (o(), L(Ze, {
        key: 8,
        hideDetails: "",
        config: {
          open: G.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: _(() => [
          (o(), L(je, {
            key: `table_${K.value}`,
            colNames: I.value.colNames,
            head: I.value.head,
            body: I.value.body,
            config: I.value.config,
            title: `${e.value.style.chart.title.text}${e.value.style.chart.title.subtitle.text ? ` : ${e.value.style.chart.title.subtitle.text}` : ""}`,
            onClose: u[0] || (u[0] = (t) => G.value.showTable = !1)
          }, {
            th: _(({ th: t }) => [
              n("div", {
                innerHTML: t,
                style: { display: "flex", "align-items": "center" }
              }, null, 8, Ft)
            ]),
            td: _(({ td: t }) => [
              ye(A(t.name || t), 1)
            ]),
            _: 1
          }, 8, ["colNames", "head", "body", "config", "title"]))
        ]),
        _: 1
      }, 8, ["config"])) : y("", !0)
    ], 14, et));
  }
}, tl = /* @__PURE__ */ Qe(Vt, [["__scopeId", "data-v-d151e2f0"]]);
export {
  tl as default
};
