keycloakify 10.0.0-rc.73 → 10.0.0-rc.75

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- exports.id = 363;
3
- exports.ids = [363];
2
+ exports.id = 440;
3
+ exports.ids = [440];
4
4
  exports.modules = {
5
5
 
6
6
  /***/ 73817:
@@ -155,7 +155,7 @@ function generateMessageProperties(params) {
155
155
 
156
156
  /***/ }),
157
157
 
158
- /***/ 52363:
158
+ /***/ 46440:
159
159
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
160
160
 
161
161
  // ESM COMPAT FLAG
@@ -348,63 +348,28 @@ const { readAssetsDirSync } = (() => {
348
348
  ;// CONCATENATED MODULE: ./dist/bin/keycloakify/replacers/replaceImportsInJsCode/index.js
349
349
 
350
350
  //# sourceMappingURL=index.js.map
351
- // EXTERNAL MODULE: external "crypto"
352
- var external_crypto_ = __webpack_require__(6113);
353
351
  ;// CONCATENATED MODULE: ./dist/bin/keycloakify/replacers/replaceImportsInCssCode.js
354
352
 
355
353
 
356
-
357
354
  (0,assert.assert)();
358
355
  function replaceImportsInCssCode(params) {
359
- var _a;
360
- const { cssCode } = params;
361
- const cssGlobalsToDefine = {};
362
- new Set((_a = cssCode.match(/url\(["']?\/[^/][^)"']+["']?\)[^;}]*?/g)) !== null && _a !== void 0 ? _a : []).forEach(match => (cssGlobalsToDefine["url" +
363
- external_crypto_.createHash("sha256")
364
- .update(match)
365
- .digest("hex")
366
- .substring(0, 15)] = match));
367
- let fixedCssCode = cssCode;
368
- Object.keys(cssGlobalsToDefine).forEach(cssVariableName =>
369
- //NOTE: split/join pattern ~ replace all
370
- (fixedCssCode = fixedCssCode
371
- .split(cssGlobalsToDefine[cssVariableName])
372
- .join(`var(--${cssVariableName})`)));
373
- return { fixedCssCode, cssGlobalsToDefine };
374
- }
375
- function generateCssCodeToDefineGlobals(params) {
376
- const { cssGlobalsToDefine, buildContext } = params;
377
- return {
378
- cssCodeToPrependInHead: [
379
- ":root {",
380
- ...Object.keys(cssGlobalsToDefine)
381
- .map(cssVariableName => {
382
- var _a;
383
- return [
384
- `--${cssVariableName}:`,
385
- cssGlobalsToDefine[cssVariableName].replace(new RegExp(`url\\(${((_a = buildContext.urlPathname) !== null && _a !== void 0 ? _a : "/").replace(/\//g, "\\/")}`, "g"), `url(\${url.resourcesPath}/${constants/* basenameOfTheKeycloakifyResourcesDir */.M}/`)
386
- ].join(" ");
387
- })
388
- .map(line => ` ${line};`),
389
- "}"
390
- ].join("\n")
391
- };
356
+ const { cssCode, fileRelativeDirPath, buildContext } = params;
357
+ const fixedCssCode = cssCode.replace(/url\(["']?(\/[^/][^)"']+)["']?\)/g, (match, assetFileAbsoluteUrlPathname) => {
358
+ if (buildContext.urlPathname !== undefined) {
359
+ if (!assetFileAbsoluteUrlPathname.startsWith(buildContext.urlPathname)) {
360
+ // NOTE: Should never happen
361
+ return match;
362
+ }
363
+ assetFileAbsoluteUrlPathname = assetFileAbsoluteUrlPathname.replace(buildContext.urlPathname, "/");
364
+ }
365
+ const assetFileRelativeUrlPathname = external_path_.posix.relative(fileRelativeDirPath.replace(/\\/g, "/"), assetFileAbsoluteUrlPathname.replace(/^\//, ""));
366
+ return `url(${assetFileRelativeUrlPathname})`;
367
+ });
368
+ return { fixedCssCode };
392
369
  }
393
370
  //# sourceMappingURL=replaceImportsInCssCode.js.map
394
371
  // EXTERNAL MODULE: ./node_modules/cheerio/lib/esm/index.js + 76 modules
395
372
  var esm = __webpack_require__(87182);
396
- ;// CONCATENATED MODULE: ./dist/bin/keycloakify/replacers/replaceImportsInInlineCssCode.js
397
-
398
-
399
- (0,assert.assert)();
400
- function replaceImportsInInlineCssCode(params) {
401
- const { cssCode, buildContext } = params;
402
- const fixedCssCode = cssCode.replace(buildContext.urlPathname === undefined
403
- ? /url\(["']?\/([^/][^)"']+)["']?\)/g
404
- : new RegExp(`url\\(["']?${buildContext.urlPathname}([^)"']+)["']?\\)`, "g"), (...[, group]) => `url(\${url.resourcesPath}/${constants/* basenameOfTheKeycloakifyResourcesDir */.M}/${group})`);
405
- return { fixedCssCode };
406
- }
407
- //# sourceMappingURL=replaceImportsInInlineCssCode.js.map
408
373
  // EXTERNAL MODULE: ./dist/bin/tools/getThisCodebaseRootDirPath.js
409
374
  var getThisCodebaseRootDirPath = __webpack_require__(58822);
410
375
  ;// CONCATENATED MODULE: ./dist/bin/keycloakify/generateFtl/generateFtl.js
@@ -416,11 +381,10 @@ var getThisCodebaseRootDirPath = __webpack_require__(58822);
416
381
 
417
382
 
418
383
 
419
-
420
384
  (0,assert.assert)();
421
385
  function generateFtlFilesCodeFactory(params) {
422
386
  var _a;
423
- const { themeName, cssGlobalsToDefine, indexHtmlCode, buildContext, keycloakifyVersion, themeType, fieldNames } = params;
387
+ const { themeName, indexHtmlCode, buildContext, keycloakifyVersion, themeType, fieldNames } = params;
424
388
  const $ = esm/* default.load */.ZP.load(indexHtmlCode);
425
389
  fix_imports_statements: {
426
390
  $("script:not([src])").each((...[, element]) => {
@@ -435,8 +399,9 @@ function generateFtlFilesCodeFactory(params) {
435
399
  $("style").each((...[, element]) => {
436
400
  const cssCode = $(element).html();
437
401
  (0,assert.assert)(cssCode !== null);
438
- const { fixedCssCode } = replaceImportsInInlineCssCode({
402
+ const { fixedCssCode } = replaceImportsInCssCode({
439
403
  cssCode,
404
+ fileRelativeDirPath: ".",
440
405
  buildContext
441
406
  });
442
407
  $(element).text(fixedCssCode);
@@ -452,18 +417,6 @@ function generateFtlFilesCodeFactory(params) {
452
417
  }
453
418
  $(element).attr(attrName, href.replace(new RegExp(`^${((_a = buildContext.urlPathname) !== null && _a !== void 0 ? _a : "/").replace(/\//g, "\\/")}`), `\${url.resourcesPath}/${constants/* basenameOfTheKeycloakifyResourcesDir */.M}/`));
454
419
  }));
455
- if (Object.keys(cssGlobalsToDefine).length !== 0) {
456
- $("head").prepend([
457
- "",
458
- "<style>",
459
- generateCssCodeToDefineGlobals({
460
- cssGlobalsToDefine,
461
- buildContext
462
- }).cssCodeToPrependInHead,
463
- "</style>",
464
- ""
465
- ].join("\n"));
466
- }
467
420
  }
468
421
  //FTL is no valid html, we can't insert with cheerio, we put placeholder for injecting later.
469
422
  const kcContextDeclarationTemplateFtl = external_fs_.readFileSync((0,external_path_.join)((0,getThisCodebaseRootDirPath/* getThisCodebaseRootDirPath */.e)(), "src", "bin", "keycloakify", "generateFtl", "kcContextDeclarationTemplate.ftl"))
@@ -734,7 +687,6 @@ async function generateResourcesForMainTheme(params) {
734
687
  const { themeType } = params;
735
688
  return (0,external_path_.join)(resourcesDirPath, "theme", themeName, themeType);
736
689
  };
737
- const cssGlobalsToDefine = {};
738
690
  for (const themeType of ["login", "account"]) {
739
691
  if (!buildContext.recordIsImplementedByThemeType[themeType]) {
740
692
  continue;
@@ -771,13 +723,12 @@ async function generateResourcesForMainTheme(params) {
771
723
  (0,transformCodebase/* transformCodebase */.N)({
772
724
  srcDirPath: buildContext.projectBuildDirPath,
773
725
  destDirPath,
774
- transformSourceCode: ({ filePath, sourceCode }) => {
726
+ transformSourceCode: ({ filePath, fileRelativePath, sourceCode }) => {
775
727
  if (filePath.endsWith(".css")) {
776
- const { cssGlobalsToDefine: cssGlobalsToDefineForThisFile, fixedCssCode } = replaceImportsInCssCode({
777
- cssCode: sourceCode.toString("utf8")
778
- });
779
- Object.entries(cssGlobalsToDefineForThisFile).forEach(([key, value]) => {
780
- cssGlobalsToDefine[key] = value;
728
+ const { fixedCssCode } = replaceImportsInCssCode({
729
+ cssCode: sourceCode.toString("utf8"),
730
+ fileRelativeDirPath: (0,external_path_.dirname)(fileRelativePath),
731
+ buildContext
781
732
  });
782
733
  return {
783
734
  modifiedSourceCode: Buffer.from(fixedCssCode, "utf8")
@@ -800,7 +751,6 @@ async function generateResourcesForMainTheme(params) {
800
751
  themeName,
801
752
  indexHtmlCode: external_fs_.readFileSync((0,external_path_.join)(buildContext.projectBuildDirPath, "index.html"))
802
753
  .toString("utf8"),
803
- cssGlobalsToDefine,
804
754
  buildContext,
805
755
  keycloakifyVersion: (0,readThisNpmPackageVersion/* readThisNpmPackageVersion */.K)(),
806
756
  themeType,
@@ -0,0 +1,243 @@
1
+ "use strict";
2
+ exports.id = 720;
3
+ exports.ids = [720];
4
+ exports.modules = {
5
+
6
+ /***/ 68720:
7
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
8
+
9
+ __webpack_require__.r(__webpack_exports__);
10
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
11
+ /* harmony export */ "default": () => (/* binding */ wrapAnsi)
12
+ /* harmony export */ });
13
+ /* harmony import */ var string_width__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(10509);
14
+ /* harmony import */ var strip_ansi__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5505);
15
+ /* harmony import */ var ansi_styles__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(51284);
16
+
17
+
18
+
19
+
20
+ const ESCAPES = new Set([
21
+ '\u001B',
22
+ '\u009B',
23
+ ]);
24
+
25
+ const END_CODE = 39;
26
+ const ANSI_ESCAPE_BELL = '\u0007';
27
+ const ANSI_CSI = '[';
28
+ const ANSI_OSC = ']';
29
+ const ANSI_SGR_TERMINATOR = 'm';
30
+ const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
31
+
32
+ const wrapAnsiCode = code => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
33
+ const wrapAnsiHyperlink = url => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
34
+
35
+ // Calculate the length of words split on ' ', ignoring
36
+ // the extra characters added by ansi escape codes
37
+ const wordLengths = string => string.split(' ').map(character => (0,string_width__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)(character));
38
+
39
+ // Wrap a long word across multiple rows
40
+ // Ansi escape codes do not count towards length
41
+ const wrapWord = (rows, word, columns) => {
42
+ const characters = [...word];
43
+
44
+ let isInsideEscape = false;
45
+ let isInsideLinkEscape = false;
46
+ let visible = (0,string_width__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)((0,strip_ansi__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(rows.at(-1)));
47
+
48
+ for (const [index, character] of characters.entries()) {
49
+ const characterLength = (0,string_width__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)(character);
50
+
51
+ if (visible + characterLength <= columns) {
52
+ rows[rows.length - 1] += character;
53
+ } else {
54
+ rows.push(character);
55
+ visible = 0;
56
+ }
57
+
58
+ if (ESCAPES.has(character)) {
59
+ isInsideEscape = true;
60
+
61
+ const ansiEscapeLinkCandidate = characters.slice(index + 1, index + 1 + ANSI_ESCAPE_LINK.length).join('');
62
+ isInsideLinkEscape = ansiEscapeLinkCandidate === ANSI_ESCAPE_LINK;
63
+ }
64
+
65
+ if (isInsideEscape) {
66
+ if (isInsideLinkEscape) {
67
+ if (character === ANSI_ESCAPE_BELL) {
68
+ isInsideEscape = false;
69
+ isInsideLinkEscape = false;
70
+ }
71
+ } else if (character === ANSI_SGR_TERMINATOR) {
72
+ isInsideEscape = false;
73
+ }
74
+
75
+ continue;
76
+ }
77
+
78
+ visible += characterLength;
79
+
80
+ if (visible === columns && index < characters.length - 1) {
81
+ rows.push('');
82
+ visible = 0;
83
+ }
84
+ }
85
+
86
+ // It's possible that the last row we copy over is only
87
+ // ansi escape characters, handle this edge-case
88
+ if (!visible && rows.at(-1).length > 0 && rows.length > 1) {
89
+ rows[rows.length - 2] += rows.pop();
90
+ }
91
+ };
92
+
93
+ // Trims spaces from a string ignoring invisible sequences
94
+ const stringVisibleTrimSpacesRight = string => {
95
+ const words = string.split(' ');
96
+ let last = words.length;
97
+
98
+ while (last > 0) {
99
+ if ((0,string_width__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)(words[last - 1]) > 0) {
100
+ break;
101
+ }
102
+
103
+ last--;
104
+ }
105
+
106
+ if (last === words.length) {
107
+ return string;
108
+ }
109
+
110
+ return words.slice(0, last).join(' ') + words.slice(last).join('');
111
+ };
112
+
113
+ // The wrap-ansi module can be invoked in either 'hard' or 'soft' wrap mode.
114
+ //
115
+ // 'hard' will never allow a string to take up more than columns characters.
116
+ //
117
+ // 'soft' allows long words to expand past the column length.
118
+ const exec = (string, columns, options = {}) => {
119
+ if (options.trim !== false && string.trim() === '') {
120
+ return '';
121
+ }
122
+
123
+ let returnValue = '';
124
+ let escapeCode;
125
+ let escapeUrl;
126
+
127
+ const lengths = wordLengths(string);
128
+ let rows = [''];
129
+
130
+ for (const [index, word] of string.split(' ').entries()) {
131
+ if (options.trim !== false) {
132
+ rows[rows.length - 1] = rows.at(-1).trimStart();
133
+ }
134
+
135
+ let rowLength = (0,string_width__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)(rows.at(-1));
136
+
137
+ if (index !== 0) {
138
+ if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
139
+ // If we start with a new word but the current row length equals the length of the columns, add a new row
140
+ rows.push('');
141
+ rowLength = 0;
142
+ }
143
+
144
+ if (rowLength > 0 || options.trim === false) {
145
+ rows[rows.length - 1] += ' ';
146
+ rowLength++;
147
+ }
148
+ }
149
+
150
+ // In 'hard' wrap mode, the length of a line is never allowed to extend past 'columns'
151
+ if (options.hard && lengths[index] > columns) {
152
+ const remainingColumns = (columns - rowLength);
153
+ const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);
154
+ const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);
155
+ if (breaksStartingNextLine < breaksStartingThisLine) {
156
+ rows.push('');
157
+ }
158
+
159
+ wrapWord(rows, word, columns);
160
+ continue;
161
+ }
162
+
163
+ if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {
164
+ if (options.wordWrap === false && rowLength < columns) {
165
+ wrapWord(rows, word, columns);
166
+ continue;
167
+ }
168
+
169
+ rows.push('');
170
+ }
171
+
172
+ if (rowLength + lengths[index] > columns && options.wordWrap === false) {
173
+ wrapWord(rows, word, columns);
174
+ continue;
175
+ }
176
+
177
+ rows[rows.length - 1] += word;
178
+ }
179
+
180
+ if (options.trim !== false) {
181
+ rows = rows.map(row => stringVisibleTrimSpacesRight(row));
182
+ }
183
+
184
+ const preString = rows.join('\n');
185
+ const pre = [...preString];
186
+
187
+ // We need to keep a separate index as `String#slice()` works on Unicode code units, while `pre` is an array of codepoints.
188
+ let preStringIndex = 0;
189
+
190
+ for (const [index, character] of pre.entries()) {
191
+ returnValue += character;
192
+
193
+ if (ESCAPES.has(character)) {
194
+ const {groups} = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(preString.slice(preStringIndex)) || {groups: {}};
195
+ if (groups.code !== undefined) {
196
+ const code = Number.parseFloat(groups.code);
197
+ escapeCode = code === END_CODE ? undefined : code;
198
+ } else if (groups.uri !== undefined) {
199
+ escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;
200
+ }
201
+ }
202
+
203
+ const code = ansi_styles__WEBPACK_IMPORTED_MODULE_1__/* ["default"].codes.get */ .ZP.codes.get(Number(escapeCode));
204
+
205
+ if (pre[index + 1] === '\n') {
206
+ if (escapeUrl) {
207
+ returnValue += wrapAnsiHyperlink('');
208
+ }
209
+
210
+ if (escapeCode && code) {
211
+ returnValue += wrapAnsiCode(code);
212
+ }
213
+ } else if (character === '\n') {
214
+ if (escapeCode && code) {
215
+ returnValue += wrapAnsiCode(escapeCode);
216
+ }
217
+
218
+ if (escapeUrl) {
219
+ returnValue += wrapAnsiHyperlink(escapeUrl);
220
+ }
221
+ }
222
+
223
+ preStringIndex += character.length;
224
+ }
225
+
226
+ return returnValue;
227
+ };
228
+
229
+ // For each newline, invoke the method separately
230
+ function wrapAnsi(string, columns, options) {
231
+ return String(string)
232
+ .normalize()
233
+ .replaceAll('\r\n', '\n')
234
+ .split('\n')
235
+ .map(line => exec(line, columns, options))
236
+ .join('\n');
237
+ }
238
+
239
+
240
+ /***/ })
241
+
242
+ };
243
+ ;
@@ -0,0 +1,275 @@
1
+ "use strict";
2
+ exports.id = 877;
3
+ exports.ids = [877];
4
+ exports.modules = {
5
+
6
+ /***/ 85877:
7
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
8
+
9
+ // ESM COMPAT FLAG
10
+ __webpack_require__.r(__webpack_exports__);
11
+
12
+ // EXPORTS
13
+ __webpack_require__.d(__webpack_exports__, {
14
+ "default": () => (/* binding */ cliTruncate)
15
+ });
16
+
17
+ ;// CONCATENATED MODULE: ./node_modules/listr2/node_modules/is-fullwidth-code-point/index.js
18
+ /* eslint-disable yoda */
19
+
20
+ function isFullwidthCodePoint(codePoint) {
21
+ if (!Number.isInteger(codePoint)) {
22
+ return false;
23
+ }
24
+
25
+ // Code points are derived from:
26
+ // https://unicode.org/Public/UNIDATA/EastAsianWidth.txt
27
+ return codePoint >= 0x1100 && (
28
+ codePoint <= 0x115F || // Hangul Jamo
29
+ codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET
30
+ codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET
31
+ // CJK Radicals Supplement .. Enclosed CJK Letters and Months
32
+ (0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) ||
33
+ // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
34
+ (0x3250 <= codePoint && codePoint <= 0x4DBF) ||
35
+ // CJK Unified Ideographs .. Yi Radicals
36
+ (0x4E00 <= codePoint && codePoint <= 0xA4C6) ||
37
+ // Hangul Jamo Extended-A
38
+ (0xA960 <= codePoint && codePoint <= 0xA97C) ||
39
+ // Hangul Syllables
40
+ (0xAC00 <= codePoint && codePoint <= 0xD7A3) ||
41
+ // CJK Compatibility Ideographs
42
+ (0xF900 <= codePoint && codePoint <= 0xFAFF) ||
43
+ // Vertical Forms
44
+ (0xFE10 <= codePoint && codePoint <= 0xFE19) ||
45
+ // CJK Compatibility Forms .. Small Form Variants
46
+ (0xFE30 <= codePoint && codePoint <= 0xFE6B) ||
47
+ // Halfwidth and Fullwidth Forms
48
+ (0xFF01 <= codePoint && codePoint <= 0xFF60) ||
49
+ (0xFFE0 <= codePoint && codePoint <= 0xFFE6) ||
50
+ // Kana Supplement
51
+ (0x1B000 <= codePoint && codePoint <= 0x1B001) ||
52
+ // Enclosed Ideographic Supplement
53
+ (0x1F200 <= codePoint && codePoint <= 0x1F251) ||
54
+ // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
55
+ (0x20000 <= codePoint && codePoint <= 0x3FFFD)
56
+ );
57
+ }
58
+
59
+ // EXTERNAL MODULE: ./node_modules/listr2/node_modules/ansi-styles/index.js
60
+ var ansi_styles = __webpack_require__(51284);
61
+ ;// CONCATENATED MODULE: ./node_modules/listr2/node_modules/slice-ansi/index.js
62
+
63
+
64
+
65
+ const astralRegex = /^[\uD800-\uDBFF][\uDC00-\uDFFF]$/;
66
+
67
+ const ESCAPES = [
68
+ '\u001B',
69
+ '\u009B'
70
+ ];
71
+
72
+ const wrapAnsi = code => `${ESCAPES[0]}[${code}m`;
73
+
74
+ const checkAnsi = (ansiCodes, isEscapes, endAnsiCode) => {
75
+ let output = [];
76
+ ansiCodes = [...ansiCodes];
77
+
78
+ for (let ansiCode of ansiCodes) {
79
+ const ansiCodeOrigin = ansiCode;
80
+ if (ansiCode.includes(';')) {
81
+ ansiCode = ansiCode.split(';')[0][0] + '0';
82
+ }
83
+
84
+ const item = ansi_styles/* default.codes.get */.ZP.codes.get(Number.parseInt(ansiCode, 10));
85
+ if (item) {
86
+ const indexEscape = ansiCodes.indexOf(item.toString());
87
+ if (indexEscape === -1) {
88
+ output.push(wrapAnsi(isEscapes ? item : ansiCodeOrigin));
89
+ } else {
90
+ ansiCodes.splice(indexEscape, 1);
91
+ }
92
+ } else if (isEscapes) {
93
+ output.push(wrapAnsi(0));
94
+ break;
95
+ } else {
96
+ output.push(wrapAnsi(ansiCodeOrigin));
97
+ }
98
+ }
99
+
100
+ if (isEscapes) {
101
+ output = output.filter((element, index) => output.indexOf(element) === index);
102
+
103
+ if (endAnsiCode !== undefined) {
104
+ const fistEscapeCode = wrapAnsi(ansi_styles/* default.codes.get */.ZP.codes.get(Number.parseInt(endAnsiCode, 10)));
105
+ // TODO: Remove the use of `.reduce` here.
106
+ // eslint-disable-next-line unicorn/no-array-reduce
107
+ output = output.reduce((current, next) => next === fistEscapeCode ? [next, ...current] : [...current, next], []);
108
+ }
109
+ }
110
+
111
+ return output.join('');
112
+ };
113
+
114
+ function sliceAnsi(string, begin, end) {
115
+ const characters = [...string];
116
+ const ansiCodes = [];
117
+
118
+ let stringEnd = typeof end === 'number' ? end : characters.length;
119
+ let isInsideEscape = false;
120
+ let ansiCode;
121
+ let visible = 0;
122
+ let output = '';
123
+
124
+ for (const [index, character] of characters.entries()) {
125
+ let leftEscape = false;
126
+
127
+ if (ESCAPES.includes(character)) {
128
+ const code = /\d[^m]*/.exec(string.slice(index, index + 18));
129
+ ansiCode = code && code.length > 0 ? code[0] : undefined;
130
+
131
+ if (visible < stringEnd) {
132
+ isInsideEscape = true;
133
+
134
+ if (ansiCode !== undefined) {
135
+ ansiCodes.push(ansiCode);
136
+ }
137
+ }
138
+ } else if (isInsideEscape && character === 'm') {
139
+ isInsideEscape = false;
140
+ leftEscape = true;
141
+ }
142
+
143
+ if (!isInsideEscape && !leftEscape) {
144
+ visible++;
145
+ }
146
+
147
+ if (!astralRegex.test(character) && isFullwidthCodePoint(character.codePointAt())) {
148
+ visible++;
149
+
150
+ if (typeof end !== 'number') {
151
+ stringEnd++;
152
+ }
153
+ }
154
+
155
+ if (visible > begin && visible <= stringEnd) {
156
+ output += character;
157
+ } else if (visible === begin && !isInsideEscape && ansiCode !== undefined) {
158
+ output = checkAnsi(ansiCodes);
159
+ } else if (visible >= stringEnd) {
160
+ output += checkAnsi(ansiCodes, true, ansiCode);
161
+ break;
162
+ }
163
+ }
164
+
165
+ return output;
166
+ }
167
+
168
+ // EXTERNAL MODULE: ./node_modules/listr2/node_modules/string-width/index.js
169
+ var string_width = __webpack_require__(10509);
170
+ ;// CONCATENATED MODULE: ./node_modules/listr2/node_modules/cli-truncate/index.js
171
+
172
+
173
+
174
+ function getIndexOfNearestSpace(string, wantedIndex, shouldSearchRight) {
175
+ if (string.charAt(wantedIndex) === ' ') {
176
+ return wantedIndex;
177
+ }
178
+
179
+ const direction = shouldSearchRight ? 1 : -1;
180
+
181
+ for (let index = 0; index <= 3; index++) {
182
+ const finalIndex = wantedIndex + (index * direction);
183
+ if (string.charAt(finalIndex) === ' ') {
184
+ return finalIndex;
185
+ }
186
+ }
187
+
188
+ return wantedIndex;
189
+ }
190
+
191
+ function cliTruncate(text, columns, options = {}) {
192
+ const {
193
+ position = 'end',
194
+ space = false,
195
+ preferTruncationOnSpace = false,
196
+ } = options;
197
+
198
+ let {truncationCharacter = '…'} = options;
199
+
200
+ if (typeof text !== 'string') {
201
+ throw new TypeError(`Expected \`input\` to be a string, got ${typeof text}`);
202
+ }
203
+
204
+ if (typeof columns !== 'number') {
205
+ throw new TypeError(`Expected \`columns\` to be a number, got ${typeof columns}`);
206
+ }
207
+
208
+ if (columns < 1) {
209
+ return '';
210
+ }
211
+
212
+ if (columns === 1) {
213
+ return truncationCharacter;
214
+ }
215
+
216
+ const length = (0,string_width/* default */.Z)(text);
217
+
218
+ if (length <= columns) {
219
+ return text;
220
+ }
221
+
222
+ if (position === 'start') {
223
+ if (preferTruncationOnSpace) {
224
+ const nearestSpace = getIndexOfNearestSpace(text, length - columns + 1, true);
225
+ return truncationCharacter + sliceAnsi(text, nearestSpace, length).trim();
226
+ }
227
+
228
+ if (space === true) {
229
+ truncationCharacter += ' ';
230
+ }
231
+
232
+ return truncationCharacter + sliceAnsi(text, length - columns + (0,string_width/* default */.Z)(truncationCharacter), length);
233
+ }
234
+
235
+ if (position === 'middle') {
236
+ if (space === true) {
237
+ truncationCharacter = ` ${truncationCharacter} `;
238
+ }
239
+
240
+ const half = Math.floor(columns / 2);
241
+
242
+ if (preferTruncationOnSpace) {
243
+ const spaceNearFirstBreakPoint = getIndexOfNearestSpace(text, half);
244
+ const spaceNearSecondBreakPoint = getIndexOfNearestSpace(text, length - (columns - half) + 1, true);
245
+ return sliceAnsi(text, 0, spaceNearFirstBreakPoint) + truncationCharacter + sliceAnsi(text, spaceNearSecondBreakPoint, length).trim();
246
+ }
247
+
248
+ return (
249
+ sliceAnsi(text, 0, half)
250
+ + truncationCharacter
251
+ + sliceAnsi(text, length - (columns - half) + (0,string_width/* default */.Z)(truncationCharacter), length)
252
+ );
253
+ }
254
+
255
+ if (position === 'end') {
256
+ if (preferTruncationOnSpace) {
257
+ const nearestSpace = getIndexOfNearestSpace(text, columns - 1);
258
+ return sliceAnsi(text, 0, nearestSpace) + truncationCharacter;
259
+ }
260
+
261
+ if (space === true) {
262
+ truncationCharacter = ` ${truncationCharacter}`;
263
+ }
264
+
265
+ return sliceAnsi(text, 0, columns - (0,string_width/* default */.Z)(truncationCharacter)) + truncationCharacter;
266
+ }
267
+
268
+ throw new Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${position}`);
269
+ }
270
+
271
+
272
+ /***/ })
273
+
274
+ };
275
+ ;