"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 QueuedMessagesDisplay_exports = {};
__export(QueuedMessagesDisplay_exports, {
  QUEUE_EDIT_SHORTCUTS: () => QUEUE_EDIT_SHORTCUTS,
  QueuedMessagesDisplay: () => QueuedMessagesDisplay
});
module.exports = __toCommonJS(QueuedMessagesDisplay_exports);
var import_jsx_runtime = require("react/jsx-runtime");
var import_ink = require("ink");
var import_queuedComposerContent = require("../../utils/queuedComposerContent.js");
const isMac = process.platform === "darwin";
const QUEUE_EDIT_SHORTCUTS = {
  currentTurn: isMac ? "\u2325 + \u2191 edit" : "Alt + \u2191 edit",
  followUp: "\u2191 edit"
};
function truncateText(text, maxLength = 60) {
  const singleLine = text.replace(/\n/g, " ").trim();
  if (singleLine.length <= maxLength) {
    return singleLine;
  }
  return singleLine.slice(0, maxLength - 3) + "...";
}
function QueuedMessagesDisplay({
  messages,
  label = "queued",
  hint = "\u2191 to edit"
}) {
  if (messages.length === 0) return null;
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ink.Box, { flexDirection: "column", marginBottom: 1, children: [
    /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ink.Box, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ink.Text, { color: "gray", children: [
        messages.length,
        " message",
        messages.length !== 1 ? "s" : "",
        " ",
        label
      ] }),
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { color: "gray", children: " \u2022 " }),
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { color: "gray", children: hint })
    ] }),
    messages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ink.Box, { flexDirection: "row", children: [
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { color: "gray", children: index === messages.length - 1 ? "\u21B3 " : "\u2502 " }),
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { color: "gray", italic: true, children: truncateText((0, import_queuedComposerContent.previewQueuedContent)(message.content)) })
    ] }, message.id))
  ] });
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  QUEUE_EDIT_SHORTCUTS,
  QueuedMessagesDisplay
});
