import { jsxs as i, jsx as t } from "react/jsx-runtime";
import { useMemo as m, useState as b, useRef as f, useEffect as S } from "react";
import "./index-CuHybtft.js";
import { u as o, a as p, B as N, X as D, C as J } from "./switch-Dkx2qEOr.js";
import "./index-CPyEi9gS.js";
import "./index-CJdxSyQq.js";
import "react-dom";
function V() {
  const e = o((s) => s.dashboard), c = o((s) => s.actions.setDashboard), h = o(
    (s) => s.showDashboardJSON
  ), l = o(
    (s) => s.actions.setShowDashboardJSON
  ), a = m(
    () => e ? JSON.stringify(e, null, 2) : "",
    [e]
  ), [u, n] = b(a), r = f(a);
  return S(() => {
    a !== r.current && (n(a), r.current = a);
  }, [a]), /* @__PURE__ */ i(
    "div",
    {
      className: p("relative p-2", {
        hidden: !h
      }),
      children: [
        /* @__PURE__ */ i(
          N,
          {
            variant: "secondary",
            size: "sm",
            className: "absolute right-2 top-2 z-10 h-8",
            onClick: () => l(!1),
            children: [
              /* @__PURE__ */ t(D, { className: "mr-2 h-4 w-4" }),
              "Close"
            ]
          }
        ),
        /* @__PURE__ */ t("div", { className: "h-[550px] overflow-hidden", children: /* @__PURE__ */ t(
          J,
          {
            value: u,
            onValueChange: (s) => {
              n(s);
              try {
                const d = JSON.parse(s);
                r.current = JSON.stringify(
                  d,
                  null,
                  2
                ), c(d);
              } catch {
              }
            },
            language: "json"
          }
        ) })
      ]
    }
  );
}
export {
  V as default
};
