@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,261 lines (1,260 loc) • 1.56 MB
JavaScript
var tA = Object.defineProperty;
var _l = Object.getOwnPropertySymbols;
var iA = Object.prototype.hasOwnProperty, rA = Object.prototype.propertyIsEnumerable;
var Al = (r, i, n) => i in r ? tA(r, i, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[i] = n, vl = (r, i) => {
for (var n in i || (i = {}))
iA.call(i, n) && Al(r, n, i[n]);
if (_l)
for (var n of _l(i))
rA.call(i, n) && Al(r, n, i[n]);
return r;
};
var fo = (r, i, n) => new Promise((o, s) => {
var p = (C) => {
try {
y(n.next(C));
} catch (x) {
s(x);
}
}, g = (C) => {
try {
y(n.throw(C));
} catch (x) {
s(x);
}
}, y = (C) => C.done ? o(C.value) : Promise.resolve(C.value).then(p, g);
y((n = n.apply(r, i)).next());
});
import * as ra from "react";
import { jsx as nA } from "react/jsx-runtime";
Number.isFinite || (Number.isFinite = (r) => typeof r == "number" && isFinite(r));
Array.prototype.find || (Array.prototype.find = function(r, i) {
if (this === null || this === void 0)
throw new TypeError("Array.prototype.find called on null or undefined");
if (typeof r != "function")
throw new TypeError("callback must be a function");
const n = Object(this), o = n.length >>> 0;
for (let s = 0; s < o; s++)
if (r.call(i, n[s], s, n))
return n[s];
});
Array.prototype.findIndex || (Array.prototype.findIndex = function(r, i) {
if (this === null || this === void 0)
throw new TypeError("Array.prototype.findIndex called on null or undefined");
if (typeof r != "function")
throw new TypeError("callback must be a function");
const n = Object(this), o = n.length >>> 0;
for (let s = 0; s < o; s++)
if (s in n && r.call(i, n[s], s, n))
return s;
return -1;
});
Array.prototype.fill || (Array.prototype.fill = function(r, i = 0, n = this.length) {
if (this === null || this === void 0)
throw new TypeError("Array.prototype.fill called on null or undefined");
const o = Object(this), s = o.length >>> 0, p = i >> 0, g = n >> 0, y = p < 0 ? Math.max(s + p, 0) : Math.min(p, s), C = g < 0 ? Math.max(s + g, 0) : Math.min(g, s);
for (let x = y; x < C; x++)
o[x] = r;
return o;
});
var aA = Object.defineProperty, sA = (r, i, n) => i in r ? aA(r, i, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[i] = n, Au = (r, i, n) => (sA(r, typeof i != "symbol" ? i + "" : i, n), n), Un = function(r) {
var i = {};
function n(o) {
if (i[o])
return i[o].exports;
var s = i[o] = { i: o, l: !1, exports: {} };
return r[o].call(s.exports, s, s.exports, n), s.l = !0, s.exports;
}
return n.m = r, n.c = i, n.d = function(o, s, p) {
n.o(o, s) || Object.defineProperty(o, s, { enumerable: !0, get: p });
}, n.r = function(o) {
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(o, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(o, "__esModule", { value: !0 });
}, n.t = function(o, s) {
if (1 & s && (o = n(o)), 8 & s || 4 & s && typeof o == "object" && o && o.__esModule)
return o;
var p = /* @__PURE__ */ Object.create(null);
if (n.r(p), Object.defineProperty(p, "default", { enumerable: !0, value: o }), 2 & s && typeof o != "string")
for (var g in o)
n.d(p, g, function(y) {
return o[y];
}.bind(null, g));
return p;
}, n.n = function(o) {
var s = o && o.__esModule ? function() {
return o.default;
} : function() {
return o;
};
return n.d(s, "a", s), s;
}, n.o = function(o, s) {
return Object.prototype.hasOwnProperty.call(o, s);
}, n.p = "", n(n.s = 8);
}([function(r, i, n) {
var o = n(5);
function s(p, g) {
for (var y = 0; y < g.length; y++) {
var C = g[y];
C.enumerable = C.enumerable || !1, C.configurable = !0, "value" in C && (C.writable = !0), Object.defineProperty(p, o(C.key), C);
}
}
r.exports = function(p, g, y) {
return g && s(p.prototype, g), y && s(p, y), Object.defineProperty(p, "prototype", { writable: !1 }), p;
}, r.exports.__esModule = !0, r.exports.default = r.exports;
}, function(r, i) {
function n(o) {
return r.exports = n = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(s) {
return typeof s;
} : function(s) {
return s && typeof Symbol == "function" && s.constructor === Symbol && s !== Symbol.prototype ? "symbol" : typeof s;
}, r.exports.__esModule = !0, r.exports.default = r.exports, n(o);
}
r.exports = n, r.exports.__esModule = !0, r.exports.default = r.exports;
}, function(r, i, n) {
var o = n(7)();
r.exports = o;
try {
regeneratorRuntime = o;
} catch (s) {
typeof globalThis == "object" ? globalThis.regeneratorRuntime = o : Function("r", "regeneratorRuntime = r")(o);
}
}, function(r, i) {
function n() {
return r.exports = n = Object.assign ? Object.assign.bind() : function(o) {
for (var s = 1; s < arguments.length; s++) {
var p = arguments[s];
for (var g in p)
Object.prototype.hasOwnProperty.call(p, g) && (o[g] = p[g]);
}
return o;
}, r.exports.__esModule = !0, r.exports.default = r.exports, n.apply(this, arguments);
}
r.exports = n, r.exports.__esModule = !0, r.exports.default = r.exports;
}, function(r, i) {
function n(o, s, p, g, y, C, x) {
try {
var h = o[C](x), F = h.value;
} catch (R) {
return void p(R);
}
h.done ? s(F) : Promise.resolve(F).then(g, y);
}
r.exports = function(o) {
return function() {
var s = this, p = arguments;
return new Promise(function(g, y) {
var C = o.apply(s, p);
function x(F) {
n(C, g, y, x, h, "next", F);
}
function h(F) {
n(C, g, y, x, h, "throw", F);
}
x(void 0);
});
};
}, r.exports.__esModule = !0, r.exports.default = r.exports;
}, function(r, i, n) {
var o = n(1).default, s = n(6);
r.exports = function(p) {
var g = s(p, "string");
return o(g) == "symbol" ? g : g + "";
}, r.exports.__esModule = !0, r.exports.default = r.exports;
}, function(r, i, n) {
var o = n(1).default;
r.exports = function(s, p) {
if (o(s) != "object" || !s)
return s;
var g = s[Symbol.toPrimitive];
if (g !== void 0) {
var y = g.call(s, p || "default");
if (o(y) != "object")
return y;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (p === "string" ? String : Number)(s);
}, r.exports.__esModule = !0, r.exports.default = r.exports;
}, function(r, i, n) {
var o = n(1).default;
function s() {
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
r.exports = s = function() {
return g;
}, r.exports.__esModule = !0, r.exports.default = r.exports;
var p, g = {}, y = Object.prototype, C = y.hasOwnProperty, x = Object.defineProperty || function(de, X, ge) {
de[X] = ge.value;
}, h = typeof Symbol == "function" ? Symbol : {}, F = h.iterator || "@@iterator", R = h.asyncIterator || "@@asyncIterator", T = h.toStringTag || "@@toStringTag";
function D(de, X, ge) {
return Object.defineProperty(de, X, { value: ge, enumerable: !0, configurable: !0, writable: !0 }), de[X];
}
try {
D({}, "");
} catch (de) {
D = function(X, ge, Pe) {
return X[ge] = Pe;
};
}
function W(de, X, ge, Pe) {
var ae = X && X.prototype instanceof J ? X : J, q = Object.create(ae.prototype), m = new Re(Pe || []);
return x(q, "_invoke", { value: L(de, ge, m) }), q;
}
function j(de, X, ge) {
try {
return { type: "normal", arg: de.call(X, ge) };
} catch (Pe) {
return { type: "throw", arg: Pe };
}
}
g.wrap = W;
var O = "suspendedStart", K = "executing", z = "completed", B = {};
function J() {
}
function be() {
}
function $() {
}
var ye = {};
D(ye, F, function() {
return this;
});
var Be = Object.getPrototypeOf, Ve = Be && Be(Be(Oe([])));
Ve && Ve !== y && C.call(Ve, F) && (ye = Ve);
var je = $.prototype = J.prototype = Object.create(ye);
function we(de) {
["next", "throw", "return"].forEach(function(X) {
D(de, X, function(ge) {
return this._invoke(X, ge);
});
});
}
function ue(de, X) {
function ge(ae, q, m, ve) {
var U = j(de[ae], de, q);
if (U.type !== "throw") {
var M = U.arg, ne = M.value;
return ne && o(ne) == "object" && C.call(ne, "__await") ? X.resolve(ne.__await).then(function(Le) {
ge("next", Le, m, ve);
}, function(Le) {
ge("throw", Le, m, ve);
}) : X.resolve(ne).then(function(Le) {
M.value = Le, m(M);
}, function(Le) {
return ge("throw", Le, m, ve);
});
}
ve(U.arg);
}
var Pe;
x(this, "_invoke", { value: function(ae, q) {
function m() {
return new X(function(ve, U) {
ge(ae, q, ve, U);
});
}
return Pe = Pe ? Pe.then(m, m) : m();
} });
}
function L(de, X, ge) {
var Pe = O;
return function(ae, q) {
if (Pe === K)
throw Error("Generator is already running");
if (Pe === z) {
if (ae === "throw")
throw q;
return { value: p, done: !0 };
}
for (ge.method = ae, ge.arg = q; ; ) {
var m = ge.delegate;
if (m) {
var ve = w(m, ge);
if (ve) {
if (ve === B)
continue;
return ve;
}
}
if (ge.method === "next")
ge.sent = ge._sent = ge.arg;
else if (ge.method === "throw") {
if (Pe === O)
throw Pe = z, ge.arg;
ge.dispatchException(ge.arg);
} else
ge.method === "return" && ge.abrupt("return", ge.arg);
Pe = K;
var U = j(de, X, ge);
if (U.type === "normal") {
if (Pe = ge.done ? z : "suspendedYield", U.arg === B)
continue;
return { value: U.arg, done: ge.done };
}
U.type === "throw" && (Pe = z, ge.method = "throw", ge.arg = U.arg);
}
};
}
function w(de, X) {
var ge = X.method, Pe = de.iterator[ge];
if (Pe === p)
return X.delegate = null, ge === "throw" && de.iterator.return && (X.method = "return", X.arg = p, w(de, X), X.method === "throw") || ge !== "return" && (X.method = "throw", X.arg = new TypeError("The iterator does not provide a '" + ge + "' method")), B;
var ae = j(Pe, de.iterator, X.arg);
if (ae.type === "throw")
return X.method = "throw", X.arg = ae.arg, X.delegate = null, B;
var q = ae.arg;
return q ? q.done ? (X[de.resultName] = q.value, X.next = de.nextLoc, X.method !== "return" && (X.method = "next", X.arg = p), X.delegate = null, B) : q : (X.method = "throw", X.arg = new TypeError("iterator result is not an object"), X.delegate = null, B);
}
function le(de) {
var X = { tryLoc: de[0] };
1 in de && (X.catchLoc = de[1]), 2 in de && (X.finallyLoc = de[2], X.afterLoc = de[3]), this.tryEntries.push(X);
}
function oe(de) {
var X = de.completion || {};
X.type = "normal", delete X.arg, de.completion = X;
}
function Re(de) {
this.tryEntries = [{ tryLoc: "root" }], de.forEach(le, this), this.reset(!0);
}
function Oe(de) {
if (de || de === "") {
var X = de[F];
if (X)
return X.call(de);
if (typeof de.next == "function")
return de;
if (!isNaN(de.length)) {
var ge = -1, Pe = function ae() {
for (; ++ge < de.length; )
if (C.call(de, ge))
return ae.value = de[ge], ae.done = !1, ae;
return ae.value = p, ae.done = !0, ae;
};
return Pe.next = Pe;
}
}
throw new TypeError(o(de) + " is not iterable");
}
return be.prototype = $, x(je, "constructor", { value: $, configurable: !0 }), x($, "constructor", { value: be, configurable: !0 }), be.displayName = D($, T, "GeneratorFunction"), g.isGeneratorFunction = function(de) {
var X = typeof de == "function" && de.constructor;
return !!X && (X === be || (X.displayName || X.name) === "GeneratorFunction");
}, g.mark = function(de) {
return Object.setPrototypeOf ? Object.setPrototypeOf(de, $) : (de.__proto__ = $, D(de, T, "GeneratorFunction")), de.prototype = Object.create(je), de;
}, g.awrap = function(de) {
return { __await: de };
}, we(ue.prototype), D(ue.prototype, R, function() {
return this;
}), g.AsyncIterator = ue, g.async = function(de, X, ge, Pe, ae) {
ae === void 0 && (ae = Promise);
var q = new ue(W(de, X, ge, Pe), ae);
return g.isGeneratorFunction(X) ? q : q.next().then(function(m) {
return m.done ? m.value : q.next();
});
}, we(je), D(je, T, "Generator"), D(je, F, function() {
return this;
}), D(je, "toString", function() {
return "[object Generator]";
}), g.keys = function(de) {
var X = Object(de), ge = [];
for (var Pe in X)
ge.push(Pe);
return ge.reverse(), function ae() {
for (; ge.length; ) {
var q = ge.pop();
if (q in X)
return ae.value = q, ae.done = !1, ae;
}
return ae.done = !0, ae;
};
}, g.values = Oe, Re.prototype = { constructor: Re, reset: function(de) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = p, this.done = !1, this.delegate = null, this.method = "next", this.arg = p, this.tryEntries.forEach(oe), !de)
for (var X in this)
X.charAt(0) === "t" && C.call(this, X) && !isNaN(+X.slice(1)) && (this[X] = p);
}, stop: function() {
this.done = !0;
var de = this.tryEntries[0].completion;
if (de.type === "throw")
throw de.arg;
return this.rval;
}, dispatchException: function(de) {
if (this.done)
throw de;
var X = this;
function ge(U, M) {
return q.type = "throw", q.arg = de, X.next = U, M && (X.method = "next", X.arg = p), !!M;
}
for (var Pe = this.tryEntries.length - 1; Pe >= 0; --Pe) {
var ae = this.tryEntries[Pe], q = ae.completion;
if (ae.tryLoc === "root")
return ge("end");
if (ae.tryLoc <= this.prev) {
var m = C.call(ae, "catchLoc"), ve = C.call(ae, "finallyLoc");
if (m && ve) {
if (this.prev < ae.catchLoc)
return ge(ae.catchLoc, !0);
if (this.prev < ae.finallyLoc)
return ge(ae.finallyLoc);
} else if (m) {
if (this.prev < ae.catchLoc)
return ge(ae.catchLoc, !0);
} else {
if (!ve)
throw Error("try statement without catch or finally");
if (this.prev < ae.finallyLoc)
return ge(ae.finallyLoc);
}
}
}
}, abrupt: function(de, X) {
for (var ge = this.tryEntries.length - 1; ge >= 0; --ge) {
var Pe = this.tryEntries[ge];
if (Pe.tryLoc <= this.prev && C.call(Pe, "finallyLoc") && this.prev < Pe.finallyLoc) {
var ae = Pe;
break;
}
}
ae && (de === "break" || de === "continue") && ae.tryLoc <= X && X <= ae.finallyLoc && (ae = null);
var q = ae ? ae.completion : {};
return q.type = de, q.arg = X, ae ? (this.method = "next", this.next = ae.finallyLoc, B) : this.complete(q);
}, complete: function(de, X) {
if (de.type === "throw")
throw de.arg;
return de.type === "break" || de.type === "continue" ? this.next = de.arg : de.type === "return" ? (this.rval = this.arg = de.arg, this.method = "return", this.next = "end") : de.type === "normal" && X && (this.next = X), B;
}, finish: function(de) {
for (var X = this.tryEntries.length - 1; X >= 0; --X) {
var ge = this.tryEntries[X];
if (ge.finallyLoc === de)
return this.complete(ge.completion, ge.afterLoc), oe(ge), B;
}
}, catch: function(de) {
for (var X = this.tryEntries.length - 1; X >= 0; --X) {
var ge = this.tryEntries[X];
if (ge.tryLoc === de) {
var Pe = ge.completion;
if (Pe.type === "throw") {
var ae = Pe.arg;
oe(ge);
}
return ae;
}
}
throw Error("illegal catch attempt");
}, delegateYield: function(de, X, ge) {
return this.delegate = { iterator: Oe(de), resultName: X, nextLoc: ge }, this.method === "next" && (this.arg = p), B;
} }, g;
}
r.exports = s, r.exports.__esModule = !0, r.exports.default = r.exports;
}, function(r, i, n) {
n.r(i), n.d(i, "KwaiVideoLocalLog", function() {
return je;
}), n.d(i, "LogLevel", function() {
return R;
}), n.d(i, "DefaultLogger", function() {
return j;
}), n.d(i, "Logger", function() {
return W;
}), n.d(i, "printVersion", function() {
return C;
}), n.d(i, "DEFAULT_LOG_LEVEL", function() {
return T;
});
var o = n(0), s = n.n(o), p = n(3), g = n.n(p), y = { idbName: "kwai-video-local-log", idbMaxDataCount: 25e3, idbMaxFoldLog: 20, maxLogLen: 4096 };
function C(we, ue) {
console.log("%c " + we + " %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 x = function() {
function we() {
this.timeout = 6048e5;
}
var ue = we.prototype;
return ue.write = function(L, w) {
if (we.available)
try {
localStorage.setItem(L, JSON.stringify({ value: w, time: Date.now() }));
} catch (le) {
}
}, ue.read = function(L, w) {
if (w === void 0 && (w = !0), we.available)
try {
var le = localStorage.getItem(L);
if (le) {
var oe = JSON.parse(le), Re = oe.value, Oe = oe.time, de = Oe === void 0 ? 0 : Oe;
if (!w || Date.now() - de < (typeof w == "number" ? w : this.timeout))
return Re;
}
} catch (X) {
}
}, s()(we, null, [{ key: "available", get: function() {
if (we._available === void 0)
try {
localStorage.setItem("alg", "test"), we._available = !0;
} catch (L) {
we._available = !1;
}
return we._available;
} }]);
}();
x._available = void 0;
var h, F = x, R = function(we) {
return we.NONE = "none", we.ERROR = "e", we.WARN = "w", we.INFO = "i", we.DEBUG = "d", we.VERBOSE = "v", we;
}({}), T = R.ERROR, D = ((h = {})[R.NONE] = { value: 1, str: "N" }, h[R.ERROR] = { value: 100, str: "E" }, h[R.WARN] = { value: 200, str: "W" }, h[R.INFO] = { value: 300, str: "I" }, h[R.DEBUG] = { value: 400, str: "D" }, h[R.VERBOSE] = { value: 500, str: "V" }, h), W = function() {
function we(L) {
if (this._name = "kwai-v", this._level = T, this._id = -1, this._output = void 0, this._workerTag = "main", typeof location < "u" && location.protocol === "blob:") {
var w, le = location.href.split("/"), oe = (w = le[le.length - 1]) == null ? void 0 : w.match(/(\w+)-/);
oe && (this._workerTag = L ? L + "-" + oe[1] : oe[1]);
} else
L && (this._workerTag = L);
}
we.loadLogLevel = function(L, w) {
if (w === void 0 && (w = !0), location.href) {
var le = new RegExp(L + "=([a-z]{1})"), oe = location.href.match(le);
if (oe && oe.length > 1) {
var Re = oe[1];
if (this._isValueInLevel(Re))
return Re;
}
}
var Oe = new F().read(L, w);
if (this._isValueInLevel(Oe))
return Oe;
}, we.saveLogLevel = function(L, w) {
this._isValueInLevel(w) && new F().write(L, w);
}, we._isValueInLevel = function(L) {
return Object.values(R).indexOf(L) !== -1;
};
var ue = we.prototype;
return ue.setOutput = function(L) {
return this._output = L, this;
}, ue.setLevel = function(L) {
return this._level = L, this;
}, ue.setId = function(L) {
return this._id = L, this;
}, ue.setName = function(L) {
return this._name = L, this;
}, ue.getLevel = function() {
return this._level;
}, ue.getOutput = function() {
return this._output;
}, ue.hasOutput = function() {
return !!this._output;
}, ue.e = function(L) {
if (this._isLevelEnabled(this._level, R.ERROR)) {
for (var w = arguments.length, le = new Array(w > 1 ? w - 1 : 0), oe = 1; oe < w; oe++)
le[oe - 1] = arguments[oe];
var Re = this._printLog(R.ERROR, L, le);
try {
var Oe;
(Oe = this._output) == null || Oe.e.apply(Oe, [Re].concat(le));
} catch (de) {
}
}
}, ue.w = function(L) {
if (this._isLevelEnabled(this._level, R.WARN)) {
for (var w = arguments.length, le = new Array(w > 1 ? w - 1 : 0), oe = 1; oe < w; oe++)
le[oe - 1] = arguments[oe];
var Re = this._printLog(R.WARN, L, le);
try {
var Oe;
(Oe = this._output) == null || Oe.w.apply(Oe, [Re].concat(le));
} catch (de) {
}
}
}, ue.i = function(L) {
if (this._isLevelEnabled(this._level, R.INFO)) {
for (var w = arguments.length, le = new Array(w > 1 ? w - 1 : 0), oe = 1; oe < w; oe++)
le[oe - 1] = arguments[oe];
var Re = this._printLog(R.INFO, L, le);
try {
var Oe;
(Oe = this._output) == null || Oe.i.apply(Oe, [Re].concat(le));
} catch (de) {
}
}
}, ue.d = function(L) {
if (this._isLevelEnabled(this._level, R.DEBUG)) {
for (var w = arguments.length, le = new Array(w > 1 ? w - 1 : 0), oe = 1; oe < w; oe++)
le[oe - 1] = arguments[oe];
var Re = this._printLog(R.DEBUG, L, le);
try {
var Oe;
(Oe = this._output) == null || Oe.d.apply(Oe, [Re].concat(le));
} catch (de) {
}
}
}, ue.v = function(L) {
if (this._isLevelEnabled(this._level, R.VERBOSE)) {
for (var w = arguments.length, le = new Array(w > 1 ? w - 1 : 0), oe = 1; oe < w; oe++)
le[oe - 1] = arguments[oe];
var Re = this._printLog(R.VERBOSE, L, le);
try {
var Oe;
(Oe = this._output) == null || Oe.v.apply(Oe, [Re].concat(le));
} catch (de) {
}
}
}, ue._isLevelEnabled = function(L, w) {
return D[L].value >= D[w].value;
}, ue._printLog = function(L, w, le) {
var oe, Re, Oe = typeof w;
if (Oe === "object")
w = ((Re = w) == null ? void 0 : Re.constructor.name) || "unknown";
else if (Oe === "function") {
var de;
w = ((de = Object.getOwnPropertyDescriptor(w, "name")) == null ? void 0 : de.value) || "unknown";
}
var X, ge, Pe = (((oe = D[L]) == null ? void 0 : oe.str) || "") + "|" + this._name + "[" + (typeof this._id == "function" ? this._id() : this._id) + "][" + this._workerTag + "]::" + w;
return L === R.ERROR ? (X = console).error.apply(X, [Pe].concat(le.slice(0))) : (ge = console).log.apply(ge, [Pe].concat(le.slice(0))), Pe;
}, we;
}(), j = new W(), O = function() {
return s()(function we(ue) {
this._logger = void 0, this._id = 0, this._config = y, this._id = we._id, we._id++, this._logger = new W().setId(this._id).setLevel(R.INFO), this._config = g()({}, y, 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 (中国标准时间)";
} }]);
}();
O._id = 0;
var K = n(4), z = n.n(K), B = n(2), J = n.n(B), be = function() {
function we(L, w, le, oe, Re) {
var Oe = this;
Re === void 0 && (Re = 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 (; Oe._taskQueue.length; ) {
var de = Oe._taskQueue.shift();
de && Oe.run(de.task, de.mode);
}
}, this._logger = L, this._name = w, this._storeName = le, this._dbIndex = oe, this._version = Re;
}
var ue = we.prototype;
return ue.init = function() {
var L = this;
if (!this._openReq && indexedDB) {
var w = this._openReq = indexedDB.open(this._name, this._version);
this._logger.i("idb-wrapper", "open", w), w.onerror = function() {
L._logger.i("idb-wrapper", "open error.");
}, w.onsuccess = function() {
L._logger.i("idb-wrapper", "open success."), L._runTaskQueue();
}, w.onupgradeneeded = function() {
L._logger.i("idb-wrapper", "open upgradeneeded."), w.result.objectStoreNames.contains(L._storeName) && w.result.deleteObjectStore(L._storeName);
var le = w.result.createObjectStore(L._storeName, { keyPath: "id", autoIncrement: !0 });
L._dbIndex && L._dbIndex.forEach(function(oe) {
le.createIndex(oe.name, oe.keyPath, oe.option);
});
};
}
}, ue.run = function(L, w) {
if (w === void 0 && (w = "readwrite"), this.init(), this._openReq && this._openReq.readyState === "done" && !this._openReq.error)
return this._doTask(L, w);
this.state !== "error" && (this._taskQueue.push({ task: L, mode: w }), this._taskQueue.length > 1e3 && this._taskQueue.shift());
}, ue.close = function() {
var L = 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() {
L.close();
});
}, ue.destroy = function() {
this._logger.i("idb-wrapper", "destroy"), this.close(), this._taskQueue = [];
}, ue._doTask = function(L, w) {
var le = this;
if (w === void 0 && (w = "readwrite"), this._openReq && !this._openReq.error)
try {
this._isTransactionActive = !0;
var oe = this._openReq.result.transaction(this._storeName, w), Re = void 0;
oe.oncomplete = function() {
le._isTransactionActive = !1, L.callback && L.callback(Re), le._runTaskQueue();
}, oe.onabort = oe.onerror = function() {
le._isTransactionActive = !1, L.callback && L.callback(Re), le._runTaskQueue();
}, Re = L.exec(oe.objectStore(this._storeName));
} catch (Oe) {
}
else
L.callback && L.callback();
}, s()(we, [{ key: "isTransactionActive", get: function() {
return this._isTransactionActive;
} }, { key: "state", get: function() {
return this._openReq && this._openReq.readyState === "done" ? this._openReq.error ? "error" : "ready" : "idle";
} }]);
}(), $ = [{ name: "id", keyPath: "id", option: { unique: !0 } }], ye = [function() {
function we(L) {
this._ctx = void 0, this._idb = void 0, this._logCount = 0, this._saveCount = 0, this._reCountOnSaveCount = 100, this._reduceData = !1, this._ctx = L, this._idb = new be(L.logger, L.config.idbName, L.config.idbName, $), this._reCountOnSaveCount = Math.min(200, Math.max(50, Math.round(this._ctx.config.idbMaxDataCount / 10))), this._count();
}
we.isSupported = function() {
return typeof indexedDB < "u";
};
var ue = we.prototype;
return ue.saveLog = function(L) {
var w = this, le = { exec: function(oe) {
return oe.add({ value: L });
}, callback: function(oe) {
w._saveCount++, w._saveCount % w._reCountOnSaveCount == 0 && w._count(), oe != null && oe.error && w._ctx.logger.i("idb-backend", "save log err", oe.error);
} };
this._idb.run(le);
}, ue.exportLog = function() {
var L = z()(J.a.mark(function w() {
var le = this;
return J.a.wrap(function(oe) {
for (; ; )
switch (oe.prev = oe.next) {
case 0:
return oe.abrupt("return", new Promise(function(Re, Oe) {
le._ctx.logger.i("idb-backend", "export start");
var de = { exec: function(X) {
return X.getAll();
}, callback: function(X) {
Re(X === void 0 ? "" : le._mergeGetAll(X.result));
} };
le._idb.run(de, "readonly");
}));
case 1:
case "end":
return oe.stop();
}
}, w);
}));
return function() {
return L.apply(this, arguments);
};
}(), ue.destroy = function() {
this._idb.destroy();
}, ue.clean = function() {
this._idb.run({ exec: function(L) {
return L.clear();
} });
}, ue._count = function() {
var L = this, w = { exec: function(le) {
return le.count();
}, callback: function(le) {
le != null && le.error || le == null || !le.result || (L._ctx.logger.i("idb-backend", "count: " + le.result + " max: " + L._ctx.config.idbMaxDataCount), L._logCount = le.result, L._logCount >= L._ctx.config.idbMaxDataCount && !L._reduceData && L._deleteFromHead(L._logCount - Math.round(L._ctx.config.idbMaxDataCount / 2)));
} };
this._idb.run(w);
}, ue._deleteFromHead = function(L) {
var w = this;
this._ctx.logger.i("idb-backend", "delete from head"), this._reduceData = !0;
var le = { exec: function(oe) {
return oe.openCursor();
}, callback: function(oe) {
if (w._reduceData = !1, oe != null && oe.result) {
var Re = IDBKeyRange.bound(oe.result.key, oe.result.key + L, !1, !1), Oe = { exec: function(de) {
return w._ctx.logger.i("idb-backend", "del: " + Re.lower + "~" + Re.upper), de.delete(Re);
}, callback: function(de) {
w._ctx.logger.i("idb-backend", "del result: " + !(de == null || !de.error));
} };
w._idb.run(Oe);
}
} };
this._idb.run(le);
}, ue._mergeGetAll = function(L) {
return L.length ? L.reduce(function(w, le) {
return "" + w + le.value + `
`;
}, "") : "";
}, s()(we, [{ key: "isActive", get: function() {
return this._idb.state !== "error";
} }]);
}()];
function Be(we, ue, L) {
var w = /* @__PURE__ */ new Date();
typeof we != "string" && (we = we.toString());
var le = w.toLocaleString() + "." + w.getMilliseconds().toString().padStart(3, "0") + "|" + we + "|";
return ue.forEach(function(oe) {
le += typeof oe == "object" ? JSON.stringify(oe) + " " : oe + " ";
}), le.length > L ? le.substring(0, L) : le;
}
function Ve(we) {
return we.join(`
`);
}
var je = function() {
function we(L) {
var w = 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() {
w._delayTimer = setInterval(function() {
w._saveLog(!0);
}, 1e3);
}, this._stopDelay = function() {
w._delayTimer && (clearTimeout(w._delayTimer), w._delayTimer = void 0);
}, C("kwai-video-local-log", "1.0.13"), this._ctx = new O(L);
var le = function(oe) {
for (var Re = arguments.length, Oe = new Array(Re > 1 ? Re - 1 : 0), de = 1; de < Re; de++)
Oe[de - 1] = arguments[de];
w.addLog.apply(w, [oe].concat(Oe));
};
this._loggerForAdd = { e: le, w: le, i: le, d: le, v: le }, this._ctx.logger.setOutput(this._loggerForAdd), this._ctx.logger.i("kwai-video-local-log", "constructor", L, this._ctx.config), this._backend = function(oe) {
for (var Re = 0; Re < ye.length; Re++) {
var Oe = ye[Re];
if (Oe != null && Oe.isSupported())
return new Oe(oe);
}
}(this._ctx), this._backend && this._startDelay();
}
we.isSupported = function() {
return function() {
for (var L = 0; L < ye.length; L++) {
var w = ye[L];
if (w != null && w.isSupported())
return !0;
}
return !1;
}();
};
var ue = we.prototype;
return ue.addLog = function(L) {
for (var w = arguments.length, le = new Array(w > 1 ? w - 1 : 0), oe = 1; oe < w; oe++)
le[oe - 1] = arguments[oe];
this._logCache.push(Be(L, le, this._ctx.config.maxLogLen)), this._saveLog();
}, ue.cleanLog = function() {
var L;
this._ctx.logger.i("kwai-video-local-log", "clean"), (L = this._backend) == null || L.clean();
}, ue.exportLog = function() {
var L = this;
return this._ctx.logger.i("kwai-video-local-log", "export log"), new Promise(function(w, le) {
L._backend ? L._backend.exportLog().then(function(oe) {
w(Ve([oe].concat(L._logCache)));
}) : w("");
});
}, ue.downloadLog = function(L) {
var w = this;
this._ctx.logger.i("kwai-video-local-log", "download log: " + L), this._destroyDownloadHref(), this.exportLog().then(function(le) {
var oe = new Blob([le], { type: "text/plain" });
if (document) {
var Re = document.createElement("a");
w._downloadHref = Re.href = URL.createObjectURL(oe), Re.download = L || "Log_web_" + (/* @__PURE__ */ new Date()).toLocaleString() + ".log", document.body.appendChild(Re), Re.click(), Re.remove();
} else
console.log("无document,当前是否在worker中");
});
}, ue.destroy = function() {
var L;
this._destroyDownloadHref(), (L = this._backend) == null || L.destroy(), this._stopDelay();
}, ue.getLoggerForAdd = function() {
return this._loggerForAdd;
}, ue._destroyDownloadHref = function() {
try {
this._downloadHref && (URL.revokeObjectURL(this._downloadHref), this._downloadHref = void 0);
} catch (L) {
}
}, ue._saveLog = function(L) {
if (L === void 0 && (L = !1), this._backend && this._backend.isActive && (this._logCache.length >= this._ctx.config.idbMaxFoldLog || this._logCache.length > 0 && L)) {
var w = Ve(this._logCache);
this._logCache.splice(0, this._logCache.length), w && this._backend.saveLog(w);
}
}, s()(we, null, [{ key: "version", get: function() {
return "1.0.13";
} }]);
}();
i.default = je;
}]);
Un === void 0 && console.error("esm-webpack-plugin: nothing exported!");
Un.KwaiVideoLocalLog;
const vu = Un.LogLevel, Ti = Un.DefaultLogger, gu = Un.Logger, oA = Un.printVersion;
Un.DEFAULT_LOG_LEVEL;
Un.default;
var cA = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function lA(r) {
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
}
var uc = { exports: {} }, ca = typeof Reflect == "object" ? Reflect : null, gl = ca && typeof ca.apply == "function" ? ca.apply : function(r, i, n) {
return Function.prototype.apply.call(r, i, n);
}, hs;
ca && typeof ca.ownKeys == "function" ? hs = ca.ownKeys : Object.getOwnPropertySymbols ? hs = function(r) {
return Object.getOwnPropertyNames(r).concat(Object.getOwnPropertySymbols(r));
} : hs = function(r) {
return Object.getOwnPropertyNames(r);
};
function uA(r) {
console && console.warn && console.warn(r);
}
var mu = Number.isNaN || function(r) {
return r !== r;
};
function Zt() {
Zt.init.call(this);
}
uc.exports = Zt;
uc.exports.once = pA;
Zt.EventEmitter = Zt;
Zt.prototype._events = void 0;
Zt.prototype._eventsCount = 0;
Zt.prototype._maxListeners = void 0;
var ml = 10;
function Ns(r) {
if (typeof r != "function")
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof r);
}
Object.defineProperty(Zt, "defaultMaxListeners", {
enumerable: !0,
get: function() {
return ml;
},
set: function(r) {
if (typeof r != "number" || r < 0 || mu(r))
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + r + ".");
ml = r;
}
});
Zt.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;
};
Zt.prototype.setMaxListeners = function(r) {
if (typeof r != "number" || r < 0 || mu(r))
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + r + ".");
return this._maxListeners = r, this;
};
function bu(r) {
return r._maxListeners === void 0 ? Zt.defaultMaxListeners : r._maxListeners;
}
Zt.prototype.getMaxListeners = function() {
return bu(this);
};
Zt.prototype.emit = function(r) {
for (var i = [], n = 1; n < arguments.length; n++)
i.push(arguments[n]);
var o = r === "error", s = this._events;
if (s !== void 0)
o = o && s.error === void 0;
else if (!o)
return !1;
if (o) {
var p;
if (i.length > 0 && (p = i[0]), p instanceof Error)
throw p;
var g = new Error("Unhandled error." + (p ? " (" + p.message + ")" : ""));
throw g.context = p, g;
}
var y = s[r];
if (y === void 0)
return !1;
if (typeof y == "function")
gl(y, this, i);
else
for (var C = y.length, x = Iu(y, C), n = 0; n < C; ++n)
gl(x[n], this, i);
return !0;
};
function Eu(r, i, n, o) {
var s, p, g;
if (Ns(n), p = r._events, p === void 0 ? (p = r._events = /* @__PURE__ */ Object.create(null), r._eventsCount = 0) : (p.newListener !== void 0 && (r.emit(
"newListener",
i,
n.listener ? n.listener : n
), p = r._events), g = p[i]), g === void 0)
g = p[i] = n, ++r._eventsCount;
else if (typeof g == "function" ? g = p[i] = o ? [n, g] : [g, n] : o ? g.unshift(n) : g.push(n), s = bu(r), s > 0 && g.length > s && !g.warned) {
g.warned = !0;
var y = new Error("Possible EventEmitter memory leak detected. " + g.length + " " + String(i) + " listeners added. Use emitter.setMaxListeners() to increase limit");
y.name = "MaxListenersExceededWarning", y.emitter = r, y.type = i, y.count = g.length, uA(y);
}
return r;
}
Zt.prototype.addListener = function(r, i) {
return Eu(this, r, i, !1);
};
Zt.prototype.on = Zt.prototype.addListener;
Zt.prototype.prependListener = function(r, i) {
return Eu(this, r, i, !0);
};
function hA() {
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 yu(r, i, n) {
var o = { fired: !1, wrapFn: void 0, target: r, type: i, listener: n }, s = hA.bind(o);
return s.listener = n, o.wrapFn = s, s;
}
Zt.prototype.once = function(r, i) {
return Ns(i), this.on(r, yu(this, r, i)), this;
};
Zt.prototype.prependOnceListener = function(r, i) {
return Ns(i), this.prependListener(r, yu(this, r, i)), this;
};
Zt.prototype.removeListener = function(r, i) {
var n, o, s, p, g;
if (Ns(i), o = this._events, o === void 0)
return this;
if (n = o[r], n === void 0)
return this;
if (n === i || n.listener === i)
--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete o[r], o.removeListener && this.emit("removeListener", r, n.listener || i));
else if (typeof n != "function") {
for (s = -1, p = n.length - 1; p >= 0; p--)
if (n[p] === i || n[p].listener === i) {
g = n[p].listener, s = p;
break;
}
if (s < 0)
return this;
s === 0 ? n.shift() : dA(n, s), n.length === 1 && (o[r] = n[0]), o.removeListener !== void 0 && this.emit("removeListener", r, g || i);
}
return this;
};
Zt.prototype.off = Zt.prototype.removeListener;
Zt.prototype.removeAllListeners = function(r) {
var i, n, o;
if (n = this._events, n === void 0)
return this;
if (n.removeListener === void 0)
return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : n[r] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete n[r]), this;
if (arguments.length === 0) {
var s = Object.keys(n), p;
for (o = 0; o < s.length; ++o)
p = s[o], p !== "removeListener" && this.removeAllListeners(p);
return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this;
}
if (i = n[r], typeof i == "function")
this.removeListener(r, i);
else if (i !== void 0)
for (o = i.length - 1; o >= 0; o--)
this.removeListener(r, i[o]);
return this;
};
function Cu(r, i, n) {
var o = r._events;
if (o === void 0)
return [];
var s = o[i];
return s === void 0 ? [] : typeof s == "function" ? n ? [s.listener || s] : [s] : n ? fA(s) : Iu(s, s.length);
}
Zt.prototype.listeners = function(r) {
return Cu(this, r, !0);
};
Zt.prototype.rawListeners = function(r) {
return Cu(this, r, !1);
};
Zt.listenerCount = function(r, i) {
return typeof r.listenerCount == "function" ? r.listenerCount(i) : Tu.call(r, i);
};
Zt.prototype.listenerCount = Tu;
function Tu(r) {
var i = this._events;
if (i !== void 0) {
var n = i[r];
if (typeof n == "function")
return 1;
if (n !== void 0)
return n.length;
}
return 0;
}
Zt.prototype.eventNames = function() {
return this._eventsCount > 0 ? hs(this._events) : [];
};
function Iu(r, i) {
for (var n = new Array(i), o = 0; o < i; ++o)
n[o] = r[o];
return n;
}
function dA(r, i) {
for (; i + 1 < r.length; i++)
r[i] = r[i + 1];
r.pop();
}
function fA(r) {
for (var i = new Array(r.length), n = 0; n < i.length; ++n)
i[n] = r[n].listener || r[n];
return i;
}
function pA(r, i) {
return new Promise(function(n, o) {
function s(g) {
r.removeListener(i, p), o(g);
}
function p() {
typeof r.removeListener == "function" && r.removeListener("error", s), n([].slice.call(arguments));
}
Ru(r, i, p, { once: !0 }), i !== "error" && _A(r, s, { once: !0 });
});
}
function _A(r, i, n) {
typeof r.on == "function" && Ru(r, "error", i, n);
}
function Ru(r, i, n, o) {
if (typeof r.on == "function")
o.once ? r.once(i, n) : r.on(i, n);
else if (typeof r.addEventListener == "function")
r.addEventListener(i, function s(p) {
o.once && r.removeEventListener(i, s), n(p);
});
else
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof r);
}
var AA = uc.exports, wu = function() {
if (typeof Map < "u")
return Map;
function r(i, n) {
var o = -1;
return i.some(function(s, p) {
return s[0] === n ? (o = p, !0) : !1;
}), o;
}
return (
/** @class */
function() {
function i() {
this.__entries__ = [];
}
return Object.defineProperty(i.prototype, "size", {
/**
* @returns {boolean}
*/
get: function() {
return this.__entries__.length;
},
enumerable: !0,
configurable: !0
}), i.prototype.get = function(n) {
var o = r(this.__entries__, n), s = this.__entries__[o];
return s && s[1];
}, i.prototype.set = function(n, o) {
var s = r(this.__entries__, n);
~s ? this.__entries__[s][1] = o : this.__entries__.push([n, o]);
}, i.prototype.delete = function(n) {
var o = this.__entries__, s = r(o, n);
~s && o.splice(s, 1);
}, i.prototype.has = function(n) {
return !!~r(this.__entries__, n);
}, i.prototype.clear = function() {
this.__entries__.splice(0);
}, i.prototype.forEach = function(n, o) {
o === void 0 && (o = null);
for (var s = 0, p = this.__entries__; s < p.length; s++) {
var g = p[s];
n.call(o, g[1], g[0]);
}
}, i;
}()
);
}(), xo = typeof window < "u" && typeof document < "u" && window.document === document, bs = 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")();
}(), vA = function() {
return typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(bs) : function(r) {
return setTimeout(function() {
return r(Date.now());
}, 1e3 / 60);
};
}(), gA = 2;
function mA(r, i) {
var n = !1, o = !1, s = 0;
function p() {
n && (n = !1, r()), o && y();
}
function g() {
vA(p);
}
function y() {
var C = Date.now();
if (n) {
if (C - s < gA)
return;
o = !0;
} else
n = !0, o = !1, setTimeout(g, i);
s = C;
}
return y;
}
var bA = 20, EA = ["top", "right", "bottom", "left", "width", "height", "size", "weight"], yA = typeof MutationObserver < "u", CA = (
/** @class */
function() {
function r() {
this.connected_ = !1, this.mutationEventsAdded_ = !1, this.mutationsObserver_ = null, this.observers_ = [], this.onTransitionEnd_ = this.onTransitionEnd_.bind(this), this.refresh = mA(this.refresh.bind(this), bA);
}
return r.prototype.addObserver = function(i) {
~this.observers_.indexOf(i) || this.observers_.push(i), this.connected_ || this.connect_();
}, r.prototype.removeObserver = function(i) {
var n = this.observers_, o = n.indexOf(i);
~o && n.splice(o, 1), !n.length && this.connected_ && this.disconnect_();
}, r.prototype.refresh = function() {
var i = this.updateObservers_();
i && this.refresh();
}, r.prototype.updateObservers_ = function() {
var i = this.observers_.filter(function(n) {
return n.gatherActive(), n.hasActive();
});
return i.forEach(function(n) {
return n.broadcastActive();
}), i.length > 0;
}, r.prototype.connect_ = function() {
!xo || this.connected_ || (document.addEventListener("transitionend", this.onTransitionEnd_), window.addEventListener("resize", this.refresh), yA ? (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);
}, r.prototype.disconnect_ = function() {
!xo || !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);
}, r.prototype.onTransitionEnd_ = function(i) {
var n = i.propertyName, o = n === void 0 ? "" : n, s = EA.some(function(p) {
return !!~o.indexOf(p);
});
s && this.refresh();
}, r.getInstance = function() {
return this.instance_ || (this.instance_ = new r()), this.instance_;
}, r.instance_ = null, r;
}()
), Lu = function(r, i) {
for (var n = 0, o = Object.keys(i); n < o.length; n++) {
var s = o[n];
Object.defineProperty(r, s, {
value: i[s],
enumerable: !1,
writable: !1,
configurable: !0
});
}
return r;
}, ha = function(r) {
var i = r && r.ownerDocument && r.ownerDocument.defaultView;
return i || bs;
}, Du = ks(0, 0, 0, 0);
function Es(r) {
return parseFloat(r) || 0;
}
function bl(r) {
for (var i = [], n = 1; n < arguments.length; n++)
i[n - 1] = arguments[n];
return i.reduce(function(o, s) {
var p = r["border-" + s + "-width"];
return o + Es(p);
}, 0);
}
function TA(r) {
for (var i = ["top", "right", "bottom", "left"], n = {}, o = 0, s = i; o < s.length; o++) {
var p = s[o], g = r["padding-" + p];
n[p] = Es(g);
}
return n;
}
function IA(r) {
var i = r.getBBox();
return ks(0, 0, i.width, i.height);
}
function RA(r) {
var i = r.clientWidth, n = r.clientHeight;
if (!i && !n)
return Du;
var o = ha(r).getComputedStyle(r), s = TA(o), p = s.left + s.right, g = s.top + s.bottom, y = Es(o.width), C = Es(o.height);
if (o.boxSizing === "border-box" && (Math.round(y + p) !== i && (y -= bl(o, "left", "right") + p), Math.round(C + g) !== n && (C -= bl(o, "top", "bottom") + g)), !LA(r)) {
var x = Math.round(y + p) - i, h = Math.round(C + g) - n;
Math.abs(x) !== 1 && (y -= x), Math.abs(h) !== 1 && (C -= h);
}
return ks(s.left, s.top, y, C);
}
var wA = function() {
return typeof SVGGraphicsElement < "u" ? function(r) {
return r instanceof ha(r).SVGGraphicsElement;
} : function(r) {
return r instanceof ha(r).SVGElement && typeof r.getBBox == "function";
};
}();
function LA(r) {
return r === ha(r).document.documentElement;
}
function DA(r) {
return xo ? wA(r) ? IA(r) : RA(r) : Du;
}
function SA(r) {
var i = r.x, n = r.y, o = r.width, s = r.height, p = typeof DOMRectReadOnly < "u" ? DOMRectReadOnly : Object, g = Object.create(p.prototype);
return Lu(g, {