import { computed as k, ref as g, watch as He, onMounted as Je, onBeforeUnmount as Ke, openBlock as o, createElementBlock as r, normalizeClass as Fe, normalizeStyle as R, createBlock as q, createCommentVNode as d, unref as y, createSlots as Qe, withCtx as w, renderSlot as T, normalizeProps as ae, guardReactiveProps as oe, createVNode as ce, createElementVNode as c, Fragment as W, renderList as X, toDisplayString as M, createTextVNode as Ze, nextTick as et } from "vue";
import { u as tt, c as lt, t as at, a as ot, p as U, o as st, e as de, b as ut, g as Oe, R as Xe, X as rt, T as it, s as he, i as Y, v as $, f as P, x as nt, y as yt, q as vt, r as ct } from "./index-DK7qqHGP.js";
import { t as dt, u as ht } from "./useResponsive-NZB-WLRF.js";
import { _ as pt } from "./Title-Cxlu3Etv.js";
import { u as ft, U as gt } from "./usePrinter-Cza87yNE.js";
import { _ as xt } from "./Tooltip-Bt9pHzBM.js";
import { L as mt } from "./Legend-D4PxDNTf.js";
import { _ as Ie } from "./Shape-DVc7K58k.js";
import { D as bt } from "./DataTable-B9SSwFM2.js";
import kt from "./vue-ui-skeleton-CQnYuosp.js";
import _t from "./vue-ui-accordion-5C4CP3gA.js";
import { u as De } from "./useNestedProp-0nRX_rTi.js";
import { _ as wt } from "./PackageVersion-I1_4jcn_.js";
import { _ as Mt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const $t = ["id"], Ct = ["xmlns", "viewBox"], zt = { key: 0 }, St = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], At = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Lt = { key: 1 }, Tt = ["points", "fill", "stroke-width", "stroke-dasharray", "stroke"], Bt = { key: 0 }, Nt = ["cx", "cy", "r", "fill", "stroke", "stroke-width", "onMouseover"], Wt = { key: 1 }, Pt = { key: 2 }, Ft = ["id"], Ot = ["stop-color"], Xt = ["stop-color"], It = ["id"], Dt = ["stop-color"], Yt = ["stop-color"], jt = ["x", "y", "width", "height", "fill", "stroke", "stroke-width", "rx"], Et = ["x", "y", "height", "width", "fill", "stroke", "stroke-width", "rx"], Vt = { key: 0 }, Gt = ["d", "stroke", "stroke-width"], Rt = ["d", "stroke", "stroke-width"], qt = ["d", "stroke", "stroke-width"], Ut = ["d", "stroke", "stroke-width"], Ht = {
  key: 3,
  style: { "pointer-events": "none !important" }
}, Jt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width", "stroke-dasharray"], Kt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width", "stroke-dasharray"], Qt = ["x", "y", "font-size", "fill", "font-weight", "text-anchor"], Zt = ["x", "y", "font-size", "fill", "font-weight"], el = ["cx", "cy", "r", "fill", "stroke", "stroke-width"], tl = ["cx", "cy", "r", "fill", "stroke", "stroke-width"], ll = ["x", "y", "font-size", "fill", "font-weight", "text-anchor"], al = { key: 4 }, ol = ["x", "y", "font-size", "fill"], sl = ["x", "y", "font-size", "fill"], ul = ["id", "transform", "font-size", "font-weight", "fill"], rl = { key: 5 }, il = ["x", "y", "font-size", "fill"], nl = ["x", "y", "font-size", "fill"], yl = ["font-size", "font-weight", "fill", "x", "y"], vl = ["id"], cl = ["x", "y", "width", "height"], dl = { key: 6 }, hl = ["x1", "x2", "y1", "y2", "stroke-dasharray", "stroke", "stroke-width", "clip-path"], pl = ["x", "y", "fill", "font-size", "font-weight"], fl = {
  key: 3,
  class: "vue-data-ui-watermark"
}, gl = ["onClick"], xl = {
  key: 0,
  style: { width: "100%", display: "flex", "align-items": "center", "justify-content": "center" }
}, ml = {
  viewBox: "0 0 20 20",
  height: "20",
  width: "20",
  style: { overflow: "hidden", background: "transparent" }
}, bl = { key: 0 }, kl = ["innerHTML"], _l = {
  __name: "vue-ui-scatter",
  props: {
    config: {
      type: Object,
      default() {
        return {};
      }
    },
    dataset: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  setup(Ye, { expose: je }) {
    const F = Ye, { vue_ui_scatter: Ee } = tt(), Q = k(() => !!F.dataset && F.dataset.length), C = g(lt()), Ve = g(null), se = g(!1), ue = g(""), pe = g(0), J = g(null), fe = g(null), ge = g(null), xe = g(0), me = g(0), be = g(0), e = k({
      get: () => ke(),
      set: (l) => l
    });
    function ke() {
      const l = De({
        userConfig: F.config,
        defaultConfig: Ee
      });
      return l.theme ? {
        ...De({
          userConfig: at.vue_ui_scatter[l.theme] || F.config,
          defaultConfig: l
        }),
        customPalette: ot[l.theme] || U
      } : l;
    }
    He(() => F.config, (l) => {
      e.value = ke(), _e(), xe.value += 1, me.value += 1, be.value += 1;
    }, { deep: !0 });
    const Z = g(null);
    Je(() => {
      _e();
    });
    function _e() {
      if (st(F.dataset) && de({
        componentName: "VueUiScatter",
        type: "dataset"
      }), e.value.responsive) {
        const l = dt(() => {
          const { width: i, height: t } = ht({
            chart: J.value,
            title: e.value.style.title.text ? fe.value : null,
            legend: e.value.style.legend.show ? ge.value : null
          });
          z.value.width = i, z.value.height = t;
        });
        Z.value = new ResizeObserver(l), Z.value.observe(J.value.parentNode);
      }
    }
    Ke(() => {
      Z.value && Z.value.disconnect();
    });
    const { isPrinting: we, isImaging: Me, generatePdf: $e, generateImage: Ce } = ft({
      elementId: `vue-ui-scatter_${C.value}`,
      fileName: e.value.style.title.text || "vue-ui-scatter"
    }), ze = k(() => ut(e.value.customPalette)), I = g({
      showTable: e.value.table.show,
      showTooltip: e.value.style.tooltip.show
    }), z = g({
      height: e.value.style.layout.height,
      width: e.value.style.layout.width
    }), ee = k(() => e.value.style.layout.marginalBars.show ? e.value.style.layout.marginalBars.size + e.value.style.layout.marginalBars.offset : 0), u = k(() => ({
      top: e.value.style.layout.padding.top + ee.value,
      right: z.value.width - e.value.style.layout.padding.right - ee.value,
      bottom: z.value.height - e.value.style.layout.padding.bottom,
      left: e.value.style.layout.padding.left,
      height: z.value.height - e.value.style.layout.padding.top - e.value.style.layout.padding.bottom - ee.value,
      width: z.value.width - e.value.style.layout.padding.left - e.value.style.layout.padding.right - ee.value
    })), h = k(() => {
      F.dataset.forEach((a, n) => {
        Oe({
          datasetObject: a,
          requiredAttributes: ["values"]
        }).forEach((m) => {
          de({
            componentName: "VueUiScatter",
            type: "datasetSerieAttribute",
            property: m,
            index: n
          });
        }), a.values && a.values.forEach((m, E) => {
          Oe({
            datasetObject: m,
            requiredAttributes: ["x", "y"]
          }).forEach((H) => {
            de({
              componentName: "VueUiScatter",
              type: "datasetSerieAttribute",
              property: `values.${H}`,
              index: `${n} - ${E}`
            });
          });
        });
      });
      const l = Math.min(...j.value.filter((a) => !x.value.includes(a.id)).flatMap((a) => a.values.map((n) => n.x))), i = Math.max(...j.value.filter((a) => !x.value.includes(a.id)).flatMap((a) => a.values.map((n) => n.x))), t = Math.min(...j.value.filter((a) => !x.value.includes(a.id)).flatMap((a) => a.values.map((n) => n.y))), s = Math.max(...j.value.filter((a) => !x.value.includes(a.id)).flatMap((a) => a.values.map((n) => n.y)));
      return { xMin: l >= 0 ? 0 : l, xMax: i, yMin: t >= 0 ? 0 : t, yMax: s };
    }), p = k(() => ({
      x: u.value.left + Math.abs(h.value.xMin) / (h.value.xMax + Math.abs(h.value.xMin)) * u.value.width,
      y: u.value.bottom - Math.abs(h.value.yMin) / (h.value.yMax + Math.abs(h.value.yMin)) * u.value.height
    })), j = k(() => F.dataset.map((l, i) => {
      const t = `cluster_${C.value}_${i}`;
      return {
        ...l,
        id: t,
        color: l.color ? l.color : ze.value[i] || U[i] || U[i % U.length],
        opacity: x.value.includes(t) ? 0.5 : 1,
        shape: l.shape ?? "circle",
        segregate: () => Be(t),
        isSegregated: x.value.includes(t)
      };
    })), Ge = k(() => ({
      cy: "scatter-div-legend",
      backgroundColor: e.value.style.legend.backgroundColor,
      color: e.value.style.legend.color,
      fontSize: e.value.style.legend.fontSize,
      paddingBottom: 12,
      fontWeight: e.value.style.legend.bold ? "bold" : ""
    })), re = k(() => j.value.map((l, i) => ({
      ...l,
      plots: l.values.map((t) => ({
        x: u.value.left + (t.x + Math.abs(h.value.xMin)) / (h.value.xMax + Math.abs(h.value.xMin)) * u.value.width,
        y: u.value.bottom - (t.y + Math.abs(h.value.yMin)) / (h.value.yMax + Math.abs(h.value.yMin)) * u.value.height,
        v: {
          ...t,
          name: t.name || ""
        },
        clusterName: l.name,
        color: l.color ? l.color : ze.value[i] || U[i] || U[i % U.length],
        id: `plot_${C.value}_${Math.random()}`,
        weight: t.weight ?? e.value.style.layout.plots.radius
      }))
    })).filter((l) => !x.value.includes(l.id))), S = k(() => re.value.map((l) => {
      const i = l.plots.reduce((f, V) => f + V.x, 0) / l.plots.length, t = l.plots.reduce((f, V) => f + V.y, 0) / l.plots.length;
      let s = 0, a = 0, n = 0;
      for (const f of l.plots)
        s += (f.x - i) * (f.y - t), a += (f.x - i) ** 2, n += (f.y - t) ** 2;
      const m = s / Math.sqrt(a * n), E = m * (Math.sqrt(n) / Math.sqrt(a)), H = t - E * i, N = {
        x1: u.value.left,
        x2: u.value.right,
        y1: E * u.value.left + H,
        y2: E * u.value.right + H,
        coefficient: m
      }, _ = (N.y2 - N.y1) / (N.x2 - N.x1), L = N.y1 - _ * N.x1, O = Math.min(z.value.width - e.value.style.layout.padding.right, Math.max(e.value.style.layout.padding.left, (u.value.top - L) / _)), le = {
        x: O,
        y: _ * O + L <= e.value.style.layout.padding.top ? u.value.top : _ * O + L
      };
      return {
        ...l,
        correlation: N,
        label: le,
        plots: l.plots.map((f) => {
          const V = (f.x + _ * f.y - _ * L) / (1 + Math.pow(_, 2)), ne = (_ * f.x + Math.pow(_, 2) * f.y + L) / (1 + Math.pow(_, 2)), b = Math.sqrt(Math.pow(f.x - V, 2) + Math.pow(f.y - ne, 2));
          return {
            ...f,
            deviation: b,
            shape: l.shape,
            color: l.color
          };
        })
      };
    })), Se = k(() => Math.max(...S.value.flatMap((l) => l.plots.map((i) => Math.abs(i.deviation)))));
    function Re() {
      return S.value;
    }
    function Ae(l, i) {
      const t = Array.isArray(l) ? l.flatMap((b) => b.plots.map((G) => ({
        x: G.x,
        y: G.y
      }))) : l.plots.map((b) => ({
        x: b.x,
        y: b.y
      }));
      let s = 1 / 0, a = -1 / 0, n = 1 / 0, m = -1 / 0;
      t.forEach(({ x: b, y: G }) => {
        s = Math.min(s, b), a = Math.max(a, b), n = Math.min(n, G), m = Math.max(m, G);
      });
      const E = a - s, H = m - n, N = E / i, _ = H / i, L = Array(i).fill(0), O = Array(i).fill(0);
      t.forEach(({ x: b, y: G }) => {
        const ye = Math.floor((b - s) / N), ve = Math.floor((G - n) / _);
        L[ye] || (L[ye] = 0), O[ve] || (O[ve] = 0), L[ye] += 1, O[ve] += 1;
      });
      const le = [], f = [];
      for (let b = 0; b < i; b += 1)
        le.push(s + (b + 0.5) * N), f.push(n + (b + 0.5) * _);
      const V = Math.max(...L), ne = Math.max(...O);
      return { x: L, y: O, avgX: le, avgY: f, maxX: V, maxY: ne };
    }
    const D = k(() => e.value.style.layout.marginalBars.tranches), A = k(() => Ae(re.value, D.value)), qe = k(() => {
      const l = u.value.top - e.value.style.layout.marginalBars.offset, i = u.value.right + e.value.style.layout.marginalBars.offset;
      return re.value.map((t) => {
        const s = Ae(t, D.value);
        return {
          coords: s,
          dX: Xe(s.avgX.map((a, n) => ({
            x: a,
            y: l - s.x[n] / s.maxX * e.value.style.layout.marginalBars.size
          }))),
          dY: Xe(s.avgY.map((a, n) => ({
            y: a,
            x: i + e.value.style.layout.marginalBars.size * s.y[n] / s.maxY
          }))),
          color: t.color,
          id: t.id
        };
      });
    }), B = g(void 0), v = g(null), ie = g(null);
    function Le(l, i) {
      B.value = l.id, v.value = l;
      let t = "";
      ie.value = {
        datapoint: l,
        seriesIndex: i,
        series: S.value,
        config: e.value
      };
      const s = e.value.style.tooltip.customFormat;
      nt(s) && yt(() => s({
        datapoint: l,
        seriesIndex: i,
        series: S.value,
        config: e.value
      })) ? ue.value = s({
        datapoint: l,
        seriesIndex: i,
        series: S.value,
        config: e.value
      }) : (l.clusterName && (t += `<div style="display:flex;gap:3px;align-items:center">${l.clusterName}</div>`), l.v.name && (t += `<div>${l.v.name}</div>`), t += `<div style="text-align:left;margin-top:6px;padding-top:6px;border-top:1px solid ${e.value.style.tooltip.borderColor}">`, t += `<div>${e.value.style.layout.dataLabels.xAxis.name}: <b>${isNaN(l.v.x) ? "-" : Y(
        e.value.style.layout.plots.selectors.labels.x.formatter,
        l.v.x,
        P({
          p: e.value.style.tooltip.prefix,
          v: l.v.x,
          s: e.value.style.tooltip.suffix,
          r: e.value.style.tooltip.roundingValue
        }),
        { datapoint: l, seriesIndex: i }
      )}</b></div>`, t += `<div>${e.value.style.layout.dataLabels.yAxis.name}: <b>${isNaN(l.v.y) ? "-" : Y(
        e.value.style.layout.plots.selectors.labels.y.formatter,
        l.v.y,
        P({
          p: e.value.style.tooltip.prefix,
          v: l.v.y,
          s: e.value.style.tooltip.suffix,
          r: e.value.style.tooltip.roundingValue
        }),
        { datapoint: l, seriesIndex: i }
      )}</b></div>`, t += `${e.value.style.layout.plots.deviation.translation}: <b>${P({
        v: l.deviation,
        r: e.value.style.layout.plots.deviation.roundingValue
      })}</b>`, t += "</div>", ue.value = `<div>${t}</div>`), se.value = !0;
    }
    function Te() {
      se.value = !1, B.value = void 0, v.value = null;
    }
    const x = g([]);
    function Be(l) {
      x.value.includes(l) ? x.value = x.value.filter((i) => i !== l) : x.value.length < F.dataset.length - 1 && x.value.push(l);
    }
    function Ne() {
      et(() => {
        const l = ["", e.value.table.translations.correlationCoefficient, e.value.table.translations.nbrPlots, `${e.value.style.layout.dataLabels.xAxis.name} ${e.value.table.translations.average}`, `${e.value.style.layout.dataLabels.yAxis.name} ${e.value.table.translations.average}`], i = S.value.map((a) => [
          a.name,
          a.correlation.coefficient,
          a.plots.length,
          a.plots.map((n) => n.v.x).reduce((n, m) => n + m, 0) / a.plots.length,
          a.plots.map((n) => n.v.y).reduce((n, m) => n + m, 0) / a.plots.length
        ]), t = [[e.value.style.title.text], [e.value.style.title.subtitle.text], [[""], [""], [""]]].concat([l]).concat(i), s = vt(t);
        ct({ csvContent: s, title: e.value.style.title.text || "vue-ui-heatmap" });
      });
    }
    const te = k(() => {
      const l = [
        e.value.table.translations.series,
        e.value.table.translations.correlationCoefficient,
        e.value.table.translations.nbrPlots,
        `${e.value.style.layout.dataLabels.xAxis.name} ${e.value.table.translations.average}`,
        `${e.value.style.layout.dataLabels.yAxis.name} ${e.value.table.translations.average}`
      ], i = S.value.map((s) => [
        {
          shape: s.shape,
          content: s.name,
          color: s.color
        },
        Number((s.correlation.coefficient ?? 0).toFixed(e.value.table.td.roundingValue)).toLocaleString(),
        s.plots.length.toLocaleString(),
        Number((s.plots.map((a) => a.v.x ?? 0).reduce((a, n) => a + n, 0) / s.plots.length).toFixed(e.value.table.td.roundingAverage)).toLocaleString(),
        Number((s.plots.map((a) => a.v.y ?? 0).reduce((a, n) => a + n, 0) / s.plots.length).toFixed(e.value.table.td.roundingAverage)).toLocaleString()
      ]), 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 { head: l, body: i, config: t, colNames: l };
    }), K = g(!1);
    function Ue(l) {
      K.value = l, pe.value += 1;
    }
    function We() {
      I.value.showTable = !I.value.showTable;
    }
    function Pe() {
      I.value.showTooltip = !I.value.showTooltip;
    }
    return je({
      getData: Re,
      generatePdf: $e,
      generateCsv: Ne,
      generateImage: Ce,
      toggleTable: We,
      toggleTooltip: Pe
    }), (l, i) => (o(), r("div", {
      class: Fe(`vue-ui-scatter ${K.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${e.value.useCssAnimation ? "" : "vue-ui-dna"}`),
      ref_key: "scatterChart",
      ref: J,
      id: `vue-ui-scatter_${C.value}`,
      style: R(`font-family:${e.value.style.fontFamily};width:100%; text-align:center;${e.value.style.title.text ? "" : "padding-top:36px"};background:${e.value.style.backgroundColor};${e.value.responsive ? "height: 100%" : ""}`)
    }, [
      e.value.style.title.text ? (o(), r("div", {
        key: 0,
        ref_key: "chartTitle",
        ref: fe,
        style: "width:100%;background:transparent"
      }, [
        (o(), q(pt, {
          key: `title_${xe.value}`,
          config: {
            title: {
              cy: "scatter-div-title",
              ...e.value.style.title
            },
            subtitle: {
              cy: "scatter-div-subtitle",
              ...e.value.style.title.subtitle
            }
          }
        }, null, 8, ["config"]))
      ], 512)) : d("", !0),
      e.value.userOptions.show && Q.value ? (o(), q(gt, {
        ref_key: "details",
        ref: Ve,
        key: `user_options_${pe.value}`,
        backgroundColor: e.value.style.backgroundColor,
        color: e.value.style.color,
        isImaging: y(Me),
        isPrinting: y(we),
        uid: C.value,
        hasTooltip: e.value.userOptions.buttons.tooltip && e.value.style.tooltip.show,
        hasPdf: e.value.userOptions.buttons.pdf,
        hasImg: e.value.userOptions.buttons.img,
        hasXls: e.value.userOptions.buttons.csv,
        hasTable: e.value.userOptions.buttons.table,
        hasFullscreen: e.value.userOptions.buttons.fullscreen,
        isTooltip: I.value.showTooltip,
        isFullscreen: K.value,
        titles: { ...e.value.userOptions.buttonTitles },
        chartElement: J.value,
        position: e.value.userOptions.position,
        onToggleFullscreen: Ue,
        onGeneratePdf: y($e),
        onGenerateCsv: Ne,
        onGenerateImage: y(Ce),
        onToggleTable: We,
        onToggleTooltip: Pe
      }, Qe({ _: 2 }, [
        l.$slots.optionTooltip ? {
          name: "optionTooltip",
          fn: w(() => [
            T(l.$slots, "optionTooltip", {}, void 0, !0)
          ]),
          key: "0"
        } : void 0,
        l.$slots.optionPdf ? {
          name: "optionPdf",
          fn: w(() => [
            T(l.$slots, "optionPdf", {}, void 0, !0)
          ]),
          key: "1"
        } : void 0,
        l.$slots.optionCsv ? {
          name: "optionCsv",
          fn: w(() => [
            T(l.$slots, "optionCsv", {}, void 0, !0)
          ]),
          key: "2"
        } : void 0,
        l.$slots.optionImg ? {
          name: "optionImg",
          fn: w(() => [
            T(l.$slots, "optionImg", {}, void 0, !0)
          ]),
          key: "3"
        } : void 0,
        l.$slots.optionTable ? {
          name: "optionTable",
          fn: w(() => [
            T(l.$slots, "optionTable", {}, void 0, !0)
          ]),
          key: "4"
        } : void 0,
        l.$slots.optionFullscreen ? {
          name: "optionFullscreen",
          fn: w(({ toggleFullscreen: t, isFullscreen: s }) => [
            T(l.$slots, "optionFullscreen", ae(oe({ toggleFullscreen: t, isFullscreen: s })), void 0, !0)
          ]),
          key: "5"
        } : void 0
      ]), 1032, ["backgroundColor", "color", "isImaging", "isPrinting", "uid", "hasTooltip", "hasPdf", "hasImg", "hasXls", "hasTable", "hasFullscreen", "isTooltip", "isFullscreen", "titles", "chartElement", "position", "onGeneratePdf", "onGenerateImage"])) : d("", !0),
      Q.value ? (o(), r("svg", {
        key: 2,
        xmlns: y(rt),
        class: Fe({ "vue-data-ui-fullscreen--on": K.value, "vue-data-ui-fulscreen--off": !K.value }),
        viewBox: `0 0 ${z.value.width <= 0 ? 10 : z.value.width} ${z.value.height <= 0 ? 10 : z.value.height}`,
        style: R(`max-width:100%;overflow:visible;background:transparent;color:${e.value.style.color}`)
      }, [
        ce(wt),
        e.value.style.layout.axis.show ? (o(), r("g", zt, [
          c("line", {
            x1: p.value.x,
            x2: p.value.x,
            y1: u.value.top,
            y2: u.value.bottom,
            stroke: e.value.style.layout.axis.stroke,
            "stroke-width": e.value.style.layout.axis.strokeWidth,
            "stroke-linecap": "round"
          }, null, 8, St),
          c("line", {
            x1: u.value.left,
            x2: u.value.right,
            y1: p.value.y,
            y2: p.value.y,
            stroke: e.value.style.layout.axis.stroke,
            "stroke-width": e.value.style.layout.axis.strokeWidth,
            "stroke-linecap": "round"
          }, null, 8, At)
        ])) : d("", !0),
        e.value.style.layout.plots.giftWrap.show ? (o(), r("g", Lt, [
          (o(!0), r(W, null, X(S.value, (t, s) => (o(), r("g", null, [
            t.plots.length > 2 ? (o(), r("polygon", {
              key: 0,
              points: y(it)({ series: t.plots }),
              fill: y(he)(t.color, e.value.style.layout.plots.giftWrap.fillOpacity * 100),
              "stroke-width": e.value.style.layout.plots.giftWrap.strokeWidth,
              "stroke-dasharray": e.value.style.layout.plots.giftWrap.strokeDasharray,
              stroke: t.color,
              "stroke-linejoin": "round",
              "stroke-linecap": "round"
            }, null, 8, Tt)) : d("", !0)
          ]))), 256))
        ])) : d("", !0),
        (o(!0), r(W, null, X(S.value, (t, s) => (o(), r("g", null, [
          !t.shape || t.shape === "circle" ? (o(), r("g", Bt, [
            (o(!0), r(W, null, X(t.plots, (a, n) => (o(), r("circle", {
              cx: a.x,
              cy: a.y,
              r: B.value && B.value === a.id ? a.weight * 2 : a.weight,
              fill: y(he)(t.color, e.value.style.layout.plots.opacity * 100),
              stroke: e.value.style.layout.plots.stroke,
              "stroke-width": e.value.style.layout.plots.strokeWidth,
              onMouseover: (m) => Le(a, s),
              onMouseleave: Te,
              style: R(`opacity:${B.value && B.value === a.id ? 1 : e.value.style.layout.plots.significance.useDistanceOpacity ? 1 - Math.abs(a.deviation) / Se.value : e.value.style.layout.plots.significance.show && Math.abs(a.deviation) > e.value.style.layout.plots.significance.deviationThreshold ? e.value.style.layout.plots.significance.opacity : 1}`)
            }, null, 44, Nt))), 256))
          ])) : (o(), r("g", Wt, [
            (o(!0), r(W, null, X(t.plots, (a, n) => (o(), q(Ie, {
              plot: { x: a.x, y: a.y },
              radius: B.value && B.value === a.id ? a.weight * 2 : a.weight,
              shape: t.shape,
              color: y(he)(t.color, e.value.style.layout.plots.opacity * 100),
              stroke: e.value.style.layout.plots.stroke,
              strokeWidth: e.value.style.layout.plots.strokeWidth,
              onMouseover: (m) => Le(a, s),
              onMouseleave: Te,
              style: R(`opacity:${B.value && B.value === a.id ? 1 : e.value.style.layout.plots.significance.useDistanceOpacity ? 1 - Math.abs(a.deviation) / Se.value : e.value.style.layout.plots.significance.show && Math.abs(a.deviation) > e.value.style.layout.plots.significance.deviationThreshold ? e.value.style.layout.plots.significance.opacity : 1}`)
            }, null, 8, ["plot", "radius", "shape", "color", "stroke", "strokeWidth", "onMouseover", "style"]))), 256))
          ]))
        ]))), 256)),
        e.value.style.layout.marginalBars.show ? (o(), r("g", Pt, [
          c("defs", null, [
            c("linearGradient", {
              id: `marginal_x_${C.value}`,
              x1: "0%",
              y1: "0%",
              x2: "0%",
              y2: "100%"
            }, [
              c("stop", {
                offset: "0%",
                "stop-color": e.value.style.layout.marginalBars.fill
              }, null, 8, Ot),
              c("stop", {
                offset: "100%",
                "stop-color": e.value.style.backgroundColor
              }, null, 8, Xt)
            ], 8, Ft),
            c("linearGradient", {
              id: `marginal_y_${C.value}`,
              x1: "0%",
              x2: "100%",
              y1: "0%",
              y2: "0%"
            }, [
              c("stop", {
                offset: "0%",
                "stop-color": e.value.style.backgroundColor
              }, null, 8, Dt),
              c("stop", {
                offset: "100%",
                "stop-color": e.value.style.layout.marginalBars.fill
              }, null, 8, Yt)
            ], 8, It)
          ]),
          (o(!0), r(W, null, X(A.value.x, (t, s) => (o(), r("g", null, [
            t && A.value.avgX[s] ? (o(), r("rect", {
              key: 0,
              x: A.value.avgX[s] - u.value.width / D.value / 2,
              y: u.value.top - e.value.style.layout.marginalBars.offset - t / A.value.maxX * e.value.style.layout.marginalBars.size,
              width: u.value.width / D.value <= 0 ? 1e-4 : u.value.width / D.value,
              height: t / A.value.maxX * e.value.style.layout.marginalBars.size <= 0 ? 1e-4 : t / A.value.maxX * e.value.style.layout.marginalBars.size,
              fill: e.value.style.layout.marginalBars.useGradient ? `url(#marginal_x_${C.value})` : e.value.style.layout.marginalBars.fill,
              style: R(`opacity:${e.value.style.layout.marginalBars.opacity}`),
              stroke: e.value.style.backgroundColor,
              "stroke-width": e.value.style.layout.marginalBars.strokeWidth,
              rx: e.value.style.layout.marginalBars.borderRadius
            }, null, 12, jt)) : d("", !0)
          ]))), 256)),
          (o(!0), r(W, null, X(A.value.y, (t, s) => (o(), r("g", null, [
            t && A.value.avgY[s] ? (o(), r("rect", {
              key: 0,
              x: u.value.right + e.value.style.layout.marginalBars.offset,
              y: A.value.avgY[s] - u.value.height / D.value / 2,
              height: u.value.height / D.value <= 0 ? 1e-4 : u.value.height / D.value,
              width: t / A.value.maxY * e.value.style.layout.marginalBars.size <= 0 ? 1e-4 : t / A.value.maxY * e.value.style.layout.marginalBars.size,
              fill: e.value.style.layout.marginalBars.useGradient ? `url(#marginal_y_${C.value})` : e.value.style.layout.marginalBars.fill,
              style: R(`opacity:${e.value.style.layout.marginalBars.opacity}`),
              stroke: e.value.style.backgroundColor,
              "stroke-width": e.value.style.layout.marginalBars.strokeWidth,
              rx: e.value.style.layout.marginalBars.borderRadius
            }, null, 12, Et)) : d("", !0)
          ]))), 256)),
          e.value.style.layout.marginalBars.showLines ? (o(), r("g", Vt, [
            (o(!0), r(W, null, X(qe.value, (t) => (o(), r(W, null, [
              x.value.includes(t.id) ? d("", !0) : (o(), r("path", {
                key: 0,
                d: `M ${t.dX}`,
                stroke: e.value.style.backgroundColor,
                "stroke-width": e.value.style.layout.marginalBars.linesStrokeWidth + 1,
                "stroke-linecap": "round",
                "stroke-linejoin": "round",
                fill: "none"
              }, null, 8, Gt)),
              x.value.includes(t.id) ? d("", !0) : (o(), r("path", {
                key: 1,
                d: `M ${t.dX}`,
                stroke: t.color,
                "stroke-width": e.value.style.layout.marginalBars.linesStrokeWidth,
                "stroke-linecap": "round",
                "stroke-linejoin": "round",
                fill: "none"
              }, null, 8, Rt)),
              x.value.includes(t.id) ? d("", !0) : (o(), r("path", {
                key: 2,
                d: `M ${t.dY}`,
                stroke: e.value.style.backgroundColor,
                "stroke-width": e.value.style.layout.marginalBars.linesStrokeWidth + 1,
                "stroke-linecap": "round",
                "stroke-linejoin": "round",
                fill: "none"
              }, null, 8, qt)),
              x.value.includes(t.id) ? d("", !0) : (o(), r("path", {
                key: 3,
                d: `M ${t.dY}`,
                stroke: t.color,
                "stroke-width": e.value.style.layout.marginalBars.linesStrokeWidth,
                "stroke-linecap": "round",
                "stroke-linejoin": "round",
                fill: "none"
              }, null, 8, Ut))
            ], 64))), 256))
          ])) : d("", !0)
        ])) : d("", !0),
        v.value && e.value.style.layout.plots.selectors.show ? (o(), r("g", Ht, [
          c("line", {
            x1: p.value.x,
            x2: v.value.x,
            y1: v.value.y,
            y2: v.value.y,
            stroke: e.value.style.layout.plots.selectors.stroke,
            "stroke-width": e.value.style.layout.plots.selectors.strokeWidth,
            "stroke-dasharray": e.value.style.layout.plots.selectors.strokeDasharray,
            "stroke-linecap": "round",
            class: "line-pointer"
          }, null, 8, Jt),
          c("line", {
            x1: v.value.x,
            x2: v.value.x,
            y1: p.value.y,
            y2: v.value.y,
            stroke: e.value.style.layout.plots.selectors.stroke,
            "stroke-width": e.value.style.layout.plots.selectors.strokeWidth,
            "stroke-dasharray": e.value.style.layout.plots.selectors.strokeDasharray,
            "stroke-linecap": "round",
            class: "line-pointer"
          }, null, 8, Kt),
          c("text", {
            x: p.value.x + (v.value.x > p.value.x ? -6 : 6),
            y: v.value.y + e.value.style.layout.plots.selectors.labels.fontSize / 3,
            "font-size": e.value.style.layout.plots.selectors.labels.fontSize,
            fill: e.value.style.layout.plots.selectors.labels.color,
            "font-weight": e.value.style.layout.plots.selectors.labels.bold ? "bold" : "normal",
            "text-anchor": v.value.x > p.value.x ? "end" : "start"
          }, M(y(Y)(
            e.value.style.layout.plots.selectors.labels.y.formatter,
            y($)(v.value.v.y),
            y(P)({
              p: e.value.style.layout.plots.selectors.labels.prefix,
              v: y($)(v.value.v.y),
              s: e.value.style.layout.plots.selectors.labels.suffix,
              r: e.value.style.layout.plots.selectors.labels.rounding
            }),
            { datapoint: v.value }
          )), 9, Qt),
          c("text", {
            x: v.value.x,
            y: p.value.y + (v.value.y > p.value.y ? -6 : e.value.style.layout.plots.selectors.labels.fontSize + 6),
            "font-size": e.value.style.layout.plots.selectors.labels.fontSize,
            fill: e.value.style.layout.plots.selectors.labels.color,
            "font-weight": e.value.style.layout.plots.selectors.labels.bold ? "bold" : "normal",
            "text-anchor": "middle"
          }, M(y(Y)(
            e.value.style.layout.plots.selectors.labels.y.formatter,
            y($)(v.value.v.x),
            y(P)({
              p: e.value.style.layout.plots.selectors.labels.prefix,
              v: y($)(v.value.v.x),
              s: e.value.style.layout.plots.selectors.labels.suffix,
              r: e.value.style.layout.plots.selectors.labels.rounding
            }),
            { datapoint: v.value }
          )), 9, Zt),
          c("circle", {
            cx: p.value.x,
            cy: v.value.y,
            r: e.value.style.layout.plots.selectors.markers.radius,
            fill: e.value.style.layout.plots.selectors.markers.fill,
            stroke: e.value.style.layout.plots.selectors.markers.stroke,
            "stroke-width": e.value.style.layout.plots.selectors.markers.strokeWidth,
            class: "line-pointer"
          }, null, 8, el),
          c("circle", {
            cx: v.value.x,
            cy: p.value.y,
            r: e.value.style.layout.plots.selectors.markers.radius,
            fill: e.value.style.layout.plots.selectors.markers.fill,
            stroke: e.value.style.layout.plots.selectors.markers.stroke,
            "stroke-width": e.value.style.layout.plots.selectors.markers.strokeWidth,
            class: "line-pointer"
          }, null, 8, tl),
          e.value.style.layout.plots.selectors.labels.showName ? (o(), r("text", {
            key: 0,
            x: v.value.x,
            y: v.value.y + (v.value.y < p.value.y ? -e.value.style.layout.plots.selectors.labels.fontSize / 2 : e.value.style.layout.plots.selectors.labels.fontSize),
            "font-size": e.value.style.layout.plots.selectors.labels.fontSize,
            fill: e.value.style.layout.plots.selectors.labels.color,
            "font-weight": e.value.style.layout.plots.selectors.labels.bold ? "bold" : "normal",
            "text-anchor": v.value.x < u.value.left + 100 ? "start" : v.value.x > u.value.right - 100 ? "end" : v.value.x > p.value.x ? "start" : "end"
          }, M(v.value.v.name), 9, ll)) : d("", !0)
        ])) : d("", !0),
        e.value.style.layout.dataLabels.xAxis.show ? (o(), r("g", al, [
          c("text", {
            x: u.value.left - 5,
            y: p.value.y + e.value.style.layout.dataLabels.xAxis.fontSize / 3,
            "text-anchor": "end",
            "font-size": e.value.style.layout.dataLabels.xAxis.fontSize,
            fill: e.value.style.layout.dataLabels.xAxis.color
          }, M(y(Y)(
            e.value.style.layout.plots.selectors.labels.x.formatter,
            y($)(h.value.xMin),
            y(P)({
              p: e.value.style.layout.plots.selectors.labels.prefix,
              v: y($)(h.value.xMin),
              s: e.value.style.layout.plots.selectors.labels.suffix,
              r: e.value.style.layout.dataLabels.xAxis.rounding
            })
          )), 9, ol),
          c("text", {
            x: u.value.right + 3,
            y: p.value.y + e.value.style.layout.dataLabels.xAxis.fontSize / 3,
            "text-anchor": "start",
            "font-size": e.value.style.layout.dataLabels.xAxis.fontSize,
            fill: e.value.style.layout.dataLabels.xAxis.color
          }, M(y(Y)(
            e.value.style.layout.plots.selectors.labels.x.formatter,
            y($)(h.value.xMax),
            y(P)({
              p: e.value.style.layout.plots.selectors.labels.prefix,
              v: y($)(h.value.xMax),
              s: e.value.style.layout.plots.selectors.labels.suffix,
              r: e.value.style.layout.dataLabels.xAxis.rounding
            })
          )), 9, sl),
          c("text", {
            id: `vue-ui-scatter-xAxis-label-${C.value}`,
            transform: `translate(${e.value.style.layout.dataLabels.xAxis.fontSize * 2}, ${u.value.top + u.value.height / 2}), rotate(-90)`,
            "text-anchor": "middle",
            "font-size": e.value.style.layout.dataLabels.xAxis.fontSize,
            "font-weight": e.value.style.layout.dataLabels.xAxis.bold ? "bold" : "normal",
            fill: e.value.style.layout.dataLabels.xAxis.color
          }, M(e.value.style.layout.dataLabels.xAxis.name), 9, ul)
        ])) : d("", !0),
        e.value.style.layout.dataLabels.yAxis.show ? (o(), r("g", rl, [
          c("text", {
            x: p.value.x,
            y: u.value.bottom + 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
          }, M(y(Y)(
            e.value.style.layout.plots.selectors.labels.y.formatter,
            y($)(h.value.yMin),
            y(P)({
              p: e.value.style.layout.plots.selectors.labels.prefix,
              v: y($)(h.value.yMin),
              s: e.value.style.layout.plots.selectors.labels.suffix,
              r: e.value.style.layout.dataLabels.yAxis.rounding
            })
          )), 9, il),
          c("text", {
            x: p.value.x,
            y: u.value.top - e.value.style.layout.dataLabels.yAxis.fontSize / 2,
            "text-anchor": "middle",
            "font-size": e.value.style.layout.dataLabels.yAxis.fontSize,
            fill: e.value.style.layout.dataLabels.yAxis.color
          }, M(y(Y)(
            e.value.style.layout.plots.selectors.labels.y.formatter,
            y($)(h.value.yMax),
            y(P)({
              p: e.value.style.layout.plots.selectors.labels.prefix,
              v: y($)(h.value.yMax),
              s: e.value.style.layout.plots.selectors.labels.suffix,
              r: e.value.style.layout.dataLabels.yAxis.rounding
            })
          )), 9, nl),
          c("text", {
            "text-anchor": "middle",
            "font-size": e.value.style.layout.dataLabels.yAxis.fontSize,
            "font-weight": e.value.style.layout.dataLabels.yAxis.bold ? "bold" : "normal",
            fill: e.value.style.layout.dataLabels.yAxis.color,
            x: u.value.left + u.value.width / 2,
            y: u.value.bottom + 8 + e.value.style.layout.dataLabels.yAxis.fontSize * 2
          }, M(e.value.style.layout.dataLabels.yAxis.name), 9, yl)
        ])) : d("", !0),
        c("clipPath", {
          id: `clip_path_${C.value}`
        }, [
          c("rect", {
            x: u.value.left,
            y: u.value.top,
            width: u.value.width <= 0 ? 1e-4 : u.value.width,
            height: u.value.height <= 0 ? 1e-4 : u.value.height
          }, null, 8, cl)
        ], 8, vl),
        e.value.style.layout.correlation.show ? (o(), r("g", dl, [
          (o(!0), r(W, null, X(S.value, (t, s) => (o(), r("line", {
            x1: t.correlation.x1,
            x2: t.correlation.x2,
            y1: t.correlation.y1,
            y2: t.correlation.y2,
            "stroke-dasharray": e.value.style.layout.correlation.strokeDasharray,
            stroke: t.color,
            "stroke-width": e.value.style.layout.correlation.strokeWidth,
            "clip-path": `url(#clip_path_${C.value})`
          }, null, 8, hl))), 256)),
          (o(!0), r(W, null, X(S.value, (t, s) => (o(), r("g", null, [
            e.value.style.layout.correlation.label.show ? (o(), r("text", {
              key: 0,
              x: t.label.x,
              y: t.label.y,
              fill: e.value.style.layout.correlation.label.useSerieColor ? t.color : e.value.style.layout.correlation.label.color,
              "font-size": e.value.style.layout.correlation.label.fontSize,
              "font-weight": e.value.style.layout.correlation.label.bold ? "bold" : "normal"
            }, M(y(P)({
              v: y($)(t.correlation.coefficient),
              r: e.value.style.layout.correlation.label.roundingValue
            })), 9, pl)) : d("", !0)
          ]))), 256))
        ])) : d("", !0),
        T(l.$slots, "svg", { svg: z.value }, void 0, !0)
      ], 14, Ct)) : d("", !0),
      l.$slots.watermark ? (o(), r("div", fl, [
        T(l.$slots, "watermark", ae(oe({ isPrinting: y(we) || y(Me) })), void 0, !0)
      ])) : d("", !0),
      Q.value ? d("", !0) : (o(), q(kt, {
        key: 4,
        config: {
          type: "quadrant",
          style: {
            backgroundColor: e.value.style.backgroundColor,
            quadrant: {
              grid: {
                color: e.value.style.layout.axis.stroke
              },
              plots: {
                color: e.value.style.layout.axis.stroke,
                radius: 1
              }
            }
          }
        }
      }, null, 8, ["config"])),
      c("div", {
        ref_key: "chartLegend",
        ref: ge
      }, [
        e.value.style.legend.show ? (o(), q(mt, {
          key: `legend_${be.value}`,
          legendSet: j.value,
          config: Ge.value,
          onClickMarker: i[0] || (i[0] = ({ legend: t }) => Be(t.id))
        }, {
          item: w(({ legend: t }) => [
            c("div", {
              onClick: (s) => t.segregate(),
              style: R(`opacity:${x.value.includes(t.id) ? 0.5 : 1}`)
            }, M(t.name), 13, gl)
          ]),
          _: 1
        }, 8, ["legendSet", "config"])) : T(l.$slots, "legend", {
          key: 1,
          legend: j.value
        }, void 0, !0)
      ], 512),
      ce(xt, {
        show: I.value.showTooltip && se.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: J.value,
        content: ue.value,
        isCustom: e.value.style.tooltip.customFormat && typeof e.value.style.tooltip.customFormat == "function"
      }, {
        "tooltip-before": w(() => [
          T(l.$slots, "tooltip-before", ae(oe({ ...ie.value })), void 0, !0)
        ]),
        "tooltip-after": w(() => [
          T(l.$slots, "tooltip-after", ae(oe({ ...ie.value })), void 0, !0)
        ]),
        default: w(() => [
          e.value.style.tooltip.showShape ? (o(), r("div", xl, [
            (o(), r("svg", ml, [
              ce(Ie, {
                shape: v.value.shape,
                color: v.value.color,
                plot: { x: 10, y: 10 },
                radius: 7
              }, null, 8, ["shape", "color"])
            ]))
          ])) : d("", !0)
        ]),
        _: 3
      }, 8, ["show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "fontSize", "backgroundOpacity", "position", "offsetY", "parent", "content", "isCustom"]),
      Q.value ? (o(), q(_t, {
        key: 5,
        hideDetails: "",
        config: {
          open: I.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: w(() => [
          (o(), q(bt, {
            key: `table_${me.value}`,
            colNames: te.value.colNames,
            head: te.value.head,
            body: te.value.body,
            config: te.value.config,
            title: `${e.value.style.title.text}${e.value.style.title.subtitle.text ? ` : ${e.value.style.title.subtitle.text}` : ""}`,
            onClose: i[1] || (i[1] = (t) => I.value.showTable = !1)
          }, {
            th: w(({ th: t }) => [
              Ze(M(t), 1)
            ]),
            td: w(({ td: t }) => [
              t.shape ? (o(), r("div", bl, [
                c("span", null, M(t.content), 1)
              ])) : (o(), r("div", {
                key: 1,
                innerHTML: t
              }, null, 8, kl))
            ]),
            _: 1
          }, 8, ["colNames", "head", "body", "config", "title"]))
        ]),
        _: 1
      }, 8, ["config"])) : d("", !0)
    ], 14, $t));
  }
}, Ol = /* @__PURE__ */ Mt(_l, [["__scopeId", "data-v-840f65fb"]]);
export {
  Ol as default
};
