acacia-ui 1.1.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/components/layout/VerticalLayout/VerticalLayout.d.ts +1 -1
  2. package/dist/components/layout/VerticalLayout/VerticalLayout.d.ts.map +1 -1
  3. package/dist/components/ui/Avatar/Avatar.d.ts.map +1 -1
  4. package/dist/components/ui/Breadcrumb/Breadcrumb.d.ts.map +1 -1
  5. package/dist/components/ui/ConfigProvider/ConfigProvider.d.ts.map +1 -1
  6. package/dist/components/ui/ConfigProvider/defaultTheme.d.ts +1 -1
  7. package/dist/components/ui/ConfigProvider/defaultTheme.d.ts.map +1 -1
  8. package/dist/components/ui/Menu/Menu.d.ts.map +1 -1
  9. package/dist/components/ui/Modal/Modal.d.ts +7 -0
  10. package/dist/components/ui/Modal/Modal.d.ts.map +1 -0
  11. package/dist/components/ui/Pagination/Pagination.d.ts.map +1 -1
  12. package/dist/components/ui/Panel/Panel.d.ts +2 -1
  13. package/dist/components/ui/Panel/Panel.d.ts.map +1 -1
  14. package/dist/components/ui/Panel/usePanelStyles.d.ts +3 -1
  15. package/dist/components/ui/Panel/usePanelStyles.d.ts.map +1 -1
  16. package/dist/components/ui/Popconfirm/Popconfirm.d.ts +4 -0
  17. package/dist/components/ui/Popconfirm/Popconfirm.d.ts.map +1 -0
  18. package/dist/components/ui/Tabs/Tabs.d.ts.map +1 -1
  19. package/dist/components/ui/Typography/Typography.d.ts +3 -2
  20. package/dist/components/ui/Typography/Typography.d.ts.map +1 -1
  21. package/dist/components/ui/Typography/useTypographyStyles.d.ts +1 -0
  22. package/dist/components/ui/Typography/useTypographyStyles.d.ts.map +1 -1
  23. package/dist/components/ui/interfaces.d.ts +16 -54
  24. package/dist/components/ui/interfaces.d.ts.map +1 -1
  25. package/dist/index.d.ts +4 -1
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/main.js +4393 -70
  28. package/dist/main.js.map +1 -1
  29. package/dist/theme/customTheme.d.ts +2 -0
  30. package/dist/theme/customTheme.d.ts.map +1 -1
  31. package/dist/utils/colors.util.d.ts +1 -0
  32. package/dist/utils/colors.util.d.ts.map +1 -1
  33. package/dist/utils/theming.util.d.ts +5 -0
  34. package/dist/utils/theming.util.d.ts.map +1 -0
  35. package/package.json +4 -1
  36. package/dist/theme/antdTheme.d.ts +0 -4
  37. package/dist/theme/antdTheme.d.ts.map +0 -1
package/dist/main.js CHANGED
@@ -3249,6 +3249,4044 @@ function useComponentConfig(propName) {
3249
3249
  };
3250
3250
  }
3251
3251
 
3252
+ /***/ },
3253
+
3254
+ /***/ "./node_modules/chroma-js/dist/chroma.cjs"
3255
+ /*!************************************************!*\
3256
+ !*** ./node_modules/chroma-js/dist/chroma.cjs ***!
3257
+ \************************************************/
3258
+ (module) {
3259
+
3260
+ /**
3261
+ * chroma.js - JavaScript library for color conversions
3262
+ *
3263
+ * Copyright (c) 2011-2025, Gregor Aisch
3264
+ * All rights reserved.
3265
+ *
3266
+ * Redistribution and use in source and binary forms, with or without
3267
+ * modification, are permitted provided that the following conditions are met:
3268
+ *
3269
+ * 1. Redistributions of source code must retain the above copyright notice, this
3270
+ * list of conditions and the following disclaimer.
3271
+ *
3272
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
3273
+ * this list of conditions and the following disclaimer in the documentation
3274
+ * and/or other materials provided with the distribution.
3275
+ *
3276
+ * 3. The name Gregor Aisch may not be used to endorse or promote products
3277
+ * derived from this software without specific prior written permission.
3278
+ *
3279
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
3280
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
3281
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
3282
+ * DISCLAIMED. IN NO EVENT SHALL GREGOR AISCH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
3283
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
3284
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3285
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
3286
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
3287
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
3288
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3289
+ *
3290
+ * -------------------------------------------------------
3291
+ *
3292
+ * chroma.js includes colors from colorbrewer2.org, which are released under
3293
+ * the following license:
3294
+ *
3295
+ * Copyright (c) 2002 Cynthia Brewer, Mark Harrower,
3296
+ * and The Pennsylvania State University.
3297
+ *
3298
+ * Licensed under the Apache License, Version 2.0 (the "License");
3299
+ * you may not use this file except in compliance with the License.
3300
+ * You may obtain a copy of the License at
3301
+ * http://www.apache.org/licenses/LICENSE-2.0
3302
+ *
3303
+ * Unless required by applicable law or agreed to in writing,
3304
+ * software distributed under the License is distributed on an
3305
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
3306
+ * either express or implied. See the License for the specific
3307
+ * language governing permissions and limitations under the License.
3308
+ *
3309
+ * ------------------------------------------------------
3310
+ *
3311
+ * Named colors are taken from X11 Color Names.
3312
+ * http://www.w3.org/TR/css3-color/#svg-color
3313
+ *
3314
+ * @preserve
3315
+ */
3316
+
3317
+ (function (global, factory) {
3318
+ true ? module.exports = factory() :
3319
+ 0;
3320
+ })(this, (function () { 'use strict';
3321
+
3322
+ var min$4 = Math.min;
3323
+ var max$4 = Math.max;
3324
+
3325
+ function limit (x, low, high) {
3326
+ if ( low === void 0 ) low = 0;
3327
+ if ( high === void 0 ) high = 1;
3328
+
3329
+ return min$4(max$4(low, x), high);
3330
+ }
3331
+
3332
+ function clip_rgb (rgb) {
3333
+ rgb._clipped = false;
3334
+ rgb._unclipped = rgb.slice(0);
3335
+ for (var i = 0; i <= 3; i++) {
3336
+ if (i < 3) {
3337
+ if (rgb[i] < 0 || rgb[i] > 255) { rgb._clipped = true; }
3338
+ rgb[i] = limit(rgb[i], 0, 255);
3339
+ } else if (i === 3) {
3340
+ rgb[i] = limit(rgb[i], 0, 1);
3341
+ }
3342
+ }
3343
+ return rgb;
3344
+ }
3345
+
3346
+ // ported from jQuery's $.type
3347
+ var classToType = {};
3348
+ for (var i = 0, list = [
3349
+ 'Boolean',
3350
+ 'Number',
3351
+ 'String',
3352
+ 'Function',
3353
+ 'Array',
3354
+ 'Date',
3355
+ 'RegExp',
3356
+ 'Undefined',
3357
+ 'Null'
3358
+ ]; i < list.length; i += 1) {
3359
+ var name = list[i];
3360
+
3361
+ classToType[("[object " + name + "]")] = name.toLowerCase();
3362
+ }
3363
+ function type (obj) {
3364
+ return classToType[Object.prototype.toString.call(obj)] || 'object';
3365
+ }
3366
+
3367
+ function unpack (args, keyOrder) {
3368
+ if ( keyOrder === void 0 ) keyOrder = null;
3369
+
3370
+ // if called with more than 3 arguments, we return the arguments
3371
+ if (args.length >= 3) { return Array.prototype.slice.call(args); }
3372
+ // with less than 3 args we check if first arg is object
3373
+ // and use the keyOrder string to extract and sort properties
3374
+ if (type(args[0]) == 'object' && keyOrder) {
3375
+ return keyOrder
3376
+ .split('')
3377
+ .filter(function (k) { return args[0][k] !== undefined; })
3378
+ .map(function (k) { return args[0][k]; });
3379
+ }
3380
+ // otherwise we just return the first argument
3381
+ // (which we suppose is an array of args)
3382
+ return args[0].slice(0);
3383
+ }
3384
+
3385
+ function last (args) {
3386
+ if (args.length < 2) { return null; }
3387
+ var l = args.length - 1;
3388
+ if (type(args[l]) == 'string') { return args[l].toLowerCase(); }
3389
+ return null;
3390
+ }
3391
+
3392
+ var PI$2 = Math.PI;
3393
+ var min$3 = Math.min;
3394
+ var max$3 = Math.max;
3395
+
3396
+ var rnd2 = function (a) { return Math.round(a * 100) / 100; };
3397
+ var rnd3 = function (a) { return Math.round(a * 100) / 100; };
3398
+
3399
+ var TWOPI = PI$2 * 2;
3400
+ var PITHIRD = PI$2 / 3;
3401
+ var DEG2RAD = PI$2 / 180;
3402
+ var RAD2DEG = 180 / PI$2;
3403
+
3404
+ /**
3405
+ * Reverse the first three elements of an array
3406
+ *
3407
+ * @param {any[]} arr
3408
+ * @returns {any[]}
3409
+ */
3410
+ function reverse3(arr) {
3411
+ return arr.slice(0, 3).reverse().concat( arr.slice(3));
3412
+ }
3413
+
3414
+ var input = {
3415
+ format: {},
3416
+ autodetect: []
3417
+ };
3418
+
3419
+ var Color = function Color() {
3420
+ var args = [], len = arguments.length;
3421
+ while ( len-- ) args[ len ] = arguments[ len ];
3422
+
3423
+ var me = this;
3424
+ if (
3425
+ type(args[0]) === 'object' &&
3426
+ args[0].constructor &&
3427
+ args[0].constructor === this.constructor
3428
+ ) {
3429
+ // the argument is already a Color instance
3430
+ return args[0];
3431
+ }
3432
+ // last argument could be the mode
3433
+ var mode = last(args);
3434
+ var autodetect = false;
3435
+ if (!mode) {
3436
+ autodetect = true;
3437
+
3438
+ if (!input.sorted) {
3439
+ input.autodetect = input.autodetect.sort(function (a, b) { return b.p - a.p; });
3440
+ input.sorted = true;
3441
+ }
3442
+
3443
+ // auto-detect format
3444
+ for (var i = 0, list = input.autodetect; i < list.length; i += 1) {
3445
+ var chk = list[i];
3446
+
3447
+ mode = chk.test.apply(chk, args);
3448
+ if (mode) { break; }
3449
+ }
3450
+ }
3451
+ if (input.format[mode]) {
3452
+ var rgb = input.format[mode].apply(
3453
+ null,
3454
+ autodetect ? args : args.slice(0, -1)
3455
+ );
3456
+ me._rgb = clip_rgb(rgb);
3457
+ } else {
3458
+ throw new Error('unknown format: ' + args);
3459
+ }
3460
+ // add alpha channel
3461
+ if (me._rgb.length === 3) { me._rgb.push(1); }
3462
+ };
3463
+ Color.prototype.toString = function toString () {
3464
+ if (type(this.hex) == 'function') { return this.hex(); }
3465
+ return ("[" + (this._rgb.join(',')) + "]");
3466
+ };
3467
+
3468
+ // this gets updated automatically
3469
+ var version = '3.2.0';
3470
+
3471
+ var chroma = function () {
3472
+ var args = [], len = arguments.length;
3473
+ while ( len-- ) args[ len ] = arguments[ len ];
3474
+
3475
+ return new (Function.prototype.bind.apply( Color, [ null ].concat( args) ));
3476
+ };
3477
+
3478
+ chroma.version = version;
3479
+
3480
+ var cmyk2rgb = function () {
3481
+ var args = [], len = arguments.length;
3482
+ while ( len-- ) args[ len ] = arguments[ len ];
3483
+
3484
+ args = unpack(args, 'cmyk');
3485
+ var c = args[0];
3486
+ var m = args[1];
3487
+ var y = args[2];
3488
+ var k = args[3];
3489
+ var alpha = args.length > 4 ? args[4] : 1;
3490
+ if (k === 1) { return [0, 0, 0, alpha]; }
3491
+ return [
3492
+ c >= 1 ? 0 : 255 * (1 - c) * (1 - k), // r
3493
+ m >= 1 ? 0 : 255 * (1 - m) * (1 - k), // g
3494
+ y >= 1 ? 0 : 255 * (1 - y) * (1 - k), // b
3495
+ alpha
3496
+ ];
3497
+ };
3498
+
3499
+ var max$2 = Math.max;
3500
+
3501
+ var rgb2cmyk = function () {
3502
+ var args = [], len = arguments.length;
3503
+ while ( len-- ) args[ len ] = arguments[ len ];
3504
+
3505
+ var ref = unpack(args, 'rgb');
3506
+ var r = ref[0];
3507
+ var g = ref[1];
3508
+ var b = ref[2];
3509
+ r = r / 255;
3510
+ g = g / 255;
3511
+ b = b / 255;
3512
+ var k = 1 - max$2(r, max$2(g, b));
3513
+ var f = k < 1 ? 1 / (1 - k) : 0;
3514
+ var c = (1 - r - k) * f;
3515
+ var m = (1 - g - k) * f;
3516
+ var y = (1 - b - k) * f;
3517
+ return [c, m, y, k];
3518
+ };
3519
+
3520
+ Color.prototype.cmyk = function () {
3521
+ return rgb2cmyk(this._rgb);
3522
+ };
3523
+
3524
+ var cmyk = function () {
3525
+ var args = [], len = arguments.length;
3526
+ while ( len-- ) args[ len ] = arguments[ len ];
3527
+
3528
+ return new (Function.prototype.bind.apply( Color, [ null ].concat( args, ['cmyk']) ));
3529
+ };
3530
+ Object.assign(chroma, { cmyk: cmyk });
3531
+
3532
+ input.format.cmyk = cmyk2rgb;
3533
+
3534
+ input.autodetect.push({
3535
+ p: 2,
3536
+ test: function () {
3537
+ var args = [], len = arguments.length;
3538
+ while ( len-- ) args[ len ] = arguments[ len ];
3539
+
3540
+ args = unpack(args, 'cmyk');
3541
+ if (type(args) === 'array' && args.length === 4) {
3542
+ return 'cmyk';
3543
+ }
3544
+ }
3545
+ });
3546
+
3547
+ /*
3548
+ * supported arguments:
3549
+ * - hsl2css(h,s,l)
3550
+ * - hsl2css(h,s,l,a)
3551
+ * - hsl2css([h,s,l], mode)
3552
+ * - hsl2css([h,s,l,a], mode)
3553
+ * - hsl2css({h,s,l,a}, mode)
3554
+ */
3555
+ var hsl2css = function () {
3556
+ var args = [], len = arguments.length;
3557
+ while ( len-- ) args[ len ] = arguments[ len ];
3558
+
3559
+ var hsla = unpack(args, 'hsla');
3560
+ var mode = last(args) || 'lsa';
3561
+ hsla[0] = rnd2(hsla[0] || 0) + 'deg';
3562
+ hsla[1] = rnd2(hsla[1] * 100) + '%';
3563
+ hsla[2] = rnd2(hsla[2] * 100) + '%';
3564
+ if (mode === 'hsla' || (hsla.length > 3 && hsla[3] < 1)) {
3565
+ hsla[3] = '/ ' + (hsla.length > 3 ? hsla[3] : 1);
3566
+ mode = 'hsla';
3567
+ } else {
3568
+ hsla.length = 3;
3569
+ }
3570
+ return ((mode.substr(0, 3)) + "(" + (hsla.join(' ')) + ")");
3571
+ };
3572
+
3573
+ /*
3574
+ * supported arguments:
3575
+ * - rgb2hsl(r,g,b)
3576
+ * - rgb2hsl(r,g,b,a)
3577
+ * - rgb2hsl([r,g,b])
3578
+ * - rgb2hsl([r,g,b,a])
3579
+ * - rgb2hsl({r,g,b,a})
3580
+ */
3581
+ var rgb2hsl$1 = function () {
3582
+ var args = [], len = arguments.length;
3583
+ while ( len-- ) args[ len ] = arguments[ len ];
3584
+
3585
+ args = unpack(args, 'rgba');
3586
+ var r = args[0];
3587
+ var g = args[1];
3588
+ var b = args[2];
3589
+
3590
+ r /= 255;
3591
+ g /= 255;
3592
+ b /= 255;
3593
+
3594
+ var minRgb = min$3(r, g, b);
3595
+ var maxRgb = max$3(r, g, b);
3596
+
3597
+ var l = (maxRgb + minRgb) / 2;
3598
+ var s, h;
3599
+
3600
+ if (maxRgb === minRgb) {
3601
+ s = 0;
3602
+ h = Number.NaN;
3603
+ } else {
3604
+ s =
3605
+ l < 0.5
3606
+ ? (maxRgb - minRgb) / (maxRgb + minRgb)
3607
+ : (maxRgb - minRgb) / (2 - maxRgb - minRgb);
3608
+ }
3609
+
3610
+ if (r == maxRgb) { h = (g - b) / (maxRgb - minRgb); }
3611
+ else if (g == maxRgb) { h = 2 + (b - r) / (maxRgb - minRgb); }
3612
+ else if (b == maxRgb) { h = 4 + (r - g) / (maxRgb - minRgb); }
3613
+
3614
+ h *= 60;
3615
+ if (h < 0) { h += 360; }
3616
+ if (args.length > 3 && args[3] !== undefined) { return [h, s, l, args[3]]; }
3617
+ return [h, s, l];
3618
+ };
3619
+
3620
+ /*
3621
+ * supported arguments:
3622
+ * - lab2css(l,a,b)
3623
+ * - lab2css(l,a,b,alpha)
3624
+ * - lab2css([l,a,b], mode)
3625
+ * - lab2css([l,a,b,alpha], mode)
3626
+ */
3627
+ var lab2css = function () {
3628
+ var args = [], len = arguments.length;
3629
+ while ( len-- ) args[ len ] = arguments[ len ];
3630
+
3631
+ var laba = unpack(args, 'lab');
3632
+ var mode = last(args) || 'lab';
3633
+ laba[0] = rnd2(laba[0]) + '%';
3634
+ laba[1] = rnd2(laba[1]);
3635
+ laba[2] = rnd2(laba[2]);
3636
+ if (mode === 'laba' || (laba.length > 3 && laba[3] < 1)) {
3637
+ laba[3] = '/ ' + (laba.length > 3 ? laba[3] : 1);
3638
+ } else {
3639
+ laba.length = 3;
3640
+ }
3641
+ return ("lab(" + (laba.join(' ')) + ")");
3642
+ };
3643
+
3644
+ var labConstants = {
3645
+ // Corresponds roughly to RGB brighter/darker
3646
+ Kn: 18,
3647
+
3648
+ // D65 standard referent
3649
+ labWhitePoint: 'd65',
3650
+ Xn: 0.95047,
3651
+ Yn: 1,
3652
+ Zn: 1.08883,
3653
+
3654
+ kE: 216.0 / 24389.0,
3655
+ kKE: 8.0,
3656
+ kK: 24389.0 / 27.0,
3657
+
3658
+ RefWhiteRGB: {
3659
+ // sRGB
3660
+ X: 0.95047,
3661
+ Y: 1,
3662
+ Z: 1.08883
3663
+ },
3664
+
3665
+ MtxRGB2XYZ: {
3666
+ m00: 0.4124564390896922,
3667
+ m01: 0.21267285140562253,
3668
+ m02: 0.0193338955823293,
3669
+ m10: 0.357576077643909,
3670
+ m11: 0.715152155287818,
3671
+ m12: 0.11919202588130297,
3672
+ m20: 0.18043748326639894,
3673
+ m21: 0.07217499330655958,
3674
+ m22: 0.9503040785363679
3675
+ },
3676
+
3677
+ MtxXYZ2RGB: {
3678
+ m00: 3.2404541621141045,
3679
+ m01: -0.9692660305051868,
3680
+ m02: 0.055643430959114726,
3681
+ m10: -1.5371385127977166,
3682
+ m11: 1.8760108454466942,
3683
+ m12: -0.2040259135167538,
3684
+ m20: -0.498531409556016,
3685
+ m21: 0.041556017530349834,
3686
+ m22: 1.0572251882231791
3687
+ },
3688
+
3689
+ // used in rgb2xyz
3690
+ As: 0.9414285350000001,
3691
+ Bs: 1.040417467,
3692
+ Cs: 1.089532651,
3693
+
3694
+ MtxAdaptMa: {
3695
+ m00: 0.8951,
3696
+ m01: -0.7502,
3697
+ m02: 0.0389,
3698
+ m10: 0.2664,
3699
+ m11: 1.7135,
3700
+ m12: -0.0685,
3701
+ m20: -0.1614,
3702
+ m21: 0.0367,
3703
+ m22: 1.0296
3704
+ },
3705
+
3706
+ MtxAdaptMaI: {
3707
+ m00: 0.9869929054667123,
3708
+ m01: 0.43230526972339456,
3709
+ m02: -0.008528664575177328,
3710
+ m10: -0.14705425642099013,
3711
+ m11: 0.5183602715367776,
3712
+ m12: 0.04004282165408487,
3713
+ m20: 0.15996265166373125,
3714
+ m21: 0.0492912282128556,
3715
+ m22: 0.9684866957875502
3716
+ }
3717
+ };
3718
+
3719
+ // taken from https://de.mathworks.com/help/images/ref/whitepoint.html
3720
+ var ILLUMINANTS = new Map([
3721
+ // ASTM E308-01
3722
+ ['a', [1.0985, 0.35585]],
3723
+ // Wyszecki & Stiles, p. 769
3724
+ ['b', [1.0985, 0.35585]],
3725
+ // C ASTM E308-01
3726
+ ['c', [0.98074, 1.18232]],
3727
+ // D50 (ASTM E308-01)
3728
+ ['d50', [0.96422, 0.82521]],
3729
+ // D55 (ASTM E308-01)
3730
+ ['d55', [0.95682, 0.92149]],
3731
+ // D65 (ASTM E308-01)
3732
+ ['d65', [0.95047, 1.08883]],
3733
+ // E (ASTM E308-01)
3734
+ ['e', [1, 1, 1]],
3735
+ // F2 (ASTM E308-01)
3736
+ ['f2', [0.99186, 0.67393]],
3737
+ // F7 (ASTM E308-01)
3738
+ ['f7', [0.95041, 1.08747]],
3739
+ // F11 (ASTM E308-01)
3740
+ ['f11', [1.00962, 0.6435]],
3741
+ ['icc', [0.96422, 0.82521]]
3742
+ ]);
3743
+
3744
+ function setLabWhitePoint(name) {
3745
+ var ill = ILLUMINANTS.get(String(name).toLowerCase());
3746
+ if (!ill) {
3747
+ throw new Error('unknown Lab illuminant ' + name);
3748
+ }
3749
+ labConstants.labWhitePoint = name;
3750
+ labConstants.Xn = ill[0];
3751
+ labConstants.Zn = ill[1];
3752
+ }
3753
+
3754
+ function getLabWhitePoint() {
3755
+ return labConstants.labWhitePoint;
3756
+ }
3757
+
3758
+ var rgb2lab = function () {
3759
+ var args = [], len = arguments.length;
3760
+ while ( len-- ) args[ len ] = arguments[ len ];
3761
+
3762
+ var ref = unpack(args, 'rgb');
3763
+ var r = ref[0];
3764
+ var g = ref[1];
3765
+ var b = ref[2];
3766
+ var rest = ref.slice(3);
3767
+ var ref$1 = rgb2xyz(r, g, b);
3768
+ var x = ref$1[0];
3769
+ var y = ref$1[1];
3770
+ var z = ref$1[2];
3771
+ var ref$2 = xyz2lab(x, y, z);
3772
+ var L = ref$2[0];
3773
+ var a = ref$2[1];
3774
+ var b_ = ref$2[2];
3775
+ return [L, a, b_ ].concat( (rest.length > 0 && rest[0] < 1 ? [rest[0]] : []));
3776
+ };
3777
+
3778
+ function xyz2lab(x, y, z) {
3779
+ var Xn = labConstants.Xn;
3780
+ var Yn = labConstants.Yn;
3781
+ var Zn = labConstants.Zn;
3782
+ var kE = labConstants.kE;
3783
+ var kK = labConstants.kK;
3784
+ var xr = x / Xn;
3785
+ var yr = y / Yn;
3786
+ var zr = z / Zn;
3787
+
3788
+ var fx = xr > kE ? Math.pow(xr, 1.0 / 3.0) : (kK * xr + 16.0) / 116.0;
3789
+ var fy = yr > kE ? Math.pow(yr, 1.0 / 3.0) : (kK * yr + 16.0) / 116.0;
3790
+ var fz = zr > kE ? Math.pow(zr, 1.0 / 3.0) : (kK * zr + 16.0) / 116.0;
3791
+
3792
+ return [116.0 * fy - 16.0, 500.0 * (fx - fy), 200.0 * (fy - fz)];
3793
+ }
3794
+
3795
+ function gammaAdjustSRGB(companded) {
3796
+ var sign = Math.sign(companded);
3797
+ companded = Math.abs(companded);
3798
+ var linear =
3799
+ companded <= 0.04045
3800
+ ? companded / 12.92
3801
+ : Math.pow((companded + 0.055) / 1.055, 2.4);
3802
+ return linear * sign;
3803
+ }
3804
+
3805
+ var rgb2xyz = function (r, g, b) {
3806
+ // normalize and gamma adjust
3807
+ r = gammaAdjustSRGB(r / 255);
3808
+ g = gammaAdjustSRGB(g / 255);
3809
+ b = gammaAdjustSRGB(b / 255);
3810
+
3811
+ var MtxRGB2XYZ = labConstants.MtxRGB2XYZ;
3812
+ var MtxAdaptMa = labConstants.MtxAdaptMa;
3813
+ var MtxAdaptMaI = labConstants.MtxAdaptMaI;
3814
+ var Xn = labConstants.Xn;
3815
+ var Yn = labConstants.Yn;
3816
+ var Zn = labConstants.Zn;
3817
+ var As = labConstants.As;
3818
+ var Bs = labConstants.Bs;
3819
+ var Cs = labConstants.Cs;
3820
+
3821
+ var x = r * MtxRGB2XYZ.m00 + g * MtxRGB2XYZ.m10 + b * MtxRGB2XYZ.m20;
3822
+ var y = r * MtxRGB2XYZ.m01 + g * MtxRGB2XYZ.m11 + b * MtxRGB2XYZ.m21;
3823
+ var z = r * MtxRGB2XYZ.m02 + g * MtxRGB2XYZ.m12 + b * MtxRGB2XYZ.m22;
3824
+
3825
+ var Ad = Xn * MtxAdaptMa.m00 + Yn * MtxAdaptMa.m10 + Zn * MtxAdaptMa.m20;
3826
+ var Bd = Xn * MtxAdaptMa.m01 + Yn * MtxAdaptMa.m11 + Zn * MtxAdaptMa.m21;
3827
+ var Cd = Xn * MtxAdaptMa.m02 + Yn * MtxAdaptMa.m12 + Zn * MtxAdaptMa.m22;
3828
+
3829
+ var X = x * MtxAdaptMa.m00 + y * MtxAdaptMa.m10 + z * MtxAdaptMa.m20;
3830
+ var Y = x * MtxAdaptMa.m01 + y * MtxAdaptMa.m11 + z * MtxAdaptMa.m21;
3831
+ var Z = x * MtxAdaptMa.m02 + y * MtxAdaptMa.m12 + z * MtxAdaptMa.m22;
3832
+
3833
+ X *= Ad / As;
3834
+ Y *= Bd / Bs;
3835
+ Z *= Cd / Cs;
3836
+
3837
+ x = X * MtxAdaptMaI.m00 + Y * MtxAdaptMaI.m10 + Z * MtxAdaptMaI.m20;
3838
+ y = X * MtxAdaptMaI.m01 + Y * MtxAdaptMaI.m11 + Z * MtxAdaptMaI.m21;
3839
+ z = X * MtxAdaptMaI.m02 + Y * MtxAdaptMaI.m12 + Z * MtxAdaptMaI.m22;
3840
+
3841
+ return [x, y, z];
3842
+ };
3843
+
3844
+ /*
3845
+ * supported arguments:
3846
+ * - lab2css(l,a,b)
3847
+ * - lab2css(l,a,b,alpha)
3848
+ * - lab2css([l,a,b], mode)
3849
+ * - lab2css([l,a,b,alpha], mode)
3850
+ */
3851
+ var lch2css = function () {
3852
+ var args = [], len = arguments.length;
3853
+ while ( len-- ) args[ len ] = arguments[ len ];
3854
+
3855
+ var lcha = unpack(args, 'lch');
3856
+ var mode = last(args) || 'lab';
3857
+ lcha[0] = rnd2(lcha[0]) + '%';
3858
+ lcha[1] = rnd2(lcha[1]);
3859
+ lcha[2] = isNaN(lcha[2]) ? 'none' : rnd2(lcha[2]) + 'deg'; // add deg unit to hue
3860
+ if (mode === 'lcha' || (lcha.length > 3 && lcha[3] < 1)) {
3861
+ lcha[3] = '/ ' + (lcha.length > 3 ? lcha[3] : 1);
3862
+ } else {
3863
+ lcha.length = 3;
3864
+ }
3865
+ return ("lch(" + (lcha.join(' ')) + ")");
3866
+ };
3867
+
3868
+ var sqrt$4 = Math.sqrt;
3869
+ var atan2$2 = Math.atan2;
3870
+ var round$5 = Math.round;
3871
+
3872
+ var lab2lch = function () {
3873
+ var args = [], len = arguments.length;
3874
+ while ( len-- ) args[ len ] = arguments[ len ];
3875
+
3876
+ var ref = unpack(args, 'lab');
3877
+ var l = ref[0];
3878
+ var a = ref[1];
3879
+ var b = ref[2];
3880
+ var c = sqrt$4(a * a + b * b);
3881
+ var h = (atan2$2(b, a) * RAD2DEG + 360) % 360;
3882
+ if (round$5(c * 10000) === 0) { h = Number.NaN; }
3883
+ return [l, c, h];
3884
+ };
3885
+
3886
+ var rgb2lch = function () {
3887
+ var args = [], len = arguments.length;
3888
+ while ( len-- ) args[ len ] = arguments[ len ];
3889
+
3890
+ var ref = unpack(args, 'rgb');
3891
+ var r = ref[0];
3892
+ var g = ref[1];
3893
+ var b = ref[2];
3894
+ var rest = ref.slice(3);
3895
+ var ref$1 = rgb2lab(r, g, b);
3896
+ var l = ref$1[0];
3897
+ var a = ref$1[1];
3898
+ var b_ = ref$1[2];
3899
+ var ref$2 = lab2lch(l, a, b_);
3900
+ var L = ref$2[0];
3901
+ var c = ref$2[1];
3902
+ var h = ref$2[2];
3903
+ return [L, c, h ].concat( (rest.length > 0 && rest[0] < 1 ? [rest[0]] : []));
3904
+ };
3905
+
3906
+ // from https://www.w3.org/TR/css-color-4/multiply-matrices.js
3907
+ function multiplyMatrices(A, B) {
3908
+ var m = A.length;
3909
+
3910
+ if (!Array.isArray(A[0])) {
3911
+ // A is vector, convert to [[a, b, c, ...]]
3912
+ A = [A];
3913
+ }
3914
+
3915
+ if (!Array.isArray(B[0])) {
3916
+ // B is vector, convert to [[a], [b], [c], ...]]
3917
+ B = B.map(function (x) { return [x]; });
3918
+ }
3919
+
3920
+ var p = B[0].length;
3921
+ var B_cols = B[0].map(function (_, i) { return B.map(function (x) { return x[i]; }); }); // transpose B
3922
+ var product = A.map(function (row) { return B_cols.map(function (col) {
3923
+ if (!Array.isArray(row)) {
3924
+ return col.reduce(function (a, c) { return a + c * row; }, 0);
3925
+ }
3926
+
3927
+ return row.reduce(function (a, c, i) { return a + c * (col[i] || 0); }, 0);
3928
+ }); }
3929
+ );
3930
+
3931
+ if (m === 1) {
3932
+ product = product[0]; // Avoid [[a, b, c, ...]]
3933
+ }
3934
+
3935
+ if (p === 1) {
3936
+ return product.map(function (x) { return x[0]; }); // Avoid [[a], [b], [c], ...]]
3937
+ }
3938
+
3939
+ return product;
3940
+ }
3941
+
3942
+ var rgb2oklab = function () {
3943
+ var args = [], len = arguments.length;
3944
+ while ( len-- ) args[ len ] = arguments[ len ];
3945
+
3946
+ var ref = unpack(args, 'rgb');
3947
+ var r = ref[0];
3948
+ var g = ref[1];
3949
+ var b = ref[2];
3950
+ var rest = ref.slice(3);
3951
+ var xyz = rgb2xyz(r, g, b);
3952
+ var oklab = XYZ_to_OKLab(xyz);
3953
+ return oklab.concat( (rest.length > 0 && rest[0] < 1 ? [rest[0]] : []));
3954
+ };
3955
+
3956
+ // from https://www.w3.org/TR/css-color-4/#color-conversion-code
3957
+ function XYZ_to_OKLab(XYZ) {
3958
+ // Given XYZ relative to D65, convert to OKLab
3959
+ var XYZtoLMS = [
3960
+ [0.819022437996703, 0.3619062600528904, -0.1288737815209879],
3961
+ [0.0329836539323885, 0.9292868615863434, 0.0361446663506424],
3962
+ [0.0481771893596242, 0.2642395317527308, 0.6335478284694309]
3963
+ ];
3964
+ var LMStoOKLab = [
3965
+ [0.210454268309314, 0.7936177747023054, -0.0040720430116193],
3966
+ [1.9779985324311684, -2.42859224204858, 0.450593709617411],
3967
+ [0.0259040424655478, 0.7827717124575296, -0.8086757549230774]
3968
+ ];
3969
+
3970
+ var LMS = multiplyMatrices(XYZtoLMS, XYZ);
3971
+ // JavaScript Math.cbrt returns a sign-matched cube root
3972
+ // beware if porting to other languages
3973
+ // especially if tempted to use a general power function
3974
+ return multiplyMatrices(
3975
+ LMStoOKLab,
3976
+ LMS.map(function (c) { return Math.cbrt(c); })
3977
+ );
3978
+ // L in range [0,1]. For use in CSS, multiply by 100 and add a percent
3979
+ }
3980
+
3981
+ var oklab2css = function () {
3982
+ var args = [], len = arguments.length;
3983
+ while ( len-- ) args[ len ] = arguments[ len ];
3984
+
3985
+ var laba = unpack(args, 'lab');
3986
+ laba[0] = rnd2(laba[0] * 100) + '%';
3987
+ laba[1] = rnd3(laba[1]);
3988
+ laba[2] = rnd3(laba[2]);
3989
+ if (laba.length > 3 && laba[3] < 1) {
3990
+ laba[3] = '/ ' + (laba.length > 3 ? laba[3] : 1);
3991
+ } else {
3992
+ laba.length = 3;
3993
+ }
3994
+ return ("oklab(" + (laba.join(' ')) + ")");
3995
+ };
3996
+
3997
+ var rgb2oklch = function () {
3998
+ var args = [], len = arguments.length;
3999
+ while ( len-- ) args[ len ] = arguments[ len ];
4000
+
4001
+ var ref = unpack(args, 'rgb');
4002
+ var r = ref[0];
4003
+ var g = ref[1];
4004
+ var b = ref[2];
4005
+ var rest = ref.slice(3);
4006
+ var ref$1 = rgb2oklab(r, g, b);
4007
+ var l = ref$1[0];
4008
+ var a = ref$1[1];
4009
+ var b_ = ref$1[2];
4010
+ var ref$2 = lab2lch(l, a, b_);
4011
+ var L = ref$2[0];
4012
+ var c = ref$2[1];
4013
+ var h = ref$2[2];
4014
+ return [L, c, h ].concat( (rest.length > 0 && rest[0] < 1 ? [rest[0]] : []));
4015
+ };
4016
+
4017
+ var oklch2css = function () {
4018
+ var args = [], len = arguments.length;
4019
+ while ( len-- ) args[ len ] = arguments[ len ];
4020
+
4021
+ var lcha = unpack(args, 'lch');
4022
+ lcha[0] = rnd2(lcha[0] * 100) + '%';
4023
+ lcha[1] = rnd3(lcha[1]);
4024
+ lcha[2] = isNaN(lcha[2]) ? 'none' : rnd2(lcha[2]) + 'deg'; // add deg unit to hue
4025
+ if (lcha.length > 3 && lcha[3] < 1) {
4026
+ lcha[3] = '/ ' + (lcha.length > 3 ? lcha[3] : 1);
4027
+ } else {
4028
+ lcha.length = 3;
4029
+ }
4030
+ return ("oklch(" + (lcha.join(' ')) + ")");
4031
+ };
4032
+
4033
+ var round$4 = Math.round;
4034
+
4035
+ /*
4036
+ * supported arguments:
4037
+ * - rgb2css(r,g,b)
4038
+ * - rgb2css(r,g,b,a)
4039
+ * - rgb2css([r,g,b], mode)
4040
+ * - rgb2css([r,g,b,a], mode)
4041
+ * - rgb2css({r,g,b,a}, mode)
4042
+ */
4043
+ var rgb2css = function () {
4044
+ var args = [], len = arguments.length;
4045
+ while ( len-- ) args[ len ] = arguments[ len ];
4046
+
4047
+ var rgba = unpack(args, 'rgba');
4048
+ var mode = last(args) || 'rgb';
4049
+ if (mode.substr(0, 3) === 'hsl') {
4050
+ return hsl2css(rgb2hsl$1(rgba), mode);
4051
+ }
4052
+ if (mode.substr(0, 3) === 'lab') {
4053
+ // change to D50 lab whitepoint since this is what W3C is using for CSS Lab colors
4054
+ var prevWhitePoint = getLabWhitePoint();
4055
+ setLabWhitePoint('d50');
4056
+ var cssColor = lab2css(rgb2lab(rgba), mode);
4057
+ setLabWhitePoint(prevWhitePoint);
4058
+ return cssColor;
4059
+ }
4060
+ if (mode.substr(0, 3) === 'lch') {
4061
+ // change to D50 lab whitepoint since this is what W3C is using for CSS Lab colors
4062
+ var prevWhitePoint$1 = getLabWhitePoint();
4063
+ setLabWhitePoint('d50');
4064
+ var cssColor$1 = lch2css(rgb2lch(rgba), mode);
4065
+ setLabWhitePoint(prevWhitePoint$1);
4066
+ return cssColor$1;
4067
+ }
4068
+ if (mode.substr(0, 5) === 'oklab') {
4069
+ return oklab2css(rgb2oklab(rgba));
4070
+ }
4071
+ if (mode.substr(0, 5) === 'oklch') {
4072
+ return oklch2css(rgb2oklch(rgba));
4073
+ }
4074
+ rgba[0] = round$4(rgba[0]);
4075
+ rgba[1] = round$4(rgba[1]);
4076
+ rgba[2] = round$4(rgba[2]);
4077
+ if (mode === 'rgba' || (rgba.length > 3 && rgba[3] < 1)) {
4078
+ rgba[3] = '/ ' + (rgba.length > 3 ? rgba[3] : 1);
4079
+ mode = 'rgba';
4080
+ }
4081
+ return ((mode.substr(0, 3)) + "(" + (rgba.slice(0, mode === 'rgb' ? 3 : 4).join(' ')) + ")");
4082
+ };
4083
+
4084
+ var hsl2rgb = function () {
4085
+ var assign;
4086
+
4087
+ var args = [], len = arguments.length;
4088
+ while ( len-- ) args[ len ] = arguments[ len ];
4089
+ args = unpack(args, 'hsl');
4090
+ var h = args[0];
4091
+ var s = args[1];
4092
+ var l = args[2];
4093
+ var r, g, b;
4094
+ if (s === 0) {
4095
+ r = g = b = l * 255;
4096
+ } else {
4097
+ var t3 = [0, 0, 0];
4098
+ var c = [0, 0, 0];
4099
+ var t2 = l < 0.5 ? l * (1 + s) : l + s - l * s;
4100
+ var t1 = 2 * l - t2;
4101
+ var h_ = h / 360;
4102
+ t3[0] = h_ + 1 / 3;
4103
+ t3[1] = h_;
4104
+ t3[2] = h_ - 1 / 3;
4105
+ for (var i = 0; i < 3; i++) {
4106
+ if (t3[i] < 0) { t3[i] += 1; }
4107
+ if (t3[i] > 1) { t3[i] -= 1; }
4108
+ if (6 * t3[i] < 1) { c[i] = t1 + (t2 - t1) * 6 * t3[i]; }
4109
+ else if (2 * t3[i] < 1) { c[i] = t2; }
4110
+ else if (3 * t3[i] < 2) { c[i] = t1 + (t2 - t1) * (2 / 3 - t3[i]) * 6; }
4111
+ else { c[i] = t1; }
4112
+ }
4113
+ (assign = [c[0] * 255, c[1] * 255, c[2] * 255], r = assign[0], g = assign[1], b = assign[2]);
4114
+ }
4115
+ if (args.length > 3) {
4116
+ // keep alpha channel
4117
+ return [r, g, b, args[3]];
4118
+ }
4119
+ return [r, g, b, 1];
4120
+ };
4121
+
4122
+ /*
4123
+ * L* [0..100]
4124
+ * a [-100..100]
4125
+ * b [-100..100]
4126
+ */
4127
+ var lab2rgb = function () {
4128
+ var args = [], len = arguments.length;
4129
+ while ( len-- ) args[ len ] = arguments[ len ];
4130
+
4131
+ args = unpack(args, 'lab');
4132
+ var L = args[0];
4133
+ var a = args[1];
4134
+ var b = args[2];
4135
+ var ref = lab2xyz(L, a, b);
4136
+ var x = ref[0];
4137
+ var y = ref[1];
4138
+ var z = ref[2];
4139
+ var ref$1 = xyz2rgb(x, y, z);
4140
+ var r = ref$1[0];
4141
+ var g = ref$1[1];
4142
+ var b_ = ref$1[2];
4143
+ return [r, g, b_, args.length > 3 ? args[3] : 1];
4144
+ };
4145
+
4146
+ var lab2xyz = function (L, a, b) {
4147
+ var kE = labConstants.kE;
4148
+ var kK = labConstants.kK;
4149
+ var kKE = labConstants.kKE;
4150
+ var Xn = labConstants.Xn;
4151
+ var Yn = labConstants.Yn;
4152
+ var Zn = labConstants.Zn;
4153
+
4154
+ var fy = (L + 16.0) / 116.0;
4155
+ var fx = 0.002 * a + fy;
4156
+ var fz = fy - 0.005 * b;
4157
+
4158
+ var fx3 = fx * fx * fx;
4159
+ var fz3 = fz * fz * fz;
4160
+
4161
+ var xr = fx3 > kE ? fx3 : (116.0 * fx - 16.0) / kK;
4162
+ var yr = L > kKE ? Math.pow((L + 16.0) / 116.0, 3.0) : L / kK;
4163
+ var zr = fz3 > kE ? fz3 : (116.0 * fz - 16.0) / kK;
4164
+
4165
+ var x = xr * Xn;
4166
+ var y = yr * Yn;
4167
+ var z = zr * Zn;
4168
+
4169
+ return [x, y, z];
4170
+ };
4171
+
4172
+ var compand = function (linear) {
4173
+ /* sRGB */
4174
+ var sign = Math.sign(linear);
4175
+ linear = Math.abs(linear);
4176
+ return (
4177
+ (linear <= 0.0031308
4178
+ ? linear * 12.92
4179
+ : 1.055 * Math.pow(linear, 1.0 / 2.4) - 0.055) * sign
4180
+ );
4181
+ };
4182
+
4183
+ var xyz2rgb = function (x, y, z) {
4184
+ var MtxAdaptMa = labConstants.MtxAdaptMa;
4185
+ var MtxAdaptMaI = labConstants.MtxAdaptMaI;
4186
+ var MtxXYZ2RGB = labConstants.MtxXYZ2RGB;
4187
+ var RefWhiteRGB = labConstants.RefWhiteRGB;
4188
+ var Xn = labConstants.Xn;
4189
+ var Yn = labConstants.Yn;
4190
+ var Zn = labConstants.Zn;
4191
+
4192
+ var As = Xn * MtxAdaptMa.m00 + Yn * MtxAdaptMa.m10 + Zn * MtxAdaptMa.m20;
4193
+ var Bs = Xn * MtxAdaptMa.m01 + Yn * MtxAdaptMa.m11 + Zn * MtxAdaptMa.m21;
4194
+ var Cs = Xn * MtxAdaptMa.m02 + Yn * MtxAdaptMa.m12 + Zn * MtxAdaptMa.m22;
4195
+
4196
+ var Ad =
4197
+ RefWhiteRGB.X * MtxAdaptMa.m00 +
4198
+ RefWhiteRGB.Y * MtxAdaptMa.m10 +
4199
+ RefWhiteRGB.Z * MtxAdaptMa.m20;
4200
+ var Bd =
4201
+ RefWhiteRGB.X * MtxAdaptMa.m01 +
4202
+ RefWhiteRGB.Y * MtxAdaptMa.m11 +
4203
+ RefWhiteRGB.Z * MtxAdaptMa.m21;
4204
+ var Cd =
4205
+ RefWhiteRGB.X * MtxAdaptMa.m02 +
4206
+ RefWhiteRGB.Y * MtxAdaptMa.m12 +
4207
+ RefWhiteRGB.Z * MtxAdaptMa.m22;
4208
+
4209
+ var X1 =
4210
+ (x * MtxAdaptMa.m00 + y * MtxAdaptMa.m10 + z * MtxAdaptMa.m20) *
4211
+ (Ad / As);
4212
+ var Y1 =
4213
+ (x * MtxAdaptMa.m01 + y * MtxAdaptMa.m11 + z * MtxAdaptMa.m21) *
4214
+ (Bd / Bs);
4215
+ var Z1 =
4216
+ (x * MtxAdaptMa.m02 + y * MtxAdaptMa.m12 + z * MtxAdaptMa.m22) *
4217
+ (Cd / Cs);
4218
+
4219
+ var X2 =
4220
+ X1 * MtxAdaptMaI.m00 + Y1 * MtxAdaptMaI.m10 + Z1 * MtxAdaptMaI.m20;
4221
+ var Y2 =
4222
+ X1 * MtxAdaptMaI.m01 + Y1 * MtxAdaptMaI.m11 + Z1 * MtxAdaptMaI.m21;
4223
+ var Z2 =
4224
+ X1 * MtxAdaptMaI.m02 + Y1 * MtxAdaptMaI.m12 + Z1 * MtxAdaptMaI.m22;
4225
+
4226
+ var r = compand(
4227
+ X2 * MtxXYZ2RGB.m00 + Y2 * MtxXYZ2RGB.m10 + Z2 * MtxXYZ2RGB.m20
4228
+ );
4229
+ var g = compand(
4230
+ X2 * MtxXYZ2RGB.m01 + Y2 * MtxXYZ2RGB.m11 + Z2 * MtxXYZ2RGB.m21
4231
+ );
4232
+ var b = compand(
4233
+ X2 * MtxXYZ2RGB.m02 + Y2 * MtxXYZ2RGB.m12 + Z2 * MtxXYZ2RGB.m22
4234
+ );
4235
+
4236
+ return [r * 255, g * 255, b * 255];
4237
+ };
4238
+
4239
+ var sin$3 = Math.sin;
4240
+ var cos$4 = Math.cos;
4241
+
4242
+ var lch2lab = function () {
4243
+ var args = [], len = arguments.length;
4244
+ while ( len-- ) args[ len ] = arguments[ len ];
4245
+
4246
+ /*
4247
+ Convert from a qualitative parameter h and a quantitative parameter l to a 24-bit pixel.
4248
+ These formulas were invented by David Dalrymple to obtain maximum contrast without going
4249
+ out of gamut if the parameters are in the range 0-1.
4250
+
4251
+ A saturation multiplier was added by Gregor Aisch
4252
+ */
4253
+ var ref = unpack(args, 'lch');
4254
+ var l = ref[0];
4255
+ var c = ref[1];
4256
+ var h = ref[2];
4257
+ if (isNaN(h)) { h = 0; }
4258
+ h = h * DEG2RAD;
4259
+ return [l, cos$4(h) * c, sin$3(h) * c];
4260
+ };
4261
+
4262
+ var lch2rgb = function () {
4263
+ var args = [], len = arguments.length;
4264
+ while ( len-- ) args[ len ] = arguments[ len ];
4265
+
4266
+ args = unpack(args, 'lch');
4267
+ var l = args[0];
4268
+ var c = args[1];
4269
+ var h = args[2];
4270
+ var ref = lch2lab(l, c, h);
4271
+ var L = ref[0];
4272
+ var a = ref[1];
4273
+ var b_ = ref[2];
4274
+ var ref$1 = lab2rgb(L, a, b_);
4275
+ var r = ref$1[0];
4276
+ var g = ref$1[1];
4277
+ var b = ref$1[2];
4278
+ return [r, g, b, args.length > 3 ? args[3] : 1];
4279
+ };
4280
+
4281
+ var oklab2rgb = function () {
4282
+ var args = [], len = arguments.length;
4283
+ while ( len-- ) args[ len ] = arguments[ len ];
4284
+
4285
+ args = unpack(args, 'lab');
4286
+ var L = args[0];
4287
+ var a = args[1];
4288
+ var b = args[2];
4289
+ var rest = args.slice(3);
4290
+ var ref = OKLab_to_XYZ([L, a, b]);
4291
+ var X = ref[0];
4292
+ var Y = ref[1];
4293
+ var Z = ref[2];
4294
+ var ref$1 = xyz2rgb(X, Y, Z);
4295
+ var r = ref$1[0];
4296
+ var g = ref$1[1];
4297
+ var b_ = ref$1[2];
4298
+ return [r, g, b_ ].concat( (rest.length > 0 && rest[0] < 1 ? [rest[0]] : []));
4299
+ };
4300
+
4301
+ // from https://www.w3.org/TR/css-color-4/#color-conversion-code
4302
+ function OKLab_to_XYZ(OKLab) {
4303
+ // Given OKLab, convert to XYZ relative to D65
4304
+ var LMStoXYZ = [
4305
+ [1.2268798758459243, -0.5578149944602171, 0.2813910456659647],
4306
+ [-0.0405757452148008, 1.112286803280317, -0.0717110580655164],
4307
+ [-0.0763729366746601, -0.4214933324022432, 1.5869240198367816]
4308
+ ];
4309
+ var OKLabtoLMS = [
4310
+ [1.0, 0.3963377773761749, 0.2158037573099136],
4311
+ [1.0, -0.1055613458156586, -0.0638541728258133],
4312
+ [1.0, -0.0894841775298119, -1.2914855480194092]
4313
+ ];
4314
+
4315
+ var LMSnl = multiplyMatrices(OKLabtoLMS, OKLab);
4316
+ return multiplyMatrices(
4317
+ LMStoXYZ,
4318
+ LMSnl.map(function (c) { return Math.pow( c, 3 ); })
4319
+ );
4320
+ }
4321
+
4322
+ var oklch2rgb = function () {
4323
+ var args = [], len = arguments.length;
4324
+ while ( len-- ) args[ len ] = arguments[ len ];
4325
+
4326
+ args = unpack(args, 'lch');
4327
+ var l = args[0];
4328
+ var c = args[1];
4329
+ var h = args[2];
4330
+ var rest = args.slice(3);
4331
+ var ref = lch2lab(l, c, h);
4332
+ var L = ref[0];
4333
+ var a = ref[1];
4334
+ var b_ = ref[2];
4335
+ var ref$1 = oklab2rgb(L, a, b_);
4336
+ var r = ref$1[0];
4337
+ var g = ref$1[1];
4338
+ var b = ref$1[2];
4339
+ return [r, g, b ].concat( (rest.length > 0 && rest[0] < 1 ? [rest[0]] : []));
4340
+ };
4341
+
4342
+ var INT_OR_PCT = /((?:-?\d+)|(?:-?\d+(?:\.\d+)?)%|none)/.source;
4343
+ var FLOAT_OR_PCT = /((?:-?(?:\d+(?:\.\d*)?|\.\d+)%?)|none)/.source;
4344
+ var PCT = /((?:-?(?:\d+(?:\.\d*)?|\.\d+)%)|none)/.source;
4345
+ var RE_S = /\s*/.source;
4346
+ var SEP = /\s+/.source;
4347
+ var COMMA = /\s*,\s*/.source;
4348
+ var ANLGE = /((?:-?(?:\d+(?:\.\d*)?|\.\d+)(?:deg)?)|none)/.source;
4349
+ var ALPHA = /\s*(?:\/\s*((?:[01]|[01]?\.\d+)|\d+(?:\.\d+)?%))?/.source;
4350
+
4351
+ // e.g. rgb(250 20 0), rgb(100% 50% 20%), rgb(100% 50% 20% / 0.5)
4352
+ var RE_RGB = new RegExp(
4353
+ '^rgba?\\(' +
4354
+ RE_S +
4355
+ [INT_OR_PCT, INT_OR_PCT, INT_OR_PCT].join(SEP) +
4356
+ ALPHA +
4357
+ '\\)$'
4358
+ );
4359
+ var RE_RGB_LEGACY = new RegExp(
4360
+ '^rgb\\(' +
4361
+ RE_S +
4362
+ [INT_OR_PCT, INT_OR_PCT, INT_OR_PCT].join(COMMA) +
4363
+ RE_S +
4364
+ '\\)$'
4365
+ );
4366
+ var RE_RGBA_LEGACY = new RegExp(
4367
+ '^rgba\\(' +
4368
+ RE_S +
4369
+ [INT_OR_PCT, INT_OR_PCT, INT_OR_PCT, FLOAT_OR_PCT].join(COMMA) +
4370
+ RE_S +
4371
+ '\\)$'
4372
+ );
4373
+
4374
+ var RE_HSL = new RegExp(
4375
+ '^hsla?\\(' + RE_S + [ANLGE, PCT, PCT].join(SEP) + ALPHA + '\\)$'
4376
+ );
4377
+ var RE_HSL_LEGACY = new RegExp(
4378
+ '^hsl?\\(' + RE_S + [ANLGE, PCT, PCT].join(COMMA) + RE_S + '\\)$'
4379
+ );
4380
+ var RE_HSLA_LEGACY =
4381
+ /^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/;
4382
+
4383
+ var RE_LAB = new RegExp(
4384
+ '^lab\\(' +
4385
+ RE_S +
4386
+ [FLOAT_OR_PCT, FLOAT_OR_PCT, FLOAT_OR_PCT].join(SEP) +
4387
+ ALPHA +
4388
+ '\\)$'
4389
+ );
4390
+ var RE_LCH = new RegExp(
4391
+ '^lch\\(' +
4392
+ RE_S +
4393
+ [FLOAT_OR_PCT, FLOAT_OR_PCT, ANLGE].join(SEP) +
4394
+ ALPHA +
4395
+ '\\)$'
4396
+ );
4397
+ var RE_OKLAB = new RegExp(
4398
+ '^oklab\\(' +
4399
+ RE_S +
4400
+ [FLOAT_OR_PCT, FLOAT_OR_PCT, FLOAT_OR_PCT].join(SEP) +
4401
+ ALPHA +
4402
+ '\\)$'
4403
+ );
4404
+ var RE_OKLCH = new RegExp(
4405
+ '^oklch\\(' +
4406
+ RE_S +
4407
+ [FLOAT_OR_PCT, FLOAT_OR_PCT, ANLGE].join(SEP) +
4408
+ ALPHA +
4409
+ '\\)$'
4410
+ );
4411
+
4412
+ var round$3 = Math.round;
4413
+
4414
+ var roundRGB = function (rgb) {
4415
+ return rgb.map(function (v, i) { return (i <= 2 ? limit(round$3(v), 0, 255) : v); });
4416
+ };
4417
+
4418
+ var percentToAbsolute = function (pct, min, max, signed) {
4419
+ if ( min === void 0 ) min = 0;
4420
+ if ( max === void 0 ) max = 100;
4421
+ if ( signed === void 0 ) signed = false;
4422
+
4423
+ if (typeof pct === 'string' && pct.endsWith('%')) {
4424
+ pct = parseFloat(pct.substring(0, pct.length - 1)) / 100;
4425
+ if (signed) {
4426
+ // signed percentages are in the range -100% to 100%
4427
+ pct = min + (pct + 1) * 0.5 * (max - min);
4428
+ } else {
4429
+ pct = min + pct * (max - min);
4430
+ }
4431
+ }
4432
+ return +pct;
4433
+ };
4434
+
4435
+ var noneToValue = function (v, noneValue) {
4436
+ return v === 'none' ? noneValue : v;
4437
+ };
4438
+
4439
+ var css2rgb = function (css) {
4440
+ css = css.toLowerCase().trim();
4441
+
4442
+ if (css === 'transparent') {
4443
+ return [0, 0, 0, 0];
4444
+ }
4445
+
4446
+ var m;
4447
+
4448
+ if (input.format.named) {
4449
+ try {
4450
+ return input.format.named(css);
4451
+ // eslint-disable-next-line
4452
+ } catch (e) {}
4453
+ }
4454
+
4455
+ // rgb(250 20 0) or rgb(250,20,0)
4456
+ if ((m = css.match(RE_RGB)) || (m = css.match(RE_RGB_LEGACY))) {
4457
+ var rgb = m.slice(1, 4);
4458
+ for (var i = 0; i < 3; i++) {
4459
+ rgb[i] = +percentToAbsolute(noneToValue(rgb[i], 0), 0, 255);
4460
+ }
4461
+ rgb = roundRGB(rgb);
4462
+ var alpha = m[4] !== undefined ? +percentToAbsolute(m[4], 0, 1) : 1;
4463
+ rgb[3] = alpha; // default alpha
4464
+ return rgb;
4465
+ }
4466
+
4467
+ // rgba(250,20,0,0.4)
4468
+ if ((m = css.match(RE_RGBA_LEGACY))) {
4469
+ var rgb$1 = m.slice(1, 5);
4470
+ for (var i$1 = 0; i$1 < 4; i$1++) {
4471
+ rgb$1[i$1] = +percentToAbsolute(rgb$1[i$1], 0, 255);
4472
+ }
4473
+ return rgb$1;
4474
+ }
4475
+
4476
+ // hsl(0,100%,50%)
4477
+ if ((m = css.match(RE_HSL)) || (m = css.match(RE_HSL_LEGACY))) {
4478
+ var hsl = m.slice(1, 4);
4479
+ hsl[0] = +noneToValue(hsl[0].replace('deg', ''), 0);
4480
+ hsl[1] = +percentToAbsolute(noneToValue(hsl[1], 0), 0, 100) * 0.01;
4481
+ hsl[2] = +percentToAbsolute(noneToValue(hsl[2], 0), 0, 100) * 0.01;
4482
+ var rgb$2 = roundRGB(hsl2rgb(hsl));
4483
+ var alpha$1 = m[4] !== undefined ? +percentToAbsolute(m[4], 0, 1) : 1;
4484
+ rgb$2[3] = alpha$1;
4485
+ return rgb$2;
4486
+ }
4487
+
4488
+ // hsla(0,100%,50%,0.5)
4489
+ if ((m = css.match(RE_HSLA_LEGACY))) {
4490
+ var hsl$1 = m.slice(1, 4);
4491
+ hsl$1[1] *= 0.01;
4492
+ hsl$1[2] *= 0.01;
4493
+ var rgb$3 = hsl2rgb(hsl$1);
4494
+ for (var i$2 = 0; i$2 < 3; i$2++) {
4495
+ rgb$3[i$2] = round$3(rgb$3[i$2]);
4496
+ }
4497
+ rgb$3[3] = +m[4]; // default alpha = 1
4498
+ return rgb$3;
4499
+ }
4500
+
4501
+ if ((m = css.match(RE_LAB))) {
4502
+ var lab = m.slice(1, 4);
4503
+ lab[0] = percentToAbsolute(noneToValue(lab[0], 0), 0, 100);
4504
+ lab[1] = percentToAbsolute(noneToValue(lab[1], 0), -125, 125, true);
4505
+ lab[2] = percentToAbsolute(noneToValue(lab[2], 0), -125, 125, true);
4506
+ // convert to D50 Lab whitepoint
4507
+ var wp = getLabWhitePoint();
4508
+ setLabWhitePoint('d50');
4509
+ var rgb$4 = roundRGB(lab2rgb(lab));
4510
+ // convert back to original Lab whitepoint
4511
+ setLabWhitePoint(wp);
4512
+ var alpha$2 = m[4] !== undefined ? +percentToAbsolute(m[4], 0, 1) : 1;
4513
+ rgb$4[3] = alpha$2;
4514
+ return rgb$4;
4515
+ }
4516
+
4517
+ if ((m = css.match(RE_LCH))) {
4518
+ var lch = m.slice(1, 4);
4519
+ lch[0] = percentToAbsolute(lch[0], 0, 100);
4520
+ lch[1] = percentToAbsolute(noneToValue(lch[1], 0), 0, 150, false);
4521
+ lch[2] = +noneToValue(lch[2].replace('deg', ''), 0);
4522
+ // convert to D50 Lab whitepoint
4523
+ var wp$1 = getLabWhitePoint();
4524
+ setLabWhitePoint('d50');
4525
+ var rgb$5 = roundRGB(lch2rgb(lch));
4526
+ // convert back to original Lab whitepoint
4527
+ setLabWhitePoint(wp$1);
4528
+ var alpha$3 = m[4] !== undefined ? +percentToAbsolute(m[4], 0, 1) : 1;
4529
+ rgb$5[3] = alpha$3;
4530
+ return rgb$5;
4531
+ }
4532
+
4533
+ if ((m = css.match(RE_OKLAB))) {
4534
+ var oklab = m.slice(1, 4);
4535
+ oklab[0] = percentToAbsolute(noneToValue(oklab[0], 0), 0, 1);
4536
+ oklab[1] = percentToAbsolute(noneToValue(oklab[1], 0), -0.4, 0.4, true);
4537
+ oklab[2] = percentToAbsolute(noneToValue(oklab[2], 0), -0.4, 0.4, true);
4538
+ var rgb$6 = roundRGB(oklab2rgb(oklab));
4539
+ var alpha$4 = m[4] !== undefined ? +percentToAbsolute(m[4], 0, 1) : 1;
4540
+ rgb$6[3] = alpha$4;
4541
+ return rgb$6;
4542
+ }
4543
+
4544
+ if ((m = css.match(RE_OKLCH))) {
4545
+ var oklch = m.slice(1, 4);
4546
+ oklch[0] = percentToAbsolute(noneToValue(oklch[0], 0), 0, 1);
4547
+ oklch[1] = percentToAbsolute(noneToValue(oklch[1], 0), 0, 0.4, false);
4548
+ oklch[2] = +noneToValue(oklch[2].replace('deg', ''), 0);
4549
+ var rgb$7 = roundRGB(oklch2rgb(oklch));
4550
+ var alpha$5 = m[4] !== undefined ? +percentToAbsolute(m[4], 0, 1) : 1;
4551
+ rgb$7[3] = alpha$5;
4552
+ return rgb$7;
4553
+ }
4554
+ };
4555
+
4556
+ css2rgb.test = function (s) {
4557
+ return (
4558
+ // modern
4559
+ RE_RGB.test(s) ||
4560
+ RE_HSL.test(s) ||
4561
+ RE_LAB.test(s) ||
4562
+ RE_LCH.test(s) ||
4563
+ RE_OKLAB.test(s) ||
4564
+ RE_OKLCH.test(s) ||
4565
+ // legacy
4566
+ RE_RGB_LEGACY.test(s) ||
4567
+ RE_RGBA_LEGACY.test(s) ||
4568
+ RE_HSL_LEGACY.test(s) ||
4569
+ RE_HSLA_LEGACY.test(s) ||
4570
+ s === 'transparent'
4571
+ );
4572
+ };
4573
+
4574
+ Color.prototype.css = function (mode) {
4575
+ return rgb2css(this._rgb, mode);
4576
+ };
4577
+
4578
+ var css = function () {
4579
+ var args = [], len = arguments.length;
4580
+ while ( len-- ) args[ len ] = arguments[ len ];
4581
+
4582
+ return new (Function.prototype.bind.apply( Color, [ null ].concat( args, ['css']) ));
4583
+ };
4584
+ chroma.css = css;
4585
+
4586
+ input.format.css = css2rgb;
4587
+
4588
+ input.autodetect.push({
4589
+ p: 5,
4590
+ test: function (h) {
4591
+ var rest = [], len = arguments.length - 1;
4592
+ while ( len-- > 0 ) rest[ len ] = arguments[ len + 1 ];
4593
+
4594
+ if (!rest.length && type(h) === 'string' && css2rgb.test(h)) {
4595
+ return 'css';
4596
+ }
4597
+ }
4598
+ });
4599
+
4600
+ input.format.gl = function () {
4601
+ var args = [], len = arguments.length;
4602
+ while ( len-- ) args[ len ] = arguments[ len ];
4603
+
4604
+ var rgb = unpack(args, 'rgba');
4605
+ rgb[0] *= 255;
4606
+ rgb[1] *= 255;
4607
+ rgb[2] *= 255;
4608
+ return rgb;
4609
+ };
4610
+
4611
+ var gl = function () {
4612
+ var args = [], len = arguments.length;
4613
+ while ( len-- ) args[ len ] = arguments[ len ];
4614
+
4615
+ return new (Function.prototype.bind.apply( Color, [ null ].concat( args, ['gl']) ));
4616
+ };
4617
+ chroma.gl = gl;
4618
+
4619
+ Color.prototype.gl = function () {
4620
+ var rgb = this._rgb;
4621
+ return [rgb[0] / 255, rgb[1] / 255, rgb[2] / 255, rgb[3]];
4622
+ };
4623
+
4624
+ var floor$3 = Math.floor;
4625
+
4626
+ /*
4627
+ * this is basically just HSV with some minor tweaks
4628
+ *
4629
+ * hue.. [0..360]
4630
+ * chroma .. [0..1]
4631
+ * grayness .. [0..1]
4632
+ */
4633
+
4634
+ var hcg2rgb = function () {
4635
+ var assign, assign$1, assign$2, assign$3, assign$4, assign$5;
4636
+
4637
+ var args = [], len = arguments.length;
4638
+ while ( len-- ) args[ len ] = arguments[ len ];
4639
+ args = unpack(args, 'hcg');
4640
+ var h = args[0];
4641
+ var c = args[1];
4642
+ var _g = args[2];
4643
+ var r, g, b;
4644
+ _g = _g * 255;
4645
+ var _c = c * 255;
4646
+ if (c === 0) {
4647
+ r = g = b = _g;
4648
+ } else {
4649
+ if (h === 360) { h = 0; }
4650
+ if (h > 360) { h -= 360; }
4651
+ if (h < 0) { h += 360; }
4652
+ h /= 60;
4653
+ var i = floor$3(h);
4654
+ var f = h - i;
4655
+ var p = _g * (1 - c);
4656
+ var q = p + _c * (1 - f);
4657
+ var t = p + _c * f;
4658
+ var v = p + _c;
4659
+ switch (i) {
4660
+ case 0:
4661
+ (assign = [v, t, p], r = assign[0], g = assign[1], b = assign[2]);
4662
+ break;
4663
+ case 1:
4664
+ (assign$1 = [q, v, p], r = assign$1[0], g = assign$1[1], b = assign$1[2]);
4665
+ break;
4666
+ case 2:
4667
+ (assign$2 = [p, v, t], r = assign$2[0], g = assign$2[1], b = assign$2[2]);
4668
+ break;
4669
+ case 3:
4670
+ (assign$3 = [p, q, v], r = assign$3[0], g = assign$3[1], b = assign$3[2]);
4671
+ break;
4672
+ case 4:
4673
+ (assign$4 = [t, p, v], r = assign$4[0], g = assign$4[1], b = assign$4[2]);
4674
+ break;
4675
+ case 5:
4676
+ (assign$5 = [v, p, q], r = assign$5[0], g = assign$5[1], b = assign$5[2]);
4677
+ break;
4678
+ }
4679
+ }
4680
+ return [r, g, b, args.length > 3 ? args[3] : 1];
4681
+ };
4682
+
4683
+ var rgb2hcg = function () {
4684
+ var args = [], len = arguments.length;
4685
+ while ( len-- ) args[ len ] = arguments[ len ];
4686
+
4687
+ var ref = unpack(args, 'rgb');
4688
+ var r = ref[0];
4689
+ var g = ref[1];
4690
+ var b = ref[2];
4691
+ var minRgb = min$3(r, g, b);
4692
+ var maxRgb = max$3(r, g, b);
4693
+ var delta = maxRgb - minRgb;
4694
+ var c = (delta * 100) / 255;
4695
+ var _g = (minRgb / (255 - delta)) * 100;
4696
+ var h;
4697
+ if (delta === 0) {
4698
+ h = Number.NaN;
4699
+ } else {
4700
+ if (r === maxRgb) { h = (g - b) / delta; }
4701
+ if (g === maxRgb) { h = 2 + (b - r) / delta; }
4702
+ if (b === maxRgb) { h = 4 + (r - g) / delta; }
4703
+ h *= 60;
4704
+ if (h < 0) { h += 360; }
4705
+ }
4706
+ return [h, c, _g];
4707
+ };
4708
+
4709
+ Color.prototype.hcg = function () {
4710
+ return rgb2hcg(this._rgb);
4711
+ };
4712
+
4713
+ var hcg$1 = function () {
4714
+ var args = [], len = arguments.length;
4715
+ while ( len-- ) args[ len ] = arguments[ len ];
4716
+
4717
+ return new (Function.prototype.bind.apply( Color, [ null ].concat( args, ['hcg']) ));
4718
+ };
4719
+ chroma.hcg = hcg$1;
4720
+
4721
+ input.format.hcg = hcg2rgb;
4722
+
4723
+ input.autodetect.push({
4724
+ p: 1,
4725
+ test: function () {
4726
+ var args = [], len = arguments.length;
4727
+ while ( len-- ) args[ len ] = arguments[ len ];
4728
+
4729
+ args = unpack(args, 'hcg');
4730
+ if (type(args) === 'array' && args.length === 3) {
4731
+ return 'hcg';
4732
+ }
4733
+ }
4734
+ });
4735
+
4736
+ var RE_HEX = /^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
4737
+ var RE_HEXA = /^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/;
4738
+
4739
+ var hex2rgb = function (hex) {
4740
+ if (hex.match(RE_HEX)) {
4741
+ // remove optional leading #
4742
+ if (hex.length === 4 || hex.length === 7) {
4743
+ hex = hex.substr(1);
4744
+ }
4745
+ // expand short-notation to full six-digit
4746
+ if (hex.length === 3) {
4747
+ hex = hex.split('');
4748
+ hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
4749
+ }
4750
+ var u = parseInt(hex, 16);
4751
+ var r = u >> 16;
4752
+ var g = (u >> 8) & 0xff;
4753
+ var b = u & 0xff;
4754
+ return [r, g, b, 1];
4755
+ }
4756
+
4757
+ // match rgba hex format, eg #FF000077
4758
+ if (hex.match(RE_HEXA)) {
4759
+ if (hex.length === 5 || hex.length === 9) {
4760
+ // remove optional leading #
4761
+ hex = hex.substr(1);
4762
+ }
4763
+ // expand short-notation to full eight-digit
4764
+ if (hex.length === 4) {
4765
+ hex = hex.split('');
4766
+ hex =
4767
+ hex[0] +
4768
+ hex[0] +
4769
+ hex[1] +
4770
+ hex[1] +
4771
+ hex[2] +
4772
+ hex[2] +
4773
+ hex[3] +
4774
+ hex[3];
4775
+ }
4776
+ var u$1 = parseInt(hex, 16);
4777
+ var r$1 = (u$1 >> 24) & 0xff;
4778
+ var g$1 = (u$1 >> 16) & 0xff;
4779
+ var b$1 = (u$1 >> 8) & 0xff;
4780
+ var a = Math.round(((u$1 & 0xff) / 0xff) * 100) / 100;
4781
+ return [r$1, g$1, b$1, a];
4782
+ }
4783
+
4784
+ // we used to check for css colors here
4785
+ // if _input.css? and rgb = _input.css hex
4786
+ // return rgb
4787
+
4788
+ throw new Error(("unknown hex color: " + hex));
4789
+ };
4790
+
4791
+ var round$2 = Math.round;
4792
+
4793
+ var rgb2hex = function () {
4794
+ var args = [], len = arguments.length;
4795
+ while ( len-- ) args[ len ] = arguments[ len ];
4796
+
4797
+ var ref = unpack(args, 'rgba');
4798
+ var r = ref[0];
4799
+ var g = ref[1];
4800
+ var b = ref[2];
4801
+ var a = ref[3];
4802
+ var mode = last(args) || 'auto';
4803
+ if (a === undefined) { a = 1; }
4804
+ if (mode === 'auto') {
4805
+ mode = a < 1 ? 'rgba' : 'rgb';
4806
+ }
4807
+ r = round$2(r);
4808
+ g = round$2(g);
4809
+ b = round$2(b);
4810
+ var u = (r << 16) | (g << 8) | b;
4811
+ var str = '000000' + u.toString(16); //#.toUpperCase();
4812
+ str = str.substr(str.length - 6);
4813
+ var hxa = '0' + round$2(a * 255).toString(16);
4814
+ hxa = hxa.substr(hxa.length - 2);
4815
+ switch (mode.toLowerCase()) {
4816
+ case 'rgba':
4817
+ return ("#" + str + hxa);
4818
+ case 'argb':
4819
+ return ("#" + hxa + str);
4820
+ default:
4821
+ return ("#" + str);
4822
+ }
4823
+ };
4824
+
4825
+ Color.prototype.hex = function (mode) {
4826
+ return rgb2hex(this._rgb, mode);
4827
+ };
4828
+
4829
+ var hex = function () {
4830
+ var args = [], len = arguments.length;
4831
+ while ( len-- ) args[ len ] = arguments[ len ];
4832
+
4833
+ return new (Function.prototype.bind.apply( Color, [ null ].concat( args, ['hex']) ));
4834
+ };
4835
+ chroma.hex = hex;
4836
+
4837
+ input.format.hex = hex2rgb;
4838
+ input.autodetect.push({
4839
+ p: 4,
4840
+ test: function (h) {
4841
+ var rest = [], len = arguments.length - 1;
4842
+ while ( len-- > 0 ) rest[ len ] = arguments[ len + 1 ];
4843
+
4844
+ if (
4845
+ !rest.length &&
4846
+ type(h) === 'string' &&
4847
+ [3, 4, 5, 6, 7, 8, 9].indexOf(h.length) >= 0
4848
+ ) {
4849
+ return 'hex';
4850
+ }
4851
+ }
4852
+ });
4853
+
4854
+ var cos$3 = Math.cos;
4855
+
4856
+ /*
4857
+ * hue [0..360]
4858
+ * saturation [0..1]
4859
+ * intensity [0..1]
4860
+ */
4861
+ var hsi2rgb = function () {
4862
+ var args = [], len = arguments.length;
4863
+ while ( len-- ) args[ len ] = arguments[ len ];
4864
+
4865
+ /*
4866
+ borrowed from here:
4867
+ http://hummer.stanford.edu/museinfo/doc/examples/humdrum/keyscape2/hsi2rgb.cpp
4868
+ */
4869
+ args = unpack(args, 'hsi');
4870
+ var h = args[0];
4871
+ var s = args[1];
4872
+ var i = args[2];
4873
+ var r, g, b;
4874
+
4875
+ if (isNaN(h)) { h = 0; }
4876
+ if (isNaN(s)) { s = 0; }
4877
+ // normalize hue
4878
+ if (h > 360) { h -= 360; }
4879
+ if (h < 0) { h += 360; }
4880
+ h /= 360;
4881
+ if (h < 1 / 3) {
4882
+ b = (1 - s) / 3;
4883
+ r = (1 + (s * cos$3(TWOPI * h)) / cos$3(PITHIRD - TWOPI * h)) / 3;
4884
+ g = 1 - (b + r);
4885
+ } else if (h < 2 / 3) {
4886
+ h -= 1 / 3;
4887
+ r = (1 - s) / 3;
4888
+ g = (1 + (s * cos$3(TWOPI * h)) / cos$3(PITHIRD - TWOPI * h)) / 3;
4889
+ b = 1 - (r + g);
4890
+ } else {
4891
+ h -= 2 / 3;
4892
+ g = (1 - s) / 3;
4893
+ b = (1 + (s * cos$3(TWOPI * h)) / cos$3(PITHIRD - TWOPI * h)) / 3;
4894
+ r = 1 - (g + b);
4895
+ }
4896
+ r = limit(i * r * 3);
4897
+ g = limit(i * g * 3);
4898
+ b = limit(i * b * 3);
4899
+ return [r * 255, g * 255, b * 255, args.length > 3 ? args[3] : 1];
4900
+ };
4901
+
4902
+ var min$2 = Math.min;
4903
+ var sqrt$3 = Math.sqrt;
4904
+ var acos = Math.acos;
4905
+
4906
+ var rgb2hsi = function () {
4907
+ var args = [], len = arguments.length;
4908
+ while ( len-- ) args[ len ] = arguments[ len ];
4909
+
4910
+ /*
4911
+ borrowed from here:
4912
+ http://hummer.stanford.edu/museinfo/doc/examples/humdrum/keyscape2/rgb2hsi.cpp
4913
+ */
4914
+ var ref = unpack(args, 'rgb');
4915
+ var r = ref[0];
4916
+ var g = ref[1];
4917
+ var b = ref[2];
4918
+ r /= 255;
4919
+ g /= 255;
4920
+ b /= 255;
4921
+ var h;
4922
+ var min_ = min$2(r, g, b);
4923
+ var i = (r + g + b) / 3;
4924
+ var s = i > 0 ? 1 - min_ / i : 0;
4925
+ if (s === 0) {
4926
+ h = NaN;
4927
+ } else {
4928
+ h = (r - g + (r - b)) / 2;
4929
+ h /= sqrt$3((r - g) * (r - g) + (r - b) * (g - b));
4930
+ h = acos(h);
4931
+ if (b > g) {
4932
+ h = TWOPI - h;
4933
+ }
4934
+ h /= TWOPI;
4935
+ }
4936
+ return [h * 360, s, i];
4937
+ };
4938
+
4939
+ Color.prototype.hsi = function () {
4940
+ return rgb2hsi(this._rgb);
4941
+ };
4942
+
4943
+ var hsi$1 = function () {
4944
+ var args = [], len = arguments.length;
4945
+ while ( len-- ) args[ len ] = arguments[ len ];
4946
+
4947
+ return new (Function.prototype.bind.apply( Color, [ null ].concat( args, ['hsi']) ));
4948
+ };
4949
+ chroma.hsi = hsi$1;
4950
+
4951
+ input.format.hsi = hsi2rgb;
4952
+
4953
+ input.autodetect.push({
4954
+ p: 2,
4955
+ test: function () {
4956
+ var args = [], len = arguments.length;
4957
+ while ( len-- ) args[ len ] = arguments[ len ];
4958
+
4959
+ args = unpack(args, 'hsi');
4960
+ if (type(args) === 'array' && args.length === 3) {
4961
+ return 'hsi';
4962
+ }
4963
+ }
4964
+ });
4965
+
4966
+ Color.prototype.hsl = function () {
4967
+ return rgb2hsl$1(this._rgb);
4968
+ };
4969
+
4970
+ var hsl$1 = function () {
4971
+ var args = [], len = arguments.length;
4972
+ while ( len-- ) args[ len ] = arguments[ len ];
4973
+
4974
+ return new (Function.prototype.bind.apply( Color, [ null ].concat( args, ['hsl']) ));
4975
+ };
4976
+ chroma.hsl = hsl$1;
4977
+
4978
+ input.format.hsl = hsl2rgb;
4979
+
4980
+ input.autodetect.push({
4981
+ p: 2,
4982
+ test: function () {
4983
+ var args = [], len = arguments.length;
4984
+ while ( len-- ) args[ len ] = arguments[ len ];
4985
+
4986
+ args = unpack(args, 'hsl');
4987
+ if (type(args) === 'array' && args.length === 3) {
4988
+ return 'hsl';
4989
+ }
4990
+ }
4991
+ });
4992
+
4993
+ var floor$2 = Math.floor;
4994
+
4995
+ var hsv2rgb = function () {
4996
+ var assign, assign$1, assign$2, assign$3, assign$4, assign$5;
4997
+
4998
+ var args = [], len = arguments.length;
4999
+ while ( len-- ) args[ len ] = arguments[ len ];
5000
+ args = unpack(args, 'hsv');
5001
+ var h = args[0];
5002
+ var s = args[1];
5003
+ var v = args[2];
5004
+ var r, g, b;
5005
+ v *= 255;
5006
+ if (s === 0) {
5007
+ r = g = b = v;
5008
+ } else {
5009
+ if (h === 360) { h = 0; }
5010
+ if (h > 360) { h -= 360; }
5011
+ if (h < 0) { h += 360; }
5012
+ h /= 60;
5013
+
5014
+ var i = floor$2(h);
5015
+ var f = h - i;
5016
+ var p = v * (1 - s);
5017
+ var q = v * (1 - s * f);
5018
+ var t = v * (1 - s * (1 - f));
5019
+
5020
+ switch (i) {
5021
+ case 0:
5022
+ (assign = [v, t, p], r = assign[0], g = assign[1], b = assign[2]);
5023
+ break;
5024
+ case 1:
5025
+ (assign$1 = [q, v, p], r = assign$1[0], g = assign$1[1], b = assign$1[2]);
5026
+ break;
5027
+ case 2:
5028
+ (assign$2 = [p, v, t], r = assign$2[0], g = assign$2[1], b = assign$2[2]);
5029
+ break;
5030
+ case 3:
5031
+ (assign$3 = [p, q, v], r = assign$3[0], g = assign$3[1], b = assign$3[2]);
5032
+ break;
5033
+ case 4:
5034
+ (assign$4 = [t, p, v], r = assign$4[0], g = assign$4[1], b = assign$4[2]);
5035
+ break;
5036
+ case 5:
5037
+ (assign$5 = [v, p, q], r = assign$5[0], g = assign$5[1], b = assign$5[2]);
5038
+ break;
5039
+ }
5040
+ }
5041
+ return [r, g, b, args.length > 3 ? args[3] : 1];
5042
+ };
5043
+
5044
+ var min$1 = Math.min;
5045
+ var max$1 = Math.max;
5046
+
5047
+ /*
5048
+ * supported arguments:
5049
+ * - rgb2hsv(r,g,b)
5050
+ * - rgb2hsv([r,g,b])
5051
+ * - rgb2hsv({r,g,b})
5052
+ */
5053
+ var rgb2hsl = function () {
5054
+ var args = [], len = arguments.length;
5055
+ while ( len-- ) args[ len ] = arguments[ len ];
5056
+
5057
+ args = unpack(args, 'rgb');
5058
+ var r = args[0];
5059
+ var g = args[1];
5060
+ var b = args[2];
5061
+ var min_ = min$1(r, g, b);
5062
+ var max_ = max$1(r, g, b);
5063
+ var delta = max_ - min_;
5064
+ var h, s, v;
5065
+ v = max_ / 255.0;
5066
+ if (max_ === 0) {
5067
+ h = Number.NaN;
5068
+ s = 0;
5069
+ } else {
5070
+ s = delta / max_;
5071
+ if (r === max_) { h = (g - b) / delta; }
5072
+ if (g === max_) { h = 2 + (b - r) / delta; }
5073
+ if (b === max_) { h = 4 + (r - g) / delta; }
5074
+ h *= 60;
5075
+ if (h < 0) { h += 360; }
5076
+ }
5077
+ return [h, s, v];
5078
+ };
5079
+
5080
+ Color.prototype.hsv = function () {
5081
+ return rgb2hsl(this._rgb);
5082
+ };
5083
+
5084
+ var hsv$1 = function () {
5085
+ var args = [], len = arguments.length;
5086
+ while ( len-- ) args[ len ] = arguments[ len ];
5087
+
5088
+ return new (Function.prototype.bind.apply( Color, [ null ].concat( args, ['hsv']) ));
5089
+ };
5090
+ chroma.hsv = hsv$1;
5091
+
5092
+ input.format.hsv = hsv2rgb;
5093
+
5094
+ input.autodetect.push({
5095
+ p: 2,
5096
+ test: function () {
5097
+ var args = [], len = arguments.length;
5098
+ while ( len-- ) args[ len ] = arguments[ len ];
5099
+
5100
+ args = unpack(args, 'hsv');
5101
+ if (type(args) === 'array' && args.length === 3) {
5102
+ return 'hsv';
5103
+ }
5104
+ }
5105
+ });
5106
+
5107
+ Color.prototype.lab = function () {
5108
+ return rgb2lab(this._rgb);
5109
+ };
5110
+
5111
+ var lab$1 = function () {
5112
+ var args = [], len = arguments.length;
5113
+ while ( len-- ) args[ len ] = arguments[ len ];
5114
+
5115
+ return new (Function.prototype.bind.apply( Color, [ null ].concat( args, ['lab']) ));
5116
+ };
5117
+ Object.assign(chroma, { lab: lab$1, getLabWhitePoint: getLabWhitePoint, setLabWhitePoint: setLabWhitePoint });
5118
+
5119
+ input.format.lab = lab2rgb;
5120
+
5121
+ input.autodetect.push({
5122
+ p: 2,
5123
+ test: function () {
5124
+ var args = [], len = arguments.length;
5125
+ while ( len-- ) args[ len ] = arguments[ len ];
5126
+
5127
+ args = unpack(args, 'lab');
5128
+ if (type(args) === 'array' && args.length === 3) {
5129
+ return 'lab';
5130
+ }
5131
+ }
5132
+ });
5133
+
5134
+ var hcl2rgb = function () {
5135
+ var args = [], len = arguments.length;
5136
+ while ( len-- ) args[ len ] = arguments[ len ];
5137
+
5138
+ var hcl = reverse3(unpack(args, 'hcl'));
5139
+ return lch2rgb.apply(void 0, hcl);
5140
+ };
5141
+
5142
+ Color.prototype.lch = function () {
5143
+ return rgb2lch(this._rgb);
5144
+ };
5145
+ Color.prototype.hcl = function () {
5146
+ return reverse3(rgb2lch(this._rgb));
5147
+ };
5148
+
5149
+ var lch$1 = function () {
5150
+ var args = [], len = arguments.length;
5151
+ while ( len-- ) args[ len ] = arguments[ len ];
5152
+
5153
+ return new (Function.prototype.bind.apply( Color, [ null ].concat( args, ['lch']) ));
5154
+ };
5155
+ var hcl = function () {
5156
+ var args = [], len = arguments.length;
5157
+ while ( len-- ) args[ len ] = arguments[ len ];
5158
+
5159
+ return new (Function.prototype.bind.apply( Color, [ null ].concat( args, ['hcl']) ));
5160
+ };
5161
+
5162
+ Object.assign(chroma, { lch: lch$1, hcl: hcl });
5163
+
5164
+ input.format.lch = lch2rgb;
5165
+ input.format.hcl = hcl2rgb;
5166
+ ['lch', 'hcl'].forEach(function (m) { return input.autodetect.push({
5167
+ p: 2,
5168
+ test: function () {
5169
+ var args = [], len = arguments.length;
5170
+ while ( len-- ) args[ len ] = arguments[ len ];
5171
+
5172
+ args = unpack(args, m);
5173
+ if (type(args) === 'array' && args.length === 3) {
5174
+ return m;
5175
+ }
5176
+ }
5177
+ }); }
5178
+ );
5179
+
5180
+ var num2rgb = function (num) {
5181
+ if (type(num) == 'number' && num >= 0 && num <= 0xffffff) {
5182
+ var r = num >> 16;
5183
+ var g = (num >> 8) & 0xff;
5184
+ var b = num & 0xff;
5185
+ return [r, g, b, 1];
5186
+ }
5187
+ throw new Error('unknown num color: ' + num);
5188
+ };
5189
+
5190
+ var rgb2num = function () {
5191
+ var args = [], len = arguments.length;
5192
+ while ( len-- ) args[ len ] = arguments[ len ];
5193
+
5194
+ var ref = unpack(args, 'rgb');
5195
+ var r = ref[0];
5196
+ var g = ref[1];
5197
+ var b = ref[2];
5198
+ return (r << 16) + (g << 8) + b;
5199
+ };
5200
+
5201
+ Color.prototype.num = function () {
5202
+ return rgb2num(this._rgb);
5203
+ };
5204
+
5205
+ var num$1 = function () {
5206
+ var args = [], len = arguments.length;
5207
+ while ( len-- ) args[ len ] = arguments[ len ];
5208
+
5209
+ return new (Function.prototype.bind.apply( Color, [ null ].concat( args, ['num']) ));
5210
+ };
5211
+
5212
+ Object.assign(chroma, { num: num$1 });
5213
+
5214
+ input.format.num = num2rgb;
5215
+
5216
+ input.autodetect.push({
5217
+ p: 5,
5218
+ test: function () {
5219
+ var args = [], len = arguments.length;
5220
+ while ( len-- ) args[ len ] = arguments[ len ];
5221
+
5222
+ if (
5223
+ args.length === 1 &&
5224
+ type(args[0]) === 'number' &&
5225
+ args[0] >= 0 &&
5226
+ args[0] <= 0xffffff
5227
+ ) {
5228
+ return 'num';
5229
+ }
5230
+ }
5231
+ });
5232
+
5233
+ var round$1 = Math.round;
5234
+
5235
+ Color.prototype.rgb = function (rnd) {
5236
+ if ( rnd === void 0 ) rnd = true;
5237
+
5238
+ if (rnd === false) { return this._rgb.slice(0, 3); }
5239
+ return this._rgb.slice(0, 3).map(round$1);
5240
+ };
5241
+
5242
+ Color.prototype.rgba = function (rnd) {
5243
+ if ( rnd === void 0 ) rnd = true;
5244
+
5245
+ return this._rgb.slice(0, 4).map(function (v, i) {
5246
+ return i < 3 ? (rnd === false ? v : round$1(v)) : v;
5247
+ });
5248
+ };
5249
+
5250
+ var rgb$1 = function () {
5251
+ var args = [], len = arguments.length;
5252
+ while ( len-- ) args[ len ] = arguments[ len ];
5253
+
5254
+ return new (Function.prototype.bind.apply( Color, [ null ].concat( args, ['rgb']) ));
5255
+ };
5256
+ Object.assign(chroma, { rgb: rgb$1 });
5257
+
5258
+ input.format.rgb = function () {
5259
+ var args = [], len = arguments.length;
5260
+ while ( len-- ) args[ len ] = arguments[ len ];
5261
+
5262
+ var rgba = unpack(args, 'rgba');
5263
+ if (rgba[3] === undefined) { rgba[3] = 1; }
5264
+ return rgba;
5265
+ };
5266
+
5267
+ input.autodetect.push({
5268
+ p: 3,
5269
+ test: function () {
5270
+ var args = [], len = arguments.length;
5271
+ while ( len-- ) args[ len ] = arguments[ len ];
5272
+
5273
+ args = unpack(args, 'rgba');
5274
+ if (
5275
+ type(args) === 'array' &&
5276
+ (args.length === 3 ||
5277
+ (args.length === 4 &&
5278
+ type(args[3]) == 'number' &&
5279
+ args[3] >= 0 &&
5280
+ args[3] <= 1))
5281
+ ) {
5282
+ return 'rgb';
5283
+ }
5284
+ }
5285
+ });
5286
+
5287
+ /*
5288
+ * Based on implementation by Neil Bartlett
5289
+ * https://github.com/neilbartlett/color-temperature
5290
+ */
5291
+
5292
+ var log$1 = Math.log;
5293
+
5294
+ var temperature2rgb = function (kelvin) {
5295
+ var temp = kelvin / 100;
5296
+ var r, g, b;
5297
+ if (temp < 66) {
5298
+ r = 255;
5299
+ g =
5300
+ temp < 6
5301
+ ? 0
5302
+ : -155.25485562709179 -
5303
+ 0.44596950469579133 * (g = temp - 2) +
5304
+ 104.49216199393888 * log$1(g);
5305
+ b =
5306
+ temp < 20
5307
+ ? 0
5308
+ : -254.76935184120902 +
5309
+ 0.8274096064007395 * (b = temp - 10) +
5310
+ 115.67994401066147 * log$1(b);
5311
+ } else {
5312
+ r =
5313
+ 351.97690566805693 +
5314
+ 0.114206453784165 * (r = temp - 55) -
5315
+ 40.25366309332127 * log$1(r);
5316
+ g =
5317
+ 325.4494125711974 +
5318
+ 0.07943456536662342 * (g = temp - 50) -
5319
+ 28.0852963507957 * log$1(g);
5320
+ b = 255;
5321
+ }
5322
+ return [r, g, b, 1];
5323
+ };
5324
+
5325
+ /*
5326
+ * Based on implementation by Neil Bartlett
5327
+ * https://github.com/neilbartlett/color-temperature
5328
+ **/
5329
+
5330
+ var round = Math.round;
5331
+
5332
+ var rgb2temperature = function () {
5333
+ var args = [], len = arguments.length;
5334
+ while ( len-- ) args[ len ] = arguments[ len ];
5335
+
5336
+ var rgb = unpack(args, 'rgb');
5337
+ var r = rgb[0],
5338
+ b = rgb[2];
5339
+ var minTemp = 1000;
5340
+ var maxTemp = 40000;
5341
+ var eps = 0.4;
5342
+ var temp;
5343
+ while (maxTemp - minTemp > eps) {
5344
+ temp = (maxTemp + minTemp) * 0.5;
5345
+ var rgb$1 = temperature2rgb(temp);
5346
+ if (rgb$1[2] / rgb$1[0] >= b / r) {
5347
+ maxTemp = temp;
5348
+ } else {
5349
+ minTemp = temp;
5350
+ }
5351
+ }
5352
+ return round(temp);
5353
+ };
5354
+
5355
+ Color.prototype.temp =
5356
+ Color.prototype.kelvin =
5357
+ Color.prototype.temperature =
5358
+ function () {
5359
+ return rgb2temperature(this._rgb);
5360
+ };
5361
+
5362
+ var temp = function () {
5363
+ var args = [], len = arguments.length;
5364
+ while ( len-- ) args[ len ] = arguments[ len ];
5365
+
5366
+ return new (Function.prototype.bind.apply( Color, [ null ].concat( args, ['temp']) ));
5367
+ };
5368
+ Object.assign(chroma, { temp: temp, kelvin: temp, temperature: temp });
5369
+
5370
+ input.format.temp =
5371
+ input.format.kelvin =
5372
+ input.format.temperature =
5373
+ temperature2rgb;
5374
+
5375
+ Color.prototype.oklab = function () {
5376
+ return rgb2oklab(this._rgb);
5377
+ };
5378
+
5379
+ var oklab$1 = function () {
5380
+ var args = [], len = arguments.length;
5381
+ while ( len-- ) args[ len ] = arguments[ len ];
5382
+
5383
+ return new (Function.prototype.bind.apply( Color, [ null ].concat( args, ['oklab']) ));
5384
+ };
5385
+ Object.assign(chroma, { oklab: oklab$1 });
5386
+
5387
+ input.format.oklab = oklab2rgb;
5388
+
5389
+ input.autodetect.push({
5390
+ p: 2,
5391
+ test: function () {
5392
+ var args = [], len = arguments.length;
5393
+ while ( len-- ) args[ len ] = arguments[ len ];
5394
+
5395
+ args = unpack(args, 'oklab');
5396
+ if (type(args) === 'array' && args.length === 3) {
5397
+ return 'oklab';
5398
+ }
5399
+ }
5400
+ });
5401
+
5402
+ Color.prototype.oklch = function () {
5403
+ return rgb2oklch(this._rgb);
5404
+ };
5405
+
5406
+ var oklch$1 = function () {
5407
+ var args = [], len = arguments.length;
5408
+ while ( len-- ) args[ len ] = arguments[ len ];
5409
+
5410
+ return new (Function.prototype.bind.apply( Color, [ null ].concat( args, ['oklch']) ));
5411
+ };
5412
+ Object.assign(chroma, { oklch: oklch$1 });
5413
+
5414
+ input.format.oklch = oklch2rgb;
5415
+
5416
+ input.autodetect.push({
5417
+ p: 2,
5418
+ test: function () {
5419
+ var args = [], len = arguments.length;
5420
+ while ( len-- ) args[ len ] = arguments[ len ];
5421
+
5422
+ args = unpack(args, 'oklch');
5423
+ if (type(args) === 'array' && args.length === 3) {
5424
+ return 'oklch';
5425
+ }
5426
+ }
5427
+ });
5428
+
5429
+ /**
5430
+ X11 color names
5431
+
5432
+ http://www.w3.org/TR/css3-color/#svg-color
5433
+ */
5434
+
5435
+ var w3cx11 = {
5436
+ aliceblue: '#f0f8ff',
5437
+ antiquewhite: '#faebd7',
5438
+ aqua: '#00ffff',
5439
+ aquamarine: '#7fffd4',
5440
+ azure: '#f0ffff',
5441
+ beige: '#f5f5dc',
5442
+ bisque: '#ffe4c4',
5443
+ black: '#000000',
5444
+ blanchedalmond: '#ffebcd',
5445
+ blue: '#0000ff',
5446
+ blueviolet: '#8a2be2',
5447
+ brown: '#a52a2a',
5448
+ burlywood: '#deb887',
5449
+ cadetblue: '#5f9ea0',
5450
+ chartreuse: '#7fff00',
5451
+ chocolate: '#d2691e',
5452
+ coral: '#ff7f50',
5453
+ cornflowerblue: '#6495ed',
5454
+ cornsilk: '#fff8dc',
5455
+ crimson: '#dc143c',
5456
+ cyan: '#00ffff',
5457
+ darkblue: '#00008b',
5458
+ darkcyan: '#008b8b',
5459
+ darkgoldenrod: '#b8860b',
5460
+ darkgray: '#a9a9a9',
5461
+ darkgreen: '#006400',
5462
+ darkgrey: '#a9a9a9',
5463
+ darkkhaki: '#bdb76b',
5464
+ darkmagenta: '#8b008b',
5465
+ darkolivegreen: '#556b2f',
5466
+ darkorange: '#ff8c00',
5467
+ darkorchid: '#9932cc',
5468
+ darkred: '#8b0000',
5469
+ darksalmon: '#e9967a',
5470
+ darkseagreen: '#8fbc8f',
5471
+ darkslateblue: '#483d8b',
5472
+ darkslategray: '#2f4f4f',
5473
+ darkslategrey: '#2f4f4f',
5474
+ darkturquoise: '#00ced1',
5475
+ darkviolet: '#9400d3',
5476
+ deeppink: '#ff1493',
5477
+ deepskyblue: '#00bfff',
5478
+ dimgray: '#696969',
5479
+ dimgrey: '#696969',
5480
+ dodgerblue: '#1e90ff',
5481
+ firebrick: '#b22222',
5482
+ floralwhite: '#fffaf0',
5483
+ forestgreen: '#228b22',
5484
+ fuchsia: '#ff00ff',
5485
+ gainsboro: '#dcdcdc',
5486
+ ghostwhite: '#f8f8ff',
5487
+ gold: '#ffd700',
5488
+ goldenrod: '#daa520',
5489
+ gray: '#808080',
5490
+ green: '#008000',
5491
+ greenyellow: '#adff2f',
5492
+ grey: '#808080',
5493
+ honeydew: '#f0fff0',
5494
+ hotpink: '#ff69b4',
5495
+ indianred: '#cd5c5c',
5496
+ indigo: '#4b0082',
5497
+ ivory: '#fffff0',
5498
+ khaki: '#f0e68c',
5499
+ laserlemon: '#ffff54',
5500
+ lavender: '#e6e6fa',
5501
+ lavenderblush: '#fff0f5',
5502
+ lawngreen: '#7cfc00',
5503
+ lemonchiffon: '#fffacd',
5504
+ lightblue: '#add8e6',
5505
+ lightcoral: '#f08080',
5506
+ lightcyan: '#e0ffff',
5507
+ lightgoldenrod: '#fafad2',
5508
+ lightgoldenrodyellow: '#fafad2',
5509
+ lightgray: '#d3d3d3',
5510
+ lightgreen: '#90ee90',
5511
+ lightgrey: '#d3d3d3',
5512
+ lightpink: '#ffb6c1',
5513
+ lightsalmon: '#ffa07a',
5514
+ lightseagreen: '#20b2aa',
5515
+ lightskyblue: '#87cefa',
5516
+ lightslategray: '#778899',
5517
+ lightslategrey: '#778899',
5518
+ lightsteelblue: '#b0c4de',
5519
+ lightyellow: '#ffffe0',
5520
+ lime: '#00ff00',
5521
+ limegreen: '#32cd32',
5522
+ linen: '#faf0e6',
5523
+ magenta: '#ff00ff',
5524
+ maroon: '#800000',
5525
+ maroon2: '#7f0000',
5526
+ maroon3: '#b03060',
5527
+ mediumaquamarine: '#66cdaa',
5528
+ mediumblue: '#0000cd',
5529
+ mediumorchid: '#ba55d3',
5530
+ mediumpurple: '#9370db',
5531
+ mediumseagreen: '#3cb371',
5532
+ mediumslateblue: '#7b68ee',
5533
+ mediumspringgreen: '#00fa9a',
5534
+ mediumturquoise: '#48d1cc',
5535
+ mediumvioletred: '#c71585',
5536
+ midnightblue: '#191970',
5537
+ mintcream: '#f5fffa',
5538
+ mistyrose: '#ffe4e1',
5539
+ moccasin: '#ffe4b5',
5540
+ navajowhite: '#ffdead',
5541
+ navy: '#000080',
5542
+ oldlace: '#fdf5e6',
5543
+ olive: '#808000',
5544
+ olivedrab: '#6b8e23',
5545
+ orange: '#ffa500',
5546
+ orangered: '#ff4500',
5547
+ orchid: '#da70d6',
5548
+ palegoldenrod: '#eee8aa',
5549
+ palegreen: '#98fb98',
5550
+ paleturquoise: '#afeeee',
5551
+ palevioletred: '#db7093',
5552
+ papayawhip: '#ffefd5',
5553
+ peachpuff: '#ffdab9',
5554
+ peru: '#cd853f',
5555
+ pink: '#ffc0cb',
5556
+ plum: '#dda0dd',
5557
+ powderblue: '#b0e0e6',
5558
+ purple: '#800080',
5559
+ purple2: '#7f007f',
5560
+ purple3: '#a020f0',
5561
+ rebeccapurple: '#663399',
5562
+ red: '#ff0000',
5563
+ rosybrown: '#bc8f8f',
5564
+ royalblue: '#4169e1',
5565
+ saddlebrown: '#8b4513',
5566
+ salmon: '#fa8072',
5567
+ sandybrown: '#f4a460',
5568
+ seagreen: '#2e8b57',
5569
+ seashell: '#fff5ee',
5570
+ sienna: '#a0522d',
5571
+ silver: '#c0c0c0',
5572
+ skyblue: '#87ceeb',
5573
+ slateblue: '#6a5acd',
5574
+ slategray: '#708090',
5575
+ slategrey: '#708090',
5576
+ snow: '#fffafa',
5577
+ springgreen: '#00ff7f',
5578
+ steelblue: '#4682b4',
5579
+ tan: '#d2b48c',
5580
+ teal: '#008080',
5581
+ thistle: '#d8bfd8',
5582
+ tomato: '#ff6347',
5583
+ turquoise: '#40e0d0',
5584
+ violet: '#ee82ee',
5585
+ wheat: '#f5deb3',
5586
+ white: '#ffffff',
5587
+ whitesmoke: '#f5f5f5',
5588
+ yellow: '#ffff00',
5589
+ yellowgreen: '#9acd32'
5590
+ };
5591
+
5592
+ Color.prototype.name = function () {
5593
+ var hex = rgb2hex(this._rgb, 'rgb');
5594
+ for (var i = 0, list = Object.keys(w3cx11); i < list.length; i += 1) {
5595
+ var n = list[i];
5596
+
5597
+ if (w3cx11[n] === hex) { return n.toLowerCase(); }
5598
+ }
5599
+ return hex;
5600
+ };
5601
+
5602
+ input.format.named = function (name) {
5603
+ name = name.toLowerCase();
5604
+ if (w3cx11[name]) { return hex2rgb(w3cx11[name]); }
5605
+ throw new Error('unknown color name: ' + name);
5606
+ };
5607
+
5608
+ input.autodetect.push({
5609
+ p: 5,
5610
+ test: function (h) {
5611
+ var rest = [], len = arguments.length - 1;
5612
+ while ( len-- > 0 ) rest[ len ] = arguments[ len + 1 ];
5613
+
5614
+ if (!rest.length && type(h) === 'string' && w3cx11[h.toLowerCase()]) {
5615
+ return 'named';
5616
+ }
5617
+ }
5618
+ });
5619
+
5620
+ Color.prototype.alpha = function (a, mutate) {
5621
+ if ( mutate === void 0 ) mutate = false;
5622
+
5623
+ if (a !== undefined && type(a) === 'number') {
5624
+ if (mutate) {
5625
+ this._rgb[3] = a;
5626
+ return this;
5627
+ }
5628
+ return new Color([this._rgb[0], this._rgb[1], this._rgb[2], a], 'rgb');
5629
+ }
5630
+ return this._rgb[3];
5631
+ };
5632
+
5633
+ Color.prototype.clipped = function () {
5634
+ return this._rgb._clipped || false;
5635
+ };
5636
+
5637
+ Color.prototype.darken = function (amount) {
5638
+ if ( amount === void 0 ) amount = 1;
5639
+
5640
+ var me = this;
5641
+ var lab = me.lab();
5642
+ lab[0] -= labConstants.Kn * amount;
5643
+ return new Color(lab, 'lab').alpha(me.alpha(), true);
5644
+ };
5645
+
5646
+ Color.prototype.brighten = function (amount) {
5647
+ if ( amount === void 0 ) amount = 1;
5648
+
5649
+ return this.darken(-amount);
5650
+ };
5651
+
5652
+ Color.prototype.darker = Color.prototype.darken;
5653
+ Color.prototype.brighter = Color.prototype.brighten;
5654
+
5655
+ Color.prototype.get = function (mc) {
5656
+ var ref = mc.split('.');
5657
+ var mode = ref[0];
5658
+ var channel = ref[1];
5659
+ var src = this[mode]();
5660
+ if (channel) {
5661
+ var i = mode.indexOf(channel) - (mode.substr(0, 2) === 'ok' ? 2 : 0);
5662
+ if (i > -1) { return src[i]; }
5663
+ throw new Error(("unknown channel " + channel + " in mode " + mode));
5664
+ } else {
5665
+ return src;
5666
+ }
5667
+ };
5668
+
5669
+ var pow$6 = Math.pow;
5670
+
5671
+ var EPS = 1e-7;
5672
+ var MAX_ITER = 20;
5673
+
5674
+ Color.prototype.luminance = function (lum, mode) {
5675
+ if ( mode === void 0 ) mode = 'rgb';
5676
+
5677
+ if (lum !== undefined && type(lum) === 'number') {
5678
+ if (lum === 0) {
5679
+ // return pure black
5680
+ return new Color([0, 0, 0, this._rgb[3]], 'rgb');
5681
+ }
5682
+ if (lum === 1) {
5683
+ // return pure white
5684
+ return new Color([255, 255, 255, this._rgb[3]], 'rgb');
5685
+ }
5686
+ // compute new color using...
5687
+ var cur_lum = this.luminance();
5688
+ var max_iter = MAX_ITER;
5689
+
5690
+ var test = function (low, high) {
5691
+ var mid = low.interpolate(high, 0.5, mode);
5692
+ var lm = mid.luminance();
5693
+ if (Math.abs(lum - lm) < EPS || !max_iter--) {
5694
+ // close enough
5695
+ return mid;
5696
+ }
5697
+ return lm > lum ? test(low, mid) : test(mid, high);
5698
+ };
5699
+
5700
+ var rgb = (
5701
+ cur_lum > lum
5702
+ ? test(new Color([0, 0, 0]), this)
5703
+ : test(this, new Color([255, 255, 255]))
5704
+ ).rgb();
5705
+ return new Color(rgb.concat( [this._rgb[3]]));
5706
+ }
5707
+ return rgb2luminance.apply(void 0, this._rgb.slice(0, 3));
5708
+ };
5709
+
5710
+ var rgb2luminance = function (r, g, b) {
5711
+ // relative luminance
5712
+ // see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
5713
+ r = luminance_x(r);
5714
+ g = luminance_x(g);
5715
+ b = luminance_x(b);
5716
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b;
5717
+ };
5718
+
5719
+ var luminance_x = function (x) {
5720
+ x /= 255;
5721
+ return x <= 0.03928 ? x / 12.92 : pow$6((x + 0.055) / 1.055, 2.4);
5722
+ };
5723
+
5724
+ var index = {};
5725
+
5726
+ function mix (col1, col2, f) {
5727
+ if ( f === void 0 ) f = 0.5;
5728
+ var rest = [], len = arguments.length - 3;
5729
+ while ( len-- > 0 ) rest[ len ] = arguments[ len + 3 ];
5730
+
5731
+ var mode = rest[0] || 'lrgb';
5732
+ if (!index[mode] && !rest.length) {
5733
+ // fall back to the first supported mode
5734
+ mode = Object.keys(index)[0];
5735
+ }
5736
+ if (!index[mode]) {
5737
+ throw new Error(("interpolation mode " + mode + " is not defined"));
5738
+ }
5739
+ if (type(col1) !== 'object') { col1 = new Color(col1); }
5740
+ if (type(col2) !== 'object') { col2 = new Color(col2); }
5741
+ return index[mode](col1, col2, f).alpha(
5742
+ col1.alpha() + f * (col2.alpha() - col1.alpha())
5743
+ );
5744
+ }
5745
+
5746
+ Color.prototype.mix = Color.prototype.interpolate = function (
5747
+ col2,
5748
+ f
5749
+ ) {
5750
+ if ( f === void 0 ) f = 0.5;
5751
+ var rest = [], len = arguments.length - 2;
5752
+ while ( len-- > 0 ) rest[ len ] = arguments[ len + 2 ];
5753
+
5754
+ return mix.apply(void 0, [ this, col2, f ].concat( rest ));
5755
+ };
5756
+
5757
+ Color.prototype.premultiply = function (mutate) {
5758
+ if ( mutate === void 0 ) mutate = false;
5759
+
5760
+ var rgb = this._rgb;
5761
+ var a = rgb[3];
5762
+ if (mutate) {
5763
+ this._rgb = [rgb[0] * a, rgb[1] * a, rgb[2] * a, a];
5764
+ return this;
5765
+ } else {
5766
+ return new Color([rgb[0] * a, rgb[1] * a, rgb[2] * a, a], 'rgb');
5767
+ }
5768
+ };
5769
+
5770
+ Color.prototype.saturate = function (amount) {
5771
+ if ( amount === void 0 ) amount = 1;
5772
+
5773
+ var me = this;
5774
+ var lch = me.lch();
5775
+ lch[1] += labConstants.Kn * amount;
5776
+ if (lch[1] < 0) { lch[1] = 0; }
5777
+ return new Color(lch, 'lch').alpha(me.alpha(), true);
5778
+ };
5779
+
5780
+ Color.prototype.desaturate = function (amount) {
5781
+ if ( amount === void 0 ) amount = 1;
5782
+
5783
+ return this.saturate(-amount);
5784
+ };
5785
+
5786
+ Color.prototype.set = function (mc, value, mutate) {
5787
+ if ( mutate === void 0 ) mutate = false;
5788
+
5789
+ var ref = mc.split('.');
5790
+ var mode = ref[0];
5791
+ var channel = ref[1];
5792
+ var src = this[mode]();
5793
+ if (channel) {
5794
+ var i = mode.indexOf(channel) - (mode.substr(0, 2) === 'ok' ? 2 : 0);
5795
+ if (i > -1) {
5796
+ if (type(value) == 'string') {
5797
+ switch (value.charAt(0)) {
5798
+ case '+':
5799
+ src[i] += +value;
5800
+ break;
5801
+ case '-':
5802
+ src[i] += +value;
5803
+ break;
5804
+ case '*':
5805
+ src[i] *= +value.substr(1);
5806
+ break;
5807
+ case '/':
5808
+ src[i] /= +value.substr(1);
5809
+ break;
5810
+ default:
5811
+ src[i] = +value;
5812
+ }
5813
+ } else if (type(value) === 'number') {
5814
+ src[i] = value;
5815
+ } else {
5816
+ throw new Error("unsupported value for Color.set");
5817
+ }
5818
+ var out = new Color(src, mode);
5819
+ if (mutate) {
5820
+ this._rgb = out._rgb;
5821
+ return this;
5822
+ }
5823
+ return out;
5824
+ }
5825
+ throw new Error(("unknown channel " + channel + " in mode " + mode));
5826
+ } else {
5827
+ return src;
5828
+ }
5829
+ };
5830
+
5831
+ Color.prototype.tint = function (f) {
5832
+ if ( f === void 0 ) f = 0.5;
5833
+ var rest = [], len = arguments.length - 1;
5834
+ while ( len-- > 0 ) rest[ len ] = arguments[ len + 1 ];
5835
+
5836
+ return mix.apply(void 0, [ this, 'white', f ].concat( rest ));
5837
+ };
5838
+
5839
+ Color.prototype.shade = function (f) {
5840
+ if ( f === void 0 ) f = 0.5;
5841
+ var rest = [], len = arguments.length - 1;
5842
+ while ( len-- > 0 ) rest[ len ] = arguments[ len + 1 ];
5843
+
5844
+ return mix.apply(void 0, [ this, 'black', f ].concat( rest ));
5845
+ };
5846
+
5847
+ var rgb = function (col1, col2, f) {
5848
+ var xyz0 = col1._rgb;
5849
+ var xyz1 = col2._rgb;
5850
+ return new Color(
5851
+ xyz0[0] + f * (xyz1[0] - xyz0[0]),
5852
+ xyz0[1] + f * (xyz1[1] - xyz0[1]),
5853
+ xyz0[2] + f * (xyz1[2] - xyz0[2]),
5854
+ 'rgb'
5855
+ );
5856
+ };
5857
+
5858
+ // register interpolator
5859
+ index.rgb = rgb;
5860
+
5861
+ var sqrt$2 = Math.sqrt;
5862
+ var pow$5 = Math.pow;
5863
+
5864
+ var lrgb = function (col1, col2, f) {
5865
+ var ref = col1._rgb;
5866
+ var x1 = ref[0];
5867
+ var y1 = ref[1];
5868
+ var z1 = ref[2];
5869
+ var ref$1 = col2._rgb;
5870
+ var x2 = ref$1[0];
5871
+ var y2 = ref$1[1];
5872
+ var z2 = ref$1[2];
5873
+ return new Color(
5874
+ sqrt$2(pow$5(x1, 2) * (1 - f) + pow$5(x2, 2) * f),
5875
+ sqrt$2(pow$5(y1, 2) * (1 - f) + pow$5(y2, 2) * f),
5876
+ sqrt$2(pow$5(z1, 2) * (1 - f) + pow$5(z2, 2) * f),
5877
+ 'rgb'
5878
+ );
5879
+ };
5880
+
5881
+ // register interpolator
5882
+ index.lrgb = lrgb;
5883
+
5884
+ var lab = function (col1, col2, f) {
5885
+ var xyz0 = col1.lab();
5886
+ var xyz1 = col2.lab();
5887
+ return new Color(
5888
+ xyz0[0] + f * (xyz1[0] - xyz0[0]),
5889
+ xyz0[1] + f * (xyz1[1] - xyz0[1]),
5890
+ xyz0[2] + f * (xyz1[2] - xyz0[2]),
5891
+ 'lab'
5892
+ );
5893
+ };
5894
+
5895
+ // register interpolator
5896
+ index.lab = lab;
5897
+
5898
+ function interpolate_hsx (col1, col2, f, m) {
5899
+ var assign, assign$1;
5900
+
5901
+ var xyz0, xyz1;
5902
+ if (m === 'hsl') {
5903
+ xyz0 = col1.hsl();
5904
+ xyz1 = col2.hsl();
5905
+ } else if (m === 'hsv') {
5906
+ xyz0 = col1.hsv();
5907
+ xyz1 = col2.hsv();
5908
+ } else if (m === 'hcg') {
5909
+ xyz0 = col1.hcg();
5910
+ xyz1 = col2.hcg();
5911
+ } else if (m === 'hsi') {
5912
+ xyz0 = col1.hsi();
5913
+ xyz1 = col2.hsi();
5914
+ } else if (m === 'lch' || m === 'hcl') {
5915
+ m = 'hcl';
5916
+ xyz0 = col1.hcl();
5917
+ xyz1 = col2.hcl();
5918
+ } else if (m === 'oklch') {
5919
+ xyz0 = col1.oklch().reverse();
5920
+ xyz1 = col2.oklch().reverse();
5921
+ }
5922
+
5923
+ var hue0, hue1, sat0, sat1, lbv0, lbv1;
5924
+ if (m.substr(0, 1) === 'h' || m === 'oklch') {
5925
+ (assign = xyz0, hue0 = assign[0], sat0 = assign[1], lbv0 = assign[2]);
5926
+ (assign$1 = xyz1, hue1 = assign$1[0], sat1 = assign$1[1], lbv1 = assign$1[2]);
5927
+ }
5928
+
5929
+ var sat, hue, lbv, dh;
5930
+
5931
+ if (!isNaN(hue0) && !isNaN(hue1)) {
5932
+ // both colors have hue
5933
+ if (hue1 > hue0 && hue1 - hue0 > 180) {
5934
+ dh = hue1 - (hue0 + 360);
5935
+ } else if (hue1 < hue0 && hue0 - hue1 > 180) {
5936
+ dh = hue1 + 360 - hue0;
5937
+ } else {
5938
+ dh = hue1 - hue0;
5939
+ }
5940
+ hue = hue0 + f * dh;
5941
+ } else if (!isNaN(hue0)) {
5942
+ hue = hue0;
5943
+ if ((lbv1 == 1 || lbv1 == 0) && m != 'hsv') { sat = sat0; }
5944
+ } else if (!isNaN(hue1)) {
5945
+ hue = hue1;
5946
+ if ((lbv0 == 1 || lbv0 == 0) && m != 'hsv') { sat = sat1; }
5947
+ } else {
5948
+ hue = Number.NaN;
5949
+ }
5950
+
5951
+ if (sat === undefined) { sat = sat0 + f * (sat1 - sat0); }
5952
+ lbv = lbv0 + f * (lbv1 - lbv0);
5953
+ return m === 'oklch'
5954
+ ? new Color([lbv, sat, hue], m)
5955
+ : new Color([hue, sat, lbv], m);
5956
+ }
5957
+
5958
+ var lch = function (col1, col2, f) {
5959
+ return interpolate_hsx(col1, col2, f, 'lch');
5960
+ };
5961
+
5962
+ // register interpolator
5963
+ index.lch = lch;
5964
+ index.hcl = lch;
5965
+
5966
+ var num = function (col1, col2, f) {
5967
+ var c1 = col1.num();
5968
+ var c2 = col2.num();
5969
+ return new Color(c1 + f * (c2 - c1), 'num');
5970
+ };
5971
+
5972
+ // register interpolator
5973
+ index.num = num;
5974
+
5975
+ var hcg = function (col1, col2, f) {
5976
+ return interpolate_hsx(col1, col2, f, 'hcg');
5977
+ };
5978
+
5979
+ // register interpolator
5980
+ index.hcg = hcg;
5981
+
5982
+ var hsi = function (col1, col2, f) {
5983
+ return interpolate_hsx(col1, col2, f, 'hsi');
5984
+ };
5985
+
5986
+ // register interpolator
5987
+ index.hsi = hsi;
5988
+
5989
+ var hsl = function (col1, col2, f) {
5990
+ return interpolate_hsx(col1, col2, f, 'hsl');
5991
+ };
5992
+
5993
+ // register interpolator
5994
+ index.hsl = hsl;
5995
+
5996
+ var hsv = function (col1, col2, f) {
5997
+ return interpolate_hsx(col1, col2, f, 'hsv');
5998
+ };
5999
+
6000
+ // register interpolator
6001
+ index.hsv = hsv;
6002
+
6003
+ var oklab = function (col1, col2, f) {
6004
+ var xyz0 = col1.oklab();
6005
+ var xyz1 = col2.oklab();
6006
+ return new Color(
6007
+ xyz0[0] + f * (xyz1[0] - xyz0[0]),
6008
+ xyz0[1] + f * (xyz1[1] - xyz0[1]),
6009
+ xyz0[2] + f * (xyz1[2] - xyz0[2]),
6010
+ 'oklab'
6011
+ );
6012
+ };
6013
+
6014
+ // register interpolator
6015
+ index.oklab = oklab;
6016
+
6017
+ var oklch = function (col1, col2, f) {
6018
+ return interpolate_hsx(col1, col2, f, 'oklch');
6019
+ };
6020
+
6021
+ // register interpolator
6022
+ index.oklch = oklch;
6023
+
6024
+ var pow$4 = Math.pow;
6025
+ var sqrt$1 = Math.sqrt;
6026
+ var PI$1 = Math.PI;
6027
+ var cos$2 = Math.cos;
6028
+ var sin$2 = Math.sin;
6029
+ var atan2$1 = Math.atan2;
6030
+
6031
+ function average (colors, mode, weights) {
6032
+ if ( mode === void 0 ) mode = 'lrgb';
6033
+ if ( weights === void 0 ) weights = null;
6034
+
6035
+ var l = colors.length;
6036
+ if (!weights) { weights = Array.from(new Array(l)).map(function () { return 1; }); }
6037
+ // normalize weights
6038
+ var k =
6039
+ l /
6040
+ weights.reduce(function (a, b) {
6041
+ return a + b;
6042
+ });
6043
+ weights.forEach(function (w, i) {
6044
+ weights[i] *= k;
6045
+ });
6046
+ // convert colors to Color objects
6047
+ colors = colors.map(function (c) { return new Color(c); });
6048
+ if (mode === 'lrgb') {
6049
+ return _average_lrgb(colors, weights);
6050
+ }
6051
+ var first = colors.shift();
6052
+ var xyz = first.get(mode);
6053
+ var cnt = [];
6054
+ var dx = 0;
6055
+ var dy = 0;
6056
+ // initial color
6057
+ for (var i = 0; i < xyz.length; i++) {
6058
+ xyz[i] = (xyz[i] || 0) * weights[0];
6059
+ cnt.push(isNaN(xyz[i]) ? 0 : weights[0]);
6060
+ if (mode.charAt(i) === 'h' && !isNaN(xyz[i])) {
6061
+ var A = (xyz[i] / 180) * PI$1;
6062
+ dx += cos$2(A) * weights[0];
6063
+ dy += sin$2(A) * weights[0];
6064
+ }
6065
+ }
6066
+
6067
+ var alpha = first.alpha() * weights[0];
6068
+ colors.forEach(function (c, ci) {
6069
+ var xyz2 = c.get(mode);
6070
+ alpha += c.alpha() * weights[ci + 1];
6071
+ for (var i = 0; i < xyz.length; i++) {
6072
+ if (!isNaN(xyz2[i])) {
6073
+ cnt[i] += weights[ci + 1];
6074
+ if (mode.charAt(i) === 'h') {
6075
+ var A = (xyz2[i] / 180) * PI$1;
6076
+ dx += cos$2(A) * weights[ci + 1];
6077
+ dy += sin$2(A) * weights[ci + 1];
6078
+ } else {
6079
+ xyz[i] += xyz2[i] * weights[ci + 1];
6080
+ }
6081
+ }
6082
+ }
6083
+ });
6084
+
6085
+ for (var i$1 = 0; i$1 < xyz.length; i$1++) {
6086
+ if (mode.charAt(i$1) === 'h') {
6087
+ var A$1 = (atan2$1(dy / cnt[i$1], dx / cnt[i$1]) / PI$1) * 180;
6088
+ while (A$1 < 0) { A$1 += 360; }
6089
+ while (A$1 >= 360) { A$1 -= 360; }
6090
+ xyz[i$1] = A$1;
6091
+ } else {
6092
+ xyz[i$1] = xyz[i$1] / cnt[i$1];
6093
+ }
6094
+ }
6095
+ alpha /= l;
6096
+ return new Color(xyz, mode).alpha(alpha > 0.99999 ? 1 : alpha, true);
6097
+ }
6098
+ var _average_lrgb = function (colors, weights) {
6099
+ var l = colors.length;
6100
+ var xyz = [0, 0, 0, 0];
6101
+ for (var i = 0; i < colors.length; i++) {
6102
+ var col = colors[i];
6103
+ var f = weights[i] / l;
6104
+ var rgb = col._rgb;
6105
+ xyz[0] += pow$4(rgb[0], 2) * f;
6106
+ xyz[1] += pow$4(rgb[1], 2) * f;
6107
+ xyz[2] += pow$4(rgb[2], 2) * f;
6108
+ xyz[3] += rgb[3] * f;
6109
+ }
6110
+ xyz[0] = sqrt$1(xyz[0]);
6111
+ xyz[1] = sqrt$1(xyz[1]);
6112
+ xyz[2] = sqrt$1(xyz[2]);
6113
+ if (xyz[3] > 0.9999999) { xyz[3] = 1; }
6114
+ return new Color(clip_rgb(xyz));
6115
+ };
6116
+
6117
+ // minimal multi-purpose interface
6118
+
6119
+
6120
+ var pow$3 = Math.pow;
6121
+
6122
+ function scale (colors) {
6123
+ // constructor
6124
+ var _mode = 'rgb';
6125
+ var _nacol = chroma('#ccc');
6126
+ var _spread = 0;
6127
+ // const _fixed = false;
6128
+ var _positions = [0, 1];
6129
+ var _domain = [0, 1];
6130
+ var _pos = [];
6131
+ var _padding = [0, 0];
6132
+ var _classes = false;
6133
+ var _colors = [];
6134
+ var _out = false;
6135
+ var _min = 0;
6136
+ var _max = 1;
6137
+ var _correctLightness = false;
6138
+ var _colorCache = {};
6139
+ var _useCache = true;
6140
+ var _gamma = 1;
6141
+
6142
+ // private methods
6143
+
6144
+ var setColors = function (colors) {
6145
+ colors = colors || ['#fff', '#000'];
6146
+ if (
6147
+ colors &&
6148
+ type(colors) === 'string' &&
6149
+ chroma.brewer &&
6150
+ chroma.brewer[colors.toLowerCase()]
6151
+ ) {
6152
+ colors = chroma.brewer[colors.toLowerCase()];
6153
+ }
6154
+ if (type(colors) === 'array') {
6155
+ // handle single color
6156
+ if (colors.length === 1) {
6157
+ colors = [colors[0], colors[0]];
6158
+ }
6159
+ // make a copy of the colors
6160
+ colors = colors.slice(0);
6161
+ // convert to chroma classes
6162
+ for (var c = 0; c < colors.length; c++) {
6163
+ colors[c] = chroma(colors[c]);
6164
+ }
6165
+ // auto-fill color position
6166
+ _pos.length = 0;
6167
+ for (var c$1 = 0; c$1 < colors.length; c$1++) {
6168
+ _pos.push(c$1 / (colors.length - 1));
6169
+ }
6170
+ }
6171
+ resetCache();
6172
+ return (_colors = colors);
6173
+ };
6174
+
6175
+ var getClass = function (value) {
6176
+ if (_classes != null) {
6177
+ var n = _classes.length - 1;
6178
+ var i = 0;
6179
+ while (i < n && value >= _classes[i]) {
6180
+ i++;
6181
+ }
6182
+ return i - 1;
6183
+ }
6184
+ return 0;
6185
+ };
6186
+
6187
+ var tMapLightness = function (t) { return t; };
6188
+ var tMapDomain = function (t) { return t; };
6189
+
6190
+ // const classifyValue = function(value) {
6191
+ // let val = value;
6192
+ // if (_classes.length > 2) {
6193
+ // const n = _classes.length-1;
6194
+ // const i = getClass(value);
6195
+ // const minc = _classes[0] + ((_classes[1]-_classes[0]) * (0 + (_spread * 0.5))); // center of 1st class
6196
+ // const maxc = _classes[n-1] + ((_classes[n]-_classes[n-1]) * (1 - (_spread * 0.5))); // center of last class
6197
+ // val = _min + ((((_classes[i] + ((_classes[i+1] - _classes[i]) * 0.5)) - minc) / (maxc-minc)) * (_max - _min));
6198
+ // }
6199
+ // return val;
6200
+ // };
6201
+
6202
+ var getColor = function (val, bypassMap) {
6203
+ var col, t;
6204
+ if (bypassMap == null) {
6205
+ bypassMap = false;
6206
+ }
6207
+ if (isNaN(val) || val === null) {
6208
+ return _nacol;
6209
+ }
6210
+ if (!bypassMap) {
6211
+ if (_classes && _classes.length > 2) {
6212
+ // find the class
6213
+ var c = getClass(val);
6214
+ t = c / (_classes.length - 2);
6215
+ } else if (_max !== _min) {
6216
+ // just interpolate between min/max
6217
+ t = (val - _min) / (_max - _min);
6218
+ } else {
6219
+ t = 1;
6220
+ }
6221
+ } else {
6222
+ t = val;
6223
+ }
6224
+
6225
+ // domain map
6226
+ t = tMapDomain(t);
6227
+
6228
+ if (!bypassMap) {
6229
+ t = tMapLightness(t); // lightness correction
6230
+ }
6231
+
6232
+ if (_gamma !== 1) {
6233
+ t = pow$3(t, _gamma);
6234
+ }
6235
+
6236
+ t = _padding[0] + t * (1 - _padding[0] - _padding[1]);
6237
+
6238
+ t = limit(t, 0, 1);
6239
+
6240
+ var k = Math.floor(t * 10000);
6241
+
6242
+ if (_useCache && _colorCache[k]) {
6243
+ col = _colorCache[k];
6244
+ } else {
6245
+ if (type(_colors) === 'array') {
6246
+ //for i in [0.._pos.length-1]
6247
+ for (var i = 0; i < _pos.length; i++) {
6248
+ var p = _pos[i];
6249
+ if (t <= p) {
6250
+ col = _colors[i];
6251
+ break;
6252
+ }
6253
+ if (t >= p && i === _pos.length - 1) {
6254
+ col = _colors[i];
6255
+ break;
6256
+ }
6257
+ if (t > p && t < _pos[i + 1]) {
6258
+ t = (t - p) / (_pos[i + 1] - p);
6259
+ col = chroma.interpolate(
6260
+ _colors[i],
6261
+ _colors[i + 1],
6262
+ t,
6263
+ _mode
6264
+ );
6265
+ break;
6266
+ }
6267
+ }
6268
+ } else if (type(_colors) === 'function') {
6269
+ col = _colors(t);
6270
+ }
6271
+ if (_useCache) {
6272
+ _colorCache[k] = col;
6273
+ }
6274
+ }
6275
+ return col;
6276
+ };
6277
+
6278
+ var resetCache = function () { return (_colorCache = {}); };
6279
+
6280
+ setColors(colors);
6281
+
6282
+ // public interface
6283
+
6284
+ var f = function (v) {
6285
+ var c = chroma(getColor(v));
6286
+ if (_out && c[_out]) {
6287
+ return c[_out]();
6288
+ } else {
6289
+ return c;
6290
+ }
6291
+ };
6292
+
6293
+ f.classes = function (classes) {
6294
+ if (classes != null) {
6295
+ if (type(classes) === 'array') {
6296
+ _classes = classes;
6297
+ _positions = [classes[0], classes[classes.length - 1]];
6298
+ } else {
6299
+ var d = chroma.analyze(_positions);
6300
+ if (classes === 0) {
6301
+ _classes = [d.min, d.max];
6302
+ } else {
6303
+ _classes = chroma.limits(d, 'e', classes);
6304
+ }
6305
+ }
6306
+ return f;
6307
+ }
6308
+ return _classes;
6309
+ };
6310
+
6311
+ f.domain = function (domain) {
6312
+ if (!arguments.length) {
6313
+ // return original domain
6314
+ return _domain;
6315
+ }
6316
+ // store original domain so we can return it later
6317
+ _domain = domain.slice(0);
6318
+ _min = domain[0];
6319
+ _max = domain[domain.length - 1];
6320
+ _pos = [];
6321
+ var k = _colors.length;
6322
+ if (domain.length === k && _min !== _max) {
6323
+ // update positions
6324
+ for (var i = 0, list = Array.from(domain); i < list.length; i += 1) {
6325
+ var d = list[i];
6326
+
6327
+ _pos.push((d - _min) / (_max - _min));
6328
+ }
6329
+ } else {
6330
+ for (var c = 0; c < k; c++) {
6331
+ _pos.push(c / (k - 1));
6332
+ }
6333
+ if (domain.length > 2) {
6334
+ // set domain map
6335
+ var tOut = domain.map(function (d, i) { return i / (domain.length - 1); });
6336
+ var tBreaks = domain.map(function (d) { return (d - _min) / (_max - _min); });
6337
+ if (!tBreaks.every(function (val, i) { return tOut[i] === val; })) {
6338
+ tMapDomain = function (t) {
6339
+ if (t <= 0 || t >= 1) { return t; }
6340
+ var i = 0;
6341
+ while (t >= tBreaks[i + 1]) { i++; }
6342
+ var f =
6343
+ (t - tBreaks[i]) / (tBreaks[i + 1] - tBreaks[i]);
6344
+ var out = tOut[i] + f * (tOut[i + 1] - tOut[i]);
6345
+ return out;
6346
+ };
6347
+ }
6348
+ }
6349
+ }
6350
+ _positions = [_min, _max];
6351
+ return f;
6352
+ };
6353
+
6354
+ f.mode = function (_m) {
6355
+ if (!arguments.length) {
6356
+ return _mode;
6357
+ }
6358
+ _mode = _m;
6359
+ resetCache();
6360
+ return f;
6361
+ };
6362
+
6363
+ f.range = function (colors, _pos) {
6364
+ setColors(colors);
6365
+ return f;
6366
+ };
6367
+
6368
+ f.out = function (_o) {
6369
+ _out = _o;
6370
+ return f;
6371
+ };
6372
+
6373
+ f.spread = function (val) {
6374
+ if (!arguments.length) {
6375
+ return _spread;
6376
+ }
6377
+ _spread = val;
6378
+ return f;
6379
+ };
6380
+
6381
+ f.correctLightness = function (v) {
6382
+ if (v == null) {
6383
+ v = true;
6384
+ }
6385
+ _correctLightness = v;
6386
+ resetCache();
6387
+ if (_correctLightness) {
6388
+ tMapLightness = function (t) {
6389
+ var L0 = getColor(0, true).lab()[0];
6390
+ var L1 = getColor(1, true).lab()[0];
6391
+ var pol = L0 > L1;
6392
+ var L_actual = getColor(t, true).lab()[0];
6393
+ var L_ideal = L0 + (L1 - L0) * t;
6394
+ var L_diff = L_actual - L_ideal;
6395
+ var t0 = 0;
6396
+ var t1 = 1;
6397
+ var max_iter = 20;
6398
+ while (Math.abs(L_diff) > 1e-2 && max_iter-- > 0) {
6399
+ (function () {
6400
+ if (pol) {
6401
+ L_diff *= -1;
6402
+ }
6403
+ if (L_diff < 0) {
6404
+ t0 = t;
6405
+ t += (t1 - t) * 0.5;
6406
+ } else {
6407
+ t1 = t;
6408
+ t += (t0 - t) * 0.5;
6409
+ }
6410
+ L_actual = getColor(t, true).lab()[0];
6411
+ return (L_diff = L_actual - L_ideal);
6412
+ })();
6413
+ }
6414
+ return t;
6415
+ };
6416
+ } else {
6417
+ tMapLightness = function (t) { return t; };
6418
+ }
6419
+ return f;
6420
+ };
6421
+
6422
+ f.padding = function (p) {
6423
+ if (p != null) {
6424
+ if (type(p) === 'number') {
6425
+ p = [p, p];
6426
+ }
6427
+ _padding = p;
6428
+ return f;
6429
+ } else {
6430
+ return _padding;
6431
+ }
6432
+ };
6433
+
6434
+ f.colors = function (numColors, out) {
6435
+ // If no arguments are given, return the original colors that were provided
6436
+ if (arguments.length < 2) {
6437
+ out = 'hex';
6438
+ }
6439
+ var result = [];
6440
+
6441
+ if (arguments.length === 0) {
6442
+ result = _colors.slice(0);
6443
+ } else if (numColors === 1) {
6444
+ result = [f(0.5)];
6445
+ } else if (numColors > 1) {
6446
+ var dm = _positions[0];
6447
+ var dd = _positions[1] - dm;
6448
+ result = __range__(0, numColors).map(function (i) { return f(dm + (i / (numColors - 1)) * dd); }
6449
+ );
6450
+ } else {
6451
+ // returns all colors based on the defined classes
6452
+ colors = [];
6453
+ var samples = [];
6454
+ if (_classes && _classes.length > 2) {
6455
+ for (
6456
+ var i = 1, end = _classes.length, asc = 1 <= end;
6457
+ asc ? i < end : i > end;
6458
+ asc ? i++ : i--
6459
+ ) {
6460
+ samples.push((_classes[i - 1] + _classes[i]) * 0.5);
6461
+ }
6462
+ } else {
6463
+ samples = _positions;
6464
+ }
6465
+ result = samples.map(function (v) { return f(v); });
6466
+ }
6467
+
6468
+ if (chroma[out]) {
6469
+ result = result.map(function (c) { return c[out](); });
6470
+ }
6471
+ return result;
6472
+ };
6473
+
6474
+ f.cache = function (c) {
6475
+ if (c != null) {
6476
+ _useCache = c;
6477
+ return f;
6478
+ } else {
6479
+ return _useCache;
6480
+ }
6481
+ };
6482
+
6483
+ f.gamma = function (g) {
6484
+ if (g != null) {
6485
+ _gamma = g;
6486
+ return f;
6487
+ } else {
6488
+ return _gamma;
6489
+ }
6490
+ };
6491
+
6492
+ f.nodata = function (d) {
6493
+ if (d != null) {
6494
+ _nacol = chroma(d);
6495
+ return f;
6496
+ } else {
6497
+ return _nacol;
6498
+ }
6499
+ };
6500
+
6501
+ return f;
6502
+ }
6503
+
6504
+ function __range__(left, right, inclusive) {
6505
+ var range = [];
6506
+ var ascending = left < right;
6507
+ var end = right ;
6508
+ for (var i = left; ascending ? i < end : i > end; ascending ? i++ : i--) {
6509
+ range.push(i);
6510
+ }
6511
+ return range;
6512
+ }
6513
+
6514
+ //
6515
+ // interpolates between a set of colors uzing a bezier spline
6516
+ //
6517
+
6518
+
6519
+ // nth row of the pascal triangle
6520
+ var binom_row = function (n) {
6521
+ var row = [1, 1];
6522
+ for (var i = 1; i < n; i++) {
6523
+ var newrow = [1];
6524
+ for (var j = 1; j <= row.length; j++) {
6525
+ newrow[j] = (row[j] || 0) + row[j - 1];
6526
+ }
6527
+ row = newrow;
6528
+ }
6529
+ return row;
6530
+ };
6531
+
6532
+ var bezier = function (colors) {
6533
+ var assign, assign$1, assign$2;
6534
+
6535
+ var I, lab0, lab1, lab2;
6536
+ colors = colors.map(function (c) { return new Color(c); });
6537
+ if (colors.length === 2) {
6538
+ // linear interpolation
6539
+ (assign = colors.map(function (c) { return c.lab(); }), lab0 = assign[0], lab1 = assign[1]);
6540
+ I = function (t) {
6541
+ var lab = [0, 1, 2].map(function (i) { return lab0[i] + t * (lab1[i] - lab0[i]); });
6542
+ return new Color(lab, 'lab');
6543
+ };
6544
+ } else if (colors.length === 3) {
6545
+ // quadratic bezier interpolation
6546
+ (assign$1 = colors.map(function (c) { return c.lab(); }), lab0 = assign$1[0], lab1 = assign$1[1], lab2 = assign$1[2]);
6547
+ I = function (t) {
6548
+ var lab = [0, 1, 2].map(
6549
+ function (i) { return (1 - t) * (1 - t) * lab0[i] +
6550
+ 2 * (1 - t) * t * lab1[i] +
6551
+ t * t * lab2[i]; }
6552
+ );
6553
+ return new Color(lab, 'lab');
6554
+ };
6555
+ } else if (colors.length === 4) {
6556
+ // cubic bezier interpolation
6557
+ var lab3;
6558
+ (assign$2 = colors.map(function (c) { return c.lab(); }), lab0 = assign$2[0], lab1 = assign$2[1], lab2 = assign$2[2], lab3 = assign$2[3]);
6559
+ I = function (t) {
6560
+ var lab = [0, 1, 2].map(
6561
+ function (i) { return (1 - t) * (1 - t) * (1 - t) * lab0[i] +
6562
+ 3 * (1 - t) * (1 - t) * t * lab1[i] +
6563
+ 3 * (1 - t) * t * t * lab2[i] +
6564
+ t * t * t * lab3[i]; }
6565
+ );
6566
+ return new Color(lab, 'lab');
6567
+ };
6568
+ } else if (colors.length >= 5) {
6569
+ // general case (degree n bezier)
6570
+ var labs, row, n;
6571
+ labs = colors.map(function (c) { return c.lab(); });
6572
+ n = colors.length - 1;
6573
+ row = binom_row(n);
6574
+ I = function (t) {
6575
+ var u = 1 - t;
6576
+ var lab = [0, 1, 2].map(function (i) { return labs.reduce(
6577
+ function (sum, el, j) { return sum + row[j] * Math.pow( u, (n - j) ) * Math.pow( t, j ) * el[i]; },
6578
+ 0
6579
+ ); }
6580
+ );
6581
+ return new Color(lab, 'lab');
6582
+ };
6583
+ } else {
6584
+ throw new RangeError('No point in running bezier with only one color.');
6585
+ }
6586
+ return I;
6587
+ };
6588
+
6589
+ function bezier$1 (colors) {
6590
+ var f = bezier(colors);
6591
+ f.scale = function () { return scale(f); };
6592
+ return f;
6593
+ }
6594
+
6595
+ /*
6596
+ * interpolates between a set of colors uzing a bezier spline
6597
+ * blend mode formulas taken from https://web.archive.org/web/20180110014946/http://www.venture-ware.com/kevin/coding/lets-learn-math-photoshop-blend-modes/
6598
+ */
6599
+
6600
+
6601
+ var blend = function (bottom, top, mode) {
6602
+ if (!blend[mode]) {
6603
+ throw new Error('unknown blend mode ' + mode);
6604
+ }
6605
+ return blend[mode](bottom, top);
6606
+ };
6607
+
6608
+ var blend_f = function (f) { return function (bottom, top) {
6609
+ var c0 = chroma(top).rgb();
6610
+ var c1 = chroma(bottom).rgb();
6611
+ return chroma.rgb(f(c0, c1));
6612
+ }; };
6613
+
6614
+ var each = function (f) { return function (c0, c1) {
6615
+ var out = [];
6616
+ out[0] = f(c0[0], c1[0]);
6617
+ out[1] = f(c0[1], c1[1]);
6618
+ out[2] = f(c0[2], c1[2]);
6619
+ return out;
6620
+ }; };
6621
+
6622
+ var normal = function (a) { return a; };
6623
+ var multiply = function (a, b) { return (a * b) / 255; };
6624
+ var darken = function (a, b) { return (a > b ? b : a); };
6625
+ var lighten = function (a, b) { return (a > b ? a : b); };
6626
+ var screen = function (a, b) { return 255 * (1 - (1 - a / 255) * (1 - b / 255)); };
6627
+ var overlay = function (a, b) { return b < 128 ? (2 * a * b) / 255 : 255 * (1 - 2 * (1 - a / 255) * (1 - b / 255)); };
6628
+ var burn = function (a, b) { return 255 * (1 - (1 - b / 255) / (a / 255)); };
6629
+ var dodge = function (a, b) {
6630
+ if (a === 255) { return 255; }
6631
+ a = (255 * (b / 255)) / (1 - a / 255);
6632
+ return a > 255 ? 255 : a;
6633
+ };
6634
+
6635
+ // # add = (a,b) ->
6636
+ // # if (a + b > 255) then 255 else a + b
6637
+
6638
+ blend.normal = blend_f(each(normal));
6639
+ blend.multiply = blend_f(each(multiply));
6640
+ blend.screen = blend_f(each(screen));
6641
+ blend.overlay = blend_f(each(overlay));
6642
+ blend.darken = blend_f(each(darken));
6643
+ blend.lighten = blend_f(each(lighten));
6644
+ blend.dodge = blend_f(each(dodge));
6645
+ blend.burn = blend_f(each(burn));
6646
+
6647
+ // cubehelix interpolation
6648
+ // based on D.A. Green "A colour scheme for the display of astronomical intensity images"
6649
+ // http://astron-soc.in/bulletin/11June/289392011.pdf
6650
+ var pow$2 = Math.pow;
6651
+ var sin$1 = Math.sin;
6652
+ var cos$1 = Math.cos;
6653
+
6654
+ function cubehelix (
6655
+ start,
6656
+ rotations,
6657
+ hue,
6658
+ gamma,
6659
+ lightness
6660
+ ) {
6661
+ if ( start === void 0 ) start = 300;
6662
+ if ( rotations === void 0 ) rotations = -1.5;
6663
+ if ( hue === void 0 ) hue = 1;
6664
+ if ( gamma === void 0 ) gamma = 1;
6665
+ if ( lightness === void 0 ) lightness = [0, 1];
6666
+
6667
+ var dh = 0,
6668
+ dl;
6669
+ if (type(lightness) === 'array') {
6670
+ dl = lightness[1] - lightness[0];
6671
+ } else {
6672
+ dl = 0;
6673
+ lightness = [lightness, lightness];
6674
+ }
6675
+ var f = function (fract) {
6676
+ var a = TWOPI * ((start + 120) / 360 + rotations * fract);
6677
+ var l = pow$2(lightness[0] + dl * fract, gamma);
6678
+ var h = dh !== 0 ? hue[0] + fract * dh : hue;
6679
+ var amp = (h * l * (1 - l)) / 2;
6680
+ var cos_a = cos$1(a);
6681
+ var sin_a = sin$1(a);
6682
+ var r = l + amp * (-0.14861 * cos_a + 1.78277 * sin_a);
6683
+ var g = l + amp * (-0.29227 * cos_a - 0.90649 * sin_a);
6684
+ var b = l + amp * (1.97294 * cos_a);
6685
+ return chroma(clip_rgb([r * 255, g * 255, b * 255, 1]));
6686
+ };
6687
+ f.start = function (s) {
6688
+ if (s == null) {
6689
+ return start;
6690
+ }
6691
+ start = s;
6692
+ return f;
6693
+ };
6694
+ f.rotations = function (r) {
6695
+ if (r == null) {
6696
+ return rotations;
6697
+ }
6698
+ rotations = r;
6699
+ return f;
6700
+ };
6701
+ f.gamma = function (g) {
6702
+ if (g == null) {
6703
+ return gamma;
6704
+ }
6705
+ gamma = g;
6706
+ return f;
6707
+ };
6708
+ f.hue = function (h) {
6709
+ if (h == null) {
6710
+ return hue;
6711
+ }
6712
+ hue = h;
6713
+ if (type(hue) === 'array') {
6714
+ dh = hue[1] - hue[0];
6715
+ if (dh === 0) {
6716
+ hue = hue[1];
6717
+ }
6718
+ } else {
6719
+ dh = 0;
6720
+ }
6721
+ return f;
6722
+ };
6723
+ f.lightness = function (h) {
6724
+ if (h == null) {
6725
+ return lightness;
6726
+ }
6727
+ if (type(h) === 'array') {
6728
+ lightness = h;
6729
+ dl = h[1] - h[0];
6730
+ } else {
6731
+ lightness = [h, h];
6732
+ dl = 0;
6733
+ }
6734
+ return f;
6735
+ };
6736
+ f.scale = function () { return chroma.scale(f); };
6737
+ f.hue(hue);
6738
+ return f;
6739
+ }
6740
+
6741
+ var digits = '0123456789abcdef';
6742
+
6743
+ var floor$1 = Math.floor;
6744
+ var random = Math.random;
6745
+
6746
+ /**
6747
+ * Generates a random color.
6748
+ * @param {() => number} rng - A random number generator function.
6749
+ */
6750
+ function random$1 (rng) {
6751
+ if ( rng === void 0 ) rng = random;
6752
+
6753
+ var code = '#';
6754
+ for (var i = 0; i < 6; i++) {
6755
+ code += digits.charAt(floor$1(rng() * 16));
6756
+ }
6757
+ return new Color(code, 'hex');
6758
+ }
6759
+
6760
+ var log = Math.log;
6761
+ var pow$1 = Math.pow;
6762
+ var floor = Math.floor;
6763
+ var abs$1 = Math.abs;
6764
+
6765
+ function analyze(data, key) {
6766
+ if ( key === void 0 ) key = null;
6767
+
6768
+ var r = {
6769
+ min: Number.MAX_VALUE,
6770
+ max: Number.MAX_VALUE * -1,
6771
+ sum: 0,
6772
+ values: [],
6773
+ count: 0
6774
+ };
6775
+ if (type(data) === 'object') {
6776
+ data = Object.values(data);
6777
+ }
6778
+ data.forEach(function (val) {
6779
+ if (key && type(val) === 'object') { val = val[key]; }
6780
+ if (val !== undefined && val !== null && !isNaN(val)) {
6781
+ r.values.push(val);
6782
+ r.sum += val;
6783
+ if (val < r.min) { r.min = val; }
6784
+ if (val > r.max) { r.max = val; }
6785
+ r.count += 1;
6786
+ }
6787
+ });
6788
+
6789
+ r.domain = [r.min, r.max];
6790
+
6791
+ r.limits = function (mode, num) { return limits(r, mode, num); };
6792
+
6793
+ return r;
6794
+ }
6795
+
6796
+ function limits(data, mode, num) {
6797
+ if ( mode === void 0 ) mode = 'equal';
6798
+ if ( num === void 0 ) num = 7;
6799
+
6800
+ if (type(data) == 'array') {
6801
+ data = analyze(data);
6802
+ }
6803
+ var min = data.min;
6804
+ var max = data.max;
6805
+ var values = data.values.sort(function (a, b) { return a - b; });
6806
+
6807
+ if (num === 1) {
6808
+ return [min, max];
6809
+ }
6810
+
6811
+ var limits = [];
6812
+
6813
+ if (mode.substr(0, 1) === 'c') {
6814
+ // continuous
6815
+ limits.push(min);
6816
+ limits.push(max);
6817
+ }
6818
+
6819
+ if (mode.substr(0, 1) === 'e') {
6820
+ // equal interval
6821
+ limits.push(min);
6822
+ for (var i = 1; i < num; i++) {
6823
+ limits.push(min + (i / num) * (max - min));
6824
+ }
6825
+ limits.push(max);
6826
+ } else if (mode.substr(0, 1) === 'l') {
6827
+ // log scale
6828
+ if (min <= 0) {
6829
+ throw new Error(
6830
+ 'Logarithmic scales are only possible for values > 0'
6831
+ );
6832
+ }
6833
+ var min_log = Math.LOG10E * log(min);
6834
+ var max_log = Math.LOG10E * log(max);
6835
+ limits.push(min);
6836
+ for (var i$1 = 1; i$1 < num; i$1++) {
6837
+ limits.push(pow$1(10, min_log + (i$1 / num) * (max_log - min_log)));
6838
+ }
6839
+ limits.push(max);
6840
+ } else if (mode.substr(0, 1) === 'q') {
6841
+ // quantile scale
6842
+ limits.push(min);
6843
+ for (var i$2 = 1; i$2 < num; i$2++) {
6844
+ var p = ((values.length - 1) * i$2) / num;
6845
+ var pb = floor(p);
6846
+ if (pb === p) {
6847
+ limits.push(values[pb]);
6848
+ } else {
6849
+ // p > pb
6850
+ var pr = p - pb;
6851
+ limits.push(values[pb] * (1 - pr) + values[pb + 1] * pr);
6852
+ }
6853
+ }
6854
+ limits.push(max);
6855
+ } else if (mode.substr(0, 1) === 'k') {
6856
+ // k-means clustering
6857
+ /*
6858
+ implementation based on
6859
+ http://code.google.com/p/figue/source/browse/trunk/figue.js#336
6860
+ simplified for 1-d input values
6861
+ */
6862
+ var cluster;
6863
+ var n = values.length;
6864
+ var assignments = new Array(n);
6865
+ var clusterSizes = new Array(num);
6866
+ var repeat = true;
6867
+ var nb_iters = 0;
6868
+ var centroids = null;
6869
+
6870
+ // get seed values
6871
+ centroids = [];
6872
+ centroids.push(min);
6873
+ for (var i$3 = 1; i$3 < num; i$3++) {
6874
+ centroids.push(min + (i$3 / num) * (max - min));
6875
+ }
6876
+ centroids.push(max);
6877
+
6878
+ while (repeat) {
6879
+ // assignment step
6880
+ for (var j = 0; j < num; j++) {
6881
+ clusterSizes[j] = 0;
6882
+ }
6883
+ for (var i$4 = 0; i$4 < n; i$4++) {
6884
+ var value = values[i$4];
6885
+ var mindist = Number.MAX_VALUE;
6886
+ var best = (void 0);
6887
+ for (var j$1 = 0; j$1 < num; j$1++) {
6888
+ var dist = abs$1(centroids[j$1] - value);
6889
+ if (dist < mindist) {
6890
+ mindist = dist;
6891
+ best = j$1;
6892
+ }
6893
+ clusterSizes[best]++;
6894
+ assignments[i$4] = best;
6895
+ }
6896
+ }
6897
+
6898
+ // update centroids step
6899
+ var newCentroids = new Array(num);
6900
+ for (var j$2 = 0; j$2 < num; j$2++) {
6901
+ newCentroids[j$2] = null;
6902
+ }
6903
+ for (var i$5 = 0; i$5 < n; i$5++) {
6904
+ cluster = assignments[i$5];
6905
+ if (newCentroids[cluster] === null) {
6906
+ newCentroids[cluster] = values[i$5];
6907
+ } else {
6908
+ newCentroids[cluster] += values[i$5];
6909
+ }
6910
+ }
6911
+ for (var j$3 = 0; j$3 < num; j$3++) {
6912
+ newCentroids[j$3] *= 1 / clusterSizes[j$3];
6913
+ }
6914
+
6915
+ // check convergence
6916
+ repeat = false;
6917
+ for (var j$4 = 0; j$4 < num; j$4++) {
6918
+ if (newCentroids[j$4] !== centroids[j$4]) {
6919
+ repeat = true;
6920
+ break;
6921
+ }
6922
+ }
6923
+
6924
+ centroids = newCentroids;
6925
+ nb_iters++;
6926
+
6927
+ if (nb_iters > 200) {
6928
+ repeat = false;
6929
+ }
6930
+ }
6931
+
6932
+ // finished k-means clustering
6933
+ // the next part is borrowed from gabrielflor.it
6934
+ var kClusters = {};
6935
+ for (var j$5 = 0; j$5 < num; j$5++) {
6936
+ kClusters[j$5] = [];
6937
+ }
6938
+ for (var i$6 = 0; i$6 < n; i$6++) {
6939
+ cluster = assignments[i$6];
6940
+ kClusters[cluster].push(values[i$6]);
6941
+ }
6942
+ var tmpKMeansBreaks = [];
6943
+ for (var j$6 = 0; j$6 < num; j$6++) {
6944
+ tmpKMeansBreaks.push(kClusters[j$6][0]);
6945
+ tmpKMeansBreaks.push(kClusters[j$6][kClusters[j$6].length - 1]);
6946
+ }
6947
+ tmpKMeansBreaks = tmpKMeansBreaks.sort(function (a, b) { return a - b; });
6948
+ limits.push(tmpKMeansBreaks[0]);
6949
+ for (var i$7 = 1; i$7 < tmpKMeansBreaks.length; i$7 += 2) {
6950
+ var v = tmpKMeansBreaks[i$7];
6951
+ if (!isNaN(v) && limits.indexOf(v) === -1) {
6952
+ limits.push(v);
6953
+ }
6954
+ }
6955
+ }
6956
+ return limits;
6957
+ }
6958
+
6959
+ function contrast (a, b) {
6960
+ // WCAG contrast ratio
6961
+ // see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef
6962
+ a = new Color(a);
6963
+ b = new Color(b);
6964
+ var l1 = a.luminance();
6965
+ var l2 = b.luminance();
6966
+ return l1 > l2 ? (l1 + 0.05) / (l2 + 0.05) : (l2 + 0.05) / (l1 + 0.05);
6967
+ }
6968
+
6969
+ /**
6970
+ * @license
6971
+ *
6972
+ * The APCA contrast prediction algorithm is based of the formulas published
6973
+ * in the APCA-1.0.98G specification by Myndex. The specification is available at:
6974
+ * https://raw.githubusercontent.com/Myndex/apca-w3/master/images/APCAw3_0.1.17_APCA0.0.98G.svg
6975
+ *
6976
+ * Note that the APCA implementation is still beta, so please update to
6977
+ * future versions of chroma.js when they become available.
6978
+ *
6979
+ * You can read more about the APCA Readability Criterion at
6980
+ * https://readtech.org/ARC/
6981
+ */
6982
+
6983
+ // constants
6984
+ var W_offset = 0.027;
6985
+ var P_in = 0.0005;
6986
+ var P_out = 0.1;
6987
+ var R_scale = 1.14;
6988
+ var B_threshold = 0.022;
6989
+ var B_exp = 1.414;
6990
+
6991
+ function contrastAPCA (text, bg) {
6992
+ // parse input colors
6993
+ text = new Color(text);
6994
+ bg = new Color(bg);
6995
+ // if text color has alpha, blend against background
6996
+ if (text.alpha() < 1) {
6997
+ text = mix(bg, text, text.alpha(), 'rgb');
6998
+ }
6999
+ var l_text = lum.apply(void 0, text.rgb());
7000
+ var l_bg = lum.apply(void 0, bg.rgb());
7001
+
7002
+ // soft clamp black levels
7003
+ var Y_text =
7004
+ l_text >= B_threshold
7005
+ ? l_text
7006
+ : l_text + Math.pow(B_threshold - l_text, B_exp);
7007
+ var Y_bg =
7008
+ l_bg >= B_threshold ? l_bg : l_bg + Math.pow(B_threshold - l_bg, B_exp);
7009
+
7010
+ // normal polarity (dark text on light background)
7011
+ var S_norm = Math.pow(Y_bg, 0.56) - Math.pow(Y_text, 0.57);
7012
+ // reverse polarity (light text on dark background)
7013
+ var S_rev = Math.pow(Y_bg, 0.65) - Math.pow(Y_text, 0.62);
7014
+ // clamp noise then scale
7015
+ var C =
7016
+ Math.abs(Y_bg - Y_text) < P_in
7017
+ ? 0
7018
+ : Y_text < Y_bg
7019
+ ? S_norm * R_scale
7020
+ : S_rev * R_scale;
7021
+ // clamp minimum contrast then offset
7022
+ var S_apc = Math.abs(C) < P_out ? 0 : C > 0 ? C - W_offset : C + W_offset;
7023
+ // scale to 100
7024
+ return S_apc * 100;
7025
+ }
7026
+ function lum(r, g, b) {
7027
+ return (
7028
+ 0.2126729 * Math.pow(r / 255, 2.4) +
7029
+ 0.7151522 * Math.pow(g / 255, 2.4) +
7030
+ 0.072175 * Math.pow(b / 255, 2.4)
7031
+ );
7032
+ }
7033
+
7034
+ var sqrt = Math.sqrt;
7035
+ var pow = Math.pow;
7036
+ var min = Math.min;
7037
+ var max = Math.max;
7038
+ var atan2 = Math.atan2;
7039
+ var abs = Math.abs;
7040
+ var cos = Math.cos;
7041
+ var sin = Math.sin;
7042
+ var exp = Math.exp;
7043
+ var PI = Math.PI;
7044
+
7045
+ function deltaE (a, b, Kl, Kc, Kh) {
7046
+ if ( Kl === void 0 ) Kl = 1;
7047
+ if ( Kc === void 0 ) Kc = 1;
7048
+ if ( Kh === void 0 ) Kh = 1;
7049
+
7050
+ // Delta E (CIE 2000)
7051
+ // see http://www.brucelindbloom.com/index.html?Eqn_DeltaE_CIE2000.html
7052
+ var rad2deg = function (rad) {
7053
+ return (360 * rad) / (2 * PI);
7054
+ };
7055
+ var deg2rad = function (deg) {
7056
+ return (2 * PI * deg) / 360;
7057
+ };
7058
+ a = new Color(a);
7059
+ b = new Color(b);
7060
+ var ref = Array.from(a.lab());
7061
+ var L1 = ref[0];
7062
+ var a1 = ref[1];
7063
+ var b1 = ref[2];
7064
+ var ref$1 = Array.from(b.lab());
7065
+ var L2 = ref$1[0];
7066
+ var a2 = ref$1[1];
7067
+ var b2 = ref$1[2];
7068
+ var avgL = (L1 + L2) / 2;
7069
+ var C1 = sqrt(pow(a1, 2) + pow(b1, 2));
7070
+ var C2 = sqrt(pow(a2, 2) + pow(b2, 2));
7071
+ var avgC = (C1 + C2) / 2;
7072
+ var G = 0.5 * (1 - sqrt(pow(avgC, 7) / (pow(avgC, 7) + pow(25, 7))));
7073
+ var a1p = a1 * (1 + G);
7074
+ var a2p = a2 * (1 + G);
7075
+ var C1p = sqrt(pow(a1p, 2) + pow(b1, 2));
7076
+ var C2p = sqrt(pow(a2p, 2) + pow(b2, 2));
7077
+ var avgCp = (C1p + C2p) / 2;
7078
+ var arctan1 = rad2deg(atan2(b1, a1p));
7079
+ var arctan2 = rad2deg(atan2(b2, a2p));
7080
+ var h1p = arctan1 >= 0 ? arctan1 : arctan1 + 360;
7081
+ var h2p = arctan2 >= 0 ? arctan2 : arctan2 + 360;
7082
+ var avgHp =
7083
+ abs(h1p - h2p) > 180 ? (h1p + h2p + 360) / 2 : (h1p + h2p) / 2;
7084
+ var T =
7085
+ 1 -
7086
+ 0.17 * cos(deg2rad(avgHp - 30)) +
7087
+ 0.24 * cos(deg2rad(2 * avgHp)) +
7088
+ 0.32 * cos(deg2rad(3 * avgHp + 6)) -
7089
+ 0.2 * cos(deg2rad(4 * avgHp - 63));
7090
+ var deltaHp = h2p - h1p;
7091
+ deltaHp =
7092
+ abs(deltaHp) <= 180
7093
+ ? deltaHp
7094
+ : h2p <= h1p
7095
+ ? deltaHp + 360
7096
+ : deltaHp - 360;
7097
+ deltaHp = 2 * sqrt(C1p * C2p) * sin(deg2rad(deltaHp) / 2);
7098
+ var deltaL = L2 - L1;
7099
+ var deltaCp = C2p - C1p;
7100
+ var sl = 1 + (0.015 * pow(avgL - 50, 2)) / sqrt(20 + pow(avgL - 50, 2));
7101
+ var sc = 1 + 0.045 * avgCp;
7102
+ var sh = 1 + 0.015 * avgCp * T;
7103
+ var deltaTheta = 30 * exp(-pow((avgHp - 275) / 25, 2));
7104
+ var Rc = 2 * sqrt(pow(avgCp, 7) / (pow(avgCp, 7) + pow(25, 7)));
7105
+ var Rt = -Rc * sin(2 * deg2rad(deltaTheta));
7106
+ var result = sqrt(
7107
+ pow(deltaL / (Kl * sl), 2) +
7108
+ pow(deltaCp / (Kc * sc), 2) +
7109
+ pow(deltaHp / (Kh * sh), 2) +
7110
+ Rt * (deltaCp / (Kc * sc)) * (deltaHp / (Kh * sh))
7111
+ );
7112
+ return max(0, min(100, result));
7113
+ }
7114
+
7115
+ // simple Euclidean distance
7116
+ function distance (a, b, mode) {
7117
+ if ( mode === void 0 ) mode = 'lab';
7118
+
7119
+ // Delta E (CIE 1976)
7120
+ // see http://www.brucelindbloom.com/index.html?Equations.html
7121
+ a = new Color(a);
7122
+ b = new Color(b);
7123
+ var l1 = a.get(mode);
7124
+ var l2 = b.get(mode);
7125
+ var sum_sq = 0;
7126
+ for (var i in l1) {
7127
+ var d = (l1[i] || 0) - (l2[i] || 0);
7128
+ sum_sq += d * d;
7129
+ }
7130
+ return Math.sqrt(sum_sq);
7131
+ }
7132
+
7133
+ function valid () {
7134
+ var args = [], len = arguments.length;
7135
+ while ( len-- ) args[ len ] = arguments[ len ];
7136
+
7137
+ try {
7138
+ new (Function.prototype.bind.apply( Color, [ null ].concat( args) ));
7139
+ return true;
7140
+ // eslint-disable-next-line
7141
+ } catch (e) {
7142
+ return false;
7143
+ }
7144
+ }
7145
+
7146
+ // some pre-defined color scales:
7147
+
7148
+ var scales = {
7149
+ cool: function cool() {
7150
+ return scale([chroma.hsl(180, 1, 0.9), chroma.hsl(250, 0.7, 0.4)]);
7151
+ },
7152
+ hot: function hot() {
7153
+ return scale(['#000', '#f00', '#ff0', '#fff']).mode(
7154
+ 'rgb'
7155
+ );
7156
+ }
7157
+ };
7158
+
7159
+ /**
7160
+ ColorBrewer colors for chroma.js
7161
+
7162
+ Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and The
7163
+ Pennsylvania State University.
7164
+
7165
+ Licensed under the Apache License, Version 2.0 (the "License");
7166
+ you may not use this file except in compliance with the License.
7167
+ You may obtain a copy of the License at
7168
+ http://www.apache.org/licenses/LICENSE-2.0
7169
+
7170
+ Unless required by applicable law or agreed to in writing, software distributed
7171
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
7172
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
7173
+ specific language governing permissions and limitations under the License.
7174
+ */
7175
+
7176
+ var colorbrewer = {
7177
+ // sequential
7178
+ OrRd: ['#fff7ec', '#fee8c8', '#fdd49e', '#fdbb84', '#fc8d59', '#ef6548', '#d7301f', '#b30000', '#7f0000'],
7179
+ PuBu: ['#fff7fb', '#ece7f2', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#045a8d', '#023858'],
7180
+ BuPu: ['#f7fcfd', '#e0ecf4', '#bfd3e6', '#9ebcda', '#8c96c6', '#8c6bb1', '#88419d', '#810f7c', '#4d004b'],
7181
+ Oranges: ['#fff5eb', '#fee6ce', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#a63603', '#7f2704'],
7182
+ BuGn: ['#f7fcfd', '#e5f5f9', '#ccece6', '#99d8c9', '#66c2a4', '#41ae76', '#238b45', '#006d2c', '#00441b'],
7183
+ YlOrBr: ['#ffffe5', '#fff7bc', '#fee391', '#fec44f', '#fe9929', '#ec7014', '#cc4c02', '#993404', '#662506'],
7184
+ YlGn: ['#ffffe5', '#f7fcb9', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#006837', '#004529'],
7185
+ Reds: ['#fff5f0', '#fee0d2', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#a50f15', '#67000d'],
7186
+ RdPu: ['#fff7f3', '#fde0dd', '#fcc5c0', '#fa9fb5', '#f768a1', '#dd3497', '#ae017e', '#7a0177', '#49006a'],
7187
+ Greens: ['#f7fcf5', '#e5f5e0', '#c7e9c0', '#a1d99b', '#74c476', '#41ab5d', '#238b45', '#006d2c', '#00441b'],
7188
+ YlGnBu: ['#ffffd9', '#edf8b1', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#253494', '#081d58'],
7189
+ Purples: ['#fcfbfd', '#efedf5', '#dadaeb', '#bcbddc', '#9e9ac8', '#807dba', '#6a51a3', '#54278f', '#3f007d'],
7190
+ GnBu: ['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081'],
7191
+ Greys: ['#ffffff', '#f0f0f0', '#d9d9d9', '#bdbdbd', '#969696', '#737373', '#525252', '#252525', '#000000'],
7192
+ YlOrRd: ['#ffffcc', '#ffeda0', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#bd0026', '#800026'],
7193
+ PuRd: ['#f7f4f9', '#e7e1ef', '#d4b9da', '#c994c7', '#df65b0', '#e7298a', '#ce1256', '#980043', '#67001f'],
7194
+ Blues: ['#f7fbff', '#deebf7', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#08519c', '#08306b'],
7195
+ PuBuGn: ['#fff7fb', '#ece2f0', '#d0d1e6', '#a6bddb', '#67a9cf', '#3690c0', '#02818a', '#016c59', '#014636'],
7196
+ Viridis: ['#440154', '#482777', '#3f4a8a', '#31678e', '#26838f', '#1f9d8a', '#6cce5a', '#b6de2b', '#fee825'],
7197
+
7198
+ // diverging
7199
+ Spectral: ['#9e0142', '#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#e6f598', '#abdda4', '#66c2a5', '#3288bd', '#5e4fa2'],
7200
+ RdYlGn: ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850', '#006837'],
7201
+ RdBu: ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#f7f7f7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac', '#053061'],
7202
+ PiYG: ['#8e0152', '#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#f7f7f7', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221', '#276419'],
7203
+ PRGn: ['#40004b', '#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#f7f7f7', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837', '#00441b'],
7204
+ RdYlBu: ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee090', '#ffffbf', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4', '#313695'],
7205
+ BrBG: ['#543005', '#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#f5f5f5', '#c7eae5', '#80cdc1', '#35978f', '#01665e', '#003c30'],
7206
+ RdGy: ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#ffffff', '#e0e0e0', '#bababa', '#878787', '#4d4d4d', '#1a1a1a'],
7207
+ PuOr: ['#7f3b08', '#b35806', '#e08214', '#fdb863', '#fee0b6', '#f7f7f7', '#d8daeb', '#b2abd2', '#8073ac', '#542788', '#2d004b'],
7208
+
7209
+ // qualitative
7210
+ Set2: ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f', '#e5c494', '#b3b3b3'],
7211
+ Accent: ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0', '#f0027f', '#bf5b17', '#666666'],
7212
+ Set1: ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33', '#a65628', '#f781bf', '#999999'],
7213
+ Set3: ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9', '#bc80bd', '#ccebc5', '#ffed6f'],
7214
+ Dark2: ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02', '#a6761d', '#666666'],
7215
+ Paired: ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a', '#ffff99', '#b15928'],
7216
+ Pastel2: ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9', '#fff2ae', '#f1e2cc', '#cccccc'],
7217
+ Pastel1: ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc', '#e5d8bd', '#fddaec', '#f2f2f2']
7218
+ };
7219
+
7220
+ var colorbrewerTypes = Object.keys(colorbrewer);
7221
+ var typeMap = new Map(colorbrewerTypes.map(function (key) { return [key.toLowerCase(), key]; }));
7222
+
7223
+ // use Proxy to allow case-insensitive access to palettes
7224
+ var colorbrewerProxy =
7225
+ typeof Proxy === 'function'
7226
+ ? new Proxy(colorbrewer, {
7227
+ get: function get(target, prop) {
7228
+ var lower = prop.toLowerCase();
7229
+ if (typeMap.has(lower)) {
7230
+ return target[typeMap.get(lower)];
7231
+ }
7232
+ },
7233
+ getOwnPropertyNames: function getOwnPropertyNames() {
7234
+ return Object.getOwnPropertyNames(colorbrewerTypes);
7235
+ }
7236
+ })
7237
+ : colorbrewer;
7238
+
7239
+ // feel free to comment out anything to rollup
7240
+ // a smaller chroma.js bundle
7241
+
7242
+ Object.assign(chroma, {
7243
+ analyze: analyze,
7244
+ average: average,
7245
+ bezier: bezier$1,
7246
+ blend: blend,
7247
+ brewer: colorbrewerProxy,
7248
+ Color: Color,
7249
+ colors: w3cx11,
7250
+ contrast: contrast,
7251
+ contrastAPCA: contrastAPCA,
7252
+ cubehelix: cubehelix,
7253
+ deltaE: deltaE,
7254
+ distance: distance,
7255
+ input: input,
7256
+ interpolate: mix,
7257
+ limits: limits,
7258
+ mix: mix,
7259
+ random: random$1,
7260
+ scale: scale,
7261
+ scales: scales,
7262
+ valid: valid,
7263
+ cmyk: cmyk,
7264
+ css: css,
7265
+ gl: gl,
7266
+ hcg: hcg$1,
7267
+ hex: hex,
7268
+ hsi: hsi$1,
7269
+ hsl: hsl$1,
7270
+ hsv: hsv$1,
7271
+ lab: lab$1,
7272
+ lch: lch$1,
7273
+ hcl: hcl,
7274
+ num: num$1,
7275
+ rgb: rgb$1,
7276
+ temp: temp,
7277
+ kelvin: temp,
7278
+ temperature: temp,
7279
+ oklab: oklab$1,
7280
+ oklch: oklch$1,
7281
+ getLabWhitePoint: getLabWhitePoint,
7282
+ setLabWhitePoint: setLabWhitePoint
7283
+ });
7284
+
7285
+ return chroma;
7286
+
7287
+ }));
7288
+
7289
+
3252
7290
  /***/ },
3253
7291
 
3254
7292
  /***/ "./node_modules/object-assign/index.js"
@@ -5194,12 +9232,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5194
9232
  Object.defineProperty(exports, "__esModule", ({ value: true }));
5195
9233
  exports.VerticalLayoutContext = void 0;
5196
9234
  var jsx_runtime_1 = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js");
5197
- var header1_jpg_1 = __importDefault(__webpack_require__(/*! ../../../assets/header1.jpg */ "./src/assets/header1.jpg"));
5198
- var header2_jpg_1 = __importDefault(__webpack_require__(/*! ../../../assets/header2.jpg */ "./src/assets/header2.jpg"));
5199
- var header3_jpg_1 = __importDefault(__webpack_require__(/*! ../../../assets/header3.jpg */ "./src/assets/header3.jpg"));
5200
- var body_png_1 = __importDefault(__webpack_require__(/*! ../../../assets/body.png */ "./src/assets/body.png"));
5201
- var body3_png_1 = __importDefault(__webpack_require__(/*! ../../../assets/body3.png */ "./src/assets/body3.png"));
5202
- var body2_png_1 = __importDefault(__webpack_require__(/*! ../../../assets/body2.png */ "./src/assets/body2.png"));
5203
9235
  var ts_pattern_1 = __webpack_require__(/*! ts-pattern */ "./node_modules/ts-pattern/dist/index.cjs");
5204
9236
  var react_1 = __webpack_require__(/*! react */ "react");
5205
9237
  var antd_1 = __webpack_require__(/*! antd */ "antd");
@@ -5213,24 +9245,11 @@ var VerticalHeader_1 = __importDefault(__webpack_require__(/*! ./VerticalHeader
5213
9245
  var VerticalContent_1 = __importDefault(__webpack_require__(/*! ./VerticalContent */ "./src/components/layout/VerticalLayout/VerticalContent.tsx"));
5214
9246
  var utils_1 = __webpack_require__(/*! ../utils */ "./src/components/layout/utils.ts");
5215
9247
  var antd_style_1 = __webpack_require__(/*! antd-style */ "antd-style");
5216
- var getThemedBackgroundPicture = function (theme) {
5217
- return (0, ts_pattern_1.match)(theme)
5218
- .with("classic", function () { return header1_jpg_1.default; })
5219
- .with("submarine", function () { return header2_jpg_1.default; })
5220
- .with("mystical", function () { return header3_jpg_1.default; })
5221
- .exhaustive();
5222
- };
5223
- var getThemedContentBackgroundPicture = function (theme) {
5224
- return (0, ts_pattern_1.match)(theme)
5225
- .with("classic", function () { return body_png_1.default; })
5226
- .with("submarine", function () { return body2_png_1.default; })
5227
- .with("mystical", function () { return body3_png_1.default; })
5228
- .exhaustive();
5229
- };
9248
+ var theming_util_1 = __webpack_require__(/*! ../../../utils/theming.util */ "./src/utils/theming.util.ts");
5230
9249
  exports.VerticalLayoutContext = (0, react_1.createContext)(null);
5231
9250
  var VerticalLayout = function (_a) {
5232
9251
  var _b;
5233
- var _c = _a.headerBackgroundProps, _d = _c === void 0 ? {} : _c, _e = _d.headerBackgroundImage, headerBackgroundImage = _e === void 0 ? { type: "theme", theme: "classic" } : _e, _f = _d.headerBackgroundFill, headerBackgroundFill = _f === void 0 ? { type: "theme", theme: "classic" } : _f, props = __rest(_a, ["headerBackgroundProps"]);
9252
+ var _c = _a.headerBackgroundProps, _d = _c === void 0 ? {} : _c, _e = _d.headerBackgroundImage, headerBackgroundImage = _e === void 0 ? { type: "theme", theme: "classic" } : _e, _f = _d.headerBackgroundFill, headerBackgroundFill = _f === void 0 ? { type: "theme", theme: "classic" } : _f, _g = _a.contentBackgroundProps, _h = _g === void 0 ? {} : _g, _j = _h.contentBackgroundFill, contentBackgroundFill = _j === void 0 ? { type: "theme", theme: "classic" } : _j, _k = _h.contentBackgroundImage, contentBackgroundImage = _k === void 0 ? { type: "theme", theme: "classic" } : _k, props = __rest(_a, ["headerBackgroundProps", "contentBackgroundProps"]);
5234
9253
  var defaultTheme = (0, antd_style_1.useTheme)().appTheme; // get the app theme
5235
9254
  // get the first bg color
5236
9255
  var getFirstBackgroundHexColor = function () {
@@ -5319,16 +9338,16 @@ var VerticalLayout = function (_a) {
5319
9338
  })
5320
9339
  .exhaustive();
5321
9340
  };
5322
- var _g = getBackgroundCSS(), css = _g.css, stops = _g.stops;
9341
+ var _l = getBackgroundCSS(), css = _l.css, stops = _l.stops;
5323
9342
  // for each type of header - the way to get background image changes
5324
9343
  var getBackgroundImage = function () {
5325
9344
  return (0, ts_pattern_1.match)(headerBackgroundImage)
5326
9345
  .with({ type: "theme" }, function (_a) {
5327
9346
  var theme = _a.theme;
5328
9347
  if (theme !== "classic") {
5329
- return getThemedBackgroundPicture(theme);
9348
+ return (0, theming_util_1.getThemedBackgroundPicture)(theme);
5330
9349
  }
5331
- return getThemedBackgroundPicture(defaultTheme);
9350
+ return (0, theming_util_1.getThemedBackgroundPicture)(defaultTheme);
5332
9351
  })
5333
9352
  .with({ type: "custom-image" }, function (_a) {
5334
9353
  var src = _a.src;
@@ -5338,13 +9357,13 @@ var VerticalLayout = function (_a) {
5338
9357
  };
5339
9358
  // for each type of header - the way to get background image changes
5340
9359
  var getContentBackgroundImage = function () {
5341
- return (0, ts_pattern_1.match)(headerBackgroundImage)
9360
+ return (0, ts_pattern_1.match)(contentBackgroundImage)
5342
9361
  .with({ type: "theme" }, function (_a) {
5343
9362
  var theme = _a.theme;
5344
9363
  if (theme !== "classic") {
5345
- return getThemedContentBackgroundPicture(theme);
9364
+ return (0, theming_util_1.getThemedContentBackgroundPicture)(theme);
5346
9365
  }
5347
- return getThemedContentBackgroundPicture(defaultTheme);
9366
+ return (0, theming_util_1.getThemedContentBackgroundPicture)(defaultTheme);
5348
9367
  })
5349
9368
  .with({ type: "custom-image" }, function (_a) {
5350
9369
  var src = _a.src;
@@ -5358,6 +9377,14 @@ var VerticalLayout = function (_a) {
5358
9377
  var headerChildren = allChildren.filter(utils_1.isVerticalHeader);
5359
9378
  // get the content children as this needs to be overlapped with the bg
5360
9379
  var contentChildren = allChildren.filter(utils_1.isVerticalContent);
9380
+ // get the layout padding
9381
+ // if there is content children, then increase the padding
9382
+ var getLayoutPadding = function () {
9383
+ if (contentChildren.length > 0) {
9384
+ return "1rem 2rem 3rem 2rem";
9385
+ }
9386
+ return "1rem 2rem 0rem 2rem";
9387
+ };
5361
9388
  return ((0, jsx_runtime_1.jsxs)(exports.VerticalLayoutContext.Provider, { value: {
5362
9389
  mainTextColor: (_b = props.mainTextColor) !== null && _b !== void 0 ? _b : (0, colors_util_1.renderBlackOrWhiteText)(firstBackgroundColor), // by default it will try to render white/black text for content
5363
9390
  accentColor: accentColor,
@@ -5367,9 +9394,9 @@ var VerticalLayout = function (_a) {
5367
9394
  backgroundRepeat: "no-repeat",
5368
9395
  backgroundSize: "cover",
5369
9396
  backgroundPosition: "center",
5370
- }, children: (0, jsx_runtime_1.jsxs)("div", { style: { padding: "1rem 2rem 3rem 2rem" }, children: [(0, jsx_runtime_1.jsxs)(antd_1.Layout.Header, { style: { display: "flex", alignItems: "center" }, children: [(0, jsx_runtime_1.jsx)(defaultLogo_1.default, {}), props.menuProps && ((0, jsx_runtime_1.jsx)(Menu_1.default, __assign({ mode: "horizontal" }, props.menuProps, { style: __assign({ flex: 1, minWidth: 0, fontSize: 16, fontWeight: 700 }, props.menuProps.style) })))] }), headerChildren] }) }), (0, jsx_runtime_1.jsx)(antd_1.Layout.Content, { style: {
9397
+ }, children: (0, jsx_runtime_1.jsxs)("div", { style: { padding: getLayoutPadding() }, children: [(0, jsx_runtime_1.jsxs)(antd_1.Layout.Header, { style: { display: "flex", alignItems: "center" }, children: [(0, jsx_runtime_1.jsx)(defaultLogo_1.default, {}), props.menuProps && ((0, jsx_runtime_1.jsx)(Menu_1.default, __assign({ mode: "horizontal" }, props.menuProps, { style: __assign({ flex: 1, minWidth: 0, fontSize: 16, fontWeight: 700 }, props.menuProps.style) })))] }), headerChildren] }) }), (0, jsx_runtime_1.jsx)(antd_1.Layout.Content, { style: {
5371
9398
  background: "#f3f3f3 url(".concat(getContentBackgroundImage(), ") top left"),
5372
- padding: "2rem",
9399
+ padding: contentChildren && "2rem",
5373
9400
  flex: 1,
5374
9401
  zIndex: 1,
5375
9402
  }, children: contentChildren })] })] }));
@@ -5453,9 +9480,20 @@ var jsx_runtime_1 = __webpack_require__(/*! react/jsx-runtime */ "./node_modules
5453
9480
  var antd_1 = __webpack_require__(/*! antd */ "antd");
5454
9481
  var Typography_1 = __importDefault(__webpack_require__(/*! ../Typography/Typography */ "./src/components/ui/Typography/Typography.tsx"));
5455
9482
  var Space_1 = __importDefault(__webpack_require__(/*! ../Space/Space */ "./src/components/ui/Space/Space.tsx"));
9483
+ var antd_style_1 = __webpack_require__(/*! antd-style */ "antd-style");
5456
9484
  var Avatar = function (_a) {
5457
9485
  var props = __rest(_a, []);
5458
- return ((0, jsx_runtime_1.jsx)(Space_1.default, { size: 0, children: (0, jsx_runtime_1.jsxs)("div", { style: __assign({}, (props.userId && { background: "#ebe8e8", borderRadius: 20 })), children: [(0, jsx_runtime_1.jsx)(antd_1.Avatar, __assign({ style: __assign({ marginRight: props.userId && -3 }, props.style) }, props, { children: props.children })), props.userId && ((0, jsx_runtime_1.jsx)(Typography_1.default.Text, { strong: true, style: { paddingInline: 8 }, children: props.userId.toUpperCase() }))] }) }));
9486
+ var token = (0, antd_style_1.useTheme)();
9487
+ var getBackgroundColor = function () {
9488
+ if (token.appThemeMode === "light") {
9489
+ return "#bbbbbb57";
9490
+ }
9491
+ return "#8e8e8e57";
9492
+ };
9493
+ return ((0, jsx_runtime_1.jsx)(Space_1.default, { size: 0, children: (0, jsx_runtime_1.jsxs)("div", { style: __assign({}, (props.userId && {
9494
+ background: getBackgroundColor(),
9495
+ borderRadius: 20,
9496
+ })), children: [(0, jsx_runtime_1.jsx)(antd_1.Avatar, __assign({ style: __assign({ marginRight: props.userId && -3 }, props.style) }, props, { children: props.children })), props.userId && ((0, jsx_runtime_1.jsx)(Typography_1.default.Text, { strong: true, style: { paddingInline: "10px" }, children: props.userId.toUpperCase() }))] }) }));
5459
9497
  };
5460
9498
  exports["default"] = Avatar;
5461
9499
 
@@ -5590,6 +9628,7 @@ var antd_1 = __webpack_require__(/*! antd */ "antd");
5590
9628
  var VerticalLayout_1 = __webpack_require__(/*! ../../layout/VerticalLayout/VerticalLayout */ "./src/components/layout/VerticalLayout/VerticalLayout.tsx");
5591
9629
  var react_1 = __webpack_require__(/*! react */ "react");
5592
9630
  var defaultTheme_1 = __webpack_require__(/*! ../ConfigProvider/defaultTheme */ "./src/components/ui/ConfigProvider/defaultTheme.ts");
9631
+ var antd_style_1 = __webpack_require__(/*! antd-style */ "antd-style");
5593
9632
  /**
5594
9633
  * A breadcrumb displays the current location within a hierarchy. It allows going back to states higher up in the hierarchy.
5595
9634
  */
@@ -5597,9 +9636,9 @@ var Breadcrumb = function (_a) {
5597
9636
  var props = __rest(_a, []);
5598
9637
  var context = (0, react_1.useContext)(VerticalLayout_1.VerticalLayoutContext); // context to check if its nested - its possible that the user can use the header without the VerticalLayout
5599
9638
  var isNestedInLayout = Boolean(context); // check if nested or not to handle colors
5600
- var useToken = antd_1.theme.useToken;
5601
- var globalToken = useToken(); // get the default, antd tokens
5602
- var defaultTheme = (0, defaultTheme_1.useGetDefaultTheme)(); // get the default, overwritten tokens
9639
+ var globalToken = antd_1.theme.useToken(); // get the default, antd tokens
9640
+ var token = (0, antd_style_1.useTheme)();
9641
+ var defaultTheme = (0, defaultTheme_1.useGetDefaultTheme)(token.appThemeMode); // get the default, overwritten tokens
5603
9642
  return ((0, jsx_runtime_1.jsx)(antd_1.ConfigProvider, { theme: {
5604
9643
  token: __assign(__assign({}, defaultTheme.token), globalToken.token),
5605
9644
  components: {
@@ -5932,11 +9971,14 @@ var ConfigProvider = function (_a) {
5932
9971
  var props = __rest(_a, []);
5933
9972
  var _d = (0, useAcaciaColors_1.useAcaciaColors)(), colors = _d.colors, generate = _d.generate;
5934
9973
  var _e = (0, useAcaciaConfig_1.useAcaciaConfig)(), borderRadius = _e.borderRadius, padding = _e.padding;
5935
- var defaultTheme = (0, defaultTheme_1.useGetDefaultTheme)();
5936
9974
  var mergedToken = __assign(__assign({}, customTheme_1.CustomTheme), props.customToken);
9975
+ var defaultTheme = (0, defaultTheme_1.useGetDefaultTheme)(mergedToken.appThemeMode);
5937
9976
  return ((0, jsx_runtime_1.jsx)(antd_style_1.ThemeProvider, { customToken: mergedToken, children: (0, jsx_runtime_1.jsx)(antd_1.ConfigProvider, __assign({}, props, { theme: {
5938
9977
  token: __assign(__assign({}, defaultTheme.token), (_b = props.theme) === null || _b === void 0 ? void 0 : _b.token),
5939
9978
  components: __assign(__assign({}, defaultTheme.components), (_c = props.theme) === null || _c === void 0 ? void 0 : _c.components),
9979
+ algorithm: mergedToken.appThemeMode === "light"
9980
+ ? antd_1.theme.defaultAlgorithm
9981
+ : antd_1.theme.darkAlgorithm,
5940
9982
  }, children: props.children })) }));
5941
9983
  };
5942
9984
  ConfigProvider.ConfigContext = context_1.ConfigContext;
@@ -5964,15 +10006,15 @@ __webpack_require__(/*! @fontsource-variable/inter */ "./node_modules/@fontsourc
5964
10006
  __webpack_require__(/*! @fontsource-variable/outfit */ "./node_modules/@fontsource-variable/outfit/index.css");
5965
10007
  __webpack_require__(/*! @fontsource-variable/roboto-flex */ "./node_modules/@fontsource-variable/roboto-flex/index.css");
5966
10008
  // classic theme
5967
- function useGetDefaultTheme() {
10009
+ function useGetDefaultTheme(appThemeMode) {
5968
10010
  var colors = (0, useAcaciaColors_1.useAcaciaColors)().colors;
5969
10011
  var _a = (0, useAcaciaConfig_1.useAcaciaConfig)(), borderRadius = _a.borderRadius, padding = _a.padding;
5970
10012
  return (0, react_1.useMemo)(function () {
5971
10013
  return {
5972
10014
  token: {
5973
10015
  colorPrimary: "#427e7b", // your custom default
5974
- colorText: "#080808",
5975
- colorTextTertiary: "#757C7C",
10016
+ colorText: appThemeMode === "light" ? "#080808" : "#eaeaea",
10017
+ colorTextTertiary: appThemeMode === "light" ? "#757C7C" : "#cecece",
5976
10018
  fontFamily: "'Inter Variable', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
5977
10019
  borderRadius: borderRadius.primary,
5978
10020
  borderRadiusLG: borderRadius.primary,
@@ -6564,7 +10606,6 @@ var react_1 = __webpack_require__(/*! react */ "react");
6564
10606
  var VerticalLayout_1 = __webpack_require__(/*! ../../layout/VerticalLayout/VerticalLayout */ "./src/components/layout/VerticalLayout/VerticalLayout.tsx");
6565
10607
  var defaultTheme_1 = __webpack_require__(/*! ../ConfigProvider/defaultTheme */ "./src/components/ui/ConfigProvider/defaultTheme.ts");
6566
10608
  var colorize_1 = __webpack_require__(/*! @mirawision/colorize */ "./node_modules/@mirawision/colorize/index.js");
6567
- var ts_pattern_1 = __webpack_require__(/*! ts-pattern */ "./node_modules/ts-pattern/dist/index.cjs");
6568
10609
  var colors_util_1 = __webpack_require__(/*! ../../../utils/colors.util */ "./src/utils/colors.util.ts");
6569
10610
  var antd_style_1 = __webpack_require__(/*! antd-style */ "antd-style");
6570
10611
  var useStyle = (0, antd_style_1.createStyles)(function (_a) {
@@ -6577,19 +10618,9 @@ var Menu = function (_a) {
6577
10618
  var _b = _a.showRightBorder, showRightBorder = _b === void 0 ? true : _b, props = __rest(_a, ["showRightBorder"]);
6578
10619
  var context = (0, react_1.useContext)(VerticalLayout_1.VerticalLayoutContext); // context to check if its nested - its possible that the user can use the header without the VerticalLayout
6579
10620
  var isNestedInLayout = Boolean(context); // check if nested or not to handle colors
6580
- var useToken = antd_1.theme.useToken;
6581
- var globalToken = useToken(); // get the default, antd tokens
10621
+ var globalToken = antd_1.theme.useToken(); // get the default, antd tokens
6582
10622
  var menuStyles = useStyle().styles;
6583
- var editOpacity = function (type, color) {
6584
- return (0, ts_pattern_1.match)(type)
6585
- .with("hex", function () {
6586
- return (0, colors_util_1.hexToRGBA)(color, 30);
6587
- })
6588
- .with("rgba", function () {
6589
- return (0, colorize_1.changeOpacity)(color, 0.3);
6590
- })
6591
- .exhaustive();
6592
- };
10623
+ var token = (0, antd_style_1.useTheme)();
6593
10624
  var selectedItemColor = (0, react_1.useMemo)(function () {
6594
10625
  if (isNestedInLayout) {
6595
10626
  var blended = (0, colorize_1.blendMultipleColors)(context.gradients.map(function (item) {
@@ -6602,12 +10633,12 @@ var Menu = function (_a) {
6602
10633
  return {
6603
10634
  menuColor: context === null || context === void 0 ? void 0 : context.accentColor,
6604
10635
  menuBgColor: (0, colorize_1.isValidHEXColor)(color)
6605
- ? editOpacity("hex", color)
6606
- : editOpacity("rgba", color),
10636
+ ? (0, colors_util_1.editOpacity)("hex", color)
10637
+ : (0, colors_util_1.editOpacity)("rgba", color),
6607
10638
  };
6608
10639
  }
6609
10640
  }, [context === null || context === void 0 ? void 0 : context.accentColor, isNestedInLayout]);
6610
- var defaultTheme = (0, defaultTheme_1.useGetDefaultTheme)(); // get the default, overwritten tokens
10641
+ var defaultTheme = (0, defaultTheme_1.useGetDefaultTheme)(token.appThemeMode); // get the default, overwritten tokens
6611
10642
  return ((0, jsx_runtime_1.jsx)(antd_1.ConfigProvider, { theme: {
6612
10643
  token: __assign(__assign({}, defaultTheme.token), globalToken.token),
6613
10644
  components: {
@@ -6647,6 +10678,106 @@ exports["default"] = Menu;
6647
10678
  var templateObject_1;
6648
10679
 
6649
10680
 
10681
+ /***/ },
10682
+
10683
+ /***/ "./src/components/ui/Modal/Modal.tsx"
10684
+ /*!*******************************************!*\
10685
+ !*** ./src/components/ui/Modal/Modal.tsx ***!
10686
+ \*******************************************/
10687
+ (__unused_webpack_module, exports, __webpack_require__) {
10688
+
10689
+ "use strict";
10690
+
10691
+ var __assign = (this && this.__assign) || function () {
10692
+ __assign = Object.assign || function(t) {
10693
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
10694
+ s = arguments[i];
10695
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10696
+ t[p] = s[p];
10697
+ }
10698
+ return t;
10699
+ };
10700
+ return __assign.apply(this, arguments);
10701
+ };
10702
+ var __rest = (this && this.__rest) || function (s, e) {
10703
+ var t = {};
10704
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
10705
+ t[p] = s[p];
10706
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
10707
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
10708
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
10709
+ t[p[i]] = s[p[i]];
10710
+ }
10711
+ return t;
10712
+ };
10713
+ var __importDefault = (this && this.__importDefault) || function (mod) {
10714
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10715
+ };
10716
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
10717
+ var jsx_runtime_1 = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js");
10718
+ /**
10719
+ * @description A long list can be divided into several pages using Pagination, and only one page will be loaded at a time.
10720
+ */
10721
+ var antd_1 = __webpack_require__(/*! antd */ "antd");
10722
+ var antd_style_1 = __webpack_require__(/*! antd-style */ "antd-style");
10723
+ var theming_util_1 = __webpack_require__(/*! ../../../utils/theming.util */ "./src/utils/theming.util.ts");
10724
+ var chroma_js_1 = __importDefault(__webpack_require__(/*! chroma-js */ "./node_modules/chroma-js/dist/chroma.cjs"));
10725
+ var Typography_1 = __importDefault(__webpack_require__(/*! ../Typography/Typography */ "./src/components/ui/Typography/Typography.tsx"));
10726
+ var Space_1 = __importDefault(__webpack_require__(/*! ../Space/Space */ "./src/components/ui/Space/Space.tsx"));
10727
+ var ts_pattern_1 = __webpack_require__(/*! ts-pattern */ "./node_modules/ts-pattern/dist/index.cjs");
10728
+ var Modal = function (_a) {
10729
+ var title = _a.title, subtitle = _a.subtitle, _b = _a.headerBgTheme, headerBgTheme = _b === void 0 ? "classic" : _b, _c = _a.iconPosition, iconPosition = _c === void 0 ? "start" : _c, props = __rest(_a, ["title", "subtitle", "headerBgTheme", "iconPosition"]);
10730
+ var useToken = antd_1.theme.useToken;
10731
+ var defaultTheme = (0, antd_style_1.useTheme)().appTheme; // get the app theme
10732
+ // get the header background theme - check global config and scoped config
10733
+ var getHeaderBackgroundTheme = function () {
10734
+ if (headerBgTheme !== "classic") {
10735
+ return (0, theming_util_1.getThemedTitleHeaderBackgroundPicture)(headerBgTheme);
10736
+ }
10737
+ return (0, theming_util_1.getThemedTitleHeaderBackgroundPicture)(defaultTheme);
10738
+ };
10739
+ var getLinearGradient = function (firstColor, secondColor) {
10740
+ return "linear-gradient(70deg, ".concat(firstColor, "CC 80%, ").concat(secondColor, "69 80%), url(").concat(getHeaderBackgroundTheme(), ")");
10741
+ };
10742
+ // account for dark mode
10743
+ var getHeaderBgGradient = function () {
10744
+ var darkerColor = chroma_js_1.default
10745
+ .scale([useToken().token.colorPrimary, "black"])(0.2)
10746
+ .hex();
10747
+ return (0, ts_pattern_1.match)((0, antd_style_1.useTheme)().appThemeMode)
10748
+ .with("light", function () {
10749
+ var lighterColor = chroma_js_1.default
10750
+ .scale([useToken().token.colorPrimary, "white"])(0.7)
10751
+ .hex();
10752
+ return getLinearGradient(lighterColor, darkerColor);
10753
+ })
10754
+ .with("dark", function () {
10755
+ var darkestColor = chroma_js_1.default
10756
+ .scale([useToken().token.colorPrimary, "black"])(0.7)
10757
+ .hex();
10758
+ return getLinearGradient(darkerColor, darkestColor);
10759
+ })
10760
+ .exhaustive();
10761
+ };
10762
+ return ((0, jsx_runtime_1.jsx)(antd_1.Modal, __assign({ styles: {
10763
+ container: {
10764
+ padding: 0,
10765
+ },
10766
+ header: {
10767
+ background: getHeaderBgGradient(),
10768
+ padding: "15px 24px",
10769
+ },
10770
+ body: {
10771
+ padding: "0px 24px",
10772
+ },
10773
+ footer: {
10774
+ padding: "0px 24px 15px 24px",
10775
+ },
10776
+ }, title: (0, jsx_runtime_1.jsxs)(Space_1.default, { orientation: "vertical", size: 0, children: [(0, jsx_runtime_1.jsxs)(Space_1.default, { orientation: "horizontal", children: [iconPosition === "start" && props.icon, title, iconPosition === "end" && props.icon] }), (0, jsx_runtime_1.jsx)(Typography_1.default.Overline, { children: subtitle })] }) }, props)));
10777
+ };
10778
+ exports["default"] = Modal;
10779
+
10780
+
6650
10781
  /***/ },
6651
10782
 
6652
10783
  /***/ "./src/components/ui/Pagination/Pagination.tsx"
@@ -6688,18 +10819,22 @@ var antd_1 = __webpack_require__(/*! antd */ "antd");
6688
10819
  var defaultTheme_1 = __webpack_require__(/*! ../ConfigProvider/defaultTheme */ "./src/components/ui/ConfigProvider/defaultTheme.ts");
6689
10820
  var colors_util_1 = __webpack_require__(/*! ../../../utils/colors.util */ "./src/utils/colors.util.ts");
6690
10821
  var colorize_1 = __webpack_require__(/*! @mirawision/colorize */ "./node_modules/@mirawision/colorize/index.js");
10822
+ var antd_style_1 = __webpack_require__(/*! antd-style */ "antd-style");
6691
10823
  var Pagination = function (_a) {
6692
10824
  var _b = _a.selectedStyle, selectedStyle = _b === void 0 ? "solid" : _b, props = __rest(_a, ["selectedStyle"]);
6693
10825
  var useToken = antd_1.theme.useToken;
6694
10826
  var globalToken = useToken(); // get the default, antd tokens
6695
- var defaultTheme = (0, defaultTheme_1.useGetDefaultTheme)(); // get the default, overwritten tokens
10827
+ var token = (0, antd_style_1.useTheme)();
10828
+ var defaultTheme = (0, defaultTheme_1.useGetDefaultTheme)(token.appThemeMode); // get the default, overwritten tokens
6696
10829
  return ((0, jsx_runtime_1.jsx)(antd_1.ConfigProvider, { theme: {
6697
10830
  token: __assign(__assign({}, defaultTheme.token), globalToken.token),
6698
10831
  components: {
6699
10832
  Pagination: __assign(__assign({}, defaultTheme.components.Pagination), (selectedStyle === "solid"
6700
10833
  ? {
6701
10834
  itemActiveBg: globalToken.token.colorPrimary,
6702
- itemActiveColor: (0, colors_util_1.renderBlackOrWhiteText)(globalToken.token.colorPrimary),
10835
+ itemActiveColor: token.appThemeMode === "light"
10836
+ ? (0, colors_util_1.renderBlackOrWhiteText)(globalToken.token.colorPrimary)
10837
+ : "white",
6703
10838
  itemActiveColorHover: (0, colorize_1.tint)((0, colors_util_1.renderBlackOrWhiteText)(globalToken.token.colorPrimary), 0.3),
6704
10839
  }
6705
10840
  : {})),
@@ -6749,10 +10884,39 @@ exports["default"] = Panel;
6749
10884
  var jsx_runtime_1 = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js");
6750
10885
  var Space_1 = __importDefault(__webpack_require__(/*! ../Space/Space */ "./src/components/ui/Space/Space.tsx"));
6751
10886
  var usePanelStyles_1 = __webpack_require__(/*! ./usePanelStyles */ "./src/components/ui/Panel/usePanelStyles.tsx");
10887
+ var react_1 = __webpack_require__(/*! react */ "react");
10888
+ var VerticalLayout_1 = __webpack_require__(/*! ../../layout/VerticalLayout/VerticalLayout */ "./src/components/layout/VerticalLayout/VerticalLayout.tsx");
10889
+ var colorize_1 = __webpack_require__(/*! @mirawision/colorize */ "./node_modules/@mirawision/colorize/index.js");
10890
+ var colors_util_1 = __webpack_require__(/*! ../../../utils/colors.util */ "./src/utils/colors.util.ts");
6752
10891
  function Panel(_a) {
6753
10892
  var _b, _c, _d, _e, _f, _g, _h, _j;
6754
10893
  var _k = _a.position, position = _k === void 0 ? "left" : _k, props = __rest(_a, ["position"]);
6755
- var _l = (0, usePanelStyles_1.usePanelStyles)(), styles = _l.styles, cx = _l.cx;
10894
+ var context = (0, react_1.useContext)(VerticalLayout_1.VerticalLayoutContext); // context to check if its nested - its possible that the user can use the header without the VerticalLayout
10895
+ var isNestedInLayout = Boolean(context); // check if nested or not to handle colors
10896
+ var selectedItemColor = (0, react_1.useMemo)(function () {
10897
+ if (isNestedInLayout) {
10898
+ var blended = (0, colorize_1.blendMultipleColors)(context.gradients.map(function (item) {
10899
+ return {
10900
+ color: item,
10901
+ weight: 1,
10902
+ };
10903
+ }));
10904
+ var color = (0, colorize_1.shade)(blended, 0.5);
10905
+ return {
10906
+ menuColor: context === null || context === void 0 ? void 0 : context.accentColor,
10907
+ menuBgColor: (0, colorize_1.isValidHEXColor)(color)
10908
+ ? (0, colors_util_1.editOpacity)("hex", color)
10909
+ : (0, colors_util_1.editOpacity)("rgba", color),
10910
+ };
10911
+ }
10912
+ return {
10913
+ menuColor: null,
10914
+ menuBgColor: null,
10915
+ };
10916
+ }, [context === null || context === void 0 ? void 0 : context.accentColor, isNestedInLayout]);
10917
+ var _l = (0, usePanelStyles_1.usePanelStyles)({
10918
+ color: selectedItemColor.menuBgColor,
10919
+ }), styles = _l.styles, cx = _l.cx;
6756
10920
  return ((0, jsx_runtime_1.jsx)("div", { className: cx(position !== "none" && styles.outerPanel, position === "left" && styles.outerPanelLeft, position === "right" && styles.outerPanelRight, (_b = props === null || props === void 0 ? void 0 : props.classNames) === null || _b === void 0 ? void 0 : _b.outerContainerClassName), style: __assign({}, (_c = props === null || props === void 0 ? void 0 : props.styles) === null || _c === void 0 ? void 0 : _c.outerContainerStyles), children: (0, jsx_runtime_1.jsxs)("div", { className: cx(styles.panelBase, (_d = props === null || props === void 0 ? void 0 : props.classNames) === null || _d === void 0 ? void 0 : _d.panelBaseClassName), style: __assign({}, (_e = props === null || props === void 0 ? void 0 : props.styles) === null || _e === void 0 ? void 0 : _e.panelBaseStyles), children: [(0, jsx_runtime_1.jsx)("div", { className: cx(styles.panelBody, (_f = props === null || props === void 0 ? void 0 : props.classNames) === null || _f === void 0 ? void 0 : _f.panelBodyClassName), style: __assign({}, (_g = props === null || props === void 0 ? void 0 : props.styles) === null || _g === void 0 ? void 0 : _g.panelBodyStyles), children: (0, jsx_runtime_1.jsx)(Space_1.default, { orientation: "vertical", children: props.children }) }), props.footer && ((0, jsx_runtime_1.jsx)("div", { className: cx(styles.panelFooter, (_h = props === null || props === void 0 ? void 0 : props.classNames) === null || _h === void 0 ? void 0 : _h.panelFooterClassName), style: __assign({}, (_j = props === null || props === void 0 ? void 0 : props.styles) === null || _j === void 0 ? void 0 : _j.panelFooterStyles), children: props.footer }))] }) }));
6757
10921
  }
6758
10922
 
@@ -6774,9 +10938,10 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
6774
10938
  Object.defineProperty(exports, "__esModule", ({ value: true }));
6775
10939
  exports.usePanelStyles = void 0;
6776
10940
  var antd_style_1 = __webpack_require__(/*! antd-style */ "antd-style");
6777
- exports.usePanelStyles = (0, antd_style_1.createStyles)(function (_a) {
10941
+ exports.usePanelStyles = (0, antd_style_1.createStyles)(function (_a, props) {
10942
+ var _b;
6778
10943
  var css = _a.css;
6779
- var outerPanelBase = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n z-index: 2;\n &::before {\n content: \"\";\n position: absolute;\n width: 80%;\n height: 12px;\n top: -7px;\n z-index: -1;\n border-radius: 3px 6px 6px 0;\n background: #9cafb7;\n }\n "], ["\n position: relative;\n z-index: 2;\n &::before {\n content: \"\";\n position: absolute;\n width: 80%;\n height: 12px;\n top: -7px;\n z-index: -1;\n border-radius: 3px 6px 6px 0;\n background: #9cafb7;\n }\n "])));
10944
+ var outerPanelBase = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n z-index: 2;\n &::before {\n content: \"\";\n position: absolute;\n width: 80%;\n height: 12px;\n top: -7px;\n z-index: -1;\n border-radius: 3px 6px 6px 0;\n background: ", "; \n }\n "], ["\n position: relative;\n z-index: 2;\n &::before {\n content: \"\";\n position: absolute;\n width: 80%;\n height: 12px;\n top: -7px;\n z-index: -1;\n border-radius: 3px 6px 6px 0;\n background: ", "; \n }\n "])), (_b = props.color) !== null && _b !== void 0 ? _b : "#9cafb7");
6780
10945
  var panelBase = css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border-radius: 3px;\n background: #EFF3F3;\n box-shadow: rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px;\n "], ["\n border-radius: 3px;\n background: #EFF3F3;\n box-shadow: rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px;\n "])));
6781
10946
  var panelBody = css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding: 1rem; \n "], ["\n padding: 1rem; \n "])));
6782
10947
  var panelFooter = css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n background: #e2e7e8;\n border-top: 1px solid #dadada;\n "], ["\n background: #e2e7e8;\n border-top: 1px solid #dadada;\n "])));
@@ -6792,6 +10957,78 @@ exports.usePanelStyles = (0, antd_style_1.createStyles)(function (_a) {
6792
10957
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
6793
10958
 
6794
10959
 
10960
+ /***/ },
10961
+
10962
+ /***/ "./src/components/ui/Popconfirm/Popconfirm.tsx"
10963
+ /*!*****************************************************!*\
10964
+ !*** ./src/components/ui/Popconfirm/Popconfirm.tsx ***!
10965
+ \*****************************************************/
10966
+ (__unused_webpack_module, exports, __webpack_require__) {
10967
+
10968
+ "use strict";
10969
+
10970
+ var __assign = (this && this.__assign) || function () {
10971
+ __assign = Object.assign || function(t) {
10972
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
10973
+ s = arguments[i];
10974
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10975
+ t[p] = s[p];
10976
+ }
10977
+ return t;
10978
+ };
10979
+ return __assign.apply(this, arguments);
10980
+ };
10981
+ var __rest = (this && this.__rest) || function (s, e) {
10982
+ var t = {};
10983
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
10984
+ t[p] = s[p];
10985
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
10986
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
10987
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
10988
+ t[p[i]] = s[p[i]];
10989
+ }
10990
+ return t;
10991
+ };
10992
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
10993
+ var jsx_runtime_1 = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js");
10994
+ var antd_style_1 = __webpack_require__(/*! antd-style */ "antd-style");
10995
+ var antd_1 = __webpack_require__(/*! antd */ "antd");
10996
+ var defaultTheme_1 = __webpack_require__(/*! ../ConfigProvider/defaultTheme */ "./src/components/ui/ConfigProvider/defaultTheme.ts");
10997
+ var Popconfirm = function (_a) {
10998
+ var props = __rest(_a, []);
10999
+ var token = (0, antd_style_1.useTheme)();
11000
+ var defaultTheme = (0, defaultTheme_1.useGetDefaultTheme)(token.appThemeMode); // get the default, overwritten tokens
11001
+ var globalToken = antd_1.theme.useToken(); // get the default, antd tokens
11002
+ return ((0, jsx_runtime_1.jsx)(antd_1.ConfigProvider, { theme: {
11003
+ token: __assign(__assign({}, defaultTheme.token), globalToken.token),
11004
+ components: {
11005
+ Popconfirm: {
11006
+ colorBgElevated: token.darkPopover && "#161616c4",
11007
+ },
11008
+ },
11009
+ }, children: (0, jsx_runtime_1.jsx)(antd_1.Popconfirm, __assign({ cancelButtonProps: {
11010
+ type: "text",
11011
+ styles: {
11012
+ content: {
11013
+ color: token.darkPopover && (0, defaultTheme_1.useGetDefaultTheme)("dark").token.colorText,
11014
+ },
11015
+ },
11016
+ } }, props, { styles: {
11017
+ container: {
11018
+ backgroundColor: token.darkPopover && "#161616c4",
11019
+ backdropFilter: token.darkPopover && "blur(3px)",
11020
+ },
11021
+ title: {
11022
+ color: token.darkPopover && (0, defaultTheme_1.useGetDefaultTheme)("dark").token.colorText,
11023
+ },
11024
+ content: {
11025
+ color: token.darkPopover && (0, defaultTheme_1.useGetDefaultTheme)("dark").token.colorText,
11026
+ },
11027
+ } })) }));
11028
+ };
11029
+ exports["default"] = Popconfirm;
11030
+
11031
+
6795
11032
  /***/ },
6796
11033
 
6797
11034
  /***/ "./src/components/ui/Radio/Button.tsx"
@@ -7150,13 +11387,15 @@ var colorize_1 = __webpack_require__(/*! @mirawision/colorize */ "./node_modules
7150
11387
  var react_1 = __webpack_require__(/*! react */ "react");
7151
11388
  var VerticalLayout_1 = __webpack_require__(/*! ../../layout/VerticalLayout/VerticalLayout */ "./src/components/layout/VerticalLayout/VerticalLayout.tsx");
7152
11389
  var defaultTheme_1 = __webpack_require__(/*! ../ConfigProvider/defaultTheme */ "./src/components/ui/ConfigProvider/defaultTheme.ts");
11390
+ var antd_style_1 = __webpack_require__(/*! antd-style */ "antd-style");
7153
11391
  function Tabs(_a) {
7154
11392
  var _b = _a.type, type = _b === void 0 ? "line" : _b, props = __rest(_a, ["type"]);
7155
11393
  var context = (0, react_1.useContext)(VerticalLayout_1.VerticalLayoutContext);
7156
11394
  var isNestedInLayout = Boolean(context); // for when tabs are nested in Layout
7157
11395
  var useToken = antd_1.theme.useToken;
7158
11396
  var globalToken = useToken(); // get the default, antd tokens
7159
- var defaultTheme = (0, defaultTheme_1.useGetDefaultTheme)(); // get the default, overwritten tokens
11397
+ var token = (0, antd_style_1.useTheme)();
11398
+ var defaultTheme = (0, defaultTheme_1.useGetDefaultTheme)(token.appThemeMode); // get the default, overwritten tokens
7160
11399
  return ((0, jsx_runtime_1.jsx)(antd_1.ConfigProvider, { theme: {
7161
11400
  token: __assign(__assign(__assign({}, defaultTheme.token), globalToken.token), (isNestedInLayout
7162
11401
  ? {
@@ -7352,11 +11591,15 @@ var __rest = (this && this.__rest) || function (s, e) {
7352
11591
  }
7353
11592
  return t;
7354
11593
  };
11594
+ var __importDefault = (this && this.__importDefault) || function (mod) {
11595
+ return (mod && mod.__esModule) ? mod : { "default": mod };
11596
+ };
7355
11597
  Object.defineProperty(exports, "__esModule", ({ value: true }));
7356
11598
  var jsx_runtime_1 = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js");
7357
11599
  var antd_1 = __webpack_require__(/*! antd */ "antd");
7358
11600
  var useTypographyStyles_1 = __webpack_require__(/*! ./useTypographyStyles */ "./src/components/ui/Typography/useTypographyStyles.ts");
7359
11601
  var typographyUtil_1 = __webpack_require__(/*! ../../../theme/typographyUtil */ "./src/theme/typographyUtil.ts");
11602
+ var Space_1 = __importDefault(__webpack_require__(/*! ../Space/Space */ "./src/components/ui/Space/Space.tsx"));
7360
11603
  var TypographyToken = {
7361
11604
  fontSizeHeading1: typographyUtil_1.typographyUtil.fontSize.h1,
7362
11605
  fontSizeHeading2: typographyUtil_1.typographyUtil.fontSize.h2,
@@ -7366,34 +11609,39 @@ var TypographyToken = {
7366
11609
  fontWeightStrong: 600,
7367
11610
  };
7368
11611
  var Title = function (_a) {
7369
- var children = _a.children, _b = _a.level, level = _b === void 0 ? 1 : _b, color = _a.color, antdProps = __rest(_a, ["children", "level", "color"]);
11612
+ var children = _a.children, _b = _a.level, level = _b === void 0 ? 1 : _b, color = _a.color, _c = _a.showPointer, showPointer = _c === void 0 ? true : _c, _d = _a.iconPosition, iconPosition = _d === void 0 ? "start" : _d, props = __rest(_a, ["children", "level", "color", "showPointer", "iconPosition"]);
7370
11613
  var typoStyles = (0, useTypographyStyles_1.useTypographyStyles)(color).styles;
7371
- return ((0, jsx_runtime_1.jsx)(antd_1.Typography.Title, __assign({ className: "\n\t\t\t\t\t".concat(typoStyles.common, "\n\t\t\t\t\t").concat(typoStyles.title, "\n\t\t\t\t\t").concat(typoStyles["titleH".concat(level)], "\n\t\t\t\t"), level: level }, antdProps, { children: children })));
11614
+ return ((0, jsx_runtime_1.jsxs)(Space_1.default, { orientation: "horizontal", children: [iconPosition === "start" && props.icon, (0, jsx_runtime_1.jsx)(antd_1.Typography.Title, __assign({ className: "\n\t\t\t\t\t".concat(typoStyles.common, "\n\t\t\t\t\t").concat(typoStyles.title, "\n\t\t\t\t\t").concat(typoStyles["titleH".concat(level)], "\n\t\t\t\t\t").concat(showPointer ? "pointer" : "", "\n\t\t\t\t"), level: level }, props, { children: children })), iconPosition === "end" && props.icon] }));
7372
11615
  };
7373
11616
  var Text = function (_a) {
7374
- var children = _a.children, _b = _a.level, level = _b === void 0 ? 2 : _b, color = _a.color, antdProps = __rest(_a, ["children", "level", "color"]);
11617
+ var children = _a.children, _b = _a.level, level = _b === void 0 ? 1 : _b, color = _a.color, antdProps = __rest(_a, ["children", "level", "color"]);
7375
11618
  var typoStyles = (0, useTypographyStyles_1.useTypographyStyles)(color).styles;
7376
11619
  return ((0, jsx_runtime_1.jsx)(antd_1.Typography.Text, __assign({ className: "\n\t\t\t\t".concat(typoStyles.common, "\n\t\t\t\t").concat(typoStyles.text, " \n\t\t\t\t").concat(typoStyles["textBody".concat(level)], "\n\t\t\t") }, antdProps, { children: children })));
7377
11620
  };
7378
11621
  var Emphasis = function (_a) {
7379
11622
  var children = _a.children, color = _a.color, props = __rest(_a, ["children", "color"]);
7380
11623
  var typoStyles = (0, useTypographyStyles_1.useTypographyStyles)(color).styles;
7381
- return ((0, jsx_runtime_1.jsx)(Text, __assign({ className: "\n\t\t\t\t".concat(typoStyles.common, "\n\t\t\t\t").concat(typoStyles.emphasis, " \n\t\t\t"), color: color }, props, { children: children })));
11624
+ return ((0, jsx_runtime_1.jsx)(Text, __assign({ className: "\n\t\t\t\t".concat(typoStyles.common, "\n\t\t\t\t").concat(typoStyles.emphasis, "\n\t\t\t"), color: color }, props, { children: children })));
7382
11625
  };
7383
11626
  var Caption = function (_a) {
7384
11627
  var children = _a.children, color = _a.color, antdProps = __rest(_a, ["children", "color"]);
7385
11628
  var typoStyles = (0, useTypographyStyles_1.useTypographyStyles)(color).styles;
7386
- return ((0, jsx_runtime_1.jsx)(antd_1.Typography.Text, __assign({ className: "\n\t\t\t\t".concat(typoStyles.common, "\n\t\t\t\t").concat(typoStyles.caption, " \n\t\t\t") }, antdProps, { children: children })));
11629
+ return ((0, jsx_runtime_1.jsx)(antd_1.Typography.Text, __assign({ className: "\n\t\t\t\t".concat(typoStyles.common, "\n\t\t\t\t").concat(typoStyles.caption, "\n\t\t\t") }, antdProps, { children: children })));
7387
11630
  };
7388
11631
  var Overline = function (_a) {
7389
11632
  var children = _a.children, color = _a.color, antdProps = __rest(_a, ["children", "color"]);
7390
11633
  var typoStyles = (0, useTypographyStyles_1.useTypographyStyles)(color).styles;
7391
- return ((0, jsx_runtime_1.jsx)(antd_1.Typography.Text, __assign({ className: "\n\t\t\t\t".concat(typoStyles.common, "\n\t\t\t\t").concat(typoStyles.overline, " \n\t\t\t") }, antdProps, { children: children })));
11634
+ return ((0, jsx_runtime_1.jsx)(antd_1.Typography.Text, __assign({ className: "\n\t\t\t\t".concat(typoStyles.common, "\n\t\t\t\t").concat(typoStyles.overline, "\n\t\t\t") }, antdProps, { children: children })));
7392
11635
  };
7393
11636
  var Paragraph = function (_a) {
7394
11637
  var children = _a.children, color = _a.color, antdProps = __rest(_a, ["children", "color"]);
7395
11638
  var typoStyles = (0, useTypographyStyles_1.useTypographyStyles)(color).styles;
7396
- return ((0, jsx_runtime_1.jsx)(antd_1.Typography.Text, __assign({ className: "\n\t\t\t\t".concat(typoStyles.common, "\n\t\t\t\t").concat(typoStyles.textBody2, " \n\t\t\t\t").concat(typoStyles.paragraph, "\n\t\t\t") }, antdProps, { children: children })));
11639
+ return ((0, jsx_runtime_1.jsx)(antd_1.Typography.Text, __assign({ className: "\n\t\t\t\t".concat(typoStyles.common, "\n\t\t\t\t").concat(typoStyles.textBody2, "\n\t\t\t\t").concat(typoStyles.paragraph, "\n\t\t\t") }, antdProps, { children: children })));
11640
+ };
11641
+ var Link = function (_a) {
11642
+ var children = _a.children, color = _a.color, antdProps = __rest(_a, ["children", "color"]);
11643
+ var typoStyles = (0, useTypographyStyles_1.useTypographyStyles)(color).styles;
11644
+ return ((0, jsx_runtime_1.jsx)(antd_1.Typography.Link, __assign({ className: "\n\t\t\t\t".concat(typoStyles.common, "\n\t\t\t\t").concat(typoStyles.textBody1, "\n\t\t\t\t").concat(typoStyles.link, "\n\t\t\t") }, antdProps, { children: children })));
7397
11645
  };
7398
11646
  /**
7399
11647
  * Basic text writing, including headings, body text, lists, and more.
@@ -7411,6 +11659,7 @@ Typography.Caption = Caption;
7411
11659
  Typography.Overline = Overline;
7412
11660
  Typography.Paragraph = Paragraph;
7413
11661
  Typography.Emphasis = Emphasis;
11662
+ Typography.Link = Link;
7414
11663
  exports["default"] = Typography;
7415
11664
 
7416
11665
 
@@ -7453,11 +11702,12 @@ var useTypographyStyles = function (color) {
7453
11702
  paragraph: css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n display: block;\n margin-bottom: 20px;\n "], ["\n display: block;\n margin-bottom: 20px;\n "]))),
7454
11703
  caption: css(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n letter-spacing: ", ";\n font-size: ", "px;\n font-weight: 500;\n "], ["\n letter-spacing: ", ";\n font-size: ", "px;\n font-weight: 500;\n "])), typographyUtil_1.typographyUtil.letterSpacing.caption, typographyUtil_1.typographyUtil.fontSize.caption),
7455
11704
  overline: css(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n letter-spacing: ", ";\n font-size: ", "px;\n font-weight: 600;\n opacity: 0.88;\n text-transform: uppercase;\n \n &&.", "-typography {\n margin-bottom: 0;\n }\n "], ["\n letter-spacing: ", ";\n font-size: ", "px;\n font-weight: 600;\n opacity: 0.88;\n text-transform: uppercase;\n \n &&.", "-typography {\n margin-bottom: 0;\n }\n "])), typographyUtil_1.typographyUtil.letterSpacing.overline, typographyUtil_1.typographyUtil.fontSize.overline, prefixCls),
11705
+ link: css(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n text-decoration: underline !important;\n text-underline-offset: 3px;\n \n &&.", "-typography {\n margin-bottom: 0;\n }\n "], ["\n text-decoration: underline !important;\n text-underline-offset: 3px;\n \n &&.", "-typography {\n margin-bottom: 0;\n }\n "])), prefixCls),
7456
11706
  });
7457
11707
  })();
7458
11708
  };
7459
11709
  exports.useTypographyStyles = useTypographyStyles;
7460
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14;
11710
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15;
7461
11711
 
7462
11712
 
7463
11713
  /***/ },
@@ -7685,7 +11935,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
7685
11935
  return (mod && mod.__esModule) ? mod : { "default": mod };
7686
11936
  };
7687
11937
  Object.defineProperty(exports, "__esModule", ({ value: true }));
7688
- exports.useScreenSize = exports.useAcaciaConfig = exports.useFoucHandler = exports.useAcaciaColors = exports.VerticalHeader = exports.VerticalLayout = exports.Panel = exports.Space = exports.Menu = exports.Avatar = exports.Tabs = exports.Tag = exports.Card = exports.DatePicker = exports.TimePicker = exports.Typography = exports.Pagination = exports.Dropdown = exports.Input = exports.Switch = exports.Select = exports.Segmented = exports.Radio = exports.Checkbox = exports.Breadcrumb = exports.ConfigProvider = exports.Badge = exports.Button = void 0;
11938
+ exports.useScreenSize = exports.useAcaciaConfig = exports.useFoucHandler = exports.useAcaciaColors = exports.VerticalContent = exports.VerticalHeader = exports.VerticalLayout = exports.Modal = exports.Popconfirm = exports.Panel = exports.Space = exports.Menu = exports.Avatar = exports.Tabs = exports.Tag = exports.Card = exports.DatePicker = exports.TimePicker = exports.Typography = exports.Pagination = exports.Dropdown = exports.Input = exports.Switch = exports.Select = exports.Segmented = exports.Radio = exports.Checkbox = exports.Breadcrumb = exports.ConfigProvider = exports.Badge = exports.Button = void 0;
7689
11939
  var Button_1 = __webpack_require__(/*! ./components/ui/Button/Button */ "./src/components/ui/Button/Button.tsx");
7690
11940
  Object.defineProperty(exports, "Button", ({ enumerable: true, get: function () { return __importDefault(Button_1).default; } }));
7691
11941
  var Badge_1 = __webpack_require__(/*! ./components/ui/Badge/Badge */ "./src/components/ui/Badge/Badge.tsx");
@@ -7730,10 +11980,16 @@ var Space_1 = __webpack_require__(/*! ./components/ui/Space/Space */ "./src/comp
7730
11980
  Object.defineProperty(exports, "Space", ({ enumerable: true, get: function () { return __importDefault(Space_1).default; } }));
7731
11981
  var Panel_1 = __webpack_require__(/*! ./components/ui/Panel/Panel */ "./src/components/ui/Panel/Panel.tsx");
7732
11982
  Object.defineProperty(exports, "Panel", ({ enumerable: true, get: function () { return __importDefault(Panel_1).default; } }));
11983
+ var Popconfirm_1 = __webpack_require__(/*! ./components/ui/Popconfirm/Popconfirm */ "./src/components/ui/Popconfirm/Popconfirm.tsx");
11984
+ Object.defineProperty(exports, "Popconfirm", ({ enumerable: true, get: function () { return __importDefault(Popconfirm_1).default; } }));
11985
+ var Modal_1 = __webpack_require__(/*! ./components/ui/Modal/Modal */ "./src/components/ui/Modal/Modal.tsx");
11986
+ Object.defineProperty(exports, "Modal", ({ enumerable: true, get: function () { return __importDefault(Modal_1).default; } }));
7733
11987
  var VerticalLayout_1 = __webpack_require__(/*! ./components/layout/VerticalLayout/VerticalLayout */ "./src/components/layout/VerticalLayout/VerticalLayout.tsx");
7734
11988
  Object.defineProperty(exports, "VerticalLayout", ({ enumerable: true, get: function () { return __importDefault(VerticalLayout_1).default; } }));
7735
11989
  var VerticalHeader_1 = __webpack_require__(/*! ./components/layout/VerticalLayout/VerticalHeader */ "./src/components/layout/VerticalLayout/VerticalHeader.tsx");
7736
11990
  Object.defineProperty(exports, "VerticalHeader", ({ enumerable: true, get: function () { return __importDefault(VerticalHeader_1).default; } }));
11991
+ var VerticalContent_1 = __webpack_require__(/*! ./components/layout/VerticalLayout/VerticalContent */ "./src/components/layout/VerticalLayout/VerticalContent.tsx");
11992
+ Object.defineProperty(exports, "VerticalContent", ({ enumerable: true, get: function () { return __importDefault(VerticalContent_1).default; } }));
7737
11993
  // hooks
7738
11994
  var useAcaciaColors_1 = __webpack_require__(/*! ./hooks/useAcaciaColors */ "./src/hooks/useAcaciaColors.tsx");
7739
11995
  Object.defineProperty(exports, "useAcaciaColors", ({ enumerable: true, get: function () { return useAcaciaColors_1.useAcaciaColors; } }));
@@ -7762,6 +12018,8 @@ exports.CustomTheme = {
7762
12018
  headingFontFamily: '"Roboto Flex Variable", "Roboto Flex", "Segoe UI", sans-serif',
7763
12019
  appTheme: "classic",
7764
12020
  logo: "TEST LOGO",
12021
+ appThemeMode: "light",
12022
+ darkPopover: false,
7765
12023
  };
7766
12024
 
7767
12025
 
@@ -7807,7 +12065,7 @@ function DefaultLogo() {
7807
12065
  var token = (0, antd_style_1.useTheme)();
7808
12066
  var useToken = antd_1.theme.useToken;
7809
12067
  var globalToken = useToken(); // get the default, antd tokens
7810
- var defaultTheme = (0, defaultTheme_1.useGetDefaultTheme)(); // get the default, overwritten tokens
12068
+ var defaultTheme = (0, defaultTheme_1.useGetDefaultTheme)(token.appThemeMode); // get the default, overwritten tokens
7811
12069
  var getLogo = function () {
7812
12070
  var _a, _b, _c;
7813
12071
  if (typeof token.logo === "string") {
@@ -7909,10 +12167,11 @@ exports.useAcaciaToken = useAcaciaToken;
7909
12167
  "use strict";
7910
12168
 
7911
12169
  Object.defineProperty(exports, "__esModule", ({ value: true }));
7912
- exports.renderBlackOrWhiteText = exports.generate = void 0;
12170
+ exports.editOpacity = exports.renderBlackOrWhiteText = exports.generate = void 0;
7913
12171
  exports.hexToRGBA = hexToRGBA;
7914
12172
  var colors_1 = __webpack_require__(/*! @ant-design/colors */ "./node_modules/@ant-design/colors/es/index.js");
7915
12173
  var colorize_1 = __webpack_require__(/*! @mirawision/colorize */ "./node_modules/@mirawision/colorize/index.js");
12174
+ var ts_pattern_1 = __webpack_require__(/*! ts-pattern */ "./node_modules/ts-pattern/dist/index.cjs");
7916
12175
  var generate = function (color, darken) {
7917
12176
  var colors = color
7918
12177
  ? (0, colors_1.generate)(color, {
@@ -7946,6 +12205,17 @@ function hexToRGBA(hex, opacityPercent) {
7946
12205
  var b = Number.parseInt(hex.slice(5, 7), 16);
7947
12206
  return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(alpha, ")");
7948
12207
  }
12208
+ var editOpacity = function (type, color) {
12209
+ return (0, ts_pattern_1.match)(type)
12210
+ .with("hex", function () {
12211
+ return hexToRGBA(color, 30);
12212
+ })
12213
+ .with("rgba", function () {
12214
+ return (0, colorize_1.changeOpacity)(color, 0.3);
12215
+ })
12216
+ .exhaustive();
12217
+ };
12218
+ exports.editOpacity = editOpacity;
7949
12219
 
7950
12220
 
7951
12221
  /***/ },
@@ -7990,6 +12260,59 @@ function parseBackgroundColors(css) {
7990
12260
  }
7991
12261
 
7992
12262
 
12263
+ /***/ },
12264
+
12265
+ /***/ "./src/utils/theming.util.ts"
12266
+ /*!***********************************!*\
12267
+ !*** ./src/utils/theming.util.ts ***!
12268
+ \***********************************/
12269
+ (__unused_webpack_module, exports, __webpack_require__) {
12270
+
12271
+ "use strict";
12272
+
12273
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12274
+ return (mod && mod.__esModule) ? mod : { "default": mod };
12275
+ };
12276
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
12277
+ exports.getThemedTitleHeaderBackgroundPicture = exports.getThemedContentBackgroundPicture = exports.getThemedBackgroundPicture = void 0;
12278
+ var header1_jpg_1 = __importDefault(__webpack_require__(/*! ../assets/header1.jpg */ "./src/assets/header1.jpg"));
12279
+ var header2_jpg_1 = __importDefault(__webpack_require__(/*! ../assets/header2.jpg */ "./src/assets/header2.jpg"));
12280
+ var header3_jpg_1 = __importDefault(__webpack_require__(/*! ../assets/header3.jpg */ "./src/assets/header3.jpg"));
12281
+ var body_png_1 = __importDefault(__webpack_require__(/*! ../assets/body.png */ "./src/assets/body.png"));
12282
+ var body3_png_1 = __importDefault(__webpack_require__(/*! ../assets/body3.png */ "./src/assets/body3.png"));
12283
+ var body2_png_1 = __importDefault(__webpack_require__(/*! ../assets/body2.png */ "./src/assets/body2.png"));
12284
+ var cardheader_png_1 = __importDefault(__webpack_require__(/*! ../assets/cardheader.png */ "./src/assets/cardheader.png"));
12285
+ var cardheader2_png_1 = __importDefault(__webpack_require__(/*! ../assets/cardheader2.png */ "./src/assets/cardheader2.png"));
12286
+ var cardheader3_png_1 = __importDefault(__webpack_require__(/*! ../assets/cardheader3.png */ "./src/assets/cardheader3.png"));
12287
+ var ts_pattern_1 = __webpack_require__(/*! ts-pattern */ "./node_modules/ts-pattern/dist/index.cjs");
12288
+ // for vertical layout
12289
+ var getThemedBackgroundPicture = function (theme) {
12290
+ return (0, ts_pattern_1.match)(theme)
12291
+ .with("classic", function () { return header1_jpg_1.default; })
12292
+ .with("submarine", function () { return header2_jpg_1.default; })
12293
+ .with("mystical", function () { return header3_jpg_1.default; })
12294
+ .exhaustive();
12295
+ };
12296
+ exports.getThemedBackgroundPicture = getThemedBackgroundPicture;
12297
+ var getThemedContentBackgroundPicture = function (theme) {
12298
+ return (0, ts_pattern_1.match)(theme)
12299
+ .with("classic", function () { return body_png_1.default; })
12300
+ .with("submarine", function () { return body2_png_1.default; })
12301
+ .with("mystical", function () { return body3_png_1.default; })
12302
+ .exhaustive();
12303
+ };
12304
+ exports.getThemedContentBackgroundPicture = getThemedContentBackgroundPicture;
12305
+ // for title headers bg
12306
+ var getThemedTitleHeaderBackgroundPicture = function (theme) {
12307
+ return (0, ts_pattern_1.match)(theme)
12308
+ .with("classic", function () { return cardheader_png_1.default; })
12309
+ .with("submarine", function () { return cardheader2_png_1.default; })
12310
+ .with("mystical", function () { return cardheader3_png_1.default; })
12311
+ .exhaustive();
12312
+ };
12313
+ exports.getThemedTitleHeaderBackgroundPicture = getThemedTitleHeaderBackgroundPicture;
12314
+
12315
+
7993
12316
  /***/ },
7994
12317
 
7995
12318
  /***/ "antd"