@reactoo/watchtogether-sdk-js 2.5.75 → 2.5.76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/watchtogether-sdk.js +210 -165
- package/dist/watchtogether-sdk.min.js +2 -2
- package/example/index.html +1 -0
- package/package.json +1 -1
- package/src/models/asset.js +1 -1
- package/src/models/room.js +2 -2
- package/src/models/system.js +37 -0
- package/src/models/user.js +10 -8
- package/src/modules/wt-iot.js +3 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @reactoo/watchtogether-sdk-js
|
|
3
|
-
* @version 2.5.
|
|
3
|
+
* @version 2.5.76
|
|
4
4
|
*/
|
|
5
5
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
6
6
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -753,11 +753,11 @@ eval("// TODO(Babel 8): Remove this file.\nvar runtime = __webpack_require__(/*!
|
|
|
753
753
|
/*!**************************************************************************!*\
|
|
754
754
|
!*** ./node_modules/@fingerprintjs/fingerprintjs-pro/dist/fp.esm.min.js ***!
|
|
755
755
|
\**************************************************************************/
|
|
756
|
-
/*! exports provided: ERROR_API_KEY_EXPIRED, ERROR_API_KEY_INVALID, ERROR_API_KEY_MISSING, ERROR_BAD_REQUEST_FORMAT, ERROR_BAD_RESPONSE_FORMAT, ERROR_CLIENT_TIMEOUT, ERROR_FORBIDDEN_ENDPOINT, ERROR_FORBIDDEN_HEADER, ERROR_FORBIDDEN_ORIGIN, ERROR_GENERAL_SERVER_FAILURE, ERROR_INSTALLATION_METHOD_RESTRICTED, ERROR_NETWORK_ABORT, ERROR_NETWORK_CONNECTION, ERROR_RATE_LIMIT, ERROR_SCRIPT_LOAD_FAIL, ERROR_SERVER_TIMEOUT, ERROR_SUBSCRIPTION_NOT_ACTIVE, ERROR_TOKEN_EXPIRED, ERROR_TOKEN_INVALID, ERROR_TOKEN_MISSING, ERROR_UNSUPPORTED_VERSION, ERROR_WRONG_REGION, default, load */
|
|
756
|
+
/*! exports provided: ERROR_API_KEY_EXPIRED, ERROR_API_KEY_INVALID, ERROR_API_KEY_MISSING, ERROR_BAD_REQUEST_FORMAT, ERROR_BAD_RESPONSE_FORMAT, ERROR_CLIENT_TIMEOUT, ERROR_CSP_BLOCK, ERROR_FORBIDDEN_ENDPOINT, ERROR_FORBIDDEN_HEADER, ERROR_FORBIDDEN_ORIGIN, ERROR_GENERAL_SERVER_FAILURE, ERROR_INSTALLATION_METHOD_RESTRICTED, ERROR_NETWORK_ABORT, ERROR_NETWORK_CONNECTION, ERROR_RATE_LIMIT, ERROR_SCRIPT_LOAD_FAIL, ERROR_SERVER_TIMEOUT, ERROR_SUBSCRIPTION_NOT_ACTIVE, ERROR_TOKEN_EXPIRED, ERROR_TOKEN_INVALID, ERROR_TOKEN_MISSING, ERROR_UNSUPPORTED_VERSION, ERROR_WRONG_REGION, default, load */
|
|
757
757
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
758
758
|
|
|
759
759
|
"use strict";
|
|
760
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_API_KEY_EXPIRED\", function() { return _; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_API_KEY_INVALID\", function() { return c; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_API_KEY_MISSING\", function() { return l; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_BAD_REQUEST_FORMAT\", function() { return O; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_BAD_RESPONSE_FORMAT\", function() { return R; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_CLIENT_TIMEOUT\", function() { return o; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_FORBIDDEN_ENDPOINT\", function() { return u; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_FORBIDDEN_HEADER\", function() { return v; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_FORBIDDEN_ORIGIN\", function() { return N; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_GENERAL_SERVER_FAILURE\", function() { return I; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_INSTALLATION_METHOD_RESTRICTED\", function() { return E; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_NETWORK_ABORT\", function() { return i; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_NETWORK_CONNECTION\", function() { return n; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_RATE_LIMIT\", function() { return f; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_SCRIPT_LOAD_FAIL\", function() { return h; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_SERVER_TIMEOUT\", function() { return p; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_SUBSCRIPTION_NOT_ACTIVE\", function() { return d; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_TOKEN_EXPIRED\", function() { return T; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_TOKEN_INVALID\", function() { return P; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_TOKEN_MISSING\", function() { return A; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_UNSUPPORTED_VERSION\", function() { return s; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_WRONG_REGION\", function() { return a; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return w; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"load\", function() { return D; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.js\");\n/**\n * FingerprintJS Pro v3.7.0 - Copyright (c) FingerprintJS, Inc, 2022 (https://fingerprint.com)\n *\n * This software contains code from open-source projects:\n * MurmurHash3 by Karan Lyons (https://github.com/karanlyons/murmurHash3.js)\n */\n\n\nfunction r(e) {\n for (var t = \"\", r = 0; r < e.length; ++r) if (r > 0) {\n var o = e[r].toLowerCase();\n o !== e[r] ? t += \" \" + o : t += e[r];\n } else t += e[r].toUpperCase();\n\n return t;\n}\n\nvar o = \"Client timeout\",\n n = \"Network connection error\",\n i = \"Network request aborted\",\n R = \"Response cannot be parsed\",\n a = /*#__PURE__*/r(\"WrongRegion\"),\n d = /*#__PURE__*/r(\"SubscriptionNotActive\"),\n s = /*#__PURE__*/r(\"UnsupportedVersion\"),\n E = /*#__PURE__*/r(\"InstallationMethodRestricted\"),\n u = /*#__PURE__*/r(\"HostnameRestricted\"),\n l = \"API key required\",\n c = \"API key not found\",\n _ = \"API key expired\",\n O = \"Request cannot be parsed\",\n I = \"Request failed\",\n p = \"Request failed to process\",\n f = \"Too many requests, rate limit exceeded\",\n N = \"Not available for this origin\",\n v = \"Not available with restricted header\",\n A = \"API key required\",\n P = \"API key not found\",\n T = \"API key expired\";\n\nfunction y(e, t, r) {\n return void 0 === r && (r = 0), t(r).catch(function (o) {\n if (r >= e.maxRetries) throw o;\n var n,\n i,\n R,\n a,\n d = (n = e.baseDelay, i = e.maxDelay, R = e.baseDelay * Math.pow(2, r), Math.max(n, Math.min(i, R)));\n return (a = d, new Promise(function (e) {\n return setTimeout(e, a);\n })).then(function () {\n return y(e, t, r + 1);\n });\n });\n}\n\nvar h = \"Failed to load the JS script of the agent\",\n m = \"https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js\";\n\nfunction D(r) {\n var o,\n n,\n i = r.scriptUrlPattern,\n R = r.token,\n a = r.apiKey,\n d = void 0 === a ? R : a,\n s = Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__rest\"])(r, [\"scriptUrlPattern\", \"token\", \"apiKey\"]),\n E = (o = r, n = \"scriptUrlPattern\", Object.prototype.hasOwnProperty.call(o, n) ? i : void 0),\n u = [];\n return Promise.resolve().then(function () {\n if (!d || \"string\" != typeof d) throw new Error(\"API key required\");\n return y({\n maxRetries: 5,\n baseDelay: 100,\n maxDelay: 3e3\n }, function () {\n var e,\n t = new Date(),\n r = function () {\n return u.push({\n startedAt: t,\n finishedAt: new Date()\n });\n },\n o = (e = function (e, t) {\n void 0 === t && (t = m);\n var r = encodeURIComponent;\n return t.replace(/<[^<>]+>/g, function (t) {\n return \"<version>\" === t ? \"3\" : \"<apiKey>\" === t ? r(e) : \"<loaderVersion>\" === t ? r(\"3.7.0\") : t;\n });\n }(d, E), new Promise(function (t, r) {\n var o = document.createElement(\"script\"),\n n = function () {\n var e;\n return null === (e = o.parentNode) || void 0 === e ? void 0 : e.removeChild(o);\n },\n i = document.head || document.getElementsByTagName(\"head\")[0];\n\n o.onload = function () {\n n(), t();\n }, o.onerror = function () {\n n(), r(new Error(h));\n }, o.async = !0, o.src = e, i.appendChild(o);\n }));\n\n return o.then(r, r), o;\n });\n }).then(function () {\n var e = window,\n r = \"__fpjs_p_l_b\",\n o = e[r];\n if (function (e, t) {\n var r,\n o = null === (r = Object.getOwnPropertyDescriptor) || void 0 === r ? void 0 : r.call(Object, e, t);\n (null == o ? void 0 : o.configurable) ? delete e[t] : o && !o.writable || (e[t] = void 0);\n }(e, r), \"function\" != typeof (null == o ? void 0 : o.load)) throw new Error(h);\n return o.load(Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"])(Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"])({}, s), {\n ldi: {\n attempts: u\n }\n }));\n });\n}\n\nvar w = {\n load: D,\n ERROR_SCRIPT_LOAD_FAIL: h,\n ERROR_API_KEY_EXPIRED: \"API key expired\",\n ERROR_API_KEY_INVALID: \"API key not found\",\n ERROR_API_KEY_MISSING: \"API key required\",\n ERROR_BAD_REQUEST_FORMAT: \"Request cannot be parsed\",\n ERROR_BAD_RESPONSE_FORMAT: \"Response cannot be parsed\",\n ERROR_CLIENT_TIMEOUT: \"Client timeout\",\n ERROR_FORBIDDEN_ENDPOINT: u,\n ERROR_FORBIDDEN_HEADER: \"Not available with restricted header\",\n ERROR_FORBIDDEN_ORIGIN: \"Not available for this origin\",\n ERROR_GENERAL_SERVER_FAILURE: \"Request failed\",\n ERROR_INSTALLATION_METHOD_RESTRICTED: E,\n ERROR_NETWORK_ABORT: \"Network request aborted\",\n ERROR_NETWORK_CONNECTION: \"Network connection error\",\n ERROR_RATE_LIMIT: \"Too many requests, rate limit exceeded\",\n ERROR_SERVER_TIMEOUT: \"Request failed to process\",\n ERROR_SUBSCRIPTION_NOT_ACTIVE: d,\n ERROR_TOKEN_EXPIRED: \"API key expired\",\n ERROR_TOKEN_INVALID: \"API key not found\",\n ERROR_TOKEN_MISSING: \"API key required\",\n ERROR_UNSUPPORTED_VERSION: s,\n ERROR_WRONG_REGION: a\n};\n\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/@fingerprintjs/fingerprintjs-pro/dist/fp.esm.min.js?");
|
|
760
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_API_KEY_EXPIRED\", function() { return f; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_API_KEY_INVALID\", function() { return _; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_API_KEY_MISSING\", function() { return E; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_BAD_REQUEST_FORMAT\", function() { return O; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_BAD_RESPONSE_FORMAT\", function() { return R; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_CLIENT_TIMEOUT\", function() { return n; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_CSP_BLOCK\", function() { return a; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_FORBIDDEN_ENDPOINT\", function() { return l; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_FORBIDDEN_HEADER\", function() { return h; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_FORBIDDEN_ORIGIN\", function() { return N; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_GENERAL_SERVER_FAILURE\", function() { return I; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_INSTALLATION_METHOD_RESTRICTED\", function() { return d; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_NETWORK_ABORT\", function() { return i; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_NETWORK_CONNECTION\", function() { return o; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_RATE_LIMIT\", function() { return v; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_SCRIPT_LOAD_FAIL\", function() { return T; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_SERVER_TIMEOUT\", function() { return p; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_SUBSCRIPTION_NOT_ACTIVE\", function() { return s; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_TOKEN_EXPIRED\", function() { return m; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_TOKEN_INVALID\", function() { return P; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_TOKEN_MISSING\", function() { return y; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_UNSUPPORTED_VERSION\", function() { return c; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ERROR_WRONG_REGION\", function() { return u; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return D; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"load\", function() { return b; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.js\");\n/**\n * FingerprintJS Pro v3.7.1 - Copyright (c) FingerprintJS, Inc, 2022 (https://fingerprint.com)\n *\n * This software contains code from open-source projects:\n * MurmurHash3 by Karan Lyons (https://github.com/karanlyons/murmurHash3.js)\n */\n\n\nfunction r(e) {\n for (var t = \"\", r = 0; r < e.length; ++r) if (r > 0) {\n var n = e[r].toLowerCase();\n n !== e[r] ? t += \" \" + n : t += e[r];\n } else t += e[r].toUpperCase();\n\n return t;\n}\n\nvar n = \"Client timeout\",\n o = \"Network connection error\",\n i = \"Network request aborted\",\n R = \"Response cannot be parsed\",\n a = \"Blocked by CSP\",\n u = /*#__PURE__*/r(\"WrongRegion\"),\n s = /*#__PURE__*/r(\"SubscriptionNotActive\"),\n c = /*#__PURE__*/r(\"UnsupportedVersion\"),\n d = /*#__PURE__*/r(\"InstallationMethodRestricted\"),\n l = /*#__PURE__*/r(\"HostnameRestricted\"),\n E = \"API key required\",\n _ = \"API key not found\",\n f = \"API key expired\",\n O = \"Request cannot be parsed\",\n I = \"Request failed\",\n p = \"Request failed to process\",\n v = \"Too many requests, rate limit exceeded\",\n N = \"Not available for this origin\",\n h = \"Not available with restricted header\",\n y = \"API key required\",\n P = \"API key not found\",\n m = \"API key expired\";\n\nfunction A(e, t, r) {\n return void 0 === r && (r = 0), t(r).catch(function (n) {\n if (r >= e.maxRetries || !e.shouldRetry(n)) throw n;\n var o,\n i,\n R,\n a,\n u = (o = e.baseDelay, i = e.maxDelay, R = e.baseDelay * Math.pow(2, r), Math.max(o, Math.min(i, R)));\n return (a = u, new Promise(function (e) {\n return setTimeout(e, a);\n })).then(function () {\n return A(e, t, r + 1);\n });\n });\n}\n\nvar T = \"Failed to load the JS script of the agent\",\n w = \"https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js\";\n\nfunction b(r) {\n var n,\n o,\n i = r.scriptUrlPattern,\n R = r.token,\n a = r.apiKey,\n u = void 0 === a ? R : a,\n s = Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__rest\"])(r, [\"scriptUrlPattern\", \"token\", \"apiKey\"]),\n c = (n = r, o = \"scriptUrlPattern\", Object.prototype.hasOwnProperty.call(n, o) ? i : void 0),\n d = [];\n return Promise.resolve().then(function () {\n if (!u || \"string\" != typeof u) throw new Error(\"API key required\");\n return A({\n maxRetries: 5,\n baseDelay: 100,\n maxDelay: 3e3,\n shouldRetry: function (e) {\n return !(e instanceof Error && \"Blocked by CSP\" === e.message);\n }\n }, function () {\n var e,\n t = new Date(),\n r = function () {\n return d.push({\n startedAt: t,\n finishedAt: new Date()\n });\n },\n n = function (e, t, r, n) {\n var o,\n i = document,\n R = \"securitypolicyviolation\",\n a = function (t) {\n var r = new URL(e, location.href),\n n = t.blockedURI;\n n !== r.href && n !== r.protocol.slice(0, -1) && n !== r.origin || (o = t, u());\n };\n\n i.addEventListener(R, a);\n\n var u = function () {\n return i.removeEventListener(R, a);\n };\n\n return null == n || n.then(u, u), Promise.resolve().then(t).then(function (e) {\n return u(), e;\n }, function (e) {\n return new Promise(function (e) {\n return setTimeout(e);\n }).then(function () {\n if (u(), o) return r(o);\n throw e;\n });\n });\n }(e = function (e, t) {\n void 0 === t && (t = w);\n var r = encodeURIComponent;\n return t.replace(/<[^<>]+>/g, function (t) {\n return \"<version>\" === t ? \"3\" : \"<apiKey>\" === t ? r(e) : \"<loaderVersion>\" === t ? r(\"3.7.1\") : t;\n });\n }(u, c), function () {\n return function (e) {\n return new Promise(function (t, r) {\n var n = document.createElement(\"script\"),\n o = function () {\n var e;\n return null === (e = n.parentNode) || void 0 === e ? void 0 : e.removeChild(n);\n },\n i = document.head || document.getElementsByTagName(\"head\")[0];\n\n n.onload = function () {\n o(), t();\n }, n.onerror = function () {\n o(), r(new Error(T));\n }, n.async = !0, n.src = e, i.appendChild(n);\n });\n }(e);\n }, function () {\n throw new Error(\"Blocked by CSP\");\n });\n\n return n.then(r, r), n;\n });\n }).then(function () {\n var e = window,\n r = \"__fpjs_p_l_b\",\n n = e[r];\n if (function (e, t) {\n var r,\n n = null === (r = Object.getOwnPropertyDescriptor) || void 0 === r ? void 0 : r.call(Object, e, t);\n (null == n ? void 0 : n.configurable) ? delete e[t] : n && !n.writable || (e[t] = void 0);\n }(e, r), \"function\" != typeof (null == n ? void 0 : n.load)) throw new Error(T);\n return n.load(Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"])(Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"])({}, s), {\n ldi: {\n attempts: d\n }\n }));\n });\n}\n\nvar D = {\n load: b,\n ERROR_SCRIPT_LOAD_FAIL: T,\n ERROR_API_KEY_EXPIRED: \"API key expired\",\n ERROR_API_KEY_INVALID: \"API key not found\",\n ERROR_API_KEY_MISSING: \"API key required\",\n ERROR_BAD_REQUEST_FORMAT: \"Request cannot be parsed\",\n ERROR_BAD_RESPONSE_FORMAT: \"Response cannot be parsed\",\n ERROR_CLIENT_TIMEOUT: \"Client timeout\",\n ERROR_CSP_BLOCK: \"Blocked by CSP\",\n ERROR_FORBIDDEN_ENDPOINT: l,\n ERROR_FORBIDDEN_HEADER: \"Not available with restricted header\",\n ERROR_FORBIDDEN_ORIGIN: \"Not available for this origin\",\n ERROR_GENERAL_SERVER_FAILURE: \"Request failed\",\n ERROR_INSTALLATION_METHOD_RESTRICTED: d,\n ERROR_NETWORK_ABORT: \"Network request aborted\",\n ERROR_NETWORK_CONNECTION: \"Network connection error\",\n ERROR_RATE_LIMIT: \"Too many requests, rate limit exceeded\",\n ERROR_SERVER_TIMEOUT: \"Request failed to process\",\n ERROR_SUBSCRIPTION_NOT_ACTIVE: s,\n ERROR_TOKEN_EXPIRED: \"API key expired\",\n ERROR_TOKEN_INVALID: \"API key not found\",\n ERROR_TOKEN_MISSING: \"API key required\",\n ERROR_UNSUPPORTED_VERSION: c,\n ERROR_WRONG_REGION: u\n};\n\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/@fingerprintjs/fingerprintjs-pro/dist/fp.esm.min.js?");
|
|
761
761
|
|
|
762
762
|
/***/ }),
|
|
763
763
|
|
|
@@ -769,7 +769,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
769
769
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
770
770
|
|
|
771
771
|
"use strict";
|
|
772
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"componentsToDebugString\", function() { return componentsToDebugString; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return index; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getFullscreenElement\", function() { return getFullscreenElement; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getScreenFrame\", function() { return getScreenFrame; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"hashComponents\", function() { return hashComponents; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isAndroid\", function() { return isAndroid; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isChromium\", function() { return isChromium; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isDesktopSafari\", function() { return isDesktopSafari; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isEdgeHTML\", function() { return isEdgeHTML; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isGecko\", function() { return isGecko; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isTrident\", function() { return isTrident; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isWebKit\", function() { return isWebKit; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"load\", function() { return load; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"loadSources\", function() { return loadSources; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"murmurX64Hash128\", function() { return murmurX64Hash128; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"prepareForSources\", function() { return prepareForSources; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"sources\", function() { return sources; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"transformSource\", function() { return transformSource; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.js\");\n/**\n * FingerprintJS v3.3.4 - Copyright (c) FingerprintJS, Inc, 2022 (https://fingerprint.com)\n * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.\n *\n * This software contains code from open-source projects:\n * MurmurHash3 by Karan Lyons (https://github.com/karanlyons/murmurHash3.js)\n */\n\nvar version = \"3.3.4\";\n\nfunction wait(durationMs, resolveWith) {\n return new Promise(function (resolve) {\n return setTimeout(resolve, durationMs, resolveWith);\n });\n}\n\nfunction requestIdleCallbackIfAvailable(fallbackTimeout, deadlineTimeout) {\n if (deadlineTimeout === void 0) {\n deadlineTimeout = Infinity;\n }\n\n var requestIdleCallback = window.requestIdleCallback;\n\n if (requestIdleCallback) {\n // The function `requestIdleCallback` loses the binding to `window` here.\n // `globalThis` isn't always equal `window` (see https://github.com/fingerprintjs/fingerprintjs/issues/683).\n // Therefore, an error can occur. `call(window,` prevents the error.\n return new Promise(function (resolve) {\n return requestIdleCallback.call(window, function () {\n return resolve();\n }, {\n timeout: deadlineTimeout\n });\n });\n } else {\n return wait(Math.min(fallbackTimeout, deadlineTimeout));\n }\n}\n\nfunction isPromise(value) {\n return value && typeof value.then === 'function';\n}\n/**\n * Calls a maybe asynchronous function without creating microtasks when the function is synchronous.\n * Catches errors in both cases.\n *\n * If just you run a code like this:\n * ```\n * console.time('Action duration')\n * await action()\n * console.timeEnd('Action duration')\n * ```\n * The synchronous function time can be measured incorrectly because another microtask may run before the `await`\n * returns the control back to the code.\n */\n\n\nfunction awaitIfAsync(action, callback) {\n try {\n var returnedValue = action();\n\n if (isPromise(returnedValue)) {\n returnedValue.then(function (result) {\n return callback(true, result);\n }, function (error) {\n return callback(false, error);\n });\n } else {\n callback(true, returnedValue);\n }\n } catch (error) {\n callback(false, error);\n }\n}\n/**\n * If you run many synchronous tasks without using this function, the JS main loop will be busy and asynchronous tasks\n * (e.g. completing a network request, rendering the page) won't be able to happen.\n * This function allows running many synchronous tasks such way that asynchronous tasks can run too in background.\n */\n\n\nfunction forEachWithBreaks(items, callback, loopReleaseInterval) {\n if (loopReleaseInterval === void 0) {\n loopReleaseInterval = 16;\n }\n\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__awaiter\"])(this, void 0, void 0, function () {\n var lastLoopReleaseTime, i, now;\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__generator\"])(this, function (_a) {\n switch (_a.label) {\n case 0:\n lastLoopReleaseTime = Date.now();\n i = 0;\n _a.label = 1;\n\n case 1:\n if (!(i < items.length)) return [3\n /*break*/\n , 4];\n callback(items[i], i);\n now = Date.now();\n if (!(now >= lastLoopReleaseTime + loopReleaseInterval)) return [3\n /*break*/\n , 3];\n lastLoopReleaseTime = now; // Allows asynchronous actions and microtasks to happen\n\n return [4\n /*yield*/\n , wait(0)];\n\n case 2:\n // Allows asynchronous actions and microtasks to happen\n _a.sent();\n\n _a.label = 3;\n\n case 3:\n ++i;\n return [3\n /*break*/\n , 1];\n\n case 4:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\n * Makes the given promise never emit an unhandled promise rejection console warning.\n * The promise will still pass errors to the next promises.\n *\n * Otherwise, promise emits a console warning unless it has a `catch` listener.\n */\n\n\nfunction suppressUnhandledRejectionWarning(promise) {\n promise.then(undefined, function () {\n return undefined;\n });\n}\n/*\n * Taken from https://github.com/karanlyons/murmurHash3.js/blob/a33d0723127e2e5415056c455f8aed2451ace208/murmurHash3.js\n */\n//\n// Given two 64bit ints (as an array of two 32bit ints) returns the two\n// added together as a 64bit int (as an array of two 32bit ints).\n//\n\n\nfunction x64Add(m, n) {\n m = [m[0] >>> 16, m[0] & 0xffff, m[1] >>> 16, m[1] & 0xffff];\n n = [n[0] >>> 16, n[0] & 0xffff, n[1] >>> 16, n[1] & 0xffff];\n var o = [0, 0, 0, 0];\n o[3] += m[3] + n[3];\n o[2] += o[3] >>> 16;\n o[3] &= 0xffff;\n o[2] += m[2] + n[2];\n o[1] += o[2] >>> 16;\n o[2] &= 0xffff;\n o[1] += m[1] + n[1];\n o[0] += o[1] >>> 16;\n o[1] &= 0xffff;\n o[0] += m[0] + n[0];\n o[0] &= 0xffff;\n return [o[0] << 16 | o[1], o[2] << 16 | o[3]];\n} //\n// Given two 64bit ints (as an array of two 32bit ints) returns the two\n// multiplied together as a 64bit int (as an array of two 32bit ints).\n//\n\n\nfunction x64Multiply(m, n) {\n m = [m[0] >>> 16, m[0] & 0xffff, m[1] >>> 16, m[1] & 0xffff];\n n = [n[0] >>> 16, n[0] & 0xffff, n[1] >>> 16, n[1] & 0xffff];\n var o = [0, 0, 0, 0];\n o[3] += m[3] * n[3];\n o[2] += o[3] >>> 16;\n o[3] &= 0xffff;\n o[2] += m[2] * n[3];\n o[1] += o[2] >>> 16;\n o[2] &= 0xffff;\n o[2] += m[3] * n[2];\n o[1] += o[2] >>> 16;\n o[2] &= 0xffff;\n o[1] += m[1] * n[3];\n o[0] += o[1] >>> 16;\n o[1] &= 0xffff;\n o[1] += m[2] * n[2];\n o[0] += o[1] >>> 16;\n o[1] &= 0xffff;\n o[1] += m[3] * n[1];\n o[0] += o[1] >>> 16;\n o[1] &= 0xffff;\n o[0] += m[0] * n[3] + m[1] * n[2] + m[2] * n[1] + m[3] * n[0];\n o[0] &= 0xffff;\n return [o[0] << 16 | o[1], o[2] << 16 | o[3]];\n} //\n// Given a 64bit int (as an array of two 32bit ints) and an int\n// representing a number of bit positions, returns the 64bit int (as an\n// array of two 32bit ints) rotated left by that number of positions.\n//\n\n\nfunction x64Rotl(m, n) {\n n %= 64;\n\n if (n === 32) {\n return [m[1], m[0]];\n } else if (n < 32) {\n return [m[0] << n | m[1] >>> 32 - n, m[1] << n | m[0] >>> 32 - n];\n } else {\n n -= 32;\n return [m[1] << n | m[0] >>> 32 - n, m[0] << n | m[1] >>> 32 - n];\n }\n} //\n// Given a 64bit int (as an array of two 32bit ints) and an int\n// representing a number of bit positions, returns the 64bit int (as an\n// array of two 32bit ints) shifted left by that number of positions.\n//\n\n\nfunction x64LeftShift(m, n) {\n n %= 64;\n\n if (n === 0) {\n return m;\n } else if (n < 32) {\n return [m[0] << n | m[1] >>> 32 - n, m[1] << n];\n } else {\n return [m[1] << n - 32, 0];\n }\n} //\n// Given two 64bit ints (as an array of two 32bit ints) returns the two\n// xored together as a 64bit int (as an array of two 32bit ints).\n//\n\n\nfunction x64Xor(m, n) {\n return [m[0] ^ n[0], m[1] ^ n[1]];\n} //\n// Given a block, returns murmurHash3's final x64 mix of that block.\n// (`[0, h[0] >>> 1]` is a 33 bit unsigned right shift. This is the\n// only place where we need to right shift 64bit ints.)\n//\n\n\nfunction x64Fmix(h) {\n h = x64Xor(h, [0, h[0] >>> 1]);\n h = x64Multiply(h, [0xff51afd7, 0xed558ccd]);\n h = x64Xor(h, [0, h[0] >>> 1]);\n h = x64Multiply(h, [0xc4ceb9fe, 0x1a85ec53]);\n h = x64Xor(h, [0, h[0] >>> 1]);\n return h;\n} //\n// Given a string and an optional seed as an int, returns a 128 bit\n// hash using the x64 flavor of MurmurHash3, as an unsigned hex.\n//\n\n\nfunction x64hash128(key, seed) {\n key = key || '';\n seed = seed || 0;\n var remainder = key.length % 16;\n var bytes = key.length - remainder;\n var h1 = [0, seed];\n var h2 = [0, seed];\n var k1 = [0, 0];\n var k2 = [0, 0];\n var c1 = [0x87c37b91, 0x114253d5];\n var c2 = [0x4cf5ad43, 0x2745937f];\n var i;\n\n for (i = 0; i < bytes; i = i + 16) {\n k1 = [key.charCodeAt(i + 4) & 0xff | (key.charCodeAt(i + 5) & 0xff) << 8 | (key.charCodeAt(i + 6) & 0xff) << 16 | (key.charCodeAt(i + 7) & 0xff) << 24, key.charCodeAt(i) & 0xff | (key.charCodeAt(i + 1) & 0xff) << 8 | (key.charCodeAt(i + 2) & 0xff) << 16 | (key.charCodeAt(i + 3) & 0xff) << 24];\n k2 = [key.charCodeAt(i + 12) & 0xff | (key.charCodeAt(i + 13) & 0xff) << 8 | (key.charCodeAt(i + 14) & 0xff) << 16 | (key.charCodeAt(i + 15) & 0xff) << 24, key.charCodeAt(i + 8) & 0xff | (key.charCodeAt(i + 9) & 0xff) << 8 | (key.charCodeAt(i + 10) & 0xff) << 16 | (key.charCodeAt(i + 11) & 0xff) << 24];\n k1 = x64Multiply(k1, c1);\n k1 = x64Rotl(k1, 31);\n k1 = x64Multiply(k1, c2);\n h1 = x64Xor(h1, k1);\n h1 = x64Rotl(h1, 27);\n h1 = x64Add(h1, h2);\n h1 = x64Add(x64Multiply(h1, [0, 5]), [0, 0x52dce729]);\n k2 = x64Multiply(k2, c2);\n k2 = x64Rotl(k2, 33);\n k2 = x64Multiply(k2, c1);\n h2 = x64Xor(h2, k2);\n h2 = x64Rotl(h2, 31);\n h2 = x64Add(h2, h1);\n h2 = x64Add(x64Multiply(h2, [0, 5]), [0, 0x38495ab5]);\n }\n\n k1 = [0, 0];\n k2 = [0, 0];\n\n switch (remainder) {\n case 15:\n k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 14)], 48));\n // fallthrough\n\n case 14:\n k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 13)], 40));\n // fallthrough\n\n case 13:\n k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 12)], 32));\n // fallthrough\n\n case 12:\n k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 11)], 24));\n // fallthrough\n\n case 11:\n k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 10)], 16));\n // fallthrough\n\n case 10:\n k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 9)], 8));\n // fallthrough\n\n case 9:\n k2 = x64Xor(k2, [0, key.charCodeAt(i + 8)]);\n k2 = x64Multiply(k2, c2);\n k2 = x64Rotl(k2, 33);\n k2 = x64Multiply(k2, c1);\n h2 = x64Xor(h2, k2);\n // fallthrough\n\n case 8:\n k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 7)], 56));\n // fallthrough\n\n case 7:\n k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 6)], 48));\n // fallthrough\n\n case 6:\n k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 5)], 40));\n // fallthrough\n\n case 5:\n k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 4)], 32));\n // fallthrough\n\n case 4:\n k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 3)], 24));\n // fallthrough\n\n case 3:\n k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 2)], 16));\n // fallthrough\n\n case 2:\n k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 1)], 8));\n // fallthrough\n\n case 1:\n k1 = x64Xor(k1, [0, key.charCodeAt(i)]);\n k1 = x64Multiply(k1, c1);\n k1 = x64Rotl(k1, 31);\n k1 = x64Multiply(k1, c2);\n h1 = x64Xor(h1, k1);\n // fallthrough\n }\n\n h1 = x64Xor(h1, [0, key.length]);\n h2 = x64Xor(h2, [0, key.length]);\n h1 = x64Add(h1, h2);\n h2 = x64Add(h2, h1);\n h1 = x64Fmix(h1);\n h2 = x64Fmix(h2);\n h1 = x64Add(h1, h2);\n h2 = x64Add(h2, h1);\n return ('00000000' + (h1[0] >>> 0).toString(16)).slice(-8) + ('00000000' + (h1[1] >>> 0).toString(16)).slice(-8) + ('00000000' + (h2[0] >>> 0).toString(16)).slice(-8) + ('00000000' + (h2[1] >>> 0).toString(16)).slice(-8);\n}\n/**\n * Converts an error object to a plain object that can be used with `JSON.stringify`.\n * If you just run `JSON.stringify(error)`, you'll get `'{}'`.\n */\n\n\nfunction errorToObject(error) {\n var _a;\n\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"])({\n name: error.name,\n message: error.message,\n stack: (_a = error.stack) === null || _a === void 0 ? void 0 : _a.split('\\n')\n }, error);\n}\n/*\n * This file contains functions to work with pure data only (no browser features, DOM, side effects, etc).\n */\n\n/**\n * Does the same as Array.prototype.includes but has better typing\n */\n\n\nfunction includes(haystack, needle) {\n for (var i = 0, l = haystack.length; i < l; ++i) {\n if (haystack[i] === needle) {\n return true;\n }\n }\n\n return false;\n}\n/**\n * Like `!includes()` but with proper typing\n */\n\n\nfunction excludes(haystack, needle) {\n return !includes(haystack, needle);\n}\n/**\n * Be careful, NaN can return\n */\n\n\nfunction toInt(value) {\n return parseInt(value);\n}\n/**\n * Be careful, NaN can return\n */\n\n\nfunction toFloat(value) {\n return parseFloat(value);\n}\n\nfunction replaceNaN(value, replacement) {\n return typeof value === 'number' && isNaN(value) ? replacement : value;\n}\n\nfunction countTruthy(values) {\n return values.reduce(function (sum, value) {\n return sum + (value ? 1 : 0);\n }, 0);\n}\n\nfunction round(value, base) {\n if (base === void 0) {\n base = 1;\n }\n\n if (Math.abs(base) >= 1) {\n return Math.round(value / base) * base;\n } else {\n // Sometimes when a number is multiplied by a small number, precision is lost,\n // for example 1234 * 0.0001 === 0.12340000000000001, and it's more precise divide: 1234 / (1 / 0.0001) === 0.1234.\n var counterBase = 1 / base;\n return Math.round(value * counterBase) / counterBase;\n }\n}\n/**\n * Parses a CSS selector into tag name with HTML attributes.\n * Only single element selector are supported (without operators like space, +, >, etc).\n *\n * Multiple values can be returned for each attribute. You decide how to handle them.\n */\n\n\nfunction parseSimpleCssSelector(selector) {\n var _a, _b;\n\n var errorMessage = \"Unexpected syntax '\" + selector + \"'\";\n var tagMatch = /^\\s*([a-z-]*)(.*)$/i.exec(selector);\n var tag = tagMatch[1] || undefined;\n var attributes = {};\n var partsRegex = /([.:#][\\w-]+|\\[.+?\\])/gi;\n\n var addAttribute = function (name, value) {\n attributes[name] = attributes[name] || [];\n attributes[name].push(value);\n };\n\n for (;;) {\n var match = partsRegex.exec(tagMatch[2]);\n\n if (!match) {\n break;\n }\n\n var part = match[0];\n\n switch (part[0]) {\n case '.':\n addAttribute('class', part.slice(1));\n break;\n\n case '#':\n addAttribute('id', part.slice(1));\n break;\n\n case '[':\n {\n var attributeMatch = /^\\[([\\w-]+)([~|^$*]?=(\"(.*?)\"|([\\w-]+)))?(\\s+[is])?\\]$/.exec(part);\n\n if (attributeMatch) {\n addAttribute(attributeMatch[1], (_b = (_a = attributeMatch[4]) !== null && _a !== void 0 ? _a : attributeMatch[5]) !== null && _b !== void 0 ? _b : '');\n } else {\n throw new Error(errorMessage);\n }\n\n break;\n }\n\n default:\n throw new Error(errorMessage);\n }\n }\n\n return [tag, attributes];\n}\n\nfunction ensureErrorWithMessage(error) {\n return error && typeof error === 'object' && 'message' in error ? error : {\n message: error\n };\n}\n\nfunction isFinalResultLoaded(loadResult) {\n return typeof loadResult !== 'function';\n}\n/**\n * Loads the given entropy source. Returns a function that gets an entropy component from the source.\n *\n * The result is returned synchronously to prevent `loadSources` from\n * waiting for one source to load before getting the components from the other sources.\n */\n\n\nfunction loadSource(source, sourceOptions) {\n var sourceLoadPromise = new Promise(function (resolveLoad) {\n var loadStartTime = Date.now(); // `awaitIfAsync` is used instead of just `await` in order to measure the duration of synchronous sources\n // correctly (other microtasks won't affect the duration).\n\n awaitIfAsync(source.bind(null, sourceOptions), function () {\n var loadArgs = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n loadArgs[_i] = arguments[_i];\n }\n\n var loadDuration = Date.now() - loadStartTime; // Source loading failed\n\n if (!loadArgs[0]) {\n return resolveLoad(function () {\n return {\n error: ensureErrorWithMessage(loadArgs[1]),\n duration: loadDuration\n };\n });\n }\n\n var loadResult = loadArgs[1]; // Source loaded with the final result\n\n if (isFinalResultLoaded(loadResult)) {\n return resolveLoad(function () {\n return {\n value: loadResult,\n duration: loadDuration\n };\n });\n } // Source loaded with \"get\" stage\n\n\n resolveLoad(function () {\n return new Promise(function (resolveGet) {\n var getStartTime = Date.now();\n awaitIfAsync(loadResult, function () {\n var getArgs = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n getArgs[_i] = arguments[_i];\n }\n\n var duration = loadDuration + Date.now() - getStartTime; // Source getting failed\n\n if (!getArgs[0]) {\n return resolveGet({\n error: ensureErrorWithMessage(getArgs[1]),\n duration: duration\n });\n } // Source getting succeeded\n\n\n resolveGet({\n value: getArgs[1],\n duration: duration\n });\n });\n });\n });\n });\n });\n suppressUnhandledRejectionWarning(sourceLoadPromise);\n return function getComponent() {\n return sourceLoadPromise.then(function (finalizeSource) {\n return finalizeSource();\n });\n };\n}\n/**\n * Loads the given entropy sources. Returns a function that collects the entropy components.\n *\n * The result is returned synchronously in order to allow start getting the components\n * before the sources are loaded completely.\n *\n * Warning for package users:\n * This function is out of Semantic Versioning, i.e. can change unexpectedly. Usage is at your own risk.\n */\n\n\nfunction loadSources(sources, sourceOptions, excludeSources) {\n var includedSources = Object.keys(sources).filter(function (sourceKey) {\n return excludes(excludeSources, sourceKey);\n });\n var sourceGetters = Array(includedSources.length); // Using `forEachWithBreaks` allows asynchronous sources to complete between synchronous sources\n // and measure the duration correctly\n\n forEachWithBreaks(includedSources, function (sourceKey, index) {\n sourceGetters[index] = loadSource(sources[sourceKey], sourceOptions);\n });\n return function getComponents() {\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__awaiter\"])(this, void 0, void 0, function () {\n var components, _i, includedSources_1, sourceKey, componentPromises, _loop_1, state_1;\n\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__generator\"])(this, function (_a) {\n switch (_a.label) {\n case 0:\n components = {};\n\n for (_i = 0, includedSources_1 = includedSources; _i < includedSources_1.length; _i++) {\n sourceKey = includedSources_1[_i];\n components[sourceKey] = undefined;\n }\n\n componentPromises = Array(includedSources.length);\n\n _loop_1 = function () {\n var hasAllComponentPromises;\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__generator\"])(this, function (_a) {\n switch (_a.label) {\n case 0:\n hasAllComponentPromises = true;\n return [4\n /*yield*/\n , forEachWithBreaks(includedSources, function (sourceKey, index) {\n if (!componentPromises[index]) {\n // `sourceGetters` may be incomplete at this point of execution because `forEachWithBreaks` is asynchronous\n if (sourceGetters[index]) {\n var componentPromise = sourceGetters[index]().then(function (component) {\n return components[sourceKey] = component;\n });\n suppressUnhandledRejectionWarning(componentPromise);\n componentPromises[index] = componentPromise;\n } else {\n hasAllComponentPromises = false;\n }\n }\n })];\n\n case 1:\n _a.sent();\n\n if (hasAllComponentPromises) {\n return [2\n /*return*/\n , \"break\"];\n }\n\n return [4\n /*yield*/\n , wait(1)];\n // Lets the source load loop continue\n\n case 2:\n _a.sent(); // Lets the source load loop continue\n\n\n return [2\n /*return*/\n ];\n }\n });\n };\n\n _a.label = 1;\n\n case 1:\n return [5\n /*yield**/\n , _loop_1()];\n\n case 2:\n state_1 = _a.sent();\n if (state_1 === \"break\") return [3\n /*break*/\n , 4];\n _a.label = 3;\n\n case 3:\n return [3\n /*break*/\n , 1];\n\n case 4:\n return [4\n /*yield*/\n , Promise.all(componentPromises)];\n\n case 5:\n _a.sent();\n\n return [2\n /*return*/\n , components];\n }\n });\n });\n };\n}\n/**\n * Modifies an entropy source by transforming its returned value with the given function.\n * Keeps the source properties: sync/async, 1/2 stages.\n *\n * Warning for package users:\n * This function is out of Semantic Versioning, i.e. can change unexpectedly. Usage is at your own risk.\n */\n\n\nfunction transformSource(source, transformValue) {\n var transformLoadResult = function (loadResult) {\n if (isFinalResultLoaded(loadResult)) {\n return transformValue(loadResult);\n }\n\n return function () {\n var getResult = loadResult();\n\n if (isPromise(getResult)) {\n return getResult.then(transformValue);\n }\n\n return transformValue(getResult);\n };\n };\n\n return function (options) {\n var loadResult = source(options);\n\n if (isPromise(loadResult)) {\n return loadResult.then(transformLoadResult);\n }\n\n return transformLoadResult(loadResult);\n };\n}\n/*\n * Functions to help with features that vary through browsers\n */\n\n/**\n * Checks whether the browser is based on Trident (the Internet Explorer engine) without using user-agent.\n *\n * Warning for package users:\n * This function is out of Semantic Versioning, i.e. can change unexpectedly. Usage is at your own risk.\n */\n\n\nfunction isTrident() {\n var w = window;\n var n = navigator; // The properties are checked to be in IE 10, IE 11 and not to be in other browsers in October 2020\n\n return countTruthy(['MSCSSMatrix' in w, 'msSetImmediate' in w, 'msIndexedDB' in w, 'msMaxTouchPoints' in n, 'msPointerEnabled' in n]) >= 4;\n}\n/**\n * Checks whether the browser is based on EdgeHTML (the pre-Chromium Edge engine) without using user-agent.\n *\n * Warning for package users:\n * This function is out of Semantic Versioning, i.e. can change unexpectedly. Usage is at your own risk.\n */\n\n\nfunction isEdgeHTML() {\n // Based on research in October 2020\n var w = window;\n var n = navigator;\n return countTruthy(['msWriteProfilerMark' in w, 'MSStream' in w, 'msLaunchUri' in n, 'msSaveBlob' in n]) >= 3 && !isTrident();\n}\n/**\n * Checks whether the browser is based on Chromium without using user-agent.\n *\n * Warning for package users:\n * This function is out of Semantic Versioning, i.e. can change unexpectedly. Usage is at your own risk.\n */\n\n\nfunction isChromium() {\n // Based on research in October 2020. Tested to detect Chromium 42-86.\n var w = window;\n var n = navigator;\n return countTruthy(['webkitPersistentStorage' in n, 'webkitTemporaryStorage' in n, n.vendor.indexOf('Google') === 0, 'webkitResolveLocalFileSystemURL' in w, 'BatteryManager' in w, 'webkitMediaStream' in w, 'webkitSpeechGrammar' in w]) >= 5;\n}\n/**\n * Checks whether the browser is based on mobile or desktop Safari without using user-agent.\n * All iOS browsers use WebKit (the Safari engine).\n *\n * Warning for package users:\n * This function is out of Semantic Versioning, i.e. can change unexpectedly. Usage is at your own risk.\n */\n\n\nfunction isWebKit() {\n // Based on research in September 2020\n var w = window;\n var n = navigator;\n return countTruthy(['ApplePayError' in w, 'CSSPrimitiveValue' in w, 'Counter' in w, n.vendor.indexOf('Apple') === 0, 'getStorageUpdates' in n, 'WebKitMediaKeys' in w]) >= 4;\n}\n/**\n * Checks whether the WebKit browser is a desktop Safari.\n *\n * Warning for package users:\n * This function is out of Semantic Versioning, i.e. can change unexpectedly. Usage is at your own risk.\n */\n\n\nfunction isDesktopSafari() {\n var w = window;\n return countTruthy(['safari' in w, !('DeviceMotionEvent' in w), !('ongestureend' in w), !('standalone' in navigator)]) >= 3;\n}\n/**\n * Checks whether the browser is based on Gecko (Firefox engine) without using user-agent.\n *\n * Warning for package users:\n * This function is out of Semantic Versioning, i.e. can change unexpectedly. Usage is at your own risk.\n */\n\n\nfunction isGecko() {\n var _a, _b;\n\n var w = window; // Based on research in September 2020\n\n return countTruthy(['buildID' in navigator, 'MozAppearance' in ((_b = (_a = document.documentElement) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : {}), 'onmozfullscreenchange' in w, 'mozInnerScreenX' in w, 'CSSMozDocumentRule' in w, 'CanvasCaptureMediaStream' in w]) >= 4;\n}\n/**\n * Checks whether the browser is based on Chromium version ≥86 without using user-agent.\n * It doesn't check that the browser is based on Chromium, there is a separate function for this.\n */\n\n\nfunction isChromium86OrNewer() {\n // Checked in Chrome 85 vs Chrome 86 both on desktop and Android\n var w = window;\n return countTruthy([!('MediaSettingsRange' in w), 'RTCEncodedAudioFrame' in w, '' + w.Intl === '[object Intl]', '' + w.Reflect === '[object Reflect]']) >= 3;\n}\n/**\n * Checks whether the browser is based on WebKit version ≥606 (Safari ≥12) without using user-agent.\n * It doesn't check that the browser is based on WebKit, there is a separate function for this.\n *\n * @link https://en.wikipedia.org/wiki/Safari_version_history#Release_history Safari-WebKit versions map\n */\n\n\nfunction isWebKit606OrNewer() {\n // Checked in Safari 9–14\n var w = window;\n return countTruthy(['DOMRectList' in w, 'RTCPeerConnectionIceEvent' in w, 'SVGGeometryElement' in w, 'ontransitioncancel' in w]) >= 3;\n}\n/**\n * Checks whether the device is an iPad.\n * It doesn't check that the engine is WebKit and that the WebKit isn't desktop.\n */\n\n\nfunction isIPad() {\n // Checked on:\n // Safari on iPadOS (both mobile and desktop modes): 8, 11, 12, 13, 14\n // Chrome on iPadOS (both mobile and desktop modes): 11, 12, 13, 14\n // Safari on iOS (both mobile and desktop modes): 9, 10, 11, 12, 13, 14\n // Chrome on iOS (both mobile and desktop modes): 9, 10, 11, 12, 13, 14\n // Before iOS 13. Safari tampers the value in \"request desktop site\" mode since iOS 13.\n if (navigator.platform === 'iPad') {\n return true;\n }\n\n var s = screen;\n var screenRatio = s.width / s.height;\n return countTruthy(['MediaSource' in window, !!Element.prototype.webkitRequestFullscreen, // iPhone 4S that runs iOS 9 matches this. But it won't match the criteria above, so it won't be detected as iPad.\n screenRatio > 0.65 && screenRatio < 1.53]) >= 2;\n}\n/**\n * Warning for package users:\n * This function is out of Semantic Versioning, i.e. can change unexpectedly. Usage is at your own risk.\n */\n\n\nfunction getFullscreenElement() {\n var d = document;\n return d.fullscreenElement || d.msFullscreenElement || d.mozFullScreenElement || d.webkitFullscreenElement || null;\n}\n\nfunction exitFullscreen() {\n var d = document; // `call` is required because the function throws an error without a proper \"this\" context\n\n return (d.exitFullscreen || d.msExitFullscreen || d.mozCancelFullScreen || d.webkitExitFullscreen).call(d);\n}\n/**\n * Checks whether the device runs on Android without using user-agent.\n *\n * Warning for package users:\n * This function is out of Semantic Versioning, i.e. can change unexpectedly. Usage is at your own risk.\n */\n\n\nfunction isAndroid() {\n var isItChromium = isChromium();\n var isItGecko = isGecko(); // Only 2 browser engines are presented on Android.\n // Actually, there is also Android 4.1 browser, but it's not worth detecting it at the moment.\n\n if (!isItChromium && !isItGecko) {\n return false;\n }\n\n var w = window; // Chrome removes all words \"Android\" from `navigator` when desktop version is requested\n // Firefox keeps \"Android\" in `navigator.appVersion` when desktop version is requested\n\n return countTruthy(['onorientationchange' in w, 'orientation' in w, isItChromium && !('SharedWorker' in w), isItGecko && /android/i.test(navigator.appVersion)]) >= 2;\n}\n/**\n * A deep description: https://fingerprint.com/blog/audio-fingerprinting/\n * Inspired by and based on https://github.com/cozylife/audio-fingerprint\n */\n\n\nfunction getAudioFingerprint() {\n var w = window;\n var AudioContext = w.OfflineAudioContext || w.webkitOfflineAudioContext;\n\n if (!AudioContext) {\n return -2\n /* NotSupported */\n ;\n } // In some browsers, audio context always stays suspended unless the context is started in response to a user action\n // (e.g. a click or a tap). It prevents audio fingerprint from being taken at an arbitrary moment of time.\n // Such browsers are old and unpopular, so the audio fingerprinting is just skipped in them.\n // See a similar case explanation at https://stackoverflow.com/questions/46363048/onaudioprocess-not-called-on-ios11#46534088\n\n\n if (doesCurrentBrowserSuspendAudioContext()) {\n return -1\n /* KnownToSuspend */\n ;\n }\n\n var hashFromIndex = 4500;\n var hashToIndex = 5000;\n var context = new AudioContext(1, hashToIndex, 44100);\n var oscillator = context.createOscillator();\n oscillator.type = 'triangle';\n oscillator.frequency.value = 10000;\n var compressor = context.createDynamicsCompressor();\n compressor.threshold.value = -50;\n compressor.knee.value = 40;\n compressor.ratio.value = 12;\n compressor.attack.value = 0;\n compressor.release.value = 0.25;\n oscillator.connect(compressor);\n compressor.connect(context.destination);\n oscillator.start(0);\n\n var _a = startRenderingAudio(context),\n renderPromise = _a[0],\n finishRendering = _a[1];\n\n var fingerprintPromise = renderPromise.then(function (buffer) {\n return getHash(buffer.getChannelData(0).subarray(hashFromIndex));\n }, function (error) {\n if (error.name === \"timeout\"\n /* Timeout */\n || error.name === \"suspended\"\n /* Suspended */\n ) {\n return -3\n /* Timeout */\n ;\n }\n\n throw error;\n }); // Suppresses the console error message in case when the fingerprint fails before requested\n\n suppressUnhandledRejectionWarning(fingerprintPromise);\n return function () {\n finishRendering();\n return fingerprintPromise;\n };\n}\n/**\n * Checks if the current browser is known to always suspend audio context\n */\n\n\nfunction doesCurrentBrowserSuspendAudioContext() {\n return isWebKit() && !isDesktopSafari() && !isWebKit606OrNewer();\n}\n/**\n * Starts rendering the audio context.\n * When the returned function is called, the render process starts finishing.\n */\n\n\nfunction startRenderingAudio(context) {\n var renderTryMaxCount = 3;\n var renderRetryDelay = 500;\n var runningMaxAwaitTime = 500;\n var runningSufficientTime = 5000;\n\n var finalize = function () {\n return undefined;\n };\n\n var resultPromise = new Promise(function (resolve, reject) {\n var isFinalized = false;\n var renderTryCount = 0;\n var startedRunningAt = 0;\n\n context.oncomplete = function (event) {\n return resolve(event.renderedBuffer);\n };\n\n var startRunningTimeout = function () {\n setTimeout(function () {\n return reject(makeInnerError(\"timeout\"\n /* Timeout */\n ));\n }, Math.min(runningMaxAwaitTime, startedRunningAt + runningSufficientTime - Date.now()));\n };\n\n var tryRender = function () {\n try {\n context.startRendering();\n\n switch (context.state) {\n case 'running':\n startedRunningAt = Date.now();\n\n if (isFinalized) {\n startRunningTimeout();\n }\n\n break;\n // Sometimes the audio context doesn't start after calling `startRendering` (in addition to the cases where\n // audio context doesn't start at all). A known case is starting an audio context when the browser tab is in\n // background on iPhone. Retries usually help in this case.\n\n case 'suspended':\n // The audio context can reject starting until the tab is in foreground. Long fingerprint duration\n // in background isn't a problem, therefore the retry attempts don't count in background. It can lead to\n // a situation when a fingerprint takes very long time and finishes successfully. FYI, the audio context\n // can be suspended when `document.hidden === false` and start running after a retry.\n if (!document.hidden) {\n renderTryCount++;\n }\n\n if (isFinalized && renderTryCount >= renderTryMaxCount) {\n reject(makeInnerError(\"suspended\"\n /* Suspended */\n ));\n } else {\n setTimeout(tryRender, renderRetryDelay);\n }\n\n break;\n }\n } catch (error) {\n reject(error);\n }\n };\n\n tryRender();\n\n finalize = function () {\n if (!isFinalized) {\n isFinalized = true;\n\n if (startedRunningAt > 0) {\n startRunningTimeout();\n }\n }\n };\n });\n return [resultPromise, finalize];\n}\n\nfunction getHash(signal) {\n var hash = 0;\n\n for (var i = 0; i < signal.length; ++i) {\n hash += Math.abs(signal[i]);\n }\n\n return hash;\n}\n\nfunction makeInnerError(name) {\n var error = new Error(name);\n error.name = name;\n return error;\n}\n/**\n * Creates and keeps an invisible iframe while the given function runs.\n * The given function is called when the iframe is loaded and has a body.\n * The iframe allows to measure DOM sizes inside itself.\n *\n * Notice: passing an initial HTML code doesn't work in IE.\n *\n * Warning for package users:\n * This function is out of Semantic Versioning, i.e. can change unexpectedly. Usage is at your own risk.\n */\n\n\nfunction withIframe(action, initialHtml, domPollInterval) {\n var _a, _b, _c;\n\n if (domPollInterval === void 0) {\n domPollInterval = 50;\n }\n\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__awaiter\"])(this, void 0, void 0, function () {\n var d, iframe;\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__generator\"])(this, function (_d) {\n switch (_d.label) {\n case 0:\n d = document;\n _d.label = 1;\n\n case 1:\n if (!!d.body) return [3\n /*break*/\n , 3];\n return [4\n /*yield*/\n , wait(domPollInterval)];\n\n case 2:\n _d.sent();\n\n return [3\n /*break*/\n , 1];\n\n case 3:\n iframe = d.createElement('iframe');\n _d.label = 4;\n\n case 4:\n _d.trys.push([4,, 10, 11]);\n\n return [4\n /*yield*/\n , new Promise(function (_resolve, _reject) {\n var isComplete = false;\n\n var resolve = function () {\n isComplete = true;\n\n _resolve();\n };\n\n var reject = function (error) {\n isComplete = true;\n\n _reject(error);\n };\n\n iframe.onload = resolve;\n iframe.onerror = reject;\n var style = iframe.style;\n style.setProperty('display', 'block', 'important'); // Required for browsers to calculate the layout\n\n style.position = 'absolute';\n style.top = '0';\n style.left = '0';\n style.visibility = 'hidden';\n\n if (initialHtml && 'srcdoc' in iframe) {\n iframe.srcdoc = initialHtml;\n } else {\n iframe.src = 'about:blank';\n }\n\n d.body.appendChild(iframe); // WebKit in WeChat doesn't fire the iframe's `onload` for some reason.\n // This code checks for the loading state manually.\n // See https://github.com/fingerprintjs/fingerprintjs/issues/645\n\n var checkReadyState = function () {\n var _a, _b; // The ready state may never become 'complete' in Firefox despite the 'load' event being fired.\n // So an infinite setTimeout loop can happen without this check.\n // See https://github.com/fingerprintjs/fingerprintjs/pull/716#issuecomment-986898796\n\n\n if (isComplete) {\n return;\n } // Make sure iframe.contentWindow and iframe.contentWindow.document are both loaded\n // The contentWindow.document can miss in JSDOM (https://github.com/jsdom/jsdom).\n\n\n if (((_b = (_a = iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.document) === null || _b === void 0 ? void 0 : _b.readyState) === 'complete') {\n resolve();\n } else {\n setTimeout(checkReadyState, 10);\n }\n };\n\n checkReadyState();\n })];\n\n case 5:\n _d.sent();\n\n _d.label = 6;\n\n case 6:\n if (!!((_b = (_a = iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.document) === null || _b === void 0 ? void 0 : _b.body)) return [3\n /*break*/\n , 8];\n return [4\n /*yield*/\n , wait(domPollInterval)];\n\n case 7:\n _d.sent();\n\n return [3\n /*break*/\n , 6];\n\n case 8:\n return [4\n /*yield*/\n , action(iframe, iframe.contentWindow)];\n\n case 9:\n return [2\n /*return*/\n , _d.sent()];\n\n case 10:\n (_c = iframe.parentNode) === null || _c === void 0 ? void 0 : _c.removeChild(iframe);\n return [7\n /*endfinally*/\n ];\n\n case 11:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\n * Creates a DOM element that matches the given selector.\n * Only single element selector are supported (without operators like space, +, >, etc).\n */\n\n\nfunction selectorToElement(selector) {\n var _a = parseSimpleCssSelector(selector),\n tag = _a[0],\n attributes = _a[1];\n\n var element = document.createElement(tag !== null && tag !== void 0 ? tag : 'div');\n\n for (var _i = 0, _b = Object.keys(attributes); _i < _b.length; _i++) {\n var name_1 = _b[_i];\n var value = attributes[name_1].join(' '); // Changing the `style` attribute can cause a CSP error, therefore we change the `style.cssText` property.\n // https://github.com/fingerprintjs/fingerprintjs/issues/733\n\n if (name_1 === 'style') {\n addStyleString(element.style, value);\n } else {\n element.setAttribute(name_1, value);\n }\n }\n\n return element;\n}\n/**\n * Adds CSS styles from a string in such a way that doesn't trigger a CSP warning (unsafe-inline or unsafe-eval)\n */\n\n\nfunction addStyleString(style, source) {\n // We don't use `style.cssText` because browsers must block it when no `unsafe-eval` CSP is presented: https://csplite.com/csp145/#w3c_note\n // Even though the browsers ignore this standard, we don't use `cssText` just in case.\n for (var _i = 0, _a = source.split(';'); _i < _a.length; _i++) {\n var property = _a[_i];\n var match = /^\\s*([\\w-]+)\\s*:\\s*(.+?)(\\s*!([\\w-]+))?\\s*$/.exec(property);\n\n if (match) {\n var name_2 = match[1],\n value = match[2],\n priority = match[4];\n style.setProperty(name_2, value, priority || ''); // The last argument can't be undefined in IE11\n }\n }\n} // We use m or w because these two characters take up the maximum width.\n// And we use a LLi so that the same matching fonts can get separated.\n\n\nvar testString = 'mmMwWLliI0O&1'; // We test using 48px font size, we may use any size. I guess larger the better.\n\nvar textSize = '48px'; // A font will be compared against all the three default fonts.\n// And if for any default fonts it doesn't match, then that font is available.\n\nvar baseFonts = ['monospace', 'sans-serif', 'serif'];\nvar fontList = [// This is android-specific font from \"Roboto\" family\n'sans-serif-thin', 'ARNO PRO', 'Agency FB', 'Arabic Typesetting', 'Arial Unicode MS', 'AvantGarde Bk BT', 'BankGothic Md BT', 'Batang', 'Bitstream Vera Sans Mono', 'Calibri', 'Century', 'Century Gothic', 'Clarendon', 'EUROSTILE', 'Franklin Gothic', 'Futura Bk BT', 'Futura Md BT', 'GOTHAM', 'Gill Sans', 'HELV', 'Haettenschweiler', 'Helvetica Neue', 'Humanst521 BT', 'Leelawadee', 'Letter Gothic', 'Levenim MT', 'Lucida Bright', 'Lucida Sans', 'Menlo', 'MS Mincho', 'MS Outlook', 'MS Reference Specialty', 'MS UI Gothic', 'MT Extra', 'MYRIAD PRO', 'Marlett', 'Meiryo UI', 'Microsoft Uighur', 'Minion Pro', 'Monotype Corsiva', 'PMingLiU', 'Pristina', 'SCRIPTINA', 'Segoe UI Light', 'Serifa', 'SimHei', 'Small Fonts', 'Staccato222 BT', 'TRAJAN PRO', 'Univers CE 55 Medium', 'Vrinda', 'ZWAdobeF']; // kudos to http://www.lalit.org/lab/javascript-css-font-detect/\n\nfunction getFonts() {\n // Running the script in an iframe makes it not affect the page look and not be affected by the page CSS. See:\n // https://github.com/fingerprintjs/fingerprintjs/issues/592\n // https://github.com/fingerprintjs/fingerprintjs/issues/628\n return withIframe(function (_, _a) {\n var document = _a.document;\n var holder = document.body;\n holder.style.fontSize = textSize; // div to load spans for the default fonts and the fonts to detect\n\n var spansContainer = document.createElement('div');\n var defaultWidth = {};\n var defaultHeight = {}; // creates a span where the fonts will be loaded\n\n var createSpan = function (fontFamily) {\n var span = document.createElement('span');\n var style = span.style;\n style.position = 'absolute';\n style.top = '0';\n style.left = '0';\n style.fontFamily = fontFamily;\n span.textContent = testString;\n spansContainer.appendChild(span);\n return span;\n }; // creates a span and load the font to detect and a base font for fallback\n\n\n var createSpanWithFonts = function (fontToDetect, baseFont) {\n return createSpan(\"'\" + fontToDetect + \"',\" + baseFont);\n }; // creates spans for the base fonts and adds them to baseFontsDiv\n\n\n var initializeBaseFontsSpans = function () {\n return baseFonts.map(createSpan);\n }; // creates spans for the fonts to detect and adds them to fontsDiv\n\n\n var initializeFontsSpans = function () {\n // Stores {fontName : [spans for that font]}\n var spans = {};\n\n var _loop_1 = function (font) {\n spans[font] = baseFonts.map(function (baseFont) {\n return createSpanWithFonts(font, baseFont);\n });\n };\n\n for (var _i = 0, fontList_1 = fontList; _i < fontList_1.length; _i++) {\n var font = fontList_1[_i];\n\n _loop_1(font);\n }\n\n return spans;\n }; // checks if a font is available\n\n\n var isFontAvailable = function (fontSpans) {\n return baseFonts.some(function (baseFont, baseFontIndex) {\n return fontSpans[baseFontIndex].offsetWidth !== defaultWidth[baseFont] || fontSpans[baseFontIndex].offsetHeight !== defaultHeight[baseFont];\n });\n }; // create spans for base fonts\n\n\n var baseFontsSpans = initializeBaseFontsSpans(); // create spans for fonts to detect\n\n var fontsSpans = initializeFontsSpans(); // add all the spans to the DOM\n\n holder.appendChild(spansContainer); // get the default width for the three base fonts\n\n for (var index = 0; index < baseFonts.length; index++) {\n defaultWidth[baseFonts[index]] = baseFontsSpans[index].offsetWidth; // width for the default font\n\n defaultHeight[baseFonts[index]] = baseFontsSpans[index].offsetHeight; // height for the default font\n } // check available fonts\n\n\n return fontList.filter(function (font) {\n return isFontAvailable(fontsSpans[font]);\n });\n });\n}\n\nfunction getPlugins() {\n var rawPlugins = navigator.plugins;\n\n if (!rawPlugins) {\n return undefined;\n }\n\n var plugins = []; // Safari 10 doesn't support iterating navigator.plugins with for...of\n\n for (var i = 0; i < rawPlugins.length; ++i) {\n var plugin = rawPlugins[i];\n\n if (!plugin) {\n continue;\n }\n\n var mimeTypes = [];\n\n for (var j = 0; j < plugin.length; ++j) {\n var mimeType = plugin[j];\n mimeTypes.push({\n type: mimeType.type,\n suffixes: mimeType.suffixes\n });\n }\n\n plugins.push({\n name: plugin.name,\n description: plugin.description,\n mimeTypes: mimeTypes\n });\n }\n\n return plugins;\n} // https://www.browserleaks.com/canvas#how-does-it-work\n\n\nfunction getCanvasFingerprint() {\n var _a = makeCanvasContext(),\n canvas = _a[0],\n context = _a[1];\n\n if (!isSupported(canvas, context)) {\n return {\n winding: false,\n geometry: '',\n text: ''\n };\n }\n\n return {\n winding: doesSupportWinding(context),\n geometry: makeGeometryImage(canvas, context),\n // Text is unstable:\n // https://github.com/fingerprintjs/fingerprintjs/issues/583\n // https://github.com/fingerprintjs/fingerprintjs/issues/103\n // Therefore it's extracted into a separate image.\n text: makeTextImage(canvas, context)\n };\n}\n\nfunction makeCanvasContext() {\n var canvas = document.createElement('canvas');\n canvas.width = 1;\n canvas.height = 1;\n return [canvas, canvas.getContext('2d')];\n}\n\nfunction isSupported(canvas, context) {\n // TODO: look into: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob\n return !!(context && canvas.toDataURL);\n}\n\nfunction doesSupportWinding(context) {\n // https://web.archive.org/web/20170825024655/http://blogs.adobe.com/webplatform/2013/01/30/winding-rules-in-canvas/\n // https://github.com/Modernizr/Modernizr/blob/master/feature-detects/canvas/winding.js\n context.rect(0, 0, 10, 10);\n context.rect(2, 2, 6, 6);\n return !context.isPointInPath(5, 5, 'evenodd');\n}\n\nfunction makeTextImage(canvas, context) {\n // Resizing the canvas cleans it\n canvas.width = 240;\n canvas.height = 60;\n context.textBaseline = 'alphabetic';\n context.fillStyle = '#f60';\n context.fillRect(100, 1, 62, 20);\n context.fillStyle = '#069'; // It's important to use explicit built-in fonts in order to exclude the affect of font preferences\n // (there is a separate entropy source for them).\n\n context.font = '11pt \"Times New Roman\"'; // The choice of emojis has a gigantic impact on rendering performance (especially in FF).\n // Some newer emojis cause it to slow down 50-200 times.\n // There must be no text to the right of the emoji, see https://github.com/fingerprintjs/fingerprintjs/issues/574\n // A bare emoji shouldn't be used because the canvas will change depending on the script encoding:\n // https://github.com/fingerprintjs/fingerprintjs/issues/66\n // Escape sequence shouldn't be used too because Terser will turn it into a bare unicode.\n\n var printedText = \"Cwm fjordbank gly \" + String.fromCharCode(55357, 56835)\n /* 😃 */\n ;\n context.fillText(printedText, 2, 15);\n context.fillStyle = 'rgba(102, 204, 0, 0.2)';\n context.font = '18pt Arial';\n context.fillText(printedText, 4, 45);\n return save(canvas);\n}\n\nfunction makeGeometryImage(canvas, context) {\n // Resizing the canvas cleans it\n canvas.width = 122;\n canvas.height = 110; // Canvas blending\n // https://web.archive.org/web/20170826194121/http://blogs.adobe.com/webplatform/2013/01/28/blending-features-in-canvas/\n // http://jsfiddle.net/NDYV8/16/\n\n context.globalCompositeOperation = 'multiply';\n\n for (var _i = 0, _a = [['#f2f', 40, 40], ['#2ff', 80, 40], ['#ff2', 60, 80]]; _i < _a.length; _i++) {\n var _b = _a[_i],\n color = _b[0],\n x = _b[1],\n y = _b[2];\n context.fillStyle = color;\n context.beginPath();\n context.arc(x, y, 40, 0, Math.PI * 2, true);\n context.closePath();\n context.fill();\n } // Canvas winding\n // https://web.archive.org/web/20130913061632/http://blogs.adobe.com/webplatform/2013/01/30/winding-rules-in-canvas/\n // http://jsfiddle.net/NDYV8/19/\n\n\n context.fillStyle = '#f9c';\n context.arc(60, 60, 60, 0, Math.PI * 2, true);\n context.arc(60, 60, 20, 0, Math.PI * 2, true);\n context.fill('evenodd');\n return save(canvas);\n}\n\nfunction save(canvas) {\n // TODO: look into: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob\n return canvas.toDataURL();\n}\n/**\n * This is a crude and primitive touch screen detection. It's not possible to currently reliably detect the availability\n * of a touch screen with a JS, without actually subscribing to a touch event.\n *\n * @see http://www.stucox.com/blog/you-cant-detect-a-touchscreen/\n * @see https://github.com/Modernizr/Modernizr/issues/548\n */\n\n\nfunction getTouchSupport() {\n var n = navigator;\n var maxTouchPoints = 0;\n var touchEvent;\n\n if (n.maxTouchPoints !== undefined) {\n maxTouchPoints = toInt(n.maxTouchPoints);\n } else if (n.msMaxTouchPoints !== undefined) {\n maxTouchPoints = n.msMaxTouchPoints;\n }\n\n try {\n document.createEvent('TouchEvent');\n touchEvent = true;\n } catch (_a) {\n touchEvent = false;\n }\n\n var touchStart = ('ontouchstart' in window);\n return {\n maxTouchPoints: maxTouchPoints,\n touchEvent: touchEvent,\n touchStart: touchStart\n };\n}\n\nfunction getOsCpu() {\n return navigator.oscpu;\n}\n\nfunction getLanguages() {\n var n = navigator;\n var result = [];\n var language = n.language || n.userLanguage || n.browserLanguage || n.systemLanguage;\n\n if (language !== undefined) {\n result.push([language]);\n }\n\n if (Array.isArray(n.languages)) {\n // Starting from Chromium 86, there is only a single value in `navigator.language` in Incognito mode:\n // the value of `navigator.language`. Therefore the value is ignored in this browser.\n if (!(isChromium() && isChromium86OrNewer())) {\n result.push(n.languages);\n }\n } else if (typeof n.languages === 'string') {\n var languages = n.languages;\n\n if (languages) {\n result.push(languages.split(','));\n }\n }\n\n return result;\n}\n\nfunction getColorDepth() {\n return window.screen.colorDepth;\n}\n\nfunction getDeviceMemory() {\n // `navigator.deviceMemory` is a string containing a number in some unidentified cases\n return replaceNaN(toFloat(navigator.deviceMemory), undefined);\n}\n\nfunction getScreenResolution() {\n var s = screen; // Some browsers return screen resolution as strings, e.g. \"1200\", instead of a number, e.g. 1200.\n // I suspect it's done by certain plugins that randomize browser properties to prevent fingerprinting.\n // Some browsers even return screen resolution as not numbers.\n\n var parseDimension = function (value) {\n return replaceNaN(toInt(value), null);\n };\n\n var dimensions = [parseDimension(s.width), parseDimension(s.height)];\n dimensions.sort().reverse();\n return dimensions;\n}\n\nvar screenFrameCheckInterval = 2500;\nvar roundingPrecision = 10; // The type is readonly to protect from unwanted mutations\n\nvar screenFrameBackup;\nvar screenFrameSizeTimeoutId;\n/**\n * Starts watching the screen frame size. When a non-zero size appears, the size is saved and the watch is stopped.\n * Later, when `getScreenFrame` runs, it will return the saved non-zero size if the current size is null.\n *\n * This trick is required to mitigate the fact that the screen frame turns null in some cases.\n * See more on this at https://github.com/fingerprintjs/fingerprintjs/issues/568\n */\n\nfunction watchScreenFrame() {\n if (screenFrameSizeTimeoutId !== undefined) {\n return;\n }\n\n var checkScreenFrame = function () {\n var frameSize = getCurrentScreenFrame();\n\n if (isFrameSizeNull(frameSize)) {\n screenFrameSizeTimeoutId = setTimeout(checkScreenFrame, screenFrameCheckInterval);\n } else {\n screenFrameBackup = frameSize;\n screenFrameSizeTimeoutId = undefined;\n }\n };\n\n checkScreenFrame();\n}\n\nfunction getScreenFrame() {\n var _this = this;\n\n watchScreenFrame();\n return function () {\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__awaiter\"])(_this, void 0, void 0, function () {\n var frameSize;\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__generator\"])(this, function (_a) {\n switch (_a.label) {\n case 0:\n frameSize = getCurrentScreenFrame();\n if (!isFrameSizeNull(frameSize)) return [3\n /*break*/\n , 2];\n\n if (screenFrameBackup) {\n return [2\n /*return*/\n , Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__spreadArrays\"])(screenFrameBackup)];\n }\n\n if (!getFullscreenElement()) return [3\n /*break*/\n , 2]; // Some browsers set the screen frame to zero when programmatic fullscreen is on.\n // There is a chance of getting a non-zero frame after exiting the fullscreen.\n // See more on this at https://github.com/fingerprintjs/fingerprintjs/issues/568\n\n return [4\n /*yield*/\n , exitFullscreen()];\n\n case 1:\n // Some browsers set the screen frame to zero when programmatic fullscreen is on.\n // There is a chance of getting a non-zero frame after exiting the fullscreen.\n // See more on this at https://github.com/fingerprintjs/fingerprintjs/issues/568\n _a.sent();\n\n frameSize = getCurrentScreenFrame();\n _a.label = 2;\n\n case 2:\n if (!isFrameSizeNull(frameSize)) {\n screenFrameBackup = frameSize;\n }\n\n return [2\n /*return*/\n , frameSize];\n }\n });\n });\n };\n}\n/**\n * Sometimes the available screen resolution changes a bit, e.g. 1900x1440 → 1900x1439. A possible reason: macOS Dock\n * shrinks to fit more icons when there is too little space. The rounding is used to mitigate the difference.\n */\n\n\nfunction getRoundedScreenFrame() {\n var _this = this;\n\n var screenFrameGetter = getScreenFrame();\n return function () {\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__awaiter\"])(_this, void 0, void 0, function () {\n var frameSize, processSize;\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__generator\"])(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4\n /*yield*/\n , screenFrameGetter()];\n\n case 1:\n frameSize = _a.sent();\n\n processSize = function (sideSize) {\n return sideSize === null ? null : round(sideSize, roundingPrecision);\n }; // It might look like I don't know about `for` and `map`.\n // In fact, such code is used to avoid TypeScript issues without using `as`.\n\n\n return [2\n /*return*/\n , [processSize(frameSize[0]), processSize(frameSize[1]), processSize(frameSize[2]), processSize(frameSize[3])]];\n }\n });\n });\n };\n}\n\nfunction getCurrentScreenFrame() {\n var s = screen; // Some browsers return screen resolution as strings, e.g. \"1200\", instead of a number, e.g. 1200.\n // I suspect it's done by certain plugins that randomize browser properties to prevent fingerprinting.\n //\n // Some browsers (IE, Edge ≤18) don't provide `screen.availLeft` and `screen.availTop`. The property values are\n // replaced with 0 in such cases to not lose the entropy from `screen.availWidth` and `screen.availHeight`.\n\n return [replaceNaN(toFloat(s.availTop), null), replaceNaN(toFloat(s.width) - toFloat(s.availWidth) - replaceNaN(toFloat(s.availLeft), 0), null), replaceNaN(toFloat(s.height) - toFloat(s.availHeight) - replaceNaN(toFloat(s.availTop), 0), null), replaceNaN(toFloat(s.availLeft), null)];\n}\n\nfunction isFrameSizeNull(frameSize) {\n for (var i = 0; i < 4; ++i) {\n if (frameSize[i]) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction getHardwareConcurrency() {\n // sometimes hardware concurrency is a string\n return replaceNaN(toInt(navigator.hardwareConcurrency), undefined);\n}\n\nfunction getTimezone() {\n var _a;\n\n var DateTimeFormat = (_a = window.Intl) === null || _a === void 0 ? void 0 : _a.DateTimeFormat;\n\n if (DateTimeFormat) {\n var timezone = new DateTimeFormat().resolvedOptions().timeZone;\n\n if (timezone) {\n return timezone;\n }\n } // For browsers that don't support timezone names\n // The minus is intentional because the JS offset is opposite to the real offset\n\n\n var offset = -getTimezoneOffset();\n return \"UTC\" + (offset >= 0 ? '+' : '') + Math.abs(offset);\n}\n\nfunction getTimezoneOffset() {\n var currentYear = new Date().getFullYear(); // The timezone offset may change over time due to daylight saving time (DST) shifts.\n // The non-DST timezone offset is used as the result timezone offset.\n // Since the DST season differs in the northern and the southern hemispheres,\n // both January and July timezones offsets are considered.\n\n return Math.max( // `getTimezoneOffset` returns a number as a string in some unidentified cases\n toFloat(new Date(currentYear, 0, 1).getTimezoneOffset()), toFloat(new Date(currentYear, 6, 1).getTimezoneOffset()));\n}\n\nfunction getSessionStorage() {\n try {\n return !!window.sessionStorage;\n } catch (error) {\n /* SecurityError when referencing it means it exists */\n return true;\n }\n} // https://bugzilla.mozilla.org/show_bug.cgi?id=781447\n\n\nfunction getLocalStorage() {\n try {\n return !!window.localStorage;\n } catch (e) {\n /* SecurityError when referencing it means it exists */\n return true;\n }\n}\n\nfunction getIndexedDB() {\n // IE and Edge don't allow accessing indexedDB in private mode, therefore IE and Edge will have different\n // visitor identifier in normal and private modes.\n if (isTrident() || isEdgeHTML()) {\n return undefined;\n }\n\n try {\n return !!window.indexedDB;\n } catch (e) {\n /* SecurityError when referencing it means it exists */\n return true;\n }\n}\n\nfunction getOpenDatabase() {\n return !!window.openDatabase;\n}\n\nfunction getCpuClass() {\n return navigator.cpuClass;\n}\n\nfunction getPlatform() {\n // Android Chrome 86 and 87 and Android Firefox 80 and 84 don't mock the platform value when desktop mode is requested\n var platform = navigator.platform; // iOS mocks the platform value when desktop version is requested: https://github.com/fingerprintjs/fingerprintjs/issues/514\n // iPad uses desktop mode by default since iOS 13\n // The value is 'MacIntel' on M1 Macs\n // The value is 'iPhone' on iPod Touch\n\n if (platform === 'MacIntel') {\n if (isWebKit() && !isDesktopSafari()) {\n return isIPad() ? 'iPad' : 'iPhone';\n }\n }\n\n return platform;\n}\n\nfunction getVendor() {\n return navigator.vendor || '';\n}\n/**\n * Checks for browser-specific (not engine specific) global variables to tell browsers with the same engine apart.\n * Only somewhat popular browsers are considered.\n */\n\n\nfunction getVendorFlavors() {\n var flavors = [];\n\n for (var _i = 0, _a = [// Blink and some browsers on iOS\n 'chrome', // Safari on macOS\n 'safari', // Chrome on iOS (checked in 85 on 13 and 87 on 14)\n '__crWeb', '__gCrWeb', // Yandex Browser on iOS, macOS and Android (checked in 21.2 on iOS 14, macOS and Android)\n 'yandex', // Yandex Browser on iOS (checked in 21.2 on 14)\n '__yb', '__ybro', // Firefox on iOS (checked in 32 on 14)\n '__firefox__', // Edge on iOS (checked in 46 on 14)\n '__edgeTrackingPreventionStatistics', 'webkit', // Opera Touch on iOS (checked in 2.6 on 14)\n 'oprt', // Samsung Internet on Android (checked in 11.1)\n 'samsungAr', // UC Browser on Android (checked in 12.10 and 13.0)\n 'ucweb', 'UCShellJava', // Puffin on Android (checked in 9.0)\n 'puffinDevice']; _i < _a.length; _i++) {\n var key = _a[_i];\n var value = window[key];\n\n if (value && typeof value === 'object') {\n flavors.push(key);\n }\n }\n\n return flavors.sort();\n}\n/**\n * navigator.cookieEnabled cannot detect custom or nuanced cookie blocking configurations. For example, when blocking\n * cookies via the Advanced Privacy Settings in IE9, it always returns true. And there have been issues in the past with\n * site-specific exceptions. Don't rely on it.\n *\n * @see https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cookies.js Taken from here\n */\n\n\nfunction areCookiesEnabled() {\n var d = document; // Taken from here: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cookies.js\n // navigator.cookieEnabled cannot detect custom or nuanced cookie blocking configurations. For example, when blocking\n // cookies via the Advanced Privacy Settings in IE9, it always returns true. And there have been issues in the past\n // with site-specific exceptions. Don't rely on it.\n // try..catch because some in situations `document.cookie` is exposed but throws a\n // SecurityError if you try to access it; e.g. documents created from data URIs\n // or in sandboxed iframes (depending on flags/context)\n\n try {\n // Create cookie\n d.cookie = 'cookietest=1; SameSite=Strict;';\n var result = d.cookie.indexOf('cookietest=') !== -1; // Delete cookie\n\n d.cookie = 'cookietest=1; SameSite=Strict; expires=Thu, 01-Jan-1970 00:00:01 GMT';\n return result;\n } catch (e) {\n return false;\n }\n}\n/**\n * Only single element selector are supported (no operators like space, +, >, etc).\n * `embed` and `position: fixed;` will be considered as blocked anyway because it always has no offsetParent.\n * Avoid `iframe` and anything with `[src=]` because they produce excess HTTP requests.\n *\n * See docs/content_blockers.md to learn how to make the list\n */\n\n\nvar filters = {\n abpIndo: ['#Iklan-Melayang', '#Kolom-Iklan-728', '#SidebarIklan-wrapper', 'a[title=\"7naga poker\" i]', '[title=\"ALIENBOLA\" i]'],\n abpvn: ['#quangcaomb', '.iosAdsiosAds-layout', '.quangcao', '[href^=\"https://r88.vn/\"]', '[href^=\"https://zbet.vn/\"]'],\n adBlockFinland: ['.mainostila', '.sponsorit', '.ylamainos', 'a[href*=\"/clickthrgh.asp?\"]', 'a[href^=\"https://app.readpeak.com/ads\"]'],\n adBlockPersian: ['#navbar_notice_50', '.kadr', 'TABLE[width=\"140px\"]', '#divAgahi', '#ad2_inline'],\n adBlockWarningRemoval: ['#adblock-honeypot', '.adblocker-root', '.wp_adblock_detect', '.header-blocked-ad', '#ad_blocker'],\n adGuardAnnoyances: ['amp-embed[type=\"zen\"]', '.hs-sosyal', '#cookieconsentdiv', 'div[class^=\"app_gdpr\"]', '.as-oil'],\n adGuardBase: ['.BetterJsPopOverlay', '#ad_300X250', '#bannerfloat22', '#ad-banner', '#campaign-banner'],\n adGuardChinese: ['.Zi_ad_a_H', 'a[href*=\"/od005.com\"]', 'a[href*=\".hthbet34.com\"]', '.qq_nr_lad', '#widget-quan'],\n adGuardFrench: ['#block-views-ads-sidebar-block-block', '#pavePub', '.ad-desktop-rectangle', '.mobile_adhesion', '.widgetadv'],\n adGuardGerman: ['.banneritemwerbung_head_1', '.boxstartwerbung', '.werbung3', 'a[href^=\"http://www.eis.de/index.phtml?refid=\"]', 'a[href^=\"https://www.tipico.com/?affiliateId=\"]'],\n adGuardJapanese: ['#kauli_yad_1', 'a[href^=\"http://ad2.trafficgate.net/\"]', '._popIn_infinite_ad', '.adgoogle', '.ad_regular3'],\n adGuardMobile: ['amp-auto-ads', '.amp_ad', 'amp-embed[type=\"24smi\"]', '#mgid_iframe1', '#ad_inview_area'],\n adGuardRussian: ['a[href^=\"https://ad.letmeads.com/\"]', '.reclama', 'div[id^=\"smi2adblock\"]', 'div[id^=\"AdFox_banner_\"]', '#ad_square'],\n adGuardSocial: ['a[href^=\"//www.stumbleupon.com/submit?url=\"]', 'a[href^=\"//telegram.me/share/url?\"]', '.etsy-tweet', '#inlineShare', '.popup-social'],\n adGuardSpanishPortuguese: ['#barraPublicidade', '#Publicidade', '#publiEspecial', '#queTooltip', '[href^=\"http://ads.glispa.com/\"]'],\n adGuardTrackingProtection: ['#qoo-counter', 'a[href^=\"http://click.hotlog.ru/\"]', 'a[href^=\"http://hitcounter.ru/top/stat.php\"]', 'a[href^=\"http://top.mail.ru/jump\"]', '#top100counter'],\n adGuardTurkish: ['#backkapat', '#reklami', 'a[href^=\"http://adserv.ontek.com.tr/\"]', 'a[href^=\"http://izlenzi.com/campaign/\"]', 'a[href^=\"http://www.installads.net/\"]'],\n bulgarian: ['td#freenet_table_ads', '#ea_intext_div', '.lapni-pop-over', '#xenium_hot_offers', '#newAd'],\n easyList: ['#AD_CONTROL_28', '.second-post-ads-wrapper', '.universalboxADVBOX03', '.advertisement-728x90', '.square_ads'],\n easyListChina: ['a[href*=\".wensixuetang.com/\"]', '.appguide-wrap[onclick*=\"bcebos.com\"]', '.frontpageAdvM', '#taotaole', '#aafoot.top_box'],\n easyListCookie: ['#AdaCompliance.app-notice', '.text-center.rgpd', '.panel--cookie', '.js-cookies-andromeda', '.elxtr-consent'],\n easyListCzechSlovak: ['#onlajny-stickers', '#reklamni-box', '.reklama-megaboard', '.sklik', '[id^=\"sklikReklama\"]'],\n easyListDutch: ['#advertentie', '#vipAdmarktBannerBlock', '.adstekst', 'a[href^=\"https://xltube.nl/click/\"]', '#semilo-lrectangle'],\n easyListGermany: ['#Ad_Win2day', '#werbungsbox300', 'a[href^=\"http://www.rotlichtkartei.com/?sc=\"]', '#werbung_wideskyscraper_screen', 'a[href^=\"http://landing.parkplatzkartei.com/?ag=\"]'],\n easyListItaly: ['.box_adv_annunci', '.sb-box-pubbliredazionale', 'a[href^=\"http://affiliazioniads.snai.it/\"]', 'a[href^=\"https://adserver.html.it/\"]', 'a[href^=\"https://affiliazioniads.snai.it/\"]'],\n easyListLithuania: ['.reklamos_tarpas', '.reklamos_nuorodos', 'img[alt=\"Reklaminis skydelis\"]', 'img[alt=\"Dedikuoti.lt serveriai\"]', 'img[alt=\"Hostingas Serveriai.lt\"]'],\n estonian: ['A[href*=\"http://pay4results24.eu\"]'],\n fanboyAnnoyances: ['#feedback-tab', '#taboola-below-article', '.feedburnerFeedBlock', '.widget-feedburner-counter', '[title=\"Subscribe to our blog\"]'],\n fanboyAntiFacebook: ['.util-bar-module-firefly-visible'],\n fanboyEnhancedTrackers: ['.open.pushModal', '#issuem-leaky-paywall-articles-zero-remaining-nag', '#sovrn_container', 'div[class$=\"-hide\"][zoompage-fontsize][style=\"display: block;\"]', '.BlockNag__Card'],\n fanboySocial: ['.td-tags-and-social-wrapper-box', '.twitterContainer', '.youtube-social', 'a[title^=\"Like us on Facebook\"]', 'img[alt^=\"Share on Digg\"]'],\n frellwitSwedish: ['a[href*=\"casinopro.se\"][target=\"_blank\"]', 'a[href*=\"doktor-se.onelink.me\"]', 'article.category-samarbete', 'div.holidAds', 'ul.adsmodern'],\n greekAdBlock: ['A[href*=\"adman.otenet.gr/click?\"]', 'A[href*=\"http://axiabanners.exodus.gr/\"]', 'A[href*=\"http://interactive.forthnet.gr/click?\"]', 'DIV.agores300', 'TABLE.advright'],\n hungarian: ['#cemp_doboz', '.optimonk-iframe-container', '.ad__main', '[class*=\"GoogleAds\"]', '#hirdetesek_box'],\n iDontCareAboutCookies: ['.alert-info[data-block-track*=\"CookieNotice\"]', '.ModuleTemplateCookieIndicator', '.o--cookies--container', '.cookie-msg-info-container', '#cookies-policy-sticky'],\n icelandicAbp: ['A[href^=\"/framework/resources/forms/ads.aspx\"]'],\n latvian: ['a[href=\"http://www.salidzini.lv/\"][style=\"display: block; width: 120px; height: 40px; overflow: hidden; position: relative;\"]', 'a[href=\"http://www.salidzini.lv/\"][style=\"display: block; width: 88px; height: 31px; overflow: hidden; position: relative;\"]'],\n listKr: ['a[href*=\"//ad.planbplus.co.kr/\"]', '#livereAdWrapper', 'a[href*=\"//adv.imadrep.co.kr/\"]', 'ins.fastview-ad', '.revenue_unit_item.dable'],\n listeAr: ['.geminiLB1Ad', '.right-and-left-sponsers', 'a[href*=\".aflam.info\"]', 'a[href*=\"booraq.org\"]', 'a[href*=\"dubizzle.com/ar/?utm_source=\"]'],\n listeFr: ['a[href^=\"http://promo.vador.com/\"]', '#adcontainer_recherche', 'a[href*=\"weborama.fr/fcgi-bin/\"]', '.site-pub-interstitiel', 'div[id^=\"crt-\"][data-criteo-id]'],\n officialPolish: ['#ceneo-placeholder-ceneo-12', '[href^=\"https://aff.sendhub.pl/\"]', 'a[href^=\"http://advmanager.techfun.pl/redirect/\"]', 'a[href^=\"http://www.trizer.pl/?utm_source\"]', 'div#skapiec_ad'],\n ro: ['a[href^=\"//afftrk.altex.ro/Counter/Click\"]', 'a[href^=\"/magazin/\"]', 'a[href^=\"https://blackfridaysales.ro/trk/shop/\"]', 'a[href^=\"https://event.2performant.com/events/click\"]', 'a[href^=\"https://l.profitshare.ro/\"]'],\n ruAd: ['a[href*=\"//febrare.ru/\"]', 'a[href*=\"//utimg.ru/\"]', 'a[href*=\"://chikidiki.ru\"]', '#pgeldiz', '.yandex-rtb-block'],\n thaiAds: ['a[href*=macau-uta-popup]', '#ads-google-middle_rectangle-group', '.ads300s', '.bumq', '.img-kosana'],\n webAnnoyancesUltralist: ['#mod-social-share-2', '#social-tools', '.ctpl-fullbanner', '.zergnet-recommend', '.yt.btn-link.btn-md.btn']\n};\n/**\n * The order of the returned array means nothing (it's always sorted alphabetically).\n *\n * Notice that the source is slightly unstable.\n * Safari provides a 2-taps way to disable all content blockers on a page temporarily.\n * Also content blockers can be disabled permanently for a domain, but it requires 4 taps.\n * So empty array shouldn't be treated as \"no blockers\", it should be treated as \"no signal\".\n * If you are a website owner, don't make your visitors want to disable content blockers.\n */\n\nfunction getDomBlockers(_a) {\n var debug = (_a === void 0 ? {} : _a).debug;\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__awaiter\"])(this, void 0, void 0, function () {\n var filterNames, allSelectors, blockedSelectors, activeBlockers;\n\n var _b;\n\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__generator\"])(this, function (_c) {\n switch (_c.label) {\n case 0:\n if (!isApplicable()) {\n return [2\n /*return*/\n , undefined];\n }\n\n filterNames = Object.keys(filters);\n allSelectors = (_b = []).concat.apply(_b, filterNames.map(function (filterName) {\n return filters[filterName];\n }));\n return [4\n /*yield*/\n , getBlockedSelectors(allSelectors)];\n\n case 1:\n blockedSelectors = _c.sent();\n\n if (debug) {\n printDebug(blockedSelectors);\n }\n\n activeBlockers = filterNames.filter(function (filterName) {\n var selectors = filters[filterName];\n var blockedCount = countTruthy(selectors.map(function (selector) {\n return blockedSelectors[selector];\n }));\n return blockedCount > selectors.length * 0.6;\n });\n activeBlockers.sort();\n return [2\n /*return*/\n , activeBlockers];\n }\n });\n });\n}\n\nfunction isApplicable() {\n // Safari (desktop and mobile) and all Android browsers keep content blockers in both regular and private mode\n return isWebKit() || isAndroid();\n}\n\nfunction getBlockedSelectors(selectors) {\n var _a;\n\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__awaiter\"])(this, void 0, void 0, function () {\n var d, root, elements, blockedSelectors, i, element, holder, i;\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__generator\"])(this, function (_b) {\n switch (_b.label) {\n case 0:\n d = document;\n root = d.createElement('div');\n elements = new Array(selectors.length);\n blockedSelectors = {} // Set() isn't used just in case somebody need older browser support\n ;\n forceShow(root); // First create all elements that can be blocked. If the DOM steps below are done in a single cycle,\n // browser will alternate tree modification and layout reading, that is very slow.\n\n for (i = 0; i < selectors.length; ++i) {\n element = selectorToElement(selectors[i]);\n holder = d.createElement('div') // Protects from unwanted effects of `+` and `~` selectors of filters\n ;\n forceShow(holder);\n holder.appendChild(element);\n root.appendChild(holder);\n elements[i] = element;\n }\n\n _b.label = 1;\n\n case 1:\n if (!!d.body) return [3\n /*break*/\n , 3];\n return [4\n /*yield*/\n , wait(50)];\n\n case 2:\n _b.sent();\n\n return [3\n /*break*/\n , 1];\n\n case 3:\n d.body.appendChild(root);\n\n try {\n // Then check which of the elements are blocked\n for (i = 0; i < selectors.length; ++i) {\n if (!elements[i].offsetParent) {\n blockedSelectors[selectors[i]] = true;\n }\n }\n } finally {\n // Then remove the elements\n (_a = root.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(root);\n }\n\n return [2\n /*return*/\n , blockedSelectors];\n }\n });\n });\n}\n\nfunction forceShow(element) {\n element.style.setProperty('display', 'block', 'important');\n}\n\nfunction printDebug(blockedSelectors) {\n var message = 'DOM blockers debug:\\n```';\n\n for (var _i = 0, _a = Object.keys(filters); _i < _a.length; _i++) {\n var filterName = _a[_i];\n message += \"\\n\" + filterName + \":\";\n\n for (var _b = 0, _c = filters[filterName]; _b < _c.length; _b++) {\n var selector = _c[_b];\n message += \"\\n \" + selector + \" \" + (blockedSelectors[selector] ? '🚫' : '➡️');\n }\n } // console.log is ok here because it's under a debug clause\n // eslint-disable-next-line no-console\n\n\n console.log(message + \"\\n```\");\n}\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/@media/color-gamut\n */\n\n\nfunction getColorGamut() {\n // rec2020 includes p3 and p3 includes srgb\n for (var _i = 0, _a = ['rec2020', 'p3', 'srgb']; _i < _a.length; _i++) {\n var gamut = _a[_i];\n\n if (matchMedia(\"(color-gamut: \" + gamut + \")\").matches) {\n return gamut;\n }\n }\n\n return undefined;\n}\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/@media/inverted-colors\n */\n\n\nfunction areColorsInverted() {\n if (doesMatch$4('inverted')) {\n return true;\n }\n\n if (doesMatch$4('none')) {\n return false;\n }\n\n return undefined;\n}\n\nfunction doesMatch$4(value) {\n return matchMedia(\"(inverted-colors: \" + value + \")\").matches;\n}\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/@media/forced-colors\n */\n\n\nfunction areColorsForced() {\n if (doesMatch$3('active')) {\n return true;\n }\n\n if (doesMatch$3('none')) {\n return false;\n }\n\n return undefined;\n}\n\nfunction doesMatch$3(value) {\n return matchMedia(\"(forced-colors: \" + value + \")\").matches;\n}\n\nvar maxValueToCheck = 100;\n/**\n * If the display is monochrome (e.g. black&white), the value will be ≥0 and will mean the number of bits per pixel.\n * If the display is not monochrome, the returned value will be 0.\n * If the browser doesn't support this feature, the returned value will be undefined.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/@media/monochrome\n */\n\nfunction getMonochromeDepth() {\n if (!matchMedia('(min-monochrome: 0)').matches) {\n // The media feature isn't supported by the browser\n return undefined;\n } // A variation of binary search algorithm can be used here.\n // But since expected values are very small (≤10), there is no sense in adding the complexity.\n\n\n for (var i = 0; i <= maxValueToCheck; ++i) {\n if (matchMedia(\"(max-monochrome: \" + i + \")\").matches) {\n return i;\n }\n }\n\n throw new Error('Too high value');\n}\n/**\n * @see https://www.w3.org/TR/mediaqueries-5/#prefers-contrast\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-contrast\n */\n\n\nfunction getContrastPreference() {\n if (doesMatch$2('no-preference')) {\n return 0\n /* None */\n ;\n } // The sources contradict on the keywords. Probably 'high' and 'low' will never be implemented.\n // Need to check it when all browsers implement the feature.\n\n\n if (doesMatch$2('high') || doesMatch$2('more')) {\n return 1\n /* More */\n ;\n }\n\n if (doesMatch$2('low') || doesMatch$2('less')) {\n return -1\n /* Less */\n ;\n }\n\n if (doesMatch$2('forced')) {\n return 10\n /* ForcedColors */\n ;\n }\n\n return undefined;\n}\n\nfunction doesMatch$2(value) {\n return matchMedia(\"(prefers-contrast: \" + value + \")\").matches;\n}\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion\n */\n\n\nfunction isMotionReduced() {\n if (doesMatch$1('reduce')) {\n return true;\n }\n\n if (doesMatch$1('no-preference')) {\n return false;\n }\n\n return undefined;\n}\n\nfunction doesMatch$1(value) {\n return matchMedia(\"(prefers-reduced-motion: \" + value + \")\").matches;\n}\n/**\n * @see https://www.w3.org/TR/mediaqueries-5/#dynamic-range\n */\n\n\nfunction isHDR() {\n if (doesMatch('high')) {\n return true;\n }\n\n if (doesMatch('standard')) {\n return false;\n }\n\n return undefined;\n}\n\nfunction doesMatch(value) {\n return matchMedia(\"(dynamic-range: \" + value + \")\").matches;\n}\n\nvar M = Math; // To reduce the minified code size\n\nvar fallbackFn = function () {\n return 0;\n};\n/**\n * @see https://gitlab.torproject.org/legacy/trac/-/issues/13018\n * @see https://bugzilla.mozilla.org/show_bug.cgi?id=531915\n */\n\n\nfunction getMathFingerprint() {\n // Native operations\n var acos = M.acos || fallbackFn;\n var acosh = M.acosh || fallbackFn;\n var asin = M.asin || fallbackFn;\n var asinh = M.asinh || fallbackFn;\n var atanh = M.atanh || fallbackFn;\n var atan = M.atan || fallbackFn;\n var sin = M.sin || fallbackFn;\n var sinh = M.sinh || fallbackFn;\n var cos = M.cos || fallbackFn;\n var cosh = M.cosh || fallbackFn;\n var tan = M.tan || fallbackFn;\n var tanh = M.tanh || fallbackFn;\n var exp = M.exp || fallbackFn;\n var expm1 = M.expm1 || fallbackFn;\n var log1p = M.log1p || fallbackFn; // Operation polyfills\n\n var powPI = function (value) {\n return M.pow(M.PI, value);\n };\n\n var acoshPf = function (value) {\n return M.log(value + M.sqrt(value * value - 1));\n };\n\n var asinhPf = function (value) {\n return M.log(value + M.sqrt(value * value + 1));\n };\n\n var atanhPf = function (value) {\n return M.log((1 + value) / (1 - value)) / 2;\n };\n\n var sinhPf = function (value) {\n return M.exp(value) - 1 / M.exp(value) / 2;\n };\n\n var coshPf = function (value) {\n return (M.exp(value) + 1 / M.exp(value)) / 2;\n };\n\n var expm1Pf = function (value) {\n return M.exp(value) - 1;\n };\n\n var tanhPf = function (value) {\n return (M.exp(2 * value) - 1) / (M.exp(2 * value) + 1);\n };\n\n var log1pPf = function (value) {\n return M.log(1 + value);\n }; // Note: constant values are empirical\n\n\n return {\n acos: acos(0.123124234234234242),\n acosh: acosh(1e308),\n acoshPf: acoshPf(1e154),\n asin: asin(0.123124234234234242),\n asinh: asinh(1),\n asinhPf: asinhPf(1),\n atanh: atanh(0.5),\n atanhPf: atanhPf(0.5),\n atan: atan(0.5),\n sin: sin(-1e300),\n sinh: sinh(1),\n sinhPf: sinhPf(1),\n cos: cos(10.000000000123),\n cosh: cosh(1),\n coshPf: coshPf(1),\n tan: tan(-1e300),\n tanh: tanh(1),\n tanhPf: tanhPf(1),\n exp: exp(1),\n expm1: expm1(1),\n expm1Pf: expm1Pf(1),\n log1p: log1p(10),\n log1pPf: log1pPf(10),\n powPI: powPI(-100)\n };\n}\n/**\n * We use m or w because these two characters take up the maximum width.\n * Also there are a couple of ligatures.\n */\n\n\nvar defaultText = 'mmMwWLliI0fiflO&1';\n/**\n * Settings of text blocks to measure. The keys are random but persistent words.\n */\n\nvar presets = {\n /**\n * The default font. User can change it in desktop Chrome, desktop Firefox, IE 11,\n * Android Chrome (but only when the size is ≥ than the default) and Android Firefox.\n */\n default: [],\n\n /** OS font on macOS. User can change its size and weight. Applies after Safari restart. */\n apple: [{\n font: '-apple-system-body'\n }],\n\n /** User can change it in desktop Chrome and desktop Firefox. */\n serif: [{\n fontFamily: 'serif'\n }],\n\n /** User can change it in desktop Chrome and desktop Firefox. */\n sans: [{\n fontFamily: 'sans-serif'\n }],\n\n /** User can change it in desktop Chrome and desktop Firefox. */\n mono: [{\n fontFamily: 'monospace'\n }],\n\n /**\n * Check the smallest allowed font size. User can change it in desktop Chrome, desktop Firefox and desktop Safari.\n * The height can be 0 in Chrome on a retina display.\n */\n min: [{\n fontSize: '1px'\n }],\n\n /** Tells one OS from another in desktop Chrome. */\n system: [{\n fontFamily: 'system-ui'\n }]\n};\n/**\n * The result is a dictionary of the width of the text samples.\n * Heights aren't included because they give no extra entropy and are unstable.\n *\n * The result is very stable in IE 11, Edge 18 and Safari 14.\n * The result changes when the OS pixel density changes in Chromium 87. The real pixel density is required to solve,\n * but seems like it's impossible: https://stackoverflow.com/q/1713771/1118709.\n * The \"min\" and the \"mono\" (only on Windows) value may change when the page is zoomed in Firefox 87.\n */\n\nfunction getFontPreferences() {\n return withNaturalFonts(function (document, container) {\n var elements = {};\n var sizes = {}; // First create all elements to measure. If the DOM steps below are done in a single cycle,\n // browser will alternate tree modification and layout reading, that is very slow.\n\n for (var _i = 0, _a = Object.keys(presets); _i < _a.length; _i++) {\n var key = _a[_i];\n var _b = presets[key],\n _c = _b[0],\n style = _c === void 0 ? {} : _c,\n _d = _b[1],\n text = _d === void 0 ? defaultText : _d;\n var element = document.createElement('span');\n element.textContent = text;\n element.style.whiteSpace = 'nowrap';\n\n for (var _e = 0, _f = Object.keys(style); _e < _f.length; _e++) {\n var name_1 = _f[_e];\n var value = style[name_1];\n\n if (value !== undefined) {\n element.style[name_1] = value;\n }\n }\n\n elements[key] = element;\n container.appendChild(document.createElement('br'));\n container.appendChild(element);\n } // Then measure the created elements\n\n\n for (var _g = 0, _h = Object.keys(presets); _g < _h.length; _g++) {\n var key = _h[_g];\n sizes[key] = elements[key].getBoundingClientRect().width;\n }\n\n return sizes;\n });\n}\n/**\n * Creates a DOM environment that provides the most natural font available, including Android OS font.\n * Measurements of the elements are zoom-independent.\n * Don't put a content to measure inside an absolutely positioned element.\n */\n\n\nfunction withNaturalFonts(action, containerWidthPx) {\n if (containerWidthPx === void 0) {\n containerWidthPx = 4000;\n }\n /*\n * Requirements for Android Chrome to apply the system font size to a text inside an iframe:\n * - The iframe mustn't have a `display: none;` style;\n * - The text mustn't be positioned absolutely;\n * - The text block must be wide enough.\n * 2560px on some devices in portrait orientation for the biggest font size option (32px);\n * - There must be much enough text to form a few lines (I don't know the exact numbers);\n * - The text must have the `text-size-adjust: none` style. Otherwise the text will scale in \"Desktop site\" mode;\n *\n * Requirements for Android Firefox to apply the system font size to a text inside an iframe:\n * - The iframe document must have a header: `<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />`.\n * The only way to set it is to use the `srcdoc` attribute of the iframe;\n * - The iframe content must get loaded before adding extra content with JavaScript;\n *\n * https://example.com as the iframe target always inherits Android font settings so it can be used as a reference.\n *\n * Observations on how page zoom affects the measurements:\n * - macOS Safari 11.1, 12.1, 13.1, 14.0: zoom reset + offsetWidth = 100% reliable;\n * - macOS Safari 11.1, 12.1, 13.1, 14.0: zoom reset + getBoundingClientRect = 100% reliable;\n * - macOS Safari 14.0: offsetWidth = 5% fluctuation;\n * - macOS Safari 14.0: getBoundingClientRect = 5% fluctuation;\n * - iOS Safari 9, 10, 11.0, 12.0: haven't found a way to zoom a page (pinch doesn't change layout);\n * - iOS Safari 13.1, 14.0: zoom reset + offsetWidth = 100% reliable;\n * - iOS Safari 13.1, 14.0: zoom reset + getBoundingClientRect = 100% reliable;\n * - iOS Safari 14.0: offsetWidth = 100% reliable;\n * - iOS Safari 14.0: getBoundingClientRect = 100% reliable;\n * - Chrome 42, 65, 80, 87: zoom 1/devicePixelRatio + offsetWidth = 1px fluctuation;\n * - Chrome 42, 65, 80, 87: zoom 1/devicePixelRatio + getBoundingClientRect = 100% reliable;\n * - Chrome 87: offsetWidth = 1px fluctuation;\n * - Chrome 87: getBoundingClientRect = 0.7px fluctuation;\n * - Firefox 48, 51: offsetWidth = 10% fluctuation;\n * - Firefox 48, 51: getBoundingClientRect = 10% fluctuation;\n * - Firefox 52, 53, 57, 62, 66, 67, 68, 71, 75, 80, 84: offsetWidth = width 100% reliable, height 10% fluctuation;\n * - Firefox 52, 53, 57, 62, 66, 67, 68, 71, 75, 80, 84: getBoundingClientRect = width 100% reliable, height 10%\n * fluctuation;\n * - Android Chrome 86: haven't found a way to zoom a page (pinch doesn't change layout);\n * - Android Firefox 84: font size in accessibility settings changes all the CSS sizes, but offsetWidth and\n * getBoundingClientRect keep measuring with regular units, so the size reflects the font size setting and doesn't\n * fluctuate;\n * - IE 11, Edge 18: zoom 1/devicePixelRatio + offsetWidth = 100% reliable;\n * - IE 11, Edge 18: zoom 1/devicePixelRatio + getBoundingClientRect = reflects the zoom level;\n * - IE 11, Edge 18: offsetWidth = 100% reliable;\n * - IE 11, Edge 18: getBoundingClientRect = 100% reliable;\n */\n\n\n return withIframe(function (_, iframeWindow) {\n var iframeDocument = iframeWindow.document;\n var iframeBody = iframeDocument.body;\n var bodyStyle = iframeBody.style;\n bodyStyle.width = containerWidthPx + \"px\";\n bodyStyle.webkitTextSizeAdjust = bodyStyle.textSizeAdjust = 'none'; // See the big comment above\n\n if (isChromium()) {\n iframeBody.style.zoom = \"\" + 1 / iframeWindow.devicePixelRatio;\n } else if (isWebKit()) {\n iframeBody.style.zoom = 'reset';\n } // See the big comment above\n\n\n var linesOfText = iframeDocument.createElement('div');\n linesOfText.textContent = Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__spreadArrays\"])(Array(containerWidthPx / 20 << 0)).map(function () {\n return 'word';\n }).join(' ');\n iframeBody.appendChild(linesOfText);\n return action(iframeDocument, iframeBody);\n }, '<!doctype html><html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">');\n}\n/**\n * The list of entropy sources used to make visitor identifiers.\n *\n * This value isn't restricted by Semantic Versioning, i.e. it may be changed without bumping minor or major version of\n * this package.\n *\n * Note: Rollup and Webpack are smart enough to remove unused properties of this object during tree-shaking, so there is\n * no need to export the sources individually.\n */\n\n\nvar sources = {\n // READ FIRST:\n // See https://github.com/fingerprintjs/fingerprintjs/blob/master/contributing.md#how-to-make-an-entropy-source\n // to learn how entropy source works and how to make your own.\n // The sources run in this exact order.\n // The asynchronous sources are at the start to run in parallel with other sources.\n fonts: getFonts,\n domBlockers: getDomBlockers,\n fontPreferences: getFontPreferences,\n audio: getAudioFingerprint,\n screenFrame: getRoundedScreenFrame,\n osCpu: getOsCpu,\n languages: getLanguages,\n colorDepth: getColorDepth,\n deviceMemory: getDeviceMemory,\n screenResolution: getScreenResolution,\n hardwareConcurrency: getHardwareConcurrency,\n timezone: getTimezone,\n sessionStorage: getSessionStorage,\n localStorage: getLocalStorage,\n indexedDB: getIndexedDB,\n openDatabase: getOpenDatabase,\n cpuClass: getCpuClass,\n platform: getPlatform,\n plugins: getPlugins,\n canvas: getCanvasFingerprint,\n touchSupport: getTouchSupport,\n vendor: getVendor,\n vendorFlavors: getVendorFlavors,\n cookiesEnabled: areCookiesEnabled,\n colorGamut: getColorGamut,\n invertedColors: areColorsInverted,\n forcedColors: areColorsForced,\n monochrome: getMonochromeDepth,\n contrast: getContrastPreference,\n reducedMotion: isMotionReduced,\n hdr: isHDR,\n math: getMathFingerprint\n};\n/**\n * Loads the built-in entropy sources.\n * Returns a function that collects the entropy components to make the visitor identifier.\n */\n\nfunction loadBuiltinSources(options) {\n return loadSources(sources, options, []);\n}\n\nvar commentTemplate = '$ if upgrade to Pro: https://fpjs.dev/pro';\n\nfunction getConfidence(components) {\n var openConfidenceScore = getOpenConfidenceScore(components);\n var proConfidenceScore = deriveProConfidenceScore(openConfidenceScore);\n return {\n score: openConfidenceScore,\n comment: commentTemplate.replace(/\\$/g, \"\" + proConfidenceScore)\n };\n}\n\nfunction getOpenConfidenceScore(components) {\n // In order to calculate the true probability of the visitor identifier being correct, we need to know the number of\n // website visitors (the higher the number, the less the probability because the fingerprint entropy is limited).\n // JS agent doesn't know the number of visitors, so we can only do an approximate assessment.\n if (isAndroid()) {\n return 0.4;\n } // Safari (mobile and desktop)\n\n\n if (isWebKit()) {\n return isDesktopSafari() ? 0.5 : 0.3;\n }\n\n var platform = components.platform.value || ''; // Windows\n\n if (/^Win/.test(platform)) {\n // The score is greater than on macOS because of the higher variety of devices running Windows.\n // Chrome provides more entropy than Firefox according too\n // https://netmarketshare.com/browser-market-share.aspx?options=%7B%22filter%22%3A%7B%22%24and%22%3A%5B%7B%22platform%22%3A%7B%22%24in%22%3A%5B%22Windows%22%5D%7D%7D%5D%7D%2C%22dateLabel%22%3A%22Trend%22%2C%22attributes%22%3A%22share%22%2C%22group%22%3A%22browser%22%2C%22sort%22%3A%7B%22share%22%3A-1%7D%2C%22id%22%3A%22browsersDesktop%22%2C%22dateInterval%22%3A%22Monthly%22%2C%22dateStart%22%3A%222019-11%22%2C%22dateEnd%22%3A%222020-10%22%2C%22segments%22%3A%22-1000%22%7D\n // So we assign the same score to them.\n return 0.6;\n } // macOS\n\n\n if (/^Mac/.test(platform)) {\n // Chrome provides more entropy than Safari and Safari provides more entropy than Firefox.\n // Chrome is more popular than Safari and Safari is more popular than Firefox according to\n // https://netmarketshare.com/browser-market-share.aspx?options=%7B%22filter%22%3A%7B%22%24and%22%3A%5B%7B%22platform%22%3A%7B%22%24in%22%3A%5B%22Mac%20OS%22%5D%7D%7D%5D%7D%2C%22dateLabel%22%3A%22Trend%22%2C%22attributes%22%3A%22share%22%2C%22group%22%3A%22browser%22%2C%22sort%22%3A%7B%22share%22%3A-1%7D%2C%22id%22%3A%22browsersDesktop%22%2C%22dateInterval%22%3A%22Monthly%22%2C%22dateStart%22%3A%222019-11%22%2C%22dateEnd%22%3A%222020-10%22%2C%22segments%22%3A%22-1000%22%7D\n // So we assign the same score to them.\n return 0.5;\n } // Another platform, e.g. a desktop Linux. It's rare, so it should be pretty unique.\n\n\n return 0.7;\n}\n\nfunction deriveProConfidenceScore(openConfidenceScore) {\n return round(0.99 + 0.01 * openConfidenceScore, 0.0001);\n}\n\nfunction componentsToCanonicalString(components) {\n var result = '';\n\n for (var _i = 0, _a = Object.keys(components).sort(); _i < _a.length; _i++) {\n var componentKey = _a[_i];\n var component = components[componentKey];\n var value = component.error ? 'error' : JSON.stringify(component.value);\n result += \"\" + (result ? '|' : '') + componentKey.replace(/([:|\\\\])/g, '\\\\$1') + \":\" + value;\n }\n\n return result;\n}\n\nfunction componentsToDebugString(components) {\n return JSON.stringify(components, function (_key, value) {\n if (value instanceof Error) {\n return errorToObject(value);\n }\n\n return value;\n }, 2);\n}\n\nfunction hashComponents(components) {\n return x64hash128(componentsToCanonicalString(components));\n}\n/**\n * Makes a GetResult implementation that calculates the visitor id hash on demand.\n * Designed for optimisation.\n */\n\n\nfunction makeLazyGetResult(components) {\n var visitorIdCache; // This function runs very fast, so there is no need to make it lazy\n\n var confidence = getConfidence(components); // A plain class isn't used because its getters and setters aren't enumerable.\n\n return {\n get visitorId() {\n if (visitorIdCache === undefined) {\n visitorIdCache = hashComponents(this.components);\n }\n\n return visitorIdCache;\n },\n\n set visitorId(visitorId) {\n visitorIdCache = visitorId;\n },\n\n confidence: confidence,\n components: components,\n version: version\n };\n}\n/**\n * A delay is required to ensure consistent entropy components.\n * See https://github.com/fingerprintjs/fingerprintjs/issues/254\n * and https://github.com/fingerprintjs/fingerprintjs/issues/307\n * and https://github.com/fingerprintjs/fingerprintjs/commit/945633e7c5f67ae38eb0fea37349712f0e669b18\n */\n\n\nfunction prepareForSources(delayFallback) {\n if (delayFallback === void 0) {\n delayFallback = 50;\n } // A proper deadline is unknown. Let it be twice the fallback timeout so that both cases have the same average time.\n\n\n return requestIdleCallbackIfAvailable(delayFallback, delayFallback * 2);\n}\n/**\n * The function isn't exported from the index file to not allow to call it without `load()`.\n * The hiding gives more freedom for future non-breaking updates.\n *\n * A factory function is used instead of a class to shorten the attribute names in the minified code.\n * Native private class fields could've been used, but TypeScript doesn't allow them with `\"target\": \"es5\"`.\n */\n\n\nfunction makeAgent(getComponents, debug) {\n var creationTime = Date.now();\n return {\n get: function (options) {\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__awaiter\"])(this, void 0, void 0, function () {\n var startTime, components, result;\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__generator\"])(this, function (_a) {\n switch (_a.label) {\n case 0:\n startTime = Date.now();\n return [4\n /*yield*/\n , getComponents()];\n\n case 1:\n components = _a.sent();\n result = makeLazyGetResult(components);\n\n if (debug || (options === null || options === void 0 ? void 0 : options.debug)) {\n // console.log is ok here because it's under a debug clause\n // eslint-disable-next-line no-console\n console.log(\"Copy the text below to get the debug data:\\n\\n```\\nversion: \" + result.version + \"\\nuserAgent: \" + navigator.userAgent + \"\\ntimeBetweenLoadAndGet: \" + (startTime - creationTime) + \"\\nvisitorId: \" + result.visitorId + \"\\ncomponents: \" + componentsToDebugString(components) + \"\\n```\");\n }\n\n return [2\n /*return*/\n , result];\n }\n });\n });\n }\n };\n}\n/**\n * Sends an unpersonalized AJAX request to collect installation statistics\n */\n\n\nfunction monitor() {\n // The FingerprintJS CDN (https://github.com/fingerprintjs/cdn) replaces `window.__fpjs_d_m` with `true`\n if (window.__fpjs_d_m || Math.random() >= 0.001) {\n return;\n }\n\n try {\n var request = new XMLHttpRequest();\n request.open('get', \"https://m1.openfpcdn.io/fingerprintjs/v\" + version + \"/npm-monitoring\", true);\n request.send();\n } catch (error) {\n // console.error is ok here because it's an unexpected error handler\n // eslint-disable-next-line no-console\n console.error(error);\n }\n}\n/**\n * Builds an instance of Agent and waits a delay required for a proper operation.\n */\n\n\nfunction load(_a) {\n var _b = _a === void 0 ? {} : _a,\n delayFallback = _b.delayFallback,\n debug = _b.debug,\n _c = _b.monitoring,\n monitoring = _c === void 0 ? true : _c;\n\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__awaiter\"])(this, void 0, void 0, function () {\n var getComponents;\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__generator\"])(this, function (_d) {\n switch (_d.label) {\n case 0:\n if (monitoring) {\n monitor();\n }\n\n return [4\n /*yield*/\n , prepareForSources(delayFallback)];\n\n case 1:\n _d.sent();\n\n getComponents = loadBuiltinSources({\n debug: debug\n });\n return [2\n /*return*/\n , makeAgent(getComponents, debug)];\n }\n });\n });\n} // The default export is a syntax sugar (`import * as FP from '...' → import FP from '...'`).\n// It should contain all the public exported values.\n\n\nvar index = {\n load: load,\n hashComponents: hashComponents,\n componentsToDebugString: componentsToDebugString\n}; // The exports below are for private usage. They may change unexpectedly. Use them at your own risk.\n\n/** Not documented, out of Semantic Versioning, usage is at your own risk */\n\nvar murmurX64Hash128 = x64hash128;\n\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/@fingerprintjs/fingerprintjs/dist/fp.esm.js?");
|
|
772
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"componentsToDebugString\", function() { return componentsToDebugString; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return index; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getFullscreenElement\", function() { return getFullscreenElement; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getScreenFrame\", function() { return getScreenFrame; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"hashComponents\", function() { return hashComponents; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isAndroid\", function() { return isAndroid; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isChromium\", function() { return isChromium; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isDesktopSafari\", function() { return isDesktopSafari; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isEdgeHTML\", function() { return isEdgeHTML; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isGecko\", function() { return isGecko; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isTrident\", function() { return isTrident; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isWebKit\", function() { return isWebKit; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"load\", function() { return load; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"loadSources\", function() { return loadSources; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"murmurX64Hash128\", function() { return murmurX64Hash128; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"prepareForSources\", function() { return prepareForSources; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"sources\", function() { return sources; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"transformSource\", function() { return transformSource; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.js\");\n/**\n * FingerprintJS v3.3.6 - Copyright (c) FingerprintJS, Inc, 2022 (https://fingerprint.com)\n * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.\n *\n * This software contains code from open-source projects:\n * MurmurHash3 by Karan Lyons (https://github.com/karanlyons/murmurHash3.js)\n */\n\nvar version = \"3.3.6\";\n\nfunction wait(durationMs, resolveWith) {\n return new Promise(function (resolve) {\n return setTimeout(resolve, durationMs, resolveWith);\n });\n}\n\nfunction requestIdleCallbackIfAvailable(fallbackTimeout, deadlineTimeout) {\n if (deadlineTimeout === void 0) {\n deadlineTimeout = Infinity;\n }\n\n var requestIdleCallback = window.requestIdleCallback;\n\n if (requestIdleCallback) {\n // The function `requestIdleCallback` loses the binding to `window` here.\n // `globalThis` isn't always equal `window` (see https://github.com/fingerprintjs/fingerprintjs/issues/683).\n // Therefore, an error can occur. `call(window,` prevents the error.\n return new Promise(function (resolve) {\n return requestIdleCallback.call(window, function () {\n return resolve();\n }, {\n timeout: deadlineTimeout\n });\n });\n } else {\n return wait(Math.min(fallbackTimeout, deadlineTimeout));\n }\n}\n\nfunction isPromise(value) {\n return value && typeof value.then === 'function';\n}\n/**\n * Calls a maybe asynchronous function without creating microtasks when the function is synchronous.\n * Catches errors in both cases.\n *\n * If just you run a code like this:\n * ```\n * console.time('Action duration')\n * await action()\n * console.timeEnd('Action duration')\n * ```\n * The synchronous function time can be measured incorrectly because another microtask may run before the `await`\n * returns the control back to the code.\n */\n\n\nfunction awaitIfAsync(action, callback) {\n try {\n var returnedValue = action();\n\n if (isPromise(returnedValue)) {\n returnedValue.then(function (result) {\n return callback(true, result);\n }, function (error) {\n return callback(false, error);\n });\n } else {\n callback(true, returnedValue);\n }\n } catch (error) {\n callback(false, error);\n }\n}\n/**\n * If you run many synchronous tasks without using this function, the JS main loop will be busy and asynchronous tasks\n * (e.g. completing a network request, rendering the page) won't be able to happen.\n * This function allows running many synchronous tasks such way that asynchronous tasks can run too in background.\n */\n\n\nfunction forEachWithBreaks(items, callback, loopReleaseInterval) {\n if (loopReleaseInterval === void 0) {\n loopReleaseInterval = 16;\n }\n\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__awaiter\"])(this, void 0, void 0, function () {\n var lastLoopReleaseTime, i, now;\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__generator\"])(this, function (_a) {\n switch (_a.label) {\n case 0:\n lastLoopReleaseTime = Date.now();\n i = 0;\n _a.label = 1;\n\n case 1:\n if (!(i < items.length)) return [3\n /*break*/\n , 4];\n callback(items[i], i);\n now = Date.now();\n if (!(now >= lastLoopReleaseTime + loopReleaseInterval)) return [3\n /*break*/\n , 3];\n lastLoopReleaseTime = now; // Allows asynchronous actions and microtasks to happen\n\n return [4\n /*yield*/\n , wait(0)];\n\n case 2:\n // Allows asynchronous actions and microtasks to happen\n _a.sent();\n\n _a.label = 3;\n\n case 3:\n ++i;\n return [3\n /*break*/\n , 1];\n\n case 4:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\n * Makes the given promise never emit an unhandled promise rejection console warning.\n * The promise will still pass errors to the next promises.\n *\n * Otherwise, promise emits a console warning unless it has a `catch` listener.\n */\n\n\nfunction suppressUnhandledRejectionWarning(promise) {\n promise.then(undefined, function () {\n return undefined;\n });\n}\n/*\n * Taken from https://github.com/karanlyons/murmurHash3.js/blob/a33d0723127e2e5415056c455f8aed2451ace208/murmurHash3.js\n */\n//\n// Given two 64bit ints (as an array of two 32bit ints) returns the two\n// added together as a 64bit int (as an array of two 32bit ints).\n//\n\n\nfunction x64Add(m, n) {\n m = [m[0] >>> 16, m[0] & 0xffff, m[1] >>> 16, m[1] & 0xffff];\n n = [n[0] >>> 16, n[0] & 0xffff, n[1] >>> 16, n[1] & 0xffff];\n var o = [0, 0, 0, 0];\n o[3] += m[3] + n[3];\n o[2] += o[3] >>> 16;\n o[3] &= 0xffff;\n o[2] += m[2] + n[2];\n o[1] += o[2] >>> 16;\n o[2] &= 0xffff;\n o[1] += m[1] + n[1];\n o[0] += o[1] >>> 16;\n o[1] &= 0xffff;\n o[0] += m[0] + n[0];\n o[0] &= 0xffff;\n return [o[0] << 16 | o[1], o[2] << 16 | o[3]];\n} //\n// Given two 64bit ints (as an array of two 32bit ints) returns the two\n// multiplied together as a 64bit int (as an array of two 32bit ints).\n//\n\n\nfunction x64Multiply(m, n) {\n m = [m[0] >>> 16, m[0] & 0xffff, m[1] >>> 16, m[1] & 0xffff];\n n = [n[0] >>> 16, n[0] & 0xffff, n[1] >>> 16, n[1] & 0xffff];\n var o = [0, 0, 0, 0];\n o[3] += m[3] * n[3];\n o[2] += o[3] >>> 16;\n o[3] &= 0xffff;\n o[2] += m[2] * n[3];\n o[1] += o[2] >>> 16;\n o[2] &= 0xffff;\n o[2] += m[3] * n[2];\n o[1] += o[2] >>> 16;\n o[2] &= 0xffff;\n o[1] += m[1] * n[3];\n o[0] += o[1] >>> 16;\n o[1] &= 0xffff;\n o[1] += m[2] * n[2];\n o[0] += o[1] >>> 16;\n o[1] &= 0xffff;\n o[1] += m[3] * n[1];\n o[0] += o[1] >>> 16;\n o[1] &= 0xffff;\n o[0] += m[0] * n[3] + m[1] * n[2] + m[2] * n[1] + m[3] * n[0];\n o[0] &= 0xffff;\n return [o[0] << 16 | o[1], o[2] << 16 | o[3]];\n} //\n// Given a 64bit int (as an array of two 32bit ints) and an int\n// representing a number of bit positions, returns the 64bit int (as an\n// array of two 32bit ints) rotated left by that number of positions.\n//\n\n\nfunction x64Rotl(m, n) {\n n %= 64;\n\n if (n === 32) {\n return [m[1], m[0]];\n } else if (n < 32) {\n return [m[0] << n | m[1] >>> 32 - n, m[1] << n | m[0] >>> 32 - n];\n } else {\n n -= 32;\n return [m[1] << n | m[0] >>> 32 - n, m[0] << n | m[1] >>> 32 - n];\n }\n} //\n// Given a 64bit int (as an array of two 32bit ints) and an int\n// representing a number of bit positions, returns the 64bit int (as an\n// array of two 32bit ints) shifted left by that number of positions.\n//\n\n\nfunction x64LeftShift(m, n) {\n n %= 64;\n\n if (n === 0) {\n return m;\n } else if (n < 32) {\n return [m[0] << n | m[1] >>> 32 - n, m[1] << n];\n } else {\n return [m[1] << n - 32, 0];\n }\n} //\n// Given two 64bit ints (as an array of two 32bit ints) returns the two\n// xored together as a 64bit int (as an array of two 32bit ints).\n//\n\n\nfunction x64Xor(m, n) {\n return [m[0] ^ n[0], m[1] ^ n[1]];\n} //\n// Given a block, returns murmurHash3's final x64 mix of that block.\n// (`[0, h[0] >>> 1]` is a 33 bit unsigned right shift. This is the\n// only place where we need to right shift 64bit ints.)\n//\n\n\nfunction x64Fmix(h) {\n h = x64Xor(h, [0, h[0] >>> 1]);\n h = x64Multiply(h, [0xff51afd7, 0xed558ccd]);\n h = x64Xor(h, [0, h[0] >>> 1]);\n h = x64Multiply(h, [0xc4ceb9fe, 0x1a85ec53]);\n h = x64Xor(h, [0, h[0] >>> 1]);\n return h;\n} //\n// Given a string and an optional seed as an int, returns a 128 bit\n// hash using the x64 flavor of MurmurHash3, as an unsigned hex.\n//\n\n\nfunction x64hash128(key, seed) {\n key = key || '';\n seed = seed || 0;\n var remainder = key.length % 16;\n var bytes = key.length - remainder;\n var h1 = [0, seed];\n var h2 = [0, seed];\n var k1 = [0, 0];\n var k2 = [0, 0];\n var c1 = [0x87c37b91, 0x114253d5];\n var c2 = [0x4cf5ad43, 0x2745937f];\n var i;\n\n for (i = 0; i < bytes; i = i + 16) {\n k1 = [key.charCodeAt(i + 4) & 0xff | (key.charCodeAt(i + 5) & 0xff) << 8 | (key.charCodeAt(i + 6) & 0xff) << 16 | (key.charCodeAt(i + 7) & 0xff) << 24, key.charCodeAt(i) & 0xff | (key.charCodeAt(i + 1) & 0xff) << 8 | (key.charCodeAt(i + 2) & 0xff) << 16 | (key.charCodeAt(i + 3) & 0xff) << 24];\n k2 = [key.charCodeAt(i + 12) & 0xff | (key.charCodeAt(i + 13) & 0xff) << 8 | (key.charCodeAt(i + 14) & 0xff) << 16 | (key.charCodeAt(i + 15) & 0xff) << 24, key.charCodeAt(i + 8) & 0xff | (key.charCodeAt(i + 9) & 0xff) << 8 | (key.charCodeAt(i + 10) & 0xff) << 16 | (key.charCodeAt(i + 11) & 0xff) << 24];\n k1 = x64Multiply(k1, c1);\n k1 = x64Rotl(k1, 31);\n k1 = x64Multiply(k1, c2);\n h1 = x64Xor(h1, k1);\n h1 = x64Rotl(h1, 27);\n h1 = x64Add(h1, h2);\n h1 = x64Add(x64Multiply(h1, [0, 5]), [0, 0x52dce729]);\n k2 = x64Multiply(k2, c2);\n k2 = x64Rotl(k2, 33);\n k2 = x64Multiply(k2, c1);\n h2 = x64Xor(h2, k2);\n h2 = x64Rotl(h2, 31);\n h2 = x64Add(h2, h1);\n h2 = x64Add(x64Multiply(h2, [0, 5]), [0, 0x38495ab5]);\n }\n\n k1 = [0, 0];\n k2 = [0, 0];\n\n switch (remainder) {\n case 15:\n k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 14)], 48));\n // fallthrough\n\n case 14:\n k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 13)], 40));\n // fallthrough\n\n case 13:\n k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 12)], 32));\n // fallthrough\n\n case 12:\n k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 11)], 24));\n // fallthrough\n\n case 11:\n k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 10)], 16));\n // fallthrough\n\n case 10:\n k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 9)], 8));\n // fallthrough\n\n case 9:\n k2 = x64Xor(k2, [0, key.charCodeAt(i + 8)]);\n k2 = x64Multiply(k2, c2);\n k2 = x64Rotl(k2, 33);\n k2 = x64Multiply(k2, c1);\n h2 = x64Xor(h2, k2);\n // fallthrough\n\n case 8:\n k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 7)], 56));\n // fallthrough\n\n case 7:\n k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 6)], 48));\n // fallthrough\n\n case 6:\n k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 5)], 40));\n // fallthrough\n\n case 5:\n k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 4)], 32));\n // fallthrough\n\n case 4:\n k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 3)], 24));\n // fallthrough\n\n case 3:\n k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 2)], 16));\n // fallthrough\n\n case 2:\n k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 1)], 8));\n // fallthrough\n\n case 1:\n k1 = x64Xor(k1, [0, key.charCodeAt(i)]);\n k1 = x64Multiply(k1, c1);\n k1 = x64Rotl(k1, 31);\n k1 = x64Multiply(k1, c2);\n h1 = x64Xor(h1, k1);\n // fallthrough\n }\n\n h1 = x64Xor(h1, [0, key.length]);\n h2 = x64Xor(h2, [0, key.length]);\n h1 = x64Add(h1, h2);\n h2 = x64Add(h2, h1);\n h1 = x64Fmix(h1);\n h2 = x64Fmix(h2);\n h1 = x64Add(h1, h2);\n h2 = x64Add(h2, h1);\n return ('00000000' + (h1[0] >>> 0).toString(16)).slice(-8) + ('00000000' + (h1[1] >>> 0).toString(16)).slice(-8) + ('00000000' + (h2[0] >>> 0).toString(16)).slice(-8) + ('00000000' + (h2[1] >>> 0).toString(16)).slice(-8);\n}\n/**\n * Converts an error object to a plain object that can be used with `JSON.stringify`.\n * If you just run `JSON.stringify(error)`, you'll get `'{}'`.\n */\n\n\nfunction errorToObject(error) {\n var _a;\n\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"])({\n name: error.name,\n message: error.message,\n stack: (_a = error.stack) === null || _a === void 0 ? void 0 : _a.split('\\n')\n }, error);\n}\n/*\n * This file contains functions to work with pure data only (no browser features, DOM, side effects, etc).\n */\n\n/**\n * Does the same as Array.prototype.includes but has better typing\n */\n\n\nfunction includes(haystack, needle) {\n for (var i = 0, l = haystack.length; i < l; ++i) {\n if (haystack[i] === needle) {\n return true;\n }\n }\n\n return false;\n}\n/**\n * Like `!includes()` but with proper typing\n */\n\n\nfunction excludes(haystack, needle) {\n return !includes(haystack, needle);\n}\n/**\n * Be careful, NaN can return\n */\n\n\nfunction toInt(value) {\n return parseInt(value);\n}\n/**\n * Be careful, NaN can return\n */\n\n\nfunction toFloat(value) {\n return parseFloat(value);\n}\n\nfunction replaceNaN(value, replacement) {\n return typeof value === 'number' && isNaN(value) ? replacement : value;\n}\n\nfunction countTruthy(values) {\n return values.reduce(function (sum, value) {\n return sum + (value ? 1 : 0);\n }, 0);\n}\n\nfunction round(value, base) {\n if (base === void 0) {\n base = 1;\n }\n\n if (Math.abs(base) >= 1) {\n return Math.round(value / base) * base;\n } else {\n // Sometimes when a number is multiplied by a small number, precision is lost,\n // for example 1234 * 0.0001 === 0.12340000000000001, and it's more precise divide: 1234 / (1 / 0.0001) === 0.1234.\n var counterBase = 1 / base;\n return Math.round(value * counterBase) / counterBase;\n }\n}\n/**\n * Parses a CSS selector into tag name with HTML attributes.\n * Only single element selector are supported (without operators like space, +, >, etc).\n *\n * Multiple values can be returned for each attribute. You decide how to handle them.\n */\n\n\nfunction parseSimpleCssSelector(selector) {\n var _a, _b;\n\n var errorMessage = \"Unexpected syntax '\" + selector + \"'\";\n var tagMatch = /^\\s*([a-z-]*)(.*)$/i.exec(selector);\n var tag = tagMatch[1] || undefined;\n var attributes = {};\n var partsRegex = /([.:#][\\w-]+|\\[.+?\\])/gi;\n\n var addAttribute = function (name, value) {\n attributes[name] = attributes[name] || [];\n attributes[name].push(value);\n };\n\n for (;;) {\n var match = partsRegex.exec(tagMatch[2]);\n\n if (!match) {\n break;\n }\n\n var part = match[0];\n\n switch (part[0]) {\n case '.':\n addAttribute('class', part.slice(1));\n break;\n\n case '#':\n addAttribute('id', part.slice(1));\n break;\n\n case '[':\n {\n var attributeMatch = /^\\[([\\w-]+)([~|^$*]?=(\"(.*?)\"|([\\w-]+)))?(\\s+[is])?\\]$/.exec(part);\n\n if (attributeMatch) {\n addAttribute(attributeMatch[1], (_b = (_a = attributeMatch[4]) !== null && _a !== void 0 ? _a : attributeMatch[5]) !== null && _b !== void 0 ? _b : '');\n } else {\n throw new Error(errorMessage);\n }\n\n break;\n }\n\n default:\n throw new Error(errorMessage);\n }\n }\n\n return [tag, attributes];\n}\n\nfunction ensureErrorWithMessage(error) {\n return error && typeof error === 'object' && 'message' in error ? error : {\n message: error\n };\n}\n\nfunction isFinalResultLoaded(loadResult) {\n return typeof loadResult !== 'function';\n}\n/**\n * Loads the given entropy source. Returns a function that gets an entropy component from the source.\n *\n * The result is returned synchronously to prevent `loadSources` from\n * waiting for one source to load before getting the components from the other sources.\n */\n\n\nfunction loadSource(source, sourceOptions) {\n var sourceLoadPromise = new Promise(function (resolveLoad) {\n var loadStartTime = Date.now(); // `awaitIfAsync` is used instead of just `await` in order to measure the duration of synchronous sources\n // correctly (other microtasks won't affect the duration).\n\n awaitIfAsync(source.bind(null, sourceOptions), function () {\n var loadArgs = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n loadArgs[_i] = arguments[_i];\n }\n\n var loadDuration = Date.now() - loadStartTime; // Source loading failed\n\n if (!loadArgs[0]) {\n return resolveLoad(function () {\n return {\n error: ensureErrorWithMessage(loadArgs[1]),\n duration: loadDuration\n };\n });\n }\n\n var loadResult = loadArgs[1]; // Source loaded with the final result\n\n if (isFinalResultLoaded(loadResult)) {\n return resolveLoad(function () {\n return {\n value: loadResult,\n duration: loadDuration\n };\n });\n } // Source loaded with \"get\" stage\n\n\n resolveLoad(function () {\n return new Promise(function (resolveGet) {\n var getStartTime = Date.now();\n awaitIfAsync(loadResult, function () {\n var getArgs = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n getArgs[_i] = arguments[_i];\n }\n\n var duration = loadDuration + Date.now() - getStartTime; // Source getting failed\n\n if (!getArgs[0]) {\n return resolveGet({\n error: ensureErrorWithMessage(getArgs[1]),\n duration: duration\n });\n } // Source getting succeeded\n\n\n resolveGet({\n value: getArgs[1],\n duration: duration\n });\n });\n });\n });\n });\n });\n suppressUnhandledRejectionWarning(sourceLoadPromise);\n return function getComponent() {\n return sourceLoadPromise.then(function (finalizeSource) {\n return finalizeSource();\n });\n };\n}\n/**\n * Loads the given entropy sources. Returns a function that collects the entropy components.\n *\n * The result is returned synchronously in order to allow start getting the components\n * before the sources are loaded completely.\n *\n * Warning for package users:\n * This function is out of Semantic Versioning, i.e. can change unexpectedly. Usage is at your own risk.\n */\n\n\nfunction loadSources(sources, sourceOptions, excludeSources) {\n var includedSources = Object.keys(sources).filter(function (sourceKey) {\n return excludes(excludeSources, sourceKey);\n });\n var sourceGetters = Array(includedSources.length); // Using `forEachWithBreaks` allows asynchronous sources to complete between synchronous sources\n // and measure the duration correctly\n\n forEachWithBreaks(includedSources, function (sourceKey, index) {\n sourceGetters[index] = loadSource(sources[sourceKey], sourceOptions);\n });\n return function getComponents() {\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__awaiter\"])(this, void 0, void 0, function () {\n var components, _i, includedSources_1, sourceKey, componentPromises, _loop_1, state_1;\n\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__generator\"])(this, function (_a) {\n switch (_a.label) {\n case 0:\n components = {};\n\n for (_i = 0, includedSources_1 = includedSources; _i < includedSources_1.length; _i++) {\n sourceKey = includedSources_1[_i];\n components[sourceKey] = undefined;\n }\n\n componentPromises = Array(includedSources.length);\n\n _loop_1 = function () {\n var hasAllComponentPromises;\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__generator\"])(this, function (_a) {\n switch (_a.label) {\n case 0:\n hasAllComponentPromises = true;\n return [4\n /*yield*/\n , forEachWithBreaks(includedSources, function (sourceKey, index) {\n if (!componentPromises[index]) {\n // `sourceGetters` may be incomplete at this point of execution because `forEachWithBreaks` is asynchronous\n if (sourceGetters[index]) {\n var componentPromise = sourceGetters[index]().then(function (component) {\n return components[sourceKey] = component;\n });\n suppressUnhandledRejectionWarning(componentPromise);\n componentPromises[index] = componentPromise;\n } else {\n hasAllComponentPromises = false;\n }\n }\n })];\n\n case 1:\n _a.sent();\n\n if (hasAllComponentPromises) {\n return [2\n /*return*/\n , \"break\"];\n }\n\n return [4\n /*yield*/\n , wait(1)];\n // Lets the source load loop continue\n\n case 2:\n _a.sent(); // Lets the source load loop continue\n\n\n return [2\n /*return*/\n ];\n }\n });\n };\n\n _a.label = 1;\n\n case 1:\n return [5\n /*yield**/\n , _loop_1()];\n\n case 2:\n state_1 = _a.sent();\n if (state_1 === \"break\") return [3\n /*break*/\n , 4];\n _a.label = 3;\n\n case 3:\n return [3\n /*break*/\n , 1];\n\n case 4:\n return [4\n /*yield*/\n , Promise.all(componentPromises)];\n\n case 5:\n _a.sent();\n\n return [2\n /*return*/\n , components];\n }\n });\n });\n };\n}\n/**\n * Modifies an entropy source by transforming its returned value with the given function.\n * Keeps the source properties: sync/async, 1/2 stages.\n *\n * Warning for package users:\n * This function is out of Semantic Versioning, i.e. can change unexpectedly. Usage is at your own risk.\n */\n\n\nfunction transformSource(source, transformValue) {\n var transformLoadResult = function (loadResult) {\n if (isFinalResultLoaded(loadResult)) {\n return transformValue(loadResult);\n }\n\n return function () {\n var getResult = loadResult();\n\n if (isPromise(getResult)) {\n return getResult.then(transformValue);\n }\n\n return transformValue(getResult);\n };\n };\n\n return function (options) {\n var loadResult = source(options);\n\n if (isPromise(loadResult)) {\n return loadResult.then(transformLoadResult);\n }\n\n return transformLoadResult(loadResult);\n };\n}\n/*\n * Functions to help with features that vary through browsers\n */\n\n/**\n * Checks whether the browser is based on Trident (the Internet Explorer engine) without using user-agent.\n *\n * Warning for package users:\n * This function is out of Semantic Versioning, i.e. can change unexpectedly. Usage is at your own risk.\n */\n\n\nfunction isTrident() {\n var w = window;\n var n = navigator; // The properties are checked to be in IE 10, IE 11 and not to be in other browsers in October 2020\n\n return countTruthy(['MSCSSMatrix' in w, 'msSetImmediate' in w, 'msIndexedDB' in w, 'msMaxTouchPoints' in n, 'msPointerEnabled' in n]) >= 4;\n}\n/**\n * Checks whether the browser is based on EdgeHTML (the pre-Chromium Edge engine) without using user-agent.\n *\n * Warning for package users:\n * This function is out of Semantic Versioning, i.e. can change unexpectedly. Usage is at your own risk.\n */\n\n\nfunction isEdgeHTML() {\n // Based on research in October 2020\n var w = window;\n var n = navigator;\n return countTruthy(['msWriteProfilerMark' in w, 'MSStream' in w, 'msLaunchUri' in n, 'msSaveBlob' in n]) >= 3 && !isTrident();\n}\n/**\n * Checks whether the browser is based on Chromium without using user-agent.\n *\n * Warning for package users:\n * This function is out of Semantic Versioning, i.e. can change unexpectedly. Usage is at your own risk.\n */\n\n\nfunction isChromium() {\n // Based on research in October 2020. Tested to detect Chromium 42-86.\n var w = window;\n var n = navigator;\n return countTruthy(['webkitPersistentStorage' in n, 'webkitTemporaryStorage' in n, n.vendor.indexOf('Google') === 0, 'webkitResolveLocalFileSystemURL' in w, 'BatteryManager' in w, 'webkitMediaStream' in w, 'webkitSpeechGrammar' in w]) >= 5;\n}\n/**\n * Checks whether the browser is based on mobile or desktop Safari without using user-agent.\n * All iOS browsers use WebKit (the Safari engine).\n *\n * Warning for package users:\n * This function is out of Semantic Versioning, i.e. can change unexpectedly. Usage is at your own risk.\n */\n\n\nfunction isWebKit() {\n // Based on research in September 2020\n var w = window;\n var n = navigator;\n return countTruthy(['ApplePayError' in w, 'CSSPrimitiveValue' in w, 'Counter' in w, n.vendor.indexOf('Apple') === 0, 'getStorageUpdates' in n, 'WebKitMediaKeys' in w]) >= 4;\n}\n/**\n * Checks whether the WebKit browser is a desktop Safari.\n *\n * Warning for package users:\n * This function is out of Semantic Versioning, i.e. can change unexpectedly. Usage is at your own risk.\n */\n\n\nfunction isDesktopSafari() {\n var w = window;\n return countTruthy(['safari' in w, !('DeviceMotionEvent' in w), !('ongestureend' in w), !('standalone' in navigator)]) >= 3;\n}\n/**\n * Checks whether the browser is based on Gecko (Firefox engine) without using user-agent.\n *\n * Warning for package users:\n * This function is out of Semantic Versioning, i.e. can change unexpectedly. Usage is at your own risk.\n */\n\n\nfunction isGecko() {\n var _a, _b;\n\n var w = window; // Based on research in September 2020\n\n return countTruthy(['buildID' in navigator, 'MozAppearance' in ((_b = (_a = document.documentElement) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : {}), 'onmozfullscreenchange' in w, 'mozInnerScreenX' in w, 'CSSMozDocumentRule' in w, 'CanvasCaptureMediaStream' in w]) >= 4;\n}\n/**\n * Checks whether the browser is based on Chromium version ≥86 without using user-agent.\n * It doesn't check that the browser is based on Chromium, there is a separate function for this.\n */\n\n\nfunction isChromium86OrNewer() {\n // Checked in Chrome 85 vs Chrome 86 both on desktop and Android\n var w = window;\n return countTruthy([!('MediaSettingsRange' in w), 'RTCEncodedAudioFrame' in w, '' + w.Intl === '[object Intl]', '' + w.Reflect === '[object Reflect]']) >= 3;\n}\n/**\n * Checks whether the browser is based on WebKit version ≥606 (Safari ≥12) without using user-agent.\n * It doesn't check that the browser is based on WebKit, there is a separate function for this.\n *\n * @link https://en.wikipedia.org/wiki/Safari_version_history#Release_history Safari-WebKit versions map\n */\n\n\nfunction isWebKit606OrNewer() {\n // Checked in Safari 9–14\n var w = window;\n return countTruthy(['DOMRectList' in w, 'RTCPeerConnectionIceEvent' in w, 'SVGGeometryElement' in w, 'ontransitioncancel' in w]) >= 3;\n}\n/**\n * Checks whether the device is an iPad.\n * It doesn't check that the engine is WebKit and that the WebKit isn't desktop.\n */\n\n\nfunction isIPad() {\n // Checked on:\n // Safari on iPadOS (both mobile and desktop modes): 8, 11, 12, 13, 14\n // Chrome on iPadOS (both mobile and desktop modes): 11, 12, 13, 14\n // Safari on iOS (both mobile and desktop modes): 9, 10, 11, 12, 13, 14\n // Chrome on iOS (both mobile and desktop modes): 9, 10, 11, 12, 13, 14\n // Before iOS 13. Safari tampers the value in \"request desktop site\" mode since iOS 13.\n if (navigator.platform === 'iPad') {\n return true;\n }\n\n var s = screen;\n var screenRatio = s.width / s.height;\n return countTruthy(['MediaSource' in window, !!Element.prototype.webkitRequestFullscreen, // iPhone 4S that runs iOS 9 matches this. But it won't match the criteria above, so it won't be detected as iPad.\n screenRatio > 0.65 && screenRatio < 1.53]) >= 2;\n}\n/**\n * Warning for package users:\n * This function is out of Semantic Versioning, i.e. can change unexpectedly. Usage is at your own risk.\n */\n\n\nfunction getFullscreenElement() {\n var d = document;\n return d.fullscreenElement || d.msFullscreenElement || d.mozFullScreenElement || d.webkitFullscreenElement || null;\n}\n\nfunction exitFullscreen() {\n var d = document; // `call` is required because the function throws an error without a proper \"this\" context\n\n return (d.exitFullscreen || d.msExitFullscreen || d.mozCancelFullScreen || d.webkitExitFullscreen).call(d);\n}\n/**\n * Checks whether the device runs on Android without using user-agent.\n *\n * Warning for package users:\n * This function is out of Semantic Versioning, i.e. can change unexpectedly. Usage is at your own risk.\n */\n\n\nfunction isAndroid() {\n var isItChromium = isChromium();\n var isItGecko = isGecko(); // Only 2 browser engines are presented on Android.\n // Actually, there is also Android 4.1 browser, but it's not worth detecting it at the moment.\n\n if (!isItChromium && !isItGecko) {\n return false;\n }\n\n var w = window; // Chrome removes all words \"Android\" from `navigator` when desktop version is requested\n // Firefox keeps \"Android\" in `navigator.appVersion` when desktop version is requested\n\n return countTruthy(['onorientationchange' in w, 'orientation' in w, isItChromium && !('SharedWorker' in w), isItGecko && /android/i.test(navigator.appVersion)]) >= 2;\n}\n/**\n * A deep description: https://fingerprint.com/blog/audio-fingerprinting/\n * Inspired by and based on https://github.com/cozylife/audio-fingerprint\n */\n\n\nfunction getAudioFingerprint() {\n var w = window;\n var AudioContext = w.OfflineAudioContext || w.webkitOfflineAudioContext;\n\n if (!AudioContext) {\n return -2\n /* NotSupported */\n ;\n } // In some browsers, audio context always stays suspended unless the context is started in response to a user action\n // (e.g. a click or a tap). It prevents audio fingerprint from being taken at an arbitrary moment of time.\n // Such browsers are old and unpopular, so the audio fingerprinting is just skipped in them.\n // See a similar case explanation at https://stackoverflow.com/questions/46363048/onaudioprocess-not-called-on-ios11#46534088\n\n\n if (doesCurrentBrowserSuspendAudioContext()) {\n return -1\n /* KnownToSuspend */\n ;\n }\n\n var hashFromIndex = 4500;\n var hashToIndex = 5000;\n var context = new AudioContext(1, hashToIndex, 44100);\n var oscillator = context.createOscillator();\n oscillator.type = 'triangle';\n oscillator.frequency.value = 10000;\n var compressor = context.createDynamicsCompressor();\n compressor.threshold.value = -50;\n compressor.knee.value = 40;\n compressor.ratio.value = 12;\n compressor.attack.value = 0;\n compressor.release.value = 0.25;\n oscillator.connect(compressor);\n compressor.connect(context.destination);\n oscillator.start(0);\n\n var _a = startRenderingAudio(context),\n renderPromise = _a[0],\n finishRendering = _a[1];\n\n var fingerprintPromise = renderPromise.then(function (buffer) {\n return getHash(buffer.getChannelData(0).subarray(hashFromIndex));\n }, function (error) {\n if (error.name === \"timeout\"\n /* Timeout */\n || error.name === \"suspended\"\n /* Suspended */\n ) {\n return -3\n /* Timeout */\n ;\n }\n\n throw error;\n }); // Suppresses the console error message in case when the fingerprint fails before requested\n\n suppressUnhandledRejectionWarning(fingerprintPromise);\n return function () {\n finishRendering();\n return fingerprintPromise;\n };\n}\n/**\n * Checks if the current browser is known to always suspend audio context\n */\n\n\nfunction doesCurrentBrowserSuspendAudioContext() {\n return isWebKit() && !isDesktopSafari() && !isWebKit606OrNewer();\n}\n/**\n * Starts rendering the audio context.\n * When the returned function is called, the render process starts finishing.\n */\n\n\nfunction startRenderingAudio(context) {\n var renderTryMaxCount = 3;\n var renderRetryDelay = 500;\n var runningMaxAwaitTime = 500;\n var runningSufficientTime = 5000;\n\n var finalize = function () {\n return undefined;\n };\n\n var resultPromise = new Promise(function (resolve, reject) {\n var isFinalized = false;\n var renderTryCount = 0;\n var startedRunningAt = 0;\n\n context.oncomplete = function (event) {\n return resolve(event.renderedBuffer);\n };\n\n var startRunningTimeout = function () {\n setTimeout(function () {\n return reject(makeInnerError(\"timeout\"\n /* Timeout */\n ));\n }, Math.min(runningMaxAwaitTime, startedRunningAt + runningSufficientTime - Date.now()));\n };\n\n var tryRender = function () {\n try {\n context.startRendering();\n\n switch (context.state) {\n case 'running':\n startedRunningAt = Date.now();\n\n if (isFinalized) {\n startRunningTimeout();\n }\n\n break;\n // Sometimes the audio context doesn't start after calling `startRendering` (in addition to the cases where\n // audio context doesn't start at all). A known case is starting an audio context when the browser tab is in\n // background on iPhone. Retries usually help in this case.\n\n case 'suspended':\n // The audio context can reject starting until the tab is in foreground. Long fingerprint duration\n // in background isn't a problem, therefore the retry attempts don't count in background. It can lead to\n // a situation when a fingerprint takes very long time and finishes successfully. FYI, the audio context\n // can be suspended when `document.hidden === false` and start running after a retry.\n if (!document.hidden) {\n renderTryCount++;\n }\n\n if (isFinalized && renderTryCount >= renderTryMaxCount) {\n reject(makeInnerError(\"suspended\"\n /* Suspended */\n ));\n } else {\n setTimeout(tryRender, renderRetryDelay);\n }\n\n break;\n }\n } catch (error) {\n reject(error);\n }\n };\n\n tryRender();\n\n finalize = function () {\n if (!isFinalized) {\n isFinalized = true;\n\n if (startedRunningAt > 0) {\n startRunningTimeout();\n }\n }\n };\n });\n return [resultPromise, finalize];\n}\n\nfunction getHash(signal) {\n var hash = 0;\n\n for (var i = 0; i < signal.length; ++i) {\n hash += Math.abs(signal[i]);\n }\n\n return hash;\n}\n\nfunction makeInnerError(name) {\n var error = new Error(name);\n error.name = name;\n return error;\n}\n/**\n * Creates and keeps an invisible iframe while the given function runs.\n * The given function is called when the iframe is loaded and has a body.\n * The iframe allows to measure DOM sizes inside itself.\n *\n * Notice: passing an initial HTML code doesn't work in IE.\n *\n * Warning for package users:\n * This function is out of Semantic Versioning, i.e. can change unexpectedly. Usage is at your own risk.\n */\n\n\nfunction withIframe(action, initialHtml, domPollInterval) {\n var _a, _b, _c;\n\n if (domPollInterval === void 0) {\n domPollInterval = 50;\n }\n\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__awaiter\"])(this, void 0, void 0, function () {\n var d, iframe;\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__generator\"])(this, function (_d) {\n switch (_d.label) {\n case 0:\n d = document;\n _d.label = 1;\n\n case 1:\n if (!!d.body) return [3\n /*break*/\n , 3];\n return [4\n /*yield*/\n , wait(domPollInterval)];\n\n case 2:\n _d.sent();\n\n return [3\n /*break*/\n , 1];\n\n case 3:\n iframe = d.createElement('iframe');\n _d.label = 4;\n\n case 4:\n _d.trys.push([4,, 10, 11]);\n\n return [4\n /*yield*/\n , new Promise(function (_resolve, _reject) {\n var isComplete = false;\n\n var resolve = function () {\n isComplete = true;\n\n _resolve();\n };\n\n var reject = function (error) {\n isComplete = true;\n\n _reject(error);\n };\n\n iframe.onload = resolve;\n iframe.onerror = reject;\n var style = iframe.style;\n style.setProperty('display', 'block', 'important'); // Required for browsers to calculate the layout\n\n style.position = 'absolute';\n style.top = '0';\n style.left = '0';\n style.visibility = 'hidden';\n\n if (initialHtml && 'srcdoc' in iframe) {\n iframe.srcdoc = initialHtml;\n } else {\n iframe.src = 'about:blank';\n }\n\n d.body.appendChild(iframe); // WebKit in WeChat doesn't fire the iframe's `onload` for some reason.\n // This code checks for the loading state manually.\n // See https://github.com/fingerprintjs/fingerprintjs/issues/645\n\n var checkReadyState = function () {\n var _a, _b; // The ready state may never become 'complete' in Firefox despite the 'load' event being fired.\n // So an infinite setTimeout loop can happen without this check.\n // See https://github.com/fingerprintjs/fingerprintjs/pull/716#issuecomment-986898796\n\n\n if (isComplete) {\n return;\n } // Make sure iframe.contentWindow and iframe.contentWindow.document are both loaded\n // The contentWindow.document can miss in JSDOM (https://github.com/jsdom/jsdom).\n\n\n if (((_b = (_a = iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.document) === null || _b === void 0 ? void 0 : _b.readyState) === 'complete') {\n resolve();\n } else {\n setTimeout(checkReadyState, 10);\n }\n };\n\n checkReadyState();\n })];\n\n case 5:\n _d.sent();\n\n _d.label = 6;\n\n case 6:\n if (!!((_b = (_a = iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.document) === null || _b === void 0 ? void 0 : _b.body)) return [3\n /*break*/\n , 8];\n return [4\n /*yield*/\n , wait(domPollInterval)];\n\n case 7:\n _d.sent();\n\n return [3\n /*break*/\n , 6];\n\n case 8:\n return [4\n /*yield*/\n , action(iframe, iframe.contentWindow)];\n\n case 9:\n return [2\n /*return*/\n , _d.sent()];\n\n case 10:\n (_c = iframe.parentNode) === null || _c === void 0 ? void 0 : _c.removeChild(iframe);\n return [7\n /*endfinally*/\n ];\n\n case 11:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\n * Creates a DOM element that matches the given selector.\n * Only single element selector are supported (without operators like space, +, >, etc).\n */\n\n\nfunction selectorToElement(selector) {\n var _a = parseSimpleCssSelector(selector),\n tag = _a[0],\n attributes = _a[1];\n\n var element = document.createElement(tag !== null && tag !== void 0 ? tag : 'div');\n\n for (var _i = 0, _b = Object.keys(attributes); _i < _b.length; _i++) {\n var name_1 = _b[_i];\n var value = attributes[name_1].join(' '); // Changing the `style` attribute can cause a CSP error, therefore we change the `style.cssText` property.\n // https://github.com/fingerprintjs/fingerprintjs/issues/733\n\n if (name_1 === 'style') {\n addStyleString(element.style, value);\n } else {\n element.setAttribute(name_1, value);\n }\n }\n\n return element;\n}\n/**\n * Adds CSS styles from a string in such a way that doesn't trigger a CSP warning (unsafe-inline or unsafe-eval)\n */\n\n\nfunction addStyleString(style, source) {\n // We don't use `style.cssText` because browsers must block it when no `unsafe-eval` CSP is presented: https://csplite.com/csp145/#w3c_note\n // Even though the browsers ignore this standard, we don't use `cssText` just in case.\n for (var _i = 0, _a = source.split(';'); _i < _a.length; _i++) {\n var property = _a[_i];\n var match = /^\\s*([\\w-]+)\\s*:\\s*(.+?)(\\s*!([\\w-]+))?\\s*$/.exec(property);\n\n if (match) {\n var name_2 = match[1],\n value = match[2],\n priority = match[4];\n style.setProperty(name_2, value, priority || ''); // The last argument can't be undefined in IE11\n }\n }\n} // We use m or w because these two characters take up the maximum width.\n// And we use a LLi so that the same matching fonts can get separated.\n\n\nvar testString = 'mmMwWLliI0O&1'; // We test using 48px font size, we may use any size. I guess larger the better.\n\nvar textSize = '48px'; // A font will be compared against all the three default fonts.\n// And if for any default fonts it doesn't match, then that font is available.\n\nvar baseFonts = ['monospace', 'sans-serif', 'serif'];\nvar fontList = [// This is android-specific font from \"Roboto\" family\n'sans-serif-thin', 'ARNO PRO', 'Agency FB', 'Arabic Typesetting', 'Arial Unicode MS', 'AvantGarde Bk BT', 'BankGothic Md BT', 'Batang', 'Bitstream Vera Sans Mono', 'Calibri', 'Century', 'Century Gothic', 'Clarendon', 'EUROSTILE', 'Franklin Gothic', 'Futura Bk BT', 'Futura Md BT', 'GOTHAM', 'Gill Sans', 'HELV', 'Haettenschweiler', 'Helvetica Neue', 'Humanst521 BT', 'Leelawadee', 'Letter Gothic', 'Levenim MT', 'Lucida Bright', 'Lucida Sans', 'Menlo', 'MS Mincho', 'MS Outlook', 'MS Reference Specialty', 'MS UI Gothic', 'MT Extra', 'MYRIAD PRO', 'Marlett', 'Meiryo UI', 'Microsoft Uighur', 'Minion Pro', 'Monotype Corsiva', 'PMingLiU', 'Pristina', 'SCRIPTINA', 'Segoe UI Light', 'Serifa', 'SimHei', 'Small Fonts', 'Staccato222 BT', 'TRAJAN PRO', 'Univers CE 55 Medium', 'Vrinda', 'ZWAdobeF']; // kudos to http://www.lalit.org/lab/javascript-css-font-detect/\n\nfunction getFonts() {\n // Running the script in an iframe makes it not affect the page look and not be affected by the page CSS. See:\n // https://github.com/fingerprintjs/fingerprintjs/issues/592\n // https://github.com/fingerprintjs/fingerprintjs/issues/628\n return withIframe(function (_, _a) {\n var document = _a.document;\n var holder = document.body;\n holder.style.fontSize = textSize; // div to load spans for the default fonts and the fonts to detect\n\n var spansContainer = document.createElement('div');\n var defaultWidth = {};\n var defaultHeight = {}; // creates a span where the fonts will be loaded\n\n var createSpan = function (fontFamily) {\n var span = document.createElement('span');\n var style = span.style;\n style.position = 'absolute';\n style.top = '0';\n style.left = '0';\n style.fontFamily = fontFamily;\n span.textContent = testString;\n spansContainer.appendChild(span);\n return span;\n }; // creates a span and load the font to detect and a base font for fallback\n\n\n var createSpanWithFonts = function (fontToDetect, baseFont) {\n return createSpan(\"'\" + fontToDetect + \"',\" + baseFont);\n }; // creates spans for the base fonts and adds them to baseFontsDiv\n\n\n var initializeBaseFontsSpans = function () {\n return baseFonts.map(createSpan);\n }; // creates spans for the fonts to detect and adds them to fontsDiv\n\n\n var initializeFontsSpans = function () {\n // Stores {fontName : [spans for that font]}\n var spans = {};\n\n var _loop_1 = function (font) {\n spans[font] = baseFonts.map(function (baseFont) {\n return createSpanWithFonts(font, baseFont);\n });\n };\n\n for (var _i = 0, fontList_1 = fontList; _i < fontList_1.length; _i++) {\n var font = fontList_1[_i];\n\n _loop_1(font);\n }\n\n return spans;\n }; // checks if a font is available\n\n\n var isFontAvailable = function (fontSpans) {\n return baseFonts.some(function (baseFont, baseFontIndex) {\n return fontSpans[baseFontIndex].offsetWidth !== defaultWidth[baseFont] || fontSpans[baseFontIndex].offsetHeight !== defaultHeight[baseFont];\n });\n }; // create spans for base fonts\n\n\n var baseFontsSpans = initializeBaseFontsSpans(); // create spans for fonts to detect\n\n var fontsSpans = initializeFontsSpans(); // add all the spans to the DOM\n\n holder.appendChild(spansContainer); // get the default width for the three base fonts\n\n for (var index = 0; index < baseFonts.length; index++) {\n defaultWidth[baseFonts[index]] = baseFontsSpans[index].offsetWidth; // width for the default font\n\n defaultHeight[baseFonts[index]] = baseFontsSpans[index].offsetHeight; // height for the default font\n } // check available fonts\n\n\n return fontList.filter(function (font) {\n return isFontAvailable(fontsSpans[font]);\n });\n });\n}\n\nfunction getPlugins() {\n var rawPlugins = navigator.plugins;\n\n if (!rawPlugins) {\n return undefined;\n }\n\n var plugins = []; // Safari 10 doesn't support iterating navigator.plugins with for...of\n\n for (var i = 0; i < rawPlugins.length; ++i) {\n var plugin = rawPlugins[i];\n\n if (!plugin) {\n continue;\n }\n\n var mimeTypes = [];\n\n for (var j = 0; j < plugin.length; ++j) {\n var mimeType = plugin[j];\n mimeTypes.push({\n type: mimeType.type,\n suffixes: mimeType.suffixes\n });\n }\n\n plugins.push({\n name: plugin.name,\n description: plugin.description,\n mimeTypes: mimeTypes\n });\n }\n\n return plugins;\n} // https://www.browserleaks.com/canvas#how-does-it-work\n\n\nfunction getCanvasFingerprint() {\n var winding = false;\n var geometry;\n var text;\n\n var _a = makeCanvasContext(),\n canvas = _a[0],\n context = _a[1];\n\n if (!isSupported(canvas, context)) {\n geometry = text = ''; // The value will be 'unsupported' in v3.4\n } else {\n winding = doesSupportWinding(context);\n renderTextImage(canvas, context);\n var textImage1 = canvasToString(canvas);\n var textImage2 = canvasToString(canvas); // It's slightly faster to double-encode the text image\n // Some browsers add a noise to the canvas: https://github.com/fingerprintjs/fingerprintjs/issues/791\n // The canvas is excluded from the fingerprint in this case\n\n if (textImage1 !== textImage2) {\n geometry = text = 'unstable';\n } else {\n text = textImage1; // Text is unstable:\n // https://github.com/fingerprintjs/fingerprintjs/issues/583\n // https://github.com/fingerprintjs/fingerprintjs/issues/103\n // Therefore it's extracted into a separate image.\n\n renderGeometryImage(canvas, context);\n geometry = canvasToString(canvas);\n }\n }\n\n return {\n winding: winding,\n geometry: geometry,\n text: text\n };\n}\n\nfunction makeCanvasContext() {\n var canvas = document.createElement('canvas');\n canvas.width = 1;\n canvas.height = 1;\n return [canvas, canvas.getContext('2d')];\n}\n\nfunction isSupported(canvas, context) {\n return !!(context && canvas.toDataURL);\n}\n\nfunction doesSupportWinding(context) {\n // https://web.archive.org/web/20170825024655/http://blogs.adobe.com/webplatform/2013/01/30/winding-rules-in-canvas/\n // https://github.com/Modernizr/Modernizr/blob/master/feature-detects/canvas/winding.js\n context.rect(0, 0, 10, 10);\n context.rect(2, 2, 6, 6);\n return !context.isPointInPath(5, 5, 'evenodd');\n}\n\nfunction renderTextImage(canvas, context) {\n // Resizing the canvas cleans it\n canvas.width = 240;\n canvas.height = 60;\n context.textBaseline = 'alphabetic';\n context.fillStyle = '#f60';\n context.fillRect(100, 1, 62, 20);\n context.fillStyle = '#069'; // It's important to use explicit built-in fonts in order to exclude the affect of font preferences\n // (there is a separate entropy source for them).\n\n context.font = '11pt \"Times New Roman\"'; // The choice of emojis has a gigantic impact on rendering performance (especially in FF).\n // Some newer emojis cause it to slow down 50-200 times.\n // There must be no text to the right of the emoji, see https://github.com/fingerprintjs/fingerprintjs/issues/574\n // A bare emoji shouldn't be used because the canvas will change depending on the script encoding:\n // https://github.com/fingerprintjs/fingerprintjs/issues/66\n // Escape sequence shouldn't be used too because Terser will turn it into a bare unicode.\n\n var printedText = \"Cwm fjordbank gly \" + String.fromCharCode(55357, 56835)\n /* 😃 */\n ;\n context.fillText(printedText, 2, 15);\n context.fillStyle = 'rgba(102, 204, 0, 0.2)';\n context.font = '18pt Arial';\n context.fillText(printedText, 4, 45);\n}\n\nfunction renderGeometryImage(canvas, context) {\n // Resizing the canvas cleans it\n canvas.width = 122;\n canvas.height = 110; // Canvas blending\n // https://web.archive.org/web/20170826194121/http://blogs.adobe.com/webplatform/2013/01/28/blending-features-in-canvas/\n // http://jsfiddle.net/NDYV8/16/\n\n context.globalCompositeOperation = 'multiply';\n\n for (var _i = 0, _a = [['#f2f', 40, 40], ['#2ff', 80, 40], ['#ff2', 60, 80]]; _i < _a.length; _i++) {\n var _b = _a[_i],\n color = _b[0],\n x = _b[1],\n y = _b[2];\n context.fillStyle = color;\n context.beginPath();\n context.arc(x, y, 40, 0, Math.PI * 2, true);\n context.closePath();\n context.fill();\n } // Canvas winding\n // https://web.archive.org/web/20130913061632/http://blogs.adobe.com/webplatform/2013/01/30/winding-rules-in-canvas/\n // http://jsfiddle.net/NDYV8/19/\n\n\n context.fillStyle = '#f9c';\n context.arc(60, 60, 60, 0, Math.PI * 2, true);\n context.arc(60, 60, 20, 0, Math.PI * 2, true);\n context.fill('evenodd');\n}\n\nfunction canvasToString(canvas) {\n return canvas.toDataURL();\n}\n/**\n * This is a crude and primitive touch screen detection. It's not possible to currently reliably detect the availability\n * of a touch screen with a JS, without actually subscribing to a touch event.\n *\n * @see http://www.stucox.com/blog/you-cant-detect-a-touchscreen/\n * @see https://github.com/Modernizr/Modernizr/issues/548\n */\n\n\nfunction getTouchSupport() {\n var n = navigator;\n var maxTouchPoints = 0;\n var touchEvent;\n\n if (n.maxTouchPoints !== undefined) {\n maxTouchPoints = toInt(n.maxTouchPoints);\n } else if (n.msMaxTouchPoints !== undefined) {\n maxTouchPoints = n.msMaxTouchPoints;\n }\n\n try {\n document.createEvent('TouchEvent');\n touchEvent = true;\n } catch (_a) {\n touchEvent = false;\n }\n\n var touchStart = ('ontouchstart' in window);\n return {\n maxTouchPoints: maxTouchPoints,\n touchEvent: touchEvent,\n touchStart: touchStart\n };\n}\n\nfunction getOsCpu() {\n return navigator.oscpu;\n}\n\nfunction getLanguages() {\n var n = navigator;\n var result = [];\n var language = n.language || n.userLanguage || n.browserLanguage || n.systemLanguage;\n\n if (language !== undefined) {\n result.push([language]);\n }\n\n if (Array.isArray(n.languages)) {\n // Starting from Chromium 86, there is only a single value in `navigator.language` in Incognito mode:\n // the value of `navigator.language`. Therefore the value is ignored in this browser.\n if (!(isChromium() && isChromium86OrNewer())) {\n result.push(n.languages);\n }\n } else if (typeof n.languages === 'string') {\n var languages = n.languages;\n\n if (languages) {\n result.push(languages.split(','));\n }\n }\n\n return result;\n}\n\nfunction getColorDepth() {\n return window.screen.colorDepth;\n}\n\nfunction getDeviceMemory() {\n // `navigator.deviceMemory` is a string containing a number in some unidentified cases\n return replaceNaN(toFloat(navigator.deviceMemory), undefined);\n}\n\nfunction getScreenResolution() {\n var s = screen; // Some browsers return screen resolution as strings, e.g. \"1200\", instead of a number, e.g. 1200.\n // I suspect it's done by certain plugins that randomize browser properties to prevent fingerprinting.\n // Some browsers even return screen resolution as not numbers.\n\n var parseDimension = function (value) {\n return replaceNaN(toInt(value), null);\n };\n\n var dimensions = [parseDimension(s.width), parseDimension(s.height)];\n dimensions.sort().reverse();\n return dimensions;\n}\n\nvar screenFrameCheckInterval = 2500;\nvar roundingPrecision = 10; // The type is readonly to protect from unwanted mutations\n\nvar screenFrameBackup;\nvar screenFrameSizeTimeoutId;\n/**\n * Starts watching the screen frame size. When a non-zero size appears, the size is saved and the watch is stopped.\n * Later, when `getScreenFrame` runs, it will return the saved non-zero size if the current size is null.\n *\n * This trick is required to mitigate the fact that the screen frame turns null in some cases.\n * See more on this at https://github.com/fingerprintjs/fingerprintjs/issues/568\n */\n\nfunction watchScreenFrame() {\n if (screenFrameSizeTimeoutId !== undefined) {\n return;\n }\n\n var checkScreenFrame = function () {\n var frameSize = getCurrentScreenFrame();\n\n if (isFrameSizeNull(frameSize)) {\n screenFrameSizeTimeoutId = setTimeout(checkScreenFrame, screenFrameCheckInterval);\n } else {\n screenFrameBackup = frameSize;\n screenFrameSizeTimeoutId = undefined;\n }\n };\n\n checkScreenFrame();\n}\n\nfunction getScreenFrame() {\n var _this = this;\n\n watchScreenFrame();\n return function () {\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__awaiter\"])(_this, void 0, void 0, function () {\n var frameSize;\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__generator\"])(this, function (_a) {\n switch (_a.label) {\n case 0:\n frameSize = getCurrentScreenFrame();\n if (!isFrameSizeNull(frameSize)) return [3\n /*break*/\n , 2];\n\n if (screenFrameBackup) {\n return [2\n /*return*/\n , Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__spreadArrays\"])(screenFrameBackup)];\n }\n\n if (!getFullscreenElement()) return [3\n /*break*/\n , 2]; // Some browsers set the screen frame to zero when programmatic fullscreen is on.\n // There is a chance of getting a non-zero frame after exiting the fullscreen.\n // See more on this at https://github.com/fingerprintjs/fingerprintjs/issues/568\n\n return [4\n /*yield*/\n , exitFullscreen()];\n\n case 1:\n // Some browsers set the screen frame to zero when programmatic fullscreen is on.\n // There is a chance of getting a non-zero frame after exiting the fullscreen.\n // See more on this at https://github.com/fingerprintjs/fingerprintjs/issues/568\n _a.sent();\n\n frameSize = getCurrentScreenFrame();\n _a.label = 2;\n\n case 2:\n if (!isFrameSizeNull(frameSize)) {\n screenFrameBackup = frameSize;\n }\n\n return [2\n /*return*/\n , frameSize];\n }\n });\n });\n };\n}\n/**\n * Sometimes the available screen resolution changes a bit, e.g. 1900x1440 → 1900x1439. A possible reason: macOS Dock\n * shrinks to fit more icons when there is too little space. The rounding is used to mitigate the difference.\n */\n\n\nfunction getRoundedScreenFrame() {\n var _this = this;\n\n var screenFrameGetter = getScreenFrame();\n return function () {\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__awaiter\"])(_this, void 0, void 0, function () {\n var frameSize, processSize;\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__generator\"])(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4\n /*yield*/\n , screenFrameGetter()];\n\n case 1:\n frameSize = _a.sent();\n\n processSize = function (sideSize) {\n return sideSize === null ? null : round(sideSize, roundingPrecision);\n }; // It might look like I don't know about `for` and `map`.\n // In fact, such code is used to avoid TypeScript issues without using `as`.\n\n\n return [2\n /*return*/\n , [processSize(frameSize[0]), processSize(frameSize[1]), processSize(frameSize[2]), processSize(frameSize[3])]];\n }\n });\n });\n };\n}\n\nfunction getCurrentScreenFrame() {\n var s = screen; // Some browsers return screen resolution as strings, e.g. \"1200\", instead of a number, e.g. 1200.\n // I suspect it's done by certain plugins that randomize browser properties to prevent fingerprinting.\n //\n // Some browsers (IE, Edge ≤18) don't provide `screen.availLeft` and `screen.availTop`. The property values are\n // replaced with 0 in such cases to not lose the entropy from `screen.availWidth` and `screen.availHeight`.\n\n return [replaceNaN(toFloat(s.availTop), null), replaceNaN(toFloat(s.width) - toFloat(s.availWidth) - replaceNaN(toFloat(s.availLeft), 0), null), replaceNaN(toFloat(s.height) - toFloat(s.availHeight) - replaceNaN(toFloat(s.availTop), 0), null), replaceNaN(toFloat(s.availLeft), null)];\n}\n\nfunction isFrameSizeNull(frameSize) {\n for (var i = 0; i < 4; ++i) {\n if (frameSize[i]) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction getHardwareConcurrency() {\n // sometimes hardware concurrency is a string\n return replaceNaN(toInt(navigator.hardwareConcurrency), undefined);\n}\n\nfunction getTimezone() {\n var _a;\n\n var DateTimeFormat = (_a = window.Intl) === null || _a === void 0 ? void 0 : _a.DateTimeFormat;\n\n if (DateTimeFormat) {\n var timezone = new DateTimeFormat().resolvedOptions().timeZone;\n\n if (timezone) {\n return timezone;\n }\n } // For browsers that don't support timezone names\n // The minus is intentional because the JS offset is opposite to the real offset\n\n\n var offset = -getTimezoneOffset();\n return \"UTC\" + (offset >= 0 ? '+' : '') + Math.abs(offset);\n}\n\nfunction getTimezoneOffset() {\n var currentYear = new Date().getFullYear(); // The timezone offset may change over time due to daylight saving time (DST) shifts.\n // The non-DST timezone offset is used as the result timezone offset.\n // Since the DST season differs in the northern and the southern hemispheres,\n // both January and July timezones offsets are considered.\n\n return Math.max( // `getTimezoneOffset` returns a number as a string in some unidentified cases\n toFloat(new Date(currentYear, 0, 1).getTimezoneOffset()), toFloat(new Date(currentYear, 6, 1).getTimezoneOffset()));\n}\n\nfunction getSessionStorage() {\n try {\n return !!window.sessionStorage;\n } catch (error) {\n /* SecurityError when referencing it means it exists */\n return true;\n }\n} // https://bugzilla.mozilla.org/show_bug.cgi?id=781447\n\n\nfunction getLocalStorage() {\n try {\n return !!window.localStorage;\n } catch (e) {\n /* SecurityError when referencing it means it exists */\n return true;\n }\n}\n\nfunction getIndexedDB() {\n // IE and Edge don't allow accessing indexedDB in private mode, therefore IE and Edge will have different\n // visitor identifier in normal and private modes.\n if (isTrident() || isEdgeHTML()) {\n return undefined;\n }\n\n try {\n return !!window.indexedDB;\n } catch (e) {\n /* SecurityError when referencing it means it exists */\n return true;\n }\n}\n\nfunction getOpenDatabase() {\n return !!window.openDatabase;\n}\n\nfunction getCpuClass() {\n return navigator.cpuClass;\n}\n\nfunction getPlatform() {\n // Android Chrome 86 and 87 and Android Firefox 80 and 84 don't mock the platform value when desktop mode is requested\n var platform = navigator.platform; // iOS mocks the platform value when desktop version is requested: https://github.com/fingerprintjs/fingerprintjs/issues/514\n // iPad uses desktop mode by default since iOS 13\n // The value is 'MacIntel' on M1 Macs\n // The value is 'iPhone' on iPod Touch\n\n if (platform === 'MacIntel') {\n if (isWebKit() && !isDesktopSafari()) {\n return isIPad() ? 'iPad' : 'iPhone';\n }\n }\n\n return platform;\n}\n\nfunction getVendor() {\n return navigator.vendor || '';\n}\n/**\n * Checks for browser-specific (not engine specific) global variables to tell browsers with the same engine apart.\n * Only somewhat popular browsers are considered.\n */\n\n\nfunction getVendorFlavors() {\n var flavors = [];\n\n for (var _i = 0, _a = [// Blink and some browsers on iOS\n 'chrome', // Safari on macOS\n 'safari', // Chrome on iOS (checked in 85 on 13 and 87 on 14)\n '__crWeb', '__gCrWeb', // Yandex Browser on iOS, macOS and Android (checked in 21.2 on iOS 14, macOS and Android)\n 'yandex', // Yandex Browser on iOS (checked in 21.2 on 14)\n '__yb', '__ybro', // Firefox on iOS (checked in 32 on 14)\n '__firefox__', // Edge on iOS (checked in 46 on 14)\n '__edgeTrackingPreventionStatistics', 'webkit', // Opera Touch on iOS (checked in 2.6 on 14)\n 'oprt', // Samsung Internet on Android (checked in 11.1)\n 'samsungAr', // UC Browser on Android (checked in 12.10 and 13.0)\n 'ucweb', 'UCShellJava', // Puffin on Android (checked in 9.0)\n 'puffinDevice']; _i < _a.length; _i++) {\n var key = _a[_i];\n var value = window[key];\n\n if (value && typeof value === 'object') {\n flavors.push(key);\n }\n }\n\n return flavors.sort();\n}\n/**\n * navigator.cookieEnabled cannot detect custom or nuanced cookie blocking configurations. For example, when blocking\n * cookies via the Advanced Privacy Settings in IE9, it always returns true. And there have been issues in the past with\n * site-specific exceptions. Don't rely on it.\n *\n * @see https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cookies.js Taken from here\n */\n\n\nfunction areCookiesEnabled() {\n var d = document; // Taken from here: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cookies.js\n // navigator.cookieEnabled cannot detect custom or nuanced cookie blocking configurations. For example, when blocking\n // cookies via the Advanced Privacy Settings in IE9, it always returns true. And there have been issues in the past\n // with site-specific exceptions. Don't rely on it.\n // try..catch because some in situations `document.cookie` is exposed but throws a\n // SecurityError if you try to access it; e.g. documents created from data URIs\n // or in sandboxed iframes (depending on flags/context)\n\n try {\n // Create cookie\n d.cookie = 'cookietest=1; SameSite=Strict;';\n var result = d.cookie.indexOf('cookietest=') !== -1; // Delete cookie\n\n d.cookie = 'cookietest=1; SameSite=Strict; expires=Thu, 01-Jan-1970 00:00:01 GMT';\n return result;\n } catch (e) {\n return false;\n }\n}\n/**\n * Only single element selector are supported (no operators like space, +, >, etc).\n * `embed` and `position: fixed;` will be considered as blocked anyway because it always has no offsetParent.\n * Avoid `iframe` and anything with `[src=]` because they produce excess HTTP requests.\n *\n * The \"inappropriate\" selectors are obfuscated. See https://github.com/fingerprintjs/fingerprintjs/issues/734.\n * A function is used instead of a plain object to help tree-shaking.\n *\n * The function code is generated automatically. See docs/content_blockers.md to learn how to make the list.\n */\n\n\nfunction getFilters() {\n var fromB64 = atob; // Just for better minification\n\n return {\n abpIndo: ['#Iklan-Melayang', '#Kolom-Iklan-728', '#SidebarIklan-wrapper', fromB64('YVt0aXRsZT0iN25hZ2EgcG9rZXIiIGld'), '[title=\"ALIENBOLA\" i]'],\n abpvn: ['#quangcaomb', fromB64('Lmlvc0Fkc2lvc0Fkcy1sYXlvdXQ='), '.quangcao', fromB64('W2hyZWZePSJodHRwczovL3I4OC52bi8iXQ=='), fromB64('W2hyZWZePSJodHRwczovL3piZXQudm4vIl0=')],\n adBlockFinland: ['.mainostila', fromB64('LnNwb25zb3JpdA=='), '.ylamainos', fromB64('YVtocmVmKj0iL2NsaWNrdGhyZ2guYXNwPyJd'), fromB64('YVtocmVmXj0iaHR0cHM6Ly9hcHAucmVhZHBlYWsuY29tL2FkcyJd')],\n adBlockPersian: ['#navbar_notice_50', '.kadr', 'TABLE[width=\"140px\"]', '#divAgahi', fromB64('I2FkMl9pbmxpbmU=')],\n adBlockWarningRemoval: ['#adblock-honeypot', '.adblocker-root', '.wp_adblock_detect', fromB64('LmhlYWRlci1ibG9ja2VkLWFk'), fromB64('I2FkX2Jsb2NrZXI=')],\n adGuardAnnoyances: ['amp-embed[type=\"zen\"]', '.hs-sosyal', '#cookieconsentdiv', 'div[class^=\"app_gdpr\"]', '.as-oil'],\n adGuardBase: ['.BetterJsPopOverlay', fromB64('I2FkXzMwMFgyNTA='), fromB64('I2Jhbm5lcmZsb2F0MjI='), fromB64('I2FkLWJhbm5lcg=='), fromB64('I2NhbXBhaWduLWJhbm5lcg==')],\n adGuardChinese: [fromB64('LlppX2FkX2FfSA=='), fromB64('YVtocmVmKj0iL29kMDA1LmNvbSJd'), fromB64('YVtocmVmKj0iLmh0aGJldDM0LmNvbSJd'), '.qq_nr_lad', '#widget-quan'],\n adGuardFrench: [fromB64('I2Jsb2NrLXZpZXdzLWFkcy1zaWRlYmFyLWJsb2NrLWJsb2Nr'), '#pavePub', fromB64('LmFkLWRlc2t0b3AtcmVjdGFuZ2xl'), '.mobile_adhesion', '.widgetadv'],\n adGuardGerman: [fromB64('LmJhbm5lcml0ZW13ZXJidW5nX2hlYWRfMQ=='), fromB64('LmJveHN0YXJ0d2VyYnVuZw=='), fromB64('LndlcmJ1bmcz'), fromB64('YVtocmVmXj0iaHR0cDovL3d3dy5laXMuZGUvaW5kZXgucGh0bWw/cmVmaWQ9Il0='), fromB64('YVtocmVmXj0iaHR0cHM6Ly93d3cudGlwaWNvLmNvbS8/YWZmaWxpYXRlSWQ9Il0=')],\n adGuardJapanese: ['#kauli_yad_1', fromB64('YVtocmVmXj0iaHR0cDovL2FkMi50cmFmZmljZ2F0ZS5uZXQvIl0='), fromB64('Ll9wb3BJbl9pbmZpbml0ZV9hZA=='), fromB64('LmFkZ29vZ2xl'), fromB64('LmFkX3JlZ3VsYXIz')],\n adGuardMobile: [fromB64('YW1wLWF1dG8tYWRz'), fromB64('LmFtcF9hZA=='), 'amp-embed[type=\"24smi\"]', '#mgid_iframe1', fromB64('I2FkX2ludmlld19hcmVh')],\n adGuardRussian: [fromB64('YVtocmVmXj0iaHR0cHM6Ly9hZC5sZXRtZWFkcy5jb20vIl0='), fromB64('LnJlY2xhbWE='), 'div[id^=\"smi2adblock\"]', fromB64('ZGl2W2lkXj0iQWRGb3hfYmFubmVyXyJd'), fromB64('I2FkX3NxdWFyZQ==')],\n adGuardSocial: [fromB64('YVtocmVmXj0iLy93d3cuc3R1bWJsZXVwb24uY29tL3N1Ym1pdD91cmw9Il0='), fromB64('YVtocmVmXj0iLy90ZWxlZ3JhbS5tZS9zaGFyZS91cmw/Il0='), '.etsy-tweet', '#inlineShare', '.popup-social'],\n adGuardSpanishPortuguese: ['#barraPublicidade', '#Publicidade', '#publiEspecial', '#queTooltip', fromB64('W2hyZWZePSJodHRwOi8vYWRzLmdsaXNwYS5jb20vIl0=')],\n adGuardTrackingProtection: ['#qoo-counter', fromB64('YVtocmVmXj0iaHR0cDovL2NsaWNrLmhvdGxvZy5ydS8iXQ=='), fromB64('YVtocmVmXj0iaHR0cDovL2hpdGNvdW50ZXIucnUvdG9wL3N0YXQucGhwIl0='), fromB64('YVtocmVmXj0iaHR0cDovL3RvcC5tYWlsLnJ1L2p1bXAiXQ=='), '#top100counter'],\n adGuardTurkish: ['#backkapat', fromB64('I3Jla2xhbWk='), fromB64('YVtocmVmXj0iaHR0cDovL2Fkc2Vydi5vbnRlay5jb20udHIvIl0='), fromB64('YVtocmVmXj0iaHR0cDovL2l6bGVuemkuY29tL2NhbXBhaWduLyJd'), fromB64('YVtocmVmXj0iaHR0cDovL3d3dy5pbnN0YWxsYWRzLm5ldC8iXQ==')],\n bulgarian: [fromB64('dGQjZnJlZW5ldF90YWJsZV9hZHM='), '#ea_intext_div', '.lapni-pop-over', '#xenium_hot_offers', fromB64('I25ld0Fk')],\n easyList: [fromB64('I0FEX0NPTlRST0xfMjg='), fromB64('LnNlY29uZC1wb3N0LWFkcy13cmFwcGVy'), '.universalboxADVBOX03', fromB64('LmFkdmVydGlzZW1lbnQtNzI4eDkw'), fromB64('LnNxdWFyZV9hZHM=')],\n easyListChina: [fromB64('YVtocmVmKj0iLndlbnNpeHVldGFuZy5jb20vIl0='), fromB64('LmFwcGd1aWRlLXdyYXBbb25jbGljayo9ImJjZWJvcy5jb20iXQ=='), fromB64('LmZyb250cGFnZUFkdk0='), '#taotaole', '#aafoot.top_box'],\n easyListCookie: ['#AdaCompliance.app-notice', '.text-center.rgpd', '.panel--cookie', '.js-cookies-andromeda', '.elxtr-consent'],\n easyListCzechSlovak: ['#onlajny-stickers', fromB64('I3Jla2xhbW5pLWJveA=='), fromB64('LnJla2xhbWEtbWVnYWJvYXJk'), '.sklik', fromB64('W2lkXj0ic2tsaWtSZWtsYW1hIl0=')],\n easyListDutch: [fromB64('I2FkdmVydGVudGll'), fromB64('I3ZpcEFkbWFya3RCYW5uZXJCbG9jaw=='), '.adstekst', fromB64('YVtocmVmXj0iaHR0cHM6Ly94bHR1YmUubmwvY2xpY2svIl0='), '#semilo-lrectangle'],\n easyListGermany: [fromB64('I0FkX1dpbjJkYXk='), fromB64('I3dlcmJ1bmdzYm94MzAw'), fromB64('YVtocmVmXj0iaHR0cDovL3d3dy5yb3RsaWNodGthcnRlaS5jb20vP3NjPSJd'), fromB64('I3dlcmJ1bmdfd2lkZXNreXNjcmFwZXJfc2NyZWVu'), fromB64('YVtocmVmXj0iaHR0cDovL2xhbmRpbmcucGFya3BsYXR6a2FydGVpLmNvbS8/YWc9Il0=')],\n easyListItaly: [fromB64('LmJveF9hZHZfYW5udW5jaQ=='), '.sb-box-pubbliredazionale', fromB64('YVtocmVmXj0iaHR0cDovL2FmZmlsaWF6aW9uaWFkcy5zbmFpLml0LyJd'), fromB64('YVtocmVmXj0iaHR0cHM6Ly9hZHNlcnZlci5odG1sLml0LyJd'), fromB64('YVtocmVmXj0iaHR0cHM6Ly9hZmZpbGlhemlvbmlhZHMuc25haS5pdC8iXQ==')],\n easyListLithuania: [fromB64('LnJla2xhbW9zX3RhcnBhcw=='), fromB64('LnJla2xhbW9zX251b3JvZG9z'), fromB64('aW1nW2FsdD0iUmVrbGFtaW5pcyBza3lkZWxpcyJd'), fromB64('aW1nW2FsdD0iRGVkaWt1b3RpLmx0IHNlcnZlcmlhaSJd'), fromB64('aW1nW2FsdD0iSG9zdGluZ2FzIFNlcnZlcmlhaS5sdCJd')],\n estonian: [fromB64('QVtocmVmKj0iaHR0cDovL3BheTRyZXN1bHRzMjQuZXUiXQ==')],\n fanboyAnnoyances: ['#feedback-tab', '#taboola-below-article', '.feedburnerFeedBlock', '.widget-feedburner-counter', '[title=\"Subscribe to our blog\"]'],\n fanboyAntiFacebook: ['.util-bar-module-firefly-visible'],\n fanboyEnhancedTrackers: ['.open.pushModal', '#issuem-leaky-paywall-articles-zero-remaining-nag', '#sovrn_container', 'div[class$=\"-hide\"][zoompage-fontsize][style=\"display: block;\"]', '.BlockNag__Card'],\n fanboySocial: ['.td-tags-and-social-wrapper-box', '.twitterContainer', '.youtube-social', 'a[title^=\"Like us on Facebook\"]', 'img[alt^=\"Share on Digg\"]'],\n frellwitSwedish: [fromB64('YVtocmVmKj0iY2FzaW5vcHJvLnNlIl1bdGFyZ2V0PSJfYmxhbmsiXQ=='), fromB64('YVtocmVmKj0iZG9rdG9yLXNlLm9uZWxpbmsubWUiXQ=='), 'article.category-samarbete', fromB64('ZGl2LmhvbGlkQWRz'), 'ul.adsmodern'],\n greekAdBlock: [fromB64('QVtocmVmKj0iYWRtYW4ub3RlbmV0LmdyL2NsaWNrPyJd'), fromB64('QVtocmVmKj0iaHR0cDovL2F4aWFiYW5uZXJzLmV4b2R1cy5nci8iXQ=='), fromB64('QVtocmVmKj0iaHR0cDovL2ludGVyYWN0aXZlLmZvcnRobmV0LmdyL2NsaWNrPyJd'), 'DIV.agores300', 'TABLE.advright'],\n hungarian: ['#cemp_doboz', '.optimonk-iframe-container', fromB64('LmFkX19tYWlu'), fromB64('W2NsYXNzKj0iR29vZ2xlQWRzIl0='), '#hirdetesek_box'],\n iDontCareAboutCookies: ['.alert-info[data-block-track*=\"CookieNotice\"]', '.ModuleTemplateCookieIndicator', '.o--cookies--container', '.cookie-msg-info-container', '#cookies-policy-sticky'],\n icelandicAbp: [fromB64('QVtocmVmXj0iL2ZyYW1ld29yay9yZXNvdXJjZXMvZm9ybXMvYWRzLmFzcHgiXQ==')],\n latvian: [fromB64('YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiAxMjBweDsgaGVpZ2h0O' + 'iA0MHB4OyBvdmVyZmxvdzogaGlkZGVuOyBwb3NpdGlvbjogcmVsYXRpdmU7Il0='), fromB64('YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiA4OHB4OyBoZWlnaHQ6I' + 'DMxcHg7IG92ZXJmbG93OiBoaWRkZW47IHBvc2l0aW9uOiByZWxhdGl2ZTsiXQ==')],\n listKr: [fromB64('YVtocmVmKj0iLy9hZC5wbGFuYnBsdXMuY28ua3IvIl0='), fromB64('I2xpdmVyZUFkV3JhcHBlcg=='), fromB64('YVtocmVmKj0iLy9hZHYuaW1hZHJlcC5jby5rci8iXQ=='), fromB64('aW5zLmZhc3R2aWV3LWFk'), '.revenue_unit_item.dable'],\n listeAr: [fromB64('LmdlbWluaUxCMUFk'), '.right-and-left-sponsers', fromB64('YVtocmVmKj0iLmFmbGFtLmluZm8iXQ=='), fromB64('YVtocmVmKj0iYm9vcmFxLm9yZyJd'), fromB64('YVtocmVmKj0iZHViaXp6bGUuY29tL2FyLz91dG1fc291cmNlPSJd')],\n listeFr: [fromB64('YVtocmVmXj0iaHR0cDovL3Byb21vLnZhZG9yLmNvbS8iXQ=='), fromB64('I2FkY29udGFpbmVyX3JlY2hlcmNoZQ=='), fromB64('YVtocmVmKj0id2Vib3JhbWEuZnIvZmNnaS1iaW4vIl0='), '.site-pub-interstitiel', 'div[id^=\"crt-\"][data-criteo-id]'],\n officialPolish: ['#ceneo-placeholder-ceneo-12', fromB64('W2hyZWZePSJodHRwczovL2FmZi5zZW5kaHViLnBsLyJd'), fromB64('YVtocmVmXj0iaHR0cDovL2Fkdm1hbmFnZXIudGVjaGZ1bi5wbC9yZWRpcmVjdC8iXQ=='), fromB64('YVtocmVmXj0iaHR0cDovL3d3dy50cml6ZXIucGwvP3V0bV9zb3VyY2UiXQ=='), fromB64('ZGl2I3NrYXBpZWNfYWQ=')],\n ro: [fromB64('YVtocmVmXj0iLy9hZmZ0cmsuYWx0ZXgucm8vQ291bnRlci9DbGljayJd'), 'a[href^=\"/magazin/\"]', fromB64('YVtocmVmXj0iaHR0cHM6Ly9ibGFja2ZyaWRheXNhbGVzLnJvL3Ryay9zaG9wLyJd'), fromB64('YVtocmVmXj0iaHR0cHM6Ly9ldmVudC4ycGVyZm9ybWFudC5jb20vZXZlbnRzL2NsaWNrIl0='), fromB64('YVtocmVmXj0iaHR0cHM6Ly9sLnByb2ZpdHNoYXJlLnJvLyJd')],\n ruAd: [fromB64('YVtocmVmKj0iLy9mZWJyYXJlLnJ1LyJd'), fromB64('YVtocmVmKj0iLy91dGltZy5ydS8iXQ=='), fromB64('YVtocmVmKj0iOi8vY2hpa2lkaWtpLnJ1Il0='), '#pgeldiz', '.yandex-rtb-block'],\n thaiAds: ['a[href*=macau-uta-popup]', fromB64('I2Fkcy1nb29nbGUtbWlkZGxlX3JlY3RhbmdsZS1ncm91cA=='), fromB64('LmFkczMwMHM='), '.bumq', '.img-kosana'],\n webAnnoyancesUltralist: ['#mod-social-share-2', '#social-tools', fromB64('LmN0cGwtZnVsbGJhbm5lcg=='), '.zergnet-recommend', '.yt.btn-link.btn-md.btn']\n };\n}\n/**\n * The order of the returned array means nothing (it's always sorted alphabetically).\n *\n * Notice that the source is slightly unstable.\n * Safari provides a 2-taps way to disable all content blockers on a page temporarily.\n * Also content blockers can be disabled permanently for a domain, but it requires 4 taps.\n * So empty array shouldn't be treated as \"no blockers\", it should be treated as \"no signal\".\n * If you are a website owner, don't make your visitors want to disable content blockers.\n */\n\n\nfunction getDomBlockers(_a) {\n var debug = (_a === void 0 ? {} : _a).debug;\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__awaiter\"])(this, void 0, void 0, function () {\n var filters, filterNames, allSelectors, blockedSelectors, activeBlockers;\n\n var _b;\n\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__generator\"])(this, function (_c) {\n switch (_c.label) {\n case 0:\n if (!isApplicable()) {\n return [2\n /*return*/\n , undefined];\n }\n\n filters = getFilters();\n filterNames = Object.keys(filters);\n allSelectors = (_b = []).concat.apply(_b, filterNames.map(function (filterName) {\n return filters[filterName];\n }));\n return [4\n /*yield*/\n , getBlockedSelectors(allSelectors)];\n\n case 1:\n blockedSelectors = _c.sent();\n\n if (debug) {\n printDebug(filters, blockedSelectors);\n }\n\n activeBlockers = filterNames.filter(function (filterName) {\n var selectors = filters[filterName];\n var blockedCount = countTruthy(selectors.map(function (selector) {\n return blockedSelectors[selector];\n }));\n return blockedCount > selectors.length * 0.6;\n });\n activeBlockers.sort();\n return [2\n /*return*/\n , activeBlockers];\n }\n });\n });\n}\n\nfunction isApplicable() {\n // Safari (desktop and mobile) and all Android browsers keep content blockers in both regular and private mode\n return isWebKit() || isAndroid();\n}\n\nfunction getBlockedSelectors(selectors) {\n var _a;\n\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__awaiter\"])(this, void 0, void 0, function () {\n var d, root, elements, blockedSelectors, i, element, holder, i;\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__generator\"])(this, function (_b) {\n switch (_b.label) {\n case 0:\n d = document;\n root = d.createElement('div');\n elements = new Array(selectors.length);\n blockedSelectors = {} // Set() isn't used just in case somebody need older browser support\n ;\n forceShow(root); // First create all elements that can be blocked. If the DOM steps below are done in a single cycle,\n // browser will alternate tree modification and layout reading, that is very slow.\n\n for (i = 0; i < selectors.length; ++i) {\n element = selectorToElement(selectors[i]);\n holder = d.createElement('div') // Protects from unwanted effects of `+` and `~` selectors of filters\n ;\n forceShow(holder);\n holder.appendChild(element);\n root.appendChild(holder);\n elements[i] = element;\n }\n\n _b.label = 1;\n\n case 1:\n if (!!d.body) return [3\n /*break*/\n , 3];\n return [4\n /*yield*/\n , wait(50)];\n\n case 2:\n _b.sent();\n\n return [3\n /*break*/\n , 1];\n\n case 3:\n d.body.appendChild(root);\n\n try {\n // Then check which of the elements are blocked\n for (i = 0; i < selectors.length; ++i) {\n if (!elements[i].offsetParent) {\n blockedSelectors[selectors[i]] = true;\n }\n }\n } finally {\n // Then remove the elements\n (_a = root.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(root);\n }\n\n return [2\n /*return*/\n , blockedSelectors];\n }\n });\n });\n}\n\nfunction forceShow(element) {\n element.style.setProperty('display', 'block', 'important');\n}\n\nfunction printDebug(filters, blockedSelectors) {\n var message = 'DOM blockers debug:\\n```';\n\n for (var _i = 0, _a = Object.keys(filters); _i < _a.length; _i++) {\n var filterName = _a[_i];\n message += \"\\n\" + filterName + \":\";\n\n for (var _b = 0, _c = filters[filterName]; _b < _c.length; _b++) {\n var selector = _c[_b];\n message += \"\\n \" + (blockedSelectors[selector] ? '🚫' : '➡️') + \" \" + selector;\n }\n } // console.log is ok here because it's under a debug clause\n // eslint-disable-next-line no-console\n\n\n console.log(message + \"\\n```\");\n}\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/@media/color-gamut\n */\n\n\nfunction getColorGamut() {\n // rec2020 includes p3 and p3 includes srgb\n for (var _i = 0, _a = ['rec2020', 'p3', 'srgb']; _i < _a.length; _i++) {\n var gamut = _a[_i];\n\n if (matchMedia(\"(color-gamut: \" + gamut + \")\").matches) {\n return gamut;\n }\n }\n\n return undefined;\n}\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/@media/inverted-colors\n */\n\n\nfunction areColorsInverted() {\n if (doesMatch$4('inverted')) {\n return true;\n }\n\n if (doesMatch$4('none')) {\n return false;\n }\n\n return undefined;\n}\n\nfunction doesMatch$4(value) {\n return matchMedia(\"(inverted-colors: \" + value + \")\").matches;\n}\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/@media/forced-colors\n */\n\n\nfunction areColorsForced() {\n if (doesMatch$3('active')) {\n return true;\n }\n\n if (doesMatch$3('none')) {\n return false;\n }\n\n return undefined;\n}\n\nfunction doesMatch$3(value) {\n return matchMedia(\"(forced-colors: \" + value + \")\").matches;\n}\n\nvar maxValueToCheck = 100;\n/**\n * If the display is monochrome (e.g. black&white), the value will be ≥0 and will mean the number of bits per pixel.\n * If the display is not monochrome, the returned value will be 0.\n * If the browser doesn't support this feature, the returned value will be undefined.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/@media/monochrome\n */\n\nfunction getMonochromeDepth() {\n if (!matchMedia('(min-monochrome: 0)').matches) {\n // The media feature isn't supported by the browser\n return undefined;\n } // A variation of binary search algorithm can be used here.\n // But since expected values are very small (≤10), there is no sense in adding the complexity.\n\n\n for (var i = 0; i <= maxValueToCheck; ++i) {\n if (matchMedia(\"(max-monochrome: \" + i + \")\").matches) {\n return i;\n }\n }\n\n throw new Error('Too high value');\n}\n/**\n * @see https://www.w3.org/TR/mediaqueries-5/#prefers-contrast\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-contrast\n */\n\n\nfunction getContrastPreference() {\n if (doesMatch$2('no-preference')) {\n return 0\n /* None */\n ;\n } // The sources contradict on the keywords. Probably 'high' and 'low' will never be implemented.\n // Need to check it when all browsers implement the feature.\n\n\n if (doesMatch$2('high') || doesMatch$2('more')) {\n return 1\n /* More */\n ;\n }\n\n if (doesMatch$2('low') || doesMatch$2('less')) {\n return -1\n /* Less */\n ;\n }\n\n if (doesMatch$2('forced')) {\n return 10\n /* ForcedColors */\n ;\n }\n\n return undefined;\n}\n\nfunction doesMatch$2(value) {\n return matchMedia(\"(prefers-contrast: \" + value + \")\").matches;\n}\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion\n */\n\n\nfunction isMotionReduced() {\n if (doesMatch$1('reduce')) {\n return true;\n }\n\n if (doesMatch$1('no-preference')) {\n return false;\n }\n\n return undefined;\n}\n\nfunction doesMatch$1(value) {\n return matchMedia(\"(prefers-reduced-motion: \" + value + \")\").matches;\n}\n/**\n * @see https://www.w3.org/TR/mediaqueries-5/#dynamic-range\n */\n\n\nfunction isHDR() {\n if (doesMatch('high')) {\n return true;\n }\n\n if (doesMatch('standard')) {\n return false;\n }\n\n return undefined;\n}\n\nfunction doesMatch(value) {\n return matchMedia(\"(dynamic-range: \" + value + \")\").matches;\n}\n\nvar M = Math; // To reduce the minified code size\n\nvar fallbackFn = function () {\n return 0;\n};\n/**\n * @see https://gitlab.torproject.org/legacy/trac/-/issues/13018\n * @see https://bugzilla.mozilla.org/show_bug.cgi?id=531915\n */\n\n\nfunction getMathFingerprint() {\n // Native operations\n var acos = M.acos || fallbackFn;\n var acosh = M.acosh || fallbackFn;\n var asin = M.asin || fallbackFn;\n var asinh = M.asinh || fallbackFn;\n var atanh = M.atanh || fallbackFn;\n var atan = M.atan || fallbackFn;\n var sin = M.sin || fallbackFn;\n var sinh = M.sinh || fallbackFn;\n var cos = M.cos || fallbackFn;\n var cosh = M.cosh || fallbackFn;\n var tan = M.tan || fallbackFn;\n var tanh = M.tanh || fallbackFn;\n var exp = M.exp || fallbackFn;\n var expm1 = M.expm1 || fallbackFn;\n var log1p = M.log1p || fallbackFn; // Operation polyfills\n\n var powPI = function (value) {\n return M.pow(M.PI, value);\n };\n\n var acoshPf = function (value) {\n return M.log(value + M.sqrt(value * value - 1));\n };\n\n var asinhPf = function (value) {\n return M.log(value + M.sqrt(value * value + 1));\n };\n\n var atanhPf = function (value) {\n return M.log((1 + value) / (1 - value)) / 2;\n };\n\n var sinhPf = function (value) {\n return M.exp(value) - 1 / M.exp(value) / 2;\n };\n\n var coshPf = function (value) {\n return (M.exp(value) + 1 / M.exp(value)) / 2;\n };\n\n var expm1Pf = function (value) {\n return M.exp(value) - 1;\n };\n\n var tanhPf = function (value) {\n return (M.exp(2 * value) - 1) / (M.exp(2 * value) + 1);\n };\n\n var log1pPf = function (value) {\n return M.log(1 + value);\n }; // Note: constant values are empirical\n\n\n return {\n acos: acos(0.123124234234234242),\n acosh: acosh(1e308),\n acoshPf: acoshPf(1e154),\n asin: asin(0.123124234234234242),\n asinh: asinh(1),\n asinhPf: asinhPf(1),\n atanh: atanh(0.5),\n atanhPf: atanhPf(0.5),\n atan: atan(0.5),\n sin: sin(-1e300),\n sinh: sinh(1),\n sinhPf: sinhPf(1),\n cos: cos(10.000000000123),\n cosh: cosh(1),\n coshPf: coshPf(1),\n tan: tan(-1e300),\n tanh: tanh(1),\n tanhPf: tanhPf(1),\n exp: exp(1),\n expm1: expm1(1),\n expm1Pf: expm1Pf(1),\n log1p: log1p(10),\n log1pPf: log1pPf(10),\n powPI: powPI(-100)\n };\n}\n/**\n * We use m or w because these two characters take up the maximum width.\n * Also there are a couple of ligatures.\n */\n\n\nvar defaultText = 'mmMwWLliI0fiflO&1';\n/**\n * Settings of text blocks to measure. The keys are random but persistent words.\n */\n\nvar presets = {\n /**\n * The default font. User can change it in desktop Chrome, desktop Firefox, IE 11,\n * Android Chrome (but only when the size is ≥ than the default) and Android Firefox.\n */\n default: [],\n\n /** OS font on macOS. User can change its size and weight. Applies after Safari restart. */\n apple: [{\n font: '-apple-system-body'\n }],\n\n /** User can change it in desktop Chrome and desktop Firefox. */\n serif: [{\n fontFamily: 'serif'\n }],\n\n /** User can change it in desktop Chrome and desktop Firefox. */\n sans: [{\n fontFamily: 'sans-serif'\n }],\n\n /** User can change it in desktop Chrome and desktop Firefox. */\n mono: [{\n fontFamily: 'monospace'\n }],\n\n /**\n * Check the smallest allowed font size. User can change it in desktop Chrome, desktop Firefox and desktop Safari.\n * The height can be 0 in Chrome on a retina display.\n */\n min: [{\n fontSize: '1px'\n }],\n\n /** Tells one OS from another in desktop Chrome. */\n system: [{\n fontFamily: 'system-ui'\n }]\n};\n/**\n * The result is a dictionary of the width of the text samples.\n * Heights aren't included because they give no extra entropy and are unstable.\n *\n * The result is very stable in IE 11, Edge 18 and Safari 14.\n * The result changes when the OS pixel density changes in Chromium 87. The real pixel density is required to solve,\n * but seems like it's impossible: https://stackoverflow.com/q/1713771/1118709.\n * The \"min\" and the \"mono\" (only on Windows) value may change when the page is zoomed in Firefox 87.\n */\n\nfunction getFontPreferences() {\n return withNaturalFonts(function (document, container) {\n var elements = {};\n var sizes = {}; // First create all elements to measure. If the DOM steps below are done in a single cycle,\n // browser will alternate tree modification and layout reading, that is very slow.\n\n for (var _i = 0, _a = Object.keys(presets); _i < _a.length; _i++) {\n var key = _a[_i];\n var _b = presets[key],\n _c = _b[0],\n style = _c === void 0 ? {} : _c,\n _d = _b[1],\n text = _d === void 0 ? defaultText : _d;\n var element = document.createElement('span');\n element.textContent = text;\n element.style.whiteSpace = 'nowrap';\n\n for (var _e = 0, _f = Object.keys(style); _e < _f.length; _e++) {\n var name_1 = _f[_e];\n var value = style[name_1];\n\n if (value !== undefined) {\n element.style[name_1] = value;\n }\n }\n\n elements[key] = element;\n container.appendChild(document.createElement('br'));\n container.appendChild(element);\n } // Then measure the created elements\n\n\n for (var _g = 0, _h = Object.keys(presets); _g < _h.length; _g++) {\n var key = _h[_g];\n sizes[key] = elements[key].getBoundingClientRect().width;\n }\n\n return sizes;\n });\n}\n/**\n * Creates a DOM environment that provides the most natural font available, including Android OS font.\n * Measurements of the elements are zoom-independent.\n * Don't put a content to measure inside an absolutely positioned element.\n */\n\n\nfunction withNaturalFonts(action, containerWidthPx) {\n if (containerWidthPx === void 0) {\n containerWidthPx = 4000;\n }\n /*\n * Requirements for Android Chrome to apply the system font size to a text inside an iframe:\n * - The iframe mustn't have a `display: none;` style;\n * - The text mustn't be positioned absolutely;\n * - The text block must be wide enough.\n * 2560px on some devices in portrait orientation for the biggest font size option (32px);\n * - There must be much enough text to form a few lines (I don't know the exact numbers);\n * - The text must have the `text-size-adjust: none` style. Otherwise the text will scale in \"Desktop site\" mode;\n *\n * Requirements for Android Firefox to apply the system font size to a text inside an iframe:\n * - The iframe document must have a header: `<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />`.\n * The only way to set it is to use the `srcdoc` attribute of the iframe;\n * - The iframe content must get loaded before adding extra content with JavaScript;\n *\n * https://example.com as the iframe target always inherits Android font settings so it can be used as a reference.\n *\n * Observations on how page zoom affects the measurements:\n * - macOS Safari 11.1, 12.1, 13.1, 14.0: zoom reset + offsetWidth = 100% reliable;\n * - macOS Safari 11.1, 12.1, 13.1, 14.0: zoom reset + getBoundingClientRect = 100% reliable;\n * - macOS Safari 14.0: offsetWidth = 5% fluctuation;\n * - macOS Safari 14.0: getBoundingClientRect = 5% fluctuation;\n * - iOS Safari 9, 10, 11.0, 12.0: haven't found a way to zoom a page (pinch doesn't change layout);\n * - iOS Safari 13.1, 14.0: zoom reset + offsetWidth = 100% reliable;\n * - iOS Safari 13.1, 14.0: zoom reset + getBoundingClientRect = 100% reliable;\n * - iOS Safari 14.0: offsetWidth = 100% reliable;\n * - iOS Safari 14.0: getBoundingClientRect = 100% reliable;\n * - Chrome 42, 65, 80, 87: zoom 1/devicePixelRatio + offsetWidth = 1px fluctuation;\n * - Chrome 42, 65, 80, 87: zoom 1/devicePixelRatio + getBoundingClientRect = 100% reliable;\n * - Chrome 87: offsetWidth = 1px fluctuation;\n * - Chrome 87: getBoundingClientRect = 0.7px fluctuation;\n * - Firefox 48, 51: offsetWidth = 10% fluctuation;\n * - Firefox 48, 51: getBoundingClientRect = 10% fluctuation;\n * - Firefox 52, 53, 57, 62, 66, 67, 68, 71, 75, 80, 84: offsetWidth = width 100% reliable, height 10% fluctuation;\n * - Firefox 52, 53, 57, 62, 66, 67, 68, 71, 75, 80, 84: getBoundingClientRect = width 100% reliable, height 10%\n * fluctuation;\n * - Android Chrome 86: haven't found a way to zoom a page (pinch doesn't change layout);\n * - Android Firefox 84: font size in accessibility settings changes all the CSS sizes, but offsetWidth and\n * getBoundingClientRect keep measuring with regular units, so the size reflects the font size setting and doesn't\n * fluctuate;\n * - IE 11, Edge 18: zoom 1/devicePixelRatio + offsetWidth = 100% reliable;\n * - IE 11, Edge 18: zoom 1/devicePixelRatio + getBoundingClientRect = reflects the zoom level;\n * - IE 11, Edge 18: offsetWidth = 100% reliable;\n * - IE 11, Edge 18: getBoundingClientRect = 100% reliable;\n */\n\n\n return withIframe(function (_, iframeWindow) {\n var iframeDocument = iframeWindow.document;\n var iframeBody = iframeDocument.body;\n var bodyStyle = iframeBody.style;\n bodyStyle.width = containerWidthPx + \"px\";\n bodyStyle.webkitTextSizeAdjust = bodyStyle.textSizeAdjust = 'none'; // See the big comment above\n\n if (isChromium()) {\n iframeBody.style.zoom = \"\" + 1 / iframeWindow.devicePixelRatio;\n } else if (isWebKit()) {\n iframeBody.style.zoom = 'reset';\n } // See the big comment above\n\n\n var linesOfText = iframeDocument.createElement('div');\n linesOfText.textContent = Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__spreadArrays\"])(Array(containerWidthPx / 20 << 0)).map(function () {\n return 'word';\n }).join(' ');\n iframeBody.appendChild(linesOfText);\n return action(iframeDocument, iframeBody);\n }, '<!doctype html><html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">');\n}\n/**\n * The list of entropy sources used to make visitor identifiers.\n *\n * This value isn't restricted by Semantic Versioning, i.e. it may be changed without bumping minor or major version of\n * this package.\n *\n * Note: Rollup and Webpack are smart enough to remove unused properties of this object during tree-shaking, so there is\n * no need to export the sources individually.\n */\n\n\nvar sources = {\n // READ FIRST:\n // See https://github.com/fingerprintjs/fingerprintjs/blob/master/contributing.md#how-to-make-an-entropy-source\n // to learn how entropy source works and how to make your own.\n // The sources run in this exact order.\n // The asynchronous sources are at the start to run in parallel with other sources.\n fonts: getFonts,\n domBlockers: getDomBlockers,\n fontPreferences: getFontPreferences,\n audio: getAudioFingerprint,\n screenFrame: getRoundedScreenFrame,\n osCpu: getOsCpu,\n languages: getLanguages,\n colorDepth: getColorDepth,\n deviceMemory: getDeviceMemory,\n screenResolution: getScreenResolution,\n hardwareConcurrency: getHardwareConcurrency,\n timezone: getTimezone,\n sessionStorage: getSessionStorage,\n localStorage: getLocalStorage,\n indexedDB: getIndexedDB,\n openDatabase: getOpenDatabase,\n cpuClass: getCpuClass,\n platform: getPlatform,\n plugins: getPlugins,\n canvas: getCanvasFingerprint,\n touchSupport: getTouchSupport,\n vendor: getVendor,\n vendorFlavors: getVendorFlavors,\n cookiesEnabled: areCookiesEnabled,\n colorGamut: getColorGamut,\n invertedColors: areColorsInverted,\n forcedColors: areColorsForced,\n monochrome: getMonochromeDepth,\n contrast: getContrastPreference,\n reducedMotion: isMotionReduced,\n hdr: isHDR,\n math: getMathFingerprint\n};\n/**\n * Loads the built-in entropy sources.\n * Returns a function that collects the entropy components to make the visitor identifier.\n */\n\nfunction loadBuiltinSources(options) {\n return loadSources(sources, options, []);\n}\n\nvar commentTemplate = '$ if upgrade to Pro: https://fpjs.dev/pro';\n\nfunction getConfidence(components) {\n var openConfidenceScore = getOpenConfidenceScore(components);\n var proConfidenceScore = deriveProConfidenceScore(openConfidenceScore);\n return {\n score: openConfidenceScore,\n comment: commentTemplate.replace(/\\$/g, \"\" + proConfidenceScore)\n };\n}\n\nfunction getOpenConfidenceScore(components) {\n // In order to calculate the true probability of the visitor identifier being correct, we need to know the number of\n // website visitors (the higher the number, the less the probability because the fingerprint entropy is limited).\n // JS agent doesn't know the number of visitors, so we can only do an approximate assessment.\n if (isAndroid()) {\n return 0.4;\n } // Safari (mobile and desktop)\n\n\n if (isWebKit()) {\n return isDesktopSafari() ? 0.5 : 0.3;\n }\n\n var platform = components.platform.value || ''; // Windows\n\n if (/^Win/.test(platform)) {\n // The score is greater than on macOS because of the higher variety of devices running Windows.\n // Chrome provides more entropy than Firefox according too\n // https://netmarketshare.com/browser-market-share.aspx?options=%7B%22filter%22%3A%7B%22%24and%22%3A%5B%7B%22platform%22%3A%7B%22%24in%22%3A%5B%22Windows%22%5D%7D%7D%5D%7D%2C%22dateLabel%22%3A%22Trend%22%2C%22attributes%22%3A%22share%22%2C%22group%22%3A%22browser%22%2C%22sort%22%3A%7B%22share%22%3A-1%7D%2C%22id%22%3A%22browsersDesktop%22%2C%22dateInterval%22%3A%22Monthly%22%2C%22dateStart%22%3A%222019-11%22%2C%22dateEnd%22%3A%222020-10%22%2C%22segments%22%3A%22-1000%22%7D\n // So we assign the same score to them.\n return 0.6;\n } // macOS\n\n\n if (/^Mac/.test(platform)) {\n // Chrome provides more entropy than Safari and Safari provides more entropy than Firefox.\n // Chrome is more popular than Safari and Safari is more popular than Firefox according to\n // https://netmarketshare.com/browser-market-share.aspx?options=%7B%22filter%22%3A%7B%22%24and%22%3A%5B%7B%22platform%22%3A%7B%22%24in%22%3A%5B%22Mac%20OS%22%5D%7D%7D%5D%7D%2C%22dateLabel%22%3A%22Trend%22%2C%22attributes%22%3A%22share%22%2C%22group%22%3A%22browser%22%2C%22sort%22%3A%7B%22share%22%3A-1%7D%2C%22id%22%3A%22browsersDesktop%22%2C%22dateInterval%22%3A%22Monthly%22%2C%22dateStart%22%3A%222019-11%22%2C%22dateEnd%22%3A%222020-10%22%2C%22segments%22%3A%22-1000%22%7D\n // So we assign the same score to them.\n return 0.5;\n } // Another platform, e.g. a desktop Linux. It's rare, so it should be pretty unique.\n\n\n return 0.7;\n}\n\nfunction deriveProConfidenceScore(openConfidenceScore) {\n return round(0.99 + 0.01 * openConfidenceScore, 0.0001);\n}\n\nfunction componentsToCanonicalString(components) {\n var result = '';\n\n for (var _i = 0, _a = Object.keys(components).sort(); _i < _a.length; _i++) {\n var componentKey = _a[_i];\n var component = components[componentKey];\n var value = component.error ? 'error' : JSON.stringify(component.value);\n result += \"\" + (result ? '|' : '') + componentKey.replace(/([:|\\\\])/g, '\\\\$1') + \":\" + value;\n }\n\n return result;\n}\n\nfunction componentsToDebugString(components) {\n return JSON.stringify(components, function (_key, value) {\n if (value instanceof Error) {\n return errorToObject(value);\n }\n\n return value;\n }, 2);\n}\n\nfunction hashComponents(components) {\n return x64hash128(componentsToCanonicalString(components));\n}\n/**\n * Makes a GetResult implementation that calculates the visitor id hash on demand.\n * Designed for optimisation.\n */\n\n\nfunction makeLazyGetResult(components) {\n var visitorIdCache; // This function runs very fast, so there is no need to make it lazy\n\n var confidence = getConfidence(components); // A plain class isn't used because its getters and setters aren't enumerable.\n\n return {\n get visitorId() {\n if (visitorIdCache === undefined) {\n visitorIdCache = hashComponents(this.components);\n }\n\n return visitorIdCache;\n },\n\n set visitorId(visitorId) {\n visitorIdCache = visitorId;\n },\n\n confidence: confidence,\n components: components,\n version: version\n };\n}\n/**\n * A delay is required to ensure consistent entropy components.\n * See https://github.com/fingerprintjs/fingerprintjs/issues/254\n * and https://github.com/fingerprintjs/fingerprintjs/issues/307\n * and https://github.com/fingerprintjs/fingerprintjs/commit/945633e7c5f67ae38eb0fea37349712f0e669b18\n */\n\n\nfunction prepareForSources(delayFallback) {\n if (delayFallback === void 0) {\n delayFallback = 50;\n } // A proper deadline is unknown. Let it be twice the fallback timeout so that both cases have the same average time.\n\n\n return requestIdleCallbackIfAvailable(delayFallback, delayFallback * 2);\n}\n/**\n * The function isn't exported from the index file to not allow to call it without `load()`.\n * The hiding gives more freedom for future non-breaking updates.\n *\n * A factory function is used instead of a class to shorten the attribute names in the minified code.\n * Native private class fields could've been used, but TypeScript doesn't allow them with `\"target\": \"es5\"`.\n */\n\n\nfunction makeAgent(getComponents, debug) {\n var creationTime = Date.now();\n return {\n get: function (options) {\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__awaiter\"])(this, void 0, void 0, function () {\n var startTime, components, result;\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__generator\"])(this, function (_a) {\n switch (_a.label) {\n case 0:\n startTime = Date.now();\n return [4\n /*yield*/\n , getComponents()];\n\n case 1:\n components = _a.sent();\n result = makeLazyGetResult(components);\n\n if (debug || (options === null || options === void 0 ? void 0 : options.debug)) {\n // console.log is ok here because it's under a debug clause\n // eslint-disable-next-line no-console\n console.log(\"Copy the text below to get the debug data:\\n\\n```\\nversion: \" + result.version + \"\\nuserAgent: \" + navigator.userAgent + \"\\ntimeBetweenLoadAndGet: \" + (startTime - creationTime) + \"\\nvisitorId: \" + result.visitorId + \"\\ncomponents: \" + componentsToDebugString(components) + \"\\n```\");\n }\n\n return [2\n /*return*/\n , result];\n }\n });\n });\n }\n };\n}\n/**\n * Sends an unpersonalized AJAX request to collect installation statistics\n */\n\n\nfunction monitor() {\n // The FingerprintJS CDN (https://github.com/fingerprintjs/cdn) replaces `window.__fpjs_d_m` with `true`\n if (window.__fpjs_d_m || Math.random() >= 0.001) {\n return;\n }\n\n try {\n var request = new XMLHttpRequest();\n request.open('get', \"https://m1.openfpcdn.io/fingerprintjs/v\" + version + \"/npm-monitoring\", true);\n request.send();\n } catch (error) {\n // console.error is ok here because it's an unexpected error handler\n // eslint-disable-next-line no-console\n console.error(error);\n }\n}\n/**\n * Builds an instance of Agent and waits a delay required for a proper operation.\n */\n\n\nfunction load(_a) {\n var _b = _a === void 0 ? {} : _a,\n delayFallback = _b.delayFallback,\n debug = _b.debug,\n _c = _b.monitoring,\n monitoring = _c === void 0 ? true : _c;\n\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__awaiter\"])(this, void 0, void 0, function () {\n var getComponents;\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__generator\"])(this, function (_d) {\n switch (_d.label) {\n case 0:\n if (monitoring) {\n monitor();\n }\n\n return [4\n /*yield*/\n , prepareForSources(delayFallback)];\n\n case 1:\n _d.sent();\n\n getComponents = loadBuiltinSources({\n debug: debug\n });\n return [2\n /*return*/\n , makeAgent(getComponents, debug)];\n }\n });\n });\n} // The default export is a syntax sugar (`import * as FP from '...' → import FP from '...'`).\n// It should contain all the public exported values.\n\n\nvar index = {\n load: load,\n hashComponents: hashComponents,\n componentsToDebugString: componentsToDebugString\n}; // The exports below are for private usage. They may change unexpectedly. Use them at your own risk.\n\n/** Not documented, out of Semantic Versioning, usage is at your own risk */\n\nvar murmurX64Hash128 = x64hash128;\n\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/@fingerprintjs/fingerprintjs/dist/fp.esm.js?");
|
|
773
773
|
|
|
774
774
|
/***/ }),
|
|
775
775
|
|
|
@@ -2809,6 +2809,18 @@ eval("\n\nvar fails = __webpack_require__(/*! ../internals/fails */ \"./node_mod
|
|
|
2809
2809
|
|
|
2810
2810
|
/***/ }),
|
|
2811
2811
|
|
|
2812
|
+
/***/ "./node_modules/core-js-pure/internals/array-set-length.js":
|
|
2813
|
+
/*!*****************************************************************!*\
|
|
2814
|
+
!*** ./node_modules/core-js-pure/internals/array-set-length.js ***!
|
|
2815
|
+
\*****************************************************************/
|
|
2816
|
+
/*! no static exports found */
|
|
2817
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2818
|
+
|
|
2819
|
+
"use strict";
|
|
2820
|
+
eval("\n\nvar DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ \"./node_modules/core-js-pure/internals/descriptors.js\");\n\nvar isArray = __webpack_require__(/*! ../internals/is-array */ \"./node_modules/core-js-pure/internals/is-array.js\");\n\nvar $TypeError = TypeError; // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe\n\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // Safari < 13 does not throw an error in this case\n\nvar SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function () {\n // makes no sense without proper strict mode support\n if (this !== undefined) return true;\n\n try {\n // eslint-disable-next-line es-x/no-object-defineproperty -- safe\n Object.defineProperty([], 'length', {\n writable: false\n }).length = 1;\n } catch (error) {\n return error instanceof TypeError;\n }\n}();\nmodule.exports = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) {\n if (isArray(O) && !getOwnPropertyDescriptor(O, 'length').writable) {\n throw $TypeError('Cannot set read only .length');\n }\n\n return O.length = length;\n} : function (O, length) {\n return O.length = length;\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/array-set-length.js?");
|
|
2821
|
+
|
|
2822
|
+
/***/ }),
|
|
2823
|
+
|
|
2812
2824
|
/***/ "./node_modules/core-js-pure/internals/array-slice-simple.js":
|
|
2813
2825
|
/*!*******************************************************************!*\
|
|
2814
2826
|
!*** ./node_modules/core-js-pure/internals/array-slice-simple.js ***!
|
|
@@ -2908,17 +2920,6 @@ eval("var TO_STRING_TAG_SUPPORT = __webpack_require__(/*! ../internals/to-string
|
|
|
2908
2920
|
|
|
2909
2921
|
/***/ }),
|
|
2910
2922
|
|
|
2911
|
-
/***/ "./node_modules/core-js-pure/internals/clear-error-stack.js":
|
|
2912
|
-
/*!******************************************************************!*\
|
|
2913
|
-
!*** ./node_modules/core-js-pure/internals/clear-error-stack.js ***!
|
|
2914
|
-
\******************************************************************/
|
|
2915
|
-
/*! no static exports found */
|
|
2916
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
2917
|
-
|
|
2918
|
-
eval("var uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ \"./node_modules/core-js-pure/internals/function-uncurry-this.js\");\n\nvar $Error = Error;\nvar replace = uncurryThis(''.replace);\n\nvar TEST = function (arg) {\n return String($Error(arg).stack);\n}('zxcasd');\n\nvar V8_OR_CHAKRA_STACK_ENTRY = /\\n\\s*at [^:]*:[^\\n]*/;\nvar IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);\n\nmodule.exports = function (stack, dropEntries) {\n if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) {\n while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, '');\n }\n\n return stack;\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/clear-error-stack.js?");
|
|
2919
|
-
|
|
2920
|
-
/***/ }),
|
|
2921
|
-
|
|
2922
2923
|
/***/ "./node_modules/core-js-pure/internals/collection-weak.js":
|
|
2923
2924
|
/*!****************************************************************!*\
|
|
2924
2925
|
!*** ./node_modules/core-js-pure/internals/collection-weak.js ***!
|
|
@@ -2927,7 +2928,7 @@ eval("var uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-th
|
|
|
2927
2928
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2928
2929
|
|
|
2929
2930
|
"use strict";
|
|
2930
|
-
eval("\n\nvar uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ \"./node_modules/core-js-pure/internals/function-uncurry-this.js\");\n\nvar defineBuiltIns = __webpack_require__(/*! ../internals/define-built-ins */ \"./node_modules/core-js-pure/internals/define-built-ins.js\");\n\nvar getWeakData = __webpack_require__(/*! ../internals/internal-metadata */ \"./node_modules/core-js-pure/internals/internal-metadata.js\").getWeakData;\n\nvar anObject = __webpack_require__(/*! ../internals/an-object */ \"./node_modules/core-js-pure/internals/an-object.js\");\n\nvar
|
|
2931
|
+
eval("\n\nvar uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ \"./node_modules/core-js-pure/internals/function-uncurry-this.js\");\n\nvar defineBuiltIns = __webpack_require__(/*! ../internals/define-built-ins */ \"./node_modules/core-js-pure/internals/define-built-ins.js\");\n\nvar getWeakData = __webpack_require__(/*! ../internals/internal-metadata */ \"./node_modules/core-js-pure/internals/internal-metadata.js\").getWeakData;\n\nvar anInstance = __webpack_require__(/*! ../internals/an-instance */ \"./node_modules/core-js-pure/internals/an-instance.js\");\n\nvar anObject = __webpack_require__(/*! ../internals/an-object */ \"./node_modules/core-js-pure/internals/an-object.js\");\n\nvar isNullOrUndefined = __webpack_require__(/*! ../internals/is-null-or-undefined */ \"./node_modules/core-js-pure/internals/is-null-or-undefined.js\");\n\nvar isObject = __webpack_require__(/*! ../internals/is-object */ \"./node_modules/core-js-pure/internals/is-object.js\");\n\nvar iterate = __webpack_require__(/*! ../internals/iterate */ \"./node_modules/core-js-pure/internals/iterate.js\");\n\nvar ArrayIterationModule = __webpack_require__(/*! ../internals/array-iteration */ \"./node_modules/core-js-pure/internals/array-iteration.js\");\n\nvar hasOwn = __webpack_require__(/*! ../internals/has-own-property */ \"./node_modules/core-js-pure/internals/has-own-property.js\");\n\nvar InternalStateModule = __webpack_require__(/*! ../internals/internal-state */ \"./node_modules/core-js-pure/internals/internal-state.js\");\n\nvar setInternalState = InternalStateModule.set;\nvar internalStateGetterFor = InternalStateModule.getterFor;\nvar find = ArrayIterationModule.find;\nvar findIndex = ArrayIterationModule.findIndex;\nvar splice = uncurryThis([].splice);\nvar id = 0; // fallback for uncaught frozen keys\n\nvar uncaughtFrozenStore = function (store) {\n return store.frozen || (store.frozen = new UncaughtFrozenStore());\n};\n\nvar UncaughtFrozenStore = function () {\n this.entries = [];\n};\n\nvar findUncaughtFrozen = function (store, key) {\n return find(store.entries, function (it) {\n return it[0] === key;\n });\n};\n\nUncaughtFrozenStore.prototype = {\n get: function (key) {\n var entry = findUncaughtFrozen(this, key);\n if (entry) return entry[1];\n },\n has: function (key) {\n return !!findUncaughtFrozen(this, key);\n },\n set: function (key, value) {\n var entry = findUncaughtFrozen(this, key);\n if (entry) entry[1] = value;else this.entries.push([key, value]);\n },\n 'delete': function (key) {\n var index = findIndex(this.entries, function (it) {\n return it[0] === key;\n });\n if (~index) splice(this.entries, index, 1);\n return !!~index;\n }\n};\nmodule.exports = {\n getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {\n var Constructor = wrapper(function (that, iterable) {\n anInstance(that, Prototype);\n setInternalState(that, {\n type: CONSTRUCTOR_NAME,\n id: id++,\n frozen: undefined\n });\n if (!isNullOrUndefined(iterable)) iterate(iterable, that[ADDER], {\n that: that,\n AS_ENTRIES: IS_MAP\n });\n });\n var Prototype = Constructor.prototype;\n var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);\n\n var define = function (that, key, value) {\n var state = getInternalState(that);\n var data = getWeakData(anObject(key), true);\n if (data === true) uncaughtFrozenStore(state).set(key, value);else data[state.id] = value;\n return that;\n };\n\n defineBuiltIns(Prototype, {\n // `{ WeakMap, WeakSet }.prototype.delete(key)` methods\n // https://tc39.es/ecma262/#sec-weakmap.prototype.delete\n // https://tc39.es/ecma262/#sec-weakset.prototype.delete\n 'delete': function (key) {\n var state = getInternalState(this);\n if (!isObject(key)) return false;\n var data = getWeakData(key);\n if (data === true) return uncaughtFrozenStore(state)['delete'](key);\n return data && hasOwn(data, state.id) && delete data[state.id];\n },\n // `{ WeakMap, WeakSet }.prototype.has(key)` methods\n // https://tc39.es/ecma262/#sec-weakmap.prototype.has\n // https://tc39.es/ecma262/#sec-weakset.prototype.has\n has: function has(key) {\n var state = getInternalState(this);\n if (!isObject(key)) return false;\n var data = getWeakData(key);\n if (data === true) return uncaughtFrozenStore(state).has(key);\n return data && hasOwn(data, state.id);\n }\n });\n defineBuiltIns(Prototype, IS_MAP ? {\n // `WeakMap.prototype.get(key)` method\n // https://tc39.es/ecma262/#sec-weakmap.prototype.get\n get: function get(key) {\n var state = getInternalState(this);\n\n if (isObject(key)) {\n var data = getWeakData(key);\n if (data === true) return uncaughtFrozenStore(state).get(key);\n return data ? data[state.id] : undefined;\n }\n },\n // `WeakMap.prototype.set(key, value)` method\n // https://tc39.es/ecma262/#sec-weakmap.prototype.set\n set: function set(key, value) {\n return define(this, key, value);\n }\n } : {\n // `WeakSet.prototype.add(value)` method\n // https://tc39.es/ecma262/#sec-weakset.prototype.add\n add: function add(value) {\n return define(this, value, true);\n }\n });\n return Constructor;\n }\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/collection-weak.js?");
|
|
2931
2932
|
|
|
2932
2933
|
/***/ }),
|
|
2933
2934
|
|
|
@@ -2976,15 +2977,14 @@ eval("var fails = __webpack_require__(/*! ../internals/fails */ \"./node_modules
|
|
|
2976
2977
|
|
|
2977
2978
|
/***/ }),
|
|
2978
2979
|
|
|
2979
|
-
/***/ "./node_modules/core-js-pure/internals/create-
|
|
2980
|
-
|
|
2981
|
-
!*** ./node_modules/core-js-pure/internals/create-
|
|
2982
|
-
|
|
2980
|
+
/***/ "./node_modules/core-js-pure/internals/create-iter-result-object.js":
|
|
2981
|
+
/*!**************************************************************************!*\
|
|
2982
|
+
!*** ./node_modules/core-js-pure/internals/create-iter-result-object.js ***!
|
|
2983
|
+
\**************************************************************************/
|
|
2983
2984
|
/*! no static exports found */
|
|
2984
|
-
/***/ (function(module, exports
|
|
2985
|
+
/***/ (function(module, exports) {
|
|
2985
2986
|
|
|
2986
|
-
"
|
|
2987
|
-
eval("\n\nvar IteratorPrototype = __webpack_require__(/*! ../internals/iterators-core */ \"./node_modules/core-js-pure/internals/iterators-core.js\").IteratorPrototype;\n\nvar create = __webpack_require__(/*! ../internals/object-create */ \"./node_modules/core-js-pure/internals/object-create.js\");\n\nvar createPropertyDescriptor = __webpack_require__(/*! ../internals/create-property-descriptor */ \"./node_modules/core-js-pure/internals/create-property-descriptor.js\");\n\nvar setToStringTag = __webpack_require__(/*! ../internals/set-to-string-tag */ \"./node_modules/core-js-pure/internals/set-to-string-tag.js\");\n\nvar Iterators = __webpack_require__(/*! ../internals/iterators */ \"./node_modules/core-js-pure/internals/iterators.js\");\n\nvar returnThis = function () {\n return this;\n};\n\nmodule.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {\n var TO_STRING_TAG = NAME + ' Iterator';\n IteratorConstructor.prototype = create(IteratorPrototype, {\n next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next)\n });\n setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);\n Iterators[TO_STRING_TAG] = returnThis;\n return IteratorConstructor;\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/create-iterator-constructor.js?");
|
|
2987
|
+
eval("// `CreateIterResultObject` abstract operation\n// https://tc39.es/ecma262/#sec-createiterresultobject\nmodule.exports = function (value, done) {\n return {\n value: value,\n done: done\n };\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/create-iter-result-object.js?");
|
|
2988
2988
|
|
|
2989
2989
|
/***/ }),
|
|
2990
2990
|
|
|
@@ -3055,29 +3055,6 @@ eval("var global = __webpack_require__(/*! ../internals/global */ \"./node_modul
|
|
|
3055
3055
|
|
|
3056
3056
|
/***/ }),
|
|
3057
3057
|
|
|
3058
|
-
/***/ "./node_modules/core-js-pure/internals/define-iterator.js":
|
|
3059
|
-
/*!****************************************************************!*\
|
|
3060
|
-
!*** ./node_modules/core-js-pure/internals/define-iterator.js ***!
|
|
3061
|
-
\****************************************************************/
|
|
3062
|
-
/*! no static exports found */
|
|
3063
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
3064
|
-
|
|
3065
|
-
"use strict";
|
|
3066
|
-
eval("\n\nvar $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar call = __webpack_require__(/*! ../internals/function-call */ \"./node_modules/core-js-pure/internals/function-call.js\");\n\nvar IS_PURE = __webpack_require__(/*! ../internals/is-pure */ \"./node_modules/core-js-pure/internals/is-pure.js\");\n\nvar FunctionName = __webpack_require__(/*! ../internals/function-name */ \"./node_modules/core-js-pure/internals/function-name.js\");\n\nvar isCallable = __webpack_require__(/*! ../internals/is-callable */ \"./node_modules/core-js-pure/internals/is-callable.js\");\n\nvar createIteratorConstructor = __webpack_require__(/*! ../internals/create-iterator-constructor */ \"./node_modules/core-js-pure/internals/create-iterator-constructor.js\");\n\nvar getPrototypeOf = __webpack_require__(/*! ../internals/object-get-prototype-of */ \"./node_modules/core-js-pure/internals/object-get-prototype-of.js\");\n\nvar setPrototypeOf = __webpack_require__(/*! ../internals/object-set-prototype-of */ \"./node_modules/core-js-pure/internals/object-set-prototype-of.js\");\n\nvar setToStringTag = __webpack_require__(/*! ../internals/set-to-string-tag */ \"./node_modules/core-js-pure/internals/set-to-string-tag.js\");\n\nvar createNonEnumerableProperty = __webpack_require__(/*! ../internals/create-non-enumerable-property */ \"./node_modules/core-js-pure/internals/create-non-enumerable-property.js\");\n\nvar defineBuiltIn = __webpack_require__(/*! ../internals/define-built-in */ \"./node_modules/core-js-pure/internals/define-built-in.js\");\n\nvar wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ \"./node_modules/core-js-pure/internals/well-known-symbol.js\");\n\nvar Iterators = __webpack_require__(/*! ../internals/iterators */ \"./node_modules/core-js-pure/internals/iterators.js\");\n\nvar IteratorsCore = __webpack_require__(/*! ../internals/iterators-core */ \"./node_modules/core-js-pure/internals/iterators-core.js\");\n\nvar PROPER_FUNCTION_NAME = FunctionName.PROPER;\nvar CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;\nvar IteratorPrototype = IteratorsCore.IteratorPrototype;\nvar BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;\nvar ITERATOR = wellKnownSymbol('iterator');\nvar KEYS = 'keys';\nvar VALUES = 'values';\nvar ENTRIES = 'entries';\n\nvar returnThis = function () {\n return this;\n};\n\nmodule.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {\n createIteratorConstructor(IteratorConstructor, NAME, next);\n\n var getIterationMethod = function (KIND) {\n if (KIND === DEFAULT && defaultIterator) return defaultIterator;\n if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];\n\n switch (KIND) {\n case KEYS:\n return function keys() {\n return new IteratorConstructor(this, KIND);\n };\n\n case VALUES:\n return function values() {\n return new IteratorConstructor(this, KIND);\n };\n\n case ENTRIES:\n return function entries() {\n return new IteratorConstructor(this, KIND);\n };\n }\n\n return function () {\n return new IteratorConstructor(this);\n };\n };\n\n var TO_STRING_TAG = NAME + ' Iterator';\n var INCORRECT_VALUES_NAME = false;\n var IterablePrototype = Iterable.prototype;\n var nativeIterator = IterablePrototype[ITERATOR] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT];\n var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);\n var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;\n var CurrentIteratorPrototype, methods, KEY; // fix native\n\n if (anyNativeIterator) {\n CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));\n\n if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {\n if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {\n if (setPrototypeOf) {\n setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);\n } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) {\n defineBuiltIn(CurrentIteratorPrototype, ITERATOR, returnThis);\n }\n } // Set @@toStringTag to native iterators\n\n\n setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);\n if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;\n }\n } // fix Array.prototype.{ values, @@iterator }.name in V8 / FF\n\n\n if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {\n if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) {\n createNonEnumerableProperty(IterablePrototype, 'name', VALUES);\n } else {\n INCORRECT_VALUES_NAME = true;\n\n defaultIterator = function values() {\n return call(nativeIterator, this);\n };\n }\n } // export additional methods\n\n\n if (DEFAULT) {\n methods = {\n values: getIterationMethod(VALUES),\n keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),\n entries: getIterationMethod(ENTRIES)\n };\n if (FORCED) for (KEY in methods) {\n if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {\n defineBuiltIn(IterablePrototype, KEY, methods[KEY]);\n }\n } else $({\n target: NAME,\n proto: true,\n forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME\n }, methods);\n } // define iterator\n\n\n if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {\n defineBuiltIn(IterablePrototype, ITERATOR, defaultIterator, {\n name: DEFAULT\n });\n }\n\n Iterators[NAME] = defaultIterator;\n return methods;\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/define-iterator.js?");
|
|
3067
|
-
|
|
3068
|
-
/***/ }),
|
|
3069
|
-
|
|
3070
|
-
/***/ "./node_modules/core-js-pure/internals/define-well-known-symbol.js":
|
|
3071
|
-
/*!*************************************************************************!*\
|
|
3072
|
-
!*** ./node_modules/core-js-pure/internals/define-well-known-symbol.js ***!
|
|
3073
|
-
\*************************************************************************/
|
|
3074
|
-
/*! no static exports found */
|
|
3075
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
3076
|
-
|
|
3077
|
-
eval("var path = __webpack_require__(/*! ../internals/path */ \"./node_modules/core-js-pure/internals/path.js\");\n\nvar hasOwn = __webpack_require__(/*! ../internals/has-own-property */ \"./node_modules/core-js-pure/internals/has-own-property.js\");\n\nvar wrappedWellKnownSymbolModule = __webpack_require__(/*! ../internals/well-known-symbol-wrapped */ \"./node_modules/core-js-pure/internals/well-known-symbol-wrapped.js\");\n\nvar defineProperty = __webpack_require__(/*! ../internals/object-define-property */ \"./node_modules/core-js-pure/internals/object-define-property.js\").f;\n\nmodule.exports = function (NAME) {\n var Symbol = path.Symbol || (path.Symbol = {});\n if (!hasOwn(Symbol, NAME)) defineProperty(Symbol, NAME, {\n value: wrappedWellKnownSymbolModule.f(NAME)\n });\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/define-well-known-symbol.js?");
|
|
3078
|
-
|
|
3079
|
-
/***/ }),
|
|
3080
|
-
|
|
3081
3058
|
/***/ "./node_modules/core-js-pure/internals/delete-property-or-throw.js":
|
|
3082
3059
|
/*!*************************************************************************!*\
|
|
3083
3060
|
!*** ./node_modules/core-js-pure/internals/delete-property-or-throw.js ***!
|
|
@@ -3101,6 +3078,17 @@ eval("var fails = __webpack_require__(/*! ../internals/fails */ \"./node_modules
|
|
|
3101
3078
|
|
|
3102
3079
|
/***/ }),
|
|
3103
3080
|
|
|
3081
|
+
/***/ "./node_modules/core-js-pure/internals/document-all.js":
|
|
3082
|
+
/*!*************************************************************!*\
|
|
3083
|
+
!*** ./node_modules/core-js-pure/internals/document-all.js ***!
|
|
3084
|
+
\*************************************************************/
|
|
3085
|
+
/*! no static exports found */
|
|
3086
|
+
/***/ (function(module, exports) {
|
|
3087
|
+
|
|
3088
|
+
eval("var documentAll = typeof document == 'object' && document.all; // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot\n\nvar IS_HTMLDDA = typeof documentAll == 'undefined' && documentAll !== undefined;\nmodule.exports = {\n all: documentAll,\n IS_HTMLDDA: IS_HTMLDDA\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/document-all.js?");
|
|
3089
|
+
|
|
3090
|
+
/***/ }),
|
|
3091
|
+
|
|
3104
3092
|
/***/ "./node_modules/core-js-pure/internals/document-create-element.js":
|
|
3105
3093
|
/*!************************************************************************!*\
|
|
3106
3094
|
!*** ./node_modules/core-js-pure/internals/document-create-element.js ***!
|
|
@@ -3244,6 +3232,17 @@ eval("// IE8- don't enum bug keys\nmodule.exports = ['constructor', 'hasOwnPrope
|
|
|
3244
3232
|
|
|
3245
3233
|
/***/ }),
|
|
3246
3234
|
|
|
3235
|
+
/***/ "./node_modules/core-js-pure/internals/error-stack-clear.js":
|
|
3236
|
+
/*!******************************************************************!*\
|
|
3237
|
+
!*** ./node_modules/core-js-pure/internals/error-stack-clear.js ***!
|
|
3238
|
+
\******************************************************************/
|
|
3239
|
+
/*! no static exports found */
|
|
3240
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3241
|
+
|
|
3242
|
+
eval("var uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ \"./node_modules/core-js-pure/internals/function-uncurry-this.js\");\n\nvar $Error = Error;\nvar replace = uncurryThis(''.replace);\n\nvar TEST = function (arg) {\n return String($Error(arg).stack);\n}('zxcasd');\n\nvar V8_OR_CHAKRA_STACK_ENTRY = /\\n\\s*at [^:]*:[^\\n]*/;\nvar IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);\n\nmodule.exports = function (stack, dropEntries) {\n if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) {\n while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, '');\n }\n\n return stack;\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/error-stack-clear.js?");
|
|
3243
|
+
|
|
3244
|
+
/***/ }),
|
|
3245
|
+
|
|
3247
3246
|
/***/ "./node_modules/core-js-pure/internals/error-stack-installable.js":
|
|
3248
3247
|
/*!************************************************************************!*\
|
|
3249
3248
|
!*** ./node_modules/core-js-pure/internals/error-stack-installable.js ***!
|
|
@@ -3373,7 +3372,7 @@ eval("var path = __webpack_require__(/*! ../internals/path */ \"./node_modules/c
|
|
|
3373
3372
|
/*! no static exports found */
|
|
3374
3373
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3375
3374
|
|
|
3376
|
-
eval("var classof = __webpack_require__(/*! ../internals/classof */ \"./node_modules/core-js-pure/internals/classof.js\");\n\nvar getMethod = __webpack_require__(/*! ../internals/get-method */ \"./node_modules/core-js-pure/internals/get-method.js\");\n\nvar Iterators = __webpack_require__(/*! ../internals/iterators */ \"./node_modules/core-js-pure/internals/iterators.js\");\n\nvar wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ \"./node_modules/core-js-pure/internals/well-known-symbol.js\");\n\nvar ITERATOR = wellKnownSymbol('iterator');\n\nmodule.exports = function (it) {\n if (it
|
|
3375
|
+
eval("var classof = __webpack_require__(/*! ../internals/classof */ \"./node_modules/core-js-pure/internals/classof.js\");\n\nvar getMethod = __webpack_require__(/*! ../internals/get-method */ \"./node_modules/core-js-pure/internals/get-method.js\");\n\nvar isNullOrUndefined = __webpack_require__(/*! ../internals/is-null-or-undefined */ \"./node_modules/core-js-pure/internals/is-null-or-undefined.js\");\n\nvar Iterators = __webpack_require__(/*! ../internals/iterators */ \"./node_modules/core-js-pure/internals/iterators.js\");\n\nvar wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ \"./node_modules/core-js-pure/internals/well-known-symbol.js\");\n\nvar ITERATOR = wellKnownSymbol('iterator');\n\nmodule.exports = function (it) {\n if (!isNullOrUndefined(it)) return getMethod(it, ITERATOR) || getMethod(it, '@@iterator') || Iterators[classof(it)];\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/get-iterator-method.js?");
|
|
3377
3376
|
|
|
3378
3377
|
/***/ }),
|
|
3379
3378
|
|
|
@@ -3395,7 +3394,7 @@ eval("var call = __webpack_require__(/*! ../internals/function-call */ \"./node_
|
|
|
3395
3394
|
/*! no static exports found */
|
|
3396
3395
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3397
3396
|
|
|
3398
|
-
eval("var aCallable = __webpack_require__(/*! ../internals/a-callable */ \"./node_modules/core-js-pure/internals/a-callable.js\"); // `GetMethod` abstract operation\n// https://tc39.es/ecma262/#sec-getmethod\n\n\nmodule.exports = function (V, P) {\n var func = V[P];\n return func
|
|
3397
|
+
eval("var aCallable = __webpack_require__(/*! ../internals/a-callable */ \"./node_modules/core-js-pure/internals/a-callable.js\");\n\nvar isNullOrUndefined = __webpack_require__(/*! ../internals/is-null-or-undefined */ \"./node_modules/core-js-pure/internals/is-null-or-undefined.js\"); // `GetMethod` abstract operation\n// https://tc39.es/ecma262/#sec-getmethod\n\n\nmodule.exports = function (V, P) {\n var func = V[P];\n return isNullOrUndefined(func) ? undefined : aCallable(func);\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/get-method.js?");
|
|
3399
3398
|
|
|
3400
3399
|
/***/ }),
|
|
3401
3400
|
|
|
@@ -3516,7 +3515,7 @@ eval("var $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/co
|
|
|
3516
3515
|
/*! no static exports found */
|
|
3517
3516
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3518
3517
|
|
|
3519
|
-
eval("var NATIVE_WEAK_MAP = __webpack_require__(/*! ../internals/
|
|
3518
|
+
eval("var NATIVE_WEAK_MAP = __webpack_require__(/*! ../internals/weak-map-basic-detection */ \"./node_modules/core-js-pure/internals/weak-map-basic-detection.js\");\n\nvar global = __webpack_require__(/*! ../internals/global */ \"./node_modules/core-js-pure/internals/global.js\");\n\nvar uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ \"./node_modules/core-js-pure/internals/function-uncurry-this.js\");\n\nvar isObject = __webpack_require__(/*! ../internals/is-object */ \"./node_modules/core-js-pure/internals/is-object.js\");\n\nvar createNonEnumerableProperty = __webpack_require__(/*! ../internals/create-non-enumerable-property */ \"./node_modules/core-js-pure/internals/create-non-enumerable-property.js\");\n\nvar hasOwn = __webpack_require__(/*! ../internals/has-own-property */ \"./node_modules/core-js-pure/internals/has-own-property.js\");\n\nvar shared = __webpack_require__(/*! ../internals/shared-store */ \"./node_modules/core-js-pure/internals/shared-store.js\");\n\nvar sharedKey = __webpack_require__(/*! ../internals/shared-key */ \"./node_modules/core-js-pure/internals/shared-key.js\");\n\nvar hiddenKeys = __webpack_require__(/*! ../internals/hidden-keys */ \"./node_modules/core-js-pure/internals/hidden-keys.js\");\n\nvar OBJECT_ALREADY_INITIALIZED = 'Object already initialized';\nvar TypeError = global.TypeError;\nvar WeakMap = global.WeakMap;\nvar set, get, has;\n\nvar enforce = function (it) {\n return has(it) ? get(it) : set(it, {});\n};\n\nvar getterFor = function (TYPE) {\n return function (it) {\n var state;\n\n if (!isObject(it) || (state = get(it)).type !== TYPE) {\n throw TypeError('Incompatible receiver, ' + TYPE + ' required');\n }\n\n return state;\n };\n};\n\nif (NATIVE_WEAK_MAP || shared.state) {\n var store = shared.state || (shared.state = new WeakMap());\n var wmget = uncurryThis(store.get);\n var wmhas = uncurryThis(store.has);\n var wmset = uncurryThis(store.set);\n\n set = function (it, metadata) {\n if (wmhas(store, it)) throw TypeError(OBJECT_ALREADY_INITIALIZED);\n metadata.facade = it;\n wmset(store, it, metadata);\n return metadata;\n };\n\n get = function (it) {\n return wmget(store, it) || {};\n };\n\n has = function (it) {\n return wmhas(store, it);\n };\n} else {\n var STATE = sharedKey('state');\n hiddenKeys[STATE] = true;\n\n set = function (it, metadata) {\n if (hasOwn(it, STATE)) throw TypeError(OBJECT_ALREADY_INITIALIZED);\n metadata.facade = it;\n createNonEnumerableProperty(it, STATE, metadata);\n return metadata;\n };\n\n get = function (it) {\n return hasOwn(it, STATE) ? it[STATE] : {};\n };\n\n has = function (it) {\n return hasOwn(it, STATE);\n };\n}\n\nmodule.exports = {\n set: set,\n get: get,\n has: has,\n enforce: enforce,\n getterFor: getterFor\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/internal-state.js?");
|
|
3520
3519
|
|
|
3521
3520
|
/***/ }),
|
|
3522
3521
|
|
|
@@ -3547,9 +3546,9 @@ eval("var classof = __webpack_require__(/*! ../internals/classof-raw */ \"./node
|
|
|
3547
3546
|
!*** ./node_modules/core-js-pure/internals/is-callable.js ***!
|
|
3548
3547
|
\************************************************************/
|
|
3549
3548
|
/*! no static exports found */
|
|
3550
|
-
/***/ (function(module, exports) {
|
|
3549
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3551
3550
|
|
|
3552
|
-
eval("// `IsCallable` abstract operation\n// https://tc39.es/ecma262/#sec-iscallable\nmodule.exports = function (argument) {\n return typeof argument == 'function';\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/is-callable.js?");
|
|
3551
|
+
eval("var $documentAll = __webpack_require__(/*! ../internals/document-all */ \"./node_modules/core-js-pure/internals/document-all.js\");\n\nvar documentAll = $documentAll.all; // `IsCallable` abstract operation\n// https://tc39.es/ecma262/#sec-iscallable\n\nmodule.exports = $documentAll.IS_HTMLDDA ? function (argument) {\n return typeof argument == 'function' || argument === documentAll;\n} : function (argument) {\n return typeof argument == 'function';\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/is-callable.js?");
|
|
3553
3552
|
|
|
3554
3553
|
/***/ }),
|
|
3555
3554
|
|
|
@@ -3575,6 +3574,17 @@ eval("var fails = __webpack_require__(/*! ../internals/fails */ \"./node_modules
|
|
|
3575
3574
|
|
|
3576
3575
|
/***/ }),
|
|
3577
3576
|
|
|
3577
|
+
/***/ "./node_modules/core-js-pure/internals/is-null-or-undefined.js":
|
|
3578
|
+
/*!*********************************************************************!*\
|
|
3579
|
+
!*** ./node_modules/core-js-pure/internals/is-null-or-undefined.js ***!
|
|
3580
|
+
\*********************************************************************/
|
|
3581
|
+
/*! no static exports found */
|
|
3582
|
+
/***/ (function(module, exports) {
|
|
3583
|
+
|
|
3584
|
+
eval("// we can't use just `it == null` since of `document.all` special case\n// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec\nmodule.exports = function (it) {\n return it === null || it === undefined;\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/is-null-or-undefined.js?");
|
|
3585
|
+
|
|
3586
|
+
/***/ }),
|
|
3587
|
+
|
|
3578
3588
|
/***/ "./node_modules/core-js-pure/internals/is-object.js":
|
|
3579
3589
|
/*!**********************************************************!*\
|
|
3580
3590
|
!*** ./node_modules/core-js-pure/internals/is-object.js ***!
|
|
@@ -3582,7 +3592,7 @@ eval("var fails = __webpack_require__(/*! ../internals/fails */ \"./node_modules
|
|
|
3582
3592
|
/*! no static exports found */
|
|
3583
3593
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3584
3594
|
|
|
3585
|
-
eval("var isCallable = __webpack_require__(/*! ../internals/is-callable */ \"./node_modules/core-js-pure/internals/is-callable.js\");\n\nmodule.exports = function (it) {\n return typeof it == 'object' ? it !== null : isCallable(it);\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/is-object.js?");
|
|
3595
|
+
eval("var isCallable = __webpack_require__(/*! ../internals/is-callable */ \"./node_modules/core-js-pure/internals/is-callable.js\");\n\nvar $documentAll = __webpack_require__(/*! ../internals/document-all */ \"./node_modules/core-js-pure/internals/document-all.js\");\n\nvar documentAll = $documentAll.all;\nmodule.exports = $documentAll.IS_HTMLDDA ? function (it) {\n return typeof it == 'object' ? it !== null : isCallable(it) || it === documentAll;\n} : function (it) {\n return typeof it == 'object' ? it !== null : isCallable(it);\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/is-object.js?");
|
|
3586
3596
|
|
|
3587
3597
|
/***/ }),
|
|
3588
3598
|
|
|
@@ -3641,6 +3651,30 @@ eval("var call = __webpack_require__(/*! ../internals/function-call */ \"./node_
|
|
|
3641
3651
|
|
|
3642
3652
|
/***/ }),
|
|
3643
3653
|
|
|
3654
|
+
/***/ "./node_modules/core-js-pure/internals/iterator-create-constructor.js":
|
|
3655
|
+
/*!****************************************************************************!*\
|
|
3656
|
+
!*** ./node_modules/core-js-pure/internals/iterator-create-constructor.js ***!
|
|
3657
|
+
\****************************************************************************/
|
|
3658
|
+
/*! no static exports found */
|
|
3659
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3660
|
+
|
|
3661
|
+
"use strict";
|
|
3662
|
+
eval("\n\nvar IteratorPrototype = __webpack_require__(/*! ../internals/iterators-core */ \"./node_modules/core-js-pure/internals/iterators-core.js\").IteratorPrototype;\n\nvar create = __webpack_require__(/*! ../internals/object-create */ \"./node_modules/core-js-pure/internals/object-create.js\");\n\nvar createPropertyDescriptor = __webpack_require__(/*! ../internals/create-property-descriptor */ \"./node_modules/core-js-pure/internals/create-property-descriptor.js\");\n\nvar setToStringTag = __webpack_require__(/*! ../internals/set-to-string-tag */ \"./node_modules/core-js-pure/internals/set-to-string-tag.js\");\n\nvar Iterators = __webpack_require__(/*! ../internals/iterators */ \"./node_modules/core-js-pure/internals/iterators.js\");\n\nvar returnThis = function () {\n return this;\n};\n\nmodule.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {\n var TO_STRING_TAG = NAME + ' Iterator';\n IteratorConstructor.prototype = create(IteratorPrototype, {\n next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next)\n });\n setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);\n Iterators[TO_STRING_TAG] = returnThis;\n return IteratorConstructor;\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/iterator-create-constructor.js?");
|
|
3663
|
+
|
|
3664
|
+
/***/ }),
|
|
3665
|
+
|
|
3666
|
+
/***/ "./node_modules/core-js-pure/internals/iterator-define.js":
|
|
3667
|
+
/*!****************************************************************!*\
|
|
3668
|
+
!*** ./node_modules/core-js-pure/internals/iterator-define.js ***!
|
|
3669
|
+
\****************************************************************/
|
|
3670
|
+
/*! no static exports found */
|
|
3671
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3672
|
+
|
|
3673
|
+
"use strict";
|
|
3674
|
+
eval("\n\nvar $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar call = __webpack_require__(/*! ../internals/function-call */ \"./node_modules/core-js-pure/internals/function-call.js\");\n\nvar IS_PURE = __webpack_require__(/*! ../internals/is-pure */ \"./node_modules/core-js-pure/internals/is-pure.js\");\n\nvar FunctionName = __webpack_require__(/*! ../internals/function-name */ \"./node_modules/core-js-pure/internals/function-name.js\");\n\nvar isCallable = __webpack_require__(/*! ../internals/is-callable */ \"./node_modules/core-js-pure/internals/is-callable.js\");\n\nvar createIteratorConstructor = __webpack_require__(/*! ../internals/iterator-create-constructor */ \"./node_modules/core-js-pure/internals/iterator-create-constructor.js\");\n\nvar getPrototypeOf = __webpack_require__(/*! ../internals/object-get-prototype-of */ \"./node_modules/core-js-pure/internals/object-get-prototype-of.js\");\n\nvar setPrototypeOf = __webpack_require__(/*! ../internals/object-set-prototype-of */ \"./node_modules/core-js-pure/internals/object-set-prototype-of.js\");\n\nvar setToStringTag = __webpack_require__(/*! ../internals/set-to-string-tag */ \"./node_modules/core-js-pure/internals/set-to-string-tag.js\");\n\nvar createNonEnumerableProperty = __webpack_require__(/*! ../internals/create-non-enumerable-property */ \"./node_modules/core-js-pure/internals/create-non-enumerable-property.js\");\n\nvar defineBuiltIn = __webpack_require__(/*! ../internals/define-built-in */ \"./node_modules/core-js-pure/internals/define-built-in.js\");\n\nvar wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ \"./node_modules/core-js-pure/internals/well-known-symbol.js\");\n\nvar Iterators = __webpack_require__(/*! ../internals/iterators */ \"./node_modules/core-js-pure/internals/iterators.js\");\n\nvar IteratorsCore = __webpack_require__(/*! ../internals/iterators-core */ \"./node_modules/core-js-pure/internals/iterators-core.js\");\n\nvar PROPER_FUNCTION_NAME = FunctionName.PROPER;\nvar CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;\nvar IteratorPrototype = IteratorsCore.IteratorPrototype;\nvar BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;\nvar ITERATOR = wellKnownSymbol('iterator');\nvar KEYS = 'keys';\nvar VALUES = 'values';\nvar ENTRIES = 'entries';\n\nvar returnThis = function () {\n return this;\n};\n\nmodule.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {\n createIteratorConstructor(IteratorConstructor, NAME, next);\n\n var getIterationMethod = function (KIND) {\n if (KIND === DEFAULT && defaultIterator) return defaultIterator;\n if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];\n\n switch (KIND) {\n case KEYS:\n return function keys() {\n return new IteratorConstructor(this, KIND);\n };\n\n case VALUES:\n return function values() {\n return new IteratorConstructor(this, KIND);\n };\n\n case ENTRIES:\n return function entries() {\n return new IteratorConstructor(this, KIND);\n };\n }\n\n return function () {\n return new IteratorConstructor(this);\n };\n };\n\n var TO_STRING_TAG = NAME + ' Iterator';\n var INCORRECT_VALUES_NAME = false;\n var IterablePrototype = Iterable.prototype;\n var nativeIterator = IterablePrototype[ITERATOR] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT];\n var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);\n var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;\n var CurrentIteratorPrototype, methods, KEY; // fix native\n\n if (anyNativeIterator) {\n CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));\n\n if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {\n if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {\n if (setPrototypeOf) {\n setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);\n } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) {\n defineBuiltIn(CurrentIteratorPrototype, ITERATOR, returnThis);\n }\n } // Set @@toStringTag to native iterators\n\n\n setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);\n if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;\n }\n } // fix Array.prototype.{ values, @@iterator }.name in V8 / FF\n\n\n if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {\n if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) {\n createNonEnumerableProperty(IterablePrototype, 'name', VALUES);\n } else {\n INCORRECT_VALUES_NAME = true;\n\n defaultIterator = function values() {\n return call(nativeIterator, this);\n };\n }\n } // export additional methods\n\n\n if (DEFAULT) {\n methods = {\n values: getIterationMethod(VALUES),\n keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),\n entries: getIterationMethod(ENTRIES)\n };\n if (FORCED) for (KEY in methods) {\n if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {\n defineBuiltIn(IterablePrototype, KEY, methods[KEY]);\n }\n } else $({\n target: NAME,\n proto: true,\n forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME\n }, methods);\n } // define iterator\n\n\n if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {\n defineBuiltIn(IterablePrototype, ITERATOR, defaultIterator, {\n name: DEFAULT\n });\n }\n\n Iterators[NAME] = defaultIterator;\n return methods;\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/iterator-define.js?");
|
|
3675
|
+
|
|
3676
|
+
/***/ }),
|
|
3677
|
+
|
|
3644
3678
|
/***/ "./node_modules/core-js-pure/internals/iterators-core.js":
|
|
3645
3679
|
/*!***************************************************************!*\
|
|
3646
3680
|
!*** ./node_modules/core-js-pure/internals/iterators-core.js ***!
|
|
@@ -3649,7 +3683,7 @@ eval("var call = __webpack_require__(/*! ../internals/function-call */ \"./node_
|
|
|
3649
3683
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3650
3684
|
|
|
3651
3685
|
"use strict";
|
|
3652
|
-
eval("\n\nvar fails = __webpack_require__(/*! ../internals/fails */ \"./node_modules/core-js-pure/internals/fails.js\");\n\nvar isCallable = __webpack_require__(/*! ../internals/is-callable */ \"./node_modules/core-js-pure/internals/is-callable.js\");\n\nvar create = __webpack_require__(/*! ../internals/object-create */ \"./node_modules/core-js-pure/internals/object-create.js\");\n\nvar getPrototypeOf = __webpack_require__(/*! ../internals/object-get-prototype-of */ \"./node_modules/core-js-pure/internals/object-get-prototype-of.js\");\n\nvar defineBuiltIn = __webpack_require__(/*! ../internals/define-built-in */ \"./node_modules/core-js-pure/internals/define-built-in.js\");\n\nvar wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ \"./node_modules/core-js-pure/internals/well-known-symbol.js\");\n\nvar IS_PURE = __webpack_require__(/*! ../internals/is-pure */ \"./node_modules/core-js-pure/internals/is-pure.js\");\n\nvar ITERATOR = wellKnownSymbol('iterator');\nvar BUGGY_SAFARI_ITERATORS = false; // `%IteratorPrototype%` object\n// https://tc39.es/ecma262/#sec-%iteratorprototype%-object\n\nvar IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;\n/* eslint-disable es-x/no-array-prototype-keys -- safe */\n\nif ([].keys) {\n arrayIterator = [].keys(); // Safari 8 has buggy iterators w/o `next`\n\n if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;else {\n PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));\n if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;\n }\n}\n\nvar NEW_ITERATOR_PROTOTYPE = IteratorPrototype
|
|
3686
|
+
eval("\n\nvar fails = __webpack_require__(/*! ../internals/fails */ \"./node_modules/core-js-pure/internals/fails.js\");\n\nvar isCallable = __webpack_require__(/*! ../internals/is-callable */ \"./node_modules/core-js-pure/internals/is-callable.js\");\n\nvar isObject = __webpack_require__(/*! ../internals/is-object */ \"./node_modules/core-js-pure/internals/is-object.js\");\n\nvar create = __webpack_require__(/*! ../internals/object-create */ \"./node_modules/core-js-pure/internals/object-create.js\");\n\nvar getPrototypeOf = __webpack_require__(/*! ../internals/object-get-prototype-of */ \"./node_modules/core-js-pure/internals/object-get-prototype-of.js\");\n\nvar defineBuiltIn = __webpack_require__(/*! ../internals/define-built-in */ \"./node_modules/core-js-pure/internals/define-built-in.js\");\n\nvar wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ \"./node_modules/core-js-pure/internals/well-known-symbol.js\");\n\nvar IS_PURE = __webpack_require__(/*! ../internals/is-pure */ \"./node_modules/core-js-pure/internals/is-pure.js\");\n\nvar ITERATOR = wellKnownSymbol('iterator');\nvar BUGGY_SAFARI_ITERATORS = false; // `%IteratorPrototype%` object\n// https://tc39.es/ecma262/#sec-%iteratorprototype%-object\n\nvar IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;\n/* eslint-disable es-x/no-array-prototype-keys -- safe */\n\nif ([].keys) {\n arrayIterator = [].keys(); // Safari 8 has buggy iterators w/o `next`\n\n if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;else {\n PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));\n if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;\n }\n}\n\nvar NEW_ITERATOR_PROTOTYPE = !isObject(IteratorPrototype) || fails(function () {\n var test = {}; // FF44- legacy iterators case\n\n return IteratorPrototype[ITERATOR].call(test) !== test;\n});\nif (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};else if (IS_PURE) IteratorPrototype = create(IteratorPrototype); // `%IteratorPrototype%[@@iterator]()` method\n// https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator\n\nif (!isCallable(IteratorPrototype[ITERATOR])) {\n defineBuiltIn(IteratorPrototype, ITERATOR, function () {\n return this;\n });\n}\n\nmodule.exports = {\n IteratorPrototype: IteratorPrototype,\n BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/iterators-core.js?");
|
|
3653
3687
|
|
|
3654
3688
|
/***/ }),
|
|
3655
3689
|
|
|
@@ -3697,50 +3731,6 @@ eval("var global = __webpack_require__(/*! ../internals/global */ \"./node_modul
|
|
|
3697
3731
|
|
|
3698
3732
|
/***/ }),
|
|
3699
3733
|
|
|
3700
|
-
/***/ "./node_modules/core-js-pure/internals/native-symbol-registry.js":
|
|
3701
|
-
/*!***********************************************************************!*\
|
|
3702
|
-
!*** ./node_modules/core-js-pure/internals/native-symbol-registry.js ***!
|
|
3703
|
-
\***********************************************************************/
|
|
3704
|
-
/*! no static exports found */
|
|
3705
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
3706
|
-
|
|
3707
|
-
eval("var NATIVE_SYMBOL = __webpack_require__(/*! ../internals/native-symbol */ \"./node_modules/core-js-pure/internals/native-symbol.js\");\n/* eslint-disable es-x/no-symbol -- safe */\n\n\nmodule.exports = NATIVE_SYMBOL && !!Symbol['for'] && !!Symbol.keyFor;\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/native-symbol-registry.js?");
|
|
3708
|
-
|
|
3709
|
-
/***/ }),
|
|
3710
|
-
|
|
3711
|
-
/***/ "./node_modules/core-js-pure/internals/native-symbol.js":
|
|
3712
|
-
/*!**************************************************************!*\
|
|
3713
|
-
!*** ./node_modules/core-js-pure/internals/native-symbol.js ***!
|
|
3714
|
-
\**************************************************************/
|
|
3715
|
-
/*! no static exports found */
|
|
3716
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
3717
|
-
|
|
3718
|
-
eval("/* eslint-disable es-x/no-symbol -- required for testing */\nvar V8_VERSION = __webpack_require__(/*! ../internals/engine-v8-version */ \"./node_modules/core-js-pure/internals/engine-v8-version.js\");\n\nvar fails = __webpack_require__(/*! ../internals/fails */ \"./node_modules/core-js-pure/internals/fails.js\"); // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing\n\n\nmodule.exports = !!Object.getOwnPropertySymbols && !fails(function () {\n var symbol = Symbol(); // Chrome 38 Symbol has incorrect toString conversion\n // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances\n\n return !String(symbol) || !(Object(symbol) instanceof Symbol) || // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances\n !Symbol.sham && V8_VERSION && V8_VERSION < 41;\n});\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/native-symbol.js?");
|
|
3719
|
-
|
|
3720
|
-
/***/ }),
|
|
3721
|
-
|
|
3722
|
-
/***/ "./node_modules/core-js-pure/internals/native-url.js":
|
|
3723
|
-
/*!***********************************************************!*\
|
|
3724
|
-
!*** ./node_modules/core-js-pure/internals/native-url.js ***!
|
|
3725
|
-
\***********************************************************/
|
|
3726
|
-
/*! no static exports found */
|
|
3727
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
3728
|
-
|
|
3729
|
-
eval("var fails = __webpack_require__(/*! ../internals/fails */ \"./node_modules/core-js-pure/internals/fails.js\");\n\nvar wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ \"./node_modules/core-js-pure/internals/well-known-symbol.js\");\n\nvar IS_PURE = __webpack_require__(/*! ../internals/is-pure */ \"./node_modules/core-js-pure/internals/is-pure.js\");\n\nvar ITERATOR = wellKnownSymbol('iterator');\nmodule.exports = !fails(function () {\n // eslint-disable-next-line unicorn/relative-url-style -- required for testing\n var url = new URL('b?a=1&b=2&c=3', 'http://a');\n var searchParams = url.searchParams;\n var result = '';\n url.pathname = 'c%20d';\n searchParams.forEach(function (value, key) {\n searchParams['delete']('b');\n result += key + value;\n });\n return IS_PURE && !url.toJSON || !searchParams.sort || url.href !== 'http://a/c%20d?a=1&c=3' || searchParams.get('c') !== '3' || String(new URLSearchParams('?a=1')) !== 'a=1' || !searchParams[ITERATOR] // throws in Edge\n || new URL('https://a@b').username !== 'a' || new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b' // not punycoded in Edge\n || new URL('http://тест').host !== 'xn--e1aybc' // not escaped in Chrome 62-\n || new URL('http://a#б').hash !== '#%D0%B1' // fails in Chrome 66-\n || result !== 'a1c3' // throws in Safari\n || new URL('http://x', undefined).host !== 'x';\n});\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/native-url.js?");
|
|
3730
|
-
|
|
3731
|
-
/***/ }),
|
|
3732
|
-
|
|
3733
|
-
/***/ "./node_modules/core-js-pure/internals/native-weak-map.js":
|
|
3734
|
-
/*!****************************************************************!*\
|
|
3735
|
-
!*** ./node_modules/core-js-pure/internals/native-weak-map.js ***!
|
|
3736
|
-
\****************************************************************/
|
|
3737
|
-
/*! no static exports found */
|
|
3738
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
3739
|
-
|
|
3740
|
-
eval("var global = __webpack_require__(/*! ../internals/global */ \"./node_modules/core-js-pure/internals/global.js\");\n\nvar isCallable = __webpack_require__(/*! ../internals/is-callable */ \"./node_modules/core-js-pure/internals/is-callable.js\");\n\nvar inspectSource = __webpack_require__(/*! ../internals/inspect-source */ \"./node_modules/core-js-pure/internals/inspect-source.js\");\n\nvar WeakMap = global.WeakMap;\nmodule.exports = isCallable(WeakMap) && /native code/.test(inspectSource(WeakMap));\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/native-weak-map.js?");
|
|
3741
|
-
|
|
3742
|
-
/***/ }),
|
|
3743
|
-
|
|
3744
3734
|
/***/ "./node_modules/core-js-pure/internals/new-promise-capability.js":
|
|
3745
3735
|
/*!***********************************************************************!*\
|
|
3746
3736
|
!*** ./node_modules/core-js-pure/internals/new-promise-capability.js ***!
|
|
@@ -3749,7 +3739,7 @@ eval("var global = __webpack_require__(/*! ../internals/global */ \"./node_modul
|
|
|
3749
3739
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3750
3740
|
|
|
3751
3741
|
"use strict";
|
|
3752
|
-
eval("\n\nvar aCallable = __webpack_require__(/*! ../internals/a-callable */ \"./node_modules/core-js-pure/internals/a-callable.js\");\n\nvar PromiseCapability = function (C) {\n var resolve, reject;\n this.promise = new C(function ($$resolve, $$reject) {\n if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');\n resolve = $$resolve;\n reject = $$reject;\n });\n this.resolve = aCallable(resolve);\n this.reject = aCallable(reject);\n}; // `NewPromiseCapability` abstract operation\n// https://tc39.es/ecma262/#sec-newpromisecapability\n\n\nmodule.exports.f = function (C) {\n return new PromiseCapability(C);\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/new-promise-capability.js?");
|
|
3742
|
+
eval("\n\nvar aCallable = __webpack_require__(/*! ../internals/a-callable */ \"./node_modules/core-js-pure/internals/a-callable.js\");\n\nvar $TypeError = TypeError;\n\nvar PromiseCapability = function (C) {\n var resolve, reject;\n this.promise = new C(function ($$resolve, $$reject) {\n if (resolve !== undefined || reject !== undefined) throw $TypeError('Bad Promise constructor');\n resolve = $$resolve;\n reject = $$reject;\n });\n this.resolve = aCallable(resolve);\n this.reject = aCallable(reject);\n}; // `NewPromiseCapability` abstract operation\n// https://tc39.es/ecma262/#sec-newpromisecapability\n\n\nmodule.exports.f = function (C) {\n return new PromiseCapability(C);\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/new-promise-capability.js?");
|
|
3753
3743
|
|
|
3754
3744
|
/***/ }),
|
|
3755
3745
|
|
|
@@ -4069,9 +4059,9 @@ eval("var Queue = function () {\n this.head = null;\n this.tail = null;\n};\n\
|
|
|
4069
4059
|
!*** ./node_modules/core-js-pure/internals/require-object-coercible.js ***!
|
|
4070
4060
|
\*************************************************************************/
|
|
4071
4061
|
/*! no static exports found */
|
|
4072
|
-
/***/ (function(module, exports) {
|
|
4062
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
4073
4063
|
|
|
4074
|
-
eval("var $TypeError = TypeError; // `RequireObjectCoercible` abstract operation\n// https://tc39.es/ecma262/#sec-requireobjectcoercible\n\nmodule.exports = function (it) {\n if (it
|
|
4064
|
+
eval("var isNullOrUndefined = __webpack_require__(/*! ../internals/is-null-or-undefined */ \"./node_modules/core-js-pure/internals/is-null-or-undefined.js\");\n\nvar $TypeError = TypeError; // `RequireObjectCoercible` abstract operation\n// https://tc39.es/ecma262/#sec-requireobjectcoercible\n\nmodule.exports = function (it) {\n if (isNullOrUndefined(it)) throw $TypeError(\"Can't call method on \" + it);\n return it;\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/require-object-coercible.js?");
|
|
4075
4065
|
|
|
4076
4066
|
/***/ }),
|
|
4077
4067
|
|
|
@@ -4127,7 +4117,7 @@ eval("var global = __webpack_require__(/*! ../internals/global */ \"./node_modul
|
|
|
4127
4117
|
/*! no static exports found */
|
|
4128
4118
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4129
4119
|
|
|
4130
|
-
eval("var IS_PURE = __webpack_require__(/*! ../internals/is-pure */ \"./node_modules/core-js-pure/internals/is-pure.js\");\n\nvar store = __webpack_require__(/*! ../internals/shared-store */ \"./node_modules/core-js-pure/internals/shared-store.js\");\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: '3.
|
|
4120
|
+
eval("var IS_PURE = __webpack_require__(/*! ../internals/is-pure */ \"./node_modules/core-js-pure/internals/is-pure.js\");\n\nvar store = __webpack_require__(/*! ../internals/shared-store */ \"./node_modules/core-js-pure/internals/shared-store.js\");\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: '3.25.2',\n mode: IS_PURE ? 'pure' : 'global',\n copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',\n license: 'https://github.com/zloirock/core-js/blob/v3.25.2/LICENSE',\n source: 'https://github.com/zloirock/core-js'\n});\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/shared.js?");
|
|
4131
4121
|
|
|
4132
4122
|
/***/ }),
|
|
4133
4123
|
|
|
@@ -4138,7 +4128,7 @@ eval("var IS_PURE = __webpack_require__(/*! ../internals/is-pure */ \"./node_mod
|
|
|
4138
4128
|
/*! no static exports found */
|
|
4139
4129
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4140
4130
|
|
|
4141
|
-
eval("var anObject = __webpack_require__(/*! ../internals/an-object */ \"./node_modules/core-js-pure/internals/an-object.js\");\n\nvar aConstructor = __webpack_require__(/*! ../internals/a-constructor */ \"./node_modules/core-js-pure/internals/a-constructor.js\");\n\nvar wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ \"./node_modules/core-js-pure/internals/well-known-symbol.js\");\n\nvar SPECIES = wellKnownSymbol('species'); // `SpeciesConstructor` abstract operation\n// https://tc39.es/ecma262/#sec-speciesconstructor\n\nmodule.exports = function (O, defaultConstructor) {\n var C = anObject(O).constructor;\n var S;\n return C === undefined || (S = anObject(C)[SPECIES])
|
|
4131
|
+
eval("var anObject = __webpack_require__(/*! ../internals/an-object */ \"./node_modules/core-js-pure/internals/an-object.js\");\n\nvar aConstructor = __webpack_require__(/*! ../internals/a-constructor */ \"./node_modules/core-js-pure/internals/a-constructor.js\");\n\nvar isNullOrUndefined = __webpack_require__(/*! ../internals/is-null-or-undefined */ \"./node_modules/core-js-pure/internals/is-null-or-undefined.js\");\n\nvar wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ \"./node_modules/core-js-pure/internals/well-known-symbol.js\");\n\nvar SPECIES = wellKnownSymbol('species'); // `SpeciesConstructor` abstract operation\n// https://tc39.es/ecma262/#sec-speciesconstructor\n\nmodule.exports = function (O, defaultConstructor) {\n var C = anObject(O).constructor;\n var S;\n return C === undefined || isNullOrUndefined(S = anObject(C)[SPECIES]) ? defaultConstructor : aConstructor(S);\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/species-constructor.js?");
|
|
4142
4132
|
|
|
4143
4133
|
/***/ }),
|
|
4144
4134
|
|
|
@@ -4153,6 +4143,17 @@ eval("var uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-th
|
|
|
4153
4143
|
|
|
4154
4144
|
/***/ }),
|
|
4155
4145
|
|
|
4146
|
+
/***/ "./node_modules/core-js-pure/internals/symbol-constructor-detection.js":
|
|
4147
|
+
/*!*****************************************************************************!*\
|
|
4148
|
+
!*** ./node_modules/core-js-pure/internals/symbol-constructor-detection.js ***!
|
|
4149
|
+
\*****************************************************************************/
|
|
4150
|
+
/*! no static exports found */
|
|
4151
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
4152
|
+
|
|
4153
|
+
eval("/* eslint-disable es-x/no-symbol -- required for testing */\nvar V8_VERSION = __webpack_require__(/*! ../internals/engine-v8-version */ \"./node_modules/core-js-pure/internals/engine-v8-version.js\");\n\nvar fails = __webpack_require__(/*! ../internals/fails */ \"./node_modules/core-js-pure/internals/fails.js\"); // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing\n\n\nmodule.exports = !!Object.getOwnPropertySymbols && !fails(function () {\n var symbol = Symbol(); // Chrome 38 Symbol has incorrect toString conversion\n // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances\n\n return !String(symbol) || !(Object(symbol) instanceof Symbol) || // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances\n !Symbol.sham && V8_VERSION && V8_VERSION < 41;\n});\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/symbol-constructor-detection.js?");
|
|
4154
|
+
|
|
4155
|
+
/***/ }),
|
|
4156
|
+
|
|
4156
4157
|
/***/ "./node_modules/core-js-pure/internals/symbol-define-to-primitive.js":
|
|
4157
4158
|
/*!***************************************************************************!*\
|
|
4158
4159
|
!*** ./node_modules/core-js-pure/internals/symbol-define-to-primitive.js ***!
|
|
@@ -4164,6 +4165,17 @@ eval("var call = __webpack_require__(/*! ../internals/function-call */ \"./node_
|
|
|
4164
4165
|
|
|
4165
4166
|
/***/ }),
|
|
4166
4167
|
|
|
4168
|
+
/***/ "./node_modules/core-js-pure/internals/symbol-registry-detection.js":
|
|
4169
|
+
/*!**************************************************************************!*\
|
|
4170
|
+
!*** ./node_modules/core-js-pure/internals/symbol-registry-detection.js ***!
|
|
4171
|
+
\**************************************************************************/
|
|
4172
|
+
/*! no static exports found */
|
|
4173
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
4174
|
+
|
|
4175
|
+
eval("var NATIVE_SYMBOL = __webpack_require__(/*! ../internals/symbol-constructor-detection */ \"./node_modules/core-js-pure/internals/symbol-constructor-detection.js\");\n/* eslint-disable es-x/no-symbol -- safe */\n\n\nmodule.exports = NATIVE_SYMBOL && !!Symbol['for'] && !!Symbol.keyFor;\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/symbol-registry-detection.js?");
|
|
4176
|
+
|
|
4177
|
+
/***/ }),
|
|
4178
|
+
|
|
4167
4179
|
/***/ "./node_modules/core-js-pure/internals/task.js":
|
|
4168
4180
|
/*!*****************************************************!*\
|
|
4169
4181
|
!*** ./node_modules/core-js-pure/internals/task.js ***!
|
|
@@ -4296,6 +4308,17 @@ eval("var uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-th
|
|
|
4296
4308
|
|
|
4297
4309
|
/***/ }),
|
|
4298
4310
|
|
|
4311
|
+
/***/ "./node_modules/core-js-pure/internals/url-constructor-detection.js":
|
|
4312
|
+
/*!**************************************************************************!*\
|
|
4313
|
+
!*** ./node_modules/core-js-pure/internals/url-constructor-detection.js ***!
|
|
4314
|
+
\**************************************************************************/
|
|
4315
|
+
/*! no static exports found */
|
|
4316
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
4317
|
+
|
|
4318
|
+
eval("var fails = __webpack_require__(/*! ../internals/fails */ \"./node_modules/core-js-pure/internals/fails.js\");\n\nvar wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ \"./node_modules/core-js-pure/internals/well-known-symbol.js\");\n\nvar IS_PURE = __webpack_require__(/*! ../internals/is-pure */ \"./node_modules/core-js-pure/internals/is-pure.js\");\n\nvar ITERATOR = wellKnownSymbol('iterator');\nmodule.exports = !fails(function () {\n // eslint-disable-next-line unicorn/relative-url-style -- required for testing\n var url = new URL('b?a=1&b=2&c=3', 'http://a');\n var searchParams = url.searchParams;\n var result = '';\n url.pathname = 'c%20d';\n searchParams.forEach(function (value, key) {\n searchParams['delete']('b');\n result += key + value;\n });\n return IS_PURE && !url.toJSON || !searchParams.sort || url.href !== 'http://a/c%20d?a=1&c=3' || searchParams.get('c') !== '3' || String(new URLSearchParams('?a=1')) !== 'a=1' || !searchParams[ITERATOR] // throws in Edge\n || new URL('https://a@b').username !== 'a' || new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b' // not punycoded in Edge\n || new URL('http://тест').host !== 'xn--e1aybc' // not escaped in Chrome 62-\n || new URL('http://a#б').hash !== '#%D0%B1' // fails in Chrome 66-\n || result !== 'a1c3' // throws in Safari\n || new URL('http://x', undefined).host !== 'x';\n});\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/url-constructor-detection.js?");
|
|
4319
|
+
|
|
4320
|
+
/***/ }),
|
|
4321
|
+
|
|
4299
4322
|
/***/ "./node_modules/core-js-pure/internals/use-symbol-as-uid.js":
|
|
4300
4323
|
/*!******************************************************************!*\
|
|
4301
4324
|
!*** ./node_modules/core-js-pure/internals/use-symbol-as-uid.js ***!
|
|
@@ -4303,7 +4326,7 @@ eval("var uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-th
|
|
|
4303
4326
|
/*! no static exports found */
|
|
4304
4327
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4305
4328
|
|
|
4306
|
-
eval("/* eslint-disable es-x/no-symbol -- required for testing */\nvar NATIVE_SYMBOL = __webpack_require__(/*! ../internals/
|
|
4329
|
+
eval("/* eslint-disable es-x/no-symbol -- required for testing */\nvar NATIVE_SYMBOL = __webpack_require__(/*! ../internals/symbol-constructor-detection */ \"./node_modules/core-js-pure/internals/symbol-constructor-detection.js\");\n\nmodule.exports = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == 'symbol';\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/use-symbol-as-uid.js?");
|
|
4307
4330
|
|
|
4308
4331
|
/***/ }),
|
|
4309
4332
|
|
|
@@ -4329,6 +4352,28 @@ eval("var $TypeError = TypeError;\n\nmodule.exports = function (passed, required
|
|
|
4329
4352
|
|
|
4330
4353
|
/***/ }),
|
|
4331
4354
|
|
|
4355
|
+
/***/ "./node_modules/core-js-pure/internals/weak-map-basic-detection.js":
|
|
4356
|
+
/*!*************************************************************************!*\
|
|
4357
|
+
!*** ./node_modules/core-js-pure/internals/weak-map-basic-detection.js ***!
|
|
4358
|
+
\*************************************************************************/
|
|
4359
|
+
/*! no static exports found */
|
|
4360
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
4361
|
+
|
|
4362
|
+
eval("var global = __webpack_require__(/*! ../internals/global */ \"./node_modules/core-js-pure/internals/global.js\");\n\nvar isCallable = __webpack_require__(/*! ../internals/is-callable */ \"./node_modules/core-js-pure/internals/is-callable.js\");\n\nvar WeakMap = global.WeakMap;\nmodule.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap));\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/weak-map-basic-detection.js?");
|
|
4363
|
+
|
|
4364
|
+
/***/ }),
|
|
4365
|
+
|
|
4366
|
+
/***/ "./node_modules/core-js-pure/internals/well-known-symbol-define.js":
|
|
4367
|
+
/*!*************************************************************************!*\
|
|
4368
|
+
!*** ./node_modules/core-js-pure/internals/well-known-symbol-define.js ***!
|
|
4369
|
+
\*************************************************************************/
|
|
4370
|
+
/*! no static exports found */
|
|
4371
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
4372
|
+
|
|
4373
|
+
eval("var path = __webpack_require__(/*! ../internals/path */ \"./node_modules/core-js-pure/internals/path.js\");\n\nvar hasOwn = __webpack_require__(/*! ../internals/has-own-property */ \"./node_modules/core-js-pure/internals/has-own-property.js\");\n\nvar wrappedWellKnownSymbolModule = __webpack_require__(/*! ../internals/well-known-symbol-wrapped */ \"./node_modules/core-js-pure/internals/well-known-symbol-wrapped.js\");\n\nvar defineProperty = __webpack_require__(/*! ../internals/object-define-property */ \"./node_modules/core-js-pure/internals/object-define-property.js\").f;\n\nmodule.exports = function (NAME) {\n var Symbol = path.Symbol || (path.Symbol = {});\n if (!hasOwn(Symbol, NAME)) defineProperty(Symbol, NAME, {\n value: wrappedWellKnownSymbolModule.f(NAME)\n });\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/well-known-symbol-define.js?");
|
|
4374
|
+
|
|
4375
|
+
/***/ }),
|
|
4376
|
+
|
|
4332
4377
|
/***/ "./node_modules/core-js-pure/internals/well-known-symbol-wrapped.js":
|
|
4333
4378
|
/*!**************************************************************************!*\
|
|
4334
4379
|
!*** ./node_modules/core-js-pure/internals/well-known-symbol-wrapped.js ***!
|
|
@@ -4347,7 +4392,7 @@ eval("var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symb
|
|
|
4347
4392
|
/*! no static exports found */
|
|
4348
4393
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4349
4394
|
|
|
4350
|
-
eval("var global = __webpack_require__(/*! ../internals/global */ \"./node_modules/core-js-pure/internals/global.js\");\n\nvar shared = __webpack_require__(/*! ../internals/shared */ \"./node_modules/core-js-pure/internals/shared.js\");\n\nvar hasOwn = __webpack_require__(/*! ../internals/has-own-property */ \"./node_modules/core-js-pure/internals/has-own-property.js\");\n\nvar uid = __webpack_require__(/*! ../internals/uid */ \"./node_modules/core-js-pure/internals/uid.js\");\n\nvar NATIVE_SYMBOL = __webpack_require__(/*! ../internals/
|
|
4395
|
+
eval("var global = __webpack_require__(/*! ../internals/global */ \"./node_modules/core-js-pure/internals/global.js\");\n\nvar shared = __webpack_require__(/*! ../internals/shared */ \"./node_modules/core-js-pure/internals/shared.js\");\n\nvar hasOwn = __webpack_require__(/*! ../internals/has-own-property */ \"./node_modules/core-js-pure/internals/has-own-property.js\");\n\nvar uid = __webpack_require__(/*! ../internals/uid */ \"./node_modules/core-js-pure/internals/uid.js\");\n\nvar NATIVE_SYMBOL = __webpack_require__(/*! ../internals/symbol-constructor-detection */ \"./node_modules/core-js-pure/internals/symbol-constructor-detection.js\");\n\nvar USE_SYMBOL_AS_UID = __webpack_require__(/*! ../internals/use-symbol-as-uid */ \"./node_modules/core-js-pure/internals/use-symbol-as-uid.js\");\n\nvar WellKnownSymbolsStore = shared('wks');\nvar Symbol = global.Symbol;\nvar symbolFor = Symbol && Symbol['for'];\nvar createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;\n\nmodule.exports = function (name) {\n if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {\n var description = 'Symbol.' + name;\n\n if (NATIVE_SYMBOL && hasOwn(Symbol, name)) {\n WellKnownSymbolsStore[name] = Symbol[name];\n } else if (USE_SYMBOL_AS_UID && symbolFor) {\n WellKnownSymbolsStore[name] = symbolFor(description);\n } else {\n WellKnownSymbolsStore[name] = createWellKnownSymbol(description);\n }\n }\n\n return WellKnownSymbolsStore[name];\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/internals/well-known-symbol.js?");
|
|
4351
4396
|
|
|
4352
4397
|
/***/ }),
|
|
4353
4398
|
|
|
@@ -4359,7 +4404,7 @@ eval("var global = __webpack_require__(/*! ../internals/global */ \"./node_modul
|
|
|
4359
4404
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4360
4405
|
|
|
4361
4406
|
"use strict";
|
|
4362
|
-
eval("\n\nvar $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar isPrototypeOf = __webpack_require__(/*! ../internals/object-is-prototype-of */ \"./node_modules/core-js-pure/internals/object-is-prototype-of.js\");\n\nvar getPrototypeOf = __webpack_require__(/*! ../internals/object-get-prototype-of */ \"./node_modules/core-js-pure/internals/object-get-prototype-of.js\");\n\nvar setPrototypeOf = __webpack_require__(/*! ../internals/object-set-prototype-of */ \"./node_modules/core-js-pure/internals/object-set-prototype-of.js\");\n\nvar copyConstructorProperties = __webpack_require__(/*! ../internals/copy-constructor-properties */ \"./node_modules/core-js-pure/internals/copy-constructor-properties.js\");\n\nvar create = __webpack_require__(/*! ../internals/object-create */ \"./node_modules/core-js-pure/internals/object-create.js\");\n\nvar createNonEnumerableProperty = __webpack_require__(/*! ../internals/create-non-enumerable-property */ \"./node_modules/core-js-pure/internals/create-non-enumerable-property.js\");\n\nvar createPropertyDescriptor = __webpack_require__(/*! ../internals/create-property-descriptor */ \"./node_modules/core-js-pure/internals/create-property-descriptor.js\");\n\nvar clearErrorStack = __webpack_require__(/*! ../internals/
|
|
4407
|
+
eval("\n\nvar $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar isPrototypeOf = __webpack_require__(/*! ../internals/object-is-prototype-of */ \"./node_modules/core-js-pure/internals/object-is-prototype-of.js\");\n\nvar getPrototypeOf = __webpack_require__(/*! ../internals/object-get-prototype-of */ \"./node_modules/core-js-pure/internals/object-get-prototype-of.js\");\n\nvar setPrototypeOf = __webpack_require__(/*! ../internals/object-set-prototype-of */ \"./node_modules/core-js-pure/internals/object-set-prototype-of.js\");\n\nvar copyConstructorProperties = __webpack_require__(/*! ../internals/copy-constructor-properties */ \"./node_modules/core-js-pure/internals/copy-constructor-properties.js\");\n\nvar create = __webpack_require__(/*! ../internals/object-create */ \"./node_modules/core-js-pure/internals/object-create.js\");\n\nvar createNonEnumerableProperty = __webpack_require__(/*! ../internals/create-non-enumerable-property */ \"./node_modules/core-js-pure/internals/create-non-enumerable-property.js\");\n\nvar createPropertyDescriptor = __webpack_require__(/*! ../internals/create-property-descriptor */ \"./node_modules/core-js-pure/internals/create-property-descriptor.js\");\n\nvar clearErrorStack = __webpack_require__(/*! ../internals/error-stack-clear */ \"./node_modules/core-js-pure/internals/error-stack-clear.js\");\n\nvar installErrorCause = __webpack_require__(/*! ../internals/install-error-cause */ \"./node_modules/core-js-pure/internals/install-error-cause.js\");\n\nvar iterate = __webpack_require__(/*! ../internals/iterate */ \"./node_modules/core-js-pure/internals/iterate.js\");\n\nvar normalizeStringArgument = __webpack_require__(/*! ../internals/normalize-string-argument */ \"./node_modules/core-js-pure/internals/normalize-string-argument.js\");\n\nvar wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ \"./node_modules/core-js-pure/internals/well-known-symbol.js\");\n\nvar ERROR_STACK_INSTALLABLE = __webpack_require__(/*! ../internals/error-stack-installable */ \"./node_modules/core-js-pure/internals/error-stack-installable.js\");\n\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\nvar $Error = Error;\nvar push = [].push;\n\nvar $AggregateError = function AggregateError(errors, message\n/* , options */\n) {\n var options = arguments.length > 2 ? arguments[2] : undefined;\n var isInstance = isPrototypeOf(AggregateErrorPrototype, this);\n var that;\n\n if (setPrototypeOf) {\n that = setPrototypeOf($Error(), isInstance ? getPrototypeOf(this) : AggregateErrorPrototype);\n } else {\n that = isInstance ? this : create(AggregateErrorPrototype);\n createNonEnumerableProperty(that, TO_STRING_TAG, 'Error');\n }\n\n if (message !== undefined) createNonEnumerableProperty(that, 'message', normalizeStringArgument(message));\n if (ERROR_STACK_INSTALLABLE) createNonEnumerableProperty(that, 'stack', clearErrorStack(that.stack, 1));\n installErrorCause(that, options);\n var errorsArray = [];\n iterate(errors, push, {\n that: errorsArray\n });\n createNonEnumerableProperty(that, 'errors', errorsArray);\n return that;\n};\n\nif (setPrototypeOf) setPrototypeOf($AggregateError, $Error);else copyConstructorProperties($AggregateError, $Error, {\n name: true\n});\nvar AggregateErrorPrototype = $AggregateError.prototype = create($Error.prototype, {\n constructor: createPropertyDescriptor(1, $AggregateError),\n message: createPropertyDescriptor(1, ''),\n name: createPropertyDescriptor(1, 'AggregateError')\n}); // `AggregateError` constructor\n// https://tc39.es/ecma262/#sec-aggregate-error-constructor\n\n$({\n global: true,\n constructor: true,\n arity: 2\n}, {\n AggregateError: $AggregateError\n});\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.aggregate-error.constructor.js?");
|
|
4363
4408
|
|
|
4364
4409
|
/***/ }),
|
|
4365
4410
|
|
|
@@ -4453,7 +4498,7 @@ eval("\n\nvar $ = __webpack_require__(/*! ../internals/export */ \"./node_module
|
|
|
4453
4498
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4454
4499
|
|
|
4455
4500
|
"use strict";
|
|
4456
|
-
eval("\n/* eslint-disable es-x/no-array-prototype-indexof -- required for testing */\n\nvar $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ \"./node_modules/core-js-pure/internals/function-uncurry-this.js\");\n\nvar $
|
|
4501
|
+
eval("\n/* eslint-disable es-x/no-array-prototype-indexof -- required for testing */\n\nvar $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ \"./node_modules/core-js-pure/internals/function-uncurry-this.js\");\n\nvar $indexOf = __webpack_require__(/*! ../internals/array-includes */ \"./node_modules/core-js-pure/internals/array-includes.js\").indexOf;\n\nvar arrayMethodIsStrict = __webpack_require__(/*! ../internals/array-method-is-strict */ \"./node_modules/core-js-pure/internals/array-method-is-strict.js\");\n\nvar nativeIndexOf = uncurryThis([].indexOf);\nvar NEGATIVE_ZERO = !!nativeIndexOf && 1 / nativeIndexOf([1], 1, -0) < 0;\nvar STRICT_METHOD = arrayMethodIsStrict('indexOf'); // `Array.prototype.indexOf` method\n// https://tc39.es/ecma262/#sec-array.prototype.indexof\n\n$({\n target: 'Array',\n proto: true,\n forced: NEGATIVE_ZERO || !STRICT_METHOD\n}, {\n indexOf: function indexOf(searchElement\n /* , fromIndex = 0 */\n ) {\n var fromIndex = arguments.length > 1 ? arguments[1] : undefined;\n return NEGATIVE_ZERO // convert -0 to +0\n ? nativeIndexOf(this, searchElement, fromIndex) || 0 : $indexOf(this, searchElement, fromIndex);\n }\n});\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.array.index-of.js?");
|
|
4457
4502
|
|
|
4458
4503
|
/***/ }),
|
|
4459
4504
|
|
|
@@ -4476,7 +4521,7 @@ eval("var $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/co
|
|
|
4476
4521
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4477
4522
|
|
|
4478
4523
|
"use strict";
|
|
4479
|
-
eval("\n\nvar toIndexedObject = __webpack_require__(/*! ../internals/to-indexed-object */ \"./node_modules/core-js-pure/internals/to-indexed-object.js\");\n\nvar addToUnscopables = __webpack_require__(/*! ../internals/add-to-unscopables */ \"./node_modules/core-js-pure/internals/add-to-unscopables.js\");\n\nvar Iterators = __webpack_require__(/*! ../internals/iterators */ \"./node_modules/core-js-pure/internals/iterators.js\");\n\nvar InternalStateModule = __webpack_require__(/*! ../internals/internal-state */ \"./node_modules/core-js-pure/internals/internal-state.js\");\n\nvar defineProperty = __webpack_require__(/*! ../internals/object-define-property */ \"./node_modules/core-js-pure/internals/object-define-property.js\").f;\n\nvar defineIterator = __webpack_require__(/*! ../internals/define-iterator */ \"./node_modules/core-js-pure/internals/
|
|
4524
|
+
eval("\n\nvar toIndexedObject = __webpack_require__(/*! ../internals/to-indexed-object */ \"./node_modules/core-js-pure/internals/to-indexed-object.js\");\n\nvar addToUnscopables = __webpack_require__(/*! ../internals/add-to-unscopables */ \"./node_modules/core-js-pure/internals/add-to-unscopables.js\");\n\nvar Iterators = __webpack_require__(/*! ../internals/iterators */ \"./node_modules/core-js-pure/internals/iterators.js\");\n\nvar InternalStateModule = __webpack_require__(/*! ../internals/internal-state */ \"./node_modules/core-js-pure/internals/internal-state.js\");\n\nvar defineProperty = __webpack_require__(/*! ../internals/object-define-property */ \"./node_modules/core-js-pure/internals/object-define-property.js\").f;\n\nvar defineIterator = __webpack_require__(/*! ../internals/iterator-define */ \"./node_modules/core-js-pure/internals/iterator-define.js\");\n\nvar createIterResultObject = __webpack_require__(/*! ../internals/create-iter-result-object */ \"./node_modules/core-js-pure/internals/create-iter-result-object.js\");\n\nvar IS_PURE = __webpack_require__(/*! ../internals/is-pure */ \"./node_modules/core-js-pure/internals/is-pure.js\");\n\nvar DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ \"./node_modules/core-js-pure/internals/descriptors.js\");\n\nvar ARRAY_ITERATOR = 'Array Iterator';\nvar setInternalState = InternalStateModule.set;\nvar getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR); // `Array.prototype.entries` method\n// https://tc39.es/ecma262/#sec-array.prototype.entries\n// `Array.prototype.keys` method\n// https://tc39.es/ecma262/#sec-array.prototype.keys\n// `Array.prototype.values` method\n// https://tc39.es/ecma262/#sec-array.prototype.values\n// `Array.prototype[@@iterator]` method\n// https://tc39.es/ecma262/#sec-array.prototype-@@iterator\n// `CreateArrayIterator` internal method\n// https://tc39.es/ecma262/#sec-createarrayiterator\n\nmodule.exports = defineIterator(Array, 'Array', function (iterated, kind) {\n setInternalState(this, {\n type: ARRAY_ITERATOR,\n target: toIndexedObject(iterated),\n // target\n index: 0,\n // next index\n kind: kind // kind\n\n }); // `%ArrayIteratorPrototype%.next` method\n // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next\n}, function () {\n var state = getInternalState(this);\n var target = state.target;\n var kind = state.kind;\n var index = state.index++;\n\n if (!target || index >= target.length) {\n state.target = undefined;\n return createIterResultObject(undefined, true);\n }\n\n if (kind == 'keys') return createIterResultObject(index, false);\n if (kind == 'values') return createIterResultObject(target[index], false);\n return createIterResultObject([index, target[index]], false);\n}, 'values'); // argumentsList[@@iterator] is %ArrayProto_values%\n// https://tc39.es/ecma262/#sec-createunmappedargumentsobject\n// https://tc39.es/ecma262/#sec-createmappedargumentsobject\n\nvar values = Iterators.Arguments = Iterators.Array; // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables\n\naddToUnscopables('keys');\naddToUnscopables('values');\naddToUnscopables('entries'); // V8 ~ Chrome 45- bug\n\nif (!IS_PURE && DESCRIPTORS && values.name !== 'values') try {\n defineProperty(values, 'name', {\n value: 'values'\n });\n} catch (error) {\n /* empty */\n}\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.array.iterator.js?");
|
|
4480
4525
|
|
|
4481
4526
|
/***/ }),
|
|
4482
4527
|
|
|
@@ -4500,7 +4545,7 @@ eval("\n\nvar $ = __webpack_require__(/*! ../internals/export */ \"./node_module
|
|
|
4500
4545
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4501
4546
|
|
|
4502
4547
|
"use strict";
|
|
4503
|
-
eval("\n\nvar $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ \"./node_modules/core-js-pure/internals/function-uncurry-this.js\");\n\nvar isArray = __webpack_require__(/*! ../internals/is-array */ \"./node_modules/core-js-pure/internals/is-array.js\");\n\nvar
|
|
4548
|
+
eval("\n\nvar $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ \"./node_modules/core-js-pure/internals/function-uncurry-this.js\");\n\nvar isArray = __webpack_require__(/*! ../internals/is-array */ \"./node_modules/core-js-pure/internals/is-array.js\");\n\nvar nativeReverse = uncurryThis([].reverse);\nvar test = [1, 2]; // `Array.prototype.reverse` method\n// https://tc39.es/ecma262/#sec-array.prototype.reverse\n// fix for Safari 12.0 bug\n// https://bugs.webkit.org/show_bug.cgi?id=188794\n\n$({\n target: 'Array',\n proto: true,\n forced: String(test) === String(test.reverse())\n}, {\n reverse: function reverse() {\n // eslint-disable-next-line no-self-assign -- dirty hack\n if (isArray(this)) this.length = this.length;\n return nativeReverse(this);\n }\n});\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.array.reverse.js?");
|
|
4504
4549
|
|
|
4505
4550
|
/***/ }),
|
|
4506
4551
|
|
|
@@ -4512,7 +4557,7 @@ eval("\n\nvar $ = __webpack_require__(/*! ../internals/export */ \"./node_module
|
|
|
4512
4557
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4513
4558
|
|
|
4514
4559
|
"use strict";
|
|
4515
|
-
eval("\n\nvar $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar isArray = __webpack_require__(/*! ../internals/is-array */ \"./node_modules/core-js-pure/internals/is-array.js\");\n\nvar isConstructor = __webpack_require__(/*! ../internals/is-constructor */ \"./node_modules/core-js-pure/internals/is-constructor.js\");\n\nvar isObject = __webpack_require__(/*! ../internals/is-object */ \"./node_modules/core-js-pure/internals/is-object.js\");\n\nvar toAbsoluteIndex = __webpack_require__(/*! ../internals/to-absolute-index */ \"./node_modules/core-js-pure/internals/to-absolute-index.js\");\n\nvar lengthOfArrayLike = __webpack_require__(/*! ../internals/length-of-array-like */ \"./node_modules/core-js-pure/internals/length-of-array-like.js\");\n\nvar toIndexedObject = __webpack_require__(/*! ../internals/to-indexed-object */ \"./node_modules/core-js-pure/internals/to-indexed-object.js\");\n\nvar createProperty = __webpack_require__(/*! ../internals/create-property */ \"./node_modules/core-js-pure/internals/create-property.js\");\n\nvar wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ \"./node_modules/core-js-pure/internals/well-known-symbol.js\");\n\nvar arrayMethodHasSpeciesSupport = __webpack_require__(/*! ../internals/array-method-has-species-support */ \"./node_modules/core-js-pure/internals/array-method-has-species-support.js\");\n\nvar
|
|
4560
|
+
eval("\n\nvar $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar isArray = __webpack_require__(/*! ../internals/is-array */ \"./node_modules/core-js-pure/internals/is-array.js\");\n\nvar isConstructor = __webpack_require__(/*! ../internals/is-constructor */ \"./node_modules/core-js-pure/internals/is-constructor.js\");\n\nvar isObject = __webpack_require__(/*! ../internals/is-object */ \"./node_modules/core-js-pure/internals/is-object.js\");\n\nvar toAbsoluteIndex = __webpack_require__(/*! ../internals/to-absolute-index */ \"./node_modules/core-js-pure/internals/to-absolute-index.js\");\n\nvar lengthOfArrayLike = __webpack_require__(/*! ../internals/length-of-array-like */ \"./node_modules/core-js-pure/internals/length-of-array-like.js\");\n\nvar toIndexedObject = __webpack_require__(/*! ../internals/to-indexed-object */ \"./node_modules/core-js-pure/internals/to-indexed-object.js\");\n\nvar createProperty = __webpack_require__(/*! ../internals/create-property */ \"./node_modules/core-js-pure/internals/create-property.js\");\n\nvar wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ \"./node_modules/core-js-pure/internals/well-known-symbol.js\");\n\nvar arrayMethodHasSpeciesSupport = __webpack_require__(/*! ../internals/array-method-has-species-support */ \"./node_modules/core-js-pure/internals/array-method-has-species-support.js\");\n\nvar nativeSlice = __webpack_require__(/*! ../internals/array-slice */ \"./node_modules/core-js-pure/internals/array-slice.js\");\n\nvar HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');\nvar SPECIES = wellKnownSymbol('species');\nvar $Array = Array;\nvar max = Math.max; // `Array.prototype.slice` method\n// https://tc39.es/ecma262/#sec-array.prototype.slice\n// fallback for not array-like ES3 strings and DOM objects\n\n$({\n target: 'Array',\n proto: true,\n forced: !HAS_SPECIES_SUPPORT\n}, {\n slice: function slice(start, end) {\n var O = toIndexedObject(this);\n var length = lengthOfArrayLike(O);\n var k = toAbsoluteIndex(start, length);\n var fin = toAbsoluteIndex(end === undefined ? length : end, length); // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible\n\n var Constructor, result, n;\n\n if (isArray(O)) {\n Constructor = O.constructor; // cross-realm fallback\n\n if (isConstructor(Constructor) && (Constructor === $Array || isArray(Constructor.prototype))) {\n Constructor = undefined;\n } else if (isObject(Constructor)) {\n Constructor = Constructor[SPECIES];\n if (Constructor === null) Constructor = undefined;\n }\n\n if (Constructor === $Array || Constructor === undefined) {\n return nativeSlice(O, k, fin);\n }\n }\n\n result = new (Constructor === undefined ? $Array : Constructor)(max(fin - k, 0));\n\n for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);\n\n result.length = n;\n return result;\n }\n});\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.array.slice.js?");
|
|
4516
4561
|
|
|
4517
4562
|
/***/ }),
|
|
4518
4563
|
|
|
@@ -4524,7 +4569,7 @@ eval("\n\nvar $ = __webpack_require__(/*! ../internals/export */ \"./node_module
|
|
|
4524
4569
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4525
4570
|
|
|
4526
4571
|
"use strict";
|
|
4527
|
-
eval("\n\nvar $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar toObject = __webpack_require__(/*! ../internals/to-object */ \"./node_modules/core-js-pure/internals/to-object.js\");\n\nvar toAbsoluteIndex = __webpack_require__(/*! ../internals/to-absolute-index */ \"./node_modules/core-js-pure/internals/to-absolute-index.js\");\n\nvar toIntegerOrInfinity = __webpack_require__(/*! ../internals/to-integer-or-infinity */ \"./node_modules/core-js-pure/internals/to-integer-or-infinity.js\");\n\nvar lengthOfArrayLike = __webpack_require__(/*! ../internals/length-of-array-like */ \"./node_modules/core-js-pure/internals/length-of-array-like.js\");\n\nvar doesNotExceedSafeInteger = __webpack_require__(/*! ../internals/does-not-exceed-safe-integer */ \"./node_modules/core-js-pure/internals/does-not-exceed-safe-integer.js\");\n\nvar arraySpeciesCreate = __webpack_require__(/*! ../internals/array-species-create */ \"./node_modules/core-js-pure/internals/array-species-create.js\");\n\nvar createProperty = __webpack_require__(/*! ../internals/create-property */ \"./node_modules/core-js-pure/internals/create-property.js\");\n\nvar deletePropertyOrThrow = __webpack_require__(/*! ../internals/delete-property-or-throw */ \"./node_modules/core-js-pure/internals/delete-property-or-throw.js\");\n\nvar arrayMethodHasSpeciesSupport = __webpack_require__(/*! ../internals/array-method-has-species-support */ \"./node_modules/core-js-pure/internals/array-method-has-species-support.js\");\n\nvar HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');\nvar max = Math.max;\nvar min = Math.min; // `Array.prototype.splice` method\n// https://tc39.es/ecma262/#sec-array.prototype.splice\n// with adding support of @@species\n\n$({\n target: 'Array',\n proto: true,\n forced: !HAS_SPECIES_SUPPORT\n}, {\n splice: function splice(start, deleteCount\n /* , ...items */\n ) {\n var O = toObject(this);\n var len = lengthOfArrayLike(O);\n var actualStart = toAbsoluteIndex(start, len);\n var argumentsLength = arguments.length;\n var insertCount, actualDeleteCount, A, k, from, to;\n\n if (argumentsLength === 0) {\n insertCount = actualDeleteCount = 0;\n } else if (argumentsLength === 1) {\n insertCount = 0;\n actualDeleteCount = len - actualStart;\n } else {\n insertCount = argumentsLength - 2;\n actualDeleteCount = min(max(toIntegerOrInfinity(deleteCount), 0), len - actualStart);\n }\n\n doesNotExceedSafeInteger(len + insertCount - actualDeleteCount);\n A = arraySpeciesCreate(O, actualDeleteCount);\n\n for (k = 0; k < actualDeleteCount; k++) {\n from = actualStart + k;\n if (from in O) createProperty(A, k, O[from]);\n }\n\n A.length = actualDeleteCount;\n\n if (insertCount < actualDeleteCount) {\n for (k = actualStart; k < len - actualDeleteCount; k++) {\n from = k + actualDeleteCount;\n to = k + insertCount;\n if (from in O) O[to] = O[from];else deletePropertyOrThrow(O, to);\n }\n\n for (k = len; k > len - actualDeleteCount + insertCount; k--) deletePropertyOrThrow(O, k - 1);\n } else if (insertCount > actualDeleteCount) {\n for (k = len - actualDeleteCount; k > actualStart; k--) {\n from = k + actualDeleteCount - 1;\n to = k + insertCount - 1;\n if (from in O) O[to] = O[from];else deletePropertyOrThrow(O, to);\n }\n }\n\n for (k = 0; k < insertCount; k++) {\n O[k + actualStart] = arguments[k + 2];\n }\n\n O
|
|
4572
|
+
eval("\n\nvar $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar toObject = __webpack_require__(/*! ../internals/to-object */ \"./node_modules/core-js-pure/internals/to-object.js\");\n\nvar toAbsoluteIndex = __webpack_require__(/*! ../internals/to-absolute-index */ \"./node_modules/core-js-pure/internals/to-absolute-index.js\");\n\nvar toIntegerOrInfinity = __webpack_require__(/*! ../internals/to-integer-or-infinity */ \"./node_modules/core-js-pure/internals/to-integer-or-infinity.js\");\n\nvar lengthOfArrayLike = __webpack_require__(/*! ../internals/length-of-array-like */ \"./node_modules/core-js-pure/internals/length-of-array-like.js\");\n\nvar setArrayLength = __webpack_require__(/*! ../internals/array-set-length */ \"./node_modules/core-js-pure/internals/array-set-length.js\");\n\nvar doesNotExceedSafeInteger = __webpack_require__(/*! ../internals/does-not-exceed-safe-integer */ \"./node_modules/core-js-pure/internals/does-not-exceed-safe-integer.js\");\n\nvar arraySpeciesCreate = __webpack_require__(/*! ../internals/array-species-create */ \"./node_modules/core-js-pure/internals/array-species-create.js\");\n\nvar createProperty = __webpack_require__(/*! ../internals/create-property */ \"./node_modules/core-js-pure/internals/create-property.js\");\n\nvar deletePropertyOrThrow = __webpack_require__(/*! ../internals/delete-property-or-throw */ \"./node_modules/core-js-pure/internals/delete-property-or-throw.js\");\n\nvar arrayMethodHasSpeciesSupport = __webpack_require__(/*! ../internals/array-method-has-species-support */ \"./node_modules/core-js-pure/internals/array-method-has-species-support.js\");\n\nvar HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');\nvar max = Math.max;\nvar min = Math.min; // `Array.prototype.splice` method\n// https://tc39.es/ecma262/#sec-array.prototype.splice\n// with adding support of @@species\n\n$({\n target: 'Array',\n proto: true,\n forced: !HAS_SPECIES_SUPPORT\n}, {\n splice: function splice(start, deleteCount\n /* , ...items */\n ) {\n var O = toObject(this);\n var len = lengthOfArrayLike(O);\n var actualStart = toAbsoluteIndex(start, len);\n var argumentsLength = arguments.length;\n var insertCount, actualDeleteCount, A, k, from, to;\n\n if (argumentsLength === 0) {\n insertCount = actualDeleteCount = 0;\n } else if (argumentsLength === 1) {\n insertCount = 0;\n actualDeleteCount = len - actualStart;\n } else {\n insertCount = argumentsLength - 2;\n actualDeleteCount = min(max(toIntegerOrInfinity(deleteCount), 0), len - actualStart);\n }\n\n doesNotExceedSafeInteger(len + insertCount - actualDeleteCount);\n A = arraySpeciesCreate(O, actualDeleteCount);\n\n for (k = 0; k < actualDeleteCount; k++) {\n from = actualStart + k;\n if (from in O) createProperty(A, k, O[from]);\n }\n\n A.length = actualDeleteCount;\n\n if (insertCount < actualDeleteCount) {\n for (k = actualStart; k < len - actualDeleteCount; k++) {\n from = k + actualDeleteCount;\n to = k + insertCount;\n if (from in O) O[to] = O[from];else deletePropertyOrThrow(O, to);\n }\n\n for (k = len; k > len - actualDeleteCount + insertCount; k--) deletePropertyOrThrow(O, k - 1);\n } else if (insertCount > actualDeleteCount) {\n for (k = len - actualDeleteCount; k > actualStart; k--) {\n from = k + actualDeleteCount - 1;\n to = k + insertCount - 1;\n if (from in O) O[to] = O[from];else deletePropertyOrThrow(O, to);\n }\n }\n\n for (k = 0; k < insertCount; k++) {\n O[k + actualStart] = arguments[k + 2];\n }\n\n setArrayLength(O, len - actualDeleteCount + insertCount);\n return A;\n }\n});\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.array.splice.js?");
|
|
4528
4573
|
|
|
4529
4574
|
/***/ }),
|
|
4530
4575
|
|
|
@@ -4535,7 +4580,7 @@ eval("\n\nvar $ = __webpack_require__(/*! ../internals/export */ \"./node_module
|
|
|
4535
4580
|
/*! no static exports found */
|
|
4536
4581
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4537
4582
|
|
|
4538
|
-
eval("var $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar global = __webpack_require__(/*! ../internals/global */ \"./node_modules/core-js-pure/internals/global.js\"); // `globalThis` object\n// https://tc39.es/ecma262/#sec-globalthis\n\n\n$({\n global: true\n}, {\n globalThis: global\n});\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.global-this.js?");
|
|
4583
|
+
eval("var $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar global = __webpack_require__(/*! ../internals/global */ \"./node_modules/core-js-pure/internals/global.js\"); // `globalThis` object\n// https://tc39.es/ecma262/#sec-globalthis\n\n\n$({\n global: true,\n forced: global.globalThis !== global\n}, {\n globalThis: global\n});\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.global-this.js?");
|
|
4539
4584
|
|
|
4540
4585
|
/***/ }),
|
|
4541
4586
|
|
|
@@ -4546,7 +4591,7 @@ eval("var $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/co
|
|
|
4546
4591
|
/*! no static exports found */
|
|
4547
4592
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4548
4593
|
|
|
4549
|
-
eval("var $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar getBuiltIn = __webpack_require__(/*! ../internals/get-built-in */ \"./node_modules/core-js-pure/internals/get-built-in.js\");\n\nvar apply = __webpack_require__(/*! ../internals/function-apply */ \"./node_modules/core-js-pure/internals/function-apply.js\");\n\nvar call = __webpack_require__(/*! ../internals/function-call */ \"./node_modules/core-js-pure/internals/function-call.js\");\n\nvar uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ \"./node_modules/core-js-pure/internals/function-uncurry-this.js\");\n\nvar fails = __webpack_require__(/*! ../internals/fails */ \"./node_modules/core-js-pure/internals/fails.js\");\n\nvar isArray = __webpack_require__(/*! ../internals/is-array */ \"./node_modules/core-js-pure/internals/is-array.js\");\n\nvar isCallable = __webpack_require__(/*! ../internals/is-callable */ \"./node_modules/core-js-pure/internals/is-callable.js\");\n\nvar isObject = __webpack_require__(/*! ../internals/is-object */ \"./node_modules/core-js-pure/internals/is-object.js\");\n\nvar isSymbol = __webpack_require__(/*! ../internals/is-symbol */ \"./node_modules/core-js-pure/internals/is-symbol.js\");\n\nvar arraySlice = __webpack_require__(/*! ../internals/array-slice */ \"./node_modules/core-js-pure/internals/array-slice.js\");\n\nvar NATIVE_SYMBOL = __webpack_require__(/*! ../internals/
|
|
4594
|
+
eval("var $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar getBuiltIn = __webpack_require__(/*! ../internals/get-built-in */ \"./node_modules/core-js-pure/internals/get-built-in.js\");\n\nvar apply = __webpack_require__(/*! ../internals/function-apply */ \"./node_modules/core-js-pure/internals/function-apply.js\");\n\nvar call = __webpack_require__(/*! ../internals/function-call */ \"./node_modules/core-js-pure/internals/function-call.js\");\n\nvar uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ \"./node_modules/core-js-pure/internals/function-uncurry-this.js\");\n\nvar fails = __webpack_require__(/*! ../internals/fails */ \"./node_modules/core-js-pure/internals/fails.js\");\n\nvar isArray = __webpack_require__(/*! ../internals/is-array */ \"./node_modules/core-js-pure/internals/is-array.js\");\n\nvar isCallable = __webpack_require__(/*! ../internals/is-callable */ \"./node_modules/core-js-pure/internals/is-callable.js\");\n\nvar isObject = __webpack_require__(/*! ../internals/is-object */ \"./node_modules/core-js-pure/internals/is-object.js\");\n\nvar isSymbol = __webpack_require__(/*! ../internals/is-symbol */ \"./node_modules/core-js-pure/internals/is-symbol.js\");\n\nvar arraySlice = __webpack_require__(/*! ../internals/array-slice */ \"./node_modules/core-js-pure/internals/array-slice.js\");\n\nvar NATIVE_SYMBOL = __webpack_require__(/*! ../internals/symbol-constructor-detection */ \"./node_modules/core-js-pure/internals/symbol-constructor-detection.js\");\n\nvar $stringify = getBuiltIn('JSON', 'stringify');\nvar exec = uncurryThis(/./.exec);\nvar charAt = uncurryThis(''.charAt);\nvar charCodeAt = uncurryThis(''.charCodeAt);\nvar replace = uncurryThis(''.replace);\nvar numberToString = uncurryThis(1.0.toString);\nvar tester = /[\\uD800-\\uDFFF]/g;\nvar low = /^[\\uD800-\\uDBFF]$/;\nvar hi = /^[\\uDC00-\\uDFFF]$/;\nvar WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL || fails(function () {\n var symbol = getBuiltIn('Symbol')(); // MS Edge converts symbol values to JSON as {}\n\n return $stringify([symbol]) != '[null]' // WebKit converts symbol values to JSON as null\n || $stringify({\n a: symbol\n }) != '{}' // V8 throws on boxed symbols\n || $stringify(Object(symbol)) != '{}';\n}); // https://github.com/tc39/proposal-well-formed-stringify\n\nvar ILL_FORMED_UNICODE = fails(function () {\n return $stringify('\\uDF06\\uD834') !== '\"\\\\udf06\\\\ud834\"' || $stringify('\\uDEAD') !== '\"\\\\udead\"';\n});\n\nvar stringifyWithSymbolsFix = function (it, replacer) {\n var args = arraySlice(arguments);\n var $replacer = replacer;\n if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined\n\n if (!isArray(replacer)) replacer = function (key, value) {\n if (isCallable($replacer)) value = call($replacer, this, key, value);\n if (!isSymbol(value)) return value;\n };\n args[1] = replacer;\n return apply($stringify, null, args);\n};\n\nvar fixIllFormed = function (match, offset, string) {\n var prev = charAt(string, offset - 1);\n var next = charAt(string, offset + 1);\n\n if (exec(low, match) && !exec(hi, next) || exec(hi, match) && !exec(low, prev)) {\n return '\\\\u' + numberToString(charCodeAt(match, 0), 16);\n }\n\n return match;\n};\n\nif ($stringify) {\n // `JSON.stringify` method\n // https://tc39.es/ecma262/#sec-json.stringify\n $({\n target: 'JSON',\n stat: true,\n arity: 3,\n forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE\n }, {\n // eslint-disable-next-line no-unused-vars -- required for `.length`\n stringify: function stringify(it, replacer, space) {\n var args = arraySlice(arguments);\n var result = apply(WRONG_SYMBOLS_CONVERSION ? stringifyWithSymbolsFix : $stringify, null, args);\n return ILL_FORMED_UNICODE && typeof result == 'string' ? replace(result, tester, fixIllFormed) : result;\n }\n });\n}\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.json.stringify.js?");
|
|
4550
4595
|
|
|
4551
4596
|
/***/ }),
|
|
4552
4597
|
|
|
@@ -4656,7 +4701,7 @@ eval("var $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/co
|
|
|
4656
4701
|
/*! no static exports found */
|
|
4657
4702
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4658
4703
|
|
|
4659
|
-
eval("var $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar NATIVE_SYMBOL = __webpack_require__(/*! ../internals/
|
|
4704
|
+
eval("var $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar NATIVE_SYMBOL = __webpack_require__(/*! ../internals/symbol-constructor-detection */ \"./node_modules/core-js-pure/internals/symbol-constructor-detection.js\");\n\nvar fails = __webpack_require__(/*! ../internals/fails */ \"./node_modules/core-js-pure/internals/fails.js\");\n\nvar getOwnPropertySymbolsModule = __webpack_require__(/*! ../internals/object-get-own-property-symbols */ \"./node_modules/core-js-pure/internals/object-get-own-property-symbols.js\");\n\nvar toObject = __webpack_require__(/*! ../internals/to-object */ \"./node_modules/core-js-pure/internals/to-object.js\"); // V8 ~ Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives\n// https://bugs.chromium.org/p/v8/issues/detail?id=3443\n\n\nvar FORCED = !NATIVE_SYMBOL || fails(function () {\n getOwnPropertySymbolsModule.f(1);\n}); // `Object.getOwnPropertySymbols` method\n// https://tc39.es/ecma262/#sec-object.getownpropertysymbols\n\n$({\n target: 'Object',\n stat: true,\n forced: FORCED\n}, {\n getOwnPropertySymbols: function getOwnPropertySymbols(it) {\n var $getOwnPropertySymbols = getOwnPropertySymbolsModule.f;\n return $getOwnPropertySymbols ? $getOwnPropertySymbols(toObject(it)) : [];\n }\n});\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.object.get-own-property-symbols.js?");
|
|
4660
4705
|
|
|
4661
4706
|
/***/ }),
|
|
4662
4707
|
|
|
@@ -4854,7 +4899,7 @@ eval("\n\nvar $ = __webpack_require__(/*! ../internals/export */ \"./node_module
|
|
|
4854
4899
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4855
4900
|
|
|
4856
4901
|
"use strict";
|
|
4857
|
-
eval("\n\nvar charAt = __webpack_require__(/*! ../internals/string-multibyte */ \"./node_modules/core-js-pure/internals/string-multibyte.js\").charAt;\n\nvar toString = __webpack_require__(/*! ../internals/to-string */ \"./node_modules/core-js-pure/internals/to-string.js\");\n\nvar InternalStateModule = __webpack_require__(/*! ../internals/internal-state */ \"./node_modules/core-js-pure/internals/internal-state.js\");\n\nvar defineIterator = __webpack_require__(/*! ../internals/define-iterator */ \"./node_modules/core-js-pure/internals/
|
|
4902
|
+
eval("\n\nvar charAt = __webpack_require__(/*! ../internals/string-multibyte */ \"./node_modules/core-js-pure/internals/string-multibyte.js\").charAt;\n\nvar toString = __webpack_require__(/*! ../internals/to-string */ \"./node_modules/core-js-pure/internals/to-string.js\");\n\nvar InternalStateModule = __webpack_require__(/*! ../internals/internal-state */ \"./node_modules/core-js-pure/internals/internal-state.js\");\n\nvar defineIterator = __webpack_require__(/*! ../internals/iterator-define */ \"./node_modules/core-js-pure/internals/iterator-define.js\");\n\nvar createIterResultObject = __webpack_require__(/*! ../internals/create-iter-result-object */ \"./node_modules/core-js-pure/internals/create-iter-result-object.js\");\n\nvar STRING_ITERATOR = 'String Iterator';\nvar setInternalState = InternalStateModule.set;\nvar getInternalState = InternalStateModule.getterFor(STRING_ITERATOR); // `String.prototype[@@iterator]` method\n// https://tc39.es/ecma262/#sec-string.prototype-@@iterator\n\ndefineIterator(String, 'String', function (iterated) {\n setInternalState(this, {\n type: STRING_ITERATOR,\n string: toString(iterated),\n index: 0\n }); // `%StringIteratorPrototype%.next` method\n // https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next\n}, function next() {\n var state = getInternalState(this);\n var string = state.string;\n var index = state.index;\n var point;\n if (index >= string.length) return createIterResultObject(undefined, true);\n point = charAt(string, index);\n state.index += point.length;\n return createIterResultObject(point, false);\n});\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.string.iterator.js?");
|
|
4858
4903
|
|
|
4859
4904
|
/***/ }),
|
|
4860
4905
|
|
|
@@ -4866,7 +4911,7 @@ eval("\n\nvar charAt = __webpack_require__(/*! ../internals/string-multibyte */
|
|
|
4866
4911
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4867
4912
|
|
|
4868
4913
|
"use strict";
|
|
4869
|
-
eval("\n\nvar $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ \"./node_modules/core-js-pure/internals/function-uncurry-this.js\");\n\nvar getOwnPropertyDescriptor = __webpack_require__(/*! ../internals/object-get-own-property-descriptor */ \"./node_modules/core-js-pure/internals/object-get-own-property-descriptor.js\").f;\n\nvar toLength = __webpack_require__(/*! ../internals/to-length */ \"./node_modules/core-js-pure/internals/to-length.js\");\n\nvar toString = __webpack_require__(/*! ../internals/to-string */ \"./node_modules/core-js-pure/internals/to-string.js\");\n\nvar notARegExp = __webpack_require__(/*! ../internals/not-a-regexp */ \"./node_modules/core-js-pure/internals/not-a-regexp.js\");\n\nvar requireObjectCoercible = __webpack_require__(/*! ../internals/require-object-coercible */ \"./node_modules/core-js-pure/internals/require-object-coercible.js\");\n\nvar correctIsRegExpLogic = __webpack_require__(/*! ../internals/correct-is-regexp-logic */ \"./node_modules/core-js-pure/internals/correct-is-regexp-logic.js\");\n\nvar IS_PURE = __webpack_require__(/*! ../internals/is-pure */ \"./node_modules/core-js-pure/internals/is-pure.js\"); // eslint-disable-next-line es-x/no-string-prototype-startswith -- safe\n\n\nvar
|
|
4914
|
+
eval("\n\nvar $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ \"./node_modules/core-js-pure/internals/function-uncurry-this.js\");\n\nvar getOwnPropertyDescriptor = __webpack_require__(/*! ../internals/object-get-own-property-descriptor */ \"./node_modules/core-js-pure/internals/object-get-own-property-descriptor.js\").f;\n\nvar toLength = __webpack_require__(/*! ../internals/to-length */ \"./node_modules/core-js-pure/internals/to-length.js\");\n\nvar toString = __webpack_require__(/*! ../internals/to-string */ \"./node_modules/core-js-pure/internals/to-string.js\");\n\nvar notARegExp = __webpack_require__(/*! ../internals/not-a-regexp */ \"./node_modules/core-js-pure/internals/not-a-regexp.js\");\n\nvar requireObjectCoercible = __webpack_require__(/*! ../internals/require-object-coercible */ \"./node_modules/core-js-pure/internals/require-object-coercible.js\");\n\nvar correctIsRegExpLogic = __webpack_require__(/*! ../internals/correct-is-regexp-logic */ \"./node_modules/core-js-pure/internals/correct-is-regexp-logic.js\");\n\nvar IS_PURE = __webpack_require__(/*! ../internals/is-pure */ \"./node_modules/core-js-pure/internals/is-pure.js\"); // eslint-disable-next-line es-x/no-string-prototype-startswith -- safe\n\n\nvar nativeStartsWith = uncurryThis(''.startsWith);\nvar stringSlice = uncurryThis(''.slice);\nvar min = Math.min;\nvar CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('startsWith'); // https://github.com/zloirock/core-js/pull/702\n\nvar MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!function () {\n var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith');\n return descriptor && !descriptor.writable;\n}(); // `String.prototype.startsWith` method\n// https://tc39.es/ecma262/#sec-string.prototype.startswith\n\n$({\n target: 'String',\n proto: true,\n forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC\n}, {\n startsWith: function startsWith(searchString\n /* , position = 0 */\n ) {\n var that = toString(requireObjectCoercible(this));\n notARegExp(searchString);\n var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length));\n var search = toString(searchString);\n return nativeStartsWith ? nativeStartsWith(that, search, index) : stringSlice(that, index, index + search.length) === search;\n }\n});\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.string.starts-with.js?");
|
|
4870
4915
|
|
|
4871
4916
|
/***/ }),
|
|
4872
4917
|
|
|
@@ -4877,7 +4922,7 @@ eval("\n\nvar $ = __webpack_require__(/*! ../internals/export */ \"./node_module
|
|
|
4877
4922
|
/*! no static exports found */
|
|
4878
4923
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4879
4924
|
|
|
4880
|
-
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/
|
|
4925
|
+
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol-define */ \"./node_modules/core-js-pure/internals/well-known-symbol-define.js\"); // `Symbol.asyncIterator` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.asynciterator\n\n\ndefineWellKnownSymbol('asyncIterator');\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.symbol.async-iterator.js?");
|
|
4881
4926
|
|
|
4882
4927
|
/***/ }),
|
|
4883
4928
|
|
|
@@ -4889,7 +4934,7 @@ eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/define-we
|
|
|
4889
4934
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4890
4935
|
|
|
4891
4936
|
"use strict";
|
|
4892
|
-
eval("\n\nvar $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar global = __webpack_require__(/*! ../internals/global */ \"./node_modules/core-js-pure/internals/global.js\");\n\nvar call = __webpack_require__(/*! ../internals/function-call */ \"./node_modules/core-js-pure/internals/function-call.js\");\n\nvar uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ \"./node_modules/core-js-pure/internals/function-uncurry-this.js\");\n\nvar IS_PURE = __webpack_require__(/*! ../internals/is-pure */ \"./node_modules/core-js-pure/internals/is-pure.js\");\n\nvar DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ \"./node_modules/core-js-pure/internals/descriptors.js\");\n\nvar NATIVE_SYMBOL = __webpack_require__(/*! ../internals/native-symbol */ \"./node_modules/core-js-pure/internals/native-symbol.js\");\n\nvar fails = __webpack_require__(/*! ../internals/fails */ \"./node_modules/core-js-pure/internals/fails.js\");\n\nvar hasOwn = __webpack_require__(/*! ../internals/has-own-property */ \"./node_modules/core-js-pure/internals/has-own-property.js\");\n\nvar isPrototypeOf = __webpack_require__(/*! ../internals/object-is-prototype-of */ \"./node_modules/core-js-pure/internals/object-is-prototype-of.js\");\n\nvar anObject = __webpack_require__(/*! ../internals/an-object */ \"./node_modules/core-js-pure/internals/an-object.js\");\n\nvar toIndexedObject = __webpack_require__(/*! ../internals/to-indexed-object */ \"./node_modules/core-js-pure/internals/to-indexed-object.js\");\n\nvar toPropertyKey = __webpack_require__(/*! ../internals/to-property-key */ \"./node_modules/core-js-pure/internals/to-property-key.js\");\n\nvar $toString = __webpack_require__(/*! ../internals/to-string */ \"./node_modules/core-js-pure/internals/to-string.js\");\n\nvar createPropertyDescriptor = __webpack_require__(/*! ../internals/create-property-descriptor */ \"./node_modules/core-js-pure/internals/create-property-descriptor.js\");\n\nvar nativeObjectCreate = __webpack_require__(/*! ../internals/object-create */ \"./node_modules/core-js-pure/internals/object-create.js\");\n\nvar objectKeys = __webpack_require__(/*! ../internals/object-keys */ \"./node_modules/core-js-pure/internals/object-keys.js\");\n\nvar getOwnPropertyNamesModule = __webpack_require__(/*! ../internals/object-get-own-property-names */ \"./node_modules/core-js-pure/internals/object-get-own-property-names.js\");\n\nvar getOwnPropertyNamesExternal = __webpack_require__(/*! ../internals/object-get-own-property-names-external */ \"./node_modules/core-js-pure/internals/object-get-own-property-names-external.js\");\n\nvar getOwnPropertySymbolsModule = __webpack_require__(/*! ../internals/object-get-own-property-symbols */ \"./node_modules/core-js-pure/internals/object-get-own-property-symbols.js\");\n\nvar getOwnPropertyDescriptorModule = __webpack_require__(/*! ../internals/object-get-own-property-descriptor */ \"./node_modules/core-js-pure/internals/object-get-own-property-descriptor.js\");\n\nvar definePropertyModule = __webpack_require__(/*! ../internals/object-define-property */ \"./node_modules/core-js-pure/internals/object-define-property.js\");\n\nvar definePropertiesModule = __webpack_require__(/*! ../internals/object-define-properties */ \"./node_modules/core-js-pure/internals/object-define-properties.js\");\n\nvar propertyIsEnumerableModule = __webpack_require__(/*! ../internals/object-property-is-enumerable */ \"./node_modules/core-js-pure/internals/object-property-is-enumerable.js\");\n\nvar defineBuiltIn = __webpack_require__(/*! ../internals/define-built-in */ \"./node_modules/core-js-pure/internals/define-built-in.js\");\n\nvar shared = __webpack_require__(/*! ../internals/shared */ \"./node_modules/core-js-pure/internals/shared.js\");\n\nvar sharedKey = __webpack_require__(/*! ../internals/shared-key */ \"./node_modules/core-js-pure/internals/shared-key.js\");\n\nvar hiddenKeys = __webpack_require__(/*! ../internals/hidden-keys */ \"./node_modules/core-js-pure/internals/hidden-keys.js\");\n\nvar uid = __webpack_require__(/*! ../internals/uid */ \"./node_modules/core-js-pure/internals/uid.js\");\n\nvar wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ \"./node_modules/core-js-pure/internals/well-known-symbol.js\");\n\nvar wrappedWellKnownSymbolModule = __webpack_require__(/*! ../internals/well-known-symbol-wrapped */ \"./node_modules/core-js-pure/internals/well-known-symbol-wrapped.js\");\n\nvar defineWellKnownSymbol = __webpack_require__(/*! ../internals/define-well-known-symbol */ \"./node_modules/core-js-pure/internals/define-well-known-symbol.js\");\n\nvar defineSymbolToPrimitive = __webpack_require__(/*! ../internals/symbol-define-to-primitive */ \"./node_modules/core-js-pure/internals/symbol-define-to-primitive.js\");\n\nvar setToStringTag = __webpack_require__(/*! ../internals/set-to-string-tag */ \"./node_modules/core-js-pure/internals/set-to-string-tag.js\");\n\nvar InternalStateModule = __webpack_require__(/*! ../internals/internal-state */ \"./node_modules/core-js-pure/internals/internal-state.js\");\n\nvar $forEach = __webpack_require__(/*! ../internals/array-iteration */ \"./node_modules/core-js-pure/internals/array-iteration.js\").forEach;\n\nvar HIDDEN = sharedKey('hidden');\nvar SYMBOL = 'Symbol';\nvar PROTOTYPE = 'prototype';\nvar setInternalState = InternalStateModule.set;\nvar getInternalState = InternalStateModule.getterFor(SYMBOL);\nvar ObjectPrototype = Object[PROTOTYPE];\nvar $Symbol = global.Symbol;\nvar SymbolPrototype = $Symbol && $Symbol[PROTOTYPE];\nvar TypeError = global.TypeError;\nvar QObject = global.QObject;\nvar nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;\nvar nativeDefineProperty = definePropertyModule.f;\nvar nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;\nvar nativePropertyIsEnumerable = propertyIsEnumerableModule.f;\nvar push = uncurryThis([].push);\nvar AllSymbols = shared('symbols');\nvar ObjectPrototypeSymbols = shared('op-symbols');\nvar WellKnownSymbolsStore = shared('wks'); // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173\n\nvar USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687\n\nvar setSymbolDescriptor = DESCRIPTORS && fails(function () {\n return nativeObjectCreate(nativeDefineProperty({}, 'a', {\n get: function () {\n return nativeDefineProperty(this, 'a', {\n value: 7\n }).a;\n }\n })).a != 7;\n}) ? function (O, P, Attributes) {\n var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P);\n if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];\n nativeDefineProperty(O, P, Attributes);\n\n if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {\n nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);\n }\n} : nativeDefineProperty;\n\nvar wrap = function (tag, description) {\n var symbol = AllSymbols[tag] = nativeObjectCreate(SymbolPrototype);\n setInternalState(symbol, {\n type: SYMBOL,\n tag: tag,\n description: description\n });\n if (!DESCRIPTORS) symbol.description = description;\n return symbol;\n};\n\nvar $defineProperty = function defineProperty(O, P, Attributes) {\n if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);\n anObject(O);\n var key = toPropertyKey(P);\n anObject(Attributes);\n\n if (hasOwn(AllSymbols, key)) {\n if (!Attributes.enumerable) {\n if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {}));\n O[HIDDEN][key] = true;\n } else {\n if (hasOwn(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;\n Attributes = nativeObjectCreate(Attributes, {\n enumerable: createPropertyDescriptor(0, false)\n });\n }\n\n return setSymbolDescriptor(O, key, Attributes);\n }\n\n return nativeDefineProperty(O, key, Attributes);\n};\n\nvar $defineProperties = function defineProperties(O, Properties) {\n anObject(O);\n var properties = toIndexedObject(Properties);\n var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));\n $forEach(keys, function (key) {\n if (!DESCRIPTORS || call($propertyIsEnumerable, properties, key)) $defineProperty(O, key, properties[key]);\n });\n return O;\n};\n\nvar $create = function create(O, Properties) {\n return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);\n};\n\nvar $propertyIsEnumerable = function propertyIsEnumerable(V) {\n var P = toPropertyKey(V);\n var enumerable = call(nativePropertyIsEnumerable, this, P);\n if (this === ObjectPrototype && hasOwn(AllSymbols, P) && !hasOwn(ObjectPrototypeSymbols, P)) return false;\n return enumerable || !hasOwn(this, P) || !hasOwn(AllSymbols, P) || hasOwn(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;\n};\n\nvar $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {\n var it = toIndexedObject(O);\n var key = toPropertyKey(P);\n if (it === ObjectPrototype && hasOwn(AllSymbols, key) && !hasOwn(ObjectPrototypeSymbols, key)) return;\n var descriptor = nativeGetOwnPropertyDescriptor(it, key);\n\n if (descriptor && hasOwn(AllSymbols, key) && !(hasOwn(it, HIDDEN) && it[HIDDEN][key])) {\n descriptor.enumerable = true;\n }\n\n return descriptor;\n};\n\nvar $getOwnPropertyNames = function getOwnPropertyNames(O) {\n var names = nativeGetOwnPropertyNames(toIndexedObject(O));\n var result = [];\n $forEach(names, function (key) {\n if (!hasOwn(AllSymbols, key) && !hasOwn(hiddenKeys, key)) push(result, key);\n });\n return result;\n};\n\nvar $getOwnPropertySymbols = function (O) {\n var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;\n var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));\n var result = [];\n $forEach(names, function (key) {\n if (hasOwn(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn(ObjectPrototype, key))) {\n push(result, AllSymbols[key]);\n }\n });\n return result;\n}; // `Symbol` constructor\n// https://tc39.es/ecma262/#sec-symbol-constructor\n\n\nif (!NATIVE_SYMBOL) {\n $Symbol = function Symbol() {\n if (isPrototypeOf(SymbolPrototype, this)) throw TypeError('Symbol is not a constructor');\n var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]);\n var tag = uid(description);\n\n var setter = function (value) {\n if (this === ObjectPrototype) call(setter, ObjectPrototypeSymbols, value);\n if (hasOwn(this, HIDDEN) && hasOwn(this[HIDDEN], tag)) this[HIDDEN][tag] = false;\n setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));\n };\n\n if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, {\n configurable: true,\n set: setter\n });\n return wrap(tag, description);\n };\n\n SymbolPrototype = $Symbol[PROTOTYPE];\n defineBuiltIn(SymbolPrototype, 'toString', function toString() {\n return getInternalState(this).tag;\n });\n defineBuiltIn($Symbol, 'withoutSetter', function (description) {\n return wrap(uid(description), description);\n });\n propertyIsEnumerableModule.f = $propertyIsEnumerable;\n definePropertyModule.f = $defineProperty;\n definePropertiesModule.f = $defineProperties;\n getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor;\n getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;\n getOwnPropertySymbolsModule.f = $getOwnPropertySymbols;\n\n wrappedWellKnownSymbolModule.f = function (name) {\n return wrap(wellKnownSymbol(name), name);\n };\n\n if (DESCRIPTORS) {\n // https://github.com/tc39/proposal-Symbol-description\n nativeDefineProperty(SymbolPrototype, 'description', {\n configurable: true,\n get: function description() {\n return getInternalState(this).description;\n }\n });\n\n if (!IS_PURE) {\n defineBuiltIn(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, {\n unsafe: true\n });\n }\n }\n}\n\n$({\n global: true,\n constructor: true,\n wrap: true,\n forced: !NATIVE_SYMBOL,\n sham: !NATIVE_SYMBOL\n}, {\n Symbol: $Symbol\n});\n$forEach(objectKeys(WellKnownSymbolsStore), function (name) {\n defineWellKnownSymbol(name);\n});\n$({\n target: SYMBOL,\n stat: true,\n forced: !NATIVE_SYMBOL\n}, {\n useSetter: function () {\n USE_SETTER = true;\n },\n useSimple: function () {\n USE_SETTER = false;\n }\n});\n$({\n target: 'Object',\n stat: true,\n forced: !NATIVE_SYMBOL,\n sham: !DESCRIPTORS\n}, {\n // `Object.create` method\n // https://tc39.es/ecma262/#sec-object.create\n create: $create,\n // `Object.defineProperty` method\n // https://tc39.es/ecma262/#sec-object.defineproperty\n defineProperty: $defineProperty,\n // `Object.defineProperties` method\n // https://tc39.es/ecma262/#sec-object.defineproperties\n defineProperties: $defineProperties,\n // `Object.getOwnPropertyDescriptor` method\n // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors\n getOwnPropertyDescriptor: $getOwnPropertyDescriptor\n});\n$({\n target: 'Object',\n stat: true,\n forced: !NATIVE_SYMBOL\n}, {\n // `Object.getOwnPropertyNames` method\n // https://tc39.es/ecma262/#sec-object.getownpropertynames\n getOwnPropertyNames: $getOwnPropertyNames\n}); // `Symbol.prototype[@@toPrimitive]` method\n// https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive\n\ndefineSymbolToPrimitive(); // `Symbol.prototype[@@toStringTag]` property\n// https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag\n\nsetToStringTag($Symbol, SYMBOL);\nhiddenKeys[HIDDEN] = true;\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.symbol.constructor.js?");
|
|
4937
|
+
eval("\n\nvar $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar global = __webpack_require__(/*! ../internals/global */ \"./node_modules/core-js-pure/internals/global.js\");\n\nvar call = __webpack_require__(/*! ../internals/function-call */ \"./node_modules/core-js-pure/internals/function-call.js\");\n\nvar uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ \"./node_modules/core-js-pure/internals/function-uncurry-this.js\");\n\nvar IS_PURE = __webpack_require__(/*! ../internals/is-pure */ \"./node_modules/core-js-pure/internals/is-pure.js\");\n\nvar DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ \"./node_modules/core-js-pure/internals/descriptors.js\");\n\nvar NATIVE_SYMBOL = __webpack_require__(/*! ../internals/symbol-constructor-detection */ \"./node_modules/core-js-pure/internals/symbol-constructor-detection.js\");\n\nvar fails = __webpack_require__(/*! ../internals/fails */ \"./node_modules/core-js-pure/internals/fails.js\");\n\nvar hasOwn = __webpack_require__(/*! ../internals/has-own-property */ \"./node_modules/core-js-pure/internals/has-own-property.js\");\n\nvar isPrototypeOf = __webpack_require__(/*! ../internals/object-is-prototype-of */ \"./node_modules/core-js-pure/internals/object-is-prototype-of.js\");\n\nvar anObject = __webpack_require__(/*! ../internals/an-object */ \"./node_modules/core-js-pure/internals/an-object.js\");\n\nvar toIndexedObject = __webpack_require__(/*! ../internals/to-indexed-object */ \"./node_modules/core-js-pure/internals/to-indexed-object.js\");\n\nvar toPropertyKey = __webpack_require__(/*! ../internals/to-property-key */ \"./node_modules/core-js-pure/internals/to-property-key.js\");\n\nvar $toString = __webpack_require__(/*! ../internals/to-string */ \"./node_modules/core-js-pure/internals/to-string.js\");\n\nvar createPropertyDescriptor = __webpack_require__(/*! ../internals/create-property-descriptor */ \"./node_modules/core-js-pure/internals/create-property-descriptor.js\");\n\nvar nativeObjectCreate = __webpack_require__(/*! ../internals/object-create */ \"./node_modules/core-js-pure/internals/object-create.js\");\n\nvar objectKeys = __webpack_require__(/*! ../internals/object-keys */ \"./node_modules/core-js-pure/internals/object-keys.js\");\n\nvar getOwnPropertyNamesModule = __webpack_require__(/*! ../internals/object-get-own-property-names */ \"./node_modules/core-js-pure/internals/object-get-own-property-names.js\");\n\nvar getOwnPropertyNamesExternal = __webpack_require__(/*! ../internals/object-get-own-property-names-external */ \"./node_modules/core-js-pure/internals/object-get-own-property-names-external.js\");\n\nvar getOwnPropertySymbolsModule = __webpack_require__(/*! ../internals/object-get-own-property-symbols */ \"./node_modules/core-js-pure/internals/object-get-own-property-symbols.js\");\n\nvar getOwnPropertyDescriptorModule = __webpack_require__(/*! ../internals/object-get-own-property-descriptor */ \"./node_modules/core-js-pure/internals/object-get-own-property-descriptor.js\");\n\nvar definePropertyModule = __webpack_require__(/*! ../internals/object-define-property */ \"./node_modules/core-js-pure/internals/object-define-property.js\");\n\nvar definePropertiesModule = __webpack_require__(/*! ../internals/object-define-properties */ \"./node_modules/core-js-pure/internals/object-define-properties.js\");\n\nvar propertyIsEnumerableModule = __webpack_require__(/*! ../internals/object-property-is-enumerable */ \"./node_modules/core-js-pure/internals/object-property-is-enumerable.js\");\n\nvar defineBuiltIn = __webpack_require__(/*! ../internals/define-built-in */ \"./node_modules/core-js-pure/internals/define-built-in.js\");\n\nvar shared = __webpack_require__(/*! ../internals/shared */ \"./node_modules/core-js-pure/internals/shared.js\");\n\nvar sharedKey = __webpack_require__(/*! ../internals/shared-key */ \"./node_modules/core-js-pure/internals/shared-key.js\");\n\nvar hiddenKeys = __webpack_require__(/*! ../internals/hidden-keys */ \"./node_modules/core-js-pure/internals/hidden-keys.js\");\n\nvar uid = __webpack_require__(/*! ../internals/uid */ \"./node_modules/core-js-pure/internals/uid.js\");\n\nvar wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ \"./node_modules/core-js-pure/internals/well-known-symbol.js\");\n\nvar wrappedWellKnownSymbolModule = __webpack_require__(/*! ../internals/well-known-symbol-wrapped */ \"./node_modules/core-js-pure/internals/well-known-symbol-wrapped.js\");\n\nvar defineWellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol-define */ \"./node_modules/core-js-pure/internals/well-known-symbol-define.js\");\n\nvar defineSymbolToPrimitive = __webpack_require__(/*! ../internals/symbol-define-to-primitive */ \"./node_modules/core-js-pure/internals/symbol-define-to-primitive.js\");\n\nvar setToStringTag = __webpack_require__(/*! ../internals/set-to-string-tag */ \"./node_modules/core-js-pure/internals/set-to-string-tag.js\");\n\nvar InternalStateModule = __webpack_require__(/*! ../internals/internal-state */ \"./node_modules/core-js-pure/internals/internal-state.js\");\n\nvar $forEach = __webpack_require__(/*! ../internals/array-iteration */ \"./node_modules/core-js-pure/internals/array-iteration.js\").forEach;\n\nvar HIDDEN = sharedKey('hidden');\nvar SYMBOL = 'Symbol';\nvar PROTOTYPE = 'prototype';\nvar setInternalState = InternalStateModule.set;\nvar getInternalState = InternalStateModule.getterFor(SYMBOL);\nvar ObjectPrototype = Object[PROTOTYPE];\nvar $Symbol = global.Symbol;\nvar SymbolPrototype = $Symbol && $Symbol[PROTOTYPE];\nvar TypeError = global.TypeError;\nvar QObject = global.QObject;\nvar nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;\nvar nativeDefineProperty = definePropertyModule.f;\nvar nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;\nvar nativePropertyIsEnumerable = propertyIsEnumerableModule.f;\nvar push = uncurryThis([].push);\nvar AllSymbols = shared('symbols');\nvar ObjectPrototypeSymbols = shared('op-symbols');\nvar WellKnownSymbolsStore = shared('wks'); // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173\n\nvar USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687\n\nvar setSymbolDescriptor = DESCRIPTORS && fails(function () {\n return nativeObjectCreate(nativeDefineProperty({}, 'a', {\n get: function () {\n return nativeDefineProperty(this, 'a', {\n value: 7\n }).a;\n }\n })).a != 7;\n}) ? function (O, P, Attributes) {\n var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P);\n if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];\n nativeDefineProperty(O, P, Attributes);\n\n if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {\n nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);\n }\n} : nativeDefineProperty;\n\nvar wrap = function (tag, description) {\n var symbol = AllSymbols[tag] = nativeObjectCreate(SymbolPrototype);\n setInternalState(symbol, {\n type: SYMBOL,\n tag: tag,\n description: description\n });\n if (!DESCRIPTORS) symbol.description = description;\n return symbol;\n};\n\nvar $defineProperty = function defineProperty(O, P, Attributes) {\n if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);\n anObject(O);\n var key = toPropertyKey(P);\n anObject(Attributes);\n\n if (hasOwn(AllSymbols, key)) {\n if (!Attributes.enumerable) {\n if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {}));\n O[HIDDEN][key] = true;\n } else {\n if (hasOwn(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;\n Attributes = nativeObjectCreate(Attributes, {\n enumerable: createPropertyDescriptor(0, false)\n });\n }\n\n return setSymbolDescriptor(O, key, Attributes);\n }\n\n return nativeDefineProperty(O, key, Attributes);\n};\n\nvar $defineProperties = function defineProperties(O, Properties) {\n anObject(O);\n var properties = toIndexedObject(Properties);\n var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));\n $forEach(keys, function (key) {\n if (!DESCRIPTORS || call($propertyIsEnumerable, properties, key)) $defineProperty(O, key, properties[key]);\n });\n return O;\n};\n\nvar $create = function create(O, Properties) {\n return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);\n};\n\nvar $propertyIsEnumerable = function propertyIsEnumerable(V) {\n var P = toPropertyKey(V);\n var enumerable = call(nativePropertyIsEnumerable, this, P);\n if (this === ObjectPrototype && hasOwn(AllSymbols, P) && !hasOwn(ObjectPrototypeSymbols, P)) return false;\n return enumerable || !hasOwn(this, P) || !hasOwn(AllSymbols, P) || hasOwn(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;\n};\n\nvar $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {\n var it = toIndexedObject(O);\n var key = toPropertyKey(P);\n if (it === ObjectPrototype && hasOwn(AllSymbols, key) && !hasOwn(ObjectPrototypeSymbols, key)) return;\n var descriptor = nativeGetOwnPropertyDescriptor(it, key);\n\n if (descriptor && hasOwn(AllSymbols, key) && !(hasOwn(it, HIDDEN) && it[HIDDEN][key])) {\n descriptor.enumerable = true;\n }\n\n return descriptor;\n};\n\nvar $getOwnPropertyNames = function getOwnPropertyNames(O) {\n var names = nativeGetOwnPropertyNames(toIndexedObject(O));\n var result = [];\n $forEach(names, function (key) {\n if (!hasOwn(AllSymbols, key) && !hasOwn(hiddenKeys, key)) push(result, key);\n });\n return result;\n};\n\nvar $getOwnPropertySymbols = function (O) {\n var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;\n var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));\n var result = [];\n $forEach(names, function (key) {\n if (hasOwn(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn(ObjectPrototype, key))) {\n push(result, AllSymbols[key]);\n }\n });\n return result;\n}; // `Symbol` constructor\n// https://tc39.es/ecma262/#sec-symbol-constructor\n\n\nif (!NATIVE_SYMBOL) {\n $Symbol = function Symbol() {\n if (isPrototypeOf(SymbolPrototype, this)) throw TypeError('Symbol is not a constructor');\n var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]);\n var tag = uid(description);\n\n var setter = function (value) {\n if (this === ObjectPrototype) call(setter, ObjectPrototypeSymbols, value);\n if (hasOwn(this, HIDDEN) && hasOwn(this[HIDDEN], tag)) this[HIDDEN][tag] = false;\n setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));\n };\n\n if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, {\n configurable: true,\n set: setter\n });\n return wrap(tag, description);\n };\n\n SymbolPrototype = $Symbol[PROTOTYPE];\n defineBuiltIn(SymbolPrototype, 'toString', function toString() {\n return getInternalState(this).tag;\n });\n defineBuiltIn($Symbol, 'withoutSetter', function (description) {\n return wrap(uid(description), description);\n });\n propertyIsEnumerableModule.f = $propertyIsEnumerable;\n definePropertyModule.f = $defineProperty;\n definePropertiesModule.f = $defineProperties;\n getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor;\n getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;\n getOwnPropertySymbolsModule.f = $getOwnPropertySymbols;\n\n wrappedWellKnownSymbolModule.f = function (name) {\n return wrap(wellKnownSymbol(name), name);\n };\n\n if (DESCRIPTORS) {\n // https://github.com/tc39/proposal-Symbol-description\n nativeDefineProperty(SymbolPrototype, 'description', {\n configurable: true,\n get: function description() {\n return getInternalState(this).description;\n }\n });\n\n if (!IS_PURE) {\n defineBuiltIn(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, {\n unsafe: true\n });\n }\n }\n}\n\n$({\n global: true,\n constructor: true,\n wrap: true,\n forced: !NATIVE_SYMBOL,\n sham: !NATIVE_SYMBOL\n}, {\n Symbol: $Symbol\n});\n$forEach(objectKeys(WellKnownSymbolsStore), function (name) {\n defineWellKnownSymbol(name);\n});\n$({\n target: SYMBOL,\n stat: true,\n forced: !NATIVE_SYMBOL\n}, {\n useSetter: function () {\n USE_SETTER = true;\n },\n useSimple: function () {\n USE_SETTER = false;\n }\n});\n$({\n target: 'Object',\n stat: true,\n forced: !NATIVE_SYMBOL,\n sham: !DESCRIPTORS\n}, {\n // `Object.create` method\n // https://tc39.es/ecma262/#sec-object.create\n create: $create,\n // `Object.defineProperty` method\n // https://tc39.es/ecma262/#sec-object.defineproperty\n defineProperty: $defineProperty,\n // `Object.defineProperties` method\n // https://tc39.es/ecma262/#sec-object.defineproperties\n defineProperties: $defineProperties,\n // `Object.getOwnPropertyDescriptor` method\n // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors\n getOwnPropertyDescriptor: $getOwnPropertyDescriptor\n});\n$({\n target: 'Object',\n stat: true,\n forced: !NATIVE_SYMBOL\n}, {\n // `Object.getOwnPropertyNames` method\n // https://tc39.es/ecma262/#sec-object.getownpropertynames\n getOwnPropertyNames: $getOwnPropertyNames\n}); // `Symbol.prototype[@@toPrimitive]` method\n// https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive\n\ndefineSymbolToPrimitive(); // `Symbol.prototype[@@toStringTag]` property\n// https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag\n\nsetToStringTag($Symbol, SYMBOL);\nhiddenKeys[HIDDEN] = true;\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.symbol.constructor.js?");
|
|
4893
4938
|
|
|
4894
4939
|
/***/ }),
|
|
4895
4940
|
|
|
@@ -4911,7 +4956,7 @@ eval("// empty\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-j
|
|
|
4911
4956
|
/*! no static exports found */
|
|
4912
4957
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4913
4958
|
|
|
4914
|
-
eval("var $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar getBuiltIn = __webpack_require__(/*! ../internals/get-built-in */ \"./node_modules/core-js-pure/internals/get-built-in.js\");\n\nvar hasOwn = __webpack_require__(/*! ../internals/has-own-property */ \"./node_modules/core-js-pure/internals/has-own-property.js\");\n\nvar toString = __webpack_require__(/*! ../internals/to-string */ \"./node_modules/core-js-pure/internals/to-string.js\");\n\nvar shared = __webpack_require__(/*! ../internals/shared */ \"./node_modules/core-js-pure/internals/shared.js\");\n\nvar NATIVE_SYMBOL_REGISTRY = __webpack_require__(/*! ../internals/
|
|
4959
|
+
eval("var $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar getBuiltIn = __webpack_require__(/*! ../internals/get-built-in */ \"./node_modules/core-js-pure/internals/get-built-in.js\");\n\nvar hasOwn = __webpack_require__(/*! ../internals/has-own-property */ \"./node_modules/core-js-pure/internals/has-own-property.js\");\n\nvar toString = __webpack_require__(/*! ../internals/to-string */ \"./node_modules/core-js-pure/internals/to-string.js\");\n\nvar shared = __webpack_require__(/*! ../internals/shared */ \"./node_modules/core-js-pure/internals/shared.js\");\n\nvar NATIVE_SYMBOL_REGISTRY = __webpack_require__(/*! ../internals/symbol-registry-detection */ \"./node_modules/core-js-pure/internals/symbol-registry-detection.js\");\n\nvar StringToSymbolRegistry = shared('string-to-symbol-registry');\nvar SymbolToStringRegistry = shared('symbol-to-string-registry'); // `Symbol.for` method\n// https://tc39.es/ecma262/#sec-symbol.for\n\n$({\n target: 'Symbol',\n stat: true,\n forced: !NATIVE_SYMBOL_REGISTRY\n}, {\n 'for': function (key) {\n var string = toString(key);\n if (hasOwn(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];\n var symbol = getBuiltIn('Symbol')(string);\n StringToSymbolRegistry[string] = symbol;\n SymbolToStringRegistry[symbol] = string;\n return symbol;\n }\n});\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.symbol.for.js?");
|
|
4915
4960
|
|
|
4916
4961
|
/***/ }),
|
|
4917
4962
|
|
|
@@ -4922,7 +4967,7 @@ eval("var $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/co
|
|
|
4922
4967
|
/*! no static exports found */
|
|
4923
4968
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4924
4969
|
|
|
4925
|
-
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/
|
|
4970
|
+
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol-define */ \"./node_modules/core-js-pure/internals/well-known-symbol-define.js\"); // `Symbol.hasInstance` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.hasinstance\n\n\ndefineWellKnownSymbol('hasInstance');\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.symbol.has-instance.js?");
|
|
4926
4971
|
|
|
4927
4972
|
/***/ }),
|
|
4928
4973
|
|
|
@@ -4933,7 +4978,7 @@ eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/define-we
|
|
|
4933
4978
|
/*! no static exports found */
|
|
4934
4979
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4935
4980
|
|
|
4936
|
-
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/
|
|
4981
|
+
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol-define */ \"./node_modules/core-js-pure/internals/well-known-symbol-define.js\"); // `Symbol.isConcatSpreadable` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.isconcatspreadable\n\n\ndefineWellKnownSymbol('isConcatSpreadable');\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.symbol.is-concat-spreadable.js?");
|
|
4937
4982
|
|
|
4938
4983
|
/***/ }),
|
|
4939
4984
|
|
|
@@ -4944,7 +4989,7 @@ eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/define-we
|
|
|
4944
4989
|
/*! no static exports found */
|
|
4945
4990
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4946
4991
|
|
|
4947
|
-
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/
|
|
4992
|
+
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol-define */ \"./node_modules/core-js-pure/internals/well-known-symbol-define.js\"); // `Symbol.iterator` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.iterator\n\n\ndefineWellKnownSymbol('iterator');\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.symbol.iterator.js?");
|
|
4948
4993
|
|
|
4949
4994
|
/***/ }),
|
|
4950
4995
|
|
|
@@ -4966,7 +5011,7 @@ eval("// TODO: Remove this module from `core-js@4` since it's split to modules l
|
|
|
4966
5011
|
/*! no static exports found */
|
|
4967
5012
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4968
5013
|
|
|
4969
|
-
eval("var $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar hasOwn = __webpack_require__(/*! ../internals/has-own-property */ \"./node_modules/core-js-pure/internals/has-own-property.js\");\n\nvar isSymbol = __webpack_require__(/*! ../internals/is-symbol */ \"./node_modules/core-js-pure/internals/is-symbol.js\");\n\nvar tryToString = __webpack_require__(/*! ../internals/try-to-string */ \"./node_modules/core-js-pure/internals/try-to-string.js\");\n\nvar shared = __webpack_require__(/*! ../internals/shared */ \"./node_modules/core-js-pure/internals/shared.js\");\n\nvar NATIVE_SYMBOL_REGISTRY = __webpack_require__(/*! ../internals/
|
|
5014
|
+
eval("var $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar hasOwn = __webpack_require__(/*! ../internals/has-own-property */ \"./node_modules/core-js-pure/internals/has-own-property.js\");\n\nvar isSymbol = __webpack_require__(/*! ../internals/is-symbol */ \"./node_modules/core-js-pure/internals/is-symbol.js\");\n\nvar tryToString = __webpack_require__(/*! ../internals/try-to-string */ \"./node_modules/core-js-pure/internals/try-to-string.js\");\n\nvar shared = __webpack_require__(/*! ../internals/shared */ \"./node_modules/core-js-pure/internals/shared.js\");\n\nvar NATIVE_SYMBOL_REGISTRY = __webpack_require__(/*! ../internals/symbol-registry-detection */ \"./node_modules/core-js-pure/internals/symbol-registry-detection.js\");\n\nvar SymbolToStringRegistry = shared('symbol-to-string-registry'); // `Symbol.keyFor` method\n// https://tc39.es/ecma262/#sec-symbol.keyfor\n\n$({\n target: 'Symbol',\n stat: true,\n forced: !NATIVE_SYMBOL_REGISTRY\n}, {\n keyFor: function keyFor(sym) {\n if (!isSymbol(sym)) throw TypeError(tryToString(sym) + ' is not a symbol');\n if (hasOwn(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];\n }\n});\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.symbol.key-for.js?");
|
|
4970
5015
|
|
|
4971
5016
|
/***/ }),
|
|
4972
5017
|
|
|
@@ -4977,7 +5022,7 @@ eval("var $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/co
|
|
|
4977
5022
|
/*! no static exports found */
|
|
4978
5023
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4979
5024
|
|
|
4980
|
-
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/
|
|
5025
|
+
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol-define */ \"./node_modules/core-js-pure/internals/well-known-symbol-define.js\"); // `Symbol.matchAll` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.matchall\n\n\ndefineWellKnownSymbol('matchAll');\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.symbol.match-all.js?");
|
|
4981
5026
|
|
|
4982
5027
|
/***/ }),
|
|
4983
5028
|
|
|
@@ -4988,7 +5033,7 @@ eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/define-we
|
|
|
4988
5033
|
/*! no static exports found */
|
|
4989
5034
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4990
5035
|
|
|
4991
|
-
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/
|
|
5036
|
+
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol-define */ \"./node_modules/core-js-pure/internals/well-known-symbol-define.js\"); // `Symbol.match` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.match\n\n\ndefineWellKnownSymbol('match');\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.symbol.match.js?");
|
|
4992
5037
|
|
|
4993
5038
|
/***/ }),
|
|
4994
5039
|
|
|
@@ -4999,7 +5044,7 @@ eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/define-we
|
|
|
4999
5044
|
/*! no static exports found */
|
|
5000
5045
|
/***/ (function(module, exports, __webpack_require__) {
|
|
5001
5046
|
|
|
5002
|
-
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/
|
|
5047
|
+
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol-define */ \"./node_modules/core-js-pure/internals/well-known-symbol-define.js\"); // `Symbol.replace` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.replace\n\n\ndefineWellKnownSymbol('replace');\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.symbol.replace.js?");
|
|
5003
5048
|
|
|
5004
5049
|
/***/ }),
|
|
5005
5050
|
|
|
@@ -5010,7 +5055,7 @@ eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/define-we
|
|
|
5010
5055
|
/*! no static exports found */
|
|
5011
5056
|
/***/ (function(module, exports, __webpack_require__) {
|
|
5012
5057
|
|
|
5013
|
-
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/
|
|
5058
|
+
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol-define */ \"./node_modules/core-js-pure/internals/well-known-symbol-define.js\"); // `Symbol.search` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.search\n\n\ndefineWellKnownSymbol('search');\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.symbol.search.js?");
|
|
5014
5059
|
|
|
5015
5060
|
/***/ }),
|
|
5016
5061
|
|
|
@@ -5021,7 +5066,7 @@ eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/define-we
|
|
|
5021
5066
|
/*! no static exports found */
|
|
5022
5067
|
/***/ (function(module, exports, __webpack_require__) {
|
|
5023
5068
|
|
|
5024
|
-
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/
|
|
5069
|
+
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol-define */ \"./node_modules/core-js-pure/internals/well-known-symbol-define.js\"); // `Symbol.species` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.species\n\n\ndefineWellKnownSymbol('species');\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.symbol.species.js?");
|
|
5025
5070
|
|
|
5026
5071
|
/***/ }),
|
|
5027
5072
|
|
|
@@ -5032,7 +5077,7 @@ eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/define-we
|
|
|
5032
5077
|
/*! no static exports found */
|
|
5033
5078
|
/***/ (function(module, exports, __webpack_require__) {
|
|
5034
5079
|
|
|
5035
|
-
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/
|
|
5080
|
+
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol-define */ \"./node_modules/core-js-pure/internals/well-known-symbol-define.js\"); // `Symbol.split` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.split\n\n\ndefineWellKnownSymbol('split');\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.symbol.split.js?");
|
|
5036
5081
|
|
|
5037
5082
|
/***/ }),
|
|
5038
5083
|
|
|
@@ -5043,7 +5088,7 @@ eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/define-we
|
|
|
5043
5088
|
/*! no static exports found */
|
|
5044
5089
|
/***/ (function(module, exports, __webpack_require__) {
|
|
5045
5090
|
|
|
5046
|
-
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/
|
|
5091
|
+
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol-define */ \"./node_modules/core-js-pure/internals/well-known-symbol-define.js\");\n\nvar defineSymbolToPrimitive = __webpack_require__(/*! ../internals/symbol-define-to-primitive */ \"./node_modules/core-js-pure/internals/symbol-define-to-primitive.js\"); // `Symbol.toPrimitive` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.toprimitive\n\n\ndefineWellKnownSymbol('toPrimitive'); // `Symbol.prototype[@@toPrimitive]` method\n// https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive\n\ndefineSymbolToPrimitive();\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.symbol.to-primitive.js?");
|
|
5047
5092
|
|
|
5048
5093
|
/***/ }),
|
|
5049
5094
|
|
|
@@ -5054,7 +5099,7 @@ eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/define-we
|
|
|
5054
5099
|
/*! no static exports found */
|
|
5055
5100
|
/***/ (function(module, exports, __webpack_require__) {
|
|
5056
5101
|
|
|
5057
|
-
eval("var getBuiltIn = __webpack_require__(/*! ../internals/get-built-in */ \"./node_modules/core-js-pure/internals/get-built-in.js\");\n\nvar defineWellKnownSymbol = __webpack_require__(/*! ../internals/
|
|
5102
|
+
eval("var getBuiltIn = __webpack_require__(/*! ../internals/get-built-in */ \"./node_modules/core-js-pure/internals/get-built-in.js\");\n\nvar defineWellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol-define */ \"./node_modules/core-js-pure/internals/well-known-symbol-define.js\");\n\nvar setToStringTag = __webpack_require__(/*! ../internals/set-to-string-tag */ \"./node_modules/core-js-pure/internals/set-to-string-tag.js\"); // `Symbol.toStringTag` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.tostringtag\n\n\ndefineWellKnownSymbol('toStringTag'); // `Symbol.prototype[@@toStringTag]` property\n// https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag\n\nsetToStringTag(getBuiltIn('Symbol'), 'Symbol');\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.symbol.to-string-tag.js?");
|
|
5058
5103
|
|
|
5059
5104
|
/***/ }),
|
|
5060
5105
|
|
|
@@ -5065,7 +5110,7 @@ eval("var getBuiltIn = __webpack_require__(/*! ../internals/get-built-in */ \"./
|
|
|
5065
5110
|
/*! no static exports found */
|
|
5066
5111
|
/***/ (function(module, exports, __webpack_require__) {
|
|
5067
5112
|
|
|
5068
|
-
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/
|
|
5113
|
+
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol-define */ \"./node_modules/core-js-pure/internals/well-known-symbol-define.js\"); // `Symbol.unscopables` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.unscopables\n\n\ndefineWellKnownSymbol('unscopables');\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.symbol.unscopables.js?");
|
|
5069
5114
|
|
|
5070
5115
|
/***/ }),
|
|
5071
5116
|
|
|
@@ -5077,7 +5122,7 @@ eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/define-we
|
|
|
5077
5122
|
/***/ (function(module, exports, __webpack_require__) {
|
|
5078
5123
|
|
|
5079
5124
|
"use strict";
|
|
5080
|
-
eval("\n\nvar global = __webpack_require__(/*! ../internals/global */ \"./node_modules/core-js-pure/internals/global.js\");\n\nvar uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ \"./node_modules/core-js-pure/internals/function-uncurry-this.js\");\n\nvar defineBuiltIns = __webpack_require__(/*! ../internals/define-built-ins */ \"./node_modules/core-js-pure/internals/define-built-ins.js\");\n\nvar InternalMetadataModule = __webpack_require__(/*! ../internals/internal-metadata */ \"./node_modules/core-js-pure/internals/internal-metadata.js\");\n\nvar collection = __webpack_require__(/*! ../internals/collection */ \"./node_modules/core-js-pure/internals/collection.js\");\n\nvar collectionWeak = __webpack_require__(/*! ../internals/collection-weak */ \"./node_modules/core-js-pure/internals/collection-weak.js\");\n\nvar isObject = __webpack_require__(/*! ../internals/is-object */ \"./node_modules/core-js-pure/internals/is-object.js\");\n\nvar isExtensible = __webpack_require__(/*! ../internals/object-is-extensible */ \"./node_modules/core-js-pure/internals/object-is-extensible.js\");\n\nvar enforceInternalState = __webpack_require__(/*! ../internals/internal-state */ \"./node_modules/core-js-pure/internals/internal-state.js\").enforce;\n\nvar NATIVE_WEAK_MAP = __webpack_require__(/*! ../internals/
|
|
5125
|
+
eval("\n\nvar global = __webpack_require__(/*! ../internals/global */ \"./node_modules/core-js-pure/internals/global.js\");\n\nvar uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ \"./node_modules/core-js-pure/internals/function-uncurry-this.js\");\n\nvar defineBuiltIns = __webpack_require__(/*! ../internals/define-built-ins */ \"./node_modules/core-js-pure/internals/define-built-ins.js\");\n\nvar InternalMetadataModule = __webpack_require__(/*! ../internals/internal-metadata */ \"./node_modules/core-js-pure/internals/internal-metadata.js\");\n\nvar collection = __webpack_require__(/*! ../internals/collection */ \"./node_modules/core-js-pure/internals/collection.js\");\n\nvar collectionWeak = __webpack_require__(/*! ../internals/collection-weak */ \"./node_modules/core-js-pure/internals/collection-weak.js\");\n\nvar isObject = __webpack_require__(/*! ../internals/is-object */ \"./node_modules/core-js-pure/internals/is-object.js\");\n\nvar isExtensible = __webpack_require__(/*! ../internals/object-is-extensible */ \"./node_modules/core-js-pure/internals/object-is-extensible.js\");\n\nvar enforceInternalState = __webpack_require__(/*! ../internals/internal-state */ \"./node_modules/core-js-pure/internals/internal-state.js\").enforce;\n\nvar NATIVE_WEAK_MAP = __webpack_require__(/*! ../internals/weak-map-basic-detection */ \"./node_modules/core-js-pure/internals/weak-map-basic-detection.js\");\n\nvar IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;\nvar InternalWeakMap;\n\nvar wrapper = function (init) {\n return function WeakMap() {\n return init(this, arguments.length ? arguments[0] : undefined);\n };\n}; // `WeakMap` constructor\n// https://tc39.es/ecma262/#sec-weakmap-constructor\n\n\nvar $WeakMap = collection('WeakMap', wrapper, collectionWeak); // IE11 WeakMap frozen keys fix\n// We can't use feature detection because it crash some old IE builds\n// https://github.com/zloirock/core-js/issues/485\n\nif (NATIVE_WEAK_MAP && IS_IE11) {\n InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true);\n InternalMetadataModule.enable();\n var WeakMapPrototype = $WeakMap.prototype;\n var nativeDelete = uncurryThis(WeakMapPrototype['delete']);\n var nativeHas = uncurryThis(WeakMapPrototype.has);\n var nativeGet = uncurryThis(WeakMapPrototype.get);\n var nativeSet = uncurryThis(WeakMapPrototype.set);\n defineBuiltIns(WeakMapPrototype, {\n 'delete': function (key) {\n if (isObject(key) && !isExtensible(key)) {\n var state = enforceInternalState(this);\n if (!state.frozen) state.frozen = new InternalWeakMap();\n return nativeDelete(this, key) || state.frozen['delete'](key);\n }\n\n return nativeDelete(this, key);\n },\n has: function has(key) {\n if (isObject(key) && !isExtensible(key)) {\n var state = enforceInternalState(this);\n if (!state.frozen) state.frozen = new InternalWeakMap();\n return nativeHas(this, key) || state.frozen.has(key);\n }\n\n return nativeHas(this, key);\n },\n get: function get(key) {\n if (isObject(key) && !isExtensible(key)) {\n var state = enforceInternalState(this);\n if (!state.frozen) state.frozen = new InternalWeakMap();\n return nativeHas(this, key) ? nativeGet(this, key) : state.frozen.get(key);\n }\n\n return nativeGet(this, key);\n },\n set: function set(key, value) {\n if (isObject(key) && !isExtensible(key)) {\n var state = enforceInternalState(this);\n if (!state.frozen) state.frozen = new InternalWeakMap();\n nativeHas(this, key) ? nativeSet(this, key, value) : state.frozen.set(key, value);\n } else nativeSet(this, key, value);\n\n return this;\n }\n });\n}\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/es.weak-map.constructor.js?");
|
|
5081
5126
|
|
|
5082
5127
|
/***/ }),
|
|
5083
5128
|
|
|
@@ -5155,7 +5200,7 @@ eval(" // TODO: Remove from `core-js@4`\n\nvar $ = __webpack_require__(/*! ../in
|
|
|
5155
5200
|
/*! no static exports found */
|
|
5156
5201
|
/***/ (function(module, exports, __webpack_require__) {
|
|
5157
5202
|
|
|
5158
|
-
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/
|
|
5203
|
+
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol-define */ \"./node_modules/core-js-pure/internals/well-known-symbol-define.js\"); // `Symbol.asyncDispose` well-known symbol\n// https://github.com/tc39/proposal-using-statement\n\n\ndefineWellKnownSymbol('asyncDispose');\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/esnext.symbol.async-dispose.js?");
|
|
5159
5204
|
|
|
5160
5205
|
/***/ }),
|
|
5161
5206
|
|
|
@@ -5166,7 +5211,7 @@ eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/define-we
|
|
|
5166
5211
|
/*! no static exports found */
|
|
5167
5212
|
/***/ (function(module, exports, __webpack_require__) {
|
|
5168
5213
|
|
|
5169
|
-
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/
|
|
5214
|
+
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol-define */ \"./node_modules/core-js-pure/internals/well-known-symbol-define.js\"); // `Symbol.dispose` well-known symbol\n// https://github.com/tc39/proposal-using-statement\n\n\ndefineWellKnownSymbol('dispose');\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/esnext.symbol.dispose.js?");
|
|
5170
5215
|
|
|
5171
5216
|
/***/ }),
|
|
5172
5217
|
|
|
@@ -5177,7 +5222,7 @@ eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/define-we
|
|
|
5177
5222
|
/*! no static exports found */
|
|
5178
5223
|
/***/ (function(module, exports, __webpack_require__) {
|
|
5179
5224
|
|
|
5180
|
-
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/
|
|
5225
|
+
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol-define */ \"./node_modules/core-js-pure/internals/well-known-symbol-define.js\"); // `Symbol.matcher` well-known symbol\n// https://github.com/tc39/proposal-pattern-matching\n\n\ndefineWellKnownSymbol('matcher');\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/esnext.symbol.matcher.js?");
|
|
5181
5226
|
|
|
5182
5227
|
/***/ }),
|
|
5183
5228
|
|
|
@@ -5188,7 +5233,7 @@ eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/define-we
|
|
|
5188
5233
|
/*! no static exports found */
|
|
5189
5234
|
/***/ (function(module, exports, __webpack_require__) {
|
|
5190
5235
|
|
|
5191
|
-
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/
|
|
5236
|
+
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol-define */ \"./node_modules/core-js-pure/internals/well-known-symbol-define.js\"); // `Symbol.metadataKey` well-known symbol\n// https://github.com/tc39/proposal-decorator-metadata\n\n\ndefineWellKnownSymbol('metadataKey');\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/esnext.symbol.metadata-key.js?");
|
|
5192
5237
|
|
|
5193
5238
|
/***/ }),
|
|
5194
5239
|
|
|
@@ -5199,7 +5244,7 @@ eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/define-we
|
|
|
5199
5244
|
/*! no static exports found */
|
|
5200
5245
|
/***/ (function(module, exports, __webpack_require__) {
|
|
5201
5246
|
|
|
5202
|
-
eval("// TODO: Remove from `core-js@4`\nvar defineWellKnownSymbol = __webpack_require__(/*! ../internals/
|
|
5247
|
+
eval("// TODO: Remove from `core-js@4`\nvar defineWellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol-define */ \"./node_modules/core-js-pure/internals/well-known-symbol-define.js\"); // `Symbol.metadata` well-known symbol\n// https://github.com/tc39/proposal-decorators\n\n\ndefineWellKnownSymbol('metadata');\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/esnext.symbol.metadata.js?");
|
|
5203
5248
|
|
|
5204
5249
|
/***/ }),
|
|
5205
5250
|
|
|
@@ -5210,7 +5255,7 @@ eval("// TODO: Remove from `core-js@4`\nvar defineWellKnownSymbol = __webpack_re
|
|
|
5210
5255
|
/*! no static exports found */
|
|
5211
5256
|
/***/ (function(module, exports, __webpack_require__) {
|
|
5212
5257
|
|
|
5213
|
-
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/
|
|
5258
|
+
eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol-define */ \"./node_modules/core-js-pure/internals/well-known-symbol-define.js\"); // `Symbol.observable` well-known symbol\n// https://github.com/tc39/proposal-observable\n\n\ndefineWellKnownSymbol('observable');\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/esnext.symbol.observable.js?");
|
|
5214
5259
|
|
|
5215
5260
|
/***/ }),
|
|
5216
5261
|
|
|
@@ -5221,7 +5266,7 @@ eval("var defineWellKnownSymbol = __webpack_require__(/*! ../internals/define-we
|
|
|
5221
5266
|
/*! no static exports found */
|
|
5222
5267
|
/***/ (function(module, exports, __webpack_require__) {
|
|
5223
5268
|
|
|
5224
|
-
eval("// TODO: remove from `core-js@4`\nvar defineWellKnownSymbol = __webpack_require__(/*! ../internals/
|
|
5269
|
+
eval("// TODO: remove from `core-js@4`\nvar defineWellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol-define */ \"./node_modules/core-js-pure/internals/well-known-symbol-define.js\"); // `Symbol.patternMatch` well-known symbol\n// https://github.com/tc39/proposal-pattern-matching\n\n\ndefineWellKnownSymbol('patternMatch');\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/esnext.symbol.pattern-match.js?");
|
|
5225
5270
|
|
|
5226
5271
|
/***/ }),
|
|
5227
5272
|
|
|
@@ -5232,7 +5277,7 @@ eval("// TODO: remove from `core-js@4`\nvar defineWellKnownSymbol = __webpack_re
|
|
|
5232
5277
|
/*! no static exports found */
|
|
5233
5278
|
/***/ (function(module, exports, __webpack_require__) {
|
|
5234
5279
|
|
|
5235
|
-
eval("// TODO: remove from `core-js@4`\nvar defineWellKnownSymbol = __webpack_require__(/*! ../internals/
|
|
5280
|
+
eval("// TODO: remove from `core-js@4`\nvar defineWellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol-define */ \"./node_modules/core-js-pure/internals/well-known-symbol-define.js\");\n\ndefineWellKnownSymbol('replaceAll');\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/esnext.symbol.replace-all.js?");
|
|
5236
5281
|
|
|
5237
5282
|
/***/ }),
|
|
5238
5283
|
|
|
@@ -5255,7 +5300,7 @@ eval("__webpack_require__(/*! ../modules/es.array.iterator */ \"./node_modules/c
|
|
|
5255
5300
|
/***/ (function(module, exports, __webpack_require__) {
|
|
5256
5301
|
|
|
5257
5302
|
"use strict";
|
|
5258
|
-
eval(" // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`\n\n__webpack_require__(/*! ../modules/es.array.iterator */ \"./node_modules/core-js-pure/modules/es.array.iterator.js\");\n\nvar $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar global = __webpack_require__(/*! ../internals/global */ \"./node_modules/core-js-pure/internals/global.js\");\n\nvar call = __webpack_require__(/*! ../internals/function-call */ \"./node_modules/core-js-pure/internals/function-call.js\");\n\nvar uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ \"./node_modules/core-js-pure/internals/function-uncurry-this.js\");\n\nvar DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ \"./node_modules/core-js-pure/internals/descriptors.js\");\n\nvar USE_NATIVE_URL = __webpack_require__(/*! ../internals/native-url */ \"./node_modules/core-js-pure/internals/native-url.js\");\n\nvar defineBuiltIn = __webpack_require__(/*! ../internals/define-built-in */ \"./node_modules/core-js-pure/internals/define-built-in.js\");\n\nvar defineBuiltIns = __webpack_require__(/*! ../internals/define-built-ins */ \"./node_modules/core-js-pure/internals/define-built-ins.js\");\n\nvar setToStringTag = __webpack_require__(/*! ../internals/set-to-string-tag */ \"./node_modules/core-js-pure/internals/set-to-string-tag.js\");\n\nvar createIteratorConstructor = __webpack_require__(/*! ../internals/create-iterator-constructor */ \"./node_modules/core-js-pure/internals/create-iterator-constructor.js\");\n\nvar InternalStateModule = __webpack_require__(/*! ../internals/internal-state */ \"./node_modules/core-js-pure/internals/internal-state.js\");\n\nvar anInstance = __webpack_require__(/*! ../internals/an-instance */ \"./node_modules/core-js-pure/internals/an-instance.js\");\n\nvar isCallable = __webpack_require__(/*! ../internals/is-callable */ \"./node_modules/core-js-pure/internals/is-callable.js\");\n\nvar hasOwn = __webpack_require__(/*! ../internals/has-own-property */ \"./node_modules/core-js-pure/internals/has-own-property.js\");\n\nvar bind = __webpack_require__(/*! ../internals/function-bind-context */ \"./node_modules/core-js-pure/internals/function-bind-context.js\");\n\nvar classof = __webpack_require__(/*! ../internals/classof */ \"./node_modules/core-js-pure/internals/classof.js\");\n\nvar anObject = __webpack_require__(/*! ../internals/an-object */ \"./node_modules/core-js-pure/internals/an-object.js\");\n\nvar isObject = __webpack_require__(/*! ../internals/is-object */ \"./node_modules/core-js-pure/internals/is-object.js\");\n\nvar $toString = __webpack_require__(/*! ../internals/to-string */ \"./node_modules/core-js-pure/internals/to-string.js\");\n\nvar create = __webpack_require__(/*! ../internals/object-create */ \"./node_modules/core-js-pure/internals/object-create.js\");\n\nvar createPropertyDescriptor = __webpack_require__(/*! ../internals/create-property-descriptor */ \"./node_modules/core-js-pure/internals/create-property-descriptor.js\");\n\nvar getIterator = __webpack_require__(/*! ../internals/get-iterator */ \"./node_modules/core-js-pure/internals/get-iterator.js\");\n\nvar getIteratorMethod = __webpack_require__(/*! ../internals/get-iterator-method */ \"./node_modules/core-js-pure/internals/get-iterator-method.js\");\n\nvar validateArgumentsLength = __webpack_require__(/*! ../internals/validate-arguments-length */ \"./node_modules/core-js-pure/internals/validate-arguments-length.js\");\n\nvar wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ \"./node_modules/core-js-pure/internals/well-known-symbol.js\");\n\nvar arraySort = __webpack_require__(/*! ../internals/array-sort */ \"./node_modules/core-js-pure/internals/array-sort.js\");\n\nvar ITERATOR = wellKnownSymbol('iterator');\nvar URL_SEARCH_PARAMS = 'URLSearchParams';\nvar URL_SEARCH_PARAMS_ITERATOR = URL_SEARCH_PARAMS + 'Iterator';\nvar setInternalState = InternalStateModule.set;\nvar getInternalParamsState = InternalStateModule.getterFor(URL_SEARCH_PARAMS);\nvar getInternalIteratorState = InternalStateModule.getterFor(URL_SEARCH_PARAMS_ITERATOR); // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe\n\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // Avoid NodeJS experimental warning\n\nvar safeGetBuiltIn = function (name) {\n if (!DESCRIPTORS) return global[name];\n var descriptor = getOwnPropertyDescriptor(global, name);\n return descriptor && descriptor.value;\n};\n\nvar nativeFetch = safeGetBuiltIn('fetch');\nvar NativeRequest = safeGetBuiltIn('Request');\nvar Headers = safeGetBuiltIn('Headers');\nvar RequestPrototype = NativeRequest && NativeRequest.prototype;\nvar HeadersPrototype = Headers && Headers.prototype;\nvar RegExp = global.RegExp;\nvar TypeError = global.TypeError;\nvar decodeURIComponent = global.decodeURIComponent;\nvar encodeURIComponent = global.encodeURIComponent;\nvar charAt = uncurryThis(''.charAt);\nvar join = uncurryThis([].join);\nvar push = uncurryThis([].push);\nvar replace = uncurryThis(''.replace);\nvar shift = uncurryThis([].shift);\nvar splice = uncurryThis([].splice);\nvar split = uncurryThis(''.split);\nvar stringSlice = uncurryThis(''.slice);\nvar plus = /\\+/g;\nvar sequences = Array(4);\n\nvar percentSequence = function (bytes) {\n return sequences[bytes - 1] || (sequences[bytes - 1] = RegExp('((?:%[\\\\da-f]{2}){' + bytes + '})', 'gi'));\n};\n\nvar percentDecode = function (sequence) {\n try {\n return decodeURIComponent(sequence);\n } catch (error) {\n return sequence;\n }\n};\n\nvar deserialize = function (it) {\n var result = replace(it, plus, ' ');\n var bytes = 4;\n\n try {\n return decodeURIComponent(result);\n } catch (error) {\n while (bytes) {\n result = replace(result, percentSequence(bytes--), percentDecode);\n }\n\n return result;\n }\n};\n\nvar find = /[!'()~]|%20/g;\nvar replacements = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+'\n};\n\nvar replacer = function (match) {\n return replacements[match];\n};\n\nvar serialize = function (it) {\n return replace(encodeURIComponent(it), find, replacer);\n};\n\nvar URLSearchParamsIterator = createIteratorConstructor(function Iterator(params, kind) {\n setInternalState(this, {\n type: URL_SEARCH_PARAMS_ITERATOR,\n iterator: getIterator(getInternalParamsState(params).entries),\n kind: kind\n });\n}, 'Iterator', function next() {\n var state = getInternalIteratorState(this);\n var kind = state.kind;\n var step = state.iterator.next();\n var entry = step.value;\n\n if (!step.done) {\n step.value = kind === 'keys' ? entry.key : kind === 'values' ? entry.value : [entry.key, entry.value];\n }\n\n return step;\n}, true);\n\nvar URLSearchParamsState = function (init) {\n this.entries = [];\n this.url = null;\n\n if (init !== undefined) {\n if (isObject(init)) this.parseObject(init);else this.parseQuery(typeof init == 'string' ? charAt(init, 0) === '?' ? stringSlice(init, 1) : init : $toString(init));\n }\n};\n\nURLSearchParamsState.prototype = {\n type: URL_SEARCH_PARAMS,\n bindURL: function (url) {\n this.url = url;\n this.update();\n },\n parseObject: function (object) {\n var iteratorMethod = getIteratorMethod(object);\n var iterator, next, step, entryIterator, entryNext, first, second;\n\n if (iteratorMethod) {\n iterator = getIterator(object, iteratorMethod);\n next = iterator.next;\n\n while (!(step = call(next, iterator)).done) {\n entryIterator = getIterator(anObject(step.value));\n entryNext = entryIterator.next;\n if ((first = call(entryNext, entryIterator)).done || (second = call(entryNext, entryIterator)).done || !call(entryNext, entryIterator).done) throw TypeError('Expected sequence with length 2');\n push(this.entries, {\n key: $toString(first.value),\n value: $toString(second.value)\n });\n }\n } else for (var key in object) if (hasOwn(object, key)) {\n push(this.entries, {\n key: key,\n value: $toString(object[key])\n });\n }\n },\n parseQuery: function (query) {\n if (query) {\n var attributes = split(query, '&');\n var index = 0;\n var attribute, entry;\n\n while (index < attributes.length) {\n attribute = attributes[index++];\n\n if (attribute.length) {\n entry = split(attribute, '=');\n push(this.entries, {\n key: deserialize(shift(entry)),\n value: deserialize(join(entry, '='))\n });\n }\n }\n }\n },\n serialize: function () {\n var entries = this.entries;\n var result = [];\n var index = 0;\n var entry;\n\n while (index < entries.length) {\n entry = entries[index++];\n push(result, serialize(entry.key) + '=' + serialize(entry.value));\n }\n\n return join(result, '&');\n },\n update: function () {\n this.entries.length = 0;\n this.parseQuery(this.url.query);\n },\n updateURL: function () {\n if (this.url) this.url.update();\n }\n}; // `URLSearchParams` constructor\n// https://url.spec.whatwg.org/#interface-urlsearchparams\n\nvar URLSearchParamsConstructor = function\n /* init */\nURLSearchParams() {\n anInstance(this, URLSearchParamsPrototype);\n var init = arguments.length > 0 ? arguments[0] : undefined;\n setInternalState(this, new URLSearchParamsState(init));\n};\n\nvar URLSearchParamsPrototype = URLSearchParamsConstructor.prototype;\ndefineBuiltIns(URLSearchParamsPrototype, {\n // `URLSearchParams.prototype.append` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-append\n append: function append(name, value) {\n validateArgumentsLength(arguments.length, 2);\n var state = getInternalParamsState(this);\n push(state.entries, {\n key: $toString(name),\n value: $toString(value)\n });\n state.updateURL();\n },\n // `URLSearchParams.prototype.delete` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-delete\n 'delete': function (name) {\n validateArgumentsLength(arguments.length, 1);\n var state = getInternalParamsState(this);\n var entries = state.entries;\n var key = $toString(name);\n var index = 0;\n\n while (index < entries.length) {\n if (entries[index].key === key) splice(entries, index, 1);else index++;\n }\n\n state.updateURL();\n },\n // `URLSearchParams.prototype.get` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-get\n get: function get(name) {\n validateArgumentsLength(arguments.length, 1);\n var entries = getInternalParamsState(this).entries;\n var key = $toString(name);\n var index = 0;\n\n for (; index < entries.length; index++) {\n if (entries[index].key === key) return entries[index].value;\n }\n\n return null;\n },\n // `URLSearchParams.prototype.getAll` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-getall\n getAll: function getAll(name) {\n validateArgumentsLength(arguments.length, 1);\n var entries = getInternalParamsState(this).entries;\n var key = $toString(name);\n var result = [];\n var index = 0;\n\n for (; index < entries.length; index++) {\n if (entries[index].key === key) push(result, entries[index].value);\n }\n\n return result;\n },\n // `URLSearchParams.prototype.has` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-has\n has: function has(name) {\n validateArgumentsLength(arguments.length, 1);\n var entries = getInternalParamsState(this).entries;\n var key = $toString(name);\n var index = 0;\n\n while (index < entries.length) {\n if (entries[index++].key === key) return true;\n }\n\n return false;\n },\n // `URLSearchParams.prototype.set` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-set\n set: function set(name, value) {\n validateArgumentsLength(arguments.length, 1);\n var state = getInternalParamsState(this);\n var entries = state.entries;\n var found = false;\n var key = $toString(name);\n var val = $toString(value);\n var index = 0;\n var entry;\n\n for (; index < entries.length; index++) {\n entry = entries[index];\n\n if (entry.key === key) {\n if (found) splice(entries, index--, 1);else {\n found = true;\n entry.value = val;\n }\n }\n }\n\n if (!found) push(entries, {\n key: key,\n value: val\n });\n state.updateURL();\n },\n // `URLSearchParams.prototype.sort` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-sort\n sort: function sort() {\n var state = getInternalParamsState(this);\n arraySort(state.entries, function (a, b) {\n return a.key > b.key ? 1 : -1;\n });\n state.updateURL();\n },\n // `URLSearchParams.prototype.forEach` method\n forEach: function forEach(callback\n /* , thisArg */\n ) {\n var entries = getInternalParamsState(this).entries;\n var boundFunction = bind(callback, arguments.length > 1 ? arguments[1] : undefined);\n var index = 0;\n var entry;\n\n while (index < entries.length) {\n entry = entries[index++];\n boundFunction(entry.value, entry.key, this);\n }\n },\n // `URLSearchParams.prototype.keys` method\n keys: function keys() {\n return new URLSearchParamsIterator(this, 'keys');\n },\n // `URLSearchParams.prototype.values` method\n values: function values() {\n return new URLSearchParamsIterator(this, 'values');\n },\n // `URLSearchParams.prototype.entries` method\n entries: function entries() {\n return new URLSearchParamsIterator(this, 'entries');\n }\n}, {\n enumerable: true\n}); // `URLSearchParams.prototype[@@iterator]` method\n\ndefineBuiltIn(URLSearchParamsPrototype, ITERATOR, URLSearchParamsPrototype.entries, {\n name: 'entries'\n}); // `URLSearchParams.prototype.toString` method\n// https://url.spec.whatwg.org/#urlsearchparams-stringification-behavior\n\ndefineBuiltIn(URLSearchParamsPrototype, 'toString', function toString() {\n return getInternalParamsState(this).serialize();\n}, {\n enumerable: true\n});\nsetToStringTag(URLSearchParamsConstructor, URL_SEARCH_PARAMS);\n$({\n global: true,\n constructor: true,\n forced: !USE_NATIVE_URL\n}, {\n URLSearchParams: URLSearchParamsConstructor\n}); // Wrap `fetch` and `Request` for correct work with polyfilled `URLSearchParams`\n\nif (!USE_NATIVE_URL && isCallable(Headers)) {\n var headersHas = uncurryThis(HeadersPrototype.has);\n var headersSet = uncurryThis(HeadersPrototype.set);\n\n var wrapRequestOptions = function (init) {\n if (isObject(init)) {\n var body = init.body;\n var headers;\n\n if (classof(body) === URL_SEARCH_PARAMS) {\n headers = init.headers ? new Headers(init.headers) : new Headers();\n\n if (!headersHas(headers, 'content-type')) {\n headersSet(headers, 'content-type', 'application/x-www-form-urlencoded;charset=UTF-8');\n }\n\n return create(init, {\n body: createPropertyDescriptor(0, $toString(body)),\n headers: createPropertyDescriptor(0, headers)\n });\n }\n }\n\n return init;\n };\n\n if (isCallable(nativeFetch)) {\n $({\n global: true,\n enumerable: true,\n dontCallGetSet: true,\n forced: true\n }, {\n fetch: function fetch(input\n /* , init */\n ) {\n return nativeFetch(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {});\n }\n });\n }\n\n if (isCallable(NativeRequest)) {\n var RequestConstructor = function Request(input\n /* , init */\n ) {\n anInstance(this, RequestPrototype);\n return new NativeRequest(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {});\n };\n\n RequestPrototype.constructor = RequestConstructor;\n RequestConstructor.prototype = RequestPrototype;\n $({\n global: true,\n constructor: true,\n dontCallGetSet: true,\n forced: true\n }, {\n Request: RequestConstructor\n });\n }\n}\n\nmodule.exports = {\n URLSearchParams: URLSearchParamsConstructor,\n getState: getInternalParamsState\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/web.url-search-params.constructor.js?");
|
|
5303
|
+
eval(" // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`\n\n__webpack_require__(/*! ../modules/es.array.iterator */ \"./node_modules/core-js-pure/modules/es.array.iterator.js\");\n\nvar $ = __webpack_require__(/*! ../internals/export */ \"./node_modules/core-js-pure/internals/export.js\");\n\nvar global = __webpack_require__(/*! ../internals/global */ \"./node_modules/core-js-pure/internals/global.js\");\n\nvar call = __webpack_require__(/*! ../internals/function-call */ \"./node_modules/core-js-pure/internals/function-call.js\");\n\nvar uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ \"./node_modules/core-js-pure/internals/function-uncurry-this.js\");\n\nvar DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ \"./node_modules/core-js-pure/internals/descriptors.js\");\n\nvar USE_NATIVE_URL = __webpack_require__(/*! ../internals/url-constructor-detection */ \"./node_modules/core-js-pure/internals/url-constructor-detection.js\");\n\nvar defineBuiltIn = __webpack_require__(/*! ../internals/define-built-in */ \"./node_modules/core-js-pure/internals/define-built-in.js\");\n\nvar defineBuiltIns = __webpack_require__(/*! ../internals/define-built-ins */ \"./node_modules/core-js-pure/internals/define-built-ins.js\");\n\nvar setToStringTag = __webpack_require__(/*! ../internals/set-to-string-tag */ \"./node_modules/core-js-pure/internals/set-to-string-tag.js\");\n\nvar createIteratorConstructor = __webpack_require__(/*! ../internals/iterator-create-constructor */ \"./node_modules/core-js-pure/internals/iterator-create-constructor.js\");\n\nvar InternalStateModule = __webpack_require__(/*! ../internals/internal-state */ \"./node_modules/core-js-pure/internals/internal-state.js\");\n\nvar anInstance = __webpack_require__(/*! ../internals/an-instance */ \"./node_modules/core-js-pure/internals/an-instance.js\");\n\nvar isCallable = __webpack_require__(/*! ../internals/is-callable */ \"./node_modules/core-js-pure/internals/is-callable.js\");\n\nvar hasOwn = __webpack_require__(/*! ../internals/has-own-property */ \"./node_modules/core-js-pure/internals/has-own-property.js\");\n\nvar bind = __webpack_require__(/*! ../internals/function-bind-context */ \"./node_modules/core-js-pure/internals/function-bind-context.js\");\n\nvar classof = __webpack_require__(/*! ../internals/classof */ \"./node_modules/core-js-pure/internals/classof.js\");\n\nvar anObject = __webpack_require__(/*! ../internals/an-object */ \"./node_modules/core-js-pure/internals/an-object.js\");\n\nvar isObject = __webpack_require__(/*! ../internals/is-object */ \"./node_modules/core-js-pure/internals/is-object.js\");\n\nvar $toString = __webpack_require__(/*! ../internals/to-string */ \"./node_modules/core-js-pure/internals/to-string.js\");\n\nvar create = __webpack_require__(/*! ../internals/object-create */ \"./node_modules/core-js-pure/internals/object-create.js\");\n\nvar createPropertyDescriptor = __webpack_require__(/*! ../internals/create-property-descriptor */ \"./node_modules/core-js-pure/internals/create-property-descriptor.js\");\n\nvar getIterator = __webpack_require__(/*! ../internals/get-iterator */ \"./node_modules/core-js-pure/internals/get-iterator.js\");\n\nvar getIteratorMethod = __webpack_require__(/*! ../internals/get-iterator-method */ \"./node_modules/core-js-pure/internals/get-iterator-method.js\");\n\nvar validateArgumentsLength = __webpack_require__(/*! ../internals/validate-arguments-length */ \"./node_modules/core-js-pure/internals/validate-arguments-length.js\");\n\nvar wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ \"./node_modules/core-js-pure/internals/well-known-symbol.js\");\n\nvar arraySort = __webpack_require__(/*! ../internals/array-sort */ \"./node_modules/core-js-pure/internals/array-sort.js\");\n\nvar ITERATOR = wellKnownSymbol('iterator');\nvar URL_SEARCH_PARAMS = 'URLSearchParams';\nvar URL_SEARCH_PARAMS_ITERATOR = URL_SEARCH_PARAMS + 'Iterator';\nvar setInternalState = InternalStateModule.set;\nvar getInternalParamsState = InternalStateModule.getterFor(URL_SEARCH_PARAMS);\nvar getInternalIteratorState = InternalStateModule.getterFor(URL_SEARCH_PARAMS_ITERATOR); // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe\n\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // Avoid NodeJS experimental warning\n\nvar safeGetBuiltIn = function (name) {\n if (!DESCRIPTORS) return global[name];\n var descriptor = getOwnPropertyDescriptor(global, name);\n return descriptor && descriptor.value;\n};\n\nvar nativeFetch = safeGetBuiltIn('fetch');\nvar NativeRequest = safeGetBuiltIn('Request');\nvar Headers = safeGetBuiltIn('Headers');\nvar RequestPrototype = NativeRequest && NativeRequest.prototype;\nvar HeadersPrototype = Headers && Headers.prototype;\nvar RegExp = global.RegExp;\nvar TypeError = global.TypeError;\nvar decodeURIComponent = global.decodeURIComponent;\nvar encodeURIComponent = global.encodeURIComponent;\nvar charAt = uncurryThis(''.charAt);\nvar join = uncurryThis([].join);\nvar push = uncurryThis([].push);\nvar replace = uncurryThis(''.replace);\nvar shift = uncurryThis([].shift);\nvar splice = uncurryThis([].splice);\nvar split = uncurryThis(''.split);\nvar stringSlice = uncurryThis(''.slice);\nvar plus = /\\+/g;\nvar sequences = Array(4);\n\nvar percentSequence = function (bytes) {\n return sequences[bytes - 1] || (sequences[bytes - 1] = RegExp('((?:%[\\\\da-f]{2}){' + bytes + '})', 'gi'));\n};\n\nvar percentDecode = function (sequence) {\n try {\n return decodeURIComponent(sequence);\n } catch (error) {\n return sequence;\n }\n};\n\nvar deserialize = function (it) {\n var result = replace(it, plus, ' ');\n var bytes = 4;\n\n try {\n return decodeURIComponent(result);\n } catch (error) {\n while (bytes) {\n result = replace(result, percentSequence(bytes--), percentDecode);\n }\n\n return result;\n }\n};\n\nvar find = /[!'()~]|%20/g;\nvar replacements = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+'\n};\n\nvar replacer = function (match) {\n return replacements[match];\n};\n\nvar serialize = function (it) {\n return replace(encodeURIComponent(it), find, replacer);\n};\n\nvar URLSearchParamsIterator = createIteratorConstructor(function Iterator(params, kind) {\n setInternalState(this, {\n type: URL_SEARCH_PARAMS_ITERATOR,\n iterator: getIterator(getInternalParamsState(params).entries),\n kind: kind\n });\n}, 'Iterator', function next() {\n var state = getInternalIteratorState(this);\n var kind = state.kind;\n var step = state.iterator.next();\n var entry = step.value;\n\n if (!step.done) {\n step.value = kind === 'keys' ? entry.key : kind === 'values' ? entry.value : [entry.key, entry.value];\n }\n\n return step;\n}, true);\n\nvar URLSearchParamsState = function (init) {\n this.entries = [];\n this.url = null;\n\n if (init !== undefined) {\n if (isObject(init)) this.parseObject(init);else this.parseQuery(typeof init == 'string' ? charAt(init, 0) === '?' ? stringSlice(init, 1) : init : $toString(init));\n }\n};\n\nURLSearchParamsState.prototype = {\n type: URL_SEARCH_PARAMS,\n bindURL: function (url) {\n this.url = url;\n this.update();\n },\n parseObject: function (object) {\n var iteratorMethod = getIteratorMethod(object);\n var iterator, next, step, entryIterator, entryNext, first, second;\n\n if (iteratorMethod) {\n iterator = getIterator(object, iteratorMethod);\n next = iterator.next;\n\n while (!(step = call(next, iterator)).done) {\n entryIterator = getIterator(anObject(step.value));\n entryNext = entryIterator.next;\n if ((first = call(entryNext, entryIterator)).done || (second = call(entryNext, entryIterator)).done || !call(entryNext, entryIterator).done) throw TypeError('Expected sequence with length 2');\n push(this.entries, {\n key: $toString(first.value),\n value: $toString(second.value)\n });\n }\n } else for (var key in object) if (hasOwn(object, key)) {\n push(this.entries, {\n key: key,\n value: $toString(object[key])\n });\n }\n },\n parseQuery: function (query) {\n if (query) {\n var attributes = split(query, '&');\n var index = 0;\n var attribute, entry;\n\n while (index < attributes.length) {\n attribute = attributes[index++];\n\n if (attribute.length) {\n entry = split(attribute, '=');\n push(this.entries, {\n key: deserialize(shift(entry)),\n value: deserialize(join(entry, '='))\n });\n }\n }\n }\n },\n serialize: function () {\n var entries = this.entries;\n var result = [];\n var index = 0;\n var entry;\n\n while (index < entries.length) {\n entry = entries[index++];\n push(result, serialize(entry.key) + '=' + serialize(entry.value));\n }\n\n return join(result, '&');\n },\n update: function () {\n this.entries.length = 0;\n this.parseQuery(this.url.query);\n },\n updateURL: function () {\n if (this.url) this.url.update();\n }\n}; // `URLSearchParams` constructor\n// https://url.spec.whatwg.org/#interface-urlsearchparams\n\nvar URLSearchParamsConstructor = function\n /* init */\nURLSearchParams() {\n anInstance(this, URLSearchParamsPrototype);\n var init = arguments.length > 0 ? arguments[0] : undefined;\n setInternalState(this, new URLSearchParamsState(init));\n};\n\nvar URLSearchParamsPrototype = URLSearchParamsConstructor.prototype;\ndefineBuiltIns(URLSearchParamsPrototype, {\n // `URLSearchParams.prototype.append` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-append\n append: function append(name, value) {\n validateArgumentsLength(arguments.length, 2);\n var state = getInternalParamsState(this);\n push(state.entries, {\n key: $toString(name),\n value: $toString(value)\n });\n state.updateURL();\n },\n // `URLSearchParams.prototype.delete` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-delete\n 'delete': function (name) {\n validateArgumentsLength(arguments.length, 1);\n var state = getInternalParamsState(this);\n var entries = state.entries;\n var key = $toString(name);\n var index = 0;\n\n while (index < entries.length) {\n if (entries[index].key === key) splice(entries, index, 1);else index++;\n }\n\n state.updateURL();\n },\n // `URLSearchParams.prototype.get` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-get\n get: function get(name) {\n validateArgumentsLength(arguments.length, 1);\n var entries = getInternalParamsState(this).entries;\n var key = $toString(name);\n var index = 0;\n\n for (; index < entries.length; index++) {\n if (entries[index].key === key) return entries[index].value;\n }\n\n return null;\n },\n // `URLSearchParams.prototype.getAll` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-getall\n getAll: function getAll(name) {\n validateArgumentsLength(arguments.length, 1);\n var entries = getInternalParamsState(this).entries;\n var key = $toString(name);\n var result = [];\n var index = 0;\n\n for (; index < entries.length; index++) {\n if (entries[index].key === key) push(result, entries[index].value);\n }\n\n return result;\n },\n // `URLSearchParams.prototype.has` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-has\n has: function has(name) {\n validateArgumentsLength(arguments.length, 1);\n var entries = getInternalParamsState(this).entries;\n var key = $toString(name);\n var index = 0;\n\n while (index < entries.length) {\n if (entries[index++].key === key) return true;\n }\n\n return false;\n },\n // `URLSearchParams.prototype.set` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-set\n set: function set(name, value) {\n validateArgumentsLength(arguments.length, 1);\n var state = getInternalParamsState(this);\n var entries = state.entries;\n var found = false;\n var key = $toString(name);\n var val = $toString(value);\n var index = 0;\n var entry;\n\n for (; index < entries.length; index++) {\n entry = entries[index];\n\n if (entry.key === key) {\n if (found) splice(entries, index--, 1);else {\n found = true;\n entry.value = val;\n }\n }\n }\n\n if (!found) push(entries, {\n key: key,\n value: val\n });\n state.updateURL();\n },\n // `URLSearchParams.prototype.sort` method\n // https://url.spec.whatwg.org/#dom-urlsearchparams-sort\n sort: function sort() {\n var state = getInternalParamsState(this);\n arraySort(state.entries, function (a, b) {\n return a.key > b.key ? 1 : -1;\n });\n state.updateURL();\n },\n // `URLSearchParams.prototype.forEach` method\n forEach: function forEach(callback\n /* , thisArg */\n ) {\n var entries = getInternalParamsState(this).entries;\n var boundFunction = bind(callback, arguments.length > 1 ? arguments[1] : undefined);\n var index = 0;\n var entry;\n\n while (index < entries.length) {\n entry = entries[index++];\n boundFunction(entry.value, entry.key, this);\n }\n },\n // `URLSearchParams.prototype.keys` method\n keys: function keys() {\n return new URLSearchParamsIterator(this, 'keys');\n },\n // `URLSearchParams.prototype.values` method\n values: function values() {\n return new URLSearchParamsIterator(this, 'values');\n },\n // `URLSearchParams.prototype.entries` method\n entries: function entries() {\n return new URLSearchParamsIterator(this, 'entries');\n }\n}, {\n enumerable: true\n}); // `URLSearchParams.prototype[@@iterator]` method\n\ndefineBuiltIn(URLSearchParamsPrototype, ITERATOR, URLSearchParamsPrototype.entries, {\n name: 'entries'\n}); // `URLSearchParams.prototype.toString` method\n// https://url.spec.whatwg.org/#urlsearchparams-stringification-behavior\n\ndefineBuiltIn(URLSearchParamsPrototype, 'toString', function toString() {\n return getInternalParamsState(this).serialize();\n}, {\n enumerable: true\n});\nsetToStringTag(URLSearchParamsConstructor, URL_SEARCH_PARAMS);\n$({\n global: true,\n constructor: true,\n forced: !USE_NATIVE_URL\n}, {\n URLSearchParams: URLSearchParamsConstructor\n}); // Wrap `fetch` and `Request` for correct work with polyfilled `URLSearchParams`\n\nif (!USE_NATIVE_URL && isCallable(Headers)) {\n var headersHas = uncurryThis(HeadersPrototype.has);\n var headersSet = uncurryThis(HeadersPrototype.set);\n\n var wrapRequestOptions = function (init) {\n if (isObject(init)) {\n var body = init.body;\n var headers;\n\n if (classof(body) === URL_SEARCH_PARAMS) {\n headers = init.headers ? new Headers(init.headers) : new Headers();\n\n if (!headersHas(headers, 'content-type')) {\n headersSet(headers, 'content-type', 'application/x-www-form-urlencoded;charset=UTF-8');\n }\n\n return create(init, {\n body: createPropertyDescriptor(0, $toString(body)),\n headers: createPropertyDescriptor(0, headers)\n });\n }\n }\n\n return init;\n };\n\n if (isCallable(nativeFetch)) {\n $({\n global: true,\n enumerable: true,\n dontCallGetSet: true,\n forced: true\n }, {\n fetch: function fetch(input\n /* , init */\n ) {\n return nativeFetch(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {});\n }\n });\n }\n\n if (isCallable(NativeRequest)) {\n var RequestConstructor = function Request(input\n /* , init */\n ) {\n anInstance(this, RequestPrototype);\n return new NativeRequest(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {});\n };\n\n RequestPrototype.constructor = RequestConstructor;\n RequestConstructor.prototype = RequestPrototype;\n $({\n global: true,\n constructor: true,\n dontCallGetSet: true,\n forced: true\n }, {\n Request: RequestConstructor\n });\n }\n}\n\nmodule.exports = {\n URLSearchParams: URLSearchParamsConstructor,\n getState: getInternalParamsState\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/core-js-pure/modules/web.url-search-params.constructor.js?");
|
|
5259
5304
|
|
|
5260
5305
|
/***/ }),
|
|
5261
5306
|
|
|
@@ -6312,7 +6357,7 @@ eval("\n\nvar implementation = __webpack_require__(/*! ./implementation */ \"./n
|
|
|
6312
6357
|
/***/ (function(module, exports, __webpack_require__) {
|
|
6313
6358
|
|
|
6314
6359
|
"use strict";
|
|
6315
|
-
eval("\n\nvar undefined;\nvar $SyntaxError = SyntaxError;\nvar $Function = Function;\nvar $TypeError = TypeError; // eslint-disable-next-line consistent-return\n\nvar getEvalledConstructor = function (expressionSyntax) {\n try {\n return $Function('\"use strict\"; return (' + expressionSyntax + ').constructor;')();\n } catch (e) {}\n};\n\nvar $gOPD = Object.getOwnPropertyDescriptor;\n\nif ($gOPD) {\n try {\n $gOPD({}, '');\n } catch (e) {\n $gOPD = null; // this is IE 8, which has a broken gOPD\n }\n}\n\nvar throwTypeError = function () {\n throw new $TypeError();\n};\n\nvar ThrowTypeError = $gOPD ? function () {\n try {\n // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties\n arguments.callee; // IE 8 does not throw here\n\n return throwTypeError;\n } catch (calleeThrows) {\n try {\n // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')\n return $gOPD(arguments, 'callee').get;\n } catch (gOPDthrows) {\n return throwTypeError;\n }\n }\n}() : throwTypeError;\n\nvar hasSymbols = __webpack_require__(/*! has-symbols */ \"./node_modules/has-symbols/index.js\")();\n\nvar getProto = Object.getPrototypeOf || function (x) {\n return x.__proto__;\n}; // eslint-disable-line no-proto\n\n\nvar needsEval = {};\nvar TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);\nvar INTRINSICS = {\n '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,\n '%Array%': Array,\n '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,\n '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,\n '%AsyncFromSyncIteratorPrototype%': undefined,\n '%AsyncFunction%': needsEval,\n '%AsyncGenerator%': needsEval,\n '%AsyncGeneratorFunction%': needsEval,\n '%AsyncIteratorPrototype%': needsEval,\n '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,\n '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,\n '%Boolean%': Boolean,\n '%DataView%': typeof DataView === 'undefined' ? undefined : DataView,\n '%Date%': Date,\n '%decodeURI%': decodeURI,\n '%decodeURIComponent%': decodeURIComponent,\n '%encodeURI%': encodeURI,\n '%encodeURIComponent%': encodeURIComponent,\n '%Error%': Error,\n '%eval%': eval,\n // eslint-disable-line no-eval\n '%EvalError%': EvalError,\n '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,\n '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,\n '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,\n '%Function%': $Function,\n '%GeneratorFunction%': needsEval,\n '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,\n '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,\n '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,\n '%isFinite%': isFinite,\n '%isNaN%': isNaN,\n '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,\n '%JSON%': typeof JSON === 'object' ? JSON : undefined,\n '%Map%': typeof Map === 'undefined' ? undefined : Map,\n '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),\n '%Math%': Math,\n '%Number%': Number,\n '%Object%': Object,\n '%parseFloat%': parseFloat,\n '%parseInt%': parseInt,\n '%Promise%': typeof Promise === 'undefined' ? undefined : Promise,\n '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,\n '%RangeError%': RangeError,\n '%ReferenceError%': ReferenceError,\n '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,\n '%RegExp%': RegExp,\n '%Set%': typeof Set === 'undefined' ? undefined : Set,\n '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),\n '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,\n '%String%': String,\n '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,\n '%Symbol%': hasSymbols ? Symbol : undefined,\n '%SyntaxError%': $SyntaxError,\n '%ThrowTypeError%': ThrowTypeError,\n '%TypedArray%': TypedArray,\n '%TypeError%': $TypeError,\n '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,\n '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,\n '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,\n '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,\n '%URIError%': URIError,\n '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,\n '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,\n '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet\n};\n\nvar doEval = function doEval(name) {\n var value;\n\n if (name === '%AsyncFunction%') {\n value = getEvalledConstructor('async function () {}');\n } else if (name === '%GeneratorFunction%') {\n value = getEvalledConstructor('function* () {}');\n } else if (name === '%AsyncGeneratorFunction%') {\n value = getEvalledConstructor('async function* () {}');\n } else if (name === '%AsyncGenerator%') {\n var fn = doEval('%AsyncGeneratorFunction%');\n\n if (fn) {\n value = fn.prototype;\n }\n } else if (name === '%AsyncIteratorPrototype%') {\n var gen = doEval('%AsyncGenerator%');\n\n if (gen) {\n value = getProto(gen.prototype);\n }\n }\n\n INTRINSICS[name] = value;\n return value;\n};\n\nvar LEGACY_ALIASES = {\n '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],\n '%ArrayPrototype%': ['Array', 'prototype'],\n '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],\n '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],\n '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],\n '%ArrayProto_values%': ['Array', 'prototype', 'values'],\n '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],\n '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],\n '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],\n '%BooleanPrototype%': ['Boolean', 'prototype'],\n '%DataViewPrototype%': ['DataView', 'prototype'],\n '%DatePrototype%': ['Date', 'prototype'],\n '%ErrorPrototype%': ['Error', 'prototype'],\n '%EvalErrorPrototype%': ['EvalError', 'prototype'],\n '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],\n '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],\n '%FunctionPrototype%': ['Function', 'prototype'],\n '%Generator%': ['GeneratorFunction', 'prototype'],\n '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],\n '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],\n '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],\n '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],\n '%JSONParse%': ['JSON', 'parse'],\n '%JSONStringify%': ['JSON', 'stringify'],\n '%MapPrototype%': ['Map', 'prototype'],\n '%NumberPrototype%': ['Number', 'prototype'],\n '%ObjectPrototype%': ['Object', 'prototype'],\n '%ObjProto_toString%': ['Object', 'prototype', 'toString'],\n '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],\n '%PromisePrototype%': ['Promise', 'prototype'],\n '%PromiseProto_then%': ['Promise', 'prototype', 'then'],\n '%Promise_all%': ['Promise', 'all'],\n '%Promise_reject%': ['Promise', 'reject'],\n '%Promise_resolve%': ['Promise', 'resolve'],\n '%RangeErrorPrototype%': ['RangeError', 'prototype'],\n '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],\n '%RegExpPrototype%': ['RegExp', 'prototype'],\n '%SetPrototype%': ['Set', 'prototype'],\n '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],\n '%StringPrototype%': ['String', 'prototype'],\n '%SymbolPrototype%': ['Symbol', 'prototype'],\n '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],\n '%TypedArrayPrototype%': ['TypedArray', 'prototype'],\n '%TypeErrorPrototype%': ['TypeError', 'prototype'],\n '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],\n '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],\n '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],\n '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],\n '%URIErrorPrototype%': ['URIError', 'prototype'],\n '%WeakMapPrototype%': ['WeakMap', 'prototype'],\n '%WeakSetPrototype%': ['WeakSet', 'prototype']\n};\n\nvar bind = __webpack_require__(/*! function-bind */ \"./node_modules/function-bind/index.js\");\n\nvar hasOwn = __webpack_require__(/*! has */ \"./node_modules/has/src/index.js\");\n\nvar $concat = bind.call(Function.call, Array.prototype.concat);\nvar $spliceApply = bind.call(Function.apply, Array.prototype.splice);\nvar $replace = bind.call(Function.call, String.prototype.replace);\nvar $strSlice = bind.call(Function.call, String.prototype.slice);\nvar $exec = bind.call(Function.call, RegExp.prototype.exec);\n/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */\n\nvar rePropName = /[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g;\nvar reEscapeChar = /\\\\(\\\\)?/g;\n/** Used to match backslashes in property paths. */\n\nvar stringToPath = function stringToPath(string) {\n var first = $strSlice(string, 0, 1);\n var last = $strSlice(string, -1);\n\n if (first === '%' && last !== '%') {\n throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');\n } else if (last === '%' && first !== '%') {\n throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');\n }\n\n var result = [];\n $replace(string, rePropName, function (match, number, quote, subString) {\n result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;\n });\n return result;\n};\n/* end adaptation */\n\n\nvar getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {\n var intrinsicName = name;\n var alias;\n\n if (hasOwn(LEGACY_ALIASES, intrinsicName)) {\n alias = LEGACY_ALIASES[intrinsicName];\n intrinsicName = '%' + alias[0] + '%';\n }\n\n if (hasOwn(INTRINSICS, intrinsicName)) {\n var value = INTRINSICS[intrinsicName];\n\n if (value === needsEval) {\n value = doEval(intrinsicName);\n }\n\n if (typeof value === 'undefined' && !allowMissing) {\n throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');\n }\n\n return {\n alias: alias,\n name: intrinsicName,\n value: value\n };\n }\n\n throw new $SyntaxError('intrinsic ' + name + ' does not exist!');\n};\n\nmodule.exports = function GetIntrinsic(name, allowMissing) {\n if (typeof name !== 'string' || name.length === 0) {\n throw new $TypeError('intrinsic name must be a non-empty string');\n }\n\n if (arguments.length > 1 && typeof allowMissing !== 'boolean') {\n throw new $TypeError('\"allowMissing\" argument must be a boolean');\n }\n\n if ($exec(/^%?[^%]*%?$/g, name) === null) {\n throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');\n }\n\n var parts = stringToPath(name);\n var intrinsicBaseName = parts.length > 0 ? parts[0] : '';\n var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);\n var intrinsicRealName = intrinsic.name;\n var value = intrinsic.value;\n var skipFurtherCaching = false;\n var alias = intrinsic.alias;\n\n if (alias) {\n intrinsicBaseName = alias[0];\n $spliceApply(parts, $concat([0, 1], alias));\n }\n\n for (var i = 1, isOwn = true; i < parts.length; i += 1) {\n var part = parts[i];\n var first = $strSlice(part, 0, 1);\n var last = $strSlice(part, -1);\n\n if ((first === '\"' || first === \"'\" || first === '`' || last === '\"' || last === \"'\" || last === '`') && first !== last) {\n throw new $SyntaxError('property names with quotes must have matching quotes');\n }\n\n if (part === 'constructor' || !isOwn) {\n skipFurtherCaching = true;\n }\n\n intrinsicBaseName += '.' + part;\n intrinsicRealName = '%' + intrinsicBaseName + '%';\n\n if (hasOwn(INTRINSICS, intrinsicRealName)) {\n value = INTRINSICS[intrinsicRealName];\n } else if (value != null) {\n if (!(part in value)) {\n if (!allowMissing) {\n throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');\n }\n\n return void undefined;\n }\n\n if ($gOPD && i + 1 >= parts.length) {\n var desc = $gOPD(value, part);\n isOwn = !!desc; // By convention, when a data property is converted to an accessor\n // property to emulate a data property that does not suffer from\n // the override mistake, that accessor's getter is marked with\n // an `originalValue` property. Here, when we detect this, we\n // uphold the illusion by pretending to see that original data\n // property, i.e., returning the value rather than the getter\n // itself.\n\n if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {\n value = desc.get;\n } else {\n value = value[part];\n }\n } else {\n isOwn = hasOwn(value, part);\n value = value[part];\n }\n\n if (isOwn && !skipFurtherCaching) {\n INTRINSICS[intrinsicRealName] = value;\n }\n }\n }\n\n return value;\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/get-intrinsic/index.js?");
|
|
6360
|
+
eval("\n\nvar undefined;\nvar $SyntaxError = SyntaxError;\nvar $Function = Function;\nvar $TypeError = TypeError; // eslint-disable-next-line consistent-return\n\nvar getEvalledConstructor = function (expressionSyntax) {\n try {\n return $Function('\"use strict\"; return (' + expressionSyntax + ').constructor;')();\n } catch (e) {}\n};\n\nvar $gOPD = Object.getOwnPropertyDescriptor;\n\nif ($gOPD) {\n try {\n $gOPD({}, '');\n } catch (e) {\n $gOPD = null; // this is IE 8, which has a broken gOPD\n }\n}\n\nvar throwTypeError = function () {\n throw new $TypeError();\n};\n\nvar ThrowTypeError = $gOPD ? function () {\n try {\n // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties\n arguments.callee; // IE 8 does not throw here\n\n return throwTypeError;\n } catch (calleeThrows) {\n try {\n // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')\n return $gOPD(arguments, 'callee').get;\n } catch (gOPDthrows) {\n return throwTypeError;\n }\n }\n}() : throwTypeError;\n\nvar hasSymbols = __webpack_require__(/*! has-symbols */ \"./node_modules/has-symbols/index.js\")();\n\nvar getProto = Object.getPrototypeOf || function (x) {\n return x.__proto__;\n}; // eslint-disable-line no-proto\n\n\nvar needsEval = {};\nvar TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);\nvar INTRINSICS = {\n '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,\n '%Array%': Array,\n '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,\n '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,\n '%AsyncFromSyncIteratorPrototype%': undefined,\n '%AsyncFunction%': needsEval,\n '%AsyncGenerator%': needsEval,\n '%AsyncGeneratorFunction%': needsEval,\n '%AsyncIteratorPrototype%': needsEval,\n '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,\n '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,\n '%Boolean%': Boolean,\n '%DataView%': typeof DataView === 'undefined' ? undefined : DataView,\n '%Date%': Date,\n '%decodeURI%': decodeURI,\n '%decodeURIComponent%': decodeURIComponent,\n '%encodeURI%': encodeURI,\n '%encodeURIComponent%': encodeURIComponent,\n '%Error%': Error,\n '%eval%': eval,\n // eslint-disable-line no-eval\n '%EvalError%': EvalError,\n '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,\n '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,\n '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,\n '%Function%': $Function,\n '%GeneratorFunction%': needsEval,\n '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,\n '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,\n '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,\n '%isFinite%': isFinite,\n '%isNaN%': isNaN,\n '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,\n '%JSON%': typeof JSON === 'object' ? JSON : undefined,\n '%Map%': typeof Map === 'undefined' ? undefined : Map,\n '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),\n '%Math%': Math,\n '%Number%': Number,\n '%Object%': Object,\n '%parseFloat%': parseFloat,\n '%parseInt%': parseInt,\n '%Promise%': typeof Promise === 'undefined' ? undefined : Promise,\n '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,\n '%RangeError%': RangeError,\n '%ReferenceError%': ReferenceError,\n '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,\n '%RegExp%': RegExp,\n '%Set%': typeof Set === 'undefined' ? undefined : Set,\n '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),\n '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,\n '%String%': String,\n '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,\n '%Symbol%': hasSymbols ? Symbol : undefined,\n '%SyntaxError%': $SyntaxError,\n '%ThrowTypeError%': ThrowTypeError,\n '%TypedArray%': TypedArray,\n '%TypeError%': $TypeError,\n '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,\n '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,\n '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,\n '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,\n '%URIError%': URIError,\n '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,\n '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,\n '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet\n};\n\nvar doEval = function doEval(name) {\n var value;\n\n if (name === '%AsyncFunction%') {\n value = getEvalledConstructor('async function () {}');\n } else if (name === '%GeneratorFunction%') {\n value = getEvalledConstructor('function* () {}');\n } else if (name === '%AsyncGeneratorFunction%') {\n value = getEvalledConstructor('async function* () {}');\n } else if (name === '%AsyncGenerator%') {\n var fn = doEval('%AsyncGeneratorFunction%');\n\n if (fn) {\n value = fn.prototype;\n }\n } else if (name === '%AsyncIteratorPrototype%') {\n var gen = doEval('%AsyncGenerator%');\n\n if (gen) {\n value = getProto(gen.prototype);\n }\n }\n\n INTRINSICS[name] = value;\n return value;\n};\n\nvar LEGACY_ALIASES = {\n '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],\n '%ArrayPrototype%': ['Array', 'prototype'],\n '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],\n '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],\n '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],\n '%ArrayProto_values%': ['Array', 'prototype', 'values'],\n '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],\n '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],\n '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],\n '%BooleanPrototype%': ['Boolean', 'prototype'],\n '%DataViewPrototype%': ['DataView', 'prototype'],\n '%DatePrototype%': ['Date', 'prototype'],\n '%ErrorPrototype%': ['Error', 'prototype'],\n '%EvalErrorPrototype%': ['EvalError', 'prototype'],\n '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],\n '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],\n '%FunctionPrototype%': ['Function', 'prototype'],\n '%Generator%': ['GeneratorFunction', 'prototype'],\n '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],\n '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],\n '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],\n '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],\n '%JSONParse%': ['JSON', 'parse'],\n '%JSONStringify%': ['JSON', 'stringify'],\n '%MapPrototype%': ['Map', 'prototype'],\n '%NumberPrototype%': ['Number', 'prototype'],\n '%ObjectPrototype%': ['Object', 'prototype'],\n '%ObjProto_toString%': ['Object', 'prototype', 'toString'],\n '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],\n '%PromisePrototype%': ['Promise', 'prototype'],\n '%PromiseProto_then%': ['Promise', 'prototype', 'then'],\n '%Promise_all%': ['Promise', 'all'],\n '%Promise_reject%': ['Promise', 'reject'],\n '%Promise_resolve%': ['Promise', 'resolve'],\n '%RangeErrorPrototype%': ['RangeError', 'prototype'],\n '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],\n '%RegExpPrototype%': ['RegExp', 'prototype'],\n '%SetPrototype%': ['Set', 'prototype'],\n '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],\n '%StringPrototype%': ['String', 'prototype'],\n '%SymbolPrototype%': ['Symbol', 'prototype'],\n '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],\n '%TypedArrayPrototype%': ['TypedArray', 'prototype'],\n '%TypeErrorPrototype%': ['TypeError', 'prototype'],\n '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],\n '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],\n '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],\n '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],\n '%URIErrorPrototype%': ['URIError', 'prototype'],\n '%WeakMapPrototype%': ['WeakMap', 'prototype'],\n '%WeakSetPrototype%': ['WeakSet', 'prototype']\n};\n\nvar bind = __webpack_require__(/*! function-bind */ \"./node_modules/function-bind/index.js\");\n\nvar hasOwn = __webpack_require__(/*! has */ \"./node_modules/has/src/index.js\");\n\nvar $concat = bind.call(Function.call, Array.prototype.concat);\nvar $spliceApply = bind.call(Function.apply, Array.prototype.splice);\nvar $replace = bind.call(Function.call, String.prototype.replace);\nvar $strSlice = bind.call(Function.call, String.prototype.slice);\nvar $exec = bind.call(Function.call, RegExp.prototype.exec);\n/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */\n\nvar rePropName = /[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g;\nvar reEscapeChar = /\\\\(\\\\)?/g;\n/** Used to match backslashes in property paths. */\n\nvar stringToPath = function stringToPath(string) {\n var first = $strSlice(string, 0, 1);\n var last = $strSlice(string, -1);\n\n if (first === '%' && last !== '%') {\n throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');\n } else if (last === '%' && first !== '%') {\n throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');\n }\n\n var result = [];\n $replace(string, rePropName, function (match, number, quote, subString) {\n result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;\n });\n return result;\n};\n/* end adaptation */\n\n\nvar getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {\n var intrinsicName = name;\n var alias;\n\n if (hasOwn(LEGACY_ALIASES, intrinsicName)) {\n alias = LEGACY_ALIASES[intrinsicName];\n intrinsicName = '%' + alias[0] + '%';\n }\n\n if (hasOwn(INTRINSICS, intrinsicName)) {\n var value = INTRINSICS[intrinsicName];\n\n if (value === needsEval) {\n value = doEval(intrinsicName);\n }\n\n if (typeof value === 'undefined' && !allowMissing) {\n throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');\n }\n\n return {\n alias: alias,\n name: intrinsicName,\n value: value\n };\n }\n\n throw new $SyntaxError('intrinsic ' + name + ' does not exist!');\n};\n\nmodule.exports = function GetIntrinsic(name, allowMissing) {\n if (typeof name !== 'string' || name.length === 0) {\n throw new $TypeError('intrinsic name must be a non-empty string');\n }\n\n if (arguments.length > 1 && typeof allowMissing !== 'boolean') {\n throw new $TypeError('\"allowMissing\" argument must be a boolean');\n }\n\n if ($exec(/^%?[^%]*%?$/, name) === null) {\n throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');\n }\n\n var parts = stringToPath(name);\n var intrinsicBaseName = parts.length > 0 ? parts[0] : '';\n var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);\n var intrinsicRealName = intrinsic.name;\n var value = intrinsic.value;\n var skipFurtherCaching = false;\n var alias = intrinsic.alias;\n\n if (alias) {\n intrinsicBaseName = alias[0];\n $spliceApply(parts, $concat([0, 1], alias));\n }\n\n for (var i = 1, isOwn = true; i < parts.length; i += 1) {\n var part = parts[i];\n var first = $strSlice(part, 0, 1);\n var last = $strSlice(part, -1);\n\n if ((first === '\"' || first === \"'\" || first === '`' || last === '\"' || last === \"'\" || last === '`') && first !== last) {\n throw new $SyntaxError('property names with quotes must have matching quotes');\n }\n\n if (part === 'constructor' || !isOwn) {\n skipFurtherCaching = true;\n }\n\n intrinsicBaseName += '.' + part;\n intrinsicRealName = '%' + intrinsicBaseName + '%';\n\n if (hasOwn(INTRINSICS, intrinsicRealName)) {\n value = INTRINSICS[intrinsicRealName];\n } else if (value != null) {\n if (!(part in value)) {\n if (!allowMissing) {\n throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');\n }\n\n return void undefined;\n }\n\n if ($gOPD && i + 1 >= parts.length) {\n var desc = $gOPD(value, part);\n isOwn = !!desc; // By convention, when a data property is converted to an accessor\n // property to emulate a data property that does not suffer from\n // the override mistake, that accessor's getter is marked with\n // an `originalValue` property. Here, when we detect this, we\n // uphold the illusion by pretending to see that original data\n // property, i.e., returning the value rather than the getter\n // itself.\n\n if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {\n value = desc.get;\n } else {\n value = value[part];\n }\n } else {\n isOwn = hasOwn(value, part);\n value = value[part];\n }\n\n if (isOwn && !skipFurtherCaching) {\n INTRINSICS[intrinsicRealName] = value;\n }\n }\n }\n\n return value;\n};\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/get-intrinsic/index.js?");
|
|
6316
6361
|
|
|
6317
6362
|
/***/ }),
|
|
6318
6363
|
|
|
@@ -8869,7 +8914,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
8869
8914
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
8870
8915
|
|
|
8871
8916
|
"use strict";
|
|
8872
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shimOnTrack\", function() { return shimOnTrack; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shimPeerConnection\", function() { return shimPeerConnection; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shimSenderGetStats\", function() { return shimSenderGetStats; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shimReceiverGetStats\", function() { return shimReceiverGetStats; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shimRemoveStream\", function() { return shimRemoveStream; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shimRTCDataChannel\", function() { return shimRTCDataChannel; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shimAddTransceiver\", function() { return shimAddTransceiver; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shimGetParameters\", function() { return shimGetParameters; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shimCreateOffer\", function() { return shimCreateOffer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shimCreateAnswer\", function() { return shimCreateAnswer; });\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils */ \"./node_modules/webrtc-adapter/src/js/utils.js\");\n/* harmony import */ var _getusermedia__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./getusermedia */ \"./node_modules/webrtc-adapter/src/js/firefox/getusermedia.js\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"shimGetUserMedia\", function() { return _getusermedia__WEBPACK_IMPORTED_MODULE_1__[\"shimGetUserMedia\"]; });\n\n/* harmony import */ var _getdisplaymedia__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./getdisplaymedia */ \"./node_modules/webrtc-adapter/src/js/firefox/getdisplaymedia.js\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"shimGetDisplayMedia\", function() { return _getdisplaymedia__WEBPACK_IMPORTED_MODULE_2__[\"shimGetDisplayMedia\"]; });\n\n/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n\n/* eslint-env node */\n\n\n\n\n\nfunction shimOnTrack(window) {\n if (typeof window === 'object' && window.RTCTrackEvent && 'receiver' in window.RTCTrackEvent.prototype && !('transceiver' in window.RTCTrackEvent.prototype)) {\n Object.defineProperty(window.RTCTrackEvent.prototype, 'transceiver', {\n get() {\n return {\n receiver: this.receiver\n };\n }\n\n });\n }\n}\nfunction shimPeerConnection(window, browserDetails) {\n if (typeof window !== 'object' || !(window.RTCPeerConnection || window.mozRTCPeerConnection)) {\n return; // probably media.peerconnection.enabled=false in about:config\n }\n\n if (!window.RTCPeerConnection && window.mozRTCPeerConnection) {\n // very basic support for old versions.\n window.RTCPeerConnection = window.mozRTCPeerConnection;\n }\n\n if (browserDetails.version < 53) {\n // shim away need for obsolete RTCIceCandidate/RTCSessionDescription.\n ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate'].forEach(function (method) {\n const nativeMethod = window.RTCPeerConnection.prototype[method];\n const methodObj = {\n [method]() {\n arguments[0] = new (method === 'addIceCandidate' ? window.RTCIceCandidate : window.RTCSessionDescription)(arguments[0]);\n return nativeMethod.apply(this, arguments);\n }\n\n };\n window.RTCPeerConnection.prototype[method] = methodObj[method];\n });\n }\n\n const modernStatsTypes = {\n inboundrtp: 'inbound-rtp',\n outboundrtp: 'outbound-rtp',\n candidatepair: 'candidate-pair',\n localcandidate: 'local-candidate',\n remotecandidate: 'remote-candidate'\n };\n const nativeGetStats = window.RTCPeerConnection.prototype.getStats;\n\n window.RTCPeerConnection.prototype.getStats = function getStats() {\n const [selector, onSucc, onErr] = arguments;\n return nativeGetStats.apply(this, [selector || null]).then(stats => {\n if (browserDetails.version < 53 && !onSucc) {\n // Shim only promise getStats with spec-hyphens in type names\n // Leave callback version alone; misc old uses of forEach before Map\n try {\n stats.forEach(stat => {\n stat.type = modernStatsTypes[stat.type] || stat.type;\n });\n } catch (e) {\n if (e.name !== 'TypeError') {\n throw e;\n } // Avoid TypeError: \"type\" is read-only, in old versions. 34-43ish\n\n\n stats.forEach((stat, i) => {\n stats.set(i, Object.assign({}, stat, {\n type: modernStatsTypes[stat.type] || stat.type\n }));\n });\n }\n }\n\n return stats;\n }).then(onSucc, onErr);\n };\n}\nfunction shimSenderGetStats(window) {\n if (!(typeof window === 'object' && window.RTCPeerConnection && window.RTCRtpSender)) {\n return;\n }\n\n if (window.RTCRtpSender && 'getStats' in window.RTCRtpSender.prototype) {\n return;\n }\n\n const origGetSenders = window.RTCPeerConnection.prototype.getSenders;\n\n if (origGetSenders) {\n window.RTCPeerConnection.prototype.getSenders = function getSenders() {\n const senders = origGetSenders.apply(this, []);\n senders.forEach(sender => sender._pc = this);\n return senders;\n };\n }\n\n const origAddTrack = window.RTCPeerConnection.prototype.addTrack;\n\n if (origAddTrack) {\n window.RTCPeerConnection.prototype.addTrack = function addTrack() {\n const sender = origAddTrack.apply(this, arguments);\n sender._pc = this;\n return sender;\n };\n }\n\n window.RTCRtpSender.prototype.getStats = function getStats() {\n return this.track ? this._pc.getStats(this.track) : Promise.resolve(new Map());\n };\n}\nfunction shimReceiverGetStats(window) {\n if (!(typeof window === 'object' && window.RTCPeerConnection && window.RTCRtpSender)) {\n return;\n }\n\n if (window.RTCRtpSender && 'getStats' in window.RTCRtpReceiver.prototype) {\n return;\n }\n\n const origGetReceivers = window.RTCPeerConnection.prototype.getReceivers;\n\n if (origGetReceivers) {\n window.RTCPeerConnection.prototype.getReceivers = function getReceivers() {\n const receivers = origGetReceivers.apply(this, []);\n receivers.forEach(receiver => receiver._pc = this);\n return receivers;\n };\n }\n\n _utils__WEBPACK_IMPORTED_MODULE_0__[\"wrapPeerConnectionEvent\"](window, 'track', e => {\n e.receiver._pc = e.srcElement;\n return e;\n });\n\n window.RTCRtpReceiver.prototype.getStats = function getStats() {\n return this._pc.getStats(this.track);\n };\n}\nfunction shimRemoveStream(window) {\n if (!window.RTCPeerConnection || 'removeStream' in window.RTCPeerConnection.prototype) {\n return;\n }\n\n window.RTCPeerConnection.prototype.removeStream = function removeStream(stream) {\n _utils__WEBPACK_IMPORTED_MODULE_0__[\"deprecated\"]('removeStream', 'removeTrack');\n this.getSenders().forEach(sender => {\n if (sender.track && stream.getTracks().includes(sender.track)) {\n this.removeTrack(sender);\n }\n });\n };\n}\nfunction shimRTCDataChannel(window) {\n // rename DataChannel to RTCDataChannel (native fix in FF60):\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1173851\n if (window.DataChannel && !window.RTCDataChannel) {\n window.RTCDataChannel = window.DataChannel;\n }\n}\nfunction shimAddTransceiver(window) {\n // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647\n // Firefox ignores the init sendEncodings options passed to addTransceiver\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918\n if (!(typeof window === 'object' && window.RTCPeerConnection)) {\n return;\n }\n\n const origAddTransceiver = window.RTCPeerConnection.prototype.addTransceiver;\n\n if (origAddTransceiver) {\n window.RTCPeerConnection.prototype.addTransceiver = function addTransceiver() {\n this.setParametersPromises = [];\n const initParameters = arguments[1];\n const shouldPerformCheck = initParameters && 'sendEncodings' in initParameters;\n\n if (shouldPerformCheck) {\n // If sendEncodings params are provided, validate grammar\n initParameters.sendEncodings.forEach(encodingParam => {\n if ('rid' in encodingParam) {\n const ridRegex = /^[a-z0-9]{0,16}$/i;\n\n if (!ridRegex.test(encodingParam.rid)) {\n throw new TypeError('Invalid RID value provided.');\n }\n }\n\n if ('scaleResolutionDownBy' in encodingParam) {\n if (!(parseFloat(encodingParam.scaleResolutionDownBy) >= 1.0)) {\n throw new RangeError('scale_resolution_down_by must be >= 1.0');\n }\n }\n\n if ('maxFramerate' in encodingParam) {\n if (!(parseFloat(encodingParam.maxFramerate) >= 0)) {\n throw new RangeError('max_framerate must be >= 0.0');\n }\n }\n });\n }\n\n const transceiver = origAddTransceiver.apply(this, arguments);\n\n if (shouldPerformCheck) {\n // Check if the init options were applied. If not we do this in an\n // asynchronous way and save the promise reference in a global object.\n // This is an ugly hack, but at the same time is way more robust than\n // checking the sender parameters before and after the createOffer\n // Also note that after the createoffer we are not 100% sure that\n // the params were asynchronously applied so we might miss the\n // opportunity to recreate offer.\n const {\n sender\n } = transceiver;\n const params = sender.getParameters();\n\n if (!('encodings' in params) || // Avoid being fooled by patched getParameters() below.\n params.encodings.length === 1 && Object.keys(params.encodings[0]).length === 0) {\n params.encodings = initParameters.sendEncodings;\n sender.sendEncodings = initParameters.sendEncodings;\n this.setParametersPromises.push(sender.setParameters(params).then(() => {\n delete sender.sendEncodings;\n }).catch(() => {\n delete sender.sendEncodings;\n }));\n }\n }\n\n return transceiver;\n };\n }\n}\nfunction shimGetParameters(window) {\n if (!(typeof window === 'object' && window.RTCRtpSender)) {\n return;\n }\n\n const origGetParameters = window.RTCRtpSender.prototype.getParameters;\n\n if (origGetParameters) {\n window.RTCRtpSender.prototype.getParameters = function getParameters() {\n const params = origGetParameters.apply(this, arguments);\n\n if (!('encodings' in params)) {\n params.encodings = [].concat(this.sendEncodings || [{}]);\n }\n\n return params;\n };\n }\n}\nfunction shimCreateOffer(window) {\n // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647\n // Firefox ignores the init sendEncodings options passed to addTransceiver\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918\n if (!(typeof window === 'object' && window.RTCPeerConnection)) {\n return;\n }\n\n const origCreateOffer = window.RTCPeerConnection.prototype.createOffer;\n\n window.RTCPeerConnection.prototype.createOffer = function createOffer() {\n if (this.setParametersPromises && this.setParametersPromises.length) {\n return Promise.all(this.setParametersPromises).then(() => {\n return origCreateOffer.apply(this, arguments);\n }).finally(() => {\n this.setParametersPromises = [];\n });\n }\n\n return origCreateOffer.apply(this, arguments);\n };\n}\nfunction shimCreateAnswer(window) {\n // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647\n // Firefox ignores the init sendEncodings options passed to addTransceiver\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918\n if (!(typeof window === 'object' && window.RTCPeerConnection)) {\n return;\n }\n\n const origCreateAnswer = window.RTCPeerConnection.prototype.createAnswer;\n\n window.RTCPeerConnection.prototype.createAnswer = function createAnswer() {\n if (this.setParametersPromises && this.setParametersPromises.length) {\n return Promise.all(this.setParametersPromises).then(() => {\n return origCreateAnswer.apply(this, arguments);\n }).finally(() => {\n this.setParametersPromises = [];\n });\n }\n\n return origCreateAnswer.apply(this, arguments);\n };\n}\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/webrtc-adapter/src/js/firefox/firefox_shim.js?");
|
|
8917
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shimOnTrack\", function() { return shimOnTrack; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shimPeerConnection\", function() { return shimPeerConnection; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shimSenderGetStats\", function() { return shimSenderGetStats; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shimReceiverGetStats\", function() { return shimReceiverGetStats; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shimRemoveStream\", function() { return shimRemoveStream; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shimRTCDataChannel\", function() { return shimRTCDataChannel; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shimAddTransceiver\", function() { return shimAddTransceiver; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shimGetParameters\", function() { return shimGetParameters; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shimCreateOffer\", function() { return shimCreateOffer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shimCreateAnswer\", function() { return shimCreateAnswer; });\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils */ \"./node_modules/webrtc-adapter/src/js/utils.js\");\n/* harmony import */ var _getusermedia__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./getusermedia */ \"./node_modules/webrtc-adapter/src/js/firefox/getusermedia.js\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"shimGetUserMedia\", function() { return _getusermedia__WEBPACK_IMPORTED_MODULE_1__[\"shimGetUserMedia\"]; });\n\n/* harmony import */ var _getdisplaymedia__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./getdisplaymedia */ \"./node_modules/webrtc-adapter/src/js/firefox/getdisplaymedia.js\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"shimGetDisplayMedia\", function() { return _getdisplaymedia__WEBPACK_IMPORTED_MODULE_2__[\"shimGetDisplayMedia\"]; });\n\n/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n\n/* eslint-env node */\n\n\n\n\n\nfunction shimOnTrack(window) {\n if (typeof window === 'object' && window.RTCTrackEvent && 'receiver' in window.RTCTrackEvent.prototype && !('transceiver' in window.RTCTrackEvent.prototype)) {\n Object.defineProperty(window.RTCTrackEvent.prototype, 'transceiver', {\n get() {\n return {\n receiver: this.receiver\n };\n }\n\n });\n }\n}\nfunction shimPeerConnection(window, browserDetails) {\n if (typeof window !== 'object' || !(window.RTCPeerConnection || window.mozRTCPeerConnection)) {\n return; // probably media.peerconnection.enabled=false in about:config\n }\n\n if (!window.RTCPeerConnection && window.mozRTCPeerConnection) {\n // very basic support for old versions.\n window.RTCPeerConnection = window.mozRTCPeerConnection;\n }\n\n if (browserDetails.version < 53) {\n // shim away need for obsolete RTCIceCandidate/RTCSessionDescription.\n ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate'].forEach(function (method) {\n const nativeMethod = window.RTCPeerConnection.prototype[method];\n const methodObj = {\n [method]() {\n arguments[0] = new (method === 'addIceCandidate' ? window.RTCIceCandidate : window.RTCSessionDescription)(arguments[0]);\n return nativeMethod.apply(this, arguments);\n }\n\n };\n window.RTCPeerConnection.prototype[method] = methodObj[method];\n });\n }\n\n const modernStatsTypes = {\n inboundrtp: 'inbound-rtp',\n outboundrtp: 'outbound-rtp',\n candidatepair: 'candidate-pair',\n localcandidate: 'local-candidate',\n remotecandidate: 'remote-candidate'\n };\n const nativeGetStats = window.RTCPeerConnection.prototype.getStats;\n\n window.RTCPeerConnection.prototype.getStats = function getStats() {\n const [selector, onSucc, onErr] = arguments;\n return nativeGetStats.apply(this, [selector || null]).then(stats => {\n if (browserDetails.version < 53 && !onSucc) {\n // Shim only promise getStats with spec-hyphens in type names\n // Leave callback version alone; misc old uses of forEach before Map\n try {\n stats.forEach(stat => {\n stat.type = modernStatsTypes[stat.type] || stat.type;\n });\n } catch (e) {\n if (e.name !== 'TypeError') {\n throw e;\n } // Avoid TypeError: \"type\" is read-only, in old versions. 34-43ish\n\n\n stats.forEach((stat, i) => {\n stats.set(i, Object.assign({}, stat, {\n type: modernStatsTypes[stat.type] || stat.type\n }));\n });\n }\n }\n\n return stats;\n }).then(onSucc, onErr);\n };\n}\nfunction shimSenderGetStats(window) {\n if (!(typeof window === 'object' && window.RTCPeerConnection && window.RTCRtpSender)) {\n return;\n }\n\n if (window.RTCRtpSender && 'getStats' in window.RTCRtpSender.prototype) {\n return;\n }\n\n const origGetSenders = window.RTCPeerConnection.prototype.getSenders;\n\n if (origGetSenders) {\n window.RTCPeerConnection.prototype.getSenders = function getSenders() {\n const senders = origGetSenders.apply(this, []);\n senders.forEach(sender => sender._pc = this);\n return senders;\n };\n }\n\n const origAddTrack = window.RTCPeerConnection.prototype.addTrack;\n\n if (origAddTrack) {\n window.RTCPeerConnection.prototype.addTrack = function addTrack() {\n const sender = origAddTrack.apply(this, arguments);\n sender._pc = this;\n return sender;\n };\n }\n\n window.RTCRtpSender.prototype.getStats = function getStats() {\n return this.track ? this._pc.getStats(this.track) : Promise.resolve(new Map());\n };\n}\nfunction shimReceiverGetStats(window) {\n if (!(typeof window === 'object' && window.RTCPeerConnection && window.RTCRtpSender)) {\n return;\n }\n\n if (window.RTCRtpSender && 'getStats' in window.RTCRtpReceiver.prototype) {\n return;\n }\n\n const origGetReceivers = window.RTCPeerConnection.prototype.getReceivers;\n\n if (origGetReceivers) {\n window.RTCPeerConnection.prototype.getReceivers = function getReceivers() {\n const receivers = origGetReceivers.apply(this, []);\n receivers.forEach(receiver => receiver._pc = this);\n return receivers;\n };\n }\n\n _utils__WEBPACK_IMPORTED_MODULE_0__[\"wrapPeerConnectionEvent\"](window, 'track', e => {\n e.receiver._pc = e.srcElement;\n return e;\n });\n\n window.RTCRtpReceiver.prototype.getStats = function getStats() {\n return this._pc.getStats(this.track);\n };\n}\nfunction shimRemoveStream(window) {\n if (!window.RTCPeerConnection || 'removeStream' in window.RTCPeerConnection.prototype) {\n return;\n }\n\n window.RTCPeerConnection.prototype.removeStream = function removeStream(stream) {\n _utils__WEBPACK_IMPORTED_MODULE_0__[\"deprecated\"]('removeStream', 'removeTrack');\n this.getSenders().forEach(sender => {\n if (sender.track && stream.getTracks().includes(sender.track)) {\n this.removeTrack(sender);\n }\n });\n };\n}\nfunction shimRTCDataChannel(window) {\n // rename DataChannel to RTCDataChannel (native fix in FF60):\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1173851\n if (window.DataChannel && !window.RTCDataChannel) {\n window.RTCDataChannel = window.DataChannel;\n }\n}\nfunction shimAddTransceiver(window) {\n // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647\n // Firefox ignores the init sendEncodings options passed to addTransceiver\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918\n if (!(typeof window === 'object' && window.RTCPeerConnection)) {\n return;\n }\n\n const origAddTransceiver = window.RTCPeerConnection.prototype.addTransceiver;\n\n if (origAddTransceiver) {\n window.RTCPeerConnection.prototype.addTransceiver = function addTransceiver() {\n this.setParametersPromises = []; // WebIDL input coercion and validation\n\n let sendEncodings = arguments[1] && arguments[1].sendEncodings;\n\n if (sendEncodings === undefined) {\n sendEncodings = [];\n }\n\n sendEncodings = [...sendEncodings];\n const shouldPerformCheck = sendEncodings.length > 0;\n\n if (shouldPerformCheck) {\n // If sendEncodings params are provided, validate grammar\n sendEncodings.forEach(encodingParam => {\n if ('rid' in encodingParam) {\n const ridRegex = /^[a-z0-9]{0,16}$/i;\n\n if (!ridRegex.test(encodingParam.rid)) {\n throw new TypeError('Invalid RID value provided.');\n }\n }\n\n if ('scaleResolutionDownBy' in encodingParam) {\n if (!(parseFloat(encodingParam.scaleResolutionDownBy) >= 1.0)) {\n throw new RangeError('scale_resolution_down_by must be >= 1.0');\n }\n }\n\n if ('maxFramerate' in encodingParam) {\n if (!(parseFloat(encodingParam.maxFramerate) >= 0)) {\n throw new RangeError('max_framerate must be >= 0.0');\n }\n }\n });\n }\n\n const transceiver = origAddTransceiver.apply(this, arguments);\n\n if (shouldPerformCheck) {\n // Check if the init options were applied. If not we do this in an\n // asynchronous way and save the promise reference in a global object.\n // This is an ugly hack, but at the same time is way more robust than\n // checking the sender parameters before and after the createOffer\n // Also note that after the createoffer we are not 100% sure that\n // the params were asynchronously applied so we might miss the\n // opportunity to recreate offer.\n const {\n sender\n } = transceiver;\n const params = sender.getParameters();\n\n if (!('encodings' in params) || // Avoid being fooled by patched getParameters() below.\n params.encodings.length === 1 && Object.keys(params.encodings[0]).length === 0) {\n params.encodings = sendEncodings;\n sender.sendEncodings = sendEncodings;\n this.setParametersPromises.push(sender.setParameters(params).then(() => {\n delete sender.sendEncodings;\n }).catch(() => {\n delete sender.sendEncodings;\n }));\n }\n }\n\n return transceiver;\n };\n }\n}\nfunction shimGetParameters(window) {\n if (!(typeof window === 'object' && window.RTCRtpSender)) {\n return;\n }\n\n const origGetParameters = window.RTCRtpSender.prototype.getParameters;\n\n if (origGetParameters) {\n window.RTCRtpSender.prototype.getParameters = function getParameters() {\n const params = origGetParameters.apply(this, arguments);\n\n if (!('encodings' in params)) {\n params.encodings = [].concat(this.sendEncodings || [{}]);\n }\n\n return params;\n };\n }\n}\nfunction shimCreateOffer(window) {\n // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647\n // Firefox ignores the init sendEncodings options passed to addTransceiver\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918\n if (!(typeof window === 'object' && window.RTCPeerConnection)) {\n return;\n }\n\n const origCreateOffer = window.RTCPeerConnection.prototype.createOffer;\n\n window.RTCPeerConnection.prototype.createOffer = function createOffer() {\n if (this.setParametersPromises && this.setParametersPromises.length) {\n return Promise.all(this.setParametersPromises).then(() => {\n return origCreateOffer.apply(this, arguments);\n }).finally(() => {\n this.setParametersPromises = [];\n });\n }\n\n return origCreateOffer.apply(this, arguments);\n };\n}\nfunction shimCreateAnswer(window) {\n // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647\n // Firefox ignores the init sendEncodings options passed to addTransceiver\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918\n if (!(typeof window === 'object' && window.RTCPeerConnection)) {\n return;\n }\n\n const origCreateAnswer = window.RTCPeerConnection.prototype.createAnswer;\n\n window.RTCPeerConnection.prototype.createAnswer = function createAnswer() {\n if (this.setParametersPromises && this.setParametersPromises.length) {\n return Promise.all(this.setParametersPromises).then(() => {\n return origCreateAnswer.apply(this, arguments);\n }).finally(() => {\n this.setParametersPromises = [];\n });\n }\n\n return origCreateAnswer.apply(this, arguments);\n };\n}\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/webrtc-adapter/src/js/firefox/firefox_shim.js?");
|
|
8873
8918
|
|
|
8874
8919
|
/***/ }),
|
|
8875
8920
|
|
|
@@ -8917,7 +8962,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
8917
8962
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
8918
8963
|
|
|
8919
8964
|
"use strict";
|
|
8920
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"extractVersion\", function() { return extractVersion; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"wrapPeerConnectionEvent\", function() { return wrapPeerConnectionEvent; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"disableLog\", function() { return disableLog; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"disableWarnings\", function() { return disableWarnings; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"log\", function() { return log; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"deprecated\", function() { return deprecated; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"detectBrowser\", function() { return detectBrowser; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"compactObject\", function() { return compactObject; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"walkStats\", function() { return walkStats; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"filterStats\", function() { return filterStats; });\n/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n\n/* eslint-env node */\n\n\nlet logDisabled_ = true;\nlet deprecationWarnings_ = true;\n/**\n * Extract browser version out of the provided user agent string.\n *\n * @param {!string} uastring userAgent string.\n * @param {!string} expr Regular expression used as match criteria.\n * @param {!number} pos position in the version string to be returned.\n * @return {!number} browser version.\n */\n\nfunction extractVersion(uastring, expr, pos) {\n const match = uastring.match(expr);\n return match && match.length >= pos && parseInt(match[pos], 10);\n} // Wraps the peerconnection event eventNameToWrap in a function\n// which returns the modified event object (or false to prevent\n// the event).\n\nfunction wrapPeerConnectionEvent(window, eventNameToWrap, wrapper) {\n if (!window.RTCPeerConnection) {\n return;\n }\n\n const proto = window.RTCPeerConnection.prototype;\n const nativeAddEventListener = proto.addEventListener;\n\n proto.addEventListener = function (nativeEventName, cb) {\n if (nativeEventName !== eventNameToWrap) {\n return nativeAddEventListener.apply(this, arguments);\n }\n\n const wrappedCallback = e => {\n const modifiedEvent = wrapper(e);\n\n if (modifiedEvent) {\n if (cb.handleEvent) {\n cb.handleEvent(modifiedEvent);\n } else {\n cb(modifiedEvent);\n }\n }\n };\n\n this._eventMap = this._eventMap || {};\n\n if (!this._eventMap[eventNameToWrap]) {\n this._eventMap[eventNameToWrap] = new Map();\n }\n\n this._eventMap[eventNameToWrap].set(cb, wrappedCallback);\n\n return nativeAddEventListener.apply(this, [nativeEventName, wrappedCallback]);\n };\n\n const nativeRemoveEventListener = proto.removeEventListener;\n\n proto.removeEventListener = function (nativeEventName, cb) {\n if (nativeEventName !== eventNameToWrap || !this._eventMap || !this._eventMap[eventNameToWrap]) {\n return nativeRemoveEventListener.apply(this, arguments);\n }\n\n if (!this._eventMap[eventNameToWrap].has(cb)) {\n return nativeRemoveEventListener.apply(this, arguments);\n }\n\n const unwrappedCb = this._eventMap[eventNameToWrap].get(cb);\n\n this._eventMap[eventNameToWrap].delete(cb);\n\n if (this._eventMap[eventNameToWrap].size === 0) {\n delete this._eventMap[eventNameToWrap];\n }\n\n if (Object.keys(this._eventMap).length === 0) {\n delete this._eventMap;\n }\n\n return nativeRemoveEventListener.apply(this, [nativeEventName, unwrappedCb]);\n };\n\n Object.defineProperty(proto, 'on' + eventNameToWrap, {\n get() {\n return this['_on' + eventNameToWrap];\n },\n\n set(cb) {\n if (this['_on' + eventNameToWrap]) {\n this.removeEventListener(eventNameToWrap, this['_on' + eventNameToWrap]);\n delete this['_on' + eventNameToWrap];\n }\n\n if (cb) {\n this.addEventListener(eventNameToWrap, this['_on' + eventNameToWrap] = cb);\n }\n },\n\n enumerable: true,\n configurable: true\n });\n}\nfunction disableLog(bool) {\n if (typeof bool !== 'boolean') {\n return new Error('Argument type: ' + typeof bool + '. Please use a boolean.');\n }\n\n logDisabled_ = bool;\n return bool ? 'adapter.js logging disabled' : 'adapter.js logging enabled';\n}\n/**\n * Disable or enable deprecation warnings\n * @param {!boolean} bool set to true to disable warnings.\n */\n\nfunction disableWarnings(bool) {\n if (typeof bool !== 'boolean') {\n return new Error('Argument type: ' + typeof bool + '. Please use a boolean.');\n }\n\n deprecationWarnings_ = !bool;\n return 'adapter.js deprecation warnings ' + (bool ? 'disabled' : 'enabled');\n}\nfunction log() {\n if (typeof window === 'object') {\n if (logDisabled_) {\n return;\n }\n\n if (typeof console !== 'undefined' && typeof console.log === 'function') {\n console.log.apply(console, arguments);\n }\n }\n}\n/**\n * Shows a deprecation warning suggesting the modern and spec-compatible API.\n */\n\nfunction deprecated(oldMethod, newMethod) {\n if (!deprecationWarnings_) {\n return;\n }\n\n console.warn(oldMethod + ' is deprecated, please use ' + newMethod + ' instead.');\n}\n/**\n * Browser detector.\n *\n * @return {object} result containing browser and version\n * properties.\n */\n\nfunction detectBrowser(window) {\n // Returned result object.\n const result = {\n browser: null,\n version: null\n }; // Fail early if it's not a browser\n\n if (typeof window === 'undefined' || !window.navigator) {\n result.browser = 'Not a browser.';\n return result;\n }\n\n const {\n navigator\n } = window;\n\n if (navigator.mozGetUserMedia) {\n // Firefox.\n result.browser = 'firefox';\n result.version = extractVersion(navigator.userAgent, /Firefox\\/(\\d+)\\./, 1);\n } else if (navigator.webkitGetUserMedia || window.isSecureContext === false && window.webkitRTCPeerConnection
|
|
8965
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"extractVersion\", function() { return extractVersion; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"wrapPeerConnectionEvent\", function() { return wrapPeerConnectionEvent; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"disableLog\", function() { return disableLog; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"disableWarnings\", function() { return disableWarnings; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"log\", function() { return log; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"deprecated\", function() { return deprecated; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"detectBrowser\", function() { return detectBrowser; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"compactObject\", function() { return compactObject; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"walkStats\", function() { return walkStats; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"filterStats\", function() { return filterStats; });\n/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n\n/* eslint-env node */\n\n\nlet logDisabled_ = true;\nlet deprecationWarnings_ = true;\n/**\n * Extract browser version out of the provided user agent string.\n *\n * @param {!string} uastring userAgent string.\n * @param {!string} expr Regular expression used as match criteria.\n * @param {!number} pos position in the version string to be returned.\n * @return {!number} browser version.\n */\n\nfunction extractVersion(uastring, expr, pos) {\n const match = uastring.match(expr);\n return match && match.length >= pos && parseInt(match[pos], 10);\n} // Wraps the peerconnection event eventNameToWrap in a function\n// which returns the modified event object (or false to prevent\n// the event).\n\nfunction wrapPeerConnectionEvent(window, eventNameToWrap, wrapper) {\n if (!window.RTCPeerConnection) {\n return;\n }\n\n const proto = window.RTCPeerConnection.prototype;\n const nativeAddEventListener = proto.addEventListener;\n\n proto.addEventListener = function (nativeEventName, cb) {\n if (nativeEventName !== eventNameToWrap) {\n return nativeAddEventListener.apply(this, arguments);\n }\n\n const wrappedCallback = e => {\n const modifiedEvent = wrapper(e);\n\n if (modifiedEvent) {\n if (cb.handleEvent) {\n cb.handleEvent(modifiedEvent);\n } else {\n cb(modifiedEvent);\n }\n }\n };\n\n this._eventMap = this._eventMap || {};\n\n if (!this._eventMap[eventNameToWrap]) {\n this._eventMap[eventNameToWrap] = new Map();\n }\n\n this._eventMap[eventNameToWrap].set(cb, wrappedCallback);\n\n return nativeAddEventListener.apply(this, [nativeEventName, wrappedCallback]);\n };\n\n const nativeRemoveEventListener = proto.removeEventListener;\n\n proto.removeEventListener = function (nativeEventName, cb) {\n if (nativeEventName !== eventNameToWrap || !this._eventMap || !this._eventMap[eventNameToWrap]) {\n return nativeRemoveEventListener.apply(this, arguments);\n }\n\n if (!this._eventMap[eventNameToWrap].has(cb)) {\n return nativeRemoveEventListener.apply(this, arguments);\n }\n\n const unwrappedCb = this._eventMap[eventNameToWrap].get(cb);\n\n this._eventMap[eventNameToWrap].delete(cb);\n\n if (this._eventMap[eventNameToWrap].size === 0) {\n delete this._eventMap[eventNameToWrap];\n }\n\n if (Object.keys(this._eventMap).length === 0) {\n delete this._eventMap;\n }\n\n return nativeRemoveEventListener.apply(this, [nativeEventName, unwrappedCb]);\n };\n\n Object.defineProperty(proto, 'on' + eventNameToWrap, {\n get() {\n return this['_on' + eventNameToWrap];\n },\n\n set(cb) {\n if (this['_on' + eventNameToWrap]) {\n this.removeEventListener(eventNameToWrap, this['_on' + eventNameToWrap]);\n delete this['_on' + eventNameToWrap];\n }\n\n if (cb) {\n this.addEventListener(eventNameToWrap, this['_on' + eventNameToWrap] = cb);\n }\n },\n\n enumerable: true,\n configurable: true\n });\n}\nfunction disableLog(bool) {\n if (typeof bool !== 'boolean') {\n return new Error('Argument type: ' + typeof bool + '. Please use a boolean.');\n }\n\n logDisabled_ = bool;\n return bool ? 'adapter.js logging disabled' : 'adapter.js logging enabled';\n}\n/**\n * Disable or enable deprecation warnings\n * @param {!boolean} bool set to true to disable warnings.\n */\n\nfunction disableWarnings(bool) {\n if (typeof bool !== 'boolean') {\n return new Error('Argument type: ' + typeof bool + '. Please use a boolean.');\n }\n\n deprecationWarnings_ = !bool;\n return 'adapter.js deprecation warnings ' + (bool ? 'disabled' : 'enabled');\n}\nfunction log() {\n if (typeof window === 'object') {\n if (logDisabled_) {\n return;\n }\n\n if (typeof console !== 'undefined' && typeof console.log === 'function') {\n console.log.apply(console, arguments);\n }\n }\n}\n/**\n * Shows a deprecation warning suggesting the modern and spec-compatible API.\n */\n\nfunction deprecated(oldMethod, newMethod) {\n if (!deprecationWarnings_) {\n return;\n }\n\n console.warn(oldMethod + ' is deprecated, please use ' + newMethod + ' instead.');\n}\n/**\n * Browser detector.\n *\n * @return {object} result containing browser and version\n * properties.\n */\n\nfunction detectBrowser(window) {\n // Returned result object.\n const result = {\n browser: null,\n version: null\n }; // Fail early if it's not a browser\n\n if (typeof window === 'undefined' || !window.navigator) {\n result.browser = 'Not a browser.';\n return result;\n }\n\n const {\n navigator\n } = window;\n\n if (navigator.mozGetUserMedia) {\n // Firefox.\n result.browser = 'firefox';\n result.version = extractVersion(navigator.userAgent, /Firefox\\/(\\d+)\\./, 1);\n } else if (navigator.webkitGetUserMedia || window.isSecureContext === false && window.webkitRTCPeerConnection) {\n // Chrome, Chromium, Webview, Opera.\n // Version matches Chrome/WebRTC version.\n // Chrome 74 removed webkitGetUserMedia on http as well so we need the\n // more complicated fallback to webkitRTCPeerConnection.\n result.browser = 'chrome';\n result.version = extractVersion(navigator.userAgent, /Chrom(e|ium)\\/(\\d+)\\./, 2);\n } else if (window.RTCPeerConnection && navigator.userAgent.match(/AppleWebKit\\/(\\d+)\\./)) {\n // Safari.\n result.browser = 'safari';\n result.version = extractVersion(navigator.userAgent, /AppleWebKit\\/(\\d+)\\./, 1);\n result.supportsUnifiedPlan = window.RTCRtpTransceiver && 'currentDirection' in window.RTCRtpTransceiver.prototype;\n } else {\n // Default fallthrough: not supported.\n result.browser = 'Not a supported browser.';\n return result;\n }\n\n return result;\n}\n/**\n * Checks if something is an object.\n *\n * @param {*} val The something you want to check.\n * @return true if val is an object, false otherwise.\n */\n\nfunction isObject(val) {\n return Object.prototype.toString.call(val) === '[object Object]';\n}\n/**\n * Remove all empty objects and undefined values\n * from a nested object -- an enhanced and vanilla version\n * of Lodash's `compact`.\n */\n\n\nfunction compactObject(data) {\n if (!isObject(data)) {\n return data;\n }\n\n return Object.keys(data).reduce(function (accumulator, key) {\n const isObj = isObject(data[key]);\n const value = isObj ? compactObject(data[key]) : data[key];\n const isEmptyObject = isObj && !Object.keys(value).length;\n\n if (value === undefined || isEmptyObject) {\n return accumulator;\n }\n\n return Object.assign(accumulator, {\n [key]: value\n });\n }, {});\n}\n/* iterates the stats graph recursively. */\n\nfunction walkStats(stats, base, resultSet) {\n if (!base || resultSet.has(base.id)) {\n return;\n }\n\n resultSet.set(base.id, base);\n Object.keys(base).forEach(name => {\n if (name.endsWith('Id')) {\n walkStats(stats, stats.get(base[name]), resultSet);\n } else if (name.endsWith('Ids')) {\n base[name].forEach(id => {\n walkStats(stats, stats.get(id), resultSet);\n });\n }\n });\n}\n/* filter getStats for a sender/receiver track. */\n\nfunction filterStats(result, track, outbound) {\n const streamStatsType = outbound ? 'outbound-rtp' : 'inbound-rtp';\n const filteredResult = new Map();\n\n if (track === null) {\n return filteredResult;\n }\n\n const trackStats = [];\n result.forEach(value => {\n if (value.type === 'track' && value.trackIdentifier === track.id) {\n trackStats.push(value);\n }\n });\n trackStats.forEach(trackStat => {\n result.forEach(stats => {\n if (stats.type === streamStatsType && stats.trackId === trackStat.id) {\n walkStats(result, stats, filteredResult);\n }\n });\n });\n return filteredResult;\n}\n\n//# sourceURL=webpack://WatchTogetherSDK/./node_modules/webrtc-adapter/src/js/utils.js?");
|
|
8921
8966
|
|
|
8922
8967
|
/***/ }),
|
|
8923
8968
|
|
|
@@ -9115,7 +9160,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _mod
|
|
|
9115
9160
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9116
9161
|
|
|
9117
9162
|
"use strict";
|
|
9118
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _modules_wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../modules/wt-utils */ \"./src/modules/wt-utils.js\");\n\n\n\n\nlet asset = function () {\n var _this = this;\n\n return {\n getAssetList: _ref => {\n let {\n type = 'instanceType',\n instanceType,\n size = 20,\n startKey = null,\n roomId\n } = _ref;\n let apiParams = { ...(instanceType && {\n instanceType: instanceType === true ? this.__instanceType : instanceType\n }),\n type,\n size,\n ...(roomId && {\n roomId\n }),\n ...(startKey && {\n startKey\n })\n };\n return this.__privates.auth.__client.then(client => client.apis.asset.getAssetList(apiParams));\n },\n updateAsset: function () {\n let {\n id,\n assetType,\n title,\n roomIds\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.asset.updateAsset({\n id\n }, {\n requestBody: {\n assetType,\n title,\n roomIds\n }\n }));\n },\n deleteAsset: id => {\n return this.__privates.auth.__client.then(client => client.apis.asset.deleteAsset({\n id\n }));\n },\n uploadAsset: (file, roomIds) => {\n let id = Object(_modules_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"generateUUID\"])();\n return this.__privates.auth.__client.then(client => Promise.all([client, client.apis.asset.initiateAssetUpload({\n id\n })])).then(_ref2 => {\n let [client, response] = _ref2;\n return Promise.all([client, client.http({\n url: response.data.signedUrl,\n method: response.data.httpMethod,\n headers: {\n \"Content-Type\": file.type\n },\n body: file\n }), response.data.id]);\n }).then(_ref3 => {\n let [client, response, idn] = _ref3;\n return client.apis.asset.publishAsset({\n id: idn\n }, {\n requestBody: {\n title: file.name,\n ...(roomIds ? {\n roomIds\n } : {})\n }\n });\n });\n },\n downloadAsset: function (url) {\n let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return _this.__privates.auth.__client.then(client => client.http({\n url,\n method: 'GET',\n ...options\n }));\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (asset);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/models/asset.js?");
|
|
9163
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _modules_wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../modules/wt-utils */ \"./src/modules/wt-utils.js\");\n\n\n\n\nlet asset = function () {\n var _this = this;\n\n return {\n getAssetList: _ref => {\n let {\n type = 'instanceType',\n instanceType,\n size = 20,\n startKey = null,\n roomId\n } = _ref;\n let apiParams = { ...(instanceType && {\n instanceType: instanceType === true ? this.__instanceType : instanceType\n }),\n type,\n size,\n ...(roomId && {\n roomId\n }),\n ...(startKey && {\n startKey\n })\n };\n return this.__privates.auth.__client.then(client => client.apis.asset.getAssetList(apiParams));\n },\n updateAsset: function () {\n let {\n id,\n assetType,\n title,\n roomIds\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.asset.updateAsset({\n id\n }, {\n requestBody: {\n assetType,\n title,\n roomIds\n }\n }));\n },\n deleteAsset: id => {\n return this.__privates.auth.__client.then(client => client.apis.asset.deleteAsset({\n id\n }));\n },\n uploadAsset: (file, roomIds) => {\n let id = Object(_modules_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"generateUUID\"])();\n return this.__privates.auth.__client.then(client => Promise.all([client, client.apis.asset.initiateAssetUpload({\n id\n })])).then(_ref2 => {\n let [client, response] = _ref2;\n return Promise.all([client, client.http({\n url: response.data.signedUrl,\n method: response.data.httpMethod,\n headers: {\n \"Content-Type\": file.type\n },\n body: file\n }), response.data.id]);\n }).then(_ref3 => {\n let [client, response, idn] = _ref3;\n return Promise.all([client.apis.asset.publishAsset({\n id: idn\n }, {\n requestBody: {\n title: file.name,\n ...(roomIds ? {\n roomIds\n } : {})\n }\n }), idn]);\n });\n },\n downloadAsset: function (url) {\n let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return _this.__privates.auth.__client.then(client => client.http({\n url,\n method: 'GET',\n ...options\n }));\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (asset);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/models/asset.js?");
|
|
9119
9164
|
|
|
9120
9165
|
/***/ }),
|
|
9121
9166
|
|
|
@@ -9139,7 +9184,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _mod
|
|
|
9139
9184
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9140
9185
|
|
|
9141
9186
|
"use strict";
|
|
9142
|
-
eval("__webpack_require__.r(__webpack_exports__);\n\n\nlet iot = function () {\n var _this = this;\n\n let __currentTopics = [];\n let __ = null;\n return {\n __promise: null,\n __reconnect: err => {\n this.__privates.iot.log('MQTT Error:', err,
|
|
9187
|
+
eval("__webpack_require__.r(__webpack_exports__);\n\n\nlet iot = function () {\n var _this = this;\n\n let __currentTopics = [];\n let __ = null;\n return {\n __promise: null,\n __reconnect: err => {\n this.__privates.iot.log('MQTT Error:', err, `Is event error: ${err instanceof Event}`);\n\n if (err instanceof Event && err.type === 'error') {\n this.__privates.iot.log('SDK MQTT Reconnection attempt');\n\n clearTimeout(__);\n __ = setTimeout(() => {\n this.iot.iotLogin(true, true).catch(e => this.__privates.iot.log('MQTT Connection Error:', e));\n }, 1000);\n }\n },\n __updateCredentials: () => {\n this.iot.getCredentials().then(response => this.__privates.iot.updateWebSocketCredentials(response.data.credentials.accessKeyId, response.data.credentials.secretAccessKey, response.data.credentials.sessionToken, response.data.credentials.expiration));\n },\n getCredentials: () => {\n return this.__privates.auth.__client.then(client => client.apis.auth.iotSignIn({}, {\n requestBody: {\n suggestedTopics: true,\n domain: location.hostname\n }\n }));\n },\n iotLogin: function () {\n let subscribeToSuggestedTopics = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;\n let forceDisconnect = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n _this.iot.$off('error', _this.iot.__reconnect, _this);\n\n _this.iot.__promise = new Promise((resolve, reject) => {\n _this.iot.getCredentials().then(response => {\n return Promise.all([response.data.suggestedTopics, _this.__privates.iot.connect(response.data.endpoint, response.data.clientId, response.data.region, response.data.credentials.accessKeyId, response.data.credentials.secretAccessKey, response.data.credentials.sessionToken, response.data.credentials.expiration, forceDisconnect)]);\n }).then(resolve).catch(reject);\n });\n let __currentTopicsCopy = [...__currentTopics];\n __currentTopics.length = 0;\n\n _this.iot.__promise.then(_ref => {\n let [suggestedTopic, instance] = _ref;\n return subscribeToSuggestedTopics ? Promise.all([...suggestedTopic, ...__currentTopicsCopy].map(topic => _this.iot.subscribe(topic))).then(() => instance) : Promise.resolve(instance);\n }).then(instance => {\n _this.iot.$on('error', _this.iot.__reconnect, _this);\n\n _this.iot.$on('updateCredentials', _this.iot.__updateCredentials, _this);\n\n return instance;\n });\n\n return _this.iot.__promise;\n },\n iotLogout: function () {\n let keepCurrentTopics = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n _this.iot.$off('error', _this.iot.__reconnect, _this);\n\n _this.iot.$off('updateCredentials', _this.iot.__updateCredentials, _this);\n\n if (!keepCurrentTopics) {\n __currentTopics.length = 0;\n }\n\n return _this.__privates.iot.disconnect().then(() => {\n _this.iot.__promise = null;\n return true;\n });\n },\n isConnected: () => {\n return this.__privates.iot.isConnected();\n },\n subscribe: topic => {\n if (__currentTopics.indexOf(topic) === -1) {\n __currentTopics.push(topic);\n\n if (!this.iot.__promise) return Promise.resolve('not_connected');\n return this.iot.__promise.then(() => this.__privates.iot.subscribe(topic));\n }\n },\n unsubscribe: topic => {\n let index = __currentTopics.indexOf(topic);\n\n index > -1 && __currentTopics.splice(index, 1);\n if (!this.iot.__promise) return Promise.resolve('not_connected');\n return this.iot.__promise.then(() => this.__privates.iot.unsubscribe(topic));\n },\n send: (topic, message) => {\n return this.iot.__promise.then(() => this.__privates.iot.send(topic, message));\n },\n $once: (key, callback, that) => {\n return this.__privates.iot.once(key, callback, that || this);\n },\n $on: (key, callback, that) => {\n return this.__privates.iot.on(key, callback, that || this);\n },\n $off: (key, callback, that) => {\n return this.__privates.iot.off(key, callback, that || this);\n },\n $clear: () => {\n return this.__privates.iot.clear();\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (iot);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/models/iot.js?");
|
|
9143
9188
|
|
|
9144
9189
|
/***/ }),
|
|
9145
9190
|
|
|
@@ -9163,7 +9208,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _mod
|
|
|
9163
9208
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9164
9209
|
|
|
9165
9210
|
"use strict";
|
|
9166
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _room_session__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./room-session */ \"./src/models/room-session.js\");\n/* harmony import */ var _streaming_session__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./streaming-session */ \"./src/models/streaming-session.js\");\n/* harmony import */ var _modules_wt_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../modules/wt-utils */ \"./src/modules/wt-utils.js\");\n\n\n\n\n\n\nlet room = function () {\n var _this = this;\n\n let roomSessions = [];\n\n let setExitListeners = () => {\n window.addEventListener('pagehide', event => {\n if (!event.persisted) {\n this.room.destroySessions();\n }\n });\n window.addEventListener('beforeunload', () => {\n this.room.destroySessions();\n });\n };\n\n setExitListeners();\n return {\n //TODO: new model\n integration: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.integration({\n type: _this.__instanceType\n }, {\n requestBody: { ...data\n },\n requestInterceptor: req => {\n if (!req.headers) {\n req.headers = {};\n }\n\n req.headers['Authorization'] = 'Bearer ' + localStorage.getItem('rwt_idToken');\n return req;\n }\n }));\n },\n //TODO: new model\n getAnalytics: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.getAnalytics({\n instanceType: _this.__instanceType,\n ...data\n }));\n },\n sendChatMessage: _ref => {\n let {\n roomId,\n message,\n options,\n senderUserId\n } = _ref;\n return this.__privates.auth.__client.then(client => client.apis.wt.sendRoomMessage({}, {\n requestBody: {\n roomId,\n message,\n options,\n senderUserId\n }\n }));\n },\n createRoom: function () {\n let {\n title,\n description,\n isPublic,\n isRouter,\n isStudioLayout,\n wtChannelId,\n isHd,\n disableSync,\n reduceRoomControls,\n hasStudioChat,\n maxParticipants,\n customAttributes,\n chatRoomId,\n linkedRoomId,\n type,\n dotAttribute\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n let _da = dotAttribute ? Array.isArray(dotAttribute) ? dotAttribute.reduce((p, cv) => (p[cv.name] = cv.value) && p || p, {}) : {\n [dotAttribute.name]: dotAttribute.value\n } : {};\n\n return _this.__privates.auth.__client.then(client => client.apis.wt.createRoom({}, {\n requestBody: {\n title,\n description,\n isRouter,\n isPublic,\n isStudioLayout,\n wtChannelId,\n isHd,\n disableSync,\n reduceRoomControls,\n chatRoomId,\n linkedRoomId,\n hasStudioChat,\n maxParticipants,\n type,\n customAttributes,\n ..._da,\n instanceType: _this.__instanceType\n }\n }));\n },\n updateRoom: function () {\n let {\n roomId,\n title,\n description,\n isPublic,\n isRouter,\n recordings,\n slug,\n password,\n maxParticipants,\n setInstanceType = false,\n wtChannelId,\n isHd,\n isStudioLayout,\n hasStudioChat,\n reduceRoomControls,\n chatRoomId,\n linkedRoomId,\n type,\n disableSync,\n defaultRegion,\n customAttributes,\n dotAttribute\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n let _da = dotAttribute ? Array.isArray(dotAttribute) ? dotAttribute.reduce((p, cv) => (p[cv.name] = cv.value) && p || p, {}) : {\n [dotAttribute.name]: dotAttribute.value\n } : {};\n\n return _this.__privates.auth.__client.then(client => client.apis.wt.updateRoom({\n id: roomId\n }, {\n requestBody: {\n title,\n description,\n slug,\n password,\n isPublic,\n isRouter,\n isHd,\n isStudioLayout,\n hasStudioChat,\n maxParticipants,\n reduceRoomControls,\n chatRoomId,\n linkedRoomId,\n type,\n disableSync,\n defaultRegion,\n customAttributes,\n wtChannelId,\n ..._da,\n ...(setInstanceType && {\n instanceType: setInstanceType === true ? _this.__instanceType : setInstanceType\n }),\n ...(recordings && {\n recordings\n })\n }\n }));\n },\n deleteRoom: roomId => {\n return this.__privates.auth.__client.then(client => client.apis.wt.deleteRoom({\n id: roomId\n }));\n },\n leaveRoom: roomId => {\n return this.__privates.auth.__client.then(client => client.apis.wt.leave({\n roomId\n }));\n },\n updateLayout: _ref2 => {\n let {\n roomId,\n operation,\n name,\n attributeName,\n value,\n target\n } = _ref2;\n //operation : clearLayouts, setLayout, setLayouts, unsetLayout, setName, setTarget, setStyle, setAttribute, unsetAttribute,'sendMessage'\n return this.__privates.auth.__client.then(client => client.apis.wt.updateLayout({}, {\n requestBody: {\n roomId,\n operation,\n name,\n attributeName,\n value,\n target\n }\n }));\n },\n getInviteUrl: (roomId, domain, url) => {\n return this.__privates.auth.__client.then(client => client.apis.wt.invite({}, {\n requestBody: {\n roomId,\n domain: domain || location.host,\n url: url || location.href\n }\n }));\n },\n getRoomChatList: function () {\n let {\n roomId,\n type = \"normal\",\n size = 50,\n startKey = null\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let apiParams = {\n roomId,\n type,\n size,\n ...(startKey && {\n startKey\n })\n };\n return _this.__privates.auth.__client.then(client => client.apis.wt.getRoomChatList(apiParams));\n },\n getRoomsList: function () {\n let {\n type = 'participant',\n activeOnly = null,\n instanceType = _this.__instanceType,\n size = 20,\n startKey = null,\n includeWtEventModels = false,\n demo = false,\n viewType = 'list',\n wtChannelId = undefined\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let apiParams = {\n type,\n instanceType,\n size,\n includeWtEventModels,\n demo,\n viewType,\n ...(wtChannelId && {\n wtChannelId\n }),\n ...(activeOnly && {\n activeOnly\n }),\n ...(startKey && {\n startKey\n })\n };\n return _this.__privates.auth.__client.then(client => client.apis.wt.getRoomList(apiParams));\n },\n setUser: _ref3 => {\n let {\n messageId,\n userId,\n roomId,\n flag,\n timestamp,\n option\n } = _ref3;\n //leave, kick, ban, unban, approve, report\n return this.__privates.auth.__client.then(client => client.apis.wt.setUser({\n messageId,\n userId,\n roomId,\n flag,\n timestamp,\n option\n }));\n },\n getRoomById: function (id) {\n let pinHash = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;\n let showPublic = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;\n let demo = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n let signal = arguments.length > 4 ? arguments[4] : undefined;\n return _this.__privates.auth.__client.then(client => client.apis.wt.getRoom({\n id,\n pinHash,\n \"public\": showPublic,\n demo\n }, { ...(signal ? {\n requestInterceptor: req => {\n req.signal = signal;\n return req;\n }\n } : {})\n }));\n },\n getRoomBySlug: function (slug) {\n let password = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;\n let showPublic = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;\n let demo = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n return _this.__privates.auth.__client.then(client => client.apis.wt.getRoom({\n slug,\n password,\n \"public\": showPublic,\n demo\n }));\n },\n roomRecorder: function () {\n let {\n roomId,\n operation = 'get',\n config\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.wt.recordRoom({}, {\n requestBody: {\n roomId,\n operation,\n config\n }\n }));\n },\n __joinRoom: function () {\n let {\n roomId,\n pinHash,\n instanceType = _this.__instanceType,\n role = 'participant',\n customBearer = undefined\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let signal = arguments.length > 1 ? arguments[1] : undefined;\n return _this.__privates.auth.__client.then(client => client.apis.wt.join({\n roomId,\n pinHash,\n instanceType,\n role,\n platform: _this.browser === 'firefox' ? 'web-firefox' : 'web'\n }, { ...(signal ? {\n requestInterceptor: req => {\n req.signal = signal;\n return req;\n }\n } : {})\n }));\n },\n isSafariSupported: () => {\n return this.__privates.room.safariVp8;\n },\n isWebrtcSupported: () => {\n return this.__privates.room.isWebrtcSupported;\n },\n createStreamingSession: function () {\n let {\n constructId,\n roomId,\n pinHash,\n streamId,\n href,\n iceServers,\n accessToken\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.room.whenInitialized.then(lib => _streaming_session__WEBPACK_IMPORTED_MODULE_1__[\"default\"].call(_this, {\n roomId,\n pinHash,\n streamId,\n href,\n iceServers,\n accessToken\n }, lib.createSession(constructId, 'streaming'), _this)).then(newSession => {\n let existingSessionIndex = roomSessions.findIndex(session => session.constructId === newSession.constructId);\n\n if (existingSessionIndex > -1) {\n return _this.room.destroySession(newSession.constructId).then(() => {\n roomSessions.push(newSession);\n return newSession;\n });\n } else {\n roomSessions.push(newSession);\n return newSession;\n }\n });\n },\n createSession: _ref4 => {\n let {\n constructId,\n roomId,\n pinHash,\n role,\n options\n } = _ref4;\n return this.__privates.room.whenInitialized.then(lib => _room_session__WEBPACK_IMPORTED_MODULE_0__[\"default\"].call(this, {\n roomId,\n pinHash,\n role\n }, lib.createSession(constructId, 'reactooroom', options), this)).then(newSession => {\n let existingSessionIndex = roomSessions.findIndex(session => session.constructId === newSession.constructId);\n\n if (existingSessionIndex > -1) {\n return this.room.destroySession(newSession.constructId).then(() => {\n roomSessions.push(newSession);\n return newSession;\n });\n } else {\n roomSessions.push(newSession);\n return newSession;\n }\n });\n },\n getSessions: () => {\n return roomSessions;\n },\n getSessionByConstructId: constructId => {\n return roomSessions.find(session => session.constructId === constructId) || null;\n },\n getSessionBySessionId: sessionId => {\n return roomSessions.find(session => session.sessionId === sessionId) || null;\n },\n getSessionByRoomId: roomId => {\n return roomSessions.find(session => session.roomId === roomId) || null;\n },\n getSessionByUserId: userId => {\n return roomSessions.find(session => {\n var _decodeJanusDisplay;\n\n return ((_decodeJanusDisplay = Object(_modules_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(session.userId)) === null || _decodeJanusDisplay === void 0 ? void 0 : _decodeJanusDisplay.userId) === userId;\n }) || null;\n },\n getSessionByStreamId: streamId => {\n return roomSessions.find(session => session.streamId === streamId) || null;\n },\n destroySession: constructId => {\n let sessionIndex = roomSessions.findIndex(session => session.constructId === constructId);\n\n if (sessionIndex > -1) {\n return roomSessions[sessionIndex].destroy().finally(() => {\n roomSessions.splice(sessionIndex, 1);\n return true;\n });\n }\n\n return Promise.resolve();\n },\n destroySessionBySessionId: sessionId => {\n let sessionIndex = roomSessions.findIndex(session => session.sessionId === sessionId);\n\n if (sessionIndex > -1) {\n return roomSessions[sessionIndex].destroy().finally(() => {\n roomSessions.splice(sessionIndex, 1);\n return true;\n });\n }\n\n return Promise.resolve();\n },\n destroySessions: () => {\n roomSessions.forEach(session => session.destroy().catch(e => this.log(e)));\n roomSessions.length = 0;\n },\n queue: function () {\n let {\n roomId,\n operation,\n userId\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n //Enum: \"status\" \"join\" \"approve\" \"reject\" \"block\" \"unblock\"\n return _this.__privates.auth.__client.then(client => client.apis.wt.queue({}, {\n requestBody: {\n roomId,\n operation,\n userId\n }\n }));\n },\n getDefaultRegions: () => {\n return this.__privates.auth.__client.then(client => {\n var _client$spec, _client$spec$componen, _client$spec$componen2, _client$spec$componen3, _client$spec$componen4, _client$spec$componen5;\n\n return [...(((_client$spec = client.spec) === null || _client$spec === void 0 ? void 0 : (_client$spec$componen = _client$spec.components) === null || _client$spec$componen === void 0 ? void 0 : (_client$spec$componen2 = _client$spec$componen.schemas) === null || _client$spec$componen2 === void 0 ? void 0 : (_client$spec$componen3 = _client$spec$componen2.WtRoom) === null || _client$spec$componen3 === void 0 ? void 0 : (_client$spec$componen4 = _client$spec$componen3.properties) === null || _client$spec$componen4 === void 0 ? void 0 : (_client$spec$componen5 = _client$spec$componen4.defaultRegion) === null || _client$spec$componen5 === void 0 ? void 0 : _client$spec$componen5.enum) || [''])];\n });\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (room);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/models/room.js?");
|
|
9211
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _room_session__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./room-session */ \"./src/models/room-session.js\");\n/* harmony import */ var _streaming_session__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./streaming-session */ \"./src/models/streaming-session.js\");\n/* harmony import */ var _modules_wt_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../modules/wt-utils */ \"./src/modules/wt-utils.js\");\n\n\n\n\n\n\nlet room = function () {\n var _this = this;\n\n let roomSessions = [];\n\n let setExitListeners = () => {\n window.addEventListener('pagehide', event => {\n if (!event.persisted) {\n this.room.destroySessions();\n }\n });\n window.addEventListener('beforeunload', () => {\n this.room.destroySessions();\n });\n };\n\n setExitListeners();\n return {\n //TODO:deprecated\n integration: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.integration({\n type: _this.__instanceType\n }, {\n requestBody: { ...data\n },\n requestInterceptor: req => {\n if (!req.headers) {\n req.headers = {};\n }\n\n req.headers['Authorization'] = 'Bearer ' + localStorage.getItem('rwt_idToken');\n return req;\n }\n }));\n },\n //TODO:deprecated\n getAnalytics: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.getAnalytics({\n instanceType: _this.__instanceType,\n ...data\n }));\n },\n sendChatMessage: _ref => {\n let {\n roomId,\n message,\n options,\n senderUserId\n } = _ref;\n return this.__privates.auth.__client.then(client => client.apis.wt.sendRoomMessage({}, {\n requestBody: {\n roomId,\n message,\n options,\n senderUserId\n }\n }));\n },\n createRoom: function () {\n let {\n title,\n description,\n isPublic,\n isRouter,\n isStudioLayout,\n wtChannelId,\n isHd,\n disableSync,\n reduceRoomControls,\n hasStudioChat,\n maxParticipants,\n customAttributes,\n chatRoomId,\n linkedRoomId,\n type,\n dotAttribute\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n let _da = dotAttribute ? Array.isArray(dotAttribute) ? dotAttribute.reduce((p, cv) => (p[cv.name] = cv.value) && p || p, {}) : {\n [dotAttribute.name]: dotAttribute.value\n } : {};\n\n return _this.__privates.auth.__client.then(client => client.apis.wt.createRoom({}, {\n requestBody: {\n title,\n description,\n isRouter,\n isPublic,\n isStudioLayout,\n wtChannelId,\n isHd,\n disableSync,\n reduceRoomControls,\n chatRoomId,\n linkedRoomId,\n hasStudioChat,\n maxParticipants,\n type,\n customAttributes,\n ..._da,\n instanceType: _this.__instanceType\n }\n }));\n },\n updateRoom: function () {\n let {\n roomId,\n title,\n description,\n isPublic,\n isRouter,\n recordings,\n slug,\n password,\n maxParticipants,\n setInstanceType = false,\n wtChannelId,\n isHd,\n isStudioLayout,\n hasStudioChat,\n reduceRoomControls,\n chatRoomId,\n linkedRoomId,\n type,\n disableSync,\n defaultRegion,\n customAttributes,\n dotAttribute\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n let _da = dotAttribute ? Array.isArray(dotAttribute) ? dotAttribute.reduce((p, cv) => (p[cv.name] = cv.value) && p || p, {}) : {\n [dotAttribute.name]: dotAttribute.value\n } : {};\n\n return _this.__privates.auth.__client.then(client => client.apis.wt.updateRoom({\n id: roomId\n }, {\n requestBody: {\n title,\n description,\n slug,\n password,\n isPublic,\n isRouter,\n isHd,\n isStudioLayout,\n hasStudioChat,\n maxParticipants,\n reduceRoomControls,\n chatRoomId,\n linkedRoomId,\n type,\n disableSync,\n defaultRegion,\n customAttributes,\n wtChannelId,\n ..._da,\n ...(setInstanceType && {\n instanceType: setInstanceType === true ? _this.__instanceType : setInstanceType\n }),\n ...(recordings && {\n recordings\n })\n }\n }));\n },\n deleteRoom: roomId => {\n return this.__privates.auth.__client.then(client => client.apis.wt.deleteRoom({\n id: roomId\n }));\n },\n leaveRoom: roomId => {\n return this.__privates.auth.__client.then(client => client.apis.wt.leave({\n roomId\n }));\n },\n updateLayout: _ref2 => {\n let {\n roomId,\n operation,\n name,\n attributeName,\n value,\n target\n } = _ref2;\n //operation : clearLayouts, setLayout, setLayouts, unsetLayout, setName, setTarget, setStyle, setAttribute, unsetAttribute,'sendMessage'\n return this.__privates.auth.__client.then(client => client.apis.wt.updateLayout({}, {\n requestBody: {\n roomId,\n operation,\n name,\n attributeName,\n value,\n target\n }\n }));\n },\n getInviteUrl: (roomId, domain, url) => {\n return this.__privates.auth.__client.then(client => client.apis.wt.invite({}, {\n requestBody: {\n roomId,\n domain: domain || location.host,\n url: url || location.href\n }\n }));\n },\n getRoomChatList: function () {\n let {\n roomId,\n type = \"normal\",\n size = 50,\n startKey = null\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let apiParams = {\n roomId,\n type,\n size,\n ...(startKey && {\n startKey\n })\n };\n return _this.__privates.auth.__client.then(client => client.apis.wt.getRoomChatList(apiParams));\n },\n getRoomsList: function () {\n let {\n type = 'participant',\n activeOnly = null,\n instanceType = _this.__instanceType,\n size = 20,\n startKey = null,\n includeWtEventModels = false,\n demo = false,\n viewType = 'list',\n wtChannelId = undefined\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let apiParams = {\n type,\n instanceType,\n size,\n includeWtEventModels,\n demo,\n viewType,\n ...(wtChannelId && {\n wtChannelId\n }),\n ...(activeOnly && {\n activeOnly\n }),\n ...(startKey && {\n startKey\n })\n };\n return _this.__privates.auth.__client.then(client => client.apis.wt.getRoomList(apiParams));\n },\n setUser: _ref3 => {\n let {\n messageId,\n userId,\n roomId,\n flag,\n timestamp,\n option\n } = _ref3;\n //leave, kick, ban, unban, approve, report\n return this.__privates.auth.__client.then(client => client.apis.wt.setUser({\n messageId,\n userId,\n roomId,\n flag,\n timestamp,\n option\n }));\n },\n getRoomById: function (id) {\n let pinHash = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;\n let showPublic = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;\n let demo = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n let signal = arguments.length > 4 ? arguments[4] : undefined;\n return _this.__privates.auth.__client.then(client => client.apis.wt.getRoom({\n id,\n pinHash,\n \"public\": showPublic,\n demo\n }, { ...(signal ? {\n requestInterceptor: req => {\n req.signal = signal;\n return req;\n }\n } : {})\n }));\n },\n getRoomBySlug: function (slug) {\n let password = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;\n let showPublic = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;\n let demo = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n return _this.__privates.auth.__client.then(client => client.apis.wt.getRoom({\n slug,\n password,\n \"public\": showPublic,\n demo\n }));\n },\n roomRecorder: function () {\n let {\n roomId,\n operation = 'get',\n config\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.wt.recordRoom({}, {\n requestBody: {\n roomId,\n operation,\n config\n }\n }));\n },\n __joinRoom: function () {\n let {\n roomId,\n pinHash,\n instanceType = _this.__instanceType,\n role = 'participant',\n customBearer = undefined\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let signal = arguments.length > 1 ? arguments[1] : undefined;\n return _this.__privates.auth.__client.then(client => client.apis.wt.join({\n roomId,\n pinHash,\n instanceType,\n role,\n platform: _this.browser === 'firefox' ? 'web-firefox' : 'web'\n }, { ...(signal ? {\n requestInterceptor: req => {\n req.signal = signal;\n return req;\n }\n } : {})\n }));\n },\n isSafariSupported: () => {\n return this.__privates.room.safariVp8;\n },\n isWebrtcSupported: () => {\n return this.__privates.room.isWebrtcSupported;\n },\n createStreamingSession: function () {\n let {\n constructId,\n roomId,\n pinHash,\n streamId,\n href,\n iceServers,\n accessToken\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.room.whenInitialized.then(lib => _streaming_session__WEBPACK_IMPORTED_MODULE_1__[\"default\"].call(_this, {\n roomId,\n pinHash,\n streamId,\n href,\n iceServers,\n accessToken\n }, lib.createSession(constructId, 'streaming'), _this)).then(newSession => {\n let existingSessionIndex = roomSessions.findIndex(session => session.constructId === newSession.constructId);\n\n if (existingSessionIndex > -1) {\n return _this.room.destroySession(newSession.constructId).then(() => {\n roomSessions.push(newSession);\n return newSession;\n });\n } else {\n roomSessions.push(newSession);\n return newSession;\n }\n });\n },\n createSession: _ref4 => {\n let {\n constructId,\n roomId,\n pinHash,\n role,\n options\n } = _ref4;\n return this.__privates.room.whenInitialized.then(lib => _room_session__WEBPACK_IMPORTED_MODULE_0__[\"default\"].call(this, {\n roomId,\n pinHash,\n role\n }, lib.createSession(constructId, 'reactooroom', options), this)).then(newSession => {\n let existingSessionIndex = roomSessions.findIndex(session => session.constructId === newSession.constructId);\n\n if (existingSessionIndex > -1) {\n return this.room.destroySession(newSession.constructId).then(() => {\n roomSessions.push(newSession);\n return newSession;\n });\n } else {\n roomSessions.push(newSession);\n return newSession;\n }\n });\n },\n getSessions: () => {\n return roomSessions;\n },\n getSessionByConstructId: constructId => {\n return roomSessions.find(session => session.constructId === constructId) || null;\n },\n getSessionBySessionId: sessionId => {\n return roomSessions.find(session => session.sessionId === sessionId) || null;\n },\n getSessionByRoomId: roomId => {\n return roomSessions.find(session => session.roomId === roomId) || null;\n },\n getSessionByUserId: userId => {\n return roomSessions.find(session => {\n var _decodeJanusDisplay;\n\n return ((_decodeJanusDisplay = Object(_modules_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(session.userId)) === null || _decodeJanusDisplay === void 0 ? void 0 : _decodeJanusDisplay.userId) === userId;\n }) || null;\n },\n getSessionByStreamId: streamId => {\n return roomSessions.find(session => session.streamId === streamId) || null;\n },\n destroySession: constructId => {\n let sessionIndex = roomSessions.findIndex(session => session.constructId === constructId);\n\n if (sessionIndex > -1) {\n return roomSessions[sessionIndex].destroy().finally(() => {\n roomSessions.splice(sessionIndex, 1);\n return true;\n });\n }\n\n return Promise.resolve();\n },\n destroySessionBySessionId: sessionId => {\n let sessionIndex = roomSessions.findIndex(session => session.sessionId === sessionId);\n\n if (sessionIndex > -1) {\n return roomSessions[sessionIndex].destroy().finally(() => {\n roomSessions.splice(sessionIndex, 1);\n return true;\n });\n }\n\n return Promise.resolve();\n },\n destroySessions: () => {\n roomSessions.forEach(session => session.destroy().catch(e => this.log(e)));\n roomSessions.length = 0;\n },\n queue: function () {\n let {\n roomId,\n operation,\n userId\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n //Enum: \"status\" \"join\" \"approve\" \"reject\" \"block\" \"unblock\"\n return _this.__privates.auth.__client.then(client => client.apis.wt.queue({}, {\n requestBody: {\n roomId,\n operation,\n userId\n }\n }));\n },\n getDefaultRegions: () => {\n return this.__privates.auth.__client.then(client => {\n var _client$spec, _client$spec$componen, _client$spec$componen2, _client$spec$componen3, _client$spec$componen4, _client$spec$componen5;\n\n return [...(((_client$spec = client.spec) === null || _client$spec === void 0 ? void 0 : (_client$spec$componen = _client$spec.components) === null || _client$spec$componen === void 0 ? void 0 : (_client$spec$componen2 = _client$spec$componen.schemas) === null || _client$spec$componen2 === void 0 ? void 0 : (_client$spec$componen3 = _client$spec$componen2.WtRoom) === null || _client$spec$componen3 === void 0 ? void 0 : (_client$spec$componen4 = _client$spec$componen3.properties) === null || _client$spec$componen4 === void 0 ? void 0 : (_client$spec$componen5 = _client$spec$componen4.defaultRegion) === null || _client$spec$componen5 === void 0 ? void 0 : _client$spec$componen5.enum) || [''])];\n });\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (room);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/models/room.js?");
|
|
9167
9212
|
|
|
9168
9213
|
/***/ }),
|
|
9169
9214
|
|
|
@@ -9187,7 +9232,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n\n\nlet streamingSession = fu
|
|
|
9187
9232
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9188
9233
|
|
|
9189
9234
|
"use strict";
|
|
9190
|
-
eval("__webpack_require__.r(__webpack_exports__);\n\n\nlet system = function () {\n var _this = this;\n\n return {\n integration: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.integration({\n type: _this.__instanceType\n }, {\n requestBody: { ...data\n },\n requestInterceptor: req => {\n if (!req.headers) {\n req.headers = {};\n }\n\n req.headers['Authorization'] = 'Bearer ' + localStorage.getItem('rwt_idToken');\n return req;\n }\n }));\n },\n getAnalytics: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.getAnalytics({\n instanceType: _this.__instanceType,\n ...data\n }));\n },\n getTranslation: function () {\n let {\n namespace = 'wt'\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.getTranslation({\n namespace\n }));\n },\n getConfig: function () {\n let {\n instanceType = _this.__instanceType,\n domain = location.hostname\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.getConfig({\n instanceType,\n domain\n }));\n },\n updateConfig: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.updateConfig({\n id: data.instanceType || _this.__instanceType\n }, {\n requestBody: { ...data\n }\n }));\n },\n getIntegrationPublic: function (type) {\n let data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.integrationPublic({\n type\n }, {\n requestBody: { ...data\n }\n }));\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (system);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/models/system.js?");
|
|
9235
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var serialize_error__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! serialize-error */ \"./node_modules/serialize-error/index.js\");\n\n\n\n\nlet system = function () {\n var _this = this;\n\n return {\n integration: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.integration({\n type: _this.__instanceType\n }, {\n requestBody: { ...data\n },\n requestInterceptor: req => {\n if (!req.headers) {\n req.headers = {};\n }\n\n req.headers['Authorization'] = 'Bearer ' + localStorage.getItem('rwt_idToken');\n return req;\n }\n }));\n },\n getAnalytics: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.getAnalytics({\n instanceType: _this.__instanceType,\n ...data\n }));\n },\n getTranslation: function () {\n let {\n namespace = 'wt'\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.getTranslation({\n namespace\n }));\n },\n getConfig: function () {\n let {\n instanceType = _this.__instanceType,\n domain = location.hostname\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.getConfig({\n instanceType,\n domain\n }));\n },\n updateConfig: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.updateConfig({\n id: data.instanceType || _this.__instanceType\n }, {\n requestBody: { ...data\n }\n }));\n },\n getIntegrationPublic: function (type) {\n let data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.integrationPublic({\n type\n }, {\n requestBody: { ...data\n }\n }));\n },\n admin: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.wt.admin({}, {\n requestBody: {\n instanceType: _this.__instanceType,\n ...data\n }\n }));\n },\n analytics: function () {\n let {\n action,\n startKey = null,\n limit = 20\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let apiParams = {\n action,\n limit,\n ...(startKey && {\n startKey\n })\n };\n return _this.__privates.auth.__client.then(client => client.apis.wt.analytics({}, {\n requestBody: {\n instanceType: _this.__instanceType,\n ...apiParams\n }\n }));\n },\n track: function () {\n let {\n eventType = 'ERROR',\n message\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.wt.track({}, {\n requestBody: {\n \"eventType\": eventType,\n \"appType\": \"web\",\n \"deviceType\": `desktop${navigator.maxTouchPoints ? '/touch' : ''}`,\n \"os\": navigator.platform,\n \"browser\": navigator.userAgent,\n \"domain\": location.host,\n \"url\": location.href,\n \"message\": Object(serialize_error__WEBPACK_IMPORTED_MODULE_0__[\"serializeError\"])(message)\n }\n }));\n },\n getSchemas: () => {\n return this.__privates.auth.__client.then(client => {\n var _client$spec, _client$spec$componen;\n\n return (_client$spec = client.spec) === null || _client$spec === void 0 ? void 0 : (_client$spec$componen = _client$spec.components) === null || _client$spec$componen === void 0 ? void 0 : _client$spec$componen.schemas;\n });\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (system);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/models/system.js?");
|
|
9191
9236
|
|
|
9192
9237
|
/***/ }),
|
|
9193
9238
|
|
|
@@ -9199,7 +9244,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n\n\nlet system = function ()
|
|
|
9199
9244
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9200
9245
|
|
|
9201
9246
|
"use strict";
|
|
9202
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _modules_wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../modules/wt-utils */ \"./src/modules/wt-utils.js\");\n/* harmony import */ var serialize_error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! serialize-error */ \"./node_modules/serialize-error/index.js\");\n\n\n\n\n\nlet user = function () {\n var _this = this;\n\n return {\n updateUserSelf: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.user.updateMyself({ ...(data.lastRoomId && {\n lastRoomId: data.lastRoomId\n })\n }, {\n requestBody: { ...data\n }\n }));\n },\n updateUser: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.user.updateUser({ ...data\n }, {\n requestBody: { ...data\n }\n }));\n },\n uploadAvatar: (file, lastRoomId) => {\n let id = Object(_modules_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"generateUUID\"])();\n return this.__privates.auth.__client.then(client => Promise.all([client, client.apis.user.initiateMyAvatarUpload({\n id\n })])).then(_ref => {\n let [client, response] = _ref;\n return Promise.all([client, client.http({\n url: response.data.signedUrl,\n method: response.data.httpMethod,\n headers: {\n \"Content-Type\": file.type\n },\n body: file\n })]);\n }).then(_ref2 => {\n let [client, response] = _ref2;\n return client.apis.user.publishMyAvatar({\n id,\n lastRoomId\n });\n });\n },\n uploadReaction: files => {\n let id = Object(_modules_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"generateUUID\"])();\n return this.__privates.auth.__client.then(client => Promise.all([client, client.apis.reaction.initiateReactionUpload({\n id: id,\n segmentCount: files.length || 0\n })])).then(_ref3 => {\n let [client, response] = _ref3;\n return Promise.all([client, ...response.data.signedUrlSegments.map((url, index) => client.http({\n url,\n method: response.data.httpMethod,\n headers: {\n \"Content-Type\": files[index].type\n },\n body: files[index]\n }))]);\n }).then(_ref4 => {\n let [client] = _ref4;\n return client.apis.reaction.processReaction({\n id: id,\n type: 'concat'\n });\n }).then(response => response.data.key);\n },\n uploadVideo: function (roomId, files) {\n let privateAttributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n let id = Object(_modules_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"generateUUID\"])();\n return _this.__privates.auth.__client.then(client => Promise.all([client, client.apis.video.initiateVideoUpload({\n id,\n segmentCount: files.length || 0\n })])).then(_ref5 => {\n let [client, response] = _ref5;\n return Promise.all([client, response.data.signedUrlSegments.reduce((acc, url, index) => acc.then(() => client.http({\n url,\n method: response.data.httpMethod,\n headers: {\n \"Content-Type\": files[index].type\n },\n body: files[index]\n })), Promise.resolve())]);\n }).then(_ref6 => {\n let [client] = _ref6;\n return client.apis.video.publishVideo({\n _id: id,\n roomId\n }, {\n requestBody: {\n _id: id,\n roomId,\n privateAttributes\n }\n });\n });\n },\n getReactionById: id => {\n return this.__privates.auth.__client.then(client => client.apis.reaction.getReactionById({\n id\n }));\n },\n getReactions: function () {\n let {\n userId,\n roomId,\n type,\n size,\n startKey,\n includeUserModels = false\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let apiParams = { ...(roomId && {\n roomId\n }),\n ...(userId && {\n userId\n }),\n ...(size && {\n size\n }),\n ...(startKey && {\n startKey\n }),\n includeUserModels,\n type\n };\n return _this.__privates.auth.__client.then(client => client.apis.reaction.getReactions(apiParams));\n },\n getVideoById: id => {\n return this.__privates.auth.__client.then(client => client.apis.video.getVideoById({\n id\n }));\n },\n getVideos: function () {\n let {\n roomId,\n userId,\n type,\n size,\n startKey,\n includeUserModels = false,\n includeRoomQueueStatus\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let apiParams = { ...(roomId && {\n roomId\n }),\n ...(userId && {\n userId\n }),\n ...(size && {\n size\n }),\n ...(startKey && {\n startKey\n }),\n ...(includeRoomQueueStatus && {\n includeRoomQueueStatus\n }),\n includeUserModels,\n type\n };\n return _this.__privates.auth.__client.then(client => client.apis.video.getVideos(apiParams));\n },\n getUserSelf: () => {\n return this.__privates.auth.__client.then(client => client.apis.user.getUserMyself());\n },\n getUserById: id => {\n return this.__privates.auth.__client.then(client => client.apis.user.getUserById({\n id\n }));\n },\n getUsersByIds: function () {\n let {\n ids = [],\n size = null,\n startKey = null\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let apiParams = {\n type: 'ids',\n ...(size && {\n size\n }),\n ...(ids && {\n ids: ids.join(',')\n }),\n ...(startKey && {\n startKey\n })\n };\n return _this.__privates.auth.__client.then(client => client.apis.user.getUsers(apiParams));\n },\n getUsers: function () {\n let {\n type,\n userId,\n roomId,\n size = 20,\n startKey = null\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let apiParams = {\n type,\n size,\n ...(roomId && {\n roomId\n }),\n ...(userId && {\n userId\n }),\n ...(startKey && {\n startKey\n })\n };\n return _this.__privates.auth.__client.then(client => client.apis.user.getUsers(apiParams));\n },\n //TODO: should have own model\n track: function () {\n let {\n eventType = 'ERROR',\n message\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.wt.track({}, {\n requestBody: {\n \"eventType\": eventType,\n \"appType\": \"web\",\n \"deviceType\": \"desktop\".concat(navigator.maxTouchPoints ? '/touch' : ''),\n \"os\": navigator.platform,\n \"browser\": navigator.userAgent,\n \"domain\": location.host,\n \"url\": location.href,\n \"message\": Object(serialize_error__WEBPACK_IMPORTED_MODULE_1__[\"serializeError\"])(message)\n }\n }));\n },\n //TODO: new model\n getTranslation: function () {\n let {\n namespace = 'wt'\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.getTranslation({\n namespace\n }));\n },\n //TODO: new model\n getConfig: function () {\n let {\n instanceType = _this.__instanceType,\n domain = location.hostname\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.getConfig({\n instanceType,\n domain\n }));\n },\n //TODO: new model\n getIntegrationPublic: function (type) {\n let data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.integrationPublic({\n type\n }, {\n requestBody: { ...data\n }\n }));\n },\n updateConfig: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.wt.updateConfig({\n id: data.instanceType || _this.__instanceType\n }, {\n requestBody: { ...data\n }\n }));\n },\n admin: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.wt.admin({}, {\n requestBody: {\n instanceType: _this.__instanceType,\n ...data\n }\n }));\n },\n analytics: function () {\n let {\n action,\n startKey = null,\n limit = 20\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let apiParams = {\n action,\n limit,\n ...(startKey && {\n startKey\n })\n };\n return _this.__privates.auth.__client.then(client => client.apis.wt.analytics({}, {\n requestBody: {\n instanceType: _this.__instanceType,\n ...apiParams\n }\n }));\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (user);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/models/user.js?");
|
|
9247
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _modules_wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../modules/wt-utils */ \"./src/modules/wt-utils.js\");\n/* harmony import */ var serialize_error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! serialize-error */ \"./node_modules/serialize-error/index.js\");\n\n\n\n\n\nlet user = function () {\n var _this = this;\n\n return {\n updateUserSelf: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.user.updateMyself({ ...(data.lastRoomId && {\n lastRoomId: data.lastRoomId\n })\n }, {\n requestBody: { ...data\n }\n }));\n },\n updateUser: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.user.updateUser({ ...data\n }, {\n requestBody: { ...data\n }\n }));\n },\n uploadAvatar: (file, lastRoomId) => {\n let id = Object(_modules_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"generateUUID\"])();\n return this.__privates.auth.__client.then(client => Promise.all([client, client.apis.user.initiateMyAvatarUpload({\n id\n })])).then(_ref => {\n let [client, response] = _ref;\n return Promise.all([client, client.http({\n url: response.data.signedUrl,\n method: response.data.httpMethod,\n headers: {\n \"Content-Type\": file.type\n },\n body: file\n })]);\n }).then(_ref2 => {\n let [client, response] = _ref2;\n return client.apis.user.publishMyAvatar({\n id,\n lastRoomId\n });\n });\n },\n uploadReaction: files => {\n let id = Object(_modules_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"generateUUID\"])();\n return this.__privates.auth.__client.then(client => Promise.all([client, client.apis.reaction.initiateReactionUpload({\n id: id,\n segmentCount: files.length || 0\n })])).then(_ref3 => {\n let [client, response] = _ref3;\n return Promise.all([client, ...response.data.signedUrlSegments.map((url, index) => client.http({\n url,\n method: response.data.httpMethod,\n headers: {\n \"Content-Type\": files[index].type\n },\n body: files[index]\n }))]);\n }).then(_ref4 => {\n let [client] = _ref4;\n return client.apis.reaction.processReaction({\n id: id,\n type: 'concat'\n });\n }).then(response => response.data.key);\n },\n uploadVideo: function (roomId, files) {\n let privateAttributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n let id = Object(_modules_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"generateUUID\"])();\n return _this.__privates.auth.__client.then(client => Promise.all([client, client.apis.video.initiateVideoUpload({\n id,\n segmentCount: files.length || 0\n })])).then(_ref5 => {\n let [client, response] = _ref5;\n return Promise.all([client, response.data.signedUrlSegments.reduce((acc, url, index) => acc.then(() => client.http({\n url,\n method: response.data.httpMethod,\n headers: {\n \"Content-Type\": files[index].type\n },\n body: files[index]\n })), Promise.resolve())]);\n }).then(_ref6 => {\n let [client] = _ref6;\n return client.apis.video.publishVideo({\n _id: id,\n roomId\n }, {\n requestBody: {\n _id: id,\n roomId,\n privateAttributes\n }\n });\n });\n },\n getReactionById: id => {\n return this.__privates.auth.__client.then(client => client.apis.reaction.getReactionById({\n id\n }));\n },\n getReactions: function () {\n let {\n userId,\n roomId,\n type,\n size,\n startKey,\n includeUserModels = false\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let apiParams = { ...(roomId && {\n roomId\n }),\n ...(userId && {\n userId\n }),\n ...(size && {\n size\n }),\n ...(startKey && {\n startKey\n }),\n includeUserModels,\n type\n };\n return _this.__privates.auth.__client.then(client => client.apis.reaction.getReactions(apiParams));\n },\n getVideoById: id => {\n return this.__privates.auth.__client.then(client => client.apis.video.getVideoById({\n id\n }));\n },\n getVideos: function () {\n let {\n roomId,\n userId,\n type,\n size,\n startKey,\n includeUserModels = false,\n includeRoomQueueStatus\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let apiParams = { ...(roomId && {\n roomId\n }),\n ...(userId && {\n userId\n }),\n ...(size && {\n size\n }),\n ...(startKey && {\n startKey\n }),\n ...(includeRoomQueueStatus && {\n includeRoomQueueStatus\n }),\n includeUserModels,\n type\n };\n return _this.__privates.auth.__client.then(client => client.apis.video.getVideos(apiParams));\n },\n getUserSelf: () => {\n return this.__privates.auth.__client.then(client => client.apis.user.getUserMyself());\n },\n getUserById: id => {\n return this.__privates.auth.__client.then(client => client.apis.user.getUserById({\n id\n }));\n },\n getUsersByIds: function () {\n let {\n ids = [],\n size = null,\n startKey = null\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let apiParams = {\n type: 'ids',\n ...(size && {\n size\n }),\n ...(ids && {\n ids: ids.join(',')\n }),\n ...(startKey && {\n startKey\n })\n };\n return _this.__privates.auth.__client.then(client => client.apis.user.getUsers(apiParams));\n },\n getUsers: function () {\n let {\n type,\n userId,\n roomId,\n size = 20,\n startKey = null\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let apiParams = {\n type,\n size,\n ...(roomId && {\n roomId\n }),\n ...(userId && {\n userId\n }),\n ...(startKey && {\n startKey\n })\n };\n return _this.__privates.auth.__client.then(client => client.apis.user.getUsers(apiParams));\n },\n //TODO:deprecated\n track: function () {\n let {\n eventType = 'ERROR',\n message\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.wt.track({}, {\n requestBody: {\n \"eventType\": eventType,\n \"appType\": \"web\",\n \"deviceType\": `desktop${navigator.maxTouchPoints ? '/touch' : ''}`,\n \"os\": navigator.platform,\n \"browser\": navigator.userAgent,\n \"domain\": location.host,\n \"url\": location.href,\n \"message\": Object(serialize_error__WEBPACK_IMPORTED_MODULE_1__[\"serializeError\"])(message)\n }\n }));\n },\n //TODO:deprecated\n getTranslation: function () {\n let {\n namespace = 'wt'\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.getTranslation({\n namespace\n }));\n },\n //TODO:deprecated\n getConfig: function () {\n let {\n instanceType = _this.__instanceType,\n domain = location.hostname\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.getConfig({\n instanceType,\n domain\n }));\n },\n //TODO:deprecated\n getIntegrationPublic: function (type) {\n let data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.integrationPublic({\n type\n }, {\n requestBody: { ...data\n }\n }));\n },\n //TODO:deprecated\n updateConfig: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.wt.updateConfig({\n id: data.instanceType || _this.__instanceType\n }, {\n requestBody: { ...data\n }\n }));\n },\n //TODO:deprecated\n admin: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.wt.admin({}, {\n requestBody: {\n instanceType: _this.__instanceType,\n ...data\n }\n }));\n },\n //TODO:deprecated\n analytics: function () {\n let {\n action,\n startKey = null,\n limit = 20\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let apiParams = {\n action,\n limit,\n ...(startKey && {\n startKey\n })\n };\n return _this.__privates.auth.__client.then(client => client.apis.wt.analytics({}, {\n requestBody: {\n instanceType: _this.__instanceType,\n ...apiParams\n }\n }));\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (user);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/models/user.js?");
|
|
9203
9248
|
|
|
9204
9249
|
/***/ }),
|
|
9205
9250
|
|
|
@@ -9223,7 +9268,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n\n\n/* harmony default export
|
|
|
9223
9268
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9224
9269
|
|
|
9225
9270
|
"use strict";
|
|
9226
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../wt-utils */ \"./src/modules/wt-utils.js\");\n\n\nconst syncVodDashJs = function () {\n let {\n room,\n wt,\n roomSession,\n emitter\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n //SYNC VARS\n let _libraryInstance = null;\n let _videoElement = null;\n let _roomId = null;\n let _syncDisabled = false;\n const syncDefaultWaitTime = 60000;\n const syncShortWaitTime = 10000;\n const maxSyncThreshold = 0.5;\n const maxSyncTries = 3;\n let currentSyncRetry = 0;\n let syncWaitId = null;\n let syncNextWaitTime = null;\n let stopFlag = false;\n let isSyncing = false;\n let seekingDebounceId = null;\n let seekingDebounceTimeout = 300;\n let isPlaying = false;\n let isProgrammaticallySeeked = false;\n let isForcedMaster = false;\n\n const startSyncLoop = () => {\n if (_syncDisabled) {\n room._log('--- Sync loop will not start due to sync force disabled ---');\n\n return;\n }\n\n if (!isConnected()) {\n room._log('--- Sync loop will not start due to user not connected yet ---');\n\n return;\n }\n\n if (syncWaitId) {\n room._log('--- Sync loop already running ---');\n\n return;\n }\n\n room._log('--- Sync enabled ---');\n\n stopFlag = false;\n\n const loop = () => {\n isSyncing = true;\n emitter.emit('playerSyncing', true);\n sync().finally(() => {\n isSyncing = false;\n emitter.emit('playerSyncing', false);\n\n if (isConnected() && !stopFlag) {\n syncWaitId = setTimeout(loop, syncNextWaitTime);\n } else {\n room._log('--- Automatic stop due to user not connected or stop flag enabled ---');\n\n stopSyncLoop();\n }\n });\n };\n\n loop();\n };\n\n const stopSyncLoop = () => {\n room._log('--- Sync disabled ---');\n\n clearTimeout(syncWaitId);\n syncWaitId = null;\n currentSyncRetry = 0;\n stopFlag = true;\n };\n\n const restartSyncLoop = () => {\n room._log('--- Sync restarting ---');\n\n stopSyncLoop();\n startSyncLoop();\n };\n\n const setNextWaitTime = function () {\n let didSyncFail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (!didSyncFail) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n currentSyncRetry++;\n\n if (currentSyncRetry > maxSyncTries) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n syncNextWaitTime = syncShortWaitTime;\n }\n }\n\n room._log('--- Next sync will occur in ' + syncNextWaitTime / 1000 + ' seconds ---');\n };\n\n const sync = () => {\n return getSyncData().then(syncData => {\n if (syncData.isMaster || stopFlag) {\n setNextWaitTime(false);\n return Promise.resolve();\n } else if (isForcedMaster) {\n setNextWaitTime(false);\n return propagateMasterFunc();\n } else {\n const syncStartTime = Date.now();\n const {\n position,\n isBufferSufficient\n } = calculateSyncDifferenceTime(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping);\n const currentPosition = getCurrentSegmentPosition() / 1000;\n\n if (syncData.masterFragmentSn) {\n playMedia();\n } else {\n pauseMedia();\n }\n\n if (position && Math.abs(position - currentPosition) <= maxSyncThreshold) {\n room._log(\"We're within max sync threshold, no need to resync now\");\n\n setNextWaitTime(false);\n return Promise.resolve();\n }\n\n if (position !== null) {\n return seekTo(position).then(() => {\n const seekDuration = (Date.now() - syncStartTime) / 1000;\n const syncPrecision = Math.abs(position + (isPlaying ? seekDuration : 0) - getCurrentSegmentPosition() / 1000);\n\n room._log(\"Insufficient buffer: \", !isBufferSufficient);\n\n room._log(\"Seek duration is \".concat(seekDuration));\n\n room._log(\"Sync precision should be \".concat(syncPrecision));\n\n const didSyncFail = syncPrecision > maxSyncThreshold;\n setNextWaitTime(didSyncFail);\n return Promise.resolve();\n }).catch(e => {\n setNextWaitTime(true);\n return Promise.reject(e);\n });\n } else {\n setNextWaitTime(true);\n return Promise.reject();\n }\n }\n }).catch(() => {\n setNextWaitTime(true);\n });\n };\n\n const handleAddLocalParticipant = () => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n\n if (_videoElement) {\n //TODO: shit fix ... data channel with other participant is not opened yet so we wait\n setTimeout(() => {\n restartSyncLoop();\n }, 1000);\n }\n };\n\n const handleAddRemoteParticipant = () => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n };\n\n const handleRemoveRemoteParticipant = () => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n };\n\n const isConnected = () => {\n return room._isDataChannelOpen && room.isConnected;\n };\n\n const buffering = event => {\n if (event.mediaType === 'video' || event.mediaType === 'audio') {\n if (event.state === 'bufferStalled') {\n handleStalledWaiting();\n }\n }\n };\n\n const executePlayerIotEvents = data => {\n let rid = _roomId || room.roomId;\n\n if (data.attributeName === 'playerReplay' && (!rid || (data === null || data === void 0 ? void 0 : data.roomId) === rid)) {\n seekTo(0).then(() => playMedia());\n }\n\n if (data.attributeName === 'playerPlay' && (!rid || (data === null || data === void 0 ? void 0 : data.roomId) === rid)) {\n playMedia();\n }\n\n if (data.attributeName === 'playerPause' && (!rid || (data === null || data === void 0 ? void 0 : data.roomId) === rid)) {\n pauseMedia();\n }\n };\n\n const parseIotEvents = data => {\n if (data.event === 'template_updated') {\n if (data.operation === 'multi') {\n (data.value || []).forEach(event => {\n if (event.operation === 'sendMessage') {\n executePlayerIotEvents({ ...event,\n roomId: data.roomId,\n userId: data.userId\n });\n }\n });\n }\n\n if (data.operation === 'sendMessage') {\n executePlayerIotEvents(data);\n }\n }\n };\n\n const parseDataEvents = function () {\n let msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (msg.videoroom === 'sync_source_set' && msg.wt_channel_id != \"\") {\n emitter.emit('changePlayerSource', msg.wt_channel_id);\n } else if (msg.videoroom === 'sync_request') {\n roomSyncSend(msg.sync_slave_id).catch(() => {});\n } else if (msg.videoroom === 'message') {\n // ignoring non studio commands if master\n if (isForcedMaster && msg.from !== null) {\n return;\n }\n\n if (_syncDisabled) {\n return;\n }\n\n if (msg.user_action === 'sync_seeking') {\n seekMedia(msg).catch(() => {});\n } else if (msg.user_action === 'sync_seeked') {} else if (msg.user_action === 'sync_play' || msg.action === 'sync_play') {\n playMedia();\n } else if (msg.user_action === 'sync_pause' || msg.action === 'sync_pause') {\n pauseMedia();\n }\n }\n };\n\n const getCurrentSegmentPosition = () => {\n let position = _videoElement && _videoElement.currentTime;\n return isNaN(position) ? 0 : position * 1000;\n };\n\n const calculateSyncDifferenceTime = function (fragmentSn) {\n let fragmentPos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n let ping = arguments.length > 2 ? arguments[2] : undefined;\n return {\n position: (fragmentPos + ping / 2) / 1000,\n isBufferSufficient: true\n };\n };\n\n const seekMedia = msg => {\n msg = {\n userId: msg.from,\n ...(msg.text && JSON.parse(msg.text))\n };\n\n if (msg.handleId !== room.handleId) {\n const {\n position,\n isBufferSufficient\n } = calculateSyncDifferenceTime(msg.fragment, msg.fragment_pos, 0); //TODO: right ping\n\n if (position) {\n return seekTo(position).then(() => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n });\n } else {\n return Promise.resolve();\n }\n } else {\n return Promise.resolve();\n }\n };\n\n const prePlay = () => {\n if (_videoElement.currentTime > 0 || _videoElement.paused === false) {\n return Promise.resolve();\n }\n\n isProgrammaticallySeeked = true;\n let wasMuted = _videoElement.muted;\n _videoElement.muted = true;\n return _videoElement.play().then(() => {\n _videoElement.pause();\n\n _videoElement.currentTime = 0;\n return Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"wait\"])(100);\n }).catch(() => true).finally(() => {\n _videoElement.muted = wasMuted;\n isProgrammaticallySeeked = false;\n return true;\n });\n };\n\n const playMedia = () => {\n if (_videoElement && _videoElement.paused) {\n isProgrammaticallySeeked = true;\n\n _videoElement.play().finally(() => {\n isProgrammaticallySeeked = false;\n });\n }\n };\n\n const pauseMedia = () => {\n if (_videoElement && !_videoElement.paused) {\n isProgrammaticallySeeked = true;\n\n _videoElement.addEventListener('pause', () => {\n isProgrammaticallySeeked = false;\n }, {\n once: true\n });\n\n _videoElement.pause();\n }\n };\n\n const seekTo = time => {\n return new Promise(resolve => {\n if (_videoElement.currentTime !== time) {\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _videoElement.addEventListener('seeked', () => {\n isProgrammaticallySeeked = false;\n resolve();\n }, {\n once: true\n });\n\n _videoElement.currentTime = time;\n } else resolve();\n });\n };\n\n const handlePlaying = () => {\n if (!isProgrammaticallySeeked) {\n roomSession.sendSystemMessage('sync_play', {\n timestamp: new Date().getTime(),\n handleId: room.handleId\n }, undefined, null).catch(() => {});\n }\n\n isPlaying = !_videoElement.paused;\n };\n\n const handlePause = () => {\n if (!isProgrammaticallySeeked) {\n roomSession.sendSystemMessage('sync_pause', {\n timestamp: new Date().getTime(),\n handleId: room.handleId\n }, undefined, null).catch(() => {});\n }\n\n isPlaying = !_videoElement.paused;\n };\n\n const handleStalledWaiting = () => {\n if (!isProgrammaticallySeeked) {\n clientPaused().catch(() => {});\n }\n };\n\n const handleSeeking = () => {\n clearTimeout(seekingDebounceId);\n\n if (!isProgrammaticallySeeked) {\n seekingDebounceId = setTimeout(() => {\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n roomSession.sendSystemMessage('sync_seeking', {\n timestamp: new Date().getTime(),\n handleId: room.handleId,\n fragment: \"0\",\n //isPlaying ? \"1\":\"0\",\n fragment_pos: Number(fragmentPosition)\n }, undefined, null).catch(() => {});\n\n if (!isForcedMaster && !_syncDisabled) {\n pauseMedia();\n }\n }, seekingDebounceTimeout);\n }\n };\n\n const handleSeeked = () => {};\n\n const handleEnded = () => {};\n\n const roomSyncSend = slaveId => {\n if (!_libraryInstance || !_videoElement) {\n room._log(\"I've been asked for position even if we don't have player attached.\\n Does it mean I'm the master?\");\n\n return Promise.resolve();\n }\n\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n\n room._log(\"Sending my position to \".concat(slaveId));\n\n room._log(\"Current time: \".concat(fragmentPosition));\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_response\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: isPlaying ? \"1\" : \"0\",\n fragment_pos: Number(fragmentPosition),\n slave_id: room.webrtcVersion > 1000 ? String(slaveId) : Number(slaveId)\n }\n });\n };\n\n const getSyncData = () => {\n room._log('Sending roomSync request');\n\n let roomId = room.roomId;\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n return new Promise((resolve, reject) => {\n let now = new Date().getTime();\n let ping = null;\n let sid = setTimeout(() => {\n room.off('data', fn, this);\n reject('Timeout');\n }, 3000);\n let body = {\n request: \"sync\",\n room: roomId,\n timestamp: new Date().getTime(),\n fragment: isPlaying ? \"1\" : \"0\",\n fragment_pos: Number(fragmentPosition)\n };\n\n let fn = msg => {\n if (msg.videoroom && ['sync', 'sync_response'].includes(msg.videoroom)) {\n if (msg.sync_master_await) {\n room._log('Waiting for master position');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n } else if (msg.sync_master_fragment || msg.sync_master_fragment_pos) {\n room._log('Got master position data');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n\n room._log(\"I'm master: \".concat(!!msg.sync_master_self));\n\n room._log(\"Ping: \".concat(ping));\n\n room._log(\"Master fragment: \".concat(msg.sync_master_fragment));\n\n room._log(\"Master fragment position: \".concat(msg.sync_master_fragment_pos));\n\n room.off('data', fn, this);\n clearTimeout(sid);\n resolve({\n isMaster: !!msg.sync_master_self,\n ping: ping,\n masterFragmentPos: parseInt(msg.sync_master_fragment_pos),\n masterFragmentSn: parseInt(msg.sync_master_fragment)\n });\n } else {\n clearTimeout(sid);\n reject('Master lost connection');\n }\n }\n };\n\n room.on('data', fn, this);\n room.sendMessage(room.handleId, {\n body\n }).then(fn).catch(e => {\n room.off('data', fn, this);\n clearTimeout(sid);\n reject(e);\n });\n });\n };\n\n const clientPaused = () => {\n room._log('Sending client paused');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_paused\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: '0',\n fragment_pos: 0\n }\n });\n };\n\n const propagateMasterFunc = () => {\n room._log('Propagating master');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_source_set\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n wt_channel_id: \"\",\n fragment: \"0\",\n fragment_pos: 0\n }\n });\n };\n\n return {\n __events: ['playerSyncing'],\n initialize: function () {\n let {\n dashInstance,\n libraryInstance,\n propagateMaster = false,\n isStudio = false,\n roomId,\n syncDisabled\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _libraryInstance = dashInstance || libraryInstance;\n _videoElement = _libraryInstance.getVideoElement();\n _roomId = roomId;\n _syncDisabled = syncDisabled;\n\n if (!_libraryInstance) {\n console.log('No player instance');\n return;\n }\n\n emitter.emit('playerSyncing', false);\n isForcedMaster = propagateMaster;\n isPlaying = _videoElement.paused === false;\n room.on('disconnect', stopSyncLoop);\n room.on('addLocalParticipant', handleAddLocalParticipant);\n room.on('removeLocalParticipant', stopSyncLoop);\n room.on('addRemoteParticipant', handleAddRemoteParticipant);\n room.on('removeRemoteParticipant', handleRemoveRemoteParticipant);\n room.on('data', parseDataEvents);\n wt.iot.$on('message', parseIotEvents);\n\n if (isForcedMaster) {\n propagateMasterFunc().catch(() => {});\n }\n\n if (_libraryInstance && _videoElement) {\n (propagateMaster || isStudio ? Promise.resolve() : prePlay()).then(() => {\n _libraryInstance.on('bufferStateChanged', buffering);\n\n _videoElement.addEventListener('playing', handlePlaying);\n\n _videoElement.addEventListener('pause', handlePause);\n\n _videoElement.addEventListener('seeking', handleSeeking);\n\n _videoElement.addEventListener('seeked', handleSeeked);\n\n _videoElement.addEventListener('ended', handleEnded);\n\n startSyncLoop();\n });\n }\n },\n destroy: () => {\n stopSyncLoop();\n room.off('disconnect', stopSyncLoop);\n room.off('addLocalParticipant', handleAddLocalParticipant);\n room.off('removeLocalParticipant', stopSyncLoop);\n room.off('addRemoteParticipant', handleAddRemoteParticipant);\n room.off('removeRemoteParticipant', handleRemoveRemoteParticipant);\n room.off('data', parseDataEvents);\n wt.iot.$off('message', parseIotEvents);\n\n if (_libraryInstance) {\n _libraryInstance.off('bufferStateChanged', buffering);\n }\n\n if (_videoElement) {\n _videoElement.removeEventListener('playing', handlePlaying);\n\n _videoElement.removeEventListener('pause', handlePause);\n\n _videoElement.removeEventListener('seeking', handleSeeking);\n\n _videoElement.removeEventListener('seeked', handleSeeked);\n\n _videoElement.removeEventListener('ended', handleEnded);\n }\n\n _libraryInstance = null;\n _videoElement = null;\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (syncVodDashJs);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/sync-modules/sync-dash-vod.js?");
|
|
9271
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../wt-utils */ \"./src/modules/wt-utils.js\");\n\n\nconst syncVodDashJs = function () {\n let {\n room,\n wt,\n roomSession,\n emitter\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n //SYNC VARS\n let _libraryInstance = null;\n let _videoElement = null;\n let _roomId = null;\n let _syncDisabled = false;\n const syncDefaultWaitTime = 60000;\n const syncShortWaitTime = 10000;\n const maxSyncThreshold = 0.5;\n const maxSyncTries = 3;\n let currentSyncRetry = 0;\n let syncWaitId = null;\n let syncNextWaitTime = null;\n let stopFlag = false;\n let isSyncing = false;\n let seekingDebounceId = null;\n let seekingDebounceTimeout = 300;\n let isPlaying = false;\n let isProgrammaticallySeeked = false;\n let isForcedMaster = false;\n\n const startSyncLoop = () => {\n if (_syncDisabled) {\n room._log('--- Sync loop will not start due to sync force disabled ---');\n\n return;\n }\n\n if (!isConnected()) {\n room._log('--- Sync loop will not start due to user not connected yet ---');\n\n return;\n }\n\n if (syncWaitId) {\n room._log('--- Sync loop already running ---');\n\n return;\n }\n\n room._log('--- Sync enabled ---');\n\n stopFlag = false;\n\n const loop = () => {\n isSyncing = true;\n emitter.emit('playerSyncing', true);\n sync().finally(() => {\n isSyncing = false;\n emitter.emit('playerSyncing', false);\n\n if (isConnected() && !stopFlag) {\n syncWaitId = setTimeout(loop, syncNextWaitTime);\n } else {\n room._log('--- Automatic stop due to user not connected or stop flag enabled ---');\n\n stopSyncLoop();\n }\n });\n };\n\n loop();\n };\n\n const stopSyncLoop = () => {\n room._log('--- Sync disabled ---');\n\n clearTimeout(syncWaitId);\n syncWaitId = null;\n currentSyncRetry = 0;\n stopFlag = true;\n };\n\n const restartSyncLoop = () => {\n room._log('--- Sync restarting ---');\n\n stopSyncLoop();\n startSyncLoop();\n };\n\n const setNextWaitTime = function () {\n let didSyncFail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (!didSyncFail) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n currentSyncRetry++;\n\n if (currentSyncRetry > maxSyncTries) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n syncNextWaitTime = syncShortWaitTime;\n }\n }\n\n room._log('--- Next sync will occur in ' + syncNextWaitTime / 1000 + ' seconds ---');\n };\n\n const sync = () => {\n return getSyncData().then(syncData => {\n if (syncData.isMaster || stopFlag) {\n setNextWaitTime(false);\n return Promise.resolve();\n } else if (isForcedMaster) {\n setNextWaitTime(false);\n return propagateMasterFunc();\n } else {\n const syncStartTime = Date.now();\n const {\n position,\n isBufferSufficient\n } = calculateSyncDifferenceTime(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping);\n const currentPosition = getCurrentSegmentPosition() / 1000;\n\n if (syncData.masterFragmentSn) {\n playMedia();\n } else {\n pauseMedia();\n }\n\n if (position && Math.abs(position - currentPosition) <= maxSyncThreshold) {\n room._log(`We're within max sync threshold, no need to resync now`);\n\n setNextWaitTime(false);\n return Promise.resolve();\n }\n\n if (position !== null) {\n return seekTo(position).then(() => {\n const seekDuration = (Date.now() - syncStartTime) / 1000;\n const syncPrecision = Math.abs(position + (isPlaying ? seekDuration : 0) - getCurrentSegmentPosition() / 1000);\n\n room._log(`Insufficient buffer: `, !isBufferSufficient);\n\n room._log(`Seek duration is ${seekDuration}`);\n\n room._log(`Sync precision should be ${syncPrecision}`);\n\n const didSyncFail = syncPrecision > maxSyncThreshold;\n setNextWaitTime(didSyncFail);\n return Promise.resolve();\n }).catch(e => {\n setNextWaitTime(true);\n return Promise.reject(e);\n });\n } else {\n setNextWaitTime(true);\n return Promise.reject();\n }\n }\n }).catch(() => {\n setNextWaitTime(true);\n });\n };\n\n const handleAddLocalParticipant = () => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n\n if (_videoElement) {\n //TODO: shit fix ... data channel with other participant is not opened yet so we wait\n setTimeout(() => {\n restartSyncLoop();\n }, 1000);\n }\n };\n\n const handleAddRemoteParticipant = () => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n };\n\n const handleRemoveRemoteParticipant = () => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n };\n\n const isConnected = () => {\n return room._isDataChannelOpen && room.isConnected;\n };\n\n const buffering = event => {\n if (event.mediaType === 'video' || event.mediaType === 'audio') {\n if (event.state === 'bufferStalled') {\n handleStalledWaiting();\n }\n }\n };\n\n const executePlayerIotEvents = data => {\n let rid = _roomId || room.roomId;\n\n if (data.attributeName === 'playerReplay' && (!rid || (data === null || data === void 0 ? void 0 : data.roomId) === rid)) {\n seekTo(0).then(() => playMedia());\n }\n\n if (data.attributeName === 'playerPlay' && (!rid || (data === null || data === void 0 ? void 0 : data.roomId) === rid)) {\n playMedia();\n }\n\n if (data.attributeName === 'playerPause' && (!rid || (data === null || data === void 0 ? void 0 : data.roomId) === rid)) {\n pauseMedia();\n }\n };\n\n const parseIotEvents = data => {\n if (data.event === 'template_updated') {\n if (data.operation === 'multi') {\n (data.value || []).forEach(event => {\n if (event.operation === 'sendMessage') {\n executePlayerIotEvents({ ...event,\n roomId: data.roomId,\n userId: data.userId\n });\n }\n });\n }\n\n if (data.operation === 'sendMessage') {\n executePlayerIotEvents(data);\n }\n }\n };\n\n const parseDataEvents = function () {\n let msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (msg.videoroom === 'sync_source_set' && msg.wt_channel_id != \"\") {\n emitter.emit('changePlayerSource', msg.wt_channel_id);\n } else if (msg.videoroom === 'sync_request') {\n roomSyncSend(msg.sync_slave_id).catch(() => {});\n } else if (msg.videoroom === 'message') {\n // ignoring non studio commands if master\n if (isForcedMaster && msg.from !== null) {\n return;\n }\n\n if (_syncDisabled) {\n return;\n }\n\n if (msg.user_action === 'sync_seeking') {\n seekMedia(msg).catch(() => {});\n } else if (msg.user_action === 'sync_seeked') {} else if (msg.user_action === 'sync_play' || msg.action === 'sync_play') {\n playMedia();\n } else if (msg.user_action === 'sync_pause' || msg.action === 'sync_pause') {\n pauseMedia();\n }\n }\n };\n\n const getCurrentSegmentPosition = () => {\n let position = _videoElement && _videoElement.currentTime;\n return isNaN(position) ? 0 : position * 1000;\n };\n\n const calculateSyncDifferenceTime = function (fragmentSn) {\n let fragmentPos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n let ping = arguments.length > 2 ? arguments[2] : undefined;\n return {\n position: (fragmentPos + ping / 2) / 1000,\n isBufferSufficient: true\n };\n };\n\n const seekMedia = msg => {\n msg = {\n userId: msg.from,\n ...(msg.text && JSON.parse(msg.text))\n };\n\n if (msg.handleId !== room.handleId) {\n const {\n position,\n isBufferSufficient\n } = calculateSyncDifferenceTime(msg.fragment, msg.fragment_pos, 0); //TODO: right ping\n\n if (position) {\n return seekTo(position).then(() => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n });\n } else {\n return Promise.resolve();\n }\n } else {\n return Promise.resolve();\n }\n };\n\n const prePlay = () => {\n if (_videoElement.currentTime > 0 || _videoElement.paused === false) {\n return Promise.resolve();\n }\n\n isProgrammaticallySeeked = true;\n let wasMuted = _videoElement.muted;\n _videoElement.muted = true;\n return _videoElement.play().then(() => {\n _videoElement.pause();\n\n _videoElement.currentTime = 0;\n return Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"wait\"])(100);\n }).catch(() => true).finally(() => {\n _videoElement.muted = wasMuted;\n isProgrammaticallySeeked = false;\n return true;\n });\n };\n\n const playMedia = () => {\n if (_videoElement && _videoElement.paused) {\n isProgrammaticallySeeked = true;\n\n _videoElement.play().finally(() => {\n isProgrammaticallySeeked = false;\n });\n }\n };\n\n const pauseMedia = () => {\n if (_videoElement && !_videoElement.paused) {\n isProgrammaticallySeeked = true;\n\n _videoElement.addEventListener('pause', () => {\n isProgrammaticallySeeked = false;\n }, {\n once: true\n });\n\n _videoElement.pause();\n }\n };\n\n const seekTo = time => {\n return new Promise(resolve => {\n if (_videoElement.currentTime !== time) {\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _videoElement.addEventListener('seeked', () => {\n isProgrammaticallySeeked = false;\n resolve();\n }, {\n once: true\n });\n\n _videoElement.currentTime = time;\n } else resolve();\n });\n };\n\n const handlePlaying = () => {\n if (!isProgrammaticallySeeked) {\n roomSession.sendSystemMessage('sync_play', {\n timestamp: new Date().getTime(),\n handleId: room.handleId\n }, undefined, null).catch(() => {});\n }\n\n isPlaying = !_videoElement.paused;\n };\n\n const handlePause = () => {\n if (!isProgrammaticallySeeked) {\n roomSession.sendSystemMessage('sync_pause', {\n timestamp: new Date().getTime(),\n handleId: room.handleId\n }, undefined, null).catch(() => {});\n }\n\n isPlaying = !_videoElement.paused;\n };\n\n const handleStalledWaiting = () => {\n if (!isProgrammaticallySeeked) {\n clientPaused().catch(() => {});\n }\n };\n\n const handleSeeking = () => {\n clearTimeout(seekingDebounceId);\n\n if (!isProgrammaticallySeeked) {\n seekingDebounceId = setTimeout(() => {\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n roomSession.sendSystemMessage('sync_seeking', {\n timestamp: new Date().getTime(),\n handleId: room.handleId,\n fragment: \"0\",\n //isPlaying ? \"1\":\"0\",\n fragment_pos: Number(fragmentPosition)\n }, undefined, null).catch(() => {});\n\n if (!isForcedMaster && !_syncDisabled) {\n pauseMedia();\n }\n }, seekingDebounceTimeout);\n }\n };\n\n const handleSeeked = () => {};\n\n const handleEnded = () => {};\n\n const roomSyncSend = slaveId => {\n if (!_libraryInstance || !_videoElement) {\n room._log(`I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?`);\n\n return Promise.resolve();\n }\n\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n\n room._log(`Sending my position to ${slaveId}`);\n\n room._log(`Current time: ${fragmentPosition}`);\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_response\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: isPlaying ? \"1\" : \"0\",\n fragment_pos: Number(fragmentPosition),\n slave_id: room.webrtcVersion > 1000 ? String(slaveId) : Number(slaveId)\n }\n });\n };\n\n const getSyncData = () => {\n room._log('Sending roomSync request');\n\n let roomId = room.roomId;\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n return new Promise((resolve, reject) => {\n let now = new Date().getTime();\n let ping = null;\n let sid = setTimeout(() => {\n room.off('data', fn, this);\n reject('Timeout');\n }, 3000);\n let body = {\n request: \"sync\",\n room: roomId,\n timestamp: new Date().getTime(),\n fragment: isPlaying ? \"1\" : \"0\",\n fragment_pos: Number(fragmentPosition)\n };\n\n let fn = msg => {\n if (msg.videoroom && ['sync', 'sync_response'].includes(msg.videoroom)) {\n if (msg.sync_master_await) {\n room._log('Waiting for master position');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n } else if (msg.sync_master_fragment || msg.sync_master_fragment_pos) {\n room._log('Got master position data');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n\n room._log(`I'm master: ${!!msg.sync_master_self}`);\n\n room._log(`Ping: ${ping}`);\n\n room._log(`Master fragment: ${msg.sync_master_fragment}`);\n\n room._log(`Master fragment position: ${msg.sync_master_fragment_pos}`);\n\n room.off('data', fn, this);\n clearTimeout(sid);\n resolve({\n isMaster: !!msg.sync_master_self,\n ping: ping,\n masterFragmentPos: parseInt(msg.sync_master_fragment_pos),\n masterFragmentSn: parseInt(msg.sync_master_fragment)\n });\n } else {\n clearTimeout(sid);\n reject('Master lost connection');\n }\n }\n };\n\n room.on('data', fn, this);\n room.sendMessage(room.handleId, {\n body\n }).then(fn).catch(e => {\n room.off('data', fn, this);\n clearTimeout(sid);\n reject(e);\n });\n });\n };\n\n const clientPaused = () => {\n room._log('Sending client paused');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_paused\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: '0',\n fragment_pos: 0\n }\n });\n };\n\n const propagateMasterFunc = () => {\n room._log('Propagating master');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_source_set\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n wt_channel_id: \"\",\n fragment: \"0\",\n fragment_pos: 0\n }\n });\n };\n\n return {\n __events: ['playerSyncing'],\n initialize: function () {\n let {\n dashInstance,\n libraryInstance,\n propagateMaster = false,\n isStudio = false,\n roomId,\n syncDisabled\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _libraryInstance = dashInstance || libraryInstance;\n _videoElement = _libraryInstance.getVideoElement();\n _roomId = roomId;\n _syncDisabled = syncDisabled;\n\n if (!_libraryInstance) {\n console.log('No player instance');\n return;\n }\n\n emitter.emit('playerSyncing', false);\n isForcedMaster = propagateMaster;\n isPlaying = _videoElement.paused === false;\n room.on('disconnect', stopSyncLoop);\n room.on('addLocalParticipant', handleAddLocalParticipant);\n room.on('removeLocalParticipant', stopSyncLoop);\n room.on('addRemoteParticipant', handleAddRemoteParticipant);\n room.on('removeRemoteParticipant', handleRemoveRemoteParticipant);\n room.on('data', parseDataEvents);\n wt.iot.$on('message', parseIotEvents);\n\n if (isForcedMaster) {\n propagateMasterFunc().catch(() => {});\n }\n\n if (_libraryInstance && _videoElement) {\n (propagateMaster || isStudio ? Promise.resolve() : prePlay()).then(() => {\n _libraryInstance.on('bufferStateChanged', buffering);\n\n _videoElement.addEventListener('playing', handlePlaying);\n\n _videoElement.addEventListener('pause', handlePause);\n\n _videoElement.addEventListener('seeking', handleSeeking);\n\n _videoElement.addEventListener('seeked', handleSeeked);\n\n _videoElement.addEventListener('ended', handleEnded);\n\n startSyncLoop();\n });\n }\n },\n destroy: () => {\n stopSyncLoop();\n room.off('disconnect', stopSyncLoop);\n room.off('addLocalParticipant', handleAddLocalParticipant);\n room.off('removeLocalParticipant', stopSyncLoop);\n room.off('addRemoteParticipant', handleAddRemoteParticipant);\n room.off('removeRemoteParticipant', handleRemoveRemoteParticipant);\n room.off('data', parseDataEvents);\n wt.iot.$off('message', parseIotEvents);\n\n if (_libraryInstance) {\n _libraryInstance.off('bufferStateChanged', buffering);\n }\n\n if (_videoElement) {\n _videoElement.removeEventListener('playing', handlePlaying);\n\n _videoElement.removeEventListener('pause', handlePause);\n\n _videoElement.removeEventListener('seeking', handleSeeking);\n\n _videoElement.removeEventListener('seeked', handleSeeked);\n\n _videoElement.removeEventListener('ended', handleEnded);\n }\n\n _libraryInstance = null;\n _videoElement = null;\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (syncVodDashJs);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/sync-modules/sync-dash-vod.js?");
|
|
9227
9272
|
|
|
9228
9273
|
/***/ }),
|
|
9229
9274
|
|
|
@@ -9235,7 +9280,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_
|
|
|
9235
9280
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9236
9281
|
|
|
9237
9282
|
"use strict";
|
|
9238
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../wt-utils */ \"./src/modules/wt-utils.js\");\n\n\nconst syncDashJs = function () {\n let {\n room,\n wt,\n roomSession,\n emitter\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n //SYNC VARS\n let _libraryInstance = null;\n let _videoElement = null;\n const syncDefaultWaitTime = 60000;\n const syncShortWaitTime = 10000;\n const maxSyncThreshold = 0.5;\n const maxSyncTries = 3;\n let currentSyncRetry = 0;\n let syncWaitId = null;\n let syncNextWaitTime = null;\n let stopFlag = false;\n let isSyncing = false;\n let playbackRate = 2;\n let isPlaying = false;\n let isPreloading = true;\n let isProgrammaticallySeeked = false;\n let shouldPropagateMaster = false;\n\n const startSyncLoop = () => {\n if (!isConnected()) {\n room._log('--- Sync loop will not start due to user not connected yet ---');\n\n return;\n }\n\n if (syncWaitId) {\n room._log('--- Sync loop already running ---');\n\n return;\n }\n\n room._log('--- Sync enabled ---');\n\n stopFlag = false;\n\n const loop = () => {\n isSyncing = true;\n emitter.emit('playerSyncing', true);\n sync().finally(() => {\n isSyncing = false;\n emitter.emit('playerSyncing', false);\n\n if (isConnected() && !stopFlag) {\n syncWaitId = setTimeout(loop, syncNextWaitTime);\n } else {\n room._log('--- Automatic stop due to user not connected or stop flag enabled ---');\n\n stopSyncLoop();\n }\n });\n };\n\n loop();\n };\n\n const stopSyncLoop = () => {\n room._log('--- Sync disabled ---');\n\n clearTimeout(syncWaitId);\n syncWaitId = null;\n currentSyncRetry = 0;\n stopFlag = true;\n };\n\n const restartSyncLoop = () => {\n room._log('--- Sync restarting ---');\n\n stopSyncLoop();\n startSyncLoop();\n };\n\n const setNextWaitTime = function () {\n let didSyncFail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (!didSyncFail) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n currentSyncRetry++;\n\n if (currentSyncRetry > maxSyncTries) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n syncNextWaitTime = syncShortWaitTime;\n }\n }\n\n room._log('--- Next sync will occur in ' + syncNextWaitTime / 1000 + ' seconds ---');\n };\n\n const sync = () => {\n return getSyncData().then(syncData => {\n if (syncData.isMaster) {\n if (_videoElement.paused) _videoElement.play();\n setNextWaitTime(false);\n return Promise.resolve();\n } else if (shouldPropagateMaster) {\n setNextWaitTime(false);\n return propagateMasterFunc();\n } else {\n const syncStartTime = Date.now();\n const {\n position,\n realPosition,\n isBufferSufficient\n } = calculateSyncDifferenceTime(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping);\n const currentPosition = getCurrentSegmentPosition() / 1000;\n\n if (position && Math.abs(position - currentPosition) <= maxSyncThreshold) {\n room._log(\"We're within max sync threshold, no need to resync now\");\n\n setNextWaitTime(false);\n return Promise.resolve();\n }\n\n if (position !== null) {\n return seekTo(position).then(() => {\n const seekDuration = (Date.now() - syncStartTime) / 1000;\n const syncPrecision = Math.abs(realPosition + seekDuration - getCurrentSegmentPosition() / 1000);\n\n room._log(\"Insufficient buffer: \", !isBufferSufficient);\n\n room._log(\"Seek duration is \".concat(seekDuration));\n\n room._log(\"Sync precision should be \".concat(syncPrecision));\n\n const didSyncFail = syncPrecision > maxSyncThreshold;\n setNextWaitTime(didSyncFail);\n return Promise.resolve();\n }).catch(e => {\n setNextWaitTime(true);\n return Promise.reject(e);\n });\n } else {\n setNextWaitTime(true);\n return Promise.reject();\n }\n }\n }).catch(() => {\n setNextWaitTime(true);\n return Promise.reject();\n });\n };\n\n const handleAddLocalParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n\n if (_videoElement && _videoElement.paused === false) {\n _videoElement.addEventListener('progress', () => {\n restartSyncLoop();\n }, {\n once: true\n });\n }\n };\n\n const handleAddRemoteParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n };\n\n const isConnected = () => {\n return room._isDataChannelOpen && room.isConnected;\n };\n\n const buffering = event => {\n if (event.mediaType === 'video' || event.mediaType === 'audio') {\n if (event.state === 'bufferStalled') {\n handleStalledWaiting();\n }\n }\n };\n\n const parseDataEvents = function () {\n let msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (msg.videoroom === 'sync_source_set' && msg.wt_channel_id != \"\") {\n emitter.emit('changePlayerSource', msg.wt_channel_id);\n } else if (msg.videoroom === 'sync_request') {\n roomSyncSend(msg.sync_slave_id).catch(() => {});\n }\n };\n\n const getCurrentSegmentPosition = () => {\n let position = _videoElement && _videoElement.currentTime;\n return isNaN(position) ? 0 : position * 1000;\n };\n\n const calculateSyncDifferenceTime = (fragmentSn, fragmentPos, ping) => {\n let seekRanges = _videoElement.buffered;\n let seekRange = {};\n\n for (let i = 0; i < seekRanges.length; i++) {\n let _c_start = seekRanges.start(i);\n\n let _c_end = seekRanges.end(i);\n\n if (!seekRange.start || _c_start < seekRange.start) {\n seekRange.start = _c_start;\n }\n\n if (!seekRange.end || _c_end > seekRange.end) {\n seekRange.end = _c_end;\n }\n }\n\n let position = (fragmentPos + ping / 2) / 1000;\n\n if (position > seekRange.start && position < seekRange.end) {\n return {\n position,\n realPosition: position,\n isBufferSufficient: true\n };\n } else if (position < seekRange.start) {\n room._log(\"Syncing to \".concat(seekRange.start, \" instead of \").concat(position, \" due to lack of buffered data\"));\n\n return {\n position: seekRange.start + 0.5,\n realPosition: position,\n isBufferSufficient: false\n };\n } else if (position > seekRange.end) {\n room._log(\"Syncing to \".concat(seekRange.end, \" instead of \").concat(position, \" due to lack of buffered data\"));\n\n return {\n position: seekRange.end - 0.5,\n realPosition: position,\n isBufferSufficient: false\n };\n } else return {\n position: null,\n realPosition: position,\n isBufferSufficient: false\n };\n };\n\n const seekTo = time => {\n return new Promise((resolve, reject) => {\n if (_videoElement.currentTime !== time) {\n let diff = time - _videoElement.currentTime;\n\n if (_videoElement.currentTime < time && diff < 4) {\n room._log(\"Fast forward to seek...\");\n\n let wasPaused = false;\n\n let __ = () => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false;\n reject('Stalled');\n }; // _videoElement.addEventListener('waiting', __, {once:true});\n\n\n _videoElement.addEventListener('stalled', __, {\n once: true\n });\n\n Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"setExactTimeout\"])(() => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false; // _videoElement.removeEventListener('waiting', __, {once:true});\n\n _videoElement.removeEventListener('stalled', __, {\n once: true\n });\n\n resolve();\n }, diff * 1000 / (playbackRate - 1), 20);\n isProgrammaticallySeeked = true;\n\n if (_videoElement.paused) {\n wasPaused = true;\n\n _videoElement.play().then(() => {\n _videoElement.playbackRate = playbackRate;\n });\n } else {\n _videoElement.playbackRate = playbackRate;\n }\n } else {\n room._log(\"Jump to seek...\");\n\n let __ = Date.now();\n\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _videoElement.addEventListener('playing', () => {\n room._log(\"It took the player \".concat((Date.now() - __) / 1000, \" seconds to seek \"));\n\n isProgrammaticallySeeked = false;\n resolve();\n }, {\n once: true\n });\n\n _videoElement.currentTime = time;\n }\n } else resolve();\n });\n };\n\n const handlePlaying = () => {\n if (!isProgrammaticallySeeked) {\n room._log('Handle playing');\n\n startSyncLoop();\n }\n\n isProgrammaticallySeeked = false;\n isPreloading = _videoElement.paused;\n isPlaying = !_videoElement.paused;\n };\n\n const handlePause = () => {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPlaying = !_videoElement.paused;\n };\n\n const handleStalledWaiting = () => {\n room._log('handleStalledWaiting');\n\n if (!isProgrammaticallySeeked) {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPreloading = _videoElement.paused;\n }\n };\n\n const roomSyncSend = slaveId => {\n if (!_libraryInstance || !_videoElement) {\n room._log(\"I've been asked for position even if we don't have player attached.\\n Does it mean I'm the master?\");\n\n return Promise.resolve();\n }\n\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n\n room._log(\"Sending my position to \".concat(slaveId));\n\n room._log(\"Current time: \".concat(fragmentPosition));\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_response\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: String(\"0\"),\n fragment_pos: Number(fragmentPosition),\n slave_id: room.webrtcVersion > 1000 ? String(slaveId) : Number(slaveId)\n }\n });\n };\n\n const getSyncData = () => {\n room._log('Sending roomSync request');\n\n let roomId = room.roomId;\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n return new Promise((resolve, reject) => {\n let now = new Date().getTime();\n let ping = null;\n let sid = setTimeout(() => {\n room.off('data', fn, this);\n reject('Timeout');\n }, 3000);\n let body = {\n request: \"sync\",\n room: roomId,\n timestamp: new Date().getTime(),\n fragment: String(\"0\"),\n fragment_pos: Number(fragmentPosition)\n };\n\n let fn = msg => {\n if (msg.videoroom && ['sync', 'sync_response'].includes(msg.videoroom)) {\n if (msg.sync_master_await) {\n room._log('Waiting for master position');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n } else if (msg.sync_master_fragment || msg.sync_master_fragment_pos) {\n room._log('Got master position data');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n\n room._log(\"I'm master: \".concat(!!msg.sync_master_self));\n\n room._log(\"Ping: \".concat(ping));\n\n room._log(\"Master fragment: \".concat(msg.sync_master_fragment));\n\n room._log(\"Master fragment position: \".concat(msg.sync_master_fragment_pos));\n\n room.off('data', fn, this);\n clearTimeout(sid);\n resolve({\n isMaster: !!msg.sync_master_self,\n ping: ping,\n masterFragmentPos: parseInt(msg.sync_master_fragment_pos),\n masterFragmentSn: parseInt(msg.sync_master_fragment)\n });\n } else {\n clearTimeout(sid);\n reject('Master lost connection');\n }\n }\n };\n\n room.on('data', fn, this);\n room.sendMessage(room.handleId, {\n body\n }).then(fn).catch(e => {\n room.off('data', fn, this);\n clearTimeout(sid);\n reject(e);\n });\n });\n };\n\n const clientPaused = () => {\n room._log('Sending client paused');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_paused\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: '0',\n fragment_pos: 0\n }\n });\n };\n\n const propagateMasterFunc = () => {\n room._log('Propagating master');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_source_set\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n wt_channel_id: \"\",\n fragment: \"0\",\n fragment_pos: 0\n }\n });\n };\n\n return {\n __events: ['playerSyncing'],\n initialize: function () {\n let {\n dashInstance,\n libraryInstance,\n propagateMaster = false\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _libraryInstance = dashInstance || libraryInstance; // backwards comp;\n\n _videoElement = _libraryInstance.getVideoElement();\n\n if (!_libraryInstance) {\n room._log('No dash player instance!');\n\n return;\n }\n\n shouldPropagateMaster = propagateMaster;\n isPlaying = _videoElement.paused === false;\n room.on('disconnect', stopSyncLoop);\n room.on('removeLocalParticipant', stopSyncLoop);\n room.on('addLocalParticipant', handleAddLocalParticipant);\n room.on('addRemoteParticipant', handleAddRemoteParticipant);\n room.on('data', parseDataEvents);\n\n if (shouldPropagateMaster) {\n propagateMasterFunc().catch(() => {});\n }\n\n if (_videoElement && _videoElement.paused === false) {\n _videoElement.addEventListener('progress', () => {\n restartSyncLoop();\n }, {\n once: true\n });\n }\n\n _libraryInstance.on('bufferStateChanged', buffering);\n\n _videoElement.addEventListener('playing', handlePlaying);\n\n _videoElement.addEventListener('pause', handlePause);\n },\n destroy: () => {\n stopSyncLoop();\n room.off('disconnect', stopSyncLoop);\n room.off('removeLocalParticipant', stopSyncLoop);\n room.off('addLocalParticipant', handleAddLocalParticipant);\n room.off('addRemoteParticipant', handleAddRemoteParticipant);\n room.off('data', parseDataEvents);\n\n if (_libraryInstance) {\n _libraryInstance.off('bufferStateChanged', buffering);\n }\n\n if (_videoElement) {\n _videoElement.removeEventListener('playing', handlePlaying);\n\n _videoElement.removeEventListener('pause', handlePause);\n }\n\n _libraryInstance = null;\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (syncDashJs);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/sync-modules/sync-dash.js?");
|
|
9283
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../wt-utils */ \"./src/modules/wt-utils.js\");\n\n\nconst syncDashJs = function () {\n let {\n room,\n wt,\n roomSession,\n emitter\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n //SYNC VARS\n let _libraryInstance = null;\n let _videoElement = null;\n const syncDefaultWaitTime = 60000;\n const syncShortWaitTime = 10000;\n const maxSyncThreshold = 0.5;\n const maxSyncTries = 3;\n let currentSyncRetry = 0;\n let syncWaitId = null;\n let syncNextWaitTime = null;\n let stopFlag = false;\n let isSyncing = false;\n let playbackRate = 2;\n let isPlaying = false;\n let isPreloading = true;\n let isProgrammaticallySeeked = false;\n let shouldPropagateMaster = false;\n\n const startSyncLoop = () => {\n if (!isConnected()) {\n room._log('--- Sync loop will not start due to user not connected yet ---');\n\n return;\n }\n\n if (syncWaitId) {\n room._log('--- Sync loop already running ---');\n\n return;\n }\n\n room._log('--- Sync enabled ---');\n\n stopFlag = false;\n\n const loop = () => {\n isSyncing = true;\n emitter.emit('playerSyncing', true);\n sync().finally(() => {\n isSyncing = false;\n emitter.emit('playerSyncing', false);\n\n if (isConnected() && !stopFlag) {\n syncWaitId = setTimeout(loop, syncNextWaitTime);\n } else {\n room._log('--- Automatic stop due to user not connected or stop flag enabled ---');\n\n stopSyncLoop();\n }\n });\n };\n\n loop();\n };\n\n const stopSyncLoop = () => {\n room._log('--- Sync disabled ---');\n\n clearTimeout(syncWaitId);\n syncWaitId = null;\n currentSyncRetry = 0;\n stopFlag = true;\n };\n\n const restartSyncLoop = () => {\n room._log('--- Sync restarting ---');\n\n stopSyncLoop();\n startSyncLoop();\n };\n\n const setNextWaitTime = function () {\n let didSyncFail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (!didSyncFail) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n currentSyncRetry++;\n\n if (currentSyncRetry > maxSyncTries) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n syncNextWaitTime = syncShortWaitTime;\n }\n }\n\n room._log('--- Next sync will occur in ' + syncNextWaitTime / 1000 + ' seconds ---');\n };\n\n const sync = () => {\n return getSyncData().then(syncData => {\n if (syncData.isMaster) {\n if (_videoElement.paused) _videoElement.play();\n setNextWaitTime(false);\n return Promise.resolve();\n } else if (shouldPropagateMaster) {\n setNextWaitTime(false);\n return propagateMasterFunc();\n } else {\n const syncStartTime = Date.now();\n const {\n position,\n realPosition,\n isBufferSufficient\n } = calculateSyncDifferenceTime(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping);\n const currentPosition = getCurrentSegmentPosition() / 1000;\n\n if (position && Math.abs(position - currentPosition) <= maxSyncThreshold) {\n room._log(`We're within max sync threshold, no need to resync now`);\n\n setNextWaitTime(false);\n return Promise.resolve();\n }\n\n if (position !== null) {\n return seekTo(position).then(() => {\n const seekDuration = (Date.now() - syncStartTime) / 1000;\n const syncPrecision = Math.abs(realPosition + seekDuration - getCurrentSegmentPosition() / 1000);\n\n room._log(`Insufficient buffer: `, !isBufferSufficient);\n\n room._log(`Seek duration is ${seekDuration}`);\n\n room._log(`Sync precision should be ${syncPrecision}`);\n\n const didSyncFail = syncPrecision > maxSyncThreshold;\n setNextWaitTime(didSyncFail);\n return Promise.resolve();\n }).catch(e => {\n setNextWaitTime(true);\n return Promise.reject(e);\n });\n } else {\n setNextWaitTime(true);\n return Promise.reject();\n }\n }\n }).catch(() => {\n setNextWaitTime(true);\n return Promise.reject();\n });\n };\n\n const handleAddLocalParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n\n if (_videoElement && _videoElement.paused === false) {\n _videoElement.addEventListener('progress', () => {\n restartSyncLoop();\n }, {\n once: true\n });\n }\n };\n\n const handleAddRemoteParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n };\n\n const isConnected = () => {\n return room._isDataChannelOpen && room.isConnected;\n };\n\n const buffering = event => {\n if (event.mediaType === 'video' || event.mediaType === 'audio') {\n if (event.state === 'bufferStalled') {\n handleStalledWaiting();\n }\n }\n };\n\n const parseDataEvents = function () {\n let msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (msg.videoroom === 'sync_source_set' && msg.wt_channel_id != \"\") {\n emitter.emit('changePlayerSource', msg.wt_channel_id);\n } else if (msg.videoroom === 'sync_request') {\n roomSyncSend(msg.sync_slave_id).catch(() => {});\n }\n };\n\n const getCurrentSegmentPosition = () => {\n let position = _videoElement && _videoElement.currentTime;\n return isNaN(position) ? 0 : position * 1000;\n };\n\n const calculateSyncDifferenceTime = (fragmentSn, fragmentPos, ping) => {\n let seekRanges = _videoElement.buffered;\n let seekRange = {};\n\n for (let i = 0; i < seekRanges.length; i++) {\n let _c_start = seekRanges.start(i);\n\n let _c_end = seekRanges.end(i);\n\n if (!seekRange.start || _c_start < seekRange.start) {\n seekRange.start = _c_start;\n }\n\n if (!seekRange.end || _c_end > seekRange.end) {\n seekRange.end = _c_end;\n }\n }\n\n let position = (fragmentPos + ping / 2) / 1000;\n\n if (position > seekRange.start && position < seekRange.end) {\n return {\n position,\n realPosition: position,\n isBufferSufficient: true\n };\n } else if (position < seekRange.start) {\n room._log(`Syncing to ${seekRange.start} instead of ${position} due to lack of buffered data`);\n\n return {\n position: seekRange.start + 0.5,\n realPosition: position,\n isBufferSufficient: false\n };\n } else if (position > seekRange.end) {\n room._log(`Syncing to ${seekRange.end} instead of ${position} due to lack of buffered data`);\n\n return {\n position: seekRange.end - 0.5,\n realPosition: position,\n isBufferSufficient: false\n };\n } else return {\n position: null,\n realPosition: position,\n isBufferSufficient: false\n };\n };\n\n const seekTo = time => {\n return new Promise((resolve, reject) => {\n if (_videoElement.currentTime !== time) {\n let diff = time - _videoElement.currentTime;\n\n if (_videoElement.currentTime < time && diff < 4) {\n room._log(`Fast forward to seek...`);\n\n let wasPaused = false;\n\n let __ = () => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false;\n reject('Stalled');\n }; // _videoElement.addEventListener('waiting', __, {once:true});\n\n\n _videoElement.addEventListener('stalled', __, {\n once: true\n });\n\n Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"setExactTimeout\"])(() => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false; // _videoElement.removeEventListener('waiting', __, {once:true});\n\n _videoElement.removeEventListener('stalled', __, {\n once: true\n });\n\n resolve();\n }, diff * 1000 / (playbackRate - 1), 20);\n isProgrammaticallySeeked = true;\n\n if (_videoElement.paused) {\n wasPaused = true;\n\n _videoElement.play().then(() => {\n _videoElement.playbackRate = playbackRate;\n });\n } else {\n _videoElement.playbackRate = playbackRate;\n }\n } else {\n room._log(`Jump to seek...`);\n\n let __ = Date.now();\n\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _videoElement.addEventListener('playing', () => {\n room._log(`It took the player ${(Date.now() - __) / 1000} seconds to seek `);\n\n isProgrammaticallySeeked = false;\n resolve();\n }, {\n once: true\n });\n\n _videoElement.currentTime = time;\n }\n } else resolve();\n });\n };\n\n const handlePlaying = () => {\n if (!isProgrammaticallySeeked) {\n room._log('Handle playing');\n\n startSyncLoop();\n }\n\n isProgrammaticallySeeked = false;\n isPreloading = _videoElement.paused;\n isPlaying = !_videoElement.paused;\n };\n\n const handlePause = () => {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPlaying = !_videoElement.paused;\n };\n\n const handleStalledWaiting = () => {\n room._log('handleStalledWaiting');\n\n if (!isProgrammaticallySeeked) {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPreloading = _videoElement.paused;\n }\n };\n\n const roomSyncSend = slaveId => {\n if (!_libraryInstance || !_videoElement) {\n room._log(`I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?`);\n\n return Promise.resolve();\n }\n\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n\n room._log(`Sending my position to ${slaveId}`);\n\n room._log(`Current time: ${fragmentPosition}`);\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_response\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: String(\"0\"),\n fragment_pos: Number(fragmentPosition),\n slave_id: room.webrtcVersion > 1000 ? String(slaveId) : Number(slaveId)\n }\n });\n };\n\n const getSyncData = () => {\n room._log('Sending roomSync request');\n\n let roomId = room.roomId;\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n return new Promise((resolve, reject) => {\n let now = new Date().getTime();\n let ping = null;\n let sid = setTimeout(() => {\n room.off('data', fn, this);\n reject('Timeout');\n }, 3000);\n let body = {\n request: \"sync\",\n room: roomId,\n timestamp: new Date().getTime(),\n fragment: String(\"0\"),\n fragment_pos: Number(fragmentPosition)\n };\n\n let fn = msg => {\n if (msg.videoroom && ['sync', 'sync_response'].includes(msg.videoroom)) {\n if (msg.sync_master_await) {\n room._log('Waiting for master position');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n } else if (msg.sync_master_fragment || msg.sync_master_fragment_pos) {\n room._log('Got master position data');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n\n room._log(`I'm master: ${!!msg.sync_master_self}`);\n\n room._log(`Ping: ${ping}`);\n\n room._log(`Master fragment: ${msg.sync_master_fragment}`);\n\n room._log(`Master fragment position: ${msg.sync_master_fragment_pos}`);\n\n room.off('data', fn, this);\n clearTimeout(sid);\n resolve({\n isMaster: !!msg.sync_master_self,\n ping: ping,\n masterFragmentPos: parseInt(msg.sync_master_fragment_pos),\n masterFragmentSn: parseInt(msg.sync_master_fragment)\n });\n } else {\n clearTimeout(sid);\n reject('Master lost connection');\n }\n }\n };\n\n room.on('data', fn, this);\n room.sendMessage(room.handleId, {\n body\n }).then(fn).catch(e => {\n room.off('data', fn, this);\n clearTimeout(sid);\n reject(e);\n });\n });\n };\n\n const clientPaused = () => {\n room._log('Sending client paused');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_paused\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: '0',\n fragment_pos: 0\n }\n });\n };\n\n const propagateMasterFunc = () => {\n room._log('Propagating master');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_source_set\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n wt_channel_id: \"\",\n fragment: \"0\",\n fragment_pos: 0\n }\n });\n };\n\n return {\n __events: ['playerSyncing'],\n initialize: function () {\n let {\n dashInstance,\n libraryInstance,\n propagateMaster = false\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _libraryInstance = dashInstance || libraryInstance; // backwards comp;\n\n _videoElement = _libraryInstance.getVideoElement();\n\n if (!_libraryInstance) {\n room._log('No dash player instance!');\n\n return;\n }\n\n shouldPropagateMaster = propagateMaster;\n isPlaying = _videoElement.paused === false;\n room.on('disconnect', stopSyncLoop);\n room.on('removeLocalParticipant', stopSyncLoop);\n room.on('addLocalParticipant', handleAddLocalParticipant);\n room.on('addRemoteParticipant', handleAddRemoteParticipant);\n room.on('data', parseDataEvents);\n\n if (shouldPropagateMaster) {\n propagateMasterFunc().catch(() => {});\n }\n\n if (_videoElement && _videoElement.paused === false) {\n _videoElement.addEventListener('progress', () => {\n restartSyncLoop();\n }, {\n once: true\n });\n }\n\n _libraryInstance.on('bufferStateChanged', buffering);\n\n _videoElement.addEventListener('playing', handlePlaying);\n\n _videoElement.addEventListener('pause', handlePause);\n },\n destroy: () => {\n stopSyncLoop();\n room.off('disconnect', stopSyncLoop);\n room.off('removeLocalParticipant', stopSyncLoop);\n room.off('addLocalParticipant', handleAddLocalParticipant);\n room.off('addRemoteParticipant', handleAddRemoteParticipant);\n room.off('data', parseDataEvents);\n\n if (_libraryInstance) {\n _libraryInstance.off('bufferStateChanged', buffering);\n }\n\n if (_videoElement) {\n _videoElement.removeEventListener('playing', handlePlaying);\n\n _videoElement.removeEventListener('pause', handlePause);\n }\n\n _libraryInstance = null;\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (syncDashJs);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/sync-modules/sync-dash.js?");
|
|
9239
9284
|
|
|
9240
9285
|
/***/ }),
|
|
9241
9286
|
|
|
@@ -9247,7 +9292,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_
|
|
|
9247
9292
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9248
9293
|
|
|
9249
9294
|
"use strict";
|
|
9250
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../wt-utils */ \"./src/modules/wt-utils.js\");\n\n\nconst syncDaznDash = function () {\n let {\n room,\n wt,\n roomSession,\n emitter\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n //SYNC VARS\n let _libraryInstance = null;\n let _videoElement = null;\n const syncDefaultWaitTime = 60000;\n const syncShortWaitTime = 10000;\n const maxSyncThreshold = 0.5;\n const maxSyncTries = 3;\n let currentSyncRetry = 0;\n let syncWaitId = null;\n let syncNextWaitTime = null;\n let stopFlag = false;\n let isSyncing = false;\n let playbackRate = 2;\n let isPlaying = false;\n let isPreloading = true;\n let isProgrammaticallySeeked = false;\n let shouldPropagateMaster = false;\n\n const startSyncLoop = () => {\n if (!isConnected()) {\n room._log('--- Sync loop will not start due to user not connected yet ---');\n\n return;\n }\n\n if (syncWaitId) {\n room._log('--- Sync loop already running ---');\n\n return;\n }\n\n room._log('--- Sync enabled ---');\n\n stopFlag = false;\n\n const loop = () => {\n isSyncing = true;\n emitter.emit('playerSyncing', true);\n sync().finally(() => {\n isSyncing = false;\n emitter.emit('playerSyncing', false);\n\n if (isConnected() && !stopFlag) {\n syncWaitId = setTimeout(loop, syncNextWaitTime);\n } else {\n room._log('--- Automatic stop due to user not connected or stop flag enabled ---');\n\n stopSyncLoop();\n }\n });\n };\n\n loop();\n };\n\n const stopSyncLoop = () => {\n room._log('--- Sync disabled ---');\n\n clearTimeout(syncWaitId);\n syncWaitId = null;\n currentSyncRetry = 0;\n stopFlag = true;\n };\n\n const restartSyncLoop = () => {\n room._log('--- Sync restarting ---');\n\n stopSyncLoop();\n startSyncLoop();\n };\n\n const setNextWaitTime = function () {\n let didSyncFail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (!didSyncFail) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n currentSyncRetry++;\n\n if (currentSyncRetry > maxSyncTries) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n syncNextWaitTime = syncShortWaitTime;\n }\n }\n\n room._log('--- Next sync will occur in ' + syncNextWaitTime / 1000 + ' seconds ---');\n };\n\n const sync = () => {\n return getSyncData().then(syncData => {\n if (syncData.isMaster) {\n if (_videoElement.paused) _videoElement.play();\n setNextWaitTime(false);\n return Promise.resolve();\n } else if (shouldPropagateMaster) {\n setNextWaitTime(false);\n return propagateMasterFunc();\n } else {\n const syncStartTime = Date.now();\n const {\n position,\n realPosition,\n isBufferSufficient\n } = calculateSyncDifferenceTime(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping);\n const currentPosition = getCurrentSegmentPosition() / 1000;\n\n if (position && Math.abs(position - currentPosition) <= maxSyncThreshold) {\n room._log(\"We're within max sync threshold, no need to resync now\");\n\n setNextWaitTime(false);\n return Promise.resolve();\n }\n\n if (position !== null) {\n return seekTo(position).then(() => {\n const seekDuration = (Date.now() - syncStartTime) / 1000;\n const syncPrecision = Math.abs(realPosition + seekDuration - getCurrentSegmentPosition() / 1000);\n\n room._log(\"Insufficient buffer: \", !isBufferSufficient);\n\n room._log(\"Seek duration is \".concat(seekDuration));\n\n room._log(\"Sync precision should be \".concat(syncPrecision));\n\n const didSyncFail = syncPrecision > maxSyncThreshold;\n setNextWaitTime(didSyncFail);\n return Promise.resolve();\n }).catch(e => {\n setNextWaitTime(true);\n return Promise.reject(e);\n });\n } else {\n setNextWaitTime(true);\n return Promise.reject();\n }\n }\n }).catch(() => {\n setNextWaitTime(true);\n return Promise.reject();\n });\n };\n\n const handleAddLocalParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n\n if (_videoElement && _videoElement.paused === false) {\n _videoElement.addEventListener('progress', () => {\n restartSyncLoop();\n }, {\n once: true\n });\n }\n };\n\n const handleAddRemoteParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n };\n\n const isConnected = () => {\n return room._isDataChannelOpen && room.isConnected;\n };\n\n const parseDataEvents = function () {\n let msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (msg.videoroom === 'sync_source_set' && msg.wt_channel_id != \"\") {\n emitter.emit('changePlayerSource', msg.wt_channel_id);\n } else if (msg.videoroom === 'sync_request') {\n roomSyncSend(msg.sync_slave_id).catch(() => {});\n }\n };\n\n const getCurrentSegmentPosition = () => {\n let position = _videoElement && _videoElement.currentTime;\n return isNaN(position) ? 0 : position * 1000;\n };\n\n const calculateSyncDifferenceTime = (fragmentSn, fragmentPos, ping) => {\n let seekRanges = _videoElement.buffered;\n let seekRange = {};\n\n for (let i = 0; i < seekRanges.length; i++) {\n let _c_start = seekRanges.start(i);\n\n let _c_end = seekRanges.end(i);\n\n if (!seekRange.start || _c_start < seekRange.start) {\n seekRange.start = _c_start;\n }\n\n if (!seekRange.end || _c_end > seekRange.end) {\n seekRange.end = _c_end;\n }\n }\n\n let position = (fragmentPos + ping / 2) / 1000;\n\n if (position > seekRange.start && position < seekRange.end) {\n return {\n position,\n realPostion: position,\n isBufferSufficient: true\n };\n } else if (position < seekRange.start) {\n room._log(\"Syncing to \".concat(seekRange.start, \" instead of \").concat(position, \" due to lack of buffered data\"));\n\n return {\n position: seekRange.start + 0.5,\n realPostion: position,\n isBufferSufficient: false\n };\n } else if (position > seekRange.end) {\n room._log(\"Syncing to \".concat(seekRange.end, \" instead of \").concat(position, \" due to lack of buffered data\"));\n\n return {\n position: seekRange.end - 0.5,\n realPostion: position,\n isBufferSufficient: false\n };\n } else return {\n position: null,\n realPostion: position,\n isBufferSufficient: false\n };\n };\n\n const seekTo = time => {\n return new Promise((resolve, reject) => {\n if (_videoElement.currentTime !== time) {\n let diff = time - _videoElement.currentTime;\n\n if (_videoElement.currentTime < time && diff < 4) {\n room._log(\"Fast forward to seek...\");\n\n let wasPaused = false;\n\n let __ = () => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false;\n reject('Stalled');\n }; // _videoElement.addEventListener('waiting', __, {once:true});\n\n\n _videoElement.addEventListener('stalled', __, {\n once: true\n });\n\n Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"setExactTimeout\"])(() => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false; // _videoElement.removeEventListener('waiting', __, {once:true});\n\n _videoElement.removeEventListener('stalled', __, {\n once: true\n });\n\n resolve();\n }, diff * 1000 / (playbackRate - 1), 20);\n isProgrammaticallySeeked = true;\n\n if (_videoElement.paused) {\n wasPaused = true;\n\n _videoElement.play().then(() => {\n _videoElement.playbackRate = playbackRate;\n });\n } else {\n _videoElement.playbackRate = playbackRate;\n }\n } else {\n room._log(\"Jump to seek...\");\n\n let __ = Date.now();\n\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _videoElement.addEventListener('playing', () => {\n room._log(\"It took the player \".concat((Date.now() - __) / 1000, \" seconds to seek \"));\n\n isProgrammaticallySeeked = false;\n resolve();\n }, {\n once: true\n });\n\n _videoElement.currentTime = time;\n }\n } else resolve();\n });\n }; // const seekTo = (time) => {\n // return new Promise((resolve, reject) => {\n // if(_videoElement.currentTime !== time) {\n // let __ = Date.now();\n // isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n // _videoElement.addEventListener('playing', () => {\n // room._log(`It took the player ${(Date.now() - __) / 1000} seconds to seek `);\n // isProgrammaticallySeeked = false;\n // resolve();\n // }, {once:true});\n // _videoElement.currentTime = time;\n // } else resolve()\n // });\n // };\n\n\n const handlePlaying = () => {\n if (!isProgrammaticallySeeked) {\n room._log('Handle playing');\n\n startSyncLoop();\n }\n\n isProgrammaticallySeeked = false;\n isPreloading = _videoElement.paused;\n isPlaying = !_videoElement.paused;\n };\n\n const handlePause = () => {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPlaying = !_videoElement.paused;\n };\n\n const handleStalledWaiting = () => {\n room._log('handleStalledWaiting');\n\n if (!isProgrammaticallySeeked) {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPreloading = _videoElement.paused;\n }\n };\n\n const roomSyncSend = slaveId => {\n if (!_libraryInstance || !_videoElement) {\n room._log(\"I've been asked for position even if we don't have player attached.\\n Does it mean I'm the master?\");\n\n return Promise.resolve();\n }\n\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n\n room._log(\"Sending my position to \".concat(slaveId));\n\n room._log(\"Current time: \".concat(fragmentPosition));\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_response\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: String(\"0\"),\n fragment_pos: Number(fragmentPosition),\n slave_id: room.webrtcVersion > 1000 ? String(slaveId) : Number(slaveId)\n }\n });\n };\n\n const getSyncData = () => {\n room._log('Sending roomSync request');\n\n let roomId = room.roomId;\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n return new Promise((resolve, reject) => {\n let now = new Date().getTime();\n let ping = null;\n let sid = setTimeout(() => {\n room.off('data', fn, this);\n reject('Timeout');\n }, 3000);\n let body = {\n request: \"sync\",\n room: roomId,\n timestamp: new Date().getTime(),\n fragment: String(\"0\"),\n fragment_pos: Number(fragmentPosition)\n };\n\n let fn = msg => {\n if (msg.videoroom && ['sync', 'sync_response'].includes(msg.videoroom)) {\n if (msg.sync_master_await) {\n room._log('Waiting for master position');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n } else if (msg.sync_master_fragment || msg.sync_master_fragment_pos) {\n room._log('Got master position data');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n\n room._log(\"I'm master: \".concat(!!msg.sync_master_self));\n\n room._log(\"Ping: \".concat(ping));\n\n room._log(\"Master fragment: \".concat(msg.sync_master_fragment));\n\n room._log(\"Master fragment position: \".concat(msg.sync_master_fragment_pos));\n\n room.off('data', fn, this);\n clearTimeout(sid);\n resolve({\n isMaster: !!msg.sync_master_self,\n ping: ping,\n masterFragmentPos: parseInt(msg.sync_master_fragment_pos),\n masterFragmentSn: parseInt(msg.sync_master_fragment)\n });\n } else {\n clearTimeout(sid);\n reject('Master lost connection');\n }\n }\n };\n\n room.on('data', fn, this);\n room.sendMessage(room.handleId, {\n body\n }).then(fn).catch(e => {\n room.off('data', fn, this);\n clearTimeout(sid);\n reject(e);\n });\n });\n };\n\n const clientPaused = () => {\n room._log('Sending client paused');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_paused\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: '0',\n fragment_pos: 0\n }\n });\n };\n\n const propagateMasterFunc = () => {\n room._log('Propagating master');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_source_set\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n wt_channel_id: \"\",\n fragment: \"0\",\n fragment_pos: 0\n }\n });\n };\n\n return {\n __events: ['playerSyncing'],\n initialize: function () {\n let {\n libraryInstance,\n propagateMaster = false\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _libraryInstance = libraryInstance;\n _videoElement = _libraryInstance.videoElement;\n shouldPropagateMaster = propagateMaster;\n isPlaying = _videoElement.paused === false;\n room.on('disconnect', stopSyncLoop);\n room.on('removeLocalParticipant', stopSyncLoop);\n room.on('addLocalParticipant', handleAddLocalParticipant);\n room.on('addRemoteParticipant', handleAddRemoteParticipant);\n room.on('data', parseDataEvents);\n\n if (shouldPropagateMaster) {\n propagateMasterFunc().catch(() => {});\n }\n\n if (_videoElement && _videoElement.paused === false) {\n _videoElement.addEventListener('progress', () => {\n restartSyncLoop();\n }, {\n once: true\n });\n }\n\n _libraryInstance.addEventListener('buffer', handleStalledWaiting);\n\n _videoElement.addEventListener('playing', handlePlaying);\n\n _videoElement.addEventListener('pause', handlePause);\n },\n destroy: () => {\n stopSyncLoop();\n room.off('disconnect', stopSyncLoop);\n room.off('removeLocalParticipant', stopSyncLoop);\n room.off('addLocalParticipant', handleAddLocalParticipant);\n room.off('addRemoteParticipant', handleAddRemoteParticipant);\n room.off('data', parseDataEvents);\n\n if (_libraryInstance) {\n _libraryInstance.removeEventListener('buffer', handleStalledWaiting);\n }\n\n if (_videoElement) {\n _videoElement.removeEventListener('playing', handlePlaying);\n\n _videoElement.removeEventListener('pause', handlePause);\n }\n\n _libraryInstance = null;\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (syncDaznDash);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/sync-modules/sync-dazn-dash.js?");
|
|
9295
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../wt-utils */ \"./src/modules/wt-utils.js\");\n\n\nconst syncDaznDash = function () {\n let {\n room,\n wt,\n roomSession,\n emitter\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n //SYNC VARS\n let _libraryInstance = null;\n let _videoElement = null;\n const syncDefaultWaitTime = 60000;\n const syncShortWaitTime = 10000;\n const maxSyncThreshold = 0.5;\n const maxSyncTries = 3;\n let currentSyncRetry = 0;\n let syncWaitId = null;\n let syncNextWaitTime = null;\n let stopFlag = false;\n let isSyncing = false;\n let playbackRate = 2;\n let isPlaying = false;\n let isPreloading = true;\n let isProgrammaticallySeeked = false;\n let shouldPropagateMaster = false;\n\n const startSyncLoop = () => {\n if (!isConnected()) {\n room._log('--- Sync loop will not start due to user not connected yet ---');\n\n return;\n }\n\n if (syncWaitId) {\n room._log('--- Sync loop already running ---');\n\n return;\n }\n\n room._log('--- Sync enabled ---');\n\n stopFlag = false;\n\n const loop = () => {\n isSyncing = true;\n emitter.emit('playerSyncing', true);\n sync().finally(() => {\n isSyncing = false;\n emitter.emit('playerSyncing', false);\n\n if (isConnected() && !stopFlag) {\n syncWaitId = setTimeout(loop, syncNextWaitTime);\n } else {\n room._log('--- Automatic stop due to user not connected or stop flag enabled ---');\n\n stopSyncLoop();\n }\n });\n };\n\n loop();\n };\n\n const stopSyncLoop = () => {\n room._log('--- Sync disabled ---');\n\n clearTimeout(syncWaitId);\n syncWaitId = null;\n currentSyncRetry = 0;\n stopFlag = true;\n };\n\n const restartSyncLoop = () => {\n room._log('--- Sync restarting ---');\n\n stopSyncLoop();\n startSyncLoop();\n };\n\n const setNextWaitTime = function () {\n let didSyncFail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (!didSyncFail) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n currentSyncRetry++;\n\n if (currentSyncRetry > maxSyncTries) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n syncNextWaitTime = syncShortWaitTime;\n }\n }\n\n room._log('--- Next sync will occur in ' + syncNextWaitTime / 1000 + ' seconds ---');\n };\n\n const sync = () => {\n return getSyncData().then(syncData => {\n if (syncData.isMaster) {\n if (_videoElement.paused) _videoElement.play();\n setNextWaitTime(false);\n return Promise.resolve();\n } else if (shouldPropagateMaster) {\n setNextWaitTime(false);\n return propagateMasterFunc();\n } else {\n const syncStartTime = Date.now();\n const {\n position,\n realPosition,\n isBufferSufficient\n } = calculateSyncDifferenceTime(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping);\n const currentPosition = getCurrentSegmentPosition() / 1000;\n\n if (position && Math.abs(position - currentPosition) <= maxSyncThreshold) {\n room._log(`We're within max sync threshold, no need to resync now`);\n\n setNextWaitTime(false);\n return Promise.resolve();\n }\n\n if (position !== null) {\n return seekTo(position).then(() => {\n const seekDuration = (Date.now() - syncStartTime) / 1000;\n const syncPrecision = Math.abs(realPosition + seekDuration - getCurrentSegmentPosition() / 1000);\n\n room._log(`Insufficient buffer: `, !isBufferSufficient);\n\n room._log(`Seek duration is ${seekDuration}`);\n\n room._log(`Sync precision should be ${syncPrecision}`);\n\n const didSyncFail = syncPrecision > maxSyncThreshold;\n setNextWaitTime(didSyncFail);\n return Promise.resolve();\n }).catch(e => {\n setNextWaitTime(true);\n return Promise.reject(e);\n });\n } else {\n setNextWaitTime(true);\n return Promise.reject();\n }\n }\n }).catch(() => {\n setNextWaitTime(true);\n return Promise.reject();\n });\n };\n\n const handleAddLocalParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n\n if (_videoElement && _videoElement.paused === false) {\n _videoElement.addEventListener('progress', () => {\n restartSyncLoop();\n }, {\n once: true\n });\n }\n };\n\n const handleAddRemoteParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n };\n\n const isConnected = () => {\n return room._isDataChannelOpen && room.isConnected;\n };\n\n const parseDataEvents = function () {\n let msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (msg.videoroom === 'sync_source_set' && msg.wt_channel_id != \"\") {\n emitter.emit('changePlayerSource', msg.wt_channel_id);\n } else if (msg.videoroom === 'sync_request') {\n roomSyncSend(msg.sync_slave_id).catch(() => {});\n }\n };\n\n const getCurrentSegmentPosition = () => {\n let position = _videoElement && _videoElement.currentTime;\n return isNaN(position) ? 0 : position * 1000;\n };\n\n const calculateSyncDifferenceTime = (fragmentSn, fragmentPos, ping) => {\n let seekRanges = _videoElement.buffered;\n let seekRange = {};\n\n for (let i = 0; i < seekRanges.length; i++) {\n let _c_start = seekRanges.start(i);\n\n let _c_end = seekRanges.end(i);\n\n if (!seekRange.start || _c_start < seekRange.start) {\n seekRange.start = _c_start;\n }\n\n if (!seekRange.end || _c_end > seekRange.end) {\n seekRange.end = _c_end;\n }\n }\n\n let position = (fragmentPos + ping / 2) / 1000;\n\n if (position > seekRange.start && position < seekRange.end) {\n return {\n position,\n realPostion: position,\n isBufferSufficient: true\n };\n } else if (position < seekRange.start) {\n room._log(`Syncing to ${seekRange.start} instead of ${position} due to lack of buffered data`);\n\n return {\n position: seekRange.start + 0.5,\n realPostion: position,\n isBufferSufficient: false\n };\n } else if (position > seekRange.end) {\n room._log(`Syncing to ${seekRange.end} instead of ${position} due to lack of buffered data`);\n\n return {\n position: seekRange.end - 0.5,\n realPostion: position,\n isBufferSufficient: false\n };\n } else return {\n position: null,\n realPostion: position,\n isBufferSufficient: false\n };\n };\n\n const seekTo = time => {\n return new Promise((resolve, reject) => {\n if (_videoElement.currentTime !== time) {\n let diff = time - _videoElement.currentTime;\n\n if (_videoElement.currentTime < time && diff < 4) {\n room._log(`Fast forward to seek...`);\n\n let wasPaused = false;\n\n let __ = () => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false;\n reject('Stalled');\n }; // _videoElement.addEventListener('waiting', __, {once:true});\n\n\n _videoElement.addEventListener('stalled', __, {\n once: true\n });\n\n Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"setExactTimeout\"])(() => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false; // _videoElement.removeEventListener('waiting', __, {once:true});\n\n _videoElement.removeEventListener('stalled', __, {\n once: true\n });\n\n resolve();\n }, diff * 1000 / (playbackRate - 1), 20);\n isProgrammaticallySeeked = true;\n\n if (_videoElement.paused) {\n wasPaused = true;\n\n _videoElement.play().then(() => {\n _videoElement.playbackRate = playbackRate;\n });\n } else {\n _videoElement.playbackRate = playbackRate;\n }\n } else {\n room._log(`Jump to seek...`);\n\n let __ = Date.now();\n\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _videoElement.addEventListener('playing', () => {\n room._log(`It took the player ${(Date.now() - __) / 1000} seconds to seek `);\n\n isProgrammaticallySeeked = false;\n resolve();\n }, {\n once: true\n });\n\n _videoElement.currentTime = time;\n }\n } else resolve();\n });\n }; // const seekTo = (time) => {\n // return new Promise((resolve, reject) => {\n // if(_videoElement.currentTime !== time) {\n // let __ = Date.now();\n // isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n // _videoElement.addEventListener('playing', () => {\n // room._log(`It took the player ${(Date.now() - __) / 1000} seconds to seek `);\n // isProgrammaticallySeeked = false;\n // resolve();\n // }, {once:true});\n // _videoElement.currentTime = time;\n // } else resolve()\n // });\n // };\n\n\n const handlePlaying = () => {\n if (!isProgrammaticallySeeked) {\n room._log('Handle playing');\n\n startSyncLoop();\n }\n\n isProgrammaticallySeeked = false;\n isPreloading = _videoElement.paused;\n isPlaying = !_videoElement.paused;\n };\n\n const handlePause = () => {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPlaying = !_videoElement.paused;\n };\n\n const handleStalledWaiting = () => {\n room._log('handleStalledWaiting');\n\n if (!isProgrammaticallySeeked) {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPreloading = _videoElement.paused;\n }\n };\n\n const roomSyncSend = slaveId => {\n if (!_libraryInstance || !_videoElement) {\n room._log(`I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?`);\n\n return Promise.resolve();\n }\n\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n\n room._log(`Sending my position to ${slaveId}`);\n\n room._log(`Current time: ${fragmentPosition}`);\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_response\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: String(\"0\"),\n fragment_pos: Number(fragmentPosition),\n slave_id: room.webrtcVersion > 1000 ? String(slaveId) : Number(slaveId)\n }\n });\n };\n\n const getSyncData = () => {\n room._log('Sending roomSync request');\n\n let roomId = room.roomId;\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n return new Promise((resolve, reject) => {\n let now = new Date().getTime();\n let ping = null;\n let sid = setTimeout(() => {\n room.off('data', fn, this);\n reject('Timeout');\n }, 3000);\n let body = {\n request: \"sync\",\n room: roomId,\n timestamp: new Date().getTime(),\n fragment: String(\"0\"),\n fragment_pos: Number(fragmentPosition)\n };\n\n let fn = msg => {\n if (msg.videoroom && ['sync', 'sync_response'].includes(msg.videoroom)) {\n if (msg.sync_master_await) {\n room._log('Waiting for master position');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n } else if (msg.sync_master_fragment || msg.sync_master_fragment_pos) {\n room._log('Got master position data');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n\n room._log(`I'm master: ${!!msg.sync_master_self}`);\n\n room._log(`Ping: ${ping}`);\n\n room._log(`Master fragment: ${msg.sync_master_fragment}`);\n\n room._log(`Master fragment position: ${msg.sync_master_fragment_pos}`);\n\n room.off('data', fn, this);\n clearTimeout(sid);\n resolve({\n isMaster: !!msg.sync_master_self,\n ping: ping,\n masterFragmentPos: parseInt(msg.sync_master_fragment_pos),\n masterFragmentSn: parseInt(msg.sync_master_fragment)\n });\n } else {\n clearTimeout(sid);\n reject('Master lost connection');\n }\n }\n };\n\n room.on('data', fn, this);\n room.sendMessage(room.handleId, {\n body\n }).then(fn).catch(e => {\n room.off('data', fn, this);\n clearTimeout(sid);\n reject(e);\n });\n });\n };\n\n const clientPaused = () => {\n room._log('Sending client paused');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_paused\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: '0',\n fragment_pos: 0\n }\n });\n };\n\n const propagateMasterFunc = () => {\n room._log('Propagating master');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_source_set\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n wt_channel_id: \"\",\n fragment: \"0\",\n fragment_pos: 0\n }\n });\n };\n\n return {\n __events: ['playerSyncing'],\n initialize: function () {\n let {\n libraryInstance,\n propagateMaster = false\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _libraryInstance = libraryInstance;\n _videoElement = _libraryInstance.videoElement;\n shouldPropagateMaster = propagateMaster;\n isPlaying = _videoElement.paused === false;\n room.on('disconnect', stopSyncLoop);\n room.on('removeLocalParticipant', stopSyncLoop);\n room.on('addLocalParticipant', handleAddLocalParticipant);\n room.on('addRemoteParticipant', handleAddRemoteParticipant);\n room.on('data', parseDataEvents);\n\n if (shouldPropagateMaster) {\n propagateMasterFunc().catch(() => {});\n }\n\n if (_videoElement && _videoElement.paused === false) {\n _videoElement.addEventListener('progress', () => {\n restartSyncLoop();\n }, {\n once: true\n });\n }\n\n _libraryInstance.addEventListener('buffer', handleStalledWaiting);\n\n _videoElement.addEventListener('playing', handlePlaying);\n\n _videoElement.addEventListener('pause', handlePause);\n },\n destroy: () => {\n stopSyncLoop();\n room.off('disconnect', stopSyncLoop);\n room.off('removeLocalParticipant', stopSyncLoop);\n room.off('addLocalParticipant', handleAddLocalParticipant);\n room.off('addRemoteParticipant', handleAddRemoteParticipant);\n room.off('data', parseDataEvents);\n\n if (_libraryInstance) {\n _libraryInstance.removeEventListener('buffer', handleStalledWaiting);\n }\n\n if (_videoElement) {\n _videoElement.removeEventListener('playing', handlePlaying);\n\n _videoElement.removeEventListener('pause', handlePause);\n }\n\n _libraryInstance = null;\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (syncDaznDash);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/sync-modules/sync-dazn-dash.js?");
|
|
9251
9296
|
|
|
9252
9297
|
/***/ }),
|
|
9253
9298
|
|
|
@@ -9271,7 +9316,7 @@ eval("__webpack_require__.r(__webpack_exports__);\nconst syncDisabled = function
|
|
|
9271
9316
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9272
9317
|
|
|
9273
9318
|
"use strict";
|
|
9274
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../wt-utils */ \"./src/modules/wt-utils.js\");\n\n\nconst syncDoris = function () {\n let {\n room,\n wt,\n roomSession,\n emitter\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n //SYNC VARS\n let _libraryInstance = null;\n let _videoElement = null;\n const syncDefaultWaitTime = 60000;\n const syncShortWaitTime = 10000;\n const maxSyncThreshold = 0.5;\n const maxSyncTries = 3;\n let currentSyncRetry = 0;\n let syncWaitId = null;\n let syncNextWaitTime = null;\n let stopFlag = false;\n let isSyncing = false;\n let playbackRate = 2;\n let isPlaying = false;\n let isPreloading = true;\n let isProgrammaticallySeeked = false;\n let shouldPropagateMaster = false;\n let isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n\n const startSyncLoop = () => {\n if (!isConnected()) {\n room._log('--- Sync loop will not start due to user not connected yet ---');\n\n return;\n }\n\n if (syncWaitId) {\n room._log('--- Sync loop already running ---');\n\n return;\n }\n\n room._log('--- Sync enabled ---');\n\n stopFlag = false;\n\n const loop = () => {\n isSyncing = true;\n emitter.emit('playerSyncing', true);\n sync().finally(() => {\n isSyncing = false;\n emitter.emit('playerSyncing', false);\n\n if (isConnected() && !stopFlag) {\n syncWaitId = setTimeout(loop, syncNextWaitTime);\n } else {\n room._log('--- Automatic stop due to user not connected or stop flag enabled ---');\n\n stopSyncLoop();\n }\n });\n };\n\n loop();\n };\n\n const stopSyncLoop = () => {\n room._log('--- Sync disabled ---');\n\n clearTimeout(syncWaitId);\n syncWaitId = null;\n currentSyncRetry = 0;\n stopFlag = true;\n };\n\n const restartSyncLoop = () => {\n room._log('--- Sync restarting ---');\n\n stopSyncLoop();\n startSyncLoop();\n };\n\n const setNextWaitTime = function () {\n let didSyncFail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (!didSyncFail) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n currentSyncRetry++;\n\n if (currentSyncRetry > maxSyncTries) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n syncNextWaitTime = syncShortWaitTime;\n }\n }\n\n room._log('--- Next sync will occur in ' + syncNextWaitTime / 1000 + ' seconds ---');\n };\n\n const sync = () => {\n return getSyncData().then(syncData => {\n if (syncData.isMaster) {\n if (_videoElement.paused) _videoElement.play();\n setNextWaitTime(false);\n return Promise.resolve();\n } else if (shouldPropagateMaster) {\n setNextWaitTime(false);\n return propagateMasterFunc();\n } else {\n const syncStartTime = Date.now();\n const {\n position,\n act,\n isBufferSufficient\n } = calculateSyncDifferenceTime(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping);\n\n if (position && Math.abs(position) <= maxSyncThreshold) {\n room._log(\"We're within max sync threshold, no need to resync now\");\n\n setNextWaitTime(false);\n return Promise.resolve();\n }\n\n if (position !== null) {\n return seekDoris(position, act).then(() => {\n const seekDuration = Date.now() - syncStartTime;\n const {\n position\n } = calculateSyncDifferenceTime(syncData.masterFragmentSn, syncData.masterFragmentPos + seekDuration, syncData.ping);\n const syncPrecision = Math.abs(position);\n\n room._log(\"Insufficient buffer: \", !isBufferSufficient);\n\n room._log(\"Seek duration is \".concat(seekDuration));\n\n room._log(\"Sync precision should be \".concat(syncPrecision));\n\n const didSyncFail = syncPrecision > maxSyncThreshold;\n setNextWaitTime(didSyncFail);\n return Promise.resolve();\n }).catch(e => {\n setNextWaitTime(true);\n return Promise.reject(e);\n });\n } else {\n setNextWaitTime(true);\n return Promise.reject();\n }\n }\n }).catch(() => {\n setNextWaitTime(true);\n return Promise.reject();\n });\n };\n\n const handleAddLocalParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n\n if (_videoElement && _videoElement.paused === false) {\n _videoElement.addEventListener('progress', () => {\n restartSyncLoop();\n }, {\n once: true\n });\n }\n };\n\n const handleAddRemoteParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n };\n\n const isConnected = () => {\n return room._isDataChannelOpen && room.isConnected;\n };\n\n const parseDataEvents = function () {\n let msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (msg.videoroom === 'sync_source_set' && msg.wt_channel_id != \"\") {\n emitter.emit('changePlayerSource', msg.wt_channel_id);\n } else if (msg.videoroom === 'sync_request') {\n roomSyncSend(msg.sync_slave_id).catch(() => {});\n }\n };\n\n const getCurrentSegmentPosition = () => {\n var position;\n return (position = _libraryInstance.getCurrentDate()) === null || position === void 0 ? 0 : position.getTime();\n };\n\n const calculateSyncDifferenceTime = function (fragmentSn, fragmentPos) {\n let ping = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n\n var _pos;\n\n let currentTime = (_pos = _libraryInstance.getCurrentDate()) === null || _pos === void 0 ? null : _pos.getTime();\n\n if (currentTime && fragmentPos) {\n return {\n position: (fragmentPos + ping / 2 - currentTime) / 1000,\n act: fragmentPos + ping / 2,\n isBufferSufficient: true\n };\n } else {\n return {\n position: null,\n isBufferSufficient: false\n };\n }\n };\n\n const seekDoris = (time, act) => {\n //https://mcorp.no/lib/mediasync.js\n return new Promise((resolve, reject) => {\n if (time !== 0) {\n if (isSafari) {\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _videoElement.addEventListener('playing', () => {\n isProgrammaticallySeeked = false;\n resolve();\n }, {\n once: true\n });\n\n _libraryInstance.seekTo(new Date(act));\n } else {\n if (time > 0 && time < 4) {\n room._log(\"Fast forward to seek...\");\n\n let wasPaused = false;\n\n let __ = () => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false;\n reject('Stalled');\n };\n\n let diff = time; // _videoElement.addEventListener('waiting', __, {once:true});\n\n _videoElement.addEventListener('stalled', __, {\n once: true\n });\n\n Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"setExactTimeout\"])(() => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false; // _videoElement.removeEventListener('waiting', __, {once:true});\n\n _videoElement.removeEventListener('stalled', __, {\n once: true\n });\n\n resolve();\n }, diff * 1000 / (playbackRate - 1), 20);\n isProgrammaticallySeeked = true;\n\n if (_videoElement.paused) {\n wasPaused = true;\n\n _videoElement.play().then(() => {\n _videoElement.playbackRate = playbackRate;\n });\n } else {\n _videoElement.playbackRate = playbackRate;\n }\n } else {\n room._log(\"Jump to seek...\");\n\n let __ = Date.now();\n\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _videoElement.addEventListener('playing', () => {\n room._log(\"It took the player \".concat((Date.now() - __) / 1000, \" seconds to seek \"));\n\n isProgrammaticallySeeked = false;\n resolve();\n }, {\n once: true\n });\n\n _videoElement.currentTime += time;\n }\n }\n } else resolve();\n });\n };\n\n const handlePlaying = () => {\n if (!isProgrammaticallySeeked) {\n room._log('Handle playing');\n\n startSyncLoop();\n }\n\n isProgrammaticallySeeked = false;\n isPreloading = _videoElement.paused;\n isPlaying = !_videoElement.paused;\n };\n\n const handlePause = () => {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPlaying = !_videoElement.paused;\n };\n\n const handleStalledWaiting = () => {\n room._log('handleStalledWaiting');\n\n if (!isProgrammaticallySeeked) {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPreloading = _videoElement.paused;\n }\n };\n\n let sgtid = null;\n\n const stalledGenerator = () => {\n clearTimeout(sgtid);\n sgtid = setTimeout(() => {\n if (_videoElement.paused === false) {\n handleStalledWaiting();\n }\n }, 1000);\n };\n\n const roomSyncSend = slaveId => {\n if (!_libraryInstance || !_videoElement) {\n room._log(\"I've been asked for position even if we don't have player attached.\\n Does it mean I'm the master?\");\n\n return Promise.resolve();\n }\n\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n\n room._log(\"Sending my position to \".concat(slaveId));\n\n room._log(\"Current time: \".concat(fragmentPosition));\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_response\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: String(\"0\"),\n fragment_pos: Number(fragmentPosition),\n slave_id: room.webrtcVersion > 1000 ? String(slaveId) : Number(slaveId)\n }\n });\n };\n\n const getSyncData = () => {\n room._log('Sending roomSync request');\n\n let roomId = room.roomId;\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n return new Promise((resolve, reject) => {\n let now = new Date().getTime();\n let ping = null;\n let sid = setTimeout(() => {\n room.off('data', fn, this);\n reject('Timeout');\n }, 3000);\n let body = {\n request: \"sync\",\n room: roomId,\n timestamp: new Date().getTime(),\n fragment: String(\"0\"),\n fragment_pos: Number(fragmentPosition)\n };\n\n let fn = msg => {\n if (msg.videoroom && ['sync', 'sync_response'].includes(msg.videoroom)) {\n if (msg.sync_master_await) {\n room._log('Waiting for master position');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n } else if (msg.sync_master_fragment || msg.sync_master_fragment_pos) {\n room._log('Got master position data');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n\n room._log(\"I'm master: \".concat(!!msg.sync_master_self));\n\n room._log(\"Ping: \".concat(ping));\n\n room._log(\"Master fragment: \".concat(msg.sync_master_fragment));\n\n room._log(\"Master fragment position: \".concat(msg.sync_master_fragment_pos));\n\n room.off('data', fn, this);\n clearTimeout(sid);\n resolve({\n isMaster: !!msg.sync_master_self,\n ping: ping,\n masterFragmentPos: parseInt(msg.sync_master_fragment_pos),\n masterFragmentSn: parseInt(msg.sync_master_fragment)\n });\n } else {\n clearTimeout(sid);\n reject('Master lost connection');\n }\n }\n };\n\n room.on('data', fn, this);\n room.sendMessage(room.handleId, {\n body\n }).then(fn).catch(e => {\n room.off('data', fn, this);\n clearTimeout(sid);\n reject(e);\n });\n });\n };\n\n const clientPaused = () => {\n room._log('Sending client paused');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_paused\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: '0',\n fragment_pos: 0\n }\n });\n };\n\n const propagateMasterFunc = () => {\n room._log('Propagating master');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_source_set\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n wt_channel_id: \"\",\n fragment: \"0\",\n fragment_pos: 0\n }\n });\n };\n\n return {\n __events: ['playerSyncing'],\n initialize: function () {\n let {\n dorisInstance,\n libraryInstance,\n propagateMaster = false\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _libraryInstance = dorisInstance || libraryInstance;\n _videoElement = _libraryInstance.sourceHandler.getElement();\n shouldPropagateMaster = propagateMaster;\n isPlaying = _videoElement.paused === false;\n room.on('disconnect', stopSyncLoop);\n room.on('removeLocalParticipant', stopSyncLoop);\n room.on('addLocalParticipant', handleAddLocalParticipant);\n room.on('addRemoteParticipant', handleAddRemoteParticipant);\n room.on('data', parseDataEvents);\n\n if (shouldPropagateMaster) {\n propagateMasterFunc().catch(() => {});\n }\n\n if (_videoElement && _videoElement.paused === false) {\n _videoElement.addEventListener('progress', () => {\n restartSyncLoop();\n }, {\n once: true\n });\n }\n\n _videoElement.addEventListener('timeupdate', stalledGenerator);\n\n _videoElement.addEventListener('playing', handlePlaying);\n\n _videoElement.addEventListener('pause', handlePause);\n },\n destroy: () => {\n stopSyncLoop();\n room.off('disconnect', stopSyncLoop);\n room.off('removeLocalParticipant', stopSyncLoop);\n room.off('addLocalParticipant', handleAddLocalParticipant);\n room.off('addRemoteParticipant', handleAddRemoteParticipant);\n room.off('data', parseDataEvents);\n\n if (_videoElement) {\n _videoElement.removeEventListener('timeupdate', stalledGenerator);\n\n _videoElement.removeEventListener('playing', handlePlaying);\n\n _videoElement.removeEventListener('pause', handlePause);\n }\n\n _libraryInstance = null;\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (syncDoris);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/sync-modules/sync-doris.js?");
|
|
9319
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../wt-utils */ \"./src/modules/wt-utils.js\");\n\n\nconst syncDoris = function () {\n let {\n room,\n wt,\n roomSession,\n emitter\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n //SYNC VARS\n let _libraryInstance = null;\n let _videoElement = null;\n const syncDefaultWaitTime = 60000;\n const syncShortWaitTime = 10000;\n const maxSyncThreshold = 0.5;\n const maxSyncTries = 3;\n let currentSyncRetry = 0;\n let syncWaitId = null;\n let syncNextWaitTime = null;\n let stopFlag = false;\n let isSyncing = false;\n let playbackRate = 2;\n let isPlaying = false;\n let isPreloading = true;\n let isProgrammaticallySeeked = false;\n let shouldPropagateMaster = false;\n let isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n\n const startSyncLoop = () => {\n if (!isConnected()) {\n room._log('--- Sync loop will not start due to user not connected yet ---');\n\n return;\n }\n\n if (syncWaitId) {\n room._log('--- Sync loop already running ---');\n\n return;\n }\n\n room._log('--- Sync enabled ---');\n\n stopFlag = false;\n\n const loop = () => {\n isSyncing = true;\n emitter.emit('playerSyncing', true);\n sync().finally(() => {\n isSyncing = false;\n emitter.emit('playerSyncing', false);\n\n if (isConnected() && !stopFlag) {\n syncWaitId = setTimeout(loop, syncNextWaitTime);\n } else {\n room._log('--- Automatic stop due to user not connected or stop flag enabled ---');\n\n stopSyncLoop();\n }\n });\n };\n\n loop();\n };\n\n const stopSyncLoop = () => {\n room._log('--- Sync disabled ---');\n\n clearTimeout(syncWaitId);\n syncWaitId = null;\n currentSyncRetry = 0;\n stopFlag = true;\n };\n\n const restartSyncLoop = () => {\n room._log('--- Sync restarting ---');\n\n stopSyncLoop();\n startSyncLoop();\n };\n\n const setNextWaitTime = function () {\n let didSyncFail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (!didSyncFail) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n currentSyncRetry++;\n\n if (currentSyncRetry > maxSyncTries) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n syncNextWaitTime = syncShortWaitTime;\n }\n }\n\n room._log('--- Next sync will occur in ' + syncNextWaitTime / 1000 + ' seconds ---');\n };\n\n const sync = () => {\n return getSyncData().then(syncData => {\n if (syncData.isMaster) {\n if (_videoElement.paused) _videoElement.play();\n setNextWaitTime(false);\n return Promise.resolve();\n } else if (shouldPropagateMaster) {\n setNextWaitTime(false);\n return propagateMasterFunc();\n } else {\n const syncStartTime = Date.now();\n const {\n position,\n act,\n isBufferSufficient\n } = calculateSyncDifferenceTime(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping);\n\n if (position && Math.abs(position) <= maxSyncThreshold) {\n room._log(`We're within max sync threshold, no need to resync now`);\n\n setNextWaitTime(false);\n return Promise.resolve();\n }\n\n if (position !== null) {\n return seekDoris(position, act).then(() => {\n const seekDuration = Date.now() - syncStartTime;\n const {\n position\n } = calculateSyncDifferenceTime(syncData.masterFragmentSn, syncData.masterFragmentPos + seekDuration, syncData.ping);\n const syncPrecision = Math.abs(position);\n\n room._log(`Insufficient buffer: `, !isBufferSufficient);\n\n room._log(`Seek duration is ${seekDuration}`);\n\n room._log(`Sync precision should be ${syncPrecision}`);\n\n const didSyncFail = syncPrecision > maxSyncThreshold;\n setNextWaitTime(didSyncFail);\n return Promise.resolve();\n }).catch(e => {\n setNextWaitTime(true);\n return Promise.reject(e);\n });\n } else {\n setNextWaitTime(true);\n return Promise.reject();\n }\n }\n }).catch(() => {\n setNextWaitTime(true);\n return Promise.reject();\n });\n };\n\n const handleAddLocalParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n\n if (_videoElement && _videoElement.paused === false) {\n _videoElement.addEventListener('progress', () => {\n restartSyncLoop();\n }, {\n once: true\n });\n }\n };\n\n const handleAddRemoteParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n };\n\n const isConnected = () => {\n return room._isDataChannelOpen && room.isConnected;\n };\n\n const parseDataEvents = function () {\n let msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (msg.videoroom === 'sync_source_set' && msg.wt_channel_id != \"\") {\n emitter.emit('changePlayerSource', msg.wt_channel_id);\n } else if (msg.videoroom === 'sync_request') {\n roomSyncSend(msg.sync_slave_id).catch(() => {});\n }\n };\n\n const getCurrentSegmentPosition = () => {\n var position;\n return (position = _libraryInstance.getCurrentDate()) === null || position === void 0 ? 0 : position.getTime();\n };\n\n const calculateSyncDifferenceTime = function (fragmentSn, fragmentPos) {\n let ping = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n\n var _pos;\n\n let currentTime = (_pos = _libraryInstance.getCurrentDate()) === null || _pos === void 0 ? null : _pos.getTime();\n\n if (currentTime && fragmentPos) {\n return {\n position: (fragmentPos + ping / 2 - currentTime) / 1000,\n act: fragmentPos + ping / 2,\n isBufferSufficient: true\n };\n } else {\n return {\n position: null,\n isBufferSufficient: false\n };\n }\n };\n\n const seekDoris = (time, act) => {\n //https://mcorp.no/lib/mediasync.js\n return new Promise((resolve, reject) => {\n if (time !== 0) {\n if (isSafari) {\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _videoElement.addEventListener('playing', () => {\n isProgrammaticallySeeked = false;\n resolve();\n }, {\n once: true\n });\n\n _libraryInstance.seekTo(new Date(act));\n } else {\n if (time > 0 && time < 4) {\n room._log(`Fast forward to seek...`);\n\n let wasPaused = false;\n\n let __ = () => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false;\n reject('Stalled');\n };\n\n let diff = time; // _videoElement.addEventListener('waiting', __, {once:true});\n\n _videoElement.addEventListener('stalled', __, {\n once: true\n });\n\n Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"setExactTimeout\"])(() => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false; // _videoElement.removeEventListener('waiting', __, {once:true});\n\n _videoElement.removeEventListener('stalled', __, {\n once: true\n });\n\n resolve();\n }, diff * 1000 / (playbackRate - 1), 20);\n isProgrammaticallySeeked = true;\n\n if (_videoElement.paused) {\n wasPaused = true;\n\n _videoElement.play().then(() => {\n _videoElement.playbackRate = playbackRate;\n });\n } else {\n _videoElement.playbackRate = playbackRate;\n }\n } else {\n room._log(`Jump to seek...`);\n\n let __ = Date.now();\n\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _videoElement.addEventListener('playing', () => {\n room._log(`It took the player ${(Date.now() - __) / 1000} seconds to seek `);\n\n isProgrammaticallySeeked = false;\n resolve();\n }, {\n once: true\n });\n\n _videoElement.currentTime += time;\n }\n }\n } else resolve();\n });\n };\n\n const handlePlaying = () => {\n if (!isProgrammaticallySeeked) {\n room._log('Handle playing');\n\n startSyncLoop();\n }\n\n isProgrammaticallySeeked = false;\n isPreloading = _videoElement.paused;\n isPlaying = !_videoElement.paused;\n };\n\n const handlePause = () => {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPlaying = !_videoElement.paused;\n };\n\n const handleStalledWaiting = () => {\n room._log('handleStalledWaiting');\n\n if (!isProgrammaticallySeeked) {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPreloading = _videoElement.paused;\n }\n };\n\n let sgtid = null;\n\n const stalledGenerator = () => {\n clearTimeout(sgtid);\n sgtid = setTimeout(() => {\n if (_videoElement.paused === false) {\n handleStalledWaiting();\n }\n }, 1000);\n };\n\n const roomSyncSend = slaveId => {\n if (!_libraryInstance || !_videoElement) {\n room._log(`I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?`);\n\n return Promise.resolve();\n }\n\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n\n room._log(`Sending my position to ${slaveId}`);\n\n room._log(`Current time: ${fragmentPosition}`);\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_response\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: String(\"0\"),\n fragment_pos: Number(fragmentPosition),\n slave_id: room.webrtcVersion > 1000 ? String(slaveId) : Number(slaveId)\n }\n });\n };\n\n const getSyncData = () => {\n room._log('Sending roomSync request');\n\n let roomId = room.roomId;\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n return new Promise((resolve, reject) => {\n let now = new Date().getTime();\n let ping = null;\n let sid = setTimeout(() => {\n room.off('data', fn, this);\n reject('Timeout');\n }, 3000);\n let body = {\n request: \"sync\",\n room: roomId,\n timestamp: new Date().getTime(),\n fragment: String(\"0\"),\n fragment_pos: Number(fragmentPosition)\n };\n\n let fn = msg => {\n if (msg.videoroom && ['sync', 'sync_response'].includes(msg.videoroom)) {\n if (msg.sync_master_await) {\n room._log('Waiting for master position');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n } else if (msg.sync_master_fragment || msg.sync_master_fragment_pos) {\n room._log('Got master position data');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n\n room._log(`I'm master: ${!!msg.sync_master_self}`);\n\n room._log(`Ping: ${ping}`);\n\n room._log(`Master fragment: ${msg.sync_master_fragment}`);\n\n room._log(`Master fragment position: ${msg.sync_master_fragment_pos}`);\n\n room.off('data', fn, this);\n clearTimeout(sid);\n resolve({\n isMaster: !!msg.sync_master_self,\n ping: ping,\n masterFragmentPos: parseInt(msg.sync_master_fragment_pos),\n masterFragmentSn: parseInt(msg.sync_master_fragment)\n });\n } else {\n clearTimeout(sid);\n reject('Master lost connection');\n }\n }\n };\n\n room.on('data', fn, this);\n room.sendMessage(room.handleId, {\n body\n }).then(fn).catch(e => {\n room.off('data', fn, this);\n clearTimeout(sid);\n reject(e);\n });\n });\n };\n\n const clientPaused = () => {\n room._log('Sending client paused');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_paused\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: '0',\n fragment_pos: 0\n }\n });\n };\n\n const propagateMasterFunc = () => {\n room._log('Propagating master');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_source_set\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n wt_channel_id: \"\",\n fragment: \"0\",\n fragment_pos: 0\n }\n });\n };\n\n return {\n __events: ['playerSyncing'],\n initialize: function () {\n let {\n dorisInstance,\n libraryInstance,\n propagateMaster = false\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _libraryInstance = dorisInstance || libraryInstance;\n _videoElement = _libraryInstance.sourceHandler.getElement();\n shouldPropagateMaster = propagateMaster;\n isPlaying = _videoElement.paused === false;\n room.on('disconnect', stopSyncLoop);\n room.on('removeLocalParticipant', stopSyncLoop);\n room.on('addLocalParticipant', handleAddLocalParticipant);\n room.on('addRemoteParticipant', handleAddRemoteParticipant);\n room.on('data', parseDataEvents);\n\n if (shouldPropagateMaster) {\n propagateMasterFunc().catch(() => {});\n }\n\n if (_videoElement && _videoElement.paused === false) {\n _videoElement.addEventListener('progress', () => {\n restartSyncLoop();\n }, {\n once: true\n });\n }\n\n _videoElement.addEventListener('timeupdate', stalledGenerator);\n\n _videoElement.addEventListener('playing', handlePlaying);\n\n _videoElement.addEventListener('pause', handlePause);\n },\n destroy: () => {\n stopSyncLoop();\n room.off('disconnect', stopSyncLoop);\n room.off('removeLocalParticipant', stopSyncLoop);\n room.off('addLocalParticipant', handleAddLocalParticipant);\n room.off('addRemoteParticipant', handleAddRemoteParticipant);\n room.off('data', parseDataEvents);\n\n if (_videoElement) {\n _videoElement.removeEventListener('timeupdate', stalledGenerator);\n\n _videoElement.removeEventListener('playing', handlePlaying);\n\n _videoElement.removeEventListener('pause', handlePause);\n }\n\n _libraryInstance = null;\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (syncDoris);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/sync-modules/sync-doris.js?");
|
|
9275
9320
|
|
|
9276
9321
|
/***/ }),
|
|
9277
9322
|
|
|
@@ -9283,7 +9328,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_
|
|
|
9283
9328
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9284
9329
|
|
|
9285
9330
|
"use strict";
|
|
9286
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../wt-utils */ \"./src/modules/wt-utils.js\");\n\n\nconst syncVodHlsJs = function () {\n let {\n room,\n wt,\n roomSession,\n emitter\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n //SYNC VARS\n let _libraryInstance = null;\n let _videoElement = null;\n let _roomId = null;\n let _syncDisabled = false;\n const syncDefaultWaitTime = 60000;\n const syncShortWaitTime = 10000;\n const maxSyncThreshold = 0.5;\n const maxSyncTries = 3;\n let currentSyncRetry = 0;\n let syncWaitId = null;\n let syncNextWaitTime = null;\n let stopFlag = false;\n let isSyncing = false;\n let seekingDebounceId = null;\n let seekingDebounceTimeout = 300;\n let isPlaying = false;\n let isProgrammaticallySeeked = false;\n let isForcedMaster = false;\n\n const startSyncLoop = () => {\n if (_syncDisabled) {\n room._log('--- Sync loop will not start due to sync force disabled ---');\n\n return;\n }\n\n if (!isConnected()) {\n room._log('--- Sync loop will not start due to user not connected yet ---');\n\n return;\n }\n\n if (syncWaitId) {\n room._log('--- Sync loop already running ---');\n\n return;\n }\n\n room._log('--- Sync enabled ---');\n\n stopFlag = false;\n\n const loop = () => {\n isSyncing = true;\n emitter.emit('playerSyncing', true);\n sync().finally(() => {\n isSyncing = false;\n emitter.emit('playerSyncing', false);\n\n if (isConnected() && !stopFlag) {\n syncWaitId = setTimeout(loop, syncNextWaitTime);\n } else {\n room._log('--- Automatic stop due to user not connected or stop flag enabled ---');\n\n stopSyncLoop();\n }\n });\n };\n\n loop();\n };\n\n const stopSyncLoop = () => {\n room._log('--- Sync disabled ---');\n\n clearTimeout(syncWaitId);\n syncWaitId = null;\n currentSyncRetry = 0;\n stopFlag = true;\n };\n\n const restartSyncLoop = () => {\n room._log('--- Sync restarting ---');\n\n stopSyncLoop();\n startSyncLoop();\n };\n\n const setNextWaitTime = function () {\n let didSyncFail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (!didSyncFail) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n currentSyncRetry++;\n\n if (currentSyncRetry > maxSyncTries) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n syncNextWaitTime = syncShortWaitTime;\n }\n }\n\n room._log('--- Next sync will occur in ' + syncNextWaitTime / 1000 + ' seconds ---');\n };\n\n const sync = () => {\n return getSyncData().then(syncData => {\n if (syncData.isMaster || stopFlag) {\n setNextWaitTime(false);\n return Promise.resolve();\n } else if (isForcedMaster) {\n setNextWaitTime(false);\n return propagateMasterFunc();\n } else {\n const syncStartTime = Date.now();\n const {\n position,\n isBufferSufficient\n } = calculateSyncDifferenceTime(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping);\n const currentPosition = getCurrentSegmentPosition() / 1000;\n\n if (syncData.masterFragmentSn) {\n playMedia();\n } else {\n pauseMedia();\n }\n\n if (position && Math.abs(position - currentPosition) <= maxSyncThreshold) {\n room._log(\"We're within max sync threshold, no need to resync now\");\n\n setNextWaitTime(false);\n return Promise.resolve();\n }\n\n if (position !== null) {\n return seekTo(position).then(() => {\n const seekDuration = (Date.now() - syncStartTime) / 1000;\n const syncPrecision = Math.abs(position + (isPlaying ? seekDuration : 0) - getCurrentSegmentPosition() / 1000);\n\n room._log(\"Insufficient buffer: \", !isBufferSufficient);\n\n room._log(\"Seek duration is \".concat(seekDuration));\n\n room._log(\"Sync precision should be \".concat(syncPrecision));\n\n const didSyncFail = syncPrecision > maxSyncThreshold;\n setNextWaitTime(didSyncFail);\n return Promise.resolve();\n }).catch(e => {\n setNextWaitTime(true);\n return Promise.reject(e);\n });\n } else {\n setNextWaitTime(true);\n return Promise.reject();\n }\n }\n }).catch(() => {\n setNextWaitTime(true);\n });\n };\n\n const handleAddLocalParticipant = () => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n\n if (_videoElement) {\n //TODO: shit fix ... data channel with other participant is not opened yet so we wait\n setTimeout(() => {\n _videoElement.addEventListener('progress', () => {\n restartSyncLoop();\n }, {\n once: true\n });\n }, 1000);\n }\n };\n\n const handleAddRemoteParticipant = () => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n };\n\n const handleRemoveRemoteParticipant = () => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n };\n\n const isConnected = () => {\n return room._isDataChannelOpen && room.isConnected;\n };\n\n const buffering = function (event) {\n let data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n if (data.details === 'bufferStalledError') {\n handleStalledWaiting();\n }\n };\n\n const executePlayerIotEvents = data => {\n let rid = _roomId || room.roomId;\n\n if (data.attributeName === 'playerReplay' && (!rid || (data === null || data === void 0 ? void 0 : data.roomId) === rid)) {\n seekTo(0).then(() => playMedia());\n }\n\n if (data.attributeName === 'playerPlay' && (!rid || (data === null || data === void 0 ? void 0 : data.roomId) === rid)) {\n playMedia();\n }\n\n if (data.attributeName === 'playerPause' && (!rid || (data === null || data === void 0 ? void 0 : data.roomId) === rid)) {\n pauseMedia();\n }\n };\n\n const parseIotEvents = data => {\n if (data.event === 'template_updated') {\n if (data.operation === 'multi') {\n (data.value || []).forEach(event => {\n if (event.operation === 'sendMessage') {\n executePlayerIotEvents({ ...event,\n roomId: data.roomId,\n userId: data.userId\n });\n }\n });\n }\n\n if (data.operation === 'sendMessage') {\n executePlayerIotEvents(data);\n }\n }\n };\n\n const parseDataEvents = function () {\n let msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (msg.videoroom === 'sync_source_set' && msg.wt_channel_id != \"\") {\n emitter.emit('changePlayerSource', msg.wt_channel_id);\n } else if (msg.videoroom === 'sync_request') {\n roomSyncSend(msg.sync_slave_id).catch(() => {});\n } else if (msg.videoroom === 'message') {\n // ignoring non studio commands if master\n if (isForcedMaster && msg.from !== null) {\n return;\n }\n\n if (_syncDisabled) {\n return;\n }\n\n if (msg.user_action === 'sync_seeking') {\n seekMedia(msg).catch(() => {});\n } else if (msg.user_action === 'sync_seeked') {} else if (msg.user_action === 'sync_play' || msg.action === 'sync_play') {\n playMedia();\n } else if (msg.user_action === 'sync_pause' || msg.action === 'sync_pause') {\n pauseMedia();\n }\n }\n };\n\n const getCurrentSegmentPosition = () => {\n let position = _videoElement && _videoElement.currentTime;\n return isNaN(position) ? 0 : position * 1000;\n };\n\n const calculateSyncDifferenceTime = function (fragmentSn) {\n let fragmentPos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n let ping = arguments.length > 2 ? arguments[2] : undefined;\n return {\n position: (fragmentPos + ping / 2) / 1000,\n isBufferSufficient: true\n };\n };\n\n const seekMedia = msg => {\n msg = {\n userId: msg.from,\n ...(msg.text && JSON.parse(msg.text))\n };\n\n if (msg.handleId !== room.handleId) {\n const {\n position,\n isBufferSufficient\n } = calculateSyncDifferenceTime(msg.fragment, msg.fragment_pos, 0); //TODO: right ping\n\n if (position) {\n return seekTo(position).then(() => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n });\n } else {\n return Promise.resolve();\n }\n } else {\n return Promise.resolve();\n }\n };\n\n const prePlay = () => {\n if (_videoElement.currentTime > 0 || _videoElement.paused === false) {\n return Promise.resolve();\n }\n\n isProgrammaticallySeeked = true;\n let wasMuted = _videoElement.muted;\n _videoElement.muted = true;\n return _videoElement.play().then(() => {\n _videoElement.pause();\n\n _videoElement.currentTime = 0;\n return Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"wait\"])(100);\n }).catch(() => true).finally(() => {\n _videoElement.muted = wasMuted;\n isProgrammaticallySeeked = false;\n return true;\n });\n };\n\n const playMedia = () => {\n if (_videoElement && _videoElement.paused) {\n isProgrammaticallySeeked = true;\n\n _videoElement.play().finally(() => {\n isProgrammaticallySeeked = false;\n });\n }\n };\n\n const pauseMedia = () => {\n if (_videoElement && !_videoElement.paused) {\n isProgrammaticallySeeked = true;\n\n _videoElement.addEventListener('pause', () => {\n isProgrammaticallySeeked = false;\n }, {\n once: true\n });\n\n _videoElement.pause();\n }\n };\n\n const seekTo = time => {\n return new Promise(resolve => {\n if (_videoElement.currentTime !== time) {\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _videoElement.addEventListener('seeked', () => {\n isProgrammaticallySeeked = false;\n resolve();\n }, {\n once: true\n });\n\n _videoElement.currentTime = time;\n } else resolve();\n });\n };\n\n const handlePlaying = () => {\n if (!isProgrammaticallySeeked) {\n roomSession.sendSystemMessage('sync_play', {\n timestamp: new Date().getTime(),\n handleId: room.handleId\n }, undefined, null).catch(() => {});\n }\n\n isPlaying = !_videoElement.paused;\n };\n\n const handlePause = () => {\n if (!isProgrammaticallySeeked) {\n roomSession.sendSystemMessage('sync_pause', {\n timestamp: new Date().getTime(),\n handleId: room.handleId\n }, undefined, null).catch(() => {});\n }\n\n isPlaying = !_videoElement.paused;\n };\n\n const handleStalledWaiting = () => {\n if (!isProgrammaticallySeeked) {\n clientPaused().catch(() => {});\n }\n };\n\n const handleSeeking = () => {\n clearTimeout(seekingDebounceId);\n\n if (!isProgrammaticallySeeked) {\n seekingDebounceId = setTimeout(() => {\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n roomSession.sendSystemMessage('sync_seeking', {\n timestamp: new Date().getTime(),\n handleId: room.handleId,\n fragment: \"0\",\n //isPlaying ? \"1\":\"0\",\n fragment_pos: Number(fragmentPosition)\n }, undefined, null).catch(() => {});\n\n if (!isForcedMaster && !_syncDisabled) {\n pauseMedia();\n }\n }, seekingDebounceTimeout);\n }\n };\n\n const handleSeeked = () => {};\n\n const handleEnded = () => {};\n\n const roomSyncSend = slaveId => {\n if (!_videoElement) {\n room._log(\"I've been asked for position even if we don't have player attached.\\n Does it mean I'm the master?\");\n\n return Promise.resolve();\n }\n\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n\n room._log(\"Sending my position to \".concat(slaveId));\n\n room._log(\"Current time: \".concat(fragmentPosition));\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_response\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: isPlaying ? \"1\" : \"0\",\n fragment_pos: Number(fragmentPosition),\n slave_id: room.webrtcVersion > 1000 ? String(slaveId) : Number(slaveId)\n }\n });\n };\n\n const getSyncData = () => {\n room._log('Sending roomSync request');\n\n let roomId = room.roomId;\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n return new Promise((resolve, reject) => {\n let now = new Date().getTime();\n let ping = null;\n let sid = setTimeout(() => {\n room.off('data', fn, this);\n reject('Timeout');\n }, 3000);\n let body = {\n request: \"sync\",\n room: roomId,\n timestamp: new Date().getTime(),\n fragment: isPlaying ? \"1\" : \"0\",\n fragment_pos: Number(fragmentPosition)\n };\n\n let fn = msg => {\n if (msg.videoroom && ['sync', 'sync_response'].includes(msg.videoroom)) {\n if (msg.sync_master_await) {\n room._log('Waiting for master position');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n } else if (msg.sync_master_fragment || msg.sync_master_fragment_pos) {\n room._log('Got master position data');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n\n room._log(\"I'm master: \".concat(!!msg.sync_master_self));\n\n room._log(\"Ping: \".concat(ping));\n\n room._log(\"Master fragment: \".concat(msg.sync_master_fragment));\n\n room._log(\"Master fragment position: \".concat(msg.sync_master_fragment_pos));\n\n room.off('data', fn, this);\n clearTimeout(sid);\n resolve({\n isMaster: !!msg.sync_master_self,\n ping: ping,\n masterFragmentPos: parseInt(msg.sync_master_fragment_pos),\n masterFragmentSn: parseInt(msg.sync_master_fragment)\n });\n } else {\n clearTimeout(sid);\n reject('Master lost connection');\n }\n }\n };\n\n room.on('data', fn, this);\n room.sendMessage(room.handleId, {\n body\n }).then(fn).catch(e => {\n room.off('data', fn, this);\n clearTimeout(sid);\n reject(e);\n });\n });\n };\n\n const clientPaused = () => {\n room._log('Sending client paused');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_paused\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: '0',\n fragment_pos: 0\n }\n });\n };\n\n const propagateMasterFunc = () => {\n room._log('Propagating master');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_source_set\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n wt_channel_id: \"\",\n fragment: \"0\",\n fragment_pos: 0\n }\n });\n };\n\n return {\n __events: ['playerSyncing'],\n initialize: function () {\n let {\n hlsInstance,\n libraryInstance,\n propagateMaster = false,\n isStudio = false,\n roomId,\n syncDisabled\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _libraryInstance = hlsInstance || libraryInstance; // backwards comp;\n\n _videoElement = _libraryInstance.media;\n _roomId = roomId;\n _syncDisabled = syncDisabled;\n\n if (!_libraryInstance) {\n room._log('No hls.js player instance!');\n\n return;\n }\n\n emitter.emit('playerSyncing', false);\n isForcedMaster = propagateMaster;\n isPlaying = _videoElement.paused === false;\n room.on('disconnect', stopSyncLoop);\n room.on('addLocalParticipant', handleAddLocalParticipant);\n room.on('removeLocalParticipant', stopSyncLoop);\n room.on('addRemoteParticipant', handleAddRemoteParticipant);\n room.on('removeRemoteParticipant', handleRemoveRemoteParticipant);\n room.on('data', parseDataEvents);\n wt.iot.$on('message', parseIotEvents);\n\n if (isForcedMaster) {\n propagateMasterFunc().catch(() => {});\n }\n\n if (_libraryInstance && _videoElement) {\n (propagateMaster || isStudio ? Promise.resolve() : prePlay()).then(() => {\n _libraryInstance.on('hlsError', buffering);\n\n _videoElement.addEventListener('playing', handlePlaying);\n\n _videoElement.addEventListener('pause', handlePause);\n\n _videoElement.addEventListener('seeking', handleSeeking);\n\n _videoElement.addEventListener('seeked', handleSeeked);\n\n _videoElement.addEventListener('ended', handleEnded);\n\n startSyncLoop();\n });\n }\n },\n destroy: () => {\n stopSyncLoop();\n room.off('disconnect', stopSyncLoop);\n room.off('addLocalParticipant', handleAddLocalParticipant);\n room.off('removeLocalParticipant', stopSyncLoop);\n room.off('addRemoteParticipant', handleAddRemoteParticipant);\n room.off('removeRemoteParticipant', handleRemoveRemoteParticipant);\n room.off('data', parseDataEvents);\n wt.iot.$off('message', parseIotEvents);\n\n if (_libraryInstance) {\n _libraryInstance.off('hlsError', buffering);\n }\n\n if (_videoElement) {\n _videoElement.removeEventListener('playing', handlePlaying);\n\n _videoElement.removeEventListener('pause', handlePause);\n\n _videoElement.removeEventListener('seeking', handleSeeking);\n\n _videoElement.removeEventListener('seeked', handleSeeked);\n\n _videoElement.removeEventListener('ended', handleEnded);\n }\n\n _libraryInstance = null;\n _videoElement = null;\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (syncVodHlsJs);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/sync-modules/sync-hls-vod.js?");
|
|
9331
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../wt-utils */ \"./src/modules/wt-utils.js\");\n\n\nconst syncVodHlsJs = function () {\n let {\n room,\n wt,\n roomSession,\n emitter\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n //SYNC VARS\n let _libraryInstance = null;\n let _videoElement = null;\n let _roomId = null;\n let _syncDisabled = false;\n const syncDefaultWaitTime = 60000;\n const syncShortWaitTime = 10000;\n const maxSyncThreshold = 0.5;\n const maxSyncTries = 3;\n let currentSyncRetry = 0;\n let syncWaitId = null;\n let syncNextWaitTime = null;\n let stopFlag = false;\n let isSyncing = false;\n let seekingDebounceId = null;\n let seekingDebounceTimeout = 300;\n let isPlaying = false;\n let isProgrammaticallySeeked = false;\n let isForcedMaster = false;\n\n const startSyncLoop = () => {\n if (_syncDisabled) {\n room._log('--- Sync loop will not start due to sync force disabled ---');\n\n return;\n }\n\n if (!isConnected()) {\n room._log('--- Sync loop will not start due to user not connected yet ---');\n\n return;\n }\n\n if (syncWaitId) {\n room._log('--- Sync loop already running ---');\n\n return;\n }\n\n room._log('--- Sync enabled ---');\n\n stopFlag = false;\n\n const loop = () => {\n isSyncing = true;\n emitter.emit('playerSyncing', true);\n sync().finally(() => {\n isSyncing = false;\n emitter.emit('playerSyncing', false);\n\n if (isConnected() && !stopFlag) {\n syncWaitId = setTimeout(loop, syncNextWaitTime);\n } else {\n room._log('--- Automatic stop due to user not connected or stop flag enabled ---');\n\n stopSyncLoop();\n }\n });\n };\n\n loop();\n };\n\n const stopSyncLoop = () => {\n room._log('--- Sync disabled ---');\n\n clearTimeout(syncWaitId);\n syncWaitId = null;\n currentSyncRetry = 0;\n stopFlag = true;\n };\n\n const restartSyncLoop = () => {\n room._log('--- Sync restarting ---');\n\n stopSyncLoop();\n startSyncLoop();\n };\n\n const setNextWaitTime = function () {\n let didSyncFail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (!didSyncFail) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n currentSyncRetry++;\n\n if (currentSyncRetry > maxSyncTries) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n syncNextWaitTime = syncShortWaitTime;\n }\n }\n\n room._log('--- Next sync will occur in ' + syncNextWaitTime / 1000 + ' seconds ---');\n };\n\n const sync = () => {\n return getSyncData().then(syncData => {\n if (syncData.isMaster || stopFlag) {\n setNextWaitTime(false);\n return Promise.resolve();\n } else if (isForcedMaster) {\n setNextWaitTime(false);\n return propagateMasterFunc();\n } else {\n const syncStartTime = Date.now();\n const {\n position,\n isBufferSufficient\n } = calculateSyncDifferenceTime(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping);\n const currentPosition = getCurrentSegmentPosition() / 1000;\n\n if (syncData.masterFragmentSn) {\n playMedia();\n } else {\n pauseMedia();\n }\n\n if (position && Math.abs(position - currentPosition) <= maxSyncThreshold) {\n room._log(`We're within max sync threshold, no need to resync now`);\n\n setNextWaitTime(false);\n return Promise.resolve();\n }\n\n if (position !== null) {\n return seekTo(position).then(() => {\n const seekDuration = (Date.now() - syncStartTime) / 1000;\n const syncPrecision = Math.abs(position + (isPlaying ? seekDuration : 0) - getCurrentSegmentPosition() / 1000);\n\n room._log(`Insufficient buffer: `, !isBufferSufficient);\n\n room._log(`Seek duration is ${seekDuration}`);\n\n room._log(`Sync precision should be ${syncPrecision}`);\n\n const didSyncFail = syncPrecision > maxSyncThreshold;\n setNextWaitTime(didSyncFail);\n return Promise.resolve();\n }).catch(e => {\n setNextWaitTime(true);\n return Promise.reject(e);\n });\n } else {\n setNextWaitTime(true);\n return Promise.reject();\n }\n }\n }).catch(() => {\n setNextWaitTime(true);\n });\n };\n\n const handleAddLocalParticipant = () => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n\n if (_videoElement) {\n //TODO: shit fix ... data channel with other participant is not opened yet so we wait\n setTimeout(() => {\n _videoElement.addEventListener('progress', () => {\n restartSyncLoop();\n }, {\n once: true\n });\n }, 1000);\n }\n };\n\n const handleAddRemoteParticipant = () => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n };\n\n const handleRemoveRemoteParticipant = () => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n };\n\n const isConnected = () => {\n return room._isDataChannelOpen && room.isConnected;\n };\n\n const buffering = function (event) {\n let data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n if (data.details === 'bufferStalledError') {\n handleStalledWaiting();\n }\n };\n\n const executePlayerIotEvents = data => {\n let rid = _roomId || room.roomId;\n\n if (data.attributeName === 'playerReplay' && (!rid || (data === null || data === void 0 ? void 0 : data.roomId) === rid)) {\n seekTo(0).then(() => playMedia());\n }\n\n if (data.attributeName === 'playerPlay' && (!rid || (data === null || data === void 0 ? void 0 : data.roomId) === rid)) {\n playMedia();\n }\n\n if (data.attributeName === 'playerPause' && (!rid || (data === null || data === void 0 ? void 0 : data.roomId) === rid)) {\n pauseMedia();\n }\n };\n\n const parseIotEvents = data => {\n if (data.event === 'template_updated') {\n if (data.operation === 'multi') {\n (data.value || []).forEach(event => {\n if (event.operation === 'sendMessage') {\n executePlayerIotEvents({ ...event,\n roomId: data.roomId,\n userId: data.userId\n });\n }\n });\n }\n\n if (data.operation === 'sendMessage') {\n executePlayerIotEvents(data);\n }\n }\n };\n\n const parseDataEvents = function () {\n let msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (msg.videoroom === 'sync_source_set' && msg.wt_channel_id != \"\") {\n emitter.emit('changePlayerSource', msg.wt_channel_id);\n } else if (msg.videoroom === 'sync_request') {\n roomSyncSend(msg.sync_slave_id).catch(() => {});\n } else if (msg.videoroom === 'message') {\n // ignoring non studio commands if master\n if (isForcedMaster && msg.from !== null) {\n return;\n }\n\n if (_syncDisabled) {\n return;\n }\n\n if (msg.user_action === 'sync_seeking') {\n seekMedia(msg).catch(() => {});\n } else if (msg.user_action === 'sync_seeked') {} else if (msg.user_action === 'sync_play' || msg.action === 'sync_play') {\n playMedia();\n } else if (msg.user_action === 'sync_pause' || msg.action === 'sync_pause') {\n pauseMedia();\n }\n }\n };\n\n const getCurrentSegmentPosition = () => {\n let position = _videoElement && _videoElement.currentTime;\n return isNaN(position) ? 0 : position * 1000;\n };\n\n const calculateSyncDifferenceTime = function (fragmentSn) {\n let fragmentPos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n let ping = arguments.length > 2 ? arguments[2] : undefined;\n return {\n position: (fragmentPos + ping / 2) / 1000,\n isBufferSufficient: true\n };\n };\n\n const seekMedia = msg => {\n msg = {\n userId: msg.from,\n ...(msg.text && JSON.parse(msg.text))\n };\n\n if (msg.handleId !== room.handleId) {\n const {\n position,\n isBufferSufficient\n } = calculateSyncDifferenceTime(msg.fragment, msg.fragment_pos, 0); //TODO: right ping\n\n if (position) {\n return seekTo(position).then(() => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n });\n } else {\n return Promise.resolve();\n }\n } else {\n return Promise.resolve();\n }\n };\n\n const prePlay = () => {\n if (_videoElement.currentTime > 0 || _videoElement.paused === false) {\n return Promise.resolve();\n }\n\n isProgrammaticallySeeked = true;\n let wasMuted = _videoElement.muted;\n _videoElement.muted = true;\n return _videoElement.play().then(() => {\n _videoElement.pause();\n\n _videoElement.currentTime = 0;\n return Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"wait\"])(100);\n }).catch(() => true).finally(() => {\n _videoElement.muted = wasMuted;\n isProgrammaticallySeeked = false;\n return true;\n });\n };\n\n const playMedia = () => {\n if (_videoElement && _videoElement.paused) {\n isProgrammaticallySeeked = true;\n\n _videoElement.play().finally(() => {\n isProgrammaticallySeeked = false;\n });\n }\n };\n\n const pauseMedia = () => {\n if (_videoElement && !_videoElement.paused) {\n isProgrammaticallySeeked = true;\n\n _videoElement.addEventListener('pause', () => {\n isProgrammaticallySeeked = false;\n }, {\n once: true\n });\n\n _videoElement.pause();\n }\n };\n\n const seekTo = time => {\n return new Promise(resolve => {\n if (_videoElement.currentTime !== time) {\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _videoElement.addEventListener('seeked', () => {\n isProgrammaticallySeeked = false;\n resolve();\n }, {\n once: true\n });\n\n _videoElement.currentTime = time;\n } else resolve();\n });\n };\n\n const handlePlaying = () => {\n if (!isProgrammaticallySeeked) {\n roomSession.sendSystemMessage('sync_play', {\n timestamp: new Date().getTime(),\n handleId: room.handleId\n }, undefined, null).catch(() => {});\n }\n\n isPlaying = !_videoElement.paused;\n };\n\n const handlePause = () => {\n if (!isProgrammaticallySeeked) {\n roomSession.sendSystemMessage('sync_pause', {\n timestamp: new Date().getTime(),\n handleId: room.handleId\n }, undefined, null).catch(() => {});\n }\n\n isPlaying = !_videoElement.paused;\n };\n\n const handleStalledWaiting = () => {\n if (!isProgrammaticallySeeked) {\n clientPaused().catch(() => {});\n }\n };\n\n const handleSeeking = () => {\n clearTimeout(seekingDebounceId);\n\n if (!isProgrammaticallySeeked) {\n seekingDebounceId = setTimeout(() => {\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n roomSession.sendSystemMessage('sync_seeking', {\n timestamp: new Date().getTime(),\n handleId: room.handleId,\n fragment: \"0\",\n //isPlaying ? \"1\":\"0\",\n fragment_pos: Number(fragmentPosition)\n }, undefined, null).catch(() => {});\n\n if (!isForcedMaster && !_syncDisabled) {\n pauseMedia();\n }\n }, seekingDebounceTimeout);\n }\n };\n\n const handleSeeked = () => {};\n\n const handleEnded = () => {};\n\n const roomSyncSend = slaveId => {\n if (!_videoElement) {\n room._log(`I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?`);\n\n return Promise.resolve();\n }\n\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n\n room._log(`Sending my position to ${slaveId}`);\n\n room._log(`Current time: ${fragmentPosition}`);\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_response\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: isPlaying ? \"1\" : \"0\",\n fragment_pos: Number(fragmentPosition),\n slave_id: room.webrtcVersion > 1000 ? String(slaveId) : Number(slaveId)\n }\n });\n };\n\n const getSyncData = () => {\n room._log('Sending roomSync request');\n\n let roomId = room.roomId;\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n return new Promise((resolve, reject) => {\n let now = new Date().getTime();\n let ping = null;\n let sid = setTimeout(() => {\n room.off('data', fn, this);\n reject('Timeout');\n }, 3000);\n let body = {\n request: \"sync\",\n room: roomId,\n timestamp: new Date().getTime(),\n fragment: isPlaying ? \"1\" : \"0\",\n fragment_pos: Number(fragmentPosition)\n };\n\n let fn = msg => {\n if (msg.videoroom && ['sync', 'sync_response'].includes(msg.videoroom)) {\n if (msg.sync_master_await) {\n room._log('Waiting for master position');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n } else if (msg.sync_master_fragment || msg.sync_master_fragment_pos) {\n room._log('Got master position data');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n\n room._log(`I'm master: ${!!msg.sync_master_self}`);\n\n room._log(`Ping: ${ping}`);\n\n room._log(`Master fragment: ${msg.sync_master_fragment}`);\n\n room._log(`Master fragment position: ${msg.sync_master_fragment_pos}`);\n\n room.off('data', fn, this);\n clearTimeout(sid);\n resolve({\n isMaster: !!msg.sync_master_self,\n ping: ping,\n masterFragmentPos: parseInt(msg.sync_master_fragment_pos),\n masterFragmentSn: parseInt(msg.sync_master_fragment)\n });\n } else {\n clearTimeout(sid);\n reject('Master lost connection');\n }\n }\n };\n\n room.on('data', fn, this);\n room.sendMessage(room.handleId, {\n body\n }).then(fn).catch(e => {\n room.off('data', fn, this);\n clearTimeout(sid);\n reject(e);\n });\n });\n };\n\n const clientPaused = () => {\n room._log('Sending client paused');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_paused\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: '0',\n fragment_pos: 0\n }\n });\n };\n\n const propagateMasterFunc = () => {\n room._log('Propagating master');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_source_set\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n wt_channel_id: \"\",\n fragment: \"0\",\n fragment_pos: 0\n }\n });\n };\n\n return {\n __events: ['playerSyncing'],\n initialize: function () {\n let {\n hlsInstance,\n libraryInstance,\n propagateMaster = false,\n isStudio = false,\n roomId,\n syncDisabled\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _libraryInstance = hlsInstance || libraryInstance; // backwards comp;\n\n _videoElement = _libraryInstance.media;\n _roomId = roomId;\n _syncDisabled = syncDisabled;\n\n if (!_libraryInstance) {\n room._log('No hls.js player instance!');\n\n return;\n }\n\n emitter.emit('playerSyncing', false);\n isForcedMaster = propagateMaster;\n isPlaying = _videoElement.paused === false;\n room.on('disconnect', stopSyncLoop);\n room.on('addLocalParticipant', handleAddLocalParticipant);\n room.on('removeLocalParticipant', stopSyncLoop);\n room.on('addRemoteParticipant', handleAddRemoteParticipant);\n room.on('removeRemoteParticipant', handleRemoveRemoteParticipant);\n room.on('data', parseDataEvents);\n wt.iot.$on('message', parseIotEvents);\n\n if (isForcedMaster) {\n propagateMasterFunc().catch(() => {});\n }\n\n if (_libraryInstance && _videoElement) {\n (propagateMaster || isStudio ? Promise.resolve() : prePlay()).then(() => {\n _libraryInstance.on('hlsError', buffering);\n\n _videoElement.addEventListener('playing', handlePlaying);\n\n _videoElement.addEventListener('pause', handlePause);\n\n _videoElement.addEventListener('seeking', handleSeeking);\n\n _videoElement.addEventListener('seeked', handleSeeked);\n\n _videoElement.addEventListener('ended', handleEnded);\n\n startSyncLoop();\n });\n }\n },\n destroy: () => {\n stopSyncLoop();\n room.off('disconnect', stopSyncLoop);\n room.off('addLocalParticipant', handleAddLocalParticipant);\n room.off('removeLocalParticipant', stopSyncLoop);\n room.off('addRemoteParticipant', handleAddRemoteParticipant);\n room.off('removeRemoteParticipant', handleRemoveRemoteParticipant);\n room.off('data', parseDataEvents);\n wt.iot.$off('message', parseIotEvents);\n\n if (_libraryInstance) {\n _libraryInstance.off('hlsError', buffering);\n }\n\n if (_videoElement) {\n _videoElement.removeEventListener('playing', handlePlaying);\n\n _videoElement.removeEventListener('pause', handlePause);\n\n _videoElement.removeEventListener('seeking', handleSeeking);\n\n _videoElement.removeEventListener('seeked', handleSeeked);\n\n _videoElement.removeEventListener('ended', handleEnded);\n }\n\n _libraryInstance = null;\n _videoElement = null;\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (syncVodHlsJs);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/sync-modules/sync-hls-vod.js?");
|
|
9287
9332
|
|
|
9288
9333
|
/***/ }),
|
|
9289
9334
|
|
|
@@ -9295,7 +9340,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_
|
|
|
9295
9340
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9296
9341
|
|
|
9297
9342
|
"use strict";
|
|
9298
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../wt-utils */ \"./src/modules/wt-utils.js\");\n/*\n * TODO:\n * Sync we get\n * machineTimestamp = now\n * ping = (endRequestTimestamp - startRequestTimestamp) / 2\n * clockDifference = (serverTimestamp - machineTimestamp - ping)\n *\n *\n * usable vars : (now +- clockDifference) === currentServerTimestamp ---> when event was received\n * : (otherMachineTimestamp +- otherMachineClockDifference) === currentServerTimestamp ---> when event was sent\n *\n *\n * ping: (this user currentServerTimestamp a.k.a when event was received) - (remote user currentServerTimestamp a.k.a. when event was sent )\n *\n *\n * */\n\n\nconst syncHlsJs = function () {\n let {\n room,\n wt,\n roomSession,\n emitter\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n //SYNC VARS\n let _libraryInstance = null;\n let _videoElement = null;\n let currentFragmentSn = null;\n const syncDefaultWaitTime = 60000;\n const syncShortWaitTime = 10000;\n const maxSyncThreshold = 0.5;\n const maxSyncTries = 3;\n let currentSyncRetry = 0;\n let syncWaitId = null;\n let syncNextWaitTime = null;\n let stopFlag = false;\n let isSyncing = false;\n let playbackRate = 2;\n let isPlaying = false;\n let isPreloading = true;\n let isProgrammaticallySeeked = false;\n let shouldPropagateMaster = false;\n\n const startSyncLoop = () => {\n if (!isConnected()) {\n room._log('--- Sync loop will not start due to user not connected yet ---');\n\n return;\n }\n\n if (syncWaitId) {\n room._log('--- Sync loop already running ---');\n\n return;\n }\n\n room._log('--- Sync enabled ---');\n\n stopFlag = false;\n\n const loop = () => {\n isSyncing = true;\n emitter.emit('playerSyncing', true);\n sync().finally(() => {\n isSyncing = false;\n emitter.emit('playerSyncing', false);\n\n if (isConnected() && !stopFlag) {\n syncWaitId = setTimeout(loop, syncNextWaitTime);\n } else {\n room._log('--- Automatic stop due to user not connected or stop flag enabled ---');\n\n stopSyncLoop();\n }\n });\n };\n\n loop();\n };\n\n const stopSyncLoop = () => {\n room._log('--- Sync disabled ---');\n\n clearTimeout(syncWaitId);\n syncWaitId = null;\n currentSyncRetry = 0;\n stopFlag = true;\n };\n\n const restartSyncLoop = () => {\n room._log('--- Sync restarting ---');\n\n stopSyncLoop();\n startSyncLoop();\n };\n\n const setNextWaitTime = function () {\n let didSyncFail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (!didSyncFail) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n currentSyncRetry++;\n\n if (currentSyncRetry > maxSyncTries) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n syncNextWaitTime = syncShortWaitTime;\n }\n }\n\n room._log('--- Next sync will occur in ' + syncNextWaitTime / 1000 + ' seconds ---');\n };\n\n const sync = () => {\n return getSyncData().then(syncData => {\n if (syncData.isMaster) {\n if (_videoElement.paused) _videoElement.play();\n setNextWaitTime(false);\n return Promise.resolve();\n } else if (shouldPropagateMaster) {\n setNextWaitTime(false);\n return propagateMasterFunc();\n } else {\n const syncStartTime = Date.now();\n const {\n position,\n isBufferSufficient\n } = calculateSyncDifferenceTime(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping);\n\n if (position && Math.abs(position) <= maxSyncThreshold) {\n room._log(\"We're within max sync threshold, no need to resync now\");\n\n setNextWaitTime(false);\n return Promise.resolve();\n }\n\n if (position !== null) {\n return seekBy(position).then(() => {\n const seekDuration = Date.now() - syncStartTime;\n const {\n position,\n isBufferSufficient\n } = calculateSyncDifferenceTime(syncData.masterFragmentSn, syncData.masterFragmentPos + seekDuration, syncData.ping);\n const syncPrecision = Math.abs(position);\n\n room._log(\"Insufficient buffer: \", !isBufferSufficient);\n\n room._log(\"Seek duration is \".concat(seekDuration / 1000));\n\n room._log(\"Sync precision should be \".concat(syncPrecision));\n\n const didSyncFail = syncPrecision > maxSyncThreshold;\n setNextWaitTime(didSyncFail);\n return Promise.resolve();\n }).catch(e => {\n setNextWaitTime(true);\n return Promise.reject(e);\n });\n } else {\n setNextWaitTime(true);\n return Promise.reject();\n }\n }\n }).catch(() => {\n setNextWaitTime(true);\n return Promise.reject();\n });\n };\n\n const handleAddLocalParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n\n if (_videoElement && _videoElement.paused === false) {\n _videoElement.addEventListener('progress', () => {\n restartSyncLoop();\n }, {\n once: true\n });\n }\n };\n\n const handleAddRemoteParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n };\n\n const isConnected = () => {\n return room._isDataChannelOpen && room.isConnected;\n };\n\n const buffering = function (event) {\n let data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n if (data.details === 'bufferStalledError') {\n handleStalledWaiting();\n }\n };\n\n const hlsFragChanged = (event, data) => {\n currentFragmentSn = data.frag.sn;\n };\n\n const parseDataEvents = function () {\n let msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (msg.videoroom === 'sync_source_set' && msg.wt_channel_id != \"\") {\n emitter.emit('changePlayerSource', msg.wt_channel_id);\n } else if (msg.videoroom === 'sync_request') {\n roomSyncSend(msg.sync_slave_id).catch(() => {});\n }\n };\n\n const getCurrentSegmentPosition = () => {\n var _currentFragment$body;\n\n let fragments = _libraryInstance.streamController.fragmentTracker.fragments;\n\n if (!fragments) {\n return 0;\n }\n\n let currentFragment = fragments[Object.keys(fragments).find(key => key.indexOf(currentFragmentSn) > -1)];\n\n if (!currentFragment) {\n return 0;\n }\n\n return Math.max((_libraryInstance.streamController.lastCurrentTime - (((_currentFragment$body = currentFragment.body) === null || _currentFragment$body === void 0 ? void 0 : _currentFragment$body.startPTS) || 0)) * 1000, 0);\n };\n\n const calculateSyncDifferenceTime = (masterFragmentSn, masterFragmentPos, ping) => {\n var _currentFragment$body2;\n\n let fragments = _libraryInstance.streamController.fragmentTracker.fragments;\n let fragmentNumbers = Object.keys(fragments).map(key => parseInt(key.slice(key.lastIndexOf('_') + 1))).sort(function (a, b) {\n return a - b;\n }); // our position in fragment\n //let currentFragmentSn = currentFragmentSn;\n\n let currentFragment = fragments[Object.keys(fragments).find(key => key.indexOf(currentFragmentSn) > -1)];\n\n if (!currentFragment) {\n room._log('Current fragment not found, what now?', currentFragmentSn);\n\n return {\n position: null,\n isBufferSufficient: false\n };\n }\n\n let currentFragmentPos = Math.max((_libraryInstance.streamController.lastCurrentTime - (((_currentFragment$body2 = currentFragment.body) === null || _currentFragment$body2 === void 0 ? void 0 : _currentFragment$body2.startPTS) || 0)) * 1000, 0);\n let currentFragmentLength = currentFragment.body.duration * 1000;\n\n room._log(\"Our current fragment is: \".concat(currentFragmentSn));\n\n room._log(\"Our current fragment position is: \".concat(currentFragmentPos));\n\n room._log(\"Our current fragment length is: \".concat(currentFragmentLength)); // real server fragment\n\n\n let realMasterFragmentSn = masterFragmentSn; // real server position in fragment\n\n let realMasterFragmentPos = Math.max(ping / 2 + masterFragmentPos, 0); // simple flag\n\n let isBufferSufficient = false;\n /* Searching for fragment and in-fragment position when taking all delays into account */\n\n let relevantFragmentNumbers = fragmentNumbers.indexOf(masterFragmentSn) > -1 ? fragmentNumbers.slice(fragmentNumbers.indexOf(masterFragmentSn)) : [];\n\n for (let i = 0, len = relevantFragmentNumbers.length; i < len; i++) {\n let sn = relevantFragmentNumbers[i];\n let fragment = fragments[Object.keys(fragments).find(key => key.indexOf(sn) > -1)];\n let fragmentDuration = fragment.body.duration * 1000;\n\n room._log(\"Correction diff: \".concat(realMasterFragmentPos - fragmentDuration));\n\n realMasterFragmentSn = sn;\n\n if (realMasterFragmentPos - fragmentDuration > 0) {\n room._log(\"Not enough at fragment \".concat(sn));\n\n realMasterFragmentPos -= fragmentDuration;\n } else {\n room._log(\"Enough at fragment \".concat(sn));\n\n isBufferSufficient = true;\n break;\n }\n } // We're not ready yet\n\n\n if (!isBufferSufficient) {\n room._log(\"We don't have required fragment \".concat(realMasterFragmentSn, \" yet\"));\n\n return {\n position: null,\n isBufferSufficient: false\n };\n } // We are too ahead\n\n\n if (realMasterFragmentSn < currentFragmentSn) {\n room._log(\"We are ahead of master...\");\n\n room._log(\"Real master fragment: \".concat(realMasterFragmentSn));\n\n room._log(\"Our fragment: \".concat(currentFragmentSn));\n\n let seekTime = currentFragmentPos - realMasterFragmentPos;\n let relevantFragmentNumbers = fragmentNumbers.slice(fragmentNumbers.indexOf(realMasterFragmentSn));\n\n for (let i = 0, len = relevantFragmentNumbers.length; i < len; i++) {\n let sn = relevantFragmentNumbers[i];\n let fragment = fragments[Object.keys(fragments).find(key => key.indexOf(sn) > -1)];\n let fragmentDuration = fragment.body.duration * 1000;\n\n if (sn >= currentFragmentSn) {\n break;\n }\n\n seekTime += fragmentDuration;\n }\n\n room._log(\"Sync difference is: \".concat(seekTime));\n\n return {\n position: seekTime / 1000 * -1,\n isBufferSufficient: true\n };\n } // We are behind or spot on\n else {\n room._log(\"We're behind or spot on master...\");\n\n room._log(\"Real master fragment: \".concat(realMasterFragmentSn));\n\n room._log(\"Our fragment: \".concat(currentFragmentSn));\n\n let seekTime = realMasterFragmentPos - currentFragmentPos;\n let relevantFragmentNumbers = fragmentNumbers.slice(fragmentNumbers.indexOf(currentFragmentSn));\n\n for (let i = 0, len = relevantFragmentNumbers.length; i < len; i++) {\n let sn = relevantFragmentNumbers[i];\n let fragment = fragments[Object.keys(fragments).find(key => key.indexOf(sn) > -1)];\n let fragmentDuration = fragment.body.duration * 1000;\n\n if (sn >= realMasterFragmentSn) {\n break;\n }\n\n seekTime += fragmentDuration;\n }\n\n room._log(\"We can proceed with seek time: \".concat(seekTime));\n\n return {\n position: seekTime / 1000,\n isBufferSufficient: true\n };\n }\n };\n\n const seekBy = time => {\n //https://mcorp.no/lib/mediasync.js\n return new Promise((resolve, reject) => {\n if (time !== 0) {\n if (time > 0 && time < 4) {\n room._log(\"Fast forward to seek...\");\n\n let wasPaused = false;\n\n let __ = () => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false;\n reject('Stalled');\n };\n\n let diff = time; // _videoElement.addEventListener('waiting', __, {once:true});\n\n _videoElement.addEventListener('stalled', __, {\n once: true\n });\n\n Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"setExactTimeout\"])(() => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false; // _videoElement.removeEventListener('waiting', __, {once:true});\n\n _videoElement.removeEventListener('stalled', __, {\n once: true\n });\n\n resolve();\n }, diff * 1000 / (playbackRate - 1), 20);\n isProgrammaticallySeeked = true;\n\n if (_videoElement.paused) {\n wasPaused = true;\n\n _videoElement.play().then(() => {\n _videoElement.playbackRate = playbackRate;\n });\n } else {\n _videoElement.playbackRate = playbackRate;\n }\n } else {\n room._log(\"Jump to seek...\");\n\n let __ = Date.now();\n\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _videoElement.addEventListener('playing', () => {\n room._log(\"It took the player \".concat((Date.now() - __) / 1000, \" seconds to seek \"));\n\n isProgrammaticallySeeked = false;\n resolve();\n }, {\n once: true\n });\n\n _videoElement.currentTime += time;\n }\n } else resolve();\n });\n };\n\n const seekTo = time => {\n //https://webtiming.github.io/timingsrc/ use this\n //https://mcorp.no/lib/mediasync.js\n return new Promise((resolve, reject) => {\n if (_videoElement.currentTime !== time) {\n let diff = time - _videoElement.currentTime;\n\n if (_videoElement.currentTime < time && diff < 4) {\n room._log(\"Fast forward to seek...\");\n\n let wasPaused = false;\n\n let __ = () => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false;\n reject('Stalled');\n }; // _videoElement.addEventListener('waiting', __, {once:true});\n\n\n _videoElement.addEventListener('stalled', __, {\n once: true\n });\n\n Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"setExactTimeout\"])(() => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false; // _videoElement.removeEventListener('waiting', __, {once:true});\n\n _videoElement.removeEventListener('stalled', __, {\n once: true\n });\n\n resolve();\n }, diff * 1000 / (playbackRate - 1), 20);\n isProgrammaticallySeeked = true;\n\n if (_videoElement.paused) {\n wasPaused = true;\n\n _videoElement.play().then(() => {\n _videoElement.playbackRate = playbackRate;\n });\n } else {\n _videoElement.playbackRate = playbackRate;\n }\n } else {\n room._log(\"Jump to seek...\");\n\n let __ = Date.now();\n\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _videoElement.addEventListener('playing', () => {\n room._log(\"It took the player \".concat((Date.now() - __) / 1000, \" seconds to seek \"));\n\n isProgrammaticallySeeked = false;\n resolve();\n }, {\n once: true\n });\n\n _videoElement.currentTime = time;\n }\n } else resolve();\n });\n };\n\n const handlePlaying = () => {\n if (!isProgrammaticallySeeked) {\n room._log('Handle playing');\n\n startSyncLoop();\n }\n\n isProgrammaticallySeeked = false;\n isPreloading = _videoElement.paused;\n isPlaying = !_videoElement.paused;\n };\n\n const handlePause = () => {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPlaying = !_videoElement.paused;\n };\n\n const handleStalledWaiting = () => {\n room._log('handleStalledWaiting');\n\n if (!isProgrammaticallySeeked) {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPreloading = _videoElement.paused;\n }\n };\n\n const roomSyncSend = slaveId => {\n if (!_libraryInstance || !_videoElement) {\n room._log(\"I've been asked for position even if we don't have player attached.\\n Does it mean I'm the master?\");\n\n return Promise.resolve();\n }\n\n let fragment = currentFragmentSn;\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n\n room._log(\"Sending my position to \".concat(slaveId));\n\n room._log(\"Fragment: \".concat(fragment));\n\n room._log(\"Fragment position: \".concat(fragmentPosition));\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_response\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: String(fragment),\n fragment_pos: Number(fragmentPosition),\n slave_id: room.webrtcVersion > 1000 ? String(slaveId) : Number(slaveId)\n }\n });\n };\n\n const getSyncData = () => {\n room._log('Sending roomSync request');\n\n let roomId = room.roomId;\n let fragment = currentFragmentSn;\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n return new Promise((resolve, reject) => {\n let now = new Date().getTime();\n let ping = null;\n let sid = setTimeout(() => {\n room.off('data', fn, this);\n reject('Timeout');\n }, 3000);\n let body = {\n request: \"sync\",\n room: roomId,\n timestamp: new Date().getTime(),\n fragment: String(fragment),\n fragment_pos: Number(fragmentPosition)\n };\n\n let fn = msg => {\n if (msg.videoroom && ['sync', 'sync_response'].includes(msg.videoroom)) {\n if (msg.sync_master_await) {\n room._log('Waiting for master position');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n } else if (msg.sync_master_fragment || msg.sync_master_fragment_pos) {\n room._log('Got master position data');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n\n room._log(\"I'm master: \".concat(!!msg.sync_master_self));\n\n room._log(\"Ping: \".concat(ping));\n\n room._log(\"Master fragment: \".concat(msg.sync_master_fragment));\n\n room._log(\"Master fragment position: \".concat(msg.sync_master_fragment_pos));\n\n room.off('data', fn, this);\n clearTimeout(sid);\n resolve({\n isMaster: !!msg.sync_master_self,\n ping: ping,\n masterFragmentPos: parseInt(msg.sync_master_fragment_pos),\n masterFragmentSn: parseInt(msg.sync_master_fragment)\n });\n } else {\n clearTimeout(sid);\n reject('Master lost connection');\n }\n }\n };\n\n room.on('data', fn, this);\n room.sendMessage(room.handleId, {\n body\n }).then(fn).catch(e => {\n room.off('data', fn, this);\n clearTimeout(sid);\n reject(e);\n });\n });\n };\n\n const clientPaused = () => {\n room._log('Sending client paused');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_paused\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: '0',\n fragment_pos: 0\n }\n });\n };\n\n const propagateMasterFunc = () => {\n room._log('Propagating master');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_source_set\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n wt_channel_id: \"\",\n fragment: \"0\",\n fragment_pos: 0\n }\n });\n };\n\n return {\n __events: ['playerSyncing'],\n initialize: function () {\n let {\n hlsInstance,\n libraryInstance,\n propagateMaster = false\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _libraryInstance = hlsInstance || libraryInstance; // backwards comp;\n\n _videoElement = _libraryInstance.media;\n\n if (!_libraryInstance) {\n room._log('No hls.js player instance!');\n\n return;\n }\n\n shouldPropagateMaster = propagateMaster;\n isPlaying = _videoElement.paused === false;\n room.on('disconnect', stopSyncLoop);\n room.on('removeLocalParticipant', stopSyncLoop);\n room.on('addLocalParticipant', handleAddLocalParticipant);\n room.on('addRemoteParticipant', handleAddRemoteParticipant);\n room.on('data', parseDataEvents);\n\n if (shouldPropagateMaster) {\n propagateMasterFunc().catch(() => {});\n }\n\n if (_videoElement && _videoElement.paused === false) {\n _libraryInstance.once('hlsFragChanged', () => {\n restartSyncLoop();\n });\n }\n\n _libraryInstance.on('hlsError', buffering);\n\n _libraryInstance.on('hlsFragChanged', hlsFragChanged);\n\n _videoElement.addEventListener('playing', handlePlaying);\n\n _videoElement.addEventListener('pause', handlePause);\n },\n destroy: () => {\n stopSyncLoop();\n room.off('disconnect', stopSyncLoop);\n room.off('removeLocalParticipant', stopSyncLoop);\n room.off('addLocalParticipant', handleAddLocalParticipant);\n room.off('addRemoteParticipant', handleAddRemoteParticipant);\n room.off('data', parseDataEvents);\n\n if (_libraryInstance) {\n _libraryInstance.off('hlsError', buffering);\n\n _libraryInstance.off('hlsFragChanged', hlsFragChanged);\n }\n\n if (_videoElement) {\n _videoElement.removeEventListener('playing', handlePlaying);\n\n _videoElement.removeEventListener('pause', handlePause);\n }\n\n _libraryInstance = null;\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (syncHlsJs);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/sync-modules/sync-hls.js?");
|
|
9343
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../wt-utils */ \"./src/modules/wt-utils.js\");\n/*\n * TODO:\n * Sync we get\n * machineTimestamp = now\n * ping = (endRequestTimestamp - startRequestTimestamp) / 2\n * clockDifference = (serverTimestamp - machineTimestamp - ping)\n *\n *\n * usable vars : (now +- clockDifference) === currentServerTimestamp ---> when event was received\n * : (otherMachineTimestamp +- otherMachineClockDifference) === currentServerTimestamp ---> when event was sent\n *\n *\n * ping: (this user currentServerTimestamp a.k.a when event was received) - (remote user currentServerTimestamp a.k.a. when event was sent )\n *\n *\n * */\n\n\nconst syncHlsJs = function () {\n let {\n room,\n wt,\n roomSession,\n emitter\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n //SYNC VARS\n let _libraryInstance = null;\n let _videoElement = null;\n let currentFragmentSn = null;\n const syncDefaultWaitTime = 60000;\n const syncShortWaitTime = 10000;\n const maxSyncThreshold = 0.5;\n const maxSyncTries = 3;\n let currentSyncRetry = 0;\n let syncWaitId = null;\n let syncNextWaitTime = null;\n let stopFlag = false;\n let isSyncing = false;\n let playbackRate = 2;\n let isPlaying = false;\n let isPreloading = true;\n let isProgrammaticallySeeked = false;\n let shouldPropagateMaster = false;\n\n const startSyncLoop = () => {\n if (!isConnected()) {\n room._log('--- Sync loop will not start due to user not connected yet ---');\n\n return;\n }\n\n if (syncWaitId) {\n room._log('--- Sync loop already running ---');\n\n return;\n }\n\n room._log('--- Sync enabled ---');\n\n stopFlag = false;\n\n const loop = () => {\n isSyncing = true;\n emitter.emit('playerSyncing', true);\n sync().finally(() => {\n isSyncing = false;\n emitter.emit('playerSyncing', false);\n\n if (isConnected() && !stopFlag) {\n syncWaitId = setTimeout(loop, syncNextWaitTime);\n } else {\n room._log('--- Automatic stop due to user not connected or stop flag enabled ---');\n\n stopSyncLoop();\n }\n });\n };\n\n loop();\n };\n\n const stopSyncLoop = () => {\n room._log('--- Sync disabled ---');\n\n clearTimeout(syncWaitId);\n syncWaitId = null;\n currentSyncRetry = 0;\n stopFlag = true;\n };\n\n const restartSyncLoop = () => {\n room._log('--- Sync restarting ---');\n\n stopSyncLoop();\n startSyncLoop();\n };\n\n const setNextWaitTime = function () {\n let didSyncFail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (!didSyncFail) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n currentSyncRetry++;\n\n if (currentSyncRetry > maxSyncTries) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n syncNextWaitTime = syncShortWaitTime;\n }\n }\n\n room._log('--- Next sync will occur in ' + syncNextWaitTime / 1000 + ' seconds ---');\n };\n\n const sync = () => {\n return getSyncData().then(syncData => {\n if (syncData.isMaster) {\n if (_videoElement.paused) _videoElement.play();\n setNextWaitTime(false);\n return Promise.resolve();\n } else if (shouldPropagateMaster) {\n setNextWaitTime(false);\n return propagateMasterFunc();\n } else {\n const syncStartTime = Date.now();\n const {\n position,\n isBufferSufficient\n } = calculateSyncDifferenceTime(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping);\n\n if (position && Math.abs(position) <= maxSyncThreshold) {\n room._log(`We're within max sync threshold, no need to resync now`);\n\n setNextWaitTime(false);\n return Promise.resolve();\n }\n\n if (position !== null) {\n return seekBy(position).then(() => {\n const seekDuration = Date.now() - syncStartTime;\n const {\n position,\n isBufferSufficient\n } = calculateSyncDifferenceTime(syncData.masterFragmentSn, syncData.masterFragmentPos + seekDuration, syncData.ping);\n const syncPrecision = Math.abs(position);\n\n room._log(`Insufficient buffer: `, !isBufferSufficient);\n\n room._log(`Seek duration is ${seekDuration / 1000}`);\n\n room._log(`Sync precision should be ${syncPrecision}`);\n\n const didSyncFail = syncPrecision > maxSyncThreshold;\n setNextWaitTime(didSyncFail);\n return Promise.resolve();\n }).catch(e => {\n setNextWaitTime(true);\n return Promise.reject(e);\n });\n } else {\n setNextWaitTime(true);\n return Promise.reject();\n }\n }\n }).catch(() => {\n setNextWaitTime(true);\n return Promise.reject();\n });\n };\n\n const handleAddLocalParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n\n if (_videoElement && _videoElement.paused === false) {\n _videoElement.addEventListener('progress', () => {\n restartSyncLoop();\n }, {\n once: true\n });\n }\n };\n\n const handleAddRemoteParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n };\n\n const isConnected = () => {\n return room._isDataChannelOpen && room.isConnected;\n };\n\n const buffering = function (event) {\n let data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n if (data.details === 'bufferStalledError') {\n handleStalledWaiting();\n }\n };\n\n const hlsFragChanged = (event, data) => {\n currentFragmentSn = data.frag.sn;\n };\n\n const parseDataEvents = function () {\n let msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (msg.videoroom === 'sync_source_set' && msg.wt_channel_id != \"\") {\n emitter.emit('changePlayerSource', msg.wt_channel_id);\n } else if (msg.videoroom === 'sync_request') {\n roomSyncSend(msg.sync_slave_id).catch(() => {});\n }\n };\n\n const getCurrentSegmentPosition = () => {\n var _currentFragment$body;\n\n let fragments = _libraryInstance.streamController.fragmentTracker.fragments;\n\n if (!fragments) {\n return 0;\n }\n\n let currentFragment = fragments[Object.keys(fragments).find(key => key.indexOf(currentFragmentSn) > -1)];\n\n if (!currentFragment) {\n return 0;\n }\n\n return Math.max((_libraryInstance.streamController.lastCurrentTime - (((_currentFragment$body = currentFragment.body) === null || _currentFragment$body === void 0 ? void 0 : _currentFragment$body.startPTS) || 0)) * 1000, 0);\n };\n\n const calculateSyncDifferenceTime = (masterFragmentSn, masterFragmentPos, ping) => {\n var _currentFragment$body2;\n\n let fragments = _libraryInstance.streamController.fragmentTracker.fragments;\n let fragmentNumbers = Object.keys(fragments).map(key => parseInt(key.slice(key.lastIndexOf('_') + 1))).sort(function (a, b) {\n return a - b;\n }); // our position in fragment\n //let currentFragmentSn = currentFragmentSn;\n\n let currentFragment = fragments[Object.keys(fragments).find(key => key.indexOf(currentFragmentSn) > -1)];\n\n if (!currentFragment) {\n room._log('Current fragment not found, what now?', currentFragmentSn);\n\n return {\n position: null,\n isBufferSufficient: false\n };\n }\n\n let currentFragmentPos = Math.max((_libraryInstance.streamController.lastCurrentTime - (((_currentFragment$body2 = currentFragment.body) === null || _currentFragment$body2 === void 0 ? void 0 : _currentFragment$body2.startPTS) || 0)) * 1000, 0);\n let currentFragmentLength = currentFragment.body.duration * 1000;\n\n room._log(`Our current fragment is: ${currentFragmentSn}`);\n\n room._log(`Our current fragment position is: ${currentFragmentPos}`);\n\n room._log(`Our current fragment length is: ${currentFragmentLength}`); // real server fragment\n\n\n let realMasterFragmentSn = masterFragmentSn; // real server position in fragment\n\n let realMasterFragmentPos = Math.max(ping / 2 + masterFragmentPos, 0); // simple flag\n\n let isBufferSufficient = false;\n /* Searching for fragment and in-fragment position when taking all delays into account */\n\n let relevantFragmentNumbers = fragmentNumbers.indexOf(masterFragmentSn) > -1 ? fragmentNumbers.slice(fragmentNumbers.indexOf(masterFragmentSn)) : [];\n\n for (let i = 0, len = relevantFragmentNumbers.length; i < len; i++) {\n let sn = relevantFragmentNumbers[i];\n let fragment = fragments[Object.keys(fragments).find(key => key.indexOf(sn) > -1)];\n let fragmentDuration = fragment.body.duration * 1000;\n\n room._log(`Correction diff: ${realMasterFragmentPos - fragmentDuration}`);\n\n realMasterFragmentSn = sn;\n\n if (realMasterFragmentPos - fragmentDuration > 0) {\n room._log(`Not enough at fragment ${sn}`);\n\n realMasterFragmentPos -= fragmentDuration;\n } else {\n room._log(`Enough at fragment ${sn}`);\n\n isBufferSufficient = true;\n break;\n }\n } // We're not ready yet\n\n\n if (!isBufferSufficient) {\n room._log(`We don't have required fragment ${realMasterFragmentSn} yet`);\n\n return {\n position: null,\n isBufferSufficient: false\n };\n } // We are too ahead\n\n\n if (realMasterFragmentSn < currentFragmentSn) {\n room._log(`We are ahead of master...`);\n\n room._log(`Real master fragment: ${realMasterFragmentSn}`);\n\n room._log(`Our fragment: ${currentFragmentSn}`);\n\n let seekTime = currentFragmentPos - realMasterFragmentPos;\n let relevantFragmentNumbers = fragmentNumbers.slice(fragmentNumbers.indexOf(realMasterFragmentSn));\n\n for (let i = 0, len = relevantFragmentNumbers.length; i < len; i++) {\n let sn = relevantFragmentNumbers[i];\n let fragment = fragments[Object.keys(fragments).find(key => key.indexOf(sn) > -1)];\n let fragmentDuration = fragment.body.duration * 1000;\n\n if (sn >= currentFragmentSn) {\n break;\n }\n\n seekTime += fragmentDuration;\n }\n\n room._log(`Sync difference is: ${seekTime}`);\n\n return {\n position: seekTime / 1000 * -1,\n isBufferSufficient: true\n };\n } // We are behind or spot on\n else {\n room._log(`We're behind or spot on master...`);\n\n room._log(`Real master fragment: ${realMasterFragmentSn}`);\n\n room._log(`Our fragment: ${currentFragmentSn}`);\n\n let seekTime = realMasterFragmentPos - currentFragmentPos;\n let relevantFragmentNumbers = fragmentNumbers.slice(fragmentNumbers.indexOf(currentFragmentSn));\n\n for (let i = 0, len = relevantFragmentNumbers.length; i < len; i++) {\n let sn = relevantFragmentNumbers[i];\n let fragment = fragments[Object.keys(fragments).find(key => key.indexOf(sn) > -1)];\n let fragmentDuration = fragment.body.duration * 1000;\n\n if (sn >= realMasterFragmentSn) {\n break;\n }\n\n seekTime += fragmentDuration;\n }\n\n room._log(`We can proceed with seek time: ${seekTime}`);\n\n return {\n position: seekTime / 1000,\n isBufferSufficient: true\n };\n }\n };\n\n const seekBy = time => {\n //https://mcorp.no/lib/mediasync.js\n return new Promise((resolve, reject) => {\n if (time !== 0) {\n if (time > 0 && time < 4) {\n room._log(`Fast forward to seek...`);\n\n let wasPaused = false;\n\n let __ = () => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false;\n reject('Stalled');\n };\n\n let diff = time; // _videoElement.addEventListener('waiting', __, {once:true});\n\n _videoElement.addEventListener('stalled', __, {\n once: true\n });\n\n Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"setExactTimeout\"])(() => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false; // _videoElement.removeEventListener('waiting', __, {once:true});\n\n _videoElement.removeEventListener('stalled', __, {\n once: true\n });\n\n resolve();\n }, diff * 1000 / (playbackRate - 1), 20);\n isProgrammaticallySeeked = true;\n\n if (_videoElement.paused) {\n wasPaused = true;\n\n _videoElement.play().then(() => {\n _videoElement.playbackRate = playbackRate;\n });\n } else {\n _videoElement.playbackRate = playbackRate;\n }\n } else {\n room._log(`Jump to seek...`);\n\n let __ = Date.now();\n\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _videoElement.addEventListener('playing', () => {\n room._log(`It took the player ${(Date.now() - __) / 1000} seconds to seek `);\n\n isProgrammaticallySeeked = false;\n resolve();\n }, {\n once: true\n });\n\n _videoElement.currentTime += time;\n }\n } else resolve();\n });\n };\n\n const seekTo = time => {\n //https://webtiming.github.io/timingsrc/ use this\n //https://mcorp.no/lib/mediasync.js\n return new Promise((resolve, reject) => {\n if (_videoElement.currentTime !== time) {\n let diff = time - _videoElement.currentTime;\n\n if (_videoElement.currentTime < time && diff < 4) {\n room._log(`Fast forward to seek...`);\n\n let wasPaused = false;\n\n let __ = () => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false;\n reject('Stalled');\n }; // _videoElement.addEventListener('waiting', __, {once:true});\n\n\n _videoElement.addEventListener('stalled', __, {\n once: true\n });\n\n Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"setExactTimeout\"])(() => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false; // _videoElement.removeEventListener('waiting', __, {once:true});\n\n _videoElement.removeEventListener('stalled', __, {\n once: true\n });\n\n resolve();\n }, diff * 1000 / (playbackRate - 1), 20);\n isProgrammaticallySeeked = true;\n\n if (_videoElement.paused) {\n wasPaused = true;\n\n _videoElement.play().then(() => {\n _videoElement.playbackRate = playbackRate;\n });\n } else {\n _videoElement.playbackRate = playbackRate;\n }\n } else {\n room._log(`Jump to seek...`);\n\n let __ = Date.now();\n\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _videoElement.addEventListener('playing', () => {\n room._log(`It took the player ${(Date.now() - __) / 1000} seconds to seek `);\n\n isProgrammaticallySeeked = false;\n resolve();\n }, {\n once: true\n });\n\n _videoElement.currentTime = time;\n }\n } else resolve();\n });\n };\n\n const handlePlaying = () => {\n if (!isProgrammaticallySeeked) {\n room._log('Handle playing');\n\n startSyncLoop();\n }\n\n isProgrammaticallySeeked = false;\n isPreloading = _videoElement.paused;\n isPlaying = !_videoElement.paused;\n };\n\n const handlePause = () => {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPlaying = !_videoElement.paused;\n };\n\n const handleStalledWaiting = () => {\n room._log('handleStalledWaiting');\n\n if (!isProgrammaticallySeeked) {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPreloading = _videoElement.paused;\n }\n };\n\n const roomSyncSend = slaveId => {\n if (!_libraryInstance || !_videoElement) {\n room._log(`I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?`);\n\n return Promise.resolve();\n }\n\n let fragment = currentFragmentSn;\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n\n room._log(`Sending my position to ${slaveId}`);\n\n room._log(`Fragment: ${fragment}`);\n\n room._log(`Fragment position: ${fragmentPosition}`);\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_response\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: String(fragment),\n fragment_pos: Number(fragmentPosition),\n slave_id: room.webrtcVersion > 1000 ? String(slaveId) : Number(slaveId)\n }\n });\n };\n\n const getSyncData = () => {\n room._log('Sending roomSync request');\n\n let roomId = room.roomId;\n let fragment = currentFragmentSn;\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n return new Promise((resolve, reject) => {\n let now = new Date().getTime();\n let ping = null;\n let sid = setTimeout(() => {\n room.off('data', fn, this);\n reject('Timeout');\n }, 3000);\n let body = {\n request: \"sync\",\n room: roomId,\n timestamp: new Date().getTime(),\n fragment: String(fragment),\n fragment_pos: Number(fragmentPosition)\n };\n\n let fn = msg => {\n if (msg.videoroom && ['sync', 'sync_response'].includes(msg.videoroom)) {\n if (msg.sync_master_await) {\n room._log('Waiting for master position');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n } else if (msg.sync_master_fragment || msg.sync_master_fragment_pos) {\n room._log('Got master position data');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n\n room._log(`I'm master: ${!!msg.sync_master_self}`);\n\n room._log(`Ping: ${ping}`);\n\n room._log(`Master fragment: ${msg.sync_master_fragment}`);\n\n room._log(`Master fragment position: ${msg.sync_master_fragment_pos}`);\n\n room.off('data', fn, this);\n clearTimeout(sid);\n resolve({\n isMaster: !!msg.sync_master_self,\n ping: ping,\n masterFragmentPos: parseInt(msg.sync_master_fragment_pos),\n masterFragmentSn: parseInt(msg.sync_master_fragment)\n });\n } else {\n clearTimeout(sid);\n reject('Master lost connection');\n }\n }\n };\n\n room.on('data', fn, this);\n room.sendMessage(room.handleId, {\n body\n }).then(fn).catch(e => {\n room.off('data', fn, this);\n clearTimeout(sid);\n reject(e);\n });\n });\n };\n\n const clientPaused = () => {\n room._log('Sending client paused');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_paused\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: '0',\n fragment_pos: 0\n }\n });\n };\n\n const propagateMasterFunc = () => {\n room._log('Propagating master');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_source_set\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n wt_channel_id: \"\",\n fragment: \"0\",\n fragment_pos: 0\n }\n });\n };\n\n return {\n __events: ['playerSyncing'],\n initialize: function () {\n let {\n hlsInstance,\n libraryInstance,\n propagateMaster = false\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _libraryInstance = hlsInstance || libraryInstance; // backwards comp;\n\n _videoElement = _libraryInstance.media;\n\n if (!_libraryInstance) {\n room._log('No hls.js player instance!');\n\n return;\n }\n\n shouldPropagateMaster = propagateMaster;\n isPlaying = _videoElement.paused === false;\n room.on('disconnect', stopSyncLoop);\n room.on('removeLocalParticipant', stopSyncLoop);\n room.on('addLocalParticipant', handleAddLocalParticipant);\n room.on('addRemoteParticipant', handleAddRemoteParticipant);\n room.on('data', parseDataEvents);\n\n if (shouldPropagateMaster) {\n propagateMasterFunc().catch(() => {});\n }\n\n if (_videoElement && _videoElement.paused === false) {\n _libraryInstance.once('hlsFragChanged', () => {\n restartSyncLoop();\n });\n }\n\n _libraryInstance.on('hlsError', buffering);\n\n _libraryInstance.on('hlsFragChanged', hlsFragChanged);\n\n _videoElement.addEventListener('playing', handlePlaying);\n\n _videoElement.addEventListener('pause', handlePause);\n },\n destroy: () => {\n stopSyncLoop();\n room.off('disconnect', stopSyncLoop);\n room.off('removeLocalParticipant', stopSyncLoop);\n room.off('addLocalParticipant', handleAddLocalParticipant);\n room.off('addRemoteParticipant', handleAddRemoteParticipant);\n room.off('data', parseDataEvents);\n\n if (_libraryInstance) {\n _libraryInstance.off('hlsError', buffering);\n\n _libraryInstance.off('hlsFragChanged', hlsFragChanged);\n }\n\n if (_videoElement) {\n _videoElement.removeEventListener('playing', handlePlaying);\n\n _videoElement.removeEventListener('pause', handlePause);\n }\n\n _libraryInstance = null;\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (syncHlsJs);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/sync-modules/sync-hls.js?");
|
|
9299
9344
|
|
|
9300
9345
|
/***/ }),
|
|
9301
9346
|
|
|
@@ -9307,7 +9352,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_
|
|
|
9307
9352
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9308
9353
|
|
|
9309
9354
|
"use strict";
|
|
9310
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../wt-utils */ \"./src/modules/wt-utils.js\");\n/* harmony import */ var _wt_emitter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../wt-emitter */ \"./src/modules/wt-emitter.js\");\n\n\n\nconst syncModule = function () {\n let {\n room,\n emitter\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n //SYNC VARS\n let _emitter = Object(_wt_emitter__WEBPACK_IMPORTED_MODULE_1__[\"default\"])();\n\n let _playerInterface = null;\n let _propagateMaster = false;\n let _playerInterfaceOptions = {\n type: 'none',\n ignoreBufferedTimeRanges: true,\n disableFastSeek: false\n };\n const syncDefaultWaitTime = 60000;\n const syncShortWaitTime = 10000;\n const maxSyncThreshold = 0.5;\n const maxSyncTries = 3;\n const waitForPlayingEventAfterSeek = 5000;\n const fastForwardThreshold = 4;\n let currentSyncRetry = 0;\n let syncWaitId = null;\n let syncNextWaitTime = null;\n let stopFlag = false;\n let isSyncing = false;\n let safeSpace = 2;\n let playbackRate = 2;\n let isPlaying = false;\n let isPreloading = true;\n let isProgrammaticallySeeked = false;\n\n const startSyncLoop = () => {\n if (!isConnected() && _playerInterfaceOptions.type !== 'push') {\n room._log('--- Sync loop will not start due to user not connected yet ---');\n\n return;\n }\n\n if (syncWaitId) {\n room._log('--- Sync loop already running ---');\n\n return;\n }\n\n room._log('--- Sync enabled ---');\n\n stopFlag = false;\n\n if (_playerInterfaceOptions.type !== 'push') {\n const loop = () => {\n isSyncing = true;\n emitter.emit('playerSyncing', true);\n sync().finally(() => {\n isSyncing = false;\n emitter.emit('playerSyncing', false);\n\n if (isConnected() && !stopFlag) {\n syncWaitId = setTimeout(loop, syncNextWaitTime);\n } else {\n room._log('--- Automatic stop due to user not connected or stop flag enabled ---');\n\n stopSyncLoop();\n }\n });\n };\n\n loop();\n } else {\n const loop2 = () => {\n seekForward().then(() => {\n setNextWaitTime(false);\n }).catch(e => {\n setNextWaitTime(true);\n console.log('Sync failed', e);\n });\n syncWaitId = setTimeout(loop2, syncNextWaitTime);\n };\n\n loop2();\n }\n };\n\n const stopSyncLoop = doNotResetRetryCount => {\n room._log('--- Sync disabled ---');\n\n clearTimeout(syncWaitId);\n syncWaitId = null;\n\n if (!doNotResetRetryCount) {\n currentSyncRetry = 0;\n }\n\n stopFlag = true;\n };\n\n const restartSyncLoop = () => {\n room._log('--- Sync restarting ---');\n\n stopSyncLoop();\n startSyncLoop();\n };\n\n const setNextWaitTime = function () {\n let didSyncFail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (!didSyncFail) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n currentSyncRetry++;\n\n if (currentSyncRetry > maxSyncTries) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n syncNextWaitTime = syncShortWaitTime;\n }\n }\n\n room._log('--- Next sync will occur in ' + syncNextWaitTime / 1000 + ' seconds ---');\n };\n\n const sync = () => {\n return getSyncData().then(syncData => {\n if (syncData.isMaster) {\n if (_playerInterface.isPaused) _playerInterface.play();\n setNextWaitTime(false);\n return Promise.resolve();\n } else if (_propagateMaster) {\n setNextWaitTime(false);\n return propagateMasterFunc();\n } else {\n const syncStartTime = Date.now();\n const {\n position,\n realPosition,\n isBufferSufficient\n } = _playerInterface.getTimeDifference ? _playerInterface.getTimeDifference(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping) : getTimeDifference(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping);\n\n if (position && Math.abs(position) <= maxSyncThreshold) {\n room._log(\"We're within max sync threshold, no need to resync now\");\n\n setNextWaitTime(false);\n return Promise.resolve();\n }\n\n if (position !== null && !isNaN(position)) {\n return seekBy(position).then(() => {\n const seekDuration = Date.now() - syncStartTime;\n const {\n position,\n realPosition,\n isBufferSufficient\n } = _playerInterface.getTimeDifference ? _playerInterface.getTimeDifference(syncData.masterFragmentSn, syncData.masterFragmentPos + seekDuration, syncData.ping) : getTimeDifference(syncData.masterFragmentSn, syncData.masterFragmentPos + seekDuration, syncData.ping);\n const syncPrecision = Math.abs(realPosition);\n\n room._log(\"Insufficient buffer: \", !isBufferSufficient);\n\n room._log(\"Seek duration is \".concat(seekDuration / 1000, \" seconds\"));\n\n room._log(\"Sync precision should be \".concat(syncPrecision));\n\n const didSyncFail = syncPrecision > maxSyncThreshold;\n setNextWaitTime(didSyncFail);\n return Promise.resolve();\n }).catch(e => {\n room._log(\"Seek failed: \", e);\n\n setNextWaitTime(true);\n return Promise.reject(e);\n });\n } else {\n room._log(\"Position in not a number: \", position);\n\n setNextWaitTime(true);\n return Promise.reject();\n }\n }\n }).catch(e => {\n room._log(\"getSyncData() failed: \", e);\n\n setNextWaitTime(true);\n return Promise.reject();\n });\n };\n\n const handleAddLocalParticipant = () => {\n if (_propagateMaster) {\n propagateMasterFunc();\n }\n\n if (_playerInterface.isPaused === false) {\n _emitter.once('timeupdate', restartSyncLoop);\n }\n };\n\n const handleAddRemoteParticipant = () => {\n if (_propagateMaster) {\n propagateMasterFunc();\n }\n };\n\n const isConnected = () => {\n return room._isDataChannelOpen && room.isConnected;\n };\n\n const parseDataEvents = function () {\n let msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (msg.videoroom === 'sync_request') {\n roomSyncSend(msg.sync_slave_id).catch(() => {});\n }\n };\n\n const getCurrentPlayerPosition = () => {\n let position = _playerInterface.currentTime;\n return isNaN(position) ? 0 : position * 1000;\n };\n\n const getTimeDifference = (fragmentSn, fragmentPos, ping) => {\n let seekRanges = _playerInterface.buffered;\n let position = (fragmentPos + ping / 2) / 1000;\n let currentPlayerPosition = getCurrentPlayerPosition() / 1000;\n\n if (seekRanges && !_playerInterfaceOptions.ignoreBufferedTimeRanges) {\n let seekRange = {};\n\n for (let i = 0; i < seekRanges.length; i++) {\n let _c_start = seekRanges.start(i);\n\n let _c_end = seekRanges.end(i);\n\n if (!seekRange.start || _c_start < seekRange.start) {\n seekRange.start = _c_start;\n }\n\n if (!seekRange.end || _c_end > seekRange.end) {\n seekRange.end = _c_end;\n }\n }\n\n if (position > seekRange.start && position < seekRange.end) {\n return {\n position: position - currentPlayerPosition,\n realPosition: position - currentPlayerPosition,\n isBufferSufficient: true\n };\n } else if (position < seekRange.start) {\n room._log(\"Syncing to \".concat(seekRange.start, \" instead of \").concat(position, \" due to lack of buffered data\"));\n\n return {\n position: seekRange.start + 0.5 - currentPlayerPosition,\n realPosition: position - currentPlayerPosition,\n isBufferSufficient: false\n };\n } else if (position > seekRange.end) {\n room._log(\"Syncing to \".concat(seekRange.end, \" instead of \").concat(position, \" due to lack of buffered data\"));\n\n return {\n position: seekRange.end - 0.5 - currentPlayerPosition,\n realPosition: position - currentPlayerPosition,\n isBufferSufficient: false\n };\n } else return {\n position: null,\n isBufferSufficient: false\n };\n } else {\n return {\n position: position - currentPlayerPosition,\n realPosition: position - currentPlayerPosition,\n isBufferSufficient: true\n };\n }\n };\n\n const seekForward = () => {\n return new Promise((resolve, reject) => {\n let diff = _playerInterface.buffered.end(0) - _playerInterface.currentTime;\n\n let diff_target = diff - safeSpace;\n\n let __ = () => {\n _playerInterface.setPlaybackRate(1);\n\n isProgrammaticallySeeked = false;\n isSyncing = false;\n reject('Stalled');\n };\n\n console.log('Users stream is behind behind live by:', diff);\n\n if (diff_target > 0) {\n _emitter.once('stalled', __);\n\n Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"setExactTimeout\"])(() => {\n _playerInterface.setPlaybackRate(1);\n\n isProgrammaticallySeeked = false;\n isSyncing = false;\n\n _emitter.off('stalled', __);\n\n resolve();\n }, diff_target * 1000 / (playbackRate - 1), 20);\n isProgrammaticallySeeked = true;\n isSyncing = true;\n\n _playerInterface.setPlaybackRate(playbackRate);\n } else {\n resolve();\n }\n });\n };\n\n const seekBy = time => {\n return new Promise((resolve, reject) => {\n if (_playerInterface.currentTime !== time) {\n if (time > 0 && time < fastForwardThreshold && !_playerInterfaceOptions.disableFastSeek) {\n room._log(\"Fast forward to seek...\");\n\n let wasPaused = false;\n\n let _handleFailed = () => {\n if (wasPaused) {\n _playerInterface.pause();\n }\n\n _playerInterface.setPlaybackRate(1);\n\n isProgrammaticallySeeked = false;\n reject('Stalled');\n };\n\n let _fastForward = () => {\n isProgrammaticallySeeked = true;\n Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"setExactTimeout\"])(() => {\n _emitter.off('stalled', _handleFailed);\n\n if (wasPaused && _playerInterface.isVod) {\n _playerInterface.pause();\n }\n\n _playerInterface.setPlaybackRate(1);\n\n isProgrammaticallySeeked = false;\n resolve();\n }, time * 1000 / (playbackRate - 1), 20);\n\n _playerInterface.setPlaybackRate(playbackRate);\n };\n\n _emitter.once('stalled', _handleFailed);\n\n if (_playerInterface.isPaused) {\n wasPaused = true;\n\n _playerInterface.play().then(() => {\n _fastForward();\n }).catch(_handleFailed);\n } else {\n _fastForward();\n }\n } else {\n room._log(\"Jump to seek...\");\n\n let currentTimestamp = Date.now();\n let __failsafeId = null;\n\n let _resolve = () => {\n clearTimeout(__failsafeId);\n __failsafeId = null;\n isProgrammaticallySeeked = false;\n\n room._log(\"It took the player \".concat((Date.now() - currentTimestamp) / 1000, \" seconds to seek \"));\n\n resolve();\n };\n\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _emitter.once('playing', _resolve);\n\n __failsafeId = setTimeout(_resolve, waitForPlayingEventAfterSeek);\n\n _playerInterface.seek(_playerInterface.currentTime + time);\n }\n } else resolve();\n });\n };\n\n const seekTo = time => {\n return new Promise((resolve, reject) => {\n if (_playerInterface.currentTime !== time) {\n let diff = time - _playerInterface.currentTime;\n\n if (_playerInterface.currentTime < time && diff < fastForwardThreshold && !_playerInterfaceOptions.disableFastSeek) {\n room._log(\"Fast forward to seek...\");\n\n let wasPaused = false;\n\n let _handleFailed = () => {\n if (wasPaused) {\n _playerInterface.pause();\n }\n\n _playerInterface.setPlaybackRate(1);\n\n isProgrammaticallySeeked = false;\n reject('Stalled');\n };\n\n let _fastForward = () => {\n isProgrammaticallySeeked = true;\n Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"setExactTimeout\"])(() => {\n _emitter.off('stalled', _handleFailed);\n\n if (wasPaused && _playerInterface.isVod) {\n _playerInterface.pause();\n }\n\n _playerInterface.setPlaybackRate(1);\n\n isProgrammaticallySeeked = false;\n resolve();\n }, diff * 1000 / (playbackRate - 1), 20);\n\n _playerInterface.setPlaybackRate(playbackRate);\n };\n\n _emitter.once('stalled', _handleFailed);\n\n if (_playerInterface.isPaused) {\n wasPaused = true;\n\n _playerInterface.play().then(() => {\n _fastForward();\n }).catch(_handleFailed);\n } else {\n _fastForward();\n }\n } else {\n room._log(\"Jump to seek...\");\n\n let currentTimestamp = Date.now();\n let __failsafeId = null;\n\n let _resolve = () => {\n clearTimeout(__failsafeId);\n __failsafeId = null;\n isProgrammaticallySeeked = false;\n\n room._log(\"It took the player \".concat((Date.now() - currentTimestamp) / 1000, \" seconds to seek \"));\n\n resolve();\n };\n\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _emitter.once('playing', _resolve);\n\n __failsafeId = setTimeout(_resolve, waitForPlayingEventAfterSeek);\n\n _playerInterface.seek(time);\n }\n } else resolve();\n });\n };\n\n const handlePlaying = () => {\n if (!isProgrammaticallySeeked) {\n room._log('Handle playing');\n\n startSyncLoop();\n }\n\n isProgrammaticallySeeked = false;\n isPreloading = _playerInterface.isPaused;\n isPlaying = !_playerInterface.isPaused;\n };\n\n const handlePause = () => {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPlaying = !_playerInterface.isPaused;\n };\n\n const handleBuffering = () => {\n room._log('handleBuffering');\n\n if (!isProgrammaticallySeeked) {\n stopSyncLoop(true);\n clientPaused().catch(() => {});\n isPreloading = _playerInterface.isPaused;\n }\n };\n\n const roomSyncSend = slaveId => {\n var _playerInterface2;\n\n if (!_playerInterface) {\n room._log(\"I've been asked for position even if we don't have player attached.\\n Does it mean I'm the master?\");\n\n return Promise.resolve();\n }\n\n var fragmentData = ((_playerInterface2 = _playerInterface) === null || _playerInterface2 === void 0 ? void 0 : _playerInterface2.currentFragment) || {\n fragment: String(\"0\"),\n fragment_pos: Number(parseInt(getCurrentPlayerPosition()))\n };\n\n room._log(\"Sending my position to \".concat(slaveId));\n\n room._log(\"Current time: \".concat(fragmentData.fragment, \" # \").concat(fragmentData.fragment_pos));\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_response\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n slave_id: room.webrtcVersion > 1000 ? String(slaveId) : Number(slaveId),\n ...fragmentData\n }\n });\n };\n\n const getSyncData = () => {\n var _playerInterface3;\n\n room._log('Sending roomSync request');\n\n let roomId = room.roomId;\n var fragmentData = ((_playerInterface3 = _playerInterface) === null || _playerInterface3 === void 0 ? void 0 : _playerInterface3.currentFragment) || {\n fragment: String(\"0\"),\n fragment_pos: Number(parseInt(getCurrentPlayerPosition()))\n };\n return new Promise((resolve, reject) => {\n let now = new Date().getTime();\n let ping = null;\n let sid = setTimeout(() => {\n room.off('data', fn, this);\n reject('Timeout');\n }, 3000);\n let body = {\n request: \"sync\",\n room: roomId,\n timestamp: new Date().getTime(),\n ...fragmentData\n };\n\n let fn = msg => {\n if (msg.videoroom && ['sync', 'sync_response'].includes(msg.videoroom)) {\n if (msg.sync_master_await) {\n room._log('Waiting for master position');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n } else if (msg.sync_master_fragment || msg.sync_master_fragment_pos) {\n room._log('Got master position data');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n\n room._log(\"I'm master: \".concat(!!msg.sync_master_self));\n\n room._log(\"Ping: \".concat(ping));\n\n room._log(\"Master fragment: \".concat(msg.sync_master_fragment));\n\n room._log(\"Master fragment position: \".concat(msg.sync_master_fragment_pos));\n\n room.off('data', fn, this);\n clearTimeout(sid);\n resolve({\n isMaster: !!msg.sync_master_self,\n ping: ping,\n masterFragmentPos: parseInt(msg.sync_master_fragment_pos),\n masterFragmentSn: parseInt(msg.sync_master_fragment)\n });\n } else {\n clearTimeout(sid);\n reject('Master lost connection');\n }\n }\n };\n\n room.on('data', fn, this);\n room.sendMessage(room.handleId, {\n body\n }).then(fn).catch(e => {\n room.off('data', fn, this);\n clearTimeout(sid);\n reject(e);\n });\n });\n };\n\n const clientPaused = () => {\n room._log('Sending client paused');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_paused\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: '0',\n fragment_pos: 0\n }\n });\n };\n\n const propagateMasterFunc = () => {\n room._log('Propagating master');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_source_set\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n wt_channel_id: \"\",\n fragment: \"0\",\n fragment_pos: 0\n }\n });\n };\n\n return {\n __events: ['playerSyncing'],\n initialize: function () {\n let {\n playerInterface,\n propagateMaster = false\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _playerInterface = playerInterface;\n _playerInterfaceOptions = { ..._playerInterfaceOptions,\n ...(_playerInterface.syncSettings || {})\n };\n _propagateMaster = propagateMaster;\n\n room._log('Interface options passed: ', _playerInterface.syncSettings || {});\n\n room._log('All interface options: ', _playerInterfaceOptions);\n\n if (_playerInterfaceOptions.type === 'none') {\n room._log('Sync module has been disabled via type:none');\n\n return;\n } // if(_playerInterfaceOptions.type === 'push') {\n // \troom._log('Push sync is not implemented in this sync module yet');\n // \treturn;\n // }\n\n\n if (_playerInterface.isVod) {\n room._log('VOD sync is not implemented in this sync module yet');\n\n return;\n }\n\n playerInterface.addHandlers({\n handlePause: event => {\n room._log('handlePause');\n\n _emitter.emit('pause', event);\n },\n handlePlaying: event => {\n room._log('handlePlaying');\n\n _emitter.emit('playing', event);\n },\n handleBuffering: event => {\n room._log('handleBuffering');\n\n _emitter.emit('buffering', event);\n\n _emitter.emit('stalled', event);\n },\n handleTimeupdate: event => {\n room._log('handleTimeupdate');\n\n _emitter.emit('timeupdate', event);\n }\n });\n isPlaying = _playerInterface.isPaused === false;\n room.on('disconnect', stopSyncLoop);\n room.on('removeLocalParticipant', stopSyncLoop);\n room.on('addLocalParticipant', handleAddLocalParticipant);\n room.on('addRemoteParticipant', handleAddRemoteParticipant);\n room.on('data', parseDataEvents);\n\n if (_propagateMaster) {\n propagateMasterFunc().catch(() => {});\n }\n\n if (_playerInterface.isPaused === false) {\n _emitter.once('timeupdate', restartSyncLoop);\n }\n\n _emitter.on('buffering', handleBuffering);\n\n _emitter.on('playing', handlePlaying);\n\n _emitter.on('pause', handlePause);\n },\n destroy: () => {\n stopSyncLoop();\n room.off('disconnect', stopSyncLoop);\n room.off('removeLocalParticipant', stopSyncLoop);\n room.off('addLocalParticipant', handleAddLocalParticipant);\n room.off('addRemoteParticipant', handleAddRemoteParticipant);\n room.off('data', parseDataEvents);\n _playerInterface = null;\n\n _emitter.clear();\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (syncModule);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/sync-modules/sync-module.js?");
|
|
9355
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../wt-utils */ \"./src/modules/wt-utils.js\");\n/* harmony import */ var _wt_emitter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../wt-emitter */ \"./src/modules/wt-emitter.js\");\n\n\n\nconst syncModule = function () {\n let {\n room,\n emitter\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n //SYNC VARS\n let _emitter = Object(_wt_emitter__WEBPACK_IMPORTED_MODULE_1__[\"default\"])();\n\n let _playerInterface = null;\n let _propagateMaster = false;\n let _playerInterfaceOptions = {\n type: 'none',\n ignoreBufferedTimeRanges: true,\n disableFastSeek: false\n };\n const syncDefaultWaitTime = 60000;\n const syncShortWaitTime = 10000;\n const maxSyncThreshold = 0.5;\n const maxSyncTries = 3;\n const waitForPlayingEventAfterSeek = 5000;\n const fastForwardThreshold = 4;\n let currentSyncRetry = 0;\n let syncWaitId = null;\n let syncNextWaitTime = null;\n let stopFlag = false;\n let isSyncing = false;\n let safeSpace = 2;\n let playbackRate = 2;\n let isPlaying = false;\n let isPreloading = true;\n let isProgrammaticallySeeked = false;\n\n const startSyncLoop = () => {\n if (!isConnected() && _playerInterfaceOptions.type !== 'push') {\n room._log('--- Sync loop will not start due to user not connected yet ---');\n\n return;\n }\n\n if (syncWaitId) {\n room._log('--- Sync loop already running ---');\n\n return;\n }\n\n room._log('--- Sync enabled ---');\n\n stopFlag = false;\n\n if (_playerInterfaceOptions.type !== 'push') {\n const loop = () => {\n isSyncing = true;\n emitter.emit('playerSyncing', true);\n sync().finally(() => {\n isSyncing = false;\n emitter.emit('playerSyncing', false);\n\n if (isConnected() && !stopFlag) {\n syncWaitId = setTimeout(loop, syncNextWaitTime);\n } else {\n room._log('--- Automatic stop due to user not connected or stop flag enabled ---');\n\n stopSyncLoop();\n }\n });\n };\n\n loop();\n } else {\n const loop2 = () => {\n seekForward().then(() => {\n setNextWaitTime(false);\n }).catch(e => {\n setNextWaitTime(true);\n console.log('Sync failed', e);\n });\n syncWaitId = setTimeout(loop2, syncNextWaitTime);\n };\n\n loop2();\n }\n };\n\n const stopSyncLoop = doNotResetRetryCount => {\n room._log('--- Sync disabled ---');\n\n clearTimeout(syncWaitId);\n syncWaitId = null;\n\n if (!doNotResetRetryCount) {\n currentSyncRetry = 0;\n }\n\n stopFlag = true;\n };\n\n const restartSyncLoop = () => {\n room._log('--- Sync restarting ---');\n\n stopSyncLoop();\n startSyncLoop();\n };\n\n const setNextWaitTime = function () {\n let didSyncFail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (!didSyncFail) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n currentSyncRetry++;\n\n if (currentSyncRetry > maxSyncTries) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n syncNextWaitTime = syncShortWaitTime;\n }\n }\n\n room._log('--- Next sync will occur in ' + syncNextWaitTime / 1000 + ' seconds ---');\n };\n\n const sync = () => {\n return getSyncData().then(syncData => {\n if (syncData.isMaster) {\n if (_playerInterface.isPaused) _playerInterface.play();\n setNextWaitTime(false);\n return Promise.resolve();\n } else if (_propagateMaster) {\n setNextWaitTime(false);\n return propagateMasterFunc();\n } else {\n const syncStartTime = Date.now();\n const {\n position,\n realPosition,\n isBufferSufficient\n } = _playerInterface.getTimeDifference ? _playerInterface.getTimeDifference(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping) : getTimeDifference(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping);\n\n if (position && Math.abs(position) <= maxSyncThreshold) {\n room._log(`We're within max sync threshold, no need to resync now`);\n\n setNextWaitTime(false);\n return Promise.resolve();\n }\n\n if (position !== null && !isNaN(position)) {\n return seekBy(position).then(() => {\n const seekDuration = Date.now() - syncStartTime;\n const {\n position,\n realPosition,\n isBufferSufficient\n } = _playerInterface.getTimeDifference ? _playerInterface.getTimeDifference(syncData.masterFragmentSn, syncData.masterFragmentPos + seekDuration, syncData.ping) : getTimeDifference(syncData.masterFragmentSn, syncData.masterFragmentPos + seekDuration, syncData.ping);\n const syncPrecision = Math.abs(realPosition);\n\n room._log(`Insufficient buffer: `, !isBufferSufficient);\n\n room._log(`Seek duration is ${seekDuration / 1000} seconds`);\n\n room._log(`Sync precision should be ${syncPrecision}`);\n\n const didSyncFail = syncPrecision > maxSyncThreshold;\n setNextWaitTime(didSyncFail);\n return Promise.resolve();\n }).catch(e => {\n room._log(`Seek failed: `, e);\n\n setNextWaitTime(true);\n return Promise.reject(e);\n });\n } else {\n room._log(`Position in not a number: `, position);\n\n setNextWaitTime(true);\n return Promise.reject();\n }\n }\n }).catch(e => {\n room._log(`getSyncData() failed: `, e);\n\n setNextWaitTime(true);\n return Promise.reject();\n });\n };\n\n const handleAddLocalParticipant = () => {\n if (_propagateMaster) {\n propagateMasterFunc();\n }\n\n if (_playerInterface.isPaused === false) {\n _emitter.once('timeupdate', restartSyncLoop);\n }\n };\n\n const handleAddRemoteParticipant = () => {\n if (_propagateMaster) {\n propagateMasterFunc();\n }\n };\n\n const isConnected = () => {\n return room._isDataChannelOpen && room.isConnected;\n };\n\n const parseDataEvents = function () {\n let msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (msg.videoroom === 'sync_request') {\n roomSyncSend(msg.sync_slave_id).catch(() => {});\n }\n };\n\n const getCurrentPlayerPosition = () => {\n let position = _playerInterface.currentTime;\n return isNaN(position) ? 0 : position * 1000;\n };\n\n const getTimeDifference = (fragmentSn, fragmentPos, ping) => {\n let seekRanges = _playerInterface.buffered;\n let position = (fragmentPos + ping / 2) / 1000;\n let currentPlayerPosition = getCurrentPlayerPosition() / 1000;\n\n if (seekRanges && !_playerInterfaceOptions.ignoreBufferedTimeRanges) {\n let seekRange = {};\n\n for (let i = 0; i < seekRanges.length; i++) {\n let _c_start = seekRanges.start(i);\n\n let _c_end = seekRanges.end(i);\n\n if (!seekRange.start || _c_start < seekRange.start) {\n seekRange.start = _c_start;\n }\n\n if (!seekRange.end || _c_end > seekRange.end) {\n seekRange.end = _c_end;\n }\n }\n\n if (position > seekRange.start && position < seekRange.end) {\n return {\n position: position - currentPlayerPosition,\n realPosition: position - currentPlayerPosition,\n isBufferSufficient: true\n };\n } else if (position < seekRange.start) {\n room._log(`Syncing to ${seekRange.start} instead of ${position} due to lack of buffered data`);\n\n return {\n position: seekRange.start + 0.5 - currentPlayerPosition,\n realPosition: position - currentPlayerPosition,\n isBufferSufficient: false\n };\n } else if (position > seekRange.end) {\n room._log(`Syncing to ${seekRange.end} instead of ${position} due to lack of buffered data`);\n\n return {\n position: seekRange.end - 0.5 - currentPlayerPosition,\n realPosition: position - currentPlayerPosition,\n isBufferSufficient: false\n };\n } else return {\n position: null,\n isBufferSufficient: false\n };\n } else {\n return {\n position: position - currentPlayerPosition,\n realPosition: position - currentPlayerPosition,\n isBufferSufficient: true\n };\n }\n };\n\n const seekForward = () => {\n return new Promise((resolve, reject) => {\n let diff = _playerInterface.buffered.end(0) - _playerInterface.currentTime;\n\n let diff_target = diff - safeSpace;\n\n let __ = () => {\n _playerInterface.setPlaybackRate(1);\n\n isProgrammaticallySeeked = false;\n isSyncing = false;\n reject('Stalled');\n };\n\n console.log('Users stream is behind behind live by:', diff);\n\n if (diff_target > 0) {\n _emitter.once('stalled', __);\n\n Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"setExactTimeout\"])(() => {\n _playerInterface.setPlaybackRate(1);\n\n isProgrammaticallySeeked = false;\n isSyncing = false;\n\n _emitter.off('stalled', __);\n\n resolve();\n }, diff_target * 1000 / (playbackRate - 1), 20);\n isProgrammaticallySeeked = true;\n isSyncing = true;\n\n _playerInterface.setPlaybackRate(playbackRate);\n } else {\n resolve();\n }\n });\n };\n\n const seekBy = time => {\n return new Promise((resolve, reject) => {\n if (_playerInterface.currentTime !== time) {\n if (time > 0 && time < fastForwardThreshold && !_playerInterfaceOptions.disableFastSeek) {\n room._log(`Fast forward to seek...`);\n\n let wasPaused = false;\n\n let _handleFailed = () => {\n if (wasPaused) {\n _playerInterface.pause();\n }\n\n _playerInterface.setPlaybackRate(1);\n\n isProgrammaticallySeeked = false;\n reject('Stalled');\n };\n\n let _fastForward = () => {\n isProgrammaticallySeeked = true;\n Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"setExactTimeout\"])(() => {\n _emitter.off('stalled', _handleFailed);\n\n if (wasPaused && _playerInterface.isVod) {\n _playerInterface.pause();\n }\n\n _playerInterface.setPlaybackRate(1);\n\n isProgrammaticallySeeked = false;\n resolve();\n }, time * 1000 / (playbackRate - 1), 20);\n\n _playerInterface.setPlaybackRate(playbackRate);\n };\n\n _emitter.once('stalled', _handleFailed);\n\n if (_playerInterface.isPaused) {\n wasPaused = true;\n\n _playerInterface.play().then(() => {\n _fastForward();\n }).catch(_handleFailed);\n } else {\n _fastForward();\n }\n } else {\n room._log(`Jump to seek...`);\n\n let currentTimestamp = Date.now();\n let __failsafeId = null;\n\n let _resolve = () => {\n clearTimeout(__failsafeId);\n __failsafeId = null;\n isProgrammaticallySeeked = false;\n\n room._log(`It took the player ${(Date.now() - currentTimestamp) / 1000} seconds to seek `);\n\n resolve();\n };\n\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _emitter.once('playing', _resolve);\n\n __failsafeId = setTimeout(_resolve, waitForPlayingEventAfterSeek);\n\n _playerInterface.seek(_playerInterface.currentTime + time);\n }\n } else resolve();\n });\n };\n\n const seekTo = time => {\n return new Promise((resolve, reject) => {\n if (_playerInterface.currentTime !== time) {\n let diff = time - _playerInterface.currentTime;\n\n if (_playerInterface.currentTime < time && diff < fastForwardThreshold && !_playerInterfaceOptions.disableFastSeek) {\n room._log(`Fast forward to seek...`);\n\n let wasPaused = false;\n\n let _handleFailed = () => {\n if (wasPaused) {\n _playerInterface.pause();\n }\n\n _playerInterface.setPlaybackRate(1);\n\n isProgrammaticallySeeked = false;\n reject('Stalled');\n };\n\n let _fastForward = () => {\n isProgrammaticallySeeked = true;\n Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"setExactTimeout\"])(() => {\n _emitter.off('stalled', _handleFailed);\n\n if (wasPaused && _playerInterface.isVod) {\n _playerInterface.pause();\n }\n\n _playerInterface.setPlaybackRate(1);\n\n isProgrammaticallySeeked = false;\n resolve();\n }, diff * 1000 / (playbackRate - 1), 20);\n\n _playerInterface.setPlaybackRate(playbackRate);\n };\n\n _emitter.once('stalled', _handleFailed);\n\n if (_playerInterface.isPaused) {\n wasPaused = true;\n\n _playerInterface.play().then(() => {\n _fastForward();\n }).catch(_handleFailed);\n } else {\n _fastForward();\n }\n } else {\n room._log(`Jump to seek...`);\n\n let currentTimestamp = Date.now();\n let __failsafeId = null;\n\n let _resolve = () => {\n clearTimeout(__failsafeId);\n __failsafeId = null;\n isProgrammaticallySeeked = false;\n\n room._log(`It took the player ${(Date.now() - currentTimestamp) / 1000} seconds to seek `);\n\n resolve();\n };\n\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _emitter.once('playing', _resolve);\n\n __failsafeId = setTimeout(_resolve, waitForPlayingEventAfterSeek);\n\n _playerInterface.seek(time);\n }\n } else resolve();\n });\n };\n\n const handlePlaying = () => {\n if (!isProgrammaticallySeeked) {\n room._log('Handle playing');\n\n startSyncLoop();\n }\n\n isProgrammaticallySeeked = false;\n isPreloading = _playerInterface.isPaused;\n isPlaying = !_playerInterface.isPaused;\n };\n\n const handlePause = () => {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPlaying = !_playerInterface.isPaused;\n };\n\n const handleBuffering = () => {\n room._log('handleBuffering');\n\n if (!isProgrammaticallySeeked) {\n stopSyncLoop(true);\n clientPaused().catch(() => {});\n isPreloading = _playerInterface.isPaused;\n }\n };\n\n const roomSyncSend = slaveId => {\n var _playerInterface2;\n\n if (!_playerInterface) {\n room._log(`I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?`);\n\n return Promise.resolve();\n }\n\n var fragmentData = ((_playerInterface2 = _playerInterface) === null || _playerInterface2 === void 0 ? void 0 : _playerInterface2.currentFragment) || {\n fragment: String(\"0\"),\n fragment_pos: Number(parseInt(getCurrentPlayerPosition()))\n };\n\n room._log(`Sending my position to ${slaveId}`);\n\n room._log(`Current time: ${fragmentData.fragment} # ${fragmentData.fragment_pos}`);\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_response\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n slave_id: room.webrtcVersion > 1000 ? String(slaveId) : Number(slaveId),\n ...fragmentData\n }\n });\n };\n\n const getSyncData = () => {\n var _playerInterface3;\n\n room._log('Sending roomSync request');\n\n let roomId = room.roomId;\n var fragmentData = ((_playerInterface3 = _playerInterface) === null || _playerInterface3 === void 0 ? void 0 : _playerInterface3.currentFragment) || {\n fragment: String(\"0\"),\n fragment_pos: Number(parseInt(getCurrentPlayerPosition()))\n };\n return new Promise((resolve, reject) => {\n let now = new Date().getTime();\n let ping = null;\n let sid = setTimeout(() => {\n room.off('data', fn, this);\n reject('Timeout');\n }, 3000);\n let body = {\n request: \"sync\",\n room: roomId,\n timestamp: new Date().getTime(),\n ...fragmentData\n };\n\n let fn = msg => {\n if (msg.videoroom && ['sync', 'sync_response'].includes(msg.videoroom)) {\n if (msg.sync_master_await) {\n room._log('Waiting for master position');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n } else if (msg.sync_master_fragment || msg.sync_master_fragment_pos) {\n room._log('Got master position data');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n\n room._log(`I'm master: ${!!msg.sync_master_self}`);\n\n room._log(`Ping: ${ping}`);\n\n room._log(`Master fragment: ${msg.sync_master_fragment}`);\n\n room._log(`Master fragment position: ${msg.sync_master_fragment_pos}`);\n\n room.off('data', fn, this);\n clearTimeout(sid);\n resolve({\n isMaster: !!msg.sync_master_self,\n ping: ping,\n masterFragmentPos: parseInt(msg.sync_master_fragment_pos),\n masterFragmentSn: parseInt(msg.sync_master_fragment)\n });\n } else {\n clearTimeout(sid);\n reject('Master lost connection');\n }\n }\n };\n\n room.on('data', fn, this);\n room.sendMessage(room.handleId, {\n body\n }).then(fn).catch(e => {\n room.off('data', fn, this);\n clearTimeout(sid);\n reject(e);\n });\n });\n };\n\n const clientPaused = () => {\n room._log('Sending client paused');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_paused\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: '0',\n fragment_pos: 0\n }\n });\n };\n\n const propagateMasterFunc = () => {\n room._log('Propagating master');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_source_set\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n wt_channel_id: \"\",\n fragment: \"0\",\n fragment_pos: 0\n }\n });\n };\n\n return {\n __events: ['playerSyncing'],\n initialize: function () {\n let {\n playerInterface,\n propagateMaster = false\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _playerInterface = playerInterface;\n _playerInterfaceOptions = { ..._playerInterfaceOptions,\n ...(_playerInterface.syncSettings || {})\n };\n _propagateMaster = propagateMaster;\n\n room._log('Interface options passed: ', _playerInterface.syncSettings || {});\n\n room._log('All interface options: ', _playerInterfaceOptions);\n\n if (_playerInterfaceOptions.type === 'none') {\n room._log('Sync module has been disabled via type:none');\n\n return;\n } // if(_playerInterfaceOptions.type === 'push') {\n // \troom._log('Push sync is not implemented in this sync module yet');\n // \treturn;\n // }\n\n\n if (_playerInterface.isVod) {\n room._log('VOD sync is not implemented in this sync module yet');\n\n return;\n }\n\n playerInterface.addHandlers({\n handlePause: event => {\n room._log('handlePause');\n\n _emitter.emit('pause', event);\n },\n handlePlaying: event => {\n room._log('handlePlaying');\n\n _emitter.emit('playing', event);\n },\n handleBuffering: event => {\n room._log('handleBuffering');\n\n _emitter.emit('buffering', event);\n\n _emitter.emit('stalled', event);\n },\n handleTimeupdate: event => {\n room._log('handleTimeupdate');\n\n _emitter.emit('timeupdate', event);\n }\n });\n isPlaying = _playerInterface.isPaused === false;\n room.on('disconnect', stopSyncLoop);\n room.on('removeLocalParticipant', stopSyncLoop);\n room.on('addLocalParticipant', handleAddLocalParticipant);\n room.on('addRemoteParticipant', handleAddRemoteParticipant);\n room.on('data', parseDataEvents);\n\n if (_propagateMaster) {\n propagateMasterFunc().catch(() => {});\n }\n\n if (_playerInterface.isPaused === false) {\n _emitter.once('timeupdate', restartSyncLoop);\n }\n\n _emitter.on('buffering', handleBuffering);\n\n _emitter.on('playing', handlePlaying);\n\n _emitter.on('pause', handlePause);\n },\n destroy: () => {\n stopSyncLoop();\n room.off('disconnect', stopSyncLoop);\n room.off('removeLocalParticipant', stopSyncLoop);\n room.off('addLocalParticipant', handleAddLocalParticipant);\n room.off('addRemoteParticipant', handleAddRemoteParticipant);\n room.off('data', parseDataEvents);\n _playerInterface = null;\n\n _emitter.clear();\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (syncModule);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/sync-modules/sync-module.js?");
|
|
9311
9356
|
|
|
9312
9357
|
/***/ }),
|
|
9313
9358
|
|
|
@@ -9319,7 +9364,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_
|
|
|
9319
9364
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9320
9365
|
|
|
9321
9366
|
"use strict";
|
|
9322
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../wt-utils */ \"./src/modules/wt-utils.js\");\n\n\nconst syncVodHlsJs = function () {\n let {\n room,\n wt,\n roomSession,\n emitter\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n //SYNC VARS\n let _videoElement = null;\n let _roomId = null;\n let _syncDisabled = false;\n const syncDefaultWaitTime = 60000;\n const syncShortWaitTime = 10000;\n const maxSyncThreshold = 0.5;\n const maxSyncTries = 3;\n let currentSyncRetry = 0;\n let syncWaitId = null;\n let syncNextWaitTime = null;\n let stopFlag = false;\n let isSyncing = false;\n let seekingDebounceId = null;\n let seekingDebounceTimeout = 300;\n let isPlaying = false;\n let isProgrammaticallySeeked = false;\n let isForcedMaster = false;\n\n const startSyncLoop = () => {\n if (_syncDisabled) {\n room._log('--- Sync loop will not start due to sync force disabled ---');\n\n return;\n }\n\n if (!isConnected()) {\n room._log('--- Sync loop will not start due to user not connected yet ---');\n\n return;\n }\n\n if (syncWaitId) {\n room._log('--- Sync loop already running ---');\n\n return;\n }\n\n room._log('--- Sync enabled ---');\n\n stopFlag = false;\n\n const loop = () => {\n isSyncing = true;\n emitter.emit('playerSyncing', true);\n sync().finally(() => {\n isSyncing = false;\n emitter.emit('playerSyncing', false);\n\n if (isConnected() && !stopFlag) {\n syncWaitId = setTimeout(loop, syncNextWaitTime);\n } else {\n room._log('--- Automatic stop due to user not connected or stop flag enabled ---');\n\n stopSyncLoop();\n }\n });\n };\n\n loop();\n };\n\n const stopSyncLoop = () => {\n room._log('--- Sync disabled ---');\n\n clearTimeout(syncWaitId);\n syncWaitId = null;\n currentSyncRetry = 0;\n stopFlag = true;\n };\n\n const restartSyncLoop = () => {\n room._log('--- Sync restarting ---');\n\n stopSyncLoop();\n startSyncLoop();\n };\n\n const setNextWaitTime = function () {\n let didSyncFail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (!didSyncFail) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n currentSyncRetry++;\n\n if (currentSyncRetry > maxSyncTries) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n syncNextWaitTime = syncShortWaitTime;\n }\n }\n\n room._log('--- Next sync will occur in ' + syncNextWaitTime / 1000 + ' seconds ---');\n };\n\n const sync = () => {\n return getSyncData().then(syncData => {\n if (syncData.isMaster || stopFlag) {\n setNextWaitTime(false);\n return Promise.resolve();\n } else if (isForcedMaster) {\n setNextWaitTime(false);\n return propagateMasterFunc();\n } else {\n const syncStartTime = Date.now();\n const {\n position,\n isBufferSufficient\n } = calculateSyncDifferenceTime(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping);\n const currentPosition = getCurrentSegmentPosition() / 1000;\n\n if (syncData.masterFragmentSn) {\n playMedia();\n } else {\n pauseMedia();\n }\n\n if (position && Math.abs(position - currentPosition) <= maxSyncThreshold) {\n room._log(\"We're within max sync threshold, no need to resync now\");\n\n setNextWaitTime(false);\n return Promise.resolve();\n }\n\n if (position !== null) {\n return seekTo(position).then(() => {\n const seekDuration = (Date.now() - syncStartTime) / 1000;\n const syncPrecision = Math.abs(position + (isPlaying ? seekDuration : 0) - getCurrentSegmentPosition() / 1000);\n\n room._log(\"Insufficient buffer: \", !isBufferSufficient);\n\n room._log(\"Seek duration is \".concat(seekDuration));\n\n room._log(\"Sync precision should be \".concat(syncPrecision));\n\n const didSyncFail = syncPrecision > maxSyncThreshold;\n setNextWaitTime(didSyncFail);\n return Promise.resolve();\n }).catch(e => {\n setNextWaitTime(true);\n return Promise.reject(e);\n });\n } else {\n setNextWaitTime(true);\n return Promise.reject();\n }\n }\n }).catch(() => {\n setNextWaitTime(true);\n });\n };\n\n const handleAddLocalParticipant = () => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n\n if (_videoElement) {\n //TODO: shit fix ... data channel with other participant is not opened yet so we wait\n setTimeout(() => {\n restartSyncLoop();\n }, 1000);\n }\n };\n\n const handleAddRemoteParticipant = () => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n };\n\n const handleRemoveRemoteParticipant = () => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n };\n\n const isConnected = () => {\n return room._isDataChannelOpen && room.isConnected;\n };\n\n const executePlayerIotEvents = data => {\n let rid = _roomId || room.roomId;\n\n if (data.attributeName === 'playerReplay' && (!rid || (data === null || data === void 0 ? void 0 : data.roomId) === rid)) {\n seekTo(0).then(() => playMedia());\n }\n\n if (data.attributeName === 'playerPlay' && (!rid || (data === null || data === void 0 ? void 0 : data.roomId) === rid)) {\n playMedia();\n }\n\n if (data.attributeName === 'playerPause' && (!rid || (data === null || data === void 0 ? void 0 : data.roomId) === rid)) {\n pauseMedia();\n }\n };\n\n const parseIotEvents = data => {\n if (data.event === 'template_updated') {\n if (data.operation === 'multi') {\n (data.value || []).forEach(event => {\n if (event.operation === 'sendMessage') {\n executePlayerIotEvents({ ...event,\n roomId: data.roomId,\n userId: data.userId\n });\n }\n });\n }\n\n if (data.operation === 'sendMessage') {\n executePlayerIotEvents(data);\n }\n }\n };\n\n const parseDataEvents = function () {\n let msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (msg.videoroom === 'sync_source_set' && msg.wt_channel_id != \"\") {\n emitter.emit('changePlayerSource', msg.wt_channel_id);\n } else if (msg.videoroom === 'sync_request') {\n roomSyncSend(msg.sync_slave_id).catch(() => {});\n } else if (msg.videoroom === 'message') {\n // ignoring non studio commands if master\n if (isForcedMaster && msg.from !== null) {\n return;\n }\n\n if (_syncDisabled) {\n return;\n }\n\n if (msg.user_action === 'sync_seeking') {\n seekMedia(msg).catch(() => {});\n } else if (msg.user_action === 'sync_seeked') {} else if (msg.user_action === 'sync_play' || msg.action === 'sync_play') {\n playMedia();\n } else if (msg.user_action === 'sync_pause' || msg.action === 'sync_pause') {\n pauseMedia();\n }\n }\n };\n\n const getCurrentSegmentPosition = () => {\n let position = _videoElement && _videoElement.currentTime;\n return isNaN(position) ? 0 : position * 1000;\n };\n\n const calculateSyncDifferenceTime = function (fragmentSn) {\n let fragmentPos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n let ping = arguments.length > 2 ? arguments[2] : undefined;\n return {\n position: (fragmentPos + ping / 2) / 1000,\n isBufferSufficient: true\n };\n };\n\n const seekMedia = msg => {\n msg = {\n userId: msg.from,\n ...(msg.text && JSON.parse(msg.text))\n };\n\n if (msg.handleId !== room.handleId) {\n const {\n position,\n isBufferSufficient\n } = calculateSyncDifferenceTime(msg.fragment, msg.fragment_pos, 0); //TODO: right ping\n\n if (position) {\n return seekTo(position).then(() => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n });\n } else {\n return Promise.resolve();\n }\n } else {\n return Promise.resolve();\n }\n };\n\n const prePlay = () => {\n if (_videoElement.currentTime > 0 || _videoElement.paused === false) {\n return Promise.resolve();\n }\n\n isProgrammaticallySeeked = true;\n let wasMuted = _videoElement.muted;\n _videoElement.muted = true;\n return _videoElement.play().then(() => {\n _videoElement.pause();\n\n _videoElement.currentTime = 0;\n return Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"wait\"])(100);\n }).catch(() => true).finally(() => {\n _videoElement.muted = wasMuted;\n isProgrammaticallySeeked = false;\n return true;\n });\n };\n\n const playMedia = () => {\n if (_videoElement && _videoElement.paused) {\n isProgrammaticallySeeked = true;\n\n _videoElement.play().finally(() => {\n isProgrammaticallySeeked = false;\n });\n }\n };\n\n const pauseMedia = () => {\n if (_videoElement && !_videoElement.paused) {\n isProgrammaticallySeeked = true;\n\n _videoElement.addEventListener('pause', () => {\n isProgrammaticallySeeked = false;\n }, {\n once: true\n });\n\n _videoElement.pause();\n }\n };\n\n const seekTo = time => {\n return new Promise(resolve => {\n if (_videoElement.currentTime !== time) {\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _videoElement.addEventListener('seeked', () => {\n isProgrammaticallySeeked = false;\n resolve();\n }, {\n once: true\n });\n\n _videoElement.currentTime = time;\n } else resolve();\n });\n };\n\n const handlePlaying = () => {\n if (!isProgrammaticallySeeked) {\n roomSession.sendSystemMessage('sync_play', {\n timestamp: new Date().getTime(),\n handleId: room.handleId\n }, undefined, null).catch(() => {});\n }\n\n isPlaying = !_videoElement.paused;\n };\n\n const handlePause = () => {\n if (!isProgrammaticallySeeked) {\n roomSession.sendSystemMessage('sync_pause', {\n timestamp: new Date().getTime(),\n handleId: room.handleId\n }, undefined, null).catch(() => {});\n }\n\n isPlaying = !_videoElement.paused;\n };\n\n const handleStalledWaiting = () => {\n if (!isProgrammaticallySeeked) {\n clientPaused().catch(() => {});\n }\n };\n\n const handleSeeking = () => {\n clearTimeout(seekingDebounceId);\n\n if (!isProgrammaticallySeeked) {\n seekingDebounceId = setTimeout(() => {\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n roomSession.sendSystemMessage('sync_seeking', {\n timestamp: new Date().getTime(),\n handleId: room.handleId,\n fragment: \"0\",\n //isPlaying ? \"1\":\"0\",\n fragment_pos: Number(fragmentPosition)\n }, undefined, null).catch(() => {});\n\n if (!isForcedMaster && !_syncDisabled) {\n pauseMedia();\n }\n }, seekingDebounceTimeout);\n }\n };\n\n const handleSeeked = () => {};\n\n const handleEnded = () => {};\n\n const roomSyncSend = slaveId => {\n if (!_videoElement) {\n room._log(\"I've been asked for position even if we don't have player attached.\\n Does it mean I'm the master?\");\n\n return Promise.resolve();\n }\n\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n\n room._log(\"Sending my position to \".concat(slaveId));\n\n room._log(\"Current time: \".concat(fragmentPosition));\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_response\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: isPlaying ? \"1\" : \"0\",\n fragment_pos: Number(fragmentPosition),\n slave_id: room.webrtcVersion > 1000 ? String(slaveId) : Number(slaveId)\n }\n });\n };\n\n const getSyncData = () => {\n room._log('Sending roomSync request');\n\n let roomId = room.roomId;\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n return new Promise((resolve, reject) => {\n let now = new Date().getTime();\n let ping = null;\n let sid = setTimeout(() => {\n room.off('data', fn, this);\n reject('Timeout');\n }, 3000);\n let body = {\n request: \"sync\",\n room: roomId,\n timestamp: new Date().getTime(),\n fragment: isPlaying ? \"1\" : \"0\",\n fragment_pos: Number(fragmentPosition)\n };\n\n let fn = msg => {\n if (msg.videoroom && ['sync', 'sync_response'].includes(msg.videoroom)) {\n if (msg.sync_master_await) {\n room._log('Waiting for master position');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n } else if (msg.sync_master_fragment || msg.sync_master_fragment_pos) {\n room._log('Got master position data');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n\n room._log(\"I'm master: \".concat(!!msg.sync_master_self));\n\n room._log(\"Ping: \".concat(ping));\n\n room._log(\"Master fragment: \".concat(msg.sync_master_fragment));\n\n room._log(\"Master fragment position: \".concat(msg.sync_master_fragment_pos));\n\n room.off('data', fn, this);\n clearTimeout(sid);\n resolve({\n isMaster: !!msg.sync_master_self,\n ping: ping,\n masterFragmentPos: parseInt(msg.sync_master_fragment_pos),\n masterFragmentSn: parseInt(msg.sync_master_fragment)\n });\n } else {\n clearTimeout(sid);\n reject('Master lost connection');\n }\n }\n };\n\n room.on('data', fn, this);\n room.sendMessage(room.handleId, {\n body\n }).then(fn).catch(e => {\n room.off('data', fn, this);\n clearTimeout(sid);\n reject(e);\n });\n });\n };\n\n const clientPaused = () => {\n room._log('Sending client paused');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_paused\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: '0',\n fragment_pos: 0\n }\n });\n };\n\n const propagateMasterFunc = () => {\n room._log('Propagating master');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_source_set\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n wt_channel_id: \"\",\n fragment: \"0\",\n fragment_pos: 0\n }\n });\n };\n\n return {\n __events: ['playerSyncing'],\n initialize: function () {\n let {\n videoElement,\n propagateMaster = false,\n isStudio = false,\n roomId,\n syncDisabled\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _videoElement = videoElement;\n _roomId = roomId;\n _syncDisabled = syncDisabled;\n\n if (!_videoElement) {\n room._log('No video element present!');\n\n return;\n }\n\n emitter.emit('playerSyncing', false);\n isForcedMaster = propagateMaster;\n isPlaying = _videoElement.paused === false;\n room.on('disconnect', stopSyncLoop);\n room.on('addLocalParticipant', handleAddLocalParticipant);\n room.on('removeLocalParticipant', stopSyncLoop);\n room.on('addRemoteParticipant', handleAddRemoteParticipant);\n room.on('removeRemoteParticipant', handleRemoveRemoteParticipant);\n room.on('data', parseDataEvents);\n wt.iot.$on('message', parseIotEvents);\n\n if (isForcedMaster) {\n propagateMasterFunc().catch(() => {});\n }\n\n if (_videoElement) {\n (propagateMaster || isStudio ? Promise.resolve() : prePlay()).then(() => {\n _videoElement.addEventListener('stalled', handleStalledWaiting);\n\n _videoElement.addEventListener('playing', handlePlaying);\n\n _videoElement.addEventListener('pause', handlePause);\n\n _videoElement.addEventListener('seeking', handleSeeking);\n\n _videoElement.addEventListener('seeked', handleSeeked);\n\n _videoElement.addEventListener('ended', handleEnded);\n\n startSyncLoop();\n });\n }\n },\n destroy: () => {\n stopSyncLoop();\n room.off('disconnect', stopSyncLoop);\n room.off('addLocalParticipant', handleAddLocalParticipant);\n room.off('removeLocalParticipant', stopSyncLoop);\n room.off('addRemoteParticipant', handleAddRemoteParticipant);\n room.off('removeRemoteParticipant', handleRemoveRemoteParticipant);\n room.off('data', parseDataEvents);\n wt.iot.$off('message', parseIotEvents);\n\n if (_videoElement) {\n _videoElement.removeEventListener('stalled', handleStalledWaiting);\n\n _videoElement.removeEventListener('playing', handlePlaying);\n\n _videoElement.removeEventListener('pause', handlePause);\n\n _videoElement.removeEventListener('seeking', handleSeeking);\n\n _videoElement.removeEventListener('seeked', handleSeeked);\n\n _videoElement.removeEventListener('ended', handleEnded);\n }\n\n _videoElement = null;\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (syncVodHlsJs);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/sync-modules/sync-native-hls-vod.js?");
|
|
9367
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../wt-utils */ \"./src/modules/wt-utils.js\");\n\n\nconst syncVodHlsJs = function () {\n let {\n room,\n wt,\n roomSession,\n emitter\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n //SYNC VARS\n let _videoElement = null;\n let _roomId = null;\n let _syncDisabled = false;\n const syncDefaultWaitTime = 60000;\n const syncShortWaitTime = 10000;\n const maxSyncThreshold = 0.5;\n const maxSyncTries = 3;\n let currentSyncRetry = 0;\n let syncWaitId = null;\n let syncNextWaitTime = null;\n let stopFlag = false;\n let isSyncing = false;\n let seekingDebounceId = null;\n let seekingDebounceTimeout = 300;\n let isPlaying = false;\n let isProgrammaticallySeeked = false;\n let isForcedMaster = false;\n\n const startSyncLoop = () => {\n if (_syncDisabled) {\n room._log('--- Sync loop will not start due to sync force disabled ---');\n\n return;\n }\n\n if (!isConnected()) {\n room._log('--- Sync loop will not start due to user not connected yet ---');\n\n return;\n }\n\n if (syncWaitId) {\n room._log('--- Sync loop already running ---');\n\n return;\n }\n\n room._log('--- Sync enabled ---');\n\n stopFlag = false;\n\n const loop = () => {\n isSyncing = true;\n emitter.emit('playerSyncing', true);\n sync().finally(() => {\n isSyncing = false;\n emitter.emit('playerSyncing', false);\n\n if (isConnected() && !stopFlag) {\n syncWaitId = setTimeout(loop, syncNextWaitTime);\n } else {\n room._log('--- Automatic stop due to user not connected or stop flag enabled ---');\n\n stopSyncLoop();\n }\n });\n };\n\n loop();\n };\n\n const stopSyncLoop = () => {\n room._log('--- Sync disabled ---');\n\n clearTimeout(syncWaitId);\n syncWaitId = null;\n currentSyncRetry = 0;\n stopFlag = true;\n };\n\n const restartSyncLoop = () => {\n room._log('--- Sync restarting ---');\n\n stopSyncLoop();\n startSyncLoop();\n };\n\n const setNextWaitTime = function () {\n let didSyncFail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (!didSyncFail) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n currentSyncRetry++;\n\n if (currentSyncRetry > maxSyncTries) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n syncNextWaitTime = syncShortWaitTime;\n }\n }\n\n room._log('--- Next sync will occur in ' + syncNextWaitTime / 1000 + ' seconds ---');\n };\n\n const sync = () => {\n return getSyncData().then(syncData => {\n if (syncData.isMaster || stopFlag) {\n setNextWaitTime(false);\n return Promise.resolve();\n } else if (isForcedMaster) {\n setNextWaitTime(false);\n return propagateMasterFunc();\n } else {\n const syncStartTime = Date.now();\n const {\n position,\n isBufferSufficient\n } = calculateSyncDifferenceTime(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping);\n const currentPosition = getCurrentSegmentPosition() / 1000;\n\n if (syncData.masterFragmentSn) {\n playMedia();\n } else {\n pauseMedia();\n }\n\n if (position && Math.abs(position - currentPosition) <= maxSyncThreshold) {\n room._log(`We're within max sync threshold, no need to resync now`);\n\n setNextWaitTime(false);\n return Promise.resolve();\n }\n\n if (position !== null) {\n return seekTo(position).then(() => {\n const seekDuration = (Date.now() - syncStartTime) / 1000;\n const syncPrecision = Math.abs(position + (isPlaying ? seekDuration : 0) - getCurrentSegmentPosition() / 1000);\n\n room._log(`Insufficient buffer: `, !isBufferSufficient);\n\n room._log(`Seek duration is ${seekDuration}`);\n\n room._log(`Sync precision should be ${syncPrecision}`);\n\n const didSyncFail = syncPrecision > maxSyncThreshold;\n setNextWaitTime(didSyncFail);\n return Promise.resolve();\n }).catch(e => {\n setNextWaitTime(true);\n return Promise.reject(e);\n });\n } else {\n setNextWaitTime(true);\n return Promise.reject();\n }\n }\n }).catch(() => {\n setNextWaitTime(true);\n });\n };\n\n const handleAddLocalParticipant = () => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n\n if (_videoElement) {\n //TODO: shit fix ... data channel with other participant is not opened yet so we wait\n setTimeout(() => {\n restartSyncLoop();\n }, 1000);\n }\n };\n\n const handleAddRemoteParticipant = () => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n };\n\n const handleRemoveRemoteParticipant = () => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n };\n\n const isConnected = () => {\n return room._isDataChannelOpen && room.isConnected;\n };\n\n const executePlayerIotEvents = data => {\n let rid = _roomId || room.roomId;\n\n if (data.attributeName === 'playerReplay' && (!rid || (data === null || data === void 0 ? void 0 : data.roomId) === rid)) {\n seekTo(0).then(() => playMedia());\n }\n\n if (data.attributeName === 'playerPlay' && (!rid || (data === null || data === void 0 ? void 0 : data.roomId) === rid)) {\n playMedia();\n }\n\n if (data.attributeName === 'playerPause' && (!rid || (data === null || data === void 0 ? void 0 : data.roomId) === rid)) {\n pauseMedia();\n }\n };\n\n const parseIotEvents = data => {\n if (data.event === 'template_updated') {\n if (data.operation === 'multi') {\n (data.value || []).forEach(event => {\n if (event.operation === 'sendMessage') {\n executePlayerIotEvents({ ...event,\n roomId: data.roomId,\n userId: data.userId\n });\n }\n });\n }\n\n if (data.operation === 'sendMessage') {\n executePlayerIotEvents(data);\n }\n }\n };\n\n const parseDataEvents = function () {\n let msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (msg.videoroom === 'sync_source_set' && msg.wt_channel_id != \"\") {\n emitter.emit('changePlayerSource', msg.wt_channel_id);\n } else if (msg.videoroom === 'sync_request') {\n roomSyncSend(msg.sync_slave_id).catch(() => {});\n } else if (msg.videoroom === 'message') {\n // ignoring non studio commands if master\n if (isForcedMaster && msg.from !== null) {\n return;\n }\n\n if (_syncDisabled) {\n return;\n }\n\n if (msg.user_action === 'sync_seeking') {\n seekMedia(msg).catch(() => {});\n } else if (msg.user_action === 'sync_seeked') {} else if (msg.user_action === 'sync_play' || msg.action === 'sync_play') {\n playMedia();\n } else if (msg.user_action === 'sync_pause' || msg.action === 'sync_pause') {\n pauseMedia();\n }\n }\n };\n\n const getCurrentSegmentPosition = () => {\n let position = _videoElement && _videoElement.currentTime;\n return isNaN(position) ? 0 : position * 1000;\n };\n\n const calculateSyncDifferenceTime = function (fragmentSn) {\n let fragmentPos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n let ping = arguments.length > 2 ? arguments[2] : undefined;\n return {\n position: (fragmentPos + ping / 2) / 1000,\n isBufferSufficient: true\n };\n };\n\n const seekMedia = msg => {\n msg = {\n userId: msg.from,\n ...(msg.text && JSON.parse(msg.text))\n };\n\n if (msg.handleId !== room.handleId) {\n const {\n position,\n isBufferSufficient\n } = calculateSyncDifferenceTime(msg.fragment, msg.fragment_pos, 0); //TODO: right ping\n\n if (position) {\n return seekTo(position).then(() => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n });\n } else {\n return Promise.resolve();\n }\n } else {\n return Promise.resolve();\n }\n };\n\n const prePlay = () => {\n if (_videoElement.currentTime > 0 || _videoElement.paused === false) {\n return Promise.resolve();\n }\n\n isProgrammaticallySeeked = true;\n let wasMuted = _videoElement.muted;\n _videoElement.muted = true;\n return _videoElement.play().then(() => {\n _videoElement.pause();\n\n _videoElement.currentTime = 0;\n return Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"wait\"])(100);\n }).catch(() => true).finally(() => {\n _videoElement.muted = wasMuted;\n isProgrammaticallySeeked = false;\n return true;\n });\n };\n\n const playMedia = () => {\n if (_videoElement && _videoElement.paused) {\n isProgrammaticallySeeked = true;\n\n _videoElement.play().finally(() => {\n isProgrammaticallySeeked = false;\n });\n }\n };\n\n const pauseMedia = () => {\n if (_videoElement && !_videoElement.paused) {\n isProgrammaticallySeeked = true;\n\n _videoElement.addEventListener('pause', () => {\n isProgrammaticallySeeked = false;\n }, {\n once: true\n });\n\n _videoElement.pause();\n }\n };\n\n const seekTo = time => {\n return new Promise(resolve => {\n if (_videoElement.currentTime !== time) {\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _videoElement.addEventListener('seeked', () => {\n isProgrammaticallySeeked = false;\n resolve();\n }, {\n once: true\n });\n\n _videoElement.currentTime = time;\n } else resolve();\n });\n };\n\n const handlePlaying = () => {\n if (!isProgrammaticallySeeked) {\n roomSession.sendSystemMessage('sync_play', {\n timestamp: new Date().getTime(),\n handleId: room.handleId\n }, undefined, null).catch(() => {});\n }\n\n isPlaying = !_videoElement.paused;\n };\n\n const handlePause = () => {\n if (!isProgrammaticallySeeked) {\n roomSession.sendSystemMessage('sync_pause', {\n timestamp: new Date().getTime(),\n handleId: room.handleId\n }, undefined, null).catch(() => {});\n }\n\n isPlaying = !_videoElement.paused;\n };\n\n const handleStalledWaiting = () => {\n if (!isProgrammaticallySeeked) {\n clientPaused().catch(() => {});\n }\n };\n\n const handleSeeking = () => {\n clearTimeout(seekingDebounceId);\n\n if (!isProgrammaticallySeeked) {\n seekingDebounceId = setTimeout(() => {\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n roomSession.sendSystemMessage('sync_seeking', {\n timestamp: new Date().getTime(),\n handleId: room.handleId,\n fragment: \"0\",\n //isPlaying ? \"1\":\"0\",\n fragment_pos: Number(fragmentPosition)\n }, undefined, null).catch(() => {});\n\n if (!isForcedMaster && !_syncDisabled) {\n pauseMedia();\n }\n }, seekingDebounceTimeout);\n }\n };\n\n const handleSeeked = () => {};\n\n const handleEnded = () => {};\n\n const roomSyncSend = slaveId => {\n if (!_videoElement) {\n room._log(`I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?`);\n\n return Promise.resolve();\n }\n\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n\n room._log(`Sending my position to ${slaveId}`);\n\n room._log(`Current time: ${fragmentPosition}`);\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_response\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: isPlaying ? \"1\" : \"0\",\n fragment_pos: Number(fragmentPosition),\n slave_id: room.webrtcVersion > 1000 ? String(slaveId) : Number(slaveId)\n }\n });\n };\n\n const getSyncData = () => {\n room._log('Sending roomSync request');\n\n let roomId = room.roomId;\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n return new Promise((resolve, reject) => {\n let now = new Date().getTime();\n let ping = null;\n let sid = setTimeout(() => {\n room.off('data', fn, this);\n reject('Timeout');\n }, 3000);\n let body = {\n request: \"sync\",\n room: roomId,\n timestamp: new Date().getTime(),\n fragment: isPlaying ? \"1\" : \"0\",\n fragment_pos: Number(fragmentPosition)\n };\n\n let fn = msg => {\n if (msg.videoroom && ['sync', 'sync_response'].includes(msg.videoroom)) {\n if (msg.sync_master_await) {\n room._log('Waiting for master position');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n } else if (msg.sync_master_fragment || msg.sync_master_fragment_pos) {\n room._log('Got master position data');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n\n room._log(`I'm master: ${!!msg.sync_master_self}`);\n\n room._log(`Ping: ${ping}`);\n\n room._log(`Master fragment: ${msg.sync_master_fragment}`);\n\n room._log(`Master fragment position: ${msg.sync_master_fragment_pos}`);\n\n room.off('data', fn, this);\n clearTimeout(sid);\n resolve({\n isMaster: !!msg.sync_master_self,\n ping: ping,\n masterFragmentPos: parseInt(msg.sync_master_fragment_pos),\n masterFragmentSn: parseInt(msg.sync_master_fragment)\n });\n } else {\n clearTimeout(sid);\n reject('Master lost connection');\n }\n }\n };\n\n room.on('data', fn, this);\n room.sendMessage(room.handleId, {\n body\n }).then(fn).catch(e => {\n room.off('data', fn, this);\n clearTimeout(sid);\n reject(e);\n });\n });\n };\n\n const clientPaused = () => {\n room._log('Sending client paused');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_paused\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: '0',\n fragment_pos: 0\n }\n });\n };\n\n const propagateMasterFunc = () => {\n room._log('Propagating master');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_source_set\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n wt_channel_id: \"\",\n fragment: \"0\",\n fragment_pos: 0\n }\n });\n };\n\n return {\n __events: ['playerSyncing'],\n initialize: function () {\n let {\n videoElement,\n propagateMaster = false,\n isStudio = false,\n roomId,\n syncDisabled\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _videoElement = videoElement;\n _roomId = roomId;\n _syncDisabled = syncDisabled;\n\n if (!_videoElement) {\n room._log('No video element present!');\n\n return;\n }\n\n emitter.emit('playerSyncing', false);\n isForcedMaster = propagateMaster;\n isPlaying = _videoElement.paused === false;\n room.on('disconnect', stopSyncLoop);\n room.on('addLocalParticipant', handleAddLocalParticipant);\n room.on('removeLocalParticipant', stopSyncLoop);\n room.on('addRemoteParticipant', handleAddRemoteParticipant);\n room.on('removeRemoteParticipant', handleRemoveRemoteParticipant);\n room.on('data', parseDataEvents);\n wt.iot.$on('message', parseIotEvents);\n\n if (isForcedMaster) {\n propagateMasterFunc().catch(() => {});\n }\n\n if (_videoElement) {\n (propagateMaster || isStudio ? Promise.resolve() : prePlay()).then(() => {\n _videoElement.addEventListener('stalled', handleStalledWaiting);\n\n _videoElement.addEventListener('playing', handlePlaying);\n\n _videoElement.addEventListener('pause', handlePause);\n\n _videoElement.addEventListener('seeking', handleSeeking);\n\n _videoElement.addEventListener('seeked', handleSeeked);\n\n _videoElement.addEventListener('ended', handleEnded);\n\n startSyncLoop();\n });\n }\n },\n destroy: () => {\n stopSyncLoop();\n room.off('disconnect', stopSyncLoop);\n room.off('addLocalParticipant', handleAddLocalParticipant);\n room.off('removeLocalParticipant', stopSyncLoop);\n room.off('addRemoteParticipant', handleAddRemoteParticipant);\n room.off('removeRemoteParticipant', handleRemoveRemoteParticipant);\n room.off('data', parseDataEvents);\n wt.iot.$off('message', parseIotEvents);\n\n if (_videoElement) {\n _videoElement.removeEventListener('stalled', handleStalledWaiting);\n\n _videoElement.removeEventListener('playing', handlePlaying);\n\n _videoElement.removeEventListener('pause', handlePause);\n\n _videoElement.removeEventListener('seeking', handleSeeking);\n\n _videoElement.removeEventListener('seeked', handleSeeked);\n\n _videoElement.removeEventListener('ended', handleEnded);\n }\n\n _videoElement = null;\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (syncVodHlsJs);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/sync-modules/sync-native-hls-vod.js?");
|
|
9323
9368
|
|
|
9324
9369
|
/***/ }),
|
|
9325
9370
|
|
|
@@ -9331,7 +9376,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_
|
|
|
9331
9376
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9332
9377
|
|
|
9333
9378
|
"use strict";
|
|
9334
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../wt-utils */ \"./src/modules/wt-utils.js\");\n\n\nconst syncNativeHls = function () {\n let {\n room,\n wt,\n roomSession,\n emitter\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n //SYNC VARS\n let _videoElement = null;\n const syncDefaultWaitTime = 60000;\n const syncShortWaitTime = 10000;\n const maxSyncThreshold = 0.5;\n const maxSyncTries = 3;\n let currentSyncRetry = 0;\n let syncWaitId = null;\n let syncNextWaitTime = null;\n let stopFlag = false;\n let isSyncing = false;\n let playbackRate = 2;\n let isPlaying = false;\n let isPreloading = true;\n let isProgrammaticallySeeked = false;\n let shouldPropagateMaster = false;\n\n const startSyncLoop = () => {\n if (!isConnected()) {\n room._log('--- Sync loop will not start due to user not connected yet ---');\n\n return;\n }\n\n if (syncWaitId) {\n room._log('--- Sync loop already running ---');\n\n return;\n }\n\n room._log('--- Sync enabled ---');\n\n stopFlag = false;\n\n const loop = () => {\n isSyncing = true;\n emitter.emit('playerSyncing', true);\n sync().finally(() => {\n isSyncing = false;\n emitter.emit('playerSyncing', false);\n\n if (isConnected() && !stopFlag) {\n syncWaitId = setTimeout(loop, syncNextWaitTime);\n } else {\n room._log('--- Automatic stop due to user not connected or stop flag enabled ---');\n\n stopSyncLoop();\n }\n });\n };\n\n loop();\n };\n\n const stopSyncLoop = () => {\n room._log('--- Sync disabled ---');\n\n clearTimeout(syncWaitId);\n syncWaitId = null;\n currentSyncRetry = 0;\n stopFlag = true;\n };\n\n const restartSyncLoop = () => {\n room._log('--- Sync restarting ---');\n\n stopSyncLoop();\n startSyncLoop();\n };\n\n const setNextWaitTime = function () {\n let didSyncFail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (!didSyncFail) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n currentSyncRetry++;\n\n if (currentSyncRetry > maxSyncTries) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n syncNextWaitTime = syncShortWaitTime;\n }\n }\n\n room._log('--- Next sync will occur in ' + syncNextWaitTime / 1000 + ' seconds ---');\n };\n\n const sync = () => {\n return getSyncData().then(syncData => {\n if (syncData.isMaster) {\n if (_videoElement.paused) _videoElement.play();\n setNextWaitTime(false);\n return Promise.resolve();\n } else if (shouldPropagateMaster) {\n setNextWaitTime(false);\n return propagateMasterFunc();\n } else {\n const syncStartTime = Date.now();\n const {\n position,\n realPosition,\n isBufferSufficient\n } = calculateSyncDifferenceTime(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping);\n const currentPosition = getCurrentSegmentPosition() / 1000;\n\n if (position && Math.abs(position - currentPosition) <= maxSyncThreshold) {\n room._log(\"We're within max sync threshold, no need to resync now\");\n\n setNextWaitTime(false);\n return Promise.resolve();\n }\n\n if (position !== null) {\n return seekTo(position).then(() => {\n const seekDuration = (Date.now() - syncStartTime) / 1000;\n const syncPrecision = Math.abs(realPosition + seekDuration - getCurrentSegmentPosition() / 1000);\n\n room._log(\"Insufficient buffer: \", !isBufferSufficient);\n\n room._log(\"Seek duration is \".concat(seekDuration));\n\n room._log(\"Sync precision should be \".concat(syncPrecision));\n\n const didSyncFail = syncPrecision > maxSyncThreshold;\n setNextWaitTime(didSyncFail);\n return Promise.resolve();\n }).catch(e => {\n setNextWaitTime(true);\n return Promise.reject(e);\n });\n } else {\n setNextWaitTime(true);\n return Promise.reject();\n }\n }\n }).catch(() => {\n setNextWaitTime(true);\n return Promise.reject();\n });\n };\n\n const handleAddLocalParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n\n if (_videoElement && _videoElement.paused === false) {\n _videoElement.addEventListener('progress', () => {\n restartSyncLoop();\n }, {\n once: true\n });\n }\n };\n\n const handleAddRemoteParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n };\n\n const isConnected = () => {\n return room._isDataChannelOpen && room.isConnected;\n };\n\n const parseDataEvents = function () {\n let msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (msg.videoroom === 'sync_source_set' && msg.wt_channel_id != \"\") {\n emitter.emit('changePlayerSource', msg.wt_channel_id);\n } else if (msg.videoroom === 'sync_request') {\n roomSyncSend(msg.sync_slave_id).catch(() => {});\n }\n };\n\n const getCurrentSegmentPosition = () => {\n let position = _videoElement && _videoElement.currentTime;\n return isNaN(position) ? 0 : position * 1000;\n };\n\n const calculateSyncDifferenceTime = (fragmentSn, fragmentPos, ping) => {\n let seekRanges = _videoElement.buffered;\n let seekRange = {};\n\n for (let i = 0; i < seekRanges.length; i++) {\n let _c_start = seekRanges.start(i);\n\n let _c_end = seekRanges.end(i);\n\n if (!seekRange.start || _c_start < seekRange.start) {\n seekRange.start = _c_start;\n }\n\n if (!seekRange.end || _c_end > seekRange.end) {\n seekRange.end = _c_end;\n }\n }\n\n let position = (fragmentPos + ping / 2) / 1000;\n\n if (position > seekRange.start && position < seekRange.end) {\n return {\n position,\n isBufferSufficient: true\n };\n } else if (position < seekRange.start) {\n room._log(\"Syncing to \".concat(seekRange.start, \" instead of \").concat(position, \" due to lack of buffered data\"));\n\n return {\n position: seekRange.start + 0.5,\n realPosition: position,\n isBufferSufficient: false\n };\n } else if (position > seekRange.end) {\n room._log(\"Syncing to \".concat(seekRange.end, \" instead of \").concat(position, \" due to lack of buffered data\"));\n\n return {\n position: seekRange.end - 0.5,\n realPosition: position,\n isBufferSufficient: false\n };\n } else return {\n position: null,\n realPosition: position,\n isBufferSufficient: false\n };\n };\n\n const seekTo = time => {\n return new Promise((resolve, reject) => {\n if (_videoElement.currentTime !== time) {\n let diff = time - _videoElement.currentTime;\n\n if (_videoElement.currentTime < time && diff < 4) {\n room._log(\"Fast forward to seek...\");\n\n let wasPaused = false;\n\n let __ = () => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false;\n reject('Stalled');\n }; // _videoElement.addEventListener('waiting', __, {once:true});\n\n\n _videoElement.addEventListener('stalled', __, {\n once: true\n });\n\n Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"setExactTimeout\"])(() => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false; // _videoElement.removeEventListener('waiting', __, {once:true});\n\n _videoElement.removeEventListener('stalled', __, {\n once: true\n });\n\n resolve();\n }, diff * 1000 / (playbackRate - 1), 20);\n isProgrammaticallySeeked = true;\n\n if (_videoElement.paused) {\n wasPaused = true;\n\n _videoElement.play().then(() => {\n _videoElement.playbackRate = playbackRate;\n });\n } else {\n _videoElement.playbackRate = playbackRate;\n }\n } else {\n room._log(\"Jump to seek...\");\n\n let __ = Date.now();\n\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _videoElement.addEventListener('playing', () => {\n room._log(\"It took the player \".concat((Date.now() - __) / 1000, \" seconds to seek \"));\n\n isProgrammaticallySeeked = false;\n resolve();\n }, {\n once: true\n });\n\n _videoElement.currentTime = time;\n }\n } else resolve();\n });\n };\n\n const handlePlaying = () => {\n if (!isProgrammaticallySeeked) {\n room._log('Handle playing');\n\n startSyncLoop();\n }\n\n isProgrammaticallySeeked = false;\n isPreloading = _videoElement.paused;\n isPlaying = !_videoElement.paused;\n };\n\n const handlePause = () => {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPlaying = !_videoElement.paused;\n };\n\n const handleStalledWaiting = () => {\n room._log('handleStalledWaiting');\n\n if (!isProgrammaticallySeeked) {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPreloading = _videoElement.paused;\n }\n };\n\n let sgtid = null;\n\n const stalledGenerator = () => {\n clearTimeout(sgtid);\n sgtid = setTimeout(() => {\n if (_videoElement.paused === false) {\n handleStalledWaiting();\n }\n }, 1000);\n };\n\n const roomSyncSend = slaveId => {\n if (!_videoElement) {\n room._log(\"I've been asked for position even if we don't have player attached.\\n Does it mean I'm the master?\");\n\n return Promise.resolve();\n }\n\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n\n room._log(\"Sending my position to \".concat(slaveId));\n\n room._log(\"Current time: \".concat(fragmentPosition));\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_response\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: String(\"0\"),\n fragment_pos: Number(fragmentPosition),\n slave_id: room.webrtcVersion > 1000 ? String(slaveId) : Number(slaveId)\n }\n });\n };\n\n const getSyncData = () => {\n room._log('Sending roomSync request');\n\n let roomId = room.roomId;\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n return new Promise((resolve, reject) => {\n let now = new Date().getTime();\n let ping = null;\n let sid = setTimeout(() => {\n room.off('data', fn, this);\n reject('Timeout');\n }, 3000);\n let body = {\n request: \"sync\",\n room: roomId,\n timestamp: new Date().getTime(),\n fragment: String(\"0\"),\n fragment_pos: Number(fragmentPosition)\n };\n\n let fn = msg => {\n if (msg.videoroom && ['sync', 'sync_response'].includes(msg.videoroom)) {\n if (msg.sync_master_await) {\n room._log('Waiting for master position');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n } else if (msg.sync_master_fragment || msg.sync_master_fragment_pos) {\n room._log('Got master position data');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n\n room._log(\"I'm master: \".concat(!!msg.sync_master_self));\n\n room._log(\"Ping: \".concat(ping));\n\n room._log(\"Master fragment: \".concat(msg.sync_master_fragment));\n\n room._log(\"Master fragment position: \".concat(msg.sync_master_fragment_pos));\n\n room.off('data', fn, this);\n clearTimeout(sid);\n resolve({\n isMaster: !!msg.sync_master_self,\n ping: ping,\n masterFragmentPos: parseInt(msg.sync_master_fragment_pos),\n masterFragmentSn: parseInt(msg.sync_master_fragment)\n });\n } else {\n clearTimeout(sid);\n reject('Master lost connection');\n }\n }\n };\n\n room.on('data', fn, this);\n room.sendMessage(room.handleId, {\n body\n }).then(fn).catch(e => {\n room.off('data', fn, this);\n clearTimeout(sid);\n reject(e);\n });\n });\n };\n\n const clientPaused = () => {\n room._log('Sending client paused');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_paused\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: '0',\n fragment_pos: 0\n }\n });\n };\n\n const propagateMasterFunc = () => {\n room._log('Propagating master');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_source_set\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n wt_channel_id: \"\",\n fragment: \"0\",\n fragment_pos: 0\n }\n });\n };\n\n return {\n __events: ['playerSyncing'],\n initialize: function () {\n let {\n videoElement,\n syncOnLevelSwitch = false,\n propagateMaster = false\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _videoElement = videoElement;\n shouldPropagateMaster = propagateMaster;\n isPlaying = _videoElement.paused === false;\n room.on('disconnect', stopSyncLoop);\n room.on('removeLocalParticipant', stopSyncLoop);\n room.on('addLocalParticipant', handleAddLocalParticipant);\n room.on('addRemoteParticipant', handleAddRemoteParticipant);\n room.on('data', parseDataEvents);\n\n if (shouldPropagateMaster) {\n propagateMasterFunc().catch(() => {});\n }\n\n if (_videoElement && _videoElement.paused === false) {\n _videoElement.addEventListener('progress', () => {\n restartSyncLoop();\n }, {\n once: true\n });\n }\n\n _videoElement.addEventListener('timeupdate', stalledGenerator);\n\n _videoElement.addEventListener('playing', handlePlaying);\n\n _videoElement.addEventListener('pause', handlePause);\n },\n destroy: () => {\n stopSyncLoop();\n room.off('disconnect', stopSyncLoop);\n room.off('removeLocalParticipant', stopSyncLoop);\n room.off('addLocalParticipant', handleAddLocalParticipant);\n room.off('addRemoteParticipant', handleAddRemoteParticipant);\n room.off('data', parseDataEvents);\n\n if (_videoElement) {\n _videoElement.removeEventListener('timeupdate', stalledGenerator);\n\n _videoElement.removeEventListener('playing', handlePlaying);\n\n _videoElement.removeEventListener('pause', handlePause);\n }\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (syncNativeHls);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/sync-modules/sync-native-hls.js?");
|
|
9379
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../wt-utils */ \"./src/modules/wt-utils.js\");\n\n\nconst syncNativeHls = function () {\n let {\n room,\n wt,\n roomSession,\n emitter\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n //SYNC VARS\n let _videoElement = null;\n const syncDefaultWaitTime = 60000;\n const syncShortWaitTime = 10000;\n const maxSyncThreshold = 0.5;\n const maxSyncTries = 3;\n let currentSyncRetry = 0;\n let syncWaitId = null;\n let syncNextWaitTime = null;\n let stopFlag = false;\n let isSyncing = false;\n let playbackRate = 2;\n let isPlaying = false;\n let isPreloading = true;\n let isProgrammaticallySeeked = false;\n let shouldPropagateMaster = false;\n\n const startSyncLoop = () => {\n if (!isConnected()) {\n room._log('--- Sync loop will not start due to user not connected yet ---');\n\n return;\n }\n\n if (syncWaitId) {\n room._log('--- Sync loop already running ---');\n\n return;\n }\n\n room._log('--- Sync enabled ---');\n\n stopFlag = false;\n\n const loop = () => {\n isSyncing = true;\n emitter.emit('playerSyncing', true);\n sync().finally(() => {\n isSyncing = false;\n emitter.emit('playerSyncing', false);\n\n if (isConnected() && !stopFlag) {\n syncWaitId = setTimeout(loop, syncNextWaitTime);\n } else {\n room._log('--- Automatic stop due to user not connected or stop flag enabled ---');\n\n stopSyncLoop();\n }\n });\n };\n\n loop();\n };\n\n const stopSyncLoop = () => {\n room._log('--- Sync disabled ---');\n\n clearTimeout(syncWaitId);\n syncWaitId = null;\n currentSyncRetry = 0;\n stopFlag = true;\n };\n\n const restartSyncLoop = () => {\n room._log('--- Sync restarting ---');\n\n stopSyncLoop();\n startSyncLoop();\n };\n\n const setNextWaitTime = function () {\n let didSyncFail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (!didSyncFail) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n currentSyncRetry++;\n\n if (currentSyncRetry > maxSyncTries) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n syncNextWaitTime = syncShortWaitTime;\n }\n }\n\n room._log('--- Next sync will occur in ' + syncNextWaitTime / 1000 + ' seconds ---');\n };\n\n const sync = () => {\n return getSyncData().then(syncData => {\n if (syncData.isMaster) {\n if (_videoElement.paused) _videoElement.play();\n setNextWaitTime(false);\n return Promise.resolve();\n } else if (shouldPropagateMaster) {\n setNextWaitTime(false);\n return propagateMasterFunc();\n } else {\n const syncStartTime = Date.now();\n const {\n position,\n realPosition,\n isBufferSufficient\n } = calculateSyncDifferenceTime(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping);\n const currentPosition = getCurrentSegmentPosition() / 1000;\n\n if (position && Math.abs(position - currentPosition) <= maxSyncThreshold) {\n room._log(`We're within max sync threshold, no need to resync now`);\n\n setNextWaitTime(false);\n return Promise.resolve();\n }\n\n if (position !== null) {\n return seekTo(position).then(() => {\n const seekDuration = (Date.now() - syncStartTime) / 1000;\n const syncPrecision = Math.abs(realPosition + seekDuration - getCurrentSegmentPosition() / 1000);\n\n room._log(`Insufficient buffer: `, !isBufferSufficient);\n\n room._log(`Seek duration is ${seekDuration}`);\n\n room._log(`Sync precision should be ${syncPrecision}`);\n\n const didSyncFail = syncPrecision > maxSyncThreshold;\n setNextWaitTime(didSyncFail);\n return Promise.resolve();\n }).catch(e => {\n setNextWaitTime(true);\n return Promise.reject(e);\n });\n } else {\n setNextWaitTime(true);\n return Promise.reject();\n }\n }\n }).catch(() => {\n setNextWaitTime(true);\n return Promise.reject();\n });\n };\n\n const handleAddLocalParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n\n if (_videoElement && _videoElement.paused === false) {\n _videoElement.addEventListener('progress', () => {\n restartSyncLoop();\n }, {\n once: true\n });\n }\n };\n\n const handleAddRemoteParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n };\n\n const isConnected = () => {\n return room._isDataChannelOpen && room.isConnected;\n };\n\n const parseDataEvents = function () {\n let msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (msg.videoroom === 'sync_source_set' && msg.wt_channel_id != \"\") {\n emitter.emit('changePlayerSource', msg.wt_channel_id);\n } else if (msg.videoroom === 'sync_request') {\n roomSyncSend(msg.sync_slave_id).catch(() => {});\n }\n };\n\n const getCurrentSegmentPosition = () => {\n let position = _videoElement && _videoElement.currentTime;\n return isNaN(position) ? 0 : position * 1000;\n };\n\n const calculateSyncDifferenceTime = (fragmentSn, fragmentPos, ping) => {\n let seekRanges = _videoElement.buffered;\n let seekRange = {};\n\n for (let i = 0; i < seekRanges.length; i++) {\n let _c_start = seekRanges.start(i);\n\n let _c_end = seekRanges.end(i);\n\n if (!seekRange.start || _c_start < seekRange.start) {\n seekRange.start = _c_start;\n }\n\n if (!seekRange.end || _c_end > seekRange.end) {\n seekRange.end = _c_end;\n }\n }\n\n let position = (fragmentPos + ping / 2) / 1000;\n\n if (position > seekRange.start && position < seekRange.end) {\n return {\n position,\n isBufferSufficient: true\n };\n } else if (position < seekRange.start) {\n room._log(`Syncing to ${seekRange.start} instead of ${position} due to lack of buffered data`);\n\n return {\n position: seekRange.start + 0.5,\n realPosition: position,\n isBufferSufficient: false\n };\n } else if (position > seekRange.end) {\n room._log(`Syncing to ${seekRange.end} instead of ${position} due to lack of buffered data`);\n\n return {\n position: seekRange.end - 0.5,\n realPosition: position,\n isBufferSufficient: false\n };\n } else return {\n position: null,\n realPosition: position,\n isBufferSufficient: false\n };\n };\n\n const seekTo = time => {\n return new Promise((resolve, reject) => {\n if (_videoElement.currentTime !== time) {\n let diff = time - _videoElement.currentTime;\n\n if (_videoElement.currentTime < time && diff < 4) {\n room._log(`Fast forward to seek...`);\n\n let wasPaused = false;\n\n let __ = () => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false;\n reject('Stalled');\n }; // _videoElement.addEventListener('waiting', __, {once:true});\n\n\n _videoElement.addEventListener('stalled', __, {\n once: true\n });\n\n Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"setExactTimeout\"])(() => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false; // _videoElement.removeEventListener('waiting', __, {once:true});\n\n _videoElement.removeEventListener('stalled', __, {\n once: true\n });\n\n resolve();\n }, diff * 1000 / (playbackRate - 1), 20);\n isProgrammaticallySeeked = true;\n\n if (_videoElement.paused) {\n wasPaused = true;\n\n _videoElement.play().then(() => {\n _videoElement.playbackRate = playbackRate;\n });\n } else {\n _videoElement.playbackRate = playbackRate;\n }\n } else {\n room._log(`Jump to seek...`);\n\n let __ = Date.now();\n\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _videoElement.addEventListener('playing', () => {\n room._log(`It took the player ${(Date.now() - __) / 1000} seconds to seek `);\n\n isProgrammaticallySeeked = false;\n resolve();\n }, {\n once: true\n });\n\n _videoElement.currentTime = time;\n }\n } else resolve();\n });\n };\n\n const handlePlaying = () => {\n if (!isProgrammaticallySeeked) {\n room._log('Handle playing');\n\n startSyncLoop();\n }\n\n isProgrammaticallySeeked = false;\n isPreloading = _videoElement.paused;\n isPlaying = !_videoElement.paused;\n };\n\n const handlePause = () => {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPlaying = !_videoElement.paused;\n };\n\n const handleStalledWaiting = () => {\n room._log('handleStalledWaiting');\n\n if (!isProgrammaticallySeeked) {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPreloading = _videoElement.paused;\n }\n };\n\n let sgtid = null;\n\n const stalledGenerator = () => {\n clearTimeout(sgtid);\n sgtid = setTimeout(() => {\n if (_videoElement.paused === false) {\n handleStalledWaiting();\n }\n }, 1000);\n };\n\n const roomSyncSend = slaveId => {\n if (!_videoElement) {\n room._log(`I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?`);\n\n return Promise.resolve();\n }\n\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n\n room._log(`Sending my position to ${slaveId}`);\n\n room._log(`Current time: ${fragmentPosition}`);\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_response\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: String(\"0\"),\n fragment_pos: Number(fragmentPosition),\n slave_id: room.webrtcVersion > 1000 ? String(slaveId) : Number(slaveId)\n }\n });\n };\n\n const getSyncData = () => {\n room._log('Sending roomSync request');\n\n let roomId = room.roomId;\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n return new Promise((resolve, reject) => {\n let now = new Date().getTime();\n let ping = null;\n let sid = setTimeout(() => {\n room.off('data', fn, this);\n reject('Timeout');\n }, 3000);\n let body = {\n request: \"sync\",\n room: roomId,\n timestamp: new Date().getTime(),\n fragment: String(\"0\"),\n fragment_pos: Number(fragmentPosition)\n };\n\n let fn = msg => {\n if (msg.videoroom && ['sync', 'sync_response'].includes(msg.videoroom)) {\n if (msg.sync_master_await) {\n room._log('Waiting for master position');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n } else if (msg.sync_master_fragment || msg.sync_master_fragment_pos) {\n room._log('Got master position data');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n\n room._log(`I'm master: ${!!msg.sync_master_self}`);\n\n room._log(`Ping: ${ping}`);\n\n room._log(`Master fragment: ${msg.sync_master_fragment}`);\n\n room._log(`Master fragment position: ${msg.sync_master_fragment_pos}`);\n\n room.off('data', fn, this);\n clearTimeout(sid);\n resolve({\n isMaster: !!msg.sync_master_self,\n ping: ping,\n masterFragmentPos: parseInt(msg.sync_master_fragment_pos),\n masterFragmentSn: parseInt(msg.sync_master_fragment)\n });\n } else {\n clearTimeout(sid);\n reject('Master lost connection');\n }\n }\n };\n\n room.on('data', fn, this);\n room.sendMessage(room.handleId, {\n body\n }).then(fn).catch(e => {\n room.off('data', fn, this);\n clearTimeout(sid);\n reject(e);\n });\n });\n };\n\n const clientPaused = () => {\n room._log('Sending client paused');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_paused\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: '0',\n fragment_pos: 0\n }\n });\n };\n\n const propagateMasterFunc = () => {\n room._log('Propagating master');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_source_set\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n wt_channel_id: \"\",\n fragment: \"0\",\n fragment_pos: 0\n }\n });\n };\n\n return {\n __events: ['playerSyncing'],\n initialize: function () {\n let {\n videoElement,\n syncOnLevelSwitch = false,\n propagateMaster = false\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _videoElement = videoElement;\n shouldPropagateMaster = propagateMaster;\n isPlaying = _videoElement.paused === false;\n room.on('disconnect', stopSyncLoop);\n room.on('removeLocalParticipant', stopSyncLoop);\n room.on('addLocalParticipant', handleAddLocalParticipant);\n room.on('addRemoteParticipant', handleAddRemoteParticipant);\n room.on('data', parseDataEvents);\n\n if (shouldPropagateMaster) {\n propagateMasterFunc().catch(() => {});\n }\n\n if (_videoElement && _videoElement.paused === false) {\n _videoElement.addEventListener('progress', () => {\n restartSyncLoop();\n }, {\n once: true\n });\n }\n\n _videoElement.addEventListener('timeupdate', stalledGenerator);\n\n _videoElement.addEventListener('playing', handlePlaying);\n\n _videoElement.addEventListener('pause', handlePause);\n },\n destroy: () => {\n stopSyncLoop();\n room.off('disconnect', stopSyncLoop);\n room.off('removeLocalParticipant', stopSyncLoop);\n room.off('addLocalParticipant', handleAddLocalParticipant);\n room.off('addRemoteParticipant', handleAddRemoteParticipant);\n room.off('data', parseDataEvents);\n\n if (_videoElement) {\n _videoElement.removeEventListener('timeupdate', stalledGenerator);\n\n _videoElement.removeEventListener('playing', handlePlaying);\n\n _videoElement.removeEventListener('pause', handlePause);\n }\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (syncNativeHls);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/sync-modules/sync-native-hls.js?");
|
|
9335
9380
|
|
|
9336
9381
|
/***/ }),
|
|
9337
9382
|
|
|
@@ -9343,7 +9388,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_
|
|
|
9343
9388
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9344
9389
|
|
|
9345
9390
|
"use strict";
|
|
9346
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../wt-utils */ \"./src/modules/wt-utils.js\");\n\n\nconst syncVodShakaDash = function () {\n let {\n room,\n wt,\n roomSession,\n emitter\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n //SYNC VARS\n let _libraryInstance = null;\n let _videoElement = null;\n let _roomId = null;\n let _syncDisabled = false;\n const syncDefaultWaitTime = 60000;\n const syncShortWaitTime = 10000;\n const maxSyncThreshold = 0.5;\n const maxSyncTries = 3;\n let currentSyncRetry = 0;\n let syncWaitId = null;\n let syncNextWaitTime = null;\n let stopFlag = false;\n let isSyncing = false;\n let seekingDebounceId = null;\n let seekingDebounceTimeout = 300;\n let isPlaying = false;\n let isProgrammaticallySeeked = false;\n let isForcedMaster = false;\n\n const startSyncLoop = () => {\n if (_syncDisabled) {\n room._log('--- Sync loop will not start due to sync force disabled ---');\n\n return;\n }\n\n if (!isConnected()) {\n room._log('--- Sync loop will not start due to user not connected yet ---');\n\n return;\n }\n\n if (syncWaitId) {\n room._log('--- Sync loop already running ---');\n\n return;\n }\n\n room._log('--- Sync enabled ---');\n\n stopFlag = false;\n\n const loop = () => {\n isSyncing = true;\n emitter.emit('playerSyncing', true);\n sync().finally(() => {\n isSyncing = false;\n emitter.emit('playerSyncing', false);\n\n if (isConnected() && !stopFlag) {\n syncWaitId = setTimeout(loop, syncNextWaitTime);\n } else {\n room._log('--- Automatic stop due to user not connected or stop flag enabled ---');\n\n stopSyncLoop();\n }\n });\n };\n\n loop();\n };\n\n const stopSyncLoop = () => {\n room._log('--- Sync disabled ---');\n\n clearTimeout(syncWaitId);\n syncWaitId = null;\n currentSyncRetry = 0;\n stopFlag = true;\n };\n\n const restartSyncLoop = () => {\n room._log('--- Sync restarting ---');\n\n stopSyncLoop();\n startSyncLoop();\n };\n\n const setNextWaitTime = function () {\n let didSyncFail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (!didSyncFail) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n currentSyncRetry++;\n\n if (currentSyncRetry > maxSyncTries) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n syncNextWaitTime = syncShortWaitTime;\n }\n }\n\n room._log('--- Next sync will occur in ' + syncNextWaitTime / 1000 + ' seconds ---');\n };\n\n const sync = () => {\n return getSyncData().then(syncData => {\n if (syncData.isMaster || stopFlag) {\n setNextWaitTime(false);\n return Promise.resolve();\n } else if (isForcedMaster) {\n setNextWaitTime(false);\n return propagateMasterFunc();\n } else {\n const syncStartTime = Date.now();\n const {\n position,\n isBufferSufficient\n } = calculateSyncDifferenceTime(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping);\n const currentPosition = getCurrentSegmentPosition() / 1000;\n\n if (syncData.masterFragmentSn) {\n playMedia();\n } else {\n pauseMedia();\n }\n\n if (position && Math.abs(position - currentPosition) <= maxSyncThreshold) {\n room._log(\"We're within max sync threshold, no need to resync now\");\n\n setNextWaitTime(false);\n return Promise.resolve();\n }\n\n if (position !== null) {\n return seekTo(position).then(() => {\n const seekDuration = (Date.now() - syncStartTime) / 1000;\n const syncPrecision = Math.abs(position + (isPlaying ? seekDuration : 0) - getCurrentSegmentPosition() / 1000);\n\n room._log(\"Insufficient buffer: \", !isBufferSufficient);\n\n room._log(\"Seek duration is \".concat(seekDuration));\n\n room._log(\"Sync precision should be \".concat(syncPrecision));\n\n const didSyncFail = syncPrecision > maxSyncThreshold;\n setNextWaitTime(didSyncFail);\n return Promise.resolve();\n }).catch(e => {\n setNextWaitTime(true);\n return Promise.reject(e);\n });\n } else {\n setNextWaitTime(true);\n return Promise.reject();\n }\n }\n }).catch(() => {\n setNextWaitTime(true);\n });\n };\n\n const handleAddLocalParticipant = () => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n\n if (_videoElement) {\n //TODO: shit fix ... data channel with other participant is not opened yet so we wait\n setTimeout(() => {\n restartSyncLoop();\n }, 1000);\n }\n };\n\n const handleAddRemoteParticipant = () => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n };\n\n const handleRemoveRemoteParticipant = () => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n };\n\n const isConnected = () => {\n return room._isDataChannelOpen && room.isConnected;\n };\n\n const buffering = event => {\n if (event.buffering) {\n handleStalledWaiting();\n }\n };\n\n const executePlayerIotEvents = data => {\n let rid = _roomId || room.roomId;\n\n if (data.attributeName === 'playerReplay' && (!rid || (data === null || data === void 0 ? void 0 : data.roomId) === rid)) {\n seekTo(0).then(() => playMedia());\n }\n\n if (data.attributeName === 'playerPlay' && (!rid || (data === null || data === void 0 ? void 0 : data.roomId) === rid)) {\n playMedia();\n }\n\n if (data.attributeName === 'playerPause' && (!rid || (data === null || data === void 0 ? void 0 : data.roomId) === rid)) {\n pauseMedia();\n }\n };\n\n const parseIotEvents = data => {\n if (data.event === 'template_updated') {\n if (data.operation === 'multi') {\n (data.value || []).forEach(event => {\n if (event.operation === 'sendMessage') {\n executePlayerIotEvents({ ...event,\n roomId: data.roomId,\n userId: data.userId\n });\n }\n });\n }\n\n if (data.operation === 'sendMessage') {\n executePlayerIotEvents(data);\n }\n }\n };\n\n const parseDataEvents = function () {\n let msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (msg.videoroom === 'sync_source_set' && msg.wt_channel_id != \"\") {\n emitter.emit('changePlayerSource', msg.wt_channel_id);\n } else if (msg.videoroom === 'sync_request') {\n roomSyncSend(msg.sync_slave_id).catch(() => {});\n } else if (msg.videoroom === 'message') {\n // ignoring non studio commands if master\n if (isForcedMaster && msg.from !== null) {\n return;\n }\n\n if (_syncDisabled) {\n return;\n }\n\n if (msg.user_action === 'sync_seeking') {\n seekMedia(msg).catch(() => {});\n } else if (msg.user_action === 'sync_seeked') {} else if (msg.user_action === 'sync_play' || msg.action === 'sync_play') {\n playMedia();\n } else if (msg.user_action === 'sync_pause' || msg.action === 'sync_pause') {\n pauseMedia();\n }\n }\n };\n\n const getCurrentSegmentPosition = () => {\n let position = _videoElement && _videoElement.currentTime;\n return isNaN(position) ? 0 : position * 1000;\n };\n\n const calculateSyncDifferenceTime = function (fragmentSn) {\n let fragmentPos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n let ping = arguments.length > 2 ? arguments[2] : undefined;\n return {\n position: (fragmentPos + ping / 2) / 1000,\n isBufferSufficient: true\n };\n };\n\n const seekMedia = msg => {\n msg = {\n userId: msg.from,\n ...(msg.text && JSON.parse(msg.text))\n };\n\n if (msg.handleId !== room.handleId) {\n const {\n position,\n isBufferSufficient\n } = calculateSyncDifferenceTime(msg.fragment, msg.fragment_pos, 0); //TODO: right ping\n\n if (position) {\n return seekTo(position).then(() => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n });\n } else {\n return Promise.resolve();\n }\n } else {\n return Promise.resolve();\n }\n };\n\n const prePlay = () => {\n if (_videoElement.currentTime > 0 || _videoElement.paused === false) {\n return Promise.resolve();\n }\n\n isProgrammaticallySeeked = true;\n let wasMuted = _videoElement.muted;\n _videoElement.muted = true;\n return _videoElement.play().then(() => {\n _videoElement.pause();\n\n _videoElement.currentTime = 0;\n return Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"wait\"])(100);\n }).catch(() => true).finally(() => {\n _videoElement.muted = wasMuted;\n isProgrammaticallySeeked = false;\n return true;\n });\n };\n\n const playMedia = () => {\n if (_videoElement && _videoElement.paused) {\n isProgrammaticallySeeked = true;\n\n _videoElement.play().finally(() => {\n isProgrammaticallySeeked = false;\n });\n }\n };\n\n const pauseMedia = () => {\n if (_videoElement && !_videoElement.paused) {\n isProgrammaticallySeeked = true;\n\n _videoElement.addEventListener('pause', () => {\n isProgrammaticallySeeked = false;\n }, {\n once: true\n });\n\n _videoElement.pause();\n }\n };\n\n const seekTo = time => {\n return new Promise(resolve => {\n if (_videoElement.currentTime !== time) {\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _videoElement.addEventListener('seeked', () => {\n isProgrammaticallySeeked = false;\n resolve();\n }, {\n once: true\n });\n\n _videoElement.currentTime = time;\n } else resolve();\n });\n };\n\n const handlePlaying = () => {\n if (!isProgrammaticallySeeked) {\n roomSession.sendSystemMessage('sync_play', {\n timestamp: new Date().getTime(),\n handleId: room.handleId\n }, undefined, null).catch(() => {});\n }\n\n isPlaying = !_videoElement.paused;\n };\n\n const handlePause = () => {\n if (!isProgrammaticallySeeked) {\n roomSession.sendSystemMessage('sync_pause', {\n timestamp: new Date().getTime(),\n handleId: room.handleId\n }, undefined, null).catch(() => {});\n }\n\n isPlaying = !_videoElement.paused;\n };\n\n const handleStalledWaiting = () => {\n if (!isProgrammaticallySeeked) {\n clientPaused().catch(() => {});\n }\n };\n\n const handleSeeking = () => {\n clearTimeout(seekingDebounceId);\n\n if (!isProgrammaticallySeeked) {\n seekingDebounceId = setTimeout(() => {\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n roomSession.sendSystemMessage('sync_seeking', {\n timestamp: new Date().getTime(),\n handleId: room.handleId,\n fragment: \"0\",\n //isPlaying ? \"1\":\"0\",\n fragment_pos: Number(fragmentPosition)\n }, undefined, null).catch(() => {});\n\n if (!isForcedMaster && !_syncDisabled) {\n pauseMedia();\n }\n }, seekingDebounceTimeout);\n }\n };\n\n const handleSeeked = () => {};\n\n const handleEnded = () => {};\n\n const roomSyncSend = slaveId => {\n if (!_libraryInstance || !_videoElement) {\n room._log(\"I've been asked for position even if we don't have player attached.\\n Does it mean I'm the master?\");\n\n return Promise.resolve();\n }\n\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n\n room._log(\"Sending my position to \".concat(slaveId));\n\n room._log(\"Current time: \".concat(fragmentPosition));\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_response\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: isPlaying ? \"1\" : \"0\",\n fragment_pos: Number(fragmentPosition),\n slave_id: room.webrtcVersion > 1000 ? String(slaveId) : Number(slaveId)\n }\n });\n };\n\n const getSyncData = () => {\n room._log('Sending roomSync request');\n\n let roomId = room.roomId;\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n return new Promise((resolve, reject) => {\n let now = new Date().getTime();\n let ping = null;\n let sid = setTimeout(() => {\n room.off('data', fn, this);\n reject('Timeout');\n }, 3000);\n let body = {\n request: \"sync\",\n room: roomId,\n timestamp: new Date().getTime(),\n fragment: isPlaying ? \"1\" : \"0\",\n fragment_pos: Number(fragmentPosition)\n };\n\n let fn = msg => {\n if (msg.videoroom && ['sync', 'sync_response'].includes(msg.videoroom)) {\n if (msg.sync_master_await) {\n room._log('Waiting for master position');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n } else if (msg.sync_master_fragment || msg.sync_master_fragment_pos) {\n room._log('Got master position data');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n\n room._log(\"I'm master: \".concat(!!msg.sync_master_self));\n\n room._log(\"Ping: \".concat(ping));\n\n room._log(\"Master fragment: \".concat(msg.sync_master_fragment));\n\n room._log(\"Master fragment position: \".concat(msg.sync_master_fragment_pos));\n\n room.off('data', fn, this);\n clearTimeout(sid);\n resolve({\n isMaster: !!msg.sync_master_self,\n ping: ping,\n masterFragmentPos: parseInt(msg.sync_master_fragment_pos),\n masterFragmentSn: parseInt(msg.sync_master_fragment)\n });\n } else {\n clearTimeout(sid);\n reject('Master lost connection');\n }\n }\n };\n\n room.on('data', fn, this);\n room.sendMessage(room.handleId, {\n body\n }).then(fn).catch(e => {\n room.off('data', fn, this);\n clearTimeout(sid);\n reject(e);\n });\n });\n };\n\n const clientPaused = () => {\n room._log('Sending client paused');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_paused\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: '0',\n fragment_pos: 0\n }\n });\n };\n\n const propagateMasterFunc = () => {\n room._log('Propagating master');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_source_set\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n wt_channel_id: \"\",\n fragment: \"0\",\n fragment_pos: 0\n }\n });\n };\n\n return {\n __events: ['playerSyncing'],\n initialize: function () {\n let {\n shakaInstance,\n libraryInstance,\n propagateMaster = false,\n isStudio = false,\n roomId,\n syncDisabled\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _libraryInstance = shakaInstance || libraryInstance;\n _videoElement = _libraryInstance.getMediaElement();\n _roomId = roomId;\n _syncDisabled = syncDisabled;\n\n if (!_libraryInstance) {\n console.log('No shaka player instance');\n return;\n }\n\n emitter.emit('playerSyncing', false);\n isForcedMaster = propagateMaster;\n isPlaying = _videoElement.paused === false;\n room.on('disconnect', stopSyncLoop);\n room.on('addLocalParticipant', handleAddLocalParticipant);\n room.on('removeLocalParticipant', stopSyncLoop);\n room.on('addRemoteParticipant', handleAddRemoteParticipant);\n room.on('removeRemoteParticipant', handleRemoveRemoteParticipant);\n room.on('data', parseDataEvents);\n wt.iot.$on('message', parseIotEvents);\n\n if (isForcedMaster) {\n propagateMasterFunc().catch(() => {});\n }\n\n if (_libraryInstance && _videoElement) {\n (propagateMaster || isStudio ? Promise.resolve() : prePlay()).then(() => {\n _libraryInstance.addEventListener('buffering', buffering);\n\n _videoElement.addEventListener('playing', handlePlaying);\n\n _videoElement.addEventListener('pause', handlePause);\n\n _videoElement.addEventListener('seeking', handleSeeking);\n\n _videoElement.addEventListener('seeked', handleSeeked);\n\n _videoElement.addEventListener('ended', handleEnded);\n\n startSyncLoop();\n });\n }\n },\n destroy: () => {\n stopSyncLoop();\n room.off('disconnect', stopSyncLoop);\n room.off('addLocalParticipant', handleAddLocalParticipant);\n room.off('removeLocalParticipant', stopSyncLoop);\n room.off('addRemoteParticipant', handleAddRemoteParticipant);\n room.off('removeRemoteParticipant', handleRemoveRemoteParticipant);\n room.off('data', parseDataEvents);\n wt.iot.$off('message', parseIotEvents);\n\n if (_libraryInstance) {\n _libraryInstance.removeEventListener('buffering', buffering);\n }\n\n if (_videoElement) {\n _videoElement.removeEventListener('playing', handlePlaying);\n\n _videoElement.removeEventListener('pause', handlePause);\n\n _videoElement.removeEventListener('seeking', handleSeeking);\n\n _videoElement.removeEventListener('seeked', handleSeeked);\n\n _videoElement.removeEventListener('ended', handleEnded);\n }\n\n _libraryInstance = null;\n _videoElement = null;\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (syncVodShakaDash);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/sync-modules/sync-shaka-dash-vod.js?");
|
|
9391
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../wt-utils */ \"./src/modules/wt-utils.js\");\n\n\nconst syncVodShakaDash = function () {\n let {\n room,\n wt,\n roomSession,\n emitter\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n //SYNC VARS\n let _libraryInstance = null;\n let _videoElement = null;\n let _roomId = null;\n let _syncDisabled = false;\n const syncDefaultWaitTime = 60000;\n const syncShortWaitTime = 10000;\n const maxSyncThreshold = 0.5;\n const maxSyncTries = 3;\n let currentSyncRetry = 0;\n let syncWaitId = null;\n let syncNextWaitTime = null;\n let stopFlag = false;\n let isSyncing = false;\n let seekingDebounceId = null;\n let seekingDebounceTimeout = 300;\n let isPlaying = false;\n let isProgrammaticallySeeked = false;\n let isForcedMaster = false;\n\n const startSyncLoop = () => {\n if (_syncDisabled) {\n room._log('--- Sync loop will not start due to sync force disabled ---');\n\n return;\n }\n\n if (!isConnected()) {\n room._log('--- Sync loop will not start due to user not connected yet ---');\n\n return;\n }\n\n if (syncWaitId) {\n room._log('--- Sync loop already running ---');\n\n return;\n }\n\n room._log('--- Sync enabled ---');\n\n stopFlag = false;\n\n const loop = () => {\n isSyncing = true;\n emitter.emit('playerSyncing', true);\n sync().finally(() => {\n isSyncing = false;\n emitter.emit('playerSyncing', false);\n\n if (isConnected() && !stopFlag) {\n syncWaitId = setTimeout(loop, syncNextWaitTime);\n } else {\n room._log('--- Automatic stop due to user not connected or stop flag enabled ---');\n\n stopSyncLoop();\n }\n });\n };\n\n loop();\n };\n\n const stopSyncLoop = () => {\n room._log('--- Sync disabled ---');\n\n clearTimeout(syncWaitId);\n syncWaitId = null;\n currentSyncRetry = 0;\n stopFlag = true;\n };\n\n const restartSyncLoop = () => {\n room._log('--- Sync restarting ---');\n\n stopSyncLoop();\n startSyncLoop();\n };\n\n const setNextWaitTime = function () {\n let didSyncFail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (!didSyncFail) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n currentSyncRetry++;\n\n if (currentSyncRetry > maxSyncTries) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n syncNextWaitTime = syncShortWaitTime;\n }\n }\n\n room._log('--- Next sync will occur in ' + syncNextWaitTime / 1000 + ' seconds ---');\n };\n\n const sync = () => {\n return getSyncData().then(syncData => {\n if (syncData.isMaster || stopFlag) {\n setNextWaitTime(false);\n return Promise.resolve();\n } else if (isForcedMaster) {\n setNextWaitTime(false);\n return propagateMasterFunc();\n } else {\n const syncStartTime = Date.now();\n const {\n position,\n isBufferSufficient\n } = calculateSyncDifferenceTime(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping);\n const currentPosition = getCurrentSegmentPosition() / 1000;\n\n if (syncData.masterFragmentSn) {\n playMedia();\n } else {\n pauseMedia();\n }\n\n if (position && Math.abs(position - currentPosition) <= maxSyncThreshold) {\n room._log(`We're within max sync threshold, no need to resync now`);\n\n setNextWaitTime(false);\n return Promise.resolve();\n }\n\n if (position !== null) {\n return seekTo(position).then(() => {\n const seekDuration = (Date.now() - syncStartTime) / 1000;\n const syncPrecision = Math.abs(position + (isPlaying ? seekDuration : 0) - getCurrentSegmentPosition() / 1000);\n\n room._log(`Insufficient buffer: `, !isBufferSufficient);\n\n room._log(`Seek duration is ${seekDuration}`);\n\n room._log(`Sync precision should be ${syncPrecision}`);\n\n const didSyncFail = syncPrecision > maxSyncThreshold;\n setNextWaitTime(didSyncFail);\n return Promise.resolve();\n }).catch(e => {\n setNextWaitTime(true);\n return Promise.reject(e);\n });\n } else {\n setNextWaitTime(true);\n return Promise.reject();\n }\n }\n }).catch(() => {\n setNextWaitTime(true);\n });\n };\n\n const handleAddLocalParticipant = () => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n\n if (_videoElement) {\n //TODO: shit fix ... data channel with other participant is not opened yet so we wait\n setTimeout(() => {\n restartSyncLoop();\n }, 1000);\n }\n };\n\n const handleAddRemoteParticipant = () => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n };\n\n const handleRemoveRemoteParticipant = () => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n };\n\n const isConnected = () => {\n return room._isDataChannelOpen && room.isConnected;\n };\n\n const buffering = event => {\n if (event.buffering) {\n handleStalledWaiting();\n }\n };\n\n const executePlayerIotEvents = data => {\n let rid = _roomId || room.roomId;\n\n if (data.attributeName === 'playerReplay' && (!rid || (data === null || data === void 0 ? void 0 : data.roomId) === rid)) {\n seekTo(0).then(() => playMedia());\n }\n\n if (data.attributeName === 'playerPlay' && (!rid || (data === null || data === void 0 ? void 0 : data.roomId) === rid)) {\n playMedia();\n }\n\n if (data.attributeName === 'playerPause' && (!rid || (data === null || data === void 0 ? void 0 : data.roomId) === rid)) {\n pauseMedia();\n }\n };\n\n const parseIotEvents = data => {\n if (data.event === 'template_updated') {\n if (data.operation === 'multi') {\n (data.value || []).forEach(event => {\n if (event.operation === 'sendMessage') {\n executePlayerIotEvents({ ...event,\n roomId: data.roomId,\n userId: data.userId\n });\n }\n });\n }\n\n if (data.operation === 'sendMessage') {\n executePlayerIotEvents(data);\n }\n }\n };\n\n const parseDataEvents = function () {\n let msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (msg.videoroom === 'sync_source_set' && msg.wt_channel_id != \"\") {\n emitter.emit('changePlayerSource', msg.wt_channel_id);\n } else if (msg.videoroom === 'sync_request') {\n roomSyncSend(msg.sync_slave_id).catch(() => {});\n } else if (msg.videoroom === 'message') {\n // ignoring non studio commands if master\n if (isForcedMaster && msg.from !== null) {\n return;\n }\n\n if (_syncDisabled) {\n return;\n }\n\n if (msg.user_action === 'sync_seeking') {\n seekMedia(msg).catch(() => {});\n } else if (msg.user_action === 'sync_seeked') {} else if (msg.user_action === 'sync_play' || msg.action === 'sync_play') {\n playMedia();\n } else if (msg.user_action === 'sync_pause' || msg.action === 'sync_pause') {\n pauseMedia();\n }\n }\n };\n\n const getCurrentSegmentPosition = () => {\n let position = _videoElement && _videoElement.currentTime;\n return isNaN(position) ? 0 : position * 1000;\n };\n\n const calculateSyncDifferenceTime = function (fragmentSn) {\n let fragmentPos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n let ping = arguments.length > 2 ? arguments[2] : undefined;\n return {\n position: (fragmentPos + ping / 2) / 1000,\n isBufferSufficient: true\n };\n };\n\n const seekMedia = msg => {\n msg = {\n userId: msg.from,\n ...(msg.text && JSON.parse(msg.text))\n };\n\n if (msg.handleId !== room.handleId) {\n const {\n position,\n isBufferSufficient\n } = calculateSyncDifferenceTime(msg.fragment, msg.fragment_pos, 0); //TODO: right ping\n\n if (position) {\n return seekTo(position).then(() => {\n if (isForcedMaster) {\n propagateMasterFunc();\n }\n });\n } else {\n return Promise.resolve();\n }\n } else {\n return Promise.resolve();\n }\n };\n\n const prePlay = () => {\n if (_videoElement.currentTime > 0 || _videoElement.paused === false) {\n return Promise.resolve();\n }\n\n isProgrammaticallySeeked = true;\n let wasMuted = _videoElement.muted;\n _videoElement.muted = true;\n return _videoElement.play().then(() => {\n _videoElement.pause();\n\n _videoElement.currentTime = 0;\n return Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"wait\"])(100);\n }).catch(() => true).finally(() => {\n _videoElement.muted = wasMuted;\n isProgrammaticallySeeked = false;\n return true;\n });\n };\n\n const playMedia = () => {\n if (_videoElement && _videoElement.paused) {\n isProgrammaticallySeeked = true;\n\n _videoElement.play().finally(() => {\n isProgrammaticallySeeked = false;\n });\n }\n };\n\n const pauseMedia = () => {\n if (_videoElement && !_videoElement.paused) {\n isProgrammaticallySeeked = true;\n\n _videoElement.addEventListener('pause', () => {\n isProgrammaticallySeeked = false;\n }, {\n once: true\n });\n\n _videoElement.pause();\n }\n };\n\n const seekTo = time => {\n return new Promise(resolve => {\n if (_videoElement.currentTime !== time) {\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _videoElement.addEventListener('seeked', () => {\n isProgrammaticallySeeked = false;\n resolve();\n }, {\n once: true\n });\n\n _videoElement.currentTime = time;\n } else resolve();\n });\n };\n\n const handlePlaying = () => {\n if (!isProgrammaticallySeeked) {\n roomSession.sendSystemMessage('sync_play', {\n timestamp: new Date().getTime(),\n handleId: room.handleId\n }, undefined, null).catch(() => {});\n }\n\n isPlaying = !_videoElement.paused;\n };\n\n const handlePause = () => {\n if (!isProgrammaticallySeeked) {\n roomSession.sendSystemMessage('sync_pause', {\n timestamp: new Date().getTime(),\n handleId: room.handleId\n }, undefined, null).catch(() => {});\n }\n\n isPlaying = !_videoElement.paused;\n };\n\n const handleStalledWaiting = () => {\n if (!isProgrammaticallySeeked) {\n clientPaused().catch(() => {});\n }\n };\n\n const handleSeeking = () => {\n clearTimeout(seekingDebounceId);\n\n if (!isProgrammaticallySeeked) {\n seekingDebounceId = setTimeout(() => {\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n roomSession.sendSystemMessage('sync_seeking', {\n timestamp: new Date().getTime(),\n handleId: room.handleId,\n fragment: \"0\",\n //isPlaying ? \"1\":\"0\",\n fragment_pos: Number(fragmentPosition)\n }, undefined, null).catch(() => {});\n\n if (!isForcedMaster && !_syncDisabled) {\n pauseMedia();\n }\n }, seekingDebounceTimeout);\n }\n };\n\n const handleSeeked = () => {};\n\n const handleEnded = () => {};\n\n const roomSyncSend = slaveId => {\n if (!_libraryInstance || !_videoElement) {\n room._log(`I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?`);\n\n return Promise.resolve();\n }\n\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n\n room._log(`Sending my position to ${slaveId}`);\n\n room._log(`Current time: ${fragmentPosition}`);\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_response\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: isPlaying ? \"1\" : \"0\",\n fragment_pos: Number(fragmentPosition),\n slave_id: room.webrtcVersion > 1000 ? String(slaveId) : Number(slaveId)\n }\n });\n };\n\n const getSyncData = () => {\n room._log('Sending roomSync request');\n\n let roomId = room.roomId;\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n return new Promise((resolve, reject) => {\n let now = new Date().getTime();\n let ping = null;\n let sid = setTimeout(() => {\n room.off('data', fn, this);\n reject('Timeout');\n }, 3000);\n let body = {\n request: \"sync\",\n room: roomId,\n timestamp: new Date().getTime(),\n fragment: isPlaying ? \"1\" : \"0\",\n fragment_pos: Number(fragmentPosition)\n };\n\n let fn = msg => {\n if (msg.videoroom && ['sync', 'sync_response'].includes(msg.videoroom)) {\n if (msg.sync_master_await) {\n room._log('Waiting for master position');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n } else if (msg.sync_master_fragment || msg.sync_master_fragment_pos) {\n room._log('Got master position data');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n\n room._log(`I'm master: ${!!msg.sync_master_self}`);\n\n room._log(`Ping: ${ping}`);\n\n room._log(`Master fragment: ${msg.sync_master_fragment}`);\n\n room._log(`Master fragment position: ${msg.sync_master_fragment_pos}`);\n\n room.off('data', fn, this);\n clearTimeout(sid);\n resolve({\n isMaster: !!msg.sync_master_self,\n ping: ping,\n masterFragmentPos: parseInt(msg.sync_master_fragment_pos),\n masterFragmentSn: parseInt(msg.sync_master_fragment)\n });\n } else {\n clearTimeout(sid);\n reject('Master lost connection');\n }\n }\n };\n\n room.on('data', fn, this);\n room.sendMessage(room.handleId, {\n body\n }).then(fn).catch(e => {\n room.off('data', fn, this);\n clearTimeout(sid);\n reject(e);\n });\n });\n };\n\n const clientPaused = () => {\n room._log('Sending client paused');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_paused\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: '0',\n fragment_pos: 0\n }\n });\n };\n\n const propagateMasterFunc = () => {\n room._log('Propagating master');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_source_set\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n wt_channel_id: \"\",\n fragment: \"0\",\n fragment_pos: 0\n }\n });\n };\n\n return {\n __events: ['playerSyncing'],\n initialize: function () {\n let {\n shakaInstance,\n libraryInstance,\n propagateMaster = false,\n isStudio = false,\n roomId,\n syncDisabled\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _libraryInstance = shakaInstance || libraryInstance;\n _videoElement = _libraryInstance.getMediaElement();\n _roomId = roomId;\n _syncDisabled = syncDisabled;\n\n if (!_libraryInstance) {\n console.log('No shaka player instance');\n return;\n }\n\n emitter.emit('playerSyncing', false);\n isForcedMaster = propagateMaster;\n isPlaying = _videoElement.paused === false;\n room.on('disconnect', stopSyncLoop);\n room.on('addLocalParticipant', handleAddLocalParticipant);\n room.on('removeLocalParticipant', stopSyncLoop);\n room.on('addRemoteParticipant', handleAddRemoteParticipant);\n room.on('removeRemoteParticipant', handleRemoveRemoteParticipant);\n room.on('data', parseDataEvents);\n wt.iot.$on('message', parseIotEvents);\n\n if (isForcedMaster) {\n propagateMasterFunc().catch(() => {});\n }\n\n if (_libraryInstance && _videoElement) {\n (propagateMaster || isStudio ? Promise.resolve() : prePlay()).then(() => {\n _libraryInstance.addEventListener('buffering', buffering);\n\n _videoElement.addEventListener('playing', handlePlaying);\n\n _videoElement.addEventListener('pause', handlePause);\n\n _videoElement.addEventListener('seeking', handleSeeking);\n\n _videoElement.addEventListener('seeked', handleSeeked);\n\n _videoElement.addEventListener('ended', handleEnded);\n\n startSyncLoop();\n });\n }\n },\n destroy: () => {\n stopSyncLoop();\n room.off('disconnect', stopSyncLoop);\n room.off('addLocalParticipant', handleAddLocalParticipant);\n room.off('removeLocalParticipant', stopSyncLoop);\n room.off('addRemoteParticipant', handleAddRemoteParticipant);\n room.off('removeRemoteParticipant', handleRemoveRemoteParticipant);\n room.off('data', parseDataEvents);\n wt.iot.$off('message', parseIotEvents);\n\n if (_libraryInstance) {\n _libraryInstance.removeEventListener('buffering', buffering);\n }\n\n if (_videoElement) {\n _videoElement.removeEventListener('playing', handlePlaying);\n\n _videoElement.removeEventListener('pause', handlePause);\n\n _videoElement.removeEventListener('seeking', handleSeeking);\n\n _videoElement.removeEventListener('seeked', handleSeeked);\n\n _videoElement.removeEventListener('ended', handleEnded);\n }\n\n _libraryInstance = null;\n _videoElement = null;\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (syncVodShakaDash);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/sync-modules/sync-shaka-dash-vod.js?");
|
|
9347
9392
|
|
|
9348
9393
|
/***/ }),
|
|
9349
9394
|
|
|
@@ -9355,7 +9400,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_
|
|
|
9355
9400
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9356
9401
|
|
|
9357
9402
|
"use strict";
|
|
9358
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../wt-utils */ \"./src/modules/wt-utils.js\");\n\n\nconst syncDaznDash = function () {\n let {\n room,\n wt,\n roomSession,\n emitter\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n //SYNC VARS\n let _libraryInstance = null;\n let _videoElement = null;\n const syncDefaultWaitTime = 60000;\n const syncShortWaitTime = 10000;\n const maxSyncThreshold = 0.5;\n const maxSyncTries = 3;\n let currentSyncRetry = 0;\n let syncWaitId = null;\n let syncNextWaitTime = null;\n let stopFlag = false;\n let isSyncing = false;\n let playbackRate = 2;\n let isPlaying = false;\n let isPreloading = true;\n let isProgrammaticallySeeked = false;\n let shouldPropagateMaster = false;\n\n const buffering = event => {\n if (event.buffering) {\n handleStalledWaiting();\n }\n };\n\n const startSyncLoop = () => {\n if (!isConnected()) {\n room._log('--- Sync loop will not start due to user not connected yet ---');\n\n return;\n }\n\n if (syncWaitId) {\n room._log('--- Sync loop already running ---');\n\n return;\n }\n\n room._log('--- Sync enabled ---');\n\n stopFlag = false;\n\n const loop = () => {\n isSyncing = true;\n emitter.emit('playerSyncing', true);\n sync().finally(() => {\n isSyncing = false;\n emitter.emit('playerSyncing', false);\n\n if (isConnected() && !stopFlag) {\n syncWaitId = setTimeout(loop, syncNextWaitTime);\n } else {\n room._log('--- Automatic stop due to user not connected or stop flag enabled ---');\n\n stopSyncLoop();\n }\n });\n };\n\n loop();\n };\n\n const stopSyncLoop = () => {\n room._log('--- Sync disabled ---');\n\n clearTimeout(syncWaitId);\n syncWaitId = null;\n currentSyncRetry = 0;\n stopFlag = true;\n };\n\n const restartSyncLoop = () => {\n room._log('--- Sync restarting ---');\n\n stopSyncLoop();\n startSyncLoop();\n };\n\n const setNextWaitTime = function () {\n let didSyncFail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (!didSyncFail) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n currentSyncRetry++;\n\n if (currentSyncRetry > maxSyncTries) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n syncNextWaitTime = syncShortWaitTime;\n }\n }\n\n room._log('--- Next sync will occur in ' + syncNextWaitTime / 1000 + ' seconds ---');\n };\n\n const sync = () => {\n return getSyncData().then(syncData => {\n if (syncData.isMaster) {\n if (_videoElement.paused) _videoElement.play();\n setNextWaitTime(false);\n return Promise.resolve();\n } else if (shouldPropagateMaster) {\n setNextWaitTime(false);\n return propagateMasterFunc();\n } else {\n const syncStartTime = Date.now();\n const {\n position,\n realPosition,\n isBufferSufficient\n } = calculateSyncDifferenceTime(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping);\n const currentPosition = getCurrentSegmentPosition() / 1000;\n\n if (position && Math.abs(position - currentPosition) <= maxSyncThreshold) {\n room._log(\"We're within max sync threshold, no need to resync now\");\n\n setNextWaitTime(false);\n return Promise.resolve();\n }\n\n if (position !== null) {\n return seekTo(position).then(() => {\n const seekDuration = (Date.now() - syncStartTime) / 1000;\n const syncPrecision = Math.abs(realPosition + seekDuration - getCurrentSegmentPosition() / 1000);\n\n room._log(\"Insufficient buffer: \", !isBufferSufficient);\n\n room._log(\"Seek duration is \".concat(seekDuration));\n\n room._log(\"Sync precision should be \".concat(syncPrecision));\n\n const didSyncFail = syncPrecision > maxSyncThreshold;\n setNextWaitTime(didSyncFail);\n return Promise.resolve();\n }).catch(e => {\n setNextWaitTime(true);\n return Promise.reject(e);\n });\n } else {\n setNextWaitTime(true);\n return Promise.reject();\n }\n }\n }).catch(() => {\n setNextWaitTime(true);\n return Promise.reject();\n });\n };\n\n const handleAddLocalParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n\n if (_videoElement && _videoElement.paused === false) {\n _videoElement.addEventListener('progress', () => {\n restartSyncLoop();\n }, {\n once: true\n });\n }\n };\n\n const handleAddRemoteParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n };\n\n const isConnected = () => {\n return room._isDataChannelOpen && room.isConnected;\n };\n\n const parseDataEvents = function () {\n let msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (msg.videoroom === 'sync_source_set' && msg.wt_channel_id != \"\") {\n emitter.emit('changePlayerSource', msg.wt_channel_id);\n } else if (msg.videoroom === 'sync_request') {\n roomSyncSend(msg.sync_slave_id).catch(() => {});\n }\n };\n\n const getCurrentSegmentPosition = () => {\n let position = _videoElement && _videoElement.currentTime;\n return isNaN(position) ? 0 : position * 1000;\n };\n\n const calculateSyncDifferenceTime = (fragmentSn, fragmentPos, ping) => {\n let seekRanges = _videoElement.buffered;\n let seekRange = {};\n\n for (let i = 0; i < seekRanges.length; i++) {\n let _c_start = seekRanges.start(i);\n\n let _c_end = seekRanges.end(i);\n\n if (!seekRange.start || _c_start < seekRange.start) {\n seekRange.start = _c_start;\n }\n\n if (!seekRange.end || _c_end > seekRange.end) {\n seekRange.end = _c_end;\n }\n }\n\n let position = (fragmentPos + ping / 2) / 1000;\n\n if (position > seekRange.start && position < seekRange.end) {\n return {\n position,\n isBufferSufficient: true\n };\n } else if (position < seekRange.start) {\n room._log(\"Syncing to \".concat(seekRange.start, \" instead of \").concat(position, \" due to lack of buffered data\"));\n\n return {\n position: seekRange.start + 0.5,\n realPosition: position,\n isBufferSufficient: false\n };\n } else if (position > seekRange.end) {\n room._log(\"Syncing to \".concat(seekRange.end, \" instead of \").concat(position, \" due to lack of buffered data\"));\n\n return {\n position: seekRange.end - 0.5,\n realPosition: position,\n isBufferSufficient: false\n };\n } else return {\n position: null,\n realPosition: position,\n isBufferSufficient: false\n };\n };\n\n const seekTo = time => {\n return new Promise((resolve, reject) => {\n if (_videoElement.currentTime !== time) {\n let diff = time - _videoElement.currentTime;\n\n if (_videoElement.currentTime < time && diff < 4) {\n room._log(\"Fast forward to seek...\");\n\n let wasPaused = false;\n\n let __ = () => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false;\n reject('Stalled');\n }; // _videoElement.addEventListener('waiting', __, {once:true});\n\n\n _videoElement.addEventListener('stalled', __, {\n once: true\n });\n\n Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"setExactTimeout\"])(() => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false; // _videoElement.removeEventListener('waiting', __, {once:true});\n\n _videoElement.removeEventListener('stalled', __, {\n once: true\n });\n\n resolve();\n }, diff * 1000 / (playbackRate - 1), 20);\n isProgrammaticallySeeked = true;\n\n if (_videoElement.paused) {\n wasPaused = true;\n\n _videoElement.play().then(() => {\n _videoElement.playbackRate = playbackRate;\n });\n } else {\n _videoElement.playbackRate = playbackRate;\n }\n } else {\n room._log(\"Jump to seek...\");\n\n let __ = Date.now();\n\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _videoElement.addEventListener('playing', () => {\n room._log(\"It took the player \".concat((Date.now() - __) / 1000, \" seconds to seek \"));\n\n isProgrammaticallySeeked = false;\n resolve();\n }, {\n once: true\n });\n\n _videoElement.currentTime = time;\n }\n } else resolve();\n });\n }; // const seekTo = (time) => {\n // return new Promise((resolve, reject) => {\n // if(_videoElement.currentTime !== time) {\n // let __ = Date.now();\n // isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n // _videoElement.addEventListener('playing', () => {\n // room._log(`It took the player ${(Date.now() - __) / 1000} seconds to seek `);\n // isProgrammaticallySeeked = false;\n // resolve();\n // }, {once:true});\n // _videoElement.currentTime = time;\n // } else resolve()\n // });\n // };\n\n\n const handlePlaying = () => {\n if (!isProgrammaticallySeeked) {\n room._log('Handle playing');\n\n startSyncLoop();\n }\n\n isProgrammaticallySeeked = false;\n isPreloading = _videoElement.paused;\n isPlaying = !_videoElement.paused;\n };\n\n const handlePause = () => {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPlaying = !_videoElement.paused;\n };\n\n const handleStalledWaiting = () => {\n room._log('handleStalledWaiting');\n\n if (!isProgrammaticallySeeked) {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPreloading = _videoElement.paused;\n }\n };\n\n const roomSyncSend = slaveId => {\n if (!_libraryInstance || !_videoElement) {\n room._log(\"I've been asked for position even if we don't have player attached.\\n Does it mean I'm the master?\");\n\n return Promise.resolve();\n }\n\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n\n room._log(\"Sending my position to \".concat(slaveId));\n\n room._log(\"Current time: \".concat(fragmentPosition));\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_response\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: String(\"0\"),\n fragment_pos: Number(fragmentPosition),\n slave_id: room.webrtcVersion > 1000 ? String(slaveId) : Number(slaveId)\n }\n });\n };\n\n const getSyncData = () => {\n room._log('Sending roomSync request');\n\n let roomId = room.roomId;\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n return new Promise((resolve, reject) => {\n let now = new Date().getTime();\n let ping = null;\n let sid = setTimeout(() => {\n room.off('data', fn, this);\n reject('Timeout');\n }, 3000);\n let body = {\n request: \"sync\",\n room: roomId,\n timestamp: new Date().getTime(),\n fragment: String(\"0\"),\n fragment_pos: Number(fragmentPosition)\n };\n\n let fn = msg => {\n if (msg.videoroom && ['sync', 'sync_response'].includes(msg.videoroom)) {\n if (msg.sync_master_await) {\n room._log('Waiting for master position');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n } else if (msg.sync_master_fragment || msg.sync_master_fragment_pos) {\n room._log('Got master position data');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n\n room._log(\"I'm master: \".concat(!!msg.sync_master_self));\n\n room._log(\"Ping: \".concat(ping));\n\n room._log(\"Master fragment: \".concat(msg.sync_master_fragment));\n\n room._log(\"Master fragment position: \".concat(msg.sync_master_fragment_pos));\n\n room.off('data', fn, this);\n clearTimeout(sid);\n resolve({\n isMaster: !!msg.sync_master_self,\n ping: ping,\n masterFragmentPos: parseInt(msg.sync_master_fragment_pos),\n masterFragmentSn: parseInt(msg.sync_master_fragment)\n });\n } else {\n clearTimeout(sid);\n reject('Master lost connection');\n }\n }\n };\n\n room.on('data', fn, this);\n room.sendMessage(room.handleId, {\n body\n }).then(fn).catch(e => {\n room.off('data', fn, this);\n clearTimeout(sid);\n reject(e);\n });\n });\n };\n\n const clientPaused = () => {\n room._log('Sending client paused');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_paused\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: '0',\n fragment_pos: 0\n }\n });\n };\n\n const propagateMasterFunc = () => {\n room._log('Propagating master');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_source_set\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n wt_channel_id: \"\",\n fragment: \"0\",\n fragment_pos: 0\n }\n });\n };\n\n return {\n __events: ['playerSyncing'],\n initialize: function () {\n let {\n libraryInstance,\n shakaInstance,\n propagateMaster = false\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _libraryInstance = libraryInstance || shakaInstance;\n _videoElement = _libraryInstance.getMediaElement();\n shouldPropagateMaster = propagateMaster;\n isPlaying = _videoElement.paused === false;\n room.on('disconnect', stopSyncLoop);\n room.on('removeLocalParticipant', stopSyncLoop);\n room.on('addLocalParticipant', handleAddLocalParticipant);\n room.on('addRemoteParticipant', handleAddRemoteParticipant);\n room.on('data', parseDataEvents);\n\n if (shouldPropagateMaster) {\n propagateMasterFunc().catch(() => {});\n }\n\n if (_videoElement && _videoElement.paused === false) {\n _videoElement.addEventListener('progress', () => {\n restartSyncLoop();\n }, {\n once: true\n });\n }\n\n _libraryInstance.addEventListener('buffering', buffering);\n\n _videoElement.addEventListener('playing', handlePlaying);\n\n _videoElement.addEventListener('pause', handlePause);\n },\n destroy: () => {\n stopSyncLoop();\n room.off('disconnect', stopSyncLoop);\n room.off('removeLocalParticipant', stopSyncLoop);\n room.off('addLocalParticipant', handleAddLocalParticipant);\n room.off('addRemoteParticipant', handleAddRemoteParticipant);\n room.off('data', parseDataEvents);\n\n if (_libraryInstance) {\n _libraryInstance.removeEventListener('buffering', buffering);\n }\n\n if (_videoElement) {\n _videoElement.removeEventListener('playing', handlePlaying);\n\n _videoElement.removeEventListener('pause', handlePause);\n }\n\n _libraryInstance = null;\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (syncDaznDash);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/sync-modules/sync-shaka-dash.js?");
|
|
9403
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../wt-utils */ \"./src/modules/wt-utils.js\");\n\n\nconst syncDaznDash = function () {\n let {\n room,\n wt,\n roomSession,\n emitter\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n //SYNC VARS\n let _libraryInstance = null;\n let _videoElement = null;\n const syncDefaultWaitTime = 60000;\n const syncShortWaitTime = 10000;\n const maxSyncThreshold = 0.5;\n const maxSyncTries = 3;\n let currentSyncRetry = 0;\n let syncWaitId = null;\n let syncNextWaitTime = null;\n let stopFlag = false;\n let isSyncing = false;\n let playbackRate = 2;\n let isPlaying = false;\n let isPreloading = true;\n let isProgrammaticallySeeked = false;\n let shouldPropagateMaster = false;\n\n const buffering = event => {\n if (event.buffering) {\n handleStalledWaiting();\n }\n };\n\n const startSyncLoop = () => {\n if (!isConnected()) {\n room._log('--- Sync loop will not start due to user not connected yet ---');\n\n return;\n }\n\n if (syncWaitId) {\n room._log('--- Sync loop already running ---');\n\n return;\n }\n\n room._log('--- Sync enabled ---');\n\n stopFlag = false;\n\n const loop = () => {\n isSyncing = true;\n emitter.emit('playerSyncing', true);\n sync().finally(() => {\n isSyncing = false;\n emitter.emit('playerSyncing', false);\n\n if (isConnected() && !stopFlag) {\n syncWaitId = setTimeout(loop, syncNextWaitTime);\n } else {\n room._log('--- Automatic stop due to user not connected or stop flag enabled ---');\n\n stopSyncLoop();\n }\n });\n };\n\n loop();\n };\n\n const stopSyncLoop = () => {\n room._log('--- Sync disabled ---');\n\n clearTimeout(syncWaitId);\n syncWaitId = null;\n currentSyncRetry = 0;\n stopFlag = true;\n };\n\n const restartSyncLoop = () => {\n room._log('--- Sync restarting ---');\n\n stopSyncLoop();\n startSyncLoop();\n };\n\n const setNextWaitTime = function () {\n let didSyncFail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (!didSyncFail) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n currentSyncRetry++;\n\n if (currentSyncRetry > maxSyncTries) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n syncNextWaitTime = syncShortWaitTime;\n }\n }\n\n room._log('--- Next sync will occur in ' + syncNextWaitTime / 1000 + ' seconds ---');\n };\n\n const sync = () => {\n return getSyncData().then(syncData => {\n if (syncData.isMaster) {\n if (_videoElement.paused) _videoElement.play();\n setNextWaitTime(false);\n return Promise.resolve();\n } else if (shouldPropagateMaster) {\n setNextWaitTime(false);\n return propagateMasterFunc();\n } else {\n const syncStartTime = Date.now();\n const {\n position,\n realPosition,\n isBufferSufficient\n } = calculateSyncDifferenceTime(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping);\n const currentPosition = getCurrentSegmentPosition() / 1000;\n\n if (position && Math.abs(position - currentPosition) <= maxSyncThreshold) {\n room._log(`We're within max sync threshold, no need to resync now`);\n\n setNextWaitTime(false);\n return Promise.resolve();\n }\n\n if (position !== null) {\n return seekTo(position).then(() => {\n const seekDuration = (Date.now() - syncStartTime) / 1000;\n const syncPrecision = Math.abs(realPosition + seekDuration - getCurrentSegmentPosition() / 1000);\n\n room._log(`Insufficient buffer: `, !isBufferSufficient);\n\n room._log(`Seek duration is ${seekDuration}`);\n\n room._log(`Sync precision should be ${syncPrecision}`);\n\n const didSyncFail = syncPrecision > maxSyncThreshold;\n setNextWaitTime(didSyncFail);\n return Promise.resolve();\n }).catch(e => {\n setNextWaitTime(true);\n return Promise.reject(e);\n });\n } else {\n setNextWaitTime(true);\n return Promise.reject();\n }\n }\n }).catch(() => {\n setNextWaitTime(true);\n return Promise.reject();\n });\n };\n\n const handleAddLocalParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n\n if (_videoElement && _videoElement.paused === false) {\n _videoElement.addEventListener('progress', () => {\n restartSyncLoop();\n }, {\n once: true\n });\n }\n };\n\n const handleAddRemoteParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n };\n\n const isConnected = () => {\n return room._isDataChannelOpen && room.isConnected;\n };\n\n const parseDataEvents = function () {\n let msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (msg.videoroom === 'sync_source_set' && msg.wt_channel_id != \"\") {\n emitter.emit('changePlayerSource', msg.wt_channel_id);\n } else if (msg.videoroom === 'sync_request') {\n roomSyncSend(msg.sync_slave_id).catch(() => {});\n }\n };\n\n const getCurrentSegmentPosition = () => {\n let position = _videoElement && _videoElement.currentTime;\n return isNaN(position) ? 0 : position * 1000;\n };\n\n const calculateSyncDifferenceTime = (fragmentSn, fragmentPos, ping) => {\n let seekRanges = _videoElement.buffered;\n let seekRange = {};\n\n for (let i = 0; i < seekRanges.length; i++) {\n let _c_start = seekRanges.start(i);\n\n let _c_end = seekRanges.end(i);\n\n if (!seekRange.start || _c_start < seekRange.start) {\n seekRange.start = _c_start;\n }\n\n if (!seekRange.end || _c_end > seekRange.end) {\n seekRange.end = _c_end;\n }\n }\n\n let position = (fragmentPos + ping / 2) / 1000;\n\n if (position > seekRange.start && position < seekRange.end) {\n return {\n position,\n isBufferSufficient: true\n };\n } else if (position < seekRange.start) {\n room._log(`Syncing to ${seekRange.start} instead of ${position} due to lack of buffered data`);\n\n return {\n position: seekRange.start + 0.5,\n realPosition: position,\n isBufferSufficient: false\n };\n } else if (position > seekRange.end) {\n room._log(`Syncing to ${seekRange.end} instead of ${position} due to lack of buffered data`);\n\n return {\n position: seekRange.end - 0.5,\n realPosition: position,\n isBufferSufficient: false\n };\n } else return {\n position: null,\n realPosition: position,\n isBufferSufficient: false\n };\n };\n\n const seekTo = time => {\n return new Promise((resolve, reject) => {\n if (_videoElement.currentTime !== time) {\n let diff = time - _videoElement.currentTime;\n\n if (_videoElement.currentTime < time && diff < 4) {\n room._log(`Fast forward to seek...`);\n\n let wasPaused = false;\n\n let __ = () => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false;\n reject('Stalled');\n }; // _videoElement.addEventListener('waiting', __, {once:true});\n\n\n _videoElement.addEventListener('stalled', __, {\n once: true\n });\n\n Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"setExactTimeout\"])(() => {\n if (wasPaused) {\n _videoElement.pause();\n }\n\n _videoElement.playbackRate = 1;\n isProgrammaticallySeeked = false; // _videoElement.removeEventListener('waiting', __, {once:true});\n\n _videoElement.removeEventListener('stalled', __, {\n once: true\n });\n\n resolve();\n }, diff * 1000 / (playbackRate - 1), 20);\n isProgrammaticallySeeked = true;\n\n if (_videoElement.paused) {\n wasPaused = true;\n\n _videoElement.play().then(() => {\n _videoElement.playbackRate = playbackRate;\n });\n } else {\n _videoElement.playbackRate = playbackRate;\n }\n } else {\n room._log(`Jump to seek...`);\n\n let __ = Date.now();\n\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _videoElement.addEventListener('playing', () => {\n room._log(`It took the player ${(Date.now() - __) / 1000} seconds to seek `);\n\n isProgrammaticallySeeked = false;\n resolve();\n }, {\n once: true\n });\n\n _videoElement.currentTime = time;\n }\n } else resolve();\n });\n }; // const seekTo = (time) => {\n // return new Promise((resolve, reject) => {\n // if(_videoElement.currentTime !== time) {\n // let __ = Date.now();\n // isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n // _videoElement.addEventListener('playing', () => {\n // room._log(`It took the player ${(Date.now() - __) / 1000} seconds to seek `);\n // isProgrammaticallySeeked = false;\n // resolve();\n // }, {once:true});\n // _videoElement.currentTime = time;\n // } else resolve()\n // });\n // };\n\n\n const handlePlaying = () => {\n if (!isProgrammaticallySeeked) {\n room._log('Handle playing');\n\n startSyncLoop();\n }\n\n isProgrammaticallySeeked = false;\n isPreloading = _videoElement.paused;\n isPlaying = !_videoElement.paused;\n };\n\n const handlePause = () => {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPlaying = !_videoElement.paused;\n };\n\n const handleStalledWaiting = () => {\n room._log('handleStalledWaiting');\n\n if (!isProgrammaticallySeeked) {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPreloading = _videoElement.paused;\n }\n };\n\n const roomSyncSend = slaveId => {\n if (!_libraryInstance || !_videoElement) {\n room._log(`I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?`);\n\n return Promise.resolve();\n }\n\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n\n room._log(`Sending my position to ${slaveId}`);\n\n room._log(`Current time: ${fragmentPosition}`);\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_response\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: String(\"0\"),\n fragment_pos: Number(fragmentPosition),\n slave_id: room.webrtcVersion > 1000 ? String(slaveId) : Number(slaveId)\n }\n });\n };\n\n const getSyncData = () => {\n room._log('Sending roomSync request');\n\n let roomId = room.roomId;\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n return new Promise((resolve, reject) => {\n let now = new Date().getTime();\n let ping = null;\n let sid = setTimeout(() => {\n room.off('data', fn, this);\n reject('Timeout');\n }, 3000);\n let body = {\n request: \"sync\",\n room: roomId,\n timestamp: new Date().getTime(),\n fragment: String(\"0\"),\n fragment_pos: Number(fragmentPosition)\n };\n\n let fn = msg => {\n if (msg.videoroom && ['sync', 'sync_response'].includes(msg.videoroom)) {\n if (msg.sync_master_await) {\n room._log('Waiting for master position');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n } else if (msg.sync_master_fragment || msg.sync_master_fragment_pos) {\n room._log('Got master position data');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n\n room._log(`I'm master: ${!!msg.sync_master_self}`);\n\n room._log(`Ping: ${ping}`);\n\n room._log(`Master fragment: ${msg.sync_master_fragment}`);\n\n room._log(`Master fragment position: ${msg.sync_master_fragment_pos}`);\n\n room.off('data', fn, this);\n clearTimeout(sid);\n resolve({\n isMaster: !!msg.sync_master_self,\n ping: ping,\n masterFragmentPos: parseInt(msg.sync_master_fragment_pos),\n masterFragmentSn: parseInt(msg.sync_master_fragment)\n });\n } else {\n clearTimeout(sid);\n reject('Master lost connection');\n }\n }\n };\n\n room.on('data', fn, this);\n room.sendMessage(room.handleId, {\n body\n }).then(fn).catch(e => {\n room.off('data', fn, this);\n clearTimeout(sid);\n reject(e);\n });\n });\n };\n\n const clientPaused = () => {\n room._log('Sending client paused');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_paused\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: '0',\n fragment_pos: 0\n }\n });\n };\n\n const propagateMasterFunc = () => {\n room._log('Propagating master');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_source_set\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n wt_channel_id: \"\",\n fragment: \"0\",\n fragment_pos: 0\n }\n });\n };\n\n return {\n __events: ['playerSyncing'],\n initialize: function () {\n let {\n libraryInstance,\n shakaInstance,\n propagateMaster = false\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _libraryInstance = libraryInstance || shakaInstance;\n _videoElement = _libraryInstance.getMediaElement();\n shouldPropagateMaster = propagateMaster;\n isPlaying = _videoElement.paused === false;\n room.on('disconnect', stopSyncLoop);\n room.on('removeLocalParticipant', stopSyncLoop);\n room.on('addLocalParticipant', handleAddLocalParticipant);\n room.on('addRemoteParticipant', handleAddRemoteParticipant);\n room.on('data', parseDataEvents);\n\n if (shouldPropagateMaster) {\n propagateMasterFunc().catch(() => {});\n }\n\n if (_videoElement && _videoElement.paused === false) {\n _videoElement.addEventListener('progress', () => {\n restartSyncLoop();\n }, {\n once: true\n });\n }\n\n _libraryInstance.addEventListener('buffering', buffering);\n\n _videoElement.addEventListener('playing', handlePlaying);\n\n _videoElement.addEventListener('pause', handlePause);\n },\n destroy: () => {\n stopSyncLoop();\n room.off('disconnect', stopSyncLoop);\n room.off('removeLocalParticipant', stopSyncLoop);\n room.off('addLocalParticipant', handleAddLocalParticipant);\n room.off('addRemoteParticipant', handleAddRemoteParticipant);\n room.off('data', parseDataEvents);\n\n if (_libraryInstance) {\n _libraryInstance.removeEventListener('buffering', buffering);\n }\n\n if (_videoElement) {\n _videoElement.removeEventListener('playing', handlePlaying);\n\n _videoElement.removeEventListener('pause', handlePause);\n }\n\n _libraryInstance = null;\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (syncDaznDash);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/sync-modules/sync-shaka-dash.js?");
|
|
9359
9404
|
|
|
9360
9405
|
/***/ }),
|
|
9361
9406
|
|
|
@@ -9367,7 +9412,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_
|
|
|
9367
9412
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9368
9413
|
|
|
9369
9414
|
"use strict";
|
|
9370
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../wt-utils */ \"./src/modules/wt-utils.js\");\n/* harmony import */ var _wt_emitter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../wt-emitter */ \"./src/modules/wt-emitter.js\");\n\n\n\nconst syncUniversal = function () {\n let {\n room,\n wt,\n roomSession,\n emitter\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n //SYNC VARS\n let _emitter = Object(_wt_emitter__WEBPACK_IMPORTED_MODULE_1__[\"default\"])();\n\n let _playerInterface = null;\n let _playerInterfaceOptions = {\n isLive: true,\n ignoreBufferedTimeRanges: true,\n useSeekBy: false,\n syncBySegments: false,\n disableFastSeek: false\n };\n const syncDefaultWaitTime = 60000;\n const syncShortWaitTime = 10000;\n const maxSyncThreshold = 0.5;\n const maxSyncTries = 3;\n const waitForPlayingEventAfterSeek = 5000;\n let currentSyncRetry = 0;\n let syncWaitId = null;\n let syncNextWaitTime = null;\n let stopFlag = false;\n let isSyncing = false;\n let playbackRate = 2;\n let isPlaying = false;\n let isPreloading = true;\n let isProgrammaticallySeeked = false;\n let shouldPropagateMaster = false;\n\n const startSyncLoop = () => {\n if (!isConnected()) {\n room._log('--- Sync loop will not start due to user not connected yet ---');\n\n return;\n }\n\n if (syncWaitId) {\n room._log('--- Sync loop already running ---');\n\n return;\n }\n\n room._log('--- Sync enabled ---');\n\n stopFlag = false;\n\n const loop = () => {\n isSyncing = true;\n emitter.emit('playerSyncing', true);\n sync().finally(() => {\n isSyncing = false;\n emitter.emit('playerSyncing', false);\n\n if (isConnected() && !stopFlag) {\n syncWaitId = setTimeout(loop, syncNextWaitTime);\n } else {\n room._log('--- Automatic stop due to user not connected or stop flag enabled ---');\n\n stopSyncLoop();\n }\n });\n };\n\n loop();\n };\n\n const stopSyncLoop = () => {\n room._log('--- Sync disabled ---');\n\n clearTimeout(syncWaitId);\n syncWaitId = null;\n currentSyncRetry = 0;\n stopFlag = true;\n };\n\n const restartSyncLoop = () => {\n room._log('--- Sync restarting ---');\n\n stopSyncLoop();\n startSyncLoop();\n };\n\n const setNextWaitTime = function () {\n let didSyncFail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (!didSyncFail) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n currentSyncRetry++;\n\n if (currentSyncRetry > maxSyncTries) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n syncNextWaitTime = syncShortWaitTime;\n }\n }\n\n room._log('--- Next sync will occur in ' + syncNextWaitTime / 1000 + ' seconds ---');\n };\n\n const sync = () => {\n return getSyncData().then(syncData => {\n if (syncData.isMaster) {\n if (_playerInterface.isPaused) _playerInterface.play();\n setNextWaitTime(false);\n return Promise.resolve();\n } else if (shouldPropagateMaster) {\n setNextWaitTime(false);\n return propagateMasterFunc();\n } else {\n const syncStartTime = Date.now();\n const {\n position,\n realPosition,\n isBufferSufficient\n } = calculateSyncDifferenceTime(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping);\n const currentPosition = getCurrentSegmentPosition() / 1000;\n\n if (position && Math.abs(position - currentPosition) <= maxSyncThreshold) {\n room._log(\"We're within max sync threshold, no need to resync now\");\n\n setNextWaitTime(false);\n return Promise.resolve();\n }\n\n if (position !== null) {\n return seekTo(position).then(() => {\n const seekDuration = (Date.now() - syncStartTime) / 1000;\n const syncPrecision = Math.abs(realPosition + seekDuration - getCurrentSegmentPosition() / 1000);\n\n room._log(realPosition, seekDuration, getCurrentSegmentPosition());\n\n room._log(\"Insufficient buffer: \", !isBufferSufficient);\n\n room._log(\"Seek duration is \".concat(seekDuration, \" seconds\"));\n\n room._log(\"Sync precision should be \".concat(syncPrecision));\n\n const didSyncFail = syncPrecision > maxSyncThreshold;\n setNextWaitTime(didSyncFail);\n return Promise.resolve();\n }).catch(e => {\n setNextWaitTime(true);\n return Promise.reject(e);\n });\n } else {\n setNextWaitTime(true);\n return Promise.reject();\n }\n }\n }).catch(() => {\n setNextWaitTime(true);\n return Promise.reject();\n });\n };\n\n const handleAddLocalParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n\n if (_playerInterface.isPaused === false) {\n _emitter.once('timeupdate', restartSyncLoop);\n }\n };\n\n const handleAddRemoteParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n };\n\n const isConnected = () => {\n return room._isDataChannelOpen && room.isConnected;\n };\n\n const parseDataEvents = function () {\n let msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (msg.videoroom === 'sync_source_set' && msg.wt_channel_id != \"\") {\n emitter.emit('changePlayerSource', msg.wt_channel_id);\n } else if (msg.videoroom === 'sync_request') {\n roomSyncSend(msg.sync_slave_id).catch(() => {});\n }\n };\n\n const getCurrentSegmentPosition = () => {\n let position = _playerInterface.currentTime;\n return isNaN(position) ? 0 : position * 1000;\n };\n\n const calculateSyncDifferenceTime = (fragmentSn, fragmentPos, ping) => {\n let seekRanges = _playerInterface.buffered;\n let position = (fragmentPos + ping / 2) / 1000;\n\n if (seekRanges && !_playerInterfaceOptions.ignoreBufferedTimeRanges) {\n let seekRange = {};\n\n for (let i = 0; i < seekRanges.length; i++) {\n let _c_start = seekRanges.start(i);\n\n let _c_end = seekRanges.end(i);\n\n if (!seekRange.start || _c_start < seekRange.start) {\n seekRange.start = _c_start;\n }\n\n if (!seekRange.end || _c_end > seekRange.end) {\n seekRange.end = _c_end;\n }\n }\n\n if (position > seekRange.start && position < seekRange.end) {\n return {\n position,\n realPosition: position,\n isBufferSufficient: true\n };\n } else if (position < seekRange.start) {\n room._log(\"Syncing to \".concat(seekRange.start, \" instead of \").concat(position, \" due to lack of buffered data\"));\n\n return {\n position: seekRange.start + 0.5,\n realPosition: position,\n isBufferSufficient: false\n };\n } else if (position > seekRange.end) {\n room._log(\"Syncing to \".concat(seekRange.end, \" instead of \").concat(position, \" due to lack of buffered data\"));\n\n return {\n position: seekRange.end - 0.5,\n realPosition: position,\n isBufferSufficient: false\n };\n } else return {\n position: null,\n isBufferSufficient: false\n };\n } else {\n return {\n position,\n realPosition: position,\n isBufferSufficient: true\n };\n }\n };\n\n const seekTo = time => {\n return new Promise((resolve, reject) => {\n if (_playerInterface.currentTime !== time) {\n let diff = time - _playerInterface.currentTime;\n\n if (_playerInterface.currentTime < time && diff < 4) {\n room._log(\"Fast forward to seek...\");\n\n let wasPaused = false;\n\n let _handleFailed = () => {\n if (wasPaused) {\n _playerInterface.pause();\n }\n\n _playerInterface.setPlaybackRate(1);\n\n isProgrammaticallySeeked = false;\n reject('Stalled');\n };\n\n let _fastForward = () => {\n isProgrammaticallySeeked = true;\n Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"setExactTimeout\"])(() => {\n _emitter.off('stalled', _handleFailed);\n\n if (wasPaused && !_playerInterfaceOptions.isLive) {\n _playerInterface.pause();\n }\n\n _playerInterface.setPlaybackRate(1);\n\n isProgrammaticallySeeked = false;\n resolve();\n }, diff * 1000 / (playbackRate - 1), 20);\n\n _playerInterface.setPlaybackRate(playbackRate);\n };\n\n _emitter.once('stalled', _handleFailed);\n\n if (_playerInterface.isPaused) {\n wasPaused = true;\n\n _playerInterface.play().then(() => {\n _fastForward();\n }).catch(_handleFailed);\n } else {\n _fastForward();\n }\n } else {\n room._log(\"Jump to seek...\");\n\n let currentTimestamp = Date.now();\n let __failsafeId = null;\n\n let _resolve = () => {\n clearTimeout(__failsafeId);\n __failsafeId = null;\n isProgrammaticallySeeked = false;\n\n room._log(\"It took the player \".concat((Date.now() - currentTimestamp) / 1000, \" seconds to seek \"));\n\n resolve();\n };\n\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _emitter.once('playing', _resolve);\n\n __failsafeId = setTimeout(_resolve, waitForPlayingEventAfterSeek);\n\n _playerInterface.seek(time);\n }\n } else resolve();\n });\n };\n\n const handlePlaying = () => {\n if (!isProgrammaticallySeeked) {\n room._log('Handle playing');\n\n startSyncLoop();\n }\n\n isProgrammaticallySeeked = false;\n isPreloading = _playerInterface.isPaused;\n isPlaying = !_playerInterface.isPaused;\n };\n\n const handlePause = () => {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPlaying = !_playerInterface.isPaused;\n };\n\n const handleBuffering = () => {\n room._log('handleBuffering');\n\n if (!isProgrammaticallySeeked) {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPreloading = _playerInterface.isPaused;\n }\n };\n\n const roomSyncSend = slaveId => {\n if (!_playerInterface) {\n room._log(\"I've been asked for position even if we don't have player attached.\\n Does it mean I'm the master?\");\n\n return Promise.resolve();\n }\n\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n\n room._log(\"Sending my position to \".concat(slaveId));\n\n room._log(\"Current time: \".concat(fragmentPosition));\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_response\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: String(\"0\"),\n fragment_pos: Number(fragmentPosition),\n slave_id: room.webrtcVersion > 1000 ? String(slaveId) : Number(slaveId)\n }\n });\n };\n\n const getSyncData = () => {\n room._log('Sending roomSync request');\n\n let roomId = room.roomId;\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n return new Promise((resolve, reject) => {\n let now = new Date().getTime();\n let ping = null;\n let sid = setTimeout(() => {\n room.off('data', fn, this);\n reject('Timeout');\n }, 3000);\n let body = {\n request: \"sync\",\n room: roomId,\n timestamp: new Date().getTime(),\n fragment: String(\"0\"),\n fragment_pos: Number(fragmentPosition)\n };\n\n let fn = msg => {\n if (msg.videoroom && ['sync', 'sync_response'].includes(msg.videoroom)) {\n if (msg.sync_master_await) {\n room._log('Waiting for master position');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n } else if (msg.sync_master_fragment || msg.sync_master_fragment_pos) {\n room._log('Got master position data');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n\n room._log(\"I'm master: \".concat(!!msg.sync_master_self));\n\n room._log(\"Ping: \".concat(ping));\n\n room._log(\"Master fragment: \".concat(msg.sync_master_fragment));\n\n room._log(\"Master fragment position: \".concat(msg.sync_master_fragment_pos));\n\n room.off('data', fn, this);\n clearTimeout(sid);\n resolve({\n isMaster: !!msg.sync_master_self,\n ping: ping,\n masterFragmentPos: parseInt(msg.sync_master_fragment_pos),\n masterFragmentSn: parseInt(msg.sync_master_fragment)\n });\n } else {\n clearTimeout(sid);\n reject('Master lost connection');\n }\n }\n };\n\n room.on('data', fn, this);\n room.sendMessage(room.handleId, {\n body\n }).then(fn).catch(e => {\n room.off('data', fn, this);\n clearTimeout(sid);\n reject(e);\n });\n });\n };\n\n const clientPaused = () => {\n room._log('Sending client paused');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_paused\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: '0',\n fragment_pos: 0\n }\n });\n };\n\n const propagateMasterFunc = () => {\n room._log('Propagating master');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_source_set\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n wt_channel_id: \"\",\n fragment: \"0\",\n fragment_pos: 0\n }\n });\n };\n\n return {\n __events: ['playerSyncing'],\n getHandlers: () => ({\n handlePause: event => {\n room._log('handlePause');\n\n _emitter.emit('pause', event);\n },\n handlePlaying: event => {\n room._log('handlePlaying');\n\n _emitter.emit('playing', event);\n },\n handleBuffering: event => {\n room._log('handleBuffering');\n\n _emitter.emit('buffering', event);\n },\n handleStalled: event => {\n room._log('handleBuffering');\n\n room._log('handleStalled');\n\n _emitter.emit('buffering', event);\n\n _emitter.emit('stalled', event);\n },\n handleTimeupdate: event => {\n room._log('handleTimeupdate');\n\n _emitter.emit('timeupdate', event);\n }\n }),\n initialize: function () {\n let {\n playerInterface\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _playerInterface = playerInterface;\n _playerInterfaceOptions = { ..._playerInterfaceOptions,\n ...(_playerInterface.options || {})\n };\n\n room._log('Interface options passed: ', _playerInterface.options || {});\n\n room._log('All interface options: ', _playerInterfaceOptions);\n\n shouldPropagateMaster = false;\n isPlaying = _playerInterface.isPaused === false;\n room.on('disconnect', stopSyncLoop);\n room.on('removeLocalParticipant', stopSyncLoop);\n room.on('addLocalParticipant', handleAddLocalParticipant);\n room.on('addRemoteParticipant', handleAddRemoteParticipant);\n room.on('data', parseDataEvents);\n\n if (shouldPropagateMaster) {\n propagateMasterFunc().catch(() => {});\n }\n\n if (_playerInterface.isPaused === false) {\n _emitter.once('timeupdate', restartSyncLoop);\n }\n\n _emitter.on('buffering', handleBuffering);\n\n _emitter.on('playing', handlePlaying);\n\n _emitter.on('pause', handlePause);\n },\n destroy: () => {\n var _playerInterface2;\n\n stopSyncLoop();\n room.off('disconnect', stopSyncLoop);\n room.off('removeLocalParticipant', stopSyncLoop);\n room.off('addLocalParticipant', handleAddLocalParticipant);\n room.off('addRemoteParticipant', handleAddRemoteParticipant);\n room.off('data', parseDataEvents);\n\n if (typeof ((_playerInterface2 = _playerInterface) === null || _playerInterface2 === void 0 ? void 0 : _playerInterface2.destroy) === 'function') {\n var _playerInterface3;\n\n (_playerInterface3 = _playerInterface) === null || _playerInterface3 === void 0 ? void 0 : _playerInterface3.destroy();\n }\n\n _playerInterface = null;\n\n _emitter.clear();\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (syncUniversal);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/sync-modules/sync-universal.js?");
|
|
9415
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../wt-utils */ \"./src/modules/wt-utils.js\");\n/* harmony import */ var _wt_emitter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../wt-emitter */ \"./src/modules/wt-emitter.js\");\n\n\n\nconst syncUniversal = function () {\n let {\n room,\n wt,\n roomSession,\n emitter\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n //SYNC VARS\n let _emitter = Object(_wt_emitter__WEBPACK_IMPORTED_MODULE_1__[\"default\"])();\n\n let _playerInterface = null;\n let _playerInterfaceOptions = {\n isLive: true,\n ignoreBufferedTimeRanges: true,\n useSeekBy: false,\n syncBySegments: false,\n disableFastSeek: false\n };\n const syncDefaultWaitTime = 60000;\n const syncShortWaitTime = 10000;\n const maxSyncThreshold = 0.5;\n const maxSyncTries = 3;\n const waitForPlayingEventAfterSeek = 5000;\n let currentSyncRetry = 0;\n let syncWaitId = null;\n let syncNextWaitTime = null;\n let stopFlag = false;\n let isSyncing = false;\n let playbackRate = 2;\n let isPlaying = false;\n let isPreloading = true;\n let isProgrammaticallySeeked = false;\n let shouldPropagateMaster = false;\n\n const startSyncLoop = () => {\n if (!isConnected()) {\n room._log('--- Sync loop will not start due to user not connected yet ---');\n\n return;\n }\n\n if (syncWaitId) {\n room._log('--- Sync loop already running ---');\n\n return;\n }\n\n room._log('--- Sync enabled ---');\n\n stopFlag = false;\n\n const loop = () => {\n isSyncing = true;\n emitter.emit('playerSyncing', true);\n sync().finally(() => {\n isSyncing = false;\n emitter.emit('playerSyncing', false);\n\n if (isConnected() && !stopFlag) {\n syncWaitId = setTimeout(loop, syncNextWaitTime);\n } else {\n room._log('--- Automatic stop due to user not connected or stop flag enabled ---');\n\n stopSyncLoop();\n }\n });\n };\n\n loop();\n };\n\n const stopSyncLoop = () => {\n room._log('--- Sync disabled ---');\n\n clearTimeout(syncWaitId);\n syncWaitId = null;\n currentSyncRetry = 0;\n stopFlag = true;\n };\n\n const restartSyncLoop = () => {\n room._log('--- Sync restarting ---');\n\n stopSyncLoop();\n startSyncLoop();\n };\n\n const setNextWaitTime = function () {\n let didSyncFail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (!didSyncFail) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n currentSyncRetry++;\n\n if (currentSyncRetry > maxSyncTries) {\n syncNextWaitTime = syncDefaultWaitTime;\n currentSyncRetry = 0;\n } else {\n syncNextWaitTime = syncShortWaitTime;\n }\n }\n\n room._log('--- Next sync will occur in ' + syncNextWaitTime / 1000 + ' seconds ---');\n };\n\n const sync = () => {\n return getSyncData().then(syncData => {\n if (syncData.isMaster) {\n if (_playerInterface.isPaused) _playerInterface.play();\n setNextWaitTime(false);\n return Promise.resolve();\n } else if (shouldPropagateMaster) {\n setNextWaitTime(false);\n return propagateMasterFunc();\n } else {\n const syncStartTime = Date.now();\n const {\n position,\n realPosition,\n isBufferSufficient\n } = calculateSyncDifferenceTime(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping);\n const currentPosition = getCurrentSegmentPosition() / 1000;\n\n if (position && Math.abs(position - currentPosition) <= maxSyncThreshold) {\n room._log(`We're within max sync threshold, no need to resync now`);\n\n setNextWaitTime(false);\n return Promise.resolve();\n }\n\n if (position !== null) {\n return seekTo(position).then(() => {\n const seekDuration = (Date.now() - syncStartTime) / 1000;\n const syncPrecision = Math.abs(realPosition + seekDuration - getCurrentSegmentPosition() / 1000);\n\n room._log(realPosition, seekDuration, getCurrentSegmentPosition());\n\n room._log(`Insufficient buffer: `, !isBufferSufficient);\n\n room._log(`Seek duration is ${seekDuration} seconds`);\n\n room._log(`Sync precision should be ${syncPrecision}`);\n\n const didSyncFail = syncPrecision > maxSyncThreshold;\n setNextWaitTime(didSyncFail);\n return Promise.resolve();\n }).catch(e => {\n setNextWaitTime(true);\n return Promise.reject(e);\n });\n } else {\n setNextWaitTime(true);\n return Promise.reject();\n }\n }\n }).catch(() => {\n setNextWaitTime(true);\n return Promise.reject();\n });\n };\n\n const handleAddLocalParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n\n if (_playerInterface.isPaused === false) {\n _emitter.once('timeupdate', restartSyncLoop);\n }\n };\n\n const handleAddRemoteParticipant = () => {\n if (shouldPropagateMaster) {\n propagateMasterFunc();\n }\n };\n\n const isConnected = () => {\n return room._isDataChannelOpen && room.isConnected;\n };\n\n const parseDataEvents = function () {\n let msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (msg.videoroom === 'sync_source_set' && msg.wt_channel_id != \"\") {\n emitter.emit('changePlayerSource', msg.wt_channel_id);\n } else if (msg.videoroom === 'sync_request') {\n roomSyncSend(msg.sync_slave_id).catch(() => {});\n }\n };\n\n const getCurrentSegmentPosition = () => {\n let position = _playerInterface.currentTime;\n return isNaN(position) ? 0 : position * 1000;\n };\n\n const calculateSyncDifferenceTime = (fragmentSn, fragmentPos, ping) => {\n let seekRanges = _playerInterface.buffered;\n let position = (fragmentPos + ping / 2) / 1000;\n\n if (seekRanges && !_playerInterfaceOptions.ignoreBufferedTimeRanges) {\n let seekRange = {};\n\n for (let i = 0; i < seekRanges.length; i++) {\n let _c_start = seekRanges.start(i);\n\n let _c_end = seekRanges.end(i);\n\n if (!seekRange.start || _c_start < seekRange.start) {\n seekRange.start = _c_start;\n }\n\n if (!seekRange.end || _c_end > seekRange.end) {\n seekRange.end = _c_end;\n }\n }\n\n if (position > seekRange.start && position < seekRange.end) {\n return {\n position,\n realPosition: position,\n isBufferSufficient: true\n };\n } else if (position < seekRange.start) {\n room._log(`Syncing to ${seekRange.start} instead of ${position} due to lack of buffered data`);\n\n return {\n position: seekRange.start + 0.5,\n realPosition: position,\n isBufferSufficient: false\n };\n } else if (position > seekRange.end) {\n room._log(`Syncing to ${seekRange.end} instead of ${position} due to lack of buffered data`);\n\n return {\n position: seekRange.end - 0.5,\n realPosition: position,\n isBufferSufficient: false\n };\n } else return {\n position: null,\n isBufferSufficient: false\n };\n } else {\n return {\n position,\n realPosition: position,\n isBufferSufficient: true\n };\n }\n };\n\n const seekTo = time => {\n return new Promise((resolve, reject) => {\n if (_playerInterface.currentTime !== time) {\n let diff = time - _playerInterface.currentTime;\n\n if (_playerInterface.currentTime < time && diff < 4) {\n room._log(`Fast forward to seek...`);\n\n let wasPaused = false;\n\n let _handleFailed = () => {\n if (wasPaused) {\n _playerInterface.pause();\n }\n\n _playerInterface.setPlaybackRate(1);\n\n isProgrammaticallySeeked = false;\n reject('Stalled');\n };\n\n let _fastForward = () => {\n isProgrammaticallySeeked = true;\n Object(_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"setExactTimeout\"])(() => {\n _emitter.off('stalled', _handleFailed);\n\n if (wasPaused && !_playerInterfaceOptions.isLive) {\n _playerInterface.pause();\n }\n\n _playerInterface.setPlaybackRate(1);\n\n isProgrammaticallySeeked = false;\n resolve();\n }, diff * 1000 / (playbackRate - 1), 20);\n\n _playerInterface.setPlaybackRate(playbackRate);\n };\n\n _emitter.once('stalled', _handleFailed);\n\n if (_playerInterface.isPaused) {\n wasPaused = true;\n\n _playerInterface.play().then(() => {\n _fastForward();\n }).catch(_handleFailed);\n } else {\n _fastForward();\n }\n } else {\n room._log(`Jump to seek...`);\n\n let currentTimestamp = Date.now();\n let __failsafeId = null;\n\n let _resolve = () => {\n clearTimeout(__failsafeId);\n __failsafeId = null;\n isProgrammaticallySeeked = false;\n\n room._log(`It took the player ${(Date.now() - currentTimestamp) / 1000} seconds to seek `);\n\n resolve();\n };\n\n isProgrammaticallySeeked = true; // we need to ignore stall events since those are false alarm\n\n _emitter.once('playing', _resolve);\n\n __failsafeId = setTimeout(_resolve, waitForPlayingEventAfterSeek);\n\n _playerInterface.seek(time);\n }\n } else resolve();\n });\n };\n\n const handlePlaying = () => {\n if (!isProgrammaticallySeeked) {\n room._log('Handle playing');\n\n startSyncLoop();\n }\n\n isProgrammaticallySeeked = false;\n isPreloading = _playerInterface.isPaused;\n isPlaying = !_playerInterface.isPaused;\n };\n\n const handlePause = () => {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPlaying = !_playerInterface.isPaused;\n };\n\n const handleBuffering = () => {\n room._log('handleBuffering');\n\n if (!isProgrammaticallySeeked) {\n stopSyncLoop();\n clientPaused().catch(() => {});\n isPreloading = _playerInterface.isPaused;\n }\n };\n\n const roomSyncSend = slaveId => {\n if (!_playerInterface) {\n room._log(`I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?`);\n\n return Promise.resolve();\n }\n\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n\n room._log(`Sending my position to ${slaveId}`);\n\n room._log(`Current time: ${fragmentPosition}`);\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_response\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: String(\"0\"),\n fragment_pos: Number(fragmentPosition),\n slave_id: room.webrtcVersion > 1000 ? String(slaveId) : Number(slaveId)\n }\n });\n };\n\n const getSyncData = () => {\n room._log('Sending roomSync request');\n\n let roomId = room.roomId;\n let fragmentPosition = parseInt(getCurrentSegmentPosition());\n return new Promise((resolve, reject) => {\n let now = new Date().getTime();\n let ping = null;\n let sid = setTimeout(() => {\n room.off('data', fn, this);\n reject('Timeout');\n }, 3000);\n let body = {\n request: \"sync\",\n room: roomId,\n timestamp: new Date().getTime(),\n fragment: String(\"0\"),\n fragment_pos: Number(fragmentPosition)\n };\n\n let fn = msg => {\n if (msg.videoroom && ['sync', 'sync_response'].includes(msg.videoroom)) {\n if (msg.sync_master_await) {\n room._log('Waiting for master position');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n } else if (msg.sync_master_fragment || msg.sync_master_fragment_pos) {\n room._log('Got master position data');\n\n if (!ping) {\n ping = new Date().getTime() - now;\n }\n\n room._log(`I'm master: ${!!msg.sync_master_self}`);\n\n room._log(`Ping: ${ping}`);\n\n room._log(`Master fragment: ${msg.sync_master_fragment}`);\n\n room._log(`Master fragment position: ${msg.sync_master_fragment_pos}`);\n\n room.off('data', fn, this);\n clearTimeout(sid);\n resolve({\n isMaster: !!msg.sync_master_self,\n ping: ping,\n masterFragmentPos: parseInt(msg.sync_master_fragment_pos),\n masterFragmentSn: parseInt(msg.sync_master_fragment)\n });\n } else {\n clearTimeout(sid);\n reject('Master lost connection');\n }\n }\n };\n\n room.on('data', fn, this);\n room.sendMessage(room.handleId, {\n body\n }).then(fn).catch(e => {\n room.off('data', fn, this);\n clearTimeout(sid);\n reject(e);\n });\n });\n };\n\n const clientPaused = () => {\n room._log('Sending client paused');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_paused\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n fragment: '0',\n fragment_pos: 0\n }\n });\n };\n\n const propagateMasterFunc = () => {\n room._log('Propagating master');\n\n if (!isConnected()) {\n return Promise.resolve();\n }\n\n return room.sendMessage(room.handleId, {\n body: {\n request: \"sync_source_set\",\n room: room.roomId,\n timestamp: new Date().getTime(),\n wt_channel_id: \"\",\n fragment: \"0\",\n fragment_pos: 0\n }\n });\n };\n\n return {\n __events: ['playerSyncing'],\n getHandlers: () => ({\n handlePause: event => {\n room._log('handlePause');\n\n _emitter.emit('pause', event);\n },\n handlePlaying: event => {\n room._log('handlePlaying');\n\n _emitter.emit('playing', event);\n },\n handleBuffering: event => {\n room._log('handleBuffering');\n\n _emitter.emit('buffering', event);\n },\n handleStalled: event => {\n room._log('handleBuffering');\n\n room._log('handleStalled');\n\n _emitter.emit('buffering', event);\n\n _emitter.emit('stalled', event);\n },\n handleTimeupdate: event => {\n room._log('handleTimeupdate');\n\n _emitter.emit('timeupdate', event);\n }\n }),\n initialize: function () {\n let {\n playerInterface\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _playerInterface = playerInterface;\n _playerInterfaceOptions = { ..._playerInterfaceOptions,\n ...(_playerInterface.options || {})\n };\n\n room._log('Interface options passed: ', _playerInterface.options || {});\n\n room._log('All interface options: ', _playerInterfaceOptions);\n\n shouldPropagateMaster = false;\n isPlaying = _playerInterface.isPaused === false;\n room.on('disconnect', stopSyncLoop);\n room.on('removeLocalParticipant', stopSyncLoop);\n room.on('addLocalParticipant', handleAddLocalParticipant);\n room.on('addRemoteParticipant', handleAddRemoteParticipant);\n room.on('data', parseDataEvents);\n\n if (shouldPropagateMaster) {\n propagateMasterFunc().catch(() => {});\n }\n\n if (_playerInterface.isPaused === false) {\n _emitter.once('timeupdate', restartSyncLoop);\n }\n\n _emitter.on('buffering', handleBuffering);\n\n _emitter.on('playing', handlePlaying);\n\n _emitter.on('pause', handlePause);\n },\n destroy: () => {\n var _playerInterface2;\n\n stopSyncLoop();\n room.off('disconnect', stopSyncLoop);\n room.off('removeLocalParticipant', stopSyncLoop);\n room.off('addLocalParticipant', handleAddLocalParticipant);\n room.off('addRemoteParticipant', handleAddRemoteParticipant);\n room.off('data', parseDataEvents);\n\n if (typeof ((_playerInterface2 = _playerInterface) === null || _playerInterface2 === void 0 ? void 0 : _playerInterface2.destroy) === 'function') {\n var _playerInterface3;\n\n (_playerInterface3 = _playerInterface) === null || _playerInterface3 === void 0 ? void 0 : _playerInterface3.destroy();\n }\n\n _playerInterface = null;\n\n _emitter.clear();\n }\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (syncUniversal);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/sync-modules/sync-universal.js?");
|
|
9371
9416
|
|
|
9372
9417
|
/***/ }),
|
|
9373
9418
|
|
|
@@ -9379,7 +9424,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wt_
|
|
|
9379
9424
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9380
9425
|
|
|
9381
9426
|
"use strict";
|
|
9382
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* WEBPACK VAR INJECTION */(function(Buffer) {/* harmony import */ var swagger_client__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! swagger-client */ \"./node_modules/swagger-client/es/index.js\");\n/* harmony import */ var _wt_config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./wt-config */ \"./src/modules/wt-config.js\");\n/* harmony import */ var _wt_emitter__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./wt-emitter */ \"./src/modules/wt-emitter.js\");\n\n\n\n\nclass Auth {\n constructor(enableDebugFlag) {\n let language = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en-GB';\n let storagePrefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : \"\";\n let apiUrl = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n this.ID_TOKEN =
|
|
9427
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* WEBPACK VAR INJECTION */(function(Buffer) {/* harmony import */ var swagger_client__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! swagger-client */ \"./node_modules/swagger-client/es/index.js\");\n/* harmony import */ var _wt_config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./wt-config */ \"./src/modules/wt-config.js\");\n/* harmony import */ var _wt_emitter__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./wt-emitter */ \"./src/modules/wt-emitter.js\");\n\n\n\n\nclass Auth {\n constructor(enableDebugFlag) {\n let language = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en-GB';\n let storagePrefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : \"\";\n let apiUrl = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n this.ID_TOKEN = `${storagePrefix !== \"\" ? storagePrefix + '_' : ''}rwt_idToken`;\n this.ACCESS_TOKEN = `${storagePrefix !== \"\" ? storagePrefix + '_' : ''}rwt_accessToken`;\n this.REFRESH_TOKEN = `${storagePrefix !== \"\" ? storagePrefix + '_' : ''}rwt_refreshToken`;\n Object.assign(this, Object(_wt_emitter__WEBPACK_IMPORTED_MODULE_2__[\"default\"])());\n this.__log = Auth.noop;\n\n if (enableDebugFlag) {\n this._enableDebug();\n }\n\n this.__language = language;\n this.__refreshTokenPromise = null;\n this.__isRefreshing = false;\n this.__isLogged = null;\n this.__parsedJwt = null;\n this.__specUrl = apiUrl ? apiUrl : _wt_config__WEBPACK_IMPORTED_MODULE_1__[\"default\"].apiUrl;\n this.__client = this.initialize(true);\n }\n\n static noop() {}\n\n _enableDebug() {\n this.__log = console.log.bind(console);\n }\n\n _requestInterceptor(req) {\n if (!req.headers) {\n req.headers = {};\n }\n\n req.headers['Accept-Language'] = this.__language;\n return req;\n }\n\n _responseInterceptor(res, req) {\n if (res.status === 401) {\n if (this.__isLogged) {\n let rt = localStorage.getItem(this.REFRESH_TOKEN);\n this.__refreshTokenPromise = this.__isRefreshing ? this.__refreshTokenPromise : this.__client.then(client => {\n this.__isRefreshing = true;\n return client.apis.auth.refreshToken({}, {\n requestBody: {\n refreshToken: localStorage.getItem(this.REFRESH_TOKEN)\n }\n });\n }).then(r => {\n this.__isRefreshing = false;\n return this.login(r.data.idToken, r.data.accessToken, rt, true);\n }).catch(e => {\n this.__isRefreshing = false;\n this.logout();\n return Promise.reject(e);\n });\n return this.__refreshTokenPromise.then(() => swagger_client__WEBPACK_IMPORTED_MODULE_0__[\"default\"].http({ ...req,\n headers: { ...req.headers,\n Authorization: 'Bearer ' + localStorage.getItem(this.ID_TOKEN)\n }\n })).then(res => {\n if (typeof res.obj === 'object' && res.obj !== null) {\n res.data = res.obj;\n }\n\n return res;\n });\n }\n }\n\n if (typeof res.obj === 'object' && res.obj !== null) {\n res.data = res.obj;\n }\n\n return res;\n }\n\n initialize() {\n let isInitialEvent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n let isReauth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n let idToken = localStorage.getItem(this.ID_TOKEN);\n let authorizations = {};\n\n if (idToken) {\n authorizations['bearer'] = '' + idToken;\n }\n\n this.__isLogged = !!idToken;\n\n let _that = this;\n\n return new swagger_client__WEBPACK_IMPORTED_MODULE_0__[\"default\"](this.__specUrl, {\n authorizations,\n requestInterceptor: this._requestInterceptor.bind(this),\n responseInterceptor: function (res) {\n return _that._responseInterceptor(res, this);\n }\n }).then(client => {\n this.__isLogged = !!idToken;\n this.__parsedJwt = this.parseJwt(idToken);\n this.emit(this.__isLogged ? 'login' : 'logout', {\n client,\n isInitialEvent,\n isReauth,\n isLoggedInAsDevice: this.isLoggedInAs(this.__parsedJwt, 'device'),\n isLoggedInAsObserver: this.isLoggedInAs(this.__parsedJwt, 'observer'),\n isLoggedInAsInstanceAdmin: this.isLoggedInAs(this.__parsedJwt, 'instanceAdmin'),\n isLoggedInAsAdmin: this.isLoggedInAs(this.__parsedJwt, 'admin'),\n domain: this.getDomain(this.__parsedJwt)\n });\n return client;\n }).catch(e => {\n this.__isLogged = false;\n this.emit('logout', {\n client: null,\n isInitialEvent,\n isLoggedInAsDevice: false,\n isLoggedInAsObserver: false,\n isLoggedInAsInstanceAdmin: false,\n isLoggedInAsAdmin: false,\n isReauth\n });\n return Promise.reject(e);\n });\n }\n\n login(idToken, accessToken, refreshToken) {\n let isReauth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n localStorage.setItem(this.ID_TOKEN, idToken);\n localStorage.setItem(this.ACCESS_TOKEN, accessToken);\n localStorage.setItem(this.REFRESH_TOKEN, refreshToken);\n return this.__client = this.initialize(false, isReauth);\n }\n\n logout() {\n localStorage.removeItem(this.ID_TOKEN);\n localStorage.removeItem(this.ACCESS_TOKEN);\n localStorage.removeItem(this.REFRESH_TOKEN);\n return this.__client = this.initialize();\n }\n\n isLoggedIn() {\n return this.__isLogged;\n }\n\n isLoggedInAs(parsedJwt) {\n let as = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'device';\n parsedJwt = parsedJwt || this.__parsedJwt;\n return !!(parsedJwt && parsedJwt['cognito:groups'] && parsedJwt['cognito:groups'].includes(as));\n }\n\n setLanguage(language) {\n this.__language = language;\n return this.__language;\n }\n\n getDomain(parsedJwt) {\n parsedJwt = parsedJwt || this.__parsedJwt;\n return parsedJwt['custom:domain'];\n }\n\n parseJwt(jwt) {\n if (!jwt || typeof jwt !== \"string\") return false;\n let match = jwt.match(/^(([0-9a-zA-Z]*)\\.){2}[\\w-]*$/);\n if (!match || !match[2]) return false;\n\n try {\n match = new Buffer(match[2], 'base64').toString('binary');\n return JSON.parse(match);\n } catch (e) {\n return false;\n }\n }\n\n}\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Auth);\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/node-libs-browser/node_modules/buffer/index.js */ \"./node_modules/node-libs-browser/node_modules/buffer/index.js\").Buffer))\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/wt-auth.js?");
|
|
9383
9428
|
|
|
9384
9429
|
/***/ }),
|
|
9385
9430
|
|
|
@@ -9415,7 +9460,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony default export */
|
|
|
9415
9460
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9416
9461
|
|
|
9417
9462
|
"use strict";
|
|
9418
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var aws_iot_device_sdk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! aws-iot-device-sdk */ \"./node_modules/aws-iot-device-sdk/index.js\");\n/* harmony import */ var aws_iot_device_sdk__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(aws_iot_device_sdk__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _wt_emitter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./wt-emitter */ \"./src/modules/wt-emitter.js\");\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./wt-utils */ \"./src/modules/wt-utils.js\");\n\n\n\n\nclass Iot {\n constructor(enableDebugFlag) {\n Object.assign(this, Object(_wt_emitter__WEBPACK_IMPORTED_MODULE_1__[\"default\"])());\n this.device = null;\n this.decoder = new TextDecoder('utf-8');\n this.connectionActive = false;\n this.log = Iot.noop;\n this.debugFlag = enableDebugFlag;\n this.credentialsExpirationCheckIntervalId = null;\n this.currentCredentialsExpirationStamp = null;\n\n if (enableDebugFlag) {\n this.enableDebug();\n }\n }\n\n static noop() {}\n\n enableDebug() {\n this.log = console.log.bind(console);\n }\n\n startCredentialsExpirationCheck(expiration) {\n this.stopCredentialsExpirationCheck();\n this.currentCredentialsExpirationStamp = new Date(expiration).getTime();\n this.credentialsExpirationCheckIntervalId = setInterval(() => {\n const curentTimeStamp = new Date().getTime();\n\n if (this.currentCredentialsExpirationStamp - curentTimeStamp <= 300000) {\n this.emit('updateCredentials');\n }\n }, 5000);\n }\n\n stopCredentialsExpirationCheck() {\n clearInterval(this.credentialsExpirationCheckIntervalId);\n this.credentialsExpirationCheckIntervalId = null;\n }\n\n updateWebSocketCredentials(accessKeyId, secretAccessKey, sessionToken, expiration) {\n if (this.device) {\n this.device.updateWebSocketCredentials(accessKeyId, secretAccessKey, sessionToken);\n this.startCredentialsExpirationCheck(expiration);\n }\n }\n\n connect(apiMqttUrl, apiMqttClientId, region, accessKeyId, secretAccessKey, sessionToken, expiration) {\n let forceDisconnect = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;\n return this.disconnect(forceDisconnect).then(() => {\n return new Promise((resolve, reject) => {\n this.device = Object(aws_iot_device_sdk__WEBPACK_IMPORTED_MODULE_0__[\"device\"])({\n protocol: 'wss',\n clientId: apiMqttClientId,\n region,\n host: apiMqttUrl,\n accessKeyId: accessKeyId,\n secretKey: secretAccessKey,\n sessionToken: sessionToken,\n keepalive: 15,\n maximumReconnectTimeMs: 8000,\n enableMetrics: false,\n debug: this.debugFlag,\n autoResubscribe: true\n });\n this.startCredentialsExpirationCheck(expiration);\n\n let __s = () => {\n var _this$device, _this$device2;\n\n (_this$device = this.device) === null || _this$device === void 0 ? void 0 : _this$device.off('connect', __s);\n (_this$device2 = this.device) === null || _this$device2 === void 0 ? void 0 : _this$device2.off('error', __e);\n resolve(this.device);\n };\n\n let __e = e => {\n var _this$device3, _this$device4;\n\n (_this$device3 = this.device) === null || _this$device3 === void 0 ? void 0 : _this$device3.off('connect', __s);\n (_this$device4 = this.device) === null || _this$device4 === void 0 ? void 0 : _this$device4.off('error', __e);\n reject(e);\n };\n\n this.device.once('connect', __s);\n this.device.once('error', __e);\n this.device.on('message', this.__messageCb.bind(this));\n this.device.on('connect', this.__connectCb.bind(this));\n this.device.on('reconnect', this.__reconnectCb.bind(this));\n this.device.on('error', this.__failureCb.bind(this));\n this.device.on('close', this.__closeCb.bind(this));\n this.device.on('offline', this.__offlineCb.bind(this));\n });\n });\n }\n\n disconnect() {\n let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n this.stopCredentialsExpirationCheck();\n return new Promise((resolve, reject) => {\n if (!this.device) {\n resolve();\n return;\n }\n\n let __i = null;\n\n let __c = () => {\n clearTimeout(__i);\n this.device = null;\n resolve();\n };\n\n __i = setTimeout(__c, 4000);\n this.device.off('message', this.__messageCb.bind(this));\n this.device.off('connect', this.__connectCb.bind(this));\n this.device.off('reconnect', this.__reconnectCb.bind(this));\n this.device.off('error', this.__failureCb.bind(this));\n this.device.off('close', this.__closeCb.bind(this));\n this.device.off('offline', this.__offlineCb.bind(this));\n this.device.end(force, __c);\n });\n }\n\n isConnected() {\n return this.connectionActive;\n }\n\n subscribe(topic) {\n return this.device && this.device.subscribe(topic);\n }\n\n unsubscribe(topic) {\n return this.device && this.device.unsubscribe(topic);\n }\n\n send(topic, message) {\n let msg = typeof message === 'object' ? JSON.stringify(message) : message;\n return this.device && this.device.publish(topic, msg);\n }\n\n __reconnectCb() {\n this.emit('reconnect');\n }\n\n __connectCb() {\n this.connectionActive = true;\n this.emit('connect');\n }\n\n __failureCb(err) {\n this.emit('error', err);\n }\n\n __closeCb(responseObject) {\n this.connectionActive = false;\n this.emit('close');\n }\n\n __offlineCb(responseObject) {\n this.emit('offline');\n }\n\n __messageCb(t, message, packet) {\n const topic = t.split('/');\n let payload = JSON.parse(this.decoder.decode(message));\n\n if (payload.display) {\n const decodedDisplay = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(payload.display);\n\n if (decodedDisplay.userId) {\n payload = { ...payload,\n userId: decodedDisplay.userId,\n role: decodedDisplay.role,\n start: decodedDisplay.start\n };\n }\n }\n\n if (topic[0] === 'user') {\n // user\n const userId = topic[1].replace(\"_\", ':');\n this.emit('message', {\n userId,\n ...payload,\n event: payload.event ?
|
|
9463
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var aws_iot_device_sdk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! aws-iot-device-sdk */ \"./node_modules/aws-iot-device-sdk/index.js\");\n/* harmony import */ var aws_iot_device_sdk__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(aws_iot_device_sdk__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _wt_emitter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./wt-emitter */ \"./src/modules/wt-emitter.js\");\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./wt-utils */ \"./src/modules/wt-utils.js\");\n\n\n\n\nclass Iot {\n constructor(enableDebugFlag) {\n Object.assign(this, Object(_wt_emitter__WEBPACK_IMPORTED_MODULE_1__[\"default\"])());\n this.device = null;\n this.decoder = new TextDecoder('utf-8');\n this.connectionActive = false;\n this.log = Iot.noop;\n this.debugFlag = enableDebugFlag;\n this.credentialsExpirationCheckIntervalId = null;\n this.currentCredentialsExpirationStamp = null;\n\n if (enableDebugFlag) {\n this.enableDebug();\n }\n }\n\n static noop() {}\n\n enableDebug() {\n this.log = console.log.bind(console);\n }\n\n startCredentialsExpirationCheck(expiration) {\n this.stopCredentialsExpirationCheck();\n this.currentCredentialsExpirationStamp = new Date(expiration).getTime();\n this.credentialsExpirationCheckIntervalId = setInterval(() => {\n const curentTimeStamp = new Date().getTime();\n\n if (this.currentCredentialsExpirationStamp - curentTimeStamp <= 300000) {\n this.emit('updateCredentials');\n }\n }, 5000);\n }\n\n stopCredentialsExpirationCheck() {\n clearInterval(this.credentialsExpirationCheckIntervalId);\n this.credentialsExpirationCheckIntervalId = null;\n }\n\n updateWebSocketCredentials(accessKeyId, secretAccessKey, sessionToken, expiration) {\n if (this.device) {\n this.device.updateWebSocketCredentials(accessKeyId, secretAccessKey, sessionToken);\n this.startCredentialsExpirationCheck(expiration);\n }\n }\n\n connect(apiMqttUrl, apiMqttClientId, region, accessKeyId, secretAccessKey, sessionToken, expiration) {\n let forceDisconnect = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;\n return this.disconnect(forceDisconnect).then(() => {\n return new Promise((resolve, reject) => {\n this.device = Object(aws_iot_device_sdk__WEBPACK_IMPORTED_MODULE_0__[\"device\"])({\n protocol: 'wss',\n clientId: apiMqttClientId,\n region,\n host: apiMqttUrl,\n accessKeyId: accessKeyId,\n secretKey: secretAccessKey,\n sessionToken: sessionToken,\n keepalive: 15,\n maximumReconnectTimeMs: 8000,\n enableMetrics: false,\n debug: this.debugFlag,\n autoResubscribe: true\n });\n this.startCredentialsExpirationCheck(expiration);\n\n let __s = () => {\n var _this$device, _this$device2;\n\n (_this$device = this.device) === null || _this$device === void 0 ? void 0 : _this$device.off('connect', __s);\n (_this$device2 = this.device) === null || _this$device2 === void 0 ? void 0 : _this$device2.off('error', __e);\n resolve(this.device);\n };\n\n let __e = e => {\n var _this$device3, _this$device4;\n\n (_this$device3 = this.device) === null || _this$device3 === void 0 ? void 0 : _this$device3.off('connect', __s);\n (_this$device4 = this.device) === null || _this$device4 === void 0 ? void 0 : _this$device4.off('error', __e);\n reject(e);\n };\n\n this.device.once('connect', __s);\n this.device.once('error', __e);\n this.device.on('message', this.__messageCb.bind(this));\n this.device.on('connect', this.__connectCb.bind(this));\n this.device.on('reconnect', this.__reconnectCb.bind(this));\n this.device.on('error', this.__failureCb.bind(this));\n this.device.on('close', this.__closeCb.bind(this));\n this.device.on('offline', this.__offlineCb.bind(this));\n });\n });\n }\n\n disconnect() {\n let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n this.stopCredentialsExpirationCheck();\n return new Promise((resolve, reject) => {\n if (!this.device) {\n resolve();\n return;\n }\n\n let __i = null;\n\n let __c = () => {\n clearTimeout(__i);\n this.device = null;\n resolve();\n };\n\n __i = setTimeout(__c, 4000);\n this.device.off('message', this.__messageCb.bind(this));\n this.device.off('connect', this.__connectCb.bind(this));\n this.device.off('reconnect', this.__reconnectCb.bind(this));\n this.device.off('error', this.__failureCb.bind(this));\n this.device.off('close', this.__closeCb.bind(this));\n this.device.off('offline', this.__offlineCb.bind(this));\n this.device.end(force, __c);\n });\n }\n\n isConnected() {\n return this.connectionActive;\n }\n\n subscribe(topic) {\n return this.device && this.device.subscribe(topic);\n }\n\n unsubscribe(topic) {\n return this.device && this.device.unsubscribe(topic);\n }\n\n send(topic, message) {\n let msg = typeof message === 'object' ? JSON.stringify(message) : message;\n return this.device && this.device.publish(topic, msg);\n }\n\n __reconnectCb() {\n this.emit('reconnect');\n }\n\n __connectCb() {\n this.connectionActive = true;\n this.emit('connect');\n }\n\n __failureCb(err) {\n this.emit('error', err);\n }\n\n __closeCb(responseObject) {\n this.connectionActive = false;\n this.emit('close');\n }\n\n __offlineCb(responseObject) {\n this.emit('offline');\n }\n\n __messageCb(t, message, packet) {\n const topic = t.split('/');\n let payload = JSON.parse(this.decoder.decode(message));\n\n if (payload.display) {\n const decodedDisplay = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(payload.display);\n\n if (decodedDisplay.userId) {\n payload = { ...payload,\n userId: decodedDisplay.userId,\n role: decodedDisplay.role,\n start: decodedDisplay.start\n };\n }\n }\n\n if (topic[0] === 'user') {\n // user\n const userId = topic[1].replace(\"_\", ':');\n this.emit('message', {\n userId,\n ...payload,\n event: payload.event ? `user:${payload.event}` : 'user'\n });\n } else if (topic[0] === 'wt') {\n const event = payload.event;\n const roomId = topic[2];\n\n if (topic[1] === 'room') {\n // room\n if (event === 'message' || event === 'template_updated' || event === 'record_start' || event === 'record_stop' || event === 'record_configured' || event === 'record_livestream_available' || event === 'record_livestream_kick' || event === 'user_update_displayname' || event === 'user_update_avatar' || event === 'user_update_customattributes' || event === 'user_update_privateattributes' || event === 'channel_changed' || event === \"instance_homepage_changed\" || event === \"instance_settings_changed\" || event === \"externalmix_changed\" || event === \"video_uploaded\" || event === \"change_user_devices\" || event === \"queue\" || event === \"title_changed\") {\n this.emit('message', {\n event,\n ...payload,\n roomId\n });\n } else if (event === 'joined' || event === 'leaving') {\n this.emit('message', {\n event,\n ...payload,\n isObserver: !!payload.isObserver,\n roomId\n });\n } else if (event === 'left' || //user removed room a.k.a. left the room\n event === 'kicked' || event === 'banned' || event === 'unbanned' || event === 'approved' || event === 'muted' || event === 'unmuted' || event === 'messageRemoved' || event === 'messageReported' || event === 'chatClear' || event === 'handRaised' || event === 'handLowered' || event === 'handsCleared') {\n this.emit('message', {\n event,\n ...payload\n });\n } else if (event === 'volume_set') {\n this.emit('message', {\n event,\n ...payload\n });\n }\n } else if (topic[1] === 'instanceroom') {\n // instance\n if (event === 'add_room' || event === 'remove_room' || event === 'set_room' || event === \"instance_homepage_changed\" || event === 'instance_settings_changed') {\n this.emit('message', {\n event,\n ...payload\n });\n }\n } else if (topic[1] === 'externalmix') {\n const event = payload.event;\n this.emit('message', {\n event,\n ...payload\n });\n } else if (topic[1] === 'asset') {\n this.emit('message', {\n event: 'asset',\n assetId: topic[2],\n ...payload\n });\n }\n } else if (topic[0] === 'wtr') {\n const recorderId = topic[1];\n const sessionId = topic[2];\n\n if (topic[3] === 'control') {\n this.emit('message', {\n event: 'recorder_control',\n ...payload,\n recorderId,\n sessionId\n });\n } // recorder control\n else if (topic[3] === 'monitor') {\n this.emit('message', {\n event: 'recorder_monitor',\n ...payload,\n recorderId,\n sessionId\n });\n } // recorder monitor\n\n }\n }\n\n}\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Iot);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/wt-iot.js?");
|
|
9419
9464
|
|
|
9420
9465
|
/***/ }),
|
|
9421
9466
|
|
|
@@ -9427,7 +9472,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var aws_
|
|
|
9427
9472
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9428
9473
|
|
|
9429
9474
|
"use strict";
|
|
9430
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! webrtc-adapter */ \"./node_modules/webrtc-adapter/src/js/adapter_core.js\");\n/* harmony import */ var _wt_emitter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./wt-emitter */ \"./src/modules/wt-emitter.js\");\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./wt-utils */ \"./src/modules/wt-utils.js\");\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n// Watch together janus webrtc library\n\n\n\n\nclass Room {\n constructor(debug) {\n this.debug = debug;\n this.sessions = [];\n this.safariVp8 = false;\n this.browser = webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__[\"default\"].browserDetails.browser;\n this.browserDetails = webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__[\"default\"].browserDetails;\n this.webrtcSupported = Room.isWebrtcSupported();\n this.safariVp8TestPromise = Room.testSafariVp8();\n this.safariVp8 = null;\n this.safariVp8TestPromise.then(safariVp8 => {\n this.safariVp8 = safariVp8;\n }); // Let's get it started\n\n this.whenInitialized = this.initialize();\n }\n\n initialize() {\n return this.safariVp8TestPromise.then(() => this);\n }\n\n createSession() {\n let constructId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'reactooroom';\n let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n return new RoomSession(constructId, type, {\n debug: this.debug,\n ...options\n });\n }\n\n static testSafariVp8() {\n return new Promise(resolve => {\n if (webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__[\"default\"].browserDetails.browser === 'safari' && webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__[\"default\"].browserDetails.version >= 605) {\n if (RTCRtpSender && RTCRtpSender.getCapabilities && RTCRtpSender.getCapabilities(\"video\") && RTCRtpSender.getCapabilities(\"video\").codecs && RTCRtpSender.getCapabilities(\"video\").codecs.length) {\n var isVp8 = false;\n\n for (var i in RTCRtpSender.getCapabilities(\"video\").codecs) {\n var codec = RTCRtpSender.getCapabilities(\"video\").codecs[i];\n\n if (codec && codec.mimeType && codec.mimeType.toLowerCase() === \"video/vp8\") {\n isVp8 = true;\n break;\n }\n }\n\n resolve(isVp8);\n } else {\n // We do it in a very ugly way, as there's no alternative...\n // We create a PeerConnection to see if VP8 is in an offer\n var testpc = new RTCPeerConnection({}, {});\n testpc.createOffer({\n offerToReceiveVideo: true\n }).then(function (offer) {\n let result = offer.sdp.indexOf(\"VP8\") !== -1;\n testpc.close();\n testpc = null;\n resolve(result);\n });\n }\n } else resolve(false);\n });\n }\n\n static isWebrtcSupported() {\n return window.RTCPeerConnection !== undefined && window.RTCPeerConnection !== null && navigator.mediaDevices !== undefined && navigator.mediaDevices !== null && navigator.mediaDevices.getUserMedia !== undefined && navigator.mediaDevices.getUserMedia !== null;\n }\n\n}\n\nclass RoomSession {\n static noop() {}\n\n static randomString(len) {\n var charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n var randomString = '';\n\n for (var i = 0; i < len; i++) {\n var randomPoz = Math.floor(Math.random() * charSet.length);\n randomString += charSet.substring(randomPoz, randomPoz + 1);\n }\n\n return randomString;\n } //TODO: solve\n // #eventList = ['error', 'kicked', 'addLocalParticipant', ,'addRemoteInstructor','addRemoteParticipant','addRemoteTalkback', 'addRemoteObserver', 'removeRemoteInstructor', 'removeLocalParticipant', 'removeRemoteParticipant', 'removeRemoteTalkback', 'removeRemoteObserver', 'localMuted', 'localHasVideo', 'localHasAudio', 'data', 'iceState', 'connectionState', 'joined', 'joining', 'dataChannel', 'disconnect', 'observerIds', 'talkbackIds', 'instructorId', 'published', 'publishing', 'remoteTrackMuted', 'streamingStatus', 'streaming', 'streamStarting'];\n //\n\n\n constructor() {\n let constructId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'reactooroom';\n let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n Object.assign(this, Object(_wt_emitter__WEBPACK_IMPORTED_MODULE_1__[\"default\"])());\n this.defaultDataChannelLabel = 'JanusDataChannel';\n this.server = null;\n this.iceServers = null;\n this.token = null;\n this.roomId = null;\n this.streamId = null;\n this.pin = null;\n this.userId = null;\n this.sessiontype = type;\n this.initialBitrate = 0;\n this.recordingFilename = null;\n this.pluginName = RoomSession.sessionTypes[type];\n this.options = options;\n this.id = null;\n this.privateId = null;\n this.constructId = constructId || RoomSession.randomString(16);\n this.sessionId = null;\n this.handleId = null;\n this.ws = null;\n this.isRestarting = false;\n this.isConnecting = false;\n this.isDisconnecting = false;\n this.isConnected = false;\n this.isPublished = false;\n this.isReclaiming = false;\n this.isStreaming = false;\n this._ipv6Support = false;\n this._retries = 0;\n this._maxRetries = 3;\n this._keepAliveId = null;\n this._participants = [];\n this._roomType = 'watchparty';\n this._isDataChannelOpen = false;\n this._abortController = null;\n this.isAudioMuted = false;\n this.isVideoMuted = false;\n this.isVideoEnabled = false;\n this.isAudioEnabed = false;\n this.isUnifiedPlan = RoomSession.checkUnifiedPlan();\n this.subscriptionRules = { ...RoomSession.subscriptionRules,\n ...(this.options.subscriptionRules || {})\n };\n this._log = RoomSession.noop;\n\n if (this.options.debug) {\n this._enableDebug();\n }\n } // Check if this browser supports Unified Plan and transceivers\n // Based on https://codepen.io/anon/pen/ZqLwWV?editors=0010\n\n\n static checkUnifiedPlan() {\n let unifiedPlan = false;\n\n if (webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__[\"default\"].browserDetails.browser === 'firefox' && webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__[\"default\"].browserDetails.version >= 59) {\n // Firefox definitely does, starting from version 59\n unifiedPlan = true;\n } else if (webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__[\"default\"].browserDetails.browser === 'chrome' && webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__[\"default\"].browserDetails.version >= 72) {\n // Chrome does, but it's only usable from version 72 on\n unifiedPlan = true;\n } else if (!window.RTCRtpTransceiver || !('currentDirection' in RTCRtpTransceiver.prototype)) {\n // Safari supports addTransceiver() but not Unified Plan when\n // currentDirection is not defined (see codepen above).\n unifiedPlan = false;\n } else {\n // Check if addTransceiver() throws an exception\n const tempPc = new RTCPeerConnection();\n\n try {\n tempPc.addTransceiver('audio');\n unifiedPlan = true;\n } catch (e) {}\n\n tempPc.close();\n }\n\n return unifiedPlan;\n }\n\n _participantShouldSubscribe(userId) {\n const myUser = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(this.display);\n const remoteUser = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(userId);\n let localUserRole = (myUser === null || myUser === void 0 ? void 0 : myUser.role) || 'participant';\n let remoteUserRole = (remoteUser === null || remoteUser === void 0 ? void 0 : remoteUser.role) || 'participant';\n return this.subscriptionRules[localUserRole][this._roomType || 'watchparty'].indexOf(remoteUserRole) > -1;\n }\n\n _getAddParticipantEventName(handleId) {\n var _decodeJanusDisplay;\n\n let handle = this._getHandle(handleId);\n\n if (!handle) {\n this.emit('error', {\n type: 'warning',\n id: 15,\n message: 'id non-existent',\n data: [handleId, 'getParticipantEventName']\n });\n }\n\n const participantRole = (_decodeJanusDisplay = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay === void 0 ? void 0 : _decodeJanusDisplay.role;\n\n switch (participantRole) {\n case 'participant':\n return 'addRemoteParticipant';\n\n case 'talkback':\n return 'addRemoteTalkback';\n\n case 'monitor':\n return 'addRemoteTalkback';\n\n case 'observer':\n case 'observerSolo1':\n case 'observerSolo2':\n case 'observerSolo3':\n return 'addRemoteObserver';\n\n case 'host':\n return 'addRemoteInstructor';\n\n case 'companionTV':\n return 'addRemoteCompanionTV';\n\n case 'companionPhone':\n return 'addRemoteCompanionPhone';\n\n default:\n return 'addRemoteParticipant';\n }\n }\n\n _getRemoveParticipantEventName(handleId) {\n var _decodeJanusDisplay2;\n\n let handle = this._getHandle(handleId);\n\n if (!handle) {\n this.emit('error', {\n type: 'warning',\n id: 15,\n message: 'id non-existent',\n data: [handleId, 'getParticipantEventName']\n });\n }\n\n const participantRole = (_decodeJanusDisplay2 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay2 === void 0 ? void 0 : _decodeJanusDisplay2.role;\n\n switch (participantRole) {\n case 'participant':\n return 'removeRemoteParticipant';\n\n case 'talkback':\n return 'removeRemoteTalkback';\n\n case 'monitor':\n return 'removeRemoteTalkback';\n\n case 'observer':\n case 'observerSolo1':\n case 'observerSolo2':\n case 'observerSolo3':\n return 'removeRemoteObserver';\n\n case 'host':\n return 'removeRemoteInstructor';\n\n case 'companionTV':\n return 'removeRemoteCompanionTV';\n\n case 'companionPhone':\n return 'removeRemoteCompanionPhone';\n\n default:\n return 'removeRemoteParticipant';\n }\n }\n\n sendMessage(handleId) {\n let message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n body: 'Example Body'\n };\n let dontWait = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n let dontResolveOnAck = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n return this._send({\n \"janus\": \"message\",\n \"handle_id\": handleId,\n ...message\n }, dontWait, dontResolveOnAck).then(json => {\n if (json && json[\"janus\"] === \"success\") {\n let plugindata = json[\"plugindata\"] || {};\n let data = plugindata[\"data\"];\n return Promise.resolve(data);\n }\n\n return Promise.resolve();\n }).catch(json => {\n if (json && json[\"error\"]) {\n return Promise.reject({\n type: 'warning',\n id: 1,\n message: 'sendMessage failed',\n data: json[\"error\"]\n });\n } else {\n return Promise.reject({\n type: 'warning',\n id: 1,\n message: 'sendMessage failed',\n data: json\n });\n }\n });\n }\n\n _send() {\n let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let ignoreResponse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n let dontResolveOnAck = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n let transaction = RoomSession.randomString(12);\n let requestData = { ...request,\n transaction,\n token: this.token,\n ...(this.sessionId && {\n 'session_id': this.sessionId\n } || {})\n };\n\n this._log(requestData);\n\n return new Promise((resolve, reject) => {\n let messageTimeoutId = null;\n\n let abortResponse = () => {\n this._abortController.signal.removeEventListener('abort', abortResponse);\n\n clearTimeout(messageTimeoutId);\n this.ws.removeEventListener('message', parseResponse);\n reject({\n type: 'warning',\n id: 17,\n message: 'connection cancelled'\n });\n };\n\n let parseResponse = event => {\n let json = JSON.parse(event.data);\n let r_transaction = json['transaction'];\n\n if (r_transaction === transaction && (!dontResolveOnAck || json['janus'] !== 'ack')) {\n clearTimeout(messageTimeoutId);\n\n this._abortController.signal.removeEventListener('abort', abortResponse);\n\n this.ws.removeEventListener('message', parseResponse);\n\n if (json['janus'] === 'error') {\n var _json$error;\n\n if ((json === null || json === void 0 ? void 0 : (_json$error = json.error) === null || _json$error === void 0 ? void 0 : _json$error.code) == 403) {\n this.disconnect(true);\n }\n\n reject({\n type: 'error',\n id: 2,\n message: 'send failed',\n data: json,\n requestData\n });\n } else {\n resolve(json);\n }\n }\n };\n\n if (ignoreResponse) {\n if (this.ws && this.ws.readyState === 1) {\n this.ws.send(JSON.stringify(requestData));\n }\n\n resolve();\n } else {\n if (this.ws && this.ws.readyState === 1) {\n this.ws.addEventListener('message', parseResponse);\n messageTimeoutId = setTimeout(() => {\n this.ws.removeEventListener('message', parseResponse);\n\n this._abortController.signal.removeEventListener('abort', abortResponse);\n\n reject({\n type: 'error',\n id: 3,\n message: 'send timeout',\n data: requestData\n });\n }, 10000);\n\n this._abortController.signal.addEventListener('abort', abortResponse);\n\n this.ws.send(JSON.stringify(requestData));\n } else {\n reject({\n type: 'warning',\n id: 29,\n message: 'No connection to WebSockets',\n data: requestData\n });\n }\n }\n });\n }\n\n _connectionClosed() {\n if (!this.isConnected || this.isConnecting || this.isDisconnecting) {\n return;\n }\n\n if (this._retries < this._maxRetries) {\n setTimeout(() => {\n this._retries++;\n\n this._reconnect().catch(e => {\n this.emit('error', e);\n });\n }, 3000 * this._retries);\n } else {\n if (this.sessiontype === 'reactooroom') {\n this.disconnect(true);\n } else if (this.sessiontype === 'streaming') {\n this.stopStream();\n }\n\n this.emit('error', {\n type: 'error',\n id: 4,\n message: 'Lost connection to WebSockets',\n data: null\n });\n }\n }\n\n _wipeListeners() {\n if (this.ws) {\n this.ws.removeEventListener('close', this.__connectionClosedBoundFn);\n this.ws.removeEventListener('message', this.__handleWsEventsBoundFn);\n }\n }\n\n _startKeepAlive() {\n this._send({\n \"janus\": \"keepalive\"\n }).then(json => {\n if (json[\"janus\"] !== 'ack') {\n this.emit('error', {\n type: 'warning',\n id: 5,\n message: 'keepalive response suspicious',\n data: json[\"janus\"]\n });\n }\n }).catch(e => {\n this.emit('error', {\n type: 'warning',\n id: 6,\n message: 'keepalive dead',\n data: e\n });\n\n this._connectionClosed();\n });\n\n this._keepAliveId = setTimeout(() => {\n this._startKeepAlive();\n }, 30000);\n }\n\n _stopKeepAlive() {\n clearTimeout(this._keepAliveId);\n }\n\n _handleWsEvents(event) {\n let json = JSON.parse(event.data);\n var sender = json[\"sender\"];\n var type = json[\"janus\"];\n\n let handle = this._getHandle(sender);\n\n if (!handle) {\n return;\n }\n\n if (type === \"trickle\") {\n let candidate = json[\"candidate\"];\n let config = handle.webrtcStuff;\n\n if (config.pc && config.remoteSdp) {\n if (!candidate || candidate.completed === true) {\n config.pc.addIceCandidate(null);\n } else {\n config.pc.addIceCandidate(candidate);\n }\n } else {\n if (!config.candidates) {\n config.candidates = [];\n }\n\n config.candidates.push(candidate);\n }\n } else if (type === \"webrtcup\") {//none universal\n } else if (type === \"hangup\") {\n this._log('hangup on', handle.handleId);\n\n this._removeParticipant(handle.handleId, null, false);\n } else if (type === \"detached\") {\n this._log('detached on', handle.handleId);\n\n this._removeParticipant(handle.handleId, null, true);\n } else if (type === \"media\") {\n this._log('Media event:', handle.handleId, json[\"type\"], json[\"receiving\"], json[\"mid\"]);\n } else if (type === \"slowlink\") {\n this._log('Slowlink', handle.handleId, json[\"uplink\"], json[\"lost\"], json[\"mid\"]);\n } else if (type === \"event\") {//none universal\n } else if (type === 'timeout') {\n this.ws.close(3504, \"Gateway timeout\");\n } else if (type === 'success' || type === 'error') {// we're capturing those elsewhere\n } else {\n this._log(\"Unknown event: \".concat(type, \" on session: \").concat(this.sessionId));\n } // LOCAL\n\n\n if (sender === this.handleId) {\n if (type === \"event\") {\n var plugindata = json[\"plugindata\"] || {};\n var msg = plugindata[\"data\"] || {};\n var jsep = json[\"jsep\"];\n let result = msg[\"result\"] || null;\n let event = msg[\"videoroom\"] || null;\n let list = msg[\"publishers\"] || {};\n let leaving = msg[\"leaving\"]; //let joining = msg[\"joining\"];\n\n let unpublished = msg[\"unpublished\"];\n let error = msg[\"error\"];\n\n if (event === \"joined\") {\n this.id = msg[\"id\"];\n this.privateId = msg[\"private_id\"];\n this.isConnected = true;\n this.emit('joined', true);\n\n this._log('We have successfully joined Room');\n\n for (let f in list) {\n let userId = list[f][\"display\"];\n let streams = list[f][\"streams\"] || [];\n let id = list[f][\"id\"];\n\n for (let i in streams) {\n streams[i][\"id\"] = id;\n streams[i][\"display\"] = userId;\n }\n\n this._log('Remote userId: ', userId);\n\n if (this._participantShouldSubscribe(userId)) {\n this._log('Creating user: ', userId);\n\n this._createParticipant(userId, id).then(handle => {\n return this.sendMessage(handle.handleId, {\n body: {\n \"request\": \"join\",\n \"room\": this.roomId,\n \"ptype\": \"subscriber\",\n \"feed\": id,\n \"private_id\": this.privateId,\n ...(this.webrtcVersion > 1000 ? {\n id: this.userId\n } : {}),\n pin: this.pin\n }\n });\n }).catch(err => {\n this.emit('error', err);\n });\n }\n }\n } else if (event === \"event\") {\n if (msg[\"streams\"] !== undefined && msg[\"streams\"] !== null) {\n this._log('Got my own streams back', msg[\"streams\"]);\n }\n\n for (let f in list) {\n let userId = list[f][\"display\"];\n let streams = list[f][\"streams\"] || [];\n let id = list[f][\"id\"];\n\n for (let i in streams) {\n streams[i][\"id\"] = id;\n streams[i][\"display\"] = userId;\n }\n\n this._log('Remote userId: ', userId);\n\n if (this._participantShouldSubscribe(userId)) {\n this._log('Creating user: ', userId);\n\n this._createParticipant(userId, id).then(handle => {\n return this.sendMessage(handle.handleId, {\n body: {\n \"request\": \"join\",\n \"room\": this.roomId,\n \"ptype\": \"subscriber\",\n \"feed\": id,\n \"private_id\": this.privateId,\n ...(this.webrtcVersion > 1000 ? {\n id: this.userId\n } : {}),\n pin: this.pin\n }\n });\n }).catch(err => {\n this.emit('error', err);\n });\n }\n }\n\n if (leaving === 'ok') {\n this._log('leaving', this.handleId, 'this is us');\n\n this._removeParticipant(this.handleId);\n\n if (msg['reason'] === 'kicked') {\n this.emit('kicked');\n this.disconnect().catch(() => {});\n }\n } else if (leaving) {\n this._log('leaving', leaving);\n\n this._removeParticipant(null, leaving);\n }\n\n if (unpublished === 'ok') {\n this._log('unpublished', this.handleId, 'this is us');\n\n this._removeParticipant(this.handleId, null, false); // we do just hangup\n\n } else if (unpublished) {\n this._log('unpublished', unpublished);\n\n this._removeParticipant(null, unpublished, true); // we do hangup and detach\n\n }\n\n if (error) {\n this.emit('error', {\n type: 'error',\n id: 7,\n message: 'local participant error',\n data: [sender, msg]\n });\n }\n } // Streaming related\n else if (result && result[\"status\"]) {\n this.emit('streamingStatus', result[\"status\"]);\n\n if (result[\"status\"] === 'stopped') {\n this.stopStream();\n }\n\n if (result[\"status\"] === 'started') {\n this.emit('streaming', true);\n this.isStreaming = true;\n }\n }\n\n if (jsep !== undefined && jsep !== null) {\n if (this.sessiontype === 'reactooroom') {\n this._webrtcPeer(this.handleId, jsep).catch(err => {\n this.emit('error', err);\n });\n } else if (this.sessiontype === 'streaming') {\n this._publishRemote(this.handleId, jsep).catch(err => {\n this.emit('error', err);\n });\n }\n }\n } else if (type === \"webrtcup\") {\n this._log('Configuring bitrate: ' + this.initialBitrate);\n\n if (this.initialBitrate > 0) {\n this.sendMessage(this.handleId, {\n \"body\": {\n \"request\": \"configure\",\n \"bitrate\": this.initialBitrate\n }\n }).catch(() => null);\n }\n }\n } //REMOTE\n else {\n let plugindata = json[\"plugindata\"] || {};\n let msg = plugindata[\"data\"] || {};\n let jsep = json[\"jsep\"];\n let event = msg[\"videoroom\"];\n let error = msg[\"error\"];\n\n if (event === \"attached\") {\n var _decodeJanusDisplay3, _decodeJanusDisplay4;\n\n this._log('Remote have successfully joined Room', msg);\n\n this.emit(this._getAddParticipantEventName(handle.handleId), {\n tid: Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"generateUUID\"])(),\n id: handle.handleId,\n userId: (_decodeJanusDisplay3 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay3 === void 0 ? void 0 : _decodeJanusDisplay3.userId,\n role: (_decodeJanusDisplay4 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay4 === void 0 ? void 0 : _decodeJanusDisplay4.role,\n stream: null,\n track: null,\n adding: false,\n constructId: this.constructId,\n metaData: this.options.metaData,\n hasAudioTrack: false,\n hasVideoTrack: false\n });\n }\n\n if (error) {\n this.emit('error', {\n type: 'warning',\n id: 8,\n message: 'remote participant error',\n data: [sender, msg]\n });\n }\n\n if (jsep) {\n this._publishRemote(handle.handleId, jsep).catch(err => {\n this.emit('error', err);\n });\n }\n }\n }\n\n _handleDataEvents(handleId, type, data) {\n let handle = this._getHandle(handleId);\n\n if (type === 'state') {\n this._log(\" - Data channel status - \", \"UID: \".concat(handleId), \"STATUS: \".concat(JSON.stringify(data)), \"ME: \".concat(handleId === this.handleId));\n\n if (handle) {\n let config = handle.webrtcStuff;\n config.dataChannelOpen = this.defaultDataChannelLabel === (data === null || data === void 0 ? void 0 : data.label) && (data === null || data === void 0 ? void 0 : data.state) === 'open';\n }\n\n if (handleId === this.handleId && this.defaultDataChannelLabel === (data === null || data === void 0 ? void 0 : data.label)) {\n this._isDataChannelOpen = (data === null || data === void 0 ? void 0 : data.state) === 'open';\n this.emit('dataChannel', (data === null || data === void 0 ? void 0 : data.state) === 'open');\n }\n }\n\n if (type === 'error') {\n this.emit('error', {\n type: 'warning',\n id: 9,\n message: 'data event warning',\n data: [handleId, data]\n });\n\n if (handle) {\n let config = handle.webrtcStuff;\n\n if (this.defaultDataChannelLabel === data.label) {\n config.dataChannelOpen = false;\n }\n }\n\n if (handleId === this.handleId && this.defaultDataChannelLabel === data.label) {\n this._isDataChannelOpen = false;\n this.emit('dataChannel', false);\n }\n }\n\n if (handleId === this.handleId && type === 'message') {\n let d = null;\n\n try {\n d = JSON.parse(data);\n } catch (e) {\n this.emit('error', {\n type: 'warning',\n id: 10,\n message: 'data message parse error',\n data: [handleId, e]\n });\n return;\n }\n\n this.emit('data', d);\n }\n } //removeHandle === true -> hangup, detach, removeHandle === false -> hangup\n\n\n _removeParticipant(handleId, rfid) {\n let removeHandle = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n\n let handle = this._getHandle(handleId, rfid);\n\n if (!handle) {\n return Promise.resolve();\n } else {\n handleId = handle.handleId;\n }\n\n return this._send({\n \"janus\": \"hangup\",\n \"handle_id\": handleId\n }, true).then(() => removeHandle ? this._send({\n \"janus\": \"detach\",\n \"handle_id\": handleId\n }, true) : Promise.resolve()).finally(() => {\n try {\n if (handle.webrtcStuff.stream && !this.isRestarting) {\n handle.webrtcStuff.stream.getTracks().forEach(track => track.stop());\n }\n } catch (e) {// Do nothing\n }\n\n handle.webrtcStuff.stream = null;\n\n if (handle.webrtcStuff.dataChannel) {\n Object.keys(handle.webrtcStuff.dataChannel).forEach(label => {\n handle.webrtcStuff.dataChannel[label].onmessage = null;\n handle.webrtcStuff.dataChannel[label].onopen = null;\n handle.webrtcStuff.dataChannel[label].onclose = null;\n handle.webrtcStuff.dataChannel[label].onerror = null;\n });\n }\n\n if (handle.webrtcStuff.pc) {\n handle.webrtcStuff.pc.onicecandidate = null;\n handle.webrtcStuff.pc.ontrack = null;\n handle.webrtcStuff.pc.ondatachannel = null;\n handle.webrtcStuff.pc.onconnectionstatechange = null;\n handle.webrtcStuff.pc.oniceconnectionstatechange = null;\n }\n\n try {\n handle.webrtcStuff.pc.close();\n } catch (e) {}\n\n handle.webrtcStuff = {\n stream: null,\n mySdp: null,\n mediaConstraints: null,\n pc: null,\n dataChannelOpen: false,\n dataChannel: null,\n dtmfSender: null,\n trickle: true,\n iceDone: false\n };\n\n if (handleId === this.handleId) {\n var _decodeJanusDisplay5, _decodeJanusDisplay6;\n\n this._isDataChannelOpen = false;\n this.isPublished = false;\n this.emit('published', {\n status: false,\n hasStream: false\n });\n this.emit('removeLocalParticipant', {\n id: handleId,\n userId: (_decodeJanusDisplay5 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay5 === void 0 ? void 0 : _decodeJanusDisplay5.userId,\n role: (_decodeJanusDisplay6 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay6 === void 0 ? void 0 : _decodeJanusDisplay6.role\n });\n } else {\n var _decodeJanusDisplay7, _decodeJanusDisplay8;\n\n this.emit(this._getRemoveParticipantEventName(handleId), {\n id: handleId,\n userId: (_decodeJanusDisplay7 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay7 === void 0 ? void 0 : _decodeJanusDisplay7.userId,\n role: (_decodeJanusDisplay8 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay8 === void 0 ? void 0 : _decodeJanusDisplay8.role\n });\n }\n\n if (removeHandle) {\n let handleIndex = this._participants.findIndex(p => p.handleId === handleId);\n\n this._participants.splice(handleIndex, 1);\n }\n\n return true;\n });\n }\n\n _createParticipant() {\n let userId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n let rfid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n return this._send({\n \"janus\": \"attach\",\n \"plugin\": this.pluginName\n }).then(json => {\n let handleId = json.data[\"id\"];\n let handle = {\n handleId,\n rfid,\n userId,\n webrtcStuff: {\n stream: null,\n mySdp: null,\n mediaConstraints: null,\n pc: null,\n dataChannelOpen: false,\n dataChannel: null,\n dtmfSender: null,\n trickle: true,\n iceDone: false,\n isIceRestarting: false\n }\n };\n\n this._participants.push(handle);\n\n return handle;\n });\n }\n\n _joinRoom(roomId, pin, userId, display) {\n return this.sendMessage(this.handleId, {\n body: {\n \"request\": \"join\",\n \"room\": roomId,\n \"pin\": pin,\n \"ptype\": \"publisher\",\n \"display\": display,\n ...(this.webrtcVersion > 1000 ? {\n id: userId\n } : {})\n }\n }, false, true);\n }\n\n _watchStream(id) {\n return this.sendMessage(this.handleId, {\n body: {\n \"request\": \"watch\",\n id: parseInt(id)\n }\n }, false, true);\n }\n\n _leaveRoom() {\n let dontWait = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n return this.isConnected ? this.sendMessage(this.handleId, {\n body: {\n \"request\": \"leave\"\n }\n }, dontWait).finally(() => {\n this.isConnected = false;\n this.emit('joined', false);\n }) : Promise.resolve();\n } // internal reconnect\n\n\n _reconnect() {\n if (this.isReclaiming) {\n return Promise.resolve();\n }\n\n if (this.ws) {\n this._wipeListeners();\n\n if (this.ws.readyState === 1) {\n this.ws.close();\n }\n }\n\n this._stopKeepAlive();\n\n this.isReclaiming = true;\n this.emit('joining', true);\n return new Promise((resolve, reject) => {\n let abortReconnect = () => {\n this._abortController.signal.removeEventListener('abort', abortReconnect);\n\n this.ws.removeEventListener('close', this.__connectionClosedBoundFn);\n this.ws.removeEventListener('message', this.__handleWsEventsBoundFn);\n this.ws.onopen = null;\n this.ws.onerror = null;\n this.isReclaiming = false;\n this.emit('joining', false);\n reject({\n type: 'warning',\n id: 17,\n message: 'Connection cancelled',\n data: e\n });\n };\n\n this.ws = new WebSocket(this.server, 'janus-protocol');\n this.__connectionClosedBoundFn = this._connectionClosed.bind(this);\n this.__handleWsEventsBoundFn = this._handleWsEvents.bind(this);\n this.ws.addEventListener('close', this.__connectionClosedBoundFn);\n this.ws.addEventListener('message', this.__handleWsEventsBoundFn);\n\n this.ws.onopen = () => {\n this._abortController.signal.removeEventListener('abort', abortReconnect);\n\n this._send({\n \"janus\": \"claim\"\n }).then(json => {\n this.sessionId = json[\"session_id\"] ? json[\"session_id\"] : json.data[\"id\"];\n\n this._startKeepAlive();\n\n this.isReclaiming = false;\n this.emit('joining', false);\n this._retries = 0;\n resolve(json);\n }).catch(error => {\n this.isReclaiming = false;\n this.emit('joining', false);\n reject({\n type: 'error',\n id: 11,\n message: 'reconnection error',\n data: error\n });\n });\n }; // this is called before 'close' event callback so it doesn't break reconnect loop\n\n\n this.ws.onerror = e => {\n this._abortController.signal.removeEventListener('abort', abortReconnect);\n\n this.isReclaiming = false;\n this.emit('joining', false);\n reject({\n type: 'warning',\n id: 12,\n message: 'ws reconnection error',\n data: e\n });\n };\n\n this._abortController.signal.addEventListener('abort', abortReconnect);\n });\n }\n\n connect(roomId, pin, server, iceServers, token, display, userId) {\n let webrtcVersion = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 0;\n let initialBitrate = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 0;\n let recordingFilename = arguments.length > 9 ? arguments[9] : undefined;\n\n if (this.isConnecting) {\n return Promise.reject({\n type: 'warning',\n id: 16,\n message: 'connection already in progress'\n });\n }\n\n if (this.ws) {\n this._wipeListeners();\n }\n\n this._stopKeepAlive();\n\n this._abortController = new AbortController();\n this.sessionId = null;\n this.server = server;\n this.iceServers = iceServers;\n this.token = token;\n this.roomId = roomId;\n this.pin = pin;\n this.display = display;\n this.userId = userId;\n this.webrtcVersion = webrtcVersion;\n this.initialBitrate = initialBitrate;\n this.recordingFilename = recordingFilename;\n this.isConnecting = true;\n this.emit('joining', true);\n return new Promise((resolve, reject) => {\n this.ws = new WebSocket(this.server, 'janus-protocol');\n this.__connectionClosedBoundFn = this._connectionClosed.bind(this);\n this.__handleWsEventsBoundFn = this._handleWsEvents.bind(this);\n\n let abortConnect = () => {\n this._abortController.signal.removeEventListener('abort', abortConnect);\n\n this.ws.removeEventListener('close', this.__connectionClosedBoundFn);\n this.ws.removeEventListener('message', this.__handleWsEventsBoundFn);\n this.ws.onopen = null;\n this.ws.onerror = null;\n this.isConnecting = false;\n this.emit('joining', false);\n reject({\n type: 'warning',\n id: 17,\n message: 'Connection cancelled'\n });\n };\n\n this.ws.addEventListener('close', this.__connectionClosedBoundFn);\n this.ws.addEventListener('message', this.__handleWsEventsBoundFn);\n\n this.ws.onopen = () => {\n this._abortController.signal.removeEventListener('abort', abortConnect);\n\n this._retries = 0;\n\n this._send({\n \"janus\": \"create\"\n }).then(json => {\n this.sessionId = json[\"session_id\"] ? json[\"session_id\"] : json.data[\"id\"];\n\n this._startKeepAlive();\n\n return 1;\n }).then(() => this._createParticipant(userId)).then(handle => {\n this.handleId = handle.handleId;\n return 1;\n }).then(() => this._joinRoom(roomId, pin, userId, display)).then(() => {\n this.isConnecting = false;\n this.emit('joining', false);\n resolve(this);\n }).catch(error => {\n this.isConnecting = false;\n this.emit('joining', false);\n reject({\n type: (error === null || error === void 0 ? void 0 : error.type) === 'warning' ? 'warning' : 'error',\n id: 13,\n message: 'connection error',\n data: error\n });\n });\n };\n\n this.ws.onerror = e => {\n this._abortController.signal.removeEventListener('abort', abortConnect);\n\n this.isConnecting = false;\n this.emit('joining', false);\n reject({\n type: 'error',\n id: 14,\n message: 'ws connection error',\n data: e\n });\n };\n\n this._abortController.signal.addEventListener('abort', abortConnect);\n });\n }\n\n disconnect() {\n var _this$_abortControlle, _this$_abortControlle2;\n\n if (this.isDisconnecting) {\n return Promise.resolve();\n }\n\n (_this$_abortControlle = this._abortController) === null || _this$_abortControlle === void 0 ? void 0 : (_this$_abortControlle2 = _this$_abortControlle.abort) === null || _this$_abortControlle2 === void 0 ? void 0 : _this$_abortControlle2.call(_this$_abortControlle);\n\n this._stopKeepAlive();\n\n let isConnected = this.isConnected;\n this.isDisconnecting = true;\n return Promise.all(this._participants.map(p => this._removeParticipant(p.handleId))).finally(() => {\n this._wipeListeners();\n\n if (this.ws && this.ws.readyState === 1) {\n this._send({\n \"janus\": \"destroy\"\n }, true);\n\n this.ws.close();\n }\n\n this.sessionId = null;\n this.isPublished = false;\n this.isConnected = false;\n this.isDisconnecting = false;\n this.emit('publishing', false);\n this.emit('published', {\n status: false,\n hasStream: false\n });\n this.emit('joining', false);\n this.emit('joined', false);\n this.emit('disconnect', isConnected);\n return Promise.resolve('Disconnected');\n });\n }\n\n startStream(streamId, server, iceServers, token, userId) {\n if (this.isConnecting) {\n return Promise.reject({\n type: 'warning',\n id: 16,\n message: 'connection error',\n data: 'Connection is in progress'\n });\n }\n\n if (this.ws) {\n this._wipeListeners();\n }\n\n this._stopKeepAlive();\n\n this._abortController = new AbortController();\n this.server = server;\n this.iceServers = iceServers;\n this.token = token;\n this.streamId = streamId;\n this.userId = userId;\n this.sessionId = null;\n this.isConnecting = true;\n this.emit('streamStarting', true);\n return new Promise((resolve, reject) => {\n this.ws = new WebSocket(this.server, 'janus-protocol');\n this.__connectionClosedBoundFn = this._connectionClosed.bind(this);\n this.__handleWsEventsBoundFn = this._handleWsEvents.bind(this);\n\n let abortConnect = () => {\n this._abortController.signal.removeEventListener('abort', abortConnect);\n\n this.ws.removeEventListener('close', this.__connectionClosedBoundFn);\n this.ws.removeEventListener('message', this.__handleWsEventsBoundFn);\n this.ws.onopen = null;\n this.ws.onerror = null;\n this.isConnecting = false;\n this.emit('streamStarting', false);\n reject({\n type: 'warning',\n id: 17,\n message: 'Connection cancelled'\n });\n };\n\n this.ws.addEventListener('close', this.__connectionClosedBoundFn);\n this.ws.addEventListener('message', this.__handleWsEventsBoundFn);\n\n this.ws.onopen = () => {\n this._abortController.signal.removeEventListener('abort', abortConnect);\n\n this._retries = 0;\n\n this._send({\n \"janus\": \"create\"\n }).then(json => {\n this.sessionId = json[\"session_id\"] ? json[\"session_id\"] : json.data[\"id\"];\n\n this._startKeepAlive();\n\n return 1;\n }).then(() => this._createParticipant(userId)).then(handle => {\n this.handleId = handle.handleId;\n return 1;\n }).then(() => this._watchStream(streamId)).then(() => {\n this.isConnecting = false;\n this.emit('streamStarting', false);\n resolve(this);\n }).catch(error => {\n this.isConnecting = false;\n this.emit('streamStarting', false);\n reject({\n type: 'error',\n id: 13,\n message: 'connection error',\n data: error\n });\n });\n };\n\n this.ws.onerror = e => {\n this._abortController.signal.removeEventListener('abort', abortConnect);\n\n this.isConnecting = false;\n this.emit('streamStarting', false);\n reject({\n type: 'error',\n id: 14,\n message: 'ws connection error',\n data: e\n });\n };\n\n this._abortController.signal.addEventListener('abort', abortConnect);\n });\n }\n\n stopStream() {\n var _this$_abortControlle3, _this$_abortControlle4;\n\n if (this.isDisconnecting) {\n return Promise.resolve();\n }\n\n (_this$_abortControlle3 = this._abortController) === null || _this$_abortControlle3 === void 0 ? void 0 : (_this$_abortControlle4 = _this$_abortControlle3.abort) === null || _this$_abortControlle4 === void 0 ? void 0 : _this$_abortControlle4.call(_this$_abortControlle3);\n\n this._stopKeepAlive();\n\n let isStreaming = this.isStreaming;\n this.isDisconnecting = true;\n return this.sendMessage(this.handleId, {\n body: {\n \"request\": \"stop\"\n }\n }, false, true).then(() => this._removeParticipant(this.handleId)).finally(() => {\n this._wipeListeners();\n\n this._send({\n \"janus\": \"destroy\"\n }, true);\n\n if (this.ws && this.ws.readyState === 1) {\n this.ws.close();\n }\n\n this.sessionId = null;\n this.isDisconnecting = false;\n this.isStreaming = false;\n this.emit('streamStarting', false);\n this.emit('streaming', false);\n this.emit('disconnect', isStreaming);\n return Promise.resolve('Disconnected');\n });\n }\n\n destroy() {\n if (this.sessiontype === 'reactooroom') {\n return this.disconnect().then(() => {\n this.clear();\n return true;\n });\n } else if (this.sessiontype === 'streaming') {\n return this.stopStream().then(() => {\n this.clear();\n return true;\n });\n }\n }\n\n _enableDebug() {\n this._log = console.log.bind(console);\n }\n\n _getHandle(handleId) {\n let rfid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n return this._participants.find(p => p.handleId === handleId || rfid && p.rfid === rfid);\n }\n\n _getStats() {\n let type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n return Promise.all(this._participants.map(participant => {\n let mediaTrack = null;\n\n if (type === 'video') {\n mediaTrack = participant.webrtcStuff && participant.webrtcStuff.stream && participant.webrtcStuff.stream.getVideoTracks().length && participant.webrtcStuff.stream.getVideoTracks()[0];\n } else if (type === 'audio') {\n mediaTrack = participant.webrtcStuff && participant.webrtcStuff.stream && participant.webrtcStuff.stream.getAudioTracks().length && participant.webrtcStuff.stream.getAudioTracks()[0];\n }\n\n return participant.webrtcStuff && participant.webrtcStuff.pc && participant.webrtcStuff.pc.getStats(mediaTrack).then(r => ({\n handle: participant,\n stats: r\n })).catch(e => Promise.resolve({\n handle: participant,\n stats: e\n }));\n }));\n }\n\n _sendTrickleCandidate(handleId, candidate) {\n return this._send({\n \"janus\": \"trickle\",\n \"candidate\": candidate,\n \"handle_id\": handleId\n });\n }\n\n _webrtc(handleId) {\n let enableOntrack = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n let handle = this._getHandle(handleId);\n\n if (!handle) {\n this.emit('error', {\n type: 'warning',\n id: 15,\n message: 'id non-existent',\n data: [handleId, 'create rtc connection']\n });\n }\n\n let config = handle.webrtcStuff;\n\n if (!config.pc) {\n let pc_config = {\n \"iceServers\": this.iceServers,\n \"iceTransportPolicy\": 'all',\n \"bundlePolicy\": undefined\n };\n pc_config[\"sdpSemantics\"] = this.isUnifiedPlan ? \"unified-plan\" : \"plan-b\";\n let pc_constraints = {\n \"optional\": [{\n \"DtlsSrtpKeyAgreement\": true\n }]\n };\n\n if (this._ipv6Support === true) {\n pc_constraints.optional.push({\n \"googIPv6\": true\n });\n }\n\n if (webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__[\"default\"].browserDetails.browser === \"edge\") {\n // This is Edge, enable BUNDLE explicitly\n pc_config.bundlePolicy = \"max-bundle\";\n }\n\n this._log('new RTCPeerConnection', pc_config, pc_constraints);\n\n config.pc = new RTCPeerConnection(pc_config, pc_constraints);\n\n config.pc.onconnectionstatechange = () => {\n if (config.pc.connectionState === 'failed') {\n this._iceRestart(handleId);\n }\n\n this.emit('connectionState', [handleId, handleId === this.handleId, config.pc.connectionState]);\n\n if (handleId !== this.handleId && config.pc.connectionState === 'connected') {\n var _decodeJanusDisplay9, _decodeJanusDisplay10;\n\n this.emit(this._getAddParticipantEventName(handle.handleId), {\n tid: Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"generateUUID\"])(),\n id: handle.handleId,\n userId: (_decodeJanusDisplay9 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay9 === void 0 ? void 0 : _decodeJanusDisplay9.userId,\n role: (_decodeJanusDisplay10 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay10 === void 0 ? void 0 : _decodeJanusDisplay10.role,\n stream: config.stream,\n track: null,\n optional: true,\n constructId: this.constructId,\n metaData: this.options.metaData,\n adding: false,\n hasAudioTrack: !!(config.stream && config.stream.getAudioTracks().length),\n hasVideoTrack: !!(config.stream && config.stream.getVideoTracks().length)\n });\n }\n };\n\n config.pc.oniceconnectionstatechange = () => {\n if (config.pc.iceConnectionState === 'failed') {\n this._iceRestart(handleId);\n }\n\n this.emit('iceState', [handleId, handleId === this.handleId, config.pc.iceConnectionState]);\n\n if (handleId !== this.handleId && (config.pc.iceConnectionState === 'completed' || config.pc.iceConnectionState === 'connected')) {\n var _decodeJanusDisplay11, _decodeJanusDisplay12;\n\n this.emit(this._getAddParticipantEventName(handle.handleId), {\n tid: Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"generateUUID\"])(),\n id: handle.handleId,\n userId: (_decodeJanusDisplay11 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay11 === void 0 ? void 0 : _decodeJanusDisplay11.userId,\n role: (_decodeJanusDisplay12 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay12 === void 0 ? void 0 : _decodeJanusDisplay12.role,\n stream: config.stream,\n track: null,\n optional: true,\n constructId: this.constructId,\n metaData: this.options.metaData,\n adding: false,\n hasAudioTrack: !!(config.stream && config.stream.getAudioTracks().length),\n hasVideoTrack: !!(config.stream && config.stream.getVideoTracks().length)\n });\n }\n };\n\n config.pc.onicecandidate = event => {\n if (event.candidate == null || webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__[\"default\"].browserDetails.browser === 'edge' && event.candidate.candidate.indexOf('endOfCandidates') > 0) {\n config.iceDone = true;\n\n this._sendTrickleCandidate(handleId, {\n \"completed\": true\n }).catch(e => {\n this.emit('error', e);\n });\n } else {\n // JSON.stringify doesn't work on some WebRTC objects anymore\n // See https://code.google.com/p/chromium/issues/detail?id=467366\n var candidate = {\n \"candidate\": event.candidate.candidate,\n \"sdpMid\": event.candidate.sdpMid,\n \"sdpMLineIndex\": event.candidate.sdpMLineIndex\n };\n\n this._sendTrickleCandidate(handleId, candidate).catch(e => {\n this.emit('error', e);\n });\n }\n };\n\n if (enableOntrack) {\n config.pc.ontrack = event => {\n if (!event.streams) return; //config.stream = event.streams[0];\n\n if (!config.stream) {\n config.stream = new MediaStream();\n }\n\n if (event.track) {\n var _decodeJanusDisplay13, _decodeJanusDisplay14;\n\n let mid = event.transceiver ? event.transceiver.mid : event.track.id;\n config.stream.addTrack(event.track);\n this.emit(this._getAddParticipantEventName(handle.handleId), {\n tid: Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"generateUUID\"])(),\n mid,\n id: handle.handleId,\n userId: (_decodeJanusDisplay13 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay13 === void 0 ? void 0 : _decodeJanusDisplay13.userId,\n role: (_decodeJanusDisplay14 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay14 === void 0 ? void 0 : _decodeJanusDisplay14.role,\n stream: config.stream,\n track: event.track,\n constructId: this.constructId,\n metaData: this.options.metaData,\n adding: true,\n hasAudioTrack: !!(config.stream && config.stream.getAudioTracks().length),\n hasVideoTrack: !!(config.stream && config.stream.getVideoTracks().length)\n });\n if (event.track.onended) return;\n\n event.track.onended = ev => {\n let mid = ev.target.id;\n\n if (this.isUnifiedPlan) {\n let transceiver = config.pc.getTransceivers().find(t => t.receiver.track === ev.target);\n mid = transceiver.mid;\n }\n\n if (config.stream) {\n var _decodeJanusDisplay15, _decodeJanusDisplay16;\n\n config.stream && config.stream.removeTrack(ev.target);\n this.emit(this._getAddParticipantEventName(handle.handleId), {\n tid: Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"generateUUID\"])(),\n id: handle.handleId,\n mid,\n userId: (_decodeJanusDisplay15 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay15 === void 0 ? void 0 : _decodeJanusDisplay15.userId,\n role: (_decodeJanusDisplay16 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay16 === void 0 ? void 0 : _decodeJanusDisplay16.role,\n stream: config.stream,\n track: ev.target,\n constructId: this.constructId,\n metaData: this.options.metaData,\n adding: false,\n removing: true,\n hasAudioTrack: !!(config.stream && config.stream.getAudioTracks().length),\n hasVideoTrack: !!(config.stream && config.stream.getVideoTracks().length)\n });\n }\n };\n\n event.track.onmute = ev => {\n var _decodeJanusDisplay17, _decodeJanusDisplay18;\n\n this._log('remoteTrackMuted', 'onmute');\n\n let mid = ev.target.id;\n\n if (this.isUnifiedPlan) {\n let transceiver = config.pc.getTransceivers().find(t => t.receiver.track === ev.target);\n mid = transceiver.mid;\n }\n\n this.emit('remoteTrackMuted', {\n id: handle.handleId,\n mid,\n userId: (_decodeJanusDisplay17 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay17 === void 0 ? void 0 : _decodeJanusDisplay17.userId,\n role: (_decodeJanusDisplay18 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay18 === void 0 ? void 0 : _decodeJanusDisplay18.role,\n stream: config.stream,\n kind: ev.target.kind,\n track: ev.target,\n muted: true\n });\n };\n\n event.track.onunmute = ev => {\n var _decodeJanusDisplay19, _decodeJanusDisplay20;\n\n this._log('remoteTrackMuted', 'onunmute');\n\n let mid = ev.target.id;\n\n if (this.isUnifiedPlan) {\n let transceiver = config.pc.getTransceivers().find(t => t.receiver.track === ev.target);\n mid = transceiver.mid;\n }\n\n this.emit('remoteTrackMuted', {\n id: handle.handleId,\n mid,\n userId: (_decodeJanusDisplay19 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay19 === void 0 ? void 0 : _decodeJanusDisplay19.userId,\n role: (_decodeJanusDisplay20 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay20 === void 0 ? void 0 : _decodeJanusDisplay20.role,\n stream: config.stream,\n kind: ev.target.kind,\n track: ev.target,\n muted: false\n });\n };\n }\n };\n }\n }\n\n if (!config.dataChannel || !config.dataChannelOpen) {\n config.dataChannel = {};\n\n var onDataChannelMessage = event => {\n this._handleDataEvents(handleId, 'message', event.data);\n };\n\n var onDataChannelStateChange = event => {\n let label = event.target.label;\n let protocol = event.target.protocol;\n let state = config.dataChannel[label] ? config.dataChannel[label].readyState : \"null\";\n\n this._handleDataEvents(handleId, 'state', {\n state,\n label\n });\n }; //TODO: check this\n\n\n var onDataChannelError = error => {\n var _error$channel;\n\n this._handleDataEvents(handleId, 'error', {\n label: error === null || error === void 0 ? void 0 : (_error$channel = error.channel) === null || _error$channel === void 0 ? void 0 : _error$channel.label,\n error\n });\n };\n\n const createDataChannel = (label, protocol, incoming) => {\n let options = {\n ordered: true\n };\n\n if (!incoming) {\n if (protocol) {\n options = { ...options,\n protocol\n };\n }\n\n config.dataChannel[label] = config.pc.createDataChannel(label, options);\n } else {\n config.dataChannel[label] = incoming;\n }\n\n config.dataChannel[label].onmessage = onDataChannelMessage;\n config.dataChannel[label].onopen = onDataChannelStateChange;\n config.dataChannel[label].onclose = onDataChannelStateChange;\n config.dataChannel[label].onerror = onDataChannelError;\n };\n\n createDataChannel(this.defaultDataChannelLabel, null, null);\n\n config.pc.ondatachannel = function (event) {\n createDataChannel(event.channel.label, event.channel.protocol, event.channel);\n };\n }\n }\n\n _webrtcPeer(handleId, jsep) {\n let handle = this._getHandle(handleId);\n\n if (!handle) {\n return Promise.reject({\n type: 'warning',\n id: 15,\n message: 'id non-existent',\n data: [handleId, 'rtc peer']\n });\n }\n\n var config = handle.webrtcStuff;\n\n if (jsep !== undefined && jsep !== null) {\n if (config.pc === null) {\n this._log(\"No PeerConnection: if this is an answer, use createAnswer and not _webrtcPeer\");\n\n return Promise.resolve(null);\n }\n\n return config.pc.setRemoteDescription(jsep).then(() => {\n config.remoteSdp = jsep.sdp; // Any trickle candidate we cached?\n\n if (config.candidates && config.candidates.length > 0) {\n for (var i = 0; i < config.candidates.length; i++) {\n var candidate = config.candidates[i];\n\n if (!candidate || candidate.completed === true) {\n config.pc.addIceCandidate(null);\n } else {\n config.pc.addIceCandidate(candidate);\n }\n }\n\n config.candidates = [];\n } // Done\n\n\n return true;\n });\n } else {\n return Promise.reject({\n type: 'warning',\n id: 22,\n message: 'rtc peer',\n data: [handleId, 'invalid jsep']\n });\n }\n }\n\n _iceRestart(handleId) {\n let handle = this._getHandle(handleId);\n\n if (!handle) {\n return;\n }\n\n var config = handle.webrtcStuff; // Already restarting;\n\n if (config.isIceRestarting) {\n return;\n }\n\n if (this.handleId === handleId) {\n this._log('Performing local ICE restart');\n\n config.isIceRestarting = true;\n let hasAudio = !!(config.stream && config.stream.getAudioTracks().length > 0);\n let hasVideo = !!(config.stream && config.stream.getVideoTracks().length > 0);\n\n this._createAO('offer', handleId, true, [hasAudio, false, hasVideo, false]).then(jsep => {\n if (!jsep) {\n return null;\n }\n\n return this.sendMessage(handleId, {\n body: {\n \"request\": \"configure\",\n \"audio\": hasAudio,\n \"video\": hasVideo,\n \"data\": true,\n ...(this.recordingFilename ? {\n filename: this.recordingFilename\n } : {})\n },\n jsep\n });\n }).then(r => {\n config.isIceRestarting = false;\n\n this._log('ICE restart success');\n }).catch(e => {\n config.isIceRestarting = false;\n this.emit('warning', {\n type: 'error',\n id: 28,\n message: 'iceRestart failed',\n data: e\n });\n });\n } else {\n this._log('Performing remote ICE restart', handleId);\n\n config.isIceRestarting = true;\n return this.sendMessage(handleId, {\n body: {\n \"request\": \"configure\",\n \"restart\": true\n }\n }).then(() => {\n config.isIceRestarting = false;\n }).catch(() => {\n config.isIceRestarting = false;\n });\n }\n }\n\n _createAO() {\n let type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'offer';\n let handleId = arguments.length > 1 ? arguments[1] : undefined;\n let iceRestart = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n let [audioSend, audioRecv, videoSend, videoRecv] = arguments.length > 3 ? arguments[3] : undefined;\n\n let handle = this._getHandle(handleId);\n\n if (!handle) {\n return Promise.reject({\n type: 'warning',\n id: 15,\n message: 'id non-existent',\n data: [handleId, 'createAO', type]\n });\n }\n\n let methodName = null;\n\n if (type === 'offer') {\n methodName = 'createOffer';\n } else {\n methodName = 'createAnswer';\n }\n\n var config = handle.webrtcStuff; // https://code.google.com/p/webrtc/issues/detail?id=3508\n\n var mediaConstraints = {};\n\n if (this.isUnifiedPlan) {\n var audioTransceiver = null,\n videoTransceiver = null;\n var transceivers = config.pc.getTransceivers();\n\n if (transceivers && transceivers.length > 0) {\n for (var i in transceivers) {\n var t = transceivers[i];\n\n if (t.sender && t.sender.track && t.sender.track.kind === \"audio\" && t.stopped === false || t.receiver && t.receiver.track && t.receiver.track.kind === \"audio\" && t.stopped === false) {\n if (!audioTransceiver) audioTransceiver = t;\n continue;\n }\n\n if (t.sender && t.sender.track && t.sender.track.kind === \"video\" && t.stopped === false || t.receiver && t.receiver.track && t.receiver.track.kind === \"video\" && t.stopped === false) {\n if (!videoTransceiver) videoTransceiver = t;\n continue;\n }\n }\n } // Handle audio (and related changes, if any)\n\n\n if (!audioSend && !audioRecv) {\n // Audio disabled: have we removed it?\n if (audioTransceiver) {\n if (audioTransceiver.setDirection) {\n audioTransceiver.setDirection(\"inactive\");\n } else {\n audioTransceiver.direction = \"inactive\";\n }\n }\n } else {\n // Take care of audio m-line\n if (audioSend && audioRecv) {\n if (audioTransceiver) {\n if (audioTransceiver.setDirection) {\n audioTransceiver.setDirection(\"sendrecv\");\n } else {\n audioTransceiver.direction = \"sendrecv\";\n }\n }\n } else if (audioSend && !audioRecv) {\n if (audioTransceiver) {\n if (audioTransceiver.setDirection) {\n audioTransceiver.setDirection(\"sendonly\");\n } else {\n audioTransceiver.direction = \"sendonly\";\n }\n }\n } else if (!audioSend && audioRecv) {\n if (audioTransceiver) {\n if (audioTransceiver.setDirection) {\n audioTransceiver.setDirection(\"recvonly\");\n } else {\n audioTransceiver.direction = \"recvonly\";\n }\n } else {\n // In theory, this is the only case where we might not have a transceiver yet\n audioTransceiver = config.pc.addTransceiver(\"audio\", {\n direction: \"recvonly\"\n });\n }\n }\n } // Handle video (and related changes, if any)\n\n\n if (!videoSend && !videoRecv) {\n if (videoTransceiver) {\n if (videoTransceiver.setDirection) {\n videoTransceiver.setDirection(\"inactive\");\n } else {\n videoTransceiver.direction = \"inactive\";\n }\n }\n } else {\n // Take care of video m-line\n if (videoSend && videoRecv) {\n if (videoTransceiver) {\n if (videoTransceiver.setDirection) {\n videoTransceiver.setDirection(\"sendrecv\");\n } else {\n videoTransceiver.direction = \"sendrecv\";\n }\n }\n } else if (videoSend && !videoRecv) {\n if (videoTransceiver) {\n if (videoTransceiver.setDirection) {\n videoTransceiver.setDirection(\"sendonly\");\n } else {\n videoTransceiver.direction = \"sendonly\";\n }\n }\n } else if (!videoSend && videoRecv) {\n if (videoTransceiver) {\n if (videoTransceiver.setDirection) {\n videoTransceiver.setDirection(\"recvonly\");\n } else {\n videoTransceiver.direction = \"recvonly\";\n }\n } else {\n // In theory, this is the only case where we might not have a transceiver yet\n videoTransceiver = config.pc.addTransceiver(\"video\", {\n direction: \"recvonly\"\n });\n }\n }\n }\n } else {\n if (webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__[\"default\"].browserDetails.browser === \"firefox\" || webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__[\"default\"].browserDetails.browser === \"edge\") {\n mediaConstraints = {\n offerToReceiveAudio: audioRecv,\n offerToReceiveVideo: videoRecv\n };\n } else {\n mediaConstraints = {\n mandatory: {\n OfferToReceiveAudio: audioRecv,\n OfferToReceiveVideo: videoRecv\n }\n };\n }\n }\n\n if (iceRestart) {\n mediaConstraints[\"iceRestart\"] = true;\n }\n\n return config.pc[methodName](mediaConstraints).then(function (response) {\n config.mySdp = response.sdp;\n\n let _p = config.pc.setLocalDescription(response).catch(e => {\n return Promise.reject({\n type: 'warning',\n id: 24,\n message: 'setLocalDescription',\n data: [handleId, e]\n });\n });\n\n config.mediaConstraints = mediaConstraints;\n\n if (!config.iceDone && !config.trickle) {\n // Don't do anything until we have all candidates\n return Promise.resolve(null);\n } // JSON.stringify doesn't work on some WebRTC objects anymore\n // See https://code.google.com/p/chromium/issues/detail?id=467366\n\n\n var jsep = {\n \"type\": response.type,\n \"sdp\": response.sdp\n };\n return _p.then(() => jsep);\n }, e => {\n return Promise.reject({\n type: 'warning',\n id: 25,\n message: methodName,\n data: [handleId, e]\n });\n });\n }\n\n _publishRemote(handleId, jsep) {\n let handle = this._getHandle(handleId);\n\n if (!handle) {\n return Promise.reject({\n type: 'warning',\n id: 15,\n message: 'id non-existent',\n data: [handleId, 'publish remote participant']\n });\n }\n\n this._webrtc(handleId, true);\n\n let config = handle.webrtcStuff;\n\n if (jsep) {\n return config.pc.setRemoteDescription(jsep).then(() => {\n config.remoteSdp = jsep.sdp; // Any trickle candidate we cached?\n\n if (config.candidates && config.candidates.length > 0) {\n for (var i = 0; i < config.candidates.length; i++) {\n var candidate = config.candidates[i];\n\n if (!candidate || candidate.completed === true) {\n // end-of-candidates\n config.pc.addIceCandidate(null);\n } else {\n // New candidate\n config.pc.addIceCandidate(candidate);\n }\n }\n\n config.candidates = [];\n } // Create the answer now\n\n\n return this._createAO('answer', handleId, false, [false, true, false, true]).then(_jsep => {\n if (!_jsep) {\n this.emit('error', {\n type: 'warning',\n id: 19,\n message: 'publish remote participant',\n data: [handleId, 'no jsep']\n });\n return Promise.resolve();\n }\n\n return this.sendMessage(handleId, {\n \"body\": {\n \"request\": \"start\",\n ...(this.roomId && {\n \"room\": this.roomId\n }),\n ...(this.pin && {\n pin: this.pin\n })\n },\n \"jsep\": _jsep\n });\n });\n }, e => Promise.reject({\n type: 'warning',\n id: 23,\n message: 'setRemoteDescription',\n data: [handleId, e]\n }));\n } else {\n return Promise.resolve();\n }\n } //Public methods\n\n\n publishLocal(stream) {\n let {\n keepAudio = false,\n keepVideo = false\n } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n if (this.isDisconnecting || !this.isConnected) {\n return Promise.reject({\n type: 'warning',\n id: 18,\n message: 'Either not connected or disconnecting'\n });\n }\n\n this.emit('publishing', true);\n\n let handle = this._getHandle(this.handleId);\n\n if (!handle) {\n return Promise.reject({\n type: 'error',\n id: 21,\n message: 'no local id, connect before publishing',\n data: null\n });\n }\n\n this._webrtc(this.handleId);\n\n let config = handle.webrtcStuff;\n\n if (stream) {\n if (!config.stream) {\n config.stream = stream;\n stream.getTracks().forEach(function (track) {\n config.pc.addTrack(track, stream);\n });\n } else {\n /* UPDATE Audio */\n let replaceAudio = stream.getAudioTracks().length;\n\n if (replaceAudio || !keepAudio) {\n //this will stop existing tracks\n let oldAudioStream = config.stream.getAudioTracks()[0];\n\n if (oldAudioStream) {\n config.stream.removeTrack(oldAudioStream);\n\n try {\n oldAudioStream.stop();\n } catch (e) {\n this._log(e);\n }\n }\n }\n\n if (config.pc.getSenders() && config.pc.getSenders().length) {\n if (replaceAudio && this.isUnifiedPlan) {//using replace\n } else {\n for (let index in config.pc.getSenders()) {\n let s = config.pc.getSenders()[index];\n\n if (s && s.track && s.track.kind === \"audio\") {\n config.pc.removeTrack(s);\n }\n }\n }\n }\n\n if (replaceAudio) {\n config.stream.addTrack(stream.getAudioTracks()[0]);\n var audioTransceiver = null;\n\n if (this.isUnifiedPlan) {\n let transceivers = config.pc.getTransceivers();\n\n if (transceivers && transceivers.length > 0) {\n for (let i in transceivers) {\n let t = transceivers[i];\n\n if (t.sender && t.sender.track && t.sender.track.kind === \"audio\" && t.stopped === false || t.receiver && t.receiver.track && t.receiver.track.kind === \"audio\" && t.stopped === false) {\n audioTransceiver = t;\n break;\n }\n }\n }\n }\n\n if (audioTransceiver && audioTransceiver.sender) {\n audioTransceiver.sender.replaceTrack(stream.getAudioTracks()[0]);\n } else {\n config.pc.addTrack(stream.getAudioTracks()[0], stream);\n }\n }\n /* UPDATE Video */\n\n\n let replaceVideo = stream.getVideoTracks().length;\n\n if (replaceVideo || !keepVideo) {\n let oldVideoStream = config.stream.getVideoTracks()[0];\n\n if (oldVideoStream) {\n config.stream.removeTrack(oldVideoStream);\n\n try {\n oldVideoStream.stop();\n } catch (e) {\n this._log(e);\n }\n }\n }\n\n if (config.pc.getSenders() && config.pc.getSenders().length) {\n if (replaceVideo && this.isUnifiedPlan) {//using replace\n } else {\n for (let index in config.pc.getSenders()) {\n let s = config.pc.getSenders()[index];\n\n if (s && s.track && s.track.kind === \"video\") {\n config.pc.removeTrack(s);\n }\n }\n }\n }\n\n if (replaceVideo) {\n config.stream.addTrack(stream.getVideoTracks()[0]);\n var videoTransceiver = null;\n\n if (this.isUnifiedPlan) {\n let transceivers = config.pc.getTransceivers();\n\n if (transceivers && transceivers.length > 0) {\n for (let i in transceivers) {\n let t = transceivers[i];\n\n if (t.sender && t.sender.track && t.sender.track.kind === \"video\" && t.stopped === false || t.receiver && t.receiver.track && t.receiver.track.kind === \"video\" && t.stopped === false) {\n videoTransceiver = t;\n break;\n }\n }\n }\n }\n\n if (videoTransceiver && videoTransceiver.sender) {\n //TODO: check if t.stopped === false still gets us videoTransceiver\n videoTransceiver.sender.replaceTrack(stream.getVideoTracks()[0]);\n } else {\n config.pc.addTrack(stream.getVideoTracks()[0], stream);\n }\n }\n }\n }\n\n let hasAudio = !!(stream && stream.getAudioTracks().length > 0);\n let hasVideo = !!(stream && stream.getVideoTracks().length > 0);\n let isAudioMuted = !stream || stream.getAudioTracks().length === 0 || !stream.getAudioTracks()[0].enabled;\n let isVideoMuted = !stream || stream.getVideoTracks().length === 0 || !stream.getVideoTracks()[0].enabled;\n this.isAudioEnabed = hasAudio;\n this.isVideoEnabled = hasVideo;\n this.isAudioMuted = isAudioMuted;\n this.isVideoMuted = isVideoMuted;\n return this._createAO('offer', this.handleId, false, [hasAudio, false, hasVideo, false]).then(jsep => {\n if (!jsep) {\n return null;\n } //HOTFIX: Temporary fix for Safari 13\n\n\n if (jsep.sdp && jsep.sdp.indexOf(\"\\r\\na=ice-ufrag\") === -1) {\n jsep.sdp = jsep.sdp.replace(\"\\na=ice-ufrag\", \"\\r\\na=ice-ufrag\");\n }\n\n return this.sendMessage(this.handleId, {\n body: {\n \"request\": \"configure\",\n \"audio\": hasAudio,\n \"video\": hasVideo,\n \"data\": true,\n ...(this.recordingFilename ? {\n filename: this.recordingFilename\n } : {})\n },\n jsep\n });\n }).then(r => {\n if (this._isDataChannelOpen) {\n return Promise.resolve(r);\n } else {\n return new Promise((resolve, reject) => {\n let dataChannelTimeoutId = null;\n\n let _resolve = val => {\n if (val) {\n clearTimeout(dataChannelTimeoutId);\n\n this._abortController.signal.removeEventListener('abort', _rejectAbort);\n\n this.off('dataChannel', _resolve, this);\n resolve(this);\n }\n };\n\n let _rejectTimeout = () => {\n this.off('dataChannel', _resolve, this);\n\n this._abortController.signal.removeEventListener('abort', _rejectAbort);\n\n reject({\n type: 'error',\n id: 27,\n message: 'Data channel did not open',\n data: null\n });\n };\n\n let _rejectAbort = () => {\n this._abortController.signal.removeEventListener('abort', _rejectAbort);\n\n clearTimeout(dataChannelTimeoutId);\n this.off('dataChannel', _resolve, this);\n reject({\n type: 'warning',\n id: 17,\n message: 'Connection cancelled'\n });\n };\n\n dataChannelTimeoutId = setTimeout(_rejectTimeout, 5000);\n\n this._abortController.signal.addEventListener('abort', _rejectAbort);\n\n this.on('dataChannel', _resolve, this);\n });\n }\n }).then(r => {\n this.isPublished = true;\n\n if (config.stream) {\n let tracks = config.stream.getTracks();\n tracks.forEach(track => {\n // used as a flag to not emit tracks that been already emitted\n if (!track.onended) {\n var _decodeJanusDisplay21, _decodeJanusDisplay22;\n\n this.emit('addLocalParticipant', {\n tid: Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"generateUUID\"])(),\n id: handle.handleId,\n userId: (_decodeJanusDisplay21 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay21 === void 0 ? void 0 : _decodeJanusDisplay21.userId,\n role: (_decodeJanusDisplay22 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(this.display)) === null || _decodeJanusDisplay22 === void 0 ? void 0 : _decodeJanusDisplay22.role,\n track,\n stream: config.stream,\n adding: true,\n constructId: this.constructId,\n metaData: this.options.metaData,\n hasAudioTrack: hasAudio,\n hasVideoTrack: hasVideo\n });\n\n track.onended = ev => {\n var _decodeJanusDisplay23, _decodeJanusDisplay24;\n\n this.emit('addLocalParticipant', {\n tid: Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"generateUUID\"])(),\n id: handle.handleId,\n userId: (_decodeJanusDisplay23 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay23 === void 0 ? void 0 : _decodeJanusDisplay23.userId,\n role: (_decodeJanusDisplay24 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(this.display)) === null || _decodeJanusDisplay24 === void 0 ? void 0 : _decodeJanusDisplay24.role,\n track: ev.target,\n stream: config.stream,\n adding: false,\n removing: true,\n constructId: this.constructId,\n metaData: this.options.metaData,\n hasAudioTrack: hasAudio,\n hasVideoTrack: hasVideo\n });\n };\n }\n });\n } else {\n var _decodeJanusDisplay25, _decodeJanusDisplay26;\n\n this.emit('addLocalParticipant', {\n tid: Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"generateUUID\"])(),\n id: handle.handleId,\n userId: (_decodeJanusDisplay25 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay25 === void 0 ? void 0 : _decodeJanusDisplay25.userId,\n role: (_decodeJanusDisplay26 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(this.display)) === null || _decodeJanusDisplay26 === void 0 ? void 0 : _decodeJanusDisplay26.role,\n stream: null,\n adding: false,\n constructId: this.constructId,\n metaData: this.options.metaData,\n hasAudioTrack: hasAudio,\n hasVideoTrack: hasVideo\n });\n }\n\n this.emit('published', {\n status: true,\n hasStream: !!config.stream\n });\n this.emit('publishing', false);\n this.emit('localHasVideo', hasVideo);\n this.emit('localHasAudio', hasAudio);\n this.emit('localMuted', {\n type: 'video',\n value: isVideoMuted\n });\n this.emit('localMuted', {\n type: 'audio',\n value: isAudioMuted\n });\n return r;\n }).catch(e => {\n this.emit('publishing', false);\n return Promise.reject(e);\n });\n }\n\n unpublishLocal() {\n let dontWait = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n return this.isPublished ? this.sendMessage(this.handleId, {\n body: {\n \"request\": \"unpublish\"\n }\n }, dontWait).finally(r => {\n this.isPublished = false;\n this.emit('published', {\n status: false,\n hasStream: false\n });\n return r;\n }) : Promise.resolve();\n }\n\n toggleAudio() {\n let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n let mid = arguments.length > 1 ? arguments[1] : undefined;\n\n let handle = this._getHandle(this.handleId);\n\n if (!handle) {\n return Promise.reject({\n type: 'error',\n id: 21,\n message: 'no local id, connect first',\n data: null\n });\n }\n\n let config = handle.webrtcStuff;\n\n if (this.isUnifiedPlan) {\n let transceiver = config.pc.getTransceivers().find(t => t.sender && t.sender.track && t.receiver.track.kind === \"audio\" && t.stopped === false && (mid ? t.mid === mid : true));\n\n if (transceiver) {\n transceiver.sender.track.enabled = value !== null ? !!value : !transceiver.sender.track.enabled;\n }\n\n this.isAudioMuted = !transceiver || !transceiver.sender.track.enabled;\n } else {\n if (config.stream && config.stream.getAudioTracks().length) {\n config.stream.getAudioTracks()[0].enabled = value !== null ? !!value : !config.stream.getAudioTracks()[0].enabled;\n }\n\n this.isAudioMuted = config.stream.getAudioTracks().length === 0 || !config.stream.getAudioTracks()[0].enabled;\n }\n\n this.emit('localMuted', {\n type: 'audio',\n value: this.isAudioMuted,\n mid\n });\n }\n\n toggleVideo() {\n let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n let mid = arguments.length > 1 ? arguments[1] : undefined;\n\n let handle = this._getHandle(this.handleId);\n\n if (!handle) {\n return Promise.reject({\n type: 'error',\n id: 21,\n message: 'no local id, connect first',\n data: null\n });\n }\n\n let config = handle.webrtcStuff;\n\n if (this.isUnifiedPlan) {\n let transceiver = config.pc.getTransceivers().find(t => t.sender && t.sender.track && t.receiver.track.kind === \"video\" && t.stopped === false && (mid ? t.mid === mid : true));\n\n if (transceiver) {\n transceiver.sender.track.enabled = value !== null ? !!value : !transceiver.sender.track.enabled;\n }\n\n this.isVideoMuted = !transceiver || !transceiver.sender.track.enabled;\n } else {\n if (config.stream && config.stream.getVideoTracks().length) {\n config.stream.getVideoTracks()[0].enabled = value !== null ? !!value : !config.stream.getVideoTracks()[0].enabled;\n }\n\n this.isVideoMuted = config.stream.getVideoTracks().length === 0 || !config.stream.getVideoTracks()[0].enabled;\n }\n\n this.emit('localMuted', {\n type: 'video',\n value: this.isVideoMuted,\n mid\n });\n }\n\n setRoomType() {\n let type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'watchparty';\n this._roomType = type;\n return this._roomType;\n }\n\n}\n\n_defineProperty(RoomSession, \"sessionTypes\", {\n 'reactooroom': 'janus.plugin.reactooroom',\n 'streaming': 'janus.plugin.streaming'\n});\n\n_defineProperty(RoomSession, \"subscriptionRules\", {\n participant: {\n \"watchparty\": ['participant', 'talkback'],\n \"commentary\": ['participant', 'talkback', 'host'],\n \"videowall\": ['host', 'talkback', 'observer', 'observerSolo1', 'observerSolo2', 'observerSolo3'],\n \"videowall-queue\": ['host', 'talkback', 'observer', 'observerSolo1', 'observerSolo2', 'observerSolo3'],\n \"videowall-queue-video\": ['host', 'talkback', 'observer', 'observerSolo1', 'observerSolo2', 'observerSolo3']\n },\n monitor: {\n \"watchparty\": ['participant'],\n \"commentary\": ['participant', 'host'],\n \"videowall\": ['host', 'participant'],\n \"videowall-queue\": ['host', 'participant'],\n \"videowall-queue-video\": ['host', 'participant']\n },\n talkback: {\n \"watchparty\": ['participant'],\n \"commentary\": ['host', 'participant'],\n \"videowall\": ['host', 'participant'],\n \"videowall-queue\": ['host', 'participant'],\n \"videowall-queue-video\": ['host', 'participant']\n },\n observer: {\n \"watchparty\": ['participant'],\n \"commentary\": ['participant'],\n \"videowall\": ['participant'],\n \"videowall-queue\": ['participant'],\n \"videowall-queue-video\": ['participant']\n },\n observerSolo1: {\n \"watchparty\": ['participant'],\n \"commentary\": ['participant'],\n \"videowall\": ['participant'],\n \"videowall-queue\": ['participant'],\n \"videowall-queue-video\": ['participant']\n },\n observerSolo2: {\n \"watchparty\": ['participant'],\n \"commentary\": ['participant'],\n \"videowall\": ['participant'],\n \"videowall-queue\": ['participant'],\n \"videowall-queue-video\": ['participant']\n },\n observerSolo3: {\n \"watchparty\": ['participant'],\n \"commentary\": ['participant'],\n \"videowall\": ['participant'],\n \"videowall-queue\": ['participant'],\n \"videowall-queue-video\": ['participant']\n },\n host: {\n \"watchparty\": [],\n \"commentary\": [],\n \"videowall\": [],\n \"videowall-queue\": [],\n \"videowall-queue-video\": []\n },\n companionTV: {},\n companionPhone: {}\n});\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Room);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/wt-room.js?");
|
|
9475
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! webrtc-adapter */ \"./node_modules/webrtc-adapter/src/js/adapter_core.js\");\n/* harmony import */ var _wt_emitter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./wt-emitter */ \"./src/modules/wt-emitter.js\");\n/* harmony import */ var _wt_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./wt-utils */ \"./src/modules/wt-utils.js\");\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n// Watch together janus webrtc library\n\n\n\n\nclass Room {\n constructor(debug) {\n this.debug = debug;\n this.sessions = [];\n this.safariVp8 = false;\n this.browser = webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__[\"default\"].browserDetails.browser;\n this.browserDetails = webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__[\"default\"].browserDetails;\n this.webrtcSupported = Room.isWebrtcSupported();\n this.safariVp8TestPromise = Room.testSafariVp8();\n this.safariVp8 = null;\n this.safariVp8TestPromise.then(safariVp8 => {\n this.safariVp8 = safariVp8;\n }); // Let's get it started\n\n this.whenInitialized = this.initialize();\n }\n\n initialize() {\n return this.safariVp8TestPromise.then(() => this);\n }\n\n createSession() {\n let constructId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'reactooroom';\n let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n return new RoomSession(constructId, type, {\n debug: this.debug,\n ...options\n });\n }\n\n static testSafariVp8() {\n return new Promise(resolve => {\n if (webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__[\"default\"].browserDetails.browser === 'safari' && webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__[\"default\"].browserDetails.version >= 605) {\n if (RTCRtpSender && RTCRtpSender.getCapabilities && RTCRtpSender.getCapabilities(\"video\") && RTCRtpSender.getCapabilities(\"video\").codecs && RTCRtpSender.getCapabilities(\"video\").codecs.length) {\n var isVp8 = false;\n\n for (var i in RTCRtpSender.getCapabilities(\"video\").codecs) {\n var codec = RTCRtpSender.getCapabilities(\"video\").codecs[i];\n\n if (codec && codec.mimeType && codec.mimeType.toLowerCase() === \"video/vp8\") {\n isVp8 = true;\n break;\n }\n }\n\n resolve(isVp8);\n } else {\n // We do it in a very ugly way, as there's no alternative...\n // We create a PeerConnection to see if VP8 is in an offer\n var testpc = new RTCPeerConnection({}, {});\n testpc.createOffer({\n offerToReceiveVideo: true\n }).then(function (offer) {\n let result = offer.sdp.indexOf(\"VP8\") !== -1;\n testpc.close();\n testpc = null;\n resolve(result);\n });\n }\n } else resolve(false);\n });\n }\n\n static isWebrtcSupported() {\n return window.RTCPeerConnection !== undefined && window.RTCPeerConnection !== null && navigator.mediaDevices !== undefined && navigator.mediaDevices !== null && navigator.mediaDevices.getUserMedia !== undefined && navigator.mediaDevices.getUserMedia !== null;\n }\n\n}\n\nclass RoomSession {\n static noop() {}\n\n static randomString(len) {\n var charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n var randomString = '';\n\n for (var i = 0; i < len; i++) {\n var randomPoz = Math.floor(Math.random() * charSet.length);\n randomString += charSet.substring(randomPoz, randomPoz + 1);\n }\n\n return randomString;\n } //TODO: solve\n // #eventList = ['error', 'kicked', 'addLocalParticipant', ,'addRemoteInstructor','addRemoteParticipant','addRemoteTalkback', 'addRemoteObserver', 'removeRemoteInstructor', 'removeLocalParticipant', 'removeRemoteParticipant', 'removeRemoteTalkback', 'removeRemoteObserver', 'localMuted', 'localHasVideo', 'localHasAudio', 'data', 'iceState', 'connectionState', 'joined', 'joining', 'dataChannel', 'disconnect', 'observerIds', 'talkbackIds', 'instructorId', 'published', 'publishing', 'remoteTrackMuted', 'streamingStatus', 'streaming', 'streamStarting'];\n //\n\n\n constructor() {\n let constructId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'reactooroom';\n let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n Object.assign(this, Object(_wt_emitter__WEBPACK_IMPORTED_MODULE_1__[\"default\"])());\n this.defaultDataChannelLabel = 'JanusDataChannel';\n this.server = null;\n this.iceServers = null;\n this.token = null;\n this.roomId = null;\n this.streamId = null;\n this.pin = null;\n this.userId = null;\n this.sessiontype = type;\n this.initialBitrate = 0;\n this.recordingFilename = null;\n this.pluginName = RoomSession.sessionTypes[type];\n this.options = options;\n this.id = null;\n this.privateId = null;\n this.constructId = constructId || RoomSession.randomString(16);\n this.sessionId = null;\n this.handleId = null;\n this.ws = null;\n this.isRestarting = false;\n this.isConnecting = false;\n this.isDisconnecting = false;\n this.isConnected = false;\n this.isPublished = false;\n this.isReclaiming = false;\n this.isStreaming = false;\n this._ipv6Support = false;\n this._retries = 0;\n this._maxRetries = 3;\n this._keepAliveId = null;\n this._participants = [];\n this._roomType = 'watchparty';\n this._isDataChannelOpen = false;\n this._abortController = null;\n this.isAudioMuted = false;\n this.isVideoMuted = false;\n this.isVideoEnabled = false;\n this.isAudioEnabed = false;\n this.isUnifiedPlan = RoomSession.checkUnifiedPlan();\n this.subscriptionRules = { ...RoomSession.subscriptionRules,\n ...(this.options.subscriptionRules || {})\n };\n this._log = RoomSession.noop;\n\n if (this.options.debug) {\n this._enableDebug();\n }\n } // Check if this browser supports Unified Plan and transceivers\n // Based on https://codepen.io/anon/pen/ZqLwWV?editors=0010\n\n\n static checkUnifiedPlan() {\n let unifiedPlan = false;\n\n if (webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__[\"default\"].browserDetails.browser === 'firefox' && webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__[\"default\"].browserDetails.version >= 59) {\n // Firefox definitely does, starting from version 59\n unifiedPlan = true;\n } else if (webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__[\"default\"].browserDetails.browser === 'chrome' && webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__[\"default\"].browserDetails.version >= 72) {\n // Chrome does, but it's only usable from version 72 on\n unifiedPlan = true;\n } else if (!window.RTCRtpTransceiver || !('currentDirection' in RTCRtpTransceiver.prototype)) {\n // Safari supports addTransceiver() but not Unified Plan when\n // currentDirection is not defined (see codepen above).\n unifiedPlan = false;\n } else {\n // Check if addTransceiver() throws an exception\n const tempPc = new RTCPeerConnection();\n\n try {\n tempPc.addTransceiver('audio');\n unifiedPlan = true;\n } catch (e) {}\n\n tempPc.close();\n }\n\n return unifiedPlan;\n }\n\n _participantShouldSubscribe(userId) {\n const myUser = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(this.display);\n const remoteUser = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(userId);\n let localUserRole = (myUser === null || myUser === void 0 ? void 0 : myUser.role) || 'participant';\n let remoteUserRole = (remoteUser === null || remoteUser === void 0 ? void 0 : remoteUser.role) || 'participant';\n return this.subscriptionRules[localUserRole][this._roomType || 'watchparty'].indexOf(remoteUserRole) > -1;\n }\n\n _getAddParticipantEventName(handleId) {\n var _decodeJanusDisplay;\n\n let handle = this._getHandle(handleId);\n\n if (!handle) {\n this.emit('error', {\n type: 'warning',\n id: 15,\n message: 'id non-existent',\n data: [handleId, 'getParticipantEventName']\n });\n }\n\n const participantRole = (_decodeJanusDisplay = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay === void 0 ? void 0 : _decodeJanusDisplay.role;\n\n switch (participantRole) {\n case 'participant':\n return 'addRemoteParticipant';\n\n case 'talkback':\n return 'addRemoteTalkback';\n\n case 'monitor':\n return 'addRemoteTalkback';\n\n case 'observer':\n case 'observerSolo1':\n case 'observerSolo2':\n case 'observerSolo3':\n return 'addRemoteObserver';\n\n case 'host':\n return 'addRemoteInstructor';\n\n case 'companionTV':\n return 'addRemoteCompanionTV';\n\n case 'companionPhone':\n return 'addRemoteCompanionPhone';\n\n default:\n return 'addRemoteParticipant';\n }\n }\n\n _getRemoveParticipantEventName(handleId) {\n var _decodeJanusDisplay2;\n\n let handle = this._getHandle(handleId);\n\n if (!handle) {\n this.emit('error', {\n type: 'warning',\n id: 15,\n message: 'id non-existent',\n data: [handleId, 'getParticipantEventName']\n });\n }\n\n const participantRole = (_decodeJanusDisplay2 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay2 === void 0 ? void 0 : _decodeJanusDisplay2.role;\n\n switch (participantRole) {\n case 'participant':\n return 'removeRemoteParticipant';\n\n case 'talkback':\n return 'removeRemoteTalkback';\n\n case 'monitor':\n return 'removeRemoteTalkback';\n\n case 'observer':\n case 'observerSolo1':\n case 'observerSolo2':\n case 'observerSolo3':\n return 'removeRemoteObserver';\n\n case 'host':\n return 'removeRemoteInstructor';\n\n case 'companionTV':\n return 'removeRemoteCompanionTV';\n\n case 'companionPhone':\n return 'removeRemoteCompanionPhone';\n\n default:\n return 'removeRemoteParticipant';\n }\n }\n\n sendMessage(handleId) {\n let message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n body: 'Example Body'\n };\n let dontWait = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n let dontResolveOnAck = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n return this._send({\n \"janus\": \"message\",\n \"handle_id\": handleId,\n ...message\n }, dontWait, dontResolveOnAck).then(json => {\n if (json && json[\"janus\"] === \"success\") {\n let plugindata = json[\"plugindata\"] || {};\n let data = plugindata[\"data\"];\n return Promise.resolve(data);\n }\n\n return Promise.resolve();\n }).catch(json => {\n if (json && json[\"error\"]) {\n return Promise.reject({\n type: 'warning',\n id: 1,\n message: 'sendMessage failed',\n data: json[\"error\"]\n });\n } else {\n return Promise.reject({\n type: 'warning',\n id: 1,\n message: 'sendMessage failed',\n data: json\n });\n }\n });\n }\n\n _send() {\n let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let ignoreResponse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n let dontResolveOnAck = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n let transaction = RoomSession.randomString(12);\n let requestData = { ...request,\n transaction,\n token: this.token,\n ...(this.sessionId && {\n 'session_id': this.sessionId\n } || {})\n };\n\n this._log(requestData);\n\n return new Promise((resolve, reject) => {\n let messageTimeoutId = null;\n\n let abortResponse = () => {\n this._abortController.signal.removeEventListener('abort', abortResponse);\n\n clearTimeout(messageTimeoutId);\n this.ws.removeEventListener('message', parseResponse);\n reject({\n type: 'warning',\n id: 17,\n message: 'connection cancelled'\n });\n };\n\n let parseResponse = event => {\n let json = JSON.parse(event.data);\n let r_transaction = json['transaction'];\n\n if (r_transaction === transaction && (!dontResolveOnAck || json['janus'] !== 'ack')) {\n clearTimeout(messageTimeoutId);\n\n this._abortController.signal.removeEventListener('abort', abortResponse);\n\n this.ws.removeEventListener('message', parseResponse);\n\n if (json['janus'] === 'error') {\n var _json$error;\n\n if ((json === null || json === void 0 ? void 0 : (_json$error = json.error) === null || _json$error === void 0 ? void 0 : _json$error.code) == 403) {\n this.disconnect(true);\n }\n\n reject({\n type: 'error',\n id: 2,\n message: 'send failed',\n data: json,\n requestData\n });\n } else {\n resolve(json);\n }\n }\n };\n\n if (ignoreResponse) {\n if (this.ws && this.ws.readyState === 1) {\n this.ws.send(JSON.stringify(requestData));\n }\n\n resolve();\n } else {\n if (this.ws && this.ws.readyState === 1) {\n this.ws.addEventListener('message', parseResponse);\n messageTimeoutId = setTimeout(() => {\n this.ws.removeEventListener('message', parseResponse);\n\n this._abortController.signal.removeEventListener('abort', abortResponse);\n\n reject({\n type: 'error',\n id: 3,\n message: 'send timeout',\n data: requestData\n });\n }, 10000);\n\n this._abortController.signal.addEventListener('abort', abortResponse);\n\n this.ws.send(JSON.stringify(requestData));\n } else {\n reject({\n type: 'warning',\n id: 29,\n message: 'No connection to WebSockets',\n data: requestData\n });\n }\n }\n });\n }\n\n _connectionClosed() {\n if (!this.isConnected || this.isConnecting || this.isDisconnecting) {\n return;\n }\n\n if (this._retries < this._maxRetries) {\n setTimeout(() => {\n this._retries++;\n\n this._reconnect().catch(e => {\n this.emit('error', e);\n });\n }, 3000 * this._retries);\n } else {\n if (this.sessiontype === 'reactooroom') {\n this.disconnect(true);\n } else if (this.sessiontype === 'streaming') {\n this.stopStream();\n }\n\n this.emit('error', {\n type: 'error',\n id: 4,\n message: 'Lost connection to WebSockets',\n data: null\n });\n }\n }\n\n _wipeListeners() {\n if (this.ws) {\n this.ws.removeEventListener('close', this.__connectionClosedBoundFn);\n this.ws.removeEventListener('message', this.__handleWsEventsBoundFn);\n }\n }\n\n _startKeepAlive() {\n this._send({\n \"janus\": \"keepalive\"\n }).then(json => {\n if (json[\"janus\"] !== 'ack') {\n this.emit('error', {\n type: 'warning',\n id: 5,\n message: 'keepalive response suspicious',\n data: json[\"janus\"]\n });\n }\n }).catch(e => {\n this.emit('error', {\n type: 'warning',\n id: 6,\n message: 'keepalive dead',\n data: e\n });\n\n this._connectionClosed();\n });\n\n this._keepAliveId = setTimeout(() => {\n this._startKeepAlive();\n }, 30000);\n }\n\n _stopKeepAlive() {\n clearTimeout(this._keepAliveId);\n }\n\n _handleWsEvents(event) {\n let json = JSON.parse(event.data);\n var sender = json[\"sender\"];\n var type = json[\"janus\"];\n\n let handle = this._getHandle(sender);\n\n if (!handle) {\n return;\n }\n\n if (type === \"trickle\") {\n let candidate = json[\"candidate\"];\n let config = handle.webrtcStuff;\n\n if (config.pc && config.remoteSdp) {\n if (!candidate || candidate.completed === true) {\n config.pc.addIceCandidate(null);\n } else {\n config.pc.addIceCandidate(candidate);\n }\n } else {\n if (!config.candidates) {\n config.candidates = [];\n }\n\n config.candidates.push(candidate);\n }\n } else if (type === \"webrtcup\") {//none universal\n } else if (type === \"hangup\") {\n this._log('hangup on', handle.handleId);\n\n this._removeParticipant(handle.handleId, null, false);\n } else if (type === \"detached\") {\n this._log('detached on', handle.handleId);\n\n this._removeParticipant(handle.handleId, null, true);\n } else if (type === \"media\") {\n this._log('Media event:', handle.handleId, json[\"type\"], json[\"receiving\"], json[\"mid\"]);\n } else if (type === \"slowlink\") {\n this._log('Slowlink', handle.handleId, json[\"uplink\"], json[\"lost\"], json[\"mid\"]);\n } else if (type === \"event\") {//none universal\n } else if (type === 'timeout') {\n this.ws.close(3504, \"Gateway timeout\");\n } else if (type === 'success' || type === 'error') {// we're capturing those elsewhere\n } else {\n this._log(`Unknown event: ${type} on session: ${this.sessionId}`);\n } // LOCAL\n\n\n if (sender === this.handleId) {\n if (type === \"event\") {\n var plugindata = json[\"plugindata\"] || {};\n var msg = plugindata[\"data\"] || {};\n var jsep = json[\"jsep\"];\n let result = msg[\"result\"] || null;\n let event = msg[\"videoroom\"] || null;\n let list = msg[\"publishers\"] || {};\n let leaving = msg[\"leaving\"]; //let joining = msg[\"joining\"];\n\n let unpublished = msg[\"unpublished\"];\n let error = msg[\"error\"];\n\n if (event === \"joined\") {\n this.id = msg[\"id\"];\n this.privateId = msg[\"private_id\"];\n this.isConnected = true;\n this.emit('joined', true);\n\n this._log('We have successfully joined Room');\n\n for (let f in list) {\n let userId = list[f][\"display\"];\n let streams = list[f][\"streams\"] || [];\n let id = list[f][\"id\"];\n\n for (let i in streams) {\n streams[i][\"id\"] = id;\n streams[i][\"display\"] = userId;\n }\n\n this._log('Remote userId: ', userId);\n\n if (this._participantShouldSubscribe(userId)) {\n this._log('Creating user: ', userId);\n\n this._createParticipant(userId, id).then(handle => {\n return this.sendMessage(handle.handleId, {\n body: {\n \"request\": \"join\",\n \"room\": this.roomId,\n \"ptype\": \"subscriber\",\n \"feed\": id,\n \"private_id\": this.privateId,\n ...(this.webrtcVersion > 1000 ? {\n id: this.userId\n } : {}),\n pin: this.pin\n }\n });\n }).catch(err => {\n this.emit('error', err);\n });\n }\n }\n } else if (event === \"event\") {\n if (msg[\"streams\"] !== undefined && msg[\"streams\"] !== null) {\n this._log('Got my own streams back', msg[\"streams\"]);\n }\n\n for (let f in list) {\n let userId = list[f][\"display\"];\n let streams = list[f][\"streams\"] || [];\n let id = list[f][\"id\"];\n\n for (let i in streams) {\n streams[i][\"id\"] = id;\n streams[i][\"display\"] = userId;\n }\n\n this._log('Remote userId: ', userId);\n\n if (this._participantShouldSubscribe(userId)) {\n this._log('Creating user: ', userId);\n\n this._createParticipant(userId, id).then(handle => {\n return this.sendMessage(handle.handleId, {\n body: {\n \"request\": \"join\",\n \"room\": this.roomId,\n \"ptype\": \"subscriber\",\n \"feed\": id,\n \"private_id\": this.privateId,\n ...(this.webrtcVersion > 1000 ? {\n id: this.userId\n } : {}),\n pin: this.pin\n }\n });\n }).catch(err => {\n this.emit('error', err);\n });\n }\n }\n\n if (leaving === 'ok') {\n this._log('leaving', this.handleId, 'this is us');\n\n this._removeParticipant(this.handleId);\n\n if (msg['reason'] === 'kicked') {\n this.emit('kicked');\n this.disconnect().catch(() => {});\n }\n } else if (leaving) {\n this._log('leaving', leaving);\n\n this._removeParticipant(null, leaving);\n }\n\n if (unpublished === 'ok') {\n this._log('unpublished', this.handleId, 'this is us');\n\n this._removeParticipant(this.handleId, null, false); // we do just hangup\n\n } else if (unpublished) {\n this._log('unpublished', unpublished);\n\n this._removeParticipant(null, unpublished, true); // we do hangup and detach\n\n }\n\n if (error) {\n this.emit('error', {\n type: 'error',\n id: 7,\n message: 'local participant error',\n data: [sender, msg]\n });\n }\n } // Streaming related\n else if (result && result[\"status\"]) {\n this.emit('streamingStatus', result[\"status\"]);\n\n if (result[\"status\"] === 'stopped') {\n this.stopStream();\n }\n\n if (result[\"status\"] === 'started') {\n this.emit('streaming', true);\n this.isStreaming = true;\n }\n }\n\n if (jsep !== undefined && jsep !== null) {\n if (this.sessiontype === 'reactooroom') {\n this._webrtcPeer(this.handleId, jsep).catch(err => {\n this.emit('error', err);\n });\n } else if (this.sessiontype === 'streaming') {\n this._publishRemote(this.handleId, jsep).catch(err => {\n this.emit('error', err);\n });\n }\n }\n } else if (type === \"webrtcup\") {\n this._log('Configuring bitrate: ' + this.initialBitrate);\n\n if (this.initialBitrate > 0) {\n this.sendMessage(this.handleId, {\n \"body\": {\n \"request\": \"configure\",\n \"bitrate\": this.initialBitrate\n }\n }).catch(() => null);\n }\n }\n } //REMOTE\n else {\n let plugindata = json[\"plugindata\"] || {};\n let msg = plugindata[\"data\"] || {};\n let jsep = json[\"jsep\"];\n let event = msg[\"videoroom\"];\n let error = msg[\"error\"];\n\n if (event === \"attached\") {\n var _decodeJanusDisplay3, _decodeJanusDisplay4;\n\n this._log('Remote have successfully joined Room', msg);\n\n this.emit(this._getAddParticipantEventName(handle.handleId), {\n tid: Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"generateUUID\"])(),\n id: handle.handleId,\n userId: (_decodeJanusDisplay3 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay3 === void 0 ? void 0 : _decodeJanusDisplay3.userId,\n role: (_decodeJanusDisplay4 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay4 === void 0 ? void 0 : _decodeJanusDisplay4.role,\n stream: null,\n track: null,\n adding: false,\n constructId: this.constructId,\n metaData: this.options.metaData,\n hasAudioTrack: false,\n hasVideoTrack: false\n });\n }\n\n if (error) {\n this.emit('error', {\n type: 'warning',\n id: 8,\n message: 'remote participant error',\n data: [sender, msg]\n });\n }\n\n if (jsep) {\n this._publishRemote(handle.handleId, jsep).catch(err => {\n this.emit('error', err);\n });\n }\n }\n }\n\n _handleDataEvents(handleId, type, data) {\n let handle = this._getHandle(handleId);\n\n if (type === 'state') {\n this._log(` - Data channel status - `, `UID: ${handleId}`, `STATUS: ${JSON.stringify(data)}`, `ME: ${handleId === this.handleId}`);\n\n if (handle) {\n let config = handle.webrtcStuff;\n config.dataChannelOpen = this.defaultDataChannelLabel === (data === null || data === void 0 ? void 0 : data.label) && (data === null || data === void 0 ? void 0 : data.state) === 'open';\n }\n\n if (handleId === this.handleId && this.defaultDataChannelLabel === (data === null || data === void 0 ? void 0 : data.label)) {\n this._isDataChannelOpen = (data === null || data === void 0 ? void 0 : data.state) === 'open';\n this.emit('dataChannel', (data === null || data === void 0 ? void 0 : data.state) === 'open');\n }\n }\n\n if (type === 'error') {\n this.emit('error', {\n type: 'warning',\n id: 9,\n message: 'data event warning',\n data: [handleId, data]\n });\n\n if (handle) {\n let config = handle.webrtcStuff;\n\n if (this.defaultDataChannelLabel === data.label) {\n config.dataChannelOpen = false;\n }\n }\n\n if (handleId === this.handleId && this.defaultDataChannelLabel === data.label) {\n this._isDataChannelOpen = false;\n this.emit('dataChannel', false);\n }\n }\n\n if (handleId === this.handleId && type === 'message') {\n let d = null;\n\n try {\n d = JSON.parse(data);\n } catch (e) {\n this.emit('error', {\n type: 'warning',\n id: 10,\n message: 'data message parse error',\n data: [handleId, e]\n });\n return;\n }\n\n this.emit('data', d);\n }\n } //removeHandle === true -> hangup, detach, removeHandle === false -> hangup\n\n\n _removeParticipant(handleId, rfid) {\n let removeHandle = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n\n let handle = this._getHandle(handleId, rfid);\n\n if (!handle) {\n return Promise.resolve();\n } else {\n handleId = handle.handleId;\n }\n\n return this._send({\n \"janus\": \"hangup\",\n \"handle_id\": handleId\n }, true).then(() => removeHandle ? this._send({\n \"janus\": \"detach\",\n \"handle_id\": handleId\n }, true) : Promise.resolve()).finally(() => {\n try {\n if (handle.webrtcStuff.stream && !this.isRestarting) {\n handle.webrtcStuff.stream.getTracks().forEach(track => track.stop());\n }\n } catch (e) {// Do nothing\n }\n\n handle.webrtcStuff.stream = null;\n\n if (handle.webrtcStuff.dataChannel) {\n Object.keys(handle.webrtcStuff.dataChannel).forEach(label => {\n handle.webrtcStuff.dataChannel[label].onmessage = null;\n handle.webrtcStuff.dataChannel[label].onopen = null;\n handle.webrtcStuff.dataChannel[label].onclose = null;\n handle.webrtcStuff.dataChannel[label].onerror = null;\n });\n }\n\n if (handle.webrtcStuff.pc) {\n handle.webrtcStuff.pc.onicecandidate = null;\n handle.webrtcStuff.pc.ontrack = null;\n handle.webrtcStuff.pc.ondatachannel = null;\n handle.webrtcStuff.pc.onconnectionstatechange = null;\n handle.webrtcStuff.pc.oniceconnectionstatechange = null;\n }\n\n try {\n handle.webrtcStuff.pc.close();\n } catch (e) {}\n\n handle.webrtcStuff = {\n stream: null,\n mySdp: null,\n mediaConstraints: null,\n pc: null,\n dataChannelOpen: false,\n dataChannel: null,\n dtmfSender: null,\n trickle: true,\n iceDone: false\n };\n\n if (handleId === this.handleId) {\n var _decodeJanusDisplay5, _decodeJanusDisplay6;\n\n this._isDataChannelOpen = false;\n this.isPublished = false;\n this.emit('published', {\n status: false,\n hasStream: false\n });\n this.emit('removeLocalParticipant', {\n id: handleId,\n userId: (_decodeJanusDisplay5 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay5 === void 0 ? void 0 : _decodeJanusDisplay5.userId,\n role: (_decodeJanusDisplay6 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay6 === void 0 ? void 0 : _decodeJanusDisplay6.role\n });\n } else {\n var _decodeJanusDisplay7, _decodeJanusDisplay8;\n\n this.emit(this._getRemoveParticipantEventName(handleId), {\n id: handleId,\n userId: (_decodeJanusDisplay7 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay7 === void 0 ? void 0 : _decodeJanusDisplay7.userId,\n role: (_decodeJanusDisplay8 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay8 === void 0 ? void 0 : _decodeJanusDisplay8.role\n });\n }\n\n if (removeHandle) {\n let handleIndex = this._participants.findIndex(p => p.handleId === handleId);\n\n this._participants.splice(handleIndex, 1);\n }\n\n return true;\n });\n }\n\n _createParticipant() {\n let userId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n let rfid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n return this._send({\n \"janus\": \"attach\",\n \"plugin\": this.pluginName\n }).then(json => {\n let handleId = json.data[\"id\"];\n let handle = {\n handleId,\n rfid,\n userId,\n webrtcStuff: {\n stream: null,\n mySdp: null,\n mediaConstraints: null,\n pc: null,\n dataChannelOpen: false,\n dataChannel: null,\n dtmfSender: null,\n trickle: true,\n iceDone: false,\n isIceRestarting: false\n }\n };\n\n this._participants.push(handle);\n\n return handle;\n });\n }\n\n _joinRoom(roomId, pin, userId, display) {\n return this.sendMessage(this.handleId, {\n body: {\n \"request\": \"join\",\n \"room\": roomId,\n \"pin\": pin,\n \"ptype\": \"publisher\",\n \"display\": display,\n ...(this.webrtcVersion > 1000 ? {\n id: userId\n } : {})\n }\n }, false, true);\n }\n\n _watchStream(id) {\n return this.sendMessage(this.handleId, {\n body: {\n \"request\": \"watch\",\n id: parseInt(id)\n }\n }, false, true);\n }\n\n _leaveRoom() {\n let dontWait = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n return this.isConnected ? this.sendMessage(this.handleId, {\n body: {\n \"request\": \"leave\"\n }\n }, dontWait).finally(() => {\n this.isConnected = false;\n this.emit('joined', false);\n }) : Promise.resolve();\n } // internal reconnect\n\n\n _reconnect() {\n if (this.isReclaiming) {\n return Promise.resolve();\n }\n\n if (this.ws) {\n this._wipeListeners();\n\n if (this.ws.readyState === 1) {\n this.ws.close();\n }\n }\n\n this._stopKeepAlive();\n\n this.isReclaiming = true;\n this.emit('joining', true);\n return new Promise((resolve, reject) => {\n let abortReconnect = () => {\n this._abortController.signal.removeEventListener('abort', abortReconnect);\n\n this.ws.removeEventListener('close', this.__connectionClosedBoundFn);\n this.ws.removeEventListener('message', this.__handleWsEventsBoundFn);\n this.ws.onopen = null;\n this.ws.onerror = null;\n this.isReclaiming = false;\n this.emit('joining', false);\n reject({\n type: 'warning',\n id: 17,\n message: 'Connection cancelled',\n data: e\n });\n };\n\n this.ws = new WebSocket(this.server, 'janus-protocol');\n this.__connectionClosedBoundFn = this._connectionClosed.bind(this);\n this.__handleWsEventsBoundFn = this._handleWsEvents.bind(this);\n this.ws.addEventListener('close', this.__connectionClosedBoundFn);\n this.ws.addEventListener('message', this.__handleWsEventsBoundFn);\n\n this.ws.onopen = () => {\n this._abortController.signal.removeEventListener('abort', abortReconnect);\n\n this._send({\n \"janus\": \"claim\"\n }).then(json => {\n this.sessionId = json[\"session_id\"] ? json[\"session_id\"] : json.data[\"id\"];\n\n this._startKeepAlive();\n\n this.isReclaiming = false;\n this.emit('joining', false);\n this._retries = 0;\n resolve(json);\n }).catch(error => {\n this.isReclaiming = false;\n this.emit('joining', false);\n reject({\n type: 'error',\n id: 11,\n message: 'reconnection error',\n data: error\n });\n });\n }; // this is called before 'close' event callback so it doesn't break reconnect loop\n\n\n this.ws.onerror = e => {\n this._abortController.signal.removeEventListener('abort', abortReconnect);\n\n this.isReclaiming = false;\n this.emit('joining', false);\n reject({\n type: 'warning',\n id: 12,\n message: 'ws reconnection error',\n data: e\n });\n };\n\n this._abortController.signal.addEventListener('abort', abortReconnect);\n });\n }\n\n connect(roomId, pin, server, iceServers, token, display, userId) {\n let webrtcVersion = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 0;\n let initialBitrate = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 0;\n let recordingFilename = arguments.length > 9 ? arguments[9] : undefined;\n\n if (this.isConnecting) {\n return Promise.reject({\n type: 'warning',\n id: 16,\n message: 'connection already in progress'\n });\n }\n\n if (this.ws) {\n this._wipeListeners();\n }\n\n this._stopKeepAlive();\n\n this._abortController = new AbortController();\n this.sessionId = null;\n this.server = server;\n this.iceServers = iceServers;\n this.token = token;\n this.roomId = roomId;\n this.pin = pin;\n this.display = display;\n this.userId = userId;\n this.webrtcVersion = webrtcVersion;\n this.initialBitrate = initialBitrate;\n this.recordingFilename = recordingFilename;\n this.isConnecting = true;\n this.emit('joining', true);\n return new Promise((resolve, reject) => {\n this.ws = new WebSocket(this.server, 'janus-protocol');\n this.__connectionClosedBoundFn = this._connectionClosed.bind(this);\n this.__handleWsEventsBoundFn = this._handleWsEvents.bind(this);\n\n let abortConnect = () => {\n this._abortController.signal.removeEventListener('abort', abortConnect);\n\n this.ws.removeEventListener('close', this.__connectionClosedBoundFn);\n this.ws.removeEventListener('message', this.__handleWsEventsBoundFn);\n this.ws.onopen = null;\n this.ws.onerror = null;\n this.isConnecting = false;\n this.emit('joining', false);\n reject({\n type: 'warning',\n id: 17,\n message: 'Connection cancelled'\n });\n };\n\n this.ws.addEventListener('close', this.__connectionClosedBoundFn);\n this.ws.addEventListener('message', this.__handleWsEventsBoundFn);\n\n this.ws.onopen = () => {\n this._abortController.signal.removeEventListener('abort', abortConnect);\n\n this._retries = 0;\n\n this._send({\n \"janus\": \"create\"\n }).then(json => {\n this.sessionId = json[\"session_id\"] ? json[\"session_id\"] : json.data[\"id\"];\n\n this._startKeepAlive();\n\n return 1;\n }).then(() => this._createParticipant(userId)).then(handle => {\n this.handleId = handle.handleId;\n return 1;\n }).then(() => this._joinRoom(roomId, pin, userId, display)).then(() => {\n this.isConnecting = false;\n this.emit('joining', false);\n resolve(this);\n }).catch(error => {\n this.isConnecting = false;\n this.emit('joining', false);\n reject({\n type: (error === null || error === void 0 ? void 0 : error.type) === 'warning' ? 'warning' : 'error',\n id: 13,\n message: 'connection error',\n data: error\n });\n });\n };\n\n this.ws.onerror = e => {\n this._abortController.signal.removeEventListener('abort', abortConnect);\n\n this.isConnecting = false;\n this.emit('joining', false);\n reject({\n type: 'error',\n id: 14,\n message: 'ws connection error',\n data: e\n });\n };\n\n this._abortController.signal.addEventListener('abort', abortConnect);\n });\n }\n\n disconnect() {\n var _this$_abortControlle, _this$_abortControlle2;\n\n if (this.isDisconnecting) {\n return Promise.resolve();\n }\n\n (_this$_abortControlle = this._abortController) === null || _this$_abortControlle === void 0 ? void 0 : (_this$_abortControlle2 = _this$_abortControlle.abort) === null || _this$_abortControlle2 === void 0 ? void 0 : _this$_abortControlle2.call(_this$_abortControlle);\n\n this._stopKeepAlive();\n\n let isConnected = this.isConnected;\n this.isDisconnecting = true;\n return Promise.all(this._participants.map(p => this._removeParticipant(p.handleId))).finally(() => {\n this._wipeListeners();\n\n if (this.ws && this.ws.readyState === 1) {\n this._send({\n \"janus\": \"destroy\"\n }, true);\n\n this.ws.close();\n }\n\n this.sessionId = null;\n this.isPublished = false;\n this.isConnected = false;\n this.isDisconnecting = false;\n this.emit('publishing', false);\n this.emit('published', {\n status: false,\n hasStream: false\n });\n this.emit('joining', false);\n this.emit('joined', false);\n this.emit('disconnect', isConnected);\n return Promise.resolve('Disconnected');\n });\n }\n\n startStream(streamId, server, iceServers, token, userId) {\n if (this.isConnecting) {\n return Promise.reject({\n type: 'warning',\n id: 16,\n message: 'connection error',\n data: 'Connection is in progress'\n });\n }\n\n if (this.ws) {\n this._wipeListeners();\n }\n\n this._stopKeepAlive();\n\n this._abortController = new AbortController();\n this.server = server;\n this.iceServers = iceServers;\n this.token = token;\n this.streamId = streamId;\n this.userId = userId;\n this.sessionId = null;\n this.isConnecting = true;\n this.emit('streamStarting', true);\n return new Promise((resolve, reject) => {\n this.ws = new WebSocket(this.server, 'janus-protocol');\n this.__connectionClosedBoundFn = this._connectionClosed.bind(this);\n this.__handleWsEventsBoundFn = this._handleWsEvents.bind(this);\n\n let abortConnect = () => {\n this._abortController.signal.removeEventListener('abort', abortConnect);\n\n this.ws.removeEventListener('close', this.__connectionClosedBoundFn);\n this.ws.removeEventListener('message', this.__handleWsEventsBoundFn);\n this.ws.onopen = null;\n this.ws.onerror = null;\n this.isConnecting = false;\n this.emit('streamStarting', false);\n reject({\n type: 'warning',\n id: 17,\n message: 'Connection cancelled'\n });\n };\n\n this.ws.addEventListener('close', this.__connectionClosedBoundFn);\n this.ws.addEventListener('message', this.__handleWsEventsBoundFn);\n\n this.ws.onopen = () => {\n this._abortController.signal.removeEventListener('abort', abortConnect);\n\n this._retries = 0;\n\n this._send({\n \"janus\": \"create\"\n }).then(json => {\n this.sessionId = json[\"session_id\"] ? json[\"session_id\"] : json.data[\"id\"];\n\n this._startKeepAlive();\n\n return 1;\n }).then(() => this._createParticipant(userId)).then(handle => {\n this.handleId = handle.handleId;\n return 1;\n }).then(() => this._watchStream(streamId)).then(() => {\n this.isConnecting = false;\n this.emit('streamStarting', false);\n resolve(this);\n }).catch(error => {\n this.isConnecting = false;\n this.emit('streamStarting', false);\n reject({\n type: 'error',\n id: 13,\n message: 'connection error',\n data: error\n });\n });\n };\n\n this.ws.onerror = e => {\n this._abortController.signal.removeEventListener('abort', abortConnect);\n\n this.isConnecting = false;\n this.emit('streamStarting', false);\n reject({\n type: 'error',\n id: 14,\n message: 'ws connection error',\n data: e\n });\n };\n\n this._abortController.signal.addEventListener('abort', abortConnect);\n });\n }\n\n stopStream() {\n var _this$_abortControlle3, _this$_abortControlle4;\n\n if (this.isDisconnecting) {\n return Promise.resolve();\n }\n\n (_this$_abortControlle3 = this._abortController) === null || _this$_abortControlle3 === void 0 ? void 0 : (_this$_abortControlle4 = _this$_abortControlle3.abort) === null || _this$_abortControlle4 === void 0 ? void 0 : _this$_abortControlle4.call(_this$_abortControlle3);\n\n this._stopKeepAlive();\n\n let isStreaming = this.isStreaming;\n this.isDisconnecting = true;\n return this.sendMessage(this.handleId, {\n body: {\n \"request\": \"stop\"\n }\n }, false, true).then(() => this._removeParticipant(this.handleId)).finally(() => {\n this._wipeListeners();\n\n this._send({\n \"janus\": \"destroy\"\n }, true);\n\n if (this.ws && this.ws.readyState === 1) {\n this.ws.close();\n }\n\n this.sessionId = null;\n this.isDisconnecting = false;\n this.isStreaming = false;\n this.emit('streamStarting', false);\n this.emit('streaming', false);\n this.emit('disconnect', isStreaming);\n return Promise.resolve('Disconnected');\n });\n }\n\n destroy() {\n if (this.sessiontype === 'reactooroom') {\n return this.disconnect().then(() => {\n this.clear();\n return true;\n });\n } else if (this.sessiontype === 'streaming') {\n return this.stopStream().then(() => {\n this.clear();\n return true;\n });\n }\n }\n\n _enableDebug() {\n this._log = console.log.bind(console);\n }\n\n _getHandle(handleId) {\n let rfid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n return this._participants.find(p => p.handleId === handleId || rfid && p.rfid === rfid);\n }\n\n _getStats() {\n let type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n return Promise.all(this._participants.map(participant => {\n let mediaTrack = null;\n\n if (type === 'video') {\n mediaTrack = participant.webrtcStuff && participant.webrtcStuff.stream && participant.webrtcStuff.stream.getVideoTracks().length && participant.webrtcStuff.stream.getVideoTracks()[0];\n } else if (type === 'audio') {\n mediaTrack = participant.webrtcStuff && participant.webrtcStuff.stream && participant.webrtcStuff.stream.getAudioTracks().length && participant.webrtcStuff.stream.getAudioTracks()[0];\n }\n\n return participant.webrtcStuff && participant.webrtcStuff.pc && participant.webrtcStuff.pc.getStats(mediaTrack).then(r => ({\n handle: participant,\n stats: r\n })).catch(e => Promise.resolve({\n handle: participant,\n stats: e\n }));\n }));\n }\n\n _sendTrickleCandidate(handleId, candidate) {\n return this._send({\n \"janus\": \"trickle\",\n \"candidate\": candidate,\n \"handle_id\": handleId\n });\n }\n\n _webrtc(handleId) {\n let enableOntrack = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n let handle = this._getHandle(handleId);\n\n if (!handle) {\n this.emit('error', {\n type: 'warning',\n id: 15,\n message: 'id non-existent',\n data: [handleId, 'create rtc connection']\n });\n }\n\n let config = handle.webrtcStuff;\n\n if (!config.pc) {\n let pc_config = {\n \"iceServers\": this.iceServers,\n \"iceTransportPolicy\": 'all',\n \"bundlePolicy\": undefined\n };\n pc_config[\"sdpSemantics\"] = this.isUnifiedPlan ? \"unified-plan\" : \"plan-b\";\n let pc_constraints = {\n \"optional\": [{\n \"DtlsSrtpKeyAgreement\": true\n }]\n };\n\n if (this._ipv6Support === true) {\n pc_constraints.optional.push({\n \"googIPv6\": true\n });\n }\n\n if (webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__[\"default\"].browserDetails.browser === \"edge\") {\n // This is Edge, enable BUNDLE explicitly\n pc_config.bundlePolicy = \"max-bundle\";\n }\n\n this._log('new RTCPeerConnection', pc_config, pc_constraints);\n\n config.pc = new RTCPeerConnection(pc_config, pc_constraints);\n\n config.pc.onconnectionstatechange = () => {\n if (config.pc.connectionState === 'failed') {\n this._iceRestart(handleId);\n }\n\n this.emit('connectionState', [handleId, handleId === this.handleId, config.pc.connectionState]);\n\n if (handleId !== this.handleId && config.pc.connectionState === 'connected') {\n var _decodeJanusDisplay9, _decodeJanusDisplay10;\n\n this.emit(this._getAddParticipantEventName(handle.handleId), {\n tid: Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"generateUUID\"])(),\n id: handle.handleId,\n userId: (_decodeJanusDisplay9 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay9 === void 0 ? void 0 : _decodeJanusDisplay9.userId,\n role: (_decodeJanusDisplay10 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay10 === void 0 ? void 0 : _decodeJanusDisplay10.role,\n stream: config.stream,\n track: null,\n optional: true,\n constructId: this.constructId,\n metaData: this.options.metaData,\n adding: false,\n hasAudioTrack: !!(config.stream && config.stream.getAudioTracks().length),\n hasVideoTrack: !!(config.stream && config.stream.getVideoTracks().length)\n });\n }\n };\n\n config.pc.oniceconnectionstatechange = () => {\n if (config.pc.iceConnectionState === 'failed') {\n this._iceRestart(handleId);\n }\n\n this.emit('iceState', [handleId, handleId === this.handleId, config.pc.iceConnectionState]);\n\n if (handleId !== this.handleId && (config.pc.iceConnectionState === 'completed' || config.pc.iceConnectionState === 'connected')) {\n var _decodeJanusDisplay11, _decodeJanusDisplay12;\n\n this.emit(this._getAddParticipantEventName(handle.handleId), {\n tid: Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"generateUUID\"])(),\n id: handle.handleId,\n userId: (_decodeJanusDisplay11 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay11 === void 0 ? void 0 : _decodeJanusDisplay11.userId,\n role: (_decodeJanusDisplay12 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay12 === void 0 ? void 0 : _decodeJanusDisplay12.role,\n stream: config.stream,\n track: null,\n optional: true,\n constructId: this.constructId,\n metaData: this.options.metaData,\n adding: false,\n hasAudioTrack: !!(config.stream && config.stream.getAudioTracks().length),\n hasVideoTrack: !!(config.stream && config.stream.getVideoTracks().length)\n });\n }\n };\n\n config.pc.onicecandidate = event => {\n if (event.candidate == null || webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__[\"default\"].browserDetails.browser === 'edge' && event.candidate.candidate.indexOf('endOfCandidates') > 0) {\n config.iceDone = true;\n\n this._sendTrickleCandidate(handleId, {\n \"completed\": true\n }).catch(e => {\n this.emit('error', e);\n });\n } else {\n // JSON.stringify doesn't work on some WebRTC objects anymore\n // See https://code.google.com/p/chromium/issues/detail?id=467366\n var candidate = {\n \"candidate\": event.candidate.candidate,\n \"sdpMid\": event.candidate.sdpMid,\n \"sdpMLineIndex\": event.candidate.sdpMLineIndex\n };\n\n this._sendTrickleCandidate(handleId, candidate).catch(e => {\n this.emit('error', e);\n });\n }\n };\n\n if (enableOntrack) {\n config.pc.ontrack = event => {\n if (!event.streams) return; //config.stream = event.streams[0];\n\n if (!config.stream) {\n config.stream = new MediaStream();\n }\n\n if (event.track) {\n var _decodeJanusDisplay13, _decodeJanusDisplay14;\n\n let mid = event.transceiver ? event.transceiver.mid : event.track.id;\n config.stream.addTrack(event.track);\n this.emit(this._getAddParticipantEventName(handle.handleId), {\n tid: Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"generateUUID\"])(),\n mid,\n id: handle.handleId,\n userId: (_decodeJanusDisplay13 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay13 === void 0 ? void 0 : _decodeJanusDisplay13.userId,\n role: (_decodeJanusDisplay14 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay14 === void 0 ? void 0 : _decodeJanusDisplay14.role,\n stream: config.stream,\n track: event.track,\n constructId: this.constructId,\n metaData: this.options.metaData,\n adding: true,\n hasAudioTrack: !!(config.stream && config.stream.getAudioTracks().length),\n hasVideoTrack: !!(config.stream && config.stream.getVideoTracks().length)\n });\n if (event.track.onended) return;\n\n event.track.onended = ev => {\n let mid = ev.target.id;\n\n if (this.isUnifiedPlan) {\n let transceiver = config.pc.getTransceivers().find(t => t.receiver.track === ev.target);\n mid = transceiver.mid;\n }\n\n if (config.stream) {\n var _decodeJanusDisplay15, _decodeJanusDisplay16;\n\n config.stream && config.stream.removeTrack(ev.target);\n this.emit(this._getAddParticipantEventName(handle.handleId), {\n tid: Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"generateUUID\"])(),\n id: handle.handleId,\n mid,\n userId: (_decodeJanusDisplay15 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay15 === void 0 ? void 0 : _decodeJanusDisplay15.userId,\n role: (_decodeJanusDisplay16 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay16 === void 0 ? void 0 : _decodeJanusDisplay16.role,\n stream: config.stream,\n track: ev.target,\n constructId: this.constructId,\n metaData: this.options.metaData,\n adding: false,\n removing: true,\n hasAudioTrack: !!(config.stream && config.stream.getAudioTracks().length),\n hasVideoTrack: !!(config.stream && config.stream.getVideoTracks().length)\n });\n }\n };\n\n event.track.onmute = ev => {\n var _decodeJanusDisplay17, _decodeJanusDisplay18;\n\n this._log('remoteTrackMuted', 'onmute');\n\n let mid = ev.target.id;\n\n if (this.isUnifiedPlan) {\n let transceiver = config.pc.getTransceivers().find(t => t.receiver.track === ev.target);\n mid = transceiver.mid;\n }\n\n this.emit('remoteTrackMuted', {\n id: handle.handleId,\n mid,\n userId: (_decodeJanusDisplay17 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay17 === void 0 ? void 0 : _decodeJanusDisplay17.userId,\n role: (_decodeJanusDisplay18 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay18 === void 0 ? void 0 : _decodeJanusDisplay18.role,\n stream: config.stream,\n kind: ev.target.kind,\n track: ev.target,\n muted: true\n });\n };\n\n event.track.onunmute = ev => {\n var _decodeJanusDisplay19, _decodeJanusDisplay20;\n\n this._log('remoteTrackMuted', 'onunmute');\n\n let mid = ev.target.id;\n\n if (this.isUnifiedPlan) {\n let transceiver = config.pc.getTransceivers().find(t => t.receiver.track === ev.target);\n mid = transceiver.mid;\n }\n\n this.emit('remoteTrackMuted', {\n id: handle.handleId,\n mid,\n userId: (_decodeJanusDisplay19 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay19 === void 0 ? void 0 : _decodeJanusDisplay19.userId,\n role: (_decodeJanusDisplay20 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay20 === void 0 ? void 0 : _decodeJanusDisplay20.role,\n stream: config.stream,\n kind: ev.target.kind,\n track: ev.target,\n muted: false\n });\n };\n }\n };\n }\n }\n\n if (!config.dataChannel || !config.dataChannelOpen) {\n config.dataChannel = {};\n\n var onDataChannelMessage = event => {\n this._handleDataEvents(handleId, 'message', event.data);\n };\n\n var onDataChannelStateChange = event => {\n let label = event.target.label;\n let protocol = event.target.protocol;\n let state = config.dataChannel[label] ? config.dataChannel[label].readyState : \"null\";\n\n this._handleDataEvents(handleId, 'state', {\n state,\n label\n });\n }; //TODO: check this\n\n\n var onDataChannelError = error => {\n var _error$channel;\n\n this._handleDataEvents(handleId, 'error', {\n label: error === null || error === void 0 ? void 0 : (_error$channel = error.channel) === null || _error$channel === void 0 ? void 0 : _error$channel.label,\n error\n });\n };\n\n const createDataChannel = (label, protocol, incoming) => {\n let options = {\n ordered: true\n };\n\n if (!incoming) {\n if (protocol) {\n options = { ...options,\n protocol\n };\n }\n\n config.dataChannel[label] = config.pc.createDataChannel(label, options);\n } else {\n config.dataChannel[label] = incoming;\n }\n\n config.dataChannel[label].onmessage = onDataChannelMessage;\n config.dataChannel[label].onopen = onDataChannelStateChange;\n config.dataChannel[label].onclose = onDataChannelStateChange;\n config.dataChannel[label].onerror = onDataChannelError;\n };\n\n createDataChannel(this.defaultDataChannelLabel, null, null);\n\n config.pc.ondatachannel = function (event) {\n createDataChannel(event.channel.label, event.channel.protocol, event.channel);\n };\n }\n }\n\n _webrtcPeer(handleId, jsep) {\n let handle = this._getHandle(handleId);\n\n if (!handle) {\n return Promise.reject({\n type: 'warning',\n id: 15,\n message: 'id non-existent',\n data: [handleId, 'rtc peer']\n });\n }\n\n var config = handle.webrtcStuff;\n\n if (jsep !== undefined && jsep !== null) {\n if (config.pc === null) {\n this._log(\"No PeerConnection: if this is an answer, use createAnswer and not _webrtcPeer\");\n\n return Promise.resolve(null);\n }\n\n return config.pc.setRemoteDescription(jsep).then(() => {\n config.remoteSdp = jsep.sdp; // Any trickle candidate we cached?\n\n if (config.candidates && config.candidates.length > 0) {\n for (var i = 0; i < config.candidates.length; i++) {\n var candidate = config.candidates[i];\n\n if (!candidate || candidate.completed === true) {\n config.pc.addIceCandidate(null);\n } else {\n config.pc.addIceCandidate(candidate);\n }\n }\n\n config.candidates = [];\n } // Done\n\n\n return true;\n });\n } else {\n return Promise.reject({\n type: 'warning',\n id: 22,\n message: 'rtc peer',\n data: [handleId, 'invalid jsep']\n });\n }\n }\n\n _iceRestart(handleId) {\n let handle = this._getHandle(handleId);\n\n if (!handle) {\n return;\n }\n\n var config = handle.webrtcStuff; // Already restarting;\n\n if (config.isIceRestarting) {\n return;\n }\n\n if (this.handleId === handleId) {\n this._log('Performing local ICE restart');\n\n config.isIceRestarting = true;\n let hasAudio = !!(config.stream && config.stream.getAudioTracks().length > 0);\n let hasVideo = !!(config.stream && config.stream.getVideoTracks().length > 0);\n\n this._createAO('offer', handleId, true, [hasAudio, false, hasVideo, false]).then(jsep => {\n if (!jsep) {\n return null;\n }\n\n return this.sendMessage(handleId, {\n body: {\n \"request\": \"configure\",\n \"audio\": hasAudio,\n \"video\": hasVideo,\n \"data\": true,\n ...(this.recordingFilename ? {\n filename: this.recordingFilename\n } : {})\n },\n jsep\n });\n }).then(r => {\n config.isIceRestarting = false;\n\n this._log('ICE restart success');\n }).catch(e => {\n config.isIceRestarting = false;\n this.emit('warning', {\n type: 'error',\n id: 28,\n message: 'iceRestart failed',\n data: e\n });\n });\n } else {\n this._log('Performing remote ICE restart', handleId);\n\n config.isIceRestarting = true;\n return this.sendMessage(handleId, {\n body: {\n \"request\": \"configure\",\n \"restart\": true\n }\n }).then(() => {\n config.isIceRestarting = false;\n }).catch(() => {\n config.isIceRestarting = false;\n });\n }\n }\n\n _createAO() {\n let type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'offer';\n let handleId = arguments.length > 1 ? arguments[1] : undefined;\n let iceRestart = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n let [audioSend, audioRecv, videoSend, videoRecv] = arguments.length > 3 ? arguments[3] : undefined;\n\n let handle = this._getHandle(handleId);\n\n if (!handle) {\n return Promise.reject({\n type: 'warning',\n id: 15,\n message: 'id non-existent',\n data: [handleId, 'createAO', type]\n });\n }\n\n let methodName = null;\n\n if (type === 'offer') {\n methodName = 'createOffer';\n } else {\n methodName = 'createAnswer';\n }\n\n var config = handle.webrtcStuff; // https://code.google.com/p/webrtc/issues/detail?id=3508\n\n var mediaConstraints = {};\n\n if (this.isUnifiedPlan) {\n var audioTransceiver = null,\n videoTransceiver = null;\n var transceivers = config.pc.getTransceivers();\n\n if (transceivers && transceivers.length > 0) {\n for (var i in transceivers) {\n var t = transceivers[i];\n\n if (t.sender && t.sender.track && t.sender.track.kind === \"audio\" && t.stopped === false || t.receiver && t.receiver.track && t.receiver.track.kind === \"audio\" && t.stopped === false) {\n if (!audioTransceiver) audioTransceiver = t;\n continue;\n }\n\n if (t.sender && t.sender.track && t.sender.track.kind === \"video\" && t.stopped === false || t.receiver && t.receiver.track && t.receiver.track.kind === \"video\" && t.stopped === false) {\n if (!videoTransceiver) videoTransceiver = t;\n continue;\n }\n }\n } // Handle audio (and related changes, if any)\n\n\n if (!audioSend && !audioRecv) {\n // Audio disabled: have we removed it?\n if (audioTransceiver) {\n if (audioTransceiver.setDirection) {\n audioTransceiver.setDirection(\"inactive\");\n } else {\n audioTransceiver.direction = \"inactive\";\n }\n }\n } else {\n // Take care of audio m-line\n if (audioSend && audioRecv) {\n if (audioTransceiver) {\n if (audioTransceiver.setDirection) {\n audioTransceiver.setDirection(\"sendrecv\");\n } else {\n audioTransceiver.direction = \"sendrecv\";\n }\n }\n } else if (audioSend && !audioRecv) {\n if (audioTransceiver) {\n if (audioTransceiver.setDirection) {\n audioTransceiver.setDirection(\"sendonly\");\n } else {\n audioTransceiver.direction = \"sendonly\";\n }\n }\n } else if (!audioSend && audioRecv) {\n if (audioTransceiver) {\n if (audioTransceiver.setDirection) {\n audioTransceiver.setDirection(\"recvonly\");\n } else {\n audioTransceiver.direction = \"recvonly\";\n }\n } else {\n // In theory, this is the only case where we might not have a transceiver yet\n audioTransceiver = config.pc.addTransceiver(\"audio\", {\n direction: \"recvonly\"\n });\n }\n }\n } // Handle video (and related changes, if any)\n\n\n if (!videoSend && !videoRecv) {\n if (videoTransceiver) {\n if (videoTransceiver.setDirection) {\n videoTransceiver.setDirection(\"inactive\");\n } else {\n videoTransceiver.direction = \"inactive\";\n }\n }\n } else {\n // Take care of video m-line\n if (videoSend && videoRecv) {\n if (videoTransceiver) {\n if (videoTransceiver.setDirection) {\n videoTransceiver.setDirection(\"sendrecv\");\n } else {\n videoTransceiver.direction = \"sendrecv\";\n }\n }\n } else if (videoSend && !videoRecv) {\n if (videoTransceiver) {\n if (videoTransceiver.setDirection) {\n videoTransceiver.setDirection(\"sendonly\");\n } else {\n videoTransceiver.direction = \"sendonly\";\n }\n }\n } else if (!videoSend && videoRecv) {\n if (videoTransceiver) {\n if (videoTransceiver.setDirection) {\n videoTransceiver.setDirection(\"recvonly\");\n } else {\n videoTransceiver.direction = \"recvonly\";\n }\n } else {\n // In theory, this is the only case where we might not have a transceiver yet\n videoTransceiver = config.pc.addTransceiver(\"video\", {\n direction: \"recvonly\"\n });\n }\n }\n }\n } else {\n if (webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__[\"default\"].browserDetails.browser === \"firefox\" || webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__[\"default\"].browserDetails.browser === \"edge\") {\n mediaConstraints = {\n offerToReceiveAudio: audioRecv,\n offerToReceiveVideo: videoRecv\n };\n } else {\n mediaConstraints = {\n mandatory: {\n OfferToReceiveAudio: audioRecv,\n OfferToReceiveVideo: videoRecv\n }\n };\n }\n }\n\n if (iceRestart) {\n mediaConstraints[\"iceRestart\"] = true;\n }\n\n return config.pc[methodName](mediaConstraints).then(function (response) {\n config.mySdp = response.sdp;\n\n let _p = config.pc.setLocalDescription(response).catch(e => {\n return Promise.reject({\n type: 'warning',\n id: 24,\n message: 'setLocalDescription',\n data: [handleId, e]\n });\n });\n\n config.mediaConstraints = mediaConstraints;\n\n if (!config.iceDone && !config.trickle) {\n // Don't do anything until we have all candidates\n return Promise.resolve(null);\n } // JSON.stringify doesn't work on some WebRTC objects anymore\n // See https://code.google.com/p/chromium/issues/detail?id=467366\n\n\n var jsep = {\n \"type\": response.type,\n \"sdp\": response.sdp\n };\n return _p.then(() => jsep);\n }, e => {\n return Promise.reject({\n type: 'warning',\n id: 25,\n message: methodName,\n data: [handleId, e]\n });\n });\n }\n\n _publishRemote(handleId, jsep) {\n let handle = this._getHandle(handleId);\n\n if (!handle) {\n return Promise.reject({\n type: 'warning',\n id: 15,\n message: 'id non-existent',\n data: [handleId, 'publish remote participant']\n });\n }\n\n this._webrtc(handleId, true);\n\n let config = handle.webrtcStuff;\n\n if (jsep) {\n return config.pc.setRemoteDescription(jsep).then(() => {\n config.remoteSdp = jsep.sdp; // Any trickle candidate we cached?\n\n if (config.candidates && config.candidates.length > 0) {\n for (var i = 0; i < config.candidates.length; i++) {\n var candidate = config.candidates[i];\n\n if (!candidate || candidate.completed === true) {\n // end-of-candidates\n config.pc.addIceCandidate(null);\n } else {\n // New candidate\n config.pc.addIceCandidate(candidate);\n }\n }\n\n config.candidates = [];\n } // Create the answer now\n\n\n return this._createAO('answer', handleId, false, [false, true, false, true]).then(_jsep => {\n if (!_jsep) {\n this.emit('error', {\n type: 'warning',\n id: 19,\n message: 'publish remote participant',\n data: [handleId, 'no jsep']\n });\n return Promise.resolve();\n }\n\n return this.sendMessage(handleId, {\n \"body\": {\n \"request\": \"start\",\n ...(this.roomId && {\n \"room\": this.roomId\n }),\n ...(this.pin && {\n pin: this.pin\n })\n },\n \"jsep\": _jsep\n });\n });\n }, e => Promise.reject({\n type: 'warning',\n id: 23,\n message: 'setRemoteDescription',\n data: [handleId, e]\n }));\n } else {\n return Promise.resolve();\n }\n } //Public methods\n\n\n publishLocal(stream) {\n let {\n keepAudio = false,\n keepVideo = false\n } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n if (this.isDisconnecting || !this.isConnected) {\n return Promise.reject({\n type: 'warning',\n id: 18,\n message: 'Either not connected or disconnecting'\n });\n }\n\n this.emit('publishing', true);\n\n let handle = this._getHandle(this.handleId);\n\n if (!handle) {\n return Promise.reject({\n type: 'error',\n id: 21,\n message: 'no local id, connect before publishing',\n data: null\n });\n }\n\n this._webrtc(this.handleId);\n\n let config = handle.webrtcStuff;\n\n if (stream) {\n if (!config.stream) {\n config.stream = stream;\n stream.getTracks().forEach(function (track) {\n config.pc.addTrack(track, stream);\n });\n } else {\n /* UPDATE Audio */\n let replaceAudio = stream.getAudioTracks().length;\n\n if (replaceAudio || !keepAudio) {\n //this will stop existing tracks\n let oldAudioStream = config.stream.getAudioTracks()[0];\n\n if (oldAudioStream) {\n config.stream.removeTrack(oldAudioStream);\n\n try {\n oldAudioStream.stop();\n } catch (e) {\n this._log(e);\n }\n }\n }\n\n if (config.pc.getSenders() && config.pc.getSenders().length) {\n if (replaceAudio && this.isUnifiedPlan) {//using replace\n } else {\n for (let index in config.pc.getSenders()) {\n let s = config.pc.getSenders()[index];\n\n if (s && s.track && s.track.kind === \"audio\") {\n config.pc.removeTrack(s);\n }\n }\n }\n }\n\n if (replaceAudio) {\n config.stream.addTrack(stream.getAudioTracks()[0]);\n var audioTransceiver = null;\n\n if (this.isUnifiedPlan) {\n let transceivers = config.pc.getTransceivers();\n\n if (transceivers && transceivers.length > 0) {\n for (let i in transceivers) {\n let t = transceivers[i];\n\n if (t.sender && t.sender.track && t.sender.track.kind === \"audio\" && t.stopped === false || t.receiver && t.receiver.track && t.receiver.track.kind === \"audio\" && t.stopped === false) {\n audioTransceiver = t;\n break;\n }\n }\n }\n }\n\n if (audioTransceiver && audioTransceiver.sender) {\n audioTransceiver.sender.replaceTrack(stream.getAudioTracks()[0]);\n } else {\n config.pc.addTrack(stream.getAudioTracks()[0], stream);\n }\n }\n /* UPDATE Video */\n\n\n let replaceVideo = stream.getVideoTracks().length;\n\n if (replaceVideo || !keepVideo) {\n let oldVideoStream = config.stream.getVideoTracks()[0];\n\n if (oldVideoStream) {\n config.stream.removeTrack(oldVideoStream);\n\n try {\n oldVideoStream.stop();\n } catch (e) {\n this._log(e);\n }\n }\n }\n\n if (config.pc.getSenders() && config.pc.getSenders().length) {\n if (replaceVideo && this.isUnifiedPlan) {//using replace\n } else {\n for (let index in config.pc.getSenders()) {\n let s = config.pc.getSenders()[index];\n\n if (s && s.track && s.track.kind === \"video\") {\n config.pc.removeTrack(s);\n }\n }\n }\n }\n\n if (replaceVideo) {\n config.stream.addTrack(stream.getVideoTracks()[0]);\n var videoTransceiver = null;\n\n if (this.isUnifiedPlan) {\n let transceivers = config.pc.getTransceivers();\n\n if (transceivers && transceivers.length > 0) {\n for (let i in transceivers) {\n let t = transceivers[i];\n\n if (t.sender && t.sender.track && t.sender.track.kind === \"video\" && t.stopped === false || t.receiver && t.receiver.track && t.receiver.track.kind === \"video\" && t.stopped === false) {\n videoTransceiver = t;\n break;\n }\n }\n }\n }\n\n if (videoTransceiver && videoTransceiver.sender) {\n //TODO: check if t.stopped === false still gets us videoTransceiver\n videoTransceiver.sender.replaceTrack(stream.getVideoTracks()[0]);\n } else {\n config.pc.addTrack(stream.getVideoTracks()[0], stream);\n }\n }\n }\n }\n\n let hasAudio = !!(stream && stream.getAudioTracks().length > 0);\n let hasVideo = !!(stream && stream.getVideoTracks().length > 0);\n let isAudioMuted = !stream || stream.getAudioTracks().length === 0 || !stream.getAudioTracks()[0].enabled;\n let isVideoMuted = !stream || stream.getVideoTracks().length === 0 || !stream.getVideoTracks()[0].enabled;\n this.isAudioEnabed = hasAudio;\n this.isVideoEnabled = hasVideo;\n this.isAudioMuted = isAudioMuted;\n this.isVideoMuted = isVideoMuted;\n return this._createAO('offer', this.handleId, false, [hasAudio, false, hasVideo, false]).then(jsep => {\n if (!jsep) {\n return null;\n } //HOTFIX: Temporary fix for Safari 13\n\n\n if (jsep.sdp && jsep.sdp.indexOf(\"\\r\\na=ice-ufrag\") === -1) {\n jsep.sdp = jsep.sdp.replace(\"\\na=ice-ufrag\", \"\\r\\na=ice-ufrag\");\n }\n\n return this.sendMessage(this.handleId, {\n body: {\n \"request\": \"configure\",\n \"audio\": hasAudio,\n \"video\": hasVideo,\n \"data\": true,\n ...(this.recordingFilename ? {\n filename: this.recordingFilename\n } : {})\n },\n jsep\n });\n }).then(r => {\n if (this._isDataChannelOpen) {\n return Promise.resolve(r);\n } else {\n return new Promise((resolve, reject) => {\n let dataChannelTimeoutId = null;\n\n let _resolve = val => {\n if (val) {\n clearTimeout(dataChannelTimeoutId);\n\n this._abortController.signal.removeEventListener('abort', _rejectAbort);\n\n this.off('dataChannel', _resolve, this);\n resolve(this);\n }\n };\n\n let _rejectTimeout = () => {\n this.off('dataChannel', _resolve, this);\n\n this._abortController.signal.removeEventListener('abort', _rejectAbort);\n\n reject({\n type: 'error',\n id: 27,\n message: 'Data channel did not open',\n data: null\n });\n };\n\n let _rejectAbort = () => {\n this._abortController.signal.removeEventListener('abort', _rejectAbort);\n\n clearTimeout(dataChannelTimeoutId);\n this.off('dataChannel', _resolve, this);\n reject({\n type: 'warning',\n id: 17,\n message: 'Connection cancelled'\n });\n };\n\n dataChannelTimeoutId = setTimeout(_rejectTimeout, 5000);\n\n this._abortController.signal.addEventListener('abort', _rejectAbort);\n\n this.on('dataChannel', _resolve, this);\n });\n }\n }).then(r => {\n this.isPublished = true;\n\n if (config.stream) {\n let tracks = config.stream.getTracks();\n tracks.forEach(track => {\n // used as a flag to not emit tracks that been already emitted\n if (!track.onended) {\n var _decodeJanusDisplay21, _decodeJanusDisplay22;\n\n this.emit('addLocalParticipant', {\n tid: Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"generateUUID\"])(),\n id: handle.handleId,\n userId: (_decodeJanusDisplay21 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay21 === void 0 ? void 0 : _decodeJanusDisplay21.userId,\n role: (_decodeJanusDisplay22 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(this.display)) === null || _decodeJanusDisplay22 === void 0 ? void 0 : _decodeJanusDisplay22.role,\n track,\n stream: config.stream,\n adding: true,\n constructId: this.constructId,\n metaData: this.options.metaData,\n hasAudioTrack: hasAudio,\n hasVideoTrack: hasVideo\n });\n\n track.onended = ev => {\n var _decodeJanusDisplay23, _decodeJanusDisplay24;\n\n this.emit('addLocalParticipant', {\n tid: Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"generateUUID\"])(),\n id: handle.handleId,\n userId: (_decodeJanusDisplay23 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay23 === void 0 ? void 0 : _decodeJanusDisplay23.userId,\n role: (_decodeJanusDisplay24 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(this.display)) === null || _decodeJanusDisplay24 === void 0 ? void 0 : _decodeJanusDisplay24.role,\n track: ev.target,\n stream: config.stream,\n adding: false,\n removing: true,\n constructId: this.constructId,\n metaData: this.options.metaData,\n hasAudioTrack: hasAudio,\n hasVideoTrack: hasVideo\n });\n };\n }\n });\n } else {\n var _decodeJanusDisplay25, _decodeJanusDisplay26;\n\n this.emit('addLocalParticipant', {\n tid: Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"generateUUID\"])(),\n id: handle.handleId,\n userId: (_decodeJanusDisplay25 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(handle.userId)) === null || _decodeJanusDisplay25 === void 0 ? void 0 : _decodeJanusDisplay25.userId,\n role: (_decodeJanusDisplay26 = Object(_wt_utils__WEBPACK_IMPORTED_MODULE_2__[\"decodeJanusDisplay\"])(this.display)) === null || _decodeJanusDisplay26 === void 0 ? void 0 : _decodeJanusDisplay26.role,\n stream: null,\n adding: false,\n constructId: this.constructId,\n metaData: this.options.metaData,\n hasAudioTrack: hasAudio,\n hasVideoTrack: hasVideo\n });\n }\n\n this.emit('published', {\n status: true,\n hasStream: !!config.stream\n });\n this.emit('publishing', false);\n this.emit('localHasVideo', hasVideo);\n this.emit('localHasAudio', hasAudio);\n this.emit('localMuted', {\n type: 'video',\n value: isVideoMuted\n });\n this.emit('localMuted', {\n type: 'audio',\n value: isAudioMuted\n });\n return r;\n }).catch(e => {\n this.emit('publishing', false);\n return Promise.reject(e);\n });\n }\n\n unpublishLocal() {\n let dontWait = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n return this.isPublished ? this.sendMessage(this.handleId, {\n body: {\n \"request\": \"unpublish\"\n }\n }, dontWait).finally(r => {\n this.isPublished = false;\n this.emit('published', {\n status: false,\n hasStream: false\n });\n return r;\n }) : Promise.resolve();\n }\n\n toggleAudio() {\n let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n let mid = arguments.length > 1 ? arguments[1] : undefined;\n\n let handle = this._getHandle(this.handleId);\n\n if (!handle) {\n return Promise.reject({\n type: 'error',\n id: 21,\n message: 'no local id, connect first',\n data: null\n });\n }\n\n let config = handle.webrtcStuff;\n\n if (this.isUnifiedPlan) {\n let transceiver = config.pc.getTransceivers().find(t => t.sender && t.sender.track && t.receiver.track.kind === \"audio\" && t.stopped === false && (mid ? t.mid === mid : true));\n\n if (transceiver) {\n transceiver.sender.track.enabled = value !== null ? !!value : !transceiver.sender.track.enabled;\n }\n\n this.isAudioMuted = !transceiver || !transceiver.sender.track.enabled;\n } else {\n if (config.stream && config.stream.getAudioTracks().length) {\n config.stream.getAudioTracks()[0].enabled = value !== null ? !!value : !config.stream.getAudioTracks()[0].enabled;\n }\n\n this.isAudioMuted = config.stream.getAudioTracks().length === 0 || !config.stream.getAudioTracks()[0].enabled;\n }\n\n this.emit('localMuted', {\n type: 'audio',\n value: this.isAudioMuted,\n mid\n });\n }\n\n toggleVideo() {\n let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n let mid = arguments.length > 1 ? arguments[1] : undefined;\n\n let handle = this._getHandle(this.handleId);\n\n if (!handle) {\n return Promise.reject({\n type: 'error',\n id: 21,\n message: 'no local id, connect first',\n data: null\n });\n }\n\n let config = handle.webrtcStuff;\n\n if (this.isUnifiedPlan) {\n let transceiver = config.pc.getTransceivers().find(t => t.sender && t.sender.track && t.receiver.track.kind === \"video\" && t.stopped === false && (mid ? t.mid === mid : true));\n\n if (transceiver) {\n transceiver.sender.track.enabled = value !== null ? !!value : !transceiver.sender.track.enabled;\n }\n\n this.isVideoMuted = !transceiver || !transceiver.sender.track.enabled;\n } else {\n if (config.stream && config.stream.getVideoTracks().length) {\n config.stream.getVideoTracks()[0].enabled = value !== null ? !!value : !config.stream.getVideoTracks()[0].enabled;\n }\n\n this.isVideoMuted = config.stream.getVideoTracks().length === 0 || !config.stream.getVideoTracks()[0].enabled;\n }\n\n this.emit('localMuted', {\n type: 'video',\n value: this.isVideoMuted,\n mid\n });\n }\n\n setRoomType() {\n let type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'watchparty';\n this._roomType = type;\n return this._roomType;\n }\n\n}\n\n_defineProperty(RoomSession, \"sessionTypes\", {\n 'reactooroom': 'janus.plugin.reactooroom',\n 'streaming': 'janus.plugin.streaming'\n});\n\n_defineProperty(RoomSession, \"subscriptionRules\", {\n participant: {\n \"watchparty\": ['participant', 'talkback'],\n \"commentary\": ['participant', 'talkback', 'host'],\n \"videowall\": ['host', 'talkback', 'observer', 'observerSolo1', 'observerSolo2', 'observerSolo3'],\n \"videowall-queue\": ['host', 'talkback', 'observer', 'observerSolo1', 'observerSolo2', 'observerSolo3'],\n \"videowall-queue-video\": ['host', 'talkback', 'observer', 'observerSolo1', 'observerSolo2', 'observerSolo3']\n },\n monitor: {\n \"watchparty\": ['participant'],\n \"commentary\": ['participant', 'host'],\n \"videowall\": ['host', 'participant'],\n \"videowall-queue\": ['host', 'participant'],\n \"videowall-queue-video\": ['host', 'participant']\n },\n talkback: {\n \"watchparty\": ['participant'],\n \"commentary\": ['host', 'participant'],\n \"videowall\": ['host', 'participant'],\n \"videowall-queue\": ['host', 'participant'],\n \"videowall-queue-video\": ['host', 'participant']\n },\n observer: {\n \"watchparty\": ['participant'],\n \"commentary\": ['participant'],\n \"videowall\": ['participant'],\n \"videowall-queue\": ['participant'],\n \"videowall-queue-video\": ['participant']\n },\n observerSolo1: {\n \"watchparty\": ['participant'],\n \"commentary\": ['participant'],\n \"videowall\": ['participant'],\n \"videowall-queue\": ['participant'],\n \"videowall-queue-video\": ['participant']\n },\n observerSolo2: {\n \"watchparty\": ['participant'],\n \"commentary\": ['participant'],\n \"videowall\": ['participant'],\n \"videowall-queue\": ['participant'],\n \"videowall-queue-video\": ['participant']\n },\n observerSolo3: {\n \"watchparty\": ['participant'],\n \"commentary\": ['participant'],\n \"videowall\": ['participant'],\n \"videowall-queue\": ['participant'],\n \"videowall-queue-video\": ['participant']\n },\n host: {\n \"watchparty\": [],\n \"commentary\": [],\n \"videowall\": [],\n \"videowall-queue\": [],\n \"videowall-queue-video\": []\n },\n companionTV: {},\n companionPhone: {}\n});\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Room);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/wt-room.js?");
|
|
9431
9476
|
|
|
9432
9477
|
/***/ }),
|
|
9433
9478
|
|
|
@@ -9439,7 +9484,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var webr
|
|
|
9439
9484
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9440
9485
|
|
|
9441
9486
|
"use strict";
|
|
9442
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"wait\", function() { return wait; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getBrowserFingerprint\", function() { return getBrowserFingerprint; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"generateUUID\", function() { return generateUUID; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"decodeJanusDisplay\", function() { return decodeJanusDisplay; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"setExactTimeout\", function() { return setExactTimeout; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"clearExactTimeout\", function() { return clearExactTimeout; });\n/* harmony import */ var _fingerprintjs_fingerprintjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @fingerprintjs/fingerprintjs */ \"./node_modules/@fingerprintjs/fingerprintjs/dist/fp.esm.js\");\n/* harmony import */ var _fingerprintjs_fingerprintjs_pro__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @fingerprintjs/fingerprintjs-pro */ \"./node_modules/@fingerprintjs/fingerprintjs-pro/dist/fp.esm.min.js\");\n\n\n\nlet wait = function (ms) {\n return new Promise(resolve => setTimeout(resolve, ms));\n};\n\nlet fingerprint = _fingerprintjs_fingerprintjs__WEBPACK_IMPORTED_MODULE_0__[\"default\"].load({\n monitoring: false\n});\nlet fingerprintPro = _fingerprintjs_fingerprintjs_pro__WEBPACK_IMPORTED_MODULE_1__[\"default\"].load({\n monitoring: false,\n apiKey: '5UHdpSuX3wHr3CjyEiSP',\n endpoint: \"https://fingerprint.reactoo.com\"\n});\n\nlet getBrowserFingerprint = function () {\n let instanceType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n let usePrecise = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n let salt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n\n if (!usePrecise) {\n return fingerprint.then(fp => fp.get()).then(result => {\n const components = { ...result.components,\n instanceType: {\n value: instanceType + '_' + salt\n }\n };\n return [8, 13, 18, 23].reduce((acc, cur) => {\n return acc.slice(0, cur) + '-' + acc.slice(cur);\n }, _fingerprintjs_fingerprintjs__WEBPACK_IMPORTED_MODULE_0__[\"default\"].hashComponents(components)).substring(0, 36);\n });\n } else {\n return fingerprintPro.then(fp => fp.get()).then(result => {\n let id = result.visitorId.padEnd(32, '0');\n return [8, 13, 18, 23].reduce((acc, cur) => {\n return acc.slice(0, cur) + '-' + acc.slice(cur);\n }, id).substring(0, 36);\n });\n }\n};\n\nlet generateUUID = function () {\n var d = Date.now();\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = (d + Math.random() * 16) % 16 | 0;\n d = Math.floor(d / 16);\n return (c == 'x' ? r : r & 0x3 | 0x8).toString(16);\n });\n};\n\nconst janusDisplayDelimiter = ',';\n\nconst decodeJanusDisplay = display => {\n let output = {\n userId: null,\n role: \"participant\",\n start: Date.now(),\n displayName: \"?\"\n };\n\n if (display && typeof display === \"string\") {\n if (display.indexOf(janusDisplayDelimiter) >= 0) {\n let values = display.split(new RegExp(
|
|
9487
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"wait\", function() { return wait; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getBrowserFingerprint\", function() { return getBrowserFingerprint; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"generateUUID\", function() { return generateUUID; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"decodeJanusDisplay\", function() { return decodeJanusDisplay; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"setExactTimeout\", function() { return setExactTimeout; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"clearExactTimeout\", function() { return clearExactTimeout; });\n/* harmony import */ var _fingerprintjs_fingerprintjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @fingerprintjs/fingerprintjs */ \"./node_modules/@fingerprintjs/fingerprintjs/dist/fp.esm.js\");\n/* harmony import */ var _fingerprintjs_fingerprintjs_pro__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @fingerprintjs/fingerprintjs-pro */ \"./node_modules/@fingerprintjs/fingerprintjs-pro/dist/fp.esm.min.js\");\n\n\n\nlet wait = function (ms) {\n return new Promise(resolve => setTimeout(resolve, ms));\n};\n\nlet fingerprint = _fingerprintjs_fingerprintjs__WEBPACK_IMPORTED_MODULE_0__[\"default\"].load({\n monitoring: false\n});\nlet fingerprintPro = _fingerprintjs_fingerprintjs_pro__WEBPACK_IMPORTED_MODULE_1__[\"default\"].load({\n monitoring: false,\n apiKey: '5UHdpSuX3wHr3CjyEiSP',\n endpoint: \"https://fingerprint.reactoo.com\"\n});\n\nlet getBrowserFingerprint = function () {\n let instanceType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n let usePrecise = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n let salt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n\n if (!usePrecise) {\n return fingerprint.then(fp => fp.get()).then(result => {\n const components = { ...result.components,\n instanceType: {\n value: instanceType + '_' + salt\n }\n };\n return [8, 13, 18, 23].reduce((acc, cur) => {\n return acc.slice(0, cur) + '-' + acc.slice(cur);\n }, _fingerprintjs_fingerprintjs__WEBPACK_IMPORTED_MODULE_0__[\"default\"].hashComponents(components)).substring(0, 36);\n });\n } else {\n return fingerprintPro.then(fp => fp.get()).then(result => {\n let id = result.visitorId.padEnd(32, '0');\n return [8, 13, 18, 23].reduce((acc, cur) => {\n return acc.slice(0, cur) + '-' + acc.slice(cur);\n }, id).substring(0, 36);\n });\n }\n};\n\nlet generateUUID = function () {\n var d = Date.now();\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = (d + Math.random() * 16) % 16 | 0;\n d = Math.floor(d / 16);\n return (c == 'x' ? r : r & 0x3 | 0x8).toString(16);\n });\n};\n\nconst janusDisplayDelimiter = ',';\n\nconst decodeJanusDisplay = display => {\n let output = {\n userId: null,\n role: \"participant\",\n start: Date.now(),\n displayName: \"?\"\n };\n\n if (display && typeof display === \"string\") {\n if (display.indexOf(janusDisplayDelimiter) >= 0) {\n let values = display.split(new RegExp(`\\\\${janusDisplayDelimiter}(?=(?:(?:[^\"]*\"){2})*[^\"]*$)`, 'mi')).map(v => v && v.startsWith('\"') || v.endsWith('\"') ? v.substring(1, v.length - 1) : /^\\d+$/.test(v) ? parseInt(v) : v);\n Object.keys(output).forEach((key, i) => values[i] ? output[key] = values[i] : null);\n } else {\n output.userId = display;\n }\n\n return output;\n } else if (display && typeof display === \"object\") {\n return Object.assign({}, output, display);\n }\n\n return null;\n};\n\nconst setExactTimeout = function (callback, duration, resolution) {\n const start = new Date().getTime();\n const timeout = setInterval(function () {\n if (new Date().getTime() - start > duration) {\n callback();\n clearInterval(timeout);\n }\n }, resolution);\n return timeout;\n};\n\nconst clearExactTimeout = function (timeout) {\n clearInterval(timeout);\n};\n\n\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/wt-utils.js?");
|
|
9443
9488
|
|
|
9444
9489
|
/***/ }),
|
|
9445
9490
|
|