aivideocall
Version:
Using this package, you can integrate the callyourai video-call component into your react application.
1,348 lines (1,346 loc) • 217 kB
JavaScript
var ss = Object.defineProperty;
var rs = (a, e, t) => e in a ? ss(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
var Y = (a, e, t) => (rs(a, typeof e != "symbol" ? e + "" : e, t), t);
import Dt, { forwardRef as Ye, useRef as ue, useState as ee, useImperativeHandle as Ze, useEffect as Pe, Component as is } from "react";
var Ke = { exports: {} }, ve = {};
/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var bt;
function as() {
if (bt)
return ve;
bt = 1;
var a = Dt, e = Symbol.for("react.element"), t = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, s = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
function l(c, d, m) {
var g, y = {}, f = null, T = null;
m !== void 0 && (f = "" + m), d.key !== void 0 && (f = "" + d.key), d.ref !== void 0 && (T = d.ref);
for (g in d)
n.call(d, g) && !i.hasOwnProperty(g) && (y[g] = d[g]);
if (c && c.defaultProps)
for (g in d = c.defaultProps, d)
y[g] === void 0 && (y[g] = d[g]);
return { $$typeof: e, type: c, key: f, ref: T, props: y, _owner: s.current };
}
return ve.Fragment = t, ve.jsx = l, ve.jsxs = l, ve;
}
var Se = {};
/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var yt;
function os() {
return yt || (yt = 1, process.env.NODE_ENV !== "production" && function() {
var a = Dt, e = Symbol.for("react.element"), t = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), l = Symbol.for("react.provider"), c = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), m = Symbol.for("react.suspense"), g = Symbol.for("react.suspense_list"), y = Symbol.for("react.memo"), f = Symbol.for("react.lazy"), T = Symbol.for("react.offscreen"), R = Symbol.iterator, k = "@@iterator";
function H(o) {
if (o === null || typeof o != "object")
return null;
var u = R && o[R] || o[k];
return typeof u == "function" ? u : null;
}
var $ = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
function G(o) {
{
for (var u = arguments.length, v = new Array(u > 1 ? u - 1 : 0), b = 1; b < u; b++)
v[b - 1] = arguments[b];
xe("error", o, v);
}
}
function xe(o, u, v) {
{
var b = $.ReactDebugCurrentFrame, P = b.getStackAddendum();
P !== "" && (u += "%s", v = v.concat([P]));
var x = v.map(function(M) {
return String(M);
});
x.unshift("Warning: " + u), Function.prototype.apply.call(console[o], console, x);
}
}
var Le = !1, Ae = !1, O = !1, oe = !1, L = !1, ne;
ne = Symbol.for("react.module.reference");
function Fe(o) {
return !!(typeof o == "string" || typeof o == "function" || o === n || o === i || L || o === s || o === m || o === g || oe || o === T || Le || Ae || O || typeof o == "object" && o !== null && (o.$$typeof === f || o.$$typeof === y || o.$$typeof === l || o.$$typeof === c || o.$$typeof === d || // This needs to include all possible module reference object
// types supported by any Flight configuration anywhere since
// we don't know which Flight build this will end up being used
// with.
o.$$typeof === ne || o.getModuleId !== void 0));
}
function le(o, u, v) {
var b = o.displayName;
if (b)
return b;
var P = u.displayName || u.name || "";
return P !== "" ? v + "(" + P + ")" : v;
}
function X(o) {
return o.displayName || "Context";
}
function j(o) {
if (o == null)
return null;
if (typeof o.tag == "number" && G("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof o == "function")
return o.displayName || o.name || null;
if (typeof o == "string")
return o;
switch (o) {
case n:
return "Fragment";
case t:
return "Portal";
case i:
return "Profiler";
case s:
return "StrictMode";
case m:
return "Suspense";
case g:
return "SuspenseList";
}
if (typeof o == "object")
switch (o.$$typeof) {
case c:
var u = o;
return X(u) + ".Consumer";
case l:
var v = o;
return X(v._context) + ".Provider";
case d:
return le(o, o.render, "ForwardRef");
case y:
var b = o.displayName || null;
return b !== null ? b : j(o.type) || "Memo";
case f: {
var P = o, x = P._payload, M = P._init;
try {
return j(M(x));
} catch {
return null;
}
}
}
return null;
}
var J = Object.assign, me = 0, et, tt, nt, st, rt, it, at;
function ot() {
}
ot.__reactDisabledLog = !0;
function Ln() {
{
if (me === 0) {
et = console.log, tt = console.info, nt = console.warn, st = console.error, rt = console.group, it = console.groupCollapsed, at = console.groupEnd;
var o = {
configurable: !0,
enumerable: !0,
value: ot,
writable: !0
};
Object.defineProperties(console, {
info: o,
log: o,
warn: o,
error: o,
group: o,
groupCollapsed: o,
groupEnd: o
});
}
me++;
}
}
function An() {
{
if (me--, me === 0) {
var o = {
configurable: !0,
enumerable: !0,
writable: !0
};
Object.defineProperties(console, {
log: J({}, o, {
value: et
}),
info: J({}, o, {
value: tt
}),
warn: J({}, o, {
value: nt
}),
error: J({}, o, {
value: st
}),
group: J({}, o, {
value: rt
}),
groupCollapsed: J({}, o, {
value: it
}),
groupEnd: J({}, o, {
value: at
})
});
}
me < 0 && G("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
}
}
var De = $.ReactCurrentDispatcher, Oe;
function Ee(o, u, v) {
{
if (Oe === void 0)
try {
throw Error();
} catch (P) {
var b = P.stack.trim().match(/\n( *(at )?)/);
Oe = b && b[1] || "";
}
return `
` + Oe + o;
}
}
var Ie = !1, be;
{
var Fn = typeof WeakMap == "function" ? WeakMap : Map;
be = new Fn();
}
function lt(o, u) {
if (!o || Ie)
return "";
{
var v = be.get(o);
if (v !== void 0)
return v;
}
var b;
Ie = !0;
var P = Error.prepareStackTrace;
Error.prepareStackTrace = void 0;
var x;
x = De.current, De.current = null, Ln();
try {
if (u) {
var M = function() {
throw Error();
};
if (Object.defineProperty(M.prototype, "props", {
set: function() {
throw Error();
}
}), typeof Reflect == "object" && Reflect.construct) {
try {
Reflect.construct(M, []);
} catch (K) {
b = K;
}
Reflect.construct(o, [], M);
} else {
try {
M.call();
} catch (K) {
b = K;
}
o.call(M.prototype);
}
} else {
try {
throw Error();
} catch (K) {
b = K;
}
o();
}
} catch (K) {
if (K && b && typeof K.stack == "string") {
for (var w = K.stack.split(`
`), W = b.stack.split(`
`), F = w.length - 1, I = W.length - 1; F >= 1 && I >= 0 && w[F] !== W[I]; )
I--;
for (; F >= 1 && I >= 0; F--, I--)
if (w[F] !== W[I]) {
if (F !== 1 || I !== 1)
do
if (F--, I--, I < 0 || w[F] !== W[I]) {
var Q = `
` + w[F].replace(" at new ", " at ");
return o.displayName && Q.includes("<anonymous>") && (Q = Q.replace("<anonymous>", o.displayName)), typeof o == "function" && be.set(o, Q), Q;
}
while (F >= 1 && I >= 0);
break;
}
}
} finally {
Ie = !1, De.current = x, An(), Error.prepareStackTrace = P;
}
var de = o ? o.displayName || o.name : "", se = de ? Ee(de) : "";
return typeof o == "function" && be.set(o, se), se;
}
function Dn(o, u, v) {
return lt(o, !1);
}
function On(o) {
var u = o.prototype;
return !!(u && u.isReactComponent);
}
function ye(o, u, v) {
if (o == null)
return "";
if (typeof o == "function")
return lt(o, On(o));
if (typeof o == "string")
return Ee(o);
switch (o) {
case m:
return Ee("Suspense");
case g:
return Ee("SuspenseList");
}
if (typeof o == "object")
switch (o.$$typeof) {
case d:
return Dn(o.render);
case y:
return ye(o.type, u, v);
case f: {
var b = o, P = b._payload, x = b._init;
try {
return ye(x(P), u, v);
} catch {
}
}
}
return "";
}
var pe = Object.prototype.hasOwnProperty, ct = {}, dt = $.ReactDebugCurrentFrame;
function we(o) {
if (o) {
var u = o._owner, v = ye(o.type, o._source, u ? u.type : null);
dt.setExtraStackFrame(v);
} else
dt.setExtraStackFrame(null);
}
function In(o, u, v, b, P) {
{
var x = Function.call.bind(pe);
for (var M in o)
if (x(o, M)) {
var w = void 0;
try {
if (typeof o[M] != "function") {
var W = Error((b || "React class") + ": " + v + " type `" + M + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof o[M] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
throw W.name = "Invariant Violation", W;
}
w = o[M](u, M, b, v, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
} catch (F) {
w = F;
}
w && !(w instanceof Error) && (we(P), G("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", b || "React class", v, M, typeof w), we(null)), w instanceof Error && !(w.message in ct) && (ct[w.message] = !0, we(P), G("Failed %s type: %s", v, w.message), we(null));
}
}
}
var _n = Array.isArray;
function _e(o) {
return _n(o);
}
function Un(o) {
{
var u = typeof Symbol == "function" && Symbol.toStringTag, v = u && o[Symbol.toStringTag] || o.constructor.name || "Object";
return v;
}
}
function Gn(o) {
try {
return ht(o), !1;
} catch {
return !0;
}
}
function ht(o) {
return "" + o;
}
function ut(o) {
if (Gn(o))
return G("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Un(o)), ht(o);
}
var fe = $.ReactCurrentOwner, zn = {
key: !0,
ref: !0,
__self: !0,
__source: !0
}, gt, mt, Ue;
Ue = {};
function Bn(o) {
if (pe.call(o, "ref")) {
var u = Object.getOwnPropertyDescriptor(o, "ref").get;
if (u && u.isReactWarning)
return !1;
}
return o.ref !== void 0;
}
function Hn(o) {
if (pe.call(o, "key")) {
var u = Object.getOwnPropertyDescriptor(o, "key").get;
if (u && u.isReactWarning)
return !1;
}
return o.key !== void 0;
}
function Wn(o, u) {
if (typeof o.ref == "string" && fe.current && u && fe.current.stateNode !== u) {
var v = j(fe.current.type);
Ue[v] || (G('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', j(fe.current.type), o.ref), Ue[v] = !0);
}
}
function Vn(o, u) {
{
var v = function() {
gt || (gt = !0, G("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", u));
};
v.isReactWarning = !0, Object.defineProperty(o, "key", {
get: v,
configurable: !0
});
}
}
function Nn(o, u) {
{
var v = function() {
mt || (mt = !0, G("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", u));
};
v.isReactWarning = !0, Object.defineProperty(o, "ref", {
get: v,
configurable: !0
});
}
}
var Kn = function(o, u, v, b, P, x, M) {
var w = {
// This tag allows us to uniquely identify this as a React Element
$$typeof: e,
// Built-in properties that belong on the element
type: o,
key: u,
ref: v,
props: M,
// Record the component responsible for creating this element.
_owner: x
};
return w._store = {}, Object.defineProperty(w._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: !1
}), Object.defineProperty(w, "_self", {
configurable: !1,
enumerable: !1,
writable: !1,
value: b
}), Object.defineProperty(w, "_source", {
configurable: !1,
enumerable: !1,
writable: !1,
value: P
}), Object.freeze && (Object.freeze(w.props), Object.freeze(w)), w;
};
function $n(o, u, v, b, P) {
{
var x, M = {}, w = null, W = null;
v !== void 0 && (ut(v), w = "" + v), Hn(u) && (ut(u.key), w = "" + u.key), Bn(u) && (W = u.ref, Wn(u, P));
for (x in u)
pe.call(u, x) && !zn.hasOwnProperty(x) && (M[x] = u[x]);
if (o && o.defaultProps) {
var F = o.defaultProps;
for (x in F)
M[x] === void 0 && (M[x] = F[x]);
}
if (w || W) {
var I = typeof o == "function" ? o.displayName || o.name || "Unknown" : o;
w && Vn(M, I), W && Nn(M, I);
}
return Kn(o, w, W, P, b, fe.current, M);
}
}
var Ge = $.ReactCurrentOwner, pt = $.ReactDebugCurrentFrame;
function ce(o) {
if (o) {
var u = o._owner, v = ye(o.type, o._source, u ? u.type : null);
pt.setExtraStackFrame(v);
} else
pt.setExtraStackFrame(null);
}
var ze;
ze = !1;
function Be(o) {
return typeof o == "object" && o !== null && o.$$typeof === e;
}
function ft() {
{
if (Ge.current) {
var o = j(Ge.current.type);
if (o)
return `
Check the render method of \`` + o + "`.";
}
return "";
}
}
function jn(o) {
return "";
}
var vt = {};
function Qn(o) {
{
var u = ft();
if (!u) {
var v = typeof o == "string" ? o : o.displayName || o.name;
v && (u = `
Check the top-level render call using <` + v + ">.");
}
return u;
}
}
function St(o, u) {
{
if (!o._store || o._store.validated || o.key != null)
return;
o._store.validated = !0;
var v = Qn(u);
if (vt[v])
return;
vt[v] = !0;
var b = "";
o && o._owner && o._owner !== Ge.current && (b = " It was passed a child from " + j(o._owner.type) + "."), ce(o), G('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', v, b), ce(null);
}
}
function Ct(o, u) {
{
if (typeof o != "object")
return;
if (_e(o))
for (var v = 0; v < o.length; v++) {
var b = o[v];
Be(b) && St(b, u);
}
else if (Be(o))
o._store && (o._store.validated = !0);
else if (o) {
var P = H(o);
if (typeof P == "function" && P !== o.entries)
for (var x = P.call(o), M; !(M = x.next()).done; )
Be(M.value) && St(M.value, u);
}
}
}
function qn(o) {
{
var u = o.type;
if (u == null || typeof u == "string")
return;
var v;
if (typeof u == "function")
v = u.propTypes;
else if (typeof u == "object" && (u.$$typeof === d || // Note: Memo only checks outer props here.
// Inner props are checked in the reconciler.
u.$$typeof === y))
v = u.propTypes;
else
return;
if (v) {
var b = j(u);
In(v, o.props, "prop", b, o);
} else if (u.PropTypes !== void 0 && !ze) {
ze = !0;
var P = j(u);
G("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", P || "Unknown");
}
typeof u.getDefaultProps == "function" && !u.getDefaultProps.isReactClassApproved && G("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
}
}
function Xn(o) {
{
for (var u = Object.keys(o.props), v = 0; v < u.length; v++) {
var b = u[v];
if (b !== "children" && b !== "key") {
ce(o), G("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", b), ce(null);
break;
}
}
o.ref !== null && (ce(o), G("Invalid attribute `ref` supplied to `React.Fragment`."), ce(null));
}
}
var Tt = {};
function Et(o, u, v, b, P, x) {
{
var M = Fe(o);
if (!M) {
var w = "";
(o === void 0 || typeof o == "object" && o !== null && Object.keys(o).length === 0) && (w += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
var W = jn();
W ? w += W : w += ft();
var F;
o === null ? F = "null" : _e(o) ? F = "array" : o !== void 0 && o.$$typeof === e ? (F = "<" + (j(o.type) || "Unknown") + " />", w = " Did you accidentally export a JSX literal instead of a component?") : F = typeof o, G("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", F, w);
}
var I = $n(o, u, v, P, x);
if (I == null)
return I;
if (M) {
var Q = u.children;
if (Q !== void 0)
if (b)
if (_e(Q)) {
for (var de = 0; de < Q.length; de++)
Ct(Q[de], o);
Object.freeze && Object.freeze(Q);
} else
G("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
else
Ct(Q, o);
}
if (pe.call(u, "key")) {
var se = j(o), K = Object.keys(u).filter(function(ns) {
return ns !== "key";
}), He = K.length > 0 ? "{key: someKey, " + K.join(": ..., ") + ": ...}" : "{key: someKey}";
if (!Tt[se + He]) {
var ts = K.length > 0 ? "{" + K.join(": ..., ") + ": ...}" : "{}";
G(`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`, He, se, ts, se), Tt[se + He] = !0;
}
}
return o === n ? Xn(I) : qn(I), I;
}
}
function Jn(o, u, v) {
return Et(o, u, v, !0);
}
function Yn(o, u, v) {
return Et(o, u, v, !1);
}
var Zn = Yn, es = Jn;
Se.Fragment = n, Se.jsx = Zn, Se.jsxs = es;
}()), Se;
}
process.env.NODE_ENV === "production" ? Ke.exports = as() : Ke.exports = os();
var D = Ke.exports, Ot = { exports: {} };
(function(a) {
const e = {};
e.generateIdentifier = function() {
return Math.random().toString(36).substring(2, 12);
}, e.localCName = e.generateIdentifier(), e.splitLines = function(t) {
return t.trim().split(`
`).map((n) => n.trim());
}, e.splitSections = function(t) {
return t.split(`
m=`).map((s, i) => (i > 0 ? "m=" + s : s).trim() + `\r
`);
}, e.getDescription = function(t) {
const n = e.splitSections(t);
return n && n[0];
}, e.getMediaSections = function(t) {
const n = e.splitSections(t);
return n.shift(), n;
}, e.matchPrefix = function(t, n) {
return e.splitLines(t).filter((s) => s.indexOf(n) === 0);
}, e.parseCandidate = function(t) {
let n;
t.indexOf("a=candidate:") === 0 ? n = t.substring(12).split(" ") : n = t.substring(10).split(" ");
const s = {
foundation: n[0],
component: { 1: "rtp", 2: "rtcp" }[n[1]] || n[1],
protocol: n[2].toLowerCase(),
priority: parseInt(n[3], 10),
ip: n[4],
address: n[4],
// address is an alias for ip.
port: parseInt(n[5], 10),
// skip parts[6] == 'typ'
type: n[7]
};
for (let i = 8; i < n.length; i += 2)
switch (n[i]) {
case "raddr":
s.relatedAddress = n[i + 1];
break;
case "rport":
s.relatedPort = parseInt(n[i + 1], 10);
break;
case "tcptype":
s.tcpType = n[i + 1];
break;
case "ufrag":
s.ufrag = n[i + 1], s.usernameFragment = n[i + 1];
break;
default:
s[n[i]] === void 0 && (s[n[i]] = n[i + 1]);
break;
}
return s;
}, e.writeCandidate = function(t) {
const n = [];
n.push(t.foundation);
const s = t.component;
s === "rtp" ? n.push(1) : s === "rtcp" ? n.push(2) : n.push(s), n.push(t.protocol.toUpperCase()), n.push(t.priority), n.push(t.address || t.ip), n.push(t.port);
const i = t.type;
return n.push("typ"), n.push(i), i !== "host" && t.relatedAddress && t.relatedPort && (n.push("raddr"), n.push(t.relatedAddress), n.push("rport"), n.push(t.relatedPort)), t.tcpType && t.protocol.toLowerCase() === "tcp" && (n.push("tcptype"), n.push(t.tcpType)), (t.usernameFragment || t.ufrag) && (n.push("ufrag"), n.push(t.usernameFragment || t.ufrag)), "candidate:" + n.join(" ");
}, e.parseIceOptions = function(t) {
return t.substring(14).split(" ");
}, e.parseRtpMap = function(t) {
let n = t.substring(9).split(" ");
const s = {
payloadType: parseInt(n.shift(), 10)
// was: id
};
return n = n[0].split("/"), s.name = n[0], s.clockRate = parseInt(n[1], 10), s.channels = n.length === 3 ? parseInt(n[2], 10) : 1, s.numChannels = s.channels, s;
}, e.writeRtpMap = function(t) {
let n = t.payloadType;
t.preferredPayloadType !== void 0 && (n = t.preferredPayloadType);
const s = t.channels || t.numChannels || 1;
return "a=rtpmap:" + n + " " + t.name + "/" + t.clockRate + (s !== 1 ? "/" + s : "") + `\r
`;
}, e.parseExtmap = function(t) {
const n = t.substring(9).split(" ");
return {
id: parseInt(n[0], 10),
direction: n[0].indexOf("/") > 0 ? n[0].split("/")[1] : "sendrecv",
uri: n[1],
attributes: n.slice(2).join(" ")
};
}, e.writeExtmap = function(t) {
return "a=extmap:" + (t.id || t.preferredId) + (t.direction && t.direction !== "sendrecv" ? "/" + t.direction : "") + " " + t.uri + (t.attributes ? " " + t.attributes : "") + `\r
`;
}, e.parseFmtp = function(t) {
const n = {};
let s;
const i = t.substring(t.indexOf(" ") + 1).split(";");
for (let l = 0; l < i.length; l++)
s = i[l].trim().split("="), n[s[0].trim()] = s[1];
return n;
}, e.writeFmtp = function(t) {
let n = "", s = t.payloadType;
if (t.preferredPayloadType !== void 0 && (s = t.preferredPayloadType), t.parameters && Object.keys(t.parameters).length) {
const i = [];
Object.keys(t.parameters).forEach((l) => {
t.parameters[l] !== void 0 ? i.push(l + "=" + t.parameters[l]) : i.push(l);
}), n += "a=fmtp:" + s + " " + i.join(";") + `\r
`;
}
return n;
}, e.parseRtcpFb = function(t) {
const n = t.substring(t.indexOf(" ") + 1).split(" ");
return {
type: n.shift(),
parameter: n.join(" ")
};
}, e.writeRtcpFb = function(t) {
let n = "", s = t.payloadType;
return t.preferredPayloadType !== void 0 && (s = t.preferredPayloadType), t.rtcpFeedback && t.rtcpFeedback.length && t.rtcpFeedback.forEach((i) => {
n += "a=rtcp-fb:" + s + " " + i.type + (i.parameter && i.parameter.length ? " " + i.parameter : "") + `\r
`;
}), n;
}, e.parseSsrcMedia = function(t) {
const n = t.indexOf(" "), s = {
ssrc: parseInt(t.substring(7, n), 10)
}, i = t.indexOf(":", n);
return i > -1 ? (s.attribute = t.substring(n + 1, i), s.value = t.substring(i + 1)) : s.attribute = t.substring(n + 1), s;
}, e.parseSsrcGroup = function(t) {
const n = t.substring(13).split(" ");
return {
semantics: n.shift(),
ssrcs: n.map((s) => parseInt(s, 10))
};
}, e.getMid = function(t) {
const n = e.matchPrefix(t, "a=mid:")[0];
if (n)
return n.substring(6);
}, e.parseFingerprint = function(t) {
const n = t.substring(14).split(" ");
return {
algorithm: n[0].toLowerCase(),
// algorithm is case-sensitive in Edge.
value: n[1].toUpperCase()
// the definition is upper-case in RFC 4572.
};
}, e.getDtlsParameters = function(t, n) {
return {
role: "auto",
fingerprints: e.matchPrefix(
t + n,
"a=fingerprint:"
).map(e.parseFingerprint)
};
}, e.writeDtlsParameters = function(t, n) {
let s = "a=setup:" + n + `\r
`;
return t.fingerprints.forEach((i) => {
s += "a=fingerprint:" + i.algorithm + " " + i.value + `\r
`;
}), s;
}, e.parseCryptoLine = function(t) {
const n = t.substring(9).split(" ");
return {
tag: parseInt(n[0], 10),
cryptoSuite: n[1],
keyParams: n[2],
sessionParams: n.slice(3)
};
}, e.writeCryptoLine = function(t) {
return "a=crypto:" + t.tag + " " + t.cryptoSuite + " " + (typeof t.keyParams == "object" ? e.writeCryptoKeyParams(t.keyParams) : t.keyParams) + (t.sessionParams ? " " + t.sessionParams.join(" ") : "") + `\r
`;
}, e.parseCryptoKeyParams = function(t) {
if (t.indexOf("inline:") !== 0)
return null;
const n = t.substring(7).split("|");
return {
keyMethod: "inline",
keySalt: n[0],
lifeTime: n[1],
mkiValue: n[2] ? n[2].split(":")[0] : void 0,
mkiLength: n[2] ? n[2].split(":")[1] : void 0
};
}, e.writeCryptoKeyParams = function(t) {
return t.keyMethod + ":" + t.keySalt + (t.lifeTime ? "|" + t.lifeTime : "") + (t.mkiValue && t.mkiLength ? "|" + t.mkiValue + ":" + t.mkiLength : "");
}, e.getCryptoParameters = function(t, n) {
return e.matchPrefix(
t + n,
"a=crypto:"
).map(e.parseCryptoLine);
}, e.getIceParameters = function(t, n) {
const s = e.matchPrefix(
t + n,
"a=ice-ufrag:"
)[0], i = e.matchPrefix(
t + n,
"a=ice-pwd:"
)[0];
return s && i ? {
usernameFragment: s.substring(12),
password: i.substring(10)
} : null;
}, e.writeIceParameters = function(t) {
let n = "a=ice-ufrag:" + t.usernameFragment + `\r
a=ice-pwd:` + t.password + `\r
`;
return t.iceLite && (n += `a=ice-lite\r
`), n;
}, e.parseRtpParameters = function(t) {
const n = {
codecs: [],
headerExtensions: [],
fecMechanisms: [],
rtcp: []
}, i = e.splitLines(t)[0].split(" ");
for (let c = 3; c < i.length; c++) {
const d = i[c], m = e.matchPrefix(
t,
"a=rtpmap:" + d + " "
)[0];
if (m) {
const g = e.parseRtpMap(m), y = e.matchPrefix(
t,
"a=fmtp:" + d + " "
);
switch (g.parameters = y.length ? e.parseFmtp(y[0]) : {}, g.rtcpFeedback = e.matchPrefix(
t,
"a=rtcp-fb:" + d + " "
).map(e.parseRtcpFb), n.codecs.push(g), g.name.toUpperCase()) {
case "RED":
case "ULPFEC":
n.fecMechanisms.push(g.name.toUpperCase());
break;
}
}
}
e.matchPrefix(t, "a=extmap:").forEach((c) => {
n.headerExtensions.push(e.parseExtmap(c));
});
const l = e.matchPrefix(t, "a=rtcp-fb:* ").map(e.parseRtcpFb);
return n.codecs.forEach((c) => {
l.forEach((d) => {
c.rtcpFeedback.find((g) => g.type === d.type && g.parameter === d.parameter) || c.rtcpFeedback.push(d);
});
}), n;
}, e.writeRtpDescription = function(t, n) {
let s = "";
s += "m=" + t + " ", s += n.codecs.length > 0 ? "9" : "0", s += " UDP/TLS/RTP/SAVPF ", s += n.codecs.map((l) => l.preferredPayloadType !== void 0 ? l.preferredPayloadType : l.payloadType).join(" ") + `\r
`, s += `c=IN IP4 0.0.0.0\r
`, s += `a=rtcp:9 IN IP4 0.0.0.0\r
`, n.codecs.forEach((l) => {
s += e.writeRtpMap(l), s += e.writeFmtp(l), s += e.writeRtcpFb(l);
});
let i = 0;
return n.codecs.forEach((l) => {
l.maxptime > i && (i = l.maxptime);
}), i > 0 && (s += "a=maxptime:" + i + `\r
`), n.headerExtensions && n.headerExtensions.forEach((l) => {
s += e.writeExtmap(l);
}), s;
}, e.parseRtpEncodingParameters = function(t) {
const n = [], s = e.parseRtpParameters(t), i = s.fecMechanisms.indexOf("RED") !== -1, l = s.fecMechanisms.indexOf("ULPFEC") !== -1, c = e.matchPrefix(t, "a=ssrc:").map((f) => e.parseSsrcMedia(f)).filter((f) => f.attribute === "cname"), d = c.length > 0 && c[0].ssrc;
let m;
const g = e.matchPrefix(t, "a=ssrc-group:FID").map((f) => f.substring(17).split(" ").map((R) => parseInt(R, 10)));
g.length > 0 && g[0].length > 1 && g[0][0] === d && (m = g[0][1]), s.codecs.forEach((f) => {
if (f.name.toUpperCase() === "RTX" && f.parameters.apt) {
let T = {
ssrc: d,
codecPayloadType: parseInt(f.parameters.apt, 10)
};
d && m && (T.rtx = { ssrc: m }), n.push(T), i && (T = JSON.parse(JSON.stringify(T)), T.fec = {
ssrc: d,
mechanism: l ? "red+ulpfec" : "red"
}, n.push(T));
}
}), n.length === 0 && d && n.push({
ssrc: d
});
let y = e.matchPrefix(t, "b=");
return y.length && (y[0].indexOf("b=TIAS:") === 0 ? y = parseInt(y[0].substring(7), 10) : y[0].indexOf("b=AS:") === 0 ? y = parseInt(y[0].substring(5), 10) * 1e3 * 0.95 - 50 * 40 * 8 : y = void 0, n.forEach((f) => {
f.maxBitrate = y;
})), n;
}, e.parseRtcpParameters = function(t) {
const n = {}, s = e.matchPrefix(t, "a=ssrc:").map((c) => e.parseSsrcMedia(c)).filter((c) => c.attribute === "cname")[0];
s && (n.cname = s.value, n.ssrc = s.ssrc);
const i = e.matchPrefix(t, "a=rtcp-rsize");
n.reducedSize = i.length > 0, n.compound = i.length === 0;
const l = e.matchPrefix(t, "a=rtcp-mux");
return n.mux = l.length > 0, n;
}, e.writeRtcpParameters = function(t) {
let n = "";
return t.reducedSize && (n += `a=rtcp-rsize\r
`), t.mux && (n += `a=rtcp-mux\r
`), t.ssrc !== void 0 && t.cname && (n += "a=ssrc:" + t.ssrc + " cname:" + t.cname + `\r
`), n;
}, e.parseMsid = function(t) {
let n;
const s = e.matchPrefix(t, "a=msid:");
if (s.length === 1)
return n = s[0].substring(7).split(" "), { stream: n[0], track: n[1] };
const i = e.matchPrefix(t, "a=ssrc:").map((l) => e.parseSsrcMedia(l)).filter((l) => l.attribute === "msid");
if (i.length > 0)
return n = i[0].value.split(" "), { stream: n[0], track: n[1] };
}, e.parseSctpDescription = function(t) {
const n = e.parseMLine(t), s = e.matchPrefix(t, "a=max-message-size:");
let i;
s.length > 0 && (i = parseInt(s[0].substring(19), 10)), isNaN(i) && (i = 65536);
const l = e.matchPrefix(t, "a=sctp-port:");
if (l.length > 0)
return {
port: parseInt(l[0].substring(12), 10),
protocol: n.fmt,
maxMessageSize: i
};
const c = e.matchPrefix(t, "a=sctpmap:");
if (c.length > 0) {
const d = c[0].substring(10).split(" ");
return {
port: parseInt(d[0], 10),
protocol: d[1],
maxMessageSize: i
};
}
}, e.writeSctpDescription = function(t, n) {
let s = [];
return t.protocol !== "DTLS/SCTP" ? s = [
"m=" + t.kind + " 9 " + t.protocol + " " + n.protocol + `\r
`,
`c=IN IP4 0.0.0.0\r
`,
"a=sctp-port:" + n.port + `\r
`
] : s = [
"m=" + t.kind + " 9 " + t.protocol + " " + n.port + `\r
`,
`c=IN IP4 0.0.0.0\r
`,
"a=sctpmap:" + n.port + " " + n.protocol + ` 65535\r
`
], n.maxMessageSize !== void 0 && s.push("a=max-message-size:" + n.maxMessageSize + `\r
`), s.join("");
}, e.generateSessionId = function() {
return Math.random().toString().substr(2, 22);
}, e.writeSessionBoilerplate = function(t, n, s) {
let i;
const l = n !== void 0 ? n : 2;
return t ? i = t : i = e.generateSessionId(), `v=0\r
o=` + (s || "thisisadapterortc") + " " + i + " " + l + ` IN IP4 127.0.0.1\r
s=-\r
t=0 0\r
`;
}, e.getDirection = function(t, n) {
const s = e.splitLines(t);
for (let i = 0; i < s.length; i++)
switch (s[i]) {
case "a=sendrecv":
case "a=sendonly":
case "a=recvonly":
case "a=inactive":
return s[i].substring(2);
}
return n ? e.getDirection(n) : "sendrecv";
}, e.getKind = function(t) {
return e.splitLines(t)[0].split(" ")[0].substring(2);
}, e.isRejected = function(t) {
return t.split(" ", 2)[1] === "0";
}, e.parseMLine = function(t) {
const s = e.splitLines(t)[0].substring(2).split(" ");
return {
kind: s[0],
port: parseInt(s[1], 10),
protocol: s[2],
fmt: s.slice(3).join(" ")
};
}, e.parseOLine = function(t) {
const s = e.matchPrefix(t, "o=")[0].substring(2).split(" ");
return {
username: s[0],
sessionId: s[1],
sessionVersion: parseInt(s[2], 10),
netType: s[3],
addressType: s[4],
address: s[5]
};
}, e.isValidSDP = function(t) {
if (typeof t != "string" || t.length === 0)
return !1;
const n = e.splitLines(t);
for (let s = 0; s < n.length; s++)
if (n[s].length < 2 || n[s].charAt(1) !== "=")
return !1;
return !0;
}, a.exports = e;
})(Ot);
var wt = Ot.exports, q, U, ke = { d: (a, e) => {
for (var t in e)
ke.o(e, t) && !ke.o(a, t) && Object.defineProperty(a, t, { enumerable: !0, get: e[t] });
}, o: (a, e) => Object.prototype.hasOwnProperty.call(a, e) }, S = {};
ke.d(S, { Dz: () => fn, g$: () => Bt, Lt: () => Gt, Q9: () => zt, qf: () => Qe, hV: () => bn, z$: () => Tn, J0: () => Xe, De: () => Ps, $C: () => ae, al: () => qt, _W: () => Xt, Gv: () => dn, m: () => hn, tz: () => Qt, Nu: () => Cn, zg: () => Mn, vp: () => pn, vU: () => h, wF: () => an, rv: () => vn, Nh: () => Sn, ss: () => wn, qW: () => un, QL: () => cn, cf: () => Pn, eM: () => rn, Yd: () => r, Tk: () => C, iM: () => It, qy: () => te, ce: () => vs, sK: () => E, Ok: () => A, q5: () => En, g: () => er, xl: () => nn, I: () => sn, bx: () => qe, dD: () => mn, Ib: () => Te, Az: () => _, Iw: () => Z, qY: () => je, db: () => Ut, mR: () => Ce, Tn: () => $e, rV: () => on, gh: () => Yt, Mi: () => Zt, j: () => en, YB: () => tn, i5: () => ln, x_: () => ie, Am: () => Je, eR: () => Ht, r8: () => Jt, u3: () => Rn, vd: () => Vt, iV: () => Kt, jZ: () => Nt, SW: () => jt, ZH: () => $t, Ni: () => kn, lh: () => Wt, bq: () => _t, $f: () => xn, eu: () => gn, Ax: () => bs, Mc: () => Es });
class r {
static GetStackTrace() {
const e = new Error();
let t = "No Stack Available for this browser";
return e.stack && (t = e.stack.toString().replace(/Error/g, "")), t;
}
static SetLoggerVerbosity(e) {
this.verboseLogLevel != null && (this.verboseLogLevel = e);
}
static Log(e, t, n) {
if (n > this.verboseLogLevel)
return;
const s = `Level: Log
Msg: ${t}
Caller: ${e}`;
console.log(s);
}
static Info(e, t, n) {
if (n > this.verboseLogLevel)
return;
const s = `Level: Info
Msg: ${t}`;
console.info(s);
}
static Error(e, t) {
const n = `Level: Error
Msg: ${t}
Caller: ${e}`;
console.error(n);
}
static Warning(e, t) {
const n = `Level: Warning
Caller: ${e}
Msg: ${t}`;
console.warn(n);
}
}
r.verboseLogLevel = 5, function(a) {
a.LIST_STREAMERS = "listStreamers", a.SUBSCRIBE = "subscribe", a.UNSUBSCRIBE = "unsubscribe", a.ICE_CANDIDATE = "iceCandidate", a.OFFER = "offer", a.ANSWER = "answer", a.DATACHANNELREQUEST = "dataChannelRequest", a.SFURECVDATACHANNELREADY = "peerDataChannelsReady", a.PONG = "pong";
}(q || (q = {}));
class te {
payload() {
return r.Log(r.GetStackTrace(), `Sending =>
` + JSON.stringify(this, void 0, 4), 6), JSON.stringify(this);
}
}
class ls extends te {
constructor() {
super(), this.type = q.LIST_STREAMERS;
}
}
class cs extends te {
constructor(e) {
super(), this.type = q.SUBSCRIBE, this.streamerId = e;
}
}
class ds extends te {
constructor() {
super(), this.type = q.UNSUBSCRIBE;
}
}
class hs extends te {
constructor(e) {
super(), this.type = q.PONG, this.time = e;
}
}
class us extends te {
constructor(e) {
super(), this.type = q.OFFER, e && (this.type = e.type, this.sdp = e.sdp);
}
}
class gs extends te {
constructor(e) {
super(), this.type = q.ANSWER, e && (this.type = e.type, this.sdp = e.sdp);
}
}
class ms extends te {
constructor() {
super(), this.type = q.DATACHANNELREQUEST;
}
}
class ps extends te {
constructor() {
super(), this.type = q.SFURECVDATACHANNELREADY;
}
}
class fs {
constructor(e) {
this.type = q.ICE_CANDIDATE, this.candidate = e;
}
payload() {
return r.Log(r.GetStackTrace(), `Sending =>
` + JSON.stringify(this, void 0, 4), 6), JSON.stringify(this);
}
}
(function(a) {
a.CONFIG = "config", a.STREAMER_LIST = "streamerList", a.PLAYER_COUNT = "playerCount", a.OFFER = "offer", a.ANSWER = "answer", a.ICE_CANDIDATE = "iceCandidate", a.PEER_DATA_CHANNELS = "peerDataChannels", a.PING = "ping", a.WARNING = "warning";
})(U || (U = {}));
class It {
}
class vs extends It {
}
class $e {
constructor() {
this.FromUEMessageHandlers = /* @__PURE__ */ new Map();
}
addMessageHandler(e, t) {
this.FromUEMessageHandlers.set(e, t);
}
handleMessage(e, t) {
this.FromUEMessageHandlers.has(e) ? this.FromUEMessageHandlers.get(e)(t) : r.Error(r.GetStackTrace(), `Message type of ${e} does not have a message handler registered on the frontend - ignoring message.`);
}
static setupDefaultHandlers(e) {
e.signallingProtocol.addMessageHandler(U.PING, (t) => {
const n = new hs((/* @__PURE__ */ new Date()).getTime()).payload();
r.Log(r.GetStackTrace(), U.PING + ": " + t, 6), e.webSocket.send(n);
}), e.signallingProtocol.addMessageHandler(U.CONFIG, (t) => {
r.Log(r.GetStackTrace(), U.CONFIG, 6);
const n = JSON.parse(t);
e.onConfig(n);
}), e.signallingProtocol.addMessageHandler(U.STREAMER_LIST, (t) => {
r.Log(r.GetStackTrace(), U.STREAMER_LIST, 6);
const n = JSON.parse(t);
e.onStreamerList(n);
}), e.signallingProtocol.addMessageHandler(U.PLAYER_COUNT, (t) => {
r.Log(r.GetStackTrace(), U.PLAYER_COUNT, 6);
const n = JSON.parse(t);
r.Log(r.GetStackTrace(), "Player Count: " + n.count, 6), e.onPlayerCount(n);
}), e.signallingProtocol.addMessageHandler(U.ANSWER, (t) => {
r.Log(r.GetStackTrace(), U.ANSWER, 6);
const n = JSON.parse(t);
e.onWebRtcAnswer(n);
}), e.signallingProtocol.addMessageHandler(U.OFFER, (t) => {
r.Log(r.GetStackTrace(), U.OFFER, 6);
const n = JSON.parse(t);
e.onWebRtcOffer(n);
}), e.signallingProtocol.addMessageHandler(U.ICE_CANDIDATE, (t) => {
r.Log(r.GetStackTrace(), U.ICE_CANDIDATE, 6);
const n = JSON.parse(t);
e.onIceCandidate(n.candidate);
}), e.signallingProtocol.addMessageHandler(U.WARNING, (t) => {
r.Warning(r.GetStackTrace(), `Warning received: ${t}`);
}), e.signallingProtocol.addMessageHandler(U.PEER_DATA_CHANNELS, (t) => {
r.Log(r.GetStackTrace(), U.PEER_DATA_CHANNELS, 6);
const n = JSON.parse(t);
e.onWebRtcPeerDataChannels(n);
});
}
}
class _t {
constructor() {
this.WS_OPEN_STATE = 1, this.onOpen = new EventTarget(), this.onClose = new EventTarget(), this.signallingProtocol = new $e(), $e.setupDefaultHandlers(this);
}
connect(e) {
r.Log(r.GetStackTrace(), e, 6);
try {
return this.webSocket = new WebSocket(e), this.webSocket.onopen = (t) => this.handleOnOpen(t), this.webSocket.onerror = () => this.handleOnError(), this.webSocket.onclose = (t) => this.handleOnClose(t), this.webSocket.onmessage = (t) => this.handleOnMessage(t), this.webSocket.onmessagebinary = (t) => this.handleOnMessageBinary(t), !0;
} catch (t) {
return r.Error(t, t), !1;
}
}
handleOnMessageBinary(e) {
e && e.data && e.data.text().then((t) => {
const n = new MessageEvent("messageFromBinary", { data: t });
this.handleOnMessage(n);
}).catch((t) => {
r.Error(r.GetStackTrace(), `Failed to parse binary blob from websocket, reason: ${t}`);
});
}
handleOnMessage(e) {
if (e.data && e.data instanceof Blob)
return void this.handleOnMessageBinary(e);
const t = JSON.parse(e.data);
r.Log(r.GetStackTrace(), `received =>
` + JSON.stringify(JSON.parse(e.data), void 0, 4), 6), this.signallingProtocol.handleMessage(t.type, e.data);
}
handleOnOpen(e) {
r.Log(r.GetStackTrace(), "Connected to the signalling server via WebSocket", 6), this.onOpen.dispatchEvent(new Event("open"));
}
handleOnError() {
r.Error(r.GetStackTrace(), "WebSocket error");
}
handleOnClose(e) {
r.Log(r.GetStackTrace(), "Disconnected to the signalling server via WebSocket: " + JSON.stringify(e.code) + " - " + e.reason), this.onClose.dispatchEvent(new CustomEvent("close", { detail: e }));
}
requestStreamerList() {
const e = new ls();
this.webSocket.send(e.payload());
}
sendSubscribe(e) {
const t = new cs(e);
this.webSocket.send(t.payload());
}
sendUnsubscribe() {
const e = new ds();
this.webSocket.send(e.payload());
}
sendWebRtcOffer(e) {
const t = new us(e);
this.webSocket.send(t.payload());
}
sendWebRtcAnswer(e) {
const t = new gs(e);
this.webSocket.send(t.payload());
}
sendWebRtcDatachannelRequest() {
const e = new ms();
this.webSocket.send(e.payload());
}
sendSFURecvDataChannelReady() {
const e = new ps();
this.webSocket.send(e.payload());
}
sendIceCandidate(e) {
if (r.Log(r.GetStackTrace(), "Sending Ice Candidate"), this.webSocket && this.webSocket.readyState === this.WS_OPEN_STATE) {
const t = new fs(e);
this.webSocket.send(t.payload());
}
}
close() {
var e;
(e = this.webSocket) === null || e === void 0 || e.close();
}
onConfig(e) {
}
onStreamerList(e) {
}
onIceCandidate(e) {
}
onWebRtcAnswer(e) {
}
onWebRtcOffer(e) {
}
onWebRtcPeerDataChannels(e) {
}
onPlayerCount(e) {
}
}
class Ss {
constructor(e) {
this.videoElementProvider = e, this.audioElement = document.createElement("Audio"), this.videoElementProvider.setAudioElement(this.audioElement);
}
handleOnTrack(e) {
if (r.Log(r.GetStackTrace(), "handleOnTrack " + JSON.stringify(e.streams), 6), e.track.id == "probator")
return;
const t = this.videoElementProvider.getVideoElement();
if (e.track && r.Log(r.GetStackTrace(), "Got track - " + e.track.kind + " id=" + e.track.id + " readyState=" + e.track.readyState, 6), e.track.kind != "audio")
return e.track.kind == "video" && t.srcObject !== e.streams[0] ? (t.srcObject = e.streams[0], void r.Log(r.GetStackTrace(), "Set video source from video track ontrack.")) : void 0;
this.CreateAudioTrack(e.streams[0]);
}
CreateAudioTrack(e) {
const t = this.videoElementProvider.getVideoElement();
t.srcObject != e && t.srcObject && t.srcObject !== e && (this.audioElement.srcObject = e, r.Log(r.GetStackTrace(), "Created new audio element to play separate audio stream."));
}
}
class Cs {
constructor(e) {
this.freezeFrameHeight = 0, this.freezeFrameWidth = 0, this.rootDiv = e, this.rootElement = document.createElement("div"), this.rootElement.id = "freezeFrame", this.rootElement.style.display = "none", this.rootElement.style.pointerEvents = "none", this.rootElement.style.position = "absolute", this.rootElement.style.zIndex = "20", this.imageElement = document.createElement("img"), this.imageElement.style.position = "absolute", this.rootElement.appendChild(this.imageElement), this.rootDiv.appendChild(this.rootElement);
}
setElementForShow() {
this.rootElement.style.display = "block";
}
setElementForHide() {
this.rootElement.style.display = "none";
}
updateImageElementSource(e) {
const t = btoa(e.reduce((n, s) => n + String.fromCharCode(s), ""));
this.imageElement.src = "data:image/jpeg;base64," + t;
}
setDimensionsFromElementAndResize() {
this.freezeFrameHeight = this.imageElement.naturalHeight, this.freezeFrameWidth = this.imageElement.naturalWidth, this.resize();
}
resize() {
if (this.freezeFrameWidth !== 0 && this.freezeFrameHeight !== 0) {
let e = 0, t = 0, n = 0, s = 0;
const i = this.rootDiv.clientWidth / this.rootDiv.clientHeight, l = this.freezeFrameWidth / this.freezeFrameHeight;
i < l ? (e = this.rootDiv.clientWidth, t = Math.floor(this.rootDiv.clientWidth / l), n = Math.floor(0.5 * (this.rootDiv.clientHeight - t)), s = 0) : (e = Math.floor(this.rootDiv.clientHeight * l), t = this.rootDiv.clientHeight, n = 0, s = Math.floor(0.5 * (this.rootDiv.clientWidth - e))), this.rootElement.style.width = this.rootDiv.offsetWidth + "px", this.rootElement.style.height = this.rootDiv.offsetHeight + "px", this.rootElement.style.left = "0px", this.rootElement.style.top = "0px", this.imageElement.style.width = e + "px", this.imageElement.style.height = t + "px", this.imageElement.style.left = s + "px", this.imageElement.style.top = n + "px";
}
}
}
class Ts {
constructor(e) {
this.receiving = !1, this.size = 0, this.jpeg = void 0, this.valid = !1, this.freezeFrameDelay = 50, this.freezeFrame = new Cs(e);
}
showFreezeFrame() {
this.valid && this.freezeFrame.setElementForShow();
}
hideFreezeFrame() {
this.valid = !1, this.freezeFrame.setElementForHide();
}
updateFreezeFrameAndShow(e, t) {
this.freezeFrame.updateImageElementSource(e), this.freezeFrame.imageElement.onload = () => {
this.freezeFrame.setDimensionsFromElementAndResize(), t();
};
}
processFreezeFrameMessage(e, t) {
this.receiving || (this.receiving = !0, this.valid = !1, this.size = 0, this.jpeg = void 0), this.size = new DataView(e.slice(1, 5).buffer).getInt32(0, !0);
const n = e.slice(5);
if (this.jpeg) {
const s = new Uint8Array(this.jpeg.length + n.length);
s.set(this.jpeg, 0), s.set(n, this.jpeg.length), this.jpeg = s;
} else
this.jpeg = n, this.receiving = !0, r.Log(r.GetStackTrace(), `received first chunk of freeze frame: ${this.jpeg.length}/${this.size}`, 6);
this.jpeg.length === this.size ? (this.receiving = !1, this.valid = !0, r.Log(r.GetStackTrace(), `received complete freeze frame ${this.size}`, 6), this.updateFreezeFrameAndShow(this.jpeg, t)) : this.jpeg.length > this.size && (r.Error(r.GetStackTrace(), `received bigger freeze frame than advertised: ${this.jpeg.length}/${this.size}`), this.jpeg = void 0, this.receiving = !1);
}
}
class Te {
constructor(e, t, n, s, i = () => {
}) {
this.onChange = i, this.onChangeEmit = () => {
}, this.id = e, this.description = n, this.label = t, this.value = s;
}
set label(e) {
this._label = e, this.onChangeEmit(this._value);
}
get label() {
return this._label;
}
get value() {