"use strict";
/* Socket Lib - Built with rolldown */
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_primordials_math = require('../primordials/math.js');
const require_strings_width = require('../strings/width.js');

//#region src/tables/padding.ts
/**
* @file Cell padding + display-width measurement — shared helpers used by both
*   the simple and bordered table renderers. `displayWidth` routes through
*   `stringWidth` so multi-cell glyphs (full-width CJK, emoji, combined code
*   points) contribute their actual terminal column count rather than a naive
*   `.length`.
*/
/**
* Calculate display width accounting for ANSI codes, CJK, and emoji. Uses
* `stringWidth` so multi-cell glyphs (full-width CJK, emoji, combined code
* points) contribute their actual terminal column count to padding.
*/
function displayWidth(text) {
	return /* @__PURE__ */ require_strings_width.stringWidth(text);
}
/**
* Pad text to specified width with alignment.
*/
function padText(text, width, align = "left") {
	const padding = require_primordials_math.MathMax(0, width - displayWidth(text));
	switch (align) {
		case "right": return " ".repeat(padding) + text;
		case "center": {
			const leftPad = Math.floor(padding / 2);
			const rightPad = padding - leftPad;
			return " ".repeat(leftPad) + text + " ".repeat(rightPad);
		}
		default: return text + " ".repeat(padding);
	}
}

//#endregion
exports.displayWidth = displayWidth;
exports.padText = padText;