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