welcome-ui
Version:
Customizable design system with react, typescript, tailwindcss and ariakit.
1,010 lines (1,009 loc) • 301 kB
JavaScript
"use client";
import { jsx as As } from "react/jsx-runtime";
import { a as br, c as Ps } from "./index-PAaZGbyz.js";
import ws, { forwardRef as Cs } from "react";
var Ke = { exports: {} }, Es = Ke.exports, _r;
function Ms() {
return _r || (_r = 1, function(Fi, ci) {
"use client";
(function(ae, Vt) {
Vt(ci, ws);
})(Es, function(ae, Vt) {
function vi(j) {
return j && typeof j == "object" && "default" in j ? j : { default: j };
}
var kr = /* @__PURE__ */ vi(Vt), Sr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof br < "u" ? br : typeof self < "u" ? self : {}, mi = { exports: {} };
(function(j, O) {
typeof navigator < "u" && function(G, D) {
j.exports = D();
}(Sr, function() {
var G = "http://www.w3.org/2000/svg", D = "", Q = !1, rt = -999999, tt = function(e) {
Q = !!e;
}, Pt = function() {
return Q;
}, at = function(e) {
D = e;
}, ht = function() {
return D;
};
function lt(t) {
return document.createElement(t);
}
function Z(t, e) {
var i, r = t.length, n;
for (i = 0; i < r; i += 1) {
n = t[i].prototype;
for (var s in n)
Object.prototype.hasOwnProperty.call(n, s) && (e.prototype[s] = n[s]);
}
}
function zt(t) {
function e() {
}
return e.prototype = t, e;
}
var Rt = function() {
function t(e) {
this.audios = [], this.audioFactory = e, this._volume = 1, this._isMuted = !1;
}
return t.prototype = {
addAudio: function(i) {
this.audios.push(i);
},
pause: function() {
var i, r = this.audios.length;
for (i = 0; i < r; i += 1)
this.audios[i].pause();
},
resume: function() {
var i, r = this.audios.length;
for (i = 0; i < r; i += 1)
this.audios[i].resume();
},
setRate: function(i) {
var r, n = this.audios.length;
for (r = 0; r < n; r += 1)
this.audios[r].setRate(i);
},
createAudio: function(i) {
return this.audioFactory ? this.audioFactory(i) : window.Howl ? new window.Howl({
src: [i]
}) : {
isPlaying: !1,
play: function() {
this.isPlaying = !0;
},
seek: function() {
this.isPlaying = !1;
},
playing: function() {
},
rate: function() {
},
setVolume: function() {
}
};
},
setAudioFactory: function(i) {
this.audioFactory = i;
},
setVolume: function(i) {
this._volume = i, this._updateVolume();
},
mute: function() {
this._isMuted = !0, this._updateVolume();
},
unmute: function() {
this._isMuted = !1, this._updateVolume();
},
getVolume: function() {
return this._volume;
},
_updateVolume: function() {
var i, r = this.audios.length;
for (i = 0; i < r; i += 1)
this.audios[i].volume(this._volume * (this._isMuted ? 0 : 1));
}
}, function() {
return new t();
};
}(), H = /* @__PURE__ */ function() {
function t(i, r) {
var n = 0, s = [], h;
switch (i) {
case "int16":
case "uint8c":
h = 1;
break;
default:
h = 1.1;
break;
}
for (n = 0; n < r; n += 1)
s.push(h);
return s;
}
function e(i, r) {
return i === "float32" ? new Float32Array(r) : i === "int16" ? new Int16Array(r) : i === "uint8c" ? new Uint8ClampedArray(r) : t(i, r);
}
return typeof Uint8ClampedArray == "function" && typeof Float32Array == "function" ? e : t;
}();
function ot(t) {
return Array.apply(null, {
length: t
});
}
var _t = !0, yt = null, Ht = "", st = /^((?!chrome|android).)*safari/i.test(navigator.userAgent), xt = Math.pow, Jt = Math.sqrt, U = Math.floor, ut = Math.min, Ue = 150, dt = Math.PI / 180, Yt = 0.5519;
function Ee(t, e, i, r) {
this.type = t, this.currentTime = e, this.totalTime = i, this.direction = r < 0 ? -1 : 1;
}
function Je(t, e) {
this.type = t, this.direction = e < 0 ? -1 : 1;
}
function $e(t, e, i, r) {
this.type = t, this.currentLoop = i, this.totalLoops = e, this.direction = r < 0 ? -1 : 1;
}
function Qe(t, e, i) {
this.type = t, this.firstFrame = e, this.totalFrames = i;
}
function ti(t, e) {
this.type = t, this.target = e;
}
function gi(t, e) {
this.type = "renderFrameError", this.nativeError = t, this.currentTime = e;
}
function yi(t) {
this.type = "configError", this.nativeError = t;
}
var wt = /* @__PURE__ */ function() {
var t = 0;
return function() {
return t += 1, Ht + "__lottie_element_" + t;
};
}();
function Me(t, e, i) {
var r, n, s, h, b, p, k, P;
switch (h = Math.floor(t * 6), b = t * 6 - h, p = i * (1 - e), k = i * (1 - b * e), P = i * (1 - (1 - b) * e), h % 6) {
case 0:
r = i, n = P, s = p;
break;
case 1:
r = k, n = i, s = p;
break;
case 2:
r = p, n = i, s = P;
break;
case 3:
r = p, n = k, s = i;
break;
case 4:
r = P, n = p, s = i;
break;
case 5:
r = i, n = p, s = k;
break;
}
return [r, n, s];
}
function Te(t, e, i) {
var r = Math.max(t, e, i), n = Math.min(t, e, i), s = r - n, h, b = r === 0 ? 0 : s / r, p = r / 255;
switch (r) {
case n:
h = 0;
break;
case t:
h = e - i + s * (e < i ? 6 : 0), h /= 6 * s;
break;
case e:
h = i - t + s * 2, h /= 6 * s;
break;
case i:
h = t - e + s * 4, h /= 6 * s;
break;
}
return [h, b, p];
}
function mt(t, e) {
var i = Te(t[0] * 255, t[1] * 255, t[2] * 255);
return i[1] += e, i[1] > 1 ? i[1] = 1 : i[1] <= 0 && (i[1] = 0), Me(i[0], i[1], i[2]);
}
function $(t, e) {
var i = Te(t[0] * 255, t[1] * 255, t[2] * 255);
return i[2] += e, i[2] > 1 ? i[2] = 1 : i[2] < 0 && (i[2] = 0), Me(i[0], i[1], i[2]);
}
function et(t, e) {
var i = Te(t[0] * 255, t[1] * 255, t[2] * 255);
return i[0] += e / 360, i[0] > 1 ? i[0] -= 1 : i[0] < 0 && (i[0] += 1), Me(i[0], i[1], i[2]);
}
(function() {
var t = [], e, i;
for (e = 0; e < 256; e += 1)
i = e.toString(16), t[e] = i.length === 1 ? "0" + i : i;
return function(r, n, s) {
return r < 0 && (r = 0), n < 0 && (n = 0), s < 0 && (s = 0), "#" + t[r] + t[n] + t[s];
};
})();
var ft = function(e) {
_t = !!e;
}, $t = function() {
return _t;
}, Fe = function(e) {
yt = e;
}, bi = function() {
return yt;
}, ei = function(e) {
Ue = e;
}, ii = function() {
return Ue;
}, jr = function(e) {
Ht = e;
};
function Y(t) {
return document.createElementNS(G, t);
}
function ri(t) {
"@babel/helpers - typeof";
return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? ri = function(i) {
return typeof i;
} : ri = function(i) {
return i && typeof Symbol == "function" && i.constructor === Symbol && i !== Symbol.prototype ? "symbol" : typeof i;
}, ri(t);
}
var Ie = /* @__PURE__ */ function() {
var t = 1, e = [], i, r, n = {
onmessage: function() {
},
postMessage: function(A) {
i({
data: A
});
}
}, s = {
postMessage: function(A) {
n.onmessage({
data: A
});
}
};
function h(u) {
if (window.Worker && window.Blob && Pt()) {
var A = new Blob(["var _workerSelf = self; self.onmessage = ", u.toString()], {
type: "text/javascript"
}), w = URL.createObjectURL(A);
return new Worker(w);
}
return i = u, n;
}
function b() {
r || (r = h(function(A) {
function w() {
function x(F, S) {
var g, f, _ = F.length, I, E, z, J;
for (f = 0; f < _; f += 1)
if (g = F[f], "ks" in g && !g.completed) {
if (g.completed = !0, g.hasMask) {
var K = g.masksProperties;
for (E = K.length, I = 0; I < E; I += 1)
if (K[I].pt.k.i)
l(K[I].pt.k);
else
for (J = K[I].pt.k.length, z = 0; z < J; z += 1)
K[I].pt.k[z].s && l(K[I].pt.k[z].s[0]), K[I].pt.k[z].e && l(K[I].pt.k[z].e[0]);
}
g.ty === 0 ? (g.layers = o(g.refId, S), x(g.layers, S)) : g.ty === 4 ? a(g.shapes) : g.ty === 5 && N(g);
}
}
function c(F, S) {
if (F) {
var g = 0, f = F.length;
for (g = 0; g < f; g += 1)
F[g].t === 1 && (F[g].data.layers = o(F[g].data.refId, S), x(F[g].data.layers, S));
}
}
function d(F, S) {
for (var g = 0, f = S.length; g < f; ) {
if (S[g].id === F)
return S[g];
g += 1;
}
return null;
}
function o(F, S) {
var g = d(F, S);
return g ? g.layers.__used ? JSON.parse(JSON.stringify(g.layers)) : (g.layers.__used = !0, g.layers) : null;
}
function a(F) {
var S, g = F.length, f, _;
for (S = g - 1; S >= 0; S -= 1)
if (F[S].ty === "sh")
if (F[S].ks.k.i)
l(F[S].ks.k);
else
for (_ = F[S].ks.k.length, f = 0; f < _; f += 1)
F[S].ks.k[f].s && l(F[S].ks.k[f].s[0]), F[S].ks.k[f].e && l(F[S].ks.k[f].e[0]);
else F[S].ty === "gr" && a(F[S].it);
}
function l(F) {
var S, g = F.i.length;
for (S = 0; S < g; S += 1)
F.i[S][0] += F.v[S][0], F.i[S][1] += F.v[S][1], F.o[S][0] += F.v[S][0], F.o[S][1] += F.v[S][1];
}
function v(F, S) {
var g = S ? S.split(".") : [100, 100, 100];
return F[0] > g[0] ? !0 : g[0] > F[0] ? !1 : F[1] > g[1] ? !0 : g[1] > F[1] ? !1 : F[2] > g[2] ? !0 : g[2] > F[2] ? !1 : null;
}
var m = /* @__PURE__ */ function() {
var F = [4, 4, 14];
function S(f) {
var _ = f.t.d;
f.t.d = {
k: [{
s: _,
t: 0
}]
};
}
function g(f) {
var _, I = f.length;
for (_ = 0; _ < I; _ += 1)
f[_].ty === 5 && S(f[_]);
}
return function(f) {
if (v(F, f.v) && (g(f.layers), f.assets)) {
var _, I = f.assets.length;
for (_ = 0; _ < I; _ += 1)
f.assets[_].layers && g(f.assets[_].layers);
}
};
}(), y = /* @__PURE__ */ function() {
var F = [4, 7, 99];
return function(S) {
if (S.chars && !v(F, S.v)) {
var g, f = S.chars.length;
for (g = 0; g < f; g += 1) {
var _ = S.chars[g];
_.data && _.data.shapes && (a(_.data.shapes), _.data.ip = 0, _.data.op = 99999, _.data.st = 0, _.data.sr = 1, _.data.ks = {
p: {
k: [0, 0],
a: 0
},
s: {
k: [100, 100],
a: 0
},
a: {
k: [0, 0],
a: 0
},
r: {
k: 0,
a: 0
},
o: {
k: 100,
a: 0
}
}, S.chars[g].t || (_.data.shapes.push({
ty: "no"
}), _.data.shapes[0].it.push({
p: {
k: [0, 0],
a: 0
},
s: {
k: [100, 100],
a: 0
},
a: {
k: [0, 0],
a: 0
},
r: {
k: 0,
a: 0
},
o: {
k: 100,
a: 0
},
sk: {
k: 0,
a: 0
},
sa: {
k: 0,
a: 0
},
ty: "tr"
})));
}
}
};
}(), T = /* @__PURE__ */ function() {
var F = [5, 7, 15];
function S(f) {
var _ = f.t.p;
typeof _.a == "number" && (_.a = {
a: 0,
k: _.a
}), typeof _.p == "number" && (_.p = {
a: 0,
k: _.p
}), typeof _.r == "number" && (_.r = {
a: 0,
k: _.r
});
}
function g(f) {
var _, I = f.length;
for (_ = 0; _ < I; _ += 1)
f[_].ty === 5 && S(f[_]);
}
return function(f) {
if (v(F, f.v) && (g(f.layers), f.assets)) {
var _, I = f.assets.length;
for (_ = 0; _ < I; _ += 1)
f.assets[_].layers && g(f.assets[_].layers);
}
};
}(), R = /* @__PURE__ */ function() {
var F = [4, 1, 9];
function S(f) {
var _, I = f.length, E, z;
for (_ = 0; _ < I; _ += 1)
if (f[_].ty === "gr")
S(f[_].it);
else if (f[_].ty === "fl" || f[_].ty === "st")
if (f[_].c.k && f[_].c.k[0].i)
for (z = f[_].c.k.length, E = 0; E < z; E += 1)
f[_].c.k[E].s && (f[_].c.k[E].s[0] /= 255, f[_].c.k[E].s[1] /= 255, f[_].c.k[E].s[2] /= 255, f[_].c.k[E].s[3] /= 255), f[_].c.k[E].e && (f[_].c.k[E].e[0] /= 255, f[_].c.k[E].e[1] /= 255, f[_].c.k[E].e[2] /= 255, f[_].c.k[E].e[3] /= 255);
else
f[_].c.k[0] /= 255, f[_].c.k[1] /= 255, f[_].c.k[2] /= 255, f[_].c.k[3] /= 255;
}
function g(f) {
var _, I = f.length;
for (_ = 0; _ < I; _ += 1)
f[_].ty === 4 && S(f[_].shapes);
}
return function(f) {
if (v(F, f.v) && (g(f.layers), f.assets)) {
var _, I = f.assets.length;
for (_ = 0; _ < I; _ += 1)
f.assets[_].layers && g(f.assets[_].layers);
}
};
}(), V = /* @__PURE__ */ function() {
var F = [4, 4, 18];
function S(f) {
var _, I = f.length, E, z;
for (_ = I - 1; _ >= 0; _ -= 1)
if (f[_].ty === "sh")
if (f[_].ks.k.i)
f[_].ks.k.c = f[_].closed;
else
for (z = f[_].ks.k.length, E = 0; E < z; E += 1)
f[_].ks.k[E].s && (f[_].ks.k[E].s[0].c = f[_].closed), f[_].ks.k[E].e && (f[_].ks.k[E].e[0].c = f[_].closed);
else f[_].ty === "gr" && S(f[_].it);
}
function g(f) {
var _, I, E = f.length, z, J, K, ct;
for (I = 0; I < E; I += 1) {
if (_ = f[I], _.hasMask) {
var it = _.masksProperties;
for (J = it.length, z = 0; z < J; z += 1)
if (it[z].pt.k.i)
it[z].pt.k.c = it[z].cl;
else
for (ct = it[z].pt.k.length, K = 0; K < ct; K += 1)
it[z].pt.k[K].s && (it[z].pt.k[K].s[0].c = it[z].cl), it[z].pt.k[K].e && (it[z].pt.k[K].e[0].c = it[z].cl);
}
_.ty === 4 && S(_.shapes);
}
}
return function(f) {
if (v(F, f.v) && (g(f.layers), f.assets)) {
var _, I = f.assets.length;
for (_ = 0; _ < I; _ += 1)
f.assets[_].layers && g(f.assets[_].layers);
}
};
}();
function L(F) {
F.__complete || (R(F), m(F), y(F), T(F), V(F), x(F.layers, F.assets), c(F.chars, F.assets), F.__complete = !0);
}
function N(F) {
F.t.a.length === 0 && "m" in F.t.p;
}
var q = {};
return q.completeData = L, q.checkColors = R, q.checkChars = y, q.checkPathProperties = T, q.checkShapes = V, q.completeLayers = x, q;
}
if (s.dataManager || (s.dataManager = w()), s.assetLoader || (s.assetLoader = /* @__PURE__ */ function() {
function x(d) {
var o = d.getResponseHeader("content-type");
return o && d.responseType === "json" && o.indexOf("json") !== -1 || d.response && ri(d.response) === "object" ? d.response : d.response && typeof d.response == "string" ? JSON.parse(d.response) : d.responseText ? JSON.parse(d.responseText) : null;
}
function c(d, o, a, l) {
var v, m = new XMLHttpRequest();
try {
m.responseType = "json";
} catch {
}
m.onreadystatechange = function() {
if (m.readyState === 4)
if (m.status === 200)
v = x(m), a(v);
else
try {
v = x(m), a(v);
} catch (y) {
l && l(y);
}
};
try {
m.open(["G", "E", "T"].join(""), d, !0);
} catch {
m.open(["G", "E", "T"].join(""), o + "/" + d, !0);
}
m.send();
}
return {
load: c
};
}()), A.data.type === "loadAnimation")
s.assetLoader.load(A.data.path, A.data.fullPath, function(x) {
s.dataManager.completeData(x), s.postMessage({
id: A.data.id,
payload: x,
status: "success"
});
}, function() {
s.postMessage({
id: A.data.id,
status: "error"
});
});
else if (A.data.type === "complete") {
var C = A.data.animation;
s.dataManager.completeData(C), s.postMessage({
id: A.data.id,
payload: C,
status: "success"
});
} else A.data.type === "loadData" && s.assetLoader.load(A.data.path, A.data.fullPath, function(x) {
s.postMessage({
id: A.data.id,
payload: x,
status: "success"
});
}, function() {
s.postMessage({
id: A.data.id,
status: "error"
});
});
}), r.onmessage = function(u) {
var A = u.data, w = A.id, C = e[w];
e[w] = null, A.status === "success" ? C.onComplete(A.payload) : C.onError && C.onError();
});
}
function p(u, A) {
t += 1;
var w = "processId_" + t;
return e[w] = {
onComplete: u,
onError: A
}, w;
}
function k(u, A, w) {
b();
var C = p(A, w);
r.postMessage({
type: "loadAnimation",
path: u,
fullPath: window.location.origin + window.location.pathname,
id: C
});
}
function P(u, A, w) {
b();
var C = p(A, w);
r.postMessage({
type: "loadData",
path: u,
fullPath: window.location.origin + window.location.pathname,
id: C
});
}
function M(u, A, w) {
b();
var C = p(A, w);
r.postMessage({
type: "complete",
animation: u,
id: C
});
}
return {
loadAnimation: k,
loadData: P,
completeAnimation: M
};
}(), Dr = function() {
var t = function() {
var c = lt("canvas");
c.width = 1, c.height = 1;
var d = c.getContext("2d");
return d.fillStyle = "rgba(0,0,0,0)", d.fillRect(0, 0, 1, 1), c;
}();
function e() {
this.loadedAssets += 1, this.loadedAssets === this.totalImages && this.loadedFootagesCount === this.totalFootages && this.imagesLoadedCb && this.imagesLoadedCb(null);
}
function i() {
this.loadedFootagesCount += 1, this.loadedAssets === this.totalImages && this.loadedFootagesCount === this.totalFootages && this.imagesLoadedCb && this.imagesLoadedCb(null);
}
function r(c, d, o) {
var a = "";
if (c.e)
a = c.p;
else if (d) {
var l = c.p;
l.indexOf("images/") !== -1 && (l = l.split("/")[1]), a = d + l;
} else
a = o, a += c.u ? c.u : "", a += c.p;
return a;
}
function n(c) {
var d = 0, o = setInterval((function() {
var a = c.getBBox();
(a.width || d > 500) && (this._imageLoaded(), clearInterval(o)), d += 1;
}).bind(this), 50);
}
function s(c) {
var d = r(c, this.assetsPath, this.path), o = Y("image");
st ? this.testImageLoaded(o) : o.addEventListener("load", this._imageLoaded, !1), o.addEventListener("error", (function() {
a.img = t, this._imageLoaded();
}).bind(this), !1), o.setAttributeNS("http://www.w3.org/1999/xlink", "href", d), this._elementHelper.append ? this._elementHelper.append(o) : this._elementHelper.appendChild(o);
var a = {
img: o,
assetData: c
};
return a;
}
function h(c) {
var d = r(c, this.assetsPath, this.path), o = lt("img");
o.crossOrigin = "anonymous", o.addEventListener("load", this._imageLoaded, !1), o.addEventListener("error", (function() {
a.img = t, this._imageLoaded();
}).bind(this), !1), o.src = d;
var a = {
img: o,
assetData: c
};
return a;
}
function b(c) {
var d = {
assetData: c
}, o = r(c, this.assetsPath, this.path);
return Ie.loadData(o, (function(a) {
d.img = a, this._footageLoaded();
}).bind(this), (function() {
d.img = {}, this._footageLoaded();
}).bind(this)), d;
}
function p(c, d) {
this.imagesLoadedCb = d;
var o, a = c.length;
for (o = 0; o < a; o += 1)
c[o].layers || (!c[o].t || c[o].t === "seq" ? (this.totalImages += 1, this.images.push(this._createImageData(c[o]))) : c[o].t === 3 && (this.totalFootages += 1, this.images.push(this.createFootageData(c[o]))));
}
function k(c) {
this.path = c || "";
}
function P(c) {
this.assetsPath = c || "";
}
function M(c) {
for (var d = 0, o = this.images.length; d < o; ) {
if (this.images[d].assetData === c)
return this.images[d].img;
d += 1;
}
return null;
}
function u() {
this.imagesLoadedCb = null, this.images.length = 0;
}
function A() {
return this.totalImages === this.loadedAssets;
}
function w() {
return this.totalFootages === this.loadedFootagesCount;
}
function C(c, d) {
c === "svg" ? (this._elementHelper = d, this._createImageData = this.createImageData.bind(this)) : this._createImageData = this.createImgData.bind(this);
}
function x() {
this._imageLoaded = e.bind(this), this._footageLoaded = i.bind(this), this.testImageLoaded = n.bind(this), this.createFootageData = b.bind(this), this.assetsPath = "", this.path = "", this.totalImages = 0, this.totalFootages = 0, this.loadedAssets = 0, this.loadedFootagesCount = 0, this.imagesLoadedCb = null, this.images = [];
}
return x.prototype = {
loadAssets: p,
setAssetsPath: P,
setPath: k,
loadedImages: A,
loadedFootages: w,
destroy: u,
getAsset: M,
createImgData: h,
createImageData: s,
imageLoaded: e,
footageLoaded: i,
setCacheType: C
}, x;
}();
function ji() {
}
ji.prototype = {
triggerEvent: function(e, i) {
if (this._cbs[e])
for (var r = this._cbs[e], n = 0; n < r.length; n += 1)
r[n](i);
},
addEventListener: function(e, i) {
return this._cbs[e] || (this._cbs[e] = []), this._cbs[e].push(i), (function() {
this.removeEventListener(e, i);
}).bind(this);
},
removeEventListener: function(e, i) {
if (!i)
this._cbs[e] = null;
else if (this._cbs[e]) {
for (var r = 0, n = this._cbs[e].length; r < n; )
this._cbs[e][r] === i && (this._cbs[e].splice(r, 1), r -= 1, n -= 1), r += 1;
this._cbs[e].length || (this._cbs[e] = null);
}
}
};
var Nr = /* @__PURE__ */ function() {
function t(e) {
for (var i = e.split(`\r
`), r = {}, n, s = 0, h = 0; h < i.length; h += 1)
n = i[h].split(":"), n.length === 2 && (r[n[0]] = n[1].trim(), s += 1);
if (s === 0)
throw new Error();
return r;
}
return function(e) {
for (var i = [], r = 0; r < e.length; r += 1) {
var n = e[r], s = {
time: n.tm,
duration: n.dr
};
try {
s.payload = JSON.parse(e[r].cm);
} catch {
try {
s.payload = t(e[r].cm);
} catch {
s.payload = {
name: e[r].cm
};
}
}
i.push(s);
}
return i;
};
}(), zr = /* @__PURE__ */ function() {
function t(e) {
this.compositions.push(e);
}
return function() {
function e(i) {
for (var r = 0, n = this.compositions.length; r < n; ) {
if (this.compositions[r].data && this.compositions[r].data.nm === i)
return this.compositions[r].prepareFrame && this.compositions[r].data.xt && this.compositions[r].prepareFrame(this.currentFrame), this.compositions[r].compInterface;
r += 1;
}
return null;
}
return e.compositions = [], e.currentFrame = 0, e.registerComposition = t, e;
};
}(), Di = {}, qr = function(e, i) {
Di[e] = i;
};
function Wr(t) {
return Di[t];
}
function Le(t) {
"@babel/helpers - typeof";
return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Le = function(i) {
return typeof i;
} : Le = function(i) {
return i && typeof Symbol == "function" && i.constructor === Symbol && i !== Symbol.prototype ? "symbol" : typeof i;
}, Le(t);
}
var X = function() {
this._cbs = [], this.name = "", this.path = "", this.isLoaded = !1, this.currentFrame = 0, this.currentRawFrame = 0, this.firstFrame = 0, this.totalFrames = 0, this.frameRate = 0, this.frameMult = 0, this.playSpeed = 1, this.playDirection = 1, this.playCount = 0, this.animationData = {}, this.assets = [], this.isPaused = !0, this.autoplay = !1, this.loop = !0, this.renderer = null, this.animationID = wt(), this.assetsPath = "", this.timeCompleted = 0, this.segmentPos = 0, this.isSubframeEnabled = $t(), this.segments = [], this._idle = !0, this._completedLoop = !1, this.projectInterface = zr(), this.imagePreloader = new Dr(), this.audioController = Rt(), this.markers = [], this.configAnimation = this.configAnimation.bind(this), this.onSetupError = this.onSetupError.bind(this), this.onSegmentComplete = this.onSegmentComplete.bind(this), this.drawnFrameEvent = new Ee("drawnFrame", 0, 0, 0);
};
Z([ji], X), X.prototype.setParams = function(t) {
(t.wrapper || t.container) && (this.wrapper = t.wrapper || t.container);
var e = "svg";
t.animType ? e = t.animType : t.renderer && (e = t.renderer);
var i = Wr(e);
this.renderer = new i(this, t.rendererSettings), this.imagePreloader.setCacheType(e, this.renderer.globalData.defs), this.renderer.setProjectInterface(this.projectInterface), this.animType = e, t.loop === "" || t.loop === null || t.loop === void 0 || t.loop === !0 ? this.loop = !0 : t.loop === !1 ? this.loop = !1 : this.loop = parseInt(t.loop, 10), this.autoplay = "autoplay" in t ? t.autoplay : !0, this.name = t.name ? t.name : "", this.autoloadSegments = Object.prototype.hasOwnProperty.call(t, "autoloadSegments") ? t.autoloadSegments : !0, this.assetsPath = t.assetsPath, this.initialSegment = t.initialSegment, t.audioFactory && this.audioController.setAudioFactory(t.audioFactory), t.animationData ? this.setupAnimation(t.animationData) : t.path && (t.path.lastIndexOf("\\") !== -1 ? this.path = t.path.substr(0, t.path.lastIndexOf("\\") + 1) : this.path = t.path.substr(0, t.path.lastIndexOf("/") + 1), this.fileName = t.path.substr(t.path.lastIndexOf("/") + 1), this.fileName = this.fileName.substr(0, this.fileName.lastIndexOf(".json")), Ie.loadAnimation(t.path, this.configAnimation, this.onSetupError));
}, X.prototype.onSetupError = function() {
this.trigger("data_failed");
}, X.prototype.setupAnimation = function(t) {
Ie.completeAnimation(t, this.configAnimation);
}, X.prototype.setData = function(t, e) {
e && Le(e) !== "object" && (e = JSON.parse(e));
var i = {
wrapper: t,
animationData: e
}, r = t.attributes;
i.path = r.getNamedItem("data-animation-path") ? r.getNamedItem("data-animation-path").value : r.getNamedItem("data-bm-path") ? r.getNamedItem("data-bm-path").value : r.getNamedItem("bm-path") ? r.getNamedItem("bm-path").value : "", i.animType = r.getNamedItem("data-anim-type") ? r.getNamedItem("data-anim-type").value : r.getNamedItem("data-bm-type") ? r.getNamedItem("data-bm-type").value : r.getNamedItem("bm-type") ? r.getNamedItem("bm-type").value : r.getNamedItem("data-bm-renderer") ? r.getNamedItem("data-bm-renderer").value : r.getNamedItem("bm-renderer") ? r.getNamedItem("bm-renderer").value : "canvas";
var n = r.getNamedItem("data-anim-loop") ? r.getNamedItem("data-anim-loop").value : r.getNamedItem("data-bm-loop") ? r.getNamedItem("data-bm-loop").value : r.getNamedItem("bm-loop") ? r.getNamedItem("bm-loop").value : "";
n === "false" ? i.loop = !1 : n === "true" ? i.loop = !0 : n !== "" && (i.loop = parseInt(n, 10));
var s = r.getNamedItem("data-anim-autoplay") ? r.getNamedItem("data-anim-autoplay").value : r.getNamedItem("data-bm-autoplay") ? r.getNamedItem("data-bm-autoplay").value : r.getNamedItem("bm-autoplay") ? r.getNamedItem("bm-autoplay").value : !0;
i.autoplay = s !== "false", i.name = r.getNamedItem("data-name") ? r.getNamedItem("data-name").value : r.getNamedItem("data-bm-name") ? r.getNamedItem("data-bm-name").value : r.getNamedItem("bm-name") ? r.getNamedItem("bm-name").value : "";
var h = r.getNamedItem("data-anim-prerender") ? r.getNamedItem("data-anim-prerender").value : r.getNamedItem("data-bm-prerender") ? r.getNamedItem("data-bm-prerender").value : r.getNamedItem("bm-prerender") ? r.getNamedItem("bm-prerender").value : "";
h === "false" && (i.prerender = !1), this.setParams(i);
}, X.prototype.includeLayers = function(t) {
t.op > this.animationData.op && (this.animationData.op = t.op, this.totalFrames = Math.floor(t.op - this.animationData.ip));
var e = this.animationData.layers, i, r = e.length, n = t.layers, s, h = n.length;
for (s = 0; s < h; s += 1)
for (i = 0; i < r; ) {
if (e[i].id === n[s].id) {
e[i] = n[s];
break;
}
i += 1;
}
if ((t.chars || t.fonts) && (this.renderer.globalData.fontManager.addChars(t.chars), this.renderer.globalData.fontManager.addFonts(t.fonts, this.renderer.globalData.defs)), t.assets)
for (r = t.assets.length, i = 0; i < r; i += 1)
this.animationData.assets.push(t.assets[i]);
this.animationData.__complete = !1, Ie.completeAnimation(this.animationData, this.onSegmentComplete);
}, X.prototype.onSegmentComplete = function(t) {
this.animationData = t;
var e = bi();
e && e.initExpressions(this), this.loadNextSegment();
}, X.prototype.loadNextSegment = function() {
var t = this.animationData.segments;
if (!t || t.length === 0 || !this.autoloadSegments) {
this.trigger("data_ready"), this.timeCompleted = this.totalFrames;
return;
}
var e = t.shift();
this.timeCompleted = e.time * this.frameRate;
var i = this.path + this.fileName + "_" + this.segmentPos + ".json";
this.segmentPos += 1, Ie.loadData(i, this.includeLayers.bind(this), (function() {
this.trigger("data_failed");
}).bind(this));
}, X.prototype.loadSegments = function() {
var t = this.animationData.segments;
t || (this.timeCompleted = this.totalFrames), this.loadNextSegment();
}, X.prototype.imagesLoaded = function() {
this.trigger("loaded_images"), this.checkLoaded();
}, X.prototype.preloadImages = function() {
this.imagePreloader.setAssetsPath(this.assetsPath), this.imagePreloader.setPath(this.path), this.imagePreloader.loadAssets(this.animationData.assets, this.imagesLoaded.bind(this));
}, X.prototype.configAnimation = function(t) {
if (this.renderer)
try {
this.animationData = t, this.initialSegment ? (this.totalFrames = Math.floor(this.initialSegment[1] - this.initialSegment[0]), this.firstFrame = Math.round(this.initialSegment[0])) : (this.totalFrames = Math.floor(this.animationData.op - this.animationData.ip), this.firstFrame = Math.round(this.animationData.ip)), this.renderer.configAnimation(t), t.assets || (t.assets = []), this.assets = this.animationData.assets, this.frameRate = this.animationData.fr, this.frameMult = this.animationData.fr / 1e3, this.renderer.searchExtraCompositions(t.assets), this.markers = Nr(t.markers || []), this.trigger("config_ready"), this.preloadImages(), this.loadSegments(), this.updaFrameModifier(), this.waitForFontsLoaded(), this.isPaused && this.audioController.pause();
} catch (e) {
this.triggerConfigError(e);
}
}, X.prototype.waitForFontsLoaded = function() {
this.renderer && (this.renderer.globalData.fontManager.isLoaded ? this.checkLoaded() : setTimeout(this.waitForFontsLoaded.bind(this), 20));
}, X.prototype.checkLoaded = function() {
if (!this.isLoaded && this.renderer.globalData.fontManager.isLoaded && (this.imagePreloader.loadedImages() || this.renderer.rendererType !== "canvas") && this.imagePreloader.loadedFootages()) {
this.isLoaded = !0;
var t = bi();
t && t.initExpressions(this), this.renderer.initItems(), setTimeout((function() {
this.trigger("DOMLoaded");
}).bind(this), 0), this.gotoFrame(), this.autoplay && this.play();
}
}, X.prototype.resize = function(t, e) {
var i = typeof t == "number" ? t : void 0, r = typeof e == "number" ? e : void 0;
this.renderer.updateContainerSize(i, r);
}, X.prototype.setSubframe = function(t) {
this.isSubframeEnabled = !!t;
}, X.prototype.gotoFrame = function() {
this.currentFrame = this.isSubframeEnabled ? this.currentRawFrame : ~~this.currentRawFrame, this.timeCompleted !== this.totalFrames && this.currentFrame > this.timeCompleted && (this.currentFrame = this.timeCompleted), this.trigger("enterFrame"), this.renderFrame(), this.trigger("drawnFrame");
}, X.prototype.renderFrame = function() {
if (!(this.isLoaded === !1 || !this.renderer))
try {
this.renderer.renderFrame(this.currentFrame + this.firstFrame);
} catch (t) {
this.triggerRenderFrameError(t);
}
}, X.prototype.play = function(t) {
t && this.name !== t || this.isPaused === !0 && (this.isPaused = !1, this.trigger("_pause"), this.audioController.resume(), this._idle && (this._idle = !1, this.trigger("_active")));
}, X.prototype.pause = function(t) {
t && this.name !== t || this.isPaused === !1 && (this.isPaused = !0, this.trigger("_play"), this._idle = !0, this.trigger("_idle"), this.audioController.pause());
}, X.prototype.togglePause = function(t) {
t && this.name !== t || (this.isPaused === !0 ? this.play() : this.pause());
}, X.prototype.stop = function(t) {
t && this.name !== t || (this.pause(), this.playCount = 0, this._completedLoop = !1, this.setCurrentRawFrameValue(0));
}, X.prototype.getMarkerData = function(t) {
for (var e, i = 0; i < this.markers.length; i += 1)
if (e = this.markers[i], e.payload && e.payload.name === t)
return e;
return null;
}, X.prototype.goToAndStop = function(t, e, i) {
if (!(i && this.name !== i)) {
var r = Number(t);
if (isNaN(r)) {
var n = this.getMarkerData(t);
n && this.goToAndStop(n.time, !0);
} else e ? this.setCurrentRawFrameValue(t) : this.setCurrentRawFrameValue(t * this.frameModifier);
this.pause();
}
}, X.prototype.goToAndPlay = function(t, e, i) {
if (!(i && this.name !== i)) {
var r = Number(t);
if (isNaN(r)) {
var n = this.getMarkerData(t);
n && (n.duration ? this.playSegments([n.time, n.time + n.duration], !0) : this.goToAndStop(n.time, !0));
} else
this.goToAndStop(r, e, i);
this.play();
}
}, X.prototype.advanceTime = function(t) {
if (!(this.isPaused === !0 || this.isLoaded === !1)) {
var e = this.currentRawFrame + t * this.frameModifier, i = !1;
e >= this.totalFrames - 1 && this.frameModifier > 0 ? !this.loop || this.playCount === this.loop ? this.checkSegments(e > this.totalFrames ? e % this.totalFrames : 0) || (i = !0, e = this.totalFrames - 1) : e >= this.totalFrames ? (this.playCount += 1, this.checkSegments(e % this.totalFrames) || (this.setCurrentRawFrameValue(e % this.totalFrames), this._completedLoop = !0, this.trigger("loopComplete"))) : this.setCurrentRawFrameValue(e) : e < 0 ? this.checkSegments(e % this.totalFrames) || (this.loop && !(this.playCount-- <= 0 && this.loop !== !0) ? (this.setCurrentRawFrameValue(this.totalFrames + e % this.totalFrames), this._completedLoop ? this.trigger("loopComplete") : this._completedLoop = !0) : (i = !0, e = 0)) : this.setCurrentRawFrameValue(e), i && (this.setCurrentRawFrameValue(e), this.pause(), this.trigger("complete"));
}
}, X.prototype.adjustSegment = function(t, e) {
this.playCount = 0, t[1] < t[0] ? (this.frameModifier > 0 && (this.playSpeed < 0 ? this.setSpeed(-this.playSpeed) : this.setDirection(-1)), this.totalFrames = t[0] - t[1], this.timeCompleted = this.totalFrames, this.firstFrame = t[1], this.setCurrentRawFrameValue(this.totalFrames - 1e-3 - e)) : t[1] > t[0] && (this.frameModifier < 0 && (this.playSpeed < 0 ? this.setSpeed(-this.playSpeed) : this.setDirection(1)), this.totalFrames = t[1] - t[0], this.timeCompleted = this.totalFrames, this.firstFrame = t[0], this.setCurrentRawFrameValue(1e-3 + e)), this.trigger("segmentStart");
}, X.prototype.setSegment = function(t, e) {
var i = -1;
this.isPaused && (this.currentRawFrame + this.firstFrame < t ? i = t : this.currentRawFrame + this.firstFrame > e && (i = e - t)), this.firstFrame = t, this.totalFrames = e - t, this.timeCompleted = this.totalFrames, i !== -1 && this.goToAndStop(i, !0);
}, X.prototype.playSegments = function(t, e) {
if (e && (this.segments.length = 0), Le(t[0]) === "object") {
var i, r = t.length;
for (i = 0; i < r; i += 1)
this.segments.push(t[i]);
} else
this.segments.push(t);
this.segments.length && e && this.adjustSegment(this.segments.shift(), 0), this.isPaused && this.play();
}, X.prototype.resetSegments = function(t) {
this.segments.length = 0, this.segments.push([this.animationData.ip, this.animationData.op]), t && this.checkSegments(0);
}, X.prototype.checkSegments = function(t) {
return this.segments.length ? (this.adjustSegment(this.segments.shift(), t), !0) : !1;
}, X.prototype.destroy = function(t) {
t && this.name !== t || !this.renderer || (this.renderer.destroy(), this.imagePreloader.destroy(), this.trigger("destroy"), this._cbs = null, this.onEnterFrame = null, this.onLoopComplete = null, this.onComplete = null, this.onSegmentStart = null, this.onDestroy = null, this.renderer = null, this.renderer = null, this.imagePreloader = null, this.projectInterface = null);
}, X.prototype.setCurrentRawFrameValue = function(t) {
this.currentRawFrame = t, this.gotoFrame();
}, X.prototype.setSpeed = function(t) {
this.playSpeed = t, this.updaFrameModifier();
}, X.prototype.setDirection = function(t) {
this.playDirection = t < 0 ? -1 : 1, this.updaFrameModifier();
}, X.prototype.setLoop = function(t) {
this.loop = t;
}, X.prototype.setVolume = function(t, e) {
e && this.name !== e || this.audioController.setVolume(t);
}, X.prototype.getVolume = function() {
return this.audioController.getVolume();
}, X.prototype.mute = function(t) {
t && this.name !== t || this.audioController.mute();
}, X.prototype.unmute = function(t) {
t && this.name !== t || this.audioController.unmute();
}, X.prototype.updaFrameModifier = function() {
this.frameModifier = this.frameMult * this.playSpeed * this.playDirection, this.audioController.setRate(this.playSpeed * this.playDirection);
}, X.prototype.getPath = function() {
return this.path;
}, X.prototype.getAssetsPath = function(t) {
var e = "";
if (t.e)
e = t.p;
else if (this.assetsPath) {
var i = t.p;
i.indexOf("images/") !== -1 && (i = i.split("/")[1]), e = this.assetsPath + i;
} else
e = this.path, e += t.u ? t.u : "", e += t.p;
return e;
}, X.prototype.getAssetData = function(t) {
for (var e = 0, i = this.assets.length; e < i; ) {
if (t === this.assets[e].id)
return this.assets[e];