@lordicon/utils-lottie 1.2.0 → 1.4.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/CHANGELOG.md +41 -0
- package/README.md +177 -8
- package/dist/icon-data.d.ts +45 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.js +503 -416
- package/dist/interfaces.d.ts +2 -1
- package/dist/lottie.d.ts +20 -4
- package/dist/parsers.d.ts +24 -21
- package/dist/states.d.ts +31 -0
- package/dist/utils.d.ts +1 -1
- package/package.json +37 -18
package/dist/index.js
CHANGED
|
@@ -1,429 +1,516 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
1
|
+
//#region src/parsers.ts
|
|
2
|
+
var e = {
|
|
3
|
+
aliceblue: "#f0f8ff",
|
|
4
|
+
antiquewhite: "#faebd7",
|
|
5
|
+
aqua: "#00ffff",
|
|
6
|
+
aquamarine: "#7fffd4",
|
|
7
|
+
azure: "#f0ffff",
|
|
8
|
+
beige: "#f5f5dc",
|
|
9
|
+
bisque: "#ffe4c4",
|
|
10
|
+
black: "#000000",
|
|
11
|
+
blanchedalmond: "#ffebcd",
|
|
12
|
+
blue: "#0000ff",
|
|
13
|
+
blueviolet: "#8a2be2",
|
|
14
|
+
brown: "#a52a2a",
|
|
15
|
+
burlywood: "#deb887",
|
|
16
|
+
cadetblue: "#5f9ea0",
|
|
17
|
+
chartreuse: "#7fff00",
|
|
18
|
+
chocolate: "#d2691e",
|
|
19
|
+
coral: "#ff7f50",
|
|
20
|
+
cornflowerblue: "#6495ed",
|
|
21
|
+
cornsilk: "#fff8dc",
|
|
22
|
+
crimson: "#dc143c",
|
|
23
|
+
cyan: "#00ffff",
|
|
24
|
+
darkblue: "#00008b",
|
|
25
|
+
darkcyan: "#008b8b",
|
|
26
|
+
darkgoldenrod: "#b8860b",
|
|
27
|
+
darkgray: "#a9a9a9",
|
|
28
|
+
darkgreen: "#006400",
|
|
29
|
+
darkkhaki: "#bdb76b",
|
|
30
|
+
darkmagenta: "#8b008b",
|
|
31
|
+
darkolivegreen: "#556b2f",
|
|
32
|
+
darkorange: "#ff8c00",
|
|
33
|
+
darkorchid: "#9932cc",
|
|
34
|
+
darkred: "#8b0000",
|
|
35
|
+
darksalmon: "#e9967a",
|
|
36
|
+
darkseagreen: "#8fbc8f",
|
|
37
|
+
darkslateblue: "#483d8b",
|
|
38
|
+
darkslategray: "#2f4f4f",
|
|
39
|
+
darkturquoise: "#00ced1",
|
|
40
|
+
darkviolet: "#9400d3",
|
|
41
|
+
deeppink: "#ff1493",
|
|
42
|
+
deepskyblue: "#00bfff",
|
|
43
|
+
dimgray: "#696969",
|
|
44
|
+
dodgerblue: "#1e90ff",
|
|
45
|
+
firebrick: "#b22222",
|
|
46
|
+
floralwhite: "#fffaf0",
|
|
47
|
+
forestgreen: "#228b22",
|
|
48
|
+
fuchsia: "#ff00ff",
|
|
49
|
+
gainsboro: "#dcdcdc",
|
|
50
|
+
ghostwhite: "#f8f8ff",
|
|
51
|
+
gold: "#ffd700",
|
|
52
|
+
goldenrod: "#daa520",
|
|
53
|
+
gray: "#808080",
|
|
54
|
+
green: "#008000",
|
|
55
|
+
greenyellow: "#adff2f",
|
|
56
|
+
honeydew: "#f0fff0",
|
|
57
|
+
hotpink: "#ff69b4",
|
|
58
|
+
indianred: "#cd5c5c",
|
|
59
|
+
indigo: "#4b0082",
|
|
60
|
+
ivory: "#fffff0",
|
|
61
|
+
khaki: "#f0e68c",
|
|
62
|
+
lavender: "#e6e6fa",
|
|
63
|
+
lavenderblush: "#fff0f5",
|
|
64
|
+
lawngreen: "#7cfc00",
|
|
65
|
+
lemonchiffon: "#fffacd",
|
|
66
|
+
lightblue: "#add8e6",
|
|
67
|
+
lightcoral: "#f08080",
|
|
68
|
+
lightcyan: "#e0ffff",
|
|
69
|
+
lightgoldenrodyellow: "#fafad2",
|
|
70
|
+
lightgrey: "#d3d3d3",
|
|
71
|
+
lightgreen: "#90ee90",
|
|
72
|
+
lightpink: "#ffb6c1",
|
|
73
|
+
lightsalmon: "#ffa07a",
|
|
74
|
+
lightseagreen: "#20b2aa",
|
|
75
|
+
lightskyblue: "#87cefa",
|
|
76
|
+
lightslategray: "#778899",
|
|
77
|
+
lightsteelblue: "#b0c4de",
|
|
78
|
+
lightyellow: "#ffffe0",
|
|
79
|
+
lime: "#00ff00",
|
|
80
|
+
limegreen: "#32cd32",
|
|
81
|
+
linen: "#faf0e6",
|
|
82
|
+
magenta: "#ff00ff",
|
|
83
|
+
maroon: "#800000",
|
|
84
|
+
mediumaquamarine: "#66cdaa",
|
|
85
|
+
mediumblue: "#0000cd",
|
|
86
|
+
mediumorchid: "#ba55d3",
|
|
87
|
+
mediumpurple: "#9370db",
|
|
88
|
+
mediumseagreen: "#3cb371",
|
|
89
|
+
mediumslateblue: "#7b68ee",
|
|
90
|
+
mediumspringgreen: "#00fa9a",
|
|
91
|
+
mediumturquoise: "#48d1cc",
|
|
92
|
+
mediumvioletred: "#c71585",
|
|
93
|
+
midnightblue: "#191970",
|
|
94
|
+
mintcream: "#f5fffa",
|
|
95
|
+
mistyrose: "#ffe4e1",
|
|
96
|
+
moccasin: "#ffe4b5",
|
|
97
|
+
navajowhite: "#ffdead",
|
|
98
|
+
navy: "#000080",
|
|
99
|
+
oldlace: "#fdf5e6",
|
|
100
|
+
olive: "#808000",
|
|
101
|
+
olivedrab: "#6b8e23",
|
|
102
|
+
orange: "#ffa500",
|
|
103
|
+
orangered: "#ff4500",
|
|
104
|
+
orchid: "#da70d6",
|
|
105
|
+
palegoldenrod: "#eee8aa",
|
|
106
|
+
palegreen: "#98fb98",
|
|
107
|
+
paleturquoise: "#afeeee",
|
|
108
|
+
palevioletred: "#db7093",
|
|
109
|
+
papayawhip: "#ffefd5",
|
|
110
|
+
peachpuff: "#ffdab9",
|
|
111
|
+
peru: "#cd853f",
|
|
112
|
+
pink: "#ffc0cb",
|
|
113
|
+
plum: "#dda0dd",
|
|
114
|
+
powderblue: "#b0e0e6",
|
|
115
|
+
purple: "#800080",
|
|
116
|
+
rebeccapurple: "#663399",
|
|
117
|
+
red: "#ff0000",
|
|
118
|
+
rosybrown: "#bc8f8f",
|
|
119
|
+
royalblue: "#4169e1",
|
|
120
|
+
saddlebrown: "#8b4513",
|
|
121
|
+
salmon: "#fa8072",
|
|
122
|
+
sandybrown: "#f4a460",
|
|
123
|
+
seagreen: "#2e8b57",
|
|
124
|
+
seashell: "#fff5ee",
|
|
125
|
+
sienna: "#a0522d",
|
|
126
|
+
silver: "#c0c0c0",
|
|
127
|
+
skyblue: "#87ceeb",
|
|
128
|
+
slateblue: "#6a5acd",
|
|
129
|
+
slategray: "#708090",
|
|
130
|
+
snow: "#fffafa",
|
|
131
|
+
springgreen: "#00ff7f",
|
|
132
|
+
steelblue: "#4682b4",
|
|
133
|
+
tan: "#d2b48c",
|
|
134
|
+
teal: "#008080",
|
|
135
|
+
thistle: "#d8bfd8",
|
|
136
|
+
tomato: "#ff6347",
|
|
137
|
+
turquoise: "#40e0d0",
|
|
138
|
+
violet: "#ee82ee",
|
|
139
|
+
wheat: "#f5deb3",
|
|
140
|
+
white: "#ffffff",
|
|
141
|
+
whitesmoke: "#f5f5f5",
|
|
142
|
+
yellow: "#ffff00",
|
|
143
|
+
yellowgreen: "#9acd32"
|
|
143
144
|
};
|
|
144
|
-
function
|
|
145
|
-
|
|
145
|
+
function t(e) {
|
|
146
|
+
return a(e) ?? "#000000";
|
|
146
147
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
148
|
+
var n = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i, r = {
|
|
149
|
+
light: 1,
|
|
150
|
+
regular: 2,
|
|
151
|
+
bold: 3,
|
|
152
|
+
1: 1,
|
|
153
|
+
2: 2,
|
|
154
|
+
3: 3
|
|
155
|
+
}, i = {
|
|
156
|
+
1: "light",
|
|
157
|
+
2: "regular",
|
|
158
|
+
3: "bold"
|
|
159
|
+
};
|
|
160
|
+
function a(t) {
|
|
161
|
+
let r = t.trim(), i = n.exec(r);
|
|
162
|
+
if (i) {
|
|
163
|
+
let e = i[1].toLowerCase();
|
|
164
|
+
return e.length === 6 ? `#${e}` : `#${e[0]}${e[0]}${e[1]}${e[1]}${e[2]}${e[2]}`;
|
|
165
|
+
}
|
|
166
|
+
return e[r.toLowerCase()] ?? null;
|
|
152
167
|
}
|
|
153
|
-
function
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
168
|
+
function o(e) {
|
|
169
|
+
if (!e || typeof e != "string") return;
|
|
170
|
+
let t = {};
|
|
171
|
+
for (let n of e.split(",")) {
|
|
172
|
+
let e = n.split(":").map((e) => e.trim()), r = e.length === 2 && e[0] ? a(e[1]) : null;
|
|
173
|
+
r && (t[e[0].toLowerCase()] = r);
|
|
174
|
+
}
|
|
175
|
+
return t;
|
|
160
176
|
}
|
|
161
|
-
function
|
|
162
|
-
|
|
163
|
-
return e;
|
|
177
|
+
function s(e) {
|
|
178
|
+
return Object.entries(e).map(([e, t]) => [e, a(t)]).filter(([, e]) => e).map(([e, t]) => `${e}:${t}`).join(",");
|
|
164
179
|
}
|
|
165
|
-
function
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
function
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
function z(e, f) {
|
|
175
|
-
const r = Array.isArray(f) ? f : f.split(".");
|
|
176
|
-
let t = e;
|
|
177
|
-
for (const o of r) {
|
|
178
|
-
if (!m(t) || !(o in t))
|
|
179
|
-
return !1;
|
|
180
|
-
t = t[o];
|
|
181
|
-
}
|
|
182
|
-
return !0;
|
|
183
|
-
}
|
|
184
|
-
function F(e, f, r) {
|
|
185
|
-
const t = Array.isArray(f) ? f : f.split(".");
|
|
186
|
-
let o = e;
|
|
187
|
-
for (const n of t) {
|
|
188
|
-
if (!m(o) || !(n in o))
|
|
189
|
-
return r;
|
|
190
|
-
o = o[n];
|
|
191
|
-
}
|
|
192
|
-
return o === void 0 ? r : o;
|
|
193
|
-
}
|
|
194
|
-
function a(e, f, r) {
|
|
195
|
-
let t = e;
|
|
196
|
-
const o = Array.isArray(f) ? f : f.split(".");
|
|
197
|
-
for (let n = 0; n < o.length; ++n)
|
|
198
|
-
n === o.length - 1 ? t[o[n]] = r : t = t[o[n]];
|
|
199
|
-
}
|
|
200
|
-
function k(e) {
|
|
201
|
-
const f = e.toString(16);
|
|
202
|
-
return f.length == 1 ? "0" + f : f;
|
|
180
|
+
function c(e) {
|
|
181
|
+
return r[typeof e == "string" ? e.trim().toLowerCase() : e];
|
|
182
|
+
}
|
|
183
|
+
function l(e) {
|
|
184
|
+
let t = c(e);
|
|
185
|
+
return t ? i[t] : null;
|
|
186
|
+
}
|
|
187
|
+
function u(e) {
|
|
188
|
+
if (typeof e == "string") return e;
|
|
203
189
|
}
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/utils.ts
|
|
204
192
|
function d(e) {
|
|
205
|
-
|
|
193
|
+
return structuredClone(e);
|
|
206
194
|
}
|
|
207
|
-
function
|
|
208
|
-
|
|
195
|
+
function f(e) {
|
|
196
|
+
return e == null;
|
|
209
197
|
}
|
|
210
|
-
function
|
|
211
|
-
|
|
198
|
+
function p(e) {
|
|
199
|
+
return typeof e == "object" && !!e;
|
|
212
200
|
}
|
|
213
|
-
function
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
201
|
+
function m(e, t) {
|
|
202
|
+
let n = Array.isArray(t) ? t : t.split("."), r = e;
|
|
203
|
+
for (let e of n) {
|
|
204
|
+
if (!p(r) || !(e in r)) return !1;
|
|
205
|
+
r = r[e];
|
|
206
|
+
}
|
|
207
|
+
return !0;
|
|
208
|
+
}
|
|
209
|
+
function h(e, t, n) {
|
|
210
|
+
let r = Array.isArray(t) ? t : t.split("."), i = e;
|
|
211
|
+
for (let e of r) {
|
|
212
|
+
if (!p(i) || !(e in i)) return n;
|
|
213
|
+
i = i[e];
|
|
214
|
+
}
|
|
215
|
+
return i === void 0 ? n : i;
|
|
216
|
+
}
|
|
217
|
+
function g(e, t, n) {
|
|
218
|
+
let r = Array.isArray(t) ? t : t.split("."), i = e;
|
|
219
|
+
for (let e of r.slice(0, -1)) {
|
|
220
|
+
if (!p(i)) return;
|
|
221
|
+
i = i[e];
|
|
222
|
+
}
|
|
223
|
+
p(i) && (i[r[r.length - 1]] = n);
|
|
224
|
+
}
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region src/lottie.ts
|
|
227
|
+
function _(e) {
|
|
228
|
+
let t = e.toString(16);
|
|
229
|
+
return t.length == 1 ? "0" + t : t;
|
|
230
|
+
}
|
|
231
|
+
function v(e) {
|
|
232
|
+
return Math.round(e / 255 * 1e3) / 1e3;
|
|
220
233
|
}
|
|
221
234
|
function y(e) {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
function
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
235
|
+
return Math.round(Math.min(Math.max(e, 0), 1) * 255);
|
|
236
|
+
}
|
|
237
|
+
function b(e) {
|
|
238
|
+
return "#" + _(e.r) + _(e.g) + _(e.b);
|
|
239
|
+
}
|
|
240
|
+
function x(e) {
|
|
241
|
+
let t = a(e.startsWith("#") ? e : `#${e}`) ?? "#000000", n = parseInt(t.substring(1), 16);
|
|
242
|
+
return {
|
|
243
|
+
r: n >> 16 & 255,
|
|
244
|
+
g: n >> 8 & 255,
|
|
245
|
+
b: n & 255
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
function S(e) {
|
|
249
|
+
let { r: t, g: n, b: r } = x(e);
|
|
250
|
+
return [
|
|
251
|
+
v(t),
|
|
252
|
+
v(n),
|
|
253
|
+
v(r)
|
|
254
|
+
];
|
|
255
|
+
}
|
|
256
|
+
function C(e) {
|
|
257
|
+
return b({
|
|
258
|
+
r: y(e[0]),
|
|
259
|
+
g: y(e[1]),
|
|
260
|
+
b: y(e[2])
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
function w(e, { lottieInstance: t } = {}) {
|
|
264
|
+
let n = [];
|
|
265
|
+
return !e || !e.layers || e.layers.forEach((e, r) => {
|
|
266
|
+
e.nm && e.ef && e.ef.forEach((e, i) => {
|
|
267
|
+
if (typeof e?.mn != "string" || typeof e?.nm != "string") return;
|
|
268
|
+
let a = e.ef?.[0]?.v?.k;
|
|
269
|
+
if (a === void 0) return;
|
|
270
|
+
let o;
|
|
271
|
+
o = t ? `renderer.elements.${r}.effectsManager.effectElements.${i}.effectElements.0.p.v` : `layers.${r}.ef.${i}.ef.0.v.k`;
|
|
272
|
+
let s;
|
|
273
|
+
if (e.mn === "ADBE Color Control" ? s = "color" : e.mn === "ADBE Slider Control" ? s = "slider" : e.mn === "ADBE Point Control" ? s = "point" : e.mn === "ADBE Checkbox Control" ? s = "checkbox" : e.mn.startsWith("Pseudo/") && (s = "feature"), !s) return;
|
|
274
|
+
let c = e.nm.toLowerCase();
|
|
275
|
+
n.push({
|
|
276
|
+
name: c,
|
|
277
|
+
path: o,
|
|
278
|
+
value: a,
|
|
279
|
+
type: s
|
|
280
|
+
});
|
|
281
|
+
});
|
|
282
|
+
}), n;
|
|
283
|
+
}
|
|
284
|
+
function T(e, t) {
|
|
285
|
+
for (let n of t) g(e, n.path, n.value);
|
|
286
|
+
}
|
|
287
|
+
function E(e, t, n) {
|
|
288
|
+
for (let r of t) if (r.type === "color") {
|
|
289
|
+
if (typeof n == "object" && "r" in n && "g" in n && "b" in n) g(e, r.path, [
|
|
290
|
+
v(n.r),
|
|
291
|
+
v(n.g),
|
|
292
|
+
v(n.b)
|
|
293
|
+
]);
|
|
294
|
+
else if (Array.isArray(n)) g(e, r.path, n);
|
|
295
|
+
else if (typeof n == "string") {
|
|
296
|
+
let t = a(n);
|
|
297
|
+
t && g(e, r.path, S(t));
|
|
298
|
+
}
|
|
299
|
+
} else r.type === "point" ? typeof n == "object" && "x" in n && "y" in n ? (g(e, r.path + ".0", n.x), g(e, r.path + ".1", n.y)) : Array.isArray(n) && (g(e, r.path + ".0", n[0]), g(e, r.path + ".1", n[1])) : g(e, r.path, n);
|
|
300
|
+
}
|
|
301
|
+
function D(e) {
|
|
302
|
+
let t = {};
|
|
303
|
+
for (let n of w(e)) n.type === "color" && Array.isArray(n.value) && (t[n.name] = C(n.value));
|
|
304
|
+
return t;
|
|
305
|
+
}
|
|
306
|
+
function O(e, t) {
|
|
307
|
+
let n = j(t);
|
|
308
|
+
if (!n.size) return e;
|
|
309
|
+
for (let t of w(e)) {
|
|
310
|
+
if (t.type !== "color") continue;
|
|
311
|
+
let r = n.get(C(t.value));
|
|
312
|
+
r && g(e, t.path, S(r));
|
|
313
|
+
}
|
|
314
|
+
return e;
|
|
315
|
+
}
|
|
316
|
+
function k(e, t) {
|
|
317
|
+
let n = j(t), r = {};
|
|
318
|
+
for (let [t, i] of Object.entries(D(e))) {
|
|
319
|
+
let e = n.get(i);
|
|
320
|
+
e && (r[t] = e);
|
|
321
|
+
}
|
|
322
|
+
return r;
|
|
323
|
+
}
|
|
324
|
+
function A(e) {
|
|
325
|
+
return w(e).some((e) => e.name === "stroke" || e.name === "stroke-layers");
|
|
326
|
+
}
|
|
327
|
+
function j(e) {
|
|
328
|
+
let t = /* @__PURE__ */ new Map();
|
|
329
|
+
for (let [n, r] of Object.entries(e)) {
|
|
330
|
+
let e = a(n), i = a(r);
|
|
331
|
+
e && i && t.set(e, i);
|
|
332
|
+
}
|
|
333
|
+
return t;
|
|
334
|
+
}
|
|
335
|
+
function M(e) {
|
|
336
|
+
Array.isArray(e) ? e.forEach(M) : e && typeof e == "object" && ("x" in e && typeof e.x == "string" && delete e.x, Object.values(e).forEach(M));
|
|
337
|
+
}
|
|
338
|
+
//#endregion
|
|
339
|
+
//#region src/icon.ts
|
|
340
|
+
function N(e, t) {
|
|
341
|
+
let n = [];
|
|
342
|
+
for (let r of Object.keys(e)) {
|
|
343
|
+
let i = e[r];
|
|
344
|
+
p(i) && n.push(...N(i, t));
|
|
345
|
+
}
|
|
346
|
+
return e.x && typeof e.x == "string" && e.x.includes(t) && n.push(e), n;
|
|
347
|
+
}
|
|
348
|
+
function P(e, t, n) {
|
|
349
|
+
let r = c(n);
|
|
350
|
+
if (!r) return;
|
|
351
|
+
let i = t.map((e) => e.name);
|
|
352
|
+
if (i.includes("stroke-layers")) {
|
|
353
|
+
let t = {
|
|
354
|
+
1: N(e, "effect('stroke-layers')('Menu') == 1"),
|
|
355
|
+
2: N(e, "effect('stroke-layers')('Menu') == 2"),
|
|
356
|
+
3: N(e, "effect('stroke-layers')('Menu') == 3")
|
|
357
|
+
};
|
|
358
|
+
for (let e of [
|
|
359
|
+
1,
|
|
360
|
+
2,
|
|
361
|
+
3
|
|
362
|
+
]) for (let n of t[e]) n.k = e == r ? 100 : 0;
|
|
363
|
+
} else if (i.includes("stroke")) {
|
|
364
|
+
let n = /\$bm_div\(value,[ ]{0,}([0-9]+)\)/gm, i = t.filter((e) => e.name === "stroke")[0], a = N(e, "effect('stroke')('Menu')");
|
|
365
|
+
for (let e of a) {
|
|
366
|
+
let t = i && i.value ? r / i.value : r;
|
|
367
|
+
if (p(e.k) && Array.isArray(e.k)) for (let n of e.k) Array.isArray(n.s) && (n.s = n.s.map((e) => e * t));
|
|
368
|
+
else e.k *= t;
|
|
369
|
+
e.x = e.x.replace(n, `$bm_div(value, ${r})`);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
for (let n of t) (n.name === "stroke" || n.name === "stroke-layers") && E(e, [n], r);
|
|
373
|
+
}
|
|
374
|
+
function F(e, t, n) {
|
|
375
|
+
for (let r of Object.keys(n)) {
|
|
376
|
+
let i = a(n[r]);
|
|
377
|
+
if (!i) continue;
|
|
378
|
+
let o = N(e, `effect('${r}')('Color')`);
|
|
379
|
+
for (let e of o) e.k = [...S(i), 1];
|
|
380
|
+
for (let n of t) n.name === r && E(e, [n], i);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
function I(e) {
|
|
384
|
+
let t = e.split(":");
|
|
385
|
+
return t[0] === "default" && t.shift(), t[0];
|
|
386
|
+
}
|
|
387
|
+
function L(e) {
|
|
388
|
+
if (typeof e != "string") return null;
|
|
389
|
+
let t = e.split(":");
|
|
390
|
+
return t.length > 1 && [
|
|
391
|
+
"light",
|
|
392
|
+
"regular",
|
|
393
|
+
"bold"
|
|
394
|
+
].includes(t[0]) && t.shift(), t[0];
|
|
395
|
+
}
|
|
396
|
+
function R(e, t) {
|
|
397
|
+
return typeof t == "string" && (e.markers || []).some((e) => typeof e.cm == "string" && I(e.cm) === t) ? t : null;
|
|
398
|
+
}
|
|
399
|
+
function z(e, t, n) {
|
|
400
|
+
let r = R(e, n);
|
|
401
|
+
if (r) for (let t of e.markers || []) {
|
|
402
|
+
let n = t.cm.split(":");
|
|
403
|
+
if (n[0] === "default" && n.shift(), n[0] !== r) {
|
|
404
|
+
t.cm = n.join(":");
|
|
405
|
+
continue;
|
|
406
|
+
}
|
|
407
|
+
t.cm = ["default", ...n].join(":"), e.ip = t.tm, e.op = t.tm + t.dr + 1;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
function B(e, t, n) {
|
|
411
|
+
let r = R(e, n);
|
|
412
|
+
if (!r) return;
|
|
413
|
+
let i = (e.markers || []).map((e) => I(e.cm));
|
|
414
|
+
e.markers &&= e.markers.filter((e) => I(e.cm) === r);
|
|
415
|
+
for (let t of ["assets", "layers"]) Array.isArray(e[t]) && (e[t] = e[t].filter((e) => {
|
|
416
|
+
let t = L(e.nm);
|
|
417
|
+
return t === null || !i.includes(t) || t === r;
|
|
418
|
+
}));
|
|
419
|
+
let a = e.ip;
|
|
420
|
+
e.ip = 0, e.op -= a;
|
|
421
|
+
for (let t of e.markers || []) t.tm -= a;
|
|
422
|
+
for (let t of e.layers || []) t.ip >= a && (t.ip -= a, t.st -= a, t.op -= a);
|
|
423
|
+
}
|
|
424
|
+
function V(e, t, n) {
|
|
425
|
+
let r = c(n);
|
|
426
|
+
if (!r) return;
|
|
427
|
+
let i = {
|
|
428
|
+
1: "light",
|
|
429
|
+
2: "regular",
|
|
430
|
+
3: "bold"
|
|
431
|
+
};
|
|
432
|
+
for (let t of ["assets", "layers"]) Array.isArray(e[t]) && (e[t] = e[t].filter((e) => {
|
|
433
|
+
if (typeof e.nm != "string") return !0;
|
|
434
|
+
let [t] = e.nm.split(":");
|
|
435
|
+
return !(Object.values(i).includes(t) && e.nm.includes(":")) || t === i[r];
|
|
436
|
+
}));
|
|
437
|
+
for (let e of t) e.name === "stroke" || e.name;
|
|
438
|
+
}
|
|
439
|
+
function H(e, t, n) {
|
|
440
|
+
let r = w(e), i = d(e);
|
|
441
|
+
return t.stroke && P(i, r, t.stroke), t.colors && F(i, r, t.colors), t.state && z(i, r, t.state), (n === "partial" || n === "full") && t.stroke && V(i, r, t.stroke), n === "full" && (t.state && B(i, r, t.state), M(i)), i;
|
|
442
|
+
}
|
|
443
|
+
//#endregion
|
|
444
|
+
//#region src/icon-data.ts
|
|
445
|
+
function U(e) {
|
|
446
|
+
if (typeof e != "object" || !e) return !1;
|
|
447
|
+
let t = e;
|
|
448
|
+
return [
|
|
449
|
+
"fr",
|
|
450
|
+
"ip",
|
|
451
|
+
"op",
|
|
452
|
+
"w",
|
|
453
|
+
"h"
|
|
454
|
+
].every((e) => typeof t[e] == "number") && Array.isArray(t.layers);
|
|
455
|
+
}
|
|
456
|
+
//#endregion
|
|
457
|
+
//#region src/states.ts
|
|
458
|
+
var W = ["default"];
|
|
386
459
|
function G(e) {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
460
|
+
return !e || !e.markers || !Array.isArray(e.markers) ? [] : e.markers.filter((e) => typeof e?.cm == "string" && typeof e.tm == "number" && e.dr > 0).map((e) => {
|
|
461
|
+
let t = e.cm.split(":"), n = {
|
|
462
|
+
time: e.tm,
|
|
463
|
+
duration: e.dr,
|
|
464
|
+
name: "",
|
|
465
|
+
default: !1,
|
|
466
|
+
params: []
|
|
467
|
+
};
|
|
468
|
+
for (; W.includes(t[0]);) {
|
|
469
|
+
switch (t[0]) {
|
|
470
|
+
case "default":
|
|
471
|
+
n.default = !0;
|
|
472
|
+
break;
|
|
473
|
+
default: throw Error(`Unsupported state flag: ${t[0]}`);
|
|
474
|
+
}
|
|
475
|
+
t.shift();
|
|
476
|
+
}
|
|
477
|
+
return n.name = t[0], n.params = t.slice(1, t.length), n;
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
function K(e) {
|
|
481
|
+
return [e.time, e.time + e.duration + 1];
|
|
482
|
+
}
|
|
483
|
+
function q(e) {
|
|
484
|
+
let t = e.params.length ? parseFloat(e.params[0]) : NaN;
|
|
485
|
+
return t > 0 && t < 1 ? t : null;
|
|
486
|
+
}
|
|
487
|
+
function J(e, t) {
|
|
488
|
+
let n = t ?? q(e);
|
|
489
|
+
if (n === null || !(n > 0 && n < 1)) return null;
|
|
490
|
+
let [r, i] = K(e);
|
|
491
|
+
if (i - r < 2) return null;
|
|
492
|
+
let a = r + Math.floor((e.duration + 1) * n), o = Math.min(Math.max(a, r + 1), i - 1);
|
|
493
|
+
return [[r, o], [o, i]];
|
|
494
|
+
}
|
|
495
|
+
function Y(e, t) {
|
|
496
|
+
return e.find((e) => e.name === t) ?? e.find((e) => e.name.startsWith(t)) ?? null;
|
|
497
|
+
}
|
|
498
|
+
var X = [
|
|
499
|
+
"in",
|
|
500
|
+
"hover",
|
|
501
|
+
"morph",
|
|
502
|
+
"loop"
|
|
503
|
+
];
|
|
504
|
+
function Z(e) {
|
|
505
|
+
let t = (typeof e == "string" ? e.replace(/^default:/, "") : e.name).split("-")[0];
|
|
506
|
+
return X.includes(t) ? t : null;
|
|
507
|
+
}
|
|
508
|
+
function Q(e, t) {
|
|
509
|
+
let n = J(e, t);
|
|
510
|
+
return n ? n[0][1] - 1 : e.time + e.duration;
|
|
511
|
+
}
|
|
512
|
+
function $(e) {
|
|
513
|
+
return e.find((e) => e.default) ?? null;
|
|
514
|
+
}
|
|
515
|
+
//#endregion
|
|
516
|
+
export { k as colorsByName, H as customizeIcon, d as deepClone, D as defaultColors, $ as defaultState, w as extractLottieProperties, Y as findState, s as formatColors, h as get, m as has, A as hasStroke, x as hexToRgb, S as hexToTupleColor, U as isIconData, f as isNil, p as isObjectLike, t as parseColor, o as parseColors, u as parseState, c as parseStroke, G as readStates, O as remapColors, M as removeExpressions, T as resetLottieProperties, a as resolveColor, b as rgbToHex, g as set, J as splitSegment, Q as stateEndFrame, q as stateRatio, K as stateSegment, Z as stateType, l as strokeName, C as tupleColorToHex, E as updateLottieProperties };
|