@rsbuild/webpack 0.6.15 → 0.7.0-beta.0

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.
Files changed (55) hide show
  1. package/dist/index.cjs +2675 -0
  2. package/dist/index.js +2748 -11
  3. package/package.json +12 -14
  4. package/compiled/ansi-escapes/index.d.ts +0 -248
  5. package/compiled/ansi-escapes/index.js +0 -1
  6. package/compiled/ansi-escapes/license +0 -9
  7. package/compiled/ansi-escapes/package.json +0 -1
  8. package/compiled/ansi-escapes/type-fest/index.d.ts +0 -2
  9. package/compiled/cli-truncate/index.d.ts +0 -96
  10. package/compiled/cli-truncate/index.js +0 -1
  11. package/compiled/cli-truncate/license +0 -9
  12. package/compiled/cli-truncate/package.json +0 -1
  13. package/compiled/copy-webpack-plugin/index.d.ts +0 -1
  14. package/compiled/copy-webpack-plugin/index.js +0 -22
  15. package/compiled/copy-webpack-plugin/license +0 -20
  16. package/compiled/copy-webpack-plugin/package.json +0 -1
  17. package/compiled/patch-console/build/index.d.ts +0 -4
  18. package/compiled/patch-console/index.js +0 -1
  19. package/compiled/patch-console/package.json +0 -1
  20. package/compiled/schema-utils3/index.d.ts +0 -1
  21. package/compiled/schema-utils3/index.js +0 -3
  22. package/compiled/schema-utils3/license +0 -20
  23. package/compiled/schema-utils3/package.json +0 -1
  24. package/compiled/tapable/index.js +0 -1
  25. package/compiled/tapable/license +0 -21
  26. package/compiled/tapable/package.json +0 -1
  27. package/compiled/tapable/tapable.d.ts +0 -116
  28. package/dist/build.js +0 -90
  29. package/dist/createCompiler.js +0 -96
  30. package/dist/initConfigs.js +0 -65
  31. package/dist/inspectConfig.js +0 -85
  32. package/dist/plugins/copy.js +0 -68
  33. package/dist/plugins/css.d.ts +0 -9
  34. package/dist/plugins/css.js +0 -109
  35. package/dist/plugins/less.d.ts +0 -5
  36. package/dist/plugins/less.js +0 -66
  37. package/dist/plugins/output.d.ts +0 -2
  38. package/dist/plugins/output.js +0 -66
  39. package/dist/plugins/progress.js +0 -57
  40. package/dist/plugins/resolve.js +0 -83
  41. package/dist/plugins/sass.d.ts +0 -2
  42. package/dist/plugins/sass.js +0 -76
  43. package/dist/progress/ProgressPlugin.js +0 -110
  44. package/dist/progress/helpers/bar.js +0 -142
  45. package/dist/progress/helpers/bus.js +0 -109
  46. package/dist/progress/helpers/index.js +0 -28
  47. package/dist/progress/helpers/log.js +0 -62
  48. package/dist/progress/helpers/nonTty.js +0 -56
  49. package/dist/progress/helpers/percentage.js +0 -52
  50. package/dist/progress/helpers/type.js +0 -16
  51. package/dist/progress/helpers/utils.js +0 -30
  52. package/dist/provider.js +0 -159
  53. package/dist/shared.js +0 -47
  54. package/dist/types.js +0 -16
  55. package/dist/webpackConfig.js +0 -165
package/dist/index.cjs ADDED
@@ -0,0 +1,2675 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __esm = (fn, res) => function __init() {
10
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
11
+ };
12
+ var __commonJS = (cb, mod) => function __require() {
13
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
14
+ };
15
+ var __export = (target, all) => {
16
+ for (var name in all)
17
+ __defProp(target, name, { get: all[name], enumerable: true });
18
+ };
19
+ var __copyProps = (to, from, except, desc) => {
20
+ if (from && typeof from === "object" || typeof from === "function") {
21
+ for (let key of __getOwnPropNames(from))
22
+ if (!__hasOwnProp.call(to, key) && key !== except)
23
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
24
+ }
25
+ return to;
26
+ };
27
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
28
+ // If the importer is in node compatibility mode or this is not an ESM
29
+ // file that has been converted to a CommonJS file using a Babel-
30
+ // compatible transform (i.e. "__esModule" has not been set), then set
31
+ // "default" to the CommonJS "module.exports" for node compatibility.
32
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
33
+ mod
34
+ ));
35
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
+ var __publicField = (obj, key, value) => {
37
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
38
+ return value;
39
+ };
40
+
41
+ // src/inspectConfig.ts
42
+ var inspectConfig_exports = {};
43
+ __export(inspectConfig_exports, {
44
+ inspectConfig: () => inspectConfig
45
+ });
46
+ async function inspectConfig({
47
+ context,
48
+ pluginManager,
49
+ rsbuildOptions,
50
+ bundlerConfigs,
51
+ inspectOptions = {}
52
+ }) {
53
+ if (inspectOptions.env) {
54
+ (0, import_shared.setNodeEnv)(inspectOptions.env);
55
+ } else if (!(0, import_shared.getNodeEnv)()) {
56
+ (0, import_shared.setNodeEnv)("development");
57
+ }
58
+ const webpackConfigs = bundlerConfigs || (await initConfigs({
59
+ context,
60
+ pluginManager,
61
+ rsbuildOptions
62
+ })).webpackConfigs;
63
+ const rsbuildDebugConfig = {
64
+ ...context.normalizedConfig,
65
+ pluginNames: pluginManager.plugins.map((p) => p.name)
66
+ };
67
+ const rawRsbuildConfig = await (0, import_shared.stringifyConfig)(
68
+ rsbuildDebugConfig,
69
+ inspectOptions.verbose
70
+ );
71
+ const rawBundlerConfigs = await Promise.all(
72
+ webpackConfigs.map(
73
+ (config) => (0, import_shared.stringifyConfig)(config, inspectOptions.verbose)
74
+ )
75
+ );
76
+ let outputPath = inspectOptions.outputPath || context.distPath;
77
+ if (!(0, import_node_path.isAbsolute)(outputPath)) {
78
+ outputPath = (0, import_node_path.join)(context.rootPath, outputPath);
79
+ }
80
+ if (inspectOptions.writeToDisk) {
81
+ await (0, import_shared.outputInspectConfigFiles)({
82
+ rsbuildConfig: context.normalizedConfig,
83
+ rawRsbuildConfig,
84
+ bundlerConfigs: rawBundlerConfigs,
85
+ inspectOptions: {
86
+ ...inspectOptions,
87
+ outputPath
88
+ },
89
+ configType: "webpack"
90
+ });
91
+ }
92
+ return {
93
+ rsbuildConfig: rawRsbuildConfig,
94
+ bundlerConfigs: rawBundlerConfigs,
95
+ origin: {
96
+ rsbuildConfig: rsbuildDebugConfig,
97
+ bundlerConfigs: webpackConfigs
98
+ }
99
+ };
100
+ }
101
+ var import_node_path, import_shared;
102
+ var init_inspectConfig = __esm({
103
+ "src/inspectConfig.ts"() {
104
+ "use strict";
105
+ import_node_path = require("path");
106
+ import_shared = require("@rsbuild/shared");
107
+ init_initConfigs();
108
+ }
109
+ });
110
+
111
+ // src/shared.ts
112
+ var import_node_fs, import_node_path2, import_shared2, getCompiledPath;
113
+ var init_shared = __esm({
114
+ "src/shared.ts"() {
115
+ "use strict";
116
+ import_node_fs = __toESM(require("fs"));
117
+ import_node_path2 = require("path");
118
+ import_shared2 = require("@rsbuild/shared");
119
+ getCompiledPath = (packageName) => {
120
+ const providerCompilerPath = (0, import_node_path2.join)(__dirname, "../../compiled", packageName);
121
+ if (import_node_fs.default.existsSync(providerCompilerPath)) {
122
+ return providerCompilerPath;
123
+ }
124
+ return (0, import_shared2.getSharedPkgCompiledPath)(packageName);
125
+ };
126
+ }
127
+ });
128
+
129
+ // src/webpackConfig.ts
130
+ async function modifyWebpackChain(context, utils, chain) {
131
+ (0, import_shared3.debug)("modify webpack chain");
132
+ const [modifiedChain] = await context.hooks.modifyWebpackChain.call(
133
+ chain,
134
+ utils
135
+ );
136
+ if (context.config.tools?.webpackChain) {
137
+ for (const item of (0, import_shared3.castArray)(context.config.tools.webpackChain)) {
138
+ item(modifiedChain, utils);
139
+ }
140
+ }
141
+ (0, import_shared3.debug)("modify webpack chain done");
142
+ return modifiedChain;
143
+ }
144
+ async function modifyWebpackConfig(context, webpackConfig, utils) {
145
+ (0, import_shared3.debug)("modify webpack config");
146
+ let [modifiedConfig] = await context.hooks.modifyWebpackConfig.call(
147
+ webpackConfig,
148
+ utils
149
+ );
150
+ if (context.config.tools?.webpack) {
151
+ modifiedConfig = (0, import_shared3.mergeChainedOptions)({
152
+ defaults: modifiedConfig,
153
+ options: context.config.tools.webpack,
154
+ utils,
155
+ mergeFn: utils.mergeConfig
156
+ });
157
+ }
158
+ (0, import_shared3.debug)("modify webpack config done");
159
+ return modifiedConfig;
160
+ }
161
+ async function getChainUtils(target) {
162
+ const { default: webpack2 } = await import("webpack");
163
+ const { getHTMLPlugin } = await import("@rsbuild/core/internal");
164
+ const nameMap = {
165
+ web: "client",
166
+ node: "server",
167
+ "web-worker": "web-worker",
168
+ "service-worker": "service-worker"
169
+ };
170
+ return {
171
+ ...(0, import_internal.getChainUtils)(target),
172
+ name: nameMap[target] || "",
173
+ webpack: webpack2,
174
+ getCompiledPath,
175
+ HtmlWebpackPlugin: getHTMLPlugin()
176
+ };
177
+ }
178
+ async function getConfigUtils(config, chainUtils) {
179
+ const { merge } = await import("@rsbuild/shared/webpack-merge");
180
+ return {
181
+ ...chainUtils,
182
+ mergeConfig: merge,
183
+ addRules(rules) {
184
+ const ruleArr = (0, import_shared3.castArray)(rules);
185
+ if (!config.module) {
186
+ config.module = {};
187
+ }
188
+ if (!config.module.rules) {
189
+ config.module.rules = [];
190
+ }
191
+ config.module.rules.unshift(...ruleArr);
192
+ },
193
+ prependPlugins(plugins2) {
194
+ const pluginArr = (0, import_shared3.castArray)(plugins2);
195
+ if (!config.plugins) {
196
+ config.plugins = [];
197
+ }
198
+ config.plugins.unshift(...pluginArr);
199
+ },
200
+ appendPlugins(plugins2) {
201
+ const pluginArr = (0, import_shared3.castArray)(plugins2);
202
+ if (!config.plugins) {
203
+ config.plugins = [];
204
+ }
205
+ config.plugins.push(...pluginArr);
206
+ },
207
+ removePlugin(pluginName) {
208
+ if (config.plugins) {
209
+ config.plugins = config.plugins.filter(
210
+ (item) => item?.constructor.name !== pluginName
211
+ );
212
+ }
213
+ }
214
+ };
215
+ }
216
+ async function generateWebpackConfig({
217
+ target,
218
+ context
219
+ }) {
220
+ const chainUtils = await getChainUtils(target);
221
+ const { default: webpack2 } = await import("webpack");
222
+ const {
223
+ BannerPlugin,
224
+ DefinePlugin,
225
+ IgnorePlugin,
226
+ ProvidePlugin,
227
+ HotModuleReplacementPlugin
228
+ } = webpack2;
229
+ const bundlerChain = await (0, import_shared3.modifyBundlerChain)(context, {
230
+ ...chainUtils,
231
+ bundler: {
232
+ BannerPlugin,
233
+ DefinePlugin,
234
+ IgnorePlugin,
235
+ ProvidePlugin,
236
+ HotModuleReplacementPlugin
237
+ }
238
+ });
239
+ const chain = await modifyWebpackChain(
240
+ context,
241
+ chainUtils,
242
+ // module rules not support merge
243
+ // need a special rule merge or use bundlerChain as WebpackChain
244
+ bundlerChain
245
+ );
246
+ let webpackConfig = (0, import_shared3.chainToConfig)(
247
+ chain
248
+ );
249
+ webpackConfig = await modifyWebpackConfig(
250
+ context,
251
+ webpackConfig,
252
+ await getConfigUtils(webpackConfig, chainUtils)
253
+ );
254
+ return webpackConfig;
255
+ }
256
+ var import_internal, import_shared3;
257
+ var init_webpackConfig = __esm({
258
+ "src/webpackConfig.ts"() {
259
+ "use strict";
260
+ import_internal = require("@rsbuild/core/internal");
261
+ import_shared3 = require("@rsbuild/shared");
262
+ init_shared();
263
+ }
264
+ });
265
+
266
+ // src/initConfigs.ts
267
+ async function initConfigs({
268
+ context,
269
+ pluginManager,
270
+ rsbuildOptions
271
+ }) {
272
+ const normalizedConfig = await (0, import_internal2.initRsbuildConfig)({
273
+ context,
274
+ pluginManager
275
+ });
276
+ const { targets } = normalizedConfig.output;
277
+ const webpackConfigs = await Promise.all(
278
+ targets.map((target) => generateWebpackConfig({ target, context }))
279
+ );
280
+ if ((0, import_shared5.isDebug)()) {
281
+ const inspect = () => {
282
+ const inspectOptions = {
283
+ verbose: true,
284
+ writeToDisk: true
285
+ };
286
+ inspectConfig({
287
+ context,
288
+ pluginManager,
289
+ inspectOptions,
290
+ rsbuildOptions,
291
+ bundlerConfigs: webpackConfigs
292
+ });
293
+ };
294
+ context.hooks.onBeforeBuild.tap(inspect);
295
+ context.hooks.onAfterStartDevServer.tap(inspect);
296
+ }
297
+ return {
298
+ webpackConfigs
299
+ };
300
+ }
301
+ var import_internal2, import_shared5;
302
+ var init_initConfigs = __esm({
303
+ "src/initConfigs.ts"() {
304
+ "use strict";
305
+ import_internal2 = require("@rsbuild/core/internal");
306
+ import_shared5 = require("@rsbuild/shared");
307
+ init_inspectConfig();
308
+ init_webpackConfig();
309
+ }
310
+ });
311
+
312
+ // src/createCompiler.ts
313
+ var createCompiler_exports = {};
314
+ __export(createCompiler_exports, {
315
+ createCompiler: () => createCompiler,
316
+ createDevMiddleware: () => createDevMiddleware
317
+ });
318
+ async function createCompiler({
319
+ context,
320
+ webpackConfigs
321
+ }) {
322
+ (0, import_shared6.debug)("create compiler");
323
+ await context.hooks.onBeforeCreateCompiler.call({
324
+ bundlerConfigs: webpackConfigs
325
+ });
326
+ const { default: webpack2 } = await import("webpack");
327
+ const compiler = webpackConfigs.length === 1 ? webpack2(webpackConfigs[0]) : webpack2(webpackConfigs);
328
+ const done = async (stats) => {
329
+ const { message, level } = (0, import_internal3.formatStats)(
330
+ stats,
331
+ (0, import_internal3.getStatsOptions)(compiler)
332
+ );
333
+ if (level === "error") {
334
+ import_shared6.logger.error(message);
335
+ }
336
+ if (level === "warning") {
337
+ import_shared6.logger.warn(message);
338
+ }
339
+ if ((0, import_shared6.isDev)()) {
340
+ await context.hooks.onDevCompileDone.call({
341
+ isFirstCompile,
342
+ stats
343
+ });
344
+ }
345
+ isFirstCompile = false;
346
+ };
347
+ let isFirstCompile = true;
348
+ (0, import_shared6.onCompileDone)(compiler, done, import_MultiStats.default);
349
+ await context.hooks.onAfterCreateCompiler.call({
350
+ compiler
351
+ });
352
+ (0, import_shared6.debug)("create compiler done");
353
+ return compiler;
354
+ }
355
+ async function createDevMiddleware(options, customCompiler) {
356
+ let compiler;
357
+ if (customCompiler) {
358
+ compiler = customCompiler;
359
+ } else {
360
+ const { webpackConfigs } = await initConfigs(options);
361
+ compiler = await createCompiler({
362
+ context: options.context,
363
+ webpackConfigs
364
+ });
365
+ }
366
+ return {
367
+ devMiddleware: (0, import_internal3.getDevMiddleware)(compiler),
368
+ compiler
369
+ };
370
+ }
371
+ var import_internal3, import_shared6, import_MultiStats;
372
+ var init_createCompiler = __esm({
373
+ "src/createCompiler.ts"() {
374
+ "use strict";
375
+ import_internal3 = require("@rsbuild/core/internal");
376
+ import_shared6 = require("@rsbuild/shared");
377
+ import_MultiStats = __toESM(require("webpack/lib/MultiStats.js"));
378
+ init_initConfigs();
379
+ }
380
+ });
381
+
382
+ // src/plugins/resolve.ts
383
+ var resolve_exports = {};
384
+ __export(resolve_exports, {
385
+ pluginResolve: () => pluginResolve
386
+ });
387
+ async function applyTsConfigPathsPlugin({
388
+ chain,
389
+ CHAIN_ID,
390
+ mainFields,
391
+ extensions,
392
+ configFile
393
+ }) {
394
+ const { TsconfigPathsPlugin } = await import("tsconfig-paths-webpack-plugin");
395
+ chain.resolve.plugin(CHAIN_ID.RESOLVE_PLUGIN.TS_CONFIG_PATHS).use(TsconfigPathsPlugin, [
396
+ {
397
+ configFile,
398
+ extensions,
399
+ // https://github.com/dividab/tsconfig-paths-webpack-plugin/pull/106
400
+ mainFields
401
+ }
402
+ ]);
403
+ }
404
+ var import_shared7, getMainFields, pluginResolve;
405
+ var init_resolve = __esm({
406
+ "src/plugins/resolve.ts"() {
407
+ "use strict";
408
+ import_shared7 = require("@rsbuild/shared");
409
+ getMainFields = (chain, target) => {
410
+ const mainFields = chain.resolve.mainFields.values();
411
+ if (mainFields.length) {
412
+ return mainFields;
413
+ }
414
+ if ((0, import_shared7.isWebTarget)(target)) {
415
+ return ["browser", "module", "main"];
416
+ }
417
+ return ["module", "main"];
418
+ };
419
+ pluginResolve = () => ({
420
+ name: "rsbuild-webpack:resolve",
421
+ setup(api) {
422
+ (0, import_shared7.applyResolvePlugin)(api);
423
+ api.modifyBundlerChain(async (chain, { CHAIN_ID, target }) => {
424
+ const config = api.getNormalizedConfig();
425
+ if (api.context.tsconfigPath && config.source.aliasStrategy === "prefer-tsconfig") {
426
+ await applyTsConfigPathsPlugin({
427
+ chain,
428
+ CHAIN_ID,
429
+ configFile: api.context.tsconfigPath,
430
+ mainFields: getMainFields(chain, target),
431
+ extensions: chain.resolve.extensions.values()
432
+ });
433
+ }
434
+ });
435
+ }
436
+ });
437
+ }
438
+ });
439
+
440
+ // src/plugins/copy.ts
441
+ var copy_exports = {};
442
+ __export(copy_exports, {
443
+ pluginCopy: () => pluginCopy
444
+ });
445
+ var import_node_fs2, pluginCopy;
446
+ var init_copy = __esm({
447
+ "src/plugins/copy.ts"() {
448
+ "use strict";
449
+ import_node_fs2 = __toESM(require("fs"));
450
+ pluginCopy = () => ({
451
+ name: "rsbuild-webpack:copy",
452
+ setup(api) {
453
+ api.modifyBundlerChain(async (chain, { CHAIN_ID }) => {
454
+ const config = api.getNormalizedConfig();
455
+ const { copy } = config.output;
456
+ if (!copy) {
457
+ return;
458
+ }
459
+ const { default: CopyPlugin } = await import(
460
+ // @ts-expect-error copy-webpack-plugin does not provide types
461
+ "copy-webpack-plugin"
462
+ );
463
+ const options = Array.isArray(copy) ? { patterns: copy } : copy;
464
+ chain.plugin(CHAIN_ID.PLUGIN.COPY).use(CopyPlugin, [options]);
465
+ });
466
+ api.modifyWebpackConfig(async (config) => {
467
+ const copyPlugin = config.plugins?.find(
468
+ (item) => item?.constructor.name === "CopyPlugin"
469
+ );
470
+ if (copyPlugin) {
471
+ const isContextNotExists = copyPlugin.patterns.every(
472
+ (pattern) => typeof pattern !== "string" && pattern.context && !import_node_fs2.default.existsSync(pattern.context)
473
+ );
474
+ if (isContextNotExists) {
475
+ config.plugins = config.plugins?.filter(
476
+ (item) => item?.constructor.name !== "CopyPlugin"
477
+ );
478
+ }
479
+ }
480
+ });
481
+ }
482
+ });
483
+ }
484
+ });
485
+
486
+ // ../../../node_modules/.pnpm/is-fullwidth-code-point@3.0.0/node_modules/is-fullwidth-code-point/index.js
487
+ var require_is_fullwidth_code_point = __commonJS({
488
+ "../../../node_modules/.pnpm/is-fullwidth-code-point@3.0.0/node_modules/is-fullwidth-code-point/index.js"(exports2, module2) {
489
+ "use strict";
490
+ var isFullwidthCodePoint = (codePoint) => {
491
+ if (Number.isNaN(codePoint)) {
492
+ return false;
493
+ }
494
+ if (codePoint >= 4352 && (codePoint <= 4447 || // Hangul Jamo
495
+ codePoint === 9001 || // LEFT-POINTING ANGLE BRACKET
496
+ codePoint === 9002 || // RIGHT-POINTING ANGLE BRACKET
497
+ // CJK Radicals Supplement .. Enclosed CJK Letters and Months
498
+ 11904 <= codePoint && codePoint <= 12871 && codePoint !== 12351 || // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
499
+ 12880 <= codePoint && codePoint <= 19903 || // CJK Unified Ideographs .. Yi Radicals
500
+ 19968 <= codePoint && codePoint <= 42182 || // Hangul Jamo Extended-A
501
+ 43360 <= codePoint && codePoint <= 43388 || // Hangul Syllables
502
+ 44032 <= codePoint && codePoint <= 55203 || // CJK Compatibility Ideographs
503
+ 63744 <= codePoint && codePoint <= 64255 || // Vertical Forms
504
+ 65040 <= codePoint && codePoint <= 65049 || // CJK Compatibility Forms .. Small Form Variants
505
+ 65072 <= codePoint && codePoint <= 65131 || // Halfwidth and Fullwidth Forms
506
+ 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510 || // Kana Supplement
507
+ 110592 <= codePoint && codePoint <= 110593 || // Enclosed Ideographic Supplement
508
+ 127488 <= codePoint && codePoint <= 127569 || // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
509
+ 131072 <= codePoint && codePoint <= 262141)) {
510
+ return true;
511
+ }
512
+ return false;
513
+ };
514
+ module2.exports = isFullwidthCodePoint;
515
+ module2.exports.default = isFullwidthCodePoint;
516
+ }
517
+ });
518
+
519
+ // ../../../node_modules/.pnpm/astral-regex@2.0.0/node_modules/astral-regex/index.js
520
+ var require_astral_regex = __commonJS({
521
+ "../../../node_modules/.pnpm/astral-regex@2.0.0/node_modules/astral-regex/index.js"(exports2, module2) {
522
+ "use strict";
523
+ var regex = "[\uD800-\uDBFF][\uDC00-\uDFFF]";
524
+ var astralRegex = (options) => options && options.exact ? new RegExp(`^${regex}$`) : new RegExp(regex, "g");
525
+ module2.exports = astralRegex;
526
+ }
527
+ });
528
+
529
+ // ../../../node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js
530
+ var require_color_name = __commonJS({
531
+ "../../../node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js"(exports2, module2) {
532
+ "use strict";
533
+ module2.exports = {
534
+ "aliceblue": [240, 248, 255],
535
+ "antiquewhite": [250, 235, 215],
536
+ "aqua": [0, 255, 255],
537
+ "aquamarine": [127, 255, 212],
538
+ "azure": [240, 255, 255],
539
+ "beige": [245, 245, 220],
540
+ "bisque": [255, 228, 196],
541
+ "black": [0, 0, 0],
542
+ "blanchedalmond": [255, 235, 205],
543
+ "blue": [0, 0, 255],
544
+ "blueviolet": [138, 43, 226],
545
+ "brown": [165, 42, 42],
546
+ "burlywood": [222, 184, 135],
547
+ "cadetblue": [95, 158, 160],
548
+ "chartreuse": [127, 255, 0],
549
+ "chocolate": [210, 105, 30],
550
+ "coral": [255, 127, 80],
551
+ "cornflowerblue": [100, 149, 237],
552
+ "cornsilk": [255, 248, 220],
553
+ "crimson": [220, 20, 60],
554
+ "cyan": [0, 255, 255],
555
+ "darkblue": [0, 0, 139],
556
+ "darkcyan": [0, 139, 139],
557
+ "darkgoldenrod": [184, 134, 11],
558
+ "darkgray": [169, 169, 169],
559
+ "darkgreen": [0, 100, 0],
560
+ "darkgrey": [169, 169, 169],
561
+ "darkkhaki": [189, 183, 107],
562
+ "darkmagenta": [139, 0, 139],
563
+ "darkolivegreen": [85, 107, 47],
564
+ "darkorange": [255, 140, 0],
565
+ "darkorchid": [153, 50, 204],
566
+ "darkred": [139, 0, 0],
567
+ "darksalmon": [233, 150, 122],
568
+ "darkseagreen": [143, 188, 143],
569
+ "darkslateblue": [72, 61, 139],
570
+ "darkslategray": [47, 79, 79],
571
+ "darkslategrey": [47, 79, 79],
572
+ "darkturquoise": [0, 206, 209],
573
+ "darkviolet": [148, 0, 211],
574
+ "deeppink": [255, 20, 147],
575
+ "deepskyblue": [0, 191, 255],
576
+ "dimgray": [105, 105, 105],
577
+ "dimgrey": [105, 105, 105],
578
+ "dodgerblue": [30, 144, 255],
579
+ "firebrick": [178, 34, 34],
580
+ "floralwhite": [255, 250, 240],
581
+ "forestgreen": [34, 139, 34],
582
+ "fuchsia": [255, 0, 255],
583
+ "gainsboro": [220, 220, 220],
584
+ "ghostwhite": [248, 248, 255],
585
+ "gold": [255, 215, 0],
586
+ "goldenrod": [218, 165, 32],
587
+ "gray": [128, 128, 128],
588
+ "green": [0, 128, 0],
589
+ "greenyellow": [173, 255, 47],
590
+ "grey": [128, 128, 128],
591
+ "honeydew": [240, 255, 240],
592
+ "hotpink": [255, 105, 180],
593
+ "indianred": [205, 92, 92],
594
+ "indigo": [75, 0, 130],
595
+ "ivory": [255, 255, 240],
596
+ "khaki": [240, 230, 140],
597
+ "lavender": [230, 230, 250],
598
+ "lavenderblush": [255, 240, 245],
599
+ "lawngreen": [124, 252, 0],
600
+ "lemonchiffon": [255, 250, 205],
601
+ "lightblue": [173, 216, 230],
602
+ "lightcoral": [240, 128, 128],
603
+ "lightcyan": [224, 255, 255],
604
+ "lightgoldenrodyellow": [250, 250, 210],
605
+ "lightgray": [211, 211, 211],
606
+ "lightgreen": [144, 238, 144],
607
+ "lightgrey": [211, 211, 211],
608
+ "lightpink": [255, 182, 193],
609
+ "lightsalmon": [255, 160, 122],
610
+ "lightseagreen": [32, 178, 170],
611
+ "lightskyblue": [135, 206, 250],
612
+ "lightslategray": [119, 136, 153],
613
+ "lightslategrey": [119, 136, 153],
614
+ "lightsteelblue": [176, 196, 222],
615
+ "lightyellow": [255, 255, 224],
616
+ "lime": [0, 255, 0],
617
+ "limegreen": [50, 205, 50],
618
+ "linen": [250, 240, 230],
619
+ "magenta": [255, 0, 255],
620
+ "maroon": [128, 0, 0],
621
+ "mediumaquamarine": [102, 205, 170],
622
+ "mediumblue": [0, 0, 205],
623
+ "mediumorchid": [186, 85, 211],
624
+ "mediumpurple": [147, 112, 219],
625
+ "mediumseagreen": [60, 179, 113],
626
+ "mediumslateblue": [123, 104, 238],
627
+ "mediumspringgreen": [0, 250, 154],
628
+ "mediumturquoise": [72, 209, 204],
629
+ "mediumvioletred": [199, 21, 133],
630
+ "midnightblue": [25, 25, 112],
631
+ "mintcream": [245, 255, 250],
632
+ "mistyrose": [255, 228, 225],
633
+ "moccasin": [255, 228, 181],
634
+ "navajowhite": [255, 222, 173],
635
+ "navy": [0, 0, 128],
636
+ "oldlace": [253, 245, 230],
637
+ "olive": [128, 128, 0],
638
+ "olivedrab": [107, 142, 35],
639
+ "orange": [255, 165, 0],
640
+ "orangered": [255, 69, 0],
641
+ "orchid": [218, 112, 214],
642
+ "palegoldenrod": [238, 232, 170],
643
+ "palegreen": [152, 251, 152],
644
+ "paleturquoise": [175, 238, 238],
645
+ "palevioletred": [219, 112, 147],
646
+ "papayawhip": [255, 239, 213],
647
+ "peachpuff": [255, 218, 185],
648
+ "peru": [205, 133, 63],
649
+ "pink": [255, 192, 203],
650
+ "plum": [221, 160, 221],
651
+ "powderblue": [176, 224, 230],
652
+ "purple": [128, 0, 128],
653
+ "rebeccapurple": [102, 51, 153],
654
+ "red": [255, 0, 0],
655
+ "rosybrown": [188, 143, 143],
656
+ "royalblue": [65, 105, 225],
657
+ "saddlebrown": [139, 69, 19],
658
+ "salmon": [250, 128, 114],
659
+ "sandybrown": [244, 164, 96],
660
+ "seagreen": [46, 139, 87],
661
+ "seashell": [255, 245, 238],
662
+ "sienna": [160, 82, 45],
663
+ "silver": [192, 192, 192],
664
+ "skyblue": [135, 206, 235],
665
+ "slateblue": [106, 90, 205],
666
+ "slategray": [112, 128, 144],
667
+ "slategrey": [112, 128, 144],
668
+ "snow": [255, 250, 250],
669
+ "springgreen": [0, 255, 127],
670
+ "steelblue": [70, 130, 180],
671
+ "tan": [210, 180, 140],
672
+ "teal": [0, 128, 128],
673
+ "thistle": [216, 191, 216],
674
+ "tomato": [255, 99, 71],
675
+ "turquoise": [64, 224, 208],
676
+ "violet": [238, 130, 238],
677
+ "wheat": [245, 222, 179],
678
+ "white": [255, 255, 255],
679
+ "whitesmoke": [245, 245, 245],
680
+ "yellow": [255, 255, 0],
681
+ "yellowgreen": [154, 205, 50]
682
+ };
683
+ }
684
+ });
685
+
686
+ // ../../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js
687
+ var require_conversions = __commonJS({
688
+ "../../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js"(exports2, module2) {
689
+ "use strict";
690
+ var cssKeywords = require_color_name();
691
+ var reverseKeywords = {};
692
+ for (const key of Object.keys(cssKeywords)) {
693
+ reverseKeywords[cssKeywords[key]] = key;
694
+ }
695
+ var convert = {
696
+ rgb: { channels: 3, labels: "rgb" },
697
+ hsl: { channels: 3, labels: "hsl" },
698
+ hsv: { channels: 3, labels: "hsv" },
699
+ hwb: { channels: 3, labels: "hwb" },
700
+ cmyk: { channels: 4, labels: "cmyk" },
701
+ xyz: { channels: 3, labels: "xyz" },
702
+ lab: { channels: 3, labels: "lab" },
703
+ lch: { channels: 3, labels: "lch" },
704
+ hex: { channels: 1, labels: ["hex"] },
705
+ keyword: { channels: 1, labels: ["keyword"] },
706
+ ansi16: { channels: 1, labels: ["ansi16"] },
707
+ ansi256: { channels: 1, labels: ["ansi256"] },
708
+ hcg: { channels: 3, labels: ["h", "c", "g"] },
709
+ apple: { channels: 3, labels: ["r16", "g16", "b16"] },
710
+ gray: { channels: 1, labels: ["gray"] }
711
+ };
712
+ module2.exports = convert;
713
+ for (const model of Object.keys(convert)) {
714
+ if (!("channels" in convert[model])) {
715
+ throw new Error("missing channels property: " + model);
716
+ }
717
+ if (!("labels" in convert[model])) {
718
+ throw new Error("missing channel labels property: " + model);
719
+ }
720
+ if (convert[model].labels.length !== convert[model].channels) {
721
+ throw new Error("channel and label counts mismatch: " + model);
722
+ }
723
+ const { channels, labels } = convert[model];
724
+ delete convert[model].channels;
725
+ delete convert[model].labels;
726
+ Object.defineProperty(convert[model], "channels", { value: channels });
727
+ Object.defineProperty(convert[model], "labels", { value: labels });
728
+ }
729
+ convert.rgb.hsl = function(rgb) {
730
+ const r = rgb[0] / 255;
731
+ const g = rgb[1] / 255;
732
+ const b = rgb[2] / 255;
733
+ const min = Math.min(r, g, b);
734
+ const max = Math.max(r, g, b);
735
+ const delta = max - min;
736
+ let h;
737
+ let s;
738
+ if (max === min) {
739
+ h = 0;
740
+ } else if (r === max) {
741
+ h = (g - b) / delta;
742
+ } else if (g === max) {
743
+ h = 2 + (b - r) / delta;
744
+ } else if (b === max) {
745
+ h = 4 + (r - g) / delta;
746
+ }
747
+ h = Math.min(h * 60, 360);
748
+ if (h < 0) {
749
+ h += 360;
750
+ }
751
+ const l = (min + max) / 2;
752
+ if (max === min) {
753
+ s = 0;
754
+ } else if (l <= 0.5) {
755
+ s = delta / (max + min);
756
+ } else {
757
+ s = delta / (2 - max - min);
758
+ }
759
+ return [h, s * 100, l * 100];
760
+ };
761
+ convert.rgb.hsv = function(rgb) {
762
+ let rdif;
763
+ let gdif;
764
+ let bdif;
765
+ let h;
766
+ let s;
767
+ const r = rgb[0] / 255;
768
+ const g = rgb[1] / 255;
769
+ const b = rgb[2] / 255;
770
+ const v = Math.max(r, g, b);
771
+ const diff = v - Math.min(r, g, b);
772
+ const diffc = function(c) {
773
+ return (v - c) / 6 / diff + 1 / 2;
774
+ };
775
+ if (diff === 0) {
776
+ h = 0;
777
+ s = 0;
778
+ } else {
779
+ s = diff / v;
780
+ rdif = diffc(r);
781
+ gdif = diffc(g);
782
+ bdif = diffc(b);
783
+ if (r === v) {
784
+ h = bdif - gdif;
785
+ } else if (g === v) {
786
+ h = 1 / 3 + rdif - bdif;
787
+ } else if (b === v) {
788
+ h = 2 / 3 + gdif - rdif;
789
+ }
790
+ if (h < 0) {
791
+ h += 1;
792
+ } else if (h > 1) {
793
+ h -= 1;
794
+ }
795
+ }
796
+ return [
797
+ h * 360,
798
+ s * 100,
799
+ v * 100
800
+ ];
801
+ };
802
+ convert.rgb.hwb = function(rgb) {
803
+ const r = rgb[0];
804
+ const g = rgb[1];
805
+ let b = rgb[2];
806
+ const h = convert.rgb.hsl(rgb)[0];
807
+ const w = 1 / 255 * Math.min(r, Math.min(g, b));
808
+ b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
809
+ return [h, w * 100, b * 100];
810
+ };
811
+ convert.rgb.cmyk = function(rgb) {
812
+ const r = rgb[0] / 255;
813
+ const g = rgb[1] / 255;
814
+ const b = rgb[2] / 255;
815
+ const k = Math.min(1 - r, 1 - g, 1 - b);
816
+ const c = (1 - r - k) / (1 - k) || 0;
817
+ const m = (1 - g - k) / (1 - k) || 0;
818
+ const y = (1 - b - k) / (1 - k) || 0;
819
+ return [c * 100, m * 100, y * 100, k * 100];
820
+ };
821
+ function comparativeDistance(x, y) {
822
+ return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
823
+ }
824
+ convert.rgb.keyword = function(rgb) {
825
+ const reversed = reverseKeywords[rgb];
826
+ if (reversed) {
827
+ return reversed;
828
+ }
829
+ let currentClosestDistance = Infinity;
830
+ let currentClosestKeyword;
831
+ for (const keyword of Object.keys(cssKeywords)) {
832
+ const value = cssKeywords[keyword];
833
+ const distance = comparativeDistance(rgb, value);
834
+ if (distance < currentClosestDistance) {
835
+ currentClosestDistance = distance;
836
+ currentClosestKeyword = keyword;
837
+ }
838
+ }
839
+ return currentClosestKeyword;
840
+ };
841
+ convert.keyword.rgb = function(keyword) {
842
+ return cssKeywords[keyword];
843
+ };
844
+ convert.rgb.xyz = function(rgb) {
845
+ let r = rgb[0] / 255;
846
+ let g = rgb[1] / 255;
847
+ let b = rgb[2] / 255;
848
+ r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
849
+ g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
850
+ b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
851
+ const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
852
+ const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
853
+ const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
854
+ return [x * 100, y * 100, z * 100];
855
+ };
856
+ convert.rgb.lab = function(rgb) {
857
+ const xyz = convert.rgb.xyz(rgb);
858
+ let x = xyz[0];
859
+ let y = xyz[1];
860
+ let z = xyz[2];
861
+ x /= 95.047;
862
+ y /= 100;
863
+ z /= 108.883;
864
+ x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
865
+ y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
866
+ z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
867
+ const l = 116 * y - 16;
868
+ const a = 500 * (x - y);
869
+ const b = 200 * (y - z);
870
+ return [l, a, b];
871
+ };
872
+ convert.hsl.rgb = function(hsl) {
873
+ const h = hsl[0] / 360;
874
+ const s = hsl[1] / 100;
875
+ const l = hsl[2] / 100;
876
+ let t2;
877
+ let t3;
878
+ let val;
879
+ if (s === 0) {
880
+ val = l * 255;
881
+ return [val, val, val];
882
+ }
883
+ if (l < 0.5) {
884
+ t2 = l * (1 + s);
885
+ } else {
886
+ t2 = l + s - l * s;
887
+ }
888
+ const t1 = 2 * l - t2;
889
+ const rgb = [0, 0, 0];
890
+ for (let i = 0; i < 3; i++) {
891
+ t3 = h + 1 / 3 * -(i - 1);
892
+ if (t3 < 0) {
893
+ t3++;
894
+ }
895
+ if (t3 > 1) {
896
+ t3--;
897
+ }
898
+ if (6 * t3 < 1) {
899
+ val = t1 + (t2 - t1) * 6 * t3;
900
+ } else if (2 * t3 < 1) {
901
+ val = t2;
902
+ } else if (3 * t3 < 2) {
903
+ val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
904
+ } else {
905
+ val = t1;
906
+ }
907
+ rgb[i] = val * 255;
908
+ }
909
+ return rgb;
910
+ };
911
+ convert.hsl.hsv = function(hsl) {
912
+ const h = hsl[0];
913
+ let s = hsl[1] / 100;
914
+ let l = hsl[2] / 100;
915
+ let smin = s;
916
+ const lmin = Math.max(l, 0.01);
917
+ l *= 2;
918
+ s *= l <= 1 ? l : 2 - l;
919
+ smin *= lmin <= 1 ? lmin : 2 - lmin;
920
+ const v = (l + s) / 2;
921
+ const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
922
+ return [h, sv * 100, v * 100];
923
+ };
924
+ convert.hsv.rgb = function(hsv) {
925
+ const h = hsv[0] / 60;
926
+ const s = hsv[1] / 100;
927
+ let v = hsv[2] / 100;
928
+ const hi = Math.floor(h) % 6;
929
+ const f = h - Math.floor(h);
930
+ const p = 255 * v * (1 - s);
931
+ const q = 255 * v * (1 - s * f);
932
+ const t = 255 * v * (1 - s * (1 - f));
933
+ v *= 255;
934
+ switch (hi) {
935
+ case 0:
936
+ return [v, t, p];
937
+ case 1:
938
+ return [q, v, p];
939
+ case 2:
940
+ return [p, v, t];
941
+ case 3:
942
+ return [p, q, v];
943
+ case 4:
944
+ return [t, p, v];
945
+ case 5:
946
+ return [v, p, q];
947
+ }
948
+ };
949
+ convert.hsv.hsl = function(hsv) {
950
+ const h = hsv[0];
951
+ const s = hsv[1] / 100;
952
+ const v = hsv[2] / 100;
953
+ const vmin = Math.max(v, 0.01);
954
+ let sl;
955
+ let l;
956
+ l = (2 - s) * v;
957
+ const lmin = (2 - s) * vmin;
958
+ sl = s * vmin;
959
+ sl /= lmin <= 1 ? lmin : 2 - lmin;
960
+ sl = sl || 0;
961
+ l /= 2;
962
+ return [h, sl * 100, l * 100];
963
+ };
964
+ convert.hwb.rgb = function(hwb) {
965
+ const h = hwb[0] / 360;
966
+ let wh = hwb[1] / 100;
967
+ let bl = hwb[2] / 100;
968
+ const ratio = wh + bl;
969
+ let f;
970
+ if (ratio > 1) {
971
+ wh /= ratio;
972
+ bl /= ratio;
973
+ }
974
+ const i = Math.floor(6 * h);
975
+ const v = 1 - bl;
976
+ f = 6 * h - i;
977
+ if ((i & 1) !== 0) {
978
+ f = 1 - f;
979
+ }
980
+ const n = wh + f * (v - wh);
981
+ let r;
982
+ let g;
983
+ let b;
984
+ switch (i) {
985
+ default:
986
+ case 6:
987
+ case 0:
988
+ r = v;
989
+ g = n;
990
+ b = wh;
991
+ break;
992
+ case 1:
993
+ r = n;
994
+ g = v;
995
+ b = wh;
996
+ break;
997
+ case 2:
998
+ r = wh;
999
+ g = v;
1000
+ b = n;
1001
+ break;
1002
+ case 3:
1003
+ r = wh;
1004
+ g = n;
1005
+ b = v;
1006
+ break;
1007
+ case 4:
1008
+ r = n;
1009
+ g = wh;
1010
+ b = v;
1011
+ break;
1012
+ case 5:
1013
+ r = v;
1014
+ g = wh;
1015
+ b = n;
1016
+ break;
1017
+ }
1018
+ return [r * 255, g * 255, b * 255];
1019
+ };
1020
+ convert.cmyk.rgb = function(cmyk) {
1021
+ const c = cmyk[0] / 100;
1022
+ const m = cmyk[1] / 100;
1023
+ const y = cmyk[2] / 100;
1024
+ const k = cmyk[3] / 100;
1025
+ const r = 1 - Math.min(1, c * (1 - k) + k);
1026
+ const g = 1 - Math.min(1, m * (1 - k) + k);
1027
+ const b = 1 - Math.min(1, y * (1 - k) + k);
1028
+ return [r * 255, g * 255, b * 255];
1029
+ };
1030
+ convert.xyz.rgb = function(xyz) {
1031
+ const x = xyz[0] / 100;
1032
+ const y = xyz[1] / 100;
1033
+ const z = xyz[2] / 100;
1034
+ let r;
1035
+ let g;
1036
+ let b;
1037
+ r = x * 3.2406 + y * -1.5372 + z * -0.4986;
1038
+ g = x * -0.9689 + y * 1.8758 + z * 0.0415;
1039
+ b = x * 0.0557 + y * -0.204 + z * 1.057;
1040
+ r = r > 31308e-7 ? 1.055 * r ** (1 / 2.4) - 0.055 : r * 12.92;
1041
+ g = g > 31308e-7 ? 1.055 * g ** (1 / 2.4) - 0.055 : g * 12.92;
1042
+ b = b > 31308e-7 ? 1.055 * b ** (1 / 2.4) - 0.055 : b * 12.92;
1043
+ r = Math.min(Math.max(0, r), 1);
1044
+ g = Math.min(Math.max(0, g), 1);
1045
+ b = Math.min(Math.max(0, b), 1);
1046
+ return [r * 255, g * 255, b * 255];
1047
+ };
1048
+ convert.xyz.lab = function(xyz) {
1049
+ let x = xyz[0];
1050
+ let y = xyz[1];
1051
+ let z = xyz[2];
1052
+ x /= 95.047;
1053
+ y /= 100;
1054
+ z /= 108.883;
1055
+ x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
1056
+ y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
1057
+ z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
1058
+ const l = 116 * y - 16;
1059
+ const a = 500 * (x - y);
1060
+ const b = 200 * (y - z);
1061
+ return [l, a, b];
1062
+ };
1063
+ convert.lab.xyz = function(lab) {
1064
+ const l = lab[0];
1065
+ const a = lab[1];
1066
+ const b = lab[2];
1067
+ let x;
1068
+ let y;
1069
+ let z;
1070
+ y = (l + 16) / 116;
1071
+ x = a / 500 + y;
1072
+ z = y - b / 200;
1073
+ const y2 = y ** 3;
1074
+ const x2 = x ** 3;
1075
+ const z2 = z ** 3;
1076
+ y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
1077
+ x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
1078
+ z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
1079
+ x *= 95.047;
1080
+ y *= 100;
1081
+ z *= 108.883;
1082
+ return [x, y, z];
1083
+ };
1084
+ convert.lab.lch = function(lab) {
1085
+ const l = lab[0];
1086
+ const a = lab[1];
1087
+ const b = lab[2];
1088
+ let h;
1089
+ const hr = Math.atan2(b, a);
1090
+ h = hr * 360 / 2 / Math.PI;
1091
+ if (h < 0) {
1092
+ h += 360;
1093
+ }
1094
+ const c = Math.sqrt(a * a + b * b);
1095
+ return [l, c, h];
1096
+ };
1097
+ convert.lch.lab = function(lch) {
1098
+ const l = lch[0];
1099
+ const c = lch[1];
1100
+ const h = lch[2];
1101
+ const hr = h / 360 * 2 * Math.PI;
1102
+ const a = c * Math.cos(hr);
1103
+ const b = c * Math.sin(hr);
1104
+ return [l, a, b];
1105
+ };
1106
+ convert.rgb.ansi16 = function(args, saturation = null) {
1107
+ const [r, g, b] = args;
1108
+ let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
1109
+ value = Math.round(value / 50);
1110
+ if (value === 0) {
1111
+ return 30;
1112
+ }
1113
+ let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
1114
+ if (value === 2) {
1115
+ ansi += 60;
1116
+ }
1117
+ return ansi;
1118
+ };
1119
+ convert.hsv.ansi16 = function(args) {
1120
+ return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
1121
+ };
1122
+ convert.rgb.ansi256 = function(args) {
1123
+ const r = args[0];
1124
+ const g = args[1];
1125
+ const b = args[2];
1126
+ if (r === g && g === b) {
1127
+ if (r < 8) {
1128
+ return 16;
1129
+ }
1130
+ if (r > 248) {
1131
+ return 231;
1132
+ }
1133
+ return Math.round((r - 8) / 247 * 24) + 232;
1134
+ }
1135
+ const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
1136
+ return ansi;
1137
+ };
1138
+ convert.ansi16.rgb = function(args) {
1139
+ let color = args % 10;
1140
+ if (color === 0 || color === 7) {
1141
+ if (args > 50) {
1142
+ color += 3.5;
1143
+ }
1144
+ color = color / 10.5 * 255;
1145
+ return [color, color, color];
1146
+ }
1147
+ const mult = (~~(args > 50) + 1) * 0.5;
1148
+ const r = (color & 1) * mult * 255;
1149
+ const g = (color >> 1 & 1) * mult * 255;
1150
+ const b = (color >> 2 & 1) * mult * 255;
1151
+ return [r, g, b];
1152
+ };
1153
+ convert.ansi256.rgb = function(args) {
1154
+ if (args >= 232) {
1155
+ const c = (args - 232) * 10 + 8;
1156
+ return [c, c, c];
1157
+ }
1158
+ args -= 16;
1159
+ let rem;
1160
+ const r = Math.floor(args / 36) / 5 * 255;
1161
+ const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
1162
+ const b = rem % 6 / 5 * 255;
1163
+ return [r, g, b];
1164
+ };
1165
+ convert.rgb.hex = function(args) {
1166
+ const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
1167
+ const string = integer.toString(16).toUpperCase();
1168
+ return "000000".substring(string.length) + string;
1169
+ };
1170
+ convert.hex.rgb = function(args) {
1171
+ const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
1172
+ if (!match) {
1173
+ return [0, 0, 0];
1174
+ }
1175
+ let colorString = match[0];
1176
+ if (match[0].length === 3) {
1177
+ colorString = colorString.split("").map((char) => {
1178
+ return char + char;
1179
+ }).join("");
1180
+ }
1181
+ const integer = parseInt(colorString, 16);
1182
+ const r = integer >> 16 & 255;
1183
+ const g = integer >> 8 & 255;
1184
+ const b = integer & 255;
1185
+ return [r, g, b];
1186
+ };
1187
+ convert.rgb.hcg = function(rgb) {
1188
+ const r = rgb[0] / 255;
1189
+ const g = rgb[1] / 255;
1190
+ const b = rgb[2] / 255;
1191
+ const max = Math.max(Math.max(r, g), b);
1192
+ const min = Math.min(Math.min(r, g), b);
1193
+ const chroma = max - min;
1194
+ let grayscale;
1195
+ let hue;
1196
+ if (chroma < 1) {
1197
+ grayscale = min / (1 - chroma);
1198
+ } else {
1199
+ grayscale = 0;
1200
+ }
1201
+ if (chroma <= 0) {
1202
+ hue = 0;
1203
+ } else if (max === r) {
1204
+ hue = (g - b) / chroma % 6;
1205
+ } else if (max === g) {
1206
+ hue = 2 + (b - r) / chroma;
1207
+ } else {
1208
+ hue = 4 + (r - g) / chroma;
1209
+ }
1210
+ hue /= 6;
1211
+ hue %= 1;
1212
+ return [hue * 360, chroma * 100, grayscale * 100];
1213
+ };
1214
+ convert.hsl.hcg = function(hsl) {
1215
+ const s = hsl[1] / 100;
1216
+ const l = hsl[2] / 100;
1217
+ const c = l < 0.5 ? 2 * s * l : 2 * s * (1 - l);
1218
+ let f = 0;
1219
+ if (c < 1) {
1220
+ f = (l - 0.5 * c) / (1 - c);
1221
+ }
1222
+ return [hsl[0], c * 100, f * 100];
1223
+ };
1224
+ convert.hsv.hcg = function(hsv) {
1225
+ const s = hsv[1] / 100;
1226
+ const v = hsv[2] / 100;
1227
+ const c = s * v;
1228
+ let f = 0;
1229
+ if (c < 1) {
1230
+ f = (v - c) / (1 - c);
1231
+ }
1232
+ return [hsv[0], c * 100, f * 100];
1233
+ };
1234
+ convert.hcg.rgb = function(hcg) {
1235
+ const h = hcg[0] / 360;
1236
+ const c = hcg[1] / 100;
1237
+ const g = hcg[2] / 100;
1238
+ if (c === 0) {
1239
+ return [g * 255, g * 255, g * 255];
1240
+ }
1241
+ const pure = [0, 0, 0];
1242
+ const hi = h % 1 * 6;
1243
+ const v = hi % 1;
1244
+ const w = 1 - v;
1245
+ let mg = 0;
1246
+ switch (Math.floor(hi)) {
1247
+ case 0:
1248
+ pure[0] = 1;
1249
+ pure[1] = v;
1250
+ pure[2] = 0;
1251
+ break;
1252
+ case 1:
1253
+ pure[0] = w;
1254
+ pure[1] = 1;
1255
+ pure[2] = 0;
1256
+ break;
1257
+ case 2:
1258
+ pure[0] = 0;
1259
+ pure[1] = 1;
1260
+ pure[2] = v;
1261
+ break;
1262
+ case 3:
1263
+ pure[0] = 0;
1264
+ pure[1] = w;
1265
+ pure[2] = 1;
1266
+ break;
1267
+ case 4:
1268
+ pure[0] = v;
1269
+ pure[1] = 0;
1270
+ pure[2] = 1;
1271
+ break;
1272
+ default:
1273
+ pure[0] = 1;
1274
+ pure[1] = 0;
1275
+ pure[2] = w;
1276
+ }
1277
+ mg = (1 - c) * g;
1278
+ return [
1279
+ (c * pure[0] + mg) * 255,
1280
+ (c * pure[1] + mg) * 255,
1281
+ (c * pure[2] + mg) * 255
1282
+ ];
1283
+ };
1284
+ convert.hcg.hsv = function(hcg) {
1285
+ const c = hcg[1] / 100;
1286
+ const g = hcg[2] / 100;
1287
+ const v = c + g * (1 - c);
1288
+ let f = 0;
1289
+ if (v > 0) {
1290
+ f = c / v;
1291
+ }
1292
+ return [hcg[0], f * 100, v * 100];
1293
+ };
1294
+ convert.hcg.hsl = function(hcg) {
1295
+ const c = hcg[1] / 100;
1296
+ const g = hcg[2] / 100;
1297
+ const l = g * (1 - c) + 0.5 * c;
1298
+ let s = 0;
1299
+ if (l > 0 && l < 0.5) {
1300
+ s = c / (2 * l);
1301
+ } else if (l >= 0.5 && l < 1) {
1302
+ s = c / (2 * (1 - l));
1303
+ }
1304
+ return [hcg[0], s * 100, l * 100];
1305
+ };
1306
+ convert.hcg.hwb = function(hcg) {
1307
+ const c = hcg[1] / 100;
1308
+ const g = hcg[2] / 100;
1309
+ const v = c + g * (1 - c);
1310
+ return [hcg[0], (v - c) * 100, (1 - v) * 100];
1311
+ };
1312
+ convert.hwb.hcg = function(hwb) {
1313
+ const w = hwb[1] / 100;
1314
+ const b = hwb[2] / 100;
1315
+ const v = 1 - b;
1316
+ const c = v - w;
1317
+ let g = 0;
1318
+ if (c < 1) {
1319
+ g = (v - c) / (1 - c);
1320
+ }
1321
+ return [hwb[0], c * 100, g * 100];
1322
+ };
1323
+ convert.apple.rgb = function(apple) {
1324
+ return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
1325
+ };
1326
+ convert.rgb.apple = function(rgb) {
1327
+ return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
1328
+ };
1329
+ convert.gray.rgb = function(args) {
1330
+ return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
1331
+ };
1332
+ convert.gray.hsl = function(args) {
1333
+ return [0, 0, args[0]];
1334
+ };
1335
+ convert.gray.hsv = convert.gray.hsl;
1336
+ convert.gray.hwb = function(gray) {
1337
+ return [0, 100, gray[0]];
1338
+ };
1339
+ convert.gray.cmyk = function(gray) {
1340
+ return [0, 0, 0, gray[0]];
1341
+ };
1342
+ convert.gray.lab = function(gray) {
1343
+ return [gray[0], 0, 0];
1344
+ };
1345
+ convert.gray.hex = function(gray) {
1346
+ const val = Math.round(gray[0] / 100 * 255) & 255;
1347
+ const integer = (val << 16) + (val << 8) + val;
1348
+ const string = integer.toString(16).toUpperCase();
1349
+ return "000000".substring(string.length) + string;
1350
+ };
1351
+ convert.rgb.gray = function(rgb) {
1352
+ const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
1353
+ return [val / 255 * 100];
1354
+ };
1355
+ }
1356
+ });
1357
+
1358
+ // ../../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js
1359
+ var require_route = __commonJS({
1360
+ "../../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js"(exports2, module2) {
1361
+ "use strict";
1362
+ var conversions = require_conversions();
1363
+ function buildGraph() {
1364
+ const graph = {};
1365
+ const models = Object.keys(conversions);
1366
+ for (let len = models.length, i = 0; i < len; i++) {
1367
+ graph[models[i]] = {
1368
+ // http://jsperf.com/1-vs-infinity
1369
+ // micro-opt, but this is simple.
1370
+ distance: -1,
1371
+ parent: null
1372
+ };
1373
+ }
1374
+ return graph;
1375
+ }
1376
+ function deriveBFS(fromModel) {
1377
+ const graph = buildGraph();
1378
+ const queue = [fromModel];
1379
+ graph[fromModel].distance = 0;
1380
+ while (queue.length) {
1381
+ const current = queue.pop();
1382
+ const adjacents = Object.keys(conversions[current]);
1383
+ for (let len = adjacents.length, i = 0; i < len; i++) {
1384
+ const adjacent = adjacents[i];
1385
+ const node = graph[adjacent];
1386
+ if (node.distance === -1) {
1387
+ node.distance = graph[current].distance + 1;
1388
+ node.parent = current;
1389
+ queue.unshift(adjacent);
1390
+ }
1391
+ }
1392
+ }
1393
+ return graph;
1394
+ }
1395
+ function link(from, to) {
1396
+ return function(args) {
1397
+ return to(from(args));
1398
+ };
1399
+ }
1400
+ function wrapConversion(toModel, graph) {
1401
+ const path = [graph[toModel].parent, toModel];
1402
+ let fn = conversions[graph[toModel].parent][toModel];
1403
+ let cur = graph[toModel].parent;
1404
+ while (graph[cur].parent) {
1405
+ path.unshift(graph[cur].parent);
1406
+ fn = link(conversions[graph[cur].parent][cur], fn);
1407
+ cur = graph[cur].parent;
1408
+ }
1409
+ fn.conversion = path;
1410
+ return fn;
1411
+ }
1412
+ module2.exports = function(fromModel) {
1413
+ const graph = deriveBFS(fromModel);
1414
+ const conversion = {};
1415
+ const models = Object.keys(graph);
1416
+ for (let len = models.length, i = 0; i < len; i++) {
1417
+ const toModel = models[i];
1418
+ const node = graph[toModel];
1419
+ if (node.parent === null) {
1420
+ continue;
1421
+ }
1422
+ conversion[toModel] = wrapConversion(toModel, graph);
1423
+ }
1424
+ return conversion;
1425
+ };
1426
+ }
1427
+ });
1428
+
1429
+ // ../../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js
1430
+ var require_color_convert = __commonJS({
1431
+ "../../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js"(exports2, module2) {
1432
+ "use strict";
1433
+ var conversions = require_conversions();
1434
+ var route = require_route();
1435
+ var convert = {};
1436
+ var models = Object.keys(conversions);
1437
+ function wrapRaw(fn) {
1438
+ const wrappedFn = function(...args) {
1439
+ const arg0 = args[0];
1440
+ if (arg0 === void 0 || arg0 === null) {
1441
+ return arg0;
1442
+ }
1443
+ if (arg0.length > 1) {
1444
+ args = arg0;
1445
+ }
1446
+ return fn(args);
1447
+ };
1448
+ if ("conversion" in fn) {
1449
+ wrappedFn.conversion = fn.conversion;
1450
+ }
1451
+ return wrappedFn;
1452
+ }
1453
+ function wrapRounded(fn) {
1454
+ const wrappedFn = function(...args) {
1455
+ const arg0 = args[0];
1456
+ if (arg0 === void 0 || arg0 === null) {
1457
+ return arg0;
1458
+ }
1459
+ if (arg0.length > 1) {
1460
+ args = arg0;
1461
+ }
1462
+ const result = fn(args);
1463
+ if (typeof result === "object") {
1464
+ for (let len = result.length, i = 0; i < len; i++) {
1465
+ result[i] = Math.round(result[i]);
1466
+ }
1467
+ }
1468
+ return result;
1469
+ };
1470
+ if ("conversion" in fn) {
1471
+ wrappedFn.conversion = fn.conversion;
1472
+ }
1473
+ return wrappedFn;
1474
+ }
1475
+ models.forEach((fromModel) => {
1476
+ convert[fromModel] = {};
1477
+ Object.defineProperty(convert[fromModel], "channels", { value: conversions[fromModel].channels });
1478
+ Object.defineProperty(convert[fromModel], "labels", { value: conversions[fromModel].labels });
1479
+ const routes = route(fromModel);
1480
+ const routeModels = Object.keys(routes);
1481
+ routeModels.forEach((toModel) => {
1482
+ const fn = routes[toModel];
1483
+ convert[fromModel][toModel] = wrapRounded(fn);
1484
+ convert[fromModel][toModel].raw = wrapRaw(fn);
1485
+ });
1486
+ });
1487
+ module2.exports = convert;
1488
+ }
1489
+ });
1490
+
1491
+ // ../../../node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js
1492
+ var require_ansi_styles = __commonJS({
1493
+ "../../../node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js"(exports2, module2) {
1494
+ "use strict";
1495
+ var wrapAnsi16 = (fn, offset) => (...args) => {
1496
+ const code = fn(...args);
1497
+ return `\x1B[${code + offset}m`;
1498
+ };
1499
+ var wrapAnsi256 = (fn, offset) => (...args) => {
1500
+ const code = fn(...args);
1501
+ return `\x1B[${38 + offset};5;${code}m`;
1502
+ };
1503
+ var wrapAnsi16m = (fn, offset) => (...args) => {
1504
+ const rgb = fn(...args);
1505
+ return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
1506
+ };
1507
+ var ansi2ansi = (n) => n;
1508
+ var rgb2rgb = (r, g, b) => [r, g, b];
1509
+ var setLazyProperty = (object, property, get) => {
1510
+ Object.defineProperty(object, property, {
1511
+ get: () => {
1512
+ const value = get();
1513
+ Object.defineProperty(object, property, {
1514
+ value,
1515
+ enumerable: true,
1516
+ configurable: true
1517
+ });
1518
+ return value;
1519
+ },
1520
+ enumerable: true,
1521
+ configurable: true
1522
+ });
1523
+ };
1524
+ var colorConvert;
1525
+ var makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
1526
+ if (colorConvert === void 0) {
1527
+ colorConvert = require_color_convert();
1528
+ }
1529
+ const offset = isBackground ? 10 : 0;
1530
+ const styles = {};
1531
+ for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
1532
+ const name = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
1533
+ if (sourceSpace === targetSpace) {
1534
+ styles[name] = wrap(identity, offset);
1535
+ } else if (typeof suite === "object") {
1536
+ styles[name] = wrap(suite[targetSpace], offset);
1537
+ }
1538
+ }
1539
+ return styles;
1540
+ };
1541
+ function assembleStyles() {
1542
+ const codes = /* @__PURE__ */ new Map();
1543
+ const styles = {
1544
+ modifier: {
1545
+ reset: [0, 0],
1546
+ // 21 isn't widely supported and 22 does the same thing
1547
+ bold: [1, 22],
1548
+ dim: [2, 22],
1549
+ italic: [3, 23],
1550
+ underline: [4, 24],
1551
+ inverse: [7, 27],
1552
+ hidden: [8, 28],
1553
+ strikethrough: [9, 29]
1554
+ },
1555
+ color: {
1556
+ black: [30, 39],
1557
+ red: [31, 39],
1558
+ green: [32, 39],
1559
+ yellow: [33, 39],
1560
+ blue: [34, 39],
1561
+ magenta: [35, 39],
1562
+ cyan: [36, 39],
1563
+ white: [37, 39],
1564
+ // Bright color
1565
+ blackBright: [90, 39],
1566
+ redBright: [91, 39],
1567
+ greenBright: [92, 39],
1568
+ yellowBright: [93, 39],
1569
+ blueBright: [94, 39],
1570
+ magentaBright: [95, 39],
1571
+ cyanBright: [96, 39],
1572
+ whiteBright: [97, 39]
1573
+ },
1574
+ bgColor: {
1575
+ bgBlack: [40, 49],
1576
+ bgRed: [41, 49],
1577
+ bgGreen: [42, 49],
1578
+ bgYellow: [43, 49],
1579
+ bgBlue: [44, 49],
1580
+ bgMagenta: [45, 49],
1581
+ bgCyan: [46, 49],
1582
+ bgWhite: [47, 49],
1583
+ // Bright color
1584
+ bgBlackBright: [100, 49],
1585
+ bgRedBright: [101, 49],
1586
+ bgGreenBright: [102, 49],
1587
+ bgYellowBright: [103, 49],
1588
+ bgBlueBright: [104, 49],
1589
+ bgMagentaBright: [105, 49],
1590
+ bgCyanBright: [106, 49],
1591
+ bgWhiteBright: [107, 49]
1592
+ }
1593
+ };
1594
+ styles.color.gray = styles.color.blackBright;
1595
+ styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
1596
+ styles.color.grey = styles.color.blackBright;
1597
+ styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
1598
+ for (const [groupName, group] of Object.entries(styles)) {
1599
+ for (const [styleName, style] of Object.entries(group)) {
1600
+ styles[styleName] = {
1601
+ open: `\x1B[${style[0]}m`,
1602
+ close: `\x1B[${style[1]}m`
1603
+ };
1604
+ group[styleName] = styles[styleName];
1605
+ codes.set(style[0], style[1]);
1606
+ }
1607
+ Object.defineProperty(styles, groupName, {
1608
+ value: group,
1609
+ enumerable: false
1610
+ });
1611
+ }
1612
+ Object.defineProperty(styles, "codes", {
1613
+ value: codes,
1614
+ enumerable: false
1615
+ });
1616
+ styles.color.close = "\x1B[39m";
1617
+ styles.bgColor.close = "\x1B[49m";
1618
+ setLazyProperty(styles.color, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, false));
1619
+ setLazyProperty(styles.color, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, false));
1620
+ setLazyProperty(styles.color, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, false));
1621
+ setLazyProperty(styles.bgColor, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, true));
1622
+ setLazyProperty(styles.bgColor, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, true));
1623
+ setLazyProperty(styles.bgColor, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, true));
1624
+ return styles;
1625
+ }
1626
+ Object.defineProperty(module2, "exports", {
1627
+ enumerable: true,
1628
+ get: assembleStyles
1629
+ });
1630
+ }
1631
+ });
1632
+
1633
+ // ../../../node_modules/.pnpm/slice-ansi@3.0.0/node_modules/slice-ansi/index.js
1634
+ var require_slice_ansi = __commonJS({
1635
+ "../../../node_modules/.pnpm/slice-ansi@3.0.0/node_modules/slice-ansi/index.js"(exports2, module2) {
1636
+ "use strict";
1637
+ var isFullwidthCodePoint = require_is_fullwidth_code_point();
1638
+ var astralRegex = require_astral_regex();
1639
+ var ansiStyles = require_ansi_styles();
1640
+ var ESCAPES = [
1641
+ "\x1B",
1642
+ "›"
1643
+ ];
1644
+ var wrapAnsi = (code) => `${ESCAPES[0]}[${code}m`;
1645
+ var checkAnsi = (ansiCodes, isEscapes, endAnsiCode) => {
1646
+ let output = [];
1647
+ ansiCodes = [...ansiCodes];
1648
+ for (let ansiCode of ansiCodes) {
1649
+ const ansiCodeOrigin = ansiCode;
1650
+ if (ansiCode.match(";")) {
1651
+ ansiCode = ansiCode.split(";")[0][0] + "0";
1652
+ }
1653
+ const item = ansiStyles.codes.get(parseInt(ansiCode, 10));
1654
+ if (item) {
1655
+ const indexEscape = ansiCodes.indexOf(item.toString());
1656
+ if (indexEscape >= 0) {
1657
+ ansiCodes.splice(indexEscape, 1);
1658
+ } else {
1659
+ output.push(wrapAnsi(isEscapes ? item : ansiCodeOrigin));
1660
+ }
1661
+ } else if (isEscapes) {
1662
+ output.push(wrapAnsi(0));
1663
+ break;
1664
+ } else {
1665
+ output.push(wrapAnsi(ansiCodeOrigin));
1666
+ }
1667
+ }
1668
+ if (isEscapes) {
1669
+ output = output.filter((element, index) => output.indexOf(element) === index);
1670
+ if (endAnsiCode !== void 0) {
1671
+ const fistEscapeCode = wrapAnsi(ansiStyles.codes.get(parseInt(endAnsiCode, 10)));
1672
+ output = output.reduce((current, next) => next === fistEscapeCode ? [next, ...current] : [...current, next], []);
1673
+ }
1674
+ }
1675
+ return output.join("");
1676
+ };
1677
+ module2.exports = (string, begin, end) => {
1678
+ const characters = [...string.normalize()];
1679
+ const ansiCodes = [];
1680
+ end = typeof end === "number" ? end : characters.length;
1681
+ let isInsideEscape = false;
1682
+ let ansiCode;
1683
+ let visible = 0;
1684
+ let output = "";
1685
+ for (const [index, character] of characters.entries()) {
1686
+ let leftEscape = false;
1687
+ if (ESCAPES.includes(character)) {
1688
+ const code = /\d[^m]*/.exec(string.slice(index, index + 18));
1689
+ ansiCode = code && code.length > 0 ? code[0] : void 0;
1690
+ if (visible < end) {
1691
+ isInsideEscape = true;
1692
+ if (ansiCode !== void 0) {
1693
+ ansiCodes.push(ansiCode);
1694
+ }
1695
+ }
1696
+ } else if (isInsideEscape && character === "m") {
1697
+ isInsideEscape = false;
1698
+ leftEscape = true;
1699
+ }
1700
+ if (!isInsideEscape && !leftEscape) {
1701
+ ++visible;
1702
+ }
1703
+ if (!astralRegex({ exact: true }).test(character) && isFullwidthCodePoint(character.codePointAt())) {
1704
+ ++visible;
1705
+ }
1706
+ if (visible > begin && visible <= end) {
1707
+ output += character;
1708
+ } else if (visible === begin && !isInsideEscape && ansiCode !== void 0) {
1709
+ output = checkAnsi(ansiCodes);
1710
+ } else if (visible >= end) {
1711
+ output += checkAnsi(ansiCodes, true, ansiCode);
1712
+ break;
1713
+ }
1714
+ }
1715
+ return output;
1716
+ };
1717
+ }
1718
+ });
1719
+
1720
+ // ../../../node_modules/.pnpm/ansi-regex@5.0.1/node_modules/ansi-regex/index.js
1721
+ var require_ansi_regex = __commonJS({
1722
+ "../../../node_modules/.pnpm/ansi-regex@5.0.1/node_modules/ansi-regex/index.js"(exports2, module2) {
1723
+ "use strict";
1724
+ module2.exports = ({ onlyFirst = false } = {}) => {
1725
+ const pattern = [
1726
+ "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
1727
+ "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
1728
+ ].join("|");
1729
+ return new RegExp(pattern, onlyFirst ? void 0 : "g");
1730
+ };
1731
+ }
1732
+ });
1733
+
1734
+ // ../../../node_modules/.pnpm/strip-ansi@6.0.1/node_modules/strip-ansi/index.js
1735
+ var require_strip_ansi = __commonJS({
1736
+ "../../../node_modules/.pnpm/strip-ansi@6.0.1/node_modules/strip-ansi/index.js"(exports2, module2) {
1737
+ "use strict";
1738
+ var ansiRegex = require_ansi_regex();
1739
+ module2.exports = (string) => typeof string === "string" ? string.replace(ansiRegex(), "") : string;
1740
+ }
1741
+ });
1742
+
1743
+ // ../../../node_modules/.pnpm/emoji-regex@8.0.0/node_modules/emoji-regex/index.js
1744
+ var require_emoji_regex = __commonJS({
1745
+ "../../../node_modules/.pnpm/emoji-regex@8.0.0/node_modules/emoji-regex/index.js"(exports2, module2) {
1746
+ "use strict";
1747
+ module2.exports = function() {
1748
+ return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
1749
+ };
1750
+ }
1751
+ });
1752
+
1753
+ // ../../../node_modules/.pnpm/string-width@4.2.3/node_modules/string-width/index.js
1754
+ var require_string_width = __commonJS({
1755
+ "../../../node_modules/.pnpm/string-width@4.2.3/node_modules/string-width/index.js"(exports2, module2) {
1756
+ "use strict";
1757
+ var stripAnsi = require_strip_ansi();
1758
+ var isFullwidthCodePoint = require_is_fullwidth_code_point();
1759
+ var emojiRegex = require_emoji_regex();
1760
+ var stringWidth = (string) => {
1761
+ if (typeof string !== "string" || string.length === 0) {
1762
+ return 0;
1763
+ }
1764
+ string = stripAnsi(string);
1765
+ if (string.length === 0) {
1766
+ return 0;
1767
+ }
1768
+ string = string.replace(emojiRegex(), " ");
1769
+ let width = 0;
1770
+ for (let i = 0; i < string.length; i++) {
1771
+ const code = string.codePointAt(i);
1772
+ if (code <= 31 || code >= 127 && code <= 159) {
1773
+ continue;
1774
+ }
1775
+ if (code >= 768 && code <= 879) {
1776
+ continue;
1777
+ }
1778
+ if (code > 65535) {
1779
+ i++;
1780
+ }
1781
+ width += isFullwidthCodePoint(code) ? 2 : 1;
1782
+ }
1783
+ return width;
1784
+ };
1785
+ module2.exports = stringWidth;
1786
+ module2.exports.default = stringWidth;
1787
+ }
1788
+ });
1789
+
1790
+ // ../../../node_modules/.pnpm/cli-truncate@2.1.0/node_modules/cli-truncate/index.js
1791
+ var require_cli_truncate = __commonJS({
1792
+ "../../../node_modules/.pnpm/cli-truncate@2.1.0/node_modules/cli-truncate/index.js"(exports2, module2) {
1793
+ "use strict";
1794
+ var sliceAnsi = require_slice_ansi();
1795
+ var stringWidth = require_string_width();
1796
+ function getIndexOfNearestSpace(string, index, shouldSearchRight) {
1797
+ if (string.charAt(index) === " ") {
1798
+ return index;
1799
+ }
1800
+ for (let i = 1; i <= 3; i++) {
1801
+ if (shouldSearchRight) {
1802
+ if (string.charAt(index + i) === " ") {
1803
+ return index + i;
1804
+ }
1805
+ } else if (string.charAt(index - i) === " ") {
1806
+ return index - i;
1807
+ }
1808
+ }
1809
+ return index;
1810
+ }
1811
+ module2.exports = (text, columns, options) => {
1812
+ options = {
1813
+ position: "end",
1814
+ preferTruncationOnSpace: false,
1815
+ ...options
1816
+ };
1817
+ const { position, space, preferTruncationOnSpace } = options;
1818
+ let ellipsis = "…";
1819
+ let ellipsisWidth = 1;
1820
+ if (typeof text !== "string") {
1821
+ throw new TypeError(`Expected \`input\` to be a string, got ${typeof text}`);
1822
+ }
1823
+ if (typeof columns !== "number") {
1824
+ throw new TypeError(`Expected \`columns\` to be a number, got ${typeof columns}`);
1825
+ }
1826
+ if (columns < 1) {
1827
+ return "";
1828
+ }
1829
+ if (columns === 1) {
1830
+ return ellipsis;
1831
+ }
1832
+ const length = stringWidth(text);
1833
+ if (length <= columns) {
1834
+ return text;
1835
+ }
1836
+ if (position === "start") {
1837
+ if (preferTruncationOnSpace) {
1838
+ const nearestSpace = getIndexOfNearestSpace(text, length - columns + 1, true);
1839
+ return ellipsis + sliceAnsi(text, nearestSpace, length).trim();
1840
+ }
1841
+ if (space === true) {
1842
+ ellipsis += " ";
1843
+ ellipsisWidth = 2;
1844
+ }
1845
+ return ellipsis + sliceAnsi(text, length - columns + ellipsisWidth, length);
1846
+ }
1847
+ if (position === "middle") {
1848
+ if (space === true) {
1849
+ ellipsis = " " + ellipsis + " ";
1850
+ ellipsisWidth = 3;
1851
+ }
1852
+ const half = Math.floor(columns / 2);
1853
+ if (preferTruncationOnSpace) {
1854
+ const spaceNearFirstBreakPoint = getIndexOfNearestSpace(text, half);
1855
+ const spaceNearSecondBreakPoint = getIndexOfNearestSpace(text, length - (columns - half) + 1, true);
1856
+ return sliceAnsi(text, 0, spaceNearFirstBreakPoint) + ellipsis + sliceAnsi(text, spaceNearSecondBreakPoint, length).trim();
1857
+ }
1858
+ return sliceAnsi(text, 0, half) + ellipsis + sliceAnsi(text, length - (columns - half) + ellipsisWidth, length);
1859
+ }
1860
+ if (position === "end") {
1861
+ if (preferTruncationOnSpace) {
1862
+ const nearestSpace = getIndexOfNearestSpace(text, columns - 1);
1863
+ return sliceAnsi(text, 0, nearestSpace) + ellipsis;
1864
+ }
1865
+ if (space === true) {
1866
+ ellipsis = " " + ellipsis;
1867
+ ellipsisWidth = 2;
1868
+ }
1869
+ return sliceAnsi(text, 0, columns - ellipsisWidth) + ellipsis;
1870
+ }
1871
+ throw new Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${position}`);
1872
+ };
1873
+ }
1874
+ });
1875
+
1876
+ // ../../../node_modules/.pnpm/patch-console@1.0.0/node_modules/patch-console/build/index.js
1877
+ var require_build = __commonJS({
1878
+ "../../../node_modules/.pnpm/patch-console@1.0.0/node_modules/patch-console/build/index.js"(exports2, module2) {
1879
+ "use strict";
1880
+ var stream_1 = require("stream");
1881
+ var CONSOLE_METHODS = [
1882
+ "assert",
1883
+ "count",
1884
+ "countReset",
1885
+ "debug",
1886
+ "dir",
1887
+ "dirxml",
1888
+ "error",
1889
+ "group",
1890
+ "groupCollapsed",
1891
+ "groupEnd",
1892
+ "info",
1893
+ "log",
1894
+ "table",
1895
+ "time",
1896
+ "timeEnd",
1897
+ "timeLog",
1898
+ "trace",
1899
+ "warn"
1900
+ ];
1901
+ var originalMethods = {};
1902
+ var patchConsole2 = (callback) => {
1903
+ const stdout = new stream_1.PassThrough();
1904
+ const stderr = new stream_1.PassThrough();
1905
+ stdout.write = (data) => callback("stdout", data);
1906
+ stderr.write = (data) => callback("stderr", data);
1907
+ const internalConsole = new console.Console(stdout, stderr);
1908
+ for (const method of CONSOLE_METHODS) {
1909
+ originalMethods[method] = console[method];
1910
+ console[method] = internalConsole[method];
1911
+ }
1912
+ return () => {
1913
+ for (const method of CONSOLE_METHODS) {
1914
+ console[method] = originalMethods[method];
1915
+ }
1916
+ originalMethods = {};
1917
+ };
1918
+ };
1919
+ module2.exports = patchConsole2;
1920
+ }
1921
+ });
1922
+
1923
+ // src/progress/helpers/utils.ts
1924
+ var clamp;
1925
+ var init_utils = __esm({
1926
+ "src/progress/helpers/utils.ts"() {
1927
+ "use strict";
1928
+ clamp = (x, min, max) => {
1929
+ return Math.min(max, Math.max(min, x));
1930
+ };
1931
+ }
1932
+ });
1933
+
1934
+ // src/progress/helpers/bar.ts
1935
+ var import_shared8, import_cli_truncate, defaultOption, padding, FULL_WIDTH, MIDDLE_WIDTH, renderBar;
1936
+ var init_bar = __esm({
1937
+ "src/progress/helpers/bar.ts"() {
1938
+ "use strict";
1939
+ import_shared8 = require("@rsbuild/shared");
1940
+ import_cli_truncate = __toESM(require_cli_truncate());
1941
+ init_utils();
1942
+ defaultOption = {
1943
+ total: 100,
1944
+ current: 0,
1945
+ color: "green",
1946
+ bgColor: "gray",
1947
+ char: "━",
1948
+ width: 25,
1949
+ buildIcon: "◯",
1950
+ errorIcon: "✖",
1951
+ errorInfo: "compile failed",
1952
+ message: "",
1953
+ done: false,
1954
+ spaceWidth: 1,
1955
+ messageWidth: 25,
1956
+ messageColor: "gray",
1957
+ id: "",
1958
+ maxIdLen: 16,
1959
+ hasErrors: false
1960
+ };
1961
+ padding = (id, maxLen) => {
1962
+ const left = Math.floor((maxLen - id.length) / 2);
1963
+ const right = maxLen - left - id.length;
1964
+ return " ".repeat(left) + id + " ".repeat(right);
1965
+ };
1966
+ FULL_WIDTH = 70;
1967
+ MIDDLE_WIDTH = 40;
1968
+ renderBar = (option) => {
1969
+ const mergedOptions = {
1970
+ ...defaultOption,
1971
+ ...option
1972
+ };
1973
+ const {
1974
+ total,
1975
+ done,
1976
+ buildIcon,
1977
+ errorIcon,
1978
+ errorInfo,
1979
+ width,
1980
+ current,
1981
+ color,
1982
+ bgColor,
1983
+ char,
1984
+ message,
1985
+ messageWidth,
1986
+ spaceWidth,
1987
+ messageColor,
1988
+ maxIdLen,
1989
+ hasErrors
1990
+ } = mergedOptions;
1991
+ const space = " ".repeat(spaceWidth);
1992
+ const percent = clamp(Math.floor(current / total * 100), 0, 100);
1993
+ const barColor = import_shared8.color[color];
1994
+ const backgroundColor = import_shared8.color[bgColor];
1995
+ const doneColor = hasErrors ? import_shared8.color.red : barColor;
1996
+ const idColor = done ? doneColor : barColor;
1997
+ const id = mergedOptions.id ? idColor(padding(mergedOptions.id, maxIdLen)) : "";
1998
+ const { columns: terminalWidth = FULL_WIDTH } = process.stdout;
1999
+ if (done) {
2000
+ if (hasErrors) {
2001
+ const message2 = import_shared8.color.bold(doneColor(errorInfo));
2002
+ if (terminalWidth >= MIDDLE_WIDTH) {
2003
+ return [idColor(errorIcon), id, doneColor(`${space}${message2}`)].join(
2004
+ ""
2005
+ );
2006
+ }
2007
+ return [id, doneColor(`${message2}`)].join("");
2008
+ }
2009
+ return "";
2010
+ }
2011
+ const msgStr = import_shared8.color[messageColor](
2012
+ (0, import_cli_truncate.default)(message, messageWidth, { position: "start" })
2013
+ );
2014
+ const left = clamp(Math.floor(percent * width / 100), 0, width);
2015
+ const right = clamp(width - left, 0, width);
2016
+ const barStr = `${barColor(char.repeat(left))}${backgroundColor(
2017
+ char.repeat(right)
2018
+ )}`;
2019
+ const percentStr = `${percent.toString().padStart(3)}%`;
2020
+ if (terminalWidth >= FULL_WIDTH) {
2021
+ return [
2022
+ idColor(buildIcon),
2023
+ id,
2024
+ space,
2025
+ barStr,
2026
+ space,
2027
+ percentStr,
2028
+ space,
2029
+ msgStr
2030
+ ].join("");
2031
+ }
2032
+ if (terminalWidth >= MIDDLE_WIDTH) {
2033
+ return [idColor(buildIcon), id, space, barStr, space, percentStr].join("");
2034
+ }
2035
+ return [idColor(buildIcon), id, space, percentStr].join("");
2036
+ };
2037
+ }
2038
+ });
2039
+
2040
+ // ../../../node_modules/.pnpm/ansi-escapes@4.3.2/node_modules/ansi-escapes/index.js
2041
+ var require_ansi_escapes = __commonJS({
2042
+ "../../../node_modules/.pnpm/ansi-escapes@4.3.2/node_modules/ansi-escapes/index.js"(exports2, module2) {
2043
+ "use strict";
2044
+ var ansiEscapes2 = module2.exports;
2045
+ module2.exports.default = ansiEscapes2;
2046
+ var ESC = "\x1B[";
2047
+ var OSC = "\x1B]";
2048
+ var BEL = "\x07";
2049
+ var SEP = ";";
2050
+ var isTerminalApp = process.env.TERM_PROGRAM === "Apple_Terminal";
2051
+ ansiEscapes2.cursorTo = (x, y) => {
2052
+ if (typeof x !== "number") {
2053
+ throw new TypeError("The `x` argument is required");
2054
+ }
2055
+ if (typeof y !== "number") {
2056
+ return ESC + (x + 1) + "G";
2057
+ }
2058
+ return ESC + (y + 1) + ";" + (x + 1) + "H";
2059
+ };
2060
+ ansiEscapes2.cursorMove = (x, y) => {
2061
+ if (typeof x !== "number") {
2062
+ throw new TypeError("The `x` argument is required");
2063
+ }
2064
+ let ret = "";
2065
+ if (x < 0) {
2066
+ ret += ESC + -x + "D";
2067
+ } else if (x > 0) {
2068
+ ret += ESC + x + "C";
2069
+ }
2070
+ if (y < 0) {
2071
+ ret += ESC + -y + "A";
2072
+ } else if (y > 0) {
2073
+ ret += ESC + y + "B";
2074
+ }
2075
+ return ret;
2076
+ };
2077
+ ansiEscapes2.cursorUp = (count = 1) => ESC + count + "A";
2078
+ ansiEscapes2.cursorDown = (count = 1) => ESC + count + "B";
2079
+ ansiEscapes2.cursorForward = (count = 1) => ESC + count + "C";
2080
+ ansiEscapes2.cursorBackward = (count = 1) => ESC + count + "D";
2081
+ ansiEscapes2.cursorLeft = ESC + "G";
2082
+ ansiEscapes2.cursorSavePosition = isTerminalApp ? "\x1B7" : ESC + "s";
2083
+ ansiEscapes2.cursorRestorePosition = isTerminalApp ? "\x1B8" : ESC + "u";
2084
+ ansiEscapes2.cursorGetPosition = ESC + "6n";
2085
+ ansiEscapes2.cursorNextLine = ESC + "E";
2086
+ ansiEscapes2.cursorPrevLine = ESC + "F";
2087
+ ansiEscapes2.cursorHide = ESC + "?25l";
2088
+ ansiEscapes2.cursorShow = ESC + "?25h";
2089
+ ansiEscapes2.eraseLines = (count) => {
2090
+ let clear = "";
2091
+ for (let i = 0; i < count; i++) {
2092
+ clear += ansiEscapes2.eraseLine + (i < count - 1 ? ansiEscapes2.cursorUp() : "");
2093
+ }
2094
+ if (count) {
2095
+ clear += ansiEscapes2.cursorLeft;
2096
+ }
2097
+ return clear;
2098
+ };
2099
+ ansiEscapes2.eraseEndLine = ESC + "K";
2100
+ ansiEscapes2.eraseStartLine = ESC + "1K";
2101
+ ansiEscapes2.eraseLine = ESC + "2K";
2102
+ ansiEscapes2.eraseDown = ESC + "J";
2103
+ ansiEscapes2.eraseUp = ESC + "1J";
2104
+ ansiEscapes2.eraseScreen = ESC + "2J";
2105
+ ansiEscapes2.scrollUp = ESC + "S";
2106
+ ansiEscapes2.scrollDown = ESC + "T";
2107
+ ansiEscapes2.clearScreen = "\x1Bc";
2108
+ ansiEscapes2.clearTerminal = process.platform === "win32" ? `${ansiEscapes2.eraseScreen}${ESC}0f` : (
2109
+ // 1. Erases the screen (Only done in case `2` is not supported)
2110
+ // 2. Erases the whole screen including scrollback buffer
2111
+ // 3. Moves cursor to the top-left position
2112
+ // More info: https://www.real-world-systems.com/docs/ANSIcode.html
2113
+ `${ansiEscapes2.eraseScreen}${ESC}3J${ESC}H`
2114
+ );
2115
+ ansiEscapes2.beep = BEL;
2116
+ ansiEscapes2.link = (text, url) => {
2117
+ return [
2118
+ OSC,
2119
+ "8",
2120
+ SEP,
2121
+ SEP,
2122
+ url,
2123
+ BEL,
2124
+ text,
2125
+ OSC,
2126
+ "8",
2127
+ SEP,
2128
+ SEP,
2129
+ BEL
2130
+ ].join("");
2131
+ };
2132
+ ansiEscapes2.image = (buffer, options = {}) => {
2133
+ let ret = `${OSC}1337;File=inline=1`;
2134
+ if (options.width) {
2135
+ ret += `;width=${options.width}`;
2136
+ }
2137
+ if (options.height) {
2138
+ ret += `;height=${options.height}`;
2139
+ }
2140
+ if (options.preserveAspectRatio === false) {
2141
+ ret += ";preserveAspectRatio=0";
2142
+ }
2143
+ return ret + ":" + buffer.toString("base64") + BEL;
2144
+ };
2145
+ ansiEscapes2.iTerm = {
2146
+ setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
2147
+ annotation: (message, options = {}) => {
2148
+ let ret = `${OSC}1337;`;
2149
+ const hasX = typeof options.x !== "undefined";
2150
+ const hasY = typeof options.y !== "undefined";
2151
+ if ((hasX || hasY) && !(hasX && hasY && typeof options.length !== "undefined")) {
2152
+ throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");
2153
+ }
2154
+ message = message.replace(/\|/g, "");
2155
+ ret += options.isHidden ? "AddHiddenAnnotation=" : "AddAnnotation=";
2156
+ if (options.length > 0) {
2157
+ ret += (hasX ? [message, options.length, options.x, options.y] : [options.length, message]).join("|");
2158
+ } else {
2159
+ ret += message;
2160
+ }
2161
+ return ret + BEL;
2162
+ }
2163
+ };
2164
+ }
2165
+ });
2166
+
2167
+ // src/progress/helpers/log.ts
2168
+ var import_ansi_escapes, create;
2169
+ var init_log = __esm({
2170
+ "src/progress/helpers/log.ts"() {
2171
+ "use strict";
2172
+ import_ansi_escapes = __toESM(require_ansi_escapes());
2173
+ create = (stream) => {
2174
+ let previousLineCount = 0;
2175
+ let previousOutput = "";
2176
+ const render = (str) => {
2177
+ const output = `${str}
2178
+ `;
2179
+ if (output === previousOutput) {
2180
+ return;
2181
+ }
2182
+ previousOutput = output;
2183
+ stream.write(import_ansi_escapes.default.eraseLines(previousLineCount) + output);
2184
+ previousLineCount = output.split("\n").length;
2185
+ };
2186
+ render.clear = () => {
2187
+ stream.write(import_ansi_escapes.default.eraseLines(previousLineCount));
2188
+ previousOutput = "";
2189
+ previousLineCount = 0;
2190
+ };
2191
+ render.done = () => {
2192
+ previousOutput = "";
2193
+ previousLineCount = 0;
2194
+ };
2195
+ return render;
2196
+ };
2197
+ }
2198
+ });
2199
+
2200
+ // src/progress/helpers/bus.ts
2201
+ var import_node_console, import_shared9, import_cli_truncate2, import_patch_console, Bus, bus;
2202
+ var init_bus = __esm({
2203
+ "src/progress/helpers/bus.ts"() {
2204
+ "use strict";
2205
+ import_node_console = require("console");
2206
+ import_shared9 = require("@rsbuild/shared");
2207
+ import_cli_truncate2 = __toESM(require_cli_truncate());
2208
+ import_patch_console = __toESM(require_build());
2209
+ init_bar();
2210
+ init_log();
2211
+ Bus = class {
2212
+ constructor() {
2213
+ __publicField(this, "states", []);
2214
+ __publicField(this, "log");
2215
+ __publicField(this, "restore");
2216
+ __publicField(this, "prevOutput");
2217
+ __publicField(this, "destroyed", false);
2218
+ this.prevOutput = "";
2219
+ this.log = create(process.stdout);
2220
+ console.Console = import_node_console.Console;
2221
+ this.restore = (0, import_patch_console.default)((type, data) => {
2222
+ this.writeToStd(type, data);
2223
+ });
2224
+ }
2225
+ update(state) {
2226
+ const index = this.states.findIndex((i) => i.id === state.id);
2227
+ if (index === -1) {
2228
+ this.states.push(state);
2229
+ return;
2230
+ }
2231
+ this.states[index] = state;
2232
+ }
2233
+ writeToStd(type = "stdout", data) {
2234
+ this.log.clear();
2235
+ if (data) {
2236
+ if (type === "stdout") {
2237
+ process.stdout.write(data);
2238
+ } else if (type === "stderr") {
2239
+ process.stderr.write(data);
2240
+ }
2241
+ }
2242
+ this.log(this.prevOutput);
2243
+ }
2244
+ render() {
2245
+ const maxIdLen = Math.max(...this.states.map((i) => i.id?.length ?? 0)) + 2;
2246
+ const { columns = FULL_WIDTH } = process.stdout;
2247
+ this.prevOutput = this.states.map((i, k) => {
2248
+ const bar = renderBar({
2249
+ maxIdLen,
2250
+ color: i.color ?? (0, import_shared9.getProgressColor)(k),
2251
+ ...i
2252
+ });
2253
+ if (bar) {
2254
+ return (0, import_cli_truncate2.default)(bar, columns, { position: "end" });
2255
+ }
2256
+ return null;
2257
+ }).filter((item) => item !== null).join("\n");
2258
+ this.writeToStd();
2259
+ }
2260
+ destroy() {
2261
+ if (!this.destroyed) {
2262
+ this.restore();
2263
+ }
2264
+ this.destroyed = true;
2265
+ }
2266
+ clear() {
2267
+ this.log.clear();
2268
+ this.log.done();
2269
+ }
2270
+ };
2271
+ bus = new Bus();
2272
+ }
2273
+ });
2274
+
2275
+ // src/progress/helpers/type.ts
2276
+ var init_type = __esm({
2277
+ "src/progress/helpers/type.ts"() {
2278
+ "use strict";
2279
+ }
2280
+ });
2281
+
2282
+ // src/progress/helpers/percentage.ts
2283
+ var createFriendlyPercentage;
2284
+ var init_percentage = __esm({
2285
+ "src/progress/helpers/percentage.ts"() {
2286
+ "use strict";
2287
+ createFriendlyPercentage = () => {
2288
+ let prevPercentage = 0;
2289
+ return (percentage) => {
2290
+ if (percentage === 0 || percentage === 1) {
2291
+ prevPercentage = 0;
2292
+ return percentage;
2293
+ }
2294
+ if (percentage <= prevPercentage) {
2295
+ let step = 0;
2296
+ if (prevPercentage < 0.3) {
2297
+ step = 1e-3;
2298
+ } else if (prevPercentage < 0.6) {
2299
+ step = 2e-3;
2300
+ } else if (prevPercentage < 0.8) {
2301
+ step = 4e-3;
2302
+ } else if (prevPercentage < 0.99) {
2303
+ step = 2e-3;
2304
+ }
2305
+ prevPercentage += step;
2306
+ return prevPercentage;
2307
+ }
2308
+ prevPercentage = percentage;
2309
+ return percentage;
2310
+ };
2311
+ };
2312
+ }
2313
+ });
2314
+
2315
+ // src/progress/helpers/index.ts
2316
+ var init_helpers = __esm({
2317
+ "src/progress/helpers/index.ts"() {
2318
+ "use strict";
2319
+ init_bus();
2320
+ init_bar();
2321
+ init_type();
2322
+ init_percentage();
2323
+ }
2324
+ });
2325
+
2326
+ // src/progress/helpers/nonTty.ts
2327
+ function createNonTTYLogger() {
2328
+ let prevPercentage = 0;
2329
+ const log = ({
2330
+ id,
2331
+ done,
2332
+ current,
2333
+ hasErrors,
2334
+ compileTime
2335
+ }) => {
2336
+ if (done) {
2337
+ if (prevPercentage === 100) {
2338
+ return;
2339
+ }
2340
+ prevPercentage = 100;
2341
+ if (hasErrors) {
2342
+ import_shared10.logger.error(`${id} compile failed in ${compileTime}`);
2343
+ } else {
2344
+ import_shared10.logger.ready(`${id} compiled in ${compileTime}`);
2345
+ }
2346
+ } else if (current - prevPercentage > 10) {
2347
+ prevPercentage = current;
2348
+ import_shared10.logger.info(`${id} compile progress: ${current.toFixed(0)}%`);
2349
+ }
2350
+ };
2351
+ return {
2352
+ log
2353
+ };
2354
+ }
2355
+ var import_shared10;
2356
+ var init_nonTty = __esm({
2357
+ "src/progress/helpers/nonTty.ts"() {
2358
+ "use strict";
2359
+ import_shared10 = require("@rsbuild/shared");
2360
+ }
2361
+ });
2362
+
2363
+ // src/progress/ProgressPlugin.ts
2364
+ var ProgressPlugin_exports = {};
2365
+ __export(ProgressPlugin_exports, {
2366
+ ProgressPlugin: () => ProgressPlugin
2367
+ });
2368
+ var import_shared11, import_webpack, ProgressPlugin;
2369
+ var init_ProgressPlugin = __esm({
2370
+ "src/progress/ProgressPlugin.ts"() {
2371
+ "use strict";
2372
+ import_shared11 = require("@rsbuild/shared");
2373
+ import_webpack = __toESM(require("webpack"));
2374
+ init_helpers();
2375
+ init_nonTty();
2376
+ ProgressPlugin = class extends import_webpack.default.ProgressPlugin {
2377
+ constructor(options) {
2378
+ const { id = "Rsbuild" } = options;
2379
+ const nonTTYLogger = createNonTTYLogger();
2380
+ const friendlyPercentage = createFriendlyPercentage();
2381
+ super({
2382
+ activeModules: false,
2383
+ entries: true,
2384
+ modules: true,
2385
+ modulesCount: 5e3,
2386
+ profile: false,
2387
+ dependencies: true,
2388
+ dependenciesCount: 1e4,
2389
+ percentBy: null,
2390
+ handler: (originalPercentage, message) => {
2391
+ const percentage = friendlyPercentage(originalPercentage);
2392
+ const done = percentage === 1;
2393
+ if (process.stdout.isTTY) {
2394
+ bus.update({
2395
+ id,
2396
+ current: percentage * 100,
2397
+ message,
2398
+ done,
2399
+ hasErrors: this.hasCompileErrors
2400
+ });
2401
+ bus.render();
2402
+ } else {
2403
+ nonTTYLogger.log({
2404
+ id,
2405
+ done,
2406
+ current: percentage * 100,
2407
+ hasErrors: this.hasCompileErrors,
2408
+ compileTime: this.compileTime
2409
+ });
2410
+ }
2411
+ }
2412
+ });
2413
+ __publicField(this, "name", "ProgressPlugin");
2414
+ __publicField(this, "id");
2415
+ __publicField(this, "hasCompileErrors", false);
2416
+ __publicField(this, "compileTime", null);
2417
+ this.id = id;
2418
+ }
2419
+ apply(compiler) {
2420
+ super.apply(compiler);
2421
+ let startTime = null;
2422
+ compiler.hooks.compile.tap(this.name, () => {
2423
+ this.compileTime = null;
2424
+ startTime = process.hrtime();
2425
+ });
2426
+ compiler.hooks.done.tap(this.name, (stat) => {
2427
+ if (startTime) {
2428
+ this.hasCompileErrors = stat.hasErrors();
2429
+ const hrtime = process.hrtime(startTime);
2430
+ const seconds = hrtime[0] + hrtime[1] / 1e9;
2431
+ this.compileTime = (0, import_shared11.prettyTime)(seconds);
2432
+ startTime = null;
2433
+ if (!this.hasCompileErrors) {
2434
+ import_shared11.logger.ready(`${this.id} compiled in ${this.compileTime}`);
2435
+ }
2436
+ }
2437
+ });
2438
+ }
2439
+ };
2440
+ }
2441
+ });
2442
+
2443
+ // src/plugins/progress.ts
2444
+ var progress_exports = {};
2445
+ __export(progress_exports, {
2446
+ pluginProgress: () => pluginProgress
2447
+ });
2448
+ var import_shared12, pluginProgress;
2449
+ var init_progress = __esm({
2450
+ "src/plugins/progress.ts"() {
2451
+ "use strict";
2452
+ import_shared12 = require("@rsbuild/shared");
2453
+ pluginProgress = () => ({
2454
+ name: "rsbuild-webpack:progress",
2455
+ setup(api) {
2456
+ api.modifyBundlerChain(async (chain, { target, CHAIN_ID }) => {
2457
+ const config = api.getNormalizedConfig();
2458
+ const options = config.dev.progressBar ?? true;
2459
+ if (!options) {
2460
+ return;
2461
+ }
2462
+ const { ProgressPlugin: ProgressPlugin2 } = await Promise.resolve().then(() => (init_ProgressPlugin(), ProgressPlugin_exports));
2463
+ chain.plugin(CHAIN_ID.PLUGIN.PROGRESS).use(ProgressPlugin2, [
2464
+ {
2465
+ id: import_shared12.TARGET_ID_MAP[target],
2466
+ ...options === true ? {} : options
2467
+ }
2468
+ ]);
2469
+ });
2470
+ }
2471
+ });
2472
+ }
2473
+ });
2474
+
2475
+ // src/build.ts
2476
+ var build_exports = {};
2477
+ __export(build_exports, {
2478
+ build: () => build
2479
+ });
2480
+ var import_shared13, import_MultiStats2, build;
2481
+ var init_build = __esm({
2482
+ "src/build.ts"() {
2483
+ "use strict";
2484
+ import_shared13 = require("@rsbuild/shared");
2485
+ import_MultiStats2 = __toESM(require("webpack/lib/MultiStats.js"));
2486
+ init_createCompiler();
2487
+ init_initConfigs();
2488
+ build = async (initOptions, { mode = "production", watch, compiler: customCompiler } = {}) => {
2489
+ if (!(0, import_shared13.getNodeEnv)()) {
2490
+ (0, import_shared13.setNodeEnv)(mode);
2491
+ }
2492
+ const { context } = initOptions;
2493
+ let compiler;
2494
+ let bundlerConfigs;
2495
+ if (customCompiler) {
2496
+ compiler = customCompiler;
2497
+ } else {
2498
+ const { webpackConfigs } = await initConfigs(initOptions);
2499
+ compiler = await createCompiler({
2500
+ context,
2501
+ webpackConfigs
2502
+ });
2503
+ bundlerConfigs = webpackConfigs;
2504
+ }
2505
+ let isFirstCompile = true;
2506
+ await context.hooks.onBeforeBuild.call({
2507
+ bundlerConfigs
2508
+ });
2509
+ const onDone = async (stats) => {
2510
+ const p = context.hooks.onAfterBuild.call({ isFirstCompile, stats });
2511
+ isFirstCompile = false;
2512
+ await p;
2513
+ };
2514
+ (0, import_shared13.onCompileDone)(compiler, onDone, import_MultiStats2.default);
2515
+ if (watch) {
2516
+ compiler.watch({}, (err) => {
2517
+ if (err) {
2518
+ import_shared13.logger.error(err);
2519
+ }
2520
+ });
2521
+ return;
2522
+ }
2523
+ await new Promise((resolve, reject) => {
2524
+ compiler.run((err, stats) => {
2525
+ if (err || stats?.hasErrors()) {
2526
+ const buildError = err || new Error("Webpack build failed!");
2527
+ reject(buildError);
2528
+ } else {
2529
+ compiler.close((closeErr) => {
2530
+ closeErr && import_shared13.logger.error(closeErr);
2531
+ resolve({ stats });
2532
+ });
2533
+ }
2534
+ });
2535
+ });
2536
+ };
2537
+ }
2538
+ });
2539
+
2540
+ // src/index.ts
2541
+ var src_exports = {};
2542
+ __export(src_exports, {
2543
+ webpackProvider: () => webpackProvider
2544
+ });
2545
+ module.exports = __toCommonJS(src_exports);
2546
+
2547
+ // src/provider.ts
2548
+ var import_internal4 = require("@rsbuild/core/internal");
2549
+ var import_shared14 = require("@rsbuild/shared");
2550
+ init_initConfigs();
2551
+ var webpackProvider = async ({
2552
+ pluginManager,
2553
+ rsbuildOptions
2554
+ }) => {
2555
+ const rsbuildConfig = (0, import_shared14.pickRsbuildConfig)(rsbuildOptions.rsbuildConfig);
2556
+ const context = await (0, import_internal4.createContext)(rsbuildOptions, rsbuildConfig, "webpack");
2557
+ const pluginAPI = (0, import_internal4.getPluginAPI)({ context, pluginManager });
2558
+ context.pluginAPI = pluginAPI;
2559
+ const { default: cssExtractPlugin } = await import("mini-css-extract-plugin");
2560
+ (0, import_internal4.setCssExtractPlugin)(cssExtractPlugin);
2561
+ const createCompiler2 = async () => {
2562
+ const { createCompiler: createCompiler3 } = await Promise.resolve().then(() => (init_createCompiler(), createCompiler_exports));
2563
+ const { webpackConfigs } = await initConfigs({
2564
+ context,
2565
+ pluginManager,
2566
+ rsbuildOptions
2567
+ });
2568
+ return createCompiler3({ context, webpackConfigs });
2569
+ };
2570
+ return {
2571
+ bundler: "webpack",
2572
+ pluginAPI,
2573
+ createCompiler: createCompiler2,
2574
+ publicContext: (0, import_internal4.createPublicContext)(context),
2575
+ async applyDefaultPlugins() {
2576
+ const allPlugins = await Promise.all([
2577
+ import_internal4.plugins.basic(),
2578
+ import_internal4.plugins.entry(),
2579
+ import_internal4.plugins.cache(),
2580
+ import_internal4.plugins.target(),
2581
+ import_internal4.plugins.output(),
2582
+ Promise.resolve().then(() => (init_resolve(), resolve_exports)).then((m) => m.pluginResolve()),
2583
+ import_internal4.plugins.fileSize(),
2584
+ import_internal4.plugins.cleanOutput(),
2585
+ import_internal4.plugins.asset(),
2586
+ Promise.resolve().then(() => (init_copy(), copy_exports)).then((m) => m.pluginCopy()),
2587
+ import_internal4.plugins.html(async (tags) => {
2588
+ const result = await context.hooks.modifyHTMLTags.call(tags);
2589
+ return result[0];
2590
+ }),
2591
+ import_internal4.plugins.wasm(),
2592
+ import_internal4.plugins.moment(),
2593
+ import_internal4.plugins.nodeAddons(),
2594
+ import_internal4.plugins.define(),
2595
+ Promise.resolve().then(() => (init_progress(), progress_exports)).then((m) => m.pluginProgress()),
2596
+ import_internal4.plugins.css(),
2597
+ import_internal4.plugins.less(),
2598
+ import_internal4.plugins.sass(),
2599
+ import_internal4.plugins.bundleAnalyzer(),
2600
+ import_internal4.plugins.rsdoctor(),
2601
+ import_internal4.plugins.splitChunks(),
2602
+ import_internal4.plugins.startUrl(),
2603
+ import_internal4.plugins.inlineChunk(),
2604
+ import_internal4.plugins.externals(),
2605
+ import_internal4.plugins.performance(),
2606
+ import_internal4.plugins.resourceHints(),
2607
+ import_internal4.plugins.server(),
2608
+ import_internal4.plugins.moduleFederation(),
2609
+ import_internal4.plugins.manifest()
2610
+ ]);
2611
+ pluginManager.addPlugins(allPlugins);
2612
+ },
2613
+ async initConfigs() {
2614
+ const { webpackConfigs } = await initConfigs({
2615
+ context,
2616
+ pluginManager,
2617
+ rsbuildOptions
2618
+ });
2619
+ return webpackConfigs;
2620
+ },
2621
+ async createDevServer(options) {
2622
+ const { createDevServer } = await import("@rsbuild/core/internal");
2623
+ const { createDevMiddleware: createDevMiddleware2 } = await Promise.resolve().then(() => (init_createCompiler(), createCompiler_exports));
2624
+ await (0, import_internal4.initRsbuildConfig)({ context, pluginManager });
2625
+ return createDevServer(
2626
+ { context, pluginManager, rsbuildOptions },
2627
+ createDevMiddleware2,
2628
+ options
2629
+ );
2630
+ },
2631
+ async startDevServer(options) {
2632
+ const { createDevServer } = await import("@rsbuild/core/internal");
2633
+ const { createDevMiddleware: createDevMiddleware2 } = await Promise.resolve().then(() => (init_createCompiler(), createCompiler_exports));
2634
+ await (0, import_internal4.initRsbuildConfig)({
2635
+ context,
2636
+ pluginManager
2637
+ });
2638
+ const server = await createDevServer(
2639
+ {
2640
+ context,
2641
+ pluginManager,
2642
+ rsbuildOptions
2643
+ },
2644
+ createDevMiddleware2,
2645
+ options
2646
+ );
2647
+ return server.listen();
2648
+ },
2649
+ async preview(options) {
2650
+ const { startProdServer } = await import("@rsbuild/core/internal");
2651
+ await (0, import_internal4.initRsbuildConfig)({
2652
+ context,
2653
+ pluginManager
2654
+ });
2655
+ return startProdServer(context, context.config, options);
2656
+ },
2657
+ async build(options) {
2658
+ const { build: build2 } = await Promise.resolve().then(() => (init_build(), build_exports));
2659
+ return build2({ context, pluginManager, rsbuildOptions }, options);
2660
+ },
2661
+ async inspectConfig(inspectOptions) {
2662
+ const { inspectConfig: inspectConfig2 } = await Promise.resolve().then(() => (init_inspectConfig(), inspectConfig_exports));
2663
+ return await inspectConfig2({
2664
+ context,
2665
+ pluginManager,
2666
+ rsbuildOptions,
2667
+ inspectOptions
2668
+ });
2669
+ }
2670
+ };
2671
+ };
2672
+ // Annotate the CommonJS export names for ESM import in node:
2673
+ 0 && (module.exports = {
2674
+ webpackProvider
2675
+ });