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