likec4 1.48.0 → 1.50.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/README.md +11 -1
- package/__app__/src/likec4.js +5941 -4496
- package/__app__/src/routes/index.js +3 -153
- package/__app__/src/routes/projects.js +21 -1087
- package/__app__/src/routes/single.js +1228 -16
- package/__app__/src/style.css +1 -1
- package/__app__/src/vendors.js +4649 -1897
- package/__app__/src/webcomponent.js +1 -1
- package/config/schema.json +169 -141
- package/dist/THIRD-PARTY-LICENSES.md +1769 -0
- package/dist/_chunks/LikeC4.mjs +1154 -202
- package/dist/_chunks/binary.mjs +72 -0
- package/dist/_chunks/index.d.mts +234 -140
- package/dist/_chunks/index2.d.mts +2043 -1828
- package/dist/_chunks/libs/@chevrotain/cst-dts-gen.mjs +30 -0
- package/dist/_chunks/libs/@chevrotain/regexp-to-ast.mjs +9 -785
- package/dist/_chunks/libs/@chevrotain/utils.mjs +1 -37
- package/dist/_chunks/libs/@hono/mcp.mjs +34 -0
- package/dist/_chunks/libs/@hono/node-server.mjs +1 -436
- package/dist/_chunks/libs/@logtape/logtape.d.mts +741 -0
- package/dist/_chunks/libs/@logtape/logtape.mjs +6 -1354
- package/dist/_chunks/libs/@lume/kiwi.mjs +1 -1355
- package/dist/_chunks/libs/@modelcontextprotocol/sdk.d.mts +114 -14
- package/dist/_chunks/libs/@modelcontextprotocol/sdk.mjs +12 -25105
- package/dist/_chunks/libs/@msgpack/msgpack.mjs +1 -1503
- package/dist/_chunks/libs/@nanostores/react.d.mts +61 -1
- package/dist/_chunks/libs/@nanostores/react.mjs +1 -30
- package/dist/_chunks/libs/@smithy/is-array-buffer.mjs +1 -10
- package/dist/_chunks/libs/@smithy/util-base64.mjs +1 -100
- package/dist/_chunks/libs/ajv.mjs +1 -777
- package/dist/_chunks/libs/atomically.mjs +1 -362
- package/dist/_chunks/libs/birpc.mjs +1 -201
- package/dist/_chunks/libs/chevrotain-allstar.mjs +2 -850
- package/dist/_chunks/libs/chevrotain.mjs +55 -6229
- package/dist/_chunks/libs/conf.mjs +1 -2258
- package/dist/_chunks/libs/defu.mjs +1 -42
- package/dist/_chunks/libs/esm-env.mjs +1 -5
- package/dist/_chunks/libs/eventemitter3.mjs +1 -243
- package/dist/_chunks/libs/fast-equals.mjs +1 -446
- package/dist/_chunks/libs/find-up-simple.mjs +1 -24
- package/dist/_chunks/libs/get-port.mjs +1 -107
- package/dist/_chunks/libs/is-docker.mjs +1 -26
- package/dist/_chunks/libs/is-error-instance.mjs +1 -26
- package/dist/_chunks/libs/is-inside-container.mjs +1 -20
- package/dist/_chunks/libs/is-plain-obj.mjs +1 -9
- package/dist/_chunks/libs/isexe.mjs +1 -127
- package/dist/_chunks/libs/json5.mjs +14 -959
- package/dist/_chunks/libs/khroma.mjs +1 -605
- package/dist/_chunks/libs/ky.mjs +2 -807
- package/dist/_chunks/libs/langium.d.mts +2913 -2876
- package/dist/_chunks/libs/langium.mjs +33 -20351
- package/dist/_chunks/libs/merge-error-cause.mjs +2 -746
- package/dist/_chunks/libs/p-limit.mjs +1 -120
- package/dist/_chunks/libs/p-queue.mjs +1 -449
- package/dist/_chunks/libs/package-manager-detector.mjs +1 -559
- package/dist/_chunks/libs/package-up.mjs +1 -10
- package/dist/_chunks/libs/pako.mjs +1 -0
- package/dist/_chunks/libs/parse-ms.mjs +1 -36
- package/dist/_chunks/libs/pathe.mjs +1 -0
- package/dist/_chunks/libs/picomatch.mjs +1 -1673
- package/dist/_chunks/libs/pretty-ms.mjs +1 -80
- package/dist/_chunks/libs/remeda.mjs +2 -690
- package/dist/_chunks/libs/safe-stringify.mjs +1 -21
- package/dist/_chunks/libs/strip-indent.mjs +1 -15
- package/dist/_chunks/libs/tinyrainbow.mjs +1 -88
- package/dist/_chunks/libs/ts-graphviz.mjs +4 -725
- package/dist/_chunks/libs/ufo.mjs +1 -240
- package/dist/_chunks/libs/which.mjs +1 -84
- package/dist/_chunks/libs/word-wrap.mjs +12 -43
- package/dist/_chunks/rolldown-runtime.mjs +1 -48
- package/dist/_chunks/sequence.mjs +1 -0
- package/dist/_chunks/src.mjs +15 -0
- package/dist/_chunks/src2.mjs +499 -0
- package/dist/cli/index.mjs +77 -1952
- package/dist/config/index.d.mts +2 -2
- package/dist/config/index.mjs +1 -6
- package/dist/index.d.mts +150 -7
- package/dist/index.mjs +1 -21
- package/dist/model/builder.mjs +1 -3
- package/dist/model/index.d.mts +57 -3
- package/dist/model/index.mjs +1 -5
- package/dist/vite-plugin/index.d.mts +7 -3
- package/dist/vite-plugin/index.mjs +1 -22
- package/dist/vite-plugin/internal.d.mts +6 -7
- package/dist/vite-plugin/internal.mjs +1 -68
- package/package.json +64 -45
- package/react/{index.d.ts → index.d.mts} +114 -72
- package/react/{index.js → index.mjs} +21320 -22041
- package/react/package.json +2 -5
- package/vite-plugin-modules.d.ts +10 -5
- package/dist/_chunks/LikeC4.d.mts +0 -121
- package/dist/_chunks/config-app.prod.d.mts +0 -18
- package/dist/_chunks/config-app.prod.mjs +0 -188
- package/dist/_chunks/config-webcomponent.prod.mjs +0 -71
- package/dist/_chunks/define-config.mjs +0 -409
- package/dist/_chunks/index3.d.mts +0 -60
- package/dist/_chunks/libs/@chevrotain/gast.mjs +0 -3969
- package/dist/_chunks/libs/hono.mjs +0 -1829
- package/dist/_chunks/libs/nanoid.mjs +0 -29
- package/dist/_chunks/libs/nanostores.d.mts +0 -63
- package/dist/_chunks/libs/nanostores.mjs +0 -198
- package/dist/_chunks/model.mjs +0 -12
- package/dist/_chunks/module.d.mts +0 -71
- package/dist/_chunks/module.mjs +0 -18657
- package/dist/_chunks/plugin.mjs +0 -996
- package/dist/_chunks/sequence-view.mjs +0 -575
- package/dist/_chunks/vite-build.mjs +0 -69
- package/dist/_chunks/vite-dev.mjs +0 -79
- package/dist/_chunks/vite-preview.mjs +0 -27
- package/dist/language/module.d.mts +0 -5
- package/dist/language/module.mjs +0 -20
- package/dist/vite/vite-build.d.mts +0 -26
- package/dist/vite/vite-build.mjs +0 -27
- package/dist/vite/vite-dev.d.mts +0 -34
- package/dist/vite/vite-dev.mjs +0 -29
- package/dist/vite/vite-preview.d.mts +0 -20
- package/dist/vite/vite-preview.mjs +0 -26
- /package/dist/_chunks/{index4.d.mts → libs/@chevrotain/types.d.mts} +0 -0
|
@@ -1,605 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const Channel = {
|
|
3
|
-
min: {
|
|
4
|
-
r: 0,
|
|
5
|
-
g: 0,
|
|
6
|
-
b: 0,
|
|
7
|
-
s: 0,
|
|
8
|
-
l: 0,
|
|
9
|
-
a: 0
|
|
10
|
-
},
|
|
11
|
-
max: {
|
|
12
|
-
r: 255,
|
|
13
|
-
g: 255,
|
|
14
|
-
b: 255,
|
|
15
|
-
h: 360,
|
|
16
|
-
s: 100,
|
|
17
|
-
l: 100,
|
|
18
|
-
a: 1
|
|
19
|
-
},
|
|
20
|
-
clamp: {
|
|
21
|
-
r: (r) => r >= 255 ? 255 : r < 0 ? 0 : r,
|
|
22
|
-
g: (g) => g >= 255 ? 255 : g < 0 ? 0 : g,
|
|
23
|
-
b: (b) => b >= 255 ? 255 : b < 0 ? 0 : b,
|
|
24
|
-
h: (h) => h % 360,
|
|
25
|
-
s: (s) => s >= 100 ? 100 : s < 0 ? 0 : s,
|
|
26
|
-
l: (l) => l >= 100 ? 100 : l < 0 ? 0 : l,
|
|
27
|
-
a: (a) => a >= 1 ? 1 : a < 0 ? 0 : a
|
|
28
|
-
},
|
|
29
|
-
toLinear: (c) => {
|
|
30
|
-
const n = c / 255;
|
|
31
|
-
return c > .03928 ? Math.pow((n + .055) / 1.055, 2.4) : n / 12.92;
|
|
32
|
-
},
|
|
33
|
-
hue2rgb: (p, q, t) => {
|
|
34
|
-
if (t < 0) t += 1;
|
|
35
|
-
if (t > 1) t -= 1;
|
|
36
|
-
if (t < 1 / 6) return p + (q - p) * 6 * t;
|
|
37
|
-
if (t < 1 / 2) return q;
|
|
38
|
-
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
|
|
39
|
-
return p;
|
|
40
|
-
},
|
|
41
|
-
hsl2rgb: ({ h, s, l }, channel) => {
|
|
42
|
-
if (!s) return l * 2.55;
|
|
43
|
-
h /= 360;
|
|
44
|
-
s /= 100;
|
|
45
|
-
l /= 100;
|
|
46
|
-
const q = l < .5 ? l * (1 + s) : l + s - l * s;
|
|
47
|
-
const p = 2 * l - q;
|
|
48
|
-
switch (channel) {
|
|
49
|
-
case "r": return Channel.hue2rgb(p, q, h + 1 / 3) * 255;
|
|
50
|
-
case "g": return Channel.hue2rgb(p, q, h) * 255;
|
|
51
|
-
case "b": return Channel.hue2rgb(p, q, h - 1 / 3) * 255;
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
rgb2hsl: ({ r, g, b }, channel) => {
|
|
55
|
-
r /= 255;
|
|
56
|
-
g /= 255;
|
|
57
|
-
b /= 255;
|
|
58
|
-
const max = Math.max(r, g, b);
|
|
59
|
-
const min = Math.min(r, g, b);
|
|
60
|
-
const l = (max + min) / 2;
|
|
61
|
-
if (channel === "l") return l * 100;
|
|
62
|
-
if (max === min) return 0;
|
|
63
|
-
const d = max - min;
|
|
64
|
-
const s = l > .5 ? d / (2 - max - min) : d / (max + min);
|
|
65
|
-
if (channel === "s") return s * 100;
|
|
66
|
-
switch (max) {
|
|
67
|
-
case r: return ((g - b) / d + (g < b ? 6 : 0)) * 60;
|
|
68
|
-
case g: return ((b - r) / d + 2) * 60;
|
|
69
|
-
case b: return ((r - g) / d + 4) * 60;
|
|
70
|
-
default: return -1;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
var channel_default = Channel;
|
|
75
|
-
|
|
76
|
-
//#endregion
|
|
77
|
-
//#region ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/utils/lang.js
|
|
78
|
-
const Lang = {
|
|
79
|
-
clamp: (number, lower, upper) => {
|
|
80
|
-
if (lower > upper) return Math.min(lower, Math.max(upper, number));
|
|
81
|
-
return Math.min(upper, Math.max(lower, number));
|
|
82
|
-
},
|
|
83
|
-
round: (number) => {
|
|
84
|
-
return Math.round(number * 1e10) / 1e10;
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
var lang_default = Lang;
|
|
88
|
-
|
|
89
|
-
//#endregion
|
|
90
|
-
//#region ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/utils/unit.js
|
|
91
|
-
const Unit = { dec2hex: (dec) => {
|
|
92
|
-
const hex = Math.round(dec).toString(16);
|
|
93
|
-
return hex.length > 1 ? hex : `0${hex}`;
|
|
94
|
-
} };
|
|
95
|
-
var unit_default = Unit;
|
|
96
|
-
|
|
97
|
-
//#endregion
|
|
98
|
-
//#region ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/utils/index.js
|
|
99
|
-
const Utils = {
|
|
100
|
-
channel: channel_default,
|
|
101
|
-
lang: lang_default,
|
|
102
|
-
unit: unit_default
|
|
103
|
-
};
|
|
104
|
-
var utils_default = Utils;
|
|
105
|
-
|
|
106
|
-
//#endregion
|
|
107
|
-
//#region ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/constants.js
|
|
108
|
-
const DEC2HEX = {};
|
|
109
|
-
for (let i = 0; i <= 255; i++) DEC2HEX[i] = utils_default.unit.dec2hex(i);
|
|
110
|
-
const TYPE = {
|
|
111
|
-
ALL: 0,
|
|
112
|
-
RGB: 1,
|
|
113
|
-
HSL: 2
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
//#endregion
|
|
117
|
-
//#region ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/channels/type.js
|
|
118
|
-
var Type = class {
|
|
119
|
-
constructor() {
|
|
120
|
-
this.type = TYPE.ALL;
|
|
121
|
-
}
|
|
122
|
-
get() {
|
|
123
|
-
return this.type;
|
|
124
|
-
}
|
|
125
|
-
set(type) {
|
|
126
|
-
if (this.type && this.type !== type) throw new Error("Cannot change both RGB and HSL channels at the same time");
|
|
127
|
-
this.type = type;
|
|
128
|
-
}
|
|
129
|
-
reset() {
|
|
130
|
-
this.type = TYPE.ALL;
|
|
131
|
-
}
|
|
132
|
-
is(type) {
|
|
133
|
-
return this.type === type;
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
var type_default = Type;
|
|
137
|
-
|
|
138
|
-
//#endregion
|
|
139
|
-
//#region ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/channels/index.js
|
|
140
|
-
var Channels = class {
|
|
141
|
-
constructor(data, color) {
|
|
142
|
-
this.color = color;
|
|
143
|
-
this.changed = false;
|
|
144
|
-
this.data = data;
|
|
145
|
-
this.type = new type_default();
|
|
146
|
-
}
|
|
147
|
-
set(data, color) {
|
|
148
|
-
this.color = color;
|
|
149
|
-
this.changed = false;
|
|
150
|
-
this.data = data;
|
|
151
|
-
this.type.type = TYPE.ALL;
|
|
152
|
-
return this;
|
|
153
|
-
}
|
|
154
|
-
_ensureHSL() {
|
|
155
|
-
const data = this.data;
|
|
156
|
-
const { h, s, l } = data;
|
|
157
|
-
if (h === void 0) data.h = utils_default.channel.rgb2hsl(data, "h");
|
|
158
|
-
if (s === void 0) data.s = utils_default.channel.rgb2hsl(data, "s");
|
|
159
|
-
if (l === void 0) data.l = utils_default.channel.rgb2hsl(data, "l");
|
|
160
|
-
}
|
|
161
|
-
_ensureRGB() {
|
|
162
|
-
const data = this.data;
|
|
163
|
-
const { r, g, b } = data;
|
|
164
|
-
if (r === void 0) data.r = utils_default.channel.hsl2rgb(data, "r");
|
|
165
|
-
if (g === void 0) data.g = utils_default.channel.hsl2rgb(data, "g");
|
|
166
|
-
if (b === void 0) data.b = utils_default.channel.hsl2rgb(data, "b");
|
|
167
|
-
}
|
|
168
|
-
get r() {
|
|
169
|
-
const data = this.data;
|
|
170
|
-
const r = data.r;
|
|
171
|
-
if (!this.type.is(TYPE.HSL) && r !== void 0) return r;
|
|
172
|
-
this._ensureHSL();
|
|
173
|
-
return utils_default.channel.hsl2rgb(data, "r");
|
|
174
|
-
}
|
|
175
|
-
get g() {
|
|
176
|
-
const data = this.data;
|
|
177
|
-
const g = data.g;
|
|
178
|
-
if (!this.type.is(TYPE.HSL) && g !== void 0) return g;
|
|
179
|
-
this._ensureHSL();
|
|
180
|
-
return utils_default.channel.hsl2rgb(data, "g");
|
|
181
|
-
}
|
|
182
|
-
get b() {
|
|
183
|
-
const data = this.data;
|
|
184
|
-
const b = data.b;
|
|
185
|
-
if (!this.type.is(TYPE.HSL) && b !== void 0) return b;
|
|
186
|
-
this._ensureHSL();
|
|
187
|
-
return utils_default.channel.hsl2rgb(data, "b");
|
|
188
|
-
}
|
|
189
|
-
get h() {
|
|
190
|
-
const data = this.data;
|
|
191
|
-
const h = data.h;
|
|
192
|
-
if (!this.type.is(TYPE.RGB) && h !== void 0) return h;
|
|
193
|
-
this._ensureRGB();
|
|
194
|
-
return utils_default.channel.rgb2hsl(data, "h");
|
|
195
|
-
}
|
|
196
|
-
get s() {
|
|
197
|
-
const data = this.data;
|
|
198
|
-
const s = data.s;
|
|
199
|
-
if (!this.type.is(TYPE.RGB) && s !== void 0) return s;
|
|
200
|
-
this._ensureRGB();
|
|
201
|
-
return utils_default.channel.rgb2hsl(data, "s");
|
|
202
|
-
}
|
|
203
|
-
get l() {
|
|
204
|
-
const data = this.data;
|
|
205
|
-
const l = data.l;
|
|
206
|
-
if (!this.type.is(TYPE.RGB) && l !== void 0) return l;
|
|
207
|
-
this._ensureRGB();
|
|
208
|
-
return utils_default.channel.rgb2hsl(data, "l");
|
|
209
|
-
}
|
|
210
|
-
get a() {
|
|
211
|
-
return this.data.a;
|
|
212
|
-
}
|
|
213
|
-
set r(r) {
|
|
214
|
-
this.type.set(TYPE.RGB);
|
|
215
|
-
this.changed = true;
|
|
216
|
-
this.data.r = r;
|
|
217
|
-
}
|
|
218
|
-
set g(g) {
|
|
219
|
-
this.type.set(TYPE.RGB);
|
|
220
|
-
this.changed = true;
|
|
221
|
-
this.data.g = g;
|
|
222
|
-
}
|
|
223
|
-
set b(b) {
|
|
224
|
-
this.type.set(TYPE.RGB);
|
|
225
|
-
this.changed = true;
|
|
226
|
-
this.data.b = b;
|
|
227
|
-
}
|
|
228
|
-
set h(h) {
|
|
229
|
-
this.type.set(TYPE.HSL);
|
|
230
|
-
this.changed = true;
|
|
231
|
-
this.data.h = h;
|
|
232
|
-
}
|
|
233
|
-
set s(s) {
|
|
234
|
-
this.type.set(TYPE.HSL);
|
|
235
|
-
this.changed = true;
|
|
236
|
-
this.data.s = s;
|
|
237
|
-
}
|
|
238
|
-
set l(l) {
|
|
239
|
-
this.type.set(TYPE.HSL);
|
|
240
|
-
this.changed = true;
|
|
241
|
-
this.data.l = l;
|
|
242
|
-
}
|
|
243
|
-
set a(a) {
|
|
244
|
-
this.changed = true;
|
|
245
|
-
this.data.a = a;
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
var channels_default = Channels;
|
|
249
|
-
|
|
250
|
-
//#endregion
|
|
251
|
-
//#region ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/channels/reusable.js
|
|
252
|
-
const channels = new channels_default({
|
|
253
|
-
r: 0,
|
|
254
|
-
g: 0,
|
|
255
|
-
b: 0,
|
|
256
|
-
a: 0
|
|
257
|
-
}, "transparent");
|
|
258
|
-
var reusable_default = channels;
|
|
259
|
-
|
|
260
|
-
//#endregion
|
|
261
|
-
//#region ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/hex.js
|
|
262
|
-
const Hex = {
|
|
263
|
-
re: /^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,
|
|
264
|
-
parse: (color) => {
|
|
265
|
-
if (color.charCodeAt(0) !== 35) return;
|
|
266
|
-
const match = color.match(Hex.re);
|
|
267
|
-
if (!match) return;
|
|
268
|
-
const hex = match[1];
|
|
269
|
-
const dec = parseInt(hex, 16);
|
|
270
|
-
const length = hex.length;
|
|
271
|
-
const hasAlpha = length % 4 === 0;
|
|
272
|
-
const isFullLength = length > 4;
|
|
273
|
-
const multiplier = isFullLength ? 1 : 17;
|
|
274
|
-
const bits = isFullLength ? 8 : 4;
|
|
275
|
-
const bitsOffset = hasAlpha ? 0 : -1;
|
|
276
|
-
const mask = isFullLength ? 255 : 15;
|
|
277
|
-
return reusable_default.set({
|
|
278
|
-
r: (dec >> bits * (bitsOffset + 3) & mask) * multiplier,
|
|
279
|
-
g: (dec >> bits * (bitsOffset + 2) & mask) * multiplier,
|
|
280
|
-
b: (dec >> bits * (bitsOffset + 1) & mask) * multiplier,
|
|
281
|
-
a: hasAlpha ? (dec & mask) * multiplier / 255 : 1
|
|
282
|
-
}, color);
|
|
283
|
-
},
|
|
284
|
-
stringify: (channels) => {
|
|
285
|
-
const { r, g, b, a } = channels;
|
|
286
|
-
if (a < 1) return `#${DEC2HEX[Math.round(r)]}${DEC2HEX[Math.round(g)]}${DEC2HEX[Math.round(b)]}${DEC2HEX[Math.round(a * 255)]}`;
|
|
287
|
-
else return `#${DEC2HEX[Math.round(r)]}${DEC2HEX[Math.round(g)]}${DEC2HEX[Math.round(b)]}`;
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
var hex_default = Hex;
|
|
291
|
-
|
|
292
|
-
//#endregion
|
|
293
|
-
//#region ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/hsl.js
|
|
294
|
-
const HSL = {
|
|
295
|
-
re: /^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,
|
|
296
|
-
hueRe: /^(.+?)(deg|grad|rad|turn)$/i,
|
|
297
|
-
_hue2deg: (hue) => {
|
|
298
|
-
const match = hue.match(HSL.hueRe);
|
|
299
|
-
if (match) {
|
|
300
|
-
const [, number, unit] = match;
|
|
301
|
-
switch (unit) {
|
|
302
|
-
case "grad": return utils_default.channel.clamp.h(parseFloat(number) * .9);
|
|
303
|
-
case "rad": return utils_default.channel.clamp.h(parseFloat(number) * 180 / Math.PI);
|
|
304
|
-
case "turn": return utils_default.channel.clamp.h(parseFloat(number) * 360);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
return utils_default.channel.clamp.h(parseFloat(hue));
|
|
308
|
-
},
|
|
309
|
-
parse: (color) => {
|
|
310
|
-
const charCode = color.charCodeAt(0);
|
|
311
|
-
if (charCode !== 104 && charCode !== 72) return;
|
|
312
|
-
const match = color.match(HSL.re);
|
|
313
|
-
if (!match) return;
|
|
314
|
-
const [, h, s, l, a, isAlphaPercentage] = match;
|
|
315
|
-
return reusable_default.set({
|
|
316
|
-
h: HSL._hue2deg(h),
|
|
317
|
-
s: utils_default.channel.clamp.s(parseFloat(s)),
|
|
318
|
-
l: utils_default.channel.clamp.l(parseFloat(l)),
|
|
319
|
-
a: a ? utils_default.channel.clamp.a(isAlphaPercentage ? parseFloat(a) / 100 : parseFloat(a)) : 1
|
|
320
|
-
}, color);
|
|
321
|
-
},
|
|
322
|
-
stringify: (channels) => {
|
|
323
|
-
const { h, s, l, a } = channels;
|
|
324
|
-
if (a < 1) return `hsla(${utils_default.lang.round(h)}, ${utils_default.lang.round(s)}%, ${utils_default.lang.round(l)}%, ${a})`;
|
|
325
|
-
else return `hsl(${utils_default.lang.round(h)}, ${utils_default.lang.round(s)}%, ${utils_default.lang.round(l)}%)`;
|
|
326
|
-
}
|
|
327
|
-
};
|
|
328
|
-
var hsl_default = HSL;
|
|
329
|
-
|
|
330
|
-
//#endregion
|
|
331
|
-
//#region ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/keyword.js
|
|
332
|
-
const Keyword = {
|
|
333
|
-
colors: {
|
|
334
|
-
aliceblue: "#f0f8ff",
|
|
335
|
-
antiquewhite: "#faebd7",
|
|
336
|
-
aqua: "#00ffff",
|
|
337
|
-
aquamarine: "#7fffd4",
|
|
338
|
-
azure: "#f0ffff",
|
|
339
|
-
beige: "#f5f5dc",
|
|
340
|
-
bisque: "#ffe4c4",
|
|
341
|
-
black: "#000000",
|
|
342
|
-
blanchedalmond: "#ffebcd",
|
|
343
|
-
blue: "#0000ff",
|
|
344
|
-
blueviolet: "#8a2be2",
|
|
345
|
-
brown: "#a52a2a",
|
|
346
|
-
burlywood: "#deb887",
|
|
347
|
-
cadetblue: "#5f9ea0",
|
|
348
|
-
chartreuse: "#7fff00",
|
|
349
|
-
chocolate: "#d2691e",
|
|
350
|
-
coral: "#ff7f50",
|
|
351
|
-
cornflowerblue: "#6495ed",
|
|
352
|
-
cornsilk: "#fff8dc",
|
|
353
|
-
crimson: "#dc143c",
|
|
354
|
-
cyanaqua: "#00ffff",
|
|
355
|
-
darkblue: "#00008b",
|
|
356
|
-
darkcyan: "#008b8b",
|
|
357
|
-
darkgoldenrod: "#b8860b",
|
|
358
|
-
darkgray: "#a9a9a9",
|
|
359
|
-
darkgreen: "#006400",
|
|
360
|
-
darkgrey: "#a9a9a9",
|
|
361
|
-
darkkhaki: "#bdb76b",
|
|
362
|
-
darkmagenta: "#8b008b",
|
|
363
|
-
darkolivegreen: "#556b2f",
|
|
364
|
-
darkorange: "#ff8c00",
|
|
365
|
-
darkorchid: "#9932cc",
|
|
366
|
-
darkred: "#8b0000",
|
|
367
|
-
darksalmon: "#e9967a",
|
|
368
|
-
darkseagreen: "#8fbc8f",
|
|
369
|
-
darkslateblue: "#483d8b",
|
|
370
|
-
darkslategray: "#2f4f4f",
|
|
371
|
-
darkslategrey: "#2f4f4f",
|
|
372
|
-
darkturquoise: "#00ced1",
|
|
373
|
-
darkviolet: "#9400d3",
|
|
374
|
-
deeppink: "#ff1493",
|
|
375
|
-
deepskyblue: "#00bfff",
|
|
376
|
-
dimgray: "#696969",
|
|
377
|
-
dimgrey: "#696969",
|
|
378
|
-
dodgerblue: "#1e90ff",
|
|
379
|
-
firebrick: "#b22222",
|
|
380
|
-
floralwhite: "#fffaf0",
|
|
381
|
-
forestgreen: "#228b22",
|
|
382
|
-
fuchsia: "#ff00ff",
|
|
383
|
-
gainsboro: "#dcdcdc",
|
|
384
|
-
ghostwhite: "#f8f8ff",
|
|
385
|
-
gold: "#ffd700",
|
|
386
|
-
goldenrod: "#daa520",
|
|
387
|
-
gray: "#808080",
|
|
388
|
-
green: "#008000",
|
|
389
|
-
greenyellow: "#adff2f",
|
|
390
|
-
grey: "#808080",
|
|
391
|
-
honeydew: "#f0fff0",
|
|
392
|
-
hotpink: "#ff69b4",
|
|
393
|
-
indianred: "#cd5c5c",
|
|
394
|
-
indigo: "#4b0082",
|
|
395
|
-
ivory: "#fffff0",
|
|
396
|
-
khaki: "#f0e68c",
|
|
397
|
-
lavender: "#e6e6fa",
|
|
398
|
-
lavenderblush: "#fff0f5",
|
|
399
|
-
lawngreen: "#7cfc00",
|
|
400
|
-
lemonchiffon: "#fffacd",
|
|
401
|
-
lightblue: "#add8e6",
|
|
402
|
-
lightcoral: "#f08080",
|
|
403
|
-
lightcyan: "#e0ffff",
|
|
404
|
-
lightgoldenrodyellow: "#fafad2",
|
|
405
|
-
lightgray: "#d3d3d3",
|
|
406
|
-
lightgreen: "#90ee90",
|
|
407
|
-
lightgrey: "#d3d3d3",
|
|
408
|
-
lightpink: "#ffb6c1",
|
|
409
|
-
lightsalmon: "#ffa07a",
|
|
410
|
-
lightseagreen: "#20b2aa",
|
|
411
|
-
lightskyblue: "#87cefa",
|
|
412
|
-
lightslategray: "#778899",
|
|
413
|
-
lightslategrey: "#778899",
|
|
414
|
-
lightsteelblue: "#b0c4de",
|
|
415
|
-
lightyellow: "#ffffe0",
|
|
416
|
-
lime: "#00ff00",
|
|
417
|
-
limegreen: "#32cd32",
|
|
418
|
-
linen: "#faf0e6",
|
|
419
|
-
magenta: "#ff00ff",
|
|
420
|
-
maroon: "#800000",
|
|
421
|
-
mediumaquamarine: "#66cdaa",
|
|
422
|
-
mediumblue: "#0000cd",
|
|
423
|
-
mediumorchid: "#ba55d3",
|
|
424
|
-
mediumpurple: "#9370db",
|
|
425
|
-
mediumseagreen: "#3cb371",
|
|
426
|
-
mediumslateblue: "#7b68ee",
|
|
427
|
-
mediumspringgreen: "#00fa9a",
|
|
428
|
-
mediumturquoise: "#48d1cc",
|
|
429
|
-
mediumvioletred: "#c71585",
|
|
430
|
-
midnightblue: "#191970",
|
|
431
|
-
mintcream: "#f5fffa",
|
|
432
|
-
mistyrose: "#ffe4e1",
|
|
433
|
-
moccasin: "#ffe4b5",
|
|
434
|
-
navajowhite: "#ffdead",
|
|
435
|
-
navy: "#000080",
|
|
436
|
-
oldlace: "#fdf5e6",
|
|
437
|
-
olive: "#808000",
|
|
438
|
-
olivedrab: "#6b8e23",
|
|
439
|
-
orange: "#ffa500",
|
|
440
|
-
orangered: "#ff4500",
|
|
441
|
-
orchid: "#da70d6",
|
|
442
|
-
palegoldenrod: "#eee8aa",
|
|
443
|
-
palegreen: "#98fb98",
|
|
444
|
-
paleturquoise: "#afeeee",
|
|
445
|
-
palevioletred: "#db7093",
|
|
446
|
-
papayawhip: "#ffefd5",
|
|
447
|
-
peachpuff: "#ffdab9",
|
|
448
|
-
peru: "#cd853f",
|
|
449
|
-
pink: "#ffc0cb",
|
|
450
|
-
plum: "#dda0dd",
|
|
451
|
-
powderblue: "#b0e0e6",
|
|
452
|
-
purple: "#800080",
|
|
453
|
-
rebeccapurple: "#663399",
|
|
454
|
-
red: "#ff0000",
|
|
455
|
-
rosybrown: "#bc8f8f",
|
|
456
|
-
royalblue: "#4169e1",
|
|
457
|
-
saddlebrown: "#8b4513",
|
|
458
|
-
salmon: "#fa8072",
|
|
459
|
-
sandybrown: "#f4a460",
|
|
460
|
-
seagreen: "#2e8b57",
|
|
461
|
-
seashell: "#fff5ee",
|
|
462
|
-
sienna: "#a0522d",
|
|
463
|
-
silver: "#c0c0c0",
|
|
464
|
-
skyblue: "#87ceeb",
|
|
465
|
-
slateblue: "#6a5acd",
|
|
466
|
-
slategray: "#708090",
|
|
467
|
-
slategrey: "#708090",
|
|
468
|
-
snow: "#fffafa",
|
|
469
|
-
springgreen: "#00ff7f",
|
|
470
|
-
tan: "#d2b48c",
|
|
471
|
-
teal: "#008080",
|
|
472
|
-
thistle: "#d8bfd8",
|
|
473
|
-
transparent: "#00000000",
|
|
474
|
-
turquoise: "#40e0d0",
|
|
475
|
-
violet: "#ee82ee",
|
|
476
|
-
wheat: "#f5deb3",
|
|
477
|
-
white: "#ffffff",
|
|
478
|
-
whitesmoke: "#f5f5f5",
|
|
479
|
-
yellow: "#ffff00",
|
|
480
|
-
yellowgreen: "#9acd32"
|
|
481
|
-
},
|
|
482
|
-
parse: (color) => {
|
|
483
|
-
color = color.toLowerCase();
|
|
484
|
-
const hex = Keyword.colors[color];
|
|
485
|
-
if (!hex) return;
|
|
486
|
-
return hex_default.parse(hex);
|
|
487
|
-
},
|
|
488
|
-
stringify: (channels) => {
|
|
489
|
-
const hex = hex_default.stringify(channels);
|
|
490
|
-
for (const name in Keyword.colors) if (Keyword.colors[name] === hex) return name;
|
|
491
|
-
}
|
|
492
|
-
};
|
|
493
|
-
var keyword_default = Keyword;
|
|
494
|
-
|
|
495
|
-
//#endregion
|
|
496
|
-
//#region ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/rgb.js
|
|
497
|
-
const RGB = {
|
|
498
|
-
re: /^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,
|
|
499
|
-
parse: (color) => {
|
|
500
|
-
const charCode = color.charCodeAt(0);
|
|
501
|
-
if (charCode !== 114 && charCode !== 82) return;
|
|
502
|
-
const match = color.match(RGB.re);
|
|
503
|
-
if (!match) return;
|
|
504
|
-
const [, r, isRedPercentage, g, isGreenPercentage, b, isBluePercentage, a, isAlphaPercentage] = match;
|
|
505
|
-
return reusable_default.set({
|
|
506
|
-
r: utils_default.channel.clamp.r(isRedPercentage ? parseFloat(r) * 2.55 : parseFloat(r)),
|
|
507
|
-
g: utils_default.channel.clamp.g(isGreenPercentage ? parseFloat(g) * 2.55 : parseFloat(g)),
|
|
508
|
-
b: utils_default.channel.clamp.b(isBluePercentage ? parseFloat(b) * 2.55 : parseFloat(b)),
|
|
509
|
-
a: a ? utils_default.channel.clamp.a(isAlphaPercentage ? parseFloat(a) / 100 : parseFloat(a)) : 1
|
|
510
|
-
}, color);
|
|
511
|
-
},
|
|
512
|
-
stringify: (channels) => {
|
|
513
|
-
const { r, g, b, a } = channels;
|
|
514
|
-
if (a < 1) return `rgba(${utils_default.lang.round(r)}, ${utils_default.lang.round(g)}, ${utils_default.lang.round(b)}, ${utils_default.lang.round(a)})`;
|
|
515
|
-
else return `rgb(${utils_default.lang.round(r)}, ${utils_default.lang.round(g)}, ${utils_default.lang.round(b)})`;
|
|
516
|
-
}
|
|
517
|
-
};
|
|
518
|
-
var rgb_default = RGB;
|
|
519
|
-
|
|
520
|
-
//#endregion
|
|
521
|
-
//#region ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/index.js
|
|
522
|
-
const Color = {
|
|
523
|
-
format: {
|
|
524
|
-
keyword: keyword_default,
|
|
525
|
-
hex: hex_default,
|
|
526
|
-
rgb: rgb_default,
|
|
527
|
-
rgba: rgb_default,
|
|
528
|
-
hsl: hsl_default,
|
|
529
|
-
hsla: hsl_default
|
|
530
|
-
},
|
|
531
|
-
parse: (color) => {
|
|
532
|
-
if (typeof color !== "string") return color;
|
|
533
|
-
const channels = hex_default.parse(color) || rgb_default.parse(color) || hsl_default.parse(color) || keyword_default.parse(color);
|
|
534
|
-
if (channels) return channels;
|
|
535
|
-
throw new Error(`Unsupported color format: "${color}"`);
|
|
536
|
-
},
|
|
537
|
-
stringify: (channels) => {
|
|
538
|
-
if (!channels.changed && channels.color) return channels.color;
|
|
539
|
-
if (channels.type.is(TYPE.HSL) || channels.data.r === void 0) return hsl_default.stringify(channels);
|
|
540
|
-
else if (channels.a < 1 || !Number.isInteger(channels.r) || !Number.isInteger(channels.g) || !Number.isInteger(channels.b)) return rgb_default.stringify(channels);
|
|
541
|
-
else return hex_default.stringify(channels);
|
|
542
|
-
}
|
|
543
|
-
};
|
|
544
|
-
var color_default = Color;
|
|
545
|
-
|
|
546
|
-
//#endregion
|
|
547
|
-
//#region ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/change.js
|
|
548
|
-
const change = (color, channels) => {
|
|
549
|
-
const ch = color_default.parse(color);
|
|
550
|
-
for (const c in channels) ch[c] = utils_default.channel.clamp[c](channels[c]);
|
|
551
|
-
return color_default.stringify(ch);
|
|
552
|
-
};
|
|
553
|
-
var change_default = change;
|
|
554
|
-
|
|
555
|
-
//#endregion
|
|
556
|
-
//#region ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/to_hex.js
|
|
557
|
-
const toHex = (color) => {
|
|
558
|
-
return color_default.format.hex.stringify(color_default.parse(color));
|
|
559
|
-
};
|
|
560
|
-
var to_hex_default = toHex;
|
|
561
|
-
|
|
562
|
-
//#endregion
|
|
563
|
-
//#region ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/adjust_channel.js
|
|
564
|
-
const adjustChannel = (color, channel, amount) => {
|
|
565
|
-
const channels = color_default.parse(color);
|
|
566
|
-
const amountCurrent = channels[channel];
|
|
567
|
-
const amountNext = utils_default.channel.clamp[channel](amountCurrent + amount);
|
|
568
|
-
if (amountCurrent !== amountNext) channels[channel] = amountNext;
|
|
569
|
-
return color_default.stringify(channels);
|
|
570
|
-
};
|
|
571
|
-
var adjust_channel_default = adjustChannel;
|
|
572
|
-
|
|
573
|
-
//#endregion
|
|
574
|
-
//#region ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/transparentize.js
|
|
575
|
-
const transparentize = (color, amount) => {
|
|
576
|
-
return adjust_channel_default(color, "a", -amount);
|
|
577
|
-
};
|
|
578
|
-
var transparentize_default = transparentize;
|
|
579
|
-
|
|
580
|
-
//#endregion
|
|
581
|
-
//#region ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/adjust.js
|
|
582
|
-
const adjust = (color, channels) => {
|
|
583
|
-
const ch = color_default.parse(color);
|
|
584
|
-
const changes = {};
|
|
585
|
-
for (const c in channels) {
|
|
586
|
-
if (!channels[c]) continue;
|
|
587
|
-
changes[c] = ch[c] + channels[c];
|
|
588
|
-
}
|
|
589
|
-
return change_default(color, changes);
|
|
590
|
-
};
|
|
591
|
-
var adjust_default = adjust;
|
|
592
|
-
|
|
593
|
-
//#endregion
|
|
594
|
-
//#region ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/scale.js
|
|
595
|
-
const scale = (color, channels) => {
|
|
596
|
-
const ch = color_default.parse(color);
|
|
597
|
-
const adjustments = {};
|
|
598
|
-
const delta = (amount, weight, max) => weight > 0 ? (max - amount) * weight / 100 : amount * weight / 100;
|
|
599
|
-
for (const c in channels) adjustments[c] = delta(ch[c], channels[c], utils_default.channel.max[c]);
|
|
600
|
-
return adjust_default(color, adjustments);
|
|
601
|
-
};
|
|
602
|
-
var scale_default = scale;
|
|
603
|
-
|
|
604
|
-
//#endregion
|
|
605
|
-
export { transparentize_default as n, to_hex_default as r, scale_default as t };
|
|
1
|
+
const e={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:e=>e>=255?255:e<0?0:e,g:e=>e>=255?255:e<0?0:e,b:e=>e>=255?255:e<0?0:e,h:e=>e%360,s:e=>e>=100?100:e<0?0:e,l:e=>e>=100?100:e<0?0:e,a:e=>e>=1?1:e<0?0:e},toLinear:e=>{let t=e/255;return e>.03928?((t+.055)/1.055)**2.4:t/12.92},hue2rgb:(e,t,n)=>(n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),hsl2rgb:({h:t,s:n,l:r},i)=>{if(!n)return r*2.55;t/=360,n/=100,r/=100;let a=r<.5?r*(1+n):r+n-r*n,o=2*r-a;switch(i){case`r`:return e.hue2rgb(o,a,t+1/3)*255;case`g`:return e.hue2rgb(o,a,t)*255;case`b`:return e.hue2rgb(o,a,t-1/3)*255}},rgb2hsl:({r:e,g:t,b:n},r)=>{e/=255,t/=255,n/=255;let i=Math.max(e,t,n),a=Math.min(e,t,n),o=(i+a)/2;if(r===`l`)return o*100;if(i===a)return 0;let s=i-a,c=o>.5?s/(2-i-a):s/(i+a);if(r===`s`)return c*100;switch(i){case e:return((t-n)/s+(t<n?6:0))*60;case t:return((n-e)/s+2)*60;case n:return((e-t)/s+4)*60;default:return-1}}},t={channel:e,lang:{clamp:(e,t,n)=>t>n?Math.min(t,Math.max(n,e)):Math.min(n,Math.max(t,e)),round:e=>Math.round(e*1e10)/1e10},unit:{dec2hex:e=>{let t=Math.round(e).toString(16);return t.length>1?t:`0${t}`}}},n={};for(let e=0;e<=255;e++)n[e]=t.unit.dec2hex(e);const r={ALL:0,RGB:1,HSL:2};var i=class{constructor(){this.type=r.ALL}get(){return this.type}set(e){if(this.type&&this.type!==e)throw Error(`Cannot change both RGB and HSL channels at the same time`);this.type=e}reset(){this.type=r.ALL}is(e){return this.type===e}},a=class{constructor(e,t){this.color=t,this.changed=!1,this.data=e,this.type=new i}set(e,t){return this.color=t,this.changed=!1,this.data=e,this.type.type=r.ALL,this}_ensureHSL(){let e=this.data,{h:n,s:r,l:i}=e;n===void 0&&(e.h=t.channel.rgb2hsl(e,`h`)),r===void 0&&(e.s=t.channel.rgb2hsl(e,`s`)),i===void 0&&(e.l=t.channel.rgb2hsl(e,`l`))}_ensureRGB(){let e=this.data,{r:n,g:r,b:i}=e;n===void 0&&(e.r=t.channel.hsl2rgb(e,`r`)),r===void 0&&(e.g=t.channel.hsl2rgb(e,`g`)),i===void 0&&(e.b=t.channel.hsl2rgb(e,`b`))}get r(){let e=this.data,n=e.r;return!this.type.is(r.HSL)&&n!==void 0?n:(this._ensureHSL(),t.channel.hsl2rgb(e,`r`))}get g(){let e=this.data,n=e.g;return!this.type.is(r.HSL)&&n!==void 0?n:(this._ensureHSL(),t.channel.hsl2rgb(e,`g`))}get b(){let e=this.data,n=e.b;return!this.type.is(r.HSL)&&n!==void 0?n:(this._ensureHSL(),t.channel.hsl2rgb(e,`b`))}get h(){let e=this.data,n=e.h;return!this.type.is(r.RGB)&&n!==void 0?n:(this._ensureRGB(),t.channel.rgb2hsl(e,`h`))}get s(){let e=this.data,n=e.s;return!this.type.is(r.RGB)&&n!==void 0?n:(this._ensureRGB(),t.channel.rgb2hsl(e,`s`))}get l(){let e=this.data,n=e.l;return!this.type.is(r.RGB)&&n!==void 0?n:(this._ensureRGB(),t.channel.rgb2hsl(e,`l`))}get a(){return this.data.a}set r(e){this.type.set(r.RGB),this.changed=!0,this.data.r=e}set g(e){this.type.set(r.RGB),this.changed=!0,this.data.g=e}set b(e){this.type.set(r.RGB),this.changed=!0,this.data.b=e}set h(e){this.type.set(r.HSL),this.changed=!0,this.data.h=e}set s(e){this.type.set(r.HSL),this.changed=!0,this.data.s=e}set l(e){this.type.set(r.HSL),this.changed=!0,this.data.l=e}set a(e){this.changed=!0,this.data.a=e}};const o=new a({r:0,g:0,b:0,a:0},`transparent`),s={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:e=>{if(e.charCodeAt(0)!==35)return;let t=e.match(s.re);if(!t)return;let n=t[1],r=parseInt(n,16),i=n.length,a=i%4==0,c=i>4,l=c?1:17,u=c?8:4,d=a?0:-1,f=c?255:15;return o.set({r:(r>>u*(d+3)&f)*l,g:(r>>u*(d+2)&f)*l,b:(r>>u*(d+1)&f)*l,a:a?(r&f)*l/255:1},e)},stringify:e=>{let{r:t,g:r,b:i,a}=e;return a<1?`#${n[Math.round(t)]}${n[Math.round(r)]}${n[Math.round(i)]}${n[Math.round(a*255)]}`:`#${n[Math.round(t)]}${n[Math.round(r)]}${n[Math.round(i)]}`}},c={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:e=>{let n=e.match(c.hueRe);if(n){let[,e,r]=n;switch(r){case`grad`:return t.channel.clamp.h(parseFloat(e)*.9);case`rad`:return t.channel.clamp.h(parseFloat(e)*180/Math.PI);case`turn`:return t.channel.clamp.h(parseFloat(e)*360)}}return t.channel.clamp.h(parseFloat(e))},parse:e=>{let n=e.charCodeAt(0);if(n!==104&&n!==72)return;let r=e.match(c.re);if(!r)return;let[,i,a,s,l,u]=r;return o.set({h:c._hue2deg(i),s:t.channel.clamp.s(parseFloat(a)),l:t.channel.clamp.l(parseFloat(s)),a:l?t.channel.clamp.a(u?parseFloat(l)/100:parseFloat(l)):1},e)},stringify:e=>{let{h:n,s:r,l:i,a}=e;return a<1?`hsla(${t.lang.round(n)}, ${t.lang.round(r)}%, ${t.lang.round(i)}%, ${a})`:`hsl(${t.lang.round(n)}, ${t.lang.round(r)}%, ${t.lang.round(i)}%)`}},l={colors:{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`,cyanaqua:`#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`,lavender:`#e6e6fa`,lavenderblush:`#fff0f5`,lawngreen:`#7cfc00`,lemonchiffon:`#fffacd`,lightblue:`#add8e6`,lightcoral:`#f08080`,lightcyan:`#e0ffff`,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`,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`,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`,tan:`#d2b48c`,teal:`#008080`,thistle:`#d8bfd8`,transparent:`#00000000`,turquoise:`#40e0d0`,violet:`#ee82ee`,wheat:`#f5deb3`,white:`#ffffff`,whitesmoke:`#f5f5f5`,yellow:`#ffff00`,yellowgreen:`#9acd32`},parse:e=>{e=e.toLowerCase();let t=l.colors[e];if(t)return s.parse(t)},stringify:e=>{let t=s.stringify(e);for(let e in l.colors)if(l.colors[e]===t)return e}},u={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:e=>{let n=e.charCodeAt(0);if(n!==114&&n!==82)return;let r=e.match(u.re);if(!r)return;let[,i,a,s,c,l,d,f,p]=r;return o.set({r:t.channel.clamp.r(a?parseFloat(i)*2.55:parseFloat(i)),g:t.channel.clamp.g(c?parseFloat(s)*2.55:parseFloat(s)),b:t.channel.clamp.b(d?parseFloat(l)*2.55:parseFloat(l)),a:f?t.channel.clamp.a(p?parseFloat(f)/100:parseFloat(f)):1},e)},stringify:e=>{let{r:n,g:r,b:i,a}=e;return a<1?`rgba(${t.lang.round(n)}, ${t.lang.round(r)}, ${t.lang.round(i)}, ${t.lang.round(a)})`:`rgb(${t.lang.round(n)}, ${t.lang.round(r)}, ${t.lang.round(i)})`}},d={format:{keyword:l,hex:s,rgb:u,rgba:u,hsl:c,hsla:c},parse:e=>{if(typeof e!=`string`)return e;let t=s.parse(e)||u.parse(e)||c.parse(e)||l.parse(e);if(t)return t;throw Error(`Unsupported color format: "${e}"`)},stringify:e=>!e.changed&&e.color?e.color:e.type.is(r.HSL)||e.data.r===void 0?c.stringify(e):e.a<1||!Number.isInteger(e.r)||!Number.isInteger(e.g)||!Number.isInteger(e.b)?u.stringify(e):s.stringify(e)},f=(e,n)=>{let r=d.parse(e);for(let e in n)r[e]=t.channel.clamp[e](n[e]);return d.stringify(r)},p=e=>d.format.hex.stringify(d.parse(e)),m=(e,n,r)=>{let i=d.parse(e),a=i[n],o=t.channel.clamp[n](a+r);return a!==o&&(i[n]=o),d.stringify(i)},h=(e,t)=>m(e,`a`,-t),g=(e,t)=>{let n=d.parse(e),r={};for(let e in t)t[e]&&(r[e]=n[e]+t[e]);return f(e,r)},_=(e,n)=>{let r=d.parse(e),i={},a=(e,t,n)=>t>0?(n-e)*t/100:e*t/100;for(let e in n)i[e]=a(r[e],n[e],t.channel.max[e]);return g(e,i)};export{h as n,p as r,_ as t};
|