import { e as gql, j as jsxRuntimeExports, p as s, q as c, u, t as n, v as i } from "./index-Cr4zbAtA.js";
import { M as Metadata } from "./Metadata-aK5zM6ek.js";
import { c as createCell } from "./createCell-D7cbP3PP.js";
const QUERY = gql`
  query InfoQuery {
    studioInfo: studioConfig {
      id
      basePort
      graphiql {
        id
        authImpersonation {
          id
          authProvider
          userId
          email
          # TODO: Add support for roles in generated auth headers
          # roles
          jwtSecret
        }
      }
    }
    projectInfo: userProjectConfig {
      ssr {
        id
        enabled {
          status
          message
        }
      }
    }
  }
`;
const Loading = () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." });
const Empty = () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Empty" });
const Failure = ({
  error
}) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
  className: "font-bold text-tremor-brand dark:text-dark-tremor-brand",
  children: [
    "Error: ",
    error == null ? void 0 : error.message
  ]
});
const InfoItem = ({
  title,
  value
}) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
    className: "mt-4 space-y-4",
    children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { className: "font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong", children: title }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-tremor-default text-tremor-content dark:text-dark-tremor-content ${value === void 0 || value === null ? "italic" : ""}`, children: value ?? "Not set" })
    ]
  });
};
const Success = ({
  studioInfo,
  projectInfo
}) => {
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(s, {
    className: "mt-6",
    children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(c, {
        className: "mb-6",
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(u, { children: "General" }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(u, { children: "User Impersonation" })
        ]
      }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs(n, {
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs(i, {
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(InfoItem, { title: "Base Port", value: studioInfo == null ? void 0 : studioInfo.basePort }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(InfoItem, { title: "Version", value: window.RW_STUDIO_VERSION }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(InfoItem, { title: "SSR", value: (_a = projectInfo == null ? void 0 : projectInfo.ssr) == null ? void 0 : _a.enabled.message })
            ]
          }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(i, {
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(InfoItem, { title: "Auth Provider", value: (_c = (_b = studioInfo == null ? void 0 : studioInfo.graphiql) == null ? void 0 : _b.authImpersonation) == null ? void 0 : _c.authProvider }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(InfoItem, { title: "User ID", value: (_e = (_d = studioInfo == null ? void 0 : studioInfo.graphiql) == null ? void 0 : _d.authImpersonation) == null ? void 0 : _e.userId }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(InfoItem, { title: "Email", value: (_g = (_f = studioInfo == null ? void 0 : studioInfo.graphiql) == null ? void 0 : _f.authImpersonation) == null ? void 0 : _g.email }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(InfoItem, { title: "JWT Secret", value: (_i = (_h = studioInfo == null ? void 0 : studioInfo.graphiql) == null ? void 0 : _h.authImpersonation) == null ? void 0 : _i.jwtSecret })
            ]
          })
        ]
      })
    ]
  });
};
const InfoCell = createCell({ QUERY, Loading, Empty, Failure, Success, displayName: "InfoCell" });
const InfoPage = () => {
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(Metadata, { title: "Settings", description: "Settings page" }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-tremor-title font-bold text-tremor-content-strong dark:text-dark-tremor-content-strong", children: "Settings" }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mt-2 text-tremor-default leading-6 text-tremor-content dark:text-dark-tremor-content", children: [
      "Studio configuration and settings. You can change most of these settings by updating your ",
      /* @__PURE__ */ jsxRuntimeExports.jsx("samp", { children: "redwood.toml" }),
      " file."
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(InfoCell, {})
  ] });
};
export {
  InfoPage as default
};
