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