"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var GenericRenderer_exports = {};
__export(GenericRenderer_exports, {
  GenericRenderer: () => GenericRenderer
});
module.exports = __toCommonJS(GenericRenderer_exports);
var import_jsx_runtime = require("react/jsx-runtime");
var import_ink = require("ink");
function GenericRenderer({ content, maxLines = 15 }) {
  const text = content.filter((part) => part.type === "text").map((part) => part.text).join("\n");
  if (!text) {
    return null;
  }
  const lines = text.split("\n").filter((line) => line.trim().length > 0);
  const displayLines = lines.slice(0, maxLines);
  const truncated = lines.length > maxLines;
  if (lines.length === 1 && lines[0]) {
    const line = lines[0];
    return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ink.Text, { color: "gray", children: [
      "  \u23BF ",
      line.slice(0, 80),
      line.length > 80 ? "..." : ""
    ] });
  }
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ink.Box, { flexDirection: "column", children: [
    /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ink.Text, { color: "gray", children: [
      "  \u23BF ",
      displayLines.length,
      " lines"
    ] }),
    displayLines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ink.Text, { color: "gray", wrap: "truncate", children: [
      "  \u23BF ",
      line
    ] }, i)),
    truncated && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ink.Text, { color: "gray", children: [
      "  \u23BF ",
      "... ",
      lines.length - maxLines,
      " more lines"
    ] })
  ] });
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  GenericRenderer
});
