import { toRefs as R, defineAsyncComponent as e, computed as s, ref as o, onMounted as w, watch as G, shallowReactive as tt, openBlock as c, createElementBlock as et, normalizeStyle as ot, createElementVNode as it, createBlock as m, createCommentVNode as M, createTextVNode as at, toDisplayString as nt, resolveDynamicComponent as rt, mergeProps as lt, toHandlers as ut, createSlots as st, renderList as ct, withCtx as gt, renderSlot as pt, normalizeProps as mt, guardReactiveProps as dt } from "vue";
import $ from "./BaseIcon-QBIdDtsh.js";
const Vt = { style: { width: "36px" } }, kt = {
  __name: "vue-data-ui",
  props: {
    component: { type: String },
    dataset: { type: [Object, Array, Number, String] },
    config: { type: Object }
  },
  emits: [
    "selectLegend",
    "selectDatapoint",
    "toggleOpenState",
    "saveAnnotations",
    "selectRoot",
    "selectBranch",
    "selectNut",
    "change",
    "selectPlot",
    "selectSide",
    "rate",
    "postImage",
    "hoverIndex",
    "selectX",
    "toggleLock",
    "toggleTooltip",
    "start",
    "play",
    "pause",
    "reset",
    "restart",
    "lap",
    "toggleAnnotator"
  ],
  setup(W, { expose: X, emit: Q }) {
    const n = W, { component: Ut, dataset: j, config: z } = R(n), g = {
      VueUi3dBar: e(() => import("./vue-ui-3d-bar-Bf1P0qgr.js")),
      VueUiAgePyramid: e(() => import("./vue-ui-age-pyramid-D_geE4yV.js")),
      VueUiAnnotator: e(() => import("./vue-ui-annotator-B7SCNeQW.js")),
      VueUiCandlestick: e(() => import("./vue-ui-candlestick-p--HKs4y.js")),
      VueUiChestnut: e(() => import("./vue-ui-chestnut-DwwohH1I.js")),
      VueUiDashboard: e(() => import("./vue-ui-dashboard-S_-VrC-e.js")),
      VueUiDigits: e(() => import("./vue-ui-digits-DVrKHvAx.js")),
      VueUiDonut: e(() => import("./vue-ui-donut-DLSPHatR.js")),
      VueUiDonutEvolution: e(() => import("./vue-ui-donut-evolution-CUISQ53T.js")),
      VueUiGalaxy: e(() => import("./vue-ui-galaxy-C5_aW-lx.js")),
      VueUiGauge: e(() => import("./vue-ui-gauge-CQWnEC8a.js")),
      VueUiHeatmap: e(() => import("./vue-ui-heatmap-pcdqGLRS.js")),
      VueUiKpi: e(() => import("./vue-ui-kpi-D7j0srlP.js")),
      VueUiMiniLoader: e(() => import("./vue-ui-mini-loader-D7VHDTGz.js")),
      VueUiMolecule: e(() => import("./vue-ui-molecule-C_uhs2U_.js")),
      VueUiMoodRadar: e(() => import("./vue-ui-mood-radar-CU0CfAfQ.js")),
      VueUiNestedDonuts: e(() => import("./vue-ui-nested-donuts-D8LwVfr9.js")),
      VueUiOnion: e(() => import("./vue-ui-onion-BfGt1Swk.js")),
      VueUiQuadrant: e(() => import("./vue-ui-quadrant-BkM4J8Zo.js")),
      VueUiRadar: e(() => import("./vue-ui-radar-DCuyQ8TQ.js")),
      VueUiRating: e(() => import("./vue-ui-rating-IQbpjp9W.js")),
      VueUiRelationCircle: e(() => import("./vue-ui-relation-circle-D6oDkLxu.js")),
      VueUiRings: e(() => import("./vue-ui-rings-DIIMJ6Ki.js")),
      VueUiScatter: e(() => import("./vue-ui-scatter-DlB5PjIz.js")),
      VueUiScreenshot: e(() => import("./vue-ui-screenshot-cTGWG_q0.js")),
      VueUiSkeleton: e(() => import("./vue-ui-skeleton-CZBWPZpy.js")),
      VueUiSmiley: e(() => import("./vue-ui-smiley-DvDya3We.js")),
      VueUiSparkbar: e(() => import("./vue-ui-sparkbar-_FtDdeUa.js")),
      VueUiSparkgauge: e(() => import("./vue-ui-sparkgauge-B_j3XcZO.js")),
      VueUiSparkHistogram: e(() => import("./vue-ui-sparkhistogram-C9p3d3J9.js")),
      VueUiSparkline: e(() => import("./vue-ui-sparkline-C4Vopkk9.js")),
      VueUiSparkStackbar: e(() => import("./vue-ui-sparkstackbar-CBRJEeRr.js")),
      VueUiTable: e(() => import("./vue-ui-table-DBC5CyhX.js")),
      VueUiTableSparkline: e(() => import("./vue-ui-table-sparkline-C6bJM-f0.js")),
      VueUiThermometer: e(() => import("./vue-ui-thermometer-BIYcENnb.js")),
      VueUiTiremarks: e(() => import("./vue-ui-tiremarks-MFmGeu6B.js")),
      VueUiTreemap: e(() => import("./vue-ui-treemap-ftHRUAk5.js")),
      VueUiVerticalBar: e(() => import("./vue-ui-vertical-bar-L0xygeZE.js")),
      VueUiWaffle: e(() => import("./vue-ui-waffle-CIB4Siw3.js")),
      VueUiWheel: e(() => import("./vue-ui-wheel-CRPNNms-.js")),
      VueUiXy: e(() => import("./vue-ui-xy-db3m5Vm0.js")),
      VueUiTableHeatmap: e(() => import("./vue-ui-table-heatmap-zoNwnmLR.js")),
      VueUiAccordion: e(() => import("./vue-ui-accordion-BH0OU8sD.js")),
      VueUiQuickChart: e(() => import("./vue-ui-quick-chart-DOIEo_Ek.js")),
      VueUiCursor: e(() => import("./vue-ui-cursor-DoI4WKkL.js")),
      VueUiSparkTrend: e(() => import("./vue-ui-spark-trend-8QHcYdgb.js")),
      VueUiStripPlot: e(() => import("./vue-ui-strip-plot-BnGNBKdY.js")),
      VueUiDumbbell: e(() => import("./vue-ui-dumbbell-BANsx_dg.js")),
      VueUiWordCloud: e(() => import("./vue-ui-word-cloud-CyrBFbga.js")),
      VueUiXyCanvas: e(() => import("./vue-ui-xy-canvas-CoVdHIGi.js")),
      VueUiFlow: e(() => import("./vue-ui-flow-DkLbGRW4.js")),
      VueUiParallelCoordinatePlot: e(() => import("./vue-ui-parallel-coordinate-plot-I0JYDTzv.js")),
      VueUiTimer: e(() => import("./vue-ui-timer-MLu40_bj.js")),
      VueUiCarouselTable: e(() => import("./vue-ui-carousel-table-085oPZYs.js")),
      VueUiGizmo: e(() => import("./vue-ui-gizmo-B8da3ua8.js")),
      VueUiStackbar: e(() => import("./vue-ui-stackbar-BzbafUmP.js")),
      VueUiBullet: e(() => import("./vue-ui-bullet-BkhafZhy.js")),
      VueUiFunnel: e(() => import("./vue-ui-funnel-D6i4ABc6.js")),
      VueUiHistoryPlot: e(() => import("./vue-ui-history-plot-B2DaZsY0.js")),
      VueUiCirclePack: e(() => import("./vue-ui-circle-pack-CEbJgElX.js"))
    }, K = {
      VueUi3dBar: ["config", "dataset"],
      VueUiAgePyramid: ["config", "dataset"],
      VueUiAnnotator: ["config", "dataset"],
      VueUiCandlestick: ["config", "dataset"],
      VueUiChestnut: ["config", "dataset"],
      VueUiDashboard: ["config", "dataset"],
      VueUiDigits: ["config", "dataset"],
      VueUiDonut: ["config", "dataset"],
      VueUiDonutEvolution: ["config", "dataset"],
      VueUiGalaxy: ["config", "dataset"],
      VueUiGauge: ["config", "dataset"],
      VueUiHeatmap: ["config", "dataset"],
      VueUiKpi: ["config", "dataset"],
      VueUiMiniLoader: ["config"],
      VueUiMolecule: ["config", "dataset"],
      VueUiMoodRadar: ["config", "dataset"],
      VueUiNestedDonuts: ["config", "dataset"],
      VueUiOnion: ["config", "dataset"],
      VueUiQuadrant: ["config", "dataset"],
      VueUiRadar: ["config", "dataset"],
      VueUiRating: ["config", "dataset"],
      VueUiRelationCircle: ["config", "dataset"],
      VueUiRings: ["config", "dataset"],
      VueUiScatter: ["config", "dataset"],
      VueUiScreenshot: ["config"],
      VueUiSkeleton: ["config"],
      VueUiSmiley: ["config", "dataset"],
      VueUiSparkbar: ["config", "dataset"],
      VueUiSparkgauge: ["config", "dataset"],
      VueUiSparkHistogram: ["config", "dataset"],
      VueUiSparkline: ["config", "dataset"],
      VueUiSparkStackbar: ["config", "dataset"],
      VueUiTable: ["config", "dataset"],
      VueUiTableSparkline: ["config", "dataset"],
      VueUiThermometer: ["config", "dataset"],
      VueUiTiremarks: ["config", "dataset"],
      VueUiTreemap: ["config", "dataset"],
      VueUiVerticalBar: ["config", "dataset"],
      VueUiWaffle: ["config", "dataset"],
      VueUiWheel: ["config", "dataset"],
      VueUiXy: ["config", "dataset"],
      VueUiTableHeatmap: ["config", "dataset"],
      VueUiAccordion: ["config"],
      VueUiQuickChart: ["config", "dataset"],
      VueUiCursor: ["config"],
      VueUiSparkTrend: ["config", "dataset"],
      VueUiStripPlot: ["config", "dataset"],
      VueUiDumbbell: ["config", "dataset"],
      VueUiWordCloud: ["config", "dataset"],
      VueUiXyCanvas: ["config", "dataset"],
      VueUiFlow: ["config", "dataset"],
      VueUiParallelCoordinatePlot: ["config", "dataset"],
      VueUiTimer: ["config"],
      VueUiCarouselTable: ["config", "dataset"],
      VueUiGizmo: ["config", "dataset"],
      VueUiStackbar: ["config", "dataset"],
      VueUiBullet: ["config", "dataset"],
      VueUiFunnel: ["config", "dataset"],
      VueUiHistoryPlot: ["config", "dataset"],
      VueUiCirclePack: ["config", "dataset"]
    }, d = s(() => !g[n.component]), q = s(() => g[n.component] || null), i = o(null), Y = s(() => {
      const t = K[n.component] || [], a = {};
      return t.includes("config") && (a.config = z.value), t.includes("dataset") && (a.dataset = j.value), a;
    }), V = o(() => null), U = o(() => null), f = o(() => null), v = o(() => null), k = o(() => null), S = o(() => null), h = o(() => null), y = o(() => null), b = o(() => null), C = o(() => null), A = o(() => null), T = o(() => null), P = o(() => null), D = o(() => null), x = o(() => null), I = o(() => null), F = o(() => null), H = o(() => null), L = o(() => null), B = o(() => null), E = o(() => null), _ = o(() => null), O = o(() => null), N = o(() => null);
    w(() => {
      if (d.value)
        throw new Error(`

Vue Data UI exception:
The provided component "${n.component}" does not exist. Check the spelling.

Available components:

${Object.keys(g).map((t) => `. ${t}
`).join("")}`);
    }), G(i, async (t) => {
      t && (t.generatePdf && (V.value = t.generatePdf), t.generateImage && (f.value = t.generateImage), t.generateCsv && (U.value = t.generateCsv), t.getItemsPositions && (v.value = t.getItemsPositions), t.toggleReadonly && (k.value = t.toggleReadonly), t.shoot && (S.value = t.shoot), t.close && (h.value = t.close), t.restoreOrder && (y.value = t.restoreOrder), t.recalculateHeight && (b.value = t.recalculateHeight), t.toggleLock && (C.value = t.toggleLock), t.toggleTable && (A.value = t.toggleTable), t.toggleLabels && (T.value = t.toggleLabels), t.toggleSort && (P.value = t.toggleSort), t.toggleStack && (D.value = t.toggleStack), t.toggleTooltip && (x.value = t.toggleTooltip), t.start && (I.value = t.start), t.pause && (F.value = t.pause), t.reset && (H.value = t.reset), t.restart && (L.value = t.restart), t.lap && (B.value = t.lap), t.toggleAnimation && (E.value = t.toggleAnimation), t.pauseAnimation && (_.value = t.pauseAnimation), t.resumeAnimation && (O.value = t.resumeAnimation), t.toggleAnnotator && (N.value = t.toggleAnnotator));
    });
    const J = () => {
      const t = [
        "selectLegend",
        "selectDatapoint",
        "toggleOpenState",
        "saveAnnotations",
        "selectRoot",
        "selectBranch",
        "selectNut",
        "change",
        "selectPlot",
        "selectSide",
        "rate",
        "postImage",
        "hoverIndex",
        "selectX",
        "toggleLock",
        "toggleTooltip",
        "start",
        "pause",
        "reset",
        "restart",
        "lap",
        "toggleAnimation",
        "pauseAnimation",
        "resumeAnimation",
        "toggleAnnotator"
      ], a = {};
      return t.forEach((p) => {
        a[p] = (...u) => Q(p, ...u);
      }), a;
    }, r = tt([]);
    G([r, i], () => {
      if (i.value)
        for (; r.length; ) {
          const [t, ...a] = r.shift();
          typeof i.value[t] == "function" && i.value[t](...a);
        }
    }), X({
      getData: (...t) => i.value && typeof i.value.getData == "function" ? i.value.getData() : r.push(["getData", ...t]),
      generatePdf: V,
      generateCsv: U,
      generateImage: f,
      getItemsPositions: v,
      toggleReadonly: k,
      shoot: S,
      close: h,
      restoreOrder: y,
      recalculateHeight: b,
      toggleLock: C,
      toggleTable: A,
      toggleLabels: T,
      toggleSort: P,
      toggleStack: D,
      toggleTooltip: x,
      start: I,
      pause: F,
      reset: H,
      restart: L,
      lap: B,
      pauseAnimation: _,
      resumeAnimation: O,
      toggleAnimation: E,
      toggleAnnotator: N
    });
    const l = s(() => {
      let t = `The provided component ${n.component} does not exist.`;
      return ["VueUiIcon", "VueUiPattern", "Arrow"].includes(n.component) ? (t = `${n.component} is not supported by the VueDataUi universal component. You must import it individually.`, console.warn(t), {
        status: "notSupported",
        message: t
      }) : (console.warn(t), {
        status: "unknown",
        message: t
      });
    });
    return (t, a) => d.value ? (c(), et("div", {
      key: 0,
      style: ot({
        width: "100%",
        display: "flex",
        gap: "6px",
        alignItems: "center",
        color: l.value.status === "notSupported" ? "#FF9000" : "#FF0000"
      })
    }, [
      it("div", Vt, [
        l.value.status === "unknown" ? (c(), m($, {
          key: 0,
          name: "moodFlat",
          stroke: "#FF0000"
        })) : M("", !0),
        l.value.status === "notSupported" ? (c(), m($, {
          key: 1,
          name: "circleExclamation",
          stroke: "#FF9000"
        })) : M("", !0)
      ]),
      at(" " + nt(l.value.message), 1)
    ], 4)) : (c(), m(rt(q.value), lt({
      key: 1,
      ref_key: "currentComponentRef",
      ref: i
    }, Y.value, ut(J())), st({ _: 2 }, [
      ct(t.$slots, (p, u) => ({
        name: u,
        fn: gt((Z) => [
          pt(t.$slots, u, mt(dt(Z)))
        ])
      }))
    ]), 1040));
  }
};
export {
  kt as default
};
