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