"use strict";
/* Socket Lib - Built with esbuild */
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var header_exports = {};
__export(header_exports, {
  createHeader: () => createHeader,
  createSectionHeader: () => createSectionHeader,
  printHeader: () => printHeader
});
module.exports = __toCommonJS(header_exports);
var import_yoctocolors_cjs = __toESM(require("../external/yoctocolors-cjs"));
var import_format = require("../strings/format");
var import_logger = require("../logger/logger");
var import_array = require("../primordials/array");
const logger = (0, import_logger.getDefaultLogger)();
function createHeader(title, options) {
  const {
    bold = true,
    borderChar = "=",
    color = "cyan",
    padding = 1,
    width = 80
  } = { __proto__: null, ...options };
  const border = (0, import_format.repeatString)(borderChar, width);
  let formattedTitle = title;
  if (color && import_yoctocolors_cjs.default[color]) {
    formattedTitle = import_yoctocolors_cjs.default[color](formattedTitle);
  }
  if (bold && import_yoctocolors_cjs.default.bold) {
    formattedTitle = import_yoctocolors_cjs.default.bold(formattedTitle);
  }
  const centeredTitle = (0, import_format.centerText)(formattedTitle, width);
  const paddingLine = (0, import_format.repeatString)(" ", width);
  const lines = [border];
  for (let i = 0; i < padding; i++) {
    (0, import_array.ArrayPrototypePush)(lines, paddingLine);
  }
  (0, import_array.ArrayPrototypePush)(lines, centeredTitle);
  for (let i = 0; i < padding; i++) {
    (0, import_array.ArrayPrototypePush)(lines, paddingLine);
  }
  (0, import_array.ArrayPrototypePush)(lines, border);
  return lines.join("\n");
}
function createSectionHeader(title, options) {
  const {
    borderChar = "-",
    color = "blue",
    width = 60
  } = { __proto__: null, ...options };
  return createHeader(title, {
    width,
    borderChar,
    padding: 0,
    color,
    bold: false
  });
}
function printHeader(title) {
  const border = (0, import_format.repeatString)("\u2550", 55);
  logger.log(border);
  logger.log(`  ${title}`);
  logger.log(border);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  createHeader,
  createSectionHeader,
  printHeader
});
