@lynx-js/qrcode-rsbuild-plugin
Version:
A rsbuild plugin for printing QRCode in terminal
903 lines • 110 kB
JavaScript
export const __webpack_id__ = "759";
export const __webpack_ids__ = [
"759"
];
export const __webpack_modules__ = {
"../../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js": function(module) {
let p = process || {}, argv = p.argv || [], env = p.env || {};
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || "win32" === p.platform || (p.stdout || {}).isTTY && "dumb" !== env.TERM || !!env.CI);
let formatter = (open, close, replace = open)=>(input)=>{
let string = "" + input, index = string.indexOf(close, open.length);
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
};
let replaceClose = (string, close, replace, index)=>{
let result = "", cursor = 0;
do {
result += string.substring(cursor, index) + replace;
cursor = index + close.length;
index = string.indexOf(close, cursor);
}while (~index);
return result + string.substring(cursor);
};
let createColors = (enabled = isColorSupported)=>{
let f = enabled ? formatter : ()=>String;
return {
isColorSupported: enabled,
reset: f("\x1b[0m", "\x1b[0m"),
bold: f("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
dim: f("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
italic: f("\x1b[3m", "\x1b[23m"),
underline: f("\x1b[4m", "\x1b[24m"),
inverse: f("\x1b[7m", "\x1b[27m"),
hidden: f("\x1b[8m", "\x1b[28m"),
strikethrough: f("\x1b[9m", "\x1b[29m"),
black: f("\x1b[30m", "\x1b[39m"),
red: f("\x1b[31m", "\x1b[39m"),
green: f("\x1b[32m", "\x1b[39m"),
yellow: f("\x1b[33m", "\x1b[39m"),
blue: f("\x1b[34m", "\x1b[39m"),
magenta: f("\x1b[35m", "\x1b[39m"),
cyan: f("\x1b[36m", "\x1b[39m"),
white: f("\x1b[37m", "\x1b[39m"),
gray: f("\x1b[90m", "\x1b[39m"),
bgBlack: f("\x1b[40m", "\x1b[49m"),
bgRed: f("\x1b[41m", "\x1b[49m"),
bgGreen: f("\x1b[42m", "\x1b[49m"),
bgYellow: f("\x1b[43m", "\x1b[49m"),
bgBlue: f("\x1b[44m", "\x1b[49m"),
bgMagenta: f("\x1b[45m", "\x1b[49m"),
bgCyan: f("\x1b[46m", "\x1b[49m"),
bgWhite: f("\x1b[47m", "\x1b[49m"),
blackBright: f("\x1b[90m", "\x1b[39m"),
redBright: f("\x1b[91m", "\x1b[39m"),
greenBright: f("\x1b[92m", "\x1b[39m"),
yellowBright: f("\x1b[93m", "\x1b[39m"),
blueBright: f("\x1b[94m", "\x1b[39m"),
magentaBright: f("\x1b[95m", "\x1b[39m"),
cyanBright: f("\x1b[96m", "\x1b[39m"),
whiteBright: f("\x1b[97m", "\x1b[39m"),
bgBlackBright: f("\x1b[100m", "\x1b[49m"),
bgRedBright: f("\x1b[101m", "\x1b[49m"),
bgGreenBright: f("\x1b[102m", "\x1b[49m"),
bgYellowBright: f("\x1b[103m", "\x1b[49m"),
bgBlueBright: f("\x1b[104m", "\x1b[49m"),
bgMagentaBright: f("\x1b[105m", "\x1b[49m"),
bgCyanBright: f("\x1b[106m", "\x1b[49m"),
bgWhiteBright: f("\x1b[107m", "\x1b[49m")
};
};
module.exports = createColors();
module.exports.createColors = createColors;
},
"../../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js": function(module) {
const ESC = '\x1B';
const CSI = `${ESC}[`;
const beep = '\u0007';
const cursor = {
to (x, y) {
if (!y) return `${CSI}${x + 1}G`;
return `${CSI}${y + 1};${x + 1}H`;
},
move (x, y) {
let ret = '';
if (x < 0) ret += `${CSI}${-x}D`;
else if (x > 0) ret += `${CSI}${x}C`;
if (y < 0) ret += `${CSI}${-y}A`;
else if (y > 0) ret += `${CSI}${y}B`;
return ret;
},
up: (count = 1)=>`${CSI}${count}A`,
down: (count = 1)=>`${CSI}${count}B`,
forward: (count = 1)=>`${CSI}${count}C`,
backward: (count = 1)=>`${CSI}${count}D`,
nextLine: (count = 1)=>`${CSI}E`.repeat(count),
prevLine: (count = 1)=>`${CSI}F`.repeat(count),
left: `${CSI}G`,
hide: `${CSI}?25l`,
show: `${CSI}?25h`,
save: `${ESC}7`,
restore: `${ESC}8`
};
const scroll = {
up: (count = 1)=>`${CSI}S`.repeat(count),
down: (count = 1)=>`${CSI}T`.repeat(count)
};
const erase = {
screen: `${CSI}2J`,
up: (count = 1)=>`${CSI}1J`.repeat(count),
down: (count = 1)=>`${CSI}J`.repeat(count),
line: `${CSI}2K`,
lineEnd: `${CSI}K`,
lineStart: `${CSI}1K`,
lines (count) {
let clear = '';
for(let i = 0; i < count; i++)clear += this.line + (i < count - 1 ? cursor.up() : '');
if (count) clear += cursor.left;
return clear;
}
};
module.exports = {
cursor,
scroll,
erase,
beep
};
},
"../../../node_modules/.pnpm/@clack+prompts@1.0.0-alpha.5/node_modules/@clack/prompts/dist/index.mjs": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
limitOptions: ()=>dist_G,
S_STEP_ERROR: ()=>ne,
S_INFO: ()=>ue,
S_STEP_SUBMIT: ()=>dist_W,
log: ()=>dist_O,
progress: ()=>Pt,
note: ()=>Nt,
unicode: ()=>dist_J,
S_CORNER_TOP_RIGHT: ()=>oe,
S_WARN: ()=>$e,
group: ()=>dist_xt,
S_STEP_ACTIVE: ()=>we,
S_CORNER_BOTTOM_RIGHT: ()=>le,
groupMultiselect: ()=>dist_bt,
isCI: ()=>re,
S_SUCCESS: ()=>ce,
autocompleteMultiselect: ()=>dist_At,
S_STEP_CANCEL: ()=>ie,
confirm: ()=>dist_Bt,
taskLog: ()=>Gt,
selectKey: ()=>dist_Vt,
S_CHECKBOX_ACTIVE: ()=>dist_X,
multiselect: ()=>Rt,
S_ERROR: ()=>de,
S_RADIO_INACTIVE: ()=>dist_K,
S_BAR_START_RIGHT: ()=>Be,
autocomplete: ()=>ke,
box: ()=>dist_wt,
S_CORNER_BOTTOM_LEFT: ()=>De,
intro: ()=>dist_Dt,
S_CHECKBOX_INACTIVE: ()=>Y,
S_BAR_H: ()=>z,
isTTY: ()=>Se,
password: ()=>dist_Lt,
path: ()=>dist_Wt,
S_BAR_END: ()=>dist_b,
S_CHECKBOX_SELECTED: ()=>dist_P,
S_RADIO_ACTIVE: ()=>dist_U,
cancel: ()=>dist_t,
outro: ()=>Tt,
select: ()=>jt,
stream: ()=>dist_j,
S_BAR: ()=>dist_c,
S_CORNER_TOP_LEFT: ()=>Te,
symbol: ()=>dist_L,
tasks: ()=>dist_kt,
S_PASSWORD_MASK: ()=>be,
settings: ()=>dist_C,
text: ()=>Ht,
S_BAR_END_RIGHT: ()=>xe,
S_BAR_START: ()=>ae,
unicodeOr: ()=>dist_S,
updateSettings: ()=>Et,
isCancel: ()=>It,
spinner: ()=>Fe,
S_CONNECT_LEFT: ()=>_e
});
var picocolors = __webpack_require__("../../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
var external_node_process_ = __webpack_require__("node:process");
var external_node_readline_ = __webpack_require__("node:readline");
var src = __webpack_require__("../../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js");
var external_node_tty_ = __webpack_require__("node:tty");
const nt = (t)=>161 === t || 164 === t || 167 === t || 168 === t || 170 === t || 173 === t || 174 === t || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || 198 === t || 208 === t || 215 === t || 216 === t || t >= 222 && t <= 225 || 230 === t || t >= 232 && t <= 234 || 236 === t || 237 === t || 240 === t || 242 === t || 243 === t || t >= 247 && t <= 250 || 252 === t || 254 === t || 257 === t || 273 === t || 275 === t || 283 === t || 294 === t || 295 === t || 299 === t || t >= 305 && t <= 307 || 312 === t || t >= 319 && t <= 322 || 324 === t || t >= 328 && t <= 331 || 333 === t || 338 === t || 339 === t || 358 === t || 359 === t || 363 === t || 462 === t || 464 === t || 466 === t || 468 === t || 470 === t || 472 === t || 474 === t || 476 === t || 593 === t || 609 === t || 708 === t || 711 === t || t >= 713 && t <= 715 || 717 === t || 720 === t || t >= 728 && t <= 731 || 733 === t || 735 === t || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || 1025 === t || t >= 1040 && t <= 1103 || 1105 === t || 8208 === t || t >= 8211 && t <= 8214 || 8216 === t || 8217 === t || 8220 === t || 8221 === t || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || 8240 === t || 8242 === t || 8243 === t || 8245 === t || 8251 === t || 8254 === t || 8308 === t || 8319 === t || t >= 8321 && t <= 8324 || 8364 === t || 8451 === t || 8453 === t || 8457 === t || 8467 === t || 8470 === t || 8481 === t || 8482 === t || 8486 === t || 8491 === t || 8531 === t || 8532 === t || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || 8585 === t || t >= 8592 && t <= 8601 || 8632 === t || 8633 === t || 8658 === t || 8660 === t || 8679 === t || 8704 === t || 8706 === t || 8707 === t || 8711 === t || 8712 === t || 8715 === t || 8719 === t || 8721 === t || 8725 === t || 8730 === t || t >= 8733 && t <= 8736 || 8739 === t || 8741 === t || t >= 8743 && t <= 8748 || 8750 === t || t >= 8756 && t <= 8759 || 8764 === t || 8765 === t || 8776 === t || 8780 === t || 8786 === t || 8800 === t || 8801 === t || t >= 8804 && t <= 8807 || 8810 === t || 8811 === t || 8814 === t || 8815 === t || 8834 === t || 8835 === t || 8838 === t || 8839 === t || 8853 === t || 8857 === t || 8869 === t || 8895 === t || 8978 === t || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || 9632 === t || 9633 === t || t >= 9635 && t <= 9641 || 9650 === t || 9651 === t || 9654 === t || 9655 === t || 9660 === t || 9661 === t || 9664 === t || 9665 === t || t >= 9670 && t <= 9672 || 9675 === t || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || 9711 === t || 9733 === t || 9734 === t || 9737 === t || 9742 === t || 9743 === t || 9756 === t || 9758 === t || 9792 === t || 9794 === t || 9824 === t || 9825 === t || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || 9836 === t || 9837 === t || 9839 === t || 9886 === t || 9887 === t || 9919 === t || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || 9955 === t || 9960 === t || 9961 === t || t >= 9963 && t <= 9969 || 9972 === t || t >= 9974 && t <= 9977 || 9979 === t || 9980 === t || 9982 === t || 9983 === t || 10045 === t || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || 65533 === t || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || 127375 === t || 127376 === t || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109, ut = (t)=>12288 === t || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510, ot = (t)=>t >= 4352 && t <= 4447 || 8986 === t || 8987 === t || 9001 === t || 9002 === t || t >= 9193 && t <= 9196 || 9200 === t || 9203 === t || 9725 === t || 9726 === t || 9748 === t || 9749 === t || t >= 9800 && t <= 9811 || 9855 === t || 9875 === t || 9889 === t || 9898 === t || 9899 === t || 9917 === t || 9918 === t || 9924 === t || 9925 === t || 9934 === t || 9940 === t || 9962 === t || 9970 === t || 9971 === t || 9973 === t || 9978 === t || 9981 === t || 9989 === t || 9994 === t || 9995 === t || 10024 === t || 10060 === t || 10062 === t || t >= 10067 && t <= 10069 || 10071 === t || t >= 10133 && t <= 10135 || 10160 === t || 10175 === t || 11035 === t || 11036 === t || 11088 === t || 11093 === t || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || 94192 === t || 94193 === t || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || 110589 === t || 110590 === t || t >= 110592 && t <= 110882 || 110898 === t || t >= 110928 && t <= 110930 || 110933 === t || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || 126980 === t || 127183 === t || 127374 === t || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || 127568 === t || 127569 === t || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || 127988 === t || t >= 127992 && t <= 128062 || 128064 === t || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || 128378 === t || 128405 === t || 128406 === t || 128420 === t || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || 128716 === t || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || 128747 === t || 128748 === t || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || 129008 === t || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141, dist_$ = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, k = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, dist_y = /\t{1,1000}/y, N = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu, M = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, at = /\p{M}+/gu, lt = {
limit: 1 / 0,
ellipsis: ""
}, dist_q = (t, s = {}, e = {})=>{
const i = s.limit ?? 1 / 0, r = s.ellipsis ?? "", n = s?.ellipsisWidth ?? (r ? dist_q(r, lt, e).width : 0), F = e.ansiWidth ?? 0, l = e.controlWidth ?? 0, a = e.tabWidth ?? 8, v = e.ambiguousWidth ?? 1, g = e.emojiWidth ?? 2, m = e.fullWidthWidth ?? 2, A = e.regularWidth ?? 1, S = e.wideWidth ?? 2;
let o = 0, u = 0, p = t.length, E = 0, f = !1, d = p, _ = Math.max(0, i - n), b = 0, x = 0, h = 0, c = 0;
t: for(;;){
if (x > b || u >= p && u > o) {
const it = t.slice(b, x) || t.slice(o, u);
E = 0;
for (const K of it.replaceAll(at, "")){
const T = K.codePointAt(0) || 0;
if (ut(T) ? c = m : ot(T) ? c = S : v !== A && nt(T) ? c = v : c = A, h + c > _ && (d = Math.min(d, Math.max(b, o) + E)), h + c > i) {
f = !0;
break t;
}
E += K.length, h += c;
}
b = x = 0;
}
if (u >= p) break;
if (M.lastIndex = u, M.test(t)) {
if (E = M.lastIndex - u, c = E * A, h + c > _ && (d = Math.min(d, u + Math.floor((_ - h) / A))), h + c > i) {
f = !0;
break;
}
h += c, b = o, x = u, u = o = M.lastIndex;
continue;
}
if (dist_$.lastIndex = u, dist_$.test(t)) {
if (h + F > _ && (d = Math.min(d, u)), h + F > i) {
f = !0;
break;
}
h += F, b = o, x = u, u = o = dist_$.lastIndex;
continue;
}
if (k.lastIndex = u, k.test(t)) {
if (E = k.lastIndex - u, c = E * l, h + c > _ && (d = Math.min(d, u + Math.floor((_ - h) / l))), h + c > i) {
f = !0;
break;
}
h += c, b = o, x = u, u = o = k.lastIndex;
continue;
}
if (dist_y.lastIndex = u, dist_y.test(t)) {
if (E = dist_y.lastIndex - u, c = E * a, h + c > _ && (d = Math.min(d, u + Math.floor((_ - h) / a))), h + c > i) {
f = !0;
break;
}
h += c, b = o, x = u, u = o = dist_y.lastIndex;
continue;
}
if (N.lastIndex = u, N.test(t)) {
if (h + g > _ && (d = Math.min(d, u)), h + g > i) {
f = !0;
break;
}
h += g, b = o, x = u, u = o = N.lastIndex;
continue;
}
u += 1;
}
return {
width: f ? _ : h,
index: f ? d : p,
truncated: f,
ellipsed: f && i >= n
};
}, ht = {
limit: 1 / 0,
ellipsis: "",
ellipsisWidth: 0
}, dist_w = (t, s = {})=>dist_q(t, ht, s).width, L = "\x1B", J = "\x9B", ct = 39, P = "\x07", X = "[", Ft = "]", Z = "m", O = `${Ft}8;;`, Q = new RegExp(`(?:\\${X}(?<code>\\d+)m|\\${O}(?<uri>.*)${P})`, "y"), pt = (t)=>{
if (t >= 30 && t <= 37 || t >= 90 && t <= 97) return 39;
if (t >= 40 && t <= 47 || t >= 100 && t <= 107) return 49;
if (1 === t || 2 === t) return 22;
if (3 === t) return 23;
if (4 === t) return 24;
if (7 === t) return 27;
if (8 === t) return 28;
if (9 === t) return 29;
if (0 === t) return 0;
}, tt = (t)=>`${L}${X}${t}${Z}`, st = (t)=>`${L}${O}${t}${P}`, ft = (t)=>t.map((s)=>dist_w(s)), j = (t, s, e)=>{
const i = s[Symbol.iterator]();
let r = !1, n = !1, F = t.at(-1), l = void 0 === F ? 0 : dist_w(F), a = i.next(), v = i.next(), g = 0;
for(; !a.done;){
const m = a.value, A = dist_w(m);
l + A <= e ? t[t.length - 1] += m : (t.push(m), l = 0), (m === L || m === J) && (r = !0, n = s.startsWith(O, g + 1)), r ? n ? m === P && (r = !1, n = !1) : m === Z && (r = !1) : (l += A, l !== e || v.done || (t.push(""), l = 0)), a = v, v = i.next(), g += m.length;
}
F = t.at(-1), !l && void 0 !== F && F.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
}, dt = (t)=>{
const s = t.split(" ");
let e = s.length;
for(; e > 0 && !(dist_w(s[e - 1]) > 0);)e--;
return e === s.length ? t : s.slice(0, e).join(" ") + s.slice(e).join("");
}, mt = (t, s, e = {})=>{
if (!1 !== e.trim && "" === t.trim()) return "";
let i = "", r, n;
const F = t.split(" "), l = ft(F);
let a = [
""
];
for (const [o, u] of F.entries()){
!1 !== e.trim && (a[a.length - 1] = (a.at(-1) ?? "").trimStart());
let p = dist_w(a.at(-1) ?? "");
if (0 !== o && (p >= s && (!1 === e.wordWrap || !1 === e.trim) && (a.push(""), p = 0), (p > 0 || !1 === e.trim) && (a[a.length - 1] += " ", p++)), e.hard && l[o] > s) {
const E = s - p, f = 1 + Math.floor((l[o] - E - 1) / s);
Math.floor((l[o] - 1) / s) < f && a.push(""), j(a, u, s);
continue;
}
if (p + l[o] > s && p > 0 && l[o] > 0) {
if (!1 === e.wordWrap && p < s) {
j(a, u, s);
continue;
}
a.push("");
}
if (p + l[o] > s && !1 === e.wordWrap) {
j(a, u, s);
continue;
}
a[a.length - 1] += u;
}
!1 !== e.trim && (a = a.map((o)=>dt(o)));
const v = a.join(`
`), g = v[Symbol.iterator]();
let m = g.next(), A = g.next(), S = 0;
for(; !m.done;){
const o = m.value, u = A.value;
if (i += o, o === L || o === J) {
Q.lastIndex = S + 1;
const f = Q.exec(v)?.groups;
if (f?.code !== void 0) {
const d = Number.parseFloat(f.code);
r = d === ct ? void 0 : d;
} else f?.uri !== void 0 && (n = 0 === f.uri.length ? void 0 : f.uri);
}
const p = r ? pt(r) : void 0;
u === `
` ? (n && (i += st("")), r && p && (i += tt(p))) : o === `
` && (r && p && (i += tt(r)), n && (i += st(n))), S += o.length, m = A, A = g.next();
}
return i;
};
function et(t, s, e) {
return String(t).normalize().replaceAll(`\r
`, `
`).split(`
`).map((i)=>mt(i, s, e)).join(`
`);
}
const gt = [
"up",
"down",
"left",
"right",
"space",
"enter",
"cancel"
], dist_C = {
actions: new Set(gt),
aliases: new Map([
[
"k",
"up"
],
[
"j",
"down"
],
[
"h",
"left"
],
[
"l",
"right"
],
[
"",
"cancel"
],
[
"escape",
"cancel"
]
]),
messages: {
cancel: "Canceled",
error: "Something went wrong"
}
};
function Et(t) {
if (void 0 !== t.aliases) {
const s = t.aliases;
for(const e in s){
if (!Object.hasOwn(s, e)) continue;
const i = s[e];
dist_C.actions.has(i) && (dist_C.aliases.has(e) || dist_C.aliases.set(e, i));
}
}
if (void 0 !== t.messages) {
const s = t.messages;
void 0 !== s.cancel && (dist_C.messages.cancel = s.cancel), void 0 !== s.error && (dist_C.messages.error = s.error);
}
}
function U(t, s) {
if ("string" == typeof t) return dist_C.aliases.get(t) === s;
for (const e of t)if (void 0 !== e && U(e, s)) return !0;
return !1;
}
function vt(t, s) {
if (t === s) return;
const e = t.split(`
`), i = s.split(`
`), r = [];
for(let n = 0; n < Math.max(e.length, i.length); n++)e[n] !== i[n] && r.push(n);
return r;
}
const At = globalThis.process.platform.startsWith("win"), G = Symbol("clack:cancel");
function It(t) {
return t === G;
}
function W(t, s) {
const e = t;
e.isTTY && e.setRawMode(s);
}
function _t({ input: t = external_node_process_.stdin, output: s = external_node_process_.stdout, overwrite: e = !0, hideCursor: i = !0 } = {}) {
const r = external_node_readline_.createInterface({
input: t,
output: s,
prompt: "",
tabSize: 1
});
external_node_readline_.emitKeypressEvents(t, r), t instanceof external_node_tty_.ReadStream && t.isTTY && t.setRawMode(!0);
const n = (F, { name: l, sequence: a })=>{
const v = String(F);
if (U([
v,
l,
a
], "cancel")) {
i && s.write(src.cursor.show), process.exit(0);
return;
}
if (!e) return;
const g = "return" === l ? 0 : -1, m = "return" === l ? -1 : 0;
external_node_readline_.moveCursor(s, g, m, ()=>{
external_node_readline_.clearLine(s, 1, ()=>{
t.once("keypress", n);
});
});
};
return i && s.write(src.cursor.hide), t.once("keypress", n), ()=>{
t.off("keypress", n), i && s.write(src.cursor.show), t instanceof external_node_tty_.ReadStream && t.isTTY && !At && t.setRawMode(!1), r.terminal = !1, r.close();
};
}
const Ct = (t)=>"columns" in t && "number" == typeof t.columns ? t.columns : 80, bt = (t)=>"rows" in t && "number" == typeof t.rows ? t.rows : 20;
class dist_B {
input;
output;
_abortSignal;
rl;
opts;
_render;
_track = !1;
_prevFrame = "";
_subscribers = new Map;
_cursor = 0;
state = "initial";
error = "";
value;
userInput = "";
constructor(s, e = !0){
const { input: i = external_node_process_.stdin, output: r = external_node_process_.stdout, render: n, signal: F, ...l } = s;
this.opts = l, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = e, this._abortSignal = F, this.input = i, this.output = r;
}
unsubscribe() {
this._subscribers.clear();
}
setSubscriber(s, e) {
const i = this._subscribers.get(s) ?? [];
i.push(e), this._subscribers.set(s, i);
}
on(s, e) {
this.setSubscriber(s, {
cb: e
});
}
once(s, e) {
this.setSubscriber(s, {
cb: e,
once: !0
});
}
emit(s, ...e) {
const i = this._subscribers.get(s) ?? [], r = [];
for (const n of i)n.cb(...e), n.once && r.push(()=>i.splice(i.indexOf(n), 1));
for (const n of r)n();
}
prompt() {
return new Promise((s)=>{
if (this._abortSignal) {
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), s(G);
this._abortSignal.addEventListener("abort", ()=>{
this.state = "cancel", this.close();
}, {
once: !0
});
}
this.rl = external_node_readline_["default"].createInterface({
input: this.input,
tabSize: 2,
prompt: "",
escapeCodeTimeout: 50,
terminal: !0
}), this.rl.prompt(), void 0 !== this.opts.initialUserInput && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress), W(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", ()=>{
this.output.write(src.cursor.show), this.output.off("resize", this.render), W(this.input, !1), s(this.value);
}), this.once("cancel", ()=>{
this.output.write(src.cursor.show), this.output.off("resize", this.render), W(this.input, !1), s(G);
});
});
}
_isActionKey(s, e) {
return " " === s;
}
_setValue(s) {
this.value = s, this.emit("value", this.value);
}
_setUserInput(s, e) {
this.userInput = s ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
}
_clearUserInput() {
this.rl?.write(null, {
ctrl: !0,
name: "u"
}), this._setUserInput("");
}
onKeypress(s, e) {
if (this._track && "return" !== e.name && (e.name && this._isActionKey(s, e) && this.rl?.write(null, {
ctrl: !0,
name: "h"
}), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), "error" === this.state && (this.state = "active"), e?.name && (!this._track && dist_C.aliases.has(e.name) && this.emit("cursor", dist_C.aliases.get(e.name)), dist_C.actions.has(e.name) && this.emit("cursor", e.name)), s && ("y" === s.toLowerCase() || "n" === s.toLowerCase()) && this.emit("confirm", "y" === s.toLowerCase()), this.emit("key", s?.toLowerCase(), e), e?.name === "return") {
if (this.opts.validate) {
const i = this.opts.validate(this.value);
i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
}
"error" !== this.state && (this.state = "submit");
}
U([
s,
e?.name,
e?.sequence
], "cancel") && (this.state = "cancel"), ("submit" === this.state || "cancel" === this.state) && this.emit("finalize"), this.render(), ("submit" === this.state || "cancel" === this.state) && this.close();
}
close() {
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
`), W(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
}
restoreCursor() {
const s = et(this._prevFrame, process.stdout.columns, {
hard: !0,
trim: !1
}).split(`
`).length - 1;
this.output.write(src.cursor.move(-999, -1 * s));
}
render() {
const s = et(this._render(this) ?? "", process.stdout.columns, {
hard: !0,
trim: !1
});
if (s !== this._prevFrame) {
if ("initial" === this.state) this.output.write(src.cursor.hide);
else {
const e = vt(this._prevFrame, s);
if (this.restoreCursor(), e && e?.length === 1) {
const i = e[0];
this.output.write(src.cursor.move(0, i)), this.output.write(src.erase.lines(1));
const r = s.split(`
`);
this.output.write(r[i]), this._prevFrame = s, this.output.write(src.cursor.move(0, r.length - i - 1));
return;
}
if (e && e?.length > 1) {
const i = e[0];
this.output.write(src.cursor.move(0, i)), this.output.write(src.erase.down());
const r = s.split(`
`).slice(i);
this.output.write(r.join(`
`)), this._prevFrame = s;
return;
}
this.output.write(src.erase.down());
}
this.output.write(s), "initial" === this.state && (this.state = "active"), this._prevFrame = s;
}
}
}
function Bt(t, s) {
if (void 0 === t || 0 === s.length) return 0;
const e = s.findIndex((i)=>i.value === t);
return -1 !== e ? e : 0;
}
function xt(t, s) {
return (s.label ?? String(s.value)).toLowerCase().includes(t.toLowerCase());
}
function Dt(t, s) {
if (s) return t ? s : s[0];
}
class wt extends dist_B {
filteredOptions;
multiple;
isNavigating = !1;
selectedValues = [];
focusedValue;
#t = 0;
#e = "";
#i;
#s;
get cursor() {
return this.#t;
}
get userInputWithCursor() {
if (!this.userInput) return picocolors.inverse(picocolors.hidden("_"));
if (this._cursor >= this.userInput.length) return `${this.userInput}\u2588`;
const s = this.userInput.slice(0, this._cursor), [e, ...i] = this.userInput.slice(this._cursor);
return `${s}${picocolors.inverse(e)}${i.join("")}`;
}
get options() {
return "function" == typeof this.#s ? this.#s() : this.#s;
}
constructor(s){
super(s), this.#s = s.options;
const e = this.options;
this.filteredOptions = [
...e
], this.multiple = !0 === s.multiple, this.#i = s.filter ?? xt;
let i;
if (s.initialValue && Array.isArray(s.initialValue) ? this.multiple ? i = s.initialValue : i = s.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i = [
this.options[0].value
]), i) for (const r of i){
const n = e.findIndex((F)=>F.value === r);
-1 !== n && (this.toggleSelected(r), this.#t = n);
}
this.focusedValue = this.options[this.#t]?.value, this.on("key", (r, n)=>this.#r(r, n)), this.on("userInput", (r)=>this.#n(r));
}
_isActionKey(s, e) {
return " " === s || this.multiple && this.isNavigating && "space" === e.name && void 0 !== s && "" !== s;
}
#r(s, e) {
const i = "up" === e.name, r = "down" === e.name, n = "return" === e.name;
i || r ? (this.#t = Math.max(0, Math.min(this.#t + (i ? -1 : 1), this.filteredOptions.length - 1)), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (this.selectedValues = [
this.focusedValue
]), this.isNavigating = !0) : n ? this.value = Dt(this.multiple, this.selectedValues) : this.multiple ? void 0 !== this.focusedValue && ("tab" === e.name || this.isNavigating && "space" === e.name) ? this.toggleSelected(this.focusedValue) : this.isNavigating = !1 : (this.focusedValue && (this.selectedValues = [
this.focusedValue
]), this.isNavigating = !1);
}
deselectAll() {
this.selectedValues = [];
}
toggleSelected(s) {
0 !== this.filteredOptions.length && (this.multiple ? this.selectedValues.includes(s) ? this.selectedValues = this.selectedValues.filter((e)=>e !== s) : this.selectedValues = [
...this.selectedValues,
s
] : this.selectedValues = [
s
]);
}
#n(s) {
if (s !== this.#e) {
this.#e = s;
const e = this.options;
s ? this.filteredOptions = e.filter((i)=>this.#i(s, i)) : this.filteredOptions = [
...e
], this.#t = Bt(this.focusedValue, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (void 0 !== this.focusedValue ? this.toggleSelected(this.focusedValue) : this.deselectAll());
}
}
}
let St = class extends dist_B {
get cursor() {
return this.value ? 0 : 1;
}
get _value() {
return 0 === this.cursor;
}
constructor(s){
super(s, !1), this.value = !!s.initialValue, this.on("userInput", ()=>{
this.value = this._value;
}), this.on("confirm", (e)=>{
this.output.write(src.cursor.move(0, -1)), this.value = e, this.state = "submit", this.close();
}), this.on("cursor", ()=>{
this.value = !this.value;
});
}
};
class Vt extends dist_B {
options;
cursor = 0;
#t;
getGroupItems(s) {
return this.options.filter((e)=>e.group === s);
}
isGroupSelected(s) {
const e = this.getGroupItems(s), i = this.value;
return void 0 === i ? !1 : e.every((r)=>i.includes(r.value));
}
toggleValue() {
const s = this.options[this.cursor];
if (void 0 === this.value && (this.value = []), !0 === s.group) {
const e = s.value, i = this.getGroupItems(e);
this.isGroupSelected(e) ? this.value = this.value.filter((r)=>-1 === i.findIndex((n)=>n.value === r)) : this.value = [
...this.value,
...i.map((r)=>r.value)
], this.value = Array.from(new Set(this.value));
} else {
const e = this.value.includes(s.value);
this.value = e ? this.value.filter((i)=>i !== s.value) : [
...this.value,
s.value
];
}
}
constructor(s){
super(s, !1);
const { options: e } = s;
this.#t = !1 !== s.selectableGroups, this.options = Object.entries(e).flatMap(([i, r])=>[
{
value: i,
group: !0,
label: i
},
...r.map((n)=>({
...n,
group: i
}))
]), this.value = [
...s.initialValues ?? []
], this.cursor = Math.max(this.options.findIndex(({ value: i })=>i === s.cursorAt), this.#t ? 0 : 1), this.on("cursor", (i)=>{
switch(i){
case "left":
case "up":
{
this.cursor = 0 === this.cursor ? this.options.length - 1 : this.cursor - 1;
const r = this.options[this.cursor]?.group === !0;
!this.#t && r && (this.cursor = 0 === this.cursor ? this.options.length - 1 : this.cursor - 1);
break;
}
case "down":
case "right":
{
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
const r = this.options[this.cursor]?.group === !0;
!this.#t && r && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
break;
}
case "space":
this.toggleValue();
break;
}
});
}
}
class kt extends dist_B {
options;
cursor = 0;
get _value() {
return this.options[this.cursor].value;
}
toggleAll() {
const s = void 0 !== this.value && this.value.length === this.options.length;
this.value = s ? [] : this.options.map((e)=>e.value);
}
toggleInvert() {
const s = this.value;
if (!s) return;
const e = this.options.filter((i)=>!s.includes(i.value));
this.value = e.map((i)=>i.value);
}
toggleValue() {
void 0 === this.value && (this.value = []);
const s = this.value.includes(this._value);
this.value = s ? this.value.filter((e)=>e !== this._value) : [
...this.value,
this._value
];
}
constructor(s){
super(s, !1), this.options = s.options, this.value = [
...s.initialValues ?? []
], this.cursor = Math.max(this.options.findIndex(({ value: e })=>e === s.cursorAt), 0), this.on("key", (e)=>{
"a" === e && this.toggleAll(), "i" === e && this.toggleInvert();
}), this.on("cursor", (e)=>{
switch(e){
case "left":
case "up":
this.cursor = 0 === this.cursor ? this.options.length - 1 : this.cursor - 1;
break;
case "down":
case "right":
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
break;
case "space":
this.toggleValue();
break;
}
});
}
}
let yt = class extends dist_B {
_mask = "\u2022";
get cursor() {
return this._cursor;
}
get masked() {
return this.userInput.replaceAll(/./g, this._mask);
}
get userInputWithCursor() {
if ("submit" === this.state || "cancel" === this.state) return this.masked;
const s = this.userInput;
if (this.cursor >= s.length) return `${this.masked}${picocolors.inverse(picocolors.hidden("_"))}`;
const e = this.masked, i = e.slice(0, this.cursor), r = e.slice(this.cursor);
return `${i}${picocolors.inverse(r[0])}${r.slice(1)}`;
}
clear() {
this._clearUserInput();
}
constructor({ mask: s, ...e }){
super(e), this._mask = s ?? "\u2022", this.on("userInput", (i)=>{
this._setValue(i);
});
}
};
class Mt extends dist_B {
options;
cursor = 0;
get _selectedValue() {
return this.options[this.cursor];
}
changeValue() {
this.value = this._selectedValue.value;
}
constructor(s){
super(s, !1), this.options = s.options, this.cursor = this.options.findIndex(({ value: e })=>e === s.initialValue), -1 === this.cursor && (this.cursor = 0), this.changeValue(), this.on("cursor", (e)=>{
switch(e){
case "left":
case "up":
this.cursor = 0 === this.cursor ? this.options.length - 1 : this.cursor - 1;
break;
case "down":
case "right":
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
break;
}
this.changeValue();
});
}
}
class Lt extends dist_B {
options;
cursor = 0;
constructor(s){
super(s, !1), this.options = s.options;
const e = this.options.map(({ value: [i] })=>i?.toLowerCase());
this.cursor = Math.max(e.indexOf(s.initialValue), 0), this.on("key", (i)=>{
if (!i || !e.includes(i)) return;
const r = this.options.find(({ value: [n] })=>n?.toLowerCase() === i);
r && (this.value = r.value, this.state = "submit", this.emit("submit"));
});
}
}
class Wt extends dist_B {
get userInputWithCursor() {
if ("submit" === this.state) return this.userInput;
const s = this.userInput;
if (this.cursor >= s.length) return `${this.userInput}\u2588`;
const e = s.slice(0, this.cursor), [i, ...r] = s.slice(this.cursor);
return `${e}${picocolors.inverse(i)}${r.join("")}`;
}
get cursor() {
return this._cursor;
}
constructor(s){
super({
...s,
initialUserInput: s.initialUserInput ?? s.initialValue
}), this.on("userInput", (e)=>{
this._setValue(e);
}), this.on("finalize", ()=>{
this.value || (this.value = s.defaultValue), void 0 === this.value && (this.value = "");
});
}
}
var external_node_fs_ = __webpack_require__("node:fs");
var external_node_path_ = __webpack_require__("node:path");
var external_node_util_ = __webpack_require__("node:util");
function dist_ot() {
return "win32" !== external_node_process_["default"].platform ? "linux" !== external_node_process_["default"].env.TERM : !!external_node_process_["default"].env.CI || !!external_node_process_["default"].env.WT_SESSION || !!external_node_process_["default"].env.TERMINUS_SUBLIME || "{cmd::Cmder}" === external_node_process_["default"].env.ConEmuTask || "Terminus-Sublime" === external_node_process_["default"].env.TERM_PROGRAM || "vscode" === external_node_process_["default"].env.TERM_PROGRAM || "xterm-256color" === external_node_process_["default"].env.TERM || "alacritty" === external_node_process_["default"].env.TERM || "JetBrains-JediTerm" === external_node_process_["default"].env.TERMINAL_EMULATOR;
}
const dist_J = dist_ot(), re = ()=>"true" === process.env.CI, Se = (e)=>!0 === e.isTTY, dist_S = (e, r)=>dist_J ? e : r, we = dist_S("\u25C6", "*"), ie = dist_S("\u25A0", "x"), ne = dist_S("\u25B2", "x"), dist_W = dist_S("\u25C7", "o"), ae = dist_S("\u250C", "T"), dist_c = dist_S("\u2502", "|"), dist_b = dist_S("\u2514", "\u2014"), Be = dist_S("\u2510", "T"), xe = dist_S("\u2518", "\u2014"), dist_U = dist_S("\u25CF", ">"), dist_K = dist_S("\u25CB", " "), dist_X = dist_S("\u25FB", "[\u2022]"), dist_P = dist_S("\u25FC", "[+]"), Y = dist_S("\u25FB", "[ ]"), be = dist_S("\u25AA", "\u2022"), z = dist_S("\u2500", "-"), oe = dist_S("\u256E", "+"), _e = dist_S("\u251C", "+"), le = dist_S("\u256F", "+"), De = dist_S("\u2570", "+"), Te = dist_S("\u256D", "+"), ue = dist_S("\u25CF", "\u2022"), ce = dist_S("\u25C6", "*"), $e = dist_S("\u25B2", "!"), de = dist_S("\u25A0", "x"), dist_L = (e)=>{
switch(e){
case "initial":
case "active":
return picocolors.cyan(we);
case "cancel":
return picocolors.red(ie);
case "error":
return picocolors.yellow(ne);
case "submit":
return picocolors.green(dist_W);
}
}, dist_lt = (e)=>161 === e || 164 === e || 167 === e || 168 === e || 170 === e || 173 === e || 174 === e || e >= 176 && e <= 180 || e >= 182 && e <= 186 || e >= 188 && e <= 191 || 198 === e || 208 === e || 215 === e || 216 === e || e >= 222 && e <= 225 || 230 === e || e >= 232 && e <= 234 || 236 === e || 237 =