css-color-parser-h 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,41 +1,21 @@
1
1
  /******/ (function() { // webpackBootstrap
2
2
  /******/ "use strict";
3
- /******/ var __webpack_modules__ = ({
4
-
5
- /***/ 819:
6
- /***/ (function(module) {
7
-
8
- module.exports = require("color-convert");
9
-
10
- /***/ })
11
-
12
- /******/ });
13
- /************************************************************************/
14
- /******/ // The module cache
15
- /******/ var __webpack_module_cache__ = {};
3
+ /******/ // The require scope
4
+ /******/ var __webpack_require__ = {};
16
5
  /******/
17
- /******/ // The require function
18
- /******/ function __webpack_require__(moduleId) {
19
- /******/ // Check if module is in cache
20
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
21
- /******/ if (cachedModule !== undefined) {
22
- /******/ return cachedModule.exports;
23
- /******/ }
24
- /******/ // Create a new module (and put it into the cache)
25
- /******/ var module = __webpack_module_cache__[moduleId] = {
26
- /******/ // no module.id needed
27
- /******/ // no module.loaded needed
28
- /******/ exports: {}
6
+ /************************************************************************/
7
+ /******/ /* webpack/runtime/compat get default export */
8
+ /******/ !function() {
9
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
10
+ /******/ __webpack_require__.n = function(module) {
11
+ /******/ var getter = module && module.__esModule ?
12
+ /******/ function() { return module['default']; } :
13
+ /******/ function() { return module; };
14
+ /******/ __webpack_require__.d(getter, { a: getter });
15
+ /******/ return getter;
29
16
  /******/ };
17
+ /******/ }();
30
18
  /******/
31
- /******/ // Execute the module function
32
- /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
33
- /******/
34
- /******/ // Return the exports of the module
35
- /******/ return module.exports;
36
- /******/ }
37
- /******/
38
- /************************************************************************/
39
19
  /******/ /* webpack/runtime/define property getters */
40
20
  /******/ !function() {
41
21
  /******/ // define getter functions for harmony exports
@@ -66,28 +46,34 @@ module.exports = require("color-convert");
66
46
  /******/
67
47
  /************************************************************************/
68
48
  var __webpack_exports__ = {};
69
- // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
70
- !function() {
71
49
  // ESM COMPAT FLAG
72
50
  __webpack_require__.r(__webpack_exports__);
73
51
 
74
52
  // EXPORTS
75
53
  __webpack_require__.d(__webpack_exports__, {
76
- "CssColorParser": function() { return /* reexport */ src_CssColorParser; },
77
- "fromArray": function() { return /* reexport */ fromArray; },
78
- "fromColorStr": function() { return /* reexport */ fromColorStr; },
79
- "fromHSL": function() { return /* reexport */ fromHSL; },
80
- "fromHWB": function() { return /* reexport */ fromHWB; },
81
- "fromJson": function() { return /* reexport */ fromJson; },
82
- "fromRandom": function() { return /* reexport */ fromRandom; },
83
- "parseCssColorStr": function() { return /* reexport */ parseCssColorStr; },
84
- "parseHEX": function() { return /* reexport */ parseHEX; },
85
- "parseHSLA": function() { return /* reexport */ parseHSLA; },
86
- "parseHWB": function() { return /* reexport */ parseHWB; },
87
- "parseKeyWord": function() { return /* reexport */ parseKeyWord; },
88
- "parseRGBA": function() { return /* reexport */ parseRGBA; }
54
+ "default": function() { return /* binding */ main; }
55
+ });
56
+
57
+ // NAMESPACE OBJECT: ./src/utils/parsers.ts
58
+ var parsers_namespaceObject = {};
59
+ __webpack_require__.r(parsers_namespaceObject);
60
+ __webpack_require__.d(parsers_namespaceObject, {
61
+ "fromArray": function() { return fromArray; },
62
+ "fromColorStr": function() { return fromColorStr; },
63
+ "fromHSL": function() { return fromHSL; },
64
+ "fromHWB": function() { return fromHWB; },
65
+ "fromJson": function() { return fromJson; },
66
+ "fromRandom": function() { return fromRandom; },
67
+ "parseCssColorStr": function() { return parseCssColorStr; },
68
+ "parseHEX": function() { return parseHEX; },
69
+ "parseHSLA": function() { return parseHSLA; },
70
+ "parseHWB": function() { return parseHWB; },
71
+ "parseKeyWord": function() { return parseKeyWord; },
72
+ "parseRGBA": function() { return parseRGBA; }
89
73
  });
90
74
 
75
+ ;// CONCATENATED MODULE: external "tslib"
76
+ var external_tslib_namespaceObject = require("tslib");
91
77
  ;// CONCATENATED MODULE: ./src/utils/common.ts
92
78
  var Check = /** @class */ (function () {
93
79
  function Check() {
@@ -426,14 +412,17 @@ var CssColorStringParser = /** @class */ (function () {
426
412
  }());
427
413
 
428
414
 
429
- ;// CONCATENATED MODULE: ./src/utils/parsers/parsers.ts
415
+ ;// CONCATENATED MODULE: external "color-convert"
416
+ var external_color_convert_namespaceObject = require("color-convert");
417
+ var external_color_convert_default = /*#__PURE__*/__webpack_require__.n(external_color_convert_namespaceObject);
418
+ ;// CONCATENATED MODULE: ./src/utils/parsers.ts
419
+
430
420
 
431
421
 
432
422
 
433
- var convert = __webpack_require__(819);
434
423
  function parseKeyWord(v) {
435
424
  var cssStr = CssColorStringParser.clearStrSpace(v);
436
- var res = convert.keyword.rgb(cssStr);
425
+ var res = external_color_convert_default().keyword.rgb(cssStr);
437
426
  return res && fromArray(res);
438
427
  }
439
428
  function parseHEX(v) {
@@ -499,7 +488,7 @@ function fromColorStr(v) {
499
488
  * @example: fromHSL(0,1,1,1)
500
489
  */
501
490
  function fromHSL(h, s, l, a) {
502
- var res = convert.hsl.rgb(limitNumber(0, 360, h), limitNumber(0, 100, s * 100), limitNumber(0, 100, l * 100));
491
+ var res = external_color_convert_default().hsl.rgb(limitNumber(0, 360, h), limitNumber(0, 100, s * 100), limitNumber(0, 100, l * 100));
503
492
  return new src_CssColorParser(res[0], res[1], res[2], defaultValue(Number(a), 1));
504
493
  }
505
494
  /**
@@ -512,7 +501,7 @@ function fromHSL(h, s, l, a) {
512
501
  * @example: fromHSL(0,1,1,1)
513
502
  */
514
503
  function fromHWB(h, w, b, a) {
515
- var res = convert.hwb.rgb(limitNumber(0, 360, h), limitNumber(0, 100, w * 100), limitNumber(0, 100, b * 100));
504
+ var res = external_color_convert_default().hwb.rgb(limitNumber(0, 360, h), limitNumber(0, 100, w * 100), limitNumber(0, 100, b * 100));
516
505
  return new src_CssColorParser(res[0], res[1], res[2], defaultValue(Number(a), 1));
517
506
  }
518
507
  /**
@@ -560,17 +549,17 @@ function fromArray(color) {
560
549
  }
561
550
 
562
551
  ;// CONCATENATED MODULE: ./src/main.ts
552
+
563
553
  /*
564
554
  * @Author: roman_123
565
555
  * @Description:
566
556
  * @Date: 2023-05-25 17:45:22
567
- * @LastEditTime: 2023-05-26 11:17:48
557
+ * @LastEditTime: 2023-05-26 15:01:18
568
558
  */
569
559
 
570
560
 
571
-
561
+ /* harmony default export */ var main = ((0,external_tslib_namespaceObject.__assign)({ CssColorParser: src_CssColorParser }, parsers_namespaceObject));
572
562
 
573
- }();
574
563
  var __webpack_export_target__ = exports;
575
564
  for(var i in __webpack_exports__) __webpack_export_target__[i] = __webpack_exports__[i];
576
565
  if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true });
@@ -1132,6 +1132,18 @@ module.exports = {
1132
1132
  /******/ }
1133
1133
  /******/
1134
1134
  /************************************************************************/
1135
+ /******/ /* webpack/runtime/compat get default export */
1136
+ /******/ !function() {
1137
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
1138
+ /******/ __webpack_require__.n = function(module) {
1139
+ /******/ var getter = module && module.__esModule ?
1140
+ /******/ function() { return module['default']; } :
1141
+ /******/ function() { return module; };
1142
+ /******/ __webpack_require__.d(getter, { a: getter });
1143
+ /******/ return getter;
1144
+ /******/ };
1145
+ /******/ }();
1146
+ /******/
1135
1147
  /******/ /* webpack/runtime/define property getters */
1136
1148
  /******/ !function() {
1137
1149
  /******/ // define getter functions for harmony exports
@@ -1170,21 +1182,498 @@ __webpack_require__.r(__webpack_exports__);
1170
1182
 
1171
1183
  // EXPORTS
1172
1184
  __webpack_require__.d(__webpack_exports__, {
1173
- "CssColorParser": function() { return /* reexport */ src_CssColorParser; },
1174
- "fromArray": function() { return /* reexport */ fromArray; },
1175
- "fromColorStr": function() { return /* reexport */ fromColorStr; },
1176
- "fromHSL": function() { return /* reexport */ fromHSL; },
1177
- "fromHWB": function() { return /* reexport */ fromHWB; },
1178
- "fromJson": function() { return /* reexport */ fromJson; },
1179
- "fromRandom": function() { return /* reexport */ fromRandom; },
1180
- "parseCssColorStr": function() { return /* reexport */ parseCssColorStr; },
1181
- "parseHEX": function() { return /* reexport */ parseHEX; },
1182
- "parseHSLA": function() { return /* reexport */ parseHSLA; },
1183
- "parseHWB": function() { return /* reexport */ parseHWB; },
1184
- "parseKeyWord": function() { return /* reexport */ parseKeyWord; },
1185
- "parseRGBA": function() { return /* reexport */ parseRGBA; }
1185
+ "default": function() { return /* binding */ main; }
1186
1186
  });
1187
1187
 
1188
+ // NAMESPACE OBJECT: ./src/utils/parsers.ts
1189
+ var parsers_namespaceObject = {};
1190
+ __webpack_require__.r(parsers_namespaceObject);
1191
+ __webpack_require__.d(parsers_namespaceObject, {
1192
+ "fromArray": function() { return fromArray; },
1193
+ "fromColorStr": function() { return fromColorStr; },
1194
+ "fromHSL": function() { return fromHSL; },
1195
+ "fromHWB": function() { return fromHWB; },
1196
+ "fromJson": function() { return fromJson; },
1197
+ "fromRandom": function() { return fromRandom; },
1198
+ "parseCssColorStr": function() { return parseCssColorStr; },
1199
+ "parseHEX": function() { return parseHEX; },
1200
+ "parseHSLA": function() { return parseHSLA; },
1201
+ "parseHWB": function() { return parseHWB; },
1202
+ "parseKeyWord": function() { return parseKeyWord; },
1203
+ "parseRGBA": function() { return parseRGBA; }
1204
+ });
1205
+
1206
+ ;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.js
1207
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1208
+ /******************************************************************************
1209
+ Copyright (c) Microsoft Corporation.
1210
+
1211
+ Permission to use, copy, modify, and/or distribute this software for any
1212
+ purpose with or without fee is hereby granted.
1213
+
1214
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1215
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1216
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1217
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1218
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1219
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1220
+ PERFORMANCE OF THIS SOFTWARE.
1221
+ ***************************************************************************** */
1222
+ /* global Reflect, Promise */
1223
+
1224
+ var _extendStatics = function extendStatics(d, b) {
1225
+ _extendStatics = Object.setPrototypeOf || {
1226
+ __proto__: []
1227
+ } instanceof Array && function (d, b) {
1228
+ d.__proto__ = b;
1229
+ } || function (d, b) {
1230
+ for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
1231
+ };
1232
+ return _extendStatics(d, b);
1233
+ };
1234
+ function __extends(d, b) {
1235
+ if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
1236
+ _extendStatics(d, b);
1237
+ function __() {
1238
+ this.constructor = d;
1239
+ }
1240
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1241
+ }
1242
+ var _assign = function __assign() {
1243
+ _assign = Object.assign || function __assign(t) {
1244
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
1245
+ s = arguments[i];
1246
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
1247
+ }
1248
+ return t;
1249
+ };
1250
+ return _assign.apply(this, arguments);
1251
+ };
1252
+
1253
+ function __rest(s, e) {
1254
+ var t = {};
1255
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
1256
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1257
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
1258
+ }
1259
+ return t;
1260
+ }
1261
+ function __decorate(decorators, target, key, desc) {
1262
+ var c = arguments.length,
1263
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
1264
+ d;
1265
+ if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1266
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1267
+ }
1268
+ function __param(paramIndex, decorator) {
1269
+ return function (target, key) {
1270
+ decorator(target, key, paramIndex);
1271
+ };
1272
+ }
1273
+ function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
1274
+ function accept(f) {
1275
+ if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected");
1276
+ return f;
1277
+ }
1278
+ var kind = contextIn.kind,
1279
+ key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
1280
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
1281
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
1282
+ var _,
1283
+ done = false;
1284
+ for (var i = decorators.length - 1; i >= 0; i--) {
1285
+ var context = {};
1286
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
1287
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
1288
+ context.addInitializer = function (f) {
1289
+ if (done) throw new TypeError("Cannot add initializers after decoration has completed");
1290
+ extraInitializers.push(accept(f || null));
1291
+ };
1292
+ var result = (0, decorators[i])(kind === "accessor" ? {
1293
+ get: descriptor.get,
1294
+ set: descriptor.set
1295
+ } : descriptor[key], context);
1296
+ if (kind === "accessor") {
1297
+ if (result === void 0) continue;
1298
+ if (result === null || _typeof(result) !== "object") throw new TypeError("Object expected");
1299
+ if (_ = accept(result.get)) descriptor.get = _;
1300
+ if (_ = accept(result.set)) descriptor.set = _;
1301
+ if (_ = accept(result.init)) initializers.unshift(_);
1302
+ } else if (_ = accept(result)) {
1303
+ if (kind === "field") initializers.unshift(_);else descriptor[key] = _;
1304
+ }
1305
+ }
1306
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
1307
+ done = true;
1308
+ }
1309
+ ;
1310
+ function __runInitializers(thisArg, initializers, value) {
1311
+ var useValue = arguments.length > 2;
1312
+ for (var i = 0; i < initializers.length; i++) {
1313
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
1314
+ }
1315
+ return useValue ? value : void 0;
1316
+ }
1317
+ ;
1318
+ function __propKey(x) {
1319
+ return _typeof(x) === "symbol" ? x : "".concat(x);
1320
+ }
1321
+ ;
1322
+ function __setFunctionName(f, name, prefix) {
1323
+ if (_typeof(name) === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
1324
+ return Object.defineProperty(f, "name", {
1325
+ configurable: true,
1326
+ value: prefix ? "".concat(prefix, " ", name) : name
1327
+ });
1328
+ }
1329
+ ;
1330
+ function __metadata(metadataKey, metadataValue) {
1331
+ if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
1332
+ }
1333
+ function __awaiter(thisArg, _arguments, P, generator) {
1334
+ function adopt(value) {
1335
+ return value instanceof P ? value : new P(function (resolve) {
1336
+ resolve(value);
1337
+ });
1338
+ }
1339
+ return new (P || (P = Promise))(function (resolve, reject) {
1340
+ function fulfilled(value) {
1341
+ try {
1342
+ step(generator.next(value));
1343
+ } catch (e) {
1344
+ reject(e);
1345
+ }
1346
+ }
1347
+ function rejected(value) {
1348
+ try {
1349
+ step(generator["throw"](value));
1350
+ } catch (e) {
1351
+ reject(e);
1352
+ }
1353
+ }
1354
+ function step(result) {
1355
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
1356
+ }
1357
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
1358
+ });
1359
+ }
1360
+ function __generator(thisArg, body) {
1361
+ var _ = {
1362
+ label: 0,
1363
+ sent: function sent() {
1364
+ if (t[0] & 1) throw t[1];
1365
+ return t[1];
1366
+ },
1367
+ trys: [],
1368
+ ops: []
1369
+ },
1370
+ f,
1371
+ y,
1372
+ t,
1373
+ g;
1374
+ return g = {
1375
+ next: verb(0),
1376
+ "throw": verb(1),
1377
+ "return": verb(2)
1378
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
1379
+ return this;
1380
+ }), g;
1381
+ function verb(n) {
1382
+ return function (v) {
1383
+ return step([n, v]);
1384
+ };
1385
+ }
1386
+ function step(op) {
1387
+ if (f) throw new TypeError("Generator is already executing.");
1388
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
1389
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
1390
+ if (y = 0, t) op = [op[0] & 2, t.value];
1391
+ switch (op[0]) {
1392
+ case 0:
1393
+ case 1:
1394
+ t = op;
1395
+ break;
1396
+ case 4:
1397
+ _.label++;
1398
+ return {
1399
+ value: op[1],
1400
+ done: false
1401
+ };
1402
+ case 5:
1403
+ _.label++;
1404
+ y = op[1];
1405
+ op = [0];
1406
+ continue;
1407
+ case 7:
1408
+ op = _.ops.pop();
1409
+ _.trys.pop();
1410
+ continue;
1411
+ default:
1412
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
1413
+ _ = 0;
1414
+ continue;
1415
+ }
1416
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
1417
+ _.label = op[1];
1418
+ break;
1419
+ }
1420
+ if (op[0] === 6 && _.label < t[1]) {
1421
+ _.label = t[1];
1422
+ t = op;
1423
+ break;
1424
+ }
1425
+ if (t && _.label < t[2]) {
1426
+ _.label = t[2];
1427
+ _.ops.push(op);
1428
+ break;
1429
+ }
1430
+ if (t[2]) _.ops.pop();
1431
+ _.trys.pop();
1432
+ continue;
1433
+ }
1434
+ op = body.call(thisArg, _);
1435
+ } catch (e) {
1436
+ op = [6, e];
1437
+ y = 0;
1438
+ } finally {
1439
+ f = t = 0;
1440
+ }
1441
+ if (op[0] & 5) throw op[1];
1442
+ return {
1443
+ value: op[0] ? op[1] : void 0,
1444
+ done: true
1445
+ };
1446
+ }
1447
+ }
1448
+ var __createBinding = Object.create ? function (o, m, k, k2) {
1449
+ if (k2 === undefined) k2 = k;
1450
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1451
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1452
+ desc = {
1453
+ enumerable: true,
1454
+ get: function get() {
1455
+ return m[k];
1456
+ }
1457
+ };
1458
+ }
1459
+ Object.defineProperty(o, k2, desc);
1460
+ } : function (o, m, k, k2) {
1461
+ if (k2 === undefined) k2 = k;
1462
+ o[k2] = m[k];
1463
+ };
1464
+ function __exportStar(m, o) {
1465
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
1466
+ }
1467
+ function __values(o) {
1468
+ var s = typeof Symbol === "function" && Symbol.iterator,
1469
+ m = s && o[s],
1470
+ i = 0;
1471
+ if (m) return m.call(o);
1472
+ if (o && typeof o.length === "number") return {
1473
+ next: function next() {
1474
+ if (o && i >= o.length) o = void 0;
1475
+ return {
1476
+ value: o && o[i++],
1477
+ done: !o
1478
+ };
1479
+ }
1480
+ };
1481
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
1482
+ }
1483
+ function __read(o, n) {
1484
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
1485
+ if (!m) return o;
1486
+ var i = m.call(o),
1487
+ r,
1488
+ ar = [],
1489
+ e;
1490
+ try {
1491
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
1492
+ } catch (error) {
1493
+ e = {
1494
+ error: error
1495
+ };
1496
+ } finally {
1497
+ try {
1498
+ if (r && !r.done && (m = i["return"])) m.call(i);
1499
+ } finally {
1500
+ if (e) throw e.error;
1501
+ }
1502
+ }
1503
+ return ar;
1504
+ }
1505
+
1506
+ /** @deprecated */
1507
+ function __spread() {
1508
+ for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
1509
+ return ar;
1510
+ }
1511
+
1512
+ /** @deprecated */
1513
+ function __spreadArrays() {
1514
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
1515
+ for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];
1516
+ return r;
1517
+ }
1518
+ function __spreadArray(to, from, pack) {
1519
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
1520
+ if (ar || !(i in from)) {
1521
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
1522
+ ar[i] = from[i];
1523
+ }
1524
+ }
1525
+ return to.concat(ar || Array.prototype.slice.call(from));
1526
+ }
1527
+ function __await(v) {
1528
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
1529
+ }
1530
+ function __asyncGenerator(thisArg, _arguments, generator) {
1531
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
1532
+ var g = generator.apply(thisArg, _arguments || []),
1533
+ i,
1534
+ q = [];
1535
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () {
1536
+ return this;
1537
+ }, i;
1538
+ function verb(n) {
1539
+ if (g[n]) i[n] = function (v) {
1540
+ return new Promise(function (a, b) {
1541
+ q.push([n, v, a, b]) > 1 || resume(n, v);
1542
+ });
1543
+ };
1544
+ }
1545
+ function resume(n, v) {
1546
+ try {
1547
+ step(g[n](v));
1548
+ } catch (e) {
1549
+ settle(q[0][3], e);
1550
+ }
1551
+ }
1552
+ function step(r) {
1553
+ r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
1554
+ }
1555
+ function fulfill(value) {
1556
+ resume("next", value);
1557
+ }
1558
+ function reject(value) {
1559
+ resume("throw", value);
1560
+ }
1561
+ function settle(f, v) {
1562
+ if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
1563
+ }
1564
+ }
1565
+ function __asyncDelegator(o) {
1566
+ var i, p;
1567
+ return i = {}, verb("next"), verb("throw", function (e) {
1568
+ throw e;
1569
+ }), verb("return"), i[Symbol.iterator] = function () {
1570
+ return this;
1571
+ }, i;
1572
+ function verb(n, f) {
1573
+ i[n] = o[n] ? function (v) {
1574
+ return (p = !p) ? {
1575
+ value: __await(o[n](v)),
1576
+ done: false
1577
+ } : f ? f(v) : v;
1578
+ } : f;
1579
+ }
1580
+ }
1581
+ function __asyncValues(o) {
1582
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
1583
+ var m = o[Symbol.asyncIterator],
1584
+ i;
1585
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () {
1586
+ return this;
1587
+ }, i);
1588
+ function verb(n) {
1589
+ i[n] = o[n] && function (v) {
1590
+ return new Promise(function (resolve, reject) {
1591
+ v = o[n](v), settle(resolve, reject, v.done, v.value);
1592
+ });
1593
+ };
1594
+ }
1595
+ function settle(resolve, reject, d, v) {
1596
+ Promise.resolve(v).then(function (v) {
1597
+ resolve({
1598
+ value: v,
1599
+ done: d
1600
+ });
1601
+ }, reject);
1602
+ }
1603
+ }
1604
+ function __makeTemplateObject(cooked, raw) {
1605
+ if (Object.defineProperty) {
1606
+ Object.defineProperty(cooked, "raw", {
1607
+ value: raw
1608
+ });
1609
+ } else {
1610
+ cooked.raw = raw;
1611
+ }
1612
+ return cooked;
1613
+ }
1614
+ ;
1615
+ var __setModuleDefault = Object.create ? function (o, v) {
1616
+ Object.defineProperty(o, "default", {
1617
+ enumerable: true,
1618
+ value: v
1619
+ });
1620
+ } : function (o, v) {
1621
+ o["default"] = v;
1622
+ };
1623
+ function __importStar(mod) {
1624
+ if (mod && mod.__esModule) return mod;
1625
+ var result = {};
1626
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
1627
+ __setModuleDefault(result, mod);
1628
+ return result;
1629
+ }
1630
+ function __importDefault(mod) {
1631
+ return mod && mod.__esModule ? mod : {
1632
+ "default": mod
1633
+ };
1634
+ }
1635
+ function __classPrivateFieldGet(receiver, state, kind, f) {
1636
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
1637
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1638
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1639
+ }
1640
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
1641
+ if (kind === "m") throw new TypeError("Private method is not writable");
1642
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1643
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
1644
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
1645
+ }
1646
+ function __classPrivateFieldIn(state, receiver) {
1647
+ if (receiver === null || _typeof(receiver) !== "object" && typeof receiver !== "function") throw new TypeError("Cannot use 'in' operator on non-object");
1648
+ return typeof state === "function" ? receiver === state : state.has(receiver);
1649
+ }
1650
+ /* harmony default export */ var tslib_es6 = ({
1651
+ __extends: __extends,
1652
+ __assign: _assign,
1653
+ __rest: __rest,
1654
+ __decorate: __decorate,
1655
+ __param: __param,
1656
+ __metadata: __metadata,
1657
+ __awaiter: __awaiter,
1658
+ __generator: __generator,
1659
+ __createBinding: __createBinding,
1660
+ __exportStar: __exportStar,
1661
+ __values: __values,
1662
+ __read: __read,
1663
+ __spread: __spread,
1664
+ __spreadArrays: __spreadArrays,
1665
+ __spreadArray: __spreadArray,
1666
+ __await: __await,
1667
+ __asyncGenerator: __asyncGenerator,
1668
+ __asyncDelegator: __asyncDelegator,
1669
+ __asyncValues: __asyncValues,
1670
+ __makeTemplateObject: __makeTemplateObject,
1671
+ __importStar: __importStar,
1672
+ __importDefault: __importDefault,
1673
+ __classPrivateFieldGet: __classPrivateFieldGet,
1674
+ __classPrivateFieldSet: __classPrivateFieldSet,
1675
+ __classPrivateFieldIn: __classPrivateFieldIn
1676
+ });
1188
1677
  ;// CONCATENATED MODULE: ./src/utils/common.ts
1189
1678
  var Check = /** @class */ (function () {
1190
1679
  function Check() {
@@ -1523,14 +2012,17 @@ var CssColorStringParser = /** @class */ (function () {
1523
2012
  }());
1524
2013
 
1525
2014
 
1526
- ;// CONCATENATED MODULE: ./src/utils/parsers/parsers.ts
2015
+ // EXTERNAL MODULE: ./node_modules/color-convert/index.js
2016
+ var color_convert = __webpack_require__(907);
2017
+ var color_convert_default = /*#__PURE__*/__webpack_require__.n(color_convert);
2018
+ ;// CONCATENATED MODULE: ./src/utils/parsers.ts
2019
+
1527
2020
 
1528
2021
 
1529
2022
 
1530
- var convert = __webpack_require__(907);
1531
2023
  function parseKeyWord(v) {
1532
2024
  var cssStr = CssColorStringParser.clearStrSpace(v);
1533
- var res = convert.keyword.rgb(cssStr);
2025
+ var res = color_convert_default().keyword.rgb(cssStr);
1534
2026
  return res && fromArray(res);
1535
2027
  }
1536
2028
  function parseHEX(v) {
@@ -1596,7 +2088,7 @@ function fromColorStr(v) {
1596
2088
  * @example: fromHSL(0,1,1,1)
1597
2089
  */
1598
2090
  function fromHSL(h, s, l, a) {
1599
- var res = convert.hsl.rgb(limitNumber(0, 360, h), limitNumber(0, 100, s * 100), limitNumber(0, 100, l * 100));
2091
+ var res = color_convert_default().hsl.rgb(limitNumber(0, 360, h), limitNumber(0, 100, s * 100), limitNumber(0, 100, l * 100));
1600
2092
  return new src_CssColorParser(res[0], res[1], res[2], defaultValue(Number(a), 1));
1601
2093
  }
1602
2094
  /**
@@ -1609,7 +2101,7 @@ function fromHSL(h, s, l, a) {
1609
2101
  * @example: fromHSL(0,1,1,1)
1610
2102
  */
1611
2103
  function fromHWB(h, w, b, a) {
1612
- var res = convert.hwb.rgb(limitNumber(0, 360, h), limitNumber(0, 100, w * 100), limitNumber(0, 100, b * 100));
2104
+ var res = color_convert_default().hwb.rgb(limitNumber(0, 360, h), limitNumber(0, 100, w * 100), limitNumber(0, 100, b * 100));
1613
2105
  return new src_CssColorParser(res[0], res[1], res[2], defaultValue(Number(a), 1));
1614
2106
  }
1615
2107
  /**
@@ -1657,15 +2149,16 @@ function fromArray(color) {
1657
2149
  }
1658
2150
 
1659
2151
  ;// CONCATENATED MODULE: ./src/main.ts
2152
+
1660
2153
  /*
1661
2154
  * @Author: roman_123
1662
2155
  * @Description:
1663
2156
  * @Date: 2023-05-25 17:45:22
1664
- * @LastEditTime: 2023-05-26 11:17:48
2157
+ * @LastEditTime: 2023-05-26 15:01:18
1665
2158
  */
1666
2159
 
1667
2160
 
1668
-
2161
+ /* harmony default export */ var main = (_assign({ CssColorParser: src_CssColorParser }, parsers_namespaceObject));
1669
2162
 
1670
2163
  }();
1671
2164
  /******/ return __webpack_exports__;
@@ -1 +1 @@
1
- !function(r,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Parser=e():r.Parser=e()}(this,(function(){return function(){var r={208:function(r,e,t){function n(r,e){return function(r){if(Array.isArray(r))return r}(r)||function(r,e){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var n,a,o,i,u=[],s=!0,c=!1;try{if(o=(t=t.call(r)).next,0===e){if(Object(t)!==t)return;s=!1}else for(;!(s=(n=o.call(t)).done)&&(u.push(n.value),u.length!==e);s=!0);}catch(r){c=!0,a=r}finally{try{if(!s&&null!=t.return&&(i=t.return(),Object(i)!==i))return}finally{if(c)throw a}}return u}}(r,e)||function(r,e){if(r){if("string"==typeof r)return a(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?a(r,e):void 0}}(r,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}for(var o=t(101),i={},u=0,s=Object.keys(o);u<s.length;u++){var c=s[u];i[o[c]]=c}var l={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};r.exports=l;for(var h=0,f=Object.keys(l);h<f.length;h++){var p=f[h];if(!("channels"in l[p]))throw new Error("missing channels property: "+p);if(!("labels"in l[p]))throw new Error("missing channel labels property: "+p);if(l[p].labels.length!==l[p].channels)throw new Error("channel and label counts mismatch: "+p);var b=l[p],g=b.channels,v=b.labels;delete l[p].channels,delete l[p].labels,Object.defineProperty(l[p],"channels",{value:g}),Object.defineProperty(l[p],"labels",{value:v})}l.rgb.hsl=function(r){var e,t=r[0]/255,n=r[1]/255,a=r[2]/255,o=Math.min(t,n,a),i=Math.max(t,n,a),u=i-o;i===o?e=0:t===i?e=(n-a)/u:n===i?e=2+(a-t)/u:a===i&&(e=4+(t-n)/u),(e=Math.min(60*e,360))<0&&(e+=360);var s=(o+i)/2;return[e,100*(i===o?0:s<=.5?u/(i+o):u/(2-i-o)),100*s]},l.rgb.hsv=function(r){var e,t,n,a,o,i=r[0]/255,u=r[1]/255,s=r[2]/255,c=Math.max(i,u,s),l=c-Math.min(i,u,s),h=function(r){return(c-r)/6/l+.5};return 0===l?(a=0,o=0):(o=l/c,e=h(i),t=h(u),n=h(s),i===c?a=n-t:u===c?a=1/3+e-n:s===c&&(a=2/3+t-e),a<0?a+=1:a>1&&(a-=1)),[360*a,100*o,100*c]},l.rgb.hwb=function(r){var e=r[0],t=r[1],n=r[2];return[l.rgb.hsl(r)[0],1/255*Math.min(e,Math.min(t,n))*100,100*(n=1-1/255*Math.max(e,Math.max(t,n)))]},l.rgb.cmyk=function(r){var e=r[0]/255,t=r[1]/255,n=r[2]/255,a=Math.min(1-e,1-t,1-n);return[100*((1-e-a)/(1-a)||0),100*((1-t-a)/(1-a)||0),100*((1-n-a)/(1-a)||0),100*a]},l.rgb.keyword=function(r){var e=i[r];if(e)return e;for(var t,n,a,u=1/0,s=0,c=Object.keys(o);s<c.length;s++){var l=c[s],h=(n=r,a=o[l],Math.pow(n[0]-a[0],2)+Math.pow(n[1]-a[1],2)+Math.pow(n[2]-a[2],2));h<u&&(u=h,t=l)}return t},l.keyword.rgb=function(r){return o[r]},l.rgb.xyz=function(r){var e=r[0]/255,t=r[1]/255,n=r[2]/255;return[100*(.4124*(e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)+.3576*(t=t>.04045?Math.pow((t+.055)/1.055,2.4):t/12.92)+.1805*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)),100*(.2126*e+.7152*t+.0722*n),100*(.0193*e+.1192*t+.9505*n)]},l.rgb.lab=function(r){var e=l.rgb.xyz(r),t=e[0],n=e[1],a=e[2];return n/=100,a/=108.883,t=(t/=95.047)>.008856?Math.pow(t,1/3):7.787*t+16/116,[116*(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116)-16,500*(t-n),200*(n-(a=a>.008856?Math.pow(a,1/3):7.787*a+16/116))]},l.hsl.rgb=function(r){var e,t,n,a=r[0]/360,o=r[1]/100,i=r[2]/100;if(0===o)return[n=255*i,n,n];for(var u=2*i-(e=i<.5?i*(1+o):i+o-i*o),s=[0,0,0],c=0;c<3;c++)(t=a+1/3*-(c-1))<0&&t++,t>1&&t--,n=6*t<1?u+6*(e-u)*t:2*t<1?e:3*t<2?u+(e-u)*(2/3-t)*6:u,s[c]=255*n;return s},l.hsl.hsv=function(r){var e=r[0],t=r[1]/100,n=r[2]/100,a=t,o=Math.max(n,.01);return t*=(n*=2)<=1?n:2-n,a*=o<=1?o:2-o,[e,100*(0===n?2*a/(o+a):2*t/(n+t)),(n+t)/2*100]},l.hsv.rgb=function(r){var e=r[0]/60,t=r[1]/100,n=r[2]/100,a=Math.floor(e)%6,o=e-Math.floor(e),i=255*n*(1-t),u=255*n*(1-t*o),s=255*n*(1-t*(1-o));switch(n*=255,a){case 0:return[n,s,i];case 1:return[u,n,i];case 2:return[i,n,s];case 3:return[i,u,n];case 4:return[s,i,n];case 5:return[n,i,u]}},l.hsv.hsl=function(r){var e,t,n=r[0],a=r[1]/100,o=r[2]/100,i=Math.max(o,.01);t=(2-a)*o;var u=(2-a)*i;return e=a*i,[n,100*(e=(e/=u<=1?u:2-u)||0),100*(t/=2)]},l.hwb.rgb=function(r){var e,t=r[0]/360,n=r[1]/100,a=r[2]/100,o=n+a;o>1&&(n/=o,a/=o);var i=Math.floor(6*t),u=1-a;e=6*t-i,0!=(1&i)&&(e=1-e);var s,c,l,h=n+e*(u-n);switch(i){default:case 6:case 0:s=u,c=h,l=n;break;case 1:s=h,c=u,l=n;break;case 2:s=n,c=u,l=h;break;case 3:s=n,c=h,l=u;break;case 4:s=h,c=n,l=u;break;case 5:s=u,c=n,l=h}return[255*s,255*c,255*l]},l.cmyk.rgb=function(r){var e=r[0]/100,t=r[1]/100,n=r[2]/100,a=r[3]/100;return[255*(1-Math.min(1,e*(1-a)+a)),255*(1-Math.min(1,t*(1-a)+a)),255*(1-Math.min(1,n*(1-a)+a))]},l.xyz.rgb=function(r){var e,t,n,a=r[0]/100,o=r[1]/100,i=r[2]/100;return t=-.9689*a+1.8758*o+.0415*i,n=.0557*a+-.204*o+1.057*i,e=(e=3.2406*a+-1.5372*o+-.4986*i)>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e,t=t>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,[255*(e=Math.min(Math.max(0,e),1)),255*(t=Math.min(Math.max(0,t),1)),255*(n=Math.min(Math.max(0,n),1))]},l.xyz.lab=function(r){var e=r[0],t=r[1],n=r[2];return t/=100,n/=108.883,e=(e/=95.047)>.008856?Math.pow(e,1/3):7.787*e+16/116,[116*(t=t>.008856?Math.pow(t,1/3):7.787*t+16/116)-16,500*(e-t),200*(t-(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116))]},l.lab.xyz=function(r){var e,t,n,a=r[0];e=r[1]/500+(t=(a+16)/116),n=t-r[2]/200;var o=Math.pow(t,3),i=Math.pow(e,3),u=Math.pow(n,3);return t=o>.008856?o:(t-16/116)/7.787,e=i>.008856?i:(e-16/116)/7.787,n=u>.008856?u:(n-16/116)/7.787,[e*=95.047,t*=100,n*=108.883]},l.lab.lch=function(r){var e,t=r[0],n=r[1],a=r[2];return(e=360*Math.atan2(a,n)/2/Math.PI)<0&&(e+=360),[t,Math.sqrt(n*n+a*a),e]},l.lch.lab=function(r){var e=r[0],t=r[1],n=r[2]/360*2*Math.PI;return[e,t*Math.cos(n),t*Math.sin(n)]},l.rgb.ansi16=function(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=n(r,3),a=t[0],o=t[1],i=t[2],u=null===e?l.rgb.hsv(r)[2]:e;if(0===(u=Math.round(u/50)))return 30;var s=30+(Math.round(i/255)<<2|Math.round(o/255)<<1|Math.round(a/255));return 2===u&&(s+=60),s},l.hsv.ansi16=function(r){return l.rgb.ansi16(l.hsv.rgb(r),r[2])},l.rgb.ansi256=function(r){var e=r[0],t=r[1],n=r[2];return e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5)},l.ansi16.rgb=function(r){var e=r%10;if(0===e||7===e)return r>50&&(e+=3.5),[e=e/10.5*255,e,e];var t=.5*(1+~~(r>50));return[(1&e)*t*255,(e>>1&1)*t*255,(e>>2&1)*t*255]},l.ansi256.rgb=function(r){if(r>=232){var e=10*(r-232)+8;return[e,e,e]}var t;return r-=16,[Math.floor(r/36)/5*255,Math.floor((t=r%36)/6)/5*255,t%6/5*255]},l.rgb.hex=function(r){var e=(((255&Math.round(r[0]))<<16)+((255&Math.round(r[1]))<<8)+(255&Math.round(r[2]))).toString(16).toUpperCase();return"000000".substring(e.length)+e},l.hex.rgb=function(r){var e=r.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];var t=e[0];3===e[0].length&&(t=t.split("").map((function(r){return r+r})).join(""));var n=parseInt(t,16);return[n>>16&255,n>>8&255,255&n]},l.rgb.hcg=function(r){var e,t=r[0]/255,n=r[1]/255,a=r[2]/255,o=Math.max(Math.max(t,n),a),i=Math.min(Math.min(t,n),a),u=o-i;return e=u<=0?0:o===t?(n-a)/u%6:o===n?2+(a-t)/u:4+(t-n)/u,e/=6,[360*(e%=1),100*u,100*(u<1?i/(1-u):0)]},l.hsl.hcg=function(r){var e=r[1]/100,t=r[2]/100,n=t<.5?2*e*t:2*e*(1-t),a=0;return n<1&&(a=(t-.5*n)/(1-n)),[r[0],100*n,100*a]},l.hsv.hcg=function(r){var e=r[1]/100,t=r[2]/100,n=e*t,a=0;return n<1&&(a=(t-n)/(1-n)),[r[0],100*n,100*a]},l.hcg.rgb=function(r){var e=r[0]/360,t=r[1]/100,n=r[2]/100;if(0===t)return[255*n,255*n,255*n];var a,o=[0,0,0],i=e%1*6,u=i%1,s=1-u;switch(Math.floor(i)){case 0:o[0]=1,o[1]=u,o[2]=0;break;case 1:o[0]=s,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=u;break;case 3:o[0]=0,o[1]=s,o[2]=1;break;case 4:o[0]=u,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=s}return a=(1-t)*n,[255*(t*o[0]+a),255*(t*o[1]+a),255*(t*o[2]+a)]},l.hcg.hsv=function(r){var e=r[1]/100,t=e+r[2]/100*(1-e),n=0;return t>0&&(n=e/t),[r[0],100*n,100*t]},l.hcg.hsl=function(r){var e=r[1]/100,t=r[2]/100*(1-e)+.5*e,n=0;return t>0&&t<.5?n=e/(2*t):t>=.5&&t<1&&(n=e/(2*(1-t))),[r[0],100*n,100*t]},l.hcg.hwb=function(r){var e=r[1]/100,t=e+r[2]/100*(1-e);return[r[0],100*(t-e),100*(1-t)]},l.hwb.hcg=function(r){var e=r[1]/100,t=1-r[2]/100,n=t-e,a=0;return n<1&&(a=(t-n)/(1-n)),[r[0],100*n,100*a]},l.apple.rgb=function(r){return[r[0]/65535*255,r[1]/65535*255,r[2]/65535*255]},l.rgb.apple=function(r){return[r[0]/255*65535,r[1]/255*65535,r[2]/255*65535]},l.gray.rgb=function(r){return[r[0]/100*255,r[0]/100*255,r[0]/100*255]},l.gray.hsl=function(r){return[0,0,r[0]]},l.gray.hsv=l.gray.hsl,l.gray.hwb=function(r){return[0,100,r[0]]},l.gray.cmyk=function(r){return[0,0,0,r[0]]},l.gray.lab=function(r){return[r[0],0,0]},l.gray.hex=function(r){var e=255&Math.round(r[0]/100*255),t=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(t.length)+t},l.rgb.gray=function(r){return[(r[0]+r[1]+r[2])/3/255*100]}},907:function(r,e,t){function n(r){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},n(r)}var a=t(208),o=t(171),i={};Object.keys(a).forEach((function(r){i[r]={},Object.defineProperty(i[r],"channels",{value:a[r].channels}),Object.defineProperty(i[r],"labels",{value:a[r].labels});var e=o(r);Object.keys(e).forEach((function(t){var a=e[t];i[r][t]=function(r){var e=function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];var o=t[0];if(null==o)return o;o.length>1&&(t=o);var i=r(t);if("object"===n(i))for(var u=i.length,s=0;s<u;s++)i[s]=Math.round(i[s]);return i};return"conversion"in r&&(e.conversion=r.conversion),e}(a),i[r][t].raw=function(r){var e=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var a=t[0];return null==a?a:(a.length>1&&(t=a),r(t))};return"conversion"in r&&(e.conversion=r.conversion),e}(a)}))})),r.exports=i},171:function(r,e,t){var n=t(208);function a(r,e){return function(t){return e(r(t))}}function o(r,e){for(var t=[e[r].parent,r],o=n[e[r].parent][r],i=e[r].parent;e[i].parent;)t.unshift(e[i].parent),o=a(n[e[i].parent][i],o),i=e[i].parent;return o.conversion=t,o}r.exports=function(r){for(var e=function(r){var e=function(){for(var r={},e=Object.keys(n),t=e.length,a=0;a<t;a++)r[e[a]]={distance:-1,parent:null};return r}(),t=[r];for(e[r].distance=0;t.length;)for(var a=t.pop(),o=Object.keys(n[a]),i=o.length,u=0;u<i;u++){var s=o[u],c=e[s];-1===c.distance&&(c.distance=e[a].distance+1,c.parent=a,t.unshift(s))}return e}(r),t={},a=Object.keys(e),i=a.length,u=0;u<i;u++){var s=a[u];null!==e[s].parent&&(t[s]=o(s,e))}return t}},101:function(r){"use strict";r.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}}},e={};function t(n){var a=e[n];if(void 0!==a)return a.exports;var o=e[n]={exports:{}};return r[n](o,o.exports,t),o.exports}t.d=function(r,e){for(var n in e)t.o(e,n)&&!t.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:e[n]})},t.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},t.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})};var n={};return function(){"use strict";t.r(n),t.d(n,{CssColorParser:function(){return i},fromArray:function(){return w},fromColorStr:function(){return g},fromHSL:function(){return v},fromHWB:function(){return y},fromJson:function(){return m},fromRandom:function(){return d},parseCssColorStr:function(){return b},parseHEX:function(){return l},parseHSLA:function(){return f},parseHWB:function(){return p},parseKeyWord:function(){return c},parseRGBA:function(){return h}});var r=function(){function r(){}return r.type=function(r,e,t){var n=typeof t;if(n!==r)throw new Error("Expected ".concat(e," to be typeof ").concat(r,", actual typeof was ").concat(n))},r.types=function(r,e,t){var n=typeof t;if(!r.includes(n))throw new Error("Expected ".concat(e," to be typeof ").concat(r.join("|"),", actual typeof was ").concat(n))},r}();function e(r,e){return null==r||isNaN(r)&&"number"==typeof e?e:r}function a(r,e,t){return t>e?t=e:t<r&&(t=r),t}function o(r,e){return Number(r.toFixed(e))}var i=function(){function r(r,e,t,n){this.r=255,this.g=255,this.b=255,this.a=1,this.setColor(r,e,t,n)}return r.prototype.setColor=function(r,t,n,o){this.r=a(0,255,e(Number(r),0)),this.g=a(0,255,e(Number(t),0)),this.b=a(0,255,e(Number(n),0)),this.a=a(0,1,e(Number(o),1))},r.prototype.toRGBA=function(){var r=this.toJson();return 1===r.a?"rgb(".concat(r.r,",").concat(r.g,",").concat(r.b,")"):"rgba(".concat(r.r,",").concat(r.g,",").concat(r.b,",").concat(r.a,")")},r.prototype.toString=function(){return this.toRGBA()},r.prototype.toNormalize=function(){return{r:o(this.r/255,2),g:o(this.g/255,2),b:o(this.b/255,2),a:o(this.a,2)}},r.prototype.toHEX=function(){var r=this.toJson(),e=r.r.toString(16);e.length<2&&(e="0".concat(e));var t=r.g.toString(16);t.length<2&&(t="0".concat(t));var n=r.b.toString(16);if(n.length<2&&(n="0".concat(n)),this.a<1){var a=parseInt((255*this.a).toFixed()).toString(16);return a.length<2&&(a="0".concat(a)),"#".concat(e).concat(t).concat(n).concat(a)}return"#".concat(e).concat(t).concat(n)},r.prototype.toArray=function(){var r=this.toJson();return[r.r,r.g,r.b,r.a]},r.prototype.toJson=function(){return{r:parseInt(this.r.toFixed()),g:parseInt(this.g.toFixed()),b:parseInt(this.b.toFixed()),a:parseFloat(this.a.toFixed(2))}},r.prototype.clone=function(){return new r(this.r,this.g,this.b,this.a)},r.prototype.equals=function(r){return this===r||this.r===r.r&&this.g===r.g&&this.b===r.g&&this.a===r.a},r}(),u=function(){function r(){}return r.clearStrSpace=function(r){return r.replace(/\s/g,"")},r.trimStr=function(r){return(r=r.replace(/\s+/g," ")).trim()},r.parse3BitsHEX=function(t){var n=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i.exec(t);if(n){var a=e(n[4],"f");return[r._parseResStrForRgb(parseInt(n[1]+n[1],16)),r._parseResStrForRgb(parseInt(n[2]+n[2],16)),r._parseResStrForRgb(parseInt(n[3]+n[3],16)),r._parsePercent(parseInt(a+a,16)/255)]}return null},r.parse6BitsHEX=function(t){var n=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i.exec(t);if(n){var a=e(n[4],"ff");return[r._parseResStrForRgb(parseInt(n[1],16)),r._parseResStrForRgb(parseInt(n[2],16)),r._parseResStrForRgb(parseInt(n[3],16)),r._parsePercent(parseInt(a,16)/255)]}return null},r.parseRGBA=function(e){var t=/^rgba?\(([0-9.]+%?),([0-9.]+%?),([0-9.]+%?)(?:,([0-9.]+%?))?\)$/i.exec(e);return t?[r._parseResStrForRgb(t[1]),r._parseResStrForRgb(t[2]),r._parseResStrForRgb(t[3]),r._parsePercent(t[4])]:null},r.parseHSLA=function(e){var t=/^hsla?\(([0-9.]+)(?:deg)?,([0-9.]+%?),([0-9.]+%?)(?:,([0-9.]+%?))?\)$/i.exec(e);return t?[r._parseResStrForHue(t[1]),r._parsePercent(t[2]),r._parsePercent(t[3]),r._parsePercent(t[4])]:null},r.parseHWB=function(e){var t=/^hwb\s?\(\s?([0-9.]+)(?:deg)?\s([0-9.]+%?)\s([0-9.]+%?)\s?(?:\/\s?([0-9.]+%?))?\s?\)$/i.exec(e);return t?[r._parseResStrForHue(t[1]),r._parsePercent(t[2]),r._parsePercent(t[3]),r._parsePercent(t[4])]:null},r.parseRGBA2=function(e){var t=/^rgba?\s?\(\s?([0-9.]+%?)\s?([0-9.]+%?)\s?([0-9.]+%?)(?:\s?\/\s?([0-9.]+%?))?\s?\)$/i.exec(e);return t?[r._parseResStrForRgb(t[1]),r._parseResStrForRgb(t[2]),r._parseResStrForRgb(t[3]),r._parsePercent(t[4])]:null},r.parseHSLA2=function(e){var t=/^hsla?\s?\(\s?([0-9.]+)(?:deg)?\s([0-9.]+%?)\s([0-9.]+%?)\s?(?:\/\s?([0-9.]+%?))?\s?\)$/i.exec(e);return t?[r._parseResStrForHue(t[1]),r._parsePercent(t[2]),r._parsePercent(t[3]),r._parsePercent(t[4])]:null},r._parseResStrForRgb=function(r){return"string"==typeof r&&(r=parseFloat(r)/("%"===r.substr(-1)?100/255:1)),isNaN(r)&&(r=1),a(0,255,r)},r._parseResStrForHue=function(r){return"string"==typeof r&&(r=parseFloat(r)),isNaN(r)&&(r=0),a(0,360,r)},r._parsePercent=function(r){return"string"==typeof r&&(r=parseFloat(r)/("%"===r.substr(-1)?100:1)),isNaN(r)&&(r=1),a(0,1,r)},r}(),s=t(907);function c(r){var e=u.clearStrSpace(r),t=s.keyword.rgb(e);return t&&w(t)}function l(r){var e=u.clearStrSpace(r),t=u.parse3BitsHEX(e);return t||(t=u.parse6BitsHEX(e)),t&&w(t)}function h(r){var e=u.clearStrSpace(r),t=u.parseRGBA(e);if(!t){var n=u.trimStr(r);t=u.parseRGBA2(n)}return t&&w(t)}function f(r){var e=u.clearStrSpace(r),t=u.parseHSLA(e);if(!t){var n=u.trimStr(r);t=u.parseHSLA2(n)}return t&&v(t[0],t[1],t[2],t[3])}function p(r){var e=u.trimStr(r),t=u.parseHWB(e);return t&&y(t[0],t[1],t[2],t[3])}function b(e){return r.type("string","color",e),l(e)||h(e)||c(e)||f(e)||p(e)}function g(e){return r.type("string","color",e),l(e)||h(e)||c(e)||f(e)||p(e)}function v(r,t,n,o){var u=s.hsl.rgb(a(0,360,r),a(0,100,100*t),a(0,100,100*n));return new i(u[0],u[1],u[2],e(Number(o),1))}function y(r,t,n,o){var u=s.hwb.rgb(a(0,360,r),a(0,100,100*t),a(0,100,100*n));return new i(u[0],u[1],u[2],e(Number(o),1))}function d(r,e){if("string"==typeof r&&(r=b(r)),"string"==typeof e&&(e=b(e)),!r||!e)throw new Error("fail to create object from random");var t=Math.random()*Math.abs(e.r-r.r)+Math.min(r.r,e.r),n=Math.random()*Math.abs(e.g-r.g)+Math.min(r.g,e.g),a=Math.random()*Math.abs(e.b-r.b)+Math.min(r.b,e.b),o=Math.random()*Math.abs(e.a-r.a)+Math.min(r.a,e.a);return new i(t,n,a,o)}function m(r){return new i(r.r,r.g,r.b,r.a)}function w(r){return new i(r[0],r[1],r[2],r[3])}}(),n}()}));
1
+ !function(r,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Parser=e():r.Parser=e()}(this,(function(){return function(){var r={208:function(r,e,t){function n(r,e){return function(r){if(Array.isArray(r))return r}(r)||function(r,e){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var n,a,o,i,u=[],s=!0,c=!1;try{if(o=(t=t.call(r)).next,0===e){if(Object(t)!==t)return;s=!1}else for(;!(s=(n=o.call(t)).done)&&(u.push(n.value),u.length!==e);s=!0);}catch(r){c=!0,a=r}finally{try{if(!s&&null!=t.return&&(i=t.return(),Object(i)!==i))return}finally{if(c)throw a}}return u}}(r,e)||function(r,e){if(r){if("string"==typeof r)return a(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?a(r,e):void 0}}(r,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}for(var o=t(101),i={},u=0,s=Object.keys(o);u<s.length;u++){var c=s[u];i[o[c]]=c}var l={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};r.exports=l;for(var h=0,f=Object.keys(l);h<f.length;h++){var p=f[h];if(!("channels"in l[p]))throw new Error("missing channels property: "+p);if(!("labels"in l[p]))throw new Error("missing channel labels property: "+p);if(l[p].labels.length!==l[p].channels)throw new Error("channel and label counts mismatch: "+p);var b=l[p],g=b.channels,v=b.labels;delete l[p].channels,delete l[p].labels,Object.defineProperty(l[p],"channels",{value:g}),Object.defineProperty(l[p],"labels",{value:v})}l.rgb.hsl=function(r){var e,t=r[0]/255,n=r[1]/255,a=r[2]/255,o=Math.min(t,n,a),i=Math.max(t,n,a),u=i-o;i===o?e=0:t===i?e=(n-a)/u:n===i?e=2+(a-t)/u:a===i&&(e=4+(t-n)/u),(e=Math.min(60*e,360))<0&&(e+=360);var s=(o+i)/2;return[e,100*(i===o?0:s<=.5?u/(i+o):u/(2-i-o)),100*s]},l.rgb.hsv=function(r){var e,t,n,a,o,i=r[0]/255,u=r[1]/255,s=r[2]/255,c=Math.max(i,u,s),l=c-Math.min(i,u,s),h=function(r){return(c-r)/6/l+.5};return 0===l?(a=0,o=0):(o=l/c,e=h(i),t=h(u),n=h(s),i===c?a=n-t:u===c?a=1/3+e-n:s===c&&(a=2/3+t-e),a<0?a+=1:a>1&&(a-=1)),[360*a,100*o,100*c]},l.rgb.hwb=function(r){var e=r[0],t=r[1],n=r[2];return[l.rgb.hsl(r)[0],1/255*Math.min(e,Math.min(t,n))*100,100*(n=1-1/255*Math.max(e,Math.max(t,n)))]},l.rgb.cmyk=function(r){var e=r[0]/255,t=r[1]/255,n=r[2]/255,a=Math.min(1-e,1-t,1-n);return[100*((1-e-a)/(1-a)||0),100*((1-t-a)/(1-a)||0),100*((1-n-a)/(1-a)||0),100*a]},l.rgb.keyword=function(r){var e=i[r];if(e)return e;for(var t,n,a,u=1/0,s=0,c=Object.keys(o);s<c.length;s++){var l=c[s],h=(n=r,a=o[l],Math.pow(n[0]-a[0],2)+Math.pow(n[1]-a[1],2)+Math.pow(n[2]-a[2],2));h<u&&(u=h,t=l)}return t},l.keyword.rgb=function(r){return o[r]},l.rgb.xyz=function(r){var e=r[0]/255,t=r[1]/255,n=r[2]/255;return[100*(.4124*(e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)+.3576*(t=t>.04045?Math.pow((t+.055)/1.055,2.4):t/12.92)+.1805*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)),100*(.2126*e+.7152*t+.0722*n),100*(.0193*e+.1192*t+.9505*n)]},l.rgb.lab=function(r){var e=l.rgb.xyz(r),t=e[0],n=e[1],a=e[2];return n/=100,a/=108.883,t=(t/=95.047)>.008856?Math.pow(t,1/3):7.787*t+16/116,[116*(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116)-16,500*(t-n),200*(n-(a=a>.008856?Math.pow(a,1/3):7.787*a+16/116))]},l.hsl.rgb=function(r){var e,t,n,a=r[0]/360,o=r[1]/100,i=r[2]/100;if(0===o)return[n=255*i,n,n];for(var u=2*i-(e=i<.5?i*(1+o):i+o-i*o),s=[0,0,0],c=0;c<3;c++)(t=a+1/3*-(c-1))<0&&t++,t>1&&t--,n=6*t<1?u+6*(e-u)*t:2*t<1?e:3*t<2?u+(e-u)*(2/3-t)*6:u,s[c]=255*n;return s},l.hsl.hsv=function(r){var e=r[0],t=r[1]/100,n=r[2]/100,a=t,o=Math.max(n,.01);return t*=(n*=2)<=1?n:2-n,a*=o<=1?o:2-o,[e,100*(0===n?2*a/(o+a):2*t/(n+t)),(n+t)/2*100]},l.hsv.rgb=function(r){var e=r[0]/60,t=r[1]/100,n=r[2]/100,a=Math.floor(e)%6,o=e-Math.floor(e),i=255*n*(1-t),u=255*n*(1-t*o),s=255*n*(1-t*(1-o));switch(n*=255,a){case 0:return[n,s,i];case 1:return[u,n,i];case 2:return[i,n,s];case 3:return[i,u,n];case 4:return[s,i,n];case 5:return[n,i,u]}},l.hsv.hsl=function(r){var e,t,n=r[0],a=r[1]/100,o=r[2]/100,i=Math.max(o,.01);t=(2-a)*o;var u=(2-a)*i;return e=a*i,[n,100*(e=(e/=u<=1?u:2-u)||0),100*(t/=2)]},l.hwb.rgb=function(r){var e,t=r[0]/360,n=r[1]/100,a=r[2]/100,o=n+a;o>1&&(n/=o,a/=o);var i=Math.floor(6*t),u=1-a;e=6*t-i,0!=(1&i)&&(e=1-e);var s,c,l,h=n+e*(u-n);switch(i){default:case 6:case 0:s=u,c=h,l=n;break;case 1:s=h,c=u,l=n;break;case 2:s=n,c=u,l=h;break;case 3:s=n,c=h,l=u;break;case 4:s=h,c=n,l=u;break;case 5:s=u,c=n,l=h}return[255*s,255*c,255*l]},l.cmyk.rgb=function(r){var e=r[0]/100,t=r[1]/100,n=r[2]/100,a=r[3]/100;return[255*(1-Math.min(1,e*(1-a)+a)),255*(1-Math.min(1,t*(1-a)+a)),255*(1-Math.min(1,n*(1-a)+a))]},l.xyz.rgb=function(r){var e,t,n,a=r[0]/100,o=r[1]/100,i=r[2]/100;return t=-.9689*a+1.8758*o+.0415*i,n=.0557*a+-.204*o+1.057*i,e=(e=3.2406*a+-1.5372*o+-.4986*i)>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e,t=t>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,[255*(e=Math.min(Math.max(0,e),1)),255*(t=Math.min(Math.max(0,t),1)),255*(n=Math.min(Math.max(0,n),1))]},l.xyz.lab=function(r){var e=r[0],t=r[1],n=r[2];return t/=100,n/=108.883,e=(e/=95.047)>.008856?Math.pow(e,1/3):7.787*e+16/116,[116*(t=t>.008856?Math.pow(t,1/3):7.787*t+16/116)-16,500*(e-t),200*(t-(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116))]},l.lab.xyz=function(r){var e,t,n,a=r[0];e=r[1]/500+(t=(a+16)/116),n=t-r[2]/200;var o=Math.pow(t,3),i=Math.pow(e,3),u=Math.pow(n,3);return t=o>.008856?o:(t-16/116)/7.787,e=i>.008856?i:(e-16/116)/7.787,n=u>.008856?u:(n-16/116)/7.787,[e*=95.047,t*=100,n*=108.883]},l.lab.lch=function(r){var e,t=r[0],n=r[1],a=r[2];return(e=360*Math.atan2(a,n)/2/Math.PI)<0&&(e+=360),[t,Math.sqrt(n*n+a*a),e]},l.lch.lab=function(r){var e=r[0],t=r[1],n=r[2]/360*2*Math.PI;return[e,t*Math.cos(n),t*Math.sin(n)]},l.rgb.ansi16=function(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=n(r,3),a=t[0],o=t[1],i=t[2],u=null===e?l.rgb.hsv(r)[2]:e;if(0===(u=Math.round(u/50)))return 30;var s=30+(Math.round(i/255)<<2|Math.round(o/255)<<1|Math.round(a/255));return 2===u&&(s+=60),s},l.hsv.ansi16=function(r){return l.rgb.ansi16(l.hsv.rgb(r),r[2])},l.rgb.ansi256=function(r){var e=r[0],t=r[1],n=r[2];return e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5)},l.ansi16.rgb=function(r){var e=r%10;if(0===e||7===e)return r>50&&(e+=3.5),[e=e/10.5*255,e,e];var t=.5*(1+~~(r>50));return[(1&e)*t*255,(e>>1&1)*t*255,(e>>2&1)*t*255]},l.ansi256.rgb=function(r){if(r>=232){var e=10*(r-232)+8;return[e,e,e]}var t;return r-=16,[Math.floor(r/36)/5*255,Math.floor((t=r%36)/6)/5*255,t%6/5*255]},l.rgb.hex=function(r){var e=(((255&Math.round(r[0]))<<16)+((255&Math.round(r[1]))<<8)+(255&Math.round(r[2]))).toString(16).toUpperCase();return"000000".substring(e.length)+e},l.hex.rgb=function(r){var e=r.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];var t=e[0];3===e[0].length&&(t=t.split("").map((function(r){return r+r})).join(""));var n=parseInt(t,16);return[n>>16&255,n>>8&255,255&n]},l.rgb.hcg=function(r){var e,t=r[0]/255,n=r[1]/255,a=r[2]/255,o=Math.max(Math.max(t,n),a),i=Math.min(Math.min(t,n),a),u=o-i;return e=u<=0?0:o===t?(n-a)/u%6:o===n?2+(a-t)/u:4+(t-n)/u,e/=6,[360*(e%=1),100*u,100*(u<1?i/(1-u):0)]},l.hsl.hcg=function(r){var e=r[1]/100,t=r[2]/100,n=t<.5?2*e*t:2*e*(1-t),a=0;return n<1&&(a=(t-.5*n)/(1-n)),[r[0],100*n,100*a]},l.hsv.hcg=function(r){var e=r[1]/100,t=r[2]/100,n=e*t,a=0;return n<1&&(a=(t-n)/(1-n)),[r[0],100*n,100*a]},l.hcg.rgb=function(r){var e=r[0]/360,t=r[1]/100,n=r[2]/100;if(0===t)return[255*n,255*n,255*n];var a,o=[0,0,0],i=e%1*6,u=i%1,s=1-u;switch(Math.floor(i)){case 0:o[0]=1,o[1]=u,o[2]=0;break;case 1:o[0]=s,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=u;break;case 3:o[0]=0,o[1]=s,o[2]=1;break;case 4:o[0]=u,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=s}return a=(1-t)*n,[255*(t*o[0]+a),255*(t*o[1]+a),255*(t*o[2]+a)]},l.hcg.hsv=function(r){var e=r[1]/100,t=e+r[2]/100*(1-e),n=0;return t>0&&(n=e/t),[r[0],100*n,100*t]},l.hcg.hsl=function(r){var e=r[1]/100,t=r[2]/100*(1-e)+.5*e,n=0;return t>0&&t<.5?n=e/(2*t):t>=.5&&t<1&&(n=e/(2*(1-t))),[r[0],100*n,100*t]},l.hcg.hwb=function(r){var e=r[1]/100,t=e+r[2]/100*(1-e);return[r[0],100*(t-e),100*(1-t)]},l.hwb.hcg=function(r){var e=r[1]/100,t=1-r[2]/100,n=t-e,a=0;return n<1&&(a=(t-n)/(1-n)),[r[0],100*n,100*a]},l.apple.rgb=function(r){return[r[0]/65535*255,r[1]/65535*255,r[2]/65535*255]},l.rgb.apple=function(r){return[r[0]/255*65535,r[1]/255*65535,r[2]/255*65535]},l.gray.rgb=function(r){return[r[0]/100*255,r[0]/100*255,r[0]/100*255]},l.gray.hsl=function(r){return[0,0,r[0]]},l.gray.hsv=l.gray.hsl,l.gray.hwb=function(r){return[0,100,r[0]]},l.gray.cmyk=function(r){return[0,0,0,r[0]]},l.gray.lab=function(r){return[r[0],0,0]},l.gray.hex=function(r){var e=255&Math.round(r[0]/100*255),t=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(t.length)+t},l.rgb.gray=function(r){return[(r[0]+r[1]+r[2])/3/255*100]}},907:function(r,e,t){function n(r){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},n(r)}var a=t(208),o=t(171),i={};Object.keys(a).forEach((function(r){i[r]={},Object.defineProperty(i[r],"channels",{value:a[r].channels}),Object.defineProperty(i[r],"labels",{value:a[r].labels});var e=o(r);Object.keys(e).forEach((function(t){var a=e[t];i[r][t]=function(r){var e=function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];var o=t[0];if(null==o)return o;o.length>1&&(t=o);var i=r(t);if("object"===n(i))for(var u=i.length,s=0;s<u;s++)i[s]=Math.round(i[s]);return i};return"conversion"in r&&(e.conversion=r.conversion),e}(a),i[r][t].raw=function(r){var e=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var a=t[0];return null==a?a:(a.length>1&&(t=a),r(t))};return"conversion"in r&&(e.conversion=r.conversion),e}(a)}))})),r.exports=i},171:function(r,e,t){var n=t(208);function a(r,e){return function(t){return e(r(t))}}function o(r,e){for(var t=[e[r].parent,r],o=n[e[r].parent][r],i=e[r].parent;e[i].parent;)t.unshift(e[i].parent),o=a(n[e[i].parent][i],o),i=e[i].parent;return o.conversion=t,o}r.exports=function(r){for(var e=function(r){var e=function(){for(var r={},e=Object.keys(n),t=e.length,a=0;a<t;a++)r[e[a]]={distance:-1,parent:null};return r}(),t=[r];for(e[r].distance=0;t.length;)for(var a=t.pop(),o=Object.keys(n[a]),i=o.length,u=0;u<i;u++){var s=o[u],c=e[s];-1===c.distance&&(c.distance=e[a].distance+1,c.parent=a,t.unshift(s))}return e}(r),t={},a=Object.keys(e),i=a.length,u=0;u<i;u++){var s=a[u];null!==e[s].parent&&(t[s]=o(s,e))}return t}},101:function(r){"use strict";r.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}}},e={};function t(n){var a=e[n];if(void 0!==a)return a.exports;var o=e[n]={exports:{}};return r[n](o,o.exports,t),o.exports}t.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return t.d(e,{a:e}),e},t.d=function(r,e){for(var n in e)t.o(e,n)&&!t.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:e[n]})},t.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},t.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})};var n={};return function(){"use strict";t.r(n),t.d(n,{default:function(){return x}});var r={};t.r(r),t.d(r,{fromArray:function(){return S},fromColorStr:function(){return d},fromHSL:function(){return m},fromHWB:function(){return w},fromJson:function(){return k},fromRandom:function(){return M},parseCssColorStr:function(){return y},parseHEX:function(){return p},parseHSLA:function(){return g},parseHWB:function(){return v},parseKeyWord:function(){return f},parseRGBA:function(){return b}});var e=function(){return e=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++)for(var a in e=arguments[t])Object.prototype.hasOwnProperty.call(e,a)&&(r[a]=e[a]);return r},e.apply(this,arguments)};Object.create,Object.create;var a=function(){function r(){}return r.type=function(r,e,t){var n=typeof t;if(n!==r)throw new Error("Expected ".concat(e," to be typeof ").concat(r,", actual typeof was ").concat(n))},r.types=function(r,e,t){var n=typeof t;if(!r.includes(n))throw new Error("Expected ".concat(e," to be typeof ").concat(r.join("|"),", actual typeof was ").concat(n))},r}();function o(r,e){return null==r||isNaN(r)&&"number"==typeof e?e:r}function i(r,e,t){return t>e?t=e:t<r&&(t=r),t}function u(r,e){return Number(r.toFixed(e))}var s=function(){function r(r,e,t,n){this.r=255,this.g=255,this.b=255,this.a=1,this.setColor(r,e,t,n)}return r.prototype.setColor=function(r,e,t,n){this.r=i(0,255,o(Number(r),0)),this.g=i(0,255,o(Number(e),0)),this.b=i(0,255,o(Number(t),0)),this.a=i(0,1,o(Number(n),1))},r.prototype.toRGBA=function(){var r=this.toJson();return 1===r.a?"rgb(".concat(r.r,",").concat(r.g,",").concat(r.b,")"):"rgba(".concat(r.r,",").concat(r.g,",").concat(r.b,",").concat(r.a,")")},r.prototype.toString=function(){return this.toRGBA()},r.prototype.toNormalize=function(){return{r:u(this.r/255,2),g:u(this.g/255,2),b:u(this.b/255,2),a:u(this.a,2)}},r.prototype.toHEX=function(){var r=this.toJson(),e=r.r.toString(16);e.length<2&&(e="0".concat(e));var t=r.g.toString(16);t.length<2&&(t="0".concat(t));var n=r.b.toString(16);if(n.length<2&&(n="0".concat(n)),this.a<1){var a=parseInt((255*this.a).toFixed()).toString(16);return a.length<2&&(a="0".concat(a)),"#".concat(e).concat(t).concat(n).concat(a)}return"#".concat(e).concat(t).concat(n)},r.prototype.toArray=function(){var r=this.toJson();return[r.r,r.g,r.b,r.a]},r.prototype.toJson=function(){return{r:parseInt(this.r.toFixed()),g:parseInt(this.g.toFixed()),b:parseInt(this.b.toFixed()),a:parseFloat(this.a.toFixed(2))}},r.prototype.clone=function(){return new r(this.r,this.g,this.b,this.a)},r.prototype.equals=function(r){return this===r||this.r===r.r&&this.g===r.g&&this.b===r.g&&this.a===r.a},r}(),c=function(){function r(){}return r.clearStrSpace=function(r){return r.replace(/\s/g,"")},r.trimStr=function(r){return(r=r.replace(/\s+/g," ")).trim()},r.parse3BitsHEX=function(e){var t=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i.exec(e);if(t){var n=o(t[4],"f");return[r._parseResStrForRgb(parseInt(t[1]+t[1],16)),r._parseResStrForRgb(parseInt(t[2]+t[2],16)),r._parseResStrForRgb(parseInt(t[3]+t[3],16)),r._parsePercent(parseInt(n+n,16)/255)]}return null},r.parse6BitsHEX=function(e){var t=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i.exec(e);if(t){var n=o(t[4],"ff");return[r._parseResStrForRgb(parseInt(t[1],16)),r._parseResStrForRgb(parseInt(t[2],16)),r._parseResStrForRgb(parseInt(t[3],16)),r._parsePercent(parseInt(n,16)/255)]}return null},r.parseRGBA=function(e){var t=/^rgba?\(([0-9.]+%?),([0-9.]+%?),([0-9.]+%?)(?:,([0-9.]+%?))?\)$/i.exec(e);return t?[r._parseResStrForRgb(t[1]),r._parseResStrForRgb(t[2]),r._parseResStrForRgb(t[3]),r._parsePercent(t[4])]:null},r.parseHSLA=function(e){var t=/^hsla?\(([0-9.]+)(?:deg)?,([0-9.]+%?),([0-9.]+%?)(?:,([0-9.]+%?))?\)$/i.exec(e);return t?[r._parseResStrForHue(t[1]),r._parsePercent(t[2]),r._parsePercent(t[3]),r._parsePercent(t[4])]:null},r.parseHWB=function(e){var t=/^hwb\s?\(\s?([0-9.]+)(?:deg)?\s([0-9.]+%?)\s([0-9.]+%?)\s?(?:\/\s?([0-9.]+%?))?\s?\)$/i.exec(e);return t?[r._parseResStrForHue(t[1]),r._parsePercent(t[2]),r._parsePercent(t[3]),r._parsePercent(t[4])]:null},r.parseRGBA2=function(e){var t=/^rgba?\s?\(\s?([0-9.]+%?)\s?([0-9.]+%?)\s?([0-9.]+%?)(?:\s?\/\s?([0-9.]+%?))?\s?\)$/i.exec(e);return t?[r._parseResStrForRgb(t[1]),r._parseResStrForRgb(t[2]),r._parseResStrForRgb(t[3]),r._parsePercent(t[4])]:null},r.parseHSLA2=function(e){var t=/^hsla?\s?\(\s?([0-9.]+)(?:deg)?\s([0-9.]+%?)\s([0-9.]+%?)\s?(?:\/\s?([0-9.]+%?))?\s?\)$/i.exec(e);return t?[r._parseResStrForHue(t[1]),r._parsePercent(t[2]),r._parsePercent(t[3]),r._parsePercent(t[4])]:null},r._parseResStrForRgb=function(r){return"string"==typeof r&&(r=parseFloat(r)/("%"===r.substr(-1)?100/255:1)),isNaN(r)&&(r=1),i(0,255,r)},r._parseResStrForHue=function(r){return"string"==typeof r&&(r=parseFloat(r)),isNaN(r)&&(r=0),i(0,360,r)},r._parsePercent=function(r){return"string"==typeof r&&(r=parseFloat(r)/("%"===r.substr(-1)?100:1)),isNaN(r)&&(r=1),i(0,1,r)},r}(),l=t(907),h=t.n(l);function f(r){var e=c.clearStrSpace(r),t=h().keyword.rgb(e);return t&&S(t)}function p(r){var e=c.clearStrSpace(r),t=c.parse3BitsHEX(e);return t||(t=c.parse6BitsHEX(e)),t&&S(t)}function b(r){var e=c.clearStrSpace(r),t=c.parseRGBA(e);if(!t){var n=c.trimStr(r);t=c.parseRGBA2(n)}return t&&S(t)}function g(r){var e=c.clearStrSpace(r),t=c.parseHSLA(e);if(!t){var n=c.trimStr(r);t=c.parseHSLA2(n)}return t&&m(t[0],t[1],t[2],t[3])}function v(r){var e=c.trimStr(r),t=c.parseHWB(e);return t&&w(t[0],t[1],t[2],t[3])}function y(r){return a.type("string","color",r),p(r)||b(r)||f(r)||g(r)||v(r)}function d(r){return a.type("string","color",r),p(r)||b(r)||f(r)||g(r)||v(r)}function m(r,e,t,n){var a=h().hsl.rgb(i(0,360,r),i(0,100,100*e),i(0,100,100*t));return new s(a[0],a[1],a[2],o(Number(n),1))}function w(r,e,t,n){var a=h().hwb.rgb(i(0,360,r),i(0,100,100*e),i(0,100,100*t));return new s(a[0],a[1],a[2],o(Number(n),1))}function M(r,e){if("string"==typeof r&&(r=y(r)),"string"==typeof e&&(e=y(e)),!r||!e)throw new Error("fail to create object from random");var t=Math.random()*Math.abs(e.r-r.r)+Math.min(r.r,e.r),n=Math.random()*Math.abs(e.g-r.g)+Math.min(r.g,e.g),a=Math.random()*Math.abs(e.b-r.b)+Math.min(r.b,e.b),o=Math.random()*Math.abs(e.a-r.a)+Math.min(r.a,e.a);return new s(t,n,a,o)}function k(r){return new s(r.r,r.g,r.b,r.a)}function S(r){return new s(r[0],r[1],r[2],r[3])}var x=e({CssColorParser:s},r)}(),n}()}));
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "css-color-parser-h",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "A tool for parsing css color",
5
- "main": "dist/css-color-parser-h.common.min.js",
5
+ "main": "dist/css-color-parser-h.common.js",
6
+ "types": "@types/css-color-parser-h.d.ts",
6
7
  "scripts": {
7
8
  "build": "webpack && node release.js"
8
9
  },
@@ -37,6 +38,7 @@
37
38
  "clean-webpack-plugin": "^4.0.0",
38
39
  "fs-extra": "^11.1.0",
39
40
  "ts-loader": "^9.4.1",
41
+ "tslib": "^2.5.2",
40
42
  "typescript": "^4.9.3",
41
43
  "webpack": "^5.75.0",
42
44
  "webpack-cli": "^5.0.0",
@@ -1 +0,0 @@
1
- !function(){"use strict";var r={819:function(r){r.exports=require("color-convert")}},t={};function e(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={exports:{}};return r[n](a,a.exports,e),a.exports}e.d=function(r,t){for(var n in t)e.o(t,n)&&!e.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:t[n]})},e.o=function(r,t){return Object.prototype.hasOwnProperty.call(r,t)},e.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})};var n={};!function(){e.r(n),e.d(n,{CssColorParser:function(){return s},fromArray:function(){return _},fromColorStr:function(){return h},fromHSL:function(){return S},fromHWB:function(){return v},fromJson:function(){return R},fromRandom:function(){return y},parseCssColorStr:function(){return l},parseHEX:function(){return p},parseHSLA:function(){return b},parseHWB:function(){return g},parseKeyWord:function(){return u},parseRGBA:function(){return f}});var r=function(){function r(){}return r.type=function(r,t,e){var n=typeof e;if(n!==r)throw new Error("Expected ".concat(t," to be typeof ").concat(r,", actual typeof was ").concat(n))},r.types=function(r,t,e){var n=typeof e;if(!r.includes(n))throw new Error("Expected ".concat(t," to be typeof ").concat(r.join("|"),", actual typeof was ").concat(n))},r}();function t(r,t){return null==r||isNaN(r)&&"number"==typeof t?t:r}function o(r,t,e){return e>t?e=t:e<r&&(e=r),e}function a(r,t){return Number(r.toFixed(t))}var s=function(){function r(r,t,e,n){this.r=255,this.g=255,this.b=255,this.a=1,this.setColor(r,t,e,n)}return r.prototype.setColor=function(r,e,n,a){this.r=o(0,255,t(Number(r),0)),this.g=o(0,255,t(Number(e),0)),this.b=o(0,255,t(Number(n),0)),this.a=o(0,1,t(Number(a),1))},r.prototype.toRGBA=function(){var r=this.toJson();return 1===r.a?"rgb(".concat(r.r,",").concat(r.g,",").concat(r.b,")"):"rgba(".concat(r.r,",").concat(r.g,",").concat(r.b,",").concat(r.a,")")},r.prototype.toString=function(){return this.toRGBA()},r.prototype.toNormalize=function(){return{r:a(this.r/255,2),g:a(this.g/255,2),b:a(this.b/255,2),a:a(this.a,2)}},r.prototype.toHEX=function(){var r=this.toJson(),t=r.r.toString(16);t.length<2&&(t="0".concat(t));var e=r.g.toString(16);e.length<2&&(e="0".concat(e));var n=r.b.toString(16);if(n.length<2&&(n="0".concat(n)),this.a<1){var o=parseInt((255*this.a).toFixed()).toString(16);return o.length<2&&(o="0".concat(o)),"#".concat(t).concat(e).concat(n).concat(o)}return"#".concat(t).concat(e).concat(n)},r.prototype.toArray=function(){var r=this.toJson();return[r.r,r.g,r.b,r.a]},r.prototype.toJson=function(){return{r:parseInt(this.r.toFixed()),g:parseInt(this.g.toFixed()),b:parseInt(this.b.toFixed()),a:parseFloat(this.a.toFixed(2))}},r.prototype.clone=function(){return new r(this.r,this.g,this.b,this.a)},r.prototype.equals=function(r){return this===r||this.r===r.r&&this.g===r.g&&this.b===r.g&&this.a===r.a},r}(),c=function(){function r(){}return r.clearStrSpace=function(r){return r.replace(/\s/g,"")},r.trimStr=function(r){return(r=r.replace(/\s+/g," ")).trim()},r.parse3BitsHEX=function(e){var n=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i.exec(e);if(n){var o=t(n[4],"f");return[r._parseResStrForRgb(parseInt(n[1]+n[1],16)),r._parseResStrForRgb(parseInt(n[2]+n[2],16)),r._parseResStrForRgb(parseInt(n[3]+n[3],16)),r._parsePercent(parseInt(o+o,16)/255)]}return null},r.parse6BitsHEX=function(e){var n=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i.exec(e);if(n){var o=t(n[4],"ff");return[r._parseResStrForRgb(parseInt(n[1],16)),r._parseResStrForRgb(parseInt(n[2],16)),r._parseResStrForRgb(parseInt(n[3],16)),r._parsePercent(parseInt(o,16)/255)]}return null},r.parseRGBA=function(t){var e=/^rgba?\(([0-9.]+%?),([0-9.]+%?),([0-9.]+%?)(?:,([0-9.]+%?))?\)$/i.exec(t);return e?[r._parseResStrForRgb(e[1]),r._parseResStrForRgb(e[2]),r._parseResStrForRgb(e[3]),r._parsePercent(e[4])]:null},r.parseHSLA=function(t){var e=/^hsla?\(([0-9.]+)(?:deg)?,([0-9.]+%?),([0-9.]+%?)(?:,([0-9.]+%?))?\)$/i.exec(t);return e?[r._parseResStrForHue(e[1]),r._parsePercent(e[2]),r._parsePercent(e[3]),r._parsePercent(e[4])]:null},r.parseHWB=function(t){var e=/^hwb\s?\(\s?([0-9.]+)(?:deg)?\s([0-9.]+%?)\s([0-9.]+%?)\s?(?:\/\s?([0-9.]+%?))?\s?\)$/i.exec(t);return e?[r._parseResStrForHue(e[1]),r._parsePercent(e[2]),r._parsePercent(e[3]),r._parsePercent(e[4])]:null},r.parseRGBA2=function(t){var e=/^rgba?\s?\(\s?([0-9.]+%?)\s?([0-9.]+%?)\s?([0-9.]+%?)(?:\s?\/\s?([0-9.]+%?))?\s?\)$/i.exec(t);return e?[r._parseResStrForRgb(e[1]),r._parseResStrForRgb(e[2]),r._parseResStrForRgb(e[3]),r._parsePercent(e[4])]:null},r.parseHSLA2=function(t){var e=/^hsla?\s?\(\s?([0-9.]+)(?:deg)?\s([0-9.]+%?)\s([0-9.]+%?)\s?(?:\/\s?([0-9.]+%?))?\s?\)$/i.exec(t);return e?[r._parseResStrForHue(e[1]),r._parsePercent(e[2]),r._parsePercent(e[3]),r._parsePercent(e[4])]:null},r._parseResStrForRgb=function(r){return"string"==typeof r&&(r=parseFloat(r)/("%"===r.substr(-1)?100/255:1)),isNaN(r)&&(r=1),o(0,255,r)},r._parseResStrForHue=function(r){return"string"==typeof r&&(r=parseFloat(r)),isNaN(r)&&(r=0),o(0,360,r)},r._parsePercent=function(r){return"string"==typeof r&&(r=parseFloat(r)/("%"===r.substr(-1)?100:1)),isNaN(r)&&(r=1),o(0,1,r)},r}(),i=e(819);function u(r){var t=c.clearStrSpace(r),e=i.keyword.rgb(t);return e&&_(e)}function p(r){var t=c.clearStrSpace(r),e=c.parse3BitsHEX(t);return e||(e=c.parse6BitsHEX(t)),e&&_(e)}function f(r){var t=c.clearStrSpace(r),e=c.parseRGBA(t);if(!e){var n=c.trimStr(r);e=c.parseRGBA2(n)}return e&&_(e)}function b(r){var t=c.clearStrSpace(r),e=c.parseHSLA(t);if(!e){var n=c.trimStr(r);e=c.parseHSLA2(n)}return e&&S(e[0],e[1],e[2],e[3])}function g(r){var t=c.trimStr(r),e=c.parseHWB(t);return e&&v(e[0],e[1],e[2],e[3])}function l(t){return r.type("string","color",t),p(t)||f(t)||u(t)||b(t)||g(t)}function h(t){return r.type("string","color",t),p(t)||f(t)||u(t)||b(t)||g(t)}function S(r,e,n,a){var c=i.hsl.rgb(o(0,360,r),o(0,100,100*e),o(0,100,100*n));return new s(c[0],c[1],c[2],t(Number(a),1))}function v(r,e,n,a){var c=i.hwb.rgb(o(0,360,r),o(0,100,100*e),o(0,100,100*n));return new s(c[0],c[1],c[2],t(Number(a),1))}function y(r,t){if("string"==typeof r&&(r=l(r)),"string"==typeof t&&(t=l(t)),!r||!t)throw new Error("fail to create object from random");var e=Math.random()*Math.abs(t.r-r.r)+Math.min(r.r,t.r),n=Math.random()*Math.abs(t.g-r.g)+Math.min(r.g,t.g),o=Math.random()*Math.abs(t.b-r.b)+Math.min(r.b,t.b),a=Math.random()*Math.abs(t.a-r.a)+Math.min(r.a,t.a);return new s(e,n,o,a)}function R(r){return new s(r.r,r.g,r.b,r.a)}function _(r){return new s(r[0],r[1],r[2],r[3])}}();var o=exports;for(var a in n)o[a]=n[a];n.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})}();