keycloakify 10.0.0-rc.63 → 10.0.0-rc.65

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 (34) hide show
  1. package/account/KcContext/KcContext.d.ts +1 -0
  2. package/account/KcContext/KcContext.js.map +1 -1
  3. package/account/KcContext/kcContextMocks.js +2 -1
  4. package/account/KcContext/kcContextMocks.js.map +1 -1
  5. package/account/pages/Totp.js +2 -7
  6. package/account/pages/Totp.js.map +1 -1
  7. package/bin/190.index.js +67 -101
  8. package/bin/{991.index.js → 203.index.js} +40 -19
  9. package/bin/{952.index.js → 363.index.js} +174 -154
  10. package/bin/{214.index.js → 430.index.js} +2 -161
  11. package/bin/526.index.js +130 -90
  12. package/bin/538.index.js +37 -28
  13. package/bin/{98.index.js → 827.index.js} +39 -187
  14. package/bin/{941.index.js → 890.index.js} +159 -2
  15. package/bin/932.index.js +104 -129
  16. package/bin/97.index.js +1 -1
  17. package/bin/main.js +7 -7
  18. package/package.json +9 -8
  19. package/src/account/KcContext/KcContext.ts +1 -0
  20. package/src/account/KcContext/kcContextMocks.ts +2 -1
  21. package/src/account/pages/Totp.tsx +1 -7
  22. package/src/bin/add-story.ts +1 -1
  23. package/src/bin/keycloakify/buildJars/buildJar.ts +24 -27
  24. package/src/bin/keycloakify/buildJars/buildJars.ts +5 -5
  25. package/src/bin/keycloakify/generateFtl/kcContextDeclarationTemplate.ftl +8 -6
  26. package/src/bin/keycloakify/generateResources/generateResourcesForMainTheme.ts +33 -32
  27. package/src/bin/keycloakify/generateResources/generateResourcesForThemeVariant.ts +22 -26
  28. package/src/bin/shared/downloadKeycloakDefaultTheme.ts +135 -108
  29. package/src/bin/shared/getImplementedThemeTypes.ts +38 -0
  30. package/src/bin/shared/getThemeSrcDirPath.ts +44 -32
  31. package/src/bin/shared/metaInfKeycloakThemes.ts +16 -60
  32. package/src/bin/start-keycloak/keycloakifyBuild.ts +1 -1
  33. package/src/bin/start-keycloak/start-keycloak.ts +35 -70
  34. package/vite-plugin/index.js +1917 -100
@@ -4344,7 +4344,7 @@ const containerName = "keycloak-keycloakify";
4344
4344
 
4345
4345
  /***/ }),
4346
4346
 
4347
- /***/ 8272:
4347
+ /***/ 4901:
4348
4348
  /***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
4349
4349
 
4350
4350
  "use strict";
@@ -4807,38 +4807,29 @@ var SuccessTracker;
4807
4807
  ;// CONCATENATED MODULE: ./dist/bin/tools/downloadAndExtractArchive/index.js
4808
4808
 
4809
4809
  //# sourceMappingURL=index.js.map
4810
- ;// CONCATENATED MODULE: ./dist/bin/tools/isInside.js
4811
-
4812
- function isInside(params) {
4813
- const { dirPath, filePath } = params;
4814
- return !(0,external_path_.relative)(dirPath, filePath).startsWith("..");
4815
- }
4816
- //# sourceMappingURL=isInside.js.map
4817
4810
  ;// CONCATENATED MODULE: ./dist/bin/shared/downloadKeycloakDefaultTheme.js
4818
4811
 
4819
4812
 
4820
4813
 
4821
4814
 
4822
-
4823
4815
  (0,assert.assert)();
4824
4816
  async function downloadKeycloakDefaultTheme(params) {
4825
4817
  const { keycloakVersion, buildContext } = params;
4818
+ let kcNodeModulesKeepFilePaths = undefined;
4819
+ let kcNodeModulesKeepFilePaths_lastAccountV1 = undefined;
4826
4820
  const { extractedDirPath } = await downloadAndExtractArchive({
4827
4821
  url: `https://repo1.maven.org/maven2/org/keycloak/keycloak-themes/${keycloakVersion}/keycloak-themes-${keycloakVersion}.jar`,
4828
4822
  cacheDirPath: buildContext.cacheDirPath,
4829
4823
  npmWorkspaceRootDirPath: buildContext.npmWorkspaceRootDirPath,
4830
4824
  uniqueIdOfOnOnArchiveFile: "downloadKeycloakDefaultTheme",
4831
4825
  onArchiveFile: async (params) => {
4832
- if (!isInside({ dirPath: "theme", filePath: params.fileRelativePath })) {
4826
+ const fileRelativePath = (0,external_path_.relative)("theme", params.fileRelativePath);
4827
+ if (fileRelativePath.startsWith("..")) {
4833
4828
  return;
4834
4829
  }
4835
4830
  const { readFile, writeFile } = params;
4836
- const fileRelativePath = (0,external_path_.relative)("theme", params.fileRelativePath);
4837
4831
  skip_keycloak_v2: {
4838
- if (!isInside({
4839
- dirPath: (0,external_path_.join)("keycloak.v2"),
4840
- filePath: fileRelativePath
4841
- })) {
4832
+ if (!fileRelativePath.startsWith((0,external_path_.join)("keycloak.v2"))) {
4842
4833
  break skip_keycloak_v2;
4843
4834
  }
4844
4835
  return;
@@ -4847,6 +4838,39 @@ async function downloadKeycloakDefaultTheme(params) {
4847
4838
  if (constants.lastKeycloakVersionWithAccountV1 !== keycloakVersion) {
4848
4839
  break last_account_v1_transformations;
4849
4840
  }
4841
+ skip_web_modules: {
4842
+ if (!fileRelativePath.startsWith((0,external_path_.join)("keycloak", "common", "resources", "web_modules"))) {
4843
+ break skip_web_modules;
4844
+ }
4845
+ return;
4846
+ }
4847
+ skip_lib: {
4848
+ if (!fileRelativePath.startsWith((0,external_path_.join)("keycloak", "common", "resources", "lib"))) {
4849
+ break skip_lib;
4850
+ }
4851
+ return;
4852
+ }
4853
+ skip_node_modules: {
4854
+ if (!fileRelativePath.startsWith((0,external_path_.join)("keycloak", "common", "resources", "node_modules"))) {
4855
+ break skip_node_modules;
4856
+ }
4857
+ if (kcNodeModulesKeepFilePaths_lastAccountV1 === undefined) {
4858
+ kcNodeModulesKeepFilePaths_lastAccountV1 = [
4859
+ (0,external_path_.join)("patternfly", "dist", "css", "patternfly.min.css"),
4860
+ (0,external_path_.join)("patternfly", "dist", "css", "patternfly-additions.min.css"),
4861
+ (0,external_path_.join)("patternfly", "dist", "fonts", "OpenSans-Regular-webfont.woff2"),
4862
+ (0,external_path_.join)("patternfly", "dist", "fonts", "OpenSans-Bold-webfont.woff2"),
4863
+ (0,external_path_.join)("patternfly", "dist", "fonts", "OpenSans-Light-webfont.woff2"),
4864
+ (0,external_path_.join)("patternfly", "dist", "fonts", "OpenSans-Semibold-webfont.woff2")
4865
+ ];
4866
+ }
4867
+ for (const keepPath of kcNodeModulesKeepFilePaths_lastAccountV1) {
4868
+ if (fileRelativePath.endsWith(keepPath)) {
4869
+ break skip_node_modules;
4870
+ }
4871
+ }
4872
+ return;
4873
+ }
4850
4874
  patch_account_css: {
4851
4875
  if (fileRelativePath !==
4852
4876
  (0,external_path_.join)("keycloak", "account", "resources", "css", "account.css")) {
@@ -4860,69 +4884,44 @@ async function downloadKeycloakDefaultTheme(params) {
4860
4884
  });
4861
4885
  return;
4862
4886
  }
4863
- skip_web_modules: {
4864
- if (!isInside({
4865
- dirPath: (0,external_path_.join)("keycloak", "common", "resources", "web_modules"),
4866
- filePath: fileRelativePath
4867
- })) {
4868
- break skip_web_modules;
4869
- }
4870
- return;
4871
- }
4872
- skip_unused_node_modules: {
4873
- const nodeModulesDirPath = (0,external_path_.join)("keycloak", "common", "resources", "node_modules");
4874
- if (!isInside({
4875
- dirPath: nodeModulesDirPath,
4876
- filePath: fileRelativePath
4877
- })) {
4878
- break skip_unused_node_modules;
4879
- }
4880
- const toKeepPrefixes = [
4881
- ...[
4882
- "patternfly.min.css",
4883
- "patternfly-additions.min.css",
4884
- "patternfly-additions.min.css"
4885
- ].map(fileBasename => (0,external_path_.join)(nodeModulesDirPath, "patternfly", "dist", "css", fileBasename)),
4886
- (0,external_path_.join)(nodeModulesDirPath, "patternfly", "dist", "fonts")
4887
- ];
4888
- if (toKeepPrefixes.find(prefix => fileRelativePath.startsWith(prefix)) !== undefined) {
4889
- break skip_unused_node_modules;
4890
- }
4891
- return;
4892
- }
4893
4887
  }
4894
4888
  skip_unused_resources: {
4895
4889
  if (keycloakVersion !== "24.0.4") {
4896
4890
  break skip_unused_resources;
4897
4891
  }
4898
- for (const dirBasename of [
4899
- "@patternfly-v5",
4900
- "@rollup",
4901
- "rollup",
4902
- "react",
4903
- "react-dom",
4904
- "shx",
4905
- ".pnpm"
4906
- ]) {
4907
- if (isInside({
4908
- dirPath: (0,external_path_.join)("keycloak", "common", "resources", "node_modules", dirBasename),
4909
- filePath: fileRelativePath
4910
- })) {
4911
- return;
4892
+ skip_node_modules: {
4893
+ if (!fileRelativePath.startsWith((0,external_path_.join)("keycloak", "common", "resources", "node_modules"))) {
4894
+ break skip_node_modules;
4912
4895
  }
4896
+ if (kcNodeModulesKeepFilePaths === undefined) {
4897
+ kcNodeModulesKeepFilePaths = [
4898
+ (0,external_path_.join)("@patternfly", "patternfly", "patternfly.min.css"),
4899
+ (0,external_path_.join)("patternfly", "dist", "css", "patternfly.min.css"),
4900
+ (0,external_path_.join)("patternfly", "dist", "css", "patternfly-additions.min.css"),
4901
+ (0,external_path_.join)("patternfly", "dist", "fonts", "OpenSans-Regular-webfont.woff2"),
4902
+ (0,external_path_.join)("patternfly", "dist", "fonts", "OpenSans-Light-webfont.woff2"),
4903
+ (0,external_path_.join)("patternfly", "dist", "fonts", "fontawesome-webfont.woff2"),
4904
+ (0,external_path_.join)("jquery", "dist", "jquery.min.js")
4905
+ ];
4906
+ }
4907
+ for (const keepPath of kcNodeModulesKeepFilePaths) {
4908
+ if (fileRelativePath.endsWith(keepPath)) {
4909
+ break skip_node_modules;
4910
+ }
4911
+ }
4912
+ return;
4913
4913
  }
4914
- for (const dirBasename of ["react", "react-dom"]) {
4915
- if (isInside({
4916
- dirPath: (0,external_path_.join)("keycloak", "common", "resources", "vendor", dirBasename),
4917
- filePath: fileRelativePath
4918
- })) {
4919
- return;
4914
+ skip_vendor: {
4915
+ if (!fileRelativePath.startsWith((0,external_path_.join)("keycloak", "common", "resources", "vendor"))) {
4916
+ break skip_vendor;
4920
4917
  }
4918
+ return;
4921
4919
  }
4922
- if (isInside({
4923
- dirPath: (0,external_path_.join)("keycloak", "common", "resources", "node_modules", "@patternfly", "react-core"),
4924
- filePath: fileRelativePath
4925
- })) {
4920
+ skip_rollup_config: {
4921
+ if (fileRelativePath !==
4922
+ (0,external_path_.join)("keycloak", "common", "resources", "rollup.config.js")) {
4923
+ break skip_rollup_config;
4924
+ }
4926
4925
  return;
4927
4926
  }
4928
4927
  }
@@ -5084,47 +5083,57 @@ var crawl = __nccwpck_require__(3036);
5084
5083
  var external_path_ = __nccwpck_require__(1017);
5085
5084
  // EXTERNAL MODULE: ./dist/bin/shared/constants.js
5086
5085
  var constants = __nccwpck_require__(173);
5086
+ // EXTERNAL MODULE: ./node_modules/chalk/source/index.js
5087
+ var source = __nccwpck_require__(8818);
5088
+ var source_default = /*#__PURE__*/__nccwpck_require__.n(source);
5087
5089
  ;// CONCATENATED MODULE: ./dist/bin/shared/getThemeSrcDirPath.js
5088
5090
 
5089
5091
 
5090
5092
 
5091
5093
 
5092
5094
 
5093
- const themeSrcDirBasenames = ["keycloak-theme", "keycloak_theme"];
5095
+
5096
+ let cache = undefined;
5094
5097
  /** Can't catch error, if the directory isn't found, this function will just exit the process with an error message. */
5095
5098
  function getThemeSrcDirPath(params) {
5096
5099
  const { projectDirPath } = params;
5097
- const srcDirPath = (0,external_path_.join)(projectDirPath, "src");
5098
- const themeSrcDirPath = (0,crawl/* crawl */.J)({
5099
- dirPath: srcDirPath,
5100
- returnedPathsType: "relative to dirPath"
5101
- })
5102
- .map(fileRelativePath => {
5103
- for (const themeSrcDirBasename of themeSrcDirBasenames) {
5104
- const split = fileRelativePath.split(themeSrcDirBasename);
5105
- if (split.length === 2) {
5106
- return (0,external_path_.join)(srcDirPath, split[0] + themeSrcDirBasename);
5107
- }
5108
- }
5109
- return undefined;
5110
- })
5111
- .filter((0,tsafe.exclude)(undefined))[0];
5112
- if (themeSrcDirPath !== undefined) {
5100
+ if (cache !== undefined && cache.projectDirPath === projectDirPath) {
5101
+ const { themeSrcDirPath } = cache;
5113
5102
  return { themeSrcDirPath };
5114
5103
  }
5115
- for (const themeType of [...constants.themeTypes, "email"]) {
5116
- if (!external_fs_.existsSync((0,external_path_.join)(srcDirPath, themeType))) {
5117
- continue;
5104
+ cache = undefined;
5105
+ const { themeSrcDirPath } = (() => {
5106
+ const srcDirPath = (0,external_path_.join)(projectDirPath, "src");
5107
+ const themeSrcDirPath = (0,crawl/* crawl */.J)({
5108
+ dirPath: srcDirPath,
5109
+ returnedPathsType: "relative to dirPath"
5110
+ })
5111
+ .map(fileRelativePath => {
5112
+ for (const themeSrcDirBasename of themeSrcDirBasenames) {
5113
+ const split = fileRelativePath.split(themeSrcDirBasename);
5114
+ if (split.length === 2) {
5115
+ return (0,external_path_.join)(srcDirPath, split[0] + themeSrcDirBasename);
5116
+ }
5117
+ }
5118
+ return undefined;
5119
+ })
5120
+ .filter((0,tsafe.exclude)(undefined))[0];
5121
+ if (themeSrcDirPath !== undefined) {
5122
+ return { themeSrcDirPath };
5118
5123
  }
5119
- return { themeSrcDirPath: srcDirPath };
5120
- }
5121
- console.error([
5122
- "Can't locate your theme source directory. It should be either: ",
5123
- "src/ or src/keycloak-theme or src/keycloak_theme.",
5124
- "Example in the starter: https://github.com/keycloakify/keycloakify-starter/tree/main/src/keycloak-theme"
5125
- ].join("\n"));
5126
- process.exit(-1);
5124
+ for (const themeType of [...constants.themeTypes, "email"]) {
5125
+ if (!external_fs_.existsSync((0,external_path_.join)(srcDirPath, themeType))) {
5126
+ continue;
5127
+ }
5128
+ return { themeSrcDirPath: srcDirPath };
5129
+ }
5130
+ console.log(source_default().red("Can't locate your theme source directory. It should be either: "));
5131
+ process.exit(-1);
5132
+ })();
5133
+ cache = { projectDirPath, themeSrcDirPath };
5134
+ return { themeSrcDirPath };
5127
5135
  }
5136
+ const themeSrcDirBasenames = ["keycloak-theme", "keycloak_theme"];
5128
5137
  //# sourceMappingURL=getThemeSrcDirPath.js.map
5129
5138
  // EXTERNAL MODULE: external "fs/promises"
5130
5139
  var promises_ = __nccwpck_require__(3292);
@@ -5420,7 +5429,7 @@ const path_1 = __nccwpck_require__(1017);
5420
5429
  const constants_1 = __nccwpck_require__(173);
5421
5430
  const id_1 = __nccwpck_require__(3047);
5422
5431
  const fs_rm_1 = __nccwpck_require__(8699);
5423
- const copyKeycloakResourcesToPublic_1 = __nccwpck_require__(8272);
5432
+ const copyKeycloakResourcesToPublic_1 = __nccwpck_require__(4901);
5424
5433
  const assert_1 = __nccwpck_require__(8078);
5425
5434
  const buildContext_1 = __nccwpck_require__(8355);
5426
5435
  const magic_string_1 = __importDefault(__nccwpck_require__(5734));
@@ -10141,6 +10150,178 @@ class AggregateError extends Error {
10141
10150
  module.exports = AggregateError;
10142
10151
 
10143
10152
 
10153
+ /***/ }),
10154
+
10155
+ /***/ 2068:
10156
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
10157
+
10158
+ "use strict";
10159
+ /* module decorator */ module = __nccwpck_require__.nmd(module);
10160
+
10161
+
10162
+ const wrapAnsi16 = (fn, offset) => (...args) => {
10163
+ const code = fn(...args);
10164
+ return `\u001B[${code + offset}m`;
10165
+ };
10166
+
10167
+ const wrapAnsi256 = (fn, offset) => (...args) => {
10168
+ const code = fn(...args);
10169
+ return `\u001B[${38 + offset};5;${code}m`;
10170
+ };
10171
+
10172
+ const wrapAnsi16m = (fn, offset) => (...args) => {
10173
+ const rgb = fn(...args);
10174
+ return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
10175
+ };
10176
+
10177
+ const ansi2ansi = n => n;
10178
+ const rgb2rgb = (r, g, b) => [r, g, b];
10179
+
10180
+ const setLazyProperty = (object, property, get) => {
10181
+ Object.defineProperty(object, property, {
10182
+ get: () => {
10183
+ const value = get();
10184
+
10185
+ Object.defineProperty(object, property, {
10186
+ value,
10187
+ enumerable: true,
10188
+ configurable: true
10189
+ });
10190
+
10191
+ return value;
10192
+ },
10193
+ enumerable: true,
10194
+ configurable: true
10195
+ });
10196
+ };
10197
+
10198
+ /** @type {typeof import('color-convert')} */
10199
+ let colorConvert;
10200
+ const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
10201
+ if (colorConvert === undefined) {
10202
+ colorConvert = __nccwpck_require__(6931);
10203
+ }
10204
+
10205
+ const offset = isBackground ? 10 : 0;
10206
+ const styles = {};
10207
+
10208
+ for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
10209
+ const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
10210
+ if (sourceSpace === targetSpace) {
10211
+ styles[name] = wrap(identity, offset);
10212
+ } else if (typeof suite === 'object') {
10213
+ styles[name] = wrap(suite[targetSpace], offset);
10214
+ }
10215
+ }
10216
+
10217
+ return styles;
10218
+ };
10219
+
10220
+ function assembleStyles() {
10221
+ const codes = new Map();
10222
+ const styles = {
10223
+ modifier: {
10224
+ reset: [0, 0],
10225
+ // 21 isn't widely supported and 22 does the same thing
10226
+ bold: [1, 22],
10227
+ dim: [2, 22],
10228
+ italic: [3, 23],
10229
+ underline: [4, 24],
10230
+ inverse: [7, 27],
10231
+ hidden: [8, 28],
10232
+ strikethrough: [9, 29]
10233
+ },
10234
+ color: {
10235
+ black: [30, 39],
10236
+ red: [31, 39],
10237
+ green: [32, 39],
10238
+ yellow: [33, 39],
10239
+ blue: [34, 39],
10240
+ magenta: [35, 39],
10241
+ cyan: [36, 39],
10242
+ white: [37, 39],
10243
+
10244
+ // Bright color
10245
+ blackBright: [90, 39],
10246
+ redBright: [91, 39],
10247
+ greenBright: [92, 39],
10248
+ yellowBright: [93, 39],
10249
+ blueBright: [94, 39],
10250
+ magentaBright: [95, 39],
10251
+ cyanBright: [96, 39],
10252
+ whiteBright: [97, 39]
10253
+ },
10254
+ bgColor: {
10255
+ bgBlack: [40, 49],
10256
+ bgRed: [41, 49],
10257
+ bgGreen: [42, 49],
10258
+ bgYellow: [43, 49],
10259
+ bgBlue: [44, 49],
10260
+ bgMagenta: [45, 49],
10261
+ bgCyan: [46, 49],
10262
+ bgWhite: [47, 49],
10263
+
10264
+ // Bright color
10265
+ bgBlackBright: [100, 49],
10266
+ bgRedBright: [101, 49],
10267
+ bgGreenBright: [102, 49],
10268
+ bgYellowBright: [103, 49],
10269
+ bgBlueBright: [104, 49],
10270
+ bgMagentaBright: [105, 49],
10271
+ bgCyanBright: [106, 49],
10272
+ bgWhiteBright: [107, 49]
10273
+ }
10274
+ };
10275
+
10276
+ // Alias bright black as gray (and grey)
10277
+ styles.color.gray = styles.color.blackBright;
10278
+ styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
10279
+ styles.color.grey = styles.color.blackBright;
10280
+ styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
10281
+
10282
+ for (const [groupName, group] of Object.entries(styles)) {
10283
+ for (const [styleName, style] of Object.entries(group)) {
10284
+ styles[styleName] = {
10285
+ open: `\u001B[${style[0]}m`,
10286
+ close: `\u001B[${style[1]}m`
10287
+ };
10288
+
10289
+ group[styleName] = styles[styleName];
10290
+
10291
+ codes.set(style[0], style[1]);
10292
+ }
10293
+
10294
+ Object.defineProperty(styles, groupName, {
10295
+ value: group,
10296
+ enumerable: false
10297
+ });
10298
+ }
10299
+
10300
+ Object.defineProperty(styles, 'codes', {
10301
+ value: codes,
10302
+ enumerable: false
10303
+ });
10304
+
10305
+ styles.color.close = '\u001B[39m';
10306
+ styles.bgColor.close = '\u001B[49m';
10307
+
10308
+ setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
10309
+ setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
10310
+ setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
10311
+ setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
10312
+ setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
10313
+ setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
10314
+
10315
+ return styles;
10316
+ }
10317
+
10318
+ // Make the export immutable
10319
+ Object.defineProperty(module, 'exports', {
10320
+ enumerable: true,
10321
+ get: assembleStyles
10322
+ });
10323
+
10324
+
10144
10325
  /***/ }),
10145
10326
 
10146
10327
  /***/ 9417:
@@ -19286,6 +19467,432 @@ module.exports = function (uniq) {
19286
19467
  }
19287
19468
 
19288
19469
 
19470
+ /***/ }),
19471
+
19472
+ /***/ 8818:
19473
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
19474
+
19475
+ "use strict";
19476
+
19477
+ const ansiStyles = __nccwpck_require__(2068);
19478
+ const {stdout: stdoutColor, stderr: stderrColor} = __nccwpck_require__(9318);
19479
+ const {
19480
+ stringReplaceAll,
19481
+ stringEncaseCRLFWithFirstIndex
19482
+ } = __nccwpck_require__(2415);
19483
+
19484
+ const {isArray} = Array;
19485
+
19486
+ // `supportsColor.level` → `ansiStyles.color[name]` mapping
19487
+ const levelMapping = [
19488
+ 'ansi',
19489
+ 'ansi',
19490
+ 'ansi256',
19491
+ 'ansi16m'
19492
+ ];
19493
+
19494
+ const styles = Object.create(null);
19495
+
19496
+ const applyOptions = (object, options = {}) => {
19497
+ if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
19498
+ throw new Error('The `level` option should be an integer from 0 to 3');
19499
+ }
19500
+
19501
+ // Detect level if not set manually
19502
+ const colorLevel = stdoutColor ? stdoutColor.level : 0;
19503
+ object.level = options.level === undefined ? colorLevel : options.level;
19504
+ };
19505
+
19506
+ class ChalkClass {
19507
+ constructor(options) {
19508
+ // eslint-disable-next-line no-constructor-return
19509
+ return chalkFactory(options);
19510
+ }
19511
+ }
19512
+
19513
+ const chalkFactory = options => {
19514
+ const chalk = {};
19515
+ applyOptions(chalk, options);
19516
+
19517
+ chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);
19518
+
19519
+ Object.setPrototypeOf(chalk, Chalk.prototype);
19520
+ Object.setPrototypeOf(chalk.template, chalk);
19521
+
19522
+ chalk.template.constructor = () => {
19523
+ throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');
19524
+ };
19525
+
19526
+ chalk.template.Instance = ChalkClass;
19527
+
19528
+ return chalk.template;
19529
+ };
19530
+
19531
+ function Chalk(options) {
19532
+ return chalkFactory(options);
19533
+ }
19534
+
19535
+ for (const [styleName, style] of Object.entries(ansiStyles)) {
19536
+ styles[styleName] = {
19537
+ get() {
19538
+ const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
19539
+ Object.defineProperty(this, styleName, {value: builder});
19540
+ return builder;
19541
+ }
19542
+ };
19543
+ }
19544
+
19545
+ styles.visible = {
19546
+ get() {
19547
+ const builder = createBuilder(this, this._styler, true);
19548
+ Object.defineProperty(this, 'visible', {value: builder});
19549
+ return builder;
19550
+ }
19551
+ };
19552
+
19553
+ const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256'];
19554
+
19555
+ for (const model of usedModels) {
19556
+ styles[model] = {
19557
+ get() {
19558
+ const {level} = this;
19559
+ return function (...arguments_) {
19560
+ const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
19561
+ return createBuilder(this, styler, this._isEmpty);
19562
+ };
19563
+ }
19564
+ };
19565
+ }
19566
+
19567
+ for (const model of usedModels) {
19568
+ const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
19569
+ styles[bgModel] = {
19570
+ get() {
19571
+ const {level} = this;
19572
+ return function (...arguments_) {
19573
+ const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
19574
+ return createBuilder(this, styler, this._isEmpty);
19575
+ };
19576
+ }
19577
+ };
19578
+ }
19579
+
19580
+ const proto = Object.defineProperties(() => {}, {
19581
+ ...styles,
19582
+ level: {
19583
+ enumerable: true,
19584
+ get() {
19585
+ return this._generator.level;
19586
+ },
19587
+ set(level) {
19588
+ this._generator.level = level;
19589
+ }
19590
+ }
19591
+ });
19592
+
19593
+ const createStyler = (open, close, parent) => {
19594
+ let openAll;
19595
+ let closeAll;
19596
+ if (parent === undefined) {
19597
+ openAll = open;
19598
+ closeAll = close;
19599
+ } else {
19600
+ openAll = parent.openAll + open;
19601
+ closeAll = close + parent.closeAll;
19602
+ }
19603
+
19604
+ return {
19605
+ open,
19606
+ close,
19607
+ openAll,
19608
+ closeAll,
19609
+ parent
19610
+ };
19611
+ };
19612
+
19613
+ const createBuilder = (self, _styler, _isEmpty) => {
19614
+ const builder = (...arguments_) => {
19615
+ if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
19616
+ // Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}`
19617
+ return applyStyle(builder, chalkTag(builder, ...arguments_));
19618
+ }
19619
+
19620
+ // Single argument is hot path, implicit coercion is faster than anything
19621
+ // eslint-disable-next-line no-implicit-coercion
19622
+ return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));
19623
+ };
19624
+
19625
+ // We alter the prototype because we must return a function, but there is
19626
+ // no way to create a function with a different prototype
19627
+ Object.setPrototypeOf(builder, proto);
19628
+
19629
+ builder._generator = self;
19630
+ builder._styler = _styler;
19631
+ builder._isEmpty = _isEmpty;
19632
+
19633
+ return builder;
19634
+ };
19635
+
19636
+ const applyStyle = (self, string) => {
19637
+ if (self.level <= 0 || !string) {
19638
+ return self._isEmpty ? '' : string;
19639
+ }
19640
+
19641
+ let styler = self._styler;
19642
+
19643
+ if (styler === undefined) {
19644
+ return string;
19645
+ }
19646
+
19647
+ const {openAll, closeAll} = styler;
19648
+ if (string.indexOf('\u001B') !== -1) {
19649
+ while (styler !== undefined) {
19650
+ // Replace any instances already present with a re-opening code
19651
+ // otherwise only the part of the string until said closing code
19652
+ // will be colored, and the rest will simply be 'plain'.
19653
+ string = stringReplaceAll(string, styler.close, styler.open);
19654
+
19655
+ styler = styler.parent;
19656
+ }
19657
+ }
19658
+
19659
+ // We can move both next actions out of loop, because remaining actions in loop won't have
19660
+ // any/visible effect on parts we add here. Close the styling before a linebreak and reopen
19661
+ // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
19662
+ const lfIndex = string.indexOf('\n');
19663
+ if (lfIndex !== -1) {
19664
+ string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
19665
+ }
19666
+
19667
+ return openAll + string + closeAll;
19668
+ };
19669
+
19670
+ let template;
19671
+ const chalkTag = (chalk, ...strings) => {
19672
+ const [firstString] = strings;
19673
+
19674
+ if (!isArray(firstString) || !isArray(firstString.raw)) {
19675
+ // If chalk() was called by itself or with a string,
19676
+ // return the string itself as a string.
19677
+ return strings.join(' ');
19678
+ }
19679
+
19680
+ const arguments_ = strings.slice(1);
19681
+ const parts = [firstString.raw[0]];
19682
+
19683
+ for (let i = 1; i < firstString.length; i++) {
19684
+ parts.push(
19685
+ String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'),
19686
+ String(firstString.raw[i])
19687
+ );
19688
+ }
19689
+
19690
+ if (template === undefined) {
19691
+ template = __nccwpck_require__(6987);
19692
+ }
19693
+
19694
+ return template(chalk, parts.join(''));
19695
+ };
19696
+
19697
+ Object.defineProperties(Chalk.prototype, styles);
19698
+
19699
+ const chalk = Chalk(); // eslint-disable-line new-cap
19700
+ chalk.supportsColor = stdoutColor;
19701
+ chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap
19702
+ chalk.stderr.supportsColor = stderrColor;
19703
+
19704
+ module.exports = chalk;
19705
+
19706
+
19707
+ /***/ }),
19708
+
19709
+ /***/ 6987:
19710
+ /***/ ((module) => {
19711
+
19712
+ "use strict";
19713
+
19714
+ const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
19715
+ const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
19716
+ const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
19717
+ const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
19718
+
19719
+ const ESCAPES = new Map([
19720
+ ['n', '\n'],
19721
+ ['r', '\r'],
19722
+ ['t', '\t'],
19723
+ ['b', '\b'],
19724
+ ['f', '\f'],
19725
+ ['v', '\v'],
19726
+ ['0', '\0'],
19727
+ ['\\', '\\'],
19728
+ ['e', '\u001B'],
19729
+ ['a', '\u0007']
19730
+ ]);
19731
+
19732
+ function unescape(c) {
19733
+ const u = c[0] === 'u';
19734
+ const bracket = c[1] === '{';
19735
+
19736
+ if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
19737
+ return String.fromCharCode(parseInt(c.slice(1), 16));
19738
+ }
19739
+
19740
+ if (u && bracket) {
19741
+ return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
19742
+ }
19743
+
19744
+ return ESCAPES.get(c) || c;
19745
+ }
19746
+
19747
+ function parseArguments(name, arguments_) {
19748
+ const results = [];
19749
+ const chunks = arguments_.trim().split(/\s*,\s*/g);
19750
+ let matches;
19751
+
19752
+ for (const chunk of chunks) {
19753
+ const number = Number(chunk);
19754
+ if (!Number.isNaN(number)) {
19755
+ results.push(number);
19756
+ } else if ((matches = chunk.match(STRING_REGEX))) {
19757
+ results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
19758
+ } else {
19759
+ throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
19760
+ }
19761
+ }
19762
+
19763
+ return results;
19764
+ }
19765
+
19766
+ function parseStyle(style) {
19767
+ STYLE_REGEX.lastIndex = 0;
19768
+
19769
+ const results = [];
19770
+ let matches;
19771
+
19772
+ while ((matches = STYLE_REGEX.exec(style)) !== null) {
19773
+ const name = matches[1];
19774
+
19775
+ if (matches[2]) {
19776
+ const args = parseArguments(name, matches[2]);
19777
+ results.push([name].concat(args));
19778
+ } else {
19779
+ results.push([name]);
19780
+ }
19781
+ }
19782
+
19783
+ return results;
19784
+ }
19785
+
19786
+ function buildStyle(chalk, styles) {
19787
+ const enabled = {};
19788
+
19789
+ for (const layer of styles) {
19790
+ for (const style of layer.styles) {
19791
+ enabled[style[0]] = layer.inverse ? null : style.slice(1);
19792
+ }
19793
+ }
19794
+
19795
+ let current = chalk;
19796
+ for (const [styleName, styles] of Object.entries(enabled)) {
19797
+ if (!Array.isArray(styles)) {
19798
+ continue;
19799
+ }
19800
+
19801
+ if (!(styleName in current)) {
19802
+ throw new Error(`Unknown Chalk style: ${styleName}`);
19803
+ }
19804
+
19805
+ current = styles.length > 0 ? current[styleName](...styles) : current[styleName];
19806
+ }
19807
+
19808
+ return current;
19809
+ }
19810
+
19811
+ module.exports = (chalk, temporary) => {
19812
+ const styles = [];
19813
+ const chunks = [];
19814
+ let chunk = [];
19815
+
19816
+ // eslint-disable-next-line max-params
19817
+ temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
19818
+ if (escapeCharacter) {
19819
+ chunk.push(unescape(escapeCharacter));
19820
+ } else if (style) {
19821
+ const string = chunk.join('');
19822
+ chunk = [];
19823
+ chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string));
19824
+ styles.push({inverse, styles: parseStyle(style)});
19825
+ } else if (close) {
19826
+ if (styles.length === 0) {
19827
+ throw new Error('Found extraneous } in Chalk template literal');
19828
+ }
19829
+
19830
+ chunks.push(buildStyle(chalk, styles)(chunk.join('')));
19831
+ chunk = [];
19832
+ styles.pop();
19833
+ } else {
19834
+ chunk.push(character);
19835
+ }
19836
+ });
19837
+
19838
+ chunks.push(chunk.join(''));
19839
+
19840
+ if (styles.length > 0) {
19841
+ const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
19842
+ throw new Error(errMessage);
19843
+ }
19844
+
19845
+ return chunks.join('');
19846
+ };
19847
+
19848
+
19849
+ /***/ }),
19850
+
19851
+ /***/ 2415:
19852
+ /***/ ((module) => {
19853
+
19854
+ "use strict";
19855
+
19856
+
19857
+ const stringReplaceAll = (string, substring, replacer) => {
19858
+ let index = string.indexOf(substring);
19859
+ if (index === -1) {
19860
+ return string;
19861
+ }
19862
+
19863
+ const substringLength = substring.length;
19864
+ let endIndex = 0;
19865
+ let returnValue = '';
19866
+ do {
19867
+ returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
19868
+ endIndex = index + substringLength;
19869
+ index = string.indexOf(substring, endIndex);
19870
+ } while (index !== -1);
19871
+
19872
+ returnValue += string.substr(endIndex);
19873
+ return returnValue;
19874
+ };
19875
+
19876
+ const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
19877
+ let endIndex = 0;
19878
+ let returnValue = '';
19879
+ do {
19880
+ const gotCR = string[index - 1] === '\r';
19881
+ returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
19882
+ endIndex = index + 1;
19883
+ index = string.indexOf('\n', endIndex);
19884
+ } while (index !== -1);
19885
+
19886
+ returnValue += string.substr(endIndex);
19887
+ return returnValue;
19888
+ };
19889
+
19890
+ module.exports = {
19891
+ stringReplaceAll,
19892
+ stringEncaseCRLFWithFirstIndex
19893
+ };
19894
+
19895
+
19289
19896
  /***/ }),
19290
19897
 
19291
19898
  /***/ 7972:
@@ -19334,6 +19941,1204 @@ module.exports = (stack, options) => {
19334
19941
  };
19335
19942
 
19336
19943
 
19944
+ /***/ }),
19945
+
19946
+ /***/ 7391:
19947
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
19948
+
19949
+ /* MIT license */
19950
+ /* eslint-disable no-mixed-operators */
19951
+ const cssKeywords = __nccwpck_require__(8510);
19952
+
19953
+ // NOTE: conversions should only return primitive values (i.e. arrays, or
19954
+ // values that give correct `typeof` results).
19955
+ // do not use box values types (i.e. Number(), String(), etc.)
19956
+
19957
+ const reverseKeywords = {};
19958
+ for (const key of Object.keys(cssKeywords)) {
19959
+ reverseKeywords[cssKeywords[key]] = key;
19960
+ }
19961
+
19962
+ const convert = {
19963
+ rgb: {channels: 3, labels: 'rgb'},
19964
+ hsl: {channels: 3, labels: 'hsl'},
19965
+ hsv: {channels: 3, labels: 'hsv'},
19966
+ hwb: {channels: 3, labels: 'hwb'},
19967
+ cmyk: {channels: 4, labels: 'cmyk'},
19968
+ xyz: {channels: 3, labels: 'xyz'},
19969
+ lab: {channels: 3, labels: 'lab'},
19970
+ lch: {channels: 3, labels: 'lch'},
19971
+ hex: {channels: 1, labels: ['hex']},
19972
+ keyword: {channels: 1, labels: ['keyword']},
19973
+ ansi16: {channels: 1, labels: ['ansi16']},
19974
+ ansi256: {channels: 1, labels: ['ansi256']},
19975
+ hcg: {channels: 3, labels: ['h', 'c', 'g']},
19976
+ apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
19977
+ gray: {channels: 1, labels: ['gray']}
19978
+ };
19979
+
19980
+ module.exports = convert;
19981
+
19982
+ // Hide .channels and .labels properties
19983
+ for (const model of Object.keys(convert)) {
19984
+ if (!('channels' in convert[model])) {
19985
+ throw new Error('missing channels property: ' + model);
19986
+ }
19987
+
19988
+ if (!('labels' in convert[model])) {
19989
+ throw new Error('missing channel labels property: ' + model);
19990
+ }
19991
+
19992
+ if (convert[model].labels.length !== convert[model].channels) {
19993
+ throw new Error('channel and label counts mismatch: ' + model);
19994
+ }
19995
+
19996
+ const {channels, labels} = convert[model];
19997
+ delete convert[model].channels;
19998
+ delete convert[model].labels;
19999
+ Object.defineProperty(convert[model], 'channels', {value: channels});
20000
+ Object.defineProperty(convert[model], 'labels', {value: labels});
20001
+ }
20002
+
20003
+ convert.rgb.hsl = function (rgb) {
20004
+ const r = rgb[0] / 255;
20005
+ const g = rgb[1] / 255;
20006
+ const b = rgb[2] / 255;
20007
+ const min = Math.min(r, g, b);
20008
+ const max = Math.max(r, g, b);
20009
+ const delta = max - min;
20010
+ let h;
20011
+ let s;
20012
+
20013
+ if (max === min) {
20014
+ h = 0;
20015
+ } else if (r === max) {
20016
+ h = (g - b) / delta;
20017
+ } else if (g === max) {
20018
+ h = 2 + (b - r) / delta;
20019
+ } else if (b === max) {
20020
+ h = 4 + (r - g) / delta;
20021
+ }
20022
+
20023
+ h = Math.min(h * 60, 360);
20024
+
20025
+ if (h < 0) {
20026
+ h += 360;
20027
+ }
20028
+
20029
+ const l = (min + max) / 2;
20030
+
20031
+ if (max === min) {
20032
+ s = 0;
20033
+ } else if (l <= 0.5) {
20034
+ s = delta / (max + min);
20035
+ } else {
20036
+ s = delta / (2 - max - min);
20037
+ }
20038
+
20039
+ return [h, s * 100, l * 100];
20040
+ };
20041
+
20042
+ convert.rgb.hsv = function (rgb) {
20043
+ let rdif;
20044
+ let gdif;
20045
+ let bdif;
20046
+ let h;
20047
+ let s;
20048
+
20049
+ const r = rgb[0] / 255;
20050
+ const g = rgb[1] / 255;
20051
+ const b = rgb[2] / 255;
20052
+ const v = Math.max(r, g, b);
20053
+ const diff = v - Math.min(r, g, b);
20054
+ const diffc = function (c) {
20055
+ return (v - c) / 6 / diff + 1 / 2;
20056
+ };
20057
+
20058
+ if (diff === 0) {
20059
+ h = 0;
20060
+ s = 0;
20061
+ } else {
20062
+ s = diff / v;
20063
+ rdif = diffc(r);
20064
+ gdif = diffc(g);
20065
+ bdif = diffc(b);
20066
+
20067
+ if (r === v) {
20068
+ h = bdif - gdif;
20069
+ } else if (g === v) {
20070
+ h = (1 / 3) + rdif - bdif;
20071
+ } else if (b === v) {
20072
+ h = (2 / 3) + gdif - rdif;
20073
+ }
20074
+
20075
+ if (h < 0) {
20076
+ h += 1;
20077
+ } else if (h > 1) {
20078
+ h -= 1;
20079
+ }
20080
+ }
20081
+
20082
+ return [
20083
+ h * 360,
20084
+ s * 100,
20085
+ v * 100
20086
+ ];
20087
+ };
20088
+
20089
+ convert.rgb.hwb = function (rgb) {
20090
+ const r = rgb[0];
20091
+ const g = rgb[1];
20092
+ let b = rgb[2];
20093
+ const h = convert.rgb.hsl(rgb)[0];
20094
+ const w = 1 / 255 * Math.min(r, Math.min(g, b));
20095
+
20096
+ b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
20097
+
20098
+ return [h, w * 100, b * 100];
20099
+ };
20100
+
20101
+ convert.rgb.cmyk = function (rgb) {
20102
+ const r = rgb[0] / 255;
20103
+ const g = rgb[1] / 255;
20104
+ const b = rgb[2] / 255;
20105
+
20106
+ const k = Math.min(1 - r, 1 - g, 1 - b);
20107
+ const c = (1 - r - k) / (1 - k) || 0;
20108
+ const m = (1 - g - k) / (1 - k) || 0;
20109
+ const y = (1 - b - k) / (1 - k) || 0;
20110
+
20111
+ return [c * 100, m * 100, y * 100, k * 100];
20112
+ };
20113
+
20114
+ function comparativeDistance(x, y) {
20115
+ /*
20116
+ See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
20117
+ */
20118
+ return (
20119
+ ((x[0] - y[0]) ** 2) +
20120
+ ((x[1] - y[1]) ** 2) +
20121
+ ((x[2] - y[2]) ** 2)
20122
+ );
20123
+ }
20124
+
20125
+ convert.rgb.keyword = function (rgb) {
20126
+ const reversed = reverseKeywords[rgb];
20127
+ if (reversed) {
20128
+ return reversed;
20129
+ }
20130
+
20131
+ let currentClosestDistance = Infinity;
20132
+ let currentClosestKeyword;
20133
+
20134
+ for (const keyword of Object.keys(cssKeywords)) {
20135
+ const value = cssKeywords[keyword];
20136
+
20137
+ // Compute comparative distance
20138
+ const distance = comparativeDistance(rgb, value);
20139
+
20140
+ // Check if its less, if so set as closest
20141
+ if (distance < currentClosestDistance) {
20142
+ currentClosestDistance = distance;
20143
+ currentClosestKeyword = keyword;
20144
+ }
20145
+ }
20146
+
20147
+ return currentClosestKeyword;
20148
+ };
20149
+
20150
+ convert.keyword.rgb = function (keyword) {
20151
+ return cssKeywords[keyword];
20152
+ };
20153
+
20154
+ convert.rgb.xyz = function (rgb) {
20155
+ let r = rgb[0] / 255;
20156
+ let g = rgb[1] / 255;
20157
+ let b = rgb[2] / 255;
20158
+
20159
+ // Assume sRGB
20160
+ r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);
20161
+ g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);
20162
+ b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);
20163
+
20164
+ const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
20165
+ const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
20166
+ const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
20167
+
20168
+ return [x * 100, y * 100, z * 100];
20169
+ };
20170
+
20171
+ convert.rgb.lab = function (rgb) {
20172
+ const xyz = convert.rgb.xyz(rgb);
20173
+ let x = xyz[0];
20174
+ let y = xyz[1];
20175
+ let z = xyz[2];
20176
+
20177
+ x /= 95.047;
20178
+ y /= 100;
20179
+ z /= 108.883;
20180
+
20181
+ x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
20182
+ y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
20183
+ z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
20184
+
20185
+ const l = (116 * y) - 16;
20186
+ const a = 500 * (x - y);
20187
+ const b = 200 * (y - z);
20188
+
20189
+ return [l, a, b];
20190
+ };
20191
+
20192
+ convert.hsl.rgb = function (hsl) {
20193
+ const h = hsl[0] / 360;
20194
+ const s = hsl[1] / 100;
20195
+ const l = hsl[2] / 100;
20196
+ let t2;
20197
+ let t3;
20198
+ let val;
20199
+
20200
+ if (s === 0) {
20201
+ val = l * 255;
20202
+ return [val, val, val];
20203
+ }
20204
+
20205
+ if (l < 0.5) {
20206
+ t2 = l * (1 + s);
20207
+ } else {
20208
+ t2 = l + s - l * s;
20209
+ }
20210
+
20211
+ const t1 = 2 * l - t2;
20212
+
20213
+ const rgb = [0, 0, 0];
20214
+ for (let i = 0; i < 3; i++) {
20215
+ t3 = h + 1 / 3 * -(i - 1);
20216
+ if (t3 < 0) {
20217
+ t3++;
20218
+ }
20219
+
20220
+ if (t3 > 1) {
20221
+ t3--;
20222
+ }
20223
+
20224
+ if (6 * t3 < 1) {
20225
+ val = t1 + (t2 - t1) * 6 * t3;
20226
+ } else if (2 * t3 < 1) {
20227
+ val = t2;
20228
+ } else if (3 * t3 < 2) {
20229
+ val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
20230
+ } else {
20231
+ val = t1;
20232
+ }
20233
+
20234
+ rgb[i] = val * 255;
20235
+ }
20236
+
20237
+ return rgb;
20238
+ };
20239
+
20240
+ convert.hsl.hsv = function (hsl) {
20241
+ const h = hsl[0];
20242
+ let s = hsl[1] / 100;
20243
+ let l = hsl[2] / 100;
20244
+ let smin = s;
20245
+ const lmin = Math.max(l, 0.01);
20246
+
20247
+ l *= 2;
20248
+ s *= (l <= 1) ? l : 2 - l;
20249
+ smin *= lmin <= 1 ? lmin : 2 - lmin;
20250
+ const v = (l + s) / 2;
20251
+ const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
20252
+
20253
+ return [h, sv * 100, v * 100];
20254
+ };
20255
+
20256
+ convert.hsv.rgb = function (hsv) {
20257
+ const h = hsv[0] / 60;
20258
+ const s = hsv[1] / 100;
20259
+ let v = hsv[2] / 100;
20260
+ const hi = Math.floor(h) % 6;
20261
+
20262
+ const f = h - Math.floor(h);
20263
+ const p = 255 * v * (1 - s);
20264
+ const q = 255 * v * (1 - (s * f));
20265
+ const t = 255 * v * (1 - (s * (1 - f)));
20266
+ v *= 255;
20267
+
20268
+ switch (hi) {
20269
+ case 0:
20270
+ return [v, t, p];
20271
+ case 1:
20272
+ return [q, v, p];
20273
+ case 2:
20274
+ return [p, v, t];
20275
+ case 3:
20276
+ return [p, q, v];
20277
+ case 4:
20278
+ return [t, p, v];
20279
+ case 5:
20280
+ return [v, p, q];
20281
+ }
20282
+ };
20283
+
20284
+ convert.hsv.hsl = function (hsv) {
20285
+ const h = hsv[0];
20286
+ const s = hsv[1] / 100;
20287
+ const v = hsv[2] / 100;
20288
+ const vmin = Math.max(v, 0.01);
20289
+ let sl;
20290
+ let l;
20291
+
20292
+ l = (2 - s) * v;
20293
+ const lmin = (2 - s) * vmin;
20294
+ sl = s * vmin;
20295
+ sl /= (lmin <= 1) ? lmin : 2 - lmin;
20296
+ sl = sl || 0;
20297
+ l /= 2;
20298
+
20299
+ return [h, sl * 100, l * 100];
20300
+ };
20301
+
20302
+ // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
20303
+ convert.hwb.rgb = function (hwb) {
20304
+ const h = hwb[0] / 360;
20305
+ let wh = hwb[1] / 100;
20306
+ let bl = hwb[2] / 100;
20307
+ const ratio = wh + bl;
20308
+ let f;
20309
+
20310
+ // Wh + bl cant be > 1
20311
+ if (ratio > 1) {
20312
+ wh /= ratio;
20313
+ bl /= ratio;
20314
+ }
20315
+
20316
+ const i = Math.floor(6 * h);
20317
+ const v = 1 - bl;
20318
+ f = 6 * h - i;
20319
+
20320
+ if ((i & 0x01) !== 0) {
20321
+ f = 1 - f;
20322
+ }
20323
+
20324
+ const n = wh + f * (v - wh); // Linear interpolation
20325
+
20326
+ let r;
20327
+ let g;
20328
+ let b;
20329
+ /* eslint-disable max-statements-per-line,no-multi-spaces */
20330
+ switch (i) {
20331
+ default:
20332
+ case 6:
20333
+ case 0: r = v; g = n; b = wh; break;
20334
+ case 1: r = n; g = v; b = wh; break;
20335
+ case 2: r = wh; g = v; b = n; break;
20336
+ case 3: r = wh; g = n; b = v; break;
20337
+ case 4: r = n; g = wh; b = v; break;
20338
+ case 5: r = v; g = wh; b = n; break;
20339
+ }
20340
+ /* eslint-enable max-statements-per-line,no-multi-spaces */
20341
+
20342
+ return [r * 255, g * 255, b * 255];
20343
+ };
20344
+
20345
+ convert.cmyk.rgb = function (cmyk) {
20346
+ const c = cmyk[0] / 100;
20347
+ const m = cmyk[1] / 100;
20348
+ const y = cmyk[2] / 100;
20349
+ const k = cmyk[3] / 100;
20350
+
20351
+ const r = 1 - Math.min(1, c * (1 - k) + k);
20352
+ const g = 1 - Math.min(1, m * (1 - k) + k);
20353
+ const b = 1 - Math.min(1, y * (1 - k) + k);
20354
+
20355
+ return [r * 255, g * 255, b * 255];
20356
+ };
20357
+
20358
+ convert.xyz.rgb = function (xyz) {
20359
+ const x = xyz[0] / 100;
20360
+ const y = xyz[1] / 100;
20361
+ const z = xyz[2] / 100;
20362
+ let r;
20363
+ let g;
20364
+ let b;
20365
+
20366
+ r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
20367
+ g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
20368
+ b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
20369
+
20370
+ // Assume sRGB
20371
+ r = r > 0.0031308
20372
+ ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)
20373
+ : r * 12.92;
20374
+
20375
+ g = g > 0.0031308
20376
+ ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)
20377
+ : g * 12.92;
20378
+
20379
+ b = b > 0.0031308
20380
+ ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)
20381
+ : b * 12.92;
20382
+
20383
+ r = Math.min(Math.max(0, r), 1);
20384
+ g = Math.min(Math.max(0, g), 1);
20385
+ b = Math.min(Math.max(0, b), 1);
20386
+
20387
+ return [r * 255, g * 255, b * 255];
20388
+ };
20389
+
20390
+ convert.xyz.lab = function (xyz) {
20391
+ let x = xyz[0];
20392
+ let y = xyz[1];
20393
+ let z = xyz[2];
20394
+
20395
+ x /= 95.047;
20396
+ y /= 100;
20397
+ z /= 108.883;
20398
+
20399
+ x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
20400
+ y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
20401
+ z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
20402
+
20403
+ const l = (116 * y) - 16;
20404
+ const a = 500 * (x - y);
20405
+ const b = 200 * (y - z);
20406
+
20407
+ return [l, a, b];
20408
+ };
20409
+
20410
+ convert.lab.xyz = function (lab) {
20411
+ const l = lab[0];
20412
+ const a = lab[1];
20413
+ const b = lab[2];
20414
+ let x;
20415
+ let y;
20416
+ let z;
20417
+
20418
+ y = (l + 16) / 116;
20419
+ x = a / 500 + y;
20420
+ z = y - b / 200;
20421
+
20422
+ const y2 = y ** 3;
20423
+ const x2 = x ** 3;
20424
+ const z2 = z ** 3;
20425
+ y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
20426
+ x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
20427
+ z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
20428
+
20429
+ x *= 95.047;
20430
+ y *= 100;
20431
+ z *= 108.883;
20432
+
20433
+ return [x, y, z];
20434
+ };
20435
+
20436
+ convert.lab.lch = function (lab) {
20437
+ const l = lab[0];
20438
+ const a = lab[1];
20439
+ const b = lab[2];
20440
+ let h;
20441
+
20442
+ const hr = Math.atan2(b, a);
20443
+ h = hr * 360 / 2 / Math.PI;
20444
+
20445
+ if (h < 0) {
20446
+ h += 360;
20447
+ }
20448
+
20449
+ const c = Math.sqrt(a * a + b * b);
20450
+
20451
+ return [l, c, h];
20452
+ };
20453
+
20454
+ convert.lch.lab = function (lch) {
20455
+ const l = lch[0];
20456
+ const c = lch[1];
20457
+ const h = lch[2];
20458
+
20459
+ const hr = h / 360 * 2 * Math.PI;
20460
+ const a = c * Math.cos(hr);
20461
+ const b = c * Math.sin(hr);
20462
+
20463
+ return [l, a, b];
20464
+ };
20465
+
20466
+ convert.rgb.ansi16 = function (args, saturation = null) {
20467
+ const [r, g, b] = args;
20468
+ let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
20469
+
20470
+ value = Math.round(value / 50);
20471
+
20472
+ if (value === 0) {
20473
+ return 30;
20474
+ }
20475
+
20476
+ let ansi = 30
20477
+ + ((Math.round(b / 255) << 2)
20478
+ | (Math.round(g / 255) << 1)
20479
+ | Math.round(r / 255));
20480
+
20481
+ if (value === 2) {
20482
+ ansi += 60;
20483
+ }
20484
+
20485
+ return ansi;
20486
+ };
20487
+
20488
+ convert.hsv.ansi16 = function (args) {
20489
+ // Optimization here; we already know the value and don't need to get
20490
+ // it converted for us.
20491
+ return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
20492
+ };
20493
+
20494
+ convert.rgb.ansi256 = function (args) {
20495
+ const r = args[0];
20496
+ const g = args[1];
20497
+ const b = args[2];
20498
+
20499
+ // We use the extended greyscale palette here, with the exception of
20500
+ // black and white. normal palette only has 4 greyscale shades.
20501
+ if (r === g && g === b) {
20502
+ if (r < 8) {
20503
+ return 16;
20504
+ }
20505
+
20506
+ if (r > 248) {
20507
+ return 231;
20508
+ }
20509
+
20510
+ return Math.round(((r - 8) / 247) * 24) + 232;
20511
+ }
20512
+
20513
+ const ansi = 16
20514
+ + (36 * Math.round(r / 255 * 5))
20515
+ + (6 * Math.round(g / 255 * 5))
20516
+ + Math.round(b / 255 * 5);
20517
+
20518
+ return ansi;
20519
+ };
20520
+
20521
+ convert.ansi16.rgb = function (args) {
20522
+ let color = args % 10;
20523
+
20524
+ // Handle greyscale
20525
+ if (color === 0 || color === 7) {
20526
+ if (args > 50) {
20527
+ color += 3.5;
20528
+ }
20529
+
20530
+ color = color / 10.5 * 255;
20531
+
20532
+ return [color, color, color];
20533
+ }
20534
+
20535
+ const mult = (~~(args > 50) + 1) * 0.5;
20536
+ const r = ((color & 1) * mult) * 255;
20537
+ const g = (((color >> 1) & 1) * mult) * 255;
20538
+ const b = (((color >> 2) & 1) * mult) * 255;
20539
+
20540
+ return [r, g, b];
20541
+ };
20542
+
20543
+ convert.ansi256.rgb = function (args) {
20544
+ // Handle greyscale
20545
+ if (args >= 232) {
20546
+ const c = (args - 232) * 10 + 8;
20547
+ return [c, c, c];
20548
+ }
20549
+
20550
+ args -= 16;
20551
+
20552
+ let rem;
20553
+ const r = Math.floor(args / 36) / 5 * 255;
20554
+ const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
20555
+ const b = (rem % 6) / 5 * 255;
20556
+
20557
+ return [r, g, b];
20558
+ };
20559
+
20560
+ convert.rgb.hex = function (args) {
20561
+ const integer = ((Math.round(args[0]) & 0xFF) << 16)
20562
+ + ((Math.round(args[1]) & 0xFF) << 8)
20563
+ + (Math.round(args[2]) & 0xFF);
20564
+
20565
+ const string = integer.toString(16).toUpperCase();
20566
+ return '000000'.substring(string.length) + string;
20567
+ };
20568
+
20569
+ convert.hex.rgb = function (args) {
20570
+ const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
20571
+ if (!match) {
20572
+ return [0, 0, 0];
20573
+ }
20574
+
20575
+ let colorString = match[0];
20576
+
20577
+ if (match[0].length === 3) {
20578
+ colorString = colorString.split('').map(char => {
20579
+ return char + char;
20580
+ }).join('');
20581
+ }
20582
+
20583
+ const integer = parseInt(colorString, 16);
20584
+ const r = (integer >> 16) & 0xFF;
20585
+ const g = (integer >> 8) & 0xFF;
20586
+ const b = integer & 0xFF;
20587
+
20588
+ return [r, g, b];
20589
+ };
20590
+
20591
+ convert.rgb.hcg = function (rgb) {
20592
+ const r = rgb[0] / 255;
20593
+ const g = rgb[1] / 255;
20594
+ const b = rgb[2] / 255;
20595
+ const max = Math.max(Math.max(r, g), b);
20596
+ const min = Math.min(Math.min(r, g), b);
20597
+ const chroma = (max - min);
20598
+ let grayscale;
20599
+ let hue;
20600
+
20601
+ if (chroma < 1) {
20602
+ grayscale = min / (1 - chroma);
20603
+ } else {
20604
+ grayscale = 0;
20605
+ }
20606
+
20607
+ if (chroma <= 0) {
20608
+ hue = 0;
20609
+ } else
20610
+ if (max === r) {
20611
+ hue = ((g - b) / chroma) % 6;
20612
+ } else
20613
+ if (max === g) {
20614
+ hue = 2 + (b - r) / chroma;
20615
+ } else {
20616
+ hue = 4 + (r - g) / chroma;
20617
+ }
20618
+
20619
+ hue /= 6;
20620
+ hue %= 1;
20621
+
20622
+ return [hue * 360, chroma * 100, grayscale * 100];
20623
+ };
20624
+
20625
+ convert.hsl.hcg = function (hsl) {
20626
+ const s = hsl[1] / 100;
20627
+ const l = hsl[2] / 100;
20628
+
20629
+ const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));
20630
+
20631
+ let f = 0;
20632
+ if (c < 1.0) {
20633
+ f = (l - 0.5 * c) / (1.0 - c);
20634
+ }
20635
+
20636
+ return [hsl[0], c * 100, f * 100];
20637
+ };
20638
+
20639
+ convert.hsv.hcg = function (hsv) {
20640
+ const s = hsv[1] / 100;
20641
+ const v = hsv[2] / 100;
20642
+
20643
+ const c = s * v;
20644
+ let f = 0;
20645
+
20646
+ if (c < 1.0) {
20647
+ f = (v - c) / (1 - c);
20648
+ }
20649
+
20650
+ return [hsv[0], c * 100, f * 100];
20651
+ };
20652
+
20653
+ convert.hcg.rgb = function (hcg) {
20654
+ const h = hcg[0] / 360;
20655
+ const c = hcg[1] / 100;
20656
+ const g = hcg[2] / 100;
20657
+
20658
+ if (c === 0.0) {
20659
+ return [g * 255, g * 255, g * 255];
20660
+ }
20661
+
20662
+ const pure = [0, 0, 0];
20663
+ const hi = (h % 1) * 6;
20664
+ const v = hi % 1;
20665
+ const w = 1 - v;
20666
+ let mg = 0;
20667
+
20668
+ /* eslint-disable max-statements-per-line */
20669
+ switch (Math.floor(hi)) {
20670
+ case 0:
20671
+ pure[0] = 1; pure[1] = v; pure[2] = 0; break;
20672
+ case 1:
20673
+ pure[0] = w; pure[1] = 1; pure[2] = 0; break;
20674
+ case 2:
20675
+ pure[0] = 0; pure[1] = 1; pure[2] = v; break;
20676
+ case 3:
20677
+ pure[0] = 0; pure[1] = w; pure[2] = 1; break;
20678
+ case 4:
20679
+ pure[0] = v; pure[1] = 0; pure[2] = 1; break;
20680
+ default:
20681
+ pure[0] = 1; pure[1] = 0; pure[2] = w;
20682
+ }
20683
+ /* eslint-enable max-statements-per-line */
20684
+
20685
+ mg = (1.0 - c) * g;
20686
+
20687
+ return [
20688
+ (c * pure[0] + mg) * 255,
20689
+ (c * pure[1] + mg) * 255,
20690
+ (c * pure[2] + mg) * 255
20691
+ ];
20692
+ };
20693
+
20694
+ convert.hcg.hsv = function (hcg) {
20695
+ const c = hcg[1] / 100;
20696
+ const g = hcg[2] / 100;
20697
+
20698
+ const v = c + g * (1.0 - c);
20699
+ let f = 0;
20700
+
20701
+ if (v > 0.0) {
20702
+ f = c / v;
20703
+ }
20704
+
20705
+ return [hcg[0], f * 100, v * 100];
20706
+ };
20707
+
20708
+ convert.hcg.hsl = function (hcg) {
20709
+ const c = hcg[1] / 100;
20710
+ const g = hcg[2] / 100;
20711
+
20712
+ const l = g * (1.0 - c) + 0.5 * c;
20713
+ let s = 0;
20714
+
20715
+ if (l > 0.0 && l < 0.5) {
20716
+ s = c / (2 * l);
20717
+ } else
20718
+ if (l >= 0.5 && l < 1.0) {
20719
+ s = c / (2 * (1 - l));
20720
+ }
20721
+
20722
+ return [hcg[0], s * 100, l * 100];
20723
+ };
20724
+
20725
+ convert.hcg.hwb = function (hcg) {
20726
+ const c = hcg[1] / 100;
20727
+ const g = hcg[2] / 100;
20728
+ const v = c + g * (1.0 - c);
20729
+ return [hcg[0], (v - c) * 100, (1 - v) * 100];
20730
+ };
20731
+
20732
+ convert.hwb.hcg = function (hwb) {
20733
+ const w = hwb[1] / 100;
20734
+ const b = hwb[2] / 100;
20735
+ const v = 1 - b;
20736
+ const c = v - w;
20737
+ let g = 0;
20738
+
20739
+ if (c < 1) {
20740
+ g = (v - c) / (1 - c);
20741
+ }
20742
+
20743
+ return [hwb[0], c * 100, g * 100];
20744
+ };
20745
+
20746
+ convert.apple.rgb = function (apple) {
20747
+ return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
20748
+ };
20749
+
20750
+ convert.rgb.apple = function (rgb) {
20751
+ return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
20752
+ };
20753
+
20754
+ convert.gray.rgb = function (args) {
20755
+ return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
20756
+ };
20757
+
20758
+ convert.gray.hsl = function (args) {
20759
+ return [0, 0, args[0]];
20760
+ };
20761
+
20762
+ convert.gray.hsv = convert.gray.hsl;
20763
+
20764
+ convert.gray.hwb = function (gray) {
20765
+ return [0, 100, gray[0]];
20766
+ };
20767
+
20768
+ convert.gray.cmyk = function (gray) {
20769
+ return [0, 0, 0, gray[0]];
20770
+ };
20771
+
20772
+ convert.gray.lab = function (gray) {
20773
+ return [gray[0], 0, 0];
20774
+ };
20775
+
20776
+ convert.gray.hex = function (gray) {
20777
+ const val = Math.round(gray[0] / 100 * 255) & 0xFF;
20778
+ const integer = (val << 16) + (val << 8) + val;
20779
+
20780
+ const string = integer.toString(16).toUpperCase();
20781
+ return '000000'.substring(string.length) + string;
20782
+ };
20783
+
20784
+ convert.rgb.gray = function (rgb) {
20785
+ const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
20786
+ return [val / 255 * 100];
20787
+ };
20788
+
20789
+
20790
+ /***/ }),
20791
+
20792
+ /***/ 6931:
20793
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
20794
+
20795
+ const conversions = __nccwpck_require__(7391);
20796
+ const route = __nccwpck_require__(221);
20797
+
20798
+ const convert = {};
20799
+
20800
+ const models = Object.keys(conversions);
20801
+
20802
+ function wrapRaw(fn) {
20803
+ const wrappedFn = function (...args) {
20804
+ const arg0 = args[0];
20805
+ if (arg0 === undefined || arg0 === null) {
20806
+ return arg0;
20807
+ }
20808
+
20809
+ if (arg0.length > 1) {
20810
+ args = arg0;
20811
+ }
20812
+
20813
+ return fn(args);
20814
+ };
20815
+
20816
+ // Preserve .conversion property if there is one
20817
+ if ('conversion' in fn) {
20818
+ wrappedFn.conversion = fn.conversion;
20819
+ }
20820
+
20821
+ return wrappedFn;
20822
+ }
20823
+
20824
+ function wrapRounded(fn) {
20825
+ const wrappedFn = function (...args) {
20826
+ const arg0 = args[0];
20827
+
20828
+ if (arg0 === undefined || arg0 === null) {
20829
+ return arg0;
20830
+ }
20831
+
20832
+ if (arg0.length > 1) {
20833
+ args = arg0;
20834
+ }
20835
+
20836
+ const result = fn(args);
20837
+
20838
+ // We're assuming the result is an array here.
20839
+ // see notice in conversions.js; don't use box types
20840
+ // in conversion functions.
20841
+ if (typeof result === 'object') {
20842
+ for (let len = result.length, i = 0; i < len; i++) {
20843
+ result[i] = Math.round(result[i]);
20844
+ }
20845
+ }
20846
+
20847
+ return result;
20848
+ };
20849
+
20850
+ // Preserve .conversion property if there is one
20851
+ if ('conversion' in fn) {
20852
+ wrappedFn.conversion = fn.conversion;
20853
+ }
20854
+
20855
+ return wrappedFn;
20856
+ }
20857
+
20858
+ models.forEach(fromModel => {
20859
+ convert[fromModel] = {};
20860
+
20861
+ Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
20862
+ Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
20863
+
20864
+ const routes = route(fromModel);
20865
+ const routeModels = Object.keys(routes);
20866
+
20867
+ routeModels.forEach(toModel => {
20868
+ const fn = routes[toModel];
20869
+
20870
+ convert[fromModel][toModel] = wrapRounded(fn);
20871
+ convert[fromModel][toModel].raw = wrapRaw(fn);
20872
+ });
20873
+ });
20874
+
20875
+ module.exports = convert;
20876
+
20877
+
20878
+ /***/ }),
20879
+
20880
+ /***/ 221:
20881
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
20882
+
20883
+ const conversions = __nccwpck_require__(7391);
20884
+
20885
+ /*
20886
+ This function routes a model to all other models.
20887
+
20888
+ all functions that are routed have a property `.conversion` attached
20889
+ to the returned synthetic function. This property is an array
20890
+ of strings, each with the steps in between the 'from' and 'to'
20891
+ color models (inclusive).
20892
+
20893
+ conversions that are not possible simply are not included.
20894
+ */
20895
+
20896
+ function buildGraph() {
20897
+ const graph = {};
20898
+ // https://jsperf.com/object-keys-vs-for-in-with-closure/3
20899
+ const models = Object.keys(conversions);
20900
+
20901
+ for (let len = models.length, i = 0; i < len; i++) {
20902
+ graph[models[i]] = {
20903
+ // http://jsperf.com/1-vs-infinity
20904
+ // micro-opt, but this is simple.
20905
+ distance: -1,
20906
+ parent: null
20907
+ };
20908
+ }
20909
+
20910
+ return graph;
20911
+ }
20912
+
20913
+ // https://en.wikipedia.org/wiki/Breadth-first_search
20914
+ function deriveBFS(fromModel) {
20915
+ const graph = buildGraph();
20916
+ const queue = [fromModel]; // Unshift -> queue -> pop
20917
+
20918
+ graph[fromModel].distance = 0;
20919
+
20920
+ while (queue.length) {
20921
+ const current = queue.pop();
20922
+ const adjacents = Object.keys(conversions[current]);
20923
+
20924
+ for (let len = adjacents.length, i = 0; i < len; i++) {
20925
+ const adjacent = adjacents[i];
20926
+ const node = graph[adjacent];
20927
+
20928
+ if (node.distance === -1) {
20929
+ node.distance = graph[current].distance + 1;
20930
+ node.parent = current;
20931
+ queue.unshift(adjacent);
20932
+ }
20933
+ }
20934
+ }
20935
+
20936
+ return graph;
20937
+ }
20938
+
20939
+ function link(from, to) {
20940
+ return function (args) {
20941
+ return to(from(args));
20942
+ };
20943
+ }
20944
+
20945
+ function wrapConversion(toModel, graph) {
20946
+ const path = [graph[toModel].parent, toModel];
20947
+ let fn = conversions[graph[toModel].parent][toModel];
20948
+
20949
+ let cur = graph[toModel].parent;
20950
+ while (graph[cur].parent) {
20951
+ path.unshift(graph[cur].parent);
20952
+ fn = link(conversions[graph[cur].parent][cur], fn);
20953
+ cur = graph[cur].parent;
20954
+ }
20955
+
20956
+ fn.conversion = path;
20957
+ return fn;
20958
+ }
20959
+
20960
+ module.exports = function (fromModel) {
20961
+ const graph = deriveBFS(fromModel);
20962
+ const conversion = {};
20963
+
20964
+ const models = Object.keys(graph);
20965
+ for (let len = models.length, i = 0; i < len; i++) {
20966
+ const toModel = models[i];
20967
+ const node = graph[toModel];
20968
+
20969
+ if (node.parent === null) {
20970
+ // No possible conversion, or this node is the source model.
20971
+ continue;
20972
+ }
20973
+
20974
+ conversion[toModel] = wrapConversion(toModel, graph);
20975
+ }
20976
+
20977
+ return conversion;
20978
+ };
20979
+
20980
+
20981
+
20982
+ /***/ }),
20983
+
20984
+ /***/ 8510:
20985
+ /***/ ((module) => {
20986
+
20987
+ "use strict";
20988
+
20989
+
20990
+ module.exports = {
20991
+ "aliceblue": [240, 248, 255],
20992
+ "antiquewhite": [250, 235, 215],
20993
+ "aqua": [0, 255, 255],
20994
+ "aquamarine": [127, 255, 212],
20995
+ "azure": [240, 255, 255],
20996
+ "beige": [245, 245, 220],
20997
+ "bisque": [255, 228, 196],
20998
+ "black": [0, 0, 0],
20999
+ "blanchedalmond": [255, 235, 205],
21000
+ "blue": [0, 0, 255],
21001
+ "blueviolet": [138, 43, 226],
21002
+ "brown": [165, 42, 42],
21003
+ "burlywood": [222, 184, 135],
21004
+ "cadetblue": [95, 158, 160],
21005
+ "chartreuse": [127, 255, 0],
21006
+ "chocolate": [210, 105, 30],
21007
+ "coral": [255, 127, 80],
21008
+ "cornflowerblue": [100, 149, 237],
21009
+ "cornsilk": [255, 248, 220],
21010
+ "crimson": [220, 20, 60],
21011
+ "cyan": [0, 255, 255],
21012
+ "darkblue": [0, 0, 139],
21013
+ "darkcyan": [0, 139, 139],
21014
+ "darkgoldenrod": [184, 134, 11],
21015
+ "darkgray": [169, 169, 169],
21016
+ "darkgreen": [0, 100, 0],
21017
+ "darkgrey": [169, 169, 169],
21018
+ "darkkhaki": [189, 183, 107],
21019
+ "darkmagenta": [139, 0, 139],
21020
+ "darkolivegreen": [85, 107, 47],
21021
+ "darkorange": [255, 140, 0],
21022
+ "darkorchid": [153, 50, 204],
21023
+ "darkred": [139, 0, 0],
21024
+ "darksalmon": [233, 150, 122],
21025
+ "darkseagreen": [143, 188, 143],
21026
+ "darkslateblue": [72, 61, 139],
21027
+ "darkslategray": [47, 79, 79],
21028
+ "darkslategrey": [47, 79, 79],
21029
+ "darkturquoise": [0, 206, 209],
21030
+ "darkviolet": [148, 0, 211],
21031
+ "deeppink": [255, 20, 147],
21032
+ "deepskyblue": [0, 191, 255],
21033
+ "dimgray": [105, 105, 105],
21034
+ "dimgrey": [105, 105, 105],
21035
+ "dodgerblue": [30, 144, 255],
21036
+ "firebrick": [178, 34, 34],
21037
+ "floralwhite": [255, 250, 240],
21038
+ "forestgreen": [34, 139, 34],
21039
+ "fuchsia": [255, 0, 255],
21040
+ "gainsboro": [220, 220, 220],
21041
+ "ghostwhite": [248, 248, 255],
21042
+ "gold": [255, 215, 0],
21043
+ "goldenrod": [218, 165, 32],
21044
+ "gray": [128, 128, 128],
21045
+ "green": [0, 128, 0],
21046
+ "greenyellow": [173, 255, 47],
21047
+ "grey": [128, 128, 128],
21048
+ "honeydew": [240, 255, 240],
21049
+ "hotpink": [255, 105, 180],
21050
+ "indianred": [205, 92, 92],
21051
+ "indigo": [75, 0, 130],
21052
+ "ivory": [255, 255, 240],
21053
+ "khaki": [240, 230, 140],
21054
+ "lavender": [230, 230, 250],
21055
+ "lavenderblush": [255, 240, 245],
21056
+ "lawngreen": [124, 252, 0],
21057
+ "lemonchiffon": [255, 250, 205],
21058
+ "lightblue": [173, 216, 230],
21059
+ "lightcoral": [240, 128, 128],
21060
+ "lightcyan": [224, 255, 255],
21061
+ "lightgoldenrodyellow": [250, 250, 210],
21062
+ "lightgray": [211, 211, 211],
21063
+ "lightgreen": [144, 238, 144],
21064
+ "lightgrey": [211, 211, 211],
21065
+ "lightpink": [255, 182, 193],
21066
+ "lightsalmon": [255, 160, 122],
21067
+ "lightseagreen": [32, 178, 170],
21068
+ "lightskyblue": [135, 206, 250],
21069
+ "lightslategray": [119, 136, 153],
21070
+ "lightslategrey": [119, 136, 153],
21071
+ "lightsteelblue": [176, 196, 222],
21072
+ "lightyellow": [255, 255, 224],
21073
+ "lime": [0, 255, 0],
21074
+ "limegreen": [50, 205, 50],
21075
+ "linen": [250, 240, 230],
21076
+ "magenta": [255, 0, 255],
21077
+ "maroon": [128, 0, 0],
21078
+ "mediumaquamarine": [102, 205, 170],
21079
+ "mediumblue": [0, 0, 205],
21080
+ "mediumorchid": [186, 85, 211],
21081
+ "mediumpurple": [147, 112, 219],
21082
+ "mediumseagreen": [60, 179, 113],
21083
+ "mediumslateblue": [123, 104, 238],
21084
+ "mediumspringgreen": [0, 250, 154],
21085
+ "mediumturquoise": [72, 209, 204],
21086
+ "mediumvioletred": [199, 21, 133],
21087
+ "midnightblue": [25, 25, 112],
21088
+ "mintcream": [245, 255, 250],
21089
+ "mistyrose": [255, 228, 225],
21090
+ "moccasin": [255, 228, 181],
21091
+ "navajowhite": [255, 222, 173],
21092
+ "navy": [0, 0, 128],
21093
+ "oldlace": [253, 245, 230],
21094
+ "olive": [128, 128, 0],
21095
+ "olivedrab": [107, 142, 35],
21096
+ "orange": [255, 165, 0],
21097
+ "orangered": [255, 69, 0],
21098
+ "orchid": [218, 112, 214],
21099
+ "palegoldenrod": [238, 232, 170],
21100
+ "palegreen": [152, 251, 152],
21101
+ "paleturquoise": [175, 238, 238],
21102
+ "palevioletred": [219, 112, 147],
21103
+ "papayawhip": [255, 239, 213],
21104
+ "peachpuff": [255, 218, 185],
21105
+ "peru": [205, 133, 63],
21106
+ "pink": [255, 192, 203],
21107
+ "plum": [221, 160, 221],
21108
+ "powderblue": [176, 224, 230],
21109
+ "purple": [128, 0, 128],
21110
+ "rebeccapurple": [102, 51, 153],
21111
+ "red": [255, 0, 0],
21112
+ "rosybrown": [188, 143, 143],
21113
+ "royalblue": [65, 105, 225],
21114
+ "saddlebrown": [139, 69, 19],
21115
+ "salmon": [250, 128, 114],
21116
+ "sandybrown": [244, 164, 96],
21117
+ "seagreen": [46, 139, 87],
21118
+ "seashell": [255, 245, 238],
21119
+ "sienna": [160, 82, 45],
21120
+ "silver": [192, 192, 192],
21121
+ "skyblue": [135, 206, 235],
21122
+ "slateblue": [106, 90, 205],
21123
+ "slategray": [112, 128, 144],
21124
+ "slategrey": [112, 128, 144],
21125
+ "snow": [255, 250, 250],
21126
+ "springgreen": [0, 255, 127],
21127
+ "steelblue": [70, 130, 180],
21128
+ "tan": [210, 180, 140],
21129
+ "teal": [0, 128, 128],
21130
+ "thistle": [216, 191, 216],
21131
+ "tomato": [255, 99, 71],
21132
+ "turquoise": [64, 224, 208],
21133
+ "violet": [238, 130, 238],
21134
+ "wheat": [245, 222, 179],
21135
+ "white": [255, 255, 255],
21136
+ "whitesmoke": [245, 245, 245],
21137
+ "yellow": [255, 255, 0],
21138
+ "yellowgreen": [154, 205, 50]
21139
+ };
21140
+
21141
+
19337
21142
  /***/ }),
19338
21143
 
19339
21144
  /***/ 4697:
@@ -51257,8 +53062,8 @@ module.exports = {"i8":"3.0.2"};
51257
53062
  /******/ }
51258
53063
  /******/ // Create a new module (and put it into the cache)
51259
53064
  /******/ var module = __webpack_module_cache__[moduleId] = {
51260
- /******/ // no module.id needed
51261
- /******/ // no module.loaded needed
53065
+ /******/ id: moduleId,
53066
+ /******/ loaded: false,
51262
53067
  /******/ exports: {}
51263
53068
  /******/ };
51264
53069
  /******/
@@ -51271,6 +53076,9 @@ module.exports = {"i8":"3.0.2"};
51271
53076
  /******/ if(threw) delete __webpack_module_cache__[moduleId];
51272
53077
  /******/ }
51273
53078
  /******/
53079
+ /******/ // Flag the module as loaded
53080
+ /******/ module.loaded = true;
53081
+ /******/
51274
53082
  /******/ // Return the exports of the module
51275
53083
  /******/ return module.exports;
51276
53084
  /******/ }
@@ -51316,6 +53124,15 @@ module.exports = {"i8":"3.0.2"};
51316
53124
  /******/ };
51317
53125
  /******/ })();
51318
53126
  /******/
53127
+ /******/ /* webpack/runtime/node module decorator */
53128
+ /******/ (() => {
53129
+ /******/ __nccwpck_require__.nmd = (module) => {
53130
+ /******/ module.paths = [];
53131
+ /******/ if (!module.children) module.children = [];
53132
+ /******/ return module;
53133
+ /******/ };
53134
+ /******/ })();
53135
+ /******/
51319
53136
  /******/ /* webpack/runtime/compat */
51320
53137
  /******/
51321
53138
  /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";