UNPKG

@hopeio/utils

Version:
219 lines (218 loc) 5.77 kB
import { g as C } from "./index-D5v913EJ.js"; function _(e) { return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; } var x = { exports: {} }, r = x.exports = {}, s, i; function v() { throw new Error("setTimeout has not been defined"); } function y() { throw new Error("clearTimeout has not been defined"); } (function() { try { typeof setTimeout == "function" ? s = setTimeout : s = v; } catch { s = v; } try { typeof clearTimeout == "function" ? i = clearTimeout : i = y; } catch { i = y; } })(); function B(e) { if (s === setTimeout) return setTimeout(e, 0); if ((s === v || !s) && setTimeout) return s = setTimeout, setTimeout(e, 0); try { return s(e, 0); } catch { try { return s.call(null, e, 0); } catch { return s.call(this, e, 0); } } } function A(e) { if (i === clearTimeout) return clearTimeout(e); if ((i === y || !i) && clearTimeout) return i = clearTimeout, clearTimeout(e); try { return i(e); } catch { try { return i.call(null, e); } catch { return i.call(this, e); } } } var c = [], h = !1, f, T = -1; function G() { !h || !f || (h = !1, f.length ? c = f.concat(c) : T = -1, c.length && I()); } function I() { if (!h) { var e = B(G); h = !0; for (var n = c.length; n; ) { for (f = c, c = []; ++T < n; ) f && f[T].run(); T = -1, n = c.length; } f = null, h = !1, A(e); } } r.nextTick = function(e) { var n = new Array(arguments.length - 1); if (arguments.length > 1) for (var o = 1; o < arguments.length; o++) n[o - 1] = arguments[o]; c.push(new $(e, n)), c.length === 1 && !h && B(I); }; function $(e, n) { this.fun = e, this.array = n; } $.prototype.run = function() { this.fun.apply(null, this.array); }; r.title = "browser"; r.browser = !0; r.env = {}; r.argv = []; r.version = ""; r.versions = {}; function u() { } r.on = u; r.addListener = u; r.once = u; r.off = u; r.removeListener = u; r.removeAllListeners = u; r.emit = u; r.prependListener = u; r.prependOnceListener = u; r.listeners = function(e) { return []; }; r.binding = function(e) { throw new Error("process.binding is not supported"); }; r.cwd = function() { return "/"; }; r.chdir = function(e) { throw new Error("process.chdir is not supported"); }; r.umask = function() { return 0; }; var S = x.exports; const E = /* @__PURE__ */ _(S); let a = !0; const g = typeof self < "u" ? self : typeof window < "u" ? window : typeof C < "u" ? C : {}; let d = 0; if (g.process && g.process.env && g.process.stdout) { const { FORCE_COLOR: e, NODE_DISABLE_COLORS: n, NO_COLOR: o, TERM: l, COLORTERM: p } = g.process.env; n || o || e === "0" ? a = !1 : e === "1" || e === "2" || e === "3" ? a = !0 : l === "dumb" ? a = !1 : "CI" in g.process.env && [ "TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE", "DRONE" ].some((w) => w in g.process.env) ? a = !0 : a = E.stdout.isTTY, a && (E.platform === "win32" || p && (p === "truecolor" || p === "24bit") ? d = 3 : l && (l.endsWith("-256color") || l.endsWith("256")) ? d = 2 : d = 1); } let m = { enabled: a, supportLevel: d }; function t(e, n, o = 1) { const l = `\x1B[${e}m`, p = `\x1B[${n}m`, w = new RegExp(`\\x1b\\[${n}m`, "g"); return (L) => m.enabled && m.supportLevel >= o ? l + ("" + L).replace(w, l) + p : "" + L; } function M(e, n, o) { return e >> 4 === n >> 4 && n >> 4 === o >> 4 ? e < 8 ? 16 : e > 248 ? 231 : Math.round((e - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(e / 255 * 5) + 6 * Math.round(n / 255 * 5) + Math.round(o / 255 * 5); } function k(e) { return ("" + e).replace(/\x1b\[[0-9;]+m/g, "").replace(/\x1b\]8;;.*?\x07(.*?)\x1b\]8;;\x07/g, (n, o) => o); } const P = t(0, 0), U = t(1, 22), V = t(2, 22), W = t(3, 23), j = t(4, 24), q = t(7, 27), F = t(8, 28), Q = t(9, 29), H = t(30, 39), K = t(31, 39), z = t(32, 39), J = t(33, 39), X = t(34, 39), Z = t(35, 39), ee = t(36, 39), te = t(97, 39), ne = t(90, 39), oe = t(37, 39), re = t(91, 39), se = t(92, 39), ie = t(93, 39), ce = t(94, 39), ue = t(95, 39), le = t(96, 39), ae = t(40, 49), fe = t(41, 49), ge = t(42, 49), he = t(43, 49), pe = t(44, 49), de = t(45, 49), me = t(46, 49), be = t(107, 49), Te = t(100, 49), we = t(101, 49), ve = t(102, 49), ye = t(103, 49), Le = t(104, 49), Ce = t(105, 49), Ee = t(106, 49), Oe = t(47, 49), D = (e) => t( "38;5;" + e, 0, 2 /* ansi256 */ ), N = (e) => t( "48;5;" + e, 0, 2 /* ansi256 */ ), Re = (e, n, o) => m.supportLevel === 2 ? D(M(e, n, o)) : t( `38;2;${e};${n};${o}`, 0, 3 /* trueColor */ ), xe = (e, n, o) => m.supportLevel === 2 ? N(M(e, n, o)) : t( `48;2;${e};${n};${o}`, 0, 3 /* trueColor */ ), O = "\x1B]", R = "\x07", b = ";"; function Be(e, n) { return m.enabled ? O + "8" + b + b + n + R + e + O + "8" + b + b + R : `${e} (​${n}​)`; } export { D as ansi256, N as ansi256Bg, ae as bgBlack, pe as bgBlue, me as bgCyan, Te as bgGray, ge as bgGreen, Le as bgLightBlue, Ee as bgLightCyan, Oe as bgLightGray, ve as bgLightGreen, Ce as bgLightMagenta, we as bgLightRed, ye as bgLightYellow, de as bgMagenta, fe as bgRed, be as bgWhite, he as bgYellow, H as black, X as blue, U as bold, ee as cyan, V as dim, ne as gray, z as green, F as hidden, q as inverse, W as italic, ce as lightBlue, le as lightCyan, oe as lightGray, se as lightGreen, ue as lightMagenta, re as lightRed, ie as lightYellow, Be as link, Z as magenta, m as options, K as red, P as reset, Q as strikethrough, k as stripColors, Re as trueColor, xe as trueColorBg, j as underline, te as white, J as yellow };