@lottiefiles/lottie-js
Advanced tools
Comparing version 0.2.4 to 0.3.1
# Changelog | ||
## 0.2.4 | ||
## 0.3.1 | ||
@@ -5,0 +5,0 @@ ### Patch Changes |
/*! | ||
* @lottiefiles/lottie-js - v0.2.4 | ||
* Compiled Thu, 11 Nov 2021 11:12:29 UTC | ||
* @lottiefiles/lottie-js - v0.3.1 | ||
* Compiled Thu, 16 Dec 2021 04:57:44 UTC | ||
* | ||
@@ -216,2 +216,4 @@ * Copyright LottieFiles. All rights reserved. | ||
this.value = 0; | ||
this.frameInTangent = [0, 0]; | ||
this.frameOutTangent = [1, 1]; | ||
this.hold = false; | ||
@@ -221,5 +223,8 @@ this.frame = frame; | ||
} | ||
fromJSON(json) { | ||
fromJSON(json, valueClass = void 0) { | ||
this.frame = json.t; | ||
this.value = json.s; | ||
if (valueClass === void 0) | ||
this.value = json.s; | ||
else | ||
this.value = valueClass.fromJSON(json.s); | ||
const hasFrameTangents = "i" in json && "o" in json; | ||
@@ -268,2 +273,42 @@ const hasValueTangents = "ti" in json && "to" in json; | ||
class Color { | ||
toJSON() { | ||
return this.toRgbArray(); | ||
} | ||
static fromJSON(json) { | ||
if (json.length > 3) | ||
return ColorRgba.fromJSON(json); | ||
else if (json.length == 3) | ||
return ColorRgb.fromJSON(json); | ||
else | ||
return new ColorRgb(0, 0, 0); | ||
} | ||
} | ||
class ColorRgb extends Color { | ||
constructor(r, g, b) { | ||
super(); | ||
this.r = r; | ||
this.g = g; | ||
this.b = b; | ||
} | ||
toRgbArray() { | ||
return [this.r, this.g, this.b]; | ||
} | ||
static fromJSON(json) { | ||
return new ColorRgb(json[0], json[1], json[2]); | ||
} | ||
} | ||
class ColorRgba extends ColorRgb { | ||
constructor(r, g, b, a = 1) { | ||
super(r, g, b); | ||
this.a = a; | ||
} | ||
toRgbArray() { | ||
return [this.r, this.g, this.b, this.a]; | ||
} | ||
static fromJSON(json) { | ||
return new ColorRgba(json[0], json[1], json[2], json[3]); | ||
} | ||
} | ||
class Property { | ||
@@ -273,3 +318,2 @@ constructor(parent, type, values = []) { | ||
this.isAnimated = false; | ||
this.index = 0; | ||
this.values = []; | ||
@@ -289,3 +333,6 @@ this._parent = parent; | ||
this.isAnimated = json.a === 1; | ||
this.values = this.isAnimated ? json.k.map((v) => new KeyFrame().fromJSON(v)) : [new KeyFrame().fromJSON({t: 0, s: json.k})]; | ||
let valueClass = void 0; | ||
if (this.type == exports.PropertyType.COLOR) | ||
valueClass = Color; | ||
this.values = this.isAnimated ? json.k.map((v) => new KeyFrame().fromJSON(v, valueClass)) : [new KeyFrame().fromJSON({t: 0, s: json.k}, valueClass)]; | ||
if (this.type === exports.PropertyType.COLOR) { | ||
@@ -298,6 +345,7 @@ this.maxColors = "p" in json ? json.p : void 0; | ||
let value; | ||
if (this.isAnimated === false) { | ||
const animated = this.isAnimated !== false || this.values.length > 1; | ||
if (animated) { | ||
value = this.values; | ||
} else { | ||
value = this.values.length ? this.values[0].value : 0; | ||
} else { | ||
value = this.values; | ||
} | ||
@@ -307,3 +355,3 @@ return { | ||
ix: this.index, | ||
a: this.isAnimated ? 1 : 0, | ||
a: animated ? 1 : 0, | ||
k: value, | ||
@@ -315,103 +363,49 @@ p: this.maxColors | ||
class GradientStop { | ||
constructor(offset = 0, color = []) { | ||
this.offset = offset; | ||
this.color = color; | ||
} | ||
get hasAlpha() { | ||
return this.color.length > 3; | ||
} | ||
get red() { | ||
return this.color[0]; | ||
} | ||
get green() { | ||
return this.color[1]; | ||
} | ||
get blue() { | ||
return this.color[2]; | ||
} | ||
get alpha() { | ||
return this.color[3]; | ||
} | ||
} | ||
class GradientColorsProperty extends Property { | ||
class Transform { | ||
constructor() { | ||
super(...arguments); | ||
this.colorCount = 0; | ||
this.anchor = new Property(this, exports.PropertyType.ANCHOR, [new KeyFrame(0, [0, 0])]); | ||
this.opacity = new Property(this, exports.PropertyType.OPACITY, [new KeyFrame(0, 100)]); | ||
this.position = new Property(this, exports.PropertyType.POSITION, [new KeyFrame(0, [0, 0])]); | ||
this.rotation = new Property(this, exports.PropertyType.ROTATION, [new KeyFrame(0, 0)]); | ||
this.scale = new Property(this, exports.PropertyType.SCALE, [new KeyFrame(0, [100, 100])]); | ||
this.skew = new Property(this, exports.PropertyType.SKEW); | ||
this.skewAxis = new Property(this, exports.PropertyType.SKEW_AXIS); | ||
} | ||
keyframeValue(index) { | ||
if (index >= this.values.length) | ||
return []; | ||
return this.values[index].value; | ||
} | ||
keyframeHasAlpha(index) { | ||
return this.keyframeValue(index).length == this.colorCount * 6; | ||
} | ||
keframeStops(index) { | ||
const values = this.keyframeValue(index); | ||
const stops = []; | ||
const hasAlpha = this.keyframeHasAlpha(index); | ||
for (let i = 0; i < this.colorCount; i++) { | ||
const color = values.slice(i, 3); | ||
if (hasAlpha) | ||
color.push(values[this.colorCount * 4 + i * 2]); | ||
stops.push(new GradientStop(values[i * 4], color)); | ||
fromJSON(json) { | ||
this.rotation = "r" in json ? new Property(this, exports.PropertyType.ROTATION).fromJSON(json.r) : void 0; | ||
"o" in json && this.opacity.fromJSON(json.o); | ||
"p" in json && this.position.fromJSON(json.p); | ||
"a" in json && this.anchor.fromJSON(json.a); | ||
"s" in json && this.scale.fromJSON(json.s); | ||
this.skew = "sk" in json ? new Property(this, exports.PropertyType.SKEW).fromJSON(json.sk) : void 0; | ||
this.skewAxis = "sa" in json ? new Property(this, exports.PropertyType.SKEW_AXIS).fromJSON(json.sa) : void 0; | ||
if ("or" in json) { | ||
this.orientation = new Property(this, exports.PropertyType.ORIENTATION).fromJSON(json.or); | ||
} | ||
return stops; | ||
} | ||
setKeyframeStops(index, stops) { | ||
if (index >= this.values.length) | ||
return; | ||
if (stops.length > this.colorCount) | ||
this.colorCount = stops.length; | ||
this.values[index].value = this.stopsToArray(stops); | ||
} | ||
addKeyframe(frame, stops) { | ||
const keyframe = new KeyFrame(frame, this.stopsToArray(stops)); | ||
if (stops.length > this.colorCount) | ||
this.colorCount = stops.length; | ||
this.values.push(keyframe); | ||
return keyframe; | ||
} | ||
stopsToArray(stops) { | ||
let hasAlpha = false; | ||
const result = []; | ||
for (const color of stops) { | ||
result.push(color.offset); | ||
result.push(color.red); | ||
result.push(color.green); | ||
result.push(color.blue); | ||
if (color.hasAlpha) | ||
hasAlpha = true; | ||
if ("rx" in json) { | ||
this.rotationX = new Property(this, exports.PropertyType.ROTATION_X).fromJSON(json.rx); | ||
} | ||
if (hasAlpha) { | ||
for (const color of stops) { | ||
result.push(color.offset); | ||
result.push(color.alpha !== void 0 ? color.alpha : 1); | ||
} | ||
if ("ry" in json) { | ||
this.rotationY = new Property(this, exports.PropertyType.ROTATION_Y).fromJSON(json.ry); | ||
} | ||
return result; | ||
if ("rz" in json) { | ||
this.rotationZ = new Property(this, exports.PropertyType.ROTATION_Z).fromJSON(json.rz); | ||
} | ||
return this; | ||
} | ||
} | ||
class Gradient { | ||
constructor() { | ||
this.gradientColors = new GradientColorsProperty(this, exports.PropertyType.COLOR); | ||
} | ||
get colorCount() { | ||
return this.gradientColors.colorCount; | ||
} | ||
set colorCount(count) { | ||
this.gradientColors.colorCount = count; | ||
} | ||
toJSON() { | ||
return { | ||
p: this.colorCount, | ||
k: this.gradientColors | ||
a: this.anchor, | ||
o: this.opacity, | ||
p: this.position, | ||
r: this.rotation, | ||
s: this.scale, | ||
sk: this.skew, | ||
sa: this.skewAxis, | ||
rx: this.rotationX, | ||
ry: this.rotationY, | ||
rz: this.rotationZ, | ||
or: this.orientation | ||
}; | ||
} | ||
fromJSON(json) { | ||
this.gradientColors.fromJSON(json.k); | ||
this.colorCount = json.p; | ||
return this; | ||
} | ||
} | ||
@@ -433,6 +427,3 @@ | ||
this.width = 0; | ||
this.opacity = new Property(this, exports.PropertyType.OPACITY); | ||
this.position = new Property(this, exports.PropertyType.POSITION); | ||
this.anchor = new Property(this, exports.PropertyType.ANCHOR); | ||
this.scale = new Property(this, exports.PropertyType.SCALE); | ||
this.transform = new Transform(); | ||
this.parent = parent; | ||
@@ -465,3 +456,3 @@ } | ||
this.height = json.h; | ||
this.id = json.ld; | ||
this.id = json.ln; | ||
this.index = json.ind; | ||
@@ -491,7 +482,3 @@ this.inPoint = json.ip; | ||
} | ||
this.opacity.fromJSON(json.ks.o); | ||
this.position.fromJSON(json.ks.p); | ||
this.anchor.fromJSON(json.ks.a); | ||
this.scale.fromJSON(json.ks.s); | ||
this.rotation = new Property(this, exports.PropertyType.ROTATION).fromJSON(json.ks.r); | ||
this.transform.fromJSON(json.ks); | ||
return this; | ||
@@ -511,7 +498,3 @@ } | ||
ks: { | ||
a: this.anchor, | ||
o: this.opacity, | ||
p: this.position, | ||
r: this.rotation, | ||
s: this.scale | ||
...this.transform.toJSON() | ||
}, | ||
@@ -544,3 +527,3 @@ ln: this.id, | ||
this.height = json.h; | ||
this.id = json.ld; | ||
this.id = json.ln; | ||
this.index = json.ind; | ||
@@ -570,7 +553,3 @@ this.inPoint = json.ip; | ||
} | ||
this.opacity.fromJSON(json.ks.o); | ||
this.position.fromJSON(json.ks.p); | ||
this.anchor.fromJSON(json.ks.a); | ||
this.scale.fromJSON(json.ks.s); | ||
this.rotation = new Property(this, exports.PropertyType.ROTATION).fromJSON(json.ks.r); | ||
this.transform.fromJSON(json.ks); | ||
this.refId = json.refId; | ||
@@ -592,7 +571,3 @@ return this; | ||
ks: { | ||
a: this.anchor, | ||
o: this.opacity, | ||
p: this.position, | ||
r: this.rotation, | ||
s: this.scale | ||
...this.transform.toJSON() | ||
}, | ||
@@ -625,3 +600,3 @@ ln: this.id, | ||
this.height = json.h; | ||
this.id = json.ld; | ||
this.id = json.ln; | ||
this.index = json.ind; | ||
@@ -651,7 +626,3 @@ this.inPoint = json.ip; | ||
} | ||
this.opacity.fromJSON(json.ks.o); | ||
this.position.fromJSON(json.ks.p); | ||
this.anchor.fromJSON(json.ks.a); | ||
this.scale.fromJSON(json.ks.s); | ||
this.rotation = new Property(this, exports.PropertyType.ROTATION).fromJSON(json.ks.r); | ||
this.transform.fromJSON(json.ks); | ||
this.refId = json.refId; | ||
@@ -672,7 +643,3 @@ return this; | ||
ks: { | ||
a: this.anchor, | ||
o: this.opacity, | ||
p: this.position, | ||
r: this.rotation, | ||
s: this.scale | ||
...this.transform.toJSON() | ||
}, | ||
@@ -696,2 +663,105 @@ ln: this.id, | ||
class GradientStop { | ||
constructor(offset = 0, color = []) { | ||
this.offset = offset; | ||
this.color = color; | ||
} | ||
get hasAlpha() { | ||
return this.color.length > 3; | ||
} | ||
get red() { | ||
return this.color[0]; | ||
} | ||
get green() { | ||
return this.color[1]; | ||
} | ||
get blue() { | ||
return this.color[2]; | ||
} | ||
get alpha() { | ||
return this.color[3]; | ||
} | ||
} | ||
class GradientColorsProperty extends Property { | ||
constructor() { | ||
super(...arguments); | ||
this.colorCount = 0; | ||
} | ||
keyframeValue(index) { | ||
if (index >= this.values.length) | ||
return []; | ||
return this.values[index].value; | ||
} | ||
keyframeHasAlpha(index) { | ||
return this.keyframeValue(index).length == this.colorCount * 6; | ||
} | ||
keframeStops(index) { | ||
const values = this.keyframeValue(index); | ||
const stops = []; | ||
const hasAlpha = this.keyframeHasAlpha(index); | ||
for (let i = 0; i < this.colorCount; i++) { | ||
const color = values.slice(i, 3); | ||
if (hasAlpha) | ||
color.push(values[this.colorCount * 4 + i * 2]); | ||
stops.push(new GradientStop(values[i * 4], color)); | ||
} | ||
return stops; | ||
} | ||
setKeyframeStops(index, stops) { | ||
if (index >= this.values.length) | ||
return; | ||
if (stops.length > this.colorCount) | ||
this.colorCount = stops.length; | ||
this.values[index].value = this.stopsToArray(stops); | ||
} | ||
addKeyframe(frame, stops) { | ||
const keyframe = new KeyFrame(frame, this.stopsToArray(stops)); | ||
if (stops.length > this.colorCount) | ||
this.colorCount = stops.length; | ||
this.values.push(keyframe); | ||
return keyframe; | ||
} | ||
stopsToArray(stops) { | ||
let hasAlpha = false; | ||
const result = []; | ||
for (const color of stops) { | ||
result.push(color.offset); | ||
result.push(color.red); | ||
result.push(color.green); | ||
result.push(color.blue); | ||
if (color.hasAlpha) | ||
hasAlpha = true; | ||
} | ||
if (hasAlpha) { | ||
for (const color of stops) { | ||
result.push(color.offset); | ||
result.push(color.alpha !== void 0 ? color.alpha : 1); | ||
} | ||
} | ||
return result; | ||
} | ||
} | ||
class Gradient { | ||
constructor() { | ||
this.gradientColors = new GradientColorsProperty(this, exports.PropertyType.COLOR); | ||
} | ||
get colorCount() { | ||
return this.gradientColors.colorCount; | ||
} | ||
set colorCount(count) { | ||
this.gradientColors.colorCount = count; | ||
} | ||
toJSON() { | ||
return { | ||
p: this.colorCount, | ||
k: this.gradientColors | ||
}; | ||
} | ||
fromJSON(json) { | ||
this.gradientColors.fromJSON(json.k); | ||
this.colorCount = json.p; | ||
return this; | ||
} | ||
} | ||
class Shape { | ||
@@ -745,3 +815,3 @@ constructor(parent) { | ||
this.fillRule = exports.FillRuleType.EVEN_ODD; | ||
this.opacity = new Property(this, exports.PropertyType.OPACITY); | ||
this.opacity = new Property(this, exports.PropertyType.OPACITY, [new KeyFrame(0, 100)]); | ||
} | ||
@@ -928,2 +998,53 @@ fromJSON(json) { | ||
class StarShape extends Shape { | ||
constructor() { | ||
super(...arguments); | ||
this.type = exports.ShapeType.STAR; | ||
this.position = new Property(this, exports.PropertyType.POSITION); | ||
this.innerRadius = new Property(this, exports.PropertyType.NUMBER); | ||
this.innerRoundness = new Property(this, exports.PropertyType.NUMBER); | ||
this.outerRadius = new Property(this, exports.PropertyType.NUMBER); | ||
this.outerRoundness = new Property(this, exports.PropertyType.NUMBER); | ||
this.rotation = new Property(this, exports.PropertyType.ROTATION); | ||
this.points = new Property(this, exports.PropertyType.NUMBER); | ||
this.starType = exports.StarType.STAR; | ||
} | ||
fromJSON(json) { | ||
this.classNames = json.cl; | ||
this.id = json.ln; | ||
this.isHidden = json.hd; | ||
this.matchName = json.mn; | ||
this.name = json.nm; | ||
this.position.fromJSON(json.p); | ||
this.innerRadius.fromJSON(json.ir); | ||
this.innerRoundness.fromJSON(json.is); | ||
this.outerRadius.fromJSON(json.or); | ||
this.outerRoundness.fromJSON(json.os); | ||
this.rotation.fromJSON(json.r); | ||
this.points.fromJSON(json.pt); | ||
this.starType = json.sy; | ||
this.direction = json.d; | ||
return this; | ||
} | ||
toJSON() { | ||
return { | ||
ty: this.type, | ||
cl: this.classNames, | ||
hd: this.isHidden, | ||
ln: this.id, | ||
mn: this.matchName, | ||
nm: this.name, | ||
p: this.position, | ||
ir: this.innerRadius, | ||
is: this.innerRoundness, | ||
or: this.outerRadius, | ||
os: this.outerRoundness, | ||
r: this.rotation, | ||
pt: this.points, | ||
sy: this.starType, | ||
d: this.direction | ||
}; | ||
} | ||
} | ||
class StrokeShape extends Shape { | ||
@@ -937,3 +1058,3 @@ constructor() { | ||
this.lineJoinType = exports.LineJoinType.ROUND; | ||
this.opacity = new Property(this, exports.PropertyType.OPACITY); | ||
this.opacity = new Property(this, exports.PropertyType.OPACITY, [new KeyFrame(0, 100)]); | ||
this.width = new Property(this, exports.PropertyType.STROKE_WIDTH); | ||
@@ -1019,13 +1140,7 @@ } | ||
this.type = exports.ShapeType.GROUP; | ||
this.anchor = new Property(this, exports.PropertyType.ANCHOR); | ||
this.blendMode = exports.BlendMode.NORMAL; | ||
this.isHidden = false; | ||
this.numProperties = 0; | ||
this.opacity = new Property(this, exports.PropertyType.OPACITY); | ||
this.position = new Property(this, exports.PropertyType.POSITION); | ||
this.rotation = new Property(this, exports.PropertyType.ROTATION); | ||
this.scale = new Property(this, exports.PropertyType.SCALE); | ||
this.transform = new Transform(); | ||
this.shapes = []; | ||
this.skew = new Property(this, exports.PropertyType.SKEW); | ||
this.skewAxis = new Property(this, exports.PropertyType.SKEW_AXIS); | ||
} | ||
@@ -1048,13 +1163,3 @@ fromJSON(json) { | ||
} | ||
this.anchor.fromJSON(jShape.a); | ||
this.opacity.fromJSON(jShape.o); | ||
this.position.fromJSON(jShape.p); | ||
this.rotation.fromJSON(jShape.r); | ||
this.scale.fromJSON(jShape.s); | ||
if (jShape.sk) { | ||
this.skew.fromJSON(jShape.sk); | ||
} | ||
if (jShape.sa) { | ||
this.skewAxis.fromJSON(jShape.sa); | ||
} | ||
this.transform.fromJSON(jShape); | ||
} catch (e) { | ||
@@ -1085,5 +1190,13 @@ } | ||
return new MergeShape(this); | ||
} else if (type === exports.ShapeType.STAR) { | ||
return new StarShape(this); | ||
} | ||
throw new Error(`Invalid or unknown shape type: ${type}`); | ||
} | ||
addShape(shape2) { | ||
if (!(shape2 instanceof Shape)) | ||
shape2 = this.createShape(shape2); | ||
this.shapes.push(shape2); | ||
return shape2; | ||
} | ||
toJSON() { | ||
@@ -1094,9 +1207,3 @@ const shapes = JSON.parse(JSON.stringify(this.shapes)); | ||
nm: "Transform", | ||
a: this.anchor, | ||
o: this.opacity, | ||
p: this.position, | ||
r: this.rotation, | ||
s: this.scale, | ||
sk: this.skew, | ||
sa: this.skewAxis | ||
...this.transform.toJSON() | ||
}); | ||
@@ -1119,2 +1226,157 @@ return { | ||
class GradientStrokeShape extends Shape { | ||
constructor() { | ||
super(...arguments); | ||
this.type = exports.ShapeType.GRADIENT_STROKE; | ||
this.blendMode = exports.BlendMode.NORMAL; | ||
this.endPoint = new Property(this, exports.PropertyType.POSITION); | ||
this.gradientColors = new Gradient(); | ||
this.gradientType = exports.GradientFillType.LINEAR; | ||
this.highlightAngle = new Property(this, exports.PropertyType.NUMBER); | ||
this.highlightLength = new Property(this, exports.PropertyType.NUMBER); | ||
this.opacity = new Property(this, exports.PropertyType.OPACITY); | ||
this.startPoint = new Property(this, exports.PropertyType.POSITION); | ||
this.lineCapType = exports.LineCapType.ROUND; | ||
this.lineJoinType = exports.LineJoinType.ROUND; | ||
this.width = new Property(this, exports.PropertyType.STROKE_WIDTH); | ||
} | ||
fromJSON(json) { | ||
this.classNames = json.cl; | ||
this.id = json.ln; | ||
this.isHidden = json.hd; | ||
this.matchName = json.mn; | ||
this.name = json.nm; | ||
this.blendMode = json.bm; | ||
this.opacity.fromJSON(json.o); | ||
this.endPoint.fromJSON(json.e); | ||
this.gradientColors.fromJSON(json.g); | ||
this.gradientType = json.t; | ||
this.startPoint.fromJSON(json.s); | ||
if (this.gradientType === exports.GradientFillType.LINEAR) { | ||
this.highlightAngle.fromJSON(json.a); | ||
this.highlightLength.fromJSON(json.h); | ||
} | ||
this.lineCapType = json.lc in exports.LineCapType ? json.lc : exports.LineCapType.ROUND; | ||
this.lineJoinType = json.lj in exports.LineJoinType ? json.lj : exports.LineJoinType.ROUND; | ||
this.miterLimit = json.ml; | ||
this.width.fromJSON(json.w); | ||
return this; | ||
} | ||
toJSON() { | ||
return { | ||
ty: this.type, | ||
cl: this.classNames, | ||
hd: this.isHidden, | ||
ln: this.id, | ||
mn: this.matchName, | ||
nm: this.name, | ||
bm: this.blendMode, | ||
o: this.opacity, | ||
e: this.endPoint, | ||
g: this.gradientColors, | ||
t: this.gradientType, | ||
a: this.highlightAngle, | ||
h: this.highlightLength, | ||
s: this.startPoint, | ||
lc: this.lineCapType, | ||
lj: this.lineJoinType, | ||
ml: this.miterLimit, | ||
w: this.width | ||
}; | ||
} | ||
} | ||
class RepeaterShape extends Shape { | ||
constructor() { | ||
super(...arguments); | ||
this.type = exports.ShapeType.REPEATER; | ||
this.anchor = new Property(this, exports.PropertyType.ANCHOR); | ||
this.startOpacity = new Property(this, exports.PropertyType.OPACITY); | ||
this.endOpacity = new Property(this, exports.PropertyType.OPACITY); | ||
this.position = new Property(this, exports.PropertyType.POSITION); | ||
this.rotation = new Property(this, exports.PropertyType.ROTATION); | ||
this.scale = new Property(this, exports.PropertyType.SCALE); | ||
this.shapes = []; | ||
this.skew = new Property(this, exports.PropertyType.SKEW); | ||
this.skewAxis = new Property(this, exports.PropertyType.SKEW_AXIS); | ||
this.copies = new Property(this, exports.PropertyType.NUMBER); | ||
this.offset = new Property(this, exports.PropertyType.NUMBER); | ||
this.composition = exports.RepeaterComposite.ABOVE; | ||
} | ||
fromJSON(json) { | ||
this.classNames = json.cl; | ||
this.id = json.ln; | ||
this.isHidden = json.hd; | ||
this.matchName = json.mn; | ||
this.name = json.nm; | ||
this.copies.fromJSON(json.c); | ||
this.composition = json.m; | ||
this.offset.fromJSON(json.o); | ||
this.anchor.fromJSON(json.tr.a); | ||
this.startOpacity.fromJSON(json.tr.so); | ||
this.endOpacity.fromJSON(json.tr.eo); | ||
this.position.fromJSON(json.tr.p); | ||
this.rotation.fromJSON(json.tr.r); | ||
this.scale.fromJSON(json.tr.s); | ||
if (json.tr.sk) { | ||
this.skew.fromJSON(json.tr.sk); | ||
} | ||
if (json.tr.sa) { | ||
this.skewAxis.fromJSON(json.tr.sa); | ||
} | ||
return this; | ||
} | ||
toJSON() { | ||
return { | ||
ty: this.type, | ||
cl: this.classNames, | ||
hd: this.isHidden, | ||
ln: this.id, | ||
mn: this.matchName, | ||
nm: this.name, | ||
m: this.composition, | ||
c: this.copies, | ||
o: this.offset, | ||
tr: { | ||
a: this.anchor, | ||
so: this.startOpacity, | ||
eo: this.endOpacity, | ||
p: this.position, | ||
r: this.rotation, | ||
s: this.scale, | ||
sk: this.skew, | ||
sa: this.skewAxis | ||
} | ||
}; | ||
} | ||
} | ||
class RoundedCornersShape extends Shape { | ||
constructor() { | ||
super(...arguments); | ||
this.type = exports.ShapeType.ROUNDED_CORNERS; | ||
this.roundness = new Property(this, exports.PropertyType.NUMBER); | ||
} | ||
fromJSON(json) { | ||
this.classNames = json.cl; | ||
this.id = json.ln; | ||
this.isHidden = json.hd; | ||
this.matchName = json.mn; | ||
this.name = json.nm; | ||
this.roundness.fromJSON(json.r); | ||
return this; | ||
} | ||
toJSON() { | ||
return { | ||
ty: this.type, | ||
cl: this.classNames, | ||
hd: this.isHidden, | ||
ln: this.id, | ||
mn: this.matchName, | ||
nm: this.name, | ||
r: this.roundness | ||
}; | ||
} | ||
} | ||
class ShapeLayer extends Layer { | ||
@@ -1148,2 +1410,8 @@ constructor() { | ||
} | ||
addShape(shape) { | ||
if (!(shape instanceof Shape)) | ||
shape = this.createShape(shape); | ||
this.shapes.push(shape); | ||
return shape; | ||
} | ||
createShapeFromJSON(json) { | ||
@@ -1162,3 +1430,3 @@ try { | ||
this.height = json.h; | ||
this.id = json.ld; | ||
this.id = json.ln; | ||
this.index = json.ind; | ||
@@ -1174,21 +1442,3 @@ this.inPoint = json.ip; | ||
this.classNames = "cl" in json ? json.cl.split(" ") : []; | ||
"o" in json.ks && this.opacity.fromJSON(json.ks.o); | ||
"p" in json.ks && this.position.fromJSON(json.ks.p); | ||
"a" in json.ks && this.anchor.fromJSON(json.ks.a); | ||
"s" in json.ks && this.scale.fromJSON(json.ks.s); | ||
if ("or" in json.ks) { | ||
this.orientation = new Property(this, exports.PropertyType.ORIENTATION).fromJSON(json.ks.or); | ||
} | ||
if ("rx" in json.ks) { | ||
this.rotationX = new Property(this, exports.PropertyType.ROTATION_X).fromJSON(json.ks.rx); | ||
} | ||
if ("ry" in json.ks) { | ||
this.rotationY = new Property(this, exports.PropertyType.ROTATION_Y).fromJSON(json.ks.ry); | ||
} | ||
if ("rz" in json.ks) { | ||
this.rotationZ = new Property(this, exports.PropertyType.ROTATION_Z).fromJSON(json.ks.rz); | ||
} | ||
if ("r" in json.ks) { | ||
this.rotation = new Property(this, exports.PropertyType.ROTATION).fromJSON(json.ks.r); | ||
} | ||
this.transform.fromJSON(json.ks); | ||
if ("tt" in json) { | ||
@@ -1206,4 +1456,2 @@ this.matteMode = json.tt; | ||
} | ||
this.skew = "sk" in json.ks ? new Property(this, exports.PropertyType.SKEW).fromJSON(json.ks.sk) : void 0; | ||
this.skewAxis = "sa" in json.ks ? new Property(this, exports.PropertyType.SKEW_AXIS).fromJSON(json.ks.sa) : void 0; | ||
this.shapes = json.shapes.map((jShape) => this.createShapeFromJSON(jShape)).filter(Boolean); | ||
@@ -1224,13 +1472,3 @@ return this; | ||
ks: { | ||
a: this.anchor, | ||
o: this.opacity, | ||
p: this.position, | ||
r: this.rotation, | ||
s: this.scale, | ||
sk: this.skew, | ||
sa: this.skewAxis, | ||
rx: this.rotationX, | ||
ry: this.rotationY, | ||
rz: this.rotationZ, | ||
or: this.orientation | ||
...this.transform.toJSON() | ||
}, | ||
@@ -1267,3 +1505,3 @@ shapes: this.shapes.map((shape) => shape.toJSON()), | ||
this.height = json.h; | ||
this.id = json.ld; | ||
this.id = json.ln; | ||
this.index = json.ind; | ||
@@ -1293,7 +1531,3 @@ this.inPoint = json.ip; | ||
} | ||
this.opacity.fromJSON(json.ks.o); | ||
this.position.fromJSON(json.ks.p); | ||
this.anchor.fromJSON(json.ks.a); | ||
this.scale.fromJSON(json.ks.s); | ||
this.rotation = new Property(this, exports.PropertyType.ROTATION).fromJSON(json.ks.r); | ||
this.transform.fromJSON(json.ks); | ||
this.solidColor = json.sc; | ||
@@ -1316,7 +1550,3 @@ this.solidHeight = json.sh; | ||
ks: { | ||
a: this.anchor, | ||
o: this.opacity, | ||
p: this.position, | ||
r: this.rotation, | ||
s: this.scale | ||
...this.transform.toJSON() | ||
}, | ||
@@ -1352,3 +1582,3 @@ ln: this.id, | ||
this.height = json.h; | ||
this.id = json.ld; | ||
this.id = json.ln; | ||
this.index = json.ind; | ||
@@ -1378,7 +1608,3 @@ this.inPoint = json.ip; | ||
} | ||
this.opacity.fromJSON(json.ks.o); | ||
this.position.fromJSON(json.ks.p); | ||
this.anchor.fromJSON(json.ks.a); | ||
this.scale.fromJSON(json.ks.s); | ||
this.rotation = new Property(this, exports.PropertyType.ROTATION).fromJSON(json.ks.r); | ||
this.transform.fromJSON(json.ks); | ||
this.textData = json.t; | ||
@@ -1400,7 +1626,3 @@ return this; | ||
ks: { | ||
a: this.anchor, | ||
o: this.opacity, | ||
p: this.position, | ||
r: this.rotation, | ||
s: this.scale | ||
...this.transform.toJSON() | ||
}, | ||
@@ -1469,3 +1691,3 @@ ln: this.id, | ||
this.keywords = []; | ||
this.generator = "@lottiefiles/lottie-js 0.2.4"; | ||
this.generator = "@lottiefiles/lottie-js 0.3.1"; | ||
this.parent = parent; | ||
@@ -1495,3 +1717,3 @@ } | ||
this.assets = []; | ||
this.frameRate = 0; | ||
this.frameRate = 60; | ||
this.height = 0; | ||
@@ -1531,12 +1753,6 @@ this.inPoint = 0; | ||
cp.values.forEach((v) => { | ||
const colorParts = v.value; | ||
colors.add(JSON.stringify([ | ||
Math.round(colorParts[0] * 255), | ||
Math.round(colorParts[1] * 255), | ||
Math.round(colorParts[2] * 255), | ||
colorParts[3] | ||
])); | ||
colors.add(JSON.stringify(v.value)); | ||
}); | ||
}); | ||
return Array.from(colors).map((c) => JSON.parse(c)); | ||
return Array.from(colors).map((c) => Color.fromJSON(JSON.parse(c))); | ||
} | ||
@@ -1746,210 +1962,7 @@ get colorsVerbose() { | ||
class GradientStrokeShape extends Shape { | ||
constructor() { | ||
super(...arguments); | ||
this.type = exports.ShapeType.GRADIENT_STROKE; | ||
this.blendMode = exports.BlendMode.NORMAL; | ||
this.endPoint = new Property(this, exports.PropertyType.POSITION); | ||
this.gradientColors = new Gradient(); | ||
this.gradientType = exports.GradientFillType.LINEAR; | ||
this.highlightAngle = new Property(this, exports.PropertyType.NUMBER); | ||
this.highlightLength = new Property(this, exports.PropertyType.NUMBER); | ||
this.opacity = new Property(this, exports.PropertyType.OPACITY); | ||
this.startPoint = new Property(this, exports.PropertyType.POSITION); | ||
this.lineCapType = exports.LineCapType.ROUND; | ||
this.lineJoinType = exports.LineJoinType.ROUND; | ||
this.width = new Property(this, exports.PropertyType.STROKE_WIDTH); | ||
} | ||
fromJSON(json) { | ||
this.classNames = json.cl; | ||
this.id = json.ln; | ||
this.isHidden = json.hd; | ||
this.matchName = json.mn; | ||
this.name = json.nm; | ||
this.blendMode = json.bm; | ||
this.opacity.fromJSON(json.o); | ||
this.endPoint.fromJSON(json.e); | ||
this.gradientColors.fromJSON(json.g); | ||
this.gradientType = json.t; | ||
this.startPoint.fromJSON(json.s); | ||
if (this.gradientType === exports.GradientFillType.LINEAR) { | ||
this.highlightAngle.fromJSON(json.a); | ||
this.highlightLength.fromJSON(json.h); | ||
} | ||
this.lineCapType = json.lc in exports.LineCapType ? json.lc : exports.LineCapType.ROUND; | ||
this.lineJoinType = json.lj in exports.LineJoinType ? json.lj : exports.LineJoinType.ROUND; | ||
this.miterLimit = json.ml; | ||
this.width.fromJSON(json.w); | ||
return this; | ||
} | ||
toJSON() { | ||
return { | ||
ty: this.type, | ||
cl: this.classNames, | ||
hd: this.isHidden, | ||
ln: this.id, | ||
mn: this.matchName, | ||
nm: this.name, | ||
bm: this.blendMode, | ||
o: this.opacity, | ||
e: this.endPoint, | ||
g: this.gradientColors, | ||
t: this.gradientType, | ||
a: this.highlightAngle, | ||
h: this.highlightLength, | ||
s: this.startPoint, | ||
lc: this.lineCapType, | ||
lj: this.lineJoinType, | ||
ml: this.miterLimit, | ||
w: this.width | ||
}; | ||
} | ||
} | ||
class RepeaterShape extends Shape { | ||
constructor() { | ||
super(...arguments); | ||
this.type = exports.ShapeType.REPEATER; | ||
this.anchor = new Property(this, exports.PropertyType.ANCHOR); | ||
this.startOpacity = new Property(this, exports.PropertyType.OPACITY); | ||
this.endOpacity = new Property(this, exports.PropertyType.OPACITY); | ||
this.position = new Property(this, exports.PropertyType.POSITION); | ||
this.rotation = new Property(this, exports.PropertyType.ROTATION); | ||
this.scale = new Property(this, exports.PropertyType.SCALE); | ||
this.shapes = []; | ||
this.skew = new Property(this, exports.PropertyType.SKEW); | ||
this.skewAxis = new Property(this, exports.PropertyType.SKEW_AXIS); | ||
this.copies = new Property(this, exports.PropertyType.NUMBER); | ||
this.offset = new Property(this, exports.PropertyType.NUMBER); | ||
this.composition = exports.RepeaterComposite.ABOVE; | ||
} | ||
fromJSON(json) { | ||
this.classNames = json.cl; | ||
this.id = json.ln; | ||
this.isHidden = json.hd; | ||
this.matchName = json.mn; | ||
this.name = json.nm; | ||
this.copies.fromJSON(json.c); | ||
this.composition = json.m; | ||
this.offset.fromJSON(json.o); | ||
this.anchor.fromJSON(json.tr.a); | ||
this.startOpacity.fromJSON(json.tr.so); | ||
this.endOpacity.fromJSON(json.tr.eo); | ||
this.position.fromJSON(json.tr.p); | ||
this.rotation.fromJSON(json.tr.r); | ||
this.scale.fromJSON(json.tr.s); | ||
if (json.tr.sk) { | ||
this.skew.fromJSON(json.tr.sk); | ||
} | ||
if (json.tr.sa) { | ||
this.skewAxis.fromJSON(json.tr.sa); | ||
} | ||
return this; | ||
} | ||
toJSON() { | ||
return { | ||
ty: this.type, | ||
cl: this.classNames, | ||
hd: this.isHidden, | ||
ln: this.id, | ||
mn: this.matchName, | ||
nm: this.name, | ||
m: this.composition, | ||
c: this.copies, | ||
o: this.offset, | ||
tr: { | ||
a: this.anchor, | ||
so: this.startOpacity, | ||
eo: this.endOpacity, | ||
p: this.position, | ||
r: this.rotation, | ||
s: this.scale, | ||
sk: this.skew, | ||
sa: this.skewAxis | ||
} | ||
}; | ||
} | ||
} | ||
class StarShape extends Shape { | ||
constructor() { | ||
super(...arguments); | ||
this.type = exports.ShapeType.STAR; | ||
this.position = new Property(this, exports.PropertyType.POSITION); | ||
this.innerRadius = new Property(this, exports.PropertyType.NUMBER); | ||
this.innerRoundness = new Property(this, exports.PropertyType.NUMBER); | ||
this.outerRadius = new Property(this, exports.PropertyType.NUMBER); | ||
this.outerRoundness = new Property(this, exports.PropertyType.NUMBER); | ||
this.rotation = new Property(this, exports.PropertyType.ROTATION); | ||
this.points = new Property(this, exports.PropertyType.NUMBER); | ||
this.starType = exports.StarType.STAR; | ||
} | ||
fromJSON(json) { | ||
this.classNames = json.cl; | ||
this.id = json.ln; | ||
this.isHidden = json.hd; | ||
this.matchName = json.mn; | ||
this.name = json.nm; | ||
this.position.fromJSON(json.p); | ||
this.innerRadius.fromJSON(json.ir); | ||
this.innerRoundness.fromJSON(json.is); | ||
this.outerRadius.fromJSON(json.or); | ||
this.outerRoundness.fromJSON(json.os); | ||
this.rotation.fromJSON(json.r); | ||
this.points.fromJSON(json.pt); | ||
this.starType = json.sy; | ||
this.direction = json.d; | ||
return this; | ||
} | ||
toJSON() { | ||
return { | ||
ty: this.type, | ||
cl: this.classNames, | ||
hd: this.isHidden, | ||
ln: this.id, | ||
mn: this.matchName, | ||
nm: this.name, | ||
p: this.position, | ||
ir: this.innerRadius, | ||
is: this.innerRoundness, | ||
or: this.outerRadius, | ||
os: this.outerRoundness, | ||
r: this.rotation, | ||
pt: this.points, | ||
sy: this.starType, | ||
d: this.direction | ||
}; | ||
} | ||
} | ||
class RoundedCornersShape extends Shape { | ||
constructor() { | ||
super(...arguments); | ||
this.type = exports.ShapeType.ROUNDED_CORNERS; | ||
this.roundness = new Property(this, exports.PropertyType.NUMBER); | ||
} | ||
fromJSON(json) { | ||
this.classNames = json.cl; | ||
this.id = json.ln; | ||
this.isHidden = json.hd; | ||
this.matchName = json.mn; | ||
this.name = json.nm; | ||
this.roundness.fromJSON(json.r); | ||
return this; | ||
} | ||
toJSON() { | ||
return { | ||
ty: this.type, | ||
cl: this.classNames, | ||
hd: this.isHidden, | ||
ln: this.id, | ||
mn: this.matchName, | ||
nm: this.name, | ||
r: this.roundness | ||
}; | ||
} | ||
} | ||
exports.Animation = Animation; | ||
exports.Asset = Asset; | ||
exports.Color = Color; | ||
exports.ColorRgb = ColorRgb; | ||
exports.ColorRgba = ColorRgba; | ||
exports.EllipseShape = EllipseShape; | ||
@@ -1983,2 +1996,3 @@ exports.FillShape = FillShape; | ||
exports.TextLayer = TextLayer; | ||
exports.Transform = Transform; | ||
exports.TrimShape = TrimShape; | ||
@@ -1985,0 +1999,0 @@ exports.hexToRgba = hexToRgba; |
@@ -165,5 +165,29 @@ declare abstract class Asset { | ||
interface Value { | ||
toJSON(): any; | ||
} | ||
declare abstract class Color implements Value { | ||
protected abstract toRgbArray(): number[]; | ||
toJSON(): number[]; | ||
static fromJSON(json: number[]): Color; | ||
} | ||
declare class ColorRgb extends Color { | ||
r: number; | ||
g: number; | ||
b: number; | ||
constructor(r: number, g: number, b: number); | ||
protected toRgbArray(): number[]; | ||
static fromJSON(json: number[]): ColorRgb; | ||
} | ||
declare class ColorRgba extends ColorRgb { | ||
a: number; | ||
constructor(r: number, g: number, b: number, a?: number); | ||
protected toRgbArray(): number[]; | ||
static fromJSON(json: number[]): ColorRgba; | ||
} | ||
declare class KeyFrame { | ||
frame: number; | ||
value: number | number[]; | ||
value: number | number[] | Value; | ||
frameInTangent?: [number, number]; | ||
@@ -174,4 +198,4 @@ frameOutTangent?: [number, number]; | ||
hold: boolean; | ||
constructor(frame?: number, value?: number | number[]); | ||
fromJSON(json: Record<string, any>): KeyFrame; | ||
constructor(frame?: number, value?: number | number[] | Value); | ||
fromJSON(json: Record<string, any>, valueClass?: any): KeyFrame; | ||
toJSON(): Record<string, any>; | ||
@@ -185,3 +209,3 @@ } | ||
isAnimated: boolean; | ||
index: number; | ||
index?: number; | ||
maxColors?: number; | ||
@@ -196,2 +220,18 @@ values: Array<KeyFrame>; | ||
declare class Transform { | ||
anchor: Property; | ||
opacity: Property; | ||
position: Property; | ||
rotation?: Property; | ||
scale: Property; | ||
skew?: Property; | ||
skewAxis?: Property; | ||
orientation?: Property; | ||
rotationX?: Property; | ||
rotationY?: Property; | ||
rotationZ?: Property; | ||
fromJSON(json: Record<string, any>): this; | ||
toJSON(): Record<string, any>; | ||
} | ||
declare abstract class Layer { | ||
@@ -219,11 +259,3 @@ abstract readonly type: LayerType; | ||
matchName?: string; | ||
opacity: Property; | ||
position: Property; | ||
anchor: Property; | ||
scale: Property; | ||
orientation?: Property; | ||
rotation?: Property; | ||
rotationX?: Property; | ||
rotationY?: Property; | ||
rotationZ?: Property; | ||
transform: Transform; | ||
parent?: any; | ||
@@ -335,3 +367,2 @@ constructor(parent: any); | ||
readonly type = ShapeType.GROUP; | ||
anchor: Property; | ||
blendMode: BlendMode; | ||
@@ -341,12 +372,8 @@ contentPropertyIndex?: number; | ||
numProperties: number; | ||
opacity: Property; | ||
position: Property; | ||
propertyIndex?: number; | ||
rotation: Property; | ||
scale: Property; | ||
transform: Transform; | ||
shapes: Shape[]; | ||
skew: Property; | ||
skewAxis: Property; | ||
fromJSON(json: Record<string, any>): GroupShape; | ||
createShape(type: ShapeType): Shape; | ||
addShape(shape: ShapeType | Shape): Shape; | ||
toJSON(): Record<string, any>; | ||
@@ -458,5 +485,4 @@ } | ||
shapes: Shape[]; | ||
skew?: Property; | ||
skewAxis?: Property; | ||
createShape(type: ShapeType): Shape; | ||
addShape(shape: ShapeType | Shape): Shape; | ||
createShapeFromJSON(json: Record<string, any>): Shape; | ||
@@ -527,3 +553,3 @@ fromJSON(json: Record<string, any>): ShapeLayer; | ||
static isLottie(json: Record<string, any>): boolean; | ||
get colors(): string[]; | ||
get colors(): Color[]; | ||
get colorsVerbose(): Record<string, any>; | ||
@@ -564,2 +590,2 @@ get textLayers(): Record<string, any>; | ||
export { Animation, Asset, AssetType, BlendMode, EllipseShape, FillRuleType, FillShape, Gradient, GradientFillShape, GradientFillType, GradientStop, GradientStrokeShape, GradientStrokeType, GroupLayer, GroupShape, ImageAsset, ImageLayer, KeyFrame, Layer, LayerType, LineCapType, LineJoinType, Marker, Mask, MaskMode, MatteMode, Meta, PathShape, PrecompositionAsset, PrecompositionLayer, Property, PropertyType, RectangleShape, RepeaterComposite, RepeaterShape, RoundedCornersShape, Shape, ShapeLayer, ShapeType, SolidLayer, StarShape, StarType, StrokeShape, TextLayer, TrimMode, TrimShape, hexToRgba, rgbaToHex, useRegistry }; | ||
export { Animation, Asset, AssetType, BlendMode, Color, ColorRgb, ColorRgba, EllipseShape, FillRuleType, FillShape, Gradient, GradientFillShape, GradientFillType, GradientStop, GradientStrokeShape, GradientStrokeType, GroupLayer, GroupShape, ImageAsset, ImageLayer, KeyFrame, Layer, LayerType, LineCapType, LineJoinType, Marker, Mask, MaskMode, MatteMode, Meta, PathShape, PrecompositionAsset, PrecompositionLayer, Property, PropertyType, RectangleShape, RepeaterComposite, RepeaterShape, RoundedCornersShape, Shape, ShapeLayer, ShapeType, SolidLayer, StarShape, StarType, StrokeShape, TextLayer, Transform, TrimMode, TrimShape, Value, hexToRgba, rgbaToHex, useRegistry }; |
/*! | ||
* @lottiefiles/lottie-js - v0.2.4 | ||
* Compiled Thu, 11 Nov 2021 11:12:29 UTC | ||
* @lottiefiles/lottie-js - v0.3.1 | ||
* Compiled Thu, 16 Dec 2021 04:57:44 UTC | ||
* | ||
@@ -223,2 +223,4 @@ * Copyright LottieFiles. All rights reserved. | ||
this.value = 0; | ||
this.frameInTangent = [0, 0]; | ||
this.frameOutTangent = [1, 1]; | ||
this.hold = false; | ||
@@ -228,5 +230,8 @@ this.frame = frame; | ||
} | ||
fromJSON(json) { | ||
fromJSON(json, valueClass = void 0) { | ||
this.frame = json.t; | ||
this.value = json.s; | ||
if (valueClass === void 0) | ||
this.value = json.s; | ||
else | ||
this.value = valueClass.fromJSON(json.s); | ||
const hasFrameTangents = "i" in json && "o" in json; | ||
@@ -275,2 +280,42 @@ const hasValueTangents = "ti" in json && "to" in json; | ||
class Color { | ||
toJSON() { | ||
return this.toRgbArray(); | ||
} | ||
static fromJSON(json) { | ||
if (json.length > 3) | ||
return ColorRgba.fromJSON(json); | ||
else if (json.length == 3) | ||
return ColorRgb.fromJSON(json); | ||
else | ||
return new ColorRgb(0, 0, 0); | ||
} | ||
} | ||
class ColorRgb extends Color { | ||
constructor(r, g, b) { | ||
super(); | ||
this.r = r; | ||
this.g = g; | ||
this.b = b; | ||
} | ||
toRgbArray() { | ||
return [this.r, this.g, this.b]; | ||
} | ||
static fromJSON(json) { | ||
return new ColorRgb(json[0], json[1], json[2]); | ||
} | ||
} | ||
class ColorRgba extends ColorRgb { | ||
constructor(r, g, b, a = 1) { | ||
super(r, g, b); | ||
this.a = a; | ||
} | ||
toRgbArray() { | ||
return [this.r, this.g, this.b, this.a]; | ||
} | ||
static fromJSON(json) { | ||
return new ColorRgba(json[0], json[1], json[2], json[3]); | ||
} | ||
} | ||
class Property { | ||
@@ -280,3 +325,2 @@ constructor(parent, type, values = []) { | ||
this.isAnimated = false; | ||
this.index = 0; | ||
this.values = []; | ||
@@ -296,3 +340,6 @@ this._parent = parent; | ||
this.isAnimated = json.a === 1; | ||
this.values = this.isAnimated ? json.k.map((v) => new KeyFrame().fromJSON(v)) : [new KeyFrame().fromJSON({t: 0, s: json.k})]; | ||
let valueClass = void 0; | ||
if (this.type == PropertyType.COLOR) | ||
valueClass = Color; | ||
this.values = this.isAnimated ? json.k.map((v) => new KeyFrame().fromJSON(v, valueClass)) : [new KeyFrame().fromJSON({t: 0, s: json.k}, valueClass)]; | ||
if (this.type === PropertyType.COLOR) { | ||
@@ -305,6 +352,7 @@ this.maxColors = "p" in json ? json.p : void 0; | ||
let value; | ||
if (this.isAnimated === false) { | ||
const animated = this.isAnimated !== false || this.values.length > 1; | ||
if (animated) { | ||
value = this.values; | ||
} else { | ||
value = this.values.length ? this.values[0].value : 0; | ||
} else { | ||
value = this.values; | ||
} | ||
@@ -314,3 +362,3 @@ return { | ||
ix: this.index, | ||
a: this.isAnimated ? 1 : 0, | ||
a: animated ? 1 : 0, | ||
k: value, | ||
@@ -322,103 +370,49 @@ p: this.maxColors | ||
class GradientStop { | ||
constructor(offset = 0, color = []) { | ||
this.offset = offset; | ||
this.color = color; | ||
} | ||
get hasAlpha() { | ||
return this.color.length > 3; | ||
} | ||
get red() { | ||
return this.color[0]; | ||
} | ||
get green() { | ||
return this.color[1]; | ||
} | ||
get blue() { | ||
return this.color[2]; | ||
} | ||
get alpha() { | ||
return this.color[3]; | ||
} | ||
} | ||
class GradientColorsProperty extends Property { | ||
class Transform { | ||
constructor() { | ||
super(...arguments); | ||
this.colorCount = 0; | ||
this.anchor = new Property(this, PropertyType.ANCHOR, [new KeyFrame(0, [0, 0])]); | ||
this.opacity = new Property(this, PropertyType.OPACITY, [new KeyFrame(0, 100)]); | ||
this.position = new Property(this, PropertyType.POSITION, [new KeyFrame(0, [0, 0])]); | ||
this.rotation = new Property(this, PropertyType.ROTATION, [new KeyFrame(0, 0)]); | ||
this.scale = new Property(this, PropertyType.SCALE, [new KeyFrame(0, [100, 100])]); | ||
this.skew = new Property(this, PropertyType.SKEW); | ||
this.skewAxis = new Property(this, PropertyType.SKEW_AXIS); | ||
} | ||
keyframeValue(index) { | ||
if (index >= this.values.length) | ||
return []; | ||
return this.values[index].value; | ||
} | ||
keyframeHasAlpha(index) { | ||
return this.keyframeValue(index).length == this.colorCount * 6; | ||
} | ||
keframeStops(index) { | ||
const values = this.keyframeValue(index); | ||
const stops = []; | ||
const hasAlpha = this.keyframeHasAlpha(index); | ||
for (let i = 0; i < this.colorCount; i++) { | ||
const color = values.slice(i, 3); | ||
if (hasAlpha) | ||
color.push(values[this.colorCount * 4 + i * 2]); | ||
stops.push(new GradientStop(values[i * 4], color)); | ||
fromJSON(json) { | ||
this.rotation = "r" in json ? new Property(this, PropertyType.ROTATION).fromJSON(json.r) : void 0; | ||
"o" in json && this.opacity.fromJSON(json.o); | ||
"p" in json && this.position.fromJSON(json.p); | ||
"a" in json && this.anchor.fromJSON(json.a); | ||
"s" in json && this.scale.fromJSON(json.s); | ||
this.skew = "sk" in json ? new Property(this, PropertyType.SKEW).fromJSON(json.sk) : void 0; | ||
this.skewAxis = "sa" in json ? new Property(this, PropertyType.SKEW_AXIS).fromJSON(json.sa) : void 0; | ||
if ("or" in json) { | ||
this.orientation = new Property(this, PropertyType.ORIENTATION).fromJSON(json.or); | ||
} | ||
return stops; | ||
} | ||
setKeyframeStops(index, stops) { | ||
if (index >= this.values.length) | ||
return; | ||
if (stops.length > this.colorCount) | ||
this.colorCount = stops.length; | ||
this.values[index].value = this.stopsToArray(stops); | ||
} | ||
addKeyframe(frame, stops) { | ||
const keyframe = new KeyFrame(frame, this.stopsToArray(stops)); | ||
if (stops.length > this.colorCount) | ||
this.colorCount = stops.length; | ||
this.values.push(keyframe); | ||
return keyframe; | ||
} | ||
stopsToArray(stops) { | ||
let hasAlpha = false; | ||
const result = []; | ||
for (const color of stops) { | ||
result.push(color.offset); | ||
result.push(color.red); | ||
result.push(color.green); | ||
result.push(color.blue); | ||
if (color.hasAlpha) | ||
hasAlpha = true; | ||
if ("rx" in json) { | ||
this.rotationX = new Property(this, PropertyType.ROTATION_X).fromJSON(json.rx); | ||
} | ||
if (hasAlpha) { | ||
for (const color of stops) { | ||
result.push(color.offset); | ||
result.push(color.alpha !== void 0 ? color.alpha : 1); | ||
} | ||
if ("ry" in json) { | ||
this.rotationY = new Property(this, PropertyType.ROTATION_Y).fromJSON(json.ry); | ||
} | ||
return result; | ||
if ("rz" in json) { | ||
this.rotationZ = new Property(this, PropertyType.ROTATION_Z).fromJSON(json.rz); | ||
} | ||
return this; | ||
} | ||
} | ||
class Gradient { | ||
constructor() { | ||
this.gradientColors = new GradientColorsProperty(this, PropertyType.COLOR); | ||
} | ||
get colorCount() { | ||
return this.gradientColors.colorCount; | ||
} | ||
set colorCount(count) { | ||
this.gradientColors.colorCount = count; | ||
} | ||
toJSON() { | ||
return { | ||
p: this.colorCount, | ||
k: this.gradientColors | ||
a: this.anchor, | ||
o: this.opacity, | ||
p: this.position, | ||
r: this.rotation, | ||
s: this.scale, | ||
sk: this.skew, | ||
sa: this.skewAxis, | ||
rx: this.rotationX, | ||
ry: this.rotationY, | ||
rz: this.rotationZ, | ||
or: this.orientation | ||
}; | ||
} | ||
fromJSON(json) { | ||
this.gradientColors.fromJSON(json.k); | ||
this.colorCount = json.p; | ||
return this; | ||
} | ||
} | ||
@@ -440,6 +434,3 @@ | ||
this.width = 0; | ||
this.opacity = new Property(this, PropertyType.OPACITY); | ||
this.position = new Property(this, PropertyType.POSITION); | ||
this.anchor = new Property(this, PropertyType.ANCHOR); | ||
this.scale = new Property(this, PropertyType.SCALE); | ||
this.transform = new Transform(); | ||
this.parent = parent; | ||
@@ -472,3 +463,3 @@ } | ||
this.height = json.h; | ||
this.id = json.ld; | ||
this.id = json.ln; | ||
this.index = json.ind; | ||
@@ -498,7 +489,3 @@ this.inPoint = json.ip; | ||
} | ||
this.opacity.fromJSON(json.ks.o); | ||
this.position.fromJSON(json.ks.p); | ||
this.anchor.fromJSON(json.ks.a); | ||
this.scale.fromJSON(json.ks.s); | ||
this.rotation = new Property(this, PropertyType.ROTATION).fromJSON(json.ks.r); | ||
this.transform.fromJSON(json.ks); | ||
return this; | ||
@@ -518,7 +505,3 @@ } | ||
ks: { | ||
a: this.anchor, | ||
o: this.opacity, | ||
p: this.position, | ||
r: this.rotation, | ||
s: this.scale | ||
...this.transform.toJSON() | ||
}, | ||
@@ -551,3 +534,3 @@ ln: this.id, | ||
this.height = json.h; | ||
this.id = json.ld; | ||
this.id = json.ln; | ||
this.index = json.ind; | ||
@@ -577,7 +560,3 @@ this.inPoint = json.ip; | ||
} | ||
this.opacity.fromJSON(json.ks.o); | ||
this.position.fromJSON(json.ks.p); | ||
this.anchor.fromJSON(json.ks.a); | ||
this.scale.fromJSON(json.ks.s); | ||
this.rotation = new Property(this, PropertyType.ROTATION).fromJSON(json.ks.r); | ||
this.transform.fromJSON(json.ks); | ||
this.refId = json.refId; | ||
@@ -599,7 +578,3 @@ return this; | ||
ks: { | ||
a: this.anchor, | ||
o: this.opacity, | ||
p: this.position, | ||
r: this.rotation, | ||
s: this.scale | ||
...this.transform.toJSON() | ||
}, | ||
@@ -632,3 +607,3 @@ ln: this.id, | ||
this.height = json.h; | ||
this.id = json.ld; | ||
this.id = json.ln; | ||
this.index = json.ind; | ||
@@ -658,7 +633,3 @@ this.inPoint = json.ip; | ||
} | ||
this.opacity.fromJSON(json.ks.o); | ||
this.position.fromJSON(json.ks.p); | ||
this.anchor.fromJSON(json.ks.a); | ||
this.scale.fromJSON(json.ks.s); | ||
this.rotation = new Property(this, PropertyType.ROTATION).fromJSON(json.ks.r); | ||
this.transform.fromJSON(json.ks); | ||
this.refId = json.refId; | ||
@@ -679,7 +650,3 @@ return this; | ||
ks: { | ||
a: this.anchor, | ||
o: this.opacity, | ||
p: this.position, | ||
r: this.rotation, | ||
s: this.scale | ||
...this.transform.toJSON() | ||
}, | ||
@@ -703,2 +670,105 @@ ln: this.id, | ||
class GradientStop { | ||
constructor(offset = 0, color = []) { | ||
this.offset = offset; | ||
this.color = color; | ||
} | ||
get hasAlpha() { | ||
return this.color.length > 3; | ||
} | ||
get red() { | ||
return this.color[0]; | ||
} | ||
get green() { | ||
return this.color[1]; | ||
} | ||
get blue() { | ||
return this.color[2]; | ||
} | ||
get alpha() { | ||
return this.color[3]; | ||
} | ||
} | ||
class GradientColorsProperty extends Property { | ||
constructor() { | ||
super(...arguments); | ||
this.colorCount = 0; | ||
} | ||
keyframeValue(index) { | ||
if (index >= this.values.length) | ||
return []; | ||
return this.values[index].value; | ||
} | ||
keyframeHasAlpha(index) { | ||
return this.keyframeValue(index).length == this.colorCount * 6; | ||
} | ||
keframeStops(index) { | ||
const values = this.keyframeValue(index); | ||
const stops = []; | ||
const hasAlpha = this.keyframeHasAlpha(index); | ||
for (let i = 0; i < this.colorCount; i++) { | ||
const color = values.slice(i, 3); | ||
if (hasAlpha) | ||
color.push(values[this.colorCount * 4 + i * 2]); | ||
stops.push(new GradientStop(values[i * 4], color)); | ||
} | ||
return stops; | ||
} | ||
setKeyframeStops(index, stops) { | ||
if (index >= this.values.length) | ||
return; | ||
if (stops.length > this.colorCount) | ||
this.colorCount = stops.length; | ||
this.values[index].value = this.stopsToArray(stops); | ||
} | ||
addKeyframe(frame, stops) { | ||
const keyframe = new KeyFrame(frame, this.stopsToArray(stops)); | ||
if (stops.length > this.colorCount) | ||
this.colorCount = stops.length; | ||
this.values.push(keyframe); | ||
return keyframe; | ||
} | ||
stopsToArray(stops) { | ||
let hasAlpha = false; | ||
const result = []; | ||
for (const color of stops) { | ||
result.push(color.offset); | ||
result.push(color.red); | ||
result.push(color.green); | ||
result.push(color.blue); | ||
if (color.hasAlpha) | ||
hasAlpha = true; | ||
} | ||
if (hasAlpha) { | ||
for (const color of stops) { | ||
result.push(color.offset); | ||
result.push(color.alpha !== void 0 ? color.alpha : 1); | ||
} | ||
} | ||
return result; | ||
} | ||
} | ||
class Gradient { | ||
constructor() { | ||
this.gradientColors = new GradientColorsProperty(this, PropertyType.COLOR); | ||
} | ||
get colorCount() { | ||
return this.gradientColors.colorCount; | ||
} | ||
set colorCount(count) { | ||
this.gradientColors.colorCount = count; | ||
} | ||
toJSON() { | ||
return { | ||
p: this.colorCount, | ||
k: this.gradientColors | ||
}; | ||
} | ||
fromJSON(json) { | ||
this.gradientColors.fromJSON(json.k); | ||
this.colorCount = json.p; | ||
return this; | ||
} | ||
} | ||
class Shape { | ||
@@ -752,3 +822,3 @@ constructor(parent) { | ||
this.fillRule = FillRuleType.EVEN_ODD; | ||
this.opacity = new Property(this, PropertyType.OPACITY); | ||
this.opacity = new Property(this, PropertyType.OPACITY, [new KeyFrame(0, 100)]); | ||
} | ||
@@ -935,2 +1005,53 @@ fromJSON(json) { | ||
class StarShape extends Shape { | ||
constructor() { | ||
super(...arguments); | ||
this.type = ShapeType.STAR; | ||
this.position = new Property(this, PropertyType.POSITION); | ||
this.innerRadius = new Property(this, PropertyType.NUMBER); | ||
this.innerRoundness = new Property(this, PropertyType.NUMBER); | ||
this.outerRadius = new Property(this, PropertyType.NUMBER); | ||
this.outerRoundness = new Property(this, PropertyType.NUMBER); | ||
this.rotation = new Property(this, PropertyType.ROTATION); | ||
this.points = new Property(this, PropertyType.NUMBER); | ||
this.starType = StarType.STAR; | ||
} | ||
fromJSON(json) { | ||
this.classNames = json.cl; | ||
this.id = json.ln; | ||
this.isHidden = json.hd; | ||
this.matchName = json.mn; | ||
this.name = json.nm; | ||
this.position.fromJSON(json.p); | ||
this.innerRadius.fromJSON(json.ir); | ||
this.innerRoundness.fromJSON(json.is); | ||
this.outerRadius.fromJSON(json.or); | ||
this.outerRoundness.fromJSON(json.os); | ||
this.rotation.fromJSON(json.r); | ||
this.points.fromJSON(json.pt); | ||
this.starType = json.sy; | ||
this.direction = json.d; | ||
return this; | ||
} | ||
toJSON() { | ||
return { | ||
ty: this.type, | ||
cl: this.classNames, | ||
hd: this.isHidden, | ||
ln: this.id, | ||
mn: this.matchName, | ||
nm: this.name, | ||
p: this.position, | ||
ir: this.innerRadius, | ||
is: this.innerRoundness, | ||
or: this.outerRadius, | ||
os: this.outerRoundness, | ||
r: this.rotation, | ||
pt: this.points, | ||
sy: this.starType, | ||
d: this.direction | ||
}; | ||
} | ||
} | ||
class StrokeShape extends Shape { | ||
@@ -944,3 +1065,3 @@ constructor() { | ||
this.lineJoinType = LineJoinType.ROUND; | ||
this.opacity = new Property(this, PropertyType.OPACITY); | ||
this.opacity = new Property(this, PropertyType.OPACITY, [new KeyFrame(0, 100)]); | ||
this.width = new Property(this, PropertyType.STROKE_WIDTH); | ||
@@ -1026,13 +1147,7 @@ } | ||
this.type = ShapeType.GROUP; | ||
this.anchor = new Property(this, PropertyType.ANCHOR); | ||
this.blendMode = BlendMode.NORMAL; | ||
this.isHidden = false; | ||
this.numProperties = 0; | ||
this.opacity = new Property(this, PropertyType.OPACITY); | ||
this.position = new Property(this, PropertyType.POSITION); | ||
this.rotation = new Property(this, PropertyType.ROTATION); | ||
this.scale = new Property(this, PropertyType.SCALE); | ||
this.transform = new Transform(); | ||
this.shapes = []; | ||
this.skew = new Property(this, PropertyType.SKEW); | ||
this.skewAxis = new Property(this, PropertyType.SKEW_AXIS); | ||
} | ||
@@ -1055,13 +1170,3 @@ fromJSON(json) { | ||
} | ||
this.anchor.fromJSON(jShape.a); | ||
this.opacity.fromJSON(jShape.o); | ||
this.position.fromJSON(jShape.p); | ||
this.rotation.fromJSON(jShape.r); | ||
this.scale.fromJSON(jShape.s); | ||
if (jShape.sk) { | ||
this.skew.fromJSON(jShape.sk); | ||
} | ||
if (jShape.sa) { | ||
this.skewAxis.fromJSON(jShape.sa); | ||
} | ||
this.transform.fromJSON(jShape); | ||
} catch (e) { | ||
@@ -1092,5 +1197,13 @@ } | ||
return new MergeShape(this); | ||
} else if (type === ShapeType.STAR) { | ||
return new StarShape(this); | ||
} | ||
throw new Error(`Invalid or unknown shape type: ${type}`); | ||
} | ||
addShape(shape2) { | ||
if (!(shape2 instanceof Shape)) | ||
shape2 = this.createShape(shape2); | ||
this.shapes.push(shape2); | ||
return shape2; | ||
} | ||
toJSON() { | ||
@@ -1101,9 +1214,3 @@ const shapes = JSON.parse(JSON.stringify(this.shapes)); | ||
nm: "Transform", | ||
a: this.anchor, | ||
o: this.opacity, | ||
p: this.position, | ||
r: this.rotation, | ||
s: this.scale, | ||
sk: this.skew, | ||
sa: this.skewAxis | ||
...this.transform.toJSON() | ||
}); | ||
@@ -1126,2 +1233,157 @@ return { | ||
class GradientStrokeShape extends Shape { | ||
constructor() { | ||
super(...arguments); | ||
this.type = ShapeType.GRADIENT_STROKE; | ||
this.blendMode = BlendMode.NORMAL; | ||
this.endPoint = new Property(this, PropertyType.POSITION); | ||
this.gradientColors = new Gradient(); | ||
this.gradientType = GradientFillType.LINEAR; | ||
this.highlightAngle = new Property(this, PropertyType.NUMBER); | ||
this.highlightLength = new Property(this, PropertyType.NUMBER); | ||
this.opacity = new Property(this, PropertyType.OPACITY); | ||
this.startPoint = new Property(this, PropertyType.POSITION); | ||
this.lineCapType = LineCapType.ROUND; | ||
this.lineJoinType = LineJoinType.ROUND; | ||
this.width = new Property(this, PropertyType.STROKE_WIDTH); | ||
} | ||
fromJSON(json) { | ||
this.classNames = json.cl; | ||
this.id = json.ln; | ||
this.isHidden = json.hd; | ||
this.matchName = json.mn; | ||
this.name = json.nm; | ||
this.blendMode = json.bm; | ||
this.opacity.fromJSON(json.o); | ||
this.endPoint.fromJSON(json.e); | ||
this.gradientColors.fromJSON(json.g); | ||
this.gradientType = json.t; | ||
this.startPoint.fromJSON(json.s); | ||
if (this.gradientType === GradientFillType.LINEAR) { | ||
this.highlightAngle.fromJSON(json.a); | ||
this.highlightLength.fromJSON(json.h); | ||
} | ||
this.lineCapType = json.lc in LineCapType ? json.lc : LineCapType.ROUND; | ||
this.lineJoinType = json.lj in LineJoinType ? json.lj : LineJoinType.ROUND; | ||
this.miterLimit = json.ml; | ||
this.width.fromJSON(json.w); | ||
return this; | ||
} | ||
toJSON() { | ||
return { | ||
ty: this.type, | ||
cl: this.classNames, | ||
hd: this.isHidden, | ||
ln: this.id, | ||
mn: this.matchName, | ||
nm: this.name, | ||
bm: this.blendMode, | ||
o: this.opacity, | ||
e: this.endPoint, | ||
g: this.gradientColors, | ||
t: this.gradientType, | ||
a: this.highlightAngle, | ||
h: this.highlightLength, | ||
s: this.startPoint, | ||
lc: this.lineCapType, | ||
lj: this.lineJoinType, | ||
ml: this.miterLimit, | ||
w: this.width | ||
}; | ||
} | ||
} | ||
class RepeaterShape extends Shape { | ||
constructor() { | ||
super(...arguments); | ||
this.type = ShapeType.REPEATER; | ||
this.anchor = new Property(this, PropertyType.ANCHOR); | ||
this.startOpacity = new Property(this, PropertyType.OPACITY); | ||
this.endOpacity = new Property(this, PropertyType.OPACITY); | ||
this.position = new Property(this, PropertyType.POSITION); | ||
this.rotation = new Property(this, PropertyType.ROTATION); | ||
this.scale = new Property(this, PropertyType.SCALE); | ||
this.shapes = []; | ||
this.skew = new Property(this, PropertyType.SKEW); | ||
this.skewAxis = new Property(this, PropertyType.SKEW_AXIS); | ||
this.copies = new Property(this, PropertyType.NUMBER); | ||
this.offset = new Property(this, PropertyType.NUMBER); | ||
this.composition = RepeaterComposite.ABOVE; | ||
} | ||
fromJSON(json) { | ||
this.classNames = json.cl; | ||
this.id = json.ln; | ||
this.isHidden = json.hd; | ||
this.matchName = json.mn; | ||
this.name = json.nm; | ||
this.copies.fromJSON(json.c); | ||
this.composition = json.m; | ||
this.offset.fromJSON(json.o); | ||
this.anchor.fromJSON(json.tr.a); | ||
this.startOpacity.fromJSON(json.tr.so); | ||
this.endOpacity.fromJSON(json.tr.eo); | ||
this.position.fromJSON(json.tr.p); | ||
this.rotation.fromJSON(json.tr.r); | ||
this.scale.fromJSON(json.tr.s); | ||
if (json.tr.sk) { | ||
this.skew.fromJSON(json.tr.sk); | ||
} | ||
if (json.tr.sa) { | ||
this.skewAxis.fromJSON(json.tr.sa); | ||
} | ||
return this; | ||
} | ||
toJSON() { | ||
return { | ||
ty: this.type, | ||
cl: this.classNames, | ||
hd: this.isHidden, | ||
ln: this.id, | ||
mn: this.matchName, | ||
nm: this.name, | ||
m: this.composition, | ||
c: this.copies, | ||
o: this.offset, | ||
tr: { | ||
a: this.anchor, | ||
so: this.startOpacity, | ||
eo: this.endOpacity, | ||
p: this.position, | ||
r: this.rotation, | ||
s: this.scale, | ||
sk: this.skew, | ||
sa: this.skewAxis | ||
} | ||
}; | ||
} | ||
} | ||
class RoundedCornersShape extends Shape { | ||
constructor() { | ||
super(...arguments); | ||
this.type = ShapeType.ROUNDED_CORNERS; | ||
this.roundness = new Property(this, PropertyType.NUMBER); | ||
} | ||
fromJSON(json) { | ||
this.classNames = json.cl; | ||
this.id = json.ln; | ||
this.isHidden = json.hd; | ||
this.matchName = json.mn; | ||
this.name = json.nm; | ||
this.roundness.fromJSON(json.r); | ||
return this; | ||
} | ||
toJSON() { | ||
return { | ||
ty: this.type, | ||
cl: this.classNames, | ||
hd: this.isHidden, | ||
ln: this.id, | ||
mn: this.matchName, | ||
nm: this.name, | ||
r: this.roundness | ||
}; | ||
} | ||
} | ||
class ShapeLayer extends Layer { | ||
@@ -1155,2 +1417,8 @@ constructor() { | ||
} | ||
addShape(shape) { | ||
if (!(shape instanceof Shape)) | ||
shape = this.createShape(shape); | ||
this.shapes.push(shape); | ||
return shape; | ||
} | ||
createShapeFromJSON(json) { | ||
@@ -1169,3 +1437,3 @@ try { | ||
this.height = json.h; | ||
this.id = json.ld; | ||
this.id = json.ln; | ||
this.index = json.ind; | ||
@@ -1181,21 +1449,3 @@ this.inPoint = json.ip; | ||
this.classNames = "cl" in json ? json.cl.split(" ") : []; | ||
"o" in json.ks && this.opacity.fromJSON(json.ks.o); | ||
"p" in json.ks && this.position.fromJSON(json.ks.p); | ||
"a" in json.ks && this.anchor.fromJSON(json.ks.a); | ||
"s" in json.ks && this.scale.fromJSON(json.ks.s); | ||
if ("or" in json.ks) { | ||
this.orientation = new Property(this, PropertyType.ORIENTATION).fromJSON(json.ks.or); | ||
} | ||
if ("rx" in json.ks) { | ||
this.rotationX = new Property(this, PropertyType.ROTATION_X).fromJSON(json.ks.rx); | ||
} | ||
if ("ry" in json.ks) { | ||
this.rotationY = new Property(this, PropertyType.ROTATION_Y).fromJSON(json.ks.ry); | ||
} | ||
if ("rz" in json.ks) { | ||
this.rotationZ = new Property(this, PropertyType.ROTATION_Z).fromJSON(json.ks.rz); | ||
} | ||
if ("r" in json.ks) { | ||
this.rotation = new Property(this, PropertyType.ROTATION).fromJSON(json.ks.r); | ||
} | ||
this.transform.fromJSON(json.ks); | ||
if ("tt" in json) { | ||
@@ -1213,4 +1463,2 @@ this.matteMode = json.tt; | ||
} | ||
this.skew = "sk" in json.ks ? new Property(this, PropertyType.SKEW).fromJSON(json.ks.sk) : void 0; | ||
this.skewAxis = "sa" in json.ks ? new Property(this, PropertyType.SKEW_AXIS).fromJSON(json.ks.sa) : void 0; | ||
this.shapes = json.shapes.map((jShape) => this.createShapeFromJSON(jShape)).filter(Boolean); | ||
@@ -1231,13 +1479,3 @@ return this; | ||
ks: { | ||
a: this.anchor, | ||
o: this.opacity, | ||
p: this.position, | ||
r: this.rotation, | ||
s: this.scale, | ||
sk: this.skew, | ||
sa: this.skewAxis, | ||
rx: this.rotationX, | ||
ry: this.rotationY, | ||
rz: this.rotationZ, | ||
or: this.orientation | ||
...this.transform.toJSON() | ||
}, | ||
@@ -1274,3 +1512,3 @@ shapes: this.shapes.map((shape) => shape.toJSON()), | ||
this.height = json.h; | ||
this.id = json.ld; | ||
this.id = json.ln; | ||
this.index = json.ind; | ||
@@ -1300,7 +1538,3 @@ this.inPoint = json.ip; | ||
} | ||
this.opacity.fromJSON(json.ks.o); | ||
this.position.fromJSON(json.ks.p); | ||
this.anchor.fromJSON(json.ks.a); | ||
this.scale.fromJSON(json.ks.s); | ||
this.rotation = new Property(this, PropertyType.ROTATION).fromJSON(json.ks.r); | ||
this.transform.fromJSON(json.ks); | ||
this.solidColor = json.sc; | ||
@@ -1323,7 +1557,3 @@ this.solidHeight = json.sh; | ||
ks: { | ||
a: this.anchor, | ||
o: this.opacity, | ||
p: this.position, | ||
r: this.rotation, | ||
s: this.scale | ||
...this.transform.toJSON() | ||
}, | ||
@@ -1359,3 +1589,3 @@ ln: this.id, | ||
this.height = json.h; | ||
this.id = json.ld; | ||
this.id = json.ln; | ||
this.index = json.ind; | ||
@@ -1385,7 +1615,3 @@ this.inPoint = json.ip; | ||
} | ||
this.opacity.fromJSON(json.ks.o); | ||
this.position.fromJSON(json.ks.p); | ||
this.anchor.fromJSON(json.ks.a); | ||
this.scale.fromJSON(json.ks.s); | ||
this.rotation = new Property(this, PropertyType.ROTATION).fromJSON(json.ks.r); | ||
this.transform.fromJSON(json.ks); | ||
this.textData = json.t; | ||
@@ -1407,7 +1633,3 @@ return this; | ||
ks: { | ||
a: this.anchor, | ||
o: this.opacity, | ||
p: this.position, | ||
r: this.rotation, | ||
s: this.scale | ||
...this.transform.toJSON() | ||
}, | ||
@@ -1476,3 +1698,3 @@ ln: this.id, | ||
this.keywords = []; | ||
this.generator = "@lottiefiles/lottie-js 0.2.4"; | ||
this.generator = "@lottiefiles/lottie-js 0.3.1"; | ||
this.parent = parent; | ||
@@ -1502,3 +1724,3 @@ } | ||
this.assets = []; | ||
this.frameRate = 0; | ||
this.frameRate = 60; | ||
this.height = 0; | ||
@@ -1538,12 +1760,6 @@ this.inPoint = 0; | ||
cp.values.forEach((v) => { | ||
const colorParts = v.value; | ||
colors.add(JSON.stringify([ | ||
Math.round(colorParts[0] * 255), | ||
Math.round(colorParts[1] * 255), | ||
Math.round(colorParts[2] * 255), | ||
colorParts[3] | ||
])); | ||
colors.add(JSON.stringify(v.value)); | ||
}); | ||
}); | ||
return Array.from(colors).map((c) => JSON.parse(c)); | ||
return Array.from(colors).map((c) => Color.fromJSON(JSON.parse(c))); | ||
} | ||
@@ -1753,209 +1969,3 @@ get colorsVerbose() { | ||
class GradientStrokeShape extends Shape { | ||
constructor() { | ||
super(...arguments); | ||
this.type = ShapeType.GRADIENT_STROKE; | ||
this.blendMode = BlendMode.NORMAL; | ||
this.endPoint = new Property(this, PropertyType.POSITION); | ||
this.gradientColors = new Gradient(); | ||
this.gradientType = GradientFillType.LINEAR; | ||
this.highlightAngle = new Property(this, PropertyType.NUMBER); | ||
this.highlightLength = new Property(this, PropertyType.NUMBER); | ||
this.opacity = new Property(this, PropertyType.OPACITY); | ||
this.startPoint = new Property(this, PropertyType.POSITION); | ||
this.lineCapType = LineCapType.ROUND; | ||
this.lineJoinType = LineJoinType.ROUND; | ||
this.width = new Property(this, PropertyType.STROKE_WIDTH); | ||
} | ||
fromJSON(json) { | ||
this.classNames = json.cl; | ||
this.id = json.ln; | ||
this.isHidden = json.hd; | ||
this.matchName = json.mn; | ||
this.name = json.nm; | ||
this.blendMode = json.bm; | ||
this.opacity.fromJSON(json.o); | ||
this.endPoint.fromJSON(json.e); | ||
this.gradientColors.fromJSON(json.g); | ||
this.gradientType = json.t; | ||
this.startPoint.fromJSON(json.s); | ||
if (this.gradientType === GradientFillType.LINEAR) { | ||
this.highlightAngle.fromJSON(json.a); | ||
this.highlightLength.fromJSON(json.h); | ||
} | ||
this.lineCapType = json.lc in LineCapType ? json.lc : LineCapType.ROUND; | ||
this.lineJoinType = json.lj in LineJoinType ? json.lj : LineJoinType.ROUND; | ||
this.miterLimit = json.ml; | ||
this.width.fromJSON(json.w); | ||
return this; | ||
} | ||
toJSON() { | ||
return { | ||
ty: this.type, | ||
cl: this.classNames, | ||
hd: this.isHidden, | ||
ln: this.id, | ||
mn: this.matchName, | ||
nm: this.name, | ||
bm: this.blendMode, | ||
o: this.opacity, | ||
e: this.endPoint, | ||
g: this.gradientColors, | ||
t: this.gradientType, | ||
a: this.highlightAngle, | ||
h: this.highlightLength, | ||
s: this.startPoint, | ||
lc: this.lineCapType, | ||
lj: this.lineJoinType, | ||
ml: this.miterLimit, | ||
w: this.width | ||
}; | ||
} | ||
} | ||
class RepeaterShape extends Shape { | ||
constructor() { | ||
super(...arguments); | ||
this.type = ShapeType.REPEATER; | ||
this.anchor = new Property(this, PropertyType.ANCHOR); | ||
this.startOpacity = new Property(this, PropertyType.OPACITY); | ||
this.endOpacity = new Property(this, PropertyType.OPACITY); | ||
this.position = new Property(this, PropertyType.POSITION); | ||
this.rotation = new Property(this, PropertyType.ROTATION); | ||
this.scale = new Property(this, PropertyType.SCALE); | ||
this.shapes = []; | ||
this.skew = new Property(this, PropertyType.SKEW); | ||
this.skewAxis = new Property(this, PropertyType.SKEW_AXIS); | ||
this.copies = new Property(this, PropertyType.NUMBER); | ||
this.offset = new Property(this, PropertyType.NUMBER); | ||
this.composition = RepeaterComposite.ABOVE; | ||
} | ||
fromJSON(json) { | ||
this.classNames = json.cl; | ||
this.id = json.ln; | ||
this.isHidden = json.hd; | ||
this.matchName = json.mn; | ||
this.name = json.nm; | ||
this.copies.fromJSON(json.c); | ||
this.composition = json.m; | ||
this.offset.fromJSON(json.o); | ||
this.anchor.fromJSON(json.tr.a); | ||
this.startOpacity.fromJSON(json.tr.so); | ||
this.endOpacity.fromJSON(json.tr.eo); | ||
this.position.fromJSON(json.tr.p); | ||
this.rotation.fromJSON(json.tr.r); | ||
this.scale.fromJSON(json.tr.s); | ||
if (json.tr.sk) { | ||
this.skew.fromJSON(json.tr.sk); | ||
} | ||
if (json.tr.sa) { | ||
this.skewAxis.fromJSON(json.tr.sa); | ||
} | ||
return this; | ||
} | ||
toJSON() { | ||
return { | ||
ty: this.type, | ||
cl: this.classNames, | ||
hd: this.isHidden, | ||
ln: this.id, | ||
mn: this.matchName, | ||
nm: this.name, | ||
m: this.composition, | ||
c: this.copies, | ||
o: this.offset, | ||
tr: { | ||
a: this.anchor, | ||
so: this.startOpacity, | ||
eo: this.endOpacity, | ||
p: this.position, | ||
r: this.rotation, | ||
s: this.scale, | ||
sk: this.skew, | ||
sa: this.skewAxis | ||
} | ||
}; | ||
} | ||
} | ||
class StarShape extends Shape { | ||
constructor() { | ||
super(...arguments); | ||
this.type = ShapeType.STAR; | ||
this.position = new Property(this, PropertyType.POSITION); | ||
this.innerRadius = new Property(this, PropertyType.NUMBER); | ||
this.innerRoundness = new Property(this, PropertyType.NUMBER); | ||
this.outerRadius = new Property(this, PropertyType.NUMBER); | ||
this.outerRoundness = new Property(this, PropertyType.NUMBER); | ||
this.rotation = new Property(this, PropertyType.ROTATION); | ||
this.points = new Property(this, PropertyType.NUMBER); | ||
this.starType = StarType.STAR; | ||
} | ||
fromJSON(json) { | ||
this.classNames = json.cl; | ||
this.id = json.ln; | ||
this.isHidden = json.hd; | ||
this.matchName = json.mn; | ||
this.name = json.nm; | ||
this.position.fromJSON(json.p); | ||
this.innerRadius.fromJSON(json.ir); | ||
this.innerRoundness.fromJSON(json.is); | ||
this.outerRadius.fromJSON(json.or); | ||
this.outerRoundness.fromJSON(json.os); | ||
this.rotation.fromJSON(json.r); | ||
this.points.fromJSON(json.pt); | ||
this.starType = json.sy; | ||
this.direction = json.d; | ||
return this; | ||
} | ||
toJSON() { | ||
return { | ||
ty: this.type, | ||
cl: this.classNames, | ||
hd: this.isHidden, | ||
ln: this.id, | ||
mn: this.matchName, | ||
nm: this.name, | ||
p: this.position, | ||
ir: this.innerRadius, | ||
is: this.innerRoundness, | ||
or: this.outerRadius, | ||
os: this.outerRoundness, | ||
r: this.rotation, | ||
pt: this.points, | ||
sy: this.starType, | ||
d: this.direction | ||
}; | ||
} | ||
} | ||
class RoundedCornersShape extends Shape { | ||
constructor() { | ||
super(...arguments); | ||
this.type = ShapeType.ROUNDED_CORNERS; | ||
this.roundness = new Property(this, PropertyType.NUMBER); | ||
} | ||
fromJSON(json) { | ||
this.classNames = json.cl; | ||
this.id = json.ln; | ||
this.isHidden = json.hd; | ||
this.matchName = json.mn; | ||
this.name = json.nm; | ||
this.roundness.fromJSON(json.r); | ||
return this; | ||
} | ||
toJSON() { | ||
return { | ||
ty: this.type, | ||
cl: this.classNames, | ||
hd: this.isHidden, | ||
ln: this.id, | ||
mn: this.matchName, | ||
nm: this.name, | ||
r: this.roundness | ||
}; | ||
} | ||
} | ||
export { Animation, Asset, AssetType, BlendMode, EllipseShape, FillRuleType, FillShape, Gradient, GradientFillShape, GradientFillType, GradientStop, GradientStrokeShape, GradientStrokeType, GroupLayer, GroupShape, ImageAsset, ImageLayer, KeyFrame, Layer, LayerType, LineCapType, LineJoinType, Marker, Mask, MaskMode, MatteMode, Meta, PathShape, PrecompositionAsset, PrecompositionLayer, Property, PropertyType, RectangleShape, RepeaterComposite, RepeaterShape, RoundedCornersShape, Shape, ShapeLayer, ShapeType, SolidLayer, StarShape, StarType, StrokeShape, TextLayer, TrimMode, TrimShape, hexToRgba, rgbaToHex, useRegistry }; | ||
export { Animation, Asset, AssetType, BlendMode, Color, ColorRgb, ColorRgba, EllipseShape, FillRuleType, FillShape, Gradient, GradientFillShape, GradientFillType, GradientStop, GradientStrokeShape, GradientStrokeType, GroupLayer, GroupShape, ImageAsset, ImageLayer, KeyFrame, Layer, LayerType, LineCapType, LineJoinType, Marker, Mask, MaskMode, MatteMode, Meta, PathShape, PrecompositionAsset, PrecompositionLayer, Property, PropertyType, RectangleShape, RepeaterComposite, RepeaterShape, RoundedCornersShape, Shape, ShapeLayer, ShapeType, SolidLayer, StarShape, StarType, StrokeShape, TextLayer, Transform, TrimMode, TrimShape, hexToRgba, rgbaToHex, useRegistry }; | ||
//# sourceMappingURL=index.esm.js.map |
/*! | ||
* @lottiefiles/lottie-js - v0.2.4 | ||
* Compiled Thu, 11 Nov 2021 11:12:29 UTC | ||
* @lottiefiles/lottie-js - v0.3.1 | ||
* Compiled Thu, 16 Dec 2021 04:57:44 UTC | ||
* | ||
* Copyright LottieFiles. All rights reserved. | ||
*/(function(i,T){typeof exports=="object"&&typeof module!="undefined"?T(exports):typeof define=="function"&&define.amd?define(["exports"],T):(i=typeof globalThis!="undefined"?globalThis:i||self,T(i.Lottie={}))})(this,function(i){"use strict";class T{constructor(t){this.parent=t}}class Y extends T{fromJSON(t){return this.data=t.p,this.id=t.id,this.height=t.h,this.path=t.u,this.width=t.w,this}toJSON(){return{h:this.height,i:this.id,p:this.data,u:this.path,w:this.width}}}(function(t){t[t.PRECOMPOSITION=0]="PRECOMPOSITION",t[t.IMAGE=1]="IMAGE"})(i.AssetType||(i.AssetType={}));class K extends T{constructor(){super(...arguments);this.type=i.AssetType.PRECOMPOSITION,this.layers=[],this.id=""}fromJSON(t){return this.id=t.id,this.timeRemap=t.tm,this.layers=this.parent.createLayersFromJSONArray(t.layers),this}toJSON(){return{id:this.id,layers:this.layers.map(t=>t.toJSON()),tm:this.timeRemap}}}var at=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function nt(t,s,h){return h={path:s,exports:{},require:function(n,l){return ot(n,l??h.path)}},t(h,h.exports),h.exports}function ot(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var lt=nt(function(t,s){var h=function(n){function l(){this.fetch=!1,this.DOMException=n.DOMException}return l.prototype=n,new l}(typeof self!="undefined"?self:at);(function(n){var l=function(d){var f={searchParams:"URLSearchParams"in n,iterable:"Symbol"in n&&"iterator"in Symbol,blob:"FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in n,arrayBuffer:"ArrayBuffer"in n};function p(e){return e&&DataView.prototype.isPrototypeOf(e)}if(f.arrayBuffer)var S=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],A=ArrayBuffer.isView||function(e){return e&&S.indexOf(Object.prototype.toString.call(e))>-1};function R(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function et(e){return typeof e!="string"&&(e=String(e)),e}function G(e){var r={next:function(){var o=e.shift();return{done:o===void 0,value:o}}};return f.iterable&&(r[Symbol.iterator]=function(){return r}),r}function c(e){this.map={},e instanceof c?e.forEach(function(r,o){this.append(o,r)},this):Array.isArray(e)?e.forEach(function(r){this.append(r[0],r[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(r){this.append(r,e[r])},this)}c.prototype.append=function(e,r){e=R(e),r=et(r);var o=this.map[e];this.map[e]=o?o+", "+r:r},c.prototype.delete=function(e){delete this.map[R(e)]},c.prototype.get=function(e){return e=R(e),this.has(e)?this.map[e]:null},c.prototype.has=function(e){return this.map.hasOwnProperty(R(e))},c.prototype.set=function(e,r){this.map[R(e)]=et(r)},c.prototype.forEach=function(e,r){for(var o in this.map)this.map.hasOwnProperty(o)&&e.call(r,this.map[o],o,this)},c.prototype.keys=function(){var e=[];return this.forEach(function(r,o){e.push(o)}),G(e)},c.prototype.values=function(){var e=[];return this.forEach(function(r){e.push(r)}),G(e)},c.prototype.entries=function(){var e=[];return this.forEach(function(r,o){e.push([o,r])}),G(e)},f.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);function B(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function st(e){return new Promise(function(r,o){e.onload=function(){r(e.result)},e.onerror=function(){o(e.error)}})}function St(e){var r=new FileReader,o=st(r);return r.readAsArrayBuffer(e),o}function Tt(e){var r=new FileReader,o=st(r);return r.readAsText(e),o}function Et(e){for(var r=new Uint8Array(e),o=new Array(r.length),y=0;y<r.length;y++)o[y]=String.fromCharCode(r[y]);return o.join("")}function rt(e){if(e.slice)return e.slice(0);var r=new Uint8Array(e.byteLength);return r.set(new Uint8Array(e)),r.buffer}function ht(){return this.bodyUsed=!1,this._initBody=function(e){this._bodyInit=e,e?typeof e=="string"?this._bodyText=e:f.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:f.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:f.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():f.arrayBuffer&&f.blob&&p(e)?(this._bodyArrayBuffer=rt(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):f.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||A(e))?this._bodyArrayBuffer=rt(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||(typeof e=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):f.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},f.blob&&(this.blob=function(){var e=B(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?B(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(St)}),this.text=function(){var e=B(this);if(e)return e;if(this._bodyBlob)return Tt(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(Et(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},f.formData&&(this.formData=function(){return this.text().then(At)}),this.json=function(){return this.text().then(JSON.parse)},this}var wt=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function gt(e){var r=e.toUpperCase();return wt.indexOf(r)>-1?r:e}function w(e,r){r=r||{};var o=r.body;if(e instanceof w){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,r.headers||(this.headers=new c(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,!o&&e._bodyInit!=null&&(o=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=r.credentials||this.credentials||"same-origin",(r.headers||!this.headers)&&(this.headers=new c(r.headers)),this.method=gt(r.method||this.method||"GET"),this.mode=r.mode||this.mode||null,this.signal=r.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})};function At(e){var r=new FormData;return e.trim().split("&").forEach(function(o){if(o){var y=o.split("="),u=y.shift().replace(/\+/g," "),m=y.join("=").replace(/\+/g," ");r.append(decodeURIComponent(u),decodeURIComponent(m))}}),r}function Rt(e){var r=new c,o=e.replace(/\r?\n[\t ]+/g," ");return o.split(/\r?\n/).forEach(function(y){var u=y.split(":"),m=u.shift().trim();if(m){var J=u.join(":").trim();r.append(m,J)}}),r}ht.call(w.prototype);function N(e,r){r||(r={}),this.type="default",this.status=r.status===void 0?200:r.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in r?r.statusText:"OK",this.headers=new c(r.headers),this.url=r.url||"",this._initBody(e)}ht.call(N.prototype),N.prototype.clone=function(){return new N(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},N.error=function(){var e=new N(null,{status:0,statusText:""});return e.type="error",e};var It=[301,302,303,307,308];N.redirect=function(e,r){if(It.indexOf(r)===-1)throw new RangeError("Invalid status code");return new N(null,{status:r,headers:{location:e}})},d.DOMException=n.DOMException;try{new d.DOMException}catch(e){d.DOMException=function(r,o){this.message=r,this.name=o;var y=Error(r);this.stack=y.stack},d.DOMException.prototype=Object.create(Error.prototype),d.DOMException.prototype.constructor=d.DOMException}function F(e,r){return new Promise(function(o,y){var u=new w(e,r);if(u.signal&&u.signal.aborted)return y(new d.DOMException("Aborted","AbortError"));var m=new XMLHttpRequest;function J(){m.abort()}m.onload=function(){var I={status:m.status,statusText:m.statusText,headers:Rt(m.getAllResponseHeaders()||"")};I.url="responseURL"in m?m.responseURL:I.headers.get("X-Request-URL");var V="response"in m?m.response:m.responseText;o(new N(V,I))},m.onerror=function(){y(new TypeError("Network request failed"))},m.ontimeout=function(){y(new TypeError("Network request failed"))},m.onabort=function(){y(new d.DOMException("Aborted","AbortError"))},m.open(u.method,u.url,!0),u.credentials==="include"?m.withCredentials=!0:u.credentials==="omit"&&(m.withCredentials=!1),"responseType"in m&&f.blob&&(m.responseType="blob"),u.headers.forEach(function(I,V){m.setRequestHeader(V,I)}),u.signal&&(u.signal.addEventListener("abort",J),m.onreadystatechange=function(){m.readyState===4&&u.signal.removeEventListener("abort",J)}),m.send(typeof u._bodyInit=="undefined"?null:u._bodyInit)})}return F.polyfill=!0,n.fetch||(n.fetch=F,n.Headers=c,n.Request=w,n.Response=N),d.Headers=c,d.Request=w,d.Response=N,d.fetch=F,d}({})})(h),delete h.fetch.polyfill,s=h.fetch,s.default=h.fetch,s.fetch=h.fetch,s.Headers=h.Headers,s.Request=h.Request,s.Response=h.Response,t.exports=s});(function(t){t[t.NORMAL=0]="NORMAL",t[t.MULTIPLY=1]="MULTIPLY",t[t.SCREEN=2]="SCREEN",t[t.OVERLAY=3]="OVERLAY",t[t.DARKEN=4]="DARKEN",t[t.LIGHTEN=5]="LIGHTEN",t[t.COLOR_DODGE=6]="COLOR_DODGE",t[t.COLOR_BURN=7]="COLOR_BURN",t[t.HARD_LIGHT=8]="HARD_LIGHT",t[t.SOFT_LIGHT=9]="SOFT_LIGHT",t[t.DIFFERENCE=10]="DIFFERENCE",t[t.EXCLUSION=11]="EXCLUSION",t[t.HUE=12]="HUE",t[t.SATURATION=13]="SATURATION",t[t.COLOR=14]="COLOR",t[t.LUMINOSITY=15]="LUMINOSITY"})(i.BlendMode||(i.BlendMode={})),function(t){t[t.EVEN_ODD=1]="EVEN_ODD",t[t.NONZERO=2]="NONZERO"}(i.FillRuleType||(i.FillRuleType={})),function(t){t[t.NONE=0]="NONE",t[t.LINEAR=1]="LINEAR",t[t.RADIAL=2]="RADIAL",t[t.ANGULAR=4]="ANGULAR",t[t.REFLECTED=5]="REFLECTED",t[t.DIAMOND=6]="DIAMOND"}(i.GradientFillType||(i.GradientFillType={})),function(t){t[t.LINEAR=1]="LINEAR",t[t.RADIAL=2]="RADIAL"}(i.GradientStrokeType||(i.GradientStrokeType={})),function(t){t[t.PRECOMPOSITION=0]="PRECOMPOSITION",t[t.SOLID=1]="SOLID",t[t.IMAGE=2]="IMAGE",t[t.GROUP=3]="GROUP",t[t.SHAPE=4]="SHAPE",t[t.TEXT=5]="TEXT",t[t.AUDIO=6]="AUDIO",t[t.VIDEO_PLACEHOLDER=7]="VIDEO_PLACEHOLDER",t[t.IMAGE_SEQUENCE=8]="IMAGE_SEQUENCE",t[t.VIDEO=9]="VIDEO",t[t.IMAGE_PLACEHOLDER=10]="IMAGE_PLACEHOLDER",t[t.GUIDE=11]="GUIDE",t[t.ADJUSTMENT=12]="ADJUSTMENT",t[t.CAMERA=13]="CAMERA",t[t.LIGHT=14]="LIGHT"}(i.LayerType||(i.LayerType={})),function(t){t[t.BUTT=1]="BUTT",t[t.ROUND=2]="ROUND",t[t.PROJECTING=3]="PROJECTING"}(i.LineCapType||(i.LineCapType={})),function(t){t[t.MITER=1]="MITER",t[t.ROUND=2]="ROUND",t[t.BEVEL=3]="BEVEL"}(i.LineJoinType||(i.LineJoinType={})),function(t){t.None="n",t.Add="a",t.Subtract="s",t.Intersect="i",t.Lighten="l",t.Darken="d",t.Difference="f"}(i.MaskMode||(i.MaskMode={})),function(t){t.ANCHOR="a",t.OPACITY="o",t.POSITION="p",t.ROTATION="r",t.ROTATION_X="rx",t.ROTATION_Y="ry",t.ROTATION_Z="rz",t.SCALE="s",t.SKEW_AXIS="sa",t.SKEW="sk",t.SHAPE="sh",t.EXPANSION="x",t.FEATHER="f",t.SIZE="sz",t.ROUNDNESS="rd",t.MITER_LIMIT="ml",t.STROKE_WIDTH="sw",t.NUMBER="nu",t.COLOR="cl",t.ORIENTATION="or"}(i.PropertyType||(i.PropertyType={})),function(t){t.ELLIPSE="el",t.FILL="fl",t.GRADIENT_FILL="gf",t.GRADIENT_STROKE="gs",t.GROUP="gr",t.MERGE="mm",t.OFFSET_PATH="op",t.PATH="sh",t.RECTANGLE="rc",t.REPEATER="rp",t.ROUNDED_CORNERS="rd",t.STAR="sr",t.STROKE="st",t.TRIM="tm",t.TWIST="tw"}(i.ShapeType||(i.ShapeType={})),function(t){t[t.SIMULTANEOUSLY=1]="SIMULTANEOUSLY",t[t.INDIVIDUALLY=2]="INDIVIDUALLY"}(i.TrimMode||(i.TrimMode={})),function(t){t[t.ABOVE=1]="ABOVE",t[t.BELOW=2]="BELOW"}(i.RepeaterComposite||(i.RepeaterComposite={})),function(t){t[t.STAR=1]="STAR",t[t.POLYGON=2]="POLYGON"}(i.StarType||(i.StarType={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.ALPHA=1]="ALPHA",t[t.INVERTED_ALPHA=2]="INVERTED_ALPHA",t[t.LUMA=3]="LUMA",t[t.INVERTED_LUMA=4]="INVERTED_LUMA"}(i.MatteMode||(i.MatteMode={}));class P{constructor(t=0,s=0){this.frame=0,this.value=0,this.hold=!1,this.frame=t,this.value=s}fromJSON(t){this.frame=t.t,this.value=t.s;const s="i"in t&&"o"in t,h="ti"in t&&"to"in t;return this.frameInTangent=s?[t.i.x,t.i.y]:void 0,this.frameOutTangent=s?[t.o.x,t.o.y]:void 0,h&&("x"in t.ti&&"y"in t.ti?this.valueInTangent=[t.ti.x,t.ti.y]:this.valueInTangent=t.ti,"x"in t.to&&"y"in t.to?this.valueOutTangent=[t.to.x,t.to.y]:this.valueOutTangent=t.to),this.hold="h"in t&&t.h,this}toJSON(){const t={t:this.frame,s:this.value};return this.hold?t.h=1:this.frameInTangent&&this.frameOutTangent&&(t.i={x:this.frameInTangent[0],y:this.frameInTangent[1]},t.o={x:this.frameOutTangent[0],y:this.frameOutTangent[1]}),this.valueInTangent&&this.valueOutTangent&&(t.ti=this.valueInTangent,t.to=this.valueOutTangent),t}}const dt=new Map;function g(){return dt}class a{constructor(t,s,h=[]){this.UID=0,this.isAnimated=!1,this.index=0,this.values=[],this._parent=t,this.type=s,this.values=h,this.isAnimated=h.length>1,g().set(this,t)}getParent(){return this._parent}fromJSON(t){return this.expression="x"in t?t.x:void 0,this.index=t.ix,this.isAnimated=t.a===1,this.values=this.isAnimated?t.k.map(s=>new P().fromJSON(s)):[new P().fromJSON({t:0,s:t.k})],this.type===i.PropertyType.COLOR&&(this.maxColors="p"in t?t.p:void 0),this}toJSON(){let t;return this.isAnimated===!1?t=this.values.length?this.values[0].value:0:t=this.values,{x:this.expression,ix:this.index,a:this.isAnimated?1:0,k:t,p:this.maxColors}}}class z{constructor(t=0,s=[]){this.offset=t,this.color=s}get hasAlpha(){return this.color.length>3}get red(){return this.color[0]}get green(){return this.color[1]}get blue(){return this.color[2]}get alpha(){return this.color[3]}}class mt extends a{constructor(){super(...arguments);this.colorCount=0}keyframeValue(t){return t>=this.values.length?[]:this.values[t].value}keyframeHasAlpha(t){return this.keyframeValue(t).length==this.colorCount*6}keframeStops(t){const s=this.keyframeValue(t),h=[],n=this.keyframeHasAlpha(t);for(let l=0;l<this.colorCount;l++){const d=s.slice(l,3);n&&d.push(s[this.colorCount*4+l*2]),h.push(new z(s[l*4],d))}return h}setKeyframeStops(t,s){if(t>=this.values.length)return;s.length>this.colorCount&&(this.colorCount=s.length),this.values[t].value=this.stopsToArray(s)}addKeyframe(t,s){const h=new P(t,this.stopsToArray(s));return s.length>this.colorCount&&(this.colorCount=s.length),this.values.push(h),h}stopsToArray(t){let s=!1;const h=[];for(const n of t)h.push(n.offset),h.push(n.red),h.push(n.green),h.push(n.blue),n.hasAlpha&&(s=!0);if(s)for(const n of t)h.push(n.offset),h.push(n.alpha!==void 0?n.alpha:1);return h}}class L{constructor(){this.gradientColors=new mt(this,i.PropertyType.COLOR)}get colorCount(){return this.gradientColors.colorCount}set colorCount(t){this.gradientColors.colorCount=t}toJSON(){return{p:this.colorCount,k:this.gradientColors}}fromJSON(t){return this.gradientColors.fromJSON(t.k),this.colorCount=t.p,this}}class E{constructor(t){this.autoOrient=!1,this.blendMode=i.BlendMode.NORMAL,this.classNames=[],this.height=0,this.id="",this.inPoint=0,this.is3D=!1,this.name="",this.outPoint=0,this.startTime=0,this.timeStretch=1,this.width=0,this.opacity=new a(this,i.PropertyType.OPACITY),this.position=new a(this,i.PropertyType.POSITION),this.anchor=new a(this,i.PropertyType.ANCHOR),this.scale=new a(this,i.PropertyType.SCALE),this.parent=t}get colors(){const t=new Set,s=g();return[...s.keys()].filter(h=>s.get(h)===this&&h.type===i.PropertyType.COLOR).forEach(h=>{h.values.forEach(n=>{t.add(JSON.stringify(n.value))})}),Array.from(t).map(h=>JSON.parse(h))}get totalFrames(){return this.outPoint-this.inPoint}}class X extends E{constructor(){super(...arguments);this.type=i.LayerType.GROUP}fromJSON(t){return this.autoOrient=t.ao===1,this.blendMode=t.bm,this.effects=t.ef,this.height=t.h,this.id=t.ld,this.index=t.ind,this.inPoint=t.ip,this.is3D=t.ddd,this.name=t.nm,this.outPoint=t.op,this.parent=t.parent,this.startTime=t.st,this.timeStretch=t.sr,this.width=t.w,"cl"in t&&(this.classNames=t.cl.split(" ")),"tt"in t&&(this.matteMode=t.tt),"td"in t&&(this.matteTarget=t.td),"hd"in t&&(this.isHidden=t.hd),"mn"in t&&(this.matchName=t.mn),this.opacity.fromJSON(t.ks.o),this.position.fromJSON(t.ks.p),this.anchor.fromJSON(t.ks.a),this.scale.fromJSON(t.ks.s),this.rotation=new a(this,i.PropertyType.ROTATION).fromJSON(t.ks.r),this}toJSON(){var t;return{ao:this.autoOrient?1:0,bm:this.blendMode,cl:this.classNames.length?this.classNames.join(" "):void 0,ddd:this.is3D?1:0,ef:this.effects,h:this.height,ind:this.index,ip:this.inPoint,ks:{a:this.anchor,o:this.opacity,p:this.position,r:this.rotation,s:this.scale},ln:this.id,nm:this.name,mn:this.matchName,op:this.outPoint,parent:(t=this.parent)==null?void 0:t.index,sr:this.timeStretch,st:this.startTime,ty:this.type,w:this.width,tt:this.matteMode,td:this.matteTarget,hd:this.isHidden!==void 0?Number(this.isHidden):void 0}}}class W extends E{constructor(){super(...arguments);this.type=i.LayerType.IMAGE}fromJSON(t){return this.autoOrient=t.ao===1,this.blendMode=t.bm,this.effects=t.ef,this.height=t.h,this.id=t.ld,this.index=t.ind,this.inPoint=t.ip,this.is3D=t.ddd,this.name=t.nm,this.outPoint=t.op,this.parent=t.parent,this.startTime=t.st,this.timeStretch=t.sr,this.width=t.w,"cl"in t&&(this.classNames=t.cl.split(" ")),"tt"in t&&(this.matteMode=t.tt),"td"in t&&(this.matteTarget=t.td),"hd"in t&&(this.isHidden=t.hd),"mn"in t&&(this.matchName=t.mn),this.opacity.fromJSON(t.ks.o),this.position.fromJSON(t.ks.p),this.anchor.fromJSON(t.ks.a),this.scale.fromJSON(t.ks.s),this.rotation=new a(this,i.PropertyType.ROTATION).fromJSON(t.ks.r),this.refId=t.refId,this}toJSON(){var t;return{ty:this.type,ao:this.autoOrient?1:0,bm:this.blendMode,cl:this.classNames.length?this.classNames.join(" "):void 0,ddd:this.is3D?1:0,ef:this.effects,h:this.height,ind:this.index,ip:this.inPoint,ks:{a:this.anchor,o:this.opacity,p:this.position,r:this.rotation,s:this.scale},ln:this.id,nm:this.name,mn:this.matchName,op:this.outPoint,parent:(t=this.parent)==null?void 0:t.index,sr:this.timeStretch,st:this.startTime,w:this.width,tt:this.matteMode,td:this.matteTarget,hd:this.isHidden!==void 0?Number(this.isHidden):void 0,refId:this.refId}}}class q extends E{constructor(){super(...arguments);this.type=i.LayerType.PRECOMPOSITION}fromJSON(t){return this.autoOrient=t.ao===1,this.blendMode=t.bm,this.effects=t.ef,this.height=t.h,this.id=t.ld,this.index=t.ind,this.inPoint=t.ip,this.is3D=t.ddd,this.name=t.nm,this.outPoint=t.op,this.parent=t.parent,this.startTime=t.st,this.timeStretch=t.sr,this.width=t.w,"cl"in t&&(this.classNames=t.cl.split(" ")),"tt"in t&&(this.matteMode=t.tt),"td"in t&&(this.matteTarget=t.td),"hd"in t&&(this.isHidden=t.hd),"mn"in t&&(this.matchName=t.mn),this.opacity.fromJSON(t.ks.o),this.position.fromJSON(t.ks.p),this.anchor.fromJSON(t.ks.a),this.scale.fromJSON(t.ks.s),this.rotation=new a(this,i.PropertyType.ROTATION).fromJSON(t.ks.r),this.refId=t.refId,this}toJSON(){var t;return{ao:this.autoOrient?1:0,bm:this.blendMode,cl:this.classNames.length?this.classNames.join(" "):void 0,ddd:this.is3D?1:0,ef:this.effects,h:this.height,ind:this.index,ip:this.inPoint,ks:{a:this.anchor,o:this.opacity,p:this.position,r:this.rotation,s:this.scale},ln:this.id,nm:this.name,mn:this.matchName,op:this.outPoint,parent:(t=this.parent)==null?void 0:t.index,refId:this.refId,sr:this.timeStretch,st:this.startTime,ty:this.type,w:this.width,tt:this.matteMode,td:this.matteTarget,hd:this.isHidden!==void 0?Number(this.isHidden):void 0}}}class O{constructor(t){this.isHidden=!1,this.parent=t}}class b extends O{constructor(){super(...arguments);this.type=i.ShapeType.ELLIPSE,this.position=new a(this,i.PropertyType.POSITION),this.size=new a(this,i.PropertyType.SIZE),this.direction=1}fromJSON(t){return this.classNames=t.cl,this.id=t.ln,this.isHidden=t.hd,this.matchName=t.mn,this.name=t.nm,this.position.fromJSON(t.p),this.size.fromJSON(t.s),this.direction=t.d,this}toJSON(){return{ty:this.type,cl:this.classNames,hd:this.isHidden,ln:this.id,mn:this.matchName,nm:this.name,p:this.position,s:this.size,d:this.direction}}}class v extends O{constructor(){super(...arguments);this.type=i.ShapeType.FILL,this.blendMode=i.BlendMode.NORMAL,this.color=new a(this,i.PropertyType.COLOR),this.fillRule=i.FillRuleType.EVEN_ODD,this.opacity=new a(this,i.PropertyType.OPACITY)}fromJSON(t){return this.classNames=t.cl,this.id=t.ln,this.isHidden=t.hd,this.matchName=t.mn,this.name=t.nm,this.blendMode=t.bm,this.color.fromJSON(t.c),this.fillRule=t.r in i.FillRuleType?t.r:i.FillRuleType.EVEN_ODD,this.opacity.fromJSON(t.o),this}toJSON(){return{ty:this.type,cl:this.classNames,hd:this.isHidden,ln:this.id,mn:this.matchName,nm:this.name,bm:this.blendMode,c:this.color,r:this.fillRule,o:this.opacity}}}class D extends O{constructor(){super(...arguments);this.type=i.ShapeType.GRADIENT_FILL,this.blendMode=i.BlendMode.NORMAL,this.endPoint=new a(this,i.PropertyType.POSITION),this.gradientColors=new L,this.gradientType=i.GradientFillType.LINEAR,this.highlightAngle=new a(this,i.PropertyType.NUMBER),this.highlightLength=new a(this,i.PropertyType.NUMBER),this.opacity=new a(this,i.PropertyType.OPACITY),this.startPoint=new a(this,i.PropertyType.POSITION),this.fillRule=i.FillRuleType.EVEN_ODD}fromJSON(t){return this.classNames=t.cl,this.id=t.ln,this.isHidden=t.hd,this.matchName=t.mn,this.name=t.nm,this.blendMode=t.bm,this.endPoint.fromJSON(t.e),this.gradientColors.fromJSON(t.g),this.gradientType=t.t,this.opacity.fromJSON(t.o),this.startPoint.fromJSON(t.s),this.fillRule=t.r,this.gradientType===i.GradientFillType.LINEAR&&(this.highlightAngle.fromJSON(t.a),this.highlightLength.fromJSON(t.h)),this}toJSON(){return{ty:this.type,cl:this.classNames,hd:this.isHidden,ln:this.id,mn:this.matchName,nm:this.name,bm:this.blendMode,e:this.endPoint,g:this.gradientColors,t:this.gradientType,a:this.highlightAngle,h:this.highlightLength,o:this.opacity,r:this.fillRule,s:this.startPoint}}}class Z extends O{constructor(){super(...arguments);this.type=i.ShapeType.MERGE,this.mergeMode=1}fromJSON(t){return this.classNames=t.cl,this.id=t.ln,this.isHidden=t.hd,this.matchName=t.mn,this.name=t.nm,this.mergeMode=t.mm,this}toJSON(){return{ty:this.type,cl:this.classNames,hd:this.isHidden,ln:this.id,mn:this.matchName,nm:this.name,mm:this.mergeMode}}}class k extends O{constructor(){super(...arguments);this.type=i.ShapeType.PATH,this.vertices=new a(this,i.PropertyType.SHAPE)}fromJSON(t){return this.classNames=t.cl,this.id=t.ln,this.isHidden=t.hd,this.matchName=t.mn,this.name=t.nm,this.itemIndex=t.ind,this.shapeIndex=t.ix,this.direction=t.d,this.vertices=t.ks,this}toJSON(){return{ty:this.type,cl:this.classNames,hd:this.isHidden,ln:this.id,mn:this.matchName,nm:this.name,ind:this.itemIndex,ix:this.shapeIndex,d:this.direction,ks:this.vertices}}}class M extends O{constructor(){super(...arguments);this.type=i.ShapeType.RECTANGLE,this.position=new a(this,i.PropertyType.POSITION),this.roundness=new a(this,i.PropertyType.ROUNDNESS),this.size=new a(this,i.PropertyType.SIZE)}fromJSON(t){return this.classNames=t.cl,this.id=t.ln,this.isHidden=t.hd,this.matchName=t.mn,this.name=t.nm,this.direction=t.d,this.position.fromJSON(t.p),this.roundness.fromJSON(t.r),this.size.fromJSON(t.s),this}toJSON(){return{ty:this.type,cl:this.classNames,hd:this.isHidden,ln:this.id,mn:this.matchName,nm:this.name,d:this.direction,p:this.position,r:this.roundness,s:this.size}}}class C extends O{constructor(){super(...arguments);this.type=i.ShapeType.STROKE,this.blendMode=i.BlendMode.NORMAL,this.color=new a(this,i.PropertyType.COLOR),this.lineCapType=i.LineCapType.ROUND,this.lineJoinType=i.LineJoinType.ROUND,this.opacity=new a(this,i.PropertyType.OPACITY),this.width=new a(this,i.PropertyType.STROKE_WIDTH)}fromJSON(t){return this.classNames=t.cl,this.id=t.ln,this.isHidden=t.hd,this.matchName=t.mn,this.name=t.nm,this.blendMode=t.bm in i.BlendMode?t.bm:i.BlendMode.NORMAL,this.color.fromJSON(t.c),this.lineCapType=t.lc in i.LineCapType?t.lc:i.LineCapType.ROUND,this.lineJoinType=t.lj in i.LineJoinType?t.lj:i.LineJoinType.ROUND,this.miterLimit=t.ml,this.opacity.fromJSON(t.o),this.width.fromJSON(t.w),this}toJSON(){return{ty:this.type,cl:this.classNames,hd:this.isHidden,ln:this.id,mn:this.matchName,nm:this.name,bm:this.blendMode,c:this.color,lc:this.lineCapType,lj:this.lineJoinType,ml:this.miterLimit,o:this.opacity,w:this.width}}}class U extends O{constructor(){super(...arguments);this.type=i.ShapeType.TRIM,this.blendMode=i.BlendMode.NORMAL,this.trimEnd=new a(this,i.PropertyType.NUMBER),this.trimOffset=new a(this,i.PropertyType.NUMBER),this.trimStart=new a(this,i.PropertyType.NUMBER),this.trimMultipleShapes=i.TrimMode.SIMULTANEOUSLY}fromJSON(t){return this.classNames=t.cl,this.id=t.ln,this.isHidden=t.hd,this.matchName=t.mn,this.name=t.nm,this.blendMode=t.bm in i.BlendMode?t.bm:i.BlendMode.NORMAL,this.trimEnd.fromJSON(t.e),this.trimOffset.fromJSON(t.o),this.trimStart.fromJSON(t.s),this.trimMultipleShapes=t.m in i.TrimMode?t.m:i.TrimMode.INDIVIDUALLY,this}toJSON(){return{ty:this.type,cl:this.classNames,hd:this.isHidden,ln:this.id,mn:this.matchName,nm:this.name,bm:this.blendMode,e:this.trimEnd,o:this.trimOffset,s:this.trimStart,m:this.trimMultipleShapes}}}class H extends O{constructor(){super(...arguments);this.type=i.ShapeType.GROUP,this.anchor=new a(this,i.PropertyType.ANCHOR),this.blendMode=i.BlendMode.NORMAL,this.isHidden=!1,this.numProperties=0,this.opacity=new a(this,i.PropertyType.OPACITY),this.position=new a(this,i.PropertyType.POSITION),this.rotation=new a(this,i.PropertyType.ROTATION),this.scale=new a(this,i.PropertyType.SCALE),this.shapes=[],this.skew=new a(this,i.PropertyType.SKEW),this.skewAxis=new a(this,i.PropertyType.SKEW_AXIS)}fromJSON(t){return this.classNames=t.cl,this.id=t.ln,this.isHidden=t.hd,this.matchName=t.mn,this.name=t.nm,this.blendMode=t.bm,this.contentPropertyIndex=t.cix,this.propertyIndex=t.ix,this.numProperties=t.np,this.shapes=t.it.map(s=>{try{if(s.ty!=="tr"){const h=this.createShape(s.ty);return h.fromJSON(s)}this.anchor.fromJSON(s.a),this.opacity.fromJSON(s.o),this.position.fromJSON(s.p),this.rotation.fromJSON(s.r),this.scale.fromJSON(s.s),s.sk&&this.skew.fromJSON(s.sk),s.sa&&this.skewAxis.fromJSON(s.sa)}catch(h){}return!1}).filter(Boolean),this}createShape(t){if(t===i.ShapeType.PATH)return new k(this);if(t===i.ShapeType.GROUP)return new H(this);if(t===i.ShapeType.FILL)return new v(this);if(t===i.ShapeType.RECTANGLE)return new M(this);if(t===i.ShapeType.ELLIPSE)return new b(this);if(t===i.ShapeType.STROKE)return new C(this);if(t===i.ShapeType.GRADIENT_FILL)return new D(this);if(t===i.ShapeType.TRIM)return new U(this);if(t===i.ShapeType.MERGE)return new Z(this);throw new Error(`Invalid or unknown shape type: ${t}`)}toJSON(){const t=JSON.parse(JSON.stringify(this.shapes));return t.push({ty:"tr",nm:"Transform",a:this.anchor,o:this.opacity,p:this.position,r:this.rotation,s:this.scale,sk:this.skew,sa:this.skewAxis}),{ty:this.type,cl:this.classNames,hd:this.isHidden,ln:this.id,mn:this.matchName,nm:this.name,bm:this.blendMode,cix:this.contentPropertyIndex,it:t,ix:this.propertyIndex,np:this.numProperties}}}class $ extends E{constructor(){super(...arguments);this.type=i.LayerType.SHAPE,this.shapes=[]}createShape(t){if(t===i.ShapeType.PATH)return new k(this);if(t===i.ShapeType.GROUP)return new H(this);if(t===i.ShapeType.FILL)return new v(this);if(t===i.ShapeType.RECTANGLE)return new M(this);if(t===i.ShapeType.ELLIPSE)return new b(this);if(t===i.ShapeType.STROKE)return new C(this);if(t===i.ShapeType.GRADIENT_FILL)return new D(this);if(t===i.ShapeType.TRIM)return new U(this);if(t===i.ShapeType.MERGE)return new Z(this);throw new Error(`Invalid or unknown shape type: ${t}`)}createShapeFromJSON(t){try{const s=this.createShape(t.ty);return s.fromJSON(t)}catch(s){throw new Error(`Unable to create shape from JSON: ${t.ty}`)}}fromJSON(t){return this.autoOrient=t.ao===1,this.blendMode=t.bm,this.effects=t.ef,this.height=t.h,this.id=t.ld,this.index=t.ind,this.inPoint=t.ip,this.is3D=t.ddd,this.name=t.nm,this.outPoint=t.op,this.parent=t.parent,this.startTime=t.st,this.timeStretch=t.sr,this.width=t.w,this.classNames="cl"in t?t.cl.split(" "):[],"o"in t.ks&&this.opacity.fromJSON(t.ks.o),"p"in t.ks&&this.position.fromJSON(t.ks.p),"a"in t.ks&&this.anchor.fromJSON(t.ks.a),"s"in t.ks&&this.scale.fromJSON(t.ks.s),"or"in t.ks&&(this.orientation=new a(this,i.PropertyType.ORIENTATION).fromJSON(t.ks.or)),"rx"in t.ks&&(this.rotationX=new a(this,i.PropertyType.ROTATION_X).fromJSON(t.ks.rx)),"ry"in t.ks&&(this.rotationY=new a(this,i.PropertyType.ROTATION_Y).fromJSON(t.ks.ry)),"rz"in t.ks&&(this.rotationZ=new a(this,i.PropertyType.ROTATION_Z).fromJSON(t.ks.rz)),"r"in t.ks&&(this.rotation=new a(this,i.PropertyType.ROTATION).fromJSON(t.ks.r)),"tt"in t&&(this.matteMode=t.tt),"td"in t&&(this.matteTarget=t.td),"hd"in t&&(this.isHidden=t.hd),"mn"in t&&(this.matchName=t.mn),this.skew="sk"in t.ks?new a(this,i.PropertyType.SKEW).fromJSON(t.ks.sk):void 0,this.skewAxis="sa"in t.ks?new a(this,i.PropertyType.SKEW_AXIS).fromJSON(t.ks.sa):void 0,this.shapes=t.shapes.map(s=>this.createShapeFromJSON(s)).filter(Boolean),this}toJSON(){var t;return{ao:this.autoOrient?1:0,bm:this.blendMode,cl:this.classNames.length?this.classNames.join(" "):void 0,ddd:this.is3D?1:0,ef:this.effects,h:this.height,ind:this.index,ip:this.inPoint,ks:{a:this.anchor,o:this.opacity,p:this.position,r:this.rotation,s:this.scale,sk:this.skew,sa:this.skewAxis,rx:this.rotationX,ry:this.rotationY,rz:this.rotationZ,or:this.orientation},shapes:this.shapes.map(s=>s.toJSON()),ln:this.id,nm:this.name,mn:this.matchName,op:this.outPoint,parent:(t=this.parent)==null?void 0:t.index,sr:this.timeStretch,st:this.startTime,ty:this.type,w:this.width,tt:this.matteMode,td:this.matteTarget,hd:this.isHidden!==void 0?Number(this.isHidden):void 0}}}class Q extends E{constructor(){super(...arguments);this.type=i.LayerType.SOLID,this.solidColor="#000000",this.solidHeight=1,this.solidWidth=1}fromJSON(t){return this.autoOrient=t.ao===1,this.blendMode=t.bm,this.effects=t.ef,this.height=t.h,this.id=t.ld,this.index=t.ind,this.inPoint=t.ip,this.is3D=t.ddd,this.name=t.nm,this.outPoint=t.op,this.parent=t.parent,this.startTime=t.st,this.timeStretch=t.sr,this.width=t.w,"cl"in t&&(this.classNames=t.cl.split(" ")),"tt"in t&&(this.matteMode=t.tt),"td"in t&&(this.matteTarget=t.td),"hd"in t&&(this.isHidden=t.hd),"mn"in t&&(this.matchName=t.mn),this.opacity.fromJSON(t.ks.o),this.position.fromJSON(t.ks.p),this.anchor.fromJSON(t.ks.a),this.scale.fromJSON(t.ks.s),this.rotation=new a(this,i.PropertyType.ROTATION).fromJSON(t.ks.r),this.solidColor=t.sc,this.solidHeight=t.sh,this.solidWidth=t.sw,this}toJSON(){var t;return{ao:this.autoOrient?1:0,bm:this.blendMode,cl:this.classNames.length?this.classNames.join(" "):void 0,ddd:this.is3D?1:0,ef:this.effects,h:this.height,ind:this.index,ip:this.inPoint,ks:{a:this.anchor,o:this.opacity,p:this.position,r:this.rotation,s:this.scale},ln:this.id,nm:this.name,mn:this.matchName,op:this.outPoint,parent:(t=this.parent)==null?void 0:t.index,sc:this.solidColor,sh:this.solidHeight,sw:this.solidWidth,sr:this.timeStretch,st:this.startTime,ty:this.type,w:this.width,tt:this.matteMode,td:this.matteTarget,hd:this.isHidden!==void 0?Number(this.isHidden):void 0}}}class x extends E{constructor(){super(...arguments);this.type=i.LayerType.TEXT}fromJSON(t){return this.autoOrient=t.ao===1,this.blendMode=t.bm,this.effects=t.ef,this.height=t.h,this.id=t.ld,this.index=t.ind,this.inPoint=t.ip,this.is3D=t.ddd,this.name=t.nm,this.outPoint=t.op,this.parent=t.parent,this.startTime=t.st,this.timeStretch=t.sr,this.width=t.w,"cl"in t&&(this.classNames=t.cl.split(" ")),"tt"in t&&(this.matteMode=t.tt),"td"in t&&(this.matteTarget=t.td),"hd"in t&&(this.isHidden=t.hd),"mn"in t&&(this.matchName=t.mn),this.opacity.fromJSON(t.ks.o),this.position.fromJSON(t.ks.p),this.anchor.fromJSON(t.ks.a),this.scale.fromJSON(t.ks.s),this.rotation=new a(this,i.PropertyType.ROTATION).fromJSON(t.ks.r),this.textData=t.t,this}toJSON(){var t;return{ty:this.type,ao:this.autoOrient?1:0,bm:this.blendMode,cl:this.classNames.length?this.classNames.join(" "):void 0,ddd:this.is3D?1:0,ef:this.effects,h:this.height,ind:this.index,ip:this.inPoint,ks:{a:this.anchor,o:this.opacity,p:this.position,r:this.rotation,s:this.scale},ln:this.id,nm:this.name,mn:this.matchName,op:this.outPoint,parent:(t=this.parent)==null?void 0:t.index,sr:this.timeStretch,st:this.startTime,w:this.width,tt:this.matteMode,td:this.matteTarget,hd:this.isHidden!==void 0?Number(this.isHidden):void 0,t:this.textData}}}class j{constructor(){this.comment="",this.duration=0,this.time=0}fromJSON(t){return this.comment=t.cm,this.duration=t.dr,this.time=t.tm,this}toJSON(){return{cm:this.comment,dr:this.duration,tm:this.time}}}function tt(t){let s=(+t[0]).toString(16),h=(+t[1]).toString(16),n=(+t[2]).toString(16),l=Math.round(+t[3]*255).toString(16);return s.length==1&&(s="0"+s),h.length==1&&(h="0"+h),n.length==1&&(n="0"+n),l.length==1&&(l="0"+l),"#"+s+h+n+l}function ct(t,s){const h=parseInt(t.slice(1,3),16),n=parseInt(t.slice(3,5),16),l=parseInt(t.slice(5,7),16);return s?[h/255,n/255,l/255,s]:[h/255,n/255,l/255]}class it{constructor(t){this.keywords=[],this.generator="@lottiefiles/lottie-js 0.2.4",this.parent=t}fromJSON(t){return this.author=t.a,this.keywords="k"in t?t.k.split(",").map(s=>s.trim()):[t.k],this.generator=t.g,this.description=t.d,this.themeColor=t.tc,this}toJSON(){return{a:this.author,k:this.keywords.length?this.keywords:void 0,g:this.generator,d:this.description,tc:this.themeColor}}}var ft=(t,s,h)=>new Promise((n,l)=>{var d=S=>{try{p(h.next(S))}catch(A){l(A)}},f=S=>{try{p(h.throw(S))}catch(A){l(A)}},p=S=>S.done?n(S.value):Promise.resolve(S.value).then(d,f);p((h=h.apply(t,s)).next())});class _{constructor(){this.assets=[],this.frameRate=0,this.height=0,this.inPoint=0,this.is3D=!1,this.layers=[],this.markers=[],this.meta=new it(this),this.name="",this.outPoint=0,this.version="",this.width=0}static fromURL(t){return ft(this,null,function*(){if(typeof t!="string")throw new Error("The url value must be a string");let s;try{const n=new URL(t),l=yield lt(n.toString());s=yield l.json()}catch(n){throw new Error("An error occurred while trying to load the Lottie file from URL")}const h=new _;return h.fromJSON(s)})}static isLottie(t){const s=["v","ip","op","layers","fr","w","h"];return s.every(h=>Object.prototype.hasOwnProperty.call(t,h))}get colors(){const t=new Set;return[...g().keys()].filter(s=>s.type===i.PropertyType.COLOR).forEach(s=>{s.values.forEach(h=>{const n=h.value;t.add(JSON.stringify([Math.round(n[0]*255),Math.round(n[1]*255),Math.round(n[2]*255),n[3]]))})}),Array.from(t).map(s=>JSON.parse(s))}get colorsVerbose(){const t={};return[...g().keys()].filter(s=>s.type===i.PropertyType.COLOR).forEach((s,h)=>{const n=s.getParent(),l=this.parentPath(n),d=l.slice();s.values.forEach(f=>{d.unshift("Frame "+f.frame),d.unshift(h.toString());const p=f.value;t[d.join(".")]=tt([Math.round(p[0]*255),Math.round(p[1]*255),Math.round(p[2]*255),p[3]])})}),t}get textLayers(){const t={},s=this.getLayersByType(i.LayerType.TEXT);return s.forEach((h,n)=>{t[n+"."+h.name]=h.textData.d.k[0].s.t}),t}parentPath(t,s=[]){return t.parent===void 0?(s.push(t.name),s):(s.push(t.name),this.parentPath(t.parent,s))}get duration(){return this.totalFrames/this.frameRate}get fileSize(){return new TextEncoder().encode(JSON.stringify(this)).length}get totalFrames(){return this.outPoint-this.inPoint}createAsset(t){if(t===i.AssetType.PRECOMPOSITION)return new K(this);if(t===i.AssetType.IMAGE)return new Y(this);throw new Error(`Invalid or unknown asset type ${t}`)}createAssetFromJSON(t){try{const s=this.createAsset("layers"in t?i.AssetType.PRECOMPOSITION:i.AssetType.IMAGE);return s.fromJSON(t)}catch(s){throw new Error("Unable to create asset from JSON")}}createLayer(t){if(t===i.LayerType.PRECOMPOSITION)return new q(this);if(t===i.LayerType.SHAPE)return new $(this);if(t===i.LayerType.GROUP)return new X(this);if(t===i.LayerType.SOLID)return new Q(this);if(t===i.LayerType.IMAGE)return new W(this);if(t===i.LayerType.TEXT)return new x(this);throw new Error(`Invalid or unknown layer type: ${t}`)}createLayerFromJSON(t){try{const s=this.createLayer(t.ty);return s.fromJSON(t)}catch(s){throw console.log(s),new Error(`Unable to create layer type from JSON: ${t.ty}`)}}createLayersFromJSONArray(t){const s=new Map,h=[],n=[];return t.forEach(l=>{const d=this.createLayerFromJSON(l);d&&(l.parent!==void 0&&h.push([d,l.parent]),d.index!==void 0&&s.set(d.index,d),n.push(d))}),h.forEach(([l,d])=>{l.parent=s.get(d)}),n}createMarker(){return new j}createMarkerFromJSON(t){try{const s=this.createMarker();return s.fromJSON(t)}catch(s){throw console.log(s),new Error("Unable to create marker from JSON")}}fromJSON(t){if(_.isLottie(t)===!1)throw new Error("The given object is not a valid Lottie JSON structure");return this.frameRate=t.fr,this.height=t.h,this.inPoint=t.ip,this.is3D=t.ddd,this.name=t.nm,this.outPoint=t.op,this.version=t.v,this.width=t.w,this.assets=t.assets.map(s=>this.createAssetFromJSON(s)).filter(Boolean),this.layers=this.createLayersFromJSONArray(t.layers),this.markers=t.markers.map(s=>this.createMarkerFromJSON(s)).filter(Boolean),"meta"in t&&this.meta.fromJSON(t.meta),this}getLayerById(t){if(typeof t!="string")throw new Error("ID value must be a string");return this.layers.find(s=>s.id===t)}getLayersByClassName(t){if(typeof t!="string")throw new Error("Class name value must be a string");return this.layers.filter(s=>s.classNames.includes(t))}getLayersByType(t){if(t in i.LayerType===!1)throw new Error("Type value must be a valid LayerType value");return this.layers.filter(s=>s.type===t)}toJSON(t){return t?void 0:{assets:this.assets,ddd:this.is3D?1:0,fr:this.frameRate,h:this.height,ip:this.inPoint,layers:this.layers.map(s=>s.toJSON()),markers:this.markers.map(s=>s.toJSON()),meta:this.meta,nm:this.name,op:this.outPoint,v:this.version||"5.6.0",w:this.width}}}class ut{constructor(){this.isInverted=!1,this.name="",this.mode=i.MaskMode.Add}fromJSON(t){return this.isInverted=t.inv,this.mode=t.mode,this.name=t.nm,this.points=t.pt,this.opacity=t.o,this}toJSON(){return{inv:this.isInverted,mode:this.mode,nm:this.name,o:this.opacity,pt:this.points}}}class yt extends O{constructor(){super(...arguments);this.type=i.ShapeType.GRADIENT_STROKE,this.blendMode=i.BlendMode.NORMAL,this.endPoint=new a(this,i.PropertyType.POSITION),this.gradientColors=new L,this.gradientType=i.GradientFillType.LINEAR,this.highlightAngle=new a(this,i.PropertyType.NUMBER),this.highlightLength=new a(this,i.PropertyType.NUMBER),this.opacity=new a(this,i.PropertyType.OPACITY),this.startPoint=new a(this,i.PropertyType.POSITION),this.lineCapType=i.LineCapType.ROUND,this.lineJoinType=i.LineJoinType.ROUND,this.width=new a(this,i.PropertyType.STROKE_WIDTH)}fromJSON(t){return this.classNames=t.cl,this.id=t.ln,this.isHidden=t.hd,this.matchName=t.mn,this.name=t.nm,this.blendMode=t.bm,this.opacity.fromJSON(t.o),this.endPoint.fromJSON(t.e),this.gradientColors.fromJSON(t.g),this.gradientType=t.t,this.startPoint.fromJSON(t.s),this.gradientType===i.GradientFillType.LINEAR&&(this.highlightAngle.fromJSON(t.a),this.highlightLength.fromJSON(t.h)),this.lineCapType=t.lc in i.LineCapType?t.lc:i.LineCapType.ROUND,this.lineJoinType=t.lj in i.LineJoinType?t.lj:i.LineJoinType.ROUND,this.miterLimit=t.ml,this.width.fromJSON(t.w),this}toJSON(){return{ty:this.type,cl:this.classNames,hd:this.isHidden,ln:this.id,mn:this.matchName,nm:this.name,bm:this.blendMode,o:this.opacity,e:this.endPoint,g:this.gradientColors,t:this.gradientType,a:this.highlightAngle,h:this.highlightLength,s:this.startPoint,lc:this.lineCapType,lj:this.lineJoinType,ml:this.miterLimit,w:this.width}}}class Ot extends O{constructor(){super(...arguments);this.type=i.ShapeType.REPEATER,this.anchor=new a(this,i.PropertyType.ANCHOR),this.startOpacity=new a(this,i.PropertyType.OPACITY),this.endOpacity=new a(this,i.PropertyType.OPACITY),this.position=new a(this,i.PropertyType.POSITION),this.rotation=new a(this,i.PropertyType.ROTATION),this.scale=new a(this,i.PropertyType.SCALE),this.shapes=[],this.skew=new a(this,i.PropertyType.SKEW),this.skewAxis=new a(this,i.PropertyType.SKEW_AXIS),this.copies=new a(this,i.PropertyType.NUMBER),this.offset=new a(this,i.PropertyType.NUMBER),this.composition=i.RepeaterComposite.ABOVE}fromJSON(t){return this.classNames=t.cl,this.id=t.ln,this.isHidden=t.hd,this.matchName=t.mn,this.name=t.nm,this.copies.fromJSON(t.c),this.composition=t.m,this.offset.fromJSON(t.o),this.anchor.fromJSON(t.tr.a),this.startOpacity.fromJSON(t.tr.so),this.endOpacity.fromJSON(t.tr.eo),this.position.fromJSON(t.tr.p),this.rotation.fromJSON(t.tr.r),this.scale.fromJSON(t.tr.s),t.tr.sk&&this.skew.fromJSON(t.tr.sk),t.tr.sa&&this.skewAxis.fromJSON(t.tr.sa),this}toJSON(){return{ty:this.type,cl:this.classNames,hd:this.isHidden,ln:this.id,mn:this.matchName,nm:this.name,m:this.composition,c:this.copies,o:this.offset,tr:{a:this.anchor,so:this.startOpacity,eo:this.endOpacity,p:this.position,r:this.rotation,s:this.scale,sk:this.skew,sa:this.skewAxis}}}}class pt extends O{constructor(){super(...arguments);this.type=i.ShapeType.STAR,this.position=new a(this,i.PropertyType.POSITION),this.innerRadius=new a(this,i.PropertyType.NUMBER),this.innerRoundness=new a(this,i.PropertyType.NUMBER),this.outerRadius=new a(this,i.PropertyType.NUMBER),this.outerRoundness=new a(this,i.PropertyType.NUMBER),this.rotation=new a(this,i.PropertyType.ROTATION),this.points=new a(this,i.PropertyType.NUMBER),this.starType=i.StarType.STAR}fromJSON(t){return this.classNames=t.cl,this.id=t.ln,this.isHidden=t.hd,this.matchName=t.mn,this.name=t.nm,this.position.fromJSON(t.p),this.innerRadius.fromJSON(t.ir),this.innerRoundness.fromJSON(t.is),this.outerRadius.fromJSON(t.or),this.outerRoundness.fromJSON(t.os),this.rotation.fromJSON(t.r),this.points.fromJSON(t.pt),this.starType=t.sy,this.direction=t.d,this}toJSON(){return{ty:this.type,cl:this.classNames,hd:this.isHidden,ln:this.id,mn:this.matchName,nm:this.name,p:this.position,ir:this.innerRadius,is:this.innerRoundness,or:this.outerRadius,os:this.outerRoundness,r:this.rotation,pt:this.points,sy:this.starType,d:this.direction}}}class Nt extends O{constructor(){super(...arguments);this.type=i.ShapeType.ROUNDED_CORNERS,this.roundness=new a(this,i.PropertyType.NUMBER)}fromJSON(t){return this.classNames=t.cl,this.id=t.ln,this.isHidden=t.hd,this.matchName=t.mn,this.name=t.nm,this.roundness.fromJSON(t.r),this}toJSON(){return{ty:this.type,cl:this.classNames,hd:this.isHidden,ln:this.id,mn:this.matchName,nm:this.name,r:this.roundness}}}i.Animation=_,i.Asset=T,i.EllipseShape=b,i.FillShape=v,i.Gradient=L,i.GradientFillShape=D,i.GradientStop=z,i.GradientStrokeShape=yt,i.GroupLayer=X,i.GroupShape=H,i.ImageAsset=Y,i.ImageLayer=W,i.KeyFrame=P,i.Layer=E,i.Marker=j,i.Mask=ut,i.Meta=it,i.PathShape=k,i.PrecompositionAsset=K,i.PrecompositionLayer=q,i.Property=a,i.RectangleShape=M,i.RepeaterShape=Ot,i.RoundedCornersShape=Nt,i.Shape=O,i.ShapeLayer=$,i.SolidLayer=Q,i.StarShape=pt,i.StrokeShape=C,i.TextLayer=x,i.TrimShape=U,i.hexToRgba=ct,i.rgbaToHex=tt,i.useRegistry=g,Object.defineProperty(i,"__esModule",{value:!0})}); | ||
*/(function(i,E){typeof exports=="object"&&typeof module!="undefined"?E(exports):typeof define=="function"&&define.amd?define(["exports"],E):(i=typeof globalThis!="undefined"?globalThis:i||self,E(i.Lottie={}))})(this,function(i){"use strict";class E{constructor(t){this.parent=t}}class W extends E{fromJSON(t){return this.data=t.p,this.id=t.id,this.height=t.h,this.path=t.u,this.width=t.w,this}toJSON(){return{h:this.height,i:this.id,p:this.data,u:this.path,w:this.width}}}(function(t){t[t.PRECOMPOSITION=0]="PRECOMPOSITION",t[t.IMAGE=1]="IMAGE"})(i.AssetType||(i.AssetType={}));class q extends E{constructor(){super(...arguments);this.type=i.AssetType.PRECOMPOSITION,this.layers=[],this.id=""}fromJSON(t){return this.id=t.id,this.timeRemap=t.tm,this.layers=this.parent.createLayersFromJSONArray(t.layers),this}toJSON(){return{id:this.id,layers:this.layers.map(t=>t.toJSON()),tm:this.timeRemap}}}var mt=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function ct(t,s,r){return r={path:s,exports:{},require:function(a,l){return ut(a,l??r.path)}},t(r,r.exports),r.exports}function ut(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var ft=ct(function(t,s){var r=function(a){function l(){this.fetch=!1,this.DOMException=a.DOMException}return l.prototype=a,new l}(typeof self!="undefined"?self:mt);(function(a){var l=function(d){var u={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function N(e){return e&&DataView.prototype.isPrototypeOf(e)}if(u.arrayBuffer)var T=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],I=ArrayBuffer.isView||function(e){return e&&T.indexOf(Object.prototype.toString.call(e))>-1};function P(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function at(e){return typeof e!="string"&&(e=String(e)),e}function Y(e){var h={next:function(){var o=e.shift();return{done:o===void 0,value:o}}};return u.iterable&&(h[Symbol.iterator]=function(){return h}),h}function c(e){this.map={},e instanceof c?e.forEach(function(h,o){this.append(o,h)},this):Array.isArray(e)?e.forEach(function(h){this.append(h[0],h[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(h){this.append(h,e[h])},this)}c.prototype.append=function(e,h){e=P(e),h=at(h);var o=this.map[e];this.map[e]=o?o+", "+h:h},c.prototype.delete=function(e){delete this.map[P(e)]},c.prototype.get=function(e){return e=P(e),this.has(e)?this.map[e]:null},c.prototype.has=function(e){return this.map.hasOwnProperty(P(e))},c.prototype.set=function(e,h){this.map[P(e)]=at(h)},c.prototype.forEach=function(e,h){for(var o in this.map)this.map.hasOwnProperty(o)&&e.call(h,this.map[o],o,this)},c.prototype.keys=function(){var e=[];return this.forEach(function(h,o){e.push(o)}),Y(e)},c.prototype.values=function(){var e=[];return this.forEach(function(h){e.push(h)}),Y(e)},c.prototype.entries=function(){var e=[];return this.forEach(function(h,o){e.push([o,h])}),Y(e)},u.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);function K(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function ot(e){return new Promise(function(h,o){e.onload=function(){h(e.result)},e.onerror=function(){o(e.error)}})}function Lt(e){var h=new FileReader,o=ot(h);return h.readAsArrayBuffer(e),o}function vt(e){var h=new FileReader,o=ot(h);return h.readAsText(e),o}function Dt(e){for(var h=new Uint8Array(e),o=new Array(h.length),O=0;O<h.length;O++)o[O]=String.fromCharCode(h[O]);return o.join("")}function lt(e){if(e.slice)return e.slice(0);var h=new Uint8Array(e.byteLength);return h.set(new Uint8Array(e)),h.buffer}function dt(){return this.bodyUsed=!1,this._initBody=function(e){this._bodyInit=e,e?typeof e=="string"?this._bodyText=e:u.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:u.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:u.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():u.arrayBuffer&&u.blob&&N(e)?(this._bodyArrayBuffer=lt(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||I(e))?this._bodyArrayBuffer=lt(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||(typeof e=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):u.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},u.blob&&(this.blob=function(){var e=K(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?K(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(Lt)}),this.text=function(){var e=K(this);if(e)return e;if(this._bodyBlob)return vt(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(Dt(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},u.formData&&(this.formData=function(){return this.text().then(_t)}),this.json=function(){return this.text().then(JSON.parse)},this}var Ct=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function Mt(e){var h=e.toUpperCase();return Ct.indexOf(h)>-1?h:e}function w(e,h){h=h||{};var o=h.body;if(e instanceof w){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,h.headers||(this.headers=new c(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,!o&&e._bodyInit!=null&&(o=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=h.credentials||this.credentials||"same-origin",(h.headers||!this.headers)&&(this.headers=new c(h.headers)),this.method=Mt(h.method||this.method||"GET"),this.mode=h.mode||this.mode||null,this.signal=h.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})};function _t(e){var h=new FormData;return e.trim().split("&").forEach(function(o){if(o){var O=o.split("="),f=O.shift().replace(/\+/g," "),m=O.join("=").replace(/\+/g," ");h.append(decodeURIComponent(f),decodeURIComponent(m))}}),h}function Ut(e){var h=new c,o=e.replace(/\r?\n[\t ]+/g," ");return o.split(/\r?\n/).forEach(function(O){var f=O.split(":"),m=f.shift().trim();if(m){var L=f.join(":").trim();h.append(m,L)}}),h}dt.call(w.prototype);function S(e,h){h||(h={}),this.type="default",this.status=h.status===void 0?200:h.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in h?h.statusText:"OK",this.headers=new c(h.headers),this.url=h.url||"",this._initBody(e)}dt.call(S.prototype),S.prototype.clone=function(){return new S(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},S.error=function(){var e=new S(null,{status:0,statusText:""});return e.type="error",e};var Ht=[301,302,303,307,308];S.redirect=function(e,h){if(Ht.indexOf(h)===-1)throw new RangeError("Invalid status code");return new S(null,{status:h,headers:{location:e}})},d.DOMException=a.DOMException;try{new d.DOMException}catch(e){d.DOMException=function(h,o){this.message=h,this.name=o;var O=Error(h);this.stack=O.stack},d.DOMException.prototype=Object.create(Error.prototype),d.DOMException.prototype.constructor=d.DOMException}function z(e,h){return new Promise(function(o,O){var f=new w(e,h);if(f.signal&&f.signal.aborted)return O(new d.DOMException("Aborted","AbortError"));var m=new XMLHttpRequest;function L(){m.abort()}m.onload=function(){var b={status:m.status,statusText:m.statusText,headers:Ut(m.getAllResponseHeaders()||"")};b.url="responseURL"in m?m.responseURL:b.headers.get("X-Request-URL");var X="response"in m?m.response:m.responseText;o(new S(X,b))},m.onerror=function(){O(new TypeError("Network request failed"))},m.ontimeout=function(){O(new TypeError("Network request failed"))},m.onabort=function(){O(new d.DOMException("Aborted","AbortError"))},m.open(f.method,f.url,!0),f.credentials==="include"?m.withCredentials=!0:f.credentials==="omit"&&(m.withCredentials=!1),"responseType"in m&&u.blob&&(m.responseType="blob"),f.headers.forEach(function(b,X){m.setRequestHeader(X,b)}),f.signal&&(f.signal.addEventListener("abort",L),m.onreadystatechange=function(){m.readyState===4&&f.signal.removeEventListener("abort",L)}),m.send(typeof f._bodyInit=="undefined"?null:f._bodyInit)})}return z.polyfill=!0,a.fetch||(a.fetch=z,a.Headers=c,a.Request=w,a.Response=S),d.Headers=c,d.Request=w,d.Response=S,d.fetch=z,d}({})})(r),delete r.fetch.polyfill,s=r.fetch,s.default=r.fetch,s.fetch=r.fetch,s.Headers=r.Headers,s.Request=r.Request,s.Response=r.Response,t.exports=s});(function(t){t[t.NORMAL=0]="NORMAL",t[t.MULTIPLY=1]="MULTIPLY",t[t.SCREEN=2]="SCREEN",t[t.OVERLAY=3]="OVERLAY",t[t.DARKEN=4]="DARKEN",t[t.LIGHTEN=5]="LIGHTEN",t[t.COLOR_DODGE=6]="COLOR_DODGE",t[t.COLOR_BURN=7]="COLOR_BURN",t[t.HARD_LIGHT=8]="HARD_LIGHT",t[t.SOFT_LIGHT=9]="SOFT_LIGHT",t[t.DIFFERENCE=10]="DIFFERENCE",t[t.EXCLUSION=11]="EXCLUSION",t[t.HUE=12]="HUE",t[t.SATURATION=13]="SATURATION",t[t.COLOR=14]="COLOR",t[t.LUMINOSITY=15]="LUMINOSITY"})(i.BlendMode||(i.BlendMode={})),function(t){t[t.EVEN_ODD=1]="EVEN_ODD",t[t.NONZERO=2]="NONZERO"}(i.FillRuleType||(i.FillRuleType={})),function(t){t[t.NONE=0]="NONE",t[t.LINEAR=1]="LINEAR",t[t.RADIAL=2]="RADIAL",t[t.ANGULAR=4]="ANGULAR",t[t.REFLECTED=5]="REFLECTED",t[t.DIAMOND=6]="DIAMOND"}(i.GradientFillType||(i.GradientFillType={})),function(t){t[t.LINEAR=1]="LINEAR",t[t.RADIAL=2]="RADIAL"}(i.GradientStrokeType||(i.GradientStrokeType={})),function(t){t[t.PRECOMPOSITION=0]="PRECOMPOSITION",t[t.SOLID=1]="SOLID",t[t.IMAGE=2]="IMAGE",t[t.GROUP=3]="GROUP",t[t.SHAPE=4]="SHAPE",t[t.TEXT=5]="TEXT",t[t.AUDIO=6]="AUDIO",t[t.VIDEO_PLACEHOLDER=7]="VIDEO_PLACEHOLDER",t[t.IMAGE_SEQUENCE=8]="IMAGE_SEQUENCE",t[t.VIDEO=9]="VIDEO",t[t.IMAGE_PLACEHOLDER=10]="IMAGE_PLACEHOLDER",t[t.GUIDE=11]="GUIDE",t[t.ADJUSTMENT=12]="ADJUSTMENT",t[t.CAMERA=13]="CAMERA",t[t.LIGHT=14]="LIGHT"}(i.LayerType||(i.LayerType={})),function(t){t[t.BUTT=1]="BUTT",t[t.ROUND=2]="ROUND",t[t.PROJECTING=3]="PROJECTING"}(i.LineCapType||(i.LineCapType={})),function(t){t[t.MITER=1]="MITER",t[t.ROUND=2]="ROUND",t[t.BEVEL=3]="BEVEL"}(i.LineJoinType||(i.LineJoinType={})),function(t){t.None="n",t.Add="a",t.Subtract="s",t.Intersect="i",t.Lighten="l",t.Darken="d",t.Difference="f"}(i.MaskMode||(i.MaskMode={})),function(t){t.ANCHOR="a",t.OPACITY="o",t.POSITION="p",t.ROTATION="r",t.ROTATION_X="rx",t.ROTATION_Y="ry",t.ROTATION_Z="rz",t.SCALE="s",t.SKEW_AXIS="sa",t.SKEW="sk",t.SHAPE="sh",t.EXPANSION="x",t.FEATHER="f",t.SIZE="sz",t.ROUNDNESS="rd",t.MITER_LIMIT="ml",t.STROKE_WIDTH="sw",t.NUMBER="nu",t.COLOR="cl",t.ORIENTATION="or"}(i.PropertyType||(i.PropertyType={})),function(t){t.ELLIPSE="el",t.FILL="fl",t.GRADIENT_FILL="gf",t.GRADIENT_STROKE="gs",t.GROUP="gr",t.MERGE="mm",t.OFFSET_PATH="op",t.PATH="sh",t.RECTANGLE="rc",t.REPEATER="rp",t.ROUNDED_CORNERS="rd",t.STAR="sr",t.STROKE="st",t.TRIM="tm",t.TWIST="tw"}(i.ShapeType||(i.ShapeType={})),function(t){t[t.SIMULTANEOUSLY=1]="SIMULTANEOUSLY",t[t.INDIVIDUALLY=2]="INDIVIDUALLY"}(i.TrimMode||(i.TrimMode={})),function(t){t[t.ABOVE=1]="ABOVE",t[t.BELOW=2]="BELOW"}(i.RepeaterComposite||(i.RepeaterComposite={})),function(t){t[t.STAR=1]="STAR",t[t.POLYGON=2]="POLYGON"}(i.StarType||(i.StarType={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.ALPHA=1]="ALPHA",t[t.INVERTED_ALPHA=2]="INVERTED_ALPHA",t[t.LUMA=3]="LUMA",t[t.INVERTED_LUMA=4]="INVERTED_LUMA"}(i.MatteMode||(i.MatteMode={}));class p{constructor(t=0,s=0){this.frame=0,this.value=0,this.frameInTangent=[0,0],this.frameOutTangent=[1,1],this.hold=!1,this.frame=t,this.value=s}fromJSON(t,s=void 0){this.frame=t.t,s===void 0?this.value=t.s:this.value=s.fromJSON(t.s);const r="i"in t&&"o"in t,a="ti"in t&&"to"in t;return this.frameInTangent=r?[t.i.x,t.i.y]:void 0,this.frameOutTangent=r?[t.o.x,t.o.y]:void 0,a&&("x"in t.ti&&"y"in t.ti?this.valueInTangent=[t.ti.x,t.ti.y]:this.valueInTangent=t.ti,"x"in t.to&&"y"in t.to?this.valueOutTangent=[t.to.x,t.to.y]:this.valueOutTangent=t.to),this.hold="h"in t&&t.h,this}toJSON(){const t={t:this.frame,s:this.value};return this.hold?t.h=1:this.frameInTangent&&this.frameOutTangent&&(t.i={x:this.frameInTangent[0],y:this.frameInTangent[1]},t.o={x:this.frameOutTangent[0],y:this.frameOutTangent[1]}),this.valueInTangent&&this.valueOutTangent&&(t.ti=this.valueInTangent,t.to=this.valueOutTangent),t}}const yt=new Map;function R(){return yt}class J{toJSON(){return this.toRgbArray()}static fromJSON(t){return t.length>3?v.fromJSON(t):t.length==3?A.fromJSON(t):new A(0,0,0)}}class A extends J{constructor(t,s,r){super();this.r=t,this.g=s,this.b=r}toRgbArray(){return[this.r,this.g,this.b]}static fromJSON(t){return new A(t[0],t[1],t[2])}}class v extends A{constructor(t,s,r,a=1){super(t,s,r);this.a=a}toRgbArray(){return[this.r,this.g,this.b,this.a]}static fromJSON(t){return new v(t[0],t[1],t[2],t[3])}}class n{constructor(t,s,r=[]){this.UID=0,this.isAnimated=!1,this.values=[],this._parent=t,this.type=s,this.values=r,this.isAnimated=r.length>1,R().set(this,t)}getParent(){return this._parent}fromJSON(t){this.expression="x"in t?t.x:void 0,this.index=t.ix,this.isAnimated=t.a===1;let s;return this.type==i.PropertyType.COLOR&&(s=J),this.values=this.isAnimated?t.k.map(r=>new p().fromJSON(r,s)):[new p().fromJSON({t:0,s:t.k},s)],this.type===i.PropertyType.COLOR&&(this.maxColors="p"in t?t.p:void 0),this}toJSON(){let t;const s=this.isAnimated!==!1||this.values.length>1;return s?t=this.values:t=this.values.length?this.values[0].value:0,{x:this.expression,ix:this.index,a:s?1:0,k:t,p:this.maxColors}}}class D{constructor(){this.anchor=new n(this,i.PropertyType.ANCHOR,[new p(0,[0,0])]),this.opacity=new n(this,i.PropertyType.OPACITY,[new p(0,100)]),this.position=new n(this,i.PropertyType.POSITION,[new p(0,[0,0])]),this.rotation=new n(this,i.PropertyType.ROTATION,[new p(0,0)]),this.scale=new n(this,i.PropertyType.SCALE,[new p(0,[100,100])]),this.skew=new n(this,i.PropertyType.SKEW),this.skewAxis=new n(this,i.PropertyType.SKEW_AXIS)}fromJSON(t){return this.rotation="r"in t?new n(this,i.PropertyType.ROTATION).fromJSON(t.r):void 0,"o"in t&&this.opacity.fromJSON(t.o),"p"in t&&this.position.fromJSON(t.p),"a"in t&&this.anchor.fromJSON(t.a),"s"in t&&this.scale.fromJSON(t.s),this.skew="sk"in t?new n(this,i.PropertyType.SKEW).fromJSON(t.sk):void 0,this.skewAxis="sa"in t?new n(this,i.PropertyType.SKEW_AXIS).fromJSON(t.sa):void 0,"or"in t&&(this.orientation=new n(this,i.PropertyType.ORIENTATION).fromJSON(t.or)),"rx"in t&&(this.rotationX=new n(this,i.PropertyType.ROTATION_X).fromJSON(t.rx)),"ry"in t&&(this.rotationY=new n(this,i.PropertyType.ROTATION_Y).fromJSON(t.ry)),"rz"in t&&(this.rotationZ=new n(this,i.PropertyType.ROTATION_Z).fromJSON(t.rz)),this}toJSON(){return{a:this.anchor,o:this.opacity,p:this.position,r:this.rotation,s:this.scale,sk:this.skew,sa:this.skewAxis,rx:this.rotationX,ry:this.rotationY,rz:this.rotationZ,or:this.orientation}}}class g{constructor(t){this.autoOrient=!1,this.blendMode=i.BlendMode.NORMAL,this.classNames=[],this.height=0,this.id="",this.inPoint=0,this.is3D=!1,this.name="",this.outPoint=0,this.startTime=0,this.timeStretch=1,this.width=0,this.transform=new D,this.parent=t}get colors(){const t=new Set,s=R();return[...s.keys()].filter(r=>s.get(r)===this&&r.type===i.PropertyType.COLOR).forEach(r=>{r.values.forEach(a=>{t.add(JSON.stringify(a.value))})}),Array.from(t).map(r=>JSON.parse(r))}get totalFrames(){return this.outPoint-this.inPoint}}var Ot=Object.assign;class $ extends g{constructor(){super(...arguments);this.type=i.LayerType.GROUP}fromJSON(t){return this.autoOrient=t.ao===1,this.blendMode=t.bm,this.effects=t.ef,this.height=t.h,this.id=t.ln,this.index=t.ind,this.inPoint=t.ip,this.is3D=t.ddd,this.name=t.nm,this.outPoint=t.op,this.parent=t.parent,this.startTime=t.st,this.timeStretch=t.sr,this.width=t.w,"cl"in t&&(this.classNames=t.cl.split(" ")),"tt"in t&&(this.matteMode=t.tt),"td"in t&&(this.matteTarget=t.td),"hd"in t&&(this.isHidden=t.hd),"mn"in t&&(this.matchName=t.mn),this.transform.fromJSON(t.ks),this}toJSON(){var t;return{ao:this.autoOrient?1:0,bm:this.blendMode,cl:this.classNames.length?this.classNames.join(" "):void 0,ddd:this.is3D?1:0,ef:this.effects,h:this.height,ind:this.index,ip:this.inPoint,ks:Ot({},this.transform.toJSON()),ln:this.id,nm:this.name,mn:this.matchName,op:this.outPoint,parent:(t=this.parent)==null?void 0:t.index,sr:this.timeStretch,st:this.startTime,ty:this.type,w:this.width,tt:this.matteMode,td:this.matteTarget,hd:this.isHidden!==void 0?Number(this.isHidden):void 0}}}var pt=Object.assign;class Z extends g{constructor(){super(...arguments);this.type=i.LayerType.IMAGE}fromJSON(t){return this.autoOrient=t.ao===1,this.blendMode=t.bm,this.effects=t.ef,this.height=t.h,this.id=t.ln,this.index=t.ind,this.inPoint=t.ip,this.is3D=t.ddd,this.name=t.nm,this.outPoint=t.op,this.parent=t.parent,this.startTime=t.st,this.timeStretch=t.sr,this.width=t.w,"cl"in t&&(this.classNames=t.cl.split(" ")),"tt"in t&&(this.matteMode=t.tt),"td"in t&&(this.matteTarget=t.td),"hd"in t&&(this.isHidden=t.hd),"mn"in t&&(this.matchName=t.mn),this.transform.fromJSON(t.ks),this.refId=t.refId,this}toJSON(){var t;return{ty:this.type,ao:this.autoOrient?1:0,bm:this.blendMode,cl:this.classNames.length?this.classNames.join(" "):void 0,ddd:this.is3D?1:0,ef:this.effects,h:this.height,ind:this.index,ip:this.inPoint,ks:pt({},this.transform.toJSON()),ln:this.id,nm:this.name,mn:this.matchName,op:this.outPoint,parent:(t=this.parent)==null?void 0:t.index,sr:this.timeStretch,st:this.startTime,w:this.width,tt:this.matteMode,td:this.matteTarget,hd:this.isHidden!==void 0?Number(this.isHidden):void 0,refId:this.refId}}}var Nt=Object.assign;class Q extends g{constructor(){super(...arguments);this.type=i.LayerType.PRECOMPOSITION}fromJSON(t){return this.autoOrient=t.ao===1,this.blendMode=t.bm,this.effects=t.ef,this.height=t.h,this.id=t.ln,this.index=t.ind,this.inPoint=t.ip,this.is3D=t.ddd,this.name=t.nm,this.outPoint=t.op,this.parent=t.parent,this.startTime=t.st,this.timeStretch=t.sr,this.width=t.w,"cl"in t&&(this.classNames=t.cl.split(" ")),"tt"in t&&(this.matteMode=t.tt),"td"in t&&(this.matteTarget=t.td),"hd"in t&&(this.isHidden=t.hd),"mn"in t&&(this.matchName=t.mn),this.transform.fromJSON(t.ks),this.refId=t.refId,this}toJSON(){var t;return{ao:this.autoOrient?1:0,bm:this.blendMode,cl:this.classNames.length?this.classNames.join(" "):void 0,ddd:this.is3D?1:0,ef:this.effects,h:this.height,ind:this.index,ip:this.inPoint,ks:Nt({},this.transform.toJSON()),ln:this.id,nm:this.name,mn:this.matchName,op:this.outPoint,parent:(t=this.parent)==null?void 0:t.index,refId:this.refId,sr:this.timeStretch,st:this.startTime,ty:this.type,w:this.width,tt:this.matteMode,td:this.matteTarget,hd:this.isHidden!==void 0?Number(this.isHidden):void 0}}}class x{constructor(t=0,s=[]){this.offset=t,this.color=s}get hasAlpha(){return this.color.length>3}get red(){return this.color[0]}get green(){return this.color[1]}get blue(){return this.color[2]}get alpha(){return this.color[3]}}class St extends n{constructor(){super(...arguments);this.colorCount=0}keyframeValue(t){return t>=this.values.length?[]:this.values[t].value}keyframeHasAlpha(t){return this.keyframeValue(t).length==this.colorCount*6}keframeStops(t){const s=this.keyframeValue(t),r=[],a=this.keyframeHasAlpha(t);for(let l=0;l<this.colorCount;l++){const d=s.slice(l,3);a&&d.push(s[this.colorCount*4+l*2]),r.push(new x(s[l*4],d))}return r}setKeyframeStops(t,s){if(t>=this.values.length)return;s.length>this.colorCount&&(this.colorCount=s.length),this.values[t].value=this.stopsToArray(s)}addKeyframe(t,s){const r=new p(t,this.stopsToArray(s));return s.length>this.colorCount&&(this.colorCount=s.length),this.values.push(r),r}stopsToArray(t){let s=!1;const r=[];for(const a of t)r.push(a.offset),r.push(a.red),r.push(a.green),r.push(a.blue),a.hasAlpha&&(s=!0);if(s)for(const a of t)r.push(a.offset),r.push(a.alpha!==void 0?a.alpha:1);return r}}class C{constructor(){this.gradientColors=new St(this,i.PropertyType.COLOR)}get colorCount(){return this.gradientColors.colorCount}set colorCount(t){this.gradientColors.colorCount=t}toJSON(){return{p:this.colorCount,k:this.gradientColors}}fromJSON(t){return this.gradientColors.fromJSON(t.k),this.colorCount=t.p,this}}class y{constructor(t){this.isHidden=!1,this.parent=t}}class M extends y{constructor(){super(...arguments);this.type=i.ShapeType.ELLIPSE,this.position=new n(this,i.PropertyType.POSITION),this.size=new n(this,i.PropertyType.SIZE),this.direction=1}fromJSON(t){return this.classNames=t.cl,this.id=t.ln,this.isHidden=t.hd,this.matchName=t.mn,this.name=t.nm,this.position.fromJSON(t.p),this.size.fromJSON(t.s),this.direction=t.d,this}toJSON(){return{ty:this.type,cl:this.classNames,hd:this.isHidden,ln:this.id,mn:this.matchName,nm:this.name,p:this.position,s:this.size,d:this.direction}}}class _ extends y{constructor(){super(...arguments);this.type=i.ShapeType.FILL,this.blendMode=i.BlendMode.NORMAL,this.color=new n(this,i.PropertyType.COLOR),this.fillRule=i.FillRuleType.EVEN_ODD,this.opacity=new n(this,i.PropertyType.OPACITY,[new p(0,100)])}fromJSON(t){return this.classNames=t.cl,this.id=t.ln,this.isHidden=t.hd,this.matchName=t.mn,this.name=t.nm,this.blendMode=t.bm,this.color.fromJSON(t.c),this.fillRule=t.r in i.FillRuleType?t.r:i.FillRuleType.EVEN_ODD,this.opacity.fromJSON(t.o),this}toJSON(){return{ty:this.type,cl:this.classNames,hd:this.isHidden,ln:this.id,mn:this.matchName,nm:this.name,bm:this.blendMode,c:this.color,r:this.fillRule,o:this.opacity}}}class U extends y{constructor(){super(...arguments);this.type=i.ShapeType.GRADIENT_FILL,this.blendMode=i.BlendMode.NORMAL,this.endPoint=new n(this,i.PropertyType.POSITION),this.gradientColors=new C,this.gradientType=i.GradientFillType.LINEAR,this.highlightAngle=new n(this,i.PropertyType.NUMBER),this.highlightLength=new n(this,i.PropertyType.NUMBER),this.opacity=new n(this,i.PropertyType.OPACITY),this.startPoint=new n(this,i.PropertyType.POSITION),this.fillRule=i.FillRuleType.EVEN_ODD}fromJSON(t){return this.classNames=t.cl,this.id=t.ln,this.isHidden=t.hd,this.matchName=t.mn,this.name=t.nm,this.blendMode=t.bm,this.endPoint.fromJSON(t.e),this.gradientColors.fromJSON(t.g),this.gradientType=t.t,this.opacity.fromJSON(t.o),this.startPoint.fromJSON(t.s),this.fillRule=t.r,this.gradientType===i.GradientFillType.LINEAR&&(this.highlightAngle.fromJSON(t.a),this.highlightLength.fromJSON(t.h)),this}toJSON(){return{ty:this.type,cl:this.classNames,hd:this.isHidden,ln:this.id,mn:this.matchName,nm:this.name,bm:this.blendMode,e:this.endPoint,g:this.gradientColors,t:this.gradientType,a:this.highlightAngle,h:this.highlightLength,o:this.opacity,r:this.fillRule,s:this.startPoint}}}class j extends y{constructor(){super(...arguments);this.type=i.ShapeType.MERGE,this.mergeMode=1}fromJSON(t){return this.classNames=t.cl,this.id=t.ln,this.isHidden=t.hd,this.matchName=t.mn,this.name=t.nm,this.mergeMode=t.mm,this}toJSON(){return{ty:this.type,cl:this.classNames,hd:this.isHidden,ln:this.id,mn:this.matchName,nm:this.name,mm:this.mergeMode}}}class H extends y{constructor(){super(...arguments);this.type=i.ShapeType.PATH,this.vertices=new n(this,i.PropertyType.SHAPE)}fromJSON(t){return this.classNames=t.cl,this.id=t.ln,this.isHidden=t.hd,this.matchName=t.mn,this.name=t.nm,this.itemIndex=t.ind,this.shapeIndex=t.ix,this.direction=t.d,this.vertices=t.ks,this}toJSON(){return{ty:this.type,cl:this.classNames,hd:this.isHidden,ln:this.id,mn:this.matchName,nm:this.name,ind:this.itemIndex,ix:this.shapeIndex,d:this.direction,ks:this.vertices}}}class k extends y{constructor(){super(...arguments);this.type=i.ShapeType.RECTANGLE,this.position=new n(this,i.PropertyType.POSITION),this.roundness=new n(this,i.PropertyType.ROUNDNESS),this.size=new n(this,i.PropertyType.SIZE)}fromJSON(t){return this.classNames=t.cl,this.id=t.ln,this.isHidden=t.hd,this.matchName=t.mn,this.name=t.nm,this.direction=t.d,this.position.fromJSON(t.p),this.roundness.fromJSON(t.r),this.size.fromJSON(t.s),this}toJSON(){return{ty:this.type,cl:this.classNames,hd:this.isHidden,ln:this.id,mn:this.matchName,nm:this.name,d:this.direction,p:this.position,r:this.roundness,s:this.size}}}class tt extends y{constructor(){super(...arguments);this.type=i.ShapeType.STAR,this.position=new n(this,i.PropertyType.POSITION),this.innerRadius=new n(this,i.PropertyType.NUMBER),this.innerRoundness=new n(this,i.PropertyType.NUMBER),this.outerRadius=new n(this,i.PropertyType.NUMBER),this.outerRoundness=new n(this,i.PropertyType.NUMBER),this.rotation=new n(this,i.PropertyType.ROTATION),this.points=new n(this,i.PropertyType.NUMBER),this.starType=i.StarType.STAR}fromJSON(t){return this.classNames=t.cl,this.id=t.ln,this.isHidden=t.hd,this.matchName=t.mn,this.name=t.nm,this.position.fromJSON(t.p),this.innerRadius.fromJSON(t.ir),this.innerRoundness.fromJSON(t.is),this.outerRadius.fromJSON(t.or),this.outerRoundness.fromJSON(t.os),this.rotation.fromJSON(t.r),this.points.fromJSON(t.pt),this.starType=t.sy,this.direction=t.d,this}toJSON(){return{ty:this.type,cl:this.classNames,hd:this.isHidden,ln:this.id,mn:this.matchName,nm:this.name,p:this.position,ir:this.innerRadius,is:this.innerRoundness,or:this.outerRadius,os:this.outerRoundness,r:this.rotation,pt:this.points,sy:this.starType,d:this.direction}}}class G extends y{constructor(){super(...arguments);this.type=i.ShapeType.STROKE,this.blendMode=i.BlendMode.NORMAL,this.color=new n(this,i.PropertyType.COLOR),this.lineCapType=i.LineCapType.ROUND,this.lineJoinType=i.LineJoinType.ROUND,this.opacity=new n(this,i.PropertyType.OPACITY,[new p(0,100)]),this.width=new n(this,i.PropertyType.STROKE_WIDTH)}fromJSON(t){return this.classNames=t.cl,this.id=t.ln,this.isHidden=t.hd,this.matchName=t.mn,this.name=t.nm,this.blendMode=t.bm in i.BlendMode?t.bm:i.BlendMode.NORMAL,this.color.fromJSON(t.c),this.lineCapType=t.lc in i.LineCapType?t.lc:i.LineCapType.ROUND,this.lineJoinType=t.lj in i.LineJoinType?t.lj:i.LineJoinType.ROUND,this.miterLimit=t.ml,this.opacity.fromJSON(t.o),this.width.fromJSON(t.w),this}toJSON(){return{ty:this.type,cl:this.classNames,hd:this.isHidden,ln:this.id,mn:this.matchName,nm:this.name,bm:this.blendMode,c:this.color,lc:this.lineCapType,lj:this.lineJoinType,ml:this.miterLimit,o:this.opacity,w:this.width}}}class B extends y{constructor(){super(...arguments);this.type=i.ShapeType.TRIM,this.blendMode=i.BlendMode.NORMAL,this.trimEnd=new n(this,i.PropertyType.NUMBER),this.trimOffset=new n(this,i.PropertyType.NUMBER),this.trimStart=new n(this,i.PropertyType.NUMBER),this.trimMultipleShapes=i.TrimMode.SIMULTANEOUSLY}fromJSON(t){return this.classNames=t.cl,this.id=t.ln,this.isHidden=t.hd,this.matchName=t.mn,this.name=t.nm,this.blendMode=t.bm in i.BlendMode?t.bm:i.BlendMode.NORMAL,this.trimEnd.fromJSON(t.e),this.trimOffset.fromJSON(t.o),this.trimStart.fromJSON(t.s),this.trimMultipleShapes=t.m in i.TrimMode?t.m:i.TrimMode.INDIVIDUALLY,this}toJSON(){return{ty:this.type,cl:this.classNames,hd:this.isHidden,ln:this.id,mn:this.matchName,nm:this.name,bm:this.blendMode,e:this.trimEnd,o:this.trimOffset,s:this.trimStart,m:this.trimMultipleShapes}}}var Tt=Object.assign;class F extends y{constructor(){super(...arguments);this.type=i.ShapeType.GROUP,this.blendMode=i.BlendMode.NORMAL,this.isHidden=!1,this.numProperties=0,this.transform=new D,this.shapes=[]}fromJSON(t){return this.classNames=t.cl,this.id=t.ln,this.isHidden=t.hd,this.matchName=t.mn,this.name=t.nm,this.blendMode=t.bm,this.contentPropertyIndex=t.cix,this.propertyIndex=t.ix,this.numProperties=t.np,this.shapes=t.it.map(s=>{try{if(s.ty!=="tr"){const r=this.createShape(s.ty);return r.fromJSON(s)}this.transform.fromJSON(s)}catch(r){}return!1}).filter(Boolean),this}createShape(t){if(t===i.ShapeType.PATH)return new H(this);if(t===i.ShapeType.GROUP)return new F(this);if(t===i.ShapeType.FILL)return new _(this);if(t===i.ShapeType.RECTANGLE)return new k(this);if(t===i.ShapeType.ELLIPSE)return new M(this);if(t===i.ShapeType.STROKE)return new G(this);if(t===i.ShapeType.GRADIENT_FILL)return new U(this);if(t===i.ShapeType.TRIM)return new B(this);if(t===i.ShapeType.MERGE)return new j(this);if(t===i.ShapeType.STAR)return new tt(this);throw new Error(`Invalid or unknown shape type: ${t}`)}addShape(t){return t instanceof y||(t=this.createShape(t)),this.shapes.push(t),t}toJSON(){const t=JSON.parse(JSON.stringify(this.shapes));return t.push(Tt({ty:"tr",nm:"Transform"},this.transform.toJSON())),{ty:this.type,cl:this.classNames,hd:this.isHidden,ln:this.id,mn:this.matchName,nm:this.name,bm:this.blendMode,cix:this.contentPropertyIndex,it:t,ix:this.propertyIndex,np:this.numProperties}}}class Et extends y{constructor(){super(...arguments);this.type=i.ShapeType.GRADIENT_STROKE,this.blendMode=i.BlendMode.NORMAL,this.endPoint=new n(this,i.PropertyType.POSITION),this.gradientColors=new C,this.gradientType=i.GradientFillType.LINEAR,this.highlightAngle=new n(this,i.PropertyType.NUMBER),this.highlightLength=new n(this,i.PropertyType.NUMBER),this.opacity=new n(this,i.PropertyType.OPACITY),this.startPoint=new n(this,i.PropertyType.POSITION),this.lineCapType=i.LineCapType.ROUND,this.lineJoinType=i.LineJoinType.ROUND,this.width=new n(this,i.PropertyType.STROKE_WIDTH)}fromJSON(t){return this.classNames=t.cl,this.id=t.ln,this.isHidden=t.hd,this.matchName=t.mn,this.name=t.nm,this.blendMode=t.bm,this.opacity.fromJSON(t.o),this.endPoint.fromJSON(t.e),this.gradientColors.fromJSON(t.g),this.gradientType=t.t,this.startPoint.fromJSON(t.s),this.gradientType===i.GradientFillType.LINEAR&&(this.highlightAngle.fromJSON(t.a),this.highlightLength.fromJSON(t.h)),this.lineCapType=t.lc in i.LineCapType?t.lc:i.LineCapType.ROUND,this.lineJoinType=t.lj in i.LineJoinType?t.lj:i.LineJoinType.ROUND,this.miterLimit=t.ml,this.width.fromJSON(t.w),this}toJSON(){return{ty:this.type,cl:this.classNames,hd:this.isHidden,ln:this.id,mn:this.matchName,nm:this.name,bm:this.blendMode,o:this.opacity,e:this.endPoint,g:this.gradientColors,t:this.gradientType,a:this.highlightAngle,h:this.highlightLength,s:this.startPoint,lc:this.lineCapType,lj:this.lineJoinType,ml:this.miterLimit,w:this.width}}}class gt extends y{constructor(){super(...arguments);this.type=i.ShapeType.REPEATER,this.anchor=new n(this,i.PropertyType.ANCHOR),this.startOpacity=new n(this,i.PropertyType.OPACITY),this.endOpacity=new n(this,i.PropertyType.OPACITY),this.position=new n(this,i.PropertyType.POSITION),this.rotation=new n(this,i.PropertyType.ROTATION),this.scale=new n(this,i.PropertyType.SCALE),this.shapes=[],this.skew=new n(this,i.PropertyType.SKEW),this.skewAxis=new n(this,i.PropertyType.SKEW_AXIS),this.copies=new n(this,i.PropertyType.NUMBER),this.offset=new n(this,i.PropertyType.NUMBER),this.composition=i.RepeaterComposite.ABOVE}fromJSON(t){return this.classNames=t.cl,this.id=t.ln,this.isHidden=t.hd,this.matchName=t.mn,this.name=t.nm,this.copies.fromJSON(t.c),this.composition=t.m,this.offset.fromJSON(t.o),this.anchor.fromJSON(t.tr.a),this.startOpacity.fromJSON(t.tr.so),this.endOpacity.fromJSON(t.tr.eo),this.position.fromJSON(t.tr.p),this.rotation.fromJSON(t.tr.r),this.scale.fromJSON(t.tr.s),t.tr.sk&&this.skew.fromJSON(t.tr.sk),t.tr.sa&&this.skewAxis.fromJSON(t.tr.sa),this}toJSON(){return{ty:this.type,cl:this.classNames,hd:this.isHidden,ln:this.id,mn:this.matchName,nm:this.name,m:this.composition,c:this.copies,o:this.offset,tr:{a:this.anchor,so:this.startOpacity,eo:this.endOpacity,p:this.position,r:this.rotation,s:this.scale,sk:this.skew,sa:this.skewAxis}}}}class wt extends y{constructor(){super(...arguments);this.type=i.ShapeType.ROUNDED_CORNERS,this.roundness=new n(this,i.PropertyType.NUMBER)}fromJSON(t){return this.classNames=t.cl,this.id=t.ln,this.isHidden=t.hd,this.matchName=t.mn,this.name=t.nm,this.roundness.fromJSON(t.r),this}toJSON(){return{ty:this.type,cl:this.classNames,hd:this.isHidden,ln:this.id,mn:this.matchName,nm:this.name,r:this.roundness}}}var Rt=Object.assign;class it extends g{constructor(){super(...arguments);this.type=i.LayerType.SHAPE,this.shapes=[]}createShape(t){if(t===i.ShapeType.PATH)return new H(this);if(t===i.ShapeType.GROUP)return new F(this);if(t===i.ShapeType.FILL)return new _(this);if(t===i.ShapeType.RECTANGLE)return new k(this);if(t===i.ShapeType.ELLIPSE)return new M(this);if(t===i.ShapeType.STROKE)return new G(this);if(t===i.ShapeType.GRADIENT_FILL)return new U(this);if(t===i.ShapeType.TRIM)return new B(this);if(t===i.ShapeType.MERGE)return new j(this);throw new Error(`Invalid or unknown shape type: ${t}`)}addShape(t){return t instanceof y||(t=this.createShape(t)),this.shapes.push(t),t}createShapeFromJSON(t){try{const s=this.createShape(t.ty);return s.fromJSON(t)}catch(s){throw new Error(`Unable to create shape from JSON: ${t.ty}`)}}fromJSON(t){return this.autoOrient=t.ao===1,this.blendMode=t.bm,this.effects=t.ef,this.height=t.h,this.id=t.ln,this.index=t.ind,this.inPoint=t.ip,this.is3D=t.ddd,this.name=t.nm,this.outPoint=t.op,this.parent=t.parent,this.startTime=t.st,this.timeStretch=t.sr,this.width=t.w,this.classNames="cl"in t?t.cl.split(" "):[],this.transform.fromJSON(t.ks),"tt"in t&&(this.matteMode=t.tt),"td"in t&&(this.matteTarget=t.td),"hd"in t&&(this.isHidden=t.hd),"mn"in t&&(this.matchName=t.mn),this.shapes=t.shapes.map(s=>this.createShapeFromJSON(s)).filter(Boolean),this}toJSON(){var t;return{ao:this.autoOrient?1:0,bm:this.blendMode,cl:this.classNames.length?this.classNames.join(" "):void 0,ddd:this.is3D?1:0,ef:this.effects,h:this.height,ind:this.index,ip:this.inPoint,ks:Rt({},this.transform.toJSON()),shapes:this.shapes.map(s=>s.toJSON()),ln:this.id,nm:this.name,mn:this.matchName,op:this.outPoint,parent:(t=this.parent)==null?void 0:t.index,sr:this.timeStretch,st:this.startTime,ty:this.type,w:this.width,tt:this.matteMode,td:this.matteTarget,hd:this.isHidden!==void 0?Number(this.isHidden):void 0}}}var At=Object.assign;class et extends g{constructor(){super(...arguments);this.type=i.LayerType.SOLID,this.solidColor="#000000",this.solidHeight=1,this.solidWidth=1}fromJSON(t){return this.autoOrient=t.ao===1,this.blendMode=t.bm,this.effects=t.ef,this.height=t.h,this.id=t.ln,this.index=t.ind,this.inPoint=t.ip,this.is3D=t.ddd,this.name=t.nm,this.outPoint=t.op,this.parent=t.parent,this.startTime=t.st,this.timeStretch=t.sr,this.width=t.w,"cl"in t&&(this.classNames=t.cl.split(" ")),"tt"in t&&(this.matteMode=t.tt),"td"in t&&(this.matteTarget=t.td),"hd"in t&&(this.isHidden=t.hd),"mn"in t&&(this.matchName=t.mn),this.transform.fromJSON(t.ks),this.solidColor=t.sc,this.solidHeight=t.sh,this.solidWidth=t.sw,this}toJSON(){var t;return{ao:this.autoOrient?1:0,bm:this.blendMode,cl:this.classNames.length?this.classNames.join(" "):void 0,ddd:this.is3D?1:0,ef:this.effects,h:this.height,ind:this.index,ip:this.inPoint,ks:At({},this.transform.toJSON()),ln:this.id,nm:this.name,mn:this.matchName,op:this.outPoint,parent:(t=this.parent)==null?void 0:t.index,sc:this.solidColor,sh:this.solidHeight,sw:this.solidWidth,sr:this.timeStretch,st:this.startTime,ty:this.type,w:this.width,tt:this.matteMode,td:this.matteTarget,hd:this.isHidden!==void 0?Number(this.isHidden):void 0}}}var It=Object.assign;class st extends g{constructor(){super(...arguments);this.type=i.LayerType.TEXT}fromJSON(t){return this.autoOrient=t.ao===1,this.blendMode=t.bm,this.effects=t.ef,this.height=t.h,this.id=t.ln,this.index=t.ind,this.inPoint=t.ip,this.is3D=t.ddd,this.name=t.nm,this.outPoint=t.op,this.parent=t.parent,this.startTime=t.st,this.timeStretch=t.sr,this.width=t.w,"cl"in t&&(this.classNames=t.cl.split(" ")),"tt"in t&&(this.matteMode=t.tt),"td"in t&&(this.matteTarget=t.td),"hd"in t&&(this.isHidden=t.hd),"mn"in t&&(this.matchName=t.mn),this.transform.fromJSON(t.ks),this.textData=t.t,this}toJSON(){var t;return{ty:this.type,ao:this.autoOrient?1:0,bm:this.blendMode,cl:this.classNames.length?this.classNames.join(" "):void 0,ddd:this.is3D?1:0,ef:this.effects,h:this.height,ind:this.index,ip:this.inPoint,ks:It({},this.transform.toJSON()),ln:this.id,nm:this.name,mn:this.matchName,op:this.outPoint,parent:(t=this.parent)==null?void 0:t.index,sr:this.timeStretch,st:this.startTime,w:this.width,tt:this.matteMode,td:this.matteTarget,hd:this.isHidden!==void 0?Number(this.isHidden):void 0,t:this.textData}}}class rt{constructor(){this.comment="",this.duration=0,this.time=0}fromJSON(t){return this.comment=t.cm,this.duration=t.dr,this.time=t.tm,this}toJSON(){return{cm:this.comment,dr:this.duration,tm:this.time}}}function ht(t){let s=(+t[0]).toString(16),r=(+t[1]).toString(16),a=(+t[2]).toString(16),l=Math.round(+t[3]*255).toString(16);return s.length==1&&(s="0"+s),r.length==1&&(r="0"+r),a.length==1&&(a="0"+a),l.length==1&&(l="0"+l),"#"+s+r+a+l}function Pt(t,s){const r=parseInt(t.slice(1,3),16),a=parseInt(t.slice(3,5),16),l=parseInt(t.slice(5,7),16);return s?[r/255,a/255,l/255,s]:[r/255,a/255,l/255]}class nt{constructor(t){this.keywords=[],this.generator="@lottiefiles/lottie-js 0.3.1",this.parent=t}fromJSON(t){return this.author=t.a,this.keywords="k"in t?t.k.split(",").map(s=>s.trim()):[t.k],this.generator=t.g,this.description=t.d,this.themeColor=t.tc,this}toJSON(){return{a:this.author,k:this.keywords.length?this.keywords:void 0,g:this.generator,d:this.description,tc:this.themeColor}}}var bt=(t,s,r)=>new Promise((a,l)=>{var d=T=>{try{N(r.next(T))}catch(I){l(I)}},u=T=>{try{N(r.throw(T))}catch(I){l(I)}},N=T=>T.done?a(T.value):Promise.resolve(T.value).then(d,u);N((r=r.apply(t,s)).next())});class V{constructor(){this.assets=[],this.frameRate=60,this.height=0,this.inPoint=0,this.is3D=!1,this.layers=[],this.markers=[],this.meta=new nt(this),this.name="",this.outPoint=0,this.version="",this.width=0}static fromURL(t){return bt(this,null,function*(){if(typeof t!="string")throw new Error("The url value must be a string");let s;try{const a=new URL(t),l=yield ft(a.toString());s=yield l.json()}catch(a){throw new Error("An error occurred while trying to load the Lottie file from URL")}const r=new V;return r.fromJSON(s)})}static isLottie(t){const s=["v","ip","op","layers","fr","w","h"];return s.every(r=>Object.prototype.hasOwnProperty.call(t,r))}get colors(){const t=new Set;return[...R().keys()].filter(s=>s.type===i.PropertyType.COLOR).forEach(s=>{s.values.forEach(r=>{t.add(JSON.stringify(r.value))})}),Array.from(t).map(s=>J.fromJSON(JSON.parse(s)))}get colorsVerbose(){const t={};return[...R().keys()].filter(s=>s.type===i.PropertyType.COLOR).forEach((s,r)=>{const a=s.getParent(),l=this.parentPath(a),d=l.slice();s.values.forEach(u=>{d.unshift("Frame "+u.frame),d.unshift(r.toString());const N=u.value;t[d.join(".")]=ht([Math.round(N[0]*255),Math.round(N[1]*255),Math.round(N[2]*255),N[3]])})}),t}get textLayers(){const t={},s=this.getLayersByType(i.LayerType.TEXT);return s.forEach((r,a)=>{t[a+"."+r.name]=r.textData.d.k[0].s.t}),t}parentPath(t,s=[]){return t.parent===void 0?(s.push(t.name),s):(s.push(t.name),this.parentPath(t.parent,s))}get duration(){return this.totalFrames/this.frameRate}get fileSize(){return new TextEncoder().encode(JSON.stringify(this)).length}get totalFrames(){return this.outPoint-this.inPoint}createAsset(t){if(t===i.AssetType.PRECOMPOSITION)return new q(this);if(t===i.AssetType.IMAGE)return new W(this);throw new Error(`Invalid or unknown asset type ${t}`)}createAssetFromJSON(t){try{const s=this.createAsset("layers"in t?i.AssetType.PRECOMPOSITION:i.AssetType.IMAGE);return s.fromJSON(t)}catch(s){throw new Error("Unable to create asset from JSON")}}createLayer(t){if(t===i.LayerType.PRECOMPOSITION)return new Q(this);if(t===i.LayerType.SHAPE)return new it(this);if(t===i.LayerType.GROUP)return new $(this);if(t===i.LayerType.SOLID)return new et(this);if(t===i.LayerType.IMAGE)return new Z(this);if(t===i.LayerType.TEXT)return new st(this);throw new Error(`Invalid or unknown layer type: ${t}`)}createLayerFromJSON(t){try{const s=this.createLayer(t.ty);return s.fromJSON(t)}catch(s){throw console.log(s),new Error(`Unable to create layer type from JSON: ${t.ty}`)}}createLayersFromJSONArray(t){const s=new Map,r=[],a=[];return t.forEach(l=>{const d=this.createLayerFromJSON(l);d&&(l.parent!==void 0&&r.push([d,l.parent]),d.index!==void 0&&s.set(d.index,d),a.push(d))}),r.forEach(([l,d])=>{l.parent=s.get(d)}),a}createMarker(){return new rt}createMarkerFromJSON(t){try{const s=this.createMarker();return s.fromJSON(t)}catch(s){throw console.log(s),new Error("Unable to create marker from JSON")}}fromJSON(t){if(V.isLottie(t)===!1)throw new Error("The given object is not a valid Lottie JSON structure");return this.frameRate=t.fr,this.height=t.h,this.inPoint=t.ip,this.is3D=t.ddd,this.name=t.nm,this.outPoint=t.op,this.version=t.v,this.width=t.w,this.assets=t.assets.map(s=>this.createAssetFromJSON(s)).filter(Boolean),this.layers=this.createLayersFromJSONArray(t.layers),this.markers=t.markers.map(s=>this.createMarkerFromJSON(s)).filter(Boolean),"meta"in t&&this.meta.fromJSON(t.meta),this}getLayerById(t){if(typeof t!="string")throw new Error("ID value must be a string");return this.layers.find(s=>s.id===t)}getLayersByClassName(t){if(typeof t!="string")throw new Error("Class name value must be a string");return this.layers.filter(s=>s.classNames.includes(t))}getLayersByType(t){if(t in i.LayerType===!1)throw new Error("Type value must be a valid LayerType value");return this.layers.filter(s=>s.type===t)}toJSON(t){return t?void 0:{assets:this.assets,ddd:this.is3D?1:0,fr:this.frameRate,h:this.height,ip:this.inPoint,layers:this.layers.map(s=>s.toJSON()),markers:this.markers.map(s=>s.toJSON()),meta:this.meta,nm:this.name,op:this.outPoint,v:this.version||"5.6.0",w:this.width}}}class Jt{constructor(){this.isInverted=!1,this.name="",this.mode=i.MaskMode.Add}fromJSON(t){return this.isInverted=t.inv,this.mode=t.mode,this.name=t.nm,this.points=t.pt,this.opacity=t.o,this}toJSON(){return{inv:this.isInverted,mode:this.mode,nm:this.name,o:this.opacity,pt:this.points}}}i.Animation=V,i.Asset=E,i.Color=J,i.ColorRgb=A,i.ColorRgba=v,i.EllipseShape=M,i.FillShape=_,i.Gradient=C,i.GradientFillShape=U,i.GradientStop=x,i.GradientStrokeShape=Et,i.GroupLayer=$,i.GroupShape=F,i.ImageAsset=W,i.ImageLayer=Z,i.KeyFrame=p,i.Layer=g,i.Marker=rt,i.Mask=Jt,i.Meta=nt,i.PathShape=H,i.PrecompositionAsset=q,i.PrecompositionLayer=Q,i.Property=n,i.RectangleShape=k,i.RepeaterShape=gt,i.RoundedCornersShape=wt,i.Shape=y,i.ShapeLayer=it,i.SolidLayer=et,i.StarShape=tt,i.StrokeShape=G,i.TextLayer=st,i.Transform=D,i.TrimShape=B,i.hexToRgba=Pt,i.rgbaToHex=ht,i.useRegistry=R,Object.defineProperty(i,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "@lottiefiles/lottie-js", | ||
"version": "0.2.4", | ||
"version": "0.3.1", | ||
"description": "Lottie JSON model for Javascript/Typescript", | ||
@@ -10,3 +10,3 @@ "main": "dist/index.cjs.js", | ||
"repository": "https://github.com/LottieFiles/lottie-js", | ||
"license": "UNLICENSED", | ||
"license": "MIT", | ||
"keywords": [ | ||
@@ -13,0 +13,0 @@ "Lottie", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Explicitly Unlicensed Item
License(Experimental) Something was found which is explicitly marked as unlicensed
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license
Found 1 instance in 1 package
0
0
100
4489
702564