UNPKG

@byomakase/omakase-player

Version:

## Omakase Player - Open source JavaScript framework for building frame accurate video experiences

1,868 lines • 5.01 MB
import HC, { Events as NQ, ErrorDetails as rd } from "hls.js"; var Ts = function(g, A) { return Ts = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(B, Q) { B.__proto__ = Q; } || function(B, Q) { for (var I in Q) Object.prototype.hasOwnProperty.call(Q, I) && (B[I] = Q[I]); }, Ts(g, A); }; function bI(g, A) { if (typeof A != "function" && A !== null) throw new TypeError("Class extends value " + String(A) + " is not a constructor or null"); Ts(g, A); function B() { this.constructor = g; } g.prototype = A === null ? Object.create(A) : (B.prototype = A.prototype, new B()); } function nd(g, A, B, Q) { function I(E) { return E instanceof B ? E : new B(function(C) { C(E); }); } return new (B || (B = Promise))(function(E, C) { function i(o) { try { e(Q.next(o)); } catch (s) { C(s); } } function t(o) { try { e(Q.throw(o)); } catch (s) { C(s); } } function e(o) { o.done ? E(o.value) : I(o.value).then(i, t); } e((Q = Q.apply(g, A || [])).next()); }); } function uc(g, A) { var B = { label: 0, sent: function() { if (E[0] & 1) throw E[1]; return E[1]; }, trys: [], ops: [] }, Q, I, E, C = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype); return C.next = i(0), C.throw = i(1), C.return = i(2), typeof Symbol == "function" && (C[Symbol.iterator] = function() { return this; }), C; function i(e) { return function(o) { return t([e, o]); }; } function t(e) { if (Q) throw new TypeError("Generator is already executing."); for (; C && (C = 0, e[0] && (B = 0)), B; ) try { if (Q = 1, I && (E = e[0] & 2 ? I.return : e[0] ? I.throw || ((E = I.return) && E.call(I), 0) : I.next) && !(E = E.call(I, e[1])).done) return E; switch (I = 0, E && (e = [e[0] & 2, E.value]), e[0]) { case 0: case 1: E = e; break; case 4: return B.label++, { value: e[1], done: !1 }; case 5: B.label++, I = e[1], e = [0]; continue; case 7: e = B.ops.pop(), B.trys.pop(); continue; default: if (E = B.trys, !(E = E.length > 0 && E[E.length - 1]) && (e[0] === 6 || e[0] === 2)) { B = 0; continue; } if (e[0] === 3 && (!E || e[1] > E[0] && e[1] < E[3])) { B.label = e[1]; break; } if (e[0] === 6 && B.label < E[1]) { B.label = E[1], E = e; break; } if (E && B.label < E[2]) { B.label = E[2], B.ops.push(e); break; } E[2] && B.ops.pop(), B.trys.pop(); continue; } e = A.call(g, B); } catch (o) { e = [6, o], I = 0; } finally { Q = E = 0; } if (e[0] & 5) throw e[1]; return { value: e[0] ? e[1] : void 0, done: !0 }; } } function ai(g) { var A = typeof Symbol == "function" && Symbol.iterator, B = A && g[A], Q = 0; if (B) return B.call(g); if (g && typeof g.length == "number") return { next: function() { return g && Q >= g.length && (g = void 0), { value: g && g[Q++], done: !g }; } }; throw new TypeError(A ? "Object is not iterable." : "Symbol.iterator is not defined."); } function _E(g, A) { var B = typeof Symbol == "function" && g[Symbol.iterator]; if (!B) return g; var Q = B.call(g), I, E = [], C; try { for (; (A === void 0 || A-- > 0) && !(I = Q.next()).done; ) E.push(I.value); } catch (i) { C = { error: i }; } finally { try { I && !I.done && (B = Q.return) && B.call(Q); } finally { if (C) throw C.error; } } return E; } function si(g, A, B) { if (B || arguments.length === 2) for (var Q = 0, I = A.length, E; Q < I; Q++) (E || !(Q in A)) && (E || (E = Array.prototype.slice.call(A, 0, Q)), E[Q] = A[Q]); return g.concat(E || Array.prototype.slice.call(A)); } function Ai(g) { return this instanceof Ai ? (this.v = g, this) : new Ai(g); } function hd(g, A, B) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var Q = B.apply(g, A || []), I, E = []; return I = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), i("next"), i("throw"), i("return", C), I[Symbol.asyncIterator] = function() { return this; }, I; function C(D) { return function(r) { return Promise.resolve(r).then(D, s); }; } function i(D, r) { Q[D] && (I[D] = function(n) { return new Promise(function(h, G) { E.push([D, n, h, G]) > 1 || t(D, n); }); }, r && (I[D] = r(I[D]))); } function t(D, r) { try { e(Q[D](r)); } catch (n) { a(E[0][3], n); } } function e(D) { D.value instanceof Ai ? Promise.resolve(D.value.v).then(o, s) : a(E[0][2], D); } function o(D) { t("next", D); } function s(D) { t("throw", D); } function a(D, r) { D(r), E.shift(), E.length && t(E[0][0], E[0][1]); } } function cd(g) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var A = g[Symbol.asyncIterator], B; return A ? A.call(g) : (g = typeof ai == "function" ? ai(g) : g[Symbol.iterator](), B = {}, Q("next"), Q("throw"), Q("return"), B[Symbol.asyncIterator] = function() { return this; }, B); function Q(E) { B[E] = g[E] && function(C) { return new Promise(function(i, t) { C = g[E](C), I(i, t, C.done, C.value); }); }; } function I(E, C, i, t) { Promise.resolve(t).then(function(e) { E({ value: e, done: i }); }, C); } } function lB(g) { return typeof g == "function"; } function Ma(g) { var A = function(Q) { Error.call(Q), Q.stack = new Error().stack; }, B = g(A); return B.prototype = Object.create(Error.prototype), B.prototype.constructor = B, B; } var hs = Ma(function(g) { return function(B) { g(this), this.message = B ? B.length + ` errors occurred during unsubscription: ` + B.map(function(Q, I) { return I + 1 + ") " + Q.toString(); }).join(` `) : "", this.name = "UnsubscriptionError", this.errors = B; }; }); function Zo(g, A) { if (g) { var B = g.indexOf(A); 0 <= B && g.splice(B, 1); } } var ge = function() { function g(A) { this.initialTeardown = A, this.closed = !1, this._parentage = null, this._finalizers = null; } return g.prototype.unsubscribe = function() { var A, B, Q, I, E; if (!this.closed) { this.closed = !0; var C = this._parentage; if (C) if (this._parentage = null, Array.isArray(C)) try { for (var i = ai(C), t = i.next(); !t.done; t = i.next()) { var e = t.value; e.remove(this); } } catch (n) { A = { error: n }; } finally { try { t && !t.done && (B = i.return) && B.call(i); } finally { if (A) throw A.error; } } else C.remove(this); var o = this.initialTeardown; if (lB(o)) try { o(); } catch (n) { E = n instanceof hs ? n.errors : [n]; } var s = this._finalizers; if (s) { this._finalizers = null; try { for (var a = ai(s), D = a.next(); !D.done; D = a.next()) { var r = D.value; try { an(r); } catch (n) { E = E ?? [], n instanceof hs ? E = si(si([], _E(E)), _E(n.errors)) : E.push(n); } } } catch (n) { Q = { error: n }; } finally { try { D && !D.done && (I = a.return) && I.call(a); } finally { if (Q) throw Q.error; } } } if (E) throw new hs(E); } }, g.prototype.add = function(A) { var B; if (A && A !== this) if (this.closed) an(A); else { if (A instanceof g) { if (A.closed || A._hasParent(this)) return; A._addParent(this); } (this._finalizers = (B = this._finalizers) !== null && B !== void 0 ? B : []).push(A); } }, g.prototype._hasParent = function(A) { var B = this._parentage; return B === A || Array.isArray(B) && B.includes(A); }, g.prototype._addParent = function(A) { var B = this._parentage; this._parentage = Array.isArray(B) ? (B.push(A), B) : B ? [B, A] : A; }, g.prototype._removeParent = function(A) { var B = this._parentage; B === A ? this._parentage = null : Array.isArray(B) && Zo(B, A); }, g.prototype.remove = function(A) { var B = this._finalizers; B && Zo(B, A), A instanceof g && A._removeParent(this); }, g.EMPTY = function() { var A = new g(); return A.closed = !0, A; }(), g; }(), Jc = ge.EMPTY; function Hc(g) { return g instanceof ge || g && "closed" in g && lB(g.remove) && lB(g.add) && lB(g.unsubscribe); } function an(g) { lB(g) ? g() : g.unsubscribe(); } var pc = { onUnhandledError: null, onStoppedNotification: null, Promise: void 0, useDeprecatedSynchronousErrorHandling: !1, useDeprecatedNextContext: !1 }, mc = { setTimeout: function(g, A) { for (var B = [], Q = 2; Q < arguments.length; Q++) B[Q - 2] = arguments[Q]; return setTimeout.apply(void 0, si([g, A], _E(B))); }, clearTimeout: function(g) { var A = mc.delegate; return ((A == null ? void 0 : A.clearTimeout) || clearTimeout)(g); }, delegate: void 0 }; function Yc(g) { mc.setTimeout(function() { throw g; }); } function To() { } function Pe(g) { g(); } var jD = function(g) { bI(A, g); function A(B) { var Q = g.call(this) || this; return Q.isStopped = !1, B ? (Q.destination = B, Hc(B) && B.add(Q)) : Q.destination = ld, Q; } return A.create = function(B, Q, I) { return new Oo(B, Q, I); }, A.prototype.next = function(B) { this.isStopped || this._next(B); }, A.prototype.error = function(B) { this.isStopped || (this.isStopped = !0, this._error(B)); }, A.prototype.complete = function() { this.isStopped || (this.isStopped = !0, this._complete()); }, A.prototype.unsubscribe = function() { this.closed || (this.isStopped = !0, g.prototype.unsubscribe.call(this), this.destination = null); }, A.prototype._next = function(B) { this.destination.next(B); }, A.prototype._error = function(B) { try { this.destination.error(B); } finally { this.unsubscribe(); } }, A.prototype._complete = function() { try { this.destination.complete(); } finally { this.unsubscribe(); } }, A; }(ge), wd = Function.prototype.bind; function cs(g, A) { return wd.call(g, A); } var Gd = function() { function g(A) { this.partialObserver = A; } return g.prototype.next = function(A) { var B = this.partialObserver; if (B.next) try { B.next(A); } catch (Q) { Fe(Q); } }, g.prototype.error = function(A) { var B = this.partialObserver; if (B.error) try { B.error(A); } catch (Q) { Fe(Q); } else Fe(A); }, g.prototype.complete = function() { var A = this.partialObserver; if (A.complete) try { A.complete(); } catch (B) { Fe(B); } }, g; }(), Oo = function(g) { bI(A, g); function A(B, Q, I) { var E = g.call(this) || this, C; if (lB(B) || !B) C = { next: B ?? void 0, error: Q ?? void 0, complete: I ?? void 0 }; else { var i; E && pc.useDeprecatedNextContext ? (i = Object.create(B), i.unsubscribe = function() { return E.unsubscribe(); }, C = { next: B.next && cs(B.next, i), error: B.error && cs(B.error, i), complete: B.complete && cs(B.complete, i) }) : C = B; } return E.destination = new Gd(C), E; } return A; }(jD); function Fe(g) { Yc(g); } function Fd(g) { throw g; } var ld = { closed: !0, next: To, error: Fd, complete: To }, _D = function() { return typeof Symbol == "function" && Symbol.observable || "@@observable"; }(); function EC(g) { return g; } function dd(g) { return g.length === 0 ? EC : g.length === 1 ? g[0] : function(B) { return g.reduce(function(Q, I) { return I(Q); }, B); }; } var wA = function() { function g(A) { A && (this._subscribe = A); } return g.prototype.lift = function(A) { var B = new g(); return B.source = this, B.operator = A, B; }, g.prototype.subscribe = function(A, B, Q) { var I = this, E = Ud(A) ? A : new Oo(A, B, Q); return Pe(function() { var C = I, i = C.operator, t = C.source; E.add(i ? i.call(E, t) : t ? I._subscribe(E) : I._trySubscribe(E)); }), E; }, g.prototype._trySubscribe = function(A) { try { return this._subscribe(A); } catch (B) { A.error(B); } }, g.prototype.forEach = function(A, B) { var Q = this; return B = sn(B), new B(function(I, E) { var C = new Oo({ next: function(i) { try { A(i); } catch (t) { E(t), C.unsubscribe(); } }, error: E, complete: I }); Q.subscribe(C); }); }, g.prototype._subscribe = function(A) { var B; return (B = this.source) === null || B === void 0 ? void 0 : B.subscribe(A); }, g.prototype[_D] = function() { return this; }, g.prototype.pipe = function() { for (var A = [], B = 0; B < arguments.length; B++) A[B] = arguments[B]; return dd(A)(this); }, g.prototype.toPromise = function(A) { var B = this; return A = sn(A), new A(function(Q, I) { var E; B.subscribe(function(C) { return E = C; }, function(C) { return I(C); }, function() { return Q(E); }); }); }, g.create = function(A) { return new g(A); }, g; }(); function sn(g) { var A; return (A = g ?? pc.Promise) !== null && A !== void 0 ? A : Promise; } function Rd(g) { return g && lB(g.next) && lB(g.error) && lB(g.complete); } function Ud(g) { return g && g instanceof jD || Rd(g) && Hc(g); } function kd(g) { return lB(g == null ? void 0 : g.lift); } function FQ(g) { return function(A) { if (kd(A)) return A.lift(function(B) { try { return g(B, this); } catch (Q) { this.error(Q); } }); throw new TypeError("Unable to lift unknown Observable type"); }; } function KB(g, A, B, Q, I) { return new yd(g, A, B, Q, I); } var yd = function(g) { bI(A, g); function A(B, Q, I, E, C, i) { var t = g.call(this, B) || this; return t.onFinalize = C, t.shouldUnsubscribe = i, t._next = Q ? function(e) { try { Q(e); } catch (o) { B.error(o); } } : g.prototype._next, t._error = E ? function(e) { try { E(e); } catch (o) { B.error(o); } finally { this.unsubscribe(); } } : g.prototype._error, t._complete = I ? function() { try { I(); } catch (e) { B.error(e); } finally { this.unsubscribe(); } } : g.prototype._complete, t; } return A.prototype.unsubscribe = function() { var B; if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) { var Q = this.closed; g.prototype.unsubscribe.call(this), !Q && ((B = this.onFinalize) === null || B === void 0 || B.call(this)); } }, A; }(jD), Md = Ma(function(g) { return function() { g(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed"; }; }), y = function(g) { bI(A, g); function A() { var B = g.call(this) || this; return B.closed = !1, B.currentObservers = null, B.observers = [], B.isStopped = !1, B.hasError = !1, B.thrownError = null, B; } return A.prototype.lift = function(B) { var Q = new Dn(this, this); return Q.operator = B, Q; }, A.prototype._throwIfClosed = function() { if (this.closed) throw new Md(); }, A.prototype.next = function(B) { var Q = this; Pe(function() { var I, E; if (Q._throwIfClosed(), !Q.isStopped) { Q.currentObservers || (Q.currentObservers = Array.from(Q.observers)); try { for (var C = ai(Q.currentObservers), i = C.next(); !i.done; i = C.next()) { var t = i.value; t.next(B); } } catch (e) { I = { error: e }; } finally { try { i && !i.done && (E = C.return) && E.call(C); } finally { if (I) throw I.error; } } } }); }, A.prototype.error = function(B) { var Q = this; Pe(function() { if (Q._throwIfClosed(), !Q.isStopped) { Q.hasError = Q.isStopped = !0, Q.thrownError = B; for (var I = Q.observers; I.length; ) I.shift().error(B); } }); }, A.prototype.complete = function() { var B = this; Pe(function() { if (B._throwIfClosed(), !B.isStopped) { B.isStopped = !0; for (var Q = B.observers; Q.length; ) Q.shift().complete(); } }); }, A.prototype.unsubscribe = function() { this.isStopped = this.closed = !0, this.observers = this.currentObservers = null; }, Object.defineProperty(A.prototype, "observed", { get: function() { var B; return ((B = this.observers) === null || B === void 0 ? void 0 : B.length) > 0; }, enumerable: !1, configurable: !0 }), A.prototype._trySubscribe = function(B) { return this._throwIfClosed(), g.prototype._trySubscribe.call(this, B); }, A.prototype._subscribe = function(B) { return this._throwIfClosed(), this._checkFinalizedStatuses(B), this._innerSubscribe(B); }, A.prototype._innerSubscribe = function(B) { var Q = this, I = this, E = I.hasError, C = I.isStopped, i = I.observers; return E || C ? Jc : (this.currentObservers = null, i.push(B), new ge(function() { Q.currentObservers = null, Zo(i, B); })); }, A.prototype._checkFinalizedStatuses = function(B) { var Q = this, I = Q.hasError, E = Q.thrownError, C = Q.isStopped; I ? B.error(E) : C && B.complete(); }, A.prototype.asObservable = function() { var B = new wA(); return B.source = this, B; }, A.create = function(B, Q) { return new Dn(B, Q); }, A; }(wA), Dn = function(g) { bI(A, g); function A(B, Q) { var I = g.call(this) || this; return I.destination = B, I.source = Q, I; } return A.prototype.next = function(B) { var Q, I; (I = (Q = this.destination) === null || Q === void 0 ? void 0 : Q.next) === null || I === void 0 || I.call(Q, B); }, A.prototype.error = function(B) { var Q, I; (I = (Q = this.destination) === null || Q === void 0 ? void 0 : Q.error) === null || I === void 0 || I.call(Q, B); }, A.prototype.complete = function() { var B, Q; (Q = (B = this.destination) === null || B === void 0 ? void 0 : B.complete) === null || Q === void 0 || Q.call(B); }, A.prototype._subscribe = function(B) { var Q, I; return (I = (Q = this.source) === null || Q === void 0 ? void 0 : Q.subscribe(B)) !== null && I !== void 0 ? I : Jc; }, A; }(y), iB = function(g) { bI(A, g); function A(B) { var Q = g.call(this) || this; return Q._value = B, Q; } return Object.defineProperty(A.prototype, "value", { get: function() { return this.getValue(); }, enumerable: !1, configurable: !0 }), A.prototype._subscribe = function(B) { var Q = g.prototype._subscribe.call(this, B); return !Q.closed && B.next(this._value), Q; }, A.prototype.getValue = function() { var B = this, Q = B.hasError, I = B.thrownError, E = B._value; if (Q) throw I; return this._throwIfClosed(), E; }, A.prototype.next = function(B) { g.prototype.next.call(this, this._value = B); }, A; }(y), Sd = { now: function() { return Date.now(); }, delegate: void 0 }, Nd = function(g) { bI(A, g); function A(B, Q) { return g.call(this) || this; } return A.prototype.schedule = function(B, Q) { return this; }, A; }(ge), rn = { setInterval: function(g, A) { for (var B = [], Q = 2; Q < arguments.length; Q++) B[Q - 2] = arguments[Q]; return setInterval.apply(void 0, si([g, A], _E(B))); }, clearInterval: function(g) { return clearInterval(g); }, delegate: void 0 }, Ld = function(g) { bI(A, g); function A(B, Q) { var I = g.call(this, B, Q) || this; return I.scheduler = B, I.work = Q, I.pending = !1, I; } return A.prototype.schedule = function(B, Q) { var I; if (Q === void 0 && (Q = 0), this.closed) return this; this.state = B; var E = this.id, C = this.scheduler; return E != null && (this.id = this.recycleAsyncId(C, E, Q)), this.pending = !0, this.delay = Q, this.id = (I = this.id) !== null && I !== void 0 ? I : this.requestAsyncId(C, this.id, Q), this; }, A.prototype.requestAsyncId = function(B, Q, I) { return I === void 0 && (I = 0), rn.setInterval(B.flush.bind(B, this), I); }, A.prototype.recycleAsyncId = function(B, Q, I) { if (I === void 0 && (I = 0), I != null && this.delay === I && this.pending === !1) return Q; Q != null && rn.clearInterval(Q); }, A.prototype.execute = function(B, Q) { if (this.closed) return new Error("executing a cancelled action"); this.pending = !1; var I = this._execute(B, Q); if (I) return I; this.pending === !1 && this.id != null && (this.id = this.recycleAsyncId(this.scheduler, this.id, null)); }, A.prototype._execute = function(B, Q) { var I = !1, E; try { this.work(B); } catch (C) { I = !0, E = C || new Error("Scheduled action threw falsy error"); } if (I) return this.unsubscribe(), E; }, A.prototype.unsubscribe = function() { if (!this.closed) { var B = this, Q = B.id, I = B.scheduler, E = I.actions; this.work = this.state = this.scheduler = null, this.pending = !1, Zo(E, this), Q != null && (this.id = this.recycleAsyncId(I, Q, null)), this.delay = null, g.prototype.unsubscribe.call(this); } }, A; }(Nd), nn = function() { function g(A, B) { B === void 0 && (B = g.now), this.schedulerActionCtor = A, this.now = B; } return g.prototype.schedule = function(A, B, Q) { return B === void 0 && (B = 0), new this.schedulerActionCtor(this, A).schedule(Q, B); }, g.now = Sd.now, g; }(), ud = function(g) { bI(A, g); function A(B, Q) { Q === void 0 && (Q = nn.now); var I = g.call(this, B, Q) || this; return I.actions = [], I._active = !1, I; } return A.prototype.flush = function(B) { var Q = this.actions; if (this._active) { Q.push(B); return; } var I; this._active = !0; do if (I = B.execute(B.state, B.delay)) break; while (B = Q.shift()); if (this._active = !1, I) { for (; B = Q.shift(); ) B.unsubscribe(); throw I; } }, A; }(nn), Ri = new ud(Ld), Jd = Ri, $D = new wA(function(g) { return g.complete(); }); function Kc(g) { return g && lB(g.schedule); } function Ar(g) { return g[g.length - 1]; } function Br(g) { return lB(Ar(g)) ? g.pop() : void 0; } function Sa(g) { return Kc(Ar(g)) ? g.pop() : void 0; } function Hd(g, A) { return typeof Ar(g) == "number" ? g.pop() : A; } var Qr = function(g) { return g && typeof g.length == "number" && typeof g != "function"; }; function bc(g) { return lB(g == null ? void 0 : g.then); } function fc(g) { return lB(g[_D]); } function Vc(g) { return Symbol.asyncIterator && lB(g == null ? void 0 : g[Symbol.asyncIterator]); } function Wc(g) { return new TypeError("You provided " + (g !== null && typeof g == "object" ? "an invalid object" : "'" + g + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable."); } function pd() { return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator; } var xc = pd(); function Zc(g) { return lB(g == null ? void 0 : g[xc]); } function Tc(g) { return hd(this, arguments, function() { var B, Q, I, E; return uc(this, function(C) { switch (C.label) { case 0: B = g.getReader(), C.label = 1; case 1: C.trys.push([1, , 9, 10]), C.label = 2; case 2: return [4, Ai(B.read())]; case 3: return Q = C.sent(), I = Q.value, E = Q.done, E ? [4, Ai(void 0)] : [3, 5]; case 4: return [2, C.sent()]; case 5: return [4, Ai(I)]; case 6: return [4, C.sent()]; case 7: return C.sent(), [3, 2]; case 8: return [3, 10]; case 9: return B.releaseLock(), [7]; case 10: return [2]; } }); }); } function Oc(g) { return lB(g == null ? void 0 : g.getReader); } function lQ(g) { if (g instanceof wA) return g; if (g != null) { if (fc(g)) return md(g); if (Qr(g)) return Yd(g); if (bc(g)) return hA(g); if (Vc(g)) return vc(g); if (Zc(g)) return Kd(g); if (Oc(g)) return bd(g); } throw Wc(g); } function md(g) { return new wA(function(A) { var B = g[_D](); if (lB(B.subscribe)) return B.subscribe(A); throw new TypeError("Provided object does not correctly implement Symbol.observable"); }); } function Yd(g) { return new wA(function(A) { for (var B = 0; B < g.length && !A.closed; B++) A.next(g[B]); A.complete(); }); } function hA(g) { return new wA(function(A) { g.then(function(B) { A.closed || (A.next(B), A.complete()); }, function(B) { return A.error(B); }).then(null, Yc); }); } function Kd(g) { return new wA(function(A) { var B, Q; try { for (var I = ai(g), E = I.next(); !E.done; E = I.next()) { var C = E.value; if (A.next(C), A.closed) return; } } catch (i) { B = { error: i }; } finally { try { E && !E.done && (Q = I.return) && Q.call(I); } finally { if (B) throw B.error; } } A.complete(); }); } function vc(g) { return new wA(function(A) { fd(g, A).catch(function(B) { return A.error(B); }); }); } function bd(g) { return vc(Tc(g)); } function fd(g, A) { var B, Q, I, E; return nd(this, void 0, void 0, function() { var C, i; return uc(this, function(t) { switch (t.label) { case 0: t.trys.push([0, 5, 6, 11]), B = cd(g), t.label = 1; case 1: return [4, B.next()]; case 2: if (Q = t.sent(), !!Q.done) return [3, 4]; if (C = Q.value, A.next(C), A.closed) return [2]; t.label = 3; case 3: return [3, 1]; case 4: return [3, 11]; case 5: return i = t.sent(), I = { error: i }, [3, 11]; case 6: return t.trys.push([6, , 9, 10]), Q && !Q.done && (E = B.return) ? [4, E.call(B)] : [3, 8]; case 7: t.sent(), t.label = 8; case 8: return [3, 10]; case 9: if (I) throw I.error; return [7]; case 10: return [7]; case 11: return A.complete(), [2]; } }); }); } function pI(g, A, B, Q, I) { Q === void 0 && (Q = 0), I === void 0 && (I = !1); var E = A.schedule(function() { B(), I ? g.add(this.schedule(null, Q)) : this.unsubscribe(); }, Q); if (g.add(E), !I) return E; } function qc(g, A) { return A === void 0 && (A = 0), FQ(function(B, Q) { B.subscribe(KB(Q, function(I) { return pI(Q, g, function() { return Q.next(I); }, A); }, function() { return pI(Q, g, function() { return Q.complete(); }, A); }, function(I) { return pI(Q, g, function() { return Q.error(I); }, A); })); }); } function Xc(g, A) { return A === void 0 && (A = 0), FQ(function(B, Q) { Q.add(g.schedule(function() { return B.subscribe(Q); }, A)); }); } function Vd(g, A) { return lQ(g).pipe(Xc(A), qc(A)); } function Wd(g, A) { return lQ(g).pipe(Xc(A), qc(A)); } function xd(g, A) { return new wA(function(B) { var Q = 0; return A.schedule(function() { Q === g.length ? B.complete() : (B.next(g[Q++]), B.closed || this.schedule()); }); }); } function Zd(g, A) { return new wA(function(B) { var Q; return pI(B, A, function() { Q = g[xc](), pI(B, A, function() { var I, E, C; try { I = Q.next(), E = I.value, C = I.done; } catch (i) { B.error(i); return; } C ? B.complete() : B.next(E); }, 0, !0); }), function() { return lB(Q == null ? void 0 : Q.return) && Q.return(); }; }); } function zc(g, A) { if (!g) throw new Error("Iterable cannot be null"); return new wA(function(B) { pI(B, A, function() { var Q = g[Symbol.asyncIterator](); pI(B, A, function() { Q.next().then(function(I) { I.done ? B.complete() : B.next(I.value); }); }, 0, !0); }); }); } function Td(g, A) { return zc(Tc(g), A); } function Od(g, A) { if (g != null) { if (fc(g)) return Vd(g, A); if (Qr(g)) return xd(g, A); if (bc(g)) return Wd(g, A); if (Vc(g)) return zc(g, A); if (Zc(g)) return Zd(g, A); if (Oc(g)) return Td(g, A); } throw Wc(g); } function vB(g, A) { return A ? Od(g, A) : lQ(g); } function jB() { for (var g = [], A = 0; A < arguments.length; A++) g[A] = arguments[A]; var B = Sa(g); return vB(g, B); } var gr = Ma(function(g) { return function() { g(this), this.name = "EmptyError", this.message = "no elements in sequence"; }; }); function cA(g, A) { return new Promise(function(B, Q) { var I = new Oo({ next: function(E) { B(E), I.unsubscribe(); }, error: Q, complete: function() { Q(new gr()); } }); g.subscribe(I); }); } function Pc(g) { return g instanceof Date && !isNaN(g); } var vd = Ma(function(g) { return function(B) { B === void 0 && (B = null), g(this), this.message = "Timeout has occurred", this.name = "TimeoutError", this.info = B; }; }); function wg(g, A) { var B = Pc(g) ? { first: g } : typeof g == "number" ? { each: g } : g, Q = B.first, I = B.each, E = B.with, C = E === void 0 ? qd : E, i = B.scheduler, t = i === void 0 ? Ri : i, e = B.meta, o = e === void 0 ? null : e; if (Q == null && I == null) throw new TypeError("No timeout provided."); return FQ(function(s, a) { var D, r, n = null, h = 0, G = function(w) { r = pI(a, t, function() { try { D.unsubscribe(), lQ(C({ meta: o, lastValue: n, seen: h })).subscribe(a); } catch (d) { a.error(d); } }, w); }; D = s.subscribe(KB(a, function(w) { r == null || r.unsubscribe(), h++, a.next(n = w), I > 0 && G(I); }, void 0, void 0, function() { r != null && r.closed || r == null || r.unsubscribe(), n = null; })), !h && G(Q != null ? typeof Q == "number" ? Q : +Q - t.now() : I); }); } function qd(g) { throw new vd(g); } function VA(g, A) { return FQ(function(B, Q) { var I = 0; B.subscribe(KB(Q, function(E) { Q.next(g.call(A, E, I++)); })); }); } var Xd = Array.isArray; function zd(g, A) { return Xd(A) ? g.apply(void 0, si([], _E(A))) : g(A); } function Ir(g) { return VA(function(A) { return zd(g, A); }); } var Pd = Array.isArray, jd = Object.getPrototypeOf, _d = Object.prototype, $d = Object.keys; function jc(g) { if (g.length === 1) { var A = g[0]; if (Pd(A)) return { args: A, keys: null }; if (AR(A)) { var B = $d(A); return { args: B.map(function(Q) { return A[Q]; }), keys: B }; } } return { args: g, keys: null }; } function AR(g) { return g && typeof g == "object" && jd(g) === _d; } function _c(g, A) { return g.reduce(function(B, Q, I) { return B[Q] = A[I], B; }, {}); } function mI() { for (var g = [], A = 0; A < arguments.length; A++) g[A] = arguments[A]; var B = Sa(g), Q = Br(g), I = jc(g), E = I.args, C = I.keys; if (E.length === 0) return vB([], B); var i = new wA(BR(E, B, C ? function(t) { return _c(C, t); } : EC)); return Q ? i.pipe(Ir(Q)) : i; } function BR(g, A, B) { return B === void 0 && (B = EC), function(Q) { hn(A, function() { for (var I = g.length, E = new Array(I), C = I, i = I, t = function(o) { hn(A, function() { var s = vB(g[o], A), a = !1; s.subscribe(KB(Q, function(D) { E[o] = D, a || (a = !0, i--), i || Q.next(B(E.slice())); }, function() { --C || Q.complete(); })); }, Q); }, e = 0; e < I; e++) t(e); }, Q); }; } function hn(g, A, B) { g ? pI(B, g, A) : A(); } function QR(g, A, B, Q, I, E, C, i) { var t = [], e = 0, o = 0, s = !1, a = function() { s && !t.length && !e && A.complete(); }, D = function(n) { return e < Q ? r(n) : t.push(n); }, r = function(n) { e++; var h = !1; lQ(B(n, o++)).subscribe(KB(A, function(G) { A.next(G); }, function() { h = !0; }, void 0, function() { if (h) try { e--; for (var G = function() { var w = t.shift(); C || r(w); }; t.length && e < Q; ) G(); a(); } catch (w) { A.error(w); } })); }; return g.subscribe(KB(A, D, function() { s = !0, a(); })), function() { }; } function sE(g, A, B) { return B === void 0 && (B = 1 / 0), lB(A) ? sE(function(Q, I) { return VA(function(E, C) { return A(Q, E, I, C); })(lQ(g(Q, I))); }, B) : (typeof A == "number" && (B = A), FQ(function(Q, I) { return QR(Q, I, g, B); })); } function Er(g) { return g === void 0 && (g = 1 / 0), sE(EC, g); } function gR() { return Er(1); } function cn() { for (var g = [], A = 0; A < arguments.length; A++) g[A] = arguments[A]; return gR()(vB(g, Sa(g))); } function IR(g) { return new wA(function(A) { lQ(g()).subscribe(A); }); } function QQ() { for (var g = [], A = 0; A < arguments.length; A++) g[A] = arguments[A]; var B = Br(g), Q = jc(g), I = Q.args, E = Q.keys, C = new wA(function(i) { var t = I.length; if (!t) { i.complete(); return; } for (var e = new Array(t), o = t, s = t, a = function(r) { var n = !1; lQ(I[r]).subscribe(KB(i, function(h) { n || (n = !0, s--), e[r] = h; }, function() { return o--; }, void 0, function() { (!o || !n) && (s || i.next(E ? _c(E, e) : e), i.complete()); })); }, D = 0; D < t; D++) a(D); }); return B ? C.pipe(Ir(B)) : C; } var ER = ["addListener", "removeListener"], CR = ["addEventListener", "removeEventListener"], iR = ["on", "off"]; function OA(g, A, B, Q) { if (lB(B) && (Q = B, B = void 0), Q) return OA(g, A, B).pipe(Ir(Q)); var I = _E(oR(g) ? CR.map(function(i) { return function(t) { return g[i](A, t, B); }; }) : tR(g) ? ER.map(wn(g, A)) : eR(g) ? iR.map(wn(g, A)) : [], 2), E = I[0], C = I[1]; if (!E && Qr(g)) return sE(function(i) { return OA(i, A, B); })(lQ(g)); if (!E) throw new TypeError("Invalid event target"); return new wA(function(i) { var t = function() { for (var e = [], o = 0; o < arguments.length; o++) e[o] = arguments[o]; return i.next(1 < e.length ? e : e[0]); }; return E(t), function() { return C(t); }; }); } function wn(g, A) { return function(B) { return function(Q) { return g[B](A, Q); }; }; } function tR(g) { return lB(g.addListener) && lB(g.removeListener); } function eR(g) { return lB(g.on) && lB(g.off); } function oR(g) { return lB(g.addEventListener) && lB(g.removeEventListener); } function OE(g, A, B) { g === void 0 && (g = 0), B === void 0 && (B = Jd); var Q = -1; return A != null && (Kc(A) ? B = A : Q = A), new wA(function(I) { var E = Pc(g) ? +g - B.now() : g; E < 0 && (E = 0); var C = 0; return B.schedule(function() { I.closed || (I.next(C++), 0 <= Q ? this.schedule(void 0, Q) : I.complete()); }, E); }); } function Cr(g, A) { return g === void 0 && (g = 0), A === void 0 && (A = Ri), g < 0 && (g = 0), OE(g, g, A); } function yQ() { for (var g = [], A = 0; A < arguments.length; A++) g[A] = arguments[A]; var B = Sa(g), Q = Hd(g, 1 / 0), I = g; return I.length ? I.length === 1 ? lQ(I[0]) : Er(Q)(vB(I, B)) : $D; } var aR = Array.isArray; function $c(g) { return g.length === 1 && aR(g[0]) ? g[0] : g; } function lA(g, A) { return FQ(function(B, Q) { var I = 0; B.subscribe(KB(Q, function(E) { return g.call(A, E, I++) && Q.next(E); })); }); } function sR() { for (var g = [], A = 0; A < arguments.length; A++) g[A] = arguments[A]; return g = $c(g), g.length === 1 ? lQ(g[0]) : new wA(DR(g)); } function DR(g) { return function(A) { for (var B = [], Q = function(E) { B.push(lQ(g[E]).subscribe(KB(A, function(C) { if (B) { for (var i = 0; i < B.length; i++) i !== E && B[i].unsubscribe(); B = null; } A.next(C); }))); }, I = 0; B && !A.closed && I < g.length; I++) Q(I); }; } function CC() { for (var g = [], A = 0; A < arguments.length; A++) g[A] = arguments[A]; var B = Br(g), Q = $c(g); return Q.length ? new wA(function(I) { var E = Q.map(function() { return []; }), C = Q.map(function() { return !1; }); I.add(function() { E = C = null; }); for (var i = function(e) { lQ(Q[e]).subscribe(KB(I, function(o) { if (E[e].push(o), E.every(function(a) { return a.length; })) { var s = E.map(function(a) { return a.shift(); }); I.next(B ? B.apply(void 0, si([], _E(s))) : s), E.some(function(a, D) { return !a.length && C[D]; }) && I.complete(); } }, function() { C[e] = !0, !E[e].length && I.complete(); })); }, t = 0; !I.closed && t < Q.length; t++) i(t); return function() { E = C = null; }; }) : $D; } function aI(g) { return FQ(function(A, B) { var Q = null, I = !1, E; Q = A.subscribe(KB(B, void 0, void 0, function(C) { E = lQ(g(C, aI(g)(A))), Q ? (Q.unsubscribe(), Q = null, E.subscribe(B)) : I = !0; })), I && (Q.unsubscribe(), Q = null, E.subscribe(B)); }); } function rR(g, A, B, Q, I) { return function(E, C) { var i = B, t = A, e = 0; E.subscribe(KB(C, function(o) { var s = e++; t = i ? g(t, o, s) : (i = !0, o); }, function() { i && C.next(t), C.complete(); })); }; } function nR(g, A) { return FQ(rR(g, A, arguments.length >= 2, !1, !0)); } var hR = function(g, A) { return g.push(A), g; }; function Os() { return FQ(function(g, A) { nR(hR, [])(g).subscribe(A); }); } function vs(g, A) { return lB(A) ? sE(g, A, 1) : sE(g, 1); } function Fg(g, A) { return A === void 0 && (A = Ri), FQ(function(B, Q) { var I = null, E = null, C = null, i = function() { if (I) { I.unsubscribe(), I = null; var e = E; E = null, Q.next(e); } }; function t() { var e = C + g, o = A.now(); if (o < e) { I = this.schedule(void 0, e - o), Q.add(I); return; } i(); } B.subscribe(KB(Q, function(e) { E = e, C = A.now(), I || (I = A.schedule(t, g), Q.add(I)); }, function() { i(), Q.complete(); }, void 0, function() { E = I = null; })); }); } function cR(g) { return FQ(function(A, B) { var Q = !1; A.subscribe(KB(B, function(I) { Q = !0, B.next(I); }, function() { Q || B.next(g), B.complete(); })); }); } function vA(g) { return g <= 0 ? function() { return $D; } : FQ(function(A, B) { var Q = 0; A.subscribe(KB(B, function(I) { ++Q <= g && (B.next(I), g <= Q && B.complete()); })); }); } function wR(g) { return VA(function() { return g; }); } function GR(g, A) { return sE(function(B, Q) { return lQ(g(B, Q)).pipe(vA(1), wR(B)); }); } function FR(g, A) { A === void 0 && (A = Ri); var B = OE(g, A); return GR(function() { return B; }); } function ir(g, A) { return A === void 0 && (A = EC), g = g ?? lR, FQ(function(B, Q) { var I, E = !0; B.subscribe(KB(Q, function(C) { var i = A(C); (E || !g(I, i)) && (E = !1, I = i, Q.next(C)); })); }); } function lR(g, A) { return g === A; } function dR(g) { return g === void 0 && (g = RR), FQ(function(A, B) { var Q = !1; A.subscribe(KB(B, function(I) { Q = !0, B.next(I); }, function() { return Q ? B.complete() : B.error(g()); })); }); } function RR() { return new gr(); } function oI(g, A) { var B = arguments.length >= 2; return function(Q) { return Q.pipe(EC, vA(1), B ? cR(A) : dR(function() { return new gr(); })); }; } function UR(g) { return FQ(function(A, B) { var Q = !1, I = null; A.subscribe(KB(B, function(E) { Q = !0, I = E; })), lQ(g).subscribe(KB(B, function() { if (Q) { Q = !1; var E = I; I = null, B.next(E); } }, To)); }); } function tr(g, A) { return A === void 0 && (A = Ri), UR(Cr(g, A)); } function Gn(g) { return lA(function(A, B) { return g <= B; }); } function Di(g, A) { return FQ(function(B, Q) { var I = null, E = 0, C = !1, i = function() { return C && !I && Q.complete(); }; B.subscribe(KB(Q, function(t) { I == null || I.unsubscribe(); var e = 0, o = E++; lQ(g(t, o)).subscribe(I = KB(Q, function(s) { return Q.next(A ? A(t, s, o, e++) : s); }, function() { I = null, i(); })); }, function() { C = !0, i(); })); }); } function c(g) { return FQ(function(A, B) { lQ(g).subscribe(KB(B, function() { return B.complete(); }, To)), !B.closed && A.subscribe(B); }); } function vE(g, A, B) { var Q = lB(g) || A || B ? { next: g, error: A, complete: B } : g; return Q ? FQ(function(I, E) { var C; (C = Q.subscribe) === null || C === void 0 || C.call(Q); var i = !0; I.subscribe(KB(E, function(t) { var e; (e = Q.next) === null || e === void 0 || e.call(Q, t), E.next(t); }, function() { var t; i = !1, (t = Q.complete) === null || t === void 0 || t.call(Q), E.complete(); }, function(t) { var e; i = !1, (e = Q.error) === null || e === void 0 || e.call(Q, t), E.error(t); }, function() { var t, e; i && ((t = Q.unsubscribe) === null || t === void 0 || t.call(Q)), (e = Q.finalize) === null || e === void 0 || e.call(Q); })); }) : EC; } class er { constructor(A) { this.onChange$ = new y(), this.style = { ...A }; } get style() { return this._style; } set style(A) { let B = JSON.stringify(this._style); this._style = { ...this._style, ...A }, B !== JSON.stringify(this._style) && this.onChange$.next(this._style); } } class _B { static isNullUndefinedOrWhitespace(A) { return typeof A === void 0 || A == null ? !0 : `${A}`.replace(/\s/g, "").length < 1; } static isNonEmpty(A) { return !this.isNullUndefinedOrWhitespace(A); } static isEmpty(A) { return !this.isNonEmpty(A); } static toArrayBuffer(A) { return new TextEncoder().encode(A).buffer; } } class MB extends Error { constructor(A, B) { super(A), this.name = _B.isNullUndefinedOrWhitespace(B) ? "OmpError" : B; } } class kR extends MB { constructor(A) { super(A, "OmpBroadcastChannelError"); } } class yR extends MB { constructor(A) { super(A, "OmpBroadcastChannelTimeoutError"); } } class UQ extends MB { constructor(A) { super(A, "OmpVideoWindowPlaybackError"); } } var sB; (function(g) { g.assertEqual = (I) => I; function A(I) { } g.assertIs = A; function B(I) { throw new Error(); } g.assertNever = B, g.arrayToEnum = (I) => { const E = {}; for (const C of I) E[C] = C; return E; }, g.getValidEnumValues = (I) => { const E = g.objectKeys(I).filter((i) => typeof I[I[i]] != "number"), C = {}; for (const i of E) C[i] = I[i]; return g.objectValues(C); }, g.objectValues = (I) => g.objectKeys(I).map(function(E) { return I[E]; }), g.objectKeys = typeof Object.keys == "function" ? (I) => Object.keys(I) : (I) => { const E = []; for (const C in I) Object.prototype.hasOwnProperty.call(I, C) && E.push(C); return E; }, g.find = (I, E) => { for (const C of I) if (E(C)) return C; }, g.isInteger = typeof Number.isInteger == "function" ? (I) => Number.isInteger(I) : (I) => typeof I == "number" && isFinite(I) && Math.floor(I) === I; function Q(I, E = " | ") { return I.map((C) => typeof C == "string" ? `'${C}'` : C).join(E); } g.joinValues = Q, g.jsonStringifyReplacer = (I, E) => typeof E == "bigint" ? E.toString() : E; })(sB || (sB = {})); var qs; (function(g) { g.mergeShapes = (A, B) => ({ ...A, ...B // second overwrites first }); })(qs || (qs = {})); const UA = sB.arrayToEnum([ "string", "nan", "number", "integer", "float", "boolean", "date", "bigint", "symbol", "function", "undefined", "null", "array", "object", "unknown", "promise", "void", "never", "map", "set" ]), EE = (g) => { switch (typeof g) { case "undefined": return UA.undefined; case "string": return UA.string; case "number": return isNaN(g) ? UA.nan : UA.number; case "boolean": return UA.boolean; case "function": return UA.function; case "bigint": return UA.bigint; case "symbol": return UA.symbol; case "object": return Array.isArray(g) ? UA.array : g === null ? UA.null : g.then && typeof g.then == "function" && g.catch && typeof g.catch == "function" ? UA.promise : typeof Map < "u" && g instanceof Map ? UA.map : typeof Set < "u" && g instanceof Set ? UA.set : typeof Date < "u" && g instanceof Date ? UA.date : UA.object; default: return UA.unknown; } }, EA = sB.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" ]), MR = (g) => JSON.stringify(g, null, 2).replace(/"([^"]+)":/g, "$1:"); class _Q extends Error { constructor(A) { super(), this.issues = [], this.addIssue = (Q) => { this.issues = [...this.issues, Q]; }, this.addIssues = (Q = []) => { this.issues = [...this.issues, ...Q]; }; const B = new.target.prototype; Object.setPrototypeOf ? Object.setPrototypeOf(this, B) : this.__proto__ = B, this.name = "ZodError", this.issues = A; } get errors() { return this.issues; } format(A) { const B = A || function(E) { return E.message; }, Q = { _errors: [] }, I = (E) => { for (const C of E.issues) if (C.code === "invalid_union") C.unionErrors.map(I); else if (C.code === "invalid_return_type") I(C.returnTypeError); else if (C.code === "invalid_arguments") I(C.argumentsError); else if (C.path.length === 0) Q._errors.push(B(C)); else { let i = Q, t = 0; for (; t < C.path.length; ) { const e = C.path[t]; t === C.path.length - 1 ? (i[e] = i[e] || { _errors: [] }, i[e]._errors.push(B(C))) : i[e] = i[e] || { _errors: [] }, i = i[e], t++; } } }; return I(this), Q; } static assert(A) { if (!(A instanceof _Q)) throw new Error(`Not a ZodError: ${A}`); } toString() { return this.message; } get message() { return JSON.stringify(this.issues, sB.jsonStringifyReplacer, 2); } get isEmpty() { return this.issues.length === 0; } flatten(A = (B) => B.message) { const B = {}, Q = []; for (const I of this.issues) I.path.length > 0 ? (B[I.path[0]] = B[I.path[0]] || [], B[I.path[0]].push(A(I))) : Q.push(A(I)); return { formErrors: Q, fieldErrors: B }; } get formErrors() { return this.flatten(); } } _Q.create = (g) => new _Q(g); const ri = (g, A) => { let B; switch (g.code) { case EA.invalid_type: g.received === UA.undefined ? B = "Required" : B = `Expected ${g.expected}, received ${g.received}`; break; case EA.invalid_literal: B = `Invalid literal value, expected ${JSON.stringify(g.expected, sB.jsonStringifyReplacer)}`; break; case EA.unrecognized_keys: B = `Unrecognized key(s) in object: ${sB.joinValues(g.keys, ", ")}`; break; case EA.invalid_union: B = "Invalid input"; break; case EA.invalid_union_discriminator: B = `Invalid discriminator value. Expected ${sB.joinValues(g.options)}`; break; case EA.invalid_enum_value: B = `Invalid enum value. Expected ${sB.joinValues(g.options)}, received