@likec4/core 1.55.1 → 1.57.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.
- package/dist/THIRD-PARTY-LICENSES.md +30 -30
- package/dist/_chunks/Builder.view-element.mjs +2 -2
- package/dist/_chunks/LikeC4Model.d.mts +2 -1
- package/dist/_chunks/_types.d.mts +7 -3
- package/dist/_chunks/_types2.d.mts +1 -1
- package/dist/_chunks/assignTagColors.mjs +1 -1
- package/dist/_chunks/index.d.mts +64 -2
- package/dist/_chunks/index3.d.mts +1 -1
- package/dist/_chunks/index4.d.mts +1 -1
- package/dist/_chunks/index5.d.mts +13 -2
- package/dist/_chunks/libs/chroma-js.mjs +15 -0
- package/dist/_chunks/libs/graphology-dag.d.mts +607 -0
- package/dist/_chunks/libs/graphology-dag.mjs +1 -1
- package/dist/_chunks/libs/hast-util-to-html.mjs +1 -1
- package/dist/_chunks/libs/mdast-util-find-and-replace.mjs +1 -1
- package/dist/_chunks/libs/mdast-util-from-markdown.mjs +1 -1
- package/dist/_chunks/libs/mdast-util-gfm.mjs +11 -11
- package/dist/_chunks/libs/mnemonist.d.mts +33 -33
- package/dist/_chunks/libs/mnemonist.mjs +1 -1
- package/dist/_chunks/libs/unified.mjs +1 -1
- package/dist/_chunks/manual-layout.mjs +1 -1
- package/dist/_chunks/mnemonist.d.mts +1 -1
- package/dist/_chunks/model.mjs +4 -4
- package/dist/_chunks/rolldown-runtime.mjs +1 -1
- package/dist/_chunks/types.mjs +1 -1
- package/dist/builder/index.d.mts +2 -8
- package/dist/builder/index.mjs +1 -1
- package/dist/compute-view/index.d.mts +2 -6
- package/dist/compute-view/index.mjs +2 -2
- package/dist/geometry/index.mjs +1 -1
- package/dist/index.d.mts +4 -5
- package/dist/index.mjs +1 -1
- package/dist/model/index.d.mts +0 -5
- package/dist/model/index.mjs +1 -1
- package/dist/styles/index.d.mts +1 -2
- package/dist/styles/index.mjs +1 -1
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.mjs +1 -1
- package/dist/utils/graphology/index.d.mts +2 -1
- package/dist/utils/graphology/index.mjs +1 -1
- package/dist/utils/index.d.mts +3 -5
- package/dist/utils/index.mjs +1 -1
- package/package.json +10 -10
- package/dist/_chunks/geometry.mjs +0 -1
- package/dist/_chunks/libs/@mantine/colors-generator.mjs +0 -15
- package/dist/_chunks/utils.mjs +0 -1
package/dist/_chunks/index.d.mts
CHANGED
|
@@ -660,6 +660,10 @@ declare namespace FqnExpr {
|
|
|
660
660
|
border?: BorderStyle;
|
|
661
661
|
opacity?: number;
|
|
662
662
|
navigateTo?: StrictViewId<A>;
|
|
663
|
+
/**
|
|
664
|
+
* If true, each matching element is rendered as multiple shapes.
|
|
665
|
+
* @default false
|
|
666
|
+
*/
|
|
663
667
|
multiple?: boolean;
|
|
664
668
|
size?: ShapeSize;
|
|
665
669
|
padding?: ShapeSize;
|
|
@@ -739,6 +743,11 @@ declare namespace RelationExpr {
|
|
|
739
743
|
line?: RelationshipLineType;
|
|
740
744
|
head?: RelationshipArrowType;
|
|
741
745
|
tail?: RelationshipArrowType;
|
|
746
|
+
/**
|
|
747
|
+
* If true, each matching relationship is rendered as a separate edge.
|
|
748
|
+
* @default false
|
|
749
|
+
*/
|
|
750
|
+
multiple?: boolean;
|
|
742
751
|
};
|
|
743
752
|
}
|
|
744
753
|
function isCustom<A extends AnyAux$1>(expr: Expression<A>): expr is Custom<A>;
|
|
@@ -851,6 +860,10 @@ declare namespace ModelFqnExpr {
|
|
|
851
860
|
border?: BorderStyle;
|
|
852
861
|
opacity?: number;
|
|
853
862
|
navigateTo?: StrictViewId<A>;
|
|
863
|
+
/**
|
|
864
|
+
* If true, each matching element is rendered as multiple shapes.
|
|
865
|
+
* @default false
|
|
866
|
+
*/
|
|
854
867
|
multiple?: boolean;
|
|
855
868
|
size?: ShapeSize;
|
|
856
869
|
padding?: ShapeSize;
|
|
@@ -927,6 +940,11 @@ declare namespace ModelRelationExpr {
|
|
|
927
940
|
line?: RelationshipLineType;
|
|
928
941
|
head?: RelationshipArrowType;
|
|
929
942
|
tail?: RelationshipArrowType;
|
|
943
|
+
/**
|
|
944
|
+
* If true, each matching relationship is rendered as a separate edge.
|
|
945
|
+
* @default false
|
|
946
|
+
*/
|
|
947
|
+
multiple?: boolean;
|
|
930
948
|
};
|
|
931
949
|
}
|
|
932
950
|
function isCustom<A extends AnyAux>(expr: ModelExpression<A>): expr is Custom<A>;
|
|
@@ -997,6 +1015,10 @@ interface AnyViewRuleStyle<Expr> {
|
|
|
997
1015
|
style: {
|
|
998
1016
|
border?: BorderStyle;
|
|
999
1017
|
opacity?: number;
|
|
1018
|
+
/**
|
|
1019
|
+
* If true, the element is rendered as multiple shapes.
|
|
1020
|
+
* @default false
|
|
1021
|
+
*/
|
|
1000
1022
|
multiple?: boolean;
|
|
1001
1023
|
size?: ShapeSize;
|
|
1002
1024
|
padding?: SpacingSize;
|
|
@@ -1090,6 +1112,10 @@ interface ElementViewRuleGroup<A extends Any = Any> {
|
|
|
1090
1112
|
color?: Color;
|
|
1091
1113
|
border?: BorderStyle;
|
|
1092
1114
|
opacity?: number;
|
|
1115
|
+
/**
|
|
1116
|
+
* If true, each matching element in the group is rendered as multiple shapes.
|
|
1117
|
+
* @default false
|
|
1118
|
+
*/
|
|
1093
1119
|
multiple?: boolean;
|
|
1094
1120
|
size?: ShapeSize;
|
|
1095
1121
|
padding?: SpacingSize;
|
|
@@ -1324,6 +1350,10 @@ interface ElementSpecification {
|
|
|
1324
1350
|
size?: ShapeSize;
|
|
1325
1351
|
padding?: SpacingSize;
|
|
1326
1352
|
textSize?: TextSize;
|
|
1353
|
+
/**
|
|
1354
|
+
* If true, the element is rendered as multiple shapes.
|
|
1355
|
+
* @default false
|
|
1356
|
+
*/
|
|
1327
1357
|
multiple?: boolean;
|
|
1328
1358
|
};
|
|
1329
1359
|
}
|
|
@@ -1344,6 +1374,12 @@ interface RelationshipSpecification {
|
|
|
1344
1374
|
line?: RelationshipLineType;
|
|
1345
1375
|
head?: RelationshipArrowType;
|
|
1346
1376
|
tail?: RelationshipArrowType;
|
|
1377
|
+
/**
|
|
1378
|
+
* If true, matching relationships are rendered as separate edges instead of
|
|
1379
|
+
* being merged into a single connection.
|
|
1380
|
+
* @default false
|
|
1381
|
+
*/
|
|
1382
|
+
multiple?: boolean;
|
|
1347
1383
|
}
|
|
1348
1384
|
type Specification<A> = A extends Any ? {
|
|
1349
1385
|
tags: { [key in Tag<A>]: TagSpecification };
|
|
@@ -1717,7 +1753,15 @@ type DeploymentViewRule<A extends Any = Unknown> = ExclusiveUnion<{
|
|
|
1717
1753
|
Exclude: DeploymentViewExcludePredicate<A>;
|
|
1718
1754
|
Style: DeploymentViewRuleStyle<A>;
|
|
1719
1755
|
AutoLayout: ViewRuleAutoLayout;
|
|
1756
|
+
IncludeAncestors: ParsedViewRuleAncestors;
|
|
1720
1757
|
}>;
|
|
1758
|
+
interface ParsedViewRuleAncestors<A extends Any = Unknown> {
|
|
1759
|
+
/**
|
|
1760
|
+
* When true, ancestor elements of included deployment nodes are also included in the view.
|
|
1761
|
+
* @default false (ancestors are not included)
|
|
1762
|
+
*/
|
|
1763
|
+
includeAncestors: boolean;
|
|
1764
|
+
}
|
|
1721
1765
|
interface ParsedDeploymentView<A extends Any = Unknown> extends BaseParsedViewProperties<A> {
|
|
1722
1766
|
[_type]: 'deployment';
|
|
1723
1767
|
readonly rules: DeploymentViewRule<A>[];
|
|
@@ -1893,8 +1937,26 @@ declare namespace ViewChange {
|
|
|
1893
1937
|
rankSep?: number | null;
|
|
1894
1938
|
};
|
|
1895
1939
|
}
|
|
1940
|
+
interface ChangeProperty {
|
|
1941
|
+
op: 'change-property';
|
|
1942
|
+
/**
|
|
1943
|
+
* Change title
|
|
1944
|
+
*/
|
|
1945
|
+
title?: string;
|
|
1946
|
+
/**
|
|
1947
|
+
* Change description
|
|
1948
|
+
*/
|
|
1949
|
+
description?: MarkdownOrString;
|
|
1950
|
+
/**
|
|
1951
|
+
* Add or remove tags
|
|
1952
|
+
*/
|
|
1953
|
+
tag?: {
|
|
1954
|
+
add?: Tag$1 | Tag$1[];
|
|
1955
|
+
remove?: Tag$1 | Tag$1[];
|
|
1956
|
+
};
|
|
1957
|
+
}
|
|
1896
1958
|
}
|
|
1897
|
-
type ViewChange = ViewChange.ChangeElementStyle | ViewChange.SaveViewSnapshot | ViewChange.ResetManualLayout | ViewChange.ChangeAutoLayout;
|
|
1959
|
+
type ViewChange = ViewChange.ChangeElementStyle | ViewChange.SaveViewSnapshot | ViewChange.ResetManualLayout | ViewChange.ChangeAutoLayout | ViewChange.ChangeProperty;
|
|
1898
1960
|
//#endregion
|
|
1899
1961
|
//#region src/types/RichText.d.ts
|
|
1900
1962
|
interface RichTextEmpty {
|
|
@@ -2015,4 +2077,4 @@ type GuardedBy<G> = G extends Guard<infer To> ? Or<IsAny<To>, IsUnknown<To>> ext
|
|
|
2015
2077
|
*/
|
|
2016
2078
|
declare function isAnyOf<const Predicates extends NonEmptyArray<Guard<any>>>(...predicates: Predicates): <T>(value: T) => value is T & GuardedBy<Predicates[number]>;
|
|
2017
2079
|
//#endregion
|
|
2018
|
-
export {
|
|
2080
|
+
export { DiagramNodeDriftReason as $, Coalesce as $i, isTagEqual as $n, RelationId as $r, ElementViewIncludePredicate as $t, isComputedView as A, ProjectId$1 as Ai, ModelRelationExpr as An, IconPositions as Ar, ElementStyle as At, DeploymentViewIncludePredicate as B, flattenMarkdownOrString as Bi, NotOperator as Bn, DeploymentKind as Br, DynamicStep as Bt, LayoutedView as C, GlobalFqn as Ci, ViewWithNotation as Cn, ThemeColor as Cr, DeploymentNode as Ct, ViewRule as D, MarkdownOrString as Di, isViewRuleGlobalStyle as Dn, BorderStyles as Dr, isDeploymentNode as Dt, ViewOnStage as E, IconUrl as Ei, isViewRuleGlobalPredicateRef as En, isThemeColor as Er, isDeployedInstance as Et, isExtendsElementView as F, StepEdgeIdLiteral as Fi, AndOperator as Fn, AnyLayouted as Fr, GlobalPredicateId as Ft, ParsedViewRuleAncestors as G, splitGlobalFqn as Gi, TagEqual as Gn, LooseDeploymentId as Gr, DynamicViewRule as Gt, DeploymentViewRule as H, isGroupElementKind as Hi, OrOperator as Hn, ElementId as Hr, DynamicStepsSeries as Ht, isScopedElementView as I, StepEdgeKind as Ii, EqualOperator as In, AnyParsed as Ir, GlobalPredicates as It, LayoutType as J, ModelStage as Ji, isKindEqual as Jn, LooseTag as Jr, getParallelStepsPrefix as Jt, DiagramEdge as K, stepEdgeId as Ki, WhereOperator as Kn, LooseElementId as Kr, DynamicViewStep as Kt, isViewRulePredicate as L, Tag$1 as Li, Filterable as Ln, Aux as Lr, GlobalStyleID as Lt, isDiagramView as M, RelationKind$1 as Mi, FqnExpr as Mn, ThemeColors as Mr, Relationship as Mt, isDynamicView as N, RelationshipKind as Ni, PredicateSelector as Nn, Any as Nr, ensureSizes as Nt, ViewRulePredicate as O, NodeId$1 as Oi, ModelExpression as On, DefaultTagColors as Or, AbstractRelationship as Ot, isElementView as P, StepEdgeId as Pi, RelationExpr as Pn, AnyComputed as Pr, GlobalDynamicPredicates as Pt, DiagramEdgeDriftReason as Q, isOnStage as Qi, isParticipantOperator as Qn, ProjectId as Qr, ElementViewExcludePredicate as Qt, isViewRuleStyle as R, ViewId$1 as Ri, KindEqual as Rn, DeploymentFqn as Rr, GlobalStyles as Rt, ComputedView as S, Fqn$1 as Si, ViewWithHash as Sn, TextSize as Sr, DeploymentElementRef$1 as St, ProcessedView as T, Icon as Ti, isViewRuleAutoLayout as Tn, isCustomColor as Tr, DeploymentRelationship as Tt, DeploymentViewRuleStyle as U, isStepEdgeId as Ui, Participant as Un, ElementKind as Ur, DynamicViewDisplayVariant as Ut, DeploymentViewPredicate as V, isGlobalFqn as Vi, OperatorPredicate as Vn, EdgeId as Vr, DynamicStepsParallel as Vt, ParsedDeploymentView as W, scalar_d_exports as Wi, ParticipantOperator as Wn, Fqn as Wr, DynamicViewIncludeRule as Wt, LayoutedDynamicView as X, _stage as Xi, isNotOperator as Xn, Metadata as Xr, isDynamicStepsParallel as Xt, LayoutedDeploymentView as Y, _layout as Yi, isMetadataEqual as Yn, LooseViewId as Yr, isDynamicStep as Yt, LayoutedElementView as Z, _type as Zi, isOrOperator as Zn, MetadataKey as Zr, isDynamicStepsSeries as Zt, ComputedLikeC4ModelData as _, BuiltInIcon as _i, ViewRuleAutoLayout as _n, RelationshipColorValues as _r, Specification as _t, isNonEmptyArray as a, NTuple as aa, Tags as ai, ParsedElementView as an, CustomColor as ar, ComputedElementView as at, ParsedLikeC4ModelData as b, EdgeId$1 as bi, ViewRuleRank as bn, Size as br, DeployedInstance as bt, RichTextEmpty as c, Predicate as ca, UnknownLayouted as ci, AnyExcludePredicate as cn, ElementShape as cr, ComputedRankConstraint as ct, AuxFromDump as d, _aux_d_exports as di, AutoLayoutDirection as dn, IconSize as dr, LikeC4ProjectStyleDefaults as dt, ExclusiveUnion as ea, RelationKind as ei, ElementViewPredicate as en, whereOperatorAsPredicate as er, LayoutedViewDriftReason as et, LikeC4ModelDump as f, preferDescription as fi, BaseParsedViewProperties as fn, LikeC4StyleDefaults as fr, LikeC4ProjectStylesConfig as ft, AuxFromLikeC4ModelData as g, AnyFqn as gi, ViewAutoLayout as gn, RelationshipArrowTypes as gr, RelationshipSpecification as gt, SpecificationDump as h, toComputed as hi, RankValue as hn, RelationshipArrowType as hr, ElementSpecification as ht, isAnyOf as i, Link as ia, Tag as ii, ElementViewRuleStyle as in, ColorLiteral as ir, ComputedEdge as it, isDeploymentView as j, RelationId$1 as ji, Expression as jn, Sizes as jr, ModelRelation as jt, ViewWithType as k, NoneIcon as ki, ModelFqnExpr as kn, ElementShapes as kr, Element as kt, RichTextOrEmpty as l, ReorderedArray as la, UnknownParsed as li, AnyIncludePredicate as ln, HexColor as lr, LikeC4Project as lt, SpecTypesFromDump as m, setProject as mi, NodeNotation as mn, LikeC4Theme as mr, LikeC4ProjectTheme as mt, GuardedBy as n, IteratorLike as na, Stage as ni, ElementViewRuleGroup as nn, BorderStyle as nr, ComputedDeploymentView as nt, isString as o, NonEmptyArray as oa, Unknown as oi, isViewRuleGroup as on, CustomColorDefinitions as or, ComputedNode as ot, ProjectDump as p, preferSummary as pi, BaseViewProperties as pn, LikeC4StylesConfig as pr, LikeC4ProjectStylesCustomStylesheets as pt, DiagramNode as q, ExtractOnStage as qi, isAndOperator as qn, LooseLiteral as qr, ParsedDynamicView as qt, hasProp as r, KeysOf as ra, StrictViewId as ri, ElementViewRuleRank as rn, Color as rr, ComputedDynamicView as rt, RichText as s, NonEmptyReadonlyArray as sa, UnknownComputed as si, isViewRuleRank as sn, ElementColorValues as sr, ComputedNodeStyle as st, Guard as t, IterableContainer as ta, SpecAux as ti, ElementViewRule as tn, FqnRef as tr, ViewManualLayoutSnapshot as tt, ViewChange as u, exact as ua, ViewId as ui, AnyViewRuleStyle as un, IconPosition as ur, LikeC4ProjectManualLayoutsConfig as ut, LayoutedLikeC4ModelData as v, DeploymentFqn$1 as vi, ViewRuleGlobalPredicateRef as vn, RelationshipLineType as vr, TagSpecification as vt, ParsedView as w, GroupElementKind as wi, isAutoLayoutDirection as wn, ThemeColorValues as wr, DeploymentRelation as wt, AnyView as x, ElementKind$1 as xi, ViewType as xn, SpacingSize as xr, DeploymentElement as xt, LikeC4ModelData as y, DeploymentKind$1 as yi, ViewRuleGlobalStyle as yn, ShapeSize as yr, isTagColorSpecified as yt, DeploymentViewExcludePredicate as z, extractStep as zi, MetadataEqual as zn, DeploymentId as zr, ModelGlobals as zt };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Cr as
|
|
1
|
+
import { Cr as ThemeColor, Li as Tag, Or as DefaultTagColors, Sr as TextSize, _r as RelationshipColorValues, aa as NTuple, dr as IconSize, fr as LikeC4StyleDefaults, ft as LikeC4ProjectStylesConfig, ir as ColorLiteral, mr as LikeC4Theme, nr as BorderStyle, or as CustomColorDefinitions, pr as LikeC4StylesConfig, pt as LikeC4ProjectStylesCustomStylesheets, rr as Color, sr as ElementColorValues, st as ComputedNodeStyle, ur as IconPosition, vt as TagSpecification, wr as ThemeColorValues, xr as SpacingSize, yr as ShapeSize } from "./index.mjs";
|
|
2
2
|
import { LiteralUnion } from "type-fest";
|
|
3
3
|
|
|
4
4
|
//#region src/styles/assignTagColors.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Nr as Any, Si as Fqn, Vr as EdgeId, la as ReorderedArray, na as IteratorLike, oi as Unknown, ta as IterableContainer } from "./index.mjs";
|
|
2
2
|
import { C as ElementModel, S as NodeModel, T as RelationshipModel, a as DeploymentNodeModel, c as NestedElementOfDeployedInstanceModel, i as DeploymentElementModel, l as RelationshipsAccum, r as DeployedInstanceModel, s as DeploymentRelationModel, w as AnyRelationshipModel, x as EdgeModel, y as LikeC4ViewModel } from "./LikeC4Model.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/model/connection/Connection.d.ts
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Si as Fqn, la as ReorderedArray, na as IteratorLike, oa as NonEmptyArray, ta as IterableContainer } from "./index.mjs";
|
|
2
|
+
import "./mnemonist.mjs";
|
|
2
3
|
|
|
3
4
|
//#region src/utils/invariant.d.ts
|
|
4
5
|
declare function nonNullable<T>(value: T, message?: string | (() => string)): NonNullable<T>;
|
|
@@ -21,6 +22,9 @@ declare function sortNatural<T extends IterableContainer<string>>(elements: T):
|
|
|
21
22
|
* Compares two strings lexicographically first, then hierarchically based on their depth.\
|
|
22
23
|
* From parent nodes to leaves
|
|
23
24
|
*
|
|
25
|
+
* @param separator - The separator to use for splitting the strings
|
|
26
|
+
* @param deepestFirst - If true, deeper paths come first (reverse order)
|
|
27
|
+
*
|
|
24
28
|
* @example
|
|
25
29
|
* const lines = [
|
|
26
30
|
* 'b.c',
|
|
@@ -401,4 +405,11 @@ declare function markdownToHtml(markdown: string): string;
|
|
|
401
405
|
*/
|
|
402
406
|
declare function markdownToText(markdown: string): string;
|
|
403
407
|
//#endregion
|
|
404
|
-
|
|
408
|
+
//#region src/utils/unsafe.d.ts
|
|
409
|
+
/**
|
|
410
|
+
* Casts a partial object to a full object type, mostly for tests.
|
|
411
|
+
* Motivation: to avoid using `as` in the code
|
|
412
|
+
*/
|
|
413
|
+
declare function unsafePartial<T>(value: Partial<NoInfer<T>>): T;
|
|
414
|
+
//#endregion
|
|
415
|
+
export { ancestorsFqn as A, parentFqn as B, iflatMap as C, ifilter as D, ifind as E, hierarchyLevel as F, compareNaturalHierarchically as G, sortNaturalByFqn as H, isAncestor as I, invariant as J, sortNatural as K, isDescendantOf as L, compareByFqnHierarchically as M, compareFqnHierarchically as N, isIterable as O, hierarchyDistance as P, isSameHierarchy as R, ihead as S, ifirst as T, sortParentsFirst as U, sortByFqnHierarchically as V, compareNatural as W, nonexhaustive as X, nonNullable as Y, toArray as _, objectHash as a, ireduce as b, intersection as c, compareRelations as d, delay as f, iunique as g, memoizeProp as h, stringHash as i, commonAncestor as j, getOrCreate as k, symmetricDifference as l, promiseNextTick as m, markdownToText as n, difference as o, onNextTick as p, commonHead as q, markdownToHtml as r, equals as s, unsafePartial as t, union as u, toSet as v, iflat as w, imap as x, isome as y, nameFromFqn as z };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const{min:e,max:t}=Math;var n=(n,r=0,i=1)=>e(t(r,n),i),r=e=>{e._clipped=!1,e._unclipped=e.slice(0);for(let t=0;t<=3;t++)t<3?((e[t]<0||e[t]>255)&&(e._clipped=!0),e[t]=n(e[t],0,255)):t===3&&(e[t]=n(e[t],0,1));return e};const i={};for(let e of[`Boolean`,`Number`,`String`,`Function`,`Array`,`Date`,`RegExp`,`Undefined`,`Null`])i[`[object ${e}]`]=e.toLowerCase();function a(e){return i[Object.prototype.toString.call(e)]||`object`}var o=(e,t=null)=>e.length>=3?Array.prototype.slice.call(e):a(e[0])==`object`&&t?t.split(``).filter(t=>e[0][t]!==void 0).map(t=>e[0][t]):e[0].slice(0),s=e=>{if(e.length<2)return null;let t=e.length-1;return a(e[t])==`string`?e[t].toLowerCase():null};const{PI:c,min:l,max:u}=Math,d=e=>Math.round(e*100)/100,f=e=>Math.round(e*100)/100,p=c*2,m=c/3,h=c/180,g=180/c;function _(e){return[...e.slice(0,3).reverse(),...e.slice(3)]}var v={format:{},autodetect:[]},y=class{constructor(...e){let t=this;if(a(e[0])===`object`&&e[0].constructor&&e[0].constructor===this.constructor)return e[0];let n=s(e),i=!1;if(!n){i=!0,v.sorted||=(v.autodetect=v.autodetect.sort((e,t)=>t.p-e.p),!0);for(let t of v.autodetect)if(n=t.test(...e),n)break}if(v.format[n])t._rgb=r(v.format[n].apply(null,i?e:e.slice(0,-1)));else throw Error(`unknown format: `+e);t._rgb.length===3&&t._rgb.push(1)}toString(){return a(this.hex)==`function`?this.hex():`[${this._rgb.join(`,`)}]`}};const b=(...e)=>new y(...e);b.version=`3.2.0`;const x={aliceblue:`#f0f8ff`,antiquewhite:`#faebd7`,aqua:`#00ffff`,aquamarine:`#7fffd4`,azure:`#f0ffff`,beige:`#f5f5dc`,bisque:`#ffe4c4`,black:`#000000`,blanchedalmond:`#ffebcd`,blue:`#0000ff`,blueviolet:`#8a2be2`,brown:`#a52a2a`,burlywood:`#deb887`,cadetblue:`#5f9ea0`,chartreuse:`#7fff00`,chocolate:`#d2691e`,coral:`#ff7f50`,cornflowerblue:`#6495ed`,cornsilk:`#fff8dc`,crimson:`#dc143c`,cyan:`#00ffff`,darkblue:`#00008b`,darkcyan:`#008b8b`,darkgoldenrod:`#b8860b`,darkgray:`#a9a9a9`,darkgreen:`#006400`,darkgrey:`#a9a9a9`,darkkhaki:`#bdb76b`,darkmagenta:`#8b008b`,darkolivegreen:`#556b2f`,darkorange:`#ff8c00`,darkorchid:`#9932cc`,darkred:`#8b0000`,darksalmon:`#e9967a`,darkseagreen:`#8fbc8f`,darkslateblue:`#483d8b`,darkslategray:`#2f4f4f`,darkslategrey:`#2f4f4f`,darkturquoise:`#00ced1`,darkviolet:`#9400d3`,deeppink:`#ff1493`,deepskyblue:`#00bfff`,dimgray:`#696969`,dimgrey:`#696969`,dodgerblue:`#1e90ff`,firebrick:`#b22222`,floralwhite:`#fffaf0`,forestgreen:`#228b22`,fuchsia:`#ff00ff`,gainsboro:`#dcdcdc`,ghostwhite:`#f8f8ff`,gold:`#ffd700`,goldenrod:`#daa520`,gray:`#808080`,green:`#008000`,greenyellow:`#adff2f`,grey:`#808080`,honeydew:`#f0fff0`,hotpink:`#ff69b4`,indianred:`#cd5c5c`,indigo:`#4b0082`,ivory:`#fffff0`,khaki:`#f0e68c`,laserlemon:`#ffff54`,lavender:`#e6e6fa`,lavenderblush:`#fff0f5`,lawngreen:`#7cfc00`,lemonchiffon:`#fffacd`,lightblue:`#add8e6`,lightcoral:`#f08080`,lightcyan:`#e0ffff`,lightgoldenrod:`#fafad2`,lightgoldenrodyellow:`#fafad2`,lightgray:`#d3d3d3`,lightgreen:`#90ee90`,lightgrey:`#d3d3d3`,lightpink:`#ffb6c1`,lightsalmon:`#ffa07a`,lightseagreen:`#20b2aa`,lightskyblue:`#87cefa`,lightslategray:`#778899`,lightslategrey:`#778899`,lightsteelblue:`#b0c4de`,lightyellow:`#ffffe0`,lime:`#00ff00`,limegreen:`#32cd32`,linen:`#faf0e6`,magenta:`#ff00ff`,maroon:`#800000`,maroon2:`#7f0000`,maroon3:`#b03060`,mediumaquamarine:`#66cdaa`,mediumblue:`#0000cd`,mediumorchid:`#ba55d3`,mediumpurple:`#9370db`,mediumseagreen:`#3cb371`,mediumslateblue:`#7b68ee`,mediumspringgreen:`#00fa9a`,mediumturquoise:`#48d1cc`,mediumvioletred:`#c71585`,midnightblue:`#191970`,mintcream:`#f5fffa`,mistyrose:`#ffe4e1`,moccasin:`#ffe4b5`,navajowhite:`#ffdead`,navy:`#000080`,oldlace:`#fdf5e6`,olive:`#808000`,olivedrab:`#6b8e23`,orange:`#ffa500`,orangered:`#ff4500`,orchid:`#da70d6`,palegoldenrod:`#eee8aa`,palegreen:`#98fb98`,paleturquoise:`#afeeee`,palevioletred:`#db7093`,papayawhip:`#ffefd5`,peachpuff:`#ffdab9`,peru:`#cd853f`,pink:`#ffc0cb`,plum:`#dda0dd`,powderblue:`#b0e0e6`,purple:`#800080`,purple2:`#7f007f`,purple3:`#a020f0`,rebeccapurple:`#663399`,red:`#ff0000`,rosybrown:`#bc8f8f`,royalblue:`#4169e1`,saddlebrown:`#8b4513`,salmon:`#fa8072`,sandybrown:`#f4a460`,seagreen:`#2e8b57`,seashell:`#fff5ee`,sienna:`#a0522d`,silver:`#c0c0c0`,skyblue:`#87ceeb`,slateblue:`#6a5acd`,slategray:`#708090`,slategrey:`#708090`,snow:`#fffafa`,springgreen:`#00ff7f`,steelblue:`#4682b4`,tan:`#d2b48c`,teal:`#008080`,thistle:`#d8bfd8`,tomato:`#ff6347`,turquoise:`#40e0d0`,violet:`#ee82ee`,wheat:`#f5deb3`,white:`#ffffff`,whitesmoke:`#f5f5f5`,yellow:`#ffff00`,yellowgreen:`#9acd32`},S=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,C=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,w=e=>{if(e.match(S)){(e.length===4||e.length===7)&&(e=e.substr(1)),e.length===3&&(e=e.split(``),e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);let t=parseInt(e,16);return[t>>16,t>>8&255,t&255,1]}if(e.match(C)){(e.length===5||e.length===9)&&(e=e.substr(1)),e.length===4&&(e=e.split(``),e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]);let t=parseInt(e,16);return[t>>24&255,t>>16&255,t>>8&255,Math.round((t&255)/255*100)/100]}throw Error(`unknown hex color: ${e}`)},{round:T}=Math,E=(...e)=>{let[t,n,r,i]=o(e,`rgba`),a=s(e)||`auto`;i===void 0&&(i=1),a===`auto`&&(a=i<1?`rgba`:`rgb`),t=T(t),n=T(n),r=T(r);let c=`000000`+(t<<16|n<<8|r).toString(16);c=c.substr(c.length-6);let l=`0`+T(i*255).toString(16);switch(l=l.substr(l.length-2),a.toLowerCase()){case`rgba`:return`#${c}${l}`;case`argb`:return`#${l}${c}`;default:return`#${c}`}};y.prototype.name=function(){let e=E(this._rgb,`rgb`);for(let t of Object.keys(x))if(x[t]===e)return t.toLowerCase();return e},v.format.named=e=>{if(e=e.toLowerCase(),x[e])return w(x[e]);throw Error(`unknown color name: `+e)},v.autodetect.push({p:5,test:(e,...t)=>{if(!t.length&&a(e)===`string`&&x[e.toLowerCase()])return`named`}}),y.prototype.alpha=function(e,t=!1){return e!==void 0&&a(e)===`number`?t?(this._rgb[3]=e,this):new y([this._rgb[0],this._rgb[1],this._rgb[2],e],`rgb`):this._rgb[3]},y.prototype.clipped=function(){return this._rgb._clipped||!1};const D={Kn:18,labWhitePoint:`d65`,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452,kE:216/24389,kKE:8,kK:24389/27,RefWhiteRGB:{X:.95047,Y:1,Z:1.08883},MtxRGB2XYZ:{m00:.4124564390896922,m01:.21267285140562253,m02:.0193338955823293,m10:.357576077643909,m11:.715152155287818,m12:.11919202588130297,m20:.18043748326639894,m21:.07217499330655958,m22:.9503040785363679},MtxXYZ2RGB:{m00:3.2404541621141045,m01:-.9692660305051868,m02:.055643430959114726,m10:-1.5371385127977166,m11:1.8760108454466942,m12:-.2040259135167538,m20:-.498531409556016,m21:.041556017530349834,m22:1.0572251882231791},As:.9414285350000001,Bs:1.040417467,Cs:1.089532651,MtxAdaptMa:{m00:.8951,m01:-.7502,m02:.0389,m10:.2664,m11:1.7135,m12:-.0685,m20:-.1614,m21:.0367,m22:1.0296},MtxAdaptMaI:{m00:.9869929054667123,m01:.43230526972339456,m02:-.008528664575177328,m10:-.14705425642099013,m11:.5183602715367776,m12:.04004282165408487,m20:.15996265166373125,m21:.0492912282128556,m22:.9684866957875502}},O=new Map([[`a`,[1.0985,.35585]],[`b`,[1.0985,.35585]],[`c`,[.98074,1.18232]],[`d50`,[.96422,.82521]],[`d55`,[.95682,.92149]],[`d65`,[.95047,1.08883]],[`e`,[1,1,1]],[`f2`,[.99186,.67393]],[`f7`,[.95041,1.08747]],[`f11`,[1.00962,.6435]],[`icc`,[.96422,.82521]]]);function k(e){let t=O.get(String(e).toLowerCase());if(!t)throw Error(`unknown Lab illuminant `+e);D.labWhitePoint=e,D.Xn=t[0],D.Zn=t[1]}function A(){return D.labWhitePoint}const ee=(...e)=>{e=o(e,`lab`);let[t,n,r]=e,[i,a,s]=te(t,n,r),[c,l,u]=ne(i,a,s);return[c,l,u,e.length>3?e[3]:1]},te=(e,t,n)=>{let{kE:r,kK:i,kKE:a,Xn:o,Yn:s,Zn:c}=D,l=(e+16)/116,u=.002*t+l,d=l-.005*n,f=u*u*u,p=d*d*d,m=f>r?f:(116*u-16)/i,h=e>a?((e+16)/116)**3:e/i,g=p>r?p:(116*d-16)/i;return[m*o,h*s,g*c]},j=e=>{let t=Math.sign(e);return e=Math.abs(e),(e<=.0031308?e*12.92:1.055*e**(1/2.4)-.055)*t},ne=(e,t,n)=>{let{MtxAdaptMa:r,MtxAdaptMaI:i,MtxXYZ2RGB:a,RefWhiteRGB:o,Xn:s,Yn:c,Zn:l}=D,u=s*r.m00+c*r.m10+l*r.m20,d=s*r.m01+c*r.m11+l*r.m21,f=s*r.m02+c*r.m12+l*r.m22,p=o.X*r.m00+o.Y*r.m10+o.Z*r.m20,m=o.X*r.m01+o.Y*r.m11+o.Z*r.m21,h=o.X*r.m02+o.Y*r.m12+o.Z*r.m22,g=(e*r.m00+t*r.m10+n*r.m20)*(p/u),_=(e*r.m01+t*r.m11+n*r.m21)*(m/d),v=(e*r.m02+t*r.m12+n*r.m22)*(h/f),y=g*i.m00+_*i.m10+v*i.m20,b=g*i.m01+_*i.m11+v*i.m21,x=g*i.m02+_*i.m12+v*i.m22,S=j(y*a.m00+b*a.m10+x*a.m20),C=j(y*a.m01+b*a.m11+x*a.m21),w=j(y*a.m02+b*a.m12+x*a.m22);return[S*255,C*255,w*255]},M=(...e)=>{let[t,n,r,...i]=o(e,`rgb`),[a,s,c]=ae(t,n,r),[l,u,d]=re(a,s,c);return[l,u,d,...i.length>0&&i[0]<1?[i[0]]:[]]};function re(e,t,n){let{Xn:r,Yn:i,Zn:a,kE:o,kK:s}=D,c=e/r,l=t/i,u=n/a,d=c>o?c**(1/3):(s*c+16)/116,f=l>o?l**(1/3):(s*l+16)/116,p=u>o?u**(1/3):(s*u+16)/116;return[116*f-16,500*(d-f),200*(f-p)]}function ie(e){let t=Math.sign(e);return e=Math.abs(e),(e<=.04045?e/12.92:((e+.055)/1.055)**2.4)*t}const ae=(e,t,n)=>{e=ie(e/255),t=ie(t/255),n=ie(n/255);let{MtxRGB2XYZ:r,MtxAdaptMa:i,MtxAdaptMaI:a,Xn:o,Yn:s,Zn:c,As:l,Bs:u,Cs:d}=D,f=e*r.m00+t*r.m10+n*r.m20,p=e*r.m01+t*r.m11+n*r.m21,m=e*r.m02+t*r.m12+n*r.m22,h=o*i.m00+s*i.m10+c*i.m20,g=o*i.m01+s*i.m11+c*i.m21,_=o*i.m02+s*i.m12+c*i.m22,v=f*i.m00+p*i.m10+m*i.m20,y=f*i.m01+p*i.m11+m*i.m21,b=f*i.m02+p*i.m12+m*i.m22;return v*=h/l,y*=g/u,b*=_/d,f=v*a.m00+y*a.m10+b*a.m20,p=v*a.m01+y*a.m11+b*a.m21,m=v*a.m02+y*a.m12+b*a.m22,[f,p,m]};y.prototype.lab=function(){return M(this._rgb)};const oe=(...e)=>new y(...e,`lab`);Object.assign(b,{lab:oe,getLabWhitePoint:A,setLabWhitePoint:k}),v.format.lab=ee,v.autodetect.push({p:2,test:(...e)=>{if(e=o(e,`lab`),a(e)===`array`&&e.length===3)return`lab`}}),y.prototype.darken=function(e=1){let t=this,n=t.lab();return n[0]-=D.Kn*e,new y(n,`lab`).alpha(t.alpha(),!0)},y.prototype.brighten=function(e=1){return this.darken(-e)},y.prototype.darker=y.prototype.darken,y.prototype.brighter=y.prototype.brighten,y.prototype.get=function(e){let[t,n]=e.split(`.`),r=this[t]();if(n){let e=t.indexOf(n)-(t.substr(0,2)===`ok`?2:0);if(e>-1)return r[e];throw Error(`unknown channel ${n} in mode ${t}`)}else return r};const{pow:se}=Math;y.prototype.luminance=function(e,t=`rgb`){if(e!==void 0&&a(e)===`number`){if(e===0)return new y([0,0,0,this._rgb[3]],`rgb`);if(e===1)return new y([255,255,255,this._rgb[3]],`rgb`);let n=this.luminance(),r=20,i=(n,a)=>{let o=n.interpolate(a,.5,t),s=o.luminance();return Math.abs(e-s)<1e-7||!r--?o:s>e?i(n,o):i(o,a)};return new y([...(n>e?i(new y([0,0,0]),this):i(this,new y([255,255,255]))).rgb(),this._rgb[3]])}return ce(...this._rgb.slice(0,3))};const ce=(e,t,n)=>(e=le(e),t=le(t),n=le(n),.2126*e+.7152*t+.0722*n),le=e=>(e/=255,e<=.03928?e/12.92:se((e+.055)/1.055,2.4));var N={},P=(e,t,n=.5,...r)=>{let i=r[0]||`lrgb`;if(!N[i]&&!r.length&&(i=Object.keys(N)[0]),!N[i])throw Error(`interpolation mode ${i} is not defined`);return a(e)!==`object`&&(e=new y(e)),a(t)!==`object`&&(t=new y(t)),N[i](e,t,n).alpha(e.alpha()+n*(t.alpha()-e.alpha()))};y.prototype.mix=y.prototype.interpolate=function(e,t=.5,...n){return P(this,e,t,...n)},y.prototype.premultiply=function(e=!1){let t=this._rgb,n=t[3];return e?(this._rgb=[t[0]*n,t[1]*n,t[2]*n,n],this):new y([t[0]*n,t[1]*n,t[2]*n,n],`rgb`)};const{sin:ue,cos:de}=Math,fe=(...e)=>{let[t,n,r]=o(e,`lch`);return isNaN(r)&&(r=0),r*=h,[t,de(r)*n,ue(r)*n]},pe=(...e)=>{e=o(e,`lch`);let[t,n,r]=e,[i,a,s]=fe(t,n,r),[c,l,u]=ee(i,a,s);return[c,l,u,e.length>3?e[3]:1]},me=(...e)=>pe(..._(o(e,`hcl`))),{sqrt:he,atan2:ge,round:_e}=Math,ve=(...e)=>{let[t,n,r]=o(e,`lab`),i=he(n*n+r*r),a=(ge(r,n)*g+360)%360;return _e(i*1e4)===0&&(a=NaN),[t,i,a]},ye=(...e)=>{let[t,n,r,...i]=o(e,`rgb`),[a,s,c]=M(t,n,r),[l,u,d]=ve(a,s,c);return[l,u,d,...i.length>0&&i[0]<1?[i[0]]:[]]};y.prototype.lch=function(){return ye(this._rgb)},y.prototype.hcl=function(){return _(ye(this._rgb))};const be=(...e)=>new y(...e,`lch`),xe=(...e)=>new y(...e,`hcl`);Object.assign(b,{lch:be,hcl:xe}),v.format.lch=pe,v.format.hcl=me,[`lch`,`hcl`].forEach(e=>v.autodetect.push({p:2,test:(...t)=>{if(t=o(t,e),a(t)===`array`&&t.length===3)return e}})),y.prototype.saturate=function(e=1){let t=this,n=t.lch();return n[1]+=D.Kn*e,n[1]<0&&(n[1]=0),new y(n,`lch`).alpha(t.alpha(),!0)},y.prototype.desaturate=function(e=1){return this.saturate(-e)},y.prototype.set=function(e,t,n=!1){let[r,i]=e.split(`.`),o=this[r]();if(i){let e=r.indexOf(i)-(r.substr(0,2)===`ok`?2:0);if(e>-1){if(a(t)==`string`)switch(t.charAt(0)){case`+`:o[e]+=+t;break;case`-`:o[e]+=+t;break;case`*`:o[e]*=+t.substr(1);break;case`/`:o[e]/=+t.substr(1);break;default:o[e]=+t}else if(a(t)===`number`)o[e]=t;else throw Error(`unsupported value for Color.set`);let i=new y(o,r);return n?(this._rgb=i._rgb,this):i}throw Error(`unknown channel ${i} in mode ${r}`)}else return o},y.prototype.tint=function(e=.5,...t){return P(this,`white`,e,...t)},y.prototype.shade=function(e=.5,...t){return P(this,`black`,e,...t)};const Se=(e,t,n)=>{let r=e._rgb,i=t._rgb;return new y(r[0]+n*(i[0]-r[0]),r[1]+n*(i[1]-r[1]),r[2]+n*(i[2]-r[2]),`rgb`)};N.rgb=Se;const{sqrt:Ce,pow:F}=Math,we=(e,t,n)=>{let[r,i,a]=e._rgb,[o,s,c]=t._rgb;return new y(Ce(F(r,2)*(1-n)+F(o,2)*n),Ce(F(i,2)*(1-n)+F(s,2)*n),Ce(F(a,2)*(1-n)+F(c,2)*n),`rgb`)};N.lrgb=we;const Te=(e,t,n)=>{let r=e.lab(),i=t.lab();return new y(r[0]+n*(i[0]-r[0]),r[1]+n*(i[1]-r[1]),r[2]+n*(i[2]-r[2]),`lab`)};N.lab=Te;var I=(e,t,n,r)=>{let i,a;r===`hsl`?(i=e.hsl(),a=t.hsl()):r===`hsv`?(i=e.hsv(),a=t.hsv()):r===`hcg`?(i=e.hcg(),a=t.hcg()):r===`hsi`?(i=e.hsi(),a=t.hsi()):r===`lch`||r===`hcl`?(r=`hcl`,i=e.hcl(),a=t.hcl()):r===`oklch`&&(i=e.oklch().reverse(),a=t.oklch().reverse());let o,s,c,l,u,d;(r.substr(0,1)===`h`||r===`oklch`)&&([o,c,u]=i,[s,l,d]=a);let f,p,m,h;return!isNaN(o)&&!isNaN(s)?(h=s>o&&s-o>180?s-(o+360):s<o&&o-s>180?s+360-o:s-o,p=o+n*h):isNaN(o)?isNaN(s)?p=NaN:(p=s,(u==1||u==0)&&r!=`hsv`&&(f=l)):(p=o,(d==1||d==0)&&r!=`hsv`&&(f=c)),f===void 0&&(f=c+n*(l-c)),m=u+n*(d-u),r===`oklch`?new y([m,f,p],r):new y([p,f,m],r)};const Ee=(e,t,n)=>I(e,t,n,`lch`);N.lch=Ee,N.hcl=Ee;const De=e=>{if(a(e)==`number`&&e>=0&&e<=16777215)return[e>>16,e>>8&255,e&255,1];throw Error(`unknown num color: `+e)},Oe=(...e)=>{let[t,n,r]=o(e,`rgb`);return(t<<16)+(n<<8)+r};y.prototype.num=function(){return Oe(this._rgb)};const ke=(...e)=>new y(...e,`num`);Object.assign(b,{num:ke}),v.format.num=De,v.autodetect.push({p:5,test:(...e)=>{if(e.length===1&&a(e[0])===`number`&&e[0]>=0&&e[0]<=16777215)return`num`}});const Ae=(e,t,n)=>{let r=e.num();return new y(r+n*(t.num()-r),`num`)};N.num=Ae;const{floor:je}=Math,Me=(...e)=>{e=o(e,`hcg`);let[t,n,r]=e,i,a,s;r*=255;let c=n*255;if(n===0)i=a=s=r;else{t===360&&(t=0),t>360&&(t-=360),t<0&&(t+=360),t/=60;let e=je(t),o=t-e,l=r*(1-n),u=l+c*(1-o),d=l+c*o,f=l+c;switch(e){case 0:[i,a,s]=[f,d,l];break;case 1:[i,a,s]=[u,f,l];break;case 2:[i,a,s]=[l,f,d];break;case 3:[i,a,s]=[l,u,f];break;case 4:[i,a,s]=[d,l,f];break;case 5:[i,a,s]=[f,l,u];break}}return[i,a,s,e.length>3?e[3]:1]},Ne=(...e)=>{let[t,n,r]=o(e,`rgb`),i=l(t,n,r),a=u(t,n,r),s=a-i,c=s*100/255,d=i/(255-s)*100,f;return s===0?f=NaN:(t===a&&(f=(n-r)/s),n===a&&(f=2+(r-t)/s),r===a&&(f=4+(t-n)/s),f*=60,f<0&&(f+=360)),[f,c,d]};y.prototype.hcg=function(){return Ne(this._rgb)};const Pe=(...e)=>new y(...e,`hcg`);b.hcg=Pe,v.format.hcg=Me,v.autodetect.push({p:1,test:(...e)=>{if(e=o(e,`hcg`),a(e)===`array`&&e.length===3)return`hcg`}});const Fe=(e,t,n)=>I(e,t,n,`hcg`);N.hcg=Fe;const{cos:L}=Math,Ie=(...e)=>{e=o(e,`hsi`);let[t,r,i]=e,a,s,c;return isNaN(t)&&(t=0),isNaN(r)&&(r=0),t>360&&(t-=360),t<0&&(t+=360),t/=360,t<1/3?(c=(1-r)/3,a=(1+r*L(p*t)/L(m-p*t))/3,s=1-(c+a)):t<2/3?(t-=1/3,a=(1-r)/3,s=(1+r*L(p*t)/L(m-p*t))/3,c=1-(a+s)):(t-=2/3,s=(1-r)/3,c=(1+r*L(p*t)/L(m-p*t))/3,a=1-(s+c)),a=n(i*a*3),s=n(i*s*3),c=n(i*c*3),[a*255,s*255,c*255,e.length>3?e[3]:1]},{min:Le,sqrt:Re,acos:ze}=Math,Be=(...e)=>{let[t,n,r]=o(e,`rgb`);t/=255,n/=255,r/=255;let i,a=Le(t,n,r),s=(t+n+r)/3,c=s>0?1-a/s:0;return c===0?i=NaN:(i=(t-n+(t-r))/2,i/=Re((t-n)*(t-n)+(t-r)*(n-r)),i=ze(i),r>n&&(i=p-i),i/=p),[i*360,c,s]};y.prototype.hsi=function(){return Be(this._rgb)};const Ve=(...e)=>new y(...e,`hsi`);b.hsi=Ve,v.format.hsi=Ie,v.autodetect.push({p:2,test:(...e)=>{if(e=o(e,`hsi`),a(e)===`array`&&e.length===3)return`hsi`}});const He=(e,t,n)=>I(e,t,n,`hsi`);N.hsi=He;const Ue=(...e)=>{e=o(e,`hsl`);let[t,n,r]=e,i,a,s;if(n===0)i=a=s=r*255;else{let e=[0,0,0],o=[0,0,0],c=r<.5?r*(1+n):r+n-r*n,l=2*r-c,u=t/360;e[0]=u+1/3,e[1]=u,e[2]=u-1/3;for(let t=0;t<3;t++)e[t]<0&&(e[t]+=1),e[t]>1&&--e[t],6*e[t]<1?o[t]=l+(c-l)*6*e[t]:2*e[t]<1?o[t]=c:3*e[t]<2?o[t]=l+(c-l)*(2/3-e[t])*6:o[t]=l;[i,a,s]=[o[0]*255,o[1]*255,o[2]*255]}return e.length>3?[i,a,s,e[3]]:[i,a,s,1]},We=(...e)=>{e=o(e,`rgba`);let[t,n,r]=e;t/=255,n/=255,r/=255;let i=l(t,n,r),a=u(t,n,r),s=(a+i)/2,c,d;return a===i?(c=0,d=NaN):c=s<.5?(a-i)/(a+i):(a-i)/(2-a-i),t==a?d=(n-r)/(a-i):n==a?d=2+(r-t)/(a-i):r==a&&(d=4+(t-n)/(a-i)),d*=60,d<0&&(d+=360),e.length>3&&e[3]!==void 0?[d,c,s,e[3]]:[d,c,s]};y.prototype.hsl=function(){return We(this._rgb)};const Ge=(...e)=>new y(...e,`hsl`);b.hsl=Ge,v.format.hsl=Ue,v.autodetect.push({p:2,test:(...e)=>{if(e=o(e,`hsl`),a(e)===`array`&&e.length===3)return`hsl`}});const Ke=(e,t,n)=>I(e,t,n,`hsl`);N.hsl=Ke;const{floor:qe}=Math,Je=(...e)=>{e=o(e,`hsv`);let[t,n,r]=e,i,a,s;if(r*=255,n===0)i=a=s=r;else{t===360&&(t=0),t>360&&(t-=360),t<0&&(t+=360),t/=60;let e=qe(t),o=t-e,c=r*(1-n),l=r*(1-n*o),u=r*(1-n*(1-o));switch(e){case 0:[i,a,s]=[r,u,c];break;case 1:[i,a,s]=[l,r,c];break;case 2:[i,a,s]=[c,r,u];break;case 3:[i,a,s]=[c,l,r];break;case 4:[i,a,s]=[u,c,r];break;case 5:[i,a,s]=[r,c,l];break}}return[i,a,s,e.length>3?e[3]:1]},{min:Ye,max:Xe}=Math,Ze=(...e)=>{e=o(e,`rgb`);let[t,n,r]=e,i=Ye(t,n,r),a=Xe(t,n,r),s=a-i,c,l,u;return u=a/255,a===0?(c=NaN,l=0):(l=s/a,t===a&&(c=(n-r)/s),n===a&&(c=2+(r-t)/s),r===a&&(c=4+(t-n)/s),c*=60,c<0&&(c+=360)),[c,l,u]};y.prototype.hsv=function(){return Ze(this._rgb)};const Qe=(...e)=>new y(...e,`hsv`);b.hsv=Qe,v.format.hsv=Je,v.autodetect.push({p:2,test:(...e)=>{if(e=o(e,`hsv`),a(e)===`array`&&e.length===3)return`hsv`}});const $e=(e,t,n)=>I(e,t,n,`hsv`);N.hsv=$e;function R(e,t){let n=e.length;Array.isArray(e[0])||(e=[e]),Array.isArray(t[0])||(t=t.map(e=>[e]));let r=t[0].length,i=t[0].map((e,n)=>t.map(e=>e[n])),a=e.map(e=>i.map(t=>Array.isArray(e)?e.reduce((e,n,r)=>e+n*(t[r]||0),0):t.reduce((t,n)=>t+n*e,0)));return n===1&&(a=a[0]),r===1?a.map(e=>e[0]):a}const et=(...e)=>{e=o(e,`lab`);let[t,n,r,...i]=e,[a,s,c]=tt([t,n,r]),[l,u,d]=ne(a,s,c);return[l,u,d,...i.length>0&&i[0]<1?[i[0]]:[]]};function tt(e){return R([[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],R([[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],e).map(e=>e**3))}const nt=(...e)=>{let[t,n,r,...i]=o(e,`rgb`);return[...rt(ae(t,n,r)),...i.length>0&&i[0]<1?[i[0]]:[]]};function rt(e){return R([[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],R([[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],e).map(e=>Math.cbrt(e)))}y.prototype.oklab=function(){return nt(this._rgb)};const it=(...e)=>new y(...e,`oklab`);Object.assign(b,{oklab:it}),v.format.oklab=et,v.autodetect.push({p:2,test:(...e)=>{if(e=o(e,`oklab`),a(e)===`array`&&e.length===3)return`oklab`}});const at=(e,t,n)=>{let r=e.oklab(),i=t.oklab();return new y(r[0]+n*(i[0]-r[0]),r[1]+n*(i[1]-r[1]),r[2]+n*(i[2]-r[2]),`oklab`)};N.oklab=at;const ot=(e,t,n)=>I(e,t,n,`oklch`);N.oklch=ot;const{pow:st,sqrt:ct,PI:lt,cos:ut,sin:dt,atan2:ft}=Math;var pt=(e,t=`lrgb`,n=null)=>{let r=e.length;n||=Array.from(Array(r)).map(()=>1);let i=r/n.reduce(function(e,t){return e+t});if(n.forEach((e,t)=>{n[t]*=i}),e=e.map(e=>new y(e)),t===`lrgb`)return mt(e,n);let a=e.shift(),o=a.get(t),s=[],c=0,l=0;for(let e=0;e<o.length;e++)if(o[e]=(o[e]||0)*n[0],s.push(isNaN(o[e])?0:n[0]),t.charAt(e)===`h`&&!isNaN(o[e])){let t=o[e]/180*lt;c+=ut(t)*n[0],l+=dt(t)*n[0]}let u=a.alpha()*n[0];e.forEach((e,r)=>{let i=e.get(t);u+=e.alpha()*n[r+1];for(let e=0;e<o.length;e++)if(!isNaN(i[e]))if(s[e]+=n[r+1],t.charAt(e)===`h`){let t=i[e]/180*lt;c+=ut(t)*n[r+1],l+=dt(t)*n[r+1]}else o[e]+=i[e]*n[r+1]});for(let e=0;e<o.length;e++)if(t.charAt(e)===`h`){let t=ft(l/s[e],c/s[e])/lt*180;for(;t<0;)t+=360;for(;t>=360;)t-=360;o[e]=t}else o[e]=o[e]/s[e];return u/=r,new y(o,t).alpha(u>.99999?1:u,!0)};const mt=(e,t)=>{let n=e.length,i=[0,0,0,0];for(let r=0;r<e.length;r++){let a=e[r],o=t[r]/n,s=a._rgb;i[0]+=st(s[0],2)*o,i[1]+=st(s[1],2)*o,i[2]+=st(s[2],2)*o,i[3]+=s[3]*o}return i[0]=ct(i[0]),i[1]=ct(i[1]),i[2]=ct(i[2]),i[3]>.9999999&&(i[3]=1),new y(r(i))},{pow:ht}=Math;function z(e){let t=`rgb`,r=b(`#ccc`),i=0,o=[0,1],s=[0,1],c=[],l=[0,0],u=!1,d=[],f=!1,p=0,m=1,h=!1,g={},_=!0,v=1,y=function(e){if(e||=[`#fff`,`#000`],e&&a(e)===`string`&&b.brewer&&b.brewer[e.toLowerCase()]&&(e=b.brewer[e.toLowerCase()]),a(e)===`array`){e.length===1&&(e=[e[0],e[0]]),e=e.slice(0);for(let t=0;t<e.length;t++)e[t]=b(e[t]);c.length=0;for(let t=0;t<e.length;t++)c.push(t/(e.length-1))}return T(),d=e},x=function(e){if(u!=null){let t=u.length-1,n=0;for(;n<t&&e>=u[n];)n++;return n-1}return 0},S=e=>e,C=e=>e,w=function(e,i){let o,s;if(i??=!1,isNaN(e)||e===null)return r;s=i?e:u&&u.length>2?x(e)/(u.length-2):m===p?1:(e-p)/(m-p),s=C(s),i||(s=S(s)),v!==1&&(s=ht(s,v)),s=l[0]+s*(1-l[0]-l[1]),s=n(s,0,1);let f=Math.floor(s*1e4);if(_&&g[f])o=g[f];else{if(a(d)===`array`)for(let e=0;e<c.length;e++){let n=c[e];if(s<=n){o=d[e];break}if(s>=n&&e===c.length-1){o=d[e];break}if(s>n&&s<c[e+1]){s=(s-n)/(c[e+1]-n),o=b.interpolate(d[e],d[e+1],s,t);break}}else a(d)===`function`&&(o=d(s));_&&(g[f]=o)}return o};var T=()=>g={};y(e);let E=function(e){let t=b(w(e));return f&&t[f]?t[f]():t};return E.classes=function(e){if(e!=null){if(a(e)===`array`)u=e,o=[e[0],e[e.length-1]];else{let t=b.analyze(o);u=e===0?[t.min,t.max]:b.limits(t,`e`,e)}return E}return u},E.domain=function(e){if(!arguments.length)return s;s=e.slice(0),p=e[0],m=e[e.length-1],c=[];let t=d.length;if(e.length===t&&p!==m)for(let t of Array.from(e))c.push((t-p)/(m-p));else{for(let e=0;e<t;e++)c.push(e/(t-1));if(e.length>2){let t=e.map((t,n)=>n/(e.length-1)),n=e.map(e=>(e-p)/(m-p));n.every((e,n)=>t[n]===e)||(C=e=>{if(e<=0||e>=1)return e;let r=0;for(;e>=n[r+1];)r++;let i=(e-n[r])/(n[r+1]-n[r]);return t[r]+i*(t[r+1]-t[r])})}}return o=[p,m],E},E.mode=function(e){return arguments.length?(t=e,T(),E):t},E.range=function(e,t){return y(e,t),E},E.out=function(e){return f=e,E},E.spread=function(e){return arguments.length?(i=e,E):i},E.correctLightness=function(e){return e??=!0,h=e,T(),S=h?function(e){let t=w(0,!0).lab()[0],n=w(1,!0).lab()[0],r=t>n,i=w(e,!0).lab()[0],a=t+(n-t)*e,o=i-a,s=0,c=1,l=20;for(;Math.abs(o)>.01&&l-- >0;)(function(){return r&&(o*=-1),o<0?(s=e,e+=(c-e)*.5):(c=e,e+=(s-e)*.5),i=w(e,!0).lab()[0],o=i-a})();return e}:e=>e,E},E.padding=function(e){return e==null?l:(a(e)===`number`&&(e=[e,e]),l=e,E)},E.colors=function(t,n){arguments.length<2&&(n=`hex`);let r=[];if(arguments.length===0)r=d.slice(0);else if(t===1)r=[E(.5)];else if(t>1){let e=o[0],n=o[1]-e;r=gt(0,t,!1).map(r=>E(e+r/(t-1)*n))}else{e=[];let t=[];if(u&&u.length>2)for(let e=1,n=u.length,r=1<=n;r?e<n:e>n;r?e++:e--)t.push((u[e-1]+u[e])*.5);else t=o;r=t.map(e=>E(e))}return b[n]&&(r=r.map(e=>e[n]())),r},E.cache=function(e){return e==null?_:(_=e,E)},E.gamma=function(e){return e==null?v:(v=e,E)},E.nodata=function(e){return e==null?r:(r=b(e),E)},E}function gt(e,t,n){let r=[],i=e<t,a=n?i?t+1:t-1:t;for(let t=e;i?t<a:t>a;i?t++:t--)r.push(t);return r}const _t=function(e){let t=[1,1];for(let n=1;n<e;n++){let e=[1];for(let n=1;n<=t.length;n++)e[n]=(t[n]||0)+t[n-1];t=e}return t},vt=function(e){let t,n,r,i;if(e=e.map(e=>new y(e)),e.length===2)[n,r]=e.map(e=>e.lab()),t=function(e){return new y([0,1,2].map(t=>n[t]+e*(r[t]-n[t])),`lab`)};else if(e.length===3)[n,r,i]=e.map(e=>e.lab()),t=function(e){return new y([0,1,2].map(t=>(1-e)*(1-e)*n[t]+2*(1-e)*e*r[t]+e*e*i[t]),`lab`)};else if(e.length===4){let a;[n,r,i,a]=e.map(e=>e.lab()),t=function(e){return new y([0,1,2].map(t=>(1-e)*(1-e)*(1-e)*n[t]+3*(1-e)*(1-e)*e*r[t]+3*(1-e)*e*e*i[t]+e*e*e*a[t]),`lab`)}}else if(e.length>=5){let n,r,i;n=e.map(e=>e.lab()),i=e.length-1,r=_t(i),t=function(e){let t=1-e;return new y([0,1,2].map(a=>n.reduce((n,o,s)=>n+r[s]*t**(i-s)*e**s*o[a],0)),`lab`)}}else throw RangeError(`No point in running bezier with only one color.`);return t};var yt=e=>{let t=vt(e);return t.scale=()=>z(t),t};const{round:bt}=Math;y.prototype.rgb=function(e=!0){return e===!1?this._rgb.slice(0,3):this._rgb.slice(0,3).map(bt)},y.prototype.rgba=function(e=!0){return this._rgb.slice(0,4).map((t,n)=>n<3?e===!1?t:bt(t):t)};const xt=(...e)=>new y(...e,`rgb`);Object.assign(b,{rgb:xt}),v.format.rgb=(...e)=>{let t=o(e,`rgba`);return t[3]===void 0&&(t[3]=1),t},v.autodetect.push({p:3,test:(...e)=>{if(e=o(e,`rgba`),a(e)===`array`&&(e.length===3||e.length===4&&a(e[3])==`number`&&e[3]>=0&&e[3]<=1))return`rgb`}});const B=(e,t,n)=>{if(!B[n])throw Error(`unknown blend mode `+n);return B[n](e,t)},V=e=>(t,n)=>{let r=b(n).rgb(),i=b(t).rgb();return b.rgb(e(r,i))},H=e=>(t,n)=>{let r=[];return r[0]=e(t[0],n[0]),r[1]=e(t[1],n[1]),r[2]=e(t[2],n[2]),r},St=e=>e,Ct=(e,t)=>e*t/255,wt=(e,t)=>e>t?t:e,Tt=(e,t)=>e>t?e:t,Et=(e,t)=>255*(1-(1-e/255)*(1-t/255)),Dt=(e,t)=>t<128?2*e*t/255:255*(1-2*(1-e/255)*(1-t/255)),Ot=(e,t)=>255*(1-(1-t/255)/(e/255)),kt=(e,t)=>e===255?255:(e=t/255*255/(1-e/255),e>255?255:e);B.normal=V(H(St)),B.multiply=V(H(Ct)),B.screen=V(H(Et)),B.overlay=V(H(Dt)),B.darken=V(H(wt)),B.lighten=V(H(Tt)),B.dodge=V(H(kt)),B.burn=V(H(Ot));const{pow:At,sin:jt,cos:Mt}=Math;function Nt(e=300,t=-1.5,n=1,i=1,o=[0,1]){let s=0,c;a(o)===`array`?c=o[1]-o[0]:(c=0,o=[o,o]);let l=function(a){let l=p*((e+120)/360+t*a),u=At(o[0]+c*a,i),d=(s===0?n:n[0]+a*s)*u*(1-u)/2,f=Mt(l),m=jt(l),h=u+d*(-.14861*f+1.78277*m),g=u+d*(-.29227*f-.90649*m),_=u+1.97294*f*d;return b(r([h*255,g*255,_*255,1]))};return l.start=function(t){return t==null?e:(e=t,l)},l.rotations=function(e){return e==null?t:(t=e,l)},l.gamma=function(e){return e==null?i:(i=e,l)},l.hue=function(e){return e==null?n:(n=e,a(n)===`array`?(s=n[1]-n[0],s===0&&(n=n[1])):s=0,l)},l.lightness=function(e){return e==null?o:(a(e)===`array`?(o=e,c=e[1]-e[0]):(o=[e,e],c=0),l)},l.scale=()=>b.scale(l),l.hue(n),l}const{floor:Pt,random:Ft}=Math;var It=(e=Ft)=>{let t=`#`;for(let n=0;n<6;n++)t+=`0123456789abcdef`.charAt(Pt(e()*16));return new y(t,`hex`)};const{log:Lt,pow:Rt,floor:zt,abs:Bt}=Math;function Vt(e,t=null){let n={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};return a(e)===`object`&&(e=Object.values(e)),e.forEach(e=>{t&&a(e)===`object`&&(e=e[t]),e!=null&&!isNaN(e)&&(n.values.push(e),n.sum+=e,e<n.min&&(n.min=e),e>n.max&&(n.max=e),n.count+=1)}),n.domain=[n.min,n.max],n.limits=(e,t)=>Ht(n,e,t),n}function Ht(e,t=`equal`,n=7){a(e)==`array`&&(e=Vt(e));let{min:r,max:i}=e,o=e.values.sort((e,t)=>e-t);if(n===1)return[r,i];let s=[];if(t.substr(0,1)===`c`&&(s.push(r),s.push(i)),t.substr(0,1)===`e`){s.push(r);for(let e=1;e<n;e++)s.push(r+e/n*(i-r));s.push(i)}else if(t.substr(0,1)===`l`){if(r<=0)throw Error(`Logarithmic scales are only possible for values > 0`);let e=Math.LOG10E*Lt(r),t=Math.LOG10E*Lt(i);s.push(r);for(let r=1;r<n;r++)s.push(Rt(10,e+r/n*(t-e)));s.push(i)}else if(t.substr(0,1)===`q`){s.push(r);for(let e=1;e<n;e++){let t=(o.length-1)*e/n,r=zt(t);if(r===t)s.push(o[r]);else{let e=t-r;s.push(o[r]*(1-e)+o[r+1]*e)}}s.push(i)}else if(t.substr(0,1)===`k`){let e,t=o.length,a=Array(t),c=Array(n),l=!0,u=0,d=null;d=[],d.push(r);for(let e=1;e<n;e++)d.push(r+e/n*(i-r));for(d.push(i);l;){for(let e=0;e<n;e++)c[e]=0;for(let e=0;e<t;e++){let t=o[e],r=Number.MAX_VALUE,i;for(let o=0;o<n;o++){let n=Bt(d[o]-t);n<r&&(r=n,i=o),c[i]++,a[e]=i}}let r=Array(n);for(let e=0;e<n;e++)r[e]=null;for(let n=0;n<t;n++)e=a[n],r[e]===null?r[e]=o[n]:r[e]+=o[n];for(let e=0;e<n;e++)r[e]*=1/c[e];l=!1;for(let e=0;e<n;e++)if(r[e]!==d[e]){l=!0;break}d=r,u++,u>200&&(l=!1)}let f={};for(let e=0;e<n;e++)f[e]=[];for(let n=0;n<t;n++)e=a[n],f[e].push(o[n]);let p=[];for(let e=0;e<n;e++)p.push(f[e][0]),p.push(f[e][f[e].length-1]);p=p.sort((e,t)=>e-t),s.push(p[0]);for(let e=1;e<p.length;e+=2){let t=p[e];!isNaN(t)&&s.indexOf(t)===-1&&s.push(t)}}return s}var Ut=(e,t)=>{e=new y(e),t=new y(t);let n=e.luminance(),r=t.luminance();return n>r?(n+.05)/(r+.05):(r+.05)/(n+.05)};
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
*
|
|
5
|
+
* The APCA contrast prediction algorithm is based of the formulas published
|
|
6
|
+
* in the APCA-1.0.98G specification by Myndex. The specification is available at:
|
|
7
|
+
* https://raw.githubusercontent.com/Myndex/apca-w3/master/images/APCAw3_0.1.17_APCA0.0.98G.svg
|
|
8
|
+
*
|
|
9
|
+
* Note that the APCA implementation is still beta, so please update to
|
|
10
|
+
* future versions of chroma.js when they become available.
|
|
11
|
+
*
|
|
12
|
+
* You can read more about the APCA Readability Criterion at
|
|
13
|
+
* https://readtech.org/ARC/
|
|
14
|
+
*/
|
|
15
|
+
const Wt=.027,Gt=1.14,U=.022,Kt=1.414;var qt=(e,t)=>{e=new y(e),t=new y(t),e.alpha()<1&&(e=P(t,e,e.alpha(),`rgb`));let n=Jt(...e.rgb()),r=Jt(...t.rgb()),i=n>=U?n:n+(U-n)**Kt,a=r>=U?r:r+(U-r)**Kt,o=a**.56-i**.57,s=a**.65-i**.62,c=Math.abs(a-i)<5e-4?0:i<a?o*Gt:s*Gt;return(Math.abs(c)<.1?0:c>0?c-Wt:c+Wt)*100};function Jt(e,t,n){return .2126729*(e/255)**2.4+.7151522*(t/255)**2.4+.072175*(n/255)**2.4}const{sqrt:W,pow:G,min:Yt,max:Xt,atan2:Zt,abs:Qt,cos:K,sin:$t,exp:en,PI:tn}=Math;function nn(e,t,n=1,r=1,i=1){var a=function(e){return 360*e/(2*tn)},o=function(e){return 2*tn*e/360};e=new y(e),t=new y(t);let[s,c,l]=Array.from(e.lab()),[u,d,f]=Array.from(t.lab()),p=(s+u)/2,m=(W(G(c,2)+G(l,2))+W(G(d,2)+G(f,2)))/2,h=.5*(1-W(G(m,7)/(G(m,7)+G(25,7)))),g=c*(1+h),_=d*(1+h),v=W(G(g,2)+G(l,2)),b=W(G(_,2)+G(f,2)),x=(v+b)/2,S=a(Zt(l,g)),C=a(Zt(f,_)),w=S>=0?S:S+360,T=C>=0?C:C+360,E=Qt(w-T)>180?(w+T+360)/2:(w+T)/2,D=1-.17*K(o(E-30))+.24*K(o(2*E))+.32*K(o(3*E+6))-.2*K(o(4*E-63)),O=T-w;O=Qt(O)<=180?O:T<=w?O+360:O-360,O=2*W(v*b)*$t(o(O)/2);let k=u-s,A=b-v,ee=1+.015*G(p-50,2)/W(20+G(p-50,2)),te=1+.045*x,j=1+.015*x*D,ne=30*en(-G((E-275)/25,2)),M=-(2*W(G(x,7)/(G(x,7)+G(25,7))))*$t(2*o(ne));return Xt(0,Yt(100,W(G(k/(n*ee),2)+G(A/(r*te),2)+G(O/(i*j),2)+M*(A/(r*te))*(O/(i*j)))))}function rn(e,t,n=`lab`){e=new y(e),t=new y(t);let r=e.get(n),i=t.get(n),a=0;for(let e in r){let t=(r[e]||0)-(i[e]||0);a+=t*t}return Math.sqrt(a)}var an=(...e)=>{try{return new y(...e),!0}catch{return!1}},on={cool(){return z([b.hsl(180,1,.9),b.hsl(250,.7,.4)])},hot(){return z([`#000`,`#f00`,`#ff0`,`#fff`],[0,.25,.75,1]).mode(`rgb`)}};const sn={OrRd:[`#fff7ec`,`#fee8c8`,`#fdd49e`,`#fdbb84`,`#fc8d59`,`#ef6548`,`#d7301f`,`#b30000`,`#7f0000`],PuBu:[`#fff7fb`,`#ece7f2`,`#d0d1e6`,`#a6bddb`,`#74a9cf`,`#3690c0`,`#0570b0`,`#045a8d`,`#023858`],BuPu:[`#f7fcfd`,`#e0ecf4`,`#bfd3e6`,`#9ebcda`,`#8c96c6`,`#8c6bb1`,`#88419d`,`#810f7c`,`#4d004b`],Oranges:[`#fff5eb`,`#fee6ce`,`#fdd0a2`,`#fdae6b`,`#fd8d3c`,`#f16913`,`#d94801`,`#a63603`,`#7f2704`],BuGn:[`#f7fcfd`,`#e5f5f9`,`#ccece6`,`#99d8c9`,`#66c2a4`,`#41ae76`,`#238b45`,`#006d2c`,`#00441b`],YlOrBr:[`#ffffe5`,`#fff7bc`,`#fee391`,`#fec44f`,`#fe9929`,`#ec7014`,`#cc4c02`,`#993404`,`#662506`],YlGn:[`#ffffe5`,`#f7fcb9`,`#d9f0a3`,`#addd8e`,`#78c679`,`#41ab5d`,`#238443`,`#006837`,`#004529`],Reds:[`#fff5f0`,`#fee0d2`,`#fcbba1`,`#fc9272`,`#fb6a4a`,`#ef3b2c`,`#cb181d`,`#a50f15`,`#67000d`],RdPu:[`#fff7f3`,`#fde0dd`,`#fcc5c0`,`#fa9fb5`,`#f768a1`,`#dd3497`,`#ae017e`,`#7a0177`,`#49006a`],Greens:[`#f7fcf5`,`#e5f5e0`,`#c7e9c0`,`#a1d99b`,`#74c476`,`#41ab5d`,`#238b45`,`#006d2c`,`#00441b`],YlGnBu:[`#ffffd9`,`#edf8b1`,`#c7e9b4`,`#7fcdbb`,`#41b6c4`,`#1d91c0`,`#225ea8`,`#253494`,`#081d58`],Purples:[`#fcfbfd`,`#efedf5`,`#dadaeb`,`#bcbddc`,`#9e9ac8`,`#807dba`,`#6a51a3`,`#54278f`,`#3f007d`],GnBu:[`#f7fcf0`,`#e0f3db`,`#ccebc5`,`#a8ddb5`,`#7bccc4`,`#4eb3d3`,`#2b8cbe`,`#0868ac`,`#084081`],Greys:[`#ffffff`,`#f0f0f0`,`#d9d9d9`,`#bdbdbd`,`#969696`,`#737373`,`#525252`,`#252525`,`#000000`],YlOrRd:[`#ffffcc`,`#ffeda0`,`#fed976`,`#feb24c`,`#fd8d3c`,`#fc4e2a`,`#e31a1c`,`#bd0026`,`#800026`],PuRd:[`#f7f4f9`,`#e7e1ef`,`#d4b9da`,`#c994c7`,`#df65b0`,`#e7298a`,`#ce1256`,`#980043`,`#67001f`],Blues:[`#f7fbff`,`#deebf7`,`#c6dbef`,`#9ecae1`,`#6baed6`,`#4292c6`,`#2171b5`,`#08519c`,`#08306b`],PuBuGn:[`#fff7fb`,`#ece2f0`,`#d0d1e6`,`#a6bddb`,`#67a9cf`,`#3690c0`,`#02818a`,`#016c59`,`#014636`],Viridis:[`#440154`,`#482777`,`#3f4a8a`,`#31678e`,`#26838f`,`#1f9d8a`,`#6cce5a`,`#b6de2b`,`#fee825`],Spectral:[`#9e0142`,`#d53e4f`,`#f46d43`,`#fdae61`,`#fee08b`,`#ffffbf`,`#e6f598`,`#abdda4`,`#66c2a5`,`#3288bd`,`#5e4fa2`],RdYlGn:[`#a50026`,`#d73027`,`#f46d43`,`#fdae61`,`#fee08b`,`#ffffbf`,`#d9ef8b`,`#a6d96a`,`#66bd63`,`#1a9850`,`#006837`],RdBu:[`#67001f`,`#b2182b`,`#d6604d`,`#f4a582`,`#fddbc7`,`#f7f7f7`,`#d1e5f0`,`#92c5de`,`#4393c3`,`#2166ac`,`#053061`],PiYG:[`#8e0152`,`#c51b7d`,`#de77ae`,`#f1b6da`,`#fde0ef`,`#f7f7f7`,`#e6f5d0`,`#b8e186`,`#7fbc41`,`#4d9221`,`#276419`],PRGn:[`#40004b`,`#762a83`,`#9970ab`,`#c2a5cf`,`#e7d4e8`,`#f7f7f7`,`#d9f0d3`,`#a6dba0`,`#5aae61`,`#1b7837`,`#00441b`],RdYlBu:[`#a50026`,`#d73027`,`#f46d43`,`#fdae61`,`#fee090`,`#ffffbf`,`#e0f3f8`,`#abd9e9`,`#74add1`,`#4575b4`,`#313695`],BrBG:[`#543005`,`#8c510a`,`#bf812d`,`#dfc27d`,`#f6e8c3`,`#f5f5f5`,`#c7eae5`,`#80cdc1`,`#35978f`,`#01665e`,`#003c30`],RdGy:[`#67001f`,`#b2182b`,`#d6604d`,`#f4a582`,`#fddbc7`,`#ffffff`,`#e0e0e0`,`#bababa`,`#878787`,`#4d4d4d`,`#1a1a1a`],PuOr:[`#7f3b08`,`#b35806`,`#e08214`,`#fdb863`,`#fee0b6`,`#f7f7f7`,`#d8daeb`,`#b2abd2`,`#8073ac`,`#542788`,`#2d004b`],Set2:[`#66c2a5`,`#fc8d62`,`#8da0cb`,`#e78ac3`,`#a6d854`,`#ffd92f`,`#e5c494`,`#b3b3b3`],Accent:[`#7fc97f`,`#beaed4`,`#fdc086`,`#ffff99`,`#386cb0`,`#f0027f`,`#bf5b17`,`#666666`],Set1:[`#e41a1c`,`#377eb8`,`#4daf4a`,`#984ea3`,`#ff7f00`,`#ffff33`,`#a65628`,`#f781bf`,`#999999`],Set3:[`#8dd3c7`,`#ffffb3`,`#bebada`,`#fb8072`,`#80b1d3`,`#fdb462`,`#b3de69`,`#fccde5`,`#d9d9d9`,`#bc80bd`,`#ccebc5`,`#ffed6f`],Dark2:[`#1b9e77`,`#d95f02`,`#7570b3`,`#e7298a`,`#66a61e`,`#e6ab02`,`#a6761d`,`#666666`],Paired:[`#a6cee3`,`#1f78b4`,`#b2df8a`,`#33a02c`,`#fb9a99`,`#e31a1c`,`#fdbf6f`,`#ff7f00`,`#cab2d6`,`#6a3d9a`,`#ffff99`,`#b15928`],Pastel2:[`#b3e2cd`,`#fdcdac`,`#cbd5e8`,`#f4cae4`,`#e6f5c9`,`#fff2ae`,`#f1e2cc`,`#cccccc`],Pastel1:[`#fbb4ae`,`#b3cde3`,`#ccebc5`,`#decbe4`,`#fed9a6`,`#ffffcc`,`#e5d8bd`,`#fddaec`,`#f2f2f2`]},cn=Object.keys(sn),ln=new Map(cn.map(e=>[e.toLowerCase(),e])),un=typeof Proxy==`function`?new Proxy(sn,{get(e,t){let n=t.toLowerCase();if(ln.has(n))return e[ln.get(n)]},getOwnPropertyNames(){return Object.getOwnPropertyNames(cn)}}):sn,dn=(...e)=>{e=o(e,`cmyk`);let[t,n,r,i]=e,a=e.length>4?e[4]:1;return i===1?[0,0,0,a]:[t>=1?0:255*(1-t)*(1-i),n>=1?0:255*(1-n)*(1-i),r>=1?0:255*(1-r)*(1-i),a]},{max:fn}=Math,pn=(...e)=>{let[t,n,r]=o(e,`rgb`);t/=255,n/=255,r/=255;let i=1-fn(t,fn(n,r)),a=i<1?1/(1-i):0;return[(1-t-i)*a,(1-n-i)*a,(1-r-i)*a,i]};y.prototype.cmyk=function(){return pn(this._rgb)};const mn=(...e)=>new y(...e,`cmyk`);Object.assign(b,{cmyk:mn}),v.format.cmyk=dn,v.autodetect.push({p:2,test:(...e)=>{if(e=o(e,`cmyk`),a(e)===`array`&&e.length===4)return`cmyk`}});const hn=(...e)=>{let t=o(e,`hsla`),n=s(e)||`lsa`;return t[0]=d(t[0]||0)+`deg`,t[1]=d(t[1]*100)+`%`,t[2]=d(t[2]*100)+`%`,n===`hsla`||t.length>3&&t[3]<1?(t[3]=`/ `+(t.length>3?t[3]:1),n=`hsla`):t.length=3,`${n.substr(0,3)}(${t.join(` `)})`},gn=(...e)=>{let t=o(e,`lab`),n=s(e)||`lab`;return t[0]=d(t[0])+`%`,t[1]=d(t[1]),t[2]=d(t[2]),n===`laba`||t.length>3&&t[3]<1?t[3]=`/ `+(t.length>3?t[3]:1):t.length=3,`lab(${t.join(` `)})`},_n=(...e)=>{let t=o(e,`lch`),n=s(e)||`lab`;return t[0]=d(t[0])+`%`,t[1]=d(t[1]),t[2]=isNaN(t[2])?`none`:d(t[2])+`deg`,n===`lcha`||t.length>3&&t[3]<1?t[3]=`/ `+(t.length>3?t[3]:1):t.length=3,`lch(${t.join(` `)})`},vn=(...e)=>{let t=o(e,`lab`);return t[0]=d(t[0]*100)+`%`,t[1]=f(t[1]),t[2]=f(t[2]),t.length>3&&t[3]<1?t[3]=`/ `+(t.length>3?t[3]:1):t.length=3,`oklab(${t.join(` `)})`},yn=(...e)=>{let[t,n,r,...i]=o(e,`rgb`),[a,s,c]=nt(t,n,r),[l,u,d]=ve(a,s,c);return[l,u,d,...i.length>0&&i[0]<1?[i[0]]:[]]},bn=(...e)=>{let t=o(e,`lch`);return t[0]=d(t[0]*100)+`%`,t[1]=f(t[1]),t[2]=isNaN(t[2])?`none`:d(t[2])+`deg`,t.length>3&&t[3]<1?t[3]=`/ `+(t.length>3?t[3]:1):t.length=3,`oklch(${t.join(` `)})`},{round:xn}=Math,Sn=(...e)=>{let t=o(e,`rgba`),n=s(e)||`rgb`;if(n.substr(0,3)===`hsl`)return hn(We(t),n);if(n.substr(0,3)===`lab`){let e=A();k(`d50`);let r=gn(M(t),n);return k(e),r}if(n.substr(0,3)===`lch`){let e=A();k(`d50`);let r=_n(ye(t),n);return k(e),r}return n.substr(0,5)===`oklab`?vn(nt(t)):n.substr(0,5)===`oklch`?bn(yn(t)):(t[0]=xn(t[0]),t[1]=xn(t[1]),t[2]=xn(t[2]),(n===`rgba`||t.length>3&&t[3]<1)&&(t[3]=`/ `+(t.length>3?t[3]:1),n=`rgba`),`${n.substr(0,3)}(${t.slice(0,n===`rgb`?3:4).join(` `)})`)},Cn=(...e)=>{e=o(e,`lch`);let[t,n,r,...i]=e,[a,s,c]=fe(t,n,r),[l,u,d]=et(a,s,c);return[l,u,d,...i.length>0&&i[0]<1?[i[0]]:[]]},q=`((?:-?\\d+)|(?:-?\\d+(?:\\.\\d+)?)%|none)`,J=`((?:-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)%?)|none)`,Y=`((?:-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)%)|none)`,wn=`\\s*,\\s*`,X=`((?:-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:deg)?)|none)`,Tn=RegExp(`^rgba?\\(\\s*`+[q,q,q].join(`\\s+`)+`\\s*(?:\\/\\s*((?:[01]|[01]?\\.\\d+)|\\d+(?:\\.\\d+)?%))?\\)$`),En=RegExp(`^rgb\\(\\s*`+[q,q,q].join(wn)+`\\s*\\)$`),Dn=RegExp(`^rgba\\(\\s*`+[q,q,q,J].join(wn)+`\\s*\\)$`),On=RegExp(`^hsla?\\(\\s*`+[X,Y,Y].join(`\\s+`)+`\\s*(?:\\/\\s*((?:[01]|[01]?\\.\\d+)|\\d+(?:\\.\\d+)?%))?\\)$`),kn=RegExp(`^hsl?\\(\\s*`+[X,Y,Y].join(wn)+`\\s*\\)$`),An=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,jn=RegExp(`^lab\\(\\s*`+[J,J,J].join(`\\s+`)+`\\s*(?:\\/\\s*((?:[01]|[01]?\\.\\d+)|\\d+(?:\\.\\d+)?%))?\\)$`),Mn=RegExp(`^lch\\(\\s*`+[J,J,X].join(`\\s+`)+`\\s*(?:\\/\\s*((?:[01]|[01]?\\.\\d+)|\\d+(?:\\.\\d+)?%))?\\)$`),Nn=RegExp(`^oklab\\(\\s*`+[J,J,J].join(`\\s+`)+`\\s*(?:\\/\\s*((?:[01]|[01]?\\.\\d+)|\\d+(?:\\.\\d+)?%))?\\)$`),Pn=RegExp(`^oklch\\(\\s*`+[J,J,X].join(`\\s+`)+`\\s*(?:\\/\\s*((?:[01]|[01]?\\.\\d+)|\\d+(?:\\.\\d+)?%))?\\)$`),{round:Fn}=Math,Z=e=>e.map((e,t)=>t<=2?n(Fn(e),0,255):e),Q=(e,t=0,n=100,r=!1)=>(typeof e==`string`&&e.endsWith(`%`)&&(e=parseFloat(e.substring(0,e.length-1))/100,e=r?t+(e+1)*.5*(n-t):t+e*(n-t)),+e),$=(e,t)=>e===`none`?t:e,In=e=>{if(e=e.toLowerCase().trim(),e===`transparent`)return[0,0,0,0];let t;if(v.format.named)try{return v.format.named(e)}catch{}if((t=e.match(Tn))||(t=e.match(En))){let e=t.slice(1,4);for(let t=0;t<3;t++)e[t]=+Q($(e[t],0),0,255);e=Z(e);let n=t[4]===void 0?1:+Q(t[4],0,1);return e[3]=n,e}if(t=e.match(Dn)){let e=t.slice(1,5);for(let t=0;t<4;t++)e[t]=+Q(e[t],0,255);return e}if((t=e.match(On))||(t=e.match(kn))){let e=t.slice(1,4);e[0]=+$(e[0].replace(`deg`,``),0),e[1]=Q($(e[1],0),0,100)*.01,e[2]=Q($(e[2],0),0,100)*.01;let n=Z(Ue(e));return n[3]=t[4]===void 0?1:+Q(t[4],0,1),n}if(t=e.match(An)){let e=t.slice(1,4);e[1]*=.01,e[2]*=.01;let n=Ue(e);for(let e=0;e<3;e++)n[e]=Fn(n[e]);return n[3]=+t[4],n}if(t=e.match(jn)){let e=t.slice(1,4);e[0]=Q($(e[0],0),0,100),e[1]=Q($(e[1],0),-125,125,!0),e[2]=Q($(e[2],0),-125,125,!0);let n=A();k(`d50`);let r=Z(ee(e));return k(n),r[3]=t[4]===void 0?1:+Q(t[4],0,1),r}if(t=e.match(Mn)){let e=t.slice(1,4);e[0]=Q(e[0],0,100),e[1]=Q($(e[1],0),0,150,!1),e[2]=+$(e[2].replace(`deg`,``),0);let n=A();k(`d50`);let r=Z(pe(e));return k(n),r[3]=t[4]===void 0?1:+Q(t[4],0,1),r}if(t=e.match(Nn)){let e=t.slice(1,4);e[0]=Q($(e[0],0),0,1),e[1]=Q($(e[1],0),-.4,.4,!0),e[2]=Q($(e[2],0),-.4,.4,!0);let n=Z(et(e));return n[3]=t[4]===void 0?1:+Q(t[4],0,1),n}if(t=e.match(Pn)){let e=t.slice(1,4);e[0]=Q($(e[0],0),0,1),e[1]=Q($(e[1],0),0,.4,!1),e[2]=+$(e[2].replace(`deg`,``),0);let n=Z(Cn(e));return n[3]=t[4]===void 0?1:+Q(t[4],0,1),n}};In.test=e=>Tn.test(e)||On.test(e)||jn.test(e)||Mn.test(e)||Nn.test(e)||Pn.test(e)||En.test(e)||Dn.test(e)||kn.test(e)||An.test(e)||e===`transparent`,y.prototype.css=function(e){return Sn(this._rgb,e)};const Ln=(...e)=>new y(...e,`css`);b.css=Ln,v.format.css=In,v.autodetect.push({p:5,test:(e,...t)=>{if(!t.length&&a(e)===`string`&&In.test(e))return`css`}}),v.format.gl=(...e)=>{let t=o(e,`rgba`);return t[0]*=255,t[1]*=255,t[2]*=255,t};const Rn=(...e)=>new y(...e,`gl`);b.gl=Rn,y.prototype.gl=function(){let e=this._rgb;return[e[0]/255,e[1]/255,e[2]/255,e[3]]},y.prototype.hex=function(e){return E(this._rgb,e)};const zn=(...e)=>new y(...e,`hex`);b.hex=zn,v.format.hex=w,v.autodetect.push({p:4,test:(e,...t)=>{if(!t.length&&a(e)===`string`&&[3,4,5,6,7,8,9].indexOf(e.length)>=0)return`hex`}});const{log:Bn}=Math,Vn=e=>{let t=e/100,n,r,i;return t<66?(n=255,r=t<6?0:-155.25485562709179-.44596950469579133*(r=t-2)+104.49216199393888*Bn(r),i=t<20?0:-254.76935184120902+.8274096064007395*(i=t-10)+115.67994401066147*Bn(i)):(n=351.97690566805693+.114206453784165*(n=t-55)-40.25366309332127*Bn(n),r=325.4494125711974+.07943456536662342*(r=t-50)-28.0852963507957*Bn(r),i=255),[n,r,i,1]},{round:Hn}=Math,Un=(...e)=>{let t=o(e,`rgb`),n=t[0],r=t[2],i=1e3,a=4e4,s;for(;a-i>.4;){s=(a+i)*.5;let e=Vn(s);e[2]/e[0]>=r/n?a=s:i=s}return Hn(s)};y.prototype.temp=y.prototype.kelvin=y.prototype.temperature=function(){return Un(this._rgb)};const Wn=(...e)=>new y(...e,`temp`);Object.assign(b,{temp:Wn,kelvin:Wn,temperature:Wn}),v.format.temp=v.format.kelvin=v.format.temperature=Vn,y.prototype.oklch=function(){return yn(this._rgb)};const Gn=(...e)=>new y(...e,`oklch`);Object.assign(b,{oklch:Gn}),v.format.oklch=Cn,v.autodetect.push({p:2,test:(...e)=>{if(e=o(e,`oklch`),a(e)===`array`&&e.length===3)return`oklch`}}),Object.assign(b,{analyze:Vt,average:pt,bezier:yt,blend:B,brewer:un,Color:y,colors:x,contrast:Ut,contrastAPCA:qt,cubehelix:Nt,deltaE:nn,distance:rn,input:v,interpolate:P,limits:Ht,mix:P,random:It,scale:z,scales:on,valid:an});var Kn=b;export{Kn as t};
|