import { jsxs as a, Fragment as h, jsx as e } from "react/jsx-runtime";
import { useState as x } from "react";
import { useMemoizedFn as s } from "ahooks";
import { useTheme as y, MenuItem as S, Divider as u } from "@mui/material";
import { Icon as g } from "@iconify/react";
import D from "@iconify-icons/material-symbols/lens";
import { translate as I } from "../../Locale/util.js";
import { translations as z } from "../libs/translation.js";
import { DID_SPACE_URL as k } from "../../Util/constant.js";
import { TBox as T } from "../../MuiWrap/index.js";
import v from "../../Typography/index.js";
import w from "../../DIDLogo/index.js";
function O({ session: m, locale: p = "en", ...c }) {
  const d = s((r, n = {}) => I(z, r, p, "en", n)), t = y(), o = m.user?.didSpace ?? {}, [i, l] = x(0), f = s(({ fontSize: r, initialSize: n }) => {
    l(Math.ceil((n - r) / 4));
  });
  return /* @__PURE__ */ a(h, { children: [
    /* @__PURE__ */ e(T, { component: "a", href: k, sx: { p: 0.5, display: "block", textDecoration: "none" }, ...c, children: /* @__PURE__ */ a(
      S,
      {
        sx: {
          display: "flex",
          alignItems: "center",
          gap: 0.5,
          py: 1
        },
        children: [
          /* @__PURE__ */ e("div", { style: { display: "flex", alignItems: "center" }, children: /* @__PURE__ */ e(w, { name: "spaces", size: 20, dark: t.palette.mode === "dark", fontSize: 40 }) }),
          /* @__PURE__ */ e("span", { style: { color: t.palette.text.secondary }, children: ":" }),
          /* @__PURE__ */ e(
            "div",
            {
              style: {
                flexGrow: 1,
                minWidth: 0,
                color: o.did ? t.palette.text.primary : t.palette.text.secondary,
                overflow: "hidden",
                whiteSpace: "nowrap"
              },
              children: /* @__PURE__ */ e(v, { fontSize: "auto", minFontSize: 1, sx: { marginTop: `${i}px` }, onShrink: f, children: o.did ? o.name : d("disconnected") })
            }
          ),
          /* @__PURE__ */ e(
            g,
            {
              style: { marginTop: `${i}px`, flexShrink: 0 },
              icon: D,
              fontSize: 8,
              color: o.did ? t.palette.success.main : t.palette.grey[200]
            }
          )
        ]
      }
    ) }),
    /* @__PURE__ */ e(u, {})
  ] });
}
export {
  O as default
};
