@kwai-video-team/kwai-player-web
Version:
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
1,262 lines • 1.44 MB
JavaScript
var cf = Object.defineProperty;
var mc = Object.getOwnPropertySymbols;
var uf = Object.prototype.hasOwnProperty, hf = Object.prototype.propertyIsEnumerable;
var gc = (n, r, a) => r in n ? cf(n, r, { enumerable: !0, configurable: !0, writable: !0, value: a }) : n[r] = a, bc = (n, r) => {
for (var a in r || (r = {}))
uf.call(r, a) && gc(n, a, r[a]);
if (mc)
for (var a of mc(r))
hf.call(r, a) && gc(n, a, r[a]);
return n;
};
import * as Rn from "react";
import { jsx as lf } from "react/jsx-runtime";
Number.isFinite || (Number.isFinite = (n) => typeof n == "number" && isFinite(n));
Array.prototype.find || (Array.prototype.find = function(n, r) {
if (this === null || this === void 0)
throw new TypeError("Array.prototype.find called on null or undefined");
if (typeof n != "function")
throw new TypeError("callback must be a function");
const a = Object(this), u = a.length >>> 0;
for (let c = 0; c < u; c++)
if (n.call(r, a[c], c, a))
return a[c];
});
Array.prototype.findIndex || (Array.prototype.findIndex = function(n, r) {
if (this === null || this === void 0)
throw new TypeError("Array.prototype.findIndex called on null or undefined");
if (typeof n != "function")
throw new TypeError("callback must be a function");
const a = Object(this), u = a.length >>> 0;
for (let c = 0; c < u; c++)
if (c in a && n.call(r, a[c], c, a))
return c;
return -1;
});
Array.prototype.fill || (Array.prototype.fill = function(n, r = 0, a = this.length) {
if (this === null || this === void 0)
throw new TypeError("Array.prototype.fill called on null or undefined");
const u = Object(this), c = u.length >>> 0, _ = r >> 0, y = a >> 0, T = _ < 0 ? Math.max(c + _, 0) : Math.min(_, c), I = y < 0 ? Math.max(c + y, 0) : Math.min(y, c);
for (let V = T; V < I; V++)
u[V] = n;
return u;
});
var df = Object.defineProperty, ff = (n, r, a) => r in n ? df(n, r, { enumerable: !0, configurable: !0, writable: !0, value: a }) : n[r] = a, uu = (n, r, a) => (ff(n, typeof r != "symbol" ? r + "" : r, a), a), on = function(n) {
var r = {};
function a(u) {
if (r[u])
return r[u].exports;
var c = r[u] = { i: u, l: !1, exports: {} };
return n[u].call(c.exports, c, c.exports, a), c.l = !0, c.exports;
}
return a.m = n, a.c = r, a.d = function(u, c, _) {
a.o(u, c) || Object.defineProperty(u, c, { enumerable: !0, get: _ });
}, a.r = function(u) {
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(u, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(u, "__esModule", { value: !0 });
}, a.t = function(u, c) {
if (1 & c && (u = a(u)), 8 & c || 4 & c && typeof u == "object" && u && u.__esModule)
return u;
var _ = /* @__PURE__ */ Object.create(null);
if (a.r(_), Object.defineProperty(_, "default", { enumerable: !0, value: u }), 2 & c && typeof u != "string")
for (var y in u)
a.d(_, y, function(T) {
return u[T];
}.bind(null, y));
return _;
}, a.n = function(u) {
var c = u && u.__esModule ? function() {
return u.default;
} : function() {
return u;
};
return a.d(c, "a", c), c;
}, a.o = function(u, c) {
return Object.prototype.hasOwnProperty.call(u, c);
}, a.p = "", a(a.s = 8);
}([function(n, r, a) {
var u = a(5);
function c(_, y) {
for (var T = 0; T < y.length; T++) {
var I = y[T];
I.enumerable = I.enumerable || !1, I.configurable = !0, "value" in I && (I.writable = !0), Object.defineProperty(_, u(I.key), I);
}
}
n.exports = function(_, y, T) {
return y && c(_.prototype, y), T && c(_, T), Object.defineProperty(_, "prototype", { writable: !1 }), _;
}, n.exports.__esModule = !0, n.exports.default = n.exports;
}, function(n, r) {
function a(u) {
return n.exports = a = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(c) {
return typeof c;
} : function(c) {
return c && typeof Symbol == "function" && c.constructor === Symbol && c !== Symbol.prototype ? "symbol" : typeof c;
}, n.exports.__esModule = !0, n.exports.default = n.exports, a(u);
}
n.exports = a, n.exports.__esModule = !0, n.exports.default = n.exports;
}, function(n, r, a) {
var u = a(7)();
n.exports = u;
try {
regeneratorRuntime = u;
} catch (c) {
typeof globalThis == "object" ? globalThis.regeneratorRuntime = u : Function("r", "regeneratorRuntime = r")(u);
}
}, function(n, r) {
function a() {
return n.exports = a = Object.assign ? Object.assign.bind() : function(u) {
for (var c = 1; c < arguments.length; c++) {
var _ = arguments[c];
for (var y in _)
Object.prototype.hasOwnProperty.call(_, y) && (u[y] = _[y]);
}
return u;
}, n.exports.__esModule = !0, n.exports.default = n.exports, a.apply(this, arguments);
}
n.exports = a, n.exports.__esModule = !0, n.exports.default = n.exports;
}, function(n, r) {
function a(u, c, _, y, T, I, V) {
try {
var l = u[I](V), j = l.value;
} catch (S) {
return void _(S);
}
l.done ? c(j) : Promise.resolve(j).then(y, T);
}
n.exports = function(u) {
return function() {
var c = this, _ = arguments;
return new Promise(function(y, T) {
var I = u.apply(c, _);
function V(j) {
a(I, y, T, V, l, "next", j);
}
function l(j) {
a(I, y, T, V, l, "throw", j);
}
V(void 0);
});
};
}, n.exports.__esModule = !0, n.exports.default = n.exports;
}, function(n, r, a) {
var u = a(1).default, c = a(6);
n.exports = function(_) {
var y = c(_, "string");
return u(y) == "symbol" ? y : y + "";
}, n.exports.__esModule = !0, n.exports.default = n.exports;
}, function(n, r, a) {
var u = a(1).default;
n.exports = function(c, _) {
if (u(c) != "object" || !c)
return c;
var y = c[Symbol.toPrimitive];
if (y !== void 0) {
var T = y.call(c, _ || "default");
if (u(T) != "object")
return T;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (_ === "string" ? String : Number)(c);
}, n.exports.__esModule = !0, n.exports.default = n.exports;
}, function(n, r, a) {
var u = a(1).default;
function c() {
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
n.exports = c = function() {
return y;
}, n.exports.__esModule = !0, n.exports.default = n.exports;
var _, y = {}, T = Object.prototype, I = T.hasOwnProperty, V = Object.defineProperty || function(le, X, me) {
le[X] = me.value;
}, l = typeof Symbol == "function" ? Symbol : {}, j = l.iterator || "@@iterator", S = l.asyncIterator || "@@asyncIterator", E = l.toStringTag || "@@toStringTag";
function L(le, X, me) {
return Object.defineProperty(le, X, { value: me, enumerable: !0, configurable: !0, writable: !0 }), le[X];
}
try {
L({}, "");
} catch (le) {
L = function(X, me, Pe) {
return X[me] = Pe;
};
}
function Q(le, X, me, Pe) {
var ae = X && X.prototype instanceof te ? X : te, J = Object.create(ae.prototype), m = new Te(Pe || []);
return V(J, "_invoke", { value: w(le, me, m) }), J;
}
function F(le, X, me) {
try {
return { type: "normal", arg: le.call(X, me) };
} catch (Pe) {
return { type: "throw", arg: Pe };
}
}
y.wrap = Q;
var N = "suspendedStart", K = "executing", G = "completed", B = {};
function te() {
}
function ye() {
}
function Z() {
}
var Ce = {};
L(Ce, j, function() {
return this;
});
var Be = Object.getPrototypeOf, Fe = Be && Be(Be(Le([])));
Fe && Fe !== T && I.call(Fe, j) && (Ce = Fe);
var He = Z.prototype = te.prototype = Object.create(Ce);
function De(le) {
["next", "throw", "return"].forEach(function(X) {
L(le, X, function(me) {
return this._invoke(X, me);
});
});
}
function ue(le, X) {
function me(ae, J, m, ve) {
var P = F(le[ae], le, J);
if (P.type !== "throw") {
var k = P.arg, ne = k.value;
return ne && u(ne) == "object" && I.call(ne, "__await") ? X.resolve(ne.__await).then(function(we) {
me("next", we, m, ve);
}, function(we) {
me("throw", we, m, ve);
}) : X.resolve(ne).then(function(we) {
k.value = we, m(k);
}, function(we) {
return me("throw", we, m, ve);
});
}
ve(P.arg);
}
var Pe;
V(this, "_invoke", { value: function(ae, J) {
function m() {
return new X(function(ve, P) {
me(ae, J, ve, P);
});
}
return Pe = Pe ? Pe.then(m, m) : m();
} });
}
function w(le, X, me) {
var Pe = N;
return function(ae, J) {
if (Pe === K)
throw Error("Generator is already running");
if (Pe === G) {
if (ae === "throw")
throw J;
return { value: _, done: !0 };
}
for (me.method = ae, me.arg = J; ; ) {
var m = me.delegate;
if (m) {
var ve = R(m, me);
if (ve) {
if (ve === B)
continue;
return ve;
}
}
if (me.method === "next")
me.sent = me._sent = me.arg;
else if (me.method === "throw") {
if (Pe === N)
throw Pe = G, me.arg;
me.dispatchException(me.arg);
} else
me.method === "return" && me.abrupt("return", me.arg);
Pe = K;
var P = F(le, X, me);
if (P.type === "normal") {
if (Pe = me.done ? G : "suspendedYield", P.arg === B)
continue;
return { value: P.arg, done: me.done };
}
P.type === "throw" && (Pe = G, me.method = "throw", me.arg = P.arg);
}
};
}
function R(le, X) {
var me = X.method, Pe = le.iterator[me];
if (Pe === _)
return X.delegate = null, me === "throw" && le.iterator.return && (X.method = "return", X.arg = _, R(le, X), X.method === "throw") || me !== "return" && (X.method = "throw", X.arg = new TypeError("The iterator does not provide a '" + me + "' method")), B;
var ae = F(Pe, le.iterator, X.arg);
if (ae.type === "throw")
return X.method = "throw", X.arg = ae.arg, X.delegate = null, B;
var J = ae.arg;
return J ? J.done ? (X[le.resultName] = J.value, X.next = le.nextLoc, X.method !== "return" && (X.method = "next", X.arg = _), X.delegate = null, B) : J : (X.method = "throw", X.arg = new TypeError("iterator result is not an object"), X.delegate = null, B);
}
function he(le) {
var X = { tryLoc: le[0] };
1 in le && (X.catchLoc = le[1]), 2 in le && (X.finallyLoc = le[2], X.afterLoc = le[3]), this.tryEntries.push(X);
}
function oe(le) {
var X = le.completion || {};
X.type = "normal", delete X.arg, le.completion = X;
}
function Te(le) {
this.tryEntries = [{ tryLoc: "root" }], le.forEach(he, this), this.reset(!0);
}
function Le(le) {
if (le || le === "") {
var X = le[j];
if (X)
return X.call(le);
if (typeof le.next == "function")
return le;
if (!isNaN(le.length)) {
var me = -1, Pe = function ae() {
for (; ++me < le.length; )
if (I.call(le, me))
return ae.value = le[me], ae.done = !1, ae;
return ae.value = _, ae.done = !0, ae;
};
return Pe.next = Pe;
}
}
throw new TypeError(u(le) + " is not iterable");
}
return ye.prototype = Z, V(He, "constructor", { value: Z, configurable: !0 }), V(Z, "constructor", { value: ye, configurable: !0 }), ye.displayName = L(Z, E, "GeneratorFunction"), y.isGeneratorFunction = function(le) {
var X = typeof le == "function" && le.constructor;
return !!X && (X === ye || (X.displayName || X.name) === "GeneratorFunction");
}, y.mark = function(le) {
return Object.setPrototypeOf ? Object.setPrototypeOf(le, Z) : (le.__proto__ = Z, L(le, E, "GeneratorFunction")), le.prototype = Object.create(He), le;
}, y.awrap = function(le) {
return { __await: le };
}, De(ue.prototype), L(ue.prototype, S, function() {
return this;
}), y.AsyncIterator = ue, y.async = function(le, X, me, Pe, ae) {
ae === void 0 && (ae = Promise);
var J = new ue(Q(le, X, me, Pe), ae);
return y.isGeneratorFunction(X) ? J : J.next().then(function(m) {
return m.done ? m.value : J.next();
});
}, De(He), L(He, E, "Generator"), L(He, j, function() {
return this;
}), L(He, "toString", function() {
return "[object Generator]";
}), y.keys = function(le) {
var X = Object(le), me = [];
for (var Pe in X)
me.push(Pe);
return me.reverse(), function ae() {
for (; me.length; ) {
var J = me.pop();
if (J in X)
return ae.value = J, ae.done = !1, ae;
}
return ae.done = !0, ae;
};
}, y.values = Le, Te.prototype = { constructor: Te, reset: function(le) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = _, this.done = !1, this.delegate = null, this.method = "next", this.arg = _, this.tryEntries.forEach(oe), !le)
for (var X in this)
X.charAt(0) === "t" && I.call(this, X) && !isNaN(+X.slice(1)) && (this[X] = _);
}, stop: function() {
this.done = !0;
var le = this.tryEntries[0].completion;
if (le.type === "throw")
throw le.arg;
return this.rval;
}, dispatchException: function(le) {
if (this.done)
throw le;
var X = this;
function me(P, k) {
return J.type = "throw", J.arg = le, X.next = P, k && (X.method = "next", X.arg = _), !!k;
}
for (var Pe = this.tryEntries.length - 1; Pe >= 0; --Pe) {
var ae = this.tryEntries[Pe], J = ae.completion;
if (ae.tryLoc === "root")
return me("end");
if (ae.tryLoc <= this.prev) {
var m = I.call(ae, "catchLoc"), ve = I.call(ae, "finallyLoc");
if (m && ve) {
if (this.prev < ae.catchLoc)
return me(ae.catchLoc, !0);
if (this.prev < ae.finallyLoc)
return me(ae.finallyLoc);
} else if (m) {
if (this.prev < ae.catchLoc)
return me(ae.catchLoc, !0);
} else {
if (!ve)
throw Error("try statement without catch or finally");
if (this.prev < ae.finallyLoc)
return me(ae.finallyLoc);
}
}
}
}, abrupt: function(le, X) {
for (var me = this.tryEntries.length - 1; me >= 0; --me) {
var Pe = this.tryEntries[me];
if (Pe.tryLoc <= this.prev && I.call(Pe, "finallyLoc") && this.prev < Pe.finallyLoc) {
var ae = Pe;
break;
}
}
ae && (le === "break" || le === "continue") && ae.tryLoc <= X && X <= ae.finallyLoc && (ae = null);
var J = ae ? ae.completion : {};
return J.type = le, J.arg = X, ae ? (this.method = "next", this.next = ae.finallyLoc, B) : this.complete(J);
}, complete: function(le, X) {
if (le.type === "throw")
throw le.arg;
return le.type === "break" || le.type === "continue" ? this.next = le.arg : le.type === "return" ? (this.rval = this.arg = le.arg, this.method = "return", this.next = "end") : le.type === "normal" && X && (this.next = X), B;
}, finish: function(le) {
for (var X = this.tryEntries.length - 1; X >= 0; --X) {
var me = this.tryEntries[X];
if (me.finallyLoc === le)
return this.complete(me.completion, me.afterLoc), oe(me), B;
}
}, catch: function(le) {
for (var X = this.tryEntries.length - 1; X >= 0; --X) {
var me = this.tryEntries[X];
if (me.tryLoc === le) {
var Pe = me.completion;
if (Pe.type === "throw") {
var ae = Pe.arg;
oe(me);
}
return ae;
}
}
throw Error("illegal catch attempt");
}, delegateYield: function(le, X, me) {
return this.delegate = { iterator: Le(le), resultName: X, nextLoc: me }, this.method === "next" && (this.arg = _), B;
} }, y;
}
n.exports = c, n.exports.__esModule = !0, n.exports.default = n.exports;
}, function(n, r, a) {
a.r(r), a.d(r, "KwaiVideoLocalLog", function() {
return He;
}), a.d(r, "LogLevel", function() {
return S;
}), a.d(r, "DefaultLogger", function() {
return F;
}), a.d(r, "Logger", function() {
return Q;
}), a.d(r, "printVersion", function() {
return I;
}), a.d(r, "DEFAULT_LOG_LEVEL", function() {
return E;
});
var u = a(0), c = a.n(u), _ = a(3), y = a.n(_), T = { idbName: "kwai-video-local-log", idbMaxDataCount: 25e3, idbMaxFoldLog: 20, maxLogLen: 4096 };
function I(De, ue) {
console.log("%c " + De + " %c " + ue + " %c", "background:#35495e ; padding: 1px; border-radius: 4px 0 0 4px; color: #fff", "background:#ffa483 ; padding: 1px; border-radius: 0 4px 4px 0; color: #fff", "background:transparent");
}
var V = function() {
function De() {
this.timeout = 6048e5;
}
var ue = De.prototype;
return ue.write = function(w, R) {
if (De.available)
try {
localStorage.setItem(w, JSON.stringify({ value: R, time: Date.now() }));
} catch (he) {
}
}, ue.read = function(w, R) {
if (R === void 0 && (R = !0), De.available)
try {
var he = localStorage.getItem(w);
if (he) {
var oe = JSON.parse(he), Te = oe.value, Le = oe.time, le = Le === void 0 ? 0 : Le;
if (!R || Date.now() - le < (typeof R == "number" ? R : this.timeout))
return Te;
}
} catch (X) {
}
}, c()(De, null, [{ key: "available", get: function() {
if (De._available === void 0)
try {
localStorage.setItem("alg", "test"), De._available = !0;
} catch (w) {
De._available = !1;
}
return De._available;
} }]);
}();
V._available = void 0;
var l, j = V, S = function(De) {
return De.NONE = "none", De.ERROR = "e", De.WARN = "w", De.INFO = "i", De.DEBUG = "d", De.VERBOSE = "v", De;
}({}), E = S.ERROR, L = ((l = {})[S.NONE] = { value: 1, str: "N" }, l[S.ERROR] = { value: 100, str: "E" }, l[S.WARN] = { value: 200, str: "W" }, l[S.INFO] = { value: 300, str: "I" }, l[S.DEBUG] = { value: 400, str: "D" }, l[S.VERBOSE] = { value: 500, str: "V" }, l), Q = function() {
function De(w) {
if (this._name = "kwai-v", this._level = E, this._id = -1, this._output = void 0, this._workerTag = "main", typeof location < "u" && location.protocol === "blob:") {
var R, he = location.href.split("/"), oe = (R = he[he.length - 1]) == null ? void 0 : R.match(/(\w+)-/);
oe && (this._workerTag = w ? w + "-" + oe[1] : oe[1]);
} else
w && (this._workerTag = w);
}
De.loadLogLevel = function(w, R) {
if (R === void 0 && (R = !0), location.href) {
var he = new RegExp(w + "=([a-z]{1})"), oe = location.href.match(he);
if (oe && oe.length > 1) {
var Te = oe[1];
if (this._isValueInLevel(Te))
return Te;
}
}
var Le = new j().read(w, R);
if (this._isValueInLevel(Le))
return Le;
}, De.saveLogLevel = function(w, R) {
this._isValueInLevel(R) && new j().write(w, R);
}, De._isValueInLevel = function(w) {
return Object.values(S).indexOf(w) !== -1;
};
var ue = De.prototype;
return ue.setOutput = function(w) {
return this._output = w, this;
}, ue.setLevel = function(w) {
return this._level = w, this;
}, ue.setId = function(w) {
return this._id = w, this;
}, ue.setName = function(w) {
return this._name = w, this;
}, ue.getLevel = function() {
return this._level;
}, ue.getOutput = function() {
return this._output;
}, ue.hasOutput = function() {
return !!this._output;
}, ue.e = function(w) {
if (this._isLevelEnabled(this._level, S.ERROR)) {
for (var R = arguments.length, he = new Array(R > 1 ? R - 1 : 0), oe = 1; oe < R; oe++)
he[oe - 1] = arguments[oe];
var Te = this._printLog(S.ERROR, w, he);
try {
var Le;
(Le = this._output) == null || Le.e.apply(Le, [Te].concat(he));
} catch (le) {
}
}
}, ue.w = function(w) {
if (this._isLevelEnabled(this._level, S.WARN)) {
for (var R = arguments.length, he = new Array(R > 1 ? R - 1 : 0), oe = 1; oe < R; oe++)
he[oe - 1] = arguments[oe];
var Te = this._printLog(S.WARN, w, he);
try {
var Le;
(Le = this._output) == null || Le.w.apply(Le, [Te].concat(he));
} catch (le) {
}
}
}, ue.i = function(w) {
if (this._isLevelEnabled(this._level, S.INFO)) {
for (var R = arguments.length, he = new Array(R > 1 ? R - 1 : 0), oe = 1; oe < R; oe++)
he[oe - 1] = arguments[oe];
var Te = this._printLog(S.INFO, w, he);
try {
var Le;
(Le = this._output) == null || Le.i.apply(Le, [Te].concat(he));
} catch (le) {
}
}
}, ue.d = function(w) {
if (this._isLevelEnabled(this._level, S.DEBUG)) {
for (var R = arguments.length, he = new Array(R > 1 ? R - 1 : 0), oe = 1; oe < R; oe++)
he[oe - 1] = arguments[oe];
var Te = this._printLog(S.DEBUG, w, he);
try {
var Le;
(Le = this._output) == null || Le.d.apply(Le, [Te].concat(he));
} catch (le) {
}
}
}, ue.v = function(w) {
if (this._isLevelEnabled(this._level, S.VERBOSE)) {
for (var R = arguments.length, he = new Array(R > 1 ? R - 1 : 0), oe = 1; oe < R; oe++)
he[oe - 1] = arguments[oe];
var Te = this._printLog(S.VERBOSE, w, he);
try {
var Le;
(Le = this._output) == null || Le.v.apply(Le, [Te].concat(he));
} catch (le) {
}
}
}, ue._isLevelEnabled = function(w, R) {
return L[w].value >= L[R].value;
}, ue._printLog = function(w, R, he) {
var oe, Te, Le = typeof R;
if (Le === "object")
R = ((Te = R) == null ? void 0 : Te.constructor.name) || "unknown";
else if (Le === "function") {
var le;
R = ((le = Object.getOwnPropertyDescriptor(R, "name")) == null ? void 0 : le.value) || "unknown";
}
var X, me, Pe = (((oe = L[w]) == null ? void 0 : oe.str) || "") + "|" + this._name + "[" + (typeof this._id == "function" ? this._id() : this._id) + "][" + this._workerTag + "]::" + R;
return w === S.ERROR ? (X = console).error.apply(X, [Pe].concat(he.slice(0))) : (me = console).log.apply(me, [Pe].concat(he.slice(0))), Pe;
}, De;
}(), F = new Q(), N = function() {
return c()(function De(ue) {
this._logger = void 0, this._id = 0, this._config = T, this._id = De._id, De._id++, this._logger = new Q().setId(this._id).setLevel(S.INFO), this._config = y()({}, T, ue);
}, [{ key: "config", get: function() {
return this._config;
} }, { key: "logger", get: function() {
return this._logger;
} }, { key: "id", get: function() {
return this._id;
} }], [{ key: "packName", get: function() {
return "ll_es";
} }, { key: "version", get: function() {
return "1.0.13";
} }, { key: "buildTime", get: function() {
return "Tue Oct 08 2024 17:18:49 GMT+0800 (中国标准时间)";
} }]);
}();
N._id = 0;
var K = a(4), G = a.n(K), B = a(2), te = a.n(B), ye = function() {
function De(w, R, he, oe, Te) {
var Le = this;
Te === void 0 && (Te = 1), this._logger = void 0, this._name = void 0, this._storeName = void 0, this._dbIndex = void 0, this._version = void 0, this._taskQueue = [], this._openReq = void 0, this._isTransactionActive = !1, this._runTaskQueue = function() {
for (; Le._taskQueue.length; ) {
var le = Le._taskQueue.shift();
le && Le.run(le.task, le.mode);
}
}, this._logger = w, this._name = R, this._storeName = he, this._dbIndex = oe, this._version = Te;
}
var ue = De.prototype;
return ue.init = function() {
var w = this;
if (!this._openReq && indexedDB) {
var R = this._openReq = indexedDB.open(this._name, this._version);
this._logger.i("idb-wrapper", "open", R), R.onerror = function() {
w._logger.i("idb-wrapper", "open error.");
}, R.onsuccess = function() {
w._logger.i("idb-wrapper", "open success."), w._runTaskQueue();
}, R.onupgradeneeded = function() {
w._logger.i("idb-wrapper", "open upgradeneeded."), R.result.objectStoreNames.contains(w._storeName) && R.result.deleteObjectStore(w._storeName);
var he = R.result.createObjectStore(w._storeName, { keyPath: "id", autoIncrement: !0 });
w._dbIndex && w._dbIndex.forEach(function(oe) {
he.createIndex(oe.name, oe.keyPath, oe.option);
});
};
}
}, ue.run = function(w, R) {
if (R === void 0 && (R = "readwrite"), this.init(), this._openReq && this._openReq.readyState === "done" && !this._openReq.error)
return this._doTask(w, R);
this.state !== "error" && (this._taskQueue.push({ task: w, mode: R }), this._taskQueue.length > 1e3 && this._taskQueue.shift());
}, ue.close = function() {
var w = this;
this._logger.i("idb-wrapper", "close"), this._openReq && (this._openReq.readyState === "done" ? (this._openReq.result.close(), this._openReq = void 0) : this._openReq.onsuccess = function() {
w.close();
});
}, ue.destroy = function() {
this._logger.i("idb-wrapper", "destroy"), this.close(), this._taskQueue = [];
}, ue._doTask = function(w, R) {
var he = this;
if (R === void 0 && (R = "readwrite"), this._openReq && !this._openReq.error)
try {
this._isTransactionActive = !0;
var oe = this._openReq.result.transaction(this._storeName, R), Te = void 0;
oe.oncomplete = function() {
he._isTransactionActive = !1, w.callback && w.callback(Te), he._runTaskQueue();
}, oe.onabort = oe.onerror = function() {
he._isTransactionActive = !1, w.callback && w.callback(Te), he._runTaskQueue();
}, Te = w.exec(oe.objectStore(this._storeName));
} catch (Le) {
}
else
w.callback && w.callback();
}, c()(De, [{ key: "isTransactionActive", get: function() {
return this._isTransactionActive;
} }, { key: "state", get: function() {
return this._openReq && this._openReq.readyState === "done" ? this._openReq.error ? "error" : "ready" : "idle";
} }]);
}(), Z = [{ name: "id", keyPath: "id", option: { unique: !0 } }], Ce = [function() {
function De(w) {
this._ctx = void 0, this._idb = void 0, this._logCount = 0, this._saveCount = 0, this._reCountOnSaveCount = 100, this._reduceData = !1, this._ctx = w, this._idb = new ye(w.logger, w.config.idbName, w.config.idbName, Z), this._reCountOnSaveCount = Math.min(200, Math.max(50, Math.round(this._ctx.config.idbMaxDataCount / 10))), this._count();
}
De.isSupported = function() {
return typeof indexedDB < "u";
};
var ue = De.prototype;
return ue.saveLog = function(w) {
var R = this, he = { exec: function(oe) {
return oe.add({ value: w });
}, callback: function(oe) {
R._saveCount++, R._saveCount % R._reCountOnSaveCount == 0 && R._count(), oe != null && oe.error && R._ctx.logger.i("idb-backend", "save log err", oe.error);
} };
this._idb.run(he);
}, ue.exportLog = function() {
var w = G()(te.a.mark(function R() {
var he = this;
return te.a.wrap(function(oe) {
for (; ; )
switch (oe.prev = oe.next) {
case 0:
return oe.abrupt("return", new Promise(function(Te, Le) {
he._ctx.logger.i("idb-backend", "export start");
var le = { exec: function(X) {
return X.getAll();
}, callback: function(X) {
Te(X === void 0 ? "" : he._mergeGetAll(X.result));
} };
he._idb.run(le, "readonly");
}));
case 1:
case "end":
return oe.stop();
}
}, R);
}));
return function() {
return w.apply(this, arguments);
};
}(), ue.destroy = function() {
this._idb.destroy();
}, ue.clean = function() {
this._idb.run({ exec: function(w) {
return w.clear();
} });
}, ue._count = function() {
var w = this, R = { exec: function(he) {
return he.count();
}, callback: function(he) {
he != null && he.error || he == null || !he.result || (w._ctx.logger.i("idb-backend", "count: " + he.result + " max: " + w._ctx.config.idbMaxDataCount), w._logCount = he.result, w._logCount >= w._ctx.config.idbMaxDataCount && !w._reduceData && w._deleteFromHead(w._logCount - Math.round(w._ctx.config.idbMaxDataCount / 2)));
} };
this._idb.run(R);
}, ue._deleteFromHead = function(w) {
var R = this;
this._ctx.logger.i("idb-backend", "delete from head"), this._reduceData = !0;
var he = { exec: function(oe) {
return oe.openCursor();
}, callback: function(oe) {
if (R._reduceData = !1, oe != null && oe.result) {
var Te = IDBKeyRange.bound(oe.result.key, oe.result.key + w, !1, !1), Le = { exec: function(le) {
return R._ctx.logger.i("idb-backend", "del: " + Te.lower + "~" + Te.upper), le.delete(Te);
}, callback: function(le) {
R._ctx.logger.i("idb-backend", "del result: " + !(le == null || !le.error));
} };
R._idb.run(Le);
}
} };
this._idb.run(he);
}, ue._mergeGetAll = function(w) {
return w.length ? w.reduce(function(R, he) {
return "" + R + he.value + `
`;
}, "") : "";
}, c()(De, [{ key: "isActive", get: function() {
return this._idb.state !== "error";
} }]);
}()];
function Be(De, ue, w) {
var R = /* @__PURE__ */ new Date();
typeof De != "string" && (De = De.toString());
var he = R.toLocaleString() + "." + R.getMilliseconds().toString().padStart(3, "0") + "|" + De + "|";
return ue.forEach(function(oe) {
he += typeof oe == "object" ? JSON.stringify(oe) + " " : oe + " ";
}), he.length > w ? he.substring(0, w) : he;
}
function Fe(De) {
return De.join(`
`);
}
var He = function() {
function De(w) {
var R = this;
this._ctx = void 0, this._backend = void 0, this._delayTimer = void 0, this._logCache = [], this._loggerForAdd = void 0, this._downloadHref = void 0, this._startDelay = function() {
R._delayTimer = setInterval(function() {
R._saveLog(!0);
}, 1e3);
}, this._stopDelay = function() {
R._delayTimer && (clearTimeout(R._delayTimer), R._delayTimer = void 0);
}, I("kwai-video-local-log", "1.0.13"), this._ctx = new N(w);
var he = function(oe) {
for (var Te = arguments.length, Le = new Array(Te > 1 ? Te - 1 : 0), le = 1; le < Te; le++)
Le[le - 1] = arguments[le];
R.addLog.apply(R, [oe].concat(Le));
};
this._loggerForAdd = { e: he, w: he, i: he, d: he, v: he }, this._ctx.logger.setOutput(this._loggerForAdd), this._ctx.logger.i("kwai-video-local-log", "constructor", w, this._ctx.config), this._backend = function(oe) {
for (var Te = 0; Te < Ce.length; Te++) {
var Le = Ce[Te];
if (Le != null && Le.isSupported())
return new Le(oe);
}
}(this._ctx), this._backend && this._startDelay();
}
De.isSupported = function() {
return function() {
for (var w = 0; w < Ce.length; w++) {
var R = Ce[w];
if (R != null && R.isSupported())
return !0;
}
return !1;
}();
};
var ue = De.prototype;
return ue.addLog = function(w) {
for (var R = arguments.length, he = new Array(R > 1 ? R - 1 : 0), oe = 1; oe < R; oe++)
he[oe - 1] = arguments[oe];
this._logCache.push(Be(w, he, this._ctx.config.maxLogLen)), this._saveLog();
}, ue.cleanLog = function() {
var w;
this._ctx.logger.i("kwai-video-local-log", "clean"), (w = this._backend) == null || w.clean();
}, ue.exportLog = function() {
var w = this;
return this._ctx.logger.i("kwai-video-local-log", "export log"), new Promise(function(R, he) {
w._backend ? w._backend.exportLog().then(function(oe) {
R(Fe([oe].concat(w._logCache)));
}) : R("");
});
}, ue.downloadLog = function(w) {
var R = this;
this._ctx.logger.i("kwai-video-local-log", "download log: " + w), this._destroyDownloadHref(), this.exportLog().then(function(he) {
var oe = new Blob([he], { type: "text/plain" });
if (document) {
var Te = document.createElement("a");
R._downloadHref = Te.href = URL.createObjectURL(oe), Te.download = w || "Log_web_" + (/* @__PURE__ */ new Date()).toLocaleString() + ".log", document.body.appendChild(Te), Te.click(), Te.remove();
} else
console.log("无document,当前是否在worker中");
});
}, ue.destroy = function() {
var w;
this._destroyDownloadHref(), (w = this._backend) == null || w.destroy(), this._stopDelay();
}, ue.getLoggerForAdd = function() {
return this._loggerForAdd;
}, ue._destroyDownloadHref = function() {
try {
this._downloadHref && (URL.revokeObjectURL(this._downloadHref), this._downloadHref = void 0);
} catch (w) {
}
}, ue._saveLog = function(w) {
if (w === void 0 && (w = !1), this._backend && this._backend.isActive && (this._logCache.length >= this._ctx.config.idbMaxFoldLog || this._logCache.length > 0 && w)) {
var R = Fe(this._logCache);
this._logCache.splice(0, this._logCache.length), R && this._backend.saveLog(R);
}
}, c()(De, null, [{ key: "version", get: function() {
return "1.0.13";
} }]);
}();
r.default = He;
}]);
on === void 0 && console.error("esm-webpack-plugin: nothing exported!");
on.KwaiVideoLocalLog;
const hu = on.LogLevel, Ci = on.DefaultLogger, lu = on.Logger, pf = on.printVersion;
on.DEFAULT_LOG_LEVEL;
on.default;
var _f = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function Af(n) {
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
}
var fo = { exports: {} }, On = typeof Reflect == "object" ? Reflect : null, yc = On && typeof On.apply == "function" ? On.apply : function(n, r, a) {
return Function.prototype.apply.call(n, r, a);
}, wa;
On && typeof On.ownKeys == "function" ? wa = On.ownKeys : Object.getOwnPropertySymbols ? wa = function(n) {
return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n));
} : wa = function(n) {
return Object.getOwnPropertyNames(n);
};
function vf(n) {
console && console.warn && console.warn(n);
}
var du = Number.isNaN || function(n) {
return n !== n;
};
function Xt() {
Xt.init.call(this);
}
fo.exports = Xt;
fo.exports.once = yf;
Xt.EventEmitter = Xt;
Xt.prototype._events = void 0;
Xt.prototype._eventsCount = 0;
Xt.prototype._maxListeners = void 0;
var Ec = 10;
function Wa(n) {
if (typeof n != "function")
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof n);
}
Object.defineProperty(Xt, "defaultMaxListeners", {
enumerable: !0,
get: function() {
return Ec;
},
set: function(n) {
if (typeof n != "number" || n < 0 || du(n))
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + n + ".");
Ec = n;
}
});
Xt.init = function() {
(this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
};
Xt.prototype.setMaxListeners = function(n) {
if (typeof n != "number" || n < 0 || du(n))
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + ".");
return this._maxListeners = n, this;
};
function fu(n) {
return n._maxListeners === void 0 ? Xt.defaultMaxListeners : n._maxListeners;
}
Xt.prototype.getMaxListeners = function() {
return fu(this);
};
Xt.prototype.emit = function(n) {
for (var r = [], a = 1; a < arguments.length; a++)
r.push(arguments[a]);
var u = n === "error", c = this._events;
if (c !== void 0)
u = u && c.error === void 0;
else if (!u)
return !1;
if (u) {
var _;
if (r.length > 0 && (_ = r[0]), _ instanceof Error)
throw _;
var y = new Error("Unhandled error." + (_ ? " (" + _.message + ")" : ""));
throw y.context = _, y;
}
var T = c[n];
if (T === void 0)
return !1;
if (typeof T == "function")
yc(T, this, r);
else
for (var I = T.length, V = mu(T, I), a = 0; a < I; ++a)
yc(V[a], this, r);
return !0;
};
function pu(n, r, a, u) {
var c, _, y;
if (Wa(a), _ = n._events, _ === void 0 ? (_ = n._events = /* @__PURE__ */ Object.create(null), n._eventsCount = 0) : (_.newListener !== void 0 && (n.emit(
"newListener",
r,
a.listener ? a.listener : a
), _ = n._events), y = _[r]), y === void 0)
y = _[r] = a, ++n._eventsCount;
else if (typeof y == "function" ? y = _[r] = u ? [a, y] : [y, a] : u ? y.unshift(a) : y.push(a), c = fu(n), c > 0 && y.length > c && !y.warned) {
y.warned = !0;
var T = new Error("Possible EventEmitter memory leak detected. " + y.length + " " + String(r) + " listeners added. Use emitter.setMaxListeners() to increase limit");
T.name = "MaxListenersExceededWarning", T.emitter = n, T.type = r, T.count = y.length, vf(T);
}
return n;
}
Xt.prototype.addListener = function(n, r) {
return pu(this, n, r, !1);
};
Xt.prototype.on = Xt.prototype.addListener;
Xt.prototype.prependListener = function(n, r) {
return pu(this, n, r, !0);
};
function mf() {
if (!this.fired)
return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
}
function _u(n, r, a) {
var u = { fired: !1, wrapFn: void 0, target: n, type: r, listener: a }, c = mf.bind(u);
return c.listener = a, u.wrapFn = c, c;
}
Xt.prototype.once = function(n, r) {
return Wa(r), this.on(n, _u(this, n, r)), this;
};
Xt.prototype.prependOnceListener = function(n, r) {
return Wa(r), this.prependListener(n, _u(this, n, r)), this;
};
Xt.prototype.removeListener = function(n, r) {
var a, u, c, _, y;
if (Wa(r), u = this._events, u === void 0)
return this;
if (a = u[n], a === void 0)
return this;
if (a === r || a.listener === r)
--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete u[n], u.removeListener && this.emit("removeListener", n, a.listener || r));
else if (typeof a != "function") {
for (c = -1, _ = a.length - 1; _ >= 0; _--)
if (a[_] === r || a[_].listener === r) {
y = a[_].listener, c = _;
break;
}
if (c < 0)
return this;
c === 0 ? a.shift() : gf(a, c), a.length === 1 && (u[n] = a[0]), u.removeListener !== void 0 && this.emit("removeListener", n, y || r);
}
return this;
};
Xt.prototype.off = Xt.prototype.removeListener;
Xt.prototype.removeAllListeners = function(n) {
var r, a, u;
if (a = this._events, a === void 0)
return this;
if (a.removeListener === void 0)
return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : a[n] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete a[n]), this;
if (arguments.length === 0) {
var c = Object.keys(a), _;
for (u = 0; u < c.length; ++u)
_ = c[u], _ !== "removeListener" && this.removeAllListeners(_);
return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this;
}
if (r = a[n], typeof r == "function")
this.removeListener(n, r);
else if (r !== void 0)
for (u = r.length - 1; u >= 0; u--)
this.removeListener(n, r[u]);
return this;
};
function Au(n, r, a) {
var u = n._events;
if (u === void 0)
return [];
var c = u[r];
return c === void 0 ? [] : typeof c == "function" ? a ? [c.listener || c] : [c] : a ? bf(c) : mu(c, c.length);
}
Xt.prototype.listeners = function(n) {
return Au(this, n, !0);
};
Xt.prototype.rawListeners = function(n) {
return Au(this, n, !1);
};
Xt.listenerCount = function(n, r) {
return typeof n.listenerCount == "function" ? n.listenerCount(r) : vu.call(n, r);
};
Xt.prototype.listenerCount = vu;
function vu(n) {
var r = this._events;
if (r !== void 0) {
var a = r[n];
if (typeof a == "function")
return 1;
if (a !== void 0)
return a.length;
}
return 0;
}
Xt.prototype.eventNames = function() {
return this._eventsCount > 0 ? wa(this._events) : [];
};
function mu(n, r) {
for (var a = new Array(r), u = 0; u < r; ++u)
a[u] = n[u];
return a;
}
function gf(n, r) {
for (; r + 1 < n.length; r++)
n[r] = n[r + 1];
n.pop();
}
function bf(n) {
for (var r = new Array(n.length), a = 0; a < r.length; ++a)
r[a] = n[a].listener || n[a];
return r;
}
function yf(n, r) {
return new Promise(function(a, u) {
function c(y) {
n.removeListener(r, _), u(y);
}
function _() {
typeof n.removeListener == "function" && n.removeListener("error", c), a([].slice.call(arguments));
}
gu(n, r, _, { once: !0 }), r !== "error" && Ef(n, c, { once: !0 });
});
}
function Ef(n, r, a) {
typeof n.on == "function" && gu(n, "error", r, a);
}
function gu(n, r, a, u) {
if (typeof n.on == "function")
u.once ? n.once(r, a) : n.on(r, a);
else if (typeof n.addEventListener == "function")
n.addEventListener(r, function c(_) {
u.once && n.removeEventListener(r, c), a(_);
});
else
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof n);
}
var Cf = fo.exports, bu = function() {
if (typeof Map < "u")
return Map;
function n(r, a) {
var u = -1;
return r.some(function(c, _) {
return c[0] === a ? (u = _, !0) : !1;
}), u;
}
return (
/** @class */
function() {
function r() {
this.__entries__ = [];
}
return Object.defineProperty(r.prototype, "size", {
/**
* @returns {boolean}
*/
get: function() {
return this.__entries__.length;
},
enumerable: !0,
configurable: !0
}), r.prototype.get = function(a) {
var u = n(this.__entries__, a), c = this.__entries__[u];
return c && c[1];
}, r.prototype.set = function(a, u) {
var c = n(this.__entries__, a);
~c ? this.__entries__[c][1] = u : this.__entries__.push([a, u]);
}, r.prototype.delete = function(a) {
var u = this.__entries__, c = n(u, a);
~c && u.splice(c, 1);
}, r.prototype.has = function(a) {
return !!~n(this.__entries__, a);
}, r.prototype.clear = function() {
this.__entries__.splice(0);
}, r.prototype.forEach = function(a, u) {
u === void 0 && (u = null);
for (var c = 0, _ = this.__entries__; c < _.length; c++) {
var y = _[c];
a.call(u, y[1], y[0]);
}
}, r;
}()
);
}(), Ks = typeof window < "u" && typeof document < "u" && window.document === document, Pa = function() {
return typeof global < "u" && global.Math === Math ? global : typeof self < "u" && self.Math === Math ? self : typeof window < "u" && window.Math === Math ? window : Function("return this")();
}(), If = function() {
return typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(Pa) : function(n) {
return setTimeout(function() {
return n(Date.now());
}, 1e3 / 60);
};
}(), Tf = 2;
function Rf(n, r) {
var a = !1, u = !1, c = 0;
function _() {
a && (a = !1, n()), u && T();
}
function y() {
If(_);
}
function T() {
var I = Date.now();
if (a) {
if (I - c < Tf)
return;
u = !0;
} else
a = !0, u = !1, setTimeout(y, r);
c = I;
}
return T;
}
var wf = 20, Df = ["top", "right", "bottom", "left", "width", "height", "size", "weight"], Sf = typeof MutationObserver < "u", Of = (
/** @class */
function() {
function n() {
this.connected_ = !1, this.mutationEventsAdded_ = !1, this.mutationsObserver_ = null, this.observers_ = [], this.onTransitionEnd_ = this.onTransitionEnd_.bind(this), this.refresh = Rf(this.refresh.bind(this), wf);
}
return n.prototype.addObserver = function(r) {
~this.observers_.indexOf(r) || this.observers_.push(r), this.connected_ || this.connect_();
}, n.prototype.removeObserver = function(r) {
var a = this.observers_, u = a.indexOf(r);
~u && a.splice(u, 1), !a.length && this.connected_ && this.disconnect_();
}, n.prototype.refresh = function() {
var r = this.updateObservers_();
r && this.refresh();
}, n.prototype.updateObservers_ = function() {
var r = this.observers_.filter(function(a) {
return a.gatherActive(), a.hasActive();
});
return r.forEach(function(a) {
return a.broadcastActive();
}), r.length > 0;
}, n.prototype.connect_ = function() {
!Ks || this.connected_ || (document.addEventListener("transitionend", this.onTransitionEnd_), window.addEventListener("resize", this.refresh), Sf ? (this.mutationsObserver_ = new MutationObserver(this.refresh), this.mutationsObserver_.observe(document, {
attributes: !0,
childList: !0,
characterData: !0,
subtree: !0
})) : (document.addEventListener("DOMSubtreeModified", this.refresh), this.mutationEventsAdded_ = !0), this.connected_ = !0);
}, n.prototype.disconnect_ = function() {
!Ks || !this.connected_ || (document.removeEventListener("transitionend", this.onTransitionEnd_), window.removeEventListener("resize", this.refresh), this.mutationsObserver_ && this.mutationsObserver_.disconnect(), this.mutationEventsAdded_ && document.removeEventListener("DOMSubtreeModified", this.refresh), this.mutationsObserver_ = null, this.mutationEventsAdded_ = !1, this.connected_ = !1);
}, n.prototype.onTransitionEnd_ = function(r) {
var a = r.propertyName, u = a === void 0 ? "" : a, c = Df.some(function(_) {
return !!~u.indexOf(_);
});
c && this.refresh();
}, n.getInstance = function() {
return this.instance_ || (this.instance_ = new n()), this.instance_;
}, n.instance_ = null, n;
}()
), yu = function(n, r) {
for (var a = 0, u = Object.keys(r); a < u.length; a++) {
var c = u[a];
Object.defineProperty(n, c, {
value: r[c],
enumerable: !1,
writable: !1,
configurable: !0
});
}
return n;
}, kn = function(n) {
var r = n && n.ownerDocument && n.ownerDocument.defaultView;
return r || Pa;
}, Eu = Qa(0, 0, 0, 0);
function Va(n) {
return parseFloat(n) || 0;
}
function Cc(n) {
for (var r = [], a = 1; a < arguments.length; a++)
r[a - 1] = arguments[a];
return r.reduce(function(u, c) {
var _ = n["border-" + c + "-width"];
return u + Va(_);
}, 0);
}
function Lf(n) {
for (var r = ["top", "right", "bottom", "left"], a = {}, u = 0, c = r; u < c.length; u++) {
var _ = c[u], y = n["padding-" + _];
a[_] = Va(y);
}
return a;
}
function Nf(n) {
var r = n.getBBox();
return Qa(0, 0, r.width, r.height);
}
function kf(n) {
var r = n.clientWidth, a = n.clientHeight;
if (!r && !a)
return Eu;
var u = kn(n).getComputedStyle(n), c = Lf(u), _ = c.left + c.right, y = c.top + c.bottom, T = Va(u.width), I = Va(u.height);
if (u.boxSizing === "border-box" && (Math.round(T + _) !== r && (T -= Cc(u, "left", "right") + _), Math.round(I + y) !== a && (I -= Cc(u, "top", "bottom") + y)), !xf(n)) {
var V = Math.round(T + _) - r, l = Math.round(I + y) - a;
Math.abs(V) !== 1 && (T -= V), Math.abs(l) !== 1 && (I -= l);
}
return Qa(c.left, c.top, T, I);
}
var Mf = function() {
return typeof SVGGraphicsElement < "u" ? function(n) {
return n instanceof kn(n).SVGGraphicsElement;
} : function(n) {
return n instanceof kn(n).SVGElement && typeof n.getBBox == "function";
};
}();
function xf(n) {
return n === kn(n).document.documentElement;
}
function Pf(n) {
return Ks ? Mf(n) ? Nf(n) : kf(n) : Eu;
}
function Vf(n) {
var r = n.x, a = n.y, u = n.width, c = n.height, _ = typeof DOMRectReadOnly < "u" ? DOMRectReadOnly : Object, y = Object.create(_.prototype);
return yu(y, {
x: r,
y: a,
width: u,
height: c,
top: a,
right: r + u,
bottom: c + a,
left: r
}), y;
}
function Qa(n, r, a, u) {
return { x: n, y: r, width: a, height: u };
}
var Uf = (
/** @class */
function() {
function n(r) {
this.broadcastWidth = 0, this.broadcastHeight = 0, this.cont