import { jsx, jsxs } from "react/jsx-runtime";
import { Box, Text } from "ink";
import { StyledBox } from "./StyledBox.js";
function SessionListBox({ data }) {
  if (data.sessions.length === 0) {
    return /* @__PURE__ */ jsxs(StyledBox, { title: "Sessions", children: [
      /* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsx(Text, { color: "gray", children: "No sessions found." }) }),
      /* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsx(Text, { color: "gray", children: "Run `dexto` to start a new session." }) })
    ] });
  }
  return /* @__PURE__ */ jsxs(StyledBox, { title: "Sessions", children: [
    data.sessions.map((session) => /* @__PURE__ */ jsxs(Box, { marginTop: 1, children: [
      /* @__PURE__ */ jsx(Box, { width: 12, children: /* @__PURE__ */ jsxs(Text, { color: session.isCurrent ? "green" : "cyan", bold: session.isCurrent, children: [
        session.isCurrent ? ">" : " ",
        " ",
        session.id.slice(0, 8)
      ] }) }),
      /* @__PURE__ */ jsx(Box, { width: 14, children: /* @__PURE__ */ jsxs(Text, { color: "gray", children: [
        session.messageCount,
        " messages"
      ] }) }),
      /* @__PURE__ */ jsx(Text, { color: "gray", children: session.lastActive })
    ] }, session.id)),
    /* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsxs(Text, { color: "gray", children: [
      "Total: ",
      data.total,
      " sessions"
    ] }) }),
    /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { color: "gray", children: "Use /resume to switch sessions" }) })
  ] });
}
export {
  SessionListBox
};
