import { useCssVars as ae, computed as V, defineAsyncComponent as o, ref as r, watch as ie, createElementBlock as y, openBlock as g, createCommentVNode as N, createElementVNode as b, normalizeStyle as S, createStaticVNode as ne, Fragment as W, renderList as le, normalizeClass as re, renderSlot as z, createBlock as se, resolveDynamicComponent as de, mergeProps as ce } from "vue";
import he from "./pdf-Ccv6h6_6.js";
import { u as ve } from "./useNestedProp-TXT2IHSL.js";
import { u as pe, c as fe } from "./index-lwwgkcGL.js";
import { _ as me } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const ge = {
  key: 0,
  "data-dom-to-png-ignore": "",
  style: { width: "100%", display: "flex", "justify-content": "end" }
}, be = ["disabled"], Ue = ["stroke"], Ve = { key: 1 }, ye = ["id"], we = ["onMousedown", "onTouchstart"], ke = ["onMousedown", "onTouchstart"], Te = ["onMousedown", "onTouchstart"], Me = ["onMousedown", "onTouchstart"], Ce = ["onMousedown", "onTouchstart"], $ = 1, _e = {
  __name: "vue-ui-dashboard",
  props: {
    dataset: Array,
    config: Object
  },
  emits: ["change"],
  setup(R, { expose: B, emit: E }) {
    ae((e) => ({
      "56f02d00": J.value,
      "2fbe8dda": Z.value
    }));
    const L = {
      VueDataUi: o(() => import("./vue-data-ui-CfrRJcx_.js")),
      VueUi3dBar: o(() => import("./vue-ui-3d-bar-Bw5eaxc9.js")),
      VueUiAccordion: o(() => import("./vue-ui-accordion-CJnR6fHi.js")),
      VueUiAgePyramid: o(() => import("./vue-ui-age-pyramid-D0gBQw8X.js")),
      VueUiAnnotator: o(() => import("./vue-ui-annotator-DlcWoI3N.js")),
      VueUiCandlestick: o(() => import("./vue-ui-candlestick-85YmMYyP.js")),
      VueUiChestnut: o(() => import("./vue-ui-chestnut-B87se5P9.js")),
      VueUiDigits: o(() => import("./vue-ui-digits-a85ERBus.js")),
      VueUiDonut: o(() => import("./vue-ui-donut-Dgq-t23H.js")),
      VueUiDonutEvolution: o(() => import("./vue-ui-donut-evolution-BplxUn27.js")),
      VueUiDumbbell: o(() => import("./vue-ui-dumbbell-2ipG57aA.js")),
      VueUiFlow: o(() => import("./vue-ui-flow-DFlHSj8M.js")),
      VueUiGalaxy: o(() => import("./vue-ui-galaxy-CEnVeZAi.js")),
      VueUiGauge: o(() => import("./vue-ui-gauge-C7b6k24U.js")),
      VueUiHeatmap: o(() => import("./vue-ui-heatmap-BLoaEofW.js")),
      VueUiKpi: o(() => import("./vue-ui-kpi-D4pZ3CJ2.js")),
      VueUiMiniLoader: o(() => import("./vue-ui-mini-loader-D2QcTAa8.js")),
      VueUiMolecule: o(() => import("./vue-ui-molecule-BYVCvz1r.js")),
      VueUiMoodRadar: o(() => import("./vue-ui-mood-radar-B9zgFFlO.js")),
      VueUiNestedDonuts: o(() => import("./vue-ui-nested-donuts-n6rFlsNU.js")),
      VueUiOnion: o(() => import("./vue-ui-onion-B9fUzbb6.js")),
      VueUiParallelCoordinatePlot: o(() => import("./vue-ui-parallel-coordinate-plot-QokZ1gwW.js")),
      VueUiQuadrant: o(() => import("./vue-ui-quadrant-DwdrLzcC.js")),
      VueUiQuickChart: o(() => import("./vue-ui-quick-chart-Dad-wlg0.js")),
      VueUiRadar: o(() => import("./vue-ui-radar-B1OXJn1d.js")),
      VueUiRating: o(() => import("./vue-ui-rating-_WB5qAQ6.js")),
      VueUiRelationCircle: o(() => import("./vue-ui-relation-circle-CW73Nbxq.js")),
      VueUiRings: o(() => import("./vue-ui-rings-B8rqh0-_.js")),
      VueUiScatter: o(() => import("./vue-ui-scatter-01DXyF2q.js")),
      VueUiSkeleton: o(() => import("./vue-ui-skeleton-BufuSja5.js")),
      VueUiSmiley: o(() => import("./vue-ui-smiley-DfLMSjyl.js")),
      VueUiSparkHistogram: o(() => import("./vue-ui-sparkhistogram-ClDu95-3.js")),
      VueUiSparkStackbar: o(() => import("./vue-ui-sparkstackbar-YVKlhkKi.js")),
      VueUiSparkTrend: o(() => import("./vue-ui-spark-trend-d0lcXznw.js")),
      VueUiSparkbar: o(() => import("./vue-ui-sparkbar-CSJkcisH.js")),
      VueUiSparkgauge: o(() => import("./vue-ui-sparkgauge-CV7lhSGE.js")),
      VueUiSparkline: o(() => import("./vue-ui-sparkline-DT7wW1fR.js")),
      VueUiStripPlot: o(() => import("./vue-ui-strip-plot-BiYJlrH3.js")),
      VueUiTable: o(() => import("./vue-ui-table-DHaMznpt.js")),
      VueUiTableHeatmap: o(() => import("./vue-ui-table-heatmap-Ci2H0bXz.js")),
      VueUiTableSparkline: o(() => import("./vue-ui-table-sparkline-BFgLj1Ik.js")),
      VueUiThermometer: o(() => import("./vue-ui-thermometer-pUxYKQhF.js")),
      VueUiTimer: o(() => import("./vue-ui-timer-DfQM6a6k.js")),
      VueUiTiremarks: o(() => import("./vue-ui-tiremarks-DdNVrSbT.js")),
      VueUiTreemap: o(() => import("./vue-ui-treemap-BDpXhqzI.js")),
      VueUiVerticalBar: o(() => import("./vue-ui-vertical-bar-ByJLpT85.js")),
      VueUiWaffle: o(() => import("./vue-ui-waffle-Dp3DOosi.js")),
      VueUiWheel: o(() => import("./vue-ui-wheel-DBz7onD-.js")),
      VueUiWordCloud: o(() => import("./vue-ui-word-cloud-CG84NZet.js")),
      VueUiXy: o(() => import("./vue-ui-xy-CFm5IDQP.js")),
      VueUiXyCanvas: o(() => import("./vue-ui-xy-canvas-BVeP6Xmm.js")),
      VueUiCarouselTable: o(() => import("./vue-ui-carousel-table-DbY5LTHJ.js")),
      VueUiGizmo: o(() => import("./vue-ui-gizmo-eJFYYvWM.js")),
      VueUiStackbar: o(() => import("./vue-ui-stackbar-CRjmJOju.js")),
      VueUiBullet: o(() => import("./vue-ui-bullet-C6FMBrAT.js")),
      VueUiFunnel: o(() => import("./vue-ui-funnel-Bk0Fg5Fd.js")),
      VueUiHistoryPlot: o(() => import("./vue-ui-history-plot-QjiUbA7Y.js")),
      VueUiCirclePack: o(() => import("./vue-ui-circle-pack-Cd20ryi8.js")),
      VueUiWorld: o(() => import("./vue-ui-world-Dc8U0Mmg.js"))
    }, { vue_ui_dashboard: F } = pe(), D = R, s = V(() => ve({
      userConfig: D.config,
      defaultConfig: F
    })), P = r(fe()), h = r(s.value.locked);
    function A() {
      h.value = !h.value;
    }
    const l = r(D.dataset.map((e, t) => ({
      ...e,
      index: t
    }))), X = V(
      () => l.value.map((e) => ({
        ...e,
        resolvedComponent: typeof e.component == "string" ? L[e.component] : e.component
      }))
    ), v = r(null), n = r(null), p = r({ x: 0, y: 0 }), f = r({ x: 0, y: 0 }), d = r(null), c = r(!1), m = r(null), T = r(!1), w = r(!1);
    function x(e) {
      const t = e.target;
      (t.tagName === "INPUT" && t.type === "range" || t.classList.contains("range-handle")) && (w.value = !0);
    }
    function H(e) {
      const t = e.target;
      t.tagName === "INPUT" && t.type === "range" && (w.value = !1);
    }
    function I() {
      T.value = !0, he({
        domElement: document.getElementById(`vue-ui-dashboard_${P.value}`),
        fileName: "vue-ui-dashboard"
      }).finally(() => {
        T.value = !1;
      });
    }
    function G(e) {
      if (!h.value && (c.value = !0, m.value = e, n.value === null)) {
        v.value = e, p.value = { x: event.clientX, y: event.clientY };
        const t = l.value[e], a = 100 - t.width, u = 100 - t.height;
        t.left < 0 && (t.left = 0), t.top < 0 && (t.top = 0), t.left > a && (t.left = a), t.top > u && (t.top = u), t.left < 0 && (t.left = 0), t.top < 0 && (t.top = 0), t.left + t.width > 100 && (t.left = 100 - t.width), t.top + t.height > 100 && (t.top = 100 - t.height);
      }
    }
    function M(e, t) {
      c.value = !0, m.value = e, n.value = { index: e, direction: t };
      const a = l.value[e];
      f.value = { x: event.clientX, y: event.clientY, initialWidth: a.width, initialHeight: a.height };
    }
    function Y(e, t, a) {
      if (n.value.direction.includes("top")) {
        const u = e.height - a / d.value.offsetHeight * 100;
        u >= $ && (e.top += a / d.value.offsetHeight * 100, e.height = u);
      }
      if (n.value.direction.includes("bottom")) {
        const u = e.height + a / d.value.offsetHeight * 100;
        u >= $ && (e.height = u);
      }
      if (n.value.direction.includes("left")) {
        const u = e.width - t / d.value.offsetWidth * 100;
        u >= $ && (e.left += t / d.value.offsetWidth * 100, e.width = u);
      }
      if (n.value.direction.includes("right")) {
        const u = e.width + t / d.value.offsetWidth * 100;
        u >= $ && (e.width = u);
      }
    }
    function O(e) {
      if (!(h.value || w.value)) {
        if (c.value = !0, v.value !== null) {
          const t = l.value[v.value], a = e.clientX - p.value.x, u = e.clientY - p.value.y, i = t.left + a / d.value.offsetWidth * 100, U = t.top + u / d.value.offsetHeight * 100;
          i >= 0 && U >= 0 && i + t.width <= 100 && U + t.height <= 100 && (t.left = i, t.top = U), p.value = { x: e.clientX, y: e.clientY };
        }
        if (n.value !== null) {
          const t = l.value[n.value.index], a = e.clientX - f.value.x, u = e.clientY - f.value.y;
          Y(t, a, u), f.value = { x: e.clientX, y: e.clientY };
        }
      }
    }
    const j = E;
    ie(
      l,
      (e) => {
        e && !c.value && j("change", l.value);
      },
      { deep: !0 }
    );
    function Q() {
      v.value = null, n.value = null, c.value = !1, m.value = null, l.value.forEach((e) => {
        e.left = Math.round(e.left / 100 * 100), e.top = Math.round(e.top / 100 * 100), e.width = Math.round(e.width / 100 * 100), e.height = Math.round(e.height / 100 * 100);
      });
    }
    function K(e) {
      h.value || w.value || (c.value = !0, m.value = e, n.value === null && (v.value = e, p.value = { x: event.touches[0].clientX, y: event.touches[0].clientY }));
    }
    function C(e, t, a) {
      if (c.value = !0, m.value = e, n.value === null) {
        n.value = { index: e, direction: t };
        const u = l.value[e];
        f.value = { x: a.touches[0].clientX, y: a.touches[0].clientY, initialWidth: u.width, initialHeight: u.height };
      }
    }
    function _(e) {
      if (c.value = !0, e.preventDefault(), n.value !== null) {
        const t = l.value[n.value.index], a = e.touches[0].clientX - f.value.x, u = e.touches[0].clientY - f.value.y;
        Y(t, a, u), f.value = { x: e.touches[0].clientX, y: e.touches[0].clientY };
      }
    }
    function q(e) {
      if (!(h.value || w.value) && (c.value = !0, e.preventDefault(), v.value !== null)) {
        const t = l.value[v.value], a = e.touches[0].clientX - p.value.x, u = e.touches[0].clientY - p.value.y, i = t.left + a / d.value.offsetWidth * 100, U = t.top + u / d.value.offsetHeight * 100;
        i >= 0 && U >= 0 && i + t.width <= 100 && U + t.height <= 100 && (t.left = i, t.top = U), p.value = { x: e.touches[0].clientX, y: e.touches[0].clientY };
      }
    }
    function k() {
      c.value = !1, m.value = null, v.value = null, n.value = null, l.value.forEach((e) => {
        e.left = Math.round(e.left / 100 * 100), e.top = Math.round(e.top / 100 * 100), e.width = Math.round(e.width / 100 * 100), e.height = Math.round(e.height / 100 * 100);
      });
    }
    const J = V(() => s.value.style.item.borderColor), Z = V(() => s.value.style.resizeHandles.backgroundColor), ee = V(() => s.value.style.board.aspectRatio), te = V(() => s.value.style.board.backgroundColor), oe = V(() => s.value.style.board.border);
    function ue() {
      return l.value;
    }
    return B({
      generatePdf: I,
      getItemsPositions: ue,
      toggleLock: A
    }), (e, t) => (g(), y("div", {
      onMousedown: x,
      onMouseup: H,
      onTouchstart: x,
      onTouchend: H
    }, [
      s.value.allowPrint ? (g(), y("div", ge, [
        b("button", {
          class: "vue-ui-dashboard-button",
          onClick: I,
          disabled: T.value,
          style: S([{ "margin-top": "12px" }, `color:${s.value.style.board.color}`])
        }, [
          T.value ? (g(), y("svg", {
            key: 0,
            class: "vue-ui-dashboard-print-icon",
            xmlns: "http://www.w3.org/2000/svg",
            width: "20",
            height: "20",
            viewBox: "0 0 24 24",
            "stroke-width": "1.5",
            stroke: s.value.style.board.color,
            fill: "none",
            "stroke-linecap": "round",
            "stroke-linejoin": "round"
          }, t[4] || (t[4] = [
            ne('<path stroke="none" d="M0 0h24v24H0z" fill="none" data-v-f5946722></path><path d="M18 16v.01" data-v-f5946722></path><path d="M6 16v.01" data-v-f5946722></path><path d="M12 5v.01" data-v-f5946722></path><path d="M12 12v.01" data-v-f5946722></path><path d="M12 1a4 4 0 0 1 2.001 7.464l.001 .072a3.998 3.998 0 0 1 1.987 3.758l.22 .128a3.978 3.978 0 0 1 1.591 -.417l.2 -.005a4 4 0 1 1 -3.994 3.77l-.28 -.16c-.522 .25 -1.108 .39 -1.726 .39c-.619 0 -1.205 -.14 -1.728 -.391l-.279 .16l.007 .231a4 4 0 1 1 -2.212 -3.579l.222 -.129a3.998 3.998 0 0 1 1.988 -3.756l.002 -.071a4 4 0 0 1 -1.995 -3.265l-.005 -.2a4 4 0 0 1 4 -4z" data-v-f5946722></path>', 6)
          ]), 8, Ue)) : (g(), y("span", Ve, "PDF"))
        ], 12, be)
      ])) : N("", !0),
      b("div", {
        class: "vue-ui-dashboard-container",
        ref_key: "dashboardContainer",
        ref: d,
        id: `vue-ui-dashboard_${P.value}`,
        style: S(`border:${oe.value}; background:${te.value}; aspect-ratio:${ee.value}`)
      }, [
        b("div", {
          class: "vue-ui-dashboard-grid-container",
          ref: "container",
          onMousemove: O,
          onMouseup: Q,
          onTouchmove: q,
          onTouchend: k,
          style: S(`background:${s.value.style.board.backgroundColor}`)
        }, [
          t[5] || (t[5] = b("div", { class: "vue-ui-dashboard-grid" }, null, -1)),
          (g(!0), y(W, null, le(X.value, (a, u) => (g(), y("div", {
            key: a.id,
            class: re({ "vue-ui-dashboard-grid-item": !0, "vue-ui-dashboard-grid-item--locked": h.value }),
            style: S({
              width: `${a.width}%`,
              height: `${a.height}%`,
              left: `${a.left}%`,
              top: `${a.top}%`,
              cursor: "move",
              boxShadow: m.value === u ? "0 6px 12px -3px rgba(0,0,0,0.3)" : "",
              zIndex: m.value === u ? X.value.length + 1 : a.index,
              backgroundColor: s.value.style.item.backgroundColor
            }),
            onMousedown: (i) => G(u),
            onTouchstart: (i) => K(u)
          }, [
            h.value ? N("", !0) : (g(), y(W, { key: 0 }, [
              b("div", {
                class: "vue-ui-dashboard-resize-handle vue-ui-dashboard-top-left",
                onMousedown: (i) => M(u, "top-left"),
                onTouchstart: (i) => C(u, "top-left", i),
                onTouchmove: t[0] || (t[0] = (i) => _(i)),
                onTouchend: k
              }, null, 40, ke),
              b("div", {
                class: "vue-ui-dashboard-resize-handle vue-ui-dashboard-top-right",
                onMousedown: (i) => M(u, "top-right"),
                onTouchstart: (i) => C(u, "top-right", i),
                onTouchmove: t[1] || (t[1] = (i) => _(i)),
                onTouchend: k
              }, null, 40, Te),
              b("div", {
                class: "vue-ui-dashboard-resize-handle vue-ui-dashboard-bottom-left",
                onMousedown: (i) => M(u, "bottom-left"),
                onTouchstart: (i) => C(u, "bottom-left", i),
                onTouchmove: t[2] || (t[2] = (i) => _(i)),
                onTouchend: k
              }, null, 40, Me),
              b("div", {
                class: "vue-ui-dashboard-resize-handle vue-ui-dashboard-bottom-right",
                onMousedown: (i) => M(u, "bottom-right"),
                onTouchstart: (i) => C(u, "bottom-right", i),
                onTouchmove: t[3] || (t[3] = (i) => _(i)),
                onTouchend: k
              }, null, 40, Ce)
            ], 64)),
            z(e.$slots, "top", {
              item: a,
              index: u
            }, void 0, !0),
            a.resolvedComponent ? (g(), se(de(a.resolvedComponent), ce({
              key: 1,
              ref_for: !0
            }, a.props), null, 16)) : z(e.$slots, "content", {
              key: 2,
              item: a,
              index: u,
              left: a.left,
              top: a.top,
              height: a.height,
              width: a.width
            }, void 0, !0),
            z(e.$slots, "bottom", {
              item: a,
              index: u
            }, void 0, !0)
          ], 46, we))), 128))
        ], 36)
      ], 12, ye)
    ], 32));
  }
}, Xe = /* @__PURE__ */ me(_e, [["__scopeId", "data-v-f5946722"]]);
export {
  Xe as default
};
