Free javascript Hosting


vivocha.js

Uploaded on Sep 23 2021 23:50 by jxnofehpizcklczsph

var vivocha = function(e) {
function t(t) {
for (var n, i, o = t[0], a = t[1], s = 0, u = []; s < o.length; s++) i = o[s], Object.prototype.hasOwnProperty.call(r, i) && r[i] && u.push(r[i][0]), r[i] = 0;
for (n in a) Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n]);
for (c && c(t); u.length;) u.shift()()
}
var n = {},
r = {
21: 0
};

function i(t) {
if (n[t]) return n[t].exports;
var r = n[t] = {
i: t,
l: !1,
exports: {}
};
return e[t].call(r.exports, r, r.exports, i), r.l = !0, r.exports
}
i.e = function(e) {
var t = [],
n = r[e];
if (0 !== n)
if (n) t.push(n[2]);
else {
var o = new Promise((function(t, i) {
n = r[e] = [t, i]
}));
t.push(n[2] = o);
var a, s = document.createElement("script");
s.charset = "utf-8", s.timeout = 120, i.nc && s.setAttribute("nonce", i.nc), s.src = function(e) {
return i.p + "./" + ({
0: "vendors~form-sharing~visitor-form-sharing",
1: "./dataframe",
2: "./media/videoframe-container",
4: "data",
6: "glio.js",
8: "referrer-parser.js",
10: "vendors~ua-parser.js",
12: "visitor-form-sharing"
} [e] || e) + ".js"
}(e);
var c = new Error;
a = function(t) {
s.onerror = s.onload = null, clearTimeout(u);
var n = r[e];
if (0 !== n) {
if (n) {
var i = t && ("load" === t.type ? "missing" : t.type),
o = t && t.target && t.target.src;
c.message = "Loading chunk " + e + " failed.\n(" + i + ": " + o + ")", c.name = "ChunkLoadError", c.type = i, c.request = o, n[1](c)
}
r[e] = void 0
}
};
var u = setTimeout((function() {
a({
type: "timeout",
target: s
})
}), 12e4);
s.onerror = s.onload = a, document.head.appendChild(s)
} return Promise.all(t)
}, i.m = e, i.c = n, i.d = function(e, t, n) {
i.o(e, t) || Object.defineProperty(e, t, {
enumerable: !0,
get: n
})
}, i.r = function(e) {
"undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
value: "Module"
}), Object.defineProperty(e, "__esModule", {
value: !0
})
}, i.t = function(e, t) {
if (1 & t && (e = i(e)), 8 & t) return e;
if (4 & t && "object" == typeof e && e && e.__esModule) return e;
var n = Object.create(null);
if (i.r(n), Object.defineProperty(n, "default", {
enumerable: !0,
value: e
}), 2 & t && "string" != typeof e)
for (var r in e) i.d(n, r, function(t) {
return e[t]
}.bind(null, r));
return n
}, i.n = function(e) {
var t = e && e.__esModule ? function() {
return e.default
} : function() {
return e
};
return i.d(t, "a", t), t
}, i.o = function(e, t) {
return Object.prototype.hasOwnProperty.call(e, t)
}, i.p = "", i.oe = function(e) {
throw console.error(e), e
};
var o = window.webpackJsonpvivocha = window.webpackJsonpvivocha || [],
a = o.push.bind(o);
o.push = t, o = o.slice();
for (var s = 0; s < o.length; s++) t(o[s]);
var c = a;
return i(i.s = 266)
}([function(e, t, n) {
var r;
e.exports = (r = r || function(e, t) {
var n = Object.create || function() {
function e() {}
return function(t) {
var n;
return e.prototype = t, n = new e, e.prototype = null, n
}
}(),
r = {},
i = r.lib = {},
o = i.Base = {
extend: function(e) {
var t = n(this);
return e && t.mixIn(e), t.hasOwnProperty("init") && this.init !== t.init || (t.init = function() {
t.$super.init.apply(this, arguments)
}), t.init.prototype = t, t.$super = this, t
},
create: function() {
var e = this.extend();
return e.init.apply(e, arguments), e
},
init: function() {},
mixIn: function(e) {
for (var t in e) e.hasOwnProperty(t) && (this[t] = e[t]);
e.hasOwnProperty("toString") && (this.toString = e.toString)
},
clone: function() {
return this.init.prototype.extend(this)
}
},
a = i.WordArray = o.extend({
init: function(e, t) {
e = this.words = e || [], this.sigBytes = null != t ? t : 4 * e.length
},
toString: function(e) {
return (e || c).stringify(this)
},
concat: function(e) {
var t = this.words,
n = e.words,
r = this.sigBytes,
i = e.sigBytes;
if (this.clamp(), r % 4)
for (var o = 0; o < i; o++) {
var a = n[o >>> 2] >>> 24 - o % 4 * 8 & 255;
t[r + o >>> 2] |= a << 24 - (r + o) % 4 * 8
} else
for (o = 0; o < i; o += 4) t[r + o >>> 2] = n[o >>> 2];
return this.sigBytes += i, this
},
clamp: function() {
var t = this.words,
n = this.sigBytes;
t[n >>> 2] &= 4294967295 << 32 - n % 4 * 8, t.length = e.ceil(n / 4)
},
clone: function() {
var e = o.clone.call(this);
return e.words = this.words.slice(0), e
},
random: function(t) {
for (var n, r = [], i = function(t) {
t = t;
var n = 987654321,
r = 4294967295;
return function() {
var i = ((n = 36969 * (65535 & n) + (n >> 16) & r) << 16) + (t = 18e3 * (65535 & t) + (t >> 16) & r) & r;
return i /= 4294967296, (i += .5) * (e.random() > .5 ? 1 : -1)
}
}, o = 0; o < t; o += 4) {
var s = i(4294967296 * (n || e.random()));
n = 987654071 * s(), r.push(4294967296 * s() | 0)
}
return new a.init(r, t)
}
}),
s = r.enc = {},
c = s.Hex = {
stringify: function(e) {
for (var t = e.words, n = e.sigBytes, r = [], i = 0; i < n; i++) {
var o = t[i >>> 2] >>> 24 - i % 4 * 8 & 255;
r.push((o >>> 4).toString(16)), r.push((15 & o).toString(16))
}
return r.join("")
},
parse: function(e) {
for (var t = e.length, n = [], r = 0; r < t; r += 2) n[r >>> 3] |= parseInt(e.substr(r, 2), 16) << 24 - r % 8 * 4;
return new a.init(n, t / 2)
}
},
u = s.Latin1 = {
stringify: function(e) {
for (var t = e.words, n = e.sigBytes, r = [], i = 0; i < n; i++) {
var o = t[i >>> 2] >>> 24 - i % 4 * 8 & 255;
r.push(String.fromCharCode(o))
}
return r.join("")
},
parse: function(e) {
for (var t = e.length, n = [], r = 0; r < t; r++) n[r >>> 2] |= (255 & e.charCodeAt(r)) << 24 - r % 4 * 8;
return new a.init(n, t)
}
},
h = s.Utf8 = {
stringify: function(e) {
try {
return decodeURIComponent(escape(u.stringify(e)))
} catch (e) {
throw new Error("Malformed UTF-8 data")
}
},
parse: function(e) {
return u.parse(unescape(encodeURIComponent(e)))
}
},
d = i.BufferedBlockAlgorithm = o.extend({
reset: function() {
this._data = new a.init, this._nDataBytes = 0
},
_append: function(e) {
"string" == typeof e && (e = h.parse(e)), this._data.concat(e), this._nDataBytes += e.sigBytes
},
_process: function(t) {
var n = this._data,
r = n.words,
i = n.sigBytes,
o = this.blockSize,
s = i / (4 * o),
c = (s = t ? e.ceil(s) : e.max((0 | s) - this._minBufferSize, 0)) * o,
u = e.min(4 * c, i);
if (c) {
for (var h = 0; h < c; h += o) this._doProcessBlock(r, h);
var d = r.splice(0, c);
n.sigBytes -= u
}
return new a.init(d, u)
},
clone: function() {
var e = o.clone.call(this);
return e._data = this._data.clone(), e
},
_minBufferSize: 0
}),
l = (i.Hasher = d.extend({
cfg: o.extend(),
init: function(e) {
this.cfg = this.cfg.extend(e), this.reset()
},
reset: function() {
d.reset.call(this), this._doReset()
},
update: function(e) {
return this._append(e), this._process(), this
},
finalize: function(e) {
return e && this._append(e), this._doFinalize()
},
blockSize: 16,
_createHelper: function(e) {
return function(t, n) {
return new e.init(n).finalize(t)
}
},
_createHmacHelper: function(e) {
return function(t, n) {
return new l.HMAC.init(e, n).finalize(t)
}
}
}), r.algo = {});
return r
}(Math), r)
}, function(e, t, n) {
var r, i, o, a, s, c, u, h, d, l, f, p, g, v, m, y, C, w, _;
e.exports = (r = n(0), n(3), void(r.lib.Cipher || (i = r, o = i.lib, a = o.Base, s = o.WordArray, c = o.BufferedBlockAlgorithm, u = i.enc, u.Utf8, h = u.Base64, d = i.algo.EvpKDF, l = o.Cipher = c.extend({
cfg: a.extend(),
createEncryptor: function(e, t) {
return this.create(this._ENC_XFORM_MODE, e, t)
},
createDecryptor: function(e, t) {
return this.create(this._DEC_XFORM_MODE, e, t)
},
init: function(e, t, n) {
this.cfg = this.cfg.extend(n), this._xformMode = e, this._key = t, this.reset()
},
reset: function() {
c.reset.call(this), this._doReset()
},
process: function(e) {
return this._append(e), this._process()
},
finalize: function(e) {
return e && this._append(e), this._doFinalize()
},
keySize: 4,
ivSize: 4,
_ENC_XFORM_MODE: 1,
_DEC_XFORM_MODE: 2,
_createHelper: function() {
function e(e) {
return "string" == typeof e ? _ : C
}
return function(t) {
return {
encrypt: function(n, r, i) {
return e(r).encrypt(t, n, r, i)
},
decrypt: function(n, r, i) {
return e(r).decrypt(t, n, r, i)
}
}
}
}()
}), o.StreamCipher = l.extend({
_doFinalize: function() {
return this._process(!0)
},
blockSize: 1
}), f = i.mode = {}, p = o.BlockCipherMode = a.extend({
createEncryptor: function(e, t) {
return this.Encryptor.create(e, t)
},
createDecryptor: function(e, t) {
return this.Decryptor.create(e, t)
},
init: function(e, t) {
this._cipher = e, this._iv = t
}
}), g = f.CBC = function() {
var e = p.extend();

function t(e, t, n) {
var r = this._iv;
if (r) {
var i = r;
this._iv = void 0
} else i = this._prevBlock;
for (var o = 0; o < n; o++) e[t + o] ^= i[o]
}
return e.Encryptor = e.extend({
processBlock: function(e, n) {
var r = this._cipher,
i = r.blockSize;
t.call(this, e, n, i), r.encryptBlock(e, n), this._prevBlock = e.slice(n, n + i)
}
}), e.Decryptor = e.extend({
processBlock: function(e, n) {
var r = this._cipher,
i = r.blockSize,
o = e.slice(n, n + i);
r.decryptBlock(e, n), t.call(this, e, n, i), this._prevBlock = o
}
}), e
}(), v = (i.pad = {}).Pkcs7 = {
pad: function(e, t) {
for (var n = 4 * t, r = n - e.sigBytes % n, i = r << 24 | r << 16 | r << 8 | r, o = [], a = 0; a < r; a += 4) o.push(i);
var c = s.create(o, r);
e.concat(c)
},
unpad: function(e) {
var t = 255 & e.words[e.sigBytes - 1 >>> 2];
e.sigBytes -= t
}
}, o.BlockCipher = l.extend({
cfg: l.cfg.extend({
mode: g,
padding: v
}),
reset: function() {
l.reset.call(this);
var e = this.cfg,
t = e.iv,
n = e.mode;
if (this._xformMode == this._ENC_XFORM_MODE) var r = n.createEncryptor;
else r = n.createDecryptor, this._minBufferSize = 1;
this._mode && this._mode.__creator == r ? this._mode.init(this, t && t.words) : (this._mode = r.call(n, this, t && t.words), this._mode.__creator = r)
},
_doProcessBlock: function(e, t) {
this._mode.processBlock(e, t)
},
_doFinalize: function() {
var e = this.cfg.padding;
if (this._xformMode == this._ENC_XFORM_MODE) {
e.pad(this._data, this.blockSize);
var t = this._process(!0)
} else t = this._process(!0), e.unpad(t);
return t
},
blockSize: 4
}), m = o.CipherParams = a.extend({
init: function(e) {
this.mixIn(e)
},
toString: function(e) {
return (e || this.formatter).stringify(this)
}
}), y = (i.format = {}).OpenSSL = {
stringify: function(e) {
var t = e.ciphertext,
n = e.salt;
if (n) var r = s.create([1398893684, 1701076831]).concat(n).concat(t);
else r = t;
return r.toString(h)
},
parse: function(e) {
var t = h.parse(e),
n = t.words;
if (1398893684 == n[0] && 1701076831 == n[1]) {
var r = s.create(n.slice(2, 4));
n.splice(0, 4), t.sigBytes -= 16
}
return m.create({
ciphertext: t,
salt: r
})
}
}, C = o.SerializableCipher = a.extend({
cfg: a.extend({
format: y
}),
encrypt: function(e, t, n, r) {
r = this.cfg.extend(r);
var i = e.createEncryptor(n, r),
o = i.finalize(t),
a = i.cfg;
return m.create({
ciphertext: o,
key: n,
iv: a.iv,
algorithm: e,
mode: a.mode,
padding: a.padding,
blockSize: e.blockSize,
formatter: r.format
})
},
decrypt: function(e, t, n, r) {
return r = this.cfg.extend(r), t = this._parse(t, r.format), e.createDecryptor(n, r).finalize(t.ciphertext)
},
_parse: function(e, t) {
return "string" == typeof e ? t.parse(e, this) : e
}
}), w = (i.kdf = {}).OpenSSL = {
execute: function(e, t, n, r) {
r || (r = s.random(8));
var i = d.create({
keySize: t + n
}).compute(e, r),
o = s.create(i.words.slice(t), 4 * n);
return i.sigBytes = 4 * t, m.create({
key: i,
iv: o,
salt: r
})
}
}, _ = o.PasswordBasedCipher = C.extend({
cfg: C.cfg.extend({
kdf: w
}),
encrypt: function(e, t, n, r) {
var i = (r = this.cfg.extend(r)).kdf.execute(n, e.keySize, e.ivSize);
r.iv = i.iv;
var o = C.encrypt.call(this, e, t, i.key, r);
return o.mixIn(i), o
},
decrypt: function(e, t, n, r) {
r = this.cfg.extend(r), t = this._parse(t, r.format);
var i = r.kdf.execute(n, e.keySize, e.ivSize, t.salt);
return r.iv = i.iv, C.decrypt.call(this, e, t, i.key, r)
}
}))))
}, function(e, t, n) {
"use strict";
n.r(t), n.d(t, "extractVersion", (function() {
return o
})), n.d(t, "wrapPeerConnectionEvent", (function() {
return a
})), n.d(t, "disableLog", (function() {
return s
})), n.d(t, "disableWarnings", (function() {
return c
})), n.d(t, "log", (function() {
return u
})), n.d(t, "deprecated", (function() {
return h
})), n.d(t, "detectBrowser", (function() {
return d
})), n.d(t, "compactObject", (function() {
return f
})), n.d(t, "walkStats", (function() {
return p
})), n.d(t, "filterStats", (function() {
return g
}));
let r = !0,
i = !0;

function o(e, t, n) {
const r = e.match(t);
return r && r.length >= n && parseInt(r[n], 10)
}

function a(e, t, n) {
if (!e.RTCPeerConnection) return;
const r = e.RTCPeerConnection.prototype,
i = r.addEventListener;
r.addEventListener = function(e, r) {
if (e !== t) return i.apply(this, arguments);
const o = e => {
const t = n(e);
t && (r.handleEvent ? r.handleEvent(t) : r(t))
};
return this._eventMap = this._eventMap || {}, this._eventMap[t] || (this._eventMap[t] = new Map), this._eventMap[t].set(r, o), i.apply(this, [e, o])
};
const o = r.removeEventListener;
r.removeEventListener = function(e, n) {
if (e !== t || !this._eventMap || !this._eventMap[t]) return o.apply(this, arguments);
if (!this._eventMap[t].has(n)) return o.apply(this, arguments);
const r = this._eventMap[t].get(n);
return this._eventMap[t].delete(n), 0 === this._eventMap[t].size && delete this._eventMap[t], 0 === Object.keys(this._eventMap).length && delete this._eventMap, o.apply(this, [e, r])
}, Object.defineProperty(r, "on" + t, {
get() {
return this["_on" + t]
},
set(e) {
this["_on" + t] && (this.removeEventListener(t, this["_on" + t]), delete this["_on" + t]), e && this.addEventListener(t, this["_on" + t] = e)
},
enumerable: !0,
configurable: !0
})
}

function s(e) {
return "boolean" != typeof e ? new Error("Argument type: " + typeof e + ". Please use a boolean.") : (r = e, e ? "adapter.js logging disabled" : "adapter.js logging enabled")
}

function c(e) {
return "boolean" != typeof e ? new Error("Argument type: " + typeof e + ". Please use a boolean.") : (i = !e, "adapter.js deprecation warnings " + (e ? "disabled" : "enabled"))
}

function u() {
if ("object" == typeof window) {
if (r) return;
"undefined" != typeof console && "function" == typeof console.log && console.log.apply(console, arguments)
}
}

function h(e, t) {
i && console.warn(e + " is deprecated, please use " + t + " instead.")
}

function d(e) {
const t = {
browser: null,
version: null
};
if (void 0 === e || !e.navigator) return t.browser = "Not a browser.", t;
const {
navigator: n
} = e;
if (n.mozGetUserMedia) t.browser = "firefox", t.version = o(n.userAgent, /Firefox\/(\d+)\./, 1);
else if (n.webkitGetUserMedia || !1 === e.isSecureContext && e.webkitRTCPeerConnection && !e.RTCIceGatherer) t.browser = "chrome", t.version = o(n.userAgent, /Chrom(e|ium)\/(\d+)\./, 2);
else if (n.mediaDevices && n.userAgent.match(/Edge\/(\d+).(\d+)$/)) t.browser = "edge", t.version = o(n.userAgent, /Edge\/(\d+).(\d+)$/, 2);
else {
if (!e.RTCPeerConnection || !n.userAgent.match(/AppleWebKit\/(\d+)\./)) return t.browser = "Not a supported browser.", t;
t.browser = "safari", t.version = o(n.userAgent, /AppleWebKit\/(\d+)\./, 1), t.supportsUnifiedPlan = e.RTCRtpTransceiver && "currentDirection" in e.RTCRtpTransceiver.prototype
}
return t
}

function l(e) {
return "[object Object]" === Object.prototype.toString.call(e)
}

function f(e) {
return l(e) ? Object.keys(e).reduce((function(t, n) {
const r = l(e[n]),
i = r ? f(e[n]) : e[n],
o = r && !Object.keys(i).length;
return void 0 === i || o ? t : Object.assign(t, {
[n]: i
})
}), {}) : e
}

function p(e, t, n) {
t && !n.has(t.id) && (n.set(t.id, t), Object.keys(t).forEach(r => {
r.endsWith("Id") ? p(e, e.get(t[r]), n) : r.endsWith("Ids") && t[r].forEach(t => {
p(e, e.get(t), n)
})
}))
}

function g(e, t, n) {
const r = n ? "outbound-rtp" : "inbound-rtp",
i = new Map;
if (null === t) return i;
const o = [];
return e.forEach(e => {
"track" === e.type && e.trackIdentifier === t.id && o.push(e)
}), o.forEach(t => {
e.forEach(n => {
n.type === r && n.trackId === t.id && p(e, n, i)
})
}), i
}
}, function(e, t, n) {
var r, i, o, a, s, c, u, h;
e.exports = (h = n(0), n(24), n(25), i = (r = h).lib, o = i.Base, a = i.WordArray, s = r.algo, c = s.MD5, u = s.EvpKDF = o.extend({
cfg: o.extend({
keySize: 4,
hasher: c,
iterations: 1
}),
init: function(e) {
this.cfg = this.cfg.extend(e)
},
compute: function(e, t) {
for (var n = this.cfg, r = n.hasher.create(), i = a.create(), o = i.words, s = n.keySize, c = n.iterations; o.length < s;) {
u && r.update(u);
var u = r.update(e).finalize(t);
r.reset();
for (var h = 1; h < c; h++) u = r.finalize(u), r.reset();
i.concat(u)
}
return i.sigBytes = 4 * s, i
}
}), r.EvpKDF = function(e, t, n) {
return u.create(n).compute(e, t)
}, h.EvpKDF)
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.promise = t.cb = t.namespaces = void 0;
const r = n(55);
let i = {};
t.default = r.getLogger, t.namespaces = function() {
return Object.keys(i)
}, t.cb = function() {
console.log.apply(console, arguments)
}, t.promise = function(e) {
e.then((function(e) {
console.log(e)
}), (function(e) {
console.error(e)
}))
}
}, function(e, t, n) {
function r(e) {
if (e) return function(e) {
for (var t in r.prototype) e[t] = r.prototype[t];
return e
}(e)
}
e.exports = r, r.prototype.on = r.prototype.addEventListener = function(e, t) {
return this._callbacks = this._callbacks || {}, (this._callbacks["$" + e] = this._callbacks["$" + e] || []).push(t), this
}, r.prototype.once = function(e, t) {
function n() {
this.off(e, n), t.apply(this, arguments)
}
return n.fn = t, this.on(e, n), this
}, r.prototype.off = r.prototype.removeListener = r.prototype.removeAllListeners = r.prototype.removeEventListener = function(e, t) {
if (this._callbacks = this._callbacks || {}, 0 == arguments.length) return this._callbacks = {}, this;
var n, r = this._callbacks["$" + e];
if (!r) return this;
if (1 == arguments.length) return delete this._callbacks["$" + e], this;
for (var i = 0; i < r.length; i++)
if ((n = r[i]) === t || n.fn === t) {
r.splice(i, 1);
break
} return 0 === r.length && delete this._callbacks["$" + e], this
}, r.prototype.emit = function(e) {
this._callbacks = this._callbacks || {};
for (var t = new Array(arguments.length - 1), n = this._callbacks["$" + e], r = 1; r < arguments.length; r++) t[r - 1] = arguments[r];
if (n) {
r = 0;
for (var i = (n = n.slice(0)).length; r < i; ++r) n[r].apply(this, t)
}
return this
}, r.prototype.listeners = function(e) {
return this._callbacks = this._callbacks || {}, this._callbacks["$" + e] || []
}, r.prototype.hasListeners = function(e) {
return !!this.listeners(e).length
}
}, function(e, t, n) {
var r, i = n(75),
o = n(35),
a = n(76),
s = n(77),
c = n(78);
"undefined" != typeof ArrayBuffer && (r = n(79));
var u = "undefined" != typeof navigator && /Android/i.test(navigator.userAgent),
h = "undefined" != typeof navigator && /PhantomJS/i.test(navigator.userAgent),
d = u || h;
t.protocol = 3;
var l = t.packets = {
open: 0,
close: 1,
ping: 2,
pong: 3,
message: 4,
upgrade: 5,
noop: 6
},
f = i(l),
p = {
type: "error",
data: "parser error"
},
g = n(80);

function v(e, t, n) {
for (var r = new Array(e.length), i = s(e.length, n), o = function(e, n, i) {
t(n, (function(t, n) {
r[e] = n, i(t, r)
}))
}, a = 0; a < e.length; a++) o(a, e[a], i)
}
t.encodePacket = function(e, n, r, i) {
"function" == typeof n && (i = n, n = !1), "function" == typeof r && (i = r, r = null);
var o = void 0 === e.data ? void 0 : e.data.buffer || e.data;
if ("undefined" != typeof ArrayBuffer && o instanceof ArrayBuffer) return function(e, n, r) {
if (!n) return t.encodeBase64Packet(e, r);
var i = e.data,
o = new Uint8Array(i),
a = new Uint8Array(1 + i.byteLength);
a[0] = l[e.type];
for (var s = 0; s < o.length; s++) a[s + 1] = o[s];
return r(a.buffer)
}(e, n, i);
if (void 0 !== g && o instanceof g) return function(e, n, r) {
if (!n) return t.encodeBase64Packet(e, r);
if (d) return function(e, n, r) {
if (!n) return t.encodeBase64Packet(e, r);
var i = new FileReader;
return i.onload = function() {
t.encodePacket({
type: e.type,
data: i.result
}, n, !0, r)
}, i.readAsArrayBuffer(e.data)
}(e, n, r);
var i = new Uint8Array(1);
i[0] = l[e.type];
var o = new g([i.buffer, e.data]);
return r(o)
}(e, n, i);
if (o && o.base64) return function(e, n) {
var r = "b" + t.packets[e.type] + e.data.data;
return n(r)
}(e, i);
var a = l[e.type];
return void 0 !== e.data && (a += r ? c.encode(String(e.data), {
strict: !1
}) : String(e.data)), i("" + a)
}, t.encodeBase64Packet = function(e, n) {
var r, i = "b" + t.packets[e.type];
if (void 0 !== g && e.data instanceof g) {
var o = new FileReader;
return o.onload = function() {
var e = o.result.split(",")[1];
n(i + e)
}, o.readAsDataURL(e.data)
}
try {
r = String.fromCharCode.apply(null, new Uint8Array(e.data))
} catch (t) {
for (var a = new Uint8Array(e.data), s = new Array(a.length), c = 0; c < a.length; c++) s[c] = a[c];
r = String.fromCharCode.apply(null, s)
}
return i += btoa(r), n(i)
}, t.decodePacket = function(e, n, r) {
if (void 0 === e) return p;
if ("string" == typeof e) {
if ("b" === e.charAt(0)) return t.decodeBase64Packet(e.substr(1), n);
if (r && !1 === (e = function(e) {
try {
e = c.decode(e, {
strict: !1
})
} catch (e) {
return !1
}
return e
}(e))) return p;
var i = e.charAt(0);
return Number(i) == i && f[i] ? e.length > 1 ? {
type: f[i],
data: e.substring(1)
} : {
type: f[i]
} : p
}
i = new Uint8Array(e)[0];
var o = a(e, 1);
return g && "blob" === n && (o = new g([o])), {
type: f[i],
data: o
}
}, t.decodeBase64Packet = function(e, t) {
var n = f[e.charAt(0)];
if (!r) return {
type: n,
data: {
base64: !0,
data: e.substr(1)
}
};
var i = r.decode(e.substr(1));
return "blob" === t && g && (i = new g([i])), {
type: n,
data: i
}
}, t.encodePayload = function(e, n, r) {
"function" == typeof n && (r = n, n = null);
var i = o(e);
if (n && i) return g && !d ? t.encodePayloadAsBlob(e, r) : t.encodePayloadAsArrayBuffer(e, r);
if (!e.length) return r("0:");
v(e, (function(e, r) {
t.encodePacket(e, !!i && n, !1, (function(e) {
r(null, function(e) {
return e.length + ":" + e
}(e))
}))
}), (function(e, t) {
return r(t.join(""))
}))
}, t.decodePayload = function(e, n, r) {
if ("string" != typeof e) return t.decodePayloadAsBinary(e, n, r);
var i;
if ("function" == typeof n && (r = n, n = null), "" === e) return r(p, 0, 1);
for (var o, a, s = "", c = 0, u = e.length; c < u; c++) {
var h = e.charAt(c);
if (":" === h) {
if ("" === s || s != (o = Number(s))) return r(p, 0, 1);
if (s != (a = e.substr(c + 1, o)).length) return r(p, 0, 1);
if (a.length) {
if (i = t.decodePacket(a, n, !1), p.type === i.type && p.data === i.data) return r(p, 0, 1);
if (!1 === r(i, c + o, u)) return
}
c += o, s = ""
} else s += h
}
return "" !== s ? r(p, 0, 1) : void 0
}, t.encodePayloadAsArrayBuffer = function(e, n) {
if (!e.length) return n(new ArrayBuffer(0));
v(e, (function(e, n) {
t.encodePacket(e, !0, !0, (function(e) {
return n(null, e)
}))
}), (function(e, t) {
var r = t.reduce((function(e, t) {
var n;
return e + (n = "string" == typeof t ? t.length : t.byteLength).toString().length + n + 2
}), 0),
i = new Uint8Array(r),
o = 0;
return t.forEach((function(e) {
var t = "string" == typeof e,
n = e;
if (t) {
for (var r = new Uint8Array(e.length), a = 0; a < e.length; a++) r[a] = e.charCodeAt(a);
n = r.buffer
}
i[o++] = t ? 0 : 1;
var s = n.byteLength.toString();
for (a = 0; a < s.length; a++) i[o++] = parseInt(s[a]);
i[o++] = 255;
for (r = new Uint8Array(n), a = 0; a < r.length; a++) i[o++] = r[a]
})), n(i.buffer)
}))
}, t.encodePayloadAsBlob = function(e, n) {
v(e, (function(e, n) {
t.encodePacket(e, !0, !0, (function(e) {
var t = new Uint8Array(1);
if (t[0] = 1, "string" == typeof e) {
for (var r = new Uint8Array(e.length), i = 0; i < e.length; i++) r[i] = e.charCodeAt(i);
e = r.buffer, t[0] = 0
}
var o = (e instanceof ArrayBuffer ? e.byteLength : e.size).toString(),
a = new Uint8Array(o.length + 1);
for (i = 0; i < o.length; i++) a[i] = parseInt(o[i]);
if (a[o.length] = 255, g) {
var s = new g([t.buffer, a.buffer, e]);
n(null, s)
}
}))
}), (function(e, t) {
return n(new g(t))
}))
}, t.decodePayloadAsBinary = function(e, n, r) {
"function" == typeof n && (r = n, n = null);
for (var i = e, o = []; i.byteLength > 0;) {
for (var s = new Uint8Array(i), c = 0 === s[0], u = "", h = 1; 255 !== s[h]; h++) {
if (u.length > 310) return r(p, 0, 1);
u += s[h]
}
i = a(i, 2 + u.length), u = parseInt(u);
var d = a(i, 0, u);
if (c) try {
d = String.fromCharCode.apply(null, new Uint8Array(d))
} catch (e) {
var l = new Uint8Array(d);
d = "";
for (h = 0; h < l.length; h++) d += String.fromCharCode(l[h])
}
o.push(d), i = a(i, u)
}
var f = o.length;
o.forEach((function(e, i) {
r(t.decodePacket(e, n, !0), i, f)
}))
}
}, function(e, t, n) {
var r, i, o;
e.exports = (o = n(0), i = (r = o).lib.WordArray, r.enc.Base64 = {
stringify: function(e) {
var t = e.words,
n = e.sigBytes,
r = this._map;
e.clamp();
for (var i = [], o = 0; o < n; o += 3)
for (var a = (t[o >>> 2] >>> 24 - o % 4 * 8 & 255) << 16 | (t[o + 1 >>> 2] >>> 24 - (o + 1) % 4 * 8 & 255) << 8 | t[o + 2 >>> 2] >>> 24 - (o + 2) % 4 * 8 & 255, s = 0; s < 4 && o + .75 * s < n; s++) i.push(r.charAt(a >>> 6 * (3 - s) & 63));
var c = r.charAt(64);
if (c)
for (; i.length % 4;) i.push(c);
return i.join("")
},
parse: function(e) {
var t = e.length,
n = this._map,
r = this._reverseMap;
if (!r) {
r = this._reverseMap = [];
for (var o = 0; o < n.length; o++) r[n.charCodeAt(o)] = o
}
var a = n.charAt(64);
if (a) {
var s = e.indexOf(a); - 1 !== s && (t = s)
}
return function(e, t, n) {
for (var r = [], o = 0, a = 0; a < t; a++)
if (a % 4) {
var s = n[e.charCodeAt(a - 1)] << a % 4 * 2,
c = n[e.charCodeAt(a)] >>> 6 - a % 4 * 2;
r[o >>> 2] |= (s | c) << 24 - o % 4 * 8, o++
} return i.create(r, o)
}(e, t, r)
},
_map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
}, o.enc.Base64)
}, function(e, t, n) {
var r;
e.exports = (r = n(0), function(e) {
var t = r,
n = t.lib,
i = n.WordArray,
o = n.Hasher,
a = t.algo,
s = [];
! function() {
for (var t = 0; t < 64; t++) s[t] = 4294967296 * e.abs(e.sin(t + 1)) | 0
}();
var c = a.MD5 = o.extend({
_doReset: function() {
this._hash = new i.init([1732584193, 4023233417, 2562383102, 271733878])
},
_doProcessBlock: function(e, t) {
for (var n = 0; n < 16; n++) {
var r = t + n,
i = e[r];
e[r] = 16711935 & (i << 8 | i >>> 24) | 4278255360 & (i << 24 | i >>> 8)
}
var o = this._hash.words,
a = e[t + 0],
c = e[t + 1],
f = e[t + 2],
p = e[t + 3],
g = e[t + 4],
v = e[t + 5],
m = e[t + 6],
y = e[t + 7],
C = e[t + 8],
w = e[t + 9],
_ = e[t + 10],
b = e[t + 11],
E = e[t + 12],
T = e[t + 13],
S = e[t + 14],
R = e[t + 15],
x = o[0],
k = o[1],
P = o[2],
A = o[3];
x = u(x, k, P, A, a, 7, s[0]), A = u(A, x, k, P, c, 12, s[1]), P = u(P, A, x, k, f, 17, s[2]), k = u(k, P, A, x, p, 22, s[3]), x = u(x, k, P, A, g, 7, s[4]), A = u(A, x, k, P, v, 12, s[5]), P = u(P, A, x, k, m, 17, s[6]), k = u(k, P, A, x, y, 22, s[7]), x = u(x, k, P, A, C, 7, s[8]), A = u(A, x, k, P, w, 12, s[9]), P = u(P, A, x, k, _, 17, s[10]), k = u(k, P, A, x, b, 22, s[11]), x = u(x, k, P, A, E, 7, s[12]), A = u(A, x, k, P, T, 12, s[13]), P = u(P, A, x, k, S, 17, s[14]), x = h(x, k = u(k, P, A, x, R, 22, s[15]), P, A, c, 5, s[16]), A = h(A, x, k, P, m, 9, s[17]), P = h(P, A, x, k, b, 14, s[18]), k = h(k, P, A, x, a, 20, s[19]), x = h(x, k, P, A, v, 5, s[20]), A = h(A, x, k, P, _, 9, s[21]), P = h(P, A, x, k, R, 14, s[22]), k = h(k, P, A, x, g, 20, s[23]), x = h(x, k, P, A, w, 5, s[24]), A = h(A, x, k, P, S, 9, s[25]), P = h(P, A, x, k, p, 14, s[26]), k = h(k, P, A, x, C, 20, s[27]), x = h(x, k, P, A, T, 5, s[28]), A = h(A, x, k, P, f, 9, s[29]), P = h(P, A, x, k, y, 14, s[30]), x = d(x, k = h(k, P, A, x, E, 20, s[31]), P, A, v, 4, s[32]), A = d(A, x, k, P, C, 11, s[33]), P = d(P, A, x, k, b, 16, s[34]), k = d(k, P, A, x, S, 23, s[35]), x = d(x, k, P, A, c, 4, s[36]), A = d(A, x, k, P, g, 11, s[37]), P = d(P, A, x, k, y, 16, s[38]), k = d(k, P, A, x, _, 23, s[39]), x = d(x, k, P, A, T, 4, s[40]), A = d(A, x, k, P, a, 11, s[41]), P = d(P, A, x, k, p, 16, s[42]), k = d(k, P, A, x, m, 23, s[43]), x = d(x, k, P, A, w, 4, s[44]), A = d(A, x, k, P, E, 11, s[45]), P = d(P, A, x, k, R, 16, s[46]), x = l(x, k = d(k, P, A, x, f, 23, s[47]), P, A, a, 6, s[48]), A = l(A, x, k, P, y, 10, s[49]), P = l(P, A, x, k, S, 15, s[50]), k = l(k, P, A, x, v, 21, s[51]), x = l(x, k, P, A, E, 6, s[52]), A = l(A, x, k, P, p, 10, s[53]), P = l(P, A, x, k, _, 15, s[54]), k = l(k, P, A, x, c, 21, s[55]), x = l(x, k, P, A, C, 6, s[56]), A = l(A, x, k, P, R, 10, s[57]), P = l(P, A, x, k, m, 15, s[58]), k = l(k, P, A, x, T, 21, s[59]), x = l(x, k, P, A, g, 6, s[60]), A = l(A, x, k, P, b, 10, s[61]), P = l(P, A, x, k, f, 15, s[62]), k = l(k, P, A, x, w, 21, s[63]), o[0] = o[0] + x | 0, o[1] = o[1] + k | 0, o[2] = o[2] + P | 0, o[3] = o[3] + A | 0
},
_doFinalize: function() {
var t = this._data,
n = t.words,
r = 8 * this._nDataBytes,
i = 8 * t.sigBytes;
n[i >>> 5] |= 128 << 24 - i % 32;
var o = e.floor(r / 4294967296),
a = r;
n[15 + (i + 64 >>> 9 << 4)] = 16711935 & (o << 8 | o >>> 24) | 4278255360 & (o << 24 | o >>> 8), n[14 + (i + 64 >>> 9 << 4)] = 16711935 & (a << 8 | a >>> 24) | 4278255360 & (a << 24 | a >>> 8), t.sigBytes = 4 * (n.length + 1), this._process();
for (var s = this._hash, c = s.words, u = 0; u < 4; u++) {
var h = c[u];
c[u] = 16711935 & (h << 8 | h >>> 24) | 4278255360 & (h << 24 | h >>> 8)
}
return s
},
clone: function() {
var e = o.clone.call(this);
return e._hash = this._hash.clone(), e
}
});

function u(e, t, n, r, i, o, a) {
var s = e + (t & n | ~t & r) + i + a;
return (s << o | s >>> 32 - o) + t
}

function h(e, t, n, r, i, o, a) {
var s = e + (t & r | n & ~r) + i + a;
return (s << o | s >>> 32 - o) + t
}

function d(e, t, n, r, i, o, a) {
var s = e + (t ^ n ^ r) + i + a;
return (s << o | s >>> 32 - o) + t
}

function l(e, t, n, r, i, o, a) {
var s = e + (n ^ (t | ~r)) + i + a;
return (s << o | s >>> 32 - o) + t
}
t.MD5 = o._createHelper(c), t.HmacMD5 = o._createHmacHelper(c)
}(Math), r.MD5)
}, function(e, t, n) {
"use strict";
var r, i = "object" == typeof Reflect ? Reflect : null,
o = i && "function" == typeof i.apply ? i.apply : function(e, t, n) {
return Function.prototype.apply.call(e, t, n)
};
r = i && "function" == typeof i.ownKeys ? i.ownKeys : Object.getOwnPropertySymbols ? function(e) {
return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))
} : function(e) {
return Object.getOwnPropertyNames(e)
};
var a = Number.isNaN || function(e) {
return e != e
};

function s() {
s.init.call(this)
}
e.exports = s, e.exports.once = function(e, t) {
return new Promise((function(n, r) {
function i(n) {
e.removeListener(t, o), r(n)
}

function o() {
"function" == typeof e.removeListener && e.removeListener("error", i), n([].slice.call(arguments))
}
m(e, t, o, {
once: !0
}), "error" !== t && function(e, t, n) {
"function" == typeof e.on && m(e, "error", t, n)
}(e, i, {
once: !0
})
}))
}, s.EventEmitter = s, s.prototype._events = void 0, s.prototype._eventsCount = 0, s.prototype._maxListeners = void 0;
var c = 10;

function u(e) {
if ("function" != typeof e) throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof e)
}

function h(e) {
return void 0 === e._maxListeners ? s.defaultMaxListeners : e._maxListeners
}

function d(e, t, n, r) {
var i, o, a, s;
if (u(n), void 0 === (o = e._events) ? (o = e._events = Object.create(null), e._eventsCount = 0) : (void 0 !== o.newListener && (e.emit("newListener", t, n.listener ? n.listener : n), o = e._events), a = o[t]), void 0 === a) a = o[t] = n, ++e._eventsCount;
else if ("function" == typeof a ? a = o[t] = r ? [n, a] : [a, n] : r ? a.unshift(n) : a.push(n), (i = h(e)) > 0 && a.length > i && !a.warned) {
a.warned = !0;
var c = new Error("Possible EventEmitter memory leak detected. " + a.length + " " + String(t) + " listeners added. Use emitter.setMaxListeners() to increase limit");
c.name = "MaxListenersExceededWarning", c.emitter = e, c.type = t, c.count = a.length, s = c, console && console.warn && console.warn(s)
}
return e
}

function l() {
if (!this.fired) return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, 0 === arguments.length ? this.listener.call(this.target) : this.listener.apply(this.target, arguments)
}

function f(e, t, n) {
var r = {
fired: !1,
wrapFn: void 0,
target: e,
type: t,
listener: n
},
i = l.bind(r);
return i.listener = n, r.wrapFn = i, i
}

function p(e, t, n) {
var r = e._events;
if (void 0 === r) return [];
var i = r[t];
return void 0 === i ? [] : "function" == typeof i ? n ? [i.listener || i] : [i] : n ? function(e) {
for (var t = new Array(e.length), n = 0; n < t.length; ++n) t[n] = e[n].listener || e[n];
return t
}(i) : v(i, i.length)
}

function g(e) {
var t = this._events;
if (void 0 !== t) {
var n = t[e];
if ("function" == typeof n) return 1;
if (void 0 !== n) return n.length
}
return 0
}

function v(e, t) {
for (var n = new Array(t), r = 0; r < t; ++r) n[r] = e[r];
return n
}

function m(e, t, n, r) {
if ("function" == typeof e.on) r.once ? e.once(t, n) : e.on(t, n);
else {
if ("function" != typeof e.addEventListener) throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof e);
e.addEventListener(t, (function i(o) {
r.once && e.removeEventListener(t, i), n(o)
}))
}
}
Object.defineProperty(s, "defaultMaxListeners", {
enumerable: !0,
get: function() {
return c
},
set: function(e) {
if ("number" != typeof e || e < 0 || a(e)) throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + e + ".");
c = e
}
}), s.init = function() {
void 0 !== this._events && this._events !== Object.getPrototypeOf(this)._events || (this._events = Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0
}, s.prototype.setMaxListeners = function(e) {
if ("number" != typeof e || e < 0 || a(e)) throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + ".");
return this._maxListeners = e, this
}, s.prototype.getMaxListeners = function() {
return h(this)
}, s.prototype.emit = function(e) {
for (var t = [], n = 1; n < arguments.length; n++) t.push(arguments[n]);
var r = "error" === e,
i = this._events;
if (void 0 !== i) r = r && void 0 === i.error;
else if (!r) return !1;
if (r) {
var a;
if (t.length > 0 && (a = t[0]), a instanceof Error) throw a;
var s = new Error("Unhandled error." + (a ? " (" + a.message + ")" : ""));
throw s.context = a, s
}
var c = i[e];
if (void 0 === c) return !1;
if ("function" == typeof c) o(c, this, t);
else {
var u = c.length,
h = v(c, u);
for (n = 0; n < u; ++n) o(h[n], this, t)
}
return !0
}, s.prototype.addListener = function(e, t) {
return d(this, e, t, !1)
}, s.prototype.on = s.prototype.addListener, s.prototype.prependListener = function(e, t) {
return d(this, e, t, !0)
}, s.prototype.once = function(e, t) {
return u(t), this.on(e, f(this, e, t)), this
}, s.prototype.prependOnceListener = function(e, t) {
return u(t), this.prependListener(e, f(this, e, t)), this
}, s.prototype.removeListener = function(e, t) {
var n, r, i, o, a;
if (u(t), void 0 === (r = this._events)) return this;
if (void 0 === (n = r[e])) return this;
if (n === t || n.listener === t) 0 == --this._eventsCount ? this._events = Object.create(null) : (delete r[e], r.removeListener && this.emit("removeListener", e, n.listener || t));
else if ("function" != typeof n) {
for (i = -1, o = n.length - 1; o >= 0; o--)
if (n[o] === t || n[o].listener === t) {
a = n[o].listener, i = o;
break
} if (i < 0) return this;
0 === i ? n.shift() : function(e, t) {
for (; t + 1 < e.length; t++) e[t] = e[t + 1];
e.pop()
}(n, i), 1 === n.length && (r[e] = n[0]), void 0 !== r.removeListener && this.emit("removeListener", e, a || t)
}
return this
}, s.prototype.off = s.prototype.removeListener, s.prototype.removeAllListeners = function(e) {
var t, n, r;
if (void 0 === (n = this._events)) return this;
if (void 0 === n.removeListener) return 0 === arguments.length ? (this._events = Object.create(null), this._eventsCount = 0) : void 0 !== n[e] && (0 == --this._eventsCount ? this._events = Object.create(null) : delete n[e]), this;
if (0 === arguments.length) {
var i, o = Object.keys(n);
for (r = 0; r < o.length; ++r) "removeListener" !== (i = o[r]) && this.removeAllListeners(i);
return this.removeAllListeners("removeListener"), this._events = Object.create(null), this._eventsCount = 0, this
}
if ("function" == typeof(t = n[e])) this.removeListener(e, t);
else if (void 0 !== t)
for (r = t.length - 1; r >= 0; r--) this.removeListener(e, t[r]);
return this
}, s.prototype.listeners = function(e) {
return p(this, e, !0)
}, s.prototype.rawListeners = function(e) {
return p(this, e, !1)
}, s.listenerCount = function(e, t) {
return "function" == typeof e.listenerCount ? e.listenerCount(t) : g.call(e, t)
}, s.prototype.listenerCount = g, s.prototype.eventNames = function() {
return this._eventsCount > 0 ? r(this._events) : []
}
}, function(e, t) {
var n, r, i = e.exports = {};

function o() {
throw new Error("setTimeout has not been defined")
}

function a() {
throw new Error("clearTimeout has not been defined")
}

function s(e) {
if (n === setTimeout) return setTimeout(e, 0);
if ((n === o || !n) && setTimeout) return n = setTimeout, setTimeout(e, 0);
try {
return n(e, 0)
} catch (t) {
try {
return n.call(null, e, 0)
} catch (t) {
return n.call(this, e, 0)
}
}
}! function() {
try {
n = "function" == typeof setTimeout ? setTimeout : o
} catch (e) {
n = o
}
try {
r = "function" == typeof clearTimeout ? clearTimeout : a
} catch (e) {
r = a
}
}();
var c, u = [],
h = !1,
d = -1;

function l() {
h && c && (h = !1, c.length ? u = c.concat(u) : d = -1, u.length && f())
}

function f() {
if (!h) {
var e = s(l);
h = !0;
for (var t = u.length; t;) {
for (c = u, u = []; ++d < t;) c && c[d].run();
d = -1, t = u.length
}
c = null, h = !1,
function(e) {
if (r === clearTimeout) return clearTimeout(e);
if ((r === a || !r) && clearTimeout) return r = clearTimeout, clearTimeout(e);
try {
r(e)
} catch (t) {
try {
return r.call(null, e)
} catch (t) {
return r.call(this, e)
}
}
}(e)
}
}

function p(e, t) {
this.fun = e, this.array = t
}

function g() {}
i.nextTick = function(e) {
var t = new Array(arguments.length - 1);
if (arguments.length > 1)
for (var n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
u.push(new p(e, t)), 1 !== u.length || h || s(f)
}, p.prototype.run = function() {
this.fun.apply(null, this.array)
}, i.title = "browser", i.browser = !0, i.env = {}, i.argv = [], i.version = "", i.versions = {}, i.on = g, i.addListener = g, i.once = g, i.off = g, i.removeListener = g, i.removeAllListeners = g, i.emit = g, i.prependListener = g, i.prependOnceListener = g, i.listeners = function(e) {
return []
}, i.binding = function(e) {
throw new Error("process.binding is not supported")
}, i.cwd = function() {
return "/"
}, i.chdir = function(e) {
throw new Error("process.chdir is not supported")
}, i.umask = function() {
return 0
}
}, function(e, t, n) {
"use strict";
var r = this && this.__createBinding || (Object.create ? function(e, t, n, r) {
void 0 === r && (r = n), Object.defineProperty(e, r, {
enumerable: !0,
get: function() {
return t[n]
}
})
} : function(e, t, n, r) {
void 0 === r && (r = n), e[r] = t[n]
}),
i = this && this.__exportStar || function(e, t) {
for (var n in e) "default" === n || t.hasOwnProperty(n) || r(t, e, n)
};
Object.defineProperty(t, "__esModule", {
value: !0
}), i(n(56), t);
var o = n(4);
Object.defineProperty(t, "getLogger", {
enumerable: !0,
get: function() {
return o.default
}
}), i(n(88), t), i(n(46), t), i(n(116), t), i(n(117), t), i(n(29), t), i(n(47), t), i(n(26), t), i(n(45), t)
}, function(e, t, n) {
"use strict";
(function(e) {
var r = n(68),
i = n(69),
o = n(70);

function a() {
return c.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823
}

function s(e, t) {
if (a() < t) throw new RangeError("Invalid typed array length");
return c.TYPED_ARRAY_SUPPORT ? (e = new Uint8Array(t)).__proto__ = c.prototype : (null === e && (e = new c(t)), e.length = t), e
}

function c(e, t, n) {
if (!(c.TYPED_ARRAY_SUPPORT || this instanceof c)) return new c(e, t, n);
if ("number" == typeof e) {
if ("string" == typeof t) throw new Error("If encoding is specified then the first argument must be a string");
return d(this, e)
}
return u(this, e, t, n)
}

function u(e, t, n, r) {
if ("number" == typeof t) throw new TypeError('"value" argument must not be a number');
return "undefined" != typeof ArrayBuffer && t instanceof ArrayBuffer ? function(e, t, n, r) {
if (t.byteLength, n < 0 || t.byteLength < n) throw new RangeError("'offset' is out of bounds");
if (t.byteLength < n + (r || 0)) throw new RangeError("'length' is out of bounds");
t = void 0 === n && void 0 === r ? new Uint8Array(t) : void 0 === r ? new Uint8Array(t, n) : new Uint8Array(t, n, r);
c.TYPED_ARRAY_SUPPORT ? (e = t).__proto__ = c.prototype : e = l(e, t);
return e
}(e, t, n, r) : "string" == typeof t ? function(e, t, n) {
"string" == typeof n && "" !== n || (n = "utf8");
if (!c.isEncoding(n)) throw new TypeError('"encoding" must be a valid string encoding');
var r = 0 | p(t, n),
i = (e = s(e, r)).write(t, n);
i !== r && (e = e.slice(0, i));
return e
}(e, t, n) : function(e, t) {
if (c.isBuffer(t)) {
var n = 0 | f(t.length);
return 0 === (e = s(e, n)).length || t.copy(e, 0, 0, n), e
}
if (t) {
if ("undefined" != typeof ArrayBuffer && t.buffer instanceof ArrayBuffer || "length" in t) return "number" != typeof t.length || (r = t.length) != r ? s(e, 0) : l(e, t);
if ("Buffer" === t.type && o(t.data)) return l(e, t.data)
}
var r;
throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")
}(e, t)
}

function h(e) {
if ("number" != typeof e) throw new TypeError('"size" argument must be a number');
if (e < 0) throw new RangeError('"size" argument must not be negative')
}

function d(e, t) {
if (h(t), e = s(e, t < 0 ? 0 : 0 | f(t)), !c.TYPED_ARRAY_SUPPORT)
for (var n = 0; n < t; ++n) e[n] = 0;
return e
}

function l(e, t) {
var n = t.length < 0 ? 0 : 0 | f(t.length);
e = s(e, n);
for (var r = 0; r < n; r += 1) e[r] = 255 & t[r];
return e
}

function f(e) {
if (e >= a()) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + a().toString(16) + " bytes");
return 0 | e
}

function p(e, t) {
if (c.isBuffer(e)) return e.length;
if ("undefined" != typeof ArrayBuffer && "function" == typeof ArrayBuffer.isView && (ArrayBuffer.isView(e) || e instanceof ArrayBuffer)) return e.byteLength;
"string" != typeof e && (e = "" + e);
var n = e.length;
if (0 === n) return 0;
for (var r = !1;;) switch (t) {
case "ascii":
case "latin1":
case "binary":
return n;
case "utf8":
case "utf-8":
case void 0:
return B(e).length;
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return 2 * n;
case "hex":
return n >>> 1;
case "base64":
return U(e).length;
default:
if (r) return B(e).length;
t = ("" + t).toLowerCase(), r = !0
}
}

function g(e, t, n) {
var r = !1;
if ((void 0 === t || t < 0) && (t = 0), t > this.length) return "";
if ((void 0 === n || n > this.length) && (n = this.length), n <= 0) return "";
if ((n >>>= 0) <= (t >>>= 0)) return "";
for (e || (e = "utf8");;) switch (e) {
case "hex":
return P(this, t, n);
case "utf8":
case "utf-8":
return R(this, t, n);
case "ascii":
return x(this, t, n);
case "latin1":
case "binary":
return k(this, t, n);
case "base64":
return S(this, t, n);
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return A(this, t, n);
default:
if (r) throw new TypeError("Unknown encoding: " + e);
e = (e + "").toLowerCase(), r = !0
}
}

function v(e, t, n) {
var r = e[t];
e[t] = e[n], e[n] = r
}

function m(e, t, n, r, i) {
if (0 === e.length) return -1;
if ("string" == typeof n ? (r = n, n = 0) : n > 2147483647 ? n = 2147483647 : n < -2147483648 && (n = -2147483648), n = +n, isNaN(n) && (n = i ? 0 : e.length - 1), n < 0 && (n = e.length + n), n >= e.length) {
if (i) return -1;
n = e.length - 1
} else if (n < 0) {
if (!i) return -1;
n = 0
}
if ("string" == typeof t && (t = c.from(t, r)), c.isBuffer(t)) return 0 === t.length ? -1 : y(e, t, n, r, i);
if ("number" == typeof t) return t &= 255, c.TYPED_ARRAY_SUPPORT && "function" == typeof Uint8Array.prototype.indexOf ? i ? Uint8Array.prototype.indexOf.call(e, t, n) : Uint8Array.prototype.lastIndexOf.call(e, t, n) : y(e, [t], n, r, i);
throw new TypeError("val must be string, number or Buffer")
}

function y(e, t, n, r, i) {
var o, a = 1,
s = e.length,
c = t.length;
if (void 0 !== r && ("ucs2" === (r = String(r).toLowerCase()) || "ucs-2" === r || "utf16le" === r || "utf-16le" === r)) {
if (e.length < 2 || t.length < 2) return -1;
a = 2, s /= 2, c /= 2, n /= 2
}

function u(e, t) {
return 1 === a ? e[t] : e.readUInt16BE(t * a)
}
if (i) {
var h = -1;
for (o = n; o < s; o++)
if (u(e, o) === u(t, -1 === h ? 0 : o - h)) {
if (-1 === h && (h = o), o - h + 1 === c) return h * a
} else -1 !== h && (o -= o - h), h = -1
} else
for (n + c > s && (n = s - c), o = n; o >= 0; o--) {
for (var d = !0, l = 0; l < c; l++)
if (u(e, o + l) !== u(t, l)) {
d = !1;
break
} if (d) return o
}
return -1
}

function C(e, t, n, r) {
n = Number(n) || 0;
var i = e.length - n;
r ? (r = Number(r)) > i && (r = i) : r = i;
var o = t.length;
if (o % 2 != 0) throw new TypeError("Invalid hex string");
r > o / 2 && (r = o / 2);
for (var a = 0; a < r; ++a) {
var s = parseInt(t.substr(2 * a, 2), 16);
if (isNaN(s)) return a;
e[n + a] = s
}
return a
}

function w(e, t, n, r) {
return W(B(t, e.length - n), e, n, r)
}

function _(e, t, n, r) {
return W(function(e) {
for (var t = [], n = 0; n < e.length; ++n) t.push(255 & e.charCodeAt(n));
return t
}(t), e, n, r)
}

function b(e, t, n, r) {
return _(e, t, n, r)
}

function E(e, t, n, r) {
return W(U(t), e, n, r)
}

function T(e, t, n, r) {
return W(function(e, t) {
for (var n, r, i, o = [], a = 0; a < e.length && !((t -= 2) < 0); ++a) n = e.charCodeAt(a), r = n >> 8, i = n % 256, o.push(i), o.push(r);
return o
}(t, e.length - n), e, n, r)
}

function S(e, t, n) {
return 0 === t && n === e.length ? r.fromByteArray(e) : r.fromByteArray(e.slice(t, n))
}

function R(e, t, n) {
n = Math.min(e.length, n);
for (var r = [], i = t; i < n;) {
var o, a, s, c, u = e[i],
h = null,
d = u > 239 ? 4 : u > 223 ? 3 : u > 191 ? 2 : 1;
if (i + d <= n) switch (d) {
case 1:
u < 128 && (h = u);
break;
case 2:
128 == (192 & (o = e[i + 1])) && (c = (31 & u) << 6 | 63 & o) > 127 && (h = c);
break;
case 3:
o = e[i + 1], a = e[i + 2], 128 == (192 & o) && 128 == (192 & a) && (c = (15 & u) << 12 | (63 & o) << 6 | 63 & a) > 2047 && (c < 55296 || c > 57343) && (h = c);
break;
case 4:
o = e[i + 1], a = e[i + 2], s = e[i + 3], 128 == (192 & o) && 128 == (192 & a) && 128 == (192 & s) && (c = (15 & u) << 18 | (63 & o) << 12 | (63 & a) << 6 | 63 & s) > 65535 && c < 1114112 && (h = c)
}
null === h ? (h = 65533, d = 1) : h > 65535 && (h -= 65536, r.push(h >>> 10 & 1023 | 55296), h = 56320 | 1023 & h), r.push(h), i += d
}
return function(e) {
var t = e.length;
if (t <= 4096) return String.fromCharCode.apply(String, e);
var n = "",
r = 0;
for (; r < t;) n += String.fromCharCode.apply(String, e.slice(r, r += 4096));
return n
}(r)
}
t.Buffer = c, t.SlowBuffer = function(e) {
+e != e && (e = 0);
return c.alloc(+e)
}, t.INSPECT_MAX_BYTES = 50, c.TYPED_ARRAY_SUPPORT = void 0 !== e.TYPED_ARRAY_SUPPORT ? e.TYPED_ARRAY_SUPPORT : function() {
try {
var e = new Uint8Array(1);
return e.__proto__ = {
__proto__: Uint8Array.prototype,
foo: function() {
return 42
}
}, 42 === e.foo() && "function" == typeof e.subarray && 0 === e.subarray(1, 1).byteLength
} catch (e) {
return !1
}
}(), t.kMaxLength = a(), c.poolSize = 8192, c._augment = function(e) {
return e.__proto__ = c.prototype, e
}, c.from = function(e, t, n) {
return u(null, e, t, n)
}, c.TYPED_ARRAY_SUPPORT && (c.prototype.__proto__ = Uint8Array.prototype, c.__proto__ = Uint8Array, "undefined" != typeof Symbol && Symbol.species && c[Symbol.species] === c && Object.defineProperty(c, Symbol.species, {
value: null,
configurable: !0
})), c.alloc = function(e, t, n) {
return function(e, t, n, r) {
return h(t), t <= 0 ? s(e, t) : void 0 !== n ? "string" == typeof r ? s(e, t).fill(n, r) : s(e, t).fill(n) : s(e, t)
}(null, e, t, n)
}, c.allocUnsafe = function(e) {
return d(null, e)
}, c.allocUnsafeSlow = function(e) {
return d(null, e)
}, c.isBuffer = function(e) {
return !(null == e || !e._isBuffer)
}, c.compare = function(e, t) {
if (!c.isBuffer(e) || !c.isBuffer(t)) throw new TypeError("Arguments must be Buffers");
if (e === t) return 0;
for (var n = e.length, r = t.length, i = 0, o = Math.min(n, r); i < o; ++i)
if (e[i] !== t[i]) {
n = e[i], r = t[i];
break
} return n < r ? -1 : r < n ? 1 : 0
}, c.isEncoding = function(e) {
switch (String(e).toLowerCase()) {
case "hex":
case "utf8":
case "utf-8":
case "ascii":
case "latin1":
case "binary":
case "base64":
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return !0;
default:
return !1
}
}, c.concat = function(e, t) {
if (!o(e)) throw new TypeError('"list" argument must be an Array of Buffers');
if (0 === e.length) return c.alloc(0);
var n;
if (void 0 === t)
for (t = 0, n = 0; n < e.length; ++n) t += e[n].length;
var r = c.allocUnsafe(t),
i = 0;
for (n = 0; n < e.length; ++n) {
var a = e[n];
if (!c.isBuffer(a)) throw new TypeError('"list" argument must be an Array of Buffers');
a.copy(r, i), i += a.length
}
return r
}, c.byteLength = p, c.prototype._isBuffer = !0, c.prototype.swap16 = function() {
var e = this.length;
if (e % 2 != 0) throw new RangeError("Buffer size must be a multiple of 16-bits");
for (var t = 0; t < e; t += 2) v(this, t, t + 1);
return this
}, c.prototype.swap32 = function() {
var e = this.length;
if (e % 4 != 0) throw new RangeError("Buffer size must be a multiple of 32-bits");
for (var t = 0; t < e; t += 4) v(this, t, t + 3), v(this, t + 1, t + 2);
return this
}, c.prototype.swap64 = function() {
var e = this.length;
if (e % 8 != 0) throw new RangeError("Buffer size must be a multiple of 64-bits");
for (var t = 0; t < e; t += 8) v(this, t, t + 7), v(this, t + 1, t + 6), v(this, t + 2, t + 5), v(this, t + 3, t + 4);
return this
}, c.prototype.toString = function() {
var e = 0 | this.length;
return 0 === e ? "" : 0 === arguments.length ? R(this, 0, e) : g.apply(this, arguments)
}, c.prototype.equals = function(e) {
if (!c.isBuffer(e)) throw new TypeError("Argument must be a Buffer");
return this === e || 0 === c.compare(this, e)
}, c.prototype.inspect = function() {
var e = "",
n = t.INSPECT_MAX_BYTES;
return this.length > 0 && (e = this.toString("hex", 0, n).match(/.{2}/g).join(" "), this.length > n && (e += " ... ")), "<Buffer " + e + ">"
}, c.prototype.compare = function(e, t, n, r, i) {
if (!c.isBuffer(e)) throw new TypeError("Argument must be a Buffer");
if (void 0 === t && (t = 0), void 0 === n && (n = e ? e.length : 0), void 0 === r && (r = 0), void 0 === i && (i = this.length), t < 0 || n > e.length || r < 0 || i > this.length) throw new RangeError("out of range index");
if (r >= i && t >= n) return 0;
if (r >= i) return -1;
if (t >= n) return 1;
if (this === e) return 0;
for (var o = (i >>>= 0) - (r >>>= 0), a = (n >>>= 0) - (t >>>= 0), s = Math.min(o, a), u = this.slice(r, i), h = e.slice(t, n), d = 0; d < s; ++d)
if (u[d] !== h[d]) {
o = u[d], a = h[d];
break
} return o < a ? -1 : a < o ? 1 : 0
}, c.prototype.includes = function(e, t, n) {
return -1 !== this.indexOf(e, t, n)
}, c.prototype.indexOf = function(e, t, n) {
return m(this, e, t, n, !0)
}, c.prototype.lastIndexOf = function(e, t, n) {
return m(this, e, t, n, !1)
}, c.prototype.write = function(e, t, n, r) {
if (void 0 === t) r = "utf8", n = this.length, t = 0;
else if (void 0 === n && "string" == typeof t) r = t, n = this.length, t = 0;
else {
if (!isFinite(t)) throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
t |= 0, isFinite(n) ? (n |= 0, void 0 === r && (r = "utf8")) : (r = n, n = void 0)
}
var i = this.length - t;
if ((void 0 === n || n > i) && (n = i), e.length > 0 && (n < 0 || t < 0) || t > this.length) throw new RangeError("Attempt to write outside buffer bounds");
r || (r = "utf8");
for (var o = !1;;) switch (r) {
case "hex":
return C(this, e, t, n);
case "utf8":
case "utf-8":
return w(this, e, t, n);
case "ascii":
return _(this, e, t, n);
case "latin1":
case "binary":
return b(this, e, t, n);
case "base64":
return E(this, e, t, n);
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return T(this, e, t, n);
default:
if (o) throw new TypeError("Unknown encoding: " + r);
r = ("" + r).toLowerCase(), o = !0
}
}, c.prototype.toJSON = function() {
return {
type: "Buffer",
data: Array.prototype.slice.call(this._arr || this, 0)
}
};

function x(e, t, n) {
var r = "";
n = Math.min(e.length, n);
for (var i = t; i < n; ++i) r += String.fromCharCode(127 & e[i]);
return r
}

function k(e, t, n) {
var r = "";
n = Math.min(e.length, n);
for (var i = t; i < n; ++i) r += String.fromCharCode(e[i]);
return r
}

function P(e, t, n) {
var r = e.length;
(!t || t < 0) && (t = 0), (!n || n < 0 || n > r) && (n = r);
for (var i = "", o = t; o < n; ++o) i += V(e[o]);
return i
}

function A(e, t, n) {
for (var r = e.slice(t, n), i = "", o = 0; o < r.length; o += 2) i += String.fromCharCode(r[o] + 256 * r[o + 1]);
return i
}

function I(e, t, n) {
if (e % 1 != 0 || e < 0) throw new RangeError("offset is not uint");
if (e + t > n) throw new RangeError("Trying to access beyond buffer length")
}

function O(e, t, n, r, i, o) {
if (!c.isBuffer(e)) throw new TypeError('"buffer" argument must be a Buffer instance');
if (t > i || t < o) throw new RangeError('"value" argument is out of bounds');
if (n + r > e.length) throw new RangeError("Index out of range")
}

function M(e, t, n, r) {
t < 0 && (t = 65535 + t + 1);
for (var i = 0, o = Math.min(e.length - n, 2); i < o; ++i) e[n + i] = (t & 255 << 8 * (r ? i : 1 - i)) >>> 8 * (r ? i : 1 - i)
}

function D(e, t, n, r) {
t < 0 && (t = 4294967295 + t + 1);
for (var i = 0, o = Math.min(e.length - n, 4); i < o; ++i) e[n + i] = t >>> 8 * (r ? i : 3 - i) & 255
}

function N(e, t, n, r, i, o) {
if (n + r > e.length) throw new RangeError("Index out of range");
if (n < 0) throw new RangeError("Index out of range")
}

function L(e, t, n, r, o) {
return o || N(e, 0, n, 4), i.write(e, t, n, r, 23, 4), n + 4
}

function j(e, t, n, r, o) {
return o || N(e, 0, n, 8), i.write(e, t, n, r, 52, 8), n + 8
}
c.prototype.slice = function(e, t) {
var n, r = this.length;
if ((e = ~~e) < 0 ? (e += r) < 0 && (e = 0) : e > r && (e = r), (t = void 0 === t ? r : ~~t) < 0 ? (t += r) < 0 && (t = 0) : t > r && (t = r), t < e && (t = e), c.TYPED_ARRAY_SUPPORT)(n = this.subarray(e, t)).__proto__ = c.prototype;
else {
var i = t - e;
n = new c(i, void 0);
for (var o = 0; o < i; ++o) n[o] = this[o + e]
}
return n
}, c.prototype.readUIntLE = function(e, t, n) {
e |= 0, t |= 0, n || I(e, t, this.length);
for (var r = this[e], i = 1, o = 0; ++o < t && (i *= 256);) r += this[e + o] * i;
return r
}, c.prototype.readUIntBE = function(e, t, n) {
e |= 0, t |= 0, n || I(e, t, this.length);
for (var r = this[e + --t], i = 1; t > 0 && (i *= 256);) r += this[e + --t] * i;
return r
}, c.prototype.readUInt8 = function(e, t) {
return t || I(e, 1, this.length), this[e]
}, c.prototype.readUInt16LE = function(e, t) {
return t || I(e, 2, this.length), this[e] | this[e + 1] << 8
}, c.prototype.readUInt16BE = function(e, t) {
return t || I(e, 2, this.length), this[e] << 8 | this[e + 1]
}, c.prototype.readUInt32LE = function(e, t) {
return t || I(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + 16777216 * this[e + 3]
}, c.prototype.readUInt32BE = function(e, t) {
return t || I(e, 4, this.length), 16777216 * this[e] + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3])
}, c.prototype.readIntLE = function(e, t, n) {
e |= 0, t |= 0, n || I(e, t, this.length);
for (var r = this[e], i = 1, o = 0; ++o < t && (i *= 256);) r += this[e + o] * i;
return r >= (i *= 128) && (r -= Math.pow(2, 8 * t)), r
}, c.prototype.readIntBE = function(e, t, n) {
e |= 0, t |= 0, n || I(e, t, this.length);
for (var r = t, i = 1, o = this[e + --r]; r > 0 && (i *= 256);) o += this[e + --r] * i;
return o >= (i *= 128) && (o -= Math.pow(2, 8 * t)), o
}, c.prototype.readInt8 = function(e, t) {
return t || I(e, 1, this.length), 128 & this[e] ? -1 * (255 - this[e] + 1) : this[e]
}, c.prototype.readInt16LE = function(e, t) {
t || I(e, 2, this.length);
var n = this[e] | this[e + 1] << 8;
return 32768 & n ? 4294901760 | n : n
}, c.prototype.readInt16BE = function(e, t) {
t || I(e, 2, this.length);
var n = this[e + 1] | this[e] << 8;
return 32768 & n ? 4294901760 | n : n
}, c.prototype.readInt32LE = function(e, t) {
return t || I(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24
}, c.prototype.readInt32BE = function(e, t) {
return t || I(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]
}, c.prototype.readFloatLE = function(e, t) {
return t || I(e, 4, this.length), i.read(this, e, !0, 23, 4)
}, c.prototype.readFloatBE = function(e, t) {
return t || I(e, 4, this.length), i.read(this, e, !1, 23, 4)
}, c.prototype.readDoubleLE = function(e, t) {
return t || I(e, 8, this.length), i.read(this, e, !0, 52, 8)
}, c.prototype.readDoubleBE = function(e, t) {
return t || I(e, 8, this.length), i.read(this, e, !1, 52, 8)
}, c.prototype.writeUIntLE = function(e, t, n, r) {
(e = +e, t |= 0, n |= 0, r) || O(this, e, t, n, Math.pow(2, 8 * n) - 1, 0);
var i = 1,
o = 0;
for (this[t] = 255 & e; ++o < n && (i *= 256);) this[t + o] = e / i & 255;
return t + n
}, c.prototype.writeUIntBE = function(e, t, n, r) {
(e = +e, t |= 0, n |= 0, r) || O(this, e, t, n, Math.pow(2, 8 * n) - 1, 0);
var i = n - 1,
o = 1;
for (this[t + i] = 255 & e; --i >= 0 && (o *= 256);) this[t + i] = e / o & 255;
return t + n
}, c.prototype.writeUInt8 = function(e, t, n) {
return e = +e, t |= 0, n || O(this, e, t, 1, 255, 0), c.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)), this[t] = 255 & e, t + 1
}, c.prototype.writeUInt16LE = function(e, t, n) {
return e = +e, t |= 0, n || O(this, e, t, 2, 65535, 0), c.TYPED_ARRAY_SUPPORT ? (this[t] = 255 & e, this[t + 1] = e >>> 8) : M(this, e, t, !0), t + 2
}, c.prototype.writeUInt16BE = function(e, t, n) {
return e = +e, t |= 0, n || O(this, e, t, 2, 65535, 0), c.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 8, this[t + 1] = 255 & e) : M(this, e, t, !1), t + 2
}, c.prototype.writeUInt32LE = function(e, t, n) {
return e = +e, t |= 0, n || O(this, e, t, 4, 4294967295, 0), c.TYPED_ARRAY_SUPPORT ? (this[t + 3] = e >>> 24, this[t + 2] = e >>> 16, this[t + 1] = e >>> 8, this[t] = 255 & e) : D(this, e, t, !0), t + 4
}, c.prototype.writeUInt32BE = function(e, t, n) {
return e = +e, t |= 0, n || O(this, e, t, 4, 4294967295, 0), c.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = 255 & e) : D(this, e, t, !1), t + 4
}, c.prototype.writeIntLE = function(e, t, n, r) {
if (e = +e, t |= 0, !r) {
var i = Math.pow(2, 8 * n - 1);
O(this, e, t, n, i - 1, -i)
}
var o = 0,
a = 1,
s = 0;
for (this[t] = 255 & e; ++o < n && (a *= 256);) e < 0 && 0 === s && 0 !== this[t + o - 1] && (s = 1), this[t + o] = (e / a >> 0) - s & 255;
return t + n
}, c.prototype.writeIntBE = function(e, t, n, r) {
if (e = +e, t |= 0, !r) {
var i = Math.pow(2, 8 * n - 1);
O(this, e, t, n, i - 1, -i)
}
var o = n - 1,
a = 1,
s = 0;
for (this[t + o] = 255 & e; --o >= 0 && (a *= 256);) e < 0 && 0 === s && 0 !== this[t + o + 1] && (s = 1), this[t + o] = (e / a >> 0) - s & 255;
return t + n
}, c.prototype.writeInt8 = function(e, t, n) {
return e = +e, t |= 0, n || O(this, e, t, 1, 127, -128), c.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)), e < 0 && (e = 255 + e + 1), this[t] = 255 & e, t + 1
}, c.prototype.writeInt16LE = function(e, t, n) {
return e = +e, t |= 0, n || O(this, e, t, 2, 32767, -32768), c.TYPED_ARRAY_SUPPORT ? (this[t] = 255 & e, this[t + 1] = e >>> 8) : M(this, e, t, !0), t + 2
}, c.prototype.writeInt16BE = function(e, t, n) {
return e = +e, t |= 0, n || O(this, e, t, 2, 32767, -32768), c.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 8, this[t + 1] = 255 & e) : M(this, e, t, !1), t + 2
}, c.prototype.writeInt32LE = function(e, t, n) {
return e = +e, t |= 0, n || O(this, e, t, 4, 2147483647, -2147483648), c.TYPED_ARRAY_SUPPORT ? (this[t] = 255 & e, this[t + 1] = e >>> 8, this[t + 2] = e >>> 16, this[t + 3] = e >>> 24) : D(this, e, t, !0), t + 4
}, c.prototype.writeInt32BE = function(e, t, n) {
return e = +e, t |= 0, n || O(this, e, t, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 + e + 1), c.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = 255 & e) : D(this, e, t, !1), t + 4
}, c.prototype.writeFloatLE = function(e, t, n) {
return L(this, e, t, !0, n)
}, c.prototype.writeFloatBE = function(e, t, n) {
return L(this, e, t, !1, n)
}, c.prototype.writeDoubleLE = function(e, t, n) {
return j(this, e, t, !0, n)
}, c.prototype.writeDoubleBE = function(e, t, n) {
return j(this, e, t, !1, n)
}, c.prototype.copy = function(e, t, n, r) {
if (n || (n = 0), r || 0 === r || (r = this.length), t >= e.length && (t = e.length), t || (t = 0), r > 0 && r < n && (r = n), r === n) return 0;
if (0 === e.length || 0 === this.length) return 0;
if (t < 0) throw new RangeError("targetStart out of bounds");
if (n < 0 || n >= this.length) throw new RangeError("sourceStart out of bounds");
if (r < 0) throw new RangeError("sourceEnd out of bounds");
r > this.length && (r = this.length), e.length - t < r - n && (r = e.length - t + n);
var i, o = r - n;
if (this === e && n < t && t < r)
for (i = o - 1; i >= 0; --i) e[i + t] = this[i + n];
else if (o < 1e3 || !c.TYPED_ARRAY_SUPPORT)
for (i = 0; i < o; ++i) e[i + t] = this[i + n];
else Uint8Array.prototype.set.call(e, this.subarray(n, n + o), t);
return o
}, c.prototype.fill = function(e, t, n, r) {
if ("string" == typeof e) {
if ("string" == typeof t ? (r = t, t = 0, n = this.length) : "string" == typeof n && (r = n, n = this.length), 1 === e.length) {
var i = e.charCodeAt(0);
i < 256 && (e = i)
}
if (void 0 !== r && "string" != typeof r) throw new TypeError("encoding must be a string");
if ("string" == typeof r && !c.isEncoding(r)) throw new TypeError("Unknown encoding: " + r)
} else "number" == typeof e && (e &= 255);
if (t < 0 || this.length < t || this.length < n) throw new RangeError("Out of range index");
if (n <= t) return this;
var o;
if (t >>>= 0, n = void 0 === n ? this.length : n >>> 0, e || (e = 0), "number" == typeof e)
for (o = t; o < n; ++o) this[o] = e;
else {
var a = c.isBuffer(e) ? e : B(new c(e, r).toString()),
s = a.length;
for (o = 0; o < n - t; ++o) this[o + t] = a[o % s]
}
return this
};
var F = /[^+\/0-9A-Za-z-_]/g;

function V(e) {
return e < 16 ? "0" + e.toString(16) : e.toString(16)
}

function B(e, t) {
var n;
t = t || 1 / 0;
for (var r = e.length, i = null, o = [], a = 0; a < r; ++a) {
if ((n = e.charCodeAt(a)) > 55295 && n < 57344) {
if (!i) {
if (n > 56319) {
(t -= 3) > -1 && o.push(239, 191, 189);
continue
}
if (a + 1 === r) {
(t -= 3) > -1 && o.push(239, 191, 189);
continue
}
i = n;
continue
}
if (n < 56320) {
(t -= 3) > -1 && o.push(239, 191, 189), i = n;
continue
}
n = 65536 + (i - 55296 << 10 | n - 56320)
} else i && (t -= 3) > -1 && o.push(239, 191, 189);
if (i = null, n < 128) {
if ((t -= 1) < 0) break;
o.push(n)
} else if (n < 2048) {
if ((t -= 2) < 0) break;
o.push(n >> 6 | 192, 63 & n | 128)
} else if (n < 65536) {
if ((t -= 3) < 0) break;
o.push(n >> 12 | 224, n >> 6 & 63 | 128, 63 & n | 128)
} else {
if (!(n < 1114112)) throw new Error("Invalid code point");
if ((t -= 4) < 0) break;
o.push(n >> 18 | 240, n >> 12 & 63 | 128, n >> 6 & 63 | 128, 63 & n | 128)
}
}
return o
}

function U(e) {
return r.toByteArray(function(e) {
if ((e = function(e) {
return e.trim ? e.trim() : e.replace(/^\s+|\s+$/g, "")
}(e).replace(F, "")).length < 2) return "";
for (; e.length % 4 != 0;) e += "=";
return e
}(e))
}

function W(e, t, n, r) {
for (var i = 0; i < r && !(i + n >= t.length || i >= e.length); ++i) t[i + n] = e[i];
return i
}
}).call(this, n(54))
}, function(e, t, n) {
(function(r) {
function i() {
var e;
try {
e = t.storage.debug
} catch (e) {}
return !e && void 0 !== r && "env" in r && (e = r.env.DEBUG), e
}(t = e.exports = n(62)).log = function() {
return "object" == typeof console && console.log && Function.prototype.apply.call(console.log, console, arguments)
}, t.formatArgs = function(e) {
var n = this.useColors;
if (e[0] = (n ? "%c" : "") + this.namespace + (n ? " %c" : " ") + e[0] + (n ? "%c " : " ") + "+" + t.humanize(this.diff), !n) return;
var r = "color: " + this.color;
e.splice(1, 0, r, "color: inherit");
var i = 0,
o = 0;
e[0].replace(/%[a-zA-Z%]/g, (function(e) {
"%%" !== e && (i++, "%c" === e && (o = i))
})), e.splice(o, 0, r)
}, t.save = function(e) {
try {
null == e ? t.storage.removeItem("debug") : t.storage.debug = e
} catch (e) {}
}, t.load = i, t.useColors = function() {
if ("undefined" != typeof window && window.process && "renderer" === window.process.type) return !0;
if ("undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return !1;
return "undefined" != typeof document && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || "undefined" != typeof window && window.console && (window.console.firebug || window.console.exception && window.console.table) || "undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || "undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)
}, t.storage = "undefined" != typeof chrome && void 0 !== chrome.storage ? chrome.storage.local : function() {
try {
return window.localStorage
} catch (e) {}
}(), t.colors = ["#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33"], t.formatters.j = function(e) {
try {
return JSON.stringify(e)
} catch (e) {
return "[UnexpectedJSONParseError]: " + e.message
}
}, t.enable(i())
}).call(this, n(10))
}, function(e, t) {
t.encode = function(e) {
var t = "";
for (var n in e) e.hasOwnProperty(n) && (t.length && (t += "&"), t += encodeURIComponent(n) + "=" + encodeURIComponent(e[n]));
return t
}, t.decode = function(e) {
for (var t = {}, n = e.split("&"), r = 0, i = n.length; r < i; r++) {
var o = n[r].split("=");
t[decodeURIComponent(o[0])] = decodeURIComponent(o[1])
}
return t
}
}, function(e, t) {
e.exports = function(e, t) {
var n = function() {};
n.prototype = t.prototype, e.prototype = new n, e.prototype.constructor = e
}
}, function(e, t, n) {
(function(r) {
function i() {
var e;
try {
e = t.storage.debug
} catch (e) {}
return !e && void 0 !== r && "env" in r && (e = r.env.DEBUG), e
}(t = e.exports = n(81)).log = function() {
return "object" == typeof console && console.log && Function.prototype.apply.call(console.log, console, arguments)
}, t.formatArgs = function(e) {
var n = this.useColors;
if (e[0] = (n ? "%c" : "") + this.namespace + (n ? " %c" : " ") + e[0] + (n ? "%c " : " ") + "+" + t.humanize(this.diff), !n) return;
var r = "color: " + this.color;
e.splice(1, 0, r, "color: inherit");
var i = 0,
o = 0;
e[0].replace(/%[a-zA-Z%]/g, (function(e) {
"%%" !== e && (i++, "%c" === e && (o = i))
})), e.splice(o, 0, r)
}, t.save = function(e) {
try {
null == e ? t.storage.removeItem("debug") : t.storage.debug = e
} catch (e) {}
}, t.load = i, t.useColors = function() {
if ("undefined" != typeof window && window.process && "renderer" === window.process.type) return !0;
if ("undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return !1;
return "undefined" != typeof document && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || "undefined" != typeof window && window.console && (window.console.firebug || window.console.exception && window.console.table) || "undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || "undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)
}, t.storage = "undefined" != typeof chrome && void 0 !== chrome.storage ? chrome.storage.local : function() {
try {
return window.localStorage
} catch (e) {}
}(), t.colors = ["#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33"], t.formatters.j = function(e) {
try {
return JSON.stringify(e)
} catch (e) {
return "[UnexpectedJSONParseError]: " + e.message
}
}, t.enable(i())
}).call(this, n(10))
}, function(e, t, n) {
var r, i, o, a, s, c;
e.exports = (c = n(0), i = (r = c).lib, o = i.Base, a = i.WordArray, (s = r.x64 = {}).Word = o.extend({
init: function(e, t) {
this.high = e, this.low = t
}
}), s.WordArray = o.extend({
init: function(e, t) {
e = this.words = e || [], this.sigBytes = null != t ? t : 8 * e.length
},
toX32: function() {
for (var e = this.words, t = e.length, n = [], r = 0; r < t; r++) {
var i = e[r];
n.push(i.high), n.push(i.low)
}
return a.create(n, this.sigBytes)
},
clone: function() {
for (var e = o.clone.call(this), t = e.words = this.words.slice(0), n = t.length, r = 0; r < n; r++) t[r] = t[r].clone();
return e
}
}), c)
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.promise = t.cb = t.namespaces = t.getLogger = t.enable = t.disable = void 0;
const r = n(50);
var i = n(50);
Object.defineProperty(t, "disable", {
enumerable: !0,
get: function() {
return i.disable
}
}), Object.defineProperty(t, "enable", {
enumerable: !0,
get: function() {
return i.enable
}
});
const o = {},
a = {};

function s(e) {
let t = ["log", "info", "warn", "error", "debug", "trace"].reduce((t, n) => (t[n] = function(e, t) {
const n = r("".concat(e.ns, ":").concat(t));
if (e.context) {
return new Proxy(n, {
apply: function(t, n, r) {
const [i, ...o] = r;
return t.call(n, "".concat(e.context, " ").concat(i), ...o)
}
})
}
return n
}(e, n), t), {});
if ("object" == typeof window && "object" == typeof window.console) try {
t.log.log = window.console.log.bind(window.console), t.info.log = window.console.info.bind(window.console), t.warn.log = window.console.warn.bind(window.console), t.error.log = window.console.error.bind(window.console), t.debug.log = (window.console.debug ? window.console.debug : window.console.log).bind(window.console), t.trace.log = (window.console.trace ? window.console.trace : window.console.log).bind(window.console)
} catch (e) {}
return t
}

function c(e, t, n) {
const r = "string" == typeof e ? {
ns: e,
context: t,
cache: n
} : e;
let i;
if (!1 === r.cache) i = s(r);
else {
let e = r.context ? "".concat(r.ns, "@@").concat(r.context) : r.ns;
a[e] || (o[r.ns] = !0, a[e] = s(r)), i = a[e]
}
return i
}
t.getLogger = c, t.namespaces = function() {
return Object.keys(o)
}, t.cb = function(e = "") {
const t = c(e);
return (e, n) => {
e ? t.error(e) : t.info(n)
}
}, t.promise = function(e, t = "") {
const n = c(t);
return e.then((function(e) {
n.info(e)
}), (function(e) {
n.error(e)
}))
}
}, function(e, t, n) {
var r = n(64)("socket.io-parser"),
i = n(5),
o = n(67),
a = n(20),
s = n(31);

function c() {}
t.protocol = 4, t.types = ["CONNECT", "DISCONNECT", "EVENT", "ACK", "ERROR", "BINARY_EVENT", "BINARY_ACK"], t.CONNECT = 0, t.DISCONNECT = 1, t.EVENT = 2, t.ACK = 3, t.ERROR = 4, t.BINARY_EVENT = 5, t.BINARY_ACK = 6, t.Encoder = c, t.Decoder = d;
var u = t.ERROR + '"encode error"';

function h(e) {
var n = "" + e.type;
if (t.BINARY_EVENT !== e.type && t.BINARY_ACK !== e.type || (n += e.attachments + "-"), e.nsp && "/" !== e.nsp && (n += e.nsp + ","), null != e.id && (n += e.id), null != e.data) {
var i = function(e) {
try {
return JSON.stringify(e)
} catch (e) {
return !1
}
}(e.data);
if (!1 === i) return u;
n += i
}
return r("encoded %j as %s", e, n), n
}

function d() {
this.reconstructor = null
}

function l(e) {
this.reconPack = e, this.buffers = []
}

function f(e) {
return {
type: t.ERROR,
data: "parser error: " + e
}
}
c.prototype.encode = function(e, n) {
(r("encoding packet %j", e), t.BINARY_EVENT === e.type || t.BINARY_ACK === e.type) ? function(e, t) {
o.removeBlobs(e, (function(e) {
var n = o.deconstructPacket(e),
r = h(n.packet),
i = n.buffers;
i.unshift(r), t(i)
}))
}(e, n) : n([h(e)])
}, i(d.prototype), d.prototype.add = function(e) {
var n;
if ("string" == typeof e) n = function(e) {
var n = 0,
i = {
type: Number(e.charAt(0))
};
if (null == t.types[i.type]) return f("unknown packet type " + i.type);
if (t.BINARY_EVENT === i.type || t.BINARY_ACK === i.type) {
for (var o = n + 1;
"-" !== e.charAt(++n) && n != e.length;);
var s = e.substring(o, n);
if (s != Number(s) || "-" !== e.charAt(n)) throw new Error("Illegal attachments");
i.attachments = Number(s)
}
if ("/" === e.charAt(n + 1)) {
for (o = n + 1; ++n;) {
if ("," === (u = e.charAt(n))) break;
if (n === e.length) break
}
i.nsp = e.substring(o, n)
} else i.nsp = "/";
var c = e.charAt(n + 1);
if ("" !== c && Number(c) == c) {
for (o = n + 1; ++n;) {
var u;
if (null == (u = e.charAt(n)) || Number(u) != u) {
--n;
break
}
if (n === e.length) break
}
i.id = Number(e.substring(o, n + 1))
}
if (e.charAt(++n)) {
var h = function(e) {
try {
return JSON.parse(e)
} catch (e) {
return !1
}
}(e.substr(n));
if (!(!1 !== h && (i.type === t.ERROR || a(h)))) return f("invalid payload");
i.data = h
}
return r("decoded %s as %j", e, i), i
}(e), t.BINARY_EVENT === n.type || t.BINARY_ACK === n.type ? (this.reconstructor = new l(n), 0 === this.reconstructor.reconPack.attachments && this.emit("decoded", n)) : this.emit("decoded", n);
else {
if (!s(e) && !e.base64) throw new Error("Unknown type: " + e);
if (!this.reconstructor) throw new Error("got binary data when not reconstructing a packet");
(n = this.reconstructor.takeBinaryData(e)) && (this.reconstructor = null, this.emit("decoded", n))
}
}, d.prototype.destroy = function() {
this.reconstructor && this.reconstructor.finishedReconstruction()
}, l.prototype.takeBinaryData = function(e) {
if (this.buffers.push(e), this.buffers.length === this.reconPack.attachments) {
var t = o.reconstructPacket(this.reconPack, this.buffers);
return this.finishedReconstruction(), t
}
return null
}, l.prototype.finishedReconstruction = function() {
this.reconPack = null, this.buffers = []
}
}, function(e, t) {
var n = {}.toString;
e.exports = Array.isArray || function(e) {
return "[object Array]" == n.call(e)
}
}, function(e, t, n) {
var r = n(73),
i = n(22);
e.exports = function(e) {
var t = e.xdomain,
n = e.xscheme,
o = e.enablesXDR;
try {
if ("undefined" != typeof XMLHttpRequest && (!t || r)) return new XMLHttpRequest
} catch (e) {}
try {
if ("undefined" != typeof XDomainRequest && !n && o) return new XDomainRequest
} catch (e) {}
if (!t) try {
return new(i[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")
} catch (e) {}
}
}, function(e, t) {
e.exports = "undefined" != typeof self ? self : "undefined" != typeof window ? window : Function("return this")()
}, function(e, t, n) {
var r = n(6),
i = n(5);

function o(e) {
this.path = e.path, this.hostname = e.hostname, this.port = e.port, this.secure = e.secure, this.query = e.query, this.timestampParam = e.timestampParam, this.timestampRequests = e.timestampRequests, this.readyState = "", this.agent = e.agent || !1, this.socket = e.socket, this.enablesXDR = e.enablesXDR, this.withCredentials = e.withCredentials, this.pfx = e.pfx, this.key = e.key, this.passphrase = e.passphrase, this.cert = e.cert, this.ca = e.ca, this.ciphers = e.ciphers, this.rejectUnauthorized = e.rejectUnauthorized, this.forceNode = e.forceNode, this.isReactNative = e.isReactNative, this.extraHeaders = e.extraHeaders, this.localAddress = e.localAddress
}
e.exports = o, i(o.prototype), o.prototype.onError = function(e, t) {
var n = new Error(e);
return n.type = "TransportError", n.description = t, this.emit("error", n), this
}, o.prototype.open = function() {
return "closed" !== this.readyState && "" !== this.readyState || (this.readyState = "opening", this.doOpen()), this
}, o.prototype.close = function() {
return "opening" !== this.readyState && "open" !== this.readyState || (this.doClose(), this.onClose()), this
}, o.prototype.send = function(e) {
if ("open" !== this.readyState) throw new Error("Transport not open");
this.write(e)
}, o.prototype.onOpen = function() {
this.readyState = "open", this.writable = !0, this.emit("open")
}, o.prototype.onData = function(e) {
var t = r.decodePacket(e, this.socket.binaryType);
this.onPacket(t)
}, o.prototype.onPacket = function(e) {
this.emit("packet", e)
}, o.prototype.onClose = function() {
this.readyState = "closed", this.emit("close")
}
}, function(e, t, n) {
var r, i, o, a, s, c, u, h;
e.exports = (h = n(0), i = (r = h).lib, o = i.WordArray, a = i.Hasher, s = r.algo, c = [], u = s.SHA1 = a.extend({
_doReset: function() {
this._hash = new o.init([1732584193, 4023233417, 2562383102, 271733878, 3285377520])
},
_doProcessBlock: function(e, t) {
for (var n = this._hash.words, r = n[0], i = n[1], o = n[2], a = n[3], s = n[4], u = 0; u < 80; u++) {
if (u < 16) c[u] = 0 | e[t + u];
else {
var h = c[u - 3] ^ c[u - 8] ^ c[u - 14] ^ c[u - 16];
c[u] = h << 1 | h >>> 31
}
var d = (r << 5 | r >>> 27) + s + c[u];
d += u < 20 ? 1518500249 + (i & o | ~i & a) : u < 40 ? 1859775393 + (i ^ o ^ a) : u < 60 ? (i & o | i & a | o & a) - 1894007588 : (i ^ o ^ a) - 899497514, s = a, a = o, o = i << 30 | i >>> 2, i = r, r = d
}
n[0] = n[0] + r | 0, n[1] = n[1] + i | 0, n[2] = n[2] + o | 0, n[3] = n[3] + a | 0, n[4] = n[4] + s | 0
},
_doFinalize: function() {
var e = this._data,
t = e.words,
n = 8 * this._nDataBytes,
r = 8 * e.sigBytes;
return t[r >>> 5] |= 128 << 24 - r % 32, t[14 + (r + 64 >>> 9 << 4)] = Math.floor(n / 4294967296), t[15 + (r + 64 >>> 9 << 4)] = n, e.sigBytes = 4 * t.length, this._process(), this._hash
},
clone: function() {
var e = a.clone.call(this);
return e._hash = this._hash.clone(), e
}
}), r.SHA1 = a._createHelper(u), r.HmacSHA1 = a._createHmacHelper(u), h.SHA1)
}, function(e, t, n) {
var r, i, o, a;
e.exports = (r = n(0), o = (i = r).lib.Base, a = i.enc.Utf8, void(i.algo.HMAC = o.extend({
init: function(e, t) {
e = this._hasher = new e.init, "string" == typeof t && (t = a.parse(t));
var n = e.blockSize,
r = 4 * n;
t.sigBytes > r && (t = e.finalize(t)), t.clamp();
for (var i = this._oKey = t.clone(), o = this._iKey = t.clone(), s = i.words, c = o.words, u = 0; u < n; u++) s[u] ^= 1549556828, c[u] ^= 909522486;
i.sigBytes = o.sigBytes = r, this.reset()
},
reset: function() {
var e = this._hasher;
e.reset(), e.update(this._iKey)
},
update: function(e) {
return this._hasher.update(e), this
},
finalize: function(e) {
var t = this._hasher,
n = t.finalize(e);
return t.reset(), t.finalize(this._oKey.clone().concat(n))
}
})))
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.nodeify = t.query = t.cookie = t.param = t.extend = t.dot = t.FetchError = void 0;
class r extends Error {
constructor(e, t) {
super(e.statusText), this.response = e, this.err = t
}
}
t.FetchError = r, t.dot = function(e, t, n, r) {
if (!e) return;
let i, o = t ? t.split(".") : [],
a = e;
if (void 0 === n) {
let e, t;
for (e = 0, t = o.length; void 0 !== a && e < t; e++) try {
i = a, a = a[o[e]]
} catch (e) {
return
}
a && r && delete i[o[e - 1]]
} else {
let e, t, r;
for (e = 0, t = o.length - 1, r = null; r = o[e], e < t; e++) "object" != typeof a[r] && (a[r] = /\d/.test(o[e + 1]) ? [] : {}), a = a[r];
a[r] = n, a = a[r]
}
return a
}, t.extend = function e(t, n) {
var r;
if (arguments.length > 2)
for (var i = 1; i < arguments.length; i++) e(t, arguments[i]);
else
for (r in n) n.hasOwnProperty(r) && (t[r] = n[r]);
return t
}, t.param = function(e) {
let t, n = [];
for (t in e) e.hasOwnProperty(t) && n.push(t + "=" + encodeURIComponent(e[t]));
return n.join("&")
}, t.cookie = function(e, t, n) {
if (arguments.length > 1 && "[object Object]" !== String(t)) {
if (void 0 === (n = this.extend(n)).domain && void 0 !== vivocha.domain && (n.domain = vivocha.domain), null == t && (n.expires = -1), "number" == typeof n.expires) {
var r = n.expires,
i = n.expires = new Date;
i.setDate(i.getDate() + r)
}
return t = String(t), document.cookie = [encodeURIComponent(e), "=", n.raw ? t : encodeURIComponent(t), n.expires ? "; expires=" + n.expires.toUTCString() : "", n.path ? "; path=" + n.path : "", n.domain ? "; domain=" + n.domain : "", n.sameSite ? "; SameSite=" + n.sameSite : "", n.secure ? "; secure" : ""].join("")
}
var o, a = (n = t || {}).raw ? function(e) {
return e
} : decodeURIComponent;
return (o = new RegExp("(?:^|; )" + encodeURIComponent(e) + "=([^;]*)").exec(document.cookie)) ? a(o[1]) : null
}, t.query = function(e) {
let t = e.split("&"),
n = {};
for (let e = 0; e < t.length; e++) {
let r = t[e].split("=");
n[decodeURIComponent(r[0])] = decodeURIComponent(r[1])
}
return n
}, t.nodeify = function(e, t) {
return "function" == typeof e.then && "function" != typeof e.nodeify && (e.nodeify = function(e) {
if (!e) return this;
this.then((function(t) {
var n = Array.prototype.slice.call(arguments);
n.unshift(void 0), e.apply(this, n)
}), (function(t) {
e(t)
}))
}), t && e.nodeify(t), e
}
}, function(e, t, n) {
"use strict";
var r = {
generateIdentifier: function() {
return Math.random().toString(36).substr(2, 10)
}
};
r.localCName = r.generateIdentifier(), r.splitLines = function(e) {
return e.trim().split("\n").map((function(e) {
return e.trim()
}))
}, r.splitSections = function(e) {
return e.split("\nm=").map((function(e, t) {
return (t > 0 ? "m=" + e : e).trim() + "\r\n"
}))
}, r.getDescription = function(e) {
var t = r.splitSections(e);
return t && t[0]
}, r.getMediaSections = function(e) {
var t = r.splitSections(e);
return t.shift(), t
}, r.matchPrefix = function(e, t) {
return r.splitLines(e).filter((function(e) {
return 0 === e.indexOf(t)
}))
}, r.parseCandidate = function(e) {
for (var t, n = {
foundation: (t = 0 === e.indexOf("a=candidate:") ? e.substring(12).split(" ") : e.substring(10).split(" "))[0],
component: parseInt(t[1], 10),
protocol: t[2].toLowerCase(),
priority: parseInt(t[3], 10),
ip: t[4],
address: t[4],
port: parseInt(t[5], 10),
type: t[7]
}, r = 8; r < t.length; r += 2) switch (t[r]) {
case "raddr":
n.relatedAddress = t[r + 1];
break;
case "rport":
n.relatedPort = parseInt(t[r + 1], 10);
break;
case "tcptype":
n.tcpType = t[r + 1];
break;
case "ufrag":
n.ufrag = t[r + 1], n.usernameFragment = t[r + 1];
break;
default:
n[t[r]] = t[r + 1]
}
return n
}, r.writeCandidate = function(e) {
var t = [];
t.push(e.foundation), t.push(e.component), t.push(e.protocol.toUpperCase()), t.push(e.priority), t.push(e.address || e.ip), t.push(e.port);
var n = e.type;
return t.push("typ"), t.push(n), "host" !== n && e.relatedAddress && e.relatedPort && (t.push("raddr"), t.push(e.relatedAddress), t.push("rport"), t.push(e.relatedPort)), e.tcpType && "tcp" === e.protocol.toLowerCase() && (t.push("tcptype"), t.push(e.tcpType)), (e.usernameFragment || e.ufrag) && (t.push("ufrag"), t.push(e.usernameFragment || e.ufrag)), "candidate:" + t.join(" ")
}, r.parseIceOptions = function(e) {
return e.substr(14).split(" ")
}, r.parseRtpMap = function(e) {
var t = e.substr(9).split(" "),
n = {
payloadType: parseInt(t.shift(), 10)
};
return t = t[0].split("/"), n.name = t[0], n.clockRate = parseInt(t[1], 10), n.channels = 3 === t.length ? parseInt(t[2], 10) : 1, n.numChannels = n.channels, n
}, r.writeRtpMap = function(e) {
var t = e.payloadType;
void 0 !== e.preferredPayloadType && (t = e.preferredPayloadType);
var n = e.channels || e.numChannels || 1;
return "a=rtpmap:" + t + " " + e.name + "/" + e.clockRate + (1 !== n ? "/" + n : "") + "\r\n"
}, r.parseExtmap = function(e) {
var t = e.substr(9).split(" ");
return {
id: parseInt(t[0], 10),
direction: t[0].indexOf("/") > 0 ? t[0].split("/")[1] : "sendrecv",
uri: t[1]
}
}, r.writeExtmap = function(e) {
return "a=extmap:" + (e.id || e.preferredId) + (e.direction && "sendrecv" !== e.direction ? "/" + e.direction : "") + " " + e.uri + "\r\n"
}, r.parseFmtp = function(e) {
for (var t, n = {}, r = e.substr(e.indexOf(" ") + 1).split(";"), i = 0; i < r.length; i++) n[(t = r[i].trim().split("="))[0].trim()] = t[1];
return n
}, r.writeFmtp = function(e) {
var t = "",
n = e.payloadType;
if (void 0 !== e.preferredPayloadType && (n = e.preferredPayloadType), e.parameters && Object.keys(e.parameters).length) {
var r = [];
Object.keys(e.parameters).forEach((function(t) {
e.parameters[t] ? r.push(t + "=" + e.parameters[t]) : r.push(t)
})), t += "a=fmtp:" + n + " " + r.join(";") + "\r\n"
}
return t
}, r.parseRtcpFb = function(e) {
var t = e.substr(e.indexOf(" ") + 1).split(" ");
return {
type: t.shift(),
parameter: t.join(" ")
}
}, r.writeRtcpFb = function(e) {
var t = "",
n = e.payloadType;
return void 0 !== e.preferredPayloadType && (n = e.preferredPayloadType), e.rtcpFeedback && e.rtcpFeedback.length && e.rtcpFeedback.forEach((function(e) {
t += "a=rtcp-fb:" + n + " " + e.type + (e.parameter && e.parameter.length ? " " + e.parameter : "") + "\r\n"
})), t
}, r.parseSsrcMedia = function(e) {
var t = e.indexOf(" "),
n = {
ssrc: parseInt(e.substr(7, t - 7), 10)
},
r = e.indexOf(":", t);
return r > -1 ? (n.attribute = e.substr(t + 1, r - t - 1), n.value = e.substr(r + 1)) : n.attribute = e.substr(t + 1), n
}, r.parseSsrcGroup = function(e) {
var t = e.substr(13).split(" ");
return {
semantics: t.shift(),
ssrcs: t.map((function(e) {
return parseInt(e, 10)
}))
}
}, r.getMid = function(e) {
var t = r.matchPrefix(e, "a=mid:")[0];
if (t) return t.substr(6)
}, r.parseFingerprint = function(e) {
var t = e.substr(14).split(" ");
return {
algorithm: t[0].toLowerCase(),
value: t[1]
}
}, r.getDtlsParameters = function(e, t) {
return {
role: "auto",
fingerprints: r.matchPrefix(e + t, "a=fingerprint:").map(r.parseFingerprint)
}
}, r.writeDtlsParameters = function(e, t) {
var n = "a=setup:" + t + "\r\n";
return e.fingerprints.forEach((function(e) {
n += "a=fingerprint:" + e.algorithm + " " + e.value + "\r\n"
})), n
}, r.parseCryptoLine = function(e) {
var t = e.substr(9).split(" ");
return {
tag: parseInt(t[0], 10),
cryptoSuite: t[1],
keyParams: t[2],
sessionParams: t.slice(3)
}
}, r.writeCryptoLine = function(e) {
return "a=crypto:" + e.tag + " " + e.cryptoSuite + " " + ("object" == typeof e.keyParams ? r.writeCryptoKeyParams(e.keyParams) : e.keyParams) + (e.sessionParams ? " " + e.sessionParams.join(" ") : "") + "\r\n"
}, r.parseCryptoKeyParams = function(e) {
if (0 !== e.indexOf("inline:")) return null;
var t = e.substr(7).split("|");
return {
keyMethod: "inline",
keySalt: t[0],
lifeTime: t[1],
mkiValue: t[2] ? t[2].split(":")[0] : void 0,
mkiLength: t[2] ? t[2].split(":")[1] : void 0
}
}, r.writeCryptoKeyParams = function(e) {
return e.keyMethod + ":" + e.keySalt + (e.lifeTime ? "|" + e.lifeTime : "") + (e.mkiValue && e.mkiLength ? "|" + e.mkiValue + ":" + e.mkiLength : "")
}, r.getCryptoParameters = function(e, t) {
return r.matchPrefix(e + t, "a=crypto:").map(r.parseCryptoLine)
}, r.getIceParameters = function(e, t) {
var n = r.matchPrefix(e + t, "a=ice-ufrag:")[0],
i = r.matchPrefix(e + t, "a=ice-pwd:")[0];
return n && i ? {
usernameFragment: n.substr(12),
password: i.substr(10)
} : null
}, r.writeIceParameters = function(e) {
return "a=ice-ufrag:" + e.usernameFragment + "\r\na=ice-pwd:" + e.password + "\r\n"
}, r.parseRtpParameters = function(e) {
for (var t = {
codecs: [],
headerExtensions: [],
fecMechanisms: [],
rtcp: []
}, n = r.splitLines(e)[0].split(" "), i = 3; i < n.length; i++) {
var o = n[i],
a = r.matchPrefix(e, "a=rtpmap:" + o + " ")[0];
if (a) {
var s = r.parseRtpMap(a),
c = r.matchPrefix(e, "a=fmtp:" + o + " ");
switch (s.parameters = c.length ? r.parseFmtp(c[0]) : {}, s.rtcpFeedback = r.matchPrefix(e, "a=rtcp-fb:" + o + " ").map(r.parseRtcpFb), t.codecs.push(s), s.name.toUpperCase()) {
case "RED":
case "ULPFEC":
t.fecMechanisms.push(s.name.toUpperCase())
}
}
}
return r.matchPrefix(e, "a=extmap:").forEach((function(e) {
t.headerExtensions.push(r.parseExtmap(e))
})), t
}, r.writeRtpDescription = function(e, t) {
var n = "";
n += "m=" + e + " ", n += t.codecs.length > 0 ? "9" : "0", n += " UDP/TLS/RTP/SAVPF ", n += t.codecs.map((function(e) {
return void 0 !== e.preferredPayloadType ? e.preferredPayloadType : e.payloadType
})).join(" ") + "\r\n", n += "c=IN IP4 0.0.0.0\r\n", n += "a=rtcp:9 IN IP4 0.0.0.0\r\n", t.codecs.forEach((function(e) {
n += r.writeRtpMap(e), n += r.writeFmtp(e), n += r.writeRtcpFb(e)
}));
var i = 0;
return t.codecs.forEach((function(e) {
e.maxptime > i && (i = e.maxptime)
})), i > 0 && (n += "a=maxptime:" + i + "\r\n"), n += "a=rtcp-mux\r\n", t.headerExtensions && t.headerExtensions.forEach((function(e) {
n += r.writeExtmap(e)
})), n
}, r.parseRtpEncodingParameters = function(e) {
var t, n = [],
i = r.parseRtpParameters(e),
o = -1 !== i.fecMechanisms.indexOf("RED"),
a = -1 !== i.fecMechanisms.indexOf("ULPFEC"),
s = r.matchPrefix(e, "a=ssrc:").map((function(e) {
return r.parseSsrcMedia(e)
})).filter((function(e) {
return "cname" === e.attribute
})),
c = s.length > 0 && s[0].ssrc,
u = r.matchPrefix(e, "a=ssrc-group:FID").map((function(e) {
return e.substr(17).split(" ").map((function(e) {
return parseInt(e, 10)
}))
}));
u.length > 0 && u[0].length > 1 && u[0][0] === c && (t = u[0][1]), i.codecs.forEach((function(e) {
if ("RTX" === e.name.toUpperCase() && e.parameters.apt) {
var r = {
ssrc: c,
codecPayloadType: parseInt(e.parameters.apt, 10)
};
c && t && (r.rtx = {
ssrc: t
}), n.push(r), o && ((r = JSON.parse(JSON.stringify(r))).fec = {
ssrc: c,
mechanism: a ? "red+ulpfec" : "red"
}, n.push(r))
}
})), 0 === n.length && c && n.push({
ssrc: c
});
var h = r.matchPrefix(e, "b=");
return h.length && (h = 0 === h[0].indexOf("b=TIAS:") ? parseInt(h[0].substr(7), 10) : 0 === h[0].indexOf("b=AS:") ? 1e3 * parseInt(h[0].substr(5), 10) * .95 - 16e3 : void 0, n.forEach((function(e) {
e.maxBitrate = h
}))), n
}, r.parseRtcpParameters = function(e) {
var t = {},
n = r.matchPrefix(e, "a=ssrc:").map((function(e) {
return r.parseSsrcMedia(e)
})).filter((function(e) {
return "cname" === e.attribute
}))[0];
n && (t.cname = n.value, t.ssrc = n.ssrc);
var i = r.matchPrefix(e, "a=rtcp-rsize");
t.reducedSize = i.length > 0, t.compound = 0 === i.length;
var o = r.matchPrefix(e, "a=rtcp-mux");
return t.mux = o.length > 0, t
}, r.parseMsid = function(e) {
var t, n = r.matchPrefix(e, "a=msid:");
if (1 === n.length) return {
stream: (t = n[0].substr(7).split(" "))[0],
track: t[1]
};
var i = r.matchPrefix(e, "a=ssrc:").map((function(e) {
return r.parseSsrcMedia(e)
})).filter((function(e) {
return "msid" === e.attribute
}));
return i.length > 0 ? {
stream: (t = i[0].value.split(" "))[0],
track: t[1]
} : void 0
}, r.parseSctpDescription = function(e) {
var t, n = r.parseMLine(e),
i = r.matchPrefix(e, "a=max-message-size:");
i.length > 0 && (t = parseInt(i[0].substr(19), 10)), isNaN(t) && (t = 65536);
var o = r.matchPrefix(e, "a=sctp-port:");
if (o.length > 0) return {
port: parseInt(o[0].substr(12), 10),
protocol: n.fmt,
maxMessageSize: t
};
if (r.matchPrefix(e, "a=sctpmap:").length > 0) {
var a = r.matchPrefix(e, "a=sctpmap:")[0].substr(10).split(" ");
return {
port: parseInt(a[0], 10),
protocol: a[1],
maxMessageSize: t
}
}
}, r.writeSctpDescription = function(e, t) {
var n = [];
return n = "DTLS/SCTP" !== e.protocol ? ["m=" + e.kind + " 9 " + e.protocol + " " + t.protocol + "\r\n", "c=IN IP4 0.0.0.0\r\n", "a=sctp-port:" + t.port + "\r\n"] : ["m=" + e.kind + " 9 " + e.protocol + " " + t.port + "\r\n", "c=IN IP4 0.0.0.0\r\n", "a=sctpmap:" + t.port + " " + t.protocol + " 65535\r\n"], void 0 !== t.maxMessageSize && n.push("a=max-message-size:" + t.maxMessageSize + "\r\n"), n.join("")
}, r.generateSessionId = function() {
return Math.random().toString().substr(2, 21)
}, r.writeSessionBoilerplate = function(e, t, n) {
var i = void 0 !== t ? t : 2;
return "v=0\r\no=" + (n || "thisisadapterortc") + " " + (e || r.generateSessionId()) + " " + i + " IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"
}, r.writeMediaSection = function(e, t, n, i) {
var o = r.writeRtpDescription(e.kind, t);
if (o += r.writeIceParameters(e.iceGatherer.getLocalParameters()), o += r.writeDtlsParameters(e.dtlsTransport.getLocalParameters(), "offer" === n ? "actpass" : "active"), o += "a=mid:" + e.mid + "\r\n", e.direction ? o += "a=" + e.direction + "\r\n" : e.rtpSender && e.rtpReceiver ? o += "a=sendrecv\r\n" : e.rtpSender ? o += "a=sendonly\r\n" : e.rtpReceiver ? o += "a=recvonly\r\n" : o += "a=inactive\r\n", e.rtpSender) {
var a = "msid:" + i.id + " " + e.rtpSender.track.id + "\r\n";
o += "a=" + a, o += "a=ssrc:" + e.sendEncodingParameters[0].ssrc + " " + a, e.sendEncodingParameters[0].rtx && (o += "a=ssrc:" + e.sendEncodingParameters[0].rtx.ssrc + " " + a, o += "a=ssrc-group:FID " + e.sendEncodingParameters[0].ssrc + " " + e.sendEncodingParameters[0].rtx.ssrc + "\r\n")
}
return o += "a=ssrc:" + e.sendEncodingParameters[0].ssrc + " cname:" + r.localCName + "\r\n", e.rtpSender && e.sendEncodingParameters[0].rtx && (o += "a=ssrc:" + e.sendEncodingParameters[0].rtx.ssrc + " cname:" + r.localCName + "\r\n"), o
}, r.getDirection = function(e, t) {
for (var n = r.splitLines(e), i = 0; i < n.length; i++) switch (n[i]) {
case "a=sendrecv":
case "a=sendonly":
case "a=recvonly":
case "a=inactive":
return n[i].substr(2)
}
return t ? r.getDirection(t) : "sendrecv"
}, r.getKind = function(e) {
return r.splitLines(e)[0].split(" ")[0].substr(2)
}, r.isRejected = function(e) {
return "0" === e.split(" ", 2)[1]
}, r.parseMLine = function(e) {
var t = r.splitLines(e)[0].substr(2).split(" ");
return {
kind: t[0],
port: parseInt(t[1], 10),
protocol: t[2],
fmt: t.slice(3).join(" ")
}
}, r.parseOLine = function(e) {
var t = r.matchPrefix(e, "o=")[0].substr(2).split(" ");
return {
username: t[0],
sessionId: t[1],
sessionVersion: parseInt(t[2], 10),
netType: t[3],
addressType: t[4],
address: t[5]
}
}, r.isValidSDP = function(e) {
if ("string" != typeof e || 0 === e.length) return !1;
for (var t = r.splitLines(e), n = 0; n < t.length; n++)
if (t[n].length < 2 || "=" !== t[n].charAt(1)) return !1;
return !0
}, e.exports = r
}, function(e, t, n) {
(function(r) {
t.formatArgs = function(t) {
if (t[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + t[0] + (this.useColors ? "%c " : " ") + "+" + e.exports.humanize(this.diff), !this.useColors) return;
const n = "color: " + this.color;
t.splice(1, 0, n, "color: inherit");
let r = 0,
i = 0;
t[0].replace(/%[a-zA-Z%]/g, e => {
"%%" !== e && (r++, "%c" === e && (i = r))
}), t.splice(i, 0, n)
}, t.save = function(e) {
try {
e ? t.storage.setItem("debug", e) : t.storage.removeItem("debug")
} catch (e) {}
}, t.load = function() {
let e;
try {
e = t.storage.getItem("debug")
} catch (e) {}!e && void 0 !== r && "env" in r && (e = r.env.DEBUG);
return e
}, t.useColors = function() {
if ("undefined" != typeof window && window.process && ("renderer" === window.process.type || window.process.__nwjs)) return !0;
if ("undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return !1;
return "undefined" != typeof document && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || "undefined" != typeof window && window.console && (window.console.firebug || window.console.exception && window.console.table) || "undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || "undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)
}, t.storage = function() {
try {
return localStorage
} catch (e) {}
}(), t.destroy = (() => {
let e = !1;
return () => {
e || (e = !0, console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))
}
})(), t.colors = ["#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33"], t.log = console.debug || console.log || (() => {}), e.exports = n(58)(t);
const {
formatters: i
} = e.exports;
i.j = function(e) {
try {
return JSON.stringify(e)
} catch (e) {
return "[UnexpectedJSONParseError]: " + e.message
}
}
}).call(this, n(10))
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.VivochaSocket = void 0;
const r = n(9),
i = n(60),
o = n(4).default("vvc-sio");
class a extends r.EventEmitter {
constructor(e = {}) {
super(), this.defaultHandlers = e, this.wasEverConnected = !1, this.trigger = this.emit, this.unbind = this.removeListener, this.reset()
}
reset() {
try {
this.sio && (this.sio.removeAllListeners(), this.sio.close())
} catch (e) {}
this.sio = null, this.host = null
}
isConnected() {
return this.sio && this.sio.connected
}
send(...e) {
return !!this.isConnected() && (this.sio.emit(...e), !0)
}
connect(e, t) {
if (this.sio) t && t(null, this);
else {
this.wasEverConnected = !1, this.trigger("connecting");
let r = [];
if (e)
for (var n in e) r.push(encodeURIComponent(n) + "=" + encodeURIComponent(e[n]));
let a = {
path: "/a/_/p",
query: r.join("&")
};
this.reset(), this.host = "".concat(vivocha.config.world).concat(vivocha.config.domain), o.log("sio connecting", this.host), this.sio = i("wss://".concat(this.host), a), this.sio.on("connect", () => {
if (!this.wasEverConnected) {
for (var e in this.wasEverConnected = !0, o.log("sio connected", this.sio.id, this.host), this.defaultHandlers) this.sio.on(e, this.defaultHandlers[e]);
this.trigger("connect", this.host), t && t(null, this)
}
}), this.sio.on("reconnecting", () => {
o.log("sio reconnecting", this.sio.id, this.host), this.trigger("reconnecting")
}), this.sio.on("reconnect", () => {
o.log("sio reconnected", this.sio.id, this.host), this.trigger("reconnect")
})
}
}
disconnect() {
this.sio && this.sio.disconnect(), this.reset()
}
}
t.VivochaSocket = a
}, function(e, t) {
var n = /^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,
r = ["source", "protocol", "authority", "userInfo", "user", "password", "host", "port", "relative", "path", "directory", "file", "query", "anchor"];
e.exports = function(e) {
var t = e,
i = e.indexOf("["),
o = e.indexOf("]"); - 1 != i && -1 != o && (e = e.substring(0, i) + e.substring(i, o).replace(/:/g, ";") + e.substring(o, e.length));
for (var a, s, c = n.exec(e || ""), u = {}, h = 14; h--;) u[r[h]] = c[h] || "";
return -1 != i && -1 != o && (u.source = t, u.host = u.host.substring(1, u.host.length - 1).replace(/;/g, ":"), u.authority = u.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), u.ipv6uri = !0), u.pathNames = function(e, t) {
var n = t.replace(/\/{2,9}/g, "/").split("/");
"/" != t.substr(0, 1) && 0 !== t.length || n.splice(0, 1);
"/" == t.substr(t.length - 1, 1) && n.splice(n.length - 1, 1);
return n
}(0, u.path), u.queryKey = (a = u.query, s = {}, a.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, (function(e, t, n) {
t && (s[t] = n)
})), s), u
}
}, function(e, t, n) {
(function(t) {
e.exports = function(e) {
return n && t.isBuffer(e) || r && (e instanceof ArrayBuffer || function(e) {
return "function" == typeof ArrayBuffer.isView ? ArrayBuffer.isView(e) : e.buffer instanceof ArrayBuffer
}(e))
};
var n = "function" == typeof t && "function" == typeof t.isBuffer,
r = "function" == typeof ArrayBuffer
}).call(this, n(12).Buffer)
}, function(e, t, n) {
var r = n(71),
i = n(38),
o = n(5),
a = n(19),
s = n(39),
c = n(40),
u = n(13)("socket.io-client:manager"),
h = n(37),
d = n(87),
l = Object.prototype.hasOwnProperty;

function f(e, t) {
if (!(this instanceof f)) return new f(e, t);
e && "object" == typeof e && (t = e, e = void 0), (t = t || {}).path = t.path || "/socket.io", this.nsps = {}, this.subs = [], this.opts = t, this.reconnection(!1 !== t.reconnection), this.reconnectionAttempts(t.reconnectionAttempts || 1 / 0), this.reconnectionDelay(t.reconnectionDelay || 1e3), this.reconnectionDelayMax(t.reconnectionDelayMax || 5e3), this.randomizationFactor(t.randomizationFactor || .5), this.backoff = new d({
min: this.reconnectionDelay(),
max: this.reconnectionDelayMax(),
jitter: this.randomizationFactor()
}), this.timeout(null == t.timeout ? 2e4 : t.timeout), this.readyState = "closed", this.uri = e, this.connecting = [], this.lastPing = null, this.encoding = !1, this.packetBuffer = [];
var n = t.parser || a;
this.encoder = new n.Encoder, this.decoder = new n.Decoder, this.autoConnect = !1 !== t.autoConnect, this.autoConnect && this.open()
}
e.exports = f, f.prototype.emitAll = function() {
for (var e in this.emit.apply(this, arguments), this.nsps) l.call(this.nsps, e) && this.nsps[e].emit.apply(this.nsps[e], arguments)
}, f.prototype.updateSocketIds = function() {
for (var e in this.nsps) l.call(this.nsps, e) && (this.nsps[e].id = this.generateId(e))
}, f.prototype.generateId = function(e) {
return ("/" === e ? "" : e + "#") + this.engine.id
}, o(f.prototype), f.prototype.reconnection = function(e) {
return arguments.length ? (this._reconnection = !!e, this) : this._reconnection
}, f.prototype.reconnectionAttempts = function(e) {
return arguments.length ? (this._reconnectionAttempts = e, this) : this._reconnectionAttempts
}, f.prototype.reconnectionDelay = function(e) {
return arguments.length ? (this._reconnectionDelay = e, this.backoff && this.backoff.setMin(e), this) : this._reconnectionDelay
}, f.prototype.randomizationFactor = function(e) {
return arguments.length ? (this._randomizationFactor = e, this.backoff && this.backoff.setJitter(e), this) : this._randomizationFactor
}, f.prototype.reconnectionDelayMax = function(e) {
return arguments.length ? (this._reconnectionDelayMax = e, this.backoff && this.backoff.setMax(e), this) : this._reconnectionDelayMax
}, f.prototype.timeout = function(e) {
return arguments.length ? (this._timeout = e, this) : this._timeout
}, f.prototype.maybeReconnectOnOpen = function() {
!this.reconnecting && this._reconnection && 0 === this.backoff.attempts && this.reconnect()
}, f.prototype.open = f.prototype.connect = function(e, t) {
if (u("readyState %s", this.readyState), ~this.readyState.indexOf("open")) return this;
u("opening %s", this.uri), this.engine = r(this.uri, this.opts);
var n = this.engine,
i = this;
this.readyState = "opening", this.skipReconnect = !1;
var o = s(n, "open", (function() {
i.onopen(), e && e()
})),
a = s(n, "error", (function(t) {
if (u("connect_error"), i.cleanup(), i.readyState = "closed", i.emitAll("connect_error", t), e) {
var n = new Error("Connection error");
n.data = t, e(n)
} else i.maybeReconnectOnOpen()
}));
if (!1 !== this._timeout) {
var c = this._timeout;
u("connect attempt will timeout after %d", c), 0 === c && o.destroy();
var h = setTimeout((function() {
u("connect attempt timed out after %d", c), o.destroy(), n.close(), n.emit("error", "timeout"), i.emitAll("connect_timeout", c)
}), c);
this.subs.push({
destroy: function() {
clearTimeout(h)
}
})
}
return this.subs.push(o), this.subs.push(a), this
}, f.prototype.onopen = function() {
u("open"), this.cleanup(), this.readyState = "open", this.emit("open");
var e = this.engine;
this.subs.push(s(e, "data", c(this, "ondata"))), this.subs.push(s(e, "ping", c(this, "onping"))), this.subs.push(s(e, "pong", c(this, "onpong"))), this.subs.push(s(e, "error", c(this, "onerror"))), this.subs.push(s(e, "close", c(this, "onclose"))), this.subs.push(s(this.decoder, "decoded", c(this, "ondecoded")))
}, f.prototype.onping = function() {
this.lastPing = new Date, this.emitAll("ping")
}, f.prototype.onpong = function() {
this.emitAll("pong", new Date - this.lastPing)
}, f.prototype.ondata = function(e) {
this.decoder.add(e)
}, f.prototype.ondecoded = function(e) {
this.emit("packet", e)
}, f.prototype.onerror = function(e) {
u("error", e), this.emitAll("error", e)
}, f.prototype.socket = function(e, t) {
var n = this.nsps[e];
if (!n) {
n = new i(this, e, t), this.nsps[e] = n;
var r = this;
n.on("connecting", o), n.on("connect", (function() {
n.id = r.generateId(e)
})), this.autoConnect && o()
}

function o() {
~h(r.connecting, n) || r.connecting.push(n)
}
return n
}, f.prototype.destroy = function(e) {
var t = h(this.connecting, e);
~t && this.connecting.splice(t, 1), this.connecting.length || this.close()
}, f.prototype.packet = function(e) {
u("writing packet %j", e);
var t = this;
e.query && 0 === e.type && (e.nsp += "?" + e.query), t.encoding ? t.packetBuffer.push(e) : (t.encoding = !0, this.encoder.encode(e, (function(n) {
for (var r = 0; r < n.length; r++) t.engine.write(n[r], e.options);
t.encoding = !1, t.processPacketQueue()
})))
}, f.prototype.processPacketQueue = function() {
if (this.packetBuffer.length > 0 && !this.encoding) {
var e = this.packetBuffer.shift();
this.packet(e)
}
}, f.prototype.cleanup = function() {
u("cleanup");
for (var e = this.subs.length, t = 0; t < e; t++) {
this.subs.shift().destroy()
}
this.packetBuffer = [], this.encoding = !1, this.lastPing = null, this.decoder.destroy()
}, f.prototype.close = f.prototype.disconnect = function() {
u("disconnect"), this.skipReconnect = !0, this.reconnecting = !1, "opening" === this.readyState && this.cleanup(), this.backoff.reset(), this.readyState = "closed", this.engine && this.engine.close()
}, f.prototype.onclose = function(e) {
u("onclose"), this.cleanup(), this.backoff.reset(), this.readyState = "closed", this.emit("close", e), this._reconnection && !this.skipReconnect && this.reconnect()
}, f.prototype.reconnect = function() {
if (this.reconnecting || this.skipReconnect) return this;
var e = this;
if (this.backoff.attempts >= this._reconnectionAttempts) u("reconnect failed"), this.backoff.reset(), this.emitAll("reconnect_failed"), this.reconnecting = !1;
else {
var t = this.backoff.duration();
u("will wait %dms before reconnect attempt", t), this.reconnecting = !0;
var n = setTimeout((function() {
e.skipReconnect || (u("attempting reconnect"), e.emitAll("reconnect_attempt", e.backoff.attempts), e.emitAll("reconnecting", e.backoff.attempts), e.skipReconnect || e.open((function(t) {
t ? (u("reconnect attempt error"), e.reconnecting = !1, e.reconnect(), e.emitAll("reconnect_error", t.data)) : (u("reconnect success"), e.onreconnect())
})))
}), t);
this.subs.push({
destroy: function() {
clearTimeout(n)
}
})
}
}, f.prototype.onreconnect = function() {
var e = this.backoff.attempts;
this.reconnecting = !1, this.backoff.reset(), this.updateSocketIds(), this.emitAll("reconnect", e)
}
}, function(e, t, n) {
var r = n(21),
i = n(74),
o = n(83),
a = n(84);
t.polling = function(e) {
var t = !1,
n = !1,
a = !1 !== e.jsonp;
if ("undefined" != typeof location) {
var s = "https:" === location.protocol,
c = location.port;
c || (c = s ? 443 : 80), t = e.hostname !== location.hostname || c !== e.port, n = e.secure !== s
}
if (e.xdomain = t, e.xscheme = n, "open" in new r(e) && !e.forceJSONP) return new i(e);
if (!a) throw new Error("JSONP disabled");
return new o(e)
}, t.websocket = a
}, function(e, t, n) {
var r = n(23),
i = n(14),
o = n(6),
a = n(15),
s = n(36),
c = n(16)("engine.io-client:polling");
e.exports = h;
var u = null != new(n(21))({
xdomain: !1
}).responseType;

function h(e) {
var t = e && e.forceBase64;
u && !t || (this.supportsBinary = !1), r.call(this, e)
}
a(h, r), h.prototype.name = "polling", h.prototype.doOpen = function() {
this.poll()
}, h.prototype.pause = function(e) {
var t = this;

function n() {
c("paused"), t.readyState = "paused", e()
}
if (this.readyState = "pausing", this.polling || !this.writable) {
var r = 0;
this.polling && (c("we are currently polling - waiting to pause"), r++, this.once("pollComplete", (function() {
c("pre-pause polling complete"), --r || n()
}))), this.writable || (c("we are currently writing - waiting to pause"), r++, this.once("drain", (function() {
c("pre-pause writing complete"), --r || n()
})))
} else n()
}, h.prototype.poll = function() {
c("polling"), this.polling = !0, this.doPoll(), this.emit("poll")
}, h.prototype.onData = function(e) {
var t = this;
c("polling got data %s", e);
o.decodePayload(e, this.socket.binaryType, (function(e, n, r) {
if ("opening" === t.readyState && "open" === e.type && t.onOpen(), "close" === e.type) return t.onClose(), !1;
t.onPacket(e)
})), "closed" !== this.readyState && (this.polling = !1, this.emit("pollComplete"), "open" === this.readyState ? this.poll() : c('ignoring poll - transport state "%s"', this.readyState))
}, h.prototype.doClose = function() {
var e = this;

function t() {
c("writing close packet"), e.write([{
type: "close"
}])
}
"open" === this.readyState ? (c("transport open - closing"), t()) : (c("transport not open - deferring close"), this.once("open", t))
}, h.prototype.write = function(e) {
var t = this;
this.writable = !1;
var n = function() {
t.writable = !0, t.emit("drain")
};
o.encodePayload(e, this.supportsBinary, (function(e) {
t.doWrite(e, n)
}))
}, h.prototype.uri = function() {
var e = this.query || {},
t = this.secure ? "https" : "http",
n = "";
return !1 !== this.timestampRequests && (e[this.timestampParam] = s()), this.supportsBinary || e.sid || (e.b64 = 1), e = i.encode(e), this.port && ("https" === t && 443 !== Number(this.port) || "http" === t && 80 !== Number(this.port)) && (n = ":" + this.port), e.length && (e = "?" + e), t + "://" + (-1 !== this.hostname.indexOf(":") ? "[" + this.hostname + "]" : this.hostname) + n + this.path + e
}
}, function(e, t, n) {
(function(t) {
var r = n(20),
i = Object.prototype.toString,
o = "function" == typeof Blob || "undefined" != typeof Blob && "[object BlobConstructor]" === i.call(Blob),
a = "function" == typeof File || "undefined" != typeof File && "[object FileConstructor]" === i.call(File);
e.exports = function e(n) {
if (!n || "object" != typeof n) return !1;
if (r(n)) {
for (var i = 0, s = n.length; i < s; i++)
if (e(n[i])) return !0;
return !1
}
if ("function" == typeof t && t.isBuffer && t.isBuffer(n) || "function" == typeof ArrayBuffer && n instanceof ArrayBuffer || o && n instanceof Blob || a && n instanceof File) return !0;
if (n.toJSON && "function" == typeof n.toJSON && 1 === arguments.length) return e(n.toJSON(), !0);
for (var c in n)
if (Object.prototype.hasOwnProperty.call(n, c) && e(n[c])) return !0;
return !1
}
}).call(this, n(12).Buffer)
}, function(e, t, n) {
"use strict";
var r, i = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),
o = {},
a = 0,
s = 0;

function c(e) {
var t = "";
do {
t = i[e % 64] + t, e = Math.floor(e / 64)
} while (e > 0);
return t
}

function u() {
var e = c(+new Date);
return e !== r ? (a = 0, r = e) : e + "." + c(a++)
}
for (; s < 64; s++) o[i[s]] = s;
u.encode = c, u.decode = function(e) {
var t = 0;
for (s = 0; s < e.length; s++) t = 64 * t + o[e.charAt(s)];
return t
}, e.exports = u
}, function(e, t) {
var n = [].indexOf;
e.exports = function(e, t) {
if (n) return e.indexOf(t);
for (var r = 0; r < e.length; ++r)
if (e[r] === t) return r;
return -1
}
}, function(e, t, n) {
var r = n(19),
i = n(5),
o = n(86),
a = n(39),
s = n(40),
c = n(13)("socket.io-client:socket"),
u = n(14),
h = n(35);
e.exports = f;
var d = {
connect: 1,
connect_error: 1,
connect_timeout: 1,
connecting: 1,
disconnect: 1,
error: 1,
reconnect: 1,
reconnect_attempt: 1,
reconnect_failed: 1,
reconnect_error: 1,
reconnecting: 1,
ping: 1,
pong: 1
},
l = i.prototype.emit;

function f(e, t, n) {
this.io = e, this.nsp = t, this.json = this, this.ids = 0, this.acks = {}, this.receiveBuffer = [], this.sendBuffer = [], this.connected = !1, this.disconnected = !0, this.flags = {}, n && n.query && (this.query = n.query), this.io.autoConnect && this.open()
}
i(f.prototype), f.prototype.subEvents = function() {
if (!this.subs) {
var e = this.io;
this.subs = [a(e, "open", s(this, "onopen")), a(e, "packet", s(this, "onpacket")), a(e, "close", s(this, "onclose"))]
}
}, f.prototype.open = f.prototype.connect = function() {
return this.connected || (this.subEvents(), this.io.reconnecting || this.io.open(), "open" === this.io.readyState && this.onopen(), this.emit("connecting")), this
}, f.prototype.send = function() {
var e = o(arguments);
return e.unshift("message"), this.emit.apply(this, e), this
}, f.prototype.emit = function(e) {
if (d.hasOwnProperty(e)) return l.apply(this, arguments), this;
var t = o(arguments),
n = {
type: (void 0 !== this.flags.binary ? this.flags.binary : h(t)) ? r.BINARY_EVENT : r.EVENT,
data: t,
options: {}
};
return n.options.compress = !this.flags || !1 !== this.flags.compress, "function" == typeof t[t.length - 1] && (c("emitting packet with ack id %d", this.ids), this.acks[this.ids] = t.pop(), n.id = this.ids++), this.connected ? this.packet(n) : this.sendBuffer.push(n), this.flags = {}, this
}, f.prototype.packet = function(e) {
e.nsp = this.nsp, this.io.packet(e)
}, f.prototype.onopen = function() {
if (c("transport is open - connecting"), "/" !== this.nsp)
if (this.query) {
var e = "object" == typeof this.query ? u.encode(this.query) : this.query;
c("sending connect packet with query %s", e), this.packet({
type: r.CONNECT,
query: e
})
} else this.packet({
type: r.CONNECT
})
}, f.prototype.onclose = function(e) {
c("close (%s)", e), this.connected = !1, this.disconnected = !0, delete this.id, this.emit("disconnect", e)
}, f.prototype.onpacket = function(e) {
var t = e.nsp === this.nsp,
n = e.type === r.ERROR && "/" === e.nsp;
if (t || n) switch (e.type) {
case r.CONNECT:
this.onconnect();
break;
case r.EVENT:
case r.BINARY_EVENT:
this.onevent(e);
break;
case r.ACK:
case r.BINARY_ACK:
this.onack(e);
break;
case r.DISCONNECT:
this.ondisconnect();
break;
case r.ERROR:
this.emit("error", e.data)
}
}, f.prototype.onevent = function(e) {
var t = e.data || [];
c("emitting event %j", t), null != e.id && (c("attaching ack callback to event"), t.push(this.ack(e.id))), this.connected ? l.apply(this, t) : this.receiveBuffer.push(t)
}, f.prototype.ack = function(e) {
var t = this,
n = !1;
return function() {
if (!n) {
n = !0;
var i = o(arguments);
c("sending ack %j", i), t.packet({
type: h(i) ? r.BINARY_ACK : r.ACK,
id: e,
data: i
})
}
}
}, f.prototype.onack = function(e) {
var t = this.acks[e.id];
"function" == typeof t ? (c("calling ack %s with %j", e.id, e.data), t.apply(this, e.data), delete this.acks[e.id]) : c("bad ack %s", e.id)
}, f.prototype.onconnect = function() {
this.connected = !0, this.disconnected = !1, this.emit("connect"), this.emitBuffered()
}, f.prototype.emitBuffered = function() {
var e;
for (e = 0; e < this.receiveBuffer.length; e++) l.apply(this, this.receiveBuffer[e]);
for (this.receiveBuffer = [], e = 0; e < this.sendBuffer.length; e++) this.packet(this.sendBuffer[e]);
this.sendBuffer = []
}, f.prototype.ondisconnect = function() {
c("server disconnect (%s)", this.nsp), this.destroy(), this.onclose("io server disconnect")
}, f.prototype.destroy = function() {
if (this.subs) {
for (var e = 0; e < this.subs.length; e++) this.subs[e].destroy();
this.subs = null
}
this.io.destroy(this)
}, f.prototype.close = f.prototype.disconnect = function() {
return this.connected && (c("performing disconnect (%s)", this.nsp), this.packet({
type: r.DISCONNECT
})), this.destroy(), this.connected && this.onclose("io client disconnect"), this
}, f.prototype.compress = function(e) {
return this.flags.compress = e, this
}, f.prototype.binary = function(e) {
return this.flags.binary = e, this
}
}, function(e, t) {
e.exports = function(e, t, n) {
return e.on(t, n), {
destroy: function() {
e.removeListener(t, n)
}
}
}
}, function(e, t) {
var n = [].slice;
e.exports = function(e, t) {
if ("string" == typeof t && (t = e[t]), "function" != typeof t) throw new Error("bind() requires a function");
var r = n.call(arguments, 2);
return function() {
return t.apply(e, r.concat(n.call(arguments)))
}
}
}, function(e, t, n) {
var r;
e.exports = (r = n(0), function(e) {
var t = r,
n = t.lib,
i = n.WordArray,
o = n.Hasher,
a = t.algo,
s = [],
c = [];
! function() {
function t(t) {
for (var n = e.sqrt(t), r = 2; r <= n; r++)
if (!(t % r)) return !1;
return !0
}

function n(e) {
return 4294967296 * (e - (0 | e)) | 0
}
for (var r = 2, i = 0; i < 64;) t(r) && (i < 8 && (s[i] = n(e.pow(r, .5))), c[i] = n(e.pow(r, 1 / 3)), i++), r++
}();
var u = [],
h = a.SHA256 = o.extend({
_doReset: function() {
this._hash = new i.init(s.slice(0))
},
_doProcessBlock: function(e, t) {
for (var n = this._hash.words, r = n[0], i = n[1], o = n[2], a = n[3], s = n[4], h = n[5], d = n[6], l = n[7], f = 0; f < 64; f++) {
if (f < 16) u[f] = 0 | e[t + f];
else {
var p = u[f - 15],
g = (p << 25 | p >>> 7) ^ (p << 14 | p >>> 18) ^ p >>> 3,
v = u[f - 2],
m = (v << 15 | v >>> 17) ^ (v << 13 | v >>> 19) ^ v >>> 10;
u[f] = g + u[f - 7] + m + u[f - 16]
}
var y = r & i ^ r & o ^ i & o,
C = (r << 30 | r >>> 2) ^ (r << 19 | r >>> 13) ^ (r << 10 | r >>> 22),
w = l + ((s << 26 | s >>> 6) ^ (s << 21 | s >>> 11) ^ (s << 7 | s >>> 25)) + (s & h ^ ~s & d) + c[f] + u[f];
l = d, d = h, h = s, s = a + w | 0, a = o, o = i, i = r, r = w + (C + y) | 0
}
n[0] = n[0] + r | 0, n[1] = n[1] + i | 0, n[2] = n[2] + o | 0, n[3] = n[3] + a | 0, n[4] = n[4] + s | 0, n[5] = n[5] + h | 0, n[6] = n[6] + d | 0, n[7] = n[7] + l | 0
},
_doFinalize: function() {
var t = this._data,
n = t.words,
r = 8 * this._nDataBytes,
i = 8 * t.sigBytes;
return n[i >>> 5] |= 128 << 24 - i % 32, n[14 + (i + 64 >>> 9 << 4)] = e.floor(r / 4294967296), n[15 + (i + 64 >>> 9 << 4)] = r, t.sigBytes = 4 * n.length, this._process(), this._hash
},
clone: function() {
var e = o.clone.call(this);
return e._hash = this._hash.clone(), e
}
});
t.SHA256 = o._createHelper(h), t.HmacSHA256 = o._createHmacHelper(h)
}(Math), r.SHA256)
}, function(e, t, n) {
var r;
e.exports = (r = n(0), n(17), function() {
var e = r,
t = e.lib.Hasher,
n = e.x64,
i = n.Word,
o = n.WordArray,
a = e.algo;

function s() {
return i.create.apply(i, arguments)
}
var c = [s(1116352408, 3609767458), s(1899447441, 602891725), s(3049323471, 3964484399), s(3921009573, 2173295548), s(961987163, 4081628472), s(1508970993, 3053834265), s(2453635748, 2937671579), s(2870763221, 3664609560), s(3624381080, 2734883394), s(310598401, 1164996542), s(607225278, 1323610764), s(1426881987, 3590304994), s(1925078388, 4068182383), s(2162078206, 991336113), s(2614888103, 633803317), s(3248222580, 3479774868), s(3835390401, 2666613458), s(4022224774, 944711139), s(264347078, 2341262773), s(604807628, 2007800933), s(770255983, 1495990901), s(1249150122, 1856431235), s(1555081692, 3175218132), s(1996064986, 2198950837), s(2554220882, 3999719339), s(2821834349, 766784016), s(2952996808, 2566594879), s(3210313671, 3203337956), s(3336571891, 1034457026), s(3584528711, 2466948901), s(113926993, 3758326383), s(338241895, 168717936), s(666307205, 1188179964), s(773529912, 1546045734), s(1294757372, 1522805485), s(1396182291, 2643833823), s(1695183700, 2343527390), s(1986661051, 1014477480), s(2177026350, 1206759142), s(2456956037, 344077627), s(2730485921, 1290863460), s(2820302411, 3158454273), s(3259730800, 3505952657), s(3345764771, 106217008), s(3516065817, 3606008344), s(3600352804, 1432725776), s(4094571909, 1467031594), s(275423344, 851169720), s(430227734, 3100823752), s(506948616, 1363258195), s(659060556, 3750685593), s(883997877, 3785050280), s(958139571, 3318307427), s(1322822218, 3812723403), s(1537002063, 2003034995), s(1747873779, 3602036899), s(1955562222, 1575990012), s(2024104815, 1125592928), s(2227730452, 2716904306), s(2361852424, 442776044), s(2428436474, 593698344), s(2756734187, 3733110249), s(3204031479, 2999351573), s(3329325298, 3815920427), s(3391569614, 3928383900), s(3515267271, 566280711), s(3940187606, 3454069534), s(4118630271, 4000239992), s(116418474, 1914138554), s(174292421, 2731055270), s(289380356, 3203993006), s(460393269, 320620315), s(685471733, 587496836), s(852142971, 1086792851), s(1017036298, 365543100), s(1126000580, 2618297676), s(1288033470, 3409855158), s(1501505948, 4234509866), s(1607167915, 987167468), s(1816402316, 1246189591)],
u = [];
! function() {
for (var e = 0; e < 80; e++) u[e] = s()
}();
var h = a.SHA512 = t.extend({
_doReset: function() {
this._hash = new o.init([new i.init(1779033703, 4089235720), new i.init(3144134277, 2227873595), new i.init(1013904242, 4271175723), new i.init(2773480762, 1595750129), new i.init(1359893119, 2917565137), new i.init(2600822924, 725511199), new i.init(528734635, 4215389547), new i.init(1541459225, 327033209)])
},
_doProcessBlock: function(e, t) {
for (var n = this._hash.words, r = n[0], i = n[1], o = n[2], a = n[3], s = n[4], h = n[5], d = n[6], l = n[7], f = r.high, p = r.low, g = i.high, v = i.low, m = o.high, y = o.low, C = a.high, w = a.low, _ = s.high, b = s.low, E = h.high, T = h.low, S = d.high, R = d.low, x = l.high, k = l.low, P = f, A = p, I = g, O = v, M = m, D = y, N = C, L = w, j = _, F = b, V = E, B = T, U = S, W = R, q = x, H = k, z = 0; z < 80; z++) {
var G = u[z];
if (z < 16) var K = G.high = 0 | e[t + 2 * z],
Y = G.low = 0 | e[t + 2 * z + 1];
else {
var J = u[z - 15],
$ = J.high,
X = J.low,
Z = ($ >>> 1 | X << 31) ^ ($ >>> 8 | X << 24) ^ $ >>> 7,
Q = (X >>> 1 | $ << 31) ^ (X >>> 8 | $ << 24) ^ (X >>> 7 | $ << 25),
ee = u[z - 2],
te = ee.high,
ne = ee.low,
re = (te >>> 19 | ne << 13) ^ (te << 3 | ne >>> 29) ^ te >>> 6,
ie = (ne >>> 19 | te << 13) ^ (ne << 3 | te >>> 29) ^ (ne >>> 6 | te << 26),
oe = u[z - 7],
ae = oe.high,
se = oe.low,
ce = u[z - 16],
ue = ce.high,
he = ce.low;
K = (K = (K = Z + ae + ((Y = Q + se) >>> 0 < Q >>> 0 ? 1 : 0)) + re + ((Y += ie) >>> 0 < ie >>> 0 ? 1 : 0)) + ue + ((Y += he) >>> 0 < he >>> 0 ? 1 : 0), G.high = K, G.low = Y
}
var de, le = j & V ^ ~j & U,
fe = F & B ^ ~F & W,
pe = P & I ^ P & M ^ I & M,
ge = A & O ^ A & D ^ O & D,
ve = (P >>> 28 | A << 4) ^ (P << 30 | A >>> 2) ^ (P << 25 | A >>> 7),
me = (A >>> 28 | P << 4) ^ (A << 30 | P >>> 2) ^ (A << 25 | P >>> 7),
ye = (j >>> 14 | F << 18) ^ (j >>> 18 | F << 14) ^ (j << 23 | F >>> 9),
Ce = (F >>> 14 | j << 18) ^ (F >>> 18 | j << 14) ^ (F << 23 | j >>> 9),
we = c[z],
_e = we.high,
be = we.low,
Ee = q + ye + ((de = H + Ce) >>> 0 < H >>> 0 ? 1 : 0),
Te = me + ge;
q = U, H = W, U = V, W = B, V = j, B = F, j = N + (Ee = (Ee = (Ee = Ee + le + ((de += fe) >>> 0 < fe >>> 0 ? 1 : 0)) + _e + ((de += be) >>> 0 < be >>> 0 ? 1 : 0)) + K + ((de += Y) >>> 0 < Y >>> 0 ? 1 : 0)) + ((F = L + de | 0) >>> 0 < L >>> 0 ? 1 : 0) | 0, N = M, L = D, M = I, D = O, I = P, O = A, P = Ee + (ve + pe + (Te >>> 0 < me >>> 0 ? 1 : 0)) + ((A = de + Te | 0) >>> 0 < de >>> 0 ? 1 : 0) | 0
}
p = r.low = p + A, r.high = f + P + (p >>> 0 < A >>> 0 ? 1 : 0), v = i.low = v + O, i.high = g + I + (v >>> 0 < O >>> 0 ? 1 : 0), y = o.low = y + D, o.high = m + M + (y >>> 0 < D >>> 0 ? 1 : 0), w = a.low = w + L, a.high = C + N + (w >>> 0 < L >>> 0 ? 1 : 0), b = s.low = b + F, s.high = _ + j + (b >>> 0 < F >>> 0 ? 1 : 0), T = h.low = T + B, h.high = E + V + (T >>> 0 < B >>> 0 ? 1 : 0), R = d.low = R + W, d.high = S + U + (R >>> 0 < W >>> 0 ? 1 : 0), k = l.low = k + H, l.high = x + q + (k >>> 0 < H >>> 0 ? 1 : 0)
},
_doFinalize: function() {
var e = this._data,
t = e.words,
n = 8 * this._nDataBytes,
r = 8 * e.sigBytes;
return t[r >>> 5] |= 128 << 24 - r % 32, t[30 + (r + 128 >>> 10 << 5)] = Math.floor(n / 4294967296), t[31 + (r + 128 >>> 10 << 5)] = n, e.sigBytes = 4 * t.length, this._process(), this._hash.toX32()
},
clone: function() {
var e = t.clone.call(this);
return e._hash = this._hash.clone(), e
},
blockSize: 32
});
e.SHA512 = t._createHelper(h), e.HmacSHA512 = t._createHmacHelper(h)
}(), r.SHA512)
}, function(e, t) {
var n = "undefined" != typeof crypto && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || "undefined" != typeof msCrypto && "function" == typeof window.msCrypto.getRandomValues && msCrypto.getRandomValues.bind(msCrypto);
if (n) {
var r = new Uint8Array(16);
e.exports = function() {
return n(r), r
}
} else {
var i = new Array(16);
e.exports = function() {
for (var e, t = 0; t < 16; t++) 0 == (3 & t) && (e = 4294967296 * Math.random()), i[t] = e >>> ((3 & t) << 3) & 255;
return i
}
}
}, function(e, t) {
for (var n = [], r = 0; r < 256; ++r) n[r] = (r + 256).toString(16).substr(1);
e.exports = function(e, t) {
var r = t || 0,
i = n;
return [i[e[r++]], i[e[r++]], i[e[r++]], i[e[r++]], "-", i[e[r++]], i[e[r++]], "-", i[e[r++]], i[e[r++]], "-", i[e[r++]], i[e[r++]], "-", i[e[r++]], i[e[r++]], i[e[r++]], i[e[r++]], i[e[r++]], i[e[r++]]].join("")
}
}, function(e, t, n) {
"use strict";
var r = this && this.__createBinding || (Object.create ? function(e, t, n, r) {
void 0 === r && (r = n), Object.defineProperty(e, r, {
enumerable: !0,
get: function() {
return t[n]
}
})
} : function(e, t, n, r) {
void 0 === r && (r = n), e[r] = t[n]
}),
i = this && this.__exportStar || function(e, t) {
for (var n in e) "default" === n || t.hasOwnProperty(n) || r(t, e, n)
};
Object.defineProperty(t, "__esModule", {
value: !0
}), t.VivochaCore = t.sioChannel = void 0;
const o = n(4),
a = n(46),
s = n(26);
i(n(47), t), i(n(26), t);
const c = o.default("vvc-core");
async function u(e, t, n) {
let r = new a.VivochaData(e, t);
return e.dataChannels[t] = r, n ? r : new Promise((n, i) => {
e.request("DataChannel", {
id: t
}, e => {
e ? i(e) : n(r)
})
})
}
n.p = 'https://cdn.vivocha.com/w/i1/8.3.0-iengine.104/js/', t.sioChannel = u;
t.VivochaCore = class {
constructor(e, t, n) {
this.platform = e, this.acct_id = t, this._ready = Promise.resolve(this), this.config = {
ajv: "8.3.0-iengine.104",
ver: "11",
version: "8.3",
versionfull: "8.3.0-iengine.104",
product_version: "7.1",
product_versionfull: "7.1.1681",
world: 'i1',
domain: '.vivocha.com',
apihost: 'i1.vivocha.com'
}, this.console = c, this.extend = s.extend, this.param = s.param, this.cookie = s.cookie, this.dot = s.dot, this.query = s.query, this.nodeify = s.nodeify, this.getLogger = o.default, t && (this.config.acct_id = t), this.platform.init && n && this.platform.init(this)
}
ready(e) {
return this.nodeify(this._ready, e)
}
isMobile() {
return this.platform.isMobile()
}
probeCaps() {
return this.platform.probeCaps()
}
async ws(e, t, n, r) {
let i = "".concat(this.config.apiurl).concat(e ? e + "/" : "").concat(t ? t + "/" : ""),
o = [];
for (let e in n) o.push(e + "=" + encodeURIComponent(n[e]));
o.length && (i += "?".concat(o.join("&")));
const a = await fetch(i, r);
if (200 !== a.status) throw new Error(a.statusText);
const s = await a.json();
if (s.ts && (this.serverTimeDiff = +new Date(s.ts) - +new Date), s.acct_id && (this.acct_id = s.acct_id), s.user_id && (this.user_id = s.user_id), 200 === s.status || s.result) return s;
throw new Error(s.error || "error")
}
retrieveAccountId(e) {
if (e) {
const t = e.match(/\/a\/(\w*)\/(api|apps|widgetwrap|sync|js)\/(console\/)?(vivocha|dataframe|vivocha_app.js)?/);
if (t && t.length > 1 && "_" !== t[1]) return t[1]
}
}
async getDataChannel(e, t, n, r) {
if (!t)
for (t in e.dataChannels) break;
if (t && e.dataChannels[t]) return e.dataChannels[t];
if ("sio" === n) return u(e, t, r);
if ((await e.getLocalCapabilities()).WebRTC) {
return (await e.getRemoteCapabilities()).WebRTC ? this.platform.getWebRTCChannel(e, t) : u(e, t, r)
}
return u(e, t, r)
}
}
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.VivochaData = t.BaseVivochaData = void 0;
const r = n(9);
class i extends r.EventEmitter {
constructor(e) {
super(), this.id = e, this._proxable = !0
}
}
t.BaseVivochaData = i;
t.VivochaData = class extends i {
constructor(e, t) {
super(t), this.contact = e, this._proxable = !0
}
send(e, t) {
let n = {
code: "data",
channel: this.id,
data: e,
topic: t
};
this.contact.send(n)
}
}
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
})
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.ProxyProvider = void 0;
const r = n(18).getLogger("vvc-bus");
class i {
constructor(e, t, n, i) {
const o = t => {
this[t] = (...i) => (r.debug("ProxyProvider", "calling remote method " + e + "." + t), n.postRequest(e, t, i))
};
if (t.emitter && (this.addEventListener = this.on = (t, r) => r ? (r._id = n.registerEventHandler(r), this._listeners || (this._listeners = {}), this._listeners[t] || (this._listeners[t] = {}), this._listeners[t][r._id] = r, n.postRequest(n.id, "emitter_on", [e, t, r._id]), this) : this, this.once = (t, r) => {
if (!r) return this;
let i = (...e) => {
this._listeners && delete this._listeners[t][i._id || ""], r(...e)
};
return i._once = !0, i._id = n.registerEventHandler(i), this._listeners || (this._listeners = {}), this._listeners[t] || (this._listeners[t] = {}), this._listeners[t][i._id] = i, n.postRequest(n.id, "emitter_once", [e, t, i._id]), this
}, this.removeAllListeners = e => {
const t = e => {
if (this._listeners && this.removeListener) {
for (let t in this._listeners[e]) this.removeListener(e, this._listeners[e][t]);
delete this._listeners[e]
}
};
if (e) t(e);
else if (this._listeners)
for (let e in this._listeners) t(e);
return this
}, this.removeListener = (t, r) => r && r._id && this._listeners && this._listeners[t] ? (delete this._listeners[t][r._id], n.postRequest(n.id, "emitter_remove", [e, t, r._id]), this) : this), t && t.methods)
for (let e = 0; e < t.methods.length; e++) this[t.methods[e]] || o(t.methods[e]);
this._id = function() {
return e
}, this._description = function() {
return t
}, this._source = function() {
return n
}, this._distance = function() {
return i || 0
}
}
static describe(e) {
let t = {
constructor: !0,
hasOwnProperty: !0,
toString: !0,
toLocaleString: !0,
valueOf: !0,
isPrototypeOf: !0,
propertyIsEnumerable: !0,
__defineGetter__: !0,
__lookupGetter__: !0,
__defineSetter__: !0,
__lookupSetter__: !0
};
if (i.isProxy(e)) return e._description(); {
let n = {};
for (let r in e) "function" != typeof e[r] || t[r] || (n[r] = !0);
for (let r, o = 0, a = i.getAllPropertyNames(e); o < a.length; o++) r = a[o], "constructor" === r || "function" != typeof e[r] || t[r] || (n[r] = !0);
return {
methods: Object.keys(n),
emitter: i.isEmitter(e)
}
}
}
static isProxy(e) {
return e && "function" == typeof e._source && "function" == typeof e._distance
}
static isEmitter(e) {
return e && "function" == typeof e.addListener && "function" == typeof e.once
}
static getAllPropertyNames(e) {
let t = [];
do {
t = t.concat(Object.getOwnPropertyNames(e))
} while (e = Object.getPrototypeOf(e));
return t
}
}
t.ProxyProvider = i
}, function(e, t) {
(function() {
var n = "Expected a function",
r = "__lodash_placeholder__",
i = [
["ary", 128],
["bind", 1],
["bindKey", 2],
["curry", 8],
["curryRight", 16],
["flip", 512],
["partial", 32],
["partialRight", 64],
["rearg", 256]
],
o = "[object Arguments]",
a = "[object Array]",
s = "[object Boolean]",
c = "[object Date]",
u = "[object Error]",
h = "[object Function]",
d = "[object GeneratorFunction]",
l = "[object Map]",
f = "[object Number]",
p = "[object Object]",
g = "[object RegExp]",
v = "[object Set]",
m = "[object String]",
y = "[object Symbol]",
C = "[object WeakMap]",
w = "[object ArrayBuffer]",
_ = "[object DataView]",
b = "[object Float32Array]",
E = "[object Float64Array]",
T = "[object Int8Array]",
S = "[object Int16Array]",
R = "[object Int32Array]",
x = "[object Uint8Array]",
k = "[object Uint16Array]",
P = "[object Uint32Array]",
A = /\b__p \+= '';/g,
I = /\b(__p \+=) '' \+/g,
O = /(__e\(.*?\)|\b__t\)) \+\n'';/g,
M = /&(?:amp|lt|gt|quot|#39);/g,
D = /[&<>"']/g,
N = RegExp(M.source),
L = RegExp(D.source),
j = /<%-([\s\S]+?)%>/g,
F = /<%([\s\S]+?)%>/g,
V = /<%=([\s\S]+?)%>/g,
B = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
U = /^\w*$/,
W = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,
q = /[\\^$.*+?()[\]{}|]/g,
H = RegExp(q.source),
z = /^\s+/,
G = /\s/,
K = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
Y = /\{\n\/\* \[wrapped with (.+)\] \*/,
J = /,? & /,
$ = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,
X = /[()=,{}\[\]\/\s]/,
Z = /\\(\\)?/g,
Q = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,
ee = /\w*$/,
te = /^[-+]0x[0-9a-f]+$/i,
ne = /^0b[01]+$/i,
re = /^\[object .+?Constructor\]$/,
ie = /^0o[0-7]+$/i,
oe = /^(?:0|[1-9]\d*)$/,
ae = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,
se = /($^)/,
ce = /['\n\r\u2028\u2029\\]/g,
ue = "\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",
he = "\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",
de = "[\\ud800-\\udfff]",
le = "[" + he + "]",
fe = "[" + ue + "]",
pe = "\\d+",
ge = "[\\u2700-\\u27bf]",
ve = "[a-z\\xdf-\\xf6\\xf8-\\xff]",
me = "[^\\ud800-\\udfff" + he + pe + "\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",
ye = "\\ud83c[\\udffb-\\udfff]",
Ce = "[^\\ud800-\\udfff]",
we = "(?:\\ud83c[\\udde6-\\uddff]){2}",
_e = "[\\ud800-\\udbff][\\udc00-\\udfff]",
be = "[A-Z\\xc0-\\xd6\\xd8-\\xde]",
Ee = "(?:" + ve + "|" + me + ")",
Te = "(?:" + be + "|" + me + ")",
Se = "(?:" + fe + "|" + ye + ")" + "?",
Re = "[\\ufe0e\\ufe0f]?" + Se + ("(?:\\u200d(?:" + [Ce, we, _e].join("|") + ")[\\ufe0e\\ufe0f]?" + Se + ")*"),
xe = "(?:" + [ge, we, _e].join("|") + ")" + Re,
ke = "(?:" + [Ce + fe + "?", fe, we, _e, de].join("|") + ")",
Pe = RegExp("['’]", "g"),
Ae = RegExp(fe, "g"),
Ie = RegExp(ye + "(?=" + ye + ")|" + ke + Re, "g"),
Oe = RegExp([be + "?" + ve + "+(?:['’](?:d|ll|m|re|s|t|ve))?(?=" + [le, be, "$"].join("|") + ")", Te + "+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=" + [le, be + Ee, "$"].join("|") + ")", be + "?" + Ee + "+(?:['’](?:d|ll|m|re|s|t|ve))?", be + "+(?:['’](?:D|LL|M|RE|S|T|VE))?", "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", pe, xe].join("|"), "g"),
Me = RegExp("[\\u200d\\ud800-\\udfff" + ue + "\\ufe0e\\ufe0f]"),
De = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,
Ne = ["Array", "Buffer", "DataView", "Date", "Error", "Float32Array", "Float64Array", "Function", "Int8Array", "Int16Array", "Int32Array", "Map", "Math", "Object", "Promise", "RegExp", "Set", "String", "Symbol", "TypeError", "Uint8Array", "Uint8ClampedArray", "Uint16Array", "Uint32Array", "WeakMap", "_", "clearTimeout", "isFinite", "parseInt", "setTimeout"],
Le = -1,
je = {};
je[b] = je[E] = je[T] = je[S] = je[R] = je[x] = je["[object Uint8ClampedArray]"] = je[k] = je[P] = !0, je[o] = je[a] = je[w] = je[s] = je[_] = je[c] = je[u] = je[h] = je[l] = je[f] = je[p] = je[g] = je[v] = je[m] = je[C] = !1;
var Fe = {};
Fe[o] = Fe[a] = Fe[w] = Fe[_] = Fe[s] = Fe[c] = Fe[b] = Fe[E] = Fe[T] = Fe[S] = Fe[R] = Fe[l] = Fe[f] = Fe[p] = Fe[g] = Fe[v] = Fe[m] = Fe[y] = Fe[x] = Fe["[object Uint8ClampedArray]"] = Fe[k] = Fe[P] = !0, Fe[u] = Fe[h] = Fe[C] = !1;
var Ve = {
"\\": "\\",
"'": "'",
"\n": "n",
"\r": "r",
"\u2028": "u2028",
"\u2029": "u2029"
},
Be = parseFloat,
Ue = parseInt,
We = "object" == typeof global && global && global.Object === Object && global,
qe = "object" == typeof self && self && self.Object === Object && self,
He = We || qe || Function("return this")(),
ze = "object" == typeof t && t && !t.nodeType && t,
Ge = ze && "object" == typeof e && e && !e.nodeType && e,
Ke = Ge && Ge.exports === ze,
Ye = Ke && We.process,
Je = function() {
try {
var e = Ge && Ge.require && Ge.require("util").types;
return e || Ye && Ye.binding && Ye.binding("util")
} catch (e) {}
}(),
$e = Je && Je.isArrayBuffer,
Xe = Je && Je.isDate,
Ze = Je && Je.isMap,
Qe = Je && Je.isRegExp,
et = Je && Je.isSet,
tt = Je && Je.isTypedArray;

function nt(e, t, n) {
switch (n.length) {
case 0:
return e.call(t);
case 1:
return e.call(t, n[0]);
case 2:
return e.call(t, n[0], n[1]);
case 3:
return e.call(t, n[0], n[1], n[2])
}
return e.apply(t, n)
}

function rt(e, t, n, r) {
for (var i = -1, o = null == e ? 0 : e.length; ++i < o;) {
var a = e[i];
t(r, a, n(a), e)
}
return r
}

function it(e, t) {
for (var n = -1, r = null == e ? 0 : e.length; ++n < r && !1 !== t(e[n], n, e););
return e
}

function ot(e, t) {
for (var n = null == e ? 0 : e.length; n-- && !1 !== t(e[n], n, e););
return e
}

function at(e, t) {
for (var n = -1, r = null == e ? 0 : e.length; ++n < r;)
if (!t(e[n], n, e)) return !1;
return !0
}

function st(e, t) {
for (var n = -1, r = null == e ? 0 : e.length, i = 0, o = []; ++n < r;) {
var a = e[n];
t(a, n, e) && (o[i++] = a)
}
return o
}

function ct(e, t) {
return !!(null == e ? 0 : e.length) && yt(e, t, 0) > -1
}

function ut(e, t, n) {
for (var r = -1, i = null == e ? 0 : e.length; ++r < i;)
if (n(t, e[r])) return !0;
return !1
}

function ht(e, t) {
for (var n = -1, r = null == e ? 0 : e.length, i = Array(r); ++n < r;) i[n] = t(e[n], n, e);
return i
}

function dt(e, t) {
for (var n = -1, r = t.length, i = e.length; ++n < r;) e[i + n] = t[n];
return e
}

function lt(e, t, n, r) {
var i = -1,
o = null == e ? 0 : e.length;
for (r && o && (n = e[++i]); ++i < o;) n = t(n, e[i], i, e);
return n
}

function ft(e, t, n, r) {
var i = null == e ? 0 : e.length;
for (r && i && (n = e[--i]); i--;) n = t(n, e[i], i, e);
return n
}

function pt(e, t) {
for (var n = -1, r = null == e ? 0 : e.length; ++n < r;)
if (t(e[n], n, e)) return !0;
return !1
}
var gt = bt("length");

function vt(e, t, n) {
var r;
return n(e, (function(e, n, i) {
if (t(e, n, i)) return r = n, !1
})), r
}

function mt(e, t, n, r) {
for (var i = e.length, o = n + (r ? 1 : -1); r ? o-- : ++o < i;)
if (t(e[o], o, e)) return o;
return -1
}

function yt(e, t, n) {
return t == t ? function(e, t, n) {
var r = n - 1,
i = e.length;
for (; ++r < i;)
if (e[r] === t) return r;
return -1
}(e, t, n) : mt(e, wt, n)
}

function Ct(e, t, n, r) {
for (var i = n - 1, o = e.length; ++i < o;)
if (r(e[i], t)) return i;
return -1
}

function wt(e) {
return e != e
}

function _t(e, t) {
var n = null == e ? 0 : e.length;
return n ? St(e, t) / n : NaN
}

function bt(e) {
return function(t) {
return null == t ? void 0 : t[e]
}
}

function Et(e) {
return function(t) {
return null == e ? void 0 : e[t]
}
}

function Tt(e, t, n, r, i) {
return i(e, (function(e, i, o) {
n = r ? (r = !1, e) : t(n, e, i, o)
})), n
}

function St(e, t) {
for (var n, r = -1, i = e.length; ++r < i;) {
var o = t(e[r]);
void 0 !== o && (n = void 0 === n ? o : n + o)
}
return n
}

function Rt(e, t) {
for (var n = -1, r = Array(e); ++n < e;) r[n] = t(n);
return r
}

function xt(e) {
return e ? e.slice(0, zt(e) + 1).replace(z, "") : e
}

function kt(e) {
return function(t) {
return e(t)
}
}

function Pt(e, t) {
return ht(t, (function(t) {
return e[t]
}))
}

function At(e, t) {
return e.has(t)
}

function It(e, t) {
for (var n = -1, r = e.length; ++n < r && yt(t, e[n], 0) > -1;);
return n
}

function Ot(e, t) {
for (var n = e.length; n-- && yt(t, e[n], 0) > -1;);
return n
}

function Mt(e, t) {
for (var n = e.length, r = 0; n--;) e[n] === t && ++r;
return r
}
var Dt = Et({
"À": "A",
"Á": "A",
"Â": "A",
"Ã": "A",
"Ä": "A",
"Å": "A",
"à": "a",
"á": "a",
"â": "a",
"ã": "a",
"ä": "a",
"å": "a",
"Ç": "C",
"ç": "c",
"Ð": "D",
"ð": "d",
"È": "E",
"É": "E",
"Ê": "E",
"Ë": "E",
"è": "e",
"é": "e",
"ê": "e",
"ë": "e",
"Ì": "I",
"Í": "I",
"Î": "I",
"Ï": "I",
"ì": "i",
"í": "i",
"î": "i",
"ï": "i",
"Ñ": "N",
"ñ": "n",
"Ò": "O",
"Ó": "O",
"Ô": "O",
"Õ": "O",
"Ö": "O",
"Ø": "O",
"ò": "o",
"ó": "o",
"ô": "o",
"õ": "o",
"ö": "o",
"ø": "o",
"Ù": "U",
"Ú": "U",
"Û": "U",
"Ü": "U",
"ù": "u",
"ú": "u",
"û": "u",
"ü": "u",
"Ý": "Y",
"ý": "y",
"ÿ": "y",
"Æ": "Ae",
"æ": "ae",
"Þ": "Th",
"þ": "th",
"ß": "ss",
"Ā": "A",
"Ă": "A",
"Ą": "A",
"ā": "a",
"ă": "a",
"ą": "a",
"Ć": "C",
"Ĉ": "C",
"Ċ": "C",
"Č": "C",
"ć": "c",
"ĉ": "c",
"ċ": "c",
"č": "c",
"Ď": "D",
"Đ": "D",
"ď": "d",
"đ": "d",
"Ē": "E",
"Ĕ": "E",
"Ė": "E",
"Ę": "E",
"Ě": "E",
"ē": "e",
"ĕ": "e",
"ė": "e",
"ę": "e",
"ě": "e",
"Ĝ": "G",
"Ğ": "G",
"Ġ": "G",
"Ģ": "G",
"ĝ": "g",
"ğ": "g",
"ġ": "g",
"ģ": "g",
"Ĥ": "H",
"Ħ": "H",
"ĥ": "h",
"ħ": "h",
"Ĩ": "I",
"Ī": "I",
"Ĭ": "I",
"Į": "I",
"İ": "I",
"ĩ": "i",
"ī": "i",
"ĭ": "i",
"į": "i",
"ı": "i",
"Ĵ": "J",
"ĵ": "j",
"Ķ": "K",
"ķ": "k",
"ĸ": "k",
"Ĺ": "L",
"Ļ": "L",
"Ľ": "L",
"Ŀ": "L",
"Ł": "L",
"ĺ": "l",
"ļ": "l",
"ľ": "l",
"ŀ": "l",
"ł": "l",
"Ń": "N",
"Ņ": "N",
"Ň": "N",
"Ŋ": "N",
"ń": "n",
"ņ": "n",
"ň": "n",
"ŋ": "n",
"Ō": "O",
"Ŏ": "O",
"Ő": "O",
"ō": "o",
"ŏ": "o",
"ő": "o",
"Ŕ": "R",
"Ŗ": "R",
"Ř": "R",
"ŕ": "r",
"ŗ": "r",
"ř": "r",
"Ś": "S",
"Ŝ": "S",
"Ş": "S",
"Š": "S",
"ś": "s",
"ŝ": "s",
"ş": "s",
"š": "s",
"Ţ": "T",
"Ť": "T",
"Ŧ": "T",
"ţ": "t",
"ť": "t",
"ŧ": "t",
"Ũ": "U",
"Ū": "U",
"Ŭ": "U",
"Ů": "U",
"Ű": "U",
"Ų": "U",
"ũ": "u",
"ū": "u",
"ŭ": "u",
"ů": "u",
"ű": "u",
"ų": "u",
"Ŵ": "W",
"ŵ": "w",
"Ŷ": "Y",
"ŷ": "y",
"Ÿ": "Y",
"Ź": "Z",
"Ż": "Z",
"Ž": "Z",
"ź": "z",
"ż": "z",
"ž": "z",
"IJ": "IJ",
"ij": "ij",
"Œ": "Oe",
"œ": "oe",
"ʼn": "'n",
"ſ": "s"
}),
Nt = Et({
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#39;"
});

function Lt(e) {
return "\\" + Ve[e]
}

function jt(e) {
return Me.test(e)
}

function Ft(e) {
var t = -1,
n = Array(e.size);
return e.forEach((function(e, r) {
n[++t] = [r, e]
})), n
}

function Vt(e, t) {
return function(n) {
return e(t(n))
}
}

function Bt(e, t) {
for (var n = -1, i = e.length, o = 0, a = []; ++n < i;) {
var s = e[n];
s !== t && s !== r || (e[n] = r, a[o++] = n)
}
return a
}

function Ut(e) {
var t = -1,
n = Array(e.size);
return e.forEach((function(e) {
n[++t] = e
})), n
}

function Wt(e) {
var t = -1,
n = Array(e.size);
return e.forEach((function(e) {
n[++t] = [e, e]
})), n
}

function qt(e) {
return jt(e) ? function(e) {
var t = Ie.lastIndex = 0;
for (; Ie.test(e);) ++t;
return t
}(e) : gt(e)
}

function Ht(e) {
return jt(e) ? function(e) {
return e.match(Ie) || []
}(e) : function(e) {
return e.split("")
}(e)
}

function zt(e) {
for (var t = e.length; t-- && G.test(e.charAt(t)););
return t
}
var Gt = Et({
"&amp;": "&",
"&lt;": "<",
"&gt;": ">",
"&quot;": '"',
"&#39;": "'"
});
var Kt = function e(t) {
var G, ue = (t = null == t ? He : Kt.defaults(He.Object(), t, Kt.pick(He, Ne))).Array,
he = t.Date,
de = t.Error,
le = t.Function,
fe = t.Math,
pe = t.Object,
ge = t.RegExp,
ve = t.String,
me = t.TypeError,
ye = ue.prototype,
Ce = le.prototype,
we = pe.prototype,
_e = t["__core-js_shared__"],
be = Ce.toString,
Ee = we.hasOwnProperty,
Te = 0,
Se = (G = /[^.]+$/.exec(_e && _e.keys && _e.keys.IE_PROTO || "")) ? "Symbol(src)_1." + G : "",
Re = we.toString,
xe = be.call(pe),
ke = He._,
Ie = ge("^" + be.call(Ee).replace(q, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"),
Me = Ke ? t.Buffer : void 0,
Ve = t.Symbol,
We = t.Uint8Array,
qe = Me ? Me.allocUnsafe : void 0,
ze = Vt(pe.getPrototypeOf, pe),
Ge = pe.create,
Ye = we.propertyIsEnumerable,
Je = ye.splice,
gt = Ve ? Ve.isConcatSpreadable : void 0,
Et = Ve ? Ve.iterator : void 0,
Yt = Ve ? Ve.toStringTag : void 0,
Jt = function() {
try {
var e = eo(pe, "defineProperty");
return e({}, "", {}), e
} catch (e) {}
}(),
$t = t.clearTimeout !== He.clearTimeout && t.clearTimeout,
Xt = he && he.now !== He.Date.now && he.now,
Zt = t.setTimeout !== He.setTimeout && t.setTimeout,
Qt = fe.ceil,
en = fe.floor,
tn = pe.getOwnPropertySymbols,
nn = Me ? Me.isBuffer : void 0,
rn = t.isFinite,
on = ye.join,
an = Vt(pe.keys, pe),
sn = fe.max,
cn = fe.min,
un = he.now,
hn = t.parseInt,
dn = fe.random,
ln = ye.reverse,
fn = eo(t, "DataView"),
pn = eo(t, "Map"),
gn = eo(t, "Promise"),
vn = eo(t, "Set"),
mn = eo(t, "WeakMap"),
yn = eo(pe, "create"),
Cn = mn && new mn,
wn = {},
_n = ko(fn),
bn = ko(pn),
En = ko(gn),
Tn = ko(vn),
Sn = ko(mn),
Rn = Ve ? Ve.prototype : void 0,
xn = Rn ? Rn.valueOf : void 0,
kn = Rn ? Rn.toString : void 0;

function Pn(e) {
if (za(e) && !Da(e) && !(e instanceof Mn)) {
if (e instanceof On) return e;
if (Ee.call(e, "__wrapped__")) return Po(e)
}
return new On(e)
}
var An = function() {
function e() {}
return function(t) {
if (!Ha(t)) return {};
if (Ge) return Ge(t);
e.prototype = t;
var n = new e;
return e.prototype = void 0, n
}
}();

function In() {}

function On(e, t) {
this.__wrapped__ = e, this.__actions__ = [], this.__chain__ = !!t, this.__index__ = 0, this.__values__ = void 0
}

function Mn(e) {
this.__wrapped__ = e, this.__actions__ = [], this.__dir__ = 1, this.__filtered__ = !1, this.__iteratees__ = [], this.__takeCount__ = 4294967295, this.__views__ = []
}

function Dn(e) {
var t = -1,
n = null == e ? 0 : e.length;
for (this.clear(); ++t < n;) {
var r = e[t];
this.set(r[0], r[1])
}
}

function Nn(e) {
var t = -1,
n = null == e ? 0 : e.length;
for (this.clear(); ++t < n;) {
var r = e[t];
this.set(r[0], r[1])
}
}

function Ln(e) {
var t = -1,
n = null == e ? 0 : e.length;
for (this.clear(); ++t < n;) {
var r = e[t];
this.set(r[0], r[1])
}
}

function jn(e) {
var t = -1,
n = null == e ? 0 : e.length;
for (this.__data__ = new Ln; ++t < n;) this.add(e[t])
}

function Fn(e) {
var t = this.__data__ = new Nn(e);
this.size = t.size
}

function Vn(e, t) {
var n = Da(e),
r = !n && Ma(e),
i = !n && !r && Fa(e),
o = !n && !r && !i && Qa(e),
a = n || r || i || o,
s = a ? Rt(e.length, ve) : [],
c = s.length;
for (var u in e) !t && !Ee.call(e, u) || a && ("length" == u || i && ("offset" == u || "parent" == u) || o && ("buffer" == u || "byteLength" == u || "byteOffset" == u) || so(u, c)) || s.push(u);
return s
}

function Bn(e) {
var t = e.length;
return t ? e[jr(0, t - 1)] : void 0
}

function Un(e, t) {
return So(yi(e), $n(t, 0, e.length))
}

function Wn(e) {
return So(yi(e))
}

function qn(e, t, n) {
(void 0 !== n && !Aa(e[t], n) || void 0 === n && !(t in e)) && Yn(e, t, n)
}

function Hn(e, t, n) {
var r = e[t];
Ee.call(e, t) && Aa(r, n) && (void 0 !== n || t in e) || Yn(e, t, n)
}

function zn(e, t) {
for (var n = e.length; n--;)
if (Aa(e[n][0], t)) return n;
return -1
}

function Gn(e, t, n, r) {
return tr(e, (function(e, i, o) {
t(r, e, n(e), o)
})), r
}

function Kn(e, t) {
return e && Ci(t, _s(t), e)
}

function Yn(e, t, n) {
"__proto__" == t && Jt ? Jt(e, t, {
configurable: !0,
enumerable: !0,
value: n,
writable: !0
}) : e[t] = n
}

function Jn(e, t) {
for (var n = -1, r = t.length, i = ue(r), o = null == e; ++n < r;) i[n] = o ? void 0 : vs(e, t[n]);
return i
}

function $n(e, t, n) {
return e == e && (void 0 !== n && (e = e <= n ? e : n), void 0 !== t && (e = e >= t ? e : t)), e
}

function Xn(e, t, n, r, i, a) {
var u, C = 1 & t,
A = 2 & t,
I = 4 & t;
if (n && (u = i ? n(e, r, i, a) : n(e)), void 0 !== u) return u;
if (!Ha(e)) return e;
var O = Da(e);
if (O) {
if (u = function(e) {
var t = e.length,
n = new e.constructor(t);
t && "string" == typeof e[0] && Ee.call(e, "index") && (n.index = e.index, n.input = e.input);
return n
}(e), !C) return yi(e, u)
} else {
var M = ro(e),
D = M == h || M == d;
if (Fa(e)) return li(e, C);
if (M == p || M == o || D && !i) {
if (u = A || D ? {} : oo(e), !C) return A ? function(e, t) {
return Ci(e, no(e), t)
}(e, function(e, t) {
return e && Ci(t, bs(t), e)
}(u, e)) : function(e, t) {
return Ci(e, to(e), t)
}(e, Kn(u, e))
} else {
if (!Fe[M]) return i ? e : {};
u = function(e, t, n) {
var r = e.constructor;
switch (t) {
case w:
return fi(e);
case s:
case c:
return new r(+e);
case _:
return function(e, t) {
var n = t ? fi(e.buffer) : e.buffer;
return new e.constructor(n, e.byteOffset, e.byteLength)
}(e, n);
case b:
case E:
case T:
case S:
case R:
case x:
case "[object Uint8ClampedArray]":
case k:
case P:
return pi(e, n);
case l:
return new r;
case f:
case m:
return new r(e);
case g:
return function(e) {
var t = new e.constructor(e.source, ee.exec(e));
return t.lastIndex = e.lastIndex, t
}(e);
case v:
return new r;
case y:
return i = e, xn ? pe(xn.call(i)) : {}
}
var i
}(e, M, C)
}
}
a || (a = new Fn);
var N = a.get(e);
if (N) return N;
a.set(e, u), $a(e) ? e.forEach((function(r) {
u.add(Xn(r, t, n, r, e, a))
})) : Ga(e) && e.forEach((function(r, i) {
u.set(i, Xn(r, t, n, i, e, a))
}));
var L = O ? void 0 : (I ? A ? Ki : Gi : A ? bs : _s)(e);
return it(L || e, (function(r, i) {
L && (r = e[i = r]), Hn(u, i, Xn(r, t, n, i, e, a))
})), u
}

function Zn(e, t, n) {
var r = n.length;
if (null == e) return !r;
for (e = pe(e); r--;) {
var i = n[r],
o = t[i],
a = e[i];
if (void 0 === a && !(i in e) || !o(a)) return !1
}
return !0
}

function Qn(e, t, r) {
if ("function" != typeof e) throw new me(n);
return _o((function() {
e.apply(void 0, r)
}), t)
}

function er(e, t, n, r) {
var i = -1,
o = ct,
a = !0,
s = e.length,
c = [],
u = t.length;
if (!s) return c;
n && (t = ht(t, kt(n))), r ? (o = ut, a = !1) : t.length >= 200 && (o = At, a = !1, t = new jn(t));
e: for (; ++i < s;) {
var h = e[i],
d = null == n ? h : n(h);
if (h = r || 0 !== h ? h : 0, a && d == d) {
for (var l = u; l--;)
if (t[l] === d) continue e;
c.push(h)
} else o(t, d, r) || c.push(h)
}
return c
}
Pn.templateSettings = {
escape: j,
evaluate: F,
interpolate: V,
variable: "",
imports: {
_: Pn
}
}, Pn.prototype = In.prototype, Pn.prototype.constructor = Pn, On.prototype = An(In.prototype), On.prototype.constructor = On, Mn.prototype = An(In.prototype), Mn.prototype.constructor = Mn, Dn.prototype.clear = function() {
this.__data__ = yn ? yn(null) : {}, this.size = 0
}, Dn.prototype.delete = function(e) {
var t = this.has(e) && delete this.__data__[e];
return this.size -= t ? 1 : 0, t
}, Dn.prototype.get = function(e) {
var t = this.__data__;
if (yn) {
var n = t[e];
return "__lodash_hash_undefined__" === n ? void 0 : n
}
return Ee.call(t, e) ? t[e] : void 0
}, Dn.prototype.has = function(e) {
var t = this.__data__;
return yn ? void 0 !== t[e] : Ee.call(t, e)
}, Dn.prototype.set = function(e, t) {
var n = this.__data__;
return this.size += this.has(e) ? 0 : 1, n[e] = yn && void 0 === t ? "__lodash_hash_undefined__" : t, this
}, Nn.prototype.clear = function() {
this.__data__ = [], this.size = 0
}, Nn.prototype.delete = function(e) {
var t = this.__data__,
n = zn(t, e);
return !(n < 0) && (n == t.length - 1 ? t.pop() : Je.call(t, n, 1), --this.size, !0)
}, Nn.prototype.get = function(e) {
var t = this.__data__,
n = zn(t, e);
return n < 0 ? void 0 : t[n][1]
}, Nn.prototype.has = function(e) {
return zn(this.__data__, e) > -1
}, Nn.prototype.set = function(e, t) {
var n = this.__data__,
r = zn(n, e);
return r < 0 ? (++this.size, n.push([e, t])) : n[r][1] = t, this
}, Ln.prototype.clear = function() {
this.size = 0, this.__data__ = {
hash: new Dn,
map: new(pn || Nn),
string: new Dn
}
}, Ln.prototype.delete = function(e) {
var t = Zi(this, e).delete(e);
return this.size -= t ? 1 : 0, t
}, Ln.prototype.get = function(e) {
return Zi(this, e).get(e)
}, Ln.prototype.has = function(e) {
return Zi(this, e).has(e)
}, Ln.prototype.set = function(e, t) {
var n = Zi(this, e),
r = n.size;
return n.set(e, t), this.size += n.size == r ? 0 : 1, this
}, jn.prototype.add = jn.prototype.push = function(e) {
return this.__data__.set(e, "__lodash_hash_undefined__"), this
}, jn.prototype.has = function(e) {
return this.__data__.has(e)
}, Fn.prototype.clear = function() {
this.__data__ = new Nn, this.size = 0
}, Fn.prototype.delete = function(e) {
var t = this.__data__,
n = t.delete(e);
return this.size = t.size, n
}, Fn.prototype.get = function(e) {
return this.__data__.get(e)
}, Fn.prototype.has = function(e) {
return this.__data__.has(e)
}, Fn.prototype.set = function(e, t) {
var n = this.__data__;
if (n instanceof Nn) {
var r = n.__data__;
if (!pn || r.length < 199) return r.push([e, t]), this.size = ++n.size, this;
n = this.__data__ = new Ln(r)
}
return n.set(e, t), this.size = n.size, this
};
var tr = bi(ur),
nr = bi(hr, !0);

function rr(e, t) {
var n = !0;
return tr(e, (function(e, r, i) {
return n = !!t(e, r, i)
})), n
}

function ir(e, t, n) {
for (var r = -1, i = e.length; ++r < i;) {
var o = e[r],
a = t(o);
if (null != a && (void 0 === s ? a == a && !Za(a) : n(a, s))) var s = a,
c = o
}
return c
}

function or(e, t) {
var n = [];
return tr(e, (function(e, r, i) {
t(e, r, i) && n.push(e)
})), n
}

function ar(e, t, n, r, i) {
var o = -1,
a = e.length;
for (n || (n = ao), i || (i = []); ++o < a;) {
var s = e[o];
t > 0 && n(s) ? t > 1 ? ar(s, t - 1, n, r, i) : dt(i, s) : r || (i[i.length] = s)
}
return i
}
var sr = Ei(),
cr = Ei(!0);

function ur(e, t) {
return e && sr(e, t, _s)
}

function hr(e, t) {
return e && cr(e, t, _s)
}

function dr(e, t) {
return st(t, (function(t) {
return Ua(e[t])
}))
}

function lr(e, t) {
for (var n = 0, r = (t = ci(t, e)).length; null != e && n < r;) e = e[xo(t[n++])];
return n && n == r ? e : void 0
}

function fr(e, t, n) {
var r = t(e);
return Da(e) ? r : dt(r, n(e))
}

function pr(e) {
return null == e ? void 0 === e ? "[object Undefined]" : "[object Null]" : Yt && Yt in pe(e) ? function(e) {
var t = Ee.call(e, Yt),
n = e[Yt];
try {
e[Yt] = void 0;
var r = !0
} catch (e) {}
var i = Re.call(e);
r && (t ? e[Yt] = n : delete e[Yt]);
return i
}(e) : function(e) {
return Re.call(e)
}(e)
}

function gr(e, t) {
return e > t
}

function vr(e, t) {
return null != e && Ee.call(e, t)
}

function mr(e, t) {
return null != e && t in pe(e)
}

function yr(e, t, n) {
for (var r = n ? ut : ct, i = e[0].length, o = e.length, a = o, s = ue(o), c = 1 / 0, u = []; a--;) {
var h = e[a];
a && t && (h = ht(h, kt(t))), c = cn(h.length, c), s[a] = !n && (t || i >= 120 && h.length >= 120) ? new jn(a && h) : void 0
}
h = e[0];
var d = -1,
l = s[0];
e: for (; ++d < i && u.length < c;) {
var f = h[d],
p = t ? t(f) : f;
if (f = n || 0 !== f ? f : 0, !(l ? At(l, p) : r(u, p, n))) {
for (a = o; --a;) {
var g = s[a];
if (!(g ? At(g, p) : r(e[a], p, n))) continue e
}
l && l.push(p), u.push(f)
}
}
return u
}

function Cr(e, t, n) {
var r = null == (e = mo(e, t = ci(t, e))) ? e : e[xo(Bo(t))];
return null == r ? void 0 : nt(r, e, n)
}

function wr(e) {
return za(e) && pr(e) == o
}

function _r(e, t, n, r, i) {
return e === t || (null == e || null == t || !za(e) && !za(t) ? e != e && t != t : function(e, t, n, r, i, h) {
var d = Da(e),
C = Da(t),
b = d ? a : ro(e),
E = C ? a : ro(t),
T = (b = b == o ? p : b) == p,
S = (E = E == o ? p : E) == p,
R = b == E;
if (R && Fa(e)) {
if (!Fa(t)) return !1;
d = !0, T = !1
}
if (R && !T) return h || (h = new Fn), d || Qa(e) ? Hi(e, t, n, r, i, h) : function(e, t, n, r, i, o, a) {
switch (n) {
case _:
if (e.byteLength != t.byteLength || e.byteOffset != t.byteOffset) return !1;
e = e.buffer, t = t.buffer;
case w:
return !(e.byteLength != t.byteLength || !o(new We(e), new We(t)));
case s:
case c:
case f:
return Aa(+e, +t);
case u:
return e.name == t.name && e.message == t.message;
case g:
case m:
return e == t + "";
case l:
var h = Ft;
case v:
var d = 1 & r;
if (h || (h = Ut), e.size != t.size && !d) return !1;
var p = a.get(e);
if (p) return p == t;
r |= 2, a.set(e, t);
var C = Hi(h(e), h(t), r, i, o, a);
return a.delete(e), C;
case y:
if (xn) return xn.call(e) == xn.call(t)
}
return !1
}(e, t, b, n, r, i, h);
if (!(1 & n)) {
var x = T && Ee.call(e, "__wrapped__"),
k = S && Ee.call(t, "__wrapped__");
if (x || k) {
var P = x ? e.value() : e,
A = k ? t.value() : t;
return h || (h = new Fn), i(P, A, n, r, h)
}
}
if (!R) return !1;
return h || (h = new Fn),
function(e, t, n, r, i, o) {
var a = 1 & n,
s = Gi(e),
c = s.length,
u = Gi(t).length;
if (c != u && !a) return !1;
var h = c;
for (; h--;) {
var d = s[h];
if (!(a ? d in t : Ee.call(t, d))) return !1
}
var l = o.get(e),
f = o.get(t);
if (l && f) return l == t && f == e;
var p = !0;
o.set(e, t), o.set(t, e);
var g = a;
for (; ++h < c;) {
d = s[h];
var v = e[d],
m = t[d];
if (r) var y = a ? r(m, v, d, t, e, o) : r(v, m, d, e, t, o);
if (!(void 0 === y ? v === m || i(v, m, n, r, o) : y)) {
p = !1;
break
}
g || (g = "constructor" == d)
}
if (p && !g) {
var C = e.constructor,
w = t.constructor;
C == w || !("constructor" in e) || !("constructor" in t) || "function" == typeof C && C instanceof C && "function" == typeof w && w instanceof w || (p = !1)
}
return o.delete(e), o.delete(t), p
}(e, t, n, r, i, h)
}(e, t, n, r, _r, i))
}

function br(e, t, n, r) {
var i = n.length,
o = i,
a = !r;
if (null == e) return !o;
for (e = pe(e); i--;) {
var s = n[i];
if (a && s[2] ? s[1] !== e[s[0]] : !(s[0] in e)) return !1
}
for (; ++i < o;) {
var c = (s = n[i])[0],
u = e[c],
h = s[1];
if (a && s[2]) {
if (void 0 === u && !(c in e)) return !1
} else {
var d = new Fn;
if (r) var l = r(u, h, c, e, t, d);
if (!(void 0 === l ? _r(h, u, 3, r, d) : l)) return !1
}
}
return !0
}

function Er(e) {
return !(!Ha(e) || (t = e, Se && Se in t)) && (Ua(e) ? Ie : re).test(ko(e));
var t
}

function Tr(e) {
return "function" == typeof e ? e : null == e ? Ks : "object" == typeof e ? Da(e) ? Ar(e[0], e[1]) : Pr(e) : nc(e)
}

function Sr(e) {
if (!fo(e)) return an(e);
var t = [];
for (var n in pe(e)) Ee.call(e, n) && "constructor" != n && t.push(n);
return t
}

function Rr(e) {
if (!Ha(e)) return function(e) {
var t = [];
if (null != e)
for (var n in pe(e)) t.push(n);
return t
}(e);
var t = fo(e),
n = [];
for (var r in e)("constructor" != r || !t && Ee.call(e, r)) && n.push(r);
return n
}

function xr(e, t) {
return e < t
}

function kr(e, t) {
var n = -1,
r = La(e) ? ue(e.length) : [];
return tr(e, (function(e, i, o) {
r[++n] = t(e, i, o)
})), r
}

function Pr(e) {
var t = Qi(e);
return 1 == t.length && t[0][2] ? go(t[0][0], t[0][1]) : function(n) {
return n === e || br(n, e, t)
}
}

function Ar(e, t) {
return uo(e) && po(t) ? go(xo(e), t) : function(n) {
var r = vs(n, e);
return void 0 === r && r === t ? ms(n, e) : _r(t, r, 3)
}
}

function Ir(e, t, n, r, i) {
e !== t && sr(t, (function(o, a) {
if (i || (i = new Fn), Ha(o)) ! function(e, t, n, r, i, o, a) {
var s = Co(e, n),
c = Co(t, n),
u = a.get(c);
if (u) return void qn(e, n, u);
var h = o ? o(s, c, n + "", e, t, a) : void 0,
d = void 0 === h;
if (d) {
var l = Da(c),
f = !l && Fa(c),
p = !l && !f && Qa(c);
h = c, l || f || p ? Da(s) ? h = s : ja(s) ? h = yi(s) : f ? (d = !1, h = li(c, !0)) : p ? (d = !1, h = pi(c, !0)) : h = [] : Ya(c) || Ma(c) ? (h = s, Ma(s) ? h = ss(s) : Ha(s) && !Ua(s) || (h = oo(c))) : d = !1
}
d && (a.set(c, h), i(h, c, r, o, a), a.delete(c));
qn(e, n, h)
}(e, t, a, n, Ir, r, i);
else {
var s = r ? r(Co(e, a), o, a + "", e, t, i) : void 0;
void 0 === s && (s = o), qn(e, a, s)
}
}), bs)
}

function Or(e, t) {
var n = e.length;
if (n) return so(t += t < 0 ? n : 0, n) ? e[t] : void 0
}

function Mr(e, t, n) {
t = t.length ? ht(t, (function(e) {
return Da(e) ? function(t) {
return lr(t, 1 === e.length ? e[0] : e)
} : e
})) : [Ks];
var r = -1;
return t = ht(t, kt(Xi())),
function(e, t) {
var n = e.length;
for (e.sort(t); n--;) e[n] = e[n].value;
return e
}(kr(e, (function(e, n, i) {
return {
criteria: ht(t, (function(t) {
return t(e)
})),
index: ++r,
value: e
}
})), (function(e, t) {
return function(e, t, n) {
var r = -1,
i = e.criteria,
o = t.criteria,
a = i.length,
s = n.length;
for (; ++r < a;) {
var c = gi(i[r], o[r]);
if (c) {
if (r >= s) return c;
var u = n[r];
return c * ("desc" == u ? -1 : 1)
}
}
return e.index - t.index
}(e, t, n)
}))
}

function Dr(e, t, n) {
for (var r = -1, i = t.length, o = {}; ++r < i;) {
var a = t[r],
s = lr(e, a);
n(s, a) && Wr(o, ci(a, e), s)
}
return o
}

function Nr(e, t, n, r) {
var i = r ? Ct : yt,
o = -1,
a = t.length,
s = e;
for (e === t && (t = yi(t)), n && (s = ht(e, kt(n))); ++o < a;)
for (var c = 0, u = t[o], h = n ? n(u) : u;
(c = i(s, h, c, r)) > -1;) s !== e && Je.call(s, c, 1), Je.call(e, c, 1);
return e
}

function Lr(e, t) {
for (var n = e ? t.length : 0, r = n - 1; n--;) {
var i = t[n];
if (n == r || i !== o) {
var o = i;
so(i) ? Je.call(e, i, 1) : ei(e, i)
}
}
return e
}

function jr(e, t) {
return e + en(dn() * (t - e + 1))
}

function Fr(e, t) {
var n = "";
if (!e || t < 1 || t > 9007199254740991) return n;
do {
t % 2 && (n += e), (t = en(t / 2)) && (e += e)
} while (t);
return n
}

function Vr(e, t) {
return bo(vo(e, t, Ks), e + "")
}

function Br(e) {
return Bn(As(e))
}

function Ur(e, t) {
var n = As(e);
return So(n, $n(t, 0, n.length))
}

function Wr(e, t, n, r) {
if (!Ha(e)) return e;
for (var i = -1, o = (t = ci(t, e)).length, a = o - 1, s = e; null != s && ++i < o;) {
var c = xo(t[i]),
u = n;
if ("__proto__" === c || "constructor" === c || "prototype" === c) return e;
if (i != a) {
var h = s[c];
void 0 === (u = r ? r(h, c, s) : void 0) && (u = Ha(h) ? h : so(t[i + 1]) ? [] : {})
}
Hn(s, c, u), s = s[c]
}
return e
}
var qr = Cn ? function(e, t) {
return Cn.set(e, t), e
} : Ks,
Hr = Jt ? function(e, t) {
return Jt(e, "toString", {
configurable: !0,
enumerable: !1,
value: Hs(t),
writable: !0
})
} : Ks;

function zr(e) {
return So(As(e))
}

function Gr(e, t, n) {
var r = -1,
i = e.length;
t < 0 && (t = -t > i ? 0 : i + t), (n = n > i ? i : n) < 0 && (n += i), i = t > n ? 0 : n - t >>> 0, t >>>= 0;
for (var o = ue(i); ++r < i;) o[r] = e[r + t];
return o
}

function Kr(e, t) {
var n;
return tr(e, (function(e, r, i) {
return !(n = t(e, r, i))
})), !!n
}

function Yr(e, t, n) {
var r = 0,
i = null == e ? r : e.length;
if ("number" == typeof t && t == t && i <= 2147483647) {
for (; r < i;) {
var o = r + i >>> 1,
a = e[o];
null !== a && !Za(a) && (n ? a <= t : a < t) ? r = o + 1 : i = o
}
return i
}
return Jr(e, t, Ks, n)
}

function Jr(e, t, n, r) {
var i = 0,
o = null == e ? 0 : e.length;
if (0 === o) return 0;
for (var a = (t = n(t)) != t, s = null === t, c = Za(t), u = void 0 === t; i < o;) {
var h = en((i + o) / 2),
d = n(e[h]),
l = void 0 !== d,
f = null === d,
p = d == d,
g = Za(d);
if (a) var v = r || p;
else v = u ? p && (r || l) : s ? p && l && (r || !f) : c ? p && l && !f && (r || !g) : !f && !g && (r ? d <= t : d < t);
v ? i = h + 1 : o = h
}
return cn(o, 4294967294)
}

function $r(e, t) {
for (var n = -1, r = e.length, i = 0, o = []; ++n < r;) {
var a = e[n],
s = t ? t(a) : a;
if (!n || !Aa(s, c)) {
var c = s;
o[i++] = 0 === a ? 0 : a
}
}
return o
}

function Xr(e) {
return "number" == typeof e ? e : Za(e) ? NaN : +e
}

function Zr(e) {
if ("string" == typeof e) return e;
if (Da(e)) return ht(e, Zr) + "";
if (Za(e)) return kn ? kn.call(e) : "";
var t = e + "";
return "0" == t && 1 / e == -1 / 0 ? "-0" : t
}

function Qr(e, t, n) {
var r = -1,
i = ct,
o = e.length,
a = !0,
s = [],
c = s;
if (n) a = !1, i = ut;
else if (o >= 200) {
var u = t ? null : Fi(e);
if (u) return Ut(u);
a = !1, i = At, c = new jn
} else c = t ? [] : s;
e: for (; ++r < o;) {
var h = e[r],
d = t ? t(h) : h;
if (h = n || 0 !== h ? h : 0, a && d == d) {
for (var l = c.length; l--;)
if (c[l] === d) continue e;
t && c.push(d), s.push(h)
} else i(c, d, n) || (c !== s && c.push(d), s.push(h))
}
return s
}

function ei(e, t) {
return null == (e = mo(e, t = ci(t, e))) || delete e[xo(Bo(t))]
}

function ti(e, t, n, r) {
return Wr(e, t, n(lr(e, t)), r)
}

function ni(e, t, n, r) {
for (var i = e.length, o = r ? i : -1;
(r ? o-- : ++o < i) && t(e[o], o, e););
return n ? Gr(e, r ? 0 : o, r ? o + 1 : i) : Gr(e, r ? o + 1 : 0, r ? i : o)
}

function ri(e, t) {
var n = e;
return n instanceof Mn && (n = n.value()), lt(t, (function(e, t) {
return t.func.apply(t.thisArg, dt([e], t.args))
}), n)
}

function ii(e, t, n) {
var r = e.length;
if (r < 2) return r ? Qr(e[0]) : [];
for (var i = -1, o = ue(r); ++i < r;)
for (var a = e[i], s = -1; ++s < r;) s != i && (o[i] = er(o[i] || a, e[s], t, n));
return Qr(ar(o, 1), t, n)
}

function oi(e, t, n) {
for (var r = -1, i = e.length, o = t.length, a = {}; ++r < i;) {
var s = r < o ? t[r] : void 0;
n(a, e[r], s)
}
return a
}

function ai(e) {
return ja(e) ? e : []
}

function si(e) {
return "function" == typeof e ? e : Ks
}

function ci(e, t) {
return Da(e) ? e : uo(e, t) ? [e] : Ro(cs(e))
}
var ui = Vr;

function hi(e, t, n) {
var r = e.length;
return n = void 0 === n ? r : n, !t && n >= r ? e : Gr(e, t, n)
}
var di = $t || function(e) {
return He.clearTimeout(e)
};

function li(e, t) {
if (t) return e.slice();
var n = e.length,
r = qe ? qe(n) : new e.constructor(n);
return e.copy(r), r
}

function fi(e) {
var t = new e.constructor(e.byteLength);
return new We(t).set(new We(e)), t
}

function pi(e, t) {
var n = t ? fi(e.buffer) : e.buffer;
return new e.constructor(n, e.byteOffset, e.length)
}

function gi(e, t) {
if (e !== t) {
var n = void 0 !== e,
r = null === e,
i = e == e,
o = Za(e),
a = void 0 !== t,
s = null === t,
c = t == t,
u = Za(t);
if (!s && !u && !o && e > t || o && a && c && !s && !u || r && a && c || !n && c || !i) return 1;
if (!r && !o && !u && e < t || u && n && i && !r && !o || s && n && i || !a && i || !c) return -1
}
return 0
}

function vi(e, t, n, r) {
for (var i = -1, o = e.length, a = n.length, s = -1, c = t.length, u = sn(o - a, 0), h = ue(c + u), d = !r; ++s < c;) h[s] = t[s];
for (; ++i < a;)(d || i < o) && (h[n[i]] = e[i]);
for (; u--;) h[s++] = e[i++];
return h
}

function mi(e, t, n, r) {
for (var i = -1, o = e.length, a = -1, s = n.length, c = -1, u = t.length, h = sn(o - s, 0), d = ue(h + u), l = !r; ++i < h;) d[i] = e[i];
for (var f = i; ++c < u;) d[f + c] = t[c];
for (; ++a < s;)(l || i < o) && (d[f + n[a]] = e[i++]);
return d
}

function yi(e, t) {
var n = -1,
r = e.length;
for (t || (t = ue(r)); ++n < r;) t[n] = e[n];
return t
}

function Ci(e, t, n, r) {
var i = !n;
n || (n = {});
for (var o = -1, a = t.length; ++o < a;) {
var s = t[o],
c = r ? r(n[s], e[s], s, n, e) : void 0;
void 0 === c && (c = e[s]), i ? Yn(n, s, c) : Hn(n, s, c)
}
return n
}

function wi(e, t) {
return function(n, r) {
var i = Da(n) ? rt : Gn,
o = t ? t() : {};
return i(n, e, Xi(r, 2), o)
}
}

function _i(e) {
return Vr((function(t, n) {
var r = -1,
i = n.length,
o = i > 1 ? n[i - 1] : void 0,
a = i > 2 ? n[2] : void 0;
for (o = e.length > 3 && "function" == typeof o ? (i--, o) : void 0, a && co(n[0], n[1], a) && (o = i < 3 ? void 0 : o, i = 1), t = pe(t); ++r < i;) {
var s = n[r];
s && e(t, s, r, o)
}
return t
}))
}

function bi(e, t) {
return function(n, r) {
if (null == n) return n;
if (!La(n)) return e(n, r);
for (var i = n.length, o = t ? i : -1, a = pe(n);
(t ? o-- : ++o < i) && !1 !== r(a[o], o, a););
return n
}
}

function Ei(e) {
return function(t, n, r) {
for (var i = -1, o = pe(t), a = r(t), s = a.length; s--;) {
var c = a[e ? s : ++i];
if (!1 === n(o[c], c, o)) break
}
return t
}
}

function Ti(e) {
return function(t) {
var n = jt(t = cs(t)) ? Ht(t) : void 0,
r = n ? n[0] : t.charAt(0),
i = n ? hi(n, 1).join("") : t.slice(1);
return r[e]() + i
}
}

function Si(e) {
return function(t) {
return lt(Us(Ms(t).replace(Pe, "")), e, "")
}
}

function Ri(e) {
return function() {
var t = arguments;
switch (t.length) {
case 0:
return new e;
case 1:
return new e(t[0]);
case 2:
return new e(t[0], t[1]);
case 3:
return new e(t[0], t[1], t[2]);
case 4:
return new e(t[0], t[1], t[2], t[3]);
case 5:
return new e(t[0], t[1], t[2], t[3], t[4]);
case 6:
return new e(t[0], t[1], t[2], t[3], t[4], t[5]);
case 7:
return new e(t[0], t[1], t[2], t[3], t[4], t[5], t[6])
}
var n = An(e.prototype),
r = e.apply(n, t);
return Ha(r) ? r : n
}
}

function xi(e) {
return function(t, n, r) {
var i = pe(t);
if (!La(t)) {
var o = Xi(n, 3);
t = _s(t), n = function(e) {
return o(i[e], e, i)
}
}
var a = e(t, n, r);
return a > -1 ? i[o ? t[a] : a] : void 0
}
}

function ki(e) {
return zi((function(t) {
var r = t.length,
i = r,
o = On.prototype.thru;
for (e && t.reverse(); i--;) {
var a = t[i];
if ("function" != typeof a) throw new me(n);
if (o && !s && "wrapper" == Ji(a)) var s = new On([], !0)
}
for (i = s ? i : r; ++i < r;) {
var c = Ji(a = t[i]),
u = "wrapper" == c ? Yi(a) : void 0;
s = u && ho(u[0]) && 424 == u[1] && !u[4].length && 1 == u[9] ? s[Ji(u[0])].apply(s, u[3]) : 1 == a.length && ho(a) ? s[c]() : s.thru(a)
}
return function() {
var e = arguments,
n = e[0];
if (s && 1 == e.length && Da(n)) return s.plant(n).value();
for (var i = 0, o = r ? t[i].apply(this, e) : n; ++i < r;) o = t[i].call(this, o);
return o
}
}))
}

function Pi(e, t, n, r, i, o, a, s, c, u) {
var h = 128 & t,
d = 1 & t,
l = 2 & t,
f = 24 & t,
p = 512 & t,
g = l ? void 0 : Ri(e);
return function v() {
for (var m = arguments.length, y = ue(m), C = m; C--;) y[C] = arguments[C];
if (f) var w = $i(v),
_ = Mt(y, w);
if (r && (y = vi(y, r, i, f)), o && (y = mi(y, o, a, f)), m -= _, f && m < u) {
var b = Bt(y, w);
return Li(e, t, Pi, v.placeholder, n, y, b, s, c, u - m)
}
var E = d ? n : this,
T = l ? E[e] : e;
return m = y.length, s ? y = yo(y, s) : p && m > 1 && y.reverse(), h && c < m && (y.length = c), this && this !== He && this instanceof v && (T = g || Ri(T)), T.apply(E, y)
}
}

function Ai(e, t) {
return function(n, r) {
return function(e, t, n, r) {
return ur(e, (function(e, i, o) {
t(r, n(e), i, o)
})), r
}(n, e, t(r), {})
}
}

function Ii(e, t) {
return function(n, r) {
var i;
if (void 0 === n && void 0 === r) return t;
if (void 0 !== n && (i = n), void 0 !== r) {
if (void 0 === i) return r;
"string" == typeof n || "string" == typeof r ? (n = Zr(n), r = Zr(r)) : (n = Xr(n), r = Xr(r)), i = e(n, r)
}
return i
}
}

function Oi(e) {
return zi((function(t) {
return t = ht(t, kt(Xi())), Vr((function(n) {
var r = this;
return e(t, (function(e) {
return nt(e, r, n)
}))
}))
}))
}

function Mi(e, t) {
var n = (t = void 0 === t ? " " : Zr(t)).length;
if (n < 2) return n ? Fr(t, e) : t;
var r = Fr(t, Qt(e / qt(t)));
return jt(t) ? hi(Ht(r), 0, e).join("") : r.slice(0, e)
}

function Di(e) {
return function(t, n, r) {
return r && "number" != typeof r && co(t, n, r) && (n = r = void 0), t = rs(t), void 0 === n ? (n = t, t = 0) : n = rs(n),
function(e, t, n, r) {
for (var i = -1, o = sn(Qt((t - e) / (n || 1)), 0), a = ue(o); o--;) a[r ? o : ++i] = e, e += n;
return a
}(t, n, r = void 0 === r ? t < n ? 1 : -1 : rs(r), e)
}
}

function Ni(e) {
return function(t, n) {
return "string" == typeof t && "string" == typeof n || (t = as(t), n = as(n)), e(t, n)
}
}

function Li(e, t, n, r, i, o, a, s, c, u) {
var h = 8 & t;
t |= h ? 32 : 64, 4 & (t &= ~(h ? 64 : 32)) || (t &= -4);
var d = [e, t, i, h ? o : void 0, h ? a : void 0, h ? void 0 : o, h ? void 0 : a, s, c, u],
l = n.apply(void 0, d);
return ho(e) && wo(l, d), l.placeholder = r, Eo(l, e, t)
}

function ji(e) {
var t = fe[e];
return function(e, n) {
if (e = as(e), (n = null == n ? 0 : cn(is(n), 292)) && rn(e)) {
var r = (cs(e) + "e").split("e");
return +((r = (cs(t(r[0] + "e" + (+r[1] + n))) + "e").split("e"))[0] + "e" + (+r[1] - n))
}
return t(e)
}
}
var Fi = vn && 1 / Ut(new vn([, -0]))[1] == 1 / 0 ? function(e) {
return new vn(e)
} : Zs;

function Vi(e) {
return function(t) {
var n = ro(t);
return n == l ? Ft(t) : n == v ? Wt(t) : function(e, t) {
return ht(t, (function(t) {
return [t, e[t]]
}))
}(t, e(t))
}
}

function Bi(e, t, i, o, a, s, c, u) {
var h = 2 & t;
if (!h && "function" != typeof e) throw new me(n);
var d = o ? o.length : 0;
if (d || (t &= -97, o = a = void 0), c = void 0 === c ? c : sn(is(c), 0), u = void 0 === u ? u : is(u), d -= a ? a.length : 0, 64 & t) {
var l = o,
f = a;
o = a = void 0
}
var p = h ? void 0 : Yi(e),
g = [e, t, i, o, a, l, f, s, c, u];
if (p && function(e, t) {
var n = e[1],
i = t[1],
o = n | i,
a = o < 131,
s = 128 == i && 8 == n || 128 == i && 256 == n && e[7].length <= t[8] || 384 == i && t[7].length <= t[8] && 8 == n;
if (!a && !s) return e;
1 & i && (e[2] = t[2], o |= 1 & n ? 0 : 4);
var c = t[3];
if (c) {
var u = e[3];
e[3] = u ? vi(u, c, t[4]) : c, e[4] = u ? Bt(e[3], r) : t[4]
}(c = t[5]) && (u = e[5], e[5] = u ? mi(u, c, t[6]) : c, e[6] = u ? Bt(e[5], r) : t[6]);
(c = t[7]) && (e[7] = c);
128 & i && (e[8] = null == e[8] ? t[8] : cn(e[8], t[8]));
null == e[9] && (e[9] = t[9]);
e[0] = t[0], e[1] = o
}(g, p), e = g[0], t = g[1], i = g[2], o = g[3], a = g[4], !(u = g[9] = void 0 === g[9] ? h ? 0 : e.length : sn(g[9] - d, 0)) && 24 & t && (t &= -25), t && 1 != t) v = 8 == t || 16 == t ? function(e, t, n) {
var r = Ri(e);
return function i() {
for (var o = arguments.length, a = ue(o), s = o, c = $i(i); s--;) a[s] = arguments[s];
var u = o < 3 && a[0] !== c && a[o - 1] !== c ? [] : Bt(a, c);
if ((o -= u.length) < n) return Li(e, t, Pi, i.placeholder, void 0, a, u, void 0, void 0, n - o);
var h = this && this !== He && this instanceof i ? r : e;
return nt(h, this, a)
}
}(e, t, u) : 32 != t && 33 != t || a.length ? Pi.apply(void 0, g) : function(e, t, n, r) {
var i = 1 & t,
o = Ri(e);
return function t() {
for (var a = -1, s = arguments.length, c = -1, u = r.length, h = ue(u + s), d = this && this !== He && this instanceof t ? o : e; ++c < u;) h[c] = r[c];
for (; s--;) h[c++] = arguments[++a];
return nt(d, i ? n : this, h)
}
}(e, t, i, o);
else var v = function(e, t, n) {
var r = 1 & t,
i = Ri(e);
return function t() {
var o = this && this !== He && this instanceof t ? i : e;
return o.apply(r ? n : this, arguments)
}
}(e, t, i);
return Eo((p ? qr : wo)(v, g), e, t)
}

function Ui(e, t, n, r) {
return void 0 === e || Aa(e, we[n]) && !Ee.call(r, n) ? t : e
}

function Wi(e, t, n, r, i, o) {
return Ha(e) && Ha(t) && (o.set(t, e), Ir(e, t, void 0, Wi, o), o.delete(t)), e
}

function qi(e) {
return Ya(e) ? void 0 : e
}

function Hi(e, t, n, r, i, o) {
var a = 1 & n,
s = e.length,
c = t.length;
if (s != c && !(a && c > s)) return !1;
var u = o.get(e),
h = o.get(t);
if (u && h) return u == t && h == e;
var d = -1,
l = !0,
f = 2 & n ? new jn : void 0;
for (o.set(e, t), o.set(t, e); ++d < s;) {
var p = e[d],
g = t[d];
if (r) var v = a ? r(g, p, d, t, e, o) : r(p, g, d, e, t, o);
if (void 0 !== v) {
if (v) continue;
l = !1;
break
}
if (f) {
if (!pt(t, (function(e, t) {
if (!At(f, t) && (p === e || i(p, e, n, r, o))) return f.push(t)
}))) {
l = !1;
break
}
} else if (p !== g && !i(p, g, n, r, o)) {
l = !1;
break
}
}
return o.delete(e), o.delete(t), l
}

function zi(e) {
return bo(vo(e, void 0, No), e + "")
}

function Gi(e) {
return fr(e, _s, to)
}

function Ki(e) {
return fr(e, bs, no)
}
var Yi = Cn ? function(e) {
return Cn.get(e)
} : Zs;

function Ji(e) {
for (var t = e.name + "", n = wn[t], r = Ee.call(wn, t) ? n.length : 0; r--;) {
var i = n[r],
o = i.func;
if (null == o || o == e) return i.name
}
return t
}

function $i(e) {
return (Ee.call(Pn, "placeholder") ? Pn : e).placeholder
}

function Xi() {
var e = Pn.iteratee || Ys;
return e = e === Ys ? Tr : e, arguments.length ? e(arguments[0], arguments[1]) : e
}

function Zi(e, t) {
var n, r, i = e.__data__;
return ("string" == (r = typeof(n = t)) || "number" == r || "symbol" == r || "boolean" == r ? "__proto__" !== n : null === n) ? i["string" == typeof t ? "string" : "hash"] : i.map
}

function Qi(e) {
for (var t = _s(e), n = t.length; n--;) {
var r = t[n],
i = e[r];
t[n] = [r, i, po(i)]
}
return t
}

function eo(e, t) {
var n = function(e, t) {
return null == e ? void 0 : e[t]
}(e, t);
return Er(n) ? n : void 0
}
var to = tn ? function(e) {
return null == e ? [] : (e = pe(e), st(tn(e), (function(t) {
return Ye.call(e, t)
})))
} : oc,
no = tn ? function(e) {
for (var t = []; e;) dt(t, to(e)), e = ze(e);
return t
} : oc,
ro = pr;

function io(e, t, n) {
for (var r = -1, i = (t = ci(t, e)).length, o = !1; ++r < i;) {
var a = xo(t[r]);
if (!(o = null != e && n(e, a))) break;
e = e[a]
}
return o || ++r != i ? o : !!(i = null == e ? 0 : e.length) && qa(i) && so(a, i) && (Da(e) || Ma(e))
}

function oo(e) {
return "function" != typeof e.constructor || fo(e) ? {} : An(ze(e))
}

function ao(e) {
return Da(e) || Ma(e) || !!(gt && e && e[gt])
}

function so(e, t) {
var n = typeof e;
return !!(t = null == t ? 9007199254740991 : t) && ("number" == n || "symbol" != n && oe.test(e)) && e > -1 && e % 1 == 0 && e < t
}

function co(e, t, n) {
if (!Ha(n)) return !1;
var r = typeof t;
return !!("number" == r ? La(n) && so(t, n.length) : "string" == r && t in n) && Aa(n[t], e)
}

function uo(e, t) {
if (Da(e)) return !1;
var n = typeof e;
return !("number" != n && "symbol" != n && "boolean" != n && null != e && !Za(e)) || (U.test(e) || !B.test(e) || null != t && e in pe(t))
}

function ho(e) {
var t = Ji(e),
n = Pn[t];
if ("function" != typeof n || !(t in Mn.prototype)) return !1;
if (e === n) return !0;
var r = Yi(n);
return !!r && e === r[0]
}(fn && ro(new fn(new ArrayBuffer(1))) != _ || pn && ro(new pn) != l || gn && "[object Promise]" != ro(gn.resolve()) || vn && ro(new vn) != v || mn && ro(new mn) != C) && (ro = function(e) {
var t = pr(e),
n = t == p ? e.constructor : void 0,
r = n ? ko(n) : "";
if (r) switch (r) {
case _n:
return _;
case bn:
return l;
case En:
return "[object Promise]";
case Tn:
return v;
case Sn:
return C
}
return t
});
var lo = _e ? Ua : ac;

function fo(e) {
var t = e && e.constructor;
return e === ("function" == typeof t && t.prototype || we)
}

function po(e) {
return e == e && !Ha(e)
}

function go(e, t) {
return function(n) {
return null != n && (n[e] === t && (void 0 !== t || e in pe(n)))
}
}

function vo(e, t, n) {
return t = sn(void 0 === t ? e.length - 1 : t, 0),
function() {
for (var r = arguments, i = -1, o = sn(r.length - t, 0), a = ue(o); ++i < o;) a[i] = r[t + i];
i = -1;
for (var s = ue(t + 1); ++i < t;) s[i] = r[i];
return s[t] = n(a), nt(e, this, s)
}
}

function mo(e, t) {
return t.length < 2 ? e : lr(e, Gr(t, 0, -1))
}

function yo(e, t) {
for (var n = e.length, r = cn(t.length, n), i = yi(e); r--;) {
var o = t[r];
e[r] = so(o, n) ? i[o] : void 0
}
return e
}

function Co(e, t) {
if (("constructor" !== t || "function" != typeof e[t]) && "__proto__" != t) return e[t]
}
var wo = To(qr),
_o = Zt || function(e, t) {
return He.setTimeout(e, t)
},
bo = To(Hr);

function Eo(e, t, n) {
var r = t + "";
return bo(e, function(e, t) {
var n = t.length;
if (!n) return e;
var r = n - 1;
return t[r] = (n > 1 ? "& " : "") + t[r], t = t.join(n > 2 ? ", " : " "), e.replace(K, "{\n/* [wrapped with " + t + "] */\n")
}(r, function(e, t) {
return it(i, (function(n) {
var r = "_." + n[0];
t & n[1] && !ct(e, r) && e.push(r)
})), e.sort()
}(function(e) {
var t = e.match(Y);
return t ? t[1].split(J) : []
}(r), n)))
}

function To(e) {
var t = 0,
n = 0;
return function() {
var r = un(),
i = 16 - (r - n);
if (n = r, i > 0) {
if (++t >= 800) return arguments[0]
} else t = 0;
return e.apply(void 0, arguments)
}
}

function So(e, t) {
var n = -1,
r = e.length,
i = r - 1;
for (t = void 0 === t ? r : t; ++n < t;) {
var o = jr(n, i),
a = e[o];
e[o] = e[n], e[n] = a
}
return e.length = t, e
}
var Ro = function(e) {
var t = Ta(e, (function(e) {
return 500 === n.size && n.clear(), e
})),
n = t.cache;
return t
}((function(e) {
var t = [];
return 46 === e.charCodeAt(0) && t.push(""), e.replace(W, (function(e, n, r, i) {
t.push(r ? i.replace(Z, "$1") : n || e)
})), t
}));

function xo(e) {
if ("string" == typeof e || Za(e)) return e;
var t = e + "";
return "0" == t && 1 / e == -1 / 0 ? "-0" : t
}

function ko(e) {
if (null != e) {
try {
return be.call(e)
} catch (e) {}
try {
return e + ""
} catch (e) {}
}
return ""
}

function Po(e) {
if (e instanceof Mn) return e.clone();
var t = new On(e.__wrapped__, e.__chain__);
return t.__actions__ = yi(e.__actions__), t.__index__ = e.__index__, t.__values__ = e.__values__, t
}
var Ao = Vr((function(e, t) {
return ja(e) ? er(e, ar(t, 1, ja, !0)) : []
})),
Io = Vr((function(e, t) {
var n = Bo(t);
return ja(n) && (n = void 0), ja(e) ? er(e, ar(t, 1, ja, !0), Xi(n, 2)) : []
})),
Oo = Vr((function(e, t) {
var n = Bo(t);
return ja(n) && (n = void 0), ja(e) ? er(e, ar(t, 1, ja, !0), void 0, n) : []
}));

function Mo(e, t, n) {
var r = null == e ? 0 : e.length;
if (!r) return -1;
var i = null == n ? 0 : is(n);
return i < 0 && (i = sn(r + i, 0)), mt(e, Xi(t, 3), i)
}

function Do(e, t, n) {
var r = null == e ? 0 : e.length;
if (!r) return -1;
var i = r - 1;
return void 0 !== n && (i = is(n), i = n < 0 ? sn(r + i, 0) : cn(i, r - 1)), mt(e, Xi(t, 3), i, !0)
}

function No(e) {
return (null == e ? 0 : e.length) ? ar(e, 1) : []
}

function Lo(e) {
return e && e.length ? e[0] : void 0
}
var jo = Vr((function(e) {
var t = ht(e, ai);
return t.length && t[0] === e[0] ? yr(t) : []
})),
Fo = Vr((function(e) {
var t = Bo(e),
n = ht(e, ai);
return t === Bo(n) ? t = void 0 : n.pop(), n.length && n[0] === e[0] ? yr(n, Xi(t, 2)) : []
})),
Vo = Vr((function(e) {
var t = Bo(e),
n = ht(e, ai);
return (t = "function" == typeof t ? t : void 0) && n.pop(), n.length && n[0] === e[0] ? yr(n, void 0, t) : []
}));

function Bo(e) {
var t = null == e ? 0 : e.length;
return t ? e[t - 1] : void 0
}
var Uo = Vr(Wo);

function Wo(e, t) {
return e && e.length && t && t.length ? Nr(e, t) : e
}
var qo = zi((function(e, t) {
var n = null == e ? 0 : e.length,
r = Jn(e, t);
return Lr(e, ht(t, (function(e) {
return so(e, n) ? +e : e
})).sort(gi)), r
}));

function Ho(e) {
return null == e ? e : ln.call(e)
}
var zo = Vr((function(e) {
return Qr(ar(e, 1, ja, !0))
})),
Go = Vr((function(e) {
var t = Bo(e);
return ja(t) && (t = void 0), Qr(ar(e, 1, ja, !0), Xi(t, 2))
})),
Ko = Vr((function(e) {
var t = Bo(e);
return t = "function" == typeof t ? t : void 0, Qr(ar(e, 1, ja, !0), void 0, t)
}));

function Yo(e) {
if (!e || !e.length) return [];
var t = 0;
return e = st(e, (function(e) {
if (ja(e)) return t = sn(e.length, t), !0
})), Rt(t, (function(t) {
return ht(e, bt(t))
}))
}

function Jo(e, t) {
if (!e || !e.length) return [];
var n = Yo(e);
return null == t ? n : ht(n, (function(e) {
return nt(t, void 0, e)
}))
}
var $o = Vr((function(e, t) {
return ja(e) ? er(e, t) : []
})),
Xo = Vr((function(e) {
return ii(st(e, ja))
})),
Zo = Vr((function(e) {
var t = Bo(e);
return ja(t) && (t = void 0), ii(st(e, ja), Xi(t, 2))
})),
Qo = Vr((function(e) {
var t = Bo(e);
return t = "function" == typeof t ? t : void 0, ii(st(e, ja), void 0, t)
})),
ea = Vr(Yo);
var ta = Vr((function(e) {
var t = e.length,
n = t > 1 ? e[t - 1] : void 0;
return n = "function" == typeof n ? (e.pop(), n) : void 0, Jo(e, n)
}));

function na(e) {
var t = Pn(e);
return t.__chain__ = !0, t
}

function ra(e, t) {
return t(e)
}
var ia = zi((function(e) {
var t = e.length,
n = t ? e[0] : 0,
r = this.__wrapped__,
i = function(t) {
return Jn(t, e)
};
return !(t > 1 || this.__actions__.length) && r instanceof Mn && so(n) ? ((r = r.slice(n, +n + (t ? 1 : 0))).__actions__.push({
func: ra,
args: [i],
thisArg: void 0
}), new On(r, this.__chain__).thru((function(e) {
return t && !e.length && e.push(void 0), e
}))) : this.thru(i)
}));
var oa = wi((function(e, t, n) {
Ee.call(e, n) ? ++e[n] : Yn(e, n, 1)
}));
var aa = xi(Mo),
sa = xi(Do);

function ca(e, t) {
return (Da(e) ? it : tr)(e, Xi(t, 3))
}

function ua(e, t) {
return (Da(e) ? ot : nr)(e, Xi(t, 3))
}
var ha = wi((function(e, t, n) {
Ee.call(e, n) ? e[n].push(t) : Yn(e, n, [t])
}));
var da = Vr((function(e, t, n) {
var r = -1,
i = "function" == typeof t,
o = La(e) ? ue(e.length) : [];
return tr(e, (function(e) {
o[++r] = i ? nt(t, e, n) : Cr(e, t, n)
})), o
})),
la = wi((function(e, t, n) {
Yn(e, n, t)
}));

function fa(e, t) {
return (Da(e) ? ht : kr)(e, Xi(t, 3))
}
var pa = wi((function(e, t, n) {
e[n ? 0 : 1].push(t)
}), (function() {
return [
[],
[]
]
}));
var ga = Vr((function(e, t) {
if (null == e) return [];
var n = t.length;
return n > 1 && co(e, t[0], t[1]) ? t = [] : n > 2 && co(t[0], t[1], t[2]) && (t = [t[0]]), Mr(e, ar(t, 1), [])
})),
va = Xt || function() {
return He.Date.now()
};

function ma(e, t, n) {
return t = n ? void 0 : t, Bi(e, 128, void 0, void 0, void 0, void 0, t = e && null == t ? e.length : t)
}

function ya(e, t) {
var r;
if ("function" != typeof t) throw new me(n);
return e = is(e),
function() {
return --e > 0 && (r = t.apply(this, arguments)), e <= 1 && (t = void 0), r
}
}
var Ca = Vr((function(e, t, n) {
var r = 1;
if (n.length) {
var i = Bt(n, $i(Ca));
r |= 32
}
return Bi(e, r, t, n, i)
})),
wa = Vr((function(e, t, n) {
var r = 3;
if (n.length) {
var i = Bt(n, $i(wa));
r |= 32
}
return Bi(t, r, e, n, i)
}));

function _a(e, t, r) {
var i, o, a, s, c, u, h = 0,
d = !1,
l = !1,
f = !0;
if ("function" != typeof e) throw new me(n);

function p(t) {
var n = i,
r = o;
return i = o = void 0, h = t, s = e.apply(r, n)
}

function g(e) {
return h = e, c = _o(m, t), d ? p(e) : s
}

function v(e) {
var n = e - u;
return void 0 === u || n >= t || n < 0 || l && e - h >= a
}

function m() {
var e = va();
if (v(e)) return y(e);
c = _o(m, function(e) {
var n = t - (e - u);
return l ? cn(n, a - (e - h)) : n
}(e))
}

function y(e) {
return c = void 0, f && i ? p(e) : (i = o = void 0, s)
}

function C() {
var e = va(),
n = v(e);
if (i = arguments, o = this, u = e, n) {
if (void 0 === c) return g(u);
if (l) return di(c), c = _o(m, t), p(u)
}
return void 0 === c && (c = _o(m, t)), s
}
return t = as(t) || 0, Ha(r) && (d = !!r.leading, a = (l = "maxWait" in r) ? sn(as(r.maxWait) || 0, t) : a, f = "trailing" in r ? !!r.trailing : f), C.cancel = function() {
void 0 !== c && di(c), h = 0, i = u = o = c = void 0
}, C.flush = function() {
return void 0 === c ? s : y(va())
}, C
}
var ba = Vr((function(e, t) {
return Qn(e, 1, t)
})),
Ea = Vr((function(e, t, n) {
return Qn(e, as(t) || 0, n)
}));

function Ta(e, t) {
if ("function" != typeof e || null != t && "function" != typeof t) throw new me(n);
var r = function() {
var n = arguments,
i = t ? t.apply(this, n) : n[0],
o = r.cache;
if (o.has(i)) return o.get(i);
var a = e.apply(this, n);
return r.cache = o.set(i, a) || o, a
};
return r.cache = new(Ta.Cache || Ln), r
}

function Sa(e) {
if ("function" != typeof e) throw new me(n);
return function() {
var t = arguments;
switch (t.length) {
case 0:
return !e.call(this);
case 1:
return !e.call(this, t[0]);
case 2:
return !e.call(this, t[0], t[1]);
case 3:
return !e.call(this, t[0], t[1], t[2])
}
return !e.apply(this, t)
}
}
Ta.Cache = Ln;
var Ra = ui((function(e, t) {
var n = (t = 1 == t.length && Da(t[0]) ? ht(t[0], kt(Xi())) : ht(ar(t, 1), kt(Xi()))).length;
return Vr((function(r) {
for (var i = -1, o = cn(r.length, n); ++i < o;) r[i] = t[i].call(this, r[i]);
return nt(e, this, r)
}))
})),
xa = Vr((function(e, t) {
return Bi(e, 32, void 0, t, Bt(t, $i(xa)))
})),
ka = Vr((function(e, t) {
return Bi(e, 64, void 0, t, Bt(t, $i(ka)))
})),
Pa = zi((function(e, t) {
return Bi(e, 256, void 0, void 0, void 0, t)
}));

function Aa(e, t) {
return e === t || e != e && t != t
}
var Ia = Ni(gr),
Oa = Ni((function(e, t) {
return e >= t
})),
Ma = wr(function() {
return arguments
}()) ? wr : function(e) {
return za(e) && Ee.call(e, "callee") && !Ye.call(e, "callee")
},
Da = ue.isArray,
Na = $e ? kt($e) : function(e) {
return za(e) && pr(e) == w
};

function La(e) {
return null != e && qa(e.length) && !Ua(e)
}

function ja(e) {
return za(e) && La(e)
}
var Fa = nn || ac,
Va = Xe ? kt(Xe) : function(e) {
return za(e) && pr(e) == c
};

function Ba(e) {
if (!za(e)) return !1;
var t = pr(e);
return t == u || "[object DOMException]" == t || "string" == typeof e.message && "string" == typeof e.name && !Ya(e)
}

function Ua(e) {
if (!Ha(e)) return !1;
var t = pr(e);
return t == h || t == d || "[object AsyncFunction]" == t || "[object Proxy]" == t
}

function Wa(e) {
return "number" == typeof e && e == is(e)
}

function qa(e) {
return "number" == typeof e && e > -1 && e % 1 == 0 && e <= 9007199254740991
}

function Ha(e) {
var t = typeof e;
return null != e && ("object" == t || "function" == t)
}

function za(e) {
return null != e && "object" == typeof e
}
var Ga = Ze ? kt(Ze) : function(e) {
return za(e) && ro(e) == l
};

function Ka(e) {
return "number" == typeof e || za(e) && pr(e) == f
}

function Ya(e) {
if (!za(e) || pr(e) != p) return !1;
var t = ze(e);
if (null === t) return !0;
var n = Ee.call(t, "constructor") && t.constructor;
return "function" == typeof n && n instanceof n && be.call(n) == xe
}
var Ja = Qe ? kt(Qe) : function(e) {
return za(e) && pr(e) == g
};
var $a = et ? kt(et) : function(e) {
return za(e) && ro(e) == v
};

function Xa(e) {
return "string" == typeof e || !Da(e) && za(e) && pr(e) == m
}

function Za(e) {
return "symbol" == typeof e || za(e) && pr(e) == y
}
var Qa = tt ? kt(tt) : function(e) {
return za(e) && qa(e.length) && !!je[pr(e)]
};
var es = Ni(xr),
ts = Ni((function(e, t) {
return e <= t
}));

function ns(e) {
if (!e) return [];
if (La(e)) return Xa(e) ? Ht(e) : yi(e);
if (Et && e[Et]) return function(e) {
for (var t, n = []; !(t = e.next()).done;) n.push(t.value);
return n
}(e[Et]());
var t = ro(e);
return (t == l ? Ft : t == v ? Ut : As)(e)
}

function rs(e) {
return e ? (e = as(e)) === 1 / 0 || e === -1 / 0 ? 17976931348623157e292 * (e < 0 ? -1 : 1) : e == e ? e : 0 : 0 === e ? e : 0
}

function is(e) {
var t = rs(e),
n = t % 1;
return t == t ? n ? t - n : t : 0
}

function os(e) {
return e ? $n(is(e), 0, 4294967295) : 0
}

function as(e) {
if ("number" == typeof e) return e;
if (Za(e)) return NaN;
if (Ha(e)) {
var t = "function" == typeof e.valueOf ? e.valueOf() : e;
e = Ha(t) ? t + "" : t
}
if ("string" != typeof e) return 0 === e ? e : +e;
e = xt(e);
var n = ne.test(e);
return n || ie.test(e) ? Ue(e.slice(2), n ? 2 : 8) : te.test(e) ? NaN : +e
}

function ss(e) {
return Ci(e, bs(e))
}

function cs(e) {
return null == e ? "" : Zr(e)
}
var us = _i((function(e, t) {
if (fo(t) || La(t)) Ci(t, _s(t), e);
else
for (var n in t) Ee.call(t, n) && Hn(e, n, t[n])
})),
hs = _i((function(e, t) {
Ci(t, bs(t), e)
})),
ds = _i((function(e, t, n, r) {
Ci(t, bs(t), e, r)
})),
ls = _i((function(e, t, n, r) {
Ci(t, _s(t), e, r)
})),
fs = zi(Jn);
var ps = Vr((function(e, t) {
e = pe(e);
var n = -1,
r = t.length,
i = r > 2 ? t[2] : void 0;
for (i && co(t[0], t[1], i) && (r = 1); ++n < r;)
for (var o = t[n], a = bs(o), s = -1, c = a.length; ++s < c;) {
var u = a[s],
h = e[u];
(void 0 === h || Aa(h, we[u]) && !Ee.call(e, u)) && (e[u] = o[u])
}
return e
})),
gs = Vr((function(e) {
return e.push(void 0, Wi), nt(Ts, void 0, e)
}));

function vs(e, t, n) {
var r = null == e ? void 0 : lr(e, t);
return void 0 === r ? n : r
}

function ms(e, t) {
return null != e && io(e, t, mr)
}
var ys = Ai((function(e, t, n) {
null != t && "function" != typeof t.toString && (t = Re.call(t)), e[t] = n
}), Hs(Ks)),
Cs = Ai((function(e, t, n) {
null != t && "function" != typeof t.toString && (t = Re.call(t)), Ee.call(e, t) ? e[t].push(n) : e[t] = [n]
}), Xi),
ws = Vr(Cr);

function _s(e) {
return La(e) ? Vn(e) : Sr(e)
}

function bs(e) {
return La(e) ? Vn(e, !0) : Rr(e)
}
var Es = _i((function(e, t, n) {
Ir(e, t, n)
})),
Ts = _i((function(e, t, n, r) {
Ir(e, t, n, r)
})),
Ss = zi((function(e, t) {
var n = {};
if (null == e) return n;
var r = !1;
t = ht(t, (function(t) {
return t = ci(t, e), r || (r = t.length > 1), t
})), Ci(e, Ki(e), n), r && (n = Xn(n, 7, qi));
for (var i = t.length; i--;) ei(n, t[i]);
return n
}));
var Rs = zi((function(e, t) {
return null == e ? {} : function(e, t) {
return Dr(e, t, (function(t, n) {
return ms(e, n)
}))
}(e, t)
}));

function xs(e, t) {
if (null == e) return {};
var n = ht(Ki(e), (function(e) {
return [e]
}));
return t = Xi(t), Dr(e, n, (function(e, n) {
return t(e, n[0])
}))
}
var ks = Vi(_s),
Ps = Vi(bs);

function As(e) {
return null == e ? [] : Pt(e, _s(e))
}
var Is = Si((function(e, t, n) {
return t = t.toLowerCase(), e + (n ? Os(t) : t)
}));

function Os(e) {
return Bs(cs(e).toLowerCase())
}

function Ms(e) {
return (e = cs(e)) && e.replace(ae, Dt).replace(Ae, "")
}
var Ds = Si((function(e, t, n) {
return e + (n ? "-" : "") + t.toLowerCase()
})),
Ns = Si((function(e, t, n) {
return e + (n ? " " : "") + t.toLowerCase()
})),
Ls = Ti("toLowerCase");
var js = Si((function(e, t, n) {
return e + (n ? "_" : "") + t.toLowerCase()
}));
var Fs = Si((function(e, t, n) {
return e + (n ? " " : "") + Bs(t)
}));
var Vs = Si((function(e, t, n) {
return e + (n ? " " : "") + t.toUpperCase()
})),
Bs = Ti("toUpperCase");

function Us(e, t, n) {
return e = cs(e), void 0 === (t = n ? void 0 : t) ? function(e) {
return De.test(e)
}(e) ? function(e) {
return e.match(Oe) || []
}(e) : function(e) {
return e.match($) || []
}(e) : e.match(t) || []
}
var Ws = Vr((function(e, t) {
try {
return nt(e, void 0, t)
} catch (e) {
return Ba(e) ? e : new de(e)
}
})),
qs = zi((function(e, t) {
return it(t, (function(t) {
t = xo(t), Yn(e, t, Ca(e[t], e))
})), e
}));

function Hs(e) {
return function() {
return e
}
}
var zs = ki(),
Gs = ki(!0);

function Ks(e) {
return e
}

function Ys(e) {
return Tr("function" == typeof e ? e : Xn(e, 1))
}
var Js = Vr((function(e, t) {
return function(n) {
return Cr(n, e, t)
}
})),
$s = Vr((function(e, t) {
return function(n) {
return Cr(e, n, t)
}
}));

function Xs(e, t, n) {
var r = _s(t),
i = dr(t, r);
null != n || Ha(t) && (i.length || !r.length) || (n = t, t = e, e = this, i = dr(t, _s(t)));
var o = !(Ha(n) && "chain" in n && !n.chain),
a = Ua(e);
return it(i, (function(n) {
var r = t[n];
e[n] = r, a && (e.prototype[n] = function() {
var t = this.__chain__;
if (o || t) {
var n = e(this.__wrapped__),
i = n.__actions__ = yi(this.__actions__);
return i.push({
func: r,
args: arguments,
thisArg: e
}), n.__chain__ = t, n
}
return r.apply(e, dt([this.value()], arguments))
})
})), e
}

function Zs() {}
var Qs = Oi(ht),
ec = Oi(at),
tc = Oi(pt);

function nc(e) {
return uo(e) ? bt(xo(e)) : function(e) {
return function(t) {
return lr(t, e)
}
}(e)
}
var rc = Di(),
ic = Di(!0);

function oc() {
return []
}

function ac() {
return !1
}
var sc = Ii((function(e, t) {
return e + t
}), 0),
cc = ji("ceil"),
uc = Ii((function(e, t) {
return e / t
}), 1),
hc = ji("floor");
var dc, lc = Ii((function(e, t) {
return e * t
}), 1),
fc = ji("round"),
pc = Ii((function(e, t) {
return e - t
}), 0);
return Pn.after = function(e, t) {
if ("function" != typeof t) throw new me(n);
return e = is(e),
function() {
if (--e < 1) return t.apply(this, arguments)
}
}, Pn.ary = ma, Pn.assign = us, Pn.assignIn = hs, Pn.assignInWith = ds, Pn.assignWith = ls, Pn.at = fs, Pn.before = ya, Pn.bind = Ca, Pn.bindAll = qs, Pn.bindKey = wa, Pn.castArray = function() {
if (!arguments.length) return [];
var e = arguments[0];
return Da(e) ? e : [e]
}, Pn.chain = na, Pn.chunk = function(e, t, n) {
t = (n ? co(e, t, n) : void 0 === t) ? 1 : sn(is(t), 0);
var r = null == e ? 0 : e.length;
if (!r || t < 1) return [];
for (var i = 0, o = 0, a = ue(Qt(r / t)); i < r;) a[o++] = Gr(e, i, i += t);
return a
}, Pn.compact = function(e) {
for (var t = -1, n = null == e ? 0 : e.length, r = 0, i = []; ++t < n;) {
var o = e[t];
o && (i[r++] = o)
}
return i
}, Pn.concat = function() {
var e = arguments.length;
if (!e) return [];
for (var t = ue(e - 1), n = arguments[0], r = e; r--;) t[r - 1] = arguments[r];
return dt(Da(n) ? yi(n) : [n], ar(t, 1))
}, Pn.cond = function(e) {
var t = null == e ? 0 : e.length,
r = Xi();
return e = t ? ht(e, (function(e) {
if ("function" != typeof e[1]) throw new me(n);
return [r(e[0]), e[1]]
})) : [], Vr((function(n) {
for (var r = -1; ++r < t;) {
var i = e[r];
if (nt(i[0], this, n)) return nt(i[1], this, n)
}
}))
}, Pn.conforms = function(e) {
return function(e) {
var t = _s(e);
return function(n) {
return Zn(n, e, t)
}
}(Xn(e, 1))
}, Pn.constant = Hs, Pn.countBy = oa, Pn.create = function(e, t) {
var n = An(e);
return null == t ? n : Kn(n, t)
}, Pn.curry = function e(t, n, r) {
var i = Bi(t, 8, void 0, void 0, void 0, void 0, void 0, n = r ? void 0 : n);
return i.placeholder = e.placeholder, i
}, Pn.curryRight = function e(t, n, r) {
var i = Bi(t, 16, void 0, void 0, void 0, void 0, void 0, n = r ? void 0 : n);
return i.placeholder = e.placeholder, i
}, Pn.debounce = _a, Pn.defaults = ps, Pn.defaultsDeep = gs, Pn.defer = ba, Pn.delay = Ea, Pn.difference = Ao, Pn.differenceBy = Io, Pn.differenceWith = Oo, Pn.drop = function(e, t, n) {
var r = null == e ? 0 : e.length;
return r ? Gr(e, (t = n || void 0 === t ? 1 : is(t)) < 0 ? 0 : t, r) : []
}, Pn.dropRight = function(e, t, n) {
var r = null == e ? 0 : e.length;
return r ? Gr(e, 0, (t = r - (t = n || void 0 === t ? 1 : is(t))) < 0 ? 0 : t) : []
}, Pn.dropRightWhile = function(e, t) {
return e && e.length ? ni(e, Xi(t, 3), !0, !0) : []
}, Pn.dropWhile = function(e, t) {
return e && e.length ? ni(e, Xi(t, 3), !0) : []
}, Pn.fill = function(e, t, n, r) {
var i = null == e ? 0 : e.length;
return i ? (n && "number" != typeof n && co(e, t, n) && (n = 0, r = i), function(e, t, n, r) {
var i = e.length;
for ((n = is(n)) < 0 && (n = -n > i ? 0 : i + n), (r = void 0 === r || r > i ? i : is(r)) < 0 && (r += i), r = n > r ? 0 : os(r); n < r;) e[n++] = t;
return e
}(e, t, n, r)) : []
}, Pn.filter = function(e, t) {
return (Da(e) ? st : or)(e, Xi(t, 3))
}, Pn.flatMap = function(e, t) {
return ar(fa(e, t), 1)
}, Pn.flatMapDeep = function(e, t) {
return ar(fa(e, t), 1 / 0)
}, Pn.flatMapDepth = function(e, t, n) {
return n = void 0 === n ? 1 : is(n), ar(fa(e, t), n)
}, Pn.flatten = No, Pn.flattenDeep = function(e) {
return (null == e ? 0 : e.length) ? ar(e, 1 / 0) : []
}, Pn.flattenDepth = function(e, t) {
return (null == e ? 0 : e.length) ? ar(e, t = void 0 === t ? 1 : is(t)) : []
}, Pn.flip = function(e) {
return Bi(e, 512)
}, Pn.flow = zs, Pn.flowRight = Gs, Pn.fromPairs = function(e) {
for (var t = -1, n = null == e ? 0 : e.length, r = {}; ++t < n;) {
var i = e[t];
r[i[0]] = i[1]
}
return r
}, Pn.functions = function(e) {
return null == e ? [] : dr(e, _s(e))
}, Pn.functionsIn = function(e) {
return null == e ? [] : dr(e, bs(e))
}, Pn.groupBy = ha, Pn.initial = function(e) {
return (null == e ? 0 : e.length) ? Gr(e, 0, -1) : []
}, Pn.intersection = jo, Pn.intersectionBy = Fo, Pn.intersectionWith = Vo, Pn.invert = ys, Pn.invertBy = Cs, Pn.invokeMap = da, Pn.iteratee = Ys, Pn.keyBy = la, Pn.keys = _s, Pn.keysIn = bs, Pn.map = fa, Pn.mapKeys = function(e, t) {
var n = {};
return t = Xi(t, 3), ur(e, (function(e, r, i) {
Yn(n, t(e, r, i), e)
})), n
}, Pn.mapValues = function(e, t) {
var n = {};
return t = Xi(t, 3), ur(e, (function(e, r, i) {
Yn(n, r, t(e, r, i))
})), n
}, Pn.matches = function(e) {
return Pr(Xn(e, 1))
}, Pn.matchesProperty = function(e, t) {
return Ar(e, Xn(t, 1))
}, Pn.memoize = Ta, Pn.merge = Es, Pn.mergeWith = Ts, Pn.method = Js, Pn.methodOf = $s, Pn.mixin = Xs, Pn.negate = Sa, Pn.nthArg = function(e) {
return e = is(e), Vr((function(t) {
return Or(t, e)
}))
}, Pn.omit = Ss, Pn.omitBy = function(e, t) {
return xs(e, Sa(Xi(t)))
}, Pn.once = function(e) {
return ya(2, e)
}, Pn.orderBy = function(e, t, n, r) {
return null == e ? [] : (Da(t) || (t = null == t ? [] : [t]), Da(n = r ? void 0 : n) || (n = null == n ? [] : [n]), Mr(e, t, n))
}, Pn.over = Qs, Pn.overArgs = Ra, Pn.overEvery = ec, Pn.overSome = tc, Pn.partial = xa, Pn.partialRight = ka, Pn.partition = pa, Pn.pick = Rs, Pn.pickBy = xs, Pn.property = nc, Pn.propertyOf = function(e) {
return function(t) {
return null == e ? void 0 : lr(e, t)
}
}, Pn.pull = Uo, Pn.pullAll = Wo, Pn.pullAllBy = function(e, t, n) {
return e && e.length && t && t.length ? Nr(e, t, Xi(n, 2)) : e
}, Pn.pullAllWith = function(e, t, n) {
return e && e.length && t && t.length ? Nr(e, t, void 0, n) : e
}, Pn.pullAt = qo, Pn.range = rc, Pn.rangeRight = ic, Pn.rearg = Pa, Pn.reject = function(e, t) {
return (Da(e) ? st : or)(e, Sa(Xi(t, 3)))
}, Pn.remove = function(e, t) {
var n = [];
if (!e || !e.length) return n;
var r = -1,
i = [],
o = e.length;
for (t = Xi(t, 3); ++r < o;) {
var a = e[r];
t(a, r, e) && (n.push(a), i.push(r))
}
return Lr(e, i), n
}, Pn.rest = function(e, t) {
if ("function" != typeof e) throw new me(n);
return Vr(e, t = void 0 === t ? t : is(t))
}, Pn.reverse = Ho, Pn.sampleSize = function(e, t, n) {
return t = (n ? co(e, t, n) : void 0 === t) ? 1 : is(t), (Da(e) ? Un : Ur)(e, t)
}, Pn.set = function(e, t, n) {
return null == e ? e : Wr(e, t, n)
}, Pn.setWith = function(e, t, n, r) {
return r = "function" == typeof r ? r : void 0, null == e ? e : Wr(e, t, n, r)
}, Pn.shuffle = function(e) {
return (Da(e) ? Wn : zr)(e)
}, Pn.slice = function(e, t, n) {
var r = null == e ? 0 : e.length;
return r ? (n && "number" != typeof n && co(e, t, n) ? (t = 0, n = r) : (t = null == t ? 0 : is(t), n = void 0 === n ? r : is(n)), Gr(e, t, n)) : []
}, Pn.sortBy = ga, Pn.sortedUniq = function(e) {
return e && e.length ? $r(e) : []
}, Pn.sortedUniqBy = function(e, t) {
return e && e.length ? $r(e, Xi(t, 2)) : []
}, Pn.split = function(e, t, n) {
return n && "number" != typeof n && co(e, t, n) && (t = n = void 0), (n = void 0 === n ? 4294967295 : n >>> 0) ? (e = cs(e)) && ("string" == typeof t || null != t && !Ja(t)) && !(t = Zr(t)) && jt(e) ? hi(Ht(e), 0, n) : e.split(t, n) : []
}, Pn.spread = function(e, t) {
if ("function" != typeof e) throw new me(n);
return t = null == t ? 0 : sn(is(t), 0), Vr((function(n) {
var r = n[t],
i = hi(n, 0, t);
return r && dt(i, r), nt(e, this, i)
}))
}, Pn.tail = function(e) {
var t = null == e ? 0 : e.length;
return t ? Gr(e, 1, t) : []
}, Pn.take = function(e, t, n) {
return e && e.length ? Gr(e, 0, (t = n || void 0 === t ? 1 : is(t)) < 0 ? 0 : t) : []
}, Pn.takeRight = function(e, t, n) {
var r = null == e ? 0 : e.length;
return r ? Gr(e, (t = r - (t = n || void 0 === t ? 1 : is(t))) < 0 ? 0 : t, r) : []
}, Pn.takeRightWhile = function(e, t) {
return e && e.length ? ni(e, Xi(t, 3), !1, !0) : []
}, Pn.takeWhile = function(e, t) {
return e && e.length ? ni(e, Xi(t, 3)) : []
}, Pn.tap = function(e, t) {
return t(e), e
}, Pn.throttle = function(e, t, r) {
var i = !0,
o = !0;
if ("function" != typeof e) throw new me(n);
return Ha(r) && (i = "leading" in r ? !!r.leading : i, o = "trailing" in r ? !!r.trailing : o), _a(e, t, {
leading: i,
maxWait: t,
trailing: o
})
}, Pn.thru = ra, Pn.toArray = ns, Pn.toPairs = ks, Pn.toPairsIn = Ps, Pn.toPath = function(e) {
return Da(e) ? ht(e, xo) : Za(e) ? [e] : yi(Ro(cs(e)))
}, Pn.toPlainObject = ss, Pn.transform = function(e, t, n) {
var r = Da(e),
i = r || Fa(e) || Qa(e);
if (t = Xi(t, 4), null == n) {
var o = e && e.constructor;
n = i ? r ? new o : [] : Ha(e) && Ua(o) ? An(ze(e)) : {}
}
return (i ? it : ur)(e, (function(e, r, i) {
return t(n, e, r, i)
})), n
}, Pn.unary = function(e) {
return ma(e, 1)
}, Pn.union = zo, Pn.unionBy = Go, Pn.unionWith = Ko, Pn.uniq = function(e) {
return e && e.length ? Qr(e) : []
}, Pn.uniqBy = function(e, t) {
return e && e.length ? Qr(e, Xi(t, 2)) : []
}, Pn.uniqWith = function(e, t) {
return t = "function" == typeof t ? t : void 0, e && e.length ? Qr(e, void 0, t) : []
}, Pn.unset = function(e, t) {
return null == e || ei(e, t)
}, Pn.unzip = Yo, Pn.unzipWith = Jo, Pn.update = function(e, t, n) {
return null == e ? e : ti(e, t, si(n))
}, Pn.updateWith = function(e, t, n, r) {
return r = "function" == typeof r ? r : void 0, null == e ? e : ti(e, t, si(n), r)
}, Pn.values = As, Pn.valuesIn = function(e) {
return null == e ? [] : Pt(e, bs(e))
}, Pn.without = $o, Pn.words = Us, Pn.wrap = function(e, t) {
return xa(si(t), e)
}, Pn.xor = Xo, Pn.xorBy = Zo, Pn.xorWith = Qo, Pn.zip = ea, Pn.zipObject = function(e, t) {
return oi(e || [], t || [], Hn)
}, Pn.zipObjectDeep = function(e, t) {
return oi(e || [], t || [], Wr)
}, Pn.zipWith = ta, Pn.entries = ks, Pn.entriesIn = Ps, Pn.extend = hs, Pn.extendWith = ds, Xs(Pn, Pn), Pn.add = sc, Pn.attempt = Ws, Pn.camelCase = Is, Pn.capitalize = Os, Pn.ceil = cc, Pn.clamp = function(e, t, n) {
return void 0 === n && (n = t, t = void 0), void 0 !== n && (n = (n = as(n)) == n ? n : 0), void 0 !== t && (t = (t = as(t)) == t ? t : 0), $n(as(e), t, n)
}, Pn.clone = function(e) {
return Xn(e, 4)
}, Pn.cloneDeep = function(e) {
return Xn(e, 5)
}, Pn.cloneDeepWith = function(e, t) {
return Xn(e, 5, t = "function" == typeof t ? t : void 0)
}, Pn.cloneWith = function(e, t) {
return Xn(e, 4, t = "function" == typeof t ? t : void 0)
}, Pn.conformsTo = function(e, t) {
return null == t || Zn(e, t, _s(t))
}, Pn.deburr = Ms, Pn.defaultTo = function(e, t) {
return null == e || e != e ? t : e
}, Pn.divide = uc, Pn.endsWith = function(e, t, n) {
e = cs(e), t = Zr(t);
var r = e.length,
i = n = void 0 === n ? r : $n(is(n), 0, r);
return (n -= t.length) >= 0 && e.slice(n, i) == t
}, Pn.eq = Aa, Pn.escape = function(e) {
return (e = cs(e)) && L.test(e) ? e.replace(D, Nt) : e
}, Pn.escapeRegExp = function(e) {
return (e = cs(e)) && H.test(e) ? e.replace(q, "\\$&") : e
}, Pn.every = function(e, t, n) {
var r = Da(e) ? at : rr;
return n && co(e, t, n) && (t = void 0), r(e, Xi(t, 3))
}, Pn.find = aa, Pn.findIndex = Mo, Pn.findKey = function(e, t) {
return vt(e, Xi(t, 3), ur)
}, Pn.findLast = sa, Pn.findLastIndex = Do, Pn.findLastKey = function(e, t) {
return vt(e, Xi(t, 3), hr)
}, Pn.floor = hc, Pn.forEach = ca, Pn.forEachRight = ua, Pn.forIn = function(e, t) {
return null == e ? e : sr(e, Xi(t, 3), bs)
}, Pn.forInRight = function(e, t) {
return null == e ? e : cr(e, Xi(t, 3), bs)
}, Pn.forOwn = function(e, t) {
return e && ur(e, Xi(t, 3))
}, Pn.forOwnRight = function(e, t) {
return e && hr(e, Xi(t, 3))
}, Pn.get = vs, Pn.gt = Ia, Pn.gte = Oa, Pn.has = function(e, t) {
return null != e && io(e, t, vr)
}, Pn.hasIn = ms, Pn.head = Lo, Pn.identity = Ks, Pn.includes = function(e, t, n, r) {
e = La(e) ? e : As(e), n = n && !r ? is(n) : 0;
var i = e.length;
return n < 0 && (n = sn(i + n, 0)), Xa(e) ? n <= i && e.indexOf(t, n) > -1 : !!i && yt(e, t, n) > -1
}, Pn.indexOf = function(e, t, n) {
var r = null == e ? 0 : e.length;
if (!r) return -1;
var i = null == n ? 0 : is(n);
return i < 0 && (i = sn(r + i, 0)), yt(e, t, i)
}, Pn.inRange = function(e, t, n) {
return t = rs(t), void 0 === n ? (n = t, t = 0) : n = rs(n),
function(e, t, n) {
return e >= cn(t, n) && e < sn(t, n)
}(e = as(e), t, n)
}, Pn.invoke = ws, Pn.isArguments = Ma, Pn.isArray = Da, Pn.isArrayBuffer = Na, Pn.isArrayLike = La, Pn.isArrayLikeObject = ja, Pn.isBoolean = function(e) {
return !0 === e || !1 === e || za(e) && pr(e) == s
}, Pn.isBuffer = Fa, Pn.isDate = Va, Pn.isElement = function(e) {
return za(e) && 1 === e.nodeType && !Ya(e)
}, Pn.isEmpty = function(e) {
if (null == e) return !0;
if (La(e) && (Da(e) || "string" == typeof e || "function" == typeof e.splice || Fa(e) || Qa(e) || Ma(e))) return !e.length;
var t = ro(e);
if (t == l || t == v) return !e.size;
if (fo(e)) return !Sr(e).length;
for (var n in e)
if (Ee.call(e, n)) return !1;
return !0
}, Pn.isEqual = function(e, t) {
return _r(e, t)
}, Pn.isEqualWith = function(e, t, n) {
var r = (n = "function" == typeof n ? n : void 0) ? n(e, t) : void 0;
return void 0 === r ? _r(e, t, void 0, n) : !!r
}, Pn.isError = Ba, Pn.isFinite = function(e) {
return "number" == typeof e && rn(e)
}, Pn.isFunction = Ua, Pn.isInteger = Wa, Pn.isLength = qa, Pn.isMap = Ga, Pn.isMatch = function(e, t) {
return e === t || br(e, t, Qi(t))
}, Pn.isMatchWith = function(e, t, n) {
return n = "function" == typeof n ? n : void 0, br(e, t, Qi(t), n)
}, Pn.isNaN = function(e) {
return Ka(e) && e != +e
}, Pn.isNative = function(e) {
if (lo(e)) throw new de("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");
return Er(e)
}, Pn.isNil = function(e) {
return null == e
}, Pn.isNull = function(e) {
return null === e
}, Pn.isNumber = Ka, Pn.isObject = Ha, Pn.isObjectLike = za, Pn.isPlainObject = Ya, Pn.isRegExp = Ja, Pn.isSafeInteger = function(e) {
return Wa(e) && e >= -9007199254740991 && e <= 9007199254740991
}, Pn.isSet = $a, Pn.isString = Xa, Pn.isSymbol = Za, Pn.isTypedArray = Qa, Pn.isUndefined = function(e) {
return void 0 === e
}, Pn.isWeakMap = function(e) {
return za(e) && ro(e) == C
}, Pn.isWeakSet = function(e) {
return za(e) && "[object WeakSet]" == pr(e)
}, Pn.join = function(e, t) {
return null == e ? "" : on.call(e, t)
}, Pn.kebabCase = Ds, Pn.last = Bo, Pn.lastIndexOf = function(e, t, n) {
var r = null == e ? 0 : e.length;
if (!r) return -1;
var i = r;
return void 0 !== n && (i = (i = is(n)) < 0 ? sn(r + i, 0) : cn(i, r - 1)), t == t ? function(e, t, n) {
for (var r = n + 1; r--;)
if (e[r] === t) return r;
return r
}(e, t, i) : mt(e, wt, i, !0)
}, Pn.lowerCase = Ns, Pn.lowerFirst = Ls, Pn.lt = es, Pn.lte = ts, Pn.max = function(e) {
return e && e.length ? ir(e, Ks, gr) : void 0
}, Pn.maxBy = function(e, t) {
return e && e.length ? ir(e, Xi(t, 2), gr) : void 0
}, Pn.mean = function(e) {
return _t(e, Ks)
}, Pn.meanBy = function(e, t) {
return _t(e, Xi(t, 2))
}, Pn.min = function(e) {
return e && e.length ? ir(e, Ks, xr) : void 0
}, Pn.minBy = function(e, t) {
return e && e.length ? ir(e, Xi(t, 2), xr) : void 0
}, Pn.stubArray = oc, Pn.stubFalse = ac, Pn.stubObject = function() {
return {}
}, Pn.stubString = function() {
return ""
}, Pn.stubTrue = function() {
return !0
}, Pn.multiply = lc, Pn.nth = function(e, t) {
return e && e.length ? Or(e, is(t)) : void 0
}, Pn.noConflict = function() {
return He._ === this && (He._ = ke), this
}, Pn.noop = Zs, Pn.now = va, Pn.pad = function(e, t, n) {
e = cs(e);
var r = (t = is(t)) ? qt(e) : 0;
if (!t || r >= t) return e;
var i = (t - r) / 2;
return Mi(en(i), n) + e + Mi(Qt(i), n)
}, Pn.padEnd = function(e, t, n) {
e = cs(e);
var r = (t = is(t)) ? qt(e) : 0;
return t && r < t ? e + Mi(t - r, n) : e
}, Pn.padStart = function(e, t, n) {
e = cs(e);
var r = (t = is(t)) ? qt(e) : 0;
return t && r < t ? Mi(t - r, n) + e : e
}, Pn.parseInt = function(e, t, n) {
return n || null == t ? t = 0 : t && (t = +t), hn(cs(e).replace(z, ""), t || 0)
}, Pn.random = function(e, t, n) {
if (n && "boolean" != typeof n && co(e, t, n) && (t = n = void 0), void 0 === n && ("boolean" == typeof t ? (n = t, t = void 0) : "boolean" == typeof e && (n = e, e = void 0)), void 0 === e && void 0 === t ? (e = 0, t = 1) : (e = rs(e), void 0 === t ? (t = e, e = 0) : t = rs(t)), e > t) {
var r = e;
e = t, t = r
}
if (n || e % 1 || t % 1) {
var i = dn();
return cn(e + i * (t - e + Be("1e-" + ((i + "").length - 1))), t)
}
return jr(e, t)
}, Pn.reduce = function(e, t, n) {
var r = Da(e) ? lt : Tt,
i = arguments.length < 3;
return r(e, Xi(t, 4), n, i, tr)
}, Pn.reduceRight = function(e, t, n) {
var r = Da(e) ? ft : Tt,
i = arguments.length < 3;
return r(e, Xi(t, 4), n, i, nr)
}, Pn.repeat = function(e, t, n) {
return t = (n ? co(e, t, n) : void 0 === t) ? 1 : is(t), Fr(cs(e), t)
}, Pn.replace = function() {
var e = arguments,
t = cs(e[0]);
return e.length < 3 ? t : t.replace(e[1], e[2])
}, Pn.result = function(e, t, n) {
var r = -1,
i = (t = ci(t, e)).length;
for (i || (i = 1, e = void 0); ++r < i;) {
var o = null == e ? void 0 : e[xo(t[r])];
void 0 === o && (r = i, o = n), e = Ua(o) ? o.call(e) : o
}
return e
}, Pn.round = fc, Pn.runInContext = e, Pn.sample = function(e) {
return (Da(e) ? Bn : Br)(e)
}, Pn.size = function(e) {
if (null == e) return 0;
if (La(e)) return Xa(e) ? qt(e) : e.length;
var t = ro(e);
return t == l || t == v ? e.size : Sr(e).length
}, Pn.snakeCase = js, Pn.some = function(e, t, n) {
var r = Da(e) ? pt : Kr;
return n && co(e, t, n) && (t = void 0), r(e, Xi(t, 3))
}, Pn.sortedIndex = function(e, t) {
return Yr(e, t)
}, Pn.sortedIndexBy = function(e, t, n) {
return Jr(e, t, Xi(n, 2))
}, Pn.sortedIndexOf = function(e, t) {
var n = null == e ? 0 : e.length;
if (n) {
var r = Yr(e, t);
if (r < n && Aa(e[r], t)) return r
}
return -1
}, Pn.sortedLastIndex = function(e, t) {
return Yr(e, t, !0)
}, Pn.sortedLastIndexBy = function(e, t, n) {
return Jr(e, t, Xi(n, 2), !0)
}, Pn.sortedLastIndexOf = function(e, t) {
if (null == e ? 0 : e.length) {
var n = Yr(e, t, !0) - 1;
if (Aa(e[n], t)) return n
}
return -1
}, Pn.startCase = Fs, Pn.startsWith = function(e, t, n) {
return e = cs(e), n = null == n ? 0 : $n(is(n), 0, e.length), t = Zr(t), e.slice(n, n + t.length) == t
}, Pn.subtract = pc, Pn.sum = function(e) {
return e && e.length ? St(e, Ks) : 0
}, Pn.sumBy = function(e, t) {
return e && e.length ? St(e, Xi(t, 2)) : 0
}, Pn.template = function(e, t, n) {
var r = Pn.templateSettings;
n && co(e, t, n) && (t = void 0), e = cs(e), t = ds({}, t, r, Ui);
var i, o, a = ds({}, t.imports, r.imports, Ui),
s = _s(a),
c = Pt(a, s),
u = 0,
h = t.interpolate || se,
d = "__p += '",
l = ge((t.escape || se).source + "|" + h.source + "|" + (h === V ? Q : se).source + "|" + (t.evaluate || se).source + "|$", "g"),
f = "//# sourceURL=" + (Ee.call(t, "sourceURL") ? (t.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++Le + "]") + "\n";
e.replace(l, (function(t, n, r, a, s, c) {
return r || (r = a), d += e.slice(u, c).replace(ce, Lt), n && (i = !0, d += "' +\n__e(" + n + ") +\n'"), s && (o = !0, d += "';\n" + s + ";\n__p += '"), r && (d += "' +\n((__t = (" + r + ")) == null ? '' : __t) +\n'"), u = c + t.length, t
})), d += "';\n";
var p = Ee.call(t, "variable") && t.variable;
if (p) {
if (X.test(p)) throw new de("Invalid `variable` option passed into `_.template`")
} else d = "with (obj) {\n" + d + "\n}\n";
d = (o ? d.replace(A, "") : d).replace(I, "$1").replace(O, "$1;"), d = "function(" + (p || "obj") + ") {\n" + (p ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (i ? ", __e = _.escape" : "") + (o ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + d + "return __p\n}";
var g = Ws((function() {
return le(s, f + "return " + d).apply(void 0, c)
}));
if (g.source = d, Ba(g)) throw g;
return g
}, Pn.times = function(e, t) {
if ((e = is(e)) < 1 || e > 9007199254740991) return [];
var n = 4294967295,
r = cn(e, 4294967295);
e -= 4294967295;
for (var i = Rt(r, t = Xi(t)); ++n < e;) t(n);
return i
}, Pn.toFinite = rs, Pn.toInteger = is, Pn.toLength = os, Pn.toLower = function(e) {
return cs(e).toLowerCase()
}, Pn.toNumber = as, Pn.toSafeInteger = function(e) {
return e ? $n(is(e), -9007199254740991, 9007199254740991) : 0 === e ? e : 0
}, Pn.toString = cs, Pn.toUpper = function(e) {
return cs(e).toUpperCase()
}, Pn.trim = function(e, t, n) {
if ((e = cs(e)) && (n || void 0 === t)) return xt(e);
if (!e || !(t = Zr(t))) return e;
var r = Ht(e),
i = Ht(t);
return hi(r, It(r, i), Ot(r, i) + 1).join("")
}, Pn.trimEnd = function(e, t, n) {
if ((e = cs(e)) && (n || void 0 === t)) return e.slice(0, zt(e) + 1);
if (!e || !(t = Zr(t))) return e;
var r = Ht(e);
return hi(r, 0, Ot(r, Ht(t)) + 1).join("")
}, Pn.trimStart = function(e, t, n) {
if ((e = cs(e)) && (n || void 0 === t)) return e.replace(z, "");
if (!e || !(t = Zr(t))) return e;
var r = Ht(e);
return hi(r, It(r, Ht(t))).join("")
}, Pn.truncate = function(e, t) {
var n = 30,
r = "...";
if (Ha(t)) {
var i = "separator" in t ? t.separator : i;
n = "length" in t ? is(t.length) : n, r = "omission" in t ? Zr(t.omission) : r
}
var o = (e = cs(e)).length;
if (jt(e)) {
var a = Ht(e);
o = a.length
}
if (n >= o) return e;
var s = n - qt(r);
if (s < 1) return r;
var c = a ? hi(a, 0, s).join("") : e.slice(0, s);
if (void 0 === i) return c + r;
if (a && (s += c.length - s), Ja(i)) {
if (e.slice(s).search(i)) {
var u, h = c;
for (i.global || (i = ge(i.source, cs(ee.exec(i)) + "g")), i.lastIndex = 0; u = i.exec(h);) var d = u.index;
c = c.slice(0, void 0 === d ? s : d)
}
} else if (e.indexOf(Zr(i), s) != s) {
var l = c.lastIndexOf(i);
l > -1 && (c = c.slice(0, l))
}
return c + r
}, Pn.unescape = function(e) {
return (e = cs(e)) && N.test(e) ? e.replace(M, Gt) : e
}, Pn.uniqueId = function(e) {
var t = ++Te;
return cs(e) + t
}, Pn.upperCase = Vs, Pn.upperFirst = Bs, Pn.each = ca, Pn.eachRight = ua, Pn.first = Lo, Xs(Pn, (dc = {}, ur(Pn, (function(e, t) {
Ee.call(Pn.prototype, t) || (dc[t] = e)
})), dc), {
chain: !1
}), Pn.VERSION = "4.17.21", it(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], (function(e) {
Pn[e].placeholder = Pn
})), it(["drop", "take"], (function(e, t) {
Mn.prototype[e] = function(n) {
n = void 0 === n ? 1 : sn(is(n), 0);
var r = this.__filtered__ && !t ? new Mn(this) : this.clone();
return r.__filtered__ ? r.__takeCount__ = cn(n, r.__takeCount__) : r.__views__.push({
size: cn(n, 4294967295),
type: e + (r.__dir__ < 0 ? "Right" : "")
}), r
}, Mn.prototype[e + "Right"] = function(t) {
return this.reverse()[e](t).reverse()
}
})), it(["filter", "map", "takeWhile"], (function(e, t) {
var n = t + 1,
r = 1 == n || 3 == n;
Mn.prototype[e] = function(e) {
var t = this.clone();
return t.__iteratees__.push({
iteratee: Xi(e, 3),
type: n
}), t.__filtered__ = t.__filtered__ || r, t
}
})), it(["head", "last"], (function(e, t) {
var n = "take" + (t ? "Right" : "");
Mn.prototype[e] = function() {
return this[n](1).value()[0]
}
})), it(["initial", "tail"], (function(e, t) {
var n = "drop" + (t ? "" : "Right");
Mn.prototype[e] = function() {
return this.__filtered__ ? new Mn(this) : this[n](1)
}
})), Mn.prototype.compact = function() {
return this.filter(Ks)
}, Mn.prototype.find = function(e) {
return this.filter(e).head()
}, Mn.prototype.findLast = function(e) {
return this.reverse().find(e)
}, Mn.prototype.invokeMap = Vr((function(e, t) {
return "function" == typeof e ? new Mn(this) : this.map((function(n) {
return Cr(n, e, t)
}))
})), Mn.prototype.reject = function(e) {
return this.filter(Sa(Xi(e)))
}, Mn.prototype.slice = function(e, t) {
e = is(e);
var n = this;
return n.__filtered__ && (e > 0 || t < 0) ? new Mn(n) : (e < 0 ? n = n.takeRight(-e) : e && (n = n.drop(e)), void 0 !== t && (n = (t = is(t)) < 0 ? n.dropRight(-t) : n.take(t - e)), n)
}, Mn.prototype.takeRightWhile = function(e) {
return this.reverse().takeWhile(e).reverse()
}, Mn.prototype.toArray = function() {
return this.take(4294967295)
}, ur(Mn.prototype, (function(e, t) {
var n = /^(?:filter|find|map|reject)|While$/.test(t),
r = /^(?:head|last)$/.test(t),
i = Pn[r ? "take" + ("last" == t ? "Right" : "") : t],
o = r || /^find/.test(t);
i && (Pn.prototype[t] = function() {
var t = this.__wrapped__,
a = r ? [1] : arguments,
s = t instanceof Mn,
c = a[0],
u = s || Da(t),
h = function(e) {
var t = i.apply(Pn, dt([e], a));
return r && d ? t[0] : t
};
u && n && "function" == typeof c && 1 != c.length && (s = u = !1);
var d = this.__chain__,
l = !!this.__actions__.length,
f = o && !d,
p = s && !l;
if (!o && u) {
t = p ? t : new Mn(this);
var g = e.apply(t, a);
return g.__actions__.push({
func: ra,
args: [h],
thisArg: void 0
}), new On(g, d)
}
return f && p ? e.apply(this, a) : (g = this.thru(h), f ? r ? g.value()[0] : g.value() : g)
})
})), it(["pop", "push", "shift", "sort", "splice", "unshift"], (function(e) {
var t = ye[e],
n = /^(?:push|sort|unshift)$/.test(e) ? "tap" : "thru",
r = /^(?:pop|shift)$/.test(e);
Pn.prototype[e] = function() {
var e = arguments;
if (r && !this.__chain__) {
var i = this.value();
return t.apply(Da(i) ? i : [], e)
}
return this[n]((function(n) {
return t.apply(Da(n) ? n : [], e)
}))
}
})), ur(Mn.prototype, (function(e, t) {
var n = Pn[t];
if (n) {
var r = n.name + "";
Ee.call(wn, r) || (wn[r] = []), wn[r].push({
name: t,
func: n
})
}
})), wn[Pi(void 0, 2).name] = [{
name: "wrapper",
func: void 0
}], Mn.prototype.clone = function() {
var e = new Mn(this.__wrapped__);
return e.__actions__ = yi(this.__actions__), e.__dir__ = this.__dir__, e.__filtered__ = this.__filtered__, e.__iteratees__ = yi(this.__iteratees__), e.__takeCount__ = this.__takeCount__, e.__views__ = yi(this.__views__), e
}, Mn.prototype.reverse = function() {
if (this.__filtered__) {
var e = new Mn(this);
e.__dir__ = -1, e.__filtered__ = !0
} else(e = this.clone()).__dir__ *= -1;
return e
}, Mn.prototype.value = function() {
var e = this.__wrapped__.value(),
t = this.__dir__,
n = Da(e),
r = t < 0,
i = n ? e.length : 0,
o = function(e, t, n) {
var r = -1,
i = n.length;
for (; ++r < i;) {
var o = n[r],
a = o.size;
switch (o.type) {
case "drop":
e += a;
break;
case "dropRight":
t -= a;
break;
case "take":
t = cn(t, e + a);
break;
case "takeRight":
e = sn(e, t - a)
}
}
return {
start: e,
end: t
}
}(0, i, this.__views__),
a = o.start,
s = o.end,
c = s - a,
u = r ? s : a - 1,
h = this.__iteratees__,
d = h.length,
l = 0,
f = cn(c, this.__takeCount__);
if (!n || !r && i == c && f == c) return ri(e, this.__actions__);
var p = [];
e: for (; c-- && l < f;) {
for (var g = -1, v = e[u += t]; ++g < d;) {
var m = h[g],
y = m.iteratee,
C = m.type,
w = y(v);
if (2 == C) v = w;
else if (!w) {
if (1 == C) continue e;
break e
}
}
p[l++] = v
}
return p
}, Pn.prototype.at = ia, Pn.prototype.chain = function() {
return na(this)
}, Pn.prototype.commit = function() {
return new On(this.value(), this.__chain__)
}, Pn.prototype.next = function() {
void 0 === this.__values__ && (this.__values__ = ns(this.value()));
var e = this.__index__ >= this.__values__.length;
return {
done: e,
value: e ? void 0 : this.__values__[this.__index__++]
}
}, Pn.prototype.plant = function(e) {
for (var t, n = this; n instanceof In;) {
var r = Po(n);
r.__index__ = 0, r.__values__ = void 0, t ? i.__wrapped__ = r : t = r;
var i = r;
n = n.__wrapped__
}
return i.__wrapped__ = e, t
}, Pn.prototype.reverse = function() {
var e = this.__wrapped__;
if (e instanceof Mn) {
var t = e;
return this.__actions__.length && (t = new Mn(this)), (t = t.reverse()).__actions__.push({
func: ra,
args: [Ho],
thisArg: void 0
}), new On(t, this.__chain__)
}
return this.thru(Ho)
}, Pn.prototype.toJSON = Pn.prototype.valueOf = Pn.prototype.value = function() {
return ri(this.__wrapped__, this.__actions__)
}, Pn.prototype.first = Pn.prototype.head, Et && (Pn.prototype[Et] = function() {
return this
}), Pn
}();
"function" == typeof define && "object" == typeof define.amd && define.amd ? (He._ = Kt, define((function() {
return Kt
}))) : Ge ? ((Ge.exports = Kt)._ = Kt, ze._ = Kt) : He._ = Kt
}).call(this)
}, function(e, t, n) {
(function(r) {
t.formatArgs = function(t) {
if (t[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + t[0] + (this.useColors ? "%c " : " ") + "+" + e.exports.humanize(this.diff), !this.useColors) return;
const n = "color: " + this.color;
t.splice(1, 0, n, "color: inherit");
let r = 0,
i = 0;
t[0].replace(/%[a-zA-Z%]/g, e => {
"%%" !== e && (r++, "%c" === e && (i = r))
}), t.splice(i, 0, n)
}, t.save = function(e) {
try {
e ? t.storage.setItem("debug", e) : t.storage.removeItem("debug")
} catch (e) {}
}, t.load = function() {
let e;
try {
e = t.storage.getItem("debug")
} catch (e) {}!e && void 0 !== r && "env" in r && (e = r.env.DEBUG);
return e
}, t.useColors = function() {
if ("undefined" != typeof window && window.process && ("renderer" === window.process.type || window.process.__nwjs)) return !0;
if ("undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return !1;
return "undefined" != typeof document && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || "undefined" != typeof window && window.console && (window.console.firebug || window.console.exception && window.console.table) || "undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || "undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)
}, t.storage = function() {
try {
return localStorage
} catch (e) {}
}(), t.destroy = (() => {
let e = !1;
return () => {
e || (e = !0, console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))
}
})(), t.colors = ["#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33"], t.log = console.debug || console.log || (() => {}), e.exports = n(121)(t);
const {
formatters: i
} = e.exports;
i.j = function(e) {
try {
return JSON.stringify(e)
} catch (e) {
return "[UnexpectedJSONParseError]: " + e.message
}
}
}).call(this, n(10))
}, function(e, t, n) {
var r = n(123),
i = n(124),
o = i;
o.v1 = r, o.v4 = i, e.exports = o
}, function(e, t) {
var n = "undefined" != typeof crypto && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || "undefined" != typeof msCrypto && "function" == typeof window.msCrypto.getRandomValues && msCrypto.getRandomValues.bind(msCrypto);
if (n) {
var r = new Uint8Array(16);
e.exports = function() {
return n(r), r
}
} else {
var i = new Array(16);
e.exports = function() {
for (var e, t = 0; t < 16; t++) 0 == (3 & t) && (e = 4294967296 * Math.random()), i[t] = e >>> ((3 & t) << 3) & 255;
return i
}
}
}, function(e, t) {
for (var n = [], r = 0; r < 256; ++r) n[r] = (r + 256).toString(16).substr(1);
e.exports = function(e, t) {
var r = t || 0,
i = n;
return [i[e[r++]], i[e[r++]], i[e[r++]], i[e[r++]], "-", i[e[r++]], i[e[r++]], "-", i[e[r++]], i[e[r++]], "-", i[e[r++]], i[e[r++]], "-", i[e[r++]], i[e[r++]], i[e[r++]], i[e[r++]], i[e[r++]], i[e[r++]]].join("")
}
}, function(e, t) {
var n;
n = function() {
return this
}();
try {
n = n || new Function("return this")()
} catch (e) {
"object" == typeof window && (n = window)
}
e.exports = n
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.promise = t.cb = t.namespaces = t.getLogger = t.enable = t.disable = void 0;
const r = n(28);
var i = n(28);
Object.defineProperty(t, "disable", {
enumerable: !0,
get: function() {
return i.disable
}
}), Object.defineProperty(t, "enable", {
enumerable: !0,
get: function() {
return i.enable
}
});
const o = {},
a = {};

function s(e) {
let t = ["log", "info", "warn", "error", "debug", "trace"].reduce((t, n) => (t[n] = function(e, t) {
const n = r("".concat(e.ns, ":").concat(t));
if (e.context) {
return new Proxy(n, {
apply: function(t, n, r) {
const [i, ...o] = r;
return t.call(n, "".concat(e.context, " ").concat(i), ...o)
}
})
}
return n
}(e, n), t), {});
if ("object" == typeof window && "object" == typeof window.console) try {
t.log.log = window.console.log.bind(window.console), t.info.log = window.console.info.bind(window.console), t.warn.log = window.console.warn.bind(window.console), t.error.log = window.console.error.bind(window.console), t.debug.log = (window.console.debug ? window.console.debug : window.console.log).bind(window.console), t.trace.log = (window.console.trace ? window.console.trace : window.console.log).bind(window.console)
} catch (e) {}
return t
}

function c(e, t, n) {
const r = "string" == typeof e ? {
ns: e,
context: t,
cache: n
} : e;
let i;
if (!1 === r.cache) i = s(r);
else {
let e = r.context ? "".concat(r.ns, "@@").concat(r.context) : r.ns;
a[e] || (o[r.ns] = !0, a[e] = s(r)), i = a[e]
}
return i
}
t.getLogger = c, t.namespaces = function() {
return Object.keys(o)
}, t.cb = function(e = "") {
const t = c(e);
return (e, n) => {
e ? t.error(e) : t.info(n)
}
}, t.promise = function(e, t = "") {
const n = c(t);
return e.then((function(e) {
n.info(e)
}), (function(e) {
n.error(e)
}))
}
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.VivochaChannel = void 0;
const r = n(9),
i = n(4),
o = n(29),
a = i.default("vvc-channel");
class s extends r.EventEmitter {
constructor() {
super(), this._proxable = !0, this.contacts = {}, this.opts = {}, this.trigger = this.emit, this.bind = this.on, this.unbind = this.removeListener, this.defaultHandlers = {
vvcmsg: e => {
a.debug("vvcmsg", e), this.emit("vvcmsg", e), e.id && this.emit(e.id, e)
},
joined: this.getProxyEventHandler("joined"),
left: this.getProxyEventHandler("left"),
cleared: this.getProxyEventHandler("cleared"),
close: this.getProxyEventHandler("close"),
transferred: this.getProxyEventHandler("transferred")
}
}
ws(e, t, n = {}, r = {}) {
return r.credentials = "include", vivocha.ws(e, t, n, r)
}
disconnect() {
if (this.socket) {
for (let e in this.defaultHandlers) this.removeAllListeners(e);
this.socket.disconnect()
}
}
isConnected() {
return this.socket && this.socket.isConnected()
}
getProxyEventHandler(e) {
return t => {
this.proxyEvent(e, t)
}
}
proxyEvent(e, t) {
this.emit(e, t), t && t.id && ("vvcmsg" != e && (t.code = e), this.emit(t.id, t))
}
createSocket(e, t) {
this.socket && this.disconnect(), this.socket = new o.VivochaSocket(this.defaultHandlers);
const n = ["connecting", "reconnecting", "connect", "reconnect", "disconnect", "failed"];
for (let e = 0; e < n.length; e++) this.socket.on(n[e], this.getProxyEventHandler(n[e]));
this.socket.connect(vivocha.extend(this.opts, e), e => {
e ? (a.error("socket connection failed", e), t && t("socket connection failed")) : t()
})
}
send(...e) {
let t, n = e[e.length - 1];
if ("function" == typeof n) {
let r = setTimeout((function() {
t && n(new Error("timeout"))
}), 6e3);
e[e.length - 1] = function(...e) {
clearTimeout(r), n.apply(n, e)
}
}
return t = this.socket && this.socket.isConnected() && this.socket.send.apply(this.socket, e), t
}
encode(e) {
return e
}
decode(e) {
return e
}
registerContact(e) {
if (!e || !e.id) throw new Error("bad_contact");
this.contacts[e.id] && this.contacts[e.id].release(), this.contacts[e.id] = e
}
unregisterContact(e) {
this.contacts[e] && (this.contacts[e].release(), delete this.contacts[e])
}
}
t.VivochaChannel = s
}, , function(e, t, n) {
e.exports = function(e) {
function t(e) {
let n, i, o, a = null;

function s(...e) {
if (!s.enabled) return;
const r = s,
i = Number(new Date),
o = i - (n || i);
r.diff = o, r.prev = n, r.curr = i, n = i, e[0] = t.coerce(e[0]), "string" != typeof e[0] && e.unshift("%O");
let a = 0;
e[0] = e[0].replace(/%([a-zA-Z%])/g, (n, i) => {
if ("%%" === n) return "%";
a++;
const o = t.formatters[i];
if ("function" == typeof o) {
const t = e[a];
n = o.call(r, t), e.splice(a, 1), a--
}
return n
}), t.formatArgs.call(r, e);
(r.log || t.log).apply(r, e)
}
return s.namespace = e, s.useColors = t.useColors(), s.color = t.selectColor(e), s.extend = r, s.destroy = t.destroy, Object.defineProperty(s, "enabled", {
enumerable: !0,
configurable: !1,
get: () => null !== a ? a : (i !== t.namespaces && (i = t.namespaces, o = t.enabled(e)), o),
set: e => {
a = e
}
}), "function" == typeof t.init && t.init(s), s
}

function r(e, n) {
const r = t(this.namespace + (void 0 === n ? ":" : n) + e);
return r.log = this.log, r
}

function i(e) {
return e.toString().substring(2, e.toString().length - 2).replace(/\.\*\?$/, "*")
}
return t.debug = t, t.default = t, t.coerce = function(e) {
if (e instanceof Error) return e.stack || e.message;
return e
}, t.disable = function() {
const e = [...t.names.map(i), ...t.skips.map(i).map(e => "-" + e)].join(",");
return t.enable(""), e
}, t.enable = function(e) {
let n;
t.save(e), t.namespaces = e, t.names = [], t.skips = [];
const r = ("string" == typeof e ? e : "").split(/[\s,]+/),
i = r.length;
for (n = 0; n < i; n++) r[n] && ("-" === (e = r[n].replace(/\*/g, ".*?"))[0] ? t.skips.push(new RegExp("^" + e.substr(1) + "$")) : t.names.push(new RegExp("^" + e + "$")))
}, t.enabled = function(e) {
if ("*" === e[e.length - 1]) return !0;
let n, r;
for (n = 0, r = t.skips.length; n < r; n++)
if (t.skips[n].test(e)) return !1;
for (n = 0, r = t.names.length; n < r; n++)
if (t.names[n].test(e)) return !0;
return !1
}, t.humanize = n(59), t.destroy = function() {
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")
}, Object.keys(e).forEach(n => {
t[n] = e[n]
}), t.names = [], t.skips = [], t.formatters = {}, t.selectColor = function(e) {
let n = 0;
for (let t = 0; t < e.length; t++) n = (n << 5) - n + e.charCodeAt(t), n |= 0;
return t.colors[Math.abs(n) % t.colors.length]
}, t.enable(t.load()), t
}
}, function(e, t) {
var n = 1e3,
r = 6e4,
i = 60 * r,
o = 24 * i;

function a(e, t, n, r) {
var i = t >= 1.5 * n;
return Math.round(e / n) + " " + r + (i ? "s" : "")
}
e.exports = function(e, t) {
t = t || {};
var s = typeof e;
if ("string" === s && e.length > 0) return function(e) {
if ((e = String(e)).length > 100) return;
var t = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);
if (!t) return;
var a = parseFloat(t[1]);
switch ((t[2] || "ms").toLowerCase()) {
case "years":
case "year":
case "yrs":
case "yr":
case "y":
return 315576e5 * a;
case "weeks":
case "week":
case "w":
return 6048e5 * a;
case "days":
case "day":
case "d":
return a * o;
case "hours":
case "hour":
case "hrs":
case "hr":
case "h":
return a * i;
case "minutes":
case "minute":
case "mins":
case "min":
case "m":
return a * r;
case "seconds":
case "second":
case "secs":
case "sec":
case "s":
return a * n;
case "milliseconds":
case "millisecond":
case "msecs":
case "msec":
case "ms":
return a;
default:
return
}
}(e);
if ("number" === s && isFinite(e)) return t.long ? function(e) {
var t = Math.abs(e);
if (t >= o) return a(e, t, o, "day");
if (t >= i) return a(e, t, i, "hour");
if (t >= r) return a(e, t, r, "minute");
if (t >= n) return a(e, t, n, "second");
return e + " ms"
}(e) : function(e) {
var t = Math.abs(e);
if (t >= o) return Math.round(e / o) + "d";
if (t >= i) return Math.round(e / i) + "h";
if (t >= r) return Math.round(e / r) + "m";
if (t >= n) return Math.round(e / n) + "s";
return e + "ms"
}(e);
throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(e))
}
}, function(e, t, n) {
var r = n(61),
i = n(19),
o = n(32),
a = n(13)("socket.io-client");
e.exports = t = c;
var s = t.managers = {};

function c(e, t) {
"object" == typeof e && (t = e, e = void 0), t = t || {};
var n, i = r(e),
c = i.source,
u = i.id,
h = i.path,
d = s[u] && h in s[u].nsps;
return t.forceNew || t["force new connection"] || !1 === t.multiplex || d ? (a("ignoring socket cache for %s", c), n = o(c, t)) : (s[u] || (a("new io instance for %s", c), s[u] = o(c, t)), n = s[u]), i.query && !t.query && (t.query = i.query), n.socket(i.path, t)
}
t.protocol = i.protocol, t.connect = c, t.Manager = n(32), t.Socket = n(38)
}, function(e, t, n) {
var r = n(30),
i = n(13)("socket.io-client:url");
e.exports = function(e, t) {
var n = e;
t = t || "undefined" != typeof location && location, null == e && (e = t.protocol + "//" + t.host);
"string" == typeof e && ("/" === e.charAt(0) && (e = "/" === e.charAt(1) ? t.protocol + e : t.host + e), /^(https?|wss?):\/\//.test(e) || (i("protocol-less url %s", e), e = void 0 !== t ? t.protocol + "//" + e : "https://" + e), i("parse %s", e), n = r(e));
n.port || (/^(http|ws)$/.test(n.protocol) ? n.port = "80" : /^(http|ws)s$/.test(n.protocol) && (n.port = "443"));
n.path = n.path || "/";
var o = -1 !== n.host.indexOf(":") ? "[" + n.host + "]" : n.host;
return n.id = n.protocol + "://" + o + ":" + n.port, n.href = n.protocol + "://" + o + (t && t.port === n.port ? "" : ":" + n.port), n
}
}, function(e, t, n) {
function r(e) {
var n;

function r() {
if (r.enabled) {
var e = r,
i = +new Date,
o = i - (n || i);
e.diff = o, e.prev = n, e.curr = i, n = i;
for (var a = new Array(arguments.length), s = 0; s < a.length; s++) a[s] = arguments[s];
a[0] = t.coerce(a[0]), "string" != typeof a[0] && a.unshift("%O");
var c = 0;
a[0] = a[0].replace(/%([a-zA-Z%])/g, (function(n, r) {
if ("%%" === n) return n;
c++;
var i = t.formatters[r];
if ("function" == typeof i) {
var o = a[c];
n = i.call(e, o), a.splice(c, 1), c--
}
return n
})), t.formatArgs.call(e, a);
var u = r.log || t.log || console.log.bind(console);
u.apply(e, a)
}
}
return r.namespace = e, r.enabled = t.enabled(e), r.useColors = t.useColors(), r.color = function(e) {
var n, r = 0;
for (n in e) r = (r << 5) - r + e.charCodeAt(n), r |= 0;
return t.colors[Math.abs(r) % t.colors.length]
}(e), r.destroy = i, "function" == typeof t.init && t.init(r), t.instances.push(r), r
}

function i() {
var e = t.instances.indexOf(this);
return -1 !== e && (t.instances.splice(e, 1), !0)
}(t = e.exports = r.debug = r.default = r).coerce = function(e) {
return e instanceof Error ? e.stack || e.message : e
}, t.disable = function() {
t.enable("")
}, t.enable = function(e) {
var n;
t.save(e), t.names = [], t.skips = [];
var r = ("string" == typeof e ? e : "").split(/[\s,]+/),
i = r.length;
for (n = 0; n < i; n++) r[n] && ("-" === (e = r[n].replace(/\*/g, ".*?"))[0] ? t.skips.push(new RegExp("^" + e.substr(1) + "$")) : t.names.push(new RegExp("^" + e + "$")));
for (n = 0; n < t.instances.length; n++) {
var o = t.instances[n];
o.enabled = t.enabled(o.namespace)
}
}, t.enabled = function(e) {
if ("*" === e[e.length - 1]) return !0;
var n, r;
for (n = 0, r = t.skips.length; n < r; n++)
if (t.skips[n].test(e)) return !1;
for (n = 0, r = t.names.length; n < r; n++)
if (t.names[n].test(e)) return !0;
return !1
}, t.humanize = n(63), t.instances = [], t.names = [], t.skips = [], t.formatters = {}
}, function(e, t) {
var n = 1e3,
r = 6e4,
i = 60 * r,
o = 24 * i;

function a(e, t, n) {
if (!(e < t)) return e < 1.5 * t ? Math.floor(e / t) + " " + n : Math.ceil(e / t) + " " + n + "s"
}
e.exports = function(e, t) {
t = t || {};
var s, c = typeof e;
if ("string" === c && e.length > 0) return function(e) {
if ((e = String(e)).length > 100) return;
var t = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);
if (!t) return;
var a = parseFloat(t[1]);
switch ((t[2] || "ms").toLowerCase()) {
case "years":
case "year":
case "yrs":
case "yr":
case "y":
return 315576e5 * a;
case "days":
case "day":
case "d":
return a * o;
case "hours":
case "hour":
case "hrs":
case "hr":
case "h":
return a * i;
case "minutes":
case "minute":
case "mins":
case "min":
case "m":
return a * r;
case "seconds":
case "second":
case "secs":
case "sec":
case "s":
return a * n;
case "milliseconds":
case "millisecond":
case "msecs":
case "msec":
case "ms":
return a;
default:
return
}
}(e);
if ("number" === c && !1 === isNaN(e)) return t.long ? a(s = e, o, "day") || a(s, i, "hour") || a(s, r, "minute") || a(s, n, "second") || s + " ms" : function(e) {
if (e >= o) return Math.round(e / o) + "d";
if (e >= i) return Math.round(e / i) + "h";
if (e >= r) return Math.round(e / r) + "m";
if (e >= n) return Math.round(e / n) + "s";
return e + "ms"
}(e);
throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(e))
}
}, function(e, t, n) {
(function(r) {
function i() {
var e;
try {
e = t.storage.debug
} catch (e) {}
return !e && void 0 !== r && "env" in r && (e = r.env.DEBUG), e
}(t = e.exports = n(65)).log = function() {
return "object" == typeof console && console.log && Function.prototype.apply.call(console.log, console, arguments)
}, t.formatArgs = function(e) {
var n = this.useColors;
if (e[0] = (n ? "%c" : "") + this.namespace + (n ? " %c" : " ") + e[0] + (n ? "%c " : " ") + "+" + t.humanize(this.diff), !n) return;
var r = "color: " + this.color;
e.splice(1, 0, r, "color: inherit");
var i = 0,
o = 0;
e[0].replace(/%[a-zA-Z%]/g, (function(e) {
"%%" !== e && (i++, "%c" === e && (o = i))
})), e.splice(o, 0, r)
}, t.save = function(e) {
try {
null == e ? t.storage.removeItem("debug") : t.storage.debug = e
} catch (e) {}
}, t.load = i, t.useColors = function() {
if ("undefined" != typeof window && window.process && "renderer" === window.process.type) return !0;
if ("undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return !1;
return "undefined" != typeof document && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || "undefined" != typeof window && window.console && (window.console.firebug || window.console.exception && window.console.table) || "undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || "undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)
}, t.storage = "undefined" != typeof chrome && void 0 !== chrome.storage ? chrome.storage.local : function() {
try {
return window.localStorage
} catch (e) {}
}(), t.colors = ["#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33"], t.formatters.j = function(e) {
try {
return JSON.stringify(e)
} catch (e) {
return "[UnexpectedJSONParseError]: " + e.message
}
}, t.enable(i())
}).call(this, n(10))
}, function(e, t, n) {
function r(e) {
var n;

function r() {
if (r.enabled) {
var e = r,
i = +new Date,
o = i - (n || i);
e.diff = o, e.prev = n, e.curr = i, n = i;
for (var a = new Array(arguments.length), s = 0; s < a.length; s++) a[s] = arguments[s];
a[0] = t.coerce(a[0]), "string" != typeof a[0] && a.unshift("%O");
var c = 0;
a[0] = a[0].replace(/%([a-zA-Z%])/g, (function(n, r) {
if ("%%" === n) return n;
c++;
var i = t.formatters[r];
if ("function" == typeof i) {
var o = a[c];
n = i.call(e, o), a.splice(c, 1), c--
}
return n
})), t.formatArgs.call(e, a);
var u = r.log || t.log || console.log.bind(console);
u.apply(e, a)
}
}
return r.namespace = e, r.enabled = t.enabled(e), r.useColors = t.useColors(), r.color = function(e) {
var n, r = 0;
for (n in e) r = (r << 5) - r + e.charCodeAt(n), r |= 0;
return t.colors[Math.abs(r) % t.colors.length]
}(e), r.destroy = i, "function" == typeof t.init && t.init(r), t.instances.push(r), r
}

function i() {
var e = t.instances.indexOf(this);
return -1 !== e && (t.instances.splice(e, 1), !0)
}(t = e.exports = r.debug = r.default = r).coerce = function(e) {
return e instanceof Error ? e.stack || e.message : e
}, t.disable = function() {
t.enable("")
}, t.enable = function(e) {
var n;
t.save(e), t.names = [], t.skips = [];
var r = ("string" == typeof e ? e : "").split(/[\s,]+/),
i = r.length;
for (n = 0; n < i; n++) r[n] && ("-" === (e = r[n].replace(/\*/g, ".*?"))[0] ? t.skips.push(new RegExp("^" + e.substr(1) + "$")) : t.names.push(new RegExp("^" + e + "$")));
for (n = 0; n < t.instances.length; n++) {
var o = t.instances[n];
o.enabled = t.enabled(o.namespace)
}
}, t.enabled = function(e) {
if ("*" === e[e.length - 1]) return !0;
var n, r;
for (n = 0, r = t.skips.length; n < r; n++)
if (t.skips[n].test(e)) return !1;
for (n = 0, r = t.names.length; n < r; n++)
if (t.names[n].test(e)) return !0;
return !1
}, t.humanize = n(66), t.instances = [], t.names = [], t.skips = [], t.formatters = {}
}, function(e, t) {
var n = 1e3,
r = 6e4,
i = 60 * r,
o = 24 * i;

function a(e, t, n) {
if (!(e < t)) return e < 1.5 * t ? Math.floor(e / t) + " " + n : Math.ceil(e / t) + " " + n + "s"
}
e.exports = function(e, t) {
t = t || {};
var s, c = typeof e;
if ("string" === c && e.length > 0) return function(e) {
if ((e = String(e)).length > 100) return;
var t = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);
if (!t) return;
var a = parseFloat(t[1]);
switch ((t[2] || "ms").toLowerCase()) {
case "years":
case "year":
case "yrs":
case "yr":
case "y":
return 315576e5 * a;
case "days":
case "day":
case "d":
return a * o;
case "hours":
case "hour":
case "hrs":
case "hr":
case "h":
return a * i;
case "minutes":
case "minute":
case "mins":
case "min":
case "m":
return a * r;
case "seconds":
case "second":
case "secs":
case "sec":
case "s":
return a * n;
case "milliseconds":
case "millisecond":
case "msecs":
case "msec":
case "ms":
return a;
default:
return
}
}(e);
if ("number" === c && !1 === isNaN(e)) return t.long ? a(s = e, o, "day") || a(s, i, "hour") || a(s, r, "minute") || a(s, n, "second") || s + " ms" : function(e) {
if (e >= o) return Math.round(e / o) + "d";
if (e >= i) return Math.round(e / i) + "h";
if (e >= r) return Math.round(e / r) + "m";
if (e >= n) return Math.round(e / n) + "s";
return e + "ms"
}(e);
throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(e))
}
}, function(e, t, n) {
var r = n(20),
i = n(31),
o = Object.prototype.toString,
a = "function" == typeof Blob || "undefined" != typeof Blob && "[object BlobConstructor]" === o.call(Blob),
s = "function" == typeof File || "undefined" != typeof File && "[object FileConstructor]" === o.call(File);
t.deconstructPacket = function(e) {
var t = [],
n = e.data,
o = e;
return o.data = function e(t, n) {
if (!t) return t;
if (i(t)) {
var o = {
_placeholder: !0,
num: n.length
};
return n.push(t), o
}
if (r(t)) {
for (var a = new Array(t.length), s = 0; s < t.length; s++) a[s] = e(t[s], n);
return a
}
if ("object" == typeof t && !(t instanceof Date)) {
a = {};
for (var c in t) a[c] = e(t[c], n);
return a
}
return t
}(n, t), o.attachments = t.length, {
packet: o,
buffers: t
}
}, t.reconstructPacket = function(e, t) {
return e.data = function e(t, n) {
if (!t) return t;
if (t && t._placeholder) return n[t.num];
if (r(t))
for (var i = 0; i < t.length; i++) t[i] = e(t[i], n);
else if ("object" == typeof t)
for (var o in t) t[o] = e(t[o], n);
return t
}(e.data, t), e.attachments = void 0, e
}, t.removeBlobs = function(e, t) {
var n = 0,
o = e;
! function e(c, u, h) {
if (!c) return c;
if (a && c instanceof Blob || s && c instanceof File) {
n++;
var d = new FileReader;
d.onload = function() {
h ? h[u] = this.result : o = this.result, --n || t(o)
}, d.readAsArrayBuffer(c)
} else if (r(c))
for (var l = 0; l < c.length; l++) e(c[l], l, c);
else if ("object" == typeof c && !i(c))
for (var f in c) e(c[f], f, c)
}(o), n || t(o)
}
}, function(e, t, n) {
"use strict";
t.byteLength = function(e) {
var t = u(e),
n = t[0],
r = t[1];
return 3 * (n + r) / 4 - r
}, t.toByteArray = function(e) {
var t, n, r = u(e),
a = r[0],
s = r[1],
c = new o(function(e, t, n) {
return 3 * (t + n) / 4 - n
}(0, a, s)),
h = 0,
d = s > 0 ? a - 4 : a;
for (n = 0; n < d; n += 4) t = i[e.charCodeAt(n)] << 18 | i[e.charCodeAt(n + 1)] << 12 | i[e.charCodeAt(n + 2)] << 6 | i[e.charCodeAt(n + 3)], c[h++] = t >> 16 & 255, c[h++] = t >> 8 & 255, c[h++] = 255 & t;
2 === s && (t = i[e.charCodeAt(n)] << 2 | i[e.charCodeAt(n + 1)] >> 4, c[h++] = 255 & t);
1 === s && (t = i[e.charCodeAt(n)] << 10 | i[e.charCodeAt(n + 1)] << 4 | i[e.charCodeAt(n + 2)] >> 2, c[h++] = t >> 8 & 255, c[h++] = 255 & t);
return c
}, t.fromByteArray = function(e) {
for (var t, n = e.length, i = n % 3, o = [], a = 0, s = n - i; a < s; a += 16383) o.push(h(e, a, a + 16383 > s ? s : a + 16383));
1 === i ? (t = e[n - 1], o.push(r[t >> 2] + r[t << 4 & 63] + "==")) : 2 === i && (t = (e[n - 2] << 8) + e[n - 1], o.push(r[t >> 10] + r[t >> 4 & 63] + r[t << 2 & 63] + "="));
return o.join("")
};
for (var r = [], i = [], o = "undefined" != typeof Uint8Array ? Uint8Array : Array, a = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", s = 0, c = a.length; s < c; ++s) r[s] = a[s], i[a.charCodeAt(s)] = s;

function u(e) {
var t = e.length;
if (t % 4 > 0) throw new Error("Invalid string. Length must be a multiple of 4");
var n = e.indexOf("=");
return -1 === n && (n = t), [n, n === t ? 0 : 4 - n % 4]
}

function h(e, t, n) {
for (var i, o, a = [], s = t; s < n; s += 3) i = (e[s] << 16 & 16711680) + (e[s + 1] << 8 & 65280) + (255 & e[s + 2]), a.push(r[(o = i) >> 18 & 63] + r[o >> 12 & 63] + r[o >> 6 & 63] + r[63 & o]);
return a.join("")
}
i["-".charCodeAt(0)] = 62, i["_".charCodeAt(0)] = 63
}, function(e, t) {
t.read = function(e, t, n, r, i) {
var o, a, s = 8 * i - r - 1,
c = (1 << s) - 1,
u = c >> 1,
h = -7,
d = n ? i - 1 : 0,
l = n ? -1 : 1,
f = e[t + d];
for (d += l, o = f & (1 << -h) - 1, f >>= -h, h += s; h > 0; o = 256 * o + e[t + d], d += l, h -= 8);
for (a = o & (1 << -h) - 1, o >>= -h, h += r; h > 0; a = 256 * a + e[t + d], d += l, h -= 8);
if (0 === o) o = 1 - u;
else {
if (o === c) return a ? NaN : 1 / 0 * (f ? -1 : 1);
a += Math.pow(2, r), o -= u
}
return (f ? -1 : 1) * a * Math.pow(2, o - r)
}, t.write = function(e, t, n, r, i, o) {
var a, s, c, u = 8 * o - i - 1,
h = (1 << u) - 1,
d = h >> 1,
l = 23 === i ? Math.pow(2, -24) - Math.pow(2, -77) : 0,
f = r ? 0 : o - 1,
p = r ? 1 : -1,
g = t < 0 || 0 === t && 1 / t < 0 ? 1 : 0;
for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (s = isNaN(t) ? 1 : 0, a = h) : (a = Math.floor(Math.log(t) / Math.LN2), t * (c = Math.pow(2, -a)) < 1 && (a--, c *= 2), (t += a + d >= 1 ? l / c : l * Math.pow(2, 1 - d)) * c >= 2 && (a++, c /= 2), a + d >= h ? (s = 0, a = h) : a + d >= 1 ? (s = (t * c - 1) * Math.pow(2, i), a += d) : (s = t * Math.pow(2, d - 1) * Math.pow(2, i), a = 0)); i >= 8; e[n + f] = 255 & s, f += p, s /= 256, i -= 8);
for (a = a << i | s, u += i; u > 0; e[n + f] = 255 & a, f += p, a /= 256, u -= 8);
e[n + f - p] |= 128 * g
}
}, function(e, t) {
var n = {}.toString;
e.exports = Array.isArray || function(e) {
return "[object Array]" == n.call(e)
}
}, function(e, t, n) {
e.exports = n(72), e.exports.parser = n(6)
}, function(e, t, n) {
var r = n(33),
i = n(5),
o = n(16)("engine.io-client:socket"),
a = n(37),
s = n(6),
c = n(30),
u = n(14);

function h(e, t) {
if (!(this instanceof h)) return new h(e, t);
t = t || {}, e && "object" == typeof e && (t = e, e = null), e ? (e = c(e), t.hostname = e.host, t.secure = "https" === e.protocol || "wss" === e.protocol, t.port = e.port, e.query && (t.query = e.query)) : t.host && (t.hostname = c(t.host).host), this.secure = null != t.secure ? t.secure : "undefined" != typeof location && "https:" === location.protocol, t.hostname && !t.port && (t.port = this.secure ? "443" : "80"), this.agent = t.agent || !1, this.hostname = t.hostname || ("undefined" != typeof location ? location.hostname : "localhost"), this.port = t.port || ("undefined" != typeof location && location.port ? location.port : this.secure ? 443 : 80), this.query = t.query || {}, "string" == typeof this.query && (this.query = u.decode(this.query)), this.upgrade = !1 !== t.upgrade, this.path = (t.path || "/engine.io").replace(/\/$/, "") + "/", this.forceJSONP = !!t.forceJSONP, this.jsonp = !1 !== t.jsonp, this.forceBase64 = !!t.forceBase64, this.enablesXDR = !!t.enablesXDR, this.withCredentials = !1 !== t.withCredentials, this.timestampParam = t.timestampParam || "t", this.timestampRequests = t.timestampRequests, this.transports = t.transports || ["polling", "websocket"], this.transportOptions = t.transportOptions || {}, this.readyState = "", this.writeBuffer = [], this.prevBufferLen = 0, this.policyPort = t.policyPort || 843, this.rememberUpgrade = t.rememberUpgrade || !1, this.binaryType = null, this.onlyBinaryUpgrades = t.onlyBinaryUpgrades, this.perMessageDeflate = !1 !== t.perMessageDeflate && (t.perMessageDeflate || {}), !0 === this.perMessageDeflate && (this.perMessageDeflate = {}), this.perMessageDeflate && null == this.perMessageDeflate.threshold && (this.perMessageDeflate.threshold = 1024), this.pfx = t.pfx || void 0, this.key = t.key || void 0, this.passphrase = t.passphrase || void 0, this.cert = t.cert || void 0, this.ca = t.ca || void 0, this.ciphers = t.ciphers || void 0, this.rejectUnauthorized = void 0 === t.rejectUnauthorized || t.rejectUnauthorized, this.forceNode = !!t.forceNode, this.isReactNative = "undefined" != typeof navigator && "string" == typeof navigator.product && "reactnative" === navigator.product.toLowerCase(), ("undefined" == typeof self || this.isReactNative) && (t.extraHeaders && Object.keys(t.extraHeaders).length > 0 && (this.extraHeaders = t.extraHeaders), t.localAddress && (this.localAddress = t.localAddress)), this.id = null, this.upgrades = null, this.pingInterval = null, this.pingTimeout = null, this.pingIntervalTimer = null, this.pingTimeoutTimer = null, this.open()
}
e.exports = h, h.priorWebsocketSuccess = !1, i(h.prototype), h.protocol = s.protocol, h.Socket = h, h.Transport = n(23), h.transports = n(33), h.parser = n(6), h.prototype.createTransport = function(e) {
o('creating transport "%s"', e);
var t = function(e) {
var t = {};
for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
return t
}(this.query);
t.EIO = s.protocol, t.transport = e;
var n = this.transportOptions[e] || {};
return this.id && (t.sid = this.id), new r[e]({
query: t,
socket: this,
agent: n.agent || this.agent,
hostname: n.hostname || this.hostname,
port: n.port || this.port,
secure: n.secure || this.secure,
path: n.path || this.path,
forceJSONP: n.forceJSONP || this.forceJSONP,
jsonp: n.jsonp || this.jsonp,
forceBase64: n.forceBase64 || this.forceBase64,
enablesXDR: n.enablesXDR || this.enablesXDR,
withCredentials: n.withCredentials || this.withCredentials,
timestampRequests: n.timestampRequests || this.timestampRequests,
timestampParam: n.timestampParam || this.timestampParam,
policyPort: n.policyPort || this.policyPort,
pfx: n.pfx || this.pfx,
key: n.key || this.key,
passphrase: n.passphrase || this.passphrase,
cert: n.cert || this.cert,
ca: n.ca || this.ca,
ciphers: n.ciphers || this.ciphers,
rejectUnauthorized: n.rejectUnauthorized || this.rejectUnauthorized,
perMessageDeflate: n.perMessageDeflate || this.perMessageDeflate,
extraHeaders: n.extraHeaders || this.extraHeaders,
forceNode: n.forceNode || this.forceNode,
localAddress: n.localAddress || this.localAddress,
requestTimeout: n.requestTimeout || this.requestTimeout,
protocols: n.protocols || void 0,
isReactNative: this.isReactNative
})
}, h.prototype.open = function() {
var e;
if (this.rememberUpgrade && h.priorWebsocketSuccess && -1 !== this.transports.indexOf("websocket")) e = "websocket";
else {
if (0 === this.transports.length) {
var t = this;
return void setTimeout((function() {
t.emit("error", "No transports available")
}), 0)
}
e = this.transports[0]
}
this.readyState = "opening";
try {
e = this.createTransport(e)
} catch (e) {
return this.transports.shift(), void this.open()
}
e.open(), this.setTransport(e)
}, h.prototype.setTransport = function(e) {
o("setting transport %s", e.name);
var t = this;
this.transport && (o("clearing existing transport %s", this.transport.name), this.transport.removeAllListeners()), this.transport = e, e.on("drain", (function() {
t.onDrain()
})).on("packet", (function(e) {
t.onPacket(e)
})).on("error", (function(e) {
t.onError(e)
})).on("close", (function() {
t.onClose("transport close")
}))
}, h.prototype.probe = function(e) {
o('probing transport "%s"', e);
var t = this.createTransport(e, {
probe: 1
}),
n = !1,
r = this;

function i() {
if (r.onlyBinaryUpgrades) {
var i = !this.supportsBinary && r.transport.supportsBinary;
n = n || i
}
n || (o('probe transport "%s" opened', e), t.send([{
type: "ping",
data: "probe"
}]), t.once("packet", (function(i) {
if (!n)
if ("pong" === i.type && "probe" === i.data) {
if (o('probe transport "%s" pong', e), r.upgrading = !0, r.emit("upgrading", t), !t) return;
h.priorWebsocketSuccess = "websocket" === t.name, o('pausing current transport "%s"', r.transport.name), r.transport.pause((function() {
n || "closed" !== r.readyState && (o("changing transport and sending upgrade packet"), l(), r.setTransport(t), t.send([{
type: "upgrade"
}]), r.emit("upgrade", t), t = null, r.upgrading = !1, r.flush())
}))
} else {
o('probe transport "%s" failed', e);
var a = new Error("probe error");
a.transport = t.name, r.emit("upgradeError", a)
}
})))
}

function a() {
n || (n = !0, l(), t.close(), t = null)
}

function s(n) {
var i = new Error("probe error: " + n);
i.transport = t.name, a(), o('probe transport "%s" failed because of error: %s', e, n), r.emit("upgradeError", i)
}

function c() {
s("transport closed")
}

function u() {
s("socket closed")
}

function d(e) {
t && e.name !== t.name && (o('"%s" works - aborting "%s"', e.name, t.name), a())
}

function l() {
t.removeListener("open", i), t.removeListener("error", s), t.removeListener("close", c), r.removeListener("close", u), r.removeListener("upgrading", d)
}
h.priorWebsocketSuccess = !1, t.once("open", i), t.once("error", s), t.once("close", c), this.once("close", u), this.once("upgrading", d), t.open()
}, h.prototype.onOpen = function() {
if (o("socket open"), this.readyState = "open", h.priorWebsocketSuccess = "websocket" === this.transport.name, this.emit("open"), this.flush(), "open" === this.readyState && this.upgrade && this.transport.pause) {
o("starting upgrade probes");
for (var e = 0, t = this.upgrades.length; e < t; e++) this.probe(this.upgrades[e])
}
}, h.prototype.onPacket = function(e) {
if ("opening" === this.readyState || "open" === this.readyState || "closing" === this.readyState) switch (o('socket receive: type "%s", data "%s"', e.type, e.data), this.emit("packet", e), this.emit("heartbeat"), e.type) {
case "open":
this.onHandshake(JSON.parse(e.data));
break;
case "pong":
this.setPing(), this.emit("pong");
break;
case "error":
var t = new Error("server error");
t.code = e.data, this.onError(t);
break;
case "message":
this.emit("data", e.data), this.emit("message", e.data)
} else o('packet received with socket readyState "%s"', this.readyState)
}, h.prototype.onHandshake = function(e) {
this.emit("handshake", e), this.id = e.sid, this.transport.query.sid = e.sid, this.upgrades = this.filterUpgrades(e.upgrades), this.pingInterval = e.pingInterval, this.pingTimeout = e.pingTimeout, this.onOpen(), "closed" !== this.readyState && (this.setPing(), this.removeListener("heartbeat", this.onHeartbeat), this.on("heartbeat", this.onHeartbeat))
}, h.prototype.onHeartbeat = function(e) {
clearTimeout(this.pingTimeoutTimer);
var t = this;
t.pingTimeoutTimer = setTimeout((function() {
"closed" !== t.readyState && t.onClose("ping timeout")
}), e || t.pingInterval + t.pingTimeout)
}, h.prototype.setPing = function() {
var e = this;
clearTimeout(e.pingIntervalTimer), e.pingIntervalTimer = setTimeout((function() {
o("writing ping packet - expecting pong within %sms", e.pingTimeout), e.ping(), e.onHeartbeat(e.pingTimeout)
}), e.pingInterval)
}, h.prototype.ping = function() {
var e = this;
this.sendPacket("ping", (function() {
e.emit("ping")
}))
}, h.prototype.onDrain = function() {
this.writeBuffer.splice(0, this.prevBufferLen), this.prevBufferLen = 0, 0 === this.writeBuffer.length ? this.emit("drain") : this.flush()
}, h.prototype.flush = function() {
"closed" !== this.readyState && this.transport.writable && !this.upgrading && this.writeBuffer.length && (o("flushing %d packets in socket", this.writeBuffer.length), this.transport.send(this.writeBuffer), this.prevBufferLen = this.writeBuffer.length, this.emit("flush"))
}, h.prototype.write = h.prototype.send = function(e, t, n) {
return this.sendPacket("message", e, t, n), this
}, h.prototype.sendPacket = function(e, t, n, r) {
if ("function" == typeof t && (r = t, t = void 0), "function" == typeof n && (r = n, n = null), "closing" !== this.readyState && "closed" !== this.readyState) {
(n = n || {}).compress = !1 !== n.compress;
var i = {
type: e,
data: t,
options: n
};
this.emit("packetCreate", i), this.writeBuffer.push(i), r && this.once("flush", r), this.flush()
}
}, h.prototype.close = function() {
if ("opening" === this.readyState || "open" === this.readyState) {
this.readyState = "closing";
var e = this;
this.writeBuffer.length ? this.once("drain", (function() {
this.upgrading ? r() : t()
})) : this.upgrading ? r() : t()
}

function t() {
e.onClose("forced close"), o("socket closing - telling transport to close"), e.transport.close()
}

function n() {
e.removeListener("upgrade", n), e.removeListener("upgradeError", n), t()
}

function r() {
e.once("upgrade", n), e.once("upgradeError", n)
}
return this
}, h.prototype.onError = function(e) {
o("socket error %j", e), h.priorWebsocketSuccess = !1, this.emit("error", e), this.onClose("transport error", e)
}, h.prototype.onClose = function(e, t) {
if ("opening" === this.readyState || "open" === this.readyState || "closing" === this.readyState) {
o('socket close with reason: "%s"', e);
clearTimeout(this.pingIntervalTimer), clearTimeout(this.pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), this.readyState = "closed", this.id = null, this.emit("close", e, t), this.writeBuffer = [], this.prevBufferLen = 0
}
}, h.prototype.filterUpgrades = function(e) {
for (var t = [], n = 0, r = e.length; n < r; n++) ~a(this.transports, e[n]) && t.push(e[n]);
return t
}
}, function(e, t) {
try {
e.exports = "undefined" != typeof XMLHttpRequest && "withCredentials" in new XMLHttpRequest
} catch (t) {
e.exports = !1
}
}, function(e, t, n) {
var r = n(21),
i = n(34),
o = n(5),
a = n(15),
s = n(16)("engine.io-client:polling-xhr"),
c = n(22);

function u() {}

function h(e) {
if (i.call(this, e), this.requestTimeout = e.requestTimeout, this.extraHeaders = e.extraHeaders, "undefined" != typeof location) {
var t = "https:" === location.protocol,
n = location.port;
n || (n = t ? 443 : 80), this.xd = "undefined" != typeof location && e.hostname !== location.hostname || n !== e.port, this.xs = e.secure !== t
}
}

function d(e) {
this.method = e.method || "GET", this.uri = e.uri, this.xd = !!e.xd, this.xs = !!e.xs, this.async = !1 !== e.async, this.data = void 0 !== e.data ? e.data : null, this.agent = e.agent, this.isBinary = e.isBinary, this.supportsBinary = e.supportsBinary, this.enablesXDR = e.enablesXDR, this.withCredentials = e.withCredentials, this.requestTimeout = e.requestTimeout, this.pfx = e.pfx, this.key = e.key, this.passphrase = e.passphrase, this.cert = e.cert, this.ca = e.ca, this.ciphers = e.ciphers, this.rejectUnauthorized = e.rejectUnauthorized, this.extraHeaders = e.extraHeaders, this.create()
}
if (e.exports = h, e.exports.Request = d, a(h, i), h.prototype.supportsBinary = !0, h.prototype.request = function(e) {
return (e = e || {}).uri = this.uri(), e.xd = this.xd, e.xs = this.xs, e.agent = this.agent || !1, e.supportsBinary = this.supportsBinary, e.enablesXDR = this.enablesXDR, e.withCredentials = this.withCredentials, e.pfx = this.pfx, e.key = this.key, e.passphrase = this.passphrase, e.cert = this.cert, e.ca = this.ca, e.ciphers = this.ciphers, e.rejectUnauthorized = this.rejectUnauthorized, e.requestTimeout = this.requestTimeout, e.extraHeaders = this.extraHeaders, new d(e)
}, h.prototype.doWrite = function(e, t) {
var n = "string" != typeof e && void 0 !== e,
r = this.request({
method: "POST",
data: e,
isBinary: n
}),
i = this;
r.on("success", t), r.on("error", (function(e) {
i.onError("xhr post error", e)
})), this.sendXhr = r
}, h.prototype.doPoll = function() {
s("xhr poll");
var e = this.request(),
t = this;
e.on("data", (function(e) {
t.onData(e)
})), e.on("error", (function(e) {
t.onError("xhr poll error", e)
})), this.pollXhr = e
}, o(d.prototype), d.prototype.create = function() {
var e = {
agent: this.agent,
xdomain: this.xd,
xscheme: this.xs,
enablesXDR: this.enablesXDR
};
e.pfx = this.pfx, e.key = this.key, e.passphrase = this.passphrase, e.cert = this.cert, e.ca = this.ca, e.ciphers = this.ciphers, e.rejectUnauthorized = this.rejectUnauthorized;
var t = this.xhr = new r(e),
n = this;
try {
s("xhr open %s: %s", this.method, this.uri), t.open(this.method, this.uri, this.async);
try {
if (this.extraHeaders)
for (var i in t.setDisableHeaderCheck && t.setDisableHeaderCheck(!0), this.extraHeaders) this.extraHeaders.hasOwnProperty(i) && t.setRequestHeader(i, this.extraHeaders[i])
} catch (e) {}
if ("POST" === this.method) try {
this.isBinary ? t.setRequestHeader("Content-type", "application/octet-stream") : t.setRequestHeader("Content-type", "text/plain;charset=UTF-8")
} catch (e) {}
try {
t.setRequestHeader("Accept", "*/*")
} catch (e) {}
"withCredentials" in t && (t.withCredentials = this.withCredentials), this.requestTimeout && (t.timeout = this.requestTimeout), this.hasXDR() ? (t.onload = function() {
n.onLoad()
}, t.onerror = function() {
n.onError(t.responseText)
}) : t.onreadystatechange = function() {
if (2 === t.readyState) try {
var e = t.getResponseHeader("Content-Type");
(n.supportsBinary && "application/octet-stream" === e || "application/octet-stream; charset=UTF-8" === e) && (t.responseType = "arraybuffer")
} catch (e) {}
4 === t.readyState && (200 === t.status || 1223 === t.status ? n.onLoad() : setTimeout((function() {
n.onError("number" == typeof t.status ? t.status : 0)
}), 0))
}, s("xhr data %s", this.data), t.send(this.data)
} catch (e) {
return void setTimeout((function() {
n.onError(e)
}), 0)
}
"undefined" != typeof document && (this.index = d.requestsCount++, d.requests[this.index] = this)
}, d.prototype.onSuccess = function() {
this.emit("success"), this.cleanup()
}, d.prototype.onData = function(e) {
this.emit("data", e), this.onSuccess()
}, d.prototype.onError = function(e) {
this.emit("error", e), this.cleanup(!0)
}, d.prototype.cleanup = function(e) {
if (void 0 !== this.xhr && null !== this.xhr) {
if (this.hasXDR() ? this.xhr.onload = this.xhr.onerror = u : this.xhr.onreadystatechange = u, e) try {
this.xhr.abort()
} catch (e) {}
"undefined" != typeof document && delete d.requests[this.index], this.xhr = null
}
}, d.prototype.onLoad = function() {
var e;
try {
var t;
try {
t = this.xhr.getResponseHeader("Content-Type")
} catch (e) {}
e = ("application/octet-stream" === t || "application/octet-stream; charset=UTF-8" === t) && this.xhr.response || this.xhr.responseText
} catch (e) {
this.onError(e)
}
null != e && this.onData(e)
}, d.prototype.hasXDR = function() {
return "undefined" != typeof XDomainRequest && !this.xs && this.enablesXDR
}, d.prototype.abort = function() {
this.cleanup()
}, d.requestsCount = 0, d.requests = {}, "undefined" != typeof document)
if ("function" == typeof attachEvent) attachEvent("onunload", l);
else if ("function" == typeof addEventListener) {
addEventListener("onpagehide" in c ? "pagehide" : "unload", l, !1)
}

function l() {
for (var e in d.requests) d.requests.hasOwnProperty(e) && d.requests[e].abort()
}
}, function(e, t) {
e.exports = Object.keys || function(e) {
var t = [],
n = Object.prototype.hasOwnProperty;
for (var r in e) n.call(e, r) && t.push(r);
return t
}
}, function(e, t) {
e.exports = function(e, t, n) {
var r = e.byteLength;
if (t = t || 0, n = n || r, e.slice) return e.slice(t, n);
if (t < 0 && (t += r), n < 0 && (n += r), n > r && (n = r), t >= r || t >= n || 0 === r) return new ArrayBuffer(0);
for (var i = new Uint8Array(e), o = new Uint8Array(n - t), a = t, s = 0; a < n; a++, s++) o[s] = i[a];
return o.buffer
}
}, function(e, t) {
function n() {}
e.exports = function(e, t, r) {
var i = !1;
return r = r || n, o.count = e, 0 === e ? t() : o;

function o(e, n) {
if (o.count <= 0) throw new Error("after called too many times");
--o.count, e ? (i = !0, t(e), t = r) : 0 !== o.count || i || t(null, n)
}
}
}, function(e, t) {
var n, r, i, o = String.fromCharCode;

function a(e) {
for (var t, n, r = [], i = 0, o = e.length; i < o;)(t = e.charCodeAt(i++)) >= 55296 && t <= 56319 && i < o ? 56320 == (64512 & (n = e.charCodeAt(i++))) ? r.push(((1023 & t) << 10) + (1023 & n) + 65536) : (r.push(t), i--) : r.push(t);
return r
}

function s(e, t) {
if (e >= 55296 && e <= 57343) {
if (t) throw Error("Lone surrogate U+" + e.toString(16).toUpperCase() + " is not a scalar value");
return !1
}
return !0
}

function c(e, t) {
return o(e >> t & 63 | 128)
}

function u(e, t) {
if (0 == (4294967168 & e)) return o(e);
var n = "";
return 0 == (4294965248 & e) ? n = o(e >> 6 & 31 | 192) : 0 == (4294901760 & e) ? (s(e, t) || (e = 65533), n = o(e >> 12 & 15 | 224), n += c(e, 6)) : 0 == (4292870144 & e) && (n = o(e >> 18 & 7 | 240), n += c(e, 12), n += c(e, 6)), n += o(63 & e | 128)
}

function h() {
if (i >= r) throw Error("Invalid byte index");
var e = 255 & n[i];
if (i++, 128 == (192 & e)) return 63 & e;
throw Error("Invalid continuation byte")
}

function d(e) {
var t, o;
if (i > r) throw Error("Invalid byte index");
if (i == r) return !1;
if (t = 255 & n[i], i++, 0 == (128 & t)) return t;
if (192 == (224 & t)) {
if ((o = (31 & t) << 6 | h()) >= 128) return o;
throw Error("Invalid continuation byte")
}
if (224 == (240 & t)) {
if ((o = (15 & t) << 12 | h() << 6 | h()) >= 2048) return s(o, e) ? o : 65533;
throw Error("Invalid continuation byte")
}
if (240 == (248 & t) && (o = (7 & t) << 18 | h() << 12 | h() << 6 | h()) >= 65536 && o <= 1114111) return o;
throw Error("Invalid UTF-8 detected")
}
e.exports = {
version: "2.1.2",
encode: function(e, t) {
for (var n = !1 !== (t = t || {}).strict, r = a(e), i = r.length, o = -1, s = ""; ++o < i;) s += u(r[o], n);
return s
},
decode: function(e, t) {
var s = !1 !== (t = t || {}).strict;
n = a(e), r = n.length, i = 0;
for (var c, u = []; !1 !== (c = d(s));) u.push(c);
return function(e) {
for (var t, n = e.length, r = -1, i = ""; ++r < n;)(t = e[r]) > 65535 && (i += o((t -= 65536) >>> 10 & 1023 | 55296), t = 56320 | 1023 & t), i += o(t);
return i
}(u)
}
}
}, function(e, t) {
! function(e) {
"use strict";
t.encode = function(t) {
var n, r = new Uint8Array(t),
i = r.length,
o = "";
for (n = 0; n < i; n += 3) o += e[r[n] >> 2], o += e[(3 & r[n]) << 4 | r[n + 1] >> 4], o += e[(15 & r[n + 1]) << 2 | r[n + 2] >> 6], o += e[63 & r[n + 2]];
return i % 3 == 2 ? o = o.substring(0, o.length - 1) + "=" : i % 3 == 1 && (o = o.substring(0, o.length - 2) + "=="), o
}, t.decode = function(t) {
var n, r, i, o, a, s = .75 * t.length,
c = t.length,
u = 0;
"=" === t[t.length - 1] && (s--, "=" === t[t.length - 2] && s--);
var h = new ArrayBuffer(s),
d = new Uint8Array(h);
for (n = 0; n < c; n += 4) r = e.indexOf(t[n]), i = e.indexOf(t[n + 1]), o = e.indexOf(t[n + 2]), a = e.indexOf(t[n + 3]), d[u++] = r << 2 | i >> 4, d[u++] = (15 & i) << 4 | o >> 2, d[u++] = (3 & o) << 6 | 63 & a;
return h
}
}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")
}, function(e, t) {
var n = void 0 !== n ? n : "undefined" != typeof WebKitBlobBuilder ? WebKitBlobBuilder : "undefined" != typeof MSBlobBuilder ? MSBlobBuilder : "undefined" != typeof MozBlobBuilder && MozBlobBuilder,
r = function() {
try {
return 2 === new Blob(["hi"]).size
} catch (e) {
return !1
}
}(),
i = r && function() {
try {
return 2 === new Blob([new Uint8Array([1, 2])]).size
} catch (e) {
return !1
}
}(),
o = n && n.prototype.append && n.prototype.getBlob;

function a(e) {
return e.map((function(e) {
if (e.buffer instanceof ArrayBuffer) {
var t = e.buffer;
if (e.byteLength !== t.byteLength) {
var n = new Uint8Array(e.byteLength);
n.set(new Uint8Array(t, e.byteOffset, e.byteLength)), t = n.buffer
}
return t
}
return e
}))
}

function s(e, t) {
t = t || {};
var r = new n;
return a(e).forEach((function(e) {
r.append(e)
})), t.type ? r.getBlob(t.type) : r.getBlob()
}

function c(e, t) {
return new Blob(a(e), t || {})
}
"undefined" != typeof Blob && (s.prototype = Blob.prototype, c.prototype = Blob.prototype), e.exports = r ? i ? Blob : c : o ? s : void 0
}, function(e, t, n) {
function r(e) {
var n;

function r() {
if (r.enabled) {
var e = r,
i = +new Date,
o = i - (n || i);
e.diff = o, e.prev = n, e.curr = i, n = i;
for (var a = new Array(arguments.length), s = 0; s < a.length; s++) a[s] = arguments[s];
a[0] = t.coerce(a[0]), "string" != typeof a[0] && a.unshift("%O");
var c = 0;
a[0] = a[0].replace(/%([a-zA-Z%])/g, (function(n, r) {
if ("%%" === n) return n;
c++;
var i = t.formatters[r];
if ("function" == typeof i) {
var o = a[c];
n = i.call(e, o), a.splice(c, 1), c--
}
return n
})), t.formatArgs.call(e, a);
var u = r.log || t.log || console.log.bind(console);
u.apply(e, a)
}
}
return r.namespace = e, r.enabled = t.enabled(e), r.useColors = t.useColors(), r.color = function(e) {
var n, r = 0;
for (n in e) r = (r << 5) - r + e.charCodeAt(n), r |= 0;
return t.colors[Math.abs(r) % t.colors.length]
}(e), r.destroy = i, "function" == typeof t.init && t.init(r), t.instances.push(r), r
}

function i() {
var e = t.instances.indexOf(this);
return -1 !== e && (t.instances.splice(e, 1), !0)
}(t = e.exports = r.debug = r.default = r).coerce = function(e) {
return e instanceof Error ? e.stack || e.message : e
}, t.disable = function() {
t.enable("")
}, t.enable = function(e) {
var n;
t.save(e), t.names = [], t.skips = [];
var r = ("string" == typeof e ? e : "").split(/[\s,]+/),
i = r.length;
for (n = 0; n < i; n++) r[n] && ("-" === (e = r[n].replace(/\*/g, ".*?"))[0] ? t.skips.push(new RegExp("^" + e.substr(1) + "$")) : t.names.push(new RegExp("^" + e + "$")));
for (n = 0; n < t.instances.length; n++) {
var o = t.instances[n];
o.enabled = t.enabled(o.namespace)
}
}, t.enabled = function(e) {
if ("*" === e[e.length - 1]) return !0;
var n, r;
for (n = 0, r = t.skips.length; n < r; n++)
if (t.skips[n].test(e)) return !1;
for (n = 0, r = t.names.length; n < r; n++)
if (t.names[n].test(e)) return !0;
return !1
}, t.humanize = n(82), t.instances = [], t.names = [], t.skips = [], t.formatters = {}
}, function(e, t) {
var n = 1e3,
r = 6e4,
i = 60 * r,
o = 24 * i;

function a(e, t, n) {
if (!(e < t)) return e < 1.5 * t ? Math.floor(e / t) + " " + n : Math.ceil(e / t) + " " + n + "s"
}
e.exports = function(e, t) {
t = t || {};
var s, c = typeof e;
if ("string" === c && e.length > 0) return function(e) {
if ((e = String(e)).length > 100) return;
var t = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);
if (!t) return;
var a = parseFloat(t[1]);
switch ((t[2] || "ms").toLowerCase()) {
case "years":
case "year":
case "yrs":
case "yr":
case "y":
return 315576e5 * a;
case "days":
case "day":
case "d":
return a * o;
case "hours":
case "hour":
case "hrs":
case "hr":
case "h":
return a * i;
case "minutes":
case "minute":
case "mins":
case "min":
case "m":
return a * r;
case "seconds":
case "second":
case "secs":
case "sec":
case "s":
return a * n;
case "milliseconds":
case "millisecond":
case "msecs":
case "msec":
case "ms":
return a;
default:
return
}
}(e);
if ("number" === c && !1 === isNaN(e)) return t.long ? a(s = e, o, "day") || a(s, i, "hour") || a(s, r, "minute") || a(s, n, "second") || s + " ms" : function(e) {
if (e >= o) return Math.round(e / o) + "d";
if (e >= i) return Math.round(e / i) + "h";
if (e >= r) return Math.round(e / r) + "m";
if (e >= n) return Math.round(e / n) + "s";
return e + "ms"
}(e);
throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(e))
}
}, function(e, t, n) {
var r = n(34),
i = n(15),
o = n(22);
e.exports = h;
var a, s = /\n/g,
c = /\\n/g;

function u() {}

function h(e) {
r.call(this, e), this.query = this.query || {}, a || (a = o.___eio = o.___eio || []), this.index = a.length;
var t = this;
a.push((function(e) {
t.onData(e)
})), this.query.j = this.index, "function" == typeof addEventListener && addEventListener("beforeunload", (function() {
t.script && (t.script.onerror = u)
}), !1)
}
i(h, r), h.prototype.supportsBinary = !1, h.prototype.doClose = function() {
this.script && (this.script.parentNode.removeChild(this.script), this.script = null), this.form && (this.form.parentNode.removeChild(this.form), this.form = null, this.iframe = null), r.prototype.doClose.call(this)
}, h.prototype.doPoll = function() {
var e = this,
t = document.createElement("script");
this.script && (this.script.parentNode.removeChild(this.script), this.script = null), t.async = !0, t.src = this.uri(), t.onerror = function(t) {
e.onError("jsonp poll error", t)
};
var n = document.getElementsByTagName("script")[0];
n ? n.parentNode.insertBefore(t, n) : (document.head || document.body).appendChild(t), this.script = t, "undefined" != typeof navigator && /gecko/i.test(navigator.userAgent) && setTimeout((function() {
var e = document.createElement("iframe");
document.body.appendChild(e), document.body.removeChild(e)
}), 100)
}, h.prototype.doWrite = function(e, t) {
var n = this;
if (!this.form) {
var r, i = document.createElement("form"),
o = document.createElement("textarea"),
a = this.iframeId = "eio_iframe_" + this.index;
i.className = "socketio", i.style.position = "absolute", i.style.top = "-1000px", i.style.left = "-1000px", i.target = a, i.method = "POST", i.setAttribute("accept-charset", "utf-8"), o.name = "d", i.appendChild(o), document.body.appendChild(i), this.form = i, this.area = o
}

function u() {
h(), t()
}

function h() {
if (n.iframe) try {
n.form.removeChild(n.iframe)
} catch (e) {
n.onError("jsonp polling iframe removal error", e)
}
try {
var e = '<iframe src="javascript:0" name="' + n.iframeId + '">';
r = document.createElement(e)
} catch (e) {
(r = document.createElement("iframe")).name = n.iframeId, r.src = "javascript:0"
}
r.id = n.iframeId, n.form.appendChild(r), n.iframe = r
}
this.form.action = this.uri(), h(), e = e.replace(c, "\\\n"), this.area.value = e.replace(s, "\\n");
try {
this.form.submit()
} catch (e) {}
this.iframe.attachEvent ? this.iframe.onreadystatechange = function() {
"complete" === n.iframe.readyState && u()
} : this.iframe.onload = u
}
}, function(e, t, n) {
(function(t) {
var r, i, o = n(23),
a = n(6),
s = n(14),
c = n(15),
u = n(36),
h = n(16)("engine.io-client:websocket");
if ("undefined" != typeof WebSocket ? r = WebSocket : "undefined" != typeof self && (r = self.WebSocket || self.MozWebSocket), "undefined" == typeof window) try {
i = n(85)
} catch (e) {}
var d = r || i;

function l(e) {
e && e.forceBase64 && (this.supportsBinary = !1), this.perMessageDeflate = e.perMessageDeflate, this.usingBrowserWebSocket = r && !e.forceNode, this.protocols = e.protocols, this.usingBrowserWebSocket || (d = i), o.call(this, e)
}
e.exports = l, c(l, o), l.prototype.name = "websocket", l.prototype.supportsBinary = !0, l.prototype.doOpen = function() {
if (this.check()) {
var e = this.uri(),
t = this.protocols,
n = {};
this.isReactNative || (n.agent = this.agent, n.perMessageDeflate = this.perMessageDeflate, n.pfx = this.pfx, n.key = this.key, n.passphrase = this.passphrase, n.cert = this.cert, n.ca = this.ca, n.ciphers = this.ciphers, n.rejectUnauthorized = this.rejectUnauthorized), this.extraHeaders && (n.headers = this.extraHeaders), this.localAddress && (n.localAddress = this.localAddress);
try {
this.ws = this.usingBrowserWebSocket && !this.isReactNative ? t ? new d(e, t) : new d(e) : new d(e, t, n)
} catch (e) {
return this.emit("error", e)
}
void 0 === this.ws.binaryType && (this.supportsBinary = !1), this.ws.supports && this.ws.supports.binary ? (this.supportsBinary = !0, this.ws.binaryType = "nodebuffer") : this.ws.binaryType = "arraybuffer", this.addEventListeners()
}
}, l.prototype.addEventListeners = function() {
var e = this;
this.ws.onopen = function() {
e.onOpen()
}, this.ws.onclose = function() {
e.onClose()
}, this.ws.onmessage = function(t) {
e.onData(t.data)
}, this.ws.onerror = function(t) {
e.onError("websocket error", t)
}
}, l.prototype.write = function(e) {
var n = this;
this.writable = !1;
for (var r = e.length, i = 0, o = r; i < o; i++) ! function(e) {
a.encodePacket(e, n.supportsBinary, (function(i) {
if (!n.usingBrowserWebSocket) {
var o = {};
if (e.options && (o.compress = e.options.compress), n.perMessageDeflate)("string" == typeof i ? t.byteLength(i) : i.length) < n.perMessageDeflate.threshold && (o.compress = !1)
}
try {
n.usingBrowserWebSocket ? n.ws.send(i) : n.ws.send(i, o)
} catch (e) {
h("websocket closed before onclose event")
}--r || s()
}))
}(e[i]);

function s() {
n.emit("flush"), setTimeout((function() {
n.writable = !0, n.emit("drain")
}), 0)
}
}, l.prototype.onClose = function() {
o.prototype.onClose.call(this)
}, l.prototype.doClose = function() {
void 0 !== this.ws && this.ws.close()
}, l.prototype.uri = function() {
var e = this.query || {},
t = this.secure ? "wss" : "ws",
n = "";
return this.port && ("wss" === t && 443 !== Number(this.port) || "ws" === t && 80 !== Number(this.port)) && (n = ":" + this.port), this.timestampRequests && (e[this.timestampParam] = u()), this.supportsBinary || (e.b64 = 1), (e = s.encode(e)).length && (e = "?" + e), t + "://" + (-1 !== this.hostname.indexOf(":") ? "[" + this.hostname + "]" : this.hostname) + n + this.path + e
}, l.prototype.check = function() {
return !(!d || "__initialize" in d && this.name === l.prototype.name)
}
}).call(this, n(12).Buffer)
}, function(e, t) {}, function(e, t) {
e.exports = function(e, t) {
for (var n = [], r = (t = t || 0) || 0; r < e.length; r++) n[r - t] = e[r];
return n
}
}, function(e, t) {
function n(e) {
e = e || {}, this.ms = e.min || 100, this.max = e.max || 1e4, this.factor = e.factor || 2, this.jitter = e.jitter > 0 && e.jitter <= 1 ? e.jitter : 0, this.attempts = 0
}
e.exports = n, n.prototype.duration = function() {
var e = this.ms * Math.pow(this.factor, this.attempts++);
if (this.jitter) {
var t = Math.random(),
n = Math.floor(t * this.jitter * e);
e = 0 == (1 & Math.floor(10 * t)) ? e - n : e + n
}
return 0 | Math.min(e, this.max)
}, n.prototype.reset = function() {
this.attempts = 0
}, n.prototype.setMin = function(e) {
this.ms = e
}, n.prototype.setMax = function(e) {
this.max = e
}, n.prototype.setJitter = function(e) {
this.jitter = e
}
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.VivochaContact = void 0;
const r = n(89),
i = n(9),
o = n(49),
a = n(113),
s = n(4),
c = n(45),
u = s.default("vvc-contact");
class h extends i.EventEmitter {
constructor(e, t, n) {
super(), this.channel = e, this.id = t, this.contact = n, this._proxable = !0, this.secure = !1, this.dataChannels = {}, this.mediaEngines = {}, this.oldMedia = {}, this.requestTimers = {}, this.mediaState = "init", this.trigger = this.emit, this.bind = this.on, this.unbind = this.removeListener, this.disconnect = this.leave, this.mergeMedia = (() => e => this.getMedia().then(t => o.chain(t).reduce((e, t, n) => (e[n] || (e[n] = (e => {
let t = {
tx: !!e.tx,
rx: !!e.rx,
via: e.via || "net",
engine: e.engine || "Native"
};
if (e.data) {
let r = t.data = {};
for (var n in e.data) r[n] = e.data[n]
}
return t
})(t)), e), e).value()))(), this.on("Capabilities", (e, t) => {
u.log("VivochaContact.Capabilities", e), this.remoteCaps = Promise.resolve(e), this.localCaps.then(e => {
t(null, e)
}), this.emit("capabilities", e)
}), this.on("DataChannel", (e, t) => {
this.getDataChannel(e.id, "sio", !0).then(e => {
this.emit("datachannel", e), t()
}, e => {
t("failed")
})
}), this.on("MediaOffer", (e, t, n) => {
u.log("VivochaContact.MediaOffer", "offer", e, n), this.getLocalCapabilities().then(r => {
let i = r.Media || {};
for (let t in e) {
let n = e[t],
r = n.engine || "Native";
if (!("off" === n.tx && "off" === n.rx || i[t] && i[t].Engines && i[t].Engines[r])) throw u.error("VivochaContact.MediaOffer", "request media is not supported by client", n), new Error("unsupported");
var o = n.tx;
n.tx = n.rx, n.rx = o
}
return u.log("VivochaContact.MediaOffer", "adjusted offer", e), this.setMediaState("offered"), this.emitAndHandleFirst("mediaoffer", e, (e, n) => {
this.answer(e, n, t)
}, n)
})
}), this.on("MediaGet", (e, t) => {
vivocha.nodeify(this.getMedia().then(e => e), t)
}), this.on("MediaChange", e => {
let t = this.cloneMedia(e, !0),
n = this.diffMedia(this.oldMedia, t);
n && (u.debug("MediaChange", "new", JSON.stringify(e)), u.debug("MediaChange", "old", JSON.stringify(this.oldMedia)), u.debug("MediaChange", "cloned", JSON.stringify(t)), u.debug("MediaChange", "diff", n), this.oldMedia = t, this.emit("mediachange", e, n))
}), this.messageHandler = this.messageHandler.bind(this), this.reconnectHandler = this.reconnectHandler.bind(this), this.channel.on(this.id, this.messageHandler), this.channel.on("reconnect", this.reconnectHandler), this.channel.registerContact(this), this.ready = this.setContactInfo(this.contact)
}
messageHandler(e) {
switch (u.log("VivochaContact.messageHandler", e), e.code) {
case "message":
if (!e.type) return;
switch (this.secure && this.decryptMessage(e), this.emit("rawmessage", e), e.type) {
case "text":
e._id && this.sendAck(e._id), this.addToTranscript(e), this.emit("text", this.channel.decode(e.body), e.from_id, this.channel.decode(e.from_nick), e.agent);
break;
case "link":
e._id && this.sendAck(e._id), this.addToTranscript(e), this.emit("link", e.url, e.from_id, this.channel.decode(e.from_nick), this.channel.decode(e.desc), e.agent);
break;
case "attachment":
e._id && this.sendAck(e._id), this.addToTranscript(e), this.emit("attachment", e.url, e.meta, e.from_id, this.channel.decode(e.from_nick), e.agent);
break;
case "iswriting":
this.emit("iswriting", e.from_id, this.channel.decode(e.from_nick), e.agent);
break;
case "ack":
this.emit("ack", e.ref, e.from_id, this.channel.decode(e.from_nick), e.agent);
break;
case "read":
this.emit("read", e.ref, e.from_id, this.channel.decode(e.from_nick), e.agent);
break;
case "action":
switch (e.action_code) {
case "vvcreq":
e.args.length < 3 ? u.error("Malformed vvcreq", e.args) : this.listeners(e.args[1]).length ? this.emitAndHandleFirst(e.args[1], e.args[2], (t, n) => {
this.response(e.args[0], t, n)
}, e.args[0]) : (u.error("Unsupported vvcreq", e, e.args), u.error("channel", this.channel, "id", this.id, "data", this.data), this.response(e.args[0], "not_supported", {}));
break;
case "vvcres":
e.args.length < 2 ? u.error("Malformed vvcres", e.args) : this.listeners(e.args[0]).length ? this.emit(e.args[0], e.args[1], e.args[2]) : u.warn("No call back for vvcres", e.args[0]);
break;
default:
this.emit("action", e.action_code, e.args, e.from_id, this.channel.decode(e.from_nick), e.agent)
}
}
break;
case "left":
this.getMedia().then(t => {
let n, r = this.cloneMedia(t),
i = !1;
if (!1 === e.autoLeave)
for (let e in r) n = r[e], "Native" !== n.engine && (n.tx = n.rx = !1, delete r[e], i = !0);
else {
let t = "removed" === e.reason ? e.channel : "Native";
if (t) {
let e, n = !1;
for (let i in r) e = r[i], e.engine === t && (e.tx = e.rx = !1, delete r[i], n = !0)
}
}
i && this.transitMedia(t, r)
}), this.emit(e.code, e);
break;
case "cleared":
case "close":
case "joined":
this.emit(e.code, e);
break;
case "data":
this.emit(e.code, e), e.channel && this.dataChannels[e.channel] && this.dataChannels[e.channel].emit(e.topic || "data", e.data);
break;
case "transferred":
this.onTransferred(e);
break;
case "synced":
case "declined":
this.emit(e.code, e)
}
}
reconnectHandler() {
u.log("VivochaContact.reconnectHandler", this.id), this.channel.socket.sio.emit("sync", this.id)
}
setLocalCapability(e, t) {
return this.getLocalCapabilities().then(n => {
let r = c.dot(n, e);
return o.isEqual(r, t) ? n : (c.dot(n, e, t), this.setLocalCapabilities(n))
})
}
setLocalCapabilities(e) {
return "function" == typeof e.then ? this.localCaps = e : this.localCaps = Promise.resolve(e), this.remoteCaps && this.updateRemoteCapabilities(), this.emit("localcapabilities", e), this.localCaps
}
getLocalCapabilities() {
return this.localCaps
}
getRemoteCapabilities() {
return this.remoteCaps ? this.remoteCaps : this.updateRemoteCapabilities()
}
async updateRemoteCapabilities() {
const e = c.dot(this, "contact.initial_offer.Sharing");
return this.remoteCaps = new Promise(async (t, n) => {
if (e && e.tx && e.rx) {
const e = await this.localCaps;
this.request("Capabilities", e, 3e3, 8, (e, r) => {
e ? n(e) : t(r)
})
} else n(new Error("no_sharing"))
}).catch(e => ({})), this.remoteCaps
}
release() {
this.removeAllListeners();
for (let e in this.dataChannels) this.dataChannels[e].removeAllListeners(), delete this.dataChannels[e];
for (let e in this.mediaEngines) this.mediaEngines[e].release(), delete this.mediaEngines[e];
for (let e in this.requestTimers) clearTimeout(this.requestTimers[e]), delete this.requestTimers[e]
}
emitAndHandleFirst(...e) {
var t = e.length;
if (t && "function" == typeof arguments[t - 1]) {
let n = a.v4(),
r = e[t - 1];
e[t - 1] = (e, t) => {
this.emit(n, e, t)
}, this.once(n, r), this.emit.apply(this, e)
} else this.emit.apply(this, e)
}
onTransferred(e) {
this.emit(e.code, e)
}
hasHandler(e) {
return this.listeners(e).length > 0
}
addToTranscript(e) {
this.contact.transcript || (this.contact.transcript = []), e.ts || (e.ts = (new Date).toISOString()), this.contact.transcript.push(e), this.contact.messages_tot = this.contact.messages_tot ? this.contact.messages_tot + 1 : 1, e.agent ? (this.contact.messages_agent = this.contact.messages_agent ? this.contact.messages_agent + 1 : 1, this.contact.last_message = {
agent: e.ts || 1
}) : (this.contact.messages_vvcu = this.contact.messages_vvcu ? this.contact.messages_vvcu + 1 : 1, this.contact.last_message = {
vvcu: e.ts || 1
}), this.emit("message", e)
}
setContactInfo(e) {
let t = new Promise((t, n) => {
if (this.channel)
if (e) {
this.contact = e, this.nick = this.contact ? this.contact.nick : null, this.secure = !1;
let r = {};
o.each(this.contact.initial_offer, (e, t) => {
r[t] = {
tx: "off" !== e.tx,
rx: "off" !== e.rx,
via: e.via,
engine: e.engine
}
}), this.contact.initial_offer = this.cloneMedia(r);
const i = () => {
if (this.contact.transcript && "undefined" != typeof navigator && /msie/i.test(navigator.userAgent) && !/trident/i.test(navigator.userAgent) && document.charset && "utf-8" !== document.charset) {
let e = this.contact.transcript;
try {
for (let t = 0; t < e.length; t++) {
let n = e[t];
n.from_nick && (n.from_nick = this.channel.decode(n.from_nick)), n.body && (n.body = this.channel.decode(n.body)), n.desc && (n.desc = this.channel.decode(n.desc))
}
} catch (e) {
u.error("VivochaContact.setContactInfo", "transcript decode failed")
}
}
};
if (e.key)
if (96 != e.key.length) u.error("VivochaContact.setContactInfo", "invalid key length"), n(new Error("invalid_key_length"));
else try {
const {
key: n,
iv: r
} = h.splitKey(e.key);
if (this.iv = r, this.key = n, delete e.key, "client" === e.encryption && (this.secure = !0), e.data)
for (let t = 0; t < e.data.length; t++) {
let n = e.data[t];
for (let e = 0; n.data && e < n.data.length; e++) {
let t = n.data[e];
t.options && t.options.encrypted && (t.value = this.decrypt(t.value))
}
}
if (e.transcript) {
for (let t = 0; t < e.transcript.length; t++) this.decryptMessage(e.transcript[t]);
i()
}
t(this)
} catch (e) {
u.error("VivochaContact.setContactInfo", "invalid key", e), n(new Error("invalid_key"))
} else e.transcript && i(), t(this)
} else u.error("VivochaContact.setContactInfo", "no data"), n(new Error("no_data"));
else u.error("VivochaContact.setContactInfo", "no channel"), n(new Error("no_channel"))
});
return this.ready && (this.ready = this.ready.then(() => t)), t
}
data() {
return this.contact
}
encrypt(e) {
return h.encrypt(this.key, this.iv, e)
}
encryptObject(e, t) {
return h.encryptObject(this.key, this.iv, e, t)
}
encryptMessage(e) {
return h.encryptMessage(this.key, this.iv, e)
}
decrypt(e) {
return h.decrypt(this.key, this.iv, e)
}
decryptMessage(e) {
return h.decryptMessage(this.key, this.iv, e)
}
send(e, t) {
return e.id = this.id, e = this.setMessageProperties(e), !!this.channel && this.channel.send("vvcmsg", this.secure ? this.encryptMessage(o.cloneDeep(e)) : e, (...n) => {
let r = n[0],
i = n[1];
r ? u.error(r) : "message" === e.code && -1 !== ["text", "link", "mediachange", "attachment"].indexOf(e.type) && (e.ts = i.ts, n[1] = i._id, this.addToTranscript(e), u.log("VivochaContact.send _cb", i, n)), t && t.apply(this, n)
})
}
sendText(e, t, n) {
let r = {
code: "message",
type: "text",
body: this.channel.encode(e)
};
return t && (r.lang = this.channel.encode(t)), this.emit("localtext", e), this.send(r, (function(e, t) {
u.log("VivochaContact.sendText: callback", e, t), n && n(e, t)
}))
}
sendLink(e, t, n) {
let r = {
code: "message",
type: "link",
url: e
};
return t && (r.desc = this.channel.encode(t)), this.emit("localtext", e, t), this.send(r, (function(e, t) {
u.log("VivochaContact.sendLink: callback", e, t), n && n(e, t)
}))
}
sendAction(e, t, n) {
return this.send({
code: "message",
type: "action",
action_code: e,
args: t
}, (function(e, t) {
u.log("VivochaContact.sendAction: callback", e, t), n && n(e, t)
}))
}
sendIsWriting() {
return this.emit("localiswriting"), this.send({
code: "message",
type: "iswriting"
})
}
sendAck(e) {
return this.send({
code: "message",
type: "ack",
ref: e
})
}
sendRead(e) {
return this.send({
code: "message",
type: "read",
ref: e
})
}
sendEvent(e, t, n) {
"function" == typeof t && (n = t, t = null), u.info("sendEvent", e, t);
let r = {
code: "event",
type: e
};
return t && (r.data = t), this.send(r, n)
}
join(e, t) {
return this.channel && this.id && (this.assigned || t) ? (u.log("join", this.id, this), this.assigned = !0, this.send({
code: "join"
}, (t, n) => {
t ? e && e(t) : vivocha.nodeify(this.setContactInfo(n).then(() => this), e)
}), !0) : (u.error("VivochaContact.join: invalid state"), e && e(new Error("invalid_state")), !1)
}
leave(e, t, n) {
if ("function" == typeof e ? (n = e, t = void 0, e = void 0) : "function" == typeof t && (n = t, t = void 0), this.id && this.channel && this.assigned) {
if (this.channel.isConnected()) {
this.channel.unbind(this.id, this.messageHandler), this.channel.unbind("reconnect", this.reconnectHandler);
let r = {
code: "leave"
};
return e && (r.reason = e), "boolean" == typeof t && (r.endConversation = t), this.emit("localleft", e), this.send(r, n), this.getMedia().then(e => {
this.transitMedia(e)
}), !0
}
return u.error("VivochaContact.leave: not connected"), n && n(new Error("not_connected")), !1
}
return u.error("VivochaContact.leave: invalid state"), n && n(new Error("invalid_state")), !1
}
request(e, t, n, r, i) {
u.log("VivochaContact.request", e, t), "function" == typeof r && (i = r, r = 0), "function" == typeof n && (i = n, n = 0, r = 0);
let o = a.v4();
const s = () => {
u.debug("VivochaContact.request", o, e, t), this.sendAction("vvcreq", [o, e, t])
};
return s(), new Promise((e, t) => {
if (n) {
let i = null;
const a = () => {
this.cancelRequest(o), t("timeout")
},
c = () => {
this.requestTimers[o] = setTimeout(i, n)
};
if (r) {
let e = 0;
i = () => {
r < 0 || ++e < r && this.listeners(o).length ? (u.log("VivochaContact.request", o, "retrying", e, r), s(), c()) : a()
}
} else i = a;
c(), this.once(o, (n, r) => {
u.debug("VivochaContact.request", o, "got answer", n, r), clearTimeout(this.requestTimers[o]), delete this.requestTimers[o], n ? t(n) : e(r)
})
} else this.once(o, (n, r) => {
u.debug("VivochaContact.request", o, "got answer", n, r), n ? t(n) : e(r)
})
}).then(e => (i && i(null, e), e)).catch(e => {
i && i(e)
})
}
answer(e, t, n) {
var r = this;
vivocha.nodeify(new Promise((function(n, i) {
e ? (u.error("VivochaContact.answer", "offer failed", e), r.setMediaState("failed"), i(e)) : r.getMedia().then((function(e) {
var o = {};
for (var a in t) {
var s = t[a],
c = s.engine || "Native";
o[a] = {
tx: s.rx,
rx: s.tx,
via: s.via || "net",
engine: c
}
}
u.log("VivochaContact.answer", "answer", o), r.transitMedia(e, t, {
wasOffered: !0
}).then((function() {
n(o)
}), (function(e) {
u.error("VivochaContact.answer", "transitMedia failed", e), i(e)
}))
}))
})), n)
}
response(e, t, n) {
this.sendAction("vvcres", [e, t, n])
}
cancelRequest(e) {
this.removeAllListeners(e)
}
sendData(e, t, n, r) {
if (this.channel.isConnected()) return this.getDataChannel(e, r).then(e => (e.send(t, n), !0))
}
getDataChannel(e, t, n) {
return vivocha.getDataChannel(this, e, t, n)
}
getMediaEngine(e) {
return this.mediaEngines[e] ? Promise.resolve(this.mediaEngines[e]) : Promise.reject(new Error("no_engine"))
}
registerMediaEngine(e) {
return e.attach(this).then(t => (this.mediaEngines[e.id] = e, t))
}
getMediaStream(e, t) {
return vivocha.platform.getContactMediaStream(this, e, t)
}
switchToNextCamera() {
return vivocha.platform.switchToNextCamera(this)
}
getMedia() {
if (this.media) return this.media; {
let e = {},
t = c.dot(this, "contact.initial_offer.Sharing");
return t && (e.Sharing = t), this.transitMedia({}, e, {
wasOffered: !0
})
}
}
getMediaOffer() {
return this.getMedia().then(e => {
let t, n = {};
for (let r in e) t = e[r], n[r] = {
tx: t.tx ? "required" : "off",
rx: t.rx ? "required" : "off",
via: t.via || "net",
engine: t.engine || "Native"
};
return n
})
}
getMediaState() {
return this.mediaState
}
setMediaState(e) {
this.mediaState !== e && (this.mediaState = e, this.emit("MediaState", this.mediaState), "failed" === e && this.setMediaState("idle"))
}
offerMedia(e, t) {
u.log("VivochaContact.offerMedia", e);
var n = this;
return vivocha.nodeify(n.getMedia().then((function(t) {
if ("idle" !== n.mediaState) throw "bad_state";
for (let r in n.mediaEngines) e = n.mediaEngines[r].adjustOffer(e, t);
return n.getLocalCapabilities().then((function(r) {
var i = r.Media || {},
o = {};
for (var a in e) {
var s = e[a],
c = s.engine || "Native";
if (!("off" === s.tx && "off" === s.rx || i[a] && i[a].Engines && i[a].Engines[c])) throw u.error("VivochaContact.offerMedia", "request media is not supported by client", a, s), "unsupported";
o[a] = {
tx: s.tx,
rx: s.rx,
via: s.via || "net",
engine: c
}
}
return n.setMediaState("offering"), u.log("VivochaContact.offerMedia", "offer", o), new Promise((function(r, i) {
n.request("MediaOffer", o, 12e4, 1, (function(o, a) {
if (o) u.error("VivochaContact.offerMedia", "offer failed", o), i(o);
else {
for (var s in u.log("VivochaContact.offerMedia", "answer", a), a) {
var c = e[s],
h = a[s];
if (c) {
if (h.tx && "off" === c.tx || !h.tx && "required" === c.tx || h.rx && "off" === c.rx || !h.rx && "required" === c.rx) return u.warn("VivochaContact.offerMedia", "media rejected", c, h), void i("rejected");
h.via = c.via || "net", h.engine = c.engine || "Native"
} else delete a[s]
}
for (let e in n.mediaEngines) a = n.mediaEngines[e].adjustAnswer(a, t);
u.log("VivochaContact.offerMedia", "adjusted answer", a), n.transitMedia(t, a, {
wasOffered: !1
}).then(() => r(a), e => i(e))
}
}))
}))
}))
})).then((function(e) {
return e
}), (function(e) {
throw "init" !== n.mediaState && n.setMediaState("failed"), e
})), t)
}
cancelMediaOffer() {
throw new Error("unimplemented")
}
async restoreMedia(e) {
await this.getRemoteCapabilities();
const t = await this.request("MediaGet", null, 2e3, 5);
var n, r;
for (var i in u.debug("VivochaContact.restoreMedia", "remote", t), t) n = (r = t[i]).tx, r.tx = r.rx, r.rx = n, delete r.data;
u.debug("VivochaContact.restoreMedia", "local", t);
const o = this.mergeAndTransitMedia(t, {
wasOffered: !1,
restore: !0
});
return vivocha.nodeify(o, e)
}
transitMedia(e, t = {}, n = {}) {
u.log("VivochaContact.transitMedia", e, t, n);
let r = !1,
i = !0,
o = [],
a = {},
s = {};
return this.setMediaState("transiting"), new Promise((c, h) => {
this.media = new Promise(d => {
for (let t in e) s[t] = !0;
for (let e in t) delete s[e], a[t[e].engine || "Native"] = !0;
for (let t in s) a[e[t].engine || "Native"] = !0;
for (let s in a) {
var l;
if (this.mediaEngines[s])(l = n.restore ? this.mediaEngines[s].restore(e, t) : this.mediaEngines[s].transit(e, t, n.wasOffered)).deferred ? (i = !1, o.push(l.promise)) : l.changed && (r = !0);
else u.error("VivochaContact.transitMedia", "unable to transit with engine", s)
}
r && this.emit("MediaChange", e), i ? (u.log("VivochaContact.transitMedia", "completed"), this.setMediaState("idle"), d(e), c(e)) : Promise.all(o).then(() => {
u.log("VivochaContact.transitMedia", "completed"), this.setMediaState("idle"), d(e), c(e), this.emit("MediaChange", e)
}, t => {
u.log("VivochaContact.transitMedia", "failed", t), this.setMediaState("failed"), d(e), h(t), this.emit("MediaChange", e)
})
})
})
}
async mergeAndTransitMedia(e, t) {
const n = await this.getMedia(),
r = await this.mergeMedia(e);
return this.transitMedia(n, r, t)
}
cloneMedia(e, t) {
var n, r, i, o = {};
for (n in e)
if (r = e[n], (i = o[n] = {}).tx = !!r.tx, i.rx = !!r.rx, i.via = r.via || "net", i.engine = r.engine || "Native", t)
for (var a in i.data = {}, r.data)
if (r.data[a]) try {
i.data[a] = JSON.parse(JSON.stringify(r.data[a]))
} catch (e) {
i.data[a] = !0
}
return o
}
diffMedia(e, t) {
const n = {
added: {
media: {},
engine: {}
},
removed: {
media: {},
engine: {}
},
changed: {
media: {},
engine: {}
}
};
let r = !1;
const i = (e, t, i) => {
var o = n[e],
a = i.engine;
o.media[t] = a, r = !0
},
a = (e, t, i) => {
n[e].engine[t] = i, r = !0
};
let s, c, u, h, d = {},
l = {},
f = {};
for (s in e) d[s] = !0, c = e[s].engine, l[c] ? l[c].push(s) : l[c] = [s];
for (s in t) u = e[s], h = t[s], h.tx || h.rx ? (c = h.engine, f[c] ? f[c].push(s) : f[c] = [s], u ? o.isEqual(u, h) || i("changed", s, h) : i("added", s, h), delete d[s]) : delete t[s];
for (s in d) i("removed", s, e[s]);
for (s in f) u = l[s], h = f[s], u ? o.isEqual(u, h) || a("changed", s, h) : a("added", s, h), delete l[s];
for (s in l) a("removed", s, l[s]);
return r ? n : null
}
attach(e, t, n, r) {
let i = new FormData;
i.append("file", e);
let o = {
cid: this.id
};
return t && (o.desc = t), n && (o.ref = n), vivocha.nodeify(this.ws("contact", "attach", o, {
method: "post",
body: i
}), r)
}
ws(e, t, n, r) {
return vivocha.ws(e, t, n, r)
}
static splitKey(e) {
return {
key: r.enc.Hex.parse(e.substr(32)),
iv: r.enc.Hex.parse(e.substr(0, 32))
}
}
static encrypt(e, t, n) {
const i = r.lib.WordArray.random(8).toString();
return r.AES.encrypt(i + n, e, {
iv: t
}).toString()
}
static encryptByKey(e, t) {
const {
key: n,
iv: r
} = h.splitKey(e);
return h.encrypt(n, r, t)
}
static encryptObject(e, t, n, r) {
if (!n || !r || !r.length) return n;
for (let i, o, a = 0; a < r.length; a++) i = r[a], o = c.dot(n, i), o && ("string" != typeof o && (o = JSON.stringify(o), n.serialized ? n.serialized.push(i) : n.serialized = [i]), c.dot(n, i, h.encrypt(e, t, o)), n.encrypted ? n.encrypted.push(i) : n.encrypted = [i]);
return n
}
static encryptObjectByKey(e, t, n) {
const {
key: r,
iv: i
} = h.splitKey(e);
return h.encryptObject(r, i, t, n)
}
static encryptMessage(e, t, n) {
return h.encryptObject(e, t, n, {
text: ["body", "payload", "quick_replies", "template"],
postback: ["body", "payload"],
link: ["url"],
attachment: ["meta.originalUrl", "meta.originalName", "meta.mimetype", "meta.desc", "meta.key"]
} [n.type])
}
static encryptMessageByKey(e, t) {
const {
key: n,
iv: r
} = h.splitKey(e);
return h.encryptMessage(n, r, t)
}
static decrypt(e, t, n) {
var i = r.AES.decrypt(n, e, {
iv: t
}),
o = r.enc.Utf8.stringify(i);
return o.length > 16 ? o.substr(16) : ""
}
static decryptByKey(e, t) {
const {
key: n,
iv: r
} = h.splitKey(e);
return h.decrypt(n, r, t)
}
static decryptMessage(e, t, n) {
if (n && n.encrypted) {
for (let r, i = 0; i < n.encrypted.length; i++) r = c.dot(n, n.encrypted[i]), r && c.dot(n, n.encrypted[i], h.decrypt(e, t, r));
if (delete n.encrypted, n.serialized) {
for (let e, t = 0; t < n.serialized.length; t++) e = c.dot(n, n.serialized[t]), e && c.dot(n, n.serialized[t], JSON.parse(e));
delete n.serialized
}
}
return n
}
static decryptMessageByKey(e, t) {
const {
key: n,
iv: r
} = h.splitKey(e);
return h.decryptMessage(n, r, t)
}
}
t.VivochaContact = h
}, function(e, t, n) {
var r;
e.exports = (r = n(0), n(17), n(90), n(91), n(7), n(8), n(24), n(41), n(92), n(42), n(93), n(94), n(95), n(25), n(96), n(3), n(1), n(97), n(98), n(99), n(100), n(101), n(102), n(103), n(104), n(105), n(106), n(107), n(108), n(109), n(110), n(111), n(112), r)
}, function(e, t, n) {
var r;
e.exports = (r = n(0), function() {
if ("function" == typeof ArrayBuffer) {
var e = r.lib.WordArray,
t = e.init;
(e.init = function(e) {
if (e instanceof ArrayBuffer && (e = new Uint8Array(e)), (e instanceof Int8Array || "undefined" != typeof Uint8ClampedArray && e instanceof Uint8ClampedArray || e instanceof Int16Array || e instanceof Uint16Array || e instanceof Int32Array || e instanceof Uint32Array || e instanceof Float32Array || e instanceof Float64Array) && (e = new Uint8Array(e.buffer, e.byteOffset, e.byteLength)), e instanceof Uint8Array) {
for (var n = e.byteLength, r = [], i = 0; i < n; i++) r[i >>> 2] |= e[i] << 24 - i % 4 * 8;
t.call(this, r, n)
} else t.apply(this, arguments)
}).prototype = e
}
}(), r.lib.WordArray)
}, function(e, t, n) {
var r;
e.exports = (r = n(0), function() {
var e = r,
t = e.lib.WordArray,
n = e.enc;

function i(e) {
return e << 8 & 4278255360 | e >>> 8 & 16711935
}
n.Utf16 = n.Utf16BE = {
stringify: function(e) {
for (var t = e.words, n = e.sigBytes, r = [], i = 0; i < n; i += 2) {
var o = t[i >>> 2] >>> 16 - i % 4 * 8 & 65535;
r.push(String.fromCharCode(o))
}
return r.join("")
},
parse: function(e) {
for (var n = e.length, r = [], i = 0; i < n; i++) r[i >>> 1] |= e.charCodeAt(i) << 16 - i % 2 * 16;
return t.create(r, 2 * n)
}
}, n.Utf16LE = {
stringify: function(e) {
for (var t = e.words, n = e.sigBytes, r = [], o = 0; o < n; o += 2) {
var a = i(t[o >>> 2] >>> 16 - o % 4 * 8 & 65535);
r.push(String.fromCharCode(a))
}
return r.join("")
},
parse: function(e) {
for (var n = e.length, r = [], o = 0; o < n; o++) r[o >>> 1] |= i(e.charCodeAt(o) << 16 - o % 2 * 16);
return t.create(r, 2 * n)
}
}
}(), r.enc.Utf16)
}, function(e, t, n) {
var r, i, o, a, s, c;
e.exports = (c = n(0), n(41), i = (r = c).lib.WordArray, o = r.algo, a = o.SHA256, s = o.SHA224 = a.extend({
_doReset: function() {
this._hash = new i.init([3238371032, 914150663, 812702999, 4144912697, 4290775857, 1750603025, 1694076839, 3204075428])
},
_doFinalize: function() {
var e = a._doFinalize.call(this);
return e.sigBytes -= 4, e
}
}), r.SHA224 = a._createHelper(s), r.HmacSHA224 = a._createHmacHelper(s), c.SHA224)
}, function(e, t, n) {
var r, i, o, a, s, c, u, h;
e.exports = (h = n(0), n(17), n(42), i = (r = h).x64, o = i.Word, a = i.WordArray, s = r.algo, c = s.SHA512, u = s.SHA384 = c.extend({
_doReset: function() {
this._hash = new a.init([new o.init(3418070365, 3238371032), new o.init(1654270250, 914150663), new o.init(2438529370, 812702999), new o.init(355462360, 4144912697), new o.init(1731405415, 4290775857), new o.init(2394180231, 1750603025), new o.init(3675008525, 1694076839), new o.init(1203062813, 3204075428)])
},
_doFinalize: function() {
var e = c._doFinalize.call(this);
return e.sigBytes -= 16, e
}
}), r.SHA384 = c._createHelper(u), r.HmacSHA384 = c._createHmacHelper(u), h.SHA384)
}, function(e, t, n) {
var r;
e.exports = (r = n(0), n(17), function(e) {
var t = r,
n = t.lib,
i = n.WordArray,
o = n.Hasher,
a = t.x64.Word,
s = t.algo,
c = [],
u = [],
h = [];
! function() {
for (var e = 1, t = 0, n = 0; n < 24; n++) {
c[e + 5 * t] = (n + 1) * (n + 2) / 2 % 64;
var r = (2 * e + 3 * t) % 5;
e = t % 5, t = r
}
for (e = 0; e < 5; e++)
for (t = 0; t < 5; t++) u[e + 5 * t] = t + (2 * e + 3 * t) % 5 * 5;
for (var i = 1, o = 0; o < 24; o++) {
for (var s = 0, d = 0, l = 0; l < 7; l++) {
if (1 & i) {
var f = (1 << l) - 1;
f < 32 ? d ^= 1 << f : s ^= 1 << f - 32
}
128 & i ? i = i << 1 ^ 113 : i <<= 1
}
h[o] = a.create(s, d)
}
}();
var d = [];
! function() {
for (var e = 0; e < 25; e++) d[e] = a.create()
}();
var l = s.SHA3 = o.extend({
cfg: o.cfg.extend({
outputLength: 512
}),
_doReset: function() {
for (var e = this._state = [], t = 0; t < 25; t++) e[t] = new a.init;
this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32
},
_doProcessBlock: function(e, t) {
for (var n = this._state, r = this.blockSize / 2, i = 0; i < r; i++) {
var o = e[t + 2 * i],
a = e[t + 2 * i + 1];
o = 16711935 & (o << 8 | o >>> 24) | 4278255360 & (o << 24 | o >>> 8), a = 16711935 & (a << 8 | a >>> 24) | 4278255360 & (a << 24 | a >>> 8), (k = n[i]).high ^= a, k.low ^= o
}
for (var s = 0; s < 24; s++) {
for (var l = 0; l < 5; l++) {
for (var f = 0, p = 0, g = 0; g < 5; g++) f ^= (k = n[l + 5 * g]).high, p ^= k.low;
var v = d[l];
v.high = f, v.low = p
}
for (l = 0; l < 5; l++) {
var m = d[(l + 4) % 5],
y = d[(l + 1) % 5],
C = y.high,
w = y.low;
for (f = m.high ^ (C << 1 | w >>> 31), p = m.low ^ (w << 1 | C >>> 31), g = 0; g < 5; g++)(k = n[l + 5 * g]).high ^= f, k.low ^= p
}
for (var _ = 1; _ < 25; _++) {
var b = (k = n[_]).high,
E = k.low,
T = c[_];
T < 32 ? (f = b << T | E >>> 32 - T, p = E << T | b >>> 32 - T) : (f = E << T - 32 | b >>> 64 - T, p = b << T - 32 | E >>> 64 - T);
var S = d[u[_]];
S.high = f, S.low = p
}
var R = d[0],
x = n[0];
for (R.high = x.high, R.low = x.low, l = 0; l < 5; l++)
for (g = 0; g < 5; g++) {
var k = n[_ = l + 5 * g],
P = d[_],
A = d[(l + 1) % 5 + 5 * g],
I = d[(l + 2) % 5 + 5 * g];
k.high = P.high ^ ~A.high & I.high, k.low = P.low ^ ~A.low & I.low
}
k = n[0];
var O = h[s];
k.high ^= O.high, k.low ^= O.low
}
},
_doFinalize: function() {
var t = this._data,
n = t.words,
r = (this._nDataBytes, 8 * t.sigBytes),
o = 32 * this.blockSize;
n[r >>> 5] |= 1 << 24 - r % 32, n[(e.ceil((r + 1) / o) * o >>> 5) - 1] |= 128, t.sigBytes = 4 * n.length, this._process();
for (var a = this._state, s = this.cfg.outputLength / 8, c = s / 8, u = [], h = 0; h < c; h++) {
var d = a[h],
l = d.high,
f = d.low;
l = 16711935 & (l << 8 | l >>> 24) | 4278255360 & (l << 24 | l >>> 8), f = 16711935 & (f << 8 | f >>> 24) | 4278255360 & (f << 24 | f >>> 8), u.push(f), u.push(l)
}
return new i.init(u, s)
},
clone: function() {
for (var e = o.clone.call(this), t = e._state = this._state.slice(0), n = 0; n < 25; n++) t[n] = t[n].clone();
return e
}
});
t.SHA3 = o._createHelper(l), t.HmacSHA3 = o._createHmacHelper(l)
}(Math), r.SHA3)
}, function(e, t, n) {
var r;
e.exports = (r = n(0), function(e) {
var t = r,
n = t.lib,
i = n.WordArray,
o = n.Hasher,
a = t.algo,
s = i.create([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]),
c = i.create([5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]),
u = i.create([11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6]),
h = i.create([8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11]),
d = i.create([0, 1518500249, 1859775393, 2400959708, 2840853838]),
l = i.create([1352829926, 1548603684, 1836072691, 2053994217, 0]),
f = a.RIPEMD160 = o.extend({
_doReset: function() {
this._hash = i.create([1732584193, 4023233417, 2562383102, 271733878, 3285377520])
},
_doProcessBlock: function(e, t) {
for (var n = 0; n < 16; n++) {
var r = t + n,
i = e[r];
e[r] = 16711935 & (i << 8 | i >>> 24) | 4278255360 & (i << 24 | i >>> 8)
}
var o, a, f, w, _, b, E, T, S, R, x, k = this._hash.words,
P = d.words,
A = l.words,
I = s.words,
O = c.words,
M = u.words,
D = h.words;
for (b = o = k[0], E = a = k[1], T = f = k[2], S = w = k[3], R = _ = k[4], n = 0; n < 80; n += 1) x = o + e[t + I[n]] | 0, x += n < 16 ? p(a, f, w) + P[0] : n < 32 ? g(a, f, w) + P[1] : n < 48 ? v(a, f, w) + P[2] : n < 64 ? m(a, f, w) + P[3] : y(a, f, w) + P[4], x = (x = C(x |= 0, M[n])) + _ | 0, o = _, _ = w, w = C(f, 10), f = a, a = x, x = b + e[t + O[n]] | 0, x += n < 16 ? y(E, T, S) + A[0] : n < 32 ? m(E, T, S) + A[1] : n < 48 ? v(E, T, S) + A[2] : n < 64 ? g(E, T, S) + A[3] : p(E, T, S) + A[4], x = (x = C(x |= 0, D[n])) + R | 0, b = R, R = S, S = C(T, 10), T = E, E = x;
x = k[1] + f + S | 0, k[1] = k[2] + w + R | 0, k[2] = k[3] + _ + b | 0, k[3] = k[4] + o + E | 0, k[4] = k[0] + a + T | 0, k[0] = x
},
_doFinalize: function() {
var e = this._data,
t = e.words,
n = 8 * this._nDataBytes,
r = 8 * e.sigBytes;
t[r >>> 5] |= 128 << 24 - r % 32, t[14 + (r + 64 >>> 9 << 4)] = 16711935 & (n << 8 | n >>> 24) | 4278255360 & (n << 24 | n >>> 8), e.sigBytes = 4 * (t.length + 1), this._process();
for (var i = this._hash, o = i.words, a = 0; a < 5; a++) {
var s = o[a];
o[a] = 16711935 & (s << 8 | s >>> 24) | 4278255360 & (s << 24 | s >>> 8)
}
return i
},
clone: function() {
var e = o.clone.call(this);
return e._hash = this._hash.clone(), e
}
});

function p(e, t, n) {
return e ^ t ^ n
}

function g(e, t, n) {
return e & t | ~e & n
}

function v(e, t, n) {
return (e | ~t) ^ n
}

function m(e, t, n) {
return e & n | t & ~n
}

function y(e, t, n) {
return e ^ (t | ~n)
}

function C(e, t) {
return e << t | e >>> 32 - t
}
t.RIPEMD160 = o._createHelper(f), t.HmacRIPEMD160 = o._createHmacHelper(f)
}(Math), r.RIPEMD160)
}, function(e, t, n) {
var r, i, o, a, s, c, u, h, d;
e.exports = (d = n(0), n(24), n(25), i = (r = d).lib, o = i.Base, a = i.WordArray, s = r.algo, c = s.SHA1, u = s.HMAC, h = s.PBKDF2 = o.extend({
cfg: o.extend({
keySize: 4,
hasher: c,
iterations: 1
}),
init: function(e) {
this.cfg = this.cfg.extend(e)
},
compute: function(e, t) {
for (var n = this.cfg, r = u.create(n.hasher, e), i = a.create(), o = a.create([1]), s = i.words, c = o.words, h = n.keySize, d = n.iterations; s.length < h;) {
var l = r.update(t).finalize(o);
r.reset();
for (var f = l.words, p = f.length, g = l, v = 1; v < d; v++) {
g = r.finalize(g), r.reset();
for (var m = g.words, y = 0; y < p; y++) f[y] ^= m[y]
}
i.concat(l), c[0]++
}
return i.sigBytes = 4 * h, i
}
}), r.PBKDF2 = function(e, t, n) {
return h.create(n).compute(e, t)
}, d.PBKDF2)
}, function(e, t, n) {
var r;
e.exports = (r = n(0), n(1), r.mode.CFB = function() {
var e = r.lib.BlockCipherMode.extend();

function t(e, t, n, r) {
var i = this._iv;
if (i) {
var o = i.slice(0);
this._iv = void 0
} else o = this._prevBlock;
r.encryptBlock(o, 0);
for (var a = 0; a < n; a++) e[t + a] ^= o[a]
}
return e.Encryptor = e.extend({
processBlock: function(e, n) {
var r = this._cipher,
i = r.blockSize;
t.call(this, e, n, i, r), this._prevBlock = e.slice(n, n + i)
}
}), e.Decryptor = e.extend({
processBlock: function(e, n) {
var r = this._cipher,
i = r.blockSize,
o = e.slice(n, n + i);
t.call(this, e, n, i, r), this._prevBlock = o
}
}), e
}(), r.mode.CFB)
}, function(e, t, n) {
var r, i, o;
e.exports = (o = n(0), n(1), o.mode.CTR = (r = o.lib.BlockCipherMode.extend(), i = r.Encryptor = r.extend({
processBlock: function(e, t) {
var n = this._cipher,
r = n.blockSize,
i = this._iv,
o = this._counter;
i && (o = this._counter = i.slice(0), this._iv = void 0);
var a = o.slice(0);
n.encryptBlock(a, 0), o[r - 1] = o[r - 1] + 1 | 0;
for (var s = 0; s < r; s++) e[t + s] ^= a[s]
}
}), r.Decryptor = i, r), o.mode.CTR)
}, function(e, t, n) {
var r;
e.exports = (r = n(0), n(1), r.mode.CTRGladman = function() {
var e = r.lib.BlockCipherMode.extend();

function t(e) {
if (255 == (e >> 24 & 255)) {
var t = e >> 16 & 255,
n = e >> 8 & 255,
r = 255 & e;
255 === t ? (t = 0, 255 === n ? (n = 0, 255 === r ? r = 0 : ++r) : ++n) : ++t, e = 0, e += t << 16, e += n << 8, e += r
} else e += 1 << 24;
return e
}
var n = e.Encryptor = e.extend({
processBlock: function(e, n) {
var r = this._cipher,
i = r.blockSize,
o = this._iv,
a = this._counter;
o && (a = this._counter = o.slice(0), this._iv = void 0),
function(e) {
0 === (e[0] = t(e[0])) && (e[1] = t(e[1]))
}(a);
var s = a.slice(0);
r.encryptBlock(s, 0);
for (var c = 0; c < i; c++) e[n + c] ^= s[c]
}
});
return e.Decryptor = n, e
}(), r.mode.CTRGladman)
}, function(e, t, n) {
var r, i, o;
e.exports = (o = n(0), n(1), o.mode.OFB = (r = o.lib.BlockCipherMode.extend(), i = r.Encryptor = r.extend({
processBlock: function(e, t) {
var n = this._cipher,
r = n.blockSize,
i = this._iv,
o = this._keystream;
i && (o = this._keystream = i.slice(0), this._iv = void 0), n.encryptBlock(o, 0);
for (var a = 0; a < r; a++) e[t + a] ^= o[a]
}
}), r.Decryptor = i, r), o.mode.OFB)
}, function(e, t, n) {
var r, i;
e.exports = (i = n(0), n(1), i.mode.ECB = ((r = i.lib.BlockCipherMode.extend()).Encryptor = r.extend({
processBlock: function(e, t) {
this._cipher.encryptBlock(e, t)
}
}), r.Decryptor = r.extend({
processBlock: function(e, t) {
this._cipher.decryptBlock(e, t)
}
}), r), i.mode.ECB)
}, function(e, t, n) {
var r;
e.exports = (r = n(0), n(1), r.pad.AnsiX923 = {
pad: function(e, t) {
var n = e.sigBytes,
r = 4 * t,
i = r - n % r,
o = n + i - 1;
e.clamp(), e.words[o >>> 2] |= i << 24 - o % 4 * 8, e.sigBytes += i
},
unpad: function(e) {
var t = 255 & e.words[e.sigBytes - 1 >>> 2];
e.sigBytes -= t
}
}, r.pad.Ansix923)
}, function(e, t, n) {
var r;
e.exports = (r = n(0), n(1), r.pad.Iso10126 = {
pad: function(e, t) {
var n = 4 * t,
i = n - e.sigBytes % n;
e.concat(r.lib.WordArray.random(i - 1)).concat(r.lib.WordArray.create([i << 24], 1))
},
unpad: function(e) {
var t = 255 & e.words[e.sigBytes - 1 >>> 2];
e.sigBytes -= t
}
}, r.pad.Iso10126)
}, function(e, t, n) {
var r;
e.exports = (r = n(0), n(1), r.pad.Iso97971 = {
pad: function(e, t) {
e.concat(r.lib.WordArray.create([2147483648], 1)), r.pad.ZeroPadding.pad(e, t)
},
unpad: function(e) {
r.pad.ZeroPadding.unpad(e), e.sigBytes--
}
}, r.pad.Iso97971)
}, function(e, t, n) {
var r;
e.exports = (r = n(0), n(1), r.pad.ZeroPadding = {
pad: function(e, t) {
var n = 4 * t;
e.clamp(), e.sigBytes += n - (e.sigBytes % n || n)
},
unpad: function(e) {
for (var t = e.words, n = e.sigBytes - 1; !(t[n >>> 2] >>> 24 - n % 4 * 8 & 255);) n--;
e.sigBytes = n + 1
}
}, r.pad.ZeroPadding)
}, function(e, t, n) {
var r;
e.exports = (r = n(0), n(1), r.pad.NoPadding = {
pad: function() {},
unpad: function() {}
}, r.pad.NoPadding)
}, function(e, t, n) {
var r, i, o, a;
e.exports = (a = n(0), n(1), i = (r = a).lib.CipherParams, o = r.enc.Hex, r.format.Hex = {
stringify: function(e) {
return e.ciphertext.toString(o)
},
parse: function(e) {
var t = o.parse(e);
return i.create({
ciphertext: t
})
}
}, a.format.Hex)
}, function(e, t, n) {
var r;
e.exports = (r = n(0), n(7), n(8), n(3), n(1), function() {
var e = r,
t = e.lib.BlockCipher,
n = e.algo,
i = [],
o = [],
a = [],
s = [],
c = [],
u = [],
h = [],
d = [],
l = [],
f = [];
! function() {
for (var e = [], t = 0; t < 256; t++) e[t] = t < 128 ? t << 1 : t << 1 ^ 283;
var n = 0,
r = 0;
for (t = 0; t < 256; t++) {
var p = r ^ r << 1 ^ r << 2 ^ r << 3 ^ r << 4;
p = p >>> 8 ^ 255 & p ^ 99, i[n] = p, o[p] = n;
var g = e[n],
v = e[g],
m = e[v],
y = 257 * e[p] ^ 16843008 * p;
a[n] = y << 24 | y >>> 8, s[n] = y << 16 | y >>> 16, c[n] = y << 8 | y >>> 24, u[n] = y, y = 16843009 * m ^ 65537 * v ^ 257 * g ^ 16843008 * n, h[p] = y << 24 | y >>> 8, d[p] = y << 16 | y >>> 16, l[p] = y << 8 | y >>> 24, f[p] = y, n ? (n = g ^ e[e[e[m ^ g]]], r ^= e[e[r]]) : n = r = 1
}
}();
var p = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54],
g = n.AES = t.extend({
_doReset: function() {
if (!this._nRounds || this._keyPriorReset !== this._key) {
for (var e = this._keyPriorReset = this._key, t = e.words, n = e.sigBytes / 4, r = 4 * ((this._nRounds = n + 6) + 1), o = this._keySchedule = [], a = 0; a < r; a++)
if (a < n) o[a] = t[a];
else {
var s = o[a - 1];
a % n ? n > 6 && a % n == 4 && (s = i[s >>> 24] << 24 | i[s >>> 16 & 255] << 16 | i[s >>> 8 & 255] << 8 | i[255 & s]) : (s = i[(s = s << 8 | s >>> 24) >>> 24] << 24 | i[s >>> 16 & 255] << 16 | i[s >>> 8 & 255] << 8 | i[255 & s], s ^= p[a / n | 0] << 24), o[a] = o[a - n] ^ s
} for (var c = this._invKeySchedule = [], u = 0; u < r; u++) a = r - u, s = u % 4 ? o[a] : o[a - 4], c[u] = u < 4 || a <= 4 ? s : h[i[s >>> 24]] ^ d[i[s >>> 16 & 255]] ^ l[i[s >>> 8 & 255]] ^ f[i[255 & s]]
}
},
encryptBlock: function(e, t) {
this._doCryptBlock(e, t, this._keySchedule, a, s, c, u, i)
},
decryptBlock: function(e, t) {
var n = e[t + 1];
e[t + 1] = e[t + 3], e[t + 3] = n, this._doCryptBlock(e, t, this._invKeySchedule, h, d, l, f, o), n = e[t + 1], e[t + 1] = e[t + 3], e[t + 3] = n
},
_doCryptBlock: function(e, t, n, r, i, o, a, s) {
for (var c = this._nRounds, u = e[t] ^ n[0], h = e[t + 1] ^ n[1], d = e[t + 2] ^ n[2], l = e[t + 3] ^ n[3], f = 4, p = 1; p < c; p++) {
var g = r[u >>> 24] ^ i[h >>> 16 & 255] ^ o[d >>> 8 & 255] ^ a[255 & l] ^ n[f++],
v = r[h >>> 24] ^ i[d >>> 16 & 255] ^ o[l >>> 8 & 255] ^ a[255 & u] ^ n[f++],
m = r[d >>> 24] ^ i[l >>> 16 & 255] ^ o[u >>> 8 & 255] ^ a[255 & h] ^ n[f++],
y = r[l >>> 24] ^ i[u >>> 16 & 255] ^ o[h >>> 8 & 255] ^ a[255 & d] ^ n[f++];
u = g, h = v, d = m, l = y
}
g = (s[u >>> 24] << 24 | s[h >>> 16 & 255] << 16 | s[d >>> 8 & 255] << 8 | s[255 & l]) ^ n[f++], v = (s[h >>> 24] << 24 | s[d >>> 16 & 255] << 16 | s[l >>> 8 & 255] << 8 | s[255 & u]) ^ n[f++], m = (s[d >>> 24] << 24 | s[l >>> 16 & 255] << 16 | s[u >>> 8 & 255] << 8 | s[255 & h]) ^ n[f++], y = (s[l >>> 24] << 24 | s[u >>> 16 & 255] << 16 | s[h >>> 8 & 255] << 8 | s[255 & d]) ^ n[f++], e[t] = g, e[t + 1] = v, e[t + 2] = m, e[t + 3] = y
},
keySize: 8
});
e.AES = t._createHelper(g)
}(), r.AES)
}, function(e, t, n) {
var r;
e.exports = (r = n(0), n(7), n(8), n(3), n(1), function() {
var e = r,
t = e.lib,
n = t.WordArray,
i = t.BlockCipher,
o = e.algo,
a = [57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4],
s = [14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32],
c = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28],
u = [{
0: 8421888,
268435456: 32768,
536870912: 8421378,
805306368: 2,
1073741824: 512,
1342177280: 8421890,
1610612736: 8389122,
1879048192: 8388608,
2147483648: 514,
2415919104: 8389120,
2684354560: 33280,
2952790016: 8421376,
3221225472: 32770,
3489660928: 8388610,
3758096384: 0,
4026531840: 33282,
134217728: 0,
402653184: 8421890,
671088640: 33282,
939524096: 32768,
1207959552: 8421888,
1476395008: 512,
1744830464: 8421378,
2013265920: 2,
2281701376: 8389120,
2550136832: 33280,
2818572288: 8421376,
3087007744: 8389122,
3355443200: 8388610,
3623878656: 32770,
3892314112: 514,
4160749568: 8388608,
1: 32768,
268435457: 2,
536870913: 8421888,
805306369: 8388608,
1073741825: 8421378,
1342177281: 33280,
1610612737: 512,
1879048193: 8389122,
2147483649: 8421890,
2415919105: 8421376,
2684354561: 8388610,
2952790017: 33282,
3221225473: 514,
3489660929: 8389120,
3758096385: 32770,
4026531841: 0,
134217729: 8421890,
402653185: 8421376,
671088641: 8388608,
939524097: 512,
1207959553: 32768,
1476395009: 8388610,
1744830465: 2,
2013265921: 33282,
2281701377: 32770,
2550136833: 8389122,
2818572289: 514,
3087007745: 8421888,
3355443201: 8389120,
3623878657: 0,
3892314113: 33280,
4160749569: 8421378
}, {
0: 1074282512,
16777216: 16384,
33554432: 524288,
50331648: 1074266128,
67108864: 1073741840,
83886080: 1074282496,
100663296: 1073758208,
117440512: 16,
134217728: 540672,
150994944: 1073758224,
167772160: 1073741824,
184549376: 540688,
201326592: 524304,
218103808: 0,
234881024: 16400,
251658240: 1074266112,
8388608: 1073758208,
25165824: 540688,
41943040: 16,
58720256: 1073758224,
75497472: 1074282512,
92274688: 1073741824,
109051904: 524288,
125829120: 1074266128,
142606336: 524304,
159383552: 0,
176160768: 16384,
192937984: 1074266112,
209715200: 1073741840,
226492416: 540672,
243269632: 1074282496,
260046848: 16400,
268435456: 0,
285212672: 1074266128,
301989888: 1073758224,
318767104: 1074282496,
335544320: 1074266112,
352321536: 16,
369098752: 540688,
385875968: 16384,
402653184: 16400,
419430400: 524288,
436207616: 524304,
452984832: 1073741840,
469762048: 540672,
486539264: 1073758208,
503316480: 1073741824,
520093696: 1074282512,
276824064: 540688,
293601280: 524288,
310378496: 1074266112,
327155712: 16384,
343932928: 1073758208,
360710144: 1074282512,
377487360: 16,
394264576: 1073741824,
411041792: 1074282496,
427819008: 1073741840,
444596224: 1073758224,
461373440: 524304,
478150656: 0,
494927872: 16400,
511705088: 1074266128,
528482304: 540672
}, {
0: 260,
1048576: 0,
2097152: 67109120,
3145728: 65796,
4194304: 65540,
5242880: 67108868,
6291456: 67174660,
7340032: 67174400,
8388608: 67108864,
9437184: 67174656,
10485760: 65792,
11534336: 67174404,
12582912: 67109124,
13631488: 65536,
14680064: 4,
15728640: 256,
524288: 67174656,
1572864: 67174404,
2621440: 0,
3670016: 67109120,
4718592: 67108868,
5767168: 65536,
6815744: 65540,
7864320: 260,
8912896: 4,
9961472: 256,
11010048: 67174400,
12058624: 65796,
13107200: 65792,
14155776: 67109124,
15204352: 67174660,
16252928: 67108864,
16777216: 67174656,
17825792: 65540,
18874368: 65536,
19922944: 67109120,
20971520: 256,
22020096: 67174660,
23068672: 67108868,
24117248: 0,
25165824: 67109124,
26214400: 67108864,
27262976: 4,
28311552: 65792,
29360128: 67174400,
30408704: 260,
31457280: 65796,
32505856: 67174404,
17301504: 67108864,
18350080: 260,
19398656: 67174656,
20447232: 0,
21495808: 65540,
22544384: 67109120,
23592960: 256,
24641536: 67174404,
25690112: 65536,
26738688: 67174660,
27787264: 65796,
28835840: 67108868,
29884416: 67109124,
30932992: 67174400,
31981568: 4,
33030144: 65792
}, {
0: 2151682048,
65536: 2147487808,
131072: 4198464,
196608: 2151677952,
262144: 0,
327680: 4198400,
393216: 2147483712,
458752: 4194368,
524288: 2147483648,
589824: 4194304,
655360: 64,
720896: 2147487744,
786432: 2151678016,
851968: 4160,
917504: 4096,
983040: 2151682112,
32768: 2147487808,
98304: 64,
163840: 2151678016,
229376: 2147487744,
294912: 4198400,
360448: 2151682112,
425984: 0,
491520: 2151677952,
557056: 4096,
622592: 2151682048,
688128: 4194304,
753664: 4160,
819200: 2147483648,
884736: 4194368,
950272: 4198464,
1015808: 2147483712,
1048576: 4194368,
1114112: 4198400,
1179648: 2147483712,
1245184: 0,
1310720: 4160,
1376256: 2151678016,
1441792: 2151682048,
1507328: 2147487808,
1572864: 2151682112,
1638400: 2147483648,
1703936: 2151677952,
1769472: 4198464,
1835008: 2147487744,
1900544: 4194304,
1966080: 64,
2031616: 4096,
1081344: 2151677952,
1146880: 2151682112,
1212416: 0,
1277952: 4198400,
1343488: 4194368,
1409024: 2147483648,
1474560: 2147487808,
1540096: 64,
1605632: 2147483712,
1671168: 4096,
1736704: 2147487744,
1802240: 2151678016,
1867776: 4160,
1933312: 2151682048,
1998848: 4194304,
2064384: 4198464
}, {
0: 128,
4096: 17039360,
8192: 262144,
12288: 536870912,
16384: 537133184,
20480: 16777344,
24576: 553648256,
28672: 262272,
32768: 16777216,
36864: 537133056,
40960: 536871040,
45056: 553910400,
49152: 553910272,
53248: 0,
57344: 17039488,
61440: 553648128,
2048: 17039488,
6144: 553648256,
10240: 128,
14336: 17039360,
18432: 262144,
22528: 537133184,
26624: 553910272,
30720: 536870912,
34816: 537133056,
38912: 0,
43008: 553910400,
47104: 16777344,
51200: 536871040,
55296: 553648128,
59392: 16777216,
63488: 262272,
65536: 262144,
69632: 128,
73728: 536870912,
77824: 553648256,
81920: 16777344,
86016: 553910272,
90112: 537133184,
94208: 16777216,
98304: 553910400,
102400: 553648128,
106496: 17039360,
110592: 537133056,
114688: 262272,
118784: 536871040,
122880: 0,
126976: 17039488,
67584: 553648256,
71680: 16777216,
75776: 17039360,
79872: 537133184,
83968: 536870912,
88064: 17039488,
92160: 128,
96256: 553910272,
100352: 262272,
104448: 553910400,
108544: 0,
112640: 553648128,
116736: 16777344,
120832: 262144,
124928: 537133056,
129024: 536871040
}, {
0: 268435464,
256: 8192,
512: 270532608,
768: 270540808,
1024: 268443648,
1280: 2097152,
1536: 2097160,
1792: 268435456,
2048: 0,
2304: 268443656,
2560: 2105344,
2816: 8,
3072: 270532616,
3328: 2105352,
3584: 8200,
3840: 270540800,
128: 270532608,
384: 270540808,
640: 8,
896: 2097152,
1152: 2105352,
1408: 268435464,
1664: 268443648,
1920: 8200,
2176: 2097160,
2432: 8192,
2688: 268443656,
2944: 270532616,
3200: 0,
3456: 270540800,
3712: 2105344,
3968: 268435456,
4096: 268443648,
4352: 270532616,
4608: 270540808,
4864: 8200,
5120: 2097152,
5376: 268435456,
5632: 268435464,
5888: 2105344,
6144: 2105352,
6400: 0,
6656: 8,
6912: 270532608,
7168: 8192,
7424: 268443656,
7680: 270540800,
7936: 2097160,
4224: 8,
4480: 2105344,
4736: 2097152,
4992: 268435464,
5248: 268443648,
5504: 8200,
5760: 270540808,
6016: 270532608,
6272: 270540800,
6528: 270532616,
6784: 8192,
7040: 2105352,
7296: 2097160,
7552: 0,
7808: 268435456,
8064: 268443656
}, {
0: 1048576,
16: 33555457,
32: 1024,
48: 1049601,
64: 34604033,
80: 0,
96: 1,
112: 34603009,
128: 33555456,
144: 1048577,
160: 33554433,
176: 34604032,
192: 34603008,
208: 1025,
224: 1049600,
240: 33554432,
8: 34603009,
24: 0,
40: 33555457,
56: 34604032,
72: 1048576,
88: 33554433,
104: 33554432,
120: 1025,
136: 1049601,
152: 33555456,
168: 34603008,
184: 1048577,
200: 1024,
216: 34604033,
232: 1,
248: 1049600,
256: 33554432,
272: 1048576,
288: 33555457,
304: 34603009,
320: 1048577,
336: 33555456,
352: 34604032,
368: 1049601,
384: 1025,
400: 34604033,
416: 1049600,
432: 1,
448: 0,
464: 34603008,
480: 33554433,
496: 1024,
264: 1049600,
280: 33555457,
296: 34603009,
312: 1,
328: 33554432,
344: 1048576,
360: 1025,
376: 34604032,
392: 33554433,
408: 34603008,
424: 0,
440: 34604033,
456: 1049601,
472: 1024,
488: 33555456,
504: 1048577
}, {
0: 134219808,
1: 131072,
2: 134217728,
3: 32,
4: 131104,
5: 134350880,
6: 134350848,
7: 2048,
8: 134348800,
9: 134219776,
10: 133120,
11: 134348832,
12: 2080,
13: 0,
14: 134217760,
15: 133152,
2147483648: 2048,
2147483649: 134350880,
2147483650: 134219808,
2147483651: 134217728,
2147483652: 134348800,
2147483653: 133120,
2147483654: 133152,
2147483655: 32,
2147483656: 134217760,
2147483657: 2080,
2147483658: 131104,
2147483659: 134350848,
2147483660: 0,
2147483661: 134348832,
2147483662: 134219776,
2147483663: 131072,
16: 133152,
17: 134350848,
18: 32,
19: 2048,
20: 134219776,
21: 134217760,
22: 134348832,
23: 131072,
24: 0,
25: 131104,
26: 134348800,
27: 134219808,
28: 134350880,
29: 133120,
30: 2080,
31: 134217728,
2147483664: 131072,
2147483665: 2048,
2147483666: 134348832,
2147483667: 133152,
2147483668: 32,
2147483669: 134348800,
2147483670: 134217728,
2147483671: 134219808,
2147483672: 134350880,
2147483673: 134217760,
2147483674: 134219776,
2147483675: 0,
2147483676: 133120,
2147483677: 2080,
2147483678: 131104,
2147483679: 134350848
}],
h = [4160749569, 528482304, 33030144, 2064384, 129024, 8064, 504, 2147483679],
d = o.DES = i.extend({
_doReset: function() {
for (var e = this._key.words, t = [], n = 0; n < 56; n++) {
var r = a[n] - 1;
t[n] = e[r >>> 5] >>> 31 - r % 32 & 1
}
for (var i = this._subKeys = [], o = 0; o < 16; o++) {
var u = i[o] = [],
h = c[o];
for (n = 0; n < 24; n++) u[n / 6 | 0] |= t[(s[n] - 1 + h) % 28] << 31 - n % 6, u[4 + (n / 6 | 0)] |= t[28 + (s[n + 24] - 1 + h) % 28] << 31 - n % 6;
for (u[0] = u[0] << 1 | u[0] >>> 31, n = 1; n < 7; n++) u[n] = u[n] >>> 4 * (n - 1) + 3;
u[7] = u[7] << 5 | u[7] >>> 27
}
var d = this._invSubKeys = [];
for (n = 0; n < 16; n++) d[n] = i[15 - n]
},
encryptBlock: function(e, t) {
this._doCryptBlock(e, t, this._subKeys)
},
decryptBlock: function(e, t) {
this._doCryptBlock(e, t, this._invSubKeys)
},
_doCryptBlock: function(e, t, n) {
this._lBlock = e[t], this._rBlock = e[t + 1], l.call(this, 4, 252645135), l.call(this, 16, 65535), f.call(this, 2, 858993459), f.call(this, 8, 16711935), l.call(this, 1, 1431655765);
for (var r = 0; r < 16; r++) {
for (var i = n[r], o = this._lBlock, a = this._rBlock, s = 0, c = 0; c < 8; c++) s |= u[c][((a ^ i[c]) & h[c]) >>> 0];
this._lBlock = a, this._rBlock = o ^ s
}
var d = this._lBlock;
this._lBlock = this._rBlock, this._rBlock = d, l.call(this, 1, 1431655765), f.call(this, 8, 16711935), f.call(this, 2, 858993459), l.call(this, 16, 65535), l.call(this, 4, 252645135), e[t] = this._lBlock, e[t + 1] = this._rBlock
},
keySize: 2,
ivSize: 2,
blockSize: 2
});

function l(e, t) {
var n = (this._lBlock >>> e ^ this._rBlock) & t;
this._rBlock ^= n, this._lBlock ^= n << e
}

function f(e, t) {
var n = (this._rBlock >>> e ^ this._lBlock) & t;
this._lBlock ^= n, this._rBlock ^= n << e
}
e.DES = i._createHelper(d);
var p = o.TripleDES = i.extend({
_doReset: function() {
var e = this._key.words;
this._des1 = d.createEncryptor(n.create(e.slice(0, 2))), this._des2 = d.createEncryptor(n.create(e.slice(2, 4))), this._des3 = d.createEncryptor(n.create(e.slice(4, 6)))
},
encryptBlock: function(e, t) {
this._des1.encryptBlock(e, t), this._des2.decryptBlock(e, t), this._des3.encryptBlock(e, t)
},
decryptBlock: function(e, t) {
this._des3.decryptBlock(e, t), this._des2.encryptBlock(e, t), this._des1.decryptBlock(e, t)
},
keySize: 6,
ivSize: 2,
blockSize: 2
});
e.TripleDES = i._createHelper(p)
}(), r.TripleDES)
}, function(e, t, n) {
var r;
e.exports = (r = n(0), n(7), n(8), n(3), n(1), function() {
var e = r,
t = e.lib.StreamCipher,
n = e.algo,
i = n.RC4 = t.extend({
_doReset: function() {
for (var e = this._key, t = e.words, n = e.sigBytes, r = this._S = [], i = 0; i < 256; i++) r[i] = i;
i = 0;
for (var o = 0; i < 256; i++) {
var a = i % n,
s = t[a >>> 2] >>> 24 - a % 4 * 8 & 255;
o = (o + r[i] + s) % 256;
var c = r[i];
r[i] = r[o], r[o] = c
}
this._i = this._j = 0
},
_doProcessBlock: function(e, t) {
e[t] ^= o.call(this)
},
keySize: 8,
ivSize: 0
});

function o() {
for (var e = this._S, t = this._i, n = this._j, r = 0, i = 0; i < 4; i++) {
n = (n + e[t = (t + 1) % 256]) % 256;
var o = e[t];
e[t] = e[n], e[n] = o, r |= e[(e[t] + e[n]) % 256] << 24 - 8 * i
}
return this._i = t, this._j = n, r
}
e.RC4 = t._createHelper(i);
var a = n.RC4Drop = i.extend({
cfg: i.cfg.extend({
drop: 192
}),
_doReset: function() {
i._doReset.call(this);
for (var e = this.cfg.drop; e > 0; e--) o.call(this)
}
});
e.RC4Drop = t._createHelper(a)
}(), r.RC4)
}, function(e, t, n) {
var r;
e.exports = (r = n(0), n(7), n(8), n(3), n(1), function() {
var e = r,
t = e.lib.StreamCipher,
n = e.algo,
i = [],
o = [],
a = [],
s = n.Rabbit = t.extend({
_doReset: function() {
for (var e = this._key.words, t = this.cfg.iv, n = 0; n < 4; n++) e[n] = 16711935 & (e[n] << 8 | e[n] >>> 24) | 4278255360 & (e[n] << 24 | e[n] >>> 8);
var r = this._X = [e[0], e[3] << 16 | e[2] >>> 16, e[1], e[0] << 16 | e[3] >>> 16, e[2], e[1] << 16 | e[0] >>> 16, e[3], e[2] << 16 | e[1] >>> 16],
i = this._C = [e[2] << 16 | e[2] >>> 16, 4294901760 & e[0] | 65535 & e[1], e[3] << 16 | e[3] >>> 16, 4294901760 & e[1] | 65535 & e[2], e[0] << 16 | e[0] >>> 16, 4294901760 & e[2] | 65535 & e[3], e[1] << 16 | e[1] >>> 16, 4294901760 & e[3] | 65535 & e[0]];
for (this._b = 0, n = 0; n < 4; n++) c.call(this);
for (n = 0; n < 8; n++) i[n] ^= r[n + 4 & 7];
if (t) {
var o = t.words,
a = o[0],
s = o[1],
u = 16711935 & (a << 8 | a >>> 24) | 4278255360 & (a << 24 | a >>> 8),
h = 16711935 & (s << 8 | s >>> 24) | 4278255360 & (s << 24 | s >>> 8),
d = u >>> 16 | 4294901760 & h,
l = h << 16 | 65535 & u;
for (i[0] ^= u, i[1] ^= d, i[2] ^= h, i[3] ^= l, i[4] ^= u, i[5] ^= d, i[6] ^= h, i[7] ^= l, n = 0; n < 4; n++) c.call(this)
}
},
_doProcessBlock: function(e, t) {
var n = this._X;
c.call(this), i[0] = n[0] ^ n[5] >>> 16 ^ n[3] << 16, i[1] = n[2] ^ n[7] >>> 16 ^ n[5] << 16, i[2] = n[4] ^ n[1] >>> 16 ^ n[7] << 16, i[3] = n[6] ^ n[3] >>> 16 ^ n[1] << 16;
for (var r = 0; r < 4; r++) i[r] = 16711935 & (i[r] << 8 | i[r] >>> 24) | 4278255360 & (i[r] << 24 | i[r] >>> 8), e[t + r] ^= i[r]
},
blockSize: 4,
ivSize: 2
});

function c() {
for (var e = this._X, t = this._C, n = 0; n < 8; n++) o[n] = t[n];
for (t[0] = t[0] + 1295307597 + this._b | 0, t[1] = t[1] + 3545052371 + (t[0] >>> 0 < o[0] >>> 0 ? 1 : 0) | 0, t[2] = t[2] + 886263092 + (t[1] >>> 0 < o[1] >>> 0 ? 1 : 0) | 0, t[3] = t[3] + 1295307597 + (t[2] >>> 0 < o[2] >>> 0 ? 1 : 0) | 0, t[4] = t[4] + 3545052371 + (t[3] >>> 0 < o[3] >>> 0 ? 1 : 0) | 0, t[5] = t[5] + 886263092 + (t[4] >>> 0 < o[4] >>> 0 ? 1 : 0) | 0, t[6] = t[6] + 1295307597 + (t[5] >>> 0 < o[5] >>> 0 ? 1 : 0) | 0, t[7] = t[7] + 3545052371 + (t[6] >>> 0 < o[6] >>> 0 ? 1 : 0) | 0, this._b = t[7] >>> 0 < o[7] >>> 0 ? 1 : 0, n = 0; n < 8; n++) {
var r = e[n] + t[n],
i = 65535 & r,
s = r >>> 16,
c = ((i * i >>> 17) + i * s >>> 15) + s * s,
u = ((4294901760 & r) * r | 0) + ((65535 & r) * r | 0);
a[n] = c ^ u
}
e[0] = a[0] + (a[7] << 16 | a[7] >>> 16) + (a[6] << 16 | a[6] >>> 16) | 0, e[1] = a[1] + (a[0] << 8 | a[0] >>> 24) + a[7] | 0, e[2] = a[2] + (a[1] << 16 | a[1] >>> 16) + (a[0] << 16 | a[0] >>> 16) | 0, e[3] = a[3] + (a[2] << 8 | a[2] >>> 24) + a[1] | 0, e[4] = a[4] + (a[3] << 16 | a[3] >>> 16) + (a[2] << 16 | a[2] >>> 16) | 0, e[5] = a[5] + (a[4] << 8 | a[4] >>> 24) + a[3] | 0, e[6] = a[6] + (a[5] << 16 | a[5] >>> 16) + (a[4] << 16 | a[4] >>> 16) | 0, e[7] = a[7] + (a[6] << 8 | a[6] >>> 24) + a[5] | 0
}
e.Rabbit = t._createHelper(s)
}(), r.Rabbit)
}, function(e, t, n) {
var r;
e.exports = (r = n(0), n(7), n(8), n(3), n(1), function() {
var e = r,
t = e.lib.StreamCipher,
n = e.algo,
i = [],
o = [],
a = [],
s = n.RabbitLegacy = t.extend({
_doReset: function() {
var e = this._key.words,
t = this.cfg.iv,
n = this._X = [e[0], e[3] << 16 | e[2] >>> 16, e[1], e[0] << 16 | e[3] >>> 16, e[2], e[1] << 16 | e[0] >>> 16, e[3], e[2] << 16 | e[1] >>> 16],
r = this._C = [e[2] << 16 | e[2] >>> 16, 4294901760 & e[0] | 65535 & e[1], e[3] << 16 | e[3] >>> 16, 4294901760 & e[1] | 65535 & e[2], e[0] << 16 | e[0] >>> 16, 4294901760 & e[2] | 65535 & e[3], e[1] << 16 | e[1] >>> 16, 4294901760 & e[3] | 65535 & e[0]];
this._b = 0;
for (var i = 0; i < 4; i++) c.call(this);
for (i = 0; i < 8; i++) r[i] ^= n[i + 4 & 7];
if (t) {
var o = t.words,
a = o[0],
s = o[1],
u = 16711935 & (a << 8 | a >>> 24) | 4278255360 & (a << 24 | a >>> 8),
h = 16711935 & (s << 8 | s >>> 24) | 4278255360 & (s << 24 | s >>> 8),
d = u >>> 16 | 4294901760 & h,
l = h << 16 | 65535 & u;
for (r[0] ^= u, r[1] ^= d, r[2] ^= h, r[3] ^= l, r[4] ^= u, r[5] ^= d, r[6] ^= h, r[7] ^= l, i = 0; i < 4; i++) c.call(this)
}
},
_doProcessBlock: function(e, t) {
var n = this._X;
c.call(this), i[0] = n[0] ^ n[5] >>> 16 ^ n[3] << 16, i[1] = n[2] ^ n[7] >>> 16 ^ n[5] << 16, i[2] = n[4] ^ n[1] >>> 16 ^ n[7] << 16, i[3] = n[6] ^ n[3] >>> 16 ^ n[1] << 16;
for (var r = 0; r < 4; r++) i[r] = 16711935 & (i[r] << 8 | i[r] >>> 24) | 4278255360 & (i[r] << 24 | i[r] >>> 8), e[t + r] ^= i[r]
},
blockSize: 4,
ivSize: 2
});

function c() {
for (var e = this._X, t = this._C, n = 0; n < 8; n++) o[n] = t[n];
for (t[0] = t[0] + 1295307597 + this._b | 0, t[1] = t[1] + 3545052371 + (t[0] >>> 0 < o[0] >>> 0 ? 1 : 0) | 0, t[2] = t[2] + 886263092 + (t[1] >>> 0 < o[1] >>> 0 ? 1 : 0) | 0, t[3] = t[3] + 1295307597 + (t[2] >>> 0 < o[2] >>> 0 ? 1 : 0) | 0, t[4] = t[4] + 3545052371 + (t[3] >>> 0 < o[3] >>> 0 ? 1 : 0) | 0, t[5] = t[5] + 886263092 + (t[4] >>> 0 < o[4] >>> 0 ? 1 : 0) | 0, t[6] = t[6] + 1295307597 + (t[5] >>> 0 < o[5] >>> 0 ? 1 : 0) | 0, t[7] = t[7] + 3545052371 + (t[6] >>> 0 < o[6] >>> 0 ? 1 : 0) | 0, this._b = t[7] >>> 0 < o[7] >>> 0 ? 1 : 0, n = 0; n < 8; n++) {
var r = e[n] + t[n],
i = 65535 & r,
s = r >>> 16,
c = ((i * i >>> 17) + i * s >>> 15) + s * s,
u = ((4294901760 & r) * r | 0) + ((65535 & r) * r | 0);
a[n] = c ^ u
}
e[0] = a[0] + (a[7] << 16 | a[7] >>> 16) + (a[6] << 16 | a[6] >>> 16) | 0, e[1] = a[1] + (a[0] << 8 | a[0] >>> 24) + a[7] | 0, e[2] = a[2] + (a[1] << 16 | a[1] >>> 16) + (a[0] << 16 | a[0] >>> 16) | 0, e[3] = a[3] + (a[2] << 8 | a[2] >>> 24) + a[1] | 0, e[4] = a[4] + (a[3] << 16 | a[3] >>> 16) + (a[2] << 16 | a[2] >>> 16) | 0, e[5] = a[5] + (a[4] << 8 | a[4] >>> 24) + a[3] | 0, e[6] = a[6] + (a[5] << 16 | a[5] >>> 16) + (a[4] << 16 | a[4] >>> 16) | 0, e[7] = a[7] + (a[6] << 8 | a[6] >>> 24) + a[5] | 0
}
e.RabbitLegacy = t._createHelper(s)
}(), r.RabbitLegacy)
}, function(e, t, n) {
var r = n(114),
i = n(115),
o = i;
o.v1 = r, o.v4 = i, e.exports = o
}, function(e, t, n) {
var r, i, o = n(43),
a = n(44),
s = 0,
c = 0;
e.exports = function(e, t, n) {
var u = t && n || 0,
h = t || [],
d = (e = e || {}).node || r,
l = void 0 !== e.clockseq ? e.clockseq : i;
if (null == d || null == l) {
var f = o();
null == d && (d = r = [1 | f[0], f[1], f[2], f[3], f[4], f[5]]), null == l && (l = i = 16383 & (f[6] << 8 | f[7]))
}
var p = void 0 !== e.msecs ? e.msecs : (new Date).getTime(),
g = void 0 !== e.nsecs ? e.nsecs : c + 1,
v = p - s + (g - c) / 1e4;
if (v < 0 && void 0 === e.clockseq && (l = l + 1 & 16383), (v < 0 || p > s) && void 0 === e.nsecs && (g = 0), g >= 1e4) throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
s = p, c = g, i = l;
var m = (1e4 * (268435455 & (p += 122192928e5)) + g) % 4294967296;
h[u++] = m >>> 24 & 255, h[u++] = m >>> 16 & 255, h[u++] = m >>> 8 & 255, h[u++] = 255 & m;
var y = p / 4294967296 * 1e4 & 268435455;
h[u++] = y >>> 8 & 255, h[u++] = 255 & y, h[u++] = y >>> 24 & 15 | 16, h[u++] = y >>> 16 & 255, h[u++] = l >>> 8 | 128, h[u++] = 255 & l;
for (var C = 0; C < 6; ++C) h[u + C] = d[C];
return t || a(h)
}
}, function(e, t, n) {
var r = n(43),
i = n(44);
e.exports = function(e, t, n) {
var o = t && n || 0;
"string" == typeof e && (t = "binary" === e ? new Array(16) : null, e = null);
var a = (e = e || {}).random || (e.rng || r)();
if (a[6] = 15 & a[6] | 64, a[8] = 63 & a[8] | 128, t)
for (var s = 0; s < 16; ++s) t[o + s] = a[s];
return t || i(a)
}
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.MediaEngine = void 0;
t.MediaEngine = class {
constructor() {}
static probe() {
! function() {
throw new Error("call to pure virtual method")
}()
}
restore(e, t) {
return this.transit(e, t, !1)
}
adjustOffer(e, t) {
return e
}
adjustAnswer(e, t) {
return e
}
}
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
})
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.VivochaBrowserHelper = void 0;
t.VivochaBrowserHelper = class {
init(e) {
this.vivocha = e;
let t, n = document.getElementsByTagName("script");
for (let r = 0; n && r < n.length; r++) {
let i = n[r],
o = e.retrieveAccountId(i.src);
if (o) {
e.config.acct_id = o;
let n = i.parentNode;
n.tagName && "HEAD" !== n.tagName ? this.vivocha.scriptParentNode = n : this.vivocha.scriptParentNode = document.body, t = !0
}
}
if (!t) {
let t = e.retrieveAccountId(location.href);
t && (e.config.acct_id = t)
}
e._ready = e._ready.then(() => (this.flushReadyHandlers(), e))
}
isMobile() {
let e = "undefined" != typeof navigator ? navigator.userAgent : "",
t = new RegExp(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|silk|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i),
n = new RegExp(/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i);
return !(!t.test(e) && !n.test(e.substr(0, 4)))
}
probeCaps() {
return {
Media: {},
Mobile: this.isMobile(),
CoBrowsing: !0
}
}
flushReadyHandlers() {
if (window.vvc_ready_handlers) {
for (var e; e = window.vvc_ready_handlers.shift();) this.vivocha.nodeify(this.vivocha.ready(), e);
delete window.vvc_ready_handlers
}
}
findWindow(e) {
if (e(window)) return window;
for (let t in this.vivocha.bus.remotes) {
const n = this.vivocha.bus.remotes[t].target;
if (e(n)) return n
}
}
getMediaWindow() {
return this.findWindow(e => {
try {
return e && e.vivocha && e.vivocha.channel && "function" == typeof e.vivocha.channel && "function" != typeof e.vivocha.channel._distance && e.vivocha.channel().contacts
} catch (e) {
return !1
}
})
}
createVideoFrame(e, t, r) {
return new Promise((i, o) => {
n.e(2).then((o => {
const a = n(57).VivochaVideoFrameContainer;
i(a.create(this.vivocha, e, t, r))
}).bind(null, n)).catch(e => {
o(e)
})
})
}
createLocalVideoFrame(e, t) {
return this.createVideoFrame("tx", e, t)
}
createRemoteVideoFrame(e, t) {
return this.createVideoFrame("rx", e, t)
}
getMediaStream(e, t, n) {
const r = this.getMediaWindow().vivocha;
if (!r) throw new Error("no_vivocha");
let i;
if (r.channel && r.channel().contacts ? i = r.channel().contacts[e] : r.contact && (i = r.contacts), !i || i.id !== e) throw new Error("no_contact");
return i.getMediaStream(t, n)
}
async getContactMediaStream(e, t, n) {
const r = await e.getMediaEngine("WebRTC");
if (!r) throw new Error("no_webrtc_engine");
return r.getMediaStream(t, n)
}
async getWebRTCChannel(e, t) {
const n = await e.getMediaEngine("WebRTC"),
r = await n.createDataChannel(t);
return e.dataChannels[t] = r, r
}
async switchToNextCamera(e) {
const t = await e.getMediaEngine("WebRTC");
if (!t) throw new Error("no_webrtc_engine");
return t.switchToNextCamera()
}
}
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
});
var r = n(120);
Object.defineProperty(t, "Bus", {
enumerable: !0,
get: function() {
return r.Bus
}
});
var i = n(48);
Object.defineProperty(t, "ProxyProvider", {
enumerable: !0,
get: function() {
return i.ProxyProvider
}
})
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.Bus = void 0;
const r = n(18),
i = n(9),
o = n(51),
a = n(125),
s = n(48),
c = n(126),
u = r.getLogger("vvc-bus");

function h(e, t, n) {
t.addEventListener ? t.addEventListener(e, n, !1) : t.attachEvent ? t.attachEvent("on" + e, n) : t[e] = n
}
class d extends i.EventEmitter {
constructor(e = "*") {
super(), this.domain = e, this.services = {}, this.requests = {}, this.remotes = {}, this.probeList = [], this.debug = !1, this.knownWindows = new a.BusWeakSet, this.currentProbes = new a.BusWeakSet, this.id = o.v4(), h("unload", window, e => {
for (let e in this.services) s.ProxyProvider.isProxy(this.services[e]) || this.unregisterService(e);
this.release()
})
}
start() {
this.startMessageHandler(), this.initProbes()
}
release() {
this.probeTimer && (this.clearInterval(this.probeTimer), delete this.probeTimer), this.removeAllListeners(), this.stopMessageHandler()
}
startMessageHandler() {
this.messageHandler = e => {
try {
if (e && e.data) {
const t = "string" == typeof e.data ? JSON.parse(e.data) : e.data;
t && t.vvc6 && t.from && t.from !== this.id && (t.domain === this.domain || "*" === t.domain) && this.handleMessage(this.getRemote(t.from, e.source), t)
}
} catch (t) {
u.error("bad message", e, t)
}
}, h("message", window, this.messageHandler)
}
stopMessageHandler() {
var e, t, n;
e = "message", t = window, n = this.messageHandler, t.removeEventListener ? t.removeEventListener(e, n, !1) : t.detachEvent ? t.detachEvent("on" + e, n) : t[e] = n, delete this.messageHandler
}
initProbes() {
const e = t => {
try {
t.self !== window.self && this.addToProbeList(t)
} catch (e) {}
try {
t.parent !== t.self && e(t.parent)
} catch (e) {}
try {
t.opener && e(t.opener)
} catch (e) {}
};
e(window);
const t = (e = 1e3) => {
try {
this.probeRemotes()
} catch (e) {
u.warn("Bus.initProbes probe error", e)
}
this.probeTimer = setTimeout(() => {
t(e < 1e3 ? 2 * e : 1e3)
}, e)
};
this.probeRemote(window), t(31.25)
}
addToProbeList(e) {
this.currentProbes.has(e) || (this.probeList.push({
window: e,
probes: 0
}), this.currentProbes.add(e))
}
moveToProbeList(e) {
e.state = "new", this.currentProbes.has(e.target) || (this.probeList.push({
window: e.target,
probes: 0,
remote: e
}), this.currentProbes.add(e.target)), this.deleteRemote(e.id)
}
probeRemote(e) {
this.postMessage(e, {
type: "request",
code: "ping"
})
}
crawlBus(e) {
const t = new a.BusWeakSet,
n = e => {
for (let r in e.remotes) {
const i = e.remotes[r].target;
if (!t.has(i)) {
t.add(i), i.self === window.self || this.knownWindows.has(i) || this.addToProbeList(i);
try {
i.vivocha && i.vivocha.bus && i.vivocha.bus.remotes && n(i.vivocha.bus)
} catch (e) {}
}
}
};
return n(e)
}
probeRemotes() {
this.crawlBus(this), this.probeList = this.probeList.filter(e => {
try {
return !(!e.window || e.window.closed || this.knownWindows.has(e.window)) && (this.probeRemote(e.window), ++e.probes < 1200)
} catch (e) {
return !1
}
}), this.currentProbes = new a.BusWeakSet(this.probeList.map(e => e.window))
}
getRemote(e, t) {
let n = this.remotes[e] || this.restoreRemote(e) || this.createRemote(e, t);
return n.touch(), n
}
restoreRemote(e) {
for (let t = 0; t < this.probeList.length; t++)
if (void 0 !== this.probeList[t].remote && this.probeList[t].remote.id === e) return this.probeList[t].remote
}
createRemote(e, t) {
if (u.log.enabled) try {
void 0 !== t.name && u.log("Bus.createRemote", e, t)
} catch (t) {
const n = t.message.match(/origin \"([^\"]+)\" from/);
u.log("Bus.createRemote", e, n && n[1])
}
const n = this.remotes[e] = new c.Remote(e, t, this);
return this.knownWindows.add(t), this.probeRemote(t), n
}
deleteRemote(e) {
let t = this.remotes[e];
if (t) {
for (let e in t.services) this.unregisterService(e, t);
delete this.remotes[e], this.knownWindows.delete(t.target)
} else u.error("Bus.deleteRemote", "unknown remote", e)
}
handleMessage(e, t) {
switch (u.debug("Bus.handleMessage", t), t.type) {
case "request":
this.handleRequest(e, t);
break;
case "response":
this.handleResponse(e, t);
break;
case "event":
this.handleEvent(e, t);
break;
default:
u.error("Bus.handleMessage", "bad message", t)
}
}
handleRequest(e, t) {
let n, r;
if (t.args = t.args ? this.deserializeValues(e, t.args) : [], e.proxied[t.to]) r = e.proxied[t.to], r[t.code] ? n = Promise.resolve(r[t.code].apply(r, t.args)) : (u.error("Bus.handleRequest", "bad request code", t), n = Promise.reject(new Error("unsupported_method")));
else if ("ping" === t.code) n = Promise.resolve(this.handlePing(e, t));
else if (t.to === this.id) switch (t.code) {
case "list_services":
n = Promise.resolve(this.handleListServices(e, t));
break;
case "register_service":
n = Promise.resolve(this.handleRegisterService(e, t));
break;
case "unregister_service":
n = Promise.resolve(this.handleUnregisterService(e, t));
break;
case "emitter_on":
n = Promise.resolve(this.handleEmitterOn(e, t));
break;
case "emitter_once":
n = Promise.resolve(this.handleEmitterOnce(e, t));
break;
case "emitter_remove":
n = Promise.resolve(this.handleEmitterRemove(e, t));
break;
default:
u.error("Bus.handleRequest", "bad request code", t), n = Promise.reject(new Error("unsupported_method"))
} else this.services[t.to] && this.services[t.to][t.code] ? (r = this.services[t.to], n = Promise.resolve(r[t.code].apply(r, t.args))) : (u.error("Bus.handleRequest", "unknown service/method", t), n = Promise.reject(new Error("unsupported_service_method ".concat(t.to, "-").concat(t.code, "+").concat(this.id))));
t.ref && n.then(n => {
this.postMessage(e, {
ref: t.ref,
type: "response",
data: this.serializeValue(e, n)
})
}, n => {
this.postMessage(e, {
ref: t.ref,
type: "response",
error: this.serializeValue(e, n.message || n)
})
})
}
handleResponse(e, t) {
t.ref && this.requests[t.ref] ? (t.error && (t.error = this.deserializeValue(e, t.error)), t.data && (t.data = this.deserializeValue(e, t.data)), this.requests[t.ref](t.error, t.data), delete this.requests[t.ref]) : u.error("invalid/unknown response", t)
}
handleEvent(e, t) {
t.code && e.events[t.code] ? e.events[t.code].apply(this, t.args ? this.deserializeValues(e, t.args) : []) : u.error("invalid/unknown event", t)
}
handlePing(e, t) {
return "new" === e.state && (e.state = "init", this.postRequest(e, e.id, "list_services", null, 2e3).then(t => {
for (let n in t) this.doRegisterRemoteService(n, t[n].description, e, t[n].distance);
e.state = "ready"
}, t => {
u.error("Bus.handlePing", "failed to init remote", t), this.deleteRemote(e.id)
})), !0
}
handleListServices(e, t) {
return new Promise((e, t) => {
var n, r = {};
for (var i in this.services) n = this.services[i], r[i] = {
description: s.ProxyProvider.describe(n),
distance: this.getProviderDistance(n)
};
e(r)
})
}
handleRegisterService(e, t) {
return new Promise((n, r) => {
if (!t.args || t.args.length < 2) r(new Error("bad_args"));
else {
let r = t.args[0],
i = t.args[1],
o = t.args[2];
i && i.methods && i.methods.length && (u.log("Bus.handleRequest", "adding proxy service"), this.doRegisterRemoteService(r, i, e, o)), n(!0)
}
})
}
doRegisterRemoteService(e, t, n, r) {
u.log("Bus.handleRequest", "adding proxy service", e);
let i = new s.ProxyProvider(e, t, n, r + 1),
o = !this.services[e];
this.registerService(e, i), o && (this.emit("added", e, i), this.emit("added." + e, i))
}
handleUnregisterService(e, t) {
return new Promise((n, r) => {
if (!t.args || t.args.length < 1) r(new Error("bad_args"));
else {
let r = t.args[0];
this.unregisterService(r, e), this.services[r] && 0 === this.getProviderDistance(this.services[r]) ? u.warn("Bus.handleUnregisterService", "ignoring remote request to remove local service", r) : (this.unregisterService(r, e), this.services[r] || (this.emit("removed", r), this.emit("removed." + r))), n(!0)
}
})
}
handleEmitterOn(e, t) {
if (t.args) {
let n = t.args[0],
r = e.proxied[n];
if (!r || "function" != typeof r.on) return !1;
let i = t.args[1],
o = t.args[2],
a = this.deserializeValue(e, {
t: "f",
d: o
});
return a.id = o, e.listeners[o] = {
target: n,
event: i,
listener: a
}, r.on(i, a), !0
}
return !1
}
handleEmitterOnce(e, t) {
if (t.args) {
let n = t.args[0],
r = e.proxied[n];
if (!r || "function" != typeof r.once) return !1;
let i = t.args[1],
o = t.args[2],
a = this.deserializeValue(e, {
t: "f",
d: o
}),
s = function() {
delete e.listeners[o], a.apply(this, arguments)
};
return s.id = o, e.listeners[o] = {
target: n,
event: i,
listener: s
}, r.once(i, s), !0
}
return !1
}
handleEmitterRemove(e, t) {
if (t.args) {
let n = t.args[0],
r = e.proxied[n];
if (!r || "function" != typeof r.removeListener) return !1;
let i = t.args[1],
o = t.args[2],
a = e.listeners[o];
return !!a && (r.removeListener(i, a.listener), delete e.listeners[o], !0)
}
return !1
}
getClosestProvider(e, t) {
let n = t ? this.getProviderDistance(t.services[e]) : void 0,
r = t;
for (let t in this.remotes) {
let i = this.remotes[t].services[e],
o = this.getProviderDistance(i);
i && (void 0 === n || o < n) && (n = o, r = this.remotes[t])
}
return r
}
getProviderDistance(e) {
return s.ProxyProvider.isProxy(e) ? e._distance ? e._distance() : 1 : 0
}
registerService(e, t) {
if (this.services[e] && 0 === this.getProviderDistance(this.services[e])) u.warn("Bus.registerService", "ignoring remote request to register local service", e);
else {
let n = !1,
r = s.ProxyProvider.isProxy(t) ? t._source() : null,
i = this.getProviderDistance(t);
if (r) {
r.services[e] = t, this.getClosestProvider(e, r) === r && (n = !0, this.services[e] = t)
} else n = !0, this.services[e] = t;
if (n) {
let n = s.ProxyProvider.describe(t);
for (let t in this.remotes) r != this.remotes[t] && this.postRequest(this.remotes[t], t, "register_service", [e, n, i]).then(() => {}, e => {
u.error("Bus.registerService", "failed to register_service", t, n, i, e)
})
}
}
}
unregisterService(e, t) {
t && delete t.services[e];
let n = this.getClosestProvider(e);
if (n) n.services[e] !== this.services[e] && this.registerService(e, n.services[e]);
else {
for (let n in this.remotes) t != this.remotes[n] && this.postRequest(this.remotes[n], n, "unregister_service", [e]);
delete this.services[e]
}
}
postMessage(e, t) {
t.vvc6 = !0, t.from = this.id, t.domain = this.domain, u.debug("Bus.postMessage", t), c.safePostMessage(e, t)
}
postRequest(e, t, n, r, i = 1e4) {
let a = o.v4(),
s = {
ref: a,
to: t,
type: "request",
code: n,
args: this.serializeValues(e, r)
};
return new Promise((t, n) => {
let r;
i && (r = this.setTimeout(() => {
delete this.requests[a], n(new Error("timeout"))
}, i)), this.requests[a] = (e, i) => {
r && this.clearTimeout(r), delete this.requests[a], e ? n(e) : t(i)
}, this.postMessage(e, s)
})
}
serializeValue(e, t) {
if (null != t) {
let n;
switch (typeof t) {
case "function":
n = {
t: "f",
d: e.registerEventHandler(t)
};
break;
case "object":
if (t._proxable || s.ProxyProvider.isProxy(t)) {
let r = o.v4();
e.proxied[r] = t, n = {
t: "p",
d: {
id: r,
description: s.ProxyProvider.describe(t)
}
}
} else n = {
t: "o",
d: t
};
break;
default:
n = {
t: "s",
d: t
}
}
return n
}
return null
}
serializeValues(e, t) {
let n = [];
for (let r = 0; t && r < t.length; r++) n.push(this.serializeValue(e, t[r]));
return n
}
deserializeValue(e, t) {
let n;
if (t) switch (t.t) {
case "s":
case "o":
n = t.d;
break;
case "p":
t.d && (n = new s.ProxyProvider(t.d.id, t.d.description, e));
break;
case "f":
n = (...n) => {
this.postMessage(e, {
type: "event",
code: t.d,
args: this.serializeValues(e, n)
})
}
}
return n
}
deserializeValues(e, t) {
let n = [];
for (let r = 0; t && r < t.length; r++) n.push(this.deserializeValue(e, t[r]));
return n
}
setTimeout(e, t, ...n) {
return setTimeout(e, t, ...n)
}
clearTimeout(e) {
return clearTimeout(e)
}
setInterval(e, t, ...n) {
return setInterval(e, t, ...n)
}
clearInterval(e) {
return clearInterval(e)
}
oncecb(e) {
return e._once = !0, e
}
request(e, t, ...n) {
return new Promise((r, i) => {
let o = this.services[e];
o ? o[t] ? r(o[t].apply(o, ...n)) : i(new Error("unsupported_type " + t)) : i(new Error("unknown_service " + e))
})
}
}
t.Bus = d
}, function(e, t, n) {
e.exports = function(e) {
function t(e) {
let n, i, o, a = null;

function s(...e) {
if (!s.enabled) return;
const r = s,
i = Number(new Date),
o = i - (n || i);
r.diff = o, r.prev = n, r.curr = i, n = i, e[0] = t.coerce(e[0]), "string" != typeof e[0] && e.unshift("%O");
let a = 0;
e[0] = e[0].replace(/%([a-zA-Z%])/g, (n, i) => {
if ("%%" === n) return "%";
a++;
const o = t.formatters[i];
if ("function" == typeof o) {
const t = e[a];
n = o.call(r, t), e.splice(a, 1), a--
}
return n
}), t.formatArgs.call(r, e);
(r.log || t.log).apply(r, e)
}
return s.namespace = e, s.useColors = t.useColors(), s.color = t.selectColor(e), s.extend = r, s.destroy = t.destroy, Object.defineProperty(s, "enabled", {
enumerable: !0,
configurable: !1,
get: () => null !== a ? a : (i !== t.namespaces && (i = t.namespaces, o = t.enabled(e)), o),
set: e => {
a = e
}
}), "function" == typeof t.init && t.init(s), s
}

function r(e, n) {
const r = t(this.namespace + (void 0 === n ? ":" : n) + e);
return r.log = this.log, r
}

function i(e) {
return e.toString().substring(2, e.toString().length - 2).replace(/\.\*\?$/, "*")
}
return t.debug = t, t.default = t, t.coerce = function(e) {
if (e instanceof Error) return e.stack || e.message;
return e
}, t.disable = function() {
const e = [...t.names.map(i), ...t.skips.map(i).map(e => "-" + e)].join(",");
return t.enable(""), e
}, t.enable = function(e) {
let n;
t.save(e), t.namespaces = e, t.names = [], t.skips = [];
const r = ("string" == typeof e ? e : "").split(/[\s,]+/),
i = r.length;
for (n = 0; n < i; n++) r[n] && ("-" === (e = r[n].replace(/\*/g, ".*?"))[0] ? t.skips.push(new RegExp("^" + e.substr(1) + "$")) : t.names.push(new RegExp("^" + e + "$")))
}, t.enabled = function(e) {
if ("*" === e[e.length - 1]) return !0;
let n, r;
for (n = 0, r = t.skips.length; n < r; n++)
if (t.skips[n].test(e)) return !1;
for (n = 0, r = t.names.length; n < r; n++)
if (t.names[n].test(e)) return !0;
return !1
}, t.humanize = n(122), t.destroy = function() {
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")
}, Object.keys(e).forEach(n => {
t[n] = e[n]
}), t.names = [], t.skips = [], t.formatters = {}, t.selectColor = function(e) {
let n = 0;
for (let t = 0; t < e.length; t++) n = (n << 5) - n + e.charCodeAt(t), n |= 0;
return t.colors[Math.abs(n) % t.colors.length]
}, t.enable(t.load()), t
}
}, function(e, t) {
var n = 1e3,
r = 6e4,
i = 60 * r,
o = 24 * i;

function a(e, t, n, r) {
var i = t >= 1.5 * n;
return Math.round(e / n) + " " + r + (i ? "s" : "")
}
e.exports = function(e, t) {
t = t || {};
var s = typeof e;
if ("string" === s && e.length > 0) return function(e) {
if ((e = String(e)).length > 100) return;
var t = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);
if (!t) return;
var a = parseFloat(t[1]);
switch ((t[2] || "ms").toLowerCase()) {
case "years":
case "year":
case "yrs":
case "yr":
case "y":
return 315576e5 * a;
case "weeks":
case "week":
case "w":
return 6048e5 * a;
case "days":
case "day":
case "d":
return a * o;
case "hours":
case "hour":
case "hrs":
case "hr":
case "h":
return a * i;
case "minutes":
case "minute":
case "mins":
case "min":
case "m":
return a * r;
case "seconds":
case "second":
case "secs":
case "sec":
case "s":
return a * n;
case "milliseconds":
case "millisecond":
case "msecs":
case "msec":
case "ms":
return a;
default:
return
}
}(e);
if ("number" === s && isFinite(e)) return t.long ? function(e) {
var t = Math.abs(e);
if (t >= o) return a(e, t, o, "day");
if (t >= i) return a(e, t, i, "hour");
if (t >= r) return a(e, t, r, "minute");
if (t >= n) return a(e, t, n, "second");
return e + " ms"
}(e) : function(e) {
var t = Math.abs(e);
if (t >= o) return Math.round(e / o) + "d";
if (t >= i) return Math.round(e / i) + "h";
if (t >= r) return Math.round(e / r) + "m";
if (t >= n) return Math.round(e / n) + "s";
return e + "ms"
}(e);
throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(e))
}
}, function(e, t, n) {
var r, i, o = n(52),
a = n(53),
s = 0,
c = 0;
e.exports = function(e, t, n) {
var u = t && n || 0,
h = t || [],
d = (e = e || {}).node || r,
l = void 0 !== e.clockseq ? e.clockseq : i;
if (null == d || null == l) {
var f = o();
null == d && (d = r = [1 | f[0], f[1], f[2], f[3], f[4], f[5]]), null == l && (l = i = 16383 & (f[6] << 8 | f[7]))
}
var p = void 0 !== e.msecs ? e.msecs : (new Date).getTime(),
g = void 0 !== e.nsecs ? e.nsecs : c + 1,
v = p - s + (g - c) / 1e4;
if (v < 0 && void 0 === e.clockseq && (l = l + 1 & 16383), (v < 0 || p > s) && void 0 === e.nsecs && (g = 0), g >= 1e4) throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
s = p, c = g, i = l;
var m = (1e4 * (268435455 & (p += 122192928e5)) + g) % 4294967296;
h[u++] = m >>> 24 & 255, h[u++] = m >>> 16 & 255, h[u++] = m >>> 8 & 255, h[u++] = 255 & m;
var y = p / 4294967296 * 1e4 & 268435455;
h[u++] = y >>> 8 & 255, h[u++] = 255 & y, h[u++] = y >>> 24 & 15 | 16, h[u++] = y >>> 16 & 255, h[u++] = l >>> 8 | 128, h[u++] = 255 & l;
for (var C = 0; C < 6; ++C) h[u + C] = d[C];
return t || a(h)
}
}, function(e, t, n) {
var r = n(52),
i = n(53);
e.exports = function(e, t, n) {
var o = t && n || 0;
"string" == typeof e && (t = "binary" === e ? new Array(16) : null, e = null);
var a = (e = e || {}).random || (e.rng || r)();
if (a[6] = 15 & a[6] | 64, a[8] = 63 & a[8] | 128, t)
for (var s = 0; s < 16; ++s) t[o + s] = a[s];
return t || i(a)
}
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.BusWeakSet = void 0;
const r = n(18).getLogger("vvc-bus");
class i {
constructor(e = []) {
this.items = e
}
indexOf(e) {
for (let t = 0; t < this.items.length; t++)
if (this.items[t] === e) return t;
return -1
}
add(e) {
return this.has(e) || this.items.push(e), this
}
delete(e) {
let t = this.indexOf(e);
if (-1 === t) return !1;
this.items.splice(t, 1)
}
has(e) {
return -1 !== this.indexOf(e)
}
}
const o = "undefined" != typeof WeakSet && -1 !== WeakSet.toString().indexOf("[native code]") ? (r.log("Bus is using native WeakSet"), WeakSet) : (r.log("Bus is using native VivochaWeakSet"), i);
t.BusWeakSet = o
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.Remote = t.safePostMessage = void 0;
const r = n(18),
i = n(51),
o = r.getLogger("vvc-bus"),
a = function() {
if ("undefined" == typeof document) return !0; {
let e = 3;
if (document.documentMode) e = document.documentMode;
else {
let t = document.createElement("div"),
n = t.getElementsByTagName("i");
for (; t.innerHTML = "<!--[if gt IE ".concat(++e, "]><i></i><![endif]-->"), n[0];);
}
return e < 5 || e > 9
}
}();
t.safePostMessage = function(e, t) {
try {
e.postMessage(a ? t : JSON.stringify(t), "*")
} catch (e) {
o.error("safePostMessage message", e.message, t)
}
};
t.Remote = class {
constructor(e, t, n) {
this.id = e, this.target = t, this.bus = n, this.state = "new", this.services = {}, this.proxied = {}, this.events = {}, this.listeners = {}, this.pingNum = 0, this.pingSendTimeout = () => {
let e = !1;
try {
this.target && this.target.location && "about:blank" == this.target.location.href && (e = !0, o.warn("Remote.pingSendTimeout", "target.location.href is about:blank"))
} catch (e) {}
try {
!this.target || this.target.closed || e ? (o.warn("Remote.pingSendTimeout", "target.closed, invalid remote"), this.bus.moveToProbeList(this)) : (o.debug("Remote.pingSendTimeout", "going to reset ping timer"), this.bus.postRequest(this, this.id, "ping", [this.pingNum++]).catch((function(e) {
o.error("Remote.pingSendTimeout", "ping", e)
})), this.resetPingSendTimer())
} catch (e) {
o.error("Remote.pingSendTimeout", "target.closed", e)
}
}, this.pingRecvTimeout = () => {
o.error("Remote.pingRecvTimeout", this.id), this.pingSendTimer && this.bus.clearTimeout(this.pingSendTimer), this.bus.moveToProbeList(this)
}
}
postMessage(e, t = "*", n) {
try {
this.resetPingSendTimer(), this.target.postMessage(e, t, n)
} catch (n) {
o.error("Remote.postMessage", "failed", e, t, n)
}
}
postRequest(e, t, n) {
return this.bus.postRequest(this, e, t, n)
}
resetPingSendTimer() {
this.pingSendTimer && this.bus.clearTimeout(this.pingSendTimer);
let e = Math.round(1e3 + 1e3 * Math.random());
this.pingSendTimer = this.bus.setTimeout(this.pingSendTimeout.bind(this), e)
}
touch() {
this.pingRecvTimer && this.bus.clearTimeout(this.pingRecvTimer), this.bus.debug || (this.pingRecvTimer = this.bus.setTimeout(this.pingRecvTimeout.bind(this), 1e4))
}
registerEventHandler(e) {
let t = i.v4();
return e._once ? this.events[t] = (...n) => (delete this.events[t], e(...n)) : this.events[t] = e, t
}
unregisterEventHandler(e) {
delete this.events[e]
}
}
}, function(e, t, n) {
"use strict";
t.decode = t.parse = n(128), t.encode = t.stringify = n(129)
}, function(e, t, n) {
"use strict";

function r(e, t) {
return Object.prototype.hasOwnProperty.call(e, t)
}
e.exports = function(e, t, n, o) {
t = t || "&", n = n || "=";
var a = {};
if ("string" != typeof e || 0 === e.length) return a;
var s = /\+/g;
e = e.split(t);
var c = 1e3;
o && "number" == typeof o.maxKeys && (c = o.maxKeys);
var u = e.length;
c > 0 && u > c && (u = c);
for (var h = 0; h < u; ++h) {
var d, l, f, p, g = e[h].replace(s, "%20"),
v = g.indexOf(n);
v >= 0 ? (d = g.substr(0, v), l = g.substr(v + 1)) : (d = g, l = ""), f = decodeURIComponent(d), p = decodeURIComponent(l), r(a, f) ? i(a[f]) ? a[f].push(p) : a[f] = [a[f], p] : a[f] = p
}
return a
};
var i = Array.isArray || function(e) {
return "[object Array]" === Object.prototype.toString.call(e)
}
}, function(e, t, n) {
"use strict";
var r = function(e) {
switch (typeof e) {
case "string":
return e;
case "boolean":
return e ? "true" : "false";
case "number":
return isFinite(e) ? e : "";
default:
return ""
}
};
e.exports = function(e, t, n, s) {
return t = t || "&", n = n || "=", null === e && (e = void 0), "object" == typeof e ? o(a(e), (function(a) {
var s = encodeURIComponent(r(a)) + n;
return i(e[a]) ? o(e[a], (function(e) {
return s + encodeURIComponent(r(e))
})).join(t) : s + encodeURIComponent(r(e[a]))
})).join(t) : s ? encodeURIComponent(r(s)) + n + encodeURIComponent(r(e)) : ""
};
var i = Array.isArray || function(e) {
return "[object Array]" === Object.prototype.toString.call(e)
};

function o(e, t) {
if (e.map) return e.map(t);
for (var n = [], r = 0; r < e.length; r++) n.push(t(e[r], r));
return n
}
var a = Object.keys || function(e) {
var t = [];
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.push(n);
return t
}
}, , , , function(e, t, n) {
"use strict";
var r = this && this.__createBinding || (Object.create ? function(e, t, n, r) {
void 0 === r && (r = n), Object.defineProperty(e, r, {
enumerable: !0,
get: function() {
return t[n]
}
})
} : function(e, t, n, r) {
void 0 === r && (r = n), e[r] = t[n]
}),
i = this && this.__exportStar || function(e, t) {
for (var n in e) "default" === n || Object.prototype.hasOwnProperty.call(t, n) || r(t, e, n)
};
Object.defineProperty(t, "__esModule", {
value: !0
}), i(n(154), t), i(n(156), t), i(n(158), t)
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.mungeOffer = t.detectCaps = void 0;
const r = n(27),
i = n(11);
t.detectCaps = async function(e) {
const t = {};
try {
if (!e || !navigator.mediaDevices) throw new Error("WebRTC unsupported browser");
navigator.mediaDevices.getSupportedConstraints();
const n = await navigator.mediaDevices.enumerateDevices();
i.dot(t, "Media.Voice.Engines.WebRTC", !0), i.dot(t, "Media.Video.Engines.WebRTC", !0), i.dot(t, "Media.Screen.Engines.WebRTC", !0);
n.filter(e => e && "audioinput" === e.kind).length ? (i.dot(t, "WebRTC.AudioCapture", !0), i.dot(t, "WebRTC.AudioConstraints", !0)) : i.dot(t, "WebRTC.AudioCapture", !1);
const r = n.filter(e => e && "videoinput" === e.kind);
return r.length ? (i.dot(t, "WebRTC.VideoCapture", !0), i.dot(t, "WebRTC.VideoConstraints", !0), r.length > 1 && i.dot(t, "WebRTC.VideoMultipleDevices", !0)) : i.dot(t, "WebRTC.VideoCapture", !1), "function" == typeof navigator.mediaDevices.getDisplayMedia && (i.dot(t, "WebRTC.ScreenCapture", !0), i.dot(t, "WebRTC.Chrome", !0)), i.dot(t, "WebRTC.UnifiedPlan", !0), t
} catch (e) {
console.warn(e)
}
return t
}, t.mungeOffer = function(e, t) {
for (var n, i, o, a = r.splitSections(e), s = 1; s < a.length; s++) 0 === (n = a[s]).indexOf("m=audio") ? (i = t.sendAudio, o = t.recvAudio) : 0 === n.indexOf("m=video") ? (i = t.sendVideo, o = t.recvVideo) : i = o = !1, i && !o ? a[s] = n.replace("a=sendrecv", "a=sendonly") : i || o || (a[s] = n.replace("a=sendrecv", "a=inactive"));
return a.join("")
}
}, function(e, t, n) {
"use strict";
var r = n(27);

function i(e, t, n, i, o) {
var a = r.writeRtpDescription(e.kind, t);
if (a += r.writeIceParameters(e.iceGatherer.getLocalParameters()), a += r.writeDtlsParameters(e.dtlsTransport.getLocalParameters(), "offer" === n ? "actpass" : o || "active"), a += "a=mid:" + e.mid + "\r\n", e.rtpSender && e.rtpReceiver ? a += "a=sendrecv\r\n" : e.rtpSender ? a += "a=sendonly\r\n" : e.rtpReceiver ? a += "a=recvonly\r\n" : a += "a=inactive\r\n", e.rtpSender) {
var s = e.rtpSender._initialTrackId || e.rtpSender.track.id;
e.rtpSender._initialTrackId = s;
var c = "msid:" + (i ? i.id : "-") + " " + s + "\r\n";
a += "a=" + c, a += "a=ssrc:" + e.sendEncodingParameters[0].ssrc + " " + c, e.sendEncodingParameters[0].rtx && (a += "a=ssrc:" + e.sendEncodingParameters[0].rtx.ssrc + " " + c, a += "a=ssrc-group:FID " + e.sendEncodingParameters[0].ssrc + " " + e.sendEncodingParameters[0].rtx.ssrc + "\r\n")
}
return a += "a=ssrc:" + e.sendEncodingParameters[0].ssrc + " cname:" + r.localCName + "\r\n", e.rtpSender && e.sendEncodingParameters[0].rtx && (a += "a=ssrc:" + e.sendEncodingParameters[0].rtx.ssrc + " cname:" + r.localCName + "\r\n"), a
}

function o(e, t) {
var n = {
codecs: [],
headerExtensions: [],
fecMechanisms: []
},
r = function(e, t) {
e = parseInt(e, 10);
for (var n = 0; n < t.length; n++)
if (t[n].payloadType === e || t[n].preferredPayloadType === e) return t[n]
},
i = function(e, t, n, i) {
var o = r(e.parameters.apt, n),
a = r(t.parameters.apt, i);
return o && a && o.name.toLowerCase() === a.name.toLowerCase()
};
return e.codecs.forEach((function(r) {
for (var o = 0; o < t.codecs.length; o++) {
var a = t.codecs[o];
if (r.name.toLowerCase() === a.name.toLowerCase() && r.clockRate === a.clockRate) {
if ("rtx" === r.name.toLowerCase() && r.parameters && a.parameters.apt && !i(r, a, e.codecs, t.codecs)) continue;
(a = JSON.parse(JSON.stringify(a))).numChannels = Math.min(r.numChannels, a.numChannels), n.codecs.push(a), a.rtcpFeedback = a.rtcpFeedback.filter((function(e) {
for (var t = 0; t < r.rtcpFeedback.length; t++)
if (r.rtcpFeedback[t].type === e.type && r.rtcpFeedback[t].parameter === e.parameter) return !0;
return !1
}));
break
}
}
})), e.headerExtensions.forEach((function(e) {
for (var r = 0; r < t.headerExtensions.length; r++) {
var i = t.headerExtensions[r];
if (e.uri === i.uri) {
n.headerExtensions.push(i);
break
}
}
})), n
}

function a(e, t, n) {
return -1 !== {
offer: {
setLocalDescription: ["stable", "have-local-offer"],
setRemoteDescription: ["stable", "have-remote-offer"]
},
answer: {
setLocalDescription: ["have-remote-offer", "have-local-pranswer"],
setRemoteDescription: ["have-local-offer", "have-remote-pranswer"]
}
} [t][e].indexOf(n)
}

function s(e, t) {
var n = e.getRemoteCandidates().find((function(e) {
return t.foundation === e.foundation && t.ip === e.ip && t.port === e.port && t.priority === e.priority && t.protocol === e.protocol && t.type === e.type
}));
return n || e.addRemoteCandidate(t), !n
}

function c(e, t) {
var n = new Error(t);
return n.name = e, n.code = {
NotSupportedError: 9,
InvalidStateError: 11,
InvalidAccessError: 15,
TypeError: void 0,
OperationError: void 0
} [e], n
}
e.exports = function(e, t) {
function n(t, n) {
n.addTrack(t), n.dispatchEvent(new e.MediaStreamTrackEvent("addtrack", {
track: t
}))
}

function u(t, n, r, i) {
var o = new Event("track");
o.track = n, o.receiver = r, o.transceiver = {
receiver: r
}, o.streams = i, e.setTimeout((function() {
t._dispatchEvent("track", o)
}))
}
var h = function(n) {
var i = this,
o = document.createDocumentFragment();
if (["addEventListener", "removeEventListener", "dispatchEvent"].forEach((function(e) {
i[e] = o[e].bind(o)
})), this.canTrickleIceCandidates = null, this.needNegotiation = !1, this.localStreams = [], this.remoteStreams = [], this._localDescription = null, this._remoteDescription = null, this.signalingState = "stable", this.iceConnectionState = "new", this.connectionState = "new", this.iceGatheringState = "new", n = JSON.parse(JSON.stringify(n || {})), this.usingBundle = "max-bundle" === n.bundlePolicy, "negotiate" === n.rtcpMuxPolicy) throw c("NotSupportedError", "rtcpMuxPolicy 'negotiate' is not supported");
switch (n.rtcpMuxPolicy || (n.rtcpMuxPolicy = "require"), n.iceTransportPolicy) {
case "all":
case "relay":
break;
default:
n.iceTransportPolicy = "all"
}
switch (n.bundlePolicy) {
case "balanced":
case "max-compat":
case "max-bundle":
break;
default:
n.bundlePolicy = "balanced"
}
if (n.iceServers = function(e, t) {
var n = !1;
return (e = JSON.parse(JSON.stringify(e))).filter((function(e) {
if (e && (e.urls || e.url)) {
var r = e.urls || e.url;
e.url && !e.urls && console.warn("RTCIceServer.url is deprecated! Use urls instead.");
var i = "string" == typeof r;
return i && (r = [r]), r = r.filter((function(e) {
return 0 === e.indexOf("turn:") && -1 !== e.indexOf("transport=udp") && -1 === e.indexOf("turn:[") && !n ? (n = !0, !0) : 0 === e.indexOf("stun:") && t >= 14393 && -1 === e.indexOf("?transport=udp")
})), delete e.url, e.urls = i ? r[0] : r, !!r.length
}
}))
}(n.iceServers || [], t), this._iceGatherers = [], n.iceCandidatePoolSize)
for (var a = n.iceCandidatePoolSize; a > 0; a--) this._iceGatherers.push(new e.RTCIceGatherer({
iceServers: n.iceServers,
gatherPolicy: n.iceTransportPolicy
}));
else n.iceCandidatePoolSize = 0;
this._config = n, this.transceivers = [], this._sdpSessionId = r.generateSessionId(), this._sdpSessionVersion = 0, this._dtlsRole = void 0, this._isClosed = !1
};
Object.defineProperty(h.prototype, "localDescription", {
configurable: !0,
get: function() {
return this._localDescription
}
}), Object.defineProperty(h.prototype, "remoteDescription", {
configurable: !0,
get: function() {
return this._remoteDescription
}
}), h.prototype.onicecandidate = null, h.prototype.onaddstream = null, h.prototype.ontrack = null, h.prototype.onremovestream = null, h.prototype.onsignalingstatechange = null, h.prototype.oniceconnectionstatechange = null, h.prototype.onconnectionstatechange = null, h.prototype.onicegatheringstatechange = null, h.prototype.onnegotiationneeded = null, h.prototype.ondatachannel = null, h.prototype._dispatchEvent = function(e, t) {
this._isClosed || (this.dispatchEvent(t), "function" == typeof this["on" + e] && this["on" + e](t))
}, h.prototype._emitGatheringStateChange = function() {
var e = new Event("icegatheringstatechange");
this._dispatchEvent("icegatheringstatechange", e)
}, h.prototype.getConfiguration = function() {
return this._config
}, h.prototype.getLocalStreams = function() {
return this.localStreams
}, h.prototype.getRemoteStreams = function() {
return this.remoteStreams
}, h.prototype._createTransceiver = function(e, t) {
var n = this.transceivers.length > 0,
r = {
track: null,
iceGatherer: null,
iceTransport: null,
dtlsTransport: null,
localCapabilities: null,
remoteCapabilities: null,
rtpSender: null,
rtpReceiver: null,
kind: e,
mid: null,
sendEncodingParameters: null,
recvEncodingParameters: null,
stream: null,
associatedRemoteMediaStreams: [],
wantReceive: !0
};
if (this.usingBundle && n) r.iceTransport = this.transceivers[0].iceTransport, r.dtlsTransport = this.transceivers[0].dtlsTransport;
else {
var i = this._createIceAndDtlsTransports();
r.iceTransport = i.iceTransport, r.dtlsTransport = i.dtlsTransport
}
return t || this.transceivers.push(r), r
}, h.prototype.addTrack = function(t, n) {
if (this._isClosed) throw c("InvalidStateError", "Attempted to call addTrack on a closed peerconnection.");
var r;
if (this.transceivers.find((function(e) {
return e.track === t
}))) throw c("InvalidAccessError", "Track already exists.");
for (var i = 0; i < this.transceivers.length; i++) this.transceivers[i].track || this.transceivers[i].kind !== t.kind || (r = this.transceivers[i]);
return r || (r = this._createTransceiver(t.kind)), this._maybeFireNegotiationNeeded(), -1 === this.localStreams.indexOf(n) && this.localStreams.push(n), r.track = t, r.stream = n, r.rtpSender = new e.RTCRtpSender(t, r.dtlsTransport), r.rtpSender
}, h.prototype.addStream = function(e) {
var n = this;
if (t >= 15025) e.getTracks().forEach((function(t) {
n.addTrack(t, e)
}));
else {
var r = e.clone();
e.getTracks().forEach((function(e, t) {
var n = r.getTracks()[t];
e.addEventListener("enabled", (function(e) {
n.enabled = e.enabled
}))
})), r.getTracks().forEach((function(e) {
n.addTrack(e, r)
}))
}
}, h.prototype.removeTrack = function(t) {
if (this._isClosed) throw c("InvalidStateError", "Attempted to call removeTrack on a closed peerconnection.");
if (!(t instanceof e.RTCRtpSender)) throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");
var n = this.transceivers.find((function(e) {
return e.rtpSender === t
}));
if (!n) throw c("InvalidAccessError", "Sender was not created by this connection.");
var r = n.stream;
n.rtpSender.stop(), n.rtpSender = null, n.track = null, n.stream = null, -1 === this.transceivers.map((function(e) {
return e.stream
})).indexOf(r) && this.localStreams.indexOf(r) > -1 && this.localStreams.splice(this.localStreams.indexOf(r), 1), this._maybeFireNegotiationNeeded()
}, h.prototype.removeStream = function(e) {
var t = this;
e.getTracks().forEach((function(e) {
var n = t.getSenders().find((function(t) {
return t.track === e
}));
n && t.removeTrack(n)
}))
}, h.prototype.getSenders = function() {
return this.transceivers.filter((function(e) {
return !!e.rtpSender
})).map((function(e) {
return e.rtpSender
}))
}, h.prototype.getReceivers = function() {
return this.transceivers.filter((function(e) {
return !!e.rtpReceiver
})).map((function(e) {
return e.rtpReceiver
}))
}, h.prototype._createIceGatherer = function(t, n) {
var r = this;
if (n && t > 0) return this.transceivers[0].iceGatherer;
if (this._iceGatherers.length) return this._iceGatherers.shift();
var i = new e.RTCIceGatherer({
iceServers: this._config.iceServers,
gatherPolicy: this._config.iceTransportPolicy
});
return Object.defineProperty(i, "state", {
value: "new",
writable: !0
}), this.transceivers[t].bufferedCandidateEvents = [], this.transceivers[t].bufferCandidates = function(e) {
var n = !e.candidate || 0 === Object.keys(e.candidate).length;
i.state = n ? "completed" : "gathering", null !== r.transceivers[t].bufferedCandidateEvents && r.transceivers[t].bufferedCandidateEvents.push(e)
}, i.addEventListener("localcandidate", this.transceivers[t].bufferCandidates), i
}, h.prototype._gather = function(t, n) {
var i = this,
o = this.transceivers[n].iceGatherer;
if (!o.onlocalcandidate) {
var a = this.transceivers[n].bufferedCandidateEvents;
this.transceivers[n].bufferedCandidateEvents = null, o.removeEventListener("localcandidate", this.transceivers[n].bufferCandidates), o.onlocalcandidate = function(e) {
if (!(i.usingBundle && n > 0)) {
var a = new Event("icecandidate");
a.candidate = {
sdpMid: t,
sdpMLineIndex: n
};
var s = e.candidate,
c = !s || 0 === Object.keys(s).length;
if (c) "new" !== o.state && "gathering" !== o.state || (o.state = "completed");
else {
"new" === o.state && (o.state = "gathering"), s.component = 1, s.ufrag = o.getLocalParameters().usernameFragment;
var u = r.writeCandidate(s);
a.candidate = Object.assign(a.candidate, r.parseCandidate(u)), a.candidate.candidate = u, a.candidate.toJSON = function() {
return {
candidate: a.candidate.candidate,
sdpMid: a.candidate.sdpMid,
sdpMLineIndex: a.candidate.sdpMLineIndex,
usernameFragment: a.candidate.usernameFragment
}
}
}
var h = r.getMediaSections(i._localDescription.sdp);
h[a.candidate.sdpMLineIndex] += c ? "a=end-of-candidates\r\n" : "a=" + a.candidate.candidate + "\r\n", i._localDescription.sdp = r.getDescription(i._localDescription.sdp) + h.join("");
var d = i.transceivers.every((function(e) {
return e.iceGatherer && "completed" === e.iceGatherer.state
}));
"gathering" !== i.iceGatheringState && (i.iceGatheringState = "gathering", i._emitGatheringStateChange()), c || i._dispatchEvent("icecandidate", a), d && (i._dispatchEvent("icecandidate", new Event("icecandidate")), i.iceGatheringState = "complete", i._emitGatheringStateChange())
}
}, e.setTimeout((function() {
a.forEach((function(e) {
o.onlocalcandidate(e)
}))
}), 0)
}
}, h.prototype._createIceAndDtlsTransports = function() {
var t = this,
n = new e.RTCIceTransport(null);
n.onicestatechange = function() {
t._updateIceConnectionState(), t._updateConnectionState()
};
var r = new e.RTCDtlsTransport(n);
return r.ondtlsstatechange = function() {
t._updateConnectionState()
}, r.onerror = function() {
Object.defineProperty(r, "state", {
value: "failed",
writable: !0
}), t._updateConnectionState()
}, {
iceTransport: n,
dtlsTransport: r
}
}, h.prototype._disposeIceAndDtlsTransports = function(e) {
var t = this.transceivers[e].iceGatherer;
t && (delete t.onlocalcandidate, delete this.transceivers[e].iceGatherer);
var n = this.transceivers[e].iceTransport;
n && (delete n.onicestatechange, delete this.transceivers[e].iceTransport);
var r = this.transceivers[e].dtlsTransport;
r && (delete r.ondtlsstatechange, delete r.onerror, delete this.transceivers[e].dtlsTransport)
}, h.prototype._transceive = function(e, n, i) {
var a = o(e.localCapabilities, e.remoteCapabilities);
n && e.rtpSender && (a.encodings = e.sendEncodingParameters, a.rtcp = {
cname: r.localCName,
compound: e.rtcpParameters.compound
}, e.recvEncodingParameters.length && (a.rtcp.ssrc = e.recvEncodingParameters[0].ssrc), e.rtpSender.send(a)), i && e.rtpReceiver && a.codecs.length > 0 && ("video" === e.kind && e.recvEncodingParameters && t < 15019 && e.recvEncodingParameters.forEach((function(e) {
delete e.rtx
})), e.recvEncodingParameters.length ? a.encodings = e.recvEncodingParameters : a.encodings = [{}], a.rtcp = {
compound: e.rtcpParameters.compound
}, e.rtcpParameters.cname && (a.rtcp.cname = e.rtcpParameters.cname), e.sendEncodingParameters.length && (a.rtcp.ssrc = e.sendEncodingParameters[0].ssrc), e.rtpReceiver.receive(a))
}, h.prototype.setLocalDescription = function(e) {
var t, n, i = this;
if (-1 === ["offer", "answer"].indexOf(e.type)) return Promise.reject(c("TypeError", 'Unsupported type "' + e.type + '"'));
if (!a("setLocalDescription", e.type, i.signalingState) || i._isClosed) return Promise.reject(c("InvalidStateError", "Can not set local " + e.type + " in state " + i.signalingState));
if ("offer" === e.type) t = r.splitSections(e.sdp), n = t.shift(), t.forEach((function(e, t) {
var n = r.parseRtpParameters(e);
i.transceivers[t].localCapabilities = n
})), i.transceivers.forEach((function(e, t) {
i._gather(e.mid, t)
}));
else if ("answer" === e.type) {
t = r.splitSections(i._remoteDescription.sdp), n = t.shift();
var s = r.matchPrefix(n, "a=ice-lite").length > 0;
t.forEach((function(e, t) {
var a = i.transceivers[t],
c = a.iceGatherer,
u = a.iceTransport,
h = a.dtlsTransport,
d = a.localCapabilities,
l = a.remoteCapabilities;
if (!(r.isRejected(e) && 0 === r.matchPrefix(e, "a=bundle-only").length) && !a.rejected) {
var f = r.getIceParameters(e, n),
p = r.getDtlsParameters(e, n);
s && (p.role = "server"), i.usingBundle && 0 !== t || (i._gather(a.mid, t), "new" === u.state && u.start(c, f, s ? "controlling" : "controlled"), "new" === h.state && h.start(p));
var g = o(d, l);
i._transceive(a, g.codecs.length > 0, !1)
}
}))
}
return i._localDescription = {
type: e.type,
sdp: e.sdp
}, "offer" === e.type ? i._updateSignalingState("have-local-offer") : i._updateSignalingState("stable"), Promise.resolve()
}, h.prototype.setRemoteDescription = function(i) {
var h = this;
if (-1 === ["offer", "answer"].indexOf(i.type)) return Promise.reject(c("TypeError", 'Unsupported type "' + i.type + '"'));
if (!a("setRemoteDescription", i.type, h.signalingState) || h._isClosed) return Promise.reject(c("InvalidStateError", "Can not set remote " + i.type + " in state " + h.signalingState));
var d = {};
h.remoteStreams.forEach((function(e) {
d[e.id] = e
}));
var l = [],
f = r.splitSections(i.sdp),
p = f.shift(),
g = r.matchPrefix(p, "a=ice-lite").length > 0,
v = r.matchPrefix(p, "a=group:BUNDLE ").length > 0;
h.usingBundle = v;
var m = r.matchPrefix(p, "a=ice-options:")[0];
return h.canTrickleIceCandidates = !!m && m.substr(14).split(" ").indexOf("trickle") >= 0, f.forEach((function(a, c) {
var u = r.splitLines(a),
f = r.getKind(a),
m = r.isRejected(a) && 0 === r.matchPrefix(a, "a=bundle-only").length,
y = u[0].substr(2).split(" ")[2],
C = r.getDirection(a, p),
w = r.parseMsid(a),
_ = r.getMid(a) || r.generateIdentifier();
if (m || "application" === f && ("DTLS/SCTP" === y || "UDP/DTLS/SCTP" === y)) h.transceivers[c] = {
mid: _,
kind: f,
protocol: y,
rejected: !0
};
else {
var b, E, T, S, R, x, k, P, A;
!m && h.transceivers[c] && h.transceivers[c].rejected && (h.transceivers[c] = h._createTransceiver(f, !0));
var I, O, M = r.parseRtpParameters(a);
m || (I = r.getIceParameters(a, p), (O = r.getDtlsParameters(a, p)).role = "client"), k = r.parseRtpEncodingParameters(a);
var D = r.parseRtcpParameters(a),
N = r.matchPrefix(a, "a=end-of-candidates", p).length > 0,
L = r.matchPrefix(a, "a=candidate:").map((function(e) {
return r.parseCandidate(e)
})).filter((function(e) {
return 1 === e.component
}));
if (("offer" === i.type || "answer" === i.type) && !m && v && c > 0 && h.transceivers[c] && (h._disposeIceAndDtlsTransports(c), h.transceivers[c].iceGatherer = h.transceivers[0].iceGatherer, h.transceivers[c].iceTransport = h.transceivers[0].iceTransport, h.transceivers[c].dtlsTransport = h.transceivers[0].dtlsTransport, h.transceivers[c].rtpSender && h.transceivers[c].rtpSender.setTransport(h.transceivers[0].dtlsTransport), h.transceivers[c].rtpReceiver && h.transceivers[c].rtpReceiver.setTransport(h.transceivers[0].dtlsTransport)), "offer" !== i.type || m) {
if ("answer" === i.type && !m) {
E = (b = h.transceivers[c]).iceGatherer, T = b.iceTransport, S = b.dtlsTransport, R = b.rtpReceiver, x = b.sendEncodingParameters, P = b.localCapabilities, h.transceivers[c].recvEncodingParameters = k, h.transceivers[c].remoteCapabilities = M, h.transceivers[c].rtcpParameters = D, L.length && "new" === T.state && (!g && !N || v && 0 !== c ? L.forEach((function(e) {
s(b.iceTransport, e)
})) : T.setRemoteCandidates(L)), v && 0 !== c || ("new" === T.state && T.start(E, I, "controlling"), "new" === S.state && S.start(O)), !o(b.localCapabilities, b.remoteCapabilities).codecs.filter((function(e) {
return "rtx" === e.name.toLowerCase()
})).length && b.sendEncodingParameters[0].rtx && delete b.sendEncodingParameters[0].rtx, h._transceive(b, "sendrecv" === C || "recvonly" === C, "sendrecv" === C || "sendonly" === C), !R || "sendrecv" !== C && "sendonly" !== C ? delete b.rtpReceiver : (A = R.track, w ? (d[w.stream] || (d[w.stream] = new e.MediaStream), n(A, d[w.stream]), l.push([A, R, d[w.stream]])) : (d.default || (d.default = new e.MediaStream), n(A, d.default), l.push([A, R, d.default])))
}
} else {
(b = h.transceivers[c] || h._createTransceiver(f)).mid = _, b.iceGatherer || (b.iceGatherer = h._createIceGatherer(c, v)), L.length && "new" === b.iceTransport.state && (!N || v && 0 !== c ? L.forEach((function(e) {
s(b.iceTransport, e)
})) : b.iceTransport.setRemoteCandidates(L)), P = e.RTCRtpReceiver.getCapabilities(f), t < 15019 && (P.codecs = P.codecs.filter((function(e) {
return "rtx" !== e.name
}))), x = b.sendEncodingParameters || [{
ssrc: 1001 * (2 * c + 2)
}];
var j, F = !1;
if ("sendrecv" === C || "sendonly" === C) {
if (F = !b.rtpReceiver, R = b.rtpReceiver || new e.RTCRtpReceiver(b.dtlsTransport, f), F) A = R.track, w && "-" === w.stream || (w ? (d[w.stream] || (d[w.stream] = new e.MediaStream, Object.defineProperty(d[w.stream], "id", {
get: function() {
return w.stream
}
})), Object.defineProperty(A, "id", {
get: function() {
return w.track
}
}), j = d[w.stream]) : (d.default || (d.default = new e.MediaStream), j = d.default)), j && (n(A, j), b.associatedRemoteMediaStreams.push(j)), l.push([A, R, j])
} else b.rtpReceiver && b.rtpReceiver.track && (b.associatedRemoteMediaStreams.forEach((function(t) {
var n = t.getTracks().find((function(e) {
return e.id === b.rtpReceiver.track.id
}));
n && function(t, n) {
n.removeTrack(t), n.dispatchEvent(new e.MediaStreamTrackEvent("removetrack", {
track: t
}))
}(n, t)
})), b.associatedRemoteMediaStreams = []);
b.localCapabilities = P, b.remoteCapabilities = M, b.rtpReceiver = R, b.rtcpParameters = D, b.sendEncodingParameters = x, b.recvEncodingParameters = k, h._transceive(h.transceivers[c], !1, F)
}
}
})), void 0 === h._dtlsRole && (h._dtlsRole = "offer" === i.type ? "active" : "passive"), h._remoteDescription = {
type: i.type,
sdp: i.sdp
}, "offer" === i.type ? h._updateSignalingState("have-remote-offer") : h._updateSignalingState("stable"), Object.keys(d).forEach((function(t) {
var n = d[t];
if (n.getTracks().length) {
if (-1 === h.remoteStreams.indexOf(n)) {
h.remoteStreams.push(n);
var r = new Event("addstream");
r.stream = n, e.setTimeout((function() {
h._dispatchEvent("addstream", r)
}))
}
l.forEach((function(e) {
var t = e[0],
r = e[1];
n.id === e[2].id && u(h, t, r, [n])
}))
}
})), l.forEach((function(e) {
e[2] || u(h, e[0], e[1], [])
})), e.setTimeout((function() {
h && h.transceivers && h.transceivers.forEach((function(e) {
e.iceTransport && "new" === e.iceTransport.state && e.iceTransport.getRemoteCandidates().length > 0 && (console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"), e.iceTransport.addRemoteCandidate({}))
}))
}), 4e3), Promise.resolve()
}, h.prototype.close = function() {
this.transceivers.forEach((function(e) {
e.iceTransport && e.iceTransport.stop(), e.dtlsTransport && e.dtlsTransport.stop(), e.rtpSender && e.rtpSender.stop(), e.rtpReceiver && e.rtpReceiver.stop()
})), this._isClosed = !0, this._updateSignalingState("closed")
}, h.prototype._updateSignalingState = function(e) {
this.signalingState = e;
var t = new Event("signalingstatechange");
this._dispatchEvent("signalingstatechange", t)
}, h.prototype._maybeFireNegotiationNeeded = function() {
var t = this;
"stable" === this.signalingState && !0 !== this.needNegotiation && (this.needNegotiation = !0, e.setTimeout((function() {
if (t.needNegotiation) {
t.needNegotiation = !1;
var e = new Event("negotiationneeded");
t._dispatchEvent("negotiationneeded", e)
}
}), 0))
}, h.prototype._updateIceConnectionState = function() {
var e, t = {
new: 0,
closed: 0,
checking: 0,
connected: 0,
completed: 0,
disconnected: 0,
failed: 0
};
if (this.transceivers.forEach((function(e) {
e.iceTransport && !e.rejected && t[e.iceTransport.state]++
})), e = "new", t.failed > 0 ? e = "failed" : t.checking > 0 ? e = "checking" : t.disconnected > 0 ? e = "disconnected" : t.new > 0 ? e = "new" : t.connected > 0 ? e = "connected" : t.completed > 0 && (e = "completed"), e !== this.iceConnectionState) {
this.iceConnectionState = e;
var n = new Event("iceconnectionstatechange");
this._dispatchEvent("iceconnectionstatechange", n)
}
}, h.prototype._updateConnectionState = function() {
var e, t = {
new: 0,
closed: 0,
connecting: 0,
connected: 0,
completed: 0,
disconnected: 0,
failed: 0
};
if (this.transceivers.forEach((function(e) {
e.iceTransport && e.dtlsTransport && !e.rejected && (t[e.iceTransport.state]++, t[e.dtlsTransport.state]++)
})), t.connected += t.completed, e = "new", t.failed > 0 ? e = "failed" : t.connecting > 0 ? e = "connecting" : t.disconnected > 0 ? e = "disconnected" : t.new > 0 ? e = "new" : t.connected > 0 && (e = "connected"), e !== this.connectionState) {
this.connectionState = e;
var n = new Event("connectionstatechange");
this._dispatchEvent("connectionstatechange", n)
}
}, h.prototype.createOffer = function() {
var n = this;
if (n._isClosed) return Promise.reject(c("InvalidStateError", "Can not call createOffer after close"));
var o = n.transceivers.filter((function(e) {
return "audio" === e.kind
})).length,
a = n.transceivers.filter((function(e) {
return "video" === e.kind
})).length,
s = arguments[0];
if (s) {
if (s.mandatory || s.optional) throw new TypeError("Legacy mandatory/optional constraints not supported.");
void 0 !== s.offerToReceiveAudio && (o = !0 === s.offerToReceiveAudio ? 1 : !1 === s.offerToReceiveAudio ? 0 : s.offerToReceiveAudio), void 0 !== s.offerToReceiveVideo && (a = !0 === s.offerToReceiveVideo ? 1 : !1 === s.offerToReceiveVideo ? 0 : s.offerToReceiveVideo)
}
for (n.transceivers.forEach((function(e) {
"audio" === e.kind ? --o < 0 && (e.wantReceive = !1) : "video" === e.kind && --a < 0 && (e.wantReceive = !1)
})); o > 0 || a > 0;) o > 0 && (n._createTransceiver("audio"), o--), a > 0 && (n._createTransceiver("video"), a--);
var u = r.writeSessionBoilerplate(n._sdpSessionId, n._sdpSessionVersion++);
n.transceivers.forEach((function(i, o) {
var a = i.track,
s = i.kind,
c = i.mid || r.generateIdentifier();
i.mid = c, i.iceGatherer || (i.iceGatherer = n._createIceGatherer(o, n.usingBundle));
var u = e.RTCRtpSender.getCapabilities(s);
t < 15019 && (u.codecs = u.codecs.filter((function(e) {
return "rtx" !== e.name
}))), u.codecs.forEach((function(e) {
"H264" === e.name && void 0 === e.parameters["level-asymmetry-allowed"] && (e.parameters["level-asymmetry-allowed"] = "1"), i.remoteCapabilities && i.remoteCapabilities.codecs && i.remoteCapabilities.codecs.forEach((function(t) {
e.name.toLowerCase() === t.name.toLowerCase() && e.clockRate === t.clockRate && (e.preferredPayloadType = t.payloadType)
}))
})), u.headerExtensions.forEach((function(e) {
(i.remoteCapabilities && i.remoteCapabilities.headerExtensions || []).forEach((function(t) {
e.uri === t.uri && (e.id = t.id)
}))
}));
var h = i.sendEncodingParameters || [{
ssrc: 1001 * (2 * o + 1)
}];
a && t >= 15019 && "video" === s && !h[0].rtx && (h[0].rtx = {
ssrc: h[0].ssrc + 1
}), i.wantReceive && (i.rtpReceiver = new e.RTCRtpReceiver(i.dtlsTransport, s)), i.localCapabilities = u, i.sendEncodingParameters = h
})), "max-compat" !== n._config.bundlePolicy && (u += "a=group:BUNDLE " + n.transceivers.map((function(e) {
return e.mid
})).join(" ") + "\r\n"), u += "a=ice-options:trickle\r\n", n.transceivers.forEach((function(e, t) {
u += i(e, e.localCapabilities, "offer", e.stream, n._dtlsRole), u += "a=rtcp-rsize\r\n", !e.iceGatherer || "new" === n.iceGatheringState || 0 !== t && n.usingBundle || (e.iceGatherer.getLocalCandidates().forEach((function(e) {
e.component = 1, u += "a=" + r.writeCandidate(e) + "\r\n"
})), "completed" === e.iceGatherer.state && (u += "a=end-of-candidates\r\n"))
}));
var h = new e.RTCSessionDescription({
type: "offer",
sdp: u
});
return Promise.resolve(h)
}, h.prototype.createAnswer = function() {
var n = this;
if (n._isClosed) return Promise.reject(c("InvalidStateError", "Can not call createAnswer after close"));
if ("have-remote-offer" !== n.signalingState && "have-local-pranswer" !== n.signalingState) return Promise.reject(c("InvalidStateError", "Can not call createAnswer in signalingState " + n.signalingState));
var a = r.writeSessionBoilerplate(n._sdpSessionId, n._sdpSessionVersion++);
n.usingBundle && (a += "a=group:BUNDLE " + n.transceivers.map((function(e) {
return e.mid
})).join(" ") + "\r\n"), a += "a=ice-options:trickle\r\n";
var s = r.getMediaSections(n._remoteDescription.sdp).length;
n.transceivers.forEach((function(e, r) {
if (!(r + 1 > s)) {
if (e.rejected) return "application" === e.kind ? "DTLS/SCTP" === e.protocol ? a += "m=application 0 DTLS/SCTP 5000\r\n" : a += "m=application 0 " + e.protocol + " webrtc-datachannel\r\n" : "audio" === e.kind ? a += "m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n" : "video" === e.kind && (a += "m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"), void(a += "c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:" + e.mid + "\r\n");
var c;
if (e.stream) "audio" === e.kind ? c = e.stream.getAudioTracks()[0] : "video" === e.kind && (c = e.stream.getVideoTracks()[0]), c && t >= 15019 && "video" === e.kind && !e.sendEncodingParameters[0].rtx && (e.sendEncodingParameters[0].rtx = {
ssrc: e.sendEncodingParameters[0].ssrc + 1
});
var u = o(e.localCapabilities, e.remoteCapabilities);
!u.codecs.filter((function(e) {
return "rtx" === e.name.toLowerCase()
})).length && e.sendEncodingParameters[0].rtx && delete e.sendEncodingParameters[0].rtx, a += i(e, u, "answer", e.stream, n._dtlsRole), e.rtcpParameters && e.rtcpParameters.reducedSize && (a += "a=rtcp-rsize\r\n")
}
}));
var u = new e.RTCSessionDescription({
type: "answer",
sdp: a
});
return Promise.resolve(u)
}, h.prototype.addIceCandidate = function(e) {
var t, n = this;
return e && void 0 === e.sdpMLineIndex && !e.sdpMid ? Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")) : new Promise((function(i, o) {
if (!n._remoteDescription) return o(c("InvalidStateError", "Can not add ICE candidate without a remote description"));
if (e && "" !== e.candidate) {
var a = e.sdpMLineIndex;
if (e.sdpMid)
for (var u = 0; u < n.transceivers.length; u++)
if (n.transceivers[u].mid === e.sdpMid) {
a = u;
break
} var h = n.transceivers[a];
if (!h) return o(c("OperationError", "Can not add ICE candidate"));
if (h.rejected) return i();
var d = Object.keys(e.candidate).length > 0 ? r.parseCandidate(e.candidate) : {};
if ("tcp" === d.protocol && (0 === d.port || 9 === d.port)) return i();
if (d.component && 1 !== d.component) return i();
if ((0 === a || a > 0 && h.iceTransport !== n.transceivers[0].iceTransport) && !s(h.iceTransport, d)) return o(c("OperationError", "Can not add ICE candidate"));
var l = e.candidate.trim();
0 === l.indexOf("a=") && (l = l.substr(2)), (t = r.getMediaSections(n._remoteDescription.sdp))[a] += "a=" + (d.type ? l : "end-of-candidates") + "\r\n", n._remoteDescription.sdp = r.getDescription(n._remoteDescription.sdp) + t.join("")
} else
for (var f = 0; f < n.transceivers.length && (n.transceivers[f].rejected || (n.transceivers[f].iceTransport.addRemoteCandidate({}), (t = r.getMediaSections(n._remoteDescription.sdp))[f] += "a=end-of-candidates\r\n", n._remoteDescription.sdp = r.getDescription(n._remoteDescription.sdp) + t.join(""), !n.usingBundle)); f++);
i()
}))
}, h.prototype.getStats = function(t) {
if (t && t instanceof e.MediaStreamTrack) {
var n = null;
if (this.transceivers.forEach((function(e) {
e.rtpSender && e.rtpSender.track === t ? n = e.rtpSender : e.rtpReceiver && e.rtpReceiver.track === t && (n = e.rtpReceiver)
})), !n) throw c("InvalidAccessError", "Invalid selector.");
return n.getStats()
}
var r = [];
return this.transceivers.forEach((function(e) {
["rtpSender", "rtpReceiver", "iceGatherer", "iceTransport", "dtlsTransport"].forEach((function(t) {
e[t] && r.push(e[t].getStats())
}))
})), Promise.all(r).then((function(e) {
var t = new Map;
return e.forEach((function(e) {
e.forEach((function(e) {
t.set(e.id, e)
}))
})), t
}))
};
["RTCRtpSender", "RTCRtpReceiver", "RTCIceGatherer", "RTCIceTransport", "RTCDtlsTransport"].forEach((function(t) {
var n = e[t];
if (n && n.prototype && n.prototype.getStats) {
var r = n.prototype.getStats;
n.prototype.getStats = function() {
return r.apply(this).then((function(e) {
var t = new Map;
return Object.keys(e).forEach((function(n) {
var r;
e[n].type = {
inboundrtp: "inbound-rtp",
outboundrtp: "outbound-rtp",
candidatepair: "candidate-pair",
localcandidate: "local-candidate",
remotecandidate: "remote-candidate"
} [(r = e[n]).type] || r.type, t.set(n, e[n])
})), t
}))
}
}
}));
var d = ["createOffer", "createAnswer"];
return d.forEach((function(e) {
var t = h.prototype[e];
h.prototype[e] = function() {
var e = arguments;
return "function" == typeof e[0] || "function" == typeof e[1] ? t.apply(this, [arguments[2]]).then((function(t) {
"function" == typeof e[0] && e[0].apply(null, [t])
}), (function(t) {
"function" == typeof e[1] && e[1].apply(null, [t])
})) : t.apply(this, arguments)
}
})), (d = ["setLocalDescription", "setRemoteDescription", "addIceCandidate"]).forEach((function(e) {
var t = h.prototype[e];
h.prototype[e] = function() {
var e = arguments;
return "function" == typeof e[1] || "function" == typeof e[2] ? t.apply(this, arguments).then((function() {
"function" == typeof e[1] && e[1].apply(null)
}), (function(t) {
"function" == typeof e[2] && e[2].apply(null, [t])
})) : t.apply(this, arguments)
}
})), ["getStats"].forEach((function(e) {
var t = h.prototype[e];
h.prototype[e] = function() {
var e = arguments;
return "function" == typeof e[1] ? t.apply(this, arguments).then((function() {
"function" == typeof e[1] && e[1].apply(null)
})) : t.apply(this, arguments)
}
})), h
}
}, function(e, t, n) {
"use strict";
var r = n(138),
i = n(140);

function o() {
this.protocol = null, this.slashes = null, this.auth = null, this.host = null, this.port = null, this.hostname = null, this.hash = null, this.search = null, this.query = null, this.pathname = null, this.path = null, this.href = null
}
t.parse = C, t.resolve = function(e, t) {
return C(e, !1, !0).resolve(t)
}, t.resolveObject = function(e, t) {
return e ? C(e, !1, !0).resolveObject(t) : t
}, t.format = function(e) {
i.isString(e) && (e = C(e));
return e instanceof o ? e.format() : o.prototype.format.call(e)
}, t.Url = o;
var a = /^([a-z0-9.+-]+:)/i,
s = /:[0-9]*$/,
c = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
u = ["{", "}", "|", "\\", "^", "`"].concat(["<", ">", '"', "`", " ", "\r", "\n", "\t"]),
h = ["'"].concat(u),
d = ["%", "/", "?", ";", "#"].concat(h),
l = ["/", "?", "#"],
f = /^[+a-z0-9A-Z_-]{0,63}$/,
p = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
g = {
javascript: !0,
"javascript:": !0
},
v = {
javascript: !0,
"javascript:": !0
},
m = {
http: !0,
https: !0,
ftp: !0,
gopher: !0,
file: !0,
"http:": !0,
"https:": !0,
"ftp:": !0,
"gopher:": !0,
"file:": !0
},
y = n(127);

function C(e, t, n) {
if (e && i.isObject(e) && e instanceof o) return e;
var r = new o;
return r.parse(e, t, n), r
}
o.prototype.parse = function(e, t, n) {
if (!i.isString(e)) throw new TypeError("Parameter 'url' must be a string, not " + typeof e);
var o = e.indexOf("?"),
s = -1 !== o && o < e.indexOf("#") ? "?" : "#",
u = e.split(s);
u[0] = u[0].replace(/\\/g, "/");
var C = e = u.join(s);
if (C = C.trim(), !n && 1 === e.split("#").length) {
var w = c.exec(C);
if (w) return this.path = C, this.href = C, this.pathname = w[1], w[2] ? (this.search = w[2], this.query = t ? y.parse(this.search.substr(1)) : this.search.substr(1)) : t && (this.search = "", this.query = {}), this
}
var _ = a.exec(C);
if (_) {
var b = (_ = _[0]).toLowerCase();
this.protocol = b, C = C.substr(_.length)
}
if (n || _ || C.match(/^\/\/[^@\/]+@[^@\/]+/)) {
var E = "//" === C.substr(0, 2);
!E || _ && v[_] || (C = C.substr(2), this.slashes = !0)
}
if (!v[_] && (E || _ && !m[_])) {
for (var T, S, R = -1, x = 0; x < l.length; x++) {
-1 !== (k = C.indexOf(l[x])) && (-1 === R || k < R) && (R = k)
} - 1 !== (S = -1 === R ? C.lastIndexOf("@") : C.lastIndexOf("@", R)) && (T = C.slice(0, S), C = C.slice(S + 1), this.auth = decodeURIComponent(T)), R = -1;
for (x = 0; x < d.length; x++) {
var k; - 1 !== (k = C.indexOf(d[x])) && (-1 === R || k < R) && (R = k)
} - 1 === R && (R = C.length), this.host = C.slice(0, R), C = C.slice(R), this.parseHost(), this.hostname = this.hostname || "";
var P = "[" === this.hostname[0] && "]" === this.hostname[this.hostname.length - 1];
if (!P)
for (var A = this.hostname.split(/\./), I = (x = 0, A.length); x < I; x++) {
var O = A[x];
if (O && !O.match(f)) {
for (var M = "", D = 0, N = O.length; D < N; D++) O.charCodeAt(D) > 127 ? M += "x" : M += O[D];
if (!M.match(f)) {
var L = A.slice(0, x),
j = A.slice(x + 1),
F = O.match(p);
F && (L.push(F[1]), j.unshift(F[2])), j.length && (C = "/" + j.join(".") + C), this.hostname = L.join(".");
break
}
}
}
this.hostname.length > 255 ? this.hostname = "" : this.hostname = this.hostname.toLowerCase(), P || (this.hostname = r.toASCII(this.hostname));
var V = this.port ? ":" + this.port : "",
B = this.hostname || "";
this.host = B + V, this.href += this.host, P && (this.hostname = this.hostname.substr(1, this.hostname.length - 2), "/" !== C[0] && (C = "/" + C))
}
if (!g[b])
for (x = 0, I = h.length; x < I; x++) {
var U = h[x];
if (-1 !== C.indexOf(U)) {
var W = encodeURIComponent(U);
W === U && (W = escape(U)), C = C.split(U).join(W)
}
}
var q = C.indexOf("#"); - 1 !== q && (this.hash = C.substr(q), C = C.slice(0, q));
var H = C.indexOf("?");
if (-1 !== H ? (this.search = C.substr(H), this.query = C.substr(H + 1), t && (this.query = y.parse(this.query)), C = C.slice(0, H)) : t && (this.search = "", this.query = {}), C && (this.pathname = C), m[b] && this.hostname && !this.pathname && (this.pathname = "/"), this.pathname || this.search) {
V = this.pathname || "";
var z = this.search || "";
this.path = V + z
}
return this.href = this.format(), this
}, o.prototype.format = function() {
var e = this.auth || "";
e && (e = (e = encodeURIComponent(e)).replace(/%3A/i, ":"), e += "@");
var t = this.protocol || "",
n = this.pathname || "",
r = this.hash || "",
o = !1,
a = "";
this.host ? o = e + this.host : this.hostname && (o = e + (-1 === this.hostname.indexOf(":") ? this.hostname : "[" + this.hostname + "]"), this.port && (o += ":" + this.port)), this.query && i.isObject(this.query) && Object.keys(this.query).length && (a = y.stringify(this.query));
var s = this.search || a && "?" + a || "";
return t && ":" !== t.substr(-1) && (t += ":"), this.slashes || (!t || m[t]) && !1 !== o ? (o = "//" + (o || ""), n && "/" !== n.charAt(0) && (n = "/" + n)) : o || (o = ""), r && "#" !== r.charAt(0) && (r = "#" + r), s && "?" !== s.charAt(0) && (s = "?" + s), t + o + (n = n.replace(/[?#]/g, (function(e) {
return encodeURIComponent(e)
}))) + (s = s.replace("#", "%23")) + r
}, o.prototype.resolve = function(e) {
return this.resolveObject(C(e, !1, !0)).format()
}, o.prototype.resolveObject = function(e) {
if (i.isString(e)) {
var t = new o;
t.parse(e, !1, !0), e = t
}
for (var n = new o, r = Object.keys(this), a = 0; a < r.length; a++) {
var s = r[a];
n[s] = this[s]
}
if (n.hash = e.hash, "" === e.href) return n.href = n.format(), n;
if (e.slashes && !e.protocol) {
for (var c = Object.keys(e), u = 0; u < c.length; u++) {
var h = c[u];
"protocol" !== h && (n[h] = e[h])
}
return m[n.protocol] && n.hostname && !n.pathname && (n.path = n.pathname = "/"), n.href = n.format(), n
}
if (e.protocol && e.protocol !== n.protocol) {
if (!m[e.protocol]) {
for (var d = Object.keys(e), l = 0; l < d.length; l++) {
var f = d[l];
n[f] = e[f]
}
return n.href = n.format(), n
}
if (n.protocol = e.protocol, e.host || v[e.protocol]) n.pathname = e.pathname;
else {
for (var p = (e.pathname || "").split("/"); p.length && !(e.host = p.shift()););
e.host || (e.host = ""), e.hostname || (e.hostname = ""), "" !== p[0] && p.unshift(""), p.length < 2 && p.unshift(""), n.pathname = p.join("/")
}
if (n.search = e.search, n.query = e.query, n.host = e.host || "", n.auth = e.auth, n.hostname = e.hostname || e.host, n.port = e.port, n.pathname || n.search) {
var g = n.pathname || "",
y = n.search || "";
n.path = g + y
}
return n.slashes = n.slashes || e.slashes, n.href = n.format(), n
}
var C = n.pathname && "/" === n.pathname.charAt(0),
w = e.host || e.pathname && "/" === e.pathname.charAt(0),
_ = w || C || n.host && e.pathname,
b = _,
E = n.pathname && n.pathname.split("/") || [],
T = (p = e.pathname && e.pathname.split("/") || [], n.protocol && !m[n.protocol]);
if (T && (n.hostname = "", n.port = null, n.host && ("" === E[0] ? E[0] = n.host : E.unshift(n.host)), n.host = "", e.protocol && (e.hostname = null, e.port = null, e.host && ("" === p[0] ? p[0] = e.host : p.unshift(e.host)), e.host = null), _ = _ && ("" === p[0] || "" === E[0])), w) n.host = e.host || "" === e.host ? e.host : n.host, n.hostname = e.hostname || "" === e.hostname ? e.hostname : n.hostname, n.search = e.search, n.query = e.query, E = p;
else if (p.length) E || (E = []), E.pop(), E = E.concat(p), n.search = e.search, n.query = e.query;
else if (!i.isNullOrUndefined(e.search)) {
if (T) n.hostname = n.host = E.shift(), (P = !!(n.host && n.host.indexOf("@") > 0) && n.host.split("@")) && (n.auth = P.shift(), n.host = n.hostname = P.shift());
return n.search = e.search, n.query = e.query, i.isNull(n.pathname) && i.isNull(n.search) || (n.path = (n.pathname ? n.pathname : "") + (n.search ? n.search : "")), n.href = n.format(), n
}
if (!E.length) return n.pathname = null, n.search ? n.path = "/" + n.search : n.path = null, n.href = n.format(), n;
for (var S = E.slice(-1)[0], R = (n.host || e.host || E.length > 1) && ("." === S || ".." === S) || "" === S, x = 0, k = E.length; k >= 0; k--) "." === (S = E[k]) ? E.splice(k, 1) : ".." === S ? (E.splice(k, 1), x++) : x && (E.splice(k, 1), x--);
if (!_ && !b)
for (; x--; x) E.unshift("..");
!_ || "" === E[0] || E[0] && "/" === E[0].charAt(0) || E.unshift(""), R && "/" !== E.join("/").substr(-1) && E.push("");
var P, A = "" === E[0] || E[0] && "/" === E[0].charAt(0);
T && (n.hostname = n.host = A ? "" : E.length ? E.shift() : "", (P = !!(n.host && n.host.indexOf("@") > 0) && n.host.split("@")) && (n.auth = P.shift(), n.host = n.hostname = P.shift()));
return (_ = _ || n.host && E.length) && !A && E.unshift(""), E.length ? n.pathname = E.join("/") : (n.pathname = null, n.path = null), i.isNull(n.pathname) && i.isNull(n.search) || (n.path = (n.pathname ? n.pathname : "") + (n.search ? n.search : "")), n.auth = e.auth || n.auth, n.slashes = n.slashes || e.slashes, n.href = n.format(), n
}, o.prototype.parseHost = function() {
var e = this.host,
t = s.exec(e);
t && (":" !== (t = t[0]) && (this.port = t.substr(1)), e = e.substr(0, e.length - t.length)), e && (this.hostname = e)
}
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.WebRTCMediaEngine = void 0;
const r = n(49),
i = n(2),
o = n(11),
a = n(141),
s = n(134),
c = n(143),
u = o.getLogger("vvc-media"),
h = {
av: "WebRTC",
screen: "WebRTC.Screen",
data: "WebRTC.Data"
};
class d extends o.MediaEngine {
constructor() {
super(), this.id = "WebRTC", this.managers = {}, this.audioEnabled = !0, this.videoEnabled = !0
}
static probe() {
return d && d.browser && "https:" === location.protocol
}
release() {}
async attach(e) {
if (d.probe()) {
this.contact = e, d.caps || (d.caps = s.detectCaps(d.browser));
const t = await d.caps,
n = await e.getLocalCapabilities(d.browser);
return r.merge(n, t), this.contact.on("WebRTC", (e, t) => {
vivocha.nodeify(this.managerInitRequest("av", e).then((function() {
return null
})), t)
}), this.contact.on("WebRTC.Screen", (e, t) => {
vivocha.nodeify(this.managerInitRequest("screen", e).then((function() {
return null
})), t)
}), this.contact.on("WebRTC.Data", (e, t) => {
vivocha.nodeify(this.managerInitRequest("data", e).then((function() {
return null
})), t)
}), n
}
throw u.log("Browser is not WebRTC compatible"), new Error("incompatible_name")
}
async managerInitRequest(e, t) {
if (t && t.id) {
if (this.managers[e]) {
let n = await this.managers[e];
n.id !== t.id && (await n.release(), n = await this.createManager(e, t));
const r = await this.contact.getMedia();
let i, o = {};
for (let t in r) i = r[t], o[t] = i, "WebRTC" === i.engine && ("av" === e && ("Voice" === t || "Video" === t) || "screen" === e && "Screen" === t) && (delete r[t], delete i.data);
return this.transit(r, o, !0).promise.then(e => (n.signalling.emit("mediastate", "idle"), e))
}
return this.createManager(e, t)
}
throw u.error("Bad WebRTC request", t), "invalid_request"
}
createController(e, t) {
return new a.DefaultWebRTCController(e, this.contact, t)
}
managerFactory(e) {
return new c.WebRTCManager(e)
}
createManager(e, t) {
return u.log("WebRTCMediaEngine.createManager", e, t), new Promise((n, r) => {
const i = this.createController(h[e], t),
o = this.managerFactory(i);
o.once("ready", () => {
u.log('"'.concat(e, '" manager ready')), this.initManager(e, o), n(o), this.contact.emit("webrtc.".concat(e), o)
}), o.once("error", e => {
u.error("WebRTC creation error", e), r(e)
}), this.managers[e] = o
})
}
initManager(e, t) {
switch (t.removeAllListeners("trackadded"), t.removeAllListeners("trackended"), t.removeAllListeners("disconnect"), e) {
case "av":
t.on("trackadded", async (e, t) => {
u.log("trackadded", t ? "local" : "remote", e.kind, e.id);
const n = "video" === e.kind ? "Video" : "Voice",
r = t ? "tx" : "rx";
try {
const t = await this.contact.getMedia();
o.dot(t, "".concat(n, ".").concat(r), !0), o.dot(t, "".concat(n, ".data.").concat(r, "_stream.id"), e.id), this.contact.emit("MediaChange", t)
} catch (e) {
u.error("trackadded", "getMedia", e)
}
}), t.on("trackended", async (e, t) => {
u.log("trackended", t ? "local" : "remote", e.kind, e.id);
const n = "video" === e.kind ? "Video" : "Voice",
r = t ? "tx" : "rx";
try {
const e = await this.contact.getMedia();
o.dot(e, "".concat(n, ".").concat(r), !1), delete(o.dot(e, "".concat(n, ".data")) || {})["".concat(r, "_stream")], this.contact.emit("MediaChange", e)
} catch (e) {
u.error("trackended", "getMedia", e)
}
}), t.on("disconnect", async e => {
const n = await this.contact.getMedia();
let r = {};
for (let e in n) {
const t = n[e];
r[e] = t, "WebRTC" !== t.engine || "Voice" !== e && "Video" !== e || (delete n[e], delete t.data)
}
const i = await this.transit(n, r, e).promise;
return t.signalling.emit("mediastate", "idle"), i
});
break;
case "screen":
t.on("trackadded", async (e, t) => {
if ("video" === e.kind) {
u.log("trackadded", t ? "local" : "remote", e.kind, e.id);
const n = t ? "tx" : "rx";
try {
const t = await this.contact.getMedia();
o.dot(t, "Screen.".concat(n), !0), o.dot(t, "Screen.data.".concat(n, "_stream.id"), e.id), this.contact.emit("MediaChange", t)
} catch (e) {
u.error("trackadded", "getMedia", e)
}
}
}), t.on("trackended", async (e, t) => {
if ("video" === e.kind) {
u.log("trackended", t ? "local" : "remote", e.kind, e.id);
const n = t ? "tx" : "rx";
try {
const e = await this.contact.getMedia();
o.dot(e, "Screen.".concat(n), !1), delete(o.dot(e, "Screen.data") || {})["".concat(n, "_stream")], this.contact.emit("MediaChange", e)
} catch (e) {
u.error("trackended", "getMedia", e)
}
}
});
const e = 5e3;
let n;
t.on("trackmute", async (t, r) => {
"video" !== t.kind || r || (n && (clearTimeout(n), n = void 0), n = setTimeout(async () => {
u.warn("trackmute timeout"), u.log("trackmute", r ? "local" : "remote", t.kind, t.id);
const e = r ? "tx" : "rx";
try {
const t = await this.contact.getMedia();
o.dot(t, "Screen.".concat(e), !1), delete(o.dot(t, "Screen.data") || {})["".concat(e, "_stream")], this.contact.emit("MediaChange", t)
} catch (e) {
u.error("trackmute", "getMedia", e)
}
}, e))
}), t.on("trackunmute", async (e, t) => {
"video" === e.kind && !t && n && (clearTimeout(n), n = void 0)
});
break;
case "data":
t.on("datachannel", e => {
this.contact.dataChannels[e.id] = e, this.contact.emit("datachannel", e), e.on("close", () => {
this.contact.emit("datachannel.closed", e.id)
}), e.on("data", t => {
this.contact.emit("data." + e.id, t)
})
})
}
}
async getManager(e, t) {
let n;
return n = this.managers[e] ? this.managers[e] : t ? await this.createManager(e) : await new Promise(t => {
this.contact.once("webrtc." + e, e => {
t(e)
})
}), -1 === n.eventNames().indexOf("trackadded") && this.initManager(e, n), n
}
destroyManager(e) {
this.managers[e] && (this.managers[e].reset(), delete this.managers[e])
}
transit(e, t, n) {
return u.log("WebRTCMediaEngine.transit", e, t, n), {
deferred: !0,
promise: new Promise(async (r, i) => {
const a = [];
let s;
const c = !n;
e || (e = {}), t || (t = {}), o.dot(t, "Sharing.tx") && o.dot(t, "Sharing.rx") || (u.log("WebRTCMediaEngine.transit", "no sharing media, turning off all webrtc"), delete t.Voice, delete t.Video, delete t.Screen);
const h = await this.contact.getLocalCapabilities(),
d = o.dot(t, "Voice.rx"),
l = o.dot(t, "Video.rx"),
f = o.dot(e, "Voice.rx"),
p = o.dot(e, "Video.rx");
d === f && l === p || (o.dot(e, "Voice.rx", !!d), o.dot(e, "Video.rx", !!l), d || (o.dot(e, "Voice.data.rx_stream", null), delete e.Voice.data.rx_stream), l || (o.dot(e, "Video.data.rx_stream", null), delete e.Video.data.rx_stream), o.dot(e, "Voice.engine", "WebRTC"), o.dot(e, "Video.engine", "WebRTC"), this.contact.emit("MediaChange", e));
const g = o.dot(t, "Voice.tx"),
v = o.dot(t, "Video.tx"),
m = o.dot(e, "Voice.tx"),
y = o.dot(e, "Video.tx"),
C = !d != !f || !l != !p,
w = !g != !m || !v != !y,
_ = g || v,
b = d || l,
E = g && !m || v && !y,
T = !g && m || !v && y;
try {
if (_ || b)
if (w)
if (s = await this.getManager("av", !c), s.startTransition(n), _)
if (E) {
let n = {};
!m && g && (n.audio = o.dot(t, "Voice.data.tx_stream.constraints") || o.dot(h, "WebRTC.AudioConstraints") || !0, o.dot(e, "Voice.tx", !0), o.dot(e, "Voice.via", "net"), o.dot(e, "Voice.engine", "WebRTC")), !y && v && (n.video = o.dot(t, "Video.data.tx_stream.constraints") || o.dot(h, "WebRTC.VideoConstraints") || !0, o.dot(e, "Video.tx", !0), o.dot(e, "Video.via", "net"), o.dot(e, "Video.engine", "WebRTC")), a.push(async () => {
u.error("Vivocha.transitWebRTC", "getUserMedia failed"), !m && g && (o.dot(e, "Voice.tx", !1), delete(o.dot(e, "Voice.data") || {}).tx_stream), !y && v && (o.dot(e, "Video.tx", !1), delete(o.dot(e, "Video.data") || {}).tx_stream), this.contact.emit("MediaChange", e)
});
const r = await s.getUserMedia(n);
await s.addLocalStream(r), s.setLocalMediaState(!0, !1, this.audioEnabled), s.setLocalMediaState(!1, !0, this.videoEnabled), !m && g && o.dot(e, "Voice.data.tx_stream", {
id: r.getAudioTracks()[0].id
}), !y && v && o.dot(e, "Video.data.tx_stream", {
id: r.getVideoTracks()[0].id
}), this.contact.emit("MediaChange", e)
} else T && (m && !g ? (s.removeLocalTrack(o.dot(e, "Voice.data.tx_stream.id")), o.dot(e, "Voice.tx", !1), delete(o.dot(e, "Voice.data") || {}).tx_stream) : y && !v && (s.removeLocalTrack(o.dot(e, "Video.data.tx_stream.id")), o.dot(e, "Video.tx", !1), delete(o.dot(e, "Video.data") || {}).tx_stream));
else m && s.removeLocalTrack(o.dot(e, "Voice.data.tx_stream.id")), y && s.removeLocalTrack(o.dot(e, "Video.data.tx_stream.id")), o.dot(e, "Video.tx", !1), o.dot(e, "Voice.tx", !1), delete(o.dot(e, "Voice.data") || {}).tx_stream, delete(o.dot(e, "Video.data") || {}).tx_stream, b || this.destroyManager("av"), this.contact.emit("MediaChange", e);
else C && c && (s = await this.getManager("av", !1), s.renegotiate());
else o.dot(e, "Voice.tx", !1), o.dot(e, "Voice.rx", !1), o.dot(e, "Video.tx", !1), o.dot(e, "Video.rx", !1), delete(o.dot(e, "Voice.data") || {}).tx_stream, delete(o.dot(e, "Video.data") || {}).tx_stream, this.destroyManager("av");
const i = o.dot(t, "Screen.rx") || !1,
d = o.dot(e, "Screen.rx") || !1;
i !== d && (o.dot(e, "Screen.rx", !!o.dot(t, "Screen.rx")), i || (o.dot(e, "Screen.data.rx_stream", null), delete e.Screen.data.rx_stream), o.dot(e, "Screen.engine", "WebRTC"), this.contact.emit("MediaChange", e));
const l = o.dot(t, "Screen.tx") || !1,
f = o.dot(e, "Screen.tx") || !1;
if (l || i)
if (l !== f)
if (s = await this.getManager("screen", c || !i), s.startTransition(n), l) {
let n, r = {
audio: !1,
video: o.dot(t, "Screen.data.tx_stream.constraints") || o.dot(h, "WebRTC.ScreenConstraints")
};
o.dot(e, "Screen.tx", !0), o.dot(e, "Screen.via", "net"), o.dot(e, "Screen.engine", "WebRTC"), a.push(async () => {
u.error("Vivocha.transitWebRTC", "getDisplayMedia failed"), o.dot(e, "Screen.tx", !1), delete(o.dot(e, "Screen.data") || {}).tx_stream, this.contact.emit("MediaChange", e)
});
try {
n = await s.getDisplayMedia(r)
} catch (e) {
if (!e || "InvalidStateError" !== e.name || !this.contact.listeners("MediaChange.Screen.UserInitiatedActionNeeded").length) throw e;
await new Promise((e, t) => {
const n = setTimeout(() => t(new Error("UserInitiatedActionTimeout")), 3e4);
this.contact.emit("MediaChange.Screen.UserInitiatedActionNeeded", () => {
clearTimeout(n), e()
})
}), n = await s.getDisplayMedia(r)
}
await s.addLocalStream(n), o.dot(e, "Screen.data.tx_stream", {
id: n.getVideoTracks()[0].id
}), this.contact.emit("MediaChange", e)
} else {
let t;
o.dot(e, "Screen.tx") && (t = o.dot(e, "Screen.data.tx_stream.id")) && s.removeLocalTrack(t), o.dot(e, "Screen.tx", !1), delete(o.dot(e, "Screen.data") || {}).tx_stream, this.contact.emit("MediaChange", e)
}
else i !== d && (s = await this.getManager("screen", !0), s.startTransition(n));
else o.dot(e, "Screen.tx", !1), o.dot(e, "Screen.rx", !1), delete(o.dot(e, "Screen.data") || {}).tx_stream, this.destroyManager("screen");
r(e)
} catch (e) {
if (u.error("WebRTCMediaEngine.transit", "failed", e), a.length) {
u.warn("WebRTCMediaEngine.transit", "rolling back");
for (const e of a) await e()
}
i(e)
}
})
}
}
restore(e, t) {
return {
deferred: !0,
promise: (async () => {
(o.dot(t, "Voice.tx") || o.dot(t, "Video.tx")) && await this.getManager("av", !0), o.dot(t, "Screen.tx") && await this.getManager("screen", !0);
const n = await this.transit(e, t, !1);
return u.log("restore completed"), n.promise
})()
}
}
createDataChannel(e) {
return this.getManager("data", !0).then((function(t) {
return t.createDataChannel(e)
}))
}
getLocalMediaState() {
return this.getManager("av", !0).then((function(e) {
return e.getLocalMediaState()
}))
}
setLocalMediaState(e, t, n, r = !1) {
let i = void 0 === r;
return t && (this.audioEnabled = i ? !this.audioEnabled : !!r), n && (this.videoEnabled = i ? !this.videoEnabled : !!r), this.getManager("av", !0).then((function(e) {
e.setLocalMediaState(t, n, r)
}))
}
toggleLocalMedia(e) {
return this.setLocalMediaState(e, !0, !0)
}
toggleLocalAudio(e) {
return this.setLocalMediaState(e, !0, !1)
}
muteLocalAudio(e) {
return this.setLocalMediaState(e, !0, !1, !1)
}
unmuteLocalAudio(e) {
return this.setLocalMediaState(e, !0, !1, !0)
}
toggleLocalVideo(e) {
return this.setLocalMediaState(e, !1, !0)
}
pauseLocalVideo(e) {
return this.setLocalMediaState(e, !1, !0, !1)
}
unpauseLocalVideo(e) {
return this.setLocalMediaState(e, !1, !0, !0)
}
async getMediaStream(e, t) {
const n = await this.contact.getMedia();
let r, i;
if ("screen" === e ? (r = [o.dot(n, "Screen.data.".concat(t, "_stream.id"))], i = await this.getManager("screen", !1)) : (r = [o.dot(n, "Voice.data.".concat(t, "_stream.id"))], "video" === e && r.push(o.dot(n, "Video.data.".concat(t, "_stream.id"))), i = await this.getManager("av", !1)), r = r.filter(e => !!e), !r.length) throw new Error("no_stream_id");
const a = new MediaStream;
return r.map(e => "tx" === t ? i.getLocalTrack(e) : i.getRemoteTrack(e)).filter(e => !!e).forEach(e => a.addTrack(e)), a
}
async switchToNextCamera() {
const e = await this.contact.getMedia(),
t = await this.getManager("av", !1);
if (t) {
const n = await t.switchToNextCamera();
return o.dot(e, "Video.data.tx_stream", {
id: n.id
}), this.contact.emit("MediaChange", e), n
}
throw new Error("no_manager")
}
}
t.WebRTCMediaEngine = d, d.browser = i.detectBrowser(window)
}, function(e, t, n) {
(function(e, r) {
var i;
! function(o) {
t && t.nodeType, e && e.nodeType;
var a = "object" == typeof r && r;
a.global !== a && a.window !== a && a.self;
var s, c = 2147483647,
u = /^xn--/,
h = /[^\x20-\x7E]/,
d = /[\x2E\u3002\uFF0E\uFF61]/g,
l = {
overflow: "Overflow: input needs wider integers to process",
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
"invalid-input": "Invalid input"
},
f = Math.floor,
p = String.fromCharCode;

function g(e) {
throw new RangeError(l[e])
}

function v(e, t) {
for (var n = e.length, r = []; n--;) r[n] = t(e[n]);
return r
}

function m(e, t) {
var n = e.split("@"),
r = "";
return n.length > 1 && (r = n[0] + "@", e = n[1]), r + v((e = e.replace(d, ".")).split("."), t).join(".")
}

function y(e) {
for (var t, n, r = [], i = 0, o = e.length; i < o;)(t = e.charCodeAt(i++)) >= 55296 && t <= 56319 && i < o ? 56320 == (64512 & (n = e.charCodeAt(i++))) ? r.push(((1023 & t) << 10) + (1023 & n) + 65536) : (r.push(t), i--) : r.push(t);
return r
}

function C(e) {
return v(e, (function(e) {
var t = "";
return e > 65535 && (t += p((e -= 65536) >>> 10 & 1023 | 55296), e = 56320 | 1023 & e), t += p(e)
})).join("")
}

function w(e, t) {
return e + 22 + 75 * (e < 26) - ((0 != t) << 5)
}

function _(e, t, n) {
var r = 0;
for (e = n ? f(e / 700) : e >> 1, e += f(e / t); e > 455; r += 36) e = f(e / 35);
return f(r + 36 * e / (e + 38))
}

function b(e) {
var t, n, r, i, o, a, s, u, h, d, l, p = [],
v = e.length,
m = 0,
y = 128,
w = 72;
for ((n = e.lastIndexOf("-")) < 0 && (n = 0), r = 0; r < n; ++r) e.charCodeAt(r) >= 128 && g("not-basic"), p.push(e.charCodeAt(r));
for (i = n > 0 ? n + 1 : 0; i < v;) {
for (o = m, a = 1, s = 36; i >= v && g("invalid-input"), ((u = (l = e.charCodeAt(i++)) - 48 < 10 ? l - 22 : l - 65 < 26 ? l - 65 : l - 97 < 26 ? l - 97 : 36) >= 36 || u > f((c - m) / a)) && g("overflow"), m += u * a, !(u < (h = s <= w ? 1 : s >= w + 26 ? 26 : s - w)); s += 36) a > f(c / (d = 36 - h)) && g("overflow"), a *= d;
w = _(m - o, t = p.length + 1, 0 == o), f(m / t) > c - y && g("overflow"), y += f(m / t), m %= t, p.splice(m++, 0, y)
}
return C(p)
}

function E(e) {
var t, n, r, i, o, a, s, u, h, d, l, v, m, C, b, E = [];
for (v = (e = y(e)).length, t = 128, n = 0, o = 72, a = 0; a < v; ++a)(l = e[a]) < 128 && E.push(p(l));
for (r = i = E.length, i && E.push("-"); r < v;) {
for (s = c, a = 0; a < v; ++a)(l = e[a]) >= t && l < s && (s = l);
for (s - t > f((c - n) / (m = r + 1)) && g("overflow"), n += (s - t) * m, t = s, a = 0; a < v; ++a)
if ((l = e[a]) < t && ++n > c && g("overflow"), l == t) {
for (u = n, h = 36; !(u < (d = h <= o ? 1 : h >= o + 26 ? 26 : h - o)); h += 36) b = u - d, C = 36 - d, E.push(p(w(d + b % C, 0))), u = f(b / C);
E.push(p(w(u, 0))), o = _(n, m, r == i), n = 0, ++r
}++ n, ++t
}
return E.join("")
}
s = {
version: "1.4.1",
ucs2: {
decode: y,
encode: C
},
decode: b,
encode: E,
toASCII: function(e) {
return m(e, (function(e) {
return h.test(e) ? "xn--" + E(e) : e
}))
},
toUnicode: function(e) {
return m(e, (function(e) {
return u.test(e) ? b(e.slice(4).toLowerCase()) : e
}))
}
}, void 0 === (i = function() {
return s
}.call(t, n, t, e)) || (e.exports = i)
}()
}).call(this, n(139)(e), n(54))
}, function(e, t) {
e.exports = function(e) {
return e.webpackPolyfill || (e.deprecate = function() {}, e.paths = [], e.children || (e.children = []), Object.defineProperty(e, "loaded", {
enumerable: !0,
get: function() {
return e.l
}
}), Object.defineProperty(e, "id", {
enumerable: !0,
get: function() {
return e.i
}
}), e.webpackPolyfill = 1), e
}
}, function(e, t, n) {
"use strict";
e.exports = {
isString: function(e) {
return "string" == typeof e
},
isObject: function(e) {
return "object" == typeof e && null !== e
},
isNull: function(e) {
return null === e
},
isNullOrUndefined: function(e) {
return null == e
}
}
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.DefaultWebRTCController = t.DefaultWebRTCSignallingChannel = void 0;
const r = n(142);
class i extends r.WebRTCSignallingChannel {
constructor(e, t) {
super(e), this.id = e, this.contact = t, this.reinit = !1, this.contact.on(this.id, (e, t) => {
"boolean" == typeof e.reinit && (this.reinit = e.reinit), this.emit(e.code, e, t)
}), this.contact.on("MediaState", e => this.emit("mediastate", e))
}
async release() {
this.contact.removeAllListeners(this.id)
}
isReinitRequired() {
return this.reinit
}
request(e, t) {
return this.contact.request(this.id, Object.assign({}, t, {
code: e
}))
}
}
t.DefaultWebRTCSignallingChannel = i;
class o extends r.WebRTCController {
constructor(e, t, n) {
super(e), this.contact = t, n && (this.configuration = Promise.resolve(n))
}
async release() {
this.signallingChannel && ((await this.signallingChannel).release(), delete this.signallingChannel)
}
createSignallingChannel(e) {
return new i(e, this.contact)
}
async getSignallingChannel() {
return this.signallingChannel || (this.signallingChannel = (async () => {
const e = (await this.getConfiguration()).id;
return this.createSignallingChannel(e)
})()), this.signallingChannel
}
async getConfiguration() {
return this.configuration || (this.configuration = (async () => {
const e = await vivocha.ws("contact", "webrtc", {
cid: this.contact.id
});
return await this.contact.request(this.type, e), e
})()), this.configuration
}
async getMedia() {
const e = await this.contact.getMedia();
let t = !1,
n = !1,
r = !1,
i = !1;
return "WebRTC" === this.type ? (e && e.Voice && "WebRTC" === e.Voice.engine && (t = !!e.Voice.tx, r = !!e.Voice.rx), e && e.Video && "WebRTC" === e.Video.engine && (n = !!e.Video.tx, i = !!e.Video.rx)) : "WebRTC.Screen" === this.type && e && e.Screen && "WebRTC" === e.Screen.engine && (n = !!e.Screen.tx, i = !!e.Screen.rx), {
sendAudio: t,
recvAudio: r,
sendVideo: n,
recvVideo: i
}
}
getDataChannel(e) {
return this.contact.dataChannels[e]
}
getTags() {
return vivocha.dot(this.contact, "contact.tags") || []
}
getLocalCapabilities() {
return this.contact.getLocalCapabilities()
}
getRemoteCapabilities() {
return this.contact.getRemoteCapabilities()
}
}
t.DefaultWebRTCController = o
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.WebRTCController = t.WebRTCSignallingChannel = void 0;
const r = n(133);
class i extends r.Machine {
constructor(e, t, n, r) {
super(t, n, r), this.id = e
}
sdp(e) {
return this.request("sdp", {
desc: e
})
}
abort() {
return this.request("abort", {})
}
ice(e) {
return this.request("ice", {
candidate: e
})
}
signallingstate(e) {
return this.request("signallingstate", {
state: e
})
}
icestate(e) {
return this.request("icestate", {
state: e
})
}
}
t.WebRTCSignallingChannel = i;
t.WebRTCController = class {
constructor(e) {
this.type = e
}
}
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.WebRTCManager = void 0;
const r = n(133),
i = n(11),
o = n(159),
a = n(134);
n(166);
const s = i.getLogger("vvc-webrtc");
class c extends r.Machine {
constructor(e) {
super({
start: {
async entry() {
return await this.init(e), this.enter("ready")
},
"local.mediastate": "defer",
"local.transit": "defer",
"local.addtrack": "defer"
},
ready: {
"local.mediastate": e => {
"offering" === e ? this.enter("offering") : "offered" === e && this.enter("offered")
},
"local.transit": e => {
this.wasOffered = e, this.enter(e ? "offered_transiting" : "offering_transiting")
},
"local.addtrack": "defer"
},
offering: {
"local.mediastate": e => {
"transiting" === e ? this.enter("offering_transiting") : "idle" === e && this.enter("ready")
},
"local.transit": "noop",
"local.addtrack": e => this.handleLocalAddTrack(e)
},
offering_transiting: {
"local.mediastate": e => {
"idle" === e ? this.enter("offering_sdp") : "failed" === e && this.enter("offering_cancelling")
},
"local.addtrack": e => this.handleLocalAddTrack(e),
"remote.ice": "defer",
"remote.signallingstate": "defer",
"remote.icestate": "defer",
"remote.track": "defer",
"remote.track.ended": "defer",
"remote.track.mute": "defer",
"remote.track.unmute": "defer",
"local.transit": "noop",
"local.negotiationneeded": "noop",
"local.datachannel": "defer",
"local.track.ended": "defer",
"local.track.mute": "defer",
"local.track.unmute": "defer"
},
offering_cancelling: {
entry() {
this.signalling.abort(), this.enter("reinit")
},
"*": "defer"
},
offering_sdp: {
async entry() {
!this.firstNegotiation && this.signalling.isReinitRequired() && this.restartPeerConnection(this.configuration);
const e = await this.controller.getMedia(),
t = await this.pc.createOffer({
iceRestart: !1,
offerToReceiveAudio: e.sendAudio || e.recvAudio,
offerToReceiveVideo: e.sendVideo || e.recvVideo,
voiceActivityDetection: !1
});
"WebRTC.Data" !== this.type && (s.debug(this.state, "original local sdp offer", "\n" + t.sdp), t.sdp = a.mungeOffer(t.sdp, e)), s.debug(this.state, "local sdp offer", "\n" + t.sdp), await this.pc.setLocalDescription(t), this.firstNegotiation = !1, this.signalling.sdp(t).then(this.eventHandler("remote.answer"), this.eventHandler("remove.answererror"))
},
"remote.answer": async e => {
s.debug(this.state, "remote sdp answer", "\n" + e.sdp), await this.pc.setRemoteDescription(new RTCSessionDescription(e)), this.enter("negotiating")
},
"remote.answererror": e => {
s.error(this.state, "negotiation failed", e), this.enter("reinit")
},
"remote.abort": (e, t) => {
t && t(), this.enter("reinit")
},
"local.ice": e => this.handleLocalICE(e),
"local.iceerror": e => this.handleLocalICEError(e),
"remote.ice": "defer",
"remote.signallingstate": "defer",
"remote.icestate": "defer",
"remote.track": "defer",
"remote.track.ended": "defer",
"remote.track.mute": "defer",
"remote.track.unmute": "defer",
"local.mediastate": "defer",
"local.transit": "noop",
"local.negotiationneeded": "noop",
"local.connectionstate": "defer",
"local.signalingstate": "defer",
"local.iceconnectionstate": "defer",
"local.icegatheringstate": "defer",
"local.datachannel": "defer",
"local.track.ended": "defer",
"local.track.mute": "defer",
"local.track.unmute": "defer"
},
offered: {
"local.mediastate": e => {
"transiting" === e ? this.enter("offered_transiting") : "idle" === e && this.enter("ready")
},
"local.transit": "noop"
},
offered_transiting: {
"local.mediastate": e => {
"idle" === e ? this.enter("offered_sdp") : "failed" === e && this.enter("reinit")
},
"local.addtrack": e => this.handleLocalAddTrack(e),
"remote.abort": (e, t) => {
t && t(), this.enter("reinit")
},
"remote.sdp": "defer",
"remote.ice": "defer",
"remote.signallingstate": "defer",
"remote.icestate": "defer",
"remote.track": "defer",
"remote.track.ended": "defer",
"remote.track.mute": "defer",
"remote.track.unmute": "defer",
"local.transit": "noop",
"local.negotiationneeded": "defer",
"local.datachannel": "defer",
"local.track.ended": "defer",
"local.track.mute": "defer",
"local.track.unmute": "defer"
},
offered_sdp: {
entry() {
this.sdpTimer = setTimeout(() => {
s.error(this.state, "negotiation timeout"), delete this.sdpTimer, this.firstNegotiation ? this.enter("ready") : this.enter("established")
}, c.SDP_TIMEOUT)
},
exit() {
this.sdpTimer && (clearTimeout(this.sdpTimer), delete this.sdpTimer)
},
"remote.sdpreq": (e, t) => this.handleRestartRequest(e, t),
"remote.sdp": async (e, t) => {
try {
s.debug(this.state, "remote sdp offer", "\n" + e.desc.sdp), !this.firstNegotiation && this.signalling.isReinitRequired() && this.restartPeerConnection(this.configuration), await this.pc.setRemoteDescription(new RTCSessionDescription(e.desc));
const n = await this.pc.createAnswer();
await this.pc.setLocalDescription(n), this.firstNegotiation = !1, t(null, n), this.enter("negotiating")
} catch (e) {
s.error(this.state, "negotiation failed", e), t("failed")
}
},
"remote.abort": (e, t) => {
t && t(), this.enter("reinit")
},
"local.ice": e => this.handleLocalICE(e),
"local.iceerror": e => this.handleLocalICEError(e),
"remote.ice": "defer",
"remote.signallingstate": "defer",
"remote.icestate": "defer",
"remote.track": "defer",
"remote.track.ended": "defer",
"remote.track.mute": "defer",
"remote.track.unmute": "defer",
"local.mediastate": "defer",
"local.transit": "noop",
"local.negotiationneeded": "noop",
"local.connectionstate": "defer",
"local.signalingstate": "defer",
"local.iceconnectionstate": "defer",
"local.icegatheringstate": "defer",
"local.datachannel": "defer",
"local.track.ended": "defer",
"local.track.mute": "defer",
"local.track.unmute": "defer"
},
negotiating: {
"remote.ice": (e, t) => this.handleRemoteICE(e, t),
"remote.signallingstate": (e, t) => this.handleRemoteSignallingState(e, t),
"remote.icestate": (e, t) => this.handleRemoteICEState(e, t),
"remote.track": e => this.handleRemoteTrack(e),
"remote.track.ended": e => this.handleRemoteTrackEnded(e),
"remote.track.mute": e => this.handleRemoteTrackMute(e),
"remote.track.unmute": e => this.handleRemoteTrackUnmute(e),
"local.connectionstate": () => {
this.handleLocalConnectionState(), "connected" === this.pc.connectionState ? this.enter("established") : "failed" === this.pc.connectionState && this.enter("failed")
},
"local.signalingstate": () => {
this.handleLocalSignallingState(), "connected" === this.pc.connectionState || "stable" === this.pc.signalingState && "complete" === this.pc.iceGatheringState && ("completed" === this.pc.iceConnectionState || "connected" === this.pc.iceConnectionState) ? this.enter("established") : "closed" === this.pc.signalingState && this.enter("failed")
},
"local.iceconnectionstate": () => {
this.handleLocalICEConnectionState(), "connected" === this.pc.connectionState || "stable" === this.pc.signalingState && "complete" === this.pc.iceGatheringState && ("completed" === this.pc.iceConnectionState || "connected" === this.pc.iceConnectionState) ? this.enter("established") : "failed" === this.pc.iceConnectionState && this.enter("failed")
},
"local.icegatheringstate": () => {
this.handleLocalICEGatheringState(), "connected" === this.pc.connectionState || "stable" === this.pc.signalingState && "complete" === this.pc.iceGatheringState && ("completed" === this.pc.iceConnectionState || "connected" === this.pc.iceConnectionState) ? this.enter("established") : "failed" === this.pc.iceConnectionState && this.enter("failed")
},
"local.ice": e => this.handleLocalICE(e),
"local.iceerror": e => this.handleLocalICEError(e),
"local.datachannel": e => this.handleLocalDataChannel(e),
"local.track.ended": e => this.handleLocalTrackEnded(e),
"local.track.mute": e => this.handleLocalTrackMute(e),
"local.track.unmute": e => this.handleLocalTrackUnmute(e),
"remote.sdp": "defer",
"remote.sdpreq": "defer",
"local.mediastate": "defer",
"local.negotiationneeded": "noop"
},
established: {
"remote.sdp": "defer",
"remote.sdpreq": (e, t) => {
this.wasOffered = !0, this.handleRestartRequest(e, t)
},
"remote.ice": (e, t) => this.handleRemoteICE(e, t),
"remote.signallingstate": (e, t) => this.handleRemoteSignallingState(e, t),
"remote.icestate": (e, t) => this.handleRemoteICEState(e, t),
"remote.track": e => this.handleRemoteTrack(e),
"remote.track.ended": e => this.handleRemoteTrackEnded(e),
"remote.track.mute": e => this.handleRemoteTrackMute(e),
"remote.track.unmute": e => this.handleRemoteTrackUnmute(e),
"local.mediastate": e => {
"offering" === e ? this.enter("offering") : "offered" === e && this.enter("offered")
},
"local.negotiationneeded": () => this.enter("offering_sdp"),
"local.connectionstate": () => {
this.handleLocalConnectionState(), "failed" === this.pc.connectionState ? this.enter("failed") : "closed" !== this.pc.connectionState && "disconnected" !== this.pc.connectionState || this.enter("disconnected")
},
"local.signalingstate": () => {
this.handleLocalSignallingState(), "closed" === this.pc.signalingState && this.enter("reinit", this.controller)
},
"local.iceconnectionstate": () => {
this.handleLocalICEConnectionState(), "failed" === this.pc.iceConnectionState ? this.enter("failed") : "closed" === this.pc.iceConnectionState && this.enter("disconnected")
},
"local.icegatheringstate": () => this.handleLocalICEGatheringState(),
"local.ice": e => this.handleLocalICE(e),
"local.datachannel": e => this.handleLocalDataChannel(e),
"local.track.ended": e => this.handleLocalTrackEnded(e),
"local.track.mute": e => this.handleLocalTrackMute(e),
"local.track.unmute": e => this.handleLocalTrackUnmute(e),
"local.iceerror": "noop"
},
disconnected: {
entry() {
s.warn("disconnected"), this.reinitTimer = setTimeout(() => {
s.warn("WebRTCManager.state.disconnected from more than ".concat(c.REINIT_TIMEOUT / 1e3, " seconds, going to reinit")), this.enter("reinit", this.controller)
}, c.REINIT_TIMEOUT)
},
exit() {
clearTimeout(this.reinitTimer), delete this.reinitTimer
},
"remote.sdp": "defer",
"remote.sdpreq": (e, t) => {
this.wasOffered = !0, this.handleRestartRequest(e, t)
},
"local.connectionstate": "noop",
"local.iceconnectionstate": "noop",
"local.iceerror": e => {
this.handleLocalICEError(e), this.enter("reinit", this.controller)
}
},
failed: {
async entry() {
await this.reset(), this.emit("failed")
}
},
reinit: {
entry() {
s.warn("reinit"), this.restartPeerConnection(this.configuration), this.emit("disconnect", this.wasOffered)
},
"remote.sdp": "defer",
"remote.ice": "defer",
"local.mediastate": e => {
"offering" === e ? this.enter("offering") : "offered" === e && this.enter("offered")
},
"local.transit": e => {
this.wasOffered = e, this.enter(e ? "offered_transiting" : "offering_transiting")
},
"remote.track.ended": "noop",
"remote.track.mute": "noop",
"remote.track.unmute": "noop",
"local.addtrack": "defer"
}
}, "start", "vvc-webrtc"), this._proxable = !0, this.dataChannels = {}, this.pcEvMap = {
negotiationneeded: "local.negotiationneeded",
connectionstatechange: "local.connectionstate",
signalingstatechange: "local.signalingstate",
iceconnectionstatechange: "local.iceconnectionstate",
icegatheringstatechange: "local.icegatheringstate",
icecandidate: "local.ice",
icecandidateerror: "local.iceerror",
datachannel: "local.datachannel",
statsended: "local.statsended",
track: "remote.track"
};
for (let e in this.states) this.states[e]["*"] || (this.states[e]["*"] = this.unhandled)
}
unhandled(...e) {
s.error("unhandled event ".concat(this.lastEvent, " in state ").concat(this.state, ", with args ").concat(e))
}
get id() {
return this.configuration ? this.configuration.id : void 0
}
async release() {
for (var e in this.removeAllListeners(), this.dataChannels) {
const t = this.dataChannels[e];
t.close(), t.removeAllListeners(), delete this.dataChannels[e]
}
await this.reset()
}
getPeerConnectionConfig(e) {
let t;
return e.servers && (t = {
iceServers: e.servers.urls.map(t => ({
urls: t,
username: e.servers.username,
credential: e.servers.password
}))
}), vivocha.dot(this.localCaps, "WebRTC.UnifiedPlan") && !vivocha.dot(this.remoteCaps, "WebRTC.UnifiedPlan") && (t = t || {}, t.sdpSemantics = "plan-b"), t
}
createPeerConnection(e) {
s.debug("WebRTCManager.createPeerConnection", e), this.pc && this.resetPeerConnection(), this.pc = new RTCPeerConnection(this.getPeerConnectionConfig(e)), this.peerConnectionEventListener = this._peerConnectionEventListener.bind(this), Object.entries(this.pcEvMap).forEach(([e, t]) => {
this.pc.addEventListener(e, this.peerConnectionEventListener)
}), this.stream = new MediaStream, this.firstNegotiation = !0
}
_peerConnectionEventListener(e) {
if (s.log("WebRTCManager.peerConnectionEventListener", e.type), this.pcEvMap[e.type]) return this.process(this.pcEvMap[e.type], e);
s.error("unknown event", e.type)
}
restartPeerConnection(e) {
s.debug("WebRTCManager.restartPeerConnection", e), Object.entries(this.pcEvMap).forEach(([e, t]) => {
this.pc.removeEventListener(e, this.peerConnectionEventListener)
});
try {
this.pc.close()
} catch (e) {
s.error("WebRTCManager.restartPeerConnection old PeerConnection close()", e)
}
delete this.pc, delete this.peerConnectionEventListener, this.pc = new RTCPeerConnection(this.getPeerConnectionConfig(e)), this.peerConnectionEventListener = this._peerConnectionEventListener.bind(this), Object.entries(this.pcEvMap).forEach(([e, t]) => {
this.pc.addEventListener(e, this.peerConnectionEventListener)
}), this.stream.getTracks().forEach(e => this.pc.addTrack(e, this.stream)), this.firstNegotiation = !0
}
resetPeerConnection() {
s.debug("WebRTCManager.resetPeerConnection"), Object.entries(this.pcEvMap).forEach(([e, t]) => {
this.pc.removeEventListener(e, this.peerConnectionEventListener)
}), this.getSendersWithTrack().map(e => e.track.id).forEach(e => this.removeLocalTrack(e));
try {
this.pc.close()
} catch (e) {}
delete this.pc, delete this.stream
}
async init(e) {
s.debug("WebRTCManager.init", e), this.controller = e, this.signalling = await this.controller.getSignallingChannel(), this.configuration = await this.controller.getConfiguration(), this.localCaps = await this.controller.getLocalCapabilities(), this.remoteCaps = await this.controller.getRemoteCapabilities(), ["sdp", "sdpreq", "abort", "ice", "signallingstate", "icestate"].forEach(e => this.signalling.on(e, this.eventHandler("remote.".concat(e)))), this.signalling.on("mediastate", this.eventHandler("local.mediastate")), this.createPeerConnection(this.configuration)
}
async reset() {
for (var e in s.debug("WebRTCManager.reset"), this.pc && this.resetPeerConnection(), this.dataChannels) s.log("WebRTCManager.reset", "closing data channel", e), this.dataChannels[e].emit("close");
this.dataChannels = {}, this.signalling.eventNames().forEach(e => this.signalling.removeAllListeners(e)), await this.controller.release(), delete this.controller, delete this.configuration, delete this.signalling, delete this.localCaps, delete this.remoteCaps
}
renegotiate() {
return s.debug("WebRTCManager.renegotiate"), this.process("local.negotiationneeded")
}
startTransition(e) {
return this.process("local.transit", e)
}
getUserMedia(e, t = c.MEDIA_TIMEOUT) {
return s.log("WebRTCManager.getUserMedia", e, t), new Promise(async (n, r) => {
let i = setTimeout(() => {
i = void 0, r(new Error("UserMediaTimeout"))
}, t);
try {
n(await navigator.mediaDevices.getUserMedia(e))
} catch (e) {
r(e)
} finally {
i && clearTimeout(i)
}
})
}
getDisplayMedia(e, t = c.MEDIA_TIMEOUT) {
return s.log("WebRTCManager.getDisplayMedia", e, t), new Promise(async (n, r) => {
let i = setTimeout(() => {
i = void 0, r(new Error("DisplayMediaTimeout"))
}, t);
try {
n(await navigator.mediaDevices.getDisplayMedia(e))
} catch (e) {
r(e)
} finally {
i && clearTimeout(i)
}
})
}
async addLocalStream(e) {
s.log("WebRTCManager.addLocalStream", e);
const t = e.getTracks();
for (let e of t) await this.addLocalTrack(e)
}
addLocalTrack(e) {
return this.process("local.addtrack", e)
}
removeLocalTrack(e) {
const t = this.getSendersWithTrack().find(t => t.track.id === e);
if (t) {
s.log("WebRTCManager.removeLocalTrack", "stopping track", t.track.kind, t.track.id);
try {
this.stream.removeTrack(t.track), t.track.stop(), this.resetTrack(t.track), this.pc.removeTrack(t)
} catch (e) {
s.error("WebRTCManager.removeLocalTrack", e)
}
}
}
getLocalTrack(e) {
const t = this.getSendersWithTrack().find(t => t.track.id === e);
return t ? t.track : void 0
}
initLocalTrack(e) {
e.onended = () => this.process("local.track.ended", e), e.onmute = () => this.process("local.track.mute", e), e.onunmute = () => this.process("local.track.unmute", e)
}
getRemoteTrack(e) {
const t = this.getReceiversWithTrack().find(t => t.track.id === e);
return t ? t.track : void 0
}
initRemoteTrack(e) {
e.onended = () => this.process("remote.track.ended", e), e.onmute = () => this.process("remote.track.mute", e), e.onunmute = () => this.process("remote.track.unmute", e)
}
resetTrack(e) {
e.onended = null, e.onmute = null, e.onunmute = null
}
getSendersWithTrack() {
return this.pc.getSenders().filter(e => !!e.track)
}
getReceiversWithTrack() {
return this.pc.getReceivers().filter(e => !!e.track)
}
handleRestartRequest(e, t) {
this.restartPeerConnection(this.configuration), this.enter("offering_sdp"), t && t()
}
handleRemoteICE(e, t) {
e.candidate && -1 === e.candidate.candidate.indexOf("endOfCandidates") && (s.debug(this.state, "remote ice candidate", e.candidate.candidate), this.pc.addIceCandidate(new RTCIceCandidate(e.candidate)).catch(t => {
s.error("handleRemoteICE", t, e)
})), t && t()
}
handleRemoteSignallingState(e, t) {
s.log(this.state, "remote signalling state", e.state), this.emit("signallingstate", e.state, !0), t && t()
}
handleRemoteICEState(e, t) {
s.log(this.state, "remote ice connection state", e.state), this.emit("icestate", e.state, !0), t && t()
}
logPeerConnectionStates() {
s.debug("conn(".concat(this.pc.connectionState, ") sig(").concat(this.pc.signalingState, ") ice(").concat(this.pc.iceConnectionState, ") iceg(").concat(this.pc.iceGatheringState, ")"))
}
handleLocalConnectionState() {
s.log(this.state, "local connection state", this.pc.connectionState), s.debug.enabled && this.logPeerConnectionStates(), this.emit("connectionstate", this.pc.connectionState, !1)
}
handleLocalSignallingState() {
s.log(this.state, "local signalling state", this.pc.signalingState), s.debug.enabled && this.logPeerConnectionStates(), this.emit("signallingstate", this.pc.signalingState, !1)
}
handleLocalICEConnectionState() {
s.log(this.state, "local ice connection state", this.pc.iceConnectionState), s.debug.enabled && this.logPeerConnectionStates(), this.emit("icestate", this.pc.iceConnectionState, !1)
}
handleLocalICEGatheringState() {
s.log(this.state, "local ice gathering state", this.pc.iceGatheringState), s.debug.enabled && this.logPeerConnectionStates(), this.emit("icegatheringstate", this.pc.iceGatheringState, !1)
}
handleLocalICE(e) {
e.candidate && -1 === e.candidate.candidate.indexOf("endOfCandidates") && (s.debug(this.state, "local ice candidate", e.candidate.candidate), this.signalling.ice(e.candidate))
}
handleLocalICEError(e) {
s.error(this.state, "ice error", e)
}
handleLocalDataChannel(e) {
s.log(this.state, "data channel", e);
const t = o.VivochaWebRTCData.getRTCChannelId(e.channel);
let n = this.controller.getDataChannel(t);
n && n instanceof o.VivochaWebRTCData ? (s.log("attaching channel to existing datachannel"), n.attach(e.channel)) : (n = new o.VivochaWebRTCData(e.channel), this.emit("datachannel", n)), this.dataChannels[t] = n
}
handleLocalAddTrack(e) {
this.initLocalTrack(e), this.stream.addTrack(e), this.pc.addTrack(e, this.stream)
}
handleRemoteTrack(e) {
this.initRemoteTrack(e.track), this.emit("trackadded", e.track, !1)
}
handleRemoteTrackEnded(e) {
this.resetTrack(e), this.emit("trackended", e, !1)
}
handleRemoteTrackMute(e) {
this.emit("trackmute", e, !1)
}
handleRemoteTrackUnmute(e) {
this.emit("trackunmute", e, !1)
}
handleLocalTrackEnded(e) {
this.resetTrack(e), this.emit("trackended", e, !0)
}
handleLocalTrackMute(e) {
this.emit("trackmute", e, !0)
}
handleLocalTrackUnmute(e) {
this.emit("trackunmute", e, !0)
}
createDataChannel(e, t) {
return new Promise((n, r) => {
const i = this.pc.createDataChannel(e, t),
a = new o.VivochaWebRTCData(i);
a.once("error", r), a.once("ready", () => {
a.removeListener("error", r), n(a)
}), this.emit("datachannel", a)
})
}
getLocalMediaState() {
var e = {
audio: !1,
video: !1
};
return this.getSendersWithTrack().forEach(t => {
t.track.enabled && (e[t.track.kind] = !0)
}), e
}
setLocalMediaState(e, t, n) {
this.getSendersWithTrack().forEach(r => {
("audio" === r.track.kind && e || "video" === r.track.kind && t) && (r.track.enabled = "boolean" == typeof n ? n : !r.track.enabled)
})
}
async getMicrophones() {
return (await navigator.mediaDevices.enumerateDevices()).filter(e => e && "audioinput" === e.kind)
}
async getCameras() {
return (await navigator.mediaDevices.enumerateDevices()).filter(e => e && "videoinput" === e.kind)
}
async switchToNextCamera() {
const e = await this.getCameras();
if (!e || e.length < 2) throw new Error("no_multiple_cameras");
if (!this.pc) throw new Error("no_peer_connection");
const t = this.getSendersWithTrack();
if (!t || !t.length) throw new Error("no_senders");
const n = t.find(e => "video" === e.track.kind);
if (!n) throw new Error("no_video_sender");
s.debug("switchToNextCamera", "video sender", n);
const r = e.find(e => e.label === n.track.label),
i = r ? e.indexOf(r) : -1;
if (-1 === i) throw new Error("no_current_device");
s.debug("switchToNextCamera", "current device", i, r);
const o = e[(i + 1) % e.length];
s.debug("switchToNextCamera", "nextDevice device", o), n.track.stop();
const a = await this.getUserMedia({
video: {
deviceId: {
exact: o.deviceId
}
}
});
s.debug("switchToNextCamera", "new stream", a);
const c = a.getVideoTracks()[0];
return s.debug("switchToNextCamera", "new track", c), await n.replaceTrack(c), c
}
}
t.WebRTCManager = c, c.SDP_TIMEOUT = 9e4, c.REINIT_TIMEOUT = 3e4, c.MEDIA_TIMEOUT = 6e4
}, , , , , function(e, t) {
var n = "undefined" != typeof crypto && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || "undefined" != typeof msCrypto && "function" == typeof window.msCrypto.getRandomValues && msCrypto.getRandomValues.bind(msCrypto);
if (n) {
var r = new Uint8Array(16);
e.exports = function() {
return n(r), r
}
} else {
var i = new Array(16);
e.exports = function() {
for (var e, t = 0; t < 16; t++) 0 == (3 & t) && (e = 4294967296 * Math.random()), i[t] = e >>> ((3 & t) << 3) & 255;
return i
}
}
}, function(e, t) {
for (var n = [], r = 0; r < 256; ++r) n[r] = (r + 256).toString(16).substr(1);
e.exports = function(e, t) {
var r = t || 0,
i = n;
return [i[e[r++]], i[e[r++]], i[e[r++]], i[e[r++]], "-", i[e[r++]], i[e[r++]], "-", i[e[r++]], i[e[r++]], "-", i[e[r++]], i[e[r++]], "-", i[e[r++]], i[e[r++]], i[e[r++]], i[e[r++]], i[e[r++]], i[e[r++]]].join("")
}
}, , , , , function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.noop = t.defer = t.exit = t.entry = t.handle = t.fsm = void 0;
const r = n(155),
i = Symbol();

function o(e) {
return e[i] || (e[i] = {}), e[i]
}

function a(e, t, n, r) {
const i = o(n.constructor);
i[e] || (i[e] = {}), i[e][t] = r
}

function s(e, t) {
return function(n, r) {
a(e, t, n, (function(...e) {
return this[r].apply(this, e)
}))
}
}
t.fsm = function(e) {
return function(t) {
return class extends t {
constructor(...n) {
super(...n), this.states = r.deepExtend({}, this.states, o(t)), e && void 0 === this.state && this.enter(e)
}
}
}
}, t.handle = s, t.entry = function(e) {
return s(e, "entry")
}, t.exit = function(e) {
return s(e, "exit")
}, t.defer = function(e, t) {
return function(n) {
a(e, t, n, "defer")
}
}, t.noop = function(e, t) {
return function(n) {
a(e, t, n, "noop")
}
}
}, function(e, t, n) {
"use strict";
(function(e) {
Object.defineProperty(t, "__esModule", {
value: !0
}), t.mixin = t.deepExtend = t.dot = t.Eredita = void 0;
const n = Array.isArray;
class r {
constructor(e, t) {
if (this.data = e, this.parent = t, this.dirty = !1, !this.data) throw new Error("missing data")
}
dot(e, t) {
return r.dot(this.data, e, t)
}
getPath(e) {
let t = this.dot(e);
return void 0 === t ? this.parent ? this.parent.getPath(e) : void 0 : t
}
getTypedPath(e, t, r) {
let i = this.getPath(e);
if ((o = i) !== Object(o) || n(i)) return i; {
const e = t.toLowerCase();
return void 0 !== i[e] ? i[e] : r ? i[r] : void 0
}
var o
}
setPath(e, t) {
return this.dirty = !0, this.dot(e, t)
}
unsetPath(e) {
return this.setPath(e, null)
}
mergePath(e) {
let t = this.parent,
n = t ? t.mergePath(e) : null,
i = this.getPath(e);
return n ? r.deepExtend(n, i) : r.deepExtend({}, i)
}
isDirty() {
return this.dirty
}
static dot(e, t, n) {
const r = t ? t.split(".") : [];
let i = e;
if (void 0 === n)
for (let e = 0, t = r.length; void 0 !== i && e < t; e++) i = i[r[e]];
else {
let e = null;
for (let t = 0, n = r.length - 1; e = r[t], t < n; t++) "object" != typeof i[e] && (i[e] = isNaN(r[t + 1]) ? {} : []), i = i[e];
i[e] = n, i = i[e]
}
return i
}
static deepExtend(t, ...i) {
if (!t) throw new Error("missing target");
if ("object" != typeof t) throw new Error("invalid target");
if (!i.length) return t;
let o, a, s, c, u;
for (let h of i) {
if ("object" != typeof h) throw new Error("invalid argument");
for (o in h) s = t[o], a = h[o], a !== t && ("object" == typeof a && null !== a ? a instanceof e ? (u = e.alloc(a.length), a.copy(u), t[o] = u) : a instanceof Date ? t[o] = new Date(a.getTime()) : "object" == typeof s && null !== s ? (c = n(a) ? n(s) ? s : [] : n(s) ? {} : s, t[o] = r.deepExtend(c, a)) : (c = n(a) ? [] : {}, t[o] = r.deepExtend(c, a)) : t[o] = a)
}
return t
}
}
t.Eredita = r, t.dot = r.dot, t.deepExtend = r.deepExtend, t.mixin = function() {
return {
deepExtend: t.deepExtend
}
}
}).call(this, n(12).Buffer)
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.Machine = void 0;
const r = n(55),
i = n(9),
o = n(157);
class a extends i.EventEmitter {
constructor(e = {}, t, n = "fseh", i) {
super(), this.states = e, this.ready = Promise.resolve(!0), this.deferredEvents = [], this.logger = r.getLogger(n, i), t && this.enter(t)
}
defer(e) {
return (...t) => new Promise(n => {
this.deferredEvents.push({
event: e,
args: t,
resolve: n
})
})
}
async flushDeferred() {
if (this.deferredEvents.length) {
let e = this.deferredEvents;
this.deferredEvents = [];
for (let t = 0; t < e.length; t++) try {
let n = this.innerProcess(e[t].event, !0, ...e[t].args);
e[t].resolve(n)
} catch (e) {}
}
}
async innerProcess(e, t, ...n) {
if (e) {
let r;
if (this.state && this.states[this.state]) {
let n = this.states[this.state][e] || this.states[this.state]["*"];
n && ("defer" === n ? (this.logger.debug("DEFERRING ".concat(t ? "deferred " : "", "event ").concat(e.toUpperCase(), " in state ").concat(this.state.toUpperCase())), r = this.defer(e)) : "noop" === n ? (this.logger.debug("IGNORING ".concat(t ? "deferred " : "", "event ").concat(e.toUpperCase(), " in state ").concat(this.state.toUpperCase())), r = () => {}) : (this.logger.debug("PROCESSING ".concat(t ? "deferred " : "", "event ").concat(e.toUpperCase(), " in state ").concat(this.state.toUpperCase())), r = "string" == typeof n ? (...e) => this.enter(n, ...e) : n))
}
if (r) return this.lastEvent = e, r.apply(this, n);
throw this.logger.error("UNHANDLED ".concat(t ? "deferred " : "", "event ").concat(e.toUpperCase(), " in state ").concat(this.state ? this.state.toUpperCase() : "unknown")), new o.UnhandledEventError(e, this.state, t, n)
}
throw new o.InvalidEventError(e, this.state, t, n)
}
async process(e, ...t) {
return await this.ready, this.innerProcess(e, !1, ...t)
}
processStateEventHandler(e, t, n) {
return Promise.resolve(!e || !e[t] || e[t].apply(this, n))
}
enter(e, ...t) {
if (!e) return Promise.reject(new o.InvalidStateError(e, t));
let n = this.state ? this.states[this.state] : void 0,
r = this.states[e];
if (this.state !== e) {
if (r) {
let i;
return this.state ? (this.logger.debug("TRANSISTING from ".concat(this.state.toUpperCase(), " to ").concat(e.toUpperCase())), this.emit("".concat(this.state, ":exit"), e, ...t), this.emit("exit", this.state, e, ...t)) : this.logger.debug("TRANSISTING to ".concat(e.toUpperCase())), this.emit("".concat(e, ":pre-entry"), ...t), this.emit("pre-entry", e, ...t), this.ready = new Promise(e => {
i = e
}), this.state = e, (async () => {
try {
return await this.processStateEventHandler(n, "exit", t), await this.processStateEventHandler(r, "entry", t), await this.flushDeferred(), i && i(), this.emit("".concat(e, ":entry"), ...t), this.emit("entry", e, ...t), this.emit(e, ...t), !0
} catch (e) {
throw i && i(), e
}
})()
}
return this.logger.error("UNKNOWN state ".concat(e.toUpperCase())), Promise.reject(new o.UnknownStateError(e, t))
}
return Promise.resolve(!0)
}
eventHandler(e) {
return async (...t) => {
if ("string" == typeof e) return this.process(e, ...t);
if (await this.ready, this.state && e[this.state]) return e[this.state].apply(this, t);
if (e["*"]) return e["*"].apply(this, t);
throw this.logger.error("UNHANDLED event ".concat((this.lastEvent || "unknown").toUpperCase(), " in state ").concat(this.state ? this.state.toUpperCase() : "unknown")), new o.UnhandledEventError(this.lastEvent || "unknown", this.state, !1, t)
}
}
callbackEventHandler(e) {
let t = this.eventHandler(e);
return (...e) => {
if (e.length && "function" == typeof e[e.length - 1]) {
let n = e.pop();
t(e).then((...e) => {
n(null, ...e)
}, e => {
n(e)
})
} else t(...e)
}
}
}
t.Machine = a
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.UnknownStateError = t.InvalidStateError = t.UnhandledEventError = t.InvalidEventError = void 0;
class r extends Error {
constructor(e, t = "unknown", n = !1, ...i) {
super("Invalid ".concat(n ? "deferred " : "", 'event "').concat(e, '" in state "').concat(t, '"')), this.event = e, this.state = t, this.deferred = n, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, r), this.args = i
}
}
t.InvalidEventError = r;
class i extends Error {
constructor(e, t = "unknown", n = !1, ...r) {
super("Unhandled ".concat(n ? "deferred " : "", 'event "').concat(e, '" in state "').concat(t, '"')), this.event = e, this.state = t, this.deferred = n, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, i), this.args = r
}
}
t.UnhandledEventError = i;
class o extends Error {
constructor(e, ...t) {
super('Invalid state "'.concat(e, '"')), this.state = e, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, o), this.args = t
}
}
t.InvalidStateError = o;
class a extends Error {
constructor(e, ...t) {
super('Unknown state "'.concat(e, '"')), this.state = e, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, o), this.args = t
}
}
t.UnknownStateError = a
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
})
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.VivochaWebRTCData = void 0;
const r = n(11);
class i extends r.BaseVivochaData {
constructor(e) {
super(i.getRTCChannelId(e)), this._proxable = !0, this.chunks = [], this.attach(e)
}
send(e, t) {
console.log("VivochaWebRTCData.send", e);
for (var n = JSON.stringify({
data: e,
topic: t
}), r = 0, i = n.length; i > 0;) {
var o = Math.min(i, 1e3),
a = n.substr(r, o);
r += o, i -= o, this.channel.send((i ? "c:" : "e:") + a)
}
}
attach(e) {
this.channel && (this.channel.onopen = null, this.channel.onclose = null, this.channel.onerror = null, this.channel.onmessage = null, this.chunks = []), this.channel = e, this.channel.onopen = e => {
console.log("onopen", e), this.emit("ready")
}, this.channel.onclose = e => {
console.log("onclose", e), this.emit("close")
}, this.channel.onerror = e => {
console.log("onerror", e), this.emit("error", e)
}, this.channel.onmessage = e => {
if (console.log("onmessage", e), e.data.length < 3) console.error("onmessage", "bad message");
else {
var t = e.data[0],
n = e.data.substr(2);
if (this.chunks.push(n), "e" === t) try {
var r = JSON.parse(this.chunks.join(""));
this.chunks = [], this.emit(r.topic || "data", r.data)
} catch (e) {
console.error("onmessage", e)
}
}
}
}
close() {
this.channel && (this.channel.close(), this.channel.onopen = null, this.channel.onclose = null, this.channel.onerror = null, this.channel.onmessage = null, this.channel = null, this.chunks = [])
}
static getRTCChannelId(e) {
return "" + (e.label || e.id)
}
}
t.VivochaWebRTCData = i
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.NativeMediaEngine = void 0;
const r = n(49),
i = n(11);
i.getLogger("vvc-media");
class o extends i.MediaEngine {
constructor() {
super(), this.id = "Native"
}
static probe() {
return !0
}
attach(e) {
return this.contact = e, e.getLocalCapabilities().then((function(e) {
return i.dot(e, "Media.Sharing.Engines.Native", !0), i.dot(e, "Media.Chat.Engines.Native", !0), i.dot(e, "Media.Voice.Engines.Native", !0), e
}))
}
release() {
this.contact = null
}
transit(e, t, n) {
function o(n) {
var o = i.dot(e, n),
a = i.dot(t, n);
if (a && !a.engine && (a.engine = "Native"), o && (o.tx || o.rx)) {
if ("Native" !== o.engine) return !1;
a && "Native" !== a.engine && (o.tx = o.rx = !1, this.contact.emit("MediaChange", e))
}
return a ? "Native" === a.engine && (e[n] = t[n], !r.isEqual(a, o)) : (delete e[n], !!o)
}
var a = o("Sharing"),
s = o("Chat"),
c = o("Voice");
return {
changed: a || s || c
}
}
}
t.NativeMediaEngine = o
}, , , , , , function(e, t, n) {
"use strict";
n.r(t);
var r = {};
n.r(r), n.d(r, "shimGetUserMedia", (function() {
return h
})), n.d(r, "shimGetDisplayMedia", (function() {
return d
})), n.d(r, "shimMediaStream", (function() {
return l
})), n.d(r, "shimOnTrack", (function() {
return f
})), n.d(r, "shimGetSendersWithDtmf", (function() {
return p
})), n.d(r, "shimGetStats", (function() {
return g
})), n.d(r, "shimSenderReceiverGetStats", (function() {
return v
})), n.d(r, "shimAddTrackRemoveTrackWithNative", (function() {
return m
})), n.d(r, "shimAddTrackRemoveTrack", (function() {
return y
})), n.d(r, "shimPeerConnection", (function() {
return C
})), n.d(r, "fixNegotiationNeeded", (function() {
return w
}));
var i = {};
n.r(i), n.d(i, "shimGetUserMedia", (function() {
return E
})), n.d(i, "shimGetDisplayMedia", (function() {
return T
})), n.d(i, "shimPeerConnection", (function() {
return S
})), n.d(i, "shimReplaceTrack", (function() {
return R
}));
var o = {};
n.r(o), n.d(o, "shimGetUserMedia", (function() {
return x
})), n.d(o, "shimGetDisplayMedia", (function() {
return k
})), n.d(o, "shimOnTrack", (function() {
return P
})), n.d(o, "shimPeerConnection", (function() {
return A
})), n.d(o, "shimSenderGetStats", (function() {
return I
})), n.d(o, "shimReceiverGetStats", (function() {
return O
})), n.d(o, "shimRemoveStream", (function() {
return M
})), n.d(o, "shimRTCDataChannel", (function() {
return D
})), n.d(o, "shimAddTransceiver", (function() {
return N
})), n.d(o, "shimGetParameters", (function() {
return L
})), n.d(o, "shimCreateOffer", (function() {
return j
})), n.d(o, "shimCreateAnswer", (function() {
return F
}));
var a = {};
n.r(a), n.d(a, "shimLocalStreamsAPI", (function() {
return V
})), n.d(a, "shimRemoteStreamsAPI", (function() {
return B
})), n.d(a, "shimCallbacksAPI", (function() {
return U
})), n.d(a, "shimGetUserMedia", (function() {
return W
})), n.d(a, "shimConstraints", (function() {
return q
})), n.d(a, "shimRTCIceServerUrls", (function() {
return H
})), n.d(a, "shimTrackEventTransceiver", (function() {
return z
})), n.d(a, "shimCreateOfferLegacy", (function() {
return G
})), n.d(a, "shimAudioContext", (function() {
return K
}));
var s = {};
n.r(s), n.d(s, "shimRTCIceCandidate", (function() {
return $
})), n.d(s, "shimMaxMessageSize", (function() {
return X
})), n.d(s, "shimSendThrowTypeError", (function() {
return Z
})), n.d(s, "shimConnectionState", (function() {
return Q
})), n.d(s, "removeExtmapAllowMixed", (function() {
return ee
})), n.d(s, "shimAddIceCandidateNullOrEmpty", (function() {
return te
}));
var c = n(2);
const u = c.log;

function h(e, t) {
const n = e && e.navigator;
if (!n.mediaDevices) return;
const r = function(e) {
if ("object" != typeof e || e.mandatory || e.optional) return e;
const t = {};
return Object.keys(e).forEach(n => {
if ("require" === n || "advanced" === n || "mediaSource" === n) return;
const r = "object" == typeof e[n] ? e[n] : {
ideal: e[n]
};
void 0 !== r.exact && "number" == typeof r.exact && (r.min = r.max = r.exact);
const i = function(e, t) {
return e ? e + t.charAt(0).toUpperCase() + t.slice(1) : "deviceId" === t ? "sourceId" : t
};
if (void 0 !== r.ideal) {
t.optional = t.optional || [];
let e = {};
"number" == typeof r.ideal ? (e[i("min", n)] = r.ideal, t.optional.push(e), e = {}, e[i("max", n)] = r.ideal, t.optional.push(e)) : (e[i("", n)] = r.ideal, t.optional.push(e))
}
void 0 !== r.exact && "number" != typeof r.exact ? (t.mandatory = t.mandatory || {}, t.mandatory[i("", n)] = r.exact) : ["min", "max"].forEach(e => {
void 0 !== r[e] && (t.mandatory = t.mandatory || {}, t.mandatory[i(e, n)] = r[e])
})
}), e.advanced && (t.optional = (t.optional || []).concat(e.advanced)), t
},
i = function(e, i) {
if (t.version >= 61) return i(e);
if ((e = JSON.parse(JSON.stringify(e))) && "object" == typeof e.audio) {
const t = function(e, t, n) {
t in e && !(n in e) && (e[n] = e[t], delete e[t])
};
t((e = JSON.parse(JSON.stringify(e))).audio, "autoGainControl", "googAutoGainControl"), t(e.audio, "noiseSuppression", "googNoiseSuppression"), e.audio = r(e.audio)
}
if (e && "object" == typeof e.video) {
let o = e.video.facingMode;
o = o && ("object" == typeof o ? o : {
ideal: o
});
const a = t.version < 66;
if (o && ("user" === o.exact || "environment" === o.exact || "user" === o.ideal || "environment" === o.ideal) && (!n.mediaDevices.getSupportedConstraints || !n.mediaDevices.getSupportedConstraints().facingMode || a)) {
let t;
if (delete e.video.facingMode, "environment" === o.exact || "environment" === o.ideal ? t = ["back", "rear"] : "user" !== o.exact && "user" !== o.ideal || (t = ["front"]), t) return n.mediaDevices.enumerateDevices().then(n => {
let a = (n = n.filter(e => "videoinput" === e.kind)).find(e => t.some(t => e.label.toLowerCase().includes(t)));
return !a && n.length && t.includes("back") && (a = n[n.length - 1]), a && (e.video.deviceId = o.exact ? {
exact: a.deviceId
} : {
ideal: a.deviceId
}), e.video = r(e.video), u("chrome: " + JSON.stringify(e)), i(e)
})
}
e.video = r(e.video)
}
return u("chrome: " + JSON.stringify(e)), i(e)
},
o = function(e) {
return t.version >= 64 ? e : {
name: {
PermissionDeniedError: "NotAllowedError",
PermissionDismissedError: "NotAllowedError",
InvalidStateError: "NotAllowedError",
DevicesNotFoundError: "NotFoundError",
ConstraintNotSatisfiedError: "OverconstrainedError",
TrackStartError: "NotReadableError",
MediaDeviceFailedDueToShutdown: "NotAllowedError",
MediaDeviceKillSwitchOn: "NotAllowedError",
TabCaptureError: "AbortError",
ScreenCaptureError: "AbortError",
DeviceCaptureError: "AbortError"
} [e.name] || e.name,
message: e.message,
constraint: e.constraint || e.constraintName,
toString() {
return this.name + (this.message && ": ") + this.message
}
}
};
if (n.getUserMedia = function(e, t, r) {
i(e, e => {
n.webkitGetUserMedia(e, t, e => {
r && r(o(e))
})
})
}.bind(n), n.mediaDevices.getUserMedia) {
const e = n.mediaDevices.getUserMedia.bind(n.mediaDevices);
n.mediaDevices.getUserMedia = function(t) {
return i(t, t => e(t).then(e => {
if (t.audio && !e.getAudioTracks().length || t.video && !e.getVideoTracks().length) throw e.getTracks().forEach(e => {
e.stop()
}), new DOMException("", "NotFoundError");
return e
}, e => Promise.reject(o(e))))
}
}
}

function d(e, t) {
e.navigator.mediaDevices && "getDisplayMedia" in e.navigator.mediaDevices || e.navigator.mediaDevices && ("function" == typeof t ? e.navigator.mediaDevices.getDisplayMedia = function(n) {
return t(n).then(t => {
const r = n.video && n.video.width,
i = n.video && n.video.height,
o = n.video && n.video.frameRate;
return n.video = {
mandatory: {
chromeMediaSource: "desktop",
chromeMediaSourceId: t,
maxFrameRate: o || 3
}
}, r && (n.video.mandatory.maxWidth = r), i && (n.video.mandatory.maxHeight = i), e.navigator.mediaDevices.getUserMedia(n)
})
} : console.error("shimGetDisplayMedia: getSourceId argument is not a function"))
}

function l(e) {
e.MediaStream = e.MediaStream || e.webkitMediaStream
}

function f(e) {
if ("object" == typeof e && e.RTCPeerConnection && !("ontrack" in e.RTCPeerConnection.prototype)) {
Object.defineProperty(e.RTCPeerConnection.prototype, "ontrack", {
get() {
return this._ontrack
},
set(e) {
this._ontrack && this.removeEventListener("track", this._ontrack), this.addEventListener("track", this._ontrack = e)
},
enumerable: !0,
configurable: !0
});
const t = e.RTCPeerConnection.prototype.setRemoteDescription;
e.RTCPeerConnection.prototype.setRemoteDescription = function() {
return this._ontrackpoly || (this._ontrackpoly = t => {
t.stream.addEventListener("addtrack", n => {
let r;
r = e.RTCPeerConnection.prototype.getReceivers ? this.getReceivers().find(e => e.track && e.track.id === n.track.id) : {
track: n.track
};
const i = new Event("track");
i.track = n.track, i.receiver = r, i.transceiver = {
receiver: r
}, i.streams = [t.stream], this.dispatchEvent(i)
}), t.stream.getTracks().forEach(n => {
let r;
r = e.RTCPeerConnection.prototype.getReceivers ? this.getReceivers().find(e => e.track && e.track.id === n.id) : {
track: n
};
const i = new Event("track");
i.track = n, i.receiver = r, i.transceiver = {
receiver: r
}, i.streams = [t.stream], this.dispatchEvent(i)
})
}, this.addEventListener("addstream", this._ontrackpoly)), t.apply(this, arguments)
}
} else c.wrapPeerConnectionEvent(e, "track", e => (e.transceiver || Object.defineProperty(e, "transceiver", {
value: {
receiver: e.receiver
}
}), e))
}

function p(e) {
if ("object" == typeof e && e.RTCPeerConnection && !("getSenders" in e.RTCPeerConnection.prototype) && "createDTMFSender" in e.RTCPeerConnection.prototype) {
const t = function(e, t) {
return {
track: t,
get dtmf() {
return void 0 === this._dtmf && ("audio" === t.kind ? this._dtmf = e.createDTMFSender(t) : this._dtmf = null), this._dtmf
},
_pc: e
}
};
if (!e.RTCPeerConnection.prototype.getSenders) {
e.RTCPeerConnection.prototype.getSenders = function() {
return this._senders = this._senders || [], this._senders.slice()
};
const n = e.RTCPeerConnection.prototype.addTrack;
e.RTCPeerConnection.prototype.addTrack = function(e, r) {
let i = n.apply(this, arguments);
return i || (i = t(this, e), this._senders.push(i)), i
};
const r = e.RTCPeerConnection.prototype.removeTrack;
e.RTCPeerConnection.prototype.removeTrack = function(e) {
r.apply(this, arguments);
const t = this._senders.indexOf(e); - 1 !== t && this._senders.splice(t, 1)
}
}
const n = e.RTCPeerConnection.prototype.addStream;
e.RTCPeerConnection.prototype.addStream = function(e) {
this._senders = this._senders || [], n.apply(this, [e]), e.getTracks().forEach(e => {
this._senders.push(t(this, e))
})
};
const r = e.RTCPeerConnection.prototype.removeStream;
e.RTCPeerConnection.prototype.removeStream = function(e) {
this._senders = this._senders || [], r.apply(this, [e]), e.getTracks().forEach(e => {
const t = this._senders.find(t => t.track === e);
t && this._senders.splice(this._senders.indexOf(t), 1)
})
}
} else if ("object" == typeof e && e.RTCPeerConnection && "getSenders" in e.RTCPeerConnection.prototype && "createDTMFSender" in e.RTCPeerConnection.prototype && e.RTCRtpSender && !("dtmf" in e.RTCRtpSender.prototype)) {
const t = e.RTCPeerConnection.prototype.getSenders;
e.RTCPeerConnection.prototype.getSenders = function() {
const e = t.apply(this, []);
return e.forEach(e => e._pc = this), e
}, Object.defineProperty(e.RTCRtpSender.prototype, "dtmf", {
get() {
return void 0 === this._dtmf && ("audio" === this.track.kind ? this._dtmf = this._pc.createDTMFSender(this.track) : this._dtmf = null), this._dtmf
}
})
}
}

function g(e) {
if (!e.RTCPeerConnection) return;
const t = e.RTCPeerConnection.prototype.getStats;
e.RTCPeerConnection.prototype.getStats = function() {
const [e, n, r] = arguments;
if (arguments.length > 0 && "function" == typeof e) return t.apply(this, arguments);
if (0 === t.length && (0 === arguments.length || "function" != typeof e)) return t.apply(this, []);
const i = function(e) {
const t = {};
return e.result().forEach(e => {
const n = {
id: e.id,
timestamp: e.timestamp,
type: {
localcandidate: "local-candidate",
remotecandidate: "remote-candidate"
} [e.type] || e.type
};
e.names().forEach(t => {
n[t] = e.stat(t)
}), t[n.id] = n
}), t
},
o = function(e) {
return new Map(Object.keys(e).map(t => [t, e[t]]))
};
if (arguments.length >= 2) {
const r = function(e) {
n(o(i(e)))
};
return t.apply(this, [r, e])
}
return new Promise((e, n) => {
t.apply(this, [function(t) {
e(o(i(t)))
}, n])
}).then(n, r)
}
}

function v(e) {
if (!("object" == typeof e && e.RTCPeerConnection && e.RTCRtpSender && e.RTCRtpReceiver)) return;
if (!("getStats" in e.RTCRtpSender.prototype)) {
const t = e.RTCPeerConnection.prototype.getSenders;
t && (e.RTCPeerConnection.prototype.getSenders = function() {
const e = t.apply(this, []);
return e.forEach(e => e._pc = this), e
});
const n = e.RTCPeerConnection.prototype.addTrack;
n && (e.RTCPeerConnection.prototype.addTrack = function() {
const e = n.apply(this, arguments);
return e._pc = this, e
}), e.RTCRtpSender.prototype.getStats = function() {
const e = this;
return this._pc.getStats().then(t => c.filterStats(t, e.track, !0))
}
}
if (!("getStats" in e.RTCRtpReceiver.prototype)) {
const t = e.RTCPeerConnection.prototype.getReceivers;
t && (e.RTCPeerConnection.prototype.getReceivers = function() {
const e = t.apply(this, []);
return e.forEach(e => e._pc = this), e
}), c.wrapPeerConnectionEvent(e, "track", e => (e.receiver._pc = e.srcElement, e)), e.RTCRtpReceiver.prototype.getStats = function() {
const e = this;
return this._pc.getStats().then(t => c.filterStats(t, e.track, !1))
}
}
if (!("getStats" in e.RTCRtpSender.prototype) || !("getStats" in e.RTCRtpReceiver.prototype)) return;
const t = e.RTCPeerConnection.prototype.getStats;
e.RTCPeerConnection.prototype.getStats = function() {
if (arguments.length > 0 && arguments[0] instanceof e.MediaStreamTrack) {
const e = arguments[0];
let t, n, r;
return this.getSenders().forEach(n => {
n.track === e && (t ? r = !0 : t = n)
}), this.getReceivers().forEach(t => (t.track === e && (n ? r = !0 : n = t), t.track === e)), r || t && n ? Promise.reject(new DOMException("There are more than one sender or receiver for the track.", "InvalidAccessError")) : t ? t.getStats() : n ? n.getStats() : Promise.reject(new DOMException("There is no sender or receiver for the track.", "InvalidAccessError"))
}
return t.apply(this, arguments)
}
}

function m(e) {
e.RTCPeerConnection.prototype.getLocalStreams = function() {
return this._shimmedLocalStreams = this._shimmedLocalStreams || {}, Object.keys(this._shimmedLocalStreams).map(e => this._shimmedLocalStreams[e][0])
};
const t = e.RTCPeerConnection.prototype.addTrack;
e.RTCPeerConnection.prototype.addTrack = function(e, n) {
if (!n) return t.apply(this, arguments);
this._shimmedLocalStreams = this._shimmedLocalStreams || {};
const r = t.apply(this, arguments);
return this._shimmedLocalStreams[n.id] ? -1 === this._shimmedLocalStreams[n.id].indexOf(r) && this._shimmedLocalStreams[n.id].push(r) : this._shimmedLocalStreams[n.id] = [n, r], r
};
const n = e.RTCPeerConnection.prototype.addStream;
e.RTCPeerConnection.prototype.addStream = function(e) {
this._shimmedLocalStreams = this._shimmedLocalStreams || {}, e.getTracks().forEach(e => {
if (this.getSenders().find(t => t.track === e)) throw new DOMException("Track already exists.", "InvalidAccessError")
});
const t = this.getSenders();
n.apply(this, arguments);
const r = this.getSenders().filter(e => -1 === t.indexOf(e));
this._shimmedLocalStreams[e.id] = [e].concat(r)
};
const r = e.RTCPeerConnection.prototype.removeStream;
e.RTCPeerConnection.prototype.removeStream = function(e) {
return this._shimmedLocalStreams = this._shimmedLocalStreams || {}, delete this._shimmedLocalStreams[e.id], r.apply(this, arguments)
};
const i = e.RTCPeerConnection.prototype.removeTrack;
e.RTCPeerConnection.prototype.removeTrack = function(e) {
return this._shimmedLocalStreams = this._shimmedLocalStreams || {}, e && Object.keys(this._shimmedLocalStreams).forEach(t => {
const n = this._shimmedLocalStreams[t].indexOf(e); - 1 !== n && this._shimmedLocalStreams[t].splice(n, 1), 1 === this._shimmedLocalStreams[t].length && delete this._shimmedLocalStreams[t]
}), i.apply(this, arguments)
}
}

function y(e, t) {
if (!e.RTCPeerConnection) return;
if (e.RTCPeerConnection.prototype.addTrack && t.version >= 65) return m(e);
const n = e.RTCPeerConnection.prototype.getLocalStreams;
e.RTCPeerConnection.prototype.getLocalStreams = function() {
const e = n.apply(this);
return this._reverseStreams = this._reverseStreams || {}, e.map(e => this._reverseStreams[e.id])
};
const r = e.RTCPeerConnection.prototype.addStream;
e.RTCPeerConnection.prototype.addStream = function(t) {
if (this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {}, t.getTracks().forEach(e => {
if (this.getSenders().find(t => t.track === e)) throw new DOMException("Track already exists.", "InvalidAccessError")
}), !this._reverseStreams[t.id]) {
const n = new e.MediaStream(t.getTracks());
this._streams[t.id] = n, this._reverseStreams[n.id] = t, t = n
}
r.apply(this, [t])
};
const i = e.RTCPeerConnection.prototype.removeStream;

function o(e, t) {
let n = t.sdp;
return Object.keys(e._reverseStreams || []).forEach(t => {
const r = e._reverseStreams[t],
i = e._streams[r.id];
n = n.replace(new RegExp(i.id, "g"), r.id)
}), new RTCSessionDescription({
type: t.type,
sdp: n
})
}

function a(e, t) {
let n = t.sdp;
return Object.keys(e._reverseStreams || []).forEach(t => {
const r = e._reverseStreams[t],
i = e._streams[r.id];
n = n.replace(new RegExp(r.id, "g"), i.id)
}), new RTCSessionDescription({
type: t.type,
sdp: n
})
}
e.RTCPeerConnection.prototype.removeStream = function(e) {
this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {}, i.apply(this, [this._streams[e.id] || e]), delete this._reverseStreams[this._streams[e.id] ? this._streams[e.id].id : e.id], delete this._streams[e.id]
}, e.RTCPeerConnection.prototype.addTrack = function(t, n) {
if ("closed" === this.signalingState) throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.", "InvalidStateError");
const r = [].slice.call(arguments, 1);
if (1 !== r.length || !r[0].getTracks().find(e => e === t)) throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.", "NotSupportedError");
const i = this.getSenders().find(e => e.track === t);
if (i) throw new DOMException("Track already exists.", "InvalidAccessError");
this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {};
const o = this._streams[n.id];
if (o) o.addTrack(t), Promise.resolve().then(() => {
this.dispatchEvent(new Event("negotiationneeded"))
});
else {
const r = new e.MediaStream([t]);
this._streams[n.id] = r, this._reverseStreams[r.id] = n, this.addStream(r)
}
return this.getSenders().find(e => e.track === t)
}, ["createOffer", "createAnswer"].forEach((function(t) {
const n = e.RTCPeerConnection.prototype[t],
r = {
[t]() {
const e = arguments;
return arguments.length && "function" == typeof arguments[0] ? n.apply(this, [t => {
const n = o(this, t);
e[0].apply(null, [n])
}, t => {
e[1] && e[1].apply(null, t)
}, arguments[2]]) : n.apply(this, arguments).then(e => o(this, e))
}
};
e.RTCPeerConnection.prototype[t] = r[t]
}));
const s = e.RTCPeerConnection.prototype.setLocalDescription;
e.RTCPeerConnection.prototype.setLocalDescription = function() {
return arguments.length && arguments[0].type ? (arguments[0] = a(this, arguments[0]), s.apply(this, arguments)) : s.apply(this, arguments)
};
const c = Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype, "localDescription");
Object.defineProperty(e.RTCPeerConnection.prototype, "localDescription", {
get() {
const e = c.get.apply(this);
return "" === e.type ? e : o(this, e)
}
}), e.RTCPeerConnection.prototype.removeTrack = function(e) {
if ("closed" === this.signalingState) throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.", "InvalidStateError");
if (!e._pc) throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.", "TypeError");
if (!(e._pc === this)) throw new DOMException("Sender was not created by this connection.", "InvalidAccessError");
let t;
this._streams = this._streams || {}, Object.keys(this._streams).forEach(n => {
this._streams[n].getTracks().find(t => e.track === t) && (t = this._streams[n])
}), t && (1 === t.getTracks().length ? this.removeStream(this._reverseStreams[t.id]) : t.removeTrack(e.track), this.dispatchEvent(new Event("negotiationneeded")))
}
}

function C(e, t) {
!e.RTCPeerConnection && e.webkitRTCPeerConnection && (e.RTCPeerConnection = e.webkitRTCPeerConnection), e.RTCPeerConnection && t.version < 53 && ["setLocalDescription", "setRemoteDescription", "addIceCandidate"].forEach((function(t) {
const n = e.RTCPeerConnection.prototype[t],
r = {
[t]() {
return arguments[0] = new("addIceCandidate" === t ? e.RTCIceCandidate : e.RTCSessionDescription)(arguments[0]), n.apply(this, arguments)
}
};
e.RTCPeerConnection.prototype[t] = r[t]
}))
}

function w(e, t) {
c.wrapPeerConnectionEvent(e, "negotiationneeded", e => {
const n = e.target;
if (!(t.version < 72 || n.getConfiguration && "plan-b" === n.getConfiguration().sdpSemantics) || "stable" === n.signalingState) return e
})
}
var _ = n(135),
b = n.n(_);

function E(e) {
const t = e && e.navigator,
n = t.mediaDevices.getUserMedia.bind(t.mediaDevices);
t.mediaDevices.getUserMedia = function(e) {
return n(e).catch(e => Promise.reject(function(e) {
return {
name: {
PermissionDeniedError: "NotAllowedError"
} [e.name] || e.name,
message: e.message,
constraint: e.constraint,
toString() {
return this.name
}
}
}(e)))
}
}

function T(e) {
"getDisplayMedia" in e.navigator && e.navigator.mediaDevices && (e.navigator.mediaDevices && "getDisplayMedia" in e.navigator.mediaDevices || (e.navigator.mediaDevices.getDisplayMedia = e.navigator.getDisplayMedia.bind(e.navigator)))
}

function S(e, t) {
if (e.RTCIceGatherer && (e.RTCIceCandidate || (e.RTCIceCandidate = function(e) {
return e
}), e.RTCSessionDescription || (e.RTCSessionDescription = function(e) {
return e
}), t.version < 15025)) {
const t = Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype, "enabled");
Object.defineProperty(e.MediaStreamTrack.prototype, "enabled", {
set(e) {
t.set.call(this, e);
const n = new Event("enabled");
n.enabled = e, this.dispatchEvent(n)
}
})
}
e.RTCRtpSender && !("dtmf" in e.RTCRtpSender.prototype) && Object.defineProperty(e.RTCRtpSender.prototype, "dtmf", {
get() {
return void 0 === this._dtmf && ("audio" === this.track.kind ? this._dtmf = new e.RTCDtmfSender(this) : "video" === this.track.kind && (this._dtmf = null)), this._dtmf
}
}), e.RTCDtmfSender && !e.RTCDTMFSender && (e.RTCDTMFSender = e.RTCDtmfSender);
const n = b()(e, t.version);
e.RTCPeerConnection = function(e) {
return e && e.iceServers && (e.iceServers = function(e, t) {
let n = !1;
return (e = JSON.parse(JSON.stringify(e))).filter(e => {
if (e && (e.urls || e.url)) {
let t = e.urls || e.url;
e.url && !e.urls && c.deprecated("RTCIceServer.url", "RTCIceServer.urls");
const r = "string" == typeof t;
return r && (t = [t]), t = t.filter(e => {
if (0 === e.indexOf("stun:")) return !1;
const t = e.startsWith("turn") && !e.startsWith("turn:[") && e.includes("transport=udp");
return t && !n ? (n = !0, !0) : t && !n
}), delete e.url, e.urls = r ? t[0] : t, !!t.length
}
})
}(e.iceServers, t.version), c.log("ICE servers after filtering:", e.iceServers)), new n(e)
}, e.RTCPeerConnection.prototype = n.prototype
}

function R(e) {
e.RTCRtpSender && !("replaceTrack" in e.RTCRtpSender.prototype) && (e.RTCRtpSender.prototype.replaceTrack = e.RTCRtpSender.prototype.setTrack)
}

function x(e, t) {
const n = e && e.navigator,
r = e && e.MediaStreamTrack;
if (n.getUserMedia = function(e, t, r) {
c.deprecated("navigator.getUserMedia", "navigator.mediaDevices.getUserMedia"), n.mediaDevices.getUserMedia(e).then(t, r)
}, !(t.version > 55 && "autoGainControl" in n.mediaDevices.getSupportedConstraints())) {
const e = function(e, t, n) {
t in e && !(n in e) && (e[n] = e[t], delete e[t])
},
t = n.mediaDevices.getUserMedia.bind(n.mediaDevices);
if (n.mediaDevices.getUserMedia = function(n) {
return "object" == typeof n && "object" == typeof n.audio && (n = JSON.parse(JSON.stringify(n)), e(n.audio, "autoGainControl", "mozAutoGainControl"), e(n.audio, "noiseSuppression", "mozNoiseSuppression")), t(n)
}, r && r.prototype.getSettings) {
const t = r.prototype.getSettings;
r.prototype.getSettings = function() {
const n = t.apply(this, arguments);
return e(n, "mozAutoGainControl", "autoGainControl"), e(n, "mozNoiseSuppression", "noiseSuppression"), n
}
}
if (r && r.prototype.applyConstraints) {
const t = r.prototype.applyConstraints;
r.prototype.applyConstraints = function(n) {
return "audio" === this.kind && "object" == typeof n && (n = JSON.parse(JSON.stringify(n)), e(n, "autoGainControl", "mozAutoGainControl"), e(n, "noiseSuppression", "mozNoiseSuppression")), t.apply(this, [n])
}
}
}
}

function k(e, t) {
e.navigator.mediaDevices && "getDisplayMedia" in e.navigator.mediaDevices || e.navigator.mediaDevices && (e.navigator.mediaDevices.getDisplayMedia = function(n) {
if (!n || !n.video) {
const e = new DOMException("getDisplayMedia without video constraints is undefined");
return e.name = "NotFoundError", e.code = 8, Promise.reject(e)
}
return !0 === n.video ? n.video = {
mediaSource: t
} : n.video.mediaSource = t, e.navigator.mediaDevices.getUserMedia(n)
})
}

function P(e) {
"object" == typeof e && e.RTCTrackEvent && "receiver" in e.RTCTrackEvent.prototype && !("transceiver" in e.RTCTrackEvent.prototype) && Object.defineProperty(e.RTCTrackEvent.prototype, "transceiver", {
get() {
return {
receiver: this.receiver
}
}
})
}

function A(e, t) {
if ("object" != typeof e || !e.RTCPeerConnection && !e.mozRTCPeerConnection) return;
!e.RTCPeerConnection && e.mozRTCPeerConnection && (e.RTCPeerConnection = e.mozRTCPeerConnection), t.version < 53 && ["setLocalDescription", "setRemoteDescription", "addIceCandidate"].forEach((function(t) {
const n = e.RTCPeerConnection.prototype[t],
r = {
[t]() {
return arguments[0] = new("addIceCandidate" === t ? e.RTCIceCandidate : e.RTCSessionDescription)(arguments[0]), n.apply(this, arguments)
}
};
e.RTCPeerConnection.prototype[t] = r[t]
}));
const n = {
inboundrtp: "inbound-rtp",
outboundrtp: "outbound-rtp",
candidatepair: "candidate-pair",
localcandidate: "local-candidate",
remotecandidate: "remote-candidate"
},
r = e.RTCPeerConnection.prototype.getStats;
e.RTCPeerConnection.prototype.getStats = function() {
const [e, i, o] = arguments;
return r.apply(this, [e || null]).then(e => {
if (t.version < 53 && !i) try {
e.forEach(e => {
e.type = n[e.type] || e.type
})
} catch (t) {
if ("TypeError" !== t.name) throw t;
e.forEach((t, r) => {
e.set(r, Object.assign({}, t, {
type: n[t.type] || t.type
}))
})
}
return e
}).then(i, o)
}
}

function I(e) {
if ("object" != typeof e || !e.RTCPeerConnection || !e.RTCRtpSender) return;
if (e.RTCRtpSender && "getStats" in e.RTCRtpSender.prototype) return;
const t = e.RTCPeerConnection.prototype.getSenders;
t && (e.RTCPeerConnection.prototype.getSenders = function() {
const e = t.apply(this, []);
return e.forEach(e => e._pc = this), e
});
const n = e.RTCPeerConnection.prototype.addTrack;
n && (e.RTCPeerConnection.prototype.addTrack = function() {
const e = n.apply(this, arguments);
return e._pc = this, e
}), e.RTCRtpSender.prototype.getStats = function() {
return this.track ? this._pc.getStats(this.track) : Promise.resolve(new Map)
}
}

function O(e) {
if ("object" != typeof e || !e.RTCPeerConnection || !e.RTCRtpSender) return;
if (e.RTCRtpSender && "getStats" in e.RTCRtpReceiver.prototype) return;
const t = e.RTCPeerConnection.prototype.getReceivers;
t && (e.RTCPeerConnection.prototype.getReceivers = function() {
const e = t.apply(this, []);
return e.forEach(e => e._pc = this), e
}), c.wrapPeerConnectionEvent(e, "track", e => (e.receiver._pc = e.srcElement, e)), e.RTCRtpReceiver.prototype.getStats = function() {
return this._pc.getStats(this.track)
}
}

function M(e) {
e.RTCPeerConnection && !("removeStream" in e.RTCPeerConnection.prototype) && (e.RTCPeerConnection.prototype.removeStream = function(e) {
c.deprecated("removeStream", "removeTrack"), this.getSenders().forEach(t => {
t.track && e.getTracks().includes(t.track) && this.removeTrack(t)
})
})
}

function D(e) {
e.DataChannel && !e.RTCDataChannel && (e.RTCDataChannel = e.DataChannel)
}

function N(e) {
if ("object" != typeof e || !e.RTCPeerConnection) return;
const t = e.RTCPeerConnection.prototype.addTransceiver;
t && (e.RTCPeerConnection.prototype.addTransceiver = function() {
this.setParametersPromises = [];
const e = arguments[1],
n = e && "sendEncodings" in e;
n && e.sendEncodings.forEach(e => {
if ("rid" in e) {
if (!/^[a-z0-9]{0,16}$/i.test(e.rid)) throw new TypeError("Invalid RID value provided.")
}
if ("scaleResolutionDownBy" in e && !(parseFloat(e.scaleResolutionDownBy) >= 1)) throw new RangeError("scale_resolution_down_by must be >= 1.0");
if ("maxFramerate" in e && !(parseFloat(e.maxFramerate) >= 0)) throw new RangeError("max_framerate must be >= 0.0")
});
const r = t.apply(this, arguments);
if (n) {
const {
sender: t
} = r, n = t.getParameters();
(!("encodings" in n) || 1 === n.encodings.length && 0 === Object.keys(n.encodings[0]).length) && (n.encodings = e.sendEncodings, t.sendEncodings = e.sendEncodings, this.setParametersPromises.push(t.setParameters(n).then(() => {
delete t.sendEncodings
}).catch(() => {
delete t.sendEncodings
})))
}
return r
})
}

function L(e) {
if ("object" != typeof e || !e.RTCRtpSender) return;
const t = e.RTCRtpSender.prototype.getParameters;
t && (e.RTCRtpSender.prototype.getParameters = function() {
const e = t.apply(this, arguments);
return "encodings" in e || (e.encodings = [].concat(this.sendEncodings || [{}])), e
})
}

function j(e) {
if ("object" != typeof e || !e.RTCPeerConnection) return;
const t = e.RTCPeerConnection.prototype.createOffer;
e.RTCPeerConnection.prototype.createOffer = function() {
return this.setParametersPromises && this.setParametersPromises.length ? Promise.all(this.setParametersPromises).then(() => t.apply(this, arguments)).finally(() => {
this.setParametersPromises = []
}) : t.apply(this, arguments)
}
}

function F(e) {
if ("object" != typeof e || !e.RTCPeerConnection) return;
const t = e.RTCPeerConnection.prototype.createAnswer;
e.RTCPeerConnection.prototype.createAnswer = function() {
return this.setParametersPromises && this.setParametersPromises.length ? Promise.all(this.setParametersPromises).then(() => t.apply(this, arguments)).finally(() => {
this.setParametersPromises = []
}) : t.apply(this, arguments)
}
}

function V(e) {
if ("object" == typeof e && e.RTCPeerConnection) {
if ("getLocalStreams" in e.RTCPeerConnection.prototype || (e.RTCPeerConnection.prototype.getLocalStreams = function() {
return this._localStreams || (this._localStreams = []), this._localStreams
}), !("addStream" in e.RTCPeerConnection.prototype)) {
const t = e.RTCPeerConnection.prototype.addTrack;
e.RTCPeerConnection.prototype.addStream = function(e) {
this._localStreams || (this._localStreams = []), this._localStreams.includes(e) || this._localStreams.push(e), e.getAudioTracks().forEach(n => t.call(this, n, e)), e.getVideoTracks().forEach(n => t.call(this, n, e))
}, e.RTCPeerConnection.prototype.addTrack = function(e, ...n) {
return n && n.forEach(e => {
this._localStreams ? this._localStreams.includes(e) || this._localStreams.push(e) : this._localStreams = [e]
}), t.apply(this, arguments)
}
}
"removeStream" in e.RTCPeerConnection.prototype || (e.RTCPeerConnection.prototype.removeStream = function(e) {
this._localStreams || (this._localStreams = []);
const t = this._localStreams.indexOf(e);
if (-1 === t) return;
this._localStreams.splice(t, 1);
const n = e.getTracks();
this.getSenders().forEach(e => {
n.includes(e.track) && this.removeTrack(e)
})
})
}
}

function B(e) {
if ("object" == typeof e && e.RTCPeerConnection && ("getRemoteStreams" in e.RTCPeerConnection.prototype || (e.RTCPeerConnection.prototype.getRemoteStreams = function() {
return this._remoteStreams ? this._remoteStreams : []
}), !("onaddstream" in e.RTCPeerConnection.prototype))) {
Object.defineProperty(e.RTCPeerConnection.prototype, "onaddstream", {
get() {
return this._onaddstream
},
set(e) {
this._onaddstream && (this.removeEventListener("addstream", this._onaddstream), this.removeEventListener("track", this._onaddstreampoly)), this.addEventListener("addstream", this._onaddstream = e), this.addEventListener("track", this._onaddstreampoly = e => {
e.streams.forEach(e => {
if (this._remoteStreams || (this._remoteStreams = []), this._remoteStreams.includes(e)) return;
this._remoteStreams.push(e);
const t = new Event("addstream");
t.stream = e, this.dispatchEvent(t)
})
})
}
});
const t = e.RTCPeerConnection.prototype.setRemoteDescription;
e.RTCPeerConnection.prototype.setRemoteDescription = function() {
const e = this;
return this._onaddstreampoly || this.addEventListener("track", this._onaddstreampoly = function(t) {
t.streams.forEach(t => {
if (e._remoteStreams || (e._remoteStreams = []), e._remoteStreams.indexOf(t) >= 0) return;
e._remoteStreams.push(t);
const n = new Event("addstream");
n.stream = t, e.dispatchEvent(n)
})
}), t.apply(e, arguments)
}
}
}

function U(e) {
if ("object" != typeof e || !e.RTCPeerConnection) return;
const t = e.RTCPeerConnection.prototype,
n = t.createOffer,
r = t.createAnswer,
i = t.setLocalDescription,
o = t.setRemoteDescription,
a = t.addIceCandidate;
t.createOffer = function(e, t) {
const r = arguments.length >= 2 ? arguments[2] : arguments[0],
i = n.apply(this, [r]);
return t ? (i.then(e, t), Promise.resolve()) : i
}, t.createAnswer = function(e, t) {
const n = arguments.length >= 2 ? arguments[2] : arguments[0],
i = r.apply(this, [n]);
return t ? (i.then(e, t), Promise.resolve()) : i
};
let s = function(e, t, n) {
const r = i.apply(this, [e]);
return n ? (r.then(t, n), Promise.resolve()) : r
};
t.setLocalDescription = s, s = function(e, t, n) {
const r = o.apply(this, [e]);
return n ? (r.then(t, n), Promise.resolve()) : r
}, t.setRemoteDescription = s, s = function(e, t, n) {
const r = a.apply(this, [e]);
return n ? (r.then(t, n), Promise.resolve()) : r
}, t.addIceCandidate = s
}

function W(e) {
const t = e && e.navigator;
if (t.mediaDevices && t.mediaDevices.getUserMedia) {
const e = t.mediaDevices,
n = e.getUserMedia.bind(e);
t.mediaDevices.getUserMedia = e => n(q(e))
}!t.getUserMedia && t.mediaDevices && t.mediaDevices.getUserMedia && (t.getUserMedia = function(e, n, r) {
t.mediaDevices.getUserMedia(e).then(n, r)
}.bind(t))
}

function q(e) {
return e && void 0 !== e.video ? Object.assign({}, e, {
video: c.compactObject(e.video)
}) : e
}

function H(e) {
if (!e.RTCPeerConnection) return;
const t = e.RTCPeerConnection;
e.RTCPeerConnection = function(e, n) {
if (e && e.iceServers) {
const t = [];
for (let n = 0; n < e.iceServers.length; n++) {
let r = e.iceServers[n];
!r.hasOwnProperty("urls") && r.hasOwnProperty("url") ? (c.deprecated("RTCIceServer.url", "RTCIceServer.urls"), r = JSON.parse(JSON.stringify(r)), r.urls = r.url, delete r.url, t.push(r)) : t.push(e.iceServers[n])
}
e.iceServers = t
}
return new t(e, n)
}, e.RTCPeerConnection.prototype = t.prototype, "generateCertificate" in t && Object.defineProperty(e.RTCPeerConnection, "generateCertificate", {
get: () => t.generateCertificate
})
}

function z(e) {
"object" == typeof e && e.RTCTrackEvent && "receiver" in e.RTCTrackEvent.prototype && !("transceiver" in e.RTCTrackEvent.prototype) && Object.defineProperty(e.RTCTrackEvent.prototype, "transceiver", {
get() {
return {
receiver: this.receiver
}
}
})
}

function G(e) {
const t = e.RTCPeerConnection.prototype.createOffer;
e.RTCPeerConnection.prototype.createOffer = function(e) {
if (e) {
void 0 !== e.offerToReceiveAudio && (e.offerToReceiveAudio = !!e.offerToReceiveAudio);
const t = this.getTransceivers().find(e => "audio" === e.receiver.track.kind);
!1 === e.offerToReceiveAudio && t ? "sendrecv" === t.direction ? t.setDirection ? t.setDirection("sendonly") : t.direction = "sendonly" : "recvonly" === t.direction && (t.setDirection ? t.setDirection("inactive") : t.direction = "inactive") : !0 !== e.offerToReceiveAudio || t || this.addTransceiver("audio"), void 0 !== e.offerToReceiveVideo && (e.offerToReceiveVideo = !!e.offerToReceiveVideo);
const n = this.getTransceivers().find(e => "video" === e.receiver.track.kind);
!1 === e.offerToReceiveVideo && n ? "sendrecv" === n.direction ? n.setDirection ? n.setDirection("sendonly") : n.direction = "sendonly" : "recvonly" === n.direction && (n.setDirection ? n.setDirection("inactive") : n.direction = "inactive") : !0 !== e.offerToReceiveVideo || n || this.addTransceiver("video")
}
return t.apply(this, arguments)
}
}

function K(e) {
"object" != typeof e || e.AudioContext || (e.AudioContext = e.webkitAudioContext)
}
var Y = n(27),
J = n.n(Y);

function $(e) {
if (!e.RTCIceCandidate || e.RTCIceCandidate && "foundation" in e.RTCIceCandidate.prototype) return;
const t = e.RTCIceCandidate;
e.RTCIceCandidate = function(e) {
if ("object" == typeof e && e.candidate && 0 === e.candidate.indexOf("a=") && ((e = JSON.parse(JSON.stringify(e))).candidate = e.candidate.substr(2)), e.candidate && e.candidate.length) {
const n = new t(e),
r = J.a.parseCandidate(e.candidate),
i = Object.assign(n, r);
return i.toJSON = function() {
return {
candidate: i.candidate,
sdpMid: i.sdpMid,
sdpMLineIndex: i.sdpMLineIndex,
usernameFragment: i.usernameFragment
}
}, i
}
return new t(e)
}, e.RTCIceCandidate.prototype = t.prototype, c.wrapPeerConnectionEvent(e, "icecandidate", t => (t.candidate && Object.defineProperty(t, "candidate", {
value: new e.RTCIceCandidate(t.candidate),
writable: "false"
}), t))
}

function X(e, t) {
if (!e.RTCPeerConnection) return;
"sctp" in e.RTCPeerConnection.prototype || Object.defineProperty(e.RTCPeerConnection.prototype, "sctp", {
get() {
return void 0 === this._sctp ? null : this._sctp
}
});
const n = function(e) {
if (!e || !e.sdp) return !1;
const t = J.a.splitSections(e.sdp);
return t.shift(), t.some(e => {
const t = J.a.parseMLine(e);
return t && "application" === t.kind && -1 !== t.protocol.indexOf("SCTP")
})
},
r = function(e) {
const t = e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);
if (null === t || t.length < 2) return -1;
const n = parseInt(t[1], 10);
return n != n ? -1 : n
},
i = function(e) {
let n = 65536;
return "firefox" === t.browser && (n = t.version < 57 ? -1 === e ? 16384 : 2147483637 : t.version < 60 ? 57 === t.version ? 65535 : 65536 : 2147483637), n
},
o = function(e, n) {
let r = 65536;
"firefox" === t.browser && 57 === t.version && (r = 65535);
const i = J.a.matchPrefix(e.sdp, "a=max-message-size:");
return i.length > 0 ? r = parseInt(i[0].substr(19), 10) : "firefox" === t.browser && -1 !== n && (r = 2147483637), r
},
a = e.RTCPeerConnection.prototype.setRemoteDescription;
e.RTCPeerConnection.prototype.setRemoteDescription = function() {
if (this._sctp = null, "chrome" === t.browser && t.version >= 76) {
const {
sdpSemantics: e
} = this.getConfiguration();
"plan-b" === e && Object.defineProperty(this, "sctp", {
get() {
return void 0 === this._sctp ? null : this._sctp
},
enumerable: !0,
configurable: !0
})
}
if (n(arguments[0])) {
const e = r(arguments[0]),
t = i(e),
n = o(arguments[0], e);
let a;
a = 0 === t && 0 === n ? Number.POSITIVE_INFINITY : 0 === t || 0 === n ? Math.max(t, n) : Math.min(t, n);
const s = {};
Object.defineProperty(s, "maxMessageSize", {
get: () => a
}), this._sctp = s
}
return a.apply(this, arguments)
}
}

function Z(e) {
if (!e.RTCPeerConnection || !("createDataChannel" in e.RTCPeerConnection.prototype)) return;

function t(e, t) {
const n = e.send;
e.send = function() {
const r = arguments[0],
i = r.length || r.size || r.byteLength;
if ("open" === e.readyState && t.sctp && i > t.sctp.maxMessageSize) throw new TypeError("Message too large (can send a maximum of " + t.sctp.maxMessageSize + " bytes)");
return n.apply(e, arguments)
}
}
const n = e.RTCPeerConnection.prototype.createDataChannel;
e.RTCPeerConnection.prototype.createDataChannel = function() {
const e = n.apply(this, arguments);
return t(e, this), e
}, c.wrapPeerConnectionEvent(e, "datachannel", e => (t(e.channel, e.target), e))
}

function Q(e) {
if (!e.RTCPeerConnection || "connectionState" in e.RTCPeerConnection.prototype) return;
const t = e.RTCPeerConnection.prototype;
Object.defineProperty(t, "connectionState", {
get() {
return {
completed: "connected",
checking: "connecting"
} [this.iceConnectionState] || this.iceConnectionState
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(t, "onconnectionstatechange", {
get() {
return this._onconnectionstatechange || null
},
set(e) {
this._onconnectionstatechange && (this.removeEventListener("connectionstatechange", this._onconnectionstatechange), delete this._onconnectionstatechange), e && this.addEventListener("connectionstatechange", this._onconnectionstatechange = e)
},
enumerable: !0,
configurable: !0
}), ["setLocalDescription", "setRemoteDescription"].forEach(e => {
const n = t[e];
t[e] = function() {
return this._connectionstatechangepoly || (this._connectionstatechangepoly = e => {
const t = e.target;
if (t._lastConnectionState !== t.connectionState) {
t._lastConnectionState = t.connectionState;
const n = new Event("connectionstatechange", e);
t.dispatchEvent(n)
}
return e
}, this.addEventListener("iceconnectionstatechange", this._connectionstatechangepoly)), n.apply(this, arguments)
}
})
}

function ee(e, t) {
if (!e.RTCPeerConnection) return;
if ("chrome" === t.browser && t.version >= 71) return;
if ("safari" === t.browser && t.version >= 605) return;
const n = e.RTCPeerConnection.prototype.setRemoteDescription;
e.RTCPeerConnection.prototype.setRemoteDescription = function(t) {
if (t && t.sdp && -1 !== t.sdp.indexOf("\na=extmap-allow-mixed")) {
const n = t.sdp.split("\n").filter(e => "a=extmap-allow-mixed" !== e.trim()).join("\n");
e.RTCSessionDescription && t instanceof e.RTCSessionDescription ? arguments[0] = new e.RTCSessionDescription({
type: t.type,
sdp: n
}) : t.sdp = n
}
return n.apply(this, arguments)
}
}

function te(e, t) {
if (!e.RTCPeerConnection || !e.RTCPeerConnection.prototype) return;
const n = e.RTCPeerConnection.prototype.addIceCandidate;
n && 0 !== n.length && (e.RTCPeerConnection.prototype.addIceCandidate = function() {
return arguments[0] ? ("chrome" === t.browser && t.version < 78 || "firefox" === t.browser && t.version < 68 || "safari" === t.browser) && arguments[0] && "" === arguments[0].candidate ? Promise.resolve() : n.apply(this, arguments) : (arguments[1] && arguments[1].apply(null), Promise.resolve())
})
}
const ne = function({
window: e
} = {}, t = {
shimChrome: !0,
shimFirefox: !0,
shimEdge: !0,
shimSafari: !0
}) {
const n = c.log,
u = c.detectBrowser(e),
d = {
browserDetails: u,
commonShim: s,
extractVersion: c.extractVersion,
disableLog: c.disableLog,
disableWarnings: c.disableWarnings
};
switch (u.browser) {
case "chrome":
if (!r || !C || !t.shimChrome) return n("Chrome shim is not included in this adapter release."), d;
if (null === u.version) return n("Chrome shim can not determine version, not shimming."), d;
n("adapter.js shimming chrome."), d.browserShim = r, te(e, u), h(e, u), l(e), C(e, u), f(e), y(e, u), p(e), g(e), v(e), w(e, u), $(e), Q(e), X(e, u), Z(e), ee(e, u);
break;
case "firefox":
if (!o || !A || !t.shimFirefox) return n("Firefox shim is not included in this adapter release."), d;
n("adapter.js shimming firefox."), d.browserShim = o, te(e, u), x(e, u), A(e, u), P(e), M(e), I(e), O(e), D(e), N(e), L(e), j(e), F(e), $(e), Q(e), X(e, u), Z(e);
break;
case "edge":
if (!i || !S || !t.shimEdge) return n("MS edge shim is not included in this adapter release."), d;
n("adapter.js shimming edge."), d.browserShim = i, E(e), T(e), S(e, u), R(e), X(e, u), Z(e);
break;
case "safari":
if (!a || !t.shimSafari) return n("Safari shim is not included in this adapter release."), d;
n("adapter.js shimming safari."), d.browserShim = a, te(e, u), H(e), G(e), U(e), V(e), B(e), z(e), W(e), K(e), $(e), X(e, u), Z(e), ee(e, u);
break;
default:
n("Unsupported browser!")
}
return d
}({
window: "undefined" == typeof window ? void 0 : window
});
t.default = ne
}, function(e, t, n) {
var r = n(169),
i = n(170),
o = i;
o.v1 = r, o.v4 = i, e.exports = o
}, function(e, t, n) {
"use strict";
var r = this && this.__createBinding || (Object.create ? function(e, t, n, r) {
void 0 === r && (r = n), Object.defineProperty(e, r, {
enumerable: !0,
get: function() {
return t[n]
}
})
} : function(e, t, n, r) {
void 0 === r && (r = n), e[r] = t[n]
}),
i = this && this.__exportStar || function(e, t) {
for (var n in e) "default" === n || Object.prototype.hasOwnProperty.call(t, n) || r(t, e, n)
};
Object.defineProperty(t, "__esModule", {
value: !0
}), i(n(234), t), i(n(236), t), i(n(241), t)
}, function(e, t, n) {
var r, i, o = n(148),
a = n(149),
s = 0,
c = 0;
e.exports = function(e, t, n) {
var u = t && n || 0,
h = t || [],
d = (e = e || {}).node || r,
l = void 0 !== e.clockseq ? e.clockseq : i;
if (null == d || null == l) {
var f = o();
null == d && (d = r = [1 | f[0], f[1], f[2], f[3], f[4], f[5]]), null == l && (l = i = 16383 & (f[6] << 8 | f[7]))
}
var p = void 0 !== e.msecs ? e.msecs : (new Date).getTime(),
g = void 0 !== e.nsecs ? e.nsecs : c + 1,
v = p - s + (g - c) / 1e4;
if (v < 0 && void 0 === e.clockseq && (l = l + 1 & 16383), (v < 0 || p > s) && void 0 === e.nsecs && (g = 0), g >= 1e4) throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
s = p, c = g, i = l;
var m = (1e4 * (268435455 & (p += 122192928e5)) + g) % 4294967296;
h[u++] = m >>> 24 & 255, h[u++] = m >>> 16 & 255, h[u++] = m >>> 8 & 255, h[u++] = 255 & m;
var y = p / 4294967296 * 1e4 & 268435455;
h[u++] = y >>> 8 & 255, h[u++] = 255 & y, h[u++] = y >>> 24 & 15 | 16, h[u++] = y >>> 16 & 255, h[u++] = l >>> 8 | 128, h[u++] = 255 & l;
for (var C = 0; C < 6; ++C) h[u + C] = d[C];
return t || a(h)
}
}, function(e, t, n) {
var r = n(148),
i = n(149);
e.exports = function(e, t, n) {
var o = t && n || 0;
"string" == typeof e && (t = "binary" === e ? new Array(16) : null, e = null);
var a = (e = e || {}).random || (e.rng || r)();
if (a[6] = 15 & a[6] | 64, a[8] = 63 & a[8] | 128, t)
for (var s = 0; s < 16; ++s) t[o + s] = a[s];
return t || i(a)
}
}, , , , , , , , , , , , , , , function(e, t, n) {
(function(r) {
t.formatArgs = function(t) {
if (t[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + t[0] + (this.useColors ? "%c " : " ") + "+" + e.exports.humanize(this.diff), !this.useColors) return;
const n = "color: " + this.color;
t.splice(1, 0, n, "color: inherit");
let r = 0,
i = 0;
t[0].replace(/%[a-zA-Z%]/g, e => {
"%%" !== e && (r++, "%c" === e && (i = r))
}), t.splice(i, 0, n)
}, t.save = function(e) {
try {
e ? t.storage.setItem("debug", e) : t.storage.removeItem("debug")
} catch (e) {}
}, t.load = function() {
let e;
try {
e = t.storage.getItem("debug")
} catch (e) {}!e && void 0 !== r && "env" in r && (e = r.env.DEBUG);
return e
}, t.useColors = function() {
if ("undefined" != typeof window && window.process && ("renderer" === window.process.type || window.process.__nwjs)) return !0;
if ("undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return !1;
return "undefined" != typeof document && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || "undefined" != typeof window && window.console && (window.console.firebug || window.console.exception && window.console.table) || "undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || "undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)
}, t.storage = function() {
try {
return localStorage
} catch (e) {}
}(), t.destroy = (() => {
let e = !1;
return () => {
e || (e = !0, console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))
}
})(), t.colors = ["#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33"], t.log = console.debug || console.log || (() => {}), e.exports = n(238)(t);
const {
formatters: i
} = e.exports;
i.j = function(e) {
try {
return JSON.stringify(e)
} catch (e) {
return "[UnexpectedJSONParseError]: " + e.message
}
}
}).call(this, n(10))
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.VivochaVisitorBase = void 0;
const r = n(11);
r.getLogger("vvc-base");
class i extends r.VivochaCore {
constructor(e, t, n) {
super(e, t, n), this.acct_id = t;
const r = "/w/".concat(this.config.world, "/").concat(this.config.versionfull, "/"),
i = "/a/".concat(this.config.acct_id).concat(r, "api/v3/public/"),
o = "https://".concat(this.config.apihost, "/a/").concat(this.config.acct_id, "/api/");
Object.assign(this.config, {
apiurl: o,
apiurlv2: "".concat(o, "v2/public/"),
apiurlv3: "".concat(o, "v3/public/"),
liburl: 'https://cdn.vivocha.com' + r,
liburlv2: 'https://cdn.vivocha.com' + i,
liburlv3: 'https://cdn.vivocha.com' + i,
gifurl: "".concat(o, "vvct.gif")
})
}
async fetch(e, t, n = [200, 201]) {
let r = "".concat(this.config.apiurlv3).concat(e);
return this.innerFetch(r, t, n)
}
async cdnfetch(e, t, n = [200, 201]) {
let r = "".concat(this.config.liburlv3).concat(e);
return this.innerFetch(r, t, n)
}
async innerInnerFetch(e, t, n = [200, 201]) {
const i = await fetch(e, t);
if (-1 === n.indexOf(i.status)) throw new r.FetchError(i);
try {
const e = i.headers.get("content-type");
return e && -1 !== e.indexOf("application/json") ? i.json() : i.text()
} catch (e) {
throw new r.FetchError(i, e)
}
}
async innerFetch(e, t, n = [200, 201]) {
return this.innerInnerFetch(e, t, n)
}
async getSyncContactData(e) {
const t = "https://".concat(this.config.apihost, "/t/").concat(e, "/public/?corsredir");
let n = await this.innerFetch(t);
return n.corsredir && (n = await this.innerFetch(n.location)), n
}
async getSyncData(e, t, n = {}) {
return await this.fetch("contacts/".concat(t, "/sync/").concat(e), {
method: "post",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(n)
})
}
}
t.VivochaVisitorBase = i
}, , function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.ChannelActionsWrapper = t.EngagementActionsWrapper = t.ActionWrapper = void 0;
const r = n(189),
i = Symbol();
class o {
constructor(e, t) {
this.fixedContext = t, Object.assign(this, e)
}
get script() {
return (async () => {
if (!this[i]) {
if (this.url) {
const e = await fetch(this.url);
this.code = await e.json()
}
this[i] = r.Script.create(this.code, this.fixedContext)
}
return this[i]
})()
}
async execute(e) {
return (await this.script)(e)
}
}
t.ActionWrapper = o;
class a {
constructor(e, t) {
for (let n in e) "execute" !== n && (this[n] = new o(e[n], t))
}
async execute(e, t) {
const n = this[e];
if (n) {
let r = n.execute(t);
return n.once && delete this[e], !n.blocking || r
}
return !0
}
}
t.EngagementActionsWrapper = a;
t.ChannelActionsWrapper = class extends a {}
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.Script = void 0,
function(e) {
e.create = function(e, t = {}) {
const n = Object.keys(t),
r = new Function(...n.concat("context"), e);
return e => Promise.resolve(r.call(this, ...n.map(e => t[e]), e))
}
}(t.Script || (t.Script = {}))
}, function(e, t, n) {
"use strict";
var r = this && this.__createBinding || (Object.create ? function(e, t, n, r) {
void 0 === r && (r = n), Object.defineProperty(e, r, {
enumerable: !0,
get: function() {
return t[n]
}
})
} : function(e, t, n, r) {
void 0 === r && (r = n), e[r] = t[n]
}),
i = this && this.__exportStar || function(e, t) {
for (var n in e) "default" === n || t.hasOwnProperty(n) || r(t, e, n)
};
Object.defineProperty(t, "__esModule", {
value: !0
}), i(n(191), t), i(n(284), t), i(n(285), t), i(n(286), t), i(n(287), t)
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.BaseVisitorWidget = void 0;
const r = n(11),
i = n(247),
o = n(168),
a = r.getLogger("vvc-widget");
class s extends o.Machine {
constructor(e, t, n, r = !1) {
var i;
super({
FAILED: {
entry(e, t) {
this.executeAction("contact-failed", {
cause: e,
hasPresets: t
});
this.vivocha.track("dissuasion", JSON.stringify({
id: this.contact && this.contact.contact && this.contact.contact.id,
servid: this.context.campaign.id,
wid: this.context.engagement.id,
epid: this.context.entryPointId,
lang: this.language,
ver: this.context.campaign.version || 1,
media: this.availablePresets,
type: this.mediaPreset,
beforeContact: !this.interactionStart,
timeElapsed: this.interactionStart ? +new Date - this.interactionStart : 0,
cause: e
}))
},
actionDone() {
this.availablePresets.length && !this.interactionRestarted ? this.enter("RESTART_INTERACTION") : this.enter("WAIT_CLOSE")
},
close() {
return this.removeInteraction(), this.defer("close")()
}
},
TRANSFER_FAILED: {
entry(e, t) {
this.executeAction("contact-failed", {
cause: e,
hasPresets: t
});
this.vivocha.track("dissuasion", JSON.stringify({
id: this.contact && this.contact.contact && this.contact.contact.id,
servid: this.context.campaign.id,
wid: this.context.engagement.id,
epid: this.context.entryPointId,
lang: this.language,
ver: this.context.campaign.version || 1,
media: this.availablePresets,
type: this.mediaPreset,
beforeContact: !this.interactionStart,
timeElapsed: this.interactionStart ? +new Date - this.interactionStart : 0,
cause: e
}))
},
actionDone() {
this.enter("WAIT_CLOSE")
},
close() {
return this.removeInteraction(), this.defer("close")()
}
},
WAIT_CLOSE: {
close() {
this.enter("CLOSED_INTERACTION")
}
},
RESTART_INTERACTION: {
create(e) {
this.interactionRestarted = !0, this.basicOptions = e, this.enter("PRE_ROUTING")
},
close() {
this.enter("RESTART_INTERACTION_CANCELLED", !0)
},
failed(e, t) {
this.enter("FAILED", e, t)
}
},
PRE_ROUTING: {
entry() {
a.log("PRE_ROUTING with opts", this.basicOptions), this.executeAction("contact-prerouting")
},
actionDone(e) {
"contact-prerouting" === e && this.enter("CREATE_CONTACT")
},
close: "defer",
failed: "defer"
},
CREATE_CONTACT: {
entry() {
this.interaction.createContact(Object.assign(Object.assign(Object.assign({}, this.manager.customerToken && {
customerToken: this.manager.customerToken
}), this.vivocha.config.doNotProfile && {
doNotProfile: this.vivocha.config.doNotProfile
}), this.basicOptions, this.contactOptions))
},
contact(e) {
a.log("CREATE_CONTACT", e), this.contact = e, this.enter("CREATED", e)
},
close() {
this.enter("CANCELLED", !0)
},
failed(e, t) {
this.enter("FAILED", e, t)
}
},
CREATED: {
async entry(e) {
this.executeAction("contact-created"), this.vivocha.track("contact", JSON.stringify({
id: this.contact && this.contact.contact && this.contact.contact.id,
servid: this.context.campaign.id,
wid: this.context.engagement.id,
epid: this.context.entryPointId,
lang: this.language,
ver: this.context.campaign.version || 1,
media: this.availablePresets,
type: this.mediaPreset
}));
const t = +new Date;
this.interactionStart = t, await this.incStat("vvcu", "contacts"), void 0 === await this.getStat("vvcu", "first_contact") && await this.setStat("vvcu", "first_contact", t), await this.setStat("vvcu", "last_contact", t), await this.flushStats()
},
actionDone: "noop",
answer(e) {
this.enter("ANSWERED", e)
},
failed(e, t) {
this.enter("FAILED", e, t)
},
close(e) {
if ("closed" === e) this.enter("CLOSED");
else {
+new Date - this.interactionStart <= 1e4 ? this.enter("CANCELLED") : this.enter("ABANDONED")
}
}
},
CANCELLED: {
async entry(e) {
this.executeAction("contact-cancelled"), this.vivocha.track("cancelled", JSON.stringify({
id: this.contact && this.contact.contact && this.contact.contact.id,
servid: this.context.campaign.id,
wid: this.context.engagement.id,
epid: this.context.entryPointId,
lang: this.language,
ver: this.context.campaign.version || 1,
media: this.availablePresets,
type: this.mediaPreset,
beforeContact: !!e,
timeElapsed: this.interactionStart ? +new Date - this.interactionStart : 0
})), await this.setWidgetAndGlobalStat("both", "last_cancelled", +new Date), await this.incWidgetAndGlobalStat("both", "cancelled"), await this.flushStats(), e && this.process("close")
},
actionDone() {
this.enter("WAIT_CLOSE")
},
close: "defer"
},
RESTART_INTERACTION_CANCELLED: {
async entry(e) {
this.executeAction("contact-cancelled"), this.vivocha.track("restartCancelled", JSON.stringify({
id: this.contact && this.contact.contact && this.contact.contact.id,
servid: this.context.campaign.id,
wid: this.context.engagement.id,
epid: this.context.entryPointId,
lang: this.language,
ver: this.context.campaign.version || 1,
media: this.availablePresets,
type: this.mediaPreset,
beforeContact: !!e,
timeElapsed: this.interactionStart ? +new Date - this.interactionStart : 0
})), await this.setWidgetAndGlobalStat("both", "last_cancelled", +new Date), await this.incWidgetAndGlobalStat("both", "cancelled"), await this.flushStats(), e && this.process("close")
},
actionDone() {
this.enter("WAIT_CLOSE")
},
close: "defer"
},
ABANDONED: {
async entry() {
this.executeAction("contact-abandoned"), this.vivocha.track("abandoned", JSON.stringify({
id: this.contact && this.contact.contact && this.contact.contact.id,
servid: this.context.campaign.id,
wid: this.context.engagement.id,
epid: this.context.entryPointId,
lang: this.language,
ver: this.context.campaign.version || 1,
media: this.availablePresets,
type: this.mediaPreset,
beforeContact: !1,
timeElapsed: this.interactionStart ? +new Date - this.interactionStart : 0
})), await this.setWidgetAndGlobalStat("both", "last_abandoned", +new Date), await this.incWidgetAndGlobalStat("both", "abandoned"), await this.flushStats()
},
actionDone() {
this.enter("WAIT_CLOSE")
},
close: "defer"
},
ANSWERED: {
async entry(e) {
this.executeAction("contact-answered"), await this.setWidgetAndGlobalStat("both", "last_answered", +new Date), await this.incWidgetAndGlobalStat("both", "answered"), await this.flushStats(), this.enter("ESTABLISHED")
},
actionDone: "noop",
close: "defer"
},
ESTABLISHED: {
async entry() {
this.executeAction("contact-established")
},
actionDone: "noop",
answer() {
a.info("agent re-joined")
},
transfer(e) {
this.enter("TRANSFERRED", e)
},
close() {
this.enter("CLOSED")
}
},
TRANSFERRED: {
entry(e) {
a.log("TRANSFERRED", e);
const t = +new Date;
this.interactionTransfer = t
},
answer() {
this.enter("ESTABLISHED")
},
failed(e, t) {
this.enter("TRANSFER_FAILED", e, t)
},
close(e) {
if ("closed" === e) this.enter("CLOSED");
else {
+new Date - this.interactionTransfer <= 1e4 ? this.enter("CANCELLED") : this.enter("ABANDONED")
}
}
},
CLOSED: {
entry(e) {
this.executeAction("contact-closed"), this.vivocha.track("closed", JSON.stringify({
id: this.contact && this.contact.contact && this.contact.contact.id,
servid: this.context.campaign.id,
wid: this.context.engagement.id,
epid: this.context.entryPointId,
lang: this.language,
ver: this.context.campaign.version || 1,
media: this.availablePresets,
type: this.mediaPreset,
beforeContact: !1,
timeElapsed: this.interactionStart ? +new Date - this.interactionStart : 0,
cause: e
}))
},
actionDone() {
this.enter("WAIT_CLOSE")
},
close: "defer"
}
}, void 0, "vvc-widget", null === (i = n.engagement) || void 0 === i ? void 0 : i.id), this.vivocha = e, this.manager = t, this.context = n, this.widgetDisplayed = !1, this.availablePresets = [], this.availablePresetModes = [];
for (let e in this.states) this.states[e]["*"] || (this.states[e]["*"] = this.unhandled)
}
unhandled(...e) {
a.error("unhandled event ".concat(this.lastEvent, " in state ").concat(this.state, ", with args ").concat(e))
}
async isOpen(e) {
const t = e instanceof i.OpeningHoursWrapper ? e : new i.OpeningHoursWrapper(e);
a.log("widget.isOpen", e, "OpeningHoursWrapper", t);
const n = new Date,
r = await this.vivocha.getVisitorInfo(),
o = "number" == typeof r.tzOffset ? r.tzOffset : 0,
s = new Date(+n + 6e4 * (o + n.getTimezoneOffset()));
return t.isOpen(s)
}
async resolveAvailablePresets(e) {
let t = [];
this.contactOptions && this.contactOptions.tags ? t = this.contactOptions.tags : this.context.routing && this.context.routing.tags && (t = this.context.routing.tags);
const n = async e => {
var n, r, i;
let o;
if (o = "string" == typeof e ? {
offer: e
} : e, !0 === o.alwaysOn) return !0;
if (o.openingHours && !await this.isOpen(o.openingHours)) return !1;
const a = (null === (n = o.routing) || void 0 === n ? void 0 : n.queue) || (null === (r = this.context.routing) || void 0 === r ? void 0 : r.queue);
if ("infinite" === (null == a ? void 0 : a.type)) return !0;
const s = await this.getAgentAvailability((null === (i = o.routing) || void 0 === i ? void 0 : i.tags) || t),
c = o.offer;
return s && s[c] && (!0 === s[c] || "object" == typeof s[c] && !!s[c].max)
};
if (this.availablePresets = [], this.availablePresetModes = [], this.context.interactionModes && this.context.interactionModes[e]) {
const t = await async function e(t) {
let r = [];
if ("string" == typeof t) await n(t) && r.push(t);
else if (Array.isArray(t))
for (let n of t) r = r.concat(await e(n));
else if ("object" == typeof t)
if ("string" == typeof t.offer) await n(t) && r.push(t);
else if (Array.isArray(t.or))
for (let n of t.or) {
let t = await e(n);
if (t.length) {
r = r.concat(t);
break
}
}
return r
}(this.context.interactionModes[e]);
for (let e of t) "string" == typeof e ? (this.availablePresets.push(e), this.availablePresetModes.push(void 0)) : (this.availablePresets.push(e.offer), this.availablePresetModes.push(e))
}
this.availablePresets.length ? a.log("widget ".concat(this.context.engagement.id, " available presets ").concat(this.availablePresets, " for event ").concat(e)) : a.log("widget ".concat(this.context.engagement.id, " no available presets for event ").concat(e))
}
resolveLanguage(e = !1) {
if (this.language && !e) return Promise.resolve(this.language);
return this.manager.createLanguageResolver(this.context.entryPoint.language, this.context.campaign).resolve().then(e => (this.language = e, e))
}
async getAgentAvailability(e = []) {
const t = e.sort().join(","),
n = s.AA_CACHE;
if (!n[this.context.campaign.id] || !n[this.context.campaign.id][t]) {
n[this.context.campaign.id] || (n[this.context.campaign.id] = {});
const e = n[this.context.campaign.id];
e[t] = this.vivocha.fetch("campaigns/".concat(this.context.campaign.id, "/agents").concat(t ? "?tags=".concat(t) : ""));
const r = await this.vivocha.getDebugMode();
setTimeout(() => {
delete e[t]
}, r ? s.AA_TTL_DEBUG : s.AA_TTL)
}
return n[this.context.campaign.id][t]
}
async innerExecuteAction(e, t) {
try {
this.context.channelActions && await this.context.channelActions.execute(e, Object.assign({}, t, {
widget: this
})), this.context.engagementActions && await this.context.engagementActions.execute(e, Object.assign({}, t, {
widget: this
}))
} catch (t) {
this.onActionError(e, t)
}
}
executeAction(e, t) {
return this.innerExecuteAction(e, t).then(() => this.process("actionDone", e))
}
onActionError(e, t) {
a.error("widget ".concat(this.context.engagement.id, " action ").concat(e, " failed\n").concat(t)), this.enter("END")
}
async prepareDataCollection(e) {
const t = JSON.parse(JSON.stringify(e));
if (t.fields)
for (let e of t.fields) e.defaultVariableId && this.context.variables[e.defaultVariableId] && (e.defaultConstant = await this.context.variables[e.defaultVariableId](), delete e.defaultVariableId);
return t
}
async prepareDataCollectionById(e) {
if (!this.context.dataCollections[e]) throw a.error("unknown data collection", e), new Error("unknown_data_collection");
return this.prepareDataCollection(this.context.dataCollections[e])
}
getContextForPersistence() {
return {
campaign: this.context.campaign,
entryPoint: this.context.entryPoint,
engagement: this.context.engagement,
dataCollections: this.context.dataCollections,
media: this.context.media
}
}
async getConversation(e) {
return (await this.manager.fetchConversationData()).find(t => t._id === e)
}
getCustomerToken() {
return this.manager.getCustomerToken()
}
async flushStats(e = "both") {
"both" !== e && "vvcu" !== e || await this.vivocha.flushVVCUInfo(), "both" !== e && "vvct" !== e || await this.vivocha.flushVVCTInfo()
}
async setStat(e, t, n) {
if ("both" === e) await this.setStat("vvcu", t, n), await this.setStat("vvct", t, n);
else {
const r = await ("vvcu" === e ? this.vivocha.getVVCUInfo() : this.vivocha.getVVCTInfo());
this.vivocha.dot(r, t, n)
}
}
async getStat(e, t) {
const n = await ("vvcu" === e ? this.vivocha.getVVCUInfo() : this.vivocha.getVVCTInfo());
return this.vivocha.dot(n, t)
}
async incStat(e, t) {
if ("both" !== e) {
const n = await this.getStat(e, t) || 0;
return this.setStat(e, t, n + 1)
}
await this.incStat("vvcu", t), await this.incStat("vvct", t)
}
setWidgetStat(e, t, n) {
return this.setStat(e, "widgets.".concat(this.context.campaign.id, "-").concat(this.context.engagement.id, ".").concat(t), n)
}
getWidgetStat(e, t) {
return this.getStat(e, "widgets.".concat(this.context.campaign.id, "-").concat(this.context.engagement.id, ".").concat(t))
}
incWidgetStat(e, t) {
return this.incStat(e, "widgets.".concat(this.context.campaign.id, "-").concat(this.context.engagement.id, ".").concat(t))
}
async setWidgetAndGlobalStat(e, t, n) {
await this.setStat(e, t, n), await this.setWidgetStat(e, t, n)
}
async incWidgetAndGlobalStat(e, t) {
await this.incStat(e, t), await this.incWidgetStat(e, t)
}
removeInteraction() {
this.interaction && (this.interaction.release(), delete this.interaction, delete this.interactionStart, delete this.interactionRestarted)
}
}
t.BaseVisitorWidget = s, s.SLEEP_TIMER = 3e3, s.AA_TTL = 1e4, s.AA_TTL_DEBUG = 500, s.AA_CACHE = {}
}, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.DataCollector = void 0;
const r = n(168);
class i extends r.Machine {
constructor(e, t, n) {
super({
start: {
async userInput(e, t, n) {
this.enter("starting");
const r = await this.send("start", e, t, n);
if (!r || !r.context || !r.context.id) throw new Error("bad_response");
return this.contextId = r.context.id, this._data = r.data, this.enter(r.event), r.messages
}
},
starting: {
userInput: "defer"
},
continue: {
async userInput(e, t, n) {
this.enter("continuing");
const r = await this.send("continue", e, t, n);
if (!r) throw new Error("bad_response");
return this._data = r.data, this.enter(r.event), r.messages
}
},
continuing: {
userInput: "defer"
},
end: {}
}, "start", "vvc-datacollector", n.id), this.vivocha = e, this.context = t, this._proxable = !0, this._data = (n.fields || []).reduce((e, t) => (void 0 !== t.defaultConstant && (e[t.id] = t.defaultConstant), e), {}), this._definition = n, this._inline = 0 === this._definition.id.indexOf("merged(")
}
send(e, t, n, r) {
const i = {
event: e,
language: this.context.language,
environment: {
campaignId: this.context.campaign.id,
channelId: "web",
entrypointId: this.context.entryPointId,
engagementId: this.context.engagementId
}
};
let o;
return i.message = "postback" === t ? {
id: "collect",
ts: new Date,
code: "message",
type: "postback",
body: n,
payload: r
} : {
id: "collect",
ts: new Date,
code: "message",
type: "text",
body: n,
payload: r
}, this.contextId && (i.context = {
id: this.contextId
}), this._data && (i.data = this._data), this._inline ? ("start" === e && (i.settings = {
dataCollection: this._definition
}), o = "bot/collect") : o = "bot/collect/".concat(this._definition.id), this.vivocha.fetch(o, {
method: "post",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(i)
})
}
onText(e, t) {
return this.process("userInput", "text", e, t)
}
onPostback(e, t) {
return this.process("userInput", "postback", e, t)
}
started() {
return "start" !== this.state
}
completed() {
return "end" === this.state
}
data() {
return this._data
}
definition() {
return this._definition
}
}
t.DataCollector = i
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.noop = t.defer = t.exit = t.entry = t.handle = t.fsm = void 0;
const r = n(235),
i = Symbol();

function o(e) {
return e[i] || (e[i] = {}), e[i]
}

function a(e, t, n, r) {
const i = o(n.constructor);
i[e] || (i[e] = {}), i[e][t] = r
}

function s(e, t) {
return function(n, r) {
a(e, t, n, (function(...e) {
return this[r].apply(this, e)
}))
}
}
t.fsm = function(e) {
return function(t) {
return class extends t {
constructor(...n) {
super(...n), this.states = r.deepExtend({}, this.states, o(t)), e && void 0 === this.state && this.enter(e)
}
}
}
}, t.handle = s, t.entry = function(e) {
return s(e, "entry")
}, t.exit = function(e) {
return s(e, "exit")
}, t.defer = function(e, t) {
return function(n) {
a(e, t, n, "defer")
}
}, t.noop = function(e, t) {
return function(n) {
a(e, t, n, "noop")
}
}
}, function(e, t, n) {
"use strict";
(function(e) {
Object.defineProperty(t, "__esModule", {
value: !0
}), t.mixin = t.deepExtend = t.dot = t.Eredita = void 0;
const n = Array.isArray;
class r {
constructor(e, t) {
if (this.data = e, this.parent = t, this.dirty = !1, !this.data) throw new Error("missing data")
}
dot(e, t) {
return r.dot(this.data, e, t)
}
getPath(e) {
let t = this.dot(e);
return void 0 === t ? this.parent ? this.parent.getPath(e) : void 0 : t
}
getTypedPath(e, t, r) {
let i = this.getPath(e);
if ((o = i) !== Object(o) || n(i)) return i; {
const e = t.toLowerCase();
return void 0 !== i[e] ? i[e] : r ? i[r] : void 0
}
var o
}
setPath(e, t) {
return this.dirty = !0, this.dot(e, t)
}
unsetPath(e) {
return this.setPath(e, null)
}
mergePath(e) {
let t = this.parent,
n = t ? t.mergePath(e) : null,
i = this.getPath(e);
return n ? r.deepExtend(n, i) : r.deepExtend({}, i)
}
isDirty() {
return this.dirty
}
static dot(e, t, n) {
const r = t ? t.split(".") : [];
let i = e;
if (void 0 === n)
for (let e = 0, t = r.length; void 0 !== i && e < t; e++) i = i[r[e]];
else {
let e = null;
for (let t = 0, n = r.length - 1; e = r[t], t < n; t++) "object" != typeof i[e] && (i[e] = isNaN(r[t + 1]) ? {} : []), i = i[e];
i[e] = n, i = i[e]
}
return i
}
static deepExtend(t, ...i) {
if (!t) throw new Error("missing target");
if ("object" != typeof t) throw new Error("invalid target");
if (!i.length) return t;
let o, a, s, c, u;
for (let h of i) {
if ("object" != typeof h) throw new Error("invalid argument");
for (o in h) s = t[o], a = h[o], a !== t && ("object" == typeof a && null !== a ? a instanceof e ? (u = e.alloc(a.length), a.copy(u), t[o] = u) : a instanceof Date ? t[o] = new Date(a.getTime()) : "object" == typeof s && null !== s ? (c = n(a) ? n(s) ? s : [] : n(s) ? {} : s, t[o] = r.deepExtend(c, a)) : (c = n(a) ? [] : {}, t[o] = r.deepExtend(c, a)) : t[o] = a)
}
return t
}
}
t.Eredita = r, t.dot = r.dot, t.deepExtend = r.deepExtend, t.mixin = function() {
return {
deepExtend: t.deepExtend
}
}
}).call(this, n(12).Buffer)
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.Machine = void 0;
const r = n(237),
i = n(9),
o = n(240);
class a extends i.EventEmitter {
constructor(e = {}, t, n = "fseh", i) {
super(), this.states = e, this.ready = Promise.resolve(!0), this.deferredEvents = [], this.logger = r.getLogger(n, i), t && this.enter(t)
}
defer(e) {
return (...t) => new Promise(n => {
this.deferredEvents.push({
event: e,
args: t,
resolve: n
})
})
}
async flushDeferred() {
if (this.deferredEvents.length) {
let e = this.deferredEvents;
this.deferredEvents = [];
for (let t = 0; t < e.length; t++) try {
let n = this.innerProcess(e[t].event, !0, ...e[t].args);
e[t].resolve(n)
} catch (e) {}
}
}
async innerProcess(e, t, ...n) {
if (e) {
let r;
if (this.state && this.states[this.state]) {
let n = this.states[this.state][e] || this.states[this.state]["*"];
n && ("defer" === n ? (this.logger.debug("DEFERRING ".concat(t ? "deferred " : "", "event ").concat(e.toUpperCase(), " in state ").concat(this.state.toUpperCase())), r = this.defer(e)) : "noop" === n ? (this.logger.debug("IGNORING ".concat(t ? "deferred " : "", "event ").concat(e.toUpperCase(), " in state ").concat(this.state.toUpperCase())), r = () => {}) : (this.logger.debug("PROCESSING ".concat(t ? "deferred " : "", "event ").concat(e.toUpperCase(), " in state ").concat(this.state.toUpperCase())), r = "string" == typeof n ? (...e) => this.enter(n, ...e) : n))
}
if (r) return this.lastEvent = e, r.apply(this, n);
throw this.logger.error("UNHANDLED ".concat(t ? "deferred " : "", "event ").concat(e.toUpperCase(), " in state ").concat(this.state ? this.state.toUpperCase() : "unknown")), new o.UnhandledEventError(e, this.state, t, n)
}
throw new o.InvalidEventError(e, this.state, t, n)
}
async process(e, ...t) {
return await this.ready, this.innerProcess(e, !1, ...t)
}
processStateEventHandler(e, t, n) {
return Promise.resolve(!e || !e[t] || e[t].apply(this, n))
}
enter(e, ...t) {
if (!e) return Promise.reject(new o.InvalidStateError(e, t));
let n = this.state ? this.states[this.state] : void 0,
r = this.states[e];
if (this.state !== e) {
if (r) {
let i;
return this.state ? (this.logger.debug("TRANSISTING from ".concat(this.state.toUpperCase(), " to ").concat(e.toUpperCase())), this.emit("".concat(this.state, ":exit"), e, ...t), this.emit("exit", this.state, e, ...t)) : this.logger.debug("TRANSISTING to ".concat(e.toUpperCase())), this.emit("".concat(e, ":pre-entry"), ...t), this.emit("pre-entry", e, ...t), this.ready = new Promise(e => {
i = e
}), this.state = e, (async () => {
try {
return await this.processStateEventHandler(n, "exit", t), await this.processStateEventHandler(r, "entry", t), await this.flushDeferred(), i && i(), this.emit("".concat(e, ":entry"), ...t), this.emit("entry", e, ...t), this.emit(e, ...t), !0
} catch (e) {
throw i && i(), e
}
})()
}
return this.logger.error("UNKNOWN state ".concat(e.toUpperCase())), Promise.reject(new o.UnknownStateError(e, t))
}
return Promise.resolve(!0)
}
eventHandler(e) {
return async (...t) => {
if ("string" == typeof e) return this.process(e, ...t);
if (await this.ready, this.state && e[this.state]) return e[this.state].apply(this, t);
if (e["*"]) return e["*"].apply(this, t);
throw this.logger.error("UNHANDLED event ".concat((this.lastEvent || "unknown").toUpperCase(), " in state ").concat(this.state ? this.state.toUpperCase() : "unknown")), new o.UnhandledEventError(this.lastEvent || "unknown", this.state, !1, t)
}
}
callbackEventHandler(e) {
let t = this.eventHandler(e);
return (...e) => {
if (e.length && "function" == typeof e[e.length - 1]) {
let n = e.pop();
t(e).then((...e) => {
n(null, ...e)
}, e => {
n(e)
})
} else t(...e)
}
}
}
t.Machine = a
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.promise = t.cb = t.namespaces = t.getLogger = t.enable = t.disable = void 0;
const r = n(185);
var i = n(185);
Object.defineProperty(t, "disable", {
enumerable: !0,
get: function() {
return i.disable
}
}), Object.defineProperty(t, "enable", {
enumerable: !0,
get: function() {
return i.enable
}
});
const o = {},
a = {};

function s(e) {
let t = ["log", "info", "warn", "error", "debug", "trace"].reduce((t, n) => (t[n] = function(e, t) {
const n = r("".concat(e.ns, ":").concat(t));
if (e.context) {
return new Proxy(n, {
apply: function(t, n, r) {
const [i, ...o] = r;
return t.call(n, "".concat(e.context, " ").concat(i), ...o)
}
})
}
return n
}(e, n), t), {});
if ("object" == typeof window && "object" == typeof window.console) try {
t.log.log = window.console.log.bind(window.console), t.info.log = window.console.info.bind(window.console), t.warn.log = window.console.warn.bind(window.console), t.error.log = window.console.error.bind(window.console), t.debug.log = (window.console.debug ? window.console.debug : window.console.log).bind(window.console), t.trace.log = (window.console.trace ? window.console.trace : window.console.log).bind(window.console)
} catch (e) {}
return t
}

function c(e, t, n) {
const r = "string" == typeof e ? {
ns: e,
context: t,
cache: n
} : e;
let i;
if (!1 === r.cache) i = s(r);
else {
let e = r.context ? "".concat(r.ns, "@@").concat(r.context) : r.ns;
a[e] || (o[r.ns] = !0, a[e] = s(r)), i = a[e]
}
return i
}
t.getLogger = c, t.namespaces = function() {
return Object.keys(o)
}, t.cb = function(e = "") {
const t = c(e);
return (e, n) => {
e ? t.error(e) : t.info(n)
}
}, t.promise = function(e, t = "") {
const n = c(t);
return e.then((function(e) {
n.info(e)
}), (function(e) {
n.error(e)
}))
}
}, function(e, t, n) {
e.exports = function(e) {
function t(e) {
let n, i, o, a = null;

function s(...e) {
if (!s.enabled) return;
const r = s,
i = Number(new Date),
o = i - (n || i);
r.diff = o, r.prev = n, r.curr = i, n = i, e[0] = t.coerce(e[0]), "string" != typeof e[0] && e.unshift("%O");
let a = 0;
e[0] = e[0].replace(/%([a-zA-Z%])/g, (n, i) => {
if ("%%" === n) return "%";
a++;
const o = t.formatters[i];
if ("function" == typeof o) {
const t = e[a];
n = o.call(r, t), e.splice(a, 1), a--
}
return n
}), t.formatArgs.call(r, e);
(r.log || t.log).apply(r, e)
}
return s.namespace = e, s.useColors = t.useColors(), s.color = t.selectColor(e), s.extend = r, s.destroy = t.destroy, Object.defineProperty(s, "enabled", {
enumerable: !0,
configurable: !1,
get: () => null !== a ? a : (i !== t.namespaces && (i = t.namespaces, o = t.enabled(e)), o),
set: e => {
a = e
}
}), "function" == typeof t.init && t.init(s), s
}

function r(e, n) {
const r = t(this.namespace + (void 0 === n ? ":" : n) + e);
return r.log = this.log, r
}

function i(e) {
return e.toString().substring(2, e.toString().length - 2).replace(/\.\*\?$/, "*")
}
return t.debug = t, t.default = t, t.coerce = function(e) {
if (e instanceof Error) return e.stack || e.message;
return e
}, t.disable = function() {
const e = [...t.names.map(i), ...t.skips.map(i).map(e => "-" + e)].join(",");
return t.enable(""), e
}, t.enable = function(e) {
let n;
t.save(e), t.namespaces = e, t.names = [], t.skips = [];
const r = ("string" == typeof e ? e : "").split(/[\s,]+/),
i = r.length;
for (n = 0; n < i; n++) r[n] && ("-" === (e = r[n].replace(/\*/g, ".*?"))[0] ? t.skips.push(new RegExp("^" + e.substr(1) + "$")) : t.names.push(new RegExp("^" + e + "$")))
}, t.enabled = function(e) {
if ("*" === e[e.length - 1]) return !0;
let n, r;
for (n = 0, r = t.skips.length; n < r; n++)
if (t.skips[n].test(e)) return !1;
for (n = 0, r = t.names.length; n < r; n++)
if (t.names[n].test(e)) return !0;
return !1
}, t.humanize = n(239), t.destroy = function() {
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")
}, Object.keys(e).forEach(n => {
t[n] = e[n]
}), t.names = [], t.skips = [], t.formatters = {}, t.selectColor = function(e) {
let n = 0;
for (let t = 0; t < e.length; t++) n = (n << 5) - n + e.charCodeAt(t), n |= 0;
return t.colors[Math.abs(n) % t.colors.length]
}, t.enable(t.load()), t
}
}, function(e, t) {
var n = 1e3,
r = 6e4,
i = 60 * r,
o = 24 * i;

function a(e, t, n, r) {
var i = t >= 1.5 * n;
return Math.round(e / n) + " " + r + (i ? "s" : "")
}
e.exports = function(e, t) {
t = t || {};
var s = typeof e;
if ("string" === s && e.length > 0) return function(e) {
if ((e = String(e)).length > 100) return;
var t = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);
if (!t) return;
var a = parseFloat(t[1]);
switch ((t[2] || "ms").toLowerCase()) {
case "years":
case "year":
case "yrs":
case "yr":
case "y":
return 315576e5 * a;
case "weeks":
case "week":
case "w":
return 6048e5 * a;
case "days":
case "day":
case "d":
return a * o;
case "hours":
case "hour":
case "hrs":
case "hr":
case "h":
return a * i;
case "minutes":
case "minute":
case "mins":
case "min":
case "m":
return a * r;
case "seconds":
case "second":
case "secs":
case "sec":
case "s":
return a * n;
case "milliseconds":
case "millisecond":
case "msecs":
case "msec":
case "ms":
return a;
default:
return
}
}(e);
if ("number" === s && isFinite(e)) return t.long ? function(e) {
var t = Math.abs(e);
if (t >= o) return a(e, t, o, "day");
if (t >= i) return a(e, t, i, "hour");
if (t >= r) return a(e, t, r, "minute");
if (t >= n) return a(e, t, n, "second");
return e + " ms"
}(e) : function(e) {
var t = Math.abs(e);
if (t >= o) return Math.round(e / o) + "d";
if (t >= i) return Math.round(e / i) + "h";
if (t >= r) return Math.round(e / r) + "m";
if (t >= n) return Math.round(e / n) + "s";
return e + "ms"
}(e);
throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(e))
}
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.UnknownStateError = t.InvalidStateError = t.UnhandledEventError = t.InvalidEventError = void 0;
class r extends Error {
constructor(e, t = "unknown", n = !1, ...i) {
super("Invalid ".concat(n ? "deferred " : "", 'event "').concat(e, '" in state "').concat(t, '"')), this.event = e, this.state = t, this.deferred = n, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, r), this.args = i
}
}
t.InvalidEventError = r;
class i extends Error {
constructor(e, t = "unknown", n = !1, ...r) {
super("Unhandled ".concat(n ? "deferred " : "", 'event "').concat(e, '" in state "').concat(t, '"')), this.event = e, this.state = t, this.deferred = n, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, i), this.args = r
}
}
t.UnhandledEventError = i;
class o extends Error {
constructor(e, ...t) {
super('Invalid state "'.concat(e, '"')), this.state = e, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, o), this.args = t
}
}
t.InvalidStateError = o;
class a extends Error {
constructor(e, ...t) {
super('Unknown state "'.concat(e, '"')), this.state = e, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, o), this.args = t
}
}
t.UnknownStateError = a
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
})
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.VivochaVisitorCore = void 0;
const r = n(4),
i = n(136),
o = n(186),
a = r.default("vvc-core");
class s extends o.VivochaVisitorBase {
constructor(e, t, n) {
super(e, t, n), this.acct_id = t, this.tpcs = !0, this.lstr = !0, this._visitorCoreReady = this._ready
}
dataRequest(e, ...t) {
return this.platform.dataRequest(e, ...t)
}
updateConfig(e) {
this.extend(this.config, e);
try {
this.dot(this, "config.duration.vvcu") && this.setVVCUDuration(this.config.duration.vvcu), this.dot(this, "config.duration.vvct") && this.setVVCTDuration(this.config.duration.vvct)
} catch (e) {
a.error(e)
}
}
getVVCU() {
return this.dataRequest("getVVCU")
}
getVVCT() {
return this.dataRequest("getVVCT")
}
getVVC() {
return this.dataRequest("getVVC")
}
resetVVCU() {
return this.dataRequest("resetVVCU")
}
resetVVCT() {
return this.dataRequest("resetVVCT")
}
resetVVC() {
return this.dataRequest("resetVVC")
}
setVVCUDuration(...e) {
return this.dataRequest.call(this, "setVVCUDuration", ...e)
}
setVVCTDuration(...e) {
return this.dataRequest.call(this, "setVVCTDuration", ...e)
}
rcookie(e, ...t) {
return this.dataRequest.call(this, "cookie", e, ...t)
}
getRCookie(e) {
return this.rcookie(e)
}
setRCookie(e, t, n = {}) {
return this.rcookie(e, t, n)
}
unsetRCookie(e) {
return this.rcookie(e, null, {})
}
getConfig() {
return this.config
}
enableDebugMode() {
this.setRCookie("vvcd", "".concat(+new Date), {})
}
disableDebugMode() {
this.unsetRCookie("vvcd")
}
getDebugMode() {
return this.getRCookie("vvcd").then(e => !!e)
}
async innerFetch(e, t, n = [200, 201]) {
if (await this.getDebugMode()) {
const t = i.parse(e, !0);
delete t.search, this.dot(t, "query.vvcd", "".concat(+new Date)), e = i.format(t)
}
return this.innerInnerFetch(e, t, n)
}
pushLink(e, t, n) {
n || 0 !== e.indexOf(location.origin) || (n = "_self"), "_self" === n ? (a.log("VivochaVisitorCore.pushLink same origin link", e), location.href = e) : t && (a.log("VivochaVisitorCore.pushLink external file/link", e), window.open(e, n || "_blank"))
}
}
t.VivochaVisitorCore = s
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.VivochaVisitorBrowserHelper = void 0;
const r = n(119),
i = n(11),
o = n(118),
a = n(244),
s = i.getLogger("vvc-page");
class c extends o.VivochaBrowserHelper {
constructor() {
super(...arguments), this.logImages = []
}
init(e) {
if (super.init(e), !e.config.acct_id) {
const t = new Error("Cannot find the Vivocha account id. Vivocha scripts must not be removed from the DOM. Are you sure you don't have a script that removes the Vivocha script?");
throw e._ready = Promise.reject(t), t
}
e._ready = e._ready.then(async () => (s.log("VivochaVisitorCore._ready"), e.bus = new r.Bus("vvcu@" + e.config.acct_id), e.bus.start(), /[\?&]{1}vvcu=/.test(location.search) && (s.log("VivochaVisitorCore._ready enableDebugMode due querystring"), await e.enableDebugMode()), this))
}
readyData() {
if (!this._readyData) {
let e = 0;
this._readyData = this.vivocha._visitorCoreReady.then(() => {
var t, r;
const i = () => new Promise((e, t) => {
n.e(1).then((t => {
s.warn("VivochaVisitorCore.readyData() onDataframe", "local dataframe");
const r = new(0, n(153).VivochaDataProvider)(this.vivocha.config);
this.vivocha.bus.registerService("dataframe", r), e(o(this.vivocha.bus.services.dataframe))
}).bind(null, n)).catch(e => {
t(e)
})
}),
o = t => (s.log("VivochaVisitorCore.readyData() onDataframe"), t.getVVC().then(n => n.lstr && n.tpcs || !(++e < 3) ? n.lstr && n.tpcs ? (s.log("VivochaVisitorCore.readyData() onDataframe", "got dataframe service provider"), t) : void s.warn("VivochaVisitorCore.readyData() onDataframe", "unable to store cookies") : (this.vivocha.tpcs = n.tpcs, this.vivocha.lstr = n.lstr, s.warn("VivochaVisitorCore.readyData() onDataframe", "using local cookies"), i()))),
a = () => (s.log("VivochaVisitorCore.readyData() getDataframe", "creating dataframe"), new Promise((e, t) => {
var n, r;
const i = () => {
n || (n = !0, this.getDataFrame(t => {
s.log("VivochaVisitorCore.readyData() getDataframe", "got dataframe ready"), this.vivocha.bus.services.dataframe ? e(o(this.vivocha.bus.services.dataframe)) : this.vivocha.bus.on("added.dataframe", t => {
e(o(t))
})
}))
};
"complete" === document.readyState || !document.attachEvent && "interactive" === document.readyState ? setTimeout(i, 1) : r || (document.addEventListener ? (document.addEventListener("DOMContentLoaded", i, !1), window.addEventListener("load", i, !1)) : (document.attachEvent("onreadystatechange", (function() {
"complete" === document.readyState && i()
})), window.attachEvent("onload", i)), r = !0)
}));
return this.vivocha.config.doNotProfile ? i() : (null === (r = null === (t = this.vivocha.bus) || void 0 === t ? void 0 : t.services) || void 0 === r ? void 0 : r.dataframe) ? (s.log("VivochaVisitorCore.readyData()", "using dataframe from bus"), o(this.vivocha.bus.services.dataframe)) : window !== parent ? (s.log("VivochaVisitorCore.readyData()", "waiting for parent dataframe"), new Promise((e, t) => {
const n = setTimeout(() => {
s.log("VivochaVisitorCore.readyData()", "timeout on dataframe"), this.vivocha.bus.services.dataframe ? (s.log("VivochaVisitorCore.readyData()", "using dataframe from bus timeout"), e(o(this.vivocha.bus.services.dataframe))) : e(a())
}, 2e3);
this.vivocha.bus.on("added.dataframe", t => {
s.log("using dataframe from bus event"), clearTimeout(n), e(o(t))
})
})) : a()
})
}
return this._readyData
}
getDataFrame(e) {
if (!this.dataFrame) {
let t = new Promise((e, t) => {
let n = document.getElementById("vivocha_data");
if (n) e(n);
else {
const t = () => {
this.dataFrame = n, e(n)
};
n = document.createElement("iframe"), n.id = "vivocha_data", n.frameBorder = "no", n.style.margin = "0", n.style.padding = "0", n.style.top = "0", n.style.left = "0", n.style.width = "1px", n.style.height = "1px", n.style.position = "fixed", n.style.border = "none", n.style.visibility = "hidden", n.allowTransparency = "true", n.attachEvent ? n.attachEvent("onload", t) : n.onload = t, n.src = "https://".concat(this.vivocha.config.apihost, "/a/").concat(this.vivocha.config.acct_id, "/js/").concat("", "dataframe/"), (this.vivocha.scriptParentNode || document.body).appendChild(n)
}
});
return e && this.vivocha.nodeify(t, e), t
}
Promise.resolve(this.dataFrame), e && e(this.dataFrame)
}
dataRequest(e, ...t) {
return this.readyData().then(() => this.vivocha.bus.request.call(this.vivocha.bus, "dataframe", e, t))
}
createContact(e, t, n) {
return new a.VivochaBrowserVisitorContact(e, t, n)
}
async track(e, t) {
try {
const n = await this.getLogParams();
let r = this.vivocha.param(this.vivocha.extend({
ev: e || "0",
ex: t || ""
}, n)),
i = new Image;
i.src = this.vivocha.config.gifurl + "?" + r, this.logImages.push(i)
} catch (e) {
s.error("track gif", e)
}
}
async getLogParams() {
const e = await this.vivocha.getVVC(),
t = document,
n = window.location,
r = window.screen;
return {
vvcu: e.vvcu,
vvct: e.vvct,
tpcs: this.vivocha.tpcs,
lstr: this.vivocha.lstr,
kk: this.vivocha.config.acct_id,
dt: t.title,
dr: t.referrer,
cs: t.characterSet,
hn: n.hostname,
pn: n.pathname,
ul: String("Netscape" === navigator.appName ? navigator.language : navigator.browserLanguage),
sr: r.width + "x" + r.height + "-" + r.availWidth + "x" + r.availHeight,
sc: r.colorDepth,
r: location.href,
__: (new Date).getTime() + "_" + Math.round(2147483647 * Math.random())
}
}
}
t.VivochaVisitorBrowserHelper = c
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.VivochaBrowserVisitorContact = void 0;
const r = n(160),
i = n(137),
o = n(245);
class a extends o.VivochaVisitorContact {
constructor(e, t, n) {
super(e, t, n), this.ready = this.ready.then(() => this.setLocalCapabilities(vivocha.probeCaps()).then(() => this.registerMediaEngine(new r.NativeMediaEngine)).then(() => i.WebRTCMediaEngine.probe() ? this.registerMediaEngine(new i.WebRTCMediaEngine) : this).then(() => this))
}
}
t.VivochaBrowserVisitorContact = a
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.VivochaVisitorContact = void 0;
const r = n(11);
r.getLogger("vvc-contact");
class i extends r.VivochaContact {
ws(e, t, n, r) {
return "object" != typeof n && (n = {}), n.cid = this.id, n.vvcu = this.contact.vvcu, vivocha.ws(e, t, n, r)
}
join(e, t) {
try {
return super.join((t, n) => {
if (t) e && e(t);
else {
const r = n.contact;
r && (r.transcript && r.transcript.filter(e => e.agent && !e.delivered && e._id).forEach(e => this.sendAck(e._id)), r.transferInfo && r.transferInfo.to && r.transferInfo.to.toId && this.onTransferred(r.transferInfo)), e(t, n)
}
}, t)
} catch (t) {
e(t)
}
}
setMessageProperties(e) {
return e.from_id = vivocha.dot(this, "contact.vvcu"), e.from_nick = vivocha.dot(this, "contact.nick"), e.from = vivocha.dot(this, "contact.nick"), e.party = "local", e.agent = !1, e
}
onTransferred(e) {
var t;
(null === (t = e.to) || void 0 === t ? void 0 : t.toId) && (this.send({
code: "transfer",
to: e.to.toId
}), this.channel.unbind(this.id, this.messageHandler), this.id = e.to.toId, this.channel.on(this.id, this.messageHandler), this.emit(e.code, e))
}
storeSurvey(e, t) {
return vivocha.nodeify(this.ws("store_survey", null, {
data: JSON.stringify(e),
vvct: this.contact.vvct,
vvcu: this.contact.vvcu,
cid: this.id
}, {}), t)
}
}
t.VivochaVisitorContact = i
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.VariableWrapper = t.VariableError = void 0;
const r = n(276),
i = n(189),
o = n(277);
class a extends Error {
constructor(e, t, n) {
super(t), this.variable = e, this.originalError = n
}
}
t.VariableError = a;
class s {
constructor(e) {
Object.assign(this, e), e.pattern && (this.pattern = new RegExp(e.pattern, "m"))
}
value(e) {
if (this.cache && this.cachedValue) return this.cachedValue; {
this.cacheTimer && (clearTimeout(this.cacheTimer), delete this.cacheTimer);
let t = (async () => {
let t;
try {
t = await this.rawValue(e)
} catch (e) {}
if (void 0 === t) return t;
let n = t;
if ("string" == typeof t && (this.pattern && this.transform && (n = t.replace(this.pattern, this.transform)), this.trim && (n = n.trim()), this.values && -1 === this.values.indexOf(n))) throw new a(this, "invalid_value");
switch (this.dataType) {
case "number":
n = "number" == typeof n ? n : parseFloat(n);
break;
case "boolean":
n = "boolean" == typeof n ? n : "true" === n || "1" === n || "TRUE" === n
}
return n
})();
return this.cache && (this.cachedValue = t, "number" == typeof this.cache && (this.cacheTimer = setTimeout(() => {
delete this.cachedValue
}, 1e3 * this.cache))), t
}
}
static create(e, t = {}) {
if (!e.id) throw new a(e, "no_id");
switch ("boolean" != typeof e.cache && "number" != typeof e.cache && (e.cache = !0), e.dataType || (e.dataType = "string"), "boolean" != typeof e.trim && (e.trim = !0), e.type) {
case "sel":
return new c(e);
case "js":
return new u(e, t);
case "ws":
return new h(e);
default:
throw new a(e, "unsupported_variable_type")
}
}
static createMany(e = [], t = {}) {
return e.map(e => s.create(e, t))
}
static createDict(e = [], t = {}, n) {
const i = n ? r.buildInVariables.filter(e => n.has(e.id)) : r.buildInVariables;
return s.createMany(i.concat(e), t).reduce((e, t) => (e[t.id] = e => t.value(e), e[t.id].meta = t, e), {})
}
}
t.VariableWrapper = s;
class c extends s {
async rawValue() {
const e = document.querySelector(this.selector);
if (e) {
return e.innerHTML
}
throw new a(this, "no_element")
}
}
class u extends s {
constructor(e, t = {}) {
super(e), this.ctx = t, this.script = i.Script.create("return " + e.code, t)
}
async rawValue(e) {
try {
return this.script(e)
} catch (e) {
throw new a(this, "invalid_code", e)
}
}
}
class h extends s {
rawValue() {
return o.parse(this.url, {
retriever: this.retriever.bind(this)
})
}
async retriever(e) {
try {
const t = await fetch(e);
return await t.json()
} catch (e) {
throw new a(this, "retriever_error", e)
}
}
}
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.OpeningHoursWrapper = void 0;
class r {
constructor(e) {
e && Object.assign(this, e), this.intervals || (this.intervals = [])
}
isOpen(e) {
return r.isOpen(e, this)
}
static isInInterval(e, t) {
return void 0 === t || (void 0 === t.from || e >= t.from) && (void 0 === t.to || e <= t.to)
}
static isInTimeInterval(e, t) {
if (r.isInInterval(e.getFullYear(), t.year) && r.isInInterval(e.getMonth() + 1, t.month) && r.isInInterval(e.getDay(), t.dayOfWeek) && r.isInInterval(e.getDate(), t.dayOfMonth)) {
if (void 0 !== t.hours) {
let n = {
from: void 0 !== t.hours.from ? 60 * t.hours.from + (t.minutes && t.minutes.from ? t.minutes.from : 0) : void 0,
to: void 0 !== t.hours.to ? 60 * t.hours.to + (t.minutes && t.minutes.to ? t.minutes.to : 0) : void 0
};
return r.isInInterval(60 * e.getHours() + e.getMinutes(), n)
}
return !0
}
return !1
}
static isOpen(e, t) {
return !t || (void 0 === t.intervals || !t.intervals.length || t.intervals.some(t => r.isInTimeInterval(e, t))) && (void 0 === t.exceptions || !t.exceptions.some(t => r.isInTimeInterval(e, t)))
}
}
t.OpeningHoursWrapper = r
}, , , , , , , , , , , , , , , , , , , function(e, t, n) {
if (window.vivocha && window.vivocha.config) console.warn && console.warn("Vivocha already loaded for account", window.vivocha.config.acct_id), e.exports = window.vivocha;
else {
var r = new(0, n(267).VivochaWebVisitorPage);
e.exports = r
}
}, function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.VivochaWebVisitorPage = void 0;
const client_core_1 = __webpack_require__(11),
page_1 = __webpack_require__(268),
campaign_1 = __webpack_require__(269),
platform_1 = __webpack_require__(243),
console = client_core_1.getLogger("vvc-page");
class VivochaWebVisitorPage extends page_1.VivochaVisitorPage {
constructor(e) {
super(new platform_1.VivochaVisitorBrowserHelper, e, !0), this.pluginSerializer = Promise.resolve(!0), "object" == typeof window.vvc_options && (this.options = window.vvc_options), this.config.doNotProfile = !!this.options.doNotProfile, this.events.on("log", (e, t) => {
const n = e => {
let t = "";
if ("string" == typeof e) try {
const n = JSON.parse(e);
if (n.servid && n.ver && n.wid) {
const e = this.getWidget("".concat(n.servid, "-").concat(n.ver, "-").concat(n.wid));
e && (t = e.context.campaign.name)
}
} catch (e) {}
return t
};
if (e && "0" != e) {
if (this.dot(this.config, "analytics.ga")) {
const r = n(t);
if ("undefined" != typeof _gaq && _gaq.push) {
const t = {
contact: 1,
cancelled: -1,
abandoned: -1,
dissuaded: -1
};
_gaq.push(["_trackEvent", "vivocha", e, r, t[e] || 0, !0])
}
"function" == typeof ga && ga("send", "event", "vivocha", e, r)
}
if (this.dot(this.config, "analytics.webtrends") && "undefined" != typeof webtrendsAsyncInit && "undefined" != typeof dcsMultiTrack && dcsMultiTrack.apply) {
const r = ["WT.dl", "vivocha", "DCSext.event", e, "DCSext.service", n(t)];
dcsMultiTrack.apply(this, r)
}
}
}), document.addEventListener("click", () => ++this.clicks)
}
createCampaignManager() {
return new campaign_1.BrowserCampaignManager(this)
}
getScript(e, t) {
let n = e,
r = document.createElement("script");
return t && (n = e + (-1 !== n.indexOf("?") ? "&" : "?") + "_=" + this.config.ajv), r.type = "text/javascript", r.charset = "utf-8", r.async = !0, r.src = n, document.getElementsByTagName("head")[0].appendChild(r), r
}
ready(e) {
return e ? this.managerHasBeenReady ? this.nodeify(this._ready, e) : void(window.vvc_ready_handlers ? window.vvc_ready_handlers.push(e) : window.vvc_ready_handlers = [e]) : this._ready
}
loadPlugins() {
return console.log("VivochaVisitorPage.loadPlugins()"), this.dataRequest("getData", "persistence.plugins").then((e = []) => {
e || (e = []), console.log("VivochaVisitorPage.loadPlugins() plugins", e);
let t = Promise.resolve(!0),
n = (e, n) => {
t = t.then(() => this.fetchPlugin(e, n))
};
for (let t = 0; t < e.length; t++) n(e[t].appId, e[t].scriptId);
return t
})
}
loadPlugin(e, t) {
return console.log('VivochaVisitorPage.loadPlugin("'.concat(e, '","').concat(t, '")')), this.dataRequest("getData", "persistence.plugins").then((n = []) => {
n || (n = []);
let r = !1;
for (let t = 0; !r && t < n.length; t++) r = n[t].appId === e && n[t].scriptId;
return !!r || this.fetchPlugin(e, t).then(() => (n.push({
appId: e,
scriptId: t
}), this.dataRequest("setData", "persistence.plugins", n)))
})
}
fetchPlugin(appId, scriptId) {
return console.log('VivochaVisitorPage.fetchPlugin("'.concat(appId, '","').concat(scriptId, '")')), fetch("".concat(this.config.apiurl, "v2/applications/").concat(appId, "/public/script/").concat(scriptId)).then(e => {
if (200 === e.status) return e.json();
throw new Error(e.statusText)
}).then(data => {
console.log('VivochaVisitorPage.fetchPlugin("'.concat(appId, '","').concat(scriptId, '")'), "script", data.script);
try {
if ("inline" !== data.type) {
if ("url" === data.type) return new Promise((e, t) => {
let n = this.getScript(data.script);
n.readyState ? n.onreadystatechange = () => {
"loaded" != n.readyState && "complete" != n.readyState || (n.onreadystatechange = null, e(!0))
} : n.onload = () => e(!0)
});
throw new Error("Unknown type")
}
eval(data.script)
} catch (e) {
throw console.error('VivochaVisitorPage.fetchPlugin("'.concat(appId, '","').concat(scriptId, '")'), "plugin error", e), e
}
return !0
})
}
getLeavingInfo() {
return this.leavingInfo || (this.leavingInfo = new Promise((e, t) => {
try {
__webpack_require__.e(6).then((n => {
try {
__webpack_require__(248);
const t = {
leaving: !1,
top: !1,
topLeft: !1,
topRight: !1,
bottomLeft: !1,
bottomRight: !1
},
n = e => {
t.leaving = t[e] = !0, this.manager.checkRules()
},
r = window.glio;
delete window.glio, r.init(["top", () => n("top")], ["top-left", () => n("topLeft")], ["top-right", () => n("topRight")], ["bottom-left", () => n("bottomLeft")], ["bottom-right", () => n("bottomRight")]), e(t)
} catch (e) {
t(e)
}
}).bind(null, __webpack_require__)).catch(e => {
t(e)
})
} catch (e) {
t(e)
}
})), this.leavingInfo
}
getReferrerInfo() {
return this.referrerInfo || (this.referrerInfo = new Promise((e, t) => {
try {
__webpack_require__.e(8).then((n => {
try {
const t = __webpack_require__(249).parse;
e(t(document.referrer, window.location.href))
} catch (e) {
t(e)
}
}).bind(null, __webpack_require__)).catch(e => {
t(e)
})
} catch (e) {
t(e)
}
})), this.referrerInfo
}
getUAInfo() {
return this.uaInfo || (this.uaInfo = new Promise((e, t) => {
try {
__webpack_require__.e(10).then((n => {
try {
const t = __webpack_require__(250);
e(new t)
} catch (e) {
t(e)
}
}).bind(null, __webpack_require__)).catch(e => {
t(e)
})
} catch (e) {
t(e)
}
})), this.uaInfo
}
async sync(e) {
if ("READY" !== this.state) throw new Error("unable to sync on state ".concat(this.state)); {
const t = await this.getSyncContactData(e),
n = await this.getSyncData(e, t.id, await this.getVVC());
n.managerId = this.manager.id, this.manager.process("sync", n)
}
}
readyData() {
return this.platform.readyData()
}
dataRequest(e, ...t) {
return this.platform.dataRequest(e, ...t)
}
flushReadyHandlers() {
return this.platform.flushReadyHandlers()
}
findWindow(e) {
return this.platform.findWindow(e)
}
getMediaWindow() {
return this.platform.getMediaWindow()
}
getMediaStream(e, t, n) {
return this.platform.getMediaStream(e, t, n)
}
createVideoFrame(e, t, n) {
return this.platform.createVideoFrame(e, t, n)
}
createLocalVideoFrame(e, t) {
return this.platform.createLocalVideoFrame(e, t)
}
createRemoteVideoFrame(e, t) {
return this.platform.createRemoteVideoFrame(e, t)
}
}
exports.VivochaWebVisitorPage = VivochaWebVisitorPage
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.VivochaVisitorPage = void 0;
const r = n(4),
i = n(9),
o = n(242),
a = r.default("vvc-page");
class s extends o.VivochaVisitorCore {
constructor(e, t, n) {
super(e, t, n), this.acct_id = t, this.loadTime = new Date, this.clicks = 0, this.managerHasBeenReady = !1, this.options = {}, this.events = new i.EventEmitter, this._ready = super.ready().then(async () => (this.manager = this.createCampaignManager(), this.manager.once("READY", () => {
this.managerHasBeenReady = !0
}), await this.vvcInfo(), this))
}
get state() {
return this.manager ? this.manager.state : "INIT"
}
async reload() {
return await this.ready(), await this.manager.process("reload"), this
}
async vvcInfo() {
const e = +new Date;
this.vvcuInfo = this.dataRequest("getData", "vvcu").then(e => e || {}, e => ({})), this.vvctInfo = this.dataRequest("getData", "vvct").then(e => e || {}, e => ({}));
const t = await this.vvcuInfo,
n = await this.vvctInfo;
t.first_visit || (t.first_visit = e, t.last_visit = e), n.visit_ts || (t.curr_visit && (t.last_visit = t.curr_visit), t.curr_visit = e, t.visits = t.visits ? t.visits + 1 : 1, n.visit_ts = e), t.pages = t.pages ? t.pages + 1 : 1, n.pages = n.pages ? n.pages + 1 : 1, await this.flushVVCUInfo(), await this.flushVVCTInfo()
}
getCustomerToken() {
return this.manager.getCustomerToken()
}
async setCustomerToken(e) {
return await this.ready(), await this.manager.ready, this.manager.setCustomerToken(e)
}
async unsetCustomerToken() {
return await this.ready(), await this.manager.ready, this.manager.unsetCustomerToken()
}
getWidget(e) {
return this.manager.widgets[e]
}
getAgentAvailability(e = []) {
if (!this.manager) return Promise.reject(new Error("no_manager"));
if (!this.manager.widgets) return Promise.reject(new Error("no_widget"));
const t = Object.keys(this.manager.widgets);
return t.length && this.manager.widgets[t[0]] ? this.manager.widgets[t[0]].getAgentAvailability(e) : Promise.reject(new Error("no_widget"))
}
getVisitorInfo() {
return this.visitorInfo || (this.visitorInfo = this.fetch("visitor-info?t=".concat(+new Date))), this.visitorInfo
}
getVVCUInfo() {
return this.vvcuInfo
}
async flushVVCUInfo() {
const e = await this.vvcuInfo;
await this.dataRequest("setData", "vvcu", e)
}
getVVCTInfo() {
return this.vvctInfo
}
async flushVVCTInfo() {
const e = await this.vvctInfo;
await this.dataRequest("setData", "vvct", e)
}
async track(e, t) {
a.info(e, t);
try {
this.events && this.events.emit("log", e, t)
} catch (e) {
a.error("track emit", e)
}
if (!this.config.doNotProfile) return this.platform.track(e, t);
a.warn("track disabled")
}
}
t.VivochaVisitorPage = s
}, function(e, t, n) {
"use strict";
var r = this && this.__decorate || function(e, t, n, r) {
var i, o = arguments.length,
a = o < 3 ? t : null === r ? r = Object.getOwnPropertyDescriptor(t, n) : r;
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) a = Reflect.decorate(e, t, n, r);
else
for (var s = e.length - 1; s >= 0; s--)(i = e[s]) && (a = (o < 3 ? i(a) : o > 3 ? i(t, n, a) : i(t, n)) || a);
return o > 3 && a && Object.defineProperty(t, n, a), a
};
Object.defineProperty(t, "__esModule", {
value: !0
}), t.BrowserCampaignManager = void 0;
const i = n(11),
o = n(270),
a = n(168),
s = n(271),
c = n(278),
u = n(281),
h = n(283),
d = i.getLogger("vvc-manager");
let l = class extends s.CampaignManager {
async START_entry() {
if (!window.__surfly) return super.START_entry();
d.warn("CampaignManager cannot proceed")
}
START_started() {
return this.enter("CHECK_SYNC")
}
READY_persistence(e) {
if (d.log("CampaignManager got persistence from storage", this.state, e), e) switch (e.mode) {
case "always":
this.enter("INIT_PERSISTENCE_READY", e);
break;
case "last":
case "first":
default:
d.debug("Entering pause for remote persistence"), this.enter("PAUSE_REMOTE")
}
}
async READY_sync(e) {
const t = await this.syncData2persistenceData(e);
t && (await this.vivocha.dataRequest("setData", "persistence", t), this.enter("INIT_PERSISTENCE_READY", t))
}
INTERACT_persistence(e) {
d.log("CampaignManager got persistence from storage", this.state, e), e ? "last" === e.mode && e.managerId !== this.id && this.enter("INTERACT_TO_REMOTE") : this.closePersistence()
}
async CHECK_SYNC_entry(e = new Date) {
const t = await this.vivocha.dataRequest("getSessionData", "sync");
if (t) {
d.log("CHECK_SYNC data found", t);
const e = await this.syncData2persistenceData(t);
e && await this.vivocha.dataRequest("setData", "persistence", e)
}
await this.vivocha.dataRequest("unsetSessionData", "sync"), this.enter("CHECK_PERSISTENCE", e)
}
async INIT_PERSISTENCE_START_entry(e) {
try {
switch (d.log("CampaignManager got persistence", e), e.mode) {
case "last":
this.isNewWindow && (e.managerId = this.id, await this.vivocha.dataRequest("setData", "persistence", e)), e.managerId === this.id ? (this.initPersistence(e), this.enter("CHECK_CAMPAIGNS_PERSISTENCE")) : this.enter("CHECK_CAMPAIGNS_PERSISTENCE_REMOTE");
break;
case "always":
this.initPersistence(e), this.enter("CHECK_CAMPAIGNS_PERSISTENCE");
break;
case "first":
default:
e.managerId === this.id ? (this.initPersistence(e), this.enter("CHECK_CAMPAIGNS_PERSISTENCE")) : this.enter("CHECK_CAMPAIGNS_PERSISTENCE_REMOTE")
}
} catch (t) {
d.error("CampaignManager bad persistence data", e), await this.vivocha.dataRequest("unsetData", "persistence"), this.enter("CHECK_CAMPAIGNS")
}
}
async INIT_PERSISTENCE_READY_entry(e) {
try {
d.log("CampaignManager got persistence", e), this.initPersistence(e), this.enter("PAUSE")
} catch (t) {
d.error("CampaignManager bad persistence data", e), await this.vivocha.dataRequest("unsetData", "persistence"), this.enter("READY")
}
}
async CHECK_CAMPAIGNS_PERSISTENCE_REMOTE_entry() {
const e = await this.fetchCampaignData();
this.enter("INIT_CAMPAIGNS_PERSISTENCE_REMOTE", e)
}
async INIT_CAMPAIGNS_PERSISTENCE_REMOTE_entry(e) {
await this.initCampaigns(e, !0), this.trackVisit(), this.enter("INTERACT_REMOTE")
}
async PAUSE_REMOTE_entry(e) {
await this.pauseWidgets(e), this.enter("INTERACT_REMOTE")
}
async INTERACT_TO_REMOTE_entry() {
this.closePersistence()
}
INTERACT_TO_REMOTE_interactionEnded(e) {
e instanceof h.VisitorWidget && e.process("pause"), this.enter("INTERACT_REMOTE", e)
}
async INTERACT_REMOTE_entry() {
this.setRemoteTimout()
}
INTERACT_REMOTE_interactionEnded(e) {
this.enter("RESUME", e)
}
INTERACT_REMOTE_persistence(e) {
d.log("CampaignManager got persistence from storage", this.state, e), e ? (d.log("CampaignManager reset remote persistence timeout", this.state, new Date(e.lastActivity), e), this.setRemoteTimout()) : this.interactionEnded()
}
fetchCampaignData() {
return this.vivocha.fetch("web-campaigns")
}
async fetchConversationData(e = !1) {
const t = await this.vivocha.getVVCU(),
n = this.customerToken,
r = await this.vivocha.dataRequest("getData", "conversation.lastActivity");
return this.vivocha.fetch("conversations?vvcu=".concat(t, "&channel=web").concat(e ? "&full=1" : "").concat(n ? "&tok=".concat(n) : "").concat(r ? "&la=".concat(r) : ""))
}
filterValidChannel(e) {
var t, n, r, i;
return e && !1 !== e.enabled && (null === (r = null === (n = null === (t = e.channels) || void 0 === t ? void 0 : t.web) || void 0 === n ? void 0 : n.entryPoints) || void 0 === r ? void 0 : r.length) && (null === (i = e.channels.web.engagements) || void 0 === i ? void 0 : i.length) ? e.channels.web : void 0
}
filterValidEntrypoints(e) {
return e.reduce((e, t) => {
if (t && t.id && !1 !== t.enabled) {
let n = !0;
if (t.includedUrls)
for (let e of t.includedUrls)
if (n = new o.StringMatchingRuleWrapper(e).match(window.location.href), n) break;
if (n) {
if (n = !1, t.excludedUrls)
for (let e of t.excludedUrls)
if (n = new o.StringMatchingRuleWrapper(e).match(window.location.href), n) break;
n || (e[t.id] = t)
}
}
return e
}, {})
}
createInteractionManager(e, t, n) {
return new c.WebInteractionManager(e, this.vivocha, t, n)
}
createLanguageResolver(e, t) {
return new u.WebLanguageSettingsWrapper(e, t, () => this.vivocha.getVisitorInfo())
}
createVisitorWidget(e, t) {
return new h.WebVisitorWidget(this.vivocha, this, e, t)
}
createConversationWidget(e) {
return new h.WebConversationWidget(this.vivocha, this, e)
}
createPersistenceWidget(e) {
return new h.WebPersistenceWidget(this.vivocha, this, e)
}
async syncData2persistenceData(e, t = new Date) {
const {
campaign: n,
contact: r,
managerId: i
} = e;
if (r && r.sync && r.sync.expires && new Date(r.sync.expires) >= t) {
const {
vvcu: e,
vvct: o
} = await this.vivocha.getVVC(), a = n.channels.web.entryPoints[0], s = await this.createLanguageResolver(a.language, n).resolve(), c = await this.vivocha.cdnfetch("campaigns/".concat(n.id, "/").concat(n.version, "/interaction/").concat(s, "/").concat(n.hash || "-", "/").concat(n.channels.web.interaction.templateHash || "-", "/variables.json")), u = {
managerId: i,
lastActivity: +t,
contact: r,
widgetContext: {
campaign: n,
entryPoint: a,
engagement: {
id: "sync",
name: "sync",
widget: null,
entryPointIds: [a.id]
},
media: n.media
},
interactionContext: {
campaign: n,
entryPointId: a.id,
engagementId: null,
media: n.media,
routing: n.routing,
language: s,
mediaPreset: r.initial_preset,
variables: c,
page: {
vvcu: e,
vvct: o
},
persistenceId: r.id
}
};
return c.persistenceMode && (u.mode = c.persistenceMode), u
}
d.warn("sync expired", r && r.sync && r.sync.expires)
}
async conversation2persistenceData(e, t = new Date) {
if (e.currentContact) {
const {
vvcu: n,
vvct: r
} = await this.vivocha.getVVC(), i = e.campaign, o = i.channels.web, a = e.currentContact, s = a.serv_lang, c = await this.vivocha.cdnfetch("campaigns/".concat(i.id, "/").concat(i.version, "/interaction/").concat(s, "/").concat(i.hash || "-", "/").concat(o.interaction.templateHash || "-", "/variables.json")), u = {
campaign: i,
entryPoint: null,
engagement: {
id: "conversation",
name: "conversation",
widget: null,
entryPointIds: []
},
media: i.media
}, h = {
campaign: i,
entryPointId: null,
engagementId: null,
media: i.media,
routing: i.routing,
language: s,
mediaPreset: a.initial_preset,
variables: c,
page: {
vvcu: n,
vvct: r
},
persistenceId: a.id
}, d = {
managerId: this.id,
lastActivity: +t,
contact: a,
widgetContext: u,
interactionContext: h
};
return c.persistenceMode && (d.mode = c.persistenceMode), d
}
d.warn("conversation without current contact", e)
}
};
r([a.handle("READY", "persistence")], l.prototype, "READY_persistence", null), r([a.handle("READY", "sync")], l.prototype, "READY_sync", null), r([a.handle("INTERACT", "persistence")], l.prototype, "INTERACT_persistence", null), r([a.defer("CHECK_SYNC", "reload"), a.defer("CHECK_SYNC", "setCustomerToken"), a.entry("CHECK_SYNC")], l.prototype, "CHECK_SYNC_entry", null), r([a.entry("INIT_PERSISTENCE_START")], l.prototype, "INIT_PERSISTENCE_START_entry", null), r([a.defer("INIT_PERSISTENCE_READY", "reload"), a.defer("INIT_PERSISTENCE_READY", "setCustomerToken"), a.entry("INIT_PERSISTENCE_READY")], l.prototype, "INIT_PERSISTENCE_READY_entry", null), r([a.defer("CHECK_CAMPAIGNS_PERSISTENCE_REMOTE", "reload"), a.defer("CHECK_CAMPAIGNS_PERSISTENCE_REMOTE", "setCustomerToken"), a.entry("CHECK_CAMPAIGNS_PERSISTENCE_REMOTE")], l.prototype, "CHECK_CAMPAIGNS_PERSISTENCE_REMOTE_entry", null), r([a.defer("INIT_CAMPAIGNS_PERSISTENCE_REMOTE", "reload"), a.defer("INIT_CAMPAIGNS_PERSISTENCE_REMOTE", "setCustomerToken"), a.entry("INIT_CAMPAIGNS_PERSISTENCE_REMOTE")], l.prototype, "INIT_CAMPAIGNS_PERSISTENCE_REMOTE_entry", null), r([a.defer("PAUSE_REMOTE", "reload"), a.defer("PAUSE_REMOTE", "setCustomerToken"), a.entry("PAUSE_REMOTE")], l.prototype, "PAUSE_REMOTE_entry", null), r([a.defer("INTERACT_TO_REMOTE", "reload"), a.defer("INTERACT_TO_REMOTE", "setCustomerToken"), a.defer("INTERACT_TO_REMOTE", "persistence"), a.entry("INTERACT_TO_REMOTE")], l.prototype, "INTERACT_TO_REMOTE_entry", null), r([a.handle("INTERACT_TO_REMOTE", "interactionEnded")], l.prototype, "INTERACT_TO_REMOTE_interactionEnded", null), r([a.defer("INTERACT_REMOTE", "reload"), a.defer("INTERACT_REMOTE", "setCustomerToken"), a.entry("INTERACT_REMOTE")], l.prototype, "INTERACT_REMOTE_entry", null), r([a.handle("INTERACT_REMOTE", "interactionEnded")], l.prototype, "INTERACT_REMOTE_interactionEnded", null), r([a.handle("INTERACT_REMOTE", "persistence")], l.prototype, "INTERACT_REMOTE_persistence", null), l = r([a.fsm("START")], l), t.BrowserCampaignManager = l
}, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.StringMatchingRuleWrapper = void 0;
t.StringMatchingRuleWrapper = class {
constructor(e) {
Object.assign(this, e)
}
match(e) {
switch (this.type) {
case "equals":
return e === this.pattern;
case "starts":
return 0 === e.indexOf(this.pattern);
case "ends":
return e.length >= this.pattern.length && e.indexOf(this.pattern) === e.length - this.pattern.length;
case "contains":
return -1 !== e.indexOf(this.pattern);
case "matches":
return RegExp(this.pattern).test(e)
}
}
}
}, function(e, t, n) {
"use strict";
var r = this && this.__decorate || function(e, t, n, r) {
var i, o = arguments.length,
a = o < 3 ? t : null === r ? r = Object.getOwnPropertyDescriptor(t, n) : r;
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) a = Reflect.decorate(e, t, n, r);
else
for (var s = e.length - 1; s >= 0; s--)(i = e[s]) && (a = (o < 3 ? i(a) : o > 3 ? i(t, n, a) : i(t, n)) || a);
return o > 3 && a && Object.defineProperty(t, n, a), a
};
Object.defineProperty(t, "__esModule", {
value: !0
}), t.CampaignManager = void 0;
const i = n(11),
o = n(188),
a = n(272),
s = n(168),
c = n(167),
u = n(273),
h = n(246),
d = i.getLogger("vvc-manager");
let l = class extends s.Machine {
constructor(e) {
super(void 0, void 0, "vvc-manager"), this.vivocha = e
}
async START_entry() {
const e = await this.vivocha.dataRequest("getSessionData", "managerId");
e ? (this.isNewWindow = !1, this.id = e) : (this.isNewWindow = !0, this.id = await this.vivocha.dataRequest("setSessionData", "managerId", c.v4())), d.log("CampaignManager ".concat(this.id));
(await this.vivocha.dataRequest("getEvents")).on("change-persistence", e => {
this.process("persistence", e)
}), this.vivocha.options.waitForToken ? this.process("waitForToken", this.vivocha.options.waitForToken) : this.process("started")
}
START_waitForToken(e) {
return this.enter("WAIT_FOR_TOKEN", e)
}
START_started() {
return this.enter("CHECK_PERSISTENCE")
}
async WAIT_FOR_TOKEN_entry(e) {
this.waitForTokenTimeout = window.setTimeout(() => {
this.process("timeout")
}, e)
}
WAIT_FOR_TOKEN_exit() {
this.waitForTokenTimeout && (window.clearTimeout(this.waitForTokenTimeout), delete this.waitForTokenTimeout)
}
async WAIT_FOR_TOKEN_setCustomerToken(e) {
this.enter("SET_CUSTOMER_TOKEN", e)
}
async WAIT_FOR_TOKEN_unsetCustomerToken() {
this.enter("UNSET_CUSTOMER_TOKEN")
}
async WAIT_FOR_TOKEN_timeout() {
return this.enter("CHECK_PERSISTENCE")
}
async CHECK_PERSISTENCE_entry(e = new Date) {
const t = await this.vivocha.dataRequest("getData", "persistence");
t ? new Date(t.lastActivity + 6e4) >= e ? this.enter("INIT_PERSISTENCE_START", t) : (d.error("CampaignManager very old persistence data", new Date(t.lastActivity), e), await this.vivocha.dataRequest("unsetData", "persistence"), this.enter("CHECK_CONVERSATION")) : this.enter("CHECK_CONVERSATION")
}
async CHECK_CONVERSATION_entry() {
const e = await this.vivocha.dataRequest("getData", "conversation");
if (e || this.customerToken) try {
const t = await this.vivocha.getVVCU(),
n = this.customerToken,
r = await this.fetchConversationData(!0);
if (d.log("CampaignManager CHECK_CONVERSATION, activeConversations", r), !r || !r.length) throw d.log("Conversation not found for current vvcu ".concat(t, " and token ").concat(n)), new Error("Conversation not found"); {
const t = r[0];
if (await this.vivocha.dataRequest("setData", "conversation", {
_id: t._id,
lastActivity: (null == e ? void 0 : e.lastActivity) || +new Date
}), t.currentContact) {
const e = await this.conversation2persistenceData(t);
await this.vivocha.dataRequest("setData", "persistence", e), this.enter("INIT_PERSISTENCE_START", e)
} else this.enter("INIT_CONVERSATION_START", t)
}
} catch (e) {
d.log("CHECK_CONVERSATION", e), await this.vivocha.dataRequest("unsetData", "conversation"), this.enter("CHECK_CAMPAIGNS")
} else this.enter("CHECK_CAMPAIGNS")
}
async CHECK_CAMPAIGNS_entry() {
const e = await this.fetchCampaignData();
e && e.campaigns && e.campaigns.length ? this.enter("INIT_CAMPAIGNS", e) : this.enter("NO_CAMPAIGNS")
}
NO_CAMPAIGNS_reload() {
return this.enter("RELOAD")
}
async INIT_CAMPAIGNS_entry(e) {
await this.initCampaigns(e), Object.keys(this.widgets).length < 1 ? this.enter("NO_CAMPAIGNS") : (this.trackVisit(), this.enter("READY"))
}
async READY_entry(e) {
this.customerToken && (this.conversationTimeout = window.setTimeout(() => this.process("checkConversation"), 1e4))
}
READY_exit() {
this.conversationTimeout && (window.clearTimeout(this.conversationTimeout), delete this.conversationTimeout)
}
async READY_checkConversation() {
try {
const e = await this.vivocha.getVVCU(),
t = this.customerToken,
n = await this.fetchConversationData(!0);
if (d.log("CampaignManager READY, engageRequest check for currentContact in activeConversations", n), !n || !n.length) throw d.log("Conversation not found for current vvcu ".concat(e, " and token ").concat(t)), new Error("Conversation not found"); {
const e = n[0];
if (await this.vivocha.dataRequest("setData", "conversation", {
_id: e._id,
lastActivity: +new Date
}), e.currentContact) {
const t = await this.conversation2persistenceData(e);
await this.vivocha.dataRequest("setData", "persistence", t), this.enter("PAUSE_AND_INIT_PERSISTENCE_START", t)
} else this.enter("PAUSE_AND_INIT_CONVERSATION_START", e)
}
} catch (e) {
d.log("READY checkConversation", e), this.conversationTimeout = window.setTimeout(() => this.process("checkConversation"), 1e4)
}
}
async READY_engageRequest(e, t) {
try {
const n = await this.vivocha.getVVCU(),
r = this.customerToken,
i = await this.fetchConversationData(!0);
if (d.log("CampaignManager READY, engageRequest check for currentContact in activeConversations", i), !i || !i.length) throw d.log("Conversation not found for current vvcu ".concat(n, " and token ").concat(r)), new Error("Conversation not found"); {
const n = i[0];
if (await this.vivocha.dataRequest("setData", "conversation", {
_id: n._id,
lastActivity: +new Date
}), n.currentContact) {
const t = await this.conversation2persistenceData(n);
await this.vivocha.dataRequest("setData", "persistence", t), e.process("pause"), this.enter("INIT_PERSISTENCE_START", t)
} else e.process("engage", t)
}
} catch (n) {
d.log("READY engageRequest", n), e.process("engage", t)
}
}
async READY_interactionRequest(e) {
this.enter("PAUSE", e)
}
async READY_reload() {
this.enter("RELOAD")
}
READY_checkRules() {
for (let e in this.widgets) this.widgets[e].process("checkRules")
}
async READY_setCustomerToken(e) {
const t = JSON.parse(u.default.decode(e.split(".")[1]));
if (d.log("READY setCustomerToken payload", t), this.customerToken) {
d.warn("READY setCustomerToken: has already a token");
JSON.parse(u.default.decode(this.customerToken.split(".")[1])).id !== t.id ? this.enter("PAUSE_AND_SET_CUSTOMER_TOKEN", e) : this.customerToken = e
} else this.enter("PAUSE_AND_SET_CUSTOMER_TOKEN", e)
}
async READY_unsetCustomerToken() {
this.customerToken ? this.enter("UNSET_CUSTOMER_TOKEN") : d.warn("READY unsetCustomerToken no customerToken was set")
}
async PAUSE_entry(e) {
await this.pauseWidgets(e), this.enter("INTERACT")
}
async PAUSE_AND_SET_CUSTOMER_TOKEN_entry(e) {
await this.pauseWidgets(), this.enter("SET_CUSTOMER_TOKEN", e)
}
async PAUSE_AND_INIT_PERSISTENCE_START_entry(e) {
await this.pauseWidgets(), this.enter("INIT_PERSISTENCE_START", e)
}
async PAUSE_AND_INIT_CONVERSATION_START_entry(e) {
await this.pauseWidgets(), this.enter("INIT_CONVERSATION_START", e)
}
INTERACT_exit() {
this.pingTimeout && (window.clearTimeout(this.pingTimeout), delete this.pingTimeout)
}
async INTERACT_ping() {
const e = +new Date;
await this.vivocha.dataRequest("getData", "persistence.lastActivity") && await this.vivocha.dataRequest("setData", "persistence.lastActivity", e), await this.vivocha.dataRequest("getData", "conversation.lastActivity") && await this.vivocha.dataRequest("setData", "conversation.lastActivity", e), this.pingTimeout = window.setTimeout(() => this.process("ping"), 1e4)
}
async INTERACT_interactionEnded(e) {
await this.vivocha.dataRequest("getData", "conversation") ? this.enter("CHECK_CONVERSATION", e) : this.enter("RESUME", e)
}
async RESUME_entry(e) {
for (let t in this.widgets) {
let n = this.widgets[t];
n !== e && await n.process("resume")
}
this.enter("READY")
}
async RELOAD_entry() {
for (let e in this.widgets) await this.widgets[e].process("pause");
this.widgets = {}, this.enter("CHECK_CAMPAIGNS")
}
async INIT_PERSISTENCE_START_entry(e) {
this.initPersistence(e), this.enter("CHECK_CAMPAIGNS_PERSISTENCE")
}
async INIT_CONVERSATION_START_entry(e) {
this.initConversation(e), this.enter("CHECK_CAMPAIGNS_CONVERSATION")
}
async CHECK_CAMPAIGNS_PERSISTENCE_entry() {
const e = await this.fetchCampaignData();
this.enter("INIT_CAMPAIGNS_PERSISTENCE", e)
}
async CHECK_CAMPAIGNS_CONVERSATION_entry() {
const e = await this.fetchCampaignData();
this.enter("INIT_CAMPAIGNS_CONVERSATION", e)
}
async INIT_CAMPAIGNS_PERSISTENCE_entry(e) {
await this.initCampaigns(e, !0), this.trackVisit(), this.enter("INTERACT")
}
async INIT_CAMPAIGNS_CONVERSATION_entry(e) {
await this.initCampaigns(e, !0), this.trackVisit(), this.enter("CONVERSATION_IDLE")
}
async CONVERSATION_IDLE_interactionRequest(e) {
this.enter("INTERACT")
}
async CONVERSATION_IDLE_reload() {
this.enter("RELOAD")
}
async CONVERSATION_IDLE_setCustomerToken(e) {
const t = JSON.parse(u.default.decode(e.split(".")[1]));
if (d.log("CONVERSATION_IDLE setCustomerToken payload", t), this.customerToken) {
d.warn("CONVERSATION_IDLE setCustomerToken: has already a token");
JSON.parse(u.default.decode(this.customerToken.split(".")[1])).id !== t.id ? (await this.vivocha.dataRequest("unsetData", "conversation"), this.conversationWidget.removeInteraction(), delete this.conversationWidget, this.enter("SET_CUSTOMER_TOKEN", e)) : this.customerToken = e
} else await this.vivocha.dataRequest("unsetData", "conversation"), this.conversationWidget.removeInteraction(), delete this.conversationWidget, this.enter("SET_CUSTOMER_TOKEN", e)
}
async CONVERSATION_IDLE_unsetCustomerToken() {
this.customerToken ? (await this.vivocha.dataRequest("unsetData", "conversation"), this.conversationWidget.removeInteraction(), delete this.conversationWidget, this.enter("UNSET_CUSTOMER_TOKEN")) : d.warn("CONVERSATION_IDLE unsetCustomerToken no customerToken was set")
}
async SET_CUSTOMER_TOKEN_entry(e) {
const t = JSON.parse(u.default.decode(e.split(".")[1]));
d.log("SET_CUSTOMER_TOKEN payload", t);
let n = await this.vivocha.getVVCUInfo();
n.ext_id && n.ext_id !== t.id && (d.warn("SET_CUSTOMER_TOKEN payload: different customer id. Switching VVCU and VVCT"), await this.vivocha.resetVVC(), await this.vivocha.vvcInfo(), n = await this.vivocha.getVVCUInfo()), n.ext_id = t.id, await this.vivocha.flushVVCUInfo(), this.customerToken = e, this.enter("CHECK_CONVERSATION")
}
async UNSET_CUSTOMER_TOKEN_entry() {
await this.vivocha.resetVVC(), await this.vivocha.vvcInfo(), this.enter("CHECK_CAMPAIGNS")
}
getCustomerToken() {
return this.customerToken
}
async setCustomerToken(e) {
return this.process("setCustomerToken", e)
}
async unsetCustomerToken() {
return this.process("unsetCustomerToken")
}
async initCampaigns(e, t) {
this.dataCollections = e.dataCollections, d.log("CampaignManager got campaigns", e.campaigns);
const n = [];
for (let t of e.campaigns) {
let e, r;
const i = this.filterValidChannel(t);
if (!i) continue;
const s = this.filterValidEntrypoints(i.entryPoints);
d.log("matching entrypoints", s), Object.keys(s).length && i.engagements.forEach(c => {
if (c && !1 !== c.enabled && c.entryPointIds && c.entryPointIds.length) {
let u = c.entryPointIds.find(e => !!s[e]);
if (!u) return; {
let h = s[u];
const l = {
campaign: t,
entryPoint: h,
engagement: c,
dataCollections: this.dataCollections
};
t.validity && (e || (e = new a.ValidityWrapper(t.validity)), l.validity = e), i.actions && (r || (r = new o.ChannelActionsWrapper(i.actions, {
campaign: this
})), l.channelActions = r), n.push(l), d.log("matching engagement ".concat(c.id, ", campaign ").concat(t.name || t.id, ", entrypoint ").concat(h.id), l)
}
}
})
}
this.variables = h.VariableWrapper.createDict(e.variables || [], {
vivocha: this.vivocha
}), this.widgets = n.reduce((e, n) => (n.variables = this.variables, e["".concat(n.campaign.id, "-").concat(n.campaign.version, "-").concat(n.engagement.id)] = this.createVisitorWidget(n, t), e), {}), d.log("widgets", this.widgets)
}
initConversation(e) {
if (!this.filterValidChannel(e.campaign)) throw new Error("Unable to find a valid channel");
this.conversationWidget = this.createConversationWidget(e)
}
initPersistence(e) {
const t = this.filterValidChannel(e.widgetContext.campaign);
if (!t) throw new Error("Unable to find a valid channel");
t.actions && (e.widgetContext.channelActions = new o.ChannelActionsWrapper(t.actions, {
campaign: this
})), this.persistenceWidget = this.createPersistenceWidget(e)
}
closePersistence() {
const e = this.getInteractionWidget();
if (!e) throw new Error("Unable to find persistent widget");
e.enter("CLOSED_INTERACTION")
}
fetchCampaignData() {
throw new Error("not implemented")
}
fetchConversationData(e = !1) {
throw new Error("not implemented")
}
filterValidChannel(e) {
throw new Error("not implemented")
}
filterValidEntrypoints(e) {
throw new Error("not implemented")
}
createInteractionManager(e, t, n) {
throw new Error("not implemented")
}
createLanguageResolver(e, t) {
throw new Error("not implemented")
}
createVisitorWidget(e, t) {
throw new Error("not implemented")
}
createConversationWidget(e) {
throw new Error("not implemented")
}
createPersistenceWidget(e) {
throw new Error("not implemented")
}
trackVisit() {
let e = {};
for (let t in this.widgets) {
const n = this.widgets[t].context;
let r = [];
for (let e in n.campaign.media) - 1 !== ["both", "visitor"].indexOf(n.campaign.media[e]) && r.push(e);
e[n.campaign.id] ? e[n.campaign.id].widgets.push(n.engagement.id) : e[n.campaign.id] = {
media: r,
widgets: [n.engagement.id]
}
}
this.vivocha.track("0", JSON.stringify({
services: e
}))
}
getInteractionWidget() {
if (this.persistenceWidget) return this.persistenceWidget;
for (let e in this.widgets) {
let t = this.widgets[e];
if ("PAUSE" !== t.state) return t
}
}
setRemoteTimout() {
this.remoteTimeout && clearTimeout(this.remoteTimeout), this.remoteTimeout = window.setTimeout(() => {
this.interactionEnded()
}, 6e4)
}
async pauseWidgets(e) {
for (let t in this.widgets) {
let n = this.widgets[t];
n !== e && await n.process("pause")
}
}
engageRequest(e, t) {
this.process("engageRequest", e, t)
}
interactionRequest(e) {
this.process("interactionRequest", e)
}
interactionEnded(e) {
this.process("interactionEnded", e)
}
checkRules() {
this.process("checkRules")
}
async conversation2persistenceData(e, t = new Date) {
throw new Error("not implemented")
}
};
r([s.defer("START", "reload"), s.defer("START", "setCustomerToken"), s.entry("START")], l.prototype, "START_entry", null), r([s.handle("START", "waitForToken")], l.prototype, "START_waitForToken", null), r([s.handle("START", "started")], l.prototype, "START_started", null), r([s.defer("WAIT_FOR_TOKEN", "reload"), s.entry("WAIT_FOR_TOKEN")], l.prototype, "WAIT_FOR_TOKEN_entry", null), r([s.exit("WAIT_FOR_TOKEN")], l.prototype, "WAIT_FOR_TOKEN_exit", null), r([s.handle("WAIT_FOR_TOKEN", "setCustomerToken")], l.prototype, "WAIT_FOR_TOKEN_setCustomerToken", null), r([s.handle("WAIT_FOR_TOKEN", "unsetCustomerToken")], l.prototype, "WAIT_FOR_TOKEN_unsetCustomerToken", null), r([s.handle("WAIT_FOR_TOKEN", "timeout")], l.prototype, "WAIT_FOR_TOKEN_timeout", null), r([s.defer("CHECK_PERSISTENCE", "reload"), s.defer("CHECK_PERSISTENCE", "setCustomerToken"), s.entry("CHECK_PERSISTENCE")], l.prototype, "CHECK_PERSISTENCE_entry", null), r([s.defer("CHECK_CONVERSATION", "reload"), s.defer("CHECK_CONVERSATION", "setCustomerToken"), s.entry("CHECK_CONVERSATION")], l.prototype, "CHECK_CONVERSATION_entry", null), r([s.defer("CHECK_CAMPAIGNS", "reload"), s.defer("CHECK_CAMPAIGNS", "setCustomerToken"), s.entry("CHECK_CAMPAIGNS")], l.prototype, "CHECK_CAMPAIGNS_entry", null), r([s.defer("NO_CAMPAIGNS", "setCustomerToken"), s.handle("NO_CAMPAIGNS", "reload")], l.prototype, "NO_CAMPAIGNS_reload", null), r([s.defer("INIT_CAMPAIGNS", "reload"), s.defer("INIT_CAMPAIGNS", "setCustomerToken"), s.entry("INIT_CAMPAIGNS")], l.prototype, "INIT_CAMPAIGNS_entry", null), r([s.entry("READY")], l.prototype, "READY_entry", null), r([s.exit("READY")], l.prototype, "READY_exit", null), r([s.handle("READY", "checkConversation")], l.prototype, "READY_checkConversation", null), r([s.handle("READY", "engageRequest")], l.prototype, "READY_engageRequest", null), r([s.handle("READY", "interactionRequest")], l.prototype, "READY_interactionRequest", null), r([s.handle("READY", "reload")], l.prototype, "READY_reload", null), r([s.handle("READY", "checkRules")], l.prototype, "READY_checkRules", null), r([s.handle("READY", "setCustomerToken")], l.prototype, "READY_setCustomerToken", null), r([s.handle("READY", "unsetCustomerToken")], l.prototype, "READY_unsetCustomerToken", null), r([s.defer("PAUSE", "reload"), s.defer("PAUSE", "setCustomerToken"), s.entry("PAUSE")], l.prototype, "PAUSE_entry", null), r([s.defer("PAUSE_AND_SET_CUSTOMER_TOKEN", "reload"), s.defer("PAUSE_AND_SET_CUSTOMER_TOKEN", "setCustomerToken"), s.entry("PAUSE_AND_SET_CUSTOMER_T