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