"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 stderr_exports = {};
__export(stderr_exports, {
  clearLine: () => clearLine,
  cursorTo: () => cursorTo,
  getColumns: () => getColumns,
  getRows: () => getRows,
  isTTY: () => isTTY,
  stderr: () => stderr,
  writeError: () => writeError,
  writeErrorFormatted: () => writeErrorFormatted,
  writeErrorLine: () => writeErrorLine,
  writeStackTrace: () => writeStackTrace,
  writeWarning: () => writeWarning
});
module.exports = __toCommonJS(stderr_exports);
var import_node_process = __toESM(require("node:process"));
var import_internal = require("./_internal");
const stderr = import_node_process.default.stderr;
function clearLine() {
  (0, import_internal.clearLineOn)(stderr);
}
function cursorTo(x, y) {
  (0, import_internal.cursorToOn)(stderr, x, y);
}
function getColumns() {
  return (0, import_internal.getColumnsOf)(stderr);
}
function getRows() {
  return (0, import_internal.getRowsOf)(stderr);
}
function isTTY() {
  return (0, import_internal.isTTYOf)(stderr);
}
function writeError(text) {
  stderr.write(text);
}
function writeErrorFormatted(message, prefix = "Error") {
  const formatted = `${prefix}: ${message}`;
  writeErrorLine(formatted);
}
function writeErrorLine(text = "") {
  stderr.write(`${text}
`);
}
function writeStackTrace(error) {
  if (error.stack) {
    writeErrorLine(error.stack);
  } else {
    writeErrorFormatted(error.message);
  }
}
function writeWarning(message, prefix = "Warning") {
  const formatted = `${prefix}: ${message}`;
  writeErrorLine(formatted);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  clearLine,
  cursorTo,
  getColumns,
  getRows,
  isTTY,
  stderr,
  writeError,
  writeErrorFormatted,
  writeErrorLine,
  writeStackTrace,
  writeWarning
});
