@visulima/ansi
Version:
ANSI escape codes for some terminal swag.
28 lines (25 loc) • 944 B
JavaScript
import { D as DCS, a as ST, S as SEP } from './packem_shared/constants-CE7WkXh_.mjs';
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
const stringToHex = /* @__PURE__ */ __name((input) => {
let hex = "";
for (let index = 0; index < input.length; index += 1) {
const charCode = input.codePointAt(index);
if (charCode === void 0) {
continue;
}
const byteHex = charCode.toString(16).toUpperCase();
hex += byteHex.length === 1 ? `0${byteHex}` : byteHex;
}
return hex;
}, "stringToHex");
const XTGETTCAP = /* @__PURE__ */ __name((...caps) => {
if (caps.length === 0) {
return "";
}
const hexCaps = caps.map((cap) => stringToHex(cap));
return `${DCS}+q${hexCaps.join(SEP)}${ST}`;
}, "XTGETTCAP");
const requestTermcap = XTGETTCAP;
const requestTerminfo = XTGETTCAP;
export { XTGETTCAP, requestTermcap, requestTerminfo };