UNPKG

soundcraft-ui-connection

Version:

Library for controlling the Soundcraft Ui series audio mixers

1,853 lines 115 kB
import zt from "modern-isomorphic-ws"; var be = function(n, e) { return be = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, r) { t.__proto__ = r; } || function(t, r) { for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (t[s] = r[s]); }, be(n, e); }; function O(n, e) { if (typeof e != "function" && e !== null) throw new TypeError("Class extends value " + String(e) + " is not a constructor or null"); be(n, e); function t() { this.constructor = n; } n.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t()); } var ye = function() { return ye = Object.assign || function(e) { for (var t, r = 1, s = arguments.length; r < s; r++) { t = arguments[r]; for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]); } return e; }, ye.apply(this, arguments); }; function Vt(n, e, t, r) { function s(i) { return i instanceof t ? i : new t(function(o) { o(i); }); } return new (t || (t = Promise))(function(i, o) { function a(h) { try { u(r.next(h)); } catch (l) { o(l); } } function c(h) { try { u(r.throw(h)); } catch (l) { o(l); } } function u(h) { h.done ? i(h.value) : s(h.value).then(a, c); } u((r = r.apply(n, e || [])).next()); }); } function nt(n, e) { var t = { label: 0, sent: function() { if (i[0] & 1) throw i[1]; return i[1]; }, trys: [], ops: [] }, r, s, i, o = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype); return o.next = a(0), o.throw = a(1), o.return = a(2), typeof Symbol == "function" && (o[Symbol.iterator] = function() { return this; }), o; function a(u) { return function(h) { return c([u, h]); }; } function c(u) { if (r) throw new TypeError("Generator is already executing."); for (; o && (o = 0, u[0] && (t = 0)), t; ) try { if (r = 1, s && (i = u[0] & 2 ? s.return : u[0] ? s.throw || ((i = s.return) && i.call(s), 0) : s.next) && !(i = i.call(s, u[1])).done) return i; switch (s = 0, i && (u = [u[0] & 2, i.value]), u[0]) { case 0: case 1: i = u; break; case 4: return t.label++, { value: u[1], done: !1 }; case 5: t.label++, s = u[1], u = [0]; continue; case 7: u = t.ops.pop(), t.trys.pop(); continue; default: if (i = t.trys, !(i = i.length > 0 && i[i.length - 1]) && (u[0] === 6 || u[0] === 2)) { t = 0; continue; } if (u[0] === 3 && (!i || u[1] > i[0] && u[1] < i[3])) { t.label = u[1]; break; } if (u[0] === 6 && t.label < i[1]) { t.label = i[1], i = u; break; } if (i && t.label < i[2]) { t.label = i[2], t.ops.push(u); break; } i[2] && t.ops.pop(), t.trys.pop(); continue; } u = e.call(n, t); } catch (h) { u = [6, h], s = 0; } finally { r = i = 0; } if (u[0] & 5) throw u[1]; return { value: u[0] ? u[1] : void 0, done: !0 }; } } function N(n) { var e = typeof Symbol == "function" && Symbol.iterator, t = e && n[e], r = 0; if (t) return t.call(n); if (n && typeof n.length == "number") return { next: function() { return n && r >= n.length && (n = void 0), { value: n && n[r++], done: !n }; } }; throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined."); } function R(n, e) { var t = typeof Symbol == "function" && n[Symbol.iterator]; if (!t) return n; var r = t.call(n), s, i = [], o; try { for (; (e === void 0 || e-- > 0) && !(s = r.next()).done; ) i.push(s.value); } catch (a) { o = { error: a }; } finally { try { s && !s.done && (t = r.return) && t.call(r); } finally { if (o) throw o.error; } } return i; } function j(n, e, t) { if (t || arguments.length === 2) for (var r = 0, s = e.length, i; r < s; r++) (i || !(r in e)) && (i || (i = Array.prototype.slice.call(e, 0, r)), i[r] = e[r]); return n.concat(i || Array.prototype.slice.call(e)); } function U(n) { return this instanceof U ? (this.v = n, this) : new U(n); } function Yt(n, e, t) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var r = t.apply(n, e || []), s, i = []; return s = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), a("next"), a("throw"), a("return", o), s[Symbol.asyncIterator] = function() { return this; }, s; function o(f) { return function(y) { return Promise.resolve(y).then(f, l); }; } function a(f, y) { r[f] && (s[f] = function(d) { return new Promise(function(I, L) { i.push([f, d, I, L]) > 1 || c(f, d); }); }, y && (s[f] = y(s[f]))); } function c(f, y) { try { u(r[f](y)); } catch (d) { v(i[0][3], d); } } function u(f) { f.value instanceof U ? Promise.resolve(f.value.v).then(h, l) : v(i[0][2], f); } function h(f) { c("next", f); } function l(f) { c("throw", f); } function v(f, y) { f(y), i.shift(), i.length && c(i[0][0], i[0][1]); } } function Ht(n) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var e = n[Symbol.asyncIterator], t; return e ? e.call(n) : (n = typeof N == "function" ? N(n) : n[Symbol.iterator](), t = {}, r("next"), r("throw"), r("return"), t[Symbol.asyncIterator] = function() { return this; }, t); function r(i) { t[i] = n[i] && function(o) { return new Promise(function(a, c) { o = n[i](o), s(a, c, o.done, o.value); }); }; } function s(i, o, a, c) { Promise.resolve(c).then(function(u) { i({ value: u, done: a }); }, o); } } function S(n) { return typeof n == "function"; } function Ie(n) { var e = function(r) { Error.call(r), r.stack = new Error().stack; }, t = n(e); return t.prototype = Object.create(Error.prototype), t.prototype.constructor = t, t; } var de = Ie(function(n) { return function(t) { n(this), this.message = t ? t.length + ` errors occurred during unsubscription: ` + t.map(function(r, s) { return s + 1 + ") " + r.toString(); }).join(` `) : "", this.name = "UnsubscriptionError", this.errors = t; }; }); function oe(n, e) { if (n) { var t = n.indexOf(e); 0 <= t && n.splice(t, 1); } } var V = function() { function n(e) { this.initialTeardown = e, this.closed = !1, this._parentage = null, this._finalizers = null; } return n.prototype.unsubscribe = function() { var e, t, r, s, i; if (!this.closed) { this.closed = !0; var o = this._parentage; if (o) if (this._parentage = null, Array.isArray(o)) try { for (var a = N(o), c = a.next(); !c.done; c = a.next()) { var u = c.value; u.remove(this); } } catch (d) { e = { error: d }; } finally { try { c && !c.done && (t = a.return) && t.call(a); } finally { if (e) throw e.error; } } else o.remove(this); var h = this.initialTeardown; if (S(h)) try { h(); } catch (d) { i = d instanceof de ? d.errors : [d]; } var l = this._finalizers; if (l) { this._finalizers = null; try { for (var v = N(l), f = v.next(); !f.done; f = v.next()) { var y = f.value; try { Be(y); } catch (d) { i = i ?? [], d instanceof de ? i = j(j([], R(i)), R(d.errors)) : i.push(d); } } } catch (d) { r = { error: d }; } finally { try { f && !f.done && (s = v.return) && s.call(v); } finally { if (r) throw r.error; } } } if (i) throw new de(i); } }, n.prototype.add = function(e) { var t; if (e && e !== this) if (this.closed) Be(e); else { if (e instanceof n) { if (e.closed || e._hasParent(this)) return; e._addParent(this); } (this._finalizers = (t = this._finalizers) !== null && t !== void 0 ? t : []).push(e); } }, n.prototype._hasParent = function(e) { var t = this._parentage; return t === e || Array.isArray(t) && t.includes(e); }, n.prototype._addParent = function(e) { var t = this._parentage; this._parentage = Array.isArray(t) ? (t.push(e), t) : t ? [t, e] : e; }, n.prototype._removeParent = function(e) { var t = this._parentage; t === e ? this._parentage = null : Array.isArray(t) && oe(t, e); }, n.prototype.remove = function(e) { var t = this._finalizers; t && oe(t, e), e instanceof n && e._removeParent(this); }, n.EMPTY = function() { var e = new n(); return e.closed = !0, e; }(), n; }(), rt = V.EMPTY; function st(n) { return n instanceof V || n && "closed" in n && S(n.remove) && S(n.add) && S(n.unsubscribe); } function Be(n) { S(n) ? n() : n.unsubscribe(); } var it = { onUnhandledError: null, onStoppedNotification: null, Promise: void 0, useDeprecatedSynchronousErrorHandling: !1, useDeprecatedNextContext: !1 }, ot = { setTimeout: function(n, e) { for (var t = [], r = 2; r < arguments.length; r++) t[r - 2] = arguments[r]; return setTimeout.apply(void 0, j([n, e], R(t))); }, clearTimeout: function(n) { var e = ot.delegate; return ((e == null ? void 0 : e.clearTimeout) || clearTimeout)(n); }, delegate: void 0 }; function at(n) { ot.setTimeout(function() { throw n; }); } function ae() { } function re(n) { n(); } var he = function(n) { O(e, n); function e(t) { var r = n.call(this) || this; return r.isStopped = !1, t ? (r.destination = t, st(t) && t.add(r)) : r.destination = Xt, r; } return e.create = function(t, r, s) { return new G(t, r, 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, n.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; }(V), Kt = Function.prototype.bind; function ve(n, e) { return Kt.call(n, e); } var qt = function() { function n(e) { this.partialObserver = e; } return n.prototype.next = function(e) { var t = this.partialObserver; if (t.next) try { t.next(e); } catch (r) { ee(r); } }, n.prototype.error = function(e) { var t = this.partialObserver; if (t.error) try { t.error(e); } catch (r) { ee(r); } else ee(e); }, n.prototype.complete = function() { var e = this.partialObserver; if (e.complete) try { e.complete(); } catch (t) { ee(t); } }, n; }(), G = function(n) { O(e, n); function e(t, r, s) { var i = n.call(this) || this, o; if (S(t) || !t) o = { next: t ?? void 0, error: r ?? void 0, complete: s ?? void 0 }; else { var a; i && it.useDeprecatedNextContext ? (a = Object.create(t), a.unsubscribe = function() { return i.unsubscribe(); }, o = { next: t.next && ve(t.next, a), error: t.error && ve(t.error, a), complete: t.complete && ve(t.complete, a) }) : o = t; } return i.destination = new qt(o), i; } return e; }(he); function ee(n) { at(n); } function Jt(n) { throw n; } var Xt = { closed: !0, next: ae, error: Jt, complete: ae }, Te = function() { return typeof Symbol == "function" && Symbol.observable || "@@observable"; }(); function F(n) { return n; } function Zt() { for (var n = [], e = 0; e < arguments.length; e++) n[e] = arguments[e]; return ct(n); } function ct(n) { return n.length === 0 ? F : n.length === 1 ? n[0] : function(t) { return n.reduce(function(r, s) { return s(r); }, t); }; } var w = function() { function n(e) { e && (this._subscribe = e); } return n.prototype.lift = function(e) { var t = new n(); return t.source = this, t.operator = e, t; }, n.prototype.subscribe = function(e, t, r) { var s = this, i = en(e) ? e : new G(e, t, r); return re(function() { var o = s, a = o.operator, c = o.source; i.add(a ? a.call(i, c) : c ? s._subscribe(i) : s._trySubscribe(i)); }), i; }, n.prototype._trySubscribe = function(e) { try { return this._subscribe(e); } catch (t) { e.error(t); } }, n.prototype.forEach = function(e, t) { var r = this; return t = We(t), new t(function(s, i) { var o = new G({ next: function(a) { try { e(a); } catch (c) { i(c), o.unsubscribe(); } }, error: i, complete: s }); r.subscribe(o); }); }, n.prototype._subscribe = function(e) { var t; return (t = this.source) === null || t === void 0 ? void 0 : t.subscribe(e); }, n.prototype[Te] = function() { return this; }, n.prototype.pipe = function() { for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t]; return ct(e)(this); }, n.prototype.toPromise = function(e) { var t = this; return e = We(e), new e(function(r, s) { var i; t.subscribe(function(o) { return i = o; }, function(o) { return s(o); }, function() { return r(i); }); }); }, n.create = function(e) { return new n(e); }, n; }(); function We(n) { var e; return (e = n ?? it.Promise) !== null && e !== void 0 ? e : Promise; } function Qt(n) { return n && S(n.next) && S(n.error) && S(n.complete); } function en(n) { return n && n instanceof he || Qt(n) && st(n); } function tn(n) { return S(n == null ? void 0 : n.lift); } function _(n) { return function(e) { if (tn(e)) return e.lift(function(t) { try { return n(t, this); } catch (r) { this.error(r); } }); throw new TypeError("Unable to lift unknown Observable type"); }; } function x(n, e, t, r, s) { return new nn(n, e, t, r, s); } var nn = function(n) { O(e, n); function e(t, r, s, i, o, a) { var c = n.call(this, t) || this; return c.onFinalize = o, c.shouldUnsubscribe = a, c._next = r ? function(u) { try { r(u); } catch (h) { t.error(h); } } : n.prototype._next, c._error = i ? function(u) { try { i(u); } catch (h) { t.error(h); } finally { this.unsubscribe(); } } : n.prototype._error, c._complete = s ? function() { try { s(); } catch (u) { t.error(u); } finally { this.unsubscribe(); } } : n.prototype._complete, c; } return e.prototype.unsubscribe = function() { var t; if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) { var r = this.closed; n.prototype.unsubscribe.call(this), !r && ((t = this.onFinalize) === null || t === void 0 || t.call(this)); } }, e; }(he), rn = Ie(function(n) { return function() { n(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed"; }; }), P = function(n) { O(e, n); function e() { var t = n.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 r = new ge(this, this); return r.operator = t, r; }, e.prototype._throwIfClosed = function() { if (this.closed) throw new rn(); }, e.prototype.next = function(t) { var r = this; re(function() { var s, i; if (r._throwIfClosed(), !r.isStopped) { r.currentObservers || (r.currentObservers = Array.from(r.observers)); try { for (var o = N(r.currentObservers), a = o.next(); !a.done; a = o.next()) { var c = a.value; c.next(t); } } catch (u) { s = { error: u }; } finally { try { a && !a.done && (i = o.return) && i.call(o); } finally { if (s) throw s.error; } } } }); }, e.prototype.error = function(t) { var r = this; re(function() { if (r._throwIfClosed(), !r.isStopped) { r.hasError = r.isStopped = !0, r.thrownError = t; for (var s = r.observers; s.length; ) s.shift().error(t); } }); }, e.prototype.complete = function() { var t = this; re(function() { if (t._throwIfClosed(), !t.isStopped) { t.isStopped = !0; for (var r = t.observers; r.length; ) r.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(), n.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 r = this, s = this, i = s.hasError, o = s.isStopped, a = s.observers; return i || o ? rt : (this.currentObservers = null, a.push(t), new V(function() { r.currentObservers = null, oe(a, t); })); }, e.prototype._checkFinalizedStatuses = function(t) { var r = this, s = r.hasError, i = r.thrownError, o = r.isStopped; s ? t.error(i) : o && t.complete(); }, e.prototype.asObservable = function() { var t = new w(); return t.source = this, t; }, e.create = function(t, r) { return new ge(t, r); }, e; }(w), ge = function(n) { O(e, n); function e(t, r) { var s = n.call(this) || this; return s.destination = t, s.source = r, s; } return e.prototype.next = function(t) { var r, s; (s = (r = this.destination) === null || r === void 0 ? void 0 : r.next) === null || s === void 0 || s.call(r, t); }, e.prototype.error = function(t) { var r, s; (s = (r = this.destination) === null || r === void 0 ? void 0 : r.error) === null || s === void 0 || s.call(r, t); }, e.prototype.complete = function() { var t, r; (r = (t = this.destination) === null || t === void 0 ? void 0 : t.complete) === null || r === void 0 || r.call(t); }, e.prototype._subscribe = function(t) { var r, s; return (s = (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(t)) !== null && s !== void 0 ? s : rt; }, e; }(P), ke = { now: function() { return (ke.delegate || Date).now(); }, delegate: void 0 }, K = function(n) { O(e, n); function e(t, r, s) { t === void 0 && (t = 1 / 0), r === void 0 && (r = 1 / 0), s === void 0 && (s = ke); var i = n.call(this) || this; return i._bufferSize = t, i._windowTime = r, i._timestampProvider = s, i._buffer = [], i._infiniteTimeWindow = !0, i._infiniteTimeWindow = r === 1 / 0, i._bufferSize = Math.max(1, t), i._windowTime = Math.max(1, r), i; } return e.prototype.next = function(t) { var r = this, s = r.isStopped, i = r._buffer, o = r._infiniteTimeWindow, a = r._timestampProvider, c = r._windowTime; s || (i.push(t), !o && i.push(a.now() + c)), this._trimBuffer(), n.prototype.next.call(this, t); }, e.prototype._subscribe = function(t) { this._throwIfClosed(), this._trimBuffer(); for (var r = this._innerSubscribe(t), s = this, i = s._infiniteTimeWindow, o = s._buffer, a = o.slice(), c = 0; c < a.length && !t.closed; c += i ? 1 : 2) t.next(a[c]); return this._checkFinalizedStatuses(t), r; }, e.prototype._trimBuffer = function() { var t = this, r = t._bufferSize, s = t._timestampProvider, i = t._buffer, o = t._infiniteTimeWindow, a = (o ? 1 : 2) * r; if (r < 1 / 0 && a < i.length && i.splice(0, i.length - a), !o) { for (var c = s.now(), u = 0, h = 1; h < i.length && i[h] <= c; h += 2) u = h; u && i.splice(0, u + 1); } }, e; }(P), sn = function(n) { O(e, n); function e(t, r) { return n.call(this) || this; } return e.prototype.schedule = function(t, r) { return this; }, e; }(V), Ue = { setInterval: function(n, e) { for (var t = [], r = 2; r < arguments.length; r++) t[r - 2] = arguments[r]; return setInterval.apply(void 0, j([n, e], R(t))); }, clearInterval: function(n) { return clearInterval(n); }, delegate: void 0 }, on = function(n) { O(e, n); function e(t, r) { var s = n.call(this, t, r) || this; return s.scheduler = t, s.work = r, s.pending = !1, s; } return e.prototype.schedule = function(t, r) { var s; if (r === void 0 && (r = 0), this.closed) return this; this.state = t; var i = this.id, o = this.scheduler; return i != null && (this.id = this.recycleAsyncId(o, i, r)), this.pending = !0, this.delay = r, this.id = (s = this.id) !== null && s !== void 0 ? s : this.requestAsyncId(o, this.id, r), this; }, e.prototype.requestAsyncId = function(t, r, s) { return s === void 0 && (s = 0), Ue.setInterval(t.flush.bind(t, this), s); }, e.prototype.recycleAsyncId = function(t, r, s) { if (s === void 0 && (s = 0), s != null && this.delay === s && this.pending === !1) return r; r != null && Ue.clearInterval(r); }, e.prototype.execute = function(t, r) { if (this.closed) return new Error("executing a cancelled action"); this.pending = !1; var s = this._execute(t, r); if (s) return s; this.pending === !1 && this.id != null && (this.id = this.recycleAsyncId(this.scheduler, this.id, null)); }, e.prototype._execute = function(t, r) { var s = !1, i; try { this.work(t); } catch (o) { s = !0, i = o || new Error("Scheduled action threw falsy error"); } if (s) return this.unsubscribe(), i; }, e.prototype.unsubscribe = function() { if (!this.closed) { var t = this, r = t.id, s = t.scheduler, i = s.actions; this.work = this.state = this.scheduler = null, this.pending = !1, oe(i, this), r != null && (this.id = this.recycleAsyncId(s, r, null)), this.delay = null, n.prototype.unsubscribe.call(this); } }, e; }(sn), Ne = function() { function n(e, t) { t === void 0 && (t = n.now), this.schedulerActionCtor = e, this.now = t; } return n.prototype.schedule = function(e, t, r) { return t === void 0 && (t = 0), new this.schedulerActionCtor(this, e).schedule(r, t); }, n.now = ke.now, n; }(), an = function(n) { O(e, n); function e(t, r) { r === void 0 && (r = Ne.now); var s = n.call(this, t, r) || this; return s.actions = [], s._active = !1, s; } return e.prototype.flush = function(t) { var r = this.actions; if (this._active) { r.push(t); return; } var s; this._active = !0; do if (s = t.execute(t.state, t.delay)) break; while (t = r.shift()); if (this._active = !1, s) { for (; t = r.shift(); ) t.unsubscribe(); throw s; } }, e; }(Ne), le = new an(on), cn = le, ut = new w(function(n) { return n.complete(); }); function ht(n) { return n && S(n.schedule); } function Me(n) { return n[n.length - 1]; } function lt(n) { return S(Me(n)) ? n.pop() : void 0; } function Ce(n) { return ht(Me(n)) ? n.pop() : void 0; } function un(n, e) { return typeof Me(n) == "number" ? n.pop() : e; } var ft = function(n) { return n && typeof n.length == "number" && typeof n != "function"; }; function pt(n) { return S(n == null ? void 0 : n.then); } function dt(n) { return S(n[Te]); } function vt(n) { return Symbol.asyncIterator && S(n == null ? void 0 : n[Symbol.asyncIterator]); } function mt(n) { return new TypeError("You provided " + (n !== null && typeof n == "object" ? "an invalid object" : "'" + n + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable."); } function hn() { return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator; } var bt = hn(); function yt(n) { return S(n == null ? void 0 : n[bt]); } function gt(n) { return Yt(this, arguments, function() { var t, r, s, i; return nt(this, function(o) { switch (o.label) { case 0: t = n.getReader(), o.label = 1; case 1: o.trys.push([1, , 9, 10]), o.label = 2; case 2: return [4, U(t.read())]; case 3: return r = o.sent(), s = r.value, i = r.done, i ? [4, U(void 0)] : [3, 5]; case 4: return [2, o.sent()]; case 5: return [4, U(s)]; case 6: return [4, o.sent()]; case 7: return o.sent(), [3, 2]; case 8: return [3, 10]; case 9: return t.releaseLock(), [7]; case 10: return [2]; } }); }); } function $t(n) { return S(n == null ? void 0 : n.getReader); } function k(n) { if (n instanceof w) return n; if (n != null) { if (dt(n)) return ln(n); if (ft(n)) return fn(n); if (pt(n)) return pn(n); if (vt(n)) return St(n); if (yt(n)) return dn(n); if ($t(n)) return vn(n); } throw mt(n); } function ln(n) { return new w(function(e) { var t = n[Te](); if (S(t.subscribe)) return t.subscribe(e); throw new TypeError("Provided object does not correctly implement Symbol.observable"); }); } function fn(n) { return new w(function(e) { for (var t = 0; t < n.length && !e.closed; t++) e.next(n[t]); e.complete(); }); } function pn(n) { return new w(function(e) { n.then(function(t) { e.closed || (e.next(t), e.complete()); }, function(t) { return e.error(t); }).then(null, at); }); } function dn(n) { return new w(function(e) { var t, r; try { for (var s = N(n), i = s.next(); !i.done; i = s.next()) { var o = i.value; if (e.next(o), e.closed) return; } } catch (a) { t = { error: a }; } finally { try { i && !i.done && (r = s.return) && r.call(s); } finally { if (t) throw t.error; } } e.complete(); }); } function St(n) { return new w(function(e) { mn(n, e).catch(function(t) { return e.error(t); }); }); } function vn(n) { return St(gt(n)); } function mn(n, e) { var t, r, s, i; return Vt(this, void 0, void 0, function() { var o, a; return nt(this, function(c) { switch (c.label) { case 0: c.trys.push([0, 5, 6, 11]), t = Ht(n), c.label = 1; case 1: return [4, t.next()]; case 2: if (r = c.sent(), !!r.done) return [3, 4]; if (o = r.value, e.next(o), e.closed) return [2]; c.label = 3; case 3: return [3, 1]; case 4: return [3, 11]; case 5: return a = c.sent(), s = { error: a }, [3, 11]; case 6: return c.trys.push([6, , 9, 10]), r && !r.done && (i = t.return) ? [4, i.call(t)] : [3, 8]; case 7: c.sent(), c.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 A(n, e, t, r, s) { r === void 0 && (r = 0), s === void 0 && (s = !1); var i = e.schedule(function() { t(), s ? n.add(this.schedule(null, r)) : this.unsubscribe(); }, r); if (n.add(i), !s) return i; } function wt(n, e) { return e === void 0 && (e = 0), _(function(t, r) { t.subscribe(x(r, function(s) { return A(r, n, function() { return r.next(s); }, e); }, function() { return A(r, n, function() { return r.complete(); }, e); }, function(s) { return A(r, n, function() { return r.error(s); }, e); })); }); } function xt(n, e) { return e === void 0 && (e = 0), _(function(t, r) { r.add(n.schedule(function() { return t.subscribe(r); }, e)); }); } function bn(n, e) { return k(n).pipe(xt(e), wt(e)); } function yn(n, e) { return k(n).pipe(xt(e), wt(e)); } function gn(n, e) { return new w(function(t) { var r = 0; return e.schedule(function() { r === n.length ? t.complete() : (t.next(n[r++]), t.closed || this.schedule()); }); }); } function $n(n, e) { return new w(function(t) { var r; return A(t, e, function() { r = n[bt](), A(t, e, function() { var s, i, o; try { s = r.next(), i = s.value, o = s.done; } catch (a) { t.error(a); return; } o ? t.complete() : t.next(i); }, 0, !0); }), function() { return S(r == null ? void 0 : r.return) && r.return(); }; }); } function It(n, e) { if (!n) throw new Error("Iterable cannot be null"); return new w(function(t) { A(t, e, function() { var r = n[Symbol.asyncIterator](); A(t, e, function() { r.next().then(function(s) { s.done ? t.complete() : t.next(s.value); }); }, 0, !0); }); }); } function Sn(n, e) { return It(gt(n), e); } function wn(n, e) { if (n != null) { if (dt(n)) return bn(n, e); if (ft(n)) return gn(n, e); if (pt(n)) return yn(n, e); if (vt(n)) return It(n, e); if (yt(n)) return $n(n, e); if ($t(n)) return Sn(n, e); } throw mt(n); } function fe(n, e) { return e ? wn(n, e) : k(n); } function Tt() { for (var n = [], e = 0; e < arguments.length; e++) n[e] = arguments[e]; var t = Ce(n); return fe(n, t); } var xn = Ie(function(n) { return function() { n(this), this.name = "EmptyError", this.message = "no elements in sequence"; }; }); function se(n, e) { return new Promise(function(t, r) { var s = new G({ next: function(i) { t(i), s.unsubscribe(); }, error: r, complete: function() { r(new xn()); } }); n.subscribe(s); }); } function In(n) { return n instanceof Date && !isNaN(n); } function p(n, e) { return _(function(t, r) { var s = 0; t.subscribe(x(r, function(i) { r.next(n.call(e, i, s++)); })); }); } var Tn = Array.isArray; function kn(n, e) { return Tn(e) ? n.apply(void 0, j([], R(e))) : n(e); } function Mn(n) { return p(function(e) { return kn(n, e); }); } var Cn = Array.isArray, En = Object.getPrototypeOf, _n = Object.prototype, Pn = Object.keys; function Ln(n) { if (n.length === 1) { var e = n[0]; if (Cn(e)) return { args: e, keys: null }; if (On(e)) { var t = Pn(e); return { args: t.map(function(r) { return e[r]; }), keys: t }; } } return { args: n, keys: null }; } function On(n) { return n && typeof n == "object" && En(n) === _n; } function Dn(n, e) { return n.reduce(function(t, r, s) { return t[r] = e[s], t; }, {}); } function $e() { for (var n = [], e = 0; e < arguments.length; e++) n[e] = arguments[e]; var t = Ce(n), r = lt(n), s = Ln(n), i = s.args, o = s.keys; if (i.length === 0) return fe([], t); var a = new w(An(i, t, o ? function(c) { return Dn(o, c); } : F)); return r ? a.pipe(Mn(r)) : a; } function An(n, e, t) { return t === void 0 && (t = F), function(r) { Ge(e, function() { for (var s = n.length, i = new Array(s), o = s, a = s, c = function(h) { Ge(e, function() { var l = fe(n[h], e), v = !1; l.subscribe(x(r, function(f) { i[h] = f, v || (v = !0, a--), a || r.next(t(i.slice())); }, function() { --o || r.complete(); })); }, r); }, u = 0; u < s; u++) c(u); }, r); }; } function Ge(n, e, t) { n ? A(t, n, e) : e(); } function Rn(n, e, t, r, s, i, o, a) { var c = [], u = 0, h = 0, l = !1, v = function() { l && !c.length && !u && e.complete(); }, f = function(d) { return u < r ? y(d) : c.push(d); }, y = function(d) { u++; var I = !1; k(t(d, h++)).subscribe(x(e, function(L) { e.next(L); }, function() { I = !0; }, void 0, function() { if (I) try { u--; for (var L = function() { var Y = c.shift(); o || y(Y); }; c.length && u < r; ) L(); v(); } catch (Y) { e.error(Y); } })); }; return n.subscribe(x(e, f, function() { l = !0, v(); })), function() { }; } function pe(n, e, t) { return t === void 0 && (t = 1 / 0), S(e) ? pe(function(r, s) { return p(function(i, o) { return e(r, i, s, o); })(k(n(r, s))); }, t) : (typeof e == "number" && (t = e), _(function(r, s) { return Rn(r, s, n, t); })); } function jn(n) { return n === void 0 && (n = 1 / 0), pe(F, n); } function Fn(n) { return new w(function(e) { k(n()).subscribe(e); }); } var Bn = { connector: function() { return new P(); }, resetOnDisconnect: !0 }; function ze(n, e) { e === void 0 && (e = Bn); var t = null, r = e.connector, s = e.resetOnDisconnect, i = s === void 0 ? !0 : s, o = r(), a = new w(function(c) { return o.subscribe(c); }); return a.connect = function() { return (!t || t.closed) && (t = Fn(function() { return n; }).subscribe(o), i && t.add(function() { return o = r(); })), t; }, a; } function X(n, e, t) { n === void 0 && (n = 0), t === void 0 && (t = cn); var r = -1; return e != null && (ht(e) ? t = e : r = e), new w(function(s) { var i = In(n) ? +n - t.now() : n; i < 0 && (i = 0); var o = 0; return t.schedule(function() { s.closed || (s.next(o++), 0 <= r ? this.schedule(void 0, r) : s.complete()); }, i); }); } function kt(n, e) { return n === void 0 && (n = 0), e === void 0 && (e = le), n < 0 && (n = 0), X(n, n, e); } function Wn() { for (var n = [], e = 0; e < arguments.length; e++) n[e] = arguments[e]; var t = Ce(n), r = un(n, 1 / 0), s = n; return s.length ? s.length === 1 ? k(s[0]) : jn(r)(fe(s, t)) : ut; } var Un = Array.isArray; function Nn(n) { return n.length === 1 && Un(n[0]) ? n[0] : n; } function C(n, e) { return _(function(t, r) { var s = 0; t.subscribe(x(r, function(i) { return n.call(e, i, s++) && r.next(i); })); }); } function Gn() { for (var n = [], e = 0; e < arguments.length; e++) n[e] = arguments[e]; return n = Nn(n), n.length === 1 ? k(n[0]) : new w(zn(n)); } function zn(n) { return function(e) { for (var t = [], r = function(i) { t.push(k(n[i]).subscribe(x(e, function(o) { if (t) { for (var a = 0; a < t.length; a++) a !== i && t[a].unsubscribe(); t = null; } e.next(o); }))); }, s = 0; t && !e.closed && s < n.length; s++) r(s); }; } function Vn(n, e, t, r, s) { return function(i, o) { var a = t, c = e, u = 0; i.subscribe(x(o, function(h) { var l = u++; c = a ? n(c, h, l) : (a = !0, h), o.next(c); }, s)); }; } function Yn(n, e) { return e === void 0 && (e = le), _(function(t, r) { var s = null, i = null, o = null, a = function() { if (s) { s.unsubscribe(), s = null; var u = i; i = null, r.next(u); } }; function c() { var u = o + n, h = e.now(); if (h < u) { s = this.schedule(void 0, u - h), r.add(s); return; } a(); } t.subscribe(x(r, function(u) { i = u, o = e.now(), s || (s = e.schedule(c, n), r.add(s)); }, function() { a(), r.complete(); }, void 0, function() { i = s = null; })); }); } function m(n) { return n <= 0 ? function() { return ut; } : _(function(e, t) { var r = 0; e.subscribe(x(t, function(s) { ++r <= n && (t.next(s), n <= r && t.complete()); })); }); } function Hn(n) { return p(function() { return n; }); } function Kn(n, e) { return pe(function(t, r) { return k(n(t, r)).pipe(m(1), Hn(t)); }); } function qn(n, e) { e === void 0 && (e = le); var t = X(n, e); return Kn(function() { return t; }); } function Mt(n, e) { return e === void 0 && (e = F), n = n ?? Jn, _(function(t, r) { var s, i = !0; t.subscribe(x(r, function(o) { var a = e(o); (i || !n(s, a)) && (i = !1, s = a, r.next(o)); })); }); } function Jn(n, e) { return n === e; } function Xn(n) { n === void 0 && (n = 1 / 0); var e; n && typeof n == "object" ? e = n : e = { count: n }; var t = e.count, r = t === void 0 ? 1 / 0 : t, s = e.delay, i = e.resetOnSuccess, o = i === void 0 ? !1 : i; return r <= 0 ? F : _(function(a, c) { var u = 0, h, l = function() { var v = !1; h = a.subscribe(x(c, function(f) { o && (u = 0), c.next(f); }, void 0, function(f) { if (u++ < r) { var y = function() { h ? (h.unsubscribe(), h = null, l()) : v = !0; }; if (s != null) { var d = typeof s == "number" ? X(s) : k(s(f, u)), I = x(c, function() { I.unsubscribe(), y(); }, function() { c.complete(); }); d.subscribe(I); } else y(); } else c.error(f); })), v && (h.unsubscribe(), h = null, l()); }; l(); }); } function Ve(n, e) { return _(Vn(n, e, arguments.length >= 2, !0)); } function Ct(n) { n === void 0 && (n = {}); var e = n.connector, t = e === void 0 ? function() { return new P(); } : e, r = n.resetOnError, s = r === void 0 ? !0 : r, i = n.resetOnComplete, o = i === void 0 ? !0 : i, a = n.resetOnRefCountZero, c = a === void 0 ? !0 : a; return function(u) { var h, l, v, f = 0, y = !1, d = !1, I = function() { l == null || l.unsubscribe(), l = void 0; }, L = function() { I(), h = v = void 0, y = d = !1; }, Y = function() { var H = h; L(), H == null || H.unsubscribe(); }; return _(function(H, Fe) { f++, !d && !y && I(); var Z = v = v ?? t(); Fe.add(function() { f--, f === 0 && !d && !y && (l = me(Y, c)); }), Z.subscribe(Fe), !h && f > 0 && (h = new G({ next: function(Q) { return Z.next(Q); }, error: function(Q) { d = !0, I(), l = me(L, s, Q), Z.error(Q); }, complete: function() { y = !0, I(), l = me(L, o), Z.complete(); } }), k(H).subscribe(h)); })(u); }; } function me(n, e) { for (var t = [], r = 2; r < arguments.length; r++) t[r - 2] = arguments[r]; if (e === !0) { n(); return; } if (e !== !1) { var s = new G({ next: function() { s.unsubscribe(), n(); } }); return k(e.apply(void 0, j([], R(t)))).subscribe(s); } } function q(n, e) { return _(function(t, r) { var s = null, i = 0, o = !1, a = function() { return o && !s && r.complete(); }; t.subscribe(x(r, function(c) { s == null || s.unsubscribe(); var u = 0, h = i++; k(n(c, h)).subscribe(s = x(r, function(l) { return r.next(e ? e(c, l, h, u++) : l); }, function() { s = null, a(); })); }, function() { o = !0, a(); })); }); } function Se(n) { return _(function(e, t) { k(n).subscribe(x(t, function() { return t.complete(); }, ae)), !t.closed && e.subscribe(t); }); } function Ye(n, e, t) { var r = S(n) || e || t ? { next: n, error: e, complete: t } : n; return r ? _(function(s, i) { var o; (o = r.subscribe) === null || o === void 0 || o.call(r); var a = !0; s.subscribe(x(i, function(c) { var u; (u = r.next) === null || u === void 0 || u.call(r, c), i.next(c); }, function() { var c; a = !1, (c = r.complete) === null || c === void 0 || c.call(r), i.complete(); }, function(c) { var u; a = !1, (u = r.error) === null || u === void 0 || u.call(r, c), i.error(c); }, function() { var c, u; a && ((c = r.unsubscribe) === null || c === void 0 || c.call(r)), (u = r.finalize) === null || u === void 0 || u.call(r); })); }) : F; } function Ee() { for (var n = [], e = 0; e < arguments.length; e++) n[e] = arguments[e]; var t = lt(n); return _(function(r, s) { for (var i = n.length, o = new Array(i), a = n.map(function() { return !1; }), c = !1, u = function(l) { k(n[l]).subscribe(x(s, function(v) { o[l] = v, !c && !a[l] && (a[l] = !0, (c = a.every(F)) && (a = null)); }, ae)); }, h = 0; h < i; h++) u(h); r.subscribe(x(s, function(l) { if (c) { var v = j([l], R(o)); s.next(t ? t.apply(void 0, j([], R(v))) : v); } })); }); } function $(n, e, t) { return n[e] ?? t; } function E(...n) { return n.join("."); } const b = (n) => Zt( p((e) => n(e)), Mt(), C((e) => e !== void 0) ), g = (n, e) => b((t) => $(t, n, e)), Et = (n, e, t, r, s, i = 1) => { switch (s) { case "master": { const o = E(t, r - 1, n); return (a) => $(a, o, e); } case "aux": case "fx": return (o) => { const a = E(t, r - 1, s, i - 1, n); return $(o, a, e); }; } }, Zn = () => (n) => $(n, "m.mix"), Qn = () => (n) => $(n, "m.pan"), er = () => (n) => $(n, "m.dim"), He = (n) => (e) => $(e, `m.delay${n}`, 0) * 1e3, _t = (n, e, t, r) => Et("pan", 0, n, e, t, r), tr = (n, e, t, r) => Et("mute", 0, n, e, t, r), nr = (n, e) => { const t = E(n, e - 1, "solo"); return (r) => $(r, t); }, rr = (n, e, t, r = 1) => { switch (t) { case "master": { const s = E(n, e - 1, "mix"); return (i) => $(i, s); } case "aux": case "fx": { const s = E(n, e - 1, t, r - 1, "value"); return (i) => $(i, s); } } }, sr = (n, e) => { const t = E(n, e - 1, "delay"); return (r) => $(r, t, 0) * 1e3; }, ir = (n, e, t, r) => { const s = E(n, e - 1, t, r - 1, "post"); return (i) => $(i, s, 0); }, or = (n = 1) => { const e = E("f", n - 1, "bpm"); return (t) => $(t, e); }, ar = (n = 1) => { const e = E("f", n - 1, "fxtype"); return (t) => $(t, e); }, Pt = (n, e) => { const t = E(n, e - 1, "stereoIndex"); return (r) => ["i", "l", "p", "a"].includes(n) ? $(r, t, -1) : -1; }, Ke = (n, e) => { const t = E(e, n - 1, "phantom"); return (r) => $(r, t); }, qe = (n, e) => { const t = E(e, n - 1, "gain"); return (r) => $(r, t); }, cr = (n, e) => { const t = E( "settings", n, ...e !== void 0 && e >= 0 ? [e] : [] ); return (r) => $(r, t); }, _e = () => (n) => $(n, "var.currentLength", -1), Lt = () => (n) => $(n, "var.currentTrackPos", 0), Pe = (n, e) => Math.max(0, Math.floor(n * e)), Ot = (n, e) => Math.max(0, Math.floor(e - Pe(n, e))), ur = () => (n) => { const e = Lt()(n), t = _e()(n); return Pe(e, t); }, hr = () => (n) => { const e = Lt()(n), t = _e()(n); return Ot(e, t); }, Le = () => (n) => $(n, "var.mtk.currentLength", -1), Dt = () => (n) => $(n, "var.mtk.currentTrackPos", 0), lr = () => (n) => { const e = Dt()(n), t = Le()(n); return Pe(e, t); }, fr = () => (n) => { const e = Dt()(n), t = Le()(n); return Ot(e, t); }; var M = /* @__PURE__ */ ((n) => (n.Opening = "OPENING", n.Open = "OPEN", n.Close = "CLOSE", n.Closing = "CLOSING", n.Error = "ERROR", n.Reconnecting = "RECONNECTING", n))(M || {}), At = /* @__PURE__ */ ((n) => (n[n.Stopped = 0] = "Stopped", n[n.Playing = 2] = "Playing", n[n.Paused = 3] = "Paused", n))(At || {}), Rt = /* @__PURE__ */ ((n) => (n[n.Stopped = 0] = "Stopped", n[n.Paused = 1] = "Paused", n[n.Playing = 2] = "Playing", n))(Rt || {}), B = /* @__PURE__ */ ((n) => (n[n.None = -1] = "None", n[n.Reverb = 0] = "Reverb", n[n.Delay = 1] = "Delay", n[n.Chorus = 2] = "Chorus", n[n.Room = 3] = "Room", n))(B || {}); function T(n, e, t) { return Math.min(t, Math.max(e, n)); } function Oe(n) { return Math.round((n + Number.EPSILON) * 1e3) / 1e3; } function pr(n) { return n.match(/^-?\d+$/) ? parseInt(n, 10) : n.match(/^\d+\.\d+$/) ? parseFloat(n) : n; } function Yr(n) { if (n < 0) return ""; const e = Math.floor(n), t = Math.floor(e / 60), r = e % 60; return `${t}:${r.toString().length === 1 ? "0" : ""}${r}`; } function ce(n, e) { switch (e) { case 1: return n - 1; case 0: return n + 1; default: return n; } } function Je(n) { switch (n) { case 1: return "L"; case 2: return "R"; default: return ""; } } function Hr(n) { switch (n) { case B.None: return "None"; case B.Chorus: return "Chorus"; case B.Reverb: return "Reverb"; case B.Delay: return "Delay"; case B.Room: return "Room"; } } function jt(n, e) { switch (n) { case "i": return "CH " + e; case "a": return "AUX " + e; case "f": return "FX " + e; case "s": return "SUB " + e; case "v": return "VCA " + e; case "l": return "LINE IN " + Je(e); case "p": return "PLAYER " + Je(e); case "solovol": return "SOLO LEVEL"; case "hpvol": return `HEADPHONE ${e} LEVEL`; } } function Xe(n) { return se(Gn(n.state$.pipe(Yn(25)), X(250))); } const Ft = [ [-1 / 0, 0], [-100, 0.00126941502], [-99, 0.0014193058], [-98, 0.00158625841], [-97, 0.00177210569], [-96, 0.0019787848], [-95, 0.00220842659], [-94, 0.00246331096], [-93, 0.00274592638], [-92, 0.00305891037], [-91, 0.00340510905], [-90, 0.00378751755], [-89, 0.00420932472], [-88, 0.00467389822], [-87, 0.00518476963], [-86, 0.00574563444], [-85, 0.00636033714], [-84, 0.00703287125], [-83, 0.00776734948], [-82, 0.00856804848], [-81, 0.00943937898], [-80, 0.01038584113], [-79, 0.01141215861], [-78, 0.01252317429], [-77, 0.01372399926], [-76, 0.01501996815], [-75, 0.0164167881], [-74, 0.01792064309], [-73, 0.01953828335], [-72, 0.02127727866], [-71, 0.02314623445], [-70, 0.02515518665], [-69, 0.02731607854], [-68, 0.02964346856], [-67, 0.03215561062], [-66, 0.03487607837], [-65, 0.0378363952], [-64, 0.04108065367], [-63, 0.04467409104], [-62, 0.04872117192], [-61, 0.05341050774], [-60, 0.05882352591], [-59, 0.06435465068], [-58, 0.06995738298], [-57, 0.07563393563], [-56, 0.08138664067], [-55, 0.08721791208], [-54, 0.09313031286], [-53, 0.09912653267], [-52, 0.10520938411], [-51, 0.11138185114], [-50, 0.11764705926], [-49, 0.12400831282], [-48, 0.13046910241], [-47, 0.13703311235], [-46, 0.14370423928], [-45, 0.15048661083], [-44, 0.15738460608], [-43, 0.16440286487], [-42, 0.17154632322], [-41, 0.17882022634], [-40, 0.18623016588], [-39, 0.19378209766], [-38, 0.20148238726], [-37, 0.20933783613], [-36, 0.21735573001], [-35, 0.22554387664], [-34, 0.23391066305], [-33, 0.24246510724], [-32, 0.25121692196], [-31, 0.26017658552], [-30, 0.26935542002], [-29.9, 0.27028582105], [-29.8, 0.27121854806], [-29.7, 0.27215361455], [-29.6, 0.2730910331], [-29.5, 0.27403081628], [-29.4, 0.27497297851], [-29.3, 0.27591753239], [-29.2, 0.2768644914], [-29.1, 0.27781386906], [-29, 0.27876567934], [-28.9, 0.27971993526], [-28.8, 0.28067665175], [-28.7, 0.28163584229], [-28.6, 0.28259752039], [-28.5, 0.28356170142], [-28.4, 0.28452839889], [-28.3, 0.28549762792], [-28.2, 0.28646940272], [-28.1, 0.2874437375], [-28, 0.28842064831], [-27.9, 0.28940014914], [-27.8, 0.29038225533], [-27.7, 0.29136698227], [-27.6, 0.29235434486], [-27.5, 0.29334435938], [-27.4, 0.29433704074], [-27.3, 0.29533240478], [-27.2, 0.2963304678], [-27.1, 0.29733124515], [-27, 0.29833475361], [-26.9, 0.29934100923], [-26.8, 0.30035002832], [-26.7, 0.30136182765], [-26.6, 0.3023764235], [-26.5, 0.30339383334], [-26.4, 0.30441407394], [-26.3, 0.30543716229], [-26.2, 0.30646311585], [-26.1, 0.30749195209], [-26, 0.30852368847], [-25.9, 0.30955834268], [-25.8, 0.31059593312], [-25.7, 0.31163647724], [-25.6, 0.31267999392], [-25.5, 0.31372650107], [-25.4, 0.31477601733], [-25.3, 0.31582856132], [-25.2, 0.31688415236], [-25.1, 0.31794280931], [-25, 0.31900455104], [-24.9,