"use strict";
/* Socket Lib - Built with esbuild */
"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 shimmer_terminal_exports = {};
__export(shimmer_terminal_exports, {
  ANSI_RESET: () => import_constants.ANSI_RESET,
  ansiTruecolor: () => ansiTruecolor,
  colorsToAnsi: () => colorsToAnsi,
  renderFrame: () => renderFrame
});
module.exports = __toCommonJS(shimmer_terminal_exports);
var import_constants = require("../ansi/constants");
var import_shimmer = require("./shimmer");
function ansiTruecolor([r, g, b]) {
  return `\x1B[38;2;${r};${g};${b}m`;
}
function colorsToAnsi(text, colors) {
  const chars = [...text];
  let out = "";
  for (let i = 0; i < chars.length; i++) {
    const c = colors[i];
    if (c === void 0) {
      out += chars[i];
      continue;
    }
    out += `${ansiTruecolor(c)}${chars[i]}${import_constants.ANSI_RESET}`;
  }
  return out;
}
function renderFrame(spec, text, frame) {
  const chars = [...text];
  return colorsToAnsi(text, (0, import_shimmer.frameColors)(spec, chars.length, frame));
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  ANSI_RESET,
  ansiTruecolor,
  colorsToAnsi,
  renderFrame
});
