@byomakase/omakase-player
Version:
## Omakase Player - Open source JavaScript framework for building frame accurate video experiences
1,855 lines • 2.18 MB
JavaScript
import Eo, { Events as Qi, ErrorDetails as Eb } from "hls.js";
var ig = function(r, e) {
return ig = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, i) {
t.__proto__ = i;
} || function(t, i) {
for (var s in i) Object.prototype.hasOwnProperty.call(i, s) && (t[s] = i[s]);
}, ig(r, e);
};
function xs(r, e) {
if (typeof e != "function" && e !== null)
throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
ig(r, e);
function t() {
this.constructor = r;
}
r.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t());
}
function _b(r, e, t, i) {
function s(n) {
return n instanceof t ? n : new t(function(a) {
a(n);
});
}
return new (t || (t = Promise))(function(n, a) {
function o(d) {
try {
l(i.next(d));
} catch (c) {
a(c);
}
}
function A(d) {
try {
l(i.throw(d));
} catch (c) {
a(c);
}
}
function l(d) {
d.done ? n(d.value) : s(d.value).then(o, A);
}
l((i = i.apply(r, e || [])).next());
});
}
function HC(r, e) {
var t = { label: 0, sent: function() {
if (n[0] & 1) throw n[1];
return n[1];
}, trys: [], ops: [] }, i, s, n, a = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
return a.next = o(0), a.throw = o(1), a.return = o(2), typeof Symbol == "function" && (a[Symbol.iterator] = function() {
return this;
}), a;
function o(l) {
return function(d) {
return A([l, d]);
};
}
function A(l) {
if (i) throw new TypeError("Generator is already executing.");
for (; a && (a = 0, l[0] && (t = 0)), t; ) try {
if (i = 1, s && (n = l[0] & 2 ? s.return : l[0] ? s.throw || ((n = s.return) && n.call(s), 0) : s.next) && !(n = n.call(s, l[1])).done) return n;
switch (s = 0, n && (l = [l[0] & 2, n.value]), l[0]) {
case 0:
case 1:
n = l;
break;
case 4:
return t.label++, { value: l[1], done: !1 };
case 5:
t.label++, s = l[1], l = [0];
continue;
case 7:
l = t.ops.pop(), t.trys.pop();
continue;
default:
if (n = t.trys, !(n = n.length > 0 && n[n.length - 1]) && (l[0] === 6 || l[0] === 2)) {
t = 0;
continue;
}
if (l[0] === 3 && (!n || l[1] > n[0] && l[1] < n[3])) {
t.label = l[1];
break;
}
if (l[0] === 6 && t.label < n[1]) {
t.label = n[1], n = l;
break;
}
if (n && t.label < n[2]) {
t.label = n[2], t.ops.push(l);
break;
}
n[2] && t.ops.pop(), t.trys.pop();
continue;
}
l = e.call(r, t);
} catch (d) {
l = [6, d], s = 0;
} finally {
i = n = 0;
}
if (l[0] & 5) throw l[1];
return { value: l[0] ? l[1] : void 0, done: !0 };
}
}
function uA(r) {
var e = typeof Symbol == "function" && Symbol.iterator, t = e && r[e], i = 0;
if (t) return t.call(r);
if (r && typeof r.length == "number") return {
next: function() {
return r && i >= r.length && (r = void 0), { value: r && r[i++], done: !r };
}
};
throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function La(r, e) {
var t = typeof Symbol == "function" && r[Symbol.iterator];
if (!t) return r;
var i = t.call(r), s, n = [], a;
try {
for (; (e === void 0 || e-- > 0) && !(s = i.next()).done; ) n.push(s.value);
} catch (o) {
a = { error: o };
} finally {
try {
s && !s.done && (t = i.return) && t.call(i);
} finally {
if (a) throw a.error;
}
}
return n;
}
function mA(r, e, t) {
if (t || arguments.length === 2) for (var i = 0, s = e.length, n; i < s; i++)
(n || !(i in e)) && (n || (n = Array.prototype.slice.call(e, 0, i)), n[i] = e[i]);
return r.concat(n || Array.prototype.slice.call(e));
}
function Jo(r) {
return this instanceof Jo ? (this.v = r, this) : new Jo(r);
}
function wb(r, e, t) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var i = t.apply(r, e || []), s, n = [];
return s = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), o("next"), o("throw"), o("return", a), s[Symbol.asyncIterator] = function() {
return this;
}, s;
function a(m) {
return function(g) {
return Promise.resolve(g).then(m, c);
};
}
function o(m, g) {
i[m] && (s[m] = function(u) {
return new Promise(function(f, v) {
n.push([m, u, f, v]) > 1 || A(m, u);
});
}, g && (s[m] = g(s[m])));
}
function A(m, g) {
try {
l(i[m](g));
} catch (u) {
h(n[0][3], u);
}
}
function l(m) {
m.value instanceof Jo ? Promise.resolve(m.value.v).then(d, c) : h(n[0][2], m);
}
function d(m) {
A("next", m);
}
function c(m) {
A("throw", m);
}
function h(m, g) {
m(g), n.shift(), n.length && A(n[0][0], n[0][1]);
}
}
function bb(r) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var e = r[Symbol.asyncIterator], t;
return e ? e.call(r) : (r = typeof uA == "function" ? uA(r) : r[Symbol.iterator](), t = {}, i("next"), i("throw"), i("return"), t[Symbol.asyncIterator] = function() {
return this;
}, t);
function i(n) {
t[n] = r[n] && function(a) {
return new Promise(function(o, A) {
a = r[n](a), s(o, A, a.done, a.value);
});
};
}
function s(n, a, o, A) {
Promise.resolve(A).then(function(l) {
n({ value: l, done: o });
}, a);
}
}
function Ct(r) {
return typeof r == "function";
}
function mu(r) {
var e = function(i) {
Error.call(i), i.stack = new Error().stack;
}, t = r(e);
return t.prototype = Object.create(Error.prototype), t.prototype.constructor = t, t;
}
var im = mu(function(r) {
return function(t) {
r(this), this.message = t ? t.length + ` errors occurred during unsubscription:
` + t.map(function(i, s) {
return s + 1 + ") " + i.toString();
}).join(`
`) : "", this.name = "UnsubscriptionError", this.errors = t;
};
});
function vh(r, e) {
if (r) {
var t = r.indexOf(e);
0 <= t && r.splice(t, 1);
}
}
var Ed = (function() {
function r(e) {
this.initialTeardown = e, this.closed = !1, this._parentage = null, this._finalizers = null;
}
return r.prototype.unsubscribe = function() {
var e, t, i, s, n;
if (!this.closed) {
this.closed = !0;
var a = this._parentage;
if (a)
if (this._parentage = null, Array.isArray(a))
try {
for (var o = uA(a), A = o.next(); !A.done; A = o.next()) {
var l = A.value;
l.remove(this);
}
} catch (u) {
e = { error: u };
} finally {
try {
A && !A.done && (t = o.return) && t.call(o);
} finally {
if (e) throw e.error;
}
}
else
a.remove(this);
var d = this.initialTeardown;
if (Ct(d))
try {
d();
} catch (u) {
n = u instanceof im ? u.errors : [u];
}
var c = this._finalizers;
if (c) {
this._finalizers = null;
try {
for (var h = uA(c), m = h.next(); !m.done; m = h.next()) {
var g = m.value;
try {
X0(g);
} catch (u) {
n = n ?? [], u instanceof im ? n = mA(mA([], La(n)), La(u.errors)) : n.push(u);
}
}
} catch (u) {
i = { error: u };
} finally {
try {
m && !m.done && (s = h.return) && s.call(h);
} finally {
if (i) throw i.error;
}
}
}
if (n)
throw new im(n);
}
}, r.prototype.add = function(e) {
var t;
if (e && e !== this)
if (this.closed)
X0(e);
else {
if (e instanceof r) {
if (e.closed || e._hasParent(this))
return;
e._addParent(this);
}
(this._finalizers = (t = this._finalizers) !== null && t !== void 0 ? t : []).push(e);
}
}, r.prototype._hasParent = function(e) {
var t = this._parentage;
return t === e || Array.isArray(t) && t.includes(e);
}, r.prototype._addParent = function(e) {
var t = this._parentage;
this._parentage = Array.isArray(t) ? (t.push(e), t) : t ? [t, e] : e;
}, r.prototype._removeParent = function(e) {
var t = this._parentage;
t === e ? this._parentage = null : Array.isArray(t) && vh(t, e);
}, r.prototype.remove = function(e) {
var t = this._finalizers;
t && vh(t, e), e instanceof r && e._removeParent(this);
}, r.EMPTY = (function() {
var e = new r();
return e.closed = !0, e;
})(), r;
})(), VC = Ed.EMPTY;
function GC(r) {
return r instanceof Ed || r && "closed" in r && Ct(r.remove) && Ct(r.add) && Ct(r.unsubscribe);
}
function X0(r) {
Ct(r) ? r() : r.unsubscribe();
}
var Ib = {
Promise: void 0
}, kb = {
setTimeout: function(r, e) {
for (var t = [], i = 2; i < arguments.length; i++)
t[i - 2] = arguments[i];
return setTimeout.apply(void 0, mA([r, e], La(t)));
},
clearTimeout: function(r) {
return clearTimeout(r);
},
delegate: void 0
};
function UC(r) {
kb.setTimeout(function() {
throw r;
});
}
function Eh() {
}
function Ic(r) {
r();
}
var If = (function(r) {
xs(e, r);
function e(t) {
var i = r.call(this) || this;
return i.isStopped = !1, t ? (i.destination = t, GC(t) && t.add(i)) : i.destination = Sb, i;
}
return e.create = function(t, i, s) {
return new _h(t, i, s);
}, e.prototype.next = function(t) {
this.isStopped || this._next(t);
}, e.prototype.error = function(t) {
this.isStopped || (this.isStopped = !0, this._error(t));
}, e.prototype.complete = function() {
this.isStopped || (this.isStopped = !0, this._complete());
}, e.prototype.unsubscribe = function() {
this.closed || (this.isStopped = !0, r.prototype.unsubscribe.call(this), this.destination = null);
}, e.prototype._next = function(t) {
this.destination.next(t);
}, e.prototype._error = function(t) {
try {
this.destination.error(t);
} finally {
this.unsubscribe();
}
}, e.prototype._complete = function() {
try {
this.destination.complete();
} finally {
this.unsubscribe();
}
}, e;
})(Ed), yb = (function() {
function r(e) {
this.partialObserver = e;
}
return r.prototype.next = function(e) {
var t = this.partialObserver;
if (t.next)
try {
t.next(e);
} catch (i) {
Vd(i);
}
}, r.prototype.error = function(e) {
var t = this.partialObserver;
if (t.error)
try {
t.error(e);
} catch (i) {
Vd(i);
}
else
Vd(e);
}, r.prototype.complete = function() {
var e = this.partialObserver;
if (e.complete)
try {
e.complete();
} catch (t) {
Vd(t);
}
}, r;
})(), _h = (function(r) {
xs(e, r);
function e(t, i, s) {
var n = r.call(this) || this, a;
return Ct(t) || !t ? a = {
next: t ?? void 0,
error: i ?? void 0,
complete: s ?? void 0
} : a = t, n.destination = new yb(a), n;
}
return e;
})(If);
function Vd(r) {
UC(r);
}
function Bb(r) {
throw r;
}
var Sb = {
closed: !0,
next: Eh,
error: Bb,
complete: Eh
}, kf = (function() {
return typeof Symbol == "function" && Symbol.observable || "@@observable";
})();
function Ua(r) {
return r;
}
function Tb(r) {
return r.length === 0 ? Ua : r.length === 1 ? r[0] : function(t) {
return r.reduce(function(i, s) {
return s(i);
}, t);
};
}
var de = (function() {
function r(e) {
e && (this._subscribe = e);
}
return r.prototype.lift = function(e) {
var t = new r();
return t.source = this, t.operator = e, t;
}, r.prototype.subscribe = function(e, t, i) {
var s = this, n = Qb(e) ? e : new _h(e, t, i);
return Ic(function() {
var a = s, o = a.operator, A = a.source;
n.add(o ? o.call(n, A) : A ? s._subscribe(n) : s._trySubscribe(n));
}), n;
}, r.prototype._trySubscribe = function(e) {
try {
return this._subscribe(e);
} catch (t) {
e.error(t);
}
}, r.prototype.forEach = function(e, t) {
var i = this;
return t = J0(t), new t(function(s, n) {
var a = new _h({
next: function(o) {
try {
e(o);
} catch (A) {
n(A), a.unsubscribe();
}
},
error: n,
complete: s
});
i.subscribe(a);
});
}, r.prototype._subscribe = function(e) {
var t;
return (t = this.source) === null || t === void 0 ? void 0 : t.subscribe(e);
}, r.prototype[kf] = function() {
return this;
}, r.prototype.pipe = function() {
for (var e = [], t = 0; t < arguments.length; t++)
e[t] = arguments[t];
return Tb(e)(this);
}, r.prototype.toPromise = function(e) {
var t = this;
return e = J0(e), new e(function(i, s) {
var n;
t.subscribe(function(a) {
return n = a;
}, function(a) {
return s(a);
}, function() {
return i(n);
});
});
}, r.create = function(e) {
return new r(e);
}, r;
})();
function J0(r) {
var e;
return (e = r ?? Ib.Promise) !== null && e !== void 0 ? e : Promise;
}
function Db(r) {
return r && Ct(r.next) && Ct(r.error) && Ct(r.complete);
}
function Qb(r) {
return r && r instanceof If || Db(r) && GC(r);
}
function Pb(r) {
return Ct(r?.lift);
}
function pi(r) {
return function(e) {
if (Pb(e))
return e.lift(function(t) {
try {
return r(t, this);
} catch (i) {
this.error(i);
}
});
throw new TypeError("Unable to lift unknown Observable type");
};
}
function Mt(r, e, t, i, s) {
return new xb(r, e, t, i, s);
}
var xb = (function(r) {
xs(e, r);
function e(t, i, s, n, a, o) {
var A = r.call(this, t) || this;
return A.onFinalize = a, A.shouldUnsubscribe = o, A._next = i ? function(l) {
try {
i(l);
} catch (d) {
t.error(d);
}
} : r.prototype._next, A._error = n ? function(l) {
try {
n(l);
} catch (d) {
t.error(d);
} finally {
this.unsubscribe();
}
} : r.prototype._error, A._complete = s ? function() {
try {
s();
} catch (l) {
t.error(l);
} finally {
this.unsubscribe();
}
} : r.prototype._complete, A;
}
return e.prototype.unsubscribe = function() {
var t;
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
var i = this.closed;
r.prototype.unsubscribe.call(this), !i && ((t = this.onFinalize) === null || t === void 0 || t.call(this));
}
}, e;
})(If), Mb = mu(function(r) {
return function() {
r(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
};
}), I = (function(r) {
xs(e, r);
function e() {
var t = r.call(this) || this;
return t.closed = !1, t.currentObservers = null, t.observers = [], t.isStopped = !1, t.hasError = !1, t.thrownError = null, t;
}
return e.prototype.lift = function(t) {
var i = new j0(this, this);
return i.operator = t, i;
}, e.prototype._throwIfClosed = function() {
if (this.closed)
throw new Mb();
}, e.prototype.next = function(t) {
var i = this;
Ic(function() {
var s, n;
if (i._throwIfClosed(), !i.isStopped) {
i.currentObservers || (i.currentObservers = Array.from(i.observers));
try {
for (var a = uA(i.currentObservers), o = a.next(); !o.done; o = a.next()) {
var A = o.value;
A.next(t);
}
} catch (l) {
s = { error: l };
} finally {
try {
o && !o.done && (n = a.return) && n.call(a);
} finally {
if (s) throw s.error;
}
}
}
});
}, e.prototype.error = function(t) {
var i = this;
Ic(function() {
if (i._throwIfClosed(), !i.isStopped) {
i.hasError = i.isStopped = !0, i.thrownError = t;
for (var s = i.observers; s.length; )
s.shift().error(t);
}
});
}, e.prototype.complete = function() {
var t = this;
Ic(function() {
if (t._throwIfClosed(), !t.isStopped) {
t.isStopped = !0;
for (var i = t.observers; i.length; )
i.shift().complete();
}
});
}, e.prototype.unsubscribe = function() {
this.isStopped = this.closed = !0, this.observers = this.currentObservers = null;
}, Object.defineProperty(e.prototype, "observed", {
get: function() {
var t;
return ((t = this.observers) === null || t === void 0 ? void 0 : t.length) > 0;
},
enumerable: !1,
configurable: !0
}), e.prototype._trySubscribe = function(t) {
return this._throwIfClosed(), r.prototype._trySubscribe.call(this, t);
}, e.prototype._subscribe = function(t) {
return this._throwIfClosed(), this._checkFinalizedStatuses(t), this._innerSubscribe(t);
}, e.prototype._innerSubscribe = function(t) {
var i = this, s = this, n = s.hasError, a = s.isStopped, o = s.observers;
return n || a ? VC : (this.currentObservers = null, o.push(t), new Ed(function() {
i.currentObservers = null, vh(o, t);
}));
}, e.prototype._checkFinalizedStatuses = function(t) {
var i = this, s = i.hasError, n = i.thrownError, a = i.isStopped;
s ? t.error(n) : a && t.complete();
}, e.prototype.asObservable = function() {
var t = new de();
return t.source = this, t;
}, e.create = function(t, i) {
return new j0(t, i);
}, e;
})(de), j0 = (function(r) {
xs(e, r);
function e(t, i) {
var s = r.call(this) || this;
return s.destination = t, s.source = i, s;
}
return e.prototype.next = function(t) {
var i, s;
(s = (i = this.destination) === null || i === void 0 ? void 0 : i.next) === null || s === void 0 || s.call(i, t);
}, e.prototype.error = function(t) {
var i, s;
(s = (i = this.destination) === null || i === void 0 ? void 0 : i.error) === null || s === void 0 || s.call(i, t);
}, e.prototype.complete = function() {
var t, i;
(i = (t = this.destination) === null || t === void 0 ? void 0 : t.complete) === null || i === void 0 || i.call(t);
}, e.prototype._subscribe = function(t) {
var i, s;
return (s = (i = this.source) === null || i === void 0 ? void 0 : i.subscribe(t)) !== null && s !== void 0 ? s : VC;
}, e;
})(I), nt = (function(r) {
xs(e, r);
function e(t) {
var i = r.call(this) || this;
return i._value = t, i;
}
return Object.defineProperty(e.prototype, "value", {
get: function() {
return this.getValue();
},
enumerable: !1,
configurable: !0
}), e.prototype._subscribe = function(t) {
var i = r.prototype._subscribe.call(this, t);
return !i.closed && t.next(this._value), i;
}, e.prototype.getValue = function() {
var t = this, i = t.hasError, s = t.thrownError, n = t._value;
if (i)
throw s;
return this._throwIfClosed(), n;
}, e.prototype.next = function(t) {
r.prototype.next.call(this, this._value = t);
}, e;
})(I), yf = {
now: function() {
return (yf.delegate || Date).now();
},
delegate: void 0
}, zC = (function(r) {
xs(e, r);
function e(t, i, s) {
t === void 0 && (t = 1 / 0), i === void 0 && (i = 1 / 0), s === void 0 && (s = yf);
var n = r.call(this) || this;
return n._bufferSize = t, n._windowTime = i, n._timestampProvider = s, n._buffer = [], n._infiniteTimeWindow = !0, n._infiniteTimeWindow = i === 1 / 0, n._bufferSize = Math.max(1, t), n._windowTime = Math.max(1, i), n;
}
return e.prototype.next = function(t) {
var i = this, s = i.isStopped, n = i._buffer, a = i._infiniteTimeWindow, o = i._timestampProvider, A = i._windowTime;
s || (n.push(t), !a && n.push(o.now() + A)), this._trimBuffer(), r.prototype.next.call(this, t);
}, e.prototype._subscribe = function(t) {
this._throwIfClosed(), this._trimBuffer();
for (var i = this._innerSubscribe(t), s = this, n = s._infiniteTimeWindow, a = s._buffer, o = a.slice(), A = 0; A < o.length && !t.closed; A += n ? 1 : 2)
t.next(o[A]);
return this._checkFinalizedStatuses(t), i;
}, e.prototype._trimBuffer = function() {
var t = this, i = t._bufferSize, s = t._timestampProvider, n = t._buffer, a = t._infiniteTimeWindow, o = (a ? 1 : 2) * i;
if (i < 1 / 0 && o < n.length && n.splice(0, n.length - o), !a) {
for (var A = s.now(), l = 0, d = 1; d < n.length && n[d] <= A; d += 2)
l = d;
l && n.splice(0, l + 1);
}
}, e;
})(I), Rb = (function(r) {
xs(e, r);
function e(t, i) {
return r.call(this) || this;
}
return e.prototype.schedule = function(t, i) {
return this;
}, e;
})(Ed), ep = {
setInterval: function(r, e) {
for (var t = [], i = 2; i < arguments.length; i++)
t[i - 2] = arguments[i];
return setInterval.apply(void 0, mA([r, e], La(t)));
},
clearInterval: function(r) {
return clearInterval(r);
},
delegate: void 0
}, Fb = (function(r) {
xs(e, r);
function e(t, i) {
var s = r.call(this, t, i) || this;
return s.scheduler = t, s.work = i, s.pending = !1, s;
}
return e.prototype.schedule = function(t, i) {
var s;
if (i === void 0 && (i = 0), this.closed)
return this;
this.state = t;
var n = this.id, a = this.scheduler;
return n != null && (this.id = this.recycleAsyncId(a, n, i)), this.pending = !0, this.delay = i, this.id = (s = this.id) !== null && s !== void 0 ? s : this.requestAsyncId(a, this.id, i), this;
}, e.prototype.requestAsyncId = function(t, i, s) {
return s === void 0 && (s = 0), ep.setInterval(t.flush.bind(t, this), s);
}, e.prototype.recycleAsyncId = function(t, i, s) {
if (s === void 0 && (s = 0), s != null && this.delay === s && this.pending === !1)
return i;
i != null && ep.clearInterval(i);
}, e.prototype.execute = function(t, i) {
if (this.closed)
return new Error("executing a cancelled action");
this.pending = !1;
var s = this._execute(t, i);
if (s)
return s;
this.pending === !1 && this.id != null && (this.id = this.recycleAsyncId(this.scheduler, this.id, null));
}, e.prototype._execute = function(t, i) {
var s = !1, n;
try {
this.work(t);
} catch (a) {
s = !0, n = a || new Error("Scheduled action threw falsy error");
}
if (s)
return this.unsubscribe(), n;
}, e.prototype.unsubscribe = function() {
if (!this.closed) {
var t = this, i = t.id, s = t.scheduler, n = s.actions;
this.work = this.state = this.scheduler = null, this.pending = !1, vh(n, this), i != null && (this.id = this.recycleAsyncId(s, i, null)), this.delay = null, r.prototype.unsubscribe.call(this);
}
}, e;
})(Rb), tp = (function() {
function r(e, t) {
t === void 0 && (t = r.now), this.schedulerActionCtor = e, this.now = t;
}
return r.prototype.schedule = function(e, t, i) {
return t === void 0 && (t = 0), new this.schedulerActionCtor(this, e).schedule(i, t);
}, r.now = yf.now, r;
})(), Lb = (function(r) {
xs(e, r);
function e(t, i) {
i === void 0 && (i = tp.now);
var s = r.call(this, t, i) || this;
return s.actions = [], s._active = !1, s;
}
return e.prototype.flush = function(t) {
var i = this.actions;
if (this._active) {
i.push(t);
return;
}
var s;
this._active = !0;
do
if (s = t.execute(t.state, t.delay))
break;
while (t = i.shift());
if (this._active = !1, s) {
for (; t = i.shift(); )
t.unsubscribe();
throw s;
}
}, e;
})(tp), SA = new Lb(Fb), Nb = SA, Bf = new de(function(r) {
return r.complete();
});
function WC(r) {
return r && Ct(r.schedule);
}
function Sf(r) {
return r[r.length - 1];
}
function Tf(r) {
return Ct(Sf(r)) ? r.pop() : void 0;
}
function gu(r) {
return WC(Sf(r)) ? r.pop() : void 0;
}
function Ob(r, e) {
return typeof Sf(r) == "number" ? r.pop() : e;
}
var Df = (function(r) {
return r && typeof r.length == "number" && typeof r != "function";
});
function YC(r) {
return Ct(r?.then);
}
function ZC(r) {
return Ct(r[kf]);
}
function qC(r) {
return Symbol.asyncIterator && Ct(r?.[Symbol.asyncIterator]);
}
function KC(r) {
return new TypeError("You provided " + (r !== null && typeof r == "object" ? "an invalid object" : "'" + r + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
}
function $b() {
return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
}
var XC = $b();
function JC(r) {
return Ct(r?.[XC]);
}
function jC(r) {
return wb(this, arguments, function() {
var t, i, s, n;
return HC(this, function(a) {
switch (a.label) {
case 0:
t = r.getReader(), a.label = 1;
case 1:
a.trys.push([1, , 9, 10]), a.label = 2;
case 2:
return [4, Jo(t.read())];
case 3:
return i = a.sent(), s = i.value, n = i.done, n ? [4, Jo(void 0)] : [3, 5];
case 4:
return [2, a.sent()];
case 5:
return [4, Jo(s)];
case 6:
return [4, a.sent()];
case 7:
return a.sent(), [3, 2];
case 8:
return [3, 10];
case 9:
return t.releaseLock(), [7];
case 10:
return [2];
}
});
});
}
function ev(r) {
return Ct(r?.getReader);
}
function Ci(r) {
if (r instanceof de)
return r;
if (r != null) {
if (ZC(r))
return Hb(r);
if (Df(r))
return Vb(r);
if (YC(r))
return Ae(r);
if (qC(r))
return tv(r);
if (JC(r))
return Gb(r);
if (ev(r))
return Ub(r);
}
throw KC(r);
}
function Hb(r) {
return new de(function(e) {
var t = r[kf]();
if (Ct(t.subscribe))
return t.subscribe(e);
throw new TypeError("Provided object does not correctly implement Symbol.observable");
});
}
function Vb(r) {
return new de(function(e) {
for (var t = 0; t < r.length && !e.closed; t++)
e.next(r[t]);
e.complete();
});
}
function Ae(r) {
return new de(function(e) {
r.then(function(t) {
e.closed || (e.next(t), e.complete());
}, function(t) {
return e.error(t);
}).then(null, UC);
});
}
function Gb(r) {
return new de(function(e) {
var t, i;
try {
for (var s = uA(r), n = s.next(); !n.done; n = s.next()) {
var a = n.value;
if (e.next(a), e.closed)
return;
}
} catch (o) {
t = { error: o };
} finally {
try {
n && !n.done && (i = s.return) && i.call(s);
} finally {
if (t) throw t.error;
}
}
e.complete();
});
}
function tv(r) {
return new de(function(e) {
zb(r, e).catch(function(t) {
return e.error(t);
});
});
}
function Ub(r) {
return tv(jC(r));
}
function zb(r, e) {
var t, i, s, n;
return _b(this, void 0, void 0, function() {
var a, o;
return HC(this, function(A) {
switch (A.label) {
case 0:
A.trys.push([0, 5, 6, 11]), t = bb(r), A.label = 1;
case 1:
return [4, t.next()];
case 2:
if (i = A.sent(), !!i.done) return [3, 4];
if (a = i.value, e.next(a), e.closed)
return [2];
A.label = 3;
case 3:
return [3, 1];
case 4:
return [3, 11];
case 5:
return o = A.sent(), s = { error: o }, [3, 11];
case 6:
return A.trys.push([6, , 9, 10]), i && !i.done && (n = t.return) ? [4, n.call(t)] : [3, 8];
case 7:
A.sent(), A.label = 8;
case 8:
return [3, 10];
case 9:
if (s) throw s.error;
return [7];
case 10:
return [7];
case 11:
return e.complete(), [2];
}
});
});
}
function tn(r, e, t, i, s) {
i === void 0 && (i = 0), s === void 0 && (s = !1);
var n = e.schedule(function() {
t(), s ? r.add(this.schedule(null, i)) : this.unsubscribe();
}, i);
if (r.add(n), !s)
return n;
}
function iv(r, e) {
return e === void 0 && (e = 0), pi(function(t, i) {
t.subscribe(Mt(i, function(s) {
return tn(i, r, function() {
return i.next(s);
}, e);
}, function() {
return tn(i, r, function() {
return i.complete();
}, e);
}, function(s) {
return tn(i, r, function() {
return i.error(s);
}, e);
}));
});
}
function rv(r, e) {
return e === void 0 && (e = 0), pi(function(t, i) {
i.add(r.schedule(function() {
return t.subscribe(i);
}, e));
});
}
function Wb(r, e) {
return Ci(r).pipe(rv(e), iv(e));
}
function Yb(r, e) {
return Ci(r).pipe(rv(e), iv(e));
}
function Zb(r, e) {
return new de(function(t) {
var i = 0;
return e.schedule(function() {
i === r.length ? t.complete() : (t.next(r[i++]), t.closed || this.schedule());
});
});
}
function qb(r, e) {
return new de(function(t) {
var i;
return tn(t, e, function() {
i = r[XC](), tn(t, e, function() {
var s, n, a;
try {
s = i.next(), n = s.value, a = s.done;
} catch (o) {
t.error(o);
return;
}
a ? t.complete() : t.next(n);
}, 0, !0);
}), function() {
return Ct(i?.return) && i.return();
};
});
}
function sv(r, e) {
if (!r)
throw new Error("Iterable cannot be null");
return new de(function(t) {
tn(t, e, function() {
var i = r[Symbol.asyncIterator]();
tn(t, e, function() {
i.next().then(function(s) {
s.done ? t.complete() : t.next(s.value);
});
}, 0, !0);
});
});
}
function Kb(r, e) {
return sv(jC(r), e);
}
function Xb(r, e) {
if (r != null) {
if (ZC(r))
return Wb(r, e);
if (Df(r))
return Zb(r, e);
if (YC(r))
return Yb(r, e);
if (qC(r))
return sv(r, e);
if (JC(r))
return qb(r, e);
if (ev(r))
return Kb(r, e);
}
throw KC(r);
}
function Ot(r, e) {
return e ? Xb(r, e) : Ci(r);
}
function Nt() {
for (var r = [], e = 0; e < arguments.length; e++)
r[e] = arguments[e];
var t = gu(r);
return Ot(r, t);
}
var Qf = mu(function(r) {
return function() {
r(this), this.name = "EmptyError", this.message = "no elements in sequence";
};
});
function ce(r, e) {
return new Promise(function(t, i) {
var s = new _h({
next: function(n) {
t(n), s.unsubscribe();
},
error: i,
complete: function() {
i(new Qf());
}
});
r.subscribe(s);
});
}
function nv(r) {
return r instanceof Date && !isNaN(r);
}
var Jb = mu(function(r) {
return function(t) {
t === void 0 && (t = null), r(this), this.message = "Timeout has occurred", this.name = "TimeoutError", this.info = t;
};
});
function Pr(r, e) {
var t = nv(r) ? { first: r } : typeof r == "number" ? { each: r } : r, i = t.first, s = t.each, n = t.with, a = n === void 0 ? jb : n, o = t.scheduler, A = o === void 0 ? SA : o, l = t.meta, d = l === void 0 ? null : l;
if (i == null && s == null)
throw new TypeError("No timeout provided.");
return pi(function(c, h) {
var m, g, u = null, f = 0, v = function(E) {
g = tn(h, A, function() {
try {
m.unsubscribe(), Ci(a({
meta: d,
lastValue: u,
seen: f
})).subscribe(h);
} catch (_) {
h.error(_);
}
}, E);
};
m = c.subscribe(Mt(h, function(E) {
g?.unsubscribe(), f++, h.next(u = E), s > 0 && v(s);
}, void 0, void 0, function() {
g?.closed || g?.unsubscribe(), u = null;
})), !f && v(i != null ? typeof i == "number" ? i : +i - A.now() : s);
});
}
function jb(r) {
throw new Jb(r);
}
function Se(r, e) {
return pi(function(t, i) {
var s = 0;
t.subscribe(Mt(i, function(n) {
i.next(r.call(e, n, s++));
}));
});
}
var eI = Array.isArray;
function tI(r, e) {
return eI(e) ? r.apply(void 0, mA([], La(e))) : r(e);
}
function Pf(r) {
return Se(function(e) {
return tI(r, e);
});
}
var iI = Array.isArray, rI = Object.getPrototypeOf, sI = Object.prototype, nI = Object.keys;
function av(r) {
if (r.length === 1) {
var e = r[0];
if (iI(e))
return { args: e, keys: null };
if (aI(e)) {
var t = nI(e);
return {
args: t.map(function(i) {
return e[i];
}),
keys: t
};
}
}
return { args: r, keys: null };
}
function aI(r) {
return r && typeof r == "object" && rI(r) === sI;
}
function ov(r, e) {
return r.reduce(function(t, i, s) {
return t[i] = e[s], t;
}, {});
}
function Mr() {
for (var r = [], e = 0; e < arguments.length; e++)
r[e] = arguments[e];
var t = gu(r), i = Tf(r), s = av(r), n = s.args, a = s.keys;
if (n.length === 0)
return Ot([], t);
var o = new de(oI(n, t, a ? function(A) {
return ov(a, A);
} : Ua));
return i ? o.pipe(Pf(i)) : o;
}
function oI(r, e, t) {
return t === void 0 && (t = Ua), function(i) {
ip(e, function() {
for (var s = r.length, n = new Array(s), a = s, o = s, A = function(d) {
ip(e, function() {
var c = Ot(r[d], e), h = !1;
c.subscribe(Mt(i, function(m) {
n[d] = m, h || (h = !0, o--), o || i.next(t(n.slice()));
}, function() {
--a || i.complete();
}));
}, i);
}, l = 0; l < s; l++)
A(l);
}, i);
};
}
function ip(r, e, t) {
r ? tn(t, r, e) : e();
}
function AI(r, e, t, i, s, n, a, o) {
var A = [], l = 0, d = 0, c = !1, h = function() {
c && !A.length && !l && e.complete();
}, m = function(u) {
return l < i ? g(u) : A.push(u);
}, g = function(u) {
l++;
var f = !1;
Ci(t(u, d++)).subscribe(Mt(e, function(v) {
e.next(v);
}, function() {
f = !0;
}, void 0, function() {
if (f)
try {
l--;
for (var v = function() {
var E = A.shift();
a || g(E);
}; A.length && l < i; )
v();
h();
} catch (E) {
e.error(E);
}
}));
};
return r.subscribe(Mt(e, m, function() {
c = !0, h();
})), function() {
};
}
function nn(r, e, t) {
return t === void 0 && (t = 1 / 0), Ct(e) ? nn(function(i, s) {
return Se(function(n, a) {
return e(i, n, s, a);
})(Ci(r(i, s)));
}, t) : (typeof e == "number" && (t = e), pi(function(i, s) {
return AI(i, s, r, t);
}));
}
function xf(r) {
return r === void 0 && (r = 1 / 0), nn(Ua, r);
}
function lI() {
return xf(1);
}
function rm() {
for (var r = [], e = 0; e < arguments.length; e++)
r[e] = arguments[e];
return lI()(Ot(r, gu(r)));
}
function dI(r) {
return new de(function(e) {
Ci(r()).subscribe(e);
});
}
function hi() {
for (var r = [], e = 0; e < arguments.length; e++)
r[e] = arguments[e];
var t = Tf(r), i = av(r), s = i.args, n = i.keys, a = new de(function(o) {
var A = s.length;
if (!A) {
o.complete();
return;
}
for (var l = new Array(A), d = A, c = A, h = function(g) {
var u = !1;
Ci(s[g]).subscribe(Mt(o, function(f) {
u || (u = !0, c--), l[g] = f;
}, function() {
return d--;
}, void 0, function() {
(!d || !u) && (c || o.next(n ? ov(n, l) : l), o.complete());
}));
}, m = 0; m < A; m++)
h(m);
});
return t ? a.pipe(Pf(t)) : a;
}
var cI = ["addListener", "removeListener"], hI = ["addEventListener", "removeEventListener"], uI = ["on", "off"];
function De(r, e, t, i) {
if (Ct(t) && (i = t, t = void 0), i)
return De(r, e, t).pipe(Pf(i));
var s = La(fI(r) ? hI.map(function(o) {
return function(A) {
return r[o](e, A, t);
};
}) : mI(r) ? cI.map(rp(r, e)) : gI(r) ? uI.map(rp(r, e)) : [], 2), n = s[0], a = s[1];
if (!n && Df(r))
return nn(function(o) {
return De(o, e, t);
})(Ci(r));
if (!n)
throw new TypeError("Invalid event target");
return new de(function(o) {
var A = function() {
for (var l = [], d = 0; d < arguments.length; d++)
l[d] = arguments[d];
return o.next(1 < l.length ? l : l[0]);
};
return n(A), function() {
return a(A);
};
});
}
function rp(r, e) {
return function(t) {
return function(i) {
return r[t](e, i);
};
};
}
function mI(r) {
return Ct(r.addListener) && Ct(r.removeListener);
}
function gI(r) {
return Ct(r.on) && Ct(r.off);
}
function fI(r) {
return Ct(r.addEventListener) && Ct(r.removeEventListener);
}
function $n(r, e, t) {
r === void 0 && (r = 0), t === void 0 && (t = Nb);
var i = -1;
return e != null && (WC(e) ? t = e : i = e), new de(function(s) {
var n = nv(r) ? +r - t.now() : r;
n < 0 && (n = 0);
var a = 0;
return t.schedule(function() {
s.closed || (s.next(a++), 0 <= i ? this.schedule(void 0, i) : s.complete());
}, n);
});
}
function fu(r, e) {
return r === void 0 && (r = 0), e === void 0 && (e = SA), r < 0 && (r = 0), $n(r, r, e);
}
function mi() {
for (var r = [], e = 0; e < arguments.length; e++)
r[e] = arguments[e];
var t = gu(r), i = Ob(r, 1 / 0), s = r;
return s.length ? s.length === 1 ? Ci(s[0]) : xf(i)(Ot(s, t)) : Bf;
}
var pI = Array.isArray;
function Av(r) {
return r.length === 1 && pI(r[0]) ? r[0] : r;
}
function he(r, e) {
return pi(function(t, i) {
var s = 0;
t.subscribe(Mt(i, function(n) {
return r.call(e, n, s++) && i.next(n);
}));
});
}
function CI() {
for (var r = [], e = 0; e < arguments.length; e++)
r[e] = arguments[e];
return r = Av(r), r.length === 1 ? Ci(r[0]) : new de(vI(r));
}
function vI(r) {
return function(e) {
for (var t = [], i = function(n) {
t.push(Ci(r[n]).subscribe(Mt(e, function(a) {
if (t) {
for (var o = 0; o < t.length; o++)
o !== n && t[o].unsubscribe();
t = null;
}
e.next(a);
})));
}, s = 0; t && !e.closed && s < r.length; s++)
i(s);
};
}
function za() {
for (var r = [], e = 0; e < arguments.length; e++)
r[e] = arguments[e];
var t = Tf(r), i = Av(r);
return i.length ? new de(function(s) {
var n = i.map(function() {
return [];
}), a = i.map(function() {
return !1;
});
s.add(function() {
n = a = null;
});
for (var o = function(l) {
Ci(i[l]).subscribe(Mt(s, function(d) {
if (n[l].push(d), n.every(function(h) {
return h.length;
})) {
var c = n.map(function(h) {
return h.shift();
});
s.next(t ? t.apply(void 0, mA([], La(c))) : c), n.some(function(h, m) {
return !h.length && a[m];
}) && s.complete();
}
}, function() {
a[l] = !0, !n[l].length && s.complete();
}));
}, A = 0; !s.closed && A < i.length; A++)
o(A);
return function() {
n = a = null;
};
}) : Bf;
}
function Is(r) {
return pi(function(e, t) {
var i = null, s = !1, n;
i = e.subscribe(Mt(t, void 0, void 0, function(a) {
n = Ci(r(a, Is(r)(e))), i ? (i.unsubscribe(), i = null, n.subscribe(t)) : s = !0;
})), s && (i.unsubscribe(), i = null, n.subscribe(t));
});
}
function EI(r, e, t, i, s) {
return function(n, a) {
var o = t, A = e, l = 0;
n.subscribe(Mt(a, function(d) {
var c = l++;
A = o ? r(A, d, c) : (o = !0, d);
}, (function() {
o && a.next(A), a.complete();
})));
};
}
function _I(r, e) {
return pi(EI(r, e, arguments.length >= 2, !1, !0));
}
var wI = function(r, e) {
return r.push(e), r;
};
function rg() {
return pi(function(r, e) {
_I(wI, [])(r).subscribe(e);
});
}
function sg(r, e) {
return Ct(e) ? nn(r, e, 1) : nn(r, 1);
}
function Rr(r, e) {
return e === void 0 && (e = SA), pi(function(t, i) {
var s = null, n = null, a = null, o = function() {
if (s) {
s.unsubscribe(), s = null;
var l = n;
n = null, i.next(l);
}
};
function A() {
var l = a + r, d = e.now();
if (d < l) {
s = this.schedule(void 0, l - d), i.add(s);
return;
}
o();
}
t.subscribe(Mt(i, function(l) {
n = l, a = e.now(), s || (s = e.schedule(A, r), i.add(s));
}, function() {
o(), i.complete();
}, void 0, function() {
n = s = null;
}));
});
}
function bI(r) {
return pi(function(e, t) {
var i = !1;
e.subscribe(Mt(t, function(s) {
i = !0, t.next(s);
}, function() {
i || t.next(r), t.complete();
}));
});
}
function Oe(r) {
return r <= 0 ? function() {
return Bf;
} : pi(function(e, t) {
var i = 0;
e.subscribe(Mt(t, function(s) {
++i <= r && (t.next(s), r <= i && t.complete());
}));
});
}
function II(r) {
return Se(function() {
return r;
});
}
function kI(r, e) {
return nn(function(t, i) {
return Ci(r(t, i)).pipe(Oe(1), II(t));
});
}
function yI(r, e) {
e === void 0 && (e = SA);
var t = $n(r, e);
return kI(function() {
return t;
});
}
function Mf(r, e) {
return e === void 0 && (e = Ua), r = r ?? BI, pi(function(t, i) {
var s, n = !0;
t.subscribe(Mt(i, function(a) {
var o = e(a);
(n || !r(s, o)) && (n = !1, s = o, i.next(a));
}));
});
}
function BI(r, e) {
return r === e;
}
function SI(r) {
return r === void 0 && (r = TI), pi(function(e, t) {
var i = !1;
e.subscribe(Mt(t, function(s) {
i = !0, t.next(s);
}, function() {
return i ? t.complete() : t.error(r());
}));
});
}
function TI() {
return new Qf();
}
function Gn(r, e) {
var t = arguments.length >= 2;
return function(i) {
return i.pipe(Ua, Oe(1), t ? bI(e) : SI(function() {
return new Qf();
}));
};
}
function DI(r) {
return pi(function(e, t) {
var i = !1, s = null;
e.subscribe(Mt(t, function(n) {
i = !0, s = n;
})), Ci(r).subscribe(Mt(t, function() {
if (i) {
i = !1;
var n = s;
s = null, t.next(n);
}
}, Eh));
});
}
function pu(r, e) {
return e === void 0 && (e = SA), DI(fu(r, e));
}
function sp(r) {
return he(function(e, t) {
return r <= t;
});
}
function Na(r, e) {
return pi(function(t, i) {
var s = null, n = 0, a = !1, o = function() {
return a && !s && i.complete();
};
t.subscribe(Mt(i, function(A) {
s?.unsubscribe();
var l = 0, d = n++;
Ci(r(A, d)).subscribe(s = Mt(i, function(c) {
return i.next(e ? e(A, c, d, l++) : c);
}, function() {
s = null, o();
}));
}, function() {
a = !0, o();
}));
});
}
function p(r) {
return pi(function(e, t) {
Ci(r).subscribe(Mt(t, function() {
return t.complete();
}, Eh)), !t.closed && e.subscribe(t);
});
}
function rn(r, e, t) {
var i = Ct(r) || e || t ? { next: r, error: e, complete: t } : r;
return i ? pi(function(s, n) {
var a;
(a = i.subscribe) === null || a === void 0 || a.call(i);
var o = !0;
s.subscribe(Mt(n, function(A) {
var l;
(l = i.next) === null || l === void 0 || l.call(i, A), n.next(A);
}, function() {
var A;
o = !1, (A = i.complete) === null || A === void 0 || A.call(i), n.complete();
}, function(A) {
var l;
o = !1, (l = i.error) === null || l === void 0 || l.call(i, A), n.error(A);
}, function() {
var A, l;
o && ((A = i.unsubscribe) === null || A === void 0 || A.call(i)), (l = i.finalize) === null || l === void 0 || l.call(i);
}));
}) : Ua;
}
class Rf {
constructor(e) {
this.onChange$ = new I(), this.style = {
...e
};
}
get style() {
return this._style;
}
set style(e) {
let t = JSON.stringify(this._style);
this._style = {
...this._style,
...e
}, t !== JSON.stringify(this._style) && this.onChange$.next(this._style);
}
}
class ii {
static isNullUndefinedOrWhitespace(e) {
return typeof e === void 0 || e == null ? !0 : `${e}`.replace(/\s/g, "").length < 1;
}
static isNonEmpty(e) {
return !this.isNullUndefinedOrWhitespace(e);
}
static isEmpty(e) {
return !this.isNonEmpty(e);
}
static toArrayBuffer(e) {
return new TextEncoder().encode(e).buffer;
}
}
class ze extends Error {
constructor(e, t) {
super(e), this.name = ii.isNullUndefinedOrWhitespace(t) ? "OmpError" : t;
}
}
class QI extends ze {
constructor(e) {
super(e, "OmpBroadcastChannelError");
}
}
class PI extends ze {
constructor(e) {
super(e, "OmpBroadcastChannelTimeoutError");
}
}
class di extends ze {
constructor(e) {
super(e, "OmpVideoWindowPlaybackError");
}
}
var dt;
(function(r) {
r.assertEqual = (s) => s;
function e(s) {
}
r.assertIs = e;
function t(s) {
throw new Error();
}
r.assertNever = t, r.arrayToEnum = (s) => {
const n = {};
for (const a of s)
n[a] = a;
return n;
}, r.getValidEnumValues = (s) => {
const n = r.objectKeys(s).filter((o) => typeof s[s[o]] != "number"), a = {};
for (const o of n)
a[o] = s[o];
return r.objectValues(a);
}, r.objectValues = (s) => r.objectKeys(s).map(function(n) {
return s[n];
}), r.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
const n = [];
for (const a in s)
Object.prototype.hasOwnProperty.call(s, a) && n.push(a);
return n;
}, r.find = (s, n) => {
for (const a of s)
if (n(a))
return a;
}, r.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && isFinite(s) && Math.floor(s) === s;
function i(s, n = " | ") {
return s.map((a) => typeof a == "string" ? `'${a}'` : a).join(n);
}
r.joinValues = i, r.jsonStringifyReplacer = (s, n) => typeof n == "bigint" ? n.toString() : n;
})(dt || (dt = {}));
var ng;
(function(r) {
r.mergeShapes = (e, t) => ({
...e,
...t
// second overwrites first
});
})(ng || (ng = {}));
const ge = dt.arrayToEnum([
"string",
"nan",
"number",
"integer",
"float",
"boolean",
"date",
"bigint",
"symbol",
"function",
"undefined",
"null",
"array",
"object",
"unknown",
"promise",
"void",
"never",
"map",
"set"
]), Qn = (r) => {
switch (typeof r) {
case "undefined":
return ge.undefined;
case "string":
return ge.string;
case "number":
return isNaN(r) ? ge.nan : ge.number;
case "boolean":
return ge.boolean;
case "function":
return ge.function;
case "bigint":
return ge.bigint;
case "symbol":
return ge.symbol;
case "object":
return Array.isArray(r) ? ge.array : r === null ? ge.null : r.then && typeof r.then == "function" && r.catch && typeof r.catch == "function" ? ge.promise : typeof Map < "u" && r instanceof Map ? ge.map : typeof Set < "u" && r instanceof Set ? ge.set : typeof Date < "u" && r instanceof Date ? ge.date : ge.object;
default:
return ge.unknown;
}
}, J = dt.arrayToEnum([
"invalid_type",
"invalid_literal",
"custom",
"invalid_union",
"invalid_union_discriminator",
"invalid_enum_value",
"unrecognized_keys",
"invalid_arguments",
"invalid_return_type",
"invalid_date",
"invalid_string",
"too_small",
"too_big",
"invalid_intersection_types",
"not_multiple_of",
"not_finite"
]), xI = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
class ar extends Error {
constructor(e) {
super(), this.issues = [], this.addIssue = (i) => {
this.issues = [...this.issues, i];
}, this.addIssues = (i = []) => {
this.issues = [...this.issues, ...i];
};
const t = new.target.prototype;
Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
}
get errors() {
return this.issues;
}
format(e) {
const t = e || function(n) {
return n.message;
}, i = { _errors: [] }, s = (n) => {
for (const a of n.issues)
if (a.code === "invalid_union")
a.unionErrors.map(s);
else if (a.code === "invalid_return_type")
s(a.returnTypeError);
else if (a.code === "invalid_arguments")
s(a.argumentsError);
else if (a.path.length === 0)
i._errors.push(t(a));
else {
let o = i, A = 0;
for (; A < a.path.length; ) {
const l = a.path[A];
A === a.path.length - 1 ? (o[l] = o[l] || { _errors: [] }, o[l]._errors.push(t(a))) : o[l] = o[l] || { _errors: [] }, o = o[l], A++;
}
}
};
return s(this), i;
}
static assert(e) {
if (!(e instanceof ar))
throw new Error(`Not a ZodError: ${e}`);
}
toString() {
return this.message;
}
get message() {
return JSON.stringify(this.issues, dt.jsonStringifyReplacer, 2);
}
get isEmpty() {
return this.issues.length === 0;
}
flatten(e = (t) => t.message) {
const t = {}, i = [];
for (const s of this.issues)
s.path.length > 0 ? (t[s.path[0]] = t[s.path[0]] || [], t[s.path[0]].push(e(s))) : i.push(e(s));
return { formErrors: i, fieldErrors: t };
}
get formErrors() {
return this.flatten();
}
}
ar.create = (r) => new ar(r);
const gA = (r, e) => {
let t;
switch (r.code) {
case J.invalid_type:
r.received === ge.undefined ? t = "Required"